Download chakra-ui/packages/react/src/utils/flatten.ts from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 379 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/f5071caa249115f3b590492f1c8eb471e02aae4b/chakra-ui/packages/react/src/utils/flatten.ts
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset@f5071caa249115f3b590492f1c8eb471e02aae4b/chakra-ui/packages/react/src/utils/flatten.ts
-
curl -L -o flatten.ts https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/f5071caa249115f3b590492f1c8eb471e02aae4b/chakra-ui/packages/react/src/utils/flatten.ts
379 Bytes
| import { type WalkObjectStopFn, walkObject } from "./walk-object" | |
| export function flatten( | |
| values: Record<string, Record<string, any>>, | |
| stop?: WalkObjectStopFn, | |
| ) { | |
| const result: Record<string, any> = {} | |
| walkObject( | |
| values, | |
| (token, paths) => { | |
| if (token) { | |
| result[paths.join(".")] = token.value | |
| } | |
| }, | |
| { stop }, | |
| ) | |
| return result | |
| } | |