Start sharing components as a team!Share components as a team!Join Bit to build your applications faster.Get Started Free

_base-create

v4.17.11arrow_drop_down
v4.17.11
STATUS
Passing
DOWNLOADS
1,080
LICENSE
MIT
VISIBILITY
Public
PUBLISHED
A year ago
SIZE
663 B
1 contributor
Install _base-create as a package?
Copied
npm i @bit/lodash.lodash.internal._base-create
Set Bit as a scoped registryLearn more
npm config set '@bit:registry' https://node.bit.dev
_baseCreate.js
30 Lines(18 sloc)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import isObject from './isObject.js';

/** Built-in value references. */
var 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.
 */
var baseCreate = (function() {
  function object() {}
  return function(proto) {
    if (!isObject(proto)) {
      return {};
    }
    if (objectCreate) {
      return objectCreate(proto);
    }
    object.prototype = proto;
    var result = new object;
    object.prototype = undefined;
    return result;
  };
}());

export default baseCreate;