Functional programming library in JavaScript.
Lambda was created to allows us to embrace functional programming in JavaScript. It focuses on providing highly performant code which is itself built using functional paradigms. Provided functions are simple, curried, pure and optimised for partial application and function composition.
@7urtle/lambda was written to help you transition towards functional programming no matter your skill level. You can pick up any functional features as you learn at your own pace. At the end you can master everything including pure functions, composition, currying, functors, and monads.
Learn JavaScript Functional Programming
To use with Node.js:
$ npm install --save @7urtle/lambda
Require @7urtle/lambda in Node.js:
const L = require('@7urtle/lambda');
L.log('Hello world!');
Import @7urtle/lambda in Node.js:
import * as L from '@7urtle/lambda';
L.log('Hello world!');
Or import just specific functions:
import {log, upperCaseOf, compose} from '@7urtle/lambda';
const hello = compose(log, upperCaseOf);
hello('Hello World');
// => HELLO WORLD
Get the minified version from GitHub: lambda.min.js
<script src="./your/copy/of/lambda.min.js"></script>
<script>
// script on your website
// access @7urtle/lambda using the variable L
const message = L.upperCaseOf('hello world');
alert(message); // HELLO WORLD
</script>
Or use public CDN: https://www.jsdelivr.com/package/npm/@7urtle/lambda.
<script src="https://cdn.jsdelivr.net/npm/@7urtle/lambda@latest/dist/lambda.min.js"></script>
<script>
// script on your website
// access @7urtle/lambda using the variable L
const message = L.upperCaseOf('hello world');
alert(message); // HELLO WORLD
</script>
Try @7urtle/lambda with online playground using CodePen.
Made with contributors-img.
- Added a build for browsers and CDNs.
- Library type changed to module using ESM imports/exports. Still supports require and UMD through webpack/babel build.
- Optimizations for tree-shakeability of the library for both ESM and CJS.
- Declaring Node support from version 12.16 (current node is 17.4.0, LTS is 16.13.2, and AWS Lambda defaults to node 14).
- These changes were heavily tested with different configurations. However, if you encounter any issues, please report them on GitHub.