index.js 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /**
  2. * lodash 3.0.3 (Custom Build) <https://lodash.com/>
  3. * Build: `lodash modern modularize exports="npm" -o ./`
  4. * Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
  5. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  6. * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  7. * Available under MIT license <https://lodash.com/license>
  8. */
  9. /**
  10. * The base implementation of `_.create` without support for assigning
  11. * properties to the created object.
  12. *
  13. * @private
  14. * @param {Object} prototype The object to inherit from.
  15. * @returns {Object} Returns the new object.
  16. */
  17. var baseCreate = (function() {
  18. function object() {}
  19. return function(prototype) {
  20. if (isObject(prototype)) {
  21. object.prototype = prototype;
  22. var result = new object;
  23. object.prototype = undefined;
  24. }
  25. return result || {};
  26. };
  27. }());
  28. /**
  29. * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.
  30. * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  31. *
  32. * @static
  33. * @memberOf _
  34. * @category Lang
  35. * @param {*} value The value to check.
  36. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  37. * @example
  38. *
  39. * _.isObject({});
  40. * // => true
  41. *
  42. * _.isObject([1, 2, 3]);
  43. * // => true
  44. *
  45. * _.isObject(1);
  46. * // => false
  47. */
  48. function isObject(value) {
  49. // Avoid a V8 JIT bug in Chrome 19-20.
  50. // See https://code.google.com/p/v8/issues/detail?id=2291 for more details.
  51. var type = typeof value;
  52. return !!value && (type == 'object' || type == 'function');
  53. }
  54. module.exports = baseCreate;