From 808a31e15f9ff68696d66cb7e7ff78ed01b99486 Mon Sep 17 00:00:00 2001 From: DomiR Date: Wed, 13 Jan 2016 16:42:21 +0100 Subject: [PATCH 01/51] (feature) Fist step to upgrade lodash to 4.0.0 --- backbone/backbone-with-lodash-tests.ts | 2 +- bookshelf/bookshelf.d.ts | 2 +- knex/knex-tests.ts | 2 +- lodash-decorators/lodash-decorators-tests.ts | 2 +- lodash-decorators/lodash-decorators.d.ts | 2 +- lodash/lodash-3.10.d.ts | 14991 +++++++++++++++++ lodash/lodash-tests-3.10.ts | 10016 +++++++++++ lodash/lodash-tests.ts | 138 +- lodash/lodash.d.ts | 354 +- sequelize/sequelize-2.0.0.d.ts | 2 +- sequelize/sequelize.d.ts | 2 +- 11 files changed, 25265 insertions(+), 248 deletions(-) create mode 100644 lodash/lodash-3.10.d.ts create mode 100644 lodash/lodash-tests-3.10.ts diff --git a/backbone/backbone-with-lodash-tests.ts b/backbone/backbone-with-lodash-tests.ts index c4f5fdf4d..dc7ebd2de 100644 --- a/backbone/backbone-with-lodash-tests.ts +++ b/backbone/backbone-with-lodash-tests.ts @@ -1,5 +1,5 @@ /// -/// +/// /// function test_events() { diff --git a/bookshelf/bookshelf.d.ts b/bookshelf/bookshelf.d.ts index 95aa38408..5d91927db 100644 --- a/bookshelf/bookshelf.d.ts +++ b/bookshelf/bookshelf.d.ts @@ -4,7 +4,7 @@ // Definitions: https://github.com/borisyankov/DefinitelyTyped /// -/// +/// /// declare module 'bookshelf' { diff --git a/knex/knex-tests.ts b/knex/knex-tests.ts index 1d468b260..83b476b16 100644 --- a/knex/knex-tests.ts +++ b/knex/knex-tests.ts @@ -1,5 +1,5 @@ /// -/// +/// import Knex = require('knex'); import _ = require('lodash'); 'use strict'; diff --git a/lodash-decorators/lodash-decorators-tests.ts b/lodash-decorators/lodash-decorators-tests.ts index 60a659c8d..1ab2cad55 100644 --- a/lodash-decorators/lodash-decorators-tests.ts +++ b/lodash-decorators/lodash-decorators-tests.ts @@ -1,5 +1,5 @@ /// -/// +/// // // With Arguments diff --git a/lodash-decorators/lodash-decorators.d.ts b/lodash-decorators/lodash-decorators.d.ts index ac01c5cf6..586413899 100644 --- a/lodash-decorators/lodash-decorators.d.ts +++ b/lodash-decorators/lodash-decorators.d.ts @@ -3,7 +3,7 @@ // Definitions by: Qubo // Definitions: https://github.com/borisyankov/DefinitelyTyped -/// +/// declare module "lodash-decorators" { diff --git a/lodash/lodash-3.10.d.ts b/lodash/lodash-3.10.d.ts new file mode 100644 index 000000000..c570cc11c --- /dev/null +++ b/lodash/lodash-3.10.d.ts @@ -0,0 +1,14991 @@ +// Type definitions for Lo-Dash +// Project: http://lodash.com/ +// Definitions by: Brian Zengel , Ilya Mochalov +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare var _: _.LoDashStatic; + +declare module _ { + interface LoDashStatic { + /** + * Creates a lodash object which wraps the given value to enable intuitive method chaining. + * + * In addition to Lo-Dash methods, wrappers also have the following Array methods: + * concat, join, pop, push, reverse, shift, slice, sort, splice, and unshift + * + * Chaining is supported in custom builds as long as the value method is implicitly or + * explicitly included in the build. + * + * The chainable wrapper functions are: + * after, assign, bind, bindAll, bindKey, chain, chunk, compact, compose, concat, countBy, + * createCallback, curry, debounce, defaults, defer, delay, difference, filter, flatten, + * forEach, forEachRight, forIn, forInRight, forOwn, forOwnRight, functions, groupBy, + * indexBy, initial, intersection, invert, invoke, keys, map, max, memoize, merge, min, + * object, omit, once, pairs, partial, partialRight, pick, pluck, pull, push, range, reject, + * remove, rest, reverse, sample, shuffle, slice, sort, sortBy, splice, tap, throttle, times, + * toArray, transform, union, uniq, unshift, unzip, values, where, without, wrap, and zip + * + * The non-chainable wrapper functions are: + * clone, cloneDeep, contains, escape, every, find, findIndex, findKey, findLast, + * findLastIndex, findLastKey, has, identity, indexOf, isArguments, isArray, isBoolean, + * isDate, isElement, isEmpty, isEqual, isFinite, isFunction, isNaN, isNull, isNumber, + * isObject, isPlainObject, isRegExp, isString, isUndefined, join, lastIndexOf, mixin, + * noConflict, parseInt, pop, random, reduce, reduceRight, result, shift, size, some, + * sortedIndex, runInContext, template, unescape, uniqueId, and value + * + * The wrapper functions first and last return wrapped values when n is provided, otherwise + * they return unwrapped values. + * + * Explicit chaining can be enabled by using the _.chain method. + **/ + (value: number): LoDashImplicitWrapper; + (value: string): LoDashImplicitStringWrapper; + (value: boolean): LoDashImplicitWrapper; + (value: Array): LoDashImplicitNumberArrayWrapper; + (value: Array): LoDashImplicitArrayWrapper; + (value: T): LoDashImplicitObjectWrapper; + (value: any): LoDashImplicitWrapper; + + /** + * The semantic version number. + **/ + VERSION: string; + + /** + * An object used to flag environments features. + **/ + support: Support; + + /** + * By default, the template delimiters used by Lo-Dash are similar to those in embedded Ruby + * (ERB). Change the following template settings to use alternative delimiters. + **/ + templateSettings: TemplateSettings; + } + + /** + * By default, the template delimiters used by Lo-Dash are similar to those in embedded Ruby + * (ERB). Change the following template settings to use alternative delimiters. + **/ + interface TemplateSettings { + /** + * The "escape" delimiter. + **/ + escape?: RegExp; + + /** + * The "evaluate" delimiter. + **/ + evaluate?: RegExp; + + /** + * An object to import into the template as local variables. + **/ + imports?: Dictionary; + + /** + * The "interpolate" delimiter. + **/ + interpolate?: RegExp; + + /** + * Used to reference the data object in the template text. + **/ + variable?: string; + } + + /** + * Creates a cache object to store key/value pairs. + */ + interface MapCache { + /** + * Removes `key` and its value from the cache. + * @param key The key of the value to remove. + * @return Returns `true` if the entry was removed successfully, else `false`. + */ + delete(key: string): boolean; + + /** + * Gets the cached value for `key`. + * @param key The key of the value to get. + * @return Returns the cached value. + */ + get(key: string): any; + + /** + * Checks if a cached value for `key` exists. + * @param key The key of the entry to check. + * @return Returns `true` if an entry for `key` exists, else `false`. + */ + has(key: string): boolean; + + /** + * Sets `value` to `key` of the cache. + * @param key The key of the value to cache. + * @param value The value to cache. + * @return Returns the cache object. + */ + set(key: string, value: any): _.Dictionary; + } + + /** + * An object used to flag environments features. + **/ + interface Support { + /** + * Detect if an arguments object's [[Class]] is resolvable (all but Firefox < 4, IE < 9). + **/ + argsClass: boolean; + + /** + * Detect if arguments objects are Object objects (all but Narwhal and Opera < 10.5). + **/ + argsObject: boolean; + + /** + * Detect if name or message properties of Error.prototype are enumerable by default. + * (IE < 9, Safari < 5.1) + **/ + enumErrorProps: boolean; + + /** + * Detect if prototype properties are enumerable by default. + * + * Firefox < 3.6, Opera > 9.50 - Opera < 11.60, and Safari < 5.1 (if the prototype or a property on the + * prototype has been set) incorrectly set the [[Enumerable]] value of a function’s prototype property to true. + **/ + enumPrototypes: boolean; + + /** + * Detect if Function#bind exists and is inferred to be fast (all but V8). + **/ + fastBind: boolean; + + /** + * Detect if functions can be decompiled by Function#toString (all but PS3 and older Opera + * mobile browsers & avoided in Windows 8 apps). + **/ + funcDecomp: boolean; + + /** + * Detect if Function#name is supported (all but IE). + **/ + funcNames: boolean; + + /** + * Detect if arguments object indexes are non-enumerable (Firefox < 4, IE < 9, PhantomJS, + * Safari < 5.1). + **/ + nonEnumArgs: boolean; + + /** + * Detect if properties shadowing those on Object.prototype are non-enumerable. + * + * In IE < 9 an objects own properties, shadowing non-enumerable ones, are made + * non-enumerable as well (a.k.a the JScript [[DontEnum]] bug). + **/ + nonEnumShadows: boolean; + + /** + * Detect if own properties are iterated after inherited properties (all but IE < 9). + **/ + ownLast: boolean; + + /** + * Detect if Array#shift and Array#splice augment array-like objects correctly. + * + * Firefox < 10, IE compatibility mode, and IE < 9 have buggy Array shift() and splice() + * functions that fail to remove the last element, value[0], of array-like objects even + * though the length property is set to 0. The shift() method is buggy in IE 8 compatibility + * mode, while splice() is buggy regardless of mode in IE < 9 and buggy in compatibility mode + * in IE 9. + **/ + spliceObjects: boolean; + + /** + * Detect lack of support for accessing string characters by index. + * + * IE < 8 can't access characters by index and IE 8 can only access characters by index on + * string literals. + **/ + unindexedChars: boolean; + } + + interface LoDashWrapperBase { } + + interface LoDashImplicitWrapperBase extends LoDashWrapperBase { } + + interface LoDashExplicitWrapperBase extends LoDashWrapperBase { } + + interface LoDashImplicitWrapper extends LoDashImplicitWrapperBase> { } + + interface LoDashExplicitWrapper extends LoDashExplicitWrapperBase> { } + + interface LoDashImplicitStringWrapper extends LoDashImplicitWrapper { } + + interface LoDashExplicitStringWrapper extends LoDashExplicitWrapper { } + + interface LoDashImplicitObjectWrapper extends LoDashImplicitWrapperBase> { } + + interface LoDashExplicitObjectWrapper extends LoDashExplicitWrapperBase> { } + + interface LoDashImplicitArrayWrapper extends LoDashImplicitWrapperBase> { + join(seperator?: string): string; + pop(): T; + push(...items: T[]): LoDashImplicitArrayWrapper; + shift(): T; + sort(compareFn?: (a: T, b: T) => number): LoDashImplicitArrayWrapper; + splice(start: number): LoDashImplicitArrayWrapper; + splice(start: number, deleteCount: number, ...items: any[]): LoDashImplicitArrayWrapper; + unshift(...items: T[]): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper extends LoDashExplicitWrapperBase> { } + + interface LoDashImplicitNumberArrayWrapper extends LoDashImplicitArrayWrapper { } + + interface LoDashExplicitNumberArrayWrapper extends LoDashExplicitArrayWrapper { } + + /********* + * Array * + *********/ + + //_.chunk + interface LoDashStatic { + /** + * Creates an array of elements split into groups the length of size. If collection can’t be split evenly, the + * final chunk will be the remaining elements. + * + * @param array The array to process. + * @param size The length of each chunk. + * @return Returns the new array containing chunks. + */ + chunk( + array: List, + size?: number + ): T[][]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.chunk + */ + chunk(size?: number): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.chunk + */ + chunk(size?: number): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.chunk + */ + chunk(size?: number): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.chunk + */ + chunk(size?: number): LoDashExplicitArrayWrapper; + } + + //_.compact + interface LoDashStatic { + /** + * Creates an array with all falsey values removed. The values false, null, 0, "", undefined, and NaN are + * falsey. + * + * @param array The array to compact. + * @return (Array) Returns the new array of filtered values. + */ + compact(array?: List): T[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.compact + */ + compact(): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.compact + */ + compact(): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.compact + */ + compact(): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.compact + */ + compact(): LoDashExplicitArrayWrapper; + } + + //_.difference + interface LoDashStatic { + /** + * Creates an array of unique array values not included in the other provided arrays using SameValueZero for + * equality comparisons. + * + * @param array The array to inspect. + * @param values The arrays of values to exclude. + * @return Returns the new array of filtered values. + */ + difference( + array: T[]|List, + ...values: (T[]|List)[] + ): T[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.difference + */ + difference(...values: (T[]|List)[]): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.difference + */ + difference(...values: (TValue[]|List)[]): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.difference + */ + difference(...values: (T[]|List)[]): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.difference + */ + difference(...values: (TValue[]|List)[]): LoDashExplicitArrayWrapper; + } + + //_.drop + interface LoDashStatic { + /** + * Creates a slice of array with n elements dropped from the beginning. + * + * @param array The array to query. + * @param n The number of elements to drop. + * @return Returns the slice of array. + */ + drop(array: T[]|List, n?: number): T[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.drop + */ + drop(n?: number): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.drop + */ + drop(n?: number): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.drop + */ + drop(n?: number): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.drop + */ + drop(n?: number): LoDashExplicitArrayWrapper; + } + + //_.dropRight + interface LoDashStatic { + /** + * Creates a slice of array with n elements dropped from the end. + * + * @param array The array to query. + * @param n The number of elements to drop. + * @return Returns the slice of array. + */ + dropRight( + array: List, + n?: number + ): T[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.dropRight + */ + dropRight(n?: number): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.dropRight + */ + dropRight(n?: number): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.dropRight + */ + dropRight(n?: number): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.dropRight + */ + dropRight(n?: number): LoDashExplicitArrayWrapper; + } + + //_.dropRightWhile + interface LoDashStatic { + /** + * Creates a slice of array excluding elements dropped from the end. Elements are dropped until predicate + * returns falsey. The predicate is bound to thisArg and invoked with three arguments: (value, index, array). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * match the properties of the given object, else false. + * + * @param array The array to query. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the slice of array. + */ + dropRightWhile( + array: List, + predicate?: ListIterator, + thisArg?: any + ): TValue[]; + + /** + * @see _.dropRightWhile + */ + dropRightWhile( + array: List, + predicate?: string, + thisArg?: any + ): TValue[]; + + /** + * @see _.dropRightWhile + */ + dropRightWhile( + array: List, + predicate?: TWhere + ): TValue[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.dropRightWhile + */ + dropRightWhile( + predicate?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.dropRightWhile + */ + dropRightWhile( + predicate?: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.dropRightWhile + */ + dropRightWhile( + predicate?: TWhere + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.dropRightWhile + */ + dropRightWhile( + predicate?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.dropRightWhile + */ + dropRightWhile( + predicate?: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.dropRightWhile + */ + dropRightWhile( + predicate?: TWhere + ): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.dropRightWhile + */ + dropRightWhile( + predicate?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.dropRightWhile + */ + dropRightWhile( + predicate?: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.dropRightWhile + */ + dropRightWhile( + predicate?: TWhere + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.dropRightWhile + */ + dropRightWhile( + predicate?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.dropRightWhile + */ + dropRightWhile( + predicate?: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.dropRightWhile + */ + dropRightWhile( + predicate?: TWhere + ): LoDashExplicitArrayWrapper; + } + + //_.dropWhile + interface LoDashStatic { + /** + * Creates a slice of array excluding elements dropped from the beginning. Elements are dropped until predicate + * returns falsey. The predicate is bound to thisArg and invoked with three arguments: (value, index, array). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param array The array to query. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the slice of array. + */ + dropWhile( + array: List, + predicate?: ListIterator, + thisArg?: any + ): TValue[]; + + /** + * @see _.dropWhile + */ + dropWhile( + array: List, + predicate?: string, + thisArg?: any + ): TValue[]; + + /** + * @see _.dropWhile + */ + dropWhile( + array: List, + predicate?: TWhere + ): TValue[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.dropWhile + */ + dropWhile( + predicate?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.dropWhile + */ + dropWhile( + predicate?: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.dropWhile + */ + dropWhile( + predicate?: TWhere + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.dropWhile + */ + dropWhile( + predicate?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.dropWhile + */ + dropWhile( + predicate?: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.dropWhile + */ + dropWhile( + predicate?: TWhere + ): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.dropWhile + */ + dropWhile( + predicate?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.dropWhile + */ + dropWhile( + predicate?: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.dropWhile + */ + dropWhile( + predicate?: TWhere + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.dropWhile + */ + dropWhile( + predicate?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.dropWhile + */ + dropWhile( + predicate?: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.dropWhile + */ + dropWhile( + predicate?: TWhere + ): LoDashExplicitArrayWrapper; + } + + //_.fill + interface LoDashStatic { + /** + * Fills elements of array with value from start up to, but not including, end. + * + * Note: This method mutates array. + * + * @param array The array to fill. + * @param value The value to fill array with. + * @param start The start position. + * @param end The end position. + * @return Returns array. + */ + fill( + array: any[], + value: T, + start?: number, + end?: number + ): T[]; + + /** + * @see _.fill + */ + fill( + array: List, + value: T, + start?: number, + end?: number + ): List; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.fill + */ + fill( + value: T, + start?: number, + end?: number + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.fill + */ + fill( + value: T, + start?: number, + end?: number + ): LoDashImplicitObjectWrapper>; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.fill + */ + fill( + value: T, + start?: number, + end?: number + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.fill + */ + fill( + value: T, + start?: number, + end?: number + ): LoDashExplicitObjectWrapper>; + } + + //_.findIndex + interface LoDashStatic { + /** + * This method is like _.find except that it returns the index of the first element predicate returns truthy + * for instead of the element itself. + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param array The array to search. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the index of the found element, else -1. + */ + findIndex( + array: List, + predicate?: ListIterator, + thisArg?: any + ): number; + + /** + * @see _.findIndex + */ + findIndex( + array: List, + predicate?: string, + thisArg?: any + ): number; + + /** + * @see _.findIndex + */ + findIndex( + array: List, + predicate?: W + ): number; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.findIndex + */ + findIndex( + predicate?: ListIterator, + thisArg?: any + ): number; + + /** + * @see _.findIndex + */ + findIndex( + predicate?: string, + thisArg?: any + ): number; + + /** + * @see _.findIndex + */ + findIndex( + predicate?: W + ): number; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.findIndex + */ + findIndex( + predicate?: ListIterator, + thisArg?: any + ): number; + + /** + * @see _.findIndex + */ + findIndex( + predicate?: string, + thisArg?: any + ): number; + + /** + * @see _.findIndex + */ + findIndex( + predicate?: W + ): number; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.findIndex + */ + findIndex( + predicate?: ListIterator, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.findIndex + */ + findIndex( + predicate?: string, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.findIndex + */ + findIndex( + predicate?: W + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.findIndex + */ + findIndex( + predicate?: ListIterator, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.findIndex + */ + findIndex( + predicate?: string, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.findIndex + */ + findIndex( + predicate?: W + ): LoDashExplicitWrapper; + } + + //_.findLastIndex + interface LoDashStatic { + /** + * This method is like _.findIndex except that it iterates over elements of collection from right to left. + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param array The array to search. + * @param predicate The function invoked per iteration. + * @param thisArg The function invoked per iteration. + * @return Returns the index of the found element, else -1. + */ + findLastIndex( + array: List, + predicate?: ListIterator, + thisArg?: any + ): number; + + /** + * @see _.findLastIndex + */ + findLastIndex( + array: List, + predicate?: string, + thisArg?: any + ): number; + + /** + * @see _.findLastIndex + */ + findLastIndex( + array: List, + predicate?: W + ): number; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.findLastIndex + */ + findLastIndex( + predicate?: ListIterator, + thisArg?: any + ): number; + + /** + * @see _.findLastIndex + */ + findLastIndex( + predicate?: string, + thisArg?: any + ): number; + + /** + * @see _.findLastIndex + */ + findLastIndex( + predicate?: W + ): number; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.findLastIndex + */ + findLastIndex( + predicate?: ListIterator, + thisArg?: any + ): number; + + /** + * @see _.findLastIndex + */ + findLastIndex( + predicate?: string, + thisArg?: any + ): number; + + /** + * @see _.findLastIndex + */ + findLastIndex( + predicate?: W + ): number; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.findLastIndex + */ + findLastIndex( + predicate?: ListIterator, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.findLastIndex + */ + findLastIndex( + predicate?: string, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.findLastIndex + */ + findLastIndex( + predicate?: W + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.findLastIndex + */ + findLastIndex( + predicate?: ListIterator, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.findLastIndex + */ + findLastIndex( + predicate?: string, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.findLastIndex + */ + findLastIndex( + predicate?: W + ): LoDashExplicitWrapper; + } + + //_.first + interface LoDashStatic { + /** + * Gets the first element of array. + * + * @alias _.head + * + * @param array The array to query. + * @return Returns the first element of array. + */ + first(array: List): T; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.first + */ + first(): T; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.first + */ + first(): TResult; + } + + interface RecursiveArray extends Array> {} + interface ListOfRecursiveArraysOrValues extends List> {} + + //_.flatten + interface LoDashStatic { + /** + * Flattens a nested array. If isDeep is true the array is recursively flattened, otherwise it’s only + * flattened a single level. + * + * @param array The array to flatten. + * @param isDeep Specify a deep flatten. + * @return Returns the new flattened array. + */ + flatten(array: ListOfRecursiveArraysOrValues, isDeep: boolean): T[]; + + /** + * @see _.flatten + */ + flatten(array: List): T[]; + + /** + * @see _.flatten + */ + flatten(array: ListOfRecursiveArraysOrValues): RecursiveArray; + } + + interface LoDashImplicitWrapper { + /** + * @see _.flatten + */ + flatten(): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.flatten + */ + flatten(isDeep?: boolean): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.flatten + */ + flatten(isDeep?: boolean): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.flatten + */ + flatten(): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.flatten + */ + flatten(isDeep?: boolean): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.flatten + */ + flatten(isDeep?: boolean): LoDashExplicitArrayWrapper; + } + + //_.flattenDeep + interface LoDashStatic { + /** + * Recursively flattens a nested array. + * + * @param array The array to recursively flatten. + * @return Returns the new flattened array. + */ + flattenDeep(array: ListOfRecursiveArraysOrValues): T[]; + } + + interface LoDashImplicitWrapper { + /** + * @see _.flattenDeep + */ + flattenDeep(): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.flattenDeep + */ + flattenDeep(): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.flattenDeep + */ + flattenDeep(): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.flattenDeep + */ + flattenDeep(): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.flattenDeep + */ + flattenDeep(): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.flattenDeep + */ + flattenDeep(): LoDashExplicitArrayWrapper; + } + + //_.head + interface LoDashStatic { + /** + * @see _.first + */ + head(array: List): T; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.first + */ + head(): T; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.first + */ + head(): TResult; + } + + //_.indexOf + interface LoDashStatic { + /** + * Gets the index at which the first occurrence of value is found in array using SameValueZero for equality + * comparisons. If fromIndex is negative, it’s used as the offset from the end of array. If array is sorted + * providing true for fromIndex performs a faster binary search. + * + * @param array The array to search. + * @param value The value to search for. + * @param fromIndex The index to search from or true to perform a binary search on a sorted array. + * @return The index to search from or true to perform a binary search on a sorted array. + */ + indexOf( + array: List, + value: T, + fromIndex?: boolean|number + ): number; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.indexOf + */ + indexOf( + value: T, + fromIndex?: boolean|number + ): number; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.indexOf + */ + indexOf( + value: TValue, + fromIndex?: boolean|number + ): number; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.indexOf + */ + indexOf( + value: T, + fromIndex?: boolean|number + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.indexOf + */ + indexOf( + value: TValue, + fromIndex?: boolean|number + ): LoDashExplicitWrapper; + } + + //_.initial + interface LoDashStatic { + /** + * Gets all but the last element of array. + * + * @param array The array to query. + * @return Returns the slice of array. + */ + initial(array: List): T[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.initial + */ + initial(): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.initial + */ + initial(): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.initial + */ + initial(): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.initial + */ + initial(): LoDashExplicitArrayWrapper; + } + + //_.intersection + interface LoDashStatic { + /** + * Creates an array of unique values that are included in all of the provided arrays using SameValueZero for + * equality comparisons. + * + * @param arrays The arrays to inspect. + * @return Returns the new array of shared values. + */ + intersection(...arrays: (T[]|List)[]): T[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.intersection + */ + intersection(...arrays: (TResult[]|List)[]): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.intersection + */ + intersection(...arrays: (TResult[]|List)[]): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.intersection + */ + intersection(...arrays: (TResult[]|List)[]): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.intersection + */ + intersection(...arrays: (TResult[]|List)[]): LoDashExplicitArrayWrapper; + } + + //_.last + interface LoDashStatic { + /** + * Gets the last element of array. + * + * @param array The array to query. + * @return Returns the last element of array. + */ + last(array: List): T; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.last + */ + last(): T; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.last + */ + last(): T; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.last + */ + last(): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.last + */ + last(): LoDashExplicitObjectWrapper; + } + + //_.lastIndexOf + interface LoDashStatic { + /** + * This method is like _.indexOf except that it iterates over elements of array from right to left. + * + * @param array The array to search. + * @param value The value to search for. + * @param fromIndex The index to search from or true to perform a binary search on a sorted array. + * @return Returns the index of the matched value, else -1. + */ + lastIndexOf( + array: List, + value: T, + fromIndex?: boolean|number + ): number; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.lastIndexOf + */ + lastIndexOf( + value: T, + fromIndex?: boolean|number + ): number; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.lastIndexOf + */ + lastIndexOf( + value: TResult, + fromIndex?: boolean|number + ): number; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.lastIndexOf + */ + lastIndexOf( + value: T, + fromIndex?: boolean|number + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.lastIndexOf + */ + lastIndexOf( + value: TResult, + fromIndex?: boolean|number + ): LoDashExplicitWrapper; + } + + //_.object + interface LoDashStatic { + /** + * @see _.zipObject + */ + object( + props: List|List>, + values?: List + ): TResult; + + /** + * @see _.zipObject + */ + object( + props: List|List>, + values?: List + ): TResult; + + /** + * @see _.zipObject + */ + object( + props: List|List>, + values?: List + ): _.Dictionary; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.zipObject + */ + object( + values?: List + ): _.LoDashImplicitObjectWrapper; + + /** + * @see _.zipObject + */ + object( + values?: List + ): _.LoDashImplicitObjectWrapper; + + /** + * @see _.zipObject + */ + object( + values?: List + ): _.LoDashImplicitObjectWrapper<_.Dictionary>; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.zipObject + */ + object( + values?: List + ): _.LoDashImplicitObjectWrapper; + + /** + * @see _.zipObject + */ + object( + values?: List + ): _.LoDashImplicitObjectWrapper; + + /** + * @see _.zipObject + */ + object( + values?: List + ): _.LoDashImplicitObjectWrapper<_.Dictionary>; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.zipObject + */ + object( + values?: List + ): _.LoDashExplicitObjectWrapper; + + /** + * @see _.zipObject + */ + object( + values?: List + ): _.LoDashExplicitObjectWrapper; + + /** + * @see _.zipObject + */ + object( + values?: List + ): _.LoDashExplicitObjectWrapper<_.Dictionary>; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.zipObject + */ + object( + values?: List + ): _.LoDashExplicitObjectWrapper; + + /** + * @see _.zipObject + */ + object( + values?: List + ): _.LoDashExplicitObjectWrapper; + + /** + * @see _.zipObject + */ + object( + values?: List + ): _.LoDashExplicitObjectWrapper<_.Dictionary>; + } + + //_.pull + interface LoDashStatic { + /** + * Removes all provided values from array using SameValueZero for equality comparisons. + * + * Note: Unlike _.without, this method mutates array. + * + * @param array The array to modify. + * @param values The values to remove. + * @return Returns array. + */ + pull( + array: T[], + ...values: T[] + ): T[]; + + /** + * @see _.pull + */ + pull( + array: List, + ...values: T[] + ): List; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.pull + */ + pull(...values: T[]): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.pull + */ + pull(...values: TValue[]): LoDashImplicitObjectWrapper>; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.pull + */ + pull(...values: T[]): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.pull + */ + pull(...values: TValue[]): LoDashExplicitObjectWrapper>; + } + + //_.pullAt + interface LoDashStatic { + /** + * Removes elements from array corresponding to the given indexes and returns an array of the removed elements. + * Indexes may be specified as an array of indexes or as individual arguments. + * + * Note: Unlike _.at, this method mutates array. + * + * @param array The array to modify. + * @param indexes The indexes of elements to remove, specified as individual indexes or arrays of indexes. + * @return Returns the new array of removed elements. + */ + pullAt( + array: List, + ...indexes: (number|number[])[] + ): T[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.pullAt + */ + pullAt(...indexes: (number|number[])[]): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.pullAt + */ + pullAt(...indexes: (number|number[])[]): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.pullAt + */ + pullAt(...indexes: (number|number[])[]): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.pullAt + */ + pullAt(...indexes: (number|number[])[]): LoDashExplicitArrayWrapper; + } + + //_.remove + interface LoDashStatic { + /** + * Removes all elements from array that predicate returns truthy for and returns an array of the removed + * elements. The predicate is bound to thisArg and invoked with three arguments: (value, index, array). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * Note: Unlike _.filter, this method mutates array. + * + * @param array The array to modify. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the new array of removed elements. + */ + remove( + array: List, + predicate?: ListIterator, + thisArg?: any + ): T[]; + + /** + * @see _.remove + */ + remove( + array: List, + predicate?: string, + thisArg?: any + ): T[]; + + /** + * @see _.remove + */ + remove( + array: List, + predicate?: W + ): T[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.remove + */ + remove( + predicate?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.remove + */ + remove( + predicate?: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.remove + */ + remove( + predicate?: W + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.remove + */ + remove( + predicate?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.remove + */ + remove( + predicate?: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.remove + */ + remove( + predicate?: W + ): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.remove + */ + remove( + predicate?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.remove + */ + remove( + predicate?: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.remove + */ + remove( + predicate?: W + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.remove + */ + remove( + predicate?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.remove + */ + remove( + predicate?: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.remove + */ + remove( + predicate?: W + ): LoDashExplicitArrayWrapper; + } + + //_.rest + interface LoDashStatic { + /** + * Gets all but the first element of array. + * + * @alias _.tail + * + * @param array The array to query. + * @return Returns the slice of array. + */ + rest(array: List): T[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.rest + */ + rest(): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.rest + */ + rest(): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.rest + */ + rest(): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.rest + */ + rest(): LoDashExplicitArrayWrapper; + } + + //_.slice + interface LoDashStatic { + /** + * Creates a slice of array from start up to, but not including, end. + * + * @param array The array to slice. + * @param start The start position. + * @param end The end position. + * @return Returns the slice of array. + */ + slice( + array: T[], + start?: number, + end?: number + ): T[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.slice + */ + slice( + start?: number, + end?: number + ): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.slice + */ + slice( + start?: number, + end?: number + ): LoDashExplicitArrayWrapper; + } + + //_.sortedIndex + interface LoDashStatic { + /** + * Uses a binary search to determine the lowest index at which value should be inserted into array in order to maintain its sort order. If an iteratee function is provided it’s invoked for value and each element of array to compute their sort ranking. The iteratee is bound to thisArg and invoked with one argument; (value). + * + * If a property name is provided for iteratee the created _.property style callback returns the property value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that have the properties of the given object, else false. + * + * @param array The sorted array to inspect. + * @param value The value to evaluate. + * @param iteratee The function invoked per iteration. + * @return The this binding of iteratee. + */ + sortedIndex( + array: List, + value: T, + iteratee?: (x: T) => TSort, + thisArg?: any + ): number; + + /** + * @see _.sortedIndex + */ + sortedIndex( + array: List, + value: T, + iteratee?: (x: T) => any, + thisArg?: any + ): number; + + /** + * @see _.sortedIndex + */ + sortedIndex( + array: List, + value: T, + iteratee: string + ): number; + + /** + * @see _.sortedIndex + */ + sortedIndex( + array: List, + value: T, + iteratee: W + ): number; + + /** + * @see _.sortedIndex + */ + sortedIndex( + array: List, + value: T, + iteratee: Object + ): number; + } + + interface LoDashImplicitWrapper { + /** + * @see _.sortedIndex + */ + sortedIndex( + value: string, + iteratee?: (x: string) => TSort, + thisArg?: any + ): number; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.sortedIndex + */ + sortedIndex( + value: T, + iteratee?: (x: T) => TSort, + thisArg?: any + ): number; + + /** + * @see _.sortedIndex + */ + sortedIndex( + value: T, + iteratee: string + ): number; + + /** + * @see _.sortedIndex + */ + sortedIndex( + value: T, + iteratee: W + ): number; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.sortedIndex + */ + sortedIndex( + value: T, + iteratee?: (x: T) => TSort, + thisArg?: any + ): number; + + /** + * @see _.sortedIndex + */ + sortedIndex( + value: T, + iteratee?: (x: T) => any, + thisArg?: any + ): number; + + /** + * @see _.sortedIndex + */ + sortedIndex( + value: T, + iteratee: string + ): number; + + /** + * @see _.sortedIndex + */ + sortedIndex( + value: T, + iteratee: W + ): number; + + /** + * @see _.sortedIndex + */ + sortedIndex( + value: T, + iteratee: Object + ): number; + } + + interface LoDashExplicitWrapper { + /** + * @see _.sortedIndex + */ + sortedIndex( + value: string, + iteratee?: (x: string) => TSort, + thisArg?: any + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.sortedIndex + */ + sortedIndex( + value: T, + iteratee?: (x: T) => TSort, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.sortedIndex + */ + sortedIndex( + value: T, + iteratee: string + ): LoDashExplicitWrapper; + + /** + * @see _.sortedIndex + */ + sortedIndex( + value: T, + iteratee: W + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.sortedIndex + */ + sortedIndex( + value: T, + iteratee?: (x: T) => TSort, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.sortedIndex + */ + sortedIndex( + value: T, + iteratee?: (x: T) => any, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.sortedIndex + */ + sortedIndex( + value: T, + iteratee: string + ): LoDashExplicitWrapper; + + /** + * @see _.sortedIndex + */ + sortedIndex( + value: T, + iteratee: W + ): LoDashExplicitWrapper; + + /** + * @see _.sortedIndex + */ + sortedIndex( + value: T, + iteratee: Object + ): LoDashExplicitWrapper; + } + + //_.sortedLastIndex + interface LoDashStatic { + /** + * This method is like _.sortedIndex except that it returns the highest index at which value should be + * inserted into array in order to maintain its sort order. + * + * @param array The sorted array to inspect. + * @param value The value to evaluate. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the index at which value should be inserted into array. + */ + sortedLastIndex( + array: List, + value: T, + iteratee?: (x: T) => TSort, + thisArg?: any + ): number; + + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + array: List, + value: T, + iteratee?: (x: T) => any, + thisArg?: any + ): number; + + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + array: List, + value: T, + iteratee: string + ): number; + + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + array: List, + value: T, + iteratee: W + ): number; + + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + array: List, + value: T, + iteratee: Object + ): number; + } + + interface LoDashImplicitWrapper { + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: string, + iteratee?: (x: string) => TSort, + thisArg?: any + ): number; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee?: (x: T) => TSort, + thisArg?: any + ): number; + + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee: string + ): number; + + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee: W + ): number; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee?: (x: T) => TSort, + thisArg?: any + ): number; + + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee?: (x: T) => any, + thisArg?: any + ): number; + + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee: string + ): number; + + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee: W + ): number; + + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee: Object + ): number; + } + + interface LoDashExplicitWrapper { + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: string, + iteratee?: (x: string) => TSort, + thisArg?: any + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee?: (x: T) => TSort, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee: string + ): LoDashExplicitWrapper; + + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee: W + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee?: (x: T) => TSort, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee?: (x: T) => any, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee: string + ): LoDashExplicitWrapper; + + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee: W + ): LoDashExplicitWrapper; + + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee: Object + ): LoDashExplicitWrapper; + } + + //_.tail + interface LoDashStatic { + /** + * @see _.rest + */ + tail(array: List): T[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.rest + */ + tail(): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.rest + */ + tail(): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.rest + */ + tail(): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.rest + */ + tail(): LoDashExplicitArrayWrapper; + } + + //_.take + interface LoDashStatic { + /** + * Creates a slice of array with n elements taken from the beginning. + * + * @param array The array to query. + * @param n The number of elements to take. + * @return Returns the slice of array. + */ + take( + array: List, + n?: number + ): T[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.take + */ + take(n?: number): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.take + */ + take(n?: number): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.take + */ + take(n?: number): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.take + */ + take(n?: number): LoDashExplicitArrayWrapper; + } + + //_.takeRight + interface LoDashStatic { + /** + * Creates a slice of array with n elements taken from the end. + * + * @param array The array to query. + * @param n The number of elements to take. + * @return Returns the slice of array. + */ + takeRight( + array: List, + n?: number + ): T[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.takeRight + */ + takeRight(n?: number): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.takeRight + */ + takeRight(n?: number): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.takeRight + */ + takeRight(n?: number): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.takeRight + */ + takeRight(n?: number): LoDashExplicitArrayWrapper; + } + + //_.takeRightWhile + interface LoDashStatic { + /** + * Creates a slice of array with elements taken from the end. Elements are taken until predicate returns + * falsey. The predicate is bound to thisArg and invoked with three arguments: (value, index, array). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param array The array to query. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the slice of array. + */ + takeRightWhile( + array: List, + predicate?: ListIterator, + thisArg?: any + ): TValue[]; + + /** + * @see _.takeRightWhile + */ + takeRightWhile( + array: List, + predicate?: string, + thisArg?: any + ): TValue[]; + + /** + * @see _.takeRightWhile + */ + takeRightWhile( + array: List, + predicate?: TWhere + ): TValue[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.takeRightWhile + */ + takeRightWhile( + predicate?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.takeRightWhile + */ + takeRightWhile( + predicate?: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.takeRightWhile + */ + takeRightWhile( + predicate?: TWhere + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.takeRightWhile + */ + takeRightWhile( + predicate?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.takeRightWhile + */ + takeRightWhile( + predicate?: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.takeRightWhile + */ + takeRightWhile( + predicate?: TWhere + ): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.takeRightWhile + */ + takeRightWhile( + predicate?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.takeRightWhile + */ + takeRightWhile( + predicate?: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.takeRightWhile + */ + takeRightWhile( + predicate?: TWhere + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.takeRightWhile + */ + takeRightWhile( + predicate?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.takeRightWhile + */ + takeRightWhile( + predicate?: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.takeRightWhile + */ + takeRightWhile( + predicate?: TWhere + ): LoDashExplicitArrayWrapper; + } + + //_.takeWhile + interface LoDashStatic { + /** + * Creates a slice of array with elements taken from the beginning. Elements are taken until predicate returns + * falsey. The predicate is bound to thisArg and invoked with three arguments: (value, index, array). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param array The array to query. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the slice of array. + */ + takeWhile( + array: List, + predicate?: ListIterator, + thisArg?: any + ): TValue[]; + + /** + * @see _.takeWhile + */ + takeWhile( + array: List, + predicate?: string, + thisArg?: any + ): TValue[]; + + /** + * @see _.takeWhile + */ + takeWhile( + array: List, + predicate?: TWhere + ): TValue[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.takeWhile + */ + takeWhile( + predicate?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.takeWhile + */ + takeWhile( + predicate?: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.takeWhile + */ + takeWhile( + predicate?: TWhere + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.takeWhile + */ + takeWhile( + predicate?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.takeWhile + */ + takeWhile( + predicate?: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.takeWhile + */ + takeWhile( + predicate?: TWhere + ): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.takeWhile + */ + takeWhile( + predicate?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.takeWhile + */ + takeWhile( + predicate?: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.takeWhile + */ + takeWhile( + predicate?: TWhere + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.takeWhile + */ + takeWhile( + predicate?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.takeWhile + */ + takeWhile( + predicate?: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.takeWhile + */ + takeWhile( + predicate?: TWhere + ): LoDashExplicitArrayWrapper; + } + + //_.union + interface LoDashStatic { + /** + * Creates an array of unique values, in order, from all of the provided arrays using SameValueZero for + * equality comparisons. + * + * @param arrays The arrays to inspect. + * @return Returns the new array of combined values. + */ + union(...arrays: List[]): T[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.union + */ + union(...arrays: List[]): LoDashImplicitArrayWrapper; + + /** + * @see _.union + */ + union(...arrays: List[]): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.union + */ + union(...arrays: List[]): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.union + */ + union(...arrays: List[]): LoDashExplicitArrayWrapper; + + /** + * @see _.union + */ + union(...arrays: List[]): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.union + */ + union(...arrays: List[]): LoDashExplicitArrayWrapper; + } + + //_.uniq + interface LoDashStatic { + /** + * Creates a duplicate-free version of an array, using SameValueZero for equality comparisons, in which only + * the first occurrence of each element is kept. Providing true for isSorted performs a faster search + * algorithm for sorted arrays. If an iteratee function is provided it’s invoked for each element in the + * array to generate the criterion by which uniqueness is computed. The iteratee is bound to thisArg and + * invoked with three arguments: (value, index, array). + * + * If a property name is provided for iteratee the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @alias _.unique + * + * @param array The array to inspect. + * @param isSorted Specify the array is sorted. + * @param iteratee The function invoked per iteration. + * @param thisArg iteratee + * @return Returns the new duplicate-value-free array. + */ + uniq( + array: List, + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): T[]; + + /** + * @see _.uniq + */ + uniq( + array: List, + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): T[]; + + /** + * @see _.uniq + */ + uniq( + array: List, + iteratee?: ListIterator, + thisArg?: any + ): T[]; + + /** + * @see _.uniq + */ + uniq( + array: List, + iteratee?: ListIterator, + thisArg?: any + ): T[]; + + /** + * @see _.uniq + */ + uniq( + array: List, + isSorted?: boolean, + iteratee?: string, + thisArg?: any + ): T[]; + + /** + * @see _.uniq + */ + uniq( + array: List, + iteratee?: string, + thisArg?: any + ): T[]; + + /** + * @see _.uniq + */ + uniq( + array: List, + isSorted?: boolean, + iteratee?: Object + ): T[]; + + /** + * @see _.uniq + */ + uniq( + array: List, + isSorted?: boolean, + iteratee?: TWhere + ): T[]; + + /** + * @see _.uniq + */ + uniq( + array: List, + iteratee?: Object + ): T[]; + + /** + * @see _.uniq + */ + uniq( + array: List, + iteratee?: TWhere + ): T[]; + } + + interface LoDashImplicitWrapper { + /** + * @see _.uniq + */ + uniq( + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.uniq + */ + uniq( + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + isSorted?: boolean, + iteratee?: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + iteratee?: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + isSorted?: boolean, + iteratee?: TWhere + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + iteratee?: TWhere + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + uniq( + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + isSorted?: boolean, + iteratee?: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + iteratee?: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + isSorted?: boolean, + iteratee?: Object + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + isSorted?: boolean, + iteratee?: TWhere + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + iteratee?: Object + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + iteratee?: TWhere + ): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.uniq + */ + uniq( + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.uniq + */ + uniq( + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + isSorted?: boolean, + iteratee?: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + iteratee?: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + isSorted?: boolean, + iteratee?: TWhere + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + iteratee?: TWhere + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + uniq( + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + isSorted?: boolean, + iteratee?: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + iteratee?: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + isSorted?: boolean, + iteratee?: Object + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + isSorted?: boolean, + iteratee?: TWhere + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + iteratee?: Object + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + iteratee?: TWhere + ): LoDashExplicitArrayWrapper; + } + + //_.unique + interface LoDashStatic { + /** + * @see _.uniq + */ + unique( + array: List, + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): T[]; + + /** + * @see _.uniq + */ + unique( + array: List, + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): T[]; + + /** + * @see _.uniq + */ + unique( + array: List, + iteratee?: ListIterator, + thisArg?: any + ): T[]; + + /** + * @see _.uniq + */ + unique( + array: List, + iteratee?: ListIterator, + thisArg?: any + ): T[]; + + /** + * @see _.uniq + */ + unique( + array: List, + isSorted?: boolean, + iteratee?: string, + thisArg?: any + ): T[]; + + /** + * @see _.uniq + */ + unique( + array: List, + iteratee?: string, + thisArg?: any + ): T[]; + + /** + * @see _.uniq + */ + unique( + array: List, + isSorted?: boolean, + iteratee?: Object + ): T[]; + + /** + * @see _.uniq + */ + unique( + array: List, + isSorted?: boolean, + iteratee?: TWhere + ): T[]; + + /** + * @see _.uniq + */ + unique( + array: List, + iteratee?: Object + ): T[]; + + /** + * @see _.uniq + */ + unique( + array: List, + iteratee?: TWhere + ): T[]; + } + + interface LoDashImplicitWrapper { + /** + * @see _.uniq + */ + unique( + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.uniq + */ + unique( + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + isSorted?: boolean, + iteratee?: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + iteratee?: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + isSorted?: boolean, + iteratee?: TWhere + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + iteratee?: TWhere + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + unique( + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + isSorted?: boolean, + iteratee?: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + iteratee?: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + isSorted?: boolean, + iteratee?: Object + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + isSorted?: boolean, + iteratee?: TWhere + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + iteratee?: Object + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + iteratee?: TWhere + ): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.uniq + */ + unique( + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.uniq + */ + unique( + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + isSorted?: boolean, + iteratee?: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + iteratee?: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + isSorted?: boolean, + iteratee?: TWhere + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + iteratee?: TWhere + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + unique( + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + isSorted?: boolean, + iteratee?: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + iteratee?: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + isSorted?: boolean, + iteratee?: Object + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + isSorted?: boolean, + iteratee?: TWhere + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + iteratee?: Object + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + iteratee?: TWhere + ): LoDashExplicitArrayWrapper; + } + + //_.unzip + interface LoDashStatic { + /** + * This method is like _.zip except that it accepts an array of grouped elements and creates an array + * regrouping the elements to their pre-zip configuration. + * + * @param array The array of grouped elements to process. + * @return Returns the new array of regrouped elements. + */ + unzip(array: List>): T[][]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.unzip + */ + unzip(): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.unzip + */ + unzip(): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.unzip + */ + unzip(): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.unzip + */ + unzip(): LoDashExplicitArrayWrapper; + } + + //_.unzipWith + interface LoDashStatic { + /** + * This method is like _.unzip except that it accepts an iteratee to specify how regrouped values should be + * combined. The iteratee is bound to thisArg and invoked with four arguments: (accumulator, value, index, + * group). + * + * @param array The array of grouped elements to process. + * @param iteratee The function to combine regrouped values. + * @param thisArg The this binding of iteratee. + * @return Returns the new array of regrouped elements. + */ + unzipWith( + array: List>, + iteratee?: MemoIterator, + thisArg?: any + ): TResult[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.unzipWith + */ + unzipWith( + iteratee?: MemoIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.unzipWith + */ + unzipWith( + iteratee?: MemoIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + } + + //_.without + interface LoDashStatic { + /** + * Creates an array excluding all provided values using SameValueZero for equality comparisons. + * + * @param array The array to filter. + * @param values The values to exclude. + * @return Returns the new array of filtered values. + */ + without( + array: List, + ...values: T[] + ): T[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.without + */ + without(...values: T[]): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.without + */ + without(...values: T[]): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.without + */ + without(...values: T[]): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.without + */ + without(...values: T[]): LoDashExplicitArrayWrapper; + } + + //_.xor + interface LoDashStatic { + /** + * Creates an array of unique values that is the symmetric difference of the provided arrays. + * + * @param arrays The arrays to inspect. + * @return Returns the new array of values. + */ + xor(...arrays: List[]): T[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.xor + */ + xor(...arrays: List[]): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.xor + */ + xor(...arrays: List[]): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.xor + */ + xor(...arrays: List[]): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.xor + */ + xor(...arrays: List[]): LoDashExplicitArrayWrapper; + } + + //_.zip + interface LoDashStatic { + /** + * Creates an array of grouped elements, the first of which contains the first elements of the given arrays, + * the second of which contains the second elements of the given arrays, and so on. + * + * @param arrays The arrays to process. + * @return Returns the new array of grouped elements. + */ + zip(...arrays: List[]): T[][]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.zip + */ + zip(...arrays: List[]): _.LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.zip + */ + zip(...arrays: List[]): _.LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.zip + */ + zip(...arrays: List[]): _.LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.zip + */ + zip(...arrays: List[]): _.LoDashExplicitArrayWrapper; + } + + //_.zipObject + interface LoDashStatic { + /** + * The inverse of _.pairs; this method returns an object composed from arrays of property names and values. + * Provide either a single two dimensional array, e.g. [[key1, value1], [key2, value2]] or two arrays, one of + * property names and one of corresponding values. + * + * @alias _.object + * + * @param props The property names. + * @param values The property values. + * @return Returns the new object. + */ + zipObject( + props: List|List>, + values?: List + ): TResult; + + /** + * @see _.zipObject + */ + zipObject( + props: List|List>, + values?: List + ): TResult; + + /** + * @see _.zipObject + */ + zipObject( + props: List|List>, + values?: List + ): _.Dictionary; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.zipObject + */ + zipObject( + values?: List + ): _.LoDashImplicitObjectWrapper; + + /** + * @see _.zipObject + */ + zipObject( + values?: List + ): _.LoDashImplicitObjectWrapper; + + /** + * @see _.zipObject + */ + zipObject( + values?: List + ): _.LoDashImplicitObjectWrapper<_.Dictionary>; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.zipObject + */ + zipObject( + values?: List + ): _.LoDashImplicitObjectWrapper; + + /** + * @see _.zipObject + */ + zipObject( + values?: List + ): _.LoDashImplicitObjectWrapper; + + /** + * @see _.zipObject + */ + zipObject( + values?: List + ): _.LoDashImplicitObjectWrapper<_.Dictionary>; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.zipObject + */ + zipObject( + values?: List + ): _.LoDashExplicitObjectWrapper; + + /** + * @see _.zipObject + */ + zipObject( + values?: List + ): _.LoDashExplicitObjectWrapper; + + /** + * @see _.zipObject + */ + zipObject( + values?: List + ): _.LoDashExplicitObjectWrapper<_.Dictionary>; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.zipObject + */ + zipObject( + values?: List + ): _.LoDashExplicitObjectWrapper; + + /** + * @see _.zipObject + */ + zipObject( + values?: List + ): _.LoDashExplicitObjectWrapper; + + /** + * @see _.zipObject + */ + zipObject( + values?: List + ): _.LoDashExplicitObjectWrapper<_.Dictionary>; + } + + //_.zipWith + interface LoDashStatic { + /** + * This method is like _.zip except that it accepts an iteratee to specify how grouped values should be + * combined. The iteratee is bound to thisArg and invoked with four arguments: (accumulator, value, index, + * group). + * @param {...Array} [arrays] The arrays to process. + * @param {Function} [iteratee] The function to combine grouped values. + * @param {*} [thisArg] The `this` binding of `iteratee`. + * @return Returns the new array of grouped elements. + */ + zipWith(...args: any[]): TResult[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.zipWith + */ + zipWith(...args: any[]): LoDashImplicitArrayWrapper; + } + + /********* + * Chain * + *********/ + + //_.chain + interface LoDashStatic { + /** + * Creates a lodash object that wraps value with explicit method chaining enabled. + * + * @param value The value to wrap. + * @return Returns the new lodash wrapper instance. + */ + chain(value: number): LoDashExplicitWrapper; + chain(value: string): LoDashExplicitWrapper; + chain(value: boolean): LoDashExplicitWrapper; + chain(value: T[]): LoDashExplicitArrayWrapper; + chain(value: T): LoDashExplicitObjectWrapper; + chain(value: any): LoDashExplicitWrapper; + } + + interface LoDashImplicitWrapper { + /** + * @see _.chain + */ + chain(): LoDashExplicitWrapper; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.chain + */ + chain(): LoDashExplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.chain + */ + chain(): LoDashExplicitObjectWrapper; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.chain + */ + chain(): TWrapper; + } + + //_.tap + interface LoDashStatic { + /** + * This method invokes interceptor and returns value. The interceptor is bound to thisArg and invoked with one + * argument; (value). The purpose of this method is to "tap into" a method chain in order to perform operations + * on intermediate results within the chain. + * + * @param value The value to provide to interceptor. + * @param interceptor The function to invoke. + * @parem thisArg The this binding of interceptor. + * @return Returns value. + **/ + tap( + value: T, + interceptor: (value: T) => void, + thisArg?: any + ): T; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.tap + */ + tap( + interceptor: (value: T) => void, + thisArg?: any + ): TWrapper; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.tap + */ + tap( + interceptor: (value: T) => void, + thisArg?: any + ): TWrapper; + } + + //_.thru + interface LoDashStatic { + /** + * This method is like _.tap except that it returns the result of interceptor. + * + * @param value The value to provide to interceptor. + * @param interceptor The function to invoke. + * @param thisArg The this binding of interceptor. + * @return Returns the result of interceptor. + */ + thru( + value: T, + interceptor: (value: T) => TResult, + thisArg?: any + ): TResult; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.thru + */ + thru( + interceptor: (value: T) => TResult, + thisArg?: any): LoDashImplicitWrapper; + + /** + * @see _.thru + */ + thru( + interceptor: (value: T) => TResult, + thisArg?: any): LoDashImplicitWrapper; + + /** + * @see _.thru + */ + thru( + interceptor: (value: T) => TResult, + thisArg?: any): LoDashImplicitWrapper; + + /** + * @see _.thru + */ + thru( + interceptor: (value: T) => TResult, + thisArg?: any): LoDashImplicitObjectWrapper; + + /** + * @see _.thru + */ + thru( + interceptor: (value: T) => TResult[], + thisArg?: any): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.thru + */ + thru( + interceptor: (value: T) => TResult, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.thru + */ + thru( + interceptor: (value: T) => TResult, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.thru + */ + thru( + interceptor: (value: T) => TResult, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.thru + */ + thru( + interceptor: (value: T) => TResult, + thisArg?: any + ): LoDashExplicitObjectWrapper; + + /** + * @see _.thru + */ + thru( + interceptor: (value: T) => TResult[], + thisArg?: any + ): LoDashExplicitArrayWrapper; + } + + //_.prototype.commit + interface LoDashImplicitWrapperBase { + /** + * Executes the chained sequence and returns the wrapped result. + * + * @return Returns the new lodash wrapper instance. + */ + commit(): TWrapper; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.commit + */ + commit(): TWrapper; + } + + //_.prototype.concat + interface LoDashImplicitWrapperBase { + /** + * Creates a new array joining a wrapped array with any additional arrays and/or values. + * + * @param items + * @return Returns the new concatenated array. + */ + concat(...items: Array>): LoDashImplicitArrayWrapper; + + /** + * @see _.concat + */ + concat(...items: Array>): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.concat + */ + concat(...items: Array>): LoDashExplicitArrayWrapper; + + /** + * @see _.concat + */ + concat(...items: Array>): LoDashExplicitArrayWrapper; + } + + //_.prototype.plant + interface LoDashImplicitWrapperBase { + /** + * Creates a clone of the chained sequence planting value as the wrapped value. + * @param value The value to plant as the wrapped value. + * @return Returns the new lodash wrapper instance. + */ + plant(value: number): LoDashImplicitWrapper; + + /** + * @see _.plant + */ + plant(value: string): LoDashImplicitStringWrapper; + + /** + * @see _.plant + */ + plant(value: boolean): LoDashImplicitWrapper; + + /** + * @see _.plant + */ + plant(value: number[]): LoDashImplicitNumberArrayWrapper; + + /** + * @see _.plant + */ + plant(value: T[]): LoDashImplicitArrayWrapper; + + /** + * @see _.plant + */ + plant(value: T): LoDashImplicitObjectWrapper; + + /** + * @see _.plant + */ + plant(value: any): LoDashImplicitWrapper; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.plant + */ + plant(value: number): LoDashExplicitWrapper; + + /** + * @see _.plant + */ + plant(value: string): LoDashExplicitStringWrapper; + + /** + * @see _.plant + */ + plant(value: boolean): LoDashExplicitWrapper; + + /** + * @see _.plant + */ + plant(value: number[]): LoDashExplicitNumberArrayWrapper; + + /** + * @see _.plant + */ + plant(value: T[]): LoDashExplicitArrayWrapper; + + /** + * @see _.plant + */ + plant(value: T): LoDashExplicitObjectWrapper; + + /** + * @see _.plant + */ + plant(value: any): LoDashExplicitWrapper; + } + + //_.prototype.reverse + interface LoDashImplicitArrayWrapper { + /** + * Reverses the wrapped array so the first element becomes the last, the second element becomes the second to + * last, and so on. + * + * Note: This method mutates the wrapped array. + * + * @return Returns the new reversed lodash wrapper instance. + */ + reverse(): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.reverse + */ + reverse(): LoDashExplicitArrayWrapper; + } + + //_.prototype.run + interface LoDashWrapperBase { + /** + * @see _.value + */ + run(): T; + } + + //_.prototype.toJSON + interface LoDashWrapperBase { + /** + * @see _.value + */ + toJSON(): T; + } + + //_.prototype.toString + interface LoDashWrapperBase { + /** + * Produces the result of coercing the unwrapped value to a string. + * + * @return Returns the coerced string value. + */ + toString(): string; + } + + //_.prototype.value + interface LoDashWrapperBase { + /** + * Executes the chained sequence to extract the unwrapped value. + * + * @alias _.run, _.toJSON, _.valueOf + * + * @return Returns the resolved unwrapped value. + */ + value(): T; + } + + //_.valueOf + interface LoDashWrapperBase { + /** + * @see _.value + */ + valueOf(): T; + } + + /************** + * Collection * + **************/ + + //_.all + interface LoDashStatic { + /** + * @see _.every + */ + all( + collection: List, + predicate?: ListIterator, + thisArg?: any + ): boolean; + + /** + * @see _.every + */ + all( + collection: Dictionary, + predicate?: DictionaryIterator, + thisArg?: any + ): boolean; + + /** + * @see _.every + */ + all( + collection: List|Dictionary, + predicate?: string, + thisArg?: any + ): boolean; + + /** + * @see _.every + */ + all( + collection: List|Dictionary, + predicate?: TObject + ): boolean; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.every + */ + all( + predicate?: ListIterator, + thisArg?: any + ): boolean; + + /** + * @see _.every + */ + all( + predicate?: string, + thisArg?: any + ): boolean; + + /** + * @see _.every + */ + all( + predicate?: TObject + ): boolean; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.every + */ + all( + predicate?: ListIterator|DictionaryIterator, + thisArg?: any + ): boolean; + + /** + * @see _.every + */ + all( + predicate?: string, + thisArg?: any + ): boolean; + + /** + * @see _.every + */ + all( + predicate?: TObject + ): boolean; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.every + */ + all( + predicate?: ListIterator, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.every + */ + all( + predicate?: string, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.every + */ + all( + predicate?: TObject + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.every + */ + all( + predicate?: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.every + */ + all( + predicate?: string, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.every + */ + all( + predicate?: TObject + ): LoDashExplicitWrapper; + } + + //_.any + interface LoDashStatic { + /** + * @see _.some + */ + any( + collection: List, + predicate?: ListIterator, + thisArg?: any + ): boolean; + + /** + * @see _.some + */ + any( + collection: Dictionary, + predicate?: DictionaryIterator, + thisArg?: any + ): boolean; + + /** + * @see _.some + */ + any( + collection: NumericDictionary, + predicate?: NumericDictionaryIterator, + thisArg?: any + ): boolean; + + /** + * @see _.some + */ + any( + collection: List|Dictionary|NumericDictionary, + predicate?: string, + thisArg?: any + ): boolean; + + /** + * @see _.some + */ + any( + collection: List|Dictionary|NumericDictionary, + predicate?: TObject + ): boolean; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.some + */ + any( + predicate?: ListIterator|NumericDictionaryIterator, + thisArg?: any + ): boolean; + + /** + * @see _.some + */ + any( + predicate?: string, + thisArg?: any + ): boolean; + + /** + * @see _.some + */ + any( + predicate?: TObject + ): boolean; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.some + */ + any( + predicate?: ListIterator|DictionaryIterator|NumericDictionaryIterator, + thisArg?: any + ): boolean; + + /** + * @see _.some + */ + any( + predicate?: string, + thisArg?: any + ): boolean; + + /** + * @see _.some + */ + any( + predicate?: TObject + ): boolean; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.some + */ + any( + predicate?: ListIterator|NumericDictionaryIterator, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.some + */ + any( + predicate?: string, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.some + */ + any( + predicate?: TObject + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.some + */ + any( + predicate?: ListIterator|DictionaryIterator|NumericDictionaryIterator, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.some + */ + any( + predicate?: string, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.some + */ + any( + predicate?: TObject + ): LoDashExplicitWrapper; + } + + //_.at + interface LoDashStatic { + /** + * Creates an array of elements corresponding to the given keys, or indexes, of collection. Keys may be + * specified as individual arguments or as arrays of keys. + * + * @param collection The collection to iterate over. + * @param props The property names or indexes of elements to pick, specified individually or in arrays. + * @return Returns the new array of picked elements. + */ + at( + collection: List|Dictionary, + ...props: (number|string|(number|string)[])[] + ): T[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.at + */ + at(...props: (number|string|(number|string)[])[]): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.at + */ + at(...props: (number|string|(number|string)[])[]): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.at + */ + at(...props: (number|string|(number|string)[])[]): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.at + */ + at(...props: (number|string|(number|string)[])[]): LoDashExplicitArrayWrapper; + } + + //_.collect + interface LoDashStatic { + /** + * @see _.map + */ + collect( + collection: List, + iteratee?: ListIterator, + thisArg?: any + ): TResult[]; + + /** + * @see _.map + */ + collect( + collection: Dictionary, + iteratee?: DictionaryIterator, + thisArg?: any + ): TResult[]; + + /** + * @see _.map + */ + collect( + collection: List|Dictionary, + iteratee?: string + ): TResult[]; + + /** + * @see _.map + */ + collect( + collection: List|Dictionary, + iteratee?: TObject + ): boolean[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.map + */ + collect( + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.map + */ + collect( + iteratee?: string + ): LoDashImplicitArrayWrapper; + + /** + * @see _.map + */ + collect( + iteratee?: TObject + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.map + */ + collect( + iteratee?: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.map + */ + collect( + iteratee?: string + ): LoDashImplicitArrayWrapper; + + /** + * @see _.map + */ + collect( + iteratee?: TObject + ): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.map + */ + collect( + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.map + */ + collect( + iteratee?: string + ): LoDashExplicitArrayWrapper; + + /** + * @see _.map + */ + collect( + iteratee?: TObject + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.map + */ + collect( + iteratee?: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.map + */ + collect( + iteratee?: string + ): LoDashExplicitArrayWrapper; + + /** + * @see _.map + */ + collect( + iteratee?: TObject + ): LoDashExplicitArrayWrapper; + } + + //_.contains + interface LoDashStatic { + /** + * @see _.includes + */ + contains( + collection: List|Dictionary, + target: T, + fromIndex?: number + ): boolean; + + /** + * @see _.includes + */ + contains( + collection: string, + target: string, + fromIndex?: number + ): boolean; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.includes + */ + contains( + target: T, + fromIndex?: number + ): boolean; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.includes + */ + contains( + target: TValue, + fromIndex?: number + ): boolean; + } + + interface LoDashImplicitWrapper { + /** + * @see _.includes + */ + contains( + target: string, + fromIndex?: number + ): boolean; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.includes + */ + contains( + target: T, + fromIndex?: number + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.includes + */ + contains( + target: TValue, + fromIndex?: number + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.includes + */ + contains( + target: string, + fromIndex?: number + ): LoDashExplicitWrapper; + } + + //_.countBy + interface LoDashStatic { + /** + * Creates an object composed of keys generated from the results of running each element of collection through + * iteratee. The corresponding value of each key is the number of times the key was returned by iteratee. The + * iteratee is bound to thisArg and invoked with three arguments: + * (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the composed aggregate object. + */ + countBy( + collection: List, + iteratee?: ListIterator, + thisArg?: any + ): Dictionary; + + /** + * @see _.countBy + */ + countBy( + collection: Dictionary, + iteratee?: DictionaryIterator, + thisArg?: any + ): Dictionary; + + /** + * @see _.countBy + */ + countBy( + collection: NumericDictionary, + iteratee?: NumericDictionaryIterator, + thisArg?: any + ): Dictionary; + + /** + * @see _.countBy + */ + countBy( + collection: List|Dictionary|NumericDictionary, + iteratee?: string, + thisArg?: any + ): Dictionary; + + /** + * @see _.countBy + */ + countBy( + collection: List|Dictionary|NumericDictionary, + iteratee?: W + ): Dictionary; + + /** + * @see _.countBy + */ + countBy( + collection: List|Dictionary|NumericDictionary, + iteratee?: Object + ): Dictionary; + } + + interface LoDashImplicitWrapper { + /** + * @see _.countBy + */ + countBy( + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitObjectWrapper>; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.countBy + */ + countBy( + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitObjectWrapper>; + + /** + * @see _.countBy + */ + countBy( + iteratee?: string, + thisArg?: any + ): LoDashImplicitObjectWrapper>; + + /** + * @see _.countBy + */ + countBy( + iteratee?: W + ): LoDashImplicitObjectWrapper>; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.countBy + */ + countBy( + iteratee?: ListIterator|DictionaryIterator|NumericDictionaryIterator, + thisArg?: any + ): LoDashImplicitObjectWrapper>; + + /** + * @see _.countBy + */ + countBy( + iteratee?: string, + thisArg?: any + ): LoDashImplicitObjectWrapper>; + + /** + * @see _.countBy + */ + countBy( + iteratee?: W + ): LoDashImplicitObjectWrapper>; + } + + interface LoDashExplicitWrapper { + /** + * @see _.countBy + */ + countBy( + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitObjectWrapper>; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.countBy + */ + countBy( + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.countBy + */ + countBy( + iteratee?: string, + thisArg?: any + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.countBy + */ + countBy( + iteratee?: W + ): LoDashExplicitObjectWrapper>; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.countBy + */ + countBy( + iteratee?: ListIterator|DictionaryIterator|NumericDictionaryIterator, + thisArg?: any + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.countBy + */ + countBy( + iteratee?: string, + thisArg?: any + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.countBy + */ + countBy( + iteratee?: W + ): LoDashExplicitObjectWrapper>; + } + + //_.detect + interface LoDashStatic { + /** + * @see _.find + */ + detect( + collection: List, + predicate?: ListIterator, + thisArg?: any + ): T; + + /** + * @see _.find + */ + detect( + collection: Dictionary, + predicate?: DictionaryIterator, + thisArg?: any + ): T; + + /** + * @see _.find + */ + detect( + collection: List|Dictionary, + predicate?: string, + thisArg?: any + ): T; + + /** + * @see _.find + */ + detect( + collection: List|Dictionary, + predicate?: TObject + ): T; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.find + */ + detect( + predicate?: ListIterator, + thisArg?: any + ): T; + + /** + * @see _.find + */ + detect( + predicate?: string, + thisArg?: any + ): T; + + /** + * @see _.find + */ + detect( + predicate?: TObject + ): T; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.find + */ + detect( + predicate?: ListIterator|DictionaryIterator, + thisArg?: any + ): TResult; + + /** + * @see _.find + */ + detect( + predicate?: string, + thisArg?: any + ): TResult; + + /** + * @see _.find + */ + detect( + predicate?: TObject + ): TResult; + } + + //_.each + interface LoDashStatic { + /** + * @see _.forEach + */ + each( + collection: T[], + iteratee?: ListIterator, + thisArg?: any + ): T[]; + + /** + * @see _.forEach + */ + each( + collection: List, + iteratee?: ListIterator, + thisArg?: any + ): List; + + /** + * @see _.forEach + */ + each( + collection: Dictionary, + iteratee?: DictionaryIterator, + thisArg?: any + ): Dictionary; + + /** + * @see _.forEach + */ + each( + collection: T, + iteratee?: ObjectIterator, + thisArgs?: any + ): T; + + /** + * @see _.forEach + */ + each( + collection: T, + iteratee?: ObjectIterator, + thisArgs?: any + ): T; + } + + interface LoDashImplicitWrapper { + /** + * @see _.forEach + */ + each( + iteratee: ListIterator, + thisArg?: any + ): LoDashImplicitWrapper; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.forEach + */ + each( + iteratee: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.forEach + */ + each( + iteratee?: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.forEach + */ + each( + iteratee: ListIterator, + thisArg?: any + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.forEach + */ + each( + iteratee: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.forEach + */ + each( + iteratee?: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashExplicitObjectWrapper; + } + + //_.eachRight + interface LoDashStatic { + /** + * @see _.forEachRight + */ + eachRight( + collection: T[], + iteratee?: ListIterator, + thisArg?: any + ): T[]; + + /** + * @see _.forEachRight + */ + eachRight( + collection: List, + iteratee?: ListIterator, + thisArg?: any + ): List; + + /** + * @see _.forEachRight + */ + eachRight( + collection: Dictionary, + iteratee?: DictionaryIterator, + thisArg?: any + ): Dictionary; + + /** + * @see _.forEachRight + */ + eachRight( + collection: T, + iteratee?: ObjectIterator, + thisArgs?: any + ): T; + + /** + * @see _.forEachRight + */ + eachRight( + collection: T, + iteratee?: ObjectIterator, + thisArgs?: any + ): T; + } + + interface LoDashImplicitWrapper { + /** + * @see _.forEachRight + */ + eachRight( + iteratee: ListIterator, + thisArg?: any + ): LoDashImplicitWrapper; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.forEachRight + */ + eachRight( + iteratee: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.forEachRight + */ + eachRight( + iteratee?: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.forEachRight + */ + eachRight( + iteratee: ListIterator, + thisArg?: any + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.forEachRight + */ + eachRight( + iteratee: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.forEachRight + */ + eachRight( + iteratee?: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashExplicitObjectWrapper; + } + + //_.every + interface LoDashStatic { + /** + * Checks if predicate returns truthy for all elements of collection. The predicate is bound to thisArg and + * invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @alias _.all + * + * @param collection The collection to iterate over. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns true if all elements pass the predicate check, else false. + */ + every( + collection: List, + predicate?: ListIterator, + thisArg?: any + ): boolean; + + /** + * @see _.every + */ + every( + collection: Dictionary, + predicate?: DictionaryIterator, + thisArg?: any + ): boolean; + + /** + * @see _.every + */ + every( + collection: List|Dictionary, + predicate?: string, + thisArg?: any + ): boolean; + + /** + * @see _.every + */ + every( + collection: List|Dictionary, + predicate?: TObject + ): boolean; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.every + */ + every( + predicate?: ListIterator, + thisArg?: any + ): boolean; + + /** + * @see _.every + */ + every( + predicate?: string, + thisArg?: any + ): boolean; + + /** + * @see _.every + */ + every( + predicate?: TObject + ): boolean; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.every + */ + every( + predicate?: ListIterator|DictionaryIterator, + thisArg?: any + ): boolean; + + /** + * @see _.every + */ + every( + predicate?: string, + thisArg?: any + ): boolean; + + /** + * @see _.every + */ + every( + predicate?: TObject + ): boolean; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.every + */ + every( + predicate?: ListIterator, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.every + */ + every( + predicate?: string, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.every + */ + every( + predicate?: TObject + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.every + */ + every( + predicate?: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.every + */ + every( + predicate?: string, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.every + */ + every( + predicate?: TObject + ): LoDashExplicitWrapper; + } + + //_.filter + interface LoDashStatic { + /** + * Iterates over elements of collection, returning an array of all elements predicate returns truthy for. The + * predicate is bound to thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @alias _.select + * + * @param collection The collection to iterate over. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the new filtered array. + */ + filter( + collection: List, + predicate?: ListIterator, + thisArg?: any + ): T[]; + + /** + * @see _.filter + */ + filter( + collection: Dictionary, + predicate?: DictionaryIterator, + thisArg?: any + ): T[]; + + /** + * @see _.filter + */ + filter( + collection: string, + predicate?: StringIterator, + thisArg?: any + ): string[]; + + /** + * @see _.filter + */ + filter( + collection: List|Dictionary, + predicate: string, + thisArg?: any + ): T[]; + + /** + * @see _.filter + */ + filter( + collection: List|Dictionary, + predicate: W + ): T[]; + } + + interface LoDashImplicitWrapper { + /** + * @see _.filter + */ + filter( + predicate?: StringIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.filter + */ + filter( + predicate: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.filter + */ + filter( + predicate: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.filter + */ + filter(predicate: W): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.filter + */ + filter( + predicate: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.filter + */ + filter( + predicate: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.filter + */ + filter(predicate: W): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.filter + */ + filter( + predicate?: StringIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.filter + */ + filter( + predicate: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.filter + */ + filter( + predicate: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.filter + */ + filter(predicate: W): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.filter + */ + filter( + predicate: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.filter + */ + filter( + predicate: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.filter + */ + filter(predicate: W): LoDashExplicitArrayWrapper; + } + + //_.find + interface LoDashStatic { + /** + * Iterates over elements of collection, returning the first element predicate returns truthy for. + * The predicate is bound to thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @alias _.detect + * + * @param collection The collection to search. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the matched element, else undefined. + */ + find( + collection: List, + predicate?: ListIterator, + thisArg?: any + ): T; + + /** + * @see _.find + */ + find( + collection: Dictionary, + predicate?: DictionaryIterator, + thisArg?: any + ): T; + + /** + * @see _.find + */ + find( + collection: List|Dictionary, + predicate?: string, + thisArg?: any + ): T; + + /** + * @see _.find + */ + find( + collection: List|Dictionary, + predicate?: TObject + ): T; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.find + */ + find( + predicate?: ListIterator, + thisArg?: any + ): T; + + /** + * @see _.find + */ + find( + predicate?: string, + thisArg?: any + ): T; + + /** + * @see _.find + */ + find( + predicate?: TObject + ): T; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.find + */ + find( + predicate?: ListIterator|DictionaryIterator, + thisArg?: any + ): TResult; + + /** + * @see _.find + */ + find( + predicate?: string, + thisArg?: any + ): TResult; + + /** + * @see _.find + */ + find( + predicate?: TObject + ): TResult; + } + + //_.findWhere + interface LoDashStatic { + /** + * @see _.find + **/ + findWhere( + collection: Array, + callback: ListIterator, + thisArg?: any): T; + + /** + * @see _.find + **/ + findWhere( + collection: List, + callback: ListIterator, + thisArg?: any): T; + + /** + * @see _.find + **/ + findWhere( + collection: Dictionary, + callback: DictionaryIterator, + thisArg?: any): T; + + /** + * @see _.find + * @param _.matches style callback + **/ + findWhere( + collection: Array, + whereValue: W): T; + + /** + * @see _.find + * @param _.matches style callback + **/ + findWhere( + collection: List, + whereValue: W): T; + + /** + * @see _.find + * @param _.matches style callback + **/ + findWhere( + collection: Dictionary, + whereValue: W): T; + + /** + * @see _.find + * @param _.property style callback + **/ + findWhere( + collection: Array, + pluckValue: string): T; + + /** + * @see _.find + * @param _.property style callback + **/ + findWhere( + collection: List, + pluckValue: string): T; + + /** + * @see _.find + * @param _.property style callback + **/ + findWhere( + collection: Dictionary, + pluckValue: string): T; + } + + //_.findLast + interface LoDashStatic { + /** + * This method is like _.find except that it iterates over elements of a collection from + * right to left. + * @param collection Searches for a value in this list. + * @param callback The function called per iteration. + * @param thisArg The this binding of callback. + * @return The found element, else undefined. + **/ + findLast( + collection: Array, + callback: ListIterator, + thisArg?: any): T; + + /** + * @see _.find + **/ + findLast( + collection: List, + callback: ListIterator, + thisArg?: any): T; + + /** + * @see _.find + **/ + findLast( + collection: Dictionary, + callback: DictionaryIterator, + thisArg?: any): T; + + /** + * @see _.find + * @param _.pluck style callback + **/ + findLast( + collection: Array, + whereValue: W): T; + + /** + * @see _.find + * @param _.pluck style callback + **/ + findLast( + collection: List, + whereValue: W): T; + + /** + * @see _.find + * @param _.pluck style callback + **/ + findLast( + collection: Dictionary, + whereValue: W): T; + + /** + * @see _.find + * @param _.where style callback + **/ + findLast( + collection: Array, + pluckValue: string): T; + + /** + * @see _.find + * @param _.where style callback + **/ + findLast( + collection: List, + pluckValue: string): T; + + /** + * @see _.find + * @param _.where style callback + **/ + findLast( + collection: Dictionary, + pluckValue: string): T; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.findLast + */ + findLast( + callback: ListIterator, + thisArg?: any): T; + /** + * @see _.findLast + * @param _.where style callback + */ + findLast( + whereValue: W): T; + + /** + * @see _.findLast + * @param _.where style callback + */ + findLast( + pluckValue: string): T; + } + + //_.forEach + interface LoDashStatic { + /** + * Iterates over elements of collection invoking iteratee for each element. The iteratee is bound to thisArg + * and invoked with three arguments: + * (value, index|key, collection). Iteratee functions may exit iteration early by explicitly returning false. + * + * Note: As with other "Collections" methods, objects with a "length" property are iterated like arrays. To + * avoid this behavior _.forIn or _.forOwn may be used for object iteration. + * + * @alias _.each + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + */ + forEach( + collection: T[], + iteratee?: ListIterator, + thisArg?: any + ): T[]; + + /** + * @see _.forEach + */ + forEach( + collection: List, + iteratee?: ListIterator, + thisArg?: any + ): List; + + /** + * @see _.forEach + */ + forEach( + collection: Dictionary, + iteratee?: DictionaryIterator, + thisArg?: any + ): Dictionary; + + /** + * @see _.forEach + */ + forEach( + collection: T, + iteratee?: ObjectIterator, + thisArgs?: any + ): T; + + /** + * @see _.forEach + */ + forEach( + collection: T, + iteratee?: ObjectIterator, + thisArgs?: any + ): T; + } + + interface LoDashImplicitWrapper { + /** + * @see _.forEach + */ + forEach( + iteratee: ListIterator, + thisArg?: any + ): LoDashImplicitWrapper; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.forEach + */ + forEach( + iteratee: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.forEach + */ + forEach( + iteratee?: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.forEach + */ + forEach( + iteratee: ListIterator, + thisArg?: any + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.forEach + */ + forEach( + iteratee: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.forEach + */ + forEach( + iteratee?: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashExplicitObjectWrapper; + } + + //_.forEachRight + interface LoDashStatic { + /** + * This method is like _.forEach except that it iterates over elements of collection from right to left. + * + * @alias _.eachRight + * + * @param collection The collection to iterate over. + * @param iteratee The function called per iteration. + * @param thisArg The this binding of callback. + */ + forEachRight( + collection: T[], + iteratee?: ListIterator, + thisArg?: any + ): T[]; + + /** + * @see _.forEachRight + */ + forEachRight( + collection: List, + iteratee?: ListIterator, + thisArg?: any + ): List; + + /** + * @see _.forEachRight + */ + forEachRight( + collection: Dictionary, + iteratee?: DictionaryIterator, + thisArg?: any + ): Dictionary; + + /** + * @see _.forEachRight + */ + forEachRight( + collection: T, + iteratee?: ObjectIterator, + thisArgs?: any + ): T; + + /** + * @see _.forEachRight + */ + forEachRight( + collection: T, + iteratee?: ObjectIterator, + thisArgs?: any + ): T; + } + + interface LoDashImplicitWrapper { + /** + * @see _.forEachRight + */ + forEachRight( + iteratee: ListIterator, + thisArg?: any + ): LoDashImplicitWrapper; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.forEachRight + */ + forEachRight( + iteratee: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.forEachRight + */ + forEachRight( + iteratee?: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.forEachRight + */ + forEachRight( + iteratee: ListIterator, + thisArg?: any + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.forEachRight + */ + forEachRight( + iteratee: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.forEachRight + */ + forEachRight( + iteratee?: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashExplicitObjectWrapper; + } + + //_.groupBy + interface LoDashStatic { + /** + * Creates an object composed of keys generated from the results of running each element of collection through + * iteratee. The corresponding value of each key is an array of the elements responsible for generating the + * key. The iteratee is bound to thisArg and invoked with three arguments: + * (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the composed aggregate object. + */ + groupBy( + collection: List, + iteratee?: ListIterator, + thisArg?: any + ): Dictionary; + + /** + * @see _.groupBy + */ + groupBy( + collection: List, + iteratee?: ListIterator, + thisArg?: any + ): Dictionary; + + /** + * @see _.groupBy + */ + groupBy( + collection: Dictionary, + iteratee?: DictionaryIterator, + thisArg?: any + ): Dictionary; + + /** + * @see _.groupBy + */ + groupBy( + collection: Dictionary, + iteratee?: DictionaryIterator, + thisArg?: any + ): Dictionary; + + /** + * @see _.groupBy + */ + groupBy( + collection: List|Dictionary, + iteratee?: string, + thisArg?: TValue + ): Dictionary; + + /** + * @see _.groupBy + */ + groupBy( + collection: List|Dictionary, + iteratee?: string, + thisArg?: any + ): Dictionary; + + /** + * @see _.groupBy + */ + groupBy( + collection: List|Dictionary, + iteratee?: TWhere + ): Dictionary; + + /** + * @see _.groupBy + */ + groupBy( + collection: List|Dictionary, + iteratee?: Object + ): Dictionary; + } + + interface LoDashImplicitWrapper { + /** + * @see _.groupBy + */ + groupBy( + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitObjectWrapper>; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.groupBy + */ + groupBy( + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitObjectWrapper>; + + /** + * @see _.groupBy + */ + groupBy( + iteratee?: string, + thisArg?: TValue + ): LoDashImplicitObjectWrapper>; + + /** + * @see _.groupBy + */ + groupBy( + iteratee?: TWhere + ): LoDashImplicitObjectWrapper>; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.groupBy + */ + groupBy( + iteratee?: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashImplicitObjectWrapper>; + + /** + * @see _.groupBy + */ + groupBy( + iteratee?: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashImplicitObjectWrapper>; + + /** + * @see _.groupBy + */ + groupBy( + iteratee?: string, + thisArg?: TValue + ): LoDashImplicitObjectWrapper>; + + /** + * @see _.groupBy + */ + groupBy( + iteratee?: string, + thisArg?: any + ): LoDashImplicitObjectWrapper>; + + /** + * @see _.groupBy + */ + groupBy( + iteratee?: TWhere + ): LoDashImplicitObjectWrapper>; + + /** + * @see _.groupBy + */ + groupBy( + iteratee?: Object + ): LoDashImplicitObjectWrapper>; + } + + interface LoDashExplicitWrapper { + /** + * @see _.groupBy + */ + groupBy( + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitObjectWrapper>; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.groupBy + */ + groupBy( + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.groupBy + */ + groupBy( + iteratee?: string, + thisArg?: TValue + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.groupBy + */ + groupBy( + iteratee?: TWhere + ): LoDashExplicitObjectWrapper>; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.groupBy + */ + groupBy( + iteratee?: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.groupBy + */ + groupBy( + iteratee?: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.groupBy + */ + groupBy( + iteratee?: string, + thisArg?: TValue + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.groupBy + */ + groupBy( + iteratee?: string, + thisArg?: any + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.groupBy + */ + groupBy( + iteratee?: TWhere + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.groupBy + */ + groupBy( + iteratee?: Object + ): LoDashExplicitObjectWrapper>; + } + + //_.include + interface LoDashStatic { + /** + * @see _.includes + */ + include( + collection: List|Dictionary, + target: T, + fromIndex?: number + ): boolean; + + /** + * @see _.includes + */ + include( + collection: string, + target: string, + fromIndex?: number + ): boolean; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.includes + */ + include( + target: T, + fromIndex?: number + ): boolean; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.includes + */ + include( + target: TValue, + fromIndex?: number + ): boolean; + } + + interface LoDashImplicitWrapper { + /** + * @see _.includes + */ + include( + target: string, + fromIndex?: number + ): boolean; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.includes + */ + include( + target: T, + fromIndex?: number + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.includes + */ + include( + target: TValue, + fromIndex?: number + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.includes + */ + include( + target: string, + fromIndex?: number + ): LoDashExplicitWrapper; + } + + //_.includes + interface LoDashStatic { + /** + * Checks if target is in collection using SameValueZero for equality comparisons. If fromIndex is negative, + * it’s used as the offset from the end of collection. + * + * @alias _.contains, _.include + * + * @param collection The collection to search. + * @param target The value to search for. + * @param fromIndex The index to search from. + * @return True if the target element is found, else false. + */ + includes( + collection: List|Dictionary, + target: T, + fromIndex?: number + ): boolean; + + /** + * @see _.includes + */ + includes( + collection: string, + target: string, + fromIndex?: number + ): boolean; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.includes + */ + includes( + target: T, + fromIndex?: number + ): boolean; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.includes + */ + includes( + target: TValue, + fromIndex?: number + ): boolean; + } + + interface LoDashImplicitWrapper { + /** + * @see _.includes + */ + includes( + target: string, + fromIndex?: number + ): boolean; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.includes + */ + includes( + target: T, + fromIndex?: number + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.includes + */ + includes( + target: TValue, + fromIndex?: number + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.includes + */ + includes( + target: string, + fromIndex?: number + ): LoDashExplicitWrapper; + } + + //_.indexBy + interface LoDashStatic { + /** + * Creates an object composed of keys generated from the results of running each element of collection through + * iteratee. The corresponding value of each key is the last element responsible for generating the key. The + * iteratee function is bound to thisArg and invoked with three arguments: + * (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the composed aggregate object. + */ + indexBy( + collection: List, + iteratee?: ListIterator, + thisArg?: any + ): Dictionary; + + /** + * @see _.indexBy + */ + indexBy( + collection: NumericDictionary, + iteratee?: NumericDictionaryIterator, + thisArg?: any + ): Dictionary; + + /** + * @see _.indexBy + */ + indexBy( + collection: Dictionary, + iteratee?: DictionaryIterator, + thisArg?: any + ): Dictionary; + + /** + * @see _.indexBy + */ + indexBy( + collection: List|NumericDictionary|Dictionary, + iteratee?: string, + thisArg?: any + ): Dictionary; + + /** + * @see _.indexBy + */ + indexBy( + collection: List|NumericDictionary|Dictionary, + iteratee?: W + ): Dictionary; + + /** + * @see _.indexBy + */ + indexBy( + collection: List|NumericDictionary|Dictionary, + iteratee?: Object + ): Dictionary; + } + + interface LoDashImplicitWrapper { + /** + * @see _.indexBy + */ + indexBy( + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitObjectWrapper>; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.indexBy + */ + indexBy( + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitObjectWrapper>; + + /** + * @see _.indexBy + */ + indexBy( + iteratee?: string, + thisArg?: any + ): LoDashImplicitObjectWrapper>; + + /** + * @see _.indexBy + */ + indexBy( + iteratee?: W + ): LoDashImplicitObjectWrapper>; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.indexBy + */ + indexBy( + iteratee?: ListIterator|NumericDictionaryIterator|DictionaryIterator, + thisArg?: any + ): LoDashImplicitObjectWrapper>; + + /** + * @see _.indexBy + */ + indexBy( + iteratee?: string, + thisArg?: any + ): LoDashImplicitObjectWrapper>; + + /** + * @see _.indexBy + */ + indexBy( + iteratee?: W + ): LoDashImplicitObjectWrapper>; + + /** + * @see _.indexBy + */ + indexBy( + iteratee?: Object + ): LoDashImplicitObjectWrapper>; + } + + interface LoDashExplicitWrapper { + /** + * @see _.indexBy + */ + indexBy( + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitObjectWrapper>; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.indexBy + */ + indexBy( + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.indexBy + */ + indexBy( + iteratee?: string, + thisArg?: any + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.indexBy + */ + indexBy( + iteratee?: W + ): LoDashExplicitObjectWrapper>; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.indexBy + */ + indexBy( + iteratee?: ListIterator|NumericDictionaryIterator|DictionaryIterator, + thisArg?: any + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.indexBy + */ + indexBy( + iteratee?: string, + thisArg?: any + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.indexBy + */ + indexBy( + iteratee?: W + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.indexBy + */ + indexBy( + iteratee?: Object + ): LoDashExplicitObjectWrapper>; + } + + //_.invoke + interface LoDashStatic { + /** + * Invokes the method named by methodName on each element in the collection returning + * an array of the results of each invoked method. Additional arguments will be provided + * to each invoked method. If methodName is a function it will be invoked for, and this + * bound to, each element in the collection. + * @param collection The collection to iterate over. + * @param methodName The name of the method to invoke. + * @param args Arguments to invoke the method with. + **/ + invoke( + collection: Array, + methodName: string, + ...args: any[]): any; + + /** + * @see _.invoke + **/ + invoke( + collection: List, + methodName: string, + ...args: any[]): any; + + /** + * @see _.invoke + **/ + invoke( + collection: Dictionary, + methodName: string, + ...args: any[]): any; + + /** + * @see _.invoke + **/ + invoke( + collection: Array, + method: Function, + ...args: any[]): any; + + /** + * @see _.invoke + **/ + invoke( + collection: List, + method: Function, + ...args: any[]): any; + + /** + * @see _.invoke + **/ + invoke( + collection: Dictionary, + method: Function, + ...args: any[]): any; + } + + //_.map + interface LoDashStatic { + /** + * Creates an array of values by running each element in collection through iteratee. The iteratee is bound to + * thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property value + * of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * Many lodash methods are guarded to work as iteratees for methods like _.every, _.filter, _.map, _.mapValues, + * _.reject, and _.some. + * + * The guarded methods are: + * ary, callback, chunk, clone, create, curry, curryRight, drop, dropRight, every, fill, flatten, invert, max, + * min, parseInt, slice, sortBy, take, takeRight, template, trim, trimLeft, trimRight, trunc, random, range, + * sample, some, sum, uniq, and words + * + * @alias _.collect + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the new mapped array. + */ + map( + collection: List, + iteratee?: ListIterator, + thisArg?: any + ): TResult[]; + + /** + * @see _.map + */ + map( + collection: Dictionary, + iteratee?: DictionaryIterator, + thisArg?: any + ): TResult[]; + + /** + * @see _.map + */ + map( + collection: List|Dictionary, + iteratee?: string + ): TResult[]; + + /** + * @see _.map + */ + map( + collection: List|Dictionary, + iteratee?: TObject + ): boolean[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.map + */ + map( + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.map + */ + map( + iteratee?: string + ): LoDashImplicitArrayWrapper; + + /** + * @see _.map + */ + map( + iteratee?: TObject + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.map + */ + map( + iteratee?: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.map + */ + map( + iteratee?: string + ): LoDashImplicitArrayWrapper; + + /** + * @see _.map + */ + map( + iteratee?: TObject + ): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.map + */ + map( + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.map + */ + map( + iteratee?: string + ): LoDashExplicitArrayWrapper; + + /** + * @see _.map + */ + map( + iteratee?: TObject + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.map + */ + map( + iteratee?: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.map + */ + map( + iteratee?: string + ): LoDashExplicitArrayWrapper; + + /** + * @see _.map + */ + map( + iteratee?: TObject + ): LoDashExplicitArrayWrapper; + } + + //_.partition + interface LoDashStatic { + /** + * Creates an array of elements split into two groups, the first of which contains elements predicate returns truthy for, + * while the second of which contains elements predicate returns falsey for. + * The predicate is bound to thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for predicate the created _.property style callback + * returns the property value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback + * returns true for elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns + * true for elements that have the properties of the given object, else false. + * + * @param collection The collection to iterate over. + * @param callback The function called per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the array of grouped elements. + **/ + partition( + collection: List, + callback: ListIterator, + thisArg?: any): T[][]; + + /** + * @see _.partition + **/ + partition( + collection: Dictionary, + callback: DictionaryIterator, + thisArg?: any): T[][]; + + /** + * @see _.partition + **/ + partition( + collection: List, + whereValue: W): T[][]; + + /** + * @see _.partition + **/ + partition( + collection: Dictionary, + whereValue: W): T[][]; + + /** + * @see _.partition + **/ + partition( + collection: List, + path: string, + srcValue: any): T[][]; + + /** + * @see _.partition + **/ + partition( + collection: Dictionary, + path: string, + srcValue: any): T[][]; + + /** + * @see _.partition + **/ + partition( + collection: List, + pluckValue: string): T[][]; + + /** + * @see _.partition + **/ + partition( + collection: Dictionary, + pluckValue: string): T[][]; + } + + interface LoDashImplicitStringWrapper { + /** + * @see _.partition + */ + partition( + callback: ListIterator, + thisArg?: any): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.partition + */ + partition( + callback: ListIterator, + thisArg?: any): LoDashImplicitArrayWrapper; + /** + * @see _.partition + */ + partition( + whereValue: W): LoDashImplicitArrayWrapper; + /** + * @see _.partition + */ + partition( + path: string, + srcValue: any): LoDashImplicitArrayWrapper; + /** + * @see _.partition + */ + partition( + pluckValue: string): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.partition + */ + partition( + callback: ListIterator, + thisArg?: any): LoDashImplicitArrayWrapper; + + /** + * @see _.partition + */ + partition( + callback: DictionaryIterator, + thisArg?: any): LoDashImplicitArrayWrapper; + + /** + * @see _.partition + */ + partition( + whereValue: W): LoDashImplicitArrayWrapper; + + /** + * @see _.partition + */ + partition( + path: string, + srcValue: any): LoDashImplicitArrayWrapper; + + /** + * @see _.partition + */ + partition( + pluckValue: string): LoDashImplicitArrayWrapper; + } + + //_.pluck + interface LoDashStatic { + /** + * Gets the property value of path from all elements in collection. + * + * @param collection The collection to iterate over. + * @param path The path of the property to pluck. + * @return A new array of property values. + */ + pluck( + collection: List|Dictionary, + path: StringRepresentable|StringRepresentable[] + ): any[]; + + /** + * @see _.pluck + */ + pluck( + collection: List|Dictionary, + path: StringRepresentable|StringRepresentable[] + ): TResult[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.pluck + */ + pluck(path: StringRepresentable|StringRepresentable[]): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.pluck + */ + pluck(path: StringRepresentable|StringRepresentable[]): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.pluck + */ + pluck(path: StringRepresentable|StringRepresentable[]): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.pluck + */ + pluck(path: StringRepresentable|StringRepresentable[]): LoDashExplicitArrayWrapper; + } + + //_.reduce + interface LoDashStatic { + /** + * Reduces a collection to a value which is the accumulated result of running each + * element in the collection through the callback, where each successive callback execution + * consumes the return value of the previous execution. If accumulator is not provided the + * first element of the collection will be used as the initial accumulator value. The callback + * is bound to thisArg and invoked with four arguments; (accumulator, value, index|key, collection). + * @param collection The collection to iterate over. + * @param callback The function called per iteration. + * @param accumulator Initial value of the accumulator. + * @param thisArg The this binding of callback. + * @return Returns the accumulated value. + **/ + reduce( + collection: Array, + callback: MemoIterator, + accumulator: TResult, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + reduce( + collection: List, + callback: MemoIterator, + accumulator: TResult, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + reduce( + collection: Dictionary, + callback: MemoIterator, + accumulator: TResult, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + reduce( + collection: Array, + callback: MemoIterator, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + reduce( + collection: List, + callback: MemoIterator, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + reduce( + collection: Dictionary, + callback: MemoIterator, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + inject( + collection: Array, + callback: MemoIterator, + accumulator: TResult, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + inject( + collection: List, + callback: MemoIterator, + accumulator: TResult, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + inject( + collection: Dictionary, + callback: MemoIterator, + accumulator: TResult, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + inject( + collection: Array, + callback: MemoIterator, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + inject( + collection: List, + callback: MemoIterator, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + inject( + collection: Dictionary, + callback: MemoIterator, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + foldl( + collection: Array, + callback: MemoIterator, + accumulator: TResult, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + foldl( + collection: List, + callback: MemoIterator, + accumulator: TResult, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + foldl( + collection: Dictionary, + callback: MemoIterator, + accumulator: TResult, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + foldl( + collection: Array, + callback: MemoIterator, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + foldl( + collection: List, + callback: MemoIterator, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + foldl( + collection: Dictionary, + callback: MemoIterator, + thisArg?: any): TResult; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.reduce + **/ + reduce( + callback: MemoIterator, + accumulator: TResult, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + reduce( + callback: MemoIterator, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + inject( + callback: MemoIterator, + accumulator: TResult, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + inject( + callback: MemoIterator, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + foldl( + callback: MemoIterator, + accumulator: TResult, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + foldl( + callback: MemoIterator, + thisArg?: any): TResult; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.reduce + **/ + reduce( + callback: MemoIterator, + accumulator: TResult, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + reduce( + callback: MemoIterator, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + inject( + callback: MemoIterator, + accumulator: TResult, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + inject( + callback: MemoIterator, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + foldl( + callback: MemoIterator, + accumulator: TResult, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + foldl( + callback: MemoIterator, + thisArg?: any): TResult; + } + + //_.reduceRight + interface LoDashStatic { + /** + * This method is like _.reduce except that it iterates over elements of a collection from + * right to left. + * @param collection The collection to iterate over. + * @param callback The function called per iteration. + * @param accumulator Initial value of the accumulator. + * @param thisArg The this binding of callback. + * @return The accumulated value. + **/ + reduceRight( + collection: Array, + callback: MemoIterator, + accumulator: TResult, + thisArg?: any): TResult; + + /** + * @see _.reduceRight + **/ + reduceRight( + collection: List, + callback: MemoIterator, + accumulator: TResult, + thisArg?: any): TResult; + + /** + * @see _.reduceRight + **/ + reduceRight( + collection: Dictionary, + callback: MemoIterator, + accumulator: TResult, + thisArg?: any): TResult; + + /** + * @see _.reduceRight + **/ + reduceRight( + collection: Array, + callback: MemoIterator, + thisArg?: any): TResult; + + /** + * @see _.reduceRight + **/ + reduceRight( + collection: List, + callback: MemoIterator, + thisArg?: any): TResult; + + /** + * @see _.reduceRight + **/ + reduceRight( + collection: Dictionary, + callback: MemoIterator, + thisArg?: any): TResult; + + /** + * @see _.reduceRight + **/ + foldr( + collection: Array, + callback: MemoIterator, + accumulator: TResult, + thisArg?: any): TResult; + + /** + * @see _.reduceRight + **/ + foldr( + collection: List, + callback: MemoIterator, + accumulator: TResult, + thisArg?: any): TResult; + + /** + * @see _.reduceRight + **/ + foldr( + collection: Dictionary, + callback: MemoIterator, + accumulator: TResult, + thisArg?: any): TResult; + + /** + * @see _.reduceRight + **/ + foldr( + collection: Array, + callback: MemoIterator, + thisArg?: any): TResult; + + /** + * @see _.reduceRight + **/ + foldr( + collection: List, + callback: MemoIterator, + thisArg?: any): TResult; + + /** + * @see _.reduceRight + **/ + foldr( + collection: Dictionary, + callback: MemoIterator, + thisArg?: any): TResult; + } + + //_.reject + interface LoDashStatic { + /** + * The opposite of _.filter; this method returns the elements of collection that predicate does not return + * truthy for. + * + * @param collection The collection to iterate over. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the new filtered array. + */ + reject( + collection: List, + predicate?: ListIterator, + thisArg?: any + ): T[]; + + /** + * @see _.reject + */ + reject( + collection: Dictionary, + predicate?: DictionaryIterator, + thisArg?: any + ): T[]; + + /** + * @see _.reject + */ + reject( + collection: string, + predicate?: StringIterator, + thisArg?: any + ): string[]; + + /** + * @see _.reject + */ + reject( + collection: List|Dictionary, + predicate: string, + thisArg?: any + ): T[]; + + /** + * @see _.reject + */ + reject( + collection: List|Dictionary, + predicate: W + ): T[]; + } + + interface LoDashImplicitWrapper { + /** + * @see _.reject + */ + reject( + predicate?: StringIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.reject + */ + reject( + predicate: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.reject + */ + reject( + predicate: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.reject + */ + reject(predicate: W): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.reject + */ + reject( + predicate: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.reject + */ + reject( + predicate: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.reject + */ + reject(predicate: W): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.reject + */ + reject( + predicate?: StringIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.reject + */ + reject( + predicate: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.reject + */ + reject( + predicate: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.reject + */ + reject(predicate: W): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.reject + */ + reject( + predicate: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.reject + */ + reject( + predicate: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.reject + */ + reject(predicate: W): LoDashExplicitArrayWrapper; + } + + //_.sample + interface LoDashStatic { + /** + * Retrieves a random element or n random elements from a collection. + * @param collection The collection to sample. + * @return Returns the random sample(s) of collection. + **/ + sample(collection: Array): T; + + /** + * @see _.sample + **/ + sample(collection: List): T; + + /** + * @see _.sample + **/ + sample(collection: Dictionary): T; + + /** + * @see _.sample + * @param n The number of elements to sample. + **/ + sample(collection: Array, n: number): T[]; + + /** + * @see _.sample + * @param n The number of elements to sample. + **/ + sample(collection: List, n: number): T[]; + + /** + * @see _.sample + * @param n The number of elements to sample. + **/ + sample(collection: Dictionary, n: number): T[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.sample + **/ + sample(n: number): LoDashImplicitArrayWrapper; + + /** + * @see _.sample + **/ + sample(): LoDashImplicitWrapper; + } + + //_.select + interface LoDashStatic { + /** + * @see _.filter + */ + select( + collection: List, + predicate?: ListIterator, + thisArg?: any + ): T[]; + + /** + * @see _.filter + */ + select( + collection: Dictionary, + predicate?: DictionaryIterator, + thisArg?: any + ): T[]; + + /** + * @see _.filter + */ + select( + collection: string, + predicate?: StringIterator, + thisArg?: any + ): string[]; + + /** + * @see _.filter + */ + select( + collection: List|Dictionary, + predicate: string, + thisArg?: any + ): T[]; + + /** + * @see _.filter + */ + select( + collection: List|Dictionary, + predicate: W + ): T[]; + } + + interface LoDashImplicitWrapper { + /** + * @see _.filter + */ + select( + predicate?: StringIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.filter + */ + select( + predicate: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.filter + */ + select( + predicate: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.filter + */ + select(predicate: W): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.filter + */ + select( + predicate: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.filter + */ + select( + predicate: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.filter + */ + select(predicate: W): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.filter + */ + select( + predicate?: StringIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.filter + */ + select( + predicate: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.filter + */ + select( + predicate: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.filter + */ + select(predicate: W): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.filter + */ + select( + predicate: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.filter + */ + select( + predicate: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.filter + */ + select(predicate: W): LoDashExplicitArrayWrapper; + } + + //_.shuffle + interface LoDashStatic { + /** + * Creates an array of shuffled values, using a version of the Fisher-Yates shuffle. + * + * @param collection The collection to shuffle. + * @return Returns the new shuffled array. + */ + shuffle(collection: List|Dictionary): T[]; + + /** + * @see _.shuffle + */ + shuffle(collection: string): string[]; + } + + interface LoDashImplicitWrapper { + /** + * @see _.shuffle + */ + shuffle(): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.shuffle + */ + shuffle(): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.shuffle + */ + shuffle(): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.shuffle + */ + shuffle(): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.shuffle + */ + shuffle(): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.shuffle + */ + shuffle(): LoDashExplicitArrayWrapper; + } + + //_.size + interface LoDashStatic { + /** + * Gets the size of collection by returning its length for array-like values or the number of own enumerable + * properties for objects. + * + * @param collection The collection to inspect. + * @return Returns the size of collection. + */ + size(collection: List|Dictionary): number; + + /** + * @see _.size + */ + size(collection: string): number; + } + + interface LoDashImplicitWrapper { + /** + * @see _.size + */ + size(): number; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.size + */ + size(): number; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.size + */ + size(): number; + } + + interface LoDashExplicitWrapper { + /** + * @see _.size + */ + size(): LoDashExplicitWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.size + */ + size(): LoDashExplicitWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.size + */ + size(): LoDashExplicitWrapper; + } + + //_.some + interface LoDashStatic { + /** + * Checks if predicate returns truthy for any element of collection. The function returns as soon as it finds + * a passing value and does not iterate over the entire collection. The predicate is bound to thisArg and + * invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @alias _.any + * + * @param collection The collection to iterate over. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns true if any element passes the predicate check, else false. + */ + some( + collection: List, + predicate?: ListIterator, + thisArg?: any + ): boolean; + + /** + * @see _.some + */ + some( + collection: Dictionary, + predicate?: DictionaryIterator, + thisArg?: any + ): boolean; + + /** + * @see _.some + */ + some( + collection: NumericDictionary, + predicate?: NumericDictionaryIterator, + thisArg?: any + ): boolean; + + /** + * @see _.some + */ + some( + collection: List|Dictionary|NumericDictionary, + predicate?: string, + thisArg?: any + ): boolean; + + /** + * @see _.some + */ + some( + collection: List|Dictionary|NumericDictionary, + predicate?: TObject + ): boolean; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.some + */ + some( + predicate?: ListIterator|NumericDictionaryIterator, + thisArg?: any + ): boolean; + + /** + * @see _.some + */ + some( + predicate?: string, + thisArg?: any + ): boolean; + + /** + * @see _.some + */ + some( + predicate?: TObject + ): boolean; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.some + */ + some( + predicate?: ListIterator|DictionaryIterator|NumericDictionaryIterator, + thisArg?: any + ): boolean; + + /** + * @see _.some + */ + some( + predicate?: string, + thisArg?: any + ): boolean; + + /** + * @see _.some + */ + some( + predicate?: TObject + ): boolean; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.some + */ + some( + predicate?: ListIterator|NumericDictionaryIterator, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.some + */ + some( + predicate?: string, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.some + */ + some( + predicate?: TObject + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.some + */ + some( + predicate?: ListIterator|DictionaryIterator|NumericDictionaryIterator, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.some + */ + some( + predicate?: string, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.some + */ + some( + predicate?: TObject + ): LoDashExplicitWrapper; + } + + //_.sortBy + interface LoDashStatic { + /** + * Creates an array of elements, sorted in ascending order by the results of running each element in a + * collection through iteratee. This method performs a stable sort, that is, it preserves the original sort + * order of equal elements. The iteratee is bound to thisArg and invoked with three arguments: + * (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property + * valueof the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the new sorted array. + */ + sortBy( + collection: List, + iteratee?: ListIterator, + thisArg?: any + ): T[]; + + /** + * @see _.sortBy + */ + sortBy( + collection: Dictionary, + iteratee?: DictionaryIterator, + thisArg?: any + ): T[]; + + /** + * @see _.sortBy + */ + sortBy( + collection: List|Dictionary, + iteratee: string + ): T[]; + + /** + * @see _.sortBy + */ + sortBy( + collection: List|Dictionary, + whereValue: W + ): T[]; + + /** + * @see _.sortBy + */ + sortBy( + collection: List|Dictionary + ): T[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.sortBy + */ + sortBy( + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.sortBy + */ + sortBy(iteratee: string): LoDashImplicitArrayWrapper; + + /** + * @see _.sortBy + */ + sortBy(whereValue: W): LoDashImplicitArrayWrapper; + + /** + * @see _.sortBy + */ + sortBy(): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.sortBy + */ + sortBy( + iteratee?: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.sortBy + */ + sortBy(iteratee: string): LoDashImplicitArrayWrapper; + + /** + * @see _.sortBy + */ + sortBy(whereValue: W): LoDashImplicitArrayWrapper; + + /** + * @see _.sortBy + */ + sortBy(): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.sortBy + */ + sortBy( + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.sortBy + */ + sortBy(iteratee: string): LoDashExplicitArrayWrapper; + + /** + * @see _.sortBy + */ + sortBy(whereValue: W): LoDashExplicitArrayWrapper; + + /** + * @see _.sortBy + */ + sortBy(): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.sortBy + */ + sortBy( + iteratee?: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.sortBy + */ + sortBy(iteratee: string): LoDashExplicitArrayWrapper; + + /** + * @see _.sortBy + */ + sortBy(whereValue: W): LoDashExplicitArrayWrapper; + + /** + * @see _.sortBy + */ + sortBy(): LoDashExplicitArrayWrapper; + } + + //_.sortByAll + interface LoDashStatic { + /** + * This method is like "_.sortBy" except that it can sort by multiple iteratees or + * property names. + * + * If a property name is provided for an iteratee the created "_.property" style callback + * returns the property value of the given element. + * + * If a value is also provided for thisArg the created "_.matchesProperty" style callback + * returns true for elements that have a matching property value, else false. + * + * If an object is provided for an iteratee the created "_.matches" style callback returns + * true for elements that have the properties of the given object, else false. + * + * @param collection The collection to iterate over. + * @param callback The function called per iteration. + * @param thisArg The this binding of callback. + * @return A new array of sorted elements. + **/ + sortByAll( + collection: Array, + iteratees: (ListIterator|string|Object)[]): T[]; + + /** + * @see _.sortByAll + **/ + sortByAll( + collection: List, + iteratees: (ListIterator|string|Object)[]): T[]; + + /** + * @see _.sortByAll + **/ + sortByAll( + collection: Array, + ...iteratees: (ListIterator|string|Object)[]): T[]; + + /** + * @see _.sortByAll + **/ + sortByAll( + collection: List, + ...iteratees: (ListIterator|string|Object)[]): T[]; + + /** + * Sorts by all the given arguments, using either ListIterator, pluckValue, or whereValue foramts + * @param args The rules by which to sort + */ + sortByAll( + collection: (Array|List), + ...args: (ListIterator|Object|string)[] + ): T[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * Sorts by all the given arguments, using either ListIterator, pluckValue, or whereValue foramts + * @param args The rules by which to sort + */ + sortByAll(...args: (ListIterator|Object|string)[]): LoDashImplicitArrayWrapper; + + /** + * @see _.sortByAll + **/ + sortByAll( + iteratees: (ListIterator|string|Object)[]): LoDashImplicitArrayWrapper; + + /** + * @see _.sortByAll + **/ + sortByAll( + ...iteratees: (ListIterator|string|Object)[]): LoDashImplicitArrayWrapper; + } + + //_.sortByOrder + interface LoDashStatic { + /** + * This method is like _.sortByAll except that it allows specifying the sort orders of the iteratees to sort + * by. If orders is unspecified, all values are sorted in ascending order. Otherwise, a value is sorted in + * ascending order if its corresponding order is "asc", and descending if "desc". + * + * If a property name is provided for an iteratee the created _.property style callback returns the property + * value of the given element. + * + * If an object is provided for an iteratee the created _.matches style callback returns true for elements + * that have the properties of the given object, else false. + * + * @param collection The collection to iterate over. + * @param iteratees The iteratees to sort by. + * @param orders The sort orders of iteratees. + * @return Returns the new sorted array. + */ + sortByOrder( + collection: List, + iteratees: ListIterator|string|W|(ListIterator|string|W)[], + orders?: boolean|string|(boolean|string)[] + ): T[]; + + /** + * @see _.sortByOrder + */ + sortByOrder( + collection: List, + iteratees: ListIterator|string|Object|(ListIterator|string|Object)[], + orders?: boolean|string|(boolean|string)[] + ): T[]; + + /** + * @see _.sortByOrder + */ + sortByOrder( + collection: NumericDictionary, + iteratees: NumericDictionaryIterator|string|W|(NumericDictionaryIterator|string|W)[], + orders?: boolean|string|(boolean|string)[] + ): T[]; + + /** + * @see _.sortByOrder + */ + sortByOrder( + collection: NumericDictionary, + iteratees: NumericDictionaryIterator|string|Object|(NumericDictionaryIterator|string|Object)[], + orders?: boolean|string|(boolean|string)[] + ): T[]; + + /** + * @see _.sortByOrder + */ + sortByOrder( + collection: Dictionary, + iteratees: DictionaryIterator|string|W|(DictionaryIterator|string|W)[], + orders?: boolean|string|(boolean|string)[] + ): T[]; + + /** + * @see _.sortByOrder + */ + sortByOrder( + collection: Dictionary, + iteratees: DictionaryIterator|string|Object|(DictionaryIterator|string|Object)[], + orders?: boolean|string|(boolean|string)[] + ): T[]; + } + + interface LoDashImplicitWrapper { + /** + * @see _.sortByOrder + */ + sortByOrder( + iteratees: ListIterator|string|(ListIterator|string)[], + orders?: boolean|string|(boolean|string)[] + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.sortByOrder + */ + sortByOrder( + iteratees: ListIterator|string|W|(ListIterator|string|W)[], + orders?: boolean|string|(boolean|string)[] + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.sortByOrder + */ + sortByOrder( + iteratees: ListIterator|string|W|(ListIterator|string|W)[], + orders?: boolean|string|(boolean|string)[] + ): LoDashImplicitArrayWrapper; + + /** + * @see _.sortByOrder + */ + sortByOrder( + iteratees: ListIterator|string|Object|(ListIterator|string|Object)[], + orders?: boolean|string|(boolean|string)[] + ): LoDashImplicitArrayWrapper; + + /** + * @see _.sortByOrder + */ + sortByOrder( + iteratees: NumericDictionaryIterator|string|W|(NumericDictionaryIterator|string|W)[], + orders?: boolean|string|(boolean|string)[] + ): LoDashImplicitArrayWrapper; + + /** + * @see _.sortByOrder + */ + sortByOrder( + iteratees: NumericDictionaryIterator|string|Object|(NumericDictionaryIterator|string|Object)[], + orders?: boolean|string|(boolean|string)[] + ): LoDashImplicitArrayWrapper; + + /** + * @see _.sortByOrder + */ + sortByOrder( + iteratees: DictionaryIterator|string|W|(DictionaryIterator|string|W)[], + orders?: boolean|string|(boolean|string)[] + ): LoDashImplicitArrayWrapper; + + /** + * @see _.sortByOrder + */ + sortByOrder( + iteratees: DictionaryIterator|string|Object|(DictionaryIterator|string|Object)[], + orders?: boolean|string|(boolean|string)[] + ): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.sortByOrder + */ + sortByOrder( + iteratees: ListIterator|string|(ListIterator|string)[], + orders?: boolean|string|(boolean|string)[] + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.sortByOrder + */ + sortByOrder( + iteratees: ListIterator|string|W|(ListIterator|string|W)[], + orders?: boolean|string|(boolean|string)[] + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.sortByOrder + */ + sortByOrder( + iteratees: ListIterator|string|W|(ListIterator|string|W)[], + orders?: boolean|string|(boolean|string)[] + ): LoDashExplicitArrayWrapper; + + /** + * @see _.sortByOrder + */ + sortByOrder( + iteratees: ListIterator|string|Object|(ListIterator|string|Object)[], + orders?: boolean|string|(boolean|string)[] + ): LoDashExplicitArrayWrapper; + + /** + * @see _.sortByOrder + */ + sortByOrder( + iteratees: NumericDictionaryIterator|string|W|(NumericDictionaryIterator|string|W)[], + orders?: boolean|string|(boolean|string)[] + ): LoDashExplicitArrayWrapper; + + /** + * @see _.sortByOrder + */ + sortByOrder( + iteratees: NumericDictionaryIterator|string|Object|(NumericDictionaryIterator|string|Object)[], + orders?: boolean|string|(boolean|string)[] + ): LoDashExplicitArrayWrapper; + + /** + * @see _.sortByOrder + */ + sortByOrder( + iteratees: DictionaryIterator|string|W|(DictionaryIterator|string|W)[], + orders?: boolean|string|(boolean|string)[] + ): LoDashExplicitArrayWrapper; + + /** + * @see _.sortByOrder + */ + sortByOrder( + iteratees: DictionaryIterator|string|Object|(DictionaryIterator|string|Object)[], + orders?: boolean|string|(boolean|string)[] + ): LoDashExplicitArrayWrapper; + } + + //_.where + interface LoDashStatic { + /** + * Performs a deep comparison of each element in a collection to the given properties + * object, returning an array of all elements that have equivalent property values. + * @param collection The collection to iterate over. + * @param properties The object of property values to filter by. + * @return A new array of elements that have the given properties. + **/ + where( + list: Array, + properties: U): T[]; + + /** + * @see _.where + **/ + where( + list: List, + properties: U): T[]; + + /** + * @see _.where + **/ + where( + list: Dictionary, + properties: U): T[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.where + **/ + where(properties: U): LoDashImplicitArrayWrapper; + } + + /******** + * Date * + ********/ + + //_.now + interface LoDashStatic { + /** + * Gets the number of milliseconds that have elapsed since the Unix epoch (1 January 1970 00:00:00 UTC). + * + * @return The number of milliseconds. + */ + now(): number; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.now + */ + now(): number; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.now + */ + now(): LoDashExplicitWrapper; + } + + /************* + * Functions * + *************/ + + //_.after + interface LoDashStatic { + /** + * The opposite of _.before; this method creates a function that invokes func once it’s called n or more times. + * + * @param n The number of calls before func is invoked. + * @param func The function to restrict. + * @return Returns the new restricted function. + */ + after( + n: number, + func: TFunc + ): TFunc; + } + + interface LoDashImplicitWrapper { + /** + * @see _.after + **/ + after(func: TFunc): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.after + **/ + after(func: TFunc): LoDashExplicitObjectWrapper; + } + + //_.ary + interface LoDashStatic { + /** + * Creates a function that accepts up to n arguments ignoring any additional arguments. + * + * @param func The function to cap arguments for. + * @param n The arity cap. + * @returns Returns the new function. + */ + ary( + func: Function, + n?: number + ): TResult; + + ary( + func: T, + n?: number + ): TResult; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.ary + */ + ary(n?: number): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.ary + */ + ary(n?: number): LoDashExplicitObjectWrapper; + } + + //_.backflow + interface LoDashStatic { + /** + * @see _.flowRight + */ + backflow(...funcs: Function[]): TResult; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.flowRight + */ + backflow(...funcs: Function[]): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.flowRight + */ + backflow(...funcs: Function[]): LoDashExplicitObjectWrapper; + } + + //_.before + interface LoDashStatic { + /** + * Creates a function that invokes func, with the this binding and arguments of the created function, while + * it’s called less than n times. Subsequent calls to the created function return the result of the last func + * invocation. + * + * @param n The number of calls at which func is no longer invoked. + * @param func The function to restrict. + * @return Returns the new restricted function. + */ + before( + n: number, + func: TFunc + ): TFunc; + } + + interface LoDashImplicitWrapper { + /** + * @see _.before + **/ + before(func: TFunc): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.before + **/ + before(func: TFunc): LoDashExplicitObjectWrapper; + } + + //_.bind + interface FunctionBind { + placeholder: any; + + ( + func: T, + thisArg: any, + ...partials: any[] + ): TResult; + + ( + func: Function, + thisArg: any, + ...partials: any[] + ): TResult; + } + + interface LoDashStatic { + /** + * Creates a function that invokes func with the this binding of thisArg and prepends any additional _.bind + * arguments to those provided to the bound function. + * + * The _.bind.placeholder value, which defaults to _ in monolithic builds, may be used as a placeholder for + * partially applied arguments. + * + * Note: Unlike native Function#bind this method does not set the "length" property of bound functions. + * + * @param func The function to bind. + * @param thisArg The this binding of func. + * @param partials The arguments to be partially applied. + * @return Returns the new bound function. + */ + bind: FunctionBind; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.bind + */ + bind( + thisArg: any, + ...partials: any[] + ): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.bind + */ + bind( + thisArg: any, + ...partials: any[] + ): LoDashExplicitObjectWrapper; + } + + //_.bindAll + interface LoDashStatic { + /** + * Binds methods of an object to the object itself, overwriting the existing method. Method names may be + * specified as individual arguments or as arrays of method names. If no method names are provided all + * enumerable function properties, own and inherited, of object are bound. + * + * Note: This method does not set the "length" property of bound functions. + * + * @param object The object to bind and assign the bound methods to. + * @param methodNames The object method names to bind, specified as individual method names or arrays of + * method names. + * @return Returns object. + */ + bindAll( + object: T, + ...methodNames: (string|string[])[] + ): T; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.bindAll + */ + bindAll(...methodNames: (string|string[])[]): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.bindAll + */ + bindAll(...methodNames: (string|string[])[]): LoDashExplicitObjectWrapper; + } + + //_.bindKey + interface FunctionBindKey { + placeholder: any; + + ( + object: T, + key: any, + ...partials: any[] + ): TResult; + + ( + object: Object, + key: any, + ...partials: any[] + ): TResult; + } + + interface LoDashStatic { + /** + * Creates a function that invokes the method at object[key] and prepends any additional _.bindKey arguments + * to those provided to the bound function. + * + * This method differs from _.bind by allowing bound functions to reference methods that may be redefined + * or don’t yet exist. See Peter Michaux’s article for more details. + * + * The _.bindKey.placeholder value, which defaults to _ in monolithic builds, may be used as a placeholder + * for partially applied arguments. + * + * @param object The object the method belongs to. + * @param key The key of the method. + * @param partials The arguments to be partially applied. + * @return Returns the new bound function. + */ + bindKey: FunctionBindKey; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.bindKey + */ + bindKey( + key: any, + ...partials: any[] + ): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.bindKey + */ + bindKey( + key: any, + ...partials: any[] + ): LoDashExplicitObjectWrapper; + } + + //_.compose + interface LoDashStatic { + /** + * @see _.flowRight + */ + compose(...funcs: Function[]): TResult; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.flowRight + */ + compose(...funcs: Function[]): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.flowRight + */ + compose(...funcs: Function[]): LoDashExplicitObjectWrapper; + } + + //_.createCallback + interface LoDashStatic { + /** + * Produces a callback bound to an optional thisArg. If func is a property name the created + * callback will return the property value for a given element. If func is an object the created + * callback will return true for elements that contain the equivalent object properties, + * otherwise it will return false. + * @param func The value to convert to a callback. + * @param thisArg The this binding of the created callback. + * @param argCount The number of arguments the callback accepts. + * @return A callback function. + **/ + createCallback( + func: string, + thisArg?: any, + argCount?: number): () => any; + + /** + * @see _.createCallback + **/ + createCallback( + func: Dictionary, + thisArg?: any, + argCount?: number): () => boolean; + } + + interface LoDashImplicitWrapper { + /** + * @see _.createCallback + **/ + createCallback( + thisArg?: any, + argCount?: number): LoDashImplicitObjectWrapper<() => any>; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.createCallback + **/ + createCallback( + thisArg?: any, + argCount?: number): LoDashImplicitObjectWrapper<() => any>; + } + + //_.curry + interface LoDashStatic { + /** + * Creates a function that accepts one or more arguments of func that when called either invokes func returning + * its result, if all func arguments have been provided, or returns a function that accepts one or more of the + * remaining func arguments, and so on. The arity of func may be specified if func.length is not sufficient. + * @param func The function to curry. + * @return Returns the new curried function. + */ + curry(func: (t1: T1) => R): + CurriedFunction1; + /** + * Creates a function that accepts one or more arguments of func that when called either invokes func returning + * its result, if all func arguments have been provided, or returns a function that accepts one or more of the + * remaining func arguments, and so on. The arity of func may be specified if func.length is not sufficient. + * @param func The function to curry. + * @return Returns the new curried function. + */ + curry(func: (t1: T1, t2: T2) => R): + CurriedFunction2; + /** + * Creates a function that accepts one or more arguments of func that when called either invokes func returning + * its result, if all func arguments have been provided, or returns a function that accepts one or more of the + * remaining func arguments, and so on. The arity of func may be specified if func.length is not sufficient. + * @param func The function to curry. + * @return Returns the new curried function. + */ + curry(func: (t1: T1, t2: T2, t3: T3) => R): + CurriedFunction3; + /** + * Creates a function that accepts one or more arguments of func that when called either invokes func returning + * its result, if all func arguments have been provided, or returns a function that accepts one or more of the + * remaining func arguments, and so on. The arity of func may be specified if func.length is not sufficient. + * @param func The function to curry. + * @return Returns the new curried function. + */ + curry(func: (t1: T1, t2: T2, t3: T3, t4: T4) => R): + CurriedFunction4; + /** + * Creates a function that accepts one or more arguments of func that when called either invokes func returning + * its result, if all func arguments have been provided, or returns a function that accepts one or more of the + * remaining func arguments, and so on. The arity of func may be specified if func.length is not sufficient. + * @param func The function to curry. + * @return Returns the new curried function. + */ + curry(func: (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5) => R): + CurriedFunction5; + /** + * Creates a function that accepts one or more arguments of func that when called either invokes func returning + * its result, if all func arguments have been provided, or returns a function that accepts one or more of the + * remaining func arguments, and so on. The arity of func may be specified if func.length is not sufficient. + * @param func The function to curry. + * @param arity The arity of func. + * @return Returns the new curried function. + */ + curry( + func: Function, + arity?: number): TResult; + } + + interface CurriedFunction1 { + (): CurriedFunction1; + (t1: T1): R; + } + + interface CurriedFunction2 { + (): CurriedFunction2; + (t1: T1): CurriedFunction1; + (t1: T1, t2: T2): R; + } + + interface CurriedFunction3 { + (): CurriedFunction3; + (t1: T1): CurriedFunction2; + (t1: T1, t2: T2): CurriedFunction1; + (t1: T1, t2: T2, t3: T3): R; + } + + interface CurriedFunction4 { + (): CurriedFunction4; + (t1: T1): CurriedFunction3; + (t1: T1, t2: T2): CurriedFunction2; + (t1: T1, t2: T2, t3: T3): CurriedFunction1; + (t1: T1, t2: T2, t3: T3, t4: T4): R; + } + + interface CurriedFunction5 { + (): CurriedFunction5; + (t1: T1): CurriedFunction4; + (t1: T1, t2: T2): CurriedFunction3; + (t1: T1, t2: T2, t3: T3): CurriedFunction2; + (t1: T1, t2: T2, t3: T3, t4: T4): CurriedFunction1; + (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5): R; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.curry + **/ + curry(arity?: number): LoDashImplicitObjectWrapper; + } + + //_.curryRight + interface LoDashStatic { + /** + * This method is like _.curry except that arguments are applied to func in the manner of _.partialRight + * instead of _.partial. + * @param func The function to curry. + * @return Returns the new curried function. + */ + curryRight(func: (t1: T1) => R): + CurriedFunction1; + /** + * This method is like _.curry except that arguments are applied to func in the manner of _.partialRight + * instead of _.partial. + * @param func The function to curry. + * @return Returns the new curried function. + */ + curryRight(func: (t1: T1, t2: T2) => R): + CurriedFunction2; + /** + * This method is like _.curry except that arguments are applied to func in the manner of _.partialRight + * instead of _.partial. + * @param func The function to curry. + * @return Returns the new curried function. + */ + curryRight(func: (t1: T1, t2: T2, t3: T3) => R): + CurriedFunction3; + /** + * This method is like _.curry except that arguments are applied to func in the manner of _.partialRight + * instead of _.partial. + * @param func The function to curry. + * @return Returns the new curried function. + */ + curryRight(func: (t1: T1, t2: T2, t3: T3, t4: T4) => R): + CurriedFunction4; + /** + * This method is like _.curry except that arguments are applied to func in the manner of _.partialRight + * instead of _.partial. + * @param func The function to curry. + * @return Returns the new curried function. + */ + curryRight(func: (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5) => R): + CurriedFunction5; + /** + * This method is like _.curry except that arguments are applied to func in the manner of _.partialRight + * instead of _.partial. + * @param func The function to curry. + * @param arity The arity of func. + * @return Returns the new curried function. + */ + curryRight( + func: Function, + arity?: number): TResult; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.curryRight + **/ + curryRight(arity?: number): LoDashImplicitObjectWrapper; + } + + //_.debounce + interface DebounceSettings { + /** + * Specify invoking on the leading edge of the timeout. + */ + leading?: boolean; + + /** + * The maximum time func is allowed to be delayed before it’s invoked. + */ + maxWait?: number; + + /** + * Specify invoking on the trailing edge of the timeout. + */ + trailing?: boolean; + } + + interface LoDashStatic { + /** + * Creates a debounced function that delays invoking func until after wait milliseconds have elapsed since + * the last time the debounced function was invoked. The debounced function comes with a cancel method to + * cancel delayed invocations. Provide an options object to indicate that func should be invoked on the + * leading and/or trailing edge of the wait timeout. Subsequent calls to the debounced function return the + * result of the last func invocation. + * + * Note: If leading and trailing options are true, func is invoked on the trailing edge of the timeout only + * if the the debounced function is invoked more than once during the wait timeout. + * + * See David Corbacho’s article for details over the differences between _.debounce and _.throttle. + * + * @param func The function to debounce. + * @param wait The number of milliseconds to delay. + * @param options The options object. + * @param options.leading Specify invoking on the leading edge of the timeout. + * @param options.maxWait The maximum time func is allowed to be delayed before it’s invoked. + * @param options.trailing Specify invoking on the trailing edge of the timeout. + * @return Returns the new debounced function. + */ + debounce( + func: T, + wait?: number, + options?: DebounceSettings + ): T & Cancelable; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.debounce + */ + debounce( + wait?: number, + options?: DebounceSettings + ): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.debounce + */ + debounce( + wait?: number, + options?: DebounceSettings + ): LoDashExplicitObjectWrapper; + } + + //_.defer + interface LoDashStatic { + /** + * Defers invoking the func until the current call stack has cleared. Any additional arguments are provided to + * func when it’s invoked. + * + * @param func The function to defer. + * @param args The arguments to invoke the function with. + * @return Returns the timer id. + */ + defer( + func: T, + ...args: any[] + ): number; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.defer + */ + defer(...args: any[]): LoDashImplicitWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.defer + */ + defer(...args: any[]): LoDashExplicitWrapper; + } + + //_.delay + interface LoDashStatic { + /** + * Invokes func after wait milliseconds. Any additional arguments are provided to func when it’s invoked. + * + * @param func The function to delay. + * @param wait The number of milliseconds to delay invocation. + * @param args The arguments to invoke the function with. + * @return Returns the timer id. + */ + delay( + func: T, + wait: number, + ...args: any[] + ): number; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.delay + */ + delay( + wait: number, + ...args: any[] + ): LoDashImplicitWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.delay + */ + delay( + wait: number, + ...args: any[] + ): LoDashExplicitWrapper; + } + + //_.flow + interface LoDashStatic { + /** + * Creates a function that returns the result of invoking the provided functions with the this binding of the + * created function, where each successive invocation is supplied the return value of the previous. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + flow(...funcs: Function[]): TResult; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.flow + */ + flow(...funcs: Function[]): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.flow + */ + flow(...funcs: Function[]): LoDashExplicitObjectWrapper; + } + + //_.flowRight + interface LoDashStatic { + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @alias _.backflow, _.compose + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + flowRight(...funcs: Function[]): TResult; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.flowRight + */ + flowRight(...funcs: Function[]): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.flowRight + */ + flowRight(...funcs: Function[]): LoDashExplicitObjectWrapper; + } + + + //_.memoize + interface MemoizedFunction extends Function { + cache: MapCache; + } + + interface LoDashStatic { + /** + * Creates a function that memoizes the result of func. If resolver is provided it determines the cache key for + * storing the result based on the arguments provided to the memoized function. By default, the first argument + * provided to the memoized function is coerced to a string and used as the cache key. The func is invoked with + * the this binding of the memoized function. + * @param func The function to have its output memoized. + * @param resolver The function to resolve the cache key. + * @return Returns the new memoizing function. + */ + memoize( + func: Function, + resolver?: Function): TResult; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.memoize + */ + memoize(resolver?: Function): LoDashImplicitObjectWrapper; + } + + //_.modArgs + interface LoDashStatic { + /** + * Creates a function that runs each argument through a corresponding transform function. + * + * @param func The function to wrap. + * @param transforms The functions to transform arguments, specified as individual functions or arrays + * of functions. + * @return Returns the new function. + */ + modArgs( + func: T, + ...transforms: Function[] + ): TResult; + + /** + * @see _.modArgs + */ + modArgs( + func: T, + transforms: Function[] + ): TResult; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.modArgs + */ + modArgs(...transforms: Function[]): LoDashImplicitObjectWrapper; + + /** + * @see _.modArgs + */ + modArgs(transforms: Function[]): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.modArgs + */ + modArgs(...transforms: Function[]): LoDashExplicitObjectWrapper; + + /** + * @see _.modArgs + */ + modArgs(transforms: Function[]): LoDashExplicitObjectWrapper; + } + + //_.negate + interface LoDashStatic { + /** + * Creates a function that negates the result of the predicate func. The func predicate is invoked with + * the this binding and arguments of the created function. + * + * @param predicate The predicate to negate. + * @return Returns the new function. + */ + negate(predicate: T): (...args: any[]) => boolean; + + /** + * @see _.negate + */ + negate(predicate: T): TResult; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.negate + */ + negate(): LoDashImplicitObjectWrapper<(...args: any[]) => boolean>; + + /** + * @see _.negate + */ + negate(): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.negate + */ + negate(): LoDashExplicitObjectWrapper<(...args: any[]) => boolean>; + + /** + * @see _.negate + */ + negate(): LoDashExplicitObjectWrapper; + } + + //_.once + interface LoDashStatic { + /** + * Creates a function that is restricted to invoking func once. Repeat calls to the function return the value + * of the first call. The func is invoked with the this binding and arguments of the created function. + * + * @param func The function to restrict. + * @return Returns the new restricted function. + */ + once(func: T): T; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.once + */ + once(): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.once + */ + once(): LoDashExplicitObjectWrapper; + } + + //_.partial + interface LoDashStatic { + /** + * Creates a function that, when called, invokes func with any additional partial arguments + * prepended to those provided to the new function. This method is similar to _.bind except + * it does not alter the this binding. + * @param func The function to partially apply arguments to. + * @param args Arguments to be partially applied. + * @return The new partially applied function. + **/ + partial: Partial; + } + + type PH = LoDashStatic; + + interface Function0 { + (): R; + } + interface Function1 { + (t1: T1): R; + } + interface Function2 { + (t1: T1, t2: T2): R; + } + interface Function3 { + (t1: T1, t2: T2, t3: T3): R; + } + interface Function4 { + (t1: T1, t2: T2, t3: T3, t4: T4): R; + } + + interface Partial { + // arity 0 + (func: Function0): Function0; + // arity 1 + (func: Function1): Function1; + (func: Function1, arg1: T1): Function0; + // arity 2 + (func: Function2): Function2; + (func: Function2, arg1: T1): Function1< T2, R>; + (func: Function2, plc1: PH, arg2: T2): Function1; + (func: Function2, arg1: T1, arg2: T2): Function0< R>; + // arity 3 + (func: Function3): Function3; + (func: Function3, arg1: T1): Function2< T2, T3, R>; + (func: Function3, plc1: PH, arg2: T2): Function2; + (func: Function3, arg1: T1, arg2: T2): Function1< T3, R>; + (func: Function3, plc1: PH, plc2: PH, arg3: T3): Function2; + (func: Function3, arg1: T1, plc2: PH, arg3: T3): Function1< T2, R>; + (func: Function3, plc1: PH, arg2: T2, arg3: T3): Function1; + (func: Function3, arg1: T1, arg2: T2, arg3: T3): Function0< R>; + // arity 4 + (func: Function4): Function4; + (func: Function4, arg1: T1): Function3< T2, T3, T4, R>; + (func: Function4, plc1: PH, arg2: T2): Function3; + (func: Function4, arg1: T1, arg2: T2): Function2< T3, T4, R>; + (func: Function4, plc1: PH, plc2: PH, arg3: T3): Function3; + (func: Function4, arg1: T1, plc2: PH, arg3: T3): Function2< T2, T4, R>; + (func: Function4, plc1: PH, arg2: T2, arg3: T3): Function2; + (func: Function4, arg1: T1, arg2: T2, arg3: T3): Function1< T4, R>; + (func: Function4, plc1: PH, plc2: PH, plc3: PH, arg4: T4): Function3; + (func: Function4, arg1: T1, plc2: PH, plc3: PH, arg4: T4): Function2< T2, T3, R>; + (func: Function4, plc1: PH, arg2: T2, plc3: PH, arg4: T4): Function2; + (func: Function4, arg1: T1, arg2: T2, plc3: PH, arg4: T4): Function1< T3, R>; + (func: Function4, plc1: PH, plc2: PH, arg3: T3, arg4: T4): Function2; + (func: Function4, arg1: T1, plc2: PH, arg3: T3, arg4: T4): Function1< T2, R>; + (func: Function4, plc1: PH, arg2: T2, arg3: T3, arg4: T4): Function1; + (func: Function4, arg1: T1, arg2: T2, arg3: T3, arg4: T4): Function0< R>; + // catch-all + (func: Function, ...args: any[]): Function; + } + + //_.partialRight + interface LoDashStatic { + /** + * This method is like _.partial except that partial arguments are appended to those provided + * to the new function. + * @param func The function to partially apply arguments to. + * @param args Arguments to be partially applied. + * @return The new partially applied function. + **/ + partialRight: PartialRight + } + + interface PartialRight { + // arity 0 + (func: Function0): Function0; + // arity 1 + (func: Function1): Function1; + (func: Function1, arg1: T1): Function0; + // arity 2 + (func: Function2): Function2; + (func: Function2, arg1: T1, plc2: PH): Function1< T2, R>; + (func: Function2, arg2: T2): Function1; + (func: Function2, arg1: T1, arg2: T2): Function0< R>; + // arity 3 + (func: Function3): Function3; + (func: Function3, arg1: T1, plc2: PH, plc3: PH): Function2< T2, T3, R>; + (func: Function3, arg2: T2, plc3: PH): Function2; + (func: Function3, arg1: T1, arg2: T2, plc3: PH): Function1< T3, R>; + (func: Function3, arg3: T3): Function2; + (func: Function3, arg1: T1, plc2: PH, arg3: T3): Function1< T2, R>; + (func: Function3, arg2: T2, arg3: T3): Function1; + (func: Function3, arg1: T1, arg2: T2, arg3: T3): Function0< R>; + // arity 4 + (func: Function4): Function4; + (func: Function4, arg1: T1, plc2: PH, plc3: PH, plc4: PH): Function3< T2, T3, T4, R>; + (func: Function4, arg2: T2, plc3: PH, plc4: PH): Function3; + (func: Function4, arg1: T1, arg2: T2, plc3: PH, plc4: PH): Function2< T3, T4, R>; + (func: Function4, arg3: T3, plc4: PH): Function3; + (func: Function4, arg1: T1, plc2: PH, arg3: T3, plc4: PH): Function2< T2, T4, R>; + (func: Function4, arg2: T2, arg3: T3, plc4: PH): Function2; + (func: Function4, arg1: T1, arg2: T2, arg3: T3, plc4: PH): Function1< T4, R>; + (func: Function4, arg4: T4): Function3; + (func: Function4, arg1: T1, plc2: PH, plc3: PH, arg4: T4): Function2< T2, T3, R>; + (func: Function4, arg2: T2, plc3: PH, arg4: T4): Function2; + (func: Function4, arg1: T1, arg2: T2, plc3: PH, arg4: T4): Function1< T3, R>; + (func: Function4, arg3: T3, arg4: T4): Function2; + (func: Function4, arg1: T1, plc2: PH, arg3: T3, arg4: T4): Function1< T2, R>; + (func: Function4, arg2: T2, arg3: T3, arg4: T4): Function1; + (func: Function4, arg1: T1, arg2: T2, arg3: T3, arg4: T4): Function0< R>; + // catch-all + (func: Function, ...args: any[]): Function; + } + + //_.rearg + interface LoDashStatic { + /** + * Creates a function that invokes func with arguments arranged according to the specified indexes where the + * argument value at the first index is provided as the first argument, the argument value at the second index + * is provided as the second argument, and so on. + * @param func The function to rearrange arguments for. + * @param indexes The arranged argument indexes, specified as individual indexes or arrays of indexes. + * @return Returns the new function. + */ + rearg(func: Function, indexes: number[]): TResult; + + /** + * @see _.rearg + */ + rearg(func: Function, ...indexes: number[]): TResult; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.rearg + */ + rearg(indexes: number[]): LoDashImplicitObjectWrapper; + + /** + * @see _.rearg + */ + rearg(...indexes: number[]): LoDashImplicitObjectWrapper; + } + + //_.restParam + interface LoDashStatic { + /** + * Creates a function that invokes func with the this binding of the created function and arguments from start + * and beyond provided as an array. + * + * Note: This method is based on the rest parameter. + * + * @param func The function to apply a rest parameter to. + * @param start The start position of the rest parameter. + * @return Returns the new function. + */ + restParam( + func: Function, + start?: number + ): TResult; + + /** + * @see _.restParam + */ + restParam( + func: TFunc, + start?: number + ): TResult; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.restParam + */ + restParam(start?: number): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.restParam + */ + restParam(start?: number): LoDashExplicitObjectWrapper; + } + + //_.spread + interface LoDashStatic { + /** + * Creates a function that invokes func with the this binding of the created function and an array of arguments + * much like Function#apply. + * + * Note: This method is based on the spread operator. + * + * @param func The function to spread arguments over. + * @return Returns the new function. + */ + spread(func: F): T; + + /** + * @see _.spread + */ + spread(func: Function): T; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.spread + */ + spread(): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.spread + */ + spread(): LoDashExplicitObjectWrapper; + } + + //_.throttle + interface ThrottleSettings { + /** + * If you'd like to disable the leading-edge call, pass this as false. + */ + leading?: boolean; + + /** + * If you'd like to disable the execution on the trailing-edge, pass false. + */ + trailing?: boolean; + } + + interface LoDashStatic { + /** + * Creates a throttled function that only invokes func at most once per every wait milliseconds. The throttled + * function comes with a cancel method to cancel delayed invocations. Provide an options object to indicate + * that func should be invoked on the leading and/or trailing edge of the wait timeout. Subsequent calls to + * the throttled function return the result of the last func call. + * + * Note: If leading and trailing options are true, func is invoked on the trailing edge of the timeout only if + * the the throttled function is invoked more than once during the wait timeout. + * + * @param func The function to throttle. + * @param wait The number of milliseconds to throttle invocations to. + * @param options The options object. + * @param options.leading Specify invoking on the leading edge of the timeout. + * @param options.trailing Specify invoking on the trailing edge of the timeout. + * @return Returns the new throttled function. + */ + throttle( + func: T, + wait?: number, + options?: ThrottleSettings + ): T & Cancelable; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.throttle + */ + throttle( + wait?: number, + options?: ThrottleSettings + ): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.throttle + */ + throttle( + wait?: number, + options?: ThrottleSettings + ): LoDashExplicitObjectWrapper; + } + + //_.wrap + interface LoDashStatic { + /** + * Creates a function that provides value to the wrapper function as its first argument. Any additional + * arguments provided to the function are appended to those provided to the wrapper function. The wrapper is + * invoked with the this binding of the created function. + * + * @param value The value to wrap. + * @param wrapper The wrapper function. + * @return Returns the new function. + */ + wrap( + value: V, + wrapper: W + ): R; + + /** + * @see _.wrap + */ + wrap( + value: V, + wrapper: Function + ): R; + + /** + * @see _.wrap + */ + wrap( + value: any, + wrapper: Function + ): R; + } + + interface LoDashImplicitWrapper { + /** + * @see _.wrap + */ + wrap(wrapper: W): LoDashImplicitObjectWrapper; + + /** + * @see _.wrap + */ + wrap(wrapper: Function): LoDashImplicitObjectWrapper; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.wrap + */ + wrap(wrapper: W): LoDashImplicitObjectWrapper; + + /** + * @see _.wrap + */ + wrap(wrapper: Function): LoDashImplicitObjectWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.wrap + */ + wrap(wrapper: W): LoDashImplicitObjectWrapper; + + /** + * @see _.wrap + */ + wrap(wrapper: Function): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.wrap + */ + wrap(wrapper: W): LoDashExplicitObjectWrapper; + + /** + * @see _.wrap + */ + wrap(wrapper: Function): LoDashExplicitObjectWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.wrap + */ + wrap(wrapper: W): LoDashExplicitObjectWrapper; + + /** + * @see _.wrap + */ + wrap(wrapper: Function): LoDashExplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.wrap + */ + wrap(wrapper: W): LoDashExplicitObjectWrapper; + + /** + * @see _.wrap + */ + wrap(wrapper: Function): LoDashExplicitObjectWrapper; + } + + /******** + * Lang * + ********/ + + //_.clone + interface LoDashStatic { + /** + * Creates a clone of value. If isDeep is true nested objects are cloned, otherwise they are assigned by + * reference. If customizer is provided it’s invoked to produce the cloned values. If customizer returns + * undefined cloning is handled by the method instead. The customizer is bound to thisArg and invoked with up + * to three argument; (value [, index|key, object]). + * Note: This method is loosely based on the structured clone algorithm. The enumerable properties of arguments + * objects and objects created by constructors other than Object are cloned to plain Object objects. An empty + * object is returned for uncloneable values such as functions, DOM nodes, Maps, Sets, and WeakMaps. + * @param value The value to clone. + * @param isDeep Specify a deep clone. + * @param customizer The function to customize cloning values. + * @param thisArg The this binding of customizer. + * @return Returns the cloned value. + */ + clone( + value: T, + isDeep?: boolean, + customizer?: (value: any) => any, + thisArg?: any): T; + + /** + * @see _.clone + */ + clone( + value: T, + customizer?: (value: any) => any, + thisArg?: any): T; + } + + interface LoDashImplicitWrapper { + /** + * @see _.clone + */ + clone( + isDeep?: boolean, + customizer?: (value: any) => any, + thisArg?: any): T; + + /** + * @see _.clone + */ + clone( + customizer?: (value: any) => any, + thisArg?: any): T; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.clone + */ + clone( + isDeep?: boolean, + customizer?: (value: any) => any, + thisArg?: any): T[]; + + /** + * @see _.clone + */ + clone( + customizer?: (value: any) => any, + thisArg?: any): T[]; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.clone + */ + clone( + isDeep?: boolean, + customizer?: (value: any) => any, + thisArg?: any): T; + + /** + * @see _.clone + */ + clone( + customizer?: (value: any) => any, + thisArg?: any): T; + } + + //_.cloneDeep + interface LoDashStatic { + /** + * Creates a deep clone of value. If customizer is provided it’s invoked to produce the cloned values. If + * customizer returns undefined cloning is handled by the method instead. The customizer is bound to thisArg + * and invoked with up to three argument; (value [, index|key, object]). + * Note: This method is loosely based on the structured clone algorithm. The enumerable properties of arguments + * objects and objects created by constructors other than Object are cloned to plain Object objects. An empty + * object is returned for uncloneable values such as functions, DOM nodes, Maps, Sets, and WeakMaps. + * @param value The value to deep clone. + * @param customizer The function to customize cloning values. + * @param thisArg The this binding of customizer. + * @return Returns the deep cloned value. + */ + cloneDeep( + value: T, + customizer?: (value: any) => any, + thisArg?: any): T; + } + + interface LoDashImplicitWrapper { + /** + * @see _.cloneDeep + */ + cloneDeep( + customizer?: (value: any) => any, + thisArg?: any): T; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.cloneDeep + */ + cloneDeep( + customizer?: (value: any) => any, + thisArg?: any): T[]; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.cloneDeep + */ + cloneDeep( + customizer?: (value: any) => any, + thisArg?: any): T; + } + + //_.eq + interface LoDashStatic { + /** + * @see _.isEqual + */ + eq( + value: any, + other: any, + customizer?: IsEqualCustomizer, + thisArg?: any + ): boolean; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.isEqual + */ + eq( + other: any, + customizer?: IsEqualCustomizer, + thisArg?: any + ): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.isEqual + */ + eq( + other: any, + customizer?: IsEqualCustomizer, + thisArg?: any + ): LoDashExplicitWrapper; + } + + //_.gt + interface LoDashStatic { + /** + * Checks if value is greater than other. + * + * @param value The value to compare. + * @param other The other value to compare. + * @return Returns true if value is greater than other, else false. + */ + gt( + value: any, + other: any + ): boolean; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.gt + */ + gt(other: any): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.gt + */ + gt(other: any): LoDashExplicitWrapper; + } + + //_.gte + interface LoDashStatic { + /** + * Checks if value is greater than or equal to other. + * + * @param value The value to compare. + * @param other The other value to compare. + * @return Returns true if value is greater than or equal to other, else false. + */ + gte( + value: any, + other: any + ): boolean; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.gte + */ + gte(other: any): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.gte + */ + gte(other: any): LoDashExplicitWrapper; + } + + //_.isArguments + interface LoDashStatic { + /** + * Checks if value is classified as an arguments object. + * + * @param value The value to check. + * @return Returns true if value is correctly classified, else false. + */ + isArguments(value?: any): value is IArguments; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.isArguments + */ + isArguments(): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.isArguments + */ + isArguments(): LoDashExplicitWrapper; + } + + //_.isArray + interface LoDashStatic { + /** + * Checks if value is classified as an Array object. + * @param value The value to check. + * + * @return Returns true if value is correctly classified, else false. + */ + isArray(value?: any): value is T[]; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.isArray + */ + isArray(): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.isArray + */ + isArray(): LoDashExplicitWrapper; + } + + //_.isBoolean + interface LoDashStatic { + /** + * Checks if value is classified as a boolean primitive or object. + * + * @param value The value to check. + * @return Returns true if value is correctly classified, else false. + */ + isBoolean(value?: any): value is boolean; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.isBoolean + */ + isBoolean(): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.isBoolean + */ + isBoolean(): LoDashExplicitWrapper; + } + + //_.isDate + interface LoDashStatic { + /** + * Checks if value is classified as a Date object. + * @param value The value to check. + * + * @return Returns true if value is correctly classified, else false. + */ + isDate(value?: any): value is Date; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.isDate + */ + isDate(): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.isDate + */ + isDate(): LoDashExplicitWrapper; + } + + //_.isElement + interface LoDashStatic { + /** + * Checks if value is a DOM element. + * + * @param value The value to check. + * @return Returns true if value is a DOM element, else false. + */ + isElement(value?: any): boolean; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.isElement + */ + isElement(): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.isElement + */ + isElement(): LoDashExplicitWrapper; + } + + //_.isEmpty + interface LoDashStatic { + /** + * Checks if value is empty. A value is considered empty unless it’s an arguments object, array, string, or + * jQuery-like collection with a length greater than 0 or an object with own enumerable properties. + * @param value The value to inspect. + * @return Returns true if value is empty, else false. + **/ + isEmpty(value?: any[]|Dictionary|string|any): boolean; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.isEmpty + */ + isEmpty(): boolean; + } + + //_.isEqual + interface IsEqualCustomizer { + (value: any, other: any, indexOrKey?: number|string): boolean; + } + + interface LoDashStatic { + /** + * Performs a deep comparison between two values to determine if they are equivalent. If customizer is + * provided it’s invoked to compare values. If customizer returns undefined comparisons are handled by the + * method instead. The customizer is bound to thisArg and invoked with up to three arguments: (value, other + * [, index|key]). + * + * Note: This method supports comparing arrays, booleans, Date objects, numbers, Object objects, regexes, + * and strings. Objects are compared by their own, not inherited, enumerable properties. Functions and DOM + * nodes are not supported. Provide a customizer function to extend support for comparing other values. + * + * @alias _.eq + * + * @param value The value to compare. + * @param other The other value to compare. + * @param customizer The function to customize value comparisons. + * @param thisArg The this binding of customizer. + * @return Returns true if the values are equivalent, else false. + */ + isEqual( + value: any, + other: any, + customizer?: IsEqualCustomizer, + thisArg?: any + ): boolean; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.isEqual + */ + isEqual( + other: any, + customizer?: IsEqualCustomizer, + thisArg?: any + ): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.isEqual + */ + isEqual( + other: any, + customizer?: IsEqualCustomizer, + thisArg?: any + ): LoDashExplicitWrapper; + } + + //_.isError + interface LoDashStatic { + /** + * Checks if value is an Error, EvalError, RangeError, ReferenceError, SyntaxError, TypeError, or URIError + * object. + * + * @param value The value to check. + * @return Returns true if value is an error object, else false. + */ + isError(value: any): value is Error; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.isError + */ + isError(): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.isError + */ + isError(): LoDashExplicitWrapper; + } + + //_.isFinite + interface LoDashStatic { + /** + * Checks if value is a finite primitive number. + * + * Note: This method is based on Number.isFinite. + * + * @param value The value to check. + * @return Returns true if value is a finite number, else false. + */ + isFinite(value?: any): boolean; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.isFinite + */ + isFinite(): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.isFinite + */ + isFinite(): LoDashExplicitWrapper; + } + + //_.isFunction + interface LoDashStatic { + /** + * Checks if value is classified as a Function object. + * + * @param value The value to check. + * @return Returns true if value is correctly classified, else false. + */ + isFunction(value?: any): value is Function; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.isFunction + */ + isFunction(): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.isFunction + */ + isFunction(): LoDashExplicitWrapper; + } + + //_.isMatch + interface isMatchCustomizer { + (value: any, other: any, indexOrKey?: number|string): boolean; + } + + interface LoDashStatic { + /** + * Performs a deep comparison between object and source to determine if object contains equivalent property + * values. If customizer is provided it’s invoked to compare values. If customizer returns undefined + * comparisons are handled by the method instead. The customizer is bound to thisArg and invoked with three + * arguments: (value, other, index|key). + * @param object The object to inspect. + * @param source The object of property values to match. + * @param customizer The function to customize value comparisons. + * @param thisArg The this binding of customizer. + * @return Returns true if object is a match, else false. + */ + isMatch(object: Object, source: Object, customizer?: isMatchCustomizer, thisArg?: any): boolean; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.isMatch + */ + isMatch(source: Object, customizer?: isMatchCustomizer, thisArg?: any): boolean; + } + + //_.isNaN + interface LoDashStatic { + /** + * Checks if value is NaN. + * + * Note: This method is not the same as isNaN which returns true for undefined and other non-numeric values. + * + * @param value The value to check. + * @return Returns true if value is NaN, else false. + */ + isNaN(value?: any): boolean; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.isNaN + */ + isNaN(): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.isNaN + */ + isNaN(): LoDashExplicitWrapper; + } + + //_.isNative + interface LoDashStatic { + /** + * Checks if value is a native function. + * @param value The value to check. + * + * @retrun Returns true if value is a native function, else false. + */ + isNative(value: any): value is Function; + } + + interface LoDashImplicitWrapperBase { + /** + * see _.isNative + */ + isNative(): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * see _.isNative + */ + isNative(): LoDashExplicitWrapper; + } + + //_.isNull + interface LoDashStatic { + /** + * Checks if value is null. + * + * @param value The value to check. + * @return Returns true if value is null, else false. + */ + isNull(value?: any): boolean; + } + + interface LoDashImplicitWrapperBase { + /** + * see _.isNull + */ + isNull(): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * see _.isNull + */ + isNull(): LoDashExplicitWrapper; + } + + //_.isNumber + interface LoDashStatic { + /** + * Checks if value is classified as a Number primitive or object. + * + * Note: To exclude Infinity, -Infinity, and NaN, which are classified as numbers, use the _.isFinite method. + * + * @param value The value to check. + * @return Returns true if value is correctly classified, else false. + */ + isNumber(value?: any): value is number; + } + + interface LoDashImplicitWrapperBase { + /** + * see _.isNumber + */ + isNumber(): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * see _.isNumber + */ + isNumber(): LoDashExplicitWrapper; + } + + //_.isObject + interface LoDashStatic { + /** + * Checks if value is the language type of Object. (e.g. arrays, functions, objects, regexes, new Number(0), + * and new String('')) + * + * @param value The value to check. + * @return Returns true if value is an object, else false. + */ + isObject(value?: any): boolean; + } + + interface LoDashImplicitWrapperBase { + /** + * see _.isObject + */ + isObject(): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * see _.isObject + */ + isObject(): LoDashExplicitWrapper; + } + + //_.isPlainObject + interface LoDashStatic { + /** + * Checks if value is a plain object, that is, an object created by the Object constructor or one with a + * [[Prototype]] of null. + * + * Note: This method assumes objects created by the Object constructor have no inherited enumerable properties. + * + * @param value The value to check. + * @return Returns true if value is a plain object, else false. + */ + isPlainObject(value?: any): boolean; + } + + interface LoDashImplicitWrapperBase { + /** + * see _.isPlainObject + */ + isPlainObject(): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * see _.isPlainObject + */ + isPlainObject(): LoDashExplicitWrapper; + } + + //_.isRegExp + interface LoDashStatic { + /** + * Checks if value is classified as a RegExp object. + * @param value The value to check. + * + * @return Returns true if value is correctly classified, else false. + */ + isRegExp(value?: any): value is RegExp; + } + + interface LoDashImplicitWrapperBase { + /** + * see _.isRegExp + */ + isRegExp(): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * see _.isRegExp + */ + isRegExp(): LoDashExplicitWrapper; + } + + //_.isString + interface LoDashStatic { + /** + * Checks if value is classified as a String primitive or object. + * + * @param value The value to check. + * @return Returns true if value is correctly classified, else false. + */ + isString(value?: any): value is string; + } + + interface LoDashImplicitWrapperBase { + /** + * see _.isString + */ + isString(): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * see _.isString + */ + isString(): LoDashExplicitWrapper; + } + + //_.isTypedArray + interface LoDashStatic { + /** + * Checks if value is classified as a typed array. + * + * @param value The value to check. + * @return Returns true if value is correctly classified, else false. + */ + isTypedArray(value: any): boolean; + } + + interface LoDashImplicitWrapperBase { + /** + * see _.isTypedArray + */ + isTypedArray(): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * see _.isTypedArray + */ + isTypedArray(): LoDashExplicitWrapper; + } + + //_.isUndefined + interface LoDashStatic { + /** + * Checks if value is undefined. + * + * @param value The value to check. + * @return Returns true if value is undefined, else false. + */ + isUndefined(value: any): boolean; + } + + interface LoDashImplicitWrapperBase { + /** + * see _.isUndefined + */ + isUndefined(): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * see _.isUndefined + */ + isUndefined(): LoDashExplicitWrapper; + } + + //_.lt + interface LoDashStatic { + /** + * Checks if value is less than other. + * + * @param value The value to compare. + * @param other The other value to compare. + * @return Returns true if value is less than other, else false. + */ + lt( + value: any, + other: any + ): boolean; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.lt + */ + lt(other: any): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.lt + */ + lt(other: any): LoDashExplicitWrapper; + } + + //_.lte + interface LoDashStatic { + /** + * Checks if value is less than or equal to other. + * + * @param value The value to compare. + * @param other The other value to compare. + * @return Returns true if value is less than or equal to other, else false. + */ + lte( + value: any, + other: any + ): boolean; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.lte + */ + lte(other: any): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.lte + */ + lte(other: any): LoDashExplicitWrapper; + } + + //_.toArray + interface LoDashStatic { + /** + * Converts value to an array. + * + * @param value The value to convert. + * @return Returns the converted array. + */ + toArray(value: List|Dictionary|NumericDictionary): T[]; + + /** + * @see _.toArray + */ + toArray(value: TValue): TResult[]; + + /** + * @see _.toArray + */ + toArray(value?: any): TResult[]; + } + + interface LoDashImplicitWrapper { + /** + * @see _.toArray + */ + toArray(): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.toArray + */ + toArray(): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.toArray + */ + toArray(): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.toArray + */ + toArray(): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.toArray + */ + toArray(): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.toArray + */ + toArray(): LoDashExplicitArrayWrapper; + } + + //_.toPlainObject + interface LoDashStatic { + /** + * Converts value to a plain object flattening inherited enumerable properties of value to own properties + * of the plain object. + * + * @param value The value to convert. + * @return Returns the converted plain object. + */ + toPlainObject(value?: any): TResult; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.toPlainObject + */ + toPlainObject(): LoDashImplicitObjectWrapper; + } + + /******** + * Math * + ********/ + + //_.add + interface LoDashStatic { + /** + * Adds two numbers. + * + * @param augend The first number to add. + * @param addend The second number to add. + * @return Returns the sum. + */ + add( + augend: number, + addend: number + ): number; + } + + interface LoDashImplicitWrapper { + /** + * @see _.add + */ + add(addend: number): number; + } + + interface LoDashExplicitWrapper { + /** + * @see _.add + */ + add(addend: number): LoDashExplicitWrapper; + } + + //_.ceil + interface LoDashStatic { + /** + * Calculates n rounded up to precision. + * + * @param n The number to round up. + * @param precision The precision to round up to. + * @return Returns the rounded up number. + */ + ceil( + n: number, + precision?: number + ): number; + } + + interface LoDashImplicitWrapper { + /** + * @see _.ceil + */ + ceil(precision?: number): number; + } + + interface LoDashExplicitWrapper { + /** + * @see _.ceil + */ + ceil(precision?: number): LoDashExplicitWrapper; + } + + //_.floor + interface LoDashStatic { + /** + * Calculates n rounded down to precision. + * + * @param n The number to round down. + * @param precision The precision to round down to. + * @return Returns the rounded down number. + */ + floor( + n: number, + precision?: number + ): number; + } + + interface LoDashImplicitWrapper { + /** + * @see _.floor + */ + floor(precision?: number): number; + } + + interface LoDashExplicitWrapper { + /** + * @see _.floor + */ + floor(precision?: number): LoDashExplicitWrapper; + } + + //_.max + interface LoDashStatic { + /** + * Gets the maximum value of collection. If collection is empty or falsey -Infinity is returned. If an iteratee + * function is provided it’s invoked for each value in collection to generate the criterion by which the value + * is ranked. The iteratee is bound to thisArg and invoked with three arguments: (value, index, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property value + * of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the maximum value. + */ + max( + collection: List, + iteratee?: ListIterator, + thisArg?: any + ): T; + + /** + * @see _.max + */ + max( + collection: Dictionary, + iteratee?: DictionaryIterator, + thisArg?: any + ): T; + + /** + * @see _.max + */ + max( + collection: List|Dictionary, + iteratee?: string, + thisArg?: any + ): T; + + /** + * @see _.max + */ + max( + collection: List|Dictionary, + whereValue?: TObject + ): T; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.max + */ + max( + iteratee?: ListIterator, + thisArg?: any + ): T; + + /** + * @see _.max + */ + max( + iteratee?: string, + thisArg?: any + ): T; + + /** + * @see _.max + */ + max( + whereValue?: TObject + ): T; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.max + */ + max( + iteratee?: ListIterator|DictionaryIterator, + thisArg?: any + ): T; + + /** + * @see _.max + */ + max( + iteratee?: string, + thisArg?: any + ): T; + + /** + * @see _.max + */ + max( + whereValue?: TObject + ): T; + } + + //_.min + interface LoDashStatic { + /** + * Gets the minimum value of collection. If collection is empty or falsey Infinity is returned. If an iteratee + * function is provided it’s invoked for each value in collection to generate the criterion by which the value + * is ranked. The iteratee is bound to thisArg and invoked with three arguments: (value, index, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property value + * of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the minimum value. + */ + min( + collection: List, + iteratee?: ListIterator, + thisArg?: any + ): T; + + /** + * @see _.min + */ + min( + collection: Dictionary, + iteratee?: DictionaryIterator, + thisArg?: any + ): T; + + /** + * @see _.min + */ + min( + collection: List|Dictionary, + iteratee?: string, + thisArg?: any + ): T; + + /** + * @see _.min + */ + min( + collection: List|Dictionary, + whereValue?: TObject + ): T; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.min + */ + min( + iteratee?: ListIterator, + thisArg?: any + ): T; + + /** + * @see _.min + */ + min( + iteratee?: string, + thisArg?: any + ): T; + + /** + * @see _.min + */ + min( + whereValue?: TObject + ): T; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.min + */ + min( + iteratee?: ListIterator|DictionaryIterator, + thisArg?: any + ): T; + + /** + * @see _.min + */ + min( + iteratee?: string, + thisArg?: any + ): T; + + /** + * @see _.min + */ + min( + whereValue?: TObject + ): T; + } + + //_.round + interface LoDashStatic { + /** + * Calculates n rounded to precision. + * + * @param n The number to round. + * @param precision The precision to round to. + * @return Returns the rounded number. + */ + round( + n: number, + precision?: number + ): number; + } + + interface LoDashImplicitWrapper { + /** + * @see _.round + */ + round(precision?: number): number; + } + + interface LoDashExplicitWrapper { + /** + * @see _.round + */ + round(precision?: number): LoDashExplicitWrapper; + } + + //_.sum + interface LoDashStatic { + /** + * Gets the sum of the values in collection. + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the sum. + */ + sum( + collection: List, + iteratee: ListIterator, + thisArg?: any + ): number; + + /** + * @see _.sum + **/ + sum( + collection: Dictionary, + iteratee: DictionaryIterator, + thisArg?: any + ): number; + + /** + * @see _.sum + */ + sum( + collection: List|Dictionary, + iteratee: string + ): number; + + /** + * @see _.sum + */ + sum(collection: List|Dictionary): number; + + /** + * @see _.sum + */ + sum(collection: List|Dictionary): number; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.sum + */ + sum( + iteratee: ListIterator, + thisArg?: any + ): number; + + /** + * @see _.sum + */ + sum(iteratee: string): number; + + /** + * @see _.sum + */ + sum(): number; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.sum + **/ + sum( + iteratee: ListIterator|DictionaryIterator, + thisArg?: any + ): number; + + /** + * @see _.sum + */ + sum(iteratee: string): number; + + /** + * @see _.sum + */ + sum(): number; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.sum + */ + sum( + iteratee: ListIterator, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.sum + */ + sum(iteratee: string): LoDashExplicitWrapper; + + /** + * @see _.sum + */ + sum(): LoDashExplicitWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.sum + */ + sum( + iteratee: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.sum + */ + sum(iteratee: string): LoDashExplicitWrapper; + + /** + * @see _.sum + */ + sum(): LoDashExplicitWrapper; + } + + /********** + * Number * + **********/ + + //_.inRange + interface LoDashStatic { + /** + * Checks if n is between start and up to but not including, end. If end is not specified it’s set to start + * with start then set to 0. + * + * @param n The number to check. + * @param start The start of the range. + * @param end The end of the range. + * @return Returns true if n is in the range, else false. + */ + inRange( + n: number, + start: number, + end: number + ): boolean; + + + /** + * @see _.inRange + */ + inRange( + n: number, + end: number + ): boolean; + } + + interface LoDashImplicitWrapper { + /** + * @see _.inRange + */ + inRange( + start: number, + end: number + ): boolean; + + /** + * @see _.inRange + */ + inRange(end: number): boolean; + } + + interface LoDashExplicitWrapper { + /** + * @see _.inRange + */ + inRange( + start: number, + end: number + ): LoDashExplicitWrapper; + + /** + * @see _.inRange + */ + inRange(end: number): LoDashExplicitWrapper; + } + + //_.random + interface LoDashStatic { + /** + * Produces a random number between min and max (inclusive). If only one argument is provided a number between + * 0 and the given number is returned. If floating is true, or either min or max are floats, a floating-point + * number is returned instead of an integer. + * + * @param min The minimum possible value. + * @param max The maximum possible value. + * @param floating Specify returning a floating-point number. + * @return Returns the random number. + */ + random( + min?: number, + max?: number, + floating?: boolean + ): number; + + /** + * @see _.random + */ + random( + min?: number, + floating?: boolean + ): number; + + /** + * @see _.random + */ + random(floating?: boolean): number; + } + + interface LoDashImplicitWrapper { + /** + * @see _.random + */ + random( + max?: number, + floating?: boolean + ): number; + + /** + * @see _.random + */ + random(floating?: boolean): number; + } + + interface LoDashExplicitWrapper { + /** + * @see _.random + */ + random( + max?: number, + floating?: boolean + ): LoDashExplicitWrapper; + + /** + * @see _.random + */ + random(floating?: boolean): LoDashExplicitWrapper; + } + + /********** + * Object * + **********/ + + //_.assign + interface AssignCustomizer { + (objectValue: any, sourceValue: any, key?: string, object?: {}, source?: {}): any; + } + + interface LoDashStatic { + /** + * Assigns own enumerable properties of source object(s) to the destination object. Subsequent sources + * overwrite property assignments of previous sources. If customizer is provided it’s invoked to produce the + * assigned values. The customizer is bound to thisArg and invoked with five arguments: + * (objectValue, sourceValue, key, object, source). + * + * Note: This method mutates object and is based on Object.assign. + * + * @alias _.extend + * + * @param object The destination object. + * @param source The source objects. + * @param customizer The function to customize assigned values. + * @param thisArg The this binding of callback. + * @return The destination object. + */ + assign( + object: TObject, + source: TSource, + customizer?: AssignCustomizer, + thisArg?: any + ): TResult; + + /** + * @see assign + */ + assign( + object: TObject, + source1: TSource1, + source2: TSource2, + customizer?: AssignCustomizer, + thisArg?: any + ): TResult; + + /** + * @see assign + */ + assign( + object: TObject, + source1: TSource1, + source2: TSource2, + source3: TSource3, + customizer?: AssignCustomizer, + thisArg?: any + ): TResult; + + /** + * @see assign + */ + assign + ( + object: TObject, + source1: TSource1, + source2: TSource2, + source3: TSource3, + source4: TSource4, + customizer?: AssignCustomizer, + thisArg?: any + ): TResult; + + /** + * @see _.assign + */ + assign(object: TObject): TObject; + + /** + * @see _.assign + */ + assign( + object: TObject, ...otherArgs: any[] + ): TResult; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.assign + */ + assign( + source: TSource, + customizer?: AssignCustomizer, + thisArg?: any + ): LoDashImplicitObjectWrapper; + + /** + * @see assign + */ + assign( + source1: TSource1, + source2: TSource2, + customizer?: AssignCustomizer, + thisArg?: any + ): LoDashImplicitObjectWrapper; + + /** + * @see assign + */ + assign( + source1: TSource1, + source2: TSource2, + source3: TSource3, + customizer?: AssignCustomizer, + thisArg?: any + ): LoDashImplicitObjectWrapper; + + /** + * @see assign + */ + assign( + source1: TSource1, + source2: TSource2, + source3: TSource3, + source4: TSource4, + customizer?: AssignCustomizer, + thisArg?: any + ): LoDashImplicitObjectWrapper; + + /** + * @see _.assign + */ + assign(): LoDashImplicitObjectWrapper; + + /** + * @see _.assign + */ + assign(...otherArgs: any[]): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.assign + */ + assign( + source: TSource, + customizer?: AssignCustomizer, + thisArg?: any + ): LoDashExplicitObjectWrapper; + + /** + * @see assign + */ + assign( + source1: TSource1, + source2: TSource2, + customizer?: AssignCustomizer, + thisArg?: any + ): LoDashExplicitObjectWrapper; + + /** + * @see assign + */ + assign( + source1: TSource1, + source2: TSource2, + source3: TSource3, + customizer?: AssignCustomizer, + thisArg?: any + ): LoDashExplicitObjectWrapper; + + /** + * @see assign + */ + assign( + source1: TSource1, + source2: TSource2, + source3: TSource3, + source4: TSource4, + customizer?: AssignCustomizer, + thisArg?: any + ): LoDashExplicitObjectWrapper; + + /** + * @see _.assign + */ + assign(): LoDashExplicitObjectWrapper; + + /** + * @see _.assign + */ + assign(...otherArgs: any[]): LoDashExplicitObjectWrapper; + } + + //_.create + interface LoDashStatic { + /** + * Creates an object that inherits from the given prototype object. If a properties object is provided its own + * enumerable properties are assigned to the created object. + * + * @param prototype The object to inherit from. + * @param properties The properties to assign to the object. + * @return Returns the new object. + */ + create( + prototype: T, + properties?: U + ): T & U; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.create + */ + create(properties?: U): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.create + */ + create(properties?: U): LoDashExplicitObjectWrapper; + } + + //_.defaults + interface LoDashStatic { + /** + * Assigns own enumerable properties of source object(s) to the destination object for all destination + * properties that resolve to undefined. Once a property is set, additional values of the same property are + * ignored. + * + * Note: This method mutates object. + * + * @param object The destination object. + * @param sources The source objects. + * @return The destination object. + */ + defaults( + object: Obj, + ...sources: {}[] + ): TResult; + + /** + * @see _.defaults + */ + defaults( + object: Obj, + source1: S1, + ...sources: {}[] + ): TResult; + + /** + * @see _.defaults + */ + defaults( + object: Obj, + source1: S1, + source2: S2, + ...sources: {}[] + ): TResult; + + /** + * @see _.defaults + */ + defaults( + object: Obj, + source1: S1, + source2: S2, + source3: S3, + ...sources: {}[] + ): TResult; + + /** + * @see _.defaults + */ + defaults( + object: Obj, + source1: S1, + source2: S2, + source3: S3, + source4: S4, + ...sources: {}[] + ): TResult; + + /** + * @see _.defaults + */ + defaults( + object: {}, + ...sources: {}[] + ): TResult; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.defaults + */ + defaults( + source1: S1, + ...sources: {}[] + ): LoDashImplicitObjectWrapper; + + /** + * @see _.defaults + */ + defaults( + source1: S1, + source2: S2, + ...sources: {}[] + ): LoDashImplicitObjectWrapper; + + /** + * @see _.defaults + */ + defaults( + source1: S1, + source2: S2, + source3: S3, + ...sources: {}[] + ): LoDashImplicitObjectWrapper; + + /** + * @see _.defaults + */ + defaults( + source1: S1, + source2: S2, + source3: S3, + source4: S4, + ...sources: {}[] + ): LoDashImplicitObjectWrapper; + + /** + * @see _.defaults + */ + defaults(): LoDashImplicitObjectWrapper; + + /** + * @see _.defaults + */ + defaults(...sources: {}[]): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.defaults + */ + defaults( + source1: S1, + ...sources: {}[] + ): LoDashExplicitObjectWrapper; + + /** + * @see _.defaults + */ + defaults( + source1: S1, + source2: S2, + ...sources: {}[] + ): LoDashExplicitObjectWrapper; + + /** + * @see _.defaults + */ + defaults( + source1: S1, + source2: S2, + source3: S3, + ...sources: {}[] + ): LoDashExplicitObjectWrapper; + + /** + * @see _.defaults + */ + defaults( + source1: S1, + source2: S2, + source3: S3, + source4: S4, + ...sources: {}[] + ): LoDashExplicitObjectWrapper; + + /** + * @see _.defaults + */ + defaults(): LoDashExplicitObjectWrapper; + + /** + * @see _.defaults + */ + defaults(...sources: {}[]): LoDashExplicitObjectWrapper; + } + + //_.defaultsDeep + interface LoDashStatic { + /** + * This method is like _.defaults except that it recursively assigns default properties. + * @param object The destination object. + * @param sources The source objects. + * @return Returns object. + **/ + defaultsDeep( + object: T, + ...sources: any[]): TResult; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.defaultsDeep + **/ + defaultsDeep(...sources: any[]): LoDashImplicitObjectWrapper + } + + //_.extend + interface LoDashStatic { + /** + * @see assign + */ + extend( + object: TObject, + source: TSource, + customizer?: AssignCustomizer, + thisArg?: any + ): TResult; + + /** + * @see assign + */ + extend( + object: TObject, + source1: TSource1, + source2: TSource2, + customizer?: AssignCustomizer, + thisArg?: any + ): TResult; + + /** + * @see assign + */ + extend( + object: TObject, + source1: TSource1, + source2: TSource2, + source3: TSource3, + customizer?: AssignCustomizer, + thisArg?: any + ): TResult; + + /** + * @see assign + */ + extend + ( + object: TObject, + source1: TSource1, + source2: TSource2, + source3: TSource3, + source4: TSource4, + customizer?: AssignCustomizer, + thisArg?: any + ): TResult; + + /** + * @see _.assign + */ + extend(object: TObject): TObject; + + /** + * @see _.assign + */ + extend( + object: TObject, ...otherArgs: any[] + ): TResult; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.assign + */ + extend( + source: TSource, + customizer?: AssignCustomizer, + thisArg?: any + ): LoDashImplicitObjectWrapper; + + /** + * @see assign + */ + extend( + source1: TSource1, + source2: TSource2, + customizer?: AssignCustomizer, + thisArg?: any + ): LoDashImplicitObjectWrapper; + + /** + * @see assign + */ + extend( + source1: TSource1, + source2: TSource2, + source3: TSource3, + customizer?: AssignCustomizer, + thisArg?: any + ): LoDashImplicitObjectWrapper; + + /** + * @see assign + */ + extend( + source1: TSource1, + source2: TSource2, + source3: TSource3, + source4: TSource4, + customizer?: AssignCustomizer, + thisArg?: any + ): LoDashImplicitObjectWrapper; + + /** + * @see _.assign + */ + extend(): LoDashImplicitObjectWrapper; + + /** + * @see _.assign + */ + extend(...otherArgs: any[]): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.assign + */ + extend( + source: TSource, + customizer?: AssignCustomizer, + thisArg?: any + ): LoDashExplicitObjectWrapper; + + /** + * @see assign + */ + extend( + source1: TSource1, + source2: TSource2, + customizer?: AssignCustomizer, + thisArg?: any + ): LoDashExplicitObjectWrapper; + + /** + * @see assign + */ + extend( + source1: TSource1, + source2: TSource2, + source3: TSource3, + customizer?: AssignCustomizer, + thisArg?: any + ): LoDashExplicitObjectWrapper; + + /** + * @see assign + */ + extend( + source1: TSource1, + source2: TSource2, + source3: TSource3, + source4: TSource4, + customizer?: AssignCustomizer, + thisArg?: any + ): LoDashExplicitObjectWrapper; + + /** + * @see _.assign + */ + extend(): LoDashExplicitObjectWrapper; + + /** + * @see _.assign + */ + extend(...otherArgs: any[]): LoDashExplicitObjectWrapper; + } + + //_.findKey + interface LoDashStatic { + /** + * This method is like _.find except that it returns the key of the first element predicate returns truthy for + * instead of the element itself. + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param object The object to search. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the key of the matched element, else undefined. + */ + findKey( + object: TObject, + predicate?: DictionaryIterator, + thisArg?: any + ): string; + + /** + * @see _.findKey + */ + findKey( + object: TObject, + predicate?: ObjectIterator, + thisArg?: any + ): string; + + /** + * @see _.findKey + */ + findKey( + object: TObject, + predicate?: string, + thisArg?: any + ): string; + + /** + * @see _.findKey + */ + findKey, TObject>( + object: TObject, + predicate?: TWhere + ): string; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.findKey + */ + findKey( + predicate?: DictionaryIterator, + thisArg?: any + ): string; + + /** + * @see _.findKey + */ + findKey( + predicate?: ObjectIterator, + thisArg?: any + ): string; + + /** + * @see _.findKey + */ + findKey( + predicate?: string, + thisArg?: any + ): string; + + /** + * @see _.findKey + */ + findKey>( + predicate?: TWhere + ): string; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.findKey + */ + findKey( + predicate?: DictionaryIterator, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.findKey + */ + findKey( + predicate?: ObjectIterator, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.findKey + */ + findKey( + predicate?: string, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.findKey + */ + findKey>( + predicate?: TWhere + ): LoDashExplicitWrapper; + } + + //_.findLastKey + interface LoDashStatic { + /** + * This method is like _.findKey except that it iterates over elements of a collection in the opposite order. + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param object The object to search. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the key of the matched element, else undefined. + */ + findLastKey( + object: TObject, + predicate?: DictionaryIterator, + thisArg?: any + ): string; + + /** + * @see _.findLastKey + */ + findLastKey( + object: TObject, + predicate?: ObjectIterator, + thisArg?: any + ): string; + + /** + * @see _.findLastKey + */ + findLastKey( + object: TObject, + predicate?: string, + thisArg?: any + ): string; + + /** + * @see _.findLastKey + */ + findLastKey, TObject>( + object: TObject, + predicate?: TWhere + ): string; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.findLastKey + */ + findLastKey( + predicate?: DictionaryIterator, + thisArg?: any + ): string; + + /** + * @see _.findLastKey + */ + findLastKey( + predicate?: ObjectIterator, + thisArg?: any + ): string; + + /** + * @see _.findLastKey + */ + findLastKey( + predicate?: string, + thisArg?: any + ): string; + + /** + * @see _.findLastKey + */ + findLastKey>( + predicate?: TWhere + ): string; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.findLastKey + */ + findLastKey( + predicate?: DictionaryIterator, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.findLastKey + */ + findLastKey( + predicate?: ObjectIterator, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.findLastKey + */ + findLastKey( + predicate?: string, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.findLastKey + */ + findLastKey>( + predicate?: TWhere + ): LoDashExplicitWrapper; + } + + //_.forIn + interface LoDashStatic { + /** + * Iterates over own and inherited enumerable properties of an object invoking iteratee for each property. The + * iteratee is bound to thisArg and invoked with three arguments: (value, key, object). Iteratee functions may + * exit iteration early by explicitly returning false. + * + * @param object The object to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns object. + */ + forIn( + object: Dictionary, + iteratee?: DictionaryIterator, + thisArg?: any + ): Dictionary; + + /** + * @see _.forIn + */ + forIn( + object: T, + iteratee?: ObjectIterator, + thisArg?: any + ): T; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.forIn + */ + forIn( + iteratee?: DictionaryIterator, + thisArg?: any + ): _.LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.forIn + */ + forIn( + iteratee?: DictionaryIterator, + thisArg?: any + ): _.LoDashExplicitObjectWrapper; + } + + //_.forInRight + interface LoDashStatic { + /** + * This method is like _.forIn except that it iterates over properties of object in the opposite order. + * + * @param object The object to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns object. + */ + forInRight( + object: Dictionary, + iteratee?: DictionaryIterator, + thisArg?: any + ): Dictionary; + + /** + * @see _.forInRight + */ + forInRight( + object: T, + iteratee?: ObjectIterator, + thisArg?: any + ): T; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.forInRight + */ + forInRight( + iteratee?: DictionaryIterator, + thisArg?: any + ): _.LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.forInRight + */ + forInRight( + iteratee?: DictionaryIterator, + thisArg?: any + ): _.LoDashExplicitObjectWrapper; + } + + //_.forOwn + interface LoDashStatic { + /** + * Iterates over own enumerable properties of an object invoking iteratee for each property. The iteratee is + * bound to thisArg and invoked with three arguments: (value, key, object). Iteratee functions may exit + * iteration early by explicitly returning false. + * + * @param object The object to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns object. + */ + forOwn( + object: Dictionary, + iteratee?: DictionaryIterator, + thisArg?: any + ): Dictionary; + + /** + * @see _.forOwn + */ + forOwn( + object: T, + iteratee?: ObjectIterator, + thisArg?: any + ): T; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.forOwn + */ + forOwn( + iteratee?: DictionaryIterator, + thisArg?: any + ): _.LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.forOwn + */ + forOwn( + iteratee?: DictionaryIterator, + thisArg?: any + ): _.LoDashExplicitObjectWrapper; + } + + //_.forOwnRight + interface LoDashStatic { + /** + * This method is like _.forOwn except that it iterates over properties of object in the opposite order. + * + * @param object The object to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns object. + */ + forOwnRight( + object: Dictionary, + iteratee?: DictionaryIterator, + thisArg?: any + ): Dictionary; + + /** + * @see _.forOwnRight + */ + forOwnRight( + object: T, + iteratee?: ObjectIterator, + thisArg?: any + ): T; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.forOwnRight + */ + forOwnRight( + iteratee?: DictionaryIterator, + thisArg?: any + ): _.LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.forOwnRight + */ + forOwnRight( + iteratee?: DictionaryIterator, + thisArg?: any + ): _.LoDashExplicitObjectWrapper; + } + + //_.functions + interface LoDashStatic { + /** + * Creates an array of function property names from all enumerable properties, own and inherited, of object. + * + * @alias _.methods + * + * @param object The object to inspect. + * @return Returns the new array of property names. + */ + functions(object: any): string[]; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.functions + */ + functions(): _.LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.functions + */ + functions(): _.LoDashExplicitArrayWrapper; + } + + //_.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|number|boolean|Array, + defaultValue?:TResult + ): TResult; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.get + **/ + get(path: string|number|boolean|Array, + defaultValue?: TResult + ): TResult; + } + + //_.has + interface LoDashStatic { + /** + * Checks if path is a direct property. + * + * @param object The object to query. + * @param path The path to check. + * @return Returns true if path is a direct property, else false. + */ + has( + object: T, + path: StringRepresentable|StringRepresentable[] + ): boolean; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.has + */ + has(path: StringRepresentable|StringRepresentable[]): boolean; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.has + */ + has(path: StringRepresentable|StringRepresentable[]): LoDashExplicitWrapper; + } + + //_.invert + interface LoDashStatic { + /** + * Creates an object composed of the inverted keys and values of object. If object contains duplicate values, + * subsequent values overwrite property assignments of previous values unless multiValue is true. + * + * @param object The object to invert. + * @param multiValue Allow multiple values per key. + * @return Returns the new inverted object. + */ + invert( + object: T, + multiValue?: boolean + ): TResult; + + /** + * @see _.invert + */ + invert( + object: Object, + multiValue?: boolean + ): TResult; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.invert + */ + invert(multiValue?: boolean): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.invert + */ + invert(multiValue?: boolean): LoDashExplicitObjectWrapper; + } + + //_.keys + interface LoDashStatic { + /** + * Creates an array of the own enumerable property names of object. + * + * Note: Non-object values are coerced to objects. See the ES spec for more details. + * + * @param object The object to query. + * @return Returns the array of property names. + */ + keys(object?: any): string[]; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.keys + */ + keys(): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.keys + */ + keys(): LoDashExplicitArrayWrapper; + } + + //_.keysIn + interface LoDashStatic { + /** + * Creates an array of the own and inherited enumerable property names of object. + * + * Note: Non-object values are coerced to objects. + * + * @param object The object to query. + * @return An array of property names. + */ + keysIn(object?: any): string[]; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.keysIn + */ + keysIn(): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.keysIn + */ + keysIn(): LoDashExplicitArrayWrapper; + } + + //_.mapKeys + interface LoDashStatic { + /** + * The opposite of _.mapValues; this method creates an object with the same values as object and keys generated + * by running each own enumerable property of object through iteratee. + * + * @param object The object to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the new mapped object. + */ + mapKeys( + object: List, + iteratee?: ListIterator, + thisArg?: any + ): Dictionary; + + /** + * @see _.mapKeys + */ + mapKeys( + object: Dictionary, + iteratee?: DictionaryIterator, + thisArg?: any + ): Dictionary; + + /** + * @see _.mapKeys + */ + mapKeys( + object: List|Dictionary, + iteratee?: TObject + ): Dictionary; + + /** + * @see _.mapKeys + */ + mapKeys( + object: List|Dictionary, + iteratee?: string, + thisArg?: any + ): Dictionary; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.mapKeys + */ + mapKeys( + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitObjectWrapper>; + + /** + * @see _.mapKeys + */ + mapKeys( + iteratee?: TObject + ): LoDashImplicitObjectWrapper>; + + /** + * @see _.mapKeys + */ + mapKeys( + iteratee?: string, + thisArg?: any + ): LoDashImplicitObjectWrapper>; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.mapKeys + */ + mapKeys( + iteratee?: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashImplicitObjectWrapper>; + + /** + * @see _.mapKeys + */ + mapKeys( + iteratee?: TObject + ): LoDashImplicitObjectWrapper>; + + /** + * @see _.mapKeys + */ + mapKeys( + iteratee?: string, + thisArg?: any + ): LoDashImplicitObjectWrapper>; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.mapKeys + */ + mapKeys( + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.mapKeys + */ + mapKeys( + iteratee?: TObject + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.mapKeys + */ + mapKeys( + iteratee?: string, + thisArg?: any + ): LoDashExplicitObjectWrapper>; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.mapKeys + */ + mapKeys( + iteratee?: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.mapKeys + */ + mapKeys( + iteratee?: TObject + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.mapKeys + */ + mapKeys( + iteratee?: string, + thisArg?: any + ): LoDashExplicitObjectWrapper>; + } + + //_.mapValues + interface LoDashStatic { + /** + * Creates an object with the same keys as object and values generated by running each own + * enumerable property of object through iteratee. The iteratee function is bound to thisArg + * and invoked with three arguments: (value, key, object). + * + * If a property name is provided iteratee the created "_.property" style callback returns + * the property value of the given element. + * + * If a value is also provided for thisArg the creted "_.matchesProperty" style callback returns + * true for elements that have a matching property value, else false;. + * + * If an object is provided for iteratee the created "_.matches" style callback returns true + * for elements that have the properties of the given object, else false. + * + * @param {Object} object The object to iterate over. + * @param {Function|Object|string} [iteratee=_.identity] The function invoked per iteration. + * @param {Object} [thisArg] The `this` binding of `iteratee`. + * @return {Object} Returns the new mapped object. + */ + mapValues(obj: Dictionary, callback: ObjectIterator, thisArg?: any): Dictionary; + mapValues(obj: Dictionary, where: Dictionary): Dictionary; + mapValues(obj: T, pluck: string): TMapped; + mapValues(obj: T, callback: ObjectIterator, thisArg?: any): T; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.mapValues + * TValue is the type of the property values of T. + * TResult is the type output by the ObjectIterator function + */ + mapValues(callback: ObjectIterator, thisArg?: any): LoDashImplicitObjectWrapper>; + + /** + * @see _.mapValues + * TResult is the type of the property specified by pluck. + * T should be a Dictionary> + */ + mapValues(pluck: string): LoDashImplicitObjectWrapper>; + + /** + * @see _.mapValues + * TResult is the type of the properties on the object specified by pluck. + * T should be a Dictionary>> + */ + mapValues(pluck: string, where: Dictionary): LoDashImplicitArrayWrapper>; + + /** + * @see _.mapValues + * TResult is the type of the properties of each object in the values of T + * T should be a Dictionary> + */ + mapValues(where: Dictionary): LoDashImplicitArrayWrapper; + } + + //_.merge + interface MergeCustomizer { + (value: any, srcValue: any, key?: string, object?: Object, source?: Object): any; + } + + interface LoDashStatic { + /** + * Recursively merges own enumerable properties of the source object(s), that don’t resolve to undefined into + * the destination object. Subsequent sources overwrite property assignments of previous sources. If customizer + * is provided it’s invoked to produce the merged values of the destination and source properties. If + * customizer returns undefined merging is handled by the method instead. The customizer is bound to thisArg + * and invoked with five arguments: (objectValue, sourceValue, key, object, source). + * + * @param object The destination object. + * @param source The source objects. + * @param customizer The function to customize assigned values. + * @param thisArg The this binding of customizer. + * @return Returns object. + */ + merge( + object: TObject, + source: TSource, + customizer?: MergeCustomizer, + thisArg?: any + ): TObject & TSource; + + /** + * @see _.merge + */ + merge( + object: TObject, + source1: TSource1, + source2: TSource2, + customizer?: MergeCustomizer, + thisArg?: any + ): TObject & TSource1 & TSource2; + + /** + * @see _.merge + */ + merge( + object: TObject, + source1: TSource1, + source2: TSource2, + source3: TSource3, + customizer?: MergeCustomizer, + thisArg?: any + ): TObject & TSource1 & TSource2 & TSource3; + + /** + * @see _.merge + */ + merge( + object: TObject, + source1: TSource1, + source2: TSource2, + source3: TSource3, + source4: TSource4, + customizer?: MergeCustomizer, + thisArg?: any + ): TObject & TSource1 & TSource2 & TSource3 & TSource4; + + /** + * @see _.merge + */ + merge( + object: any, + ...otherArgs: any[] + ): TResult; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.merge + */ + merge( + source: TSource, + customizer?: MergeCustomizer, + thisArg?: any + ): LoDashImplicitObjectWrapper; + + /** + * @see _.merge + */ + merge( + source1: TSource1, + source2: TSource2, + customizer?: MergeCustomizer, + thisArg?: any + ): LoDashImplicitObjectWrapper; + + /** + * @see _.merge + */ + merge( + source1: TSource1, + source2: TSource2, + source3: TSource3, + customizer?: MergeCustomizer, + thisArg?: any + ): LoDashImplicitObjectWrapper; + + /** + * @see _.merge + */ + merge( + source1: TSource1, + source2: TSource2, + source3: TSource3, + source4: TSource4, + customizer?: MergeCustomizer, + thisArg?: any + ): LoDashImplicitObjectWrapper; + + /** + * @see _.merge + */ + merge( + ...otherArgs: any[] + ): LoDashImplicitObjectWrapper; + } + + //_.methods + interface LoDashStatic { + /** + * @see _.functions + */ + methods(object: any): string[]; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.functions + */ + methods(): _.LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.functions + */ + methods(): _.LoDashExplicitArrayWrapper; + } + + //_.omit + interface LoDashStatic { + /** + * The opposite of _.pick; this method creates an object composed of the own and inherited enumerable + * properties of object that are not omitted. + * + * @param object The source object. + * @param predicate The function invoked per iteration or property names to omit, specified as individual + * property names or arrays of property names. + * @param thisArg The this binding of predicate. + * @return Returns the new object. + */ + omit( + object: T, + predicate: ObjectIterator, + thisArg?: any + ): TResult; + + /** + * @see _.omit + */ + omit( + object: T, + ...predicate: (StringRepresentable|StringRepresentable[])[] + ): TResult; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.omit + */ + omit( + predicate: ObjectIterator, + thisArg?: any + ): LoDashImplicitObjectWrapper; + + /** + * @see _.omit + */ + omit( + ...predicate: (StringRepresentable|StringRepresentable[])[] + ): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.omit + */ + omit( + predicate: ObjectIterator, + thisArg?: any + ): LoDashExplicitObjectWrapper; + + /** + * @see _.omit + */ + omit( + ...predicate: (StringRepresentable|StringRepresentable[])[] + ): LoDashExplicitObjectWrapper; + } + + //_.pairs + interface LoDashStatic { + /** + * Creates a two dimensional array of the key-value pairs for object, e.g. [[key1, value1], [key2, value2]]. + * + * @param object The object to query. + * @return Returns the new array of key-value pairs. + */ + pairs(object?: T): any[][]; + + pairs(object?: T): TResult[][]; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.pairs + */ + pairs(): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.pairs + */ + pairs(): LoDashExplicitArrayWrapper; + } + + //_.pick + interface LoDashStatic { + /** + * Creates an object composed of the picked object properties. Property names may be specified as individual + * arguments or as arrays of property names. If predicate is provided it’s invoked for each property of object + * picking the properties predicate returns truthy for. The predicate is bound to thisArg and invoked with + * three arguments: (value, key, object). + * + * @param object The source object. + * @param predicate The function invoked per iteration or property names to pick, specified as individual + * property names or arrays of property names. + * @param thisArg The this binding of predicate. + * @return Returns the new object. + */ + pick( + object: T, + predicate: ObjectIterator, + thisArg?: any + ): TResult; + + /** + * @see _.pick + */ + pick( + object: T, + ...predicate: (StringRepresentable|StringRepresentable[])[] + ): TResult; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.pick + */ + pick( + predicate: ObjectIterator, + thisArg?: any + ): LoDashImplicitObjectWrapper; + + /** + * @see _.pick + */ + pick( + ...predicate: (StringRepresentable|StringRepresentable[])[] + ): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.pick + */ + pick( + predicate: ObjectIterator, + thisArg?: any + ): LoDashExplicitObjectWrapper; + + /** + * @see _.pick + */ + pick( + ...predicate: (StringRepresentable|StringRepresentable[])[] + ): LoDashExplicitObjectWrapper; + } + + //_.result + interface LoDashStatic { + /** + * This method is like _.get except that if the resolved value is a function it’s invoked with the this binding + * of its parent object and its result is returned. + * + * @param object The object to query. + * @param path The path of the property to resolve. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + result( + object: TObject, + path: number|string|boolean|Array, + defaultValue?: TResult + ): TResult; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.result + */ + result( + path: number|string|boolean|Array, + defaultValue?: TResult + ): TResult; + } + + //_.set + interface LoDashStatic { + /** + * Sets the property value of path on object. If a portion of path does not exist it’s created. + * + * @param object The object to augment. + * @param path The path of the property to set. + * @param value The value to set. + * @return Returns object. + */ + set( + object: T, + path: StringRepresentable|StringRepresentable[], + value: any + ): T; + + /** + * @see _.set + */ + set( + object: T, + path: StringRepresentable|StringRepresentable[], + value: V + ): T; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.set + */ + set( + path: StringRepresentable|StringRepresentable[], + value: V + ): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.set + */ + set( + path: StringRepresentable|StringRepresentable[], + value: V + ): LoDashExplicitObjectWrapper; + } + + //_.transform + interface LoDashStatic { + /** + * An alternative to _.reduce; this method transforms object to a new accumulator object which is the result of + * running each of its own enumerable properties through iteratee, with each invocation potentially mutating + * the accumulator object. The iteratee is bound to thisArg and invoked with four arguments: (accumulator, + * value, key, object). Iteratee functions may exit iteration early by explicitly returning false. + * + * @param object The object to iterate over. + * @param iteratee The function invoked per iteration. + * @param accumulator The custom accumulator value. + * @param thisArg The this binding of iteratee. + * @return Returns the accumulated value. + */ + transform( + object: T[], + iteratee?: MemoVoidArrayIterator, + accumulator?: TResult[], + thisArg?: any + ): TResult[]; + + /** + * @see _.transform + */ + transform( + object: T[], + iteratee?: MemoVoidArrayIterator>, + accumulator?: Dictionary, + thisArg?: any + ): Dictionary; + + /** + * @see _.transform + */ + transform( + object: Dictionary, + iteratee?: MemoVoidDictionaryIterator>, + accumulator?: Dictionary, + thisArg?: any + ): Dictionary; + + /** + * @see _.transform + */ + transform( + object: Dictionary, + iteratee?: MemoVoidDictionaryIterator, + accumulator?: TResult[], + thisArg?: any + ): TResult[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.transform + */ + transform( + iteratee?: MemoVoidArrayIterator, + accumulator?: TResult[], + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.transform + */ + transform( + iteratee?: MemoVoidArrayIterator>, + accumulator?: Dictionary, + thisArg?: any + ): LoDashImplicitObjectWrapper>; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.transform + */ + transform( + iteratee?: MemoVoidDictionaryIterator>, + accumulator?: Dictionary, + thisArg?: any + ): LoDashImplicitObjectWrapper>; + + /** + * @see _.transform + */ + transform( + iteratee?: MemoVoidDictionaryIterator, + accumulator?: TResult[], + thisArg?: any + ): LoDashImplicitArrayWrapper; + } + + //_.values + interface LoDashStatic { + /** + * Creates an array of the own enumerable property values of object. + * + * @param object The object to query. + * @return Returns an array of property values. + */ + values(object?: any): T[]; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.values + */ + values(): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.values + */ + values(): LoDashExplicitArrayWrapper; + } + + //_.valuesIn + interface LoDashStatic { + /** + * Creates an array of the own and inherited enumerable property values of object. + * + * @param object The object to query. + * @return Returns the array of property values. + */ + valuesIn(object?: any): T[]; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.valuesIn + */ + valuesIn(): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.valuesIn + */ + valuesIn(): LoDashExplicitArrayWrapper; + } + + /********** + * String * + **********/ + + //_.camelCase + interface LoDashStatic { + /** + * Converts string to camel case. + * + * @param string The string to convert. + * @return Returns the camel cased string. + */ + camelCase(string?: string): string; + } + + interface LoDashImplicitWrapper { + /** + * @see _.camelCase + */ + camelCase(): string; + } + + interface LoDashExplicitWrapper { + /** + * @see _.camelCase + */ + camelCase(): LoDashExplicitWrapper; + } + + //_.capitalize + interface LoDashStatic { + capitalize(string?: string): string; + } + + interface LoDashImplicitWrapper { + /** + * @see _.capitalize + */ + capitalize(): string; + } + + interface LoDashExplicitWrapper { + /** + * @see _.capitalize + */ + capitalize(): LoDashExplicitWrapper; + } + + //_.deburr + interface LoDashStatic { + /** + * Deburrs string by converting latin-1 supplementary letters to basic latin letters and removing combining + * diacritical marks. + * + * @param string The string to deburr. + * @return Returns the deburred string. + */ + deburr(string?: string): string; + } + + interface LoDashImplicitWrapper { + /** + * @see _.deburr + */ + deburr(): string; + } + + interface LoDashExplicitWrapper { + /** + * @see _.deburr + */ + deburr(): LoDashExplicitWrapper; + } + + //_.endsWith + interface LoDashStatic { + /** + * Checks if string ends with the given target string. + * + * @param string The string to search. + * @param target The string to search for. + * @param position The position to search from. + * @return Returns true if string ends with target, else false. + */ + endsWith( + string?: string, + target?: string, + position?: number + ): boolean; + } + + interface LoDashImplicitWrapper { + /** + * @see _.endsWith + */ + endsWith( + target?: string, + position?: number + ): boolean; + } + + interface LoDashExplicitWrapper { + /** + * @see _.endsWith + */ + endsWith( + target?: string, + position?: number + ): LoDashExplicitWrapper; + } + + // _.escape + interface LoDashStatic { + /** + * Converts the characters "&", "<", ">", '"', "'", and "`", in string to their corresponding HTML entities. + * + * Note: No other characters are escaped. To escape additional characters use a third-party library like he. + * + * Though the ">" character is escaped for symmetry, characters like ">" and "/" don’t need escaping in HTML + * and have no special meaning unless they're part of a tag or unquoted attribute value. See Mathias Bynens’s + * article (under "semi-related fun fact") for more details. + * + * Backticks are escaped because in Internet Explorer < 9, they can break out of attribute values or HTML + * comments. See #59, #102, #108, and #133 of the HTML5 Security Cheatsheet for more details. + * + * When working with HTML you should always quote attribute values to reduce XSS vectors. + * + * @param string The string to escape. + * @return Returns the escaped string. + */ + escape(string?: string): string; + } + + interface LoDashImplicitWrapper { + /** + * @see _.escape + */ + escape(): string; + } + + interface LoDashExplicitWrapper { + /** + * @see _.escape + */ + escape(): LoDashExplicitWrapper; + } + + // _.escapeRegExp + interface LoDashStatic { + /** + * Escapes the RegExp special characters "\", "/", "^", "$", ".", "|", "?", "*", "+", "(", ")", "[", "]", + * "{" and "}" in string. + * + * @param string The string to escape. + * @return Returns the escaped string. + */ + escapeRegExp(string?: string): string; + } + + interface LoDashImplicitWrapper { + /** + * @see _.escapeRegExp + */ + escapeRegExp(): string; + } + + interface LoDashExplicitWrapper { + /** + * @see _.escapeRegExp + */ + escapeRegExp(): LoDashExplicitWrapper; + } + + //_.kebabCase + interface LoDashStatic { + /** + * Converts string to kebab case. + * + * @param string The string to convert. + * @return Returns the kebab cased string. + */ + kebabCase(string?: string): string; + } + + interface LoDashImplicitWrapper { + /** + * @see _.kebabCase + */ + kebabCase(): string; + } + + interface LoDashExplicitWrapper { + /** + * @see _.kebabCase + */ + kebabCase(): LoDashExplicitWrapper; + } + + //_.pad + interface LoDashStatic { + /** + * Pads string on the left and right sides if it’s shorter than length. Padding characters are truncated if + * they can’t be evenly divided by length. + * + * @param string The string to pad. + * @param length The padding length. + * @param chars The string used as padding. + * @return Returns the padded string. + */ + pad( + string?: string, + length?: number, + chars?: string + ): string; + } + + interface LoDashImplicitWrapper { + /** + * @see _.pad + */ + pad( + length?: number, + chars?: string + ): string; + } + + interface LoDashExplicitWrapper { + /** + * @see _.pad + */ + pad( + length?: number, + chars?: string + ): LoDashExplicitWrapper; + } + + //_.padLeft + interface LoDashStatic { + /** + * Pads string on the left side if it’s shorter than length. Padding characters are truncated if they exceed + * length. + * + * @param string The string to pad. + * @param length The padding length. + * @param chars The string used as padding. + * @return Returns the padded string. + */ + padLeft( + string?: string, + length?: number, + chars?: string + ): string; + } + + interface LoDashImplicitWrapper { + /** + * @see _.padLeft + */ + padLeft( + length?: number, + chars?: string + ): string; + } + + interface LoDashExplicitWrapper { + /** + * @see _.padLeft + */ + padLeft( + length?: number, + chars?: string + ): LoDashExplicitWrapper; + } + + //_.padRight + interface LoDashStatic { + /** + * Pads string on the right side if it’s shorter than length. Padding characters are truncated if they exceed + * length. + * + * @param string The string to pad. + * @param length The padding length. + * @param chars The string used as padding. + * @return Returns the padded string. + */ + padRight( + string?: string, + length?: number, + chars?: string + ): string; + } + + interface LoDashImplicitWrapper { + /** + * @see _.padRight + */ + padRight( + length?: number, + chars?: string + ): string; + } + + interface LoDashExplicitWrapper { + /** + * @see _.padRight + */ + padRight( + length?: number, + chars?: string + ): LoDashExplicitWrapper; + } + + //_.parseInt + interface LoDashStatic { + /** + * Converts string to an integer of the specified radix. If radix is undefined or 0, a radix of 10 is used + * unless value is a hexadecimal, in which case a radix of 16 is used. + * + * Note: This method aligns with the ES5 implementation of parseInt. + * + * @param string The string to convert. + * @param radix The radix to interpret value by. + * @return Returns the converted integer. + */ + parseInt( + string: string, + radix?: number + ): number; + } + + interface LoDashImplicitWrapper { + /** + * @see _.parseInt + */ + parseInt(radix?: number): number; + } + + interface LoDashExplicitWrapper { + /** + * @see _.parseInt + */ + parseInt(radix?: number): LoDashExplicitWrapper; + } + + //_.repeat + interface LoDashStatic { + /** + * Repeats the given string n times. + * + * @param string The string to repeat. + * @param n The number of times to repeat the string. + * @return Returns the repeated string. + */ + repeat( + string?: string, + n?: number + ): string; + } + + interface LoDashImplicitWrapper { + /** + * @see _.repeat + */ + repeat(n?: number): string; + } + + interface LoDashExplicitWrapper { + /** + * @see _.repeat + */ + repeat(n?: number): LoDashExplicitWrapper; + } + + //_.snakeCase + interface LoDashStatic { + /** + * Converts string to snake case. + * + * @param string The string to convert. + * @return Returns the snake cased string. + */ + snakeCase(string?: string): string; + } + + interface LoDashImplicitWrapper { + /** + * @see _.snakeCase + */ + snakeCase(): string; + } + + interface LoDashExplicitWrapper { + /** + * @see _.snakeCase + */ + snakeCase(): LoDashExplicitWrapper; + } + + //_.startCase + interface LoDashStatic { + /** + * Converts string to start case. + * + * @param string The string to convert. + * @return Returns the start cased string. + */ + startCase(string?: string): string; + } + + interface LoDashImplicitWrapper { + /** + * @see _.startCase + */ + startCase(): string; + } + + interface LoDashExplicitWrapper { + /** + * @see _.startCase + */ + startCase(): LoDashExplicitWrapper; + } + + //_.startsWith + interface LoDashStatic { + /** + * Checks if string starts with the given target string. + * + * @param string The string to search. + * @param target The string to search for. + * @param position The position to search from. + * @return Returns true if string starts with target, else false. + */ + startsWith( + string?: string, + target?: string, + position?: number + ): boolean; + } + + interface LoDashImplicitWrapper { + /** + * @see _.startsWith + */ + startsWith( + target?: string, + position?: number + ): boolean; + } + + interface LoDashExplicitWrapper { + /** + * @see _.startsWith + */ + startsWith( + target?: string, + position?: number + ): LoDashExplicitWrapper; + } + + //_.template + interface TemplateOptions extends TemplateSettings { + /** + * The sourceURL of the template's compiled source. + */ + sourceURL?: string; + } + + interface TemplateExecutor { + (data?: Object): string; + source: string; + } + + interface LoDashStatic { + /** + * Creates a compiled template function that can interpolate data properties in "interpolate" delimiters, + * HTML-escape interpolated data properties in "escape" delimiters, and execute JavaScript in "evaluate" + * delimiters. Data properties may be accessed as free variables in the template. If a setting object is + * provided it takes precedence over _.templateSettings values. + * + * Note: In the development build _.template utilizes + * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl) for easier + * debugging. + * + * For more information on precompiling templates see + * [lodash's custom builds documentation](https://lodash.com/custom-builds). + * + * For more information on Chrome extension sandboxes see + * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval). + * + * @param string The template string. + * @param options The options object. + * @param options.escape The HTML "escape" delimiter. + * @param options.evaluate The "evaluate" delimiter. + * @param options.imports An object to import into the template as free variables. + * @param options.interpolate The "interpolate" delimiter. + * @param options.sourceURL The sourceURL of the template's compiled source. + * @param options.variable The data object variable name. + * @return Returns the compiled template function. + */ + template( + string: string, + options?: TemplateOptions + ): TemplateExecutor; + } + + interface LoDashImplicitWrapper { + /** + * @see _.template + */ + template(options?: TemplateOptions): TemplateExecutor; + } + + interface LoDashExplicitWrapper { + /** + * @see _.template + */ + template(options?: TemplateOptions): LoDashExplicitObjectWrapper; + } + + //_.trim + interface LoDashStatic { + /** + * Removes leading and trailing whitespace or specified characters from string. + * + * @param string The string to trim. + * @param chars The characters to trim. + * @return Returns the trimmed string. + */ + trim( + string?: string, + chars?: string + ): string; + } + + interface LoDashImplicitWrapper { + /** + * @see _.trim + */ + trim(chars?: string): string; + } + + interface LoDashExplicitWrapper { + /** + * @see _.trim + */ + trim(chars?: string): LoDashExplicitWrapper; + } + + //_.trimLeft + interface LoDashStatic { + /** + * Removes leading whitespace or specified characters from string. + * + * @param string The string to trim. + * @param chars The characters to trim. + * @return Returns the trimmed string. + */ + trimLeft( + string?: string, + chars?: string + ): string; + } + + interface LoDashImplicitWrapper { + /** + * @see _.trimLeft + */ + trimLeft(chars?: string): string; + } + + interface LoDashExplicitWrapper { + /** + * @see _.trimLeft + */ + trimLeft(chars?: string): LoDashExplicitWrapper; + } + + //_.trimRight + interface LoDashStatic { + /** + * Removes trailing whitespace or specified characters from string. + * + * @param string The string to trim. + * @param chars The characters to trim. + * @return Returns the trimmed string. + */ + trimRight( + string?: string, + chars?: string + ): string; + } + + interface LoDashImplicitWrapper { + /** + * @see _.trimRight + */ + trimRight(chars?: string): string; + } + + interface LoDashExplicitWrapper { + /** + * @see _.trimRight + */ + trimRight(chars?: string): LoDashExplicitWrapper; + } + + //_.trunc + interface TruncOptions { + /** The maximum string length. */ + length?: number; + /** The string to indicate text is omitted. */ + omission?: string; + /** The separator pattern to truncate to. */ + separator?: string|RegExp; + } + + interface LoDashStatic { + /** + * Truncates string if it’s longer than the given maximum string length. The last characters of the truncated + * string are replaced with the omission string which defaults to "…". + * + * @param string The string to truncate. + * @param options The options object or maximum string length. + * @return Returns the truncated string. + */ + trunc( + string?: string, + options?: TruncOptions|number + ): string; + } + + interface LoDashImplicitWrapper { + /** + * @see _.trunc + */ + trunc(options?: TruncOptions|number): string; + } + + interface LoDashExplicitWrapper { + /** + * @see _.trunc + */ + trunc(options?: TruncOptions|number): LoDashExplicitWrapper; + } + + //_.unescape + interface LoDashStatic { + /** + * The inverse of _.escape; this method converts the HTML entities &, <, >, ", ', and ` + * in string to their corresponding characters. + * + * @param string The string to unescape. + * @return Returns the unescaped string. + */ + unescape(string?: string): string; + } + + interface LoDashImplicitWrapper { + /** + * @see _.unescape + */ + unescape(): string; + } + + interface LoDashExplicitWrapper { + /** + * @see _.unescape + */ + unescape(): LoDashExplicitWrapper; + } + + //_.words + interface LoDashStatic { + /** + * Splits string into an array of its words. + * + * @param string The string to inspect. + * @param pattern The pattern to match words. + * @return Returns the words of string. + */ + words( + string?: string, + pattern?: string|RegExp + ): string[]; + } + + interface LoDashImplicitWrapper { + /** + * @see _.words + */ + words(pattern?: string|RegExp): string[]; + } + + interface LoDashExplicitWrapper { + /** + * @see _.words + */ + words(pattern?: string|RegExp): LoDashExplicitArrayWrapper; + } + + /*********** + * Utility * + ***********/ + + //_.attempt + interface LoDashStatic { + /** + * Attempts to invoke func, returning either the result or the caught error object. Any additional arguments + * are provided to func when it’s invoked. + * + * @param func The function to attempt. + * @return Returns the func result or error object. + */ + attempt(func: (...args: any[]) => TResult): TResult|Error; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.attempt + */ + attempt(): TResult|Error; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.attempt + */ + attempt(): LoDashExplicitObjectWrapper; + } + + //_.callback + interface LoDashStatic { + /** + * Creates a function that invokes func with the this binding of thisArg and arguments of the created function. + * If func is a property name the created callback returns the property value for a given element. If func is + * an object the created callback returns true for elements that contain the equivalent object properties, + * otherwise it returns false. + * + * @param func The value to convert to a callback. + * @param thisArg The this binding of func. + * @result Returns the callback. + */ + callback( + func: Function, + thisArg?: any + ): (...args: any[]) => TResult; + + /** + * @see _.callback + */ + callback( + func: string, + thisArg?: any + ): (object: any) => TResult; + + /** + * @see _.callback + */ + callback( + func: Object, + thisArg?: any + ): (object: any) => boolean; + + /** + * @see _.callback + */ + callback(): (value: TResult) => TResult; + } + + interface LoDashImplicitWrapper { + /** + * @see _.callback + */ + callback(thisArg?: any): LoDashImplicitObjectWrapper<(object: any) => TResult>; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.callback + */ + callback(thisArg?: any): LoDashImplicitObjectWrapper<(object: any) => boolean>; + + /** + * @see _.callback + */ + callback(thisArg?: any): LoDashImplicitObjectWrapper<(...args: any[]) => TResult>; + } + + interface LoDashExplicitWrapper { + /** + * @see _.callback + */ + callback(thisArg?: any): LoDashExplicitObjectWrapper<(object: any) => TResult>; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.callback + */ + callback(thisArg?: any): LoDashExplicitObjectWrapper<(object: any) => boolean>; + + /** + * @see _.callback + */ + callback(thisArg?: any): LoDashExplicitObjectWrapper<(...args: any[]) => TResult>; + } + + //_.constant + interface LoDashStatic { + /** + * Creates a function that returns value. + * + * @param value The value to return from the new function. + * @return Returns the new function. + */ + constant(value: T): () => T; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.constant + */ + constant(): LoDashImplicitObjectWrapper<() => TResult>; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.constant + */ + constant(): LoDashExplicitObjectWrapper<() => TResult>; + } + + //_.identity + interface LoDashStatic { + /** + * This method returns the first argument provided to it. + * @param value Any value. + * @return Returns value. + */ + identity(value?: T): T; + } + + interface LoDashImplicitWrapper { + /** + * @see _.identity + */ + identity(): T; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.identity + */ + identity(): T[]; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.identity + */ + identity(): T; + } + + //_.iteratee + interface LoDashStatic { + /** + * @see _.callback + */ + iteratee( + func: Function, + thisArg?: any + ): (...args: any[]) => TResult; + + /** + * @see _.callback + */ + iteratee( + func: string, + thisArg?: any + ): (object: any) => TResult; + + /** + * @see _.callback + */ + iteratee( + func: Object, + thisArg?: any + ): (object: any) => boolean; + + /** + * @see _.callback + */ + iteratee(): (value: TResult) => TResult; + } + + interface LoDashImplicitWrapper { + /** + * @see _.callback + */ + iteratee(thisArg?: any): LoDashImplicitObjectWrapper<(object: any) => TResult>; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.callback + */ + iteratee(thisArg?: any): LoDashImplicitObjectWrapper<(object: any) => boolean>; + + /** + * @see _.callback + */ + iteratee(thisArg?: any): LoDashImplicitObjectWrapper<(...args: any[]) => TResult>; + } + + interface LoDashExplicitWrapper { + /** + * @see _.callback + */ + iteratee(thisArg?: any): LoDashExplicitObjectWrapper<(object: any) => TResult>; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.callback + */ + iteratee(thisArg?: any): LoDashExplicitObjectWrapper<(object: any) => boolean>; + + /** + * @see _.callback + */ + iteratee(thisArg?: any): LoDashExplicitObjectWrapper<(...args: any[]) => TResult>; + } + + //_.matches + interface LoDashStatic { + /** + * Creates a function that performs a deep comparison between a given object and source, returning true if the + * given object has equivalent property values, else false. + * + * Note: This method supports comparing arrays, booleans, Date objects, numbers, Object objects, regexes, and + * strings. Objects are compared by their own, not inherited, enumerable properties. For comparing a single own + * or inherited property value see _.matchesProperty. + * + * @param source The object of property values to match. + * @return Returns the new function. + */ + matches(source: T): (value: any) => boolean; + + /** + * @see _.matches + */ + matches(source: T): (value: V) => boolean; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.matches + */ + matches(): LoDashImplicitObjectWrapper<(value: V) => boolean>; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.matches + */ + matches(): LoDashExplicitObjectWrapper<(value: V) => boolean>; + } + + //_.matchesProperty + interface LoDashStatic { + /** + * Creates a function that compares the property value of path on a given object to value. + * + * Note: This method supports comparing arrays, booleans, Date objects, numbers, Object objects, regexes, and + * strings. Objects are compared by their own, not inherited, enumerable properties. + * + * @param path The path of the property to get. + * @param srcValue The value to match. + * @return Returns the new function. + */ + matchesProperty( + path: StringRepresentable|StringRepresentable[], + srcValue: T + ): (value: any) => boolean; + + /** + * @see _.matchesProperty + */ + matchesProperty( + path: StringRepresentable|StringRepresentable[], + srcValue: T + ): (value: V) => boolean; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.matchesProperty + */ + matchesProperty( + srcValue: SrcValue + ): LoDashImplicitObjectWrapper<(value: any) => boolean>; + + /** + * @see _.matchesProperty + */ + matchesProperty( + srcValue: SrcValue + ): LoDashImplicitObjectWrapper<(value: Value) => boolean>; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.matchesProperty + */ + matchesProperty( + srcValue: SrcValue + ): LoDashExplicitObjectWrapper<(value: any) => boolean>; + + /** + * @see _.matchesProperty + */ + matchesProperty( + srcValue: SrcValue + ): LoDashExplicitObjectWrapper<(value: Value) => boolean>; + } + + //_.method + interface LoDashStatic { + /** + * Creates a function that invokes the method at path on a given object. Any additional arguments are provided + * to the invoked method. + * + * @param path The path of the method to invoke. + * @param args The arguments to invoke the method with. + * @return Returns the new function. + */ + method( + path: string|StringRepresentable[], + ...args: any[] + ): (object: TObject) => TResult; + + /** + * @see _.method + */ + method( + path: string|StringRepresentable[], + ...args: any[] + ): (object: any) => TResult; + } + + interface LoDashImplicitWrapper { + /** + * @see _.method + */ + method(...args: any[]): LoDashImplicitObjectWrapper<(object: TObject) => TResult>; + + /** + * @see _.method + */ + method(...args: any[]): LoDashImplicitObjectWrapper<(object: any) => TResult>; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.method + */ + method(...args: any[]): LoDashImplicitObjectWrapper<(object: TObject) => TResult>; + + /** + * @see _.method + */ + method(...args: any[]): LoDashImplicitObjectWrapper<(object: any) => TResult>; + } + + interface LoDashExplicitWrapper { + /** + * @see _.method + */ + method(...args: any[]): LoDashExplicitObjectWrapper<(object: TObject) => TResult>; + + /** + * @see _.method + */ + method(...args: any[]): LoDashExplicitObjectWrapper<(object: any) => TResult>; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.method + */ + method(...args: any[]): LoDashExplicitObjectWrapper<(object: TObject) => TResult>; + + /** + * @see _.method + */ + method(...args: any[]): LoDashExplicitObjectWrapper<(object: any) => TResult>; + } + + //_.methodOf + interface LoDashStatic { + /** + * The opposite of _.method; this method creates a function that invokes the method at a given path on object. + * Any additional arguments are provided to the invoked method. + * + * @param object The object to query. + * @param args The arguments to invoke the method with. + * @return Returns the new function. + */ + methodOf( + object: TObject, + ...args: any[] + ): (path: StringRepresentable|StringRepresentable[]) => TResult; + + /** + * @see _.methodOf + */ + methodOf( + object: {}, + ...args: any[] + ): (path: StringRepresentable|StringRepresentable[]) => TResult; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.methodOf + */ + methodOf( + ...args: any[] + ): LoDashImplicitObjectWrapper<(path: StringRepresentable|StringRepresentable[]) => TResult>; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.methodOf + */ + methodOf( + ...args: any[] + ): LoDashExplicitObjectWrapper<(path: StringRepresentable|StringRepresentable[]) => TResult>; + } + + //_.mixin + interface MixinOptions { + chain?: boolean; + } + + interface LoDashStatic { + /** + * Adds all own enumerable function properties of a source object to the destination object. If object is a + * function then methods are added to its prototype as well. + * + * Note: Use _.runInContext to create a pristine lodash function to avoid conflicts caused by modifying + * the original. + * + * @param object The destination object. + * @param source The object of functions to add. + * @param options The options object. + * @param options.chain Specify whether the functions added are chainable. + * @return Returns object. + */ + mixin( + object: TObject, + source: Dictionary, + options?: MixinOptions + ): TResult; + + /** + * @see _.mixin + */ + mixin( + source: Dictionary, + options?: MixinOptions + ): TResult; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.mixin + */ + mixin( + source: Dictionary, + options?: MixinOptions + ): LoDashImplicitObjectWrapper; + + /** + * @see _.mixin + */ + mixin( + options?: MixinOptions + ): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.mixin + */ + mixin( + source: Dictionary, + options?: MixinOptions + ): LoDashExplicitObjectWrapper; + + /** + * @see _.mixin + */ + mixin( + options?: MixinOptions + ): LoDashExplicitObjectWrapper; + } + + //_.noConflict + interface LoDashStatic { + /** + * Reverts the _ variable to its previous value and returns a reference to the lodash function. + * + * @return Returns the lodash function. + */ + noConflict(): typeof _; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.noConflict + */ + noConflict(): typeof _; + } + + //_.noop + interface LoDashStatic { + /** + * A no-operation function that returns undefined regardless of the arguments it receives. + * + * @return undefined + */ + noop(...args: any[]): void; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.noop + */ + noop(...args: any[]): void; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.noop + */ + noop(...args: any[]): _.LoDashExplicitWrapper; + } + + //_.property + interface LoDashStatic { + /** + * Creates a function that returns the property value at path on a given object. + * + * @param path The path of the property to get. + * @return Returns the new function. + */ + property(path: StringRepresentable|StringRepresentable[]): (obj: TObj) => TResult; + } + + interface LoDashImplicitWrapper { + /** + * @see _.property + */ + property(): LoDashImplicitObjectWrapper<(obj: TObj) => TResult>; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.property + */ + property(): LoDashImplicitObjectWrapper<(obj: TObj) => TResult>; + } + + interface LoDashExplicitWrapper { + /** + * @see _.property + */ + property(): LoDashExplicitObjectWrapper<(obj: TObj) => TResult>; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.property + */ + property(): LoDashExplicitObjectWrapper<(obj: TObj) => TResult>; + } + + //_.propertyOf + interface LoDashStatic { + /** + * The opposite of _.property; this method creates a function that returns the property value at a given path + * on object. + * + * @param object The object to query. + * @return Returns the new function. + */ + propertyOf(object: T): (path: string|string[]) => any; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.propertyOf + */ + propertyOf(): LoDashImplicitObjectWrapper<(path: string|string[]) => any>; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.propertyOf + */ + propertyOf(): LoDashExplicitObjectWrapper<(path: string|string[]) => any>; + } + + //_.range + interface LoDashStatic { + /** + * Creates an array of numbers (positive and/or negative) progressing from start up to, but not including, end. + * If end is not specified it’s set to start with start then set to 0. If end is less than start a zero-length + * range is created unless a negative step is specified. + * + * @param start The start of the range. + * @param end The end of the range. + * @param step The value to increment or decrement by. + * @return Returns a new range array. + */ + range( + start: number, + end: number, + step?: number + ): number[]; + + /** + * @see _.range + */ + range( + end: number, + step?: number + ): number[]; + } + + interface LoDashImplicitWrapper { + /** + * @see _.range + */ + range( + end?: number, + step?: number + ): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.range + */ + range( + end?: number, + step?: number + ): LoDashExplicitArrayWrapper; + } + + //_.runInContext + interface LoDashStatic { + /** + * Create a new pristine lodash function using the given context object. + * + * @param context The context object. + * @return Returns a new lodash function. + */ + runInContext(context?: Object): typeof _; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.runInContext + */ + runInContext(): typeof _; + } + + //_.times + interface LoDashStatic { + /** + * Invokes the iteratee function n times, returning an array of the results of each invocation. The iteratee is + * bound to thisArg and invoked with one argument; (index). + * + * @param n The number of times to invoke iteratee. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the array of results. + */ + times( + n: number, + iteratee: (num: number) => TResult, + thisArg?: any + ): TResult[]; + + /** + * @see _.times + */ + times(n: number): number[]; + } + + interface LoDashImplicitWrapper { + /** + * @see _.times + */ + times( + iteratee: (num: number) => TResult, + thisArgs?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.times + */ + times(): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.times + */ + times( + iteratee: (num: number) => TResult, + thisArgs?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.times + */ + times(): LoDashExplicitArrayWrapper; + } + + //_.uniqueId + interface LoDashStatic { + /** + * Generates a unique ID. If prefix is provided the ID is appended to it. + * + * @param prefix The value to prefix the ID with. + * @return Returns the unique ID. + */ + uniqueId(prefix?: string): string; + } + + interface LoDashImplicitWrapper { + /** + * @see _.uniqueId + */ + uniqueId(): string; + } + + interface LoDashExplicitWrapper { + /** + * @see _.uniqueId + */ + uniqueId(): LoDashExplicitWrapper; + } + + interface ListIterator { + (value: T, index: number, collection: List): TResult; + } + + interface DictionaryIterator { + (value: T, key?: string, collection?: Dictionary): TResult; + } + + interface NumericDictionaryIterator { + (value: T, key?: number, collection?: Dictionary): TResult; + } + + interface ObjectIterator { + (element: T, key?: string, collection?: any): TResult; + } + + interface StringIterator { + (char: string, index?: number, string?: string): TResult; + } + + interface MemoVoidIterator { + (prev: TResult, curr: T, indexOrKey?: any, list?: T[]): void; + } + interface MemoIterator { + (prev: TResult, curr: T, indexOrKey?: any, list?: T[]): TResult; + } + + interface MemoVoidArrayIterator { + (acc: TResult, curr: T, index?: number, arr?: T[]): void; + } + interface MemoVoidDictionaryIterator { + (acc: TResult, curr: T, key?: string, dict?: Dictionary): void; + } + + //interface Collection {} + + // Common interface between Arrays and jQuery objects + interface List { + [index: number]: T; + length: number; + } + + interface Dictionary { + [index: string]: T; + } + + interface NumericDictionary { + [index: number]: T; + } + + interface StringRepresentable { + toString(): string; + } + + interface Cancelable { + cancel(): void; + } +} + +declare module "lodash" { + export = _; +} diff --git a/lodash/lodash-tests-3.10.ts b/lodash/lodash-tests-3.10.ts new file mode 100644 index 000000000..efe2e1b3e --- /dev/null +++ b/lodash/lodash-tests-3.10.ts @@ -0,0 +1,10016 @@ +/// + +declare var $: any, jQuery: any; + +interface IFoodOrganic { + name: string; + organic: boolean; +} + +interface IFoodType { + name: string; + type: string; +} + +interface IFoodCombined { + name: string; + organic: boolean; + type: string; +} + +interface IStoogesQuote { + name: string; + quotes: string[]; +} + +interface IStoogesAge { + name: string; + age: number; +} + +interface IStoogesCombined { + name: string; + age: number; + quotes: string[]; +} + +interface IKey { + dir: string; + code: number; +} + +interface IDictionary { + [index: string]: T; +} + +var foodsOrganic: IFoodOrganic[] = [ + { name: 'banana', organic: true }, + { name: 'beet', organic: false }, +]; +var foodsType: IFoodType[] = [ + { name: 'apple', type: 'fruit' }, + { name: 'banana', type: 'fruit' }, + { name: 'beet', type: 'vegetable' } +]; +var foodsCombined: IFoodCombined[] = [ + { 'name': 'apple', 'organic': false, 'type': 'fruit' }, + { 'name': 'carrot', 'organic': true, 'type': 'vegetable' } +]; + +var stoogesQuotes: IStoogesQuote[] = [ + { 'name': 'curly', 'quotes': ['Oh, a wise guy, eh?', 'Poifect!'] }, + { 'name': 'moe', 'quotes': ['Spread out!', 'You knucklehead!'] } +]; +var stoogesAges: IStoogesAge[] = [ + { 'name': 'moe', 'age': 40 }, + { 'name': 'larry', 'age': 50 } +]; +var stoogesAgesDict: IDictionary = { + first: { 'name': 'moe', 'age': 40 }, + second: { 'name': 'larry', 'age': 50 } +}; +var stoogesCombined: IStoogesCombined[] = [ + { 'name': 'curly', 'age': 30, 'quotes': ['Oh, a wise guy, eh?', 'Poifect!'] }, + { 'name': 'moe', 'age': 40, 'quotes': ['Spread out!', 'You knucklehead!'] } +]; + +var keys: IKey[] = [ + { 'dir': 'left', 'code': 97 }, + { 'dir': 'right', 'code': 100 } +]; + +class Dog { + constructor(public name: string) { } + + public bark() { + console.log('Woof, woof!'); + } +} + +var result: any; + +var any: any; + +interface TResult { + a: number; + b: string; + c: boolean; +} + +// _.MapCache +var testMapCache: _.MapCache; +result = <(key: string) => boolean>testMapCache.delete; +result = <(key: string) => any>testMapCache.get; +result = <(key: string) => boolean>testMapCache.has; +result = <(key: string, value: any) => _.Dictionary>testMapCache.set; + +// _ +module TestWrapper { + { + let result: _.LoDashImplicitWrapper; + result = _(''); + } + + { + let result: _.LoDashImplicitWrapper; + result = _(42); + } + + { + let result: _.LoDashImplicitWrapper; + result = _(true); + } + + { + let result: _.LoDashImplicitArrayWrapper; + result = _(['']); + } + + { + let result: _.LoDashImplicitObjectWrapper<{a: string}>; + result = _<{a: string}>({a: ''}); + } +} + +//Wrapped array shortcut methods +result = _([1, 2, 3, 4]).join(','); +result = _([1, 2, 3, 4]).pop(); +result = <_.LoDashImplicitArrayWrapper>_([1, 2, 3, 4]).push(5, 6, 7); +result = _([1, 2, 3, 4]).shift(); +result = <_.LoDashImplicitArrayWrapper>_([1, 2, 3, 4]).sort((a, b) => 1); +result = <_.LoDashImplicitArrayWrapper>_([1, 2, 3, 4]).splice(1); +result = <_.LoDashImplicitArrayWrapper>_([1, 2, 3, 4]).splice(1, 2, 5, 6); +result = <_.LoDashImplicitArrayWrapper>_([1, 2, 3, 4]).unshift(5, 6); + +/********* + * Array * + *********/ + +// _.chunk +module TestChunk { + let array: TResult[]; + let list: _.List; + + { + let result: TResult[][]; + + result = _.chunk(array); + result = _.chunk(array, 42); + + result = _.chunk(list); + result = _.chunk(list, 42); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(array).chunk(); + result = _(array).chunk(42); + + result = _(list).chunk(); + result = _(list).chunk(42); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(array).chain().chunk(); + result = _(array).chain().chunk(42); + + result = _(list).chain().chunk(); + result = _(list).chain().chunk(42); + } +} + +// _.compact +module TestCompact { + let array: TResult[]; + let list: _.List; + + { + let result: TResult[]; + + result = _.compact(); + result = _.compact(array); + result = _.compact(list); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(array).compact(); + result = _(list).compact(); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(array).chain().compact(); + result = _(list).chain().compact(); + } +} + +// _.difference +module TestDifference { + let array: TResult[]; + let list: _.List; + + { + let result: TResult[]; + + result = _.difference(array); + result = _.difference(array, array); + result = _.difference(array, list, array); + result = _.difference(array, array, list, array); + + result = _.difference(list); + result = _.difference(list, list); + result = _.difference(list, array, list); + result = _.difference(list, list, array, list); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(array).difference(); + result = _(array).difference(array); + result = _(array).difference(list, array); + result = _(array).difference(array, list, array); + + result = _(list).difference(); + result = _(list).difference(list); + result = _(list).difference(array, list); + result = _(list).difference(list, array, list); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(array).chain().difference(); + result = _(array).chain().difference(array); + result = _(array).chain().difference(list, array); + result = _(array).chain().difference(array, list, array); + + result = _(list).chain().difference(); + result = _(list).chain().difference(list); + result = _(list).chain().difference(array, list); + result = _(list).chain().difference(list, array, list); + } +} + +// _.drop +{ + let array: TResult[]; + let list: _.List; + + { + let result: TResult[]; + result = _.drop(array); + result = _.drop(array, 42); + + result = _.drop(list); + result = _.drop(list, 42); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(array).drop(); + result = _(array).drop(42); + + result = _(list).drop(); + result = _(list).drop(42); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(array).chain().drop(); + result = _(array).chain().drop(42); + + result = _(list).chain().drop(); + result = _(list).chain().drop(42); + } +} + +// _.dropRight +module TestDropRight { + let array: TResult[]; + let list: _.List; + + { + let result: TResult[]; + + result = _.dropRight(array); + result = _.dropRight(array, 42); + + result = _.dropRight(list); + result = _.dropRight(list, 42); + + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(array).dropRight(); + result = _(array).dropRight(42); + + result = _(list).dropRight(); + result = _(list).dropRight(42); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(array).chain().dropRight(); + result = _(array).chain().dropRight(42); + + result = _(list).chain().dropRight(); + result = _(list).chain().dropRight(42); + } +} + +// _.dropRightWhile +module TestDropRightWhile { + let array: TResult[]; + let list: _.List; + let predicateFn: (value: TResult, index: number, collection: _.List) => boolean; + + { + let result: TResult[]; + + result = _.dropRightWhile(array); + result = _.dropRightWhile(array, predicateFn); + result = _.dropRightWhile(array, predicateFn, any); + result = _.dropRightWhile(array, ''); + result = _.dropRightWhile(array, '', any); + result = _.dropRightWhile<{a: number;}, TResult>(array, {a: 42}); + + result = _.dropRightWhile(list); + result = _.dropRightWhile(list, predicateFn); + result = _.dropRightWhile(list, predicateFn, any); + result = _.dropRightWhile(list, ''); + result = _.dropRightWhile(list, '', any); + result = _.dropRightWhile<{a: number;}, TResult>(list, {a: 42}); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(array).dropRightWhile(); + result = _(array).dropRightWhile(predicateFn); + result = _(array).dropRightWhile(predicateFn, any); + result = _(array).dropRightWhile(''); + result = _(array).dropRightWhile('', any); + result = _(array).dropRightWhile<{a: number;}>({a: 42}); + + result = _(list).dropRightWhile(); + result = _(list).dropRightWhile(predicateFn); + result = _(list).dropRightWhile(predicateFn, any); + result = _(list).dropRightWhile(''); + result = _(list).dropRightWhile('', any); + result = _(list).dropRightWhile<{a: number;}, TResult>({a: 42}); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(array).chain().dropRightWhile(); + result = _(array).chain().dropRightWhile(predicateFn); + result = _(array).chain().dropRightWhile(predicateFn, any); + result = _(array).chain().dropRightWhile(''); + result = _(array).chain().dropRightWhile('', any); + result = _(array).chain().dropRightWhile<{a: number;}>({a: 42}); + + result = _(list).chain().dropRightWhile(); + result = _(list).chain().dropRightWhile(predicateFn); + result = _(list).chain().dropRightWhile(predicateFn, any); + result = _(list).chain().dropRightWhile(''); + result = _(list).chain().dropRightWhile('', any); + result = _(list).chain().dropRightWhile<{a: number;}, TResult>({a: 42}); + } +} + +// _.dropWhile +module TestDropWhile { + let array: TResult[]; + let list: _.List; + let predicateFn: (value: TResult, index: number, collection: _.List) => boolean; + + { + let result: TResult[]; + + result = _.dropWhile(array); + result = _.dropWhile(array, predicateFn); + result = _.dropWhile(array, predicateFn, any); + result = _.dropWhile(array, ''); + result = _.dropWhile(array, '', any); + result = _.dropWhile<{a: number;}, TResult>(array, {a: 42}); + + result = _.dropWhile(list); + result = _.dropWhile(list, predicateFn); + result = _.dropWhile(list, predicateFn, any); + result = _.dropWhile(list, ''); + result = _.dropWhile(list, '', any); + result = _.dropWhile<{a: number;}, TResult>(list, {a: 42}); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(array).dropWhile(); + result = _(array).dropWhile(predicateFn); + result = _(array).dropWhile(predicateFn, any); + result = _(array).dropWhile(''); + result = _(array).dropWhile('', any); + result = _(array).dropWhile<{a: number;}>({a: 42}); + + result = _(list).dropWhile(); + result = _(list).dropWhile(predicateFn); + result = _(list).dropWhile(predicateFn, any); + result = _(list).dropWhile(''); + result = _(list).dropWhile('', any); + result = _(list).dropWhile<{a: number;}, TResult>({a: 42}); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(array).chain().dropWhile(); + result = _(array).chain().dropWhile(predicateFn); + result = _(array).chain().dropWhile(predicateFn, any); + result = _(array).chain().dropWhile(''); + result = _(array).chain().dropWhile('', any); + result = _(array).chain().dropWhile<{a: number;}>({a: 42}); + + result = _(list).chain().dropWhile(); + result = _(list).chain().dropWhile(predicateFn); + result = _(list).chain().dropWhile(predicateFn, any); + result = _(list).chain().dropWhile(''); + result = _(list).chain().dropWhile('', any); + result = _(list).chain().dropWhile<{a: number;}, TResult>({a: 42}); + } +} + +// _.fill +module TestFill { + let array: number[]; + let list: _.List; + + { + let result: number[]; + + result = _.fill(array, 42); + result = _.fill(array, 42, 0); + result = _.fill(array, 42, 0, 10); + } + + { + let result: _.List; + + result = _.fill(list, 42); + result = _.fill(list, 42, 0); + result = _.fill(list, 42, 0, 10); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(array).fill(42); + result = _(array).fill(42, 0); + result = _(array).fill(42, 0, 10); + } + + { + let result: _.LoDashImplicitObjectWrapper<_.List>; + + result = _(list).fill(42); + result = _(list).fill(42, 0); + result = _(list).fill(42, 0, 10); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(array).chain().fill(42); + result = _(array).chain().fill(42, 0); + result = _(array).chain().fill(42, 0, 10); + } + + { + let result: _.LoDashExplicitObjectWrapper<_.List>; + + result = _(list).chain().fill(42); + result = _(list).chain().fill(42, 0); + result = _(list).chain().fill(42, 0, 10); + } +} + +// _.findIndex +module TestFindIndex { + let array: TResult[]; + let list: _.List; + let predicateFn: (value: TResult, index?: number, collection?: _.List) => boolean; + + { + let result: number; + + result = _.findIndex(array); + result = _.findIndex(array, predicateFn); + result = _.findIndex(array, predicateFn, any); + result = _.findIndex(array, ''); + result = _.findIndex(array, '', any); + result = _.findIndex<{a: number}, TResult>(array, {a: 42}); + + result = _.findIndex(list); + result = _.findIndex(list, predicateFn); + result = _.findIndex(list, predicateFn, any); + result = _.findIndex(list, ''); + result = _.findIndex(list, '', any); + result = _.findIndex<{a: number}, TResult>(list, {a: 42}); + + result = _(array).findIndex(); + result = _(array).findIndex(predicateFn); + result = _(array).findIndex(predicateFn, any); + result = _(array).findIndex(''); + result = _(array).findIndex('', any); + result = _(array).findIndex<{a: number}>({a: 42}); + + result = _(list).findIndex(); + result = _(list).findIndex(predicateFn); + result = _(list).findIndex(predicateFn, any); + result = _(list).findIndex(''); + result = _(list).findIndex('', any); + result = _(list).findIndex<{a: number}>({a: 42}); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(array).chain().findIndex(); + result = _(array).chain().findIndex(predicateFn); + result = _(array).chain().findIndex(predicateFn, any); + result = _(array).chain().findIndex(''); + result = _(array).chain().findIndex('', any); + result = _(array).chain().findIndex<{a: number}>({a: 42}); + + result = _(list).chain().findIndex(); + result = _(list).chain().findIndex(predicateFn); + result = _(list).chain().findIndex(predicateFn, any); + result = _(list).chain().findIndex(''); + result = _(list).chain().findIndex('', any); + result = _(list).chain().findIndex<{a: number}>({a: 42}); + } +} + +// _.findLastIndex +module TestFindLastIndex { + let array: TResult[]; + let list: _.List; + + let predicateFn: (value: TResult, index?: number, collection?: _.List) => boolean; + + { + let result: number; + + result = _.findLastIndex(array); + result = _.findLastIndex(array, predicateFn); + result = _.findLastIndex(array, predicateFn, any); + result = _.findLastIndex(array, ''); + result = _.findLastIndex(array, '', any); + result = _.findLastIndex<{a: number}, TResult>(array, {a: 42}); + + result = _.findLastIndex(list); + result = _.findLastIndex(list, predicateFn); + result = _.findLastIndex(list, predicateFn, any); + result = _.findLastIndex(list, ''); + result = _.findLastIndex(list, '', any); + result = _.findLastIndex<{a: number}, TResult>(list, {a: 42}); + + result = _(array).findLastIndex(); + result = _(array).findLastIndex(predicateFn); + result = _(array).findLastIndex(predicateFn, any); + result = _(array).findLastIndex(''); + result = _(array).findLastIndex('', any); + result = _(array).findLastIndex<{a: number}>({a: 42}); + + result = _(list).findLastIndex(); + result = _(list).findLastIndex(predicateFn); + result = _(list).findLastIndex(predicateFn, any); + result = _(list).findLastIndex(''); + result = _(list).findLastIndex('', any); + result = _(list).findLastIndex<{a: number}>({a: 42}); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(array).chain().findLastIndex(); + result = _(array).chain().findLastIndex(predicateFn); + result = _(array).chain().findLastIndex(predicateFn, any); + result = _(array).chain().findLastIndex(''); + result = _(array).chain().findLastIndex('', any); + result = _(array).chain().findLastIndex<{a: number}>({a: 42}); + + result = _(list).chain().findLastIndex(); + result = _(list).chain().findLastIndex(predicateFn); + result = _(list).chain().findLastIndex(predicateFn, any); + result = _(list).chain().findLastIndex(''); + result = _(list).chain().findLastIndex('', any); + result = _(list).chain().findLastIndex<{a: number}>({a: 42}); + } +} + +// _.first +module TestFirst { + let array: TResult[]; + let list: _.List; + let result: TResult; + result = _.first(array); + result = _.first(list); + result = _(array).first(); + result = _(list).first(); +} + +// _.flatten +module TestFlatten { + { + let result: string[]; + + result = _.flatten('abc'); + } + + { + let result: number[]; + + result = _.flatten([1, 2, 3]); + result = _.flatten([1, [2, 3]]); + result = _.flatten([1, [2, [3]]], true); + result = _.flatten([1, [2, [3]], [[4]]], true); + + result = _.flatten({0: 1, 1: 2, 2: 3, length: 3}); + result = _.flatten({0: 1, 1: [2, 3], length: 2}); + result = _.flatten({0: 1, 1: [2, [3]], length: 2}, true); + result = _.flatten({0: 1, 1: [2, [3]], 2: [[4]], length: 3}, true); + } + + { + let result: _.RecursiveArray; + + result = _.flatten([1, [2, [3]]]); + result = _.flatten([1, [2, [3]], [[4]]]); + + result = _.flatten({0: 1, 1: [2, [3]], length: 2}); + result = _.flatten({0: 1, 1: [2, [3]], 2: [[4]], length: 3}); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _('abc').flatten(); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _([1, 2, 3]).flatten(); + result = _([1, [2, 3]]).flatten(); + result = _([1, [2, [3]]]).flatten(true); + result = _([1, [2, [3]], [[4]]]).flatten(true); + + result = _({0: 1, 1: 2, 2: 3, length: 3}).flatten(); + result = _({0: 1, 1: [2, 3], length: 2}).flatten(); + result = _({0: 1, 1: [2, [3]], length: 2}).flatten(true); + result = _({0: 1, 1: [2, [3]], 2: [[4]], length: 3}).flatten(true); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _([1, [2, [3]]]).flatten(); + result = _([1, [2, [3]], [[4]]]).flatten(); + + result = _({0: 1, 1: [2, [3]], length: 2}).flatten(); + result = _({0: 1, 1: [2, [3]], 2: [[4]], length: 3}).flatten(); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _('abc').chain().flatten(); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _([1, 2, 3]).chain().flatten(); + result = _([1, [2, 3]]).chain().flatten(); + result = _([1, [2, [3]]]).chain().flatten(true); + result = _([1, [2, [3]], [[4]]]).chain().flatten(true); + + result = _({0: 1, 1: 2, 2: 3, length: 3}).chain().flatten(); + result = _({0: 1, 1: [2, 3], length: 2}).chain().flatten(); + result = _({0: 1, 1: [2, [3]], length: 2}).chain().flatten(true); + result = _({0: 1, 1: [2, [3]], 2: [[4]], length: 3}).chain().flatten(true); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _([1, [2, [3]]]).chain().flatten(); + result = _([1, [2, [3]], [[4]]]).chain().flatten(); + + result = _({0: 1, 1: [2, [3]], length: 2}).chain().flatten(); + result = _({0: 1, 1: [2, [3]], 2: [[4]], length: 3}).chain().flatten(); + } +} + +// _.flattenDeep +module TestFlattenDeep { + { + let result: string[]; + + result = _.flattenDeep('abc'); + } + + { + let result: number[]; + + result = _.flattenDeep([1, 2, 3]); + result = _.flattenDeep([1, [2, 3]]); + result = _.flattenDeep([1, [2, [3]]]); + result = _.flattenDeep([1, [2, [3]], [[4]]]); + + result = _.flattenDeep({0: 1, 1: 2, 2: 3, length: 3}); + result = _.flattenDeep({0: 1, 1: [2, 3], length: 2}); + result = _.flattenDeep({0: 1, 1: [2, [3]], length: 2}); + result = _.flattenDeep({0: 1, 1: [2, [3]], 2: [[4]], length: 3}); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _('abc').flattenDeep(); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _([1, 2, 3]).flattenDeep(); + result = _([1, [2, 3]]).flattenDeep(); + result = _([1, [2, [3]]]).flattenDeep(); + result = _([1, [2, [3]], [[4]]]).flattenDeep(); + + result = _({0: 1, 1: 2, 2: 3, length: 3}).flattenDeep(); + result = _({0: 1, 1: [2, 3], length: 2}).flattenDeep(); + result = _({0: 1, 1: [2, [3]], length: 2}).flattenDeep(); + result = _({0: 1, 1: [2, [3]], 2: [[4]], length: 3}).flattenDeep(); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _([1, [2, [3]]]).flattenDeep(); + result = _([1, [2, [3]], [[4]]]).flattenDeep(); + + result = _({0: 1, 1: [2, [3]], length: 2}).flattenDeep(); + result = _({0: 1, 1: [2, [3]], 2: [[4]], length: 3}).flattenDeep(); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _('abc').chain().flattenDeep(); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _([1, 2, 3]).chain().flattenDeep(); + result = _([1, [2, 3]]).chain().flattenDeep(); + result = _([1, [2, [3]]]).chain().flattenDeep(); + result = _([1, [2, [3]], [[4]]]).chain().flattenDeep(); + + result = _({0: 1, 1: 2, 2: 3, length: 3}).chain().flattenDeep(); + result = _({0: 1, 1: [2, 3], length: 2}).chain().flattenDeep(); + result = _({0: 1, 1: [2, [3]], length: 2}).chain().flattenDeep(); + result = _({0: 1, 1: [2, [3]], 2: [[4]], length: 3}).chain().flattenDeep(); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _([1, [2, [3]]]).chain().flattenDeep(); + result = _([1, [2, [3]], [[4]]]).chain().flattenDeep(); + + result = _({0: 1, 1: [2, [3]], length: 2}).chain().flattenDeep(); + result = _({0: 1, 1: [2, [3]], 2: [[4]], length: 3}).chain().flattenDeep(); + } +} + +// _.head +module TestHead { + let array: TResult[]; + let list: _.List; + let result: TResult; + result = _.head(array); + result = _.head(list); + result = _(array).head(); + result = _(list).head(); +} + +// _.indexOf +module TestIndexOf { + let array: TResult[]; + let list: _.List; + let value: TResult; + + { + let result: number; + + result = _.indexOf(array, value); + result = _.indexOf(array, value, true); + result = _.indexOf(array, value, 42); + + result = _.indexOf(list, value); + result = _.indexOf(list, value, true); + result = _.indexOf(list, value, 42); + + result = _(array).indexOf(value); + result = _(array).indexOf(value, true); + result = _(array).indexOf(value, 42); + + result = _(list).indexOf(value); + result = _(list).indexOf(value, true); + result = _(list).indexOf(value, 42); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(array).chain().indexOf(value); + result = _(array).chain().indexOf(value, true); + result = _(array).chain().indexOf(value, 42); + + result = _(list).chain().indexOf(value); + result = _(list).chain().indexOf(value, true); + result = _(list).chain().indexOf(value, 42); + } +} + +//_.initial +module TestInitial { + let array: TResult[]; + let list: _.List; + + { + let result: TResult[]; + + result = _.initial(array); + result = _.initial(list); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(array).initial(); + result = _(list).initial(); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(array).chain().initial(); + result = _(list).chain().initial(); + } +} + +// _.intersection +module TestIntersection { + let array: TResult[]; + let list: _.List; + + { + let result: TResult[]; + + result = _.intersection(array, list); + result = _.intersection(list, array, list); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(array).intersection(array); + result = _(array).intersection(list, array); + + result = _(list).intersection(array); + result = _(list).intersection(list, array); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(array).chain().intersection(array); + result = _(array).chain().intersection(list, array); + + result = _(list).chain().intersection(array); + result = _(list).chain().intersection(list, array); + } +} + +// _.last +module TestLast { + let array: TResult[]; + let list: _.List; + + { + let result: TResult; + + result = _.last(array); + result = _.last(list); + + result = _(array).last(); + result = _(list).last(); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(array).chain().last(); + } + + { + let result: _.LoDashExplicitObjectWrapper<_.List>; + + result = _(list).chain().last<_.List>(); + } +} + +// _.lastIndexOf +module TestLastIndexOf { + let array: TResult[]; + let list: _.List; + let value: TResult; + + { + let result: number; + + result = _.lastIndexOf(array, value); + result = _.lastIndexOf(array, value, true); + result = _.lastIndexOf(array, value, 42); + + result = _.lastIndexOf(list, value); + result = _.lastIndexOf(list, value, true); + result = _.lastIndexOf(list, value, 42); + + result = _(array).lastIndexOf(value); + result = _(array).lastIndexOf(value, true); + result = _(array).lastIndexOf(value, 42); + + result = _(list).lastIndexOf(value); + result = _(list).lastIndexOf(value, true); + result = _(list).lastIndexOf(value, 42); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(array).chain().lastIndexOf(value); + result = _(array).chain().lastIndexOf(value, true); + result = _(array).chain().lastIndexOf(value, 42); + + result = _(list).chain().lastIndexOf(value); + result = _(list).chain().lastIndexOf(value, true); + result = _(list).chain().lastIndexOf(value, 42); + } +} + +// _.object +module TestObject { + let arrayOfKeys: string[]; + let arrayOfValues: number[]; + let arrayOfKeyValuePairs: (string|number)[][] + + let listOfKeys: _.List; + let listOfValues: _.List; + let listOfKeyValuePairs: _.List<_.List>; + + { + let result: _.Dictionary; + + result = _.object<_.Dictionary>(arrayOfKeys); + result = _.object<_.Dictionary>(listOfKeys); + } + + { + let result: _.Dictionary; + + result = _.object<_.Dictionary>(arrayOfKeys, arrayOfValues); + result = _.object<_.Dictionary>(arrayOfKeys, listOfValues); + result = _.object<_.Dictionary>(listOfKeys, listOfValues); + result = _.object<_.Dictionary>(listOfKeys, arrayOfValues); + + result = _.object>(arrayOfKeys, arrayOfValues); + result = _.object>(arrayOfKeys, listOfValues); + result = _.object>(listOfKeys, listOfValues); + result = _.object>(listOfKeys, arrayOfValues); + + result = _.object<_.Dictionary>(arrayOfKeyValuePairs); + result = _.object<_.Dictionary>(listOfKeyValuePairs); + } + + { + let result: _.Dictionary; + + result = _.object(arrayOfKeys); + result = _.object(arrayOfKeys, arrayOfValues); + result = _.object(arrayOfKeys, listOfValues); + + result = _.object(listOfKeys); + result = _.object(listOfKeys, listOfValues); + result = _.object(listOfKeys, arrayOfValues); + + result = _.object<_.Dictionary>(arrayOfKeyValuePairs); + result = _.object<_.Dictionary>(listOfKeyValuePairs); + } + + { + let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; + + result = _(arrayOfKeys).object<_.Dictionary>(); + result = _(listOfKeys).object<_.Dictionary>(); + } + + { + let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; + + result = _(arrayOfKeys).object<_.Dictionary>(arrayOfValues); + result = _(arrayOfKeys).object<_.Dictionary>(listOfValues); + result = _(listOfKeys).object<_.Dictionary>(listOfValues); + result = _(listOfKeys).object<_.Dictionary>(arrayOfValues); + + result = _(arrayOfKeys).object>(arrayOfValues); + result = _(arrayOfKeys).object>(listOfValues); + result = _(listOfKeys).object>(listOfValues); + result = _(listOfKeys).object>(arrayOfValues); + + result = _(listOfKeys).object<_.Dictionary>(arrayOfKeyValuePairs); + result = _(listOfKeys).object<_.Dictionary>(listOfKeyValuePairs); + } + + { + let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; + + result = _(arrayOfKeys).object(); + result = _(arrayOfKeys).object(arrayOfValues); + result = _(arrayOfKeys).object(listOfValues); + + result = _(listOfKeys).object(); + result = _(listOfKeys).object(listOfValues); + result = _(listOfKeys).object(arrayOfValues); + + result = _(listOfKeys).object(arrayOfKeyValuePairs); + result = _(listOfKeys).object(listOfKeyValuePairs); + } + + { + let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; + + result = _(arrayOfKeys).chain().object<_.Dictionary>(); + result = _(listOfKeys).chain().object<_.Dictionary>(); + } + + { + let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; + + result = _(arrayOfKeys).chain().object<_.Dictionary>(arrayOfValues); + result = _(arrayOfKeys).chain().object<_.Dictionary>(listOfValues); + result = _(listOfKeys).chain().object<_.Dictionary>(listOfValues); + result = _(listOfKeys).chain().object<_.Dictionary>(arrayOfValues); + + result = _(arrayOfKeys).chain().object>(arrayOfValues); + result = _(arrayOfKeys).chain().object>(listOfValues); + result = _(listOfKeys).chain().object>(listOfValues); + result = _(listOfKeys).chain().object>(arrayOfValues); + + result = _(listOfKeys).chain().object<_.Dictionary>(arrayOfKeyValuePairs); + result = _(listOfKeys).chain().object<_.Dictionary>(listOfKeyValuePairs); + } + + { + let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; + + result = _(arrayOfKeys).chain().object(); + result = _(arrayOfKeys).chain().object(arrayOfValues); + result = _(arrayOfKeys).chain().object(listOfValues); + + result = _(listOfKeys).chain().object(); + result = _(listOfKeys).chain().object(listOfValues); + result = _(listOfKeys).chain().object(arrayOfValues); + + result = _(listOfKeys).chain().object(arrayOfKeyValuePairs); + result = _(listOfKeys).chain().object(listOfKeyValuePairs); + } +} + +// _.pull +module TestPull { + let array: TResult[]; + let list: _.List; + let value: TResult; + + { + let result: TResult[]; + + result = _.pull(array); + result = _.pull(array, value); + result = _.pull(array, value, value); + result = _.pull(array, value, value, value); + } + + { + let result: _.List; + + result = _.pull(list); + result = _.pull(list, value); + result = _.pull(list, value, value); + result = _.pull(list, value, value, value); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(array).pull(); + result = _(array).pull(value); + result = _(array).pull(value, value); + result = _(array).pull(value, value, value); + } + + { + let result: _.LoDashImplicitObjectWrapper<_.List>; + + result = _(list).pull(); + result = _(list).pull(value); + result = _(list).pull(value, value); + result = _(list).pull(value, value, value); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(array).chain().pull(); + result = _(array).chain().pull(value); + result = _(array).chain().pull(value, value); + result = _(array).chain().pull(value, value, value); + } + + { + let result: _.LoDashExplicitObjectWrapper<_.List>; + + result = _(list).chain().pull(); + result = _(list).chain().pull(value); + result = _(list).chain().pull(value, value); + result = _(list).chain().pull(value, value, value); + } +} + +// _.pullAt +module TestPullAt { + let array: TResult[]; + let list: _.List; + + { + let result: TResult[]; + + result = _.pullAt(array); + result = _.pullAt(array, 1); + result = _.pullAt(array, [2, 3], 1); + result = _.pullAt(array, 4, [2, 3], 1); + + result = _.pullAt(list); + result = _.pullAt(list, 1); + result = _.pullAt(list, [2, 3], 1); + result = _.pullAt(list, 4, [2, 3], 1); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(array).pullAt(); + result = _(array).pullAt(1); + result = _(array).pullAt([2, 3], 1); + result = _(array).pullAt(4, [2, 3], 1); + + result = _(list).pullAt(); + result = _(list).pullAt(1); + result = _(list).pullAt([2, 3], 1); + result = _(list).pullAt(4, [2, 3], 1); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(array).chain().pullAt(); + result = _(array).chain().pullAt(1); + result = _(array).chain().pullAt([2, 3], 1); + result = _(array).chain().pullAt(4, [2, 3], 1); + + result = _(list).chain().pullAt(); + result = _(list).chain().pullAt(1); + result = _(list).chain().pullAt([2, 3], 1); + result = _(list).chain().pullAt(4, [2, 3], 1); + } +} + +// _.remove +module TestRemove { + let array: TResult[]; + let list: _.List; + let predicateFn: (value: TResult, index?: number, collection?: _.List) => boolean; + + { + let result: TResult[]; + + result = _.remove(array); + result = _.remove(array, predicateFn); + result = _.remove(array, predicateFn, any); + result = _.remove(array, ''); + result = _.remove(array, '', any); + result = _.remove<{a: number}, TResult>(array, {a: 42}); + + result = _.remove(list); + result = _.remove(list, predicateFn); + result = _.remove(list, predicateFn, any); + result = _.remove(list, ''); + result = _.remove(list, '', any); + result = _.remove<{a: number}, TResult>(list, {a: 42}); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(array).remove(); + result = _(array).remove(predicateFn); + result = _(array).remove(predicateFn, any); + result = _(array).remove(''); + result = _(array).remove('', any); + result = _(array).remove<{a: number}>({a: 42}); + + result = _(list).remove(); + result = _(list).remove(predicateFn); + result = _(list).remove(predicateFn, any); + result = _(list).remove(''); + result = _(list).remove('', any); + result = _(list).remove<{a: number}, TResult>({a: 42}); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(array).chain().remove(); + result = _(array).chain().remove(predicateFn); + result = _(array).chain().remove(predicateFn, any); + result = _(array).chain().remove(''); + result = _(array).chain().remove('', any); + result = _(array).chain().remove<{a: number}>({a: 42}); + + result = _(list).chain().remove(); + result = _(list).chain().remove(predicateFn); + result = _(list).chain().remove(predicateFn, any); + result = _(list).chain().remove(''); + result = _(list).chain().remove('', any); + result = _(list).chain().remove<{a: number}, TResult>({a: 42}); + } +} + +// _.rest +module TestRest { + let array: TResult[]; + let list: _.List; + + { + let result: TResult[]; + + result = _.rest(array); + result = _.rest(list); + + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(array).rest(); + result = _(list).rest(); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(array).chain().rest(); + result = _(list).chain().rest(); + } +} + +// _.slice +module TestSlice { + let array: TResult[]; + + { + let result: TResult[]; + + result = _.slice(array); + result = _.slice(array, 42); + result = _.slice(array, 42, 42); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(array).slice(); + result = _(array).slice(42); + result = _(array).slice(42, 42); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(array).chain().slice(); + result = _(array).chain().slice(42); + result = _(array).chain().slice(42, 42); + } +} + +// _.sortedIndex +module TestSortedIndex { + type SampleType = {a: number; b: string; c: boolean;}; + + let array: SampleType[]; + let list: _.List; + + let value: SampleType; + + let stringIterator: (x: string) => number; + let arrayIterator: (x: SampleType) => number; + let listIterator: (x: SampleType) => number; + + { + let result: number; + + result = _.sortedIndex('', ''); + result = _.sortedIndex('', '', stringIterator); + result = _.sortedIndex('', '', stringIterator, any); + result = _.sortedIndex('', '', stringIterator); + result = _.sortedIndex('', '', stringIterator, any); + + result = _.sortedIndex(array, value); + result = _.sortedIndex(array, value, arrayIterator); + result = _.sortedIndex(array, value, arrayIterator, any); + result = _.sortedIndex(array, value, ''); + result = _.sortedIndex(array, value, {a: 42}); + result = _.sortedIndex(array, value, arrayIterator); + result = _.sortedIndex(array, value, arrayIterator, any); + result = _.sortedIndex<{a: number}, SampleType>(array, value, {a: 42}); + + result = _.sortedIndex(list, value); + result = _.sortedIndex(list, value, listIterator); + result = _.sortedIndex(list, value, listIterator, any); + result = _.sortedIndex(list, value, ''); + result = _.sortedIndex(list, value, {a: 42}); + result = _.sortedIndex(list, value, listIterator); + result = _.sortedIndex(list, value, listIterator, any); + result = _.sortedIndex<{a: number}, SampleType>(list, value, {a: 42}); + + result = _('').sortedIndex(''); + result = _('').sortedIndex('', stringIterator); + result = _('').sortedIndex('', stringIterator, any); + + result = _(array).sortedIndex(value); + result = _(array).sortedIndex(value, arrayIterator); + result = _(array).sortedIndex(value, arrayIterator, any); + result = _(array).sortedIndex(value, ''); + result = _(array).sortedIndex<{a: number}>(value, {a: 42}); + + result = _(list).sortedIndex(value); + result = _(list).sortedIndex(value, listIterator); + result = _(list).sortedIndex(value, listIterator, any); + result = _(list).sortedIndex(value, ''); + result = _(list).sortedIndex(value, {a: 42}); + result = _(list).sortedIndex(value, listIterator); + result = _(list).sortedIndex(value, listIterator, any); + result = _(list).sortedIndex<{a: number}, SampleType>(value, {a: 42}); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _('').chain().sortedIndex(''); + result = _('').chain().sortedIndex('', stringIterator); + result = _('').chain().sortedIndex('', stringIterator, any); + + result = _(array).chain().sortedIndex(value); + result = _(array).chain().sortedIndex(value, arrayIterator); + result = _(array).chain().sortedIndex(value, arrayIterator, any); + result = _(array).chain().sortedIndex(value, ''); + result = _(array).chain().sortedIndex<{a: number}>(value, {a: 42}); + + result = _(list).chain().sortedIndex(value); + result = _(list).chain().sortedIndex(value, listIterator); + result = _(list).chain().sortedIndex(value, listIterator, any); + result = _(list).chain().sortedIndex(value, ''); + result = _(list).chain().sortedIndex(value, {a: 42}); + result = _(list).chain().sortedIndex(value, listIterator); + result = _(list).chain().sortedIndex(value, listIterator, any); + result = _(list).chain().sortedIndex<{a: number}, SampleType>(value, {a: 42}); + } +} + +// _.sortedLastIndex +module TestSortedLastIndex { + type SampleType = {a: number; b: string; c: boolean;}; + + let array: SampleType[]; + let list: _.List; + + let value: SampleType; + + let stringIterator: (x: string) => number; + let arrayIterator: (x: SampleType) => number; + let listIterator: (x: SampleType) => number; + + { + let result: number; + + result = _.sortedLastIndex('', ''); + result = _.sortedLastIndex('', '', stringIterator); + result = _.sortedLastIndex('', '', stringIterator, any); + result = _.sortedLastIndex('', '', stringIterator); + result = _.sortedLastIndex('', '', stringIterator, any); + + result = _.sortedLastIndex(array, value); + result = _.sortedLastIndex(array, value, arrayIterator); + result = _.sortedLastIndex(array, value, arrayIterator, any); + result = _.sortedLastIndex(array, value, ''); + result = _.sortedLastIndex(array, value, {a: 42}); + result = _.sortedLastIndex(array, value, arrayIterator); + result = _.sortedLastIndex(array, value, arrayIterator, any); + result = _.sortedLastIndex<{a: number}, SampleType>(array, value, {a: 42}); + + result = _.sortedLastIndex(list, value); + result = _.sortedLastIndex(list, value, listIterator); + result = _.sortedLastIndex(list, value, listIterator, any); + result = _.sortedLastIndex(list, value, ''); + result = _.sortedLastIndex(list, value, {a: 42}); + result = _.sortedLastIndex(list, value, listIterator); + result = _.sortedLastIndex(list, value, listIterator, any); + result = _.sortedLastIndex<{a: number}, SampleType>(list, value, {a: 42}); + + result = _('').sortedLastIndex(''); + result = _('').sortedLastIndex('', stringIterator); + result = _('').sortedLastIndex('', stringIterator, any); + + result = _(array).sortedLastIndex(value); + result = _(array).sortedLastIndex(value, arrayIterator); + result = _(array).sortedLastIndex(value, arrayIterator, any); + result = _(array).sortedLastIndex(value, ''); + result = _(array).sortedLastIndex<{a: number}>(value, {a: 42}); + + result = _(list).sortedLastIndex(value); + result = _(list).sortedLastIndex(value, listIterator); + result = _(list).sortedLastIndex(value, listIterator, any); + result = _(list).sortedLastIndex(value, ''); + result = _(list).sortedLastIndex(value, {a: 42}); + result = _(list).sortedLastIndex(value, listIterator); + result = _(list).sortedLastIndex(value, listIterator, any); + result = _(list).sortedLastIndex<{a: number}, SampleType>(value, {a: 42}); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _('').chain().sortedLastIndex(''); + result = _('').chain().sortedLastIndex('', stringIterator); + result = _('').chain().sortedLastIndex('', stringIterator, any); + + result = _(array).chain().sortedLastIndex(value); + result = _(array).chain().sortedLastIndex(value, arrayIterator); + result = _(array).chain().sortedLastIndex(value, arrayIterator, any); + result = _(array).chain().sortedLastIndex(value, ''); + result = _(array).chain().sortedLastIndex<{a: number}>(value, {a: 42}); + + result = _(list).chain().sortedLastIndex(value); + result = _(list).chain().sortedLastIndex(value, listIterator); + result = _(list).chain().sortedLastIndex(value, listIterator, any); + result = _(list).chain().sortedLastIndex(value, ''); + result = _(list).chain().sortedLastIndex(value, {a: 42}); + result = _(list).chain().sortedLastIndex(value, listIterator); + result = _(list).chain().sortedLastIndex(value, listIterator, any); + result = _(list).chain().sortedLastIndex<{a: number}, SampleType>(value, {a: 42}); + } +} + +// _.tail +module TestTail { + let array: TResult[]; + let list: _.List; + + { + let result: TResult[]; + + result = _.tail(array); + result = _.tail(list); + + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(array).tail(); + result = _(list).tail(); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(array).chain().tail(); + result = _(list).chain().tail(); + } +} + +// _.take +module TestTake { + let array: TResult[]; + let list: _.List; + + { + let result: TResult[]; + + result = _.take(array); + result = _.take(array, 42); + + result = _.take(list); + result = _.take(list, 42); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(array).take(); + result = _(array).take(42); + + result = _(list).take(); + result = _(list).take(42); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(array).chain().take(); + result = _(array).chain().take(42); + + result = _(list).chain().take(); + result = _(list).chain().take(42); + } +} + +// _.takeRight +module TestTakeRight { + let array: TResult[]; + let list: _.List; + + { + let result: TResult[]; + + result = _.takeRight(array); + result = _.takeRight(array, 42); + + result = _.takeRight(list); + result = _.takeRight(list, 42); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(array).takeRight(); + result = _(array).takeRight(42); + + result = _(list).takeRight(); + result = _(list).takeRight(42); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(array).chain().takeRight(); + result = _(array).chain().takeRight(42); + + result = _(list).chain().takeRight(); + result = _(list).chain().takeRight(42); + } +} + +// _.takeRightWhile +module TestTakeRightWhile { + let array: TResult[]; + let list: _.List; + let predicateFn: (value: TResult, index: number, collection: _.List) => boolean; + + { + let result: TResult[]; + + result = _.takeRightWhile(array); + result = _.takeRightWhile(array, predicateFn); + result = _.takeRightWhile(array, predicateFn, any); + result = _.takeRightWhile(array, ''); + result = _.takeRightWhile(array, '', any); + result = _.takeRightWhile<{a: number;}, TResult>(array, {a: 42}); + + result = _.takeRightWhile(list); + result = _.takeRightWhile(list, predicateFn); + result = _.takeRightWhile(list, predicateFn, any); + result = _.takeRightWhile(list, ''); + result = _.takeRightWhile(list, '', any); + result = _.takeRightWhile<{a: number;}, TResult>(list, {a: 42}); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(array).takeRightWhile(); + result = _(array).takeRightWhile(predicateFn); + result = _(array).takeRightWhile(predicateFn, any); + result = _(array).takeRightWhile(''); + result = _(array).takeRightWhile('', any); + result = _(array).takeRightWhile<{a: number;}>({a: 42}); + + result = _(list).takeRightWhile(); + result = _(list).takeRightWhile(predicateFn); + result = _(list).takeRightWhile(predicateFn, any); + result = _(list).takeRightWhile(''); + result = _(list).takeRightWhile('', any); + result = _(list).takeRightWhile<{a: number;}, TResult>({a: 42}); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(array).chain().takeRightWhile(); + result = _(array).chain().takeRightWhile(predicateFn); + result = _(array).chain().takeRightWhile(predicateFn, any); + result = _(array).chain().takeRightWhile(''); + result = _(array).chain().takeRightWhile('', any); + result = _(array).chain().takeRightWhile<{a: number;}>({a: 42}); + + result = _(list).chain().takeRightWhile(); + result = _(list).chain().takeRightWhile(predicateFn); + result = _(list).chain().takeRightWhile(predicateFn, any); + result = _(list).chain().takeRightWhile(''); + result = _(list).chain().takeRightWhile('', any); + result = _(list).chain().takeRightWhile<{a: number;}, TResult>({a: 42}); + } +} + +// _.takeWhile +module TestTakeWhile { + let array: TResult[]; + let list: _.List; + let predicateFn: (value: TResult, index: number, collection: _.List) => boolean; + + { + let result: TResult[]; + + result = _.takeWhile(array); + result = _.takeWhile(array, predicateFn); + result = _.takeWhile(array, predicateFn, any); + result = _.takeWhile(array, ''); + result = _.takeWhile(array, '', any); + result = _.takeWhile<{a: number;}, TResult>(array, {a: 42}); + + result = _.takeWhile(list); + result = _.takeWhile(list, predicateFn); + result = _.takeWhile(list, predicateFn, any); + result = _.takeWhile(list, ''); + result = _.takeWhile(list, '', any); + result = _.takeWhile<{a: number;}, TResult>(list, {a: 42}); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(array).takeWhile(); + result = _(array).takeWhile(predicateFn); + result = _(array).takeWhile(predicateFn, any); + result = _(array).takeWhile(''); + result = _(array).takeWhile('', any); + result = _(array).takeWhile<{a: number;}>({a: 42}); + + result = _(list).takeWhile(); + result = _(list).takeWhile(predicateFn); + result = _(list).takeWhile(predicateFn, any); + result = _(list).takeWhile(''); + result = _(list).takeWhile('', any); + result = _(list).takeWhile<{a: number;}, TResult>({a: 42}); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(array).chain().takeWhile(); + result = _(array).chain().takeWhile(predicateFn); + result = _(array).chain().takeWhile(predicateFn, any); + result = _(array).chain().takeWhile(''); + result = _(array).chain().takeWhile('', any); + result = _(array).chain().takeWhile<{a: number;}>({a: 42}); + + result = _(list).chain().takeWhile(); + result = _(list).chain().takeWhile(predicateFn); + result = _(list).chain().takeWhile(predicateFn, any); + result = _(list).chain().takeWhile(''); + result = _(list).chain().takeWhile('', any); + result = _(list).chain().takeWhile<{a: number;}, TResult>({a: 42}); + } +} + +// _.union +module TestUnion { + let array: TResult[]; + let list: _.List; + + { + let result: TResult[]; + + result = _.union(); + + result = _.union(array); + result = _.union(array, list); + result = _.union(array, list, array); + + result = _.union(list); + result = _.union(list, array); + result = _.union(list, array, list); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(array).union(); + result = _(array).union(list); + result = _(array).union(list, array); + + result = _(array).union(); + result = _(array).union(list); + result = _(array).union(list, array); + + result = _(list).union(); + result = _(list).union(array); + result = _(list).union(array, list); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(array).chain().union(); + result = _(array).chain().union(list); + result = _(array).chain().union(list, array); + + result = _(array).chain().union(); + result = _(array).chain().union(list); + result = _(array).chain().union(list, array); + + result = _(list).chain().union(); + result = _(list).chain().union(array); + result = _(list).chain().union(array, list); + } +} + +// _.uniq +module TestUniq { + type SampleObject = {a: number; b: string; c: boolean}; + + let array: SampleObject[]; + let list: _.List; + + let stringIterator: (value: string, index: number, collection: string) => string; + let listIterator: (value: SampleObject, index: number, collection: _.List) => number; + + { + let result: string[]; + + result = _.uniq('abc'); + result = _.uniq('abc', true); + result = _.uniq('abc', true, stringIterator); + result = _.uniq('abc', true, stringIterator, any); + result = _.uniq('abc', true, stringIterator); + result = _.uniq('abc', true, stringIterator, any); + result = _.uniq('abc', stringIterator); + result = _.uniq('abc', stringIterator, any); + result = _.uniq('abc', stringIterator); + result = _.uniq('abc', stringIterator, any); + } + + { + let result: SampleObject[]; + + result = _.uniq(array); + result = _.uniq(array, true); + result = _.uniq(array, true, listIterator); + result = _.uniq(array, true, listIterator, any); + result = _.uniq(array, true, listIterator); + result = _.uniq(array, true, listIterator, any); + result = _.uniq(array, listIterator); + result = _.uniq(array, listIterator, any); + result = _.uniq(array, listIterator); + result = _.uniq(array, listIterator, any); + result = _.uniq(array, true, 'a'); + result = _.uniq(array, true, 'a', any); + result = _.uniq(array, 'a'); + result = _.uniq(array, 'a', any); + result = _.uniq(array, true, {a: 42}); + result = _.uniq<{a: number}, SampleObject>(array, true, {a: 42}); + result = _.uniq(array, {a: 42}); + result = _.uniq<{a: number}, SampleObject>(array, {a: 42}); + + result = _.uniq(list); + result = _.uniq(list, true); + result = _.uniq(list, true, listIterator); + result = _.uniq(list, true, listIterator, any); + result = _.uniq(list, true, listIterator); + result = _.uniq(list, true, listIterator, any); + result = _.uniq(list, listIterator); + result = _.uniq(list, listIterator, any); + result = _.uniq(list, listIterator); + result = _.uniq(list, listIterator, any); + result = _.uniq(list, true, 'a'); + result = _.uniq(list, true, 'a', any); + result = _.uniq(list, 'a'); + result = _.uniq(list, 'a', any); + result = _.uniq(list, true, {a: 42}); + result = _.uniq<{a: number}, SampleObject>(list, true, {a: 42}); + result = _.uniq(list, {a: 42}); + result = _.uniq<{a: number}, SampleObject>(list, {a: 42}); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _('abc').uniq(); + result = _('abc').uniq(true); + result = _('abc').uniq(true, stringIterator); + result = _('abc').uniq(true, stringIterator, any); + result = _('abc').uniq(stringIterator); + result = _('abc').uniq(stringIterator, any); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(array).uniq(); + result = _(array).uniq(true); + result = _(array).uniq(true, listIterator); + result = _(array).uniq(true, listIterator, any); + result = _(array).uniq(listIterator); + result = _(array).uniq(listIterator, any); + result = _(array).uniq(true, 'a'); + result = _(array).uniq(true, 'a', any); + result = _(array).uniq('a'); + result = _(array).uniq('a', any); + result = _(array).uniq<{a: number}>(true, {a: 42}); + result = _(array).uniq<{a: number}>({a: 42}); + + result = _(list).uniq(); + result = _(list).uniq(true); + result = _(list).uniq(true, listIterator); + result = _(list).uniq(true, listIterator, any); + result = _(list).uniq(true, listIterator); + result = _(list).uniq(true, listIterator, any); + result = _(list).uniq(listIterator); + result = _(list).uniq(listIterator, any); + result = _(list).uniq(listIterator); + result = _(list).uniq(listIterator, any); + result = _(list).uniq(true, 'a'); + result = _(list).uniq(true, 'a', any); + result = _(list).uniq('a'); + result = _(list).uniq('a', any); + result = _(list).uniq(true, {a: 42}); + result = _(list).uniq<{a: number}, SampleObject>(true, {a: 42}); + result = _(list).uniq({a: 42}); + result = _(list).uniq<{a: number}, SampleObject>({a: 42}); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _('abc').chain().uniq(); + result = _('abc').chain().uniq(true); + result = _('abc').chain().uniq(true, stringIterator); + result = _('abc').chain().uniq(true, stringIterator, any); + result = _('abc').chain().uniq(stringIterator); + result = _('abc').chain().uniq(stringIterator, any); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(array).chain().uniq(); + result = _(array).chain().uniq(true); + result = _(array).chain().uniq(true, listIterator); + result = _(array).chain().uniq(true, listIterator, any); + result = _(array).chain().uniq(listIterator); + result = _(array).chain().uniq(listIterator, any); + result = _(array).chain().uniq(true, 'a'); + result = _(array).chain().uniq(true, 'a', any); + result = _(array).chain().uniq('a'); + result = _(array).chain().uniq('a', any); + result = _(array).chain().uniq<{a: number}>(true, {a: 42}); + result = _(array).chain().uniq<{a: number}>({a: 42}); + + result = _(list).chain().uniq(); + result = _(list).chain().uniq(true); + result = _(list).chain().uniq(true, listIterator); + result = _(list).chain().uniq(true, listIterator, any); + result = _(list).chain().uniq(true, listIterator); + result = _(list).chain().uniq(true, listIterator, any); + result = _(list).chain().uniq(listIterator); + result = _(list).chain().uniq(listIterator, any); + result = _(list).chain().uniq(listIterator); + result = _(list).chain().uniq(listIterator, any); + result = _(list).chain().uniq(true, 'a'); + result = _(list).chain().uniq(true, 'a', any); + result = _(list).chain().uniq('a'); + result = _(list).chain().uniq('a', any); + result = _(list).chain().uniq(true, {a: 42}); + result = _(list).chain().uniq<{a: number}, SampleObject>(true, {a: 42}); + result = _(list).chain().uniq({a: 42}); + result = _(list).chain().uniq<{a: number}, SampleObject>({a: 42}); + } +} + +// _.unique +module TestUnique { + type SampleObject = {a: number; b: string; c: boolean}; + + let array: SampleObject[]; + let list: _.List; + + let stringIterator: (value: string, index: number, collection: string) => string; + let listIterator: (value: SampleObject, index: number, collection: _.List) => number; + + { + let result: string[]; + + result = _.unique('abc'); + result = _.unique('abc', true); + result = _.unique('abc', true, stringIterator); + result = _.unique('abc', true, stringIterator, any); + result = _.unique('abc', true, stringIterator); + result = _.unique('abc', true, stringIterator, any); + result = _.unique('abc', stringIterator); + result = _.unique('abc', stringIterator, any); + result = _.unique('abc', stringIterator); + result = _.unique('abc', stringIterator, any); + } + + { + let result: SampleObject[]; + + result = _.unique(array); + result = _.unique(array, true); + result = _.unique(array, true, listIterator); + result = _.unique(array, true, listIterator, any); + result = _.unique(array, true, listIterator); + result = _.unique(array, true, listIterator, any); + result = _.unique(array, listIterator); + result = _.unique(array, listIterator, any); + result = _.unique(array, listIterator); + result = _.unique(array, listIterator, any); + result = _.unique(array, true, 'a'); + result = _.unique(array, true, 'a', any); + result = _.unique(array, 'a'); + result = _.unique(array, 'a', any); + result = _.unique(array, true, {a: 42}); + result = _.unique<{a: number}, SampleObject>(array, true, {a: 42}); + result = _.unique(array, {a: 42}); + result = _.unique<{a: number}, SampleObject>(array, {a: 42}); + + result = _.unique(list); + result = _.unique(list, true); + result = _.unique(list, true, listIterator); + result = _.unique(list, true, listIterator, any); + result = _.unique(list, true, listIterator); + result = _.unique(list, true, listIterator, any); + result = _.unique(list, listIterator); + result = _.unique(list, listIterator, any); + result = _.unique(list, listIterator); + result = _.unique(list, listIterator, any); + result = _.unique(list, true, 'a'); + result = _.unique(list, true, 'a', any); + result = _.unique(list, 'a'); + result = _.unique(list, 'a', any); + result = _.unique(list, true, {a: 42}); + result = _.unique<{a: number}, SampleObject>(list, true, {a: 42}); + result = _.unique(list, {a: 42}); + result = _.unique<{a: number}, SampleObject>(list, {a: 42}); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _('abc').unique(); + result = _('abc').unique(true); + result = _('abc').unique(true, stringIterator); + result = _('abc').unique(true, stringIterator, any); + result = _('abc').unique(stringIterator); + result = _('abc').unique(stringIterator, any); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(array).unique(); + result = _(array).unique(true); + result = _(array).unique(true, listIterator); + result = _(array).unique(true, listIterator, any); + result = _(array).unique(listIterator); + result = _(array).unique(listIterator, any); + result = _(array).unique(true, 'a'); + result = _(array).unique(true, 'a', any); + result = _(array).unique('a'); + result = _(array).unique('a', any); + result = _(array).unique<{a: number}>(true, {a: 42}); + result = _(array).unique<{a: number}>({a: 42}); + + result = _(list).unique(); + result = _(list).unique(true); + result = _(list).unique(true, listIterator); + result = _(list).unique(true, listIterator, any); + result = _(list).unique(true, listIterator); + result = _(list).unique(true, listIterator, any); + result = _(list).unique(listIterator); + result = _(list).unique(listIterator, any); + result = _(list).unique(listIterator); + result = _(list).unique(listIterator, any); + result = _(list).unique(true, 'a'); + result = _(list).unique(true, 'a', any); + result = _(list).unique('a'); + result = _(list).unique('a', any); + result = _(list).unique(true, {a: 42}); + result = _(list).unique<{a: number}, SampleObject>(true, {a: 42}); + result = _(list).unique({a: 42}); + result = _(list).unique<{a: number}, SampleObject>({a: 42}); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _('abc').chain().unique(); + result = _('abc').chain().unique(true); + result = _('abc').chain().unique(true, stringIterator); + result = _('abc').chain().unique(true, stringIterator, any); + result = _('abc').chain().unique(stringIterator); + result = _('abc').chain().unique(stringIterator, any); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(array).chain().unique(); + result = _(array).chain().unique(true); + result = _(array).chain().unique(true, listIterator); + result = _(array).chain().unique(true, listIterator, any); + result = _(array).chain().unique(listIterator); + result = _(array).chain().unique(listIterator, any); + result = _(array).chain().unique(true, 'a'); + result = _(array).chain().unique(true, 'a', any); + result = _(array).chain().unique('a'); + result = _(array).chain().unique('a', any); + result = _(array).chain().unique<{a: number}>(true, {a: 42}); + result = _(array).chain().unique<{a: number}>({a: 42}); + + result = _(list).chain().unique(); + result = _(list).chain().unique(true); + result = _(list).chain().unique(true, listIterator); + result = _(list).chain().unique(true, listIterator, any); + result = _(list).chain().unique(true, listIterator); + result = _(list).chain().unique(true, listIterator, any); + result = _(list).chain().unique(listIterator); + result = _(list).chain().unique(listIterator, any); + result = _(list).chain().unique(listIterator); + result = _(list).chain().unique(listIterator, any); + result = _(list).chain().unique(true, 'a'); + result = _(list).chain().unique(true, 'a', any); + result = _(list).chain().unique('a'); + result = _(list).chain().unique('a', any); + result = _(list).chain().unique(true, {a: 42}); + result = _(list).chain().unique<{a: number}, SampleObject>(true, {a: 42}); + result = _(list).chain().unique({a: 42}); + result = _(list).chain().unique<{a: number}, SampleObject>({a: 42}); + } +} + +// _.upzip +module TestUnzip { + let array = [['a', 'b'], [1, 2], [true, false]]; + + let list: _.List<_.List> = { + 0: {0: 'a', 1: 'b', length: 2}, + 1: {0: 1, 1: 2, length: 2}, + 2: {0: true, 1: false, length: 2}, + length: 3 + }; + + { + let result: (string|number|boolean)[][]; + + result = _.unzip(array); + result = _.unzip(list); + } + + { + let result: _.LoDashImplicitArrayWrapper<(string|number|boolean)[]>; + + result = _(array).unzip(); + result = _(list).unzip(); + } + + { + let result: _.LoDashExplicitArrayWrapper<(string|number|boolean)[]>; + + result = _(array).chain().unzip(); + result = _(list).chain().unzip(); + } +} + +// _.unzipWith +{ + let testUnzipWithArray: (number[]|_.List)[]; + let testUnzipWithList: _.List>; + let testUnzipWithIterator: {(prev: TResult, curr: number, index?: number, list?: number[]): TResult}; + let result: TResult[]; + result = _.unzipWith(testUnzipWithArray); + result = _.unzipWith(testUnzipWithArray, testUnzipWithIterator); + result = _.unzipWith(testUnzipWithArray, testUnzipWithIterator, any); + result = _.unzipWith(testUnzipWithList); + result = _.unzipWith(testUnzipWithList, testUnzipWithIterator); + result = _.unzipWith(testUnzipWithList, testUnzipWithIterator, any); + result = _(testUnzipWithArray).unzipWith(testUnzipWithIterator).value(); + result = _(testUnzipWithArray).unzipWith(testUnzipWithIterator, any).value(); + result = _(testUnzipWithList).unzipWith(testUnzipWithIterator).value(); + result = _(testUnzipWithList).unzipWith(testUnzipWithIterator, any).value(); +} + +// _.without +module TestWithout { + let array: number[]; + let list: _.List; + + { + let result: number[]; + + result = _.without(array); + result = _.without(array, 1); + result = _.without(array, 1, 2); + result = _.without(array, 1, 2, 3); + + result = _.without(list); + result = _.without(list, 1); + result = _.without(list, 1, 2); + result = _.without(list, 1, 2, 3); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(array).without(); + result = _(array).without(1); + result = _(array).without(1, 2); + result = _(array).without(1, 2, 3); + result = _(list).without(); + result = _(list).without(1); + result = _(list).without(1, 2); + result = _(list).without(1, 2, 3); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(array).chain().without(); + result = _(array).chain().without(1); + result = _(array).chain().without(1, 2); + result = _(array).chain().without(1, 2, 3); + + result = _(list).chain().without(); + result = _(list).chain().without(1); + result = _(list).chain().without(1, 2); + result = _(list).chain().without(1, 2, 3); + } +} + +// _.xor +module TestXor { + let array: TResult[]; + let list: _.List; + + { + let result: TResult[]; + + result = _.xor(); + + result = _.xor(array); + result = _.xor(array, list); + result = _.xor(array, list, array); + + result = _.xor(list); + result = _.xor(list, array); + result = _.xor(list, array, list); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(array).xor(); + result = _(array).xor(list); + result = _(array).xor(list, array); + + result = _(list).xor(); + result = _(list).xor(array); + result = _(list).xor(array, list); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(array).chain().xor(); + result = _(array).chain().xor(list); + result = _(array).chain().xor(list, array); + + result = _(list).chain().xor(); + result = _(list).chain().xor(array); + result = _(list).chain().xor(array, list); + } +} + +// _.zip +module TestZip { + let array: TResult[]; + let list: _.List; + + { + let result: TResult[][]; + + result = _.zip(array); + result = _.zip(array, list); + result = _.zip(array, list, array); + + result = _.zip(list); + result = _.zip(list, array); + result = _.zip(list, array, list); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(array).zip(list); + result = _(array).zip(list, array); + + result = _(list).zip(array); + result = _(list).zip(array, list); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(array).chain().zip(list); + result = _(array).chain().zip(list, array); + + result = _(list).chain().zip(array); + result = _(list).chain().zip(array, list); + } +} + +// _.zipObject +module TestZipObject { + let arrayOfKeys: string[]; + let arrayOfValues: number[]; + let arrayOfKeyValuePairs: (string|number)[][] + + let listOfKeys: _.List; + let listOfValues: _.List; + let listOfKeyValuePairs: _.List<_.List>; + + { + let result: _.Dictionary; + + result = _.zipObject<_.Dictionary>(arrayOfKeys); + result = _.zipObject<_.Dictionary>(listOfKeys); + } + + { + let result: _.Dictionary; + + result = _.zipObject<_.Dictionary>(arrayOfKeys, arrayOfValues); + result = _.zipObject<_.Dictionary>(arrayOfKeys, listOfValues); + result = _.zipObject<_.Dictionary>(listOfKeys, listOfValues); + result = _.zipObject<_.Dictionary>(listOfKeys, arrayOfValues); + + result = _.zipObject>(arrayOfKeys, arrayOfValues); + result = _.zipObject>(arrayOfKeys, listOfValues); + result = _.zipObject>(listOfKeys, listOfValues); + result = _.zipObject>(listOfKeys, arrayOfValues); + + result = _.zipObject<_.Dictionary>(arrayOfKeyValuePairs); + result = _.zipObject<_.Dictionary>(listOfKeyValuePairs); + } + + { + let result: _.Dictionary; + + result = _.zipObject(arrayOfKeys); + result = _.zipObject(arrayOfKeys, arrayOfValues); + result = _.zipObject(arrayOfKeys, listOfValues); + + result = _.zipObject(listOfKeys); + result = _.zipObject(listOfKeys, listOfValues); + result = _.zipObject(listOfKeys, arrayOfValues); + + result = _.zipObject<_.Dictionary>(arrayOfKeyValuePairs); + result = _.zipObject<_.Dictionary>(listOfKeyValuePairs); + } + + { + let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; + + result = _(arrayOfKeys).zipObject<_.Dictionary>(); + result = _(listOfKeys).zipObject<_.Dictionary>(); + } + + { + let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; + + result = _(arrayOfKeys).zipObject<_.Dictionary>(arrayOfValues); + result = _(arrayOfKeys).zipObject<_.Dictionary>(listOfValues); + result = _(listOfKeys).zipObject<_.Dictionary>(listOfValues); + result = _(listOfKeys).zipObject<_.Dictionary>(arrayOfValues); + + result = _(arrayOfKeys).zipObject>(arrayOfValues); + result = _(arrayOfKeys).zipObject>(listOfValues); + result = _(listOfKeys).zipObject>(listOfValues); + result = _(listOfKeys).zipObject>(arrayOfValues); + + result = _(listOfKeys).zipObject<_.Dictionary>(arrayOfKeyValuePairs); + result = _(listOfKeys).zipObject<_.Dictionary>(listOfKeyValuePairs); + } + + { + let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; + + result = _(arrayOfKeys).zipObject(); + result = _(arrayOfKeys).zipObject(arrayOfValues); + result = _(arrayOfKeys).zipObject(listOfValues); + + result = _(listOfKeys).zipObject(); + result = _(listOfKeys).zipObject(listOfValues); + result = _(listOfKeys).zipObject(arrayOfValues); + + result = _(listOfKeys).zipObject(arrayOfKeyValuePairs); + result = _(listOfKeys).zipObject(listOfKeyValuePairs); + } + + { + let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; + + result = _(arrayOfKeys).chain().zipObject<_.Dictionary>(); + result = _(listOfKeys).chain().zipObject<_.Dictionary>(); + } + + { + let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; + + result = _(arrayOfKeys).chain().zipObject<_.Dictionary>(arrayOfValues); + result = _(arrayOfKeys).chain().zipObject<_.Dictionary>(listOfValues); + result = _(listOfKeys).chain().zipObject<_.Dictionary>(listOfValues); + result = _(listOfKeys).chain().zipObject<_.Dictionary>(arrayOfValues); + + result = _(arrayOfKeys).chain().zipObject>(arrayOfValues); + result = _(arrayOfKeys).chain().zipObject>(listOfValues); + result = _(listOfKeys).chain().zipObject>(listOfValues); + result = _(listOfKeys).chain().zipObject>(arrayOfValues); + + result = _(listOfKeys).chain().zipObject<_.Dictionary>(arrayOfKeyValuePairs); + result = _(listOfKeys).chain().zipObject<_.Dictionary>(listOfKeyValuePairs); + } + + { + let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; + + result = _(arrayOfKeys).chain().zipObject(); + result = _(arrayOfKeys).chain().zipObject(arrayOfValues); + result = _(arrayOfKeys).chain().zipObject(listOfValues); + + result = _(listOfKeys).chain().zipObject(); + result = _(listOfKeys).chain().zipObject(listOfValues); + result = _(listOfKeys).chain().zipObject(arrayOfValues); + + result = _(listOfKeys).chain().zipObject(arrayOfKeyValuePairs); + result = _(listOfKeys).chain().zipObject(listOfKeyValuePairs); + } +} + +// _.zipWith +interface TestZipWithFn { + (a1: number, a2: number): number; +} +var testZipWithFn: TestZipWithFn; +result = _.zipWith([1, 2]); +result = _.zipWith([1, 2], testZipWithFn); +result = _.zipWith([1, 2], testZipWithFn, any); +result = _.zipWith([1, 2], [1, 2], testZipWithFn, any); +result = _.zipWith([1, 2], [1, 2], [1, 2], [1, 2], [1, 2], [1, 2], testZipWithFn, any); +result = _([1, 2]).zipWith().value(); +result = _([1, 2]).zipWith(testZipWithFn).value(); +result = _([1, 2]).zipWith(testZipWithFn, any).value(); +result = _([1, 2]).zipWith([1, 2], testZipWithFn, any).value(); +result = _([1, 2]).zipWith([1, 2], [1, 2], [1, 2], [1, 2], [1, 2], testZipWithFn, any).value(); + +/********* + * Chain * + *********/ + +// _.chain +module TestChain { + { + let result: _.LoDashExplicitWrapper; + + result = _.chain(''); + result = _('').chain(); + + result = _.chain('').chain(); + result = _('').chain().chain(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _.chain(42); + result = _(42).chain(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _.chain(true); + result = _(true).chain(); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _.chain(['']); + result = _(['']).chain(); + } + + { + let result: _.LoDashExplicitObjectWrapper<{a: string}>; + + result = _.chain<{a: string}>({a: ''}); + result = _<{a: string}>({a: ''}).chain(); + } +} + +// _.tap +module TestTap { + { + let interceptor: (value: string) => void; + let result: string; + + _.tap('', interceptor); + _.tap('', interceptor, any); + } + + { + let interceptor: (value: string[]) => void; + let result: _.LoDashImplicitArrayWrapper; + + _.tap([''], interceptor); + _.tap([''], interceptor, any); + } + + { + let interceptor: (value: {a: string}) => void; + let result: _.LoDashImplicitObjectWrapper<{a: string}>; + + _.tap({a: ''}, interceptor); + _.tap({a: ''}, interceptor, any); + } + + { + let interceptor: (value: string) => void; + let result: _.LoDashImplicitWrapper; + + _.chain('').tap(interceptor, any); + _.chain('').tap(interceptor, any); + + _('').tap(interceptor); + _('').tap(interceptor, any); + } + + { + let interceptor: (value: string[]) => void; + let result: _.LoDashImplicitArrayWrapper; + + _.chain(['']).tap(interceptor); + _.chain(['']).tap(interceptor, any); + + _(['']).tap(interceptor); + _(['']).tap(interceptor, any); + } + + { + let interceptor: (value: {a: string}) => void; + let result: _.LoDashImplicitObjectWrapper<{a: string}>; + + _.chain({a: ''}).tap(interceptor); + _.chain({a: ''}).tap(interceptor, any); + + _({a: ''}).tap(interceptor); + _({a: ''}).tap(interceptor, any); + } + + { + let interceptor: (value: string) => void; + let result: _.LoDashExplicitWrapper; + + _.chain('').tap(interceptor, any); + _.chain('').tap(interceptor, any); + + _('').chain().tap(interceptor); + _('').chain().tap(interceptor, any); + } + + { + let interceptor: (value: string[]) => void; + let result: _.LoDashExplicitArrayWrapper; + + _.chain(['']).tap(interceptor); + _.chain(['']).tap(interceptor, any); + + _(['']).chain().tap(interceptor); + _(['']).chain().tap(interceptor, any); + } + + { + let interceptor: (value: {a: string}) => void; + let result: _.LoDashExplicitObjectWrapper<{a: string}>; + + _.chain({a: ''}).tap(interceptor); + _.chain({a: ''}).tap(interceptor, any); + + _({a: ''}).chain().tap(interceptor); + _({a: ''}).chain().tap(interceptor, any); + } +} + +// _.thru +module TestThru { + interface Interceptor { + (value: T): T; + } + + { + let interceptor: Interceptor; + let result: number; + + result = _.thru(1, interceptor); + result = _.thru(1, interceptor, any); + } + + { + let interceptor: Interceptor; + let result: _.LoDashImplicitWrapper; + + result = _(1).thru(interceptor); + result = _(1).thru(interceptor, any); + } + + { + let interceptor: Interceptor; + let result: _.LoDashImplicitWrapper; + + result = _('').thru(interceptor); + result = _('').thru(interceptor, any); + } + + { + let interceptor: Interceptor; + let result: _.LoDashImplicitWrapper; + + result = _(true).thru(interceptor); + result = _(true).thru(interceptor, any); + } + + { + let interceptor: Interceptor<{a: string}>; + let result: _.LoDashImplicitObjectWrapper<{a: string}>; + + result = _({a: ''}).thru<{a: string}>(interceptor); + result = _({a: ''}).thru<{a: string}>(interceptor, any); + } + + { + let interceptor: Interceptor; + let result: _.LoDashImplicitArrayWrapper; + + result = _([1, 2, 3]).thru(interceptor); + result = _([1, 2, 3]).thru(interceptor, any); + } + + { + let interceptor: Interceptor; + let result: _.LoDashExplicitWrapper; + + result = _(1).chain().thru(interceptor); + result = _(1).chain().thru(interceptor, any); + } + + { + let interceptor: Interceptor; + let result: _.LoDashExplicitWrapper; + + result = _('').chain().thru(interceptor); + result = _('').chain().thru(interceptor, any); + } + + { + let interceptor: Interceptor; + let result: _.LoDashExplicitWrapper; + + result = _(true).chain().thru(interceptor); + result = _(true).chain().thru(interceptor, any); + } + + { + let interceptor: Interceptor<{a: string}>; + let result: _.LoDashExplicitObjectWrapper<{a: string}>; + + result = _({a: ''}).chain().thru<{a: string}>(interceptor); + result = _({a: ''}).chain().thru<{a: string}>(interceptor, any); + } + + { + let interceptor: Interceptor; + let result: _.LoDashExplicitArrayWrapper; + + result = _([1, 2, 3]).chain().thru(interceptor); + result = _([1, 2, 3]).chain().thru(interceptor, any); + } +} + +// _.prototype.commit +module TestCommit { + { + let result: _.LoDashImplicitWrapper; + result = _(42).commit(); + } + + { + let result: _.LoDashImplicitArrayWrapper; + result = _([]).commit(); + } + + { + let result: _.LoDashImplicitObjectWrapper; + result = _({}).commit(); + } + + { + let result: _.LoDashExplicitWrapper; + result = _(42).chain().commit(); + } + + { + let result: _.LoDashExplicitArrayWrapper; + result = _([]).chain().commit(); + } + + { + let result: _.LoDashExplicitObjectWrapper; + result = _({}).chain().commit(); + } +} + +// _.prototype.concat +module TestConcat { + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(1).concat(2); + result = _(1).concat(2, 3); + result = _(1).concat(2, 3, 4); + + result = _(1).concat(2); + result = _(1).concat(2, 3); + result = _(1).concat(2, 3, 4); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(['']).concat(['']); + result = _(['']).concat([''], ['']); + result = _(['']).concat([''], [''], ['']); + + result = _(['']).concat(['']); + result = _(['']).concat([''], ['']); + result = _(['']).concat([''], [''], ['']); + } + + { + let result: _.LoDashImplicitArrayWrapper<{a: string}>; + + result = _({a: ''}).concat<{a: string}>({a: ''}); + result = _({a: ''}).concat<{a: string}>({a: ''}, {a: ''}); + result = _({a: ''}).concat<{a: string}>({a: ''}, {a: ''}, {a: ''}); + + result = _({a: ''}).concat({a: ''}); + result = _({a: ''}).concat({a: ''}, {a: ''}); + result = _({a: ''}).concat({a: ''}, {a: ''}, {a: ''}); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(1).chain().concat(2); + result = _(1).chain().concat(2, 3); + result = _(1).chain().concat(2, 3, 4); + + result = _(1).chain().concat(2); + result = _(1).chain().concat(2, 3); + result = _(1).chain().concat(2, 3, 4); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(['']).chain().concat(['']); + result = _(['']).chain().concat([''], ['']); + result = _(['']).chain().concat([''], [''], ['']); + + result = _(['']).chain().concat(['']); + result = _(['']).chain().concat([''], ['']); + result = _(['']).chain().concat([''], [''], ['']); + } + + { + let result: _.LoDashExplicitArrayWrapper<{a: string}>; + + result = _({a: ''}).chain().concat<{a: string}>({a: ''}); + result = _({a: ''}).chain().concat<{a: string}>({a: ''}, {a: ''}); + result = _({a: ''}).chain().concat<{a: string}>({a: ''}, {a: ''}, {a: ''}); + + result = _({a: ''}).chain().concat({a: ''}); + result = _({a: ''}).chain().concat({a: ''}, {a: ''}); + result = _({a: ''}).chain().concat({a: ''}, {a: ''}, {a: ''}); + } +} + +// _.prototype.plant +module TestPlant { + { + let result: _.LoDashImplicitWrapper; + result = _(any).plant(42); + } + + { + let result: _.LoDashImplicitStringWrapper; + result = _(any).plant(''); + } + + { + let result: _.LoDashImplicitWrapper; + result = _(any).plant(true); + } + + { + let result: _.LoDashImplicitNumberArrayWrapper; + result = _(any).plant([42]); + } + + { + let result: _.LoDashImplicitArrayWrapper; + result = _(any).plant([]); + } + + { + let result: _.LoDashImplicitObjectWrapper<{}>; + result = _(any).plant<{}>({}); + } + + { + let result: _.LoDashExplicitWrapper; + result = _(any).chain().plant(42); + } + + { + let result: _.LoDashExplicitStringWrapper; + result = _(any).chain().plant(''); + } + + { + let result: _.LoDashExplicitWrapper; + result = _(any).chain().plant(true); + } + + { + let result: _.LoDashExplicitNumberArrayWrapper; + result = _(any).chain().plant([42]); + } + + { + let result: _.LoDashExplicitArrayWrapper; + result = _(any).chain().plant([]); + } + + { + let result: _.LoDashExplicitObjectWrapper<{}>; + result = _(any).chain().plant<{}>({}); + } +} + +// _.prototype.reverse +module TestReverse { + { + let result: _.LoDashImplicitArrayWrapper; + result: _([42]).reverse(); + } + + { + let result: _.LoDashExplicitArrayWrapper; + result: _([42]).chain().reverse(); + } +} + +// _.prototype.run +module TestRun { + { + let result: string; + + result = _('').run(); + result = _('').chain().run(); + } + + { + let result: number; + + result = _(42).run(); + result = _(42).chain().run(); + } + + { + let result: boolean; + + result = _(true).run(); + result = _(true).chain().run(); + } + + { + let result: string[]; + + result = _([]).run(); + result = _([]).chain().run(); + } + + { + let result: {a: string}; + + result = _({a: ''}).run(); + result = _({a: ''}).chain().run(); + } +} + +// _.prototype.toJSON +module TestToJSON { + { + let result: string; + + result = _('').toJSON(); + result = _('').chain().toJSON(); + } + + { + let result: number; + + result = _(42).toJSON(); + result = _(42).chain().toJSON(); + } + + { + let result: boolean; + + result = _(true).toJSON(); + result = _(true).chain().toJSON(); + } + + { + let result: string[]; + + result = _([]).toJSON(); + result = _([]).chain().toJSON(); + } + + { + let result: {a: string}; + + result = _({a: ''}).toJSON(); + result = _({a: ''}).chain().toJSON(); + } +} + +// _.prototype.toString +module TestToString { + let result: string; + + result = _('').toString(); + result = _(42).toString(); + result = _(true).toString(); + result = _(['']).toString(); + result = _({}).toString(); + + result = _('').chain().toString(); + result = _(42).chain().toString(); + result = _(true).chain().toString(); + result = _(['']).chain().toString(); + result = _({}).chain().toString(); +} + +// _.prototype.value +module TestValue { + { + let result: string; + + result = _('').value(); + result = _('').chain().value(); + } + + { + let result: number; + + result = _(42).value(); + result = _(42).chain().value(); + } + + { + let result: boolean; + + result = _(true).value(); + result = _(true).chain().value(); + } + + { + let result: string[]; + + result = _([]).value(); + result = _([]).chain().value(); + } + + { + let result: {a: string}; + + result = _({a: ''}).value(); + result = _({a: ''}).chain().value(); + } +} + +// _.prototype.valueOf +module TestValueOf { + { + let result: string; + + result = _('').valueOf(); + result = _('').chain().valueOf(); + } + + { + let result: number; + + result = _(42).valueOf(); + result = _(42).chain().valueOf(); + } + + { + let result: boolean; + + result = _(true).valueOf(); + result = _(true).chain().valueOf(); + } + + { + let result: string[]; + + result = _([]).valueOf(); + result = _([]).chain().valueOf(); + } + + { + let result: {a: string}; + + result = _({a: ''}).valueOf(); + result = _({a: ''}).chain().valueOf(); + } +} + +/************** + * Collection * + **************/ + +// _.all +module TestAll { + let array: TResult[]; + let list: _.List; + let dictionary: _.Dictionary; + + let listIterator: (value: TResult, index: number, collection: _.List) => boolean; + let dictionaryIterator: (value: TResult, key: string, collection: _.Dictionary) => boolean; + + { + let result: boolean; + + result = _.all(array); + result = _.all(array, listIterator); + result = _.all(array, listIterator, any); + result = _.all(array, ''); + result = _.all<{a: number}, TResult>(array, {a: 42}); + + result = _.all(list); + result = _.all(list, listIterator); + result = _.all(list, listIterator, any); + result = _.all(list, ''); + result = _.all<{a: number}, TResult>(list, {a: 42}); + + result = _.all(dictionary); + result = _.all(dictionary, dictionaryIterator); + result = _.all(dictionary, dictionaryIterator, any); + result = _.all(dictionary, ''); + result = _.all<{a: number}, TResult>(dictionary, {a: 42}); + + result = _(array).all(); + result = _(array).all(listIterator); + result = _(array).all(listIterator, any); + result = _(array).all(''); + result = _(array).all<{a: number}>({a: 42}); + + result = _(list).all(); + result = _(list).all(listIterator); + result = _(list).all(listIterator, any); + result = _(list).all(''); + result = _(list).all<{a: number}>({a: 42}); + + result = _(dictionary).all(); + result = _(dictionary).all(dictionaryIterator); + result = _(dictionary).all(dictionaryIterator, any); + result = _(dictionary).all(''); + result = _(dictionary).all<{a: number}>({a: 42}); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(array).chain().all(); + result = _(array).chain().all(listIterator); + result = _(array).chain().all(listIterator, any); + result = _(array).chain().all(''); + result = _(array).chain().all<{a: number}>({a: 42}); + + result = _(list).chain().all(); + result = _(list).chain().all(listIterator); + result = _(list).chain().all(listIterator, any); + result = _(list).chain().all(''); + result = _(list).chain().all<{a: number}>({a: 42}); + + result = _(dictionary).chain().all(); + result = _(dictionary).chain().all(dictionaryIterator); + result = _(dictionary).chain().all(dictionaryIterator, any); + result = _(dictionary).chain().all(''); + result = _(dictionary).chain().all<{a: number}>({a: 42}); + } +} + +// _.any +module TestAny { + let array: TResult[]; + let list: _.List; + let dictionary: _.Dictionary; + let numericDictionary: _.NumericDictionary; + + let listIterator: (value: TResult, index: number, collection: _.List) => boolean; + let dictionaryIterator: (value: TResult, key: string, collection: _.Dictionary) => boolean; + let numericDictionaryIterator: (value: TResult, key: number, collection: _.NumericDictionary) => boolean; + + { + let result: boolean; + + result = _.any(array); + result = _.any(array, listIterator); + result = _.any(array, listIterator, any); + result = _.any(array, ''); + result = _.any<{a: number}, TResult>(array, {a: 42}); + + result = _.any(list); + result = _.any(list, listIterator); + result = _.any(list, listIterator, any); + result = _.any(list, ''); + result = _.any<{a: number}, TResult>(list, {a: 42}); + + result = _.any(dictionary); + result = _.any(dictionary, dictionaryIterator); + result = _.any(dictionary, dictionaryIterator, any); + result = _.any(dictionary, ''); + result = _.any<{a: number}, TResult>(dictionary, {a: 42}); + + result = _.any(numericDictionary); + result = _.any(numericDictionary, numericDictionaryIterator); + result = _.any(numericDictionary, numericDictionaryIterator, any); + result = _.any(numericDictionary, ''); + result = _.any<{a: number}, TResult>(numericDictionary, {a: 42}); + + result = _(array).any(); + result = _(array).any(listIterator); + result = _(array).any(listIterator, any); + result = _(array).any(''); + result = _(array).any<{a: number}>({a: 42}); + + result = _(list).any(); + result = _(list).any(listIterator); + result = _(list).any(listIterator, any); + result = _(list).any(''); + result = _(list).any<{a: number}>({a: 42}); + + result = _(dictionary).any(); + result = _(dictionary).any(dictionaryIterator); + result = _(dictionary).any(dictionaryIterator, any); + result = _(dictionary).any(''); + result = _(dictionary).any<{a: number}>({a: 42}); + + result = _(numericDictionary).any(); + result = _(numericDictionary).any(numericDictionaryIterator); + result = _(numericDictionary).any(numericDictionaryIterator, any); + result = _(numericDictionary).any(''); + result = _(numericDictionary).any<{a: number}>({a: 42}); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(array).chain().any(); + result = _(array).chain().any(listIterator); + result = _(array).chain().any(listIterator, any); + result = _(array).chain().any(''); + result = _(array).chain().any<{a: number}>({a: 42}); + + result = _(list).chain().any(); + result = _(list).chain().any(listIterator); + result = _(list).chain().any(listIterator, any); + result = _(list).chain().any(''); + result = _(list).chain().any<{a: number}>({a: 42}); + + result = _(dictionary).chain().any(); + result = _(dictionary).chain().any(dictionaryIterator); + result = _(dictionary).chain().any(dictionaryIterator, any); + result = _(dictionary).chain().any(''); + result = _(dictionary).chain().any<{a: number}>({a: 42}); + + result = _(numericDictionary).chain().any(); + result = _(numericDictionary).chain().any(numericDictionaryIterator); + result = _(numericDictionary).chain().any(numericDictionaryIterator, any); + result = _(numericDictionary).chain().any(''); + result = _(numericDictionary).chain().any<{a: number}>({a: 42}); + } +} + +// _.at +module TestAt { + let array: TResult[]; + let list: _.List; + let dictionary: _.Dictionary; + + { + let result: TResult[]; + + result = _.at(array, 0, '1', [2], ['3'], [4, '5']); + result = _.at(list, 0, '1', [2], ['3'], [4, '5']); + result = _.at(dictionary, 0, '1', [2], ['3'], [4, '5']); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(array).at(0, '1', [2], ['3'], [4, '5']); + result = _(list).at(0, '1', [2], ['3'], [4, '5']); + result = _(dictionary).at(0, '1', [2], ['3'], [4, '5']); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(array).chain().at(0, '1', [2], ['3'], [4, '5']); + result = _(list).chain().at(0, '1', [2], ['3'], [4, '5']); + result = _(dictionary).chain().at(0, '1', [2], ['3'], [4, '5']); + } +} + +// _.collect +module TestCollect { + let array: number[]; + let list: _.List; + let dictionary: _.Dictionary; + + let listIterator: (value: number, index: number, collection: _.List) => TResult; + let dictionaryIterator: (value: number, key: string, collection: _.Dictionary) => TResult; + + { + let result: TResult[]; + + result = _.collect(array); + result = _.collect(array, listIterator); + result = _.collect(array, listIterator, any); + result = _.collect(array, ''); + + result = _.collect(list); + result = _.collect(list, listIterator); + result = _.collect(list, listIterator, any); + result = _.collect(list, ''); + + result = _.collect(dictionary); + result = _.collect(dictionary, dictionaryIterator); + result = _.collect(dictionary, dictionaryIterator, any); + result = _.collect(dictionary, ''); + } + + { + let result: boolean[]; + + result = _.collect(array, {}); + result = _.collect(list, {}); + result = _.collect(dictionary, {}); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(array).collect(); + result = _(array).collect(listIterator); + result = _(array).collect(listIterator, any); + result = _(array).collect(''); + + result = _(list).collect(); + result = _(list).collect(listIterator); + result = _(list).collect(listIterator, any); + result = _(list).collect(''); + + result = _(dictionary).collect(); + result = _(dictionary).collect(dictionaryIterator); + result = _(dictionary).collect(dictionaryIterator, any); + result = _(dictionary).collect(''); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(array).collect<{}>({}); + result = _(list).collect<{}>({}); + result = _(dictionary).collect<{}>({}); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(array).chain().collect(); + result = _(array).chain().collect(listIterator); + result = _(array).chain().collect(listIterator, any); + result = _(array).chain().collect(''); + + result = _(list).chain().collect(); + result = _(list).chain().collect(listIterator); + result = _(list).chain().collect(listIterator, any); + result = _(list).chain().collect(''); + + result = _(dictionary).chain().collect(); + result = _(dictionary).chain().collect(dictionaryIterator); + result = _(dictionary).chain().collect(dictionaryIterator, any); + result = _(dictionary).chain().collect(''); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(array).chain().collect<{}>({}); + result = _(list).chain().collect<{}>({}); + result = _(dictionary).chain().collect<{}>({}); + } +} + +// _.contains +module TestContains { + type SampleType = {a: string; b: number; c: boolean;}; + + let array: SampleType[]; + let list: _.List; + let dictionary: _.Dictionary; + + let target: SampleType; + + { + let result: boolean; + + result = _.contains(array, target); + result = _.contains(array, target, 42); + + result = _.contains(list, target); + result = _.contains(list, target, 42); + + result = _.contains(dictionary, target); + result = _.contains(dictionary, target, 42); + + result = _(array).contains(target); + result = _(array).contains(target, 42); + + result = _(list).contains(target); + result = _(list).contains(target, 42); + + result = _(dictionary).contains(target); + result = _(dictionary).contains(target, 42); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(array).chain().contains(target); + result = _(array).chain().contains(target, 42); + + result = _(list).chain().contains(target); + result = _(list).chain().contains(target, 42); + + result = _(dictionary).chain().contains(target); + result = _(dictionary).chain().contains(target, 42); + } +} + +// _.countBy +module TestCountBy { + let array: TResult[]; + let list: _.List; + let dictionary: _.Dictionary; + let numericDictionary: _.NumericDictionary; + + let stringIterator: (value: string, index: number, collection: string) => any; + let listIterator: (value: TResult, index: number, collection: _.List) => any; + let dictionaryIterator: (value: TResult, key: string, collection: _.Dictionary) => any; + let numericDictionaryIterator: (value: TResult, key: number, collection: _.NumericDictionary) => any; + + { + let result: _.Dictionary; + + result = _.countBy(''); + result = _.countBy('', stringIterator); + result = _.countBy('', stringIterator, any); + + result = _.countBy(array); + result = _.countBy(array, listIterator); + result = _.countBy(array, listIterator, any); + result = _.countBy(array, ''); + result = _.countBy(array, '', any); + result = _.countBy<{a: number}, TResult>(array, {a: 42}); + result = _.countBy(array, {a: 42}); + + result = _.countBy(list); + result = _.countBy(list, listIterator); + result = _.countBy(list, listIterator, any); + result = _.countBy(list, ''); + result = _.countBy(list, '', any); + result = _.countBy<{a: number}, TResult>(list, {a: 42}); + result = _.countBy(list, {a: 42}); + + result = _.countBy(dictionary); + result = _.countBy(dictionary, dictionaryIterator); + result = _.countBy(dictionary, dictionaryIterator, any); + result = _.countBy(dictionary, ''); + result = _.countBy(dictionary, '', any); + result = _.countBy<{a: number}, TResult>(dictionary, {a: 42}); + result = _.countBy(dictionary, {a: 42}); + + result = _.countBy(numericDictionary); + result = _.countBy(numericDictionary, numericDictionaryIterator); + result = _.countBy(numericDictionary, numericDictionaryIterator, any); + result = _.countBy(numericDictionary, ''); + result = _.countBy(numericDictionary, '', any); + result = _.countBy<{a: number}, TResult>(numericDictionary, {a: 42}); + result = _.countBy(numericDictionary, {a: 42}); + } + + { + let resutl: _.LoDashImplicitObjectWrapper<_.Dictionary>; + + result = _('').countBy(); + result = _('').countBy(stringIterator); + result = _('').countBy(stringIterator, any); + + result = _(array).countBy(); + result = _(array).countBy(listIterator); + result = _(array).countBy(listIterator, any); + result = _(array).countBy(''); + result = _(array).countBy('', any); + result = _(array).countBy<{a: number}>({a: 42}); + result = _(array).countBy({a: 42}); + + result = _(list).countBy(); + result = _(list).countBy(listIterator); + result = _(list).countBy(listIterator, any); + result = _(list).countBy(''); + result = _(list).countBy('', any); + result = _(list).countBy<{a: number}>({a: 42}); + result = _(list).countBy({a: 42}); + + result = _(dictionary).countBy(); + result = _(dictionary).countBy(dictionaryIterator); + result = _(dictionary).countBy(dictionaryIterator, any); + result = _(dictionary).countBy(''); + result = _(dictionary).countBy('', any); + result = _(dictionary).countBy<{a: number}>({a: 42}); + result = _(dictionary).countBy({a: 42}); + + result = _(numericDictionary).countBy(); + result = _(numericDictionary).countBy(numericDictionaryIterator); + result = _(numericDictionary).countBy(numericDictionaryIterator, any); + result = _(numericDictionary).countBy(''); + result = _(numericDictionary).countBy('', any); + result = _(numericDictionary).countBy<{a: number}>({a: 42}); + result = _(numericDictionary).countBy({a: 42}); + } + + { + let resutl: _.LoDashExplicitObjectWrapper<_.Dictionary>; + + result = _('').chain().countBy(); + result = _('').chain().countBy(stringIterator); + result = _('').chain().countBy(stringIterator, any); + + result = _(array).chain().countBy(); + result = _(array).chain().countBy(listIterator); + result = _(array).chain().countBy(listIterator, any); + result = _(array).chain().countBy(''); + result = _(array).chain().countBy('', any); + result = _(array).chain().countBy<{a: number}>({a: 42}); + result = _(array).chain().countBy({a: 42}); + + result = _(list).chain().countBy(); + result = _(list).chain().countBy(listIterator); + result = _(list).chain().countBy(listIterator, any); + result = _(list).chain().countBy(''); + result = _(list).chain().countBy('', any); + result = _(list).chain().countBy<{a: number}>({a: 42}); + result = _(list).chain().countBy({a: 42}); + + result = _(dictionary).chain().countBy(); + result = _(dictionary).chain().countBy(dictionaryIterator); + result = _(dictionary).chain().countBy(dictionaryIterator, any); + result = _(dictionary).chain().countBy(''); + result = _(dictionary).chain().countBy('', any); + result = _(dictionary).chain().countBy<{a: number}>({a: 42}); + result = _(dictionary).chain().countBy({a: 42}); + + result = _(numericDictionary).chain().countBy(); + result = _(numericDictionary).chain().countBy(numericDictionaryIterator); + result = _(numericDictionary).chain().countBy(numericDictionaryIterator, any); + result = _(numericDictionary).chain().countBy(''); + result = _(numericDictionary).chain().countBy('', any); + result = _(numericDictionary).chain().countBy<{a: number}>({a: 42}); + result = _(numericDictionary).chain().countBy({a: 42}); + } +} + +// _.detect +module TestDetect { + let array: TResult[]; + let list: _.List; + let dictionary: _.Dictionary; + + let listIterator: (value: TResult, index: number, collection: _.List) => boolean; + let dictionaryIterator: (value: TResult, key: string, collection: _.Dictionary) => boolean; + + let result: TResult; + + result = _.detect(array); + result = _.detect(array, listIterator); + result = _.detect(array, listIterator, any); + result = _.detect(array, ''); + result = _.detect<{a: number}, TResult>(array, {a: 42}); + + result = _.detect(list); + result = _.detect(list, listIterator); + result = _.detect(list, listIterator, any); + result = _.detect(list, ''); + result = _.detect<{a: number}, TResult>(list, {a: 42}); + + result = _.detect(dictionary); + result = _.detect(dictionary, dictionaryIterator); + result = _.detect(dictionary, dictionaryIterator, any); + result = _.detect(dictionary, ''); + result = _.detect<{a: number}, TResult>(dictionary, {a: 42}); + + result = _(array).detect(); + result = _(array).detect(listIterator); + result = _(array).detect(listIterator, any); + result = _(array).detect(''); + result = _(array).detect<{a: number}>({a: 42}); + + result = _(list).detect(); + result = _(list).detect(listIterator); + result = _(list).detect(listIterator, any); + result = _(list).detect(''); + result = _(list).detect<{a: number}, TResult>({a: 42}); + + result = _(dictionary).detect(); + result = _(dictionary).detect(dictionaryIterator); + result = _(dictionary).detect(dictionaryIterator, any); + result = _(dictionary).detect(''); + result = _(dictionary).detect<{a: number}, TResult>({a: 42}); +} + +// _.each +module TestEach { + let array: TResult[]; + let list: _.List; + let dictionary: _.Dictionary; + + let stringIterator: (char: string, index: number, string: string) => any; + let listIterator: (value: TResult, index: number, collection: _.List) => any; + let dictionaryIterator: (value: TResult, key: string, collection: _.Dictionary) => any; + + { + let result: string; + + _.each('', stringIterator); + _.each('', stringIterator, any); + } + + { + let result: TResult[]; + + _.each(array, listIterator); + _.each(array, listIterator, any); + } + + { + let result: _.List; + + _.each(list, listIterator); + _.each(list, listIterator, any); + } + + { + let result: _.Dictionary; + + _.each(dictionary, dictionaryIterator); + _.each(dictionary, dictionaryIterator, any); + } + + { + let result: _.LoDashImplicitWrapper; + + _('').each(stringIterator); + _('').each(stringIterator, any); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + _(array).each(listIterator); + _(array).each(listIterator, any); + } + + { + let result: _.LoDashImplicitObjectWrapper<_.List>; + + _(list).each(listIterator); + _(list).each(listIterator, any); + } + + { + let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; + + _(dictionary).each(dictionaryIterator); + _(dictionary).each(dictionaryIterator, any); + } + + { + let result: _.LoDashExplicitWrapper; + + _('').chain().each(stringIterator); + _('').chain().each(stringIterator, any); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + _(array).chain().each(listIterator); + _(array).chain().each(listIterator, any); + } + + { + let result: _.LoDashExplicitObjectWrapper<_.List>; + + _(list).chain().each(listIterator); + _(list).chain().each(listIterator, any); + } + + { + let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; + + _(dictionary).chain().each(dictionaryIterator); + _(dictionary).chain().each(dictionaryIterator, any); + } +} + +// _.eachRight +module TestEachRight { + let array: TResult[]; + let list: _.List; + let dictionary: _.Dictionary; + + let stringIterator: (char: string, index: number, string: string) => any; + let listIterator: (value: TResult, index: number, collection: _.List) => any; + let dictionaryIterator: (value: TResult, key: string, collection: _.Dictionary) => any; + + { + let result: string; + + _.eachRight('', stringIterator); + _.eachRight('', stringIterator, any); + } + + { + let result: TResult[]; + + _.eachRight(array, listIterator); + _.eachRight(array, listIterator, any); + } + + { + let result: _.List; + + _.eachRight(list, listIterator); + _.eachRight(list, listIterator, any); + } + + { + let result: _.Dictionary; + + _.eachRight(dictionary, dictionaryIterator); + _.eachRight(dictionary, dictionaryIterator, any); + } + + { + let result: _.LoDashImplicitWrapper; + + _('').eachRight(stringIterator); + _('').eachRight(stringIterator, any); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + _(array).eachRight(listIterator); + _(array).eachRight(listIterator, any); + } + + { + let result: _.LoDashImplicitObjectWrapper<_.List>; + + _(list).eachRight(listIterator); + _(list).eachRight(listIterator, any); + } + + { + let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; + + _(dictionary).eachRight(dictionaryIterator); + _(dictionary).eachRight(dictionaryIterator, any); + } + + { + let result: _.LoDashExplicitWrapper; + + _('').chain().eachRight(stringIterator); + _('').chain().eachRight(stringIterator, any); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + _(array).chain().eachRight(listIterator); + _(array).chain().eachRight(listIterator, any); + } + + { + let result: _.LoDashExplicitObjectWrapper<_.List>; + + _(list).chain().eachRight(listIterator); + _(list).chain().eachRight(listIterator, any); + } + + { + let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; + + _(dictionary).chain().eachRight(dictionaryIterator); + _(dictionary).chain().eachRight(dictionaryIterator, any); + } +} + +// _.every +module TestEvery { + let array: TResult[]; + let list: _.List; + let dictionary: _.Dictionary; + + let listIterator: (value: TResult, index: number, collection: _.List) => boolean; + let dictionaryIterator: (value: TResult, key: string, collection: _.Dictionary) => boolean; + + { + let result: boolean; + + result = _.every(array); + result = _.every(array, listIterator); + result = _.every(array, listIterator, any); + result = _.every(array, ''); + result = _.every<{a: number}, TResult>(array, {a: 42}); + + result = _.every(list); + result = _.every(list, listIterator); + result = _.every(list, listIterator, any); + result = _.every(list, ''); + result = _.every<{a: number}, TResult>(list, {a: 42}); + + result = _.every(dictionary); + result = _.every(dictionary, dictionaryIterator); + result = _.every(dictionary, dictionaryIterator, any); + result = _.every(dictionary, ''); + result = _.every<{a: number}, TResult>(dictionary, {a: 42}); + + result = _(array).every(); + result = _(array).every(listIterator); + result = _(array).every(listIterator, any); + result = _(array).every(''); + result = _(array).every<{a: number}>({a: 42}); + + result = _(list).every(); + result = _(list).every(listIterator); + result = _(list).every(listIterator, any); + result = _(list).every(''); + result = _(list).every<{a: number}>({a: 42}); + + result = _(dictionary).every(); + result = _(dictionary).every(dictionaryIterator); + result = _(dictionary).every(dictionaryIterator, any); + result = _(dictionary).every(''); + result = _(dictionary).every<{a: number}>({a: 42}); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(array).chain().every(); + result = _(array).chain().every(listIterator); + result = _(array).chain().every(listIterator, any); + result = _(array).chain().every(''); + result = _(array).chain().every<{a: number}>({a: 42}); + + result = _(list).chain().every(); + result = _(list).chain().every(listIterator); + result = _(list).chain().every(listIterator, any); + result = _(list).chain().every(''); + result = _(list).chain().every<{a: number}>({a: 42}); + + result = _(dictionary).chain().every(); + result = _(dictionary).chain().every(dictionaryIterator); + result = _(dictionary).chain().every(dictionaryIterator, any); + result = _(dictionary).chain().every(''); + result = _(dictionary).chain().every<{a: number}>({a: 42}); + } +} + +// _.filter +module TestFilter { + let array: TResult[]; + let list: _.List; + let dictionary: _.Dictionary; + + let stringIterator: (char: string, index: number, string: string) => any; + let listIterator: (value: TResult, index: number, collection: _.List) => any; + let dictionaryIterator: (value: TResult, key: string, collection: _.Dictionary) => any; + + { + let result: string[]; + + result = _.filter('', stringIterator); + result = _.filter('', stringIterator, any); + } + + { + let result: TResult[]; + + result = _.filter(array, listIterator); + result = _.filter(array, listIterator, any); + result = _.filter(array, ''); + result = _.filter(array, '', any); + result = _.filter<{a: number}, TResult>(array, {a: 42}); + + result = _.filter(list, listIterator); + result = _.filter(list, listIterator, any); + result = _.filter(list, ''); + result = _.filter(list, '', any); + result = _.filter<{a: number}, TResult>(list, {a: 42}); + + result = _.filter(dictionary, dictionaryIterator); + result = _.filter(dictionary, dictionaryIterator, any); + result = _.filter(dictionary, ''); + result = _.filter(dictionary, '', any); + result = _.filter<{a: number}, TResult>(dictionary, {a: 42}); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _('').filter(stringIterator); + result = _('').filter(stringIterator, any); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(array).filter(listIterator); + result = _(array).filter(listIterator, any); + result = _(array).filter(''); + result = _(array).filter('', any); + result = _(array).filter<{a: number}>({a: 42}); + + result = _(list).filter(listIterator); + result = _(list).filter(listIterator, any); + result = _(list).filter(''); + result = _(list).filter('', any); + result = _(list).filter<{a: number}, TResult>({a: 42}); + + result = _(dictionary).filter(dictionaryIterator); + result = _(dictionary).filter(dictionaryIterator, any); + result = _(dictionary).filter(''); + result = _(dictionary).filter('', any); + result = _(dictionary).filter<{a: number}, TResult>({a: 42}); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _('').chain().filter(stringIterator); + result = _('').chain().filter(stringIterator, any); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(array).chain().filter(listIterator); + result = _(array).chain().filter(listIterator, any); + result = _(array).chain().filter(''); + result = _(array).chain().filter('', any); + result = _(array).chain().filter<{a: number}>({a: 42}); + + result = _(list).chain().filter(listIterator); + result = _(list).chain().filter(listIterator, any); + result = _(list).chain().filter(''); + result = _(list).chain().filter('', any); + result = _(list).chain().filter<{a: number}, TResult>({a: 42}); + + result = _(dictionary).chain().filter(dictionaryIterator); + result = _(dictionary).chain().filter(dictionaryIterator, any); + result = _(dictionary).chain().filter(''); + result = _(dictionary).chain().filter('', any); + result = _(dictionary).chain().filter<{a: number}, TResult>({a: 42}); + } +} + +// _.find +module TestFind { + let array: TResult[]; + let list: _.List; + let dictionary: _.Dictionary; + + let listIterator: (value: TResult, index: number, collection: _.List) => boolean; + let dictionaryIterator: (value: TResult, key: string, collection: _.Dictionary) => boolean; + + let result: TResult; + + result = _.find(array); + result = _.find(array, listIterator); + result = _.find(array, listIterator, any); + result = _.find(array, ''); + result = _.find<{a: number}, TResult>(array, {a: 42}); + + result = _.find(list); + result = _.find(list, listIterator); + result = _.find(list, listIterator, any); + result = _.find(list, ''); + result = _.find<{a: number}, TResult>(list, {a: 42}); + + result = _.find(dictionary); + result = _.find(dictionary, dictionaryIterator); + result = _.find(dictionary, dictionaryIterator, any); + result = _.find(dictionary, ''); + result = _.find<{a: number}, TResult>(dictionary, {a: 42}); + + result = _(array).find(); + result = _(array).find(listIterator); + result = _(array).find(listIterator, any); + result = _(array).find(''); + result = _(array).find<{a: number}>({a: 42}); + + result = _(list).find(); + result = _(list).find(listIterator); + result = _(list).find(listIterator, any); + result = _(list).find(''); + result = _(list).find<{a: number}, TResult>({a: 42}); + + result = _(dictionary).find(); + result = _(dictionary).find(dictionaryIterator); + result = _(dictionary).find(dictionaryIterator, any); + result = _(dictionary).find(''); + result = _(dictionary).find<{a: number}, TResult>({a: 42}); +} + +result = _.findWhere([1, 2, 3, 4], function (num) { + return num % 2 == 0; +}); +result = _.findWhere(foodsCombined, { 'type': 'vegetable' }); +result = _.findWhere(foodsCombined, 'organic'); + +result = _.findLast([1, 2, 3, 4], function (num) { + return num % 2 == 0; +}); +result = _.findLast(foodsCombined, { 'type': 'vegetable' }); +result = _.findLast(foodsCombined, 'organic'); + +result = _([1, 2, 3, 4]).findLast(function (num) { + return num % 2 == 0; +}); +result = _(foodsCombined).findLast({ 'type': 'vegetable' }); +result = _(foodsCombined).findLast('organic'); + +// _.forEach +module TestForEach { + let array: TResult[]; + let list: _.List; + let dictionary: _.Dictionary; + + let stringIterator: (char: string, index: number, string: string) => any; + let listIterator: (value: TResult, index: number, collection: _.List) => any; + let dictionaryIterator: (value: TResult, key: string, collection: _.Dictionary) => any; + + { + let result: string; + + _.forEach('', stringIterator); + _.forEach('', stringIterator, any); + } + + { + let result: TResult[]; + + _.forEach(array, listIterator); + _.forEach(array, listIterator, any); + } + + { + let result: _.List; + + _.forEach(list, listIterator); + _.forEach(list, listIterator, any); + } + + { + let result: _.Dictionary; + + _.forEach(dictionary, dictionaryIterator); + _.forEach(dictionary, dictionaryIterator, any); + } + + { + let result: _.LoDashImplicitWrapper; + + _('').forEach(stringIterator); + _('').forEach(stringIterator, any); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + _(array).forEach(listIterator); + _(array).forEach(listIterator, any); + } + + { + let result: _.LoDashImplicitObjectWrapper<_.List>; + + _(list).forEach(listIterator); + _(list).forEach(listIterator, any); + } + + { + let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; + + _(dictionary).forEach(dictionaryIterator); + _(dictionary).forEach(dictionaryIterator, any); + } + + { + let result: _.LoDashExplicitWrapper; + + _('').chain().forEach(stringIterator); + _('').chain().forEach(stringIterator, any); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + _(array).chain().forEach(listIterator); + _(array).chain().forEach(listIterator, any); + } + + { + let result: _.LoDashExplicitObjectWrapper<_.List>; + + _(list).chain().forEach(listIterator); + _(list).chain().forEach(listIterator, any); + } + + { + let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; + + _(dictionary).chain().forEach(dictionaryIterator); + _(dictionary).chain().forEach(dictionaryIterator, any); + } +} + +// _.forEachRight +module TestForEachRight { + let array: TResult[]; + let list: _.List; + let dictionary: _.Dictionary; + + let stringIterator: (char: string, index: number, string: string) => any; + let listIterator: (value: TResult, index: number, collection: _.List) => any; + let dictionaryIterator: (value: TResult, key: string, collection: _.Dictionary) => any; + + { + let result: string; + + _.forEachRight('', stringIterator); + _.forEachRight('', stringIterator, any); + } + + { + let result: TResult[]; + + _.forEachRight(array, listIterator); + _.forEachRight(array, listIterator, any); + } + + { + let result: _.List; + + _.forEachRight(list, listIterator); + _.forEachRight(list, listIterator, any); + } + + { + let result: _.Dictionary; + + _.forEachRight(dictionary, dictionaryIterator); + _.forEachRight(dictionary, dictionaryIterator, any); + } + + { + let result: _.LoDashImplicitWrapper; + + _('').forEachRight(stringIterator); + _('').forEachRight(stringIterator, any); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + _(array).forEachRight(listIterator); + _(array).forEachRight(listIterator, any); + } + + { + let result: _.LoDashImplicitObjectWrapper<_.List>; + + _(list).forEachRight(listIterator); + _(list).forEachRight(listIterator, any); + } + + { + let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; + + _(dictionary).forEachRight(dictionaryIterator); + _(dictionary).forEachRight(dictionaryIterator, any); + } + + { + let result: _.LoDashExplicitWrapper; + + _('').chain().forEachRight(stringIterator); + _('').chain().forEachRight(stringIterator, any); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + _(array).chain().forEachRight(listIterator); + _(array).chain().forEachRight(listIterator, any); + } + + { + let result: _.LoDashExplicitObjectWrapper<_.List>; + + _(list).chain().forEachRight(listIterator); + _(list).chain().forEachRight(listIterator, any); + } + + { + let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; + + _(dictionary).chain().forEachRight(dictionaryIterator); + _(dictionary).chain().forEachRight(dictionaryIterator, any); + } +} + +// _.groupBy +module TestGroupBy { + type SampleType = {a: number; b: string; c: boolean;}; + + let array: SampleType[]; + let list: _.List; + let dictionary: _.Dictionary; + + let stringIterator: (char: string, index: number, string: string) => number; + let listIterator: (value: SampleType, index: number, collection: _.List) => number; + let dictionaryIterator: (value: SampleType, key: string, collection: _.Dictionary) => number; + + { + let result: _.Dictionary; + + result = _.groupBy(''); + result = _.groupBy('', stringIterator); + result = _.groupBy('', stringIterator, any); + result = _.groupBy('', stringIterator); + result = _.groupBy('', stringIterator, any); + } + + { + let result: _.Dictionary; + + result = _.groupBy(array); + result = _.groupBy(array, listIterator); + result = _.groupBy(array, listIterator, any); + result = _.groupBy(array, ''); + result = _.groupBy(array, '', any); + result = _.groupBy(array, {a: 42}); + + result = _.groupBy(array, listIterator); + result = _.groupBy(array, listIterator, any); + result = _.groupBy(array, '', true); + result = _.groupBy<{a: number}, SampleType>(array, {a: 42}); + + result = _.groupBy(list); + result = _.groupBy(list, listIterator); + result = _.groupBy(list, listIterator, any); + result = _.groupBy(list, ''); + result = _.groupBy(list, '', any); + result = _.groupBy(list, {a: 42}); + + result = _.groupBy(list, listIterator); + result = _.groupBy(list, listIterator, any); + result = _.groupBy(list, '', true); + result = _.groupBy<{a: number}, SampleType>(list, {a: 42}); + + result = _.groupBy(dictionary); + result = _.groupBy(dictionary, dictionaryIterator); + result = _.groupBy(dictionary, dictionaryIterator, any); + result = _.groupBy(dictionary, ''); + result = _.groupBy(dictionary, '', any); + result = _.groupBy(dictionary, {a: 42}); + + result = _.groupBy(dictionary, dictionaryIterator); + result = _.groupBy(dictionary, dictionaryIterator, any); + result = _.groupBy(dictionary, '', true); + result = _.groupBy<{a: number}, SampleType>(dictionary, {a: 42}); + } + + { + let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; + + result = _('').groupBy(); + result = _('').groupBy(stringIterator); + result = _('').groupBy(stringIterator, any); + } + + { + let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; + + result = _(array).groupBy(); + result = _(array).groupBy(listIterator); + result = _(array).groupBy(listIterator, any); + result = _(array).groupBy(''); + result = _(array).groupBy('', true); + result = _(array).groupBy<{a: number}>({a: 42}); + + result = _(list).groupBy(); + result = _(list).groupBy(listIterator); + result = _(list).groupBy(listIterator, any); + result = _(list).groupBy(''); + result = _(list).groupBy('', any); + result = _(list).groupBy({a: 42}); + + result = _(list).groupBy(listIterator); + result = _(list).groupBy(listIterator, any); + result = _(list).groupBy('', true); + result = _(list).groupBy<{a: number}, SampleType>({a: 42}); + + result = _(dictionary).groupBy(); + result = _(dictionary).groupBy(dictionaryIterator); + result = _(dictionary).groupBy(dictionaryIterator, any); + result = _(dictionary).groupBy(''); + result = _(dictionary).groupBy('', any); + result = _(dictionary).groupBy({a: 42}); + + result = _(dictionary).groupBy(dictionaryIterator); + result = _(dictionary).groupBy(dictionaryIterator, any); + result = _(dictionary).groupBy('', true); + result = _(dictionary).groupBy<{a: number}, SampleType>({a: 42}); + } + + { + let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; + + result = _('').chain().groupBy(); + result = _('').chain().groupBy(stringIterator); + result = _('').chain().groupBy(stringIterator, any); + } + + { + let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; + + result = _(array).chain().groupBy(); + result = _(array).chain().groupBy(listIterator); + result = _(array).chain().groupBy(listIterator, any); + result = _(array).chain().groupBy(''); + result = _(array).chain().groupBy('', true); + result = _(array).chain().groupBy<{a: number}>({a: 42}); + + result = _(list).chain().groupBy(); + result = _(list).chain().groupBy(listIterator); + result = _(list).chain().groupBy(listIterator, any); + result = _(list).chain().groupBy(''); + result = _(list).chain().groupBy('', any); + result = _(list).chain().groupBy({a: 42}); + + result = _(list).chain().groupBy(listIterator); + result = _(list).chain().groupBy(listIterator, any); + result = _(list).chain().groupBy('', true); + result = _(list).chain().groupBy<{a: number}, SampleType>({a: 42}); + + result = _(dictionary).chain().groupBy(); + result = _(dictionary).chain().groupBy(dictionaryIterator); + result = _(dictionary).chain().groupBy(dictionaryIterator, any); + result = _(dictionary).chain().groupBy(''); + result = _(dictionary).chain().groupBy('', any); + result = _(dictionary).chain().groupBy({a: 42}); + + result = _(dictionary).chain().groupBy(dictionaryIterator); + result = _(dictionary).chain().groupBy(dictionaryIterator, any); + result = _(dictionary).chain().groupBy('', true); + result = _(dictionary).chain().groupBy<{a: number}, SampleType>({a: 42}); + } +} + +// _.include +module TestInclude { + type SampleType = {a: string; b: number; c: boolean;}; + + let array: SampleType[]; + let list: _.List; + let dictionary: _.Dictionary; + + let target: SampleType; + + { + let result: boolean; + + result = _.include(array, target); + result = _.include(array, target, 42); + + result = _.include(list, target); + result = _.include(list, target, 42); + + result = _.include(dictionary, target); + result = _.include(dictionary, target, 42); + + result = _(array).include(target); + result = _(array).include(target, 42); + + result = _(list).include(target); + result = _(list).include(target, 42); + + result = _(dictionary).include(target); + result = _(dictionary).include(target, 42); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(array).chain().include(target); + result = _(array).chain().include(target, 42); + + result = _(list).chain().include(target); + result = _(list).chain().include(target, 42); + + result = _(dictionary).chain().include(target); + result = _(dictionary).chain().include(target, 42); + } +} + +// _.includes +module TestIncludes { + type SampleType = {a: string; b: number; c: boolean;}; + + let array: SampleType[]; + let list: _.List; + let dictionary: _.Dictionary; + + let target: SampleType; + + { + let result: boolean; + + result = _.includes(array, target); + result = _.includes(array, target, 42); + + result = _.includes(list, target); + result = _.includes(list, target, 42); + + result = _.includes(dictionary, target); + result = _.includes(dictionary, target, 42); + + result = _(array).includes(target); + result = _(array).includes(target, 42); + + result = _(list).includes(target); + result = _(list).includes(target, 42); + + result = _(dictionary).includes(target); + result = _(dictionary).includes(target, 42); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(array).chain().includes(target); + result = _(array).chain().includes(target, 42); + + result = _(list).chain().includes(target); + result = _(list).chain().includes(target, 42); + + result = _(dictionary).chain().includes(target); + result = _(dictionary).chain().includes(target, 42); + } +} + +// _.indexBy +module TestIndexBy { + type SampleObject = {a: number; b: string; c: boolean;}; + + let array: SampleObject[]; + let list: _.List; + let dictionary: _.Dictionary; + let numericDictionary: _.NumericDictionary; + + let stringIterator: (value: string, index: number, collection: string) => any; + let listIterator: (value: SampleObject, index: number, collection: _.List) => any; + let dictionaryIterator: (value: SampleObject, key: string, collection: _.Dictionary) => any; + let numericDictionaryIterator: (value: SampleObject, key: number, collection: _.NumericDictionary) => any; + + { + let result: _.Dictionary; + + result = _.indexBy('abcd'); + result = _.indexBy('abcd', stringIterator); + result = _.indexBy('abcd', stringIterator, any); + } + + { + let result: _.Dictionary; + + result = _.indexBy(array); + result = _.indexBy(array, listIterator); + result = _.indexBy(array, listIterator, any); + result = _.indexBy(array, 'a'); + result = _.indexBy(array, 'a', any); + result = _.indexBy<{a: number}, SampleObject>(array, {a: 42}); + result = _.indexBy(array, {a: 42}); + + result = _.indexBy(list); + result = _.indexBy(list, listIterator); + result = _.indexBy(list, listIterator, any); + result = _.indexBy(list, 'a'); + result = _.indexBy(list, 'a', any); + result = _.indexBy<{a: number}, SampleObject>(list, {a: 42}); + result = _.indexBy(list, {a: 42}); + + result = _.indexBy(numericDictionary); + result = _.indexBy(numericDictionary, numericDictionaryIterator); + result = _.indexBy(numericDictionary, numericDictionaryIterator, any); + result = _.indexBy(numericDictionary, 'a'); + result = _.indexBy(numericDictionary, 'a', any); + result = _.indexBy<{a: number}, SampleObject>(numericDictionary, {a: 42}); + result = _.indexBy(numericDictionary, {a: 42}); + + result = _.indexBy(dictionary); + result = _.indexBy(dictionary, dictionaryIterator); + result = _.indexBy(dictionary, dictionaryIterator, any); + result = _.indexBy(dictionary, 'a'); + result = _.indexBy(dictionary, 'a', any); + result = _.indexBy<{a: number}, SampleObject>(dictionary, {a: 42}); + result = _.indexBy(dictionary, {a: 42}); + } + + { + let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; + + result = _('abcd').indexBy(); + result = _('abcd').indexBy(stringIterator); + result = _('abcd').indexBy(stringIterator, any); + } + + { + let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; + + result = _(array).indexBy(); + result = _(array).indexBy(listIterator); + result = _(array).indexBy(listIterator, any); + result = _(array).indexBy('a'); + result = _(array).indexBy('a', any); + result = _(array).indexBy<{a: number}>({a: 42}); + + result = _(list).indexBy(); + result = _(list).indexBy(listIterator); + result = _(list).indexBy(listIterator, any); + result = _(list).indexBy('a'); + result = _(list).indexBy('a', any); + result = _(list).indexBy<{a: number}, SampleObject>({a: 42}); + result = _(list).indexBy({a: 42}); + + result = _(numericDictionary).indexBy(); + result = _(numericDictionary).indexBy(numericDictionaryIterator); + result = _(numericDictionary).indexBy(numericDictionaryIterator, any); + result = _(numericDictionary).indexBy('a'); + result = _(numericDictionary).indexBy('a', any); + result = _(numericDictionary).indexBy<{a: number}, SampleObject>({a: 42}); + result = _(numericDictionary).indexBy({a: 42}); + + result = _(dictionary).indexBy(); + result = _(dictionary).indexBy(dictionaryIterator); + result = _(dictionary).indexBy(dictionaryIterator, any); + result = _(dictionary).indexBy('a'); + result = _(dictionary).indexBy('a', any); + result = _(dictionary).indexBy<{a: number}, SampleObject>({a: 42}); + result = _(dictionary).indexBy({a: 42}); + } + + { + let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; + + result = _('abcd').chain().indexBy(); + result = _('abcd').chain().indexBy(stringIterator); + result = _('abcd').chain().indexBy(stringIterator, any); + } + + { + let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; + + result = _(array).chain().indexBy(); + result = _(array).chain().indexBy(listIterator); + result = _(array).chain().indexBy(listIterator, any); + result = _(array).chain().indexBy('a'); + result = _(array).chain().indexBy('a', any); + result = _(array).chain().indexBy<{a: number}>({a: 42}); + + result = _(list).chain().indexBy(); + result = _(list).chain().indexBy(listIterator); + result = _(list).chain().indexBy(listIterator, any); + result = _(list).chain().indexBy('a'); + result = _(list).chain().indexBy('a', any); + result = _(list).chain().indexBy<{a: number}, SampleObject>({a: 42}); + result = _(list).chain().indexBy({a: 42}); + + result = _(numericDictionary).chain().indexBy(); + result = _(numericDictionary).chain().indexBy(numericDictionaryIterator); + result = _(numericDictionary).chain().indexBy(numericDictionaryIterator, any); + result = _(numericDictionary).chain().indexBy('a'); + result = _(numericDictionary).chain().indexBy('a', any); + result = _(numericDictionary).chain().indexBy<{a: number}, SampleObject>({a: 42}); + result = _(numericDictionary).chain().indexBy({a: 42}); + + result = _(dictionary).chain().indexBy(); + result = _(dictionary).chain().indexBy(dictionaryIterator); + result = _(dictionary).chain().indexBy(dictionaryIterator, any); + result = _(dictionary).chain().indexBy('a'); + result = _(dictionary).chain().indexBy('a', any); + result = _(dictionary).chain().indexBy<{a: number}, SampleObject>({a: 42}); + result = _(dictionary).chain().indexBy({a: 42}); + } +} + +result = _.invoke([[5, 1, 7], [3, 2, 1]], 'sort'); +result = _.invoke([123, 456], String.prototype.split, ''); + +// _.map +module TestMap { + let array: number[]; + let list: _.List; + let dictionary: _.Dictionary; + + let listIterator: (value: number, index: number, collection: _.List) => TResult; + let dictionaryIterator: (value: number, key: string, collection: _.Dictionary) => TResult; + + { + let result: TResult[]; + + result = _.map(array); + result = _.map(array, listIterator); + result = _.map(array, listIterator, any); + result = _.map(array, ''); + + result = _.map(list); + result = _.map(list, listIterator); + result = _.map(list, listIterator, any); + result = _.map(list, ''); + + result = _.map(dictionary); + result = _.map(dictionary, dictionaryIterator); + result = _.map(dictionary, dictionaryIterator, any); + result = _.map(dictionary, ''); + } + + { + let result: boolean[]; + + result = _.map(array, {}); + result = _.map(list, {}); + result = _.map(dictionary, {}); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(array).map(); + result = _(array).map(listIterator); + result = _(array).map(listIterator, any); + result = _(array).map(''); + + result = _(list).map(); + result = _(list).map(listIterator); + result = _(list).map(listIterator, any); + result = _(list).map(''); + + result = _(dictionary).map(); + result = _(dictionary).map(dictionaryIterator); + result = _(dictionary).map(dictionaryIterator, any); + result = _(dictionary).map(''); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(array).map<{}>({}); + result = _(list).map<{}>({}); + result = _(dictionary).map<{}>({}); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(array).chain().map(); + result = _(array).chain().map(listIterator); + result = _(array).chain().map(listIterator, any); + result = _(array).chain().map(''); + + result = _(list).chain().map(); + result = _(list).chain().map(listIterator); + result = _(list).chain().map(listIterator, any); + result = _(list).chain().map(''); + + result = _(dictionary).chain().map(); + result = _(dictionary).chain().map(dictionaryIterator); + result = _(dictionary).chain().map(dictionaryIterator, any); + result = _(dictionary).chain().map(''); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(array).chain().map<{}>({}); + result = _(list).chain().map<{}>({}); + result = _(dictionary).chain().map<{}>({}); + } +} + +// _.partition +result = _.partition('abcd', (n) => n < 'c'); +result = _.partition(['a', 'b', 'c', 'd'], (n) => n < 'c'); +result = _.partition([1, 2, 3, 4], (n) => n < 3); +result = _.partition({0: 1, 1: 2, 2: 3, 3: 4, length: 4}, (n) => n < 3); +result = _.partition({a: 1, b: 2, c: 3, d: 4}, (n) => n < 3); +result = <{a: number}[][]>_.partition<{a: number}, {a: number}>([{a: 1}, {a: 2}], {a: 2}); +result = <{a: number}[][]>_.partition<{a: number}, {a: number}>({0: {a: 1}, 1: {a: 2}, length: 2}, {a: 2}); +result = <{a: number}[][]>_.partition<{a: number}, {a: number}>({0: {a: 1}, 1: {a: 2}}, {a: 2}); +result = <{a: number}[][]>_.partition<{a: number}>([{a: 1}, {a: 2}], 'a'); +result = <{a: number}[][]>_.partition<{a: number}>([{a: 1}, {a: 2}], 'a', 2); +result = <{a: number}[][]>_.partition<{a: number}>({0: {a: 1}, 1: {a: 2}, length: 2}, 'a'); +result = <{a: number}[][]>_.partition<{a: number}>({0: {a: 1}, 1: {a: 2}, length: 2}, 'a', 2); +result = <{a: number}[][]>_.partition<{a: number}>({0: {a: 1}, 1: {a: 2}}, 'a'); +result = <{a: number}[][]>_.partition<{a: number}>({0: {a: 1}, 1: {a: 2}}, 'a', 2); +result = _('abcd').partition((n) => n < 'c').value(); +result = _(['a', 'b', 'c', 'd']).partition((n) => n < 'c').value(); +result = _([1, 2, 3, 4]).partition((n) => n < 3).value(); +result = _({0: 1, 1: 2, 2: 3, 3: 4, length: 4}).partition((n) => n < 3).value(); +result = _({a: 1, b: 2, c: 3, d: 4}).partition((n) => n < 3).value(); +result = <{a: number}[][]>_([{a: 1}, {a: 2}]).partition<{a: number}>({a: 2}).value(); +result = <{a: number}[][]>_({0: {a: 1}, 1: {a: 2}, length: 2}).partition<{a: number}, {a: number}>({a: 2}).value(); +result = <{a: number}[][]>_({0: {a: 1}, 1: {a: 2}}).partition<{a: number}, {a: number}>({a: 2}).value(); +result = <{a: number}[][]>_([{a: 1}, {a: 2}]).partition('a').value(); +result = <{a: number}[][]>_([{a: 1}, {a: 2}]).partition('a', 2).value(); +result = <{a: number}[][]>_({0: {a: 1}, 1: {a: 2}}).partition<{a: number}>('a').value(); +result = <{a: number}[][]>_({0: {a: 1}, 1: {a: 2}}).partition<{a: number}>('a', 2).value(); + +// _.pluck +module TestPluck { + interface SampleObject { + d: {b: TResult}[]; + } + + let array: SampleObject[]; + let list: _.List; + let dictionary: _.Dictionary; + + { + let result: any[]; + + result = _.pluck(array, 'd.0.b'); + result = _.pluck(array, ['d', 0, 'b']); + + result = _.pluck(list, 'd.0.b'); + result = _.pluck(list, ['d', 0, 'b']); + + result = _.pluck(dictionary, 'd.0.b'); + result = _.pluck(dictionary, ['d', 0, 'b']); + } + + { + let result: TResult[]; + + result = _.pluck(array, 'd.0.b'); + result = _.pluck(array, ['d', 0, 'b']); + + result = _.pluck(list, 'd.0.b'); + result = _.pluck(list, ['d', 0, 'b']); + + result = _.pluck(dictionary, 'd.0.b'); + result = _.pluck(dictionary, ['d', 0, 'b']); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(array).pluck('d.0.b'); + result = _(array).pluck(['d', 0, 'b']); + + result = _(list).pluck('d.0.b'); + result = _(list).pluck(['d', 0, 'b']); + + result = _(dictionary).pluck('d.0.b'); + result = _(dictionary).pluck(['d', 0, 'b']); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(array).chain().pluck('d.0.b'); + result = _(array).chain().pluck(['d', 0, 'b']); + + result = _(list).chain().pluck('d.0.b'); + result = _(list).chain().pluck(['d', 0, 'b']); + + result = _(dictionary).chain().pluck('d.0.b'); + result = _(dictionary).chain().pluck(['d', 0, 'b']); + } +} + +interface ABC { + [index: string]: number; + a: number; + b: number; + c: number; +} + +result = _.reduce([1, 2, 3], function (sum: number, num: number) { + return sum + num; +}); +result = _.reduce({ 'a': 1, 'b': 2, 'c': 3 }, function (r: ABC, num: number, key: string) { + r[key] = num * 3; + return r; +}, {}); + +result = _.foldl([1, 2, 3], function (sum: number, num: number) { + return sum + num; +}); +result = _.foldl({ 'a': 1, 'b': 2, 'c': 3 }, function (r: ABC, num: number, key: string) { + r[key] = num * 3; + return r; +}, {}); + +result = _.inject([1, 2, 3], function (sum: number, num: number) { + return sum + num; +}); +result = _.inject({ 'a': 1, 'b': 2, 'c': 3 }, function (r: ABC, num: number, key: string) { + r[key] = num * 3; + return r; +}, {}); + +result = _([1, 2, 3]).reduce(function (sum: number, num: number) { + return sum + num; +}); +result = _({ 'a': 1, 'b': 2, 'c': 3 }).reduce(function (r: ABC, num: number, key: string) { + r[key] = num * 3; + return r; +}, {}); + +result = _([1, 2, 3]).foldl(function (sum: number, num: number) { + return sum + num; +}); +result = _({ 'a': 1, 'b': 2, 'c': 3 }).foldl(function (r: ABC, num: number, key: string) { + r[key] = num * 3; + return r; +}, {}); + +result = _([1, 2, 3]).inject(function (sum: number, num: number) { + return sum + num; +}); +result = _({ 'a': 1, 'b': 2, 'c': 3 }).inject(function (r: ABC, num: number, key: string) { + r[key] = num * 3; + return r; +}, {}); + +result = _.reduceRight([[0, 1], [2, 3], [4, 5]], function (a: number[], b: number[]) { return a.concat(b); }, []); +result = _.foldr([[0, 1], [2, 3], [4, 5]], function (a: number[], b: number[]) { return a.concat(b); }, []); + +// _.reject +module TestReject { + let array: TResult[]; + let list: _.List; + let dictionary: _.Dictionary; + + let stringIterator: (char: string, index: number, string: string) => any; + let listIterator: (value: TResult, index: number, collection: _.List) => any; + let dictionaryIterator: (value: TResult, key: string, collection: _.Dictionary) => any; + + { + let result: string[]; + + result = _.reject('', stringIterator); + result = _.reject('', stringIterator, any); + } + + { + let result: TResult[]; + + result = _.reject(array, listIterator); + result = _.reject(array, listIterator, any); + result = _.reject(array, ''); + result = _.reject(array, '', any); + result = _.reject<{a: number}, TResult>(array, {a: 42}); + + result = _.reject(list, listIterator); + result = _.reject(list, listIterator, any); + result = _.reject(list, ''); + result = _.reject(list, '', any); + result = _.reject<{a: number}, TResult>(list, {a: 42}); + + result = _.reject(dictionary, dictionaryIterator); + result = _.reject(dictionary, dictionaryIterator, any); + result = _.reject(dictionary, ''); + result = _.reject(dictionary, '', any); + result = _.reject<{a: number}, TResult>(dictionary, {a: 42}); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _('').reject(stringIterator); + result = _('').reject(stringIterator, any); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(array).reject(listIterator); + result = _(array).reject(listIterator, any); + result = _(array).reject(''); + result = _(array).reject('', any); + result = _(array).reject<{a: number}>({a: 42}); + + result = _(list).reject(listIterator); + result = _(list).reject(listIterator, any); + result = _(list).reject(''); + result = _(list).reject('', any); + result = _(list).reject<{a: number}, TResult>({a: 42}); + + result = _(dictionary).reject(dictionaryIterator); + result = _(dictionary).reject(dictionaryIterator, any); + result = _(dictionary).reject(''); + result = _(dictionary).reject('', any); + result = _(dictionary).reject<{a: number}, TResult>({a: 42}); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _('').chain().reject(stringIterator); + result = _('').chain().reject(stringIterator, any); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(array).chain().reject(listIterator); + result = _(array).chain().reject(listIterator, any); + result = _(array).chain().reject(''); + result = _(array).chain().reject('', any); + result = _(array).chain().reject<{a: number}>({a: 42}); + + result = _(list).chain().reject(listIterator); + result = _(list).chain().reject(listIterator, any); + result = _(list).chain().reject(''); + result = _(list).chain().reject('', any); + result = _(list).chain().reject<{a: number}, TResult>({a: 42}); + + result = _(dictionary).chain().reject(dictionaryIterator); + result = _(dictionary).chain().reject(dictionaryIterator, any); + result = _(dictionary).chain().reject(''); + result = _(dictionary).chain().reject('', any); + result = _(dictionary).chain().reject<{a: number}, TResult>({a: 42}); + } +} + +result = _.sample([1, 2, 3, 4]); +result = _.sample([1, 2, 3, 4], 2); +result = <_.LoDashImplicitWrapper>_([1, 2, 3, 4]).sample(); +result = <_.LoDashImplicitArrayWrapper>_([1, 2, 3, 4]).sample(2); +result = _([1, 2, 3, 4]).sample().value(); +result = _([1, 2, 3, 4]).sample(2).value(); + +// _.select +module TestSelect { + let array: TResult[]; + let list: _.List; + let dictionary: _.Dictionary; + + let stringIterator: (char: string, index: number, string: string) => any; + let listIterator: (value: TResult, index: number, collection: _.List) => any; + let dictionaryIterator: (value: TResult, key: string, collection: _.Dictionary) => any; + + { + let result: string[]; + + result = _.select('', stringIterator); + result = _.select('', stringIterator, any); + } + + { + let result: TResult[]; + + result = _.select(array, listIterator); + result = _.select(array, listIterator, any); + result = _.select(array, ''); + result = _.select(array, '', any); + result = _.select<{a: number}, TResult>(array, {a: 42}); + + result = _.select(list, listIterator); + result = _.select(list, listIterator, any); + result = _.select(list, ''); + result = _.select(list, '', any); + result = _.select<{a: number}, TResult>(list, {a: 42}); + + result = _.select(dictionary, dictionaryIterator); + result = _.select(dictionary, dictionaryIterator, any); + result = _.select(dictionary, ''); + result = _.select(dictionary, '', any); + result = _.select<{a: number}, TResult>(dictionary, {a: 42}); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _('').select(stringIterator); + result = _('').select(stringIterator, any); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(array).select(listIterator); + result = _(array).select(listIterator, any); + result = _(array).select(''); + result = _(array).select('', any); + result = _(array).select<{a: number}>({a: 42}); + + result = _(list).select(listIterator); + result = _(list).select(listIterator, any); + result = _(list).select(''); + result = _(list).select('', any); + result = _(list).select<{a: number}, TResult>({a: 42}); + + result = _(dictionary).select(dictionaryIterator); + result = _(dictionary).select(dictionaryIterator, any); + result = _(dictionary).select(''); + result = _(dictionary).select('', any); + result = _(dictionary).select<{a: number}, TResult>({a: 42}); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _('').chain().select(stringIterator); + result = _('').chain().select(stringIterator, any); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(array).chain().select(listIterator); + result = _(array).chain().select(listIterator, any); + result = _(array).chain().select(''); + result = _(array).chain().select('', any); + result = _(array).chain().select<{a: number}>({a: 42}); + + result = _(list).chain().select(listIterator); + result = _(list).chain().select(listIterator, any); + result = _(list).chain().select(''); + result = _(list).chain().select('', any); + result = _(list).chain().select<{a: number}, TResult>({a: 42}); + + result = _(dictionary).chain().select(dictionaryIterator); + result = _(dictionary).chain().select(dictionaryIterator, any); + result = _(dictionary).chain().select(''); + result = _(dictionary).chain().select('', any); + result = _(dictionary).chain().select<{a: number}, TResult>({a: 42}); + } +} + +// _.shuffle +module TestShuffle { + let array: TResult[]; + let list: _.List; + let dictionary: _.Dictionary; + + { + let result: string[]; + + result = _.shuffle('abc'); + } + + { + let result: TResult[]; + + result = _.shuffle(array); + result = _.shuffle(list); + result = _.shuffle(dictionary); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _('abc').shuffle(); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(array).shuffle(); + result = _(list).shuffle(); + result = _(dictionary).shuffle(); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _('abc').chain().shuffle(); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(array).chain().shuffle(); + result = _(list).chain().shuffle(); + result = _(dictionary).chain().shuffle(); + } +} + +// _.size +module TestSize { + type SampleType = {a: string; b: number; c: boolean;}; + + let array: SampleType[]; + let list: _.List; + let dictionary: _.Dictionary; + + { + let result: number; + + result = _.size(array); + result = _.size(list); + result = _.size(dictionary); + result = _.size(''); + + result = _(array).size(); + result = _(list).size(); + result = _(dictionary).size(); + result = _('').size(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(array).chain().size(); + result = _(list).chain().size(); + result = _(dictionary).chain().size(); + result = _('').chain().size(); + } +} + +// _.some +module TestSome { + let array: TResult[]; + let list: _.List; + let dictionary: _.Dictionary; + let numericDictionary: _.NumericDictionary; + + let listIterator: (value: TResult, index: number, collection: _.List) => boolean; + let dictionaryIterator: (value: TResult, key: string, collection: _.Dictionary) => boolean; + let numericDictionaryIterator: (value: TResult, key: number, collection: _.NumericDictionary) => boolean; + + { + let result: boolean; + + result = _.some(array); + result = _.some(array, listIterator); + result = _.some(array, listIterator, any); + result = _.some(array, ''); + result = _.some<{a: number}, TResult>(array, {a: 42}); + + result = _.some(list); + result = _.some(list, listIterator); + result = _.some(list, listIterator, any); + result = _.some(list, ''); + result = _.some<{a: number}, TResult>(list, {a: 42}); + + result = _.some(dictionary); + result = _.some(dictionary, dictionaryIterator); + result = _.some(dictionary, dictionaryIterator, any); + result = _.some(dictionary, ''); + result = _.some<{a: number}, TResult>(dictionary, {a: 42}); + + result = _.some(numericDictionary); + result = _.some(numericDictionary, numericDictionaryIterator); + result = _.some(numericDictionary, numericDictionaryIterator, any); + result = _.some(numericDictionary, ''); + result = _.some<{a: number}, TResult>(numericDictionary, {a: 42}); + + result = _(array).some(); + result = _(array).some(listIterator); + result = _(array).some(listIterator, any); + result = _(array).some(''); + result = _(array).some<{a: number}>({a: 42}); + + result = _(list).some(); + result = _(list).some(listIterator); + result = _(list).some(listIterator, any); + result = _(list).some(''); + result = _(list).some<{a: number}>({a: 42}); + + result = _(dictionary).some(); + result = _(dictionary).some(dictionaryIterator); + result = _(dictionary).some(dictionaryIterator, any); + result = _(dictionary).some(''); + result = _(dictionary).some<{a: number}>({a: 42}); + + result = _(numericDictionary).some(); + result = _(numericDictionary).some(numericDictionaryIterator); + result = _(numericDictionary).some(numericDictionaryIterator, any); + result = _(numericDictionary).some(''); + result = _(numericDictionary).some<{a: number}>({a: 42}); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(array).chain().some(); + result = _(array).chain().some(listIterator); + result = _(array).chain().some(listIterator, any); + result = _(array).chain().some(''); + result = _(array).chain().some<{a: number}>({a: 42}); + + result = _(list).chain().some(); + result = _(list).chain().some(listIterator); + result = _(list).chain().some(listIterator, any); + result = _(list).chain().some(''); + result = _(list).chain().some<{a: number}>({a: 42}); + + result = _(dictionary).chain().some(); + result = _(dictionary).chain().some(dictionaryIterator); + result = _(dictionary).chain().some(dictionaryIterator, any); + result = _(dictionary).chain().some(''); + result = _(dictionary).chain().some<{a: number}>({a: 42}); + + result = _(numericDictionary).chain().some(); + result = _(numericDictionary).chain().some(numericDictionaryIterator); + result = _(numericDictionary).chain().some(numericDictionaryIterator, any); + result = _(numericDictionary).chain().some(''); + result = _(numericDictionary).chain().some<{a: number}>({a: 42}); + } +} + +// _.sortBy +module TestSortBy { + let array: TResult[]; + let list: _.List; + let dictionary: _.Dictionary; + + let listIterator: (value: TResult, index: number, collection: _.List) => number; + let dictionaryIterator: (value: TResult, key: string, collection: _.Dictionary) => number; + + { + let result: TResult[]; + + result = _.sortBy(array); + result = _.sortBy(array, listIterator); + result = _.sortBy(array, listIterator, any); + result = _.sortBy(array, ''); + result = _.sortBy<{a: number}, TResult>(array, {a: 42}); + + result = _.sortBy(list); + result = _.sortBy(list, listIterator); + result = _.sortBy(list, listIterator, any); + result = _.sortBy(list, ''); + result = _.sortBy<{a: number}, TResult>(list, {a: 42}); + + result = _.sortBy(dictionary); + result = _.sortBy(dictionary, dictionaryIterator); + result = _.sortBy(dictionary, dictionaryIterator, any); + result = _.sortBy(dictionary, ''); + result = _.sortBy<{a: number}, TResult>(dictionary, {a: 42}); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(array).sortBy(); + result = _(array).sortBy(listIterator); + result = _(array).sortBy(listIterator, any); + result = _(array).sortBy(''); + result = _(array).sortBy<{a: number}>({a: 42}); + + result = _(list).sortBy(); + result = _(list).sortBy(listIterator); + result = _(list).sortBy(listIterator, any); + result = _(list).sortBy(''); + result = _(list).sortBy<{a: number}, TResult>({a: 42}); + + result = _(dictionary).sortBy(); + result = _(dictionary).sortBy(dictionaryIterator); + result = _(dictionary).sortBy(dictionaryIterator, any); + result = _(dictionary).sortBy(''); + result = _(dictionary).sortBy<{a: number}, TResult>({a: 42}); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(array).chain().sortBy(); + result = _(array).chain().sortBy(listIterator); + result = _(array).chain().sortBy(listIterator, any); + result = _(array).chain().sortBy(''); + result = _(array).chain().sortBy<{a: number}>({a: 42}); + + result = _(list).chain().sortBy(); + result = _(list).chain().sortBy(listIterator); + result = _(list).chain().sortBy(listIterator, any); + result = _(list).chain().sortBy(''); + result = _(list).chain().sortBy<{a: number}, TResult>({a: 42}); + + result = _(dictionary).chain().sortBy(); + result = _(dictionary).chain().sortBy(dictionaryIterator); + result = _(dictionary).chain().sortBy(dictionaryIterator, any); + result = _(dictionary).chain().sortBy(''); + result = _(dictionary).chain().sortBy<{a: number}, TResult>({a: 42}); + } +} + +result = _.sortByAll(stoogesAges, function(stooge) { return Math.sin(stooge.age); }, function(stooge) { return stooge.name.slice(1); }); +result = _.sortByAll(stoogesAges, ['name', 'age']); +result = _.sortByAll(stoogesAges, 'name', function(stooge) { return Math.sin(stooge.age); }); + +result = _(foodsOrganic).sortByAll('organic', (food) => food.name, { organic: true }).value(); + +// _.sortByOrder +module TestSortByOrder { + type SampleObject = {a: number; b: string; c: boolean}; + + let array: SampleObject[]; + let list: _.List; + let numericDictionary: _.NumericDictionary; + let dictionary: _.Dictionary; + let orders: boolean|string|(boolean|string)[]; + + { + let iteratees: (value: string) => any|((value: string) => any)[]; + let result: string[]; + + result = _.sortByOrder('acbd', iteratees); + result = _.sortByOrder('acbd', iteratees, orders); + } + + { + let iteratees: (value: SampleObject) => any|string|{a: number}|((value: SampleObject) => any|string|{a: number})[]; + let result: SampleObject[]; + + result = _.sortByOrder<{a: number}, SampleObject>(array, iteratees); + result = _.sortByOrder<{a: number}, SampleObject>(array, iteratees, orders); + result = _.sortByOrder(array, iteratees); + result = _.sortByOrder(array, iteratees, orders); + + result = _.sortByOrder<{a: number}, SampleObject>(list, iteratees); + result = _.sortByOrder<{a: number}, SampleObject>(list, iteratees, orders); + result = _.sortByOrder(list, iteratees); + result = _.sortByOrder(list, iteratees, orders); + + result = _.sortByOrder<{a: number}, SampleObject>(numericDictionary, iteratees); + result = _.sortByOrder<{a: number}, SampleObject>(numericDictionary, iteratees, orders); + result = _.sortByOrder(numericDictionary, iteratees); + result = _.sortByOrder(numericDictionary, iteratees, orders); + + result = _.sortByOrder<{a: number}, SampleObject>(dictionary, iteratees); + result = _.sortByOrder<{a: number}, SampleObject>(dictionary, iteratees, orders); + result = _.sortByOrder(dictionary, iteratees); + result = _.sortByOrder(dictionary, iteratees, orders); + } + + { + let iteratees: (value: SampleObject) => any|string|{a: number}|((value: SampleObject) => any|string|{a: number})[]; + let result: _.LoDashImplicitArrayWrapper; + + result = _(array).sortByOrder<{a: number}>(iteratees); + result = _(array).sortByOrder<{a: number}>(iteratees, orders); + + result = _(list).sortByOrder<{a: number}, SampleObject>(iteratees); + result = _(list).sortByOrder<{a: number}, SampleObject>(iteratees, orders); + result = _(list).sortByOrder(iteratees); + result = _(list).sortByOrder(iteratees, orders); + + result = _(numericDictionary).sortByOrder<{a: number}, SampleObject>(iteratees); + result = _(numericDictionary).sortByOrder<{a: number}, SampleObject>(iteratees, orders); + result = _(numericDictionary).sortByOrder(iteratees); + result = _(numericDictionary).sortByOrder(iteratees, orders); + + result = _(dictionary).sortByOrder<{a: number}, SampleObject>(iteratees); + result = _(dictionary).sortByOrder<{a: number}, SampleObject>(iteratees, orders); + result = _(dictionary).sortByOrder(iteratees); + result = _(dictionary).sortByOrder(iteratees, orders); + } + + { + let iteratees: (value: SampleObject) => any|string|{a: number}|((value: SampleObject) => any|string|{a: number})[]; + let result: _.LoDashExplicitArrayWrapper; + + result = _(array).chain().sortByOrder<{a: number}>(iteratees); + result = _(array).chain().sortByOrder<{a: number}>(iteratees, orders); + + result = _(list).chain().sortByOrder<{a: number}, SampleObject>(iteratees); + result = _(list).chain().sortByOrder<{a: number}, SampleObject>(iteratees, orders); + result = _(list).chain().sortByOrder(iteratees); + result = _(list).chain().sortByOrder(iteratees, orders); + + result = _(numericDictionary).chain().sortByOrder<{a: number}, SampleObject>(iteratees); + result = _(numericDictionary).chain().sortByOrder<{a: number}, SampleObject>(iteratees, orders); + result = _(numericDictionary).chain().sortByOrder(iteratees); + result = _(numericDictionary).chain().sortByOrder(iteratees, orders); + + result = _(dictionary).chain().sortByOrder<{a: number}, SampleObject>(iteratees); + result = _(dictionary).chain().sortByOrder<{a: number}, SampleObject>(iteratees, orders); + result = _(dictionary).chain().sortByOrder(iteratees); + result = _(dictionary).chain().sortByOrder(iteratees, orders); + } +} + +result = _.where(stoogesCombined, { 'age': 40 }); +result = _.where(stoogesCombined, { 'quotes': ['Poifect!'] }); + +result = _(stoogesCombined).where({ 'age': 40 }).value(); +result = _(stoogesCombined).where({ 'quotes': ['Poifect!'] }).value(); + +/******** + * Date * + ********/ + +module TestNow { + { + let result: number; + + result = _.now(); + result = _(42).now(); + result = _([]).now(); + result = _({}).now(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(42).chain().now(); + result = _([]).chain().now(); + result = _({}).chain().now(); + } +} + +/************* + * Functions * + *************/ + +// _after +module TestAfter { + interface Func { + (a: string, b: number): boolean; + } + + let func: Func; + + { + let result: Func; + + _.after(42, func); + } + + { + let result: _.LoDashImplicitObjectWrapper; + + _(42).after(func); + } + + { + let result: _.LoDashExplicitObjectWrapper; + + _(42).chain().after(func); + } +} + +// _.ary +module TestAry { + type SampleFunc = (a: number, b: string) => boolean; + + let func: SampleFunc; + + { + let result: SampleFunc; + + result = _.ary(func); + result = _.ary(func, 2); + result = _.ary(func); + result = _.ary(func, 2); + } + + { + let result: _.LoDashImplicitObjectWrapper; + + result = _(func).ary(); + result = _(func).ary(2); + } + + { + let result: _.LoDashExplicitObjectWrapper; + + result = _(func).chain().ary(); + result = _(func).chain().ary(2); + } +} + +// _.backflow +module TestBackflow { + let Fn1: (n: number) => number; + let Fn2: (m: number, n: number) => number; + + { + let result: (m: number, n: number) => number; + + result = _.backflow<(m: number, n: number) => number>(Fn1, Fn2); + result = _.backflow<(m: number, n: number) => number>(Fn1, Fn1, Fn2); + result = _.backflow<(m: number, n: number) => number>(Fn1, Fn1, Fn1, Fn2); + } + + { + let result: _.LoDashImplicitObjectWrapper<(m: number, n: number) => number>; + + result = _(Fn1).backflow<(m: number, n: number) => number>(Fn2); + result = _(Fn1).backflow<(m: number, n: number) => number>(Fn1, Fn2); + result = _(Fn1).backflow<(m: number, n: number) => number>(Fn1, Fn1, Fn2); + } + + { + let result: _.LoDashExplicitObjectWrapper<(m: number, n: number) => number>; + + result = _(Fn1).chain().backflow<(m: number, n: number) => number>(Fn2); + result = _(Fn1).chain().backflow<(m: number, n: number) => number>(Fn1, Fn2); + result = _(Fn1).chain().backflow<(m: number, n: number) => number>(Fn1, Fn1, Fn2); + } +} + +// _.before +module TestBefore { + interface Func { + (a: string, b: number): boolean; + } + + let func: Func; + + { + let result: Func; + + _.before(42, func); + } + + { + let result: _.LoDashImplicitObjectWrapper; + + _(42).before(func); + } + + { + let result: _.LoDashExplicitObjectWrapper; + + _(42).chain().before(func); + } +} + +// _.bind +module TestBind { + type SampleFunc = (a: number, b: string) => boolean; + + let func: SampleFunc + + { + type SampleResult = (a: number, b: string) => boolean; + + let result: SampleResult; + + result = _.bind(func, any); + result = _.bind(func, any); + } + + { + type SampleResult = (b: string) => boolean; + + let result: SampleResult; + + result = _.bind(func, any, 42); + result = _.bind(func, any, 42); + } + + { + type SampleResult = () => boolean; + + let result: SampleResult; + + result = _.bind(func, any, 42, ''); + result = _.bind(func, any, 42, ''); + } + + { + type SampleResult = (a: number, b: string) => boolean; + + let result: _.LoDashImplicitObjectWrapper; + + result = _(func).bind(any); + } + + { + type SampleResult = (b: string) => boolean; + + let result: _.LoDashImplicitObjectWrapper; + + result = _(func).bind(any, 42); + } + + { + type SampleResult = () => boolean; + + let result: _.LoDashImplicitObjectWrapper; + + result = _(func).bind(any, 42, ''); + } + + { + type SampleResult = (a: number, b: string) => boolean; + + let result: _.LoDashExplicitObjectWrapper; + + result = _(func).chain().bind(any); + } + + { + type SampleResult = (b: string) => boolean; + + let result: _.LoDashExplicitObjectWrapper; + + result = _(func).chain().bind(any, 42); + } + + { + type SampleResult = () => boolean; + + let result: _.LoDashExplicitObjectWrapper; + + result = _(func).chain().bind(any, 42, ''); + } +} + +// _.bindAll +module TestBindAll { + interface SampleObject { + a: Function; + b: Function; + c: Function; + } + + let object: SampleObject; + + { + let result: SampleObject; + + result = _.bindAll(object); + result = _.bindAll(object, 'c'); + result = _.bindAll(object, ['b'], 'c'); + result = _.bindAll(object, 'a', ['b'], 'c'); + } + + { + let result: _.LoDashImplicitObjectWrapper; + + result = _(object).bindAll(); + result = _(object).bindAll('c'); + result = _(object).bindAll(['b'], 'c'); + result = _(object).bindAll('a', ['b'], 'c'); + } + + { + let result: _.LoDashExplicitObjectWrapper; + + result = _(object).chain().bindAll(); + result = _(object).chain().bindAll('c'); + result = _(object).chain().bindAll(['b'], 'c'); + result = _(object).chain().bindAll('a', ['b'], 'c'); + } +} + +// _.bindKey +module TestBindKey { + let object: { + foo: (a: number, b: string) => boolean; + } + + { + type SampleResult = (a: number, b: string) => boolean; + + let result: SampleResult; + + result = _.bindKey(object, 'foo'); + result = _.bindKey(object, 'foo'); + } + + { + type SampleResult = (b: string) => boolean; + + let result: SampleResult; + + result = _.bindKey(object, 'foo', 42); + result = _.bindKey(object, 'foo', 42); + } + + { + type SampleResult = () => boolean; + + let result: SampleResult; + + result = _.bindKey(object, 'foo', 42, ''); + result = _.bindKey(object, 'foo', 42, ''); + } + + { + type SampleResult = (a: number, b: string) => boolean; + + let result: _.LoDashImplicitObjectWrapper; + + result = _(object).bindKey('foo'); + } + + { + type SampleResult = (b: string) => boolean; + + let result: _.LoDashImplicitObjectWrapper; + + result = _(object).bindKey('foo', 42); + } + + { + type SampleResult = () => boolean; + + let result: _.LoDashImplicitObjectWrapper; + + result = _(object).bindKey('foo', 42, ''); + } + + { + type SampleResult = (a: number, b: string) => boolean; + + let result: _.LoDashExplicitObjectWrapper; + + result = _(object).chain().bindKey('foo'); + } + + { + type SampleResult = (b: string) => boolean; + + let result: _.LoDashExplicitObjectWrapper; + + result = _(object).chain().bindKey('foo', 42); + } + + { + type SampleResult = () => boolean; + + let result: _.LoDashExplicitObjectWrapper; + + result = _(object).chain().bindKey('foo', 42, ''); + } +} + +// _.compose +module TestCompose { + let Fn1: (n: number) => number; + let Fn2: (m: number, n: number) => number; + + { + let result: (m: number, n: number) => number; + + result = _.compose<(m: number, n: number) => number>(Fn1, Fn2); + result = _.compose<(m: number, n: number) => number>(Fn1, Fn1, Fn2); + result = _.compose<(m: number, n: number) => number>(Fn1, Fn1, Fn1, Fn2); + } + + { + let result: _.LoDashImplicitObjectWrapper<(m: number, n: number) => number>; + + result = _(Fn1).compose<(m: number, n: number) => number>(Fn2); + result = _(Fn1).compose<(m: number, n: number) => number>(Fn1, Fn2); + result = _(Fn1).compose<(m: number, n: number) => number>(Fn1, Fn1, Fn2); + } + + { + let result: _.LoDashExplicitObjectWrapper<(m: number, n: number) => number>; + + result = _(Fn1).chain().compose<(m: number, n: number) => number>(Fn2); + result = _(Fn1).chain().compose<(m: number, n: number) => number>(Fn1, Fn2); + result = _(Fn1).chain().compose<(m: number, n: number) => number>(Fn1, Fn1, Fn2); + } +} + +var createCallbackObj: { [index: string]: string; } = { name: 'Joe' }; +result = <() => any>_.createCallback('name'); +result = <() => boolean>_.createCallback(createCallbackObj); +result = <_.LoDashImplicitObjectWrapper<() => any>>_('name').createCallback(); +result = <_.LoDashImplicitObjectWrapper<() => boolean>>_(createCallbackObj).createCallback(); + +// _.curry +var testCurryFn = (a: number, b: number, c: number) => [a, b, c]; +let curryResult0: number[] +let curryResult1: _.CurriedFunction1 +let curryResult2: _.CurriedFunction2 + +curryResult0 = _.curry(testCurryFn)(1, 2, 3); +curryResult1 = _.curry(testCurryFn)(1, 2); +curryResult0 = _.curry(testCurryFn)(1, 2)(3); +curryResult0 = _.curry(testCurryFn)(1)(2)(3); +curryResult2 = _.curry(testCurryFn)(1); +curryResult1 = _.curry(testCurryFn)(1)(2); +curryResult0 = _.curry(testCurryFn)(1)(2)(3); +curryResult0 = _.curry(testCurryFn)(1)(2, 3); +curryResult0 = _(testCurryFn).curry().value()(1, 2, 3); +curryResult2 = _(testCurryFn).curry().value()(1); + +declare function testCurry2(a: string, b: number, c: boolean): [string, number, boolean]; +let curryResult3: [string, number, boolean]; +let curryResult4: _.CurriedFunction1; +let curryResult5: _.CurriedFunction2; +let curryResult6: _.CurriedFunction3; +curryResult3 = _.curry(testCurry2)("1", 2, true); +curryResult3 = _.curry(testCurry2)("1", 2)(true); +curryResult3 = _.curry(testCurry2)("1")(2, true); +curryResult3 = _.curry(testCurry2)("1")(2)(true); +curryResult4 = _.curry(testCurry2)("1", 2); +curryResult4 = _.curry(testCurry2)("1")(2); +curryResult5 = _.curry(testCurry2)("1"); +curryResult6 = _.curry(testCurry2); + +// _.curryRight +var testCurryRightFn = (a: number, b: number, c: number) => [a, b, c]; +curryResult0 = _.curryRight(testCurryRightFn)(1, 2, 3); +curryResult2 = _.curryRight(testCurryRightFn)(1); +curryResult0 = _(testCurryRightFn).curryRight().value()(1, 2, 3); +curryResult2 = _(testCurryRightFn).curryRight().value()(1); + +let curryResult7: _.CurriedFunction1; +let curryResult8: _.CurriedFunction2; +let curryResult9: _.CurriedFunction3; +curryResult3 = _.curryRight(testCurry2)(true, 2, "1"); +curryResult3 = _.curryRight(testCurry2)(true, 2)("1"); +curryResult3 = _.curryRight(testCurry2)(true)(2, "1"); +curryResult3 = _.curryRight(testCurry2)(true)(2)("1"); +curryResult7 = _.curryRight(testCurry2)(true, 2); +curryResult7 = _.curryRight(testCurry2)(true)(2); +curryResult8 = _.curryRight(testCurry2)(true); +curryResult9 = _.curryRight(testCurry2); + +// _.debounce +module TestDebounce { + interface SampleFunc { + (n: number, s: string): boolean; + } + + interface Options { + leading?: boolean; + maxWait?: number; + trailing?: boolean; + } + + interface ResultFunc { + (n: number, s: string): boolean; + cancel(): void; + } + + let func: SampleFunc; + let options: Options; + + { + let result: ResultFunc; + + result = _.debounce(func); + result = _.debounce(func, 42); + result = _.debounce(func, 42, options); + } + + { + let result: _.LoDashImplicitObjectWrapper; + + result = _(func).debounce(); + result = _(func).debounce(42); + result = _(func).debounce(42, options); + } + + { + let result: _.LoDashExplicitObjectWrapper; + + result = _(func).chain().debounce(); + result = _(func).chain().debounce(42); + result = _(func).chain().debounce(42, options); + } +} + +// _.defer +module TestDefer { + type SampleFunc = (a: number, b: string) => boolean; + + let func: SampleFunc; + + { + let result: number; + + result = _.defer(func); + result = _.defer(func, any); + result = _.defer(func, any, any); + result = _.defer(func, any, any, any); + } + + { + let result: _.LoDashImplicitWrapper; + + result = _(func).defer(); + result = _(func).defer(any); + result = _(func).defer(any, any); + result = _(func).defer(any, any, any); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(func).chain().defer(); + result = _(func).chain().defer(any); + result = _(func).chain().defer(any, any); + result = _(func).chain().defer(any, any, any); + } +} + +// _.delay +module TestDelay { + type SampleFunc = (a: number, b: string) => boolean; + + let func: SampleFunc; + + { + let result: number; + + result = _.delay(func, 1); + result = _.delay(func, 1, 2); + result = _.delay(func, 1, 2, ''); + } + + { + let result: _.LoDashImplicitWrapper; + + result = _(func).delay(1); + result = _(func).delay(1, 2); + result = _(func).delay(1, 2, ''); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(func).chain().delay(1); + result = _(func).chain().delay(1, 2); + result = _(func).chain().delay(1, 2, ''); + } +} + +// _.flow +module TestFlow { + let Fn1: (n: number) => number; + let Fn2: (m: number, n: number) => number; + + { + let result: (m: number, n: number) => number; + + result = _.flow<(m: number, n: number) => number>(Fn1, Fn2); + result = _.flow<(m: number, n: number) => number>(Fn1, Fn1, Fn2); + result = _.flow<(m: number, n: number) => number>(Fn1, Fn1, Fn1, Fn2); + } + + { + let result: _.LoDashImplicitObjectWrapper<(m: number, n: number) => number>; + + result = _(Fn1).flow<(m: number, n: number) => number>(Fn2); + result = _(Fn1).flow<(m: number, n: number) => number>(Fn1, Fn2); + result = _(Fn1).flow<(m: number, n: number) => number>(Fn1, Fn1, Fn2); + } + + { + let result: _.LoDashExplicitObjectWrapper<(m: number, n: number) => number>; + + result = _(Fn1).chain().flow<(m: number, n: number) => number>(Fn2); + result = _(Fn1).chain().flow<(m: number, n: number) => number>(Fn1, Fn2); + result = _(Fn1).chain().flow<(m: number, n: number) => number>(Fn1, Fn1, Fn2); + } +} + +// _.flowRight +module TestFlowRight { + let Fn1: (n: number) => number; + let Fn2: (m: number, n: number) => number; + + { + let result: (m: number, n: number) => number; + + result = _.flowRight<(m: number, n: number) => number>(Fn1, Fn2); + result = _.flowRight<(m: number, n: number) => number>(Fn1, Fn1, Fn2); + result = _.flowRight<(m: number, n: number) => number>(Fn1, Fn1, Fn1, Fn2); + } + + { + let result: _.LoDashImplicitObjectWrapper<(m: number, n: number) => number>; + + result = _(Fn1).flowRight<(m: number, n: number) => number>(Fn2); + result = _(Fn1).flowRight<(m: number, n: number) => number>(Fn1, Fn2); + result = _(Fn1).flowRight<(m: number, n: number) => number>(Fn1, Fn1, Fn2); + } + + { + let result: _.LoDashExplicitObjectWrapper<(m: number, n: number) => number>; + + result = _(Fn1).chain().flowRight<(m: number, n: number) => number>(Fn2); + result = _(Fn1).chain().flowRight<(m: number, n: number) => number>(Fn1, Fn2); + result = _(Fn1).chain().flowRight<(m: number, n: number) => number>(Fn1, Fn1, Fn2); + } +} + +// _.memoize +var testMemoizedFunction: _.MemoizedFunction; +result = <_.MapCache>testMemoizedFunction.cache; +interface TestMemoizedResultFn extends _.MemoizedFunction { + (...args: any[]): any; +} +var testMemoizeFn: (...args: any[]) => any; +var testMemoizeResolverFn: (...args: any[]) => any; +result = _.memoize(testMemoizeFn); +result = _.memoize(testMemoizeFn, testMemoizeResolverFn); +result = (_(testMemoizeFn).memoize().value()); +result = (_(testMemoizeFn).memoize(testMemoizeResolverFn).value()); + +// _.modArgs +module TestModArgs { + type Func1 = (a: boolean) => boolean; + type Func2 = (a: boolean, b: boolean) => boolean; + + let func1: Func1; + let func2: Func2; + + let transform1: (a: string) => boolean; + let transform2: (b: number) => boolean; + + { + let result: (a: string) => boolean; + + result = _.modArgs boolean>(func1, transform1); + result = _.modArgs boolean>(func1, [transform1]); + } + + { + let result: (a: string, b: number) => boolean; + + result = _.modArgs boolean>(func2, transform1, transform2); + result = _.modArgs boolean>(func2, [transform1, transform2]); + } + + { + let result: _.LoDashImplicitObjectWrapper<(a: string) => boolean>; + + result = _(func1).modArgs<(a: string) => boolean>(transform1); + result = _(func1).modArgs<(a: string) => boolean>([transform1]); + } + + { + let result: _.LoDashImplicitObjectWrapper<(a: string, b: number) => boolean>; + + result = _(func2).modArgs<(a: string, b: number) => boolean>(transform1, transform2); + result = _(func2).modArgs<(a: string, b: number) => boolean>([transform1, transform2]); + } + + { + let result: _.LoDashExplicitObjectWrapper<(a: string) => boolean>; + + result = _(func1).chain().modArgs<(a: string) => boolean>(transform1); + result = _(func1).chain().modArgs<(a: string) => boolean>([transform1]); + } + + { + let result: _.LoDashExplicitObjectWrapper<(a: string, b: number) => boolean>; + + result = _(func2).chain().modArgs<(a: string, b: number) => boolean>(transform1, transform2); + result = _(func2).chain().modArgs<(a: string, b: number) => boolean>([transform1, transform2]); + } +} + +// _.negate +module TestNegate { + interface PredicateFn { + (a1: number, a2: number): boolean; + } + + interface ResultFn { + (a1: number, a2: number): boolean; + } + + var predicate = (a1: number, a2: number) => a1 > a2; + + { + let result: ResultFn; + + result = _.negate(predicate); + result = _.negate(predicate); + } + + { + let result: _.LoDashImplicitObjectWrapper; + + result = _(predicate).negate(); + result = _(predicate).negate(); + } + + { + let result: _.LoDashExplicitObjectWrapper; + + result = _(predicate).chain().negate(); + result = _(predicate).chain().negate(); + } +} + +// _.once +module TestOnce { + interface Func { + (a: number, b: string): boolean; + } + + let func: Func; + + { + let result: Func; + + result = _.once(func); + } + + { + let result: _.LoDashImplicitObjectWrapper; + + result = _(func).once(); + } + + { + let result: _.LoDashExplicitObjectWrapper; + + result = _(func).chain().once(); + } +} + +var greetPartial = function (greeting: string, name: string) { return greeting + ' ' + name; }; +var hi = _.partial(greetPartial, 'hi'); +hi('moe'); + + +var defaultsDeep = _.partialRight(_.merge, _.defaults); + +var optionsPartialRight = { + 'variable': 'data', + 'imports': { 'jq': $ } +}; + +defaultsDeep(optionsPartialRight, _.templateSettings); + +//_.rearg +var testReargFn = (a: string, b: string, c: string) => [a, b, c]; +interface TestReargResultFn { + (b: string, c: string, a: string): string[]; +} +result = (_.rearg(testReargFn, 2, 0, 1))('b', 'c', 'a'); +result = (_.rearg(testReargFn, [2, 0, 1]))('b', 'c', 'a'); +result = (_(testReargFn).rearg(2, 0, 1).value())('b', 'c', 'a'); +result = (_(testReargFn).rearg([2, 0, 1]).value())('b', 'c', 'a'); + +// _.restParam +module TestRestParam { + type Func = (a: string, b: number[]) => boolean; + type ResultFunc = (a: string, ...b: number[]) => boolean; + + let func: Func; + + { + let result: ResultFunc; + + result = _.restParam(func); + result = _.restParam(func, 1); + + result = _.restParam(func); + result = _.restParam(func, 1); + } + + { + let result: _.LoDashImplicitObjectWrapper; + + result = _(func).restParam(); + result = _(func).restParam(1); + } + + { + let result: _.LoDashExplicitObjectWrapper; + + result = _(func).chain().restParam(); + result = _(func).chain().restParam(1); + } +} + +//_.spread +module TestSpread { + type SampleFunc = (args: (number|string)[]) => boolean; + type SampleResult = (a: number, b: string) => boolean; + + let func: SampleFunc; + + { + let result: SampleResult; + + result = _.spread(func); + result = _.spread(func); + } + + { + let result: _.LoDashImplicitObjectWrapper; + + result = _(func).spread(); + } + + { + let result: _.LoDashExplicitObjectWrapper; + + result = _(func).chain().spread(); + } +} + +// _.throttle +module TestThrottle { + interface SampleFunc { + (n: number, s: string): boolean; + } + + interface Options { + leading?: boolean; + trailing?: boolean; + } + + interface ResultFunc { + (n: number, s: string): boolean; + cancel(): void; + } + + let func: SampleFunc; + let options: Options; + + { + let result: ResultFunc; + + result = _.throttle(func); + result = _.throttle(func, 42); + result = _.throttle(func, 42, options); + } + + { + let result: _.LoDashImplicitObjectWrapper; + + result = _(func).throttle(); + result = _(func).throttle(42); + result = _(func).throttle(42, options); + } + + { + let result: _.LoDashExplicitObjectWrapper; + + result = _(func).chain().throttle(); + result = _(func).chain().throttle(42); + result = _(func).chain().throttle(42, options); + } +} + +// _.wrap +module TestWrap { + type SampleValue = {a: number; b: string; c: boolean} + type SampleResult = (arg2: number, arg3: string) => boolean; + + { + type SampleWrapper = (arg1: SampleValue, arg2: number, arg3: string) => boolean; + + let value: SampleValue; + let wrapper: SampleWrapper; + let result: SampleResult; + + result = _.wrap(value, wrapper); + result = _.wrap(value, wrapper); + result = _.wrap(value, wrapper); + } + + { + type SampleWrapper = (arg1: number, arg2: number, arg3: string) => boolean; + + let value: number; + let wrapper: SampleWrapper; + let result: _.LoDashImplicitObjectWrapper; + + result = _(value).wrap(wrapper); + result = _(value).wrap(wrapper); + } + + { + type SampleWrapper = (arg1: number[], arg2: number, arg3: string) => boolean; + + let value: number[]; + let wrapper: SampleWrapper; + let result: _.LoDashImplicitObjectWrapper; + + result = _(value).wrap(wrapper); + result = _(value).wrap(wrapper); + } + + { + type SampleWrapper = (arg1: SampleValue, arg2: number, arg3: string) => boolean; + + let value: SampleValue; + let wrapper: SampleWrapper; + let result: _.LoDashImplicitObjectWrapper; + + result = _(value).wrap(wrapper); + result = _(value).wrap(wrapper); + } + + { + type SampleWrapper = (arg1: number, arg2: number, arg3: string) => boolean; + + let value: number; + let wrapper: SampleWrapper; + let result: _.LoDashExplicitObjectWrapper; + + result = _(value).chain().wrap(wrapper); + result = _(value).chain().wrap(wrapper); + } + + { + type SampleWrapper = (arg1: number[], arg2: number, arg3: string) => boolean; + + let value: number[]; + let wrapper: SampleWrapper; + let result: _.LoDashExplicitObjectWrapper; + + result = _(value).chain().wrap(wrapper); + result = _(value).chain().wrap(wrapper); + } + + { + type SampleWrapper = (arg1: SampleValue, arg2: number, arg3: string) => boolean; + + let value: SampleValue; + let wrapper: SampleWrapper; + let result: _.LoDashExplicitObjectWrapper; + + result = _(value).chain().wrap(wrapper); + result = _(value).chain().wrap(wrapper); + } +} + +/******** + * Lang * + ********/ + +// _.clone +interface TestCloneCustomizerFn { + (value: any): any; +} +var testCloneCustomizerFn: TestCloneCustomizerFn; +{ + let result: number; + result = _.clone(42); + result = _.clone(42, false); + result = _.clone(42, false, testCloneCustomizerFn); + result = _.clone(42, false, testCloneCustomizerFn, any); + result = _.clone(42, testCloneCustomizerFn); + result = _.clone(42, testCloneCustomizerFn, any); + result = _(42).clone(); + result = _(42).clone(false); + result = _(42).clone(false, testCloneCustomizerFn); + result = _(42).clone(false, testCloneCustomizerFn, any); + result = _(42).clone(testCloneCustomizerFn); + result = _(42).clone(testCloneCustomizerFn, any); +} +{ + let result: string[]; + result = _.clone([]); + result = _.clone([], false); + result = _.clone([], false, testCloneCustomizerFn); + result = _.clone([], false, testCloneCustomizerFn, any); + result = _.clone([], testCloneCustomizerFn); + result = _.clone([], testCloneCustomizerFn, any); + result = _([]).clone(); + result = _([]).clone(false); + result = _([]).clone(false, testCloneCustomizerFn); + result = _([]).clone(false, testCloneCustomizerFn, any); + result = _([]).clone(testCloneCustomizerFn); + result = _([]).clone(testCloneCustomizerFn, any); +} +{ + let result: {a: {b: number;}}; + result = _.clone<{a: {b: number;}}>({a: {b: 2}}); + result = _.clone<{a: {b: number;}}>({a: {b: 2}}, false); + result = _.clone<{a: {b: number;}}>({a: {b: 2}}, false, testCloneCustomizerFn); + result = _.clone<{a: {b: number;}}>({a: {b: 2}}, false, testCloneCustomizerFn, any); + result = _.clone<{a: {b: number;}}>({a: {b: 2}}, testCloneCustomizerFn); + result = _.clone<{a: {b: number;}}>({a: {b: 2}}, testCloneCustomizerFn, any); + result = _({a: {b: 2}}).clone(); + result = _({a: {b: 2}}).clone(false); + result = _({a: {b: 2}}).clone(false, testCloneCustomizerFn); + result = _({a: {b: 2}}).clone(false, testCloneCustomizerFn, any); + result = _({a: {b: 2}}).clone(testCloneCustomizerFn); + result = _({a: {b: 2}}).clone(testCloneCustomizerFn, any); +} + +// _.cloneDeep +interface TestCloneDeepCustomizerFn { + (value: any): any; +} +var testCloneDeepCustomizerFn: TestCloneDeepCustomizerFn; +{ + let result: number; + result = _.cloneDeep(42); + result = _.cloneDeep(42, testCloneDeepCustomizerFn); + result = _.cloneDeep(42, testCloneDeepCustomizerFn, any); + result = _(42).cloneDeep(); + result = _(42).cloneDeep(testCloneDeepCustomizerFn); + result = _(42).cloneDeep(testCloneDeepCustomizerFn, any); +} +{ + let result: string[]; + result = _.cloneDeep([]); + result = _.cloneDeep([], testCloneDeepCustomizerFn); + result = _.cloneDeep([], testCloneDeepCustomizerFn, any); + result = _([]).cloneDeep(); + result = _([]).cloneDeep(testCloneDeepCustomizerFn); + result = _([]).cloneDeep(testCloneDeepCustomizerFn, any); +} +{ + let result: {a: {b: number;}}; + result = _.cloneDeep<{a: {b: number;}}>({a: {b: 2}}); + result = _.cloneDeep<{a: {b: number;}}>({a: {b: 2}}, testCloneDeepCustomizerFn); + result = _.cloneDeep<{a: {b: number;}}>({a: {b: 2}}, testCloneDeepCustomizerFn, any); + result = _({a: {b: 2}}).cloneDeep(); + result = _({a: {b: 2}}).cloneDeep(testCloneDeepCustomizerFn); + result = _({a: {b: 2}}).cloneDeep(testCloneDeepCustomizerFn, any); +} + +// _.eq +module TestEq { + let customizer: (value: any, other: any, indexOrKey?: number|string) => boolean; + + { + let result: boolean; + + result = _.eq(any, any); + result = _.eq(any, any, customizer); + result = _.eq(any, any, customizer, any); + + result = _(any).eq(any); + result = _(any).eq(any, customizer); + result = _(any).eq(any, customizer, any); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(any).chain().eq(any); + result = _(any).chain().eq(any, customizer); + result = _(any).chain().eq(any, customizer, any); + } +} + +// _.gt +module TestGt { + { + let result: boolean; + + result = _.gt(any, any); + result = _(1).gt(any); + result = _([]).gt(any); + result = _({}).gt(any); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(1).chain().gt(any); + result = _([]).chain().gt(any); + result = _({}).chain().gt(any); + } +} + +// _.gte +module TestGte { + { + let result: boolean; + + result = _.gte(any, any); + result = _(1).gte(any); + result = _([]).gte(any); + result = _({}).gte(any); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(1).chain().gte(any); + result = _([]).chain().gte(any); + result = _({}).chain().gte(any); + } +} + +// _.isArguments +module TestisArguments { + { + let value: number|IArguments; + + if (_.isArguments(value)) { + let result: IArguments = value; + } + else { + let result: number = value; + } + } + + { + let result: boolean; + + result = _.isArguments(any); + result = _(1).isArguments(); + result = _([]).isArguments(); + result = _({}).isArguments(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(1).chain().isArguments(); + result = _([]).chain().isArguments(); + result = _({}).chain().isArguments(); + } +} + +// _.isArray +module TestIsArray { + { + let value: number|string[]|boolean[]; + + if (_.isArray(value)) { + let result: string[] = value; + } + else { + if (_.isArray(value)) { + let result: boolean[] = value; + } + else { + let result: number = value; + } + } + } + + { + let result: boolean; + + result = _.isArray(any); + result = _(1).isArray(); + result = _([]).isArray(); + result = _({}).isArray(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(1).chain().isArray(); + result = _([]).chain().isArray(); + result = _({}).chain().isArray(); + } +} + +// _.isBoolean +module TestIsBoolean { + { + let value: number|boolean; + + if (_.isBoolean(value)) { + let result: boolean = value; + } + else { + let result: number = value; + } + } + + { + let result: boolean; + + result = _.isBoolean(any); + result = _(1).isBoolean(); + result = _([]).isBoolean(); + result = _({}).isBoolean(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(1).chain().isBoolean(); + result = _([]).chain().isBoolean(); + result = _({}).chain().isBoolean(); + } +} + +// _.isDate +module TestIsBoolean { + { + let value: number|Date; + + if (_.isDate(value)) { + let result: Date = value; + } + else { + let result: number = value; + } + } + + { + let result: boolean; + + result = _.isDate(any); + result = _(42).isDate(); + result = _([]).isDate(); + result = _({}).isDate(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(42).chain().isDate(); + result = _([]).chain().isDate(); + result = _({}).chain().isDate(); + } +} + +// _.isElement +module TestIsElement { + { + let result: boolean; + + result = _.isElement(any); + + result = _(42).isElement(); + result = _([]).isElement(); + result = _({}).isElement(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(42).chain().isElement(); + result = _([]).chain().isElement(); + result = _({}).chain().isElement(); + } +} + +// _.isEmpty +result = _.isEmpty([1, 2, 3]); +result = _.isEmpty({}); +result = _.isEmpty(''); +result = _([1, 2, 3]).isEmpty(); +result = _({}).isEmpty(); +result = _('').isEmpty(); + +// _.isEqual +module TestIsEqual { + let customizer: (value: any, other: any, indexOrKey?: number|string) => boolean; + + { + let result: boolean; + + result = _.isEqual(any, any); + result = _.isEqual(any, any, customizer); + result = _.isEqual(any, any, customizer, any); + + result = _(any).isEqual(any); + result = _(any).isEqual(any, customizer); + result = _(any).isEqual(any, customizer, any); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(any).chain().isEqual(any); + result = _(any).chain().isEqual(any, customizer); + result = _(any).chain().isEqual(any, customizer, any); + } +} + +// _.isError +module TestIsError { + { + let value: number|Error; + + if (_.isError(value)) { + let result: Error = value; + } + else { + let result: number = value; + } + } + + { + class CustomError extends Error {} + + let value: number|CustomError; + + if (_.isError(value)) { + let result: CustomError = value; + } + else { + let result: number = value; + } + } + + { + let result: boolean; + + result = _.isError(any); + result = _(1).isError(); + result = _([]).isError(); + result = _({}).isError(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(1).chain().isError(); + result = _([]).chain().isError(); + result = _({}).chain().isError(); + } +} + +// _.isFinite +module TestIsFinite { + { + let result: boolean; + + result = _.isFinite(any); + result = _(1).isFinite(); + result = _([]).isFinite(); + result = _({}).isFinite(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(1).chain().isFinite(); + result = _([]).chain().isFinite(); + result = _({}).chain().isFinite(); + } +} + +// _.isFunction +module TestIsFunction { + { + let value: number|Function; + + if (_.isFunction(value)) { + let result: Function = value; + } + else { + let result: number = value; + } + } + + { + let result: boolean; + + result = _.isFunction(any); + result = _(1).isFunction(); + result = _([]).isFunction(); + result = _({}).isFunction(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(1).chain().isFunction(); + result = _([]).chain().isFunction(); + result = _({}).chain().isFunction(); + } +} + +// _.isMatch +var testIsMatchCustiomizerFn: (value: any, other: any, indexOrKey: number|string) => boolean; +result = _.isMatch({}, {}); +result = _.isMatch({}, {}, testIsMatchCustiomizerFn); +result = _.isMatch({}, {}, testIsMatchCustiomizerFn, {}); +result = _({}).isMatch({}); +result = _({}).isMatch({}, testIsMatchCustiomizerFn); +result = _({}).isMatch({}, testIsMatchCustiomizerFn, {}); + +// _.isNaN +module TestIsNaN { + { + let result: boolean; + + result = _.isNaN(any); + + result = _(1).isNaN(); + result = _([]).isNaN(); + result = _({}).isNaN(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(1).chain().isNaN(); + result = _([]).chain().isNaN(); + result = _({}).chain().isNaN(); + } +} + +// _.isNative +module TestIsNative { + { + let value: number|Function; + + if (_.isNative(value)) { + let result: Function = value; + } + else { + let result: number = value; + } + } + + { + let result: boolean; + + result = _.isNative(any); + + result = _(1).isNative(); + result = _([]).isNative(); + result = _({}).isNative(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(1).chain().isNative(); + result = _([]).chain().isNative(); + result = _({}).chain().isNative(); + } +} + +// _.isNull +module TestIsNull { + { + let result: boolean; + + result = _.isNull(any); + + result = _(1).isNull(); + result = _([]).isNull(); + result = _({}).isNull(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(1).chain().isNull(); + result = _([]).chain().isNull(); + result = _({}).chain().isNull(); + } +} + +// _.isNumber +module TestIsNumber { + { + let value: string|number; + + if (_.isNumber(value)) { + let result: number = value; + } + else { + let result: string = value; + } + } + + { + let result: boolean; + + result = _.isNumber(any); + + result = _(1).isNumber(); + result = _([]).isNumber(); + result = _({}).isNumber(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(1).chain().isNumber(); + result = _([]).chain().isNumber(); + result = _({}).chain().isNumber(); + } +} + +// _.isObject +module TestIsObject { + { + let result: boolean; + + result = _.isObject(any); + result = _(1).isObject(); + result = _([]).isObject(); + result = _({}).isObject(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(1).chain().isObject(); + result = _([]).chain().isObject(); + result = _({}).chain().isObject(); + } +} + +// _.isPlainObject +module TestIsPlainObject { + { + let result: boolean; + + result = _.isPlainObject(any); + result = _(1).isPlainObject(); + result = _([]).isPlainObject(); + result = _({}).isPlainObject(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(1).chain().isPlainObject(); + result = _([]).chain().isPlainObject(); + result = _({}).chain().isPlainObject(); + } +} + +// _.isRegExp +module TestIsRegExp { + { + let value: number|RegExp; + + if (_.isRegExp(value)) { + let result: RegExp = value; + } + else { + let result: number = value; + } + } + + { + let result: boolean; + + result = _.isRegExp(any); + result = _(1).isRegExp(); + result = _([]).isRegExp(); + result = _({}).isRegExp(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(1).chain().isRegExp(); + result = _([]).chain().isRegExp(); + result = _({}).chain().isRegExp(); + } +} + +// _.isString +module TestIsString { + { + let value: number|string; + + if (_.isString(value)) { + let result: string = value; + } + else { + let result: number = value; + } + } + + { + let result: boolean; + + result = _.isString(any); + result = _(1).isString(); + result = _([]).isString(); + result = _({}).isString(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(1).chain().isString(); + result = _([]).chain().isString(); + result = _({}).chain().isString(); + } +} + +// _.isTypedArray +module TestIsTypedArray { + { + let result: boolean; + + result = _.isTypedArray([]); + result = _([]).isTypedArray(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _([]).chain().isTypedArray(); + } +} + +// _.isUndefined +module TestIsUndefined { + { + let result: boolean; + + result = _.isUndefined(any); + + result = _(1).isUndefined(); + result = _([]).isUndefined(); + result = _({}).isUndefined(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(1).chain().isUndefined(); + result = _([]).chain().isUndefined(); + result = _({}).chain().isUndefined(); + } +} + +// _.lt +module TestLt { + { + let result: boolean; + + result = _.lt(any, any); + result = _(1).lt(any); + result = _([]).lt(any); + result = _({}).lt(any); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(1).chain().lt(any); + result = _([]).chain().lt(any); + result = _({}).chain().lt(any); + } +} + +// _.lte +module TestLte { + { + let result: boolean; + + result = _.lte(any, any); + result = _(1).lte(any); + result = _([]).lte(any); + result = _({}).lte(any); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(1).chain().lte(any); + result = _([]).chain().lte(any); + result = _({}).chain().lte(any); + } +} + +// _.toArray +module TestToArray { + let array: TResult[]; + let list: _.List; + let dictionary: _.Dictionary; + let numericDictionary: _.NumericDictionary; + + { + let result: string[]; + + result = _.toArray(''); + result = _.toArray(''); + } + + { + let result: TResult[]; + + result = _.toArray(array); + result = _.toArray(list); + result = _.toArray(dictionary); + result = _.toArray(numericDictionary); + + result = _.toArray(array); + result = _.toArray(list); + result = _.toArray(dictionary); + result = _.toArray(numericDictionary); + } + + { + let result: any[]; + + result = _.toArray(); + result = _.toArray(42); + result = _.toArray(true); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(array).toArray(); + result = _(list).toArray(); + result = _(dictionary).toArray(); + result = _(numericDictionary).toArray(); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(array).chain().toArray(); + result = _(list).chain().toArray(); + result = _(dictionary).chain().toArray(); + result = _(numericDictionary).chain().toArray(); + } +} + +// _.toPlainObject +module TestToPlainObject { + let result: TResult; + + result = _.toPlainObject(); + result = _.toPlainObject(true); + result = _.toPlainObject(1); + result = _.toPlainObject('a'); + result = _.toPlainObject([]); + result = _.toPlainObject({}); + + result = _(true).toPlainObject().value(); + result = _(1).toPlainObject().value(); + result = _('a').toPlainObject().value(); + result = _([1]).toPlainObject().value(); + result = _([]).toPlainObject().value(); + result = _({}).toPlainObject().value(); +} + +/******** + * Math * + ********/ + +// _.add +module TestAdd { + { + let result: number; + + result = _.add(1, 1); + result = _(1).add(1); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(1).chain().add(1); + } +} + +// _.ceil +module TestCeil { + { + let result: number; + + result = _.ceil(6.004); + result = _.ceil(6.004, 2); + + result = _(6.004).ceil(); + result = _(6.004).ceil(2); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(6.004).chain().ceil(); + result = _(6.004).chain().ceil(2); + } +} + +// _.floor +module TestFloor { + { + let result: number; + + result = _.floor(4.006); + result = _.floor(0.046, 2); + result = _.floor(4060, -2); + + result = _(4.006).floor(); + result = _(0.046).floor(2); + result = _(4060).floor(-2); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(4.006).chain().floor(); + result = _(0.046).chain().floor(2); + result = _(4060).chain().floor(-2); + } +} + +// _.max +module TestMax { + let array: number[]; + let list: _.List; + let dictionary: _.Dictionary; + + let listIterator: (value: number, index: number, collection: _.List) => number; + let dictionaryIterator: (value: number, key: string, collection: _.Dictionary) => number; + + let result: number; + + result = _.max(array); + result = _.max(array, listIterator); + result = _.max(array, listIterator, any); + result = _.max(array, ''); + result = _.max<{a: number}, number>(array, {a: 42}); + + result = _.max(list); + result = _.max(list, listIterator); + result = _.max(list, listIterator, any); + result = _.max(list, ''); + result = _.max<{a: number}, number>(list, {a: 42}); + + result = _.max(dictionary); + result = _.max(dictionary, dictionaryIterator); + result = _.max(dictionary, dictionaryIterator, any); + result = _.max(dictionary, ''); + result = _.max<{a: number}, number>(dictionary, {a: 42}); + + result = _(array).max(); + result = _(array).max(listIterator); + result = _(array).max(listIterator, any); + result = _(array).max(''); + result = _(array).max<{a: number}>({a: 42}); + + result = _(list).max(); + result = _(list).max(listIterator); + result = _(list).max(listIterator, any); + result = _(list).max(''); + result = _(list).max<{a: number}, number>({a: 42}); + + result = _(dictionary).max(); + result = _(dictionary).max(dictionaryIterator); + result = _(dictionary).max(dictionaryIterator, any); + result = _(dictionary).max(''); + result = _(dictionary).max<{a: number}, number>({a: 42}); +} + +// _.min +module TestMin { + let array: number[]; + let list: _.List; + let dictionary: _.Dictionary; + + let listIterator: (value: number, index: number, collection: _.List) => number; + let dictionaryIterator: (value: number, key: string, collection: _.Dictionary) => number; + + let result: number; + + result = _.min(array); + result = _.min(array, listIterator); + result = _.min(array, listIterator, any); + result = _.min(array, ''); + result = _.min<{a: number}, number>(array, {a: 42}); + + result = _.min(list); + result = _.min(list, listIterator); + result = _.min(list, listIterator, any); + result = _.min(list, ''); + result = _.min<{a: number}, number>(list, {a: 42}); + + result = _.min(dictionary); + result = _.min(dictionary, dictionaryIterator); + result = _.min(dictionary, dictionaryIterator, any); + result = _.min(dictionary, ''); + result = _.min<{a: number}, number>(dictionary, {a: 42}); + + result = _(array).min(); + result = _(array).min(listIterator); + result = _(array).min(listIterator, any); + result = _(array).min(''); + result = _(array).min<{a: number}>({a: 42}); + + result = _(list).min(); + result = _(list).min(listIterator); + result = _(list).min(listIterator, any); + result = _(list).min(''); + result = _(list).min<{a: number}, number>({a: 42}); + + result = _(dictionary).min(); + result = _(dictionary).min(dictionaryIterator); + result = _(dictionary).min(dictionaryIterator, any); + result = _(dictionary).min(''); + result = _(dictionary).min<{a: number}, number>({a: 42}); +} + +// _.round +module TestRound { + { + let result: number; + + result = _.round(4.006); + result = _.round(4.006, 2); + + result = _(4.006).round(); + result = _(4.006).round(2); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(4.006).chain().round(); + result = _(4.006).chain().round(2); + } +} + +// _.sum +module TestSum { + let array: number[]; + let list: _.List; + let dictionary: _.Dictionary; + + let listIterator: (value: number, index: number, collection: _.List) => number; + let dictionaryIterator: (value: number, key: string, collection: _.Dictionary) => number; + + { + let result: number; + + result = _.sum(array); + result = _.sum(array); + result = _.sum(array, listIterator); + result = _.sum(array, listIterator, any); + result = _.sum(array, ''); + + + result = _.sum(list); + result = _.sum(list); + result = _.sum(list, listIterator); + result = _.sum(list, listIterator, any); + result = _.sum(list, ''); + + result = _.sum(dictionary); + result = _.sum(dictionary); + result = _.sum(dictionary, dictionaryIterator); + result = _.sum(dictionary, dictionaryIterator, any); + result = _.sum(dictionary, ''); + + result = _(array).sum(); + result = _(array).sum(listIterator); + result = _(array).sum(listIterator, any); + result = _(array).sum(''); + + + result = _(list).sum(); + result = _(list).sum(listIterator); + result = _(list).sum(listIterator, any); + result = _(list).sum(''); + + result = _(dictionary).sum(); + result = _(dictionary).sum(dictionaryIterator); + result = _(dictionary).sum(dictionaryIterator, any); + result = _(dictionary).sum(''); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(array).chain().sum(); + result = _(array).chain().sum(listIterator); + result = _(array).chain().sum(listIterator, any); + result = _(array).chain().sum(''); + + + result = _(list).chain().sum(); + result = _(list).chain().sum(listIterator); + result = _(list).chain().sum(listIterator, any); + result = _(list).chain().sum(''); + + result = _(dictionary).chain().sum(); + result = _(dictionary).chain().sum(dictionaryIterator); + result = _(dictionary).chain().sum(dictionaryIterator, any); + result = _(dictionary).chain().sum(''); + } +} + +/********** + * Number * + **********/ + +// _.inRange +module TestInRange { + { + let result: boolean; + + result = _.inRange(3, 2, 4); + result = _.inRange(4, 8); + + result = _(3).inRange(2, 4); + result = _(4).inRange(8); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(3).chain().inRange(2, 4); + result = _(4).chain().inRange(8); + } +} + +// _.random +module TestRandom { + { + let result: number; + + result = _.random(); + result = _.random(1); + result = _.random(1, 2); + result = _.random(1, 2, true); + result = _.random(1, true); + result = _.random(true); + + result = _(1).random(); + result = _(1).random(2); + result = _(1).random(2, true); + result = _(1).random(true); + result = _(true).random(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(1).chain().random(); + result = _(1).chain().random(2); + result = _(1).chain().random(2, true); + result = _(1).chain().random(true); + result = _(true).chain().random(); + } +} + +/********** + * Object * + **********/ + +// _.assign +module TestAssign { + interface Obj {a: string}; + interface S1 {a: number}; + interface S2 {b: number}; + interface S3 {c: number}; + interface S4 {d: number}; + interface S5 {e: number}; + + let obj: Obj; + let s1: S1; + let s2: S2; + let s3: S3; + let s4: S4; + let s5: S5; + + let customizer: (objectValue: any, sourceValue: any, key?: string, object?: {}, source?: {}) => any; + + { + let result: Obj; + + result = _.assign(obj); + } + + { + let result: {a: number}; + + result = _.assign(obj, s1); + result = _.assign(obj, s1, customizer); + result = _.assign(obj, s1, customizer, any); + } + + { + let result: {a: number, b: number}; + + result = _.assign(obj, s1, s2); + result = _.assign(obj, s1, s2, customizer); + result = _.assign(obj, s1, s2, customizer, any); + } + + { + let result: {a: number, b: number, c: number}; + + result = _.assign(obj, s1, s2, s3); + result = _.assign(obj, s1, s2, s3, customizer); + result = _.assign(obj, s1, s2, s3, customizer, any); + } + + { + let result: {a: number, b: number, c: number, d: number}; + + result = _.assign(obj, s1, s2, s3, s4); + result = _.assign(obj, s1, s2, s3, s4, customizer); + result = _.assign(obj, s1, s2, s3, s4, customizer, any); + } + + { + let result: {a: number, b: number, c: number, d: number, e: number}; + + result = _.assign(obj, s1, s2, s3, s4, s5); + result = _.assign(obj, s1, s2, s3, s4, s5, customizer); + result = _.assign(obj, s1, s2, s3, s4, s5, customizer, any); + } + + { + let result: _.LoDashImplicitObjectWrapper; + + result = _(obj).assign(); + } + + { + let result: _.LoDashImplicitObjectWrapper<{a: number}>; + + result = _(obj).assign(s1); + result = _(obj).assign(s1, customizer); + result = _(obj).assign(s1, customizer, any); + } + + { + let result: _.LoDashImplicitObjectWrapper<{a: number, b: number}>; + + result = _(obj).assign(s1, s2); + result = _(obj).assign(s1, s2, customizer); + result = _(obj).assign(s1, s2, customizer, any); + } + + { + let result: _.LoDashImplicitObjectWrapper<{a: number, b: number, c: number}>; + + result = _(obj).assign(s1, s2, s3); + result = _(obj).assign(s1, s2, s3, customizer); + result = _(obj).assign(s1, s2, s3, customizer, any); + } + + { + let result: _.LoDashImplicitObjectWrapper<{a: number, b: number, c: number, d: number}>; + + result = _(obj).assign(s1, s2, s3, s4); + result = _(obj).assign(s1, s2, s3, s4, customizer); + result = _(obj).assign(s1, s2, s3, s4, customizer, any); + } + + { + let result: _.LoDashImplicitObjectWrapper<{a: number, b: number, c: number, d: number, e: number}>; + + result = _(obj).assign<{a: number, b: number, c: number, d: number, e: number}>(s1, s2, s3, s4, s5); + result = _(obj).assign<{a: number, b: number, c: number, d: number, e: number}>(s1, s2, s3, s4, s5, customizer); + result = _(obj).assign<{a: number, b: number, c: number, d: number, e: number}>(s1, s2, s3, s4, s5, customizer, any); + } + + { + let result: _.LoDashExplicitObjectWrapper; + + result = _(obj).chain().assign(); + } + + { + let result: _.LoDashExplicitObjectWrapper<{a: number}>; + + result = _(obj).chain().assign(s1); + result = _(obj).chain().assign(s1, customizer); + result = _(obj).chain().assign(s1, customizer, any); + } + + { + let result: _.LoDashExplicitObjectWrapper<{a: number, b: number}>; + + result = _(obj).chain().assign(s1, s2); + result = _(obj).chain().assign(s1, s2, customizer); + result = _(obj).chain().assign(s1, s2, customizer, any); + } + + { + let result: _.LoDashExplicitObjectWrapper<{a: number, b: number, c: number}>; + + result = _(obj).chain().assign(s1, s2, s3); + result = _(obj).chain().assign(s1, s2, s3, customizer); + result = _(obj).chain().assign(s1, s2, s3, customizer, any); + } + + { + let result: _.LoDashExplicitObjectWrapper<{a: number, b: number, c: number, d: number}>; + + result = _(obj).chain().assign(s1, s2, s3, s4); + result = _(obj).chain().assign(s1, s2, s3, s4, customizer); + result = _(obj).chain().assign(s1, s2, s3, s4, customizer, any); + } + + { + let result: _.LoDashExplicitObjectWrapper<{a: number, b: number, c: number, d: number, e: number}>; + + result = _(obj).chain().assign<{a: number, b: number, c: number, d: number, e: number}>(s1, s2, s3, s4, s5); + result = _(obj).chain().assign<{a: number, b: number, c: number, d: number, e: number}>(s1, s2, s3, s4, s5, customizer); + result = _(obj).chain().assign<{a: number, b: number, c: number, d: number, e: number}>(s1, s2, s3, s4, s5, customizer, any); + } +} + +// _.create +module TestCreate { + type SampleProto = {a: number}; + type SampleProps = {b: string}; + + let prototype: SampleProto; + let properties: SampleProps; + + { + let result: {a: number; b: string}; + + result = _.create(prototype, properties); + result = _.create(prototype, properties); + } + + { + let result: _.LoDashImplicitObjectWrapper<{a: number; b: string}>; + + result = _(prototype).create(properties); + result = _(prototype).create(properties); + } + + { + let result: _.LoDashExplicitObjectWrapper<{a: number; b: string}>; + + result = _(prototype).chain().create(properties); + result = _(prototype).chain().create(properties); + } +} + +// _.defaults +module TestDefaults { + interface Obj {a: string}; + interface S1 {a: number}; + interface S2 {b: number}; + interface S3 {c: number}; + interface S4 {d: number}; + interface S5 {e: number}; + + let obj: Obj; + let s1: S1; + let s2: S2; + let s3: S3; + let s4: S4; + let s5: S5; + + { + let result: Obj; + + result = _.defaults(obj); + } + + { + let result: {a: string}; + + result = _.defaults(obj, s1); + } + + { + let result: {a: string, b: number}; + + result = _.defaults(obj, s1, s2); + } + + { + let result: {a: string, b: number, c: number}; + + result = _.defaults(obj, s1, s2, s3); + } + + { + let result: {a: string, b: number, c: number, d: number}; + + result = _.defaults(obj, s1, s2, s3, s4); + } + + { + let result: {a: string, b: number, c: number, d: number, e: number}; + + result = _.defaults(obj, s1, s2, s3, s4, s5); + } + + { + let result: _.LoDashImplicitObjectWrapper; + + result = _(obj).defaults(); + } + + { + let result: _.LoDashImplicitObjectWrapper<{a: string}>; + + result = _(obj).defaults(s1); + } + + { + let result: _.LoDashImplicitObjectWrapper<{a: string, b: number}>; + + result = _(obj).defaults(s1, s2); + } + + { + let result: _.LoDashImplicitObjectWrapper<{a: string, b: number, c: number}>; + + result = _(obj).defaults(s1, s2, s3); + } + + { + let result: _.LoDashImplicitObjectWrapper<{a: string, b: number, c: number, d: number}>; + + result = _(obj).defaults(s1, s2, s3, s4); + } + + { + let result: _.LoDashImplicitObjectWrapper<{a: string, b: number, c: number, d: number, e: number}>; + + result = _(obj).defaults<{a: string, b: number, c: number, d: number, e: number}>(s1, s2, s3, s4, s5); + } + + { + let result: _.LoDashExplicitObjectWrapper; + + result = _(obj).chain().defaults(); + } + + { + let result: _.LoDashExplicitObjectWrapper<{a: string}>; + + result = _(obj).chain().defaults(s1); + } + + { + let result: _.LoDashExplicitObjectWrapper<{a: string, b: number}>; + + result = _(obj).chain().defaults(s1, s2); + } + + { + let result: _.LoDashExplicitObjectWrapper<{a: string, b: number, c: number}>; + + result = _(obj).chain().defaults(s1, s2, s3); + } + + { + let result: _.LoDashExplicitObjectWrapper<{a: string, b: number, c: number, d: number}>; + + result = _(obj).chain().defaults(s1, s2, s3, s4); + } + + { + let result: _.LoDashExplicitObjectWrapper<{a: string, b: number, c: number, d: number, e: number}>; + + result = _(obj).chain().defaults<{a: string, b: number, c: number, d: number, e: number}>(s1, s2, s3, s4, s5); + } +} + +//_.defaultsDeep +interface DefaultsDeepResult { + user: { + name: string; + age: number; + } +} +var TestDefaultsDeepObject = {'user': {'name': 'barney'}}; +var TestDefaultsDeepSource = {'user': {'name': 'fred', 'age': 36}}; +result = _.defaultsDeep(TestDefaultsDeepObject, TestDefaultsDeepSource); +result = _(TestDefaultsDeepObject).defaultsDeep(TestDefaultsDeepSource).value(); + +// _.extend +module TestExtend { + type Obj = {a: string}; + type S1 = {a: number}; + type S2 = {b: number}; + type S3 = {c: number}; + type S4 = {d: number}; + type S5 = {e: number}; + + let obj: Obj; + let s1: S1; + let s2: S2; + let s3: S3; + let s4: S4; + let s5: S5; + + let customizer: (objectValue: any, sourceValue: any, key?: string, object?: {}, source?: {}) => any; + + { + let result: Obj; + + result = _.extend(obj); + } + + { + let result: {a: number}; + + result = _.extend(obj, s1); + result = _.extend(obj, s1, customizer); + result = _.extend(obj, s1, customizer, any); + } + + { + let result: {a: number, b: number}; + + result = _.extend(obj, s1, s2); + result = _.extend(obj, s1, s2, customizer); + result = _.extend(obj, s1, s2, customizer, any); + } + + { + let result: {a: number, b: number, c: number}; + + result = _.extend(obj, s1, s2, s3); + result = _.extend(obj, s1, s2, s3, customizer); + result = _.extend(obj, s1, s2, s3, customizer, any); + } + + { + let result: {a: number, b: number, c: number, d: number}; + + result = _.extend(obj, s1, s2, s3, s4); + result = _.extend(obj, s1, s2, s3, s4, customizer); + result = _.extend(obj, s1, s2, s3, s4, customizer, any); + } + + { + let result: {a: number, b: number, c: number, d: number, e: number}; + + result = _.extend(obj, s1, s2, s3, s4, s5); + result = _.extend(obj, s1, s2, s3, s4, s5, customizer); + result = _.extend(obj, s1, s2, s3, s4, s5, customizer, any); + } + + { + let result: _.LoDashImplicitObjectWrapper; + + result = _(obj).extend(); + } + + { + let result: _.LoDashImplicitObjectWrapper<{a: number}>; + + result = _(obj).extend(s1); + result = _(obj).extend(s1, customizer); + result = _(obj).extend(s1, customizer, any); + } + + { + let result: _.LoDashImplicitObjectWrapper<{a: number, b: number}>; + + result = _(obj).extend(s1, s2); + result = _(obj).extend(s1, s2, customizer); + result = _(obj).extend(s1, s2, customizer, any); + } + + { + let result: _.LoDashImplicitObjectWrapper<{a: number, b: number, c: number}>; + + result = _(obj).extend(s1, s2, s3); + result = _(obj).extend(s1, s2, s3, customizer); + result = _(obj).extend(s1, s2, s3, customizer, any); + } + + { + let result: _.LoDashImplicitObjectWrapper<{a: number, b: number, c: number, d: number}>; + + result = _(obj).extend(s1, s2, s3, s4); + result = _(obj).extend(s1, s2, s3, s4, customizer); + result = _(obj).extend(s1, s2, s3, s4, customizer, any); + } + + { + let result: _.LoDashImplicitObjectWrapper<{a: number, b: number, c: number, d: number, e: number}>; + + result = _(obj).extend(s1, s2, s3, s4, s5); + result = _(obj).extend(s1, s2, s3, s4, s5, customizer); + result = _(obj).extend(s1, s2, s3, s4, s5, customizer, any); + } + + { + let result: _.LoDashExplicitObjectWrapper; + + result = _(obj).chain().extend(); + } + + { + let result: _.LoDashExplicitObjectWrapper<{a: number}>; + + result = _(obj).chain().extend(s1); + result = _(obj).chain().extend(s1, customizer); + result = _(obj).chain().extend(s1, customizer, any); + } + + { + let result: _.LoDashExplicitObjectWrapper<{a: number, b: number}>; + + result = _(obj).chain().extend(s1, s2); + result = _(obj).chain().extend(s1, s2, customizer); + result = _(obj).chain().extend(s1, s2, customizer, any); + } + + { + let result: _.LoDashExplicitObjectWrapper<{a: number, b: number, c: number}>; + + result = _(obj).chain().extend(s1, s2, s3); + result = _(obj).chain().extend(s1, s2, s3, customizer); + result = _(obj).chain().extend(s1, s2, s3, customizer, any); + } + + { + let result: _.LoDashExplicitObjectWrapper<{a: number, b: number, c: number, d: number}>; + + result = _(obj).chain().extend(s1, s2, s3, s4); + result = _(obj).chain().extend(s1, s2, s3, s4, customizer); + result = _(obj).chain().extend(s1, s2, s3, s4, customizer, any); + } + + { + let result: _.LoDashExplicitObjectWrapper<{a: number, b: number, c: number, d: number, e: number}>; + + result = _(obj).chain().extend(s1, s2, s3, s4, s5); + result = _(obj).chain().extend(s1, s2, s3, s4, s5, customizer); + result = _(obj).chain().extend(s1, s2, s3, s4, s5, customizer, any); + } +} + +// _.findKey +module TestFindKey { + { + let predicateFn: (value: any, key?: string, object?: {}) => boolean; + let result: string; + + result = _.findKey<{a: string;}>({a: ''}); + + result = _.findKey<{a: string;}>({a: ''}, predicateFn); + result = _.findKey<{a: string;}>({a: ''}, predicateFn, any); + + + result = _.findKey<{a: string;}>({a: ''}, ''); + result = _.findKey<{a: string;}>({a: ''}, '', any); + + result = _.findKey<{a: number;}, {a: string;}>({a: ''}, {a: 42}); + + result = _<{a: string;}>({a: ''}).findKey(); + + result = _<{a: string;}>({a: ''}).findKey(predicateFn); + result = _<{a: string;}>({a: ''}).findKey(predicateFn, any); + + + result = _<{a: string;}>({a: ''}).findKey(''); + result = _<{a: string;}>({a: ''}).findKey('', any); + + result = _<{a: string;}>({a: ''}).findKey<{a: number;}>({a: 42}); + } + + { + let predicateFn: (value: string, key?: string, collection?: _.Dictionary) => boolean; + let result: string; + + result = _.findKey({a: ''}, predicateFn); + result = _.findKey({a: ''}, predicateFn, any); + + result = _<{a: string;}>({a: ''}).findKey(predicateFn); + result = _<{a: string;}>({a: ''}).findKey(predicateFn, any); + } + + { + let predicateFn: (value: any, key?: string, object?: {}) => boolean; + let result: _.LoDashExplicitWrapper; + + result = _<{a: string;}>({a: ''}).chain().findKey(); + + result = _<{a: string;}>({a: ''}).chain().findKey(predicateFn); + result = _<{a: string;}>({a: ''}).chain().findKey(predicateFn, any); + + + result = _<{a: string;}>({a: ''}).chain().findKey(''); + result = _<{a: string;}>({a: ''}).chain().findKey('', any); + + result = _<{a: string;}>({a: ''}).chain().findKey<{a: number;}>({a: 42}); + } + + { + let predicateFn: (value: string, key?: string, collection?: _.Dictionary) => boolean; + let result: _.LoDashExplicitWrapper; + + result = _<{a: string;}>({a: ''}).chain().findKey(predicateFn); + result = _<{a: string;}>({a: ''}).chain().findKey(predicateFn, any); + } +} + +// _.findLastKey +module TestFindLastKey { + { + let predicateFn: (value: any, key?: string, object?: {}) => boolean; + let result: string; + + result = _.findLastKey<{a: string;}>({a: ''}); + + result = _.findLastKey<{a: string;}>({a: ''}, predicateFn); + result = _.findLastKey<{a: string;}>({a: ''}, predicateFn, any); + + + result = _.findLastKey<{a: string;}>({a: ''}, ''); + result = _.findLastKey<{a: string;}>({a: ''}, '', any); + + result = _.findLastKey<{a: number;}, {a: string;}>({a: ''}, {a: 42}); + + result = _<{a: string;}>({a: ''}).findLastKey(); + + result = _<{a: string;}>({a: ''}).findLastKey(predicateFn); + result = _<{a: string;}>({a: ''}).findLastKey(predicateFn, any); + + + result = _<{a: string;}>({a: ''}).findLastKey(''); + result = _<{a: string;}>({a: ''}).findLastKey('', any); + + result = _<{a: string;}>({a: ''}).findLastKey<{a: number;}>({a: 42}); + } + + { + let predicateFn: (value: string, key?: string, collection?: _.Dictionary) => boolean; + let result: string; + + result = _.findLastKey({a: ''}, predicateFn); + result = _.findLastKey({a: ''}, predicateFn, any); + + result = _<{a: string;}>({a: ''}).findLastKey(predicateFn); + result = _<{a: string;}>({a: ''}).findLastKey(predicateFn, any); + } + + { + let predicateFn: (value: any, key?: string, object?: {}) => boolean; + let result: _.LoDashExplicitWrapper; + + result = _<{a: string;}>({a: ''}).chain().findLastKey(); + + result = _<{a: string;}>({a: ''}).chain().findLastKey(predicateFn); + result = _<{a: string;}>({a: ''}).chain().findLastKey(predicateFn, any); + + + result = _<{a: string;}>({a: ''}).chain().findLastKey(''); + result = _<{a: string;}>({a: ''}).chain().findLastKey('', any); + + result = _<{a: string;}>({a: ''}).chain().findLastKey<{a: number;}>({a: 42}); + } + + { + let predicateFn: (value: string, key?: string, collection?: _.Dictionary) => boolean; + let result: _.LoDashExplicitWrapper; + + result = _<{a: string;}>({a: ''}).chain().findLastKey(predicateFn); + result = _<{a: string;}>({a: ''}).chain().findLastKey(predicateFn, any); + } +} + +// _.forIn +module TestForIn { + type SampleObject = {a: number; b: string; c: boolean;}; + + let dictionary: _.Dictionary; + let dictionaryIterator: (value: number, key: string, collection: _.Dictionary) => any; + + let object: SampleObject; + let objectIterator: (element: any, key?: string, collection?: any) => any; + + { + let result: _.Dictionary; + + result = _.forIn(dictionary); + result = _.forIn(dictionary, dictionaryIterator); + result = _.forIn(dictionary, dictionaryIterator, any); + } + + { + let result: SampleObject; + + result = _.forIn(object); + result = _.forIn(object, objectIterator); + result = _.forIn(object, objectIterator, any); + } + + { + let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; + + result = _(dictionary).forIn(); + result = _(dictionary).forIn(dictionaryIterator); + result = _(dictionary).forIn(dictionaryIterator, any); + } + + { + let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; + + result = _(dictionary).chain().forIn(); + result = _(dictionary).chain().forIn(dictionaryIterator); + result = _(dictionary).chain().forIn(dictionaryIterator, any); + } +} + +// _.forInRight +module TestForInRight { + type SampleObject = {a: number; b: string; c: boolean;}; + + let dictionary: _.Dictionary; + let dictionaryIterator: (value: number, key: string, collection: _.Dictionary) => any; + + let object: SampleObject; + let objectIterator: (element: any, key?: string, collection?: any) => any; + + { + let result: _.Dictionary; + + result = _.forInRight(dictionary); + result = _.forInRight(dictionary, dictionaryIterator); + result = _.forInRight(dictionary, dictionaryIterator, any); + } + + { + let result: SampleObject; + + result = _.forInRight(object); + result = _.forInRight(object, objectIterator); + result = _.forInRight(object, objectIterator, any); + } + + { + let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; + + result = _(dictionary).forInRight(); + result = _(dictionary).forInRight(dictionaryIterator); + result = _(dictionary).forInRight(dictionaryIterator, any); + } + + { + let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; + + result = _(dictionary).chain().forInRight(); + result = _(dictionary).chain().forInRight(dictionaryIterator); + result = _(dictionary).chain().forInRight(dictionaryIterator, any); + } +} + +// _.forOwn +module TestForOwn { + type SampleObject = {a: number; b: string; c: boolean;}; + + let dictionary: _.Dictionary; + let dictionaryIterator: (value: number, key: string, collection: _.Dictionary) => any; + + let object: SampleObject; + let objectIterator: (element: any, key?: string, collection?: any) => any; + + { + let result: _.Dictionary; + + result = _.forOwn(dictionary); + result = _.forOwn(dictionary, dictionaryIterator); + result = _.forOwn(dictionary, dictionaryIterator, any); + } + + { + let result: SampleObject; + + result = _.forOwn(object); + result = _.forOwn(object, objectIterator); + result = _.forOwn(object, objectIterator, any); + } + + { + let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; + + result = _(dictionary).forOwn(); + result = _(dictionary).forOwn(dictionaryIterator); + result = _(dictionary).forOwn(dictionaryIterator, any); + } + + { + let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; + + result = _(dictionary).chain().forOwn(); + result = _(dictionary).chain().forOwn(dictionaryIterator); + result = _(dictionary).chain().forOwn(dictionaryIterator, any); + } +} + +// _.forOwnRight +module TestForOwnRight { + type SampleObject = {a: number; b: string; c: boolean;}; + + let dictionary: _.Dictionary; + let dictionaryIterator: (value: number, key: string, collection: _.Dictionary) => any; + + let object: SampleObject; + let objectIterator: (element: any, key?: string, collection?: any) => any; + + { + let result: _.Dictionary; + + result = _.forOwnRight(dictionary); + result = _.forOwnRight(dictionary, dictionaryIterator); + result = _.forOwnRight(dictionary, dictionaryIterator, any); + } + + { + let result: SampleObject; + + result = _.forOwnRight(object); + result = _.forOwnRight(object, objectIterator); + result = _.forOwnRight(object, objectIterator, any); + } + + { + let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; + + result = _(dictionary).forOwnRight(); + result = _(dictionary).forOwnRight(dictionaryIterator); + result = _(dictionary).forOwnRight(dictionaryIterator, any); + } + + { + let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; + + result = _(dictionary).chain().forOwnRight(); + result = _(dictionary).chain().forOwnRight(dictionaryIterator); + result = _(dictionary).chain().forOwnRight(dictionaryIterator, any); + } +} + +// _.functions +module TestFunctions { + type SampleObject = {a: number; b: string; c: boolean;}; + + let object: SampleObject; + + { + let result: string[]; + + result = _.functions(object); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(object).functions(); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(object).chain().functions(); + } +} + +// _.get +result = _.get({ 'a': [{ 'b': { 'c': 3 } }] }, 'a[0].b.c'); + +{ + let result: TResult; + result = _.get({}, ''); + result = _.get({}, 42); + result = _.get({}, true); + result = _.get({}, ['', 42, true]); + result = _({}).get(''); + result = _({}).get(42); + result = _({}).get(true); + result = _({}).get(['', 42, true]); +} + +// _.has +module TestHas { + type SampleObject = {a: number; b: string; c: boolean;}; + + let object: SampleObject; + + { + let result: boolean; + + result = _.has(object, ''); + result = _.has(object, 42); + result = _.has(object, true); + result = _.has(object, ['', 42, true]); + + result = _(object).has(''); + result = _(object).has(42); + result = _(object).has(true); + result = _(object).has(['', 42, true]); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(object).chain().has(''); + result = _(object).chain().has(42); + result = _(object).chain().has(true); + result = _(object).chain().has(['', 42, true]); + } +} + +// _.invert +module TestInvert { + { + let result: TResult; + + result = _.invert({}); + result = _.invert({}, true); + + result = _.invert({}); + result = _.invert({}, true); + } + + { + let result: _.LoDashImplicitObjectWrapper; + + result = _({}).invert(); + result = _({}).invert(true); + } + + { + let result: _.LoDashExplicitObjectWrapper; + + result = _({}).chain().invert(); + result = _({}).chain().invert(true); + } +} + +// _.keys +module TestKeys { + let object: _.Dictionary; + + { + let result: string[]; + + result = _.keys(object); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(object).keys(); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(object).chain().keys(); + } +} + +// _.keysIn +module TestKeysIn { + let object: _.Dictionary; + + { + let result: string[]; + + result = _.keysIn(object); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(object).keysIn(); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(object).chain().keysIn(); + } +} + +// _.mapKeys +module TestMapKeys { + let array: TResult[]; + let list: _.List; + let dictionary: _.Dictionary; + + let listIterator: (value: TResult, index: number, collection: _.List) => string; + let dictionaryIterator: (value: TResult, key: string, collection: _.Dictionary) => string; + + { + let result: _.Dictionary; + + result = _.mapKeys(array); + result = _.mapKeys(array, listIterator); + result = _.mapKeys(array, listIterator, any); + result = _.mapKeys(array, ''); + result = _.mapKeys(array, '', any); + result = _.mapKeys(array, {}); + + result = _.mapKeys(list); + result = _.mapKeys(list, listIterator); + result = _.mapKeys(list, listIterator, any); + result = _.mapKeys(list, ''); + result = _.mapKeys(list, '', any); + result = _.mapKeys(list, {}); + + result = _.mapKeys(dictionary); + result = _.mapKeys(dictionary, dictionaryIterator); + result = _.mapKeys(dictionary, dictionaryIterator, any); + result = _.mapKeys(dictionary, ''); + result = _.mapKeys(dictionary, '', any); + result = _.mapKeys(dictionary, {}); + } + + { + let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; + + result = _(array).mapKeys(); + result = _(array).mapKeys(listIterator); + result = _(array).mapKeys(listIterator, any); + result = _(array).mapKeys(''); + result = _(array).mapKeys('', any); + result = _(array).mapKeys<{}>({}); + + result = _(list).mapKeys(); + result = _(list).mapKeys(listIterator); + result = _(list).mapKeys(listIterator, any); + result = _(list).mapKeys(''); + result = _(list).mapKeys('', any); + result = _(list).mapKeys({}); + + result = _(dictionary).mapKeys(); + result = _(dictionary).mapKeys(dictionaryIterator); + result = _(dictionary).mapKeys(dictionaryIterator, any); + result = _(dictionary).mapKeys(''); + result = _(dictionary).mapKeys('', any); + result = _(dictionary).mapKeys({}); + } + + { + let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; + + result = _(array).chain().mapKeys(); + result = _(array).chain().mapKeys(listIterator); + result = _(array).chain().mapKeys(listIterator, any); + result = _(array).chain().mapKeys(''); + result = _(array).chain().mapKeys('', any); + result = _(array).chain().mapKeys<{}>({}); + + result = _(list).chain().mapKeys(); + result = _(list).chain().mapKeys(listIterator); + result = _(list).chain().mapKeys(listIterator, any); + result = _(list).chain().mapKeys(''); + result = _(list).chain().mapKeys('', any); + result = _(list).chain().mapKeys({}); + + result = _(dictionary).chain().mapKeys(); + result = _(dictionary).chain().mapKeys(dictionaryIterator); + result = _(dictionary).chain().mapKeys(dictionaryIterator, any); + result = _(dictionary).chain().mapKeys(''); + result = _(dictionary).chain().mapKeys('', any); + result = _(dictionary).chain().mapKeys({}); + } +} + +// _.merge +module TestMerge { + type InitialValue = { a : number }; + type MergingValue = { b : string }; + + var initialValue = { a : 1 }; + var mergingValue = { b : "hi" }; + + type ExpectedResult = { a: number, b: string }; + let result: ExpectedResult; + + let customizer: (value: any, srcValue: any, key?: string, object?: InitialValue, source?: MergingValue) => any; + + // Test for basic merging + + result = _.merge(initialValue, mergingValue); + result = _.merge(initialValue, mergingValue, customizer); + result = _.merge(initialValue, mergingValue, customizer, any); + + result = _.merge(initialValue, {}, mergingValue); + result = _.merge(initialValue, {}, mergingValue, customizer); + result = _.merge(initialValue, {}, mergingValue, customizer, any); + + result = _.merge(initialValue, {}, {}, mergingValue); + result = _.merge(initialValue, {}, {}, mergingValue, customizer); + result = _.merge(initialValue, {}, {}, mergingValue, customizer, any); + + result = _.merge(initialValue, {}, {}, {}, mergingValue); + result = _.merge(initialValue, {}, {}, {}, mergingValue, customizer); + result = _.merge(initialValue, {}, {}, {}, mergingValue, customizer, any); + + // Once we get to the varargs version, you have to specify the result explicitly + result = _.merge(initialValue, {}, {}, {}, {}, mergingValue); + result = _.merge(initialValue, {}, {}, {}, {}, mergingValue, customizer); + result = _.merge(initialValue, {}, {}, {}, {}, mergingValue, customizer, any); + + // Test for multiple combinations of many types + + type ComplicatedExpectedType = { a: number, b: string, c: {}, d: number[], e: boolean }; + + var complicatedResult: ComplicatedExpectedType = _.merge({ a: 1 }, + { b: "string" }, + { c: {} }, + { d: [1] }, + { e: true }); + // Test for type overriding + + type ExpectedTypeAfterOverriding = { a: boolean }; + + var overriddenResult: ExpectedTypeAfterOverriding = _.merge({ a: 1 }, + { a: "string" }, + { a: {} }, + { a: [1] }, + { a: true }); + + // Tests for basic chaining with merge + + result = _(initialValue).merge(mergingValue).value(); + result = _(initialValue).merge(mergingValue, customizer).value(); + result = _(initialValue).merge(mergingValue, customizer, any).value(); + + result = _(initialValue).merge({}, mergingValue).value(); + result = _(initialValue).merge({}, mergingValue, customizer).value(); + result = _(initialValue).merge({}, mergingValue, customizer, any).value(); + + result = _(initialValue).merge({}, {}, mergingValue).value(); + result = _(initialValue).merge({}, {}, mergingValue, customizer).value(); + result = _(initialValue).merge({}, {}, mergingValue, customizer, any).value(); + + result = _(initialValue).merge({}, {}, {}, mergingValue).value(); + result = _(initialValue).merge({}, {}, {}, mergingValue, customizer).value(); + result = _(initialValue).merge({}, {}, {}, mergingValue, customizer, any).value(); + + // Once we get to the varargs version, you have to specify the result explicitly + result = _(initialValue).merge({}, {}, {}, {}, mergingValue).value(); + result = _(initialValue).merge({}, {}, {}, {}, mergingValue, customizer).value(); + result = _(initialValue).merge({}, {}, {}, {}, mergingValue, customizer, any).value(); + + // Test complex multiple combinations with chaining + + var complicatedResult: ComplicatedExpectedType = _({ a: 1 }).merge({ b: "string" }, + { c: {} }, + { d: [1] }, + { e: true }).value(); + + // Test for type overriding with chaining + + var overriddenResult: ExpectedTypeAfterOverriding = _({ a: 1 }).merge({ a: "string" }, + { a: {} }, + { a: [1] }, + { a: true }).value(); + +} + +// _.methods +module TestFunctions { + type SampleObject = {a: number; b: string; c: boolean;}; + + let object: SampleObject; + + { + let result: string[]; + + result = _.methods(object); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(object).methods(); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(object).chain().methods(); + } +} + +// _.omit +module TestOmit { + let predicate: (element: any, key: string, collection: any) => boolean; + + { + let result: TResult; + + result = _.omit({}, 'a'); + result = _.omit({}, 0, 'a'); + result = _.omit({}, true, 0, 'a'); + result = _.omit({}, ['b', 1, false], true, 0, 'a'); + result = _.omit({}, predicate); + result = _.omit({}, predicate, any); + } + + { + let result: _.LoDashImplicitObjectWrapper; + + result = _({}).omit('a'); + result = _({}).omit(0, 'a'); + result = _({}).omit(true, 0, 'a'); + result = _({}).omit(['b', 1, false], true, 0, 'a'); + result = _({}).omit(predicate); + result = _({}).omit(predicate, any); + } + + { + let result: _.LoDashExplicitObjectWrapper; + + result = _({}).chain().omit('a'); + result = _({}).chain().omit(0, 'a'); + result = _({}).chain().omit(true, 0, 'a'); + result = _({}).chain().omit(['b', 1, false], true, 0, 'a'); + result = _({}).chain().omit(predicate); + result = _({}).chain().omit(predicate, any); + } +} + +// _.pairs +module TestPairs { + let object: _.Dictionary; + + { + let result: any[][]; + + result = _.pairs<_.Dictionary>(object); + } + + { + let result: string[][]; + + result = _.pairs<_.Dictionary, string>(object); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(object).pairs(); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(object).pairs(); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(object).chain().pairs(); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(object).chain().pairs(); + } +} + +// _.pick +module TestPick { + let predicate: (element: any, key: string, collection: any) => boolean; + + { + let result: TResult; + + result = _.pick({}, 'a'); + result = _.pick({}, 0, 'a'); + result = _.pick({}, true, 0, 'a'); + result = _.pick({}, ['b', 1, false], true, 0, 'a'); + result = _.pick({}, predicate); + result = _.pick({}, predicate, any); + } + + { + let result: _.LoDashImplicitObjectWrapper; + + result = _({}).pick('a'); + result = _({}).pick(0, 'a'); + result = _({}).pick(true, 0, 'a'); + result = _({}).pick(['b', 1, false], true, 0, 'a'); + result = _({}).pick(predicate); + result = _({}).pick(predicate, any); + } + + { + let result: _.LoDashExplicitObjectWrapper; + + result = _({}).chain().pick('a'); + result = _({}).chain().pick(0, 'a'); + result = _({}).chain().pick(true, 0, 'a'); + result = _({}).chain().pick(['b', 1, false], true, 0, 'a'); + result = _({}).chain().pick(predicate); + result = _({}).chain().pick(predicate, any); + } +} + +// _.result +{ + let testResultPath: number|string|boolean|Array; + let testResultDefaultValue: TResult; + let result: TResult; + result = _.result<{}, TResult>({}, testResultPath); + result = _.result<{}, TResult>({}, testResultPath, testResultDefaultValue); + result = _({}).result(testResultPath); + result = _({}).result(testResultPath, testResultDefaultValue); +} + +// _.set +module TestSet { + type SampleValue = {a: number; b: string; c: boolean;}; + + let object: TResult; + let value = {a: 1, b: '', c: true}; + + { + let result: TResult; + + result = _.set(object, '', any); + result = _.set(object, ['a', 'b', 1], any); + + result = _.set(object, '', value); + result = _.set(object, ['a', 'b', 1], value); + } + + { + let result: _.LoDashImplicitObjectWrapper; + + result = _(object).set('', any); + result = _(object).set(['a', 'b', 1], any); + + result = _(object).set('', value); + result = _(object).set(['a', 'b', 1], value); + } + + { + let result: _.LoDashExplicitObjectWrapper; + + result = _(object).chain().set('', any); + result = _(object).chain().set(['a', 'b', 1], any); + + result = _(object).chain().set('', value); + result = _(object).chain().set(['a', 'b', 1], value); + } +} + +// _.transform +module TestTransform { + let array: number[]; + let dictionary: _.Dictionary; + + { + let iterator: (acc: TResult[], curr: number, index?: number, arr?: number[]) => void; + let accumulator: TResult[]; + let result: TResult[]; + + result = _.transform(array); + result = _.transform(array, iterator); + result = _.transform(array, iterator, accumulator); + result = _.transform(array, iterator, accumulator, any); + + result = _(array).transform().value(); + result = _(array).transform(iterator).value(); + result = _(array).transform(iterator, accumulator).value(); + result = _(array).transform(iterator, accumulator, any).value(); + } + + { + let iterator: (acc: _.Dictionary, curr: number, index?: number, arr?: number[]) => void; + let accumulator: _.Dictionary; + let result: _.Dictionary; + + result = _.transform(array, iterator); + result = _.transform(array, iterator, accumulator); + result = _.transform(array, iterator, accumulator, any); + + result = _(array).transform(iterator).value(); + result = _(array).transform(iterator, accumulator).value(); + result = _(array).transform(iterator, accumulator, any).value(); + } + + { + let iterator: (acc: _.Dictionary, curr: number, key?: string, dict?: _.Dictionary) => void; + let accumulator: _.Dictionary; + let result: _.Dictionary; + + result = _.transform(dictionary); + result = _.transform(dictionary, iterator); + result = _.transform(dictionary, iterator, accumulator); + result = _.transform(dictionary, iterator, accumulator, any); + + result = _(dictionary).transform().value(); + result = _(dictionary).transform(iterator).value(); + result = _(dictionary).transform(iterator, accumulator).value(); + result = _(dictionary).transform(iterator, accumulator, any).value(); + } + + { + let iterator: (acc: TResult[], curr: number, key?: string, dict?: _.Dictionary) => void; + let accumulator: TResult[]; + let result: TResult[]; + + result = _.transform(dictionary, iterator); + result = _.transform(dictionary, iterator, accumulator); + result = _.transform(dictionary, iterator, accumulator, any); + + result = _(dictionary).transform(iterator).value(); + result = _(dictionary).transform(iterator, accumulator).value(); + result = _(dictionary).transform(iterator, accumulator, any).value(); + } +} + +// _.values +module TestValues { + let object: _.Dictionary; + + { + let result: TResult[]; + + result = _.values(object); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(object).values(); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(object).chain().values(); + } +} + +// _.valuesIn +module TestValuesIn { + let object: _.Dictionary; + + { + let result: TResult[]; + + result = _.valuesIn(object); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(object).valuesIn(); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(object).chain().valuesIn(); + } +} + +/********** + * String * + **********/ + +// _.camelCase +module TestCamelCase { + { + let result: string; + + result = _.camelCase('Foo Bar'); + result = _('Foo Bar').camelCase(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _('Foo Bar').chain().camelCase(); + } +} + +// _.capitalize +module TestCapitalize { + { + let result: string; + + result = _.capitalize('fred'); + result = _('fred').capitalize(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _('fred').chain().capitalize(); + } +} + +// _.deburr +module TestDeburr { + { + let result: string; + + result = _.deburr('déjà vu'); + result = _('déjà vu').deburr(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _('déjà vu').chain().deburr(); + } +} + +// _.endsWith +module TestEndsWith { + { + let result: boolean; + + result = _.endsWith('abc', 'c'); + result = _.endsWith('abc', 'c', 1); + + result = _('abc').endsWith('c'); + result = _('abc').endsWith('c', 1); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _('abc').chain().endsWith('c'); + result = _('abc').chain().endsWith('c', 1); + } +} + +// _.escape +module TestEscape { + { + let result: string; + + result = _.escape('fred, barney, & pebbles'); + result = _('fred, barney, & pebbles').escape(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _('fred, barney, & pebbles').chain().escape(); + } +} + +// _.escapeRegExp +module TestEscapeRegExp { + { + let result: string; + + result = _.escapeRegExp('[lodash](https://lodash.com/)'); + result = _('[lodash](https://lodash.com/)').escapeRegExp(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _('[lodash](https://lodash.com/)').chain().escapeRegExp(); + } +} + +// _.kebabCase +module TestKebabCase { + { + let result: string; + + result = _.kebabCase('Foo Bar'); + result = _('Foo Bar').kebabCase(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _('Foo Bar').chain().kebabCase(); + } +} + +// _.pad +module TestPad { + { + let result: string; + + result = _.pad('abd'); + result = _.pad('abc', 8); + result = _.pad('abc', 8, '_-'); + + result = _('abc').pad(); + result = _('abc').pad(8); + result = _('abc').pad(8, '_-'); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _('abc').chain().pad(); + result = _('abc').chain().pad(8); + result = _('abc').chain().pad(8, '_-'); + } +} + +// _.padLeft +module TestPadLeft { + { + let result: string; + + result = _.padLeft('abc'); + result = _.padLeft('abc', 6); + result = _.padLeft('abc', 6, '_-'); + + result = _('abc').padLeft(); + result = _('abc').padLeft(6); + result = _('abc').padLeft(6, '_-'); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _('abc').chain().padLeft(); + result = _('abc').chain().padLeft(6); + result = _('abc').chain().padLeft(6, '_-'); + } +} + +// _.padRight +module TestPadRight { + { + let result: string; + + result = _.padRight('abc'); + result = _.padRight('abc', 6); + result = _.padRight('abc', 6, '_-'); + + result = _('abc').padRight(); + result = _('abc').padRight(6); + result = _('abc').padRight(6, '_-'); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _('abc').chain().padRight(); + result = _('abc').chain().padRight(6); + result = _('abc').chain().padRight(6, '_-'); + } +} + + +// _.parseInt +module TestParseInt { + { + let result: number; + + result = _.parseInt('08'); + result = _.parseInt('08', 10); + + result = _('08').parseInt(); + result = _('08').parseInt(10); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _('08').chain().parseInt(); + result = _('08').chain().parseInt(10); + } +} + +// _.repeat +module TestRepeat { + { + let result: string; + result = _.repeat('*'); + result = _.repeat('*', 3); + + result = _('*').repeat(); + result = _('*').repeat(3); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _('*').chain().repeat(); + result = _('*').chain().repeat(3); + } +} + +// _.snakeCase +module TestSnakeCase { + { + let result: string; + + result = _.snakeCase('Foo Bar'); + result = _('Foo Bar').snakeCase(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _('Foo Bar').chain().snakeCase(); + } +} + +// _.startCase +module TestStartCase { + { + let result: string; + + result = _.startCase('--foo-bar'); + result = _('--foo-bar').startCase(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _('--foo-bar').chain().startCase(); + } +} + +// _.startsWith +module TestStartsWith { + { + let result: boolean; + + result = _.startsWith('abc', 'a'); + result = _.startsWith('abc', 'a', 1); + + result = _('abc').startsWith('a'); + result = _('abc').startsWith('a', 1); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _('abc').chain().startsWith('a'); + result = _('abc').chain().startsWith('a', 1); + } +} + +// _.template +module TestTemplate { + interface TemplateExecutor { + (obj?: Object): string; + source: string; + } + + let options: { + escape?: RegExp; + evaluate?: RegExp; + imports?: _.Dictionary; + interpolate?: RegExp; + sourceURL?: string; + variable?: string; + }; + + { + let result: TemplateExecutor; + + result = _.template(''); + result = _.template('', options); + + result = _('').template(); + result = _('').template(options); + } + + { + let result: _.LoDashExplicitObjectWrapper; + + result = _('').chain().template(); + result = _('').chain().template(options); + } +} + +// _.trim +module TestTrim { + { + let result: string; + + result = _.trim(); + result = _.trim(' abc '); + result = _.trim('-_-abc-_-', '_-'); + + result = _('-_-abc-_-').trim(); + result = _('-_-abc-_-').trim('_-'); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _('-_-abc-_-').chain().trim(); + result = _('-_-abc-_-').chain().trim('_-'); + } +} + +// _.trimLeft +module TestTrimLeft { + { + let result: string; + + result = _.trimLeft(); + result = _.trimLeft(' abc '); + result = _.trimLeft('-_-abc-_-', '_-'); + + result = _('-_-abc-_-').trimLeft(); + result = _('-_-abc-_-').trimLeft('_-'); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _('-_-abc-_-').chain().trimLeft(); + result = _('-_-abc-_-').chain().trimLeft('_-'); + } +} + +// _.trimRight + +module TestTrimRight { + { + let result: string; + + result = _.trimRight(); + result = _.trimRight(' abc '); + result = _.trimRight('-_-abc-_-', '_-'); + + result = _('-_-abc-_-').trimRight(); + result = _('-_-abc-_-').trimRight('_-'); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _('-_-abc-_-').chain().trimRight(); + result = _('-_-abc-_-').chain().trimRight('_-'); + } +} + +// _.trunc +module TestTrunc { + { + let result: string; + + result = _.trunc('hi-diddly-ho there, neighborino'); + result = _.trunc('hi-diddly-ho there, neighborino', 24); + result = _.trunc('hi-diddly-ho there, neighborino', { 'length': 24, 'separator': ' ' }); + result = _.trunc('hi-diddly-ho there, neighborino', { 'length': 24, 'separator': /,? +/ }); + result = _.trunc('hi-diddly-ho there, neighborino', { 'omission': ' […]' }); + + result = _('hi-diddly-ho there, neighborino').trunc(); + result = _('hi-diddly-ho there, neighborino').trunc(24); + result = _('hi-diddly-ho there, neighborino').trunc({ 'length': 24, 'separator': ' ' }); + result = _('hi-diddly-ho there, neighborino').trunc({ 'length': 24, 'separator': /,? +/ }); + result = _('hi-diddly-ho there, neighborino').trunc({ 'omission': ' […]' }); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _('hi-diddly-ho there, neighborino').chain().trunc(); + result = _('hi-diddly-ho there, neighborino').chain().trunc(24); + result = _('hi-diddly-ho there, neighborino').chain().trunc({ 'length': 24, 'separator': ' ' }); + result = _('hi-diddly-ho there, neighborino').chain().trunc({ 'length': 24, 'separator': /,? +/ }); + result = _('hi-diddly-ho there, neighborino').chain().trunc({ 'omission': ' […]' }); + } +} + +// _.unescape +module TestUnescape { + { + let result: string; + + result = _.unescape('fred, barney, & pebbles'); + result = _('fred, barney, & pebbles').unescape(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _('fred, barney, & pebbles').chain().unescape(); + } +} + +// _.words +module TestWords { + { + let result: string[]; + + result = _.words('fred, barney, & pebbles'); + result = _.words('fred, barney, & pebbles', /[^, ]+/g); + + result = _('fred, barney, & pebbles').words(); + result = _('fred, barney, & pebbles').words(/[^, ]+/g); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _('fred, barney, & pebbles').chain().words(); + result = _('fred, barney, & pebbles').chain().words(/[^, ]+/g); + } +} + +/*********** + * Utility * + ***********/ + +// _.attempt +module TestAttempt { + let func: (...args: any[]) => {a: string}; + + { + let result: {a: string}|Error; + + result = _.attempt<{a: string}>(func); + result = _(func).attempt<{a: string}>(); + } + + { + let result: _.LoDashExplicitObjectWrapper<{a: string}|Error>; + + result = _(func).chain().attempt<{a: string}>(); + } +} + +// _.callback +module TestCallback { + { + let result: (...args: any[]) => TResult; + + result = _.callback(Function); + result = _.callback(Function, any); + } + + { + let result: (object: any) => TResult; + + result = _.callback(''); + result = _.callback('', any); + } + + { + let result: (object: any) => boolean; + + result = _.callback({}); + result = _.callback({}, any); + } + + { + let result: _.LoDashImplicitObjectWrapper<(...args: any[]) => TResult>; + + result = _(Function).callback(); + result = _(Function).callback(any); + } + + { + let result: _.LoDashImplicitObjectWrapper<(object: any) => TResult>; + + result = _('').callback(); + result = _('').callback(any); + } + + { + let result: _.LoDashImplicitObjectWrapper<(object: any) => boolean>; + + result = _({}).callback(); + result = _({}).callback(any); + } + + { + let result: _.LoDashExplicitObjectWrapper<(...args: any[]) => TResult>; + + result = _(Function).chain().callback(); + result = _(Function).chain().callback(any); + } + + { + let result: _.LoDashExplicitObjectWrapper<(object: any) => TResult>; + + result = _('').chain().callback(); + result = _('').chain().callback(any); + } + + { + let result: _.LoDashExplicitObjectWrapper<(object: any) => boolean>; + + result = _({}).chain().callback(); + result = _({}).chain().callback(any); + } +} + +// _.constant +module TestConstant { + { + let result: () => number; + result: _.constant(42); + } + + { + let result: () => string; + result: _.constant('a'); + } + + { + let result: () => boolean; + result: _.constant(true); + } + + { + let result: () => string[]; + result: _.constant(['a']); + } + + { + let result: () => {a: string}; + result: _.constant<{a: string}>({a: 'a'}); + } + + { + let result: _.LoDashImplicitObjectWrapper<() => number>; + result: _(42).constant(); + } + + { + let result: _.LoDashImplicitObjectWrapper<() => string>; + result: _('a').constant(); + } + + { + let result: _.LoDashImplicitObjectWrapper<() => boolean>; + result: _(true).constant(); + } + + { + let result: _.LoDashImplicitObjectWrapper<() => string[]>; + result: _(['a']).constant(); + } + + { + let result: _.LoDashImplicitObjectWrapper<() => {a: string}>; + result: _({a: 'a'}).constant<{a: string}>(); + } + + { + let result: _.LoDashExplicitObjectWrapper<() => number>; + result: _(42).chain().constant(); + } + + { + let result: _.LoDashExplicitObjectWrapper<() => string>; + result: _('a').chain().constant(); + } + + { + let result: _.LoDashExplicitObjectWrapper<() => boolean>; + result: _(true).chain().constant(); + } + + { + let result: _.LoDashExplicitObjectWrapper<() => string[]>; + result: _(['a']).chain().constant(); + } + + { + let result: _.LoDashExplicitObjectWrapper<() => {a: string}>; + result: _({a: 'a'}).chain().constant<{a: string}>(); + } +} + +// _.identity +{ + let testIdentityValue: TResult; + let result: TResult; + result = _.identity(testIdentityValue); + result = _(testIdentityValue).identity(); +} +{ + let result: number; + result = _(42).identity(); +} +{ + let result: boolean[]; + result = _([]).identity(); +} + +// _.iteratee +module TestIteratee { + { + let result: (...args: any[]) => TResult; + + result = _.iteratee(Function); + result = _.iteratee(Function, any); + } + + { + let result: (object: any) => TResult; + + result = _.iteratee(''); + result = _.iteratee('', any); + } + + { + let result: (object: any) => boolean; + + result = _.iteratee({}); + result = _.iteratee({}, any); + } + + { + let result: _.LoDashImplicitObjectWrapper<(...args: any[]) => TResult>; + + result = _(Function).iteratee(); + result = _(Function).iteratee(any); + } + + { + let result: _.LoDashImplicitObjectWrapper<(object: any) => TResult>; + + result = _('').iteratee(); + result = _('').iteratee(any); + } + + { + let result: _.LoDashImplicitObjectWrapper<(object: any) => boolean>; + + result = _({}).iteratee(); + result = _({}).iteratee(any); + } + + { + let result: _.LoDashExplicitObjectWrapper<(...args: any[]) => TResult>; + + result = _(Function).chain().iteratee(); + result = _(Function).chain().iteratee(any); + } + + { + let result: _.LoDashExplicitObjectWrapper<(object: any) => TResult>; + + result = _('').chain().iteratee(); + result = _('').chain().iteratee(any); + } + + { + let result: _.LoDashExplicitObjectWrapper<(object: any) => boolean>; + + result = _({}).chain().iteratee(); + result = _({}).chain().iteratee(any); + } +} + +// _.matches +module TestMatches { + let source: TResult; + + { + let result: (value: any) => boolean; + result = _.matches(source); + } + + { + let result: (value: TResult) => boolean; + result = _.matches(source); + } + + { + let result: _.LoDashImplicitObjectWrapper<(value: TResult) => boolean>; + result = _(source).matches(); + } + + { + let result: _.LoDashExplicitObjectWrapper<(value: TResult) => boolean>; + result = _(source).chain().matches(); + } +} + +// _.matchesProperty +module TestMatches { + let path: {toString(): string;}|{toString(): string;}[]; + let source: TResult; + + { + let result: (value: any) => boolean; + + result = _.matchesProperty(path, source); + } + + { + let result: (value: TResult) => boolean; + + result = _.matchesProperty(path, source); + } + + { + let result: _.LoDashImplicitObjectWrapper<(value: any) => boolean>; + + result = _(path).matchesProperty(source); + } + + { + let result: _.LoDashImplicitObjectWrapper<(value: TResult) => boolean>; + + result = _(path).matchesProperty(source); + } + + { + let result: _.LoDashExplicitObjectWrapper<(value: any) => boolean>; + + result = _(path).chain().matchesProperty(source); + } + + { + let result: _.LoDashExplicitObjectWrapper<(value: TResult) => boolean>; + + result = _(path).chain().matchesProperty(source); + } +} + +// _.method +module TestMethod { + { + let result: (object: any) => {a: string}; + + result = _.method<{a: string}>('a.0'); + result = _.method<{a: string}>('a.0', any); + result = _.method<{a: string}>('a.0', any, any); + result = _.method<{a: string}>('a.0', any, any, any); + + result = _.method<{a: string}>(['a', 0]); + result = _.method<{a: string}>(['a', 0], any); + result = _.method<{a: string}>(['a', 0], any, any); + result = _.method<{a: string}>(['a', 0], any, any, any); + } + + { + let result: (object: {a: string}) => {b: string}; + + result = _.method<{a: string}, {b: string}>('a.0'); + result = _.method<{a: string}, {b: string}>('a.0', any); + result = _.method<{a: string}, {b: string}>('a.0', any, any); + result = _.method<{a: string}, {b: string}>('a.0', any, any, any); + + result = _.method<{a: string}, {b: string}>(['a', 0]); + result = _.method<{a: string}, {b: string}>(['a', 0], any); + result = _.method<{a: string}, {b: string}>(['a', 0], any, any); + result = _.method<{a: string}, {b: string}>(['a', 0], any, any, any); + } + + { + let result: _.LoDashImplicitObjectWrapper<(object: any) => {a: string}>; + + result = _('a.0').method<{a: string}>(); + result = _('a.0').method<{a: string}>(any); + result = _('a.0').method<{a: string}>(any, any); + result = _('a.0').method<{a: string}>(any, any, any); + + result = _(['a', 0]).method<{a: string}>(); + result = _(['a', 0]).method<{a: string}>(any); + result = _(['a', 0]).method<{a: string}>(any, any); + result = _(['a', 0]).method<{a: string}>(any, any, any); + } + + { + let result: _.LoDashImplicitObjectWrapper<(object: {a: string}) => {b: string}>; + + result = _('a.0').method<{a: string}, {b: string}>(); + result = _('a.0').method<{a: string}, {b: string}>(any); + result = _('a.0').method<{a: string}, {b: string}>(any, any); + result = _('a.0').method<{a: string}, {b: string}>(any, any, any); + + result = _(['a', 0]).method<{a: string}, {b: string}>(); + result = _(['a', 0]).method<{a: string}, {b: string}>(any); + result = _(['a', 0]).method<{a: string}, {b: string}>(any, any); + result = _(['a', 0]).method<{a: string}, {b: string}>(any, any, any); + } + + { + let result: _.LoDashExplicitObjectWrapper<(object: any) => {a: string}>; + + result = _('a.0').chain().method<{a: string}>(); + result = _('a.0').chain().method<{a: string}>(any); + result = _('a.0').chain().method<{a: string}>(any, any); + result = _('a.0').chain().method<{a: string}>(any, any, any); + + result = _(['a', 0]).chain().method<{a: string}>(); + result = _(['a', 0]).chain().method<{a: string}>(any); + result = _(['a', 0]).chain().method<{a: string}>(any, any); + result = _(['a', 0]).chain().method<{a: string}>(any, any, any); + } + + { + let result: _.LoDashExplicitObjectWrapper<(object: {a: string}) => {b: string}>; + + result = _('a.0').chain().method<{a: string}, {b: string}>(); + result = _('a.0').chain().method<{a: string}, {b: string}>(any); + result = _('a.0').chain().method<{a: string}, {b: string}>(any, any); + result = _('a.0').chain().method<{a: string}, {b: string}>(any, any, any); + + result = _(['a', 0]).chain().method<{a: string}, {b: string}>(); + result = _(['a', 0]).chain().method<{a: string}, {b: string}>(any); + result = _(['a', 0]).chain().method<{a: string}, {b: string}>(any, any); + result = _(['a', 0]).chain().method<{a: string}, {b: string}>(any, any, any); + } +} + +// _.methodOf +module TestMethodOf { + type SampleObject = {a: {b: () => TResult}[]}; + type ResultFn = (path: _.StringRepresentable|_.StringRepresentable[]) => TResult; + + let object: SampleObject; + + { + let result: ResultFn; + + result = _.methodOf(object); + result = _.methodOf(object, any); + result = _.methodOf(object, any, any); + result = _.methodOf(object, any, any, any); + + result = _.methodOf(object); + result = _.methodOf(object, any); + result = _.methodOf(object, any, any); + result = _.methodOf(object, any, any, any); + } + + { + let result: _.LoDashImplicitObjectWrapper; + + result = _(object).methodOf(); + result = _(object).methodOf(any); + result = _(object).methodOf(any, any); + result = _(object).methodOf(any, any, any); + } + + { + let result: _.LoDashExplicitObjectWrapper; + + result = _(object).chain().methodOf(); + result = _(object).chain().methodOf(any); + result = _(object).chain().methodOf(any, any); + result = _(object).chain().methodOf(any, any, any); + } +} + +// _.mixin +module TestMixin { + let source: _.Dictionary; + let options: {chain?: boolean}; + + { + let result: TResult; + + result = _.mixin({}, source); + result = _.mixin({}, source, options); + result = _.mixin(source); + result = _.mixin(source, options); + } + + { + let result: _.LoDashImplicitObjectWrapper; + + result = _({}).mixin(source); + result = _({}).mixin(source, options); + result = _(source).mixin(); + result = _(source).mixin(options); + } + + { + let result: _.LoDashExplicitObjectWrapper; + + result = _({}).chain().mixin(source); + result = _({}).chain().mixin(source, options); + result = _(source).chain().mixin(); + result = _(source).chain().mixin(options); + } +} + +// _.noConflict +{ + let result: typeof _; + result = _.noConflict(); + result = _(42).noConflict(); + result = _([]).noConflict(); + result = _({}).noConflict(); +} + +// _.noop +module TestNoop { + { + let result: void; + + result = _.noop(); + result = _.noop(1); + result = _.noop('a', 1); + result = _.noop(true, 'a', 1); + + result = _('a').noop(true, 'a', 1); + result = _([1]).noop(true, 'a', 1); + result = _([]).noop(true, 'a', 1); + result = _({}).noop(true, 'a', 1); + result = _(any).noop(true, 'a', 1); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _('a').chain().noop(true, 'a', 1); + result = _([1]).chain().noop(true, 'a', 1); + result = _([]).chain().noop(true, 'a', 1); + result = _({}).chain().noop(true, 'a', 1); + result = _(any).chain().noop(true, 'a', 1); + } +} + +// _.property +module TestProperty { + interface SampleObject { + a: { + b: number[]; + } + } + + { + let result: (object: SampleObject) => number; + + result = _.property('a.b[0]'); + result = _.property(['a', 'b', 0]); + } + + { + let result: _.LoDashImplicitObjectWrapper<(object: SampleObject) => number>; + + result = _('a.b[0]').property(); + result = _(['a', 'b', 0]).property(); + } + + { + let result: _.LoDashExplicitObjectWrapper<(object: SampleObject) => number>; + + result = _('a.b[0]').chain().property(); + result = _(['a', 'b', 0]).chain().property(); + } +} + +// _.propertyOf +module TestPropertyOf { + interface SampleObject { + a: { + b: number[]; + } + } + + let object: SampleObject; + + { + let result: (path: string|string[]) => any; + + result = _.propertyOf({}); + result = _.propertyOf(object); + } + + { + let result: _.LoDashImplicitObjectWrapper<(path: string|string[]) => any>; + + result = _({}).propertyOf(); + } + + { + let result: _.LoDashExplicitObjectWrapper<(path: string|string[]) => any>; + + result = _({}).chain().propertyOf(); + } +} + +// _.range +module TestRange { + { + let result: number[]; + + result = _.range(10); + result = _.range(1, 11); + result = _.range(0, 30, 5); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(10).range(); + result = _(1).range(11); + result = _(0).range(30, 5); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(10).chain().range(); + result = _(1).chain().range(11); + result = _(0).chain().range(30, 5); + } +} + +// _.runInContext +{ + let result: typeof _; + result = _.runInContext(); + result = _.runInContext({}); + result = _({}).runInContext(); +} + +// _.times +module TestTimes { + let iteratee: (num: number) => TResult; + + { + let result: number[]; + + result = _.times(42); + } + + { + let result: TResult[]; + + result = _.times(42, iteratee); + result = _.times(42, iteratee, any); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(42).times(); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(42).times(iteratee); + result = _(42).times(iteratee, any); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(42).chain().times(); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(42).chain().times(iteratee); + result = _(42).chain().times(iteratee, any); + } +} + +// _.uniqueId +module TestUniqueId { + { + let result: string; + + result = _.uniqueId(); + result = _.uniqueId(''); + + result = _('').uniqueId(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _('').chain().uniqueId(); + } +} + +result = _.VERSION; +result = <_.Support>_.support; +result = <_.TemplateSettings>_.templateSettings; + +// _.partial & _.partialRight +{ + function func0(): number { + return 42; + } + function func1(arg1: number): number { + return arg1 * 2; + } + function func2(arg1: number, arg2: string): number { + return arg1 * arg2.length; + } + function func3(arg1: number, arg2: string, arg3: boolean): number { + return arg1 * arg2.length + (arg3 ? 1 : 0); + } + function func4(arg1: number, arg2: string, arg3: boolean, arg4: number): number { + return arg1 * arg2.length + (arg3 ? 1 : 0) - arg4; + } + let res____: () => number; + let res1___: (arg1: number ) => number; + let res_2__: ( arg2: string ) => number; + let res__3_: ( arg3: boolean ) => number; + let res___4: ( arg4: number) => number; + let res12__: (arg1: number, arg2: string ) => number; + let res1_3_: (arg1: number, arg3: boolean ) => number; + let res1__4: (arg1: number, arg4: number) => number; + let res_23_: ( arg2: string, arg3: boolean ) => number; + let res_2_4: ( arg2: string, arg4: number) => number; + let res__34: ( arg3: boolean, arg4: number) => number; + let res123_: (arg1: number, arg2: string, arg3: boolean ) => number; + let res12_4: (arg1: number, arg2: string, arg4: number) => number; + let res1_34: (arg1: number, arg3: boolean, arg4: number) => number; + let res_234: ( arg2: string, arg3: boolean, arg4: number) => number; + let res1234: (arg1: number, arg2: string, arg3: boolean, arg4: number) => number; + + // + // _.partial + // + // with arity 0 function + res____ = _.partial(func0); + // with arity 1 function + res____ = _.partial(func1, 42 ); + res1___ = _.partial(func1 ); + // with arity 2 function + res12__ = _.partial(func2 ); + res_2__ = _.partial(func2, 42 ); + res1___ = _.partial(func2, _, "foo"); + res____ = _.partial(func2, 42, "foo"); + // with arity 3 function + res123_ = _.partial(func3 ); + res_23_ = _.partial(func3, 42 ); + res1_3_ = _.partial(func3, _, "foo" ); + res__3_ = _.partial(func3, 42, "foo" ); + res12__ = _.partial(func3, _, _, true); + res_2__ = _.partial(func3, 42, _, true); + res1___ = _.partial(func3, _, "foo", true); + res____ = _.partial(func3, 42, "foo", true); + // with arity 4 function + res1234 = _.partial(func4 ); + res_234 = _.partial(func4, 42 ); + res1_34 = _.partial(func4, _, "foo" ); + res__34 = _.partial(func4, 42, "foo" ); + res12_4 = _.partial(func4, _, _, true ); + res_2_4 = _.partial(func4, 42, _, true ); + res1__4 = _.partial(func4, _, "foo", true ); + res___4 = _.partial(func4, 42, "foo", true ); + res123_ = _.partial(func4, _, _, _, 100); + res_23_ = _.partial(func4, 42, _, _, 100); + res1_3_ = _.partial(func4, _, "foo", _, 100); + res__3_ = _.partial(func4, 42, "foo", _, 100); + res12__ = _.partial(func4, _, _, true, 100); + res_2__ = _.partial(func4, 42, _, true, 100); + res1___ = _.partial(func4, _, "foo", true, 100); + res____ = _.partial(func4, 42, "foo", true, 100); + + // + // _.partialRight + // + // with arity 0 function + res____ = _.partialRight(func0); + // with arity 1 function + res____ = _.partialRight(func1, 42 ); + res1___ = _.partialRight(func1 ); + // with arity 2 function + res12__ = _.partialRight(func2 ); + res_2__ = _.partialRight(func2, 42, _); + res1___ = _.partialRight(func2, "foo"); + res____ = _.partialRight(func2, 42, "foo"); + // with arity 3 function + res123_ = _.partialRight(func3 ); + res_23_ = _.partialRight(func3, 42, _, _); + res1_3_ = _.partialRight(func3, "foo", _); + res__3_ = _.partialRight(func3, 42, "foo", _); + res12__ = _.partialRight(func3, true); + res_2__ = _.partialRight(func3, 42, _, true); + res1___ = _.partialRight(func3, "foo", true); + res____ = _.partialRight(func3, 42, "foo", true); + // with arity 4 function + res1234 = _.partialRight(func4 ); + res_234 = _.partialRight(func4, 42, _, _, _); + res1_34 = _.partialRight(func4, "foo", _, _); + res__34 = _.partialRight(func4, 42, "foo", _, _); + res12_4 = _.partialRight(func4, true, _); + res_2_4 = _.partialRight(func4, 42, _, true, _); + res1__4 = _.partialRight(func4, "foo", true, _); + res___4 = _.partialRight(func4, 42, "foo", true, _); + res123_ = _.partialRight(func4, 100); + res_23_ = _.partialRight(func4, 42, _, _, 100); + res1_3_ = _.partialRight(func4, "foo", _, 100); + res__3_ = _.partialRight(func4, 42, "foo", _, 100); + res12__ = _.partialRight(func4, true, 100); + res_2__ = _.partialRight(func4, 42, _, true, 100); + res1___ = _.partialRight(func4, "foo", true, 100); + res____ = _.partialRight(func4, 42, "foo", true, 100); +} diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 0293b17e6..f2c59d841 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -3941,12 +3941,6 @@ module TestFind { result = _(dictionary).find<{a: number}, TResult>({a: 42}); } -result = _.findWhere([1, 2, 3, 4], function (num) { - return num % 2 == 0; -}); -result = _.findWhere(foodsCombined, { 'type': 'vegetable' }); -result = _.findWhere(foodsCombined, 'organic'); - result = _.findLast([1, 2, 3, 4], function (num) { return num % 2 == 0; }); @@ -4657,68 +4651,69 @@ result = <{a: number}[][]>_([{a: 1}, {a: 2}]).partition('a', 2).value(); result = <{a: number}[][]>_({0: {a: 1}, 1: {a: 2}}).partition<{a: number}>('a').value(); result = <{a: number}[][]>_({0: {a: 1}, 1: {a: 2}}).partition<{a: number}>('a', 2).value(); -// _.pluck -module TestPluck { - interface SampleObject { - d: {b: TResult}[]; - } - - let array: SampleObject[]; - let list: _.List; - let dictionary: _.Dictionary; - - { - let result: any[]; - - result = _.pluck(array, 'd.0.b'); - result = _.pluck(array, ['d', 0, 'b']); - - result = _.pluck(list, 'd.0.b'); - result = _.pluck(list, ['d', 0, 'b']); - - result = _.pluck(dictionary, 'd.0.b'); - result = _.pluck(dictionary, ['d', 0, 'b']); - } - - { - let result: TResult[]; - - result = _.pluck(array, 'd.0.b'); - result = _.pluck(array, ['d', 0, 'b']); - - result = _.pluck(list, 'd.0.b'); - result = _.pluck(list, ['d', 0, 'b']); - - result = _.pluck(dictionary, 'd.0.b'); - result = _.pluck(dictionary, ['d', 0, 'b']); - } - - { - let result: _.LoDashImplicitArrayWrapper; - - result = _(array).pluck('d.0.b'); - result = _(array).pluck(['d', 0, 'b']); - - result = _(list).pluck('d.0.b'); - result = _(list).pluck(['d', 0, 'b']); - - result = _(dictionary).pluck('d.0.b'); - result = _(dictionary).pluck(['d', 0, 'b']); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _(array).chain().pluck('d.0.b'); - result = _(array).chain().pluck(['d', 0, 'b']); - - result = _(list).chain().pluck('d.0.b'); - result = _(list).chain().pluck(['d', 0, 'b']); - - result = _(dictionary).chain().pluck('d.0.b'); - result = _(dictionary).chain().pluck(['d', 0, 'b']); - } -} +// TODO +// _.map with iteratee shorthand +// module TestMapInsteadOfPluck { +// interface SampleObject { +// d: {b: TResult}[]; +// } +// +// let array: SampleObject[]; +// let list: _.List; +// let dictionary: _.Dictionary; +// +// { +// let result: any[]; +// +// result = _.map(array, 'd.0.b'); +// result = _.map(array, ['d', 0, 'b']); +// +// result = _.map(list, 'd.0.b'); +// result = _.map(list, ['d', 0, 'b']); +// +// result = _.map(dictionary, 'd.0.b'); +// result = _.map(dictionary, ['d', 0, 'b']); +// } +// +// { +// let result: TResult[]; +// +// result = _.map(array, 'd.0.b'); +// result = _.map(array, ['d', 0, 'b']); +// +// result = _.map(list, 'd.0.b'); +// result = _.map(list, ['d', 0, 'b']); +// +// result = _.map(dictionary, 'd.0.b'); +// result = _.map(dictionary, ['d', 0, 'b']); +// } +// +// { +// let result: _.LoDashImplicitArrayWrapper; +// +// result = _(array).map('d.0.b'); +// result = _(array).map(['d', 0, 'b']); +// +// result = _(list).map('d.0.b'); +// result = _(list).map(['d', 0, 'b']); +// +// result = _(dictionary).map('d.0.b'); +// result = _(dictionary).map(['d', 0, 'b']); +// } +// +// { +// let result: _.LoDashExplicitArrayWrapper; +// +// result = _(array).chain().map('d.0.b'); +// result = _(array).chain().map(['d', 0, 'b']); +// +// result = _(list).chain().map('d.0.b'); +// result = _(list).chain().map(['d', 0, 'b']); +// +// result = _(dictionary).chain().map('d.0.b'); +// result = _(dictionary).chain().map(['d', 0, 'b']); +// } +// } interface ABC { [index: string]: number; @@ -5386,12 +5381,6 @@ module TestSortByOrder { } } -result = _.where(stoogesCombined, { 'age': 40 }); -result = _.where(stoogesCombined, { 'quotes': ['Poifect!'] }); - -result = _(stoogesCombined).where({ 'age': 40 }).value(); -result = _(stoogesCombined).where({ 'quotes': ['Poifect!'] }).value(); - /******** * Date * ********/ @@ -9992,7 +9981,6 @@ module TestUniqueId { } result = _.VERSION; -result = <_.Support>_.support; result = <_.TemplateSettings>_.templateSettings; // _.partial & _.partialRight diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 9d42b9d5d..8fd70fc49 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -3,6 +3,194 @@ // Definitions by: Brian Zengel , Ilya Mochalov // Definitions: https://github.com/borisyankov/DefinitelyTyped + +/** +# 4.0.0 Changelog (https://github.com/lodash/lodash/wiki/Changelog) + +TODO: +- [ ] Made _.forEach, _.forIn, _.forOwn, & _.times implicitly end a chain sequence +- [ ] Removed _.pluck in favor of _.map with iteratee shorthand +- [ ] Removed thisArg params from most methods +- [ ] Split _.max & _.min into _.maxBy & _.minBy + +- [x] Removed _.support +- [x] Removed _.findWhere in favor of _.find with iteratee shorthand +- [x] Removed _.where in favor of _.filter with iteratee shorthand +- [x] Removed _.pluck in favor of _.map with iteratee shorthand + +- [ ] Renamed _.first to _.head +- [ ] Renamed _.indexBy to _.keyBy +- [ ] Renamed _.invoke to _.invokeMap +- [ ] Renamed _.modArgs to _.overArgs +- [ ] Renamed _.padLeft & _.padRight to _.padStart & _.padEnd +- [ ] Renamed _.pairs to _.toPairs +- [ ] Renamed _.rest to _.tail +- [ ] Renamed _.restParam to _.rest +- [ ] Renamed _.sortByOrder to _.orderBy +- [ ] Renamed _.trimLeft & _.trimRight to _.trimStart & _.trimEnd +- [ ] Renamed _.trunc to _.truncate + +- [ ] Split _.indexOf & _.lastIndexOf into _.sortedIndexOf & _.sortedLastIndexOf +- [ ] Split _.max & _.min into _.maxBy & _.minBy +- [ ] Split _.omit & _.pick into _.omitBy & _.pickBy +- [ ] Split _.sample into _.sampleSize +- [ ] Split _.sortedIndex into _.sortedIndexBy +- [ ] Split _.sortedLastIndex into _.sortedLastIndexBy +- [ ] Split _.uniq into _.sortedUniq, _.sortedUniqBy, & _.uniqBy + +- [ ] Absorbed _.sortByAll into _.sortBy +- [ ] Changed the category of _.at to “Object” +- [ ] Changed the category of _.bindAll to “Utility” +- [ ] Made “By” methods provide a single param to iteratees +- [ ] Made _.capitalize uppercase the first character & lowercase the rest +- [ ] Made _.functions return only own method names +- [ ] Made _.words chainable by default +- [ ] Removed isDeep params from _.clone & _.flatten +- [ ] Removed _.bindAll support for binding all methods when no names are provided +- [ ] Removed func-first param signature from _.before & _.after + +added 23 array methods: +- [ ] _.concat, +- [ ] _.differenceBy, +- [ ] _.differenceWith, +- [ ] _.flatMap, +- [ ] _.fromPairs, +- [ ] _.intersectionBy, +- [ ] _.intersectionWith, +- [ ] _.join, +- [ ] _.pullAll, +- [ ] _.pullAllBy, +- [ ] _.reverse, +- [ ] _.sortedIndexBy, +- [ ] _.sortedIndexOf, +- [ ] _.sortedLastIndexBy, +- [ ] _.sortedLastIndexOf, +- [ ] _.sortedUniq, +- [ ] _.sortedUniqBy, +- [ ] _.unionBy, +- [ ] _.unionWith, +- [ ] _.uniqBy, +- [ ] _.uniqWith, +- [ ] _.xorBy, & +- [ ] _.xorWith + +added 18 lang methods: +- [ ] _.cloneDeepWith, +- [ ] _.cloneWith, +- [ ] _.eq, +- [ ] _.isArrayLike, +- [ ] _.isArrayLikeObject, +- [ ] _.isEqualWith, +- [ ] _.isInteger, +- [ ] _.isLength, +- [ ] _.isMatchWith, +- [ ] _.isNil, +- [ ] _.isObjectLike, +- [ ] _.isSafeInteger, +- [ ] _.isSymbol, +- [ ] _.toInteger, +- [ ] _.toLength, +- [ ] _.toNumber, +- [ ] _.toSafeInteger, & +- [ ] _.toString + +added 13 object methods: +- [ ] _.assignIn, +- [ ] _.assignInWith, +- [ ] _.assignWith, +- [ ] _.functionsIn, +- [ ] _.hasIn, +- [ ] _.invoke, +- [ ] _.mergeWith, +- [ ] _.omitBy, +- [ ] _.pickBy, +- [ ] _.setWith, +- [ ] _.toPairs, +- [ ] _.toPairsIn, & +- [ ] _.unset + +added 8 string methods: +- [ ] _.lowerCase, +- [ ] _.lowerFirst, +- [ ] _.replace, +- [ ] _.split, +- [ ] _.upperCase, +- [ ] _.upperFirst, +- [ ] _.toLower, & +- [ ] _.toUpper + +added 8 utility methods: +- [ ] _.cond, +- [ ] _.conforms, +- [ ] _.nthArg, +- [ ] _.over, +- [ ] _.overEvery, +- [ ] _.overSome, +- [ ] _.rangeRight, & +- [ ] _.toPath + +added 4 math methods: +- [ ] _.maxBy, +- [ ] _.mean, +- [ ] _.minBy, & +- [ ] _.sumBy + +added 2 function methods: +- [ ] _.flip & +- [ ] _.unary + +added 2 number methods: +- [ ] _.clamp & +- [ ] _.subtract + +added chain method: +- [ ] _#next + +added collection method: +- [ ] _.sampleSize + +Added 3 aliases +- [ ] _.extend as an alias of _.assignIn +- [ ] _.extendWith as an alias of _.assignInWith +- [ ] _.first as an alias of _.head + +Removed 17 aliases +- [ ] _.all, _.any, _.backflow, _.callback, _.collect, _.compose, _.contains, _.detect, _.foldl, _.foldr, _.include, _.inject, _.methods, _.object, _.#run, _.select, & _.unique + +Other changes +- [ ] Added clear method to _.memoize.Cache +- [ ] Added flush method to debounced & throttled functions +- [ ] Added support for ES6 maps, sets, & symbols to _.clone, _.isEqual, & _.toArray +- [ ] Added support for array buffers to _.isEqual +- [ ] Added support for converting iterators to _.toArray +- [ ] Added support for deep paths to _.zipObject +- [ ] Changed UMD to export to window or self when available regardless of other exports +- [ ] Enabled _.flow & _.flowRight to accept an array of functions +- [ ] Ensured “Collection” methods treat functions as objects +- [ ] Ensured debounce cancel clears args & thisArg references +- [ ] Ensured _.add, _.subtract, & _.sum don’t skip NaN values +- [ ] Ensured _.assign, _.defaults, & _.merge coerce object values to objects +- [ ] Ensured _.bindKey bound functions call object[key] when called with the new operator +- [ ] Ensured _.clone treats generators like functions +- [ ] Ensured _.clone produces clones with the source’s [[Prototype]] +- [ ] Ensured _.defaults assigns properties that shadow Object.prototype +- [ ] Ensured _.defaultsDeep doesn’t merge a string into an array +- [ ] Ensured _.defaultsDeep & _.merge don’t modify sources +- [ ] Ensured _.defaultsDeep works with circular references +- [ ] Ensured _.isFunction returns true for generator functions +- [ ] Ensured _.keys skips “length” on strict mode arguments objects in Safari 9 +- [ ] Ensured _.merge assigns typed arrays directly +- [ ] Ensured _.merge doesn’t convert strings to arrays +- [ ] Ensured _.merge merges plain-objects onto non plain-objects +- [ ] Ensured _#plant resets iterator data of cloned sequences +- [ ] Ensured _.random swaps min & max if min is greater than max +- [ ] Ensured _.range preserves the sign of start of -0 +- [ ] Ensured _.reduce & _.reduceRight use getIteratee in their array branch +- [ ] Fixed rounding issue with the precision param of _.floor +- [ ] Made _(...) an iterator & iterable +- [ ] Made _.drop, _.take, & right forms coerce n of undefined to 0 +*/ + declare var _: _.LoDashStatic; declare module _ { @@ -51,11 +239,6 @@ declare module _ { **/ VERSION: string; - /** - * An object used to flag environments features. - **/ - support: Support; - /** * By default, the template delimiters used by Lo-Dash are similar to those in embedded Ruby * (ERB). Change the following template settings to use alternative delimiters. @@ -5871,81 +6054,6 @@ declare module _ { ): TResult; } - //_.findWhere - interface LoDashStatic { - /** - * @see _.find - **/ - findWhere( - collection: Array, - callback: ListIterator, - thisArg?: any): T; - - /** - * @see _.find - **/ - findWhere( - collection: List, - callback: ListIterator, - thisArg?: any): T; - - /** - * @see _.find - **/ - findWhere( - collection: Dictionary, - callback: DictionaryIterator, - thisArg?: any): T; - - /** - * @see _.find - * @param _.matches style callback - **/ - findWhere( - collection: Array, - whereValue: W): T; - - /** - * @see _.find - * @param _.matches style callback - **/ - findWhere( - collection: List, - whereValue: W): T; - - /** - * @see _.find - * @param _.matches style callback - **/ - findWhere( - collection: Dictionary, - whereValue: W): T; - - /** - * @see _.find - * @param _.property style callback - **/ - findWhere( - collection: Array, - pluckValue: string): T; - - /** - * @see _.find - * @param _.property style callback - **/ - findWhere( - collection: List, - pluckValue: string): T; - - /** - * @see _.find - * @param _.property style callback - **/ - findWhere( - collection: Dictionary, - pluckValue: string): T; - } - //_.findLast interface LoDashStatic { /** @@ -7276,57 +7384,6 @@ declare module _ { pluckValue: string): LoDashImplicitArrayWrapper; } - //_.pluck - interface LoDashStatic { - /** - * Gets the property value of path from all elements in collection. - * - * @param collection The collection to iterate over. - * @param path The path of the property to pluck. - * @return A new array of property values. - */ - pluck( - collection: List|Dictionary, - path: StringRepresentable|StringRepresentable[] - ): any[]; - - /** - * @see _.pluck - */ - pluck( - collection: List|Dictionary, - path: StringRepresentable|StringRepresentable[] - ): TResult[]; - } - - interface LoDashImplicitArrayWrapper { - /** - * @see _.pluck - */ - pluck(path: StringRepresentable|StringRepresentable[]): LoDashImplicitArrayWrapper; - } - - interface LoDashImplicitObjectWrapper { - /** - * @see _.pluck - */ - pluck(path: StringRepresentable|StringRepresentable[]): LoDashImplicitArrayWrapper; - } - - interface LoDashExplicitArrayWrapper { - /** - * @see _.pluck - */ - pluck(path: StringRepresentable|StringRepresentable[]): LoDashExplicitArrayWrapper; - } - - interface LoDashExplicitObjectWrapper { - /** - * @see _.pluck - */ - pluck(path: StringRepresentable|StringRepresentable[]): LoDashExplicitArrayWrapper; - } - //_.reduce interface LoDashStatic { /** @@ -8909,41 +8966,6 @@ declare module _ { ): LoDashExplicitArrayWrapper; } - //_.where - interface LoDashStatic { - /** - * Performs a deep comparison of each element in a collection to the given properties - * object, returning an array of all elements that have equivalent property values. - * @param collection The collection to iterate over. - * @param properties The object of property values to filter by. - * @return A new array of elements that have the given properties. - **/ - where( - list: Array, - properties: U): T[]; - - /** - * @see _.where - **/ - where( - list: List, - properties: U): T[]; - - /** - * @see _.where - **/ - where( - list: Dictionary, - properties: U): T[]; - } - - interface LoDashImplicitArrayWrapper { - /** - * @see _.where - **/ - where(properties: U): LoDashImplicitArrayWrapper; - } - /******** * Date * ********/ diff --git a/sequelize/sequelize-2.0.0.d.ts b/sequelize/sequelize-2.0.0.d.ts index 1bb6be593..04af612a5 100644 --- a/sequelize/sequelize-2.0.0.d.ts +++ b/sequelize/sequelize-2.0.0.d.ts @@ -6,7 +6,7 @@ // Based on original work by: samuelneff /// -/// +/// declare module "sequelize" { diff --git a/sequelize/sequelize.d.ts b/sequelize/sequelize.d.ts index 0dcd61e86..fda6503a5 100644 --- a/sequelize/sequelize.d.ts +++ b/sequelize/sequelize.d.ts @@ -5,7 +5,7 @@ // Based on original work by: samuelneff -/// +/// /// /// From 5abdddd2ab2371bb83178264771ef60989798e7c Mon Sep 17 00:00:00 2001 From: DomiR Date: Wed, 13 Jan 2016 17:03:47 +0100 Subject: [PATCH 02/51] (feature) Rename fist to head --- lodash/lodash.d.ts | 107 +++++---------------------------------------- 1 file changed, 12 insertions(+), 95 deletions(-) diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 8fd70fc49..9952113da 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -18,7 +18,7 @@ TODO: - [x] Removed _.where in favor of _.filter with iteratee shorthand - [x] Removed _.pluck in favor of _.map with iteratee shorthand -- [ ] Renamed _.first to _.head +- [x] Renamed _.first to _.head - [ ] Renamed _.indexBy to _.keyBy - [ ] Renamed _.invoke to _.invokeMap - [ ] Renamed _.modArgs to _.overArgs @@ -152,7 +152,7 @@ added collection method: Added 3 aliases - [ ] _.extend as an alias of _.assignIn - [ ] _.extendWith as an alias of _.assignInWith -- [ ] _.first as an alias of _.head +- [x] _.first as an alias of _.head Removed 17 aliases - [ ] _.all, _.any, _.backflow, _.callback, _.collect, _.compose, _.contains, _.detect, _.foldl, _.foldr, _.include, _.inject, _.methods, _.object, _.#run, _.select, & _.unique @@ -311,89 +311,6 @@ declare module _ { set(key: string, value: any): _.Dictionary; } - /** - * An object used to flag environments features. - **/ - interface Support { - /** - * Detect if an arguments object's [[Class]] is resolvable (all but Firefox < 4, IE < 9). - **/ - argsClass: boolean; - - /** - * Detect if arguments objects are Object objects (all but Narwhal and Opera < 10.5). - **/ - argsObject: boolean; - - /** - * Detect if name or message properties of Error.prototype are enumerable by default. - * (IE < 9, Safari < 5.1) - **/ - enumErrorProps: boolean; - - /** - * Detect if prototype properties are enumerable by default. - * - * Firefox < 3.6, Opera > 9.50 - Opera < 11.60, and Safari < 5.1 (if the prototype or a property on the - * prototype has been set) incorrectly set the [[Enumerable]] value of a function’s prototype property to true. - **/ - enumPrototypes: boolean; - - /** - * Detect if Function#bind exists and is inferred to be fast (all but V8). - **/ - fastBind: boolean; - - /** - * Detect if functions can be decompiled by Function#toString (all but PS3 and older Opera - * mobile browsers & avoided in Windows 8 apps). - **/ - funcDecomp: boolean; - - /** - * Detect if Function#name is supported (all but IE). - **/ - funcNames: boolean; - - /** - * Detect if arguments object indexes are non-enumerable (Firefox < 4, IE < 9, PhantomJS, - * Safari < 5.1). - **/ - nonEnumArgs: boolean; - - /** - * Detect if properties shadowing those on Object.prototype are non-enumerable. - * - * In IE < 9 an objects own properties, shadowing non-enumerable ones, are made - * non-enumerable as well (a.k.a the JScript [[DontEnum]] bug). - **/ - nonEnumShadows: boolean; - - /** - * Detect if own properties are iterated after inherited properties (all but IE < 9). - **/ - ownLast: boolean; - - /** - * Detect if Array#shift and Array#splice augment array-like objects correctly. - * - * Firefox < 10, IE compatibility mode, and IE < 9 have buggy Array shift() and splice() - * functions that fail to remove the last element, value[0], of array-like objects even - * though the length property is set to 0. The shift() method is buggy in IE 8 compatibility - * mode, while splice() is buggy regardless of mode in IE < 9 and buggy in compatibility mode - * in IE 9. - **/ - spliceObjects: boolean; - - /** - * Detect lack of support for accessing string characters by index. - * - * IE < 8 can't access characters by index and IE 8 can only access characters by index on - * string literals. - **/ - unindexedChars: boolean; - } - interface LoDashWrapperBase { } interface LoDashImplicitWrapperBase extends LoDashWrapperBase { } @@ -1296,27 +1213,22 @@ declare module _ { //_.first interface LoDashStatic { - /** - * Gets the first element of array. - * - * @alias _.head - * - * @param array The array to query. - * @return Returns the first element of array. + /** + * @see _.head */ first(array: List): T; } interface LoDashImplicitArrayWrapper { /** - * @see _.first + * @see _.head */ first(): T; } interface LoDashImplicitObjectWrapper { /** - * @see _.first + * @see _.head */ first(): TResult; } @@ -1445,7 +1357,12 @@ declare module _ { //_.head interface LoDashStatic { /** - * @see _.first + * Gets the first element of array. + * + * @alias _.first + * + * @param array The array to query. + * @return Returns the first element of array. */ head(array: List): T; } From b7f28d2d86f94c79d67dc5b796f099520ffad663 Mon Sep 17 00:00:00 2001 From: DomiR Date: Wed, 13 Jan 2016 17:07:22 +0100 Subject: [PATCH 03/51] (feature) Rename _.indexBy to _.keyBy --- lodash/lodash-tests.ts | 186 ++++++++++++++++++++--------------------- lodash/lodash.d.ts | 92 ++++++++++---------- 2 files changed, 139 insertions(+), 139 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index f2c59d841..765ab33ee 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -4384,8 +4384,8 @@ module TestIncludes { } } -// _.indexBy -module TestIndexBy { +// _.keyBy +module TestKeyBy { type SampleObject = {a: number; b: string; c: boolean;}; let array: SampleObject[]; @@ -4401,131 +4401,131 @@ module TestIndexBy { { let result: _.Dictionary; - result = _.indexBy('abcd'); - result = _.indexBy('abcd', stringIterator); - result = _.indexBy('abcd', stringIterator, any); + result = _.keyBy('abcd'); + result = _.keyBy('abcd', stringIterator); + result = _.keyBy('abcd', stringIterator, any); } { let result: _.Dictionary; - result = _.indexBy(array); - result = _.indexBy(array, listIterator); - result = _.indexBy(array, listIterator, any); - result = _.indexBy(array, 'a'); - result = _.indexBy(array, 'a', any); - result = _.indexBy<{a: number}, SampleObject>(array, {a: 42}); - result = _.indexBy(array, {a: 42}); + result = _.keyBy(array); + result = _.keyBy(array, listIterator); + result = _.keyBy(array, listIterator, any); + result = _.keyBy(array, 'a'); + result = _.keyBy(array, 'a', any); + result = _.keyBy<{a: number}, SampleObject>(array, {a: 42}); + result = _.keyBy(array, {a: 42}); - result = _.indexBy(list); - result = _.indexBy(list, listIterator); - result = _.indexBy(list, listIterator, any); - result = _.indexBy(list, 'a'); - result = _.indexBy(list, 'a', any); - result = _.indexBy<{a: number}, SampleObject>(list, {a: 42}); - result = _.indexBy(list, {a: 42}); + result = _.keyBy(list); + result = _.keyBy(list, listIterator); + result = _.keyBy(list, listIterator, any); + result = _.keyBy(list, 'a'); + result = _.keyBy(list, 'a', any); + result = _.keyBy<{a: number}, SampleObject>(list, {a: 42}); + result = _.keyBy(list, {a: 42}); - result = _.indexBy(numericDictionary); - result = _.indexBy(numericDictionary, numericDictionaryIterator); - result = _.indexBy(numericDictionary, numericDictionaryIterator, any); - result = _.indexBy(numericDictionary, 'a'); - result = _.indexBy(numericDictionary, 'a', any); - result = _.indexBy<{a: number}, SampleObject>(numericDictionary, {a: 42}); - result = _.indexBy(numericDictionary, {a: 42}); + result = _.keyBy(numericDictionary); + result = _.keyBy(numericDictionary, numericDictionaryIterator); + result = _.keyBy(numericDictionary, numericDictionaryIterator, any); + result = _.keyBy(numericDictionary, 'a'); + result = _.keyBy(numericDictionary, 'a', any); + result = _.keyBy<{a: number}, SampleObject>(numericDictionary, {a: 42}); + result = _.keyBy(numericDictionary, {a: 42}); - result = _.indexBy(dictionary); - result = _.indexBy(dictionary, dictionaryIterator); - result = _.indexBy(dictionary, dictionaryIterator, any); - result = _.indexBy(dictionary, 'a'); - result = _.indexBy(dictionary, 'a', any); - result = _.indexBy<{a: number}, SampleObject>(dictionary, {a: 42}); - result = _.indexBy(dictionary, {a: 42}); + result = _.keyBy(dictionary); + result = _.keyBy(dictionary, dictionaryIterator); + result = _.keyBy(dictionary, dictionaryIterator, any); + result = _.keyBy(dictionary, 'a'); + result = _.keyBy(dictionary, 'a', any); + result = _.keyBy<{a: number}, SampleObject>(dictionary, {a: 42}); + result = _.keyBy(dictionary, {a: 42}); } { let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; - result = _('abcd').indexBy(); - result = _('abcd').indexBy(stringIterator); - result = _('abcd').indexBy(stringIterator, any); + result = _('abcd').keyBy(); + result = _('abcd').keyBy(stringIterator); + result = _('abcd').keyBy(stringIterator, any); } { let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; - result = _(array).indexBy(); - result = _(array).indexBy(listIterator); - result = _(array).indexBy(listIterator, any); - result = _(array).indexBy('a'); - result = _(array).indexBy('a', any); - result = _(array).indexBy<{a: number}>({a: 42}); + result = _(array).keyBy(); + result = _(array).keyBy(listIterator); + result = _(array).keyBy(listIterator, any); + result = _(array).keyBy('a'); + result = _(array).keyBy('a', any); + result = _(array).keyBy<{a: number}>({a: 42}); - result = _(list).indexBy(); - result = _(list).indexBy(listIterator); - result = _(list).indexBy(listIterator, any); - result = _(list).indexBy('a'); - result = _(list).indexBy('a', any); - result = _(list).indexBy<{a: number}, SampleObject>({a: 42}); - result = _(list).indexBy({a: 42}); + result = _(list).keyBy(); + result = _(list).keyBy(listIterator); + result = _(list).keyBy(listIterator, any); + result = _(list).keyBy('a'); + result = _(list).keyBy('a', any); + result = _(list).keyBy<{a: number}, SampleObject>({a: 42}); + result = _(list).keyBy({a: 42}); - result = _(numericDictionary).indexBy(); - result = _(numericDictionary).indexBy(numericDictionaryIterator); - result = _(numericDictionary).indexBy(numericDictionaryIterator, any); - result = _(numericDictionary).indexBy('a'); - result = _(numericDictionary).indexBy('a', any); - result = _(numericDictionary).indexBy<{a: number}, SampleObject>({a: 42}); - result = _(numericDictionary).indexBy({a: 42}); + result = _(numericDictionary).keyBy(); + result = _(numericDictionary).keyBy(numericDictionaryIterator); + result = _(numericDictionary).keyBy(numericDictionaryIterator, any); + result = _(numericDictionary).keyBy('a'); + result = _(numericDictionary).keyBy('a', any); + result = _(numericDictionary).keyBy<{a: number}, SampleObject>({a: 42}); + result = _(numericDictionary).keyBy({a: 42}); - result = _(dictionary).indexBy(); - result = _(dictionary).indexBy(dictionaryIterator); - result = _(dictionary).indexBy(dictionaryIterator, any); - result = _(dictionary).indexBy('a'); - result = _(dictionary).indexBy('a', any); - result = _(dictionary).indexBy<{a: number}, SampleObject>({a: 42}); - result = _(dictionary).indexBy({a: 42}); + result = _(dictionary).keyBy(); + result = _(dictionary).keyBy(dictionaryIterator); + result = _(dictionary).keyBy(dictionaryIterator, any); + result = _(dictionary).keyBy('a'); + result = _(dictionary).keyBy('a', any); + result = _(dictionary).keyBy<{a: number}, SampleObject>({a: 42}); + result = _(dictionary).keyBy({a: 42}); } { let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; - result = _('abcd').chain().indexBy(); - result = _('abcd').chain().indexBy(stringIterator); - result = _('abcd').chain().indexBy(stringIterator, any); + result = _('abcd').chain().keyBy(); + result = _('abcd').chain().keyBy(stringIterator); + result = _('abcd').chain().keyBy(stringIterator, any); } { let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; - result = _(array).chain().indexBy(); - result = _(array).chain().indexBy(listIterator); - result = _(array).chain().indexBy(listIterator, any); - result = _(array).chain().indexBy('a'); - result = _(array).chain().indexBy('a', any); - result = _(array).chain().indexBy<{a: number}>({a: 42}); + result = _(array).chain().keyBy(); + result = _(array).chain().keyBy(listIterator); + result = _(array).chain().keyBy(listIterator, any); + result = _(array).chain().keyBy('a'); + result = _(array).chain().keyBy('a', any); + result = _(array).chain().keyBy<{a: number}>({a: 42}); - result = _(list).chain().indexBy(); - result = _(list).chain().indexBy(listIterator); - result = _(list).chain().indexBy(listIterator, any); - result = _(list).chain().indexBy('a'); - result = _(list).chain().indexBy('a', any); - result = _(list).chain().indexBy<{a: number}, SampleObject>({a: 42}); - result = _(list).chain().indexBy({a: 42}); + result = _(list).chain().keyBy(); + result = _(list).chain().keyBy(listIterator); + result = _(list).chain().keyBy(listIterator, any); + result = _(list).chain().keyBy('a'); + result = _(list).chain().keyBy('a', any); + result = _(list).chain().keyBy<{a: number}, SampleObject>({a: 42}); + result = _(list).chain().keyBy({a: 42}); - result = _(numericDictionary).chain().indexBy(); - result = _(numericDictionary).chain().indexBy(numericDictionaryIterator); - result = _(numericDictionary).chain().indexBy(numericDictionaryIterator, any); - result = _(numericDictionary).chain().indexBy('a'); - result = _(numericDictionary).chain().indexBy('a', any); - result = _(numericDictionary).chain().indexBy<{a: number}, SampleObject>({a: 42}); - result = _(numericDictionary).chain().indexBy({a: 42}); + result = _(numericDictionary).chain().keyBy(); + result = _(numericDictionary).chain().keyBy(numericDictionaryIterator); + result = _(numericDictionary).chain().keyBy(numericDictionaryIterator, any); + result = _(numericDictionary).chain().keyBy('a'); + result = _(numericDictionary).chain().keyBy('a', any); + result = _(numericDictionary).chain().keyBy<{a: number}, SampleObject>({a: 42}); + result = _(numericDictionary).chain().keyBy({a: 42}); - result = _(dictionary).chain().indexBy(); - result = _(dictionary).chain().indexBy(dictionaryIterator); - result = _(dictionary).chain().indexBy(dictionaryIterator, any); - result = _(dictionary).chain().indexBy('a'); - result = _(dictionary).chain().indexBy('a', any); - result = _(dictionary).chain().indexBy<{a: number}, SampleObject>({a: 42}); - result = _(dictionary).chain().indexBy({a: 42}); + result = _(dictionary).chain().keyBy(); + result = _(dictionary).chain().keyBy(dictionaryIterator); + result = _(dictionary).chain().keyBy(dictionaryIterator, any); + result = _(dictionary).chain().keyBy('a'); + result = _(dictionary).chain().keyBy('a', any); + result = _(dictionary).chain().keyBy<{a: number}, SampleObject>({a: 42}); + result = _(dictionary).chain().keyBy({a: 42}); } } diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 9952113da..93d974cfd 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -19,7 +19,7 @@ TODO: - [x] Removed _.pluck in favor of _.map with iteratee shorthand - [x] Renamed _.first to _.head -- [ ] Renamed _.indexBy to _.keyBy +- [x] Renamed _.indexBy to _.keyBy - [ ] Renamed _.invoke to _.invokeMap - [ ] Renamed _.modArgs to _.overArgs - [ ] Renamed _.padLeft & _.padRight to _.padStart & _.padEnd @@ -208,7 +208,7 @@ declare module _ { * after, assign, bind, bindAll, bindKey, chain, chunk, compact, compose, concat, countBy, * createCallback, curry, debounce, defaults, defer, delay, difference, filter, flatten, * forEach, forEachRight, forIn, forInRight, forOwn, forOwnRight, functions, groupBy, - * indexBy, initial, intersection, invert, invoke, keys, map, max, memoize, merge, min, + * keyBy, initial, intersection, invert, invoke, keys, map, max, memoize, merge, min, * object, omit, once, pairs, partial, partialRight, pick, pluck, pull, push, range, reject, * remove, rest, reverse, sample, shuffle, slice, sort, sortBy, splice, tap, throttle, times, * toArray, transform, union, uniq, unshift, unzip, values, where, without, wrap, and zip @@ -6732,7 +6732,7 @@ declare module _ { ): LoDashExplicitWrapper; } - //_.indexBy + //_.keyBy interface LoDashStatic { /** * Creates an object composed of keys generated from the results of running each element of collection through @@ -6754,51 +6754,51 @@ declare module _ { * @param thisArg The this binding of iteratee. * @return Returns the composed aggregate object. */ - indexBy( + keyBy( collection: List, iteratee?: ListIterator, thisArg?: any ): Dictionary; /** - * @see _.indexBy + * @see _.keyBy */ - indexBy( + keyBy( collection: NumericDictionary, iteratee?: NumericDictionaryIterator, thisArg?: any ): Dictionary; /** - * @see _.indexBy + * @see _.keyBy */ - indexBy( + keyBy( collection: Dictionary, iteratee?: DictionaryIterator, thisArg?: any ): Dictionary; /** - * @see _.indexBy + * @see _.keyBy */ - indexBy( + keyBy( collection: List|NumericDictionary|Dictionary, iteratee?: string, thisArg?: any ): Dictionary; /** - * @see _.indexBy + * @see _.keyBy */ - indexBy( + keyBy( collection: List|NumericDictionary|Dictionary, iteratee?: W ): Dictionary; /** - * @see _.indexBy + * @see _.keyBy */ - indexBy( + keyBy( collection: List|NumericDictionary|Dictionary, iteratee?: Object ): Dictionary; @@ -6806,9 +6806,9 @@ declare module _ { interface LoDashImplicitWrapper { /** - * @see _.indexBy + * @see _.keyBy */ - indexBy( + keyBy( iteratee?: ListIterator, thisArg?: any ): LoDashImplicitObjectWrapper>; @@ -6816,66 +6816,66 @@ declare module _ { interface LoDashImplicitArrayWrapper { /** - * @see _.indexBy + * @see _.keyBy */ - indexBy( + keyBy( iteratee?: ListIterator, thisArg?: any ): LoDashImplicitObjectWrapper>; /** - * @see _.indexBy + * @see _.keyBy */ - indexBy( + keyBy( iteratee?: string, thisArg?: any ): LoDashImplicitObjectWrapper>; /** - * @see _.indexBy + * @see _.keyBy */ - indexBy( + keyBy( iteratee?: W ): LoDashImplicitObjectWrapper>; } interface LoDashImplicitObjectWrapper { /** - * @see _.indexBy + * @see _.keyBy */ - indexBy( + keyBy( iteratee?: ListIterator|NumericDictionaryIterator|DictionaryIterator, thisArg?: any ): LoDashImplicitObjectWrapper>; /** - * @see _.indexBy + * @see _.keyBy */ - indexBy( + keyBy( iteratee?: string, thisArg?: any ): LoDashImplicitObjectWrapper>; /** - * @see _.indexBy + * @see _.keyBy */ - indexBy( + keyBy( iteratee?: W ): LoDashImplicitObjectWrapper>; /** - * @see _.indexBy + * @see _.keyBy */ - indexBy( + keyBy( iteratee?: Object ): LoDashImplicitObjectWrapper>; } interface LoDashExplicitWrapper { /** - * @see _.indexBy + * @see _.keyBy */ - indexBy( + keyBy( iteratee?: ListIterator, thisArg?: any ): LoDashExplicitObjectWrapper>; @@ -6883,57 +6883,57 @@ declare module _ { interface LoDashExplicitArrayWrapper { /** - * @see _.indexBy + * @see _.keyBy */ - indexBy( + keyBy( iteratee?: ListIterator, thisArg?: any ): LoDashExplicitObjectWrapper>; /** - * @see _.indexBy + * @see _.keyBy */ - indexBy( + keyBy( iteratee?: string, thisArg?: any ): LoDashExplicitObjectWrapper>; /** - * @see _.indexBy + * @see _.keyBy */ - indexBy( + keyBy( iteratee?: W ): LoDashExplicitObjectWrapper>; } interface LoDashExplicitObjectWrapper { /** - * @see _.indexBy + * @see _.keyBy */ - indexBy( + keyBy( iteratee?: ListIterator|NumericDictionaryIterator|DictionaryIterator, thisArg?: any ): LoDashExplicitObjectWrapper>; /** - * @see _.indexBy + * @see _.keyBy */ - indexBy( + keyBy( iteratee?: string, thisArg?: any ): LoDashExplicitObjectWrapper>; /** - * @see _.indexBy + * @see _.keyBy */ - indexBy( + keyBy( iteratee?: W ): LoDashExplicitObjectWrapper>; /** - * @see _.indexBy + * @see _.keyBy */ - indexBy( + keyBy( iteratee?: Object ): LoDashExplicitObjectWrapper>; } From 9841ecc216bd491d615c84829c3d08ee1668dcd1 Mon Sep 17 00:00:00 2001 From: DomiR Date: Wed, 13 Jan 2016 17:09:38 +0100 Subject: [PATCH 04/51] (feature) Renamed _.invoke to _.invokeMap --- lodash/lodash-tests.ts | 4 ++-- lodash/lodash.d.ts | 26 +++++++++++++------------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 765ab33ee..f8b8671a9 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -4529,8 +4529,8 @@ module TestKeyBy { } } -result = _.invoke([[5, 1, 7], [3, 2, 1]], 'sort'); -result = _.invoke([123, 456], String.prototype.split, ''); +result = _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort'); +result = _.invokeMap([123, 456], String.prototype.split, ''); // _.map module TestMap { diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 93d974cfd..a713c97d7 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -20,7 +20,7 @@ TODO: - [x] Renamed _.first to _.head - [x] Renamed _.indexBy to _.keyBy -- [ ] Renamed _.invoke to _.invokeMap +- [x] Renamed _.invoke to _.invokeMap - [ ] Renamed _.modArgs to _.overArgs - [ ] Renamed _.padLeft & _.padRight to _.padStart & _.padEnd - [ ] Renamed _.pairs to _.toPairs @@ -6938,7 +6938,7 @@ declare module _ { ): LoDashExplicitObjectWrapper>; } - //_.invoke + //_.invokeMap interface LoDashStatic { /** * Invokes the method named by methodName on each element in the collection returning @@ -6949,47 +6949,47 @@ declare module _ { * @param methodName The name of the method to invoke. * @param args Arguments to invoke the method with. **/ - invoke( + invokeMap( collection: Array, methodName: string, ...args: any[]): any; /** - * @see _.invoke + * @see _.invokeMap **/ - invoke( + invokeMap( collection: List, methodName: string, ...args: any[]): any; /** - * @see _.invoke + * @see _.invokeMap **/ - invoke( + invokeMap( collection: Dictionary, methodName: string, ...args: any[]): any; /** - * @see _.invoke + * @see _.invokeMap **/ - invoke( + invokeMap( collection: Array, method: Function, ...args: any[]): any; /** - * @see _.invoke + * @see _.invokeMap **/ - invoke( + invokeMap( collection: List, method: Function, ...args: any[]): any; /** - * @see _.invoke + * @see _.invokeMap **/ - invoke( + invokeMap( collection: Dictionary, method: Function, ...args: any[]): any; From 95514890d62b943ba07354228860bffa247afda5 Mon Sep 17 00:00:00 2001 From: DomiR Date: Wed, 13 Jan 2016 17:11:48 +0100 Subject: [PATCH 05/51] (feature) Renamed _.overArgs to _.overArgs --- lodash/lodash-tests.ts | 28 ++++++++++++++-------------- lodash/lodash.d.ts | 26 +++++++++++++------------- 2 files changed, 27 insertions(+), 27 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index f8b8671a9..39d3d5f6f 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -5993,8 +5993,8 @@ result = _.memoize(testMemoizeFn, te result = (_(testMemoizeFn).memoize().value()); result = (_(testMemoizeFn).memoize(testMemoizeResolverFn).value()); -// _.modArgs -module TestModArgs { +// _.overArgs +module TestOverArgs { type Func1 = (a: boolean) => boolean; type Func2 = (a: boolean, b: boolean) => boolean; @@ -6007,43 +6007,43 @@ module TestModArgs { { let result: (a: string) => boolean; - result = _.modArgs boolean>(func1, transform1); - result = _.modArgs boolean>(func1, [transform1]); + result = _.overArgs boolean>(func1, transform1); + result = _.overArgs boolean>(func1, [transform1]); } { let result: (a: string, b: number) => boolean; - result = _.modArgs boolean>(func2, transform1, transform2); - result = _.modArgs boolean>(func2, [transform1, transform2]); + result = _.overArgs boolean>(func2, transform1, transform2); + result = _.overArgs boolean>(func2, [transform1, transform2]); } { let result: _.LoDashImplicitObjectWrapper<(a: string) => boolean>; - result = _(func1).modArgs<(a: string) => boolean>(transform1); - result = _(func1).modArgs<(a: string) => boolean>([transform1]); + result = _(func1).overArgs<(a: string) => boolean>(transform1); + result = _(func1).overArgs<(a: string) => boolean>([transform1]); } { let result: _.LoDashImplicitObjectWrapper<(a: string, b: number) => boolean>; - result = _(func2).modArgs<(a: string, b: number) => boolean>(transform1, transform2); - result = _(func2).modArgs<(a: string, b: number) => boolean>([transform1, transform2]); + result = _(func2).overArgs<(a: string, b: number) => boolean>(transform1, transform2); + result = _(func2).overArgs<(a: string, b: number) => boolean>([transform1, transform2]); } { let result: _.LoDashExplicitObjectWrapper<(a: string) => boolean>; - result = _(func1).chain().modArgs<(a: string) => boolean>(transform1); - result = _(func1).chain().modArgs<(a: string) => boolean>([transform1]); + result = _(func1).chain().overArgs<(a: string) => boolean>(transform1); + result = _(func1).chain().overArgs<(a: string) => boolean>([transform1]); } { let result: _.LoDashExplicitObjectWrapper<(a: string, b: number) => boolean>; - result = _(func2).chain().modArgs<(a: string, b: number) => boolean>(transform1, transform2); - result = _(func2).chain().modArgs<(a: string, b: number) => boolean>([transform1, transform2]); + result = _(func2).chain().overArgs<(a: string, b: number) => boolean>(transform1, transform2); + result = _(func2).chain().overArgs<(a: string, b: number) => boolean>([transform1, transform2]); } } diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index a713c97d7..5212735dc 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -21,7 +21,7 @@ TODO: - [x] Renamed _.first to _.head - [x] Renamed _.indexBy to _.keyBy - [x] Renamed _.invoke to _.invokeMap -- [ ] Renamed _.modArgs to _.overArgs +- [x] Renamed _.overArgs to _.overArgs - [ ] Renamed _.padLeft & _.padRight to _.padStart & _.padEnd - [ ] Renamed _.pairs to _.toPairs - [ ] Renamed _.rest to _.tail @@ -9620,7 +9620,7 @@ declare module _ { memoize(resolver?: Function): LoDashImplicitObjectWrapper; } - //_.modArgs + //_.overArgs (was _.modArgs) interface LoDashStatic { /** * Creates a function that runs each argument through a corresponding transform function. @@ -9630,15 +9630,15 @@ declare module _ { * of functions. * @return Returns the new function. */ - modArgs( + overArgs( func: T, ...transforms: Function[] ): TResult; /** - * @see _.modArgs + * @see _.overArgs */ - modArgs( + overArgs( func: T, transforms: Function[] ): TResult; @@ -9646,26 +9646,26 @@ declare module _ { interface LoDashImplicitObjectWrapper { /** - * @see _.modArgs + * @see _.overArgs */ - modArgs(...transforms: Function[]): LoDashImplicitObjectWrapper; + overArgs(...transforms: Function[]): LoDashImplicitObjectWrapper; /** - * @see _.modArgs + * @see _.overArgs */ - modArgs(transforms: Function[]): LoDashImplicitObjectWrapper; + overArgs(transforms: Function[]): LoDashImplicitObjectWrapper; } interface LoDashExplicitObjectWrapper { /** - * @see _.modArgs + * @see _.overArgs */ - modArgs(...transforms: Function[]): LoDashExplicitObjectWrapper; + overArgs(...transforms: Function[]): LoDashExplicitObjectWrapper; /** - * @see _.modArgs + * @see _.overArgs */ - modArgs(transforms: Function[]): LoDashExplicitObjectWrapper; + overArgs(transforms: Function[]): LoDashExplicitObjectWrapper; } //_.negate From 6c45e1efa3dc97c6a60a988fe9aa283bf5c1f21d Mon Sep 17 00:00:00 2001 From: DomiR Date: Wed, 13 Jan 2016 18:59:53 +0100 Subject: [PATCH 06/51] (feature) Renamed _.padLeft & _.padRight to _.padStart & _.padEnd --- lodash/lodash-tests.ts | 44 +++++++++++++++++++++--------------------- lodash/lodash.d.ts | 28 +++++++++++++-------------- 2 files changed, 35 insertions(+), 37 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 39d3d5f6f..15509fd77 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -9010,49 +9010,49 @@ module TestPad { } } -// _.padLeft -module TestPadLeft { +// _.padStart +module TestPadStart { { let result: string; - result = _.padLeft('abc'); - result = _.padLeft('abc', 6); - result = _.padLeft('abc', 6, '_-'); + result = _.padStart('abc'); + result = _.padStart('abc', 6); + result = _.padStart('abc', 6, '_-'); - result = _('abc').padLeft(); - result = _('abc').padLeft(6); - result = _('abc').padLeft(6, '_-'); + result = _('abc').padStart(); + result = _('abc').padStart(6); + result = _('abc').padStart(6, '_-'); } { let result: _.LoDashExplicitWrapper; - result = _('abc').chain().padLeft(); - result = _('abc').chain().padLeft(6); - result = _('abc').chain().padLeft(6, '_-'); + result = _('abc').chain().padStart(); + result = _('abc').chain().padStart(6); + result = _('abc').chain().padStart(6, '_-'); } } -// _.padRight -module TestPadRight { +// _.padEnd +module TestPadEnd { { let result: string; - result = _.padRight('abc'); - result = _.padRight('abc', 6); - result = _.padRight('abc', 6, '_-'); + result = _.padEnd('abc'); + result = _.padEnd('abc', 6); + result = _.padEnd('abc', 6, '_-'); - result = _('abc').padRight(); - result = _('abc').padRight(6); - result = _('abc').padRight(6, '_-'); + result = _('abc').padEnd(); + result = _('abc').padEnd(6); + result = _('abc').padEnd(6, '_-'); } { let result: _.LoDashExplicitWrapper; - result = _('abc').chain().padRight(); - result = _('abc').chain().padRight(6); - result = _('abc').chain().padRight(6, '_-'); + result = _('abc').chain().padEnd(); + result = _('abc').chain().padEnd(6); + result = _('abc').chain().padEnd(6, '_-'); } } diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 5212735dc..0e7ea8fd7 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -9,9 +9,7 @@ TODO: - [ ] Made _.forEach, _.forIn, _.forOwn, & _.times implicitly end a chain sequence -- [ ] Removed _.pluck in favor of _.map with iteratee shorthand - [ ] Removed thisArg params from most methods -- [ ] Split _.max & _.min into _.maxBy & _.minBy - [x] Removed _.support - [x] Removed _.findWhere in favor of _.find with iteratee shorthand @@ -22,7 +20,7 @@ TODO: - [x] Renamed _.indexBy to _.keyBy - [x] Renamed _.invoke to _.invokeMap - [x] Renamed _.overArgs to _.overArgs -- [ ] Renamed _.padLeft & _.padRight to _.padStart & _.padEnd +- [x] Renamed _.padLeft & _.padRight to _.padStart & _.padEnd - [ ] Renamed _.pairs to _.toPairs - [ ] Renamed _.rest to _.tail - [ ] Renamed _.restParam to _.rest @@ -13805,7 +13803,7 @@ declare module _ { ): LoDashExplicitWrapper; } - //_.padLeft + //_.padStart interface LoDashStatic { /** * Pads string on the left side if it’s shorter than length. Padding characters are truncated if they exceed @@ -13816,7 +13814,7 @@ declare module _ { * @param chars The string used as padding. * @return Returns the padded string. */ - padLeft( + padStart( string?: string, length?: number, chars?: string @@ -13825,9 +13823,9 @@ declare module _ { interface LoDashImplicitWrapper { /** - * @see _.padLeft + * @see _.padStart */ - padLeft( + padStart( length?: number, chars?: string ): string; @@ -13835,15 +13833,15 @@ declare module _ { interface LoDashExplicitWrapper { /** - * @see _.padLeft + * @see _.padStart */ - padLeft( + padStart( length?: number, chars?: string ): LoDashExplicitWrapper; } - //_.padRight + //_.padEnd interface LoDashStatic { /** * Pads string on the right side if it’s shorter than length. Padding characters are truncated if they exceed @@ -13854,7 +13852,7 @@ declare module _ { * @param chars The string used as padding. * @return Returns the padded string. */ - padRight( + padEnd( string?: string, length?: number, chars?: string @@ -13863,9 +13861,9 @@ declare module _ { interface LoDashImplicitWrapper { /** - * @see _.padRight + * @see _.padEnd */ - padRight( + padEnd( length?: number, chars?: string ): string; @@ -13873,9 +13871,9 @@ declare module _ { interface LoDashExplicitWrapper { /** - * @see _.padRight + * @see _.padEnd */ - padRight( + padEnd( length?: number, chars?: string ): LoDashExplicitWrapper; From 654d36379b2e071c41add511bd3c585d07d669f0 Mon Sep 17 00:00:00 2001 From: DomiR Date: Wed, 13 Jan 2016 19:01:39 +0100 Subject: [PATCH 07/51] (feature) Renamed _.pairs to _.toPairs --- lodash/lodash-tests.ts | 16 ++++++++-------- lodash/lodash.d.ts | 16 ++++++++-------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 15509fd77..7ff608f52 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -8627,44 +8627,44 @@ module TestOmit { } } -// _.pairs -module TestPairs { +// _.toPairs +module TestToPairs { let object: _.Dictionary; { let result: any[][]; - result = _.pairs<_.Dictionary>(object); + result = _.toPairs<_.Dictionary>(object); } { let result: string[][]; - result = _.pairs<_.Dictionary, string>(object); + result = _.toPairs<_.Dictionary, string>(object); } { let result: _.LoDashImplicitArrayWrapper; - result = _(object).pairs(); + result = _(object).toPairs(); } { let result: _.LoDashImplicitArrayWrapper; - result = _(object).pairs(); + result = _(object).toPairs(); } { let result: _.LoDashExplicitArrayWrapper; - result = _(object).chain().pairs(); + result = _(object).chain().toPairs(); } { let result: _.LoDashExplicitArrayWrapper; - result = _(object).chain().pairs(); + result = _(object).chain().toPairs(); } } diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 0e7ea8fd7..49fba82c3 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -21,7 +21,7 @@ TODO: - [x] Renamed _.invoke to _.invokeMap - [x] Renamed _.overArgs to _.overArgs - [x] Renamed _.padLeft & _.padRight to _.padStart & _.padEnd -- [ ] Renamed _.pairs to _.toPairs +- [x] Renamed _.pairs to _.toPairs - [ ] Renamed _.rest to _.tail - [ ] Renamed _.restParam to _.rest - [ ] Renamed _.sortByOrder to _.orderBy @@ -13261,7 +13261,7 @@ declare module _ { ): LoDashExplicitObjectWrapper; } - //_.pairs + //_.toPairs interface LoDashStatic { /** * Creates a two dimensional array of the key-value pairs for object, e.g. [[key1, value1], [key2, value2]]. @@ -13269,23 +13269,23 @@ declare module _ { * @param object The object to query. * @return Returns the new array of key-value pairs. */ - pairs(object?: T): any[][]; + toPairs(object?: T): any[][]; - pairs(object?: T): TResult[][]; + toPairs(object?: T): TResult[][]; } interface LoDashImplicitObjectWrapper { /** - * @see _.pairs + * @see _.toPairs */ - pairs(): LoDashImplicitArrayWrapper; + toPairs(): LoDashImplicitArrayWrapper; } interface LoDashExplicitObjectWrapper { /** - * @see _.pairs + * @see _.toPairs */ - pairs(): LoDashExplicitArrayWrapper; + toPairs(): LoDashExplicitArrayWrapper; } //_.pick From a7699d15e70c986ec4c5fbef9856d3304e66cebd Mon Sep 17 00:00:00 2001 From: DomiR Date: Wed, 13 Jan 2016 19:02:46 +0100 Subject: [PATCH 08/51] (feature) Renamed _.rest to _.tail --- lodash/lodash-tests.ts | 16 ++++++++-------- lodash/lodash.d.ts | 22 +++++++++++----------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 7ff608f52..e342cb7c8 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -1283,31 +1283,31 @@ module TestRemove { } } -// _.rest -module TestRest { +// _.tail +module TestTail { let array: TResult[]; let list: _.List; { let result: TResult[]; - result = _.rest(array); - result = _.rest(list); + result = _.tail(array); + result = _.tail(list); } { let result: _.LoDashImplicitArrayWrapper; - result = _(array).rest(); - result = _(list).rest(); + result = _(array).tail(); + result = _(list).tail(); } { let result: _.LoDashExplicitArrayWrapper; - result = _(array).chain().rest(); - result = _(list).chain().rest(); + result = _(array).chain().tail(); + result = _(list).chain().tail(); } } diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 49fba82c3..fabea5b90 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -22,7 +22,7 @@ TODO: - [x] Renamed _.overArgs to _.overArgs - [x] Renamed _.padLeft & _.padRight to _.padStart & _.padEnd - [x] Renamed _.pairs to _.toPairs -- [ ] Renamed _.rest to _.tail +- [x] Renamed _.rest to _.tail - [ ] Renamed _.restParam to _.rest - [ ] Renamed _.sortByOrder to _.orderBy - [ ] Renamed _.trimLeft & _.trimRight to _.trimStart & _.trimEnd @@ -1977,7 +1977,7 @@ declare module _ { ): LoDashExplicitArrayWrapper; } - //_.rest + //_.tail interface LoDashStatic { /** * Gets all but the first element of array. @@ -1987,35 +1987,35 @@ declare module _ { * @param array The array to query. * @return Returns the slice of array. */ - rest(array: List): T[]; + tail(array: List): T[]; } interface LoDashImplicitArrayWrapper { /** - * @see _.rest + * @see _.tail */ - rest(): LoDashImplicitArrayWrapper; + tail(): LoDashImplicitArrayWrapper; } interface LoDashImplicitObjectWrapper { /** - * @see _.rest + * @see _.tail */ - rest(): LoDashImplicitArrayWrapper; + tail(): LoDashImplicitArrayWrapper; } interface LoDashExplicitArrayWrapper { /** - * @see _.rest + * @see _.tail */ - rest(): LoDashExplicitArrayWrapper; + tail(): LoDashExplicitArrayWrapper; } interface LoDashExplicitObjectWrapper { /** - * @see _.rest + * @see _.tail */ - rest(): LoDashExplicitArrayWrapper; + tail(): LoDashExplicitArrayWrapper; } //_.slice From 324afef7721890dd5e8bc0ca9c2778705c90190c Mon Sep 17 00:00:00 2001 From: DomiR Date: Wed, 13 Jan 2016 19:04:20 +0100 Subject: [PATCH 09/51] (feature) Renamed _.restParam to _.rest --- lodash/lodash-tests.ts | 20 ++++++++++---------- lodash/lodash.d.ts | 18 +++++++++--------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index e342cb7c8..5c2b3d573 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -6132,8 +6132,8 @@ result = (_.rearg(testReargFn, [2, 0, 1]))('b', 'c' result = (_(testReargFn).rearg(2, 0, 1).value())('b', 'c', 'a'); result = (_(testReargFn).rearg([2, 0, 1]).value())('b', 'c', 'a'); -// _.restParam -module TestRestParam { +// _.rest +module TestRest { type Func = (a: string, b: number[]) => boolean; type ResultFunc = (a: string, ...b: number[]) => boolean; @@ -6142,25 +6142,25 @@ module TestRestParam { { let result: ResultFunc; - result = _.restParam(func); - result = _.restParam(func, 1); + result = _.rest(func); + result = _.rest(func, 1); - result = _.restParam(func); - result = _.restParam(func, 1); + result = _.rest(func); + result = _.rest(func, 1); } { let result: _.LoDashImplicitObjectWrapper; - result = _(func).restParam(); - result = _(func).restParam(1); + result = _(func).rest(); + result = _(func).rest(1); } { let result: _.LoDashExplicitObjectWrapper; - result = _(func).chain().restParam(); - result = _(func).chain().restParam(1); + result = _(func).chain().rest(); + result = _(func).chain().rest(1); } } diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index fabea5b90..05f51816e 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -23,7 +23,7 @@ TODO: - [x] Renamed _.padLeft & _.padRight to _.padStart & _.padEnd - [x] Renamed _.pairs to _.toPairs - [x] Renamed _.rest to _.tail -- [ ] Renamed _.restParam to _.rest +- [x] Renamed _.restParam to _.rest - [ ] Renamed _.sortByOrder to _.orderBy - [ ] Renamed _.trimLeft & _.trimRight to _.trimStart & _.trimEnd - [ ] Renamed _.trunc to _.truncate @@ -9888,7 +9888,7 @@ declare module _ { rearg(...indexes: number[]): LoDashImplicitObjectWrapper; } - //_.restParam + //_.rest interface LoDashStatic { /** * Creates a function that invokes func with the this binding of the created function and arguments from start @@ -9900,15 +9900,15 @@ declare module _ { * @param start The start position of the rest parameter. * @return Returns the new function. */ - restParam( + rest( func: Function, start?: number ): TResult; /** - * @see _.restParam + * @see _.rest */ - restParam( + rest( func: TFunc, start?: number ): TResult; @@ -9916,16 +9916,16 @@ declare module _ { interface LoDashImplicitObjectWrapper { /** - * @see _.restParam + * @see _.rest */ - restParam(start?: number): LoDashImplicitObjectWrapper; + rest(start?: number): LoDashImplicitObjectWrapper; } interface LoDashExplicitObjectWrapper { /** - * @see _.restParam + * @see _.rest */ - restParam(start?: number): LoDashExplicitObjectWrapper; + rest(start?: number): LoDashExplicitObjectWrapper; } //_.spread From 515bcddd071a914f8bd627fd90de9df58983e454 Mon Sep 17 00:00:00 2001 From: DomiR Date: Wed, 13 Jan 2016 19:05:43 +0100 Subject: [PATCH 10/51] (feature) Renamed _.sortByOrder to _.orderBy --- lodash/lodash-tests.ts | 96 +++++++++++++++++++++--------------------- lodash/lodash.d.ts | 90 +++++++++++++++++++-------------------- 2 files changed, 93 insertions(+), 93 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 5c2b3d573..d0d3c94aa 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -5291,8 +5291,8 @@ module TestSortByAll { } } -// _.sortByOrder -module TestSortByOrder { +// _.orderBy +module TestorderBy { type SampleObject = {a: number; b: string; c: boolean}; let array: SampleObject[]; @@ -5305,79 +5305,79 @@ module TestSortByOrder { let iteratees: (value: string) => any|((value: string) => any)[]; let result: string[]; - result = _.sortByOrder('acbd', iteratees); - result = _.sortByOrder('acbd', iteratees, orders); + result = _.orderBy('acbd', iteratees); + result = _.orderBy('acbd', iteratees, orders); } { let iteratees: (value: SampleObject) => any|string|{a: number}|((value: SampleObject) => any|string|{a: number})[]; let result: SampleObject[]; - result = _.sortByOrder<{a: number}, SampleObject>(array, iteratees); - result = _.sortByOrder<{a: number}, SampleObject>(array, iteratees, orders); - result = _.sortByOrder(array, iteratees); - result = _.sortByOrder(array, iteratees, orders); + result = _.orderBy<{a: number}, SampleObject>(array, iteratees); + result = _.orderBy<{a: number}, SampleObject>(array, iteratees, orders); + result = _.orderBy(array, iteratees); + result = _.orderBy(array, iteratees, orders); - result = _.sortByOrder<{a: number}, SampleObject>(list, iteratees); - result = _.sortByOrder<{a: number}, SampleObject>(list, iteratees, orders); - result = _.sortByOrder(list, iteratees); - result = _.sortByOrder(list, iteratees, orders); + result = _.orderBy<{a: number}, SampleObject>(list, iteratees); + result = _.orderBy<{a: number}, SampleObject>(list, iteratees, orders); + result = _.orderBy(list, iteratees); + result = _.orderBy(list, iteratees, orders); - result = _.sortByOrder<{a: number}, SampleObject>(numericDictionary, iteratees); - result = _.sortByOrder<{a: number}, SampleObject>(numericDictionary, iteratees, orders); - result = _.sortByOrder(numericDictionary, iteratees); - result = _.sortByOrder(numericDictionary, iteratees, orders); + result = _.orderBy<{a: number}, SampleObject>(numericDictionary, iteratees); + result = _.orderBy<{a: number}, SampleObject>(numericDictionary, iteratees, orders); + result = _.orderBy(numericDictionary, iteratees); + result = _.orderBy(numericDictionary, iteratees, orders); - result = _.sortByOrder<{a: number}, SampleObject>(dictionary, iteratees); - result = _.sortByOrder<{a: number}, SampleObject>(dictionary, iteratees, orders); - result = _.sortByOrder(dictionary, iteratees); - result = _.sortByOrder(dictionary, iteratees, orders); + result = _.orderBy<{a: number}, SampleObject>(dictionary, iteratees); + result = _.orderBy<{a: number}, SampleObject>(dictionary, iteratees, orders); + result = _.orderBy(dictionary, iteratees); + result = _.orderBy(dictionary, iteratees, orders); } { let iteratees: (value: SampleObject) => any|string|{a: number}|((value: SampleObject) => any|string|{a: number})[]; let result: _.LoDashImplicitArrayWrapper; - result = _(array).sortByOrder<{a: number}>(iteratees); - result = _(array).sortByOrder<{a: number}>(iteratees, orders); + result = _(array).orderBy<{a: number}>(iteratees); + result = _(array).orderBy<{a: number}>(iteratees, orders); - result = _(list).sortByOrder<{a: number}, SampleObject>(iteratees); - result = _(list).sortByOrder<{a: number}, SampleObject>(iteratees, orders); - result = _(list).sortByOrder(iteratees); - result = _(list).sortByOrder(iteratees, orders); + result = _(list).orderBy<{a: number}, SampleObject>(iteratees); + result = _(list).orderBy<{a: number}, SampleObject>(iteratees, orders); + result = _(list).orderBy(iteratees); + result = _(list).orderBy(iteratees, orders); - result = _(numericDictionary).sortByOrder<{a: number}, SampleObject>(iteratees); - result = _(numericDictionary).sortByOrder<{a: number}, SampleObject>(iteratees, orders); - result = _(numericDictionary).sortByOrder(iteratees); - result = _(numericDictionary).sortByOrder(iteratees, orders); + result = _(numericDictionary).orderBy<{a: number}, SampleObject>(iteratees); + result = _(numericDictionary).orderBy<{a: number}, SampleObject>(iteratees, orders); + result = _(numericDictionary).orderBy(iteratees); + result = _(numericDictionary).orderBy(iteratees, orders); - result = _(dictionary).sortByOrder<{a: number}, SampleObject>(iteratees); - result = _(dictionary).sortByOrder<{a: number}, SampleObject>(iteratees, orders); - result = _(dictionary).sortByOrder(iteratees); - result = _(dictionary).sortByOrder(iteratees, orders); + result = _(dictionary).orderBy<{a: number}, SampleObject>(iteratees); + result = _(dictionary).orderBy<{a: number}, SampleObject>(iteratees, orders); + result = _(dictionary).orderBy(iteratees); + result = _(dictionary).orderBy(iteratees, orders); } { let iteratees: (value: SampleObject) => any|string|{a: number}|((value: SampleObject) => any|string|{a: number})[]; let result: _.LoDashExplicitArrayWrapper; - result = _(array).chain().sortByOrder<{a: number}>(iteratees); - result = _(array).chain().sortByOrder<{a: number}>(iteratees, orders); + result = _(array).chain().orderBy<{a: number}>(iteratees); + result = _(array).chain().orderBy<{a: number}>(iteratees, orders); - result = _(list).chain().sortByOrder<{a: number}, SampleObject>(iteratees); - result = _(list).chain().sortByOrder<{a: number}, SampleObject>(iteratees, orders); - result = _(list).chain().sortByOrder(iteratees); - result = _(list).chain().sortByOrder(iteratees, orders); + result = _(list).chain().orderBy<{a: number}, SampleObject>(iteratees); + result = _(list).chain().orderBy<{a: number}, SampleObject>(iteratees, orders); + result = _(list).chain().orderBy(iteratees); + result = _(list).chain().orderBy(iteratees, orders); - result = _(numericDictionary).chain().sortByOrder<{a: number}, SampleObject>(iteratees); - result = _(numericDictionary).chain().sortByOrder<{a: number}, SampleObject>(iteratees, orders); - result = _(numericDictionary).chain().sortByOrder(iteratees); - result = _(numericDictionary).chain().sortByOrder(iteratees, orders); + result = _(numericDictionary).chain().orderBy<{a: number}, SampleObject>(iteratees); + result = _(numericDictionary).chain().orderBy<{a: number}, SampleObject>(iteratees, orders); + result = _(numericDictionary).chain().orderBy(iteratees); + result = _(numericDictionary).chain().orderBy(iteratees, orders); - result = _(dictionary).chain().sortByOrder<{a: number}, SampleObject>(iteratees); - result = _(dictionary).chain().sortByOrder<{a: number}, SampleObject>(iteratees, orders); - result = _(dictionary).chain().sortByOrder(iteratees); - result = _(dictionary).chain().sortByOrder(iteratees, orders); + result = _(dictionary).chain().orderBy<{a: number}, SampleObject>(iteratees); + result = _(dictionary).chain().orderBy<{a: number}, SampleObject>(iteratees, orders); + result = _(dictionary).chain().orderBy(iteratees); + result = _(dictionary).chain().orderBy(iteratees, orders); } } diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 05f51816e..75bf6baac 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -24,7 +24,7 @@ TODO: - [x] Renamed _.pairs to _.toPairs - [x] Renamed _.rest to _.tail - [x] Renamed _.restParam to _.rest -- [ ] Renamed _.sortByOrder to _.orderBy +- [x] Renamed _.sortByOrder to _.orderBy - [ ] Renamed _.trimLeft & _.trimRight to _.trimStart & _.trimEnd - [ ] Renamed _.trunc to _.truncate @@ -8671,7 +8671,7 @@ declare module _ { ): LoDashExplicitArrayWrapper; } - //_.sortByOrder + //_.orderBy interface LoDashStatic { /** * This method is like _.sortByAll except that it allows specifying the sort orders of the iteratees to sort @@ -8689,52 +8689,52 @@ declare module _ { * @param orders The sort orders of iteratees. * @return Returns the new sorted array. */ - sortByOrder( + orderBy( collection: List, iteratees: ListIterator|string|W|(ListIterator|string|W)[], orders?: boolean|string|(boolean|string)[] ): T[]; /** - * @see _.sortByOrder + * @see _.orderBy */ - sortByOrder( + orderBy( collection: List, iteratees: ListIterator|string|Object|(ListIterator|string|Object)[], orders?: boolean|string|(boolean|string)[] ): T[]; /** - * @see _.sortByOrder + * @see _.orderBy */ - sortByOrder( + orderBy( collection: NumericDictionary, iteratees: NumericDictionaryIterator|string|W|(NumericDictionaryIterator|string|W)[], orders?: boolean|string|(boolean|string)[] ): T[]; /** - * @see _.sortByOrder + * @see _.orderBy */ - sortByOrder( + orderBy( collection: NumericDictionary, iteratees: NumericDictionaryIterator|string|Object|(NumericDictionaryIterator|string|Object)[], orders?: boolean|string|(boolean|string)[] ): T[]; /** - * @see _.sortByOrder + * @see _.orderBy */ - sortByOrder( + orderBy( collection: Dictionary, iteratees: DictionaryIterator|string|W|(DictionaryIterator|string|W)[], orders?: boolean|string|(boolean|string)[] ): T[]; /** - * @see _.sortByOrder + * @see _.orderBy */ - sortByOrder( + orderBy( collection: Dictionary, iteratees: DictionaryIterator|string|Object|(DictionaryIterator|string|Object)[], orders?: boolean|string|(boolean|string)[] @@ -8743,9 +8743,9 @@ declare module _ { interface LoDashImplicitWrapper { /** - * @see _.sortByOrder + * @see _.orderBy */ - sortByOrder( + orderBy( iteratees: ListIterator|string|(ListIterator|string)[], orders?: boolean|string|(boolean|string)[] ): LoDashImplicitArrayWrapper; @@ -8753,9 +8753,9 @@ declare module _ { interface LoDashImplicitArrayWrapper { /** - * @see _.sortByOrder + * @see _.orderBy */ - sortByOrder( + orderBy( iteratees: ListIterator|string|W|(ListIterator|string|W)[], orders?: boolean|string|(boolean|string)[] ): LoDashImplicitArrayWrapper; @@ -8763,49 +8763,49 @@ declare module _ { interface LoDashImplicitObjectWrapper { /** - * @see _.sortByOrder + * @see _.orderBy */ - sortByOrder( + orderBy( iteratees: ListIterator|string|W|(ListIterator|string|W)[], orders?: boolean|string|(boolean|string)[] ): LoDashImplicitArrayWrapper; /** - * @see _.sortByOrder + * @see _.orderBy */ - sortByOrder( + orderBy( iteratees: ListIterator|string|Object|(ListIterator|string|Object)[], orders?: boolean|string|(boolean|string)[] ): LoDashImplicitArrayWrapper; /** - * @see _.sortByOrder + * @see _.orderBy */ - sortByOrder( + orderBy( iteratees: NumericDictionaryIterator|string|W|(NumericDictionaryIterator|string|W)[], orders?: boolean|string|(boolean|string)[] ): LoDashImplicitArrayWrapper; /** - * @see _.sortByOrder + * @see _.orderBy */ - sortByOrder( + orderBy( iteratees: NumericDictionaryIterator|string|Object|(NumericDictionaryIterator|string|Object)[], orders?: boolean|string|(boolean|string)[] ): LoDashImplicitArrayWrapper; /** - * @see _.sortByOrder + * @see _.orderBy */ - sortByOrder( + orderBy( iteratees: DictionaryIterator|string|W|(DictionaryIterator|string|W)[], orders?: boolean|string|(boolean|string)[] ): LoDashImplicitArrayWrapper; /** - * @see _.sortByOrder + * @see _.orderBy */ - sortByOrder( + orderBy( iteratees: DictionaryIterator|string|Object|(DictionaryIterator|string|Object)[], orders?: boolean|string|(boolean|string)[] ): LoDashImplicitArrayWrapper; @@ -8813,9 +8813,9 @@ declare module _ { interface LoDashExplicitWrapper { /** - * @see _.sortByOrder + * @see _.orderBy */ - sortByOrder( + orderBy( iteratees: ListIterator|string|(ListIterator|string)[], orders?: boolean|string|(boolean|string)[] ): LoDashExplicitArrayWrapper; @@ -8823,9 +8823,9 @@ declare module _ { interface LoDashExplicitArrayWrapper { /** - * @see _.sortByOrder + * @see _.orderBy */ - sortByOrder( + orderBy( iteratees: ListIterator|string|W|(ListIterator|string|W)[], orders?: boolean|string|(boolean|string)[] ): LoDashExplicitArrayWrapper; @@ -8833,49 +8833,49 @@ declare module _ { interface LoDashExplicitObjectWrapper { /** - * @see _.sortByOrder + * @see _.orderBy */ - sortByOrder( + orderBy( iteratees: ListIterator|string|W|(ListIterator|string|W)[], orders?: boolean|string|(boolean|string)[] ): LoDashExplicitArrayWrapper; /** - * @see _.sortByOrder + * @see _.orderBy */ - sortByOrder( + orderBy( iteratees: ListIterator|string|Object|(ListIterator|string|Object)[], orders?: boolean|string|(boolean|string)[] ): LoDashExplicitArrayWrapper; /** - * @see _.sortByOrder + * @see _.orderBy */ - sortByOrder( + orderBy( iteratees: NumericDictionaryIterator|string|W|(NumericDictionaryIterator|string|W)[], orders?: boolean|string|(boolean|string)[] ): LoDashExplicitArrayWrapper; /** - * @see _.sortByOrder + * @see _.orderBy */ - sortByOrder( + orderBy( iteratees: NumericDictionaryIterator|string|Object|(NumericDictionaryIterator|string|Object)[], orders?: boolean|string|(boolean|string)[] ): LoDashExplicitArrayWrapper; /** - * @see _.sortByOrder + * @see _.orderBy */ - sortByOrder( + orderBy( iteratees: DictionaryIterator|string|W|(DictionaryIterator|string|W)[], orders?: boolean|string|(boolean|string)[] ): LoDashExplicitArrayWrapper; /** - * @see _.sortByOrder + * @see _.orderBy */ - sortByOrder( + orderBy( iteratees: DictionaryIterator|string|Object|(DictionaryIterator|string|Object)[], orders?: boolean|string|(boolean|string)[] ): LoDashExplicitArrayWrapper; From 63157c261eca23f05555ae57ee53a49203aacf41 Mon Sep 17 00:00:00 2001 From: DomiR Date: Wed, 13 Jan 2016 19:07:06 +0100 Subject: [PATCH 11/51] (feature) Renamed _.trimLeft & _.trimRight to _.trimStart & _.trimEnd --- lodash/lodash-tests.ts | 37 ++++++++++++++++++------------------- lodash/lodash.d.ts | 26 +++++++++++++------------- 2 files changed, 31 insertions(+), 32 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index d0d3c94aa..d2ef64326 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -9203,46 +9203,45 @@ module TestTrim { } } -// _.trimLeft -module TestTrimLeft { +// _.trimStart +module TestTrimStart { { let result: string; - result = _.trimLeft(); - result = _.trimLeft(' abc '); - result = _.trimLeft('-_-abc-_-', '_-'); + result = _.trimStart(); + result = _.trimStart(' abc '); + result = _.trimStart('-_-abc-_-', '_-'); - result = _('-_-abc-_-').trimLeft(); - result = _('-_-abc-_-').trimLeft('_-'); + result = _('-_-abc-_-').trimStart(); + result = _('-_-abc-_-').trimStart('_-'); } { let result: _.LoDashExplicitWrapper; - result = _('-_-abc-_-').chain().trimLeft(); - result = _('-_-abc-_-').chain().trimLeft('_-'); + result = _('-_-abc-_-').chain().trimStart(); + result = _('-_-abc-_-').chain().trimStart('_-'); } } -// _.trimRight - -module TestTrimRight { +// _.trimEnd +module TestTrimEnd { { let result: string; - result = _.trimRight(); - result = _.trimRight(' abc '); - result = _.trimRight('-_-abc-_-', '_-'); + result = _.trimEnd(); + result = _.trimEnd(' abc '); + result = _.trimEnd('-_-abc-_-', '_-'); - result = _('-_-abc-_-').trimRight(); - result = _('-_-abc-_-').trimRight('_-'); + result = _('-_-abc-_-').trimEnd(); + result = _('-_-abc-_-').trimEnd('_-'); } { let result: _.LoDashExplicitWrapper; - result = _('-_-abc-_-').chain().trimRight(); - result = _('-_-abc-_-').chain().trimRight('_-'); + result = _('-_-abc-_-').chain().trimEnd(); + result = _('-_-abc-_-').chain().trimEnd('_-'); } } diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 75bf6baac..e88e628d7 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -25,7 +25,7 @@ TODO: - [x] Renamed _.rest to _.tail - [x] Renamed _.restParam to _.rest - [x] Renamed _.sortByOrder to _.orderBy -- [ ] Renamed _.trimLeft & _.trimRight to _.trimStart & _.trimEnd +- [x] Renamed _.trimLeft & _.trimRight to _.trimStart & _.trimEnd - [ ] Renamed _.trunc to _.truncate - [ ] Split _.indexOf & _.lastIndexOf into _.sortedIndexOf & _.sortedLastIndexOf @@ -14116,7 +14116,7 @@ declare module _ { trim(chars?: string): LoDashExplicitWrapper; } - //_.trimLeft + //_.trimStart interface LoDashStatic { /** * Removes leading whitespace or specified characters from string. @@ -14125,7 +14125,7 @@ declare module _ { * @param chars The characters to trim. * @return Returns the trimmed string. */ - trimLeft( + trimStart( string?: string, chars?: string ): string; @@ -14133,19 +14133,19 @@ declare module _ { interface LoDashImplicitWrapper { /** - * @see _.trimLeft + * @see _.trimStart */ - trimLeft(chars?: string): string; + trimStart(chars?: string): string; } interface LoDashExplicitWrapper { /** - * @see _.trimLeft + * @see _.trimStart */ - trimLeft(chars?: string): LoDashExplicitWrapper; + trimStart(chars?: string): LoDashExplicitWrapper; } - //_.trimRight + //_.trimEnd interface LoDashStatic { /** * Removes trailing whitespace or specified characters from string. @@ -14154,7 +14154,7 @@ declare module _ { * @param chars The characters to trim. * @return Returns the trimmed string. */ - trimRight( + trimEnd( string?: string, chars?: string ): string; @@ -14162,16 +14162,16 @@ declare module _ { interface LoDashImplicitWrapper { /** - * @see _.trimRight + * @see _.trimEnd */ - trimRight(chars?: string): string; + trimEnd(chars?: string): string; } interface LoDashExplicitWrapper { /** - * @see _.trimRight + * @see _.trimEnd */ - trimRight(chars?: string): LoDashExplicitWrapper; + trimEnd(chars?: string): LoDashExplicitWrapper; } //_.trunc From 27cb7c84ccd308f1d65e97643edd9a9fd40e71bd Mon Sep 17 00:00:00 2001 From: DomiR Date: Wed, 13 Jan 2016 19:09:18 +0100 Subject: [PATCH 12/51] (feature) Renamed _.trunc to _.truncate --- lodash/lodash-tests.ts | 34 +++++++++++++++++----------------- lodash/lodash.d.ts | 16 ++++++++-------- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index d2ef64326..f8318107e 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -9245,32 +9245,32 @@ module TestTrimEnd { } } -// _.trunc -module TestTrunc { +// _.truncate +module Testtruncate { { let result: string; - result = _.trunc('hi-diddly-ho there, neighborino'); - result = _.trunc('hi-diddly-ho there, neighborino', 24); - result = _.trunc('hi-diddly-ho there, neighborino', { 'length': 24, 'separator': ' ' }); - result = _.trunc('hi-diddly-ho there, neighborino', { 'length': 24, 'separator': /,? +/ }); - result = _.trunc('hi-diddly-ho there, neighborino', { 'omission': ' […]' }); + result = _.truncate('hi-diddly-ho there, neighborino'); + result = _.truncate('hi-diddly-ho there, neighborino', 24); + result = _.truncate('hi-diddly-ho there, neighborino', { 'length': 24, 'separator': ' ' }); + result = _.truncate('hi-diddly-ho there, neighborino', { 'length': 24, 'separator': /,? +/ }); + result = _.truncate('hi-diddly-ho there, neighborino', { 'omission': ' […]' }); - result = _('hi-diddly-ho there, neighborino').trunc(); - result = _('hi-diddly-ho there, neighborino').trunc(24); - result = _('hi-diddly-ho there, neighborino').trunc({ 'length': 24, 'separator': ' ' }); - result = _('hi-diddly-ho there, neighborino').trunc({ 'length': 24, 'separator': /,? +/ }); - result = _('hi-diddly-ho there, neighborino').trunc({ 'omission': ' […]' }); + result = _('hi-diddly-ho there, neighborino').truncate(); + result = _('hi-diddly-ho there, neighborino').truncate(24); + result = _('hi-diddly-ho there, neighborino').truncate({ 'length': 24, 'separator': ' ' }); + result = _('hi-diddly-ho there, neighborino').truncate({ 'length': 24, 'separator': /,? +/ }); + result = _('hi-diddly-ho there, neighborino').truncate({ 'omission': ' […]' }); } { let result: _.LoDashExplicitWrapper; - result = _('hi-diddly-ho there, neighborino').chain().trunc(); - result = _('hi-diddly-ho there, neighborino').chain().trunc(24); - result = _('hi-diddly-ho there, neighborino').chain().trunc({ 'length': 24, 'separator': ' ' }); - result = _('hi-diddly-ho there, neighborino').chain().trunc({ 'length': 24, 'separator': /,? +/ }); - result = _('hi-diddly-ho there, neighborino').chain().trunc({ 'omission': ' […]' }); + result = _('hi-diddly-ho there, neighborino').chain().truncate(); + result = _('hi-diddly-ho there, neighborino').chain().truncate(24); + result = _('hi-diddly-ho there, neighborino').chain().truncate({ 'length': 24, 'separator': ' ' }); + result = _('hi-diddly-ho there, neighborino').chain().truncate({ 'length': 24, 'separator': /,? +/ }); + result = _('hi-diddly-ho there, neighborino').chain().truncate({ 'omission': ' […]' }); } } diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index e88e628d7..f12d06ada 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -14174,8 +14174,8 @@ declare module _ { trimEnd(chars?: string): LoDashExplicitWrapper; } - //_.trunc - interface TruncOptions { + //_.truncate + interface TruncateOptions { /** The maximum string length. */ length?: number; /** The string to indicate text is omitted. */ @@ -14193,24 +14193,24 @@ declare module _ { * @param options The options object or maximum string length. * @return Returns the truncated string. */ - trunc( + truncate( string?: string, - options?: TruncOptions|number + options?: TruncateOptions|number ): string; } interface LoDashImplicitWrapper { /** - * @see _.trunc + * @see _.truncate */ - trunc(options?: TruncOptions|number): string; + truncate(options?: TruncateOptions|number): string; } interface LoDashExplicitWrapper { /** - * @see _.trunc + * @see _.truncate */ - trunc(options?: TruncOptions|number): LoDashExplicitWrapper; + truncate(options?: TruncateOptions|number): LoDashExplicitWrapper; } //_.unescape From aebe3d44cababeb3d324e77d42bdd0edde0da4e3 Mon Sep 17 00:00:00 2001 From: DomiR Date: Wed, 13 Jan 2016 19:20:39 +0100 Subject: [PATCH 13/51] (feature) Split _.max & _.min into _.maxBy & _.minBy --- lodash/lodash-tests.ts | 147 +++++++++-------- lodash/lodash.d.ts | 349 ++++++++++++++++++++++++----------------- 2 files changed, 286 insertions(+), 210 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index f8318107e..41b80f49c 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -7185,52 +7185,18 @@ module TestFloor { module TestMax { let array: number[]; let list: _.List; - let dictionary: _.Dictionary; - - let listIterator: (value: number, index: number, collection: _.List) => number; - let dictionaryIterator: (value: number, key: string, collection: _.Dictionary) => number; let result: number; result = _.max(array); - result = _.max(array, listIterator); - result = _.max(array, listIterator, any); - result = _.max(array, ''); - result = _.max<{a: number}, number>(array, {a: 42}); - result = _.max(list); - result = _.max(list, listIterator); - result = _.max(list, listIterator, any); - result = _.max(list, ''); - result = _.max<{a: number}, number>(list, {a: 42}); - - result = _.max(dictionary); - result = _.max(dictionary, dictionaryIterator); - result = _.max(dictionary, dictionaryIterator, any); - result = _.max(dictionary, ''); - result = _.max<{a: number}, number>(dictionary, {a: 42}); result = _(array).max(); - result = _(array).max(listIterator); - result = _(array).max(listIterator, any); - result = _(array).max(''); - result = _(array).max<{a: number}>({a: 42}); - result = _(list).max(); - result = _(list).max(listIterator); - result = _(list).max(listIterator, any); - result = _(list).max(''); - result = _(list).max<{a: number}, number>({a: 42}); - - result = _(dictionary).max(); - result = _(dictionary).max(dictionaryIterator); - result = _(dictionary).max(dictionaryIterator, any); - result = _(dictionary).max(''); - result = _(dictionary).max<{a: number}, number>({a: 42}); } -// _.min -module TestMin { +// _.maxBy +module TestMaxBy { let array: number[]; let list: _.List; let dictionary: _.Dictionary; @@ -7240,41 +7206,92 @@ module TestMin { let result: number; + result = _.maxBy(array); + result = _.maxBy(array, listIterator); + result = _.maxBy(array, ''); + result = _.maxBy<{a: number}, number>(array, {a: 42}); + + result = _.maxBy(list); + result = _.maxBy(list, listIterator); + result = _.maxBy(list, ''); + result = _.maxBy<{a: number}, number>(list, {a: 42}); + + result = _.maxBy(dictionary); + result = _.maxBy(dictionary, dictionaryIterator); + result = _.maxBy(dictionary, ''); + result = _.maxBy<{a: number}, number>(dictionary, {a: 42}); + + result = _(array).maxBy(); + result = _(array).maxBy(listIterator); + result = _(array).maxBy(''); + result = _(array).maxBy<{a: number}>({a: 42}); + + result = _(list).maxBy(); + result = _(list).maxBy(listIterator); + result = _(list).maxBy(''); + result = _(list).maxBy<{a: number}, number>({a: 42}); + + result = _(dictionary).maxBy(); + result = _(dictionary).maxBy(dictionaryIterator); + result = _(dictionary).maxBy(''); + result = _(dictionary).maxBy<{a: number}, number>({a: 42}); +} + +// _.min +module TestMin { + let array: number[]; + let list: _.List; + + let result: number; + result = _.min(array); - result = _.min(array, listIterator); - result = _.min(array, listIterator, any); - result = _.min(array, ''); - result = _.min<{a: number}, number>(array, {a: 42}); - result = _.min(list); - result = _.min(list, listIterator); - result = _.min(list, listIterator, any); - result = _.min(list, ''); - result = _.min<{a: number}, number>(list, {a: 42}); - - result = _.min(dictionary); - result = _.min(dictionary, dictionaryIterator); - result = _.min(dictionary, dictionaryIterator, any); - result = _.min(dictionary, ''); - result = _.min<{a: number}, number>(dictionary, {a: 42}); result = _(array).min(); - result = _(array).min(listIterator); - result = _(array).min(listIterator, any); - result = _(array).min(''); - result = _(array).min<{a: number}>({a: 42}); - result = _(list).min(); - result = _(list).min(listIterator); - result = _(list).min(listIterator, any); - result = _(list).min(''); - result = _(list).min<{a: number}, number>({a: 42}); - result = _(dictionary).min(); - result = _(dictionary).min(dictionaryIterator); - result = _(dictionary).min(dictionaryIterator, any); - result = _(dictionary).min(''); - result = _(dictionary).min<{a: number}, number>({a: 42}); +} + +// _.minBy +module TestMinBy { + let array: number[]; + let list: _.List; + let dictionary: _.Dictionary; + + let listIterator: (value: number, index: number, collection: _.List) => number; + let dictionaryIterator: (value: number, key: string, collection: _.Dictionary) => number; + + let result: number; + + result = _.minBy(array); + result = _.minBy(array, listIterator); + result = _.minBy(array, ''); + result = _.minBy<{a: number}, number>(array, {a: 42}); + + result = _.minBy(list); + result = _.minBy(list, listIterator); + result = _.minBy(list, ''); + result = _.minBy<{a: number}, number>(list, {a: 42}); + + result = _.minBy(dictionary); + result = _.minBy(dictionary, dictionaryIterator); + result = _.minBy(dictionary, ''); + result = _.minBy<{a: number}, number>(dictionary, {a: 42}); + + result = _(array).minBy(); + result = _(array).minBy(listIterator); + result = _(array).minBy(''); + result = _(array).minBy<{a: number}>({a: 42}); + + result = _(list).minBy(); + result = _(list).minBy(listIterator); + result = _(list).minBy(''); + result = _(list).minBy<{a: number}, number>({a: 42}); + + result = _(dictionary).minBy(); + result = _(dictionary).minBy(dictionaryIterator); + result = _(dictionary).minBy(''); + result = _(dictionary).minBy<{a: number}, number>({a: 42}); } // _.round diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index f12d06ada..793aaca1f 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -26,7 +26,7 @@ TODO: - [x] Renamed _.restParam to _.rest - [x] Renamed _.sortByOrder to _.orderBy - [x] Renamed _.trimLeft & _.trimRight to _.trimStart & _.trimEnd -- [ ] Renamed _.trunc to _.truncate +- [x] Renamed _.trunc to _.truncate - [ ] Split _.indexOf & _.lastIndexOf into _.sortedIndexOf & _.sortedLastIndexOf - [ ] Split _.max & _.min into _.maxBy & _.minBy @@ -37,10 +37,10 @@ TODO: - [ ] Split _.uniq into _.sortedUniq, _.sortedUniqBy, & _.uniqBy - [ ] Absorbed _.sortByAll into _.sortBy -- [ ] Changed the category of _.at to “Object” -- [ ] Changed the category of _.bindAll to “Utility” +- [x] Changed the category of _.at to “Object” +- [x] Changed the category of _.bindAll to “Utility” - [ ] Made “By” methods provide a single param to iteratees -- [ ] Made _.capitalize uppercase the first character & lowercase the rest +- [x] Made _.capitalize uppercase the first character & lowercase the rest - [ ] Made _.functions return only own method names - [ ] Made _.words chainable by default - [ ] Removed isDeep params from _.clone & _.flatten @@ -10137,6 +10137,7 @@ declare module _ { * Note: This method is loosely based on the structured clone algorithm. The enumerable properties of arguments * objects and objects created by constructors other than Object are cloned to plain Object objects. An empty * object is returned for uncloneable values such as functions, DOM nodes, Maps, Sets, and WeakMaps. + * * @param value The value to clone. * @param isDeep Specify a deep clone. * @param customizer The function to customize cloning values. @@ -11142,55 +11143,18 @@ declare module _ { //_.max interface LoDashStatic { - /** - * Gets the maximum value of collection. If collection is empty or falsey -Infinity is returned. If an iteratee - * function is provided it’s invoked for each value in collection to generate the criterion by which the value - * is ranked. The iteratee is bound to thisArg and invoked with three arguments: (value, index, collection). - * - * If a property name is provided for iteratee the created _.property style callback returns the property value - * of the given element. - * - * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for - * elements that have a matching property value, else false. - * - * If an object is provided for iteratee the created _.matches style callback returns true for elements that - * have the properties of the given object, else false. - * - * @param collection The collection to iterate over. - * @param iteratee The function invoked per iteration. - * @param thisArg The this binding of iteratee. - * @return Returns the maximum value. - */ + /** + * Computes the maximum value of `array`. If `array` is empty or falsey + * `undefined` is returned. + * + * @static + * @memberOf _ + * @category Math + * @param {Array} array The array to iterate over. + * @returns {*} Returns the maximum value. + */ max( - collection: List, - iteratee?: ListIterator, - thisArg?: any - ): T; - - /** - * @see _.max - */ - max( - collection: Dictionary, - iteratee?: DictionaryIterator, - thisArg?: any - ): T; - - /** - * @see _.max - */ - max( - collection: List|Dictionary, - iteratee?: string, - thisArg?: any - ): T; - - /** - * @see _.max - */ - max( - collection: List|Dictionary, - whereValue?: TObject + collection: List ): T; } @@ -11198,48 +11162,114 @@ declare module _ { /** * @see _.max */ - max( - iteratee?: ListIterator, - thisArg?: any - ): T; - - /** - * @see _.max - */ - max( - iteratee?: string, - thisArg?: any - ): T; - - /** - * @see _.max - */ - max( - whereValue?: TObject - ): T; + max(): T; } interface LoDashImplicitObjectWrapper { /** * @see _.max */ - max( + max(): T; + } + + //_.maxBy + interface LoDashStatic { + /** + * This method is like `_.max` except that it accepts `iteratee` which is + * invoked for each element in `array` to generate the criterion by which + * the value is ranked. The iteratee is invoked with one argument: (value). + * + * @static + * @memberOf _ + * @category Math + * @param {Array} array The array to iterate over. + * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element. + * @returns {*} Returns the maximum value. + * @example + * + * var objects = [{ 'n': 1 }, { 'n': 2 }]; + * + * _.maxBy(objects, function(o) { return o.a; }); + * // => { 'n': 2 } + * + * // using the `_.property` iteratee shorthand + * _.maxBy(objects, 'n'); + * // => { 'n': 2 } + */ + maxBy( + collection: List, + iteratee?: ListIterator + ): T; + + /** + * @see _.maxBy + */ + maxBy( + collection: Dictionary, + iteratee?: DictionaryIterator + ): T; + + /** + * @see _.maxBy + */ + maxBy( + collection: List|Dictionary, + iteratee?: string + ): T; + + /** + * @see _.maxBy + */ + maxBy( + collection: List|Dictionary, + whereValue?: TObject + ): T; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.maxBy + */ + maxBy( + iteratee?: ListIterator + ): T; + + /** + * @see _.maxBy + */ + maxBy( + iteratee?: string + ): T; + + /** + * @see _.maxBy + */ + maxBy( + whereValue?: TObject + ): T; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.maxBy + */ + maxBy( iteratee?: ListIterator|DictionaryIterator, thisArg?: any ): T; /** - * @see _.max + * @see _.maxBy */ - max( + maxBy( iteratee?: string, thisArg?: any ): T; /** - * @see _.max + * @see _.maxBy */ - max( + maxBy( whereValue?: TObject ): T; } @@ -11247,54 +11277,17 @@ declare module _ { //_.min interface LoDashStatic { /** - * Gets the minimum value of collection. If collection is empty or falsey Infinity is returned. If an iteratee - * function is provided it’s invoked for each value in collection to generate the criterion by which the value - * is ranked. The iteratee is bound to thisArg and invoked with three arguments: (value, index, collection). + * Computes the minimum value of `array`. If `array` is empty or falsey + * `undefined` is returned. * - * If a property name is provided for iteratee the created _.property style callback returns the property value - * of the given element. - * - * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for - * elements that have a matching property value, else false. - * - * If an object is provided for iteratee the created _.matches style callback returns true for elements that - * have the properties of the given object, else false. - * - * @param collection The collection to iterate over. - * @param iteratee The function invoked per iteration. - * @param thisArg The this binding of iteratee. - * @return Returns the minimum value. + * @static + * @memberOf _ + * @category Math + * @param {Array} array The array to iterate over. + * @returns {*} Returns the minimum value. */ min( - collection: List, - iteratee?: ListIterator, - thisArg?: any - ): T; - - /** - * @see _.min - */ - min( - collection: Dictionary, - iteratee?: DictionaryIterator, - thisArg?: any - ): T; - - /** - * @see _.min - */ - min( - collection: List|Dictionary, - iteratee?: string, - thisArg?: any - ): T; - - /** - * @see _.min - */ - min( - collection: List|Dictionary, - whereValue?: TObject + collection: List ): T; } @@ -11302,48 +11295,114 @@ declare module _ { /** * @see _.min */ - min( - iteratee?: ListIterator, - thisArg?: any - ): T; - - /** - * @see _.min - */ - min( - iteratee?: string, - thisArg?: any - ): T; - - /** - * @see _.min - */ - min( - whereValue?: TObject - ): T; + min(): T; } interface LoDashImplicitObjectWrapper { /** * @see _.min */ - min( + min(): T; + } + + //_.minBy + interface LoDashStatic { + /** + * This method is like `_.min` except that it accepts `iteratee` which is + * invoked for each element in `array` to generate the criterion by which + * the value is ranked. The iteratee is invoked with one argument: (value). + * + * @static + * @memberOf _ + * @category Math + * @param {Array} array The array to iterate over. + * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element. + * @returns {*} Returns the minimum value. + * @example + * + * var objects = [{ 'n': 1 }, { 'n': 2 }]; + * + * _.minBy(objects, function(o) { return o.a; }); + * // => { 'n': 1 } + * + * // using the `_.property` iteratee shorthand + * _.minBy(objects, 'n'); + * // => { 'n': 1 } + */ + minBy( + collection: List, + iteratee?: ListIterator + ): T; + + /** + * @see _.minBy + */ + minBy( + collection: Dictionary, + iteratee?: DictionaryIterator + ): T; + + /** + * @see _.minBy + */ + minBy( + collection: List|Dictionary, + iteratee?: string + ): T; + + /** + * @see _.minBy + */ + minBy( + collection: List|Dictionary, + whereValue?: TObject + ): T; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.minBy + */ + minBy( + iteratee?: ListIterator + ): T; + + /** + * @see _.minBy + */ + minBy( + iteratee?: string + ): T; + + /** + * @see _.minBy + */ + minBy( + whereValue?: TObject + ): T; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.minBy + */ + minBy( iteratee?: ListIterator|DictionaryIterator, thisArg?: any ): T; /** - * @see _.min + * @see _.minBy */ - min( + minBy( iteratee?: string, thisArg?: any ): T; /** - * @see _.min + * @see _.minBy */ - min( + minBy( whereValue?: TObject ): T; } From 474d691952462d02e82580182cee9f439df867de Mon Sep 17 00:00:00 2001 From: DomiR Date: Wed, 13 Jan 2016 22:29:32 +0100 Subject: [PATCH 14/51] (feature) Split _.indexOf & _.lastIndexOf into _.sortedIndexOf & _.sortedLastIndexOf --- lodash/lodash-tests.ts | 23 +++++++++++ lodash/lodash.d.ts | 90 +++++++++++++++++++++++++++++++++++++----- 2 files changed, 104 insertions(+), 9 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 41b80f49c..983d73f21 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -858,6 +858,29 @@ module TestIndexOf { } } +// _.sortedIndexOf +module TestIndexOf { + let array: TResult[]; + let list: _.List; + let value: TResult; + + { + let result: number; + + result = _.sortedIndexOf(array, value); + result = _.sortedIndexOf(list, value); + result = _(array).sortedIndexOf(value); + result = _(list).sortedIndexOf(value); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(array).chain().sortedIndexOf(value); + result = _(list).chain().sortedIndexOf(value); + } +} + //_.initial module TestInitial { let array: TResult[]; diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 793aaca1f..f4f34bfc7 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -28,8 +28,8 @@ TODO: - [x] Renamed _.trimLeft & _.trimRight to _.trimStart & _.trimEnd - [x] Renamed _.trunc to _.truncate -- [ ] Split _.indexOf & _.lastIndexOf into _.sortedIndexOf & _.sortedLastIndexOf -- [ ] Split _.max & _.min into _.maxBy & _.minBy +- [x] Split _.indexOf & _.lastIndexOf into _.sortedIndexOf & _.sortedLastIndexOf +- [x] Split _.max & _.min into _.maxBy & _.minBy - [ ] Split _.omit & _.pick into _.omitBy & _.pickBy - [ ] Split _.sample into _.sampleSize - [ ] Split _.sortedIndex into _.sortedIndexBy @@ -1382,14 +1382,27 @@ declare module _ { //_.indexOf interface LoDashStatic { /** - * Gets the index at which the first occurrence of value is found in array using SameValueZero for equality - * comparisons. If fromIndex is negative, it’s used as the offset from the end of array. If array is sorted - * providing true for fromIndex performs a faster binary search. + * Gets the index at which the first occurrence of `value` is found in `array` + * using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * for equality comparisons. If `fromIndex` is negative, it's used as the offset + * from the end of `array`. If `array` is sorted providing `true` for `fromIndex` + * performs a faster binary search. * - * @param array The array to search. - * @param value The value to search for. - * @param fromIndex The index to search from or true to perform a binary search on a sorted array. - * @return The index to search from or true to perform a binary search on a sorted array. + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to search. + * @param {*} value The value to search for. + * @param {number} [fromIndex=0] The index to search from. + * @returns {number} Returns the index of the matched value, else `-1`. + * @example + * + * _.indexOf([1, 2, 1, 2], 2); + * // => 1 + * + * // using `fromIndex` + * _.indexOf([1, 2, 1, 2], 2, 2); + * // => 3 */ indexOf( array: List, @@ -1438,6 +1451,65 @@ declare module _ { ): LoDashExplicitWrapper; } + //_.sortedIndexOf + interface LoDashStatic { + /** + * This method is like `_.indexOf` except that it performs a binary + * search on a sorted `array`. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to search. + * @param {*} value The value to search for. + * @returns {number} Returns the index of the matched value, else `-1`. + * @example + * + * _.sortedIndexOf([1, 1, 2, 2], 2); + * // => 2 + */ + sortedIndexOf( + array: List, + value: T + ): number; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.sortedIndexOf + */ + sortedIndexOf( + value: T + ): number; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.sortedIndexOf + */ + sortedIndexOf( + value: TValue + ): number; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.sortedIndexOf + */ + sortedIndexOf( + value: T + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.sortedIndexOf + */ + sortedIndexOf( + value: TValue + ): LoDashExplicitWrapper; + } + //_.initial interface LoDashStatic { /** From e9db15c7d208963e37e33ca9720592078d6d7cb2 Mon Sep 17 00:00:00 2001 From: DomiR Date: Wed, 13 Jan 2016 22:39:38 +0100 Subject: [PATCH 15/51] (feature) Split _.omit & _.pick into _.omitBy & _.pickBy --- lodash/lodash-tests.ts | 58 ++++++++++--- lodash/lodash.d.ts | 181 ++++++++++++++++++++++++++--------------- 2 files changed, 163 insertions(+), 76 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 983d73f21..4b06f98b0 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -8640,8 +8640,6 @@ module TestOmit { result = _.omit({}, 0, 'a'); result = _.omit({}, true, 0, 'a'); result = _.omit({}, ['b', 1, false], true, 0, 'a'); - result = _.omit({}, predicate); - result = _.omit({}, predicate, any); } { @@ -8651,8 +8649,6 @@ module TestOmit { result = _({}).omit(0, 'a'); result = _({}).omit(true, 0, 'a'); result = _({}).omit(['b', 1, false], true, 0, 'a'); - result = _({}).omit(predicate); - result = _({}).omit(predicate, any); } { @@ -8662,8 +8658,29 @@ module TestOmit { result = _({}).chain().omit(0, 'a'); result = _({}).chain().omit(true, 0, 'a'); result = _({}).chain().omit(['b', 1, false], true, 0, 'a'); - result = _({}).chain().omit(predicate); - result = _({}).chain().omit(predicate, any); + } +} + +// _.omitBy +module TestOmitBy { + let predicate: (element: any, key: string, collection: any) => boolean; + + { + let result: TResult; + + result = _.omitBy({}, predicate); + } + + { + let result: _.LoDashImplicitObjectWrapper; + + result = _({}).omitBy(predicate); + } + + { + let result: _.LoDashExplicitObjectWrapper; + + result = _({}).chain().omitBy(predicate); } } @@ -8719,8 +8736,6 @@ module TestPick { result = _.pick({}, 0, 'a'); result = _.pick({}, true, 0, 'a'); result = _.pick({}, ['b', 1, false], true, 0, 'a'); - result = _.pick({}, predicate); - result = _.pick({}, predicate, any); } { @@ -8730,8 +8745,6 @@ module TestPick { result = _({}).pick(0, 'a'); result = _({}).pick(true, 0, 'a'); result = _({}).pick(['b', 1, false], true, 0, 'a'); - result = _({}).pick(predicate); - result = _({}).pick(predicate, any); } { @@ -8741,8 +8754,29 @@ module TestPick { result = _({}).chain().pick(0, 'a'); result = _({}).chain().pick(true, 0, 'a'); result = _({}).chain().pick(['b', 1, false], true, 0, 'a'); - result = _({}).chain().pick(predicate); - result = _({}).chain().pick(predicate, any); + } +} + +// _.pickBy +module TestPickBy { + let predicate: (element: any, key: string, collection: any) => boolean; + + { + let result: TResult; + + result = _.pickBy({}, predicate); + } + + { + let result: _.LoDashImplicitObjectWrapper; + + result = _({}).pickBy(predicate); + } + + { + let result: _.LoDashExplicitObjectWrapper; + + result = _({}).chain().pickBy(predicate); } } diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index f4f34bfc7..818c28076 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -30,7 +30,7 @@ TODO: - [x] Split _.indexOf & _.lastIndexOf into _.sortedIndexOf & _.sortedLastIndexOf - [x] Split _.max & _.min into _.maxBy & _.minBy -- [ ] Split _.omit & _.pick into _.omitBy & _.pickBy +- [x] Split _.omit & _.pick into _.omitBy & _.pickBy - [ ] Split _.sample into _.sampleSize - [ ] Split _.sortedIndex into _.sortedIndexBy - [ ] Split _.sortedLastIndex into _.sortedLastIndexBy @@ -13334,24 +13334,24 @@ declare module _ { //_.omit interface LoDashStatic { /** - * The opposite of _.pick; this method creates an object composed of the own and inherited enumerable - * properties of object that are not omitted. + * The opposite of `_.pick`; this method creates an object composed of the + * own and inherited enumerable properties of `object` that are not omitted. * - * @param object The source object. - * @param predicate The function invoked per iteration or property names to omit, specified as individual - * property names or arrays of property names. - * @param thisArg The this binding of predicate. - * @return Returns the new object. + * @static + * @memberOf _ + * @category Object + * @param {Object} object The source object. + * @param {...(string|string[])} [props] The property names to omit, specified + * individually or in arrays.. + * @returns {Object} Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.omit(object, ['a', 'c']); + * // => { 'b': '2' } */ - omit( - object: T, - predicate: ObjectIterator, - thisArg?: any - ): TResult; - /** - * @see _.omit - */ omit( object: T, ...predicate: (StringRepresentable|StringRepresentable[])[] @@ -13359,13 +13359,6 @@ declare module _ { } interface LoDashImplicitObjectWrapper { - /** - * @see _.omit - */ - omit( - predicate: ObjectIterator, - thisArg?: any - ): LoDashImplicitObjectWrapper; /** * @see _.omit @@ -13376,13 +13369,6 @@ declare module _ { } interface LoDashExplicitObjectWrapper { - /** - * @see _.omit - */ - omit( - predicate: ObjectIterator, - thisArg?: any - ): LoDashExplicitObjectWrapper; /** * @see _.omit @@ -13392,6 +13378,50 @@ declare module _ { ): LoDashExplicitObjectWrapper; } + //_.omitBy + interface LoDashStatic { + /** + * The opposite of `_.pickBy`; this method creates an object composed of the + * own and inherited enumerable properties of `object` that `predicate` + * doesn't return truthy for. + * + * @static + * @memberOf _ + * @category Object + * @param {Object} object The source object. + * @param {Function|Object|string} [predicate=_.identity] The function invoked per property. + * @returns {Object} Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.omitBy(object, _.isNumber); + * // => { 'b': '2' } + */ + omitBy( + object: T, + predicate: ObjectIterator + ): TResult; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.omitBy + */ + omitBy( + predicate: ObjectIterator + ): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.omitBy + */ + omitBy( + predicate: ObjectIterator + ): LoDashExplicitObjectWrapper; + } + //_.toPairs interface LoDashStatic { /** @@ -13422,25 +13452,21 @@ declare module _ { //_.pick interface LoDashStatic { /** - * Creates an object composed of the picked object properties. Property names may be specified as individual - * arguments or as arrays of property names. If predicate is provided it’s invoked for each property of object - * picking the properties predicate returns truthy for. The predicate is bound to thisArg and invoked with - * three arguments: (value, key, object). + * Creates an object composed of the picked `object` properties. * - * @param object The source object. - * @param predicate The function invoked per iteration or property names to pick, specified as individual - * property names or arrays of property names. - * @param thisArg The this binding of predicate. - * @return Returns the new object. - */ - pick( - object: T, - predicate: ObjectIterator, - thisArg?: any - ): TResult; - - /** - * @see _.pick + * @static + * @memberOf _ + * @category Object + * @param {Object} object The source object. + * @param {...(string|string[])} [props] The property names to pick, specified + * individually or in arrays. + * @returns {Object} Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.pick(object, ['a', 'c']); + * // => { 'a': 1, 'c': 3 } */ pick( object: T, @@ -13449,14 +13475,6 @@ declare module _ { } interface LoDashImplicitObjectWrapper { - /** - * @see _.pick - */ - pick( - predicate: ObjectIterator, - thisArg?: any - ): LoDashImplicitObjectWrapper; - /** * @see _.pick */ @@ -13466,14 +13484,6 @@ declare module _ { } interface LoDashExplicitObjectWrapper { - /** - * @see _.pick - */ - pick( - predicate: ObjectIterator, - thisArg?: any - ): LoDashExplicitObjectWrapper; - /** * @see _.pick */ @@ -13482,6 +13492,49 @@ declare module _ { ): LoDashExplicitObjectWrapper; } + //_.pickBy + interface LoDashStatic { + /** + * Creates an object composed of the `object` properties `predicate` returns + * truthy for. The predicate is invoked with one argument: (value). + * + * @static + * @memberOf _ + * @category Object + * @param {Object} object The source object. + * @param {Function|Object|string} [predicate=_.identity] The function invoked per property. + * @returns {Object} Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.pickBy(object, _.isNumber); + * // => { 'a': 1, 'c': 3 } + */ + pickBy( + object: T, + predicate: ObjectIterator + ): TResult; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.pickBy + */ + pickBy( + predicate: ObjectIterator + ): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.pickBy + */ + pickBy( + predicate: ObjectIterator + ): LoDashExplicitObjectWrapper; + } + //_.result interface LoDashStatic { /** From 6fab2980b1795b5cea5b07952f95987bae7c0b26 Mon Sep 17 00:00:00 2001 From: DomiR Date: Wed, 13 Jan 2016 22:44:37 +0100 Subject: [PATCH 16/51] (feature) Split _.sample into _.sampleSize --- lodash/lodash-tests.ts | 9 +++-- lodash/lodash.d.ts | 78 ++++++++++++++++++++++++++++-------------- 2 files changed, 58 insertions(+), 29 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 4b06f98b0..f0abe1d44 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -4894,12 +4894,15 @@ module TestReject { } } +// _.sample result = _.sample([1, 2, 3, 4]); -result = _.sample([1, 2, 3, 4], 2); result = <_.LoDashImplicitWrapper>_([1, 2, 3, 4]).sample(); -result = <_.LoDashImplicitArrayWrapper>_([1, 2, 3, 4]).sample(2); result = _([1, 2, 3, 4]).sample().value(); -result = _([1, 2, 3, 4]).sample(2).value(); + +// _.sampleSize +result = _.sampleSize([1, 2, 3, 4], 2); +result = <_.LoDashImplicitArrayWrapper>_([1, 2, 3, 4]).sampleSize(2); +result = _([1, 2, 3, 4]).sampleSize(2).value(); // _.select module TestSelect { diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 818c28076..ff005a991 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -31,7 +31,7 @@ TODO: - [x] Split _.indexOf & _.lastIndexOf into _.sortedIndexOf & _.sortedLastIndexOf - [x] Split _.max & _.min into _.maxBy & _.minBy - [x] Split _.omit & _.pick into _.omitBy & _.pickBy -- [ ] Split _.sample into _.sampleSize +- [x] Split _.sample into _.sampleSize - [ ] Split _.sortedIndex into _.sortedIndexBy - [ ] Split _.sortedLastIndex into _.sortedLastIndexBy - [ ] Split _.uniq into _.sortedUniq, _.sortedUniqBy, & _.uniqBy @@ -7909,10 +7909,18 @@ declare module _ { //_.sample interface LoDashStatic { /** - * Retrieves a random element or n random elements from a collection. - * @param collection The collection to sample. - * @return Returns the random sample(s) of collection. - **/ + * Gets a random element from `collection`. + * + * @static + * @memberOf _ + * @category Collection + * @param {Array|Object} collection The collection to sample. + * @returns {*} Returns the random element. + * @example + * + * _.sample([1, 2, 3, 4]); + * // => 2 + */ sample(collection: Array): T; /** @@ -7924,36 +7932,54 @@ declare module _ { * @see _.sample **/ sample(collection: Dictionary): T; - - /** - * @see _.sample - * @param n The number of elements to sample. - **/ - sample(collection: Array, n: number): T[]; - - /** - * @see _.sample - * @param n The number of elements to sample. - **/ - sample(collection: List, n: number): T[]; - - /** - * @see _.sample - * @param n The number of elements to sample. - **/ - sample(collection: Dictionary, n: number): T[]; } interface LoDashImplicitArrayWrapper { /** * @see _.sample **/ - sample(n: number): LoDashImplicitArrayWrapper; + sample(): LoDashImplicitWrapper; + } + + //_.sampleSize + interface LoDashStatic { + /** + * Gets `n` random elements from `collection`. + * + * @static + * @memberOf _ + * @category Collection + * @param {Array|Object} collection The collection to sample. + * @param {number} [n=0] The number of elements to sample. + * @returns {Array} Returns the random elements. + * @example + * + * _.sampleSize([1, 2, 3, 4], 2); + * // => [3, 1] + */ + sampleSize(collection: Array, n: number): T[]; /** - * @see _.sample + * @see _.sampleSize + **/ + sampleSize(collection: List, n: number): T[]; + + /** + * @see _.sampleSize + **/ + sampleSize(collection: Dictionary, n: number): T[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.sampleSize **/ - sample(): LoDashImplicitWrapper; + sampleSize(n: number): LoDashImplicitArrayWrapper; + + /** + * @see _.sampleSize + **/ + sampleSize(): LoDashImplicitWrapper; } //_.select From c00b6c330cbe71aa1652cb957a1b6554c0ccd808 Mon Sep 17 00:00:00 2001 From: DomiR Date: Wed, 13 Jan 2016 22:57:04 +0100 Subject: [PATCH 17/51] (feature) Split _.sortedIndex into _.sortedIndexBy --- lodash/lodash-tests.ts | 107 +++++++------ lodash/lodash.d.ts | 338 ++++++++++++++++++++++++++++++----------- 2 files changed, 313 insertions(+), 132 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index f0abe1d44..506aac21f 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -1380,70 +1380,89 @@ module TestSortedIndex { let result: number; result = _.sortedIndex('', ''); - result = _.sortedIndex('', '', stringIterator); - result = _.sortedIndex('', '', stringIterator, any); - result = _.sortedIndex('', '', stringIterator); - result = _.sortedIndex('', '', stringIterator, any); result = _.sortedIndex(array, value); - result = _.sortedIndex(array, value, arrayIterator); - result = _.sortedIndex(array, value, arrayIterator, any); - result = _.sortedIndex(array, value, ''); - result = _.sortedIndex(array, value, {a: 42}); - result = _.sortedIndex(array, value, arrayIterator); - result = _.sortedIndex(array, value, arrayIterator, any); - result = _.sortedIndex<{a: number}, SampleType>(array, value, {a: 42}); result = _.sortedIndex(list, value); - result = _.sortedIndex(list, value, listIterator); - result = _.sortedIndex(list, value, listIterator, any); - result = _.sortedIndex(list, value, ''); - result = _.sortedIndex(list, value, {a: 42}); - result = _.sortedIndex(list, value, listIterator); - result = _.sortedIndex(list, value, listIterator, any); - result = _.sortedIndex<{a: number}, SampleType>(list, value, {a: 42}); result = _('').sortedIndex(''); - result = _('').sortedIndex('', stringIterator); - result = _('').sortedIndex('', stringIterator, any); result = _(array).sortedIndex(value); - result = _(array).sortedIndex(value, arrayIterator); - result = _(array).sortedIndex(value, arrayIterator, any); - result = _(array).sortedIndex(value, ''); - result = _(array).sortedIndex<{a: number}>(value, {a: 42}); result = _(list).sortedIndex(value); - result = _(list).sortedIndex(value, listIterator); - result = _(list).sortedIndex(value, listIterator, any); - result = _(list).sortedIndex(value, ''); - result = _(list).sortedIndex(value, {a: 42}); - result = _(list).sortedIndex(value, listIterator); - result = _(list).sortedIndex(value, listIterator, any); - result = _(list).sortedIndex<{a: number}, SampleType>(value, {a: 42}); + } { let result: _.LoDashExplicitWrapper; result = _('').chain().sortedIndex(''); - result = _('').chain().sortedIndex('', stringIterator); - result = _('').chain().sortedIndex('', stringIterator, any); result = _(array).chain().sortedIndex(value); - result = _(array).chain().sortedIndex(value, arrayIterator); - result = _(array).chain().sortedIndex(value, arrayIterator, any); - result = _(array).chain().sortedIndex(value, ''); - result = _(array).chain().sortedIndex<{a: number}>(value, {a: 42}); result = _(list).chain().sortedIndex(value); - result = _(list).chain().sortedIndex(value, listIterator); - result = _(list).chain().sortedIndex(value, listIterator, any); - result = _(list).chain().sortedIndex(value, ''); - result = _(list).chain().sortedIndex(value, {a: 42}); - result = _(list).chain().sortedIndex(value, listIterator); - result = _(list).chain().sortedIndex(value, listIterator, any); - result = _(list).chain().sortedIndex<{a: number}, SampleType>(value, {a: 42}); + + } +} + +// _.sortedIndexBy +module TestSortedIndexBy { + type SampleType = {a: number; b: string; c: boolean;}; + + let array: SampleType[]; + let list: _.List; + + let value: SampleType; + + let stringIterator: (x: string) => number; + let arrayIterator: (x: SampleType) => number; + let listIterator: (x: SampleType) => number; + + { + let result: number; + + result = _.sortedIndexBy('', '', stringIterator); + result = _.sortedIndexBy('', '', stringIterator); + + result = _.sortedIndexBy(array, value, arrayIterator); + result = _.sortedIndexBy(array, value, ''); + result = _.sortedIndexBy(array, value, {a: 42}); + result = _.sortedIndexBy(array, value, arrayIterator); + result = _.sortedIndexBy<{a: number}, SampleType>(array, value, {a: 42}); + + result = _.sortedIndexBy(list, value, listIterator); + result = _.sortedIndexBy(list, value, ''); + result = _.sortedIndexBy(list, value, {a: 42}); + result = _.sortedIndexBy(list, value, listIterator); + result = _.sortedIndexBy<{a: number}, SampleType>(list, value, {a: 42}); + + result = _('').sortedIndexBy('', stringIterator); + + result = _(array).sortedIndexBy(value, arrayIterator); + result = _(array).sortedIndexBy(value, ''); + result = _(array).sortedIndexBy<{a: number}>(value, {a: 42}); + + result = _(list).sortedIndexBy(value, listIterator); + result = _(list).sortedIndexBy(value, ''); + result = _(list).sortedIndexBy(value, {a: 42}); + result = _(list).sortedIndexBy(value, listIterator); + result = _(list).sortedIndexBy<{a: number}, SampleType>(value, {a: 42}); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _('').chain().sortedIndexBy('', stringIterator); + + result = _(array).chain().sortedIndexBy(value, arrayIterator); + result = _(array).chain().sortedIndexBy(value, ''); + result = _(array).chain().sortedIndexBy<{a: number}>(value, {a: 42}); + + result = _(list).chain().sortedIndexBy(value, listIterator); + result = _(list).chain().sortedIndexBy(value, ''); + result = _(list).chain().sortedIndexBy(value, {a: 42}); + result = _(list).chain().sortedIndexBy(value, listIterator); + result = _(list).chain().sortedIndexBy<{a: number}, SampleType>(value, {a: 42}); } } diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index ff005a991..03eb0b2d1 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -32,7 +32,7 @@ TODO: - [x] Split _.max & _.min into _.maxBy & _.minBy - [x] Split _.omit & _.pick into _.omitBy & _.pickBy - [x] Split _.sample into _.sampleSize -- [ ] Split _.sortedIndex into _.sortedIndexBy +- [x] Split _.sortedIndex into _.sortedIndexBy - [ ] Split _.sortedLastIndex into _.sortedLastIndexBy - [ ] Split _.uniq into _.sortedUniq, _.sortedUniqBy, & _.uniqBy @@ -2130,24 +2130,26 @@ declare module _ { //_.sortedIndex interface LoDashStatic { /** - * Uses a binary search to determine the lowest index at which value should be inserted into array in order to maintain its sort order. If an iteratee function is provided it’s invoked for value and each element of array to compute their sort ranking. The iteratee is bound to thisArg and invoked with one argument; (value). + * Uses a binary search to determine the lowest index at which `value` should + * be inserted into `array` in order to maintain its sort order. * - * If a property name is provided for iteratee the created _.property style callback returns the property value of the given element. + * @static + * @memberOf _ + * @category Array + * @param {Array} array The sorted array to inspect. + * @param {*} value The value to evaluate. + * @returns {number} Returns the index at which `value` should be inserted into `array`. + * @example * - * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for elements that have a matching property value, else false. + * _.sortedIndex([30, 50], 40); + * // => 1 * - * If an object is provided for iteratee the created _.matches style callback returns true for elements that have the properties of the given object, else false. - * - * @param array The sorted array to inspect. - * @param value The value to evaluate. - * @param iteratee The function invoked per iteration. - * @return The this binding of iteratee. + * _.sortedIndex([4, 5], 4); + * // => 0 */ sortedIndex( array: List, - value: T, - iteratee?: (x: T) => TSort, - thisArg?: any + value: T ): number; /** @@ -2155,9 +2157,7 @@ declare module _ { */ sortedIndex( array: List, - value: T, - iteratee?: (x: T) => any, - thisArg?: any + value: T ): number; /** @@ -2165,8 +2165,7 @@ declare module _ { */ sortedIndex( array: List, - value: T, - iteratee: string + value: T ): number; /** @@ -2174,8 +2173,7 @@ declare module _ { */ sortedIndex( array: List, - value: T, - iteratee: W + value: T ): number; /** @@ -2183,8 +2181,7 @@ declare module _ { */ sortedIndex( array: List, - value: T, - iteratee: Object + value: T ): number; } @@ -2193,9 +2190,7 @@ declare module _ { * @see _.sortedIndex */ sortedIndex( - value: string, - iteratee?: (x: string) => TSort, - thisArg?: any + value: string ): number; } @@ -2204,25 +2199,14 @@ declare module _ { * @see _.sortedIndex */ sortedIndex( - value: T, - iteratee?: (x: T) => TSort, - thisArg?: any + value: T ): number; /** * @see _.sortedIndex */ sortedIndex( - value: T, - iteratee: string - ): number; - - /** - * @see _.sortedIndex - */ - sortedIndex( - value: T, - iteratee: W + value: T ): number; } @@ -2231,42 +2215,21 @@ declare module _ { * @see _.sortedIndex */ sortedIndex( - value: T, - iteratee?: (x: T) => TSort, - thisArg?: any + value: T ): number; /** * @see _.sortedIndex */ sortedIndex( - value: T, - iteratee?: (x: T) => any, - thisArg?: any - ): number; - - /** - * @see _.sortedIndex - */ - sortedIndex( - value: T, - iteratee: string + value: T ): number; /** * @see _.sortedIndex */ sortedIndex( - value: T, - iteratee: W - ): number; - - /** - * @see _.sortedIndex - */ - sortedIndex( - value: T, - iteratee: Object + value: T ): number; } @@ -2275,9 +2238,7 @@ declare module _ { * @see _.sortedIndex */ sortedIndex( - value: string, - iteratee?: (x: string) => TSort, - thisArg?: any + value: string ): LoDashExplicitWrapper; } @@ -2286,25 +2247,21 @@ declare module _ { * @see _.sortedIndex */ sortedIndex( - value: T, - iteratee?: (x: T) => TSort, - thisArg?: any + value: T ): LoDashExplicitWrapper; /** * @see _.sortedIndex */ sortedIndex( - value: T, - iteratee: string + value: T ): LoDashExplicitWrapper; /** * @see _.sortedIndex */ sortedIndex( - value: T, - iteratee: W + value: T ): LoDashExplicitWrapper; } @@ -2313,40 +2270,245 @@ declare module _ { * @see _.sortedIndex */ sortedIndex( - value: T, - iteratee?: (x: T) => TSort, - thisArg?: any + value: T ): LoDashExplicitWrapper; /** * @see _.sortedIndex */ sortedIndex( - value: T, - iteratee?: (x: T) => any, - thisArg?: any - ): LoDashExplicitWrapper; - - /** - * @see _.sortedIndex - */ - sortedIndex( - value: T, - iteratee: string + value: T ): LoDashExplicitWrapper; /** * @see _.sortedIndex */ sortedIndex( + value: T + ): LoDashExplicitWrapper; + + + } + + //_.sortedIndexBy + interface LoDashStatic { + /** + * This method is like `_.sortedIndex` except that it accepts `iteratee` + * which is invoked for `value` and each element of `array` to compute their + * sort ranking. The iteratee is invoked with one argument: (value). + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The sorted array to inspect. + * @param {*} value The value to evaluate. + * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element. + * @returns {number} Returns the index at which `value` should be inserted into `array`. + * @example + * + * var dict = { 'thirty': 30, 'forty': 40, 'fifty': 50 }; + * + * _.sortedIndexBy(['thirty', 'fifty'], 'forty', _.propertyOf(dict)); + * // => 1 + * + * // using the `_.property` iteratee shorthand + * _.sortedIndexBy([{ 'x': 4 }, { 'x': 5 }], { 'x': 4 }, 'x'); + * // => 0 + */ + sortedIndexBy( + array: List, + value: T, + iteratee: (x: T) => TSort + ): number; + + /** + * @see _.sortedIndexBy + */ + sortedIndexBy( + array: List, + value: T, + iteratee: (x: T) => any + ): number; + + /** + * @see _.sortedIndexBy + */ + sortedIndexBy( + array: List, + value: T, + iteratee: string + ): number; + + /** + * @see _.sortedIndexBy + */ + sortedIndexBy( + array: List, + value: T, + iteratee: W + ): number; + + /** + * @see _.sortedIndexBy + */ + sortedIndexBy( + array: List, + value: T, + iteratee: Object + ): number; + } + + interface LoDashImplicitWrapper { + /** + * @see _.sortedIndexBy + */ + sortedIndexBy( + value: string, + iteratee: (x: string) => TSort + ): number; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.sortedIndexBy + */ + sortedIndexBy( + value: T, + iteratee: (x: T) => TSort + ): number; + + /** + * @see _.sortedIndexBy + */ + sortedIndexBy( + value: T, + iteratee: string + ): number; + + /** + * @see _.sortedIndexBy + */ + sortedIndexBy( + value: T, + iteratee: W + ): number; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.sortedIndexBy + */ + sortedIndexBy( + value: T, + iteratee: (x: T) => TSort + ): number; + + /** + * @see _.sortedIndexBy + */ + sortedIndexBy( + value: T, + iteratee: (x: T) => any + ): number; + + /** + * @see _.sortedIndexBy + */ + sortedIndexBy( + value: T, + iteratee: string + ): number; + + /** + * @see _.sortedIndexBy + */ + sortedIndexBy( + value: T, + iteratee: W + ): number; + + /** + * @see _.sortedIndexBy + */ + sortedIndexBy( + value: T, + iteratee: Object + ): number; + } + + interface LoDashExplicitWrapper { + /** + * @see _.sortedIndexBy + */ + sortedIndexBy( + value: string, + iteratee: (x: string) => TSort + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.sortedIndexBy + */ + sortedIndexBy( + value: T, + iteratee: (x: T) => TSort + ): LoDashExplicitWrapper; + + /** + * @see _.sortedIndexBy + */ + sortedIndexBy( + value: T, + iteratee: string + ): LoDashExplicitWrapper; + + /** + * @see _.sortedIndexBy + */ + sortedIndexBy( + value: T, + iteratee: W + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.sortedIndexBy + */ + sortedIndexBy( + value: T, + iteratee: (x: T) => TSort + ): LoDashExplicitWrapper; + + /** + * @see _.sortedIndexBy + */ + sortedIndexBy( + value: T, + iteratee: (x: T) => any + ): LoDashExplicitWrapper; + + /** + * @see _.sortedIndexBy + */ + sortedIndexBy( + value: T, + iteratee: string + ): LoDashExplicitWrapper; + + /** + * @see _.sortedIndexBy + */ + sortedIndexBy( value: T, iteratee: W ): LoDashExplicitWrapper; /** - * @see _.sortedIndex + * @see _.sortedIndexBy */ - sortedIndex( + sortedIndexBy( value: T, iteratee: Object ): LoDashExplicitWrapper; From 420423e900fcce6bdc101e024c8abcdb623fb688 Mon Sep 17 00:00:00 2001 From: DomiR Date: Wed, 13 Jan 2016 23:06:10 +0100 Subject: [PATCH 18/51] (feature) Split _.sortedLastIndex into _.sortedLastIndexBy --- lodash/lodash-tests.ts | 105 +++++++------ lodash/lodash.d.ts | 329 ++++++++++++++++++++++++++++++----------- 2 files changed, 304 insertions(+), 130 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 506aac21f..f1c04cb4f 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -1483,70 +1483,87 @@ module TestSortedLastIndex { let result: number; result = _.sortedLastIndex('', ''); - result = _.sortedLastIndex('', '', stringIterator); - result = _.sortedLastIndex('', '', stringIterator, any); - result = _.sortedLastIndex('', '', stringIterator); - result = _.sortedLastIndex('', '', stringIterator, any); result = _.sortedLastIndex(array, value); - result = _.sortedLastIndex(array, value, arrayIterator); - result = _.sortedLastIndex(array, value, arrayIterator, any); - result = _.sortedLastIndex(array, value, ''); - result = _.sortedLastIndex(array, value, {a: 42}); - result = _.sortedLastIndex(array, value, arrayIterator); - result = _.sortedLastIndex(array, value, arrayIterator, any); - result = _.sortedLastIndex<{a: number}, SampleType>(array, value, {a: 42}); result = _.sortedLastIndex(list, value); - result = _.sortedLastIndex(list, value, listIterator); - result = _.sortedLastIndex(list, value, listIterator, any); - result = _.sortedLastIndex(list, value, ''); - result = _.sortedLastIndex(list, value, {a: 42}); - result = _.sortedLastIndex(list, value, listIterator); - result = _.sortedLastIndex(list, value, listIterator, any); - result = _.sortedLastIndex<{a: number}, SampleType>(list, value, {a: 42}); result = _('').sortedLastIndex(''); - result = _('').sortedLastIndex('', stringIterator); - result = _('').sortedLastIndex('', stringIterator, any); result = _(array).sortedLastIndex(value); - result = _(array).sortedLastIndex(value, arrayIterator); - result = _(array).sortedLastIndex(value, arrayIterator, any); - result = _(array).sortedLastIndex(value, ''); - result = _(array).sortedLastIndex<{a: number}>(value, {a: 42}); result = _(list).sortedLastIndex(value); - result = _(list).sortedLastIndex(value, listIterator); - result = _(list).sortedLastIndex(value, listIterator, any); - result = _(list).sortedLastIndex(value, ''); - result = _(list).sortedLastIndex(value, {a: 42}); - result = _(list).sortedLastIndex(value, listIterator); - result = _(list).sortedLastIndex(value, listIterator, any); - result = _(list).sortedLastIndex<{a: number}, SampleType>(value, {a: 42}); } { let result: _.LoDashExplicitWrapper; result = _('').chain().sortedLastIndex(''); - result = _('').chain().sortedLastIndex('', stringIterator); - result = _('').chain().sortedLastIndex('', stringIterator, any); result = _(array).chain().sortedLastIndex(value); - result = _(array).chain().sortedLastIndex(value, arrayIterator); - result = _(array).chain().sortedLastIndex(value, arrayIterator, any); - result = _(array).chain().sortedLastIndex(value, ''); - result = _(array).chain().sortedLastIndex<{a: number}>(value, {a: 42}); result = _(list).chain().sortedLastIndex(value); - result = _(list).chain().sortedLastIndex(value, listIterator); - result = _(list).chain().sortedLastIndex(value, listIterator, any); - result = _(list).chain().sortedLastIndex(value, ''); - result = _(list).chain().sortedLastIndex(value, {a: 42}); - result = _(list).chain().sortedLastIndex(value, listIterator); - result = _(list).chain().sortedLastIndex(value, listIterator, any); - result = _(list).chain().sortedLastIndex<{a: number}, SampleType>(value, {a: 42}); + } +} + +// _.sortedLastIndexBy +module TestSortedLastIndexBy { + type SampleType = {a: number; b: string; c: boolean;}; + + let array: SampleType[]; + let list: _.List; + + let value: SampleType; + + let stringIterator: (x: string) => number; + let arrayIterator: (x: SampleType) => number; + let listIterator: (x: SampleType) => number; + + { + let result: number; + + result = _.sortedLastIndexBy('', '', stringIterator); + result = _.sortedLastIndexBy('', '', stringIterator); + + result = _.sortedLastIndexBy(array, value, arrayIterator); + result = _.sortedLastIndexBy(array, value, ''); + result = _.sortedLastIndexBy(array, value, {a: 42}); + result = _.sortedLastIndexBy(array, value, arrayIterator); + result = _.sortedLastIndexBy<{a: number}, SampleType>(array, value, {a: 42}); + + result = _.sortedLastIndexBy(list, value, listIterator); + result = _.sortedLastIndexBy(list, value, ''); + result = _.sortedLastIndexBy(list, value, {a: 42}); + result = _.sortedLastIndexBy(list, value, listIterator); + result = _.sortedLastIndexBy<{a: number}, SampleType>(list, value, {a: 42}); + + result = _('').sortedLastIndexBy('', stringIterator); + + result = _(array).sortedLastIndexBy(value, arrayIterator); + result = _(array).sortedLastIndexBy(value, ''); + result = _(array).sortedLastIndexBy<{a: number}>(value, {a: 42}); + + result = _(list).sortedLastIndexBy(value, listIterator); + result = _(list).sortedLastIndexBy(value, ''); + result = _(list).sortedLastIndexBy(value, {a: 42}); + result = _(list).sortedLastIndexBy(value, listIterator); + result = _(list).sortedLastIndexBy<{a: number}, SampleType>(value, {a: 42}); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _('').chain().sortedLastIndexBy('', stringIterator); + + result = _(array).chain().sortedLastIndexBy(value, arrayIterator); + result = _(array).chain().sortedLastIndexBy(value, ''); + result = _(array).chain().sortedLastIndexBy<{a: number}>(value, {a: 42}); + + result = _(list).chain().sortedLastIndexBy(value, listIterator); + result = _(list).chain().sortedLastIndexBy(value, ''); + result = _(list).chain().sortedLastIndexBy(value, {a: 42}); + result = _(list).chain().sortedLastIndexBy(value, listIterator); + result = _(list).chain().sortedLastIndexBy<{a: number}, SampleType>(value, {a: 42}); } } diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 03eb0b2d1..43542ec89 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -33,7 +33,7 @@ TODO: - [x] Split _.omit & _.pick into _.omitBy & _.pickBy - [x] Split _.sample into _.sampleSize - [x] Split _.sortedIndex into _.sortedIndexBy -- [ ] Split _.sortedLastIndex into _.sortedLastIndexBy +- [x] Split _.sortedLastIndex into _.sortedLastIndexBy - [ ] Split _.uniq into _.sortedUniq, _.sortedUniqBy, & _.uniqBy - [ ] Absorbed _.sortByAll into _.sortBy @@ -2517,20 +2517,24 @@ declare module _ { //_.sortedLastIndex interface LoDashStatic { /** - * This method is like _.sortedIndex except that it returns the highest index at which value should be - * inserted into array in order to maintain its sort order. + * This method is like `_.sortedIndex` except that it returns the highest + * index at which `value` should be inserted into `array` in order to + * maintain its sort order. * - * @param array The sorted array to inspect. - * @param value The value to evaluate. - * @param iteratee The function invoked per iteration. - * @param thisArg The this binding of iteratee. - * @return Returns the index at which value should be inserted into array. + * @static + * @memberOf _ + * @category Array + * @param {Array} array The sorted array to inspect. + * @param {*} value The value to evaluate. + * @returns {number} Returns the index at which `value` should be inserted into `array`. + * @example + * + * _.sortedLastIndex([4, 5], 4); + * // => 1 */ sortedLastIndex( array: List, - value: T, - iteratee?: (x: T) => TSort, - thisArg?: any + value: T ): number; /** @@ -2538,9 +2542,7 @@ declare module _ { */ sortedLastIndex( array: List, - value: T, - iteratee?: (x: T) => any, - thisArg?: any + value: T ): number; /** @@ -2548,8 +2550,7 @@ declare module _ { */ sortedLastIndex( array: List, - value: T, - iteratee: string + value: T ): number; /** @@ -2557,8 +2558,7 @@ declare module _ { */ sortedLastIndex( array: List, - value: T, - iteratee: W + value: T ): number; /** @@ -2566,8 +2566,7 @@ declare module _ { */ sortedLastIndex( array: List, - value: T, - iteratee: Object + value: T ): number; } @@ -2576,9 +2575,7 @@ declare module _ { * @see _.sortedLastIndex */ sortedLastIndex( - value: string, - iteratee?: (x: string) => TSort, - thisArg?: any + value: string ): number; } @@ -2587,25 +2584,21 @@ declare module _ { * @see _.sortedLastIndex */ sortedLastIndex( - value: T, - iteratee?: (x: T) => TSort, - thisArg?: any + value: T ): number; /** * @see _.sortedLastIndex */ sortedLastIndex( - value: T, - iteratee: string + value: T ): number; /** * @see _.sortedLastIndex */ sortedLastIndex( - value: T, - iteratee: W + value: T ): number; } @@ -2614,42 +2607,21 @@ declare module _ { * @see _.sortedLastIndex */ sortedLastIndex( - value: T, - iteratee?: (x: T) => TSort, - thisArg?: any + value: T ): number; /** * @see _.sortedLastIndex */ sortedLastIndex( - value: T, - iteratee?: (x: T) => any, - thisArg?: any - ): number; - - /** - * @see _.sortedLastIndex - */ - sortedLastIndex( - value: T, - iteratee: string + value: T ): number; /** * @see _.sortedLastIndex */ sortedLastIndex( - value: T, - iteratee: W - ): number; - - /** - * @see _.sortedLastIndex - */ - sortedLastIndex( - value: T, - iteratee: Object + value: T ): number; } @@ -2658,9 +2630,7 @@ declare module _ { * @see _.sortedLastIndex */ sortedLastIndex( - value: string, - iteratee?: (x: string) => TSort, - thisArg?: any + value: string ): LoDashExplicitWrapper; } @@ -2669,25 +2639,14 @@ declare module _ { * @see _.sortedLastIndex */ sortedLastIndex( - value: T, - iteratee?: (x: T) => TSort, - thisArg?: any + value: T ): LoDashExplicitWrapper; /** * @see _.sortedLastIndex */ sortedLastIndex( - value: T, - iteratee: string - ): LoDashExplicitWrapper; - - /** - * @see _.sortedLastIndex - */ - sortedLastIndex( - value: T, - iteratee: W + value: T ): LoDashExplicitWrapper; } @@ -2696,40 +2655,238 @@ declare module _ { * @see _.sortedLastIndex */ sortedLastIndex( - value: T, - iteratee?: (x: T) => TSort, - thisArg?: any + value: T ): LoDashExplicitWrapper; /** * @see _.sortedLastIndex */ sortedLastIndex( - value: T, - iteratee?: (x: T) => any, - thisArg?: any - ): LoDashExplicitWrapper; - - /** - * @see _.sortedLastIndex - */ - sortedLastIndex( - value: T, - iteratee: string + value: T ): LoDashExplicitWrapper; /** * @see _.sortedLastIndex */ sortedLastIndex( + value: T + ): LoDashExplicitWrapper; + } + + //_.sortedLastIndexBy + interface LoDashStatic { + /** + * This method is like `_.sortedLastIndex` except that it accepts `iteratee` + * which is invoked for `value` and each element of `array` to compute their + * sort ranking. The iteratee is invoked with one argument: (value). + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The sorted array to inspect. + * @param {*} value The value to evaluate. + * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element. + * @returns {number} Returns the index at which `value` should be inserted into `array`. + * @example + * + * // using the `_.property` iteratee shorthand + * _.sortedLastIndexBy([{ 'x': 4 }, { 'x': 5 }], { 'x': 4 }, 'x'); + * // => 1 + */ + sortedLastIndexBy( + array: List, + value: T, + iteratee: (x: T) => TSort + ): number; + + /** + * @see _.sortedLastIndexBy + */ + sortedLastIndexBy( + array: List, + value: T, + iteratee: (x: T) => any + ): number; + + /** + * @see _.sortedLastIndexBy + */ + sortedLastIndexBy( + array: List, + value: T, + iteratee: string + ): number; + + /** + * @see _.sortedLastIndexBy + */ + sortedLastIndexBy( + array: List, + value: T, + iteratee: W + ): number; + + /** + * @see _.sortedLastIndexBy + */ + sortedLastIndexBy( + array: List, + value: T, + iteratee: Object + ): number; + } + + interface LoDashImplicitWrapper { + /** + * @see _.sortedLastIndexBy + */ + sortedLastIndexBy( + value: string, + iteratee: (x: string) => TSort + ): number; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.sortedLastIndexBy + */ + sortedLastIndexBy( + value: T, + iteratee: (x: T) => TSort + ): number; + + /** + * @see _.sortedLastIndexBy + */ + sortedLastIndexBy( + value: T, + iteratee: string + ): number; + + /** + * @see _.sortedLastIndexBy + */ + sortedLastIndexBy( + value: T, + iteratee: W + ): number; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.sortedLastIndexBy + */ + sortedLastIndexBy( + value: T, + iteratee: (x: T) => TSort + ): number; + + /** + * @see _.sortedLastIndexBy + */ + sortedLastIndexBy( + value: T, + iteratee: (x: T) => any + ): number; + + /** + * @see _.sortedLastIndexBy + */ + sortedLastIndexBy( + value: T, + iteratee: string + ): number; + + /** + * @see _.sortedLastIndexBy + */ + sortedLastIndexBy( + value: T, + iteratee: W + ): number; + + /** + * @see _.sortedLastIndexBy + */ + sortedLastIndexBy( + value: T, + iteratee: Object + ): number; + } + + interface LoDashExplicitWrapper { + /** + * @see _.sortedLastIndexBy + */ + sortedLastIndexBy( + value: string, + iteratee: (x: string) => TSort + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.sortedLastIndexBy + */ + sortedLastIndexBy( + value: T, + iteratee: (x: T) => TSort + ): LoDashExplicitWrapper; + + /** + * @see _.sortedLastIndexBy + */ + sortedLastIndexBy( + value: T, + iteratee: string + ): LoDashExplicitWrapper; + + /** + * @see _.sortedLastIndexBy + */ + sortedLastIndexBy( + value: T, + iteratee: W + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.sortedLastIndexBy + */ + sortedLastIndexBy( + value: T, + iteratee: (x: T) => TSort + ): LoDashExplicitWrapper; + + /** + * @see _.sortedLastIndexBy + */ + sortedLastIndexBy( + value: T, + iteratee: (x: T) => any + ): LoDashExplicitWrapper; + + /** + * @see _.sortedLastIndexBy + */ + sortedLastIndexBy( + value: T, + iteratee: string + ): LoDashExplicitWrapper; + + /** + * @see _.sortedLastIndexBy + */ + sortedLastIndexBy( value: T, iteratee: W ): LoDashExplicitWrapper; /** - * @see _.sortedLastIndex + * @see _.sortedLastIndexBy */ - sortedLastIndex( + sortedLastIndexBy( value: T, iteratee: Object ): LoDashExplicitWrapper; From 618f01a953e24c808d820539fe0020bbbd029fce Mon Sep 17 00:00:00 2001 From: DomiR Date: Wed, 13 Jan 2016 23:18:31 +0100 Subject: [PATCH 19/51] (feature) Removed aliase _.unique --- lodash/lodash-tests.ts | 162 ------------ lodash/lodash.d.ts | 552 +++++++---------------------------------- 2 files changed, 89 insertions(+), 625 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index f1c04cb4f..ed873436a 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -2003,168 +2003,6 @@ module TestUniq { } } -// _.unique -module TestUnique { - type SampleObject = {a: number; b: string; c: boolean}; - - let array: SampleObject[]; - let list: _.List; - - let stringIterator: (value: string, index: number, collection: string) => string; - let listIterator: (value: SampleObject, index: number, collection: _.List) => number; - - { - let result: string[]; - - result = _.unique('abc'); - result = _.unique('abc', true); - result = _.unique('abc', true, stringIterator); - result = _.unique('abc', true, stringIterator, any); - result = _.unique('abc', true, stringIterator); - result = _.unique('abc', true, stringIterator, any); - result = _.unique('abc', stringIterator); - result = _.unique('abc', stringIterator, any); - result = _.unique('abc', stringIterator); - result = _.unique('abc', stringIterator, any); - } - - { - let result: SampleObject[]; - - result = _.unique(array); - result = _.unique(array, true); - result = _.unique(array, true, listIterator); - result = _.unique(array, true, listIterator, any); - result = _.unique(array, true, listIterator); - result = _.unique(array, true, listIterator, any); - result = _.unique(array, listIterator); - result = _.unique(array, listIterator, any); - result = _.unique(array, listIterator); - result = _.unique(array, listIterator, any); - result = _.unique(array, true, 'a'); - result = _.unique(array, true, 'a', any); - result = _.unique(array, 'a'); - result = _.unique(array, 'a', any); - result = _.unique(array, true, {a: 42}); - result = _.unique<{a: number}, SampleObject>(array, true, {a: 42}); - result = _.unique(array, {a: 42}); - result = _.unique<{a: number}, SampleObject>(array, {a: 42}); - - result = _.unique(list); - result = _.unique(list, true); - result = _.unique(list, true, listIterator); - result = _.unique(list, true, listIterator, any); - result = _.unique(list, true, listIterator); - result = _.unique(list, true, listIterator, any); - result = _.unique(list, listIterator); - result = _.unique(list, listIterator, any); - result = _.unique(list, listIterator); - result = _.unique(list, listIterator, any); - result = _.unique(list, true, 'a'); - result = _.unique(list, true, 'a', any); - result = _.unique(list, 'a'); - result = _.unique(list, 'a', any); - result = _.unique(list, true, {a: 42}); - result = _.unique<{a: number}, SampleObject>(list, true, {a: 42}); - result = _.unique(list, {a: 42}); - result = _.unique<{a: number}, SampleObject>(list, {a: 42}); - } - - { - let result: _.LoDashImplicitArrayWrapper; - - result = _('abc').unique(); - result = _('abc').unique(true); - result = _('abc').unique(true, stringIterator); - result = _('abc').unique(true, stringIterator, any); - result = _('abc').unique(stringIterator); - result = _('abc').unique(stringIterator, any); - } - - { - let result: _.LoDashImplicitArrayWrapper; - - result = _(array).unique(); - result = _(array).unique(true); - result = _(array).unique(true, listIterator); - result = _(array).unique(true, listIterator, any); - result = _(array).unique(listIterator); - result = _(array).unique(listIterator, any); - result = _(array).unique(true, 'a'); - result = _(array).unique(true, 'a', any); - result = _(array).unique('a'); - result = _(array).unique('a', any); - result = _(array).unique<{a: number}>(true, {a: 42}); - result = _(array).unique<{a: number}>({a: 42}); - - result = _(list).unique(); - result = _(list).unique(true); - result = _(list).unique(true, listIterator); - result = _(list).unique(true, listIterator, any); - result = _(list).unique(true, listIterator); - result = _(list).unique(true, listIterator, any); - result = _(list).unique(listIterator); - result = _(list).unique(listIterator, any); - result = _(list).unique(listIterator); - result = _(list).unique(listIterator, any); - result = _(list).unique(true, 'a'); - result = _(list).unique(true, 'a', any); - result = _(list).unique('a'); - result = _(list).unique('a', any); - result = _(list).unique(true, {a: 42}); - result = _(list).unique<{a: number}, SampleObject>(true, {a: 42}); - result = _(list).unique({a: 42}); - result = _(list).unique<{a: number}, SampleObject>({a: 42}); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _('abc').chain().unique(); - result = _('abc').chain().unique(true); - result = _('abc').chain().unique(true, stringIterator); - result = _('abc').chain().unique(true, stringIterator, any); - result = _('abc').chain().unique(stringIterator); - result = _('abc').chain().unique(stringIterator, any); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _(array).chain().unique(); - result = _(array).chain().unique(true); - result = _(array).chain().unique(true, listIterator); - result = _(array).chain().unique(true, listIterator, any); - result = _(array).chain().unique(listIterator); - result = _(array).chain().unique(listIterator, any); - result = _(array).chain().unique(true, 'a'); - result = _(array).chain().unique(true, 'a', any); - result = _(array).chain().unique('a'); - result = _(array).chain().unique('a', any); - result = _(array).chain().unique<{a: number}>(true, {a: 42}); - result = _(array).chain().unique<{a: number}>({a: 42}); - - result = _(list).chain().unique(); - result = _(list).chain().unique(true); - result = _(list).chain().unique(true, listIterator); - result = _(list).chain().unique(true, listIterator, any); - result = _(list).chain().unique(true, listIterator); - result = _(list).chain().unique(true, listIterator, any); - result = _(list).chain().unique(listIterator); - result = _(list).chain().unique(listIterator, any); - result = _(list).chain().unique(listIterator); - result = _(list).chain().unique(listIterator, any); - result = _(list).chain().unique(true, 'a'); - result = _(list).chain().unique(true, 'a', any); - result = _(list).chain().unique('a'); - result = _(list).chain().unique('a', any); - result = _(list).chain().unique(true, {a: 42}); - result = _(list).chain().unique<{a: number}, SampleObject>(true, {a: 42}); - result = _(list).chain().unique({a: 42}); - result = _(list).chain().unique<{a: number}, SampleObject>({a: 42}); - } -} - // _.upzip module TestUnzip { let array = [['a', 'b'], [1, 2], [true, false]]; diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 43542ec89..103897a2b 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -11,11 +11,13 @@ TODO: - [ ] Made _.forEach, _.forIn, _.forOwn, & _.times implicitly end a chain sequence - [ ] Removed thisArg params from most methods +- [ ] Check for aliases in this group - [x] Removed _.support - [x] Removed _.findWhere in favor of _.find with iteratee shorthand - [x] Removed _.where in favor of _.filter with iteratee shorthand - [x] Removed _.pluck in favor of _.map with iteratee shorthand +- [ ] Check for aliases in this group - [x] Renamed _.first to _.head - [x] Renamed _.indexBy to _.keyBy - [x] Renamed _.invoke to _.invokeMap @@ -28,6 +30,7 @@ TODO: - [x] Renamed _.trimLeft & _.trimRight to _.trimStart & _.trimEnd - [x] Renamed _.trunc to _.truncate +- [ ] Check for aliases in this group - [x] Split _.indexOf & _.lastIndexOf into _.sortedIndexOf & _.sortedLastIndexOf - [x] Split _.max & _.min into _.maxBy & _.minBy - [x] Split _.omit & _.pick into _.omitBy & _.pickBy @@ -36,6 +39,7 @@ TODO: - [x] Split _.sortedLastIndex into _.sortedLastIndexBy - [ ] Split _.uniq into _.sortedUniq, _.sortedUniqBy, & _.uniqBy +- [ ] Check for aliases in this group - [ ] Absorbed _.sortByAll into _.sortBy - [x] Changed the category of _.at to “Object” - [x] Changed the category of _.bindAll to “Utility” @@ -48,89 +52,89 @@ TODO: - [ ] Removed func-first param signature from _.before & _.after added 23 array methods: -- [ ] _.concat, -- [ ] _.differenceBy, -- [ ] _.differenceWith, -- [ ] _.flatMap, -- [ ] _.fromPairs, -- [ ] _.intersectionBy, -- [ ] _.intersectionWith, -- [ ] _.join, -- [ ] _.pullAll, -- [ ] _.pullAllBy, -- [ ] _.reverse, -- [ ] _.sortedIndexBy, -- [ ] _.sortedIndexOf, -- [ ] _.sortedLastIndexBy, -- [ ] _.sortedLastIndexOf, -- [ ] _.sortedUniq, -- [ ] _.sortedUniqBy, -- [ ] _.unionBy, -- [ ] _.unionWith, -- [ ] _.uniqBy, -- [ ] _.uniqWith, -- [ ] _.xorBy, & +- [ ] _.concat +- [ ] _.differenceBy +- [ ] _.differenceWith +- [ ] _.flatMap +- [ ] _.fromPairs +- [ ] _.intersectionBy +- [ ] _.intersectionWith +- [ ] _.join +- [ ] _.pullAll +- [ ] _.pullAllBy +- [ ] _.reverse +- [ ] _.sortedIndexBy +- [ ] _.sortedIndexOf +- [ ] _.sortedLastIndexBy +- [ ] _.sortedLastIndexOf +- [ ] _.sortedUniq +- [ ] _.sortedUniqBy +- [ ] _.unionBy +- [ ] _.unionWith +- [ ] _.uniqBy +- [ ] _.uniqWith +- [ ] _.xorBy - [ ] _.xorWith added 18 lang methods: -- [ ] _.cloneDeepWith, -- [ ] _.cloneWith, -- [ ] _.eq, -- [ ] _.isArrayLike, -- [ ] _.isArrayLikeObject, -- [ ] _.isEqualWith, -- [ ] _.isInteger, -- [ ] _.isLength, -- [ ] _.isMatchWith, -- [ ] _.isNil, -- [ ] _.isObjectLike, -- [ ] _.isSafeInteger, -- [ ] _.isSymbol, -- [ ] _.toInteger, -- [ ] _.toLength, -- [ ] _.toNumber, -- [ ] _.toSafeInteger, & +- [ ] _.cloneDeepWith +- [ ] _.cloneWith +- [ ] _.eq +- [ ] _.isArrayLike +- [ ] _.isArrayLikeObject +- [ ] _.isEqualWith +- [ ] _.isInteger +- [ ] _.isLength +- [ ] _.isMatchWith +- [ ] _.isNil +- [ ] _.isObjectLike +- [ ] _.isSafeInteger +- [ ] _.isSymbol +- [ ] _.toInteger +- [ ] _.toLength +- [ ] _.toNumber +- [ ] _.toSafeInteger - [ ] _.toString added 13 object methods: -- [ ] _.assignIn, -- [ ] _.assignInWith, -- [ ] _.assignWith, -- [ ] _.functionsIn, -- [ ] _.hasIn, -- [ ] _.invoke, -- [ ] _.mergeWith, -- [ ] _.omitBy, -- [ ] _.pickBy, -- [ ] _.setWith, -- [ ] _.toPairs, -- [ ] _.toPairsIn, & +- [ ] _.assignIn +- [ ] _.assignInWith +- [ ] _.assignWith +- [ ] _.functionsIn +- [ ] _.hasIn +- [ ] _.invoke +- [ ] _.mergeWith +- [ ] _.omitBy +- [ ] _.pickBy +- [ ] _.setWith +- [ ] _.toPairs +- [ ] _.toPairsIn - [ ] _.unset added 8 string methods: -- [ ] _.lowerCase, -- [ ] _.lowerFirst, -- [ ] _.replace, -- [ ] _.split, -- [ ] _.upperCase, -- [ ] _.upperFirst, -- [ ] _.toLower, & +- [ ] _.lowerCase +- [ ] _.lowerFirst +- [ ] _.replace +- [ ] _.split +- [ ] _.upperCase +- [ ] _.upperFirst +- [ ] _.toLower - [ ] _.toUpper added 8 utility methods: -- [ ] _.cond, -- [ ] _.conforms, -- [ ] _.nthArg, -- [ ] _.over, -- [ ] _.overEvery, -- [ ] _.overSome, -- [ ] _.rangeRight, & +- [ ] _.cond +- [ ] _.conforms +- [ ] _.nthArg +- [ ] _.over +- [ ] _.overEvery +- [ ] _.overSome +- [ ] _.rangeRight - [ ] _.toPath added 4 math methods: -- [ ] _.maxBy, -- [ ] _.mean, -- [ ] _.minBy, & +- [ ] _.maxBy +- [ ] _.mean +- [ ] _.minBy - [ ] _.sumBy added 2 function methods: @@ -153,7 +157,23 @@ Added 3 aliases - [x] _.first as an alias of _.head Removed 17 aliases -- [ ] _.all, _.any, _.backflow, _.callback, _.collect, _.compose, _.contains, _.detect, _.foldl, _.foldr, _.include, _.inject, _.methods, _.object, _.#run, _.select, & _.unique +- [ ] Removed aliase _.all +- [ ] Removed aliase _.any +- [ ] Removed aliase _.backflow +- [ ] Removed aliase _.callback +- [ ] Removed aliase _.collect +- [ ] Removed aliase _.compose +- [ ] Removed aliase _.contains +- [ ] Removed aliase _.detect +- [ ] Removed aliase _.foldl +- [ ] Removed aliase _.foldr +- [ ] Removed aliase _.include +- [ ] Removed aliase _.inject +- [ ] Removed aliase _.methods +- [ ] Removed aliase _.object +- [ ] Removed aliase _.#run +- [ ] Removed aliase _.select +- [x] Removed aliase _.unique Other changes - [ ] Added clear method to _.memoize.Cache @@ -3767,400 +3787,6 @@ declare module _ { ): LoDashExplicitArrayWrapper; } - //_.unique - interface LoDashStatic { - /** - * @see _.uniq - */ - unique( - array: List, - isSorted?: boolean, - iteratee?: ListIterator, - thisArg?: any - ): T[]; - - /** - * @see _.uniq - */ - unique( - array: List, - isSorted?: boolean, - iteratee?: ListIterator, - thisArg?: any - ): T[]; - - /** - * @see _.uniq - */ - unique( - array: List, - iteratee?: ListIterator, - thisArg?: any - ): T[]; - - /** - * @see _.uniq - */ - unique( - array: List, - iteratee?: ListIterator, - thisArg?: any - ): T[]; - - /** - * @see _.uniq - */ - unique( - array: List, - isSorted?: boolean, - iteratee?: string, - thisArg?: any - ): T[]; - - /** - * @see _.uniq - */ - unique( - array: List, - iteratee?: string, - thisArg?: any - ): T[]; - - /** - * @see _.uniq - */ - unique( - array: List, - isSorted?: boolean, - iteratee?: Object - ): T[]; - - /** - * @see _.uniq - */ - unique( - array: List, - isSorted?: boolean, - iteratee?: TWhere - ): T[]; - - /** - * @see _.uniq - */ - unique( - array: List, - iteratee?: Object - ): T[]; - - /** - * @see _.uniq - */ - unique( - array: List, - iteratee?: TWhere - ): T[]; - } - - interface LoDashImplicitWrapper { - /** - * @see _.uniq - */ - unique( - isSorted?: boolean, - iteratee?: ListIterator, - thisArg?: any - ): LoDashImplicitArrayWrapper; - - /** - * @see _.uniq - */ - unique( - iteratee?: ListIterator, - thisArg?: any - ): LoDashImplicitArrayWrapper; - } - - interface LoDashImplicitArrayWrapper { - /** - * @see _.uniq - */ - unique( - isSorted?: boolean, - iteratee?: ListIterator, - thisArg?: any - ): LoDashImplicitArrayWrapper; - - /** - * @see _.uniq - */ - unique( - iteratee?: ListIterator, - thisArg?: any - ): LoDashImplicitArrayWrapper; - - /** - * @see _.uniq - */ - unique( - isSorted?: boolean, - iteratee?: string, - thisArg?: any - ): LoDashImplicitArrayWrapper; - - /** - * @see _.uniq - */ - unique( - iteratee?: string, - thisArg?: any - ): LoDashImplicitArrayWrapper; - - /** - * @see _.uniq - */ - unique( - isSorted?: boolean, - iteratee?: TWhere - ): LoDashImplicitArrayWrapper; - - /** - * @see _.uniq - */ - unique( - iteratee?: TWhere - ): LoDashImplicitArrayWrapper; - } - - interface LoDashImplicitObjectWrapper { - unique( - isSorted?: boolean, - iteratee?: ListIterator, - thisArg?: any - ): LoDashImplicitArrayWrapper; - - /** - * @see _.uniq - */ - unique( - isSorted?: boolean, - iteratee?: ListIterator, - thisArg?: any - ): LoDashImplicitArrayWrapper; - - /** - * @see _.uniq - */ - unique( - iteratee?: ListIterator, - thisArg?: any - ): LoDashImplicitArrayWrapper; - - /** - * @see _.uniq - */ - unique( - iteratee?: ListIterator, - thisArg?: any - ): LoDashImplicitArrayWrapper; - - /** - * @see _.uniq - */ - unique( - isSorted?: boolean, - iteratee?: string, - thisArg?: any - ): LoDashImplicitArrayWrapper; - - /** - * @see _.uniq - */ - unique( - iteratee?: string, - thisArg?: any - ): LoDashImplicitArrayWrapper; - - /** - * @see _.uniq - */ - unique( - isSorted?: boolean, - iteratee?: Object - ): LoDashImplicitArrayWrapper; - - /** - * @see _.uniq - */ - unique( - isSorted?: boolean, - iteratee?: TWhere - ): LoDashImplicitArrayWrapper; - - /** - * @see _.uniq - */ - unique( - iteratee?: Object - ): LoDashImplicitArrayWrapper; - - /** - * @see _.uniq - */ - unique( - iteratee?: TWhere - ): LoDashImplicitArrayWrapper; - } - - interface LoDashExplicitWrapper { - /** - * @see _.uniq - */ - unique( - isSorted?: boolean, - iteratee?: ListIterator, - thisArg?: any - ): LoDashExplicitArrayWrapper; - - /** - * @see _.uniq - */ - unique( - iteratee?: ListIterator, - thisArg?: any - ): LoDashExplicitArrayWrapper; - } - - interface LoDashExplicitArrayWrapper { - /** - * @see _.uniq - */ - unique( - isSorted?: boolean, - iteratee?: ListIterator, - thisArg?: any - ): LoDashExplicitArrayWrapper; - - /** - * @see _.uniq - */ - unique( - iteratee?: ListIterator, - thisArg?: any - ): LoDashExplicitArrayWrapper; - - /** - * @see _.uniq - */ - unique( - isSorted?: boolean, - iteratee?: string, - thisArg?: any - ): LoDashExplicitArrayWrapper; - - /** - * @see _.uniq - */ - unique( - iteratee?: string, - thisArg?: any - ): LoDashExplicitArrayWrapper; - - /** - * @see _.uniq - */ - unique( - isSorted?: boolean, - iteratee?: TWhere - ): LoDashExplicitArrayWrapper; - - /** - * @see _.uniq - */ - unique( - iteratee?: TWhere - ): LoDashExplicitArrayWrapper; - } - - interface LoDashExplicitObjectWrapper { - unique( - isSorted?: boolean, - iteratee?: ListIterator, - thisArg?: any - ): LoDashExplicitArrayWrapper; - - /** - * @see _.uniq - */ - unique( - isSorted?: boolean, - iteratee?: ListIterator, - thisArg?: any - ): LoDashExplicitArrayWrapper; - - /** - * @see _.uniq - */ - unique( - iteratee?: ListIterator, - thisArg?: any - ): LoDashExplicitArrayWrapper; - - /** - * @see _.uniq - */ - unique( - iteratee?: ListIterator, - thisArg?: any - ): LoDashExplicitArrayWrapper; - - /** - * @see _.uniq - */ - unique( - isSorted?: boolean, - iteratee?: string, - thisArg?: any - ): LoDashExplicitArrayWrapper; - - /** - * @see _.uniq - */ - unique( - iteratee?: string, - thisArg?: any - ): LoDashExplicitArrayWrapper; - - /** - * @see _.uniq - */ - unique( - isSorted?: boolean, - iteratee?: Object - ): LoDashExplicitArrayWrapper; - - /** - * @see _.uniq - */ - unique( - isSorted?: boolean, - iteratee?: TWhere - ): LoDashExplicitArrayWrapper; - - /** - * @see _.uniq - */ - unique( - iteratee?: Object - ): LoDashExplicitArrayWrapper; - - /** - * @see _.uniq - */ - unique( - iteratee?: TWhere - ): LoDashExplicitArrayWrapper; - } - //_.unzip interface LoDashStatic { /** From 5dd9ae353ce862612130c1e856d933e5da0b3133 Mon Sep 17 00:00:00 2001 From: DomiR Date: Wed, 13 Jan 2016 23:21:24 +0100 Subject: [PATCH 20/51] (feature) Removed aliase _.select --- lodash/lodash-tests.ts | 98 ------------------------- lodash/lodash.d.ts | 163 +---------------------------------------- 2 files changed, 2 insertions(+), 259 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index ed873436a..d94e7a368 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -4778,104 +4778,6 @@ result = _.sampleSize([1, 2, 3, 4], 2); result = <_.LoDashImplicitArrayWrapper>_([1, 2, 3, 4]).sampleSize(2); result = _([1, 2, 3, 4]).sampleSize(2).value(); -// _.select -module TestSelect { - let array: TResult[]; - let list: _.List; - let dictionary: _.Dictionary; - - let stringIterator: (char: string, index: number, string: string) => any; - let listIterator: (value: TResult, index: number, collection: _.List) => any; - let dictionaryIterator: (value: TResult, key: string, collection: _.Dictionary) => any; - - { - let result: string[]; - - result = _.select('', stringIterator); - result = _.select('', stringIterator, any); - } - - { - let result: TResult[]; - - result = _.select(array, listIterator); - result = _.select(array, listIterator, any); - result = _.select(array, ''); - result = _.select(array, '', any); - result = _.select<{a: number}, TResult>(array, {a: 42}); - - result = _.select(list, listIterator); - result = _.select(list, listIterator, any); - result = _.select(list, ''); - result = _.select(list, '', any); - result = _.select<{a: number}, TResult>(list, {a: 42}); - - result = _.select(dictionary, dictionaryIterator); - result = _.select(dictionary, dictionaryIterator, any); - result = _.select(dictionary, ''); - result = _.select(dictionary, '', any); - result = _.select<{a: number}, TResult>(dictionary, {a: 42}); - } - - { - let result: _.LoDashImplicitArrayWrapper; - - result = _('').select(stringIterator); - result = _('').select(stringIterator, any); - } - - { - let result: _.LoDashImplicitArrayWrapper; - - result = _(array).select(listIterator); - result = _(array).select(listIterator, any); - result = _(array).select(''); - result = _(array).select('', any); - result = _(array).select<{a: number}>({a: 42}); - - result = _(list).select(listIterator); - result = _(list).select(listIterator, any); - result = _(list).select(''); - result = _(list).select('', any); - result = _(list).select<{a: number}, TResult>({a: 42}); - - result = _(dictionary).select(dictionaryIterator); - result = _(dictionary).select(dictionaryIterator, any); - result = _(dictionary).select(''); - result = _(dictionary).select('', any); - result = _(dictionary).select<{a: number}, TResult>({a: 42}); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _('').chain().select(stringIterator); - result = _('').chain().select(stringIterator, any); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _(array).chain().select(listIterator); - result = _(array).chain().select(listIterator, any); - result = _(array).chain().select(''); - result = _(array).chain().select('', any); - result = _(array).chain().select<{a: number}>({a: 42}); - - result = _(list).chain().select(listIterator); - result = _(list).chain().select(listIterator, any); - result = _(list).chain().select(''); - result = _(list).chain().select('', any); - result = _(list).chain().select<{a: number}, TResult>({a: 42}); - - result = _(dictionary).chain().select(dictionaryIterator); - result = _(dictionary).chain().select(dictionaryIterator, any); - result = _(dictionary).chain().select(''); - result = _(dictionary).chain().select('', any); - result = _(dictionary).chain().select<{a: number}, TResult>({a: 42}); - } -} - // _.shuffle module TestShuffle { let array: TResult[]; diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 103897a2b..e59f5a89e 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -171,8 +171,8 @@ Removed 17 aliases - [ ] Removed aliase _.inject - [ ] Removed aliase _.methods - [ ] Removed aliase _.object -- [ ] Removed aliase _.#run -- [ ] Removed aliase _.select +- [ ] Removed aliase _.run +- [x] Removed aliase _.select - [x] Removed aliase _.unique Other changes @@ -7927,165 +7927,6 @@ declare module _ { sampleSize(): LoDashImplicitWrapper; } - //_.select - interface LoDashStatic { - /** - * @see _.filter - */ - select( - collection: List, - predicate?: ListIterator, - thisArg?: any - ): T[]; - - /** - * @see _.filter - */ - select( - collection: Dictionary, - predicate?: DictionaryIterator, - thisArg?: any - ): T[]; - - /** - * @see _.filter - */ - select( - collection: string, - predicate?: StringIterator, - thisArg?: any - ): string[]; - - /** - * @see _.filter - */ - select( - collection: List|Dictionary, - predicate: string, - thisArg?: any - ): T[]; - - /** - * @see _.filter - */ - select( - collection: List|Dictionary, - predicate: W - ): T[]; - } - - interface LoDashImplicitWrapper { - /** - * @see _.filter - */ - select( - predicate?: StringIterator, - thisArg?: any - ): LoDashImplicitArrayWrapper; - } - - interface LoDashImplicitArrayWrapper { - /** - * @see _.filter - */ - select( - predicate: ListIterator, - thisArg?: any - ): LoDashImplicitArrayWrapper; - - /** - * @see _.filter - */ - select( - predicate: string, - thisArg?: any - ): LoDashImplicitArrayWrapper; - - /** - * @see _.filter - */ - select(predicate: W): LoDashImplicitArrayWrapper; - } - - interface LoDashImplicitObjectWrapper { - /** - * @see _.filter - */ - select( - predicate: ListIterator|DictionaryIterator, - thisArg?: any - ): LoDashImplicitArrayWrapper; - - /** - * @see _.filter - */ - select( - predicate: string, - thisArg?: any - ): LoDashImplicitArrayWrapper; - - /** - * @see _.filter - */ - select(predicate: W): LoDashImplicitArrayWrapper; - } - - interface LoDashExplicitWrapper { - /** - * @see _.filter - */ - select( - predicate?: StringIterator, - thisArg?: any - ): LoDashExplicitArrayWrapper; - } - - interface LoDashExplicitArrayWrapper { - /** - * @see _.filter - */ - select( - predicate: ListIterator, - thisArg?: any - ): LoDashExplicitArrayWrapper; - - /** - * @see _.filter - */ - select( - predicate: string, - thisArg?: any - ): LoDashExplicitArrayWrapper; - - /** - * @see _.filter - */ - select(predicate: W): LoDashExplicitArrayWrapper; - } - - interface LoDashExplicitObjectWrapper { - /** - * @see _.filter - */ - select( - predicate: ListIterator|DictionaryIterator, - thisArg?: any - ): LoDashExplicitArrayWrapper; - - /** - * @see _.filter - */ - select( - predicate: string, - thisArg?: any - ): LoDashExplicitArrayWrapper; - - /** - * @see _.filter - */ - select(predicate: W): LoDashExplicitArrayWrapper; - } - //_.shuffle interface LoDashStatic { /** From 4a5102e41bf5a13b5dc584c6a6dbac0d8a060e06 Mon Sep 17 00:00:00 2001 From: DomiR Date: Wed, 13 Jan 2016 23:23:15 +0100 Subject: [PATCH 21/51] (feature) Removed aliase _.run --- lodash/lodash-tests.ts | 38 -------------------------------------- lodash/lodash.d.ts | 12 ++---------- 2 files changed, 2 insertions(+), 48 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index d94e7a368..1a4bf57d6 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -2744,44 +2744,6 @@ module TestReverse { } } -// _.prototype.run -module TestRun { - { - let result: string; - - result = _('').run(); - result = _('').chain().run(); - } - - { - let result: number; - - result = _(42).run(); - result = _(42).chain().run(); - } - - { - let result: boolean; - - result = _(true).run(); - result = _(true).chain().run(); - } - - { - let result: string[]; - - result = _([]).run(); - result = _([]).chain().run(); - } - - { - let result: {a: string}; - - result = _({a: ''}).run(); - result = _({a: ''}).chain().run(); - } -} - // _.prototype.toJSON module TestToJSON { { diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index e59f5a89e..11845033b 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -171,7 +171,7 @@ Removed 17 aliases - [ ] Removed aliase _.inject - [ ] Removed aliase _.methods - [ ] Removed aliase _.object -- [ ] Removed aliase _.run +- [x] Removed aliase _.run - [x] Removed aliase _.select - [x] Removed aliase _.unique @@ -4461,14 +4461,6 @@ declare module _ { reverse(): LoDashExplicitArrayWrapper; } - //_.prototype.run - interface LoDashWrapperBase { - /** - * @see _.value - */ - run(): T; - } - //_.prototype.toJSON interface LoDashWrapperBase { /** @@ -4492,7 +4484,7 @@ declare module _ { /** * Executes the chained sequence to extract the unwrapped value. * - * @alias _.run, _.toJSON, _.valueOf + * @alias _.toJSON, _.valueOf * * @return Returns the resolved unwrapped value. */ From 3ee78754090916e910e64f30738b63ec06b94705 Mon Sep 17 00:00:00 2001 From: DomiR Date: Wed, 13 Jan 2016 23:42:39 +0100 Subject: [PATCH 22/51] (feature) Removed aliases _.all, _.any, _.backflow, _.callback, _.collect, _.compose, _.contains, _.detect, _.foldl, _.foldr, _.include, _.inject, _.methods, _.object --- lodash/lodash-tests.ts | 707 ----------------------- lodash/lodash.d.ts | 1236 ++-------------------------------------- 2 files changed, 50 insertions(+), 1893 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 1a4bf57d6..1d0f2fa96 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -1008,134 +1008,6 @@ module TestLastIndexOf { } } -// _.object -module TestObject { - let arrayOfKeys: string[]; - let arrayOfValues: number[]; - let arrayOfKeyValuePairs: (string|number)[][] - - let listOfKeys: _.List; - let listOfValues: _.List; - let listOfKeyValuePairs: _.List<_.List>; - - { - let result: _.Dictionary; - - result = _.object<_.Dictionary>(arrayOfKeys); - result = _.object<_.Dictionary>(listOfKeys); - } - - { - let result: _.Dictionary; - - result = _.object<_.Dictionary>(arrayOfKeys, arrayOfValues); - result = _.object<_.Dictionary>(arrayOfKeys, listOfValues); - result = _.object<_.Dictionary>(listOfKeys, listOfValues); - result = _.object<_.Dictionary>(listOfKeys, arrayOfValues); - - result = _.object>(arrayOfKeys, arrayOfValues); - result = _.object>(arrayOfKeys, listOfValues); - result = _.object>(listOfKeys, listOfValues); - result = _.object>(listOfKeys, arrayOfValues); - - result = _.object<_.Dictionary>(arrayOfKeyValuePairs); - result = _.object<_.Dictionary>(listOfKeyValuePairs); - } - - { - let result: _.Dictionary; - - result = _.object(arrayOfKeys); - result = _.object(arrayOfKeys, arrayOfValues); - result = _.object(arrayOfKeys, listOfValues); - - result = _.object(listOfKeys); - result = _.object(listOfKeys, listOfValues); - result = _.object(listOfKeys, arrayOfValues); - - result = _.object<_.Dictionary>(arrayOfKeyValuePairs); - result = _.object<_.Dictionary>(listOfKeyValuePairs); - } - - { - let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; - - result = _(arrayOfKeys).object<_.Dictionary>(); - result = _(listOfKeys).object<_.Dictionary>(); - } - - { - let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; - - result = _(arrayOfKeys).object<_.Dictionary>(arrayOfValues); - result = _(arrayOfKeys).object<_.Dictionary>(listOfValues); - result = _(listOfKeys).object<_.Dictionary>(listOfValues); - result = _(listOfKeys).object<_.Dictionary>(arrayOfValues); - - result = _(arrayOfKeys).object>(arrayOfValues); - result = _(arrayOfKeys).object>(listOfValues); - result = _(listOfKeys).object>(listOfValues); - result = _(listOfKeys).object>(arrayOfValues); - - result = _(listOfKeys).object<_.Dictionary>(arrayOfKeyValuePairs); - result = _(listOfKeys).object<_.Dictionary>(listOfKeyValuePairs); - } - - { - let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; - - result = _(arrayOfKeys).object(); - result = _(arrayOfKeys).object(arrayOfValues); - result = _(arrayOfKeys).object(listOfValues); - - result = _(listOfKeys).object(); - result = _(listOfKeys).object(listOfValues); - result = _(listOfKeys).object(arrayOfValues); - - result = _(listOfKeys).object(arrayOfKeyValuePairs); - result = _(listOfKeys).object(listOfKeyValuePairs); - } - - { - let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; - - result = _(arrayOfKeys).chain().object<_.Dictionary>(); - result = _(listOfKeys).chain().object<_.Dictionary>(); - } - - { - let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; - - result = _(arrayOfKeys).chain().object<_.Dictionary>(arrayOfValues); - result = _(arrayOfKeys).chain().object<_.Dictionary>(listOfValues); - result = _(listOfKeys).chain().object<_.Dictionary>(listOfValues); - result = _(listOfKeys).chain().object<_.Dictionary>(arrayOfValues); - - result = _(arrayOfKeys).chain().object>(arrayOfValues); - result = _(arrayOfKeys).chain().object>(listOfValues); - result = _(listOfKeys).chain().object>(listOfValues); - result = _(listOfKeys).chain().object>(arrayOfValues); - - result = _(listOfKeys).chain().object<_.Dictionary>(arrayOfKeyValuePairs); - result = _(listOfKeys).chain().object<_.Dictionary>(listOfKeyValuePairs); - } - - { - let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; - - result = _(arrayOfKeys).chain().object(); - result = _(arrayOfKeys).chain().object(arrayOfValues); - result = _(arrayOfKeys).chain().object(listOfValues); - - result = _(listOfKeys).chain().object(); - result = _(listOfKeys).chain().object(listOfValues); - result = _(listOfKeys).chain().object(arrayOfValues); - - result = _(listOfKeys).chain().object(arrayOfKeyValuePairs); - result = _(listOfKeys).chain().object(listOfKeyValuePairs); - } -} - // _.pull module TestPull { let array: TResult[]; @@ -2879,170 +2751,6 @@ module TestValueOf { * Collection * **************/ -// _.all -module TestAll { - let array: TResult[]; - let list: _.List; - let dictionary: _.Dictionary; - - let listIterator: (value: TResult, index: number, collection: _.List) => boolean; - let dictionaryIterator: (value: TResult, key: string, collection: _.Dictionary) => boolean; - - { - let result: boolean; - - result = _.all(array); - result = _.all(array, listIterator); - result = _.all(array, listIterator, any); - result = _.all(array, ''); - result = _.all<{a: number}, TResult>(array, {a: 42}); - - result = _.all(list); - result = _.all(list, listIterator); - result = _.all(list, listIterator, any); - result = _.all(list, ''); - result = _.all<{a: number}, TResult>(list, {a: 42}); - - result = _.all(dictionary); - result = _.all(dictionary, dictionaryIterator); - result = _.all(dictionary, dictionaryIterator, any); - result = _.all(dictionary, ''); - result = _.all<{a: number}, TResult>(dictionary, {a: 42}); - - result = _(array).all(); - result = _(array).all(listIterator); - result = _(array).all(listIterator, any); - result = _(array).all(''); - result = _(array).all<{a: number}>({a: 42}); - - result = _(list).all(); - result = _(list).all(listIterator); - result = _(list).all(listIterator, any); - result = _(list).all(''); - result = _(list).all<{a: number}>({a: 42}); - - result = _(dictionary).all(); - result = _(dictionary).all(dictionaryIterator); - result = _(dictionary).all(dictionaryIterator, any); - result = _(dictionary).all(''); - result = _(dictionary).all<{a: number}>({a: 42}); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(array).chain().all(); - result = _(array).chain().all(listIterator); - result = _(array).chain().all(listIterator, any); - result = _(array).chain().all(''); - result = _(array).chain().all<{a: number}>({a: 42}); - - result = _(list).chain().all(); - result = _(list).chain().all(listIterator); - result = _(list).chain().all(listIterator, any); - result = _(list).chain().all(''); - result = _(list).chain().all<{a: number}>({a: 42}); - - result = _(dictionary).chain().all(); - result = _(dictionary).chain().all(dictionaryIterator); - result = _(dictionary).chain().all(dictionaryIterator, any); - result = _(dictionary).chain().all(''); - result = _(dictionary).chain().all<{a: number}>({a: 42}); - } -} - -// _.any -module TestAny { - let array: TResult[]; - let list: _.List; - let dictionary: _.Dictionary; - let numericDictionary: _.NumericDictionary; - - let listIterator: (value: TResult, index: number, collection: _.List) => boolean; - let dictionaryIterator: (value: TResult, key: string, collection: _.Dictionary) => boolean; - let numericDictionaryIterator: (value: TResult, key: number, collection: _.NumericDictionary) => boolean; - - { - let result: boolean; - - result = _.any(array); - result = _.any(array, listIterator); - result = _.any(array, listIterator, any); - result = _.any(array, ''); - result = _.any<{a: number}, TResult>(array, {a: 42}); - - result = _.any(list); - result = _.any(list, listIterator); - result = _.any(list, listIterator, any); - result = _.any(list, ''); - result = _.any<{a: number}, TResult>(list, {a: 42}); - - result = _.any(dictionary); - result = _.any(dictionary, dictionaryIterator); - result = _.any(dictionary, dictionaryIterator, any); - result = _.any(dictionary, ''); - result = _.any<{a: number}, TResult>(dictionary, {a: 42}); - - result = _.any(numericDictionary); - result = _.any(numericDictionary, numericDictionaryIterator); - result = _.any(numericDictionary, numericDictionaryIterator, any); - result = _.any(numericDictionary, ''); - result = _.any<{a: number}, TResult>(numericDictionary, {a: 42}); - - result = _(array).any(); - result = _(array).any(listIterator); - result = _(array).any(listIterator, any); - result = _(array).any(''); - result = _(array).any<{a: number}>({a: 42}); - - result = _(list).any(); - result = _(list).any(listIterator); - result = _(list).any(listIterator, any); - result = _(list).any(''); - result = _(list).any<{a: number}>({a: 42}); - - result = _(dictionary).any(); - result = _(dictionary).any(dictionaryIterator); - result = _(dictionary).any(dictionaryIterator, any); - result = _(dictionary).any(''); - result = _(dictionary).any<{a: number}>({a: 42}); - - result = _(numericDictionary).any(); - result = _(numericDictionary).any(numericDictionaryIterator); - result = _(numericDictionary).any(numericDictionaryIterator, any); - result = _(numericDictionary).any(''); - result = _(numericDictionary).any<{a: number}>({a: 42}); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(array).chain().any(); - result = _(array).chain().any(listIterator); - result = _(array).chain().any(listIterator, any); - result = _(array).chain().any(''); - result = _(array).chain().any<{a: number}>({a: 42}); - - result = _(list).chain().any(); - result = _(list).chain().any(listIterator); - result = _(list).chain().any(listIterator, any); - result = _(list).chain().any(''); - result = _(list).chain().any<{a: number}>({a: 42}); - - result = _(dictionary).chain().any(); - result = _(dictionary).chain().any(dictionaryIterator); - result = _(dictionary).chain().any(dictionaryIterator, any); - result = _(dictionary).chain().any(''); - result = _(dictionary).chain().any<{a: number}>({a: 42}); - - result = _(numericDictionary).chain().any(); - result = _(numericDictionary).chain().any(numericDictionaryIterator); - result = _(numericDictionary).chain().any(numericDictionaryIterator, any); - result = _(numericDictionary).chain().any(''); - result = _(numericDictionary).chain().any<{a: number}>({a: 42}); - } -} - // _.at module TestAt { let array: TResult[]; @@ -3074,143 +2782,6 @@ module TestAt { } } -// _.collect -module TestCollect { - let array: number[]; - let list: _.List; - let dictionary: _.Dictionary; - - let listIterator: (value: number, index: number, collection: _.List) => TResult; - let dictionaryIterator: (value: number, key: string, collection: _.Dictionary) => TResult; - - { - let result: TResult[]; - - result = _.collect(array); - result = _.collect(array, listIterator); - result = _.collect(array, listIterator, any); - result = _.collect(array, ''); - - result = _.collect(list); - result = _.collect(list, listIterator); - result = _.collect(list, listIterator, any); - result = _.collect(list, ''); - - result = _.collect(dictionary); - result = _.collect(dictionary, dictionaryIterator); - result = _.collect(dictionary, dictionaryIterator, any); - result = _.collect(dictionary, ''); - } - - { - let result: boolean[]; - - result = _.collect(array, {}); - result = _.collect(list, {}); - result = _.collect(dictionary, {}); - } - - { - let result: _.LoDashImplicitArrayWrapper; - - result = _(array).collect(); - result = _(array).collect(listIterator); - result = _(array).collect(listIterator, any); - result = _(array).collect(''); - - result = _(list).collect(); - result = _(list).collect(listIterator); - result = _(list).collect(listIterator, any); - result = _(list).collect(''); - - result = _(dictionary).collect(); - result = _(dictionary).collect(dictionaryIterator); - result = _(dictionary).collect(dictionaryIterator, any); - result = _(dictionary).collect(''); - } - - { - let result: _.LoDashImplicitArrayWrapper; - - result = _(array).collect<{}>({}); - result = _(list).collect<{}>({}); - result = _(dictionary).collect<{}>({}); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _(array).chain().collect(); - result = _(array).chain().collect(listIterator); - result = _(array).chain().collect(listIterator, any); - result = _(array).chain().collect(''); - - result = _(list).chain().collect(); - result = _(list).chain().collect(listIterator); - result = _(list).chain().collect(listIterator, any); - result = _(list).chain().collect(''); - - result = _(dictionary).chain().collect(); - result = _(dictionary).chain().collect(dictionaryIterator); - result = _(dictionary).chain().collect(dictionaryIterator, any); - result = _(dictionary).chain().collect(''); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _(array).chain().collect<{}>({}); - result = _(list).chain().collect<{}>({}); - result = _(dictionary).chain().collect<{}>({}); - } -} - -// _.contains -module TestContains { - type SampleType = {a: string; b: number; c: boolean;}; - - let array: SampleType[]; - let list: _.List; - let dictionary: _.Dictionary; - - let target: SampleType; - - { - let result: boolean; - - result = _.contains(array, target); - result = _.contains(array, target, 42); - - result = _.contains(list, target); - result = _.contains(list, target, 42); - - result = _.contains(dictionary, target); - result = _.contains(dictionary, target, 42); - - result = _(array).contains(target); - result = _(array).contains(target, 42); - - result = _(list).contains(target); - result = _(list).contains(target, 42); - - result = _(dictionary).contains(target); - result = _(dictionary).contains(target, 42); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(array).chain().contains(target); - result = _(array).chain().contains(target, 42); - - result = _(list).chain().contains(target); - result = _(list).chain().contains(target, 42); - - result = _(dictionary).chain().contains(target); - result = _(dictionary).chain().contains(target, 42); - } -} - // _.countBy module TestCountBy { let array: TResult[]; @@ -3344,54 +2915,6 @@ module TestCountBy { } } -// _.detect -module TestDetect { - let array: TResult[]; - let list: _.List; - let dictionary: _.Dictionary; - - let listIterator: (value: TResult, index: number, collection: _.List) => boolean; - let dictionaryIterator: (value: TResult, key: string, collection: _.Dictionary) => boolean; - - let result: TResult; - - result = _.detect(array); - result = _.detect(array, listIterator); - result = _.detect(array, listIterator, any); - result = _.detect(array, ''); - result = _.detect<{a: number}, TResult>(array, {a: 42}); - - result = _.detect(list); - result = _.detect(list, listIterator); - result = _.detect(list, listIterator, any); - result = _.detect(list, ''); - result = _.detect<{a: number}, TResult>(list, {a: 42}); - - result = _.detect(dictionary); - result = _.detect(dictionary, dictionaryIterator); - result = _.detect(dictionary, dictionaryIterator, any); - result = _.detect(dictionary, ''); - result = _.detect<{a: number}, TResult>(dictionary, {a: 42}); - - result = _(array).detect(); - result = _(array).detect(listIterator); - result = _(array).detect(listIterator, any); - result = _(array).detect(''); - result = _(array).detect<{a: number}>({a: 42}); - - result = _(list).detect(); - result = _(list).detect(listIterator); - result = _(list).detect(listIterator, any); - result = _(list).detect(''); - result = _(list).detect<{a: number}, TResult>({a: 42}); - - result = _(dictionary).detect(); - result = _(dictionary).detect(dictionaryIterator); - result = _(dictionary).detect(dictionaryIterator, any); - result = _(dictionary).detect(''); - result = _(dictionary).detect<{a: number}, TResult>({a: 42}); -} - // _.each module TestEach { let array: TResult[]; @@ -4151,52 +3674,6 @@ module TestGroupBy { } } -// _.include -module TestInclude { - type SampleType = {a: string; b: number; c: boolean;}; - - let array: SampleType[]; - let list: _.List; - let dictionary: _.Dictionary; - - let target: SampleType; - - { - let result: boolean; - - result = _.include(array, target); - result = _.include(array, target, 42); - - result = _.include(list, target); - result = _.include(list, target, 42); - - result = _.include(dictionary, target); - result = _.include(dictionary, target, 42); - - result = _(array).include(target); - result = _(array).include(target, 42); - - result = _(list).include(target); - result = _(list).include(target, 42); - - result = _(dictionary).include(target); - result = _(dictionary).include(target, 42); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(array).chain().include(target); - result = _(array).chain().include(target, 42); - - result = _(list).chain().include(target); - result = _(list).chain().include(target, 42); - - result = _(dictionary).chain().include(target); - result = _(dictionary).chain().include(target, 42); - } -} - // _.includes module TestIncludes { type SampleType = {a: string; b: number; c: boolean;}; @@ -4589,22 +4066,6 @@ result = _.reduce({ 'a': 1, 'b': 2, 'c': 3 }, function (r: ABC, num: number return r; }, {}); -result = _.foldl([1, 2, 3], function (sum: number, num: number) { - return sum + num; -}); -result = _.foldl({ 'a': 1, 'b': 2, 'c': 3 }, function (r: ABC, num: number, key: string) { - r[key] = num * 3; - return r; -}, {}); - -result = _.inject([1, 2, 3], function (sum: number, num: number) { - return sum + num; -}); -result = _.inject({ 'a': 1, 'b': 2, 'c': 3 }, function (r: ABC, num: number, key: string) { - r[key] = num * 3; - return r; -}, {}); - result = _([1, 2, 3]).reduce(function (sum: number, num: number) { return sum + num; }); @@ -4613,24 +4074,7 @@ result = _({ 'a': 1, 'b': 2, 'c': 3 }).reduce(function (r: ABC return r; }, {}); -result = _([1, 2, 3]).foldl(function (sum: number, num: number) { - return sum + num; -}); -result = _({ 'a': 1, 'b': 2, 'c': 3 }).foldl(function (r: ABC, num: number, key: string) { - r[key] = num * 3; - return r; -}, {}); - -result = _([1, 2, 3]).inject(function (sum: number, num: number) { - return sum + num; -}); -result = _({ 'a': 1, 'b': 2, 'c': 3 }).inject(function (r: ABC, num: number, key: string) { - r[key] = num * 3; - return r; -}, {}); - result = _.reduceRight([[0, 1], [2, 3], [4, 5]], function (a: number[], b: number[]) { return a.concat(b); }, []); -result = _.foldr([[0, 1], [2, 3], [4, 5]], function (a: number[], b: number[]) { return a.concat(b); }, []); // _.reject module TestReject { @@ -5229,36 +4673,6 @@ module TestAry { } } -// _.backflow -module TestBackflow { - let Fn1: (n: number) => number; - let Fn2: (m: number, n: number) => number; - - { - let result: (m: number, n: number) => number; - - result = _.backflow<(m: number, n: number) => number>(Fn1, Fn2); - result = _.backflow<(m: number, n: number) => number>(Fn1, Fn1, Fn2); - result = _.backflow<(m: number, n: number) => number>(Fn1, Fn1, Fn1, Fn2); - } - - { - let result: _.LoDashImplicitObjectWrapper<(m: number, n: number) => number>; - - result = _(Fn1).backflow<(m: number, n: number) => number>(Fn2); - result = _(Fn1).backflow<(m: number, n: number) => number>(Fn1, Fn2); - result = _(Fn1).backflow<(m: number, n: number) => number>(Fn1, Fn1, Fn2); - } - - { - let result: _.LoDashExplicitObjectWrapper<(m: number, n: number) => number>; - - result = _(Fn1).chain().backflow<(m: number, n: number) => number>(Fn2); - result = _(Fn1).chain().backflow<(m: number, n: number) => number>(Fn1, Fn2); - result = _(Fn1).chain().backflow<(m: number, n: number) => number>(Fn1, Fn1, Fn2); - } -} - // _.before module TestBefore { interface Func { @@ -5488,36 +4902,6 @@ module TestBindKey { } } -// _.compose -module TestCompose { - let Fn1: (n: number) => number; - let Fn2: (m: number, n: number) => number; - - { - let result: (m: number, n: number) => number; - - result = _.compose<(m: number, n: number) => number>(Fn1, Fn2); - result = _.compose<(m: number, n: number) => number>(Fn1, Fn1, Fn2); - result = _.compose<(m: number, n: number) => number>(Fn1, Fn1, Fn1, Fn2); - } - - { - let result: _.LoDashImplicitObjectWrapper<(m: number, n: number) => number>; - - result = _(Fn1).compose<(m: number, n: number) => number>(Fn2); - result = _(Fn1).compose<(m: number, n: number) => number>(Fn1, Fn2); - result = _(Fn1).compose<(m: number, n: number) => number>(Fn1, Fn1, Fn2); - } - - { - let result: _.LoDashExplicitObjectWrapper<(m: number, n: number) => number>; - - result = _(Fn1).chain().compose<(m: number, n: number) => number>(Fn2); - result = _(Fn1).chain().compose<(m: number, n: number) => number>(Fn1, Fn2); - result = _(Fn1).chain().compose<(m: number, n: number) => number>(Fn1, Fn1, Fn2); - } -} - var createCallbackObj: { [index: string]: string; } = { name: 'Joe' }; result = <() => any>_.createCallback('name'); result = <() => boolean>_.createCallback(createCallbackObj); @@ -8345,31 +7729,6 @@ module TestMerge { } } -// _.methods -module TestFunctions { - type SampleObject = {a: number; b: string; c: boolean;}; - - let object: SampleObject; - - { - let result: string[]; - - result = _.methods(object); - } - - { - let result: _.LoDashImplicitArrayWrapper; - - result = _(object).methods(); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _(object).chain().methods(); - } -} - // _.omit module TestOmit { let predicate: (element: any, key: string, collection: any) => boolean; @@ -9147,72 +8506,6 @@ module TestAttempt { } } -// _.callback -module TestCallback { - { - let result: (...args: any[]) => TResult; - - result = _.callback(Function); - result = _.callback(Function, any); - } - - { - let result: (object: any) => TResult; - - result = _.callback(''); - result = _.callback('', any); - } - - { - let result: (object: any) => boolean; - - result = _.callback({}); - result = _.callback({}, any); - } - - { - let result: _.LoDashImplicitObjectWrapper<(...args: any[]) => TResult>; - - result = _(Function).callback(); - result = _(Function).callback(any); - } - - { - let result: _.LoDashImplicitObjectWrapper<(object: any) => TResult>; - - result = _('').callback(); - result = _('').callback(any); - } - - { - let result: _.LoDashImplicitObjectWrapper<(object: any) => boolean>; - - result = _({}).callback(); - result = _({}).callback(any); - } - - { - let result: _.LoDashExplicitObjectWrapper<(...args: any[]) => TResult>; - - result = _(Function).chain().callback(); - result = _(Function).chain().callback(any); - } - - { - let result: _.LoDashExplicitObjectWrapper<(object: any) => TResult>; - - result = _('').chain().callback(); - result = _('').chain().callback(any); - } - - { - let result: _.LoDashExplicitObjectWrapper<(object: any) => boolean>; - - result = _({}).chain().callback(); - result = _({}).chain().callback(any); - } -} - // _.constant module TestConstant { { diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 11845033b..8500d9ecf 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -157,20 +157,20 @@ Added 3 aliases - [x] _.first as an alias of _.head Removed 17 aliases -- [ ] Removed aliase _.all -- [ ] Removed aliase _.any -- [ ] Removed aliase _.backflow -- [ ] Removed aliase _.callback -- [ ] Removed aliase _.collect -- [ ] Removed aliase _.compose -- [ ] Removed aliase _.contains -- [ ] Removed aliase _.detect -- [ ] Removed aliase _.foldl -- [ ] Removed aliase _.foldr -- [ ] Removed aliase _.include -- [ ] Removed aliase _.inject -- [ ] Removed aliase _.methods -- [ ] Removed aliase _.object +- [x] Removed aliase _.all +- [x] Removed aliase _.any +- [x] Removed aliase _.backflow +- [x] Removed aliase _.callback +- [x] Removed aliase _.collect +- [x] Removed aliase _.compose +- [x] Removed aliase _.contains +- [x] Removed aliase _.detect +- [x] Removed aliase _.foldl +- [x] Removed aliase _.foldr +- [x] Removed aliase _.include +- [x] Removed aliase _.inject +- [x] Removed aliase _.methods +- [x] Removed aliase _.object - [x] Removed aliase _.run - [x] Removed aliase _.select - [x] Removed aliase _.unique @@ -1705,125 +1705,6 @@ declare module _ { ): LoDashExplicitWrapper; } - //_.object - interface LoDashStatic { - /** - * @see _.zipObject - */ - object( - props: List|List>, - values?: List - ): TResult; - - /** - * @see _.zipObject - */ - object( - props: List|List>, - values?: List - ): TResult; - - /** - * @see _.zipObject - */ - object( - props: List|List>, - values?: List - ): _.Dictionary; - } - - interface LoDashImplicitArrayWrapper { - /** - * @see _.zipObject - */ - object( - values?: List - ): _.LoDashImplicitObjectWrapper; - - /** - * @see _.zipObject - */ - object( - values?: List - ): _.LoDashImplicitObjectWrapper; - - /** - * @see _.zipObject - */ - object( - values?: List - ): _.LoDashImplicitObjectWrapper<_.Dictionary>; - } - - interface LoDashImplicitObjectWrapper { - /** - * @see _.zipObject - */ - object( - values?: List - ): _.LoDashImplicitObjectWrapper; - - /** - * @see _.zipObject - */ - object( - values?: List - ): _.LoDashImplicitObjectWrapper; - - /** - * @see _.zipObject - */ - object( - values?: List - ): _.LoDashImplicitObjectWrapper<_.Dictionary>; - } - - interface LoDashExplicitArrayWrapper { - /** - * @see _.zipObject - */ - object( - values?: List - ): _.LoDashExplicitObjectWrapper; - - /** - * @see _.zipObject - */ - object( - values?: List - ): _.LoDashExplicitObjectWrapper; - - /** - * @see _.zipObject - */ - object( - values?: List - ): _.LoDashExplicitObjectWrapper<_.Dictionary>; - } - - interface LoDashExplicitObjectWrapper { - /** - * @see _.zipObject - */ - object( - values?: List - ): _.LoDashExplicitObjectWrapper; - - /** - * @see _.zipObject - */ - object( - values?: List - ): _.LoDashExplicitObjectWrapper; - - /** - * @see _.zipObject - */ - object( - values?: List - ): _.LoDashExplicitObjectWrapper<_.Dictionary>; - } - //_.pull interface LoDashStatic { /** @@ -3390,8 +3271,6 @@ declare module _ { * If an object is provided for iteratee the created _.matches style callback returns true for elements that * have the properties of the given object, else false. * - * @alias _.unique - * * @param array The array to inspect. * @param isSorted Specify the array is sorted. * @param iteratee The function invoked per iteration. @@ -3995,8 +3874,6 @@ declare module _ { * Provide either a single two dimensional array, e.g. [[key1, value1], [key2, value2]] or two arrays, one of * property names and one of corresponding values. * - * @alias _.object - * * @param props The property names. * @param values The property values. * @return Returns the new object. @@ -4503,291 +4380,6 @@ declare module _ { * Collection * **************/ - //_.all - interface LoDashStatic { - /** - * @see _.every - */ - all( - collection: List, - predicate?: ListIterator, - thisArg?: any - ): boolean; - - /** - * @see _.every - */ - all( - collection: Dictionary, - predicate?: DictionaryIterator, - thisArg?: any - ): boolean; - - /** - * @see _.every - */ - all( - collection: List|Dictionary, - predicate?: string, - thisArg?: any - ): boolean; - - /** - * @see _.every - */ - all( - collection: List|Dictionary, - predicate?: TObject - ): boolean; - } - - interface LoDashImplicitArrayWrapper { - /** - * @see _.every - */ - all( - predicate?: ListIterator, - thisArg?: any - ): boolean; - - /** - * @see _.every - */ - all( - predicate?: string, - thisArg?: any - ): boolean; - - /** - * @see _.every - */ - all( - predicate?: TObject - ): boolean; - } - - interface LoDashImplicitObjectWrapper { - /** - * @see _.every - */ - all( - predicate?: ListIterator|DictionaryIterator, - thisArg?: any - ): boolean; - - /** - * @see _.every - */ - all( - predicate?: string, - thisArg?: any - ): boolean; - - /** - * @see _.every - */ - all( - predicate?: TObject - ): boolean; - } - - interface LoDashExplicitArrayWrapper { - /** - * @see _.every - */ - all( - predicate?: ListIterator, - thisArg?: any - ): LoDashExplicitWrapper; - - /** - * @see _.every - */ - all( - predicate?: string, - thisArg?: any - ): LoDashExplicitWrapper; - - /** - * @see _.every - */ - all( - predicate?: TObject - ): LoDashExplicitWrapper; - } - - interface LoDashExplicitObjectWrapper { - /** - * @see _.every - */ - all( - predicate?: ListIterator|DictionaryIterator, - thisArg?: any - ): LoDashExplicitWrapper; - - /** - * @see _.every - */ - all( - predicate?: string, - thisArg?: any - ): LoDashExplicitWrapper; - - /** - * @see _.every - */ - all( - predicate?: TObject - ): LoDashExplicitWrapper; - } - - //_.any - interface LoDashStatic { - /** - * @see _.some - */ - any( - collection: List, - predicate?: ListIterator, - thisArg?: any - ): boolean; - - /** - * @see _.some - */ - any( - collection: Dictionary, - predicate?: DictionaryIterator, - thisArg?: any - ): boolean; - - /** - * @see _.some - */ - any( - collection: NumericDictionary, - predicate?: NumericDictionaryIterator, - thisArg?: any - ): boolean; - - /** - * @see _.some - */ - any( - collection: List|Dictionary|NumericDictionary, - predicate?: string, - thisArg?: any - ): boolean; - - /** - * @see _.some - */ - any( - collection: List|Dictionary|NumericDictionary, - predicate?: TObject - ): boolean; - } - - interface LoDashImplicitArrayWrapper { - /** - * @see _.some - */ - any( - predicate?: ListIterator|NumericDictionaryIterator, - thisArg?: any - ): boolean; - - /** - * @see _.some - */ - any( - predicate?: string, - thisArg?: any - ): boolean; - - /** - * @see _.some - */ - any( - predicate?: TObject - ): boolean; - } - - interface LoDashImplicitObjectWrapper { - /** - * @see _.some - */ - any( - predicate?: ListIterator|DictionaryIterator|NumericDictionaryIterator, - thisArg?: any - ): boolean; - - /** - * @see _.some - */ - any( - predicate?: string, - thisArg?: any - ): boolean; - - /** - * @see _.some - */ - any( - predicate?: TObject - ): boolean; - } - - interface LoDashExplicitArrayWrapper { - /** - * @see _.some - */ - any( - predicate?: ListIterator|NumericDictionaryIterator, - thisArg?: any - ): LoDashExplicitWrapper; - - /** - * @see _.some - */ - any( - predicate?: string, - thisArg?: any - ): LoDashExplicitWrapper; - - /** - * @see _.some - */ - any( - predicate?: TObject - ): LoDashExplicitWrapper; - } - - interface LoDashExplicitObjectWrapper { - /** - * @see _.some - */ - any( - predicate?: ListIterator|DictionaryIterator|NumericDictionaryIterator, - thisArg?: any - ): LoDashExplicitWrapper; - - /** - * @see _.some - */ - any( - predicate?: string, - thisArg?: any - ): LoDashExplicitWrapper; - - /** - * @see _.some - */ - any( - predicate?: TObject - ): LoDashExplicitWrapper; - } - //_.at interface LoDashStatic { /** @@ -4832,220 +4424,6 @@ declare module _ { at(...props: (number|string|(number|string)[])[]): LoDashExplicitArrayWrapper; } - //_.collect - interface LoDashStatic { - /** - * @see _.map - */ - collect( - collection: List, - iteratee?: ListIterator, - thisArg?: any - ): TResult[]; - - /** - * @see _.map - */ - collect( - collection: Dictionary, - iteratee?: DictionaryIterator, - thisArg?: any - ): TResult[]; - - /** - * @see _.map - */ - collect( - collection: List|Dictionary, - iteratee?: string - ): TResult[]; - - /** - * @see _.map - */ - collect( - collection: List|Dictionary, - iteratee?: TObject - ): boolean[]; - } - - interface LoDashImplicitArrayWrapper { - /** - * @see _.map - */ - collect( - iteratee?: ListIterator, - thisArg?: any - ): LoDashImplicitArrayWrapper; - - /** - * @see _.map - */ - collect( - iteratee?: string - ): LoDashImplicitArrayWrapper; - - /** - * @see _.map - */ - collect( - iteratee?: TObject - ): LoDashImplicitArrayWrapper; - } - - interface LoDashImplicitObjectWrapper { - /** - * @see _.map - */ - collect( - iteratee?: ListIterator|DictionaryIterator, - thisArg?: any - ): LoDashImplicitArrayWrapper; - - /** - * @see _.map - */ - collect( - iteratee?: string - ): LoDashImplicitArrayWrapper; - - /** - * @see _.map - */ - collect( - iteratee?: TObject - ): LoDashImplicitArrayWrapper; - } - - interface LoDashExplicitArrayWrapper { - /** - * @see _.map - */ - collect( - iteratee?: ListIterator, - thisArg?: any - ): LoDashExplicitArrayWrapper; - - /** - * @see _.map - */ - collect( - iteratee?: string - ): LoDashExplicitArrayWrapper; - - /** - * @see _.map - */ - collect( - iteratee?: TObject - ): LoDashExplicitArrayWrapper; - } - - interface LoDashExplicitObjectWrapper { - /** - * @see _.map - */ - collect( - iteratee?: ListIterator|DictionaryIterator, - thisArg?: any - ): LoDashExplicitArrayWrapper; - - /** - * @see _.map - */ - collect( - iteratee?: string - ): LoDashExplicitArrayWrapper; - - /** - * @see _.map - */ - collect( - iteratee?: TObject - ): LoDashExplicitArrayWrapper; - } - - //_.contains - interface LoDashStatic { - /** - * @see _.includes - */ - contains( - collection: List|Dictionary, - target: T, - fromIndex?: number - ): boolean; - - /** - * @see _.includes - */ - contains( - collection: string, - target: string, - fromIndex?: number - ): boolean; - } - - interface LoDashImplicitArrayWrapper { - /** - * @see _.includes - */ - contains( - target: T, - fromIndex?: number - ): boolean; - } - - interface LoDashImplicitObjectWrapper { - /** - * @see _.includes - */ - contains( - target: TValue, - fromIndex?: number - ): boolean; - } - - interface LoDashImplicitWrapper { - /** - * @see _.includes - */ - contains( - target: string, - fromIndex?: number - ): boolean; - } - - interface LoDashExplicitArrayWrapper { - /** - * @see _.includes - */ - contains( - target: T, - fromIndex?: number - ): LoDashExplicitWrapper; - } - - interface LoDashExplicitObjectWrapper { - /** - * @see _.includes - */ - contains( - target: TValue, - fromIndex?: number - ): LoDashExplicitWrapper; - } - - interface LoDashExplicitWrapper { - /** - * @see _.includes - */ - contains( - target: string, - fromIndex?: number - ): LoDashExplicitWrapper; - } - //_.countBy interface LoDashStatic { /** @@ -5238,94 +4616,6 @@ declare module _ { ): LoDashExplicitObjectWrapper>; } - //_.detect - interface LoDashStatic { - /** - * @see _.find - */ - detect( - collection: List, - predicate?: ListIterator, - thisArg?: any - ): T; - - /** - * @see _.find - */ - detect( - collection: Dictionary, - predicate?: DictionaryIterator, - thisArg?: any - ): T; - - /** - * @see _.find - */ - detect( - collection: List|Dictionary, - predicate?: string, - thisArg?: any - ): T; - - /** - * @see _.find - */ - detect( - collection: List|Dictionary, - predicate?: TObject - ): T; - } - - interface LoDashImplicitArrayWrapper { - /** - * @see _.find - */ - detect( - predicate?: ListIterator, - thisArg?: any - ): T; - - /** - * @see _.find - */ - detect( - predicate?: string, - thisArg?: any - ): T; - - /** - * @see _.find - */ - detect( - predicate?: TObject - ): T; - } - - interface LoDashImplicitObjectWrapper { - /** - * @see _.find - */ - detect( - predicate?: ListIterator|DictionaryIterator, - thisArg?: any - ): TResult; - - /** - * @see _.find - */ - detect( - predicate?: string, - thisArg?: any - ): TResult; - - /** - * @see _.find - */ - detect( - predicate?: TObject - ): TResult; - } - //_.each interface LoDashStatic { /** @@ -5557,8 +4847,6 @@ declare module _ { * If an object is provided for predicate the created _.matches style callback returns true for elements that * have the properties of the given object, else false. * - * @alias _.all - * * @param collection The collection to iterate over. * @param predicate The function invoked per iteration. * @param thisArg The this binding of predicate. @@ -5712,8 +5000,6 @@ declare module _ { * If an object is provided for predicate the created _.matches style callback returns true for elements that * have the properties of the given object, else false. * - * @alias _.select - * * @param collection The collection to iterate over. * @param predicate The function invoked per iteration. * @param thisArg The this binding of predicate. @@ -5888,8 +5174,6 @@ declare module _ { * If an object is provided for predicate the created _.matches style callback returns true for elements that * have the properties of the given object, else false. * - * @alias _.detect - * * @param collection The collection to search. * @param predicate The function invoked per iteration. * @param thisArg The this binding of predicate. @@ -6569,95 +5853,12 @@ declare module _ { ): LoDashExplicitObjectWrapper>; } - //_.include - interface LoDashStatic { - /** - * @see _.includes - */ - include( - collection: List|Dictionary, - target: T, - fromIndex?: number - ): boolean; - - /** - * @see _.includes - */ - include( - collection: string, - target: string, - fromIndex?: number - ): boolean; - } - - interface LoDashImplicitArrayWrapper { - /** - * @see _.includes - */ - include( - target: T, - fromIndex?: number - ): boolean; - } - - interface LoDashImplicitObjectWrapper { - /** - * @see _.includes - */ - include( - target: TValue, - fromIndex?: number - ): boolean; - } - - interface LoDashImplicitWrapper { - /** - * @see _.includes - */ - include( - target: string, - fromIndex?: number - ): boolean; - } - - interface LoDashExplicitArrayWrapper { - /** - * @see _.includes - */ - include( - target: T, - fromIndex?: number - ): LoDashExplicitWrapper; - } - - interface LoDashExplicitObjectWrapper { - /** - * @see _.includes - */ - include( - target: TValue, - fromIndex?: number - ): LoDashExplicitWrapper; - } - - interface LoDashExplicitWrapper { - /** - * @see _.includes - */ - include( - target: string, - fromIndex?: number - ): LoDashExplicitWrapper; - } - //_.includes interface LoDashStatic { /** * Checks if target is in collection using SameValueZero for equality comparisons. If fromIndex is negative, * it’s used as the offset from the end of collection. * - * @alias _.contains, _.include - * * @param collection The collection to search. * @param target The value to search for. * @param fromIndex The index to search from. @@ -7025,8 +6226,6 @@ declare module _ { * min, parseInt, slice, sortBy, take, takeRight, template, trim, trimLeft, trimRight, trunc, random, range, * sample, some, sum, uniq, and words * - * @alias _.collect - * * @param collection The collection to iterate over. * @param iteratee The function invoked per iteration. * @param thisArg The this binding of iteratee. @@ -7370,107 +6569,6 @@ declare module _ { callback: MemoIterator, thisArg?: any): TResult; - /** - * @see _.reduce - **/ - inject( - collection: Array, - callback: MemoIterator, - accumulator: TResult, - thisArg?: any): TResult; - - /** - * @see _.reduce - **/ - inject( - collection: List, - callback: MemoIterator, - accumulator: TResult, - thisArg?: any): TResult; - - /** - * @see _.reduce - **/ - inject( - collection: Dictionary, - callback: MemoIterator, - accumulator: TResult, - thisArg?: any): TResult; - - /** - * @see _.reduce - **/ - inject( - collection: Array, - callback: MemoIterator, - thisArg?: any): TResult; - - /** - * @see _.reduce - **/ - inject( - collection: List, - callback: MemoIterator, - thisArg?: any): TResult; - - /** - * @see _.reduce - **/ - inject( - collection: Dictionary, - callback: MemoIterator, - thisArg?: any): TResult; - - /** - * @see _.reduce - **/ - foldl( - collection: Array, - callback: MemoIterator, - accumulator: TResult, - thisArg?: any): TResult; - - /** - * @see _.reduce - **/ - foldl( - collection: List, - callback: MemoIterator, - accumulator: TResult, - thisArg?: any): TResult; - - /** - * @see _.reduce - **/ - foldl( - collection: Dictionary, - callback: MemoIterator, - accumulator: TResult, - thisArg?: any): TResult; - - /** - * @see _.reduce - **/ - foldl( - collection: Array, - callback: MemoIterator, - thisArg?: any): TResult; - - /** - * @see _.reduce - **/ - foldl( - collection: List, - callback: MemoIterator, - thisArg?: any): TResult; - - /** - * @see _.reduce - **/ - foldl( - collection: Dictionary, - callback: MemoIterator, - thisArg?: any): TResult; } interface LoDashImplicitArrayWrapper { @@ -7488,36 +6586,6 @@ declare module _ { reduce( callback: MemoIterator, thisArg?: any): TResult; - - /** - * @see _.reduce - **/ - inject( - callback: MemoIterator, - accumulator: TResult, - thisArg?: any): TResult; - - /** - * @see _.reduce - **/ - inject( - callback: MemoIterator, - thisArg?: any): TResult; - - /** - * @see _.reduce - **/ - foldl( - callback: MemoIterator, - accumulator: TResult, - thisArg?: any): TResult; - - /** - * @see _.reduce - **/ - foldl( - callback: MemoIterator, - thisArg?: any): TResult; } interface LoDashImplicitObjectWrapper { @@ -7535,36 +6603,6 @@ declare module _ { reduce( callback: MemoIterator, thisArg?: any): TResult; - - /** - * @see _.reduce - **/ - inject( - callback: MemoIterator, - accumulator: TResult, - thisArg?: any): TResult; - - /** - * @see _.reduce - **/ - inject( - callback: MemoIterator, - thisArg?: any): TResult; - - /** - * @see _.reduce - **/ - foldl( - callback: MemoIterator, - accumulator: TResult, - thisArg?: any): TResult; - - /** - * @see _.reduce - **/ - foldl( - callback: MemoIterator, - thisArg?: any): TResult; } //_.reduceRight @@ -7625,57 +6663,6 @@ declare module _ { collection: Dictionary, callback: MemoIterator, thisArg?: any): TResult; - - /** - * @see _.reduceRight - **/ - foldr( - collection: Array, - callback: MemoIterator, - accumulator: TResult, - thisArg?: any): TResult; - - /** - * @see _.reduceRight - **/ - foldr( - collection: List, - callback: MemoIterator, - accumulator: TResult, - thisArg?: any): TResult; - - /** - * @see _.reduceRight - **/ - foldr( - collection: Dictionary, - callback: MemoIterator, - accumulator: TResult, - thisArg?: any): TResult; - - /** - * @see _.reduceRight - **/ - foldr( - collection: Array, - callback: MemoIterator, - thisArg?: any): TResult; - - /** - * @see _.reduceRight - **/ - foldr( - collection: List, - callback: MemoIterator, - thisArg?: any): TResult; - - /** - * @see _.reduceRight - **/ - foldr( - collection: Dictionary, - callback: MemoIterator, - thisArg?: any): TResult; } //_.reject @@ -8052,8 +7039,6 @@ declare module _ { * If an object is provided for predicate the created _.matches style callback returns true for elements that * have the properties of the given object, else false. * - * @alias _.any - * * @param collection The collection to iterate over. * @param predicate The function invoked per iteration. * @param thisArg The this binding of predicate. @@ -8852,28 +7837,6 @@ declare module _ { ary(n?: number): LoDashExplicitObjectWrapper; } - //_.backflow - interface LoDashStatic { - /** - * @see _.flowRight - */ - backflow(...funcs: Function[]): TResult; - } - - interface LoDashImplicitObjectWrapper { - /** - * @see _.flowRight - */ - backflow(...funcs: Function[]): LoDashImplicitObjectWrapper; - } - - interface LoDashExplicitObjectWrapper { - /** - * @see _.flowRight - */ - backflow(...funcs: Function[]): LoDashExplicitObjectWrapper; - } - //_.before interface LoDashStatic { /** @@ -9050,28 +8013,6 @@ declare module _ { ): LoDashExplicitObjectWrapper; } - //_.compose - interface LoDashStatic { - /** - * @see _.flowRight - */ - compose(...funcs: Function[]): TResult; - } - - interface LoDashImplicitObjectWrapper { - /** - * @see _.flowRight - */ - compose(...funcs: Function[]): LoDashImplicitObjectWrapper; - } - - interface LoDashExplicitObjectWrapper { - /** - * @see _.flowRight - */ - compose(...funcs: Function[]): LoDashExplicitObjectWrapper; - } - //_.createCallback interface LoDashStatic { /** @@ -9444,8 +8385,6 @@ declare module _ { * This method is like _.flow except that it creates a function that invokes the provided functions from right * to left. * - * @alias _.backflow, _.compose - * * @param funcs Functions to invoke. * @return Returns the new function. */ @@ -12571,8 +11510,6 @@ declare module _ { /** * Creates an array of function property names from all enumerable properties, own and inherited, of object. * - * @alias _.methods - * * @param object The object to inspect. * @return Returns the new array of property names. */ @@ -13113,28 +12050,6 @@ declare module _ { ): LoDashExplicitObjectWrapper; } - //_.methods - interface LoDashStatic { - /** - * @see _.functions - */ - methods(object: any): string[]; - } - - interface LoDashImplicitObjectWrapper { - /** - * @see _.functions - */ - methods(): _.LoDashImplicitArrayWrapper; - } - - interface LoDashExplicitObjectWrapper { - /** - * @see _.functions - */ - methods(): _.LoDashExplicitArrayWrapper; - } - //_.omit interface LoDashStatic { /** @@ -14286,83 +13201,6 @@ declare module _ { attempt(): LoDashExplicitObjectWrapper; } - //_.callback - interface LoDashStatic { - /** - * Creates a function that invokes func with the this binding of thisArg and arguments of the created function. - * If func is a property name the created callback returns the property value for a given element. If func is - * an object the created callback returns true for elements that contain the equivalent object properties, - * otherwise it returns false. - * - * @param func The value to convert to a callback. - * @param thisArg The this binding of func. - * @result Returns the callback. - */ - callback( - func: Function, - thisArg?: any - ): (...args: any[]) => TResult; - - /** - * @see _.callback - */ - callback( - func: string, - thisArg?: any - ): (object: any) => TResult; - - /** - * @see _.callback - */ - callback( - func: Object, - thisArg?: any - ): (object: any) => boolean; - - /** - * @see _.callback - */ - callback(): (value: TResult) => TResult; - } - - interface LoDashImplicitWrapper { - /** - * @see _.callback - */ - callback(thisArg?: any): LoDashImplicitObjectWrapper<(object: any) => TResult>; - } - - interface LoDashImplicitObjectWrapper { - /** - * @see _.callback - */ - callback(thisArg?: any): LoDashImplicitObjectWrapper<(object: any) => boolean>; - - /** - * @see _.callback - */ - callback(thisArg?: any): LoDashImplicitObjectWrapper<(...args: any[]) => TResult>; - } - - interface LoDashExplicitWrapper { - /** - * @see _.callback - */ - callback(thisArg?: any): LoDashExplicitObjectWrapper<(object: any) => TResult>; - } - - interface LoDashExplicitObjectWrapper { - /** - * @see _.callback - */ - callback(thisArg?: any): LoDashExplicitObjectWrapper<(object: any) => boolean>; - - /** - * @see _.callback - */ - callback(thisArg?: any): LoDashExplicitObjectWrapper<(...args: any[]) => TResult>; - } - //_.constant interface LoDashStatic { /** @@ -14422,7 +13260,33 @@ declare module _ { //_.iteratee interface LoDashStatic { /** - * @see _.callback + * Creates a function that invokes `func` with the arguments of the created + * function. If `func` is a property name the created callback returns the + * property value for a given element. If `func` is an object the created + * callback returns `true` for elements that contain the equivalent object properties, otherwise it returns `false`. + * + * @static + * @memberOf _ + * @category Util + * @param {*} [func=_.identity] The value to convert to a callback. + * @returns {Function} Returns the callback. + * @example + * + * var users = [ + * { 'user': 'barney', 'age': 36 }, + * { 'user': 'fred', 'age': 40 } + * ]; + * + * // create custom iteratee shorthands + * _.iteratee = _.wrap(_.iteratee, function(callback, func) { + * var p = /^(\S+)\s*([<>])\s*(\S+)$/.exec(func); + * return !p ? callback(func) : function(object) { + * return (p[2] == '>' ? object[p[1]] > p[3] : object[p[1]] < p[3]); + * }; + * }); + * + * _.filter(users, 'age > 36'); + * // => [{ 'user': 'fred', 'age': 40 }] */ iteratee( func: Function, @@ -14430,7 +13294,7 @@ declare module _ { ): (...args: any[]) => TResult; /** - * @see _.callback + * @see _.iteratee */ iteratee( func: string, @@ -14438,7 +13302,7 @@ declare module _ { ): (object: any) => TResult; /** - * @see _.callback + * @see _.iteratee */ iteratee( func: Object, @@ -14446,45 +13310,45 @@ declare module _ { ): (object: any) => boolean; /** - * @see _.callback + * @see _.iteratee */ iteratee(): (value: TResult) => TResult; } interface LoDashImplicitWrapper { /** - * @see _.callback + * @see _.iteratee */ iteratee(thisArg?: any): LoDashImplicitObjectWrapper<(object: any) => TResult>; } interface LoDashImplicitObjectWrapper { /** - * @see _.callback + * @see _.iteratee */ iteratee(thisArg?: any): LoDashImplicitObjectWrapper<(object: any) => boolean>; /** - * @see _.callback + * @see _.iteratee */ iteratee(thisArg?: any): LoDashImplicitObjectWrapper<(...args: any[]) => TResult>; } interface LoDashExplicitWrapper { /** - * @see _.callback + * @see _.iteratee */ iteratee(thisArg?: any): LoDashExplicitObjectWrapper<(object: any) => TResult>; } interface LoDashExplicitObjectWrapper { /** - * @see _.callback + * @see _.iteratee */ iteratee(thisArg?: any): LoDashExplicitObjectWrapper<(object: any) => boolean>; /** - * @see _.callback + * @see _.iteratee */ iteratee(thisArg?: any): LoDashExplicitObjectWrapper<(...args: any[]) => TResult>; } From 3e8f32f82b1bc1ed15232efdcbc3d1729bd392f1 Mon Sep 17 00:00:00 2001 From: DomiR Date: Thu, 14 Jan 2016 00:17:54 +0100 Subject: [PATCH 23/51] (feature) Split _.uniq into _.sortedUniq, _.sortedUniqBy, & _.uniqBy --- lodash/lodash-tests.ts | 308 +++++++++++------ lodash/lodash.d.ts | 766 +++++++++++++++++++++++++---------------- 2 files changed, 654 insertions(+), 420 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 1d0f2fa96..a6b7b2cc1 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -1725,153 +1725,233 @@ module TestUniq { { let result: string[]; - result = _.uniq('abc'); - result = _.uniq('abc', true); - result = _.uniq('abc', true, stringIterator); - result = _.uniq('abc', true, stringIterator, any); - result = _.uniq('abc', true, stringIterator); - result = _.uniq('abc', true, stringIterator, any); - result = _.uniq('abc', stringIterator); - result = _.uniq('abc', stringIterator, any); - result = _.uniq('abc', stringIterator); - result = _.uniq('abc', stringIterator, any); } { let result: SampleObject[]; result = _.uniq(array); - result = _.uniq(array, true); - result = _.uniq(array, true, listIterator); - result = _.uniq(array, true, listIterator, any); - result = _.uniq(array, true, listIterator); - result = _.uniq(array, true, listIterator, any); - result = _.uniq(array, listIterator); - result = _.uniq(array, listIterator, any); - result = _.uniq(array, listIterator); - result = _.uniq(array, listIterator, any); - result = _.uniq(array, true, 'a'); - result = _.uniq(array, true, 'a', any); - result = _.uniq(array, 'a'); - result = _.uniq(array, 'a', any); - result = _.uniq(array, true, {a: 42}); - result = _.uniq<{a: number}, SampleObject>(array, true, {a: 42}); - result = _.uniq(array, {a: 42}); - result = _.uniq<{a: number}, SampleObject>(array, {a: 42}); - result = _.uniq(list); - result = _.uniq(list, true); - result = _.uniq(list, true, listIterator); - result = _.uniq(list, true, listIterator, any); - result = _.uniq(list, true, listIterator); - result = _.uniq(list, true, listIterator, any); - result = _.uniq(list, listIterator); - result = _.uniq(list, listIterator, any); - result = _.uniq(list, listIterator); - result = _.uniq(list, listIterator, any); - result = _.uniq(list, true, 'a'); - result = _.uniq(list, true, 'a', any); - result = _.uniq(list, 'a'); - result = _.uniq(list, 'a', any); - result = _.uniq(list, true, {a: 42}); - result = _.uniq<{a: number}, SampleObject>(list, true, {a: 42}); - result = _.uniq(list, {a: 42}); - result = _.uniq<{a: number}, SampleObject>(list, {a: 42}); } { let result: _.LoDashImplicitArrayWrapper; - result = _('abc').uniq(); - result = _('abc').uniq(true); - result = _('abc').uniq(true, stringIterator); - result = _('abc').uniq(true, stringIterator, any); - result = _('abc').uniq(stringIterator); - result = _('abc').uniq(stringIterator, any); } { let result: _.LoDashImplicitArrayWrapper; result = _(array).uniq(); - result = _(array).uniq(true); - result = _(array).uniq(true, listIterator); - result = _(array).uniq(true, listIterator, any); - result = _(array).uniq(listIterator); - result = _(array).uniq(listIterator, any); - result = _(array).uniq(true, 'a'); - result = _(array).uniq(true, 'a', any); - result = _(array).uniq('a'); - result = _(array).uniq('a', any); - result = _(array).uniq<{a: number}>(true, {a: 42}); - result = _(array).uniq<{a: number}>({a: 42}); - result = _(list).uniq(); - result = _(list).uniq(true); - result = _(list).uniq(true, listIterator); - result = _(list).uniq(true, listIterator, any); - result = _(list).uniq(true, listIterator); - result = _(list).uniq(true, listIterator, any); - result = _(list).uniq(listIterator); - result = _(list).uniq(listIterator, any); - result = _(list).uniq(listIterator); - result = _(list).uniq(listIterator, any); - result = _(list).uniq(true, 'a'); - result = _(list).uniq(true, 'a', any); - result = _(list).uniq('a'); - result = _(list).uniq('a', any); - result = _(list).uniq(true, {a: 42}); - result = _(list).uniq<{a: number}, SampleObject>(true, {a: 42}); - result = _(list).uniq({a: 42}); - result = _(list).uniq<{a: number}, SampleObject>({a: 42}); } { let result: _.LoDashExplicitArrayWrapper; result = _('abc').chain().uniq(); - result = _('abc').chain().uniq(true); - result = _('abc').chain().uniq(true, stringIterator); - result = _('abc').chain().uniq(true, stringIterator, any); - result = _('abc').chain().uniq(stringIterator); - result = _('abc').chain().uniq(stringIterator, any); } { let result: _.LoDashExplicitArrayWrapper; result = _(array).chain().uniq(); - result = _(array).chain().uniq(true); - result = _(array).chain().uniq(true, listIterator); - result = _(array).chain().uniq(true, listIterator, any); - result = _(array).chain().uniq(listIterator); - result = _(array).chain().uniq(listIterator, any); - result = _(array).chain().uniq(true, 'a'); - result = _(array).chain().uniq(true, 'a', any); - result = _(array).chain().uniq('a'); - result = _(array).chain().uniq('a', any); - result = _(array).chain().uniq<{a: number}>(true, {a: 42}); - result = _(array).chain().uniq<{a: number}>({a: 42}); - result = _(list).chain().uniq(); - result = _(list).chain().uniq(true); - result = _(list).chain().uniq(true, listIterator); - result = _(list).chain().uniq(true, listIterator, any); - result = _(list).chain().uniq(true, listIterator); - result = _(list).chain().uniq(true, listIterator, any); - result = _(list).chain().uniq(listIterator); - result = _(list).chain().uniq(listIterator, any); - result = _(list).chain().uniq(listIterator); - result = _(list).chain().uniq(listIterator, any); - result = _(list).chain().uniq(true, 'a'); - result = _(list).chain().uniq(true, 'a', any); - result = _(list).chain().uniq('a'); - result = _(list).chain().uniq('a', any); - result = _(list).chain().uniq(true, {a: 42}); - result = _(list).chain().uniq<{a: number}, SampleObject>(true, {a: 42}); - result = _(list).chain().uniq({a: 42}); - result = _(list).chain().uniq<{a: number}, SampleObject>({a: 42}); + + } +} + + +// _.uniqBy +module TestUniqBy { + type SampleObject = {a: number; b: string; c: boolean}; + + let array: SampleObject[]; + let list: _.List; + + let stringIterator: (value: string, index: number, collection: string) => string; + let listIterator: (value: SampleObject, index: number, collection: _.List) => number; + + { + let result: string[]; + + result = _.uniqBy('abc', stringIterator); + result = _.uniqBy('abc', stringIterator); + } + + { + let result: SampleObject[]; + + result = _.uniqBy(array, listIterator); + result = _.uniqBy(array, listIterator); + result = _.uniqBy(array, 'a'); + result = _.uniqBy(array, {a: 42}); + result = _.uniqBy<{a: number}, SampleObject>(array, {a: 42}); + + result = _.uniqBy(list, listIterator); + result = _.uniqBy(list, listIterator); + result = _.uniqBy(list, 'a'); + result = _.uniqBy(list, {a: 42}); + result = _.uniqBy<{a: number}, SampleObject>(list, {a: 42}); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _('abc').uniqBy(stringIterator); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(array).uniqBy(listIterator); + result = _(array).uniqBy('a'); + result = _(array).uniqBy<{a: number}>({a: 42}); + + result = _(list).uniqBy(listIterator); + result = _(list).uniqBy(listIterator); + result = _(list).uniqBy('a'); + result = _(list).uniqBy({a: 42}); + result = _(list).uniqBy<{a: number}, SampleObject>({a: 42}); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _('abc').chain().uniqBy(stringIterator); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(array).chain().uniqBy(listIterator); + result = _(array).chain().uniqBy('a'); + result = _(array).chain().uniqBy<{a: number}>({a: 42}); + + result = _(list).chain().uniqBy(listIterator); + result = _(list).chain().uniqBy(listIterator); + result = _(list).chain().uniqBy('a'); + result = _(list).chain().uniqBy({a: 42}); + result = _(list).chain().uniqBy<{a: number}, SampleObject>({a: 42}); + } +} + +// _.sortedUniq +module TestSortedUniq { + type SampleObject = {a: number; b: string; c: boolean}; + + let array: SampleObject[]; + let list: _.List; + + let stringIterator: (value: string, index: number, collection: string) => string; + let listIterator: (value: SampleObject, index: number, collection: _.List) => number; + + { + let result: string[]; + result = _.sortedUniq('abc'); + } + + { + let result: SampleObject[]; + result = _.sortedUniq(array); + result = _.sortedUniq(list); + } + + { + let result: _.LoDashImplicitArrayWrapper; + result = _('abc').sortedUniq(); + } + + { + let result: _.LoDashImplicitArrayWrapper; + result = _(array).sortedUniq(); + result = _(list).sortedUniq(); + } + + { + let result: _.LoDashExplicitArrayWrapper; + result = _('abc').chain().sortedUniq(); + } + + { + let result: _.LoDashExplicitArrayWrapper; + result = _(array).chain().sortedUniq(); + result = _(list).chain().sortedUniq(); + } +} + +// _.sortedUniqBy +module TestSortedUniqBy { + type SampleObject = {a: number; b: string; c: boolean}; + + let array: SampleObject[]; + let list: _.List; + + let stringIterator: (value: string, index: number, collection: string) => string; + let listIterator: (value: SampleObject, index: number, collection: _.List) => number; + + { + let result: string[]; + + result = _.sortedUniqBy('abc', stringIterator); + result = _.sortedUniqBy('abc', stringIterator); + } + + { + let result: SampleObject[]; + + result = _.sortedUniqBy(array, listIterator); + result = _.sortedUniqBy(array, listIterator); + result = _.sortedUniqBy(array, 'a'); + result = _.sortedUniqBy(array, {a: 42}); + result = _.sortedUniqBy<{a: number}, SampleObject>(array, {a: 42}); + + result = _.sortedUniqBy(list, listIterator); + result = _.sortedUniqBy(list, listIterator); + result = _.sortedUniqBy(list, 'a'); + result = _.sortedUniqBy(list, {a: 42}); + result = _.sortedUniqBy<{a: number}, SampleObject>(list, {a: 42}); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _('abc').sortedUniqBy(stringIterator); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(array).sortedUniqBy(listIterator); + result = _(array).sortedUniqBy('a'); + result = _(array).sortedUniqBy<{a: number}>({a: 42}); + + result = _(list).sortedUniqBy(listIterator); + result = _(list).sortedUniqBy(listIterator); + result = _(list).sortedUniqBy('a'); + result = _(list).sortedUniqBy({a: 42}); + result = _(list).sortedUniqBy<{a: number}, SampleObject>({a: 42}); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _('abc').chain().sortedUniqBy(stringIterator); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(array).chain().sortedUniqBy(listIterator); + result = _(array).chain().sortedUniqBy('a'); + result = _(array).chain().sortedUniqBy<{a: number}>({a: 42}); + + result = _(list).chain().sortedUniqBy(listIterator); + result = _(list).chain().sortedUniqBy(listIterator); + result = _(list).chain().sortedUniqBy('a'); + result = _(list).chain().sortedUniqBy({a: 42}); + result = _(list).chain().sortedUniqBy<{a: number}, SampleObject>({a: 42}); } } diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 8500d9ecf..1ba718812 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -146,7 +146,7 @@ added 2 number methods: - [ ] _.subtract added chain method: -- [ ] _#next +- [ ] _.next added collection method: - [ ] _.sampleSize @@ -3256,113 +3256,30 @@ declare module _ { //_.uniq interface LoDashStatic { /** - * Creates a duplicate-free version of an array, using SameValueZero for equality comparisons, in which only - * the first occurrence of each element is kept. Providing true for isSorted performs a faster search - * algorithm for sorted arrays. If an iteratee function is provided it’s invoked for each element in the - * array to generate the criterion by which uniqueness is computed. The iteratee is bound to thisArg and - * invoked with three arguments: (value, index, array). + * Creates a duplicate-free version of an array, using + * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * for equality comparisons, in which only the first occurrence of each element + * is kept. * - * If a property name is provided for iteratee the created _.property style callback returns the property - * value of the given element. + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to inspect. + * @returns {Array} Returns the new duplicate free array. + * @example * - * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for - * elements that have a matching property value, else false. - * - * If an object is provided for iteratee the created _.matches style callback returns true for elements that - * have the properties of the given object, else false. - * - * @param array The array to inspect. - * @param isSorted Specify the array is sorted. - * @param iteratee The function invoked per iteration. - * @param thisArg iteratee - * @return Returns the new duplicate-value-free array. + * _.uniq([2, 1, 2]); + * // => [2, 1] */ uniq( - array: List, - isSorted?: boolean, - iteratee?: ListIterator, - thisArg?: any + array: List ): T[]; /** * @see _.uniq */ uniq( - array: List, - isSorted?: boolean, - iteratee?: ListIterator, - thisArg?: any - ): T[]; - - /** - * @see _.uniq - */ - uniq( - array: List, - iteratee?: ListIterator, - thisArg?: any - ): T[]; - - /** - * @see _.uniq - */ - uniq( - array: List, - iteratee?: ListIterator, - thisArg?: any - ): T[]; - - /** - * @see _.uniq - */ - uniq( - array: List, - isSorted?: boolean, - iteratee?: string, - thisArg?: any - ): T[]; - - /** - * @see _.uniq - */ - uniq( - array: List, - iteratee?: string, - thisArg?: any - ): T[]; - - /** - * @see _.uniq - */ - uniq( - array: List, - isSorted?: boolean, - iteratee?: Object - ): T[]; - - /** - * @see _.uniq - */ - uniq( - array: List, - isSorted?: boolean, - iteratee?: TWhere - ): T[]; - - /** - * @see _.uniq - */ - uniq( - array: List, - iteratee?: Object - ): T[]; - - /** - * @see _.uniq - */ - uniq( - array: List, - iteratee?: TWhere + array: List ): T[]; } @@ -3370,299 +3287,536 @@ declare module _ { /** * @see _.uniq */ - uniq( - isSorted?: boolean, - iteratee?: ListIterator, - thisArg?: any - ): LoDashImplicitArrayWrapper; - - /** - * @see _.uniq - */ - uniq( - iteratee?: ListIterator, - thisArg?: any - ): LoDashImplicitArrayWrapper; + uniq(): LoDashImplicitArrayWrapper; } interface LoDashImplicitArrayWrapper { /** * @see _.uniq */ - uniq( - isSorted?: boolean, - iteratee?: ListIterator, - thisArg?: any - ): LoDashImplicitArrayWrapper; + uniq(): LoDashImplicitArrayWrapper; /** * @see _.uniq */ - uniq( - iteratee?: ListIterator, - thisArg?: any - ): LoDashImplicitArrayWrapper; - - /** - * @see _.uniq - */ - uniq( - isSorted?: boolean, - iteratee?: string, - thisArg?: any - ): LoDashImplicitArrayWrapper; - - /** - * @see _.uniq - */ - uniq( - iteratee?: string, - thisArg?: any - ): LoDashImplicitArrayWrapper; - - /** - * @see _.uniq - */ - uniq( - isSorted?: boolean, - iteratee?: TWhere - ): LoDashImplicitArrayWrapper; - - /** - * @see _.uniq - */ - uniq( - iteratee?: TWhere - ): LoDashImplicitArrayWrapper; + uniq(): LoDashImplicitArrayWrapper; } interface LoDashImplicitObjectWrapper { - uniq( - isSorted?: boolean, - iteratee?: ListIterator, - thisArg?: any - ): LoDashImplicitArrayWrapper; + uniq(): LoDashImplicitArrayWrapper; /** * @see _.uniq */ - uniq( - isSorted?: boolean, - iteratee?: ListIterator, - thisArg?: any - ): LoDashImplicitArrayWrapper; - - /** - * @see _.uniq - */ - uniq( - iteratee?: ListIterator, - thisArg?: any - ): LoDashImplicitArrayWrapper; - - /** - * @see _.uniq - */ - uniq( - iteratee?: ListIterator, - thisArg?: any - ): LoDashImplicitArrayWrapper; - - /** - * @see _.uniq - */ - uniq( - isSorted?: boolean, - iteratee?: string, - thisArg?: any - ): LoDashImplicitArrayWrapper; - - /** - * @see _.uniq - */ - uniq( - iteratee?: string, - thisArg?: any - ): LoDashImplicitArrayWrapper; - - /** - * @see _.uniq - */ - uniq( - isSorted?: boolean, - iteratee?: Object - ): LoDashImplicitArrayWrapper; - - /** - * @see _.uniq - */ - uniq( - isSorted?: boolean, - iteratee?: TWhere - ): LoDashImplicitArrayWrapper; - - /** - * @see _.uniq - */ - uniq( - iteratee?: Object - ): LoDashImplicitArrayWrapper; - - /** - * @see _.uniq - */ - uniq( - iteratee?: TWhere - ): LoDashImplicitArrayWrapper; + uniq(): LoDashImplicitArrayWrapper; } interface LoDashExplicitWrapper { /** * @see _.uniq */ - uniq( - isSorted?: boolean, - iteratee?: ListIterator, - thisArg?: any - ): LoDashExplicitArrayWrapper; - - /** - * @see _.uniq - */ - uniq( - iteratee?: ListIterator, - thisArg?: any - ): LoDashExplicitArrayWrapper; + uniq(): LoDashExplicitArrayWrapper; } interface LoDashExplicitArrayWrapper { /** * @see _.uniq */ - uniq( - isSorted?: boolean, - iteratee?: ListIterator, - thisArg?: any - ): LoDashExplicitArrayWrapper; + uniq(): LoDashExplicitArrayWrapper; /** * @see _.uniq */ - uniq( - iteratee?: ListIterator, - thisArg?: any - ): LoDashExplicitArrayWrapper; + uniq(): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.uniq + */ + uniq(): LoDashExplicitArrayWrapper; /** * @see _.uniq */ - uniq( - isSorted?: boolean, - iteratee?: string, - thisArg?: any + uniq(): LoDashExplicitArrayWrapper; + } + + //_.uniqBy + interface LoDashStatic { + /** + * This method is like `_.uniq` except that it accepts `iteratee` which is + * invoked for each element in `array` to generate the criterion by which + * uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to inspect. + * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element. + * @returns {Array} Returns the new duplicate free array. + * @example + * + * _.uniqBy([2.1, 1.2, 2.3], Math.floor); + * // => [2.1, 1.2] + * + * // using the `_.property` iteratee shorthand + * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x'); + * // => [{ 'x': 1 }, { 'x': 2 }] + */ + uniqBy( + array: List, + iteratee: ListIterator + ): T[]; + + /** + * @see _.uniqBy + */ + uniqBy( + array: List, + iteratee: ListIterator + ): T[]; + + /** + * @see _.uniqBy + */ + uniqBy( + array: List, + iteratee: string + ): T[]; + + /** + * @see _.uniqBy + */ + uniqBy( + array: List, + iteratee: Object + ): T[]; + + /** + * @see _.uniqBy + */ + uniqBy( + array: List, + iteratee: TWhere + ): T[]; + } + + interface LoDashImplicitWrapper { + /** + * @see _.uniqBy + */ + uniqBy( + iteratee: ListIterator + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.uniqBy + */ + uniqBy( + iteratee: ListIterator + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniqBy + */ + uniqBy( + iteratee: string + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniqBy + */ + uniqBy( + iteratee: TWhere + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.uniqBy + */ + uniqBy( + iteratee: ListIterator + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniqBy + */ + uniqBy( + iteratee: ListIterator + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniqBy + */ + uniqBy( + iteratee: string + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniqBy + */ + uniqBy( + iteratee: Object + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniqBy + */ + uniqBy( + iteratee: TWhere + ): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.uniqBy + */ + uniqBy( + iteratee: ListIterator + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.uniqBy + */ + uniqBy( + iteratee: ListIterator ): LoDashExplicitArrayWrapper; /** - * @see _.uniq + * @see _.uniqBy */ - uniq( - iteratee?: string, - thisArg?: any + uniqBy( + iteratee: string ): LoDashExplicitArrayWrapper; /** - * @see _.uniq + * @see _.uniqBy */ - uniq( - isSorted?: boolean, - iteratee?: TWhere - ): LoDashExplicitArrayWrapper; - - /** - * @see _.uniq - */ - uniq( - iteratee?: TWhere + uniqBy( + iteratee: TWhere ): LoDashExplicitArrayWrapper; } interface LoDashExplicitObjectWrapper { - uniq( - isSorted?: boolean, - iteratee?: ListIterator, - thisArg?: any + /** + * @see _.uniqBy + */ + uniqBy( + iteratee: ListIterator ): LoDashExplicitArrayWrapper; /** - * @see _.uniq + * @see _.uniqBy */ - uniq( - isSorted?: boolean, - iteratee?: ListIterator, - thisArg?: any + uniqBy( + iteratee: ListIterator ): LoDashExplicitArrayWrapper; /** - * @see _.uniq + * @see _.uniqBy */ - uniq( - iteratee?: ListIterator, - thisArg?: any + uniqBy( + iteratee: string ): LoDashExplicitArrayWrapper; /** - * @see _.uniq + * @see _.uniqBy */ - uniq( - iteratee?: ListIterator, - thisArg?: any + uniqBy( + iteratee: Object ): LoDashExplicitArrayWrapper; /** - * @see _.uniq + * @see _.uniqBy */ - uniq( - isSorted?: boolean, - iteratee?: string, - thisArg?: any + uniqBy( + iteratee: TWhere + ): LoDashExplicitArrayWrapper; + } + + //_.sortedUniq + interface LoDashStatic { + /** + * This method is like `_.uniq` except that it's designed and optimized + * for sorted arrays. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to inspect. + * @returns {Array} Returns the new duplicate free array. + * @example + * + * _.sortedUniq([1, 1, 2]); + * // => [1, 2] + */ + sortedUniq( + array: List + ): T[]; + + /** + * @see _.sortedUniq + */ + sortedUniq( + array: List + ): T[]; + } + + interface LoDashImplicitWrapper { + /** + * @see _.sortedUniq + */ + sortedUniq(): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.sortedUniq + */ + sortedUniq(): LoDashImplicitArrayWrapper; + + /** + * @see _.sortedUniq + */ + sortedUniq(): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + sortedUniq(): LoDashImplicitArrayWrapper; + + /** + * @see _.sortedUniq + */ + sortedUniq(): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.sortedUniq + */ + sortedUniq(): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.sortedUniq + */ + sortedUniq(): LoDashExplicitArrayWrapper; + + /** + * @see _.sortedUniq + */ + sortedUniq(): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.sortedUniq + */ + sortedUniq(): LoDashExplicitArrayWrapper; + + /** + * @see _.sortedUniq + */ + sortedUniq(): LoDashExplicitArrayWrapper; + } + + //_.sortedUniqBy + interface LoDashStatic { + /** + * This method is like `_.uniqBy` except that it's designed and optimized + * for sorted arrays. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to inspect. + * @param {Function} [iteratee] The iteratee invoked per element. + * @returns {Array} Returns the new duplicate free array. + * @example + * + * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor); + * // => [1.1, 2.2] + */ + sortedUniqBy( + array: List, + iteratee: ListIterator + ): T[]; + + /** + * @see _.sortedUniqBy + */ + sortedUniqBy( + array: List, + iteratee: ListIterator + ): T[]; + + /** + * @see _.sortedUniqBy + */ + sortedUniqBy( + array: List, + iteratee: string + ): T[]; + + /** + * @see _.sortedUniqBy + */ + sortedUniqBy( + array: List, + iteratee: Object + ): T[]; + + /** + * @see _.sortedUniqBy + */ + sortedUniqBy( + array: List, + iteratee: TWhere + ): T[]; + } + + interface LoDashImplicitWrapper { + /** + * @see _.sortedUniqBy + */ + sortedUniqBy( + iteratee: ListIterator + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.sortedUniqBy + */ + sortedUniqBy( + iteratee: ListIterator + ): LoDashImplicitArrayWrapper; + + /** + * @see _.sortedUniqBy + */ + sortedUniqBy( + iteratee: string + ): LoDashImplicitArrayWrapper; + + /** + * @see _.sortedUniqBy + */ + sortedUniqBy( + iteratee: TWhere + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.sortedUniqBy + */ + sortedUniqBy( + iteratee: ListIterator + ): LoDashImplicitArrayWrapper; + + /** + * @see _.sortedUniqBy + */ + sortedUniqBy( + iteratee: ListIterator + ): LoDashImplicitArrayWrapper; + + /** + * @see _.sortedUniqBy + */ + sortedUniqBy( + iteratee: string + ): LoDashImplicitArrayWrapper; + + /** + * @see _.sortedUniqBy + */ + sortedUniqBy( + iteratee: Object + ): LoDashImplicitArrayWrapper; + + /** + * @see _.sortedUniqBy + */ + sortedUniqBy( + iteratee: TWhere + ): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.sortedUniqBy + */ + sortedUniqBy( + iteratee: ListIterator + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.sortedUniqBy + */ + sortedUniqBy( + iteratee: ListIterator ): LoDashExplicitArrayWrapper; /** - * @see _.uniq + * @see _.sortedUniqBy */ - uniq( - iteratee?: string, - thisArg?: any + sortedUniqBy( + iteratee: string ): LoDashExplicitArrayWrapper; /** - * @see _.uniq + * @see _.sortedUniqBy */ - uniq( - isSorted?: boolean, - iteratee?: Object + sortedUniqBy( + iteratee: TWhere + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.sortedUniqBy + */ + sortedUniqBy( + iteratee: ListIterator ): LoDashExplicitArrayWrapper; /** - * @see _.uniq + * @see _.sortedUniqBy */ - uniq( - isSorted?: boolean, - iteratee?: TWhere + sortedUniqBy( + iteratee: ListIterator ): LoDashExplicitArrayWrapper; /** - * @see _.uniq + * @see _.sortedUniqBy */ - uniq( - iteratee?: Object + sortedUniqBy( + iteratee: string ): LoDashExplicitArrayWrapper; /** - * @see _.uniq + * @see _.sortedUniqBy */ - uniq( - iteratee?: TWhere + sortedUniqBy( + iteratee: Object + ): LoDashExplicitArrayWrapper; + + /** + * @see _.sortedUniqBy + */ + sortedUniqBy( + iteratee: TWhere ): LoDashExplicitArrayWrapper; } From 0ebf1030569dcf57078da515fc93f3c5384c91e7 Mon Sep 17 00:00:00 2001 From: DomiR Date: Thu, 14 Jan 2016 01:08:08 +0100 Subject: [PATCH 24/51] (feature) _.cloneDeepWith and _.cloneWith --- lodash/lodash-tests.ts | 78 ++++++++--------- lodash/lodash.d.ts | 190 ++++++++++++++++++++++++++--------------- 2 files changed, 158 insertions(+), 110 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index a6b7b2cc1..63fd99870 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -5552,87 +5552,79 @@ module TestWrap { ********/ // _.clone +{ + let result: number; + result = _.clone(42); + result = _(42).clone(); +} +{ + let result: string[]; + result = _.clone([]); + result = _([]).clone(); +} +{ + let result: {a: {b: number;}}; + result = _.clone<{a: {b: number;}}>({a: {b: 2}}); + result = _({a: {b: 2}}).clone(); +} + +// _.cloneDeep +{ + let result: number; + result = _.cloneDeep(42); + result = _(42).cloneDeep(); +} +{ + let result: string[]; + result = _.cloneDeep([]); + result = _([]).cloneDeep(); +} +{ + let result: {a: {b: number;}}; + result = _.cloneDeep<{a: {b: number;}}>({a: {b: 2}}); + result = _({a: {b: 2}}).cloneDeep(); +} + +// _.cloneWith interface TestCloneCustomizerFn { (value: any): any; } var testCloneCustomizerFn: TestCloneCustomizerFn; { let result: number; - result = _.clone(42); - result = _.clone(42, false); - result = _.clone(42, false, testCloneCustomizerFn); - result = _.clone(42, false, testCloneCustomizerFn, any); result = _.clone(42, testCloneCustomizerFn); - result = _.clone(42, testCloneCustomizerFn, any); - result = _(42).clone(); - result = _(42).clone(false); - result = _(42).clone(false, testCloneCustomizerFn); - result = _(42).clone(false, testCloneCustomizerFn, any); result = _(42).clone(testCloneCustomizerFn); - result = _(42).clone(testCloneCustomizerFn, any); } { let result: string[]; - result = _.clone([]); - result = _.clone([], false); - result = _.clone([], false, testCloneCustomizerFn); - result = _.clone([], false, testCloneCustomizerFn, any); result = _.clone([], testCloneCustomizerFn); - result = _.clone([], testCloneCustomizerFn, any); - result = _([]).clone(); - result = _([]).clone(false); - result = _([]).clone(false, testCloneCustomizerFn); - result = _([]).clone(false, testCloneCustomizerFn, any); result = _([]).clone(testCloneCustomizerFn); - result = _([]).clone(testCloneCustomizerFn, any); } { let result: {a: {b: number;}}; - result = _.clone<{a: {b: number;}}>({a: {b: 2}}); - result = _.clone<{a: {b: number;}}>({a: {b: 2}}, false); - result = _.clone<{a: {b: number;}}>({a: {b: 2}}, false, testCloneCustomizerFn); - result = _.clone<{a: {b: number;}}>({a: {b: 2}}, false, testCloneCustomizerFn, any); result = _.clone<{a: {b: number;}}>({a: {b: 2}}, testCloneCustomizerFn); - result = _.clone<{a: {b: number;}}>({a: {b: 2}}, testCloneCustomizerFn, any); - result = _({a: {b: 2}}).clone(); - result = _({a: {b: 2}}).clone(false); - result = _({a: {b: 2}}).clone(false, testCloneCustomizerFn); - result = _({a: {b: 2}}).clone(false, testCloneCustomizerFn, any); result = _({a: {b: 2}}).clone(testCloneCustomizerFn); - result = _({a: {b: 2}}).clone(testCloneCustomizerFn, any); } -// _.cloneDeep +// _.cloneDeepWith interface TestCloneDeepCustomizerFn { (value: any): any; } var testCloneDeepCustomizerFn: TestCloneDeepCustomizerFn; { let result: number; - result = _.cloneDeep(42); result = _.cloneDeep(42, testCloneDeepCustomizerFn); - result = _.cloneDeep(42, testCloneDeepCustomizerFn, any); - result = _(42).cloneDeep(); result = _(42).cloneDeep(testCloneDeepCustomizerFn); - result = _(42).cloneDeep(testCloneDeepCustomizerFn, any); } { let result: string[]; - result = _.cloneDeep([]); result = _.cloneDeep([], testCloneDeepCustomizerFn); - result = _.cloneDeep([], testCloneDeepCustomizerFn, any); - result = _([]).cloneDeep(); result = _([]).cloneDeep(testCloneDeepCustomizerFn); - result = _([]).cloneDeep(testCloneDeepCustomizerFn, any); } { let result: {a: {b: number;}}; - result = _.cloneDeep<{a: {b: number;}}>({a: {b: 2}}); result = _.cloneDeep<{a: {b: number;}}>({a: {b: 2}}, testCloneDeepCustomizerFn); - result = _.cloneDeep<{a: {b: number;}}>({a: {b: 2}}, testCloneDeepCustomizerFn, any); - result = _({a: {b: 2}}).cloneDeep(); result = _({a: {b: 2}}).cloneDeep(testCloneDeepCustomizerFn); - result = _({a: {b: 2}}).cloneDeep(testCloneDeepCustomizerFn, any); } // _.eq diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 1ba718812..6f9f2f223 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -77,8 +77,8 @@ added 23 array methods: - [ ] _.xorWith added 18 lang methods: -- [ ] _.cloneDeepWith -- [ ] _.cloneWith +- [x] _.cloneDeepWith +- [x] _.cloneWith - [ ] _.eq - [ ] _.isArrayLike - [ ] _.isArrayLikeObject @@ -9099,87 +9099,150 @@ declare module _ { //_.clone interface LoDashStatic { /** - * Creates a clone of value. If isDeep is true nested objects are cloned, otherwise they are assigned by - * reference. If customizer is provided it’s invoked to produce the cloned values. If customizer returns - * undefined cloning is handled by the method instead. The customizer is bound to thisArg and invoked with up - * to three argument; (value [, index|key, object]). - * Note: This method is loosely based on the structured clone algorithm. The enumerable properties of arguments - * objects and objects created by constructors other than Object are cloned to plain Object objects. An empty - * object is returned for uncloneable values such as functions, DOM nodes, Maps, Sets, and WeakMaps. + * Creates a shallow clone of `value`. * - * @param value The value to clone. - * @param isDeep Specify a deep clone. - * @param customizer The function to customize cloning values. - * @param thisArg The this binding of customizer. - * @return Returns the cloned value. + * **Note:** This method is loosely based on the + * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm) + * and supports cloning arrays, array buffers, booleans, date objects, maps, + * numbers, `Object` objects, regexes, sets, strings, symbols, and typed + * arrays. The own enumerable properties of `arguments` objects are cloned + * as plain objects. An empty object is returned for uncloneable values such + * as error objects, functions, DOM nodes, and WeakMaps. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to clone. + * @returns {*} Returns the cloned value. + * @example + * + * var objects = [{ 'a': 1 }, { 'b': 2 }]; + * + * var shallow = _.clone(objects); + * console.log(shallow[0] === objects[0]); + * // => true */ - clone( - value: T, - isDeep?: boolean, - customizer?: (value: any) => any, - thisArg?: any): T; - - /** - * @see _.clone - */ - clone( - value: T, - customizer?: (value: any) => any, - thisArg?: any): T; + clone(value: T): T; } interface LoDashImplicitWrapper { /** * @see _.clone */ - clone( - isDeep?: boolean, - customizer?: (value: any) => any, - thisArg?: any): T; - - /** - * @see _.clone - */ - clone( - customizer?: (value: any) => any, - thisArg?: any): T; + clone(): T; } interface LoDashImplicitArrayWrapper { - /** - * @see _.clone - */ - clone( - isDeep?: boolean, - customizer?: (value: any) => any, - thisArg?: any): T[]; /** * @see _.clone */ - clone( - customizer?: (value: any) => any, - thisArg?: any): T[]; + clone(): T[]; } interface LoDashImplicitObjectWrapper { /** * @see _.clone */ - clone( - isDeep?: boolean, - customizer?: (value: any) => any, - thisArg?: any): T; + clone(): T; + } + + //_.cloneDeep + interface LoDashStatic { + /** + * This method is like `_.clone` except that it recursively clones `value`. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to recursively clone. + * @returns {*} Returns the deep cloned value. + * @example + * + * var objects = [{ 'a': 1 }, { 'b': 2 }]; + * + * var deep = _.cloneDeep(objects); + * console.log(deep[0] === objects[0]); + * // => false + */ + cloneDeep(value: T): T; + } + + interface LoDashImplicitWrapper { + /** + * @see _.cloneDeep + */ + cloneDeep(): T; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.cloneDeep + */ + cloneDeep(): T[]; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.cloneDeep + */ + cloneDeep(): T; + } + + //_.cloneWith + interface LoDashStatic { + /** + * Creates a shallow clone of `value`. + * + * **Note:** This method is loosely based on the + * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm) + * and supports cloning arrays, array buffers, booleans, date objects, maps, + * numbers, `Object` objects, regexes, sets, strings, symbols, and typed + * arrays. The own enumerable properties of `arguments` objects are cloned + * as plain objects. An empty object is returned for uncloneable values such + * as error objects, functions, DOM nodes, and WeakMaps. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to clone. + * @returns {*} Returns the cloned value. + * @example + * + * var objects = [{ 'a': 1 }, { 'b': 2 }]; + * + * var shallow = _.clone(objects); + * console.log(shallow[0] === objects[0]); + * // => true + */ + clone( + value: T, + customizer: (value: any) => any): T; + } + + interface LoDashImplicitWrapper { + /** + * @see _.clone + */ + clone(customizer: (value: any) => any): T; + } + + interface LoDashImplicitArrayWrapper { /** * @see _.clone */ - clone( - customizer?: (value: any) => any, - thisArg?: any): T; + clone(customizer: (value: any) => any): T[]; } - //_.cloneDeep + interface LoDashImplicitObjectWrapper { + /** + * @see _.clone + */ + clone(customizer: (value: any) => any): T; + } + + //_.cloneDeepWith interface LoDashStatic { /** * Creates a deep clone of value. If customizer is provided it’s invoked to produce the cloned values. If @@ -9195,35 +9258,28 @@ declare module _ { */ cloneDeep( value: T, - customizer?: (value: any) => any, - thisArg?: any): T; + customizer: (value: any) => any): T; } interface LoDashImplicitWrapper { /** * @see _.cloneDeep */ - cloneDeep( - customizer?: (value: any) => any, - thisArg?: any): T; + cloneDeep(customizer: (value: any) => any): T; } interface LoDashImplicitArrayWrapper { /** * @see _.cloneDeep */ - cloneDeep( - customizer?: (value: any) => any, - thisArg?: any): T[]; + cloneDeep(customizer: (value: any) => any): T[]; } interface LoDashImplicitObjectWrapper { /** * @see _.cloneDeep */ - cloneDeep( - customizer?: (value: any) => any, - thisArg?: any): T; + cloneDeep(customizer: (value: any) => any): T; } //_.eq From bee4d73867e1f363a34731d74bf035a46521d95a Mon Sep 17 00:00:00 2001 From: DomiR Date: Thu, 14 Jan 2016 01:09:54 +0100 Subject: [PATCH 25/51] (feature) Absorbed _.sortByAll into _.sortBy --- lodash/lodash-tests.ts | 76 +--------- lodash/lodash.d.ts | 324 ++++++++++++----------------------------- 2 files changed, 100 insertions(+), 300 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 63fd99870..c19e3af69 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -4451,19 +4451,16 @@ module TestSortBy { result = _.sortBy(array); result = _.sortBy(array, listIterator); - result = _.sortBy(array, listIterator, any); result = _.sortBy(array, ''); result = _.sortBy<{a: number}, TResult>(array, {a: 42}); result = _.sortBy(list); result = _.sortBy(list, listIterator); - result = _.sortBy(list, listIterator, any); result = _.sortBy(list, ''); result = _.sortBy<{a: number}, TResult>(list, {a: 42}); result = _.sortBy(dictionary); result = _.sortBy(dictionary, dictionaryIterator); - result = _.sortBy(dictionary, dictionaryIterator, any); result = _.sortBy(dictionary, ''); result = _.sortBy<{a: number}, TResult>(dictionary, {a: 42}); } @@ -4473,19 +4470,16 @@ module TestSortBy { result = _(array).sortBy(); result = _(array).sortBy(listIterator); - result = _(array).sortBy(listIterator, any); result = _(array).sortBy(''); result = _(array).sortBy<{a: number}>({a: 42}); result = _(list).sortBy(); result = _(list).sortBy(listIterator); - result = _(list).sortBy(listIterator, any); result = _(list).sortBy(''); result = _(list).sortBy<{a: number}, TResult>({a: 42}); result = _(dictionary).sortBy(); result = _(dictionary).sortBy(dictionaryIterator); - result = _(dictionary).sortBy(dictionaryIterator, any); result = _(dictionary).sortBy(''); result = _(dictionary).sortBy<{a: number}, TResult>({a: 42}); } @@ -4495,89 +4489,27 @@ module TestSortBy { result = _(array).chain().sortBy(); result = _(array).chain().sortBy(listIterator); - result = _(array).chain().sortBy(listIterator, any); result = _(array).chain().sortBy(''); result = _(array).chain().sortBy<{a: number}>({a: 42}); result = _(list).chain().sortBy(); result = _(list).chain().sortBy(listIterator); - result = _(list).chain().sortBy(listIterator, any); result = _(list).chain().sortBy(''); result = _(list).chain().sortBy<{a: number}, TResult>({a: 42}); result = _(dictionary).chain().sortBy(); result = _(dictionary).chain().sortBy(dictionaryIterator); - result = _(dictionary).chain().sortBy(dictionaryIterator, any); result = _(dictionary).chain().sortBy(''); result = _(dictionary).chain().sortBy<{a: number}, TResult>({a: 42}); } } -// _.sortByAll -module TestSortByAll { - type SampleObject = {a: number; b: string; c: boolean}; +result = _.sortBy(stoogesAges, function(stooge) { return Math.sin(stooge.age); }, function(stooge) { return stooge.name.slice(1); }); +result = _.sortBy(stoogesAges, ['name', 'age']); +result = _.sortBy(stoogesAges, 'name', function(stooge) { return Math.sin(stooge.age); }); - let array: SampleObject[]; - let list: _.List; - let numericDictionary: _.NumericDictionary; - let dictionary: _.Dictionary;; +result = _(foodsOrganic).sortBy('organic', (food) => food.name, { organic: true }).value(); - { - let iteratees: (value: string) => any|((value: string) => any)[]; - let result: string[]; - - result = _.sortByAll('acbd', iteratees); - } - - { - let iteratees: (value: SampleObject) => any|string|{a: number}|((value: SampleObject) => any|string|{a: number})[]; - let result: SampleObject[]; - - result = _.sortByAll<{a: number}, SampleObject>(array, iteratees); - result = _.sortByAll(array, iteratees); - - result = _.sortByAll<{a: number}, SampleObject>(list, iteratees); - result = _.sortByAll(list, iteratees); - - result = _.sortByAll<{a: number}, SampleObject>(numericDictionary, iteratees); - result = _.sortByAll(numericDictionary, iteratees); - - result = _.sortByAll<{a: number}, SampleObject>(dictionary, iteratees); - result = _.sortByAll(dictionary, iteratees); - } - - { - let iteratees: (value: SampleObject) => any|string|{a: number}|((value: SampleObject) => any|string|{a: number})[]; - let result: _.LoDashImplicitArrayWrapper; - - result = _(array).sortByAll<{a: number}>(iteratees); - - result = _(list).sortByAll<{a: number}, SampleObject>(iteratees); - result = _(list).sortByAll(iteratees); - - result = _(numericDictionary).sortByAll<{a: number}, SampleObject>(iteratees); - result = _(numericDictionary).sortByAll(iteratees); - - result = _(dictionary).sortByAll<{a: number}, SampleObject>(iteratees); - result = _(dictionary).sortByAll(iteratees); - } - - { - let iteratees: (value: SampleObject) => any|string|{a: number}|((value: SampleObject) => any|string|{a: number})[]; - let result: _.LoDashExplicitArrayWrapper; - - result = _(array).chain().sortByAll<{a: number}>(iteratees); - - result = _(list).chain().sortByAll<{a: number}, SampleObject>(iteratees); - result = _(list).chain().sortByAll(iteratees); - - result = _(numericDictionary).chain().sortByAll<{a: number}, SampleObject>(iteratees); - result = _(numericDictionary).chain().sortByAll(iteratees); - - result = _(dictionary).chain().sortByAll<{a: number}, SampleObject>(iteratees); - result = _(dictionary).chain().sortByAll(iteratees); - } -} // _.orderBy module TestorderBy { diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 6f9f2f223..dc4594691 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -39,8 +39,8 @@ TODO: - [x] Split _.sortedLastIndex into _.sortedLastIndexBy - [ ] Split _.uniq into _.sortedUniq, _.sortedUniqBy, & _.uniqBy -- [ ] Check for aliases in this group -- [ ] Absorbed _.sortByAll into _.sortBy +- [ ] TODO remove _.sortBy duplicates +- [x] Absorbed _.sortByAll into _.sortBy - [x] Changed the category of _.at to “Object” - [x] Changed the category of _.bindAll to “Utility” - [ ] Made “By” methods provide a single param to iteratees @@ -7343,29 +7343,41 @@ declare module _ { //_.sortBy interface LoDashStatic { /** - * Creates an array of elements, sorted in ascending order by the results of running each element in a - * collection through iteratee. This method performs a stable sort, that is, it preserves the original sort - * order of equal elements. The iteratee is bound to thisArg and invoked with three arguments: - * (value, index|key, collection). + * Creates an array of elements, sorted in ascending order by the results of + * running each element in a collection through each iteratee. This method + * performs a stable sort, that is, it preserves the original sort order of + * equal elements. The iteratees are invoked with one argument: (value). * - * If a property name is provided for iteratee the created _.property style callback returns the property - * valueof the given element. + * @static + * @memberOf _ + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {...(Function|Function[]|Object|Object[]|string|string[])} [iteratees=[_.identity]] + * The iteratees to sort by, specified individually or in arrays. + * @returns {Array} Returns the new sorted array. + * @example * - * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for - * elements that have a matching property value, else false. + * var users = [ + * { 'user': 'fred', 'age': 48 }, + * { 'user': 'barney', 'age': 36 }, + * { 'user': 'fred', 'age': 42 }, + * { 'user': 'barney', 'age': 34 } + * ]; * - * If an object is provided for iteratee the created _.matches style callback returns true for elements that - * have the properties of the given object, else false. + * _.sortBy(users, function(o) { return o.user; }); + * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]] * - * @param collection The collection to iterate over. - * @param iteratee The function invoked per iteration. - * @param thisArg The this binding of iteratee. - * @return Returns the new sorted array. + * _.sortBy(users, ['user', 'age']); + * // => objects for [['barney', 34], ['barney', 36], ['fred', 42], ['fred', 48]] + * + * _.sortBy(users, 'user', function(o) { + * return Math.floor(o.age / 10); + * }); + * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]] */ sortBy( collection: List, - iteratee?: ListIterator, - thisArg?: any + iteratee?: ListIterator ): T[]; /** @@ -7373,8 +7385,7 @@ declare module _ { */ sortBy( collection: Dictionary, - iteratee?: DictionaryIterator, - thisArg?: any + iteratee?: DictionaryIterator ): T[]; /** @@ -7399,6 +7410,20 @@ declare module _ { sortBy( collection: List|Dictionary ): T[]; + + /** + * @see _.sortBy + */ + sortBy( + collection: (Array|List), + iteratees: (ListIterator|string|Object)[]): T[]; + + /** + * @see _.sortBy + */ + sortBy( + collection: (Array|List), + ...iteratees: (ListIterator|Object|string)[]): T[]; } interface LoDashImplicitArrayWrapper { @@ -7406,8 +7431,7 @@ declare module _ { * @see _.sortBy */ sortBy( - iteratee?: ListIterator, - thisArg?: any + iteratee?: ListIterator ): LoDashImplicitArrayWrapper; /** @@ -7424,6 +7448,16 @@ declare module _ { * @see _.sortBy */ sortBy(): LoDashImplicitArrayWrapper; + + /** + * @see _.sortBy + */ + sortBy(...iteratees: (ListIterator|Object|string)[]): LoDashImplicitArrayWrapper; + + /** + * @see _.sortBy + **/ + sortBy(iteratees: (ListIterator|string|Object)[]): LoDashImplicitArrayWrapper; } interface LoDashImplicitObjectWrapper { @@ -7431,8 +7465,7 @@ declare module _ { * @see _.sortBy */ sortBy( - iteratee?: ListIterator|DictionaryIterator, - thisArg?: any + iteratee?: ListIterator|DictionaryIterator ): LoDashImplicitArrayWrapper; /** @@ -7456,8 +7489,7 @@ declare module _ { * @see _.sortBy */ sortBy( - iteratee?: ListIterator, - thisArg?: any + iteratee?: ListIterator ): LoDashExplicitArrayWrapper; /** @@ -7481,8 +7513,7 @@ declare module _ { * @see _.sortBy */ sortBy( - iteratee?: ListIterator|DictionaryIterator, - thisArg?: any + iteratee?: ListIterator|DictionaryIterator ): LoDashExplicitArrayWrapper; /** @@ -7501,208 +7532,34 @@ declare module _ { sortBy(): LoDashExplicitArrayWrapper; } - //_.sortByAll - interface LoDashStatic { - /** - * This method is like _.sortBy except that it can sort by multiple iteratees or property names. - * - * If a property name is provided for an iteratee the created _.property style callback returns the property - * value of the given element. - * - * If an object is provided for an iteratee the created _.matches style callback returns true for elements that - * have the properties of the given object, else false. - * - * @param collection The collection to iterate over. - * @param iteratees The iteratees to sort by, specified as individual values or arrays of values. - * @return Returns the new sorted array. - */ - sortByAll( - collection: List, - iteratees: ListIterator|string|W|(ListIterator|string|W)[] - ): T[]; - - /** - * @see _.sortByAll - */ - sortByAll( - collection: List, - iteratees: ListIterator|string|Object|(ListIterator|string|Object)[] - ): T[]; - - /** - * @see _.sortByAll - */ - sortByAll( - collection: NumericDictionary, - iteratees: NumericDictionaryIterator|string|W|(NumericDictionaryIterator|string|W)[] - ): T[]; - - /** - * @see _.sortByAll - */ - sortByAll( - collection: NumericDictionary, - iteratees: NumericDictionaryIterator|string|Object|(NumericDictionaryIterator|string|Object)[] - ): T[]; - - /** - * @see _.sortByAll - */ - sortByAll( - collection: Dictionary, - iteratees: DictionaryIterator|string|W|(DictionaryIterator|string|W)[] - ): T[]; - - /** - * @see _.sortByAll - */ - sortByAll( - collection: Dictionary, - iteratees: DictionaryIterator|string|Object|(DictionaryIterator|string|Object)[] - ): T[]; - } - - interface LoDashImplicitWrapper { - /** - * @see _.sortByAll - */ - sortByAll( - iteratees: ListIterator|string|(ListIterator|string)[] - ): LoDashImplicitArrayWrapper; - } - - interface LoDashImplicitArrayWrapper { - /** - * @see _.sortByAll - */ - sortByAll( - iteratees: ListIterator|string|W|(ListIterator|string|W)[] - ): LoDashImplicitArrayWrapper; - } - - interface LoDashImplicitObjectWrapper { - /** - * @see _.sortByAll - */ - sortByAll( - iteratees: ListIterator|string|W|(ListIterator|string|W)[] - ): LoDashImplicitArrayWrapper; - - /** - * @see _.sortByAll - */ - sortByAll( - iteratees: ListIterator|string|Object|(ListIterator|string|Object)[] - ): LoDashImplicitArrayWrapper; - - /** - * @see _.sortByAll - */ - sortByAll( - iteratees: NumericDictionaryIterator|string|W|(NumericDictionaryIterator|string|W)[] - ): LoDashImplicitArrayWrapper; - - /** - * @see _.sortByAll - */ - sortByAll( - iteratees: NumericDictionaryIterator|string|Object|(NumericDictionaryIterator|string|Object)[] - ): LoDashImplicitArrayWrapper; - - /** - * @see _.sortByAll - */ - sortByAll( - iteratees: DictionaryIterator|string|W|(DictionaryIterator|string|W)[] - ): LoDashImplicitArrayWrapper; - - /** - * @see _.sortByAll - */ - sortByAll( - iteratees: DictionaryIterator|string|Object|(DictionaryIterator|string|Object)[] - ): LoDashImplicitArrayWrapper; - } - - interface LoDashExplicitWrapper { - /** - * @see _.sortByAll - */ - sortByAll( - iteratees: ListIterator|string|(ListIterator|string)[] - ): LoDashExplicitArrayWrapper; - } - - interface LoDashExplicitArrayWrapper { - /** - * @see _.sortByAll - */ - sortByAll( - iteratees: ListIterator|string|W|(ListIterator|string|W)[] - ): LoDashExplicitArrayWrapper; - } - - interface LoDashExplicitObjectWrapper { - /** - * @see _.sortByAll - */ - sortByAll( - iteratees: ListIterator|string|W|(ListIterator|string|W)[] - ): LoDashExplicitArrayWrapper; - - /** - * @see _.sortByAll - */ - sortByAll( - iteratees: ListIterator|string|Object|(ListIterator|string|Object)[] - ): LoDashExplicitArrayWrapper; - - /** - * @see _.sortByAll - */ - sortByAll( - iteratees: NumericDictionaryIterator|string|W|(NumericDictionaryIterator|string|W)[] - ): LoDashExplicitArrayWrapper; - - /** - * @see _.sortByAll - */ - sortByAll( - iteratees: NumericDictionaryIterator|string|Object|(NumericDictionaryIterator|string|Object)[] - ): LoDashExplicitArrayWrapper; - - /** - * @see _.sortByAll - */ - sortByAll( - iteratees: DictionaryIterator|string|W|(DictionaryIterator|string|W)[] - ): LoDashExplicitArrayWrapper; - - /** - * @see _.sortByAll - */ - sortByAll( - iteratees: DictionaryIterator|string|Object|(DictionaryIterator|string|Object)[] - ): LoDashExplicitArrayWrapper; - } - //_.orderBy interface LoDashStatic { /** - * This method is like _.sortByAll except that it allows specifying the sort orders of the iteratees to sort - * by. If orders is unspecified, all values are sorted in ascending order. Otherwise, a value is sorted in - * ascending order if its corresponding order is "asc", and descending if "desc". + * This method is like `_.sortBy` except that it allows specifying the sort + * orders of the iteratees to sort by. If `orders` is unspecified, all values + * are sorted in ascending order. Otherwise, specify an order of "desc" for + * descending or "asc" for ascending sort order of corresponding values. * - * If a property name is provided for an iteratee the created _.property style callback returns the property - * value of the given element. + * @static + * @memberOf _ + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function[]|Object[]|string[]} [iteratees=[_.identity]] The iteratees to sort by. + * @param {string[]} [orders] The sort orders of `iteratees`. + * @param- {Object} [guard] Enables use as an iteratee for functions like `_.reduce`. + * @returns {Array} Returns the new sorted array. + * @example * - * If an object is provided for an iteratee the created _.matches style callback returns true for elements - * that have the properties of the given object, else false. + * var users = [ + * { 'user': 'fred', 'age': 48 }, + * { 'user': 'barney', 'age': 34 }, + * { 'user': 'fred', 'age': 42 }, + * { 'user': 'barney', 'age': 36 } + * ]; * - * @param collection The collection to iterate over. - * @param iteratees The iteratees to sort by. - * @param orders The sort orders of iteratees. - * @return Returns the new sorted array. + * // sort by `user` in ascending order and by `age` in descending order + * _.orderBy(users, ['user', 'age'], ['asc', 'desc']); + * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]] */ orderBy( collection: List, @@ -13355,11 +13212,22 @@ declare module _ { //_.words interface LoDashStatic { /** - * Splits string into an array of its words. + * Splits `string` into an array of its words. * - * @param string The string to inspect. - * @param pattern The pattern to match words. - * @return Returns the words of string. + * @static + * @memberOf _ + * @category String + * @param {string} [string=''] The string to inspect. + * @param {RegExp|string} [pattern] The pattern to match words. + * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`. + * @returns {Array} Returns the words of `string`. + * @example + * + * _.words('fred, barney, & pebbles'); + * // => ['fred', 'barney', 'pebbles'] + * + * _.words('fred, barney, & pebbles', /[^, ]+/g); + * // => ['fred', 'barney', '&', 'pebbles'] */ words( string?: string, From ebb1b5add4dfbf7290490aeb5f982590031c52b9 Mon Sep 17 00:00:00 2001 From: DomiR Date: Thu, 14 Jan 2016 01:10:29 +0100 Subject: [PATCH 26/51] (clean) Status update --- lodash/lodash.d.ts | 65 ++++++++++++++++++++++------------------------ 1 file changed, 31 insertions(+), 34 deletions(-) diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index dc4594691..1f4f78ede 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -11,13 +11,11 @@ TODO: - [ ] Made _.forEach, _.forIn, _.forOwn, & _.times implicitly end a chain sequence - [ ] Removed thisArg params from most methods -- [ ] Check for aliases in this group - [x] Removed _.support - [x] Removed _.findWhere in favor of _.find with iteratee shorthand - [x] Removed _.where in favor of _.filter with iteratee shorthand - [x] Removed _.pluck in favor of _.map with iteratee shorthand -- [ ] Check for aliases in this group - [x] Renamed _.first to _.head - [x] Renamed _.indexBy to _.keyBy - [x] Renamed _.invoke to _.invokeMap @@ -30,14 +28,13 @@ TODO: - [x] Renamed _.trimLeft & _.trimRight to _.trimStart & _.trimEnd - [x] Renamed _.trunc to _.truncate -- [ ] Check for aliases in this group - [x] Split _.indexOf & _.lastIndexOf into _.sortedIndexOf & _.sortedLastIndexOf - [x] Split _.max & _.min into _.maxBy & _.minBy - [x] Split _.omit & _.pick into _.omitBy & _.pickBy - [x] Split _.sample into _.sampleSize - [x] Split _.sortedIndex into _.sortedIndexBy - [x] Split _.sortedLastIndex into _.sortedLastIndexBy -- [ ] Split _.uniq into _.sortedUniq, _.sortedUniqBy, & _.uniqBy +- [x] Split _.uniq into _.sortedUniq, _.sortedUniqBy, & _.uniqBy - [ ] TODO remove _.sortBy duplicates - [x] Absorbed _.sortByAll into _.sortBy @@ -45,7 +42,7 @@ TODO: - [x] Changed the category of _.bindAll to “Utility” - [ ] Made “By” methods provide a single param to iteratees - [x] Made _.capitalize uppercase the first character & lowercase the rest -- [ ] Made _.functions return only own method names +- [x] Made _.functions return only own method names - [ ] Made _.words chainable by default - [ ] Removed isDeep params from _.clone & _.flatten - [ ] Removed _.bindAll support for binding all methods when no names are provided @@ -63,15 +60,15 @@ added 23 array methods: - [ ] _.pullAll - [ ] _.pullAllBy - [ ] _.reverse -- [ ] _.sortedIndexBy -- [ ] _.sortedIndexOf -- [ ] _.sortedLastIndexBy +- [x] _.sortedIndexBy +- [x] _.sortedIndexOf +- [x] _.sortedLastIndexBy - [ ] _.sortedLastIndexOf -- [ ] _.sortedUniq -- [ ] _.sortedUniqBy +- [x] _.sortedUniq +- [x] _.sortedUniqBy - [ ] _.unionBy - [ ] _.unionWith -- [ ] _.uniqBy +- [x] _.uniqBy - [ ] _.uniqWith - [ ] _.xorBy - [ ] _.xorWith @@ -132,9 +129,9 @@ added 8 utility methods: - [ ] _.toPath added 4 math methods: -- [ ] _.maxBy +- [x] _.maxBy - [ ] _.mean -- [ ] _.minBy +- [x] _.minBy - [ ] _.sumBy added 2 function methods: @@ -149,7 +146,7 @@ added chain method: - [ ] _.next added collection method: -- [ ] _.sampleSize +- [x] _.sampleSize Added 3 aliases - [ ] _.extend as an alias of _.assignIn @@ -179,32 +176,32 @@ Other changes - [ ] Added clear method to _.memoize.Cache - [ ] Added flush method to debounced & throttled functions - [ ] Added support for ES6 maps, sets, & symbols to _.clone, _.isEqual, & _.toArray -- [ ] Added support for array buffers to _.isEqual -- [ ] Added support for converting iterators to _.toArray -- [ ] Added support for deep paths to _.zipObject -- [ ] Changed UMD to export to window or self when available regardless of other exports +- [x] Added support for array buffers to _.isEqual +- [x] Added support for converting iterators to _.toArray +- [x] Added support for deep paths to _.zipObject +- [x] Changed UMD to export to window or self when available regardless of other exports - [ ] Enabled _.flow & _.flowRight to accept an array of functions - [ ] Ensured “Collection” methods treat functions as objects -- [ ] Ensured debounce cancel clears args & thisArg references -- [ ] Ensured _.add, _.subtract, & _.sum don’t skip NaN values +- [x] Ensured debounce cancel clears args & thisArg references +- [x] Ensured _.add, _.subtract, & _.sum don’t skip NaN values - [ ] Ensured _.assign, _.defaults, & _.merge coerce object values to objects - [ ] Ensured _.bindKey bound functions call object[key] when called with the new operator -- [ ] Ensured _.clone treats generators like functions -- [ ] Ensured _.clone produces clones with the source’s [[Prototype]] -- [ ] Ensured _.defaults assigns properties that shadow Object.prototype -- [ ] Ensured _.defaultsDeep doesn’t merge a string into an array -- [ ] Ensured _.defaultsDeep & _.merge don’t modify sources -- [ ] Ensured _.defaultsDeep works with circular references +- [x] Ensured _.clone treats generators like functions +- [x] Ensured _.clone produces clones with the source’s [[Prototype]] +- [x] Ensured _.defaults assigns properties that shadow Object.prototype +- [x] Ensured _.defaultsDeep doesn’t merge a string into an array +- [x] Ensured _.defaultsDeep & _.merge don’t modify sources +- [x] Ensured _.defaultsDeep works with circular references - [ ] Ensured _.isFunction returns true for generator functions -- [ ] Ensured _.keys skips “length” on strict mode arguments objects in Safari 9 +- [x] Ensured _.keys skips “length” on strict mode arguments objects in Safari 9 - [ ] Ensured _.merge assigns typed arrays directly -- [ ] Ensured _.merge doesn’t convert strings to arrays -- [ ] Ensured _.merge merges plain-objects onto non plain-objects -- [ ] Ensured _#plant resets iterator data of cloned sequences -- [ ] Ensured _.random swaps min & max if min is greater than max -- [ ] Ensured _.range preserves the sign of start of -0 -- [ ] Ensured _.reduce & _.reduceRight use getIteratee in their array branch -- [ ] Fixed rounding issue with the precision param of _.floor +- [x] Ensured _.merge doesn’t convert strings to arrays +- [x] Ensured _.merge merges plain-objects onto non plain-objects +- [x] Ensured _#plant resets iterator data of cloned sequences +- [x] Ensured _.random swaps min & max if min is greater than max +- [x] Ensured _.range preserves the sign of start of -0 +- [x] Ensured _.reduce & _.reduceRight use getIteratee in their array branch +- [x] Fixed rounding issue with the precision param of _.floor - [ ] Made _(...) an iterator & iterable - [ ] Made _.drop, _.take, & right forms coerce n of undefined to 0 */ From ede6c030a176e7e8e8392982e29a42b946268c4d Mon Sep 17 00:00:00 2001 From: DomiR Date: Thu, 14 Jan 2016 01:47:52 +0100 Subject: [PATCH 27/51] (feature) Add _.clamp and _.subtract --- lodash/lodash-tests.ts | 34 +++++++++++++++ lodash/lodash.d.ts | 96 +++++++++++++++++++++++++++++++++++++++++- 2 files changed, 128 insertions(+), 2 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index c19e3af69..69ad40482 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -6539,6 +6539,40 @@ module TestSum { * Number * **********/ + // _.subtract + module subtract { + { + let result: number; + + result = _.subtract(3, 2); + + result = _(3).subtract(2); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(3).chain().subtract(2); + } + } + +// _.clamp +module TestInClamp { + { + let result: number; + + result = _.clamp(3, 2, 4); + + result = _(3).clamp(2, 4); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(3).chain().clamp(2, 4); + } +} + // _.inRange module TestInRange { { diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 1f4f78ede..f36c2c1d7 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -5,17 +5,20 @@ /** -# 4.0.0 Changelog (https://github.com/lodash/lodash/wiki/Changelog) +### 4.0.0 Changelog (https://github.com/lodash/lodash/wiki/Changelog) -TODO: +#### TODO: +misc: - [ ] Made _.forEach, _.forIn, _.forOwn, & _.times implicitly end a chain sequence - [ ] Removed thisArg params from most methods +removed: - [x] Removed _.support - [x] Removed _.findWhere in favor of _.find with iteratee shorthand - [x] Removed _.where in favor of _.filter with iteratee shorthand - [x] Removed _.pluck in favor of _.map with iteratee shorthand +renamed: - [x] Renamed _.first to _.head - [x] Renamed _.indexBy to _.keyBy - [x] Renamed _.invoke to _.invokeMap @@ -28,6 +31,7 @@ TODO: - [x] Renamed _.trimLeft & _.trimRight to _.trimStart & _.trimEnd - [x] Renamed _.trunc to _.truncate +split: - [x] Split _.indexOf & _.lastIndexOf into _.sortedIndexOf & _.sortedLastIndexOf - [x] Split _.max & _.min into _.maxBy & _.minBy - [x] Split _.omit & _.pick into _.omitBy & _.pickBy @@ -36,6 +40,7 @@ TODO: - [x] Split _.sortedLastIndex into _.sortedLastIndexBy - [x] Split _.uniq into _.sortedUniq, _.sortedUniqBy, & _.uniqBy +changes: - [ ] TODO remove _.sortBy duplicates - [x] Absorbed _.sortByAll into _.sortBy - [x] Changed the category of _.at to “Object” @@ -10443,6 +10448,93 @@ declare module _ { * Number * **********/ + //_.subtract + interface LoDashStatic { + /** + * Subtract two numbers. + * + * @static + * @memberOf _ + * @category Math + * @param {number} minuend The first number in a subtraction. + * @param {number} subtrahend The second number in a subtraction. + * @returns {number} Returns the difference. + * @example + * + * _.subtract(6, 4); + * // => 2 + */ + subtract( + minuend: number, + subtrahend: number + ): number; + } + + interface LoDashImplicitWrapper { + /** + * @see _.subtract + */ + subtract( + subtrahend: number + ): number; + } + + interface LoDashExplicitWrapper { + /** + * @see _.subtract + */ + subtract( + subtrahend: number + ): LoDashExplicitWrapper; + } + + //_.clamp + interface LoDashStatic { + /** + * Clamps `number` within the inclusive `lower` and `upper` bounds. + * + * @static + * @memberOf _ + * @category Number + * @param {number} number The number to clamp. + * @param {number} [lower] The lower bound. + * @param {number} upper The upper bound. + * @returns {number} Returns the clamped number. + * @example + * + * _.clamp(-10, -5, 5); + * // => -5 + * + * _.clamp(10, -5, 5); + * // => 5 + */ + clamp( + number: number, + lower: number, + upper: number + ): number; + } + + interface LoDashImplicitWrapper { + /** + * @see _.clamp + */ + clamp( + lower: number, + upper: number + ): number; + } + + interface LoDashExplicitWrapper { + /** + * @see _.clamp + */ + clamp( + lower: number, + upper: number + ): LoDashExplicitWrapper; + } + //_.inRange interface LoDashStatic { /** From 5919b1b39d79c4e406b8c420dc6b8f7b1c5fb80e Mon Sep 17 00:00:00 2001 From: DomiR Date: Thu, 14 Jan 2016 02:08:49 +0100 Subject: [PATCH 28/51] (feature) Add _.flip and _.unary --- lodash/lodash-tests.ts | 57 +++++++++++++++++++++++++++++-- lodash/lodash.d.ts | 76 +++++++++++++++++++++++++++++++++++++++--- 2 files changed, 127 insertions(+), 6 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 69ad40482..af31de6ce 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -4627,8 +4627,7 @@ module TestNow { /************* * Functions * *************/ - -// _after +// _.after module TestAfter { interface Func { (a: string, b: number): boolean; @@ -5080,6 +5079,33 @@ module TestDelay { } } +// _.flip +module TestFlip { + interface Func { + (a: number, b: string): boolean; + } + + let func: Func; + + { + let result: Func; + + result = _.flip(func); + } + + { + let result: _.LoDashImplicitObjectWrapper; + + result = _(func).flip(); + } + + { + let result: _.LoDashExplicitObjectWrapper; + + result = _(func).chain().flip(); + } +} + // _.flow module TestFlow { let Fn1: (n: number) => number; @@ -5395,6 +5421,33 @@ module TestThrottle { } } +// _.unary +module TestUnary { + interface Func { + (a: number, b: string): boolean; + } + + let func: Func; + + { + let result: Func; + + result = _.unary(func); + } + + { + let result: _.LoDashImplicitObjectWrapper; + + result = _(func).unary(); + } + + { + let result: _.LoDashExplicitObjectWrapper; + + result = _(func).chain().unary(); + } +} + // _.wrap module TestWrap { type SampleValue = {a: number; b: string; c: boolean} diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index f36c2c1d7..1f5d7d743 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -140,12 +140,12 @@ added 4 math methods: - [ ] _.sumBy added 2 function methods: -- [ ] _.flip & -- [ ] _.unary +- [x] _.flip +- [x] _.unary added 2 number methods: -- [ ] _.clamp & -- [ ] _.subtract +- [x] _.clamp +- [x] _.subtract added chain method: - [ ] _.next @@ -8366,6 +8366,41 @@ declare module _ { ): LoDashExplicitWrapper; } + interface LoDashStatic { + /** + * Creates a function that invokes `func` with arguments reversed. + * + * @static + * @memberOf _ + * @category Function + * @param {Function} func The function to flip arguments for. + * @returns {Function} Returns the new function. + * @example + * + * var flipped = _.flip(function() { + * return _.toArray(arguments); + * }); + * + * flipped('a', 'b', 'c', 'd'); + * // => ['d', 'c', 'b', 'a'] + */ + flip(func: T): T; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.flip + */ + flip(): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.flip + */ + flip(): LoDashExplicitObjectWrapper; + } + //_.flow interface LoDashStatic { /** @@ -8846,6 +8881,39 @@ declare module _ { ): LoDashExplicitObjectWrapper; } + //_.unary + interface LoDashStatic { + /** + * Creates a function that accepts up to one argument, ignoring any + * additional arguments. + * + * @static + * @memberOf _ + * @category Function + * @param {Function} func The function to cap arguments for. + * @returns {Function} Returns the new function. + * @example + * + * _.map(['6', '8', '10'], _.unary(parseInt)); + * // => [6, 8, 10] + */ + unary(func: T): T; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.unary + */ + unary(): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.unary + */ + unary(): LoDashExplicitObjectWrapper; + } + //_.wrap interface LoDashStatic { /** From ccc411a625c10c4654ab364574cf0c1cdc10b080 Mon Sep 17 00:00:00 2001 From: DomiR Date: Thu, 14 Jan 2016 02:25:33 +0100 Subject: [PATCH 29/51] (feature) Add _.mean and _.sumBy --- lodash/lodash-tests.ts | 94 +++++++++------ lodash/lodash.d.ts | 257 ++++++++++++++++++++++++++++------------- 2 files changed, 240 insertions(+), 111 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index af31de6ce..c3748114d 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -6442,6 +6442,18 @@ module TestMaxBy { result = _(dictionary).maxBy<{a: number}, number>({a: 42}); } +// _.mean +module TestMean { + let array: number[]; + + let result: number; + + result = _.mean(array); + + result = _(array).mean(); + +} + // _.min module TestMin { let array: number[]; @@ -6533,58 +6545,74 @@ module TestSum { result = _.sum(array); result = _.sum(array); - result = _.sum(array, listIterator); - result = _.sum(array, listIterator, any); - result = _.sum(array, ''); - result = _.sum(list); result = _.sum(list); - result = _.sum(list, listIterator); - result = _.sum(list, listIterator, any); - result = _.sum(list, ''); - - result = _.sum(dictionary); - result = _.sum(dictionary); - result = _.sum(dictionary, dictionaryIterator); - result = _.sum(dictionary, dictionaryIterator, any); - result = _.sum(dictionary, ''); result = _(array).sum(); - result = _(array).sum(listIterator); - result = _(array).sum(listIterator, any); - result = _(array).sum(''); - result = _(list).sum(); - result = _(list).sum(listIterator); - result = _(list).sum(listIterator, any); - result = _(list).sum(''); result = _(dictionary).sum(); - result = _(dictionary).sum(dictionaryIterator); - result = _(dictionary).sum(dictionaryIterator, any); - result = _(dictionary).sum(''); } { let result: _.LoDashExplicitWrapper; result = _(array).chain().sum(); - result = _(array).chain().sum(listIterator); - result = _(array).chain().sum(listIterator, any); - result = _(array).chain().sum(''); - result = _(list).chain().sum(); - result = _(list).chain().sum(listIterator); - result = _(list).chain().sum(listIterator, any); - result = _(list).chain().sum(''); result = _(dictionary).chain().sum(); - result = _(dictionary).chain().sum(dictionaryIterator); - result = _(dictionary).chain().sum(dictionaryIterator, any); - result = _(dictionary).chain().sum(''); + } +} + +// _.sumBy +module TestSumBy { + let array: number[]; + let list: _.List; + let dictionary: _.Dictionary; + + let listIterator: (value: number, index: number, collection: _.List) => number; + let dictionaryIterator: (value: number, key: string, collection: _.Dictionary) => number; + + { + let result: number; + + result = _.sumBy(array); + result = _.sumBy(array, listIterator); + result = _.sumBy(array, ''); + + + result = _.sumBy(list); + result = _.sumBy(list, listIterator); + result = _.sumBy(list, ''); + + result = _.sumBy(dictionary); + result = _.sumBy(dictionary, dictionaryIterator); + result = _.sumBy(dictionary, ''); + + result = _(array).sumBy(listIterator); + result = _(array).sumBy(''); + + result = _(list).sumBy(listIterator); + result = _(list).sumBy(''); + + result = _(dictionary).sumBy(dictionaryIterator); + result = _(dictionary).sumBy(''); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(array).chain().sumBy(listIterator); + result = _(array).chain().sumBy(''); + + result = _(list).chain().sumBy(listIterator); + result = _(list).chain().sumBy(''); + + result = _(dictionary).chain().sumBy(dictionaryIterator); + result = _(dictionary).chain().sumBy(''); } } diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 1f5d7d743..0bdf99972 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -135,9 +135,9 @@ added 8 utility methods: added 4 math methods: - [x] _.maxBy -- [ ] _.mean +- [x] _.mean - [x] _.minBy -- [ ] _.sumBy +- [x] _.sumBy added 2 function methods: - [x] _.flip @@ -10226,6 +10226,38 @@ declare module _ { ): T; } + //_.mean + interface LoDashStatic { + /** + * Computes the mean of the values in `array`. + * + * @static + * @memberOf _ + * @category Math + * @param {Array} array The array to iterate over. + * @returns {number} Returns the mean. + * @example + * + * _.mean([4, 2, 8, 6]); + * // => 5 + */ + mean( + collection: List + ): number; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.mean + */ + mean(): number; + + /** + * @see _.mean + */ + mean(): number; + } + //_.min interface LoDashStatic { /** @@ -10391,40 +10423,19 @@ declare module _ { //_.sum interface LoDashStatic { /** - * Gets the sum of the values in collection. + * Computes the sum of the values in `array`. * - * @param collection The collection to iterate over. - * @param iteratee The function invoked per iteration. - * @param thisArg The this binding of iteratee. - * @return Returns the sum. + * @static + * @memberOf _ + * @category Math + * @param {Array} array The array to iterate over. + * @returns {number} Returns the sum. + * @example + * + * _.sum([4, 2, 8, 6]); + * // => 20 */ - sum( - collection: List, - iteratee: ListIterator, - thisArg?: any - ): number; - - /** - * @see _.sum - **/ - sum( - collection: Dictionary, - iteratee: DictionaryIterator, - thisArg?: any - ): number; - - /** - * @see _.sum - */ - sum( - collection: List|Dictionary, - iteratee: string - ): number; - - /** - * @see _.sum - */ - sum(collection: List|Dictionary): number; + sum(collection: List): number; /** * @see _.sum @@ -10433,19 +10444,6 @@ declare module _ { } interface LoDashImplicitArrayWrapper { - /** - * @see _.sum - */ - sum( - iteratee: ListIterator, - thisArg?: any - ): number; - - /** - * @see _.sum - */ - sum(iteratee: string): number; - /** * @see _.sum */ @@ -10456,15 +10454,7 @@ declare module _ { /** * @see _.sum **/ - sum( - iteratee: ListIterator|DictionaryIterator, - thisArg?: any - ): number; - - /** - * @see _.sum - */ - sum(iteratee: string): number; + sum(): number; /** * @see _.sum @@ -10473,19 +10463,6 @@ declare module _ { } interface LoDashExplicitArrayWrapper { - /** - * @see _.sum - */ - sum( - iteratee: ListIterator, - thisArg?: any - ): LoDashExplicitWrapper; - - /** - * @see _.sum - */ - sum(iteratee: string): LoDashExplicitWrapper; - /** * @see _.sum */ @@ -10496,15 +10473,7 @@ declare module _ { /** * @see _.sum */ - sum( - iteratee: ListIterator|DictionaryIterator, - thisArg?: any - ): LoDashExplicitWrapper; - - /** - * @see _.sum - */ - sum(iteratee: string): LoDashExplicitWrapper; + sum(): LoDashExplicitWrapper; /** * @see _.sum @@ -10512,6 +10481,138 @@ declare module _ { sum(): LoDashExplicitWrapper; } + //_.sumBy + interface LoDashStatic { + /** + * This method is like `_.sum` except that it accepts `iteratee` which is + * invoked for each element in `array` to generate the value to be summed. + * The iteratee is invoked with one argument: (value). + * + * @static + * @memberOf _ + * @category Math + * @param {Array} array The array to iterate over. + * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element. + * @returns {number} Returns the sum. + * @example + * + * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }]; + * + * _.sumBy(objects, function(o) { return o.n; }); + * // => 20 + * + * // using the `_.property` iteratee shorthand + * _.sumBy(objects, 'n'); + * // => 20 + */ + sumBy( + collection: List, + iteratee: ListIterator + ): number; + + /** + * @see _.sumBy + **/ + sumBy( + collection: Dictionary, + iteratee: DictionaryIterator + ): number; + + /** + * @see _.sumBy + */ + sumBy( + collection: List|Dictionary, + iteratee: string + ): number; + + /** + * @see _.sumBy + */ + sumBy(collection: List|Dictionary): number; + + /** + * @see _.sumBy + */ + sumBy(collection: List|Dictionary): number; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.sumBy + */ + sumBy( + iteratee: ListIterator + ): number; + + /** + * @see _.sumBy + */ + sumBy(iteratee: string): number; + + /** + * @see _.sumBy + */ + sumBy(): number; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.sumBy + **/ + sumBy( + iteratee: ListIterator|DictionaryIterator + ): number; + + /** + * @see _.sumBy + */ + sumBy(iteratee: string): number; + + /** + * @see _.sumBy + */ + sumBy(): number; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.sumBy + */ + sumBy( + iteratee: ListIterator + ): LoDashExplicitWrapper; + + /** + * @see _.sumBy + */ + sumBy(iteratee: string): LoDashExplicitWrapper; + + /** + * @see _.sumBy + */ + sumBy(): LoDashExplicitWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.sumBy + */ + sumBy( + iteratee: ListIterator|DictionaryIterator + ): LoDashExplicitWrapper; + + /** + * @see _.sumBy + */ + sumBy(iteratee: string): LoDashExplicitWrapper; + + /** + * @see _.sumBy + */ + sumBy(): LoDashExplicitWrapper; + } + /********** * Number * **********/ From c64f7a35b79dbc536f5af4953e7897c94a5d4063 Mon Sep 17 00:00:00 2001 From: DomiR Date: Thu, 14 Jan 2016 17:39:12 +0100 Subject: [PATCH 30/51] (feature) Add _.isEqual and _.eq --- lodash/lodash-tests.ts | 33 +++++---- lodash/lodash.d.ts | 155 +++++++++++++++++++++++++++++++---------- 2 files changed, 141 insertions(+), 47 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index c3748114d..bea9ee14a 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -5620,20 +5620,14 @@ module TestEq { let result: boolean; result = _.eq(any, any); - result = _.eq(any, any, customizer); - result = _.eq(any, any, customizer, any); result = _(any).eq(any); - result = _(any).eq(any, customizer); - result = _(any).eq(any, customizer, any); } { let result: _.LoDashExplicitWrapper; result = _(any).chain().eq(any); - result = _(any).chain().eq(any, customizer); - result = _(any).chain().eq(any, customizer, any); } } @@ -5843,20 +5837,35 @@ module TestIsEqual { let result: boolean; result = _.isEqual(any, any); - result = _.isEqual(any, any, customizer); - result = _.isEqual(any, any, customizer, any); result = _(any).isEqual(any); - result = _(any).isEqual(any, customizer); - result = _(any).isEqual(any, customizer, any); } { let result: _.LoDashExplicitWrapper; + + result = _(any).chain().isEqual(any); - result = _(any).chain().isEqual(any, customizer); - result = _(any).chain().isEqual(any, customizer, any); + } +} + +// _.isEqualWith +module TestIsEqualWith { + let customizer: (value: any, other: any, indexOrKey?: number|string) => boolean; + + { + let result: boolean; + + result = _.isEqualWith(any, any, customizer); + + result = _(any).isEqualWith(any, customizer); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(any).chain().isEqualWith(any, customizer); } } diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 0bdf99972..5cadfc55f 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -9212,13 +9212,38 @@ declare module _ { //_.eq interface LoDashStatic { /** - * @see _.isEqual + * Performs a [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * comparison between two values to determine if they are equivalent. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @returns {boolean} Returns `true` if the values are equivalent, else `false`. + * @example + * + * var object = { 'user': 'fred' }; + * var other = { 'user': 'fred' }; + * + * _.eq(object, object); + * // => true + * + * _.eq(object, other); + * // => false + * + * _.eq('a', 'a'); + * // => true + * + * _.eq('a', Object('a')); + * // => false + * + * _.eq(NaN, NaN); + * // => true */ eq( value: any, - other: any, - customizer?: IsEqualCustomizer, - thisArg?: any + other: any ): boolean; } @@ -9227,9 +9252,7 @@ declare module _ { * @see _.isEqual */ eq( - other: any, - customizer?: IsEqualCustomizer, - thisArg?: any + other: any ): boolean; } @@ -9238,9 +9261,7 @@ declare module _ { * @see _.isEqual */ eq( - other: any, - customizer?: IsEqualCustomizer, - thisArg?: any + other: any ): LoDashExplicitWrapper; } @@ -9446,34 +9467,38 @@ declare module _ { } //_.isEqual - interface IsEqualCustomizer { - (value: any, other: any, indexOrKey?: number|string): boolean; - } - + // TODO tests interface LoDashStatic { /** - * Performs a deep comparison between two values to determine if they are equivalent. If customizer is - * provided it’s invoked to compare values. If customizer returns undefined comparisons are handled by the - * method instead. The customizer is bound to thisArg and invoked with up to three arguments: (value, other - * [, index|key]). + * Performs a deep comparison between two values to determine if they are + * equivalent. * - * Note: This method supports comparing arrays, booleans, Date objects, numbers, Object objects, regexes, - * and strings. Objects are compared by their own, not inherited, enumerable properties. Functions and DOM - * nodes are not supported. Provide a customizer function to extend support for comparing other values. + * **Note:** This method supports comparing arrays, array buffers, booleans, + * date objects, error objects, maps, numbers, `Object` objects, regexes, + * sets, strings, symbols, and typed arrays. `Object` objects are compared + * by their own, not inherited, enumerable properties. Functions and DOM + * nodes are **not** supported. * - * @alias _.eq + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @returns {boolean} Returns `true` if the values are equivalent, else `false`. + * @example * - * @param value The value to compare. - * @param other The other value to compare. - * @param customizer The function to customize value comparisons. - * @param thisArg The this binding of customizer. - * @return Returns true if the values are equivalent, else false. + * var object = { 'user': 'fred' }; + * var other = { 'user': 'fred' }; + * + * _.isEqual(object, other); + * // => true + * + * object === other; + * // => false */ isEqual( value: any, - other: any, - customizer?: IsEqualCustomizer, - thisArg?: any + other: any ): boolean; } @@ -9482,9 +9507,7 @@ declare module _ { * @see _.isEqual */ isEqual( - other: any, - customizer?: IsEqualCustomizer, - thisArg?: any + other: any ): boolean; } @@ -9493,9 +9516,71 @@ declare module _ { * @see _.isEqual */ isEqual( + other: any + ): LoDashExplicitWrapper; + } + + // _.isEqualWith + interface IsEqualCustomizer { + (value: any, other: any, indexOrKey?: number|string): boolean; + } + + interface LoDashStatic { + /** + * This method is like `_.isEqual` except that it accepts `customizer` which is + * invoked to compare values. If `customizer` returns `undefined` comparisons are + * handled by the method instead. The `customizer` is invoked with up to seven arguments: + * (objValue, othValue [, index|key, object, other, stack]). + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @param {Function} [customizer] The function to customize comparisons. + * @returns {boolean} Returns `true` if the values are equivalent, else `false`. + * @example + * + * function isGreeting(value) { + * return /^h(?:i|ello)$/.test(value); + * } + * + * function customizer(objValue, othValue) { + * if (isGreeting(objValue) && isGreeting(othValue)) { + * return true; + * } + * } + * + * var array = ['hello', 'goodbye']; + * var other = ['hi', 'goodbye']; + * + * _.isEqualWith(array, other, customizer); + * // => true + */ + isEqualWith( + value: any, other: any, - customizer?: IsEqualCustomizer, - thisArg?: any + customizer: IsEqualCustomizer + ): boolean; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.isEqualWith + */ + isEqualWith( + other: any, + customizer: IsEqualCustomizer + ): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.isEqualWith + */ + isEqualWith( + other: any, + customizer: IsEqualCustomizer ): LoDashExplicitWrapper; } From dcf0aac8b272dda73024d832988fc85a1a91f91d Mon Sep 17 00:00:00 2001 From: DomiR Date: Thu, 14 Jan 2016 18:06:29 +0100 Subject: [PATCH 31/51] (feature) Add _.lowerCase and _.lowerFirst --- lodash/lodash-tests.ts | 32 ++++++++++++++++++ lodash/lodash.d.ts | 73 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 105 insertions(+) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index bea9ee14a..a20319e2d 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -8289,6 +8289,38 @@ module TestKebabCase { } } +// _.lowerCase +module TestLowerCase { + { + let result: string; + + result = _.lowerCase('Foo Bar'); + result = _('Foo Bar').lowerCase(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _('Foo Bar').chain().lowerCase(); + } +} + +// _.lowerFirst +module TestLowerFirst { + { + let result: string; + + result = _.lowerFirst('Foo Bar'); + result = _('Foo Bar').lowerFirst(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _('Foo Bar').chain().lowerFirst(); + } +} + // _.pad module TestPad { { diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 5cadfc55f..ee569ab6e 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -13078,6 +13078,79 @@ declare module _ { kebabCase(): LoDashExplicitWrapper; } + //_.lowerCase + interface LoDashStatic { + /** + * Converts `string`, as space separated words, to lower case. + * + * @static + * @memberOf _ + * @category String + * @param {string} [string=''] The string to convert. + * @returns {string} Returns the lower cased string. + * @example + * + * _.lowerCase('--Foo-Bar'); + * // => 'foo bar' + * + * _.lowerCase('fooBar'); + * // => 'foo bar' + * + * _.lowerCase('__FOO_BAR__'); + * // => 'foo bar' + */ + lowerCase(string?: string): string; + } + + interface LoDashImplicitWrapper { + /** + * @see _.lowerCase + */ + lowerCase(): string; + } + + interface LoDashExplicitWrapper { + /** + * @see _.lowerCase + */ + lowerCase(): LoDashExplicitWrapper; + } + + //_.lowerFirst + interface LoDashStatic { + /** + * Converts the first character of `string` to lower case. + * + * @static + * @memberOf _ + * @category String + * @param {string} [string=''] The string to convert. + * @returns {string} Returns the converted string. + * @example + * + * _.lowerFirst('Fred'); + * // => 'fred' + * + * _.lowerFirst('FRED'); + * // => 'fRED' + */ + lowerFirst(string?: string): string; + } + + interface LoDashImplicitWrapper { + /** + * @see _.lowerFirst + */ + lowerFirst(): string; + } + + interface LoDashExplicitWrapper { + /** + * @see _.lowerFirst + */ + lowerFirst(): LoDashExplicitWrapper; + } + //_.pad interface LoDashStatic { /** From 3276cdc914e84978fb672817757b98419471e78d Mon Sep 17 00:00:00 2001 From: DomiR Date: Fri, 15 Jan 2016 01:38:15 +0100 Subject: [PATCH 32/51] (feature) Add _.upperFirst and _.upperCase --- lodash/lodash-tests.ts | 32 +++++++++++++++++ lodash/lodash.d.ts | 81 +++++++++++++++++++++++++++++++++++++++--- 2 files changed, 109 insertions(+), 4 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index a20319e2d..574739560 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -8608,6 +8608,38 @@ module Testtruncate { } } +// _.upperCase +module TestUpperCase { + { + let result: string; + + result = _.upperCase('fred, barney, & pebbles'); + result = _('fred, barney, & pebbles').upperCase(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _('fred, barney, & pebbles').chain().upperCase(); + } +} + +// _.upperFirst +module TestUpperFirst { + { + let result: string; + + result = _.upperFirst('fred, barney, & pebbles'); + result = _('fred, barney, & pebbles').upperFirst(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _('fred, barney, & pebbles').chain().upperFirst(); + } +} + // _.unescape module TestUnescape { { diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index ee569ab6e..e3dfd5235 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -114,12 +114,12 @@ added 13 object methods: - [ ] _.unset added 8 string methods: -- [ ] _.lowerCase -- [ ] _.lowerFirst +- [x] _.lowerCase +- [x] _.lowerFirst - [ ] _.replace - [ ] _.split -- [ ] _.upperCase -- [ ] _.upperFirst +- [x] _.upperCase +- [x] _.upperFirst - [ ] _.toLower - [ ] _.toUpper @@ -13599,6 +13599,79 @@ declare module _ { truncate(options?: TruncateOptions|number): LoDashExplicitWrapper; } + //_.upperCase + interface LoDashStatic { + /** + * Converts `string`, as space separated words, to upper case. + * + * @static + * @memberOf _ + * @category String + * @param {string} [string=''] The string to convert. + * @returns {string} Returns the upper cased string. + * @example + * + * _.upperCase('--foo-bar'); + * // => 'FOO BAR' + * + * _.upperCase('fooBar'); + * // => 'FOO BAR' + * + * _.upperCase('__foo_bar__'); + * // => 'FOO BAR' + */ + upperCase(string?: string): string; + } + + interface LoDashImplicitWrapper { + /** + * @see _.upperCase + */ + upperCase(): string; + } + + interface LoDashExplicitWrapper { + /** + * @see _.upperCase + */ + upperCase(): LoDashExplicitWrapper; + } + + //_.upperFirst + interface LoDashStatic { + /** + * Converts the first character of `string` to upper case. + * + * @static + * @memberOf _ + * @category String + * @param {string} [string=''] The string to convert. + * @returns {string} Returns the converted string. + * @example + * + * _.upperFirst('fred'); + * // => 'Fred' + * + * _.upperFirst('FRED'); + * // => 'FRED' + */ + upperFirst(string?: string): string; + } + + interface LoDashImplicitWrapper { + /** + * @see _.upperFirst + */ + upperFirst(): string; + } + + interface LoDashExplicitWrapper { + /** + * @see _.upperFirst + */ + upperFirst(): LoDashExplicitWrapper; + } + //_.unescape interface LoDashStatic { /** From 90053552388a8ab95078633479e4cc0e0ff9a1e2 Mon Sep 17 00:00:00 2001 From: DomiR Date: Fri, 15 Jan 2016 01:42:13 +0100 Subject: [PATCH 33/51] (feature) Add _.toLower and _.toUpper --- lodash/lodash-tests.ts | 32 ++++++++++++++++++ lodash/lodash.d.ts | 76 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 108 insertions(+) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 574739560..ab51b9e44 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -8516,6 +8516,38 @@ module TestTemplate { } } +// _.toLower +module TestToLower { + { + let result: string; + + result = _.toLower('fred, barney, & pebbles'); + result = _('fred, barney, & pebbles').toLower(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _('fred, barney, & pebbles').chain().toLower(); + } +} + +// _.toUpper +module TestToUpper { + { + let result: string; + + result = _.toUpper('fred, barney, & pebbles'); + result = _('fred, barney, & pebbles').toUpper(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _('fred, barney, & pebbles').chain().toUpper(); + } +} + // _.trim module TestTrim { { diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index e3dfd5235..2f98201dc 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -13473,6 +13473,82 @@ declare module _ { template(options?: TemplateOptions): LoDashExplicitObjectWrapper; } + //_.toLower + interface LoDashStatic { + /** + * Converts `string`, as a whole, to lower case. + * + * @static + * @memberOf _ + * @category String + * @param {string} [string=''] The string to convert. + * @returns {string} Returns the lower cased string. + * @example + * + * _.toLower('--Foo-Bar'); + * // => '--foo-bar' + * + * _.toLower('fooBar'); + * // => 'foobar' + * + * _.toLower('__FOO_BAR__'); + * // => '__foo_bar__' + */ + toLower(string?: string): string; + } + + interface LoDashImplicitWrapper { + /** + * @see _.toLower + */ + toLower(): string; + } + + interface LoDashExplicitWrapper { + /** + * @see _.toLower + */ + toLower(): LoDashExplicitWrapper; + } + + //_.toUpper + interface LoDashStatic { + /** + * Converts `string`, as a whole, to upper case. + * + * @static + * @memberOf _ + * @category String + * @param {string} [string=''] The string to convert. + * @returns {string} Returns the upper cased string. + * @example + * + * _.toUpper('--foo-bar'); + * // => '--FOO-BAR' + * + * _.toUpper('fooBar'); + * // => 'FOOBAR' + * + * _.toUpper('__foo_bar__'); + * // => '__FOO_BAR__' + */ + toUpper(string?: string): string; + } + + interface LoDashImplicitWrapper { + /** + * @see _.toUpper + */ + toUpper(): string; + } + + interface LoDashExplicitWrapper { + /** + * @see _.toUpper + */ + toUpper(): LoDashExplicitWrapper; + } + //_.trim interface LoDashStatic { /** From c5b2e44a2fac562913c3cd7f45d641525be4a58d Mon Sep 17 00:00:00 2001 From: DomiR Date: Fri, 15 Jan 2016 01:45:25 +0100 Subject: [PATCH 34/51] (feature) Add _.isArrayLike and _.isArrayLikeObject --- lodash/lodash-tests.ts | 72 +++++++++++++++++++++++++++++++++ lodash/lodash.d.ts | 91 +++++++++++++++++++++++++++++++++++++++++- 2 files changed, 161 insertions(+), 2 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index ab51b9e44..29fdbcbd3 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -5738,6 +5738,78 @@ module TestIsArray { } } +// _.isArrayLike +module TestIsArrayLike { + { + let value: number|string[]|boolean[]; + + if (_.isArrayLike(value)) { + let result: string[] = value; + } + else { + if (_.isArrayLike(value)) { + let result: boolean[] = value; + } + else { + let result: number = value; + } + } + } + + { + let result: boolean; + + result = _.isArrayLike(any); + result = _(1).isArrayLike(); + result = _([]).isArrayLike(); + result = _({}).isArrayLike(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(1).chain().isArrayLike(); + result = _([]).chain().isArrayLike(); + result = _({}).chain().isArrayLike(); + } +} + +// _.isArrayLikeObject +module TestIsArrayLikeObject { + { + let value: number|string[]|boolean[]; + + if (_.isArrayLikeObject(value)) { + let result: string[] = value; + } + else { + if (_.isArrayLikeObject(value)) { + let result: boolean[] = value; + } + else { + let result: number = value; + } + } + } + + { + let result: boolean; + + result = _.isArrayLikeObject(any); + result = _(1).isArrayLikeObject(); + result = _([]).isArrayLikeObject(); + result = _({}).isArrayLikeObject(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(1).chain().isArrayLikeObject(); + result = _([]).chain().isArrayLikeObject(); + result = _({}).chain().isArrayLikeObject(); + } +} + // _.isBoolean module TestIsBoolean { { diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 2f98201dc..2c2a50b82 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -120,8 +120,8 @@ added 8 string methods: - [ ] _.split - [x] _.upperCase - [x] _.upperFirst -- [ ] _.toLower -- [ ] _.toUpper +- [x] _.toLower +- [x] _.toUpper added 8 utility methods: - [ ] _.cond @@ -9373,6 +9373,93 @@ declare module _ { isArray(): LoDashExplicitWrapper; } + //_.isArrayLike + interface LoDashStatic { + /** + * Checks if `value` is array-like. A value is considered array-like if it's + * not a function and has a `value.length` that's an integer greater than or + * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`. + * + * @static + * @memberOf _ + * @type Function + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is array-like, else `false`. + * @example + * + * _.isArrayLike([1, 2, 3]); + * // => true + * + * _.isArrayLike(document.body.children); + * // => true + * + * _.isArrayLike('abc'); + * // => true + * + * _.isArrayLike(_.noop); + * // => false + */ + isArrayLike(value?: any): value is T[]; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.isArrayLike + */ + isArrayLike(): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.isArrayLike + */ + isArrayLike(): LoDashExplicitWrapper; + } + + //_.isArrayLikeObject + interface LoDashStatic { + /** + * This method is like `_.isArrayLike` except that it also checks if `value` + * is an object. + * + * @static + * @memberOf _ + * @type Function + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an array-like object, else `false`. + * @example + * + * _.isArrayLikeObject([1, 2, 3]); + * // => true + * + * _.isArrayLikeObject(document.body.children); + * // => true + * + * _.isArrayLikeObject('abc'); + * // => false + * + * _.isArrayLikeObject(_.noop); + * // => false + */ + isArrayLikeObject(value?: any): value is T[]; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.isArrayLikeObject + */ + isArrayLikeObject(): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.isArrayLikeObject + */ + isArrayLikeObject(): LoDashExplicitWrapper; + } + //_.isBoolean interface LoDashStatic { /** From 30e24ce7974cb44e47f4cefe3ea211a1968d8a98 Mon Sep 17 00:00:00 2001 From: DomiR Date: Fri, 15 Jan 2016 01:50:14 +0100 Subject: [PATCH 35/51] (feature) Add _.isInteger --- lodash/lodash-tests.ts | 23 +++++++++++++++++-- lodash/lodash.d.ts | 50 ++++++++++++++++++++++++++++++++++++++---- 2 files changed, 67 insertions(+), 6 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 29fdbcbd3..0ccd4dae8 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -5916,8 +5916,6 @@ module TestIsEqual { { let result: _.LoDashExplicitWrapper; - - result = _(any).chain().isEqual(any); } } @@ -6036,6 +6034,27 @@ module TestIsFunction { } } +// _.isInteger +module TestIsInteger { + { + let result: boolean; + + result = _.isInteger(any); + + result = _(1).isInteger(); + result = _([]).isInteger(); + result = _({}).isInteger(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(1).chain().isInteger(); + result = _([]).chain().isInteger(); + result = _({}).chain().isInteger(); + } +} + // _.isMatch var testIsMatchCustiomizerFn: (value: any, other: any, indexOrKey: number|string) => boolean; result = _.isMatch({}, {}); diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 2c2a50b82..a8ea000a6 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -82,9 +82,9 @@ added 18 lang methods: - [x] _.cloneDeepWith - [x] _.cloneWith - [ ] _.eq -- [ ] _.isArrayLike -- [ ] _.isArrayLikeObject -- [ ] _.isEqualWith +- [x] _.isArrayLike +- [x] _.isArrayLikeObject +- [x] _.isEqualWith - [ ] _.isInteger - [ ] _.isLength - [ ] _.isMatchWith @@ -9554,7 +9554,6 @@ declare module _ { } //_.isEqual - // TODO tests interface LoDashStatic { /** * Performs a deep comparison between two values to determine if they are @@ -9749,6 +9748,49 @@ declare module _ { isFunction(): LoDashExplicitWrapper; } + //_.isInteger + interface LoDashStatic { + /** + * Checks if `value` is an integer. + * + * **Note:** This method is based on [`Number.isInteger`](https://mdn.io/Number/isInteger). + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an integer, else `false`. + * @example + * + * _.isInteger(3); + * // => true + * + * _.isInteger(Number.MIN_VALUE); + * // => false + * + * _.isInteger(Infinity); + * // => false + * + * _.isInteger('3'); + * // => false + */ + isInteger(value?: any): boolean; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.isInteger + */ + isInteger(): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.isInteger + */ + isInteger(): LoDashExplicitWrapper; + } + //_.isMatch interface isMatchCustomizer { (value: any, other: any, indexOrKey?: number|string): boolean; From 2fff06cb701e5528e7c59989779b81e48eb6b364 Mon Sep 17 00:00:00 2001 From: DomiR Date: Fri, 15 Jan 2016 01:52:15 +0100 Subject: [PATCH 36/51] (feature) Add _.isLength --- lodash/lodash-tests.ts | 21 +++++++++++++++++++++ lodash/lodash.d.ts | 43 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 0ccd4dae8..ed3239134 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -6055,6 +6055,27 @@ module TestIsInteger { } } +// _.isLength +module TestIsLength { + { + let result: boolean; + + result = _.isLength(any); + + result = _(1).isLength(); + result = _([]).isLength(); + result = _({}).isLength(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(1).chain().isLength(); + result = _([]).chain().isLength(); + result = _({}).chain().isLength(); + } +} + // _.isMatch var testIsMatchCustiomizerFn: (value: any, other: any, indexOrKey: number|string) => boolean; result = _.isMatch({}, {}); diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index a8ea000a6..a5c8ff5db 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -9791,6 +9791,49 @@ declare module _ { isInteger(): LoDashExplicitWrapper; } + //_.isLength + interface LoDashStatic { + /** + * Checks if `value` is a valid array-like length. + * + * **Note:** This function is loosely based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. + * @example + * + * _.isLength(3); + * // => true + * + * _.isLength(Number.MIN_VALUE); + * // => false + * + * _.isLength(Infinity); + * // => false + * + * _.isLength('3'); + * // => false + */ + isLength(value?: any): boolean; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.isLength + */ + isLength(): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.isLength + */ + isLength(): LoDashExplicitWrapper; + } + //_.isMatch interface isMatchCustomizer { (value: any, other: any, indexOrKey?: number|string): boolean; From f10d6aafaa4c978b307d53b55ce00bcdb7ec44ac Mon Sep 17 00:00:00 2001 From: DomiR Date: Fri, 15 Jan 2016 01:56:45 +0100 Subject: [PATCH 37/51] (feature) Add _.isMatchWith --- lodash/lodash-tests.ts | 27 ++++++++++---- lodash/lodash.d.ts | 80 ++++++++++++++++++++++++++++++++++++------ 2 files changed, 89 insertions(+), 18 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index ed3239134..4a0884984 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -6077,13 +6077,26 @@ module TestIsLength { } // _.isMatch -var testIsMatchCustiomizerFn: (value: any, other: any, indexOrKey: number|string) => boolean; -result = _.isMatch({}, {}); -result = _.isMatch({}, {}, testIsMatchCustiomizerFn); -result = _.isMatch({}, {}, testIsMatchCustiomizerFn, {}); -result = _({}).isMatch({}); -result = _({}).isMatch({}, testIsMatchCustiomizerFn); -result = _({}).isMatch({}, testIsMatchCustiomizerFn, {}); +module TestIsMatch { + let testIsMatchCustiomizerFn: (value: any, other: any, indexOrKey: number|string) => boolean; + + let result: boolean; + + result = _.isMatch({}, {}); + result = _({}).isMatch({}); +} + + +// _.isMatchWith +module TestIsMatchWith { + let testIsMatchCustiomizerFn: (value: any, other: any, indexOrKey: number|string) => boolean; + + let result: boolean; + + result = _.isMatchWith({}, {}, testIsMatchCustiomizerFn); + result = _({}).isMatchWith({}, testIsMatchCustiomizerFn); + +} // _.isNaN module TestIsNaN { diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index a5c8ff5db..76d716126 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -9841,24 +9841,82 @@ declare module _ { interface LoDashStatic { /** - * Performs a deep comparison between object and source to determine if object contains equivalent property - * values. If customizer is provided it’s invoked to compare values. If customizer returns undefined - * comparisons are handled by the method instead. The customizer is bound to thisArg and invoked with three - * arguments: (value, other, index|key). - * @param object The object to inspect. - * @param source The object of property values to match. - * @param customizer The function to customize value comparisons. - * @param thisArg The this binding of customizer. - * @return Returns true if object is a match, else false. + * Performs a deep comparison between `object` and `source` to determine if + * `object` contains equivalent property values. + * + * **Note:** This method supports comparing the same values as `_.isEqual`. + * + * @static + * @memberOf _ + * @category Lang + * @param {Object} object The object to inspect. + * @param {Object} source The object of property values to match. + * @returns {boolean} Returns `true` if `object` is a match, else `false`. + * @example + * + * var object = { 'user': 'fred', 'age': 40 }; + * + * _.isMatch(object, { 'age': 40 }); + * // => true + * + * _.isMatch(object, { 'age': 36 }); + * // => false */ - isMatch(object: Object, source: Object, customizer?: isMatchCustomizer, thisArg?: any): boolean; + isMatch(object: Object, source: Object): boolean; } interface LoDashImplicitObjectWrapper { /** * @see _.isMatch */ - isMatch(source: Object, customizer?: isMatchCustomizer, thisArg?: any): boolean; + isMatch(source: Object): boolean; + } + + //_.isMatchWith + interface isMatchWithCustomizer { + (value: any, other: any, indexOrKey?: number|string): boolean; + } + + interface LoDashStatic { + /** + * This method is like `_.isMatch` except that it accepts `customizer` which + * is invoked to compare values. If `customizer` returns `undefined` comparisons + * are handled by the method instead. The `customizer` is invoked with three + * arguments: (objValue, srcValue, index|key, object, source). + * + * @static + * @memberOf _ + * @category Lang + * @param {Object} object The object to inspect. + * @param {Object} source The object of property values to match. + * @param {Function} [customizer] The function to customize comparisons. + * @returns {boolean} Returns `true` if `object` is a match, else `false`. + * @example + * + * function isGreeting(value) { + * return /^h(?:i|ello)$/.test(value); + * } + * + * function customizer(objValue, srcValue) { + * if (isGreeting(objValue) && isGreeting(srcValue)) { + * return true; + * } + * } + * + * var object = { 'greeting': 'hello' }; + * var source = { 'greeting': 'hi' }; + * + * _.isMatchWith(object, source, customizer); + * // => true + */ + isMatchWith(object: Object, source: Object, customizer: isMatchWithCustomizer): boolean; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.isMatchWith + */ + isMatchWith(source: Object, customizer: isMatchWithCustomizer): boolean; } //_.isNaN From d28a7929bdfee3c0a2db594492747676c3453f78 Mon Sep 17 00:00:00 2001 From: DomiR Date: Fri, 15 Jan 2016 01:58:39 +0100 Subject: [PATCH 38/51] (feature) Add _.isNil --- lodash/lodash-tests.ts | 21 +++++++++++++++++++++ lodash/lodash.d.ts | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 4a0884984..d97800833 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -6151,6 +6151,27 @@ module TestIsNative { } } +// _.isNil +module TestIsNil { + { + let result: boolean; + + result = _.isNil(any); + + result = _(1).isNil(); + result = _([]).isNil(); + result = _({}).isNil(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(1).chain().isNil(); + result = _([]).chain().isNil(); + result = _({}).chain().isNil(); + } +} + // _.isNull module TestIsNull { { diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 76d716126..4c6a30c23 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -9971,6 +9971,44 @@ declare module _ { isNative(): LoDashExplicitWrapper; } + //_.isNil + interface LoDashStatic { + /** + * Checks if `value` is `null` or `undefined`. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is nullish, else `false`. + * @example + * + * _.isNil(null); + * // => true + * + * _.isNil(void 0); + * // => true + * + * _.isNil(NaN); + * // => false + */ + isNil(value?: any): boolean; + } + + interface LoDashImplicitWrapperBase { + /** + * see _.isNil + */ + isNil(): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * see _.isNil + */ + isNil(): LoDashExplicitWrapper; + } + //_.isNull interface LoDashStatic { /** From 9ab4d2254ed373bf174c13c1a4abd5690f31027a Mon Sep 17 00:00:00 2001 From: DomiR Date: Fri, 15 Jan 2016 01:59:49 +0100 Subject: [PATCH 39/51] (feature) Add _.isObjectLike --- lodash/lodash-tests.ts | 20 ++++++++++++++++++++ lodash/lodash.d.ts | 42 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index d97800833..7b2a10356 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -6245,6 +6245,26 @@ module TestIsObject { } } +// _.isObjectLike +module TestIsObjectLike { + { + let result: boolean; + + result = _.isObjectLike(any); + result = _(1).isObjectLike(); + result = _([]).isObjectLike(); + result = _({}).isObjectLike(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(1).chain().isObjectLike(); + result = _([]).chain().isObjectLike(); + result = _({}).chain().isObjectLike(); + } +} + // _.isPlainObject module TestIsPlainObject { { diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 4c6a30c23..aa21e03cd 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -10087,6 +10087,48 @@ declare module _ { isObject(): LoDashExplicitWrapper; } + //_.isObjectLike + interface LoDashStatic { + /** + * Checks if `value` is object-like. A value is object-like if it's not `null` + * and has a `typeof` result of "object". + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is object-like, else `false`. + * @example + * + * _.isObjectLike({}); + * // => true + * + * _.isObjectLike([1, 2, 3]); + * // => true + * + * _.isObjectLike(_.noop); + * // => false + * + * _.isObjectLike(null); + * // => false + */ + isObjectLike(value?: any): boolean; + } + + interface LoDashImplicitWrapperBase { + /** + * see _.isObjectLike + */ + isObjectLike(): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * see _.isObjectLike + */ + isObjectLike(): LoDashExplicitWrapper; + } + //_.isPlainObject interface LoDashStatic { /** From 58f769dda4976ec1b7f1d6ebfb4babb18b1c74a4 Mon Sep 17 00:00:00 2001 From: DomiR Date: Fri, 15 Jan 2016 02:01:36 +0100 Subject: [PATCH 40/51] (feature) Add _.isSafeInteger --- lodash/lodash-tests.ts | 21 ++++++++++++++++++++ lodash/lodash.d.ts | 44 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 7b2a10356..8a14db2d3 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -6316,6 +6316,27 @@ module TestIsRegExp { } } +// _.isSafeInteger +module TestIsSafeInteger { + { + let result: boolean; + + result = _.isSafeInteger(any); + + result = _(1).isSafeInteger(); + result = _([]).isSafeInteger(); + result = _({}).isSafeInteger(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(1).chain().isSafeInteger(); + result = _([]).chain().isSafeInteger(); + result = _({}).chain().isSafeInteger(); + } +} + // _.isString module TestIsString { { diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index aa21e03cd..24bb866a0 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -10182,6 +10182,50 @@ declare module _ { isRegExp(): LoDashExplicitWrapper; } + //_.isSafeInteger + interface LoDashStatic { + /** + * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754 + * double precision number which isn't the result of a rounded unsafe integer. + * + * **Note:** This method is based on [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger). + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`. + * @example + * + * _.isSafeInteger(3); + * // => true + * + * _.isSafeInteger(Number.MIN_VALUE); + * // => false + * + * _.isSafeInteger(Infinity); + * // => false + * + * _.isSafeInteger('3'); + * // => false + */ + isSafeInteger(value: any): boolean; + } + + interface LoDashImplicitWrapperBase { + /** + * see _.isSafeInteger + */ + isSafeInteger(): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * see _.isSafeInteger + */ + isSafeInteger(): LoDashExplicitWrapper; + } + //_.isString interface LoDashStatic { /** From 34a25f6aef4f9b6e921412d89906c4e9fd15f8c1 Mon Sep 17 00:00:00 2001 From: DomiR Date: Fri, 15 Jan 2016 02:04:36 +0100 Subject: [PATCH 41/51] (feature) Add _.isSymbol --- lodash/lodash-tests.ts | 21 +++++++++++++++++++++ lodash/lodash.d.ts | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 8a14db2d3..3a748e852 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -6368,6 +6368,27 @@ module TestIsString { } } +// _.isSymbol +module TestIsSymbol { + { + let result: boolean; + + result = _.isSymbol(any); + + result = _(1).isSymbol(); + result = _([]).isSymbol(); + result = _({}).isSymbol(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(1).chain().isSymbol(); + result = _([]).chain().isSymbol(); + result = _({}).chain().isSymbol(); + } +} + // _.isTypedArray module TestIsTypedArray { { diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 24bb866a0..56b21f99c 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -10251,6 +10251,41 @@ declare module _ { isString(): LoDashExplicitWrapper; } + //_.isSymbol + interface LoDashStatic { + /** + * Checks if `value` is classified as a `Symbol` primitive or object. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @example + * + * _.isSymbol(Symbol.iterator); + * // => true + * + * _.isSymbol('abc'); + * // => false + */ + isSymbol(value: any): boolean; + } + + interface LoDashImplicitWrapperBase { + /** + * see _.isSymbol + */ + isSymbol(): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * see _.isSymbol + */ + isSymbol(): LoDashExplicitWrapper; + } + //_.isTypedArray interface LoDashStatic { /** From 08671c96f7b075d1ef379257778d9d0494a08545 Mon Sep 17 00:00:00 2001 From: DomiR Date: Fri, 15 Jan 2016 02:14:47 +0100 Subject: [PATCH 42/51] (feature) Add _.toInteger --- lodash/lodash-tests.ts | 55 ++++++++++++++++++++++++++++++++---------- lodash/lodash.d.ts | 43 +++++++++++++++++++++++++++++++++ 2 files changed, 85 insertions(+), 13 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 3a748e852..ed64e9179 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -6523,21 +6523,50 @@ module TestToArray { // _.toPlainObject module TestToPlainObject { - let result: TResult; - result = _.toPlainObject(); - result = _.toPlainObject(true); - result = _.toPlainObject(1); - result = _.toPlainObject('a'); - result = _.toPlainObject([]); - result = _.toPlainObject({}); + { + let result: TResult; + result = _.toPlainObject(); + result = _.toPlainObject(true); + result = _.toPlainObject(1); + result = _.toPlainObject('a'); + result = _.toPlainObject([]); + result = _.toPlainObject({}); + } - result = _(true).toPlainObject().value(); - result = _(1).toPlainObject().value(); - result = _('a').toPlainObject().value(); - result = _([1]).toPlainObject().value(); - result = _([]).toPlainObject().value(); - result = _({}).toPlainObject().value(); + { + let result: _.LoDashImplicitObjectWrapper; + + result = _(true).toPlainObject(); + result = _(1).toPlainObject(); + result = _('a').toPlainObject(); + result = _([1]).toPlainObject(); + result = _([]).toPlainObject(); + result = _({}).toPlainObject(); + } +} + +// _.toInteger +module TestToInteger { + { + let result: number; + result = _.toInteger(true); + result = _.toInteger(1); + result = _.toInteger('a'); + result = _.toInteger([]); + result = _.toInteger({}); + } + + { + let result: _.LoDashImplicitWrapper; + + result = _(true).toInteger(); + result = _(1).toInteger(); + result = _('a').toInteger(); + result = _([1]).toInteger(); + result = _([]).toInteger(); + result = _({}).toInteger(); + } } /******** diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 56b21f99c..063ae8522 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -10476,6 +10476,49 @@ declare module _ { toPlainObject(): LoDashImplicitObjectWrapper; } + //_.toInteger + interface LoDashStatic { + /** + * Converts `value` to an integer. + * + * **Note:** This function is loosely based on [`ToInteger`](http://www.ecma-international.org/ecma-262/6.0/#sec-tointeger). + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to convert. + * @returns {number} Returns the converted integer. + * @example + * + * _.toInteger(3); + * // => 3 + * + * _.toInteger(Number.MIN_VALUE); + * // => 0 + * + * _.toInteger(Infinity); + * // => 1.7976931348623157e+308 + * + * _.toInteger('3'); + * // => 3 + */ + toInteger(value: any): number; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.toInteger + */ + toInteger(): LoDashImplicitWrapper; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.toInteger + */ + toInteger(): LoDashExplicitWrapper; + } + /******** * Math * ********/ From a8fe84edcfe0451b26805fc0bc992a9b1a47c386 Mon Sep 17 00:00:00 2001 From: DomiR Date: Fri, 15 Jan 2016 02:33:35 +0100 Subject: [PATCH 43/51] (feature) Add _.toInteger, _.toLength, _.toNumber, _.toSafeInteger --- lodash/lodash-tests.ts | 69 ++++++++++++++++++++++ lodash/lodash.d.ts | 127 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 196 insertions(+) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index ed64e9179..bc33ed1ea 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -6569,6 +6569,75 @@ module TestToInteger { } } +// _.toLength +module TestToLength { + { + let result: number; + result = _.toLength(true); + result = _.toLength(1); + result = _.toLength('a'); + result = _.toLength([]); + result = _.toLength({}); + } + + { + let result: _.LoDashImplicitWrapper; + + result = _(true).toLength(); + result = _(1).toLength(); + result = _('a').toLength(); + result = _([1]).toLength(); + result = _([]).toLength(); + result = _({}).toLength(); + } +} + +// _.toNumber +module TestToNumber { + { + let result: number; + result = _.toNumber(true); + result = _.toNumber(1); + result = _.toNumber('a'); + result = _.toNumber([]); + result = _.toNumber({}); + } + + { + let result: _.LoDashImplicitWrapper; + + result = _(true).toNumber(); + result = _(1).toNumber(); + result = _('a').toNumber(); + result = _([1]).toNumber(); + result = _([]).toNumber(); + result = _({}).toNumber(); + } +} + +// _.toSafeInteger +module TestToSafeInteger { + { + let result: number; + result = _.toSafeInteger(true); + result = _.toSafeInteger(1); + result = _.toSafeInteger('a'); + result = _.toSafeInteger([]); + result = _.toSafeInteger({}); + } + + { + let result: _.LoDashImplicitWrapper; + + result = _(true).toSafeInteger(); + result = _(1).toSafeInteger(); + result = _('a').toSafeInteger(); + result = _([1]).toSafeInteger(); + result = _([]).toSafeInteger(); + result = _({}).toSafeInteger(); + } +} + /******** * Math * ********/ diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 063ae8522..ec40ddac3 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -10519,6 +10519,133 @@ declare module _ { toInteger(): LoDashExplicitWrapper; } + //_.toLength + interface LoDashStatic { + /** + * Converts `value` to an integer suitable for use as the length of an + * array-like object. + * + * **Note:** This method is based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to convert. + * @return {number} Returns the converted integer. + * @example + * + * _.toLength(3); + * // => 3 + * + * _.toLength(Number.MIN_VALUE); + * // => 0 + * + * _.toLength(Infinity); + * // => 4294967295 + * + * _.toLength('3'); + * // => 3 + */ + toLength(value: any): number; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.toLength + */ + toLength(): LoDashImplicitWrapper; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.toLength + */ + toLength(): LoDashExplicitWrapper; + } + + //_.toNumber + interface LoDashStatic { + /** + * Converts `value` to a number. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to process. + * @returns {number} Returns the number. + * @example + * + * _.toNumber(3); + * // => 3 + * + * _.toNumber(Number.MIN_VALUE); + * // => 5e-324 + * + * _.toNumber(Infinity); + * // => Infinity + * + * _.toNumber('3'); + * // => 3 + */ + toNumber(value: any): number; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.toNumber + */ + toNumber(): LoDashImplicitWrapper; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.toNumber + */ + toNumber(): LoDashExplicitWrapper; + } + + //_.toSafeInteger + interface LoDashStatic { + /** + * Converts `value` to a safe integer. A safe integer can be compared and + * represented correctly. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to convert. + * @returns {number} Returns the converted integer. + * @example + * + * _.toSafeInteger(3); + * // => 3 + * + * _.toSafeInteger(Number.MIN_VALUE); + * // => 0 + * + * _.toSafeInteger(Infinity); + * // => 9007199254740991 + * + * _.toSafeInteger('3'); + * // => 3 + */ + toSafeInteger(value: any): number; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.toSafeInteger + */ + toSafeInteger(): LoDashImplicitWrapper; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.toSafeInteger + */ + toSafeInteger(): LoDashExplicitWrapper; + } + /******** * Math * ********/ From 8807088ee7f3adfce36eb9da9d9d8ec61423c85b Mon Sep 17 00:00:00 2001 From: DomiR Date: Fri, 15 Jan 2016 02:49:45 +0100 Subject: [PATCH 44/51] (feature) Add _.assign and _.assignWith --- lodash/lodash-tests.ts | 142 +++++++++++++++---- lodash/lodash.d.ts | 304 ++++++++++++++++++++++++++++++++--------- 2 files changed, 351 insertions(+), 95 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index bc33ed1ea..deb05249e 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -7051,40 +7051,30 @@ module TestAssign { let result: {a: number}; result = _.assign(obj, s1); - result = _.assign(obj, s1, customizer); - result = _.assign(obj, s1, customizer, any); } { let result: {a: number, b: number}; result = _.assign(obj, s1, s2); - result = _.assign(obj, s1, s2, customizer); - result = _.assign(obj, s1, s2, customizer, any); } { let result: {a: number, b: number, c: number}; result = _.assign(obj, s1, s2, s3); - result = _.assign(obj, s1, s2, s3, customizer); - result = _.assign(obj, s1, s2, s3, customizer, any); } { let result: {a: number, b: number, c: number, d: number}; result = _.assign(obj, s1, s2, s3, s4); - result = _.assign(obj, s1, s2, s3, s4, customizer); - result = _.assign(obj, s1, s2, s3, s4, customizer, any); } { let result: {a: number, b: number, c: number, d: number, e: number}; result = _.assign(obj, s1, s2, s3, s4, s5); - result = _.assign(obj, s1, s2, s3, s4, s5, customizer); - result = _.assign(obj, s1, s2, s3, s4, s5, customizer, any); } { @@ -7097,40 +7087,30 @@ module TestAssign { let result: _.LoDashImplicitObjectWrapper<{a: number}>; result = _(obj).assign(s1); - result = _(obj).assign(s1, customizer); - result = _(obj).assign(s1, customizer, any); } { let result: _.LoDashImplicitObjectWrapper<{a: number, b: number}>; result = _(obj).assign(s1, s2); - result = _(obj).assign(s1, s2, customizer); - result = _(obj).assign(s1, s2, customizer, any); } { let result: _.LoDashImplicitObjectWrapper<{a: number, b: number, c: number}>; result = _(obj).assign(s1, s2, s3); - result = _(obj).assign(s1, s2, s3, customizer); - result = _(obj).assign(s1, s2, s3, customizer, any); } { let result: _.LoDashImplicitObjectWrapper<{a: number, b: number, c: number, d: number}>; result = _(obj).assign(s1, s2, s3, s4); - result = _(obj).assign(s1, s2, s3, s4, customizer); - result = _(obj).assign(s1, s2, s3, s4, customizer, any); } { let result: _.LoDashImplicitObjectWrapper<{a: number, b: number, c: number, d: number, e: number}>; result = _(obj).assign<{a: number, b: number, c: number, d: number, e: number}>(s1, s2, s3, s4, s5); - result = _(obj).assign<{a: number, b: number, c: number, d: number, e: number}>(s1, s2, s3, s4, s5, customizer); - result = _(obj).assign<{a: number, b: number, c: number, d: number, e: number}>(s1, s2, s3, s4, s5, customizer, any); } { @@ -7143,40 +7123,142 @@ module TestAssign { let result: _.LoDashExplicitObjectWrapper<{a: number}>; result = _(obj).chain().assign(s1); - result = _(obj).chain().assign(s1, customizer); - result = _(obj).chain().assign(s1, customizer, any); } { let result: _.LoDashExplicitObjectWrapper<{a: number, b: number}>; result = _(obj).chain().assign(s1, s2); - result = _(obj).chain().assign(s1, s2, customizer); - result = _(obj).chain().assign(s1, s2, customizer, any); } { let result: _.LoDashExplicitObjectWrapper<{a: number, b: number, c: number}>; result = _(obj).chain().assign(s1, s2, s3); - result = _(obj).chain().assign(s1, s2, s3, customizer); - result = _(obj).chain().assign(s1, s2, s3, customizer, any); } { let result: _.LoDashExplicitObjectWrapper<{a: number, b: number, c: number, d: number}>; result = _(obj).chain().assign(s1, s2, s3, s4); - result = _(obj).chain().assign(s1, s2, s3, s4, customizer); - result = _(obj).chain().assign(s1, s2, s3, s4, customizer, any); } { let result: _.LoDashExplicitObjectWrapper<{a: number, b: number, c: number, d: number, e: number}>; result = _(obj).chain().assign<{a: number, b: number, c: number, d: number, e: number}>(s1, s2, s3, s4, s5); - result = _(obj).chain().assign<{a: number, b: number, c: number, d: number, e: number}>(s1, s2, s3, s4, s5, customizer); - result = _(obj).chain().assign<{a: number, b: number, c: number, d: number, e: number}>(s1, s2, s3, s4, s5, customizer, any); + } +} + +// _.assignWith +module TestAssignWith { + interface Obj {a: string}; + interface S1 {a: number}; + interface S2 {b: number}; + interface S3 {c: number}; + interface S4 {d: number}; + interface S5 {e: number}; + + let obj: Obj; + let s1: S1; + let s2: S2; + let s3: S3; + let s4: S4; + let s5: S5; + + let customizer: (objectValue: any, sourceValue: any, key?: string, object?: {}, source?: {}) => any; + + { + let result: Obj; + + result = _.assignWith(obj); + } + + { + let result: {a: number}; + result = _.assignWith(obj, s1, customizer); + } + + { + let result: {a: number, b: number}; + result = _.assignWith(obj, s1, s2, customizer); + } + + { + let result: {a: number, b: number, c: number}; + result = _.assignWith(obj, s1, s2, s3, customizer); + } + + { + let result: {a: number, b: number, c: number, d: number}; + result = _.assignWith(obj, s1, s2, s3, s4, customizer); + } + + { + let result: {a: number, b: number, c: number, d: number, e: number}; + result = _.assignWith(obj, s1, s2, s3, s4, s5, customizer); + } + + { + let result: _.LoDashImplicitObjectWrapper; + + result = _(obj).assignWith(); + } + + { + let result: _.LoDashImplicitObjectWrapper<{a: number}>; + result = _(obj).assignWith(s1, customizer); + } + + { + let result: _.LoDashImplicitObjectWrapper<{a: number, b: number}>; + result = _(obj).assignWith(s1, s2, customizer); + } + + { + let result: _.LoDashImplicitObjectWrapper<{a: number, b: number, c: number}>; + result = _(obj).assignWith(s1, s2, s3, customizer); + } + + { + let result: _.LoDashImplicitObjectWrapper<{a: number, b: number, c: number, d: number}>; + result = _(obj).assignWith(s1, s2, s3, s4, customizer); + } + + { + let result: _.LoDashImplicitObjectWrapper<{a: number, b: number, c: number, d: number, e: number}>; + result = _(obj).assignWith<{a: number, b: number, c: number, d: number, e: number}>(s1, s2, s3, s4, s5, customizer); + } + + { + let result: _.LoDashExplicitObjectWrapper; + + result = _(obj).chain().assignWith(); + } + + { + let result: _.LoDashExplicitObjectWrapper<{a: number}>; + result = _(obj).chain().assignWith(s1, customizer); + } + + { + let result: _.LoDashExplicitObjectWrapper<{a: number, b: number}>; + result = _(obj).chain().assignWith(s1, s2, customizer); + } + + { + let result: _.LoDashExplicitObjectWrapper<{a: number, b: number, c: number}>; + result = _(obj).chain().assignWith(s1, s2, s3, customizer); + } + + { + let result: _.LoDashExplicitObjectWrapper<{a: number, b: number, c: number, d: number}>; + result = _(obj).chain().assignWith(s1, s2, s3, s4, customizer); + } + + { + let result: _.LoDashExplicitObjectWrapper<{a: number, b: number, c: number, d: number, e: number}>; + result = _(obj).chain().assignWith<{a: number, b: number, c: number, d: number, e: number}>(s1, s2, s3, s4, s5, customizer); } } diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index ec40ddac3..7c6a46754 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -81,21 +81,21 @@ added 23 array methods: added 18 lang methods: - [x] _.cloneDeepWith - [x] _.cloneWith -- [ ] _.eq +- [x] _.eq - [x] _.isArrayLike - [x] _.isArrayLikeObject - [x] _.isEqualWith -- [ ] _.isInteger -- [ ] _.isLength -- [ ] _.isMatchWith -- [ ] _.isNil -- [ ] _.isObjectLike -- [ ] _.isSafeInteger -- [ ] _.isSymbol -- [ ] _.toInteger -- [ ] _.toLength -- [ ] _.toNumber -- [ ] _.toSafeInteger +- [x] _.isInteger +- [x] _.isLength +- [x] _.isMatchWith +- [x] _.isNil +- [x] _.isObjectLike +- [x] _.isSafeInteger +- [x] _.isSymbol +- [x] _.toInteger +- [x] _.toLength +- [x] _.toNumber +- [x] _.toSafeInteger - [ ] _.toString added 13 object methods: @@ -106,8 +106,8 @@ added 13 object methods: - [ ] _.hasIn - [ ] _.invoke - [ ] _.mergeWith -- [ ] _.omitBy -- [ ] _.pickBy +- [x] _.omitBy +- [x] _.pickBy - [ ] _.setWith - [ ] _.toPairs - [ ] _.toPairsIn @@ -11472,32 +11472,40 @@ declare module _ { **********/ //_.assign - interface AssignCustomizer { - (objectValue: any, sourceValue: any, key?: string, object?: {}, source?: {}): any; - } - interface LoDashStatic { /** - * Assigns own enumerable properties of source object(s) to the destination object. Subsequent sources - * overwrite property assignments of previous sources. If customizer is provided it’s invoked to produce the - * assigned values. The customizer is bound to thisArg and invoked with five arguments: - * (objectValue, sourceValue, key, object, source). + * Assigns own enumerable properties of source objects to the destination + * object. Source objects are applied from left to right. Subsequent sources + * overwrite property assignments of previous sources. * - * Note: This method mutates object and is based on Object.assign. + * **Note:** This method mutates `object` and is loosely based on + * [`Object.assign`](https://mdn.io/Object/assign). * - * @alias _.extend + * @static + * @memberOf _ + * @category Object + * @param {Object} object The destination object. + * @param {...Object} [sources] The source objects. + * @returns {Object} Returns `object`. + * @example * - * @param object The destination object. - * @param source The source objects. - * @param customizer The function to customize assigned values. - * @param thisArg The this binding of callback. - * @return The destination object. + * function Foo() { + * this.c = 3; + * } + * + * function Bar() { + * this.e = 5; + * } + * + * Foo.prototype.d = 4; + * Bar.prototype.f = 6; + * + * _.assign({ 'a': 1 }, new Foo, new Bar); + * // => { 'a': 1, 'c': 3, 'e': 5 } */ assign( object: TObject, - source: TSource, - customizer?: AssignCustomizer, - thisArg?: any + source: TSource ): TResult; /** @@ -11506,9 +11514,7 @@ declare module _ { assign( object: TObject, source1: TSource1, - source2: TSource2, - customizer?: AssignCustomizer, - thisArg?: any + source2: TSource2 ): TResult; /** @@ -11518,9 +11524,7 @@ declare module _ { object: TObject, source1: TSource1, source2: TSource2, - source3: TSource3, - customizer?: AssignCustomizer, - thisArg?: any + source3: TSource3 ): TResult; /** @@ -11533,9 +11537,7 @@ declare module _ { source1: TSource1, source2: TSource2, source3: TSource3, - source4: TSource4, - customizer?: AssignCustomizer, - thisArg?: any + source4: TSource4 ): TResult; /** @@ -11556,9 +11558,7 @@ declare module _ { * @see _.assign */ assign( - source: TSource, - customizer?: AssignCustomizer, - thisArg?: any + source: TSource ): LoDashImplicitObjectWrapper; /** @@ -11566,9 +11566,7 @@ declare module _ { */ assign( source1: TSource1, - source2: TSource2, - customizer?: AssignCustomizer, - thisArg?: any + source2: TSource2 ): LoDashImplicitObjectWrapper; /** @@ -11577,9 +11575,7 @@ declare module _ { assign( source1: TSource1, source2: TSource2, - source3: TSource3, - customizer?: AssignCustomizer, - thisArg?: any + source3: TSource3 ): LoDashImplicitObjectWrapper; /** @@ -11589,9 +11585,7 @@ declare module _ { source1: TSource1, source2: TSource2, source3: TSource3, - source4: TSource4, - customizer?: AssignCustomizer, - thisArg?: any + source4: TSource4 ): LoDashImplicitObjectWrapper; /** @@ -11610,9 +11604,7 @@ declare module _ { * @see _.assign */ assign( - source: TSource, - customizer?: AssignCustomizer, - thisArg?: any + source: TSource ): LoDashExplicitObjectWrapper; /** @@ -11620,9 +11612,7 @@ declare module _ { */ assign( source1: TSource1, - source2: TSource2, - customizer?: AssignCustomizer, - thisArg?: any + source2: TSource2 ): LoDashExplicitObjectWrapper; /** @@ -11631,9 +11621,7 @@ declare module _ { assign( source1: TSource1, source2: TSource2, - source3: TSource3, - customizer?: AssignCustomizer, - thisArg?: any + source3: TSource3 ): LoDashExplicitObjectWrapper; /** @@ -11643,9 +11631,7 @@ declare module _ { source1: TSource1, source2: TSource2, source3: TSource3, - source4: TSource4, - customizer?: AssignCustomizer, - thisArg?: any + source4: TSource4 ): LoDashExplicitObjectWrapper; /** @@ -11659,6 +11645,194 @@ declare module _ { assign(...otherArgs: any[]): LoDashExplicitObjectWrapper; } + //_.assignWith + interface AssignCustomizer { + (objectValue: any, sourceValue: any, key?: string, object?: {}, source?: {}): any; + } + + interface LoDashStatic { + /** + * This method is like `_.assign` except that it accepts `customizer` which + * is invoked to produce the assigned values. If `customizer` returns `undefined` + * assignment is handled by the method instead. The `customizer` is invoked + * with five arguments: (objValue, srcValue, key, object, source). + * + * **Note:** This method mutates `object`. + * + * @static + * @memberOf _ + * @category Object + * @param {Object} object The destination object. + * @param {...Object} sources The source objects. + * @param {Function} [customizer] The function to customize assigned values. + * @returns {Object} Returns `object`. + * @example + * + * function customizer(objValue, srcValue) { + * return _.isUndefined(objValue) ? srcValue : objValue; + * } + * + * var defaults = _.partialRight(_.assignWith, customizer); + * + * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); + * // => { 'a': 1, 'b': 2 } + */ + assignWith( + object: TObject, + source: TSource, + customizer: AssignCustomizer + ): TResult; + + /** + * @see assignWith + */ + assignWith( + object: TObject, + source1: TSource1, + source2: TSource2, + customizer: AssignCustomizer + ): TResult; + + /** + * @see assignWith + */ + assignWith( + object: TObject, + source1: TSource1, + source2: TSource2, + source3: TSource3, + customizer: AssignCustomizer + ): TResult; + + /** + * @see assignWith + */ + assignWith + ( + object: TObject, + source1: TSource1, + source2: TSource2, + source3: TSource3, + source4: TSource4, + customizer: AssignCustomizer + ): TResult; + + /** + * @see _.assignWith + */ + assignWith(object: TObject): TObject; + + /** + * @see _.assignWith + */ + assignWith( + object: TObject, ...otherArgs: any[] + ): TResult; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.assignWith + */ + assignWith( + source: TSource, + customizer: AssignCustomizer + ): LoDashImplicitObjectWrapper; + + /** + * @see assignWith + */ + assignWith( + source1: TSource1, + source2: TSource2, + customizer: AssignCustomizer + ): LoDashImplicitObjectWrapper; + + /** + * @see assignWith + */ + assignWith( + source1: TSource1, + source2: TSource2, + source3: TSource3, + customizer: AssignCustomizer + ): LoDashImplicitObjectWrapper; + + /** + * @see assignWith + */ + assignWith( + source1: TSource1, + source2: TSource2, + source3: TSource3, + source4: TSource4, + customizer: AssignCustomizer + ): LoDashImplicitObjectWrapper; + + /** + * @see _.assignWith + */ + assignWith(): LoDashImplicitObjectWrapper; + + /** + * @see _.assignWith + */ + assignWith(...otherArgs: any[]): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.assignWith + */ + assignWith( + source: TSource, + customizer: AssignCustomizer + ): LoDashExplicitObjectWrapper; + + /** + * @see assignWith + */ + assignWith( + source1: TSource1, + source2: TSource2, + customizer: AssignCustomizer + ): LoDashExplicitObjectWrapper; + + /** + * @see assignWith + */ + assignWith( + source1: TSource1, + source2: TSource2, + source3: TSource3, + customizer: AssignCustomizer + ): LoDashExplicitObjectWrapper; + + /** + * @see assignWith + */ + assignWith( + source1: TSource1, + source2: TSource2, + source3: TSource3, + source4: TSource4, + customizer: AssignCustomizer + ): LoDashExplicitObjectWrapper; + + /** + * @see _.assignWith + */ + assignWith(): LoDashExplicitObjectWrapper; + + /** + * @see _.assignWith + */ + assignWith(...otherArgs: any[]): LoDashExplicitObjectWrapper; + } + + + //_.create interface LoDashStatic { /** From 75401b033629cf7894efd7322d59fd5cb9c401de Mon Sep 17 00:00:00 2001 From: DomiR Date: Fri, 15 Jan 2016 02:51:51 +0100 Subject: [PATCH 45/51] (feature) Add _.assignIn and _.assignInWith --- lodash/lodash-tests.ts | 239 +++++++++++++++++++++++++++ lodash/lodash.d.ts | 358 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 597 insertions(+) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index deb05249e..01aedc432 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -7262,6 +7262,245 @@ module TestAssignWith { } } +// _.assignIn +module TestAssignIn { + interface Obj {a: string}; + interface S1 {a: number}; + interface S2 {b: number}; + interface S3 {c: number}; + interface S4 {d: number}; + interface S5 {e: number}; + + let obj: Obj; + let s1: S1; + let s2: S2; + let s3: S3; + let s4: S4; + let s5: S5; + + let customizer: (objectValue: any, sourceValue: any, key?: string, object?: {}, source?: {}) => any; + + { + let result: Obj; + + result = _.assignIn(obj); + } + + { + let result: {a: number}; + + result = _.assignIn(obj, s1); + } + + { + let result: {a: number, b: number}; + + result = _.assignIn(obj, s1, s2); + } + + { + let result: {a: number, b: number, c: number}; + + result = _.assignIn(obj, s1, s2, s3); + } + + { + let result: {a: number, b: number, c: number, d: number}; + + result = _.assignIn(obj, s1, s2, s3, s4); + } + + { + let result: {a: number, b: number, c: number, d: number, e: number}; + + result = _.assignIn(obj, s1, s2, s3, s4, s5); + } + + { + let result: _.LoDashImplicitObjectWrapper; + + result = _(obj).assignIn(); + } + + { + let result: _.LoDashImplicitObjectWrapper<{a: number}>; + + result = _(obj).assignIn(s1); + } + + { + let result: _.LoDashImplicitObjectWrapper<{a: number, b: number}>; + + result = _(obj).assignIn(s1, s2); + } + + { + let result: _.LoDashImplicitObjectWrapper<{a: number, b: number, c: number}>; + + result = _(obj).assignIn(s1, s2, s3); + } + + { + let result: _.LoDashImplicitObjectWrapper<{a: number, b: number, c: number, d: number}>; + + result = _(obj).assignIn(s1, s2, s3, s4); + } + + { + let result: _.LoDashImplicitObjectWrapper<{a: number, b: number, c: number, d: number, e: number}>; + + result = _(obj).assignIn<{a: number, b: number, c: number, d: number, e: number}>(s1, s2, s3, s4, s5); + } + + { + let result: _.LoDashExplicitObjectWrapper; + + result = _(obj).chain().assignIn(); + } + + { + let result: _.LoDashExplicitObjectWrapper<{a: number}>; + + result = _(obj).chain().assignIn(s1); + } + + { + let result: _.LoDashExplicitObjectWrapper<{a: number, b: number}>; + + result = _(obj).chain().assignIn(s1, s2); + } + + { + let result: _.LoDashExplicitObjectWrapper<{a: number, b: number, c: number}>; + + result = _(obj).chain().assignIn(s1, s2, s3); + } + + { + let result: _.LoDashExplicitObjectWrapper<{a: number, b: number, c: number, d: number}>; + + result = _(obj).chain().assignIn(s1, s2, s3, s4); + } + + { + let result: _.LoDashExplicitObjectWrapper<{a: number, b: number, c: number, d: number, e: number}>; + + result = _(obj).chain().assignIn<{a: number, b: number, c: number, d: number, e: number}>(s1, s2, s3, s4, s5); + } +} + +// _.assignInWith +module TestAssignInWith { + interface Obj {a: string}; + interface S1 {a: number}; + interface S2 {b: number}; + interface S3 {c: number}; + interface S4 {d: number}; + interface S5 {e: number}; + + let obj: Obj; + let s1: S1; + let s2: S2; + let s3: S3; + let s4: S4; + let s5: S5; + + let customizer: (objectValue: any, sourceValue: any, key?: string, object?: {}, source?: {}) => any; + + { + let result: Obj; + + result = _.assignInWith(obj); + } + + { + let result: {a: number}; + result = _.assignInWith(obj, s1, customizer); + } + + { + let result: {a: number, b: number}; + result = _.assignInWith(obj, s1, s2, customizer); + } + + { + let result: {a: number, b: number, c: number}; + result = _.assignInWith(obj, s1, s2, s3, customizer); + } + + { + let result: {a: number, b: number, c: number, d: number}; + result = _.assignInWith(obj, s1, s2, s3, s4, customizer); + } + + { + let result: {a: number, b: number, c: number, d: number, e: number}; + result = _.assignInWith(obj, s1, s2, s3, s4, s5, customizer); + } + + { + let result: _.LoDashImplicitObjectWrapper; + + result = _(obj).assignInWith(); + } + + { + let result: _.LoDashImplicitObjectWrapper<{a: number}>; + result = _(obj).assignInWith(s1, customizer); + } + + { + let result: _.LoDashImplicitObjectWrapper<{a: number, b: number}>; + result = _(obj).assignInWith(s1, s2, customizer); + } + + { + let result: _.LoDashImplicitObjectWrapper<{a: number, b: number, c: number}>; + result = _(obj).assignInWith(s1, s2, s3, customizer); + } + + { + let result: _.LoDashImplicitObjectWrapper<{a: number, b: number, c: number, d: number}>; + result = _(obj).assignInWith(s1, s2, s3, s4, customizer); + } + + { + let result: _.LoDashImplicitObjectWrapper<{a: number, b: number, c: number, d: number, e: number}>; + result = _(obj).assignInWith<{a: number, b: number, c: number, d: number, e: number}>(s1, s2, s3, s4, s5, customizer); + } + + { + let result: _.LoDashExplicitObjectWrapper; + + result = _(obj).chain().assignInWith(); + } + + { + let result: _.LoDashExplicitObjectWrapper<{a: number}>; + result = _(obj).chain().assignInWith(s1, customizer); + } + + { + let result: _.LoDashExplicitObjectWrapper<{a: number, b: number}>; + result = _(obj).chain().assignInWith(s1, s2, customizer); + } + + { + let result: _.LoDashExplicitObjectWrapper<{a: number, b: number, c: number}>; + result = _(obj).chain().assignInWith(s1, s2, s3, customizer); + } + + { + let result: _.LoDashExplicitObjectWrapper<{a: number, b: number, c: number, d: number}>; + result = _(obj).chain().assignInWith(s1, s2, s3, s4, customizer); + } + + { + let result: _.LoDashExplicitObjectWrapper<{a: number, b: number, c: number, d: number, e: number}>; + result = _(obj).chain().assignInWith<{a: number, b: number, c: number, d: number, e: number}>(s1, s2, s3, s4, s5, customizer); + } +} + // _.create module TestCreate { type SampleProto = {a: number}; diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 7c6a46754..3f596a202 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -11831,7 +11831,365 @@ declare module _ { assignWith(...otherArgs: any[]): LoDashExplicitObjectWrapper; } + //_.assignIn + interface LoDashStatic { + /** + * This method is like `_.assign` except that it iterates over own and + * inherited source properties. + * + * **Note:** This method mutates `object`. + * + * @static + * @memberOf _ + * @alias extend + * @category Object + * @param {Object} object The destination object. + * @param {...Object} [sources] The source objects. + * @returns {Object} Returns `object`. + * @example + * + * function Foo() { + * this.b = 2; + * } + * + * function Bar() { + * this.d = 4; + * } + * + * Foo.prototype.c = 3; + * Bar.prototype.e = 5; + * + * _.assignIn({ 'a': 1 }, new Foo, new Bar); + * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5 } + */ + assignIn( + object: TObject, + source: TSource + ): TResult; + /** + * @see assignIn + */ + assignIn( + object: TObject, + source1: TSource1, + source2: TSource2 + ): TResult; + + /** + * @see assignIn + */ + assignIn( + object: TObject, + source1: TSource1, + source2: TSource2, + source3: TSource3 + ): TResult; + + /** + * @see assignIn + */ + assignIn + ( + object: TObject, + source1: TSource1, + source2: TSource2, + source3: TSource3, + source4: TSource4 + ): TResult; + + /** + * @see _.assignIn + */ + assignIn(object: TObject): TObject; + + /** + * @see _.assignIn + */ + assignIn( + object: TObject, ...otherArgs: any[] + ): TResult; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.assignIn + */ + assignIn( + source: TSource + ): LoDashImplicitObjectWrapper; + + /** + * @see assignIn + */ + assignIn( + source1: TSource1, + source2: TSource2 + ): LoDashImplicitObjectWrapper; + + /** + * @see assignIn + */ + assignIn( + source1: TSource1, + source2: TSource2, + source3: TSource3 + ): LoDashImplicitObjectWrapper; + + /** + * @see assignIn + */ + assignIn( + source1: TSource1, + source2: TSource2, + source3: TSource3, + source4: TSource4 + ): LoDashImplicitObjectWrapper; + + /** + * @see _.assignIn + */ + assignIn(): LoDashImplicitObjectWrapper; + + /** + * @see _.assignIn + */ + assignIn(...otherArgs: any[]): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.assignIn + */ + assignIn( + source: TSource + ): LoDashExplicitObjectWrapper; + + /** + * @see assignIn + */ + assignIn( + source1: TSource1, + source2: TSource2 + ): LoDashExplicitObjectWrapper; + + /** + * @see assignIn + */ + assignIn( + source1: TSource1, + source2: TSource2, + source3: TSource3 + ): LoDashExplicitObjectWrapper; + + /** + * @see assignIn + */ + assignIn( + source1: TSource1, + source2: TSource2, + source3: TSource3, + source4: TSource4 + ): LoDashExplicitObjectWrapper; + + /** + * @see _.assignIn + */ + assignIn(): LoDashExplicitObjectWrapper; + + /** + * @see _.assignIn + */ + assignIn(...otherArgs: any[]): LoDashExplicitObjectWrapper; + } + + //_.assignInWith + interface AssignCustomizer { + (objectValue: any, sourceValue: any, key?: string, object?: {}, source?: {}): any; + } + + interface LoDashStatic { + /** + * This method is like `_.assignIn` except that it accepts `customizer` which + * is invoked to produce the assigned values. If `customizer` returns `undefined` + * assignment is handled by the method instead. The `customizer` is invoked + * with five arguments: (objValue, srcValue, key, object, source). + * + * **Note:** This method mutates `object`. + * + * @static + * @memberOf _ + * @alias extendWith + * @category Object + * @param {Object} object The destination object. + * @param {...Object} sources The source objects. + * @param {Function} [customizer] The function to customize assigned values. + * @returns {Object} Returns `object`. + * @example + * + * function customizer(objValue, srcValue) { + * return _.isUndefined(objValue) ? srcValue : objValue; + * } + * + * var defaults = _.partialRight(_.assignInWith, customizer); + * + * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); + * // => { 'a': 1, 'b': 2 } + */ + assignInWith( + object: TObject, + source: TSource, + customizer: AssignCustomizer + ): TResult; + + /** + * @see assignInWith + */ + assignInWith( + object: TObject, + source1: TSource1, + source2: TSource2, + customizer: AssignCustomizer + ): TResult; + + /** + * @see assignInWith + */ + assignInWith( + object: TObject, + source1: TSource1, + source2: TSource2, + source3: TSource3, + customizer: AssignCustomizer + ): TResult; + + /** + * @see assignInWith + */ + assignInWith + ( + object: TObject, + source1: TSource1, + source2: TSource2, + source3: TSource3, + source4: TSource4, + customizer: AssignCustomizer + ): TResult; + + /** + * @see _.assignInWith + */ + assignInWith(object: TObject): TObject; + + /** + * @see _.assignInWith + */ + assignInWith( + object: TObject, ...otherArgs: any[] + ): TResult; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.assignInWith + */ + assignInWith( + source: TSource, + customizer: AssignCustomizer + ): LoDashImplicitObjectWrapper; + + /** + * @see assignInWith + */ + assignInWith( + source1: TSource1, + source2: TSource2, + customizer: AssignCustomizer + ): LoDashImplicitObjectWrapper; + + /** + * @see assignInWith + */ + assignInWith( + source1: TSource1, + source2: TSource2, + source3: TSource3, + customizer: AssignCustomizer + ): LoDashImplicitObjectWrapper; + + /** + * @see assignInWith + */ + assignInWith( + source1: TSource1, + source2: TSource2, + source3: TSource3, + source4: TSource4, + customizer: AssignCustomizer + ): LoDashImplicitObjectWrapper; + + /** + * @see _.assignInWith + */ + assignInWith(): LoDashImplicitObjectWrapper; + + /** + * @see _.assignInWith + */ + assignInWith(...otherArgs: any[]): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.assignInWith + */ + assignInWith( + source: TSource, + customizer: AssignCustomizer + ): LoDashExplicitObjectWrapper; + + /** + * @see assignInWith + */ + assignInWith( + source1: TSource1, + source2: TSource2, + customizer: AssignCustomizer + ): LoDashExplicitObjectWrapper; + + /** + * @see assignInWith + */ + assignInWith( + source1: TSource1, + source2: TSource2, + source3: TSource3, + customizer: AssignCustomizer + ): LoDashExplicitObjectWrapper; + + /** + * @see assignInWith + */ + assignInWith( + source1: TSource1, + source2: TSource2, + source3: TSource3, + source4: TSource4, + customizer: AssignCustomizer + ): LoDashExplicitObjectWrapper; + + /** + * @see _.assignInWith + */ + assignInWith(): LoDashExplicitObjectWrapper; + + /** + * @see _.assignInWith + */ + assignInWith(...otherArgs: any[]): LoDashExplicitObjectWrapper; + } //_.create interface LoDashStatic { From b89bde3df995f59b9d67c09187f4074f1cd99cc2 Mon Sep 17 00:00:00 2001 From: DomiR Date: Fri, 15 Jan 2016 02:53:24 +0100 Subject: [PATCH 46/51] (feature) Add _.functionsIn --- lodash/lodash-tests.ts | 25 ++++++++++++++++ lodash/lodash.d.ts | 67 ++++++++++++++++++++++++++++++++++++++---- 2 files changed, 86 insertions(+), 6 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 01aedc432..7db984bcc 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -8152,6 +8152,31 @@ module TestFunctions { } } +// _.functionsIn +module TestFunctionsIn { + type SampleObject = {a: number; b: string; c: boolean;}; + + let object: SampleObject; + + { + let result: string[]; + + result = _.functionsIn(object); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(object).functionsIn(); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(object).chain().functionsIn(); + } +} + // _.get result = _.get({ 'a': [{ 'b': { 'c': 3 } }] }, 'a[0].b.c'); diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 3f596a202..e27022b9c 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -99,9 +99,9 @@ added 18 lang methods: - [ ] _.toString added 13 object methods: -- [ ] _.assignIn -- [ ] _.assignInWith -- [ ] _.assignWith +- [x] _.assignIn +- [x] _.assignInWith +- [x] _.assignWith - [ ] _.functionsIn - [ ] _.hasIn - [ ] _.invoke @@ -13009,10 +13009,25 @@ declare module _ { //_.functions interface LoDashStatic { /** - * Creates an array of function property names from all enumerable properties, own and inherited, of object. + * Creates an array of function property names from own enumerable properties + * of `object`. * - * @param object The object to inspect. - * @return Returns the new array of property names. + * @static + * @memberOf _ + * @category Object + * @param {Object} object The object to inspect. + * @returns {Array} Returns the new array of property names. + * @example + * + * function Foo() { + * this.a = _.constant('a'); + * this.b = _.constant('b'); + * } + * + * Foo.prototype.c = _.constant('c'); + * + * _.functions(new Foo); + * // => ['a', 'b'] */ functions(object: any): string[]; } @@ -13031,6 +13046,46 @@ declare module _ { functions(): _.LoDashExplicitArrayWrapper; } + //_.functionsIn + interface LoDashStatic { + /** + * Creates an array of function property names from own and inherited + * enumerable properties of `object`. + * + * @static + * @memberOf _ + * @category Object + * @param {Object} object The object to inspect. + * @returns {Array} Returns the new array of property names. + * @example + * + * function Foo() { + * this.a = _.constant('a'); + * this.b = _.constant('b'); + * } + * + * Foo.prototype.c = _.constant('c'); + * + * _.functionsIn(new Foo); + * // => ['a', 'b', 'c'] + */ + functionsIn(object: any): string[]; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.functionsIn + */ + functionsIn(): _.LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.functionsIn + */ + functionsIn(): _.LoDashExplicitArrayWrapper; + } + //_.get interface LoDashStatic { /** From 242f39f73508ec72ade4e7144b142c2d66dbabe8 Mon Sep 17 00:00:00 2001 From: DomiR Date: Fri, 15 Jan 2016 02:55:49 +0100 Subject: [PATCH 47/51] (feature) Add _.hasIn --- lodash/lodash-tests.ts | 30 ++++++++++++++++ lodash/lodash.d.ts | 78 ++++++++++++++++++++++++++++++++++++++---- 2 files changed, 102 insertions(+), 6 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 7db984bcc..2e95b756d 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -8222,6 +8222,36 @@ module TestHas { } } +// _.hasIn +module TestHasIn { + type SampleObject = {a: number; b: string; c: boolean;}; + + let object: SampleObject; + + { + let result: boolean; + + result = _.hasIn(object, ''); + result = _.hasIn(object, 42); + result = _.hasIn(object, true); + result = _.hasIn(object, ['', 42, true]); + + result = _(object).hasIn(''); + result = _(object).hasIn(42); + result = _(object).hasIn(true); + result = _(object).hasIn(['', 42, true]); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(object).chain().hasIn(''); + result = _(object).chain().hasIn(42); + result = _(object).chain().hasIn(true); + result = _(object).chain().hasIn(['', 42, true]); + } +} + // _.invert module TestInvert { { diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index e27022b9c..14b0f7246 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -102,8 +102,8 @@ added 13 object methods: - [x] _.assignIn - [x] _.assignInWith - [x] _.assignWith -- [ ] _.functionsIn -- [ ] _.hasIn +- [x] _.functionsIn +- [x] _.hasIn - [ ] _.invoke - [ ] _.mergeWith - [x] _.omitBy @@ -13114,11 +13114,30 @@ declare module _ { //_.has interface LoDashStatic { /** - * Checks if path is a direct property. + * Checks if `path` is a direct property of `object`. * - * @param object The object to query. - * @param path The path to check. - * @return Returns true if path is a direct property, else false. + * @static + * @memberOf _ + * @category Object + * @param {Object} object The object to query. + * @param {Array|string} path The path to check. + * @returns {boolean} Returns `true` if `path` exists, else `false`. + * @example + * + * var object = { 'a': { 'b': { 'c': 3 } } }; + * var other = _.create({ 'a': _.create({ 'b': _.create({ 'c': 3 }) }) }); + * + * _.has(object, 'a'); + * // => true + * + * _.has(object, 'a.b.c'); + * // => true + * + * _.has(object, ['a', 'b', 'c']); + * // => true + * + * _.has(other, 'a'); + * // => false */ has( object: T, @@ -13140,6 +13159,53 @@ declare module _ { has(path: StringRepresentable|StringRepresentable[]): LoDashExplicitWrapper; } + //_.hasIn + interface LoDashStatic { + /** + * Checks if `path` is a direct or inherited property of `object`. + * + * @static + * @memberOf _ + * @category Object + * @param {Object} object The object to query. + * @param {Array|string} path The path to check. + * @returns {boolean} Returns `true` if `path` exists, else `false`. + * @example + * + * var object = _.create({ 'a': _.create({ 'b': _.create({ 'c': 3 }) }) }); + * + * _.hasIn(object, 'a'); + * // => true + * + * _.hasIn(object, 'a.b.c'); + * // => true + * + * _.hasIn(object, ['a', 'b', 'c']); + * // => true + * + * _.hasIn(object, 'b'); + * // => false + */ + hasIn( + object: T, + path: StringRepresentable|StringRepresentable[] + ): boolean; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.hasIn + */ + hasIn(path: StringRepresentable|StringRepresentable[]): boolean; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.hasIn + */ + hasIn(path: StringRepresentable|StringRepresentable[]): LoDashExplicitWrapper; + } + //_.invert interface LoDashStatic { /** From 0d6bd794759a7517a5ea63d77c8d5123d13fbe59 Mon Sep 17 00:00:00 2001 From: DomiR Date: Fri, 15 Jan 2016 11:52:01 +0100 Subject: [PATCH 48/51] (feature) Add _.mergeWith --- lodash/lodash-tests.ts | 84 +++++++-------- lodash/lodash.d.ts | 228 +++++++++++++++++++++++++++++++---------- 2 files changed, 213 insertions(+), 99 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 2e95b756d..b43e4eb3c 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -8421,32 +8421,19 @@ module TestMerge { type ExpectedResult = { a: number, b: string }; let result: ExpectedResult; - let customizer: (value: any, srcValue: any, key?: string, object?: InitialValue, source?: MergingValue) => any; - // Test for basic merging result = _.merge(initialValue, mergingValue); - result = _.merge(initialValue, mergingValue, customizer); - result = _.merge(initialValue, mergingValue, customizer, any); result = _.merge(initialValue, {}, mergingValue); - result = _.merge(initialValue, {}, mergingValue, customizer); - result = _.merge(initialValue, {}, mergingValue, customizer, any); result = _.merge(initialValue, {}, {}, mergingValue); - result = _.merge(initialValue, {}, {}, mergingValue, customizer); - result = _.merge(initialValue, {}, {}, mergingValue, customizer, any); result = _.merge(initialValue, {}, {}, {}, mergingValue); - result = _.merge(initialValue, {}, {}, {}, mergingValue, customizer); - result = _.merge(initialValue, {}, {}, {}, mergingValue, customizer, any); // Once we get to the varargs version, you have to specify the result explicitly result = _.merge(initialValue, {}, {}, {}, {}, mergingValue); - result = _.merge(initialValue, {}, {}, {}, {}, mergingValue, customizer); - result = _.merge(initialValue, {}, {}, {}, {}, mergingValue, customizer, any); - // Test for multiple combinations of many types type ComplicatedExpectedType = { a: number, b: string, c: {}, d: number[], e: boolean }; @@ -8468,25 +8455,15 @@ module TestMerge { // Tests for basic chaining with merge result = _(initialValue).merge(mergingValue).value(); - result = _(initialValue).merge(mergingValue, customizer).value(); - result = _(initialValue).merge(mergingValue, customizer, any).value(); result = _(initialValue).merge({}, mergingValue).value(); - result = _(initialValue).merge({}, mergingValue, customizer).value(); - result = _(initialValue).merge({}, mergingValue, customizer, any).value(); result = _(initialValue).merge({}, {}, mergingValue).value(); - result = _(initialValue).merge({}, {}, mergingValue, customizer).value(); - result = _(initialValue).merge({}, {}, mergingValue, customizer, any).value(); result = _(initialValue).merge({}, {}, {}, mergingValue).value(); - result = _(initialValue).merge({}, {}, {}, mergingValue, customizer).value(); - result = _(initialValue).merge({}, {}, {}, mergingValue, customizer, any).value(); // Once we get to the varargs version, you have to specify the result explicitly result = _(initialValue).merge({}, {}, {}, {}, mergingValue).value(); - result = _(initialValue).merge({}, {}, {}, {}, mergingValue, customizer).value(); - result = _(initialValue).merge({}, {}, {}, {}, mergingValue, customizer, any).value(); // Test complex multiple combinations with chaining @@ -8504,41 +8481,58 @@ module TestMerge { { let result: _.LoDashExplicitObjectWrapper; - - result = _(initialValue).chain().merge(mergingValue); - result = _(initialValue).chain().merge(mergingValue, customizer); - result = _(initialValue).chain().merge(mergingValue, customizer, any); - - result = _(initialValue).chain().merge({}, mergingValue); - result = _(initialValue).chain().merge({}, mergingValue, customizer); - result = _(initialValue).chain().merge({}, mergingValue, customizer, any); - - result = _(initialValue).chain().merge({}, {}, mergingValue); - result = _(initialValue).chain().merge({}, {}, mergingValue, customizer); - result = _(initialValue).chain().merge({}, {}, mergingValue, customizer, any); - - result = _(initialValue).chain().merge({}, {}, {}, mergingValue); - result = _(initialValue).chain().merge({}, {}, {}, mergingValue, customizer); - result = _(initialValue).chain().merge({}, {}, {}, mergingValue, customizer, any); - - result = _(initialValue).chain().merge({}, {}, {}, {}, mergingValue); - result = _(initialValue).chain().merge({}, {}, {}, {}, mergingValue, customizer); - result = _(initialValue).chain().merge({}, {}, {}, {}, mergingValue, customizer, any); + // result = _(initialValue).chain().merge(mergingValue); + // result = _(initialValue).chain().merge({}, mergingValue); + // result = _(initialValue).chain().merge({}, {}, mergingValue); + // result = _(initialValue).chain().merge({}, {}, {}, mergingValue); + // result = _(initialValue).chain().merge({}, {}, {}, {}, mergingValue); } { let result: _.LoDashExplicitObjectWrapper; - result = _({ a: 1 }).chain().merge({ b: "string" }, { c: {} }, { d: [1] }, { e: true }); + //result = _({ a: 1 }).chain().merge({ b: "string" }, { c: {} }, { d: [1] }, { e: true }); } { let result: _.LoDashExplicitObjectWrapper; - result = _({ a: 1 }).chain().merge({ a: "string" }, { a: {} }, { a: [1] }, { a: true }); + //result = _({ a: 1 }).chain().merge({ a: "string" }, { a: {} }, { a: [1] }, { a: true }); } } +// _.mergeWith +module TestMergeWith { + type InitialValue = { a : number }; + type MergingValue = { b : string }; + + var initialValue = { a : 1 }; + var mergingValue = { b : "hi" }; + + type ExpectedResult = { a: number, b: string }; + let result: ExpectedResult; + + let customizer: (value: any, srcValue: any, key?: string, object?: InitialValue, source?: MergingValue) => any; + + // Test for basic merging + result = _.mergeWith(initialValue, mergingValue, customizer); + result = _.mergeWith(initialValue, {}, mergingValue, customizer); + result = _.mergeWith(initialValue, {}, {}, mergingValue, customizer); + result = _.mergeWith(initialValue, {}, {}, {}, mergingValue, customizer); + + // Once we get to the varargs version, you have to specify the result explicitl + result = _.mergeWith(initialValue, {}, {}, {}, {}, mergingValue, customizer); + + // Tests for basic chaining with mergeWith + result = _(initialValue).mergeWith(mergingValue, customizer).value(); + result = _(initialValue).mergeWith({}, mergingValue, customizer).value(); + result = _(initialValue).mergeWith({}, {}, mergingValue, customizer).value(); + result = _(initialValue).mergeWith({}, {}, {}, mergingValue, customizer).value(); + + // Once we get to the varargs version, you have to specify the result explicitl + result = _(initialValue).mergeWith({}, {}, {}, {}, mergingValue, customizer).value(); +} + // _.omit module TestOmit { let predicate: (element: any, key: string, collection: any) => boolean; diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 14b0f7246..6126d16e7 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -105,7 +105,7 @@ added 13 object methods: - [x] _.functionsIn - [x] _.hasIn - [ ] _.invoke -- [ ] _.mergeWith +- [x] _.mergeWith - [x] _.omitBy - [x] _.pickBy - [ ] _.setWith @@ -13500,29 +13500,39 @@ declare module _ { } //_.merge - interface MergeCustomizer { - (value: any, srcValue: any, key?: string, object?: Object, source?: Object): any; - } - interface LoDashStatic { /** - * Recursively merges own enumerable properties of the source object(s), that don’t resolve to undefined into - * the destination object. Subsequent sources overwrite property assignments of previous sources. If customizer - * is provided it’s invoked to produce the merged values of the destination and source properties. If - * customizer returns undefined merging is handled by the method instead. The customizer is bound to thisArg - * and invoked with five arguments: (objectValue, sourceValue, key, object, source). + * Recursively merges own and inherited enumerable properties of source + * objects into the destination object, skipping source properties that resolve + * to `undefined`. Array and plain object properties are merged recursively. + * Other objects and value types are overridden by assignment. Source objects + * are applied from left to right. Subsequent sources overwrite property + * assignments of previous sources. * - * @param object The destination object. - * @param source The source objects. - * @param customizer The function to customize assigned values. - * @param thisArg The this binding of customizer. - * @return Returns object. + * **Note:** This method mutates `object`. + * + * @static + * @memberOf _ + * @category Object + * @param {Object} object The destination object. + * @param {...Object} [sources] The source objects. + * @returns {Object} Returns `object`. + * @example + * + * var users = { + * 'data': [{ 'user': 'barney' }, { 'user': 'fred' }] + * }; + * + * var ages = { + * 'data': [{ 'age': 36 }, { 'age': 40 }] + * }; + * + * _.merge(users, ages); + * // => { 'data': [{ 'user': 'barney', 'age': 36 }, { 'user': 'fred', 'age': 40 }] } */ merge( object: TObject, - source: TSource, - customizer?: MergeCustomizer, - thisArg?: any + source: TSource ): TObject & TSource; /** @@ -13531,9 +13541,7 @@ declare module _ { merge( object: TObject, source1: TSource1, - source2: TSource2, - customizer?: MergeCustomizer, - thisArg?: any + source2: TSource2 ): TObject & TSource1 & TSource2; /** @@ -13543,9 +13551,7 @@ declare module _ { object: TObject, source1: TSource1, source2: TSource2, - source3: TSource3, - customizer?: MergeCustomizer, - thisArg?: any + source3: TSource3 ): TObject & TSource1 & TSource2 & TSource3; /** @@ -13556,9 +13562,7 @@ declare module _ { source1: TSource1, source2: TSource2, source3: TSource3, - source4: TSource4, - customizer?: MergeCustomizer, - thisArg?: any + source4: TSource4 ): TObject & TSource1 & TSource2 & TSource3 & TSource4; /** @@ -13575,9 +13579,7 @@ declare module _ { * @see _.merge */ merge( - source: TSource, - customizer?: MergeCustomizer, - thisArg?: any + source: TSource ): LoDashImplicitObjectWrapper; /** @@ -13585,9 +13587,7 @@ declare module _ { */ merge( source1: TSource1, - source2: TSource2, - customizer?: MergeCustomizer, - thisArg?: any + source2: TSource2 ): LoDashImplicitObjectWrapper; /** @@ -13596,9 +13596,7 @@ declare module _ { merge( source1: TSource1, source2: TSource2, - source3: TSource3, - customizer?: MergeCustomizer, - thisArg?: any + source3: TSource3 ): LoDashImplicitObjectWrapper; /** @@ -13608,9 +13606,7 @@ declare module _ { source1: TSource1, source2: TSource2, source3: TSource3, - source4: TSource4, - customizer?: MergeCustomizer, - thisArg?: any + source4: TSource4 ): LoDashImplicitObjectWrapper; /** @@ -13626,9 +13622,7 @@ declare module _ { * @see _.merge */ merge( - source: TSource, - customizer?: MergeCustomizer, - thisArg?: any + source: TSource ): LoDashExplicitObjectWrapper; /** @@ -13636,9 +13630,7 @@ declare module _ { */ merge( source1: TSource1, - source2: TSource2, - customizer?: MergeCustomizer, - thisArg?: any + source2: TSource2 ): LoDashExplicitObjectWrapper; /** @@ -13647,21 +13639,13 @@ declare module _ { merge( source1: TSource1, source2: TSource2, - source3: TSource3, - customizer?: MergeCustomizer, - thisArg?: any + source3: TSource3 ): LoDashExplicitObjectWrapper; /** * @see _.merge */ merge( - source1: TSource1, - source2: TSource2, - source3: TSource3, - source4: TSource4, - customizer?: MergeCustomizer, - thisArg?: any ): LoDashExplicitObjectWrapper; /** @@ -13672,6 +13656,142 @@ declare module _ { ): LoDashExplicitObjectWrapper; } + //_.mergeWith + interface MergeWithCustomizer { + (value: any, srcValue: any, key?: string, object?: Object, source?: Object): any; + } + + interface LoDashStatic { + /** + * This method is like `_.merge` except that it accepts `customizer` which + * is invoked to produce the merged values of the destination and source + * properties. If `customizer` returns `undefined` merging is handled by the + * method instead. The `customizer` is invoked with seven arguments: + * (objValue, srcValue, key, object, source, stack). + * + * @static + * @memberOf _ + * @category Object + * @param {Object} object The destination object. + * @param {...Object} sources The source objects. + * @param {Function} customizer The function to customize assigned values. + * @returns {Object} Returns `object`. + * @example + * + * function customizer(objValue, srcValue) { + * if (_.isArray(objValue)) { + * return objValue.concat(srcValue); + * } + * } + * + * var object = { + * 'fruits': ['apple'], + * 'vegetables': ['beet'] + * }; + * + * var other = { + * 'fruits': ['banana'], + * 'vegetables': ['carrot'] + * }; + * + * _.merge(object, other, customizer); + * // => { 'fruits': ['apple', 'banana'], 'vegetables': ['beet', 'carrot'] } + */ + mergeWith( + object: TObject, + source: TSource, + customizer: MergeWithCustomizer + ): TObject & TSource; + + /** + * @see _.mergeWith + */ + mergeWith( + object: TObject, + source1: TSource1, + source2: TSource2, + customizer: MergeWithCustomizer + ): TObject & TSource1 & TSource2; + + /** + * @see _.mergeWith + */ + mergeWith( + object: TObject, + source1: TSource1, + source2: TSource2, + source3: TSource3, + customizer: MergeWithCustomizer + ): TObject & TSource1 & TSource2 & TSource3; + + /** + * @see _.mergeWith + */ + mergeWith( + object: TObject, + source1: TSource1, + source2: TSource2, + source3: TSource3, + source4: TSource4, + customizer: MergeWithCustomizer + ): TObject & TSource1 & TSource2 & TSource3 & TSource4; + + /** + * @see _.mergeWith + */ + mergeWith( + object: any, + ...otherArgs: any[] + ): TResult; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.mergeWith + */ + mergeWith( + source: TSource, + customizer: MergeWithCustomizer + ): LoDashImplicitObjectWrapper; + + /** + * @see _.mergeWith + */ + mergeWith( + source1: TSource1, + source2: TSource2, + customizer: MergeWithCustomizer + ): LoDashImplicitObjectWrapper; + + /** + * @see _.mergeWith + */ + mergeWith( + source1: TSource1, + source2: TSource2, + source3: TSource3, + customizer: MergeWithCustomizer + ): LoDashImplicitObjectWrapper; + + /** + * @see _.mergeWith + */ + mergeWith( + source1: TSource1, + source2: TSource2, + source3: TSource3, + source4: TSource4, + customizer: MergeWithCustomizer + ): LoDashImplicitObjectWrapper; + + /** + * @see _.mergeWith + */ + mergeWith( + ...otherArgs: any[] + ): LoDashImplicitObjectWrapper; + } + //_.omit interface LoDashStatic { /** From fcb3ef91382454096cbc3bedcc6edfffd41e1ff7 Mon Sep 17 00:00:00 2001 From: DomiR Date: Fri, 15 Jan 2016 15:51:22 +0100 Subject: [PATCH 49/51] (feature) Add _.toPath --- lodash/lodash-tests.ts | 23 ++++++++++++++++++++++ lodash/lodash.d.ts | 44 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index b43e4eb3c..0a356d90e 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -9969,6 +9969,29 @@ module TestTimes { } } +// _.toPath +module TestToPath { + { + let result: string[]; + result = _.toPath(true); + result = _.toPath(1); + result = _.toPath('a'); + result = _.toPath(["a"]); + result = _.toPath({}); + } + + { + let result: _.LoDashImplicitWrapper; + + result = _(true).toPath(); + result = _(1).toPath(); + result = _('a').toPath(); + result = _([1]).toPath(); + result = _(["a"]).toPath(); + result = _({}).toPath(); + } +} + // _.uniqueId module TestUniqueId { { diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 6126d16e7..097290c78 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -15827,6 +15827,50 @@ declare module _ { times(): LoDashExplicitArrayWrapper; } + //_.toPath + interface LoDashStatic { + /** + * Converts `value` to a property path array. + * + * @static + * @memberOf _ + * @category Util + * @param {*} value The value to convert. + * @returns {Array} Returns the new property path array. + * @example + * + * _.toPath('a.b.c'); + * // => ['a', 'b', 'c'] + * + * _.toPath('a[0].b.c'); + * // => ['a', '0', 'b', 'c'] + * + * var path = ['a', 'b', 'c'], + * newPath = _.toPath(path); + * + * console.log(newPath); + * // => ['a', 'b', 'c'] + * + * console.log(path === newPath); + * // => false + */ + toPath(value: any): string[]; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.toPath + */ + toPath(): LoDashImplicitWrapper; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.toPath + */ + toPath(): LoDashExplicitWrapper; + } + //_.uniqueId interface LoDashStatic { /** From 4f38ac3bc6649ce32dbd17d2c46bff46ffa2dbb4 Mon Sep 17 00:00:00 2001 From: DomiR Date: Fri, 15 Jan 2016 15:54:38 +0100 Subject: [PATCH 50/51] (feature) Add _.rangeRight --- lodash/lodash-tests.ts | 27 ++++++++++++++++ lodash/lodash.d.ts | 73 +++++++++++++++++++++++++++++++++++++++++- 2 files changed, 99 insertions(+), 1 deletion(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 0a356d90e..af33b66ac 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -9917,6 +9917,33 @@ module TestRange { } } +// _.rangeRight +module TestRangeRight { + { + let result: number[]; + + result = _.rangeRight(10); + result = _.rangeRight(1, 11); + result = _.rangeRight(0, 30, 5); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(10).rangeRight(); + result = _(1).rangeRight(11); + result = _(0).rangeRight(30, 5); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(10).chain().rangeRight(); + result = _(1).chain().rangeRight(11); + result = _(0).chain().rangeRight(30, 5); + } +} + // _.runInContext { let result: typeof _; diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 097290c78..d9e957f9a 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -131,7 +131,7 @@ added 8 utility methods: - [ ] _.overEvery - [ ] _.overSome - [ ] _.rangeRight -- [ ] _.toPath +- [x] _.toPath added 4 math methods: - [x] _.maxBy @@ -15756,6 +15756,77 @@ declare module _ { ): LoDashExplicitArrayWrapper; } + //_.rangeRight + interface LoDashStatic { + /** + * This method is like `_.range` except that it populates values in + * descending order. + * + * @static + * @memberOf _ + * @category Util + * @param {number} [start=0] The start of the range. + * @param {number} end The end of the range. + * @param {number} [step=1] The value to increment or decrement by. + * @returns {Array} Returns the new array of numbers. + * @example + * + * _.rangeRight(4); + * // => [3, 2, 1, 0] + * + * _.rangeRight(-4); + * // => [-3, -2, -1, 0] + * + * _.rangeRight(1, 5); + * // => [4, 3, 2, 1] + * + * _.rangeRight(0, 20, 5); + * // => [15, 10, 5, 0] + * + * _.rangeRight(0, -4, -1); + * // => [-3, -2, -1, 0] + * + * _.rangeRight(1, 4, 0); + * // => [1, 1, 1] + * + * _.rangeRight(0); + * // => [] + */ + rangeRight( + start: number, + end: number, + step?: number + ): number[]; + + /** + * @see _.rangeRight + */ + rangeRight( + end: number, + step?: number + ): number[]; + } + + interface LoDashImplicitWrapper { + /** + * @see _.rangeRight + */ + rangeRight( + end?: number, + step?: number + ): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.rangeRight + */ + rangeRight( + end?: number, + step?: number + ): LoDashExplicitArrayWrapper; + } + //_.runInContext interface LoDashStatic { /** From 2a6a4132bf524eb4d101a5897f31135429af0976 Mon Sep 17 00:00:00 2001 From: DomiR Date: Wed, 20 Jan 2016 15:20:13 +0100 Subject: [PATCH 51/51] (feature) Added some dummies for array functions --- lodash/lodash.d.ts | 610 ++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 552 insertions(+), 58 deletions(-) diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index d9e957f9a..f9249d16b 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -8,10 +8,6 @@ ### 4.0.0 Changelog (https://github.com/lodash/lodash/wiki/Changelog) #### TODO: -misc: -- [ ] Made _.forEach, _.forIn, _.forOwn, & _.times implicitly end a chain sequence -- [ ] Removed thisArg params from most methods - removed: - [x] Removed _.support - [x] Removed _.findWhere in favor of _.find with iteratee shorthand @@ -41,42 +37,37 @@ split: - [x] Split _.uniq into _.sortedUniq, _.sortedUniqBy, & _.uniqBy changes: -- [ ] TODO remove _.sortBy duplicates - [x] Absorbed _.sortByAll into _.sortBy - [x] Changed the category of _.at to “Object” - [x] Changed the category of _.bindAll to “Utility” -- [ ] Made “By” methods provide a single param to iteratees - [x] Made _.capitalize uppercase the first character & lowercase the rest - [x] Made _.functions return only own method names -- [ ] Made _.words chainable by default -- [ ] Removed isDeep params from _.clone & _.flatten -- [ ] Removed _.bindAll support for binding all methods when no names are provided -- [ ] Removed func-first param signature from _.before & _.after + added 23 array methods: -- [ ] _.concat -- [ ] _.differenceBy -- [ ] _.differenceWith -- [ ] _.flatMap -- [ ] _.fromPairs -- [ ] _.intersectionBy -- [ ] _.intersectionWith -- [ ] _.join -- [ ] _.pullAll -- [ ] _.pullAllBy -- [ ] _.reverse +- [x] _.concat +- [x] _.differenceBy +- [x] _.differenceWith +- [x] _.flatMap +- [x] _.fromPairs +- [x] _.intersectionBy +- [x] _.intersectionWith +- [x] _.join +- [x] _.pullAll +- [x] _.pullAllBy +- [x] _.reverse - [x] _.sortedIndexBy - [x] _.sortedIndexOf - [x] _.sortedLastIndexBy -- [ ] _.sortedLastIndexOf +- [x] _.sortedLastIndexOf - [x] _.sortedUniq - [x] _.sortedUniqBy -- [ ] _.unionBy -- [ ] _.unionWith +- [x] _.unionBy +- [x] _.unionWith - [x] _.uniqBy -- [ ] _.uniqWith -- [ ] _.xorBy -- [ ] _.xorWith +- [x] _.uniqWith +- [x] _.xorBy +- [x] _.xorWith added 18 lang methods: - [x] _.cloneDeepWith @@ -96,7 +87,7 @@ added 18 lang methods: - [x] _.toLength - [x] _.toNumber - [x] _.toSafeInteger -- [ ] _.toString +- [x] _.toString added 13 object methods: - [x] _.assignIn @@ -104,33 +95,20 @@ added 13 object methods: - [x] _.assignWith - [x] _.functionsIn - [x] _.hasIn -- [ ] _.invoke - [x] _.mergeWith - [x] _.omitBy - [x] _.pickBy -- [ ] _.setWith -- [ ] _.toPairs -- [ ] _.toPairsIn -- [ ] _.unset + added 8 string methods: - [x] _.lowerCase - [x] _.lowerFirst -- [ ] _.replace -- [ ] _.split - [x] _.upperCase - [x] _.upperFirst - [x] _.toLower - [x] _.toUpper added 8 utility methods: -- [ ] _.cond -- [ ] _.conforms -- [ ] _.nthArg -- [ ] _.over -- [ ] _.overEvery -- [ ] _.overSome -- [ ] _.rangeRight - [x] _.toPath added 4 math methods: @@ -147,15 +125,11 @@ added 2 number methods: - [x] _.clamp - [x] _.subtract -added chain method: -- [ ] _.next - added collection method: - [x] _.sampleSize Added 3 aliases -- [ ] _.extend as an alias of _.assignIn -- [ ] _.extendWith as an alias of _.assignInWith + - [x] _.first as an alias of _.head Removed 17 aliases @@ -178,28 +152,19 @@ Removed 17 aliases - [x] Removed aliase _.unique Other changes -- [ ] Added clear method to _.memoize.Cache -- [ ] Added flush method to debounced & throttled functions -- [ ] Added support for ES6 maps, sets, & symbols to _.clone, _.isEqual, & _.toArray - [x] Added support for array buffers to _.isEqual - [x] Added support for converting iterators to _.toArray - [x] Added support for deep paths to _.zipObject - [x] Changed UMD to export to window or self when available regardless of other exports -- [ ] Enabled _.flow & _.flowRight to accept an array of functions -- [ ] Ensured “Collection” methods treat functions as objects - [x] Ensured debounce cancel clears args & thisArg references - [x] Ensured _.add, _.subtract, & _.sum don’t skip NaN values -- [ ] Ensured _.assign, _.defaults, & _.merge coerce object values to objects -- [ ] Ensured _.bindKey bound functions call object[key] when called with the new operator - [x] Ensured _.clone treats generators like functions - [x] Ensured _.clone produces clones with the source’s [[Prototype]] - [x] Ensured _.defaults assigns properties that shadow Object.prototype - [x] Ensured _.defaultsDeep doesn’t merge a string into an array - [x] Ensured _.defaultsDeep & _.merge don’t modify sources - [x] Ensured _.defaultsDeep works with circular references -- [ ] Ensured _.isFunction returns true for generator functions - [x] Ensured _.keys skips “length” on strict mode arguments objects in Safari 9 -- [ ] Ensured _.merge assigns typed arrays directly - [x] Ensured _.merge doesn’t convert strings to arrays - [x] Ensured _.merge merges plain-objects onto non plain-objects - [x] Ensured _#plant resets iterator data of cloned sequences @@ -207,8 +172,68 @@ Other changes - [x] Ensured _.range preserves the sign of start of -0 - [x] Ensured _.reduce & _.reduceRight use getIteratee in their array branch - [x] Fixed rounding issue with the precision param of _.floor + +** LATER ** +Misc: +- [ ] Made _.forEach, _.forIn, _.forOwn, & _.times implicitly end a chain sequence +- [ ] Removed thisArg params from most methods +- [ ] Made “By” methods provide a single param to iteratees +- [ ] Made _.words chainable by default +- [ ] Removed isDeep params from _.clone & _.flatten +- [ ] Removed _.bindAll support for binding all methods when no names are provided +- [ ] Removed func-first param signature from _.before & _.after +- [ ] _.extend as an alias of _.assignIn +- [ ] _.extendWith as an alias of _.assignInWith +- [ ] Added clear method to _.memoize.Cache +- [ ] Added flush method to debounced & throttled functions +- [ ] Added support for ES6 maps, sets, & symbols to _.clone, _.isEqual, & _.toArray +- [ ] Enabled _.flow & _.flowRight to accept an array of functions +- [ ] Ensured “Collection” methods treat functions as objects +- [ ] Ensured _.assign, _.defaults, & _.merge coerce object values to objects +- [ ] Ensured _.bindKey bound functions call object[key] when called with the new operator +- [ ] Ensured _.isFunction returns true for generator functions +- [ ] Ensured _.merge assigns typed arrays directly - [ ] Made _(...) an iterator & iterable - [ ] Made _.drop, _.take, & right forms coerce n of undefined to 0 + +Methods: +- [ ] _.concat +- [ ] _.differenceBy +- [ ] _.differenceWith +- [ ] _.flatMap +- [ ] _.fromPairs +- [ ] _.intersectionBy +- [ ] _.intersectionWith +- [ ] _.join +- [ ] _.pullAll +- [ ] _.pullAllBy +- [ ] _.reverse +- [ ] _.sortedLastIndexOf +- [ ] _.unionBy +- [ ] _.unionWith +- [ ] _.uniqWith +- [ ] _.xorBy +- [ ] _.xorWith +- [ ] _.toString + +- [ ] _.invoke +- [ ] _.setWith +- [ ] _.toPairs +- [ ] _.toPairsIn +- [ ] _.unset + +- [ ] _.replace +- [ ] _.split + +- [ ] _.cond +- [ ] _.conforms +- [ ] _.nthArg +- [ ] _.over +- [ ] _.overEvery +- [ ] _.overSome +- [ ] _.rangeRight + +- [ ] _.next */ declare var _: _.LoDashStatic; @@ -454,6 +479,32 @@ declare module _ { compact(): LoDashExplicitArrayWrapper; } + //_.concat DUMMY + interface LoDashStatic { + /** + * Creates a new array concatenating `array` with any additional arrays + * and/or values. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to concatenate. + * @param {...*} [values] The values to concatenate. + * @returns {Array} Returns the new concatenated array. + * @example + * + * var array = [1]; + * var other = _.concat(array, 2, [3], [[4]]); + * + * console.log(other); + * // => [1, 2, 3, [4]] + * + * console.log(array); + * // => [1] + */ + concat(...values: (T[]|List)[]) : T[]; + } + //_.difference interface LoDashStatic { /** @@ -465,8 +516,8 @@ declare module _ { * @return Returns the new array of filtered values. */ difference( - array: T[]|List, - ...values: (T[]|List)[] + array: any[]|List, + ...values: any[] ): T[]; } @@ -498,6 +549,54 @@ declare module _ { difference(...values: (TValue[]|List)[]): LoDashExplicitArrayWrapper; } + //_.differenceBy DUMMY + interface LoDashStatic { + /** + * Creates an array of unique `array` values not included in the other + * provided arrays using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * for equality comparisons. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to inspect. + * @param {...Array} [values] The values to exclude. + * @returns {Array} Returns the new array of filtered values. + * @example + * + * _.difference([3, 2, 1], [4, 2]); + * // => [3, 1] + */ + differenceBy( + array: any[]|List, + ...values: any[] + ): any[]; + } + + //_.differenceWith DUMMY + interface LoDashStatic { + /** + * Creates an array of unique `array` values not included in the other + * provided arrays using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * for equality comparisons. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to inspect. + * @param {...Array} [values] The values to exclude. + * @returns {Array} Returns the new array of filtered values. + * @example + * + * _.difference([3, 2, 1], [4, 2]); + * // => [3, 1] + */ + differenceWith( + array: any[]|List, + ...values: any[] + ): any[]; + } + //_.drop interface LoDashStatic { /** @@ -1256,6 +1355,34 @@ declare module _ { interface RecursiveArray extends Array> {} interface ListOfRecursiveArraysOrValues extends List> {} + //_.flatMap DUMMY + interface LoDashStatic { + /** + * Creates an array of flattened values by running each element in `array` + * through `iteratee` and concating its result to the other mapped values. + * The iteratee is invoked with three arguments: (value, index|key, array). + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to iterate over. + * @param {Function|Object|string} [iteratee=_.identity] The function invoked per iteration. + * @returns {Array} Returns the new array. + * @example + * + * function duplicate(n) { + * return [n, n]; + * } + * + * _.flatMap([1, 2], duplicate); + * // => [1, 1, 2, 2] + */ + flatMap( + array: any[]|List, + ...values: any[] + ): any[]; + } + //_.flatten interface LoDashStatic { /** @@ -1374,6 +1501,27 @@ declare module _ { flattenDeep(): LoDashExplicitArrayWrapper; } + //_.fromPairs DUMMY + interface LoDashStatic { + /** + * The inverse of `_.toPairs`; this method returns an object composed + * from key-value `pairs`. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} pairs The key-value pairs. + * @returns {Object} Returns the new object. + * @example + * + * _.fromPairs([['fred', 30], ['barney', 40]]); + * // => { 'fred': 30, 'barney': 40 } + */ + fromPairs( + array: any[]|List + ): any[]; + } + //_.head interface LoDashStatic { /** @@ -1473,6 +1621,168 @@ declare module _ { ): LoDashExplicitWrapper; } + //_.intersectionBy DUMMY + interface LoDashStatic { + /** + * This method is like `_.intersection` except that it accepts `iteratee` + * which is invoked for each element of each `arrays` to generate the criterion + * by which uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * @static + * @memberOf _ + * @category Array + * @param {...Array} [arrays] The arrays to inspect. + * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element. + * @returns {Array} Returns the new array of shared values. + * @example + * + * _.intersectionBy([2.1, 1.2], [4.3, 2.4], Math.floor); + * // => [2.1] + * + * // using the `_.property` iteratee shorthand + * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); + * // => [{ 'x': 1 }] + */ + intersectionBy( + array: any[]|List, + ...values: any[] + ): any[]; + } + + //_.intersectionWith DUMMY + interface LoDashStatic { + /** + * This method is like `_.intersection` except that it accepts `comparator` + * which is invoked to compare elements of `arrays`. The comparator is invoked + * with two arguments: (arrVal, othVal). + * + * @static + * @memberOf _ + * @category Array + * @param {...Array} [arrays] The arrays to inspect. + * @param {Function} [comparator] The comparator invoked per element. + * @returns {Array} Returns the new array of shared values. + * @example + * + * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; + * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; + * + * _.intersectionWith(objects, others, _.isEqual); + * // => [{ 'x': 1, 'y': 2 }] + */ + intersectionWith( + array: any[]|List, + ...values: any[] + ): any[]; + } + + //_.join DUMMY + interface LoDashStatic { + /** + * Converts all elements in `array` into a string separated by `separator`. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to convert. + * @param {string} [separator=','] The element separator. + * @returns {string} Returns the joined string. + * @example + * + * _.join(['a', 'b', 'c'], '~'); + * // => 'a~b~c' + */ + join( + array: any[]|List, + ...values: any[] + ): any[]; + } + + //_.pullAll DUMMY + interface LoDashStatic { + /** + * This method is like `_.pull` except that it accepts an array of values to remove. + * + * **Note:** Unlike `_.difference`, this method mutates `array`. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to modify. + * @param {Array} values The values to remove. + * @returns {Array} Returns `array`. + * @example + * + * var array = [1, 2, 3, 1, 2, 3]; + * + * _.pull(array, [2, 3]); + * console.log(array); + * // => [1, 1] + */ + pullAll( + array: any[]|List, + ...values: any[] + ): any[]; + } + + //_.pullAllBy DUMMY + interface LoDashStatic { + /** + * This method is like `_.pullAll` except that it accepts `iteratee` which is + * invoked for each element of `array` and `values` to to generate the criterion + * by which uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * **Note:** Unlike `_.differenceBy`, this method mutates `array`. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to modify. + * @param {Array} values The values to remove. + * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element. + * @returns {Array} Returns `array`. + * @example + * + * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }]; + * + * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x'); + * console.log(array); + * // => [{ 'x': 2 }] + */ + pullAllBy( + array: any[]|List, + ...values: any[] + ): any[]; + } + + //_.reverse DUMMY + interface LoDashStatic { + /** + * Reverses `array` so that the first element becomes the last, the second + * element becomes the second to last, and so on. + * + * **Note:** This method mutates `array` and is based on + * [`Array#reverse`](https://mdn.io/Array/reverse). + * + * @memberOf _ + * @category Array + * @returns {Array} Returns `array`. + * @example + * + * var array = [1, 2, 3]; + * + * _.reverse(array); + * // => [3, 2, 1] + * + * console.log(array); + * // => [3, 2, 1] + */ + reverse( + array: any[]|List, + ...values: any[] + ): any[]; + } + //_.sortedIndexOf interface LoDashStatic { /** @@ -2795,6 +3105,29 @@ declare module _ { ): LoDashExplicitWrapper; } + //_.sortedLastIndexOf DUMMY + interface LoDashStatic { + /** + * This method is like `_.lastIndexOf` except that it performs a binary + * search on a sorted `array`. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to search. + * @param {*} value The value to search for. + * @returns {number} Returns the index of the matched value, else `-1`. + * @example + * + * _.sortedLastIndexOf([1, 1, 2, 2], 2); + * // => 3 + */ + sortedLastIndexOf( + array: any[]|List, + ...values: any[] + ): any[]; + } + //_.tail interface LoDashStatic { /** @@ -3822,6 +4155,87 @@ declare module _ { ): LoDashExplicitArrayWrapper; } + //_.unionBy DUMMY + interface LoDashStatic { + /** + * This method is like `_.union` except that it accepts `iteratee` which is + * invoked for each element of each `arrays` to generate the criterion by which + * uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * @static + * @memberOf _ + * @category Array + * @param {...Array} [arrays] The arrays to inspect. + * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element. + * @returns {Array} Returns the new array of combined values. + * @example + * + * _.unionBy([2.1, 1.2], [4.3, 2.4], Math.floor); + * // => [2.1, 1.2, 4.3] + * + * // using the `_.property` iteratee shorthand + * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); + * // => [{ 'x': 1 }, { 'x': 2 }] + */ + unionBy( + array: any[]|List, + ...values: any[] + ): any[]; + } + + //_.unionWith DUMMY + interface LoDashStatic { + /** + * This method is like `_.union` except that it accepts `comparator` which + * is invoked to compare elements of `arrays`. The comparator is invoked + * with two arguments: (arrVal, othVal). + * + * @static + * @memberOf _ + * @category Array + * @param {...Array} [arrays] The arrays to inspect. + * @param {Function} [comparator] The comparator invoked per element. + * @returns {Array} Returns the new array of combined values. + * @example + * + * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; + * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; + * + * _.unionWith(objects, others, _.isEqual); + * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }] + */ + unionWith( + array: any[]|List, + ...values: any[] + ): any[]; + } + + //_.uniqWith DUMMY + interface LoDashStatic { + /** + * This method is like `_.uniq` except that it accepts `comparator` which + * is invoked to compare elements of `array`. The comparator is invoked with + * two arguments: (arrVal, othVal). + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to inspect. + * @param {Function} [comparator] The comparator invoked per element. + * @returns {Array} Returns the new duplicate free array. + * @example + * + * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }]; + * + * _.uniqWith(objects, _.isEqual); + * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }] + */ + uniqWith( + array: any[]|List, + ...values: any[] + ): any[]; + } + //_.unzip interface LoDashStatic { /** @@ -3983,6 +4397,61 @@ declare module _ { xor(...arrays: List[]): LoDashExplicitArrayWrapper; } + //_.xorBy DUMMY + interface LoDashStatic { + /** + * This method is like `_.xor` except that it accepts `iteratee` which is + * invoked for each element of each `arrays` to generate the criterion by which + * uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * @static + * @memberOf _ + * @category Array + * @param {...Array} [arrays] The arrays to inspect. + * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element. + * @returns {Array} Returns the new array of values. + * @example + * + * _.xorBy([2.1, 1.2], [4.3, 2.4], Math.floor); + * // => [1.2, 4.3] + * + * // using the `_.property` iteratee shorthand + * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); + * // => [{ 'x': 2 }] + */ + xorBy( + array: any[]|List, + ...values: any[] + ): any[]; + } + + //_.xorWith DUMMY + interface LoDashStatic { + /** + * This method is like `_.xor` except that it accepts `comparator` which is + * invoked to compare elements of `arrays`. The comparator is invoked with + * two arguments: (arrVal, othVal). + * + * @static + * @memberOf _ + * @category Array + * @param {...Array} [arrays] The arrays to inspect. + * @param {Function} [comparator] The comparator invoked per element. + * @returns {Array} Returns the new array of values. + * @example + * + * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; + * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; + * + * _.xorWith(objects, others, _.isEqual); + * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }] + */ + xorWith( + array: any[]|List, + ...values: any[] + ): any[]; + } + //_.zip interface LoDashStatic { /** @@ -10646,6 +11115,31 @@ declare module _ { toSafeInteger(): LoDashExplicitWrapper; } + //_.toString DUMMY + interface LoDashStatic { + /** + * Converts `value` to a string if it's not one. An empty string is returned + * for `null` and `undefined` values. The sign of `-0` is preserved. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to process. + * @returns {string} Returns the string. + * @example + * + * _.toString(null); + * // => '' + * + * _.toString(-0); + * // => '-0' + * + * _.toString([1, 2, 3]); + * // => '1,2,3' + */ + toString(value: any): string; + } + /******** * Math * ********/