mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-05 17:37:50 +00:00
Use Object.create in baseCreate (even if shimmed).
This commit is contained in:
committed by
John-David Dalton
parent
4643679d79
commit
607fe2a5f6
15
lodash.js
15
lodash.js
@@ -1315,6 +1315,7 @@
|
||||
|
||||
/** Built-in value references. */
|
||||
var Buffer = moduleExports ? context.Buffer : undefined,
|
||||
objectCreate = Object.create,
|
||||
Reflect = context.Reflect,
|
||||
Symbol = context.Symbol,
|
||||
Uint8Array = context.Uint8Array,
|
||||
@@ -2373,17 +2374,9 @@
|
||||
* @param {Object} prototype The object to inherit from.
|
||||
* @returns {Object} Returns the new object.
|
||||
*/
|
||||
var baseCreate = (function() {
|
||||
function object() {}
|
||||
return function(prototype) {
|
||||
if (isObject(prototype)) {
|
||||
object.prototype = prototype;
|
||||
var result = new object;
|
||||
object.prototype = undefined;
|
||||
}
|
||||
return result || {};
|
||||
};
|
||||
}());
|
||||
function baseCreate(proto) {
|
||||
return isObject(proto) ? objectCreate(proto) : {};
|
||||
}
|
||||
|
||||
/**
|
||||
* The base implementation of `_.delay` and `_.defer` which accepts an array
|
||||
|
||||
Reference in New Issue
Block a user