MCPcopy Create free account
hub / github.com/blacksmithgu/datacore / to

Method to

src/api/data-array.ts:404–415  ·  view source on GitHub ↗
(key: string)

Source from the content-addressed store, hash-verified

402 }
403
404 public to(key: string): DataArray<unknown> {
405 let result: unknown[] = [];
406 for (let child of this.values) {
407 let value = (child as Record<string, unknown>)[key];
408 if (value === undefined || value === null) continue;
409
410 if (Array.isArray(value) || DataArray.isDataArray(value)) value.forEach((v) => result.push(v));
411 else result.push(value);
412 }
413
414 return this.lwrap(result);
415 }
416
417 public into(key: string): DataArray<unknown> {
418 let result: unknown[] = [];

Callers

nothing calls this directly

Calls 2

lwrapMethod · 0.95
forEachMethod · 0.65

Tested by

no test coverage detected