• Stars
    star
    584
  • Rank 73,900 (Top 2 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created over 9 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A functional programming toolkit for JavaScript.

FKit

Build Status

FKit (pronounced eff-kit) is a 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 by default, so you can partially apply them wherever you need to.

  • The ordering of arguments to FKit functions is carefully designed to be more natural, this makes them highly composable.

  • It's very compact, roughly 3 KB when minified and gzipped!

Table of Contents

Getting Started

Node

Install the npm package:

> npm install fkit

Import just the functions you need:

import { add } from 'fkit'
console.log(add(1, 2))

Or import the whole library:

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 <script> tag in your HTML file:

<script src="https://unpkg.com/fkit/dist/fkit.min.js"></script>

Documentation

Examples

Sum the numbers in a list:

import { sum } from 'fkit'
sum([1, 2, 3]) // 6

Stash a string:

import { map, surround } from 'fkit'
map(surround('{', '}'), 'hello') // '{h}{e}{l}{l}{o}'

Intersperse the numbers in a list with another number:

import { intersperse } from 'fkit'
intersperse(4, [1, 2, 3]) // [1, 4, 2, 4, 3]

Filter the numbers in a list where 1 <= n <= 5:

import { between } from 'fkit'
[1, 2, 3, 4, 5].filter(between(2, 4)) // [2, 3, 4]

Calculate the Cartesian product of two lists:

import { cartesian } from 'fkit'
cartesian([1, 2], [3, 4]) // [[1, 3], [1, 4], [2, 3], [2, 4]]

Calculate the permutations of a list:

import { permutations } from 'fkit'
permutations('abc') // ['abc', 'bac', 'cba', 'bca', 'cab', 'acb']

Check out some more examples:

Licence

FKit is licensed under the MIT licence. See the LICENCE file for more details.

More Repositories

1

rein

Database constraints made easy for ActiveRecord.
Ruby
670
star
2

sdram-fpga

A FPGA core for a simple SDRAM controller.
VHDL
107
star
3

tetris

A clone of the popular game Tetris.
JavaScript
101
star
4

risk

A game of Risk played on a hexgrid.
JavaScript
97
star
5

bulb

A reactive programming library for JavaScript.
JavaScript
83
star
6

bokeh

Bokeh is a simple, scalable and blazing-fast task queue built on Node.js and ZeroMQ.
JavaScript
77
star
7

openfpga-tecmo

Scala
44
star
8

mache

A library for writing cleaner and more expressive acceptance tests using page objects.
Ruby
40
star
9

jsdoc-react

A JSDoc template built with React.
JavaScript
27
star
10

rygar-emu

An emulator for the Rygar arcade game
C
20
star
11

rygar-fpga

A FPGA core for the arcade game, Rygar (1986).
VHDL
17
star
12

de10-nano-examples

DE10 Nano Sample Cores
VHDL
13
star
13

purescript-digraph

A directed graph library for PureScript.
PureScript
11
star
14

z80-chisel

A Z80 CPU implemented in Chisel.
Scala
10
star
15

de0-nano-examples

Some example circuits written in VHDL for Terasic DE0-Nano FPGA board.
VHDL
7
star
16

de10-nano-z80

A simple Z80 CPU example written in VHDL for the D10 Nano
VHDL
7
star
17

crc-chisel

Hardware CRC implementation in Chisel
Scala
5
star
18

de10-nano-sprite

A simple sprite example written in VHDL for DE10 Nano
VHDL
4
star
19

de10-nano-tilemap

A simple tilemap example written in VHDL for DE10 Nano
VHDL
4
star
20

rgb_matrix

Firmware for the SparkFun RGB LED Matrix.
3
star
21

alpha

Objective-C
3
star
22

sdram-chisel

Scala
3
star
23

de10-nano-video

A simple video example written in VHDL for the DE10 Nano
VHDL
3
star
24

de10-nano-counter

A simple counter example written in VHDL for the DE10 Nano
VHDL
2
star
25

Flatland

Objective-C
2
star
26

led-matrix

A LED matrix controller implemented in VHDL
VHDL
2
star
27

de0-nano-sdram

VHDL
2
star
28

de0-nano-char

A tilemap example written in VHDL for the DE0 Nano
VHDL
2
star
29

papilio-neopixel

VHDL
2
star
30

de0-nano-matrix

A LED matrix controller written in VHDL for the DE0-Nano FPGA development board.
VHDL
2
star
31

noise

Experiments with the webkit audio API.
CoffeeScript
2
star
32

arcadia

MiSTer FPGA core framework for Chisel
Scala
1
star
33

de0-nano-video

A simple video example written in VHDL for the DE0 Nano
VHDL
1
star
34

de0-nano-counter

A simple counter example written in VHDL for the DE0 Nano
VHDL
1
star
35

cave-tilemap-chisel

Scala
1
star
36

papilio-flasher

A simple circuit design to flash the LED on the Papilio Pro board.
VHDL
1
star
37

z80-test

Makefile
1
star
38

buccaneer

A BusPirate library for Ruby.
Ruby
1
star
39

nyan-jack

JavaScript
1
star
40

spartan-3e-counter

VHDL
1
star
41

purescript-examples

PureScript
1
star
42

papilio-picoblaze

VHDL
1
star
43

memory

A game of memory.
JavaScript
1
star
44

arduino

My arduino sketches
C++
1
star
45

fallout

Ruby
1
star