fkit

所属分类:TypeScript编程
开发工具:JavaScript
文件大小:0KB
下载次数:0
上传日期:2021-08-31 01:39:39
上 传 者sh-1993
说明:  JavaScript的函数式编程工具包。
(A functional programming toolkit for JavaScript.)

文件列表:
.editorconfig (178, 2021-08-30)
.npmrc.template (46, 2021-08-30)
.travis.yml (321, 2021-08-30)
CHANGELOG.md (9620, 2021-08-30)
LICENCE.md (1079, 2021-08-30)
Makefile (520, 2021-08-30)
babel.config.js (54, 2021-08-30)
fkit.d.ts (21663, 2021-08-30)
jest.config.js (65, 2021-08-30)
logo.png (17627, 2021-08-30)
package-lock.json (1839391, 2021-08-30)
package.json (1061, 2021-08-30)
rollup.config.js (1020, 2021-08-30)
src/ (0, 2021-08-30)
src/add.js (334, 2021-08-30)
src/add.test.js (122, 2021-08-30)
src/all.js (624, 2021-08-30)
src/all.test.js (407, 2021-08-30)
src/always.js (326, 2021-08-30)
src/always.test.js (179, 2021-08-30)
src/and.js (381, 2021-08-30)
src/and.test.js (252, 2021-08-30)
src/any.js (637, 2021-08-30)
src/any.test.js (407, 2021-08-30)
src/append.js (430, 2021-08-30)
src/append.test.js (559, 2021-08-30)
src/apply.js (386, 2021-08-30)
src/apply.test.js (354, 2021-08-30)
src/apply2.js (464, 2021-08-30)
src/apply2.test.js (498, 2021-08-30)
src/apply3.js (513, 2021-08-30)
src/apply3.test.js (657, 2021-08-30)
src/applyMethod.js (515, 2021-08-30)
src/applyMethod.test.js (387, 2021-08-30)
src/applyMethod2.js (599, 2021-08-30)
src/applyMethod2.test.js (411, 2021-08-30)
src/applyMethod3.js (651, 2021-08-30)
src/applyMethod3.test.js (430, 2021-08-30)
... ...

FKit

[![Build Status](https://travis-ci.com/nullobject/fkit.svg?branch=master)](https://travis-ci.com/nullobject/fkit) FKit (pronounced eff-kit) is a [functional programming](http://en.wikipedia.org/wiki/Functional_programming) toolkit for JavaScript. It provides many functions for solving common problems with functions, objects, arrays, and strings. It aims to provide reusable building blocks while maintaining a laser focus on everyday utility. Features: * Why reinvent the wheel? FKit provides many functions for solving everyday problems to do with functions, arrays, objects, and strings. * FKit treats both strings and arrays as *lists*, which means you can apply the same list functions to both strings and arrays (e.g. `head`, `tail`, `map`, `filter`, `fold`, etc). * Most FKit functions are already [curried](http://en.wikipedia.org/wiki/Currying) by default, so you can [partially apply](http://en.wikipedia.org/wiki/Partial_application) them wherever you need to. * The ordering of arguments to FKit functions is carefully designed to be more natural, this makes them highly [composable](http://en.wikipedia.org/wiki/Function_composition). * It's very compact, roughly 3 KB when minified and gzipped! ## Table of Contents * [Getting Started](#getting-started) * [Node](#node) * [Browser](#browser) * [Documentation](#documentation) * [Examples](#examples) * [Licence](#licence) ## Getting Started ### Node Install the npm package: ```sh > npm install fkit ``` Import just the functions you need: ```js import { add } from 'fkit' console.log(add(1, 2)) ``` Or import the whole library: ```js import * as F from 'fkit' console.log(F.add(1, 2)) ``` ### Browser The easiest way to start using FKit in your browser is to include it with a ` ``` ## Documentation * [API documentation](http://fkit.joshbassett.info/) * Presentation by Josh Bassett: [Everyday Functional Programming in JavaScript](https://speakerdeck.com/nullobject/fkit-everyday-functional-programming-in-javascript) * Article by Josh Bassett: [Take Your Code to the Next Level with FKit](http://joshbassett.info/2014/take-your-code-to-the-next-level-with-fkit/) ## Examples Sum the numbers in a list: ```js import { sum } from 'fkit' sum([1, 2, 3]) // 6 ``` Stash a string: ```js import { map, surround } from 'fkit' map(surround('{', '}'), 'hello') // '{h}{e}{l}{l}{o}' ``` Intersperse the numbers in a list with another number: ```js import { intersperse } from 'fkit' intersperse(4, [1, 2, 3]) // [1, 4, 2, 4, 3] ``` Filter the numbers in a list where 1 <= n <= 5: ```js import { between } from 'fkit' [1, 2, 3, 4, 5].filter(between(2, 4)) // [2, 3, 4] ``` Calculate the Cartesian product of two lists: ```js import { cartesian } from 'fkit' cartesian([1, 2], [3, 4]) // [[1, 3], [1, 4], [2, 3], [2, 4]] ``` Calculate the permutations of a list: ```js import { permutations } from 'fkit' permutations('abc') // ['abc', 'bac', 'cba', 'bca', 'cab', 'acb'] ``` Check out some more examples: * [Functions](http://codepen.io/nullobject/pen/dbAkl?editors=001) * [Strings](http://codepen.io/nullobject/pen/hnDEe?editors=001) * [Arrays](http://codepen.io/nullobject/pen/vbcCr?editors=001) * [Objects](http://codepen.io/nullobject/pen/rKszh?editors=001) * [Branching](http://codepen.io/nullobject/pen/LdtDK?editors=001) ## Licence FKit is licensed under the MIT licence. See the [LICENCE](https://github.com/nullobject/fkit/blob/master/LICENCE.md) file for more details.

近期下载者

相关文件


收藏者