@bothrs/util
Advanced tools
Comparing version 1.2.0 to 1.3.0
{ | ||
"name": "@bothrs/util", | ||
"version": "1.2.0", | ||
"version": "1.3.0", | ||
"description": "Common helper functions", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
10
uniq.js
// Usage: | ||
// items.filter(uniq) | ||
// items.filter(uniqBy('id')) | ||
// items.filter(uniqBy(item => item.origin + item.path)) | ||
function uniq(v, i, a) { | ||
export function uniq(v, i, a) { | ||
return a.findIndex(b => b === v) === i | ||
} | ||
function uniqBy(prop) { | ||
// Usage: | ||
// items.filter(uniqBy('id')) | ||
// items.filter(uniqBy(item => item.origin + item.path)) | ||
export function uniqBy(prop) { | ||
return typeof prop === 'function' | ||
@@ -12,0 +12,0 @@ ? (v, i, a) => a.findIndex(v2 => func(v) === func(v2)) === i |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
45893
52
1610
20