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

  • 0.81.9
  • 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

Absurdum

"if all you have is a hammer, everything looks like a nail" - Maslow's Hammer

In this package, Array.prototype.reduce is the hammer

Why the Funky Name?

It's a play on the latin phrase Reductio ad absurdum

In logic, reductio ad absurdum (Latin for "reduction to absurdity"; or argumentum ad absurdum, "argument to absurdity") is a form of argument which attempts either to disprove a statement by showing it inevitably leads to a ridiculous, absurd, or impractical conclusion, or to prove one by showing that if it were not true, the result would be absurd or impossible.

It is often said that of the big trio map, filter, and reduce, the first two are redundant. In fact, it's trivial to implement both map and filter using reduce.

This library exists to take that concept to an absurd extreme by using reduce to implement as many different types of functional transforms as possible.

What's the Point?

  • It's a challenge
  • It's good practice
  • It forces you to code/think in a functional manner
  • Who cares, it's fun

...and just maybe, new patterns/practice will emerge from pushing reduce to its limits.

Usage

Import the desired namespace then call the operator from it

import { arrays } from 'absurdum';

const input = ['a', 'b', 'c', 'd'];
const output = arrays.reverse(input);
console.log(output);
// > ['d', 'c', 'b', 'a']

CommonJS

A CommonJS bundle is included for backward compatibility with node <= 13.2

const absurdum = require('absurdum/index.cjs');

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 18 Jan 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