@flock/kotlin-ts
Advanced tools
Comparing version 0.0.13 to 0.0.14
@@ -362,3 +362,3 @@ import { Sequence } from "@flock/kotlin-ts/Sequence"; | ||
*/ | ||
export declare const groupBy: <T, K>(self: Iterable<T>, keySelector: (it: T) => K) => Map<K, T[]>; | ||
export declare const groupBy: <T, K, V>(self: Iterable<T>, keySelector: (it: T) => K, valueTransform?: (it: T) => V) => Map<K, V[]>; | ||
/** | ||
@@ -365,0 +365,0 @@ * Groups values returned by the [valueTransform] function applied to each element of the original collection |
@@ -407,3 +407,3 @@ import * as tsplus_module_1 from "@flock/kotlin-ts/Sequence"; | ||
*/ | ||
export const groupBy = (self, keySelector) => { | ||
export const groupBy = (self, keySelector, valueTransform = (it) => it) => { | ||
const map = new Map(); | ||
@@ -413,8 +413,3 @@ for (const it of self) { | ||
const value = map.get(key); | ||
if (value == null) { | ||
map.set(key, [it]); | ||
} | ||
else { | ||
map.set(key, plus_1(value, it)); | ||
} | ||
map.set(key, plus_1((value == null ? [] : value), valueTransform(it))); | ||
} | ||
@@ -421,0 +416,0 @@ return map; |
@@ -362,3 +362,3 @@ import { Sequence } from "@flock/kotlin-ts/Sequence"; | ||
*/ | ||
export declare const groupBy: <T, K>(self: Iterable<T>, keySelector: (it: T) => K) => Map<K, T[]>; | ||
export declare const groupBy: <T, K, V>(self: Iterable<T>, keySelector: (it: T) => K, valueTransform?: (it: T) => V) => Map<K, V[]>; | ||
/** | ||
@@ -365,0 +365,0 @@ * Groups values returned by the [valueTransform] function applied to each element of the original collection |
@@ -446,3 +446,3 @@ "use strict"; | ||
*/ | ||
const groupBy = (self, keySelector) => { | ||
const groupBy = (self, keySelector, valueTransform = (it) => it) => { | ||
const map = new Map(); | ||
@@ -452,8 +452,3 @@ for (const it of self) { | ||
const value = map.get(key); | ||
if (value == null) { | ||
map.set(key, [it]); | ||
} | ||
else { | ||
map.set(key, plus_1(value, it)); | ||
} | ||
map.set(key, plus_1((value == null ? [] : value), valueTransform(it))); | ||
} | ||
@@ -460,0 +455,0 @@ return map; |
{ | ||
"name": "@flock/kotlin-ts", | ||
"version": "0.0.13", | ||
"version": "0.0.14", | ||
"author": "Kasper Peulen", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
Sorry, the diff of this file is not supported yet
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
236327
0
4622