@bedrock-ui/utils
Advanced tools
Comparing version 0.3.0 to 0.3.1
@@ -1,1 +0,2 @@ | ||
export declare function groupBy(): void; | ||
import type { TypeofArray } from '../../types/array'; | ||
export declare function groupBy<T extends TypeofArray<T>[], P extends keyof TypeofArray<T>>(array: T, property: P): Map<TypeofArray<T>[P], TypeofArray<T>[]>; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.groupBy = void 0; | ||
function groupBy() { } | ||
function groupBy(array, property) { | ||
const map = new Map(); | ||
array.forEach((element) => { | ||
map.set(element[property], [...(map.get(element[property]) || []), element]); | ||
}); | ||
return map; | ||
} | ||
exports.groupBy = groupBy; |
@@ -1,1 +0,2 @@ | ||
export declare function groupBy(): void; | ||
import type { TypeofArray } from '../../types/array'; | ||
export declare function groupBy<T extends TypeofArray<T>[], P extends keyof TypeofArray<T>>(array: T, property: P): Map<TypeofArray<T>[P], TypeofArray<T>[]>; |
@@ -1,1 +0,7 @@ | ||
export function groupBy() { } | ||
export function groupBy(array, property) { | ||
const map = new Map(); | ||
array.forEach((element) => { | ||
map.set(element[property], [...(map.get(element[property]) || []), element]); | ||
}); | ||
return map; | ||
} |
{ | ||
"name": "@bedrock-ui/utils", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"description": "Bedrock UI Utils", | ||
@@ -5,0 +5,0 @@ "author": "Matthew Wolfe", |
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
14897
336