Download src/lib/db/helpers/jsonCol.js from shimen/kirway: direct link, hf CLI and curl.
- Browser
- Download file 274 Bytes
-
https://huggingface.co/spaces/shimen/kirway/resolve/main/src/lib/db/helpers/jsonCol.js
- Command line
-
hf download hf://spaces/shimen/kirway/src/lib/db/helpers/jsonCol.js
-
curl -L -o jsonCol.js https://huggingface.co/spaces/shimen/kirway/resolve/main/src/lib/db/helpers/jsonCol.js
274 Bytes
| export function parseJson(str, fallback = null) { | |
| if (str == null) return fallback; | |
| if (typeof str !== "string") return str; | |
| try { return JSON.parse(str); } catch { return fallback; } | |
| } | |
| export function stringifyJson(value) { | |
| return JSON.stringify(value ?? null); | |
| } | |