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:
742 bytes
|
Line | |
---|
1 | import copyObject from './_copyObject.js';
|
---|
2 | import keysIn from './keysIn.js';
|
---|
3 |
|
---|
4 | /**
|
---|
5 | * Converts `value` to a plain object flattening inherited enumerable string
|
---|
6 | * keyed properties of `value` to own properties of the plain object.
|
---|
7 | *
|
---|
8 | * @static
|
---|
9 | * @memberOf _
|
---|
10 | * @since 3.0.0
|
---|
11 | * @category Lang
|
---|
12 | * @param {*} value The value to convert.
|
---|
13 | * @returns {Object} Returns the converted plain object.
|
---|
14 | * @example
|
---|
15 | *
|
---|
16 | * function Foo() {
|
---|
17 | * this.b = 2;
|
---|
18 | * }
|
---|
19 | *
|
---|
20 | * Foo.prototype.c = 3;
|
---|
21 | *
|
---|
22 | * _.assign({ 'a': 1 }, new Foo);
|
---|
23 | * // => { 'a': 1, 'b': 2 }
|
---|
24 | *
|
---|
25 | * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
|
---|
26 | * // => { 'a': 1, 'b': 2, 'c': 3 }
|
---|
27 | */
|
---|
28 | function toPlainObject(value) {
|
---|
29 | return copyObject(value, keysIn(value));
|
---|
30 | }
|
---|
31 |
|
---|
32 | export default toPlainObject;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.