Skip to content

Commit

Permalink
Fixed linting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Relequestual authored and tajo committed Apr 19, 2017
1 parent 49d2328 commit b2547db
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions components/constraints.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
const React = require('react');
const Component = require('react-pure-render/component');
const ImmutablePropTypes = require('react-immutable-proptypes');
const _ = require('lodash/core');

class Constraints extends Component {
Expand All @@ -9,6 +8,16 @@ class Constraints extends Component {
constraints: React.PropTypes.object,
};

considerType(value) {
if (_.isString(value)) {
return `"${value}"`;
}
if (_.isNull(value)) {
return 'null';
}
return value;
}

render() {
const { constraints } = this.props;
if (!constraints) return <div />;
Expand All @@ -35,9 +44,10 @@ class Constraints extends Component {
}

{constraints.get('enum') ?
<li>valid values: {constraints.get('enum').valueSeq().map( value =>
<li>valid values: {constraints.get('enum').valueSeq().map(value =>
<code key={value}>{this.considerType(value)}</code>
).reduce( (prev, curr) => [prev, ', ', curr] ) }</li>
)
.reduce((prev, curr) => [prev, ', ', curr])}</li>
:
constraints.get('type') === 'boolean' && <li>valid values: (true,false)</li>
}
Expand All @@ -49,17 +59,6 @@ class Constraints extends Component {
);
}

considerType (value) {

if(_.isString(value)){
return "\"" + value + "\"";
}
if(_.isNull(value)){
return "null";
}
return value;
}

}

module.exports = Constraints;

0 comments on commit b2547db

Please sign in to comment.