UNPKG

@cloudpss/ubjson

Version:

Opinionated UBJSON encoder/decoder for CloudPSS.

22 lines 705 B
const getType = (obj) => Object.prototype.toString.call(obj).slice(8, -1); /** unsupported view */ export function unsupportedView(view) { const type = getType(view); throw new Error(`Unsupported array buffer view of type ${type}`); } /** unsupported type */ export function unsupportedType(value) { if (value && typeof value == 'string') { throw new Error(`Unsupported type ${value}`); } const type = getType(value); throw new Error(`Unsupported type ${type}`); } /** 未结束的流 */ export class UnexpectedEofError extends Error { constructor() { super('Unexpected EOF'); this.name = 'UnexpectedEofError'; } } //# sourceMappingURL=errors.js.map