web_lib

Common web application libraries
git clone https://radroots.dev/git/web_lib.git
Log | Files | Refs | LICENSE

value.ts (322B)


      1 export const idb_value_as_bytes = (value: unknown): Uint8Array | null => {
      2     if (value instanceof Uint8Array) return value;
      3     if (value instanceof ArrayBuffer) return new Uint8Array(value);
      4     if (ArrayBuffer.isView(value)) return new Uint8Array(value.buffer, value.byteOffset, value.byteLength);
      5     return null;
      6 };