UNPKG

quadstore

Version:

Quadstore is a LevelDB-backed RDF graph database / triplestore for JavaScript runtimes (browsers, Node.js, Deno, Bun, ...) that implements the RDF/JS interfaces and supports SPARQL queries and querying across named graphs.

36 lines 1.21 kB
export const sliceString = (source, offset, length) => { return source.slice(offset, offset + length); }; export const LENGTH_OF_ENCODED_TERM_LENGTH = 4; export const encodeTermLength = (val) => { if (val < 36) return `000${val.toString(36)}`; if (val < 1_296) return `00${val.toString(36)}`; if (val < 46_656) return `0${val.toString(36)}`; if (val < 1_679_616) return val.toString(36); throw new Error('term serialization exceeded maximum limit of 1_679_616 characters'); }; export const decodeTermLength = (str) => { return parseInt(str, 36); }; export const LENGTH_OF_ENCODED_QUAD_LENGTH = 5; export const encodeQuadLength = (val) => { if (val < 36) return `0000${val.toString(36)}`; if (val < 1_296) return `000${val.toString(36)}`; if (val < 46_656) return `00${val.toString(36)}`; if (val < 1_679_616) return `0${val.toString(36)}`; if (val < 60_466_176) return val.toString(36); throw new Error('quad serialization exceeded maximum limit of 60_466_176 characters'); }; export const decodeQuadLength = (str) => { return parseInt(str, 36); }; //# sourceMappingURL=utils.js.map