This package has been deprecated

Author message:

Moved to @vanillaes/absurdum

absurdum
TypeScript icon, indicating that this package has built-in type declarations

1.1.10 • Public • Published

Absurdum Logo


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.

GitHub Releases NPM Release Bundlephobia MIT License Latest Status Release Status

Features

  • Explores the flexibility of Reduce
  • Abstraction Free -> tree-shake friendly
  • Functional -> all operators are side-effect free
  • Polyfills -> includes operator polyfills for older browsers
  • Modern -> works transparently with ESM and CJS
  • Typescript -> typings are provided for all operators
  • Intellisense -> supports code completions + inline documentation
  • Well Tested -> includes 600+ tests covering every aspect

Imports

This package provides a variety of entry-points for all JS platforms

Browsers

All top-level operator namespaces (ie [arrays, objects, strings]) can be imported from the index

import { arrays, objects, strings } from 'path/to/absurdum/index.js';

The minified version can be imported from

import { arrays, objects, strings } from 'path/to/absurdum/index.min.js';

Node/Bundlers (ESM)

Top-level ES module namespaces are provided for Node/Bundlers

import { arrays, objects, strings } from 'absurdum';

Individual operators can be imported from their parent namespaces

import { chunk, find } from 'absurdum/arrays';
import { assign, invert } from 'absurdum/objects';
import { camelCase, repeat } from 'absurdum/strings';

Note: Webpack's tree-shaking algorithm doesn't handle multi-layered exports. To optimize bundle size, prefer individual operator imports.

Node/Legacy (CJS)

For Node users who rely on CommonJS, top-level namespaces are provided

const arrays = require('absurdum').arrays;
const objects = require('absurdum').objects;
const strings = require('absurdum').strings;

Note: CJS entry-points are backward-compatible with all non-EOL versions of Node

Usage

Import an operator and feed it some inputs

import { reverse } from 'absurdum/arrays';
 
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.

API Documentation

Arrays

Operator Lodash Polyfills
chunk _.chunk
compact _.compact
difference _.difference
drop _.drop
dropRight _.dropRight
fill _.fill Array.prototype.fill
filter _.filter
find _.find Array.prototype.find
findIndex _.findIndex Array.prototype.findIndex
findLastIndex _.findLastIndex
flat _.flatten Array.prototype.flat
frequency
intersection _.intersection
map _.map
pull _.pull
take _.take
takeRight _.takeRight
union _.union
unique _.uniq
unzip _.unzip
without _.without
xor _.xor
zip _.zip

Objects

Operator Lodash Polyfills
assign _.assign Object.assign
at _.at
defaults _.defaults
defaultsDeep _.defaultsDeep
entries _.toPairs Object.entries
filter _.filter
findKey _.findKey
findLastKey _.findLastKey
forIn _.forIn
fromEntries _.fromPairs Object.fromEntries
get _.get
has _.has
invert _.invert
mapKeys _.mapKeys
mapValues _.mapValues
merge _.merge
pick _.pick
result _.result
transform _.transform
values _.values Object.values

Strings

Operator Lodash Polyfills
camelCase _.camelCase
chomp
deburr _.deburr
endsWith _.endsWith String.prototype.endsWith
includes String.prototype.includes
kebabCase _.kebabCase
pad _.pad
padEnd _.padEnd String.prototype.padEnd
padStart _.padStart String.prototype.padStart
pascalCase _.startCase
repeat _.repeat String.prototype.repeat
reverse
snakeCase _.snakeCase
startsWith _.startsWith String.prototype.startsWith
trimEnd _.trimEnd String.prototype.trimEnd
trimStart _.trimStart String.prototype.trimStart
truncate _.truncate
words _.words

Package Sidebar

Install

npm i absurdum

Weekly Downloads

70

Version

1.1.10

License

MIT

Unpacked Size

199 kB

Total Files

136

Last publish

Collaborators

  • evanplaice