y-utils
v0.1.0
Published
Some helpful functions.
Downloads
3
Readme
y-utils - js 工具函数
Install
npm install y-utils --save
Usage
id
import id from 'y-utils/id'
const id1 = id() // Unique id value
const id2 = id()
is
和 is.js 接近
toAsync
import toAsync from 'y-utils/toAsync'
const asyncFn = toAsync(() => console.log(1))
asyncFn()
console.log(2)
// output '2, 1'
curry
import curry from 'y-utils/curry'
function abc (a, b, c) {
return a + b + c
}
const fn = curry(abc)
fn(1)(2)(3) //=> 6
fn(1, 2)(3) //=> 6
fn(1)(2, 3) //=> 6
fn(1, 2, 3) //=> 6