lodash: added _.toPlainObject() method

This commit is contained in:
Ilya Mochalov
2015-07-28 16:32:29 +05:00
parent 73e4b46719
commit 875c8e1e3c
2 changed files with 38 additions and 0 deletions
+18
View File
@@ -850,6 +850,24 @@ var helloWrap2 = _.wrap(helloWrap, function (func) {
});
helloWrap2();
/********
* Lang *
********/
// _.toPlainObject
result = <Object>_.toPlainObject();
result = <Object>_.toPlainObject(true);
result = <Object>_.toPlainObject(1);
result = <Object>_.toPlainObject('a');
result = <Object>_.toPlainObject([]);
result = <Object>_.toPlainObject({});
result = <Object>_(true).toPlainObject();
result = <Object>_(1).toPlainObject();
result = <Object>_('a').toPlainObject();
result = <Object>_([1]).toPlainObject();
result = <Object>_<string>([]).toPlainObject();
result = <Object>_({}).toPlainObject();
/**********
* Objects *
***********/
+20
View File
@@ -196,6 +196,11 @@ declare module _ {
* @see _.value
**/
valueOf(): T;
/**
* @see _.toPlainObject
*/
toPlainObject(): Object;
}
interface LoDashWrapper<T> extends LoDashWrapperBase<T, LoDashWrapper<T>> { }
@@ -5304,6 +5309,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 *
*************/