toxic-utils
v0.4.3
Published
utils
Downloads
361
Readme
toxic-utils
utils collection
get started
npm install toxic-utils --save
if you are using flow
, you should import our flow defination, by adding this to your .flowconfig
.
[ignore]
[include]
[libs]
./node_modules/toxic-utils/lib/index.flow.js
[options]
[lints]
doc
genTraversalHandler
the handler to generate an deep traversal handler
Parameters
fn
Function the function you wanna run when you reach in the deep property
Returns Function the handler
deepClone
deeply clone an object
Parameters
Returns clone-target the new Object
deepAssign
merge multiple objects
Parameters
args
...Object [description]
Returns merge-object [description]
camelize
camelize any string, e.g hello world -> helloWorld
Parameters
Returns string camelize string
hypenate
hypenate any string e.g hello world -> hello-world
Parameters
str
string only accept string
Returns string
bind
bind the function with some context. we have some fallback strategy here
Parameters
fn
function the function which we need to bind the context oncontext
any the context object
Returns Function
uuid
generate an uuid
Returns string
S4
generate an random number which length is 4
Returns string
rand
generate an random number with specific length
Parameters
length
number
Returns string
getDeepProperty
get an deep property
Parameters