Package Exports
- immunity
- immunity/lib/appendToArray
- immunity/lib/appendToObject
- immunity/lib/mergeArrays
- immunity/lib/mergeObjects
- immunity/lib/prependToArray
- immunity/lib/removeKeyFromObject
- immunity/lib/splitArray
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (immunity) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
immunity
What is the Immunity?
Immunity is a set of helper methods in order to construct a new version of data without mutating/updating existing data structure in-place.
Compared to its alternatives, immunity only provides utility functions instead of delivering new data types/structures as a solution.
Additionally, as a library, Immunity is completely tree-shanking-friendly. Your favorite module bundler can easily inline the functionality you need with no extra configuration, instead of bundling the whole Immunity package.
Quick start
Execute npm install immunity to install immunity and its dependencies into your project directory.
Usage
For example, to append a new item to an existing array:
import { appendToArray } from 'immunity';
const source = [ 'a', 'b' ];
const newOne = appendToArray(source, 'c');
console.log(`Result: ${newOne}`);
console.log(`Is Same: ${source === newOne}`);Alternative usage I:
import * as immunity from 'immunity';
const source = [ 'a', 'b' ];
const newOne = immunity.appendToArray(source, 'c');Alternative usage II:
import appendToArray from 'immunity/lib/appendToArray';
const source = [ 'a', 'b' ];
const newOne = appendToArray(source, 'c');List of modules
- appendToArray
- appendToObject
- copy
- dropFromArray
- dropFromObject
- filterArray
- filterObject
- mergeArrays
- mergeObjects
- pickFromArray
- pickFromObject
- prependToArray
- prependToObject
- removeFromArray
- removeKeyFromObject
- removeValueFromObject
- splitArray
- splitObject
- takeFromArray
- takeFromObject
Todo List
See GitHub Projects for more.
Requirements
- node.js (https://nodejs.org/)
License
Apache 2.0, for further details, please see LICENSE file
Contributing
See contributors.md
It is publicly open for any contribution. Bugfixes, new features and extra modules are welcome.
- To contribute to code: Fork the repo, push your changes to your fork, and submit a pull request.
- To report a bug: If something does not work, please report it using GitHub Issues.