mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-08-30 11:14:27 +08:00
_.toArray definition, removed some duplicate/old tests
This commit is contained in:
@@ -363,6 +363,7 @@ result = <number[]>_.sortBy([1, 2, 3], function(num) { return Math.sin(num); });
|
||||
result = <number[]>_.sortBy([1, 2, 3], function(num) { return this.sin(num); }, Math);
|
||||
result = <string[]>_.sortBy(['banana', 'strawberry', 'apple'], 'length');
|
||||
|
||||
(function(a, b, c, d){ return _.toArray(arguments).slice(1); })(1, 2, 3, 4);
|
||||
|
||||
|
||||
|
||||
@@ -377,11 +378,6 @@ result = <string[]>_.sortBy(['banana', 'strawberry', 'apple'], 'length');
|
||||
var listOfPlays = [{ title: "Cymbeline", author: "Shakespeare", year: 1611 }, { title: "The Tempest", author: "Shakespeare", year: 1611 }, { title: "Other", author: "Not Shakespeare", year: 2012 }];
|
||||
_.where(listOfPlays, { author: "Shakespeare", year: 1611 });
|
||||
|
||||
var odds = _.reject([1, 2, 3, 4, 5, 6], (num) => num % 2 == 0);
|
||||
|
||||
_.sortBy([1, 2, 3, 4, 5, 6], (num) => Math.sin(num));
|
||||
|
||||
|
||||
// _.indexBy(stooges, 'age')['40'].age;
|
||||
// _(stooges).indexBy('age')['40'].name;
|
||||
// _(stooges)
|
||||
@@ -389,11 +385,7 @@ _.sortBy([1, 2, 3, 4, 5, 6], (num) => Math.sin(num));
|
||||
// .indexBy('age')
|
||||
// .value()['40'].age;
|
||||
|
||||
_.shuffle([1, 2, 3, 4, 5, 6]);
|
||||
|
||||
(function(a, b, c, d){ return _.toArray(arguments).slice(1); })(1, 2, 3, 4);
|
||||
|
||||
_.size({ one: 1, two: 2, three: 3 });
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
Vendored
+7
-7
@@ -1661,6 +1661,12 @@ declare module _ {
|
||||
collection: List<T>,
|
||||
whereValue: Dictionary<any>): T[];
|
||||
|
||||
/**
|
||||
* Converts the collection to an array.
|
||||
* @param collection The collection to convert.
|
||||
* @return The new converted array.
|
||||
**/
|
||||
export function toArray<T>(collection: Collection<T>): T[];
|
||||
|
||||
|
||||
|
||||
@@ -1703,13 +1709,7 @@ declare module _ {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Converts the list (anything that can be iterated over), into a real Array. Useful for transmuting
|
||||
* the arguments object.
|
||||
* @param list object to transform into an array.
|
||||
* @return `list` as an array.
|
||||
**/
|
||||
export function toArray<T>(list: Collection<T>): T[];
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user