@@ -101,9 +101,15 @@ module LodashUnderscore {
101
101
exists ( DataFlow:: CallNode call , string name |
102
102
// Members ending with By, With, or While indicate that they are a variant of
103
103
// another function that takes a callback.
104
- name .matches ( [ "%By" , "%With" , "%While" ] ) or
104
+ name .matches ( [ "%By" , "%With" , "%While" ] )
105
+ or
105
106
// Other members that don't fit the above pattern.
106
- name = [ "each" , "eachRight" , "every" , "filter" , "find" , "findLast" , "flatMap" , "flatMapDeep" , "flatMapDepth" , "forEach" , "forEachRight" , "partition" , "reduce" , "reduceRight" , "replace" , "some" , "transform" ]
107
+ name =
108
+ [
109
+ "each" , "eachRight" , "every" , "filter" , "find" , "findLast" , "flatMap" , "flatMapDeep" ,
110
+ "flatMapDepth" , "forEach" , "forEachRight" , "partition" , "reduce" , "reduceRight" ,
111
+ "replace" , "some" , "transform"
112
+ ]
107
113
|
108
114
call = member ( name ) .getACall ( ) and
109
115
pred = call .getAnArgument ( ) .( DataFlow:: FunctionNode ) .getExceptionalReturn ( ) and
@@ -181,77 +187,30 @@ private class LodashCallbackAsPartialInvoke extends DataFlow::PartialInvokeNode:
181
187
this = LodashUnderscore:: member ( name ) .getACall ( ) and
182
188
getNumArgument ( ) = argumentCount
183
189
|
184
- (
185
- name = [ "bind" , "callback" , "iteratee" ]
186
- ) and
190
+ name = [ "bind" , "callback" , "iteratee" ] and
187
191
callbackIndex = 0 and
188
192
contextIndex = 1 and
189
193
argumentCount = 2
190
194
or
191
- (
192
- name = [
193
- "all" ,
194
- "any" ,
195
- "collect" ,
196
- "countBy" ,
197
- "detect" ,
198
- "dropRightWhile" ,
199
- "dropWhile" ,
200
- "each" ,
201
- "eachRight" ,
202
- "every" ,
203
- "filter" ,
204
- "find" ,
205
- "findIndex" ,
206
- "findKey" ,
207
- "findLast" ,
208
- "findLastIndex" ,
209
- "findLastKey" ,
210
- "forEach" ,
211
- "forEachRight" ,
212
- "forIn" ,
213
- "forInRight" ,
214
- "groupBy" ,
215
- "indexBy" ,
216
- "map" ,
217
- "mapKeys" ,
218
- "mapValues" ,
219
- "max" ,
220
- "min" ,
221
- "omit" ,
222
- "partition" ,
223
- "pick" ,
224
- "reject" ,
225
- "remove" ,
226
- "select" ,
227
- "some" ,
228
- "sortBy" ,
229
- "sum" ,
230
- "takeRightWhile" ,
231
- "takeWhile" ,
232
- "tap" ,
233
- "thru" ,
234
- "times" ,
235
- "unzipWith" ,
236
- "zipWith" ]
237
- ) and
195
+ name =
196
+ [
197
+ "all" , "any" , "collect" , "countBy" , "detect" , "dropRightWhile" , "dropWhile" , "each" ,
198
+ "eachRight" , "every" , "filter" , "find" , "findIndex" , "findKey" , "findLast" ,
199
+ "findLastIndex" , "findLastKey" , "forEach" , "forEachRight" , "forIn" , "forInRight" ,
200
+ "groupBy" , "indexBy" , "map" , "mapKeys" , "mapValues" , "max" , "min" , "omit" , "partition" ,
201
+ "pick" , "reject" , "remove" , "select" , "some" , "sortBy" , "sum" , "takeRightWhile" ,
202
+ "takeWhile" , "tap" , "thru" , "times" , "unzipWith" , "zipWith"
203
+ ] and
238
204
callbackIndex = 1 and
239
205
contextIndex = 2 and
240
206
argumentCount = 3
241
207
or
242
- (
243
- name = [ "foldl" , "foldr" , "inject" , "reduce" , "reduceRight" , "transform" ]
244
- ) and
208
+ name = [ "foldl" , "foldr" , "inject" , "reduce" , "reduceRight" , "transform" ] and
245
209
callbackIndex = 1 and
246
210
contextIndex = 3 and
247
211
argumentCount = 4
248
212
or
249
- (
250
- name = [ "sortedlastIndex" , "assign" , "eq" , "extend" , "merge" ]
251
- or
252
- name = "sortedIndex" and
253
- name = "uniq"
254
- ) and
213
+ name = [ "sortedlastIndex" , "assign" , "eq" , "extend" , "merge" , "sortedIndex" , "uniq" ] and
255
214
callbackIndex = 2 and
256
215
contextIndex = 3 and
257
216
argumentCount = 4
0 commit comments