@augment-vir/common
Advanced tools
Comparing version 28.0.0 to 28.0.1
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.filterMap = exports.arrayToObject = exports.groupArrayBy = exports.repeatArray = exports.typedMap = exports.typedArrayIncludes = exports.trimArrayStrings = exports.flatten2dArray = exports.filterOutIndexes = void 0; | ||
const get_or_set_1 = require("../object/get-or-set"); | ||
const object_entries_1 = require("../object/object-entries"); | ||
@@ -38,6 +39,4 @@ function filterOutIndexes(array, indexes) { | ||
const key = callback(entry, index, originalArray); | ||
if (!(key in accum)) { | ||
accum[key] = []; | ||
} | ||
accum[key].push(entry); | ||
const entryArray = (0, get_or_set_1.getOrSet)(accum, key, () => []); | ||
entryArray.push(entry); | ||
return accum; | ||
@@ -44,0 +43,0 @@ }, {}); |
@@ -0,1 +1,2 @@ | ||
import { getOrSet } from '../object/get-or-set'; | ||
import { typedObjectFromEntries } from '../object/object-entries'; | ||
@@ -29,6 +30,4 @@ export function filterOutIndexes(array, indexes) { | ||
const key = callback(entry, index, originalArray); | ||
if (!(key in accum)) { | ||
accum[key] = []; | ||
} | ||
accum[key].push(entry); | ||
const entryArray = getOrSet(accum, key, () => []); | ||
entryArray.push(entry); | ||
return accum; | ||
@@ -35,0 +34,0 @@ }, {}); |
@@ -18,3 +18,3 @@ import { AtLeastTuple } from '../tuple'; | ||
*/ | ||
export declare function groupArrayBy<ElementType, NewKey extends PropertyKey>(inputArray: ReadonlyArray<ElementType>, callback: (entry: ElementType, index: number, originalArray: ReadonlyArray<ElementType>) => NewKey): Record<NewKey, ElementType[]>; | ||
export declare function groupArrayBy<ElementType, NewKey extends PropertyKey>(inputArray: ReadonlyArray<ElementType>, callback: (entry: ElementType, index: number, originalArray: ReadonlyArray<ElementType>) => NewKey): Partial<Record<NewKey, ElementType[]>>; | ||
/** | ||
@@ -24,5 +24,5 @@ * Like `groupArrayBy` but maps array entries to a single key. Meaning, the resulting object does | ||
*/ | ||
export declare function arrayToObject<ElementType, NewKey extends PropertyKey>(inputArray: ReadonlyArray<ElementType>, callback: (entry: ElementType, index: number, originalArray: ReadonlyArray<ElementType>) => NewKey): Record<NewKey, ElementType>; | ||
export declare function arrayToObject<ElementType, NewKey extends PropertyKey>(inputArray: ReadonlyArray<ElementType>, callback: (entry: ElementType, index: number, originalArray: ReadonlyArray<ElementType>) => NewKey): Partial<Record<NewKey, ElementType>>; | ||
export declare function filterMap<ElementType, MappedEntry, TypeGuarded extends MappedEntry>(inputArray: ReadonlyArray<ElementType>, mapCallback: (entry: ElementType, index: number, originalArray: ReadonlyArray<ElementType>) => MappedEntry, filterCallback: (mappedOutput: MappedEntry, originalEntry: ElementType, index: number, originalArray: ReadonlyArray<ElementType>) => mappedOutput is TypeGuarded): TypeGuarded[]; | ||
export declare function filterMap<ElementType, MappedEntry>(inputArray: ReadonlyArray<ElementType>, mapCallback: (entry: ElementType, index: number, originalArray: ReadonlyArray<ElementType>) => MappedEntry, filterCallback: (mappedOutput: MappedEntry, originalEntry: ElementType, index: number, originalArray: ReadonlyArray<ElementType>) => boolean): MappedEntry[]; | ||
export {}; |
{ | ||
"name": "@augment-vir/common", | ||
"version": "28.0.0", | ||
"version": "28.0.1", | ||
"homepage": "https://github.com/electrovir/augment-vir/tree/main/packages/common", | ||
@@ -5,0 +5,0 @@ "bugs": { |
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
164851
4039