diff --git a/packages/jsonld-dataset-proxy/src/setProxy/ldSet/BasicLdSet.ts b/packages/jsonld-dataset-proxy/src/setProxy/ldSet/BasicLdSet.ts index d9cd776..5c11633 100644 --- a/packages/jsonld-dataset-proxy/src/setProxy/ldSet/BasicLdSet.ts +++ b/packages/jsonld-dataset-proxy/src/setProxy/ldSet/BasicLdSet.ts @@ -34,12 +34,12 @@ export class BasicLdSet extends Set implements LdSet { } } - map(callbackfn: (value: T, set: LdSet) => U, thisArg?: any): LdSet { - const newSet = new BasicLdSet(); + map(callbackfn: (value: T, set: LdSet) => U, thisArg?: any): U[] { + const returnValues: U[] = []; for (const value of this) { - newSet.add(callbackfn.call(thisArg, value, this)); + returnValues.push(callbackfn.call(thisArg, value, this)); } - return newSet; + return returnValues; } filter( diff --git a/packages/jsonld-dataset-proxy/src/setProxy/ldSet/LdSet.ts b/packages/jsonld-dataset-proxy/src/setProxy/ldSet/LdSet.ts index 9938639..1c76708 100644 --- a/packages/jsonld-dataset-proxy/src/setProxy/ldSet/LdSet.ts +++ b/packages/jsonld-dataset-proxy/src/setProxy/ldSet/LdSet.ts @@ -96,7 +96,7 @@ interface LdSet extends Set { * @param callbackfn A function that accepts up to two arguments. The map method calls the callbackfn function one time for each element in the set. * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. */ - map(callbackfn: (value: T, set: LdSet) => U, thisArg?: any): LdSet; + map(callbackfn: (value: T, set: LdSet) => U, thisArg?: any): U[]; /** * Returns the elements of a set that meet the condition specified in a callback function. * @param predicate A function that accepts up to two arguments. The filter method calls the predicate function one time for each element in the set.