UNPKG

sendover

Version:

Tools for creating and paying invoices privately on Bitcoin SV

22 lines 708 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.asArray = void 0; /** * Coerce a value to number[] * @param val Buffer or string or number[]. If string, encoding param applies. * @param encoding defaults to 'hex' * @returns input val if it is a number[]; if string converts to Buffer using encoding; uses Array.from to convert buffer to number[] * @publicbody */ function asArray(val, encoding) { let a; if (Array.isArray(val)) a = val; else if (Buffer.isBuffer(val)) a = Array.from(val); else a = Array.from(Buffer.from(val, encoding || 'hex')); return a; } exports.asArray = asArray; //# sourceMappingURL=asArray.js.map