在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:ramda/ramda开源软件地址:https://github.com/ramda/ramda开源编程语言:JavaScript 99.8%开源软件介绍:RamdaA practical functional library for JavaScript programmers. Why Ramda?There are already several excellent libraries with a functional flavor. Typically, they are meant to be general-purpose toolkits, suitable for working in multiple paradigms. Ramda has a more focused goal. We wanted a library designed specifically for a functional programming style, one that makes it easy to create functional pipelines, one that never mutates user data. What's Different?The primary distinguishing features of Ramda are:
The last two points together make it very easy to build functions as sequences of simpler functions, each of which transforms the data and passes it along to the next. Ramda is designed to support this style of coding. Introductions
PhilosophyUsing Ramda should feel much like just using JavaScript. It is practical, functional JavaScript. We're not introducing lambda expressions in strings, we're not borrowing consed lists, we're not porting over all of the Clojure functions. Our basic data structures are plain JavaScript objects, and our usual collections are JavaScript arrays. We also keep other native features of JavaScript, such as functions as objects with properties. Functional programming is in good part about immutable objects and side-effect free functions. While Ramda does not enforce this, it enables such style to be as frictionless as possible. We aim for an implementation both clean and elegant, but the API is king. We sacrifice a great deal of implementation elegance for even a slightly cleaner API. Last but not least, Ramda strives for performance. A reliable and quick implementation wins over any notions of functional purity. InstallationTo use with node: $ npm install ramda Then in the console: const R = require('ramda'); To use directly in Deno: import * as R from "https://deno.land/x/[email protected]/mod.ts"; or using Nest.land: import * as R from "https://x.nest.land/[email protected]/mod.ts"; To use directly in the browser: <script src="path/to/yourCopyOf/ramda.js"></script> or the minified version: <script src="path/to/yourCopyOf/ramda.min.js"></script> or from a CDN, either cdnjs: <script src="//cdnjs.cloudflare.com/ajax/libs/ramda/0.27.1/ramda.min.js"></script> or one of the below links from jsDelivr: <script src="//cdn.jsdelivr.net/npm/[email protected]/dist/ramda.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/ramda@latest/dist/ramda.min.js"></script> (note that using These script tags add the variable Or you can inject ramda into virtually any unsuspecting website using the bookmarklet. Note for versions > 0.25
Ramda versions > 0.25 don't have a default export.
So instead of Note for ES6 module and browsers
In order to access to the ES6 module in browsers, one has to provide the content of the es directory (see below for the build instructions) and use Build
Partial BuildsIt is possible to build Ramda with a subset of the functionality to reduce its file size. Ramda's build system supports this with command line flags. For example if you're using
This requires having Node/io.js installed and ramda's dependencies installed (just use Install specific functionsInstall individual functions with bit, npm and yarn without installing the whole library. DocumentationPlease review the API documentation. Also available is our Cookbook of functions built from Ramda that you may find useful. The NameOk, so we like sheep. That's all. It's a short name, not already
taken. It could as easily have been Running The Test SuiteConsole: To run the test suite from the console, you need to have
Then from the root of the project, you can just call
Alternately, if you've installed the dependencies, via:
then you can run the tests (and get detailed output) by running:
Browser: You can use testem to
test across different browsers (or even headlessly), with livereloading of
tests. Install testem ( If you have PhantomJS installed, you can run UsageFor import * as R from 'ramda'
const {identity} = R
R.map(identity, [1, 2, 3]) Destructuring imports from ramda does not necessarily prevent importing the entire library. You can manually cherry-pick methods like the following, which would only grab the parts necessary for import identity from 'ramda/src/identity'
identity() Manually cherry picking methods is cumbersome, however. Most bundlers like Webpack and Rollup offer tree-shaking as a way to drop unused Ramda code and reduce bundle size, but their performance varies, discussed here. Here is a summary of the optimal setup based on what technology you are using:
TypingsTranslationsFundingIf you wish to donate to Ramda please see our Open Collective page. Thank you! AcknowledgementsThanks to J. C. Phillipps for the Ramda logo. Ramda logo artwork © 2014 J. C. Phillipps. Licensed Creative Commons CC BY-NC-SA 3.0. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论