Installations
npm install array-hyper-unique
Developer Guide
Typescript
Yes
Module System
CommonJS, ESM
Node Version
21.7.1
NPM Version
lerna/6.6.2/node@v21.7.1+x64 (win32)
Releases
Unable to fetch releases
Contributors
Unable to fetch Contributors
Languages
TypeScript (74.2%)
JavaScript (25.8%)
Love this project? Help keep it running — sponsor us today! 🚀
Developer
bluelovers
Download Statistics
Total Downloads
2,967,071
Last Day
9,853
Last Week
50,177
Last Month
195,057
Last Year
1,571,198
GitHub Statistics
156 Commits
2 Watching
1 Branches
5 Contributors
Bundle Size
6.49 kB
Minified
2.28 kB
Minified + Gzipped
Package Meta Information
Latest Version
2.1.6
Package Id
array-hyper-unique@2.1.6
Unpacked Size
65.87 kB
Size
11.23 kB
File Count
21
NPM Version
lerna/6.6.2/node@v21.7.1+x64 (win32)
Node Version
21.7.1
Publised On
09 Mar 2024
Total Downloads
Cumulative downloads
Total Downloads
2,967,071
Last day
17.1%
9,853
Compared to previous day
Last week
-5.6%
50,177
Compared to previous week
Last month
28.7%
195,057
Compared to previous month
Last year
139.5%
1,571,198
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
array-hyper-unique
Get unique values of an array. Really, like deeply unique.
- this module base on arr-unique
- but rewrite to typescript and bug fix
- also add option control
- see _data.ts and test.test.ts or lib.chk.ts
1{ 'array-hyper-unique': { success: 15, fail: 0, error: 0 }, 2 'array-unique-deep': { success: 11, fail: 4, error: 0 }, 3 'array-uniq': { success: 7, fail: 8, error: 0 }, 4 'just-unique': { success: 7, fail: 8, error: 0 }, 5 'arr-unique': { success: 7, fail: 8, error: 0 }, 6 'lodash.uniq': { success: 7, fail: 8, error: 0 }, 7 'array-unique': { success: 6, fail: 9, error: 0 }, 8 '@arr/unique': { success: 6, fail: 9, error: 0 }, 9 'tfk-unique-array': { success: 5, fail: 6, error: 4 } }
demo
1import { array_unique, default as lazy_unique } from 'array-hyper-unique'; 2 3_testIt([ 4 1, 5 0, 6 true, 7 undefined, 8 null, 9 false, 10 ['a', 'b', 'c'], 11 ['a', 'b', 'c'], 12 ['a', 'c', 'b'], 13 { a: { b: 2 } }, 14 { a: { b: 2 } }, 15 { a: { b: 3 } }, 16 { a: { b: undefined } }, 17 { a: { } }, 18 { a: { b: 3, c: undefined } }, 19 ]) 20; 21 22_testIt( 23 [{a: {b: 2}}, {a: {b: 2}}, {a: {b: 3}}], 24); 25 26_testIt( 27 [1, 2, 3, 3], 28); 29 30_testIt( 31 [['a', 'b', 'c'], ['a', 'b', 'c'],], 32); 33 34function _testIt(data) 35{ 36 let actual = array_unique(data); 37 38 let actual2; 39 40 if (Array.isArray(data)) 41 { 42 actual2 = lazy_unique(...data); 43 } 44 else 45 { 46 actual2 = lazy_unique(data); 47 } 48 49 console.log(`========= input =========`); 50 51 console.dir(data); 52 53 console.log(`--------- array_unique ---------`); 54 console.dir(actual); 55 56 console.log(`--------- lazy_unique ---------`); 57 console.dir(actual2); 58}
1========= input ========= 2[ 1, 3 0, 4 true, 5 undefined, 6 null, 7 false, 8 [ 'a', 'b', 'c' ], 9 [ 'a', 'b', 'c' ], 10 [ 'a', 'c', 'b' ], 11 { a: { b: 2 } }, 12 { a: { b: 2 } }, 13 { a: { b: 3 } }, 14 { a: { b: undefined } }, 15 { a: {} }, 16 { a: { b: 3, c: undefined } } ] 17--------- array_unique --------- 18[ 1, 19 0, 20 true, 21 undefined, 22 null, 23 false, 24 [ 'a', 'b', 'c' ], 25 [ 'a', 'c', 'b' ], 26 { a: { b: 2 } }, 27 { a: { b: 3 } }, 28 { a: { b: undefined } }, 29 { a: {} }, 30 { a: { b: 3, c: undefined } } ] 31--------- lazy_unique --------- 32[ 1, 33 0, 34 true, 35 undefined, 36 null, 37 false, 38 [ 'a', 'b', 'c' ], 39 [ 'a', 'c', 'b' ], 40 { a: { b: 2 } }, 41 { a: { b: 3 } }, 42 { a: { b: undefined } }, 43 { a: {} }, 44 { a: { b: 3, c: undefined } } ] 45========= input ========= 46[ { a: { b: 2 } }, { a: { b: 2 } }, { a: { b: 3 } } ] 47--------- array_unique --------- 48[ { a: { b: 2 } }, { a: { b: 3 } } ] 49--------- lazy_unique --------- 50[ { a: { b: 2 } }, { a: { b: 3 } } ] 51========= input ========= 52[ 1, 2, 3, 3 ] 53--------- array_unique --------- 54[ 1, 2, 3 ] 55--------- lazy_unique --------- 56[ 1, 2, 3 ] 57========= input ========= 58[ [ 'a', 'b', 'c' ], [ 'a', 'b', 'c' ] ] 59--------- array_unique --------- 60[ [ 'a', 'b', 'c' ] ] 61--------- lazy_unique --------- 62[ [ 'a', 'b', 'c' ] ]
options
1array_unique(arr_input, { 2 checker(element, array, arr_new, arr_old) 3 { 4 let bool: boolean; 5 6 // do equal check 7 8 return bool; 9 }, 10 11 // overwrite source array 12 overwrite: true, 13})
diff with other module
[LOG] main mixin test
--------------
[SUCCESS] array-hyper-unique
[FAIL] array-uniq
[FAIL] array-unique
[FAIL] @arr/unique
[ERROR] tfk-unique-array Unexpected token u in JSON at position 0
[FAIL] just-unique
[FAIL] arr-unique
[FAIL] array-unique-deep
[FAIL] lodash.uniq
[LOG] object
--------------
[SUCCESS] array-hyper-unique
[FAIL] array-uniq
[FAIL] array-unique
[FAIL] @arr/unique
[SUCCESS] tfk-unique-array
[FAIL] just-unique
[SUCCESS] arr-unique
[SUCCESS] array-unique-deep
[FAIL] lodash.uniq
[LOG] number
--------------
[SUCCESS] array-hyper-unique
[SUCCESS] array-uniq
[SUCCESS] array-unique
[SUCCESS] @arr/unique
[SUCCESS] tfk-unique-array
[SUCCESS] just-unique
[SUCCESS] arr-unique
[SUCCESS] array-unique-deep
[SUCCESS] lodash.uniq
[LOG] number 2
--------------
[SUCCESS] array-hyper-unique
[SUCCESS] array-uniq
[FAIL] array-unique
[FAIL] @arr/unique
[FAIL] tfk-unique-array
[SUCCESS] just-unique
[FAIL] arr-unique
[SUCCESS] array-unique-deep
[SUCCESS] lodash.uniq
[LOG] string
--------------
[SUCCESS] array-hyper-unique
[SUCCESS] array-uniq
[SUCCESS] array-unique
[SUCCESS] @arr/unique
[SUCCESS] tfk-unique-array
[SUCCESS] just-unique
[SUCCESS] arr-unique
[SUCCESS] array-unique-deep
[SUCCESS] lodash.uniq
[LOG] string[]
--------------
[SUCCESS] array-hyper-unique
[FAIL] array-uniq
[FAIL] array-unique
[FAIL] @arr/unique
[SUCCESS] tfk-unique-array
[FAIL] just-unique
[FAIL] arr-unique
[SUCCESS] array-unique-deep
[FAIL] lodash.uniq
[LOG] RegExp
--------------
[SUCCESS] array-hyper-unique
[FAIL] array-uniq
[FAIL] array-unique
[FAIL] @arr/unique
[FAIL] tfk-unique-array
[FAIL] just-unique
[FAIL] arr-unique
[SUCCESS] array-unique-deep
[FAIL] lodash.uniq
[LOG] boolean
--------------
[SUCCESS] array-hyper-unique
[SUCCESS] array-uniq
[SUCCESS] array-unique
[SUCCESS] @arr/unique
[SUCCESS] tfk-unique-array
[SUCCESS] just-unique
[SUCCESS] arr-unique
[SUCCESS] array-unique-deep
[SUCCESS] lodash.uniq
[LOG] boolean 2
--------------
[SUCCESS] array-hyper-unique
[SUCCESS] array-uniq
[SUCCESS] array-unique
[SUCCESS] @arr/unique
[ERROR] tfk-unique-array Unexpected token u in JSON at position 0
[SUCCESS] just-unique
[FAIL] arr-unique
[SUCCESS] array-unique-deep
[SUCCESS] lodash.uniq
[LOG] Map
--------------
[SUCCESS] array-hyper-unique
[FAIL] array-uniq
[FAIL] array-unique
[FAIL] @arr/unique
[FAIL] tfk-unique-array
[FAIL] just-unique
[SUCCESS] arr-unique
[SUCCESS] array-unique-deep
[FAIL] lodash.uniq
[LOG] function
--------------
[SUCCESS] array-hyper-unique
[SUCCESS] array-uniq
[SUCCESS] array-unique
[SUCCESS] @arr/unique
[ERROR] tfk-unique-array Unexpected token u in JSON at position 0
[SUCCESS] just-unique
[SUCCESS] arr-unique
[FAIL] array-unique-deep
[SUCCESS] lodash.uniq
[LOG] function 2
--------------
[SUCCESS] array-hyper-unique
[FAIL] array-uniq
[FAIL] array-unique
[FAIL] @arr/unique
[ERROR] tfk-unique-array Unexpected token u in JSON at position 0
[FAIL] just-unique
[SUCCESS] arr-unique
[FAIL] array-unique-deep
[FAIL] lodash.uniq
[LOG] Buffer
--------------
[SUCCESS] array-hyper-unique
[FAIL] array-uniq
[FAIL] array-unique
[FAIL] @arr/unique
[FAIL] tfk-unique-array
[FAIL] just-unique
[FAIL] arr-unique
[SUCCESS] array-unique-deep
[FAIL] lodash.uniq
[LOG] ArrayBuffer
--------------
[SUCCESS] array-hyper-unique
[SUCCESS] array-uniq
[SUCCESS] array-unique
[SUCCESS] @arr/unique
[FAIL] tfk-unique-array
[SUCCESS] just-unique
[FAIL] arr-unique
[FAIL] array-unique-deep
[SUCCESS] lodash.uniq
[LOG] Buffer & ArrayBuffer
--------------
[SUCCESS] array-hyper-unique
[FAIL] array-uniq
[FAIL] array-unique
[FAIL] @arr/unique
[FAIL] tfk-unique-array
[FAIL] just-unique
[FAIL] arr-unique
[SUCCESS] array-unique-deep
[FAIL] lodash.uniq
1{ 2 'array-hyper-unique': { success: 15, fail: 0, error: 0 }, 3 'array-unique-deep': { success: 11, fail: 4, error: 0 }, 4 'array-uniq': { success: 7, fail: 8, error: 0 }, 5 'just-unique': { success: 7, fail: 8, error: 0 }, 6 'arr-unique': { success: 7, fail: 8, error: 0 }, 7 'lodash.uniq': { success: 7, fail: 8, error: 0 }, 8 'array-unique': { success: 6, fail: 9, error: 0 }, 9 '@arr/unique': { success: 6, fail: 9, error: 0 }, 10 'tfk-unique-array': { success: 5, fail: 6, error: 4 } 11}
![Empty State](/_next/static/media/empty.e5fae2e5.png)
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
no SAST tool detected
Details
- Warn: no pull requests merged into dev branch
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
license file not detected
Details
- Warn: project does not have a license file
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Score
2.6
/10
Last Scanned on 2025-02-03
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More