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

Commit 4c76313

Browse files
committed
refactor(core): prevent redundant checks
1 parent 40de393 commit 4c76313

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

packages/api-elements/lib/define-value-of.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ function hasTypeAttribute(e, attribute) {
2222
if (undefined !== e._attributes) {
2323
const attrs = e.attributes.get('typeAttributes');
2424
if (undefined !== attrs && undefined !== attrs.content) {
25-
return undefined !== attrs.content.find(attr => attr.content === attribute);
25+
return attrs.content.some(attr => attr.content === attribute);
2626
}
2727
}
2828
return false;
@@ -93,10 +93,8 @@ module.exports = (namespace) => {
9393
return undefined;
9494
}
9595

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

10199
function mapValue(e, options, f, elements) {
102100
const opts = updateTypeAttributes(e, options);

0 commit comments

Comments
 (0)