@@ -3,7 +3,7 @@
|
||||
// of the ISC license. See the LICENSE file for details.
|
||||
// @flow
|
||||
|
||||
const bufferFromU8a = require('../u8a/toBuffer');
|
||||
import bufferFromU8a from '../u8a/toBuffer';
|
||||
|
||||
/**
|
||||
@name bufferFromU8a
|
||||
@@ -11,4 +11,4 @@ const bufferFromU8a = require('../u8a/toBuffer');
|
||||
@summary Creates a Buffer object from a Uint8Array.
|
||||
@alias u8a/toBuffer
|
||||
*/
|
||||
module.exports = bufferFromU8a;
|
||||
export default bufferFromU8a;
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
// 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');
|
||||
import isFunction from '../is/function';
|
||||
|
||||
const { bufferFromU8a } = require('./index');
|
||||
import { bufferFromU8a } from './index';
|
||||
|
||||
describe('bufferFromU8a', () => {
|
||||
it('exists as a function', () => {
|
||||
|
||||
@@ -3,13 +3,13 @@
|
||||
// of the ISC license. See the LICENSE file for details.
|
||||
// @flow
|
||||
|
||||
const bufferFromU8a = require('./fromU8a');
|
||||
const bufferToU8a = require('./toU8a');
|
||||
import bufferFromU8a from './fromU8a';
|
||||
import bufferToU8a from './toU8a';
|
||||
|
||||
/**
|
||||
@summary Utility methods to convert to and from `Buffer` objects
|
||||
*/
|
||||
module.exports = {
|
||||
export {
|
||||
bufferFromU8a,
|
||||
bufferToU8a
|
||||
};
|
||||
|
||||
@@ -14,10 +14,10 @@
|
||||
|
||||
bufferToU8a(Buffer.from([1, 2, 3]));
|
||||
*/
|
||||
module.exports = function bufferToU8a (buffer?: Buffer): Uint8Array {
|
||||
export default function bufferToU8a (buffer?: Buffer): Uint8Array {
|
||||
if (!buffer) {
|
||||
return new Uint8Array([]);
|
||||
}
|
||||
|
||||
return new Uint8Array(buffer);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the ISC license. See the LICENSE file for details.
|
||||
|
||||
const { bufferToU8a } = require('./index');
|
||||
import { bufferToU8a } from './index';
|
||||
|
||||
describe('bufferToU8a', () => {
|
||||
it('returns an empty buffer when null provided', () => {
|
||||
|
||||
Reference in New Issue
Block a user