Merge pull request #7999 from chrootsu/lodash-unset

lodash: changed _.unset
This commit is contained in:
Masahiro Wakame
2016-02-11 22:56:22 +09:00
2 changed files with 59 additions and 15 deletions

View File

@@ -9379,6 +9379,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>;

46
lodash/lodash.d.ts vendored
View File

@@ -5295,21 +5295,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 {
/**
@@ -15922,6 +15907,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 {
/**