lodash: changed _.unset

This commit is contained in:
Ilya Mochalov
2016-02-05 23:10:32 +05:00
parent a80a024f79
commit 1e057a85a2
2 changed files with 59 additions and 15 deletions
+28
View File
@@ -8919,6 +8919,34 @@ module TestTransform {
}
}
// _.unset
namespace TestUnset {
type SampleObject = {a: {b: string; c: boolean}};
let object: SampleObject;
{
let result: boolean;
_.unset<SampleObject>(object, 'a.b');
_.unset<SampleObject>(object, ['a', 'b']);
}
{
let result: _.LoDashImplicitWrapper<boolean>;
result = _(object).unset('a.b');
result = _(object).unset(['a', 'b']);
}
{
let result: _.LoDashExplicitWrapper<boolean>;
result = _(object).chain().unset('a.b');
result = _(object).chain().unset(['a', 'b']);
}
}
// _.values
module TestValues {
let object: _.Dictionary<TResult>;
+31 -15
View File
@@ -4270,21 +4270,6 @@ declare module _ {
): any[];
}
//_.unset
interface LoDashStatic {
/**
* Removes the property at path of object.
*
* @param object The object to modify.
* @param path The path of the property to unset.
* @return Returns true if the property is deleted, else false.
*/
unset<T>(
object: T,
path: StringRepresentable | StringRepresentable[]
): boolean;
}
//_.unzip
interface LoDashStatic {
/**
@@ -14826,6 +14811,37 @@ declare module _ {
): LoDashImplicitArrayWrapper<TResult>;
}
//_.unset
interface LoDashStatic {
/**
* Removes the property at path of object.
*
* Note: This method mutates object.
*
* @param object The object to modify.
* @param path The path of the property to unset.
* @return Returns true if the property is deleted, else false.
*/
unset<T>(
object: T,
path: StringRepresentable|StringRepresentable[]
): boolean;
}
interface LoDashImplicitObjectWrapper<T> {
/**
* @see _.unset
*/
unset(path: StringRepresentable|StringRepresentable[]): LoDashImplicitWrapper<boolean>;
}
interface LoDashExplicitObjectWrapper<T> {
/**
* @see _.unset
*/
unset(path: StringRepresentable|StringRepresentable[]): LoDashExplicitWrapper<boolean>;
}
//_.values
interface LoDashStatic {
/**