UNPKG

@blockcerts/hashlink-verifier

Version:
14 lines (13 loc) 421 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.stringToUint8Array = stringToUint8Array; function stringToUint8Array(data) { if (typeof data === 'string') { // convert data to Uint8Array return new TextEncoder().encode(data); } if (!(data instanceof Uint8Array)) { throw new TypeError('"data" be a string or Uint8Array.'); } return data; }