Hex <-> Uint8Array utils (#69)
This commit is contained in:
@@ -7,7 +7,7 @@ const u8aFromBuffer = require('../buffer/toU8a');
|
||||
|
||||
/**
|
||||
@name u8aFromBuffer
|
||||
@signature u8aFromBuffer (value?: Buffer): number
|
||||
@signature u8aFromBuffer (value?: Buffer): Uint8Array
|
||||
@summary Creates a Uint8Array value from a Buffer object.
|
||||
@alias buffer/toU8a
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
// Copyright 2017-2018 Jaco Greeff
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the ISC license. See the LICENSE file for details.
|
||||
// @flow
|
||||
|
||||
const u8aFromHex = require('../hex/toU8a');
|
||||
|
||||
/**
|
||||
@name u8aFromHex
|
||||
@signature u8aFromHex (value?: string): Uint8Array
|
||||
@summary Creates a Uint8Array value from a hex string.
|
||||
@alias hex/toU8a
|
||||
*/
|
||||
module.exports = u8aFromHex;
|
||||
@@ -0,0 +1,15 @@
|
||||
// Copyright 2017-2018 Jaco Greeff
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the ISC license. See the LICENSE file for details.
|
||||
|
||||
const isFunction = require('../is/function');
|
||||
|
||||
const { u8aFromHex } = require('./index');
|
||||
|
||||
describe('u8aFromHex', () => {
|
||||
it('exists as a function', () => {
|
||||
expect(
|
||||
isFunction(u8aFromHex)
|
||||
).toEqual(true);
|
||||
});
|
||||
});
|
||||
@@ -4,6 +4,7 @@
|
||||
// @flow
|
||||
|
||||
const u8aFromBuffer = require('./fromBuffer');
|
||||
const u8aFromHex = require('./fromHex');
|
||||
const u8aFromUtf8 = require('./fromUtf8');
|
||||
const u8aToBuffer = require('./toBuffer');
|
||||
const u8aToUtf8 = require('./toUtf8');
|
||||
@@ -13,6 +14,7 @@ const u8aToUtf8 = require('./toUtf8');
|
||||
*/
|
||||
module.exports = {
|
||||
u8aFromBuffer,
|
||||
u8aFromHex,
|
||||
u8aFromUtf8,
|
||||
u8aToBuffer,
|
||||
u8aToUtf8
|
||||
|
||||
Reference in New Issue
Block a user