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 - npm Package Compare versions

Comparing version 0.47.0 to 0.48.0

docs/arrays/frequency.md

20

dist/absurdum.esm.js

@@ -358,2 +358,21 @@ /**

/**
* Frequency returns an object mapping each unique item in an array
* to the number of items it occurs in the array.
*
* @param {Array} array input array
* @returns {Object} Object of uniq values and the frequency of occurrence
*
* @example
* const result = arrays.frequency(['a', 'b', 'a', 'c', 'a', 'c', 'b']);
* console.log(result)
* > { a: 3, b: 2, c: 2 }
*/
function frequency (array) {
return array.reduce((acc, curr) => {
acc[curr] = acc[curr] ? ++acc[curr] : 1;
return acc;
}, {});
}
/**
* FromPairs takes an array of arrays with key-value pairs and returns an

@@ -770,2 +789,3 @@ * object composed from key-value pairs.

flatten: flatten,
frequency: frequency,
fromPairs: fromPairs,

@@ -772,0 +792,0 @@ indexOf: indexOf,

2

package.json
{
"name": "absurdum",
"version": "0.47.0",
"version": "0.48.0",
"description": "Reductio Ad Absurdum - The Ridiculous Application of Reduce",

@@ -5,0 +5,0 @@ "keywords": [

@@ -63,2 +63,3 @@ [![GitHub Releases](https://img.shields.io/github/release/vanillaes/absurdum.svg)](https://github.com/vanillaes/absurdum/releases)

- [flatten][arrays.flatten]
- [frequency][arrays.frequency]
- [fromPairs][arrays.fromPairs]

@@ -96,2 +97,3 @@ - [indexOf][arrays.indexOf]

[arrays.flatten]: ./docs/arrays/flatten.md
[arrays.frequency]: ./docs/arrays/frequency.md
[arrays.fromPairs]: ./docs/arrays/fromPairs.md

@@ -98,0 +100,0 @@ [arrays.indexOf]: ./docs/arrays/indexOf.md

@@ -15,2 +15,3 @@ export { chunk } from "./chunk.js";

export { flatten } from "./flatten.js";
export { frequency } from "./frequency.js";
export { fromPairs } from "./fromPairs.js";

@@ -17,0 +18,0 @@ export { indexOf } from "./indexOf.js";

@@ -15,2 +15,3 @@ export { chunk } from './chunk.js';

export { flatten } from './flatten.js';
export { frequency } from './frequency.js';
export { fromPairs } from './fromPairs.js';

@@ -17,0 +18,0 @@ export { indexOf } from './indexOf.js';

Sorry, the diff of this file is not supported yet

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