fp-es6

所属分类:GIS/地图编程
开发工具:JavaScript
文件大小:0KB
下载次数:0
上传日期:2015-08-07 14:51:05
上 传 者sh-1993
说明:  ES6集合(地图和集合)的函数编程操作的微型库,
(Tiny library of functional programming operations for ES6 collections (Maps and Sets),)

文件列表:
fp-es6.js (4118, 2015-08-07)
package.json (804, 2015-08-07)
polyfill-map.js (1139, 2015-08-07)
src/ (0, 2015-08-07)
src/fp-es6.js (2474, 2015-08-07)
test/ (0, 2015-08-07)
test/test.html (397, 2015-08-07)
test/tests.js (11696, 2015-08-07)

# fp-es6 Tiny library of functional programming operations for ES6 collections (Maps and Sets). Couldn't find any similar library without Traceur dependancy :( npm install fp-es6 Provides following operations: - map: MapOrSet -> MapOrSet - filter: MapOrSet -> MapOrSet - reduce: MapOrSet -> Any - some: MapOrSet -> Boolean - every: MapOrSet -> Boolean Assumes that Map and Set are present (native or polyfill). ``` var fn = require('fp-es6'); var doubledAndFiltered = fn(new Set([1,2,3])) .map(val => 2 * val) .filter(val => val > 2) .value(); // call value() to extract the native collection doubledAndFiltered instanceof Set // true var sum = fn(new Set([1,2,3])).reduce((a, b) => a + b); var hasFive = fn(new Set([1,2,3])).some(val => val === 5); fn(new Map([['a', 1], ['b', 1]])).every(val => val === 1); ```

近期下载者

相关文件


收藏者