diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index a16671bd7..cad1232b0 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -892,6 +892,24 @@ var helloWrap2 = _.wrap(helloWrap, function (func) { }); helloWrap2(); +/******** + * Lang * + ********/ + +// _.toPlainObject +result = _.toPlainObject(); +result = _.toPlainObject(true); +result = _.toPlainObject(1); +result = _.toPlainObject('a'); +result = _.toPlainObject([]); +result = _.toPlainObject({}); +result = _(true).toPlainObject(); +result = _(1).toPlainObject(); +result = _('a').toPlainObject(); +result = _([1]).toPlainObject(); +result = _([]).toPlainObject(); +result = _({}).toPlainObject(); + /********** * Objects * ***********/ diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 9a4945228..3b792101f 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -196,6 +196,11 @@ declare module _ { * @see _.value **/ valueOf(): T; + + /** + * @see _.toPlainObject + */ + toPlainObject(): Object; } interface LoDashWrapper extends LoDashWrapperBase> { } @@ -5473,6 +5478,21 @@ declare module _ { wrapper: (func: Function, ...args: any[]) => any): Function; } + /******** + * Lang * + ********/ + + //_.toPlainObject + interface LoDashStatic { + /** + * Converts value to a plain object flattening inherited enumerable properties of value to own properties + * of the plain object. + * @param value The value to convert. + * @return Returns the converted plain object. + */ + toPlainObject(value?: any): Object; + } + /************* * Objects * *************/