Spaces:
Runtime error
Runtime error
Download static/node_modules/mongoose/lib/cast/bigint.js from kaab4321/NarrativeFlow: direct link, hf CLI and curl.
- Browser
- Download file 708 Bytes
-
https://huggingface.co/spaces/kaab4321/NarrativeFlow/resolve/main/static/node_modules/mongoose/lib/cast/bigint.js
- Command line
-
hf download hf://spaces/kaab4321/NarrativeFlow/static/node_modules/mongoose/lib/cast/bigint.js
-
curl -L -o bigint.js https://huggingface.co/spaces/kaab4321/NarrativeFlow/resolve/main/static/node_modules/mongoose/lib/cast/bigint.js
708 Bytes
| ; | |
| const assert = require('assert'); | |
| const { Long } = require('bson'); | |
| /** | |
| * Given a value, cast it to a BigInt, or throw an `Error` if the value | |
| * cannot be casted. `null` and `undefined` are considered valid. | |
| * | |
| * @param {Any} value | |
| * @return {Number} | |
| * @throws {Error} if `value` is not one of the allowed values | |
| * @api private | |
| */ | |
| module.exports = function castBigInt(val) { | |
| if (val == null) { | |
| return val; | |
| } | |
| if (val === '') { | |
| return null; | |
| } | |
| if (typeof val === 'bigint') { | |
| return val; | |
| } | |
| if (val instanceof Long) { | |
| return val.toBigInt(); | |
| } | |
| if (typeof val === 'string' || typeof val === 'number') { | |
| return BigInt(val); | |
| } | |
| assert.ok(false); | |
| }; | |