@definitelytyped/utils
Advanced tools
Comparing version 0.0.155 to 0.0.156-next.0
@@ -40,3 +40,3 @@ export declare function initArray<T>(length: number, makeElement: (i: number) => T): T[]; | ||
/** | ||
* Maps an array. If the mapped value is an array, it is spread into the result. | ||
* Maps an array. The mapped value is spread into the result. | ||
* | ||
@@ -46,3 +46,3 @@ * @param array The array to map. | ||
*/ | ||
export declare function flatMap<T, U>(array: readonly T[] | undefined, mapfn: (x: T, i: number) => U | readonly U[] | undefined): readonly U[]; | ||
export declare function flatMap<T, U>(array: readonly T[] | undefined, mapfn: (x: T, i: number) => readonly U[]): readonly U[]; | ||
export declare function unique<T>(arr: Iterable<T>): T[]; | ||
@@ -49,0 +49,0 @@ export declare function sortObjectKeys<T extends { |
@@ -121,3 +121,3 @@ "use strict"; | ||
/** | ||
* Maps an array. If the mapped value is an array, it is spread into the result. | ||
* Maps an array. The mapped value is spread into the result. | ||
* | ||
@@ -131,11 +131,3 @@ * @param array The array to map. | ||
for (let i = 0; i < array.length; i++) { | ||
const v = mapfn(array[i], i); | ||
if (v) { | ||
if (isArray(v)) { | ||
result = addRange(result, v); | ||
} | ||
else { | ||
result = append(result, v); | ||
} | ||
} | ||
result = addRange(result, mapfn(array[i], i)); | ||
} | ||
@@ -142,0 +134,0 @@ } |
{ | ||
"name": "@definitelytyped/utils", | ||
"version": "0.0.155", | ||
"version": "0.0.156-next.0", | ||
"description": "Shared utilities for DefinitelyTyped tools", | ||
@@ -39,3 +39,3 @@ "homepage": "https://github.com/microsoft/DefinitelyTyped-tools/tree/master/packages/utils#readme", | ||
}, | ||
"gitHead": "87d6ebe276b211cf814fd73388b1d18486601ba6" | ||
"gitHead": "8a6232e6ff9cf8b2da4e8e1602a4a2c92393bda8" | ||
} |
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
130417
1952