mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-08 18:17:48 +00:00
lodash: Fix syntax error in IE < 9 related to return throw …. [jddalton]
Former-commit-id: 8de2886801d447d6c0db119fe061d2fafd49958b
This commit is contained in:
@@ -266,6 +266,7 @@
|
||||
}
|
||||
|
||||
var args = options.args,
|
||||
exits = options.exits,
|
||||
firstArg = /^[^,]+/.exec(args)[0],
|
||||
init = options.init,
|
||||
iterate = options.iterate,
|
||||
@@ -285,7 +286,8 @@
|
||||
('var index, result' + (init ? '=' + init : '')) + ';\n' +
|
||||
// exit early if first argument, e.g. `collection`, is nullish or custom expression
|
||||
'if (' + (options.exitsExp || firstArg + ' == undefined') + ')\n' +
|
||||
'return ' + (options.exits || 'result') + ';\n' +
|
||||
// IE < 9 JScript will throw a syntax error if it encounters `return throw ...`
|
||||
(/^throw\b/.test(exits) ? '' : 'return ') + (exits || 'result') + ';\n' +
|
||||
// add code after the exits if-statement but before the array/object iteration branches
|
||||
(options.top || '') + ';\n' +
|
||||
// the following branch is for iterating arrays and array-like objects
|
||||
|
||||
Reference in New Issue
Block a user