From d7b332ac7c186b11773e4e116ab8000ee8c1759d Mon Sep 17 00:00:00 2001 From: Brian Zengel Date: Sun, 20 Oct 2013 17:25:00 -0400 Subject: [PATCH] added _.pairs definition --- lodash/lodash-tests.ts | 2 ++ lodash/lodash.d.ts | 16 ++++++++++------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index ab59e31b9..55f3272c2 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -691,6 +691,8 @@ result = _.omit({ 'name': 'moe', 'age': 40 }, function(value) { return typeof value == 'number'; }); +result = _.pairs({ 'moe': 30, 'larry': 40 }); + //////////////////////////////////////////////////////////////////////////////////////// //WHAT'S LEFT //////////////////////////////////////////////////////////////////////////////////////// diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 6e380cffc..5f78e5d3f 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -2641,6 +2641,15 @@ declare module _ { callback: (value: any) => boolean, thisArg?: any): any; + /** + * Creates a two dimensional array of an object’s key-value pairs, + * i.e. [[key1, value1], [key2, value2]]. + * @param object The object to inspect. + * @return Aew array of key-value pairs. + **/ + export function pairs(object: any): any[][]; + + @@ -2691,12 +2700,7 @@ declare module _ { **/ export function values(object: any): any[]; - /** - * Convert an object into a list of [key, value] pairs. - * @param object Convert this object to a list of [key, value] pairs. - * @return List of [key, value] pairs on `object`. - **/ - export function pairs(object: any): any[][]; + /** * Return a copy of the object, filtered to only have values for the whitelisted keys