@asefux/common
v1.4.0-a1
Published
asefux commons
Downloads
8
Readme
common
npm install --save @asefux/common
module.exports = {
uuid, // npm module uuid
BN, // bignumber.js
bn, // function to create a bignumber
getTimeFromTimeuuid, // get milliseconds from timeuuid ( uuid.v1 )
isUuid, // check if a string is a valid uuid format of specified version. default version is 4
R, // ramda library
object: { flatten, unflatten } // flattens object to single level, unflattens single level object
string: { compile, toSymbolKey } // compiles a string from template
};
usage
const { uuid, bn, isUuid, string: { compile } } = require('@asefux/common');
const aBigNumber = bn('12345678909876543212345678901234566788');
const aTimeuuid = uuid.v1();
isUuid(aTimeuuid, 1) ? console.log('is uuid of version 1') : console.log('is not uuid of version 1');
const aTemplateString = 'Hello ${name}';
const aString = compile({ template: aTemplateString, info: { name: 'World' } });
console.log(aString); // will output: Hello World