@colearn/microservices-kit
Advanced tools
Comparing version 0.0.58 to 0.0.59
@@ -10,1 +10,2 @@ export declare function range(count: number): number[]; | ||
export declare function toggle<T>(array: T[], item: T): T[]; | ||
export declare function getEntityMap<T, K = string | number>(array: T[], keySelector: (t: T) => K): Map<K, T>; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.toggle = exports.replaceOrPrepend = exports.replaceOrAppend = exports.replace = exports.insert = exports.remove = exports.uniq = exports.rangeFrom = exports.range = void 0; | ||
exports.getEntityMap = exports.toggle = exports.replaceOrPrepend = exports.replaceOrAppend = exports.replace = exports.insert = exports.remove = exports.uniq = exports.rangeFrom = exports.range = void 0; | ||
function range(count) { | ||
@@ -9,3 +9,3 @@ return Array.from(Array(count).keys()); | ||
function rangeFrom(from, to) { | ||
return [...range(to - from).map((_, i) => i + from)]; | ||
return [...range(to - from + 1).map((_, i) => i + from)]; | ||
} | ||
@@ -42,2 +42,10 @@ exports.rangeFrom = rangeFrom; | ||
exports.toggle = toggle; | ||
function getEntityMap(array, keySelector) { | ||
const map = new Map(); | ||
for (const t of array) { | ||
map.set(keySelector(t), t); | ||
} | ||
return map; | ||
} | ||
exports.getEntityMap = getEntityMap; | ||
//# sourceMappingURL=arrays.js.map |
{ | ||
"name": "@colearn/microservices-kit", | ||
"version": "0.0.58", | ||
"version": "0.0.59", | ||
"description": "colearn microservice kit", | ||
@@ -5,0 +5,0 @@ "author": "Colearn", |
Sorry, the diff of this file is not supported yet
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
78486
1319