toxic-utils
utils
Last updated 7 years ago by toxicjohann .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install toxic-utils 
SYNC missed versions from official npm registry.

toxic-utils

Build Status Coverage Status npm dependency Status devDependency Status Greenkeeper badge

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

src/index.js:8-20

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

src/index.js:27-32

deeply clone an object

Parameters

  • source (Array | Object) if you pass in other type, it will throw an error

Returns clone-target the new Object

deepAssign

src/index.js:38-50

merge multiple objects

Parameters

  • args ...Object [description]

Returns merge-object [description]

camelize

src/index.js:57-63

camelize any string, e.g hello world -> helloWorld

Parameters

Returns string camelize string

hypenate

src/index.js:69-71

hypenate any string e.g hello world -> hello-world

Parameters

  • str string only accept string

Returns string

bind

src/index.js:78-90

bind the function with some context. we have some fallback strategy here

Parameters

  • fn function the function which we need to bind the context on
  • context any the context object

Returns Function

uuid

src/index.js:95-97

generate an uuid

Returns string

S4

src/index.js:101-103

generate an random number which length is 4

Returns string

rand

src/index.js:108-114

generate an random number with specific length

Parameters

Returns string

getDeepProperty

src/index.js:119-147

get an deep property

Parameters

  • obj any
  • keys (string | Array<string>)
  • $2 any (optional, default {})
    • $2.throwError (optional, default false)
    • $2.backup

Current Tags

  • 0.3.0-alpha.1                                ...           beta (8 years ago)
  • 0.4.3                                ...           latest (7 years ago)

14 Versions

  • 0.4.3                                ...           7 years ago
  • 0.4.2                                ...           7 years ago
  • 0.4.0                                ...           7 years ago
  • 0.3.1                                ...           8 years ago
  • 0.3.0                                ...           8 years ago
  • 0.3.0-alpha.1                                ...           8 years ago
  • 0.2.0                                ...           9 years ago
  • 0.1.6                                ...           9 years ago
  • 0.1.5                                ...           9 years ago
  • 0.1.4                                ...           9 years ago
  • 0.1.3                                ...           9 years ago
  • 0.1.2                                ...           9 years ago
  • 0.1.1                                ...           9 years ago
  • 0.1.0                                ...           9 years ago
Maintainers (1)
Downloads
Total 47
Today 0
This Week 0
This Month 22
Last Day 0
Last Week 0
Last Month 11
Dependencies (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE