main
Last change
on this file since d565449 was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
684 bytes
|
Rev | Line | |
---|
[d565449] | 1 | import isObject from './isObject.js';
|
---|
| 2 |
|
---|
| 3 | /** Built-in value references. */
|
---|
| 4 | var objectCreate = Object.create;
|
---|
| 5 |
|
---|
| 6 | /**
|
---|
| 7 | * The base implementation of `_.create` without support for assigning
|
---|
| 8 | * properties to the created object.
|
---|
| 9 | *
|
---|
| 10 | * @private
|
---|
| 11 | * @param {Object} proto The object to inherit from.
|
---|
| 12 | * @returns {Object} Returns the new object.
|
---|
| 13 | */
|
---|
| 14 | var baseCreate = (function() {
|
---|
| 15 | function object() {}
|
---|
| 16 | return function(proto) {
|
---|
| 17 | if (!isObject(proto)) {
|
---|
| 18 | return {};
|
---|
| 19 | }
|
---|
| 20 | if (objectCreate) {
|
---|
| 21 | return objectCreate(proto);
|
---|
| 22 | }
|
---|
| 23 | object.prototype = proto;
|
---|
| 24 | var result = new object;
|
---|
| 25 | object.prototype = undefined;
|
---|
| 26 | return result;
|
---|
| 27 | };
|
---|
| 28 | }());
|
---|
| 29 |
|
---|
| 30 | export default baseCreate;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.