Comparing version 0.27.0 to 0.28.0
@@ -466,2 +466,19 @@ 'use strict'; | ||
/** | ||
* Removes all duplicate items of an array | ||
* | ||
* @param {Array} array input array | ||
* @returns {Array} an array of unique values | ||
* @example | ||
* const result = arrays.unique([2, 1, 2]); | ||
* console.log(result); | ||
* > [2, 1] | ||
*/ | ||
function unique (array) { | ||
return [...array.reduce((acc, curr, i, arr) => { | ||
acc.add(curr); | ||
return acc; | ||
}, new Set())]; | ||
} | ||
/** | ||
* Zip applies a specified function to the corresponding elements of two sequences, | ||
@@ -523,2 +540,3 @@ * producing a sequence of the results. | ||
tap: tap, | ||
unique: unique, | ||
zip: zip | ||
@@ -525,0 +543,0 @@ }); |
@@ -462,2 +462,19 @@ /** | ||
/** | ||
* Removes all duplicate items of an array | ||
* | ||
* @param {Array} array input array | ||
* @returns {Array} an array of unique values | ||
* @example | ||
* const result = arrays.unique([2, 1, 2]); | ||
* console.log(result); | ||
* > [2, 1] | ||
*/ | ||
function unique (array) { | ||
return [...array.reduce((acc, curr, i, arr) => { | ||
acc.add(curr); | ||
return acc; | ||
}, new Set())]; | ||
} | ||
/** | ||
* Zip applies a specified function to the corresponding elements of two sequences, | ||
@@ -519,2 +536,3 @@ * producing a sequence of the results. | ||
tap: tap, | ||
unique: unique, | ||
zip: zip | ||
@@ -521,0 +539,0 @@ }); |
{ | ||
"name": "absurdum", | ||
"version": "0.27.0", | ||
"version": "0.28.0", | ||
"description": "Reductio Ad Absurdum - The Ridiculous Application of Reduce", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -67,2 +67,3 @@ [![GitHub release](https://img.shields.io/github/release/vanillaes/absurdum.svg)](https://github.com/vanillaes/absurdum/releases) | ||
- [tap][arrays.tap] | ||
- [unique][arrays.unique] | ||
- [zip][arrays.zip] | ||
@@ -88,2 +89,3 @@ | ||
[arrays.tap]: ./docs/arrays/tap.md | ||
[arrays.unique]: ./docs/arrays.unique.md | ||
[arrays.zip]: ./docs/arrays/zip.md | ||
@@ -90,0 +92,0 @@ |
@@ -19,2 +19,3 @@ export { chunk } from './chunk.js'; | ||
export { tap } from './tap.js'; | ||
export { unique } from './unique.js'; | ||
export { zip } from './zip.js'; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
102153
88
2607
116