Skip to content

Commit ba0aca9

Browse files
tplookerdavidlehn
authored andcommitted
fix: duplicate expansionMap logic
1 parent 7463ebc commit ba0aca9

File tree

1 file changed

+6
-40
lines changed

1 file changed

+6
-40
lines changed

lib/expand.js

Lines changed: 6 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -508,27 +508,10 @@ async function _expandObject({
508508
}
509509
}
510510

511-
const expandedValues = _asArray(value).map(v =>
512-
_isString(v) ? _expandIri(activeCtx, v, {base: true}, options) : v);
513-
514-
for(const i in expandedValues) {
515-
if(_isString(expandedValues[i]) && !_isAbsoluteIri(expandedValues[i])) {
516-
const expansionMapResult = await expansionMap({
517-
relativeIri: {type: key, value: expandedValues[i]},
518-
activeCtx,
519-
activeProperty,
520-
options,
521-
insideList
522-
});
523-
if(expansionMapResult !== undefined) {
524-
expandedValues[i] = expansionMapResult;
525-
}
526-
}
527-
}
528-
529511
_addValue(
530512
expandedParent, '@id',
531-
expandedValues,
513+
_asArray(value).map(v =>
514+
_isString(v) ? _expandIri(activeCtx, v, {base: true}, options) : v),
532515
{propertyIsArray: options.isFrame});
533516
continue;
534517
}
@@ -546,29 +529,12 @@ async function _expandObject({
546529
}
547530
_validateTypeValue(value, options.isFrame);
548531

549-
const expandedValues = _asArray(value).map(v =>
550-
_isString(v) ?
551-
_expandIri(typeScopedContext, v,
552-
{base: true, vocab: true}, options) : v);
553-
554-
for(const i in expandedValues) {
555-
if(_isString(expandedValues[i]) && !_isAbsoluteIri(expandedValues[i])) {
556-
const expansionMapResult = await expansionMap({
557-
relativeIri: {type: key, value: expandedValues[i]},
558-
activeCtx,
559-
activeProperty,
560-
options,
561-
insideList
562-
});
563-
if(expansionMapResult !== undefined) {
564-
expandedValues[i] = expansionMapResult;
565-
}
566-
}
567-
}
568-
569532
_addValue(
570533
expandedParent, '@type',
571-
expandedValues,
534+
_asArray(value).map(v =>
535+
_isString(v) ?
536+
_expandIri(typeScopedContext, v,
537+
{base: true, vocab: true}, options) : v),
572538
{propertyIsArray: options.isFrame});
573539
continue;
574540
}

0 commit comments

Comments
 (0)