Skip to content

Commit d46d356

Browse files
gkelloggdavidlehn
authored andcommitted
Apply suggestion from @davidlehn on use of Object.fromEntries.
1 parent 4d53f39 commit d46d356

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

lib/expand.js

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -518,15 +518,12 @@ async function _expandObject({
518518
// if framing, can be a default object, but need to expand
519519
// key to determine that
520520
if(_isObject(value)) {
521-
const expandedValue = {};
522-
for(const [k, v] of Object.entries(value)) {
523-
const kk = _expandIri(typeScopedContext, k, {vocab: true});
524-
const vv = _asArray(v).map(vvv =>
525-
_expandIri(typeScopedContext, vvv, {base: true, vocab: true})
526-
);
527-
expandedValue[kk] = vv;
528-
}
529-
value = expandedValue;
521+
value = Object.fromEntries(Object.entries(value).map(([k, v]) => [
522+
_expandIri(typeScopedContext, k, {vocab: true}),
523+
_asArray(v).map(vv =>
524+
_expandIri(typeScopedContext, vv, {base: true, vocab: true})
525+
)
526+
]));
530527
}
531528
_validateTypeValue(value, options.isFrame);
532529
_addValue(

0 commit comments

Comments
 (0)