Absurdum is a Javascript utility library built with a focus on providing idempotent side-effect free functions and clear/readable modular source for tree shaking.
- Explores the flexibility of Reduce
- Abstraction Free -> tree-shake friendly
- Functional -> all operators are side-effect free
- Polyfills -> includes operator polyfills for older browsers
- Isomorphic -> works consistently across all JS runtimes
- Typescript -> typings are provided for all operators
- Intellisense -> supports code completions + inline documentation
- Well Tested -> includes 600+ tests covering every aspect
This package works isomorphically in browsers and server-side JavaScript runtimes
Import directly from the local path or a CDN
Top-level operator namespaces (ie [arrays, objects, strings]
) can be imported from the index
<script type="module">
import { arrays, objects, strings } from 'path/to/absurdum/index.js'
</script>
The minified version can be imported from
<script type="module">
import { arrays, objects, strings } from 'path/to/absurdum/index.min.js'
</script>
Install the package
npm install @vanillaes/absurdum
Top-level operator namespaces are provided
import { arrays, objects, strings } from '@vanillaes/absurdum';
Individual operators can also be imported from their parent namespaces
import { chunk, find } from '@vanillaes/absurdum/arrays';
import { assign, invert } from '@vanillaes/absurdum/objects';
import { camelCase, repeat } from '@vanillaes/absurdum/strings';
Note: Webpack's tree-shaking algorithm doesn't work with multi-layered exports. To optimize bundle size, prefer individual operator imports.
Import an operator and feed it some inputs
const input = ['a', 'b', 'c', 'd'];
const output = reverse(input);
console.log(output);
// > ['d', 'c', 'b', 'a']
Tip: For VSCode users. Input type-checking, intellisense, and inline documentation are all supported.