Merge pull request #4982 from chrootsu/lodash-values

lodash: changed _.values() method
This commit is contained in:
Masahiro Wakame
2015-07-20 16:04:01 +09:00
2 changed files with 21 additions and 4 deletions

View File

@@ -1092,7 +1092,17 @@ result = <{ a: number; b: number; c: number; }>_.transform(<{ [index: string]: n
r[key] = num * 3;
});
result = <number[]>_.values({ 'one': 1, 'two': 2, 'three': 3 });
// _.values
class TestValues {
public a = 1;
public b = 2;
public c: string;
}
TestValues.prototype.c = 'a';
result = <number[]>_.values<number>(new TestValues());
// → [1, 2] (iteration order is not guaranteed)
result = <number[]>_(new TestValues()).values<number>().value();
// → [1, 2] (iteration order is not guaranteed)
// _.valueIn
class TestValueIn {

13
lodash/lodash.d.ts vendored
View File

@@ -6301,11 +6301,18 @@ declare module _ {
//_.values
interface LoDashStatic {
/**
* Creates an array composed of the own enumerable property values of object.
* @param object The object to inspect.
* Creates an array of the own enumerable property values of object.
* @param object The object to query.
* @return Returns an array of property values.
**/
values(object?: any): any[];
values<T>(object?: any): T[];
}
interface LoDashObjectWrapper<T> {
/**
* @see _.values
**/
values<TResult>(): LoDashObjectWrapper<TResult[]>;
}
//_.valuesIn