From 8e32375f6bdf89f14e709c4859fff7f06c8d6267 Mon Sep 17 00:00:00 2001 From: Brian Zengel Date: Fri, 18 Oct 2013 21:10:33 -0400 Subject: [PATCH] _.toArray definition, removed some duplicate/old tests --- lodash/lodash-tests.ts | 10 +--------- lodash/lodash.d.ts | 14 +++++++------- 2 files changed, 8 insertions(+), 16 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 5dba02cba..81a11267a 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -363,6 +363,7 @@ result = _.sortBy([1, 2, 3], function(num) { return Math.sin(num); }); result = _.sortBy([1, 2, 3], function(num) { return this.sin(num); }, Math); result = _.sortBy(['banana', 'strawberry', 'apple'], 'length'); +(function(a, b, c, d){ return _.toArray(arguments).slice(1); })(1, 2, 3, 4); @@ -377,11 +378,6 @@ result = _.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 }); /////////////////////////////////////////////////////////////////////////////////////// diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 17886cd77..0de09a1f0 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -1661,6 +1661,12 @@ declare module _ { collection: List, whereValue: Dictionary): T[]; + /** + * Converts the collection to an array. + * @param collection The collection to convert. + * @return The new converted array. + **/ + export function toArray(collection: Collection): 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(list: Collection): T[]; +