npm.io
0.1.0 • Published 9 years ago

y-utils

Licence
MIT
Version
0.1.0
Deps
0
Vulns
0
Weekly
0
DeprecatedThis package is deprecated

y-utils - js 工具函数

Build Status Standard - JavaScript Style Guide

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