1-liners 中文文档教程
瑞士制造
再简单不过的功能性工具。
我们很自豪地向您展示 < em>1-liners – 一款非常简单的功能实用腰带。 137 个单行函数(还在增加)。 每一件都是用爱和关注手工制作的。
Our decalogue
您将获得一流的函数式编程工艺产品。 每个功能都遵循 KISS 原则,我们将其分解为十个严格的规则。
我们总是跟着他们。 我们向您保证。
每个函数都应适合一行可读代码
– 看一眼源代码,您就会确切地知道发生了什么。
每个函数都应没有副作用
– 您可以放心使用。
每个函数都应具有固定数量的参数
– 绑定、咖喱化和非咖喱化、部分应用、内爆和爆炸都非常容易。
每个函数都应以不可变的方式处理数据
– 不再有调试噩梦。
每个函数都应将数据作为最后一个参数
– 这使得柯里化和组合新函数变得轻而易举。
每个函数都应在一个单独的微模块中< /强
– 您只需加载/捆绑您需要的单个 1-liner。
每个功能都应彻底测试
– 保证 100% 的代码覆盖率。 我们甚至测试是否每个函数都适合一行!
每个功能都应有很好的文档
– 文档解释了用法、提供了源代码并链接到规范。
我们将提供原生对象方法
的功能版本 – 像reduce(callback, array)
用于array.reduce(callback)
。
我们将提供功能版本的语言结构
– 像plus(a, b)
用于a + b
。
Usage
Install
$ npm install --save 1-liners
Usage in ES5
// The lightweight, recommended way:
var map = require('1-liners/map');
// Sometimes practical:
var map = require('1-liners').map;
Usage in ES 2015 (formerly ES6)
// The lightweight, recommended way:
import map from '1-liners/module/map';
// Sometimes practical:
import { map, filter } from '1-liners/module';
API
的文档
Maintainers
stoeffel | tomekwi | hemanth |
davidchase | tristaaan |
查看使用 gh-contributors-table 创建
License
麻省理工学院 © stoeffel tomekwi hemanth davidchase 特里斯塔安
MADE IN SWITZERLAND
Functional tools that couldn’t be simpler.
We’re proud to present 1-liners – a dead simple functional utility belt. 137 one-liner functions (and counting). Each hand-crafted with love and attention.
Our decalogue
You get a product of top-quality functional programming craftmanship. Each function follows the KISS principle, which we’ve broken down into ten strict rules.
We always follow them. You have our word.
Each function shall fit in one readable line of code
– take a glimpse at the source and you know exactly what’s going on.
Each function shall have no side-effects
– you can use it with confidence.
Each function shall have a fixed number of arguments
– it’s dead easy to bind, curry and uncurry, apply partially, implode and explode.
Each function shall deal with data in an immutable way
– no more debugging nightmares.
Each function shall take data as the last argument
– this makes currying and composing new functions a breeze.
Each function shall be in a separate micro-module
– you only load/bundle the single 1-liner you need.
Each function shall be thoroughly tested
– 100% code coverage guaranteed. We even test if every function fits in one line!
Each function shall have great documentation
– the docs explain usage, present the source, and link to the specs.
We shall provide functional versions of native object methods
– likereduce(callback, array)
forarray.reduce(callback)
.
We shall provide functional versions of language constructs
– likeplus(a, b)
fora + b
.
Usage
Install
$ npm install --save 1-liners
Usage in ES5
// The lightweight, recommended way:
var map = require('1-liners/map');
// Sometimes practical:
var map = require('1-liners').map;
Usage in ES 2015 (formerly ES6)
// The lightweight, recommended way:
import map from '1-liners/module/map';
// Sometimes practical:
import { map, filter } from '1-liners/module';
API
Checkout the documentation
Maintainers
stoeffel | tomekwi | hemanth |
davidchase | tristaaan |
created with gh-contributors-table