Spaces:
Paused
Paused
Download node_modules/graphql/jsutils/Path.mjs from sam522/GenAI_Course: direct link, hf CLI and curl.
- Browser
- Download file 421 Bytes
-
https://huggingface.co/spaces/sam522/GenAI_Course/resolve/bbf0eafbb40cb551e2f40f8ad8a90a585be08221/node_modules/graphql/jsutils/Path.mjs
- Command line
-
hf download hf://spaces/sam522/GenAI_Course@bbf0eafbb40cb551e2f40f8ad8a90a585be08221/node_modules/graphql/jsutils/Path.mjs
-
curl -L -o Path.mjs https://huggingface.co/spaces/sam522/GenAI_Course/resolve/bbf0eafbb40cb551e2f40f8ad8a90a585be08221/node_modules/graphql/jsutils/Path.mjs
421 Bytes
| /** | |
| * Given a Path and a key, return a new Path containing the new key. | |
| */ | |
| export function addPath(prev, key, typename) { | |
| return { | |
| prev, | |
| key, | |
| typename, | |
| }; | |
| } | |
| /** | |
| * Given a Path, return an Array of the path keys. | |
| */ | |
| export function pathToArray(path) { | |
| const flattened = []; | |
| let curr = path; | |
| while (curr) { | |
| flattened.push(curr.key); | |
| curr = curr.prev; | |
| } | |
| return flattened.reverse(); | |
| } | |