mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-03 08:37:49 +00:00
Move internal modules to “internal” folder.
This commit is contained in:
30
.internal/baseCreate.js
Normal file
30
.internal/baseCreate.js
Normal file
@@ -0,0 +1,30 @@
|
||||
import isObject from './isObject.js';
|
||||
|
||||
/** Built-in value references. */
|
||||
const objectCreate = Object.create;
|
||||
|
||||
/**
|
||||
* The base implementation of `create` without support for assigning
|
||||
* properties to the created object.
|
||||
*
|
||||
* @private
|
||||
* @param {Object} proto The object to inherit from.
|
||||
* @returns {Object} Returns the new object.
|
||||
*/
|
||||
const baseCreate = (() => {
|
||||
function object() {}
|
||||
return proto => {
|
||||
if (!isObject(proto)) {
|
||||
return {};
|
||||
}
|
||||
if (objectCreate) {
|
||||
return objectCreate(proto);
|
||||
}
|
||||
object.prototype = proto;
|
||||
const result = new object;
|
||||
object.prototype = undefined;
|
||||
return result;
|
||||
};
|
||||
})();
|
||||
|
||||
export default baseCreate;
|
||||
Reference in New Issue
Block a user