funk-lib
FP for Vanilla JavaScript
funk-lib
is a standard library for full-stack functional programming with native JavaScript types. It is inspired by Ramda
, but does not intend to duplicate Ramda's functionality. There is some overlap with core Browser
and Node.js
APIs, for the sake of normalization and isomorphism.
Features
Pure functions
Mostly. There are a few documented exceptions
Currying
All functions are curried, and arguments are arranged "data last" for useful partial application
Isomorphic
Packages are available for both
-
Node.js
(CommonJS) -npm/funk-lib
-
Browser
(ES Modules) -npm/funk-lib-es
Vast
Includes over 300 functions for working with
- Async (promises)
- Iterables (sync & async)
- Type checking
- Arrays and objects
- Scalars (string, number)
- Function composition
- URLs
- ... and more
For a full list of functions see the Documentation For The Latest Release
Install
npm i -P funk-lib
# or: es-module compatible build
npm i -P funk-lib-es
Import
const { mapKeys } = require('funk-lib/object');
// or: es-module compatible build
import { mapKeys } from 'funk-lib-es/object';
Development
Commands
$ npm run <command>
command | description |
---|---|
build |
Transpile source |
cover |
Run test coverage |
init |
Re/Install deps |
init:hard |
init with a fresh package-lock
|
docs |
Parse docs to JSON
|
lint |
Lint the source |
test |
Run tests |
test:watch |
Run tests on change |
verify |
Verify linting, tests, coverage |
Created by Colby Dauphinais