|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 11 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
560 bytes
|
| Line | |
|---|
| 1 | var isObject = require('./isObject.js');
|
|---|
| 2 | var _setup = require('./_setup.js');
|
|---|
| 3 |
|
|---|
| 4 | // Create a naked function reference for surrogate-prototype-swapping.
|
|---|
| 5 | function ctor() {
|
|---|
| 6 | return function(){};
|
|---|
| 7 | }
|
|---|
| 8 |
|
|---|
| 9 | // An internal function for creating a new object that inherits from another.
|
|---|
| 10 | function baseCreate(prototype) {
|
|---|
| 11 | if (!isObject(prototype)) return {};
|
|---|
| 12 | if (_setup.nativeCreate) return _setup.nativeCreate(prototype);
|
|---|
| 13 | var Ctor = ctor();
|
|---|
| 14 | Ctor.prototype = prototype;
|
|---|
| 15 | var result = new Ctor;
|
|---|
| 16 | Ctor.prototype = null;
|
|---|
| 17 | return result;
|
|---|
| 18 | }
|
|---|
| 19 |
|
|---|
| 20 | module.exports = baseCreate;
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.