Devendra174's picture
Upload folder using huggingface_hub
1e92f2d verified
raw
history blame contribute delete
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
}