useful-fn
v0.2.1
Published
Useful function
Downloads
2
Readme
fn
Useful function
For my work
Installation
NPM
Installation via npm
$ npm install --save useful-fn
CommonJS
var fn = require('useful-fn')
var param = fn.param
// alternatively
var param = require('useful-fn/param')
ES2015
import fn from 'useful-fn'
// alternatively
import param from 'useful-fn/param'
Usage
currency
import currency from 'useful-fn/currency'
currency(1000) // 1,000.00
isArray
import isArray from 'useful-fn/is/array'
isArray([]) // true
isFunction
import isFunction from 'useful-fn/is/function'
function foo() {}
isFunction(foo) // true
isNumber
import isNumber from 'useful-fn/is/number'
isNumber(1) // true
isNumber(NaN) // false
isNumber(infinite) // false
param
import param from 'useful-fn/param'
var s = param({
username: 'john',
password: 'qwerty',
favourite: ['apple', 'orange']
})
// s => 'username=john&password=qwerty&favourite=apple&favourite=orange'
parseQuery
import parseQuery from 'useful-fn/parse-query'
var obj = parseQuery(window.location.search.slice(1))
transition
import transition from 'useful-fn/transition'
if (transition) {
element.addEventListener(transition.end, function() {
//
})
} else {
// Not support
}
License
Under The MIT License.