MCPcopy Create free account
hub / github.com/codemix/graph / properties

Method properties

packages/graph/src/Traversals.ts:2269–2292  ·  view source on GitHub ↗
(...propertyNames: TPropertyNames)

Source from the content-addressed store, hash-verified

2267 ...propertyNames: TPropertyNames
2268 ): ValueTraversal<TSchema, Pick<GetTraversalPathProperties<TPath>, TPropertyNames[number]>>;
2269 public properties<
2270 const TPropertyNames extends readonly (keyof GetTraversalPathProperties<TPath>)[],
2271 >(...propertyNames: TPropertyNames) {
2272 return new ValueTraversal<
2273 TSchema,
2274 Pick<GetTraversalPathProperties<TPath>, TPropertyNames[number]>
2275 >(this.graph, [
2276 ...this.steps,
2277 new MapElementsStep<any>({
2278 mapper: (path) => {
2279 const value = path.value;
2280 const storedProps = value[$StoredElement].properties;
2281 if (propertyNames.length === 0) {
2282 return storedProps;
2283 }
2284 const properties = {} as any;
2285 for (const propertyName of propertyNames) {
2286 properties[propertyName] = storedProps[propertyName as keyof typeof storedProps];
2287 }
2288 return properties;
2289 },
2290 }),
2291 ]);
2292 }
2293
2294 /**
2295 * Map each edge in the traversal to a new value.

Calls

no outgoing calls

Tested by

no test coverage detected