@7urtle/lambda 中文文档教程

发布于 3年前 浏览 36 项目主页 更新于 3年前

@7urtle/lambda

JavaScript 中的函数式编程库。

npm NpmLicense npm 包大小(缩小) npm bundle size (minified + gzip)

@7urtle/lambda 标志

Official Website

www .7urtle.com

Why @7urtle/lambda

Lambda 的创建是为了让我们能够接受 JavaScript 中的函数式编程。 它专注于提供高度 本身使用功能范式构建的高性能代码。 提供的功能简单、柯里化、纯粹 并针对部分应用程序和功能组合进行了优化。

Focus on your own skill level

@7urtle/lambda 旨在帮助您过渡到函数式编程 无论您的技能水平如何。 您可以按照自己的进度学习任何功能特性。 最后,您可以掌握所有内容,包括纯函数、组合、柯里化、仿函数和单子。

学习 JavaScript 函数式编程

Get Started

要与 Node.js 一起使用:

$ npm install --save @7urtle/lambda

在 Node.js 中需要 @7urtle/lambda :

const L = require('@7urtle/lambda');

L.log('Hello world!');

在 Node.js 中导入 @7urtle/lambda:

import * as L from '@7urtle/lambda';

L.log('Hello world!');

或者只导入特定函数:

import {log, upperCaseOf, compose} from '@7urtle/lambda';

const hello = compose(log, upperCaseOf);
hello('Hello World');
// => HELLO WORLD

从 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>

或使用公共 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>

使用 CodePen 在在线游乐场尝试 @7urtle/lambda。

Contributors

 Contributors

使用 contributors-img 制作。

Changelog

1.1.4

  • Added a build for browsers and CDNs.

1.4.0

  • 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.

@7urtle/lambda

Functional programming library in JavaScript.

npm NpmLicense npm bundle size (minified) npm bundle size (minified + gzip)

@7urtle/lambda logo

Official Website

www.7urtle.com

Why @7urtle/lambda

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.

Focus on your own skill level

@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

Get Started

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.

Contributors

Contributors

Made with contributors-img.

Changelog

1.1.4

  • Added a build for browsers and CDNs.

1.4.0

  • 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.
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文