What is ramda-adjunct?
Ramda-adjunct is a community-maintained extension of the Ramda library, providing additional utility functions that complement Ramda's core functionality. It offers a wide range of functions for data manipulation, validation, and functional programming.
What are ramda-adjunct's main functionalities?
Data Manipulation
The `partitionIndexed` function splits a list into two lists based on a predicate function that takes both the value and the index. This is useful for more complex partitioning logic.
const RA = require('ramda-adjunct');
const R = require('ramda');
const data = [1, 2, 3, 4, 5];
const result = RA.partitionIndexed((val, idx) => idx % 2 === 0, data);
console.log(result); // [[1, 3, 5], [2, 4]]
Validation
The `isNotNilOrEmpty` function checks if a value is neither null nor an empty string, array, or object. This is useful for validation checks in your application.
const RA = require('ramda-adjunct');
const isValid = RA.isNotNilOrEmpty('Hello');
console.log(isValid); // true
Functional Programming
The `curryN` function allows you to curry a function with a specified arity. This is useful for creating more flexible and reusable functions.
const RA = require('ramda-adjunct');
const R = require('ramda');
const add = (a, b, c) => a + b + c;
const curriedAdd = RA.curryN(3, add);
console.log(curriedAdd(1)(2)(3)); // 6
Other packages similar to ramda-adjunct
lodash
Lodash is a popular utility library that provides a wide range of functions for data manipulation, validation, and functional programming. It is more widely used and has a larger community compared to ramda-adjunct.
underscore
Underscore is another utility library similar to Lodash, offering a variety of functions for data manipulation and functional programming. It is older and less feature-rich compared to Lodash but still widely used.
ramda
Ramda is the core library that ramda-adjunct extends. It focuses on functional programming and immutability, providing a set of utility functions for working with data in a functional style.
Ramda Adjunct
This library is a community maintained extension of Ramda.
Motivation
It seems to be very common for people to create their own utils and recipes composing
the Ramda functions and creating yet more complex aggregate functions.
Ramda Adjunct tries to eliminate this repetitive wheel of reinvention
and centralize most aggregate utils in its codebase.
Benefits
As a maintainers, we see three main benefits in Ramda Adjunct.
Centralization
All Ramda recipes and aggregate utils not present in Ramda are centralized here.
There is no more need for everybody to create their own utils in their own
codebases.
Tests
Creating custom aggregate utils or implementing recipes from Ramda wiki creates
the defectiveness problem. The problem is caused by the absence of any tests.
Ramda Adjunct keeps 100% code coverage and mimics the Ramda test patterns.
Impeccable documentation
You cannot call a library great without a great documentation. Ramda Adjnuct generates
its documentation directly from its codebase and uses patterns both found in Ramda and Lodash to document its API.
Requirements
- ramda >= 0.23.0
- node >=6.9.5
It doesn't mean that Ramda Adjunct won't work on lower versions of node or ramda.
This just means that our tests run on these versions.
Installation
$ npm i ramda-adjunct
API Documentation
Development
If you want to contribute to this project, please consult the CONTRIBUTING.MD
guideline.
Obtaining project copy
$ git clone https://github.com/char0n/ramda-adjunct
$ npm i
Running tests
$ npm run test
Running linter
$ npm run lint
Author
char0n (Vladimir Gorej)
vladimir.gorej@gmail.com
https://www.linkedin.com/in/vladimirgorej/