Spaces:
Runtime error
Runtime error
Download static/node_modules/mongoose/lib/helpers/schema/getKeysInSchemaOrder.js from kaab4321/NarrativeFlow: direct link, hf CLI and curl.
- Browser
- Download file 621 Bytes
-
https://huggingface.co/spaces/kaab4321/NarrativeFlow/resolve/main/static/node_modules/mongoose/lib/helpers/schema/getKeysInSchemaOrder.js
- Command line
-
hf download hf://spaces/kaab4321/NarrativeFlow/static/node_modules/mongoose/lib/helpers/schema/getKeysInSchemaOrder.js
-
curl -L -o getKeysInSchemaOrder.js https://huggingface.co/spaces/kaab4321/NarrativeFlow/resolve/main/static/node_modules/mongoose/lib/helpers/schema/getKeysInSchemaOrder.js
621 Bytes
| ; | |
| const get = require('../get'); | |
| module.exports = function getKeysInSchemaOrder(schema, val, path) { | |
| const schemaKeys = path != null ? Object.keys(get(schema.tree, path, {})) : Object.keys(schema.tree); | |
| const valKeys = new Set(Object.keys(val)); | |
| let keys; | |
| if (valKeys.size > 1) { | |
| keys = new Set(); | |
| for (const key of schemaKeys) { | |
| if (valKeys.has(key)) { | |
| keys.add(key); | |
| } | |
| } | |
| for (const key of valKeys) { | |
| if (!keys.has(key)) { | |
| keys.add(key); | |
| } | |
| } | |
| keys = Array.from(keys); | |
| } else { | |
| keys = Array.from(valKeys); | |
| } | |
| return keys; | |
| }; | |