Repositorio del curso CCOM4030 el semestre B91 del proyecto Artesanías con el Instituto de Cultura

toPlainObject.js 744B

1234567891011121314151617181920212223242526272829303132
  1. var copyObject = require('./_copyObject'),
  2. keysIn = require('./keysIn');
  3. /**
  4. * Converts `value` to a plain object flattening inherited enumerable string
  5. * keyed properties of `value` to own properties of the plain object.
  6. *
  7. * @static
  8. * @memberOf _
  9. * @since 3.0.0
  10. * @category Lang
  11. * @param {*} value The value to convert.
  12. * @returns {Object} Returns the converted plain object.
  13. * @example
  14. *
  15. * function Foo() {
  16. * this.b = 2;
  17. * }
  18. *
  19. * Foo.prototype.c = 3;
  20. *
  21. * _.assign({ 'a': 1 }, new Foo);
  22. * // => { 'a': 1, 'b': 2 }
  23. *
  24. * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
  25. * // => { 'a': 1, 'b': 2, 'c': 3 }
  26. */
  27. function toPlainObject(value) {
  28. return copyObject(value, keysIn(value));
  29. }
  30. module.exports = toPlainObject;