SIGN IN SIGN UP

A modern JavaScript utility library delivering modularity, performance, & extras.

0 0 61 JavaScript
2016-01-28 01:16:24 -08:00
define(['./isObject'], function(isObject) {
2015-01-08 00:37:01 -08:00
2016-09-25 13:37:46 -07:00
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
var undefined;
2016-02-15 20:20:54 -08:00
/** Built-in value references. */
var objectCreate = Object.create;
2015-12-16 17:52:15 -08:00
2015-01-08 00:37:01 -08:00
/**
* The base implementation of `_.create` without support for assigning
* properties to the created object.
*
* @private
2016-09-25 13:37:46 -07:00
* @param {Object} proto The object to inherit from.
2015-01-08 00:37:01 -08:00
* @returns {Object} Returns the new object.
*/
2016-09-25 13:37:46 -07:00
var baseCreate = (function() {
function object() {}
return function(proto) {
if (!isObject(proto)) {
return {};
}
if (objectCreate) {
return objectCreate(proto);
}
2016-10-02 21:51:40 -07:00
object.prototype = proto;
2016-09-25 13:37:46 -07:00
var result = new object;
object.prototype = undefined;
return result;
};
}());
2015-01-08 00:37:01 -08:00
return baseCreate;
});