Useful function
For my work
Installation via npm
$ npm install --save useful-fn
var fn = require('useful-fn')
var param = fn.param
// alternatively
var param = require('useful-fn/param')
import fn from 'useful-fn'
// alternatively
import param from 'useful-fn/param'
import currency from 'useful-fn/currency'
currency(1000) // 1,000.00
import isArray from 'useful-fn/is/array'
isArray([]) // true
import isFunction from 'useful-fn/is/function'
function foo() {}
isFunction(foo) // true
import isNumber from 'useful-fn/is/number'
isNumber(1) // true
isNumber(NaN) // false
isNumber(infinite) // false
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'
import parseQuery from 'useful-fn/parse-query'
var obj = parseQuery(window.location.search.slice(1))
import transition from 'useful-fn/transition'
if (transition) {
element.addEventListener(transition.end, function() {
//
})
} else {
// Not support
}
Under The MIT License.