mirror of
https://github.com/pezkuwichain/pezkuwi-common.git
synced 2026-04-22 14:57:56 +00:00
chore: update to version 14.0.11 and align website URLs
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.u8aToBuffer = u8aToBuffer;
|
||||
const x_global_1 = require("@pezkuwi/x-global");
|
||||
const has_js_1 = require("../has.js");
|
||||
/**
|
||||
* @name u8aToBuffer
|
||||
* @summary Creates a Buffer object from a hex string.
|
||||
* @description
|
||||
* `null` inputs returns an empty `Buffer` result. `UInt8Array` input values return the actual bytes value converted to a `Buffer`. Anything that is not a `UInt8Array` throws an error.
|
||||
* @example
|
||||
* <BR>
|
||||
*
|
||||
* ```javascript
|
||||
* import { u8aToBuffer } from '@pezkuwi/util';
|
||||
*
|
||||
* console.log('Buffer', u8aToBuffer(new Uint8Array([1, 2, 3])));
|
||||
* ```
|
||||
*/
|
||||
function u8aToBuffer(value) {
|
||||
return has_js_1.hasBuffer
|
||||
? x_global_1.xglobal.Buffer.from(value || [])
|
||||
: new Uint8Array(value || []);
|
||||
}
|
||||
Reference in New Issue
Block a user