Skip to content
This repository has been archived by the owner on Nov 8, 2024. It is now read-only.

Commit

Permalink
refactor(core): prevent redundant checks
Browse files Browse the repository at this point in the history
  • Loading branch information
kylef committed Jun 20, 2019
1 parent 40de393 commit 4c76313
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions packages/api-elements/lib/define-value-of.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function hasTypeAttribute(e, attribute) {
if (undefined !== e._attributes) {
const attrs = e.attributes.get('typeAttributes');
if (undefined !== attrs && undefined !== attrs.content) {
return undefined !== attrs.content.find(attr => attr.content === attribute);
return attrs.content.some(attr => attr.content === attribute);
}
}
return false;
Expand Down Expand Up @@ -93,10 +93,8 @@ module.exports = (namespace) => {
return undefined;
}

// TODO e instanceof EnumElement fails because of dependency injection
// checking for e.element === 'enum' as a temporary walkaround
const isEnumElement = e => (e.element === 'enum' || e instanceof EnumElement);
const isPlural = e => (e instanceof ArrayElement) || (e instanceof ObjectElement);
const isEnumElement = e => e instanceof EnumElement;
const isPlural = e => e instanceof ArrayElement;

function mapValue(e, options, f, elements) {
const opts = updateTypeAttributes(e, options);
Expand Down

0 comments on commit 4c76313

Please sign in to comment.