0.1.0 • Published 7 years ago

y-utils v0.1.0

Weekly downloads
4
License
MIT
Repository
github
Last release
7 years ago

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