93dd3f8a9aaba7b85a89d5fc960ead5e44cdc69d186ce54cfef3646a9a62776f.json raw

   1  {"ast":null,"code":"function number(n) {\n  if (!Number.isSafeInteger(n) || n < 0) throw new Error(`Wrong positive integer: ${n}`);\n}\nfunction bool(b) {\n  if (typeof b !== 'boolean') throw new Error(`Expected boolean, not ${b}`);\n}\nfunction bytes(b, ...lengths) {\n  if (!(b instanceof Uint8Array)) throw new Error('Expected Uint8Array');\n  if (lengths.length > 0 && !lengths.includes(b.length)) throw new Error(`Expected Uint8Array of length ${lengths}, not of length=${b.length}`);\n}\nfunction hash(hash) {\n  if (typeof hash !== 'function' || typeof hash.create !== 'function') throw new Error('Hash should be wrapped by utils.wrapConstructor');\n  number(hash.outputLen);\n  number(hash.blockLen);\n}\nfunction exists(instance, checkFinished = true) {\n  if (instance.destroyed) throw new Error('Hash instance has been destroyed');\n  if (checkFinished && instance.finished) throw new Error('Hash#digest() has already been called');\n}\nfunction output(out, instance) {\n  bytes(out);\n  const min = instance.outputLen;\n  if (out.length < min) {\n    throw new Error(`digestInto() expects output buffer of length at least ${min}`);\n  }\n}\nexport { number, bool, bytes, hash, exists, output };\nconst assert = {\n  number,\n  bool,\n  bytes,\n  hash,\n  exists,\n  output\n};\nexport default assert;\n//# sourceMappingURL=_assert.js.map","map":null,"metadata":{},"sourceType":"module","externalDependencies":[]}