Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

absurdum

Package Overview
Dependencies
Maintainers
1
Versions
177
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

absurdum

Reductio Ad Absurdum - The Ridiculous Application of Reduce

  • 1.1.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
15
increased by275%
Maintainers
1
Weekly downloads
 
Created
Source

GitHub Releases NPM Releases MIT License Latest Status Release Status

⚠️ Notice: Node users, this library relies heavily on features that are still marked 'experimental' in Node ⚠️

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.

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
  • Small Footprint -> 15K minified

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

OperatorLodashPolyfills
chunk_.chunk
compact_.compact
difference_.difference
drop_.drop
dropRight_.dropRight
fill_.fillArray.prototype.fill
filter_.filter
find_.findArray.prototype.find
findIndex_.findIndexArray.prototype.findIndex
findLastIndex_.findLastIndex
flat_.flattenArray.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

OperatorLodashPolyfills
assign_.assignObject.assign
at_.at
defaults_.defaults
defaultsDeep_.defaultsDeep
entries_.toPairsObject.entries
filter_.filter
findKey_.findKey
findLastKey_.findLastKey
forIn_.forIn
fromEntries_.fromPairsObject.fromEntries
get_.get
has_.has
invert_.invert
mapKeys_.mapKeys
mapValues_.mapValues
merge_.merge
pick_.pick
result_.result
transform_.transform
values_.valuesObject.values

Strings

OperatorLodashPolyfills
camelCase_.camelCase
chomp
deburr_.deburr
endsWith_.endsWithString.prototype.endsWith
includesString.prototype.includes
kebabCase_.kebabCase
pad_.pad
padEnd_.padEndString.prototype.padEnd
padStart_.padStartString.prototype.padStart
pascalCase_.startCase
repeat_.repeatString.prototype.repeat
reverse
snakeCase_.snakeCase
startsWith_.startsWithString.prototype.startsWith
trimEnd_.trimEndString.prototype.trimEnd
trimStart_.trimStartString.prototype.trimStart
truncate_.truncate
words_.words

Keywords

FAQs

Package last updated on 04 Feb 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc