From 9f902efd3550bb53e9072ca843881eac2a604e51 Mon Sep 17 00:00:00 2001 From: Sam Albert Date: Tue, 26 May 2015 13:31:01 -0400 Subject: [PATCH] Added _.get definition to lodash with updated test file. --- lodash/lodash-tests.ts | 2 ++ lodash/lodash.d.ts | 16 ++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 6a48e20c16..a96b0b6f31 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -922,6 +922,8 @@ result = _.methods(_); result = <_.LoDashArrayWrapper>_(_).functions(); result = <_.LoDashArrayWrapper>_(_).methods(); +result = _.get({ 'a': 1, 'b': 2, 'c': 3 }, 'b'); + result = _.has({ 'a': 1, 'b': 2, 'c': 3 }, 'b'); interface FirstSecond { diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 602b05d311..4b96e01e5e 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -5836,6 +5836,22 @@ declare module _ { methods(): _.LoDashArrayWrapper; } + //_.get + interface LoDashStatic { + /** + * Gets the property value at path of object. If the resolved + * value is undefined the defaultValue is used in its place. + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + **/ + get(object : Object, + path:string|string[], + defaultValue?:T + ): T; + } + //_.has interface LoDashStatic { /**