inline-loops.macro
Advanced tools
Comparing version 2.0.1 to 2.0.2
@@ -64,2 +64,11 @@ "use strict"; | ||
if (!callbackContainsThis) { | ||
if (isForEach) { | ||
body.traverse(traverseConfigs.stripReturn, { | ||
isForEach: isForEach | ||
}); | ||
return { | ||
injectedBody: body.node.body, | ||
returned: t.identifier('undefined') | ||
}; | ||
} | ||
if (returnCount < 2) { | ||
@@ -130,3 +139,3 @@ body.traverse(traverseConfigs.stripReturn, { | ||
var localCollection = collection.node; | ||
if (!collection.isIdentifier()) { | ||
if (!collection.isIdentifier() && !collection.isMemberExpression()) { | ||
localCollection = (0, _utils.getLocalName)(path, 'collection'); | ||
@@ -133,0 +142,0 @@ var localVariable = templates.localVariable({ |
@@ -66,20 +66,14 @@ type ArrayHandler<Item, Result> = ( | ||
declare function findIndex<Item, Collection extends Item[]>( | ||
collection: Collection, | ||
declare function findIndex<Item>( | ||
collection: Item[], | ||
handler: ArrayHandler<Item, unknown>, | ||
): keyof Collection | -1; | ||
declare function findKey< | ||
Item, | ||
Collection extends Record<number | string, Item>, | ||
>( | ||
collection: Collection, | ||
): number; | ||
declare function findKey<Item>( | ||
collection: Record<number | string, Item>, | ||
handler: ObjectHandler<Item, unknown>, | ||
): keyof Collection | void; | ||
declare function findLastIndex< | ||
Item, | ||
Collection extends Record<number | string, Item>, | ||
>( | ||
collection: Collection, | ||
): string | void; | ||
declare function findLastIndex<Item>( | ||
collection: Item[], | ||
handler: ArrayHandler<Item, unknown>, | ||
): keyof Collection | -1; | ||
): number; | ||
@@ -86,0 +80,0 @@ declare function forEach<Item>( |
@@ -61,3 +61,3 @@ { | ||
"typings": "./index.d.ts", | ||
"version": "2.0.1" | ||
"version": "2.0.2" | ||
} |
69114
1278