@dankreiger/groop
Advanced tools
Comparing version 0.1.28 to 0.1.29
export type ObjectKey = string | number | symbol; | ||
export type EntityDict<Entity, Key extends ObjectKey> = { | ||
entities: Record<Key, ReadonlyArray<Entity> | undefined>; | ||
ids: ReadonlyArray<Key>; | ||
}; | ||
export type MutableEntityDict<Entity, Key extends ObjectKey> = { | ||
entities: Record<Key, Entity[] | undefined>; | ||
ids: Key[]; | ||
}; |
@@ -1,5 +0,5 @@ | ||
import type { EntityDict } from '../../typings'; | ||
import type { MutableEntityDict } from '../../typings'; | ||
/** | ||
* O(n) implementation of groupBy | ||
*/ | ||
export declare const groupBy: <K extends keyof T, T extends Record<K, T[K]>>(key: K, items: T[]) => EntityDict<T, T[K]>; | ||
export declare const groupBy: <K extends keyof T, T extends Record<K, T[K]>>(key: K, items: T[]) => MutableEntityDict<T, T[K]>; |
{ | ||
"name": "@dankreiger/groop", | ||
"version": "0.1.28", | ||
"version": "0.1.29", | ||
"description": "Normalize an array of objects by a property.", | ||
@@ -27,3 +27,3 @@ "homepage": "https://github.com/dankreiger/groop#readme", | ||
"scripts": { | ||
"build": "scripty", | ||
"build": "npm run clean && npx tsc && npx rollup -c", | ||
"clean": "scripty", | ||
@@ -47,37 +47,37 @@ "commit": "scripty", | ||
"devDependencies": { | ||
"@babel/core": "7.20.2", | ||
"@babel/plugin-transform-runtime": "7.19.6", | ||
"@babel/preset-env": "7.20.2", | ||
"@babel/preset-typescript": "7.18.6", | ||
"@babel/runtime": "7.20.1", | ||
"@commitlint/cli": "17.3.0", | ||
"@commitlint/config-conventional": "17.3.0", | ||
"@commitlint/prompt-cli": "17.3.0", | ||
"@babel/core": "7.23.2", | ||
"@babel/plugin-transform-runtime": "7.23.2", | ||
"@babel/preset-env": "7.23.2", | ||
"@babel/preset-typescript": "7.23.2", | ||
"@babel/runtime": "7.23.2", | ||
"@commitlint/cli": "17.8.0", | ||
"@commitlint/config-conventional": "17.8.0", | ||
"@commitlint/prompt-cli": "17.8.0", | ||
"@rollup/plugin-babel": "5.3.1", | ||
"@rollup/plugin-commonjs": "22.0.2", | ||
"@rollup/plugin-node-resolve": "13.3.0", | ||
"@semantic-release/changelog": "6.0.1", | ||
"@semantic-release/changelog": "6.0.3", | ||
"@semantic-release/git": "10.0.1", | ||
"@semantic-release/github": "8.0.6", | ||
"@semantic-release/npm": "9.0.1", | ||
"@size-limit/preset-small-lib": "8.1.0", | ||
"@semantic-release/github": "8.1.0", | ||
"@semantic-release/npm": "9.0.2", | ||
"@size-limit/preset-small-lib": "8.2.6", | ||
"@size-limit/webpack": "8.1.0", | ||
"@size-limit/webpack-why": "8.1.0", | ||
"@types/jest": "29.2.3", | ||
"@types/node": "18.11.9", | ||
"@typescript-eslint/eslint-plugin": "5.44.0", | ||
"@typescript-eslint/parser": "5.44.0", | ||
"commitizen": "4.2.5", | ||
"@types/jest": "29.5.5", | ||
"@types/node": "18.19.5", | ||
"@typescript-eslint/eslint-plugin": "5.62.0", | ||
"@typescript-eslint/parser": "5.62.0", | ||
"commitizen": "4.3.0", | ||
"cz-conventional-changelog": "3.3.0", | ||
"eslint": "8.28.0", | ||
"eslint-config-prettier": "8.5.0", | ||
"eslint": "8.51.0", | ||
"eslint-config-prettier": "8.10.0", | ||
"eslint-plugin-jest": "26.9.0", | ||
"eslint-plugin-prettier": "4.2.1", | ||
"jest": "29.3.1", | ||
"lefthook": "1.2.2", | ||
"prettier": "2.8.0", | ||
"jest": "29.7.0", | ||
"lefthook": "1.5.2", | ||
"prettier": "2.8.8", | ||
"rimraf": "3.0.2", | ||
"rollup": "2.79.1", | ||
"rollup-plugin-terser": "7.0.2", | ||
"rollup-plugin-typescript2": "0.34.1", | ||
"rollup-plugin-typescript2": "0.36.0", | ||
"scripty": "2.1.1", | ||
@@ -87,6 +87,6 @@ "semantic-release": "19.0.5", | ||
"sort-package-json": "1.57.0", | ||
"ts-jest": "29.0.3", | ||
"ts-jest": "29.1.1", | ||
"ts-node": "10.9.1", | ||
"tslib": "2.4.1", | ||
"typescript": "4.9.3" | ||
"tslib": "2.6.2", | ||
"typescript": "4.9.5" | ||
}, | ||
@@ -93,0 +93,0 @@ "publishConfig": { |
export type ObjectKey = string | number | symbol; | ||
export type EntityDict<Entity, Key extends ObjectKey> = { | ||
entities: Record<Key, ReadonlyArray<Entity> | undefined>; | ||
ids: ReadonlyArray<Key>; | ||
}; | ||
export type MutableEntityDict<Entity, Key extends ObjectKey> = { | ||
entities: Record<Key, Entity[] | undefined>; | ||
ids: Key[]; | ||
}; |
@@ -1,2 +0,2 @@ | ||
import type { EntityDict } from '../../typings'; | ||
import type { MutableEntityDict } from '../../typings'; | ||
@@ -10,3 +10,3 @@ /** | ||
) => { | ||
const result = { entities: {}, ids: [] } as EntityDict<T, T[K]>; | ||
const result = { entities: {}, ids: [] } as MutableEntityDict<T, T[K]>; | ||
@@ -13,0 +13,0 @@ for (let i = 0; i < items.length; i++) { |
13681
281