From a00e1937b338c8e53e45c4dc860c6dac0fad4ac1 Mon Sep 17 00:00:00 2001 From: Brian Zengel Date: Sun, 20 Oct 2013 18:19:46 -0400 Subject: [PATCH] added _.mixin definition --- lodash/lodash-tests.ts | 8 ++++++++ lodash/lodash.d.ts | 28 +++++++++++++--------------- 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index b532dc018..fb52aec26 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -714,6 +714,14 @@ result = _.values({ 'one': 1, 'two': 2, 'three': 3 }); result = _.escape('Moe, Larry & Curly'); +result = <{ name: string }>_.identity({ 'name': 'moe' }); + +_.mixin({ + 'capitalize': function(string) { + return string.charAt(0).toUpperCase() + string.slice(1).toLowerCase(); + } +}); + ////////////////////////////////////////////////////////////////////////////////////////////////// var iceCream = { flavor: "chocolate" }; diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index e479d0bc2..8315ceddb 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -2714,8 +2714,18 @@ declare module _ { **/ export function escape(str: string): string; + /** + * This method returns the first argument provided to it. + * @param value Any value. + * @return value. + **/ + export function identity(value: T): T; - + /** + * Adds function properties of a source object to the lodash function and chainable wrapper. + * @param object The object of function properties to add to lodash. + **/ + export function mixin(object: Dictionary<(value: any) => any>): void; @@ -2733,13 +2743,7 @@ declare module _ { **/ export function noConflict(): any; - /** - * Returns the same value that is used as the argument. In math: f(x) = x - * This function looks useless, but is used throughout Lo-Dash as a default iterator. - * @param value Identity of this object. - * @return `value`. - **/ - export function identity(value: T): T; + /** * Invokes the given iterator function n times. @@ -2765,13 +2769,7 @@ declare module _ { **/ export function random(min: number, max: number): number; - /** - * Allows you to extend Lo-Dash with your own utility functions. Pass a hash of - * {name: function} definitions to have your functions added to the Lo-Dash object, - * as well as the OOP wrapper. - * @param object Mixin object containing key/function pairs to add to the Lo-Dash object. - **/ - export function mixin(object: any): void; + /** * Generate a globally-unique id for client-side models or DOM elements that need one.