mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-11 11:27:50 +00:00
Add more comments to nativeAssign definition. [ci skip]
This commit is contained in:
@@ -797,12 +797,17 @@
|
|||||||
|
|
||||||
/** Used as `baseAssign`. */
|
/** Used as `baseAssign`. */
|
||||||
var nativeAssign = (function() {
|
var nativeAssign = (function() {
|
||||||
|
'use strict';
|
||||||
|
// Avoid `Object.assign` in Firefox 34-37 which have an early implementation
|
||||||
|
// with a now defunct try/catch behavior. See https://bugzilla.mozilla.org/show_bug.cgi?id=1103344
|
||||||
|
// for more details.
|
||||||
|
//
|
||||||
|
// Use `Object.preventExtensions` on a plain object instead of simply using
|
||||||
|
// `Object('x')` because Chrome and IE fail to throw an error when attempting
|
||||||
|
// to assign values to readonly indexes of strings in strict mode.
|
||||||
var object = { '1': 0 },
|
var object = { '1': 0 },
|
||||||
func = preventExtensions && isNative(func = Object.assign) && func;
|
func = preventExtensions && isNative(func = Object.assign) && func;
|
||||||
|
|
||||||
// Avoid `Object.assign` in Firefox 34-37 which have an early implementation
|
|
||||||
// with a slower try/catch behavior. See https://bugzilla.mozilla.org/show_bug.cgi?id=1103344
|
|
||||||
// for more details.
|
|
||||||
try { func(preventExtensions(object), 'xo'); } catch(e) {}
|
try { func(preventExtensions(object), 'xo'); } catch(e) {}
|
||||||
return !object[1] && func;
|
return !object[1] && func;
|
||||||
}());
|
}());
|
||||||
|
|||||||
Reference in New Issue
Block a user