diff --git a/types/lodash/common/array.d.ts b/types/lodash/common/array.d.ts index f70fbbf135..49f93aa313 100644 --- a/types/lodash/common/array.d.ts +++ b/types/lodash/common/array.d.ts @@ -916,27 +916,15 @@ declare module "../index" { interface LoDashStatic { /** - * Flattens a nested array. If isDeep is true the array is recursively flattened, otherwise it’s only - * flattened a single level. + * Flattens `array` a single level deep. * * @param array The array to flatten. - * @param isDeep Specify a deep flatten. * @return Returns the new flattened array. */ - flatten(array: ListOfRecursiveArraysOrValues | null | undefined, isDeep: boolean): T[]; - - /** - * @see _.flatten - */ flatten(array: List> | null | undefined): T[]; } interface LoDashImplicitWrapper { - /** - * @see _.flatten - */ - flatten(this: LoDashImplicitWrapper | null | undefined>, isDeep: boolean): LoDashImplicitWrapper; - /** * @see _.flatten */ @@ -944,11 +932,6 @@ declare module "../index" { } interface LoDashExplicitWrapper { - /** - * @see _.flatten - */ - flatten(this: LoDashExplicitWrapper | null | undefined>, isDeep: boolean): LoDashExplicitWrapper; - /** * @see _.flatten */ @@ -1102,8 +1085,7 @@ declare module "../index" { * 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. + * from the end of `array`. * * @category Array * @param array The array to search. @@ -1122,7 +1104,7 @@ declare module "../index" { indexOf( array: List | null | undefined, value: T, - fromIndex?: boolean|number + fromIndex?: number ): number; } @@ -1133,7 +1115,7 @@ declare module "../index" { indexOf( this: LoDashImplicitWrapper | null | undefined>, value: T, - fromIndex?: boolean|number + fromIndex?: number ): number; } @@ -1144,7 +1126,7 @@ declare module "../index" { indexOf( this: LoDashExplicitWrapper | null | undefined>, value: T, - fromIndex?: boolean|number + fromIndex?: number ): LoDashExplicitWrapper; } @@ -3463,7 +3445,7 @@ declare module "../index" { /** * @see _.zip */ - zip(...arrays: Array | null | undefined>): (T | undefined)[][]; + zip(...arrays: Array | null | undefined>): Array>; } interface LoDashImplicitWrapper { @@ -3842,4 +3824,4 @@ declare module "../index" { ...iteratee: Array<((...group: T[]) => TResult) | List | null | undefined> ): LoDashExplicitWrapper; } -} \ No newline at end of file +} diff --git a/types/lodash/common/collection.d.ts b/types/lodash/common/collection.d.ts index c8b2770610..3c7e65d38f 100644 --- a/types/lodash/common/collection.d.ts +++ b/types/lodash/common/collection.d.ts @@ -516,13 +516,13 @@ declare module "../index" { 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 predicate The function called per iteration. - * @param fromIndex The index to search from. - * @return The found element, else undefined. - **/ + * 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 predicate The function called per iteration. + * @param fromIndex The index to search from. + * @return The found element, else undefined. + */ findLast( collection: List | null | undefined, predicate: ListIteratorTypeGuard, @@ -2720,4 +2720,4 @@ declare module "../index" { ...iteratees: Array>> ): LoDashExplicitWrapper>; } -} \ No newline at end of file +} diff --git a/types/lodash/common/common.d.ts b/types/lodash/common/common.d.ts index 468019ea53..17d5e04b36 100644 --- a/types/lodash/common/common.d.ts +++ b/types/lodash/common/common.d.ts @@ -1,4 +1,5 @@ import _ = require("../index"); +// tslint:disable-next-line:strict-export-declare-modifiers type GlobalPartial = Partial; declare module "../index" { type PartialObject = GlobalPartial; @@ -86,7 +87,6 @@ declare module "../index" { 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. @@ -193,17 +193,23 @@ declare module "../index" { type StringIterator = (char: string, index: number, string: string) => TResult; + /** @deprecated Use MemoVoidArrayIterator or MemoVoidDictionaryIterator instead. */ type MemoVoidIterator = (prev: TResult, curr: T, indexOrKey: any, list: T[]) => void; - /** @deprecated Use MemoListIterator or MemoObjectIterator instead. */ + /** @deprecated Use MemoListIterator or MemoObjectIterator instead. */ type MemoIterator = (prev: TResult, curr: T, indexOrKey: any, list: T[]) => TResult; type MemoListIterator = (prev: TResult, curr: T, index: number, list: TList) => TResult; type MemoObjectIterator = (prev: TResult, curr: T, key: string, list: TList) => TResult; + type MemoIteratorCapped = (prev: TResult, curr: T) => TResult; + type MemoIteratorCappedRight = (curr: T, prev: TResult) => TResult; type MemoVoidArrayIterator = (acc: TResult, curr: T, index: number, arr: T[]) => void; type MemoVoidDictionaryIterator = (acc: TResult, curr: T, key: string, dict: Dictionary) => void; + type MemoVoidIteratorCapped = (acc: TResult, curr: T) => void; type ValueIteratee = ((value: T) => NotVoid) | string | [string, any] | PartialDeep; + type ValueIterateeCustom = ((value: T) => TResult) | string | [string, any] | PartialDeep; + type ValueIteratorTypeGuard = (value: T) => value is S; type ValueKeyIteratee = ((value: T, key: string) => NotVoid) | string | [string, any] | PartialDeep; type Comparator = (a: T, b: T) => boolean; type Comparator2 = (a: T1, b: T2) => boolean; diff --git a/types/lodash/common/date.d.ts b/types/lodash/common/date.d.ts index e460de4e1a..79131e4560 100644 --- a/types/lodash/common/date.d.ts +++ b/types/lodash/common/date.d.ts @@ -24,4 +24,4 @@ declare module "../index" { */ now(): LoDashExplicitWrapper; } -} \ No newline at end of file +} diff --git a/types/lodash/common/function.d.ts b/types/lodash/common/function.d.ts index b51fa6c625..31055a2781 100644 --- a/types/lodash/common/function.d.ts +++ b/types/lodash/common/function.d.ts @@ -667,30 +667,30 @@ declare module "../index" { // flip interface LoDashStatic { - /** - * Creates a function that invokes `func` with arguments reversed. - * - * @category Function - * @param func The function to flip arguments for. - * @returns Returns the new function. - * @example - * - * var flipped = _.flip(function() { - * return _.toArray(arguments); - * }); - * - * flipped('a', 'b', 'c', 'd'); - * // => ['d', 'c', 'b', 'a'] - */ - flip any>(func: T): T; - } + /** + * Creates a function that invokes `func` with arguments reversed. + * + * @category Function + * @param func The function to flip arguments for. + * @returns Returns the new function. + * @example + * + * var flipped = _.flip(function() { + * return _.toArray(arguments); + * }); + * + * flipped('a', 'b', 'c', 'd'); + * // => ['d', 'c', 'b', 'a'] + */ + flip any>(func: T): T; + } - interface LoDashWrapper { - /** - * @see _.flip - */ - flip(): this; - } + interface LoDashWrapper { + /** + * @see _.flip + */ + flip(): this; + } // memoize @@ -771,34 +771,34 @@ declare module "../index" { // overArgs - 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. - */ - overArgs( - func: (...args: any[]) => any, - ...transforms: Array any>> - ): (...args: any[]) => any; - } + 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. + */ + overArgs( + func: (...args: any[]) => any, + ...transforms: Array any>> + ): (...args: any[]) => any; + } - interface LoDashImplicitWrapper { - /** - * @see _.overArgs - */ - overArgs(...transforms: Array any>>): LoDashImplicitWrapper<(...args: any[]) => any>; - } + interface LoDashImplicitWrapper { + /** + * @see _.overArgs + */ + overArgs(...transforms: Array any>>): LoDashImplicitWrapper<(...args: any[]) => any>; + } - interface LoDashExplicitWrapper { - /** - * @see _.overArgs - */ - overArgs(...transforms: Array any>>): LoDashExplicitWrapper<(...args: any[]) => any>; - } + interface LoDashExplicitWrapper { + /** + * @see _.overArgs + */ + overArgs(...transforms: Array any>>): LoDashExplicitWrapper<(...args: any[]) => any>; + } // partial @@ -1364,4 +1364,4 @@ declare module "../index" { wrapper: (value: TValue, ...args: any[]) => TResult ): LoDashExplicitWrapper<(...args: any[]) => TResult>; } -} \ No newline at end of file +} diff --git a/types/lodash/common/lang.d.ts b/types/lodash/common/lang.d.ts index 43393ab4b6..9afe554b28 100644 --- a/types/lodash/common/lang.d.ts +++ b/types/lodash/common/lang.d.ts @@ -210,7 +210,6 @@ declare module "../index" { // conformsTo - interface LoDashStatic { /** * Checks if object conforms to source by invoking the predicate properties of source with the @@ -233,11 +232,11 @@ declare module "../index" { /** * @see _.conformsTo */ - conformsTo(this: LoDashImplicitWrapper, source: ConformsPredicateObject): LoDashExplicitWrapper; + conformsTo(this: LoDashExplicitWrapper, source: ConformsPredicateObject): LoDashExplicitWrapper; // Note: we can't use TValue here, because it generates a typescript error when strictFunctionTypes is enabled. } - type CondPair = [(val: T) => boolean, (val: T) => R] + type CondPair = [(val: T) => boolean, (val: T) => R]; // eq @@ -1934,4 +1933,4 @@ declare module "../index" { */ toString(value: any): string; } -} \ No newline at end of file +} diff --git a/types/lodash/common/math.d.ts b/types/lodash/common/math.d.ts index a0af6114b5..b38a7df970 100644 --- a/types/lodash/common/math.d.ts +++ b/types/lodash/common/math.d.ts @@ -529,8 +529,4 @@ declare module "../index" { iteratee?: ((value: T) => number) | string ): LoDashExplicitWrapper; } - - /********** - * Number * - **********/ -} \ No newline at end of file +} diff --git a/types/lodash/common/number.d.ts b/types/lodash/common/number.d.ts index 3e6a945855..7da1cab03a 100644 --- a/types/lodash/common/number.d.ts +++ b/types/lodash/common/number.d.ts @@ -175,8 +175,4 @@ declare module "../index" { floating?: boolean ): LoDashExplicitWrapper; } - - /********** - * Object * - **********/ -} \ No newline at end of file +} diff --git a/types/lodash/common/object.d.ts b/types/lodash/common/object.d.ts index 3063072b17..4bedba42ae 100644 --- a/types/lodash/common/object.d.ts +++ b/types/lodash/common/object.d.ts @@ -2281,7 +2281,7 @@ declare module "../index" { * TODO: This would be better if we had a separate overload for obj: NumericDictionary that returned a NumericDictionary, * but TypeScript cannot select overload signatures based on number vs string index key type. */ - mapValues(obj: Dictionary | NumericDictionary | null | undefined, callback: ObjectIterator, TResult>): Dictionary; + mapValues(obj: Dictionary | NumericDictionary | null | undefined, callback: DictionaryIterator): Dictionary; /** * @see _.mapValues @@ -2358,7 +2358,7 @@ declare module "../index" { */ mapValues( this: LoDashImplicitWrapper | NumericDictionary | null | undefined>, - callback: ObjectIterator, TResult> + callback: DictionaryIterator ): LoDashImplicitWrapper>; /** @@ -2454,7 +2454,7 @@ declare module "../index" { */ mapValues( this: LoDashExplicitWrapper | NumericDictionary | null | undefined>, - callback: ObjectIterator, TResult> + callback: DictionaryIterator ): LoDashExplicitWrapper>; /** @@ -2680,6 +2680,10 @@ declare module "../index" { * @see _.merge */ merge( + source1: TSource1, + source2: TSource2, + source3: TSource3, + source4: TSource4 ): LoDashExplicitWrapper; /** @@ -2692,7 +2696,7 @@ declare module "../index" { // mergeWith - type MergeWithCustomizer = { bivariantHack(value: any, srcValue: any, key: string, object: any, source: any): any; }["bivariantHack"] + type MergeWithCustomizer = { bivariantHack(value: any, srcValue: any, key: string, object: any, source: any): any; }["bivariantHack"]; interface LoDashStatic { /** @@ -2823,6 +2827,53 @@ declare module "../index" { ): LoDashImplicitWrapper; } + interface LoDashExplicitWrapper { + /** + * @see _.mergeWith + */ + mergeWith( + source: TSource, + customizer: MergeWithCustomizer + ): LoDashExplicitWrapper; + + /** + * @see _.mergeWith + */ + mergeWith( + source1: TSource1, + source2: TSource2, + customizer: MergeWithCustomizer + ): LoDashExplicitWrapper; + + /** + * @see _.mergeWith + */ + mergeWith( + source1: TSource1, + source2: TSource2, + source3: TSource3, + customizer: MergeWithCustomizer + ): LoDashExplicitWrapper; + + /** + * @see _.mergeWith + */ + mergeWith( + source1: TSource1, + source2: TSource2, + source3: TSource3, + source4: TSource4, + customizer: MergeWithCustomizer + ): LoDashExplicitWrapper; + + /** + * @see _.mergeWith + */ + mergeWith( + ...otherArgs: any[] + ): LoDashExplicitWrapper; + } + // omit interface LoDashStatic { @@ -3719,4 +3770,4 @@ declare module "../index" { */ valuesIn(this: LoDashExplicitWrapper): LoDashExplicitWrapper>; } -} \ No newline at end of file +} diff --git a/types/lodash/common/seq.d.ts b/types/lodash/common/seq.d.ts index f3139056cd..22a7a14746 100644 --- a/types/lodash/common/seq.d.ts +++ b/types/lodash/common/seq.d.ts @@ -195,4 +195,4 @@ declare module "../index" { */ thru(interceptor: (value: TValue) => TResult): LoDashExplicitWrapper; } -} \ No newline at end of file +} diff --git a/types/lodash/common/string.d.ts b/types/lodash/common/string.d.ts index 436a2bb9f1..d940406d0d 100644 --- a/types/lodash/common/string.d.ts +++ b/types/lodash/common/string.d.ts @@ -1056,4 +1056,4 @@ declare module "../index" { */ words(pattern?: string|RegExp): LoDashExplicitWrapper; } -} \ No newline at end of file +} diff --git a/types/lodash/common/util.d.ts b/types/lodash/common/util.d.ts index e365750018..69fbc42cc0 100644 --- a/types/lodash/common/util.d.ts +++ b/types/lodash/common/util.d.ts @@ -584,9 +584,17 @@ declare module "../index" { * // => [{ 'user': 'fred', 'age': 40 }] */ iteratee any>( - func: TFunction | string | object + func: TFunction ): TFunction; + /** + * @see _.iteratee + */ + // tslint:disable-next-line:unified-signatures Tests fail in TS2.3 if the overloads are joined + iteratee( + func: string | object + ): (...args: any[]) => any; + /** * @see _.iteratee */ @@ -1452,4 +1460,4 @@ declare module "../index" { */ uniqueId(): LoDashExplicitWrapper; } -} \ No newline at end of file +} diff --git a/types/lodash/fp.d.ts b/types/lodash/fp.d.ts new file mode 100644 index 0000000000..783a56a98f --- /dev/null +++ b/types/lodash/fp.d.ts @@ -0,0 +1,790 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import add = require("./fp/add"); +import after = require("./fp/after"); +import all = require("./fp/all"); +import allPass = require("./fp/allPass"); +import always = require("./fp/always"); +import any = require("./fp/any"); +import anyPass = require("./fp/anyPass"); +import apply = require("./fp/apply"); +import ary = require("./fp/ary"); +import assign = require("./fp/assign"); +import assignAll = require("./fp/assignAll"); +import assignAllWith = require("./fp/assignAllWith"); +import assignIn = require("./fp/assignIn"); +import assignInAll = require("./fp/assignInAll"); +import assignInAllWith = require("./fp/assignInAllWith"); +import assignInWith = require("./fp/assignInWith"); +import assignWith = require("./fp/assignWith"); +import assoc = require("./fp/assoc"); +import assocPath = require("./fp/assocPath"); +import at = require("./fp/at"); +import attempt = require("./fp/attempt"); +import before = require("./fp/before"); +import bind = require("./fp/bind"); +import bindAll = require("./fp/bindAll"); +import bindKey = require("./fp/bindKey"); +import camelCase = require("./fp/camelCase"); +import capitalize = require("./fp/capitalize"); +import castArray = require("./fp/castArray"); +import ceil = require("./fp/ceil"); +import chunk = require("./fp/chunk"); +import clamp = require("./fp/clamp"); +import clone = require("./fp/clone"); +import cloneDeep = require("./fp/cloneDeep"); +import cloneDeepWith = require("./fp/cloneDeepWith"); +import cloneWith = require("./fp/cloneWith"); +import compact = require("./fp/compact"); +import complement = require("./fp/complement"); +import compose = require("./fp/compose"); +import concat = require("./fp/concat"); +import cond = require("./fp/cond"); +import conforms = require("./fp/conforms"); +import conformsTo = require("./fp/conformsTo"); +import constant = require("./fp/constant"); +import contains = require("./fp/contains"); +import countBy = require("./fp/countBy"); +import create = require("./fp/create"); +import curry = require("./fp/curry"); +import curryN = require("./fp/curryN"); +import curryRight = require("./fp/curryRight"); +import curryRightN = require("./fp/curryRightN"); +import debounce = require("./fp/debounce"); +import deburr = require("./fp/deburr"); +import defaults = require("./fp/defaults"); +import defaultsAll = require("./fp/defaultsAll"); +import defaultsDeep = require("./fp/defaultsDeep"); +import defaultsDeepAll = require("./fp/defaultsDeepAll"); +import defaultTo = require("./fp/defaultTo"); +import defer = require("./fp/defer"); +import delay = require("./fp/delay"); +import difference = require("./fp/difference"); +import differenceBy = require("./fp/differenceBy"); +import differenceWith = require("./fp/differenceWith"); +import dissoc = require("./fp/dissoc"); +import dissocPath = require("./fp/dissocPath"); +import divide = require("./fp/divide"); +import drop = require("./fp/drop"); +import dropLast = require("./fp/dropLast"); +import dropLastWhile = require("./fp/dropLastWhile"); +import dropRight = require("./fp/dropRight"); +import dropRightWhile = require("./fp/dropRightWhile"); +import dropWhile = require("./fp/dropWhile"); +import each = require("./fp/each"); +import eachRight = require("./fp/eachRight"); +import endsWith = require("./fp/endsWith"); +import entries = require("./fp/entries"); +import entriesIn = require("./fp/entriesIn"); +import eq = require("./fp/eq"); +import equals = require("./fp/equals"); +import escape = require("./fp/escape"); +import escapeRegExp = require("./fp/escapeRegExp"); +import every = require("./fp/every"); +import extend = require("./fp/extend"); +import extendAll = require("./fp/extendAll"); +import extendAllWith = require("./fp/extendAllWith"); +import extendWith = require("./fp/extendWith"); +import F = require("./fp/F"); +import fill = require("./fp/fill"); +import filter = require("./fp/filter"); +import find = require("./fp/find"); +import findFrom = require("./fp/findFrom"); +import findIndex = require("./fp/findIndex"); +import findIndexFrom = require("./fp/findIndexFrom"); +import findKey = require("./fp/findKey"); +import findLast = require("./fp/findLast"); +import findLastFrom = require("./fp/findLastFrom"); +import findLastIndex = require("./fp/findLastIndex"); +import findLastIndexFrom = require("./fp/findLastIndexFrom"); +import findLastKey = require("./fp/findLastKey"); +import first = require("./fp/first"); +import flatMap = require("./fp/flatMap"); +import flatMapDeep = require("./fp/flatMapDeep"); +import flatMapDepth = require("./fp/flatMapDepth"); +import flatten = require("./fp/flatten"); +import flattenDeep = require("./fp/flattenDeep"); +import flattenDepth = require("./fp/flattenDepth"); +import flip = require("./fp/flip"); +import floor = require("./fp/floor"); +import flow = require("./fp/flow"); +import flowRight = require("./fp/flowRight"); +import forEach = require("./fp/forEach"); +import forEachRight = require("./fp/forEachRight"); +import forIn = require("./fp/forIn"); +import forInRight = require("./fp/forInRight"); +import forOwn = require("./fp/forOwn"); +import forOwnRight = require("./fp/forOwnRight"); +import fromPairs = require("./fp/fromPairs"); +import functions = require("./fp/functions"); +import functionsIn = require("./fp/functionsIn"); +import get = require("./fp/get"); +import getOr = require("./fp/getOr"); +import groupBy = require("./fp/groupBy"); +import gt = require("./fp/gt"); +import gte = require("./fp/gte"); +import has = require("./fp/has"); +import hasIn = require("./fp/hasIn"); +import head = require("./fp/head"); +import identical = require("./fp/identical"); +import identity = require("./fp/identity"); +import includes = require("./fp/includes"); +import includesFrom = require("./fp/includesFrom"); +import indexBy = require("./fp/indexBy"); +import indexOf = require("./fp/indexOf"); +import indexOfFrom = require("./fp/indexOfFrom"); +import init = require("./fp/init"); +import initial = require("./fp/initial"); +import inRange = require("./fp/inRange"); +import intersection = require("./fp/intersection"); +import intersectionBy = require("./fp/intersectionBy"); +import intersectionWith = require("./fp/intersectionWith"); +import invert = require("./fp/invert"); +import invertBy = require("./fp/invertBy"); +import invertObj = require("./fp/invertObj"); +import invoke = require("./fp/invoke"); +import invokeArgs = require("./fp/invokeArgs"); +import invokeArgsMap = require("./fp/invokeArgsMap"); +import invokeMap = require("./fp/invokeMap"); +import isArguments = require("./fp/isArguments"); +import isArray = require("./fp/isArray"); +import isArrayBuffer = require("./fp/isArrayBuffer"); +import isArrayLike = require("./fp/isArrayLike"); +import isArrayLikeObject = require("./fp/isArrayLikeObject"); +import isBoolean = require("./fp/isBoolean"); +import isBuffer = require("./fp/isBuffer"); +import isDate = require("./fp/isDate"); +import isElement = require("./fp/isElement"); +import isEmpty = require("./fp/isEmpty"); +import isEqual = require("./fp/isEqual"); +import isEqualWith = require("./fp/isEqualWith"); +import isError = require("./fp/isError"); +import isFinite = require("./fp/isFinite"); +import isFunction = require("./fp/isFunction"); +import isInteger = require("./fp/isInteger"); +import isLength = require("./fp/isLength"); +import isMap = require("./fp/isMap"); +import isMatch = require("./fp/isMatch"); +import isMatchWith = require("./fp/isMatchWith"); +import isNaN = require("./fp/isNaN"); +import isNative = require("./fp/isNative"); +import isNil = require("./fp/isNil"); +import isNull = require("./fp/isNull"); +import isNumber = require("./fp/isNumber"); +import isObject = require("./fp/isObject"); +import isObjectLike = require("./fp/isObjectLike"); +import isPlainObject = require("./fp/isPlainObject"); +import isRegExp = require("./fp/isRegExp"); +import isSafeInteger = require("./fp/isSafeInteger"); +import isSet = require("./fp/isSet"); +import isString = require("./fp/isString"); +import isSymbol = require("./fp/isSymbol"); +import isTypedArray = require("./fp/isTypedArray"); +import isUndefined = require("./fp/isUndefined"); +import isWeakMap = require("./fp/isWeakMap"); +import isWeakSet = require("./fp/isWeakSet"); +import iteratee = require("./fp/iteratee"); +import join = require("./fp/join"); +import juxt = require("./fp/juxt"); +import kebabCase = require("./fp/kebabCase"); +import keyBy = require("./fp/keyBy"); +import keys = require("./fp/keys"); +import keysIn = require("./fp/keysIn"); +import last = require("./fp/last"); +import lastIndexOf = require("./fp/lastIndexOf"); +import lastIndexOfFrom = require("./fp/lastIndexOfFrom"); +import lowerCase = require("./fp/lowerCase"); +import lowerFirst = require("./fp/lowerFirst"); +import lt = require("./fp/lt"); +import lte = require("./fp/lte"); +import map = require("./fp/map"); +import mapKeys = require("./fp/mapKeys"); +import mapValues = require("./fp/mapValues"); +import matches = require("./fp/matches"); +import matchesProperty = require("./fp/matchesProperty"); +import max = require("./fp/max"); +import maxBy = require("./fp/maxBy"); +import mean = require("./fp/mean"); +import meanBy = require("./fp/meanBy"); +import memoize = require("./fp/memoize"); +import merge = require("./fp/merge"); +import mergeAll = require("./fp/mergeAll"); +import mergeAllWith = require("./fp/mergeAllWith"); +import mergeWith = require("./fp/mergeWith"); +import method = require("./fp/method"); +import methodOf = require("./fp/methodOf"); +import min = require("./fp/min"); +import minBy = require("./fp/minBy"); +import multiply = require("./fp/multiply"); +import nAry = require("./fp/nAry"); +import negate = require("./fp/negate"); +import noConflict = require("./fp/noConflict"); +import noop = require("./fp/noop"); +import now = require("./fp/now"); +import nth = require("./fp/nth"); +import nthArg = require("./fp/nthArg"); +import omit = require("./fp/omit"); +import omitAll = require("./fp/omitAll"); +import omitBy = require("./fp/omitBy"); +import once = require("./fp/once"); +import orderBy = require("./fp/orderBy"); +import over = require("./fp/over"); +import overArgs = require("./fp/overArgs"); +import overEvery = require("./fp/overEvery"); +import overSome = require("./fp/overSome"); +import pad = require("./fp/pad"); +import padChars = require("./fp/padChars"); +import padCharsEnd = require("./fp/padCharsEnd"); +import padCharsStart = require("./fp/padCharsStart"); +import padEnd = require("./fp/padEnd"); +import padStart = require("./fp/padStart"); +import parseInt = require("./fp/parseInt"); +import partial = require("./fp/partial"); +import partialRight = require("./fp/partialRight"); +import partition = require("./fp/partition"); +import path = require("./fp/path"); +import pathEq = require("./fp/pathEq"); +import pathOr = require("./fp/pathOr"); +import paths = require("./fp/paths"); +import pick = require("./fp/pick"); +import pickAll = require("./fp/pickAll"); +import pickBy = require("./fp/pickBy"); +import pipe = require("./fp/pipe"); +import pluck = require("./fp/pluck"); +import prop = require("./fp/prop"); +import propEq = require("./fp/propEq"); +import property = require("./fp/property"); +import propertyOf = require("./fp/propertyOf"); +import propOr = require("./fp/propOr"); +import props = require("./fp/props"); +import pull = require("./fp/pull"); +import pullAll = require("./fp/pullAll"); +import pullAllBy = require("./fp/pullAllBy"); +import pullAllWith = require("./fp/pullAllWith"); +import pullAt = require("./fp/pullAt"); +import random = require("./fp/random"); +import range = require("./fp/range"); +import rangeRight = require("./fp/rangeRight"); +import rangeStep = require("./fp/rangeStep"); +import rangeStepRight = require("./fp/rangeStepRight"); +import rearg = require("./fp/rearg"); +import reduce = require("./fp/reduce"); +import reduceRight = require("./fp/reduceRight"); +import reject = require("./fp/reject"); +import remove = require("./fp/remove"); +import repeat = require("./fp/repeat"); +import replace = require("./fp/replace"); +import rest = require("./fp/rest"); +import restFrom = require("./fp/restFrom"); +import result = require("./fp/result"); +import reverse = require("./fp/reverse"); +import round = require("./fp/round"); +import runInContext = require("./fp/runInContext"); +import sample = require("./fp/sample"); +import sampleSize = require("./fp/sampleSize"); +import set = require("./fp/set"); +import setWith = require("./fp/setWith"); +import shuffle = require("./fp/shuffle"); +import size = require("./fp/size"); +import slice = require("./fp/slice"); +import snakeCase = require("./fp/snakeCase"); +import some = require("./fp/some"); +import sortBy = require("./fp/sortBy"); +import sortedIndex = require("./fp/sortedIndex"); +import sortedIndexBy = require("./fp/sortedIndexBy"); +import sortedIndexOf = require("./fp/sortedIndexOf"); +import sortedLastIndex = require("./fp/sortedLastIndex"); +import sortedLastIndexBy = require("./fp/sortedLastIndexBy"); +import sortedLastIndexOf = require("./fp/sortedLastIndexOf"); +import sortedUniq = require("./fp/sortedUniq"); +import sortedUniqBy = require("./fp/sortedUniqBy"); +import split = require("./fp/split"); +import spread = require("./fp/spread"); +import spreadFrom = require("./fp/spreadFrom"); +import startCase = require("./fp/startCase"); +import startsWith = require("./fp/startsWith"); +import stubArray = require("./fp/stubArray"); +import stubFalse = require("./fp/stubFalse"); +import stubObject = require("./fp/stubObject"); +import stubString = require("./fp/stubString"); +import stubTrue = require("./fp/stubTrue"); +import subtract = require("./fp/subtract"); +import sum = require("./fp/sum"); +import sumBy = require("./fp/sumBy"); +import symmetricDifference = require("./fp/symmetricDifference"); +import symmetricDifferenceBy = require("./fp/symmetricDifferenceBy"); +import symmetricDifferenceWith = require("./fp/symmetricDifferenceWith"); +import T = require("./fp/T"); +import tail = require("./fp/tail"); +import take = require("./fp/take"); +import takeLast = require("./fp/takeLast"); +import takeLastWhile = require("./fp/takeLastWhile"); +import takeRight = require("./fp/takeRight"); +import takeRightWhile = require("./fp/takeRightWhile"); +import takeWhile = require("./fp/takeWhile"); +import tap = require("./fp/tap"); +import template = require("./fp/template"); +import throttle = require("./fp/throttle"); +import thru = require("./fp/thru"); +import times = require("./fp/times"); +import toArray = require("./fp/toArray"); +import toFinite = require("./fp/toFinite"); +import toInteger = require("./fp/toInteger"); +import toLength = require("./fp/toLength"); +import toLower = require("./fp/toLower"); +import toNumber = require("./fp/toNumber"); +import toPairs = require("./fp/toPairs"); +import toPairsIn = require("./fp/toPairsIn"); +import toPath = require("./fp/toPath"); +import toPlainObject = require("./fp/toPlainObject"); +import toSafeInteger = require("./fp/toSafeInteger"); +import toString = require("./fp/toString"); +import toUpper = require("./fp/toUpper"); +import transform = require("./fp/transform"); +import trim = require("./fp/trim"); +import trimChars = require("./fp/trimChars"); +import trimCharsEnd = require("./fp/trimCharsEnd"); +import trimCharsStart = require("./fp/trimCharsStart"); +import trimEnd = require("./fp/trimEnd"); +import trimStart = require("./fp/trimStart"); +import truncate = require("./fp/truncate"); +import unapply = require("./fp/unapply"); +import unary = require("./fp/unary"); +import unescape = require("./fp/unescape"); +import union = require("./fp/union"); +import unionBy = require("./fp/unionBy"); +import unionWith = require("./fp/unionWith"); +import uniq = require("./fp/uniq"); +import uniqBy = require("./fp/uniqBy"); +import uniqueId = require("./fp/uniqueId"); +import uniqWith = require("./fp/uniqWith"); +import unnest = require("./fp/unnest"); +import unset = require("./fp/unset"); +import unzip = require("./fp/unzip"); +import unzipWith = require("./fp/unzipWith"); +import update = require("./fp/update"); +import updateWith = require("./fp/updateWith"); +import upperCase = require("./fp/upperCase"); +import upperFirst = require("./fp/upperFirst"); +import useWith = require("./fp/useWith"); +import values = require("./fp/values"); +import valuesIn = require("./fp/valuesIn"); +import where = require("./fp/where"); +import whereEq = require("./fp/whereEq"); +import without = require("./fp/without"); +import words = require("./fp/words"); +import wrap = require("./fp/wrap"); +import xor = require("./fp/xor"); +import xorBy = require("./fp/xorBy"); +import xorWith = require("./fp/xorWith"); +import zip = require("./fp/zip"); +import zipAll = require("./fp/zipAll"); +import zipObj = require("./fp/zipObj"); +import zipObject = require("./fp/zipObject"); +import zipObjectDeep = require("./fp/zipObjectDeep"); +import zipWith = require("./fp/zipWith"); + +export = _; + +declare const _: _.LoDashFp; +declare namespace _ { + interface LoDashFp { + add: typeof add; + after: typeof after; + all: typeof all; + allPass: typeof allPass; + always: typeof always; + any: typeof any; + anyPass: typeof anyPass; + apply: typeof apply; + ary: typeof ary; + assign: typeof assign; + assignAll: typeof assignAll; + assignAllWith: typeof assignAllWith; + assignIn: typeof assignIn; + assignInAll: typeof assignInAll; + assignInAllWith: typeof assignInAllWith; + assignInWith: typeof assignInWith; + assignWith: typeof assignWith; + assoc: typeof assoc; + assocPath: typeof assocPath; + at: typeof at; + attempt: typeof attempt; + before: typeof before; + bind: typeof bind; + bindAll: typeof bindAll; + bindKey: typeof bindKey; + camelCase: typeof camelCase; + capitalize: typeof capitalize; + castArray: typeof castArray; + ceil: typeof ceil; + chunk: typeof chunk; + clamp: typeof clamp; + clone: typeof clone; + cloneDeep: typeof cloneDeep; + cloneDeepWith: typeof cloneDeepWith; + cloneWith: typeof cloneWith; + compact: typeof compact; + complement: typeof complement; + compose: typeof compose; + concat: typeof concat; + cond: typeof cond; + conforms: typeof conforms; + conformsTo: typeof conformsTo; + constant: typeof constant; + contains: typeof contains; + countBy: typeof countBy; + create: typeof create; + curry: typeof curry; + curryN: typeof curryN; + curryRight: typeof curryRight; + curryRightN: typeof curryRightN; + debounce: typeof debounce; + deburr: typeof deburr; + defaults: typeof defaults; + defaultsAll: typeof defaultsAll; + defaultsDeep: typeof defaultsDeep; + defaultsDeepAll: typeof defaultsDeepAll; + defaultTo: typeof defaultTo; + defer: typeof defer; + delay: typeof delay; + difference: typeof difference; + differenceBy: typeof differenceBy; + differenceWith: typeof differenceWith; + dissoc: typeof dissoc; + dissocPath: typeof dissocPath; + divide: typeof divide; + drop: typeof drop; + dropLast: typeof dropLast; + dropLastWhile: typeof dropLastWhile; + dropRight: typeof dropRight; + dropRightWhile: typeof dropRightWhile; + dropWhile: typeof dropWhile; + each: typeof each; + eachRight: typeof eachRight; + endsWith: typeof endsWith; + entries: typeof entries; + entriesIn: typeof entriesIn; + eq: typeof eq; + equals: typeof equals; + escape: typeof escape; + escapeRegExp: typeof escapeRegExp; + every: typeof every; + extend: typeof extend; + extendAll: typeof extendAll; + extendAllWith: typeof extendAllWith; + extendWith: typeof extendWith; + F: typeof F; + fill: typeof fill; + filter: typeof filter; + find: typeof find; + findFrom: typeof findFrom; + findIndex: typeof findIndex; + findIndexFrom: typeof findIndexFrom; + findKey: typeof findKey; + findLast: typeof findLast; + findLastFrom: typeof findLastFrom; + findLastIndex: typeof findLastIndex; + findLastIndexFrom: typeof findLastIndexFrom; + findLastKey: typeof findLastKey; + first: typeof first; + flatMap: typeof flatMap; + flatMapDeep: typeof flatMapDeep; + flatMapDepth: typeof flatMapDepth; + flatten: typeof flatten; + flattenDeep: typeof flattenDeep; + flattenDepth: typeof flattenDepth; + flip: typeof flip; + floor: typeof floor; + flow: typeof flow; + flowRight: typeof flowRight; + forEach: typeof forEach; + forEachRight: typeof forEachRight; + forIn: typeof forIn; + forInRight: typeof forInRight; + forOwn: typeof forOwn; + forOwnRight: typeof forOwnRight; + fromPairs: typeof fromPairs; + functions: typeof functions; + functionsIn: typeof functionsIn; + get: typeof get; + getOr: typeof getOr; + groupBy: typeof groupBy; + gt: typeof gt; + gte: typeof gte; + has: typeof has; + hasIn: typeof hasIn; + head: typeof head; + identical: typeof identical; + identity: typeof identity; + includes: typeof includes; + includesFrom: typeof includesFrom; + indexBy: typeof indexBy; + indexOf: typeof indexOf; + indexOfFrom: typeof indexOfFrom; + init: typeof init; + initial: typeof initial; + inRange: typeof inRange; + intersection: typeof intersection; + intersectionBy: typeof intersectionBy; + intersectionWith: typeof intersectionWith; + invert: typeof invert; + invertBy: typeof invertBy; + invertObj: typeof invertObj; + invoke: typeof invoke; + invokeArgs: typeof invokeArgs; + invokeArgsMap: typeof invokeArgsMap; + invokeMap: typeof invokeMap; + isArguments: typeof isArguments; + isArray: typeof isArray; + isArrayBuffer: typeof isArrayBuffer; + isArrayLike: typeof isArrayLike; + isArrayLikeObject: typeof isArrayLikeObject; + isBoolean: typeof isBoolean; + isBuffer: typeof isBuffer; + isDate: typeof isDate; + isElement: typeof isElement; + isEmpty: typeof isEmpty; + isEqual: typeof isEqual; + isEqualWith: typeof isEqualWith; + isError: typeof isError; + isFinite: typeof isFinite; + isFunction: typeof isFunction; + isInteger: typeof isInteger; + isLength: typeof isLength; + isMap: typeof isMap; + isMatch: typeof isMatch; + isMatchWith: typeof isMatchWith; + isNaN: typeof isNaN; + isNative: typeof isNative; + isNil: typeof isNil; + isNull: typeof isNull; + isNumber: typeof isNumber; + isObject: typeof isObject; + isObjectLike: typeof isObjectLike; + isPlainObject: typeof isPlainObject; + isRegExp: typeof isRegExp; + isSafeInteger: typeof isSafeInteger; + isSet: typeof isSet; + isString: typeof isString; + isSymbol: typeof isSymbol; + isTypedArray: typeof isTypedArray; + isUndefined: typeof isUndefined; + isWeakMap: typeof isWeakMap; + isWeakSet: typeof isWeakSet; + iteratee: typeof iteratee; + join: typeof join; + juxt: typeof juxt; + kebabCase: typeof kebabCase; + keyBy: typeof keyBy; + keys: typeof keys; + keysIn: typeof keysIn; + last: typeof last; + lastIndexOf: typeof lastIndexOf; + lastIndexOfFrom: typeof lastIndexOfFrom; + lowerCase: typeof lowerCase; + lowerFirst: typeof lowerFirst; + lt: typeof lt; + lte: typeof lte; + map: typeof map; + mapKeys: typeof mapKeys; + mapValues: typeof mapValues; + matches: typeof matches; + matchesProperty: typeof matchesProperty; + max: typeof max; + maxBy: typeof maxBy; + mean: typeof mean; + meanBy: typeof meanBy; + memoize: typeof memoize; + merge: typeof merge; + mergeAll: typeof mergeAll; + mergeAllWith: typeof mergeAllWith; + mergeWith: typeof mergeWith; + method: typeof method; + methodOf: typeof methodOf; + min: typeof min; + minBy: typeof minBy; + multiply: typeof multiply; + nAry: typeof nAry; + negate: typeof negate; + noConflict: typeof noConflict; + noop: typeof noop; + now: typeof now; + nth: typeof nth; + nthArg: typeof nthArg; + omit: typeof omit; + omitAll: typeof omitAll; + omitBy: typeof omitBy; + once: typeof once; + orderBy: typeof orderBy; + over: typeof over; + overArgs: typeof overArgs; + overEvery: typeof overEvery; + overSome: typeof overSome; + pad: typeof pad; + padChars: typeof padChars; + padCharsEnd: typeof padCharsEnd; + padCharsStart: typeof padCharsStart; + padEnd: typeof padEnd; + padStart: typeof padStart; + parseInt: typeof parseInt; + partial: typeof partial; + partialRight: typeof partialRight; + partition: typeof partition; + path: typeof path; + pathEq: typeof pathEq; + pathOr: typeof pathOr; + paths: typeof paths; + pick: typeof pick; + pickAll: typeof pickAll; + pickBy: typeof pickBy; + pipe: typeof pipe; + pluck: typeof pluck; + prop: typeof prop; + propEq: typeof propEq; + property: typeof property; + propertyOf: typeof propertyOf; + propOr: typeof propOr; + props: typeof props; + pull: typeof pull; + pullAll: typeof pullAll; + pullAllBy: typeof pullAllBy; + pullAllWith: typeof pullAllWith; + pullAt: typeof pullAt; + random: typeof random; + range: typeof range; + rangeRight: typeof rangeRight; + rangeStep: typeof rangeStep; + rangeStepRight: typeof rangeStepRight; + rearg: typeof rearg; + reduce: typeof reduce; + reduceRight: typeof reduceRight; + reject: typeof reject; + remove: typeof remove; + repeat: typeof repeat; + replace: typeof replace; + rest: typeof rest; + restFrom: typeof restFrom; + result: typeof result; + reverse: typeof reverse; + round: typeof round; + runInContext: typeof runInContext; + sample: typeof sample; + sampleSize: typeof sampleSize; + set: typeof set; + setWith: typeof setWith; + shuffle: typeof shuffle; + size: typeof size; + slice: typeof slice; + snakeCase: typeof snakeCase; + some: typeof some; + sortBy: typeof sortBy; + sortedIndex: typeof sortedIndex; + sortedIndexBy: typeof sortedIndexBy; + sortedIndexOf: typeof sortedIndexOf; + sortedLastIndex: typeof sortedLastIndex; + sortedLastIndexBy: typeof sortedLastIndexBy; + sortedLastIndexOf: typeof sortedLastIndexOf; + sortedUniq: typeof sortedUniq; + sortedUniqBy: typeof sortedUniqBy; + split: typeof split; + spread: typeof spread; + spreadFrom: typeof spreadFrom; + startCase: typeof startCase; + startsWith: typeof startsWith; + stubArray: typeof stubArray; + stubFalse: typeof stubFalse; + stubObject: typeof stubObject; + stubString: typeof stubString; + stubTrue: typeof stubTrue; + subtract: typeof subtract; + sum: typeof sum; + sumBy: typeof sumBy; + symmetricDifference: typeof symmetricDifference; + symmetricDifferenceBy: typeof symmetricDifferenceBy; + symmetricDifferenceWith: typeof symmetricDifferenceWith; + T: typeof T; + tail: typeof tail; + take: typeof take; + takeLast: typeof takeLast; + takeLastWhile: typeof takeLastWhile; + takeRight: typeof takeRight; + takeRightWhile: typeof takeRightWhile; + takeWhile: typeof takeWhile; + tap: typeof tap; + template: typeof template; + throttle: typeof throttle; + thru: typeof thru; + times: typeof times; + toArray: typeof toArray; + toFinite: typeof toFinite; + toInteger: typeof toInteger; + toLength: typeof toLength; + toLower: typeof toLower; + toNumber: typeof toNumber; + toPairs: typeof toPairs; + toPairsIn: typeof toPairsIn; + toPath: typeof toPath; + toPlainObject: typeof toPlainObject; + toSafeInteger: typeof toSafeInteger; + toString: typeof toString; + toUpper: typeof toUpper; + transform: typeof transform; + trim: typeof trim; + trimChars: typeof trimChars; + trimCharsEnd: typeof trimCharsEnd; + trimCharsStart: typeof trimCharsStart; + trimEnd: typeof trimEnd; + trimStart: typeof trimStart; + truncate: typeof truncate; + unapply: typeof unapply; + unary: typeof unary; + unescape: typeof unescape; + union: typeof union; + unionBy: typeof unionBy; + unionWith: typeof unionWith; + uniq: typeof uniq; + uniqBy: typeof uniqBy; + uniqueId: typeof uniqueId; + uniqWith: typeof uniqWith; + unnest: typeof unnest; + unset: typeof unset; + unzip: typeof unzip; + unzipWith: typeof unzipWith; + update: typeof update; + updateWith: typeof updateWith; + upperCase: typeof upperCase; + upperFirst: typeof upperFirst; + useWith: typeof useWith; + values: typeof values; + valuesIn: typeof valuesIn; + where: typeof where; + whereEq: typeof whereEq; + without: typeof without; + words: typeof words; + wrap: typeof wrap; + xor: typeof xor; + xorBy: typeof xorBy; + xorWith: typeof xorWith; + zip: typeof zip; + zipAll: typeof zipAll; + zipObj: typeof zipObj; + zipObject: typeof zipObject; + zipObjectDeep: typeof zipObjectDeep; + zipWith: typeof zipWith; + } +} + +// Backward compatibility with --target es5 +declare global { + // tslint:disable-next-line:no-empty-interface + interface Set { } + // tslint:disable-next-line:no-empty-interface + interface Map { } + // tslint:disable-next-line:no-empty-interface + interface WeakSet { } + // tslint:disable-next-line:no-empty-interface + interface WeakMap { } +} diff --git a/types/lodash/fp/F.d.ts b/types/lodash/fp/F.d.ts new file mode 100644 index 0000000000..8d7802efd8 --- /dev/null +++ b/types/lodash/fp/F.d.ts @@ -0,0 +1,14 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type StubFalse = + /** + * This method returns `false`. + * + * @returns Returns `false`. + */ + () => boolean; + +declare const F: StubFalse; +export = F; diff --git a/types/lodash/fp/T.d.ts b/types/lodash/fp/T.d.ts new file mode 100644 index 0000000000..ea1dc32ee8 --- /dev/null +++ b/types/lodash/fp/T.d.ts @@ -0,0 +1,14 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type StubTrue = + /** + * This method returns `true`. + * + * @returns Returns `true`. + */ + () => boolean; + +declare const T: StubTrue; +export = T; diff --git a/types/lodash/fp/add.d.ts b/types/lodash/fp/add.d.ts new file mode 100644 index 0000000000..2977814de9 --- /dev/null +++ b/types/lodash/fp/add.d.ts @@ -0,0 +1,51 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface Add { + /** + * Adds two numbers. + * + * @param augend The first number to add. + * @param addend The second number to add. + * @return Returns the sum. + */ + (): Add; + /** + * Adds two numbers. + * + * @param augend The first number to add. + * @param addend The second number to add. + * @return Returns the sum. + */ + (augend: number): Add1x1; + /** + * Adds two numbers. + * + * @param augend The first number to add. + * @param addend The second number to add. + * @return Returns the sum. + */ + (augend: number, addend: number): number; +} +interface Add1x1 { + /** + * Adds two numbers. + * + * @param augend The first number to add. + * @param addend The second number to add. + * @return Returns the sum. + */ + (): Add1x1; + /** + * Adds two numbers. + * + * @param augend The first number to add. + * @param addend The second number to add. + * @return Returns the sum. + */ + (addend: number): number; +} + +declare const add: Add; +export = add; diff --git a/types/lodash/fp/after.d.ts b/types/lodash/fp/after.d.ts new file mode 100644 index 0000000000..c6b21973d0 --- /dev/null +++ b/types/lodash/fp/after.d.ts @@ -0,0 +1,51 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface After { + /** + * 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; + /** + * 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. + */ + any>(func: TFunc): After1x1; + /** + * 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. + */ + any>(func: TFunc, n: number): TFunc; +} +interface After1x1 any> { + /** + * 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. + */ + (): After1x1; + /** + * 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. + */ + (n: number): TFunc; +} + +declare const after: After; +export = after; diff --git a/types/lodash/fp/all.d.ts b/types/lodash/fp/all.d.ts new file mode 100644 index 0000000000..15f37bae09 --- /dev/null +++ b/types/lodash/fp/all.d.ts @@ -0,0 +1,67 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Every { + /** + * Checks if predicate returns truthy for all elements of collection. Iteration is stopped once predicate + * returns falsey. The predicate is invoked with three arguments: (value, index|key, collection). + * + * @param collection The collection to iterate over. + * @param predicate The function invoked per iteration. + * @return Returns true if all elements pass the predicate check, else false. + */ + (): Every; + /** + * Checks if predicate returns truthy for all elements of collection. Iteration is stopped once predicate + * returns falsey. The predicate is invoked with three arguments: (value, index|key, collection). + * + * @param collection The collection to iterate over. + * @param predicate The function invoked per iteration. + * @return Returns true if all elements pass the predicate check, else false. + */ + (predicate: _.ValueIterateeCustom): Every1x1; + /** + * Checks if predicate returns truthy for all elements of collection. Iteration is stopped once predicate + * returns falsey. The predicate is invoked with three arguments: (value, index|key, collection). + * + * @param collection The collection to iterate over. + * @param predicate The function invoked per iteration. + * @return Returns true if all elements pass the predicate check, else false. + */ + (predicate: _.ValueIterateeCustom, collection: _.List | null | undefined): boolean; + /** + * Checks if predicate returns truthy for all elements of collection. Iteration is stopped once predicate + * returns falsey. The predicate is invoked with three arguments: (value, index|key, collection). + * + * @param collection The collection to iterate over. + * @param predicate The function invoked per iteration. + * @return Returns true if all elements pass the predicate check, else false. + */ + (predicate: _.ValueIterateeCustom, collection: T | null | undefined): boolean; +} +interface Every1x1 { + /** + * Checks if predicate returns truthy for all elements of collection. Iteration is stopped once predicate + * returns falsey. The predicate is invoked with three arguments: (value, index|key, collection). + * + * @param collection The collection to iterate over. + * @param predicate The function invoked per iteration. + * @return Returns true if all elements pass the predicate check, else false. + */ + (): Every1x1; + /** + * Checks if predicate returns truthy for all elements of collection. Iteration is stopped once predicate + * returns falsey. The predicate is invoked with three arguments: (value, index|key, collection). + * + * @param collection The collection to iterate over. + * @param predicate The function invoked per iteration. + * @return Returns true if all elements pass the predicate check, else false. + */ + (collection: _.List | object | null | undefined): boolean; +} + +declare const all: Every; +export = all; diff --git a/types/lodash/fp/allPass.d.ts b/types/lodash/fp/allPass.d.ts new file mode 100644 index 0000000000..564484494e --- /dev/null +++ b/types/lodash/fp/allPass.d.ts @@ -0,0 +1,18 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +type OverEvery = + /** + * Creates a function that checks if all of the predicates return truthy when invoked with the arguments + * provided to the created function. + * + * @param predicates The predicates to check. + * @return Returns the new function. + */ + (predicates: _.Many<(...args: T[]) => boolean>) => (...args: T[]) => boolean; + +declare const allPass: OverEvery; +export = allPass; diff --git a/types/lodash/fp/always.d.ts b/types/lodash/fp/always.d.ts new file mode 100644 index 0000000000..bd22aed21f --- /dev/null +++ b/types/lodash/fp/always.d.ts @@ -0,0 +1,15 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type Constant = + /** + * Creates a function that returns value. + * + * @param value The value to return from the new function. + * @return Returns the new function. + */ + (value: T) => () => T; + +declare const always: Constant; +export = always; diff --git a/types/lodash/fp/any.d.ts b/types/lodash/fp/any.d.ts new file mode 100644 index 0000000000..32cf83d382 --- /dev/null +++ b/types/lodash/fp/any.d.ts @@ -0,0 +1,67 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Some { + /** + * Checks if predicate returns truthy for any element of collection. Iteration is stopped once predicate + * returns truthy. The predicate is invoked with three arguments: (value, index|key, collection). + * + * @param collection The collection to iterate over. + * @param predicate The function invoked per iteration. + * @return Returns true if any element passes the predicate check, else false. + */ + (): Some; + /** + * Checks if predicate returns truthy for any element of collection. Iteration is stopped once predicate + * returns truthy. The predicate is invoked with three arguments: (value, index|key, collection). + * + * @param collection The collection to iterate over. + * @param predicate The function invoked per iteration. + * @return Returns true if any element passes the predicate check, else false. + */ + (predicate: _.ValueIterateeCustom): Some1x1; + /** + * Checks if predicate returns truthy for any element of collection. Iteration is stopped once predicate + * returns truthy. The predicate is invoked with three arguments: (value, index|key, collection). + * + * @param collection The collection to iterate over. + * @param predicate The function invoked per iteration. + * @return Returns true if any element passes the predicate check, else false. + */ + (predicate: _.ValueIterateeCustom, collection: _.List | null | undefined): boolean; + /** + * Checks if predicate returns truthy for any element of collection. Iteration is stopped once predicate + * returns truthy. The predicate is invoked with three arguments: (value, index|key, collection). + * + * @param collection The collection to iterate over. + * @param predicate The function invoked per iteration. + * @return Returns true if any element passes the predicate check, else false. + */ + (predicate: _.ValueIterateeCustom, collection: T | null | undefined): boolean; +} +interface Some1x1 { + /** + * Checks if predicate returns truthy for any element of collection. Iteration is stopped once predicate + * returns truthy. The predicate is invoked with three arguments: (value, index|key, collection). + * + * @param collection The collection to iterate over. + * @param predicate The function invoked per iteration. + * @return Returns true if any element passes the predicate check, else false. + */ + (): Some1x1; + /** + * Checks if predicate returns truthy for any element of collection. Iteration is stopped once predicate + * returns truthy. The predicate is invoked with three arguments: (value, index|key, collection). + * + * @param collection The collection to iterate over. + * @param predicate The function invoked per iteration. + * @return Returns true if any element passes the predicate check, else false. + */ + (collection: _.List | object | null | undefined): boolean; +} + +declare const any: Some; +export = any; diff --git a/types/lodash/fp/anyPass.d.ts b/types/lodash/fp/anyPass.d.ts new file mode 100644 index 0000000000..0666de68ba --- /dev/null +++ b/types/lodash/fp/anyPass.d.ts @@ -0,0 +1,18 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +type OverSome = + /** + * Creates a function that checks if any of the predicates return truthy when invoked with the arguments + * provided to the created function. + * + * @param predicates The predicates to check. + * @return Returns the new function. + */ + (predicates: _.Many<(...args: T[]) => boolean>) => (...args: T[]) => boolean; + +declare const anyPass: OverSome; +export = anyPass; diff --git a/types/lodash/fp/apply.d.ts b/types/lodash/fp/apply.d.ts new file mode 100644 index 0000000000..6a052218aa --- /dev/null +++ b/types/lodash/fp/apply.d.ts @@ -0,0 +1,18 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type Spread = + /** + * 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. + */ + (func: (...args: any[]) => TResult) => (...args: any[]) => TResult; + +declare const apply: Spread; +export = apply; diff --git a/types/lodash/fp/ary.d.ts b/types/lodash/fp/ary.d.ts new file mode 100644 index 0000000000..c241921795 --- /dev/null +++ b/types/lodash/fp/ary.d.ts @@ -0,0 +1,51 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface Ary { + /** + * 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; + /** + * 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. + */ + (n: number): Ary1x1; + /** + * 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. + */ + (n: number, func: (...args: any[]) => any): (...args: any[]) => any; +} +interface Ary1x1 { + /** + * 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. + */ + (): Ary1x1; + /** + * 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. + */ + (func: (...args: any[]) => any): (...args: any[]) => any; +} + +declare const ary: Ary; +export = ary; diff --git a/types/lodash/fp/assign.d.ts b/types/lodash/fp/assign.d.ts new file mode 100644 index 0000000000..df05fbe118 --- /dev/null +++ b/types/lodash/fp/assign.d.ts @@ -0,0 +1,156 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface Assign { + /** + * 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 loosely based on + * [`Object.assign`](https://mdn.io/Object/assign). + * + * @category Object + * @param object The destination object. + * @param [sources] The source objects. + * @returns Returns `object`. + * @example + * + * 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; + /** + * 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 loosely based on + * [`Object.assign`](https://mdn.io/Object/assign). + * + * @category Object + * @param object The destination object. + * @param [sources] The source objects. + * @returns Returns `object`. + * @example + * + * 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 } + */ + (object: TObject): Assign1x1; + /** + * 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 loosely based on + * [`Object.assign`](https://mdn.io/Object/assign). + * + * @category Object + * @param object The destination object. + * @param [sources] The source objects. + * @returns Returns `object`. + * @example + * + * 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 } + */ + (object: TObject, source: TSource): TObject & TSource; +} +interface Assign1x1 { + /** + * 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 loosely based on + * [`Object.assign`](https://mdn.io/Object/assign). + * + * @category Object + * @param object The destination object. + * @param [sources] The source objects. + * @returns Returns `object`. + * @example + * + * 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 } + */ + (): Assign1x1; + /** + * 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 loosely based on + * [`Object.assign`](https://mdn.io/Object/assign). + * + * @category Object + * @param object The destination object. + * @param [sources] The source objects. + * @returns Returns `object`. + * @example + * + * 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 } + */ + (source: TSource): TObject & TSource; +} + +declare const assign: Assign; +export = assign; diff --git a/types/lodash/fp/assignAll.d.ts b/types/lodash/fp/assignAll.d.ts new file mode 100644 index 0000000000..b6ba1dfba9 --- /dev/null +++ b/types/lodash/fp/assignAll.d.ts @@ -0,0 +1,37 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type Assign = + /** + * 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 loosely based on + * [`Object.assign`](https://mdn.io/Object/assign). + * + * @category Object + * @param object The destination object. + * @param [sources] The source objects. + * @returns Returns `object`. + * @example + * + * 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 } + */ + (object: ReadonlyArray) => any; + +declare const assignAll: Assign; +export = assignAll; diff --git a/types/lodash/fp/assignAllWith.d.ts b/types/lodash/fp/assignAllWith.d.ts new file mode 100644 index 0000000000..0f8d2d07ed --- /dev/null +++ b/types/lodash/fp/assignAllWith.d.ts @@ -0,0 +1,138 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface AssignWith { + /** + * 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`. + * + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param [customizer] The function to customize assigned values. + * @returns 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; + /** + * 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`. + * + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param [customizer] The function to customize assigned values. + * @returns 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 } + */ + (customizer: _.AssignCustomizer): AssignWith1x1; + /** + * 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`. + * + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param [customizer] The function to customize assigned values. + * @returns 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 } + */ + (customizer: _.AssignCustomizer, args: ReadonlyArray): any; +} +interface AssignWith1x1 { + /** + * 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`. + * + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param [customizer] The function to customize assigned values. + * @returns 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 } + */ + (): AssignWith1x1; + /** + * 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`. + * + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param [customizer] The function to customize assigned values. + * @returns 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 } + */ + (args: ReadonlyArray): any; +} + +declare const assignAllWith: AssignWith; +export = assignAllWith; diff --git a/types/lodash/fp/assignIn.d.ts b/types/lodash/fp/assignIn.d.ts new file mode 100644 index 0000000000..fcd201f901 --- /dev/null +++ b/types/lodash/fp/assignIn.d.ts @@ -0,0 +1,151 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface AssignIn { + /** + * This method is like `_.assign` except that it iterates over own and + * inherited source properties. + * + * **Note:** This method mutates `object`. + * + * @alias extend + * @category Object + * @param object The destination object. + * @param [sources] The source objects. + * @returns 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; + /** + * This method is like `_.assign` except that it iterates over own and + * inherited source properties. + * + * **Note:** This method mutates `object`. + * + * @alias extend + * @category Object + * @param object The destination object. + * @param [sources] The source objects. + * @returns 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 } + */ + (object: TObject): AssignIn1x1; + /** + * This method is like `_.assign` except that it iterates over own and + * inherited source properties. + * + * **Note:** This method mutates `object`. + * + * @alias extend + * @category Object + * @param object The destination object. + * @param [sources] The source objects. + * @returns 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 } + */ + (object: TObject, source: TSource): TObject & TSource; +} +interface AssignIn1x1 { + /** + * This method is like `_.assign` except that it iterates over own and + * inherited source properties. + * + * **Note:** This method mutates `object`. + * + * @alias extend + * @category Object + * @param object The destination object. + * @param [sources] The source objects. + * @returns 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 } + */ + (): AssignIn1x1; + /** + * This method is like `_.assign` except that it iterates over own and + * inherited source properties. + * + * **Note:** This method mutates `object`. + * + * @alias extend + * @category Object + * @param object The destination object. + * @param [sources] The source objects. + * @returns 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 } + */ + (source: TSource): TObject & TSource; +} + +declare const assignIn: AssignIn; +export = assignIn; diff --git a/types/lodash/fp/assignInAll.d.ts b/types/lodash/fp/assignInAll.d.ts new file mode 100644 index 0000000000..32290cc6cd --- /dev/null +++ b/types/lodash/fp/assignInAll.d.ts @@ -0,0 +1,36 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type AssignIn = + /** + * This method is like `_.assign` except that it iterates over own and + * inherited source properties. + * + * **Note:** This method mutates `object`. + * + * @alias extend + * @category Object + * @param object The destination object. + * @param [sources] The source objects. + * @returns 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 } + */ + (object: ReadonlyArray) => TResult; + +declare const assignInAll: AssignIn; +export = assignInAll; diff --git a/types/lodash/fp/assignInAllWith.d.ts b/types/lodash/fp/assignInAllWith.d.ts new file mode 100644 index 0000000000..631b28218a --- /dev/null +++ b/types/lodash/fp/assignInAllWith.d.ts @@ -0,0 +1,143 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface AssignInWith { + /** + * 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`. + * + * @alias extendWith + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param [customizer] The function to customize assigned values. + * @returns 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; + /** + * 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`. + * + * @alias extendWith + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param [customizer] The function to customize assigned values. + * @returns 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 } + */ + (customizer: _.AssignCustomizer): AssignInWith1x1; + /** + * 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`. + * + * @alias extendWith + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param [customizer] The function to customize assigned values. + * @returns 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 } + */ + (customizer: _.AssignCustomizer, args: ReadonlyArray): any; +} +interface AssignInWith1x1 { + /** + * 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`. + * + * @alias extendWith + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param [customizer] The function to customize assigned values. + * @returns 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 } + */ + (): AssignInWith1x1; + /** + * 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`. + * + * @alias extendWith + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param [customizer] The function to customize assigned values. + * @returns 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 } + */ + (args: ReadonlyArray): any; +} + +declare const assignInAllWith: AssignInWith; +export = assignInAllWith; diff --git a/types/lodash/fp/assignInWith.d.ts b/types/lodash/fp/assignInWith.d.ts new file mode 100644 index 0000000000..d2f9dbba6f --- /dev/null +++ b/types/lodash/fp/assignInWith.d.ts @@ -0,0 +1,249 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface AssignInWith { + /** + * 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`. + * + * @alias extendWith + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param [customizer] The function to customize assigned values. + * @returns 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; + /** + * 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`. + * + * @alias extendWith + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param [customizer] The function to customize assigned values. + * @returns 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 } + */ + (customizer: _.AssignCustomizer): AssignInWith1x1; + /** + * 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`. + * + * @alias extendWith + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param [customizer] The function to customize assigned values. + * @returns 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 } + */ + (customizer: _.AssignCustomizer, object: TObject): AssignInWith1x2; + /** + * 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`. + * + * @alias extendWith + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param [customizer] The function to customize assigned values. + * @returns 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 } + */ + (customizer: _.AssignCustomizer, object: TObject, source: TSource): TObject & TSource; +} +interface AssignInWith1x1 { + /** + * 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`. + * + * @alias extendWith + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param [customizer] The function to customize assigned values. + * @returns 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 } + */ + (): AssignInWith1x1; + /** + * 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`. + * + * @alias extendWith + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param [customizer] The function to customize assigned values. + * @returns 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 } + */ + (object: TObject): AssignInWith1x2; + /** + * 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`. + * + * @alias extendWith + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param [customizer] The function to customize assigned values. + * @returns 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 } + */ + (object: TObject, source: TSource): TObject & TSource; +} +interface AssignInWith1x2 { + /** + * 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`. + * + * @alias extendWith + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param [customizer] The function to customize assigned values. + * @returns 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 } + */ + (): AssignInWith1x2; + /** + * 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`. + * + * @alias extendWith + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param [customizer] The function to customize assigned values. + * @returns 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 } + */ + (source: TSource): TObject & TSource; +} + +declare const assignInWith: AssignInWith; +export = assignInWith; diff --git a/types/lodash/fp/assignWith.d.ts b/types/lodash/fp/assignWith.d.ts new file mode 100644 index 0000000000..2313bd2614 --- /dev/null +++ b/types/lodash/fp/assignWith.d.ts @@ -0,0 +1,240 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface AssignWith { + /** + * 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`. + * + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param [customizer] The function to customize assigned values. + * @returns 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; + /** + * 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`. + * + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param [customizer] The function to customize assigned values. + * @returns 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 } + */ + (customizer: _.AssignCustomizer): AssignWith1x1; + /** + * 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`. + * + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param [customizer] The function to customize assigned values. + * @returns 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 } + */ + (customizer: _.AssignCustomizer, object: TObject): AssignWith1x2; + /** + * 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`. + * + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param [customizer] The function to customize assigned values. + * @returns 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 } + */ + (customizer: _.AssignCustomizer, object: TObject, source: TSource): TObject & TSource; +} +interface AssignWith1x1 { + /** + * 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`. + * + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param [customizer] The function to customize assigned values. + * @returns 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 } + */ + (): AssignWith1x1; + /** + * 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`. + * + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param [customizer] The function to customize assigned values. + * @returns 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 } + */ + (object: TObject): AssignWith1x2; + /** + * 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`. + * + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param [customizer] The function to customize assigned values. + * @returns 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 } + */ + (object: TObject, source: TSource): TObject & TSource; +} +interface AssignWith1x2 { + /** + * 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`. + * + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param [customizer] The function to customize assigned values. + * @returns 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 } + */ + (): AssignWith1x2; + /** + * 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`. + * + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param [customizer] The function to customize assigned values. + * @returns 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 } + */ + (source: TSource): TObject & TSource; +} + +declare const assignWith: AssignWith; +export = assignWith; diff --git a/types/lodash/fp/assoc.d.ts b/types/lodash/fp/assoc.d.ts new file mode 100644 index 0000000000..41f176aaa9 --- /dev/null +++ b/types/lodash/fp/assoc.d.ts @@ -0,0 +1,147 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Set { + /** + * Sets the value at path of object. If a portion of path doesn’t exist it’s created. Arrays are created for + * missing index properties while objects are created for all other missing properties. Use _.setWith to + * customize path creation. + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @return Returns object. + */ + (): Set; + /** + * Sets the value at path of object. If a portion of path doesn’t exist it’s created. Arrays are created for + * missing index properties while objects are created for all other missing properties. Use _.setWith to + * customize path creation. + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @return Returns object. + */ + (path: _.PropertyPath): Set1x1; + /** + * Sets the value at path of object. If a portion of path doesn’t exist it’s created. Arrays are created for + * missing index properties while objects are created for all other missing properties. Use _.setWith to + * customize path creation. + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @return Returns object. + */ + (path: _.PropertyPath, value: any): Set1x2; + /** + * Sets the value at path of object. If a portion of path doesn’t exist it’s created. Arrays are created for + * missing index properties while objects are created for all other missing properties. Use _.setWith to + * customize path creation. + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @return Returns object. + */ + (path: _.PropertyPath, value: any, object: T): T; + /** + * Sets the value at path of object. If a portion of path doesn’t exist it’s created. Arrays are created for + * missing index properties while objects are created for all other missing properties. Use _.setWith to + * customize path creation. + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @return Returns object. + */ + (path: _.PropertyPath, value: any, object: object): TResult; +} +interface Set1x1 { + /** + * Sets the value at path of object. If a portion of path doesn’t exist it’s created. Arrays are created for + * missing index properties while objects are created for all other missing properties. Use _.setWith to + * customize path creation. + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @return Returns object. + */ + (): Set1x1; + /** + * Sets the value at path of object. If a portion of path doesn’t exist it’s created. Arrays are created for + * missing index properties while objects are created for all other missing properties. Use _.setWith to + * customize path creation. + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @return Returns object. + */ + (value: any): Set1x2; + /** + * Sets the value at path of object. If a portion of path doesn’t exist it’s created. Arrays are created for + * missing index properties while objects are created for all other missing properties. Use _.setWith to + * customize path creation. + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @return Returns object. + */ + (value: any, object: T): T; + /** + * Sets the value at path of object. If a portion of path doesn’t exist it’s created. Arrays are created for + * missing index properties while objects are created for all other missing properties. Use _.setWith to + * customize path creation. + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @return Returns object. + */ + (value: any, object: object): TResult; +} +interface Set1x2 { + /** + * Sets the value at path of object. If a portion of path doesn’t exist it’s created. Arrays are created for + * missing index properties while objects are created for all other missing properties. Use _.setWith to + * customize path creation. + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @return Returns object. + */ + (): Set1x2; + /** + * Sets the value at path of object. If a portion of path doesn’t exist it’s created. Arrays are created for + * missing index properties while objects are created for all other missing properties. Use _.setWith to + * customize path creation. + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @return Returns object. + */ + (object: T): T; + /** + * Sets the value at path of object. If a portion of path doesn’t exist it’s created. Arrays are created for + * missing index properties while objects are created for all other missing properties. Use _.setWith to + * customize path creation. + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @return Returns object. + */ + (object: object): TResult; +} + +declare const assoc: Set; +export = assoc; diff --git a/types/lodash/fp/assocPath.d.ts b/types/lodash/fp/assocPath.d.ts new file mode 100644 index 0000000000..ebd0a30a6e --- /dev/null +++ b/types/lodash/fp/assocPath.d.ts @@ -0,0 +1,147 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Set { + /** + * Sets the value at path of object. If a portion of path doesn’t exist it’s created. Arrays are created for + * missing index properties while objects are created for all other missing properties. Use _.setWith to + * customize path creation. + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @return Returns object. + */ + (): Set; + /** + * Sets the value at path of object. If a portion of path doesn’t exist it’s created. Arrays are created for + * missing index properties while objects are created for all other missing properties. Use _.setWith to + * customize path creation. + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @return Returns object. + */ + (path: _.PropertyPath): Set1x1; + /** + * Sets the value at path of object. If a portion of path doesn’t exist it’s created. Arrays are created for + * missing index properties while objects are created for all other missing properties. Use _.setWith to + * customize path creation. + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @return Returns object. + */ + (path: _.PropertyPath, value: any): Set1x2; + /** + * Sets the value at path of object. If a portion of path doesn’t exist it’s created. Arrays are created for + * missing index properties while objects are created for all other missing properties. Use _.setWith to + * customize path creation. + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @return Returns object. + */ + (path: _.PropertyPath, value: any, object: T): T; + /** + * Sets the value at path of object. If a portion of path doesn’t exist it’s created. Arrays are created for + * missing index properties while objects are created for all other missing properties. Use _.setWith to + * customize path creation. + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @return Returns object. + */ + (path: _.PropertyPath, value: any, object: object): TResult; +} +interface Set1x1 { + /** + * Sets the value at path of object. If a portion of path doesn’t exist it’s created. Arrays are created for + * missing index properties while objects are created for all other missing properties. Use _.setWith to + * customize path creation. + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @return Returns object. + */ + (): Set1x1; + /** + * Sets the value at path of object. If a portion of path doesn’t exist it’s created. Arrays are created for + * missing index properties while objects are created for all other missing properties. Use _.setWith to + * customize path creation. + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @return Returns object. + */ + (value: any): Set1x2; + /** + * Sets the value at path of object. If a portion of path doesn’t exist it’s created. Arrays are created for + * missing index properties while objects are created for all other missing properties. Use _.setWith to + * customize path creation. + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @return Returns object. + */ + (value: any, object: T): T; + /** + * Sets the value at path of object. If a portion of path doesn’t exist it’s created. Arrays are created for + * missing index properties while objects are created for all other missing properties. Use _.setWith to + * customize path creation. + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @return Returns object. + */ + (value: any, object: object): TResult; +} +interface Set1x2 { + /** + * Sets the value at path of object. If a portion of path doesn’t exist it’s created. Arrays are created for + * missing index properties while objects are created for all other missing properties. Use _.setWith to + * customize path creation. + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @return Returns object. + */ + (): Set1x2; + /** + * Sets the value at path of object. If a portion of path doesn’t exist it’s created. Arrays are created for + * missing index properties while objects are created for all other missing properties. Use _.setWith to + * customize path creation. + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @return Returns object. + */ + (object: T): T; + /** + * Sets the value at path of object. If a portion of path doesn’t exist it’s created. Arrays are created for + * missing index properties while objects are created for all other missing properties. Use _.setWith to + * customize path creation. + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @return Returns object. + */ + (object: object): TResult; +} + +declare const assocPath: Set; +export = assocPath; diff --git a/types/lodash/fp/at.d.ts b/types/lodash/fp/at.d.ts new file mode 100644 index 0000000000..c8777af286 --- /dev/null +++ b/types/lodash/fp/at.d.ts @@ -0,0 +1,96 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface At { + /** + * 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 object The object 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; + /** + * 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 object The object 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. + */ + (props: _.PropertyPath): At1x1; + /** + * 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 object The object 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. + */ + (props: _.PropertyPath, object: _.List | _.Dictionary | _.NumericDictionary | null | undefined): T[]; + /** + * 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 object The object 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. + */ + (props: _.Many): At2x1; + /** + * 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 object The object 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. + */ + (props: _.Many, object: T | null | undefined): Array; +} +interface At1x1 { + /** + * 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 object The object 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. + */ + (): At1x1; + /** + * 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 object The object 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. + */ + (object: _.List | _.Dictionary | _.NumericDictionary | null | undefined): T[]; +} +interface At2x1 { + /** + * 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 object The object 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. + */ + (): At2x1; + /** + * 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 object The object 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. + */ + (object: T | null | undefined): Array; +} + +declare const at: At; +export = at; diff --git a/types/lodash/fp/attempt.d.ts b/types/lodash/fp/attempt.d.ts new file mode 100644 index 0000000000..b2626b6112 --- /dev/null +++ b/types/lodash/fp/attempt.d.ts @@ -0,0 +1,16 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type Attempt = + /** + * 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. + */ + (func: (...args: any[]) => TResult) => TResult|Error; + +declare const attempt: Attempt; +export = attempt; diff --git a/types/lodash/fp/before.d.ts b/types/lodash/fp/before.d.ts new file mode 100644 index 0000000000..f3e4591275 --- /dev/null +++ b/types/lodash/fp/before.d.ts @@ -0,0 +1,61 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface Before { + /** + * 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; + /** + * 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. + */ + any>(func: TFunc): Before1x1; + /** + * 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. + */ + any>(func: TFunc, n: number): TFunc; +} +interface Before1x1 any> { + /** + * 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. + */ + (): Before1x1; + /** + * 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. + */ + (n: number): TFunc; +} + +declare const before: Before; +export = before; diff --git a/types/lodash/fp/bind.d.ts b/types/lodash/fp/bind.d.ts new file mode 100644 index 0000000000..b62fb3de1f --- /dev/null +++ b/types/lodash/fp/bind.d.ts @@ -0,0 +1,86 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface Bind { + /** + * 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; + /** + * 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. + */ + (func: (...args: any[]) => any): Bind1x1; + /** + * 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. + */ + (func: (...args: any[]) => any, thisArg: any): (...args: any[]) => any; +} +interface Bind1x1 { + /** + * 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. + */ + (): Bind1x1; + /** + * 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. + */ + (thisArg: any): (...args: any[]) => any; +} + +declare const bind: Bind; +export = bind; diff --git a/types/lodash/fp/bindAll.d.ts b/types/lodash/fp/bindAll.d.ts new file mode 100644 index 0000000000..98275d8d79 --- /dev/null +++ b/types/lodash/fp/bindAll.d.ts @@ -0,0 +1,78 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface BindAll { + /** + * 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; + /** + * 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. + */ + (methodNames: _.Many): BindAll1x1; + /** + * 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. + */ + (methodNames: _.Many, object: T): T; +} +interface BindAll1x1 { + /** + * 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. + */ + (): BindAll1x1; + /** + * 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. + */ + (object: T): T; +} + +declare const bindAll: BindAll; +export = bindAll; diff --git a/types/lodash/fp/bindKey.d.ts b/types/lodash/fp/bindKey.d.ts new file mode 100644 index 0000000000..c20c5b1901 --- /dev/null +++ b/types/lodash/fp/bindKey.d.ts @@ -0,0 +1,91 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface BindKey { + /** + * 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; + /** + * 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. + */ + (object: object): BindKey1x1; + /** + * 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. + */ + (object: object, key: string): (...args: any[]) => any; +} +interface BindKey1x1 { + /** + * 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. + */ + (): BindKey1x1; + /** + * 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. + */ + (key: string): (...args: any[]) => any; +} + +declare const bindKey: BindKey; +export = bindKey; diff --git a/types/lodash/fp/camelCase.d.ts b/types/lodash/fp/camelCase.d.ts new file mode 100644 index 0000000000..81d33d61c7 --- /dev/null +++ b/types/lodash/fp/camelCase.d.ts @@ -0,0 +1,15 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type CamelCase = + /** + * Converts string to camel case. + * + * @param string The string to convert. + * @return Returns the camel cased string. + */ + (string: string) => string; + +declare const camelCase: CamelCase; +export = camelCase; diff --git a/types/lodash/fp/capitalize.d.ts b/types/lodash/fp/capitalize.d.ts new file mode 100644 index 0000000000..988421b101 --- /dev/null +++ b/types/lodash/fp/capitalize.d.ts @@ -0,0 +1,15 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type Capitalize = + /** + * Converts the first character of string to upper case and the remaining to lower case. + * + * @param string The string to capitalize. + * @return Returns the capitalized string. + */ + (string: string) => string; + +declare const capitalize: Capitalize; +export = capitalize; diff --git a/types/lodash/fp/castArray.d.ts b/types/lodash/fp/castArray.d.ts new file mode 100644 index 0000000000..9d5b5fc11b --- /dev/null +++ b/types/lodash/fp/castArray.d.ts @@ -0,0 +1,17 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +type CastArray = + /** + * Casts value as an array if it’s not one. + * + * @param value The value to inspect. + * @return Returns the cast array. + */ + (value: _.Many) => T[]; + +declare const castArray: CastArray; +export = castArray; diff --git a/types/lodash/fp/ceil.d.ts b/types/lodash/fp/ceil.d.ts new file mode 100644 index 0000000000..e360c5bc08 --- /dev/null +++ b/types/lodash/fp/ceil.d.ts @@ -0,0 +1,16 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type Ceil = + /** + * 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. + */ + (n: number) => number; + +declare const ceil: Ceil; +export = ceil; diff --git a/types/lodash/fp/chunk.d.ts b/types/lodash/fp/chunk.d.ts new file mode 100644 index 0000000000..8506a60c56 --- /dev/null +++ b/types/lodash/fp/chunk.d.ts @@ -0,0 +1,58 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Chunk { + /** + * 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; + /** + * 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. + */ + (size: number): Chunk1x1; + /** + * 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. + */ + (size: number, array: _.List | null | undefined): T[][]; +} +interface Chunk1x1 { + /** + * 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. + */ + (): Chunk1x1; + /** + * 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. + */ + (array: _.List | null | undefined): T[][]; +} + +declare const chunk: Chunk; +export = chunk; diff --git a/types/lodash/fp/clamp.d.ts b/types/lodash/fp/clamp.d.ts new file mode 100644 index 0000000000..7683abc761 --- /dev/null +++ b/types/lodash/fp/clamp.d.ts @@ -0,0 +1,166 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface Clamp { + /** + * Clamps `number` within the inclusive `lower` and `upper` bounds. + * + * @category Number + * @param number The number to clamp. + * @param [lower] The lower bound. + * @param upper The upper bound. + * @returns Returns the clamped number. + * @example + * + * _.clamp(-10, -5, 5); + * // => -5 + * + * _.clamp(10, -5, 5); + * // => 5 + */ + (): Clamp; + /** + * Clamps `number` within the inclusive `lower` and `upper` bounds. + * + * @category Number + * @param number The number to clamp. + * @param [lower] The lower bound. + * @param upper The upper bound. + * @returns Returns the clamped number. + * @example + * + * _.clamp(-10, -5, 5); + * // => -5 + * + * _.clamp(10, -5, 5); + * // => 5 + */ + (lower: number): Clamp1x1; + /** + * Clamps `number` within the inclusive `lower` and `upper` bounds. + * + * @category Number + * @param number The number to clamp. + * @param [lower] The lower bound. + * @param upper The upper bound. + * @returns Returns the clamped number. + * @example + * + * _.clamp(-10, -5, 5); + * // => -5 + * + * _.clamp(10, -5, 5); + * // => 5 + */ + (lower: number, upper: number): Clamp1x2; + /** + * Clamps `number` within the inclusive `lower` and `upper` bounds. + * + * @category Number + * @param number The number to clamp. + * @param [lower] The lower bound. + * @param upper The upper bound. + * @returns Returns the clamped number. + * @example + * + * _.clamp(-10, -5, 5); + * // => -5 + * + * _.clamp(10, -5, 5); + * // => 5 + */ + (lower: number, upper: number, number: number): number; +} +interface Clamp1x1 { + /** + * Clamps `number` within the inclusive `lower` and `upper` bounds. + * + * @category Number + * @param number The number to clamp. + * @param [lower] The lower bound. + * @param upper The upper bound. + * @returns Returns the clamped number. + * @example + * + * _.clamp(-10, -5, 5); + * // => -5 + * + * _.clamp(10, -5, 5); + * // => 5 + */ + (): Clamp1x1; + /** + * Clamps `number` within the inclusive `lower` and `upper` bounds. + * + * @category Number + * @param number The number to clamp. + * @param [lower] The lower bound. + * @param upper The upper bound. + * @returns Returns the clamped number. + * @example + * + * _.clamp(-10, -5, 5); + * // => -5 + * + * _.clamp(10, -5, 5); + * // => 5 + */ + (upper: number): Clamp1x2; + /** + * Clamps `number` within the inclusive `lower` and `upper` bounds. + * + * @category Number + * @param number The number to clamp. + * @param [lower] The lower bound. + * @param upper The upper bound. + * @returns Returns the clamped number. + * @example + * + * _.clamp(-10, -5, 5); + * // => -5 + * + * _.clamp(10, -5, 5); + * // => 5 + */ + (upper: number, number: number): number; +} +interface Clamp1x2 { + /** + * Clamps `number` within the inclusive `lower` and `upper` bounds. + * + * @category Number + * @param number The number to clamp. + * @param [lower] The lower bound. + * @param upper The upper bound. + * @returns Returns the clamped number. + * @example + * + * _.clamp(-10, -5, 5); + * // => -5 + * + * _.clamp(10, -5, 5); + * // => 5 + */ + (): Clamp1x2; + /** + * Clamps `number` within the inclusive `lower` and `upper` bounds. + * + * @category Number + * @param number The number to clamp. + * @param [lower] The lower bound. + * @param upper The upper bound. + * @returns Returns the clamped number. + * @example + * + * _.clamp(-10, -5, 5); + * // => -5 + * + * _.clamp(10, -5, 5); + * // => 5 + */ + (number: number): number; +} + +declare const clamp: Clamp; +export = clamp; diff --git a/types/lodash/fp/clone.d.ts b/types/lodash/fp/clone.d.ts new file mode 100644 index 0000000000..b6b00ae301 --- /dev/null +++ b/types/lodash/fp/clone.d.ts @@ -0,0 +1,20 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type Clone = + /** + * Creates a shallow clone of value. + * + * Note: This method is loosely based on the 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. + * + * @param value The value to clone. + * @return Returns the cloned value. + */ + (value: T) => T; + +declare const clone: Clone; +export = clone; diff --git a/types/lodash/fp/cloneDeep.d.ts b/types/lodash/fp/cloneDeep.d.ts new file mode 100644 index 0000000000..85d7137e57 --- /dev/null +++ b/types/lodash/fp/cloneDeep.d.ts @@ -0,0 +1,15 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type CloneDeep = + /** + * This method is like _.clone except that it recursively clones value. + * + * @param value The value to recursively clone. + * @return Returns the deep cloned value. + */ + (value: T) => T; + +declare const cloneDeep: CloneDeep; +export = cloneDeep; diff --git a/types/lodash/fp/cloneDeepWith.d.ts b/types/lodash/fp/cloneDeepWith.d.ts new file mode 100644 index 0000000000..caaeb278a7 --- /dev/null +++ b/types/lodash/fp/cloneDeepWith.d.ts @@ -0,0 +1,53 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface CloneDeepWith { + /** + * This method is like _.cloneWith except that it recursively clones value. + * + * @param value The value to recursively clone. + * @param customizer The function to customize cloning. + * @return Returns the deep cloned value. + */ + (): CloneDeepWith; + /** + * This method is like _.cloneWith except that it recursively clones value. + * + * @param value The value to recursively clone. + * @param customizer The function to customize cloning. + * @return Returns the deep cloned value. + */ + (customizer: _.CloneDeepWithCustomizer): CloneDeepWith1x1; + /** + * This method is like _.cloneWith except that it recursively clones value. + * + * @param value The value to recursively clone. + * @param customizer The function to customize cloning. + * @return Returns the deep cloned value. + */ + (customizer: _.CloneDeepWithCustomizer, value: T): any; +} +interface CloneDeepWith1x1 { + /** + * This method is like _.cloneWith except that it recursively clones value. + * + * @param value The value to recursively clone. + * @param customizer The function to customize cloning. + * @return Returns the deep cloned value. + */ + (): CloneDeepWith1x1; + /** + * This method is like _.cloneWith except that it recursively clones value. + * + * @param value The value to recursively clone. + * @param customizer The function to customize cloning. + * @return Returns the deep cloned value. + */ + (value: T): any; +} + +declare const cloneDeepWith: CloneDeepWith; +export = cloneDeepWith; diff --git a/types/lodash/fp/cloneWith.d.ts b/types/lodash/fp/cloneWith.d.ts new file mode 100644 index 0000000000..de29399631 --- /dev/null +++ b/types/lodash/fp/cloneWith.d.ts @@ -0,0 +1,96 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface CloneWith { + /** + * This method is like _.clone except that it accepts customizer which is invoked to produce the cloned value. + * If customizer returns undefined cloning is handled by the method instead. + * + * @param value The value to clone. + * @param customizer The function to customize cloning. + * @return Returns the cloned value. + */ + (): CloneWith; + /** + * This method is like _.clone except that it accepts customizer which is invoked to produce the cloned value. + * If customizer returns undefined cloning is handled by the method instead. + * + * @param value The value to clone. + * @param customizer The function to customize cloning. + * @return Returns the cloned value. + */ + (customizer: _.CloneWithCustomizer): CloneWith1x1; + /** + * This method is like _.clone except that it accepts customizer which is invoked to produce the cloned value. + * If customizer returns undefined cloning is handled by the method instead. + * + * @param value The value to clone. + * @param customizer The function to customize cloning. + * @return Returns the cloned value. + */ + (customizer: _.CloneWithCustomizer, value: T): TResult; + /** + * This method is like _.clone except that it accepts customizer which is invoked to produce the cloned value. + * If customizer returns undefined cloning is handled by the method instead. + * + * @param value The value to clone. + * @param customizer The function to customize cloning. + * @return Returns the cloned value. + */ + (customizer: _.CloneWithCustomizer): CloneWith2x1; + /** + * This method is like _.clone except that it accepts customizer which is invoked to produce the cloned value. + * If customizer returns undefined cloning is handled by the method instead. + * + * @param value The value to clone. + * @param customizer The function to customize cloning. + * @return Returns the cloned value. + */ + (customizer: _.CloneWithCustomizer, value: T): TResult | T; +} +interface CloneWith1x1 { + /** + * This method is like _.clone except that it accepts customizer which is invoked to produce the cloned value. + * If customizer returns undefined cloning is handled by the method instead. + * + * @param value The value to clone. + * @param customizer The function to customize cloning. + * @return Returns the cloned value. + */ + (): CloneWith1x1; + /** + * This method is like _.clone except that it accepts customizer which is invoked to produce the cloned value. + * If customizer returns undefined cloning is handled by the method instead. + * + * @param value The value to clone. + * @param customizer The function to customize cloning. + * @return Returns the cloned value. + */ + (value: T): TResult; +} +interface CloneWith2x1 { + /** + * This method is like _.clone except that it accepts customizer which is invoked to produce the cloned value. + * If customizer returns undefined cloning is handled by the method instead. + * + * @param value The value to clone. + * @param customizer The function to customize cloning. + * @return Returns the cloned value. + */ + (): CloneWith2x1; + /** + * This method is like _.clone except that it accepts customizer which is invoked to produce the cloned value. + * If customizer returns undefined cloning is handled by the method instead. + * + * @param value The value to clone. + * @param customizer The function to customize cloning. + * @return Returns the cloned value. + */ + (value: T): TResult | T; +} + +declare const cloneWith: CloneWith; +export = cloneWith; diff --git a/types/lodash/fp/compact.d.ts b/types/lodash/fp/compact.d.ts new file mode 100644 index 0000000000..4b1c509117 --- /dev/null +++ b/types/lodash/fp/compact.d.ts @@ -0,0 +1,18 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +type Compact = + /** + * 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 Returns the new array of filtered values. + */ + (array: _.List | null | undefined) => T[]; + +declare const compact: Compact; +export = compact; diff --git a/types/lodash/fp/complement.d.ts b/types/lodash/fp/complement.d.ts new file mode 100644 index 0000000000..397bab4997 --- /dev/null +++ b/types/lodash/fp/complement.d.ts @@ -0,0 +1,16 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type Negate = + /** + * 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. + */ + any>(predicate: T) => T; + +declare const complement: Negate; +export = complement; diff --git a/types/lodash/fp/compose.d.ts b/types/lodash/fp/compose.d.ts new file mode 100644 index 0000000000..6d626496ae --- /dev/null +++ b/types/lodash/fp/compose.d.ts @@ -0,0 +1,315 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface FlowRight { + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f2: (a: R1) => R2, f1: () => R1): () => R2; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f3: (a: R2) => R3, f2: (a: R1) => R2, f1: () => R1): () => R3; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: () => R1): () => R4; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f5: (a: R4) => R5, f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: () => R1): () => R5; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f6: (a: R5) => R6, f5: (a: R4) => R5, f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: () => R1): () => R6; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f7: (a: R6) => R7, f6: (a: R5) => R6, f5: (a: R4) => R5, f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: () => R1): () => R7; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f2: (a: R1) => R2, f1: (a1: A1) => R1): (a1: A1) => R2; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (a1: A1) => R1): (a1: A1) => R3; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (a1: A1) => R1): (a1: A1) => R4; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f5: (a: R4) => R5, f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (a1: A1) => R1): (a1: A1) => R5; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f6: (a: R5) => R6, f5: (a: R4) => R5, f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (a1: A1) => R1): (a1: A1) => R6; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f7: (a: R6) => R7, f6: (a: R5) => R6, f5: (a: R4) => R5, f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (a1: A1) => R1): (a1: A1) => R7; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f2: (a: R1) => R2, f1: (a1: A1, a2: A2) => R1): (a1: A1, a2: A2) => R2; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (a1: A1, a2: A2) => R1): (a1: A1, a2: A2) => R3; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (a1: A1, a2: A2) => R1): (a1: A1, a2: A2) => R4; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f5: (a: R4) => R5, f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (a1: A1, a2: A2) => R1): (a1: A1, a2: A2) => R5; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f6: (a: R5) => R6, f5: (a: R4) => R5, f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (a1: A1, a2: A2) => R1): (a1: A1, a2: A2) => R6; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f7: (a: R6) => R7, f6: (a: R5) => R6, f5: (a: R4) => R5, f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (a1: A1, a2: A2) => R1): (a1: A1, a2: A2) => R7; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f2: (a: R1) => R2, f1: (a1: A1, a2: A2, a3: A3) => R1): (a1: A1, a2: A2, a3: A3) => R2; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (a1: A1, a2: A2, a3: A3) => R1): (a1: A1, a2: A2, a3: A3) => R3; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (a1: A1, a2: A2, a3: A3) => R1): (a1: A1, a2: A2, a3: A3) => R4; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f5: (a: R4) => R5, f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (a1: A1, a2: A2, a3: A3) => R1): (a1: A1, a2: A2, a3: A3) => R5; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f6: (a: R5) => R6, f5: (a: R4) => R5, f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (a1: A1, a2: A2, a3: A3) => R1): (a1: A1, a2: A2, a3: A3) => R6; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f7: (a: R6) => R7, f6: (a: R5) => R6, f5: (a: R4) => R5, f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (a1: A1, a2: A2, a3: A3) => R1): (a1: A1, a2: A2, a3: A3) => R7; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f2: (a: R1) => R2, f1: (a1: A1, a2: A2, a3: A3, a4: A4) => R1): (a1: A1, a2: A2, a3: A3, a4: A4) => R2; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (a1: A1, a2: A2, a3: A3, a4: A4) => R1): (a1: A1, a2: A2, a3: A3, a4: A4) => R3; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (a1: A1, a2: A2, a3: A3, a4: A4) => R1): (a1: A1, a2: A2, a3: A3, a4: A4) => R4; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f5: (a: R4) => R5, f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (a1: A1, a2: A2, a3: A3, a4: A4) => R1): (a1: A1, a2: A2, a3: A3, a4: A4) => R5; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f6: (a: R5) => R6, f5: (a: R4) => R5, f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (a1: A1, a2: A2, a3: A3, a4: A4) => R1): (a1: A1, a2: A2, a3: A3, a4: A4) => R6; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f7: (a: R6) => R7, f6: (a: R5) => R6, f5: (a: R4) => R5, f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (a1: A1, a2: A2, a3: A3, a4: A4) => R1): (a1: A1, a2: A2, a3: A3, a4: A4) => R7; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f2: (a: R1) => R2, f1: (...args: any[]) => R1): (...args: any[]) => R2; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (...args: any[]) => R1): (...args: any[]) => R3; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (...args: any[]) => R1): (...args: any[]) => R4; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f5: (a: R4) => R5, f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (...args: any[]) => R1): (...args: any[]) => R5; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f6: (a: R5) => R6, f5: (a: R4) => R5, f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (...args: any[]) => R1): (...args: any[]) => R6; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f7: (a: R6) => R7, f6: (a: R5) => R6, f5: (a: R4) => R5, f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (...args: any[]) => R1): (...args: any[]) => R7; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f7: (a: any) => any, f6: (a: any) => any, f5: (a: any) => any, f4: (a: any) => any, f3: (a: any) => any, f2: (a: any) => any, f1: () => any, ...funcs: Array<_.Many<(...args: any[]) => any>>): (...args: any[]) => any; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (funcs: Array<_.Many<(...args: any[]) => any>>): (...args: any[]) => any; +} + +declare const compose: FlowRight; +export = compose; diff --git a/types/lodash/fp/concat.d.ts b/types/lodash/fp/concat.d.ts new file mode 100644 index 0000000000..a68dce878a --- /dev/null +++ b/types/lodash/fp/concat.d.ts @@ -0,0 +1,113 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Concat { + /** + * Creates a new array concatenating `array` with any additional arrays + * and/or values. + * + * @category Array + * @param array The array to concatenate. + * @param [values] The values to concatenate. + * @returns 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; + /** + * Creates a new array concatenating `array` with any additional arrays + * and/or values. + * + * @category Array + * @param array The array to concatenate. + * @param [values] The values to concatenate. + * @returns 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] + */ + (array: _.Many): Concat1x1; + /** + * Creates a new array concatenating `array` with any additional arrays + * and/or values. + * + * @category Array + * @param array The array to concatenate. + * @param [values] The values to concatenate. + * @returns 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] + */ + (array: _.Many, values: _.Many): T[]; +} +interface Concat1x1 { + /** + * Creates a new array concatenating `array` with any additional arrays + * and/or values. + * + * @category Array + * @param array The array to concatenate. + * @param [values] The values to concatenate. + * @returns 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] + */ + (): Concat1x1; + /** + * Creates a new array concatenating `array` with any additional arrays + * and/or values. + * + * @category Array + * @param array The array to concatenate. + * @param [values] The values to concatenate. + * @returns 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] + */ + (values: _.Many): T[]; +} + +declare const concat: Concat; +export = concat; diff --git a/types/lodash/fp/cond.d.ts b/types/lodash/fp/cond.d.ts new file mode 100644 index 0000000000..c5a18575a6 --- /dev/null +++ b/types/lodash/fp/cond.d.ts @@ -0,0 +1,38 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +type Cond = + /** + * Creates a function that iterates over `pairs` and invokes the corresponding + * function of the first predicate to return truthy. The predicate-function + * pairs are invoked with the `this` binding and arguments of the created + * function. + * + * @since 4.0.0 + * @category Util + * @param pairs The predicate-function pairs. + * @returns Returns the new composite function. + * @example + * + * var func = _.cond([ + * [_.matches({ 'a': 1 }), _.constant('matches A')], + * [_.conforms({ 'b': _.isNumber }), _.constant('matches B')], + * [_.stubTrue, _.constant('no match')] + * ]); + * + * func({ 'a': 1, 'b': 2 }); + * // => 'matches A' + * + * func({ 'a': 0, 'b': 1 }); + * // => 'matches B' + * + * func({ 'a': '1', 'b': '2' }); + * // => 'no match' + */ + (pairs: Array<_.CondPair>) => (Target: T) => R; + +declare const cond: Cond; +export = cond; diff --git a/types/lodash/fp/conforms.d.ts b/types/lodash/fp/conforms.d.ts new file mode 100644 index 0000000000..6499cccf55 --- /dev/null +++ b/types/lodash/fp/conforms.d.ts @@ -0,0 +1,48 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface ConformsTo { + /** + * Checks if object conforms to source by invoking the predicate properties of source with the + * corresponding property values of object. + * + * Note: This method is equivalent to _.conforms when source is partially applied. + */ + (): ConformsTo; + /** + * Checks if object conforms to source by invoking the predicate properties of source with the + * corresponding property values of object. + * + * Note: This method is equivalent to _.conforms when source is partially applied. + */ + (source: _.ConformsPredicateObject): ConformsTo1x1; + /** + * Checks if object conforms to source by invoking the predicate properties of source with the + * corresponding property values of object. + * + * Note: This method is equivalent to _.conforms when source is partially applied. + */ + (source: _.ConformsPredicateObject, object: T): boolean; +} +interface ConformsTo1x1 { + /** + * Checks if object conforms to source by invoking the predicate properties of source with the + * corresponding property values of object. + * + * Note: This method is equivalent to _.conforms when source is partially applied. + */ + (): ConformsTo1x1; + /** + * Checks if object conforms to source by invoking the predicate properties of source with the + * corresponding property values of object. + * + * Note: This method is equivalent to _.conforms when source is partially applied. + */ + (object: T): boolean; +} + +declare const conforms: ConformsTo; +export = conforms; diff --git a/types/lodash/fp/conformsTo.d.ts b/types/lodash/fp/conformsTo.d.ts new file mode 100644 index 0000000000..9512e4adf6 --- /dev/null +++ b/types/lodash/fp/conformsTo.d.ts @@ -0,0 +1,48 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface ConformsTo { + /** + * Checks if object conforms to source by invoking the predicate properties of source with the + * corresponding property values of object. + * + * Note: This method is equivalent to _.conforms when source is partially applied. + */ + (): ConformsTo; + /** + * Checks if object conforms to source by invoking the predicate properties of source with the + * corresponding property values of object. + * + * Note: This method is equivalent to _.conforms when source is partially applied. + */ + (source: _.ConformsPredicateObject): ConformsTo1x1; + /** + * Checks if object conforms to source by invoking the predicate properties of source with the + * corresponding property values of object. + * + * Note: This method is equivalent to _.conforms when source is partially applied. + */ + (source: _.ConformsPredicateObject, object: T): boolean; +} +interface ConformsTo1x1 { + /** + * Checks if object conforms to source by invoking the predicate properties of source with the + * corresponding property values of object. + * + * Note: This method is equivalent to _.conforms when source is partially applied. + */ + (): ConformsTo1x1; + /** + * Checks if object conforms to source by invoking the predicate properties of source with the + * corresponding property values of object. + * + * Note: This method is equivalent to _.conforms when source is partially applied. + */ + (object: T): boolean; +} + +declare const conformsTo: ConformsTo; +export = conformsTo; diff --git a/types/lodash/fp/constant.d.ts b/types/lodash/fp/constant.d.ts new file mode 100644 index 0000000000..718805e17f --- /dev/null +++ b/types/lodash/fp/constant.d.ts @@ -0,0 +1,15 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type Constant = + /** + * Creates a function that returns value. + * + * @param value The value to return from the new function. + * @return Returns the new function. + */ + (value: T) => () => T; + +declare const constant: Constant; +export = constant; diff --git a/types/lodash/fp/contains.d.ts b/types/lodash/fp/contains.d.ts new file mode 100644 index 0000000000..b80ca7f1fa --- /dev/null +++ b/types/lodash/fp/contains.d.ts @@ -0,0 +1,63 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Includes { + /** + * 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. + * + * @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; + /** + * 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. + * + * @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. + */ + (target: T): Includes1x1; + /** + * 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. + * + * @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. + */ + (target: T, collection: _.List | _.Dictionary | _.NumericDictionary | null | undefined): boolean; +} +interface Includes1x1 { + /** + * 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. + * + * @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. + */ + (): Includes1x1; + /** + * 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. + * + * @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. + */ + (collection: _.List | _.Dictionary | _.NumericDictionary | null | undefined): boolean; +} + +declare const contains: Includes; +export = contains; diff --git a/types/lodash/fp/convert.d.ts b/types/lodash/fp/convert.d.ts new file mode 100644 index 0000000000..c06ecd9370 --- /dev/null +++ b/types/lodash/fp/convert.d.ts @@ -0,0 +1,15 @@ +interface ConvertOptions { + cap?: boolean; + curry?: boolean; + fixed?: boolean; + immutable?: boolean; + rearg?: boolean; +} + +interface Convert { + (func: object, options?: ConvertOptions): any; + (name: string, func: (...args: any[]) => any, options?: ConvertOptions): any; +} + +declare const convert: Convert; +export = convert; diff --git a/types/lodash/fp/countBy.d.ts b/types/lodash/fp/countBy.d.ts new file mode 100644 index 0000000000..cca0ac3b02 --- /dev/null +++ b/types/lodash/fp/countBy.d.ts @@ -0,0 +1,225 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface CountBy { + /** + * 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; + /** + * 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. + */ + (iteratee: (value: string) => T): CountBy1x1; + /** + * 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. + */ + (iteratee: (value: string) => T, collection: string | null | undefined): _.Dictionary; + /** + * 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. + */ + (iteratee: _.ValueIteratee): CountBy2x1; + /** + * 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. + */ + (iteratee: _.ValueIteratee, collection: _.List | null | undefined): _.Dictionary; + /** + * 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. + */ + (iteratee: _.ValueIteratee, collection: T | null | undefined): _.Dictionary; +} +interface CountBy1x1 { + /** + * 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. + */ + (): CountBy1x1; + /** + * 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. + */ + (collection: string | null | undefined): _.Dictionary; +} +interface CountBy2x1 { + /** + * 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. + */ + (): CountBy2x1; + /** + * 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. + */ + (collection: _.List | object | null | undefined): _.Dictionary; +} + +declare const countBy: CountBy; +export = countBy; diff --git a/types/lodash/fp/create.d.ts b/types/lodash/fp/create.d.ts new file mode 100644 index 0000000000..6025931062 --- /dev/null +++ b/types/lodash/fp/create.d.ts @@ -0,0 +1,17 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type Create = + /** + * 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. + */ + (prototype: T) => T & U; + +declare const create: Create; +export = create; diff --git a/types/lodash/fp/curry.d.ts b/types/lodash/fp/curry.d.ts new file mode 100644 index 0000000000..6c946bbf67 --- /dev/null +++ b/types/lodash/fp/curry.d.ts @@ -0,0 +1,65 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Curry { + /** + * 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. + */ + (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. + * @param arity The arity of func. + * @return Returns the new curried function. + */ + (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. + * @param arity The arity of func. + * @return Returns the new curried function. + */ + (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. + * @param arity The arity of func. + * @return Returns the new curried function. + */ + (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. + * @param arity The arity of func. + * @return Returns the new curried function. + */ + (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. + */ + (func: (...args: any[]) => any): (...args: any[]) => any; +} + +declare const curry: Curry; +export = curry; diff --git a/types/lodash/fp/curryN.d.ts b/types/lodash/fp/curryN.d.ts new file mode 100644 index 0000000000..4acbd81811 --- /dev/null +++ b/types/lodash/fp/curryN.d.ts @@ -0,0 +1,148 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Curry { + /** + * 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; + /** + * 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. + */ + (arity: number): Curry1x1; + /** + * 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. + */ + (arity: number, 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. + * @param arity The arity of func. + * @return Returns the new curried function. + */ + (arity: number, 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. + * @param arity The arity of func. + * @return Returns the new curried function. + */ + (arity: number, 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. + * @param arity The arity of func. + * @return Returns the new curried function. + */ + (arity: number, 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. + * @param arity The arity of func. + * @return Returns the new curried function. + */ + (arity: number, 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. + */ + (arity: number, func: (...args: any[]) => any): (...args: any[]) => any; +} +interface Curry1x1 { + /** + * 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. + */ + (): Curry1x1; + /** + * 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. + */ + (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. + * @param arity The arity of func. + * @return Returns the new curried function. + */ + (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. + * @param arity The arity of func. + * @return Returns the new curried function. + */ + (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. + * @param arity The arity of func. + * @return Returns the new curried function. + */ + (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. + * @param arity The arity of func. + * @return Returns the new curried function. + */ + (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. + */ + (func: (...args: any[]) => any): (...args: any[]) => any; +} + +declare const curryN: Curry; +export = curryN; diff --git a/types/lodash/fp/curryRight.d.ts b/types/lodash/fp/curryRight.d.ts new file mode 100644 index 0000000000..5ff81e2004 --- /dev/null +++ b/types/lodash/fp/curryRight.d.ts @@ -0,0 +1,59 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface CurryRight { + /** + * 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. + */ + (func: (t1: T1) => R): _.RightCurriedFunction1; + /** + * 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. + */ + (func: (t1: T1, t2: T2) => R): _.RightCurriedFunction2; + /** + * 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. + */ + (func: (t1: T1, t2: T2, t3: T3) => R): _.RightCurriedFunction3; + /** + * 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. + */ + (func: (t1: T1, t2: T2, t3: T3, t4: T4) => R): _.RightCurriedFunction4; + /** + * 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. + */ + (func: (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5) => R): _.RightCurriedFunction5; + /** + * 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. + */ + (func: (...args: any[]) => any): (...args: any[]) => any; +} + +declare const curryRight: CurryRight; +export = curryRight; diff --git a/types/lodash/fp/curryRightN.d.ts b/types/lodash/fp/curryRightN.d.ts new file mode 100644 index 0000000000..98694df731 --- /dev/null +++ b/types/lodash/fp/curryRightN.d.ts @@ -0,0 +1,133 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface CurryRight { + /** + * 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; + /** + * 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. + */ + (arity: number): CurryRight1x1; + /** + * 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. + */ + (arity: number, func: (t1: T1) => R): _.RightCurriedFunction1; + /** + * 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. + */ + (arity: number, func: (t1: T1, t2: T2) => R): _.RightCurriedFunction2; + /** + * 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. + */ + (arity: number, func: (t1: T1, t2: T2, t3: T3) => R): _.RightCurriedFunction3; + /** + * 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. + */ + (arity: number, func: (t1: T1, t2: T2, t3: T3, t4: T4) => R): _.RightCurriedFunction4; + /** + * 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. + */ + (arity: number, func: (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5) => R): _.RightCurriedFunction5; + /** + * 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. + */ + (arity: number, func: (...args: any[]) => any): (...args: any[]) => any; +} +interface CurryRight1x1 { + /** + * 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. + */ + (): CurryRight1x1; + /** + * 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. + */ + (func: (t1: T1) => R): _.RightCurriedFunction1; + /** + * 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. + */ + (func: (t1: T1, t2: T2) => R): _.RightCurriedFunction2; + /** + * 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. + */ + (func: (t1: T1, t2: T2, t3: T3) => R): _.RightCurriedFunction3; + /** + * 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. + */ + (func: (t1: T1, t2: T2, t3: T3, t4: T4) => R): _.RightCurriedFunction4; + /** + * 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. + */ + (func: (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5) => R): _.RightCurriedFunction5; + /** + * 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. + */ + (func: (...args: any[]) => any): (...args: any[]) => any; +} + +declare const curryRightN: CurryRight; +export = curryRightN; diff --git a/types/lodash/fp/debounce.d.ts b/types/lodash/fp/debounce.d.ts new file mode 100644 index 0000000000..6aa4ca891b --- /dev/null +++ b/types/lodash/fp/debounce.d.ts @@ -0,0 +1,118 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Debounce { + /** + * 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 and a flush method to immediately invoke them. 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; + /** + * 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 and a flush method to immediately invoke them. 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. + */ + (wait: number): Debounce1x1; + /** + * 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 and a flush method to immediately invoke them. 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. + */ + any>(wait: number, func: T): T & _.Cancelable; +} +interface Debounce1x1 { + /** + * 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 and a flush method to immediately invoke them. 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. + */ + (): Debounce1x1; + /** + * 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 and a flush method to immediately invoke them. 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. + */ + any>(func: T): T & _.Cancelable; +} + +declare const debounce: Debounce; +export = debounce; diff --git a/types/lodash/fp/deburr.d.ts b/types/lodash/fp/deburr.d.ts new file mode 100644 index 0000000000..582ef58205 --- /dev/null +++ b/types/lodash/fp/deburr.d.ts @@ -0,0 +1,16 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type Deburr = + /** + * 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. + */ + (string: string) => string; + +declare const deburr: Deburr; +export = deburr; diff --git a/types/lodash/fp/defaultTo.d.ts b/types/lodash/fp/defaultTo.d.ts new file mode 100644 index 0000000000..2137ee3307 --- /dev/null +++ b/types/lodash/fp/defaultTo.d.ts @@ -0,0 +1,103 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface DefaultTo { + /** + * Checks `value` to determine whether a default value should be returned in + * its place. The `defaultValue` is returned if `value` is `NaN`, `null`, + * or `undefined`. + * + * @param value The value to check. + * @param defaultValue The default value. + * @returns Returns the resolved value. + */ + (): DefaultTo; + /** + * Checks `value` to determine whether a default value should be returned in + * its place. The `defaultValue` is returned if `value` is `NaN`, `null`, + * or `undefined`. + * + * @param value The value to check. + * @param defaultValue The default value. + * @returns Returns the resolved value. + */ + (defaultValue: T): DefaultTo1x1; + /** + * Checks `value` to determine whether a default value should be returned in + * its place. The `defaultValue` is returned if `value` is `NaN`, `null`, + * or `undefined`. + * + * @param value The value to check. + * @param defaultValue The default value. + * @returns Returns the resolved value. + */ + (defaultValue: T, value: T | null | undefined): T; + /** + * Checks `value` to determine whether a default value should be returned in + * its place. The `defaultValue` is returned if `value` is `NaN`, `null`, + * or `undefined`. + * + * @param value The value to check. + * @param defaultValue The default value. + * @returns Returns the resolved value. + */ + (defaultValue: TDefault): DefaultTo2x1; + /** + * Checks `value` to determine whether a default value should be returned in + * its place. The `defaultValue` is returned if `value` is `NaN`, `null`, + * or `undefined`. + * + * @param value The value to check. + * @param defaultValue The default value. + * @returns Returns the resolved value. + */ + (defaultValue: TDefault, value: T | null | undefined): T | TDefault; +} +interface DefaultTo1x1 { + /** + * Checks `value` to determine whether a default value should be returned in + * its place. The `defaultValue` is returned if `value` is `NaN`, `null`, + * or `undefined`. + * + * @param value The value to check. + * @param defaultValue The default value. + * @returns Returns the resolved value. + */ + (): DefaultTo1x1; + /** + * Checks `value` to determine whether a default value should be returned in + * its place. The `defaultValue` is returned if `value` is `NaN`, `null`, + * or `undefined`. + * + * @param value The value to check. + * @param defaultValue The default value. + * @returns Returns the resolved value. + */ + (value: T | null | undefined): T; +} +interface DefaultTo2x1 { + /** + * Checks `value` to determine whether a default value should be returned in + * its place. The `defaultValue` is returned if `value` is `NaN`, `null`, + * or `undefined`. + * + * @param value The value to check. + * @param defaultValue The default value. + * @returns Returns the resolved value. + */ + (): DefaultTo2x1; + /** + * Checks `value` to determine whether a default value should be returned in + * its place. The `defaultValue` is returned if `value` is `NaN`, `null`, + * or `undefined`. + * + * @param value The value to check. + * @param defaultValue The default value. + * @returns Returns the resolved value. + */ + (value: T | null | undefined): T | TDefault; +} + +declare const defaultTo: DefaultTo; +export = defaultTo; diff --git a/types/lodash/fp/defaults.d.ts b/types/lodash/fp/defaults.d.ts new file mode 100644 index 0000000000..306534d374 --- /dev/null +++ b/types/lodash/fp/defaults.d.ts @@ -0,0 +1,71 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface Defaults { + /** + * 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; + /** + * 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. + */ + (source: TSource): Defaults1x1; + /** + * 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. + */ + (source: TSource, object: TObject): TSource & TObject; +} +interface Defaults1x1 { + /** + * 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. + */ + (): Defaults1x1; + /** + * 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. + */ + (object: TObject): TSource & TObject; +} + +declare const defaults: Defaults; +export = defaults; diff --git a/types/lodash/fp/defaultsAll.d.ts b/types/lodash/fp/defaultsAll.d.ts new file mode 100644 index 0000000000..371f6db282 --- /dev/null +++ b/types/lodash/fp/defaultsAll.d.ts @@ -0,0 +1,20 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type Defaults = + /** + * 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. + */ + (object: ReadonlyArray) => any; + +declare const defaultsAll: Defaults; +export = defaultsAll; diff --git a/types/lodash/fp/defaultsDeep.d.ts b/types/lodash/fp/defaultsDeep.d.ts new file mode 100644 index 0000000000..86eace1bb9 --- /dev/null +++ b/types/lodash/fp/defaultsDeep.d.ts @@ -0,0 +1,46 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface DefaultsDeep { + /** + * 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; + /** + * 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. + **/ + (sources: any): DefaultsDeep1x1; + /** + * 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. + **/ + (sources: any, object: any): any; +} +interface DefaultsDeep1x1 { + /** + * 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. + **/ + (): DefaultsDeep1x1; + /** + * 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. + **/ + (object: any): any; +} + +declare const defaultsDeep: DefaultsDeep; +export = defaultsDeep; diff --git a/types/lodash/fp/defaultsDeepAll.d.ts b/types/lodash/fp/defaultsDeepAll.d.ts new file mode 100644 index 0000000000..cb6157662d --- /dev/null +++ b/types/lodash/fp/defaultsDeepAll.d.ts @@ -0,0 +1,15 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type DefaultsDeep = + /** + * 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. + **/ + (object: ReadonlyArray) => any; + +declare const defaultsDeepAll: DefaultsDeep; +export = defaultsDeepAll; diff --git a/types/lodash/fp/defer.d.ts b/types/lodash/fp/defer.d.ts new file mode 100644 index 0000000000..a9bab80092 --- /dev/null +++ b/types/lodash/fp/defer.d.ts @@ -0,0 +1,17 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type Defer = + /** + * 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. + */ + (func: (...args: any[]) => any, ...args: any[]) => number; + +declare const defer: Defer; +export = defer; diff --git a/types/lodash/fp/delay.d.ts b/types/lodash/fp/delay.d.ts new file mode 100644 index 0000000000..8709a9c0e2 --- /dev/null +++ b/types/lodash/fp/delay.d.ts @@ -0,0 +1,56 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface Delay { + /** + * 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; + /** + * 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. + */ + (wait: number): Delay1x1; + /** + * 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. + */ + (wait: number, func: (...args: any[]) => any): number; +} +interface Delay1x1 { + /** + * 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. + */ + (): Delay1x1; + /** + * 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. + */ + (func: (...args: any[]) => any): number; +} + +declare const delay: Delay; +export = delay; diff --git a/types/lodash/fp/difference.d.ts b/types/lodash/fp/difference.d.ts new file mode 100644 index 0000000000..774539bba7 --- /dev/null +++ b/types/lodash/fp/difference.d.ts @@ -0,0 +1,58 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Difference { + /** + * 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; + /** + * 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. + */ + (array: _.List | null | undefined): Difference1x1; + /** + * 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. + */ + (array: _.List | null | undefined, values: _.List): T[]; +} +interface Difference1x1 { + /** + * 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. + */ + (): Difference1x1; + /** + * 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. + */ + (values: _.List): T[]; +} + +declare const difference: Difference; +export = difference; diff --git a/types/lodash/fp/differenceBy.d.ts b/types/lodash/fp/differenceBy.d.ts new file mode 100644 index 0000000000..64975c1b17 --- /dev/null +++ b/types/lodash/fp/differenceBy.d.ts @@ -0,0 +1,114 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface DifferenceBy { + /** + * This method is like _.difference except that it accepts iteratee which is invoked for each element of array + * and values to generate the criterion by which uniqueness is computed. The iteratee is invoked with one + * argument: (value). + * + * @param array The array to inspect. + * @param values The values to exclude. + * @param iteratee The iteratee invoked per element. + * @returns Returns the new array of filtered values. + */ + (): DifferenceBy; + /** + * This method is like _.difference except that it accepts iteratee which is invoked for each element of array + * and values to generate the criterion by which uniqueness is computed. The iteratee is invoked with one + * argument: (value). + * + * @param array The array to inspect. + * @param values The values to exclude. + * @param iteratee The iteratee invoked per element. + * @returns Returns the new array of filtered values. + */ + (iteratee: _.ValueIteratee): DifferenceBy1x1; + /** + * This method is like _.difference except that it accepts iteratee which is invoked for each element of array + * and values to generate the criterion by which uniqueness is computed. The iteratee is invoked with one + * argument: (value). + * + * @param array The array to inspect. + * @param values The values to exclude. + * @param iteratee The iteratee invoked per element. + * @returns Returns the new array of filtered values. + */ + (iteratee: _.ValueIteratee, array: _.List | null | undefined): DifferenceBy1x2; + /** + * This method is like _.difference except that it accepts iteratee which is invoked for each element of array + * and values to generate the criterion by which uniqueness is computed. The iteratee is invoked with one + * argument: (value). + * + * @param array The array to inspect. + * @param values The values to exclude. + * @param iteratee The iteratee invoked per element. + * @returns Returns the new array of filtered values. + */ + (iteratee: _.ValueIteratee, array: _.List | null | undefined, values: _.List): T1[]; +} +interface DifferenceBy1x1 { + /** + * This method is like _.difference except that it accepts iteratee which is invoked for each element of array + * and values to generate the criterion by which uniqueness is computed. The iteratee is invoked with one + * argument: (value). + * + * @param array The array to inspect. + * @param values The values to exclude. + * @param iteratee The iteratee invoked per element. + * @returns Returns the new array of filtered values. + */ + (): DifferenceBy1x1; + /** + * This method is like _.difference except that it accepts iteratee which is invoked for each element of array + * and values to generate the criterion by which uniqueness is computed. The iteratee is invoked with one + * argument: (value). + * + * @param array The array to inspect. + * @param values The values to exclude. + * @param iteratee The iteratee invoked per element. + * @returns Returns the new array of filtered values. + */ + (array: _.List | null | undefined): DifferenceBy1x2; + /** + * This method is like _.difference except that it accepts iteratee which is invoked for each element of array + * and values to generate the criterion by which uniqueness is computed. The iteratee is invoked with one + * argument: (value). + * + * @param array The array to inspect. + * @param values The values to exclude. + * @param iteratee The iteratee invoked per element. + * @returns Returns the new array of filtered values. + */ + (array: _.List | null | undefined, values: _.List): T1[]; +} +interface DifferenceBy1x2 { + /** + * This method is like _.difference except that it accepts iteratee which is invoked for each element of array + * and values to generate the criterion by which uniqueness is computed. The iteratee is invoked with one + * argument: (value). + * + * @param array The array to inspect. + * @param values The values to exclude. + * @param iteratee The iteratee invoked per element. + * @returns Returns the new array of filtered values. + */ + (): DifferenceBy1x2; + /** + * This method is like _.difference except that it accepts iteratee which is invoked for each element of array + * and values to generate the criterion by which uniqueness is computed. The iteratee is invoked with one + * argument: (value). + * + * @param array The array to inspect. + * @param values The values to exclude. + * @param iteratee The iteratee invoked per element. + * @returns Returns the new array of filtered values. + */ + (values: _.List): T1[]; +} + +declare const differenceBy: DifferenceBy; +export = differenceBy; diff --git a/types/lodash/fp/differenceWith.d.ts b/types/lodash/fp/differenceWith.d.ts new file mode 100644 index 0000000000..2ef1961ff7 --- /dev/null +++ b/types/lodash/fp/differenceWith.d.ts @@ -0,0 +1,168 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface DifferenceWith { + /** + * 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. + * + * @category Array + * @param [values] The arrays to inspect. + * @param [comparator] The comparator invoked per element. + * @returns Returns the new array of filtered values. + * @example + * + * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; + + * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual); + * // => [{ 'x': 2, 'y': 1 }] + */ + (): DifferenceWith; + /** + * 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. + * + * @category Array + * @param [values] The arrays to inspect. + * @param [comparator] The comparator invoked per element. + * @returns Returns the new array of filtered values. + * @example + * + * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; + + * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual); + * // => [{ 'x': 2, 'y': 1 }] + */ + (comparator: _.Comparator2): DifferenceWith1x1; + /** + * 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. + * + * @category Array + * @param [values] The arrays to inspect. + * @param [comparator] The comparator invoked per element. + * @returns Returns the new array of filtered values. + * @example + * + * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; + + * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual); + * // => [{ 'x': 2, 'y': 1 }] + */ + (comparator: _.Comparator2, array: _.List | null | undefined): DifferenceWith1x2; + /** + * 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. + * + * @category Array + * @param [values] The arrays to inspect. + * @param [comparator] The comparator invoked per element. + * @returns Returns the new array of filtered values. + * @example + * + * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; + + * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual); + * // => [{ 'x': 2, 'y': 1 }] + */ + (comparator: _.Comparator2, array: _.List | null | undefined, values: _.List): T1[]; +} +interface DifferenceWith1x1 { + /** + * 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. + * + * @category Array + * @param [values] The arrays to inspect. + * @param [comparator] The comparator invoked per element. + * @returns Returns the new array of filtered values. + * @example + * + * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; + + * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual); + * // => [{ 'x': 2, 'y': 1 }] + */ + (): DifferenceWith1x1; + /** + * 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. + * + * @category Array + * @param [values] The arrays to inspect. + * @param [comparator] The comparator invoked per element. + * @returns Returns the new array of filtered values. + * @example + * + * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; + + * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual); + * // => [{ 'x': 2, 'y': 1 }] + */ + (array: _.List | null | undefined): DifferenceWith1x2; + /** + * 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. + * + * @category Array + * @param [values] The arrays to inspect. + * @param [comparator] The comparator invoked per element. + * @returns Returns the new array of filtered values. + * @example + * + * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; + + * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual); + * // => [{ 'x': 2, 'y': 1 }] + */ + (array: _.List | null | undefined, values: _.List): T1[]; +} +interface DifferenceWith1x2 { + /** + * 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. + * + * @category Array + * @param [values] The arrays to inspect. + * @param [comparator] The comparator invoked per element. + * @returns Returns the new array of filtered values. + * @example + * + * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; + + * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual); + * // => [{ 'x': 2, 'y': 1 }] + */ + (): DifferenceWith1x2; + /** + * 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. + * + * @category Array + * @param [values] The arrays to inspect. + * @param [comparator] The comparator invoked per element. + * @returns Returns the new array of filtered values. + * @example + * + * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; + + * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual); + * // => [{ 'x': 2, 'y': 1 }] + */ + (values: _.List): T1[]; +} + +declare const differenceWith: DifferenceWith; +export = differenceWith; diff --git a/types/lodash/fp/dissoc.d.ts b/types/lodash/fp/dissoc.d.ts new file mode 100644 index 0000000000..ad931b90da --- /dev/null +++ b/types/lodash/fp/dissoc.d.ts @@ -0,0 +1,63 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Unset { + /** + * Removes the property at path of object. + * + * Note: This method mutates object. + * + * @param object The object to modify. + * @param path The path of the property to unset. + * @return Returns true if the property is deleted, else false. + */ + (): Unset; + /** + * Removes the property at path of object. + * + * Note: This method mutates object. + * + * @param object The object to modify. + * @param path The path of the property to unset. + * @return Returns true if the property is deleted, else false. + */ + (path: _.PropertyPath): Unset1x1; + /** + * Removes the property at path of object. + * + * Note: This method mutates object. + * + * @param object The object to modify. + * @param path The path of the property to unset. + * @return Returns true if the property is deleted, else false. + */ + (path: _.PropertyPath, object: any): boolean; +} +interface Unset1x1 { + /** + * Removes the property at path of object. + * + * Note: This method mutates object. + * + * @param object The object to modify. + * @param path The path of the property to unset. + * @return Returns true if the property is deleted, else false. + */ + (): Unset1x1; + /** + * Removes the property at path of object. + * + * Note: This method mutates object. + * + * @param object The object to modify. + * @param path The path of the property to unset. + * @return Returns true if the property is deleted, else false. + */ + (object: any): boolean; +} + +declare const dissoc: Unset; +export = dissoc; diff --git a/types/lodash/fp/dissocPath.d.ts b/types/lodash/fp/dissocPath.d.ts new file mode 100644 index 0000000000..8d98858a6c --- /dev/null +++ b/types/lodash/fp/dissocPath.d.ts @@ -0,0 +1,63 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Unset { + /** + * Removes the property at path of object. + * + * Note: This method mutates object. + * + * @param object The object to modify. + * @param path The path of the property to unset. + * @return Returns true if the property is deleted, else false. + */ + (): Unset; + /** + * Removes the property at path of object. + * + * Note: This method mutates object. + * + * @param object The object to modify. + * @param path The path of the property to unset. + * @return Returns true if the property is deleted, else false. + */ + (path: _.PropertyPath): Unset1x1; + /** + * Removes the property at path of object. + * + * Note: This method mutates object. + * + * @param object The object to modify. + * @param path The path of the property to unset. + * @return Returns true if the property is deleted, else false. + */ + (path: _.PropertyPath, object: any): boolean; +} +interface Unset1x1 { + /** + * Removes the property at path of object. + * + * Note: This method mutates object. + * + * @param object The object to modify. + * @param path The path of the property to unset. + * @return Returns true if the property is deleted, else false. + */ + (): Unset1x1; + /** + * Removes the property at path of object. + * + * Note: This method mutates object. + * + * @param object The object to modify. + * @param path The path of the property to unset. + * @return Returns true if the property is deleted, else false. + */ + (object: any): boolean; +} + +declare const dissocPath: Unset; +export = dissocPath; diff --git a/types/lodash/fp/divide.d.ts b/types/lodash/fp/divide.d.ts new file mode 100644 index 0000000000..293acebb68 --- /dev/null +++ b/types/lodash/fp/divide.d.ts @@ -0,0 +1,51 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface Divide { + /** + * Divide two numbers. + * + * @param dividend The first number in a division. + * @param divisor The second number in a division. + * @returns Returns the quotient. + */ + (): Divide; + /** + * Divide two numbers. + * + * @param dividend The first number in a division. + * @param divisor The second number in a division. + * @returns Returns the quotient. + */ + (dividend: number): Divide1x1; + /** + * Divide two numbers. + * + * @param dividend The first number in a division. + * @param divisor The second number in a division. + * @returns Returns the quotient. + */ + (dividend: number, divisor: number): number; +} +interface Divide1x1 { + /** + * Divide two numbers. + * + * @param dividend The first number in a division. + * @param divisor The second number in a division. + * @returns Returns the quotient. + */ + (): Divide1x1; + /** + * Divide two numbers. + * + * @param dividend The first number in a division. + * @param divisor The second number in a division. + * @returns Returns the quotient. + */ + (divisor: number): number; +} + +declare const divide: Divide; +export = divide; diff --git a/types/lodash/fp/drop.d.ts b/types/lodash/fp/drop.d.ts new file mode 100644 index 0000000000..3c524f1321 --- /dev/null +++ b/types/lodash/fp/drop.d.ts @@ -0,0 +1,53 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Drop { + /** + * 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; + /** + * 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. + */ + (n: number): Drop1x1; + /** + * 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. + */ + (n: number, array: _.List | null | undefined): T[]; +} +interface Drop1x1 { + /** + * 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. + */ + (): Drop1x1; + /** + * 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. + */ + (array: _.List | null | undefined): T[]; +} + +declare const drop: Drop; +export = drop; diff --git a/types/lodash/fp/dropLast.d.ts b/types/lodash/fp/dropLast.d.ts new file mode 100644 index 0000000000..e0fb5db69e --- /dev/null +++ b/types/lodash/fp/dropLast.d.ts @@ -0,0 +1,53 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface DropRight { + /** + * 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; + /** + * 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. + */ + (n: number): DropRight1x1; + /** + * 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. + */ + (n: number, array: _.List | null | undefined): T[]; +} +interface DropRight1x1 { + /** + * 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. + */ + (): DropRight1x1; + /** + * 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. + */ + (array: _.List | null | undefined): T[]; +} + +declare const dropLast: DropRight; +export = dropLast; diff --git a/types/lodash/fp/dropLastWhile.d.ts b/types/lodash/fp/dropLastWhile.d.ts new file mode 100644 index 0000000000..3d0d5634ef --- /dev/null +++ b/types/lodash/fp/dropLastWhile.d.ts @@ -0,0 +1,108 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface DropRightWhile { + /** + * 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; + /** + * 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. + */ + (predicate: _.ValueIteratee): DropRightWhile1x1; + /** + * 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. + */ + (predicate: _.ValueIteratee, array: _.List | null | undefined): T[]; +} +interface DropRightWhile1x1 { + /** + * 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. + */ + (): DropRightWhile1x1; + /** + * 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. + */ + (array: _.List | null | undefined): T[]; +} + +declare const dropLastWhile: DropRightWhile; +export = dropLastWhile; diff --git a/types/lodash/fp/dropRight.d.ts b/types/lodash/fp/dropRight.d.ts new file mode 100644 index 0000000000..4c07c3c8a5 --- /dev/null +++ b/types/lodash/fp/dropRight.d.ts @@ -0,0 +1,53 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface DropRight { + /** + * 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; + /** + * 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. + */ + (n: number): DropRight1x1; + /** + * 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. + */ + (n: number, array: _.List | null | undefined): T[]; +} +interface DropRight1x1 { + /** + * 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. + */ + (): DropRight1x1; + /** + * 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. + */ + (array: _.List | null | undefined): T[]; +} + +declare const dropRight: DropRight; +export = dropRight; diff --git a/types/lodash/fp/dropRightWhile.d.ts b/types/lodash/fp/dropRightWhile.d.ts new file mode 100644 index 0000000000..e346a77e97 --- /dev/null +++ b/types/lodash/fp/dropRightWhile.d.ts @@ -0,0 +1,108 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface DropRightWhile { + /** + * 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; + /** + * 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. + */ + (predicate: _.ValueIteratee): DropRightWhile1x1; + /** + * 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. + */ + (predicate: _.ValueIteratee, array: _.List | null | undefined): T[]; +} +interface DropRightWhile1x1 { + /** + * 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. + */ + (): DropRightWhile1x1; + /** + * 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. + */ + (array: _.List | null | undefined): T[]; +} + +declare const dropRightWhile: DropRightWhile; +export = dropRightWhile; diff --git a/types/lodash/fp/dropWhile.d.ts b/types/lodash/fp/dropWhile.d.ts new file mode 100644 index 0000000000..056a06bc3e --- /dev/null +++ b/types/lodash/fp/dropWhile.d.ts @@ -0,0 +1,108 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface DropWhile { + /** + * 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; + /** + * 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. + */ + (predicate: _.ValueIteratee): DropWhile1x1; + /** + * 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. + */ + (predicate: _.ValueIteratee, array: _.List | null | undefined): T[]; +} +interface DropWhile1x1 { + /** + * 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. + */ + (): DropWhile1x1; + /** + * 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. + */ + (array: _.List | null | undefined): T[]; +} + +declare const dropWhile: DropWhile; +export = dropWhile; diff --git a/types/lodash/fp/each.d.ts b/types/lodash/fp/each.d.ts new file mode 100644 index 0000000000..df0afae30f --- /dev/null +++ b/types/lodash/fp/each.d.ts @@ -0,0 +1,330 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface ForEach { + /** + * 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; + /** + * 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. + */ + (iteratee: (value: T) => any): ForEach1x1; + /** + * 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. + */ + (iteratee: (value: T) => any, collection: ReadonlyArray): T[]; + /** + * 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. + */ + (iteratee: (value: string) => any): ForEach2x1; + /** + * 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. + */ + (iteratee: (value: string) => any, collection: string): string; + /** + * 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. + */ + (iteratee: (value: T) => any, collection: _.List): _.List; + /** + * 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. + */ + (iteratee: (value: T[keyof T]) => any, collection: T): T; + /** + * 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. + */ + (iteratee: (value: T) => any, collection: TArray & (T[] | null | undefined)): TArray; + /** + * 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. + */ + (iteratee: (value: string) => any, collection: TString): TString; + /** + * 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. + */ + | null | undefined>(iteratee: (value: T) => any, collection: TList & (_.List | null | undefined)): TList; + /** + * 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. + */ + (iteratee: (value: T[keyof T]) => any, collection: T | null | undefined): T | null | undefined; +} +interface ForEach1x1 { + /** + * 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. + */ + (): ForEach1x1; + /** + * 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. + */ + (collection: ReadonlyArray): T[]; + /** + * 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. + */ + (collection: _.List): _.List; + /** + * 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. + */ + (collection: T1): T1; + /** + * 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. + */ + (collection: TArray & (T[] | null | undefined)): TArray; + /** + * 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. + */ + | null | undefined>(collection: TList & (_.List | null | undefined)): TList; + /** + * 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. + */ + (collection: T1 | null | undefined): T1 | null | undefined; +} +interface ForEach2x1 { + /** + * 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. + */ + (): ForEach2x1; + /** + * 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. + */ + (collection: string): string; + /** + * 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. + */ + (collection: TString): TString; +} + +declare const each: ForEach; +export = each; diff --git a/types/lodash/fp/eachRight.d.ts b/types/lodash/fp/eachRight.d.ts new file mode 100644 index 0000000000..06af73ca68 --- /dev/null +++ b/types/lodash/fp/eachRight.d.ts @@ -0,0 +1,225 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface ForEachRight { + /** + * 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; + /** + * 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. + */ + (iteratee: (value: T) => any): ForEachRight1x1; + /** + * 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. + */ + (iteratee: (value: T) => any, collection: ReadonlyArray): T[]; + /** + * 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. + */ + (iteratee: (value: string) => any): ForEachRight2x1; + /** + * 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. + */ + (iteratee: (value: string) => any, collection: string): string; + /** + * 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. + */ + (iteratee: (value: T) => any, collection: _.List): _.List; + /** + * 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. + */ + (iteratee: (value: T[keyof T]) => any, collection: T): T; + /** + * 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. + */ + (iteratee: (value: T) => any, collection: TArray & (T[] | null | undefined)): TArray; + /** + * 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. + */ + (iteratee: (value: string) => any, collection: TString): TString; + /** + * 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. + */ + | null | undefined>(iteratee: (value: T) => any, collection: TList & (_.List | null | undefined)): TList; + /** + * 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. + */ + (iteratee: (value: T[keyof T]) => any, collection: T | null | undefined): T | null | undefined; +} +interface ForEachRight1x1 { + /** + * 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. + */ + (): ForEachRight1x1; + /** + * 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. + */ + (collection: ReadonlyArray): T[]; + /** + * 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. + */ + (collection: _.List): _.List; + /** + * 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. + */ + (collection: T1): T1; + /** + * 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. + */ + (collection: TArray & (T[] | null | undefined)): TArray; + /** + * 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. + */ + | null | undefined>(collection: TList & (_.List | null | undefined)): TList; + /** + * 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. + */ + (collection: T1 | null | undefined): T1 | null | undefined; +} +interface ForEachRight2x1 { + /** + * 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. + */ + (): ForEachRight2x1; + /** + * 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. + */ + (collection: string): string; + /** + * 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. + */ + (collection: TString): TString; +} + +declare const eachRight: ForEachRight; +export = eachRight; diff --git a/types/lodash/fp/endsWith.d.ts b/types/lodash/fp/endsWith.d.ts new file mode 100644 index 0000000000..5808870c50 --- /dev/null +++ b/types/lodash/fp/endsWith.d.ts @@ -0,0 +1,56 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface EndsWith { + /** + * 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; + /** + * 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. + */ + (target: string): EndsWith1x1; + /** + * 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. + */ + (target: string, string: string): boolean; +} +interface EndsWith1x1 { + /** + * 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. + */ + (): EndsWith1x1; + /** + * 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. + */ + (string: string): boolean; +} + +declare const endsWith: EndsWith; +export = endsWith; diff --git a/types/lodash/fp/entries.d.ts b/types/lodash/fp/entries.d.ts new file mode 100644 index 0000000000..99b04076c7 --- /dev/null +++ b/types/lodash/fp/entries.d.ts @@ -0,0 +1,25 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface ToPairs { + /** + * Creates an array of own enumerable key-value pairs for object. + * + * @param object The object to query. + * @return Returns the new array of key-value pairs. + */ + (object: _.Dictionary | _.NumericDictionary): Array<[string, T]>; + /** + * Creates an array of own enumerable key-value pairs for object. + * + * @param object The object to query. + * @return Returns the new array of key-value pairs. + */ + (object: object): Array<[string, any]>; +} + +declare const entries: ToPairs; +export = entries; diff --git a/types/lodash/fp/entriesIn.d.ts b/types/lodash/fp/entriesIn.d.ts new file mode 100644 index 0000000000..3579959f84 --- /dev/null +++ b/types/lodash/fp/entriesIn.d.ts @@ -0,0 +1,25 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface ToPairsIn { + /** + * Creates an array of own and inherited enumerable key-value pairs for object. + * + * @param object The object to query. + * @return Returns the new array of key-value pairs. + */ + (object: _.Dictionary | _.NumericDictionary): Array<[string, T]>; + /** + * Creates an array of own and inherited enumerable key-value pairs for object. + * + * @param object The object to query. + * @return Returns the new array of key-value pairs. + */ + (object: object): Array<[string, any]>; +} + +declare const entriesIn: ToPairsIn; +export = entriesIn; diff --git a/types/lodash/fp/eq.d.ts b/types/lodash/fp/eq.d.ts new file mode 100644 index 0000000000..4c3278ae3d --- /dev/null +++ b/types/lodash/fp/eq.d.ts @@ -0,0 +1,156 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface Eq { + /** + * Performs a [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * comparison between two values to determine if they are equivalent. + * + * @category Lang + * @param value The value to compare. + * @param other The other value to compare. + * @returns 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; + /** + * Performs a [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * comparison between two values to determine if they are equivalent. + * + * @category Lang + * @param value The value to compare. + * @param other The other value to compare. + * @returns 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 + */ + (value: any): Eq1x1; + /** + * Performs a [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * comparison between two values to determine if they are equivalent. + * + * @category Lang + * @param value The value to compare. + * @param other The other value to compare. + * @returns 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 + */ + (value: any, other: any): boolean; +} +interface Eq1x1 { + /** + * Performs a [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * comparison between two values to determine if they are equivalent. + * + * @category Lang + * @param value The value to compare. + * @param other The other value to compare. + * @returns 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 + */ + (): Eq1x1; + /** + * Performs a [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * comparison between two values to determine if they are equivalent. + * + * @category Lang + * @param value The value to compare. + * @param other The other value to compare. + * @returns 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 + */ + (other: any): boolean; +} + +declare const eq: Eq; +export = eq; diff --git a/types/lodash/fp/equals.d.ts b/types/lodash/fp/equals.d.ts new file mode 100644 index 0000000000..3e3f9b1853 --- /dev/null +++ b/types/lodash/fp/equals.d.ts @@ -0,0 +1,141 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface IsEqual { + /** + * Performs a deep comparison between two values to determine if they are + * equivalent. + * + * **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. + * + * @category Lang + * @param value The value to compare. + * @param other The other value to compare. + * @returns Returns `true` if the values are equivalent, else `false`. + * @example + * + * var object = { 'user': 'fred' }; + * var other = { 'user': 'fred' }; + * + * _.isEqual(object, other); + * // => true + * + * object === other; + * // => false + */ + (): IsEqual; + /** + * Performs a deep comparison between two values to determine if they are + * equivalent. + * + * **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. + * + * @category Lang + * @param value The value to compare. + * @param other The other value to compare. + * @returns Returns `true` if the values are equivalent, else `false`. + * @example + * + * var object = { 'user': 'fred' }; + * var other = { 'user': 'fred' }; + * + * _.isEqual(object, other); + * // => true + * + * object === other; + * // => false + */ + (value: any): IsEqual1x1; + /** + * Performs a deep comparison between two values to determine if they are + * equivalent. + * + * **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. + * + * @category Lang + * @param value The value to compare. + * @param other The other value to compare. + * @returns Returns `true` if the values are equivalent, else `false`. + * @example + * + * var object = { 'user': 'fred' }; + * var other = { 'user': 'fred' }; + * + * _.isEqual(object, other); + * // => true + * + * object === other; + * // => false + */ + (value: any, other: any): boolean; +} +interface IsEqual1x1 { + /** + * Performs a deep comparison between two values to determine if they are + * equivalent. + * + * **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. + * + * @category Lang + * @param value The value to compare. + * @param other The other value to compare. + * @returns Returns `true` if the values are equivalent, else `false`. + * @example + * + * var object = { 'user': 'fred' }; + * var other = { 'user': 'fred' }; + * + * _.isEqual(object, other); + * // => true + * + * object === other; + * // => false + */ + (): IsEqual1x1; + /** + * Performs a deep comparison between two values to determine if they are + * equivalent. + * + * **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. + * + * @category Lang + * @param value The value to compare. + * @param other The other value to compare. + * @returns Returns `true` if the values are equivalent, else `false`. + * @example + * + * var object = { 'user': 'fred' }; + * var other = { 'user': 'fred' }; + * + * _.isEqual(object, other); + * // => true + * + * object === other; + * // => false + */ + (other: any): boolean; +} + +declare const equals: IsEqual; +export = equals; diff --git a/types/lodash/fp/escape.d.ts b/types/lodash/fp/escape.d.ts new file mode 100644 index 0000000000..18f704928d --- /dev/null +++ b/types/lodash/fp/escape.d.ts @@ -0,0 +1,26 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type Escape = + /** + * 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. + * + * hough 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 IE < 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. + */ + (string: string) => string; + +declare const escape: Escape; +export = escape; diff --git a/types/lodash/fp/escapeRegExp.d.ts b/types/lodash/fp/escapeRegExp.d.ts new file mode 100644 index 0000000000..f66fa150c8 --- /dev/null +++ b/types/lodash/fp/escapeRegExp.d.ts @@ -0,0 +1,16 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type EscapeRegExp = + /** + * Escapes the RegExp special characters "^", "$", "\", ".", "*", "+", "?", "(", ")", "[", "]", + * "{", "}", and "|" in string. + * + * @param string The string to escape. + * @return Returns the escaped string. + */ + (string: string) => string; + +declare const escapeRegExp: EscapeRegExp; +export = escapeRegExp; diff --git a/types/lodash/fp/every.d.ts b/types/lodash/fp/every.d.ts new file mode 100644 index 0000000000..fc60615c96 --- /dev/null +++ b/types/lodash/fp/every.d.ts @@ -0,0 +1,67 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Every { + /** + * Checks if predicate returns truthy for all elements of collection. Iteration is stopped once predicate + * returns falsey. The predicate is invoked with three arguments: (value, index|key, collection). + * + * @param collection The collection to iterate over. + * @param predicate The function invoked per iteration. + * @return Returns true if all elements pass the predicate check, else false. + */ + (): Every; + /** + * Checks if predicate returns truthy for all elements of collection. Iteration is stopped once predicate + * returns falsey. The predicate is invoked with three arguments: (value, index|key, collection). + * + * @param collection The collection to iterate over. + * @param predicate The function invoked per iteration. + * @return Returns true if all elements pass the predicate check, else false. + */ + (predicate: _.ValueIterateeCustom): Every1x1; + /** + * Checks if predicate returns truthy for all elements of collection. Iteration is stopped once predicate + * returns falsey. The predicate is invoked with three arguments: (value, index|key, collection). + * + * @param collection The collection to iterate over. + * @param predicate The function invoked per iteration. + * @return Returns true if all elements pass the predicate check, else false. + */ + (predicate: _.ValueIterateeCustom, collection: _.List | null | undefined): boolean; + /** + * Checks if predicate returns truthy for all elements of collection. Iteration is stopped once predicate + * returns falsey. The predicate is invoked with three arguments: (value, index|key, collection). + * + * @param collection The collection to iterate over. + * @param predicate The function invoked per iteration. + * @return Returns true if all elements pass the predicate check, else false. + */ + (predicate: _.ValueIterateeCustom, collection: T | null | undefined): boolean; +} +interface Every1x1 { + /** + * Checks if predicate returns truthy for all elements of collection. Iteration is stopped once predicate + * returns falsey. The predicate is invoked with three arguments: (value, index|key, collection). + * + * @param collection The collection to iterate over. + * @param predicate The function invoked per iteration. + * @return Returns true if all elements pass the predicate check, else false. + */ + (): Every1x1; + /** + * Checks if predicate returns truthy for all elements of collection. Iteration is stopped once predicate + * returns falsey. The predicate is invoked with three arguments: (value, index|key, collection). + * + * @param collection The collection to iterate over. + * @param predicate The function invoked per iteration. + * @return Returns true if all elements pass the predicate check, else false. + */ + (collection: _.List | object | null | undefined): boolean; +} + +declare const every: Every; +export = every; diff --git a/types/lodash/fp/extend.d.ts b/types/lodash/fp/extend.d.ts new file mode 100644 index 0000000000..ee0889f8ae --- /dev/null +++ b/types/lodash/fp/extend.d.ts @@ -0,0 +1,151 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface AssignIn { + /** + * This method is like `_.assign` except that it iterates over own and + * inherited source properties. + * + * **Note:** This method mutates `object`. + * + * @alias extend + * @category Object + * @param object The destination object. + * @param [sources] The source objects. + * @returns 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; + /** + * This method is like `_.assign` except that it iterates over own and + * inherited source properties. + * + * **Note:** This method mutates `object`. + * + * @alias extend + * @category Object + * @param object The destination object. + * @param [sources] The source objects. + * @returns 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 } + */ + (object: TObject): AssignIn1x1; + /** + * This method is like `_.assign` except that it iterates over own and + * inherited source properties. + * + * **Note:** This method mutates `object`. + * + * @alias extend + * @category Object + * @param object The destination object. + * @param [sources] The source objects. + * @returns 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 } + */ + (object: TObject, source: TSource): TObject & TSource; +} +interface AssignIn1x1 { + /** + * This method is like `_.assign` except that it iterates over own and + * inherited source properties. + * + * **Note:** This method mutates `object`. + * + * @alias extend + * @category Object + * @param object The destination object. + * @param [sources] The source objects. + * @returns 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 } + */ + (): AssignIn1x1; + /** + * This method is like `_.assign` except that it iterates over own and + * inherited source properties. + * + * **Note:** This method mutates `object`. + * + * @alias extend + * @category Object + * @param object The destination object. + * @param [sources] The source objects. + * @returns 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 } + */ + (source: TSource): TObject & TSource; +} + +declare const extend: AssignIn; +export = extend; diff --git a/types/lodash/fp/extendAll.d.ts b/types/lodash/fp/extendAll.d.ts new file mode 100644 index 0000000000..a8168d774d --- /dev/null +++ b/types/lodash/fp/extendAll.d.ts @@ -0,0 +1,36 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type AssignIn = + /** + * This method is like `_.assign` except that it iterates over own and + * inherited source properties. + * + * **Note:** This method mutates `object`. + * + * @alias extend + * @category Object + * @param object The destination object. + * @param [sources] The source objects. + * @returns 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 } + */ + (object: ReadonlyArray) => TResult; + +declare const extendAll: AssignIn; +export = extendAll; diff --git a/types/lodash/fp/extendAllWith.d.ts b/types/lodash/fp/extendAllWith.d.ts new file mode 100644 index 0000000000..6e2d7602d3 --- /dev/null +++ b/types/lodash/fp/extendAllWith.d.ts @@ -0,0 +1,143 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface AssignInWith { + /** + * 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`. + * + * @alias extendWith + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param [customizer] The function to customize assigned values. + * @returns 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; + /** + * 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`. + * + * @alias extendWith + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param [customizer] The function to customize assigned values. + * @returns 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 } + */ + (customizer: _.AssignCustomizer): AssignInWith1x1; + /** + * 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`. + * + * @alias extendWith + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param [customizer] The function to customize assigned values. + * @returns 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 } + */ + (customizer: _.AssignCustomizer, args: ReadonlyArray): any; +} +interface AssignInWith1x1 { + /** + * 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`. + * + * @alias extendWith + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param [customizer] The function to customize assigned values. + * @returns 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 } + */ + (): AssignInWith1x1; + /** + * 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`. + * + * @alias extendWith + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param [customizer] The function to customize assigned values. + * @returns 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 } + */ + (args: ReadonlyArray): any; +} + +declare const extendAllWith: AssignInWith; +export = extendAllWith; diff --git a/types/lodash/fp/extendWith.d.ts b/types/lodash/fp/extendWith.d.ts new file mode 100644 index 0000000000..39b50e9ebf --- /dev/null +++ b/types/lodash/fp/extendWith.d.ts @@ -0,0 +1,249 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface AssignInWith { + /** + * 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`. + * + * @alias extendWith + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param [customizer] The function to customize assigned values. + * @returns 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; + /** + * 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`. + * + * @alias extendWith + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param [customizer] The function to customize assigned values. + * @returns 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 } + */ + (customizer: _.AssignCustomizer): AssignInWith1x1; + /** + * 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`. + * + * @alias extendWith + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param [customizer] The function to customize assigned values. + * @returns 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 } + */ + (customizer: _.AssignCustomizer, object: TObject): AssignInWith1x2; + /** + * 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`. + * + * @alias extendWith + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param [customizer] The function to customize assigned values. + * @returns 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 } + */ + (customizer: _.AssignCustomizer, object: TObject, source: TSource): TObject & TSource; +} +interface AssignInWith1x1 { + /** + * 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`. + * + * @alias extendWith + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param [customizer] The function to customize assigned values. + * @returns 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 } + */ + (): AssignInWith1x1; + /** + * 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`. + * + * @alias extendWith + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param [customizer] The function to customize assigned values. + * @returns 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 } + */ + (object: TObject): AssignInWith1x2; + /** + * 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`. + * + * @alias extendWith + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param [customizer] The function to customize assigned values. + * @returns 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 } + */ + (object: TObject, source: TSource): TObject & TSource; +} +interface AssignInWith1x2 { + /** + * 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`. + * + * @alias extendWith + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param [customizer] The function to customize assigned values. + * @returns 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 } + */ + (): AssignInWith1x2; + /** + * 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`. + * + * @alias extendWith + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param [customizer] The function to customize assigned values. + * @returns 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 } + */ + (source: TSource): TObject & TSource; +} + +declare const extendWith: AssignInWith; +export = extendWith; diff --git a/types/lodash/fp/fill.d.ts b/types/lodash/fp/fill.d.ts new file mode 100644 index 0000000000..5349e8e067 --- /dev/null +++ b/types/lodash/fp/fill.d.ts @@ -0,0 +1,233 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Fill { + /** + * 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; + /** + * 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. + */ + (start: number): Fill1x1; + /** + * 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. + */ + (start: number, end: number): Fill1x2; + /** + * 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. + */ + (start: number, end: number, value: T): Fill1x3; + /** + * 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. + */ + (start: number, end: number, value: T, array: U[] | null | undefined): Array; + /** + * 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. + */ + (start: number, end: number, value: T, array: _.List | null | undefined): _.List; +} +interface Fill1x1 { + /** + * 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. + */ + (): Fill1x1; + /** + * 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. + */ + (end: number): Fill1x2; + /** + * 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. + */ + (end: number, value: T): Fill1x3; + /** + * 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. + */ + (end: number, value: T, array: U[] | null | undefined): Array; + /** + * 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. + */ + (end: number, value: T, array: _.List | null | undefined): _.List; +} +interface Fill1x2 { + /** + * 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. + */ + (): Fill1x2; + /** + * 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. + */ + (value: T): Fill1x3; + /** + * 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. + */ + (value: T, array: U[] | null | undefined): Array; + /** + * 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. + */ + (value: T, array: _.List | null | undefined): _.List; +} +interface Fill1x3 { + /** + * 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. + */ + (): Fill1x3; + /** + * 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. + */ + (array: U[] | null | undefined): Array; + /** + * 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. + */ + (array: _.List | null | undefined): _.List; +} + +declare const fill: Fill; +export = fill; diff --git a/types/lodash/fp/filter.d.ts b/types/lodash/fp/filter.d.ts new file mode 100644 index 0000000000..289c0edcd5 --- /dev/null +++ b/types/lodash/fp/filter.d.ts @@ -0,0 +1,361 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Filter { + /** + * 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. + * + * @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; + /** + * 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. + * + * @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. + */ + (predicate: (value: string) => boolean): Filter1x1; + /** + * 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. + * + * @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. + */ + (predicate: (value: string) => boolean, collection: string | null | undefined): string[]; + /** + * 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. + * + * @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. + */ + (predicate: _.ValueIteratorTypeGuard): Filter2x1; + /** + * 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. + * + * @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. + */ + (predicate: _.ValueIteratorTypeGuard, collection: _.List | null | undefined): S[]; + /** + * 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. + * + * @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. + */ + (predicate: _.ValueIterateeCustom): Filter3x1; + /** + * 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. + * + * @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. + */ + (predicate: _.ValueIterateeCustom, collection: _.List | null | undefined): T[]; + /** + * 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. + * + * @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. + */ + (predicate: _.ValueIteratorTypeGuard): Filter4x1; + /** + * 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. + * + * @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. + */ + (predicate: _.ValueIteratorTypeGuard, collection: T | null | undefined): S[]; + /** + * 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. + * + * @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. + */ + (predicate: _.ValueIterateeCustom, collection: T | null | undefined): Array; +} +interface Filter1x1 { + /** + * 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. + * + * @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. + */ + (): Filter1x1; + /** + * 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. + * + * @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. + */ + (collection: string | null | undefined): string[]; +} +interface Filter2x1 { + /** + * 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. + * + * @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. + */ + (): Filter2x1; + /** + * 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. + * + * @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. + */ + (collection: _.List | null | undefined): S[]; +} +interface Filter3x1 { + /** + * 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. + * + * @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. + */ + (): Filter3x1; + /** + * 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. + * + * @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. + */ + (collection: _.List | object | null | undefined): T[]; +} +interface Filter4x1 { + /** + * 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. + * + * @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. + */ + (): Filter4x1; + /** + * 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. + * + * @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. + */ + (collection: T | null | undefined): S[]; +} + +declare const filter: Filter; +export = filter; diff --git a/types/lodash/fp/find.d.ts b/types/lodash/fp/find.d.ts new file mode 100644 index 0000000000..d562ef3894 --- /dev/null +++ b/types/lodash/fp/find.d.ts @@ -0,0 +1,283 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Find { + /** + * 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. + * + * @param collection The collection to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the matched element, else undefined. + */ + (): Find; + /** + * 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. + * + * @param collection The collection to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the matched element, else undefined. + */ + (predicate: _.ValueIteratorTypeGuard): Find1x1; + /** + * 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. + * + * @param collection The collection to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the matched element, else undefined. + */ + (predicate: _.ValueIteratorTypeGuard, collection: _.List | null | undefined): S|undefined; + /** + * 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. + * + * @param collection The collection to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the matched element, else undefined. + */ + (predicate: _.ValueIterateeCustom): Find2x1; + /** + * 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. + * + * @param collection The collection to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the matched element, else undefined. + */ + (predicate: _.ValueIterateeCustom, collection: _.List | null | undefined): T|undefined; + /** + * 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. + * + * @param collection The collection to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the matched element, else undefined. + */ + (predicate: _.ValueIteratorTypeGuard): Find3x1; + /** + * 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. + * + * @param collection The collection to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the matched element, else undefined. + */ + (predicate: _.ValueIteratorTypeGuard, collection: T | null | undefined): S|undefined; + /** + * 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. + * + * @param collection The collection to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the matched element, else undefined. + */ + (predicate: _.ValueIterateeCustom, collection: T | null | undefined): T[keyof T]|undefined; +} +interface Find1x1 { + /** + * 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. + * + * @param collection The collection to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the matched element, else undefined. + */ + (): Find1x1; + /** + * 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. + * + * @param collection The collection to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the matched element, else undefined. + */ + (collection: _.List | null | undefined): S|undefined; +} +interface Find2x1 { + /** + * 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. + * + * @param collection The collection to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the matched element, else undefined. + */ + (): Find2x1; + /** + * 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. + * + * @param collection The collection to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the matched element, else undefined. + */ + (collection: _.List | object | null | undefined): T|undefined; +} +interface Find3x1 { + /** + * 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. + * + * @param collection The collection to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the matched element, else undefined. + */ + (): Find3x1; + /** + * 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. + * + * @param collection The collection to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the matched element, else undefined. + */ + (collection: T | null | undefined): S|undefined; +} + +declare const find: Find; +export = find; diff --git a/types/lodash/fp/findFrom.d.ts b/types/lodash/fp/findFrom.d.ts new file mode 100644 index 0000000000..c2c83b5644 --- /dev/null +++ b/types/lodash/fp/findFrom.d.ts @@ -0,0 +1,517 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Find { + /** + * 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. + * + * @param collection The collection to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the matched element, else undefined. + */ + (): Find; + /** + * 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. + * + * @param collection The collection to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the matched element, else undefined. + */ + (predicate: _.ValueIteratorTypeGuard): Find1x1; + /** + * 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. + * + * @param collection The collection to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the matched element, else undefined. + */ + (predicate: _.ValueIteratorTypeGuard, fromIndex: number): Find1x2; + /** + * 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. + * + * @param collection The collection to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the matched element, else undefined. + */ + (predicate: _.ValueIteratorTypeGuard, fromIndex: number, collection: _.List | null | undefined): S|undefined; + /** + * 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. + * + * @param collection The collection to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the matched element, else undefined. + */ + (predicate: _.ValueIterateeCustom): Find2x1; + /** + * 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. + * + * @param collection The collection to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the matched element, else undefined. + */ + (predicate: _.ValueIterateeCustom, fromIndex: number): Find2x2; + /** + * 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. + * + * @param collection The collection to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the matched element, else undefined. + */ + (predicate: _.ValueIterateeCustom, fromIndex: number, collection: _.List | null | undefined): T|undefined; + /** + * 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. + * + * @param collection The collection to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the matched element, else undefined. + */ + (predicate: _.ValueIteratorTypeGuard): Find3x1; + /** + * 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. + * + * @param collection The collection to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the matched element, else undefined. + */ + (predicate: _.ValueIteratorTypeGuard, fromIndex: number): Find3x2; + /** + * 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. + * + * @param collection The collection to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the matched element, else undefined. + */ + (predicate: _.ValueIteratorTypeGuard, fromIndex: number, collection: T | null | undefined): S|undefined; + /** + * 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. + * + * @param collection The collection to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the matched element, else undefined. + */ + (predicate: _.ValueIterateeCustom, fromIndex: number, collection: T | null | undefined): T[keyof T]|undefined; +} +interface Find1x1 { + /** + * 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. + * + * @param collection The collection to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the matched element, else undefined. + */ + (): Find1x1; + /** + * 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. + * + * @param collection The collection to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the matched element, else undefined. + */ + (fromIndex: number): Find1x2; + /** + * 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. + * + * @param collection The collection to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the matched element, else undefined. + */ + (fromIndex: number, collection: _.List | null | undefined): S|undefined; +} +interface Find1x2 { + /** + * 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. + * + * @param collection The collection to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the matched element, else undefined. + */ + (): Find1x2; + /** + * 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. + * + * @param collection The collection to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the matched element, else undefined. + */ + (collection: _.List | null | undefined): S|undefined; +} +interface Find2x1 { + /** + * 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. + * + * @param collection The collection to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the matched element, else undefined. + */ + (): Find2x1; + /** + * 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. + * + * @param collection The collection to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the matched element, else undefined. + */ + (fromIndex: number): Find2x2; + /** + * 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. + * + * @param collection The collection to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the matched element, else undefined. + */ + (fromIndex: number, collection: _.List | object | null | undefined): T|undefined; +} +interface Find2x2 { + /** + * 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. + * + * @param collection The collection to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the matched element, else undefined. + */ + (): Find2x2; + /** + * 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. + * + * @param collection The collection to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the matched element, else undefined. + */ + (collection: _.List | object | null | undefined): T|undefined; +} +interface Find3x1 { + /** + * 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. + * + * @param collection The collection to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the matched element, else undefined. + */ + (): Find3x1; + /** + * 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. + * + * @param collection The collection to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the matched element, else undefined. + */ + (fromIndex: number): Find3x2; + /** + * 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. + * + * @param collection The collection to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the matched element, else undefined. + */ + (fromIndex: number, collection: T | null | undefined): S|undefined; +} +interface Find3x2 { + /** + * 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. + * + * @param collection The collection to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the matched element, else undefined. + */ + (): Find3x2; + /** + * 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. + * + * @param collection The collection to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the matched element, else undefined. + */ + (collection: T | null | undefined): S|undefined; +} + +declare const findFrom: Find; +export = findFrom; diff --git a/types/lodash/fp/findIndex.d.ts b/types/lodash/fp/findIndex.d.ts new file mode 100644 index 0000000000..18842b2513 --- /dev/null +++ b/types/lodash/fp/findIndex.d.ts @@ -0,0 +1,108 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface FindIndex { + /** + * 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 fromIndex The index to search from. + * @return Returns the index of the found element, else -1. + */ + (): FindIndex; + /** + * 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 fromIndex The index to search from. + * @return Returns the index of the found element, else -1. + */ + (predicate: _.ValueIterateeCustom): FindIndex1x1; + /** + * 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 fromIndex The index to search from. + * @return Returns the index of the found element, else -1. + */ + (predicate: _.ValueIterateeCustom, array: _.List | null | undefined): number; +} +interface FindIndex1x1 { + /** + * 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 fromIndex The index to search from. + * @return Returns the index of the found element, else -1. + */ + (): FindIndex1x1; + /** + * 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 fromIndex The index to search from. + * @return Returns the index of the found element, else -1. + */ + (array: _.List | null | undefined): number; +} + +declare const findIndex: FindIndex; +export = findIndex; diff --git a/types/lodash/fp/findIndexFrom.d.ts b/types/lodash/fp/findIndexFrom.d.ts new file mode 100644 index 0000000000..fbc5f7bac1 --- /dev/null +++ b/types/lodash/fp/findIndexFrom.d.ts @@ -0,0 +1,186 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface FindIndex { + /** + * 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 fromIndex The index to search from. + * @return Returns the index of the found element, else -1. + */ + (): FindIndex; + /** + * 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 fromIndex The index to search from. + * @return Returns the index of the found element, else -1. + */ + (predicate: _.ValueIterateeCustom): FindIndex1x1; + /** + * 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 fromIndex The index to search from. + * @return Returns the index of the found element, else -1. + */ + (predicate: _.ValueIterateeCustom, fromIndex: number): FindIndex1x2; + /** + * 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 fromIndex The index to search from. + * @return Returns the index of the found element, else -1. + */ + (predicate: _.ValueIterateeCustom, fromIndex: number, array: _.List | null | undefined): number; +} +interface FindIndex1x1 { + /** + * 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 fromIndex The index to search from. + * @return Returns the index of the found element, else -1. + */ + (): FindIndex1x1; + /** + * 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 fromIndex The index to search from. + * @return Returns the index of the found element, else -1. + */ + (fromIndex: number): FindIndex1x2; + /** + * 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 fromIndex The index to search from. + * @return Returns the index of the found element, else -1. + */ + (fromIndex: number, array: _.List | null | undefined): number; +} +interface FindIndex1x2 { + /** + * 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 fromIndex The index to search from. + * @return Returns the index of the found element, else -1. + */ + (): FindIndex1x2; + /** + * 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 fromIndex The index to search from. + * @return Returns the index of the found element, else -1. + */ + (array: _.List | null | undefined): number; +} + +declare const findIndexFrom: FindIndex; +export = findIndexFrom; diff --git a/types/lodash/fp/findKey.d.ts b/types/lodash/fp/findKey.d.ts new file mode 100644 index 0000000000..a776272bc0 --- /dev/null +++ b/types/lodash/fp/findKey.d.ts @@ -0,0 +1,108 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface FindKey { + /** + * 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; + /** + * 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. + */ + (predicate: _.ValueIteratee): FindKey1x1; + /** + * 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. + */ + (predicate: _.ValueIteratee, object: T | null | undefined): string | undefined; +} +interface FindKey1x1 { + /** + * 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. + */ + (): FindKey1x1; + /** + * 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. + */ + (object: object | null | undefined): string | undefined; +} + +declare const findKey: FindKey; +export = findKey; diff --git a/types/lodash/fp/findLast.d.ts b/types/lodash/fp/findLast.d.ts new file mode 100644 index 0000000000..fb8c822bdf --- /dev/null +++ b/types/lodash/fp/findLast.d.ts @@ -0,0 +1,143 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface FindLast { + /** + * 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 predicate The function called per iteration. + * @param fromIndex The index to search from. + * @return The found element, else undefined. + */ + (): FindLast; + /** + * 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 predicate The function called per iteration. + * @param fromIndex The index to search from. + * @return The found element, else undefined. + */ + (predicate: _.ValueIteratorTypeGuard): FindLast1x1; + /** + * 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 predicate The function called per iteration. + * @param fromIndex The index to search from. + * @return The found element, else undefined. + */ + (predicate: _.ValueIteratorTypeGuard, collection: _.List | null | undefined): S|undefined; + /** + * 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 predicate The function called per iteration. + * @param fromIndex The index to search from. + * @return The found element, else undefined. + */ + (predicate: _.ValueIterateeCustom): FindLast2x1; + /** + * 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 predicate The function called per iteration. + * @param fromIndex The index to search from. + * @return The found element, else undefined. + */ + (predicate: _.ValueIterateeCustom, collection: _.List | null | undefined): T|undefined; + /** + * 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 predicate The function called per iteration. + * @param fromIndex The index to search from. + * @return The found element, else undefined. + */ + (predicate: _.ValueIteratorTypeGuard): FindLast3x1; + /** + * 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 predicate The function called per iteration. + * @param fromIndex The index to search from. + * @return The found element, else undefined. + */ + (predicate: _.ValueIteratorTypeGuard, collection: T | null | undefined): S|undefined; + /** + * 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 predicate The function called per iteration. + * @param fromIndex The index to search from. + * @return The found element, else undefined. + */ + (predicate: _.ValueIterateeCustom, collection: T | null | undefined): T[keyof T]|undefined; +} +interface FindLast1x1 { + /** + * 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 predicate The function called per iteration. + * @param fromIndex The index to search from. + * @return The found element, else undefined. + */ + (): FindLast1x1; + /** + * 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 predicate The function called per iteration. + * @param fromIndex The index to search from. + * @return The found element, else undefined. + */ + (collection: _.List | null | undefined): S|undefined; +} +interface FindLast2x1 { + /** + * 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 predicate The function called per iteration. + * @param fromIndex The index to search from. + * @return The found element, else undefined. + */ + (): FindLast2x1; + /** + * 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 predicate The function called per iteration. + * @param fromIndex The index to search from. + * @return The found element, else undefined. + */ + (collection: _.List | object | null | undefined): T|undefined; +} +interface FindLast3x1 { + /** + * 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 predicate The function called per iteration. + * @param fromIndex The index to search from. + * @return The found element, else undefined. + */ + (): FindLast3x1; + /** + * 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 predicate The function called per iteration. + * @param fromIndex The index to search from. + * @return The found element, else undefined. + */ + (collection: T | null | undefined): S|undefined; +} + +declare const findLast: FindLast; +export = findLast; diff --git a/types/lodash/fp/findLastFrom.d.ts b/types/lodash/fp/findLastFrom.d.ts new file mode 100644 index 0000000000..bd6bed3043 --- /dev/null +++ b/types/lodash/fp/findLastFrom.d.ts @@ -0,0 +1,257 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface FindLast { + /** + * 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 predicate The function called per iteration. + * @param fromIndex The index to search from. + * @return The found element, else undefined. + */ + (): FindLast; + /** + * 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 predicate The function called per iteration. + * @param fromIndex The index to search from. + * @return The found element, else undefined. + */ + (predicate: _.ValueIteratorTypeGuard): FindLast1x1; + /** + * 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 predicate The function called per iteration. + * @param fromIndex The index to search from. + * @return The found element, else undefined. + */ + (predicate: _.ValueIteratorTypeGuard, fromIndex: number): FindLast1x2; + /** + * 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 predicate The function called per iteration. + * @param fromIndex The index to search from. + * @return The found element, else undefined. + */ + (predicate: _.ValueIteratorTypeGuard, fromIndex: number, collection: _.List | null | undefined): S|undefined; + /** + * 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 predicate The function called per iteration. + * @param fromIndex The index to search from. + * @return The found element, else undefined. + */ + (predicate: _.ValueIterateeCustom): FindLast2x1; + /** + * 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 predicate The function called per iteration. + * @param fromIndex The index to search from. + * @return The found element, else undefined. + */ + (predicate: _.ValueIterateeCustom, fromIndex: number): FindLast2x2; + /** + * 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 predicate The function called per iteration. + * @param fromIndex The index to search from. + * @return The found element, else undefined. + */ + (predicate: _.ValueIterateeCustom, fromIndex: number, collection: _.List | null | undefined): T|undefined; + /** + * 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 predicate The function called per iteration. + * @param fromIndex The index to search from. + * @return The found element, else undefined. + */ + (predicate: _.ValueIteratorTypeGuard): FindLast3x1; + /** + * 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 predicate The function called per iteration. + * @param fromIndex The index to search from. + * @return The found element, else undefined. + */ + (predicate: _.ValueIteratorTypeGuard, fromIndex: number): FindLast3x2; + /** + * 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 predicate The function called per iteration. + * @param fromIndex The index to search from. + * @return The found element, else undefined. + */ + (predicate: _.ValueIteratorTypeGuard, fromIndex: number, collection: T | null | undefined): S|undefined; + /** + * 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 predicate The function called per iteration. + * @param fromIndex The index to search from. + * @return The found element, else undefined. + */ + (predicate: _.ValueIterateeCustom, fromIndex: number, collection: T | null | undefined): T[keyof T]|undefined; +} +interface FindLast1x1 { + /** + * 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 predicate The function called per iteration. + * @param fromIndex The index to search from. + * @return The found element, else undefined. + */ + (): FindLast1x1; + /** + * 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 predicate The function called per iteration. + * @param fromIndex The index to search from. + * @return The found element, else undefined. + */ + (fromIndex: number): FindLast1x2; + /** + * 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 predicate The function called per iteration. + * @param fromIndex The index to search from. + * @return The found element, else undefined. + */ + (fromIndex: number, collection: _.List | null | undefined): S|undefined; +} +interface FindLast1x2 { + /** + * 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 predicate The function called per iteration. + * @param fromIndex The index to search from. + * @return The found element, else undefined. + */ + (): FindLast1x2; + /** + * 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 predicate The function called per iteration. + * @param fromIndex The index to search from. + * @return The found element, else undefined. + */ + (collection: _.List | null | undefined): S|undefined; +} +interface FindLast2x1 { + /** + * 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 predicate The function called per iteration. + * @param fromIndex The index to search from. + * @return The found element, else undefined. + */ + (): FindLast2x1; + /** + * 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 predicate The function called per iteration. + * @param fromIndex The index to search from. + * @return The found element, else undefined. + */ + (fromIndex: number): FindLast2x2; + /** + * 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 predicate The function called per iteration. + * @param fromIndex The index to search from. + * @return The found element, else undefined. + */ + (fromIndex: number, collection: _.List | object | null | undefined): T|undefined; +} +interface FindLast2x2 { + /** + * 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 predicate The function called per iteration. + * @param fromIndex The index to search from. + * @return The found element, else undefined. + */ + (): FindLast2x2; + /** + * 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 predicate The function called per iteration. + * @param fromIndex The index to search from. + * @return The found element, else undefined. + */ + (collection: _.List | object | null | undefined): T|undefined; +} +interface FindLast3x1 { + /** + * 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 predicate The function called per iteration. + * @param fromIndex The index to search from. + * @return The found element, else undefined. + */ + (): FindLast3x1; + /** + * 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 predicate The function called per iteration. + * @param fromIndex The index to search from. + * @return The found element, else undefined. + */ + (fromIndex: number): FindLast3x2; + /** + * 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 predicate The function called per iteration. + * @param fromIndex The index to search from. + * @return The found element, else undefined. + */ + (fromIndex: number, collection: T | null | undefined): S|undefined; +} +interface FindLast3x2 { + /** + * 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 predicate The function called per iteration. + * @param fromIndex The index to search from. + * @return The found element, else undefined. + */ + (): FindLast3x2; + /** + * 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 predicate The function called per iteration. + * @param fromIndex The index to search from. + * @return The found element, else undefined. + */ + (collection: T | null | undefined): S|undefined; +} + +declare const findLastFrom: FindLast; +export = findLastFrom; diff --git a/types/lodash/fp/findLastIndex.d.ts b/types/lodash/fp/findLastIndex.d.ts new file mode 100644 index 0000000000..230736f814 --- /dev/null +++ b/types/lodash/fp/findLastIndex.d.ts @@ -0,0 +1,103 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface FindLastIndex { + /** + * 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 fromIndex The index to search from. + * @return Returns the index of the found element, else -1. + */ + (): FindLastIndex; + /** + * 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 fromIndex The index to search from. + * @return Returns the index of the found element, else -1. + */ + (predicate: _.ValueIterateeCustom): FindLastIndex1x1; + /** + * 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 fromIndex The index to search from. + * @return Returns the index of the found element, else -1. + */ + (predicate: _.ValueIterateeCustom, array: _.List | null | undefined): number; +} +interface FindLastIndex1x1 { + /** + * 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 fromIndex The index to search from. + * @return Returns the index of the found element, else -1. + */ + (): FindLastIndex1x1; + /** + * 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 fromIndex The index to search from. + * @return Returns the index of the found element, else -1. + */ + (array: _.List | null | undefined): number; +} + +declare const findLastIndex: FindLastIndex; +export = findLastIndex; diff --git a/types/lodash/fp/findLastIndexFrom.d.ts b/types/lodash/fp/findLastIndexFrom.d.ts new file mode 100644 index 0000000000..df28dc685e --- /dev/null +++ b/types/lodash/fp/findLastIndexFrom.d.ts @@ -0,0 +1,177 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface FindLastIndex { + /** + * 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 fromIndex The index to search from. + * @return Returns the index of the found element, else -1. + */ + (): FindLastIndex; + /** + * 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 fromIndex The index to search from. + * @return Returns the index of the found element, else -1. + */ + (predicate: _.ValueIterateeCustom): FindLastIndex1x1; + /** + * 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 fromIndex The index to search from. + * @return Returns the index of the found element, else -1. + */ + (predicate: _.ValueIterateeCustom, fromIndex: number): FindLastIndex1x2; + /** + * 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 fromIndex The index to search from. + * @return Returns the index of the found element, else -1. + */ + (predicate: _.ValueIterateeCustom, fromIndex: number, array: _.List | null | undefined): number; +} +interface FindLastIndex1x1 { + /** + * 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 fromIndex The index to search from. + * @return Returns the index of the found element, else -1. + */ + (): FindLastIndex1x1; + /** + * 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 fromIndex The index to search from. + * @return Returns the index of the found element, else -1. + */ + (fromIndex: number): FindLastIndex1x2; + /** + * 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 fromIndex The index to search from. + * @return Returns the index of the found element, else -1. + */ + (fromIndex: number, array: _.List | null | undefined): number; +} +interface FindLastIndex1x2 { + /** + * 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 fromIndex The index to search from. + * @return Returns the index of the found element, else -1. + */ + (): FindLastIndex1x2; + /** + * 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 fromIndex The index to search from. + * @return Returns the index of the found element, else -1. + */ + (array: _.List | null | undefined): number; +} + +declare const findLastIndexFrom: FindLastIndex; +export = findLastIndexFrom; diff --git a/types/lodash/fp/findLastKey.d.ts b/types/lodash/fp/findLastKey.d.ts new file mode 100644 index 0000000000..51e8d52ce1 --- /dev/null +++ b/types/lodash/fp/findLastKey.d.ts @@ -0,0 +1,103 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface FindLastKey { + /** + * 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; + /** + * 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. + */ + (predicate: _.ValueIteratee): FindLastKey1x1; + /** + * 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. + */ + (predicate: _.ValueIteratee, object: T | null | undefined): string | undefined; +} +interface FindLastKey1x1 { + /** + * 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. + */ + (): FindLastKey1x1; + /** + * 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. + */ + (object: object | null | undefined): string | undefined; +} + +declare const findLastKey: FindLastKey; +export = findLastKey; diff --git a/types/lodash/fp/first.d.ts b/types/lodash/fp/first.d.ts new file mode 100644 index 0000000000..e93bdf4e4e --- /dev/null +++ b/types/lodash/fp/first.d.ts @@ -0,0 +1,19 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +type Head = + /** + * Gets the first element of array. + * + * @alias _.first + * + * @param array The array to query. + * @return Returns the first element of array. + */ + (array: _.List | null | undefined) => T | undefined; + +declare const first: Head; +export = first; diff --git a/types/lodash/fp/flatMap.d.ts b/types/lodash/fp/flatMap.d.ts new file mode 100644 index 0000000000..a6713fe34d --- /dev/null +++ b/types/lodash/fp/flatMap.d.ts @@ -0,0 +1,189 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface FlatMap { + /** + * Creates an array of flattened values by running each element in collection through iteratee + * and concating its result to the other mapped values. The iteratee is invoked with three arguments: + * (value, index|key, collection). + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @return Returns the new flattened array. + */ + (): FlatMap; + /** + * Creates an array of flattened values by running each element in collection through iteratee + * and concating its result to the other mapped values. The iteratee is invoked with three arguments: + * (value, index|key, collection). + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @return Returns the new flattened array. + */ + (iteratee: (value: T) => _.Many): FlatMap1x1; + /** + * Creates an array of flattened values by running each element in collection through iteratee + * and concating its result to the other mapped values. The iteratee is invoked with three arguments: + * (value, index|key, collection). + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @return Returns the new flattened array. + */ + (iteratee: (value: T) => _.Many, collection: _.List | null | undefined): TResult[]; + /** + * Creates an array of flattened values by running each element in collection through iteratee + * and concating its result to the other mapped values. The iteratee is invoked with three arguments: + * (value, index|key, collection). + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @return Returns the new flattened array. + */ + (iteratee: (value: T[keyof T]) => _.Many): FlatMap2x1; + /** + * Creates an array of flattened values by running each element in collection through iteratee + * and concating its result to the other mapped values. The iteratee is invoked with three arguments: + * (value, index|key, collection). + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @return Returns the new flattened array. + */ + (iteratee: (value: T[keyof T]) => _.Many, collection: T | null | undefined): TResult[]; + /** + * Creates an array of flattened values by running each element in collection through iteratee + * and concating its result to the other mapped values. The iteratee is invoked with three arguments: + * (value, index|key, collection). + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @return Returns the new flattened array. + */ + (iteratee: string): FlatMap3x1; + /** + * Creates an array of flattened values by running each element in collection through iteratee + * and concating its result to the other mapped values. The iteratee is invoked with three arguments: + * (value, index|key, collection). + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @return Returns the new flattened array. + */ + (iteratee: string, collection: object | null | undefined): any[]; + /** + * Creates an array of flattened values by running each element in collection through iteratee + * and concating its result to the other mapped values. The iteratee is invoked with three arguments: + * (value, index|key, collection). + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @return Returns the new flattened array. + */ + (iteratee: object): FlatMap4x1; + /** + * Creates an array of flattened values by running each element in collection through iteratee + * and concating its result to the other mapped values. The iteratee is invoked with three arguments: + * (value, index|key, collection). + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @return Returns the new flattened array. + */ + (iteratee: object, collection: object | null | undefined): boolean[]; +} +interface FlatMap1x1 { + /** + * Creates an array of flattened values by running each element in collection through iteratee + * and concating its result to the other mapped values. The iteratee is invoked with three arguments: + * (value, index|key, collection). + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @return Returns the new flattened array. + */ + (): FlatMap1x1; + /** + * Creates an array of flattened values by running each element in collection through iteratee + * and concating its result to the other mapped values. The iteratee is invoked with three arguments: + * (value, index|key, collection). + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @return Returns the new flattened array. + */ + (collection: _.List | null | undefined): TResult[]; +} +interface FlatMap2x1 { + /** + * Creates an array of flattened values by running each element in collection through iteratee + * and concating its result to the other mapped values. The iteratee is invoked with three arguments: + * (value, index|key, collection). + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @return Returns the new flattened array. + */ + (): FlatMap2x1; + /** + * Creates an array of flattened values by running each element in collection through iteratee + * and concating its result to the other mapped values. The iteratee is invoked with three arguments: + * (value, index|key, collection). + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @return Returns the new flattened array. + */ + (collection: T | null | undefined): TResult[]; +} +interface FlatMap3x1 { + /** + * Creates an array of flattened values by running each element in collection through iteratee + * and concating its result to the other mapped values. The iteratee is invoked with three arguments: + * (value, index|key, collection). + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @return Returns the new flattened array. + */ + (): FlatMap3x1; + /** + * Creates an array of flattened values by running each element in collection through iteratee + * and concating its result to the other mapped values. The iteratee is invoked with three arguments: + * (value, index|key, collection). + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @return Returns the new flattened array. + */ + (collection: object | null | undefined): any[]; +} +interface FlatMap4x1 { + /** + * Creates an array of flattened values by running each element in collection through iteratee + * and concating its result to the other mapped values. The iteratee is invoked with three arguments: + * (value, index|key, collection). + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @return Returns the new flattened array. + */ + (): FlatMap4x1; + /** + * Creates an array of flattened values by running each element in collection through iteratee + * and concating its result to the other mapped values. The iteratee is invoked with three arguments: + * (value, index|key, collection). + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @return Returns the new flattened array. + */ + (collection: object | null | undefined): boolean[]; +} + +declare const flatMap: FlatMap; +export = flatMap; diff --git a/types/lodash/fp/flatMapDeep.d.ts b/types/lodash/fp/flatMapDeep.d.ts new file mode 100644 index 0000000000..9dad165793 --- /dev/null +++ b/types/lodash/fp/flatMapDeep.d.ts @@ -0,0 +1,342 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface FlatMapDeep { + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results. + * + * @since 4.7.0 + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @returns Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDeep([1, 2], duplicate); + * // => [1, 1, 2, 2] + */ + (): FlatMapDeep; + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results. + * + * @since 4.7.0 + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @returns Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDeep([1, 2], duplicate); + * // => [1, 1, 2, 2] + */ + (iteratee: (value: T) => _.ListOfRecursiveArraysOrValues | TResult): FlatMapDeep1x1; + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results. + * + * @since 4.7.0 + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @returns Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDeep([1, 2], duplicate); + * // => [1, 1, 2, 2] + */ + (iteratee: (value: T) => _.ListOfRecursiveArraysOrValues | TResult, collection: _.List | null | undefined): TResult[]; + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results. + * + * @since 4.7.0 + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @returns Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDeep([1, 2], duplicate); + * // => [1, 1, 2, 2] + */ + (iteratee: (value: T[keyof T]) => _.ListOfRecursiveArraysOrValues | TResult): FlatMapDeep2x1; + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results. + * + * @since 4.7.0 + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @returns Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDeep([1, 2], duplicate); + * // => [1, 1, 2, 2] + */ + (iteratee: (value: T[keyof T]) => _.ListOfRecursiveArraysOrValues | TResult, collection: T | null | undefined): TResult[]; + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results. + * + * @since 4.7.0 + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @returns Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDeep([1, 2], duplicate); + * // => [1, 1, 2, 2] + */ + (iteratee: string): FlatMapDeep3x1; + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results. + * + * @since 4.7.0 + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @returns Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDeep([1, 2], duplicate); + * // => [1, 1, 2, 2] + */ + (iteratee: string, collection: object | null | undefined): any[]; + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results. + * + * @since 4.7.0 + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @returns Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDeep([1, 2], duplicate); + * // => [1, 1, 2, 2] + */ + (iteratee: object): FlatMapDeep4x1; + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results. + * + * @since 4.7.0 + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @returns Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDeep([1, 2], duplicate); + * // => [1, 1, 2, 2] + */ + (iteratee: object, collection: object | null | undefined): boolean[]; +} +interface FlatMapDeep1x1 { + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results. + * + * @since 4.7.0 + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @returns Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDeep([1, 2], duplicate); + * // => [1, 1, 2, 2] + */ + (): FlatMapDeep1x1; + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results. + * + * @since 4.7.0 + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @returns Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDeep([1, 2], duplicate); + * // => [1, 1, 2, 2] + */ + (collection: _.List | null | undefined): TResult[]; +} +interface FlatMapDeep2x1 { + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results. + * + * @since 4.7.0 + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @returns Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDeep([1, 2], duplicate); + * // => [1, 1, 2, 2] + */ + (): FlatMapDeep2x1; + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results. + * + * @since 4.7.0 + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @returns Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDeep([1, 2], duplicate); + * // => [1, 1, 2, 2] + */ + (collection: T | null | undefined): TResult[]; +} +interface FlatMapDeep3x1 { + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results. + * + * @since 4.7.0 + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @returns Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDeep([1, 2], duplicate); + * // => [1, 1, 2, 2] + */ + (): FlatMapDeep3x1; + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results. + * + * @since 4.7.0 + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @returns Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDeep([1, 2], duplicate); + * // => [1, 1, 2, 2] + */ + (collection: object | null | undefined): any[]; +} +interface FlatMapDeep4x1 { + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results. + * + * @since 4.7.0 + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @returns Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDeep([1, 2], duplicate); + * // => [1, 1, 2, 2] + */ + (): FlatMapDeep4x1; + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results. + * + * @since 4.7.0 + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @returns Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDeep([1, 2], duplicate); + * // => [1, 1, 2, 2] + */ + (collection: object | null | undefined): boolean[]; +} + +declare const flatMapDeep: FlatMapDeep; +export = flatMapDeep; diff --git a/types/lodash/fp/flatMapDepth.d.ts b/types/lodash/fp/flatMapDepth.d.ts new file mode 100644 index 0000000000..d576c2a322 --- /dev/null +++ b/types/lodash/fp/flatMapDepth.d.ts @@ -0,0 +1,687 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface FlatMapDepth { + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results up to `depth` times. + * + * @since 4.7.0 + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [depth=1] The maximum recursion depth. + * @returns Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDepth([1, 2], duplicate, 2); + * // => [[1, 1], [2, 2]] + */ + (): FlatMapDepth; + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results up to `depth` times. + * + * @since 4.7.0 + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [depth=1] The maximum recursion depth. + * @returns Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDepth([1, 2], duplicate, 2); + * // => [[1, 1], [2, 2]] + */ + (iteratee: (value: T) => _.ListOfRecursiveArraysOrValues | TResult): FlatMapDepth1x1; + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results up to `depth` times. + * + * @since 4.7.0 + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [depth=1] The maximum recursion depth. + * @returns Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDepth([1, 2], duplicate, 2); + * // => [[1, 1], [2, 2]] + */ + (iteratee: (value: T) => _.ListOfRecursiveArraysOrValues | TResult, depth: number): FlatMapDepth1x2; + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results up to `depth` times. + * + * @since 4.7.0 + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [depth=1] The maximum recursion depth. + * @returns Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDepth([1, 2], duplicate, 2); + * // => [[1, 1], [2, 2]] + */ + (iteratee: (value: T) => _.ListOfRecursiveArraysOrValues | TResult, depth: number, collection: _.List | null | undefined): TResult[]; + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results up to `depth` times. + * + * @since 4.7.0 + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [depth=1] The maximum recursion depth. + * @returns Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDepth([1, 2], duplicate, 2); + * // => [[1, 1], [2, 2]] + */ + (iteratee: (value: T[keyof T]) => _.ListOfRecursiveArraysOrValues | TResult): FlatMapDepth2x1; + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results up to `depth` times. + * + * @since 4.7.0 + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [depth=1] The maximum recursion depth. + * @returns Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDepth([1, 2], duplicate, 2); + * // => [[1, 1], [2, 2]] + */ + (iteratee: (value: T[keyof T]) => _.ListOfRecursiveArraysOrValues | TResult, depth: number): FlatMapDepth2x2; + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results up to `depth` times. + * + * @since 4.7.0 + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [depth=1] The maximum recursion depth. + * @returns Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDepth([1, 2], duplicate, 2); + * // => [[1, 1], [2, 2]] + */ + (iteratee: (value: T[keyof T]) => _.ListOfRecursiveArraysOrValues | TResult, depth: number, collection: T | null | undefined): TResult[]; + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results up to `depth` times. + * + * @since 4.7.0 + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [depth=1] The maximum recursion depth. + * @returns Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDepth([1, 2], duplicate, 2); + * // => [[1, 1], [2, 2]] + */ + (iteratee: string): FlatMapDepth3x1; + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results up to `depth` times. + * + * @since 4.7.0 + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [depth=1] The maximum recursion depth. + * @returns Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDepth([1, 2], duplicate, 2); + * // => [[1, 1], [2, 2]] + */ + (iteratee: string, depth: number): FlatMapDepth3x2; + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results up to `depth` times. + * + * @since 4.7.0 + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [depth=1] The maximum recursion depth. + * @returns Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDepth([1, 2], duplicate, 2); + * // => [[1, 1], [2, 2]] + */ + (iteratee: string, depth: number, collection: object | null | undefined): any[]; + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results up to `depth` times. + * + * @since 4.7.0 + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [depth=1] The maximum recursion depth. + * @returns Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDepth([1, 2], duplicate, 2); + * // => [[1, 1], [2, 2]] + */ + (iteratee: object): FlatMapDepth4x1; + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results up to `depth` times. + * + * @since 4.7.0 + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [depth=1] The maximum recursion depth. + * @returns Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDepth([1, 2], duplicate, 2); + * // => [[1, 1], [2, 2]] + */ + (iteratee: object, depth: number): FlatMapDepth4x2; + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results up to `depth` times. + * + * @since 4.7.0 + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [depth=1] The maximum recursion depth. + * @returns Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDepth([1, 2], duplicate, 2); + * // => [[1, 1], [2, 2]] + */ + (iteratee: object, depth: number, collection: object | null | undefined): boolean[]; +} +interface FlatMapDepth1x1 { + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results up to `depth` times. + * + * @since 4.7.0 + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [depth=1] The maximum recursion depth. + * @returns Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDepth([1, 2], duplicate, 2); + * // => [[1, 1], [2, 2]] + */ + (): FlatMapDepth1x1; + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results up to `depth` times. + * + * @since 4.7.0 + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [depth=1] The maximum recursion depth. + * @returns Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDepth([1, 2], duplicate, 2); + * // => [[1, 1], [2, 2]] + */ + (depth: number): FlatMapDepth1x2; + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results up to `depth` times. + * + * @since 4.7.0 + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [depth=1] The maximum recursion depth. + * @returns Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDepth([1, 2], duplicate, 2); + * // => [[1, 1], [2, 2]] + */ + (depth: number, collection: _.List | null | undefined): TResult[]; +} +interface FlatMapDepth1x2 { + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results up to `depth` times. + * + * @since 4.7.0 + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [depth=1] The maximum recursion depth. + * @returns Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDepth([1, 2], duplicate, 2); + * // => [[1, 1], [2, 2]] + */ + (): FlatMapDepth1x2; + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results up to `depth` times. + * + * @since 4.7.0 + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [depth=1] The maximum recursion depth. + * @returns Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDepth([1, 2], duplicate, 2); + * // => [[1, 1], [2, 2]] + */ + (collection: _.List | null | undefined): TResult[]; +} +interface FlatMapDepth2x1 { + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results up to `depth` times. + * + * @since 4.7.0 + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [depth=1] The maximum recursion depth. + * @returns Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDepth([1, 2], duplicate, 2); + * // => [[1, 1], [2, 2]] + */ + (): FlatMapDepth2x1; + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results up to `depth` times. + * + * @since 4.7.0 + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [depth=1] The maximum recursion depth. + * @returns Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDepth([1, 2], duplicate, 2); + * // => [[1, 1], [2, 2]] + */ + (depth: number): FlatMapDepth2x2; + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results up to `depth` times. + * + * @since 4.7.0 + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [depth=1] The maximum recursion depth. + * @returns Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDepth([1, 2], duplicate, 2); + * // => [[1, 1], [2, 2]] + */ + (depth: number, collection: T | null | undefined): TResult[]; +} +interface FlatMapDepth2x2 { + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results up to `depth` times. + * + * @since 4.7.0 + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [depth=1] The maximum recursion depth. + * @returns Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDepth([1, 2], duplicate, 2); + * // => [[1, 1], [2, 2]] + */ + (): FlatMapDepth2x2; + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results up to `depth` times. + * + * @since 4.7.0 + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [depth=1] The maximum recursion depth. + * @returns Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDepth([1, 2], duplicate, 2); + * // => [[1, 1], [2, 2]] + */ + (collection: T | null | undefined): TResult[]; +} +interface FlatMapDepth3x1 { + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results up to `depth` times. + * + * @since 4.7.0 + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [depth=1] The maximum recursion depth. + * @returns Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDepth([1, 2], duplicate, 2); + * // => [[1, 1], [2, 2]] + */ + (): FlatMapDepth3x1; + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results up to `depth` times. + * + * @since 4.7.0 + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [depth=1] The maximum recursion depth. + * @returns Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDepth([1, 2], duplicate, 2); + * // => [[1, 1], [2, 2]] + */ + (depth: number): FlatMapDepth3x2; + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results up to `depth` times. + * + * @since 4.7.0 + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [depth=1] The maximum recursion depth. + * @returns Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDepth([1, 2], duplicate, 2); + * // => [[1, 1], [2, 2]] + */ + (depth: number, collection: object | null | undefined): any[]; +} +interface FlatMapDepth3x2 { + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results up to `depth` times. + * + * @since 4.7.0 + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [depth=1] The maximum recursion depth. + * @returns Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDepth([1, 2], duplicate, 2); + * // => [[1, 1], [2, 2]] + */ + (): FlatMapDepth3x2; + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results up to `depth` times. + * + * @since 4.7.0 + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [depth=1] The maximum recursion depth. + * @returns Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDepth([1, 2], duplicate, 2); + * // => [[1, 1], [2, 2]] + */ + (collection: object | null | undefined): any[]; +} +interface FlatMapDepth4x1 { + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results up to `depth` times. + * + * @since 4.7.0 + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [depth=1] The maximum recursion depth. + * @returns Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDepth([1, 2], duplicate, 2); + * // => [[1, 1], [2, 2]] + */ + (): FlatMapDepth4x1; + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results up to `depth` times. + * + * @since 4.7.0 + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [depth=1] The maximum recursion depth. + * @returns Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDepth([1, 2], duplicate, 2); + * // => [[1, 1], [2, 2]] + */ + (depth: number): FlatMapDepth4x2; + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results up to `depth` times. + * + * @since 4.7.0 + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [depth=1] The maximum recursion depth. + * @returns Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDepth([1, 2], duplicate, 2); + * // => [[1, 1], [2, 2]] + */ + (depth: number, collection: object | null | undefined): boolean[]; +} +interface FlatMapDepth4x2 { + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results up to `depth` times. + * + * @since 4.7.0 + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [depth=1] The maximum recursion depth. + * @returns Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDepth([1, 2], duplicate, 2); + * // => [[1, 1], [2, 2]] + */ + (): FlatMapDepth4x2; + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results up to `depth` times. + * + * @since 4.7.0 + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [depth=1] The maximum recursion depth. + * @returns Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDepth([1, 2], duplicate, 2); + * // => [[1, 1], [2, 2]] + */ + (collection: object | null | undefined): boolean[]; +} + +declare const flatMapDepth: FlatMapDepth; +export = flatMapDepth; diff --git a/types/lodash/fp/flatten.d.ts b/types/lodash/fp/flatten.d.ts new file mode 100644 index 0000000000..88c928c7b0 --- /dev/null +++ b/types/lodash/fp/flatten.d.ts @@ -0,0 +1,17 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +type Flatten = + /** + * Flattens `array` a single level deep. + * + * @param array The array to flatten. + * @return Returns the new flattened array. + */ + (array: _.List<_.Many> | null | undefined) => T[]; + +declare const flatten: Flatten; +export = flatten; diff --git a/types/lodash/fp/flattenDeep.d.ts b/types/lodash/fp/flattenDeep.d.ts new file mode 100644 index 0000000000..4cfb955e6b --- /dev/null +++ b/types/lodash/fp/flattenDeep.d.ts @@ -0,0 +1,17 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +type FlattenDeep = + /** + * Recursively flattens a nested array. + * + * @param array The array to recursively flatten. + * @return Returns the new flattened array. + */ + (array: _.ListOfRecursiveArraysOrValues | null | undefined) => T[]; + +declare const flattenDeep: FlattenDeep; +export = flattenDeep; diff --git a/types/lodash/fp/flattenDepth.d.ts b/types/lodash/fp/flattenDepth.d.ts new file mode 100644 index 0000000000..f5516cf82e --- /dev/null +++ b/types/lodash/fp/flattenDepth.d.ts @@ -0,0 +1,53 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface FlattenDepth { + /** + * Recursively flatten array up to depth times. + * + * @param array The array to recursively flatten. + * @param number The maximum recursion depth. + * @return Returns the new flattened array. + */ + (): FlattenDepth; + /** + * Recursively flatten array up to depth times. + * + * @param array The array to recursively flatten. + * @param number The maximum recursion depth. + * @return Returns the new flattened array. + */ + (depth: number): FlattenDepth1x1; + /** + * Recursively flatten array up to depth times. + * + * @param array The array to recursively flatten. + * @param number The maximum recursion depth. + * @return Returns the new flattened array. + */ + (depth: number, array: _.ListOfRecursiveArraysOrValues | null | undefined): T[]; +} +interface FlattenDepth1x1 { + /** + * Recursively flatten array up to depth times. + * + * @param array The array to recursively flatten. + * @param number The maximum recursion depth. + * @return Returns the new flattened array. + */ + (): FlattenDepth1x1; + /** + * Recursively flatten array up to depth times. + * + * @param array The array to recursively flatten. + * @param number The maximum recursion depth. + * @return Returns the new flattened array. + */ + (array: _.ListOfRecursiveArraysOrValues | null | undefined): T[]; +} + +declare const flattenDepth: FlattenDepth; +export = flattenDepth; diff --git a/types/lodash/fp/flip.d.ts b/types/lodash/fp/flip.d.ts new file mode 100644 index 0000000000..db73a17b1a --- /dev/null +++ b/types/lodash/fp/flip.d.ts @@ -0,0 +1,24 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type Flip = + /** + * Creates a function that invokes `func` with arguments reversed. + * + * @category Function + * @param func The function to flip arguments for. + * @returns Returns the new function. + * @example + * + * var flipped = _.flip(function() { + * return _.toArray(arguments); + * }); + * + * flipped('a', 'b', 'c', 'd'); + * // => ['d', 'c', 'b', 'a'] + */ + any>(func: T) => T; + +declare const flip: Flip; +export = flip; diff --git a/types/lodash/fp/floor.d.ts b/types/lodash/fp/floor.d.ts new file mode 100644 index 0000000000..3275466204 --- /dev/null +++ b/types/lodash/fp/floor.d.ts @@ -0,0 +1,16 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type Floor = + /** + * 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. + */ + (n: number) => number; + +declare const floor: Floor; +export = floor; diff --git a/types/lodash/fp/flow.d.ts b/types/lodash/fp/flow.d.ts new file mode 100644 index 0000000000..843b0180f8 --- /dev/null +++ b/types/lodash/fp/flow.d.ts @@ -0,0 +1,355 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Flow { + /** + * 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. + */ + (f1: () => R1, f2: (a: R1) => R2): () => R2; + /** + * 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. + */ + (f1: () => R1, f2: (a: R1) => R2, f3: (a: R2) => R3): () => R3; + /** + * 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. + */ + (f1: () => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4): () => R4; + /** + * 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. + */ + (f1: () => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5): () => R5; + /** + * 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. + */ + (f1: () => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6): () => R6; + /** + * 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. + */ + (f1: () => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6, f7: (a: R6) => R7): () => R7; + /** + * 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. + */ + (f1: () => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6, f7: (a: R6) => R7, ...funcs: Array<_.Many<(a: any) => any>>): () => any; + /** + * 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. + */ + (f1: (a1: A1) => R1, f2: (a: R1) => R2): (a1: A1) => R2; + /** + * 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. + */ + (f1: (a1: A1) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3): (a1: A1) => R3; + /** + * 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. + */ + (f1: (a1: A1) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4): (a1: A1) => R4; + /** + * 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. + */ + (f1: (a1: A1) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5): (a1: A1) => R5; + /** + * 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. + */ + (f1: (a1: A1) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6): (a1: A1) => R6; + /** + * 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. + */ + (f1: (a1: A1) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6, f7: (a: R6) => R7): (a1: A1) => R7; + /** + * 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. + */ + (f1: (a1: A1) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6, f7: (a: R6) => R7, ...funcs: Array<_.Many<(a: any) => any>>): (a1: A1) => any; + /** + * 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. + */ + (f1: (a1: A1, a2: A2) => R1, f2: (a: R1) => R2): (a1: A1, a2: A2) => R2; + /** + * 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. + */ + (f1: (a1: A1, a2: A2) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3): (a1: A1, a2: A2) => R3; + /** + * 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. + */ + (f1: (a1: A1, a2: A2) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4): (a1: A1, a2: A2) => R4; + /** + * 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. + */ + (f1: (a1: A1, a2: A2) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5): (a1: A1, a2: A2) => R5; + /** + * 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. + */ + (f1: (a1: A1, a2: A2) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6): (a1: A1, a2: A2) => R6; + /** + * 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. + */ + (f1: (a1: A1, a2: A2) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6, f7: (a: R6) => R7): (a1: A1, a2: A2) => R7; + /** + * 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. + */ + (f1: (a1: A1, a2: A2) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6, f7: (a: R6) => R7, ...funcs: Array<_.Many<(a: any) => any>>): (a1: A1, a2: A2) => any; + /** + * 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. + */ + (f1: (a1: A1, a2: A2, a3: A3) => R1, f2: (a: R1) => R2): (a1: A1, a2: A2, a3: A3) => R2; + /** + * 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. + */ + (f1: (a1: A1, a2: A2, a3: A3) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3): (a1: A1, a2: A2, a3: A3) => R3; + /** + * 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. + */ + (f1: (a1: A1, a2: A2, a3: A3) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4): (a1: A1, a2: A2, a3: A3) => R4; + /** + * 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. + */ + (f1: (a1: A1, a2: A2, a3: A3) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5): (a1: A1, a2: A2, a3: A3) => R5; + /** + * 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. + */ + (f1: (a1: A1, a2: A2, a3: A3) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6): (a1: A1, a2: A2, a3: A3) => R6; + /** + * 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. + */ + (f1: (a1: A1, a2: A2, a3: A3) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6, f7: (a: R6) => R7): (a1: A1, a2: A2, a3: A3) => R7; + /** + * 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. + */ + (f1: (a1: A1, a2: A2, a3: A3) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6, f7: (a: R6) => R7, ...funcs: Array<_.Many<(a: any) => any>>): (a1: A1, a2: A2, a3: A3) => any; + /** + * 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. + */ + (f1: (a1: A1, a2: A2, a3: A3, a4: A4) => R1, f2: (a: R1) => R2): (a1: A1, a2: A2, a3: A3, a4: A4) => R2; + /** + * 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. + */ + (f1: (a1: A1, a2: A2, a3: A3, a4: A4) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3): (a1: A1, a2: A2, a3: A3, a4: A4) => R3; + /** + * 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. + */ + (f1: (a1: A1, a2: A2, a3: A3, a4: A4) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4): (a1: A1, a2: A2, a3: A3, a4: A4) => R4; + /** + * 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. + */ + (f1: (a1: A1, a2: A2, a3: A3, a4: A4) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5): (a1: A1, a2: A2, a3: A3, a4: A4) => R5; + /** + * 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. + */ + (f1: (a1: A1, a2: A2, a3: A3, a4: A4) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6): (a1: A1, a2: A2, a3: A3, a4: A4) => R6; + /** + * 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. + */ + (f1: (a1: A1, a2: A2, a3: A3, a4: A4) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6, f7: (a: R6) => R7): (a1: A1, a2: A2, a3: A3, a4: A4) => R7; + /** + * 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. + */ + (f1: (a1: A1, a2: A2, a3: A3, a4: A4) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6, f7: (a: R6) => R7, ...funcs: Array<_.Many<(a: any) => any>>): (a1: A1, a2: A2, a3: A3, a4: A4) => any; + /** + * 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. + */ + (f1: (a1: A1, a2: A2, a3: A3, a4: A4, ...args: any[]) => R1, f2: (a: R1) => R2): (a1: A1, a2: A2, a3: A3, a4: A4, ...args: any[]) => R2; + /** + * 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. + */ + (f1: (a1: A1, a2: A2, a3: A3, a4: A4, ...args: any[]) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3): (a1: A1, a2: A2, a3: A3, a4: A4, ...args: any[]) => R3; + /** + * 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. + */ + (f1: (a1: A1, a2: A2, a3: A3, a4: A4, ...args: any[]) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4): (a1: A1, a2: A2, a3: A3, a4: A4, ...args: any[]) => R4; + /** + * 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. + */ + (f1: (a1: A1, a2: A2, a3: A3, a4: A4, ...args: any[]) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5): (a1: A1, a2: A2, a3: A3, a4: A4, ...args: any[]) => R5; + /** + * 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. + */ + (f1: (a1: A1, a2: A2, a3: A3, a4: A4, ...args: any[]) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6): (a1: A1, a2: A2, a3: A3, a4: A4, ...args: any[]) => R6; + /** + * 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. + */ + (f1: (a1: A1, a2: A2, a3: A3, a4: A4, ...args: any[]) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6, f7: (a: R6) => R7): (a1: A1, a2: A2, a3: A3, a4: A4, ...args: any[]) => R7; + /** + * 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. + */ + (f1: (a1: A1, a2: A2, a3: A3, a4: A4, ...args: any[]) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6, f7: (a: R6) => R7, ...funcs: Array<_.Many<(a: any) => any>>): (a1: A1, a2: A2, a3: A3, a4: A4, ...args: any[]) => any; + /** + * 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. + */ + (funcs: Array<_.Many<(...args: any[]) => any>>): (...args: any[]) => any; +} + +declare const flow: Flow; +export = flow; diff --git a/types/lodash/fp/flowRight.d.ts b/types/lodash/fp/flowRight.d.ts new file mode 100644 index 0000000000..16f5f2f031 --- /dev/null +++ b/types/lodash/fp/flowRight.d.ts @@ -0,0 +1,315 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface FlowRight { + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f2: (a: R1) => R2, f1: () => R1): () => R2; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f3: (a: R2) => R3, f2: (a: R1) => R2, f1: () => R1): () => R3; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: () => R1): () => R4; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f5: (a: R4) => R5, f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: () => R1): () => R5; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f6: (a: R5) => R6, f5: (a: R4) => R5, f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: () => R1): () => R6; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f7: (a: R6) => R7, f6: (a: R5) => R6, f5: (a: R4) => R5, f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: () => R1): () => R7; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f2: (a: R1) => R2, f1: (a1: A1) => R1): (a1: A1) => R2; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (a1: A1) => R1): (a1: A1) => R3; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (a1: A1) => R1): (a1: A1) => R4; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f5: (a: R4) => R5, f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (a1: A1) => R1): (a1: A1) => R5; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f6: (a: R5) => R6, f5: (a: R4) => R5, f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (a1: A1) => R1): (a1: A1) => R6; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f7: (a: R6) => R7, f6: (a: R5) => R6, f5: (a: R4) => R5, f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (a1: A1) => R1): (a1: A1) => R7; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f2: (a: R1) => R2, f1: (a1: A1, a2: A2) => R1): (a1: A1, a2: A2) => R2; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (a1: A1, a2: A2) => R1): (a1: A1, a2: A2) => R3; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (a1: A1, a2: A2) => R1): (a1: A1, a2: A2) => R4; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f5: (a: R4) => R5, f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (a1: A1, a2: A2) => R1): (a1: A1, a2: A2) => R5; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f6: (a: R5) => R6, f5: (a: R4) => R5, f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (a1: A1, a2: A2) => R1): (a1: A1, a2: A2) => R6; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f7: (a: R6) => R7, f6: (a: R5) => R6, f5: (a: R4) => R5, f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (a1: A1, a2: A2) => R1): (a1: A1, a2: A2) => R7; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f2: (a: R1) => R2, f1: (a1: A1, a2: A2, a3: A3) => R1): (a1: A1, a2: A2, a3: A3) => R2; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (a1: A1, a2: A2, a3: A3) => R1): (a1: A1, a2: A2, a3: A3) => R3; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (a1: A1, a2: A2, a3: A3) => R1): (a1: A1, a2: A2, a3: A3) => R4; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f5: (a: R4) => R5, f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (a1: A1, a2: A2, a3: A3) => R1): (a1: A1, a2: A2, a3: A3) => R5; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f6: (a: R5) => R6, f5: (a: R4) => R5, f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (a1: A1, a2: A2, a3: A3) => R1): (a1: A1, a2: A2, a3: A3) => R6; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f7: (a: R6) => R7, f6: (a: R5) => R6, f5: (a: R4) => R5, f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (a1: A1, a2: A2, a3: A3) => R1): (a1: A1, a2: A2, a3: A3) => R7; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f2: (a: R1) => R2, f1: (a1: A1, a2: A2, a3: A3, a4: A4) => R1): (a1: A1, a2: A2, a3: A3, a4: A4) => R2; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (a1: A1, a2: A2, a3: A3, a4: A4) => R1): (a1: A1, a2: A2, a3: A3, a4: A4) => R3; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (a1: A1, a2: A2, a3: A3, a4: A4) => R1): (a1: A1, a2: A2, a3: A3, a4: A4) => R4; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f5: (a: R4) => R5, f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (a1: A1, a2: A2, a3: A3, a4: A4) => R1): (a1: A1, a2: A2, a3: A3, a4: A4) => R5; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f6: (a: R5) => R6, f5: (a: R4) => R5, f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (a1: A1, a2: A2, a3: A3, a4: A4) => R1): (a1: A1, a2: A2, a3: A3, a4: A4) => R6; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f7: (a: R6) => R7, f6: (a: R5) => R6, f5: (a: R4) => R5, f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (a1: A1, a2: A2, a3: A3, a4: A4) => R1): (a1: A1, a2: A2, a3: A3, a4: A4) => R7; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f2: (a: R1) => R2, f1: (...args: any[]) => R1): (...args: any[]) => R2; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (...args: any[]) => R1): (...args: any[]) => R3; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (...args: any[]) => R1): (...args: any[]) => R4; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f5: (a: R4) => R5, f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (...args: any[]) => R1): (...args: any[]) => R5; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f6: (a: R5) => R6, f5: (a: R4) => R5, f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (...args: any[]) => R1): (...args: any[]) => R6; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f7: (a: R6) => R7, f6: (a: R5) => R6, f5: (a: R4) => R5, f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (...args: any[]) => R1): (...args: any[]) => R7; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f7: (a: any) => any, f6: (a: any) => any, f5: (a: any) => any, f4: (a: any) => any, f3: (a: any) => any, f2: (a: any) => any, f1: () => any, ...funcs: Array<_.Many<(...args: any[]) => any>>): (...args: any[]) => any; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (funcs: Array<_.Many<(...args: any[]) => any>>): (...args: any[]) => any; +} + +declare const flowRight: FlowRight; +export = flowRight; diff --git a/types/lodash/fp/forEach.d.ts b/types/lodash/fp/forEach.d.ts new file mode 100644 index 0000000000..50b4a45bf4 --- /dev/null +++ b/types/lodash/fp/forEach.d.ts @@ -0,0 +1,330 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface ForEach { + /** + * 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; + /** + * 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. + */ + (iteratee: (value: T) => any): ForEach1x1; + /** + * 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. + */ + (iteratee: (value: T) => any, collection: ReadonlyArray): T[]; + /** + * 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. + */ + (iteratee: (value: string) => any): ForEach2x1; + /** + * 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. + */ + (iteratee: (value: string) => any, collection: string): string; + /** + * 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. + */ + (iteratee: (value: T) => any, collection: _.List): _.List; + /** + * 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. + */ + (iteratee: (value: T[keyof T]) => any, collection: T): T; + /** + * 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. + */ + (iteratee: (value: T) => any, collection: TArray & (T[] | null | undefined)): TArray; + /** + * 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. + */ + (iteratee: (value: string) => any, collection: TString): TString; + /** + * 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. + */ + | null | undefined>(iteratee: (value: T) => any, collection: TList & (_.List | null | undefined)): TList; + /** + * 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. + */ + (iteratee: (value: T[keyof T]) => any, collection: T | null | undefined): T | null | undefined; +} +interface ForEach1x1 { + /** + * 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. + */ + (): ForEach1x1; + /** + * 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. + */ + (collection: ReadonlyArray): T[]; + /** + * 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. + */ + (collection: _.List): _.List; + /** + * 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. + */ + (collection: T1): T1; + /** + * 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. + */ + (collection: TArray & (T[] | null | undefined)): TArray; + /** + * 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. + */ + | null | undefined>(collection: TList & (_.List | null | undefined)): TList; + /** + * 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. + */ + (collection: T1 | null | undefined): T1 | null | undefined; +} +interface ForEach2x1 { + /** + * 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. + */ + (): ForEach2x1; + /** + * 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. + */ + (collection: string): string; + /** + * 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. + */ + (collection: TString): TString; +} + +declare const forEach: ForEach; +export = forEach; diff --git a/types/lodash/fp/forEachRight.d.ts b/types/lodash/fp/forEachRight.d.ts new file mode 100644 index 0000000000..75ed3e7fab --- /dev/null +++ b/types/lodash/fp/forEachRight.d.ts @@ -0,0 +1,225 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface ForEachRight { + /** + * 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; + /** + * 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. + */ + (iteratee: (value: T) => any): ForEachRight1x1; + /** + * 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. + */ + (iteratee: (value: T) => any, collection: ReadonlyArray): T[]; + /** + * 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. + */ + (iteratee: (value: string) => any): ForEachRight2x1; + /** + * 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. + */ + (iteratee: (value: string) => any, collection: string): string; + /** + * 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. + */ + (iteratee: (value: T) => any, collection: _.List): _.List; + /** + * 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. + */ + (iteratee: (value: T[keyof T]) => any, collection: T): T; + /** + * 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. + */ + (iteratee: (value: T) => any, collection: TArray & (T[] | null | undefined)): TArray; + /** + * 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. + */ + (iteratee: (value: string) => any, collection: TString): TString; + /** + * 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. + */ + | null | undefined>(iteratee: (value: T) => any, collection: TList & (_.List | null | undefined)): TList; + /** + * 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. + */ + (iteratee: (value: T[keyof T]) => any, collection: T | null | undefined): T | null | undefined; +} +interface ForEachRight1x1 { + /** + * 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. + */ + (): ForEachRight1x1; + /** + * 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. + */ + (collection: ReadonlyArray): T[]; + /** + * 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. + */ + (collection: _.List): _.List; + /** + * 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. + */ + (collection: T1): T1; + /** + * 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. + */ + (collection: TArray & (T[] | null | undefined)): TArray; + /** + * 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. + */ + | null | undefined>(collection: TList & (_.List | null | undefined)): TList; + /** + * 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. + */ + (collection: T1 | null | undefined): T1 | null | undefined; +} +interface ForEachRight2x1 { + /** + * 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. + */ + (): ForEachRight2x1; + /** + * 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. + */ + (collection: string): string; + /** + * 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. + */ + (collection: TString): TString; +} + +declare const forEachRight: ForEachRight; +export = forEachRight; diff --git a/types/lodash/fp/forIn.d.ts b/types/lodash/fp/forIn.d.ts new file mode 100644 index 0000000000..added8f66b --- /dev/null +++ b/types/lodash/fp/forIn.d.ts @@ -0,0 +1,88 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface ForIn { + /** + * 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; + /** + * 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. + */ + (iteratee: (value: T) => any): ForIn1x1; + /** + * 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. + */ + (iteratee: (value: T[keyof T]) => any, object: T): T; + /** + * 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. + */ + (iteratee: (value: T[keyof T]) => any, object: T | null | undefined): T | null | undefined; +} +interface ForIn1x1 { + /** + * 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. + */ + (): ForIn1x1; + /** + * 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. + */ + (object: T1): T1; + /** + * 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. + */ + (object: T1 | null | undefined): T1 | null | undefined; +} + +declare const forIn: ForIn; +export = forIn; diff --git a/types/lodash/fp/forInRight.d.ts b/types/lodash/fp/forInRight.d.ts new file mode 100644 index 0000000000..0525b46d07 --- /dev/null +++ b/types/lodash/fp/forInRight.d.ts @@ -0,0 +1,74 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface ForInRight { + /** + * 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; + /** + * 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. + */ + (iteratee: (value: T) => any): ForInRight1x1; + /** + * 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. + */ + (iteratee: (value: T[keyof T]) => any, object: T): T; + /** + * 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. + */ + (iteratee: (value: T[keyof T]) => any, object: T | null | undefined): T | null | undefined; +} +interface ForInRight1x1 { + /** + * 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. + */ + (): ForInRight1x1; + /** + * 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. + */ + (object: T1): T1; + /** + * 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. + */ + (object: T1 | null | undefined): T1 | null | undefined; +} + +declare const forInRight: ForInRight; +export = forInRight; diff --git a/types/lodash/fp/forOwn.d.ts b/types/lodash/fp/forOwn.d.ts new file mode 100644 index 0000000000..222463960f --- /dev/null +++ b/types/lodash/fp/forOwn.d.ts @@ -0,0 +1,88 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface ForOwn { + /** + * 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; + /** + * 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. + */ + (iteratee: (value: T) => any): ForOwn1x1; + /** + * 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. + */ + (iteratee: (value: T[keyof T]) => any, object: T): T; + /** + * 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. + */ + (iteratee: (value: T[keyof T]) => any, object: T | null | undefined): T | null | undefined; +} +interface ForOwn1x1 { + /** + * 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. + */ + (): ForOwn1x1; + /** + * 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. + */ + (object: T1): T1; + /** + * 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. + */ + (object: T1 | null | undefined): T1 | null | undefined; +} + +declare const forOwn: ForOwn; +export = forOwn; diff --git a/types/lodash/fp/forOwnRight.d.ts b/types/lodash/fp/forOwnRight.d.ts new file mode 100644 index 0000000000..310b720ace --- /dev/null +++ b/types/lodash/fp/forOwnRight.d.ts @@ -0,0 +1,74 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface ForOwnRight { + /** + * 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; + /** + * 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. + */ + (iteratee: (value: T) => any): ForOwnRight1x1; + /** + * 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. + */ + (iteratee: (value: T[keyof T]) => any, object: T): T; + /** + * 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. + */ + (iteratee: (value: T[keyof T]) => any, object: T | null | undefined): T | null | undefined; +} +interface ForOwnRight1x1 { + /** + * 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. + */ + (): ForOwnRight1x1; + /** + * 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. + */ + (object: T1): T1; + /** + * 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. + */ + (object: T1 | null | undefined): T1 | null | undefined; +} + +declare const forOwnRight: ForOwnRight; +export = forOwnRight; diff --git a/types/lodash/fp/fromPairs.d.ts b/types/lodash/fp/fromPairs.d.ts new file mode 100644 index 0000000000..5412865d75 --- /dev/null +++ b/types/lodash/fp/fromPairs.d.ts @@ -0,0 +1,37 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface FromPairs { + /** + * The inverse of `_.toPairs`; this method returns an object composed + * from key-value `pairs`. + * + * @category Array + * @param pairs The key-value pairs. + * @returns Returns the new object. + * @example + * + * _.fromPairs([['fred', 30], ['barney', 40]]); + * // => { 'fred': 30, 'barney': 40 } + */ + (pairs: _.List<[_.PropertyName, T]> | null | undefined): _.Dictionary; + /** + * The inverse of `_.toPairs`; this method returns an object composed + * from key-value `pairs`. + * + * @category Array + * @param pairs The key-value pairs. + * @returns Returns the new object. + * @example + * + * _.fromPairs([['fred', 30], ['barney', 40]]); + * // => { 'fred': 30, 'barney': 40 } + */ + (pairs: _.List | null | undefined): _.Dictionary; +} + +declare const fromPairs: FromPairs; +export = fromPairs; diff --git a/types/lodash/fp/functions.d.ts b/types/lodash/fp/functions.d.ts new file mode 100644 index 0000000000..bc5cb94ab1 --- /dev/null +++ b/types/lodash/fp/functions.d.ts @@ -0,0 +1,28 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type Functions = + /** + * Creates an array of function property names from own enumerable properties + * of `object`. + * + * @category Object + * @param object The object to inspect. + * @returns 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'] + */ + (object: any) => string[]; + +declare const functions: Functions; +export = functions; diff --git a/types/lodash/fp/functionsIn.d.ts b/types/lodash/fp/functionsIn.d.ts new file mode 100644 index 0000000000..0189c213d6 --- /dev/null +++ b/types/lodash/fp/functionsIn.d.ts @@ -0,0 +1,28 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type FunctionsIn = + /** + * Creates an array of function property names from own and inherited + * enumerable properties of `object`. + * + * @category Object + * @param object The object to inspect. + * @returns 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'] + */ + (object: any) => string[]; + +declare const functionsIn: FunctionsIn; +export = functionsIn; diff --git a/types/lodash/fp/get.d.ts b/types/lodash/fp/get.d.ts new file mode 100644 index 0000000000..085f3d935f --- /dev/null +++ b/types/lodash/fp/get.d.ts @@ -0,0 +1,207 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Get { + /** + * 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; + /** + * 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. + */ + (path: TKey | [TKey]): Get1x1; + /** + * 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. + */ + (path: TKey | [TKey], object: TObject): TObject[TKey]; + /** + * 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. + */ + (path: TKey | [TKey], object: TObject | null | undefined): TObject[TKey] | undefined; + /** + * 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. + */ + (path: number): Get3x1; + /** + * 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. + */ + (path: number, object: _.NumericDictionary): T; + /** + * 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. + */ + (path: number, object: _.NumericDictionary | null | undefined): T | undefined; + /** + * 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. + */ + (path: _.PropertyPath): Get5x1; + /** + * 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. + */ + (path: _.PropertyPath, object: null | undefined): undefined; + /** + * 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. + */ + (path: _.PropertyPath, object: any): any; +} +interface Get1x1 { + /** + * 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. + */ + (): Get1x1; + /** + * 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. + */ + (object: TObject): TObject[TKey]; + /** + * 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. + */ + (object: TObject | null | undefined): TObject[TKey] | undefined; +} +interface Get3x1 { + /** + * 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. + */ + (): Get3x1; + /** + * 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. + */ + (object: _.NumericDictionary): T; + /** + * 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. + */ + (object: _.NumericDictionary | null | undefined): T | undefined; +} +interface Get5x1 { + /** + * 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. + */ + (): Get5x1; + /** + * 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. + */ + (object: null | undefined): undefined; + /** + * 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. + */ + (object: any): any; +} + +declare const get: Get; +export = get; diff --git a/types/lodash/fp/getOr.d.ts b/types/lodash/fp/getOr.d.ts new file mode 100644 index 0000000000..db63bd4b1a --- /dev/null +++ b/types/lodash/fp/getOr.d.ts @@ -0,0 +1,313 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Get { + /** + * 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; + /** + * 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. + */ + (defaultValue: TDefault): Get1x1; + /** + * 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. + */ + (defaultValue: TDefault, path: TKey | [TKey]): Get1x2; + /** + * 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. + */ + (defaultValue: TDefault, path: TKey | [TKey], object: TObject | null | undefined): TObject[TKey] | TDefault; + /** + * 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. + */ + (defaultValue: TDefault, path: number): Get2x2; + /** + * 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. + */ + (defaultValue: TDefault, path: number, object: _.NumericDictionary | null | undefined): T | TDefault; + /** + * 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. + */ + (defaultValue: TDefault, path: _.PropertyPath): Get3x2; + /** + * 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. + */ + (defaultValue: TDefault, path: _.PropertyPath, object: null | undefined): TDefault; + /** + * 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. + */ + (defaultValue: any): Get4x1; + /** + * 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. + */ + (defaultValue: any, path: _.PropertyPath): Get4x2; + /** + * 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. + */ + (defaultValue: any, path: _.PropertyPath, object: any): any; +} +interface Get1x1 { + /** + * 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. + */ + (): Get1x1; + /** + * 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. + */ + (path: TKey | [TKey]): Get1x2; + /** + * 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. + */ + (path: TKey | [TKey], object: TObject | null | undefined): TObject[TKey] | TDefault; + /** + * 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. + */ + (path: number): Get2x2; + /** + * 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. + */ + (path: number, object: _.NumericDictionary | null | undefined): T | TDefault; + /** + * 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. + */ + (path: _.PropertyPath): Get3x2; + /** + * 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. + */ + (path: _.PropertyPath, object: null | undefined): TDefault; +} +interface Get1x2 { + /** + * 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. + */ + (): Get1x2; + /** + * 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. + */ + (object: TObject | null | undefined): TObject[TKey] | TDefault; +} +interface Get2x2 { + /** + * 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. + */ + (): Get2x2; + /** + * 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. + */ + (object: _.NumericDictionary | null | undefined): T | TDefault; +} +interface Get3x2 { + /** + * 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. + */ + (): Get3x2; + /** + * 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. + */ + (object: null | undefined): TDefault; +} +interface Get4x1 { + /** + * 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. + */ + (): Get4x1; + /** + * 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. + */ + (path: _.PropertyPath): Get4x2; + /** + * 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. + */ + (path: _.PropertyPath, object: any): any; +} +interface Get4x2 { + /** + * 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. + */ + (): Get4x2; + /** + * 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. + */ + (object: any): any; +} + +declare const getOr: Get; +export = getOr; diff --git a/types/lodash/fp/groupBy.d.ts b/types/lodash/fp/groupBy.d.ts new file mode 100644 index 0000000000..49f6946225 --- /dev/null +++ b/types/lodash/fp/groupBy.d.ts @@ -0,0 +1,225 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface GroupBy { + /** + * 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; + /** + * 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. + */ + (iteratee: (value: string) => _.NotVoid): GroupBy1x1; + /** + * 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. + */ + (iteratee: (value: string) => _.NotVoid, collection: string | null | undefined): _.Dictionary; + /** + * 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. + */ + (iteratee: _.ValueIteratee): GroupBy2x1; + /** + * 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. + */ + (iteratee: _.ValueIteratee, collection: _.List | null | undefined): _.Dictionary; + /** + * 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. + */ + (iteratee: _.ValueIteratee, collection: T | null | undefined): _.Dictionary>; +} +interface GroupBy1x1 { + /** + * 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. + */ + (): GroupBy1x1; + /** + * 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. + */ + (collection: string | null | undefined): _.Dictionary; +} +interface GroupBy2x1 { + /** + * 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. + */ + (): GroupBy2x1; + /** + * 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. + */ + (collection: _.List | object | null | undefined): _.Dictionary; +} + +declare const groupBy: GroupBy; +export = groupBy; diff --git a/types/lodash/fp/gt.d.ts b/types/lodash/fp/gt.d.ts new file mode 100644 index 0000000000..8102922aee --- /dev/null +++ b/types/lodash/fp/gt.d.ts @@ -0,0 +1,51 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface Gt { + /** + * 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; + /** + * 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. + */ + (value: any): Gt1x1; + /** + * 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. + */ + (value: any, other: any): boolean; +} +interface Gt1x1 { + /** + * 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. + */ + (): Gt1x1; + /** + * 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. + */ + (other: any): boolean; +} + +declare const gt: Gt; +export = gt; diff --git a/types/lodash/fp/gte.d.ts b/types/lodash/fp/gte.d.ts new file mode 100644 index 0000000000..df663c4438 --- /dev/null +++ b/types/lodash/fp/gte.d.ts @@ -0,0 +1,51 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface Gte { + /** + * 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; + /** + * 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. + */ + (value: any): Gte1x1; + /** + * 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. + */ + (value: any, other: any): boolean; +} +interface Gte1x1 { + /** + * 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. + */ + (): Gte1x1; + /** + * 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. + */ + (other: any): boolean; +} + +declare const gte: Gte; +export = gte; diff --git a/types/lodash/fp/has.d.ts b/types/lodash/fp/has.d.ts new file mode 100644 index 0000000000..950a57a43b --- /dev/null +++ b/types/lodash/fp/has.d.ts @@ -0,0 +1,138 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Has { + /** + * Checks if `path` is a direct property of `object`. + * + * @category Object + * @param object The object to query. + * @param path The path to check. + * @returns 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; + /** + * Checks if `path` is a direct property of `object`. + * + * @category Object + * @param object The object to query. + * @param path The path to check. + * @returns 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 + */ + (path: _.PropertyPath): Has1x1; + /** + * Checks if `path` is a direct property of `object`. + * + * @category Object + * @param object The object to query. + * @param path The path to check. + * @returns 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 + */ + (path: _.PropertyPath, object: T): boolean; +} +interface Has1x1 { + /** + * Checks if `path` is a direct property of `object`. + * + * @category Object + * @param object The object to query. + * @param path The path to check. + * @returns 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 + */ + (): Has1x1; + /** + * Checks if `path` is a direct property of `object`. + * + * @category Object + * @param object The object to query. + * @param path The path to check. + * @returns 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 + */ + (object: T): boolean; +} + +declare const has: Has; +export = has; diff --git a/types/lodash/fp/hasIn.d.ts b/types/lodash/fp/hasIn.d.ts new file mode 100644 index 0000000000..a5ffb7ae4e --- /dev/null +++ b/types/lodash/fp/hasIn.d.ts @@ -0,0 +1,133 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface HasIn { + /** + * Checks if `path` is a direct or inherited property of `object`. + * + * @category Object + * @param object The object to query. + * @param path The path to check. + * @returns 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; + /** + * Checks if `path` is a direct or inherited property of `object`. + * + * @category Object + * @param object The object to query. + * @param path The path to check. + * @returns 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 + */ + (path: _.PropertyPath): HasIn1x1; + /** + * Checks if `path` is a direct or inherited property of `object`. + * + * @category Object + * @param object The object to query. + * @param path The path to check. + * @returns 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 + */ + (path: _.PropertyPath, object: T): boolean; +} +interface HasIn1x1 { + /** + * Checks if `path` is a direct or inherited property of `object`. + * + * @category Object + * @param object The object to query. + * @param path The path to check. + * @returns 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 + */ + (): HasIn1x1; + /** + * Checks if `path` is a direct or inherited property of `object`. + * + * @category Object + * @param object The object to query. + * @param path The path to check. + * @returns 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 + */ + (object: T): boolean; +} + +declare const hasIn: HasIn; +export = hasIn; diff --git a/types/lodash/fp/head.d.ts b/types/lodash/fp/head.d.ts new file mode 100644 index 0000000000..618e7ca561 --- /dev/null +++ b/types/lodash/fp/head.d.ts @@ -0,0 +1,19 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +type Head = + /** + * Gets the first element of array. + * + * @alias _.first + * + * @param array The array to query. + * @return Returns the first element of array. + */ + (array: _.List | null | undefined) => T | undefined; + +declare const head: Head; +export = head; diff --git a/types/lodash/fp/identical.d.ts b/types/lodash/fp/identical.d.ts new file mode 100644 index 0000000000..689227ac95 --- /dev/null +++ b/types/lodash/fp/identical.d.ts @@ -0,0 +1,156 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface Eq { + /** + * Performs a [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * comparison between two values to determine if they are equivalent. + * + * @category Lang + * @param value The value to compare. + * @param other The other value to compare. + * @returns 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; + /** + * Performs a [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * comparison between two values to determine if they are equivalent. + * + * @category Lang + * @param value The value to compare. + * @param other The other value to compare. + * @returns 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 + */ + (value: any): Eq1x1; + /** + * Performs a [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * comparison between two values to determine if they are equivalent. + * + * @category Lang + * @param value The value to compare. + * @param other The other value to compare. + * @returns 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 + */ + (value: any, other: any): boolean; +} +interface Eq1x1 { + /** + * Performs a [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * comparison between two values to determine if they are equivalent. + * + * @category Lang + * @param value The value to compare. + * @param other The other value to compare. + * @returns 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 + */ + (): Eq1x1; + /** + * Performs a [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * comparison between two values to determine if they are equivalent. + * + * @category Lang + * @param value The value to compare. + * @param other The other value to compare. + * @returns 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 + */ + (other: any): boolean; +} + +declare const identical: Eq; +export = identical; diff --git a/types/lodash/fp/identity.d.ts b/types/lodash/fp/identity.d.ts new file mode 100644 index 0000000000..46411f1db1 --- /dev/null +++ b/types/lodash/fp/identity.d.ts @@ -0,0 +1,23 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface Identity { + /** + * This method returns the first argument provided to it. + * + * @param value Any value. + * @return Returns value. + */ + (value: T): T; + /** + * This method returns the first argument provided to it. + * + * @param value Any value. + * @return Returns value. + */ + (): undefined; +} + +declare const identity: Identity; +export = identity; diff --git a/types/lodash/fp/inRange.d.ts b/types/lodash/fp/inRange.d.ts new file mode 100644 index 0000000000..564ed81a4e --- /dev/null +++ b/types/lodash/fp/inRange.d.ts @@ -0,0 +1,103 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface InRange { + /** + * 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; + /** + * 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. + */ + (start: number): InRange1x1; + /** + * 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. + */ + (start: number, end: number): InRange1x2; + /** + * 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. + */ + (start: number, end: number, n: number): boolean; +} +interface InRange1x1 { + /** + * 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. + */ + (): InRange1x1; + /** + * 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. + */ + (end: number): InRange1x2; + /** + * 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. + */ + (end: number, n: number): boolean; +} +interface InRange1x2 { + /** + * 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. + */ + (): InRange1x2; + /** + * 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. + */ + (n: number): boolean; +} + +declare const inRange: InRange; +export = inRange; diff --git a/types/lodash/fp/includes.d.ts b/types/lodash/fp/includes.d.ts new file mode 100644 index 0000000000..b498f0e8aa --- /dev/null +++ b/types/lodash/fp/includes.d.ts @@ -0,0 +1,63 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Includes { + /** + * 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. + * + * @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; + /** + * 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. + * + * @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. + */ + (target: T): Includes1x1; + /** + * 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. + * + * @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. + */ + (target: T, collection: _.List | _.Dictionary | _.NumericDictionary | null | undefined): boolean; +} +interface Includes1x1 { + /** + * 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. + * + * @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. + */ + (): Includes1x1; + /** + * 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. + * + * @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. + */ + (collection: _.List | _.Dictionary | _.NumericDictionary | null | undefined): boolean; +} + +declare const includes: Includes; +export = includes; diff --git a/types/lodash/fp/includesFrom.d.ts b/types/lodash/fp/includesFrom.d.ts new file mode 100644 index 0000000000..45d2f6bab8 --- /dev/null +++ b/types/lodash/fp/includesFrom.d.ts @@ -0,0 +1,105 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Includes { + /** + * 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. + * + * @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; + /** + * 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. + * + * @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. + */ + (target: T): Includes1x1; + /** + * 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. + * + * @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. + */ + (target: T, fromIndex: number): Includes1x2; + /** + * 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. + * + * @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. + */ + (target: T, fromIndex: number, collection: _.List | _.Dictionary | _.NumericDictionary | null | undefined): boolean; +} +interface Includes1x1 { + /** + * 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. + * + * @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. + */ + (): Includes1x1; + /** + * 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. + * + * @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. + */ + (fromIndex: number): Includes1x2; + /** + * 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. + * + * @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. + */ + (fromIndex: number, collection: _.List | _.Dictionary | _.NumericDictionary | null | undefined): boolean; +} +interface Includes1x2 { + /** + * 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. + * + * @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. + */ + (): Includes1x2; + /** + * 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. + * + * @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. + */ + (collection: _.List | _.Dictionary | _.NumericDictionary | null | undefined): boolean; +} + +declare const includesFrom: Includes; +export = includesFrom; diff --git a/types/lodash/fp/indexBy.d.ts b/types/lodash/fp/indexBy.d.ts new file mode 100644 index 0000000000..22a9e62a3b --- /dev/null +++ b/types/lodash/fp/indexBy.d.ts @@ -0,0 +1,225 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface KeyBy { + /** + * 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. + */ + (): KeyBy; + /** + * 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. + */ + (iteratee: (value: string) => _.PropertyName): KeyBy1x1; + /** + * 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. + */ + (iteratee: (value: string) => _.PropertyName, collection: string | null | undefined): _.Dictionary; + /** + * 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. + */ + (iteratee: _.ValueIterateeCustom): KeyBy2x1; + /** + * 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. + */ + (iteratee: _.ValueIterateeCustom, collection: _.List | null | undefined): _.Dictionary; + /** + * 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. + */ + (iteratee: _.ValueIterateeCustom, collection: T | null | undefined): _.Dictionary; +} +interface KeyBy1x1 { + /** + * 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. + */ + (): KeyBy1x1; + /** + * 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. + */ + (collection: string | null | undefined): _.Dictionary; +} +interface KeyBy2x1 { + /** + * 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. + */ + (): KeyBy2x1; + /** + * 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. + */ + (collection: _.List | object | null | undefined): _.Dictionary; +} + +declare const indexBy: KeyBy; +export = indexBy; diff --git a/types/lodash/fp/indexOf.d.ts b/types/lodash/fp/indexOf.d.ts new file mode 100644 index 0000000000..71c684508f --- /dev/null +++ b/types/lodash/fp/indexOf.d.ts @@ -0,0 +1,118 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface IndexOf { + /** + * 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`. + * + * @category Array + * @param array The array to search. + * @param value The value to search for. + * @param [fromIndex=0] The index to search from. + * @returns 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; + /** + * 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`. + * + * @category Array + * @param array The array to search. + * @param value The value to search for. + * @param [fromIndex=0] The index to search from. + * @returns 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 + */ + (value: T): IndexOf1x1; + /** + * 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`. + * + * @category Array + * @param array The array to search. + * @param value The value to search for. + * @param [fromIndex=0] The index to search from. + * @returns 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 + */ + (value: T, array: _.List | null | undefined): number; +} +interface IndexOf1x1 { + /** + * 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`. + * + * @category Array + * @param array The array to search. + * @param value The value to search for. + * @param [fromIndex=0] The index to search from. + * @returns 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 + */ + (): IndexOf1x1; + /** + * 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`. + * + * @category Array + * @param array The array to search. + * @param value The value to search for. + * @param [fromIndex=0] The index to search from. + * @returns 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 + */ + (array: _.List | null | undefined): number; +} + +declare const indexOf: IndexOf; +export = indexOf; diff --git a/types/lodash/fp/indexOfFrom.d.ts b/types/lodash/fp/indexOfFrom.d.ts new file mode 100644 index 0000000000..22c8315ae5 --- /dev/null +++ b/types/lodash/fp/indexOfFrom.d.ts @@ -0,0 +1,204 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface IndexOf { + /** + * 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`. + * + * @category Array + * @param array The array to search. + * @param value The value to search for. + * @param [fromIndex=0] The index to search from. + * @returns 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; + /** + * 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`. + * + * @category Array + * @param array The array to search. + * @param value The value to search for. + * @param [fromIndex=0] The index to search from. + * @returns 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 + */ + (value: T): IndexOf1x1; + /** + * 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`. + * + * @category Array + * @param array The array to search. + * @param value The value to search for. + * @param [fromIndex=0] The index to search from. + * @returns 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 + */ + (value: T, fromIndex: number): IndexOf1x2; + /** + * 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`. + * + * @category Array + * @param array The array to search. + * @param value The value to search for. + * @param [fromIndex=0] The index to search from. + * @returns 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 + */ + (value: T, fromIndex: number, array: _.List | null | undefined): number; +} +interface IndexOf1x1 { + /** + * 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`. + * + * @category Array + * @param array The array to search. + * @param value The value to search for. + * @param [fromIndex=0] The index to search from. + * @returns 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 + */ + (): IndexOf1x1; + /** + * 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`. + * + * @category Array + * @param array The array to search. + * @param value The value to search for. + * @param [fromIndex=0] The index to search from. + * @returns 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 + */ + (fromIndex: number): IndexOf1x2; + /** + * 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`. + * + * @category Array + * @param array The array to search. + * @param value The value to search for. + * @param [fromIndex=0] The index to search from. + * @returns 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 + */ + (fromIndex: number, array: _.List | null | undefined): number; +} +interface IndexOf1x2 { + /** + * 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`. + * + * @category Array + * @param array The array to search. + * @param value The value to search for. + * @param [fromIndex=0] The index to search from. + * @returns 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 + */ + (): IndexOf1x2; + /** + * 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`. + * + * @category Array + * @param array The array to search. + * @param value The value to search for. + * @param [fromIndex=0] The index to search from. + * @returns 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 + */ + (array: _.List | null | undefined): number; +} + +declare const indexOfFrom: IndexOf; +export = indexOfFrom; diff --git a/types/lodash/fp/init.d.ts b/types/lodash/fp/init.d.ts new file mode 100644 index 0000000000..3c22717976 --- /dev/null +++ b/types/lodash/fp/init.d.ts @@ -0,0 +1,17 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +type Initial = + /** + * Gets all but the last element of array. + * + * @param array The array to query. + * @return Returns the slice of array. + */ + (array: _.List | null | undefined) => T[]; + +declare const init: Initial; +export = init; diff --git a/types/lodash/fp/initial.d.ts b/types/lodash/fp/initial.d.ts new file mode 100644 index 0000000000..e4d10ae946 --- /dev/null +++ b/types/lodash/fp/initial.d.ts @@ -0,0 +1,17 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +type Initial = + /** + * Gets all but the last element of array. + * + * @param array The array to query. + * @return Returns the slice of array. + */ + (array: _.List | null | undefined) => T[]; + +declare const initial: Initial; +export = initial; diff --git a/types/lodash/fp/intersection.d.ts b/types/lodash/fp/intersection.d.ts new file mode 100644 index 0000000000..ad290ebd3e --- /dev/null +++ b/types/lodash/fp/intersection.d.ts @@ -0,0 +1,53 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Intersection { + /** + * 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; + /** + * 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. + */ + (arrays2: _.List): Intersection1x1; + /** + * 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. + */ + (arrays2: _.List, arrays: _.List): T[]; +} +interface Intersection1x1 { + /** + * 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. + */ + (): Intersection1x1; + /** + * 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. + */ + (arrays: _.List): T[]; +} + +declare const intersection: Intersection; +export = intersection; diff --git a/types/lodash/fp/intersectionBy.d.ts b/types/lodash/fp/intersectionBy.d.ts new file mode 100644 index 0000000000..6b94ad98f7 --- /dev/null +++ b/types/lodash/fp/intersectionBy.d.ts @@ -0,0 +1,186 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface IntersectionBy { + /** + * 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). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns 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; + /** + * 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). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns 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 }] + */ + (iteratee: _.ValueIteratee): IntersectionBy1x1; + /** + * 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). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns 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 }] + */ + (iteratee: _.ValueIteratee, array: _.List | null): IntersectionBy1x2; + /** + * 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). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns 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 }] + */ + (iteratee: _.ValueIteratee, array: _.List | null, values: _.List): T1[]; +} +interface IntersectionBy1x1 { + /** + * 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). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns 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 }] + */ + (): IntersectionBy1x1; + /** + * 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). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns 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 }] + */ + (array: _.List | null): IntersectionBy1x2; + /** + * 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). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns 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 }] + */ + (array: _.List | null, values: _.List): T1[]; +} +interface IntersectionBy1x2 { + /** + * 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). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns 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 }] + */ + (): IntersectionBy1x2; + /** + * 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). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns 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 }] + */ + (values: _.List): T1[]; +} + +declare const intersectionBy: IntersectionBy; +export = intersectionBy; diff --git a/types/lodash/fp/intersectionWith.d.ts b/types/lodash/fp/intersectionWith.d.ts new file mode 100644 index 0000000000..275d2fb3a9 --- /dev/null +++ b/types/lodash/fp/intersectionWith.d.ts @@ -0,0 +1,177 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface IntersectionWith { + /** + * 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. + * + * @category Array + * @param [values] The arrays to inspect. + * @param [comparator] The comparator invoked per element. + * @returns Returns the new array of filtered 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; + /** + * 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. + * + * @category Array + * @param [values] The arrays to inspect. + * @param [comparator] The comparator invoked per element. + * @returns Returns the new array of filtered 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 }] + */ + (comparator: _.Comparator2): IntersectionWith1x1; + /** + * 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. + * + * @category Array + * @param [values] The arrays to inspect. + * @param [comparator] The comparator invoked per element. + * @returns Returns the new array of filtered 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 }] + */ + (comparator: _.Comparator2, array: _.List | null | undefined): IntersectionWith1x2; + /** + * 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. + * + * @category Array + * @param [values] The arrays to inspect. + * @param [comparator] The comparator invoked per element. + * @returns Returns the new array of filtered 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 }] + */ + (comparator: _.Comparator2, array: _.List | null | undefined, values: _.List): T1[]; +} +interface IntersectionWith1x1 { + /** + * 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. + * + * @category Array + * @param [values] The arrays to inspect. + * @param [comparator] The comparator invoked per element. + * @returns Returns the new array of filtered 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 }] + */ + (): IntersectionWith1x1; + /** + * 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. + * + * @category Array + * @param [values] The arrays to inspect. + * @param [comparator] The comparator invoked per element. + * @returns Returns the new array of filtered 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 }] + */ + (array: _.List | null | undefined): IntersectionWith1x2; + /** + * 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. + * + * @category Array + * @param [values] The arrays to inspect. + * @param [comparator] The comparator invoked per element. + * @returns Returns the new array of filtered 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 }] + */ + (array: _.List | null | undefined, values: _.List): T1[]; +} +interface IntersectionWith1x2 { + /** + * 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. + * + * @category Array + * @param [values] The arrays to inspect. + * @param [comparator] The comparator invoked per element. + * @returns Returns the new array of filtered 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 }] + */ + (): IntersectionWith1x2; + /** + * 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. + * + * @category Array + * @param [values] The arrays to inspect. + * @param [comparator] The comparator invoked per element. + * @returns Returns the new array of filtered 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 }] + */ + (values: _.List): T1[]; +} + +declare const intersectionWith: IntersectionWith; +export = intersectionWith; diff --git a/types/lodash/fp/invert.d.ts b/types/lodash/fp/invert.d.ts new file mode 100644 index 0000000000..fa6e62340e --- /dev/null +++ b/types/lodash/fp/invert.d.ts @@ -0,0 +1,19 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +type Invert = + /** + * 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. + */ + (object: object) => _.Dictionary; + +declare const invert: Invert; +export = invert; diff --git a/types/lodash/fp/invertBy.d.ts b/types/lodash/fp/invertBy.d.ts new file mode 100644 index 0000000000..5a386385ae --- /dev/null +++ b/types/lodash/fp/invertBy.d.ts @@ -0,0 +1,73 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface InvertBy { + /** + * This method is like _.invert except that the inverted object is generated from the results of running each + * element of object through iteratee. The corresponding inverted value of each inverted key is an array of + * keys responsible for generating the inverted value. The iteratee is invoked with one argument: (value). + * + * @param object The object to invert. + * @param interatee The iteratee invoked per element. + * @return Returns the new inverted object. + */ + (): InvertBy; + /** + * This method is like _.invert except that the inverted object is generated from the results of running each + * element of object through iteratee. The corresponding inverted value of each inverted key is an array of + * keys responsible for generating the inverted value. The iteratee is invoked with one argument: (value). + * + * @param object The object to invert. + * @param interatee The iteratee invoked per element. + * @return Returns the new inverted object. + */ + (interatee: _.ValueIteratee): InvertBy1x1; + /** + * This method is like _.invert except that the inverted object is generated from the results of running each + * element of object through iteratee. The corresponding inverted value of each inverted key is an array of + * keys responsible for generating the inverted value. The iteratee is invoked with one argument: (value). + * + * @param object The object to invert. + * @param interatee The iteratee invoked per element. + * @return Returns the new inverted object. + */ + (interatee: _.ValueIteratee, object: _.List | _.Dictionary | _.NumericDictionary | null | undefined): _.Dictionary; + /** + * This method is like _.invert except that the inverted object is generated from the results of running each + * element of object through iteratee. The corresponding inverted value of each inverted key is an array of + * keys responsible for generating the inverted value. The iteratee is invoked with one argument: (value). + * + * @param object The object to invert. + * @param interatee The iteratee invoked per element. + * @return Returns the new inverted object. + */ + (interatee: _.ValueIteratee, object: T | null | undefined): _.Dictionary; +} +interface InvertBy1x1 { + /** + * This method is like _.invert except that the inverted object is generated from the results of running each + * element of object through iteratee. The corresponding inverted value of each inverted key is an array of + * keys responsible for generating the inverted value. The iteratee is invoked with one argument: (value). + * + * @param object The object to invert. + * @param interatee The iteratee invoked per element. + * @return Returns the new inverted object. + */ + (): InvertBy1x1; + /** + * This method is like _.invert except that the inverted object is generated from the results of running each + * element of object through iteratee. The corresponding inverted value of each inverted key is an array of + * keys responsible for generating the inverted value. The iteratee is invoked with one argument: (value). + * + * @param object The object to invert. + * @param interatee The iteratee invoked per element. + * @return Returns the new inverted object. + */ + (object: _.List | _.Dictionary | _.NumericDictionary | object | null | undefined): _.Dictionary; +} + +declare const invertBy: InvertBy; +export = invertBy; diff --git a/types/lodash/fp/invertObj.d.ts b/types/lodash/fp/invertObj.d.ts new file mode 100644 index 0000000000..aeeb28ca48 --- /dev/null +++ b/types/lodash/fp/invertObj.d.ts @@ -0,0 +1,19 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +type Invert = + /** + * 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. + */ + (object: object) => _.Dictionary; + +declare const invertObj: Invert; +export = invertObj; diff --git a/types/lodash/fp/invoke.d.ts b/types/lodash/fp/invoke.d.ts new file mode 100644 index 0000000000..9a72390f8e --- /dev/null +++ b/types/lodash/fp/invoke.d.ts @@ -0,0 +1,48 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Invoke { + /** + * Invokes the method at path of object. + * @param object The object to query. + * @param path The path of the method to invoke. + * @param args The arguments to invoke the method with. + **/ + (): Invoke; + /** + * Invokes the method at path of object. + * @param object The object to query. + * @param path The path of the method to invoke. + * @param args The arguments to invoke the method with. + **/ + (path: _.PropertyPath): Invoke1x1; + /** + * Invokes the method at path of object. + * @param object The object to query. + * @param path The path of the method to invoke. + * @param args The arguments to invoke the method with. + **/ + (path: _.PropertyPath, object: any): any; +} +interface Invoke1x1 { + /** + * Invokes the method at path of object. + * @param object The object to query. + * @param path The path of the method to invoke. + * @param args The arguments to invoke the method with. + **/ + (): Invoke1x1; + /** + * Invokes the method at path of object. + * @param object The object to query. + * @param path The path of the method to invoke. + * @param args The arguments to invoke the method with. + **/ + (object: any): any; +} + +declare const invoke: Invoke; +export = invoke; diff --git a/types/lodash/fp/invokeArgs.d.ts b/types/lodash/fp/invokeArgs.d.ts new file mode 100644 index 0000000000..5c385579fd --- /dev/null +++ b/types/lodash/fp/invokeArgs.d.ts @@ -0,0 +1,78 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Invoke { + /** + * Invokes the method at path of object. + * @param object The object to query. + * @param path The path of the method to invoke. + * @param args The arguments to invoke the method with. + **/ + (): Invoke; + /** + * Invokes the method at path of object. + * @param object The object to query. + * @param path The path of the method to invoke. + * @param args The arguments to invoke the method with. + **/ + (path: _.PropertyPath): Invoke1x1; + /** + * Invokes the method at path of object. + * @param object The object to query. + * @param path The path of the method to invoke. + * @param args The arguments to invoke the method with. + **/ + (path: _.PropertyPath, args: ReadonlyArray): Invoke1x2; + /** + * Invokes the method at path of object. + * @param object The object to query. + * @param path The path of the method to invoke. + * @param args The arguments to invoke the method with. + **/ + (path: _.PropertyPath, args: ReadonlyArray, object: any): any; +} +interface Invoke1x1 { + /** + * Invokes the method at path of object. + * @param object The object to query. + * @param path The path of the method to invoke. + * @param args The arguments to invoke the method with. + **/ + (): Invoke1x1; + /** + * Invokes the method at path of object. + * @param object The object to query. + * @param path The path of the method to invoke. + * @param args The arguments to invoke the method with. + **/ + (args: ReadonlyArray): Invoke1x2; + /** + * Invokes the method at path of object. + * @param object The object to query. + * @param path The path of the method to invoke. + * @param args The arguments to invoke the method with. + **/ + (args: ReadonlyArray, object: any): any; +} +interface Invoke1x2 { + /** + * Invokes the method at path of object. + * @param object The object to query. + * @param path The path of the method to invoke. + * @param args The arguments to invoke the method with. + **/ + (): Invoke1x2; + /** + * Invokes the method at path of object. + * @param object The object to query. + * @param path The path of the method to invoke. + * @param args The arguments to invoke the method with. + **/ + (object: any): any; +} + +declare const invokeArgs: Invoke; +export = invokeArgs; diff --git a/types/lodash/fp/invokeArgsMap.d.ts b/types/lodash/fp/invokeArgsMap.d.ts new file mode 100644 index 0000000000..59e6170594 --- /dev/null +++ b/types/lodash/fp/invokeArgsMap.d.ts @@ -0,0 +1,187 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface InvokeMap { + /** + * 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. + **/ + (): InvokeMap; + /** + * 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. + **/ + (methodName: string): InvokeMap1x1; + /** + * 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. + **/ + (methodName: string, args: ReadonlyArray): InvokeMap1x2; + /** + * 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. + **/ + (methodName: string, args: ReadonlyArray, collection: object | null | undefined): any[]; + /** + * 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. + **/ + (method: (...args: any[]) => TResult): InvokeMap2x1; + /** + * 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. + **/ + (method: (...args: any[]) => TResult, args: ReadonlyArray): InvokeMap2x2; + /** + * 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. + **/ + (method: (...args: any[]) => TResult, args: ReadonlyArray, collection: object | null | undefined): TResult[]; +} +interface InvokeMap1x1 { + /** + * 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. + **/ + (): InvokeMap1x1; + /** + * 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. + **/ + (args: ReadonlyArray): InvokeMap1x2; + /** + * 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. + **/ + (args: ReadonlyArray, collection: object | null | undefined): any[]; +} +interface InvokeMap1x2 { + /** + * 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. + **/ + (): InvokeMap1x2; + /** + * 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. + **/ + (collection: object | null | undefined): any[]; +} +interface InvokeMap2x1 { + /** + * 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. + **/ + (): InvokeMap2x1; + /** + * 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. + **/ + (args: ReadonlyArray): InvokeMap2x2; + /** + * 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. + **/ + (args: ReadonlyArray, collection: object | null | undefined): TResult[]; +} +interface InvokeMap2x2 { + /** + * 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. + **/ + (): InvokeMap2x2; + /** + * 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. + **/ + (collection: object | null | undefined): TResult[]; +} + +declare const invokeArgsMap: InvokeMap; +export = invokeArgsMap; diff --git a/types/lodash/fp/invokeMap.d.ts b/types/lodash/fp/invokeMap.d.ts new file mode 100644 index 0000000000..3bb1072954 --- /dev/null +++ b/types/lodash/fp/invokeMap.d.ts @@ -0,0 +1,103 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface InvokeMap { + /** + * 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. + **/ + (): InvokeMap; + /** + * 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. + **/ + (methodName: string): InvokeMap1x1; + /** + * 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. + **/ + (methodName: string, collection: object | null | undefined): any[]; + /** + * 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. + **/ + (method: (...args: any[]) => TResult): InvokeMap2x1; + /** + * 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. + **/ + (method: (...args: any[]) => TResult, collection: object | null | undefined): TResult[]; +} +interface InvokeMap1x1 { + /** + * 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. + **/ + (): InvokeMap1x1; + /** + * 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. + **/ + (collection: object | null | undefined): any[]; +} +interface InvokeMap2x1 { + /** + * 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. + **/ + (): InvokeMap2x1; + /** + * 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. + **/ + (collection: object | null | undefined): TResult[]; +} + +declare const invokeMap: InvokeMap; +export = invokeMap; diff --git a/types/lodash/fp/isArguments.d.ts b/types/lodash/fp/isArguments.d.ts new file mode 100644 index 0000000000..53841e17fc --- /dev/null +++ b/types/lodash/fp/isArguments.d.ts @@ -0,0 +1,15 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type IsArguments = + /** + * 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. + */ + (value: any) => value is IArguments; + +declare const isArguments: IsArguments; +export = isArguments; diff --git a/types/lodash/fp/isArray.d.ts b/types/lodash/fp/isArray.d.ts new file mode 100644 index 0000000000..6f96cdbe55 --- /dev/null +++ b/types/lodash/fp/isArray.d.ts @@ -0,0 +1,15 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type IsArray = + /** + * 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. + */ + (value: any) => value is any[]; + +declare const isArray: IsArray; +export = isArray; diff --git a/types/lodash/fp/isArrayBuffer.d.ts b/types/lodash/fp/isArrayBuffer.d.ts new file mode 100644 index 0000000000..a9fab817ec --- /dev/null +++ b/types/lodash/fp/isArrayBuffer.d.ts @@ -0,0 +1,15 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type IsArrayBuffer = + /** + * Checks if value is classified as an ArrayBuffer object. + * + * @param value The value to check. + * @return Returns true if value is correctly classified, else false. + */ + (value: any) => value is ArrayBuffer; + +declare const isArrayBuffer: IsArrayBuffer; +export = isArrayBuffer; diff --git a/types/lodash/fp/isArrayLike.d.ts b/types/lodash/fp/isArrayLike.d.ts new file mode 100644 index 0000000000..4d99172433 --- /dev/null +++ b/types/lodash/fp/isArrayLike.d.ts @@ -0,0 +1,78 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface IsArrayLike { + /** + * 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`. + * + * @category Lang + * @param value The value to check. + * @returns 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 + */ + (value: T & string & number): boolean; + /** + * 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`. + * + * @category Lang + * @param value The value to check. + * @returns 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 + */ + (value: ((...args: any[]) => any) | null | undefined): value is never; + /** + * 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`. + * + * @category Lang + * @param value The value to check. + * @returns 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 + */ + (value: any): value is { length: number }; +} + +declare const isArrayLike: IsArrayLike; +export = isArrayLike; diff --git a/types/lodash/fp/isArrayLikeObject.d.ts b/types/lodash/fp/isArrayLikeObject.d.ts new file mode 100644 index 0000000000..f21c1f6836 --- /dev/null +++ b/types/lodash/fp/isArrayLikeObject.d.ts @@ -0,0 +1,77 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface IsArrayLikeObject { + /** + * This method is like `_.isArrayLike` except that it also checks if `value` + * is an object. + * + * @category Lang + * @param value The value to check. + * @returns 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 + */ + (value: T & string & number): boolean; + /** + * This method is like `_.isArrayLike` except that it also checks if `value` + * is an object. + * + * @category Lang + * @param value The value to check. + * @returns 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 + */ + // tslint:disable-next-line:ban-types (type guard doesn't seem to work correctly without the Function type) + (value: ((...args: any[]) => any) | Function | string | boolean | number | null | undefined): value is never; + /** + * This method is like `_.isArrayLike` except that it also checks if `value` + * is an object. + * + * @category Lang + * @param value The value to check. + * @returns 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 + */ + // tslint:disable-next-line:ban-types (type guard doesn't seem to work correctly without the Function type) + (value: T | ((...args: any[]) => any) | Function | string | boolean | number | null | undefined): value is T & { length: number }; +} + +declare const isArrayLikeObject: IsArrayLikeObject; +export = isArrayLikeObject; diff --git a/types/lodash/fp/isBoolean.d.ts b/types/lodash/fp/isBoolean.d.ts new file mode 100644 index 0000000000..45aaa6d2f9 --- /dev/null +++ b/types/lodash/fp/isBoolean.d.ts @@ -0,0 +1,15 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type IsBoolean = + /** + * 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. + */ + (value: any) => value is boolean; + +declare const isBoolean: IsBoolean; +export = isBoolean; diff --git a/types/lodash/fp/isBuffer.d.ts b/types/lodash/fp/isBuffer.d.ts new file mode 100644 index 0000000000..a603cf2d68 --- /dev/null +++ b/types/lodash/fp/isBuffer.d.ts @@ -0,0 +1,15 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type IsBuffer = + /** + * Checks if value is a buffer. + * + * @param value The value to check. + * @return Returns true if value is a buffer, else false. + */ + (value: any) => boolean; + +declare const isBuffer: IsBuffer; +export = isBuffer; diff --git a/types/lodash/fp/isDate.d.ts b/types/lodash/fp/isDate.d.ts new file mode 100644 index 0000000000..a602131f26 --- /dev/null +++ b/types/lodash/fp/isDate.d.ts @@ -0,0 +1,15 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type IsDate = + /** + * 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. + */ + (value: any) => value is Date; + +declare const isDate: IsDate; +export = isDate; diff --git a/types/lodash/fp/isElement.d.ts b/types/lodash/fp/isElement.d.ts new file mode 100644 index 0000000000..56fe27d3a6 --- /dev/null +++ b/types/lodash/fp/isElement.d.ts @@ -0,0 +1,15 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type IsElement = + /** + * Checks if value is a DOM element. + * + * @param value The value to check. + * @return Returns true if value is a DOM element, else false. + */ + (value: any) => boolean; + +declare const isElement: IsElement; +export = isElement; diff --git a/types/lodash/fp/isEmpty.d.ts b/types/lodash/fp/isEmpty.d.ts new file mode 100644 index 0000000000..b24d33f88e --- /dev/null +++ b/types/lodash/fp/isEmpty.d.ts @@ -0,0 +1,16 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type IsEmpty = + /** + * 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. + */ + (value: any) => boolean; + +declare const isEmpty: IsEmpty; +export = isEmpty; diff --git a/types/lodash/fp/isEqual.d.ts b/types/lodash/fp/isEqual.d.ts new file mode 100644 index 0000000000..225f90f914 --- /dev/null +++ b/types/lodash/fp/isEqual.d.ts @@ -0,0 +1,141 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface IsEqual { + /** + * Performs a deep comparison between two values to determine if they are + * equivalent. + * + * **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. + * + * @category Lang + * @param value The value to compare. + * @param other The other value to compare. + * @returns Returns `true` if the values are equivalent, else `false`. + * @example + * + * var object = { 'user': 'fred' }; + * var other = { 'user': 'fred' }; + * + * _.isEqual(object, other); + * // => true + * + * object === other; + * // => false + */ + (): IsEqual; + /** + * Performs a deep comparison between two values to determine if they are + * equivalent. + * + * **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. + * + * @category Lang + * @param value The value to compare. + * @param other The other value to compare. + * @returns Returns `true` if the values are equivalent, else `false`. + * @example + * + * var object = { 'user': 'fred' }; + * var other = { 'user': 'fred' }; + * + * _.isEqual(object, other); + * // => true + * + * object === other; + * // => false + */ + (value: any): IsEqual1x1; + /** + * Performs a deep comparison between two values to determine if they are + * equivalent. + * + * **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. + * + * @category Lang + * @param value The value to compare. + * @param other The other value to compare. + * @returns Returns `true` if the values are equivalent, else `false`. + * @example + * + * var object = { 'user': 'fred' }; + * var other = { 'user': 'fred' }; + * + * _.isEqual(object, other); + * // => true + * + * object === other; + * // => false + */ + (value: any, other: any): boolean; +} +interface IsEqual1x1 { + /** + * Performs a deep comparison between two values to determine if they are + * equivalent. + * + * **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. + * + * @category Lang + * @param value The value to compare. + * @param other The other value to compare. + * @returns Returns `true` if the values are equivalent, else `false`. + * @example + * + * var object = { 'user': 'fred' }; + * var other = { 'user': 'fred' }; + * + * _.isEqual(object, other); + * // => true + * + * object === other; + * // => false + */ + (): IsEqual1x1; + /** + * Performs a deep comparison between two values to determine if they are + * equivalent. + * + * **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. + * + * @category Lang + * @param value The value to compare. + * @param other The other value to compare. + * @returns Returns `true` if the values are equivalent, else `false`. + * @example + * + * var object = { 'user': 'fred' }; + * var other = { 'user': 'fred' }; + * + * _.isEqual(object, other); + * // => true + * + * object === other; + * // => false + */ + (other: any): boolean; +} + +declare const isEqual: IsEqual; +export = isEqual; diff --git a/types/lodash/fp/isEqualWith.d.ts b/types/lodash/fp/isEqualWith.d.ts new file mode 100644 index 0000000000..832c80829c --- /dev/null +++ b/types/lodash/fp/isEqualWith.d.ts @@ -0,0 +1,285 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface IsEqualWith { + /** + * 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]). + * + * @category Lang + * @param value The value to compare. + * @param other The other value to compare. + * @param [customizer] The function to customize comparisons. + * @returns 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; + /** + * 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]). + * + * @category Lang + * @param value The value to compare. + * @param other The other value to compare. + * @param [customizer] The function to customize comparisons. + * @returns 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 + */ + (customizer: _.IsEqualCustomizer): IsEqualWith1x1; + /** + * 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]). + * + * @category Lang + * @param value The value to compare. + * @param other The other value to compare. + * @param [customizer] The function to customize comparisons. + * @returns 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 + */ + (customizer: _.IsEqualCustomizer, value: any): IsEqualWith1x2; + /** + * 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]). + * + * @category Lang + * @param value The value to compare. + * @param other The other value to compare. + * @param [customizer] The function to customize comparisons. + * @returns 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 + */ + (customizer: _.IsEqualCustomizer, value: any, other: any): boolean; +} +interface IsEqualWith1x1 { + /** + * 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]). + * + * @category Lang + * @param value The value to compare. + * @param other The other value to compare. + * @param [customizer] The function to customize comparisons. + * @returns 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 + */ + (): IsEqualWith1x1; + /** + * 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]). + * + * @category Lang + * @param value The value to compare. + * @param other The other value to compare. + * @param [customizer] The function to customize comparisons. + * @returns 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 + */ + (value: any): IsEqualWith1x2; + /** + * 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]). + * + * @category Lang + * @param value The value to compare. + * @param other The other value to compare. + * @param [customizer] The function to customize comparisons. + * @returns 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 + */ + (value: any, other: any): boolean; +} +interface IsEqualWith1x2 { + /** + * 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]). + * + * @category Lang + * @param value The value to compare. + * @param other The other value to compare. + * @param [customizer] The function to customize comparisons. + * @returns 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 + */ + (): IsEqualWith1x2; + /** + * 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]). + * + * @category Lang + * @param value The value to compare. + * @param other The other value to compare. + * @param [customizer] The function to customize comparisons. + * @returns 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 + */ + (other: any): boolean; +} + +declare const isEqualWith: IsEqualWith; +export = isEqualWith; diff --git a/types/lodash/fp/isError.d.ts b/types/lodash/fp/isError.d.ts new file mode 100644 index 0000000000..6c6f429fdf --- /dev/null +++ b/types/lodash/fp/isError.d.ts @@ -0,0 +1,16 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type IsError = + /** + * 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. + */ + (value: any) => value is Error; + +declare const isError: IsError; +export = isError; diff --git a/types/lodash/fp/isFinite.d.ts b/types/lodash/fp/isFinite.d.ts new file mode 100644 index 0000000000..544f4c3fd5 --- /dev/null +++ b/types/lodash/fp/isFinite.d.ts @@ -0,0 +1,17 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type IsFinite = + /** + * 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. + */ + (value: any) => boolean; + +declare const isFinite: IsFinite; +export = isFinite; diff --git a/types/lodash/fp/isFunction.d.ts b/types/lodash/fp/isFunction.d.ts new file mode 100644 index 0000000000..7a85054a1f --- /dev/null +++ b/types/lodash/fp/isFunction.d.ts @@ -0,0 +1,15 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type IsFunction = + /** + * Checks if value is a callable function. + * + * @param value The value to check. + * @return Returns true if value is correctly classified, else false. + */ + (value: any) => value is (...args: any[]) => any; + +declare const isFunction: IsFunction; +export = isFunction; diff --git a/types/lodash/fp/isInteger.d.ts b/types/lodash/fp/isInteger.d.ts new file mode 100644 index 0000000000..d04a6f5cce --- /dev/null +++ b/types/lodash/fp/isInteger.d.ts @@ -0,0 +1,31 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type IsInteger = + /** + * Checks if `value` is an integer. + * + * **Note:** This method is based on [`Number.isInteger`](https://mdn.io/Number/isInteger). + * + * @category Lang + * @param value The value to check. + * @returns Returns `true` if `value` is an integer, else `false`. + * @example + * + * _.isInteger(3); + * // => true + * + * _.isInteger(Number.MIN_VALUE); + * // => false + * + * _.isInteger(Infinity); + * // => false + * + * _.isInteger('3'); + * // => false + */ + (value: any) => boolean; + +declare const isInteger: IsInteger; +export = isInteger; diff --git a/types/lodash/fp/isLength.d.ts b/types/lodash/fp/isLength.d.ts new file mode 100644 index 0000000000..a48a867820 --- /dev/null +++ b/types/lodash/fp/isLength.d.ts @@ -0,0 +1,31 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type IsLength = + /** + * 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). + * + * @category Lang + * @param value The value to check. + * @returns 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 + */ + (value: any) => boolean; + +declare const isLength: IsLength; +export = isLength; diff --git a/types/lodash/fp/isMap.d.ts b/types/lodash/fp/isMap.d.ts new file mode 100644 index 0000000000..940cb8a4ad --- /dev/null +++ b/types/lodash/fp/isMap.d.ts @@ -0,0 +1,15 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type IsMap = + /** + * Checks if value is classified as a Map object. + * + * @param value The value to check. + * @returns Returns true if value is correctly classified, else false. + */ + (value: any) => value is Map; + +declare const isMap: IsMap; +export = isMap; diff --git a/types/lodash/fp/isMatch.d.ts b/types/lodash/fp/isMatch.d.ts new file mode 100644 index 0000000000..231362c358 --- /dev/null +++ b/types/lodash/fp/isMatch.d.ts @@ -0,0 +1,116 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface IsMatch { + /** + * 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`. + * + * @category Lang + * @param object The object to inspect. + * @param source The object of property values to match. + * @returns 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; + /** + * 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`. + * + * @category Lang + * @param object The object to inspect. + * @param source The object of property values to match. + * @returns 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 + */ + (source: object): IsMatch1x1; + /** + * 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`. + * + * @category Lang + * @param object The object to inspect. + * @param source The object of property values to match. + * @returns 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 + */ + (source: object, object: object): boolean; +} +interface IsMatch1x1 { + /** + * 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`. + * + * @category Lang + * @param object The object to inspect. + * @param source The object of property values to match. + * @returns 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 + */ + (): IsMatch1x1; + /** + * 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`. + * + * @category Lang + * @param object The object to inspect. + * @param source The object of property values to match. + * @returns 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 + */ + (object: object): boolean; +} + +declare const isMatch: IsMatch; +export = isMatch; diff --git a/types/lodash/fp/isMatchWith.d.ts b/types/lodash/fp/isMatchWith.d.ts new file mode 100644 index 0000000000..5345ad3863 --- /dev/null +++ b/types/lodash/fp/isMatchWith.d.ts @@ -0,0 +1,285 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface IsMatchWith { + /** + * 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). + * + * @category Lang + * @param object The object to inspect. + * @param source The object of property values to match. + * @param [customizer] The function to customize comparisons. + * @returns 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; + /** + * 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). + * + * @category Lang + * @param object The object to inspect. + * @param source The object of property values to match. + * @param [customizer] The function to customize comparisons. + * @returns 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 + */ + (customizer: _.isMatchWithCustomizer): IsMatchWith1x1; + /** + * 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). + * + * @category Lang + * @param object The object to inspect. + * @param source The object of property values to match. + * @param [customizer] The function to customize comparisons. + * @returns 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 + */ + (customizer: _.isMatchWithCustomizer, source: object): IsMatchWith1x2; + /** + * 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). + * + * @category Lang + * @param object The object to inspect. + * @param source The object of property values to match. + * @param [customizer] The function to customize comparisons. + * @returns 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 + */ + (customizer: _.isMatchWithCustomizer, source: object, object: object): boolean; +} +interface IsMatchWith1x1 { + /** + * 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). + * + * @category Lang + * @param object The object to inspect. + * @param source The object of property values to match. + * @param [customizer] The function to customize comparisons. + * @returns 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 + */ + (): IsMatchWith1x1; + /** + * 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). + * + * @category Lang + * @param object The object to inspect. + * @param source The object of property values to match. + * @param [customizer] The function to customize comparisons. + * @returns 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 + */ + (source: object): IsMatchWith1x2; + /** + * 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). + * + * @category Lang + * @param object The object to inspect. + * @param source The object of property values to match. + * @param [customizer] The function to customize comparisons. + * @returns 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 + */ + (source: object, object: object): boolean; +} +interface IsMatchWith1x2 { + /** + * 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). + * + * @category Lang + * @param object The object to inspect. + * @param source The object of property values to match. + * @param [customizer] The function to customize comparisons. + * @returns 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 + */ + (): IsMatchWith1x2; + /** + * 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). + * + * @category Lang + * @param object The object to inspect. + * @param source The object of property values to match. + * @param [customizer] The function to customize comparisons. + * @returns 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 + */ + (object: object): boolean; +} + +declare const isMatchWith: IsMatchWith; +export = isMatchWith; diff --git a/types/lodash/fp/isNaN.d.ts b/types/lodash/fp/isNaN.d.ts new file mode 100644 index 0000000000..f227cd2061 --- /dev/null +++ b/types/lodash/fp/isNaN.d.ts @@ -0,0 +1,17 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type IsNaN = + /** + * 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. + */ + (value: any) => boolean; + +declare const isNaN: IsNaN; +export = isNaN; diff --git a/types/lodash/fp/isNative.d.ts b/types/lodash/fp/isNative.d.ts new file mode 100644 index 0000000000..9dd6543388 --- /dev/null +++ b/types/lodash/fp/isNative.d.ts @@ -0,0 +1,15 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type IsNative = + /** + * Checks if value is a native function. + * @param value The value to check. + * + * @retrun Returns true if value is a native function, else false. + */ + (value: any) => value is (...args: any[]) => any; + +declare const isNative: IsNative; +export = isNative; diff --git a/types/lodash/fp/isNil.d.ts b/types/lodash/fp/isNil.d.ts new file mode 100644 index 0000000000..07005f1fa1 --- /dev/null +++ b/types/lodash/fp/isNil.d.ts @@ -0,0 +1,26 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type IsNil = + /** + * Checks if `value` is `null` or `undefined`. + * + * @category Lang + * @param value The value to check. + * @returns Returns `true` if `value` is nullish, else `false`. + * @example + * + * _.isNil(null); + * // => true + * + * _.isNil(void 0); + * // => true + * + * _.isNil(NaN); + * // => false + */ + (value: any) => value is null | undefined; + +declare const isNil: IsNil; +export = isNil; diff --git a/types/lodash/fp/isNull.d.ts b/types/lodash/fp/isNull.d.ts new file mode 100644 index 0000000000..b1d5b53e0b --- /dev/null +++ b/types/lodash/fp/isNull.d.ts @@ -0,0 +1,15 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type IsNull = + /** + * Checks if value is null. + * + * @param value The value to check. + * @return Returns true if value is null, else false. + */ + (value: any) => value is null; + +declare const isNull: IsNull; +export = isNull; diff --git a/types/lodash/fp/isNumber.d.ts b/types/lodash/fp/isNumber.d.ts new file mode 100644 index 0000000000..fda5cca1b8 --- /dev/null +++ b/types/lodash/fp/isNumber.d.ts @@ -0,0 +1,17 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type IsNumber = + /** + * 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. + */ + (value: any) => value is number; + +declare const isNumber: IsNumber; +export = isNumber; diff --git a/types/lodash/fp/isObject.d.ts b/types/lodash/fp/isObject.d.ts new file mode 100644 index 0000000000..9f55786107 --- /dev/null +++ b/types/lodash/fp/isObject.d.ts @@ -0,0 +1,16 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type IsObject = + /** + * 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. + */ + (value: any) => boolean; + +declare const isObject: IsObject; +export = isObject; diff --git a/types/lodash/fp/isObjectLike.d.ts b/types/lodash/fp/isObjectLike.d.ts new file mode 100644 index 0000000000..17fc948a2d --- /dev/null +++ b/types/lodash/fp/isObjectLike.d.ts @@ -0,0 +1,30 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type IsObjectLike = + /** + * Checks if `value` is object-like. A value is object-like if it's not `null` + * and has a `typeof` result of "object". + * + * @category Lang + * @param value The value to check. + * @returns Returns `true` if `value` is object-like, else `false`. + * @example + * + * _.isObjectLike({}); + * // => true + * + * _.isObjectLike([1, 2, 3]); + * // => true + * + * _.isObjectLike(_.noop); + * // => false + * + * _.isObjectLike(null); + * // => false + */ + (value: any) => boolean; + +declare const isObjectLike: IsObjectLike; +export = isObjectLike; diff --git a/types/lodash/fp/isPlainObject.d.ts b/types/lodash/fp/isPlainObject.d.ts new file mode 100644 index 0000000000..e4cadb9806 --- /dev/null +++ b/types/lodash/fp/isPlainObject.d.ts @@ -0,0 +1,18 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type IsPlainObject = + /** + * 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. + */ + (value: any) => boolean; + +declare const isPlainObject: IsPlainObject; +export = isPlainObject; diff --git a/types/lodash/fp/isRegExp.d.ts b/types/lodash/fp/isRegExp.d.ts new file mode 100644 index 0000000000..98adef2e36 --- /dev/null +++ b/types/lodash/fp/isRegExp.d.ts @@ -0,0 +1,15 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type IsRegExp = + /** + * 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. + */ + (value: any) => value is RegExp; + +declare const isRegExp: IsRegExp; +export = isRegExp; diff --git a/types/lodash/fp/isSafeInteger.d.ts b/types/lodash/fp/isSafeInteger.d.ts new file mode 100644 index 0000000000..60d49e1be8 --- /dev/null +++ b/types/lodash/fp/isSafeInteger.d.ts @@ -0,0 +1,32 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type IsSafeInteger = + /** + * 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). + * + * @category Lang + * @param value The value to check. + * @returns 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 + */ + (value: any) => boolean; + +declare const isSafeInteger: IsSafeInteger; +export = isSafeInteger; diff --git a/types/lodash/fp/isSet.d.ts b/types/lodash/fp/isSet.d.ts new file mode 100644 index 0000000000..7be7de7600 --- /dev/null +++ b/types/lodash/fp/isSet.d.ts @@ -0,0 +1,15 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type IsSet = + /** + * Checks if value is classified as a Set object. + * + * @param value The value to check. + * @returns Returns true if value is correctly classified, else false. + */ + (value: any) => value is Set; + +declare const isSet: IsSet; +export = isSet; diff --git a/types/lodash/fp/isString.d.ts b/types/lodash/fp/isString.d.ts new file mode 100644 index 0000000000..fea109178e --- /dev/null +++ b/types/lodash/fp/isString.d.ts @@ -0,0 +1,15 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type IsString = + /** + * 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. + */ + (value: any) => value is string; + +declare const isString: IsString; +export = isString; diff --git a/types/lodash/fp/isSymbol.d.ts b/types/lodash/fp/isSymbol.d.ts new file mode 100644 index 0000000000..fe30bad576 --- /dev/null +++ b/types/lodash/fp/isSymbol.d.ts @@ -0,0 +1,23 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type IsSymbol = + /** + * Checks if `value` is classified as a `Symbol` primitive or object. + * + * @category Lang + * @param value The value to check. + * @returns Returns `true` if `value` is correctly classified, else `false`. + * @example + * + * _.isSymbol(Symbol.iterator); + * // => true + * + * _.isSymbol('abc'); + * // => false + */ + (value: any) => boolean; + +declare const isSymbol: IsSymbol; +export = isSymbol; diff --git a/types/lodash/fp/isTypedArray.d.ts b/types/lodash/fp/isTypedArray.d.ts new file mode 100644 index 0000000000..076fb84e05 --- /dev/null +++ b/types/lodash/fp/isTypedArray.d.ts @@ -0,0 +1,15 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type IsTypedArray = + /** + * 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. + */ + (value: any) => boolean; + +declare const isTypedArray: IsTypedArray; +export = isTypedArray; diff --git a/types/lodash/fp/isUndefined.d.ts b/types/lodash/fp/isUndefined.d.ts new file mode 100644 index 0000000000..3980dd5742 --- /dev/null +++ b/types/lodash/fp/isUndefined.d.ts @@ -0,0 +1,15 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type IsUndefined = + /** + * Checks if value is undefined. + * + * @param value The value to check. + * @return Returns true if value is undefined, else false. + */ + (value: any) => value is undefined; + +declare const isUndefined: IsUndefined; +export = isUndefined; diff --git a/types/lodash/fp/isWeakMap.d.ts b/types/lodash/fp/isWeakMap.d.ts new file mode 100644 index 0000000000..9edb2fbb71 --- /dev/null +++ b/types/lodash/fp/isWeakMap.d.ts @@ -0,0 +1,15 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type IsWeakMap = + /** + * Checks if value is classified as a WeakMap object. + * + * @param value The value to check. + * @returns Returns true if value is correctly classified, else false. + */ + (value: any) => value is WeakMap; + +declare const isWeakMap: IsWeakMap; +export = isWeakMap; diff --git a/types/lodash/fp/isWeakSet.d.ts b/types/lodash/fp/isWeakSet.d.ts new file mode 100644 index 0000000000..cf7bd7cf01 --- /dev/null +++ b/types/lodash/fp/isWeakSet.d.ts @@ -0,0 +1,15 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type IsWeakSet = + /** + * Checks if value is classified as a WeakSet object. + * + * @param value The value to check. + * @returns Returns true if value is correctly classified, else false. + */ + (value: any) => value is WeakSet; + +declare const isWeakSet: IsWeakSet; +export = isWeakSet; diff --git a/types/lodash/fp/iteratee.d.ts b/types/lodash/fp/iteratee.d.ts new file mode 100644 index 0000000000..669d1d92d5 --- /dev/null +++ b/types/lodash/fp/iteratee.d.ts @@ -0,0 +1,65 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface Iteratee { + /** + * 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`. + * + * @category Util + * @param [func=_.identity] The value to convert to a callback. + * @returns 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 }] + */ + any>(func: TFunction): TFunction; + /** + * 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`. + * + * @category Util + * @param [func=_.identity] The value to convert to a callback. + * @returns 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 }] + */ + (func: string | object): (...args: any[]) => any; +} + +declare const iteratee: Iteratee; +export = iteratee; diff --git a/types/lodash/fp/join.d.ts b/types/lodash/fp/join.d.ts new file mode 100644 index 0000000000..7b678d0738 --- /dev/null +++ b/types/lodash/fp/join.d.ts @@ -0,0 +1,53 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Join { + /** + * Converts all elements in `array` into a string separated by `separator`. + * + * @param array The array to convert. + * @param separator The element separator. + * @returns Returns the joined string. + */ + (): Join; + /** + * Converts all elements in `array` into a string separated by `separator`. + * + * @param array The array to convert. + * @param separator The element separator. + * @returns Returns the joined string. + */ + (separator: string): Join1x1; + /** + * Converts all elements in `array` into a string separated by `separator`. + * + * @param array The array to convert. + * @param separator The element separator. + * @returns Returns the joined string. + */ + (separator: string, array: _.List | null | undefined): string; +} +interface Join1x1 { + /** + * Converts all elements in `array` into a string separated by `separator`. + * + * @param array The array to convert. + * @param separator The element separator. + * @returns Returns the joined string. + */ + (): Join1x1; + /** + * Converts all elements in `array` into a string separated by `separator`. + * + * @param array The array to convert. + * @param separator The element separator. + * @returns Returns the joined string. + */ + (array: _.List | null | undefined): string; +} + +declare const join: Join; +export = join; diff --git a/types/lodash/fp/juxt.d.ts b/types/lodash/fp/juxt.d.ts new file mode 100644 index 0000000000..9131ad7914 --- /dev/null +++ b/types/lodash/fp/juxt.d.ts @@ -0,0 +1,18 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +type Over = + /** + * Creates a function that invokes iteratees with the arguments provided to the created function and returns + * their results. + * + * @param iteratees The iteratees to invoke. + * @return Returns the new function. + */ + (iteratees: _.Many<(...args: any[]) => TResult>) => (...args: any[]) => TResult[]; + +declare const juxt: Over; +export = juxt; diff --git a/types/lodash/fp/kebabCase.d.ts b/types/lodash/fp/kebabCase.d.ts new file mode 100644 index 0000000000..6a46ada134 --- /dev/null +++ b/types/lodash/fp/kebabCase.d.ts @@ -0,0 +1,15 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type KebabCase = + /** + * Converts string to kebab case. + * + * @param string The string to convert. + * @return Returns the kebab cased string. + */ + (string: string) => string; + +declare const kebabCase: KebabCase; +export = kebabCase; diff --git a/types/lodash/fp/keyBy.d.ts b/types/lodash/fp/keyBy.d.ts new file mode 100644 index 0000000000..d9ebba52bf --- /dev/null +++ b/types/lodash/fp/keyBy.d.ts @@ -0,0 +1,225 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface KeyBy { + /** + * 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. + */ + (): KeyBy; + /** + * 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. + */ + (iteratee: (value: string) => _.PropertyName): KeyBy1x1; + /** + * 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. + */ + (iteratee: (value: string) => _.PropertyName, collection: string | null | undefined): _.Dictionary; + /** + * 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. + */ + (iteratee: _.ValueIterateeCustom): KeyBy2x1; + /** + * 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. + */ + (iteratee: _.ValueIterateeCustom, collection: _.List | null | undefined): _.Dictionary; + /** + * 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. + */ + (iteratee: _.ValueIterateeCustom, collection: T | null | undefined): _.Dictionary; +} +interface KeyBy1x1 { + /** + * 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. + */ + (): KeyBy1x1; + /** + * 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. + */ + (collection: string | null | undefined): _.Dictionary; +} +interface KeyBy2x1 { + /** + * 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. + */ + (): KeyBy2x1; + /** + * 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. + */ + (collection: _.List | object | null | undefined): _.Dictionary; +} + +declare const keyBy: KeyBy; +export = keyBy; diff --git a/types/lodash/fp/keys.d.ts b/types/lodash/fp/keys.d.ts new file mode 100644 index 0000000000..0cfa0ac21e --- /dev/null +++ b/types/lodash/fp/keys.d.ts @@ -0,0 +1,17 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type Keys = + /** + * 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. + */ + (object: any) => string[]; + +declare const keys: Keys; +export = keys; diff --git a/types/lodash/fp/keysIn.d.ts b/types/lodash/fp/keysIn.d.ts new file mode 100644 index 0000000000..827f1edbaa --- /dev/null +++ b/types/lodash/fp/keysIn.d.ts @@ -0,0 +1,17 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type KeysIn = + /** + * 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. + */ + (object: any) => string[]; + +declare const keysIn: KeysIn; +export = keysIn; diff --git a/types/lodash/fp/last.d.ts b/types/lodash/fp/last.d.ts new file mode 100644 index 0000000000..4473a221f9 --- /dev/null +++ b/types/lodash/fp/last.d.ts @@ -0,0 +1,17 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +type Last = + /** + * Gets the last element of array. + * + * @param array The array to query. + * @return Returns the last element of array. + */ + (array: _.List | null | undefined) => T | undefined; + +declare const last: Last; +export = last; diff --git a/types/lodash/fp/lastIndexOf.d.ts b/types/lodash/fp/lastIndexOf.d.ts new file mode 100644 index 0000000000..a21af0a596 --- /dev/null +++ b/types/lodash/fp/lastIndexOf.d.ts @@ -0,0 +1,58 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface LastIndexOf { + /** + * 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; + /** + * 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. + */ + (value: T): LastIndexOf1x1; + /** + * 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. + */ + (value: T, array: _.List | null | undefined): number; +} +interface LastIndexOf1x1 { + /** + * 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. + */ + (): LastIndexOf1x1; + /** + * 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. + */ + (array: _.List | null | undefined): number; +} + +declare const lastIndexOf: LastIndexOf; +export = lastIndexOf; diff --git a/types/lodash/fp/lastIndexOfFrom.d.ts b/types/lodash/fp/lastIndexOfFrom.d.ts new file mode 100644 index 0000000000..0bea8e22c7 --- /dev/null +++ b/types/lodash/fp/lastIndexOfFrom.d.ts @@ -0,0 +1,96 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface LastIndexOf { + /** + * 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; + /** + * 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. + */ + (value: T): LastIndexOf1x1; + /** + * 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. + */ + (value: T, fromIndex: true|number): LastIndexOf1x2; + /** + * 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. + */ + (value: T, fromIndex: true|number, array: _.List | null | undefined): number; +} +interface LastIndexOf1x1 { + /** + * 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. + */ + (): LastIndexOf1x1; + /** + * 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. + */ + (fromIndex: true|number): LastIndexOf1x2; + /** + * 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. + */ + (fromIndex: true|number, array: _.List | null | undefined): number; +} +interface LastIndexOf1x2 { + /** + * 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. + */ + (): LastIndexOf1x2; + /** + * 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. + */ + (array: _.List | null | undefined): number; +} + +declare const lastIndexOfFrom: LastIndexOf; +export = lastIndexOfFrom; diff --git a/types/lodash/fp/lowerCase.d.ts b/types/lodash/fp/lowerCase.d.ts new file mode 100644 index 0000000000..628744e48b --- /dev/null +++ b/types/lodash/fp/lowerCase.d.ts @@ -0,0 +1,15 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type LowerCase = + /** + * Converts `string`, as space separated words, to lower case. + * + * @param string The string to convert. + * @return Returns the lower cased string. + */ + (string: string) => string; + +declare const lowerCase: LowerCase; +export = lowerCase; diff --git a/types/lodash/fp/lowerFirst.d.ts b/types/lodash/fp/lowerFirst.d.ts new file mode 100644 index 0000000000..a88e572706 --- /dev/null +++ b/types/lodash/fp/lowerFirst.d.ts @@ -0,0 +1,15 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type LowerFirst = + /** + * Converts the first character of `string` to lower case. + * + * @param string The string to convert. + * @return Returns the converted string. + */ + (string: string) => string; + +declare const lowerFirst: LowerFirst; +export = lowerFirst; diff --git a/types/lodash/fp/lt.d.ts b/types/lodash/fp/lt.d.ts new file mode 100644 index 0000000000..8259c6d845 --- /dev/null +++ b/types/lodash/fp/lt.d.ts @@ -0,0 +1,51 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface Lt { + /** + * 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; + /** + * 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. + */ + (value: any): Lt1x1; + /** + * 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. + */ + (value: any, other: any): boolean; +} +interface Lt1x1 { + /** + * 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. + */ + (): Lt1x1; + /** + * 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. + */ + (other: any): boolean; +} + +declare const lt: Lt; +export = lt; diff --git a/types/lodash/fp/lte.d.ts b/types/lodash/fp/lte.d.ts new file mode 100644 index 0000000000..e3ac6503f7 --- /dev/null +++ b/types/lodash/fp/lte.d.ts @@ -0,0 +1,51 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface Lte { + /** + * 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; + /** + * 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. + */ + (value: any): Lte1x1; + /** + * 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. + */ + (value: any, other: any): boolean; +} +interface Lte1x1 { + /** + * 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. + */ + (): Lte1x1; + /** + * 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. + */ + (other: any): boolean; +} + +declare const lte: Lte; +export = lte; diff --git a/types/lodash/fp/map.d.ts b/types/lodash/fp/map.d.ts new file mode 100644 index 0000000000..900e11d0d0 --- /dev/null +++ b/types/lodash/fp/map.d.ts @@ -0,0 +1,588 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Map { + /** + * 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 + * + * @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; + /** + * 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 + * + * @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. + */ + (iteratee: (value: T) => TResult): Map1x1; + /** + * 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 + * + * @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. + */ + (iteratee: (value: T) => TResult, collection: T[] | _.List | null | undefined): TResult[]; + /** + * 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 + * + * @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. + */ + (iteratee: (value: T[keyof T]) => TResult): Map3x1; + /** + * 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 + * + * @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. + */ + (iteratee: (value: T[keyof T]) => TResult, collection: T | null | undefined): TResult[]; + /** + * 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 + * + * @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. + */ + (iteratee: K): Map4x1; + /** + * 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 + * + * @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. + */ + (iteratee: K, collection: _.List | _.Dictionary | _.NumericDictionary | null | undefined): Array; + /** + * 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 + * + * @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. + */ + (iteratee: string): Map5x1; + /** + * 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 + * + * @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. + */ + (iteratee: string, collection: _.List | _.Dictionary | _.NumericDictionary | null | undefined): any[]; + /** + * 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 + * + * @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. + */ + (iteratee: object): Map6x1; + /** + * 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 + * + * @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. + */ + (iteratee: object, collection: _.List | _.Dictionary | _.NumericDictionary | null | undefined): boolean[]; +} +interface Map1x1 { + /** + * 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 + * + * @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. + */ + (): Map1x1; + /** + * 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 + * + * @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. + */ + (collection: T[] | _.List | null | undefined): TResult[]; +} +interface Map3x1 { + /** + * 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 + * + * @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. + */ + (): Map3x1; + /** + * 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 + * + * @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. + */ + (collection: T | null | undefined): TResult[]; +} +interface Map4x1 { + /** + * 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 + * + * @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. + */ + (): Map4x1; + /** + * 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 + * + * @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. + */ + (collection: _.List | _.Dictionary | _.NumericDictionary | null | undefined): Array; +} +interface Map5x1 { + /** + * 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 + * + * @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. + */ + (): Map5x1; + /** + * 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 + * + * @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. + */ + (collection: _.List | _.Dictionary | _.NumericDictionary | null | undefined): any[]; +} +interface Map6x1 { + /** + * 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 + * + * @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. + */ + (): Map6x1; + /** + * 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 + * + * @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. + */ + (collection: _.List | _.Dictionary | _.NumericDictionary | null | undefined): boolean[]; +} + +declare const map: Map; +export = map; diff --git a/types/lodash/fp/mapKeys.d.ts b/types/lodash/fp/mapKeys.d.ts new file mode 100644 index 0000000000..348fdff591 --- /dev/null +++ b/types/lodash/fp/mapKeys.d.ts @@ -0,0 +1,105 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface MapKeys { + /** + * 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; + /** + * 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. + */ + (iteratee: _.ValueIteratee): MapKeys1x1; + /** + * 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. + */ + (iteratee: _.ValueIteratee, object: _.List | null | undefined): _.Dictionary; + /** + * 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. + */ + (iteratee: _.ValueIteratee): MapKeys2x1; + /** + * 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. + */ + (iteratee: _.ValueIteratee, object: T | null | undefined): _.Dictionary; +} +interface MapKeys1x1 { + /** + * 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. + */ + (): MapKeys1x1; + /** + * 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. + */ + (object: _.List | null | undefined): _.Dictionary; +} +interface MapKeys2x1 { + /** + * 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. + */ + (): MapKeys2x1; + /** + * 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. + */ + (object: T | null | undefined): _.Dictionary; +} + +declare const mapKeys: MapKeys; +export = mapKeys; diff --git a/types/lodash/fp/mapValues.d.ts b/types/lodash/fp/mapValues.d.ts new file mode 100644 index 0000000000..ce44dda737 --- /dev/null +++ b/types/lodash/fp/mapValues.d.ts @@ -0,0 +1,603 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface MapValues { + /** + * 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 The object to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [thisArg] The `this` binding of `iteratee`. + * @return Returns the new mapped object. + */ + (): MapValues; + /** + * 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 The object to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [thisArg] The `this` binding of `iteratee`. + * @return Returns the new mapped object. + */ + (callback: (value: string) => TResult): MapValues1x1; + /** + * 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 The object to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [thisArg] The `this` binding of `iteratee`. + * @return Returns the new mapped object. + */ + (callback: (value: string) => TResult, obj: string | null | undefined): _.NumericDictionary; + /** + * 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 The object to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [thisArg] The `this` binding of `iteratee`. + * @return Returns the new mapped object. + */ + (callback: (value: T) => TResult): MapValues2x1; + /** + * 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 The object to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [thisArg] The `this` binding of `iteratee`. + * @return Returns the new mapped object. + */ + (callback: (value: T) => TResult, obj: _.Dictionary | _.NumericDictionary | null | undefined): _.Dictionary; + /** + * 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 The object to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [thisArg] The `this` binding of `iteratee`. + * @return Returns the new mapped object. + */ + (callback: (value: T[keyof T]) => TResult): MapValues3x1; + /** + * 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 The object to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [thisArg] The `this` binding of `iteratee`. + * @return Returns the new mapped object. + */ + (callback: (value: T[keyof T]) => TResult, obj: T | null | undefined): { [P in keyof T]: TResult }; + /** + * 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 The object to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [thisArg] The `this` binding of `iteratee`. + * @return Returns the new mapped object. + */ + (iteratee: object): MapValues4x1; + /** + * 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 The object to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [thisArg] The `this` binding of `iteratee`. + * @return Returns the new mapped object. + */ + (iteratee: object, obj: _.Dictionary | _.NumericDictionary | null | undefined): _.Dictionary; + /** + * 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 The object to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [thisArg] The `this` binding of `iteratee`. + * @return Returns the new mapped object. + */ + (iteratee: object, obj: T | null | undefined): { [P in keyof T]: boolean }; + /** + * 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 The object to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [thisArg] The `this` binding of `iteratee`. + * @return Returns the new mapped object. + */ + (iteratee: TKey): MapValues6x1; + /** + * 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 The object to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [thisArg] The `this` binding of `iteratee`. + * @return Returns the new mapped object. + */ + (iteratee: TKey, obj: _.Dictionary | _.NumericDictionary | null | undefined): _.Dictionary; + /** + * 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 The object to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [thisArg] The `this` binding of `iteratee`. + * @return Returns the new mapped object. + */ + (iteratee: string): MapValues7x1; + /** + * 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 The object to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [thisArg] The `this` binding of `iteratee`. + * @return Returns the new mapped object. + */ + (iteratee: string, obj: _.Dictionary | _.NumericDictionary | null | undefined): _.Dictionary; + /** + * 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 The object to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [thisArg] The `this` binding of `iteratee`. + * @return Returns the new mapped object. + */ + (iteratee: string, obj: T | null | undefined): { [P in keyof T]: any }; +} +interface MapValues1x1 { + /** + * 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 The object to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [thisArg] The `this` binding of `iteratee`. + * @return Returns the new mapped object. + */ + (): MapValues1x1; + /** + * 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 The object to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [thisArg] The `this` binding of `iteratee`. + * @return Returns the new mapped object. + */ + (obj: string | null | undefined): _.NumericDictionary; +} +interface MapValues2x1 { + /** + * 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 The object to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [thisArg] The `this` binding of `iteratee`. + * @return Returns the new mapped object. + */ + (): MapValues2x1; + /** + * 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 The object to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [thisArg] The `this` binding of `iteratee`. + * @return Returns the new mapped object. + */ + (obj: _.Dictionary | _.NumericDictionary | null | undefined): _.Dictionary; +} +interface MapValues3x1 { + /** + * 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 The object to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [thisArg] The `this` binding of `iteratee`. + * @return Returns the new mapped object. + */ + (): MapValues3x1; + /** + * 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 The object to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [thisArg] The `this` binding of `iteratee`. + * @return Returns the new mapped object. + */ + (obj: T | null | undefined): { [P in keyof T]: TResult }; +} +interface MapValues4x1 { + /** + * 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 The object to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [thisArg] The `this` binding of `iteratee`. + * @return Returns the new mapped object. + */ + (): MapValues4x1; + /** + * 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 The object to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [thisArg] The `this` binding of `iteratee`. + * @return Returns the new mapped object. + */ + (obj: _.Dictionary | _.NumericDictionary | null | undefined): _.Dictionary; + /** + * 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 The object to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [thisArg] The `this` binding of `iteratee`. + * @return Returns the new mapped object. + */ + (obj: T | null | undefined): { [P in keyof T]: boolean }; +} +interface MapValues6x1 { + /** + * 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 The object to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [thisArg] The `this` binding of `iteratee`. + * @return Returns the new mapped object. + */ + (): MapValues6x1; + /** + * 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 The object to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [thisArg] The `this` binding of `iteratee`. + * @return Returns the new mapped object. + */ + (obj: _.Dictionary | _.NumericDictionary | null | undefined): _.Dictionary; +} +interface MapValues7x1 { + /** + * 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 The object to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [thisArg] The `this` binding of `iteratee`. + * @return Returns the new mapped object. + */ + (): MapValues7x1; + /** + * 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 The object to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [thisArg] The `this` binding of `iteratee`. + * @return Returns the new mapped object. + */ + (obj: _.Dictionary | _.NumericDictionary | null | undefined): _.Dictionary; + /** + * 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 The object to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [thisArg] The `this` binding of `iteratee`. + * @return Returns the new mapped object. + */ + (obj: T | null | undefined): { [P in keyof T]: any }; +} + +declare const mapValues: MapValues; +export = mapValues; diff --git a/types/lodash/fp/matches.d.ts b/types/lodash/fp/matches.d.ts new file mode 100644 index 0000000000..e197d6b711 --- /dev/null +++ b/types/lodash/fp/matches.d.ts @@ -0,0 +1,116 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface IsMatch { + /** + * 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`. + * + * @category Lang + * @param object The object to inspect. + * @param source The object of property values to match. + * @returns 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; + /** + * 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`. + * + * @category Lang + * @param object The object to inspect. + * @param source The object of property values to match. + * @returns 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 + */ + (source: object): IsMatch1x1; + /** + * 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`. + * + * @category Lang + * @param object The object to inspect. + * @param source The object of property values to match. + * @returns 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 + */ + (source: object, object: object): boolean; +} +interface IsMatch1x1 { + /** + * 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`. + * + * @category Lang + * @param object The object to inspect. + * @param source The object of property values to match. + * @returns 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 + */ + (): IsMatch1x1; + /** + * 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`. + * + * @category Lang + * @param object The object to inspect. + * @param source The object of property values to match. + * @returns 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 + */ + (object: object): boolean; +} + +declare const matches: IsMatch; +export = matches; diff --git a/types/lodash/fp/matchesProperty.d.ts b/types/lodash/fp/matchesProperty.d.ts new file mode 100644 index 0000000000..8fec785733 --- /dev/null +++ b/types/lodash/fp/matchesProperty.d.ts @@ -0,0 +1,90 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface MatchesProperty { + /** + * 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; + /** + * 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. + */ + (path: _.PropertyPath): MatchesProperty1x1; + /** + * 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. + */ + (path: _.PropertyPath, srcValue: T): (value: any) => boolean; + /** + * 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. + */ + (path: _.PropertyPath, srcValue: T): (value: V) => boolean; +} +interface MatchesProperty1x1 { + /** + * 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. + */ + (): MatchesProperty1x1; + /** + * 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. + */ + (srcValue: T): (value: any) => boolean; + /** + * 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. + */ + (srcValue: T): (value: V) => boolean; +} + +declare const matchesProperty: MatchesProperty; +export = matchesProperty; diff --git a/types/lodash/fp/max.d.ts b/types/lodash/fp/max.d.ts new file mode 100644 index 0000000000..138dba542d --- /dev/null +++ b/types/lodash/fp/max.d.ts @@ -0,0 +1,19 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +type Max = + /** + * Computes the maximum value of `array`. If `array` is empty or falsey + * `undefined` is returned. + * + * @category Math + * @param array The array to iterate over. + * @returns Returns the maximum value. + */ + (collection: _.List | null | undefined) => T | undefined; + +declare const max: Max; +export = max; diff --git a/types/lodash/fp/maxBy.d.ts b/types/lodash/fp/maxBy.d.ts new file mode 100644 index 0000000000..44fb2ff7b1 --- /dev/null +++ b/types/lodash/fp/maxBy.d.ts @@ -0,0 +1,118 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface MaxBy { + /** + * 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). + * + * @category Math + * @param array The array to iterate over. + * @param [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; + /** + * 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). + * + * @category Math + * @param array The array to iterate over. + * @param [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 } + */ + (iteratee: _.ValueIteratee): MaxBy1x1; + /** + * 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). + * + * @category Math + * @param array The array to iterate over. + * @param [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 } + */ + (iteratee: _.ValueIteratee, collection: _.List | null | undefined): T | undefined; +} +interface MaxBy1x1 { + /** + * 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). + * + * @category Math + * @param array The array to iterate over. + * @param [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 } + */ + (): MaxBy1x1; + /** + * 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). + * + * @category Math + * @param array The array to iterate over. + * @param [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 } + */ + (collection: _.List | null | undefined): T | undefined; +} + +declare const maxBy: MaxBy; +export = maxBy; diff --git a/types/lodash/fp/mean.d.ts b/types/lodash/fp/mean.d.ts new file mode 100644 index 0000000000..0e37afaeaf --- /dev/null +++ b/types/lodash/fp/mean.d.ts @@ -0,0 +1,22 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +type Mean = + /** + * Computes the mean of the values in `array`. + * + * @category Math + * @param array The array to iterate over. + * @returns Returns the mean. + * @example + * + * _.mean([4, 2, 8, 6]); + * // => 5 + */ + (collection: _.List | null | undefined) => number; + +declare const mean: Mean; +export = mean; diff --git a/types/lodash/fp/meanBy.d.ts b/types/lodash/fp/meanBy.d.ts new file mode 100644 index 0000000000..7ae670a7b5 --- /dev/null +++ b/types/lodash/fp/meanBy.d.ts @@ -0,0 +1,78 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface MeanBy { + /** + * Computes the mean of the provided propties of the objects in the `array` + * + * @category Math + * @param array The array to iterate over. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns the mean. + * @example + * + * _.mean([{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }], 'n'); + * // => 5 + */ + (): MeanBy; + /** + * Computes the mean of the provided propties of the objects in the `array` + * + * @category Math + * @param array The array to iterate over. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns the mean. + * @example + * + * _.mean([{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }], 'n'); + * // => 5 + */ + (iteratee: _.ValueIteratee): MeanBy1x1; + /** + * Computes the mean of the provided propties of the objects in the `array` + * + * @category Math + * @param array The array to iterate over. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns the mean. + * @example + * + * _.mean([{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }], 'n'); + * // => 5 + */ + (iteratee: _.ValueIteratee, collection: _.List | null | undefined): number; +} +interface MeanBy1x1 { + /** + * Computes the mean of the provided propties of the objects in the `array` + * + * @category Math + * @param array The array to iterate over. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns the mean. + * @example + * + * _.mean([{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }], 'n'); + * // => 5 + */ + (): MeanBy1x1; + /** + * Computes the mean of the provided propties of the objects in the `array` + * + * @category Math + * @param array The array to iterate over. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns the mean. + * @example + * + * _.mean([{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }], 'n'); + * // => 5 + */ + (collection: _.List | null | undefined): number; +} + +declare const meanBy: MeanBy; +export = meanBy; diff --git a/types/lodash/fp/memoize.d.ts b/types/lodash/fp/memoize.d.ts new file mode 100644 index 0000000000..c694ae0909 --- /dev/null +++ b/types/lodash/fp/memoize.d.ts @@ -0,0 +1,21 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +type Memoize = + /** + * 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. + */ + any>(func: T) => T & _.MemoizedFunction; + +declare const memoize: Memoize; +export = memoize; diff --git a/types/lodash/fp/merge.d.ts b/types/lodash/fp/merge.d.ts new file mode 100644 index 0000000000..fe05c22488 --- /dev/null +++ b/types/lodash/fp/merge.d.ts @@ -0,0 +1,151 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface Merge { + /** + * 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. + * + * **Note:** This method mutates `object`. + * + * @category Object + * @param object The destination object. + * @param [sources] The source objects. + * @returns 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; + /** + * 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. + * + * **Note:** This method mutates `object`. + * + * @category Object + * @param object The destination object. + * @param [sources] The source objects. + * @returns 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 }] } + */ + (object: TObject): Merge1x1; + /** + * 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. + * + * **Note:** This method mutates `object`. + * + * @category Object + * @param object The destination object. + * @param [sources] The source objects. + * @returns 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 }] } + */ + (object: TObject, source: TSource): TObject & TSource; +} +interface Merge1x1 { + /** + * 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. + * + * **Note:** This method mutates `object`. + * + * @category Object + * @param object The destination object. + * @param [sources] The source objects. + * @returns 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 }] } + */ + (): Merge1x1; + /** + * 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. + * + * **Note:** This method mutates `object`. + * + * @category Object + * @param object The destination object. + * @param [sources] The source objects. + * @returns 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 }] } + */ + (source: TSource): TObject & TSource; +} + +declare const merge: Merge; +export = merge; diff --git a/types/lodash/fp/mergeAll.d.ts b/types/lodash/fp/mergeAll.d.ts new file mode 100644 index 0000000000..350ef6110c --- /dev/null +++ b/types/lodash/fp/mergeAll.d.ts @@ -0,0 +1,36 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type Merge = + /** + * 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. + * + * **Note:** This method mutates `object`. + * + * @category Object + * @param object The destination object. + * @param [sources] The source objects. + * @returns 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 }] } + */ + (object: ReadonlyArray) => any; + +declare const mergeAll: Merge; +export = mergeAll; diff --git a/types/lodash/fp/mergeAllWith.d.ts b/types/lodash/fp/mergeAllWith.d.ts new file mode 100644 index 0000000000..96be3f4db9 --- /dev/null +++ b/types/lodash/fp/mergeAllWith.d.ts @@ -0,0 +1,183 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface MergeWith { + /** + * 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). + * + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param customizer The function to customize assigned values. + * @returns 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; + /** + * 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). + * + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param customizer The function to customize assigned values. + * @returns 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'] } + */ + (customizer: _.MergeWithCustomizer): MergeWith1x1; + /** + * 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). + * + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param customizer The function to customize assigned values. + * @returns 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'] } + */ + (customizer: _.MergeWithCustomizer, args: ReadonlyArray): any; +} +interface MergeWith1x1 { + /** + * 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). + * + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param customizer The function to customize assigned values. + * @returns 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'] } + */ + (): MergeWith1x1; + /** + * 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). + * + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param customizer The function to customize assigned values. + * @returns 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'] } + */ + (args: ReadonlyArray): any; +} + +declare const mergeAllWith: MergeWith; +export = mergeAllWith; diff --git a/types/lodash/fp/mergeWith.d.ts b/types/lodash/fp/mergeWith.d.ts new file mode 100644 index 0000000000..64556114df --- /dev/null +++ b/types/lodash/fp/mergeWith.d.ts @@ -0,0 +1,321 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface MergeWith { + /** + * 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). + * + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param customizer The function to customize assigned values. + * @returns 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; + /** + * 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). + * + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param customizer The function to customize assigned values. + * @returns 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'] } + */ + (customizer: _.MergeWithCustomizer): MergeWith1x1; + /** + * 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). + * + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param customizer The function to customize assigned values. + * @returns 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'] } + */ + (customizer: _.MergeWithCustomizer, object: TObject): MergeWith1x2; + /** + * 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). + * + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param customizer The function to customize assigned values. + * @returns 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'] } + */ + (customizer: _.MergeWithCustomizer, object: TObject, source: TSource): TObject & TSource; +} +interface MergeWith1x1 { + /** + * 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). + * + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param customizer The function to customize assigned values. + * @returns 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'] } + */ + (): MergeWith1x1; + /** + * 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). + * + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param customizer The function to customize assigned values. + * @returns 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'] } + */ + (object: TObject): MergeWith1x2; + /** + * 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). + * + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param customizer The function to customize assigned values. + * @returns 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'] } + */ + (object: TObject, source: TSource): TObject & TSource; +} +interface MergeWith1x2 { + /** + * 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). + * + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param customizer The function to customize assigned values. + * @returns 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'] } + */ + (): MergeWith1x2; + /** + * 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). + * + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param customizer The function to customize assigned values. + * @returns 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'] } + */ + (source: TSource): TObject & TSource; +} + +declare const mergeWith: MergeWith; +export = mergeWith; diff --git a/types/lodash/fp/method.d.ts b/types/lodash/fp/method.d.ts new file mode 100644 index 0000000000..e44efd9f07 --- /dev/null +++ b/types/lodash/fp/method.d.ts @@ -0,0 +1,19 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +type Method = + /** + * 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. + */ + (path: _.PropertyPath) => (object: any) => any; + +declare const method: Method; +export = method; diff --git a/types/lodash/fp/methodOf.d.ts b/types/lodash/fp/methodOf.d.ts new file mode 100644 index 0000000000..6a1a908de7 --- /dev/null +++ b/types/lodash/fp/methodOf.d.ts @@ -0,0 +1,19 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +type MethodOf = + /** + * 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. + */ + (object: object) => (path: _.PropertyPath) => any; + +declare const methodOf: MethodOf; +export = methodOf; diff --git a/types/lodash/fp/min.d.ts b/types/lodash/fp/min.d.ts new file mode 100644 index 0000000000..f637f397ac --- /dev/null +++ b/types/lodash/fp/min.d.ts @@ -0,0 +1,19 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +type Min = + /** + * Computes the minimum value of `array`. If `array` is empty or falsey + * `undefined` is returned. + * + * @category Math + * @param array The array to iterate over. + * @returns Returns the minimum value. + */ + (collection: _.List | null | undefined) => T | undefined; + +declare const min: Min; +export = min; diff --git a/types/lodash/fp/minBy.d.ts b/types/lodash/fp/minBy.d.ts new file mode 100644 index 0000000000..b9bdebecd8 --- /dev/null +++ b/types/lodash/fp/minBy.d.ts @@ -0,0 +1,118 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface MinBy { + /** + * 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). + * + * @category Math + * @param array The array to iterate over. + * @param [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; + /** + * 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). + * + * @category Math + * @param array The array to iterate over. + * @param [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 } + */ + (iteratee: _.ValueIteratee): MinBy1x1; + /** + * 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). + * + * @category Math + * @param array The array to iterate over. + * @param [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 } + */ + (iteratee: _.ValueIteratee, collection: _.List | null | undefined): T | undefined; +} +interface MinBy1x1 { + /** + * 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). + * + * @category Math + * @param array The array to iterate over. + * @param [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 } + */ + (): MinBy1x1; + /** + * 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). + * + * @category Math + * @param array The array to iterate over. + * @param [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 } + */ + (collection: _.List | null | undefined): T | undefined; +} + +declare const minBy: MinBy; +export = minBy; diff --git a/types/lodash/fp/multiply.d.ts b/types/lodash/fp/multiply.d.ts new file mode 100644 index 0000000000..a335372aac --- /dev/null +++ b/types/lodash/fp/multiply.d.ts @@ -0,0 +1,46 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface Multiply { + /** + * Multiply two numbers. + * @param multiplier The first number in a multiplication. + * @param multiplicand The second number in a multiplication. + * @returns Returns the product. + */ + (): Multiply; + /** + * Multiply two numbers. + * @param multiplier The first number in a multiplication. + * @param multiplicand The second number in a multiplication. + * @returns Returns the product. + */ + (multiplier: number): Multiply1x1; + /** + * Multiply two numbers. + * @param multiplier The first number in a multiplication. + * @param multiplicand The second number in a multiplication. + * @returns Returns the product. + */ + (multiplier: number, multiplicand: number): number; +} +interface Multiply1x1 { + /** + * Multiply two numbers. + * @param multiplier The first number in a multiplication. + * @param multiplicand The second number in a multiplication. + * @returns Returns the product. + */ + (): Multiply1x1; + /** + * Multiply two numbers. + * @param multiplier The first number in a multiplication. + * @param multiplicand The second number in a multiplication. + * @returns Returns the product. + */ + (multiplicand: number): number; +} + +declare const multiply: Multiply; +export = multiply; diff --git a/types/lodash/fp/nAry.d.ts b/types/lodash/fp/nAry.d.ts new file mode 100644 index 0000000000..daede14899 --- /dev/null +++ b/types/lodash/fp/nAry.d.ts @@ -0,0 +1,51 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface Ary { + /** + * 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; + /** + * 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. + */ + (n: number): Ary1x1; + /** + * 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. + */ + (n: number, func: (...args: any[]) => any): (...args: any[]) => any; +} +interface Ary1x1 { + /** + * 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. + */ + (): Ary1x1; + /** + * 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. + */ + (func: (...args: any[]) => any): (...args: any[]) => any; +} + +declare const nAry: Ary; +export = nAry; diff --git a/types/lodash/fp/negate.d.ts b/types/lodash/fp/negate.d.ts new file mode 100644 index 0000000000..681c5be961 --- /dev/null +++ b/types/lodash/fp/negate.d.ts @@ -0,0 +1,16 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type Negate = + /** + * 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. + */ + any>(predicate: T) => T; + +declare const negate: Negate; +export = negate; diff --git a/types/lodash/fp/noConflict.d.ts b/types/lodash/fp/noConflict.d.ts new file mode 100644 index 0000000000..2b1a6c71c9 --- /dev/null +++ b/types/lodash/fp/noConflict.d.ts @@ -0,0 +1,16 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +type NoConflict = + /** + * Reverts the _ variable to its previous value and returns a reference to the lodash function. + * + * @return Returns the lodash function. + */ + () => typeof _; + +declare const noConflict: NoConflict; +export = noConflict; diff --git a/types/lodash/fp/noop.d.ts b/types/lodash/fp/noop.d.ts new file mode 100644 index 0000000000..29ce7267ea --- /dev/null +++ b/types/lodash/fp/noop.d.ts @@ -0,0 +1,14 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type Noop = + /** + * A no-operation function that returns undefined regardless of the arguments it receives. + * + * @return undefined + */ + (...args: any[]) => void; + +declare const noop: Noop; +export = noop; diff --git a/types/lodash/fp/now.d.ts b/types/lodash/fp/now.d.ts new file mode 100644 index 0000000000..d450c76116 --- /dev/null +++ b/types/lodash/fp/now.d.ts @@ -0,0 +1,14 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type Now = + /** + * Gets the number of milliseconds that have elapsed since the Unix epoch (1 January 1970 00:00:00 UTC). + * + * @return The number of milliseconds. + */ + () => number; + +declare const now: Now; +export = now; diff --git a/types/lodash/fp/nth.d.ts b/types/lodash/fp/nth.d.ts new file mode 100644 index 0000000000..a1fbedb1bf --- /dev/null +++ b/types/lodash/fp/nth.d.ts @@ -0,0 +1,53 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Nth { + /** + * Gets the element at index `n` of `array`. If `n` is negative, the nth element from the end is returned. + * + * @param array array The array to query. + * @param value The index of the element to return. + * @return Returns the nth element of `array`. + */ + (): Nth; + /** + * Gets the element at index `n` of `array`. If `n` is negative, the nth element from the end is returned. + * + * @param array array The array to query. + * @param value The index of the element to return. + * @return Returns the nth element of `array`. + */ + (n: number): Nth1x1; + /** + * Gets the element at index `n` of `array`. If `n` is negative, the nth element from the end is returned. + * + * @param array array The array to query. + * @param value The index of the element to return. + * @return Returns the nth element of `array`. + */ + (n: number, array: _.List | null | undefined): T | undefined; +} +interface Nth1x1 { + /** + * Gets the element at index `n` of `array`. If `n` is negative, the nth element from the end is returned. + * + * @param array array The array to query. + * @param value The index of the element to return. + * @return Returns the nth element of `array`. + */ + (): Nth1x1; + /** + * Gets the element at index `n` of `array`. If `n` is negative, the nth element from the end is returned. + * + * @param array array The array to query. + * @param value The index of the element to return. + * @return Returns the nth element of `array`. + */ + (array: _.List | null | undefined): T | undefined; +} + +declare const nth: Nth; +export = nth; diff --git a/types/lodash/fp/nthArg.d.ts b/types/lodash/fp/nthArg.d.ts new file mode 100644 index 0000000000..5e8335943b --- /dev/null +++ b/types/lodash/fp/nthArg.d.ts @@ -0,0 +1,15 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type NthArg = + /** + * Creates a function that returns its nth argument. + * + * @param n The index of the argument to return. + * @return Returns the new function. + */ + (n: number) => (...args: any[]) => any; + +declare const nthArg: NthArg; +export = nthArg; diff --git a/types/lodash/fp/omit.d.ts b/types/lodash/fp/omit.d.ts new file mode 100644 index 0000000000..5c7a553b9f --- /dev/null +++ b/types/lodash/fp/omit.d.ts @@ -0,0 +1,132 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Omit { + /** + * The opposite of `_.pick`; this method creates an object composed of the + * own and inherited enumerable properties of `object` that are not omitted. + * + * @category Object + * @param object The source object. + * @param [paths] The property names to omit, specified + * individually or in arrays.. + * @returns Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.omit(object, ['a', 'c']); + * // => { 'b': '2' } + */ + (): Omit; + /** + * The opposite of `_.pick`; this method creates an object composed of the + * own and inherited enumerable properties of `object` that are not omitted. + * + * @category Object + * @param object The source object. + * @param [paths] The property names to omit, specified + * individually or in arrays.. + * @returns Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.omit(object, ['a', 'c']); + * // => { 'b': '2' } + */ + (paths: _.PropertyPath): Omit1x1; + /** + * The opposite of `_.pick`; this method creates an object composed of the + * own and inherited enumerable properties of `object` that are not omitted. + * + * @category Object + * @param object The source object. + * @param [paths] The property names to omit, specified + * individually or in arrays.. + * @returns Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.omit(object, ['a', 'c']); + * // => { 'b': '2' } + */ + (paths: _.PropertyPath, object: T | null | undefined): T; + /** + * The opposite of `_.pick`; this method creates an object composed of the + * own and inherited enumerable properties of `object` that are not omitted. + * + * @category Object + * @param object The source object. + * @param [paths] The property names to omit, specified + * individually or in arrays.. + * @returns Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.omit(object, ['a', 'c']); + * // => { 'b': '2' } + */ + (paths: _.PropertyPath, object: T | null | undefined): _.PartialObject; +} +interface Omit1x1 { + /** + * The opposite of `_.pick`; this method creates an object composed of the + * own and inherited enumerable properties of `object` that are not omitted. + * + * @category Object + * @param object The source object. + * @param [paths] The property names to omit, specified + * individually or in arrays.. + * @returns Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.omit(object, ['a', 'c']); + * // => { 'b': '2' } + */ + (): Omit1x1; + /** + * The opposite of `_.pick`; this method creates an object composed of the + * own and inherited enumerable properties of `object` that are not omitted. + * + * @category Object + * @param object The source object. + * @param [paths] The property names to omit, specified + * individually or in arrays.. + * @returns Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.omit(object, ['a', 'c']); + * // => { 'b': '2' } + */ + (object: T | null | undefined): T; + /** + * The opposite of `_.pick`; this method creates an object composed of the + * own and inherited enumerable properties of `object` that are not omitted. + * + * @category Object + * @param object The source object. + * @param [paths] The property names to omit, specified + * individually or in arrays.. + * @returns Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.omit(object, ['a', 'c']); + * // => { 'b': '2' } + */ + (object: T | null | undefined): _.PartialObject; +} + +declare const omit: Omit; +export = omit; diff --git a/types/lodash/fp/omitAll.d.ts b/types/lodash/fp/omitAll.d.ts new file mode 100644 index 0000000000..a3aec48c5f --- /dev/null +++ b/types/lodash/fp/omitAll.d.ts @@ -0,0 +1,132 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Omit { + /** + * The opposite of `_.pick`; this method creates an object composed of the + * own and inherited enumerable properties of `object` that are not omitted. + * + * @category Object + * @param object The source object. + * @param [paths] The property names to omit, specified + * individually or in arrays.. + * @returns Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.omit(object, ['a', 'c']); + * // => { 'b': '2' } + */ + (): Omit; + /** + * The opposite of `_.pick`; this method creates an object composed of the + * own and inherited enumerable properties of `object` that are not omitted. + * + * @category Object + * @param object The source object. + * @param [paths] The property names to omit, specified + * individually or in arrays.. + * @returns Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.omit(object, ['a', 'c']); + * // => { 'b': '2' } + */ + (paths: _.PropertyPath): Omit1x1; + /** + * The opposite of `_.pick`; this method creates an object composed of the + * own and inherited enumerable properties of `object` that are not omitted. + * + * @category Object + * @param object The source object. + * @param [paths] The property names to omit, specified + * individually or in arrays.. + * @returns Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.omit(object, ['a', 'c']); + * // => { 'b': '2' } + */ + (paths: _.PropertyPath, object: T | null | undefined): T; + /** + * The opposite of `_.pick`; this method creates an object composed of the + * own and inherited enumerable properties of `object` that are not omitted. + * + * @category Object + * @param object The source object. + * @param [paths] The property names to omit, specified + * individually or in arrays.. + * @returns Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.omit(object, ['a', 'c']); + * // => { 'b': '2' } + */ + (paths: _.PropertyPath, object: T | null | undefined): _.PartialObject; +} +interface Omit1x1 { + /** + * The opposite of `_.pick`; this method creates an object composed of the + * own and inherited enumerable properties of `object` that are not omitted. + * + * @category Object + * @param object The source object. + * @param [paths] The property names to omit, specified + * individually or in arrays.. + * @returns Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.omit(object, ['a', 'c']); + * // => { 'b': '2' } + */ + (): Omit1x1; + /** + * The opposite of `_.pick`; this method creates an object composed of the + * own and inherited enumerable properties of `object` that are not omitted. + * + * @category Object + * @param object The source object. + * @param [paths] The property names to omit, specified + * individually or in arrays.. + * @returns Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.omit(object, ['a', 'c']); + * // => { 'b': '2' } + */ + (object: T | null | undefined): T; + /** + * The opposite of `_.pick`; this method creates an object composed of the + * own and inherited enumerable properties of `object` that are not omitted. + * + * @category Object + * @param object The source object. + * @param [paths] The property names to omit, specified + * individually or in arrays.. + * @returns Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.omit(object, ['a', 'c']); + * // => { 'b': '2' } + */ + (object: T | null | undefined): _.PartialObject; +} + +declare const omitAll: Omit; +export = omitAll; diff --git a/types/lodash/fp/omitBy.d.ts b/types/lodash/fp/omitBy.d.ts new file mode 100644 index 0000000000..b0bf665afc --- /dev/null +++ b/types/lodash/fp/omitBy.d.ts @@ -0,0 +1,98 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface OmitBy { + /** + * 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. + * + * @category Object + * @param object The source object. + * @param [predicate=_.identity] The function invoked per property. + * @returns Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.omitBy(object, _.isNumber); + * // => { 'b': '2' } + */ + (): OmitBy; + /** + * 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. + * + * @category Object + * @param object The source object. + * @param [predicate=_.identity] The function invoked per property. + * @returns Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.omitBy(object, _.isNumber); + * // => { 'b': '2' } + */ + (predicate: _.ValueKeyIteratee): OmitBy1x1; + /** + * 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. + * + * @category Object + * @param object The source object. + * @param [predicate=_.identity] The function invoked per property. + * @returns Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.omitBy(object, _.isNumber); + * // => { 'b': '2' } + */ + (predicate: _.ValueKeyIteratee, object: T | null | undefined): _.PartialObject; +} +interface OmitBy1x1 { + /** + * 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. + * + * @category Object + * @param object The source object. + * @param [predicate=_.identity] The function invoked per property. + * @returns Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.omitBy(object, _.isNumber); + * // => { 'b': '2' } + */ + (): OmitBy1x1; + /** + * 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. + * + * @category Object + * @param object The source object. + * @param [predicate=_.identity] The function invoked per property. + * @returns Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.omitBy(object, _.isNumber); + * // => { 'b': '2' } + */ + (object: T1 | null | undefined): _.PartialObject; +} + +declare const omitBy: OmitBy; +export = omitBy; diff --git a/types/lodash/fp/once.d.ts b/types/lodash/fp/once.d.ts new file mode 100644 index 0000000000..f97a08a13e --- /dev/null +++ b/types/lodash/fp/once.d.ts @@ -0,0 +1,16 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type Once = + /** + * 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. + */ + any>(func: T) => T; + +declare const once: Once; +export = once; diff --git a/types/lodash/fp/orderBy.d.ts b/types/lodash/fp/orderBy.d.ts new file mode 100644 index 0000000000..4cf7048978 --- /dev/null +++ b/types/lodash/fp/orderBy.d.ts @@ -0,0 +1,461 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface OrderBy { + /** + * 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. + * + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratees=[_.identity]] The iteratees to sort by. + * @param [orders] The sort orders of `iteratees`. + * @param- {Object} [guard] Enables use as an iteratee for functions like `_.reduce`. + * @returns Returns the new sorted array. + * @example + * + * var users = [ + * { 'user': 'fred', 'age': 48 }, + * { 'user': 'barney', 'age': 34 }, + * { 'user': 'fred', 'age': 42 }, + * { 'user': 'barney', 'age': 36 } + * ]; + * + * // 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; + /** + * 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. + * + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratees=[_.identity]] The iteratees to sort by. + * @param [orders] The sort orders of `iteratees`. + * @param- {Object} [guard] Enables use as an iteratee for functions like `_.reduce`. + * @returns Returns the new sorted array. + * @example + * + * var users = [ + * { 'user': 'fred', 'age': 48 }, + * { 'user': 'barney', 'age': 34 }, + * { 'user': 'fred', 'age': 42 }, + * { 'user': 'barney', 'age': 36 } + * ]; + * + * // 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]] + */ + (iteratees: _.Many<(value: T) => _.NotVoid>): OrderBy1x1; + /** + * 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. + * + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratees=[_.identity]] The iteratees to sort by. + * @param [orders] The sort orders of `iteratees`. + * @param- {Object} [guard] Enables use as an iteratee for functions like `_.reduce`. + * @returns Returns the new sorted array. + * @example + * + * var users = [ + * { 'user': 'fred', 'age': 48 }, + * { 'user': 'barney', 'age': 34 }, + * { 'user': 'fred', 'age': 42 }, + * { 'user': 'barney', 'age': 36 } + * ]; + * + * // 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]] + */ + (iteratees: _.Many<(value: T) => _.NotVoid>, orders: _.Many): OrderBy1x2; + /** + * 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. + * + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratees=[_.identity]] The iteratees to sort by. + * @param [orders] The sort orders of `iteratees`. + * @param- {Object} [guard] Enables use as an iteratee for functions like `_.reduce`. + * @returns Returns the new sorted array. + * @example + * + * var users = [ + * { 'user': 'fred', 'age': 48 }, + * { 'user': 'barney', 'age': 34 }, + * { 'user': 'fred', 'age': 42 }, + * { 'user': 'barney', 'age': 36 } + * ]; + * + * // 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]] + */ + (iteratees: _.Many<(value: T) => _.NotVoid> | _.Many<_.ValueIteratee>, orders: _.Many, collection: _.List | null | undefined): T[]; + /** + * 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. + * + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratees=[_.identity]] The iteratees to sort by. + * @param [orders] The sort orders of `iteratees`. + * @param- {Object} [guard] Enables use as an iteratee for functions like `_.reduce`. + * @returns Returns the new sorted array. + * @example + * + * var users = [ + * { 'user': 'fred', 'age': 48 }, + * { 'user': 'barney', 'age': 34 }, + * { 'user': 'fred', 'age': 42 }, + * { 'user': 'barney', 'age': 36 } + * ]; + * + * // 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]] + */ + (iteratees: _.Many<_.ValueIteratee>): OrderBy2x1; + /** + * 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. + * + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratees=[_.identity]] The iteratees to sort by. + * @param [orders] The sort orders of `iteratees`. + * @param- {Object} [guard] Enables use as an iteratee for functions like `_.reduce`. + * @returns Returns the new sorted array. + * @example + * + * var users = [ + * { 'user': 'fred', 'age': 48 }, + * { 'user': 'barney', 'age': 34 }, + * { 'user': 'fred', 'age': 42 }, + * { 'user': 'barney', 'age': 36 } + * ]; + * + * // 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]] + */ + (iteratees: _.Many<_.ValueIteratee>, orders: _.Many): OrderBy2x2; + /** + * 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. + * + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratees=[_.identity]] The iteratees to sort by. + * @param [orders] The sort orders of `iteratees`. + * @param- {Object} [guard] Enables use as an iteratee for functions like `_.reduce`. + * @returns Returns the new sorted array. + * @example + * + * var users = [ + * { 'user': 'fred', 'age': 48 }, + * { 'user': 'barney', 'age': 34 }, + * { 'user': 'fred', 'age': 42 }, + * { 'user': 'barney', 'age': 36 } + * ]; + * + * // 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]] + */ + (iteratees: _.Many<(value: T[keyof T]) => _.NotVoid> | _.Many<_.ValueIteratee>, orders: _.Many, collection: T | null | undefined): Array; +} +interface OrderBy1x1 { + /** + * 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. + * + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratees=[_.identity]] The iteratees to sort by. + * @param [orders] The sort orders of `iteratees`. + * @param- {Object} [guard] Enables use as an iteratee for functions like `_.reduce`. + * @returns Returns the new sorted array. + * @example + * + * var users = [ + * { 'user': 'fred', 'age': 48 }, + * { 'user': 'barney', 'age': 34 }, + * { 'user': 'fred', 'age': 42 }, + * { 'user': 'barney', 'age': 36 } + * ]; + * + * // 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]] + */ + (): OrderBy1x1; + /** + * 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. + * + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratees=[_.identity]] The iteratees to sort by. + * @param [orders] The sort orders of `iteratees`. + * @param- {Object} [guard] Enables use as an iteratee for functions like `_.reduce`. + * @returns Returns the new sorted array. + * @example + * + * var users = [ + * { 'user': 'fred', 'age': 48 }, + * { 'user': 'barney', 'age': 34 }, + * { 'user': 'fred', 'age': 42 }, + * { 'user': 'barney', 'age': 36 } + * ]; + * + * // 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]] + */ + (orders: _.Many): OrderBy1x2; + /** + * 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. + * + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratees=[_.identity]] The iteratees to sort by. + * @param [orders] The sort orders of `iteratees`. + * @param- {Object} [guard] Enables use as an iteratee for functions like `_.reduce`. + * @returns Returns the new sorted array. + * @example + * + * var users = [ + * { 'user': 'fred', 'age': 48 }, + * { 'user': 'barney', 'age': 34 }, + * { 'user': 'fred', 'age': 42 }, + * { 'user': 'barney', 'age': 36 } + * ]; + * + * // 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]] + */ + (orders: _.Many, collection: _.List | object | null | undefined): T[]; +} +interface OrderBy1x2 { + /** + * 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. + * + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratees=[_.identity]] The iteratees to sort by. + * @param [orders] The sort orders of `iteratees`. + * @param- {Object} [guard] Enables use as an iteratee for functions like `_.reduce`. + * @returns Returns the new sorted array. + * @example + * + * var users = [ + * { 'user': 'fred', 'age': 48 }, + * { 'user': 'barney', 'age': 34 }, + * { 'user': 'fred', 'age': 42 }, + * { 'user': 'barney', 'age': 36 } + * ]; + * + * // 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]] + */ + (): OrderBy1x2; + /** + * 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. + * + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratees=[_.identity]] The iteratees to sort by. + * @param [orders] The sort orders of `iteratees`. + * @param- {Object} [guard] Enables use as an iteratee for functions like `_.reduce`. + * @returns Returns the new sorted array. + * @example + * + * var users = [ + * { 'user': 'fred', 'age': 48 }, + * { 'user': 'barney', 'age': 34 }, + * { 'user': 'fred', 'age': 42 }, + * { 'user': 'barney', 'age': 36 } + * ]; + * + * // 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]] + */ + (collection: _.List | object | null | undefined): T[]; +} +interface OrderBy2x1 { + /** + * 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. + * + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratees=[_.identity]] The iteratees to sort by. + * @param [orders] The sort orders of `iteratees`. + * @param- {Object} [guard] Enables use as an iteratee for functions like `_.reduce`. + * @returns Returns the new sorted array. + * @example + * + * var users = [ + * { 'user': 'fred', 'age': 48 }, + * { 'user': 'barney', 'age': 34 }, + * { 'user': 'fred', 'age': 42 }, + * { 'user': 'barney', 'age': 36 } + * ]; + * + * // 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]] + */ + (): OrderBy2x1; + /** + * 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. + * + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratees=[_.identity]] The iteratees to sort by. + * @param [orders] The sort orders of `iteratees`. + * @param- {Object} [guard] Enables use as an iteratee for functions like `_.reduce`. + * @returns Returns the new sorted array. + * @example + * + * var users = [ + * { 'user': 'fred', 'age': 48 }, + * { 'user': 'barney', 'age': 34 }, + * { 'user': 'fred', 'age': 42 }, + * { 'user': 'barney', 'age': 36 } + * ]; + * + * // 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]] + */ + (orders: _.Many): OrderBy2x2; + /** + * 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. + * + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratees=[_.identity]] The iteratees to sort by. + * @param [orders] The sort orders of `iteratees`. + * @param- {Object} [guard] Enables use as an iteratee for functions like `_.reduce`. + * @returns Returns the new sorted array. + * @example + * + * var users = [ + * { 'user': 'fred', 'age': 48 }, + * { 'user': 'barney', 'age': 34 }, + * { 'user': 'fred', 'age': 42 }, + * { 'user': 'barney', 'age': 36 } + * ]; + * + * // 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]] + */ + (orders: _.Many, collection: _.List | object | null | undefined): T[]; +} +interface OrderBy2x2 { + /** + * 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. + * + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratees=[_.identity]] The iteratees to sort by. + * @param [orders] The sort orders of `iteratees`. + * @param- {Object} [guard] Enables use as an iteratee for functions like `_.reduce`. + * @returns Returns the new sorted array. + * @example + * + * var users = [ + * { 'user': 'fred', 'age': 48 }, + * { 'user': 'barney', 'age': 34 }, + * { 'user': 'fred', 'age': 42 }, + * { 'user': 'barney', 'age': 36 } + * ]; + * + * // 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]] + */ + (): OrderBy2x2; + /** + * 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. + * + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratees=[_.identity]] The iteratees to sort by. + * @param [orders] The sort orders of `iteratees`. + * @param- {Object} [guard] Enables use as an iteratee for functions like `_.reduce`. + * @returns Returns the new sorted array. + * @example + * + * var users = [ + * { 'user': 'fred', 'age': 48 }, + * { 'user': 'barney', 'age': 34 }, + * { 'user': 'fred', 'age': 42 }, + * { 'user': 'barney', 'age': 36 } + * ]; + * + * // 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]] + */ + (collection: _.List | object | null | undefined): T[]; +} + +declare const orderBy: OrderBy; +export = orderBy; diff --git a/types/lodash/fp/over.d.ts b/types/lodash/fp/over.d.ts new file mode 100644 index 0000000000..4bd1803827 --- /dev/null +++ b/types/lodash/fp/over.d.ts @@ -0,0 +1,18 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +type Over = + /** + * Creates a function that invokes iteratees with the arguments provided to the created function and returns + * their results. + * + * @param iteratees The iteratees to invoke. + * @return Returns the new function. + */ + (iteratees: _.Many<(...args: any[]) => TResult>) => (...args: any[]) => TResult[]; + +declare const over: Over; +export = over; diff --git a/types/lodash/fp/overArgs.d.ts b/types/lodash/fp/overArgs.d.ts new file mode 100644 index 0000000000..84241e3e58 --- /dev/null +++ b/types/lodash/fp/overArgs.d.ts @@ -0,0 +1,58 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface OverArgs { + /** + * 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. + */ + (): OverArgs; + /** + * 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. + */ + (func: (...args: any[]) => any): OverArgs1x1; + /** + * 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. + */ + (func: (...args: any[]) => any, transforms: _.Many<(...args: any[]) => any>): (...args: any[]) => any; +} +interface OverArgs1x1 { + /** + * 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. + */ + (): OverArgs1x1; + /** + * 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. + */ + (transforms: _.Many<(...args: any[]) => any>): (...args: any[]) => any; +} + +declare const overArgs: OverArgs; +export = overArgs; diff --git a/types/lodash/fp/overEvery.d.ts b/types/lodash/fp/overEvery.d.ts new file mode 100644 index 0000000000..3ebf8e2abf --- /dev/null +++ b/types/lodash/fp/overEvery.d.ts @@ -0,0 +1,18 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +type OverEvery = + /** + * Creates a function that checks if all of the predicates return truthy when invoked with the arguments + * provided to the created function. + * + * @param predicates The predicates to check. + * @return Returns the new function. + */ + (predicates: _.Many<(...args: T[]) => boolean>) => (...args: T[]) => boolean; + +declare const overEvery: OverEvery; +export = overEvery; diff --git a/types/lodash/fp/overSome.d.ts b/types/lodash/fp/overSome.d.ts new file mode 100644 index 0000000000..75315b07d0 --- /dev/null +++ b/types/lodash/fp/overSome.d.ts @@ -0,0 +1,18 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +type OverSome = + /** + * Creates a function that checks if any of the predicates return truthy when invoked with the arguments + * provided to the created function. + * + * @param predicates The predicates to check. + * @return Returns the new function. + */ + (predicates: _.Many<(...args: T[]) => boolean>) => (...args: T[]) => boolean; + +declare const overSome: OverSome; +export = overSome; diff --git a/types/lodash/fp/pad.d.ts b/types/lodash/fp/pad.d.ts new file mode 100644 index 0000000000..e6581046a2 --- /dev/null +++ b/types/lodash/fp/pad.d.ts @@ -0,0 +1,61 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface Pad { + /** + * 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; + /** + * 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. + */ + (length: number): Pad1x1; + /** + * 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. + */ + (length: number, string: string): string; +} +interface Pad1x1 { + /** + * 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. + */ + (): Pad1x1; + /** + * 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. + */ + (string: string): string; +} + +declare const pad: Pad; +export = pad; diff --git a/types/lodash/fp/padChars.d.ts b/types/lodash/fp/padChars.d.ts new file mode 100644 index 0000000000..11d797db06 --- /dev/null +++ b/types/lodash/fp/padChars.d.ts @@ -0,0 +1,103 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface Pad { + /** + * 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; + /** + * 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. + */ + (chars: string): Pad1x1; + /** + * 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. + */ + (chars: string, length: number): Pad1x2; + /** + * 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. + */ + (chars: string, length: number, string: string): string; +} +interface Pad1x1 { + /** + * 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. + */ + (): Pad1x1; + /** + * 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. + */ + (length: number): Pad1x2; + /** + * 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. + */ + (length: number, string: string): string; +} +interface Pad1x2 { + /** + * 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. + */ + (): Pad1x2; + /** + * 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. + */ + (string: string): string; +} + +declare const padChars: Pad; +export = padChars; diff --git a/types/lodash/fp/padCharsEnd.d.ts b/types/lodash/fp/padCharsEnd.d.ts new file mode 100644 index 0000000000..01ec387810 --- /dev/null +++ b/types/lodash/fp/padCharsEnd.d.ts @@ -0,0 +1,103 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface PadEnd { + /** + * 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. + */ + (): PadEnd; + /** + * 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. + */ + (chars: string): PadEnd1x1; + /** + * 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. + */ + (chars: string, length: number): PadEnd1x2; + /** + * 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. + */ + (chars: string, length: number, string: string): string; +} +interface PadEnd1x1 { + /** + * 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. + */ + (): PadEnd1x1; + /** + * 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. + */ + (length: number): PadEnd1x2; + /** + * 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. + */ + (length: number, string: string): string; +} +interface PadEnd1x2 { + /** + * 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. + */ + (): PadEnd1x2; + /** + * 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. + */ + (string: string): string; +} + +declare const padCharsEnd: PadEnd; +export = padCharsEnd; diff --git a/types/lodash/fp/padCharsStart.d.ts b/types/lodash/fp/padCharsStart.d.ts new file mode 100644 index 0000000000..cc760b7d0a --- /dev/null +++ b/types/lodash/fp/padCharsStart.d.ts @@ -0,0 +1,103 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface PadStart { + /** + * 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. + */ + (): PadStart; + /** + * 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. + */ + (chars: string): PadStart1x1; + /** + * 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. + */ + (chars: string, length: number): PadStart1x2; + /** + * 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. + */ + (chars: string, length: number, string: string): string; +} +interface PadStart1x1 { + /** + * 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. + */ + (): PadStart1x1; + /** + * 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. + */ + (length: number): PadStart1x2; + /** + * 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. + */ + (length: number, string: string): string; +} +interface PadStart1x2 { + /** + * 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. + */ + (): PadStart1x2; + /** + * 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. + */ + (string: string): string; +} + +declare const padCharsStart: PadStart; +export = padCharsStart; diff --git a/types/lodash/fp/padEnd.d.ts b/types/lodash/fp/padEnd.d.ts new file mode 100644 index 0000000000..aefc8b35ff --- /dev/null +++ b/types/lodash/fp/padEnd.d.ts @@ -0,0 +1,61 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface PadEnd { + /** + * 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. + */ + (): PadEnd; + /** + * 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. + */ + (length: number): PadEnd1x1; + /** + * 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. + */ + (length: number, string: string): string; +} +interface PadEnd1x1 { + /** + * 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. + */ + (): PadEnd1x1; + /** + * 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. + */ + (string: string): string; +} + +declare const padEnd: PadEnd; +export = padEnd; diff --git a/types/lodash/fp/padStart.d.ts b/types/lodash/fp/padStart.d.ts new file mode 100644 index 0000000000..a40e611e8c --- /dev/null +++ b/types/lodash/fp/padStart.d.ts @@ -0,0 +1,61 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface PadStart { + /** + * 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. + */ + (): PadStart; + /** + * 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. + */ + (length: number): PadStart1x1; + /** + * 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. + */ + (length: number, string: string): string; +} +interface PadStart1x1 { + /** + * 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. + */ + (): PadStart1x1; + /** + * 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. + */ + (string: string): string; +} + +declare const padStart: PadStart; +export = padStart; diff --git a/types/lodash/fp/parseInt.d.ts b/types/lodash/fp/parseInt.d.ts new file mode 100644 index 0000000000..b4257213bd --- /dev/null +++ b/types/lodash/fp/parseInt.d.ts @@ -0,0 +1,66 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface ParseInt { + /** + * 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; + /** + * 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. + */ + (radix: number): ParseInt1x1; + /** + * 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. + */ + (radix: number, string: string): number; +} +interface ParseInt1x1 { + /** + * 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. + */ + (): ParseInt1x1; + /** + * 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. + */ + (string: string): number; +} + +declare const parseInt: ParseInt; +export = parseInt; diff --git a/types/lodash/fp/partial.d.ts b/types/lodash/fp/partial.d.ts new file mode 100644 index 0000000000..37c796b0b8 --- /dev/null +++ b/types/lodash/fp/partial.d.ts @@ -0,0 +1,56 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface Partial { + /** + * 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; + /** + * 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. + **/ + (args: ReadonlyArray): Partial1x1; + /** + * 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. + **/ + (args: ReadonlyArray, func: (...args: any[]) => any): (...args: any[]) => any; +} +interface Partial1x1 { + /** + * 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. + **/ + (): Partial1x1; + /** + * 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. + **/ + (func: (...args: any[]) => any): (...args: any[]) => any; +} + +declare const partial: Partial; +export = partial; diff --git a/types/lodash/fp/partialRight.d.ts b/types/lodash/fp/partialRight.d.ts new file mode 100644 index 0000000000..d148198d3b --- /dev/null +++ b/types/lodash/fp/partialRight.d.ts @@ -0,0 +1,51 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface PartialRight { + /** + * 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; + /** + * 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. + **/ + (args: ReadonlyArray): PartialRight1x1; + /** + * 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. + **/ + (args: ReadonlyArray, func: (...args: any[]) => any): (...args: any[]) => any; +} +interface PartialRight1x1 { + /** + * 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. + **/ + (): PartialRight1x1; + /** + * 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. + **/ + (func: (...args: any[]) => any): (...args: any[]) => any; +} + +declare const partialRight: PartialRight; +export = partialRight; diff --git a/types/lodash/fp/partition.d.ts b/types/lodash/fp/partition.d.ts new file mode 100644 index 0000000000..5e97fd95de --- /dev/null +++ b/types/lodash/fp/partition.d.ts @@ -0,0 +1,133 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Partition { + /** + * 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; + /** + * 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. + **/ + (callback: _.ValueIteratee): Partition1x1; + /** + * 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. + **/ + (callback: _.ValueIteratee, collection: _.List | null | undefined): [T[], T[]]; + /** + * 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. + **/ + (callback: _.ValueIteratee, collection: T | null | undefined): [Array, Array]; +} +interface Partition1x1 { + /** + * 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. + **/ + (): Partition1x1; + /** + * 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. + **/ + (collection: _.List | object | null | undefined): [T[], T[]]; +} + +declare const partition: Partition; +export = partition; diff --git a/types/lodash/fp/path.d.ts b/types/lodash/fp/path.d.ts new file mode 100644 index 0000000000..cb8b94efaf --- /dev/null +++ b/types/lodash/fp/path.d.ts @@ -0,0 +1,207 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Get { + /** + * 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; + /** + * 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. + */ + (path: TKey | [TKey]): Get1x1; + /** + * 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. + */ + (path: TKey | [TKey], object: TObject): TObject[TKey]; + /** + * 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. + */ + (path: TKey | [TKey], object: TObject | null | undefined): TObject[TKey] | undefined; + /** + * 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. + */ + (path: number): Get3x1; + /** + * 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. + */ + (path: number, object: _.NumericDictionary): T; + /** + * 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. + */ + (path: number, object: _.NumericDictionary | null | undefined): T | undefined; + /** + * 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. + */ + (path: _.PropertyPath): Get5x1; + /** + * 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. + */ + (path: _.PropertyPath, object: null | undefined): undefined; + /** + * 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. + */ + (path: _.PropertyPath, object: any): any; +} +interface Get1x1 { + /** + * 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. + */ + (): Get1x1; + /** + * 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. + */ + (object: TObject): TObject[TKey]; + /** + * 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. + */ + (object: TObject | null | undefined): TObject[TKey] | undefined; +} +interface Get3x1 { + /** + * 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. + */ + (): Get3x1; + /** + * 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. + */ + (object: _.NumericDictionary): T; + /** + * 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. + */ + (object: _.NumericDictionary | null | undefined): T | undefined; +} +interface Get5x1 { + /** + * 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. + */ + (): Get5x1; + /** + * 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. + */ + (object: null | undefined): undefined; + /** + * 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. + */ + (object: any): any; +} + +declare const path: Get; +export = path; diff --git a/types/lodash/fp/pathEq.d.ts b/types/lodash/fp/pathEq.d.ts new file mode 100644 index 0000000000..569fffabf8 --- /dev/null +++ b/types/lodash/fp/pathEq.d.ts @@ -0,0 +1,90 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface MatchesProperty { + /** + * 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; + /** + * 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. + */ + (path: _.PropertyPath): MatchesProperty1x1; + /** + * 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. + */ + (path: _.PropertyPath, srcValue: T): (value: any) => boolean; + /** + * 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. + */ + (path: _.PropertyPath, srcValue: T): (value: V) => boolean; +} +interface MatchesProperty1x1 { + /** + * 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. + */ + (): MatchesProperty1x1; + /** + * 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. + */ + (srcValue: T): (value: any) => boolean; + /** + * 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. + */ + (srcValue: T): (value: V) => boolean; +} + +declare const pathEq: MatchesProperty; +export = pathEq; diff --git a/types/lodash/fp/pathOr.d.ts b/types/lodash/fp/pathOr.d.ts new file mode 100644 index 0000000000..a62252ce03 --- /dev/null +++ b/types/lodash/fp/pathOr.d.ts @@ -0,0 +1,313 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Get { + /** + * 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; + /** + * 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. + */ + (defaultValue: TDefault): Get1x1; + /** + * 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. + */ + (defaultValue: TDefault, path: TKey | [TKey]): Get1x2; + /** + * 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. + */ + (defaultValue: TDefault, path: TKey | [TKey], object: TObject | null | undefined): TObject[TKey] | TDefault; + /** + * 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. + */ + (defaultValue: TDefault, path: number): Get2x2; + /** + * 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. + */ + (defaultValue: TDefault, path: number, object: _.NumericDictionary | null | undefined): T | TDefault; + /** + * 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. + */ + (defaultValue: TDefault, path: _.PropertyPath): Get3x2; + /** + * 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. + */ + (defaultValue: TDefault, path: _.PropertyPath, object: null | undefined): TDefault; + /** + * 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. + */ + (defaultValue: any): Get4x1; + /** + * 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. + */ + (defaultValue: any, path: _.PropertyPath): Get4x2; + /** + * 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. + */ + (defaultValue: any, path: _.PropertyPath, object: any): any; +} +interface Get1x1 { + /** + * 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. + */ + (): Get1x1; + /** + * 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. + */ + (path: TKey | [TKey]): Get1x2; + /** + * 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. + */ + (path: TKey | [TKey], object: TObject | null | undefined): TObject[TKey] | TDefault; + /** + * 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. + */ + (path: number): Get2x2; + /** + * 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. + */ + (path: number, object: _.NumericDictionary | null | undefined): T | TDefault; + /** + * 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. + */ + (path: _.PropertyPath): Get3x2; + /** + * 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. + */ + (path: _.PropertyPath, object: null | undefined): TDefault; +} +interface Get1x2 { + /** + * 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. + */ + (): Get1x2; + /** + * 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. + */ + (object: TObject | null | undefined): TObject[TKey] | TDefault; +} +interface Get2x2 { + /** + * 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. + */ + (): Get2x2; + /** + * 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. + */ + (object: _.NumericDictionary | null | undefined): T | TDefault; +} +interface Get3x2 { + /** + * 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. + */ + (): Get3x2; + /** + * 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. + */ + (object: null | undefined): TDefault; +} +interface Get4x1 { + /** + * 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. + */ + (): Get4x1; + /** + * 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. + */ + (path: _.PropertyPath): Get4x2; + /** + * 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. + */ + (path: _.PropertyPath, object: any): any; +} +interface Get4x2 { + /** + * 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. + */ + (): Get4x2; + /** + * 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. + */ + (object: any): any; +} + +declare const pathOr: Get; +export = pathOr; diff --git a/types/lodash/fp/paths.d.ts b/types/lodash/fp/paths.d.ts new file mode 100644 index 0000000000..6aa6bcb6e5 --- /dev/null +++ b/types/lodash/fp/paths.d.ts @@ -0,0 +1,96 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface At { + /** + * 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 object The object 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; + /** + * 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 object The object 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. + */ + (props: _.PropertyPath): At1x1; + /** + * 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 object The object 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. + */ + (props: _.PropertyPath, object: _.List | _.Dictionary | _.NumericDictionary | null | undefined): T[]; + /** + * 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 object The object 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. + */ + (props: _.Many): At2x1; + /** + * 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 object The object 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. + */ + (props: _.Many, object: T | null | undefined): Array; +} +interface At1x1 { + /** + * 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 object The object 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. + */ + (): At1x1; + /** + * 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 object The object 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. + */ + (object: _.List | _.Dictionary | _.NumericDictionary | null | undefined): T[]; +} +interface At2x1 { + /** + * 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 object The object 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. + */ + (): At2x1; + /** + * 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 object The object 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. + */ + (object: T | null | undefined): Array; +} + +declare const paths: At; +export = paths; diff --git a/types/lodash/fp/pick.d.ts b/types/lodash/fp/pick.d.ts new file mode 100644 index 0000000000..d90def9925 --- /dev/null +++ b/types/lodash/fp/pick.d.ts @@ -0,0 +1,159 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface LodashPick { + /** + * Creates an object composed of the picked `object` properties. + * + * @category Object + * @param object The source object. + * @param [props] The property names to pick, specified + * individually or in arrays. + * @returns Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.pick(object, ['a', 'c']); + * // => { 'a': 1, 'c': 3 } + */ + (): LodashPick; + /** + * Creates an object composed of the picked `object` properties. + * + * @category Object + * @param object The source object. + * @param [props] The property names to pick, specified + * individually or in arrays. + * @returns Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.pick(object, ['a', 'c']); + * // => { 'a': 1, 'c': 3 } + */ + (props: _.Many): LodashPick1x1; + /** + * Creates an object composed of the picked `object` properties. + * + * @category Object + * @param object The source object. + * @param [props] The property names to pick, specified + * individually or in arrays. + * @returns Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.pick(object, ['a', 'c']); + * // => { 'a': 1, 'c': 3 } + */ + (props: _.Many, object: T): Pick; + /** + * Creates an object composed of the picked `object` properties. + * + * @category Object + * @param object The source object. + * @param [props] The property names to pick, specified + * individually or in arrays. + * @returns Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.pick(object, ['a', 'c']); + * // => { 'a': 1, 'c': 3 } + */ + (props: _.PropertyPath): LodashPick2x1; + /** + * Creates an object composed of the picked `object` properties. + * + * @category Object + * @param object The source object. + * @param [props] The property names to pick, specified + * individually or in arrays. + * @returns Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.pick(object, ['a', 'c']); + * // => { 'a': 1, 'c': 3 } + */ + (props: _.PropertyPath, object: T | null | undefined): _.PartialDeep; +} +interface LodashPick1x1 { + /** + * Creates an object composed of the picked `object` properties. + * + * @category Object + * @param object The source object. + * @param [props] The property names to pick, specified + * individually or in arrays. + * @returns Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.pick(object, ['a', 'c']); + * // => { 'a': 1, 'c': 3 } + */ + (): LodashPick1x1; + /** + * Creates an object composed of the picked `object` properties. + * + * @category Object + * @param object The source object. + * @param [props] The property names to pick, specified + * individually or in arrays. + * @returns Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.pick(object, ['a', 'c']); + * // => { 'a': 1, 'c': 3 } + */ + (object: T): Pick; +} +interface LodashPick2x1 { + /** + * Creates an object composed of the picked `object` properties. + * + * @category Object + * @param object The source object. + * @param [props] The property names to pick, specified + * individually or in arrays. + * @returns Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.pick(object, ['a', 'c']); + * // => { 'a': 1, 'c': 3 } + */ + (): LodashPick2x1; + /** + * Creates an object composed of the picked `object` properties. + * + * @category Object + * @param object The source object. + * @param [props] The property names to pick, specified + * individually or in arrays. + * @returns Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.pick(object, ['a', 'c']); + * // => { 'a': 1, 'c': 3 } + */ + (object: T | null | undefined): _.PartialDeep; +} + +declare const pick: LodashPick; +export = pick; diff --git a/types/lodash/fp/pickAll.d.ts b/types/lodash/fp/pickAll.d.ts new file mode 100644 index 0000000000..0b103c02b7 --- /dev/null +++ b/types/lodash/fp/pickAll.d.ts @@ -0,0 +1,159 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface LodashPick { + /** + * Creates an object composed of the picked `object` properties. + * + * @category Object + * @param object The source object. + * @param [props] The property names to pick, specified + * individually or in arrays. + * @returns Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.pick(object, ['a', 'c']); + * // => { 'a': 1, 'c': 3 } + */ + (): LodashPick; + /** + * Creates an object composed of the picked `object` properties. + * + * @category Object + * @param object The source object. + * @param [props] The property names to pick, specified + * individually or in arrays. + * @returns Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.pick(object, ['a', 'c']); + * // => { 'a': 1, 'c': 3 } + */ + (props: _.Many): LodashPick1x1; + /** + * Creates an object composed of the picked `object` properties. + * + * @category Object + * @param object The source object. + * @param [props] The property names to pick, specified + * individually or in arrays. + * @returns Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.pick(object, ['a', 'c']); + * // => { 'a': 1, 'c': 3 } + */ + (props: _.Many, object: T): Pick; + /** + * Creates an object composed of the picked `object` properties. + * + * @category Object + * @param object The source object. + * @param [props] The property names to pick, specified + * individually or in arrays. + * @returns Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.pick(object, ['a', 'c']); + * // => { 'a': 1, 'c': 3 } + */ + (props: _.PropertyPath): LodashPick2x1; + /** + * Creates an object composed of the picked `object` properties. + * + * @category Object + * @param object The source object. + * @param [props] The property names to pick, specified + * individually or in arrays. + * @returns Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.pick(object, ['a', 'c']); + * // => { 'a': 1, 'c': 3 } + */ + (props: _.PropertyPath, object: T | null | undefined): _.PartialDeep; +} +interface LodashPick1x1 { + /** + * Creates an object composed of the picked `object` properties. + * + * @category Object + * @param object The source object. + * @param [props] The property names to pick, specified + * individually or in arrays. + * @returns Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.pick(object, ['a', 'c']); + * // => { 'a': 1, 'c': 3 } + */ + (): LodashPick1x1; + /** + * Creates an object composed of the picked `object` properties. + * + * @category Object + * @param object The source object. + * @param [props] The property names to pick, specified + * individually or in arrays. + * @returns Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.pick(object, ['a', 'c']); + * // => { 'a': 1, 'c': 3 } + */ + (object: T): Pick; +} +interface LodashPick2x1 { + /** + * Creates an object composed of the picked `object` properties. + * + * @category Object + * @param object The source object. + * @param [props] The property names to pick, specified + * individually or in arrays. + * @returns Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.pick(object, ['a', 'c']); + * // => { 'a': 1, 'c': 3 } + */ + (): LodashPick2x1; + /** + * Creates an object composed of the picked `object` properties. + * + * @category Object + * @param object The source object. + * @param [props] The property names to pick, specified + * individually or in arrays. + * @returns Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.pick(object, ['a', 'c']); + * // => { 'a': 1, 'c': 3 } + */ + (object: T | null | undefined): _.PartialDeep; +} + +declare const pickAll: LodashPick; +export = pickAll; diff --git a/types/lodash/fp/pickBy.d.ts b/types/lodash/fp/pickBy.d.ts new file mode 100644 index 0000000000..189084f980 --- /dev/null +++ b/types/lodash/fp/pickBy.d.ts @@ -0,0 +1,93 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface PickBy { + /** + * Creates an object composed of the `object` properties `predicate` returns + * truthy for. The predicate is invoked with two arguments: (value, key). + * + * @category Object + * @param object The source object. + * @param [predicate=_.identity] The function invoked per property. + * @returns Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.pickBy(object, _.isNumber); + * // => { 'a': 1, 'c': 3 } + */ + (): PickBy; + /** + * Creates an object composed of the `object` properties `predicate` returns + * truthy for. The predicate is invoked with two arguments: (value, key). + * + * @category Object + * @param object The source object. + * @param [predicate=_.identity] The function invoked per property. + * @returns Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.pickBy(object, _.isNumber); + * // => { 'a': 1, 'c': 3 } + */ + (predicate: _.ValueKeyIteratee): PickBy1x1; + /** + * Creates an object composed of the `object` properties `predicate` returns + * truthy for. The predicate is invoked with two arguments: (value, key). + * + * @category Object + * @param object The source object. + * @param [predicate=_.identity] The function invoked per property. + * @returns Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.pickBy(object, _.isNumber); + * // => { 'a': 1, 'c': 3 } + */ + (predicate: _.ValueKeyIteratee, object: T | null | undefined): _.PartialObject; +} +interface PickBy1x1 { + /** + * Creates an object composed of the `object` properties `predicate` returns + * truthy for. The predicate is invoked with two arguments: (value, key). + * + * @category Object + * @param object The source object. + * @param [predicate=_.identity] The function invoked per property. + * @returns Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.pickBy(object, _.isNumber); + * // => { 'a': 1, 'c': 3 } + */ + (): PickBy1x1; + /** + * Creates an object composed of the `object` properties `predicate` returns + * truthy for. The predicate is invoked with two arguments: (value, key). + * + * @category Object + * @param object The source object. + * @param [predicate=_.identity] The function invoked per property. + * @returns Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.pickBy(object, _.isNumber); + * // => { 'a': 1, 'c': 3 } + */ + (object: T1 | null | undefined): _.PartialObject; +} + +declare const pickBy: PickBy; +export = pickBy; diff --git a/types/lodash/fp/pipe.d.ts b/types/lodash/fp/pipe.d.ts new file mode 100644 index 0000000000..d5fae221ec --- /dev/null +++ b/types/lodash/fp/pipe.d.ts @@ -0,0 +1,355 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Flow { + /** + * 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. + */ + (f1: () => R1, f2: (a: R1) => R2): () => R2; + /** + * 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. + */ + (f1: () => R1, f2: (a: R1) => R2, f3: (a: R2) => R3): () => R3; + /** + * 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. + */ + (f1: () => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4): () => R4; + /** + * 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. + */ + (f1: () => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5): () => R5; + /** + * 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. + */ + (f1: () => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6): () => R6; + /** + * 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. + */ + (f1: () => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6, f7: (a: R6) => R7): () => R7; + /** + * 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. + */ + (f1: () => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6, f7: (a: R6) => R7, ...funcs: Array<_.Many<(a: any) => any>>): () => any; + /** + * 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. + */ + (f1: (a1: A1) => R1, f2: (a: R1) => R2): (a1: A1) => R2; + /** + * 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. + */ + (f1: (a1: A1) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3): (a1: A1) => R3; + /** + * 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. + */ + (f1: (a1: A1) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4): (a1: A1) => R4; + /** + * 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. + */ + (f1: (a1: A1) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5): (a1: A1) => R5; + /** + * 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. + */ + (f1: (a1: A1) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6): (a1: A1) => R6; + /** + * 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. + */ + (f1: (a1: A1) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6, f7: (a: R6) => R7): (a1: A1) => R7; + /** + * 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. + */ + (f1: (a1: A1) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6, f7: (a: R6) => R7, ...funcs: Array<_.Many<(a: any) => any>>): (a1: A1) => any; + /** + * 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. + */ + (f1: (a1: A1, a2: A2) => R1, f2: (a: R1) => R2): (a1: A1, a2: A2) => R2; + /** + * 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. + */ + (f1: (a1: A1, a2: A2) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3): (a1: A1, a2: A2) => R3; + /** + * 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. + */ + (f1: (a1: A1, a2: A2) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4): (a1: A1, a2: A2) => R4; + /** + * 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. + */ + (f1: (a1: A1, a2: A2) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5): (a1: A1, a2: A2) => R5; + /** + * 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. + */ + (f1: (a1: A1, a2: A2) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6): (a1: A1, a2: A2) => R6; + /** + * 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. + */ + (f1: (a1: A1, a2: A2) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6, f7: (a: R6) => R7): (a1: A1, a2: A2) => R7; + /** + * 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. + */ + (f1: (a1: A1, a2: A2) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6, f7: (a: R6) => R7, ...funcs: Array<_.Many<(a: any) => any>>): (a1: A1, a2: A2) => any; + /** + * 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. + */ + (f1: (a1: A1, a2: A2, a3: A3) => R1, f2: (a: R1) => R2): (a1: A1, a2: A2, a3: A3) => R2; + /** + * 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. + */ + (f1: (a1: A1, a2: A2, a3: A3) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3): (a1: A1, a2: A2, a3: A3) => R3; + /** + * 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. + */ + (f1: (a1: A1, a2: A2, a3: A3) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4): (a1: A1, a2: A2, a3: A3) => R4; + /** + * 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. + */ + (f1: (a1: A1, a2: A2, a3: A3) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5): (a1: A1, a2: A2, a3: A3) => R5; + /** + * 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. + */ + (f1: (a1: A1, a2: A2, a3: A3) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6): (a1: A1, a2: A2, a3: A3) => R6; + /** + * 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. + */ + (f1: (a1: A1, a2: A2, a3: A3) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6, f7: (a: R6) => R7): (a1: A1, a2: A2, a3: A3) => R7; + /** + * 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. + */ + (f1: (a1: A1, a2: A2, a3: A3) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6, f7: (a: R6) => R7, ...funcs: Array<_.Many<(a: any) => any>>): (a1: A1, a2: A2, a3: A3) => any; + /** + * 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. + */ + (f1: (a1: A1, a2: A2, a3: A3, a4: A4) => R1, f2: (a: R1) => R2): (a1: A1, a2: A2, a3: A3, a4: A4) => R2; + /** + * 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. + */ + (f1: (a1: A1, a2: A2, a3: A3, a4: A4) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3): (a1: A1, a2: A2, a3: A3, a4: A4) => R3; + /** + * 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. + */ + (f1: (a1: A1, a2: A2, a3: A3, a4: A4) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4): (a1: A1, a2: A2, a3: A3, a4: A4) => R4; + /** + * 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. + */ + (f1: (a1: A1, a2: A2, a3: A3, a4: A4) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5): (a1: A1, a2: A2, a3: A3, a4: A4) => R5; + /** + * 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. + */ + (f1: (a1: A1, a2: A2, a3: A3, a4: A4) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6): (a1: A1, a2: A2, a3: A3, a4: A4) => R6; + /** + * 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. + */ + (f1: (a1: A1, a2: A2, a3: A3, a4: A4) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6, f7: (a: R6) => R7): (a1: A1, a2: A2, a3: A3, a4: A4) => R7; + /** + * 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. + */ + (f1: (a1: A1, a2: A2, a3: A3, a4: A4) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6, f7: (a: R6) => R7, ...funcs: Array<_.Many<(a: any) => any>>): (a1: A1, a2: A2, a3: A3, a4: A4) => any; + /** + * 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. + */ + (f1: (a1: A1, a2: A2, a3: A3, a4: A4, ...args: any[]) => R1, f2: (a: R1) => R2): (a1: A1, a2: A2, a3: A3, a4: A4, ...args: any[]) => R2; + /** + * 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. + */ + (f1: (a1: A1, a2: A2, a3: A3, a4: A4, ...args: any[]) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3): (a1: A1, a2: A2, a3: A3, a4: A4, ...args: any[]) => R3; + /** + * 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. + */ + (f1: (a1: A1, a2: A2, a3: A3, a4: A4, ...args: any[]) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4): (a1: A1, a2: A2, a3: A3, a4: A4, ...args: any[]) => R4; + /** + * 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. + */ + (f1: (a1: A1, a2: A2, a3: A3, a4: A4, ...args: any[]) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5): (a1: A1, a2: A2, a3: A3, a4: A4, ...args: any[]) => R5; + /** + * 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. + */ + (f1: (a1: A1, a2: A2, a3: A3, a4: A4, ...args: any[]) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6): (a1: A1, a2: A2, a3: A3, a4: A4, ...args: any[]) => R6; + /** + * 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. + */ + (f1: (a1: A1, a2: A2, a3: A3, a4: A4, ...args: any[]) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6, f7: (a: R6) => R7): (a1: A1, a2: A2, a3: A3, a4: A4, ...args: any[]) => R7; + /** + * 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. + */ + (f1: (a1: A1, a2: A2, a3: A3, a4: A4, ...args: any[]) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6, f7: (a: R6) => R7, ...funcs: Array<_.Many<(a: any) => any>>): (a1: A1, a2: A2, a3: A3, a4: A4, ...args: any[]) => any; + /** + * 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. + */ + (funcs: Array<_.Many<(...args: any[]) => any>>): (...args: any[]) => any; +} + +declare const pipe: Flow; +export = pipe; diff --git a/types/lodash/fp/pluck.d.ts b/types/lodash/fp/pluck.d.ts new file mode 100644 index 0000000000..eec49c3f59 --- /dev/null +++ b/types/lodash/fp/pluck.d.ts @@ -0,0 +1,588 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Map { + /** + * 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 + * + * @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; + /** + * 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 + * + * @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. + */ + (iteratee: (value: T) => TResult): Map1x1; + /** + * 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 + * + * @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. + */ + (iteratee: (value: T) => TResult, collection: T[] | _.List | null | undefined): TResult[]; + /** + * 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 + * + * @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. + */ + (iteratee: (value: T[keyof T]) => TResult): Map3x1; + /** + * 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 + * + * @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. + */ + (iteratee: (value: T[keyof T]) => TResult, collection: T | null | undefined): TResult[]; + /** + * 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 + * + * @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. + */ + (iteratee: K): Map4x1; + /** + * 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 + * + * @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. + */ + (iteratee: K, collection: _.List | _.Dictionary | _.NumericDictionary | null | undefined): Array; + /** + * 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 + * + * @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. + */ + (iteratee: string): Map5x1; + /** + * 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 + * + * @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. + */ + (iteratee: string, collection: _.List | _.Dictionary | _.NumericDictionary | null | undefined): any[]; + /** + * 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 + * + * @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. + */ + (iteratee: object): Map6x1; + /** + * 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 + * + * @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. + */ + (iteratee: object, collection: _.List | _.Dictionary | _.NumericDictionary | null | undefined): boolean[]; +} +interface Map1x1 { + /** + * 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 + * + * @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. + */ + (): Map1x1; + /** + * 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 + * + * @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. + */ + (collection: T[] | _.List | null | undefined): TResult[]; +} +interface Map3x1 { + /** + * 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 + * + * @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. + */ + (): Map3x1; + /** + * 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 + * + * @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. + */ + (collection: T | null | undefined): TResult[]; +} +interface Map4x1 { + /** + * 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 + * + * @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. + */ + (): Map4x1; + /** + * 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 + * + * @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. + */ + (collection: _.List | _.Dictionary | _.NumericDictionary | null | undefined): Array; +} +interface Map5x1 { + /** + * 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 + * + * @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. + */ + (): Map5x1; + /** + * 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 + * + * @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. + */ + (collection: _.List | _.Dictionary | _.NumericDictionary | null | undefined): any[]; +} +interface Map6x1 { + /** + * 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 + * + * @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. + */ + (): Map6x1; + /** + * 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 + * + * @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. + */ + (collection: _.List | _.Dictionary | _.NumericDictionary | null | undefined): boolean[]; +} + +declare const pluck: Map; +export = pluck; diff --git a/types/lodash/fp/prop.d.ts b/types/lodash/fp/prop.d.ts new file mode 100644 index 0000000000..c7d097d000 --- /dev/null +++ b/types/lodash/fp/prop.d.ts @@ -0,0 +1,207 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Get { + /** + * 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; + /** + * 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. + */ + (path: TKey | [TKey]): Get1x1; + /** + * 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. + */ + (path: TKey | [TKey], object: TObject): TObject[TKey]; + /** + * 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. + */ + (path: TKey | [TKey], object: TObject | null | undefined): TObject[TKey] | undefined; + /** + * 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. + */ + (path: number): Get3x1; + /** + * 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. + */ + (path: number, object: _.NumericDictionary): T; + /** + * 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. + */ + (path: number, object: _.NumericDictionary | null | undefined): T | undefined; + /** + * 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. + */ + (path: _.PropertyPath): Get5x1; + /** + * 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. + */ + (path: _.PropertyPath, object: null | undefined): undefined; + /** + * 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. + */ + (path: _.PropertyPath, object: any): any; +} +interface Get1x1 { + /** + * 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. + */ + (): Get1x1; + /** + * 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. + */ + (object: TObject): TObject[TKey]; + /** + * 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. + */ + (object: TObject | null | undefined): TObject[TKey] | undefined; +} +interface Get3x1 { + /** + * 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. + */ + (): Get3x1; + /** + * 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. + */ + (object: _.NumericDictionary): T; + /** + * 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. + */ + (object: _.NumericDictionary | null | undefined): T | undefined; +} +interface Get5x1 { + /** + * 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. + */ + (): Get5x1; + /** + * 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. + */ + (object: null | undefined): undefined; + /** + * 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. + */ + (object: any): any; +} + +declare const prop: Get; +export = prop; diff --git a/types/lodash/fp/propEq.d.ts b/types/lodash/fp/propEq.d.ts new file mode 100644 index 0000000000..64175cc00a --- /dev/null +++ b/types/lodash/fp/propEq.d.ts @@ -0,0 +1,90 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface MatchesProperty { + /** + * 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; + /** + * 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. + */ + (path: _.PropertyPath): MatchesProperty1x1; + /** + * 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. + */ + (path: _.PropertyPath, srcValue: T): (value: any) => boolean; + /** + * 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. + */ + (path: _.PropertyPath, srcValue: T): (value: V) => boolean; +} +interface MatchesProperty1x1 { + /** + * 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. + */ + (): MatchesProperty1x1; + /** + * 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. + */ + (srcValue: T): (value: any) => boolean; + /** + * 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. + */ + (srcValue: T): (value: V) => boolean; +} + +declare const propEq: MatchesProperty; +export = propEq; diff --git a/types/lodash/fp/propOr.d.ts b/types/lodash/fp/propOr.d.ts new file mode 100644 index 0000000000..cfe67fc51c --- /dev/null +++ b/types/lodash/fp/propOr.d.ts @@ -0,0 +1,313 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Get { + /** + * 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; + /** + * 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. + */ + (defaultValue: TDefault): Get1x1; + /** + * 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. + */ + (defaultValue: TDefault, path: TKey | [TKey]): Get1x2; + /** + * 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. + */ + (defaultValue: TDefault, path: TKey | [TKey], object: TObject | null | undefined): TObject[TKey] | TDefault; + /** + * 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. + */ + (defaultValue: TDefault, path: number): Get2x2; + /** + * 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. + */ + (defaultValue: TDefault, path: number, object: _.NumericDictionary | null | undefined): T | TDefault; + /** + * 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. + */ + (defaultValue: TDefault, path: _.PropertyPath): Get3x2; + /** + * 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. + */ + (defaultValue: TDefault, path: _.PropertyPath, object: null | undefined): TDefault; + /** + * 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. + */ + (defaultValue: any): Get4x1; + /** + * 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. + */ + (defaultValue: any, path: _.PropertyPath): Get4x2; + /** + * 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. + */ + (defaultValue: any, path: _.PropertyPath, object: any): any; +} +interface Get1x1 { + /** + * 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. + */ + (): Get1x1; + /** + * 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. + */ + (path: TKey | [TKey]): Get1x2; + /** + * 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. + */ + (path: TKey | [TKey], object: TObject | null | undefined): TObject[TKey] | TDefault; + /** + * 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. + */ + (path: number): Get2x2; + /** + * 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. + */ + (path: number, object: _.NumericDictionary | null | undefined): T | TDefault; + /** + * 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. + */ + (path: _.PropertyPath): Get3x2; + /** + * 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. + */ + (path: _.PropertyPath, object: null | undefined): TDefault; +} +interface Get1x2 { + /** + * 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. + */ + (): Get1x2; + /** + * 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. + */ + (object: TObject | null | undefined): TObject[TKey] | TDefault; +} +interface Get2x2 { + /** + * 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. + */ + (): Get2x2; + /** + * 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. + */ + (object: _.NumericDictionary | null | undefined): T | TDefault; +} +interface Get3x2 { + /** + * 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. + */ + (): Get3x2; + /** + * 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. + */ + (object: null | undefined): TDefault; +} +interface Get4x1 { + /** + * 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. + */ + (): Get4x1; + /** + * 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. + */ + (path: _.PropertyPath): Get4x2; + /** + * 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. + */ + (path: _.PropertyPath, object: any): any; +} +interface Get4x2 { + /** + * 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. + */ + (): Get4x2; + /** + * 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. + */ + (object: any): any; +} + +declare const propOr: Get; +export = propOr; diff --git a/types/lodash/fp/property.d.ts b/types/lodash/fp/property.d.ts new file mode 100644 index 0000000000..47a4285028 --- /dev/null +++ b/types/lodash/fp/property.d.ts @@ -0,0 +1,207 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Get { + /** + * 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; + /** + * 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. + */ + (path: TKey | [TKey]): Get1x1; + /** + * 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. + */ + (path: TKey | [TKey], object: TObject): TObject[TKey]; + /** + * 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. + */ + (path: TKey | [TKey], object: TObject | null | undefined): TObject[TKey] | undefined; + /** + * 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. + */ + (path: number): Get3x1; + /** + * 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. + */ + (path: number, object: _.NumericDictionary): T; + /** + * 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. + */ + (path: number, object: _.NumericDictionary | null | undefined): T | undefined; + /** + * 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. + */ + (path: _.PropertyPath): Get5x1; + /** + * 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. + */ + (path: _.PropertyPath, object: null | undefined): undefined; + /** + * 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. + */ + (path: _.PropertyPath, object: any): any; +} +interface Get1x1 { + /** + * 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. + */ + (): Get1x1; + /** + * 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. + */ + (object: TObject): TObject[TKey]; + /** + * 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. + */ + (object: TObject | null | undefined): TObject[TKey] | undefined; +} +interface Get3x1 { + /** + * 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. + */ + (): Get3x1; + /** + * 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. + */ + (object: _.NumericDictionary): T; + /** + * 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. + */ + (object: _.NumericDictionary | null | undefined): T | undefined; +} +interface Get5x1 { + /** + * 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. + */ + (): Get5x1; + /** + * 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. + */ + (object: null | undefined): undefined; + /** + * 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. + */ + (object: any): any; +} + +declare const property: Get; +export = property; diff --git a/types/lodash/fp/propertyOf.d.ts b/types/lodash/fp/propertyOf.d.ts new file mode 100644 index 0000000000..66e2afdaf8 --- /dev/null +++ b/types/lodash/fp/propertyOf.d.ts @@ -0,0 +1,207 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Get { + /** + * 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; + /** + * 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. + */ + (path: TKey | [TKey]): Get1x1; + /** + * 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. + */ + (path: TKey | [TKey], object: TObject): TObject[TKey]; + /** + * 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. + */ + (path: TKey | [TKey], object: TObject | null | undefined): TObject[TKey] | undefined; + /** + * 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. + */ + (path: number): Get3x1; + /** + * 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. + */ + (path: number, object: _.NumericDictionary): T; + /** + * 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. + */ + (path: number, object: _.NumericDictionary | null | undefined): T | undefined; + /** + * 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. + */ + (path: _.PropertyPath): Get5x1; + /** + * 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. + */ + (path: _.PropertyPath, object: null | undefined): undefined; + /** + * 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. + */ + (path: _.PropertyPath, object: any): any; +} +interface Get1x1 { + /** + * 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. + */ + (): Get1x1; + /** + * 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. + */ + (object: TObject): TObject[TKey]; + /** + * 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. + */ + (object: TObject | null | undefined): TObject[TKey] | undefined; +} +interface Get3x1 { + /** + * 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. + */ + (): Get3x1; + /** + * 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. + */ + (object: _.NumericDictionary): T; + /** + * 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. + */ + (object: _.NumericDictionary | null | undefined): T | undefined; +} +interface Get5x1 { + /** + * 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. + */ + (): Get5x1; + /** + * 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. + */ + (object: null | undefined): undefined; + /** + * 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. + */ + (object: any): any; +} + +declare const propertyOf: Get; +export = propertyOf; diff --git a/types/lodash/fp/props.d.ts b/types/lodash/fp/props.d.ts new file mode 100644 index 0000000000..2b22346229 --- /dev/null +++ b/types/lodash/fp/props.d.ts @@ -0,0 +1,96 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface At { + /** + * 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 object The object 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; + /** + * 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 object The object 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. + */ + (props: _.PropertyPath): At1x1; + /** + * 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 object The object 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. + */ + (props: _.PropertyPath, object: _.List | _.Dictionary | _.NumericDictionary | null | undefined): T[]; + /** + * 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 object The object 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. + */ + (props: _.Many): At2x1; + /** + * 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 object The object 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. + */ + (props: _.Many, object: T | null | undefined): Array; +} +interface At1x1 { + /** + * 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 object The object 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. + */ + (): At1x1; + /** + * 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 object The object 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. + */ + (object: _.List | _.Dictionary | _.NumericDictionary | null | undefined): T[]; +} +interface At2x1 { + /** + * 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 object The object 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. + */ + (): At2x1; + /** + * 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 object The object 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. + */ + (object: T | null | undefined): Array; +} + +declare const props: At; +export = props; diff --git a/types/lodash/fp/pull.d.ts b/types/lodash/fp/pull.d.ts new file mode 100644 index 0000000000..3ae9a76b4c --- /dev/null +++ b/types/lodash/fp/pull.d.ts @@ -0,0 +1,83 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Pull { + /** + * 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; + /** + * 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. + */ + (values: T): Pull1x1; + /** + * 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. + */ + (values: T, array: ReadonlyArray): T[]; + /** + * 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. + */ + (values: T, array: _.List): _.List; +} +interface Pull1x1 { + /** + * 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. + */ + (): Pull1x1; + /** + * 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. + */ + (array: ReadonlyArray): T[]; + /** + * 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. + */ + (array: _.List): _.List; +} + +declare const pull: Pull; +export = pull; diff --git a/types/lodash/fp/pullAll.d.ts b/types/lodash/fp/pullAll.d.ts new file mode 100644 index 0000000000..6df0d3fbe6 --- /dev/null +++ b/types/lodash/fp/pullAll.d.ts @@ -0,0 +1,139 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface PullAll { + /** + * This method is like `_.pull` except that it accepts an array of values to remove. + * + * **Note:** Unlike `_.difference`, this method mutates `array`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @returns Returns `array`. + * @example + * + * var array = [1, 2, 3, 1, 2, 3]; + * + * _.pull(array, [2, 3]); + * console.log(array); + * // => [1, 1] + */ + (): PullAll; + /** + * This method is like `_.pull` except that it accepts an array of values to remove. + * + * **Note:** Unlike `_.difference`, this method mutates `array`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @returns Returns `array`. + * @example + * + * var array = [1, 2, 3, 1, 2, 3]; + * + * _.pull(array, [2, 3]); + * console.log(array); + * // => [1, 1] + */ + (values: _.List): PullAll1x1; + /** + * This method is like `_.pull` except that it accepts an array of values to remove. + * + * **Note:** Unlike `_.difference`, this method mutates `array`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @returns Returns `array`. + * @example + * + * var array = [1, 2, 3, 1, 2, 3]; + * + * _.pull(array, [2, 3]); + * console.log(array); + * // => [1, 1] + */ + (values: _.List, array: ReadonlyArray): T[]; + /** + * This method is like `_.pull` except that it accepts an array of values to remove. + * + * **Note:** Unlike `_.difference`, this method mutates `array`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @returns Returns `array`. + * @example + * + * var array = [1, 2, 3, 1, 2, 3]; + * + * _.pull(array, [2, 3]); + * console.log(array); + * // => [1, 1] + */ + (values: _.List, array: _.List): _.List; +} +interface PullAll1x1 { + /** + * This method is like `_.pull` except that it accepts an array of values to remove. + * + * **Note:** Unlike `_.difference`, this method mutates `array`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @returns Returns `array`. + * @example + * + * var array = [1, 2, 3, 1, 2, 3]; + * + * _.pull(array, [2, 3]); + * console.log(array); + * // => [1, 1] + */ + (): PullAll1x1; + /** + * This method is like `_.pull` except that it accepts an array of values to remove. + * + * **Note:** Unlike `_.difference`, this method mutates `array`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @returns Returns `array`. + * @example + * + * var array = [1, 2, 3, 1, 2, 3]; + * + * _.pull(array, [2, 3]); + * console.log(array); + * // => [1, 1] + */ + (array: ReadonlyArray): T[]; + /** + * This method is like `_.pull` except that it accepts an array of values to remove. + * + * **Note:** Unlike `_.difference`, this method mutates `array`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @returns Returns `array`. + * @example + * + * var array = [1, 2, 3, 1, 2, 3]; + * + * _.pull(array, [2, 3]); + * console.log(array); + * // => [1, 1] + */ + (array: _.List): _.List; +} + +declare const pullAll: PullAll; +export = pullAll; diff --git a/types/lodash/fp/pullAllBy.d.ts b/types/lodash/fp/pullAllBy.d.ts new file mode 100644 index 0000000000..05a528de2d --- /dev/null +++ b/types/lodash/fp/pullAllBy.d.ts @@ -0,0 +1,502 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface PullAllBy { + /** + * 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`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns 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; + /** + * 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`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns 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 }] + */ + (iteratee: _.ValueIteratee): PullAllBy1x1; + /** + * 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`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns 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 }] + */ + (iteratee: _.ValueIteratee, values: _.List): PullAllBy1x2; + /** + * 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`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns 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 }] + */ + (iteratee: _.ValueIteratee, values: _.List, array: ReadonlyArray): T[]; + /** + * 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`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns 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 }] + */ + (iteratee: _.ValueIteratee, values: _.List, array: _.List): _.List; + /** + * 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`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns 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 }] + */ + (iteratee: _.ValueIteratee): PullAllBy3x1; + /** + * 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`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns 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 }] + */ + (iteratee: _.ValueIteratee, values: _.List): PullAllBy3x2; + /** + * 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`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns 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 }] + */ + (iteratee: _.ValueIteratee, values: _.List, array: ReadonlyArray): T1[]; + /** + * 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`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns 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 }] + */ + (iteratee: _.ValueIteratee, values: _.List, array: _.List): _.List; +} +interface PullAllBy1x1 { + /** + * 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`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns 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 }] + */ + (): PullAllBy1x1; + /** + * 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`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns 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 }] + */ + (values: _.List): PullAllBy1x2; + /** + * 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`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns 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 }] + */ + (values: _.List, array: ReadonlyArray): T[]; + /** + * 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`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns 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 }] + */ + (values: _.List, array: _.List): _.List; +} +interface PullAllBy1x2 { + /** + * 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`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns 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 }] + */ + (): PullAllBy1x2; + /** + * 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`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns 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 }] + */ + (array: ReadonlyArray): T[]; + /** + * 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`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns 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 }] + */ + (array: _.List): _.List; +} +interface PullAllBy3x1 { + /** + * 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`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns 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 }] + */ + (): PullAllBy3x1; + /** + * 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`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns 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 }] + */ + (values: _.List): PullAllBy3x2; + /** + * 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`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns 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 }] + */ + (values: _.List, array: ReadonlyArray): T1[]; + /** + * 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`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns 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 }] + */ + (values: _.List, array: _.List): _.List; +} +interface PullAllBy3x2 { + /** + * 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`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns 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 }] + */ + (): PullAllBy3x2; + /** + * 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`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns 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 }] + */ + (array: ReadonlyArray): T1[]; + /** + * 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`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns 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 }] + */ + (array: _.List): _.List; +} + +declare const pullAllBy: PullAllBy; +export = pullAllBy; diff --git a/types/lodash/fp/pullAllWith.d.ts b/types/lodash/fp/pullAllWith.d.ts new file mode 100644 index 0000000000..566eb5ae84 --- /dev/null +++ b/types/lodash/fp/pullAllWith.d.ts @@ -0,0 +1,502 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface PullAllWith { + /** + * This method is like `_.pullAll` except that it accepts `comparator` which is + * invoked to compare elements of array to values. The comparator is invoked with + * two arguments: (arrVal, othVal). + * + * **Note:** Unlike `_.differenceWith`, this method mutates `array`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns `array`. + * @example + * + * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }]; + * + * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual); + * console.log(array); + * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }] + */ + (): PullAllWith; + /** + * This method is like `_.pullAll` except that it accepts `comparator` which is + * invoked to compare elements of array to values. The comparator is invoked with + * two arguments: (arrVal, othVal). + * + * **Note:** Unlike `_.differenceWith`, this method mutates `array`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns `array`. + * @example + * + * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }]; + * + * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual); + * console.log(array); + * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }] + */ + (comparator: _.Comparator): PullAllWith1x1; + /** + * This method is like `_.pullAll` except that it accepts `comparator` which is + * invoked to compare elements of array to values. The comparator is invoked with + * two arguments: (arrVal, othVal). + * + * **Note:** Unlike `_.differenceWith`, this method mutates `array`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns `array`. + * @example + * + * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }]; + * + * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual); + * console.log(array); + * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }] + */ + (comparator: _.Comparator, values: _.List): PullAllWith1x2; + /** + * This method is like `_.pullAll` except that it accepts `comparator` which is + * invoked to compare elements of array to values. The comparator is invoked with + * two arguments: (arrVal, othVal). + * + * **Note:** Unlike `_.differenceWith`, this method mutates `array`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns `array`. + * @example + * + * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }]; + * + * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual); + * console.log(array); + * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }] + */ + (comparator: _.Comparator, values: _.List, array: ReadonlyArray): T[]; + /** + * This method is like `_.pullAll` except that it accepts `comparator` which is + * invoked to compare elements of array to values. The comparator is invoked with + * two arguments: (arrVal, othVal). + * + * **Note:** Unlike `_.differenceWith`, this method mutates `array`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns `array`. + * @example + * + * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }]; + * + * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual); + * console.log(array); + * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }] + */ + (comparator: _.Comparator, values: _.List, array: _.List): _.List; + /** + * This method is like `_.pullAll` except that it accepts `comparator` which is + * invoked to compare elements of array to values. The comparator is invoked with + * two arguments: (arrVal, othVal). + * + * **Note:** Unlike `_.differenceWith`, this method mutates `array`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns `array`. + * @example + * + * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }]; + * + * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual); + * console.log(array); + * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }] + */ + (comparator: _.Comparator2): PullAllWith3x1; + /** + * This method is like `_.pullAll` except that it accepts `comparator` which is + * invoked to compare elements of array to values. The comparator is invoked with + * two arguments: (arrVal, othVal). + * + * **Note:** Unlike `_.differenceWith`, this method mutates `array`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns `array`. + * @example + * + * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }]; + * + * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual); + * console.log(array); + * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }] + */ + (comparator: _.Comparator2, values: _.List): PullAllWith3x2; + /** + * This method is like `_.pullAll` except that it accepts `comparator` which is + * invoked to compare elements of array to values. The comparator is invoked with + * two arguments: (arrVal, othVal). + * + * **Note:** Unlike `_.differenceWith`, this method mutates `array`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns `array`. + * @example + * + * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }]; + * + * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual); + * console.log(array); + * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }] + */ + (comparator: _.Comparator2, values: _.List, array: ReadonlyArray): T1[]; + /** + * This method is like `_.pullAll` except that it accepts `comparator` which is + * invoked to compare elements of array to values. The comparator is invoked with + * two arguments: (arrVal, othVal). + * + * **Note:** Unlike `_.differenceWith`, this method mutates `array`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns `array`. + * @example + * + * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }]; + * + * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual); + * console.log(array); + * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }] + */ + (comparator: _.Comparator2, values: _.List, array: _.List): _.List; +} +interface PullAllWith1x1 { + /** + * This method is like `_.pullAll` except that it accepts `comparator` which is + * invoked to compare elements of array to values. The comparator is invoked with + * two arguments: (arrVal, othVal). + * + * **Note:** Unlike `_.differenceWith`, this method mutates `array`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns `array`. + * @example + * + * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }]; + * + * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual); + * console.log(array); + * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }] + */ + (): PullAllWith1x1; + /** + * This method is like `_.pullAll` except that it accepts `comparator` which is + * invoked to compare elements of array to values. The comparator is invoked with + * two arguments: (arrVal, othVal). + * + * **Note:** Unlike `_.differenceWith`, this method mutates `array`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns `array`. + * @example + * + * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }]; + * + * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual); + * console.log(array); + * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }] + */ + (values: _.List): PullAllWith1x2; + /** + * This method is like `_.pullAll` except that it accepts `comparator` which is + * invoked to compare elements of array to values. The comparator is invoked with + * two arguments: (arrVal, othVal). + * + * **Note:** Unlike `_.differenceWith`, this method mutates `array`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns `array`. + * @example + * + * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }]; + * + * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual); + * console.log(array); + * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }] + */ + (values: _.List, array: ReadonlyArray): T[]; + /** + * This method is like `_.pullAll` except that it accepts `comparator` which is + * invoked to compare elements of array to values. The comparator is invoked with + * two arguments: (arrVal, othVal). + * + * **Note:** Unlike `_.differenceWith`, this method mutates `array`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns `array`. + * @example + * + * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }]; + * + * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual); + * console.log(array); + * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }] + */ + (values: _.List, array: _.List): _.List; +} +interface PullAllWith1x2 { + /** + * This method is like `_.pullAll` except that it accepts `comparator` which is + * invoked to compare elements of array to values. The comparator is invoked with + * two arguments: (arrVal, othVal). + * + * **Note:** Unlike `_.differenceWith`, this method mutates `array`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns `array`. + * @example + * + * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }]; + * + * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual); + * console.log(array); + * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }] + */ + (): PullAllWith1x2; + /** + * This method is like `_.pullAll` except that it accepts `comparator` which is + * invoked to compare elements of array to values. The comparator is invoked with + * two arguments: (arrVal, othVal). + * + * **Note:** Unlike `_.differenceWith`, this method mutates `array`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns `array`. + * @example + * + * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }]; + * + * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual); + * console.log(array); + * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }] + */ + (array: ReadonlyArray): T[]; + /** + * This method is like `_.pullAll` except that it accepts `comparator` which is + * invoked to compare elements of array to values. The comparator is invoked with + * two arguments: (arrVal, othVal). + * + * **Note:** Unlike `_.differenceWith`, this method mutates `array`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns `array`. + * @example + * + * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }]; + * + * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual); + * console.log(array); + * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }] + */ + (array: _.List): _.List; +} +interface PullAllWith3x1 { + /** + * This method is like `_.pullAll` except that it accepts `comparator` which is + * invoked to compare elements of array to values. The comparator is invoked with + * two arguments: (arrVal, othVal). + * + * **Note:** Unlike `_.differenceWith`, this method mutates `array`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns `array`. + * @example + * + * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }]; + * + * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual); + * console.log(array); + * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }] + */ + (): PullAllWith3x1; + /** + * This method is like `_.pullAll` except that it accepts `comparator` which is + * invoked to compare elements of array to values. The comparator is invoked with + * two arguments: (arrVal, othVal). + * + * **Note:** Unlike `_.differenceWith`, this method mutates `array`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns `array`. + * @example + * + * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }]; + * + * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual); + * console.log(array); + * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }] + */ + (values: _.List): PullAllWith3x2; + /** + * This method is like `_.pullAll` except that it accepts `comparator` which is + * invoked to compare elements of array to values. The comparator is invoked with + * two arguments: (arrVal, othVal). + * + * **Note:** Unlike `_.differenceWith`, this method mutates `array`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns `array`. + * @example + * + * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }]; + * + * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual); + * console.log(array); + * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }] + */ + (values: _.List, array: ReadonlyArray): T1[]; + /** + * This method is like `_.pullAll` except that it accepts `comparator` which is + * invoked to compare elements of array to values. The comparator is invoked with + * two arguments: (arrVal, othVal). + * + * **Note:** Unlike `_.differenceWith`, this method mutates `array`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns `array`. + * @example + * + * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }]; + * + * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual); + * console.log(array); + * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }] + */ + (values: _.List, array: _.List): _.List; +} +interface PullAllWith3x2 { + /** + * This method is like `_.pullAll` except that it accepts `comparator` which is + * invoked to compare elements of array to values. The comparator is invoked with + * two arguments: (arrVal, othVal). + * + * **Note:** Unlike `_.differenceWith`, this method mutates `array`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns `array`. + * @example + * + * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }]; + * + * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual); + * console.log(array); + * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }] + */ + (): PullAllWith3x2; + /** + * This method is like `_.pullAll` except that it accepts `comparator` which is + * invoked to compare elements of array to values. The comparator is invoked with + * two arguments: (arrVal, othVal). + * + * **Note:** Unlike `_.differenceWith`, this method mutates `array`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns `array`. + * @example + * + * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }]; + * + * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual); + * console.log(array); + * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }] + */ + (array: ReadonlyArray): T1[]; + /** + * This method is like `_.pullAll` except that it accepts `comparator` which is + * invoked to compare elements of array to values. The comparator is invoked with + * two arguments: (arrVal, othVal). + * + * **Note:** Unlike `_.differenceWith`, this method mutates `array`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns `array`. + * @example + * + * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }]; + * + * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual); + * console.log(array); + * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }] + */ + (array: _.List): _.List; +} + +declare const pullAllWith: PullAllWith; +export = pullAllWith; diff --git a/types/lodash/fp/pullAt.d.ts b/types/lodash/fp/pullAt.d.ts new file mode 100644 index 0000000000..61d6fd04f0 --- /dev/null +++ b/types/lodash/fp/pullAt.d.ts @@ -0,0 +1,90 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface PullAt { + /** + * 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; + /** + * 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. + */ + (indexes: _.Many): PullAt1x1; + /** + * 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. + */ + (indexes: _.Many, array: ReadonlyArray): T[]; + /** + * 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. + */ + (indexes: _.Many, array: _.List): _.List; +} +interface PullAt1x1 { + /** + * 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. + */ + (): PullAt1x1; + /** + * 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. + */ + (array: ReadonlyArray): T[]; + /** + * 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. + */ + (array: _.List): _.List; +} + +declare const pullAt: PullAt; +export = pullAt; diff --git a/types/lodash/fp/random.d.ts b/types/lodash/fp/random.d.ts new file mode 100644 index 0000000000..075b54b2e4 --- /dev/null +++ b/types/lodash/fp/random.d.ts @@ -0,0 +1,66 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface Random { + /** + * 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; + /** + * 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. + */ + (maxOrMin: number): Random1x1; + /** + * 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. + */ + (maxOrMin: number, floatingOrMax: boolean | number): number; +} +interface Random1x1 { + /** + * 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. + */ + (): Random1x1; + /** + * 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. + */ + (floatingOrMax: boolean | number): number; +} + +declare const random: Random; +export = random; diff --git a/types/lodash/fp/range.d.ts b/types/lodash/fp/range.d.ts new file mode 100644 index 0000000000..7526d40e03 --- /dev/null +++ b/types/lodash/fp/range.d.ts @@ -0,0 +1,66 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface Range { + /** + * 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; + /** + * 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. + */ + (start: number): Range1x1; + /** + * 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. + */ + (start: number, end: number): number[]; +} +interface Range1x1 { + /** + * 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. + */ + (): Range1x1; + /** + * 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. + */ + (end: number): number[]; +} + +declare const range: Range; +export = range; diff --git a/types/lodash/fp/rangeRight.d.ts b/types/lodash/fp/rangeRight.d.ts new file mode 100644 index 0000000000..89337d055a --- /dev/null +++ b/types/lodash/fp/rangeRight.d.ts @@ -0,0 +1,176 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface RangeRight { + /** + * This method is like `_.range` except that it populates values in + * descending order. + * + * @category Util + * @param start The start of the range. + * @param end The end of the range. + * @param step The value to increment or decrement by. + * @returns 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; + /** + * This method is like `_.range` except that it populates values in + * descending order. + * + * @category Util + * @param start The start of the range. + * @param end The end of the range. + * @param step The value to increment or decrement by. + * @returns 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); + * // => [] + */ + (start: number): RangeRight1x1; + /** + * This method is like `_.range` except that it populates values in + * descending order. + * + * @category Util + * @param start The start of the range. + * @param end The end of the range. + * @param step The value to increment or decrement by. + * @returns 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); + * // => [] + */ + (start: number, end: number): number[]; +} +interface RangeRight1x1 { + /** + * This method is like `_.range` except that it populates values in + * descending order. + * + * @category Util + * @param start The start of the range. + * @param end The end of the range. + * @param step The value to increment or decrement by. + * @returns 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); + * // => [] + */ + (): RangeRight1x1; + /** + * This method is like `_.range` except that it populates values in + * descending order. + * + * @category Util + * @param start The start of the range. + * @param end The end of the range. + * @param step The value to increment or decrement by. + * @returns 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); + * // => [] + */ + (end: number): number[]; +} + +declare const rangeRight: RangeRight; +export = rangeRight; diff --git a/types/lodash/fp/rangeStep.d.ts b/types/lodash/fp/rangeStep.d.ts new file mode 100644 index 0000000000..1bd70ebf55 --- /dev/null +++ b/types/lodash/fp/rangeStep.d.ts @@ -0,0 +1,112 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface Range { + /** + * 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; + /** + * 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. + */ + (start: number): Range1x1; + /** + * 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. + */ + (start: number, end: number): Range1x2; + /** + * 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. + */ + (start: number, end: number, step: number): number[]; +} +interface Range1x1 { + /** + * 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. + */ + (): Range1x1; + /** + * 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. + */ + (end: number): Range1x2; + /** + * 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. + */ + (end: number, step: number): number[]; +} +interface Range1x2 { + /** + * 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. + */ + (): Range1x2; + /** + * 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. + */ + (step: number): number[]; +} + +declare const rangeStep: Range; +export = rangeStep; diff --git a/types/lodash/fp/rangeStepRight.d.ts b/types/lodash/fp/rangeStepRight.d.ts new file mode 100644 index 0000000000..dcc223f569 --- /dev/null +++ b/types/lodash/fp/rangeStepRight.d.ts @@ -0,0 +1,310 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface RangeRight { + /** + * This method is like `_.range` except that it populates values in + * descending order. + * + * @category Util + * @param start The start of the range. + * @param end The end of the range. + * @param step The value to increment or decrement by. + * @returns 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; + /** + * This method is like `_.range` except that it populates values in + * descending order. + * + * @category Util + * @param start The start of the range. + * @param end The end of the range. + * @param step The value to increment or decrement by. + * @returns 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); + * // => [] + */ + (start: number): RangeRight1x1; + /** + * This method is like `_.range` except that it populates values in + * descending order. + * + * @category Util + * @param start The start of the range. + * @param end The end of the range. + * @param step The value to increment or decrement by. + * @returns 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); + * // => [] + */ + (start: number, end: number): RangeRight1x2; + /** + * This method is like `_.range` except that it populates values in + * descending order. + * + * @category Util + * @param start The start of the range. + * @param end The end of the range. + * @param step The value to increment or decrement by. + * @returns 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); + * // => [] + */ + (start: number, end: number, step: number): number[]; +} +interface RangeRight1x1 { + /** + * This method is like `_.range` except that it populates values in + * descending order. + * + * @category Util + * @param start The start of the range. + * @param end The end of the range. + * @param step The value to increment or decrement by. + * @returns 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); + * // => [] + */ + (): RangeRight1x1; + /** + * This method is like `_.range` except that it populates values in + * descending order. + * + * @category Util + * @param start The start of the range. + * @param end The end of the range. + * @param step The value to increment or decrement by. + * @returns 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); + * // => [] + */ + (end: number): RangeRight1x2; + /** + * This method is like `_.range` except that it populates values in + * descending order. + * + * @category Util + * @param start The start of the range. + * @param end The end of the range. + * @param step The value to increment or decrement by. + * @returns 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); + * // => [] + */ + (end: number, step: number): number[]; +} +interface RangeRight1x2 { + /** + * This method is like `_.range` except that it populates values in + * descending order. + * + * @category Util + * @param start The start of the range. + * @param end The end of the range. + * @param step The value to increment or decrement by. + * @returns 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); + * // => [] + */ + (): RangeRight1x2; + /** + * This method is like `_.range` except that it populates values in + * descending order. + * + * @category Util + * @param start The start of the range. + * @param end The end of the range. + * @param step The value to increment or decrement by. + * @returns 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); + * // => [] + */ + (step: number): number[]; +} + +declare const rangeStepRight: RangeRight; +export = rangeStepRight; diff --git a/types/lodash/fp/rearg.d.ts b/types/lodash/fp/rearg.d.ts new file mode 100644 index 0000000000..9ff0dbccfb --- /dev/null +++ b/types/lodash/fp/rearg.d.ts @@ -0,0 +1,58 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Rearg { + /** + * 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; + /** + * 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. + */ + (indexes: _.Many): Rearg1x1; + /** + * 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. + */ + (indexes: _.Many, func: (...args: any[]) => any): (...args: any[]) => any; +} +interface Rearg1x1 { + /** + * 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. + */ + (): Rearg1x1; + /** + * 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. + */ + (func: (...args: any[]) => any): (...args: any[]) => any; +} + +declare const rearg: Rearg; +export = rearg; diff --git a/types/lodash/fp/reduce.d.ts b/types/lodash/fp/reduce.d.ts new file mode 100644 index 0000000000..70071a64e3 --- /dev/null +++ b/types/lodash/fp/reduce.d.ts @@ -0,0 +1,223 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Reduce { + /** + * 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. + * @return Returns the accumulated value. + **/ + (): Reduce; + /** + * 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. + * @return Returns the accumulated value. + **/ + (callback: _.MemoIteratorCapped): Reduce1x1; + /** + * 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. + * @return Returns the accumulated value. + **/ + (callback: _.MemoIteratorCapped, accumulator: TResult): Reduce1x2; + /** + * 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. + * @return Returns the accumulated value. + **/ + (callback: _.MemoIteratorCapped, accumulator: TResult, collection: T[] | _.List | null | undefined): TResult; + /** + * 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. + * @return Returns the accumulated value. + **/ + (callback: _.MemoIteratorCapped): Reduce3x1; + /** + * 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. + * @return Returns the accumulated value. + **/ + (callback: _.MemoIteratorCapped, accumulator: TResult): Reduce3x2; + /** + * 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. + * @return Returns the accumulated value. + **/ + (callback: _.MemoIteratorCapped, accumulator: TResult, collection: T | null | undefined): TResult; +} +interface Reduce1x1 { + /** + * 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. + * @return Returns the accumulated value. + **/ + (): Reduce1x1; + /** + * 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. + * @return Returns the accumulated value. + **/ + (accumulator: TResult): Reduce1x2; + /** + * 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. + * @return Returns the accumulated value. + **/ + (accumulator: TResult, collection: T[] | _.List | null | undefined): TResult; +} +interface Reduce1x2 { + /** + * 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. + * @return Returns the accumulated value. + **/ + (): Reduce1x2; + /** + * 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. + * @return Returns the accumulated value. + **/ + (collection: T[] | _.List | null | undefined): TResult; +} +interface Reduce3x1 { + /** + * 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. + * @return Returns the accumulated value. + **/ + (): Reduce3x1; + /** + * 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. + * @return Returns the accumulated value. + **/ + (accumulator: TResult): Reduce3x2; + /** + * 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. + * @return Returns the accumulated value. + **/ + (accumulator: TResult, collection: T | null | undefined): TResult; +} +interface Reduce3x2 { + /** + * 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. + * @return Returns the accumulated value. + **/ + (): Reduce3x2; + /** + * 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. + * @return Returns the accumulated value. + **/ + (collection: T | null | undefined): TResult; +} + +declare const reduce: Reduce; +export = reduce; diff --git a/types/lodash/fp/reduceRight.d.ts b/types/lodash/fp/reduceRight.d.ts new file mode 100644 index 0000000000..0c8813aa01 --- /dev/null +++ b/types/lodash/fp/reduceRight.d.ts @@ -0,0 +1,172 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface ReduceRight { + /** + * 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. + * @return The accumulated value. + **/ + (): ReduceRight; + /** + * 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. + * @return The accumulated value. + **/ + (callback: _.MemoIteratorCappedRight): ReduceRight1x1; + /** + * 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. + * @return The accumulated value. + **/ + (callback: _.MemoIteratorCappedRight, accumulator: TResult): ReduceRight1x2; + /** + * 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. + * @return The accumulated value. + **/ + (callback: _.MemoIteratorCappedRight, accumulator: TResult, collection: T[] | _.List | null | undefined): TResult; + /** + * 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. + * @return The accumulated value. + **/ + (callback: _.MemoIteratorCappedRight): ReduceRight3x1; + /** + * 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. + * @return The accumulated value. + **/ + (callback: _.MemoIteratorCappedRight, accumulator: TResult): ReduceRight3x2; + /** + * 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. + * @return The accumulated value. + **/ + (callback: _.MemoIteratorCappedRight, accumulator: TResult, collection: T | null | undefined): TResult; +} +interface ReduceRight1x1 { + /** + * 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. + * @return The accumulated value. + **/ + (): ReduceRight1x1; + /** + * 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. + * @return The accumulated value. + **/ + (accumulator: TResult): ReduceRight1x2; + /** + * 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. + * @return The accumulated value. + **/ + (accumulator: TResult, collection: T[] | _.List | null | undefined): TResult; +} +interface ReduceRight1x2 { + /** + * 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. + * @return The accumulated value. + **/ + (): ReduceRight1x2; + /** + * 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. + * @return The accumulated value. + **/ + (collection: T[] | _.List | null | undefined): TResult; +} +interface ReduceRight3x1 { + /** + * 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. + * @return The accumulated value. + **/ + (): ReduceRight3x1; + /** + * 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. + * @return The accumulated value. + **/ + (accumulator: TResult): ReduceRight3x2; + /** + * 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. + * @return The accumulated value. + **/ + (accumulator: TResult, collection: T | null | undefined): TResult; +} +interface ReduceRight3x2 { + /** + * 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. + * @return The accumulated value. + **/ + (): ReduceRight3x2; + /** + * 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. + * @return The accumulated value. + **/ + (collection: T | null | undefined): TResult; +} + +declare const reduceRight: ReduceRight; +export = reduceRight; diff --git a/types/lodash/fp/reject.d.ts b/types/lodash/fp/reject.d.ts new file mode 100644 index 0000000000..74a93c3783 --- /dev/null +++ b/types/lodash/fp/reject.d.ts @@ -0,0 +1,115 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Reject { + /** + * 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; + /** + * 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. + */ + (predicate: (value: string) => boolean): Reject1x1; + /** + * 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. + */ + (predicate: (value: string) => boolean, collection: string | null | undefined): string[]; + /** + * 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. + */ + (predicate: _.ValueIterateeCustom): Reject2x1; + /** + * 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. + */ + (predicate: _.ValueIterateeCustom, collection: _.List | null | undefined): T[]; + /** + * 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. + */ + (predicate: _.ValueIterateeCustom, collection: T | null | undefined): Array; +} +interface Reject1x1 { + /** + * 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. + */ + (): Reject1x1; + /** + * 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. + */ + (collection: string | null | undefined): string[]; +} +interface Reject2x1 { + /** + * 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. + */ + (): Reject2x1; + /** + * 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. + */ + (collection: _.List | object | null | undefined): T[]; +} + +declare const reject: Reject; +export = reject; diff --git a/types/lodash/fp/remove.d.ts b/types/lodash/fp/remove.d.ts new file mode 100644 index 0000000000..51ac8aecf8 --- /dev/null +++ b/types/lodash/fp/remove.d.ts @@ -0,0 +1,118 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Remove { + /** + * 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; + /** + * 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. + */ + (predicate: _.ValueIteratee): Remove1x1; + /** + * 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. + */ + (predicate: _.ValueIteratee, array: _.List): T[]; +} +interface Remove1x1 { + /** + * 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. + */ + (): Remove1x1; + /** + * 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. + */ + (array: _.List): T[]; +} + +declare const remove: Remove; +export = remove; diff --git a/types/lodash/fp/repeat.d.ts b/types/lodash/fp/repeat.d.ts new file mode 100644 index 0000000000..4ba7cd4e17 --- /dev/null +++ b/types/lodash/fp/repeat.d.ts @@ -0,0 +1,51 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface Repeat { + /** + * 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; + /** + * 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. + */ + (n: number): Repeat1x1; + /** + * 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. + */ + (n: number, string: string): string; +} +interface Repeat1x1 { + /** + * 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. + */ + (): Repeat1x1; + /** + * 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. + */ + (string: string): string; +} + +declare const repeat: Repeat; +export = repeat; diff --git a/types/lodash/fp/replace.d.ts b/types/lodash/fp/replace.d.ts new file mode 100644 index 0000000000..18e76a4388 --- /dev/null +++ b/types/lodash/fp/replace.d.ts @@ -0,0 +1,87 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Replace { + /** + * Replaces matches for pattern in string with replacement. + * + * Note: This method is based on String#replace. + * + * @return Returns the modified string. + */ + (): Replace; + /** + * Replaces matches for pattern in string with replacement. + * + * Note: This method is based on String#replace. + * + * @return Returns the modified string. + */ + (pattern: RegExp | string): Replace1x1; + /** + * Replaces matches for pattern in string with replacement. + * + * Note: This method is based on String#replace. + * + * @return Returns the modified string. + */ + (pattern: RegExp | string, replacement: _.ReplaceFunction | string): Replace1x2; + /** + * Replaces matches for pattern in string with replacement. + * + * Note: This method is based on String#replace. + * + * @return Returns the modified string. + */ + (pattern: RegExp | string, replacement: _.ReplaceFunction | string, string: string): string; +} +interface Replace1x1 { + /** + * Replaces matches for pattern in string with replacement. + * + * Note: This method is based on String#replace. + * + * @return Returns the modified string. + */ + (): Replace1x1; + /** + * Replaces matches for pattern in string with replacement. + * + * Note: This method is based on String#replace. + * + * @return Returns the modified string. + */ + (replacement: _.ReplaceFunction | string): Replace1x2; + /** + * Replaces matches for pattern in string with replacement. + * + * Note: This method is based on String#replace. + * + * @return Returns the modified string. + */ + (replacement: _.ReplaceFunction | string, string: string): string; +} +interface Replace1x2 { + /** + * Replaces matches for pattern in string with replacement. + * + * Note: This method is based on String#replace. + * + * @return Returns the modified string. + */ + (): Replace1x2; + /** + * Replaces matches for pattern in string with replacement. + * + * Note: This method is based on String#replace. + * + * @return Returns the modified string. + */ + (string: string): string; +} + +declare const replace: Replace; +export = replace; diff --git a/types/lodash/fp/rest.d.ts b/types/lodash/fp/rest.d.ts new file mode 100644 index 0000000000..b92f5adb85 --- /dev/null +++ b/types/lodash/fp/rest.d.ts @@ -0,0 +1,19 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type Rest = + /** + * 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. + */ + (func: (...args: any[]) => any) => (...args: any[]) => any; + +declare const rest: Rest; +export = rest; diff --git a/types/lodash/fp/restFrom.d.ts b/types/lodash/fp/restFrom.d.ts new file mode 100644 index 0000000000..3ca5389f0e --- /dev/null +++ b/types/lodash/fp/restFrom.d.ts @@ -0,0 +1,66 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface Rest { + /** + * 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. + */ + (): Rest; + /** + * 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. + */ + (start: number): Rest1x1; + /** + * 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. + */ + (start: number, func: (...args: any[]) => any): (...args: any[]) => any; +} +interface Rest1x1 { + /** + * 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. + */ + (): Rest1x1; + /** + * 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. + */ + (func: (...args: any[]) => any): (...args: any[]) => any; +} + +declare const restFrom: Rest; +export = restFrom; diff --git a/types/lodash/fp/result.d.ts b/types/lodash/fp/result.d.ts new file mode 100644 index 0000000000..de99d91ff9 --- /dev/null +++ b/types/lodash/fp/result.d.ts @@ -0,0 +1,63 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Result { + /** + * 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; + /** + * 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. + */ + (path: _.PropertyPath): Result1x1; + /** + * 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. + */ + (path: _.PropertyPath, object: any): TResult; +} +interface Result1x1 { + /** + * 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. + */ + (): Result1x1; + /** + * 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. + */ + (object: any): TResult; +} + +declare const result: Result; +export = result; diff --git a/types/lodash/fp/reverse.d.ts b/types/lodash/fp/reverse.d.ts new file mode 100644 index 0000000000..5aa826c5eb --- /dev/null +++ b/types/lodash/fp/reverse.d.ts @@ -0,0 +1,30 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +type Reverse = + /** + * 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). + * + * @category Array + * @returns Returns `array`. + * @example + * + * var array = [1, 2, 3]; + * + * _.reverse(array); + * // => [3, 2, 1] + * + * console.log(array); + * // => [3, 2, 1] + */ + >(array: TList) => TList; + +declare const reverse: Reverse; +export = reverse; diff --git a/types/lodash/fp/round.d.ts b/types/lodash/fp/round.d.ts new file mode 100644 index 0000000000..359693f99e --- /dev/null +++ b/types/lodash/fp/round.d.ts @@ -0,0 +1,16 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type Round = + /** + * Calculates n rounded to precision. + * + * @param n The number to round. + * @param precision The precision to round to. + * @return Returns the rounded number. + */ + (n: number) => number; + +declare const round: Round; +export = round; diff --git a/types/lodash/fp/runInContext.d.ts b/types/lodash/fp/runInContext.d.ts new file mode 100644 index 0000000000..a09369abec --- /dev/null +++ b/types/lodash/fp/runInContext.d.ts @@ -0,0 +1,17 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +type RunInContext = + /** + * Create a new pristine lodash function using the given context object. + * + * @param context The context object. + * @return Returns a new lodash function. + */ + (context: object) => typeof _; + +declare const runInContext: RunInContext; +export = runInContext; diff --git a/types/lodash/fp/sample.d.ts b/types/lodash/fp/sample.d.ts new file mode 100644 index 0000000000..3ba7c5b6e2 --- /dev/null +++ b/types/lodash/fp/sample.d.ts @@ -0,0 +1,25 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Sample { + /** + * Gets a random element from collection. + * + * @param collection The collection to sample. + * @return Returns the random element. + */ + (collection: _.List | _.Dictionary | _.NumericDictionary | null | undefined): T | undefined; + /** + * Gets a random element from collection. + * + * @param collection The collection to sample. + * @return Returns the random element. + */ + (collection: T | null | undefined): T[keyof T] | undefined; +} + +declare const sample: Sample; +export = sample; diff --git a/types/lodash/fp/sampleSize.d.ts b/types/lodash/fp/sampleSize.d.ts new file mode 100644 index 0000000000..17ec045353 --- /dev/null +++ b/types/lodash/fp/sampleSize.d.ts @@ -0,0 +1,69 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface SampleSize { + /** + * Gets n random elements at unique keys from collection up to the size of collection. + * + * @param collection The collection to sample. + * @param n The number of elements to sample. + * @return Returns the random elements. + */ + (): SampleSize; + /** + * Gets n random elements at unique keys from collection up to the size of collection. + * + * @param collection The collection to sample. + * @param n The number of elements to sample. + * @return Returns the random elements. + */ + (n: number): SampleSize1x1; + /** + * Gets n random elements at unique keys from collection up to the size of collection. + * + * @param collection The collection to sample. + * @param n The number of elements to sample. + * @return Returns the random elements. + */ + (n: number, collection: _.List | _.Dictionary | _.NumericDictionary | null | undefined): T[]; + /** + * Gets n random elements at unique keys from collection up to the size of collection. + * + * @param collection The collection to sample. + * @param n The number of elements to sample. + * @return Returns the random elements. + */ + (n: number, collection: T | null | undefined): Array; +} +interface SampleSize1x1 { + /** + * Gets n random elements at unique keys from collection up to the size of collection. + * + * @param collection The collection to sample. + * @param n The number of elements to sample. + * @return Returns the random elements. + */ + (): SampleSize1x1; + /** + * Gets n random elements at unique keys from collection up to the size of collection. + * + * @param collection The collection to sample. + * @param n The number of elements to sample. + * @return Returns the random elements. + */ + (collection: _.List | _.Dictionary | _.NumericDictionary | null | undefined): T[]; + /** + * Gets n random elements at unique keys from collection up to the size of collection. + * + * @param collection The collection to sample. + * @param n The number of elements to sample. + * @return Returns the random elements. + */ + (collection: T | null | undefined): Array; +} + +declare const sampleSize: SampleSize; +export = sampleSize; diff --git a/types/lodash/fp/set.d.ts b/types/lodash/fp/set.d.ts new file mode 100644 index 0000000000..ea13605dcc --- /dev/null +++ b/types/lodash/fp/set.d.ts @@ -0,0 +1,147 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Set { + /** + * Sets the value at path of object. If a portion of path doesn’t exist it’s created. Arrays are created for + * missing index properties while objects are created for all other missing properties. Use _.setWith to + * customize path creation. + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @return Returns object. + */ + (): Set; + /** + * Sets the value at path of object. If a portion of path doesn’t exist it’s created. Arrays are created for + * missing index properties while objects are created for all other missing properties. Use _.setWith to + * customize path creation. + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @return Returns object. + */ + (path: _.PropertyPath): Set1x1; + /** + * Sets the value at path of object. If a portion of path doesn’t exist it’s created. Arrays are created for + * missing index properties while objects are created for all other missing properties. Use _.setWith to + * customize path creation. + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @return Returns object. + */ + (path: _.PropertyPath, value: any): Set1x2; + /** + * Sets the value at path of object. If a portion of path doesn’t exist it’s created. Arrays are created for + * missing index properties while objects are created for all other missing properties. Use _.setWith to + * customize path creation. + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @return Returns object. + */ + (path: _.PropertyPath, value: any, object: T): T; + /** + * Sets the value at path of object. If a portion of path doesn’t exist it’s created. Arrays are created for + * missing index properties while objects are created for all other missing properties. Use _.setWith to + * customize path creation. + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @return Returns object. + */ + (path: _.PropertyPath, value: any, object: object): TResult; +} +interface Set1x1 { + /** + * Sets the value at path of object. If a portion of path doesn’t exist it’s created. Arrays are created for + * missing index properties while objects are created for all other missing properties. Use _.setWith to + * customize path creation. + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @return Returns object. + */ + (): Set1x1; + /** + * Sets the value at path of object. If a portion of path doesn’t exist it’s created. Arrays are created for + * missing index properties while objects are created for all other missing properties. Use _.setWith to + * customize path creation. + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @return Returns object. + */ + (value: any): Set1x2; + /** + * Sets the value at path of object. If a portion of path doesn’t exist it’s created. Arrays are created for + * missing index properties while objects are created for all other missing properties. Use _.setWith to + * customize path creation. + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @return Returns object. + */ + (value: any, object: T): T; + /** + * Sets the value at path of object. If a portion of path doesn’t exist it’s created. Arrays are created for + * missing index properties while objects are created for all other missing properties. Use _.setWith to + * customize path creation. + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @return Returns object. + */ + (value: any, object: object): TResult; +} +interface Set1x2 { + /** + * Sets the value at path of object. If a portion of path doesn’t exist it’s created. Arrays are created for + * missing index properties while objects are created for all other missing properties. Use _.setWith to + * customize path creation. + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @return Returns object. + */ + (): Set1x2; + /** + * Sets the value at path of object. If a portion of path doesn’t exist it’s created. Arrays are created for + * missing index properties while objects are created for all other missing properties. Use _.setWith to + * customize path creation. + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @return Returns object. + */ + (object: T): T; + /** + * Sets the value at path of object. If a portion of path doesn’t exist it’s created. Arrays are created for + * missing index properties while objects are created for all other missing properties. Use _.setWith to + * customize path creation. + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @return Returns object. + */ + (object: object): TResult; +} + +declare const set: Set; +export = set; diff --git a/types/lodash/fp/setWith.d.ts b/types/lodash/fp/setWith.d.ts new file mode 100644 index 0000000000..d26b1a88a1 --- /dev/null +++ b/types/lodash/fp/setWith.d.ts @@ -0,0 +1,233 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface SetWith { + /** + * This method is like _.set except that it accepts customizer which is invoked to produce the objects of + * path. If customizer returns undefined path creation is handled by the method instead. The customizer is + * invoked with three arguments: (nsValue, key, nsObject). + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @parem customizer The function to customize assigned values. + * @return Returns object. + */ + (): SetWith; + /** + * This method is like _.set except that it accepts customizer which is invoked to produce the objects of + * path. If customizer returns undefined path creation is handled by the method instead. The customizer is + * invoked with three arguments: (nsValue, key, nsObject). + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @parem customizer The function to customize assigned values. + * @return Returns object. + */ + (customizer: _.SetWithCustomizer): SetWith1x1; + /** + * This method is like _.set except that it accepts customizer which is invoked to produce the objects of + * path. If customizer returns undefined path creation is handled by the method instead. The customizer is + * invoked with three arguments: (nsValue, key, nsObject). + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @parem customizer The function to customize assigned values. + * @return Returns object. + */ + (customizer: _.SetWithCustomizer, path: _.PropertyPath): SetWith1x2; + /** + * This method is like _.set except that it accepts customizer which is invoked to produce the objects of + * path. If customizer returns undefined path creation is handled by the method instead. The customizer is + * invoked with three arguments: (nsValue, key, nsObject). + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @parem customizer The function to customize assigned values. + * @return Returns object. + */ + (customizer: _.SetWithCustomizer, path: _.PropertyPath, value: any): SetWith1x3; + /** + * This method is like _.set except that it accepts customizer which is invoked to produce the objects of + * path. If customizer returns undefined path creation is handled by the method instead. The customizer is + * invoked with three arguments: (nsValue, key, nsObject). + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @parem customizer The function to customize assigned values. + * @return Returns object. + */ + (customizer: _.SetWithCustomizer, path: _.PropertyPath, value: any, object: T): T; + /** + * This method is like _.set except that it accepts customizer which is invoked to produce the objects of + * path. If customizer returns undefined path creation is handled by the method instead. The customizer is + * invoked with three arguments: (nsValue, key, nsObject). + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @parem customizer The function to customize assigned values. + * @return Returns object. + */ + (customizer: _.SetWithCustomizer, path: _.PropertyPath, value: any, object: T): TResult; +} +interface SetWith1x1 { + /** + * This method is like _.set except that it accepts customizer which is invoked to produce the objects of + * path. If customizer returns undefined path creation is handled by the method instead. The customizer is + * invoked with three arguments: (nsValue, key, nsObject). + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @parem customizer The function to customize assigned values. + * @return Returns object. + */ + (): SetWith1x1; + /** + * This method is like _.set except that it accepts customizer which is invoked to produce the objects of + * path. If customizer returns undefined path creation is handled by the method instead. The customizer is + * invoked with three arguments: (nsValue, key, nsObject). + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @parem customizer The function to customize assigned values. + * @return Returns object. + */ + (path: _.PropertyPath): SetWith1x2; + /** + * This method is like _.set except that it accepts customizer which is invoked to produce the objects of + * path. If customizer returns undefined path creation is handled by the method instead. The customizer is + * invoked with three arguments: (nsValue, key, nsObject). + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @parem customizer The function to customize assigned values. + * @return Returns object. + */ + (path: _.PropertyPath, value: any): SetWith1x3; + /** + * This method is like _.set except that it accepts customizer which is invoked to produce the objects of + * path. If customizer returns undefined path creation is handled by the method instead. The customizer is + * invoked with three arguments: (nsValue, key, nsObject). + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @parem customizer The function to customize assigned values. + * @return Returns object. + */ + (path: _.PropertyPath, value: any, object: T): T; + /** + * This method is like _.set except that it accepts customizer which is invoked to produce the objects of + * path. If customizer returns undefined path creation is handled by the method instead. The customizer is + * invoked with three arguments: (nsValue, key, nsObject). + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @parem customizer The function to customize assigned values. + * @return Returns object. + */ + (path: _.PropertyPath, value: any, object: T): TResult; +} +interface SetWith1x2 { + /** + * This method is like _.set except that it accepts customizer which is invoked to produce the objects of + * path. If customizer returns undefined path creation is handled by the method instead. The customizer is + * invoked with three arguments: (nsValue, key, nsObject). + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @parem customizer The function to customize assigned values. + * @return Returns object. + */ + (): SetWith1x2; + /** + * This method is like _.set except that it accepts customizer which is invoked to produce the objects of + * path. If customizer returns undefined path creation is handled by the method instead. The customizer is + * invoked with three arguments: (nsValue, key, nsObject). + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @parem customizer The function to customize assigned values. + * @return Returns object. + */ + (value: any): SetWith1x3; + /** + * This method is like _.set except that it accepts customizer which is invoked to produce the objects of + * path. If customizer returns undefined path creation is handled by the method instead. The customizer is + * invoked with three arguments: (nsValue, key, nsObject). + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @parem customizer The function to customize assigned values. + * @return Returns object. + */ + (value: any, object: T): T; + /** + * This method is like _.set except that it accepts customizer which is invoked to produce the objects of + * path. If customizer returns undefined path creation is handled by the method instead. The customizer is + * invoked with three arguments: (nsValue, key, nsObject). + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @parem customizer The function to customize assigned values. + * @return Returns object. + */ + (value: any, object: T): TResult; +} +interface SetWith1x3 { + /** + * This method is like _.set except that it accepts customizer which is invoked to produce the objects of + * path. If customizer returns undefined path creation is handled by the method instead. The customizer is + * invoked with three arguments: (nsValue, key, nsObject). + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @parem customizer The function to customize assigned values. + * @return Returns object. + */ + (): SetWith1x3; + /** + * This method is like _.set except that it accepts customizer which is invoked to produce the objects of + * path. If customizer returns undefined path creation is handled by the method instead. The customizer is + * invoked with three arguments: (nsValue, key, nsObject). + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @parem customizer The function to customize assigned values. + * @return Returns object. + */ + (object: T): T; + /** + * This method is like _.set except that it accepts customizer which is invoked to produce the objects of + * path. If customizer returns undefined path creation is handled by the method instead. The customizer is + * invoked with three arguments: (nsValue, key, nsObject). + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @parem customizer The function to customize assigned values. + * @return Returns object. + */ + (object: T): TResult; +} + +declare const setWith: SetWith; +export = setWith; diff --git a/types/lodash/fp/shuffle.d.ts b/types/lodash/fp/shuffle.d.ts new file mode 100644 index 0000000000..b49c3d10dc --- /dev/null +++ b/types/lodash/fp/shuffle.d.ts @@ -0,0 +1,25 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Shuffle { + /** + * 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. + */ + (collection: _.List | null | undefined): T[]; + /** + * 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. + */ + (collection: T | null | undefined): Array; +} + +declare const shuffle: Shuffle; +export = shuffle; diff --git a/types/lodash/fp/size.d.ts b/types/lodash/fp/size.d.ts new file mode 100644 index 0000000000..cf4ca2d03b --- /dev/null +++ b/types/lodash/fp/size.d.ts @@ -0,0 +1,16 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type Size = + /** + * 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. + */ + (collection: object | string | null | undefined) => number; + +declare const size: Size; +export = size; diff --git a/types/lodash/fp/slice.d.ts b/types/lodash/fp/slice.d.ts new file mode 100644 index 0000000000..e602154fa1 --- /dev/null +++ b/types/lodash/fp/slice.d.ts @@ -0,0 +1,96 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Slice { + /** + * 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; + /** + * 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. + */ + (start: number): Slice1x1; + /** + * 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. + */ + (start: number, end: number): Slice1x2; + /** + * 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. + */ + (start: number, end: number, array: _.List | null | undefined): T[]; +} +interface Slice1x1 { + /** + * 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. + */ + (): Slice1x1; + /** + * 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. + */ + (end: number): Slice1x2; + /** + * 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. + */ + (end: number, array: _.List | null | undefined): T[]; +} +interface Slice1x2 { + /** + * 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. + */ + (): Slice1x2; + /** + * 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. + */ + (array: _.List | null | undefined): T[]; +} + +declare const slice: Slice; +export = slice; diff --git a/types/lodash/fp/snakeCase.d.ts b/types/lodash/fp/snakeCase.d.ts new file mode 100644 index 0000000000..ef35bad608 --- /dev/null +++ b/types/lodash/fp/snakeCase.d.ts @@ -0,0 +1,15 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type SnakeCase = + /** + * Converts string to snake case. + * + * @param string The string to convert. + * @return Returns the snake cased string. + */ + (string: string) => string; + +declare const snakeCase: SnakeCase; +export = snakeCase; diff --git a/types/lodash/fp/some.d.ts b/types/lodash/fp/some.d.ts new file mode 100644 index 0000000000..f554e380c5 --- /dev/null +++ b/types/lodash/fp/some.d.ts @@ -0,0 +1,67 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Some { + /** + * Checks if predicate returns truthy for any element of collection. Iteration is stopped once predicate + * returns truthy. The predicate is invoked with three arguments: (value, index|key, collection). + * + * @param collection The collection to iterate over. + * @param predicate The function invoked per iteration. + * @return Returns true if any element passes the predicate check, else false. + */ + (): Some; + /** + * Checks if predicate returns truthy for any element of collection. Iteration is stopped once predicate + * returns truthy. The predicate is invoked with three arguments: (value, index|key, collection). + * + * @param collection The collection to iterate over. + * @param predicate The function invoked per iteration. + * @return Returns true if any element passes the predicate check, else false. + */ + (predicate: _.ValueIterateeCustom): Some1x1; + /** + * Checks if predicate returns truthy for any element of collection. Iteration is stopped once predicate + * returns truthy. The predicate is invoked with three arguments: (value, index|key, collection). + * + * @param collection The collection to iterate over. + * @param predicate The function invoked per iteration. + * @return Returns true if any element passes the predicate check, else false. + */ + (predicate: _.ValueIterateeCustom, collection: _.List | null | undefined): boolean; + /** + * Checks if predicate returns truthy for any element of collection. Iteration is stopped once predicate + * returns truthy. The predicate is invoked with three arguments: (value, index|key, collection). + * + * @param collection The collection to iterate over. + * @param predicate The function invoked per iteration. + * @return Returns true if any element passes the predicate check, else false. + */ + (predicate: _.ValueIterateeCustom, collection: T | null | undefined): boolean; +} +interface Some1x1 { + /** + * Checks if predicate returns truthy for any element of collection. Iteration is stopped once predicate + * returns truthy. The predicate is invoked with three arguments: (value, index|key, collection). + * + * @param collection The collection to iterate over. + * @param predicate The function invoked per iteration. + * @return Returns true if any element passes the predicate check, else false. + */ + (): Some1x1; + /** + * Checks if predicate returns truthy for any element of collection. Iteration is stopped once predicate + * returns truthy. The predicate is invoked with three arguments: (value, index|key, collection). + * + * @param collection The collection to iterate over. + * @param predicate The function invoked per iteration. + * @return Returns true if any element passes the predicate check, else false. + */ + (collection: _.List | object | null | undefined): boolean; +} + +declare const some: Some; +export = some; diff --git a/types/lodash/fp/sortBy.d.ts b/types/lodash/fp/sortBy.d.ts new file mode 100644 index 0000000000..3b0a1c128c --- /dev/null +++ b/types/lodash/fp/sortBy.d.ts @@ -0,0 +1,205 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface SortBy { + /** + * 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). + * + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratees=[_.identity]] + * The iteratees to sort by, specified individually or in arrays. + * @returns Returns the new sorted array. + * @example + * + * var users = [ + * { 'user': 'fred', 'age': 48 }, + * { 'user': 'barney', 'age': 36 }, + * { 'user': 'fred', 'age': 42 }, + * { 'user': 'barney', 'age': 34 } + * ]; + * + * _.sortBy(users, function(o) { return o.user; }); + * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]] + * + * _.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; + /** + * 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). + * + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratees=[_.identity]] + * The iteratees to sort by, specified individually or in arrays. + * @returns Returns the new sorted array. + * @example + * + * var users = [ + * { 'user': 'fred', 'age': 48 }, + * { 'user': 'barney', 'age': 36 }, + * { 'user': 'fred', 'age': 42 }, + * { 'user': 'barney', 'age': 34 } + * ]; + * + * _.sortBy(users, function(o) { return o.user; }); + * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]] + * + * _.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]] + */ + (iteratees: _.Many<_.ValueIteratee>): SortBy1x1; + /** + * 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). + * + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratees=[_.identity]] + * The iteratees to sort by, specified individually or in arrays. + * @returns Returns the new sorted array. + * @example + * + * var users = [ + * { 'user': 'fred', 'age': 48 }, + * { 'user': 'barney', 'age': 36 }, + * { 'user': 'fred', 'age': 42 }, + * { 'user': 'barney', 'age': 34 } + * ]; + * + * _.sortBy(users, function(o) { return o.user; }); + * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]] + * + * _.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]] + */ + (iteratees: _.Many<_.ValueIteratee>, collection: _.List | null | undefined): T[]; + /** + * 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). + * + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratees=[_.identity]] + * The iteratees to sort by, specified individually or in arrays. + * @returns Returns the new sorted array. + * @example + * + * var users = [ + * { 'user': 'fred', 'age': 48 }, + * { 'user': 'barney', 'age': 36 }, + * { 'user': 'fred', 'age': 42 }, + * { 'user': 'barney', 'age': 34 } + * ]; + * + * _.sortBy(users, function(o) { return o.user; }); + * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]] + * + * _.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]] + */ + (iteratees: _.Many<_.ValueIteratee>, collection: T | null | undefined): Array; +} +interface SortBy1x1 { + /** + * 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). + * + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratees=[_.identity]] + * The iteratees to sort by, specified individually or in arrays. + * @returns Returns the new sorted array. + * @example + * + * var users = [ + * { 'user': 'fred', 'age': 48 }, + * { 'user': 'barney', 'age': 36 }, + * { 'user': 'fred', 'age': 42 }, + * { 'user': 'barney', 'age': 34 } + * ]; + * + * _.sortBy(users, function(o) { return o.user; }); + * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]] + * + * _.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]] + */ + (): SortBy1x1; + /** + * 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). + * + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratees=[_.identity]] + * The iteratees to sort by, specified individually or in arrays. + * @returns Returns the new sorted array. + * @example + * + * var users = [ + * { 'user': 'fred', 'age': 48 }, + * { 'user': 'barney', 'age': 36 }, + * { 'user': 'fred', 'age': 42 }, + * { 'user': 'barney', 'age': 34 } + * ]; + * + * _.sortBy(users, function(o) { return o.user; }); + * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]] + * + * _.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]] + */ + (collection: _.List | object | null | undefined): T[]; +} + +declare const sortBy: SortBy; +export = sortBy; diff --git a/types/lodash/fp/sortedIndex.d.ts b/types/lodash/fp/sortedIndex.d.ts new file mode 100644 index 0000000000..c230bd6858 --- /dev/null +++ b/types/lodash/fp/sortedIndex.d.ts @@ -0,0 +1,98 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface SortedIndex { + /** + * Uses a binary search to determine the lowest index at which `value` should + * be inserted into `array` in order to maintain its sort order. + * + * @category Array + * @param array The sorted array to inspect. + * @param value The value to evaluate. + * @returns Returns the index at which `value` should be inserted into `array`. + * @example + * + * _.sortedIndex([30, 50], 40); + * // => 1 + * + * _.sortedIndex([4, 5], 4); + * // => 0 + */ + (): SortedIndex; + /** + * Uses a binary search to determine the lowest index at which `value` should + * be inserted into `array` in order to maintain its sort order. + * + * @category Array + * @param array The sorted array to inspect. + * @param value The value to evaluate. + * @returns Returns the index at which `value` should be inserted into `array`. + * @example + * + * _.sortedIndex([30, 50], 40); + * // => 1 + * + * _.sortedIndex([4, 5], 4); + * // => 0 + */ + (value: T): SortedIndex1x1; + /** + * Uses a binary search to determine the lowest index at which `value` should + * be inserted into `array` in order to maintain its sort order. + * + * @category Array + * @param array The sorted array to inspect. + * @param value The value to evaluate. + * @returns Returns the index at which `value` should be inserted into `array`. + * @example + * + * _.sortedIndex([30, 50], 40); + * // => 1 + * + * _.sortedIndex([4, 5], 4); + * // => 0 + */ + (value: T, array: _.List | null | undefined): number; +} +interface SortedIndex1x1 { + /** + * Uses a binary search to determine the lowest index at which `value` should + * be inserted into `array` in order to maintain its sort order. + * + * @category Array + * @param array The sorted array to inspect. + * @param value The value to evaluate. + * @returns Returns the index at which `value` should be inserted into `array`. + * @example + * + * _.sortedIndex([30, 50], 40); + * // => 1 + * + * _.sortedIndex([4, 5], 4); + * // => 0 + */ + (): SortedIndex1x1; + /** + * Uses a binary search to determine the lowest index at which `value` should + * be inserted into `array` in order to maintain its sort order. + * + * @category Array + * @param array The sorted array to inspect. + * @param value The value to evaluate. + * @returns Returns the index at which `value` should be inserted into `array`. + * @example + * + * _.sortedIndex([30, 50], 40); + * // => 1 + * + * _.sortedIndex([4, 5], 4); + * // => 0 + */ + (array: _.List | null | undefined): number; +} + +declare const sortedIndex: SortedIndex; +export = sortedIndex; diff --git a/types/lodash/fp/sortedIndexBy.d.ts b/types/lodash/fp/sortedIndexBy.d.ts new file mode 100644 index 0000000000..02a1ffbae6 --- /dev/null +++ b/types/lodash/fp/sortedIndexBy.d.ts @@ -0,0 +1,213 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface SortedIndexBy { + /** + * 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). + * + * @category Array + * @param array The sorted array to inspect. + * @param value The value to evaluate. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns 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; + /** + * 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). + * + * @category Array + * @param array The sorted array to inspect. + * @param value The value to evaluate. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns 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 + */ + (iteratee: _.ValueIteratee): SortedIndexBy1x1; + /** + * 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). + * + * @category Array + * @param array The sorted array to inspect. + * @param value The value to evaluate. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns 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 + */ + (iteratee: _.ValueIteratee, value: T): SortedIndexBy1x2; + /** + * 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). + * + * @category Array + * @param array The sorted array to inspect. + * @param value The value to evaluate. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns 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 + */ + (iteratee: _.ValueIteratee, value: T, array: _.List | null | undefined): number; +} +interface SortedIndexBy1x1 { + /** + * 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). + * + * @category Array + * @param array The sorted array to inspect. + * @param value The value to evaluate. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns 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 + */ + (): SortedIndexBy1x1; + /** + * 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). + * + * @category Array + * @param array The sorted array to inspect. + * @param value The value to evaluate. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns 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 + */ + (value: T): SortedIndexBy1x2; + /** + * 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). + * + * @category Array + * @param array The sorted array to inspect. + * @param value The value to evaluate. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns 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 + */ + (value: T, array: _.List | null | undefined): number; +} +interface SortedIndexBy1x2 { + /** + * 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). + * + * @category Array + * @param array The sorted array to inspect. + * @param value The value to evaluate. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns 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 + */ + (): SortedIndexBy1x2; + /** + * 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). + * + * @category Array + * @param array The sorted array to inspect. + * @param value The value to evaluate. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns 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 + */ + (array: _.List | null | undefined): number; +} + +declare const sortedIndexBy: SortedIndexBy; +export = sortedIndexBy; diff --git a/types/lodash/fp/sortedIndexOf.d.ts b/types/lodash/fp/sortedIndexOf.d.ts new file mode 100644 index 0000000000..0b9f5503ab --- /dev/null +++ b/types/lodash/fp/sortedIndexOf.d.ts @@ -0,0 +1,83 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface SortedIndexOf { + /** + * This method is like `_.indexOf` except that it performs a binary + * search on a sorted `array`. + * + * @category Array + * @param array The array to search. + * @param value The value to search for. + * @returns Returns the index of the matched value, else `-1`. + * @example + * + * _.sortedIndexOf([1, 1, 2, 2], 2); + * // => 2 + */ + (): SortedIndexOf; + /** + * This method is like `_.indexOf` except that it performs a binary + * search on a sorted `array`. + * + * @category Array + * @param array The array to search. + * @param value The value to search for. + * @returns Returns the index of the matched value, else `-1`. + * @example + * + * _.sortedIndexOf([1, 1, 2, 2], 2); + * // => 2 + */ + (value: T): SortedIndexOf1x1; + /** + * This method is like `_.indexOf` except that it performs a binary + * search on a sorted `array`. + * + * @category Array + * @param array The array to search. + * @param value The value to search for. + * @returns Returns the index of the matched value, else `-1`. + * @example + * + * _.sortedIndexOf([1, 1, 2, 2], 2); + * // => 2 + */ + (value: T, array: _.List | null | undefined): number; +} +interface SortedIndexOf1x1 { + /** + * This method is like `_.indexOf` except that it performs a binary + * search on a sorted `array`. + * + * @category Array + * @param array The array to search. + * @param value The value to search for. + * @returns Returns the index of the matched value, else `-1`. + * @example + * + * _.sortedIndexOf([1, 1, 2, 2], 2); + * // => 2 + */ + (): SortedIndexOf1x1; + /** + * This method is like `_.indexOf` except that it performs a binary + * search on a sorted `array`. + * + * @category Array + * @param array The array to search. + * @param value The value to search for. + * @returns Returns the index of the matched value, else `-1`. + * @example + * + * _.sortedIndexOf([1, 1, 2, 2], 2); + * // => 2 + */ + (array: _.List | null | undefined): number; +} + +declare const sortedIndexOf: SortedIndexOf; +export = sortedIndexOf; diff --git a/types/lodash/fp/sortedLastIndex.d.ts b/types/lodash/fp/sortedLastIndex.d.ts new file mode 100644 index 0000000000..26b45fe1df --- /dev/null +++ b/types/lodash/fp/sortedLastIndex.d.ts @@ -0,0 +1,88 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface SortedLastIndex { + /** + * 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. + * + * @category Array + * @param array The sorted array to inspect. + * @param value The value to evaluate. + * @returns Returns the index at which `value` should be inserted into `array`. + * @example + * + * _.sortedLastIndex([4, 5], 4); + * // => 1 + */ + (): SortedLastIndex; + /** + * 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. + * + * @category Array + * @param array The sorted array to inspect. + * @param value The value to evaluate. + * @returns Returns the index at which `value` should be inserted into `array`. + * @example + * + * _.sortedLastIndex([4, 5], 4); + * // => 1 + */ + (value: T): SortedLastIndex1x1; + /** + * 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. + * + * @category Array + * @param array The sorted array to inspect. + * @param value The value to evaluate. + * @returns Returns the index at which `value` should be inserted into `array`. + * @example + * + * _.sortedLastIndex([4, 5], 4); + * // => 1 + */ + (value: T, array: _.List | null | undefined): number; +} +interface SortedLastIndex1x1 { + /** + * 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. + * + * @category Array + * @param array The sorted array to inspect. + * @param value The value to evaluate. + * @returns Returns the index at which `value` should be inserted into `array`. + * @example + * + * _.sortedLastIndex([4, 5], 4); + * // => 1 + */ + (): SortedLastIndex1x1; + /** + * 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. + * + * @category Array + * @param array The sorted array to inspect. + * @param value The value to evaluate. + * @returns Returns the index at which `value` should be inserted into `array`. + * @example + * + * _.sortedLastIndex([4, 5], 4); + * // => 1 + */ + (array: _.List | null | undefined): number; +} + +declare const sortedLastIndex: SortedLastIndex; +export = sortedLastIndex; diff --git a/types/lodash/fp/sortedLastIndexBy.d.ts b/types/lodash/fp/sortedLastIndexBy.d.ts new file mode 100644 index 0000000000..6f00b9c982 --- /dev/null +++ b/types/lodash/fp/sortedLastIndexBy.d.ts @@ -0,0 +1,168 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface SortedLastIndexBy { + /** + * 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). + * + * @category Array + * @param array The sorted array to inspect. + * @param value The value to evaluate. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns 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; + /** + * 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). + * + * @category Array + * @param array The sorted array to inspect. + * @param value The value to evaluate. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns 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 + */ + (iteratee: _.ValueIteratee): SortedLastIndexBy1x1; + /** + * 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). + * + * @category Array + * @param array The sorted array to inspect. + * @param value The value to evaluate. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns 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 + */ + (iteratee: _.ValueIteratee, value: T): SortedLastIndexBy1x2; + /** + * 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). + * + * @category Array + * @param array The sorted array to inspect. + * @param value The value to evaluate. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns 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 + */ + (iteratee: _.ValueIteratee, value: T, array: _.List | null | undefined): number; +} +interface SortedLastIndexBy1x1 { + /** + * 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). + * + * @category Array + * @param array The sorted array to inspect. + * @param value The value to evaluate. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns 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 + */ + (): SortedLastIndexBy1x1; + /** + * 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). + * + * @category Array + * @param array The sorted array to inspect. + * @param value The value to evaluate. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns 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 + */ + (value: T): SortedLastIndexBy1x2; + /** + * 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). + * + * @category Array + * @param array The sorted array to inspect. + * @param value The value to evaluate. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns 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 + */ + (value: T, array: _.List | null | undefined): number; +} +interface SortedLastIndexBy1x2 { + /** + * 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). + * + * @category Array + * @param array The sorted array to inspect. + * @param value The value to evaluate. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns 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 + */ + (): SortedLastIndexBy1x2; + /** + * 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). + * + * @category Array + * @param array The sorted array to inspect. + * @param value The value to evaluate. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns 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 + */ + (array: _.List | null | undefined): number; +} + +declare const sortedLastIndexBy: SortedLastIndexBy; +export = sortedLastIndexBy; diff --git a/types/lodash/fp/sortedLastIndexOf.d.ts b/types/lodash/fp/sortedLastIndexOf.d.ts new file mode 100644 index 0000000000..3fb6d2d77b --- /dev/null +++ b/types/lodash/fp/sortedLastIndexOf.d.ts @@ -0,0 +1,83 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface SortedLastIndexOf { + /** + * This method is like `_.lastIndexOf` except that it performs a binary + * search on a sorted `array`. + * + * @category Array + * @param array The array to search. + * @param value The value to search for. + * @returns Returns the index of the matched value, else `-1`. + * @example + * + * _.sortedLastIndexOf([1, 1, 2, 2], 2); + * // => 3 + */ + (): SortedLastIndexOf; + /** + * This method is like `_.lastIndexOf` except that it performs a binary + * search on a sorted `array`. + * + * @category Array + * @param array The array to search. + * @param value The value to search for. + * @returns Returns the index of the matched value, else `-1`. + * @example + * + * _.sortedLastIndexOf([1, 1, 2, 2], 2); + * // => 3 + */ + (value: T): SortedLastIndexOf1x1; + /** + * This method is like `_.lastIndexOf` except that it performs a binary + * search on a sorted `array`. + * + * @category Array + * @param array The array to search. + * @param value The value to search for. + * @returns Returns the index of the matched value, else `-1`. + * @example + * + * _.sortedLastIndexOf([1, 1, 2, 2], 2); + * // => 3 + */ + (value: T, array: _.List | null | undefined): number; +} +interface SortedLastIndexOf1x1 { + /** + * This method is like `_.lastIndexOf` except that it performs a binary + * search on a sorted `array`. + * + * @category Array + * @param array The array to search. + * @param value The value to search for. + * @returns Returns the index of the matched value, else `-1`. + * @example + * + * _.sortedLastIndexOf([1, 1, 2, 2], 2); + * // => 3 + */ + (): SortedLastIndexOf1x1; + /** + * This method is like `_.lastIndexOf` except that it performs a binary + * search on a sorted `array`. + * + * @category Array + * @param array The array to search. + * @param value The value to search for. + * @returns Returns the index of the matched value, else `-1`. + * @example + * + * _.sortedLastIndexOf([1, 1, 2, 2], 2); + * // => 3 + */ + (array: _.List | null | undefined): number; +} + +declare const sortedLastIndexOf: SortedLastIndexOf; +export = sortedLastIndexOf; diff --git a/types/lodash/fp/sortedUniq.d.ts b/types/lodash/fp/sortedUniq.d.ts new file mode 100644 index 0000000000..ae5c6a826b --- /dev/null +++ b/types/lodash/fp/sortedUniq.d.ts @@ -0,0 +1,23 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +type SortedUniq = + /** + * This method is like `_.uniq` except that it's designed and optimized + * for sorted arrays. + * + * @category Array + * @param array The array to inspect. + * @returns Returns the new duplicate free array. + * @example + * + * _.sortedUniq([1, 1, 2]); + * // => [1, 2] + */ + (array: _.List | null | undefined) => T[]; + +declare const sortedUniq: SortedUniq; +export = sortedUniq; diff --git a/types/lodash/fp/sortedUniqBy.d.ts b/types/lodash/fp/sortedUniqBy.d.ts new file mode 100644 index 0000000000..9300e80b75 --- /dev/null +++ b/types/lodash/fp/sortedUniqBy.d.ts @@ -0,0 +1,141 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface SortedUniqBy { + /** + * This method is like `_.uniqBy` except that it's designed and optimized + * for sorted arrays. + * + * @category Array + * @param array The array to inspect. + * @param [iteratee] The iteratee invoked per element. + * @returns Returns the new duplicate free array. + * @example + * + * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor); + * // => [1.1, 2.2] + */ + (): SortedUniqBy; + /** + * This method is like `_.uniqBy` except that it's designed and optimized + * for sorted arrays. + * + * @category Array + * @param array The array to inspect. + * @param [iteratee] The iteratee invoked per element. + * @returns Returns the new duplicate free array. + * @example + * + * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor); + * // => [1.1, 2.2] + */ + (iteratee: (value: string) => _.NotVoid): SortedUniqBy1x1; + /** + * This method is like `_.uniqBy` except that it's designed and optimized + * for sorted arrays. + * + * @category Array + * @param array The array to inspect. + * @param [iteratee] The iteratee invoked per element. + * @returns Returns the new duplicate free array. + * @example + * + * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor); + * // => [1.1, 2.2] + */ + (iteratee: (value: string) => _.NotVoid, array: string | null | undefined): string[]; + /** + * This method is like `_.uniqBy` except that it's designed and optimized + * for sorted arrays. + * + * @category Array + * @param array The array to inspect. + * @param [iteratee] The iteratee invoked per element. + * @returns Returns the new duplicate free array. + * @example + * + * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor); + * // => [1.1, 2.2] + */ + (iteratee: _.ValueIteratee): SortedUniqBy2x1; + /** + * This method is like `_.uniqBy` except that it's designed and optimized + * for sorted arrays. + * + * @category Array + * @param array The array to inspect. + * @param [iteratee] The iteratee invoked per element. + * @returns Returns the new duplicate free array. + * @example + * + * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor); + * // => [1.1, 2.2] + */ + (iteratee: _.ValueIteratee, array: _.List | null | undefined): T[]; +} +interface SortedUniqBy1x1 { + /** + * This method is like `_.uniqBy` except that it's designed and optimized + * for sorted arrays. + * + * @category Array + * @param array The array to inspect. + * @param [iteratee] The iteratee invoked per element. + * @returns Returns the new duplicate free array. + * @example + * + * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor); + * // => [1.1, 2.2] + */ + (): SortedUniqBy1x1; + /** + * This method is like `_.uniqBy` except that it's designed and optimized + * for sorted arrays. + * + * @category Array + * @param array The array to inspect. + * @param [iteratee] The iteratee invoked per element. + * @returns Returns the new duplicate free array. + * @example + * + * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor); + * // => [1.1, 2.2] + */ + (array: string | null | undefined): string[]; +} +interface SortedUniqBy2x1 { + /** + * This method is like `_.uniqBy` except that it's designed and optimized + * for sorted arrays. + * + * @category Array + * @param array The array to inspect. + * @param [iteratee] The iteratee invoked per element. + * @returns Returns the new duplicate free array. + * @example + * + * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor); + * // => [1.1, 2.2] + */ + (): SortedUniqBy2x1; + /** + * This method is like `_.uniqBy` except that it's designed and optimized + * for sorted arrays. + * + * @category Array + * @param array The array to inspect. + * @param [iteratee] The iteratee invoked per element. + * @returns Returns the new duplicate free array. + * @example + * + * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor); + * // => [1.1, 2.2] + */ + (array: _.List | null | undefined): T[]; +} + +declare const sortedUniqBy: SortedUniqBy; +export = sortedUniqBy; diff --git a/types/lodash/fp/split.d.ts b/types/lodash/fp/split.d.ts new file mode 100644 index 0000000000..50ad820360 --- /dev/null +++ b/types/lodash/fp/split.d.ts @@ -0,0 +1,66 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface Split { + /** + * Splits string by separator. + * + * Note: This method is based on String#split. + * + * @param string The string to trim. + * @param separator The separator pattern to split by. + * @param limit The length to truncate results to. + * @return Returns the new array of string segments. + */ + (): Split; + /** + * Splits string by separator. + * + * Note: This method is based on String#split. + * + * @param string The string to trim. + * @param separator The separator pattern to split by. + * @param limit The length to truncate results to. + * @return Returns the new array of string segments. + */ + (separator: RegExp|string): Split1x1; + /** + * Splits string by separator. + * + * Note: This method is based on String#split. + * + * @param string The string to trim. + * @param separator The separator pattern to split by. + * @param limit The length to truncate results to. + * @return Returns the new array of string segments. + */ + (separator: RegExp|string, string: string): string[]; +} +interface Split1x1 { + /** + * Splits string by separator. + * + * Note: This method is based on String#split. + * + * @param string The string to trim. + * @param separator The separator pattern to split by. + * @param limit The length to truncate results to. + * @return Returns the new array of string segments. + */ + (): Split1x1; + /** + * Splits string by separator. + * + * Note: This method is based on String#split. + * + * @param string The string to trim. + * @param separator The separator pattern to split by. + * @param limit The length to truncate results to. + * @return Returns the new array of string segments. + */ + (string: string): string[]; +} + +declare const split: Split; +export = split; diff --git a/types/lodash/fp/spread.d.ts b/types/lodash/fp/spread.d.ts new file mode 100644 index 0000000000..197c49278d --- /dev/null +++ b/types/lodash/fp/spread.d.ts @@ -0,0 +1,18 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type Spread = + /** + * 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. + */ + (func: (...args: any[]) => TResult) => (...args: any[]) => TResult; + +declare const spread: Spread; +export = spread; diff --git a/types/lodash/fp/spreadFrom.d.ts b/types/lodash/fp/spreadFrom.d.ts new file mode 100644 index 0000000000..7ac31bc9fe --- /dev/null +++ b/types/lodash/fp/spreadFrom.d.ts @@ -0,0 +1,61 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface Spread { + /** + * 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; + /** + * 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. + */ + (start: number): Spread1x1; + /** + * 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. + */ + (start: number, func: (...args: any[]) => TResult): (...args: any[]) => TResult; +} +interface Spread1x1 { + /** + * 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. + */ + (): Spread1x1; + /** + * 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. + */ + (func: (...args: any[]) => TResult): (...args: any[]) => TResult; +} + +declare const spreadFrom: Spread; +export = spreadFrom; diff --git a/types/lodash/fp/startCase.d.ts b/types/lodash/fp/startCase.d.ts new file mode 100644 index 0000000000..ca27b6b47f --- /dev/null +++ b/types/lodash/fp/startCase.d.ts @@ -0,0 +1,15 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type StartCase = + /** + * Converts string to start case. + * + * @param string The string to convert. + * @return Returns the start cased string. + */ + (string: string) => string; + +declare const startCase: StartCase; +export = startCase; diff --git a/types/lodash/fp/startsWith.d.ts b/types/lodash/fp/startsWith.d.ts new file mode 100644 index 0000000000..962f880742 --- /dev/null +++ b/types/lodash/fp/startsWith.d.ts @@ -0,0 +1,56 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface StartsWith { + /** + * 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; + /** + * 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. + */ + (target: string): StartsWith1x1; + /** + * 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. + */ + (target: string, string: string): boolean; +} +interface StartsWith1x1 { + /** + * 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. + */ + (): StartsWith1x1; + /** + * 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. + */ + (string: string): boolean; +} + +declare const startsWith: StartsWith; +export = startsWith; diff --git a/types/lodash/fp/stubArray.d.ts b/types/lodash/fp/stubArray.d.ts new file mode 100644 index 0000000000..1dd9667827 --- /dev/null +++ b/types/lodash/fp/stubArray.d.ts @@ -0,0 +1,14 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type StubArray = + /** + * This method returns a new empty array. + * + * @returns Returns the new empty array. + */ + () => any[]; + +declare const stubArray: StubArray; +export = stubArray; diff --git a/types/lodash/fp/stubFalse.d.ts b/types/lodash/fp/stubFalse.d.ts new file mode 100644 index 0000000000..abea160b5f --- /dev/null +++ b/types/lodash/fp/stubFalse.d.ts @@ -0,0 +1,14 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type StubFalse = + /** + * This method returns `false`. + * + * @returns Returns `false`. + */ + () => boolean; + +declare const stubFalse: StubFalse; +export = stubFalse; diff --git a/types/lodash/fp/stubObject.d.ts b/types/lodash/fp/stubObject.d.ts new file mode 100644 index 0000000000..6765c18b5a --- /dev/null +++ b/types/lodash/fp/stubObject.d.ts @@ -0,0 +1,14 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type StubObject = + /** + * This method returns a new empty object. + * + * @returns Returns the new empty object. + */ + () => any; + +declare const stubObject: StubObject; +export = stubObject; diff --git a/types/lodash/fp/stubString.d.ts b/types/lodash/fp/stubString.d.ts new file mode 100644 index 0000000000..66da9843e9 --- /dev/null +++ b/types/lodash/fp/stubString.d.ts @@ -0,0 +1,14 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type StubString = + /** + * This method returns an empty string. + * + * @returns Returns the empty string. + */ + () => string; + +declare const stubString: StubString; +export = stubString; diff --git a/types/lodash/fp/stubTrue.d.ts b/types/lodash/fp/stubTrue.d.ts new file mode 100644 index 0000000000..25cba4fcde --- /dev/null +++ b/types/lodash/fp/stubTrue.d.ts @@ -0,0 +1,14 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type StubTrue = + /** + * This method returns `true`. + * + * @returns Returns `true`. + */ + () => boolean; + +declare const stubTrue: StubTrue; +export = stubTrue; diff --git a/types/lodash/fp/subtract.d.ts b/types/lodash/fp/subtract.d.ts new file mode 100644 index 0000000000..b19ddb1f7e --- /dev/null +++ b/types/lodash/fp/subtract.d.ts @@ -0,0 +1,76 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface Subtract { + /** + * Subtract two numbers. + * + * @category Math + * @param minuend The first number in a subtraction. + * @param subtrahend The second number in a subtraction. + * @returns Returns the difference. + * @example + * + * _.subtract(6, 4); + * // => 2 + */ + (): Subtract; + /** + * Subtract two numbers. + * + * @category Math + * @param minuend The first number in a subtraction. + * @param subtrahend The second number in a subtraction. + * @returns Returns the difference. + * @example + * + * _.subtract(6, 4); + * // => 2 + */ + (minuend: number): Subtract1x1; + /** + * Subtract two numbers. + * + * @category Math + * @param minuend The first number in a subtraction. + * @param subtrahend The second number in a subtraction. + * @returns Returns the difference. + * @example + * + * _.subtract(6, 4); + * // => 2 + */ + (minuend: number, subtrahend: number): number; +} +interface Subtract1x1 { + /** + * Subtract two numbers. + * + * @category Math + * @param minuend The first number in a subtraction. + * @param subtrahend The second number in a subtraction. + * @returns Returns the difference. + * @example + * + * _.subtract(6, 4); + * // => 2 + */ + (): Subtract1x1; + /** + * Subtract two numbers. + * + * @category Math + * @param minuend The first number in a subtraction. + * @param subtrahend The second number in a subtraction. + * @returns Returns the difference. + * @example + * + * _.subtract(6, 4); + * // => 2 + */ + (subtrahend: number): number; +} + +declare const subtract: Subtract; +export = subtract; diff --git a/types/lodash/fp/sum.d.ts b/types/lodash/fp/sum.d.ts new file mode 100644 index 0000000000..84f6849067 --- /dev/null +++ b/types/lodash/fp/sum.d.ts @@ -0,0 +1,22 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +type Sum = + /** + * Computes the sum of the values in `array`. + * + * @category Math + * @param array The array to iterate over. + * @returns Returns the sum. + * @example + * + * _.sum([4, 2, 8, 6]); + * // => 20 + */ + (collection: _.List | null | undefined) => number; + +declare const sum: Sum; +export = sum; diff --git a/types/lodash/fp/sumBy.d.ts b/types/lodash/fp/sumBy.d.ts new file mode 100644 index 0000000000..93d6be33f7 --- /dev/null +++ b/types/lodash/fp/sumBy.d.ts @@ -0,0 +1,118 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface SumBy { + /** + * 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). + * + * @category Math + * @param array The array to iterate over. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns 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; + /** + * 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). + * + * @category Math + * @param array The array to iterate over. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns 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 + */ + (iteratee: ((value: T) => number) | string): SumBy1x1; + /** + * 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). + * + * @category Math + * @param array The array to iterate over. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns 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 + */ + (iteratee: ((value: T) => number) | string, collection: _.List | null | undefined): number; +} +interface SumBy1x1 { + /** + * 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). + * + * @category Math + * @param array The array to iterate over. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns 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 + */ + (): SumBy1x1; + /** + * 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). + * + * @category Math + * @param array The array to iterate over. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns 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 + */ + (collection: _.List | null | undefined): number; +} + +declare const sumBy: SumBy; +export = sumBy; diff --git a/types/lodash/fp/symmetricDifference.d.ts b/types/lodash/fp/symmetricDifference.d.ts new file mode 100644 index 0000000000..8d09e4f1a3 --- /dev/null +++ b/types/lodash/fp/symmetricDifference.d.ts @@ -0,0 +1,48 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Xor { + /** + * 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; + /** + * 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. + */ + (arrays2: _.List | null | undefined): Xor1x1; + /** + * 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. + */ + (arrays2: _.List | null | undefined, arrays: _.List | null | undefined): T[]; +} +interface Xor1x1 { + /** + * 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. + */ + (): Xor1x1; + /** + * 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. + */ + (arrays: _.List | null | undefined): T[]; +} + +declare const symmetricDifference: Xor; +export = symmetricDifference; diff --git a/types/lodash/fp/symmetricDifferenceBy.d.ts b/types/lodash/fp/symmetricDifferenceBy.d.ts new file mode 100644 index 0000000000..1bfeb6c6cd --- /dev/null +++ b/types/lodash/fp/symmetricDifferenceBy.d.ts @@ -0,0 +1,186 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface XorBy { + /** + * 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). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns 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; + /** + * 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). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns 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 }] + */ + (iteratee: _.ValueIteratee): XorBy1x1; + /** + * 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). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns 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 }] + */ + (iteratee: _.ValueIteratee, arrays: _.List | null | undefined): XorBy1x2; + /** + * 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). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns 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 }] + */ + (iteratee: _.ValueIteratee, arrays: _.List | null | undefined, arrays2: _.List | null | undefined): T[]; +} +interface XorBy1x1 { + /** + * 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). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns 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 }] + */ + (): XorBy1x1; + /** + * 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). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns 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 }] + */ + (arrays: _.List | null | undefined): XorBy1x2; + /** + * 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). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns 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 }] + */ + (arrays: _.List | null | undefined, arrays2: _.List | null | undefined): T[]; +} +interface XorBy1x2 { + /** + * 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). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns 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 }] + */ + (): XorBy1x2; + /** + * 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). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns 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 }] + */ + (arrays2: _.List | null | undefined): T[]; +} + +declare const symmetricDifferenceBy: XorBy; +export = symmetricDifferenceBy; diff --git a/types/lodash/fp/symmetricDifferenceWith.d.ts b/types/lodash/fp/symmetricDifferenceWith.d.ts new file mode 100644 index 0000000000..0aa1d417fb --- /dev/null +++ b/types/lodash/fp/symmetricDifferenceWith.d.ts @@ -0,0 +1,177 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface XorWith { + /** + * 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). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [comparator] The comparator invoked per element. + * @returns 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; + /** + * 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). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [comparator] The comparator invoked per element. + * @returns 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 }] + */ + (comparator: _.Comparator): XorWith1x1; + /** + * 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). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [comparator] The comparator invoked per element. + * @returns 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 }] + */ + (comparator: _.Comparator, arrays: _.List | null | undefined): XorWith1x2; + /** + * 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). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [comparator] The comparator invoked per element. + * @returns 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 }] + */ + (comparator: _.Comparator, arrays: _.List | null | undefined, arrays2: _.List | null | undefined): T[]; +} +interface XorWith1x1 { + /** + * 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). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [comparator] The comparator invoked per element. + * @returns 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 }] + */ + (): XorWith1x1; + /** + * 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). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [comparator] The comparator invoked per element. + * @returns 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 }] + */ + (arrays: _.List | null | undefined): XorWith1x2; + /** + * 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). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [comparator] The comparator invoked per element. + * @returns 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 }] + */ + (arrays: _.List | null | undefined, arrays2: _.List | null | undefined): T[]; +} +interface XorWith1x2 { + /** + * 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). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [comparator] The comparator invoked per element. + * @returns 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 }] + */ + (): XorWith1x2; + /** + * 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). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [comparator] The comparator invoked per element. + * @returns 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 }] + */ + (arrays2: _.List | null | undefined): T[]; +} + +declare const symmetricDifferenceWith: XorWith; +export = symmetricDifferenceWith; diff --git a/types/lodash/fp/tail.d.ts b/types/lodash/fp/tail.d.ts new file mode 100644 index 0000000000..1f4e5baea5 --- /dev/null +++ b/types/lodash/fp/tail.d.ts @@ -0,0 +1,17 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +type Tail = + /** + * Gets all but the first element of array. + * + * @param array The array to query. + * @return Returns the slice of array. + */ + (array: _.List | null | undefined) => T[]; + +declare const tail: Tail; +export = tail; diff --git a/types/lodash/fp/take.d.ts b/types/lodash/fp/take.d.ts new file mode 100644 index 0000000000..8c64452d27 --- /dev/null +++ b/types/lodash/fp/take.d.ts @@ -0,0 +1,53 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Take { + /** + * 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; + /** + * 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. + */ + (n: number): Take1x1; + /** + * 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. + */ + (n: number, array: _.List | null | undefined): T[]; +} +interface Take1x1 { + /** + * 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. + */ + (): Take1x1; + /** + * 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. + */ + (array: _.List | null | undefined): T[]; +} + +declare const take: Take; +export = take; diff --git a/types/lodash/fp/takeLast.d.ts b/types/lodash/fp/takeLast.d.ts new file mode 100644 index 0000000000..6677d06e16 --- /dev/null +++ b/types/lodash/fp/takeLast.d.ts @@ -0,0 +1,53 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface TakeRight { + /** + * 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; + /** + * 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. + */ + (n: number): TakeRight1x1; + /** + * 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. + */ + (n: number, array: _.List | null | undefined): T[]; +} +interface TakeRight1x1 { + /** + * 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. + */ + (): TakeRight1x1; + /** + * 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. + */ + (array: _.List | null | undefined): T[]; +} + +declare const takeLast: TakeRight; +export = takeLast; diff --git a/types/lodash/fp/takeLastWhile.d.ts b/types/lodash/fp/takeLastWhile.d.ts new file mode 100644 index 0000000000..4e2cd0a933 --- /dev/null +++ b/types/lodash/fp/takeLastWhile.d.ts @@ -0,0 +1,108 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface TakeRightWhile { + /** + * 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; + /** + * 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. + */ + (predicate: _.ValueIteratee): TakeRightWhile1x1; + /** + * 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. + */ + (predicate: _.ValueIteratee, array: _.List | null | undefined): T[]; +} +interface TakeRightWhile1x1 { + /** + * 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. + */ + (): TakeRightWhile1x1; + /** + * 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. + */ + (array: _.List | null | undefined): T[]; +} + +declare const takeLastWhile: TakeRightWhile; +export = takeLastWhile; diff --git a/types/lodash/fp/takeRight.d.ts b/types/lodash/fp/takeRight.d.ts new file mode 100644 index 0000000000..385f447919 --- /dev/null +++ b/types/lodash/fp/takeRight.d.ts @@ -0,0 +1,53 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface TakeRight { + /** + * 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; + /** + * 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. + */ + (n: number): TakeRight1x1; + /** + * 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. + */ + (n: number, array: _.List | null | undefined): T[]; +} +interface TakeRight1x1 { + /** + * 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. + */ + (): TakeRight1x1; + /** + * 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. + */ + (array: _.List | null | undefined): T[]; +} + +declare const takeRight: TakeRight; +export = takeRight; diff --git a/types/lodash/fp/takeRightWhile.d.ts b/types/lodash/fp/takeRightWhile.d.ts new file mode 100644 index 0000000000..b2a8934a14 --- /dev/null +++ b/types/lodash/fp/takeRightWhile.d.ts @@ -0,0 +1,108 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface TakeRightWhile { + /** + * 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; + /** + * 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. + */ + (predicate: _.ValueIteratee): TakeRightWhile1x1; + /** + * 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. + */ + (predicate: _.ValueIteratee, array: _.List | null | undefined): T[]; +} +interface TakeRightWhile1x1 { + /** + * 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. + */ + (): TakeRightWhile1x1; + /** + * 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. + */ + (array: _.List | null | undefined): T[]; +} + +declare const takeRightWhile: TakeRightWhile; +export = takeRightWhile; diff --git a/types/lodash/fp/takeWhile.d.ts b/types/lodash/fp/takeWhile.d.ts new file mode 100644 index 0000000000..3082de833b --- /dev/null +++ b/types/lodash/fp/takeWhile.d.ts @@ -0,0 +1,108 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface TakeWhile { + /** + * 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; + /** + * 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. + */ + (predicate: _.ValueIteratee): TakeWhile1x1; + /** + * 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. + */ + (predicate: _.ValueIteratee, array: _.List | null | undefined): T[]; +} +interface TakeWhile1x1 { + /** + * 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. + */ + (): TakeWhile1x1; + /** + * 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. + */ + (array: _.List | null | undefined): T[]; +} + +declare const takeWhile: TakeWhile; +export = takeWhile; diff --git a/types/lodash/fp/tap.d.ts b/types/lodash/fp/tap.d.ts new file mode 100644 index 0000000000..2091f9301a --- /dev/null +++ b/types/lodash/fp/tap.d.ts @@ -0,0 +1,66 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface Tap { + /** + * 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; + /** + * 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. + **/ + (interceptor: (value: T) => void): Tap1x1; + /** + * 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. + **/ + (interceptor: (value: T) => void, value: T): T; +} +interface Tap1x1 { + /** + * 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. + **/ + (): Tap1x1; + /** + * 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. + **/ + (value: T): T; +} + +declare const tap: Tap; +export = tap; diff --git a/types/lodash/fp/template.d.ts b/types/lodash/fp/template.d.ts new file mode 100644 index 0000000000..f913171374 --- /dev/null +++ b/types/lodash/fp/template.d.ts @@ -0,0 +1,37 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +type Template = + /** + * 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. + */ + (string: string) => _.TemplateExecutor; + +declare const template: Template; +export = template; diff --git a/types/lodash/fp/throttle.d.ts b/types/lodash/fp/throttle.d.ts new file mode 100644 index 0000000000..7644c669e4 --- /dev/null +++ b/types/lodash/fp/throttle.d.ts @@ -0,0 +1,98 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Throttle { + /** + * 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 and a flush method to immediately invoke + * them. 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; + /** + * 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 and a flush method to immediately invoke + * them. 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. + */ + (wait: number): Throttle1x1; + /** + * 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 and a flush method to immediately invoke + * them. 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. + */ + any>(wait: number, func: T): T & _.Cancelable; +} +interface Throttle1x1 { + /** + * 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 and a flush method to immediately invoke + * them. 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. + */ + (): Throttle1x1; + /** + * 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 and a flush method to immediately invoke + * them. 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. + */ + any>(func: T): T & _.Cancelable; +} + +declare const throttle: Throttle; +export = throttle; diff --git a/types/lodash/fp/thru.d.ts b/types/lodash/fp/thru.d.ts new file mode 100644 index 0000000000..d7f60ba8d0 --- /dev/null +++ b/types/lodash/fp/thru.d.ts @@ -0,0 +1,56 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface Thru { + /** + * 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; + /** + * 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. + */ + (interceptor: (value: T) => TResult): Thru1x1; + /** + * 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. + */ + (interceptor: (value: T) => TResult, value: T): TResult; +} +interface Thru1x1 { + /** + * 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. + */ + (): Thru1x1; + /** + * 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. + */ + (value: T): TResult; +} + +declare const thru: Thru; +export = thru; diff --git a/types/lodash/fp/times.d.ts b/types/lodash/fp/times.d.ts new file mode 100644 index 0000000000..777f7423fc --- /dev/null +++ b/types/lodash/fp/times.d.ts @@ -0,0 +1,56 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface Times { + /** + * Invokes the iteratee function n times, returning an array of the results of each invocation. The iteratee + * is invoked with one argument; (index). + * + * @param n The number of times to invoke iteratee. + * @param iteratee The function invoked per iteration. + * @return Returns the array of results. + */ + (): Times; + /** + * Invokes the iteratee function n times, returning an array of the results of each invocation. The iteratee + * is invoked with one argument; (index). + * + * @param n The number of times to invoke iteratee. + * @param iteratee The function invoked per iteration. + * @return Returns the array of results. + */ + (iteratee: (num: number) => TResult): Times1x1; + /** + * Invokes the iteratee function n times, returning an array of the results of each invocation. The iteratee + * is invoked with one argument; (index). + * + * @param n The number of times to invoke iteratee. + * @param iteratee The function invoked per iteration. + * @return Returns the array of results. + */ + (iteratee: (num: number) => TResult, n: number): TResult[]; +} +interface Times1x1 { + /** + * Invokes the iteratee function n times, returning an array of the results of each invocation. The iteratee + * is invoked with one argument; (index). + * + * @param n The number of times to invoke iteratee. + * @param iteratee The function invoked per iteration. + * @return Returns the array of results. + */ + (): Times1x1; + /** + * Invokes the iteratee function n times, returning an array of the results of each invocation. The iteratee + * is invoked with one argument; (index). + * + * @param n The number of times to invoke iteratee. + * @param iteratee The function invoked per iteration. + * @return Returns the array of results. + */ + (n: number): TResult[]; +} + +declare const times: Times; +export = times; diff --git a/types/lodash/fp/toArray.d.ts b/types/lodash/fp/toArray.d.ts new file mode 100644 index 0000000000..78d50b3fe3 --- /dev/null +++ b/types/lodash/fp/toArray.d.ts @@ -0,0 +1,32 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface ToArray { + /** + * Converts value to an array. + * + * @param value The value to convert. + * @return Returns the converted array. + */ + (value: _.List | _.Dictionary | _.NumericDictionary | null | undefined): T[]; + /** + * Converts value to an array. + * + * @param value The value to convert. + * @return Returns the converted array. + */ + (value: T): Array; + /** + * Converts value to an array. + * + * @param value The value to convert. + * @return Returns the converted array. + */ + (): any[]; +} + +declare const toArray: ToArray; +export = toArray; diff --git a/types/lodash/fp/toFinite.d.ts b/types/lodash/fp/toFinite.d.ts new file mode 100644 index 0000000000..7f28cb70da --- /dev/null +++ b/types/lodash/fp/toFinite.d.ts @@ -0,0 +1,30 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type ToFinite = + /** + * Converts `value` to a finite number. + * + * @since 4.12.0 + * @category Lang + * @param value The value to convert. + * @returns Returns the converted number. + * @example + * + * _.toFinite(3.2); + * // => 3.2 + * + * _.toFinite(Number.MIN_VALUE); + * // => 5e-324 + * + * _.toFinite(Infinity); + * // => 1.7976931348623157e+308 + * + * _.toFinite('3.2'); + * // => 3.2 + */ + (value: any) => number; + +declare const toFinite: ToFinite; +export = toFinite; diff --git a/types/lodash/fp/toInteger.d.ts b/types/lodash/fp/toInteger.d.ts new file mode 100644 index 0000000000..7eb32253d7 --- /dev/null +++ b/types/lodash/fp/toInteger.d.ts @@ -0,0 +1,31 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type ToInteger = + /** + * Converts `value` to an integer. + * + * **Note:** This function is loosely based on [`ToInteger`](http://www.ecma-international.org/ecma-262/6.0/#sec-tointeger). + * + * @category Lang + * @param value The value to convert. + * @returns Returns the converted integer. + * @example + * + * _.toInteger(3); + * // => 3 + * + * _.toInteger(Number.MIN_VALUE); + * // => 0 + * + * _.toInteger(Infinity); + * // => 1.7976931348623157e+308 + * + * _.toInteger('3'); + * // => 3 + */ + (value: any) => number; + +declare const toInteger: ToInteger; +export = toInteger; diff --git a/types/lodash/fp/toLength.d.ts b/types/lodash/fp/toLength.d.ts new file mode 100644 index 0000000000..9df6af979b --- /dev/null +++ b/types/lodash/fp/toLength.d.ts @@ -0,0 +1,32 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type ToLength = + /** + * 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). + * + * @category Lang + * @param value The value to convert. + * @return Returns the converted integer. + * @example + * + * _.toLength(3); + * // => 3 + * + * _.toLength(Number.MIN_VALUE); + * // => 0 + * + * _.toLength(Infinity); + * // => 4294967295 + * + * _.toLength('3'); + * // => 3 + */ + (value: any) => number; + +declare const toLength: ToLength; +export = toLength; diff --git a/types/lodash/fp/toLower.d.ts b/types/lodash/fp/toLower.d.ts new file mode 100644 index 0000000000..6423a579b2 --- /dev/null +++ b/types/lodash/fp/toLower.d.ts @@ -0,0 +1,15 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type ToLower = + /** + * Converts `string`, as a whole, to lower case. + * + * @param string The string to convert. + * @return Returns the lower cased string. + */ + (string: string) => string; + +declare const toLower: ToLower; +export = toLower; diff --git a/types/lodash/fp/toNumber.d.ts b/types/lodash/fp/toNumber.d.ts new file mode 100644 index 0000000000..346ded8778 --- /dev/null +++ b/types/lodash/fp/toNumber.d.ts @@ -0,0 +1,29 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type ToNumber = + /** + * Converts `value` to a number. + * + * @category Lang + * @param value The value to process. + * @returns Returns the number. + * @example + * + * _.toNumber(3); + * // => 3 + * + * _.toNumber(Number.MIN_VALUE); + * // => 5e-324 + * + * _.toNumber(Infinity); + * // => Infinity + * + * _.toNumber('3'); + * // => 3 + */ + (value: any) => number; + +declare const toNumber: ToNumber; +export = toNumber; diff --git a/types/lodash/fp/toPairs.d.ts b/types/lodash/fp/toPairs.d.ts new file mode 100644 index 0000000000..4097690ac8 --- /dev/null +++ b/types/lodash/fp/toPairs.d.ts @@ -0,0 +1,25 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface ToPairs { + /** + * Creates an array of own enumerable key-value pairs for object. + * + * @param object The object to query. + * @return Returns the new array of key-value pairs. + */ + (object: _.Dictionary | _.NumericDictionary): Array<[string, T]>; + /** + * Creates an array of own enumerable key-value pairs for object. + * + * @param object The object to query. + * @return Returns the new array of key-value pairs. + */ + (object: object): Array<[string, any]>; +} + +declare const toPairs: ToPairs; +export = toPairs; diff --git a/types/lodash/fp/toPairsIn.d.ts b/types/lodash/fp/toPairsIn.d.ts new file mode 100644 index 0000000000..80859cc318 --- /dev/null +++ b/types/lodash/fp/toPairsIn.d.ts @@ -0,0 +1,25 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface ToPairsIn { + /** + * Creates an array of own and inherited enumerable key-value pairs for object. + * + * @param object The object to query. + * @return Returns the new array of key-value pairs. + */ + (object: _.Dictionary | _.NumericDictionary): Array<[string, T]>; + /** + * Creates an array of own and inherited enumerable key-value pairs for object. + * + * @param object The object to query. + * @return Returns the new array of key-value pairs. + */ + (object: object): Array<[string, any]>; +} + +declare const toPairsIn: ToPairsIn; +export = toPairsIn; diff --git a/types/lodash/fp/toPath.d.ts b/types/lodash/fp/toPath.d.ts new file mode 100644 index 0000000000..a501811e14 --- /dev/null +++ b/types/lodash/fp/toPath.d.ts @@ -0,0 +1,32 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type ToPath = + /** + * Converts `value` to a property path array. + * + * @category Util + * @param value The value to convert. + * @returns 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 + */ + (value: any) => string[]; + +declare const toPath: ToPath; +export = toPath; diff --git a/types/lodash/fp/toPlainObject.d.ts b/types/lodash/fp/toPlainObject.d.ts new file mode 100644 index 0000000000..18b2eada62 --- /dev/null +++ b/types/lodash/fp/toPlainObject.d.ts @@ -0,0 +1,16 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type ToPlainObject = + /** + * 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. + */ + (value: any) => any; + +declare const toPlainObject: ToPlainObject; +export = toPlainObject; diff --git a/types/lodash/fp/toSafeInteger.d.ts b/types/lodash/fp/toSafeInteger.d.ts new file mode 100644 index 0000000000..9ddc6a79a1 --- /dev/null +++ b/types/lodash/fp/toSafeInteger.d.ts @@ -0,0 +1,30 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type ToSafeInteger = + /** + * Converts `value` to a safe integer. A safe integer can be compared and + * represented correctly. + * + * @category Lang + * @param value The value to convert. + * @returns Returns the converted integer. + * @example + * + * _.toSafeInteger(3); + * // => 3 + * + * _.toSafeInteger(Number.MIN_VALUE); + * // => 0 + * + * _.toSafeInteger(Infinity); + * // => 9007199254740991 + * + * _.toSafeInteger('3'); + * // => 3 + */ + (value: any) => number; + +declare const toSafeInteger: ToSafeInteger; +export = toSafeInteger; diff --git a/types/lodash/fp/toString.d.ts b/types/lodash/fp/toString.d.ts new file mode 100644 index 0000000000..0dcf51fecf --- /dev/null +++ b/types/lodash/fp/toString.d.ts @@ -0,0 +1,27 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type ToString = + /** + * 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. + * + * @category Lang + * @param value The value to process. + * @returns Returns the string. + * @example + * + * _.toString(null); + * // => '' + * + * _.toString(-0); + * // => '-0' + * + * _.toString([1, 2, 3]); + * // => '1,2,3' + */ + (value: any) => string; + +declare const toString: ToString; +export = toString; diff --git a/types/lodash/fp/toUpper.d.ts b/types/lodash/fp/toUpper.d.ts new file mode 100644 index 0000000000..af46b1dba8 --- /dev/null +++ b/types/lodash/fp/toUpper.d.ts @@ -0,0 +1,15 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type ToUpper = + /** + * Converts `string`, as a whole, to upper case. + * + * @param string The string to convert. + * @return Returns the upper cased string. + */ + (string: string) => string; + +declare const toUpper: ToUpper; +export = toUpper; diff --git a/types/lodash/fp/transform.d.ts b/types/lodash/fp/transform.d.ts new file mode 100644 index 0000000000..420258c514 --- /dev/null +++ b/types/lodash/fp/transform.d.ts @@ -0,0 +1,240 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Transform { + /** + * 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; + /** + * 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. + */ + (iteratee: _.MemoVoidIteratorCapped): Transform1x1; + /** + * 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. + */ + (iteratee: _.MemoVoidIteratorCapped, accumulator: ReadonlyArray): Transform1x2; + /** + * 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. + */ + (iteratee: _.MemoVoidIteratorCapped, accumulator: ReadonlyArray, object: ReadonlyArray | _.Dictionary): TResult[]; + /** + * 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. + */ + (iteratee: _.MemoVoidIteratorCapped>): Transform2x1; + /** + * 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. + */ + (iteratee: _.MemoVoidIteratorCapped>, accumulator: _.Dictionary): Transform2x2; + /** + * 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. + */ + (iteratee: _.MemoVoidIteratorCapped>, accumulator: _.Dictionary, object: ReadonlyArray | _.Dictionary): _.Dictionary; +} +interface Transform1x1 { + /** + * 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. + */ + (): Transform1x1; + /** + * 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. + */ + (accumulator: ReadonlyArray): Transform1x2; + /** + * 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. + */ + (accumulator: ReadonlyArray, object: ReadonlyArray | _.Dictionary): TResult[]; +} +interface Transform1x2 { + /** + * 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. + */ + (): Transform1x2; + /** + * 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. + */ + (object: ReadonlyArray | _.Dictionary): TResult[]; +} +interface Transform2x1 { + /** + * 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. + */ + (): Transform2x1; + /** + * 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. + */ + (accumulator: _.Dictionary): Transform2x2; + /** + * 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. + */ + (accumulator: _.Dictionary, object: ReadonlyArray | _.Dictionary): _.Dictionary; +} +interface Transform2x2 { + /** + * 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. + */ + (): Transform2x2; + /** + * 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. + */ + (object: ReadonlyArray | _.Dictionary): _.Dictionary; +} + +declare const transform: Transform; +export = transform; diff --git a/types/lodash/fp/trim.d.ts b/types/lodash/fp/trim.d.ts new file mode 100644 index 0000000000..7b1c8696b4 --- /dev/null +++ b/types/lodash/fp/trim.d.ts @@ -0,0 +1,16 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type Trim = + /** + * 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. + */ + (string: string) => string; + +declare const trim: Trim; +export = trim; diff --git a/types/lodash/fp/trimChars.d.ts b/types/lodash/fp/trimChars.d.ts new file mode 100644 index 0000000000..8c0a97e9f5 --- /dev/null +++ b/types/lodash/fp/trimChars.d.ts @@ -0,0 +1,51 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface Trim { + /** + * 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; + /** + * 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. + */ + (chars: string): Trim1x1; + /** + * 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. + */ + (chars: string, string: string): string; +} +interface Trim1x1 { + /** + * 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. + */ + (): Trim1x1; + /** + * 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. + */ + (string: string): string; +} + +declare const trimChars: Trim; +export = trimChars; diff --git a/types/lodash/fp/trimCharsEnd.d.ts b/types/lodash/fp/trimCharsEnd.d.ts new file mode 100644 index 0000000000..f8b74c9c5a --- /dev/null +++ b/types/lodash/fp/trimCharsEnd.d.ts @@ -0,0 +1,51 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface TrimEnd { + /** + * 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. + */ + (): TrimEnd; + /** + * 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. + */ + (chars: string): TrimEnd1x1; + /** + * 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. + */ + (chars: string, string: string): string; +} +interface TrimEnd1x1 { + /** + * 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. + */ + (): TrimEnd1x1; + /** + * 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. + */ + (string: string): string; +} + +declare const trimCharsEnd: TrimEnd; +export = trimCharsEnd; diff --git a/types/lodash/fp/trimCharsStart.d.ts b/types/lodash/fp/trimCharsStart.d.ts new file mode 100644 index 0000000000..5b4da3996d --- /dev/null +++ b/types/lodash/fp/trimCharsStart.d.ts @@ -0,0 +1,51 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface TrimStart { + /** + * 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. + */ + (): TrimStart; + /** + * 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. + */ + (chars: string): TrimStart1x1; + /** + * 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. + */ + (chars: string, string: string): string; +} +interface TrimStart1x1 { + /** + * 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. + */ + (): TrimStart1x1; + /** + * 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. + */ + (string: string): string; +} + +declare const trimCharsStart: TrimStart; +export = trimCharsStart; diff --git a/types/lodash/fp/trimEnd.d.ts b/types/lodash/fp/trimEnd.d.ts new file mode 100644 index 0000000000..02754779a2 --- /dev/null +++ b/types/lodash/fp/trimEnd.d.ts @@ -0,0 +1,16 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type TrimEnd = + /** + * 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. + */ + (string: string) => string; + +declare const trimEnd: TrimEnd; +export = trimEnd; diff --git a/types/lodash/fp/trimStart.d.ts b/types/lodash/fp/trimStart.d.ts new file mode 100644 index 0000000000..567dc22e5e --- /dev/null +++ b/types/lodash/fp/trimStart.d.ts @@ -0,0 +1,16 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type TrimStart = + /** + * 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. + */ + (string: string) => string; + +declare const trimStart: TrimStart; +export = trimStart; diff --git a/types/lodash/fp/truncate.d.ts b/types/lodash/fp/truncate.d.ts new file mode 100644 index 0000000000..6645f41697 --- /dev/null +++ b/types/lodash/fp/truncate.d.ts @@ -0,0 +1,58 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Truncate { + /** + * 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. + */ + (): Truncate; + /** + * 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. + */ + (options: _.TruncateOptions): Truncate1x1; + /** + * 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. + */ + (options: _.TruncateOptions, string: string): string; +} +interface Truncate1x1 { + /** + * 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. + */ + (): Truncate1x1; + /** + * 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. + */ + (string: string): string; +} + +declare const truncate: Truncate; +export = truncate; diff --git a/types/lodash/fp/unapply.d.ts b/types/lodash/fp/unapply.d.ts new file mode 100644 index 0000000000..8bde142263 --- /dev/null +++ b/types/lodash/fp/unapply.d.ts @@ -0,0 +1,19 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type Rest = + /** + * 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. + */ + (func: (...args: any[]) => any) => (...args: any[]) => any; + +declare const unapply: Rest; +export = unapply; diff --git a/types/lodash/fp/unary.d.ts b/types/lodash/fp/unary.d.ts new file mode 100644 index 0000000000..19e2946e96 --- /dev/null +++ b/types/lodash/fp/unary.d.ts @@ -0,0 +1,21 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type Unary = + /** + * Creates a function that accepts up to one argument, ignoring any + * additional arguments. + * + * @category Function + * @param func The function to cap arguments for. + * @returns Returns the new function. + * @example + * + * _.map(['6', '8', '10'], _.unary(parseInt)); + * // => [6, 8, 10] + */ + (func: (arg1: T, ...args: any[]) => TResult) => (arg1: T) => TResult; + +declare const unary: Unary; +export = unary; diff --git a/types/lodash/fp/unescape.d.ts b/types/lodash/fp/unescape.d.ts new file mode 100644 index 0000000000..20b602a298 --- /dev/null +++ b/types/lodash/fp/unescape.d.ts @@ -0,0 +1,19 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type Unescape = + /** + * The inverse of _.escape; this method converts the HTML entities &, <, >, ", ', and ` + * in string to their corresponding characters. + * + * Note: No other HTML entities are unescaped. To unescape additional HTML entities use a third-party library + * like he. + * + * @param string The string to unescape. + * @return Returns the unescaped string. + */ + (string: string) => string; + +declare const unescape: Unescape; +export = unescape; diff --git a/types/lodash/fp/union.d.ts b/types/lodash/fp/union.d.ts new file mode 100644 index 0000000000..99c9e3d4ff --- /dev/null +++ b/types/lodash/fp/union.d.ts @@ -0,0 +1,53 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Union { + /** + * 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; + /** + * 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. + */ + (arrays2: _.List | null | undefined): Union1x1; + /** + * 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. + */ + (arrays2: _.List | null | undefined, arrays: _.List | null | undefined): T[]; +} +interface Union1x1 { + /** + * 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. + */ + (): Union1x1; + /** + * 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. + */ + (arrays: _.List | null | undefined): T[]; +} + +declare const union: Union; +export = union; diff --git a/types/lodash/fp/unionBy.d.ts b/types/lodash/fp/unionBy.d.ts new file mode 100644 index 0000000000..42db2e6352 --- /dev/null +++ b/types/lodash/fp/unionBy.d.ts @@ -0,0 +1,105 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface UnionBy { + /** + * 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). + * + * @param arrays The arrays to inspect. + * @param iteratee The iteratee invoked per element. + * @return Returns the new array of combined values. + */ + (): UnionBy; + /** + * 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). + * + * @param arrays The arrays to inspect. + * @param iteratee The iteratee invoked per element. + * @return Returns the new array of combined values. + */ + (iteratee: _.ValueIteratee): UnionBy1x1; + /** + * 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). + * + * @param arrays The arrays to inspect. + * @param iteratee The iteratee invoked per element. + * @return Returns the new array of combined values. + */ + (iteratee: _.ValueIteratee, arrays1: _.List | null | undefined): UnionBy1x2; + /** + * 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). + * + * @param arrays The arrays to inspect. + * @param iteratee The iteratee invoked per element. + * @return Returns the new array of combined values. + */ + (iteratee: _.ValueIteratee, arrays1: _.List | null | undefined, arrays2: _.List | null | undefined): T[]; +} +interface UnionBy1x1 { + /** + * 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). + * + * @param arrays The arrays to inspect. + * @param iteratee The iteratee invoked per element. + * @return Returns the new array of combined values. + */ + (): UnionBy1x1; + /** + * 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). + * + * @param arrays The arrays to inspect. + * @param iteratee The iteratee invoked per element. + * @return Returns the new array of combined values. + */ + (arrays1: _.List | null | undefined): UnionBy1x2; + /** + * 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). + * + * @param arrays The arrays to inspect. + * @param iteratee The iteratee invoked per element. + * @return Returns the new array of combined values. + */ + (arrays1: _.List | null | undefined, arrays2: _.List | null | undefined): T[]; +} +interface UnionBy1x2 { + /** + * 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). + * + * @param arrays The arrays to inspect. + * @param iteratee The iteratee invoked per element. + * @return Returns the new array of combined values. + */ + (): UnionBy1x2; + /** + * 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). + * + * @param arrays The arrays to inspect. + * @param iteratee The iteratee invoked per element. + * @return Returns the new array of combined values. + */ + (arrays2: _.List | null | undefined): T[]; +} + +declare const unionBy: UnionBy; +export = unionBy; diff --git a/types/lodash/fp/unionWith.d.ts b/types/lodash/fp/unionWith.d.ts new file mode 100644 index 0000000000..89a5066ec0 --- /dev/null +++ b/types/lodash/fp/unionWith.d.ts @@ -0,0 +1,177 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface UnionWith { + /** + * 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). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [comparator] The comparator invoked per element. + * @returns 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; + /** + * 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). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [comparator] The comparator invoked per element. + * @returns 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 }] + */ + (comparator: _.Comparator): UnionWith1x1; + /** + * 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). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [comparator] The comparator invoked per element. + * @returns 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 }] + */ + (comparator: _.Comparator, arrays: _.List | null | undefined): UnionWith1x2; + /** + * 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). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [comparator] The comparator invoked per element. + * @returns 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 }] + */ + (comparator: _.Comparator, arrays: _.List | null | undefined, arrays2: _.List | null | undefined): T[]; +} +interface UnionWith1x1 { + /** + * 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). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [comparator] The comparator invoked per element. + * @returns 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 }] + */ + (): UnionWith1x1; + /** + * 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). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [comparator] The comparator invoked per element. + * @returns 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 }] + */ + (arrays: _.List | null | undefined): UnionWith1x2; + /** + * 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). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [comparator] The comparator invoked per element. + * @returns 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 }] + */ + (arrays: _.List | null | undefined, arrays2: _.List | null | undefined): T[]; +} +interface UnionWith1x2 { + /** + * 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). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [comparator] The comparator invoked per element. + * @returns 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 }] + */ + (): UnionWith1x2; + /** + * 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). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [comparator] The comparator invoked per element. + * @returns 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 }] + */ + (arrays2: _.List | null | undefined): T[]; +} + +declare const unionWith: UnionWith; +export = unionWith; diff --git a/types/lodash/fp/uniq.d.ts b/types/lodash/fp/uniq.d.ts new file mode 100644 index 0000000000..a627214680 --- /dev/null +++ b/types/lodash/fp/uniq.d.ts @@ -0,0 +1,25 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +type Uniq = + /** + * 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. + * + * @category Array + * @param array The array to inspect. + * @returns Returns the new duplicate free array. + * @example + * + * _.uniq([2, 1, 2]); + * // => [2, 1] + */ + (array: _.List | null | undefined) => T[]; + +declare const uniq: Uniq; +export = uniq; diff --git a/types/lodash/fp/uniqBy.d.ts b/types/lodash/fp/uniqBy.d.ts new file mode 100644 index 0000000000..d89b8908c5 --- /dev/null +++ b/types/lodash/fp/uniqBy.d.ts @@ -0,0 +1,186 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface UniqBy { + /** + * 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). + * + * @category Array + * @param array The array to inspect. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns 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; + /** + * 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). + * + * @category Array + * @param array The array to inspect. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns 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 }] + */ + (iteratee: (value: string) => _.NotVoid): UniqBy1x1; + /** + * 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). + * + * @category Array + * @param array The array to inspect. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns 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 }] + */ + (iteratee: (value: string) => _.NotVoid, array: string | null | undefined): string[]; + /** + * 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). + * + * @category Array + * @param array The array to inspect. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns 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 }] + */ + (iteratee: _.ValueIteratee): UniqBy2x1; + /** + * 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). + * + * @category Array + * @param array The array to inspect. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns 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 }] + */ + (iteratee: _.ValueIteratee, array: _.List | null | undefined): T[]; +} +interface UniqBy1x1 { + /** + * 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). + * + * @category Array + * @param array The array to inspect. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns 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 }] + */ + (): UniqBy1x1; + /** + * 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). + * + * @category Array + * @param array The array to inspect. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns 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 }] + */ + (array: string | null | undefined): string[]; +} +interface UniqBy2x1 { + /** + * 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). + * + * @category Array + * @param array The array to inspect. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns 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 }] + */ + (): UniqBy2x1; + /** + * 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). + * + * @category Array + * @param array The array to inspect. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns 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 }] + */ + (array: _.List | null | undefined): T[]; +} + +declare const uniqBy: UniqBy; +export = uniqBy; diff --git a/types/lodash/fp/uniqWith.d.ts b/types/lodash/fp/uniqWith.d.ts new file mode 100644 index 0000000000..f0e6de90ff --- /dev/null +++ b/types/lodash/fp/uniqWith.d.ts @@ -0,0 +1,98 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface UniqWith { + /** + * 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). + * + * @category Array + * @param array The array to inspect. + * @param [comparator] The comparator invoked per element. + * @returns 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; + /** + * 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). + * + * @category Array + * @param array The array to inspect. + * @param [comparator] The comparator invoked per element. + * @returns 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 }] + */ + (comparator: _.Comparator): UniqWith1x1; + /** + * 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). + * + * @category Array + * @param array The array to inspect. + * @param [comparator] The comparator invoked per element. + * @returns 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 }] + */ + (comparator: _.Comparator, array: _.List | null | undefined): T[]; +} +interface UniqWith1x1 { + /** + * 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). + * + * @category Array + * @param array The array to inspect. + * @param [comparator] The comparator invoked per element. + * @returns 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 }] + */ + (): UniqWith1x1; + /** + * 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). + * + * @category Array + * @param array The array to inspect. + * @param [comparator] The comparator invoked per element. + * @returns 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 }] + */ + (array: _.List | null | undefined): T[]; +} + +declare const uniqWith: UniqWith; +export = uniqWith; diff --git a/types/lodash/fp/uniqueId.d.ts b/types/lodash/fp/uniqueId.d.ts new file mode 100644 index 0000000000..d9ba028d53 --- /dev/null +++ b/types/lodash/fp/uniqueId.d.ts @@ -0,0 +1,15 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type UniqueId = + /** + * 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. + */ + (prefix: string) => string; + +declare const uniqueId: UniqueId; +export = uniqueId; diff --git a/types/lodash/fp/unnest.d.ts b/types/lodash/fp/unnest.d.ts new file mode 100644 index 0000000000..fc05e923c5 --- /dev/null +++ b/types/lodash/fp/unnest.d.ts @@ -0,0 +1,17 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +type Flatten = + /** + * Flattens `array` a single level deep. + * + * @param array The array to flatten. + * @return Returns the new flattened array. + */ + (array: _.List<_.Many> | null | undefined) => T[]; + +declare const unnest: Flatten; +export = unnest; diff --git a/types/lodash/fp/unset.d.ts b/types/lodash/fp/unset.d.ts new file mode 100644 index 0000000000..12199c061a --- /dev/null +++ b/types/lodash/fp/unset.d.ts @@ -0,0 +1,63 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Unset { + /** + * Removes the property at path of object. + * + * Note: This method mutates object. + * + * @param object The object to modify. + * @param path The path of the property to unset. + * @return Returns true if the property is deleted, else false. + */ + (): Unset; + /** + * Removes the property at path of object. + * + * Note: This method mutates object. + * + * @param object The object to modify. + * @param path The path of the property to unset. + * @return Returns true if the property is deleted, else false. + */ + (path: _.PropertyPath): Unset1x1; + /** + * Removes the property at path of object. + * + * Note: This method mutates object. + * + * @param object The object to modify. + * @param path The path of the property to unset. + * @return Returns true if the property is deleted, else false. + */ + (path: _.PropertyPath, object: any): boolean; +} +interface Unset1x1 { + /** + * Removes the property at path of object. + * + * Note: This method mutates object. + * + * @param object The object to modify. + * @param path The path of the property to unset. + * @return Returns true if the property is deleted, else false. + */ + (): Unset1x1; + /** + * Removes the property at path of object. + * + * Note: This method mutates object. + * + * @param object The object to modify. + * @param path The path of the property to unset. + * @return Returns true if the property is deleted, else false. + */ + (object: any): boolean; +} + +declare const unset: Unset; +export = unset; diff --git a/types/lodash/fp/unzip.d.ts b/types/lodash/fp/unzip.d.ts new file mode 100644 index 0000000000..e6ce334d48 --- /dev/null +++ b/types/lodash/fp/unzip.d.ts @@ -0,0 +1,18 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +type Unzip = + /** + * 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. + */ + (array: T[][] | _.List<_.List> | null | undefined) => T[][]; + +declare const unzip: Unzip; +export = unzip; diff --git a/types/lodash/fp/unzipWith.d.ts b/types/lodash/fp/unzipWith.d.ts new file mode 100644 index 0000000000..36fd2e6bf0 --- /dev/null +++ b/types/lodash/fp/unzipWith.d.ts @@ -0,0 +1,68 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface UnzipWith { + /** + * 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; + /** + * 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. + */ + (iteratee: (...values: T[]) => TResult): UnzipWith1x1; + /** + * 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. + */ + (iteratee: (...values: T[]) => TResult, array: _.List<_.List> | null | undefined): TResult[]; +} +interface UnzipWith1x1 { + /** + * 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. + */ + (): UnzipWith1x1; + /** + * 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. + */ + (array: _.List<_.List> | null | undefined): TResult[]; +} + +declare const unzipWith: UnzipWith; +export = unzipWith; diff --git a/types/lodash/fp/update.d.ts b/types/lodash/fp/update.d.ts new file mode 100644 index 0000000000..011a8ea61e --- /dev/null +++ b/types/lodash/fp/update.d.ts @@ -0,0 +1,105 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Update { + /** + * This method is like _.set except that accepts updater to produce the value to set. Use _.updateWith to + * customize path creation. The updater is invoked with one argument: (value). + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param updater The function to produce the updated value. + * @return Returns object. + */ + (): Update; + /** + * This method is like _.set except that accepts updater to produce the value to set. Use _.updateWith to + * customize path creation. The updater is invoked with one argument: (value). + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param updater The function to produce the updated value. + * @return Returns object. + */ + (path: _.PropertyPath): Update1x1; + /** + * This method is like _.set except that accepts updater to produce the value to set. Use _.updateWith to + * customize path creation. The updater is invoked with one argument: (value). + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param updater The function to produce the updated value. + * @return Returns object. + */ + (path: _.PropertyPath, updater: (value: any) => any): Update1x2; + /** + * This method is like _.set except that accepts updater to produce the value to set. Use _.updateWith to + * customize path creation. The updater is invoked with one argument: (value). + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param updater The function to produce the updated value. + * @return Returns object. + */ + (path: _.PropertyPath, updater: (value: any) => any, object: object): any; +} +interface Update1x1 { + /** + * This method is like _.set except that accepts updater to produce the value to set. Use _.updateWith to + * customize path creation. The updater is invoked with one argument: (value). + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param updater The function to produce the updated value. + * @return Returns object. + */ + (): Update1x1; + /** + * This method is like _.set except that accepts updater to produce the value to set. Use _.updateWith to + * customize path creation. The updater is invoked with one argument: (value). + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param updater The function to produce the updated value. + * @return Returns object. + */ + (updater: (value: any) => any): Update1x2; + /** + * This method is like _.set except that accepts updater to produce the value to set. Use _.updateWith to + * customize path creation. The updater is invoked with one argument: (value). + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param updater The function to produce the updated value. + * @return Returns object. + */ + (updater: (value: any) => any, object: object): any; +} +interface Update1x2 { + /** + * This method is like _.set except that accepts updater to produce the value to set. Use _.updateWith to + * customize path creation. The updater is invoked with one argument: (value). + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param updater The function to produce the updated value. + * @return Returns object. + */ + (): Update1x2; + /** + * This method is like _.set except that accepts updater to produce the value to set. Use _.updateWith to + * customize path creation. The updater is invoked with one argument: (value). + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param updater The function to produce the updated value. + * @return Returns object. + */ + (object: object): any; +} + +declare const update: Update; +export = update; diff --git a/types/lodash/fp/updateWith.d.ts b/types/lodash/fp/updateWith.d.ts new file mode 100644 index 0000000000..e26ed161d2 --- /dev/null +++ b/types/lodash/fp/updateWith.d.ts @@ -0,0 +1,431 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface UpdateWith { + /** + * This method is like `_.update` except that it accepts `customizer` which is + * invoked to produce the objects of `path`. If `customizer` returns `undefined` + * path creation is handled by the method instead. The `customizer` is invoked + * with three arguments: (nsValue, key, nsObject). + * + * **Note:** This method mutates `object`. + * + * @since 4.6.0 + * @category Object + * @param object The object to modify. + * @param path The path of the property to set. + * @param updater The function to produce the updated value. + * @param [customizer] The function to customize assigned values. + * @returns Returns `object`. + * @example + * + * var object = {}; + * + * _.updateWith(object, '[0][1]', _.constant('a'), Object); + * // => { '0': { '1': 'a' } } + */ + (): UpdateWith; + /** + * This method is like `_.update` except that it accepts `customizer` which is + * invoked to produce the objects of `path`. If `customizer` returns `undefined` + * path creation is handled by the method instead. The `customizer` is invoked + * with three arguments: (nsValue, key, nsObject). + * + * **Note:** This method mutates `object`. + * + * @since 4.6.0 + * @category Object + * @param object The object to modify. + * @param path The path of the property to set. + * @param updater The function to produce the updated value. + * @param [customizer] The function to customize assigned values. + * @returns Returns `object`. + * @example + * + * var object = {}; + * + * _.updateWith(object, '[0][1]', _.constant('a'), Object); + * // => { '0': { '1': 'a' } } + */ + (customizer: _.SetWithCustomizer): UpdateWith1x1; + /** + * This method is like `_.update` except that it accepts `customizer` which is + * invoked to produce the objects of `path`. If `customizer` returns `undefined` + * path creation is handled by the method instead. The `customizer` is invoked + * with three arguments: (nsValue, key, nsObject). + * + * **Note:** This method mutates `object`. + * + * @since 4.6.0 + * @category Object + * @param object The object to modify. + * @param path The path of the property to set. + * @param updater The function to produce the updated value. + * @param [customizer] The function to customize assigned values. + * @returns Returns `object`. + * @example + * + * var object = {}; + * + * _.updateWith(object, '[0][1]', _.constant('a'), Object); + * // => { '0': { '1': 'a' } } + */ + (customizer: _.SetWithCustomizer, path: _.PropertyPath): UpdateWith1x2; + /** + * This method is like `_.update` except that it accepts `customizer` which is + * invoked to produce the objects of `path`. If `customizer` returns `undefined` + * path creation is handled by the method instead. The `customizer` is invoked + * with three arguments: (nsValue, key, nsObject). + * + * **Note:** This method mutates `object`. + * + * @since 4.6.0 + * @category Object + * @param object The object to modify. + * @param path The path of the property to set. + * @param updater The function to produce the updated value. + * @param [customizer] The function to customize assigned values. + * @returns Returns `object`. + * @example + * + * var object = {}; + * + * _.updateWith(object, '[0][1]', _.constant('a'), Object); + * // => { '0': { '1': 'a' } } + */ + (customizer: _.SetWithCustomizer, path: _.PropertyPath, updater: (oldValue: any) => any): UpdateWith1x3; + /** + * This method is like `_.update` except that it accepts `customizer` which is + * invoked to produce the objects of `path`. If `customizer` returns `undefined` + * path creation is handled by the method instead. The `customizer` is invoked + * with three arguments: (nsValue, key, nsObject). + * + * **Note:** This method mutates `object`. + * + * @since 4.6.0 + * @category Object + * @param object The object to modify. + * @param path The path of the property to set. + * @param updater The function to produce the updated value. + * @param [customizer] The function to customize assigned values. + * @returns Returns `object`. + * @example + * + * var object = {}; + * + * _.updateWith(object, '[0][1]', _.constant('a'), Object); + * // => { '0': { '1': 'a' } } + */ + (customizer: _.SetWithCustomizer, path: _.PropertyPath, updater: (oldValue: any) => any, object: T): T; + /** + * This method is like `_.update` except that it accepts `customizer` which is + * invoked to produce the objects of `path`. If `customizer` returns `undefined` + * path creation is handled by the method instead. The `customizer` is invoked + * with three arguments: (nsValue, key, nsObject). + * + * **Note:** This method mutates `object`. + * + * @since 4.6.0 + * @category Object + * @param object The object to modify. + * @param path The path of the property to set. + * @param updater The function to produce the updated value. + * @param [customizer] The function to customize assigned values. + * @returns Returns `object`. + * @example + * + * var object = {}; + * + * _.updateWith(object, '[0][1]', _.constant('a'), Object); + * // => { '0': { '1': 'a' } } + */ + (customizer: _.SetWithCustomizer, path: _.PropertyPath, updater: (oldValue: any) => any, object: T): TResult; +} +interface UpdateWith1x1 { + /** + * This method is like `_.update` except that it accepts `customizer` which is + * invoked to produce the objects of `path`. If `customizer` returns `undefined` + * path creation is handled by the method instead. The `customizer` is invoked + * with three arguments: (nsValue, key, nsObject). + * + * **Note:** This method mutates `object`. + * + * @since 4.6.0 + * @category Object + * @param object The object to modify. + * @param path The path of the property to set. + * @param updater The function to produce the updated value. + * @param [customizer] The function to customize assigned values. + * @returns Returns `object`. + * @example + * + * var object = {}; + * + * _.updateWith(object, '[0][1]', _.constant('a'), Object); + * // => { '0': { '1': 'a' } } + */ + (): UpdateWith1x1; + /** + * This method is like `_.update` except that it accepts `customizer` which is + * invoked to produce the objects of `path`. If `customizer` returns `undefined` + * path creation is handled by the method instead. The `customizer` is invoked + * with three arguments: (nsValue, key, nsObject). + * + * **Note:** This method mutates `object`. + * + * @since 4.6.0 + * @category Object + * @param object The object to modify. + * @param path The path of the property to set. + * @param updater The function to produce the updated value. + * @param [customizer] The function to customize assigned values. + * @returns Returns `object`. + * @example + * + * var object = {}; + * + * _.updateWith(object, '[0][1]', _.constant('a'), Object); + * // => { '0': { '1': 'a' } } + */ + (path: _.PropertyPath): UpdateWith1x2; + /** + * This method is like `_.update` except that it accepts `customizer` which is + * invoked to produce the objects of `path`. If `customizer` returns `undefined` + * path creation is handled by the method instead. The `customizer` is invoked + * with three arguments: (nsValue, key, nsObject). + * + * **Note:** This method mutates `object`. + * + * @since 4.6.0 + * @category Object + * @param object The object to modify. + * @param path The path of the property to set. + * @param updater The function to produce the updated value. + * @param [customizer] The function to customize assigned values. + * @returns Returns `object`. + * @example + * + * var object = {}; + * + * _.updateWith(object, '[0][1]', _.constant('a'), Object); + * // => { '0': { '1': 'a' } } + */ + (path: _.PropertyPath, updater: (oldValue: any) => any): UpdateWith1x3; + /** + * This method is like `_.update` except that it accepts `customizer` which is + * invoked to produce the objects of `path`. If `customizer` returns `undefined` + * path creation is handled by the method instead. The `customizer` is invoked + * with three arguments: (nsValue, key, nsObject). + * + * **Note:** This method mutates `object`. + * + * @since 4.6.0 + * @category Object + * @param object The object to modify. + * @param path The path of the property to set. + * @param updater The function to produce the updated value. + * @param [customizer] The function to customize assigned values. + * @returns Returns `object`. + * @example + * + * var object = {}; + * + * _.updateWith(object, '[0][1]', _.constant('a'), Object); + * // => { '0': { '1': 'a' } } + */ + (path: _.PropertyPath, updater: (oldValue: any) => any, object: T): T; + /** + * This method is like `_.update` except that it accepts `customizer` which is + * invoked to produce the objects of `path`. If `customizer` returns `undefined` + * path creation is handled by the method instead. The `customizer` is invoked + * with three arguments: (nsValue, key, nsObject). + * + * **Note:** This method mutates `object`. + * + * @since 4.6.0 + * @category Object + * @param object The object to modify. + * @param path The path of the property to set. + * @param updater The function to produce the updated value. + * @param [customizer] The function to customize assigned values. + * @returns Returns `object`. + * @example + * + * var object = {}; + * + * _.updateWith(object, '[0][1]', _.constant('a'), Object); + * // => { '0': { '1': 'a' } } + */ + (path: _.PropertyPath, updater: (oldValue: any) => any, object: T): TResult; +} +interface UpdateWith1x2 { + /** + * This method is like `_.update` except that it accepts `customizer` which is + * invoked to produce the objects of `path`. If `customizer` returns `undefined` + * path creation is handled by the method instead. The `customizer` is invoked + * with three arguments: (nsValue, key, nsObject). + * + * **Note:** This method mutates `object`. + * + * @since 4.6.0 + * @category Object + * @param object The object to modify. + * @param path The path of the property to set. + * @param updater The function to produce the updated value. + * @param [customizer] The function to customize assigned values. + * @returns Returns `object`. + * @example + * + * var object = {}; + * + * _.updateWith(object, '[0][1]', _.constant('a'), Object); + * // => { '0': { '1': 'a' } } + */ + (): UpdateWith1x2; + /** + * This method is like `_.update` except that it accepts `customizer` which is + * invoked to produce the objects of `path`. If `customizer` returns `undefined` + * path creation is handled by the method instead. The `customizer` is invoked + * with three arguments: (nsValue, key, nsObject). + * + * **Note:** This method mutates `object`. + * + * @since 4.6.0 + * @category Object + * @param object The object to modify. + * @param path The path of the property to set. + * @param updater The function to produce the updated value. + * @param [customizer] The function to customize assigned values. + * @returns Returns `object`. + * @example + * + * var object = {}; + * + * _.updateWith(object, '[0][1]', _.constant('a'), Object); + * // => { '0': { '1': 'a' } } + */ + (updater: (oldValue: any) => any): UpdateWith1x3; + /** + * This method is like `_.update` except that it accepts `customizer` which is + * invoked to produce the objects of `path`. If `customizer` returns `undefined` + * path creation is handled by the method instead. The `customizer` is invoked + * with three arguments: (nsValue, key, nsObject). + * + * **Note:** This method mutates `object`. + * + * @since 4.6.0 + * @category Object + * @param object The object to modify. + * @param path The path of the property to set. + * @param updater The function to produce the updated value. + * @param [customizer] The function to customize assigned values. + * @returns Returns `object`. + * @example + * + * var object = {}; + * + * _.updateWith(object, '[0][1]', _.constant('a'), Object); + * // => { '0': { '1': 'a' } } + */ + (updater: (oldValue: any) => any, object: T): T; + /** + * This method is like `_.update` except that it accepts `customizer` which is + * invoked to produce the objects of `path`. If `customizer` returns `undefined` + * path creation is handled by the method instead. The `customizer` is invoked + * with three arguments: (nsValue, key, nsObject). + * + * **Note:** This method mutates `object`. + * + * @since 4.6.0 + * @category Object + * @param object The object to modify. + * @param path The path of the property to set. + * @param updater The function to produce the updated value. + * @param [customizer] The function to customize assigned values. + * @returns Returns `object`. + * @example + * + * var object = {}; + * + * _.updateWith(object, '[0][1]', _.constant('a'), Object); + * // => { '0': { '1': 'a' } } + */ + (updater: (oldValue: any) => any, object: T): TResult; +} +interface UpdateWith1x3 { + /** + * This method is like `_.update` except that it accepts `customizer` which is + * invoked to produce the objects of `path`. If `customizer` returns `undefined` + * path creation is handled by the method instead. The `customizer` is invoked + * with three arguments: (nsValue, key, nsObject). + * + * **Note:** This method mutates `object`. + * + * @since 4.6.0 + * @category Object + * @param object The object to modify. + * @param path The path of the property to set. + * @param updater The function to produce the updated value. + * @param [customizer] The function to customize assigned values. + * @returns Returns `object`. + * @example + * + * var object = {}; + * + * _.updateWith(object, '[0][1]', _.constant('a'), Object); + * // => { '0': { '1': 'a' } } + */ + (): UpdateWith1x3; + /** + * This method is like `_.update` except that it accepts `customizer` which is + * invoked to produce the objects of `path`. If `customizer` returns `undefined` + * path creation is handled by the method instead. The `customizer` is invoked + * with three arguments: (nsValue, key, nsObject). + * + * **Note:** This method mutates `object`. + * + * @since 4.6.0 + * @category Object + * @param object The object to modify. + * @param path The path of the property to set. + * @param updater The function to produce the updated value. + * @param [customizer] The function to customize assigned values. + * @returns Returns `object`. + * @example + * + * var object = {}; + * + * _.updateWith(object, '[0][1]', _.constant('a'), Object); + * // => { '0': { '1': 'a' } } + */ + (object: T): T; + /** + * This method is like `_.update` except that it accepts `customizer` which is + * invoked to produce the objects of `path`. If `customizer` returns `undefined` + * path creation is handled by the method instead. The `customizer` is invoked + * with three arguments: (nsValue, key, nsObject). + * + * **Note:** This method mutates `object`. + * + * @since 4.6.0 + * @category Object + * @param object The object to modify. + * @param path The path of the property to set. + * @param updater The function to produce the updated value. + * @param [customizer] The function to customize assigned values. + * @returns Returns `object`. + * @example + * + * var object = {}; + * + * _.updateWith(object, '[0][1]', _.constant('a'), Object); + * // => { '0': { '1': 'a' } } + */ + (object: T): TResult; +} + +declare const updateWith: UpdateWith; +export = updateWith; diff --git a/types/lodash/fp/upperCase.d.ts b/types/lodash/fp/upperCase.d.ts new file mode 100644 index 0000000000..5e6cab91bf --- /dev/null +++ b/types/lodash/fp/upperCase.d.ts @@ -0,0 +1,15 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type UpperCase = + /** + * Converts `string`, as space separated words, to upper case. + * + * @param string The string to convert. + * @return Returns the upper cased string. + */ + (string: string) => string; + +declare const upperCase: UpperCase; +export = upperCase; diff --git a/types/lodash/fp/upperFirst.d.ts b/types/lodash/fp/upperFirst.d.ts new file mode 100644 index 0000000000..54a442030e --- /dev/null +++ b/types/lodash/fp/upperFirst.d.ts @@ -0,0 +1,15 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type UpperFirst = + /** + * Converts the first character of `string` to upper case. + * + * @param string The string to convert. + * @return Returns the converted string. + */ + (string: string) => string; + +declare const upperFirst: UpperFirst; +export = upperFirst; diff --git a/types/lodash/fp/useWith.d.ts b/types/lodash/fp/useWith.d.ts new file mode 100644 index 0000000000..1196dfbade --- /dev/null +++ b/types/lodash/fp/useWith.d.ts @@ -0,0 +1,58 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface OverArgs { + /** + * 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. + */ + (): OverArgs; + /** + * 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. + */ + (func: (...args: any[]) => any): OverArgs1x1; + /** + * 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. + */ + (func: (...args: any[]) => any, transforms: _.Many<(...args: any[]) => any>): (...args: any[]) => any; +} +interface OverArgs1x1 { + /** + * 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. + */ + (): OverArgs1x1; + /** + * 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. + */ + (transforms: _.Many<(...args: any[]) => any>): (...args: any[]) => any; +} + +declare const useWith: OverArgs; +export = useWith; diff --git a/types/lodash/fp/values.d.ts b/types/lodash/fp/values.d.ts new file mode 100644 index 0000000000..ec0ef37c08 --- /dev/null +++ b/types/lodash/fp/values.d.ts @@ -0,0 +1,32 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Values { + /** + * Creates an array of the own enumerable property values of object. + * + * @param object The object to query. + * @return Returns an array of property values. + */ + (object: _.Dictionary | _.NumericDictionary | _.List | null | undefined): T[]; + /** + * Creates an array of the own enumerable property values of object. + * + * @param object The object to query. + * @return Returns an array of property values. + */ + (object: T | null | undefined): Array; + /** + * Creates an array of the own enumerable property values of object. + * + * @param object The object to query. + * @return Returns an array of property values. + */ + (object: any): any[]; +} + +declare const values: Values; +export = values; diff --git a/types/lodash/fp/valuesIn.d.ts b/types/lodash/fp/valuesIn.d.ts new file mode 100644 index 0000000000..35e9073535 --- /dev/null +++ b/types/lodash/fp/valuesIn.d.ts @@ -0,0 +1,25 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface ValuesIn { + /** + * 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. + */ + (object: _.Dictionary|_.NumericDictionary|_.List | null | undefined): T[]; + /** + * 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. + */ + (object: T | null | undefined): Array; +} + +declare const valuesIn: ValuesIn; +export = valuesIn; diff --git a/types/lodash/fp/where.d.ts b/types/lodash/fp/where.d.ts new file mode 100644 index 0000000000..4270edf2e4 --- /dev/null +++ b/types/lodash/fp/where.d.ts @@ -0,0 +1,48 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface ConformsTo { + /** + * Checks if object conforms to source by invoking the predicate properties of source with the + * corresponding property values of object. + * + * Note: This method is equivalent to _.conforms when source is partially applied. + */ + (): ConformsTo; + /** + * Checks if object conforms to source by invoking the predicate properties of source with the + * corresponding property values of object. + * + * Note: This method is equivalent to _.conforms when source is partially applied. + */ + (source: _.ConformsPredicateObject): ConformsTo1x1; + /** + * Checks if object conforms to source by invoking the predicate properties of source with the + * corresponding property values of object. + * + * Note: This method is equivalent to _.conforms when source is partially applied. + */ + (source: _.ConformsPredicateObject, object: T): boolean; +} +interface ConformsTo1x1 { + /** + * Checks if object conforms to source by invoking the predicate properties of source with the + * corresponding property values of object. + * + * Note: This method is equivalent to _.conforms when source is partially applied. + */ + (): ConformsTo1x1; + /** + * Checks if object conforms to source by invoking the predicate properties of source with the + * corresponding property values of object. + * + * Note: This method is equivalent to _.conforms when source is partially applied. + */ + (object: T): boolean; +} + +declare const where: ConformsTo; +export = where; diff --git a/types/lodash/fp/whereEq.d.ts b/types/lodash/fp/whereEq.d.ts new file mode 100644 index 0000000000..1a660655f8 --- /dev/null +++ b/types/lodash/fp/whereEq.d.ts @@ -0,0 +1,116 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface IsMatch { + /** + * 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`. + * + * @category Lang + * @param object The object to inspect. + * @param source The object of property values to match. + * @returns 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; + /** + * 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`. + * + * @category Lang + * @param object The object to inspect. + * @param source The object of property values to match. + * @returns 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 + */ + (source: object): IsMatch1x1; + /** + * 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`. + * + * @category Lang + * @param object The object to inspect. + * @param source The object of property values to match. + * @returns 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 + */ + (source: object, object: object): boolean; +} +interface IsMatch1x1 { + /** + * 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`. + * + * @category Lang + * @param object The object to inspect. + * @param source The object of property values to match. + * @returns 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 + */ + (): IsMatch1x1; + /** + * 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`. + * + * @category Lang + * @param object The object to inspect. + * @param source The object of property values to match. + * @returns 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 + */ + (object: object): boolean; +} + +declare const whereEq: IsMatch; +export = whereEq; diff --git a/types/lodash/fp/without.d.ts b/types/lodash/fp/without.d.ts new file mode 100644 index 0000000000..9c30e47289 --- /dev/null +++ b/types/lodash/fp/without.d.ts @@ -0,0 +1,53 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Without { + /** + * 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; + /** + * 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. + */ + (values: ReadonlyArray): Without1x1; + /** + * 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. + */ + (values: ReadonlyArray, array: _.List | null | undefined): T[]; +} +interface Without1x1 { + /** + * 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. + */ + (): Without1x1; + /** + * 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. + */ + (array: _.List | null | undefined): T[]; +} + +declare const without: Without; +export = without; diff --git a/types/lodash/fp/words.d.ts b/types/lodash/fp/words.d.ts new file mode 100644 index 0000000000..c827eafb15 --- /dev/null +++ b/types/lodash/fp/words.d.ts @@ -0,0 +1,16 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type 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`. + */ + (string: string) => string[]; + +declare const words: Words; +export = words; diff --git a/types/lodash/fp/wrap.d.ts b/types/lodash/fp/wrap.d.ts new file mode 100644 index 0000000000..a906abe0f2 --- /dev/null +++ b/types/lodash/fp/wrap.d.ts @@ -0,0 +1,103 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface Wrap { + /** + * 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; + /** + * 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. + */ + (wrapper: (value: T, ...args: TArgs[]) => TResult): Wrap1x1; + /** + * 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. + */ + (wrapper: (value: T, ...args: TArgs[]) => TResult, value: T): (...args: TArgs[]) => TResult; + /** + * 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. + */ + (wrapper: (value: T, ...args: any[]) => TResult): Wrap2x1; + /** + * 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. + */ + (wrapper: (value: T, ...args: any[]) => TResult, value: T): (...args: any[]) => TResult; +} +interface Wrap1x1 { + /** + * 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. + */ + (): Wrap1x1; + /** + * 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. + */ + (value: T): (...args: TArgs[]) => TResult; +} +interface Wrap2x1 { + /** + * 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. + */ + (): Wrap2x1; + /** + * 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. + */ + (value: T): (...args: any[]) => TResult; +} + +declare const wrap: Wrap; +export = wrap; diff --git a/types/lodash/fp/xor.d.ts b/types/lodash/fp/xor.d.ts new file mode 100644 index 0000000000..d3e250cb5a --- /dev/null +++ b/types/lodash/fp/xor.d.ts @@ -0,0 +1,48 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Xor { + /** + * 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; + /** + * 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. + */ + (arrays2: _.List | null | undefined): Xor1x1; + /** + * 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. + */ + (arrays2: _.List | null | undefined, arrays: _.List | null | undefined): T[]; +} +interface Xor1x1 { + /** + * 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. + */ + (): Xor1x1; + /** + * 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. + */ + (arrays: _.List | null | undefined): T[]; +} + +declare const xor: Xor; +export = xor; diff --git a/types/lodash/fp/xorBy.d.ts b/types/lodash/fp/xorBy.d.ts new file mode 100644 index 0000000000..8d5b2fd05a --- /dev/null +++ b/types/lodash/fp/xorBy.d.ts @@ -0,0 +1,186 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface XorBy { + /** + * 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). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns 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; + /** + * 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). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns 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 }] + */ + (iteratee: _.ValueIteratee): XorBy1x1; + /** + * 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). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns 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 }] + */ + (iteratee: _.ValueIteratee, arrays: _.List | null | undefined): XorBy1x2; + /** + * 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). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns 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 }] + */ + (iteratee: _.ValueIteratee, arrays: _.List | null | undefined, arrays2: _.List | null | undefined): T[]; +} +interface XorBy1x1 { + /** + * 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). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns 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 }] + */ + (): XorBy1x1; + /** + * 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). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns 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 }] + */ + (arrays: _.List | null | undefined): XorBy1x2; + /** + * 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). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns 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 }] + */ + (arrays: _.List | null | undefined, arrays2: _.List | null | undefined): T[]; +} +interface XorBy1x2 { + /** + * 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). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns 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 }] + */ + (): XorBy1x2; + /** + * 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). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns 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 }] + */ + (arrays2: _.List | null | undefined): T[]; +} + +declare const xorBy: XorBy; +export = xorBy; diff --git a/types/lodash/fp/xorWith.d.ts b/types/lodash/fp/xorWith.d.ts new file mode 100644 index 0000000000..6bdcabdbd2 --- /dev/null +++ b/types/lodash/fp/xorWith.d.ts @@ -0,0 +1,177 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface XorWith { + /** + * 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). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [comparator] The comparator invoked per element. + * @returns 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; + /** + * 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). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [comparator] The comparator invoked per element. + * @returns 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 }] + */ + (comparator: _.Comparator): XorWith1x1; + /** + * 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). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [comparator] The comparator invoked per element. + * @returns 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 }] + */ + (comparator: _.Comparator, arrays: _.List | null | undefined): XorWith1x2; + /** + * 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). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [comparator] The comparator invoked per element. + * @returns 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 }] + */ + (comparator: _.Comparator, arrays: _.List | null | undefined, arrays2: _.List | null | undefined): T[]; +} +interface XorWith1x1 { + /** + * 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). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [comparator] The comparator invoked per element. + * @returns 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 }] + */ + (): XorWith1x1; + /** + * 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). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [comparator] The comparator invoked per element. + * @returns 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 }] + */ + (arrays: _.List | null | undefined): XorWith1x2; + /** + * 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). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [comparator] The comparator invoked per element. + * @returns 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 }] + */ + (arrays: _.List | null | undefined, arrays2: _.List | null | undefined): T[]; +} +interface XorWith1x2 { + /** + * 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). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [comparator] The comparator invoked per element. + * @returns 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 }] + */ + (): XorWith1x2; + /** + * 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). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [comparator] The comparator invoked per element. + * @returns 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 }] + */ + (arrays2: _.List | null | undefined): T[]; +} + +declare const xorWith: XorWith; +export = xorWith; diff --git a/types/lodash/fp/zip.d.ts b/types/lodash/fp/zip.d.ts new file mode 100644 index 0000000000..dd4e6a1e3c --- /dev/null +++ b/types/lodash/fp/zip.d.ts @@ -0,0 +1,53 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Zip { + /** + * 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; + /** + * 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. + */ + (arrays1: _.List): Zip1x1; + /** + * 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. + */ + (arrays1: _.List, arrays2: _.List): Array<[T1 | undefined, T2 | undefined]>; +} +interface Zip1x1 { + /** + * 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. + */ + (): Zip1x1; + /** + * 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. + */ + (arrays2: _.List): Array<[T1 | undefined, T2 | undefined]>; +} + +declare const zip: Zip; +export = zip; diff --git a/types/lodash/fp/zipAll.d.ts b/types/lodash/fp/zipAll.d.ts new file mode 100644 index 0000000000..62cf6eb647 --- /dev/null +++ b/types/lodash/fp/zipAll.d.ts @@ -0,0 +1,18 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +type Zip = + /** + * 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. + */ + (arrays: ReadonlyArray<_.List | null | undefined>) => Array>; + +declare const zipAll: Zip; +export = zipAll; diff --git a/types/lodash/fp/zipObj.d.ts b/types/lodash/fp/zipObj.d.ts new file mode 100644 index 0000000000..7b1c5bb91a --- /dev/null +++ b/types/lodash/fp/zipObj.d.ts @@ -0,0 +1,58 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface ZipObject { + /** + * This method is like _.fromPairs except that it accepts two arrays, one of property + * identifiers and one of corresponding values. + * + * @param props The property names. + * @param values The property values. + * @return Returns the new object. + */ + (): ZipObject; + /** + * This method is like _.fromPairs except that it accepts two arrays, one of property + * identifiers and one of corresponding values. + * + * @param props The property names. + * @param values The property values. + * @return Returns the new object. + */ + (props: _.List<_.PropertyName>): ZipObject1x1; + /** + * This method is like _.fromPairs except that it accepts two arrays, one of property + * identifiers and one of corresponding values. + * + * @param props The property names. + * @param values The property values. + * @return Returns the new object. + */ + (props: _.List<_.PropertyName>, values: _.List): _.Dictionary; +} +interface ZipObject1x1 { + /** + * This method is like _.fromPairs except that it accepts two arrays, one of property + * identifiers and one of corresponding values. + * + * @param props The property names. + * @param values The property values. + * @return Returns the new object. + */ + (): ZipObject1x1; + /** + * This method is like _.fromPairs except that it accepts two arrays, one of property + * identifiers and one of corresponding values. + * + * @param props The property names. + * @param values The property values. + * @return Returns the new object. + */ + (values: _.List): _.Dictionary; +} + +declare const zipObj: ZipObject; +export = zipObj; diff --git a/types/lodash/fp/zipObject.d.ts b/types/lodash/fp/zipObject.d.ts new file mode 100644 index 0000000000..61f5d04e79 --- /dev/null +++ b/types/lodash/fp/zipObject.d.ts @@ -0,0 +1,58 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface ZipObject { + /** + * This method is like _.fromPairs except that it accepts two arrays, one of property + * identifiers and one of corresponding values. + * + * @param props The property names. + * @param values The property values. + * @return Returns the new object. + */ + (): ZipObject; + /** + * This method is like _.fromPairs except that it accepts two arrays, one of property + * identifiers and one of corresponding values. + * + * @param props The property names. + * @param values The property values. + * @return Returns the new object. + */ + (props: _.List<_.PropertyName>): ZipObject1x1; + /** + * This method is like _.fromPairs except that it accepts two arrays, one of property + * identifiers and one of corresponding values. + * + * @param props The property names. + * @param values The property values. + * @return Returns the new object. + */ + (props: _.List<_.PropertyName>, values: _.List): _.Dictionary; +} +interface ZipObject1x1 { + /** + * This method is like _.fromPairs except that it accepts two arrays, one of property + * identifiers and one of corresponding values. + * + * @param props The property names. + * @param values The property values. + * @return Returns the new object. + */ + (): ZipObject1x1; + /** + * This method is like _.fromPairs except that it accepts two arrays, one of property + * identifiers and one of corresponding values. + * + * @param props The property names. + * @param values The property values. + * @return Returns the new object. + */ + (values: _.List): _.Dictionary; +} + +declare const zipObject: ZipObject; +export = zipObject; diff --git a/types/lodash/fp/zipObjectDeep.d.ts b/types/lodash/fp/zipObjectDeep.d.ts new file mode 100644 index 0000000000..0fd3f218ab --- /dev/null +++ b/types/lodash/fp/zipObjectDeep.d.ts @@ -0,0 +1,53 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface ZipObjectDeep { + /** + * This method is like _.zipObject except that it supports property paths. + * + * @param paths The property names. + * @param values The property values. + * @return Returns the new object. + */ + (): ZipObjectDeep; + /** + * This method is like _.zipObject except that it supports property paths. + * + * @param paths The property names. + * @param values The property values. + * @return Returns the new object. + */ + (paths: _.List<_.PropertyPath>): ZipObjectDeep1x1; + /** + * This method is like _.zipObject except that it supports property paths. + * + * @param paths The property names. + * @param values The property values. + * @return Returns the new object. + */ + (paths: _.List<_.PropertyPath>, values: _.List): object; +} +interface ZipObjectDeep1x1 { + /** + * This method is like _.zipObject except that it supports property paths. + * + * @param paths The property names. + * @param values The property values. + * @return Returns the new object. + */ + (): ZipObjectDeep1x1; + /** + * This method is like _.zipObject except that it supports property paths. + * + * @param paths The property names. + * @param values The property values. + * @return Returns the new object. + */ + (values: _.List): object; +} + +declare const zipObjectDeep: ZipObjectDeep; +export = zipObjectDeep; diff --git a/types/lodash/fp/zipWith.d.ts b/types/lodash/fp/zipWith.d.ts new file mode 100644 index 0000000000..36c02c053c --- /dev/null +++ b/types/lodash/fp/zipWith.d.ts @@ -0,0 +1,105 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface ZipWith { + /** + * 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 [arrays] The arrays to process. + * @param [iteratee] The function to combine grouped values. + * @param [thisArg] The `this` binding of `iteratee`. + * @return Returns the new array of grouped elements. + */ + (): ZipWith; + /** + * 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 [arrays] The arrays to process. + * @param [iteratee] The function to combine grouped values. + * @param [thisArg] The `this` binding of `iteratee`. + * @return Returns the new array of grouped elements. + */ + (iteratee: (value1: T1, value2: T2) => TResult): ZipWith1x1; + /** + * 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 [arrays] The arrays to process. + * @param [iteratee] The function to combine grouped values. + * @param [thisArg] The `this` binding of `iteratee`. + * @return Returns the new array of grouped elements. + */ + (iteratee: (value1: T1, value2: T2) => TResult, arrays1: _.List): ZipWith1x2; + /** + * 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 [arrays] The arrays to process. + * @param [iteratee] The function to combine grouped values. + * @param [thisArg] The `this` binding of `iteratee`. + * @return Returns the new array of grouped elements. + */ + (iteratee: (value1: T1, value2: T2) => TResult, arrays1: _.List, arrays2: _.List): TResult[]; +} +interface ZipWith1x1 { + /** + * 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 [arrays] The arrays to process. + * @param [iteratee] The function to combine grouped values. + * @param [thisArg] The `this` binding of `iteratee`. + * @return Returns the new array of grouped elements. + */ + (): ZipWith1x1; + /** + * 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 [arrays] The arrays to process. + * @param [iteratee] The function to combine grouped values. + * @param [thisArg] The `this` binding of `iteratee`. + * @return Returns the new array of grouped elements. + */ + (arrays1: _.List): ZipWith1x2; + /** + * 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 [arrays] The arrays to process. + * @param [iteratee] The function to combine grouped values. + * @param [thisArg] The `this` binding of `iteratee`. + * @return Returns the new array of grouped elements. + */ + (arrays1: _.List, arrays2: _.List): TResult[]; +} +interface ZipWith1x2 { + /** + * 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 [arrays] The arrays to process. + * @param [iteratee] The function to combine grouped values. + * @param [thisArg] The `this` binding of `iteratee`. + * @return Returns the new array of grouped elements. + */ + (): ZipWith1x2; + /** + * 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 [arrays] The arrays to process. + * @param [iteratee] The function to combine grouped values. + * @param [thisArg] The `this` binding of `iteratee`. + * @return Returns the new array of grouped elements. + */ + (arrays2: _.List): TResult[]; +} + +declare const zipWith: ZipWith; +export = zipWith; diff --git a/types/lodash/lodash-tests.ts b/types/lodash/lodash-tests.ts index 20bde973aa..28d2967c86 100644 --- a/types/lodash/lodash-tests.ts +++ b/types/lodash/lodash-tests.ts @@ -1,26 +1,7 @@ -declare const $: any; +import fp = require("lodash/fp"); +import _ = require("lodash"); -interface FoodOrganic { - name: string; - organic: boolean; -} -interface StoogesAge { - name: string; - age: number; -} - -const foodsOrganic: FoodOrganic[] = [ - { name: 'banana', organic: true }, - { name: 'beet', organic: false }, -]; -const stoogesAges: StoogesAge[] = [ - { 'name': 'moe', 'age': 40 }, - { 'name': 'larry', 'age': 50 } -]; - -let result: any; - -let anything: any; +declare const anything: any; interface AbcObject { a: number; @@ -28,58 +9,6 @@ interface AbcObject { c: boolean; } -// _.MapCache -let testMapCache: _.MapCache = { - delete(key: string) { return true; }, - get(key: string): any { return 1; }, - has(key: string) { return true; }, - set(key: string, value: any): _.Dictionary { return {}; }, - clear() { }, -}; -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; -result = <() => void>testMapCache.clear; - -// _ -namespace 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: ''}); - } - - { - let a: AbcObject[] = []; - _(a); // $ExpectType LoDashImplicitWrapper - } - - { - let a: AbcObject[] | null | undefined = anything; - _(a); // $ExpectType LoDashImplicitWrapper - } -} - // Wrapped array shortcut methods _([1, 2, 3, 4]).pop(); // $ExpectType number | undefined _([1, 2, 3, 4]).push(5, 6, 7); // $ExpectType LoDashImplicitWrapper @@ -97,317 +26,122 @@ _.chain([1, 2, 3, 4]).splice(1); // $ExpectType LoDashExplicitWrapper _.chain([1, 2, 3, 4]).splice(1, 2, 5, 6); // $ExpectType LoDashExplicitWrapper _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper -/********* - * Array * - *********/ - // _.chunk -namespace TestChunk { - let array: AbcObject[] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; +{ + const list: _.List | null | undefined = anything; - { - let result: AbcObject[][]; + _.chunk(list); // $ExpectType AbcObject[][] + _.chunk(list, 42); // $ExpectType AbcObject[][] - result = _.chunk(array); - result = _.chunk(array, 42); + _(list).chunk(); // $ExpectType LoDashImplicitWrapper + _(list).chunk(42); // $ExpectType LoDashImplicitWrapper - result = _.chunk(list); - result = _.chunk(list, 42); - } + _.chain(list).chunk(); // $ExpectType LoDashExplicitWrapper + _.chain(list).chunk(42); // $ExpectType LoDashExplicitWrapper - { - let result: _.LoDashImplicitArrayWrapper; - - result = _(array).chunk(); - result = _(array).chunk(42); - - result = _(list).chunk(); - result = _(list).chunk(42); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _.chain(array).chunk(); - result = _(array).chain().chunk(); - result = _(array).chain().chunk(42); - - result = _(list).chain().chunk(); - result = _(list).chain().chunk(42); - } + fp.chunk(42, list); // $ExpectType AbcObject[][] + fp.chunk(42)(list); // $ExpectType AbcObject[][] + fp.chunk()(42)()(list); // $ExpectType AbcObject[][] } // _.compact -namespace TestCompact { - let array: AbcObject[] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; - let array2: Array | null | undefined = anything; - let list2: _.List | null | undefined = anything; +{ + const list: _.List | null | undefined = anything; - { - let result: AbcObject[]; - - result = _.compact(array); - result = _.compact(list); - result = _.compact(array2); - result = _.compact(list2); - } - - { - let result: _.LoDashImplicitArrayWrapper; - - result = _(array).compact(); - result = _(list).compact(); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _(array).chain().compact(); - result = _(list).chain().compact(); - } + _.compact(list); // $ExpectType AbcObject[] + _(list).compact(); // $ExpectType LoDashImplicitWrapper + _.chain(list).compact(); // $ExpectType LoDashExplicitWrapper + fp.compact(list); // $ExpectType AbcObject[] } // _.difference -namespace TestDifference { - let array: AbcObject[] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; - let arrayParam: AbcObject[] = []; - let listParam: _.List = []; +{ + const list: _.List | null | undefined = anything; + const arrayParam: AbcObject[] = []; + const listParam: _.List = []; - { - let result: AbcObject[]; + _.difference(list); // $ExpectType AbcObject[] + _.difference(list, listParam); // $ExpectType AbcObject[] + _.difference(list, listParam, arrayParam, listParam); // $ExpectType AbcObject[] - result = _.difference(array); - result = _.difference(array, arrayParam); - result = _.difference(array, listParam, arrayParam); - result = _.difference(array, listParam, listParam, arrayParam); + _(list).difference(); // $ExpectType LoDashImplicitWrapper + _(list).difference(listParam); // $ExpectType LoDashImplicitWrapper + _(list).difference(listParam, arrayParam, listParam); // $ExpectType LoDashImplicitWrapper - result = _.difference(list); - result = _.difference(list, listParam); - result = _.difference(list, arrayParam, listParam); - result = _.difference(list, listParam, arrayParam, listParam); - } + _.chain(list).difference(); // $ExpectType LoDashExplicitWrapper + _.chain(list).difference(listParam); // $ExpectType LoDashExplicitWrapper + _.chain(list).difference(listParam, arrayParam, listParam); // $ExpectType LoDashExplicitWrapper - { - let result: _.LoDashImplicitArrayWrapper; - - result = _(array).difference(); - result = _(array).difference(arrayParam); - result = _(array).difference(listParam, arrayParam); - result = _(array).difference(arrayParam, listParam, arrayParam); - - result = _(list).difference(); - result = _(list).difference(listParam); - result = _(list).difference(arrayParam, listParam); - result = _(list).difference(listParam, arrayParam, listParam); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _(array).chain().difference(); - result = _(array).chain().difference(arrayParam); - result = _(array).chain().difference(listParam, arrayParam); - result = _(array).chain().difference(arrayParam, listParam, arrayParam); - - result = _(list).chain().difference(); - result = _(list).chain().difference(listParam); - result = _(list).chain().difference(arrayParam, listParam); - result = _(list).chain().difference(listParam, arrayParam, listParam); - } + fp.difference(list, arrayParam); // $ExpectType AbcObject[] + fp.difference(list)(arrayParam); // $ExpectType AbcObject[] } // _.differenceBy -namespace TestDifferenceBy { - let array: AbcObject[] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; - let arrayParam: AbcObject[] = []; - let listParam: _.List = []; - let iteratee: (value: AbcObject) => any = (value: AbcObject) => 1; +{ + const list: _.List | null | undefined = anything; + const arrayParam: AbcObject[] = []; + const listParam: _.List = []; + const iteratee = (value: AbcObject) => 1; - { - let result: AbcObject[]; + _.differenceBy(list); // $ExpectType AbcObject[] + _.differenceBy(list, listParam); // $ExpectType AbcObject[] + _.differenceBy(list, arrayParam, listParam, arrayParam, listParam, arrayParam, listParam); // $ExpectType AbcObject[] - result = _.differenceBy(array); - result = _.differenceBy(array, arrayParam); - result = _.differenceBy(array, listParam, arrayParam); - result = _.differenceBy(array, arrayParam, listParam, arrayParam); - result = _.differenceBy(array, listParam, arrayParam, listParam, arrayParam); - result = _.differenceBy(array, arrayParam, listParam, arrayParam, listParam, arrayParam); - result = _.differenceBy(array, listParam, arrayParam, listParam, arrayParam, listParam, arrayParam); + _.differenceBy(list, listParam, iteratee); // $ExpectType AbcObject[] + _.differenceBy(list, listParam, arrayParam, listParam, arrayParam, listParam, iteratee); // $ExpectType AbcObject[] + // $ExpectType AbcObject[] + _.differenceBy(list, arrayParam, listParam, arrayParam, listParam, arrayParam, listParam, iteratee); - result = _.differenceBy(array, arrayParam, iteratee); - result = _.differenceBy(array, listParam, arrayParam, iteratee); - result = _.differenceBy(array, arrayParam, listParam, arrayParam, iteratee); - result = _.differenceBy(array, listParam, arrayParam, listParam, arrayParam, iteratee); - result = _.differenceBy(array, arrayParam, listParam, arrayParam, listParam, arrayParam, iteratee); - result = _.differenceBy(array, listParam, arrayParam, listParam, arrayParam, listParam, arrayParam, iteratee); + _.differenceBy(list, listParam, "a"); // $ExpectType AbcObject[] + _.differenceBy(list, listParam, arrayParam, listParam, arrayParam, listParam, "a"); // $ExpectType AbcObject[] + // $ExpectType AbcObject[] + _.differenceBy(list, arrayParam, listParam, arrayParam, listParam, arrayParam, listParam, "a"); - result = _.differenceBy(array, arrayParam, 'a'); - result = _.differenceBy(array, listParam, arrayParam, 'a'); - result = _.differenceBy(array, arrayParam, listParam, arrayParam, 'a'); - result = _.differenceBy(array, listParam, arrayParam, listParam, arrayParam, 'a'); - result = _.differenceBy(array, arrayParam, listParam, arrayParam, listParam, arrayParam, 'a'); - result = _.differenceBy(array, listParam, arrayParam, listParam, arrayParam, listParam, arrayParam, 'a'); + _.differenceBy(list, listParam, {a: 1}); // $ExpectType AbcObject[] + _.differenceBy(list, listParam, arrayParam, listParam, arrayParam, listParam, {a: 1}); // $ExpectType AbcObject[] + // $ExpectType AbcObject[] + _.differenceBy(list, arrayParam, listParam, arrayParam, listParam, arrayParam, listParam, {a: 1}); - result = _.differenceBy(array, arrayParam, {a: 1}); - result = _.differenceBy(array, listParam, arrayParam, {a: 1}); - result = _.differenceBy(array, arrayParam, listParam, arrayParam, {a: 1}); - result = _.differenceBy(array, listParam, arrayParam, listParam, arrayParam, {a: 1}); - result = _.differenceBy(array, arrayParam, listParam, arrayParam, listParam, arrayParam, {a: 1}); - result = _.differenceBy(array, listParam, arrayParam, listParam, arrayParam, listParam, arrayParam, {a: 1}); + _(list).differenceBy(listParam); // $ExpectType LoDashImplicitWrapper + _(list).differenceBy(arrayParam, listParam, arrayParam, listParam, arrayParam, listParam); // $ExpectType LoDashImplicitWrapper - result = _.differenceBy(list); - result = _.differenceBy(list, listParam); - result = _.differenceBy(list, arrayParam, listParam); - result = _.differenceBy(list, listParam, arrayParam, listParam); - result = _.differenceBy(list, arrayParam, listParam, arrayParam, listParam); - result = _.differenceBy(list, listParam, arrayParam, listParam, arrayParam, listParam); - result = _.differenceBy(list, arrayParam, listParam, arrayParam, listParam, arrayParam, listParam); + _(list).differenceBy(listParam, iteratee); // $ExpectType LoDashImplicitWrapper + _(list).differenceBy(listParam, arrayParam, listParam, arrayParam, listParam, iteratee); // $ExpectType LoDashImplicitWrapper + // $ExpectType LoDashImplicitWrapper + _(list).differenceBy(arrayParam, listParam, arrayParam, listParam, arrayParam, listParam, iteratee); - result = _.differenceBy(list, listParam, iteratee); - result = _.differenceBy(list, arrayParam, listParam, iteratee); - result = _.differenceBy(list, listParam, arrayParam, listParam, iteratee); - result = _.differenceBy(list, arrayParam, listParam, arrayParam, listParam, iteratee); - result = _.differenceBy(list, listParam, arrayParam, listParam, arrayParam, listParam, iteratee); - result = _.differenceBy(list, arrayParam, listParam, arrayParam, listParam, arrayParam, listParam, iteratee); + _(list).differenceBy(listParam, "a"); // $ExpectType LoDashImplicitWrapper + _(list).differenceBy(listParam, arrayParam, listParam, arrayParam, listParam, "a"); // $ExpectType LoDashImplicitWrapper + // $ExpectType LoDashImplicitWrapper + _(list).differenceBy(arrayParam, listParam, arrayParam, listParam, arrayParam, listParam, "a"); - result = _.differenceBy(list, listParam, 'a'); - result = _.differenceBy(list, arrayParam, listParam, 'a'); - result = _.differenceBy(list, listParam, arrayParam, listParam, 'a'); - result = _.differenceBy(list, arrayParam, listParam, arrayParam, listParam, 'a'); - result = _.differenceBy(list, listParam, arrayParam, listParam, arrayParam, listParam, 'a'); - result = _.differenceBy(list, arrayParam, listParam, arrayParam, listParam, arrayParam, listParam, 'a'); + _(list).differenceBy(listParam, {a: 1}); // $ExpectType LoDashImplicitWrapper + _(list).differenceBy(listParam, arrayParam, listParam, arrayParam, listParam, {a: 1}); // $ExpectType LoDashImplicitWrapper + // $ExpectType LoDashImplicitWrapper + _(list).differenceBy(arrayParam, listParam, arrayParam, listParam, arrayParam, listParam, {a: 1}); - result = _.differenceBy(list, listParam, {a: 1}); - result = _.differenceBy(list, arrayParam, listParam, {a: 1}); - result = _.differenceBy(list, listParam, arrayParam, listParam, {a: 1}); - result = _.differenceBy(list, arrayParam, listParam, arrayParam, listParam, {a: 1}); - result = _.differenceBy(list, listParam, arrayParam, listParam, arrayParam, listParam, {a: 1}); - result = _.differenceBy(list, arrayParam, listParam, arrayParam, listParam, arrayParam, listParam, {a: 1}); - } + _.chain(list).differenceBy(arrayParam); // $ExpectType LoDashExplicitWrapper + _.chain(list).differenceBy(listParam, arrayParam, listParam, arrayParam, listParam, arrayParam); // $ExpectType LoDashExplicitWrapper - { - let result: _.LoDashImplicitWrapper; + _.chain(list).differenceBy(arrayParam, iteratee); // $ExpectType LoDashExplicitWrapper + _.chain(list).differenceBy(arrayParam, listParam, arrayParam, listParam, arrayParam, iteratee); // $ExpectType LoDashExplicitWrapper + // $ExpectType LoDashExplicitWrapper + _.chain(list).differenceBy(listParam, arrayParam, listParam, arrayParam, listParam, arrayParam, iteratee); - result = _(array).differenceBy(arrayParam); - result = _(array).differenceBy(listParam, arrayParam); - result = _(array).differenceBy(arrayParam, listParam, arrayParam); - result = _(array).differenceBy(listParam, arrayParam, listParam, arrayParam); - result = _(array).differenceBy(arrayParam, listParam, arrayParam, listParam, arrayParam); - result = _(array).differenceBy(listParam, arrayParam, listParam, arrayParam, listParam, arrayParam); + _.chain(list).differenceBy(arrayParam, "a"); // $ExpectType LoDashExplicitWrapper + _.chain(list).differenceBy(arrayParam, listParam, arrayParam, listParam, arrayParam, "a"); // $ExpectType LoDashExplicitWrapper + // $ExpectType LoDashExplicitWrapper + _.chain(list).differenceBy(listParam, arrayParam, listParam, arrayParam, listParam, arrayParam, "a"); - result = _(array).differenceBy(arrayParam, iteratee); - result = _(array).differenceBy(listParam, arrayParam, iteratee); - result = _(array).differenceBy(arrayParam, listParam, arrayParam, iteratee); - result = _(array).differenceBy(listParam, arrayParam, listParam, arrayParam, iteratee); - result = _(array).differenceBy(arrayParam, listParam, arrayParam, listParam, arrayParam, iteratee); - result = _(array).differenceBy(listParam, arrayParam, listParam, arrayParam, listParam, arrayParam, iteratee); + _.chain(list).differenceBy(arrayParam, {a: 1}); // $ExpectType LoDashExplicitWrapper + _.chain(list).differenceBy(arrayParam, listParam, arrayParam, listParam, arrayParam, {a: 1}); // $ExpectType LoDashExplicitWrapper + // $ExpectType LoDashExplicitWrapper + _.chain(list).differenceBy(listParam, arrayParam, listParam, arrayParam, listParam, arrayParam, {a: 1}); - result = _(array).differenceBy(arrayParam, 'a'); - result = _(array).differenceBy(listParam, arrayParam, 'a'); - result = _(array).differenceBy(arrayParam, listParam, arrayParam, 'a'); - result = _(array).differenceBy(listParam, arrayParam, listParam, arrayParam, 'a'); - result = _(array).differenceBy(arrayParam, listParam, arrayParam, listParam, arrayParam, 'a'); - result = _(array).differenceBy(listParam, arrayParam, listParam, arrayParam, listParam, arrayParam, 'a'); - - result = _(array).differenceBy(arrayParam, {a: 1}); - result = _(array).differenceBy(listParam, arrayParam, {a: 1}); - result = _(array).differenceBy(arrayParam, listParam, arrayParam, {a: 1}); - result = _(array).differenceBy(listParam, arrayParam, listParam, arrayParam, {a: 1}); - result = _(array).differenceBy(arrayParam, listParam, arrayParam, listParam, arrayParam, {a: 1}); - result = _(array).differenceBy(listParam, arrayParam, listParam, arrayParam, listParam, arrayParam, {a: 1}); - - result = _(list).differenceBy(listParam); - result = _(list).differenceBy(arrayParam, listParam); - result = _(list).differenceBy(listParam, arrayParam, listParam); - result = _(list).differenceBy(arrayParam, listParam, arrayParam, listParam); - result = _(list).differenceBy(listParam, arrayParam, listParam, arrayParam, listParam); - result = _(list).differenceBy(arrayParam, listParam, arrayParam, listParam, arrayParam, listParam); - - result = _(list).differenceBy(listParam, iteratee); - result = _(list).differenceBy(arrayParam, listParam, iteratee); - result = _(list).differenceBy(listParam, arrayParam, listParam, iteratee); - result = _(list).differenceBy(arrayParam, listParam, arrayParam, listParam, iteratee); - result = _(list).differenceBy(listParam, arrayParam, listParam, arrayParam, listParam, iteratee); - result = _(list).differenceBy(arrayParam, listParam, arrayParam, listParam, arrayParam, listParam, iteratee); - - result = _(list).differenceBy(listParam, 'a'); - result = _(list).differenceBy(arrayParam, listParam, 'a'); - result = _(list).differenceBy(listParam, arrayParam, listParam, 'a'); - result = _(list).differenceBy(arrayParam, listParam, arrayParam, listParam, 'a'); - result = _(list).differenceBy(listParam, arrayParam, listParam, arrayParam, listParam, 'a'); - result = _(list).differenceBy(arrayParam, listParam, arrayParam, listParam, arrayParam, listParam, 'a'); - - result = _(list).differenceBy(listParam, {a: 1}); - result = _(list).differenceBy(arrayParam, listParam, {a: 1}); - result = _(list).differenceBy(listParam, arrayParam, listParam, {a: 1}); - result = _(list).differenceBy(arrayParam, listParam, arrayParam, listParam, {a: 1}); - result = _(list).differenceBy(listParam, arrayParam, listParam, arrayParam, listParam, {a: 1}); - result = _(list).differenceBy(arrayParam, listParam, arrayParam, listParam, arrayParam, listParam, {a: 1}); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(array).chain().differenceBy(arrayParam); - result = _(array).chain().differenceBy(listParam, arrayParam); - result = _(array).chain().differenceBy(arrayParam, listParam, arrayParam); - result = _(array).chain().differenceBy(listParam, arrayParam, listParam, arrayParam); - result = _(array).chain().differenceBy(arrayParam, listParam, arrayParam, listParam, arrayParam); - result = _(array).chain().differenceBy(listParam, arrayParam, listParam, arrayParam, listParam, arrayParam); - - result = _(array).chain().differenceBy(arrayParam, iteratee); - result = _(array).chain().differenceBy(listParam, arrayParam, iteratee); - result = _(array).chain().differenceBy(arrayParam, listParam, arrayParam, iteratee); - result = _(array).chain().differenceBy(listParam, arrayParam, listParam, arrayParam, iteratee); - result = _(array).chain().differenceBy(arrayParam, listParam, arrayParam, listParam, arrayParam, iteratee); - result = _(array).chain().differenceBy(listParam, arrayParam, listParam, arrayParam, listParam, arrayParam, iteratee); - - result = _(array).chain().differenceBy(arrayParam, 'a'); - result = _(array).chain().differenceBy(listParam, arrayParam, 'a'); - result = _(array).chain().differenceBy(arrayParam, listParam, arrayParam, 'a'); - result = _(array).chain().differenceBy(listParam, arrayParam, listParam, arrayParam, 'a'); - result = _(array).chain().differenceBy(arrayParam, listParam, arrayParam, listParam, arrayParam, 'a'); - result = _(array).chain().differenceBy(listParam, arrayParam, listParam, arrayParam, listParam, arrayParam, 'a'); - - result = _(array).chain().differenceBy(arrayParam, {a: 1}); - result = _(array).chain().differenceBy(listParam, arrayParam, {a: 1}); - result = _(array).chain().differenceBy(arrayParam, listParam, arrayParam, {a: 1}); - result = _(array).chain().differenceBy(listParam, arrayParam, listParam, arrayParam, {a: 1}); - result = _(array).chain().differenceBy(arrayParam, listParam, arrayParam, listParam, arrayParam, {a: 1}); - result = _(array).chain().differenceBy(listParam, arrayParam, listParam, arrayParam, listParam, arrayParam, {a: 1}); - - result = _(list).chain().differenceBy(listParam); - result = _(list).chain().differenceBy(arrayParam, listParam); - result = _(list).chain().differenceBy(listParam, arrayParam, listParam); - result = _(list).chain().differenceBy(arrayParam, listParam, arrayParam, listParam); - result = _(list).chain().differenceBy(listParam, arrayParam, listParam, arrayParam, listParam); - result = _(list).chain().differenceBy(arrayParam, listParam, arrayParam, listParam, arrayParam, listParam); - - result = _(list).chain().differenceBy(listParam, iteratee); - result = _(list).chain().differenceBy(arrayParam, listParam, iteratee); - result = _(list).chain().differenceBy(listParam, arrayParam, listParam, iteratee); - result = _(list).chain().differenceBy(arrayParam, listParam, arrayParam, listParam, iteratee); - result = _(list).chain().differenceBy(listParam, arrayParam, listParam, arrayParam, listParam, iteratee); - result = _(list).chain().differenceBy(arrayParam, listParam, arrayParam, listParam, arrayParam, listParam, iteratee); - - result = _(list).chain().differenceBy(listParam, 'a'); - result = _(list).chain().differenceBy(arrayParam, listParam, 'a'); - result = _(list).chain().differenceBy(listParam, arrayParam, listParam, 'a'); - result = _(list).chain().differenceBy(arrayParam, listParam, arrayParam, listParam, 'a'); - result = _(list).chain().differenceBy(listParam, arrayParam, listParam, arrayParam, listParam, 'a'); - result = _(list).chain().differenceBy(arrayParam, listParam, arrayParam, listParam, arrayParam, listParam, 'a'); - - result = _(list).chain().differenceBy(listParam, {a: 1}); - result = _(list).chain().differenceBy(arrayParam, listParam, {a: 1}); - result = _(list).chain().differenceBy(listParam, arrayParam, listParam, {a: 1}); - result = _(list).chain().differenceBy(arrayParam, listParam, arrayParam, listParam, {a: 1}); - result = _(list).chain().differenceBy(listParam, arrayParam, listParam, arrayParam, listParam, {a: 1}); - result = _(list).chain().differenceBy(arrayParam, listParam, arrayParam, listParam, arrayParam, listParam, {a: 1}); - } + fp.differenceBy(iteratee, list, arrayParam); // $ExpectType AbcObject[] + fp.differenceBy(iteratee)(list)(listParam); // $ExpectType AbcObject[] + fp.differenceBy("a", list, arrayParam); // $ExpectType AbcObject[] + fp.differenceBy({a: 1}, list, arrayParam); // $ExpectType AbcObject[] { interface T1 { @@ -427,13 +161,13 @@ namespace TestDifferenceBy { b: any[]; } - const t1: T1 = { a: 'a', b: 'b' }; - const t2: T2 = { a: 'a', b: 30 }; - const t3: T3 = { a: 'a', b: true }; - const t4: T4 = { a: 'a', b: [] }; + const t1: T1 = { a: "a", b: "b" }; + const t2: T2 = { a: "a", b: 30 }; + const t3: T3 = { a: "a", b: true }; + const t4: T4 = { a: "a", b: [] }; // $ExpectType T1[] - _.differenceBy([t1], [t2], 'name'); + _.differenceBy([t1], [t2], "name"); // $ExpectType T1[] _.differenceBy([t1], [t2], (value) => { value; // $ExpectType T1 | T2 @@ -460,18 +194,18 @@ namespace TestDifferenceBy { return 0; }); // $ExpectType T1[] - _.differenceBy([t1], [t2], [t3], [t4], [''], (value) => { + _.differenceBy([t1], [t2], [t3], [t4], [""], (value) => { value; // $ExpectType string | T1 | T2 | T3 | T4 return 0; }); // $ExpectType T1[] - _.differenceBy([t1], [t2], [t3], [t4], [''], [42], (value) => { + _.differenceBy([t1], [t2], [t3], [t4], [""], [42], (value) => { value; // $ExpectType string | number | T1 | T2 | T3 | T4 return 0; }); // $ExpectType LoDashImplicitWrapper - _([t1]).differenceBy([t2], 'name'); + _([t1]).differenceBy([t2], "name"); // $ExpectType LoDashImplicitWrapper _([t1]).differenceBy([t2], (value) => { value; // $ExpectType T1 | T2 @@ -498,18 +232,18 @@ namespace TestDifferenceBy { return 0; }); // $ExpectType LoDashImplicitWrapper - _([t1]).differenceBy([t2], [t3], [t4], [''], (value) => { + _([t1]).differenceBy([t2], [t3], [t4], [""], (value) => { value; // $ExpectType string | T1 | T2 | T3 | T4 return 0; }); // $ExpectType LoDashImplicitWrapper - _([t1]).differenceBy([t2], [t3], [t4], [''], [42], (value) => { + _([t1]).differenceBy([t2], [t3], [t4], [""], [42], (value) => { value; // $ExpectType string | number | T1 | T2 | T3 | T4 return 0; }); // $ExpectType LoDashExplicitWrapper - _.chain([t1]).differenceBy([t2], 'name'); + _.chain([t1]).differenceBy([t2], "name"); // $ExpectType LoDashExplicitWrapper _.chain([t1]).differenceBy([t2], (value) => { value; // $ExpectType T1 | T2 @@ -536,79 +270,49 @@ namespace TestDifferenceBy { return 0; }); // $ExpectType LoDashExplicitWrapper - _.chain([t1]).differenceBy([t2], [t3], [t4], [''], (value) => { + _.chain([t1]).differenceBy([t2], [t3], [t4], [""], (value) => { value; // $ExpectType string | T1 | T2 | T3 | T4 return 0; }); // $ExpectType LoDashExplicitWrapper - _.chain([t1]).differenceBy([t2], [t3], [t4], [''], [42], (value) => { + _.chain([t1]).differenceBy([t2], [t3], [t4], [""], [42], (value) => { value; // $ExpectType string | number | T1 | T2 | T3 | T4 return 0; }); + + fp.differenceBy("name", [t1], [t2]); // $ExpectType T1[] + fp.differenceBy((value: T1 | T2) => 0, [t1], [t2]); // $ExpectType T1[] + fp.differenceBy((value: T1 | T2 | T3) => 0, [t1], [t2, t3]); // $ExpectType T1[] } } // _.differenceWith { - let array: AbcObject[] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; - let arrayParam: AbcObject[] = []; - let listParam: _.List = []; - let comparator = (a: AbcObject, b: AbcObject) => true; + const list: _.List | null | undefined = [] as any; + const arrayParam: AbcObject[] = []; + const listParam: _.List = []; + const comparator = (a: AbcObject, b: AbcObject) => true; - { - // $ExpectType AbcObject[] - _.differenceWith(array); - // $ExpectType AbcObject[] - _.differenceWith(array, arrayParam); - // $ExpectType AbcObject[] - _.differenceWith(array, listParam, arrayParam); - // $ExpectType AbcObject[] - _.differenceWith(array, listParam, arrayParam, listParam, arrayParam, listParam, arrayParam); + _.differenceWith(list); // $ExpectType AbcObject[] + _.differenceWith(list, arrayParam); // $ExpectType AbcObject[] + _.differenceWith(list, listParam, arrayParam, listParam, arrayParam, listParam, arrayParam); // $ExpectType AbcObject[] + _.differenceWith(list, arrayParam, comparator); // $ExpectType AbcObject[] + _.differenceWith(list, listParam, arrayParam, listParam, arrayParam, listParam, arrayParam, comparator); // $ExpectType AbcObject[] - // $ExpectType AbcObject[] - _.differenceWith(array, arrayParam, comparator); - // $ExpectType AbcObject[] - _.differenceWith(array, listParam, arrayParam, comparator); - // $ExpectType AbcObject[] - _.differenceWith(array, listParam, arrayParam, listParam, arrayParam, listParam, arrayParam, comparator); - } + _(list).differenceWith(arrayParam); // $ExpectType LoDashImplicitWrapper + _(list).differenceWith(listParam, arrayParam, listParam, arrayParam, listParam, arrayParam); // $ExpectType LoDashImplicitWrapper + _(list).differenceWith(arrayParam, comparator); // $ExpectType LoDashImplicitWrapper + _(list).differenceWith(listParam, arrayParam, listParam, arrayParam, listParam, arrayParam, comparator); // $ExpectType LoDashImplicitWrapper - { - // $ExpectType LoDashImplicitWrapper - _(array).differenceWith(arrayParam); - // $ExpectType LoDashImplicitWrapper - _(array).differenceWith(listParam, arrayParam); - // $ExpectType LoDashImplicitWrapper - _(array).differenceWith(arrayParam, listParam, arrayParam); - // $ExpectType LoDashImplicitWrapper - _(array).differenceWith(listParam, arrayParam, listParam, arrayParam, listParam, arrayParam); + _.chain(list).differenceWith(arrayParam); // $ExpectType LoDashExplicitWrapper + _.chain(list).differenceWith(listParam, arrayParam, listParam, arrayParam, listParam, arrayParam); // $ExpectType LoDashExplicitWrapper + _.chain(list).differenceWith(arrayParam, comparator); // $ExpectType LoDashExplicitWrapper + _.chain(list).differenceWith(listParam, arrayParam, listParam, arrayParam, listParam, arrayParam, comparator); // $ExpectType LoDashExplicitWrapper - // $ExpectType LoDashImplicitWrapper - _(array).differenceWith(arrayParam, comparator); - // $ExpectType LoDashImplicitWrapper - _(array).differenceWith(listParam, arrayParam, comparator); - // $ExpectType LoDashImplicitWrapper - _(array).differenceWith(listParam, arrayParam, listParam, arrayParam, listParam, arrayParam, comparator); - } - - { - // $ExpectType LoDashExplicitWrapper - _.chain(array).differenceWith(arrayParam); - // $ExpectType LoDashExplicitWrapper - _.chain(array).differenceWith(listParam, arrayParam); - // $ExpectType LoDashExplicitWrapper - _.chain(array).differenceWith(arrayParam, listParam, arrayParam); - // $ExpectType LoDashExplicitWrapper - _.chain(array).differenceWith(listParam, arrayParam, listParam, arrayParam, listParam, arrayParam); - - // $ExpectType LoDashExplicitWrapper - _.chain(array).differenceWith(arrayParam, comparator); - // $ExpectType LoDashExplicitWrapper - _.chain(array).differenceWith(listParam, arrayParam, comparator); - // $ExpectType LoDashExplicitWrapper - _.chain(array).differenceWith(listParam, arrayParam, listParam, arrayParam, listParam, arrayParam, comparator); - } + fp.differenceWith(comparator, list, arrayParam); // $ExpectType AbcObject[] + fp.differenceWith(comparator)(list)(arrayParam); // $ExpectType AbcObject[] + fp.differenceWith(comparator)(list, arrayParam); // $ExpectType AbcObject[] + fp.differenceWith(comparator, list)(arrayParam); // $ExpectType AbcObject[] { interface T1 { @@ -620,7 +324,7 @@ namespace TestDifferenceBy { b: number; } - const t1: T1 = { a: 'a', b: 'b' }; + const t1: T1 = { a: "a", b: "b" }; const t2: T2 | undefined = anything; // $ExpectType T1[] @@ -643,824 +347,371 @@ namespace TestDifferenceBy { b; // $ExpectType T2 | undefined return true; }); + + fp.differenceWith((a: T1, b: T2 | undefined) => true, [t1], [t2]); // $ExpectType T1[] } } // _.drop -{ - let array: AbcObject[] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; - - { - let result: AbcObject[]; - 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 -namespace TestDropRight { - let array: AbcObject[] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; +{ + const list: _.List | null | undefined = anything; - { - let result: AbcObject[]; + _.drop(list); // $ExpectType AbcObject[] + _.drop(list, 42); // $ExpectType AbcObject[] + _(list).drop(42); // $ExpectType LoDashImplicitWrapper + _.chain(list).drop(42); // $ExpectType LoDashExplicitWrapper - result = _.dropRight(array); - result = _.dropRight(array, 42); + fp.drop(42, list); // $ExpectType AbcObject[] + fp.drop(42)(list); // $ExpectType AbcObject[] - result = _.dropRight(list); - result = _.dropRight(list, 42); - } + _.dropRight(list); // $ExpectType AbcObject[] + _.dropRight(list, 42); // $ExpectType AbcObject[] + _(list).dropRight(42); // $ExpectType LoDashImplicitWrapper + _.chain(list).dropRight(42); // $ExpectType LoDashExplicitWrapper - { - 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 -namespace TestDropRightWhile { - let array: AbcObject[] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; - let predicateFn = (value: AbcObject, index: number, collection: _.List) => true; - - { - let result: AbcObject[]; - - result = _.dropRightWhile(array); - result = _.dropRightWhile(array, predicateFn); - result = _.dropRightWhile(array, ''); - result = _.dropRightWhile(array, {a: 42}); - - result = _.dropRightWhile(list); - result = _.dropRightWhile(list, predicateFn); - result = _.dropRightWhile(list, ''); - result = _.dropRightWhile(list, {a: 42}); - } - - { - let result: _.LoDashImplicitArrayWrapper; - - result = _(array).dropRightWhile(); - result = _(array).dropRightWhile(predicateFn); - result = _(array).dropRightWhile(''); - result = _(array).dropRightWhile({a: 42}); - - result = _(list).dropRightWhile(); - result = _(list).dropRightWhile(predicateFn); - result = _(list).dropRightWhile(''); - result = _(list).dropRightWhile({a: 42}); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _(array).chain().dropRightWhile(); - result = _(array).chain().dropRightWhile(predicateFn); - result = _(array).chain().dropRightWhile(''); - result = _(array).chain().dropRightWhile({a: 42}); - - result = _(list).chain().dropRightWhile(); - result = _(list).chain().dropRightWhile(predicateFn); - result = _(list).chain().dropRightWhile(''); - result = _(list).chain().dropRightWhile({a: 42}); - } + fp.dropRight(42, list); // $ExpectType AbcObject[] + fp.dropRight(42)(list); // $ExpectType AbcObject[] } // _.dropWhile -namespace TestDropWhile { - let array: AbcObject[] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; - let predicateFn = (value: AbcObject, index: number, collection: _.List) => true; +// _.dropRightWhile +{ + const list: _.List | null | undefined = anything; + const predicateFn = (value: AbcObject, index: number, collection: _.List) => true; + const predicateFn2 = (value: AbcObject) => true; - { - let result: AbcObject[]; + _.dropWhile(list); // $ExpectType AbcObject[] + _.dropWhile(list, predicateFn); // $ExpectType AbcObject[] + _.dropWhile(list, ""); // $ExpectType AbcObject[] + _.dropWhile(list, {a: 42}); // $ExpectType AbcObject[] - result = _.dropWhile(array); - result = _.dropWhile(array, predicateFn); - result = _.dropWhile(array, ''); - result = _.dropWhile(array, {a: 42}); + _(list).dropWhile(); // $ExpectType LoDashImplicitWrapper + _(list).dropWhile(predicateFn); // $ExpectType LoDashImplicitWrapper + _(list).dropWhile(""); // $ExpectType LoDashImplicitWrapper + _(list).dropWhile({a: 42}); // $ExpectType LoDashImplicitWrapper - result = _.dropWhile(list); - result = _.dropWhile(list, predicateFn); - result = _.dropWhile(list, ''); - result = _.dropWhile(list, {a: 42}); - } + _.chain(list).dropWhile(); // $ExpectType LoDashExplicitWrapper + _.chain(list).dropWhile(predicateFn); // $ExpectType LoDashExplicitWrapper + _.chain(list).dropWhile(""); // $ExpectType LoDashExplicitWrapper + _.chain(list).dropWhile({a: 42}); // $ExpectType LoDashExplicitWrapper - { - let result: _.LoDashImplicitArrayWrapper; + fp.dropWhile(predicateFn2, list); // $ExpectType AbcObject[] + fp.dropWhile(predicateFn2)(list); // $ExpectType AbcObject[] + fp.dropWhile("", list); // $ExpectType AbcObject[] + fp.dropWhile({ a: 42 }, list); // $ExpectType AbcObject[] - result = _(array).dropWhile(); - result = _(array).dropWhile(predicateFn); - result = _(array).dropWhile(''); - result = _(array).dropWhile({a: 42}); + _.dropRightWhile(list); // $ExpectType AbcObject[] + _.dropRightWhile(list, predicateFn); // $ExpectType AbcObject[] + _.dropRightWhile(list, ""); // $ExpectType AbcObject[] + _.dropRightWhile(list, {a: 42}); // $ExpectType AbcObject[] - result = _(list).dropWhile(); - result = _(list).dropWhile(predicateFn); - result = _(list).dropWhile(''); - result = _(list).dropWhile({a: 42}); - } + _(list).dropRightWhile(); // $ExpectType LoDashImplicitWrapper + _(list).dropRightWhile(predicateFn); // $ExpectType LoDashImplicitWrapper + _(list).dropRightWhile(""); // $ExpectType LoDashImplicitWrapper + _(list).dropRightWhile({a: 42}); // $ExpectType LoDashImplicitWrapper - { - let result: _.LoDashExplicitArrayWrapper; + _.chain(list).dropRightWhile(); // $ExpectType LoDashExplicitWrapper + _.chain(list).dropRightWhile(predicateFn); // $ExpectType LoDashExplicitWrapper + _.chain(list).dropRightWhile(""); // $ExpectType LoDashExplicitWrapper + _.chain(list).dropRightWhile({a: 42}); // $ExpectType LoDashExplicitWrapper - result = _(array).chain().dropWhile(); - result = _(array).chain().dropWhile(predicateFn); - result = _(array).chain().dropWhile(''); - result = _(array).chain().dropWhile({a: 42}); - - result = _(list).chain().dropWhile(); - result = _(list).chain().dropWhile(predicateFn); - result = _(list).chain().dropWhile(''); - result = _(list).chain().dropWhile({a: 42}); - } + fp.dropRightWhile(predicateFn2, list); // $ExpectType AbcObject[] + fp.dropRightWhile(predicateFn2)(list); // $ExpectType AbcObject[] + fp.dropRightWhile("", list); // $ExpectType AbcObject[] + fp.dropRightWhile({ a: 42 }, list); // $ExpectType AbcObject[] } // _.fill -namespace TestFill { - let array: number[] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; +{ + const array: number[] | null | undefined = anything; + const list: _.List | null | undefined = anything; - { - let result: number[]; + _.fill(array, 42); // $ExpectType number[] + _.fill(array, 42, 0); // $ExpectType number[] + _.fill(array, 42, 0, 10); // $ExpectType number[] - result = _.fill(array, 42); - result = _.fill(array, 42, 0); - result = _.fill(array, 42, 0, 10); - } + _.fill(list, 42); // $ExpectType ArrayLike + _.fill(list, 42, 0); // $ExpectType ArrayLike + _.fill(list, 42, 0, 10); // $ExpectType ArrayLike - { - let result: _.List; + _(list).fill(42); // $ExpectType LoDashImplicitWrapper> + _(list).fill(42, 0); // $ExpectType LoDashImplicitWrapper> + _(list).fill(42, 0, 10); // $ExpectType LoDashImplicitWrapper> - result = _.fill(list, 42); - result = _.fill(list, 42, 0); - result = _.fill(list, 42, 0, 10); - } + _.chain(list).fill(42); // $ExpectType LoDashExplicitWrapper> + _.chain(list).fill(42, 0); // $ExpectType LoDashExplicitWrapper> + _.chain(list).fill(42, 0, 10); // $ExpectType LoDashExplicitWrapper> - { - 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); - } + fp.fill(0, 10, 42, array); // $ExpectType number[] + fp.fill(0)(10)(42)(array); // $ExpectType number[] + fp.fill(0, 10, 42, list); // $ExpectType ArrayLike } // _.findIndex -namespace TestFindIndex { - let array: AbcObject[] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; - let predicateFn = (value: AbcObject, index: number, collection: _.List) => true; - let fromIndex = 0; - - { - let result: number; - - result = _.findIndex(array); - result = _.findIndex(array, predicateFn); - result = _.findIndex(array, ''); - result = _.findIndex(array, {a: 42}); - result = _.findIndex(array, predicateFn, fromIndex); - - result = _.findIndex(list); - result = _.findIndex(list, predicateFn); - result = _.findIndex(list, ''); - result = _.findIndex(list, {a: 42}); - result = _.findIndex(list, predicateFn, fromIndex); - result = _.findIndex([{ b: 5 }], ['b', 5]); - - result = _(array).findIndex(); - result = _(array).findIndex(predicateFn); - result = _(array).findIndex(''); - result = _(array).findIndex<{a: number}>({a: 42}); - result = _(array).findIndex(predicateFn, fromIndex); - - result = _(list).findIndex(); - result = _(list).findIndex(predicateFn); - result = _(list).findIndex(''); - result = _(list).findIndex<{a: number}>({a: 42}); - result = _(list).findIndex(predicateFn, fromIndex); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(array).chain().findIndex(); - result = _(array).chain().findIndex(predicateFn); - result = _(array).chain().findIndex(''); - result = _(array).chain().findIndex<{a: number}>({a: 42}); - result = _(array).chain().findIndex(predicateFn, fromIndex); - - result = _(list).chain().findIndex(); - result = _(list).chain().findIndex(predicateFn); - result = _(list).chain().findIndex(''); - result = _(list).chain().findIndex<{a: number}>({a: 42}); - result = _(list).chain().findIndex(predicateFn, fromIndex); - } -} - // _.findLastIndex -namespace TestFindLastIndex { - let array: AbcObject[] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; +{ + const list: _.List | null | undefined = anything; + const predicateFn = (value: AbcObject, index: number, collection: _.List) => true; + const predicateFn2 = (value: AbcObject) => true; - let predicateFn = (value: AbcObject, index: number, collection: _.List) => true; - let fromIndex = 0; + _.findIndex(list); // $ExpectType number + _.findIndex(list, predicateFn); // $ExpectType number + _.findIndex(list, ""); // $ExpectType number + _.findIndex(list, {a: 42}); // $ExpectType number + _.findIndex(list, predicateFn, 1); // $ExpectType number - { - let result: number; + _(list).findIndex(); // $ExpectType number + _(list).findIndex(predicateFn); // $ExpectType number + _(list).findIndex(""); // $ExpectType number + _(list).findIndex<{a: number}>({a: 42}); // $ExpectType number + _(list).findIndex(predicateFn, 1); // $ExpectType number - result = _.findLastIndex(array); - result = _.findLastIndex(array, predicateFn); - result = _.findLastIndex(array, ''); - result = _.findLastIndex(array, {a: 42}); - result = _.findLastIndex(array, predicateFn, fromIndex); + _.chain(list).findIndex(); // $ExpectType LoDashExplicitWrapper + _.chain(list).findIndex(predicateFn); // $ExpectType LoDashExplicitWrapper + _.chain(list).findIndex(""); // $ExpectType LoDashExplicitWrapper + _.chain(list).findIndex<{a: number}>({a: 42}); // $ExpectType LoDashExplicitWrapper + _.chain(list).findIndex(predicateFn, 1); // $ExpectType LoDashExplicitWrapper - result = _.findLastIndex(list); - result = _.findLastIndex(list, predicateFn); - result = _.findLastIndex(list, ''); - result = _.findLastIndex(list, {a: 42}); - result = _.findLastIndex(list, predicateFn, fromIndex); - result = _.findLastIndex([{ b: 5 }], ['b', 5]); + fp.findIndex(predicateFn2, list); // $ExpectType number + fp.findIndex(predicateFn2)(list); // $ExpectType number + fp.findIndex("", list); // $ExpectType number + fp.findIndex({ a: 42 }, list); // $ExpectType number - result = _(array).findLastIndex(); - result = _(array).findLastIndex(predicateFn); - result = _(array).findLastIndex(''); - result = _(array).findLastIndex<{a: number}>({a: 42}); - result = _(array).findLastIndex(predicateFn, fromIndex); + fp.findIndexFrom(predicateFn2, 1, list); // $ExpectType number + fp.findIndexFrom(predicateFn2)(1)(list); // $ExpectType number + fp.findIndexFrom("", 1, list); // $ExpectType number + fp.findIndexFrom({ a: 42 }, 1, list); // $ExpectType number - result = _(list).findLastIndex(); - result = _(list).findLastIndex(predicateFn); - result = _(list).findLastIndex(''); - result = _(list).findLastIndex<{a: number}>({a: 42}); - result = _(list).findLastIndex(predicateFn, fromIndex); - } + _.findLastIndex(list); // $ExpectType number + _.findLastIndex(list, predicateFn); // $ExpectType number + _.findLastIndex(list, ""); // $ExpectType number + _.findLastIndex(list, {a: 42}); // $ExpectType number + _.findLastIndex(list, predicateFn, 1); // $ExpectType number - { - let result: _.LoDashExplicitWrapper; + _(list).findLastIndex(); // $ExpectType number + _(list).findLastIndex(predicateFn); // $ExpectType number + _(list).findLastIndex(""); // $ExpectType number + _(list).findLastIndex<{a: number}>({a: 42}); // $ExpectType number + _(list).findLastIndex(predicateFn, 1); // $ExpectType number - result = _(array).chain().findLastIndex(); - result = _(array).chain().findLastIndex(predicateFn); - result = _(array).chain().findLastIndex(''); - result = _(array).chain().findLastIndex<{a: number}>({a: 42}); - result = _(array).chain().findLastIndex(predicateFn, fromIndex); + _.chain(list).findLastIndex(); // $ExpectType LoDashExplicitWrapper + _.chain(list).findLastIndex(predicateFn); // $ExpectType LoDashExplicitWrapper + _.chain(list).findLastIndex(""); // $ExpectType LoDashExplicitWrapper + _.chain(list).findLastIndex<{a: number}>({a: 42}); // $ExpectType LoDashExplicitWrapper + _.chain(list).findLastIndex(predicateFn, 1); // $ExpectType LoDashExplicitWrapper - result = _(list).chain().findLastIndex(); - result = _(list).chain().findLastIndex(predicateFn); - result = _(list).chain().findLastIndex(''); - result = _(list).chain().findLastIndex<{a: number}>({a: 42}); - result = _(list).chain().findLastIndex(predicateFn, fromIndex); - } + fp.findLastIndex(predicateFn2, list); // $ExpectType number + fp.findLastIndex(predicateFn2)(list); // $ExpectType number + fp.findLastIndex("", list); // $ExpectType number + fp.findLastIndex({ a: 42 }, list); // $ExpectType number + + fp.findLastIndexFrom(predicateFn2, 1, list); // $ExpectType number + fp.findLastIndexFrom(predicateFn2)(1)(list); // $ExpectType number + fp.findLastIndexFrom("", 1, list); // $ExpectType number + fp.findLastIndexFrom({ a: 42 }, 1, list); // $ExpectType number } // _.first -namespace TestFirst { - let array: AbcObject[] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; +{ + const list: _.List | null | undefined = anything; - { - let result: string | undefined; + _.first("abc"); // $ExpectType string | undefined + _.first(list); // $ExpectType AbcObject | undefined - result = _.first('abc'); - result = _('abc').first(); - } + _("abc").first(); // $ExpectType string | undefined + _(list).first(); // $ExpectType AbcObject | undefined - { - let result: AbcObject | undefined; + _.chain("abc").first(); // $ExpectType LoDashExplicitWrapper + _.chain(list).first(); // $ExpectType LoDashExplicitWrapper - result = _.first(array); - result = _.first(list); - - result = _(array).first(); - result = _(list).first(); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _('abc').chain().first(); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(array).chain().first(); - result = _(list).chain().first(); - } + fp.first("abc"); // $ExpectType string | undefined + fp.first(list); // $ExpectType AbcObject | undefined } // _.flatten -namespace TestFlatten { - let array: number[][] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; +{ + _.flatten("abc"); // $ExpectType string[] + _.flatten([1, 2, 3]); // $ExpectType number[] + _.flatten([1, [2, 3]]); // $ExpectType number[] + _.flatten({0: 1, 1: [2, 3], length: 2}); // $ExpectType number[] - { - let result: string[]; + _("abc").flatten(); // $ExpectType LoDashImplicitWrapper + _([1, 2, 3]).flatten(); // $ExpectType LoDashImplicitWrapper + _([1, [2, 3]]).flatten(); // $ExpectType LoDashImplicitWrapper + _({0: 1, 1: [2, 3], length: 2}).flatten(); // $ExpectType LoDashImplicitWrapper - result = _.flatten('abc'); - } + _.chain("abc").flatten(); // $ExpectType LoDashExplicitWrapper + _.chain([1, 2, 3]).flatten(); // $ExpectType LoDashExplicitWrapper + _.chain([1, [2, 3]]).flatten(); // $ExpectType LoDashExplicitWrapper + _.chain({0: 1, 1: [2, 3], length: 2}).flatten(); // $ExpectType LoDashExplicitWrapper - { - let result: number[]; - - result = _.flatten(array); - result = _.flatten(list); - result = _.flatten([1, 2, 3]); - result = _.flatten([1, 2, 3]); - 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(); - } + fp.flatten("abc"); // $ExpectType string[] + fp.flatten([1, 2, 3]); // $ExpectType number[] + fp.flatten([1, [2, 3]]); // $ExpectType number[] + fp.flatten({0: 1, 1: [2, 3], length: 2}); // $ExpectType number[] + fp.unnest([1, [2, 3]]); // $ExpectType number[] } // _.flattenDeep -namespace TestFlattenDeep { - let array: number[][] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; +{ + _.flattenDeep([1, 2, 3]); // $ExpectType number[] + _.flattenDeep([1, [2, [3, [4, 5]]]]); // $ExpectType number[] + _.flattenDeep({0: 1, 1: [2, [3, [4, 5]]], length: 2}); // $ExpectType number[] - { - let result: string[]; + _([1, 2, 3]).flattenDeep(); // $ExpectType LoDashImplicitWrapper + _([1, [2, [3, [4, 5]]]]).flattenDeep(); // $ExpectType LoDashImplicitWrapper + _({0: 1, 1: [2, [3, [4, 5]]], length: 2}).flattenDeep(); // $ExpectType LoDashImplicitWrapper - result = _.flattenDeep('abc'); - } + _.chain([1, 2, 3]).flattenDeep(); // $ExpectType LoDashExplicitWrapper + _.chain([1, [2, [3, [4, 5]]]]).flattenDeep(); // $ExpectType LoDashExplicitWrapper + _.chain({0: 1, 1: [2, [3, [4, 5]]], length: 2}).flattenDeep(); // $ExpectType LoDashExplicitWrapper - { - let result: number[]; - - result = _.flattenDeep(array); - result = _.flattenDeep(list); - 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(); - } + fp.flattenDeep([1, 2, 3]); // $ExpectType number[] + fp.flattenDeep([1, [2, [3, [4, 5]]]]); // $ExpectType number[] + fp.flattenDeep({0: 1, 1: [2, [3, [4, 5]]], length: 2}); // $ExpectType number[] } // _.fromPairs -namespace TestFromPairs { - let twoDimensionalArray: string[][] | null | undefined = [] as any; - let numberTupleArray: Array<[string, number]> | null | undefined = [] as any; - let stringDict: _.Dictionary; - let numberDict: _.Dictionary; +{ + const twoDimensionalArray: string[][] | null | undefined = anything; + const numberTupleArray: Array<[string, number]> | null | undefined = anything; - { - stringDict = _.fromPairs(twoDimensionalArray); - numberDict = _.fromPairs(numberTupleArray); - // Ensure we're getting the parameterized overload rather than the 'any' catch-all. - numberDict = _.fromPairs(numberTupleArray); - // This doesn't compile because you can't assign arrays to tuples. - // stringDict = _.fromPairs(twoDimensionalArray); - } - - { - stringDict = _(twoDimensionalArray).fromPairs().value(); - } - - { - stringDict = _.chain(twoDimensionalArray).fromPairs().value(); - } + _.fromPairs(twoDimensionalArray); // $ExpectType Dictionary + _.fromPairs(numberTupleArray); // $ExpectType Dictionary + _(twoDimensionalArray).fromPairs(); // $ExpectType LoDashImplicitWrapper> + _.chain(twoDimensionalArray).fromPairs(); // $ExpectType LoDashExplicitWrapper> + fp.fromPairs(numberTupleArray); // $ExpectType Dictionary } // _.head -namespace TestHead { - let array: AbcObject[] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; +{ + const list: _.List | null | undefined = anything; - { - let result: string | undefined; + _.head("abc"); // $ExpectType string | undefined + _.head(list); // $ExpectType AbcObject | undefined - result = _.head('abc'); - result = _('abc').head(); - } + _("abc").head(); // $ExpectType string | undefined + _(list).head(); // $ExpectType AbcObject | undefined - { - let result: AbcObject | undefined; + _.chain("abc").head(); // $ExpectType LoDashExplicitWrapper + _.chain(list).head(); // $ExpectType LoDashExplicitWrapper - result = _.head(array); - result = _.head(list); - - result = _(array).head(); - result = _(list).head(); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _('abc').chain().head(); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(array).chain().head(); - result = _(list).chain().head(); - } + fp.head("abc"); // $ExpectType string | undefined + fp.head(list); // $ExpectType AbcObject | undefined } // _.indexOf -namespace TestIndexOf { - let array: AbcObject[] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; - let value: AbcObject = { a: 1, b: "", c: true }; - - { - 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); - } -} - +// _.lastIndexOf // _.sortedIndexOf +// _.sortedLastIndexOf { - let array: AbcObject[] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; - let value: AbcObject = { a: 1, b: "", c: true }; + const list: _.List | null | undefined = anything; + const value: AbcObject = { a: 1, b: "", c: true }; - { - let result: number; + _.indexOf(list, value); // $ExpectType number + _.indexOf(list, value, 42); // $ExpectType number + _(list).indexOf(value); // $ExpectType number + _(list).indexOf(value, 42); // $ExpectType number + _.chain(list).indexOf(value); // $ExpectType LoDashExplicitWrapper + _.chain(list).indexOf(value, 42); // $ExpectType LoDashExplicitWrapper + fp.indexOf(value, list); // $ExpectType number + fp.indexOf(value)(list); // $ExpectType number + fp.indexOfFrom(value)(42)(list); // $ExpectType number - result = _.sortedIndexOf(array, value); - result = _.sortedIndexOf(list, value); - result = _(array).sortedIndexOf(value); - result = _(list).sortedIndexOf(value); - } + _.lastIndexOf(list, value); // $ExpectType number + _.lastIndexOf(list, value, 42); // $ExpectType number + _(list).lastIndexOf(value); // $ExpectType number + _(list).lastIndexOf(value, 42); // $ExpectType number + _.chain(list).lastIndexOf(value); // $ExpectType LoDashExplicitWrapper + _.chain(list).lastIndexOf(value, 42); // $ExpectType LoDashExplicitWrapper + fp.lastIndexOf(value, list); // $ExpectType number + fp.lastIndexOf(value)(list); // $ExpectType number + fp.lastIndexOfFrom(value)(42)(list); // $ExpectType number - { - let result: _.LoDashExplicitWrapper; + _.sortedIndexOf(list, value); // $ExpectType number + _(list).sortedIndexOf(value); // $ExpectType number + _.chain(list).indexOf(value); // $ExpectType LoDashExplicitWrapper + fp.sortedIndexOf(value, list); // $ExpectType number + fp.sortedIndexOf(value)(list); // $ExpectType number - result = _(array).chain().sortedIndexOf(value); - result = _(list).chain().sortedIndexOf(value); - } + _.sortedLastIndexOf(list, value); // $ExpectType number + _(list).sortedLastIndexOf(value); // $ExpectType number + _.chain(list).sortedLastIndexOf(value); // $ExpectType LoDashExplicitWrapper + fp.sortedLastIndexOf(value, list); // $ExpectType number + fp.sortedLastIndexOf(value)(list); // $ExpectType number } -//_.initial -namespace TestInitial { - let array: AbcObject[] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; +// _.initial +{ + const list: _.List | null | undefined = anything; - { - let result: AbcObject[]; - - 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(); - } + _.initial(list); // $ExpectType AbcObject[] + _(list).initial(); // $ExpectType LoDashImplicitWrapper + _.chain(list).initial(); // $ExpectType LoDashExplicitWrapper + fp.initial(list); // $ExpectType AbcObject[] } // _.intersection -namespace TestIntersection { - let array: AbcObject[] = [] as any; - let list: _.List = [] as any; - let arrayParam: AbcObject[] = [] as any; - let listParam: _.List = [] as any; +{ + const list: _.List = anything; - { - let result: AbcObject[]; - - result = _.intersection(array, list); - result = _.intersection(list, array, list); - } - - { - let result: _.LoDashImplicitArrayWrapper; - - result = _(array).intersection(arrayParam); - result = _(array).intersection(listParam, arrayParam); - - result = _(list).intersection(arrayParam); - result = _(list).intersection(listParam, arrayParam); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _(array).chain().intersection(arrayParam); - result = _(array).chain().intersection(listParam, arrayParam); - - result = _(list).chain().intersection(arrayParam); - result = _(list).chain().intersection(listParam, arrayParam); - } + _.intersection(list, list); // $ExpectType AbcObject[] + _.intersection(list, list, list); // $ExpectType AbcObject[] + _(list).intersection(list); // $ExpectType LoDashImplicitWrapper + _(list).intersection(list, list); // $ExpectType LoDashImplicitWrapper + _.chain(list).intersection(list); // $ExpectType LoDashExplicitWrapper + _.chain(list).intersection(list, list); // $ExpectType LoDashExplicitWrapper + fp.intersection(list, list); // $ExpectType AbcObject[] + fp.intersection(list)(list); // $ExpectType AbcObject[] } // _.intersectionBy { - let array: AbcObject[] = [] as any; - let list: _.List = [] as any; - let arrayParam: AbcObject[] = [] as any; - let listParam: _.List = [] as any; + const list: _.List = anything; + _.intersectionBy(list, list); // $ExpectType AbcObject[] + _.intersectionBy(list, list, list); // $ExpectType AbcObject[] + _.intersectionBy(list, list, "a"); // $ExpectType AbcObject[] + _.intersectionBy(list, list, list, { a: 42 }); // $ExpectType AbcObject[] + _.intersectionBy(list, list, ["a", 42]); // $ExpectType AbcObject[] // $ExpectType AbcObject[] - result = _.intersectionBy(array, list); - // $ExpectType AbcObject[] - result = _.intersectionBy(list, array, list); - // $ExpectType AbcObject[] - result = _.intersectionBy(array, list, 'a'); - // $ExpectType AbcObject[] - result = _.intersectionBy(array, list, { a: 42 }); - // $ExpectType AbcObject[] - result = _.intersectionBy(list, array, list, { a: 42 }); - // $ExpectType AbcObject[] - result = _.intersectionBy(array, list, ['a', 42]); - // $ExpectType AbcObject[] - result = _.intersectionBy(array, list, (value) => { + _.intersectionBy(list, list, (value) => { value; // $ExpectType AbcObject return 0; }); // $ExpectType AbcObject[] - result = _.intersectionBy(list, array, list, (value) => { + _.intersectionBy(list, list, list, (value) => { value; // $ExpectType AbcObject return 0; }); + _(list).intersectionBy(list); // $ExpectType LoDashImplicitWrapper + _(list).intersectionBy(list, "a"); // $ExpectType LoDashImplicitWrapper + _(list).intersectionBy(list, list, { a: 42 }); // $ExpectType LoDashImplicitWrapper + _(list).intersectionBy(list, ["a", 42]); // $ExpectType LoDashImplicitWrapper // $ExpectType LoDashImplicitWrapper - result = _(array).intersectionBy(arrayParam); - // $ExpectType LoDashImplicitWrapper - result = _(array).intersectionBy(listParam, arrayParam); - // $ExpectType LoDashImplicitWrapper - result = _(array).intersectionBy(list, 'a'); - // $ExpectType LoDashImplicitWrapper - result = _(array).intersectionBy(list, { a: 42 }); - // $ExpectType LoDashImplicitWrapper - result = _(list).intersectionBy(array, list, { a: 42 }); - // $ExpectType LoDashImplicitWrapper - result = _(array).intersectionBy(list, ['a', 42]); - // $ExpectType LoDashImplicitWrapper - result = _(array).intersectionBy(list, (value) => { - value; // $ExpectType AbcObject - return ""; - }); - // $ExpectType LoDashImplicitWrapper - result = _(list).intersectionBy(array, list, (value) => { + _(list).intersectionBy(list, (value) => { value; // $ExpectType AbcObject return 1; }); + _.chain(list).intersectionBy(list); // $ExpectType LoDashExplicitWrapper + _.chain(list).intersectionBy(list, "a"); // $ExpectType LoDashExplicitWrapper + _.chain(list).intersectionBy(list, list, { a: 42 }); // $ExpectType LoDashExplicitWrapper + _.chain(list).intersectionBy(list, ["a", 42]); // $ExpectType LoDashExplicitWrapper // $ExpectType LoDashExplicitWrapper - result = _.chain(array).intersectionBy(arrayParam); - // $ExpectType LoDashExplicitWrapper - result = _.chain(array).intersectionBy(listParam, arrayParam); - // $ExpectType LoDashExplicitWrapper - result = _.chain(array).intersectionBy(list, 'a'); - // $ExpectType LoDashExplicitWrapper - result = _.chain(array).intersectionBy(list, { a: 42 }); - // $ExpectType LoDashExplicitWrapper - result = _.chain(list).intersectionBy(array, list, { a: 42 }); - // $ExpectType LoDashExplicitWrapper - result = _.chain(array).intersectionBy(list, ['a', 42]); - // $ExpectType LoDashExplicitWrapper - result = _.chain(array).intersectionBy(list, (value) => { - value; // $ExpectType AbcObject - return false; - }); - // $ExpectType LoDashExplicitWrapper - result = _.chain(list).intersectionBy(array, list, (value) => { + _.chain(list).intersectionBy(list, (value) => { value; // $ExpectType AbcObject return null; }); + fp.intersectionBy("a", list, list); // $ExpectType AbcObject[] + fp.intersectionBy("a", list, list); // $ExpectType AbcObject[] + fp.intersectionBy({ a: 42 }, list, list); // $ExpectType AbcObject[] + fp.intersectionBy(["a", 42], list, list); // $ExpectType AbcObject[] + fp.intersectionBy((value: AbcObject) => 0, list, list); // $ExpectType AbcObject[] + interface T1 { a: string; b: string; @@ -1469,20 +720,20 @@ namespace TestIntersection { a: string; b: number; } - const t1: T1 = { a: 'a', b: 'b' }; - const t2: T2 = { a: 'a', b: 1 }; + const t1: T1 = { a: "a", b: "b" }; + const t2: T2 = { a: "a", b: 1 }; // $ExpectType T1[] - result = _.intersectionBy([t1], [t2], (value) => { + _.intersectionBy([t1], [t2], (value) => { value; // $ExpectType T1 | T2 return undefined; }); // $ExpectType LoDashImplicitWrapper - result = _([t1]).intersectionBy([t2], (value) => { + _([t1]).intersectionBy([t2], (value) => { value; // $ExpectType T1 | T2 return {}; }); // $ExpectType LoDashExplicitWrapper - result = _.chain([t1]).intersectionBy([t2], (value) => { + _.chain([t1]).intersectionBy([t2], (value) => { value; // $ExpectType T1 | T2 return {}; }); @@ -1490,62 +741,44 @@ namespace TestIntersection { // _.intersectionWith { - let array: AbcObject[] = [] as any; - let list: _.List = [] as any; - let arrayParam: AbcObject[] = [] as any; - let listParam: _.List = [] as any; + const list: _.List = anything; + _.intersectionWith(list, list); // $ExpectType AbcObject[] + _.intersectionWith(list, list, list); // $ExpectType AbcObject[] // $ExpectType AbcObject[] - result = _.intersectionWith(array, list); - // $ExpectType AbcObject[] - result = _.intersectionWith(list, array, list); - // $ExpectType AbcObject[] - result = _.intersectionWith(array, list, (a, b) => { + _.intersectionWith(list, list, (a, b) => { a; // $ExpectType AbcObject b; // $ExpectType AbcObject return true; }); // $ExpectType AbcObject[] - result = _.intersectionWith(list, array, list, (a, b) => { + _.intersectionWith(list, list, list, (a, b) => { a; // $ExpectType AbcObject b; // $ExpectType AbcObject return true; }); + _(list).intersectionWith(list); // $ExpectType LoDashImplicitWrapper + _(list).intersectionWith(list, list); // $ExpectType LoDashImplicitWrapper // $ExpectType LoDashImplicitWrapper - result = _(array).intersectionWith(arrayParam); - // $ExpectType LoDashImplicitWrapper - result = _(array).intersectionWith(listParam, arrayParam); - // $ExpectType LoDashImplicitWrapper - result = _(array).intersectionWith(list, (a, b) => { - a; // $ExpectType AbcObject - b; // $ExpectType AbcObject - return true; - }); - // $ExpectType LoDashImplicitWrapper - result = _(list).intersectionWith(array, list, (a, b) => { + _(list).intersectionWith(list, (a, b) => { a; // $ExpectType AbcObject b; // $ExpectType AbcObject return true; }); + _.chain(list).intersectionWith(list); // $ExpectType LoDashExplicitWrapper + _.chain(list).intersectionWith(list, list); // $ExpectType LoDashExplicitWrapper // $ExpectType LoDashExplicitWrapper - result = _.chain(array).intersectionWith(arrayParam); - // $ExpectType LoDashExplicitWrapper - result = _.chain(array).intersectionWith(listParam, arrayParam); - // $ExpectType LoDashExplicitWrapper - result = _.chain(array).intersectionWith(list, (a, b) => { - a; // $ExpectType AbcObject - b; // $ExpectType AbcObject - return true; - }); - // $ExpectType LoDashExplicitWrapper - result = _.chain(list).intersectionWith(array, list, (a, b) => { + _.chain(list).intersectionWith(list, (a, b) => { a; // $ExpectType AbcObject b; // $ExpectType AbcObject return true; }); + fp.intersectionWith((a: AbcObject, b: AbcObject) => true, list, list); // $ExpectType AbcObject[] + fp.intersectionWith((a: AbcObject, b: AbcObject) => true)(list)(list); // $ExpectType AbcObject[] + interface T1 { a: string; b: string; @@ -1554,434 +787,244 @@ namespace TestIntersection { a: string; b: number; } - const t1: T1 = { a: 'a', b: 'b' }; - const t2: T2 = { a: 'a', b: 1 }; + const t1: T1 = { a: "a", b: "b" }; + const t2: T2 = { a: "a", b: 1 }; // $ExpectType T1[] - result = _.intersectionWith([t1], [t2], (a, b) => { + _.intersectionWith([t1], [t2], (a, b) => { a; // $ExpectType T1 b; // $ExpectType T2 return true; }); // $ExpectType LoDashImplicitWrapper - result = _([t1]).intersectionWith([t2], (a, b) => { + _([t1]).intersectionWith([t2], (a, b) => { a; // $ExpectType T1 b; // $ExpectType T2 return true; }); // $ExpectType LoDashExplicitWrapper - result = _.chain([t1]).intersectionWith([t2], (a, b) => { + _.chain([t1]).intersectionWith([t2], (a, b) => { a; // $ExpectType T1 b; // $ExpectType T2 return true; }); + + fp.intersectionWith((a: T1, b: T2) => true)([t1])([t2]); // $ExpectType T1[] } // _.join -namespace TestJoin { - let array = [1, 2]; - let list = {0: 1, 1: 2, length: 2}; - let nilArray: string[] | null | undefined = undefined as any; - let nilList: _.List | null | undefined = undefined as any; +{ + const list: _.List | null | undefined = anything; - { - let result: string; + _.join("abc"); // $ExpectType string + _.join("abc", "_"); // $ExpectType string + _.join(list); // $ExpectType string + _.join(list, "_"); // $ExpectType string - result = _.join('abc'); - result = _.join('abc', '_'); - result = _.join(array); - result = _.join(array, '_'); - result = _.join(list); - result = _.join(list, '_'); - result = _.join(nilArray); - result = _.join(nilArray, '_'); - result = _.join(nilList); - result = _.join(nilList, '_'); + _("abc").join(); // $ExpectType string + _("abc").join("_"); // $ExpectType string + _(list).join(); // $ExpectType string + _(list).join("_"); // $ExpectType string - result = _('abc').join(); - result = _('abc').join('_'); - result = _(array).join(); - result = _(array).join('_'); - result = _(list).join(); - result = _(list).join('_'); - } + _.chain("abc").join(); // $ExpectType LoDashExplicitWrapper + _.chain("abc").join("_"); // $ExpectType LoDashExplicitWrapper + _.chain(list).join(); // $ExpectType LoDashExplicitWrapper + _.chain(list).join("_"); // $ExpectType LoDashExplicitWrapper - { - let result: _.LoDashExplicitWrapper; - - result = _('abc').chain().join(); - result = _('abc').chain().join('_'); - result = _(array).chain().join(); - result = _(array).chain().join('_'); - result = _(list).chain().join(); - result = _(list).chain().join('_'); - } + fp.join("_", "abc"); // $ExpectType string + fp.join("_")(list); // $ExpectType string } // _.last -namespace TestLast { - let array: AbcObject[] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; +{ + const list: _.List | null | undefined = anything; - { - let result: string | undefined; + _.last("abc"); // $ExpectType string | undefined + _.last(list); // $ExpectType AbcObject | undefined - result = _.last('abc'); - result = _('abc').last(); - } + _("abc").last(); // $ExpectType string | undefined + _(list).last(); // $ExpectType AbcObject | undefined - { - let result: AbcObject | undefined; + _.chain("abc").last(); // $ExpectType LoDashExplicitWrapper + _.chain(list).last(); // $ExpectType LoDashExplicitWrapper - result = _.last(array); - result = _.last(list); - - result = _(array).last(); - result = _(list).last(); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _('abc').chain().last(); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(array).chain().last(); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(list).chain().last(); - } -} - -// _.lastIndexOf -namespace TestLastIndexOf { - let array: AbcObject[] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; - let value: AbcObject = { a: 1, b: "", c: true }; - - { - 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); - } + fp.last("abc"); // $ExpectType string | undefined + fp.last(list); // $ExpectType AbcObject | undefined } // _.nth -namespace TestNth { - let array: AbcObject[] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; - let value = 0; +{ + const list: _.List | null | undefined = anything; - { - let result: AbcObject | undefined; + _.nth(list, 42); // $ExpectType AbcObject | undefined + _(list).nth(42); // $ExpectType AbcObject | undefined + _.chain(list).nth(42); // $ExpectType LoDashExplicitWrapper - result = _.nth(array); - - result = _.nth(array, 42); - - result = _(array).nth(); - result = _(array).nth(42); - - result = _(list).nth(); - result = _(list).nth(42); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(array).chain().nth(); - result = _(array).chain().nth(42); - - result = _(list).chain().nth(); - result = _(list).chain().nth(42); - } + fp.nth(42, list); // $ExpectType AbcObject | undefined + fp.nth(42)(list); // $ExpectType AbcObject | undefined } // _.pull -namespace TestPull { - let array: AbcObject[] = []; - let list: _.List = []; - let value: AbcObject = { a: 1, b: "", c: true }; +{ + const array: AbcObject[] = []; + const list: _.List = []; + const value: AbcObject = { a: 1, b: "", c: true }; - { - let result: AbcObject[]; + _.pull(array); // $ExpectType AbcObject[] + _.pull(array, value); // $ExpectType AbcObject[] + _.pull(array, value, value, value); // $ExpectType AbcObject[] + _.pull(list); // $ExpectType ArrayLike + _.pull(list, value); // $ExpectType ArrayLike + _.pull(list, value, value, value); // $ExpectType ArrayLike - result = _.pull(array); - result = _.pull(array, value); - result = _.pull(array, value, value); - result = _.pull(array, value, value, value); - } + _(array).pull(); // $ExpectType LoDashImplicitWrapper + _(array).pull(value); // $ExpectType LoDashImplicitWrapper + _(array).pull(value, value, value); // $ExpectType LoDashImplicitWrapper + _(list).pull(); // $ExpectType LoDashImplicitWrapper> + _(list).pull(value); // $ExpectType LoDashImplicitWrapper> + _(list).pull(value, value, value); // $ExpectType LoDashImplicitWrapper> - { - let result: _.List; + _.chain(array).pull(); // $ExpectType LoDashExplicitWrapper + _.chain(array).pull(value); // $ExpectType LoDashExplicitWrapper + _.chain(array).pull(value, value, value); // $ExpectType LoDashExplicitWrapper + _.chain(list).pull(); // $ExpectType LoDashExplicitWrapper> + _.chain(list).pull(value); // $ExpectType LoDashExplicitWrapper> + _.chain(list).pull(value, value, value); // $ExpectType LoDashExplicitWrapper> - 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); - } + fp.pull(value, array); // $ExpectType AbcObject[] + fp.pull(value, list); // $ExpectType ArrayLike + fp.pull(value)(list); // $ExpectType ArrayLike } // _.pullAt -namespace TestPullAt { - let array: AbcObject[] = []; - let list: _.List = []; +{ + const array: AbcObject[] = []; + const list: _.List = []; - { - let result: AbcObject[]; + _.pullAt(array); // $ExpectType AbcObject[] + _.pullAt(array, 1); // $ExpectType AbcObject[] + _.pullAt(array, [2, 3], 4); // $ExpectType AbcObject[] + _.pullAt(list); // $ExpectType ArrayLike + _.pullAt(list, 1); // $ExpectType ArrayLike + _.pullAt(list, [2, 3], 4); // $ExpectType ArrayLike - result = _.pullAt(array); - result = _.pullAt(array, 1); - result = _.pullAt(array, [2, 3], 1); - result = _.pullAt(array, 4, [2, 3], 1); - } + _(array).pullAt(); // $ExpectType LoDashImplicitWrapper + _(array).pullAt(1); // $ExpectType LoDashImplicitWrapper + _(array).pullAt([2, 3], 4); // $ExpectType LoDashImplicitWrapper + _(list).pullAt(); // $ExpectType LoDashImplicitWrapper> + _(list).pullAt(1); // $ExpectType LoDashImplicitWrapper> + _(list).pullAt([2, 3], 4); // $ExpectType LoDashImplicitWrapper> - { - let result: ArrayLike; + _.chain(array).pullAt(); // $ExpectType LoDashExplicitWrapper + _.chain(array).pullAt(1); // $ExpectType LoDashExplicitWrapper + _.chain(array).pullAt([2, 3], 4); // $ExpectType LoDashExplicitWrapper + _.chain(list).pullAt(); // $ExpectType LoDashExplicitWrapper> + _.chain(list).pullAt(1); // $ExpectType LoDashExplicitWrapper> + _.chain(list).pullAt([2, 3], 4); // $ExpectType LoDashExplicitWrapper> - 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); - } - - { - let result: _.LoDashImplicitWrapper>; - - 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); - } - - { - let result: _.LoDashExplicitWrapper>; - - result = _(list).chain().pullAt(); - result = _(list).chain().pullAt(1); - result = _(list).chain().pullAt([2, 3], 1); - result = _(list).chain().pullAt(4, [2, 3], 1); - } + fp.pullAt(1, array); // $ExpectType AbcObject[] + fp.pullAt([2, 3], array); // $ExpectType AbcObject[] + fp.pullAt(1, list); // $ExpectType ArrayLike + fp.pullAt([2, 3], list); // $ExpectType ArrayLike + fp.pullAt(1)(list); // $ExpectType ArrayLike } // _.pullAll { - let array: AbcObject[] = anything; - let list: _.List = anything; - let values: _.List = anything; + const array: AbcObject[] = anything; + const list: _.List = anything; + const values: _.List = anything; - // $ExpectType AbcObject[] - _.pullAll(array); - // $ExpectType AbcObject[] - _.pullAll(array, values); - // $ExpectType ArrayLike - _.pullAll(list); - // $ExpectType ArrayLike - _.pullAll(list, values); + _.pullAll(array); // $ExpectType AbcObject[] + _.pullAll(array, values); // $ExpectType AbcObject[] + _.pullAll(list); // $ExpectType ArrayLike + _.pullAll(list, values); // $ExpectType ArrayLike - // $ExpectType LoDashImplicitWrapper - _(array).pullAll(); - // $ExpectType LoDashImplicitWrapper - _(array).pullAll(values); - // $ExpectType LoDashImplicitWrapper> - _(list).pullAll(); - // $ExpectType LoDashImplicitWrapper> - _(list).pullAll(values); + _(array).pullAll(); // $ExpectType LoDashImplicitWrapper + _(array).pullAll(values); // $ExpectType LoDashImplicitWrapper + _(list).pullAll(); // $ExpectType LoDashImplicitWrapper> + _(list).pullAll(values); // $ExpectType LoDashImplicitWrapper> - // $ExpectType LoDashExplicitWrapper - _.chain(array).pullAll(); - // $ExpectType LoDashExplicitWrapper - _.chain(array).pullAll(values); - // $ExpectType LoDashExplicitWrapper> - _.chain(list).pullAll(); - // $ExpectType LoDashExplicitWrapper> - _.chain(list).pullAll(values); + _.chain(array).pullAll(); // $ExpectType LoDashExplicitWrapper + _.chain(array).pullAll(values); // $ExpectType LoDashExplicitWrapper + _.chain(list).pullAll(); // $ExpectType LoDashExplicitWrapper> + _.chain(list).pullAll(values); // $ExpectType LoDashExplicitWrapper> + + fp.pullAll(values, array); // $ExpectType AbcObject[] + fp.pullAll(values, list); // $ExpectType ArrayLike + fp.pullAll(values)(list); // $ExpectType ArrayLike } // _.pullAllBy +// _.pullAllWith { - let array: AbcObject[] = anything; - let list: _.List = anything; - let values: _.List = anything; + const array: AbcObject[] = anything; + const list: _.List = anything; + const values: _.List = anything; - // $ExpectType AbcObject[] - _.pullAllBy(array); - // $ExpectType AbcObject[] - _.pullAllBy(array, values); - // $ExpectType AbcObject[] - _.pullAllBy(array, values, 'a'); - // $ExpectType AbcObject[] - _.pullAllBy(array, values, { a: 42 }); - // $ExpectType AbcObject[] - _.pullAllBy(array, values, ['a', 42]); + _.pullAllBy(array); // $ExpectType AbcObject[] + _.pullAllBy(array, values, "a"); // $ExpectType AbcObject[] // $ExpectType AbcObject[] _.pullAllBy(array, values, (value) => { value; // $ExpectType AbcObject return []; }); - // $ExpectType ArrayLike - _.pullAllBy(list); - // $ExpectType ArrayLike - _.pullAllBy(list, values); - // $ExpectType ArrayLike - _.pullAllBy(list, values, 'a'); - // $ExpectType ArrayLike - _.pullAllBy(list, values, { a: 42 }); - // $ExpectType ArrayLike - _.pullAllBy(list, values, ['a', 42]); + + _.pullAllBy(list); // $ExpectType ArrayLike + _.pullAllBy(list, values); // $ExpectType ArrayLike + _.pullAllBy(list, values, "a"); // $ExpectType ArrayLike + _.pullAllBy(list, values, { a: 42 }); // $ExpectType ArrayLike + _.pullAllBy(list, values, ["a", 42]); // $ExpectType ArrayLike // $ExpectType ArrayLike _.pullAllBy(list, values, (value) => { value; // $ExpectType AbcObject return () => {}; }); - // $ExpectType LoDashImplicitWrapper - _(array).pullAllBy(); - // $ExpectType LoDashImplicitWrapper - _(array).pullAllBy(values); - // $ExpectType LoDashImplicitWrapper - _(array).pullAllBy(values, 'a'); - // $ExpectType LoDashImplicitWrapper - _(array).pullAllBy(values, { a: 42 }); - // $ExpectType LoDashImplicitWrapper - _(array).pullAllBy(values, ['a', 42]); + _(array).pullAllBy(); // $ExpectType LoDashImplicitWrapper + _(array).pullAllBy(values, "a"); // $ExpectType LoDashImplicitWrapper // $ExpectType LoDashImplicitWrapper _(array).pullAllBy(values, (value) => { value; // $ExpectType AbcObject return 0; }); - // $ExpectType LoDashImplicitWrapper> - _(list).pullAllBy(); - // $ExpectType LoDashImplicitWrapper> - _(list).pullAllBy(values); - // $ExpectType LoDashImplicitWrapper> - _(list).pullAllBy(values, 'a'); - // $ExpectType LoDashImplicitWrapper> - _(list).pullAllBy(values, { a: 42 }); - // $ExpectType LoDashImplicitWrapper> - _(list).pullAllBy(values, ['a', 42]); + _(list).pullAllBy(); // $ExpectType LoDashImplicitWrapper> + _(list).pullAllBy(values, "a"); // $ExpectType LoDashImplicitWrapper> // $ExpectType LoDashImplicitWrapper> _(list).pullAllBy(values, (value) => { value; // $ExpectType AbcObject return 0; }); - // $ExpectType LoDashExplicitWrapper - _.chain(array).pullAllBy(); - // $ExpectType LoDashExplicitWrapper - _.chain(array).pullAllBy(values); - // $ExpectType LoDashExplicitWrapper - _.chain(array).pullAllBy(values, 'a'); - // $ExpectType LoDashExplicitWrapper - _.chain(array).pullAllBy(values, { a: 42 }); - // $ExpectType LoDashExplicitWrapper - _.chain(array).pullAllBy(values, ['a', 42]); + _.chain(array).pullAllBy(); // $ExpectType LoDashExplicitWrapper + _.chain(array).pullAllBy(values, "a"); // $ExpectType LoDashExplicitWrapper // $ExpectType LoDashExplicitWrapper _.chain(array).pullAllBy(values, (value) => { value; // $ExpectType AbcObject return 0; }); - // $ExpectType LoDashExplicitWrapper> - _.chain(list).pullAllBy(); - // $ExpectType LoDashExplicitWrapper> - _.chain(list).pullAllBy(values); - // $ExpectType LoDashExplicitWrapper> - _.chain(list).pullAllBy(values, 'a'); - // $ExpectType LoDashExplicitWrapper> - _.chain(list).pullAllBy(values, { a: 42 }); - // $ExpectType LoDashExplicitWrapper> - _.chain(list).pullAllBy(values, ['a', 42]); + _.chain(list).pullAllBy(); // $ExpectType LoDashExplicitWrapper> + _.chain(list).pullAllBy(values, "a"); // $ExpectType LoDashExplicitWrapper> // $ExpectType LoDashExplicitWrapper> _.chain(list).pullAllBy(values, (value) => { value; // $ExpectType AbcObject return 0; }); + fp.pullAllBy("a", values, array); // $ExpectType AbcObject[] + fp.pullAllBy({ a: 42 }, values, array); // $ExpectType AbcObject[] + fp.pullAllBy(["a", 42], values, array); // $ExpectType AbcObject[] + fp.pullAllBy((value: AbcObject) => true, values, array); // $ExpectType AbcObject[] + fp.pullAllBy((value: AbcObject) => true)(values, array); // $ExpectType AbcObject[] + fp.pullAllBy((value: AbcObject) => true, values)(array); // $ExpectType AbcObject[] + fp.pullAllBy((value: AbcObject) => true)(values)(array); // $ExpectType AbcObject[] + fp.pullAllBy("a", values, list); // $ExpectType ArrayLike + fp.pullAllBy({ a: 42 }, values, list); // $ExpectType ArrayLike + fp.pullAllBy(["a", 42], values, list); // $ExpectType ArrayLike + fp.pullAllBy((value: AbcObject) => true, values, list); // $ExpectType ArrayLike + fp.pullAllBy((value: AbcObject) => true)(values, list); // $ExpectType ArrayLike + fp.pullAllBy((value: AbcObject) => true, values)(list); // $ExpectType ArrayLike + fp.pullAllBy((value: AbcObject) => true)(values)(list); // $ExpectType ArrayLike + interface T1 { a: string; b: string; @@ -1990,45 +1033,36 @@ namespace TestPullAt { a: string; b: number; } - const t1: T1 = { a: 'a', b: 'b' }; - const t2: T2 = { a: 'a', b: 1 }; + const t1: T1 = { a: "a", b: "b" }; + const t2: T2 = { a: "a", b: 1 }; // $ExpectType T1[] - result = _.pullAllBy([t1], [t2], (value) => { + _.pullAllBy([t1], [t2], (value) => { value; // $ExpectType T1 | T2 return ""; }); // $ExpectType LoDashImplicitWrapper - result = _([t1]).pullAllBy([t2], (value) => { + _([t1]).pullAllBy([t2], (value) => { value; // $ExpectType T1 | T2 return ""; }); // $ExpectType LoDashExplicitWrapper - result = _.chain([t1]).pullAllBy([t2], (value) => { + _.chain([t1]).pullAllBy([t2], (value) => { value; // $ExpectType T1 | T2 return ""; }); -} -// _.pullAllWith -{ - let array: AbcObject[] = anything; - let list: _.List = anything; - let values: _.List = anything; + fp.pullAllBy((value: T1 | T2) => value.a, [t2], [t1]); // $ExpectType T1[] + fp.pullAllBy((value: T1 | T2) => value.a)([t2])([t1]); // $ExpectType (T1 | T2)[] - // $ExpectType AbcObject[] - _.pullAllWith(array); - // $ExpectType AbcObject[] - _.pullAllWith(array, values); + _.pullAllWith(array); // $ExpectType AbcObject[] + _.pullAllWith(array, values); // $ExpectType AbcObject[] // $ExpectType AbcObject[] _.pullAllWith(array, values, (a, b) => { a; // $ExpectType AbcObject b; // $ExpectType AbcObject return true; }); - // $ExpectType ArrayLike - _.pullAllWith(list); - // $ExpectType ArrayLike - _.pullAllWith(list, values); + _.pullAllWith(list); // $ExpectType ArrayLike // $ExpectType ArrayLike _.pullAllWith(list, values, (a, b) => { a; // $ExpectType AbcObject @@ -2036,20 +1070,15 @@ namespace TestPullAt { return true; }); - // $ExpectType LoDashImplicitWrapper - _(array).pullAllWith(); - // $ExpectType LoDashImplicitWrapper - _(array).pullAllWith(values); + _(array).pullAllWith(); // $ExpectType LoDashImplicitWrapper + _(array).pullAllWith(values); // $ExpectType LoDashImplicitWrapper // $ExpectType LoDashImplicitWrapper _(array).pullAllWith(values, (a, b) => { a; // $ExpectType AbcObject b; // $ExpectType AbcObject return true; }); - // $ExpectType LoDashImplicitWrapper> - _(list).pullAllWith(); - // $ExpectType LoDashImplicitWrapper> - _(list).pullAllWith(values); + _(list).pullAllWith(); // $ExpectType LoDashImplicitWrapper> // $ExpectType LoDashImplicitWrapper> _(list).pullAllWith(values, (a, b) => { a; // $ExpectType AbcObject @@ -2057,20 +1086,15 @@ namespace TestPullAt { return true; }); - // $ExpectType LoDashExplicitWrapper - _.chain(array).pullAllWith(); - // $ExpectType LoDashExplicitWrapper - _.chain(array).pullAllWith(values); + _.chain(array).pullAllWith(); // $ExpectType LoDashExplicitWrapper + _.chain(array).pullAllWith(values); // $ExpectType LoDashExplicitWrapper // $ExpectType LoDashExplicitWrapper _.chain(array).pullAllWith(values, (a, b) => { a; // $ExpectType AbcObject b; // $ExpectType AbcObject return true; }); - // $ExpectType LoDashExplicitWrapper> - _.chain(list).pullAllWith(); - // $ExpectType LoDashExplicitWrapper> - _.chain(list).pullAllWith(values); + _.chain(list).pullAllWith(); // $ExpectType LoDashExplicitWrapper> // $ExpectType LoDashExplicitWrapper> _.chain(list).pullAllWith(values, (a, b) => { a; // $ExpectType AbcObject @@ -2078,1987 +1102,585 @@ namespace TestPullAt { return true; }); - interface T1 { - a: string; - b: string; - } - interface T2 { - a: string; - b: number; - } - const t1: T1 = { a: 'a', b: 'b' }; - const t2: T2 = { a: 'a', b: 1 }; + fp.pullAllWith((a, b) => true, values, array); // $ExpectType AbcObject[] + fp.pullAllWith((a: AbcObject, b: AbcObject) => true)(values, array); // $ExpectType AbcObject[] + fp.pullAllWith((a, b) => true, values, list); // $ExpectType ArrayLike + fp.pullAllWith((a: AbcObject, b: AbcObject) => true)(values, list); // $ExpectType ArrayLike + // $ExpectType T1[] - result = _.pullAllWith([t1], [t2], (a, b) => { + _.pullAllWith([t1], [t2], (a, b) => { a; // $ExpectType T1 b; // $ExpectType T2 return true; }); // $ExpectType LoDashImplicitWrapper - result = _([t1]).pullAllWith([t2], (a, b) => { + _([t1]).pullAllWith([t2], (a, b) => { a; // $ExpectType T1 b; // $ExpectType T2 return true; }); // $ExpectType LoDashExplicitWrapper - result = _.chain([t1]).pullAllWith([t2], (a, b) => { + _.chain([t1]).pullAllWith([t2], (a, b) => { a; // $ExpectType T1 b; // $ExpectType T2 return true; }); + + fp.pullAllWith((a, b) => a.a === b.a, [t2], [t1]); // $ExpectType T1[] + fp.pullAllWith((a: T1, b: T2) => a.a === b.a)([t2], [t1]); // $ExpectType T1[] } // _.remove -namespace TestRemove { - let array: AbcObject[] = []; - let list: _.List = []; - let predicateFn = (value: AbcObject, index: number, collection: _.List) => true; +{ + const list: _.List = []; + const predicateFn = (value: AbcObject, index: number, collection: _.List) => true; - { - let result: AbcObject[]; + _.remove(list); // $ExpectType AbcObject[] + _.remove(list, predicateFn); // $ExpectType AbcObject[] + _.remove(list, ""); // $ExpectType AbcObject[] + _.remove(list, { a: 42 }); // $ExpectType AbcObject[] - result = _.remove(array); - result = _.remove(array, predicateFn); - result = _.remove(array, ''); - result = _.remove(array, {a: 42}); + _(list).remove(); // $ExpectType LoDashImplicitWrapper + _(list).remove(predicateFn); // $ExpectType LoDashImplicitWrapper + _(list).remove(""); // $ExpectType LoDashImplicitWrapper + _(list).remove({ a: 42 }); // $ExpectType LoDashImplicitWrapper - result = _.remove(list); - result = _.remove(list, predicateFn); - result = _.remove(list, ''); - result = _.remove(list, {a: 42}); - } + _.chain(list).remove(); // $ExpectType LoDashExplicitWrapper + _.chain(list).remove(predicateFn); // $ExpectType LoDashExplicitWrapper + _.chain(list).remove(""); // $ExpectType LoDashExplicitWrapper + _.chain(list).remove({ a: 42 }); // $ExpectType LoDashExplicitWrapper - { - let result: _.LoDashImplicitArrayWrapper; - - result = _(array).remove(); - result = _(array).remove(predicateFn); - result = _(array).remove(''); - result = _(array).remove({a: 42}); - - result = _(list).remove(); - result = _(list).remove(predicateFn); - result = _(list).remove(''); - result = _(list).remove({a: 42}); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _(array).chain().remove(); - result = _(array).chain().remove(predicateFn); - result = _(array).chain().remove(''); - result = _(array).chain().remove({a: 42}); - - result = _(list).chain().remove(); - result = _(list).chain().remove(predicateFn); - result = _(list).chain().remove(''); - result = _(list).chain().remove({a: 42}); - } + const predicateFn2 = (value: AbcObject) => true; + fp.remove(predicateFn2, list); // $ExpectType AbcObject[] + fp.remove(predicateFn2)(list); // $ExpectType AbcObject[] + fp.remove("", list); // $ExpectType AbcObject[] + fp.remove({ a: 42 }, list); // $ExpectType AbcObject[] } // _.tail -namespace TestTail { - let array: AbcObject[] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; +{ + const list: _.List | null | undefined = anything; - { - let result: AbcObject[]; - - 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(); - } + _.tail(list); // $ExpectType AbcObject[] + _(list).tail(); // $ExpectType LoDashImplicitWrapper + _.chain(list).tail(); // $ExpectType LoDashExplicitWrapper + fp.tail(list); // $ExpectType AbcObject[] } // _.slice -namespace TestSlice { - let array: AbcObject[] | null | undefined = [] as any; +{ + const array: AbcObject[] | null | undefined = anything; - { - let result: AbcObject[]; - - 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 -namespace TestSortedIndex { - type SampleType = {a: number; b: string; c: boolean;}; - - let array: SampleType[] = []; - let list: _.List = []; - - let value: SampleType = { a: 1, b: "", c: true }; - - let stringIterator: (x: string) => number; - let arrayIterator: (x: SampleType) => number; - let listIterator: (x: SampleType) => number; - - { - let result: number; - - result = _.sortedIndex('', ''); - - result = _.sortedIndex(array, value); - - result = _.sortedIndex(list, value); - - result = _('').sortedIndex(''); - - result = _(array).sortedIndex(value); - - result = _(list).sortedIndex(value); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _('').chain().sortedIndex(''); - - result = _(array).chain().sortedIndex(value); - - result = _(list).chain().sortedIndex(value); - } + _.slice(array); // $ExpectType AbcObject[] + _.slice(array, 42); // $ExpectType AbcObject[] + _.slice(array, 42, 42); // $ExpectType AbcObject[] + _(array).slice(); // $ExpectType LoDashImplicitWrapper + _(array).slice(42, 42); // $ExpectType LoDashImplicitWrapper + _.chain(array).slice(); // $ExpectType LoDashExplicitWrapper + _.chain(array).slice(42, 42); // $ExpectType LoDashExplicitWrapper + fp.slice(0, 10, array); // $ExpectType AbcObject[] + fp.slice(0)(10, array); // $ExpectType AbcObject[] + fp.slice(0)(10)(array); // $ExpectType AbcObject[] } // _.sortedIndexBy -namespace TestSortedIndexBy { - type SampleType = {a: number; b: string; c: boolean;}; - - let array: SampleType[] = []; - let list: _.List = []; - - let value: SampleType = { a: 1, b: "", c: true }; - - let stringIterator = (x: string) => 0; - let arrayIterator = (x: SampleType) => 0; - let listIterator = (x: SampleType) => 0; - - { - let result: number; - - result = _.sortedIndexBy('', '', stringIterator); - - result = _.sortedIndexBy(array, value, arrayIterator); - result = _.sortedIndexBy(array, value, ''); - result = _.sortedIndexBy(array, value, {a: 42}); - - result = _.sortedIndexBy(list, value, listIterator); - result = _.sortedIndexBy(list, value, ''); - result = _.sortedIndexBy(list, value, {a: 42}); - - result = _('').sortedIndexBy('', stringIterator); - - result = _(array).sortedIndexBy(value, arrayIterator); - result = _(array).sortedIndexBy(value, ''); - result = _(array).sortedIndexBy(value, {a: 42}); - - result = _(list).sortedIndexBy(value, listIterator); - result = _(list).sortedIndexBy(value, ''); - result = _(list).sortedIndexBy(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(value, {a: 42}); - - result = _(list).chain().sortedIndexBy(value, listIterator); - result = _(list).chain().sortedIndexBy(value, ''); - result = _(list).chain().sortedIndexBy(value, {a: 42}); - } -} - -// _.sortedLastIndex -namespace TestSortedLastIndex { - type SampleType = {a: number; b: string; c: boolean;}; - - let array: SampleType[] = []; - let list: _.List = []; - - let value: SampleType = { a: 1, b: "", c: true }; - - let stringIterator: (x: string) => number; - let arrayIterator: (x: SampleType) => number; - let listIterator: (x: SampleType) => number; - - { - let result: number; - - result = _.sortedLastIndex('', ''); - - result = _.sortedLastIndex(array, value); - - result = _.sortedLastIndex(list, value); - - result = _('').sortedLastIndex(''); - - result = _(array).sortedLastIndex(value); - - result = _(list).sortedLastIndex(value); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _('').chain().sortedLastIndex(''); - - result = _(array).chain().sortedLastIndex(value); - - result = _(list).chain().sortedLastIndex(value); - } -} - // _.sortedLastIndexBy -namespace TestSortedLastIndexBy { - type SampleType = {a: number; b: string; c: boolean;}; +{ + const list: _.List | null | undefined = anything; + const value: AbcObject = { a: 1, b: "", c: true }; + const listIterator = (value: AbcObject) => 0; - let array: SampleType[] = []; - let list: _.List = []; + _.sortedIndexBy(list, value, listIterator); // $ExpectType number + _.sortedIndexBy(list, value, ""); // $ExpectType number + _.sortedIndexBy(list, value, { a: 42 }); // $ExpectType number + _(list).sortedIndexBy(value, listIterator); // $ExpectType number + _(list).sortedIndexBy(value, ""); // $ExpectType number + _(list).sortedIndexBy(value, { a: 42 }); // $ExpectType number + _.chain(list).sortedIndexBy(value, listIterator); // $ExpectType LoDashExplicitWrapper + _.chain(list).sortedIndexBy(value, ""); // $ExpectType LoDashExplicitWrapper + _.chain(list).sortedIndexBy(value, { a: 42 }); // $ExpectType LoDashExplicitWrapper + fp.sortedIndexBy(listIterator, value, list); // $ExpectType number + fp.sortedIndexBy(listIterator)(value)(list); // $ExpectType number + fp.sortedIndexBy("a", value, list); // $ExpectType number + fp.sortedIndexBy({ a: 42 }, value, list); // $ExpectType number - let value: SampleType = { a: 1, b: "", c: true }; + _.sortedLastIndexBy(list, value, listIterator); // $ExpectType number + _.sortedLastIndexBy(list, value, ""); // $ExpectType number + _.sortedLastIndexBy(list, value, { a: 42 }); // $ExpectType number + _(list).sortedLastIndexBy(value, listIterator); // $ExpectType number + _(list).sortedLastIndexBy(value, ""); // $ExpectType number + _(list).sortedLastIndexBy(value, { a: 42 }); // $ExpectType number + _.chain(list).sortedLastIndexBy(value, listIterator); // $ExpectType LoDashExplicitWrapper + _.chain(list).sortedLastIndexBy(value, ""); // $ExpectType LoDashExplicitWrapper + _.chain(list).sortedLastIndexBy(value, { a: 42 }); // $ExpectType LoDashExplicitWrapper + fp.sortedLastIndexBy(listIterator, value, list); // $ExpectType number + fp.sortedLastIndexBy(listIterator)(value)(list); // $ExpectType number + fp.sortedLastIndexBy("a", value, list); // $ExpectType number + fp.sortedLastIndexBy({ a: 42 }, value, list); // $ExpectType number +} - let stringIterator = (x: string) => 0; - let arrayIterator = (x: SampleType) => 0; - let listIterator = (x: SampleType) => 0; +// _.sortedIndex +// _.sortedLastIndex +{ + const list: _.List | null | undefined = anything; + const value: AbcObject = { a: 1, b: "", c: true }; - { - let result: number; + _.sortedIndex(list, value); // $ExpectType number + _(list).sortedIndex(value); // $ExpectType number + _.chain(list).sortedIndex(value); // $ExpectType LoDashExplicitWrapper + fp.sortedIndex(value, list); // $ExpectType number + fp.sortedIndex(value)(list); // $ExpectType number - result = _.sortedLastIndexBy('', '', stringIterator); - - result = _.sortedLastIndexBy(array, value, arrayIterator); - result = _.sortedLastIndexBy(array, value, ''); - result = _.sortedLastIndexBy(array, value, {a: 42}); - - result = _.sortedLastIndexBy(list, value, listIterator); - result = _.sortedLastIndexBy(list, value, ''); - result = _.sortedLastIndexBy(list, value, {a: 42}); - - result = _('').sortedLastIndexBy('', stringIterator); - - result = _(array).sortedLastIndexBy(value, arrayIterator); - result = _(array).sortedLastIndexBy(value, ''); - result = _(array).sortedLastIndexBy(value, {a: 42}); - - result = _(list).sortedLastIndexBy(value, listIterator); - result = _(list).sortedLastIndexBy(value, ''); - result = _(list).sortedLastIndexBy(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(value, {a: 42}); - - result = _(list).chain().sortedLastIndexBy(value, listIterator); - result = _(list).chain().sortedLastIndexBy(value, ''); - result = _(list).chain().sortedLastIndexBy(value, {a: 42}); - } + _.sortedLastIndex(list, value); // $ExpectType number + _(list).sortedLastIndex(value); // $ExpectType number + _.chain(list).sortedLastIndex(value); // $ExpectType LoDashExplicitWrapper + fp.sortedLastIndex(value, list); // $ExpectType number + fp.sortedLastIndex(value)(list); // $ExpectType number } // _.take -namespace TestTake { - let array: AbcObject[] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; - - { - let result: AbcObject[]; - - 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 -namespace TestTakeRight { - let array: AbcObject[] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; +{ + const list: _.List | null | undefined = anything; - { - let result: AbcObject[]; + _.take(list); // $ExpectType AbcObject[] + _.take(list, 42); // $ExpectType AbcObject[] + _(list).take(); // $ExpectType LoDashImplicitWrapper + _(list).take(42); // $ExpectType LoDashImplicitWrapper + _.chain(list).take(); // $ExpectType LoDashExplicitWrapper + _.chain(list).take(42); // $ExpectType LoDashExplicitWrapper + fp.take(42, list); // $ExpectType AbcObject[] + fp.take(42)(list); // $ExpectType AbcObject[] - 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 -namespace TestTakeRightWhile { - let array: AbcObject[] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; - let predicateFn = (value: AbcObject, index: number, collection: _.List) => true; - - { - let result: AbcObject[]; - - result = _.takeRightWhile(array); - result = _.takeRightWhile(array, predicateFn); - result = _.takeRightWhile(array, ''); - result = _.takeRightWhile(array, {a: 42}); - - result = _.takeRightWhile(list); - result = _.takeRightWhile(list, predicateFn); - result = _.takeRightWhile(list, ''); - result = _.takeRightWhile(list, {a: 42}); - } - - { - let result: _.LoDashImplicitArrayWrapper; - - result = _(array).takeRightWhile(); - result = _(array).takeRightWhile(predicateFn); - result = _(array).takeRightWhile(''); - result = _(array).takeRightWhile({a: 42}); - - result = _(list).takeRightWhile(); - result = _(list).takeRightWhile(predicateFn); - result = _(list).takeRightWhile(''); - result = _(list).takeRightWhile({a: 42}); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _(array).chain().takeRightWhile(); - result = _(array).chain().takeRightWhile(predicateFn); - result = _(array).chain().takeRightWhile(''); - result = _(array).chain().takeRightWhile({a: 42}); - - result = _(list).chain().takeRightWhile(); - result = _(list).chain().takeRightWhile(predicateFn); - result = _(list).chain().takeRightWhile(''); - result = _(list).chain().takeRightWhile({a: 42}); - } + _.takeRight(list); // $ExpectType AbcObject[] + _.takeRight(list, 42); // $ExpectType AbcObject[] + _(list).takeRight(); // $ExpectType LoDashImplicitWrapper + _(list).takeRight(42); // $ExpectType LoDashImplicitWrapper + _.chain(list).takeRight(); // $ExpectType LoDashExplicitWrapper + _.chain(list).takeRight(42); // $ExpectType LoDashExplicitWrapper + fp.takeRight(42, list); // $ExpectType AbcObject[] + fp.takeRight(42)(list); // $ExpectType AbcObject[] } // _.takeWhile -namespace TestTakeWhile { - let array: AbcObject[] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; - let predicateFn = (value: AbcObject, index: number, collection: _.List) => true; +// _.takeRightWhile +{ + const list: _.List | null | undefined = anything; + const predicateFn = (value: AbcObject, index: number, collection: _.List) => true; + const predicateFn2 = (value: AbcObject) => true; - { - let result: AbcObject[]; + _.takeWhile(list); // $ExpectType AbcObject[] + _.takeWhile(list, predicateFn); // $ExpectType AbcObject[] + _.takeWhile(list, ""); // $ExpectType AbcObject[] + _.takeWhile(list, { a: 42 }); // $ExpectType AbcObject[] - result = _.takeWhile(array); - result = _.takeWhile(array, predicateFn); - result = _.takeWhile(array, ''); - result = _.takeWhile(array, {a: 42}); + _(list).takeWhile(); // $ExpectType LoDashImplicitWrapper + _(list).takeWhile(predicateFn); // $ExpectType LoDashImplicitWrapper + _(list).takeWhile(""); // $ExpectType LoDashImplicitWrapper + _(list).takeWhile({ a: 42 }); // $ExpectType LoDashImplicitWrapper - result = _.takeWhile(list); - result = _.takeWhile(list, predicateFn); - result = _.takeWhile(list, ''); - result = _.takeWhile(list, {a: 42}); - } + _.chain(list).takeWhile(); // $ExpectType LoDashExplicitWrapper + _.chain(list).takeWhile(predicateFn); // $ExpectType LoDashExplicitWrapper + _.chain(list).takeWhile(""); // $ExpectType LoDashExplicitWrapper + _.chain(list).takeWhile({ a: 42 }); // $ExpectType LoDashExplicitWrapper - { - let result: _.LoDashImplicitArrayWrapper; + fp.takeWhile(predicateFn2, list); // $ExpectType AbcObject[] + fp.takeWhile(predicateFn2)(list); // $ExpectType AbcObject[] + fp.takeWhile("a", list); // $ExpectType AbcObject[] + fp.takeWhile({ a: 42 }, list); // $ExpectType AbcObject[] - result = _(array).takeWhile(); - result = _(array).takeWhile(predicateFn); - result = _(array).takeWhile(''); - result = _(array).takeWhile({a: 42}); + _.takeRightWhile(list); // $ExpectType AbcObject[] + _.takeRightWhile(list, predicateFn); // $ExpectType AbcObject[] + _.takeRightWhile(list, ""); // $ExpectType AbcObject[] + _.takeRightWhile(list, { a: 42 }); // $ExpectType AbcObject[] - result = _(list).takeWhile(); - result = _(list).takeWhile(predicateFn); - result = _(list).takeWhile(''); - result = _(list).takeWhile({a: 42}); - } + _(list).takeRightWhile(); // $ExpectType LoDashImplicitWrapper + _(list).takeRightWhile(predicateFn); // $ExpectType LoDashImplicitWrapper + _(list).takeRightWhile(""); // $ExpectType LoDashImplicitWrapper + _(list).takeRightWhile({ a: 42 }); // $ExpectType LoDashImplicitWrapper - { - let result: _.LoDashExplicitArrayWrapper; + _.chain(list).takeRightWhile(); // $ExpectType LoDashExplicitWrapper + _.chain(list).takeRightWhile(predicateFn); // $ExpectType LoDashExplicitWrapper + _.chain(list).takeRightWhile(""); // $ExpectType LoDashExplicitWrapper + _.chain(list).takeRightWhile({ a: 42 }); // $ExpectType LoDashExplicitWrapper - result = _(array).chain().takeWhile(); - result = _(array).chain().takeWhile(predicateFn); - result = _(array).chain().takeWhile(''); - result = _(array).chain().takeWhile({a: 42}); - - result = _(list).chain().takeWhile(); - result = _(list).chain().takeWhile(predicateFn); - result = _(list).chain().takeWhile(''); - result = _(list).chain().takeWhile({a: 42}); - } + fp.takeRightWhile(predicateFn2, list); // $ExpectType AbcObject[] + fp.takeRightWhile(predicateFn2)(list); // $ExpectType AbcObject[] + fp.takeRightWhile("a", list); // $ExpectType AbcObject[] + fp.takeRightWhile({ a: 42 }, list); // $ExpectType AbcObject[] } // _.union -namespace TestUnion { - let array: AbcObject[] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; +{ + const list: _.List | null | undefined = anything; - { - let result: AbcObject[]; + _.union(list); // $ExpectType AbcObject[] + _.union(list, list); // $ExpectType AbcObject[] + _.union(list, list, list); // $ExpectType AbcObject[] - // $ExpectType {}[] - _.union(); + _(list).union(); // $ExpectType LoDashImplicitWrapper + _(list).union(list); // $ExpectType LoDashImplicitWrapper + _(list).union(list, list); // $ExpectType LoDashImplicitWrapper - result = _.union(array); - result = _.union(array, list); - result = _.union(array, list, array); + _.chain(list).union(); // $ExpectType LoDashExplicitWrapper + _.chain(list).union(list); // $ExpectType LoDashExplicitWrapper + _.chain(list).union(list, list); // $ExpectType LoDashExplicitWrapper - 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); - } + fp.union(list, list); // $ExpectType AbcObject[] + fp.union(list)(list); // $ExpectType AbcObject[] } // _.unionBy -namespace TestUnionBy { - let array: AbcObject[] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; - let iteratee: (value: AbcObject) => any = (value: AbcObject) => 1; +{ + const list: _.List | null | undefined = anything; + const iteratee = (value: AbcObject) => 1; - { - let result: AbcObject[]; + _.unionBy(list, list); // $ExpectType AbcObject[] + _.unionBy(list, list, list, list, list, list); // $ExpectType AbcObject[] + _.unionBy(list, list, iteratee); // $ExpectType AbcObject[] + _.unionBy(list, list, list, list, list, list, iteratee); // $ExpectType AbcObject[] + _.unionBy(list, list, "a"); // $ExpectType AbcObject[] + // param needed for TS 2.3 + _.unionBy(list, list, list, list, list, list, "a"); // $ExpectType AbcObject[] + _.unionBy(list, list, {a: 1}); // $ExpectType AbcObject[] + _.unionBy(list, list, list, list, list, list, {a: 1}); // $ExpectType AbcObject[] - result = _.unionBy(array, array); - result = _.unionBy(array, list, array); - result = _.unionBy(array, array, list, array); - result = _.unionBy(array, list, array, list, array); - result = _.unionBy(array, array, list, array, list, array); + _(list).unionBy(list); // $ExpectType LoDashImplicitWrapper + _(list).unionBy(list, list, list, list, list); // $ExpectType LoDashImplicitWrapper + _(list).unionBy(list, iteratee); // $ExpectType LoDashImplicitWrapper + _(list).unionBy(list, list, list, list, list, iteratee); // $ExpectType LoDashImplicitWrapper + _(list).unionBy(list, "a"); // $ExpectType LoDashImplicitWrapper + // param needed for TS 2.3 + _(list).unionBy(list, list, list, list, list, "a"); // $ExpectType LoDashImplicitWrapper + _(list).unionBy(list, {a: 1}); // $ExpectType LoDashImplicitWrapper + _(list).unionBy(list, list, list, list, list, {a: 1}); // $ExpectType LoDashImplicitWrapper - result = _.unionBy(array, array, iteratee); - result = _.unionBy(array, list, array, iteratee); - result = _.unionBy(array, array, list, array, iteratee); - result = _.unionBy(array, list, array, list, array, iteratee); - result = _.unionBy(array, array, list, array, list, array, iteratee); + _.chain(list).unionBy(list); // $ExpectType LoDashExplicitWrapper + _.chain(list).unionBy(list, list, list, list, list); // $ExpectType LoDashExplicitWrapper + _.chain(list).unionBy(list, iteratee); // $ExpectType LoDashExplicitWrapper + _.chain(list).unionBy(list, list, list, list, list, iteratee); // $ExpectType LoDashExplicitWrapper + _.chain(list).unionBy(list, "a"); // $ExpectType LoDashExplicitWrapper + // param needed for TS 2.3 + _.chain(list).unionBy(list, list, list, list, list, "a"); // $ExpectType LoDashExplicitWrapper + _.chain(list).unionBy(list, {a: 1}); // $ExpectType LoDashExplicitWrapper + _.chain(list).unionBy(list, list, list, list, list, {a: 1}); // $ExpectType LoDashExplicitWrapper - result = _.unionBy(array, array, 'a'); - result = _.unionBy(array, list, array, 'a'); - // param needed for TS 2.3 - result = _.unionBy(array, array, list, array, 'a'); - result = _.unionBy(array, list, array, list, array, 'a'); - result = _.unionBy(array, array, list, array, list, array, 'a'); - - result = _.unionBy(array, array, {a: 1}); - result = _.unionBy(array, list, array, {a: 1}); - result = _.unionBy(array, array, list, array, {a: 1}); - result = _.unionBy(array, list, array, list, array, {a: 1}); - result = _.unionBy(array, list, array, list, array, list, {a: 1}); - - result = _.unionBy(list, list); - result = _.unionBy(list, array, list); - result = _.unionBy(list, list, array, list); - result = _.unionBy(list, array, list, array, list); - result = _.unionBy(list, list, array, list, array, list); - - result = _.unionBy(list, list, iteratee); - result = _.unionBy(list, array, list, iteratee); - result = _.unionBy(list, list, array, list, iteratee); - result = _.unionBy(list, array, list, array, list, iteratee); - result = _.unionBy(list, list, array, list, array, list, iteratee); - - result = _.unionBy(list, list, 'a'); - result = _.unionBy(list, array, list, 'a'); - // param needed for TS 2.3 - result = _.unionBy(list, list, array, list, 'a'); - result = _.unionBy(list, array, list, array, list, 'a'); - result = _.unionBy(list, list, array, list, array, list, 'a'); - - result = _.unionBy(list, list, {a: 1}); - result = _.unionBy(list, array, list, {a: 1}); - result = _.unionBy(list, list, array, list, {a: 1}); - result = _.unionBy(list, array, list, array, list, {a: 1}); - result = _.unionBy(list, array, list, array, list, array, {a: 1}); - } - - { - let result: _.LoDashImplicitArrayWrapper; - - result = _(array).unionBy(array); - result = _(array).unionBy(list, array); - result = _(array).unionBy(array, list, array); - result = _(array).unionBy(list, array, list, array); - result = _(array).unionBy(array, list, array, list, array); - - result = _(array).unionBy(array, iteratee); - result = _(array).unionBy(list, array, iteratee); - result = _(array).unionBy(array, list, array, iteratee); - result = _(array).unionBy(list, array, list, array, iteratee); - result = _(array).unionBy(array, list, array, list, array, iteratee); - - result = _(array).unionBy(array, 'a'); - result = _(array).unionBy(list, array, 'a'); - // param needed for TS 2.3 - result = _(array).unionBy(array, list, array, 'a'); - result = _(array).unionBy(list, array, list, array, 'a'); - result = _(array).unionBy(array, list, array, list, array, 'a'); - - result = _(array).unionBy(array, {a: 1}); - result = _(array).unionBy(list, array, {a: 1}); - result = _(array).unionBy(array, list, array, {a: 1}); - result = _(array).unionBy(list, array, list, array, {a: 1}); - result = _(array).unionBy(list, array, list, array, list, {a: 1}); - - result = _(list).unionBy(list); - result = _(list).unionBy(array, list); - result = _(list).unionBy(list, array, list); - result = _(list).unionBy(array, list, array, list); - result = _(list).unionBy(list, array, list, array, list); - - result = _(list).unionBy(list, iteratee); - result = _(list).unionBy(array, list, iteratee); - result = _(list).unionBy(list, array, list, iteratee); - result = _(list).unionBy(array, list, array, list, iteratee); - result = _(list).unionBy(list, array, list, array, list, iteratee); - - result = _(list).unionBy(list, 'a'); - result = _(list).unionBy(array, list, 'a'); - // param needed for TS 2.3 - result = _(list).unionBy(list, array, list, 'a'); - result = _(list).unionBy(array, list, array, list, 'a'); - result = _(list).unionBy(list, array, list, array, list, 'a'); - - result = _(list).unionBy(list, {a: 1}); - result = _(list).unionBy(array, list, {a: 1}); - result = _(list).unionBy(list, array, list, {a: 1}); - result = _(list).unionBy(array, list, array, list, {a: 1}); - result = _(list).unionBy(array, list, array, list, array, {a: 1}); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _(array).chain().unionBy(array); - result = _(array).chain().unionBy(list, array); - result = _(array).chain().unionBy(array, list, array); - result = _(array).chain().unionBy(list, array, list, array); - result = _(array).chain().unionBy(array, list, array, list, array); - - result = _(array).chain().unionBy(array, iteratee); - result = _(array).chain().unionBy(list, array, iteratee); - result = _(array).chain().unionBy(array, list, array, iteratee); - result = _(array).chain().unionBy(list, array, list, array, iteratee); - result = _(array).chain().unionBy(array, list, array, list, array, iteratee); - - result = _(array).chain().unionBy(array, 'a'); - result = _(array).chain().unionBy(list, array, 'a'); - result = _(array).chain().unionBy(array, list, array, 'a'); - // param needed for TS 2.3 - result = _(array).chain().unionBy(list, array, list, array, 'a'); - result = _(array).chain().unionBy(array, list, array, list, array, 'a'); - - result = _(array).chain().unionBy(array, {a: 1}); - result = _(array).chain().unionBy(list, array, {a: 1}); - result = _(array).chain().unionBy(array, list, array, {a: 1}); - result = _(array).chain().unionBy(list, array, list, array, {a: 1}); - result = _(array).chain().unionBy(list, array, list, array, list, {a: 1}); - - result = _(list).chain().unionBy(list); - result = _(list).chain().unionBy(array, list); - result = _(list).chain().unionBy(list, array, list); - result = _(list).chain().unionBy(array, list, array, list); - result = _(list).chain().unionBy(list, array, list, array, list); - - result = _(list).chain().unionBy(list, iteratee); - result = _(list).chain().unionBy(array, list, iteratee); - result = _(list).chain().unionBy(list, array, list, iteratee); - result = _(list).chain().unionBy(array, list, array, list, iteratee); - result = _(list).chain().unionBy(list, array, list, array, list, iteratee); - - result = _(list).chain().unionBy(list, 'a'); - result = _(list).chain().unionBy(array, list, 'a'); - result = _(list).chain().unionBy(list, array, list, 'a'); - // param needed for TS 2.3 - result = _(list).chain().unionBy(array, list, array, list, 'a'); - result = _(list).chain().unionBy(list, array, list, array, list, 'a'); - - result = _(list).chain().unionBy(list, {a: 1}); - result = _(list).chain().unionBy(array, list, {a: 1}); - result = _(list).chain().unionBy(list, array, list, {a: 1}); - result = _(list).chain().unionBy(array, list, array, list, {a: 1}); - result = _(list).chain().unionBy(array, list, array, list, array, {a: 1}); - } + fp.unionBy(iteratee, list, list); // $ExpectType AbcObject[] + fp.unionBy(iteratee)(list)(list); // $ExpectType AbcObject[] + fp.unionBy("a", list, list); // $ExpectType AbcObject[] + fp.unionBy({ a: 1 }, list, list); // $ExpectType AbcObject[] } // _.uniq -namespace TestUniq { - type SampleObject = {a: number; b: string; c: boolean}; +// _.sortedUniq +{ + const list: _.List | null | undefined = anything; - let array: SampleObject[] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; + _.uniq("abc"); // $ExpectType string[] + _.uniq(list); // $ExpectType AbcObject[] + _(list).uniq(); // $ExpectType LoDashImplicitWrapper + _.chain(list).uniq(); // $ExpectType LoDashExplicitWrapper + fp.uniq("abc"); // $ExpectType string[] + fp.uniq(list); // $ExpectType AbcObject[] - { - let result: string[]; - result = _.uniq('abc'); - } - - { - let result: SampleObject[]; - - result = _.uniq(array); - result = _.uniq(list); - } - - { - let result: _.LoDashImplicitArrayWrapper; - result = _('abc').uniq(); - } - - { - let result: _.LoDashImplicitArrayWrapper; - - result = _(array).uniq(); - result = _(list).uniq(); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _('abc').chain().uniq(); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _(array).chain().uniq(); - result = _(list).chain().uniq(); - } + _.sortedUniq("abc"); // $ExpectType string[] + _.sortedUniq(list); // $ExpectType AbcObject[] + _(list).sortedUniq(); // $ExpectType LoDashImplicitWrapper + _.chain(list).sortedUniq(); // $ExpectType LoDashExplicitWrapper + fp.sortedUniq("abc"); // $ExpectType string[] + fp.sortedUniq(list); // $ExpectType AbcObject[] } // _.uniqBy -namespace TestUniqBy { - type SampleObject = {a: number; b: string; c: boolean}; - - let array: SampleObject[] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; - - let stringIterator = (value: string, index: number, collection: string) => ""; - let listIterator = (value: SampleObject, index: number, collection: _.List) => 0; - - { - let result: string[]; - - result = _.uniqBy('abc', stringIterator); - } - - { - let result: SampleObject[]; - - result = _.uniqBy(array, listIterator); - result = _.uniqBy(array, 'a'); - result = _.uniqBy(array, {a: 42}); - - result = _.uniqBy(list, listIterator); - result = _.uniqBy(list, 'a'); - result = _.uniqBy(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: 42}); - - result = _(list).uniqBy(listIterator); - result = _(list).uniqBy('a'); - result = _(list).uniqBy({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: 42}); - - result = _(list).chain().uniqBy(listIterator); - result = _(list).chain().uniqBy('a'); - result = _(list).chain().uniqBy({a: 42}); - } -} - -// _.sortedUniq -namespace TestSortedUniq { - type SampleObject = {a: number; b: string; c: boolean}; - - let array: SampleObject[] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; - - { - 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 -namespace TestSortedUniqBy { - type SampleObject = {a: number; b: string; c: boolean}; +{ + const list: _.List | null | undefined = anything; + const stringIterator = (value: string, index: number, collection: string) => ""; + const listIterator = (value: AbcObject, index: number, collection: _.List) => 0; + const stringIterator2 = (value: string) => ""; + const listIterator2 = (value: AbcObject) => 0; - let array: SampleObject[] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; + _.uniqBy("abc", stringIterator); // $ExpectType string[] + _.uniqBy(list, listIterator); // $ExpectType AbcObject[] + _.uniqBy(list, "a"); // $ExpectType AbcObject[] + _(list).uniqBy(listIterator); // $ExpectType LoDashImplicitWrapper + _(list).uniqBy("a"); // $ExpectType LoDashImplicitWrapper + _.chain(list).uniqBy(listIterator); // $ExpectType LoDashExplicitWrapper + _.chain(list).uniqBy("a"); // $ExpectType LoDashExplicitWrapper - let stringIterator = (value: string, index: number, collection: string) => ""; - let listIterator = (value: SampleObject, index: number, collection: _.List) => 0; + fp.uniqBy(stringIterator2, "abc"); // $ExpectType string[] + fp.uniqBy(listIterator2, list); // $ExpectType AbcObject[] + fp.uniqBy(listIterator2)(list); // $ExpectType AbcObject[] + fp.uniqBy("a", list); // $ExpectType AbcObject[] - { - let result: string[]; + _.sortedUniqBy("abc", stringIterator); // $ExpectType string[] + _.sortedUniqBy(list, listIterator); // $ExpectType AbcObject[] + _.sortedUniqBy(list, "a"); // $ExpectType AbcObject[] + _(list).sortedUniqBy(listIterator); // $ExpectType LoDashImplicitWrapper + _(list).sortedUniqBy("a"); // $ExpectType LoDashImplicitWrapper + _.chain(list).sortedUniqBy(listIterator); // $ExpectType LoDashExplicitWrapper + _.chain(list).sortedUniqBy("a"); // $ExpectType LoDashExplicitWrapper - result = _.sortedUniqBy('abc', stringIterator); - } - - { - let result: SampleObject[]; - - result = _.sortedUniqBy(array, listIterator); - result = _.sortedUniqBy(array, 'a'); - result = _.sortedUniqBy(array, {a: 42}); - - result = _.sortedUniqBy(list, listIterator); - result = _.sortedUniqBy(list, 'a'); - result = _.sortedUniqBy(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: 42}); - - result = _(list).sortedUniqBy(listIterator); - result = _(list).sortedUniqBy('a'); - result = _(list).sortedUniqBy({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: 42}); - - result = _(list).chain().sortedUniqBy(listIterator); - result = _(list).chain().sortedUniqBy('a'); - result = _(list).chain().sortedUniqBy({a: 42}); - } + fp.sortedUniqBy(stringIterator2, "abc"); // $ExpectType string[] + fp.sortedUniqBy(listIterator2, list); // $ExpectType AbcObject[] + fp.sortedUniqBy(listIterator2)(list); // $ExpectType AbcObject[] + fp.sortedUniqBy("a", list); // $ExpectType AbcObject[] } // _.unzip -namespace TestUnzip { - let array = [['a', 'b'], [1, 2], [true, false]]; +{ + const list: _.List<_.List> | null | undefined = anything; - 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 nilArray: AbcObject[][] | null | undefined = [] as any; - let nilList: _.List<_.List> | null | undefined = [] as any; - - { - let result: AbcObject[][]; - - result = _.unzip(nilArray); - result = _.unzip(nilList); - } - - { - let result: Array>; - - result = _.unzip(array); - result = _.unzip(list); - } - - { - let result: _.LoDashImplicitArrayWrapper>; - - result = _(array).unzip(); - result = _(list).unzip(); - } - - { - let result: _.LoDashExplicitArrayWrapper>; - - result = _(array).chain().unzip(); - result = _(list).chain().unzip(); - } + _.unzip(list); // $ExpectType AbcObject[][] + _(list).unzip(); // $ExpectType LoDashImplicitWrapper + _.chain(list).unzip(); // $ExpectType LoDashExplicitWrapper + fp.unzip(list); // $ExpectType AbcObject[][] } // _.unzipWith { - let testUnzipWithArray: Array> | null | undefined = [] as any; - let testUnzipWithList: _.List> | null | undefined = [] as any; + const list: _.List<_.List> | null | undefined = anything; - { - _.unzipWith(testUnzipWithArray); // $ExpectType number[][] - _.unzipWith(testUnzipWithList); // $ExpectType number[][] - _(testUnzipWithArray).unzipWith(); // $ExpectType LoDashImplicitWrapper - _(testUnzipWithList).unzipWith(); // $ExpectType LoDashImplicitWrapper - _.chain(testUnzipWithArray).unzipWith(); // $ExpectType LoDashExplicitWrapper - _.chain(testUnzipWithList).unzipWith(); // $ExpectType LoDashExplicitWrapper - } + _.unzipWith(list); // $ExpectType AbcObject[][] + // $ExpectType number[] + _.unzipWith(list, (...group) => { + group; // $ExpectType AbcObject[] + return 1; + }); + // $ExpectType boolean[] + _.unzipWith(list, (value1, value2, value3) => { + value1; // $ExpectType AbcObject + value2; // $ExpectType AbcObject + value3; // $ExpectType AbcObject + return true; + }); + _(list).unzipWith(); // $ExpectType LoDashImplicitWrapper + // $ExpectType LoDashImplicitWrapper + _(list).unzipWith((...group) => { + group; // $ExpectType AbcObject[] + return 1; + }); + _.chain(list).unzipWith(); // $ExpectType LoDashExplicitWrapper + // $ExpectType LoDashExplicitWrapper + _.chain(list).unzipWith((...group) => { + group; // $ExpectType AbcObject[] + return 1; + }); - { - let result: AbcObject[]; - result = _.unzipWith(testUnzipWithArray, (...group) => { - group; // $ExpectType number[] - return anything as AbcObject; - }); - result = _.unzipWith(testUnzipWithArray, (value1, value2, value3) => { - value1; // $ExpectType number - value2; // $ExpectType number - value3; // $ExpectType number - return anything as AbcObject; - }); - result = _.unzipWith(testUnzipWithList, (...group) => { - group; // $ExpectType number[] - return anything as AbcObject; - }); - result = _.unzipWith(testUnzipWithList, (value1, value2, value3) => { - value1; // $ExpectType number - value2; // $ExpectType number - value3; // $ExpectType number - return anything as AbcObject; - }); - - result = _(testUnzipWithArray).unzipWith((...group): AbcObject => { - group; // $ExpectType number[] - return anything as AbcObject; - }).value(); - result = _(testUnzipWithArray).unzipWith((value1, value2, value3) => { - value1; // $ExpectType number - value2; // $ExpectType number - value3; // $ExpectType number - return anything as AbcObject; - }).value(); - result = _(testUnzipWithList).unzipWith((...group): AbcObject => { - group; // $ExpectType number[] - return anything as AbcObject; - }).value(); - result = _(testUnzipWithList).unzipWith((value1, value2, value3) => { - value1; // $ExpectType number - value2; // $ExpectType number - value3; // $ExpectType number - return anything as AbcObject; - }).value(); - } + fp.unzipWith((...group: AbcObject[]) => 1, list); // $ExpectType number[] + fp.unzipWith((...group: AbcObject[]) => 1)(list); // $ExpectType number[] } // _.without -namespace TestWithout { - let array: number[] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; +{ + const list: _.List | null | undefined = anything; - { - let result: number[]; + _.without(list); // $ExpectType number[] + _.without(list, 1); // $ExpectType number[] + _.without(list, 1, 2, 3); // $ExpectType number[] - result = _.without(array); - result = _.without(array, 1); - result = _.without(array, 1, 2); - result = _.without(array, 1, 2, 3); + _(list).without(); // $ExpectType LoDashImplicitWrapper + _(list).without(1); // $ExpectType LoDashImplicitWrapper + _(list).without(1, 2, 3); // $ExpectType LoDashImplicitWrapper - result = _.without(list); - result = _.without(list, 1); - result = _.without(list, 1, 2); - result = _.without(list, 1, 2, 3); - } + _.chain(list).without(); // $ExpectType LoDashExplicitWrapper + _.chain(list).without(1); // $ExpectType LoDashExplicitWrapper + _.chain(list).without(1, 2, 3); // $ExpectType LoDashExplicitWrapper - { - 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); - } + fp.without([1, 2], list); + fp.without([1, 2])(list); } // _.xor -namespace TestXor { - let array: AbcObject[] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; +{ + const list: _.List | null | undefined = anything; - { - let result: AbcObject[]; + _.xor(list); // $ExpectType AbcObject[] + _.xor(list, list); // $ExpectType AbcObject[] + _.xor(list, list, list); // $ExpectType AbcObject[] - // $ExpectType {}[] - _.xor(); + _(list).xor(); // $ExpectType LoDashImplicitWrapper + _(list).xor(list); // $ExpectType LoDashImplicitWrapper + _(list).xor(list, list); // $ExpectType LoDashImplicitWrapper - result = _.xor(array); - result = _.xor(array, list); - result = _.xor(array, list, array); + _.chain(list).xor(); // $ExpectType LoDashExplicitWrapper + _.chain(list).xor(list); // $ExpectType LoDashExplicitWrapper + _.chain(list).xor(list, list); // $ExpectType LoDashExplicitWrapper - result = _.xor(list); - result = _.xor(list, array); - result = _.xor(list, array, list); - } + fp.xor(list, list); // $ExpectType AbcObject[] + fp.xor(list)(list); // $ExpectType AbcObject[] +} - { - let result: _.LoDashImplicitArrayWrapper; +// _.xorBy +{ + const list: _.List | null | undefined = anything; + const iteratee = (value: AbcObject) => 1; - result = _(array).xor(); - result = _(array).xor(list); - result = _(array).xor(list, array); + _.xorBy(list, list); // $ExpectType AbcObject[] + _.xorBy(list, list, list, list, list, list); // $ExpectType AbcObject[] + _.xorBy(list, list, iteratee); // $ExpectType AbcObject[] + _.xorBy(list, list, list, list, list, list, iteratee); // $ExpectType AbcObject[] + _.xorBy(list, list, "a"); // $ExpectType AbcObject[] + // param needed for TS 2.3 + _.xorBy(list, list, list, list, list, list, "a"); // $ExpectType AbcObject[] + _.xorBy(list, list, {a: 1}); // $ExpectType AbcObject[] + _.xorBy(list, list, list, list, list, list, {a: 1}); // $ExpectType AbcObject[] - result = _(list).xor(); - result = _(list).xor(array); - result = _(list).xor(array, list); - } + _(list).xorBy(list); // $ExpectType LoDashImplicitWrapper + _(list).xorBy(list, list, list, list, list); // $ExpectType LoDashImplicitWrapper + _(list).xorBy(list, iteratee); // $ExpectType LoDashImplicitWrapper + _(list).xorBy(list, list, list, list, list, iteratee); // $ExpectType LoDashImplicitWrapper + _(list).xorBy(list, "a"); // $ExpectType LoDashImplicitWrapper + // param needed for TS 2.3 + _(list).xorBy(list, list, list, list, list, "a"); // $ExpectType LoDashImplicitWrapper + _(list).xorBy(list, {a: 1}); // $ExpectType LoDashImplicitWrapper + _(list).xorBy(list, list, list, list, list, {a: 1}); // $ExpectType LoDashImplicitWrapper - { - let result: _.LoDashExplicitArrayWrapper; + _.chain(list).xorBy(list); // $ExpectType LoDashExplicitWrapper + _.chain(list).xorBy(list, list, list, list, list); // $ExpectType LoDashExplicitWrapper + _.chain(list).xorBy(list, iteratee); // $ExpectType LoDashExplicitWrapper + _.chain(list).xorBy(list, list, list, list, list, iteratee); // $ExpectType LoDashExplicitWrapper + _.chain(list).xorBy(list, "a"); // $ExpectType LoDashExplicitWrapper + // param needed for TS 2.3 + _.chain(list).xorBy(list, list, list, list, list, "a"); // $ExpectType LoDashExplicitWrapper + _.chain(list).xorBy(list, {a: 1}); // $ExpectType LoDashExplicitWrapper + _.chain(list).xorBy(list, list, list, list, list, {a: 1}); // $ExpectType LoDashExplicitWrapper - 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); - } + fp.xorBy(iteratee, list, list); // $ExpectType AbcObject[] + fp.xorBy(iteratee)(list)(list); // $ExpectType AbcObject[] + fp.xorBy("a", list, list); // $ExpectType AbcObject[] + fp.xorBy({ a: 1 }, list, list); // $ExpectType AbcObject[] } // _.zip { - let array: AbcObject[] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; + const list: _.List | null | undefined = anything; - { - // $ExpectType (AbcObject | undefined)[][] - _.zip(array); - // $ExpectType (AbcObject | undefined)[][] - _.zip(array, list); - // $ExpectType (AbcObject | undefined)[][] - _.zip(array, list, array); + _.zip(list); // $ExpectType (AbcObject | undefined)[][] + _.zip(list, list); // $ExpectType (AbcObject | undefined)[][] + _.zip(list, list, list, list, list, list); // $ExpectType (AbcObject | undefined)[][] + _.zip([1, 2], [3, 4]); // $ExpectType [number | undefined, number | undefined][] + _.zip([1, 2], ["a", "b"]); // $ExpectType [number | undefined, string | undefined][] + _.zip([1, 2], ["a", "b"], [true, false]); // $ExpectType [number | undefined, string | undefined, boolean | undefined][] - // $ExpectType (AbcObject | undefined)[][] - _.zip(list); - // $ExpectType (AbcObject | undefined)[][] - _.zip(list, array); - // $ExpectType (AbcObject | undefined)[][] - _.zip(list, array, list); + _(list).zip(list); // $ExpectType LoDashImplicitWrapper<(AbcObject | undefined)[][]> + _(list).zip(list, list, list, list, list); // $ExpectType LoDashImplicitWrapper<(AbcObject | undefined)[][]> - // $ExpectType (AbcObject | undefined)[][] - _.zip(list, array, list, array, list, array); - } + _.chain(list).zip(list); // $ExpectType LoDashExplicitWrapper<(AbcObject | undefined)[][]> + _.chain(list).zip(list, list, list, list, list); // $ExpectType LoDashExplicitWrapper<(AbcObject | undefined)[][]> - { - // $ExpectType LoDashImplicitWrapper<(AbcObject | undefined)[][]> - _(array).zip(list); - // $ExpectType LoDashImplicitWrapper<(AbcObject | undefined)[][]> - _(array).zip(list, array); - - // $ExpectType LoDashImplicitWrapper<(AbcObject | undefined)[][]> - _(list).zip(array); - // $ExpectType LoDashImplicitWrapper<(AbcObject | undefined)[][]> - _(list).zip(array, list); - } - - { - // $ExpectType LoDashExplicitWrapper<(AbcObject | undefined)[][]> - _(array).chain().zip(list); - // $ExpectType LoDashExplicitWrapper<(AbcObject | undefined)[][]> - _(array).chain().zip(list, array); - - // $ExpectType LoDashExplicitWrapper<(AbcObject | undefined)[][]> - _(list).chain().zip(array); - // $ExpectType LoDashExplicitWrapper<(AbcObject | undefined)[][]> - _(list).chain().zip(array, list); - } - - { - _.zip([1, 2], [3, 4]); // $ExpectType [number | undefined, number | undefined][] - _.zip([1, 2], ["a", "b"]); // $ExpectType [number | undefined, string | undefined][] - _.zip([1, 2], ["a", "b"], [true, false]); // $ExpectType [number | undefined, string | undefined, boolean | undefined][] - } + const list2: _.List = anything; + fp.zip(list2, list2); // $ExpectType [AbcObject | undefined, AbcObject | undefined][] + fp.zip(list2)(list2); // $ExpectType [AbcObject | undefined, AbcObject | undefined][] + fp.zip(["a", "b"], [1, 2]); // $ExpectType [string | undefined, number | undefined][] + fp.zipAll([list2, list2, list2]); // $ExpectType (AbcObject | undefined)[][] + fp.zipAll([[1, 2], ["a", "b"], [true, false]]); // $ExpectType (string | number | boolean | undefined)[][] } // _.zipObject -namespace TestZipObject { - const zipObjectResult = _.zipObject(['a', 'b'], [1, 2]); - const zipObjectDeepResult = _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]); +// _.zipObjectDeep +{ + const listOfKeys: _.List = anything; + const listOfValues: _.List = anything; - let arrayOfKeys: string[] = []; - let arrayOfValues: number[] = []; + _.zipObject(["a", "b"], [1, 2]); // $ExpectType Dictionary + _.zipObject(listOfKeys, listOfValues); // $ExpectType Dictionary + _(listOfKeys).zipObject(listOfValues); // $ExpectType LoDashImplicitWrapper> + _.chain(listOfKeys).zipObject(listOfValues); // $ExpectType LoDashExplicitWrapper> + fp.zipObject(["a", "b"], [1, 2]); // $ExpectType Dictionary + fp.zipObject(listOfKeys)(listOfValues); // $ExpectType Dictionary - let listOfKeys: _.List = []; - let listOfValues: _.List = []; - - { - let result: _.Dictionary; - - result = _.zipObject(arrayOfKeys); - result = _.zipObject(listOfKeys); - } - - { - let result: _.Dictionary; - - result = _.zipObject(arrayOfKeys, arrayOfValues); - result = _.zipObject(arrayOfKeys, listOfValues); - result = _.zipObject(listOfKeys, listOfValues); - result = _.zipObject(listOfKeys, arrayOfValues); - - result = _.zipObject(arrayOfKeys, arrayOfValues); - result = _.zipObject(arrayOfKeys, listOfValues); - result = _.zipObject(listOfKeys, listOfValues); - result = _.zipObject(listOfKeys, arrayOfValues); - } - - { - let result: _.Dictionary; - - result = _.zipObject(arrayOfKeys); - result = _.zipObjectDeep(arrayOfKeys); - result = _.zipObject(arrayOfKeys, arrayOfValues); - result = _.zipObjectDeep(arrayOfKeys, arrayOfValues); - result = _.zipObject(arrayOfKeys, listOfValues); - result = _.zipObjectDeep(arrayOfKeys, listOfValues); - - result = _.zipObject(listOfKeys); - result = _.zipObjectDeep(listOfKeys); - result = _.zipObject(listOfKeys, listOfValues); - result = _.zipObjectDeep(listOfKeys, listOfValues); - result = _.zipObject(listOfKeys, arrayOfValues); - result = _.zipObjectDeep(listOfKeys, arrayOfValues); - } - - { - let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; - - result = _(arrayOfKeys).zipObject(); - result = _(listOfKeys).zipObject(); - } - - { - let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; - - result = _(arrayOfKeys).zipObject(arrayOfValues); - result = _(arrayOfKeys).zipObject(listOfValues); - result = _(listOfKeys).zipObject(listOfValues); - result = _(listOfKeys).zipObject(arrayOfValues); - - result = _(arrayOfKeys).zipObject(arrayOfValues); - result = _(arrayOfKeys).zipObject(listOfValues); - result = _(listOfKeys).zipObject(listOfValues); - result = _(listOfKeys).zipObject(arrayOfValues); - } - - { - let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; - - result = _(arrayOfKeys).zipObject(); - result = _(arrayOfKeys).zipObjectDeep(); - result = _(arrayOfKeys).zipObject(arrayOfValues); - result = _(arrayOfKeys).zipObjectDeep(arrayOfValues); - result = _(arrayOfKeys).zipObject(listOfValues); - result = _(arrayOfKeys).zipObjectDeep(listOfValues); - - result = _(listOfKeys).zipObject(); - result = _(listOfKeys).zipObjectDeep(); - result = _(listOfKeys).zipObject(listOfValues); - result = _(listOfKeys).zipObjectDeep(listOfValues); - result = _(listOfKeys).zipObject(arrayOfValues); - result = _(listOfKeys).zipObjectDeep(arrayOfValues); - } - - { - let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; - - result = _(arrayOfKeys).chain().zipObject(); - result = _(listOfKeys).chain().zipObject(); - } - - { - let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; - - result = _(arrayOfKeys).chain().zipObject(arrayOfValues); - result = _(arrayOfKeys).chain().zipObject(listOfValues); - result = _(listOfKeys).chain().zipObject(listOfValues); - result = _(listOfKeys).chain().zipObject(arrayOfValues); - - result = _(arrayOfKeys).chain().zipObject(arrayOfValues); - result = _(arrayOfKeys).chain().zipObject(listOfValues); - result = _(listOfKeys).chain().zipObject(listOfValues); - result = _(listOfKeys).chain().zipObject(arrayOfValues); - } - - { - let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; - - result = _(arrayOfKeys).chain().zipObject(); - result = _(arrayOfKeys).chain().zipObjectDeep(); - result = _(arrayOfKeys).chain().zipObject(arrayOfValues); - result = _(arrayOfKeys).chain().zipObjectDeep(arrayOfValues); - result = _(arrayOfKeys).chain().zipObject(listOfValues); - result = _(arrayOfKeys).chain().zipObjectDeep(listOfValues); - - result = _(listOfKeys).chain().zipObject(); - result = _(listOfKeys).chain().zipObjectDeep(); - result = _(listOfKeys).chain().zipObject(listOfValues); - result = _(listOfKeys).chain().zipObjectDeep(listOfValues); - result = _(listOfKeys).chain().zipObject(arrayOfValues); - result = _(listOfKeys).chain().zipObjectDeep(arrayOfValues); - } + _.zipObjectDeep(["a.b[0].c", "a.b[1].d"], [1, 2]); // $ExpectType object + _.zipObjectDeep(listOfKeys, listOfValues); // $ExpectType object + _(listOfKeys).zipObjectDeep(listOfValues); // $ExpectType LoDashImplicitWrapper + _.chain(listOfKeys).zipObjectDeep(listOfValues); // $ExpectType LoDashExplicitWrapper + fp.zipObjectDeep(["a.b[0].c", "a.b[1].d"], [1, 2]); // $ExpectType object + fp.zipObjectDeep(listOfKeys)(listOfValues); // $ExpectType object } // _.zipWith { - type TestZipWithFn = (a1: number, a2: number) => number; - - { - let result: number[]; - - result = _.zipWith([1, 2], (value1) => { - value1; // $ExpectType number - return 1; - }); - result = _.zipWith([1, 2], [1, 2], (value1, value2) => { - value1; // $ExpectType number - value2; // $ExpectType number - return 1; - }); - result = _.zipWith([1, 2], [1, 2], [1, 2], (value1, value2, value3) => { - value1; // $ExpectType number - value2; // $ExpectType number - value3; // $ExpectType number - return 1; - }); - result = _.zipWith([1, 2], [1, 2], [1, 2], [1, 2], (value1, value2, value3, value4) => { - value1; // $ExpectType number - value2; // $ExpectType number - value3; // $ExpectType number - value4; // $ExpectType number - return 1; - }); - result = _.zipWith([1, 2], [1, 2], [1, 2], [1, 2], [1, 2], (value1, value2, value3, value4, value5) => { - value1; // $ExpectType number - value2; // $ExpectType number - value3; // $ExpectType number - value4; // $ExpectType number - value5; // $ExpectType number - return 1; - }); - result = _.zipWith([1, 2], [1, 2], [1, 2], [1, 2], [1, 2], [1, 2], (value1, value2, value3, value4, value5, value6) => { - value1; // $ExpectType number - value2; // $ExpectType number - value3; // $ExpectType number - value4; // $ExpectType number - value5; // $ExpectType number - value6; // $ExpectType number - return 1; - }); - result = _.zipWith([1, 2], [1, 2], [1, 2], (...group: number[]) => 1); - result = _.zipWith([1, 2], [1, 2], [1, 2], [1, 2], [1, 2], [1, 2], (...group) => { - group; // $ExpectType number[] - return 1; - }); - - let mat = [[1, 2], [1, 2], [1, 2]]; - result = _.zipWith(...mat, (...group: number[]) => 1); - - result = _([1, 2]).zipWith((value1) => { - value1; // $ExpectType number - return 1; - }).value(); - result = _([1, 2]).zipWith([1, 2], (value1, value2) => { - value1; // $ExpectType number - value2; // $ExpectType number - return 1; - }).value(); - result = _([1, 2]).zipWith([1, 2], [1, 2], (value1, value2, value3) => { - value1; // $ExpectType number - value2; // $ExpectType number - value3; // $ExpectType number - return 1; - }).value(); - result = _([1, 2]).zipWith([1, 2], [1, 2], [1, 2], (value1, value2, value3, value4) => { - value1; // $ExpectType number - value2; // $ExpectType number - value3; // $ExpectType number - value4; // $ExpectType number - return 1; - }).value(); - result = _([1, 2]).zipWith([1, 2], [1, 2], [1, 2], [1, 2], (value1, value2, value3, value4, value5) => { - value1; // $ExpectType number - value2; // $ExpectType number - value3; // $ExpectType number - value4; // $ExpectType number - value5; // $ExpectType number - return 1; - }).value(); - result = _([1, 2]).zipWith([1, 2], [1, 2], [1, 2], [1, 2], [1, 2], (value1, value2, value3, value4, value5, value6) => { - value1; // $ExpectType number - value2; // $ExpectType number - value3; // $ExpectType number - value4; // $ExpectType number - value5; // $ExpectType number - value6; // $ExpectType number - return 1; - }).value(); - result = _([1, 2]).zipWith([1, 2], [1, 2], (...group: number[]) => 1).value(); - result = _([1, 2]).zipWith([1, 2], [1, 2], [1, 2], [1, 2], [1, 2], (...group) => { - group; // $ExpectType number[] - return 1; - }).value(); - - result = _.chain([1, 2]).zipWith((value1) => { - value1; // $ExpectType number - return 1; - }).value(); - result = _.chain([1, 2]).zipWith([1, 2], (value1, value2) => { - value1; // $ExpectType number - value2; // $ExpectType number - return 1; - }).value(); - result = _.chain([1, 2]).zipWith([1, 2], [1, 2], (value1, value2, value3) => { - value1; // $ExpectType number - value2; // $ExpectType number - value3; // $ExpectType number - return 1; - }).value(); - result = _.chain([1, 2]).zipWith([1, 2], [1, 2], [1, 2], (value1, value2, value3, value4) => { - value1; // $ExpectType number - value2; // $ExpectType number - value3; // $ExpectType number - value4; // $ExpectType number - return 1; - }).value(); - result = _.chain([1, 2]).zipWith([1, 2], [1, 2], [1, 2], [1, 2], (value1, value2, value3, value4, value5) => { - value1; // $ExpectType number - value2; // $ExpectType number - value3; // $ExpectType number - value4; // $ExpectType number - value5; // $ExpectType number - return 1; - }).value(); - result = _.chain([1, 2]).zipWith([1, 2], [1, 2], [1, 2], [1, 2], [1, 2], (value1, value2, value3, value4, value5, value6) => { - value1; // $ExpectType number - value2; // $ExpectType number - value3; // $ExpectType number - value4; // $ExpectType number - value5; // $ExpectType number - value6; // $ExpectType number - return 1; - }).value(); - result = _.chain([1, 2]).zipWith([1, 2], [1, 2], (...group: number[]) => 1).value(); - result = _.chain([1, 2]).zipWith([1, 2], [1, 2], [1, 2], [1, 2], [1, 2], (...group) => { - group; // $ExpectType number[] - return 1; - }).value(); - - result = _([1, 2]).zipWith(["a", "b"], (value1, value2) => { - value1; // $ExpectType number - value2; // $ExpectType string - return 1; - }).value(); - - result = _([1, 2]).zipWith(["a", "b"], [true, false], (value1, value2, value3) => { - value1; // $ExpectType number - value2; // $ExpectType string - value3; // $ExpectType boolean - return 1; - }).value(); - } -} - -/********* - * Chain * - *********/ - -// _.chain -namespace 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 -namespace TestTap { - { - let interceptor = (value: string) => {}; - let result: string; - - _.tap('', interceptor); - } - - { - let interceptor = (value: string[]) => {}; - let result: _.LoDashImplicitArrayWrapper; - - _.tap([''], interceptor); - } - - { - let interceptor = (value: {a: string}) => {}; - let result: _.LoDashImplicitObjectWrapper<{a: string}>; - - _.tap({a: ''}, interceptor); - } - - { - let interceptor = (value: string) => {}; - let result: _.LoDashImplicitWrapper; - - _.chain('').tap(interceptor); - - _('').tap(interceptor); - } - - { - let interceptor = (value: string[]) => {}; - let result: _.LoDashImplicitArrayWrapper; - - _.chain(['']).tap(interceptor); - - _(['']).tap(interceptor); - } - - { - let interceptor = (value: {a: string}) => {}; - let result: _.LoDashImplicitWrapper<{a: string}>; - - _.chain({a: ''}).tap(interceptor); - - _({a: ''}).tap(interceptor); - } - - { - let interceptor = (value: string) => {}; - let result: _.LoDashExplicitWrapper; - - _.chain('').tap(interceptor); - - _('').chain().tap(interceptor); - } - - { - let interceptor = (value: string[]) => {}; - let result: _.LoDashExplicitArrayWrapper; - - _.chain(['']).tap(interceptor); - - _(['']).chain().tap(interceptor); - } - - { - let interceptor = (value: {a: string}) => {}; - let result: _.LoDashExplicitWrapper<{a: string}>; - - _.chain({a: ''}).tap(interceptor); - - _({a: ''}).chain().tap(interceptor); - } -} - -// _.thru -namespace TestThru { - type Interceptor = (value: T) => T; - - { - let interceptor: Interceptor = (x) => x; - let result: number; - - result = _.thru(1, interceptor); - } - - { - let interceptor: Interceptor = (x) => x; - let result: _.LoDashImplicitWrapper; - - result = _(1).thru(interceptor); - } - - { - let interceptor: Interceptor = (x) => x; - let result: _.LoDashImplicitWrapper; - - result = _('').thru(interceptor); - } - - { - let interceptor: Interceptor = (x) => x; - let result: _.LoDashImplicitWrapper; - - result = _(true).thru(interceptor); - } - - { - let interceptor: Interceptor<{a: string}> = (x) => x; - let result: _.LoDashImplicitObjectWrapper<{a: string}>; - - result = _({a: ''}).thru<{a: string}>(interceptor); - } - - { - let interceptor: Interceptor = (x) => x; - let result: _.LoDashImplicitArrayWrapper; - - result = _([1, 2, 3]).thru(interceptor); - } - - { - let interceptor: Interceptor = (x) => x; - let result: _.LoDashExplicitWrapper; - - result = _(1).chain().thru(interceptor); - } - - { - let interceptor: Interceptor = (x) => x; - let result: _.LoDashExplicitWrapper; - - result = _('').chain().thru(interceptor); - } - - { - let interceptor: Interceptor = (x) => x; - let result: _.LoDashExplicitWrapper; - - result = _(true).chain().thru(interceptor); - } - - { - let interceptor: Interceptor<{a: string}> = (x) => x; - let result: _.LoDashExplicitObjectWrapper<{a: string}>; - - result = _({a: ''}).chain().thru<{a: string}>(interceptor); - } - - { - let interceptor: Interceptor = (x) => x; - let result: _.LoDashExplicitArrayWrapper; - - result = _([1, 2, 3]).chain().thru(interceptor); - } -} - -// _.prototype.commit -namespace 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 -namespace TestConcat { - const numberROA: number[] = [0]; // TODO: Should be ReadonlyArray, but see comment on type Many - - _.concat(1); // $ExpectType number[] - _.concat([1]); // $ExpectType number[] - _.concat(numberROA); // $ExpectType number[] - _.concat(1, 2); // $ExpectType number[] - _.concat(1, [1]); // $ExpectType number[] - _.concat(1, [1], numberROA); // $ExpectType number[] - - _(1).concat(2); // $ExpectType LoDashImplicitWrapper - _(1).concat([1]); // $ExpectType LoDashImplicitWrapper - _(1).concat([2], numberROA); // $ExpectType LoDashImplicitWrapper - _([1]).concat(2); // $ExpectType LoDashImplicitWrapper - _(numberROA).concat(numberROA); // $ExpectType LoDashImplicitWrapper - _(numberROA).concat(numberROA, numberROA); // $ExpectType LoDashImplicitWrapper - - _.chain(1).concat(2); // $ExpectType LoDashExplicitWrapper - _.chain(1).concat([1]); // $ExpectType LoDashExplicitWrapper - _.chain(1).concat([2], numberROA); // $ExpectType LoDashExplicitWrapper - _.chain([1]).concat(2); // $ExpectType LoDashExplicitWrapper - _.chain(numberROA).concat(numberROA); // $ExpectType LoDashExplicitWrapper - _.chain(numberROA).concat(numberROA, numberROA); // $ExpectType LoDashExplicitWrapper - - const stringROA: string[] = ['']; // TODO: Should be ReadonlyArray, but see comment on type Many - - _.concat('a'); // $ExpectType string[] - _.concat(['a']); // $ExpectType string[] - _.concat(stringROA); // $ExpectType string[] - _.concat('a', 'b'); // $ExpectType string[] - _.concat('a', ['a']); // $ExpectType string[] - _.concat('a', ['a'], stringROA); // $ExpectType string[] - - _('a').concat('b'); // $ExpectType LoDashImplicitWrapper - _('a').concat(['a']); // $ExpectType LoDashImplicitWrapper - _('a').concat(['b'], stringROA); // $ExpectType LoDashImplicitWrapper - _(['a']).concat('b'); // $ExpectType LoDashImplicitWrapper - _(stringROA).concat(stringROA); // $ExpectType LoDashImplicitWrapper - _(stringROA).concat(stringROA, stringROA); // $ExpectType LoDashImplicitWrapper - - _.chain('a').concat('b'); // $ExpectType LoDashExplicitWrapper - _.chain('a').concat(['a']); // $ExpectType LoDashExplicitWrapper - _.chain('a').concat(['b'], stringROA); // $ExpectType LoDashExplicitWrapper - _.chain(['a']).concat('b'); // $ExpectType LoDashExplicitWrapper - _.chain(stringROA).concat(stringROA); // $ExpectType LoDashExplicitWrapper - _.chain(stringROA).concat(stringROA, stringROA); // $ExpectType LoDashExplicitWrapper - - const abcObject: AbcObject = { a: 1, b: 'foo', c: true }; - const objectROA: AbcObject[] = [{ a: 1, b: 'foo', c: true }]; // TODO: Should be ReadonlyArray, but see comment on type Many - - _.concat(abcObject); // $ExpectType AbcObject[] - _.concat([abcObject]); // $ExpectType AbcObject[] - _.concat(objectROA); // $ExpectType AbcObject[] - _.concat(abcObject, abcObject); // $ExpectType AbcObject[] - _.concat(abcObject, [abcObject]); // $ExpectType AbcObject[] - _.concat(abcObject, [abcObject], objectROA); // $ExpectType AbcObject[] - - _(abcObject).concat(abcObject); // $ExpectType LoDashImplicitWrapper - _(abcObject).concat([abcObject]); // $ExpectType LoDashImplicitWrapper - _(abcObject).concat([abcObject], objectROA); // $ExpectType LoDashImplicitWrapper - _([abcObject]).concat(abcObject); // $ExpectType LoDashImplicitWrapper - _(objectROA).concat(objectROA); // $ExpectType LoDashImplicitWrapper - _(objectROA).concat(objectROA, objectROA); // $ExpectType LoDashImplicitWrapper - - _.chain(abcObject).concat(abcObject); // $ExpectType LoDashExplicitWrapper - _.chain(abcObject).concat([abcObject]); // $ExpectType LoDashExplicitWrapper - _.chain(abcObject).concat([abcObject], objectROA); // $ExpectType LoDashExplicitWrapper - _.chain([abcObject]).concat(abcObject); // $ExpectType LoDashExplicitWrapper - _.chain(objectROA).concat(objectROA); // $ExpectType LoDashExplicitWrapper - _.chain(objectROA).concat(objectROA, objectROA); // $ExpectType LoDashExplicitWrapper -} - -// _.prototype.plant -namespace TestPlant { - { - let result: _.LoDashImplicitWrapper; - result = _(anything).plant(42); - } - - { - let result: _.LoDashImplicitStringWrapper; - result = _(anything).plant(''); - } - - { - let result: _.LoDashImplicitWrapper; - result = _(anything).plant(true); - } - - { - let result: _.LoDashImplicitNumberArrayWrapper; - result = _(anything).plant([42]); - } - - { - let result: _.LoDashImplicitArrayWrapper; - result = _(anything).plant([]); - } - - { - let result: _.LoDashImplicitWrapper<{}>; - result = _(anything).plant<{}>({}); - } - - { - let result: _.LoDashExplicitWrapper; - result = _(anything).chain().plant(42); - } - - { - let result: _.LoDashExplicitStringWrapper; - result = _(anything).chain().plant(''); - } - - { - let result: _.LoDashExplicitWrapper; - result = _(anything).chain().plant(true); - } - - { - let result: _.LoDashExplicitNumberArrayWrapper; - result = _(anything).chain().plant([42]); - } - - { - let result: _.LoDashExplicitArrayWrapper; - result = _(anything).chain().plant([]); - } - - { - let result: _.LoDashExplicitWrapper<{}>; - result = _(anything).chain().plant<{}>({}); - } -} - -// _.prototype.reverse -namespace TestReverse { - { - let result: _.LoDashImplicitArrayWrapper; - result = _([42]).reverse(); - } - - { - let result: _.LoDashExplicitArrayWrapper; - result = _([42]).chain().reverse(); - } -} - -// _.prototype.toJSON -namespace 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 -namespace 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 -namespace 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 -namespace 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(); - } + // $ExpectType string[] + _.zipWith([1, 2], (value1) => { + value1; // $ExpectType number + return ""; + }); + // $ExpectType string[] + _.zipWith([1, 2], [1, 2], (value1, value2) => { + value1; // $ExpectType number + value2; // $ExpectType number + return ""; + }); + // $ExpectType string[] + _.zipWith([1, 2], [1, 2], [1, 2], [1, 2], [1, 2], [1, 2], (value1, value2, value3, value4, value5, value6) => { + value1; // $ExpectType number + value2; // $ExpectType number + value3; // $ExpectType number + value4; // $ExpectType number + value5; // $ExpectType number + value6; // $ExpectType number + return ""; + }); + // $ExpectType string[] + _.zipWith([1, 2], [1, 2], [1, 2], [1, 2], [1, 2], [1, 2], (...group) => { + group; // $ExpectType number[] + return ""; + }); + // $ExpectType string[] + _.zipWith([1, 2], ["a", "b"], [true, false], (value1, value2, value3) => { + value1; // $ExpectType number + value2; // $ExpectType string + value3; // $ExpectType boolean + return ""; + }); + + const values = [[1, 2], [1, 2], [1, 2]]; + _.zipWith(...values, (...group: number[]) => ""); // $ExpectType string[] + + // $ExpectType LoDashImplicitWrapper + _([1, 2]).zipWith((value1) => { + value1; // $ExpectType number + return ""; + }); + // $ExpectType LoDashImplicitWrapper + _([1, 2]).zipWith([1, 2], (value1, value2) => { + value1; // $ExpectType number + value2; // $ExpectType number + return ""; + }); + // $ExpectType LoDashImplicitWrapper + _([1, 2]).zipWith([1, 2], [1, 2], [1, 2], [1, 2], [1, 2], (...group) => { + group; // $ExpectType number[] + return ""; + }); + // $ExpectType LoDashImplicitWrapper + _([1, 2]).zipWith(["a", "b"], [true, false], (value1, value2, value3) => { + value1; // $ExpectType number + value2; // $ExpectType string + value3; // $ExpectType boolean + return ""; + }); + + // $ExpectType LoDashExplicitWrapper + _.chain([1, 2]).zipWith((value1) => { + value1; // $ExpectType number + return ""; + }); + // $ExpectType LoDashExplicitWrapper + _.chain([1, 2]).zipWith([1, 2], [1, 2], [1, 2], [1, 2], [1, 2], (...group) => { + group; // $ExpectType number[] + return ""; + }); + // $ExpectType LoDashExplicitWrapper + _.chain([1, 2]).zipWith(["a", "b"], [true, false], (value1, value2, value3) => { + value1; // $ExpectType number + value2; // $ExpectType string + value3; // $ExpectType boolean + return ""; + }); + + fp.zipWith((value1, value2) => "a", [1, 2], [1, 2]); // $ExpectType string[] + fp.zipWith((value1: number, value2: number) => "a")([1, 2])([1, 2]); // $ExpectType string[] } /************** @@ -4066,1233 +1688,599 @@ namespace TestValueOf { **************/ // _.at -namespace TestAt { - let array: AbcObject[] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; - let dictionary: _.Dictionary | null | undefined = anything; - let numericDictionary: _.NumericDictionary | null | undefined = anything; - let abcObject: AbcObject | null | undefined = anything; +{ + const list: _.List | null | undefined = anything; + const dictionary: _.Dictionary | null | undefined = anything; + const numericDictionary: _.NumericDictionary | null | undefined = anything; + const abcObject: AbcObject | null | undefined = anything; - { - let result: AbcObject[]; + _.at(list, 0, "1", [2], ["3"], [4, "5"]); // $ExpectType AbcObject[] + _.at(numericDictionary, 0, "1", [2], ["3"], [4, "5"]); // $ExpectType AbcObject[] + _.at(dictionary, "a", ["b", "c"]); // $ExpectType AbcObject[] + _.at(abcObject, "a", ["b", "c"]); // $ExpectType (string | number | boolean)[] - 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']); - result = _.at(numericDictionary, 0, '1', [2], ['3'], [4, '5']); - } + _(list).at(0, "1", [2], ["3"], [4, "5"]); // $ExpectType LoDashImplicitWrapper + _(numericDictionary).at(0, "1", [2], ["3"], [4, "5"]); // $ExpectType LoDashImplicitWrapper + _(dictionary).at("a", ["b", "c"]); // $ExpectType LoDashImplicitWrapper + _(abcObject).at("a", ["b", "c"]); // $ExpectType LoDashImplicitWrapper<(string | number | boolean)[]> - { - let result: Array; + _.chain(list).at(0, "1", [2], ["3"], [4, "5"]); // $ExpectType LoDashExplicitWrapper + _.chain(numericDictionary).at(0, "1", [2], ["3"], [4, "5"]); // $ExpectType LoDashExplicitWrapper + _.chain(dictionary).at("a", ["b", "c"]); // $ExpectType LoDashExplicitWrapper + _.chain(abcObject).at("a", ["b", "c"]); // $ExpectType LoDashExplicitWrapper<(string | number | boolean)[]> - result = _.at(abcObject, 'a', ['b'], ['a', 'b']); - } - - { - 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']); - result = _(numericDictionary).at(0, '1', [2], ['3'], [4, '5']); - } - - { - let result: _.LoDashImplicitArrayWrapper; - - result = _(abcObject).at('a', ['b'], ['a', 'b']); - } - - { - 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']); - result = _(numericDictionary).chain().at(0, '1', [2], ['3'], [4, '5']); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _(abcObject).chain().at('a', ['b'], ['a', 'b']); - } + fp.at(0, list); // $ExpectType AbcObject[] + fp.at(0)(list); // $ExpectType AbcObject[] + fp.at([0, "1"], list); // $ExpectType AbcObject[] + fp.at("a", abcObject); // $ExpectType (string | number | boolean)[] } // _.countBy -namespace TestCountBy { - let array: AbcObject[] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; - let obj: any = {}; - let dictionary: _.Dictionary | null | undefined = obj; - let numericDictionary: _.NumericDictionary | null | undefined = obj; - - let stringIterator: (value: string, index: number, collection: string) => any = (value: string, index: number, collection: string) => 1; - let listIterator: (value: AbcObject, index: number, collection: _.List) => any = (value: AbcObject, index: number, collection: _.List) => 1; - let dictionaryIterator: (value: AbcObject, key: string, collection: _.Dictionary) => any = (value: AbcObject, key: string, collection: _.Dictionary) => 1; - let numericDictionaryIterator: (value: AbcObject, key: string, collection: _.NumericDictionary) => any = (value: AbcObject, key: string, collection: _.NumericDictionary) => 1; - - { - let result: _.Dictionary; - - result = _.countBy(''); - result = _.countBy('', stringIterator); - - result = _.countBy(array); - result = _.countBy(array, listIterator); - result = _.countBy(array, ''); - result = _.countBy(array, {a: 42}); - result = _.countBy(array, {a: 42}); - - result = _.countBy(list); - result = _.countBy(list, listIterator); - result = _.countBy(list, ''); - result = _.countBy(list, {a: 42}); - - result = _.countBy(dictionary); - result = _.countBy(dictionary, dictionaryIterator); - result = _.countBy(dictionary, ''); - result = _.countBy(dictionary, {a: 42}); - - result = _.countBy(numericDictionary); - result = _.countBy(numericDictionary, numericDictionaryIterator); - result = _.countBy(numericDictionary, ''); - result = _.countBy(numericDictionary, {a: 42}); - } - - { - let resutl: _.LoDashImplicitObjectWrapper<_.Dictionary>; - - result = _('').countBy(); - result = _('').countBy(stringIterator); - - result = _(array).countBy(); - result = _(array).countBy(listIterator); - result = _(array).countBy(''); - result = _(array).countBy<{a: number}>({a: 42}); - result = _(array).countBy({a: 42}); - - result = _(list).countBy(); - result = _(list).countBy(listIterator); - result = _(list).countBy(''); - result = _(list).countBy<{a: number}>({a: 42}); - result = _(list).countBy({a: 42}); - - result = _(dictionary).countBy(); - result = _(dictionary).countBy(dictionaryIterator); - result = _(dictionary).countBy(''); - result = _(dictionary).countBy({a: 42}); - - result = _(numericDictionary).countBy(); - result = _(numericDictionary).countBy(numericDictionaryIterator); - result = _(numericDictionary).countBy(''); - result = _(numericDictionary).countBy({a: 42}); - } - - { - let resutl: _.LoDashExplicitObjectWrapper<_.Dictionary>; - - result = _('').chain().countBy(); - result = _('').chain().countBy(stringIterator); - - result = _(array).chain().countBy(); - result = _(array).chain().countBy(listIterator); - result = _(array).chain().countBy(''); - result = _(array).chain().countBy({a: 42}); - - result = _(list).chain().countBy(); - result = _(list).chain().countBy(listIterator); - result = _(list).chain().countBy(''); - result = _(list).chain().countBy({a: 42}); - - result = _(dictionary).chain().countBy(); - result = _(dictionary).chain().countBy(dictionaryIterator); - result = _(dictionary).chain().countBy(''); - result = _(dictionary).chain().countBy({a: 42}); - - result = _(numericDictionary).chain().countBy(); - result = _(numericDictionary).chain().countBy(numericDictionaryIterator); - result = _(numericDictionary).chain().countBy(''); - result = _(numericDictionary).chain().countBy({a: 42}); - } -} - -// _.each -namespace TestEach { - let array: AbcObject[] = []; - let list: _.List = []; - let dictionary: _.Dictionary = {}; - let nilArray: AbcObject[] | null | undefined = [] as any; - let nilList: _.List | null | undefined = [] as any; - let nilDictionary: _.Dictionary | null | undefined = anything; - - let stringIterator: (char: string, index: number, string: string) => any = (char: string, index: number, string: string) => 1; - let listIterator: (value: AbcObject, index: number, collection: _.List) => any = (value: AbcObject, index: number, collection: _.List) => 1; - let dictionaryIterator: (value: AbcObject, key: string, collection: _.Dictionary) => any = (value: AbcObject, key: string, collection: _.Dictionary) => 1; - - { - let result: string; - - result = _.each('', stringIterator); - } - - { - let result: string | null | undefined; - - result = _.each('' as (string | null | undefined), stringIterator); - } - - { - let result: AbcObject[]; - - result = _.each(array, listIterator); - } - - { - let result: AbcObject[] | null | undefined; - - result = _.each(nilArray, listIterator); - } - - { - let result: _.List; - - result = _.each(list, listIterator); - } - - { - let result: _.List | null | undefined; - - result = _.each(nilList, listIterator); - } - - { - let result: _.Dictionary; - - result = _.each(dictionary, dictionaryIterator); - } - - { - let result: _.Dictionary | null | undefined; - - result = _.each(nilDictionary, dictionaryIterator); - } - - { - let result: _.LoDashImplicitWrapper; - - result = _('').each(stringIterator); - } - - { - let result: _.LoDashImplicitArrayWrapper; - - result = _(array).each(listIterator); - } - - { - let result: _.LoDashImplicitObjectWrapper<_.List>; - - result = _(list).each(listIterator); - } - - { - let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; - - result = _(dictionary).each(dictionaryIterator); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _('').chain().each(stringIterator); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _(array).chain().each(listIterator); - } - - { - let result: _.LoDashExplicitObjectWrapper<_.List>; - - result = _(list).chain().each(listIterator); - } - - { - let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; - - result = _(dictionary).chain().each(dictionaryIterator); - } -} - -// _.eachRight -namespace TestEachRight { - let array: AbcObject[] = []; - let list: _.List = []; - let dictionary: _.Dictionary = {}; - let nilArray: AbcObject[] | null | undefined = [] as any; - let nilList: _.List | null | undefined = [] as any; - let nilDictionary: _.Dictionary | null | undefined = anything; - - let stringIterator: (char: string, index: number, string: string) => any = (char: string, index: number, string: string) => 1; - let listIterator: (value: AbcObject, index: number, collection: _.List) => any = (value: AbcObject, index: number, collection: _.List) => 1; - let dictionaryIterator: (value: AbcObject, key: string, collection: _.Dictionary) => any = (value: AbcObject, key: string, collection: _.Dictionary) => 1; - - { - let result: string; - - result = _.eachRight('', stringIterator); - } - - { - let result: string | null | undefined; - - result = _.eachRight('' as (string | null | undefined), stringIterator); - } - - { - let result: AbcObject[]; - - result = _.eachRight(array, listIterator); - } - - { - let result: AbcObject[] | null | undefined; - - result = _.eachRight(nilArray, listIterator); - } - - { - let result: _.List; - - result = _.eachRight(list, listIterator); - } - - { - let result: _.List | null | undefined; - - result = _.eachRight(nilList, listIterator); - } - - { - let result: _.Dictionary; - - result = _.eachRight(dictionary, dictionaryIterator); - } - - { - let result: _.Dictionary | null | undefined; - - result = _.eachRight(nilDictionary, dictionaryIterator); - } - - { - let result: _.LoDashImplicitWrapper; - - result = _('').eachRight(stringIterator); - } - - { - let result: _.LoDashImplicitArrayWrapper; - - result = _(array).eachRight(listIterator); - } - - { - let result: _.LoDashImplicitObjectWrapper<_.List>; - - result = _(list).eachRight(listIterator); - } - - { - let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; - - result = _(dictionary).eachRight(dictionaryIterator); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _('').chain().eachRight(stringIterator); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _(array).chain().eachRight(listIterator); - } - - { - let result: _.LoDashExplicitObjectWrapper<_.List>; - - result = _(list).chain().eachRight(listIterator); - } - - { - let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; - - result = _(dictionary).chain().eachRight(dictionaryIterator); - } +{ + const list: _.List | null | undefined = anything; + const dictionary: _.Dictionary | null | undefined = anything; + const numericDictionary: _.NumericDictionary | null | undefined = anything; + + const stringIterator = (value: string, index: number, collection: string) => 1; + const listIterator = (value: AbcObject, index: number, collection: _.List) => 1; + const dictionaryIterator = (value: AbcObject, key: string, collection: _.Dictionary) => 1; + const numericDictionaryIterator = (value: AbcObject, key: string, collection: _.NumericDictionary) => 1; + + _.countBy(""); // $ExpectType Dictionary + _.countBy("", stringIterator); // $ExpectType Dictionary + + _.countBy(list); // $ExpectType Dictionary + _.countBy(list, listIterator); // $ExpectType Dictionary + _.countBy(list, ""); // $ExpectType Dictionary + _.countBy(list, { a: 42 }); // $ExpectType Dictionary + + _.countBy(dictionary); // $ExpectType Dictionary + _.countBy(dictionary, dictionaryIterator); // $ExpectType Dictionary + _.countBy(dictionary, ""); // $ExpectType Dictionary + _.countBy(dictionary, { a: 42 }); // $ExpectType Dictionary + + _.countBy(numericDictionary); // $ExpectType Dictionary + _.countBy(numericDictionary, numericDictionaryIterator); // $ExpectType Dictionary + _.countBy(numericDictionary, ""); // $ExpectType Dictionary + _.countBy(numericDictionary, { a: 42 }); // $ExpectType Dictionary + + _("").countBy(); // $ExpectType LoDashImplicitWrapper> + _("").countBy(stringIterator); // $ExpectType LoDashImplicitWrapper> + + _(list).countBy(); // $ExpectType LoDashImplicitWrapper> + _(list).countBy(listIterator); // $ExpectType LoDashImplicitWrapper> + _(list).countBy(""); // $ExpectType LoDashImplicitWrapper> + _(list).countBy({ a: 42 }); // $ExpectType LoDashImplicitWrapper> + + _(dictionary).countBy(); // $ExpectType LoDashImplicitWrapper> + _(dictionary).countBy(dictionaryIterator); // $ExpectType LoDashImplicitWrapper> + _(dictionary).countBy(""); // $ExpectType LoDashImplicitWrapper> + _(dictionary).countBy({ a: 42 }); // $ExpectType LoDashImplicitWrapper> + + _(numericDictionary).countBy(); // $ExpectType LoDashImplicitWrapper> + _(numericDictionary).countBy(numericDictionaryIterator); // $ExpectType LoDashImplicitWrapper> + _(numericDictionary).countBy(""); // $ExpectType LoDashImplicitWrapper> + _(numericDictionary).countBy({ a: 42 }); // $ExpectType LoDashImplicitWrapper> + + _.chain("").countBy(); // $ExpectType LoDashExplicitWrapper> + _.chain("").countBy(stringIterator); // $ExpectType LoDashExplicitWrapper> + + _.chain(list).countBy(); // $ExpectType LoDashExplicitWrapper> + _.chain(list).countBy(listIterator); // $ExpectType LoDashExplicitWrapper> + _.chain(list).countBy(""); // $ExpectType LoDashExplicitWrapper> + _.chain(list).countBy({ a: 42 }); // $ExpectType LoDashExplicitWrapper> + + _.chain(dictionary).countBy(); // $ExpectType LoDashExplicitWrapper> + _.chain(dictionary).countBy(dictionaryIterator); // $ExpectType LoDashExplicitWrapper> + _.chain(dictionary).countBy(""); // $ExpectType LoDashExplicitWrapper> + _.chain(dictionary).countBy({ a: 42 }); // $ExpectType LoDashExplicitWrapper> + + _.chain(numericDictionary).countBy(); // $ExpectType LoDashExplicitWrapper> + _.chain(numericDictionary).countBy(numericDictionaryIterator); // $ExpectType LoDashExplicitWrapper> + _.chain(numericDictionary).countBy(""); // $ExpectType LoDashExplicitWrapper> + _.chain(numericDictionary).countBy({ a: 42 }); // $ExpectType LoDashExplicitWrapper> + + const stringIterator2 = (value: string) => 1; + const listIterator2 = (value: AbcObject) => 1; + fp.countBy(stringIterator2, ""); // $ExpectType Dictionary + fp.countBy(stringIterator2)(""); // $ExpectType Dictionary + fp.countBy(listIterator2, list); // $ExpectType Dictionary + fp.countBy("", list); // $ExpectType Dictionary + fp.countBy({ a: 42 }, list); // $ExpectType Dictionary + fp.countBy(listIterator2, dictionary); // $ExpectType Dictionary + fp.countBy({ a: 42 }, dictionary); // $ExpectType Dictionary + fp.countBy(listIterator2, numericDictionary); // $ExpectType Dictionary + fp.countBy({ a: 42 }, numericDictionary); // $ExpectType Dictionary } // _.every -namespace TestEvery { - type SampleObject = {a: number; b: string; c: boolean;}; +{ + const list: _.List | null | undefined = anything; + const dictionary: _.Dictionary | null | undefined = anything; + const numericDictionary: _.NumericDictionary | null | undefined = anything; - let array: SampleObject[] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; - let obj: any = {}; - let dictionary: _.Dictionary | null | undefined = obj; - let numericDictionary: _.NumericDictionary | null | undefined = obj; + const listIterator = (value: AbcObject, index: number, collection: _.List) => true; + const dictionaryIterator = (value: AbcObject, key: string, collection: _.Dictionary) => true; + const numericDictionaryIterator = (value: AbcObject, key: string, collection: _.NumericDictionary) => true; + const valueIterator = (value: AbcObject) => true; - let listIterator = (value: SampleObject, index: number, collection: _.List) => true; - let dictionaryIterator = (value: SampleObject, key: string, collection: _.Dictionary) => true; - let numericDictionaryIterator = (value: SampleObject, key: string, collection: _.NumericDictionary) => true; + _.every(list); // $ExpectType boolean + _.every(list, listIterator); // $ExpectType boolean + _.every(list, "a"); // $ExpectType boolean + _.every(list, ["a", 42]); // $ExpectType boolean + _.every(list, { a: 42 }); // $ExpectType boolean - { - let result: boolean; + _.every(dictionary); // $ExpectType boolean + _.every(dictionary, dictionaryIterator); // $ExpectType boolean + _.every(dictionary, "a"); // $ExpectType boolean + _.every(dictionary, ["a", 42]); // $ExpectType boolean + _.every(dictionary, { a: 42 }); // $ExpectType boolean - result = _.every(array); - result = _.every(array, listIterator); - result = _.every(array, 'a'); - result = _.every(array, ['a', 42]); - result = _.every(array, {a: 42}); + _.every(numericDictionary); // $ExpectType boolean + _.every(numericDictionary, numericDictionaryIterator); // $ExpectType boolean + _.every(numericDictionary, "a"); // $ExpectType boolean + _.every(numericDictionary, ["a", 42]); // $ExpectType boolean + _.every(numericDictionary, { a: 42 }); // $ExpectType boolean - result = _.every(list); - result = _.every(list, listIterator); - result = _.every(list, 'a'); - result = _.every(list, ['a', 42]); - result = _.every(list, {a: 42}); + _(list).every(); // $ExpectType boolean + _(list).every(listIterator); // $ExpectType boolean + _(list).every("a"); // $ExpectType boolean + _(list).every(["a", 42]); // $ExpectType boolean + _(list).every({ a: 42 }); // $ExpectType boolean - result = _.every(dictionary); - result = _.every(dictionary, dictionaryIterator); - result = _.every(dictionary, 'a'); - result = _.every(dictionary, ['a', 42]); - result = _.every(dictionary, {a: 42}); + _(dictionary).every(); // $ExpectType boolean + _(dictionary).every(dictionaryIterator); // $ExpectType boolean + _(dictionary).every("a"); // $ExpectType boolean + _(dictionary).every(["a", 42]); // $ExpectType boolean + _(dictionary).every({ a: 42 }); // $ExpectType boolean - result = _.every(numericDictionary); - result = _.every(numericDictionary, numericDictionaryIterator); - result = _.every(numericDictionary, 'a'); - result = _.every(numericDictionary, ['a', 42]); - result = _.every(numericDictionary, {a: 42}); + _(numericDictionary).every(); // $ExpectType boolean + _(numericDictionary).every(numericDictionaryIterator); // $ExpectType boolean + _(numericDictionary).every("a"); // $ExpectType boolean + _(numericDictionary).every(["a", 42]); // $ExpectType boolean + _(numericDictionary).every({ a: 42 }); // $ExpectType boolean - result = _(array).every(); - result = _(array).every(listIterator); - result = _(array).every('a'); - result = _(array).every(['a', 42]); - result = _(array).every({a: 42}); + _.chain(list).every(); // $ExpectType LoDashExplicitWrapper + _.chain(list).every(listIterator); // $ExpectType LoDashExplicitWrapper + _.chain(list).every("a"); // $ExpectType LoDashExplicitWrapper + _.chain(list).every(["a", 42]); // $ExpectType LoDashExplicitWrapper + _.chain(list).every({ a: 42 }); // $ExpectType LoDashExplicitWrapper - result = _(list).every(); - result = _(list).every(listIterator); - result = _(list).every('a'); - result = _(list).every(['a', 42]); - result = _(list).every({a: 42}); + _.chain(dictionary).every(); // $ExpectType LoDashExplicitWrapper + _.chain(dictionary).every(dictionaryIterator); // $ExpectType LoDashExplicitWrapper + _.chain(dictionary).every("a"); // $ExpectType LoDashExplicitWrapper + _.chain(dictionary).every(["a", 42]); // $ExpectType LoDashExplicitWrapper + _.chain(dictionary).every({ a: 42 }); // $ExpectType LoDashExplicitWrapper - result = _(dictionary).every(); - result = _(dictionary).every(dictionaryIterator); - result = _(dictionary).every('a'); - result = _(dictionary).every(['a', 42]); - result = _(dictionary).every({a: 42}); + _.chain(numericDictionary).every(); // $ExpectType LoDashExplicitWrapper + _.chain(numericDictionary).every(numericDictionaryIterator); // $ExpectType LoDashExplicitWrapper + _.chain(numericDictionary).every("a"); // $ExpectType LoDashExplicitWrapper + _.chain(numericDictionary).every(["a", 42]); // $ExpectType LoDashExplicitWrapper + _.chain(numericDictionary).every({ a: 42 }); // $ExpectType LoDashExplicitWrapper - result = _(numericDictionary).every(); - result = _(numericDictionary).every(numericDictionaryIterator); - result = _(numericDictionary).every('a'); - result = _(numericDictionary).every(['a', 42]); - result = _(numericDictionary).every({a: 42}); - } + fp.every(valueIterator, list); // $ExpectType boolean + fp.every("a")(list); // $ExpectType boolean + fp.every({ a: 42 }, list); // $ExpectType boolean + fp.every(["a", 42], list); // $ExpectType boolean - { - let result: _.LoDashExplicitWrapper; + fp.every(valueIterator, dictionary); // $ExpectType boolean + fp.every("a")(dictionary); // $ExpectType boolean + fp.every({ a: 42 })(dictionary); // $ExpectType boolean + fp.every(["a", 42])(dictionary); // $ExpectType boolean - result = _(array).chain().every(); - result = _(array).chain().every(listIterator); - result = _(array).chain().every('a'); - result = _(array).chain().every(['a', 42]); - result = _(array).chain().every({a: 42}); - - result = _(list).chain().every(); - result = _(list).chain().every(listIterator); - result = _(list).chain().every('a'); - result = _(list).chain().every(['a', 42]); - result = _(list).chain().every({a: 42}); - - result = _(dictionary).chain().every(); - result = _(dictionary).chain().every(dictionaryIterator); - result = _(dictionary).chain().every('a'); - result = _(dictionary).chain().every(['a', 42]); - result = _(dictionary).chain().every({a: 42}); - - result = _(numericDictionary).chain().every(); - result = _(numericDictionary).chain().every(numericDictionaryIterator); - result = _(numericDictionary).chain().every('a'); - result = _(numericDictionary).chain().every(['a', 42]); - result = _(numericDictionary).chain().every({a: 42}); - } + fp.every(valueIterator, numericDictionary); // $ExpectType boolean + fp.every("a")(numericDictionary); // $ExpectType boolean + fp.every({ a: 42 })(numericDictionary); // $ExpectType boolean + fp.every(["a", 42])(numericDictionary); // $ExpectType boolean } // _.filter -namespace TestFilter { - let array: AbcObject[] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; - let obj: any = {}; - let dictionary: _.Dictionary | null | undefined = obj; +{ + const list: _.List | null | undefined = anything; + const dictionary: _.Dictionary | null | undefined = anything; - let stringIterator = (char: string, index: number, string: string) => true; - let listIterator = (value: AbcObject, index: number, collection: _.List) => true; - let dictionaryIterator = (value: AbcObject, key: string, collection: _.Dictionary) => true; + const stringIterator = (char: string, index: number, string: string) => true; + const listIterator = (value: AbcObject, index: number, collection: _.List) => true; + const dictionaryIterator = (value: AbcObject, key: string, collection: _.Dictionary) => true; + const valueIterator = (value: AbcObject) => true; - { - let result: string[]; + _.filter("", stringIterator); // $ExpectType string[] + _.filter(list, listIterator); // $ExpectType AbcObject[] + _.filter(list, ""); // $ExpectType AbcObject[] + _.filter(list, { a: 42 }); // $ExpectType AbcObject[] + _.filter(list, ["a", 42]); // $ExpectType AbcObject[] + _.filter(dictionary, dictionaryIterator); // $ExpectType AbcObject[] + _.filter(dictionary, ""); // $ExpectType AbcObject[] + _.filter(dictionary, { a: 42 }); // $ExpectType AbcObject[] + _.filter(dictionary, ["a", 42]); // $ExpectType AbcObject[] - result = _.filter('', stringIterator); - } + _("").filter(stringIterator); // $ExpectType LoDashImplicitWrapper + _(list).filter(listIterator); // $ExpectType LoDashImplicitWrapper + _(list).filter(""); // $ExpectType LoDashImplicitWrapper + _(list).filter({ a: 42 }); // $ExpectType LoDashImplicitWrapper + _(list).filter(["a", 42]); // $ExpectType LoDashImplicitWrapper + _(dictionary).filter(dictionaryIterator); // $ExpectType LoDashImplicitWrapper + _(dictionary).filter(""); // $ExpectType LoDashImplicitWrapper + _(dictionary).filter({ a: 42 }); // $ExpectType LoDashImplicitWrapper + _(dictionary).filter(["a", 42]); // $ExpectType LoDashImplicitWrapper - { - let result: AbcObject[]; + _.chain("").filter(stringIterator); // $ExpectType LoDashExplicitWrapper + _.chain(list).filter(listIterator); // $ExpectType LoDashExplicitWrapper + _.chain(list).filter(""); // $ExpectType LoDashExplicitWrapper + _.chain(list).filter({ a: 42 }); // $ExpectType LoDashExplicitWrapper + _.chain(list).filter(["a", 42]); // $ExpectType LoDashExplicitWrapper + _.chain(dictionary).filter(dictionaryIterator); // $ExpectType LoDashExplicitWrapper + _.chain(dictionary).filter(""); // $ExpectType LoDashExplicitWrapper + _.chain(dictionary).filter({ a: 42 }); // $ExpectType LoDashExplicitWrapper + _.chain(dictionary).filter(["a", 42]); // $ExpectType LoDashExplicitWrapper - result = _.filter(array, listIterator); - result = _.filter(array, ''); - result = _.filter(array, {a: 42}); - result = _.filter(array, ["a", 42]); + fp.filter(valueIterator, list); // $ExpectType AbcObject[] + fp.filter(valueIterator)(list); // $ExpectType AbcObject[] + fp.filter("", list); // $ExpectType AbcObject[] + fp.filter({ a: 42 }, list); // $ExpectType AbcObject[] + fp.filter(["a", 42], list); // $ExpectType AbcObject[] + fp.filter(valueIterator, dictionary); // $ExpectType AbcObject[] + fp.filter("", dictionary); // $ExpectType AbcObject[] + fp.filter({ a: 42 }, dictionary); // $ExpectType AbcObject[] + fp.filter(["a", 42], dictionary); // $ExpectType AbcObject[] - result = _.filter(list, listIterator); - result = _.filter(list, ''); - result = _.filter(list, {a: 42}); - result = _.filter(list, ["a", 42]); + // Test filtering with type guard + const a2: Array | null | undefined = anything; + const d2: _.Dictionary | null | undefined = anything; - result = _.filter(dictionary, dictionaryIterator); - result = _.filter(dictionary, ''); - result = _.filter(dictionary, {a: 42}); - result = _.filter(dictionary, ["a", 42]); - } + _.filter(a2, (item: string | number): item is number => typeof item === "number"); // $ExpectType number[] + _.filter(d2, (item: string | number): item is number => typeof item === "number"); // $ExpectType number[] - { - let result: _.LoDashImplicitArrayWrapper; + _(a2).filter((item: string | number): item is number => typeof item === "number"); // $ExpectType LoDashImplicitWrapper + _(d2).filter((item: string | number): item is number => typeof item === "number"); // $ExpectType LoDashImplicitWrapper - result = _('').filter(stringIterator); - } + _.chain(a2).filter((item: string | number): item is number => typeof item === "number"); // $ExpectType LoDashExplicitWrapper + _.chain(d2).filter((item: string | number): item is number => typeof item === "number"); // $ExpectType LoDashExplicitWrapper - { - let result: _.LoDashImplicitArrayWrapper; - - result = _(array).filter(listIterator); - result = _(array).filter(''); - result = _(array).filter({a: 42}); - result = _(array).filter(["a", 42]); - - result = _(list).filter(listIterator); - result = _(list).filter(''); - result = _(list).filter({a: 42}); - result = _(list).filter(["a", 42]); - - result = _(dictionary).filter(dictionaryIterator); - result = _(dictionary).filter(''); - result = _(dictionary).filter({a: 42}); - result = _(dictionary).filter(["a", 42]); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _('').chain().filter(stringIterator); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _(array).chain().filter(listIterator); - result = _(array).chain().filter(''); - result = _(array).chain().filter({a: 42}); - result = _(array).chain().filter(["a", 42]); - - result = _(list).chain().filter(listIterator); - result = _(list).chain().filter(''); - result = _(list).chain().filter({a: 42}); - result = _(list).chain().filter(["a", 42]); - - result = _(dictionary).chain().filter(dictionaryIterator); - result = _(dictionary).chain().filter(''); - result = _(dictionary).chain().filter({a: 42}); - result = _(dictionary).chain().filter(["a", 42]); - } - - { - // Test filtering with type guard - let a2: Array | null | undefined = anything; - let d2: _.Dictionary | null | undefined = anything; - - _.filter(a2, (item: string | number): item is number => typeof item === "number"); // $ExpectType number[] - _.filter(d2, (item: string | number): item is number => typeof item === "number"); // $ExpectType number[] - _(a2).filter((item: string | number): item is number => typeof item === "number"); // $ExpectType LoDashImplicitWrapper - _(d2).filter((item: string | number): item is number => typeof item === "number"); // $ExpectType LoDashImplicitWrapper - _(a2).chain().filter((item: string | number): item is number => typeof item === "number"); // $ExpectType LoDashExplicitWrapper - _(d2).chain().filter((item: string | number): item is number => typeof item === "number"); // $ExpectType LoDashExplicitWrapper - } + fp.filter((item: string | number): item is number => typeof item === "number", a2); // $ExpectType number[] + fp.filter((item: string | number): item is number => typeof item === "number", d2); // $ExpectType number[] } // _.find -namespace TestFind { - let array: AbcObject[] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; - let obj: any = {}; - let dictionary: _.Dictionary | null | undefined = obj; - - let listIterator = (value: AbcObject, index: number, collection: _.List) => true; - let dictionaryIterator = (value: AbcObject, key: string, collection: _.Dictionary) => true; - - let result: AbcObject | undefined; - - result = _.find(array); - result = _.find(array, listIterator); - result = _.find(array, listIterator, 1); - result = _.find(array, ''); - result = _.find(array, '', 1); - result = _.find(array, {a: 42}); - result = _.find(array, {a: 42}, 1); - result = _.find(array, ['a', 5]); - result = _.find(array, ['a', 5], 1); - - result = _.find(list); - result = _.find(list, listIterator); - result = _.find(list, listIterator, 1); - result = _.find(list, ''); - result = _.find(list, '', 1); - result = _.find(list, {a: 42}); - result = _.find(list, {a: 42}, 1); - result = _.find(list, ['a', 5]); - result = _.find(list, ['a', 5], 1); - - result = _.find(dictionary); - result = _.find(dictionary, dictionaryIterator); - result = _.find(dictionary, dictionaryIterator, 1); - result = _.find(dictionary, ''); - result = _.find(dictionary, '', 1); - result = _.find(dictionary, {a: 42}); - result = _.find(dictionary, {a: 42}, 1); - result = _.find(dictionary, ['a', 5]); - result = _.find(dictionary, ['a', 5], 1); - - result = _(array).find(); - result = _(array).find(listIterator); - result = _(array).find(listIterator, 1); - result = _(array).find(''); - result = _(array).find('', 1); - result = _(array).find({a: 42}); - result = _(array).find({a: 42}, 1); - result = _(array).find(['a', 5]); - result = _(array).find(['a', 5], 1); - - result = _(list).find(); - result = _(list).find(listIterator); - result = _(list).find(listIterator, 1); - result = _(list).find(''); - result = _(list).find('', 1); - result = _(list).find({a: 42}); - result = _(list).find({a: 42}, 1); - result = _(list).find(['a', 5]); - result = _(list).find(['a', 5], 1); - - result = _(dictionary).find(); - result = _(dictionary).find(dictionaryIterator); - result = _(dictionary).find(dictionaryIterator, 1); - result = _(dictionary).find(''); - result = _(dictionary).find('', 1); - result = _(dictionary).find({a: 42}); - result = _(dictionary).find({a: 42}, 1); - result = _(dictionary).find(['a', 5]); - result = _(dictionary).find(['a', 5], 1); - - result = _.find([anything as AbcObject, null, undefined], (value: AbcObject | null | undefined): value is AbcObject | undefined => value !== null); - result = _([anything as AbcObject, null, undefined]).find((value: AbcObject | null | undefined): value is AbcObject | undefined => value !== null); -} - // _.findLast -namespace TestFindLast { - let array: AbcObject[] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; - let obj: any = {}; - let dictionary: _.Dictionary | null | undefined = obj; +{ + const list: _.List | null | undefined = anything; + const dictionary: _.Dictionary | null | undefined = anything; - let listIterator = (value: AbcObject, index: number, collection: _.List) => true; - let dictionaryIterator = (value: AbcObject, key: string, collection: _.Dictionary) => true; + const listIterator = (value: AbcObject, index: number, collection: _.List) => true; + const dictionaryIterator = (value: AbcObject, key: string, collection: _.Dictionary) => true; + const valueIterator = (value: AbcObject) => true; - let result: AbcObject | undefined; + _.find(list); // $ExpectType AbcObject | undefined + _.find(list, listIterator); // $ExpectType AbcObject | undefined + _.find(list, listIterator, 1); // $ExpectType AbcObject | undefined + _.find(list, "a"); // $ExpectType AbcObject | undefined + _.find(list, "a", 1); // $ExpectType AbcObject | undefined + _.find(list, { a: 42 }); // $ExpectType AbcObject | undefined + _.find(list, { a: 42 }, 1); // $ExpectType AbcObject | undefined + _.find(list, ["a", 5]); // $ExpectType AbcObject | undefined + _.find(list, ["a", 5], 1); // $ExpectType AbcObject | undefined + _.find(dictionary); // $ExpectType AbcObject | undefined + _.find(dictionary, dictionaryIterator); // $ExpectType AbcObject | undefined + _.find(dictionary, dictionaryIterator, 1); // $ExpectType AbcObject | undefined + _.find(dictionary, "a"); // $ExpectType AbcObject | undefined + _.find(dictionary, { a: 42 }); // $ExpectType AbcObject | undefined + _.find(dictionary, ["a", 5]); // $ExpectType AbcObject | undefined + _.find([anything as AbcObject, null, undefined], (value: AbcObject | null | undefined): value is AbcObject | undefined => value !== null); // $ExpectType AbcObject | undefined - result = _.findLast(array); - result = _.findLast(array, listIterator); - result = _.findLast(array, listIterator, 1); - result = _.findLast(array, ''); - result = _.findLast(array, '', 1); - result = _.findLast(array, {a: 42}); - result = _.findLast(array, {a: 42}, 1); - result = _.findLast(array, ['a', 5]); - result = _.findLast(array, ['a', 5], 1); + _(list).find(); // $ExpectType AbcObject | undefined + _(list).find(listIterator); // $ExpectType AbcObject | undefined + _(list).find(listIterator, 1); // $ExpectType AbcObject | undefined + _(list).find("a"); // $ExpectType AbcObject | undefined + _(list).find({ a: 42 }); // $ExpectType AbcObject | undefined + _(list).find(["a", 5]); // $ExpectType AbcObject | undefined + _(dictionary).find(); // $ExpectType AbcObject | undefined + _(dictionary).find(dictionaryIterator); // $ExpectType AbcObject | undefined + _(dictionary).find(dictionaryIterator, 1); // $ExpectType AbcObject | undefined + _(dictionary).find("a"); // $ExpectType AbcObject | undefined + _(dictionary).find({ a: 42 }); // $ExpectType AbcObject | undefined + _(dictionary).find(["a", 5]); // $ExpectType AbcObject | undefined + _([anything as AbcObject, null, undefined]).find((value: AbcObject | null | undefined): value is AbcObject | undefined => value !== null); // $ExpectType AbcObject | undefined - result = _.findLast(list); - result = _.findLast(list); - result = _.findLast(list, listIterator); - result = _.findLast(list, listIterator, 1); - result = _.findLast(list, ''); - result = _.findLast(list, '', 1); - result = _.findLast(list, {a: 42}); - result = _.findLast(list, {a: 42}, 1); - result = _.findLast(list, ['a', 5]); - result = _.findLast(list, ['a', 5], 1); + _.chain(list).find(); // $ExpectType LoDashExplicitWrapper + _.chain(list).find(listIterator); // $ExpectType LoDashExplicitWrapper + _.chain(list).find(listIterator, 1); // $ExpectType LoDashExplicitWrapper + _.chain(list).find("a"); // $ExpectType LoDashExplicitWrapper + _.chain(list).find({ a: 42 }); // $ExpectType LoDashExplicitWrapper + _.chain(list).find(["a", 5]); // $ExpectType LoDashExplicitWrapper + _.chain(dictionary).find(); // $ExpectType LoDashExplicitWrapper + _.chain(dictionary).find(dictionaryIterator); // $ExpectType LoDashExplicitWrapper + _.chain(dictionary).find(dictionaryIterator, 1); // $ExpectType LoDashExplicitWrapper + _.chain(dictionary).find(""); // $ExpectType LoDashExplicitWrapper + _.chain(dictionary).find({ a: 42 }); // $ExpectType LoDashExplicitWrapper + _.chain(dictionary).find(["a", 5]); // $ExpectType LoDashExplicitWrapper + // $ExpectType LoDashExplicitWrapper + _.chain([anything as AbcObject, null, undefined]).find((value: AbcObject | null | undefined): value is AbcObject | undefined => value !== null); - result = _.findLast(dictionary); - result = _.findLast(dictionary); - result = _.findLast(dictionary, dictionaryIterator); - result = _.findLast(dictionary, dictionaryIterator, 1); - result = _.findLast(dictionary, ''); - result = _.findLast(dictionary, '', 1); - result = _.findLast(dictionary, {a: 42}); - result = _.findLast(dictionary, {a: 42}, 1); - result = _.findLast(dictionary, ['a', 5]); - result = _.findLast(dictionary, ['a', 5], 1); + fp.find(valueIterator, list); // $ExpectType AbcObject | undefined + fp.find(valueIterator)(list); // $ExpectType AbcObject | undefined + fp.find("a", list); // $ExpectType AbcObject | undefined + fp.find({ a: 42 }, list); // $ExpectType AbcObject | undefined + fp.find(["a", 42], list); // $ExpectType AbcObject | undefined + fp.find(valueIterator, dictionary); // $ExpectType AbcObject | undefined + fp.find(valueIterator)(dictionary); // $ExpectType AbcObject | undefined + fp.find({ a: 42 }, dictionary); // $ExpectType AbcObject | undefined + fp.find(["a", 42], dictionary); // $ExpectType AbcObject | undefined + fp.find((value: AbcObject | null | undefined): value is AbcObject | undefined => value !== null, [anything as AbcObject, null, undefined]); // $ExpectType AbcObject | undefined + fp.findFrom(valueIterator, 1, list); // $ExpectType AbcObject | undefined + fp.findFrom(valueIterator)(1)(list); // $ExpectType AbcObject | undefined - result = _(array).findLast(); - result = _(array).findLast(listIterator); - result = _(array).findLast(listIterator, 1); - result = _(array).findLast(''); - result = _(array).findLast('', 1); - result = _(array).findLast({a: 42}); - result = _(array).findLast({a: 42}, 1); - result = _(array).findLast(['a', 5]); - result = _(array).findLast(['a', 5], 1); + _.findLast(list); // $ExpectType AbcObject | undefined + _.findLast(list, listIterator); // $ExpectType AbcObject | undefined + _.findLast(list, listIterator, 1); // $ExpectType AbcObject | undefined + _.findLast(list, "a"); // $ExpectType AbcObject | undefined + _.findLast(list, "a", 1); // $ExpectType AbcObject | undefined + _.findLast(list, { a: 42 }); // $ExpectType AbcObject | undefined + _.findLast(list, { a: 42 }, 1); // $ExpectType AbcObject | undefined + _.findLast(list, ["a", 5]); // $ExpectType AbcObject | undefined + _.findLast(list, ["a", 5], 1); // $ExpectType AbcObject | undefined + _.findLast(dictionary); // $ExpectType AbcObject | undefined + _.findLast(dictionary, dictionaryIterator); // $ExpectType AbcObject | undefined + _.findLast(dictionary, dictionaryIterator, 1); // $ExpectType AbcObject | undefined + _.findLast(dictionary, "a"); // $ExpectType AbcObject | undefined + _.findLast(dictionary, { a: 42 }); // $ExpectType AbcObject | undefined + _.findLast(dictionary, ["a", 5]); // $ExpectType AbcObject | undefined + _.findLast([anything as AbcObject, null, undefined], (value: AbcObject | null | undefined): value is AbcObject | undefined => value !== null); // $ExpectType AbcObject | undefined - result = _(list).findLast(); - result = _(list).findLast(listIterator); - result = _(list).findLast(listIterator, 1); - result = _(list).findLast(''); - result = _(list).findLast('', 1); - result = _(list).findLast({a: 42}); - result = _(list).findLast({a: 42}, 1); - result = _(list).findLast(['a', 5]); - result = _(list).findLast(['a', 5], 1); + _(list).findLast(); // $ExpectType AbcObject | undefined + _(list).findLast(listIterator); // $ExpectType AbcObject | undefined + _(list).findLast(listIterator, 1); // $ExpectType AbcObject | undefined + _(list).findLast("a"); // $ExpectType AbcObject | undefined + _(list).findLast({ a: 42 }); // $ExpectType AbcObject | undefined + _(list).findLast(["a", 5]); // $ExpectType AbcObject | undefined + _(dictionary).findLast(); // $ExpectType AbcObject | undefined + _(dictionary).findLast(dictionaryIterator); // $ExpectType AbcObject | undefined + _(dictionary).findLast(dictionaryIterator, 1); // $ExpectType AbcObject | undefined + _(dictionary).findLast("a"); // $ExpectType AbcObject | undefined + _(dictionary).findLast({ a: 42 }); // $ExpectType AbcObject | undefined + _(dictionary).findLast(["a", 5]); // $ExpectType AbcObject | undefined + _([anything as AbcObject, null, undefined]).findLast((value: AbcObject | null | undefined): value is AbcObject | undefined => value !== null); // $ExpectType AbcObject | undefined - result = _(dictionary).findLast(); - result = _(dictionary).findLast(dictionaryIterator); - result = _(dictionary).findLast(dictionaryIterator, 1); - result = _(dictionary).findLast(''); - result = _(dictionary).findLast('', 1); - result = _(dictionary).findLast({a: 42}); - result = _(dictionary).findLast({a: 42}, 1); - result = _(dictionary).findLast(['a', 5]); - result = _(dictionary).findLast(['a', 5], 1); + _.chain(list).findLast(); // $ExpectType LoDashExplicitWrapper + _.chain(list).findLast(listIterator); // $ExpectType LoDashExplicitWrapper + _.chain(list).findLast(listIterator, 1); // $ExpectType LoDashExplicitWrapper + _.chain(list).findLast("a"); // $ExpectType LoDashExplicitWrapper + _.chain(list).findLast({ a: 42 }); // $ExpectType LoDashExplicitWrapper + _.chain(list).findLast(["a", 5]); // $ExpectType LoDashExplicitWrapper + _.chain(dictionary).findLast(); // $ExpectType LoDashExplicitWrapper + _.chain(dictionary).findLast(dictionaryIterator); // $ExpectType LoDashExplicitWrapper + _.chain(dictionary).findLast(dictionaryIterator, 1); // $ExpectType LoDashExplicitWrapper + _.chain(dictionary).findLast(""); // $ExpectType LoDashExplicitWrapper + _.chain(dictionary).findLast({ a: 42 }); // $ExpectType LoDashExplicitWrapper + _.chain(dictionary).findLast(["a", 5]); // $ExpectType LoDashExplicitWrapper + // $ExpectType LoDashExplicitWrapper + _.chain([anything as AbcObject, null, undefined]).findLast((value: AbcObject | null | undefined): value is AbcObject | undefined => value !== null); - result = _.findLast([anything as AbcObject, null, undefined], (value: AbcObject | null | undefined): value is AbcObject | undefined => value !== null); - result = _([anything as AbcObject, null, undefined]).findLast((value: AbcObject | null | undefined): value is AbcObject | undefined => value !== null); + fp.findLast(valueIterator, list); // $ExpectType AbcObject | undefined + fp.findLast(valueIterator)(list); // $ExpectType AbcObject | undefined + fp.findLast("a", list); // $ExpectType AbcObject | undefined + fp.findLast({ a: 42 }, list); // $ExpectType AbcObject | undefined + fp.findLast(["a", 42], list); // $ExpectType AbcObject | undefined + fp.findLast(valueIterator, dictionary); // $ExpectType AbcObject | undefined + fp.findLast(valueIterator)(dictionary); // $ExpectType AbcObject | undefined + fp.findLast({ a: 42 }, dictionary); // $ExpectType AbcObject | undefined + fp.findLast(["a", 42], dictionary); // $ExpectType AbcObject | undefined + fp.findLast((value: AbcObject | null | undefined): value is AbcObject | undefined => value !== null, [anything as AbcObject, null, undefined]); // $ExpectType AbcObject | undefined + fp.findLastFrom(valueIterator, 1, list); // $ExpectType AbcObject | undefined + fp.findLastFrom(valueIterator)(1)(list); // $ExpectType AbcObject | undefined } // _.flatMap -namespace TestFlatMap { - let numArray: Array | null | undefined = [1, [2, 3]] as any; - let objArray: Array<{a: number}|Array<{a: number}>> | null | undefined = [{a: 1}, [{a: 2}, {a: 3}]] as any; +{ + const numList: _.List | null | undefined = anything; + const objList: _.List<{a: number}|Array<{a: number}>> | null | undefined = anything; + const numDictionary: _.Dictionary | null | undefined = anything; + const objDictionary: _.Dictionary<{a: number}|Array<{a: number}>> | null | undefined = anything; + const numNumericDictionary: _.NumericDictionary | null | undefined = anything; + const objNumericDictionary: _.NumericDictionary<{a: number}|Array<{a: number}>> | null | undefined = anything; - let obj: any = {}; - let numList: _.List | null | undefined = obj; - let objList: _.List<{a: number}|Array<{a: number}>> | null | undefined = obj; + const stringIterator = (value: string, index: number, collection: _.List): string | string[] => ""; + const listIterator = (value: number | number[], index: number, collection: _.List): number | number[] => 1; + const dictionaryIterator = (value: number | number[], key: string, collection: _.Dictionary): number | number[] => 1; + const numericDictionaryIterator = (value: number | number[], key: string, collection: _.NumericDictionary): number | number[] => 1; + const valueIterator = (value: number | number[]): number | number[] => 1; - let numDictionary: _.Dictionary | null | undefined = obj; - let objDictionary: _.Dictionary<{a: number}|Array<{a: number}>> | null | undefined = obj; + _.flatMap("abc"); // $ExpectType string[] + _.flatMap("abc", stringIterator); // $ExpectType string[] + _.flatMap(numList); // $ExpectType number[] + _.flatMap(numList, listIterator); // $ExpectType number[] + _.flatMap(objList, "a"); // $ExpectType any[] + _.flatMap(objList, ["a", 42]); // $ExpectType boolean[] + _.flatMap(objList, { a: 42 }); // $ExpectType boolean[] + _.flatMap(numDictionary); // $ExpectType number[] + _.flatMap(numDictionary, dictionaryIterator); // $ExpectType number[] + _.flatMap(objDictionary, "a"); // $ExpectType any[] + _.flatMap(objDictionary, ["a", 42]); // $ExpectType boolean[] + _.flatMap(objDictionary, { a: 42 }); // $ExpectType boolean[] + _.flatMap(numNumericDictionary); // $ExpectType number[] + _.flatMap(numNumericDictionary, numericDictionaryIterator); // $ExpectType number[] + _.flatMap(objNumericDictionary, "a"); // $ExpectType any[] + _.flatMap(objNumericDictionary, ["a", 42]); // $ExpectType boolean[] + _.flatMap(objNumericDictionary, { a: 42 }); // $ExpectType boolean[] - let numNumericDictionary: _.NumericDictionary | null | undefined = obj; - let objNumericDictionary: _.NumericDictionary<{a: number}|Array<{a: number}>> | null | undefined = obj; + _("abc").flatMap(stringIterator); // $ExpectType LoDashImplicitWrapper + _(numList).flatMap(); // $ExpectType LoDashImplicitWrapper + _(numList).flatMap(listIterator); // $ExpectType LoDashImplicitWrapper + _(objList).flatMap("a"); // $ExpectType LoDashImplicitWrapper + _(objList).flatMap(["a", 42]); // $ExpectType LoDashImplicitWrapper + _(objList).flatMap({ a: 42 }); // $ExpectType LoDashImplicitWrapper + _(numDictionary).flatMap(dictionaryIterator); // $ExpectType LoDashImplicitWrapper + _(objDictionary).flatMap("a"); // $ExpectType LoDashImplicitWrapper + _(numNumericDictionary).flatMap(numericDictionaryIterator); // $ExpectType LoDashImplicitWrapper + _(objNumericDictionary).flatMap("a"); // $ExpectType LoDashImplicitWrapper - let stringIterator: (value: string, index: number, collection: _.List) => string|string[] = (a, b, c) => ""; + _.chain("abc").flatMap(stringIterator); // $ExpectType LoDashExplicitWrapper + _.chain(numList).flatMap(); // $ExpectType LoDashExplicitWrapper + _.chain(numList).flatMap(listIterator); // $ExpectType LoDashExplicitWrapper + _.chain(objList).flatMap("a"); // $ExpectType LoDashExplicitWrapper + _.chain(objList).flatMap(["a", 42]); // $ExpectType LoDashExplicitWrapper + _.chain(objList).flatMap({ a: 42 }); // $ExpectType LoDashExplicitWrapper + _.chain(numDictionary).flatMap(dictionaryIterator); // $ExpectType LoDashExplicitWrapper + _.chain(objDictionary).flatMap("a"); // $ExpectType LoDashExplicitWrapper + _.chain(numNumericDictionary).flatMap(numericDictionaryIterator); // $ExpectType LoDashExplicitWrapper + _.chain(objNumericDictionary).flatMap("a"); // $ExpectType LoDashExplicitWrapper - let listIterator: (value: number|number[], index: number, collection: _.List) => number|number[] = (a, b, c) => 1; - - let dictionaryIterator: (value: number|number[], key: string, collection: _.Dictionary) => number|number[] = (a, b, c) => 1; - - let numericDictionaryIterator: (value: number|number[], key: string, collection: _.NumericDictionary) => number|number[] = (a, b, c) => 1; - - { - let result: string[]; - - result = _.flatMap('abc'); - result = _.flatMap('abc'); - - result = _.flatMap('abc', stringIterator); - result = _.flatMap('abc', stringIterator); - } - - { - let result: number[]; - - result = _.flatMap(numArray); - result = _.flatMap(numArray); - - result = _.flatMap(numArray, listIterator); - result = _.flatMap(numArray, listIterator); - - result = _.flatMap(objArray, 'a'); - - result = _.flatMap(numList); - result = _.flatMap(numList); - - result = _.flatMap(numList, listIterator); - result = _.flatMap(numList, listIterator); - - result = _.flatMap(objList, 'a'); - - result = _.flatMap(numDictionary); - result = _.flatMap(numDictionary); - - result = _.flatMap(numDictionary, dictionaryIterator); - - result = _.flatMap(objDictionary, 'a'); - - result = _.flatMap(numNumericDictionary); - result = _.flatMap(numNumericDictionary); - - result = _.flatMap(numNumericDictionary, numericDictionaryIterator); - - result = _.flatMap(objNumericDictionary, 'a'); - } - - { - let result: boolean[]; - - result = _.flatMap(objArray, ['a', 42]); - result = _.flatMap(objArray, {'a': 42}); - - result = _.flatMap(objList, ['a', 42]); - result = _.flatMap(objList, {'a': 42}); - - result = _.flatMap(objDictionary, ['a', 42]); - result = _.flatMap(objDictionary, {'a': 42}); - - result = _.flatMap(objNumericDictionary, ['a', 42]); - result = _.flatMap(objNumericDictionary, {'a': 42}); - } - - { - let result: _.LoDashImplicitArrayWrapper; - - result = _('abc').flatMap(); - } - - { - let result: _.LoDashImplicitArrayWrapper; - - result = _(numArray).flatMap(); - result = _(numArray).flatMap(listIterator); - result = _(objArray).flatMap('a'); - - result = _(numList).flatMap(); - result = _(numList).flatMap(listIterator); - result = _(objList).flatMap('a'); - - result = _(numDictionary).flatMap(); - result = _(numDictionary).flatMap(dictionaryIterator); - result = _(objDictionary).flatMap('a'); - - result = _(numNumericDictionary).flatMap(); - result = _(numNumericDictionary).flatMap(numericDictionaryIterator); - result = _(objNumericDictionary).flatMap('a'); - } - - { - let result: _.LoDashImplicitArrayWrapper; - - result = _(objArray).flatMap(['a', 42]); - result = _(objArray).flatMap({a: 42}); - - result = _(objList).flatMap(['a', 42]); - result = _(objList).flatMap({a: 42}); - - result = _(objDictionary).flatMap(['a', 42]); - result = _(objDictionary).flatMap({a: 42}); - - result = _(objNumericDictionary).flatMap(['a', 42]); - result = _(objNumericDictionary).flatMap({a: 42}); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _('abc').chain().flatMap(); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _(numArray).chain().flatMap(); - result = _(numArray).chain().flatMap(listIterator); - result = _(objArray).chain().flatMap('a'); - - result = _(numList).chain().flatMap(); - result = _(numList).chain().flatMap(listIterator); - result = _(objList).chain().flatMap('a'); - - result = _(numDictionary).chain().flatMap(); - result = _(numDictionary).chain().flatMap(dictionaryIterator); - result = _(objDictionary).chain().flatMap('a'); - - result = _(numNumericDictionary).chain().flatMap(); - result = _(numNumericDictionary).chain().flatMap(numericDictionaryIterator); - result = _(objNumericDictionary).chain().flatMap('a'); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _(objArray).chain().flatMap(['a', 42]); - result = _(objArray).chain().flatMap({a: 42}); - - result = _(objList).chain().flatMap(['a', 42]); - result = _(objList).chain().flatMap({a: 42}); - - result = _(objDictionary).chain().flatMap(['a', 42]); - result = _(objDictionary).chain().flatMap({a: 42}); - - result = _(objNumericDictionary).chain().flatMap(['a', 42]); - result = _(objNumericDictionary).chain().flatMap({a: 42}); - } - - { - interface SampleObject { - bar: number; - foo: string[]; - } - const obj: SampleObject = { - bar: 1, - foo: [''], - }; - - const result1: Array = _.flatMap(obj); - const result2: _.LoDashImplicitWrapper> = _(obj).flatMap(); - const result3: _.LoDashExplicitWrapper> = _.chain(obj).flatMap(); - } + fp.flatMap(valueIterator, numList); // $ExpectType number[] + fp.flatMap(valueIterator)(numList); // $ExpectType number[] + fp.flatMap("a", objList); // $ExpectType any[] + fp.flatMap({ a: 42 }, objList); // $ExpectType boolean[] + fp.flatMap(["a", 42], objList); // $ExpectType boolean[] + fp.flatMap(valueIterator, numDictionary); // $ExpectType number[] + fp.flatMap("a", objDictionary); // $ExpectType any[] + fp.flatMap({ a: 42 }, objDictionary); // $ExpectType boolean[] + fp.flatMap(["a", 42], objDictionary); // $ExpectType boolean[] + fp.flatMap(valueIterator, numNumericDictionary); // $ExpectType number[] + fp.flatMap("a", objNumericDictionary); // $ExpectType any[] + fp.flatMap({ a: 42 }, objNumericDictionary); // $ExpectType boolean[] + fp.flatMap(["a", 42], objNumericDictionary); // $ExpectType boolean[] } // _.flatMapDeep -namespace TestFlatMapDeep { - let numArray: Array | null | undefined = [1, [2, 3]] as any; - let objArray: Array<{a: number}|Array<{a: number}>> | null | undefined = [{a: 1}, [{a: 2}, {a: 3}]] as any; +{ + const numList: _.List | null | undefined = anything; + const objList: _.List<{a: number}|Array<{a: number}>> | null | undefined = anything; + const numDictionary: _.Dictionary | null | undefined = anything; + const objDictionary: _.Dictionary<{a: number}|Array<{a: number}>> | null | undefined = anything; + const numNumericDictionary: _.NumericDictionary | null | undefined = anything; + const objNumericDictionary: _.NumericDictionary<{a: number}|Array<{a: number}>> | null | undefined = anything; - let numList: _.List | null | undefined = anything; - let objList: _.List<{a: number}|Array<{a: number}>> | null | undefined = anything; + const stringIterator = (value: string, index: number, collection: _.List): _.ListOfRecursiveArraysOrValues | string => ""; + const listIterator = (value: number | number[], index: number, collection: _.List): _.ListOfRecursiveArraysOrValues | number => 1; + const dictionaryIterator = (value: number | number[], key: string, collection: _.Dictionary): _.ListOfRecursiveArraysOrValues | number => 1; + const numericDictionaryIterator = (value: number | number[], key: string, collection: _.NumericDictionary): _.ListOfRecursiveArraysOrValues | number => 1; + const valueIterator = (value: number | number[]): _.ListOfRecursiveArraysOrValues | number => 1; - let numDictionary: _.Dictionary | null | undefined = anything; - let objDictionary: _.Dictionary<{a: number}|Array<{a: number}>> | null | undefined = anything; + _.flatMapDeep("abc"); // $ExpectType string[] + _.flatMapDeep("abc", stringIterator); // $ExpectType string[] + _.flatMapDeep(numList); // $ExpectType number[] + _.flatMapDeep(numList, listIterator); // $ExpectType number[] + _.flatMapDeep(objList, "a"); // $ExpectType any[] + _.flatMapDeep(objList, ["a", 42]); // $ExpectType boolean[] + _.flatMapDeep(objList, { a: 42 }); // $ExpectType boolean[] + _.flatMapDeep(numDictionary); // $ExpectType number[] + _.flatMapDeep(numDictionary, dictionaryIterator); // $ExpectType number[] + _.flatMapDeep(objDictionary, "a"); // $ExpectType any[] + _.flatMapDeep(objDictionary, ["a", 42]); // $ExpectType boolean[] + _.flatMapDeep(objDictionary, { a: 42 }); // $ExpectType boolean[] + _.flatMapDeep(numNumericDictionary); // $ExpectType number[] + _.flatMapDeep(numNumericDictionary, numericDictionaryIterator); // $ExpectType number[] + _.flatMapDeep(objNumericDictionary, "a"); // $ExpectType any[] + _.flatMapDeep(objNumericDictionary, ["a", 42]); // $ExpectType boolean[] + _.flatMapDeep(objNumericDictionary, { a: 42 }); // $ExpectType boolean[] - let numNumericDictionary: _.NumericDictionary | null | undefined = anything; - let objNumericDictionary: _.NumericDictionary<{a: number}|Array<{a: number}>> | null | undefined = anything; + _("abc").flatMapDeep(stringIterator); // $ExpectType LoDashImplicitWrapper + _(numList).flatMapDeep(); // $ExpectType LoDashImplicitWrapper + _(numList).flatMapDeep(listIterator); // $ExpectType LoDashImplicitWrapper + _(objList).flatMapDeep("a"); // $ExpectType LoDashImplicitWrapper + _(objList).flatMapDeep(["a", 42]); // $ExpectType LoDashImplicitWrapper + _(objList).flatMapDeep({ a: 42 }); // $ExpectType LoDashImplicitWrapper + _(numDictionary).flatMapDeep(dictionaryIterator); // $ExpectType LoDashImplicitWrapper + _(objDictionary).flatMapDeep("a"); // $ExpectType LoDashImplicitWrapper + _(numNumericDictionary).flatMapDeep(numericDictionaryIterator); // $ExpectType LoDashImplicitWrapper + _(objNumericDictionary).flatMapDeep("a"); // $ExpectType LoDashImplicitWrapper - let stringIterator: (value: string, index: number, collection: _.List) => _.ListOfRecursiveArraysOrValues = (a, b, c) => ['a', 'b', 'c']; + _.chain("abc").flatMapDeep(stringIterator); // $ExpectType LoDashExplicitWrapper + _.chain(numList).flatMapDeep(); // $ExpectType LoDashExplicitWrapper + _.chain(numList).flatMapDeep(listIterator); // $ExpectType LoDashExplicitWrapper + _.chain(objList).flatMapDeep("a"); // $ExpectType LoDashExplicitWrapper + _.chain(objList).flatMapDeep(["a", 42]); // $ExpectType LoDashExplicitWrapper + _.chain(objList).flatMapDeep({ a: 42 }); // $ExpectType LoDashExplicitWrapper + _.chain(numDictionary).flatMapDeep(dictionaryIterator); // $ExpectType LoDashExplicitWrapper + _.chain(objDictionary).flatMapDeep("a"); // $ExpectType LoDashExplicitWrapper + _.chain(numNumericDictionary).flatMapDeep(numericDictionaryIterator); // $ExpectType LoDashExplicitWrapper + _.chain(objNumericDictionary).flatMapDeep("a"); // $ExpectType LoDashExplicitWrapper - let listIterator: (value: number|number[], index: number, collection: _.List) => _.ListOfRecursiveArraysOrValues = (a, b, c) => [1]; - - let dictionaryIterator: (value: number|number[], key: string, collection: _.Dictionary) =>_.ListOfRecursiveArraysOrValues = (a, b, c) => [1]; - - let numericDictionaryIterator: (value: number|number[], key: string, collection: _.NumericDictionary) => _.ListOfRecursiveArraysOrValues = (a, b, c) => [1]; - - { - let result: string[]; - - result = _.flatMapDeep('abc'); - - result = _.flatMapDeep('abc', stringIterator); - } - - { - let result: number[]; - - result = _.flatMapDeep(numArray); - - result = _.flatMapDeep(numArray, listIterator); - - result = _.flatMapDeep(objArray, 'a'); - - result = _.flatMapDeep(numList); - - result = _.flatMapDeep(numList, listIterator); - - result = _.flatMapDeep(objList, 'a'); - - result = _.flatMapDeep(numDictionary); - - result = _.flatMapDeep(numDictionary, dictionaryIterator); - - result = _.flatMapDeep(objDictionary, 'a'); - - result = _.flatMapDeep(numNumericDictionary); - - result = _.flatMapDeep(numNumericDictionary, numericDictionaryIterator); - - result = _.flatMapDeep(objNumericDictionary, 'a'); - } - - { - let result: boolean[]; - - result = _.flatMapDeep(objArray, ['a', 42]); - result = _.flatMapDeep(objArray, {'a': 42}); - - result = _.flatMapDeep(objList, ['a', 42]); - result = _.flatMapDeep(objList, {'a': 42}); - - result = _.flatMapDeep(objDictionary, ['a', 42]); - result = _.flatMapDeep(objDictionary, {'a': 42}); - - result = _.flatMapDeep(objNumericDictionary, ['a', 42]); - result = _.flatMapDeep(objNumericDictionary, {'a': 42}); - } - - { - let result: _.LoDashImplicitArrayWrapper; - - result = _('abc').flatMapDeep(); - result = _('abc').flatMapDeep(stringIterator); - } - - { - let result: _.LoDashImplicitArrayWrapper; - - result = _(numArray).flatMapDeep(); - result = _(numArray).flatMapDeep(listIterator); - result = _(objArray).flatMapDeep('a'); - - result = _(numList).flatMapDeep(); - result = _(numList).flatMapDeep(listIterator); - result = _(objList).flatMapDeep('a'); - - result = _(numDictionary).flatMapDeep(); - result = _(numDictionary).flatMapDeep(dictionaryIterator); - result = _(objDictionary).flatMapDeep('a'); - - result = _(numNumericDictionary).flatMapDeep(); - result = _(numNumericDictionary).flatMapDeep(numericDictionaryIterator); - result = _(objNumericDictionary).flatMapDeep('a'); - } - - { - let result: _.LoDashImplicitArrayWrapper; - - result = _(objArray).flatMapDeep(['a', 42]); - result = _(objArray).flatMapDeep({a: 42}); - - result = _(objList).flatMapDeep(['a', 42]); - result = _(objList).flatMapDeep({a: 42}); - - result = _(objDictionary).flatMapDeep(['a', 42]); - result = _(objDictionary).flatMapDeep({a: 42}); - - result = _(objNumericDictionary).flatMapDeep(['a', 42]); - result = _(objNumericDictionary).flatMapDeep({a: 42}); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _('abc').chain().flatMapDeep(); - result = _('abc').chain().flatMapDeep(stringIterator); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _(numArray).chain().flatMapDeep(); - result = _(numArray).chain().flatMapDeep(listIterator); - result = _(objArray).chain().flatMapDeep('a'); - - result = _(numList).chain().flatMapDeep(); - result = _(numList).chain().flatMapDeep(listIterator); - result = _(objList).chain().flatMapDeep('a'); - - result = _(numDictionary).chain().flatMapDeep(); - result = _(numDictionary).chain().flatMapDeep(dictionaryIterator); - result = _(objDictionary).chain().flatMapDeep('a'); - - result = _(numNumericDictionary).chain().flatMapDeep(); - result = _(numNumericDictionary).chain().flatMapDeep(numericDictionaryIterator); - result = _(objNumericDictionary).chain().flatMapDeep('a'); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _(objArray).chain().flatMapDeep(['a', 42]); - result = _(objArray).chain().flatMapDeep({a: 42}); - - result = _(objList).chain().flatMapDeep(['a', 42]); - result = _(objList).chain().flatMapDeep({a: 42}); - - result = _(objDictionary).chain().flatMapDeep(['a', 42]); - result = _(objDictionary).chain().flatMapDeep({a: 42}); - - result = _(objNumericDictionary).chain().flatMapDeep(['a', 42]); - result = _(objNumericDictionary).chain().flatMapDeep({a: 42}); - } + fp.flatMapDeep(valueIterator, numList); // $ExpectType number[] + fp.flatMapDeep(valueIterator)(numList); // $ExpectType number[] + fp.flatMapDeep("a", objList); // $ExpectType any[] + fp.flatMapDeep({ a: 42 }, objList); // $ExpectType boolean[] + fp.flatMapDeep(["a", 42], objList); // $ExpectType boolean[] + fp.flatMapDeep(valueIterator, numDictionary); // $ExpectType number[] + fp.flatMapDeep("a", objDictionary); // $ExpectType any[] + fp.flatMapDeep({ a: 42 }, objDictionary); // $ExpectType boolean[] + fp.flatMapDeep(["a", 42], objDictionary); // $ExpectType boolean[] + fp.flatMapDeep(valueIterator, numNumericDictionary); // $ExpectType number[] + fp.flatMapDeep("a", objNumericDictionary); // $ExpectType any[] + fp.flatMapDeep({ a: 42 }, objNumericDictionary); // $ExpectType boolean[] + fp.flatMapDeep(["a", 42], objNumericDictionary); // $ExpectType boolean[] } // _.flatMapDepth -namespace TestFlatMapDepth { - let numArray: Array | null | undefined = [1, [2, 3]] as any; - let objArray: Array<{a: number}|Array<{a: number}>> | null | undefined = [{a: 1}, [{a: 2}, {a: 3}]] as any; +{ + const numList: _.List | null | undefined = anything; + const objList: _.List<{a: number}|Array<{a: number}>> | null | undefined = anything; + const numDictionary: _.Dictionary | null | undefined = anything; + const objDictionary: _.Dictionary<{a: number}|Array<{a: number}>> | null | undefined = anything; + const numNumericDictionary: _.NumericDictionary | null | undefined = anything; + const objNumericDictionary: _.NumericDictionary<{a: number}|Array<{a: number}>> | null | undefined = anything; - let numList: _.List | null | undefined = anything; - let objList: _.List<{a: number}|Array<{a: number}>> | null | undefined = anything; + const stringIterator = (value: string, index: number, collection: _.List): _.ListOfRecursiveArraysOrValues | string => ""; + const listIterator = (value: number | number[], index: number, collection: _.List): _.ListOfRecursiveArraysOrValues | number => 1; + const dictionaryIterator = (value: number | number[], key: string, collection: _.Dictionary): _.ListOfRecursiveArraysOrValues | number => 1; + const numericDictionaryIterator = (value: number | number[], key: string, collection: _.NumericDictionary): _.ListOfRecursiveArraysOrValues | number => 1; + const valueIterator = (value: number | number[]): _.ListOfRecursiveArraysOrValues | number => 1; - let numDictionary: _.Dictionary | null | undefined = anything; - let objDictionary: _.Dictionary<{a: number}|Array<{a: number}>> | null | undefined = anything; + _.flatMapDepth("abc"); // $ExpectType string[] + _.flatMapDepth("abc", stringIterator); // $ExpectType string[] + _.flatMapDepth("abc", stringIterator, 3); // $ExpectType string[] + _.flatMapDepth(numList, listIterator, 3); // $ExpectType number[] + _.flatMapDepth(objList, "a", 3); // $ExpectType any[] + _.flatMapDepth(objList, ["a", 42], 3); // $ExpectType boolean[] + _.flatMapDepth(objList, { a: 42 }, 3); // $ExpectType boolean[] + _.flatMapDepth(numDictionary, dictionaryIterator, 3); // $ExpectType number[] + _.flatMapDepth(objDictionary, "a", 3); // $ExpectType any[] + _.flatMapDepth(objDictionary, ["a", 42], 3); // $ExpectType boolean[] + _.flatMapDepth(objDictionary, { a: 42 }, 3); // $ExpectType boolean[] + _.flatMapDepth(numNumericDictionary, numericDictionaryIterator, 3); // $ExpectType number[] + _.flatMapDepth(objNumericDictionary, "a", 3); // $ExpectType any[] + _.flatMapDepth(objNumericDictionary, ["a", 42], 3); // $ExpectType boolean[] + _.flatMapDepth(objNumericDictionary, { a: 42 }, 3); // $ExpectType boolean[] - let numNumericDictionary: _.NumericDictionary | null | undefined = anything; - let objNumericDictionary: _.NumericDictionary<{a: number}|Array<{a: number}>> | null | undefined = anything; + _("abc").flatMapDepth(stringIterator, 3); // $ExpectType LoDashImplicitWrapper + _(numList).flatMapDepth(listIterator, 3); // $ExpectType LoDashImplicitWrapper + _(objList).flatMapDepth("a", 3); // $ExpectType LoDashImplicitWrapper + _(objList).flatMapDepth(["a", 42], 3); // $ExpectType LoDashImplicitWrapper + _(objList).flatMapDepth({ a: 42 }, 3); // $ExpectType LoDashImplicitWrapper + _(numDictionary).flatMapDepth(dictionaryIterator, 3); // $ExpectType LoDashImplicitWrapper + _(objDictionary).flatMapDepth("a", 3); // $ExpectType LoDashImplicitWrapper + _(numNumericDictionary).flatMapDepth(numericDictionaryIterator, 3); // $ExpectType LoDashImplicitWrapper + _(objNumericDictionary).flatMapDepth("a", 3); // $ExpectType LoDashImplicitWrapper - let stringIterator: (value: string, index: number, collection: _.List) => _.ListOfRecursiveArraysOrValues = (a, b, c) => ""; + _.chain("abc").flatMapDepth(stringIterator, 3); // $ExpectType LoDashExplicitWrapper + _.chain(numList).flatMapDepth(listIterator, 3); // $ExpectType LoDashExplicitWrapper + _.chain(objList).flatMapDepth("a", 3); // $ExpectType LoDashExplicitWrapper + _.chain(objList).flatMapDepth(["a", 42], 3); // $ExpectType LoDashExplicitWrapper + _.chain(objList).flatMapDepth({ a: 42 }, 3); // $ExpectType LoDashExplicitWrapper + _.chain(numDictionary).flatMapDepth(dictionaryIterator, 3); // $ExpectType LoDashExplicitWrapper + _.chain(objDictionary).flatMapDepth("a", 3); // $ExpectType LoDashExplicitWrapper + _.chain(numNumericDictionary).flatMapDepth(numericDictionaryIterator, 3); // $ExpectType LoDashExplicitWrapper + _.chain(objNumericDictionary).flatMapDepth("a", 3); // $ExpectType LoDashExplicitWrapper - let listIterator: (value: number|number[], index: number, collection: _.List) => _.ListOfRecursiveArraysOrValues = (a, b, c) =>[ 1]; - - let dictionaryIterator: (value: number|number[], key: string, collection: _.Dictionary) => _.ListOfRecursiveArraysOrValues = (a, b, c) => [1]; - - let numericDictionaryIterator: (value: number|number[], key: string, collection: _.NumericDictionary) => _.ListOfRecursiveArraysOrValues = (a, b, c) => [1]; - - { - let result: string[]; - - result = _.flatMapDepth('abc'); - - result = _.flatMapDepth('abc', stringIterator, 1); - } - - { - let result: number[]; - - result = _.flatMapDepth(numArray); - - result = _.flatMapDepth(numArray, listIterator, 1); - - result = _.flatMapDepth(objArray, 'a'); - - result = _.flatMapDepth(numList); - - result = _.flatMapDepth(numList, listIterator, 1); - - result = _.flatMapDepth(objList, 'a', 1); - - result = _.flatMapDepth(numDictionary); - - result = _.flatMapDepth(numDictionary, dictionaryIterator, 1); - - result = _.flatMapDepth(objDictionary, 'a', 1); - - result = _.flatMapDepth(numNumericDictionary); - - result = _.flatMapDepth(numNumericDictionary, numericDictionaryIterator, 1); - - result = _.flatMapDepth(objNumericDictionary, 'a', 1); - } - - { - let result: boolean[]; - - result = _.flatMapDepth(objArray, ['a', 42], 1); - result = _.flatMapDepth(objArray, {'a': 42}, 1); - - result = _.flatMapDepth(objList, ['a', 42], 1); - result = _.flatMapDepth(objList, {'a': 42}, 1); - - result = _.flatMapDepth(objDictionary, ['a', 42], 1); - result = _.flatMapDepth(objDictionary, {'a': 42}, 1); - - result = _.flatMapDepth(objNumericDictionary, ['a', 42], 1); - result = _.flatMapDepth(objNumericDictionary, {'a': 42}, 1); - } - - { - let result: _.LoDashImplicitArrayWrapper; - - result = _('abc').flatMapDepth(); - result = _('abc').flatMapDepth(stringIterator, 1); - } - - { - let result: _.LoDashImplicitArrayWrapper; - - result = _(numArray).flatMapDepth(); - result = _(numArray).flatMapDepth(listIterator, 1); - result = _(objArray).flatMapDepth('a', 1); - - result = _(numList).flatMapDepth(); - result = _(numList).flatMapDepth(listIterator, 1); - result = _(objList).flatMapDepth('a', 1); - - result = _(numDictionary).flatMapDepth(); - result = _(numDictionary).flatMapDepth(dictionaryIterator, 1); - result = _(objDictionary).flatMapDepth('a', 1); - - result = _(numNumericDictionary).flatMapDepth(); - result = _(numNumericDictionary).flatMapDepth(numericDictionaryIterator, 1); - result = _(objNumericDictionary).flatMapDepth('a', 1); - } - - { - let result: _.LoDashImplicitArrayWrapper; - - result = _(objArray).flatMapDepth(['a', 42], 1); - result = _(objArray).flatMapDepth({a: 42}, 1); - - result = _(objList).flatMapDepth(['a', 42], 1); - result = _(objList).flatMapDepth({a: 42}, 1); - - result = _(objDictionary).flatMapDepth(['a', 42], 1); - result = _(objDictionary).flatMapDepth({a: 42}, 1); - - result = _(objNumericDictionary).flatMapDepth(['a', 42], 1); - result = _(objNumericDictionary).flatMapDepth({a: 42}, 1); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _('abc').chain().flatMapDepth(); - result = _('abc').chain().flatMapDepth(stringIterator, 1); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _(numArray).chain().flatMapDepth(); - result = _(numArray).chain().flatMapDepth(listIterator, 1); - result = _(objArray).chain().flatMapDepth('a', 1); - - result = _(numList).chain().flatMapDepth(); - result = _(numList).chain().flatMapDepth(listIterator, 1); - result = _(objList).chain().flatMapDepth('a', 1); - - result = _(numDictionary).chain().flatMapDepth(); - result = _(numDictionary).chain().flatMapDepth(dictionaryIterator, 1); - result = _(objDictionary).chain().flatMapDepth('a', 1); - - result = _(numNumericDictionary).chain().flatMapDepth(); - result = _(numNumericDictionary).chain().flatMapDepth(numericDictionaryIterator, 1); - result = _(objNumericDictionary).chain().flatMapDepth('a', 1); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _(objArray).chain().flatMapDepth(['a', 42], 1); - result = _(objArray).chain().flatMapDepth({a: 42}, 1); - - result = _(objList).chain().flatMapDepth(['a', 42], 1); - result = _(objList).chain().flatMapDepth({a: 42}, 1); - - result = _(objDictionary).chain().flatMapDepth(['a', 42], 1); - result = _(objDictionary).chain().flatMapDepth({a: 42}, 1); - - result = _(objNumericDictionary).chain().flatMapDepth(['a', 42], 1); - result = _(objNumericDictionary).chain().flatMapDepth({a: 42}, 1); - } + fp.flatMapDepth(valueIterator, 3, numList); // $ExpectType number[] + fp.flatMapDepth(valueIterator)(3)(numList); // $ExpectType number[] + fp.flatMapDepth("a", 3, objList); // $ExpectType any[] + fp.flatMapDepth({ a: 42 }, 3, objList); // $ExpectType boolean[] + fp.flatMapDepth(["a", 42], 3, objList); // $ExpectType boolean[] + fp.flatMapDepth(valueIterator, 3, numDictionary); // $ExpectType number[] + fp.flatMapDepth("a", 3, objDictionary); // $ExpectType any[] + fp.flatMapDepth({ a: 42 }, 3, objDictionary); // $ExpectType boolean[] + fp.flatMapDepth(["a", 42], 3, objDictionary); // $ExpectType boolean[] + fp.flatMapDepth(valueIterator, 3, numNumericDictionary); // $ExpectType number[] + fp.flatMapDepth("a", 3, objNumericDictionary); // $ExpectType any[] + fp.flatMapDepth({ a: 42 }, 3, objNumericDictionary); // $ExpectType boolean[] + fp.flatMapDepth(["a", 42], 3, objNumericDictionary); // $ExpectType boolean[] } // _.forEach -namespace TestForEach { +// _.forEachRight +// _.each +// _.eachRight +{ const str: string = anything; const nilStr: string | null | undefined = anything; const array: AbcObject[] = anything; @@ -5448,7 +2436,7 @@ namespace TestForEach { // $ExpectType LoDashImplicitWrapper> _(numericDictionary).forEach((value, index, collection) => { - /* Broken in TS 2.4: value; // AbcObject */ + // Broken in TS 2.4: value; // AbcObject index; // $ExpectType string collection; // $ExpectType NumericDictionary }); @@ -5461,2489 +2449,1369 @@ namespace TestForEach { }); // $ExpectType LoDashExplicitWrapper - _(str).chain().forEach((value, index, collection) => { + _.chain(str).forEach((value, index, collection) => { value; // $ExpectType string index; // $ExpectType number collection; // $ExpectType string }); // $ExpectType LoDashExplicitWrapper - _(nilStr).chain().forEach((value, index, collection) => { + _.chain(nilStr).forEach((value, index, collection) => { value; // $ExpectType string index; // $ExpectType number collection; // $ExpectType string }); // $ExpectType LoDashExplicitWrapper - _(array).chain().forEach((value, index, collection) => { + _.chain(array).forEach((value, index, collection) => { value; // $ExpectType AbcObject index; // $ExpectType number collection; // $ExpectType AbcObject[] }); // $ExpectType LoDashExplicitWrapper - _(nilArray).chain().forEach((value, index, collection) => { + _.chain(nilArray).forEach((value, index, collection) => { value; // $ExpectType AbcObject index; // $ExpectType number collection; // $ExpectType AbcObject[] }); // $ExpectType LoDashExplicitWrapper> - _(list).chain().forEach((value, index, collection) => { + _.chain(list).forEach((value, index, collection) => { value; // $ExpectType AbcObject index; // $ExpectType number collection; // $ExpectType ArrayLike }); // $ExpectType LoDashExplicitWrapper | null | undefined> - _(nilList).chain().forEach((value, index, collection) => { + _.chain(nilList).forEach((value, index, collection) => { value; // $ExpectType AbcObject index; // $ExpectType number collection; // $ExpectType ArrayLike }); // $ExpectType LoDashExplicitWrapper> - _(dictionary).chain().forEach((value, index, collection) => { + _.chain(dictionary).forEach((value, index, collection) => { value; // $ExpectType AbcObject index; // $ExpectType string collection; // $ExpectType Dictionary }); // $ExpectType LoDashExplicitWrapper | null | undefined> - _(nilDictionary).chain().forEach((value, index, collection) => { + _.chain(nilDictionary).forEach((value, index, collection) => { value; // $ExpectType AbcObject index; // $ExpectType string collection; // $ExpectType Dictionary }); // $ExpectType LoDashExplicitWrapper> - _(numericDictionary).chain().forEach((value, index, collection) => { - /* Broken in TS 2.4: value; // AbcObject */ + _.chain(numericDictionary).forEach((value, index, collection) => { + // Broken in TS 2.4: value; // AbcObject index; // $ExpectType string collection; // $ExpectType NumericDictionary }); // $ExpectType LoDashExplicitWrapper | null | undefined> - _(nilNumericDictionary).chain().forEach((value, index, collection) => { - /* Broken in TS 2.4: value; // AbcObject */ + _.chain(nilNumericDictionary).forEach((value, index, collection) => { + // Broken in TS 2.4: value; // AbcObject index; // $ExpectType string collection; // $ExpectType NumericDictionary }); -} -// _.forEachRight -namespace TestForEachRight { - let array: AbcObject[] = []; - let list: _.List = []; - let dictionary: _.Dictionary = {}; - let nilArray: AbcObject[] | null | undefined = [] as any; - let nilList: _.List | null | undefined = [] as any; - let nilDictionary: _.Dictionary | null | undefined = anything; + const stringIterator2 = (char: string) => 1; + const listIterator2 = (value: AbcObject) => 1; + fp.forEach(stringIterator2, ""); // $ExpectType string + fp.forEach(listIterator2, array); // $ExpectType AbcObject[] + fp.forEach(listIterator2)(array); // $ExpectType AbcObject[] + fp.forEach(listIterator2, list); // $ExpectType ArrayLike + fp.forEach(listIterator2, dictionary); // $ExpectType Dictionary + fp.forEach(listIterator2, nilArray); // $ExpectType AbcObject[] | null | undefined + fp.forEach(listIterator2, nilList); // $ExpectType ArrayLike | null | undefined + fp.forEach(listIterator2, nilDictionary); // $ExpectType Dictionary | null | undefined - let listIterator: (value: AbcObject, index: number, collection: _.List) => any = (value: AbcObject, index: number, collection: _.List) => 1; - let dictionaryIterator: (value: AbcObject, key: string, collection: _.Dictionary) => any = (value: AbcObject, key: string, collection: _.Dictionary) => 1; + // $ExpectType AbcObject[] + _.forEachRight(array, (value, index, collection) => { + value; // $ExpectType AbcObject + index; // $ExpectType number + collection; // $ExpectType AbcObject[] + }); + // $ExpectType ArrayLike | null | undefined + _.forEachRight(nilList, (value, index, collection) => { + value; // $ExpectType AbcObject + index; // $ExpectType number + collection; // $ExpectType ArrayLike + }); + // $ExpectType LoDashImplicitWrapper + _(array).forEachRight((value, index, collection) => { + value; // $ExpectType AbcObject + index; // $ExpectType number + collection; // $ExpectType AbcObject[] + }); + // $ExpectType LoDashImplicitWrapper | null | undefined> + _(nilList).forEachRight((value, index, collection) => { + value; // $ExpectType AbcObject + index; // $ExpectType number + collection; // $ExpectType ArrayLike + }); + // $ExpectType LoDashExplicitWrapper + _.chain(array).forEachRight((value, index, collection) => { + value; // $ExpectType AbcObject + index; // $ExpectType number + collection; // $ExpectType AbcObject[] + }); + // $ExpectType LoDashExplicitWrapper | null | undefined> + _.chain(nilList).forEachRight((value, index, collection) => { + value; // $ExpectType AbcObject + index; // $ExpectType number + collection; // $ExpectType ArrayLike + }); + fp.forEachRight(listIterator2, array); // $ExpectType AbcObject[] + fp.forEachRight(listIterator2)(array); // $ExpectType AbcObject[] - { - let result: string; + // $ExpectType AbcObject[] + _.each(array, (value, index, collection) => { + value; // $ExpectType AbcObject + index; // $ExpectType number + collection; // $ExpectType AbcObject[] + }); + // $ExpectType ArrayLike | null | undefined + _.each(nilList, (value, index, collection) => { + value; // $ExpectType AbcObject + index; // $ExpectType number + collection; // $ExpectType ArrayLike + }); + // $ExpectType LoDashImplicitWrapper + _(array).each((value, index, collection) => { + value; // $ExpectType AbcObject + index; // $ExpectType number + collection; // $ExpectType AbcObject[] + }); + // $ExpectType LoDashImplicitWrapper | null | undefined> + _(nilList).each((value, index, collection) => { + value; // $ExpectType AbcObject + index; // $ExpectType number + collection; // $ExpectType ArrayLike + }); + // $ExpectType LoDashExplicitWrapper + _.chain(array).each((value, index, collection) => { + value; // $ExpectType AbcObject + index; // $ExpectType number + collection; // $ExpectType AbcObject[] + }); + // $ExpectType LoDashExplicitWrapper | null | undefined> + _.chain(nilList).each((value, index, collection) => { + value; // $ExpectType AbcObject + index; // $ExpectType number + collection; // $ExpectType ArrayLike + }); + fp.each(listIterator2, array); // $ExpectType AbcObject[] + fp.each(listIterator2)(array); // $ExpectType AbcObject[] - result = _.forEachRight('', (value, index, collection) => { - value; // $ExpectType string - index; // $ExpectType number - collection; // $ExpectType string - }); - } - - { - let result: string | null | undefined; - - result = _.forEachRight('' as (string | null | undefined), (value, index, collection) => { - value; // $ExpectType string - index; // $ExpectType number - collection; // $ExpectType string - }); - } - - { - let result: AbcObject[]; - - result = _.forEachRight(array, (value, index, collection) => { - value; // $ExpectType AbcObject - index; // $ExpectType number - collection; // $ExpectType AbcObject[] - }); - } - - { - let result: AbcObject[] | null | undefined; - - result = _.forEachRight(nilArray, (value, index, collection) => { - value; // $ExpectType AbcObject - index; // $ExpectType number - collection; // $ExpectType AbcObject[] - }); - } - - { - let result: _.List; - - result = _.forEachRight(list, (value, index, collection) => { - value; // $ExpectType AbcObject - index; // $ExpectType number - collection; // $ExpectType ArrayLike - }); - } - - { - let result: _.List | null | undefined; - - result = _.forEachRight(nilList, (value, index, collection) => { - value; // $ExpectType AbcObject - index; // $ExpectType number - collection; // $ExpectType ArrayLike - }); - } - - { - let result: _.Dictionary; - - result = _.forEachRight(dictionary, (value, index, collection) => { - value; // $ExpectType AbcObject - index; // $ExpectType string - collection; // $ExpectType Dictionary - }); - } - - { - let result: _.Dictionary | null | undefined; - - result = _.forEachRight(nilDictionary, (value, index, collection) => { - value; // $ExpectType AbcObject - index; // $ExpectType string - collection; // $ExpectType Dictionary - }); - } - - { - let result: _.LoDashImplicitWrapper; - - result = _('').forEachRight((value, index, collection) => { - value; // $ExpectType string - index; // $ExpectType number - collection; // $ExpectType string - }); - } - - { - let result: _.LoDashImplicitArrayWrapper; - - result = _(array).forEachRight(listIterator); - } - - { - let result: _.LoDashImplicitNillableArrayWrapper; - - result = _(nilArray).forEachRight(listIterator); - } - - { - let result: _.LoDashImplicitObjectWrapper<_.List>; - - result = _(list).forEachRight(listIterator); - } - - { - let result: _.LoDashImplicitNillableObjectWrapper<_.List>; - - result = _(nilList).forEachRight(listIterator); - } - - { - let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; - - result = _(dictionary).forEachRight(dictionaryIterator); - } - - { - let result: _.LoDashImplicitNillableObjectWrapper<_.Dictionary>; - - result = _(nilDictionary).forEachRight(dictionaryIterator); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _('').chain().forEachRight((value, index, collection) => { - value; // $ExpectType string - index; // $ExpectType number - collection; // $ExpectType string - }); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _(array).chain().forEachRight((value, index, collection) => { - value; // $ExpectType AbcObject - index; // $ExpectType number - collection; // $ExpectType AbcObject[] - }); - } - - { - let result: _.LoDashExplicitNillableArrayWrapper; - - result = _(nilArray).chain().forEachRight((value, index, collection) => { - value; // $ExpectType AbcObject - index; // $ExpectType number - collection; // $ExpectType AbcObject[] - }); - } - - { - let result: _.LoDashExplicitObjectWrapper<_.List>; - - result = _(list).chain().forEachRight(listIterator); - } - - { - let result: _.LoDashExplicitNillableObjectWrapper<_.List>; - - result = _(nilList).chain().forEachRight(listIterator); - } - - { - let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; - - result = _(dictionary).chain().forEachRight(dictionaryIterator); - } - - { - let result: _.LoDashExplicitNillableObjectWrapper<_.Dictionary>; - - result = _(nilDictionary).chain().forEachRight(dictionaryIterator); - } + // $ExpectType AbcObject[] + _.eachRight(array, (value, index, collection) => { + value; // $ExpectType AbcObject + index; // $ExpectType number + collection; // $ExpectType AbcObject[] + }); + // $ExpectType ArrayLike | null | undefined + _.eachRight(nilList, (value, index, collection) => { + value; // $ExpectType AbcObject + index; // $ExpectType number + collection; // $ExpectType ArrayLike + }); + // $ExpectType LoDashImplicitWrapper + _(array).eachRight((value, index, collection) => { + value; // $ExpectType AbcObject + index; // $ExpectType number + collection; // $ExpectType AbcObject[] + }); + // $ExpectType LoDashImplicitWrapper | null | undefined> + _(nilList).eachRight((value, index, collection) => { + value; // $ExpectType AbcObject + index; // $ExpectType number + collection; // $ExpectType ArrayLike + }); + // $ExpectType LoDashExplicitWrapper + _.chain(array).eachRight((value, index, collection) => { + value; // $ExpectType AbcObject + index; // $ExpectType number + collection; // $ExpectType AbcObject[] + }); + // $ExpectType LoDashExplicitWrapper | null | undefined> + _.chain(nilList).eachRight((value, index, collection) => { + value; // $ExpectType AbcObject + index; // $ExpectType number + collection; // $ExpectType ArrayLike + }); + fp.eachRight(listIterator2, array); // $ExpectType AbcObject[] + fp.eachRight(listIterator2)(array); // $ExpectType AbcObject[] } // _.groupBy -namespace TestGroupBy { - type SampleType = {a: number; b: string; c: boolean;}; +{ + const list: _.List | null | undefined = [] as any; + const dictionary: _.Dictionary | null | undefined = anything; - let array: SampleType[] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; - let dictionary: _.Dictionary | null | undefined = anything; + const stringIterator = (char: string, index: number, string: string) => 0; + const listIterator = (value: AbcObject, index: number, collection: _.List) => 0; + const dictionaryIterator = (value: AbcObject, key: string, collection: _.Dictionary) => 0; + const valueIterator = (value: AbcObject) => 0; - let stringIterator = (char: string, index: number, string: string) => 0; - let listIterator = (value: SampleType, index: number, collection: _.List) => 0; - let dictionaryIterator = (value: SampleType, key: string, collection: _.Dictionary) => 0; + _.groupBy(""); // $ExpectType Dictionary + _.groupBy("", stringIterator); // $ExpectType Dictionary + _.groupBy(list); // $ExpectType Dictionary + _.groupBy(list, listIterator); // $ExpectType Dictionary + _.groupBy(list, "a"); // $ExpectType Dictionary + _.groupBy(list, { a: 42 }); // $ExpectType Dictionary + _.groupBy(dictionary); // $ExpectType Dictionary + _.groupBy(dictionary, dictionaryIterator); // $ExpectType Dictionary + _.groupBy(dictionary, ""); // $ExpectType Dictionary + _.groupBy(dictionary, { a: 42 }); // $ExpectType Dictionary - { - let result: _.Dictionary; + _("").groupBy(); // $ExpectType LoDashImplicitWrapper> + _("").groupBy((char: string, index: number, string: ArrayLike) => 0); // $ExpectType LoDashImplicitWrapper> + _(list).groupBy(); // $ExpectType LoDashImplicitWrapper> + _(list).groupBy(listIterator); // $ExpectType LoDashImplicitWrapper> + _(list).groupBy(""); // $ExpectType LoDashImplicitWrapper> + _(list).groupBy({ a: 42 }); // $ExpectType LoDashImplicitWrapper> + _(dictionary).groupBy(); // $ExpectType LoDashImplicitWrapper> + _(dictionary).groupBy(dictionaryIterator); // $ExpectType LoDashImplicitWrapper> + _(dictionary).groupBy(""); // $ExpectType LoDashImplicitWrapper> + _(dictionary).groupBy({ a: 42 }); // $ExpectType LoDashImplicitWrapper> - result = _.groupBy(''); - result = _.groupBy('', stringIterator); - } + _.chain("").groupBy(); // $ExpectType LoDashExplicitWrapper> + _.chain("").groupBy((char: string, index: number, string: ArrayLike) => 0); // $ExpectType LoDashExplicitWrapper> + _.chain(list).groupBy(); // $ExpectType LoDashExplicitWrapper> + _.chain(list).groupBy(listIterator); // $ExpectType LoDashExplicitWrapper> + _.chain(list).groupBy(""); // $ExpectType LoDashExplicitWrapper> + _.chain(list).groupBy({ a: 42 }); // $ExpectType LoDashExplicitWrapper> + _.chain(dictionary).groupBy(); // $ExpectType LoDashExplicitWrapper> + _.chain(dictionary).groupBy(dictionaryIterator); // $ExpectType LoDashExplicitWrapper> + _.chain(dictionary).groupBy(""); // $ExpectType LoDashExplicitWrapper> + _.chain(dictionary).groupBy({ a: 42 }); // $ExpectType LoDashExplicitWrapper> - { - let result: _.Dictionary; - - result = _.groupBy(array); - result = _.groupBy(array, listIterator); - result = _.groupBy(array, ''); - result = _.groupBy(array, {a: 42}); - - result = _.groupBy(list); - result = _.groupBy(list, listIterator); - result = _.groupBy(list, ''); - result = _.groupBy(list, {a: 42}); - - result = _.groupBy(dictionary); - result = _.groupBy(dictionary, dictionaryIterator); - result = _.groupBy(dictionary, ''); - result = _.groupBy(dictionary, {a: 42}); - } - - { - let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; - - result = _('').groupBy(); - result = _('').groupBy((char: string, index: number, string: ArrayLike) => 0); - } - - { - let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; - - result = _(array).groupBy(); - result = _(array).groupBy(listIterator); - result = _(array).groupBy(''); - result = _(array).groupBy({a: 42}); - - result = _(list).groupBy(); - result = _(list).groupBy(listIterator); - result = _(list).groupBy(''); - result = _(list).groupBy({a: 42}); - - result = _(dictionary).groupBy(); - result = _(dictionary).groupBy(dictionaryIterator); - result = _(dictionary).groupBy(''); - result = _(dictionary).groupBy({a: 42}); - } - - { - let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; - - result = _('').chain().groupBy(); - result = _('').chain().groupBy((char: string, index: number, string: ArrayLike) => 0); - } - - { - let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; - - result = _(array).chain().groupBy(); - result = _(array).chain().groupBy(listIterator); - result = _(array).chain().groupBy(''); - result = _(array).chain().groupBy({a: 42}); - - result = _(list).chain().groupBy(); - result = _(list).chain().groupBy(listIterator); - result = _(list).chain().groupBy(''); - result = _(list).chain().groupBy({a: 42}); - - result = _(dictionary).chain().groupBy(); - result = _(dictionary).chain().groupBy(dictionaryIterator); - result = _(dictionary).chain().groupBy(''); - result = _(dictionary).chain().groupBy({a: 42}); - } + fp.groupBy(valueIterator, list); // $ExpectType Dictionary + fp.groupBy(valueIterator)(list); // $ExpectType Dictionary + fp.groupBy("a", list); // $ExpectType Dictionary + fp.groupBy({ a: 42 }, list); // $ExpectType Dictionary + fp.groupBy(["a", 42], list); // $ExpectType Dictionary + fp.groupBy(valueIterator, dictionary); // $ExpectType Dictionary + fp.groupBy("a", dictionary); // $ExpectType Dictionary + fp.groupBy({ a: 42 }, dictionary); // $ExpectType Dictionary + fp.groupBy(["a", 42], dictionary); // $ExpectType Dictionary } // _.includes -namespace TestIncludes { - type SampleType = {a: string; b: number; c: boolean;}; +{ + const list: _.List | null | undefined = anything; + const dictionary: _.Dictionary | null | undefined = anything; + const target: AbcObject = { a: 42, b: "", c: true }; - let array: SampleType[] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; - let obj: any = {}; - let dictionary: _.Dictionary | null | undefined = obj; + _.includes(list, target); // $ExpectType boolean + _.includes(list, target, 42); // $ExpectType boolean + _.includes(dictionary, target); // $ExpectType boolean + _.includes(dictionary, target, 42); // $ExpectType boolean - let target: SampleType = { a: "", b: 1, c: true }; + _(list).includes(target); // $ExpectType boolean + _(list).includes(target, 42); // $ExpectType boolean + _(dictionary).includes(target); // $ExpectType boolean + _(dictionary).includes(target, 42); // $ExpectType boolean - { - let result: boolean; + _.chain(list).includes(target); // $ExpectType LoDashExplicitWrapper + _.chain(list).includes(target, 42); // $ExpectType LoDashExplicitWrapper + _.chain(dictionary).includes(target); // $ExpectType LoDashExplicitWrapper + _.chain(dictionary).includes(target, 42); // $ExpectType LoDashExplicitWrapper - result = _.includes(array, target); - result = _.includes(array, target, 42); + fp.includes(target, list); // $ExpectType boolean + fp.includes(target)(list); // $ExpectType boolean + fp.includes(target, dictionary); // $ExpectType boolean - 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); - } + fp.includesFrom(target, 42, list); // $ExpectType boolean + fp.includesFrom(target)(42)(list); // $ExpectType boolean + fp.includesFrom(target, 42, dictionary); // $ExpectType boolean } // _.keyBy -namespace TestKeyBy { - type SampleObject = {a: number; b: string; c: boolean;}; +{ + const list: _.List | null | undefined = anything; + const dictionary: _.Dictionary | null | undefined = anything; + const numericDictionary: _.NumericDictionary | null | undefined = anything; - let array: SampleObject[] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; - let obj: any = {}; - let dictionary: _.Dictionary | null | undefined = obj; - let numericDictionary: _.NumericDictionary | null | undefined = obj; + const stringIterator = (value: string, index: number, collection: string) => "a"; + const listIterator = (value: AbcObject, index: number, collection: _.List) => 1; + const dictionaryIterator = (value: AbcObject, key: string, collection: _.Dictionary) => Symbol.name; + const numericDictionaryIterator = (value: AbcObject, key: string, collection: _.NumericDictionary) => "a"; + const valueIterator = (value: AbcObject) => 1; - let stringIterator = (value: string, index: number, collection: string) => "a"; - let listIterator = (value: SampleObject, index: number, collection: _.List) => 1; - let dictionaryIterator = (value: SampleObject, key: string, collection: _.Dictionary) => Symbol.name; - let numericDictionaryIterator = (value: SampleObject, key: string, collection: _.NumericDictionary) => "a"; + _.keyBy("abcd"); // $ExpectType Dictionary + _.keyBy("abcd", stringIterator); // $ExpectType Dictionary + _.keyBy(list); // $ExpectType Dictionary + _.keyBy(list, listIterator); // $ExpectType Dictionary + _.keyBy(list, "a"); // $ExpectType Dictionary + _.keyBy(list, { a: 42 }); // $ExpectType Dictionary + _.keyBy(dictionary); // $ExpectType Dictionary + _.keyBy(dictionary, dictionaryIterator); // $ExpectType Dictionary + _.keyBy(dictionary, "a"); // $ExpectType Dictionary + _.keyBy(dictionary, { a: 42 }); // $ExpectType Dictionary + // These fail in TS 2.4 + // _.keyBy(numericDictionary); // Dictionary + // _.keyBy(numericDictionary, numericDictionaryIterator); // Dictionary + // _.keyBy(numericDictionary, "a"); // Dictionary + // _.keyBy(numericDictionary, { a: 42 }); // Dictionary - { - let result: _.Dictionary; + _("abcd").keyBy(); // $ExpectType LoDashImplicitWrapper> + _("abcd").keyBy(stringIterator); // $ExpectType LoDashImplicitWrapper> + _(list).keyBy(); // $ExpectType LoDashImplicitWrapper> + _(list).keyBy(listIterator); // $ExpectType LoDashImplicitWrapper> + _(list).keyBy("a"); // $ExpectType LoDashImplicitWrapper> + _(list).keyBy({ a: 42 }); // $ExpectType LoDashImplicitWrapper> + _(dictionary).keyBy(); // $ExpectType LoDashImplicitWrapper> + _(dictionary).keyBy(dictionaryIterator); // $ExpectType LoDashImplicitWrapper> + _(dictionary).keyBy("a"); // $ExpectType LoDashImplicitWrapper> + _(dictionary).keyBy({ a: 42 }); // $ExpectType LoDashImplicitWrapper> + // These fail in TS 2.4 + // _(numericDictionary).keyBy(); // LoDashImplicitWrapper> + // _(numericDictionary).keyBy(numericDictionaryIterator); // LoDashImplicitWrapper> + // _(numericDictionary).keyBy("a"); // LoDashImplicitWrapper> + // _(numericDictionary).keyBy({ a: 42 }); // LoDashImplicitWrapper> - result = _.keyBy('abcd'); - result = _.keyBy('abcd', stringIterator); - } + _.chain("abcd").keyBy(); // $ExpectType LoDashExplicitWrapper> + _.chain("abcd").keyBy(stringIterator); // $ExpectType LoDashExplicitWrapper> + _.chain(list).keyBy(); // $ExpectType LoDashExplicitWrapper> + _.chain(list).keyBy(listIterator); // $ExpectType LoDashExplicitWrapper> + _.chain(list).keyBy("a"); // $ExpectType LoDashExplicitWrapper> + _.chain(list).keyBy({ a: 42 }); // $ExpectType LoDashExplicitWrapper> + _.chain(dictionary).keyBy(); // $ExpectType LoDashExplicitWrapper> + _.chain(dictionary).keyBy(dictionaryIterator); // $ExpectType LoDashExplicitWrapper> + _.chain(dictionary).keyBy("a"); // $ExpectType LoDashExplicitWrapper> + _.chain(dictionary).keyBy({ a: 42 }); // $ExpectType LoDashExplicitWrapper> + // These fail in TS 2.4 + // _.chain(numericDictionary).keyBy(); // LoDashExplicitWrapper> + // _.chain(numericDictionary).keyBy(numericDictionaryIterator); // LoDashExplicitWrapper> + // _.chain(numericDictionary).keyBy("a"); // LoDashExplicitWrapper> + // _.chain(numericDictionary).keyBy({ a: 42 }); // LoDashExplicitWrapper> - { - let result: _.Dictionary; - - result = _.keyBy(array); - result = _.keyBy(array, listIterator); - result = _.keyBy(array, 'a'); - result = _.keyBy(array, {a: 42}); - - result = _.keyBy(list); - result = _.keyBy(list, listIterator); - result = _.keyBy(list, 'a'); - result = _.keyBy(list, {a: 42}); - - result = _.keyBy(numericDictionary); - result = _.keyBy(numericDictionary, numericDictionaryIterator); - result = _.keyBy(numericDictionary, 'a'); - result = _.keyBy(numericDictionary, {a: 42}); - - result = _.keyBy(dictionary); - result = _.keyBy(dictionary, dictionaryIterator); - result = _.keyBy(dictionary, 'a'); - result = _.keyBy(dictionary, {a: 42}); - } - - { - let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; - - result = _('abcd').keyBy(); - result = _('abcd').keyBy(stringIterator); - } - - { - let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; - - result = _(array).keyBy(); - result = _(array).keyBy(listIterator); - result = _(array).keyBy('a'); - result = _(array).keyBy({a: 42}); - - result = _(list).keyBy(); - result = _(list).keyBy(listIterator); - result = _(list).keyBy('a'); - result = _(list).keyBy({a: 42}); - - result = _(numericDictionary).keyBy(); - result = _(numericDictionary).keyBy(numericDictionaryIterator); - result = _(numericDictionary).keyBy('a'); - result = _(numericDictionary).keyBy({a: 42}); - - result = _(dictionary).keyBy(); - result = _(dictionary).keyBy(dictionaryIterator); - result = _(dictionary).keyBy('a'); - result = _(dictionary).keyBy({a: 42}); - } - - { - let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; - - result = _('abcd').chain().keyBy(); - result = _('abcd').chain().keyBy(stringIterator); - } - - { - let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; - - result = _(array).chain().keyBy(); - result = _(array).chain().keyBy(listIterator); - result = _(array).chain().keyBy('a'); - result = _(array).chain().keyBy({a: 42}); - - result = _(list).chain().keyBy(); - result = _(list).chain().keyBy(listIterator); - result = _(list).chain().keyBy('a'); - result = _(list).chain().keyBy({a: 42}); - - result = _(numericDictionary).chain().keyBy(); - result = _(numericDictionary).chain().keyBy(numericDictionaryIterator); - result = _(numericDictionary).chain().keyBy('a'); - result = _(numericDictionary).chain().keyBy({a: 42}); - - result = _(dictionary).chain().keyBy(); - result = _(dictionary).chain().keyBy(dictionaryIterator); - result = _(dictionary).chain().keyBy('a'); - result = _(dictionary).chain().keyBy({a: 42}); - } + fp.keyBy(valueIterator, list); // $ExpectType Dictionary + fp.keyBy(valueIterator)(list); // $ExpectType Dictionary + fp.keyBy("a", list); // $ExpectType Dictionary + fp.keyBy({ a: 42 }, list); // $ExpectType Dictionary + fp.keyBy(["a", 42], list); // $ExpectType Dictionary + fp.keyBy(valueIterator, dictionary); // $ExpectType Dictionary + fp.keyBy("a", dictionary); // $ExpectType Dictionary + fp.keyBy({ a: 42 }, dictionary); // $ExpectType Dictionary + fp.keyBy(["a", 42], dictionary); // $ExpectType Dictionary + // These fail in TS 2.4 + // fp.keyBy(valueIterator, numericDictionary); // Dictionary + // fp.keyBy("a", numericDictionary); // Dictionary + // fp.keyBy({ a: 42 }, numericDictionary); // Dictionary + // fp.keyBy(["a", 42], numericDictionary); // Dictionary } -//_.invoke -namespace TestInvoke { - let boolArray: boolean[] = [true, false]; +// _.invoke +{ + const array = [(n?: number) => {}]; + const nestedDict = { a: [(n?: number) => {}] }; - let nestedDict: _.Dictionary = { - a: [0, 1, 2] - } + _.invoke(array, "[0]"); // $ExpectType any + _.invoke(array, "[0]", 2); // $ExpectType any + _.invoke(array, [0, "call"]); // $ExpectType any + _.invoke(array, [0, "call"], 2); // $ExpectType any - let numDict: _.Dictionary = { - a: 1, - b: 2, - c: 3, - d: 4 - } + _.invoke(nestedDict, ["a[0].toString"]); // $ExpectType any + _.invoke(nestedDict, ["a[0].toString"], 2); // $ExpectType any + _.invoke(nestedDict, ["a", 0, "toString"]); // $ExpectType any + _.invoke(nestedDict, ["a", 0, "toString"], 2); // $ExpectType any - let result: string; + _(array).invoke("[0]"); // $ExpectType any + _(array).invoke("[0]", 2); // $ExpectType any + _(array).invoke([0, "call"]); // $ExpectType any + _(array).invoke([0, "call"], 2); // $ExpectType any - result = _.invoke(boolArray, "[1]"); - result = _.invoke(boolArray, "[1]", 2); - result = _.invoke(boolArray, [1, "toString"]); - result = _.invoke(boolArray, [1, "toString"], 2); + _(nestedDict).invoke(["a[0].toString"]); // $ExpectType any + _(nestedDict).invoke(["a[0].toString"], 2); // $ExpectType any + _(nestedDict).invoke(["a", 0, "toString"]); // $ExpectType any + _(nestedDict).invoke(["a", 0, "toString"], 2); // $ExpectType any - result = _.invoke(boolArray, "[1]"); - result = _.invoke(boolArray, "[1]", 2); - result = _.invoke(boolArray, [1, "toString"]); - result = _.invoke(boolArray, [1, "toString"], 2); + _.chain(array).invoke("[0]"); // $ExpectType LoDashExplicitWrapper + _.chain(array).invoke("[0]", 2); // $ExpectType LoDashExplicitWrapper + _.chain(array).invoke([0, "call"]); // $ExpectType LoDashExplicitWrapper + _.chain(array).invoke([0, "call"], 2); // $ExpectType LoDashExplicitWrapper - result = _.invoke(numDict, "a.toString"); - result = _.invoke(numDict, "a.toString", 2); - result = _.invoke(numDict, ["a", "toString"]); - result = _.invoke(numDict, ["a", "toString"], 2); + _.chain(nestedDict).invoke(["a[0].toString"]); // $ExpectType LoDashExplicitWrapper + _.chain(nestedDict).invoke(["a[0].toString"], 2); // $ExpectType LoDashExplicitWrapper + _.chain(nestedDict).invoke(["a", 0, "toString"]); // $ExpectType LoDashExplicitWrapper + _.chain(nestedDict).invoke(["a", 0, "toString"], 2); // $ExpectType LoDashExplicitWrapper - result = _.invoke(numDict, "a.toString"); - result = _.invoke(numDict, "a.toString", 2); - result = _.invoke(numDict, ["a", "toString"]); - result = _.invoke(numDict, ["a", "toString"], 2); + fp.invoke("[0]", array); // $ExpectType any + fp.invoke("[0]")(array); // $ExpectType any + fp.invoke(["[0]", 2], array); // $ExpectType any - result = _.invoke(nestedDict, ["a[0].toString"]); - result = _.invoke(nestedDict, ["a[0].toString"], 2); - result = _.invoke(nestedDict, ["a", 0, "toString"]); - result = _.invoke(nestedDict, ["a", 0, "toString"], 2); - - result = _.invoke(nestedDict, ["a[0].toString"]); - result = _.invoke(nestedDict, ["a[0].toString"], 2); - result = _.invoke(nestedDict, ["a", 0, "toString"]); - result = _.invoke(nestedDict, ["a", 0, "toString"], 2); - - result = _(boolArray).invoke("[1]"); - result = _(boolArray).invoke("[1]", 2); - result = _(boolArray).invoke([1, "toString"]); - result = _(boolArray).invoke([1, "toString"], 2); - - result = _(numDict).invoke("a.toString"); - result = _(numDict).invoke("a.toString", 2); - result = _(numDict).invoke(["a", "toString"]); - result = _(numDict).invoke(["a", "toString"], 2); - - result = _(nestedDict).invoke("a[0].toString"); - result = _(nestedDict).invoke("a[0].toString", 2); - result = _(nestedDict).invoke(["a", 0, "toString"]); - result = _(nestedDict).invoke(["a", 0, "toString"], 2); - - { - let result: _.LoDashExplicitWrapper; - - result = _(boolArray).chain().invoke("[1]"); - result = _(boolArray).chain().invoke("[1]", 2); - result = _(boolArray).chain().invoke([1, "toString"]); - result = _(boolArray).chain().invoke([1, "toString"], 2); - - result = _(numDict).chain().invoke("a.toString"); - result = _(numDict).chain().invoke("a.toString", 2); - result = _(numDict).chain().invoke(["a", "toString"]); - result = _(numDict).chain().invoke(["a", "toString"], 2); - - result = _(nestedDict).chain().invoke("a[0].toString"); - result = _(nestedDict).chain().invoke("a[0].toString", 2); - result = _(nestedDict).chain().invoke(["a", 0, "toString"]); - result = _(nestedDict).chain().invoke(["a", 0, "toString"], 2); - } + fp.invoke("a[0].toString", nestedDict); // $ExpectType any + fp.invoke(["a", 0, "toString"], nestedDict); // $ExpectType any } -//_.invokeMap -namespace TestInvokeMap { - let numArray: number[] | null | undefined = [4, 2, 1, 3] as any; - let obj: _.Dictionary = { - a: 1, - b: 2, - c: 3, - d: 4 - }; - let numDict: _.Dictionary | null | undefined = obj as any; +// _.invokeMap +{ + const numArray: number[] | null | undefined = anything; + const numDict: _.Dictionary | null | undefined = anything; - let result: string[]; - result = _.invokeMap(numArray, 'toString'); - result = _.invokeMap(numArray, 'toString', 2); - result = _.invokeMap(numArray, 'toString'); - result = _.invokeMap(numArray, 'toString', 2); - result = _(numArray).invokeMap('toString').value(); - result = _(numArray).invokeMap('toString', 2).value(); - result = _(numArray).chain().invokeMap('toString').value(); - result = _(numArray).chain().invokeMap('toString', 2).value(); + _.invokeMap(numArray, "toString"); // $ExpectType any[] + _.invokeMap(numArray, "toString", 2); // $ExpectType any[] + _.invokeMap(numArray, Number.prototype.toString); // $ExpectType string[] + _.invokeMap(numDict, "toString"); // $ExpectType any[] - result = _.invokeMap(numArray, Number.prototype.toString); - result = _.invokeMap(numArray, Number.prototype.toString, 2); - result = _.invokeMap(numArray, Number.prototype.toString); - result = _.invokeMap(numArray, Number.prototype.toString, 2); - result = _(numArray).invokeMap(Number.prototype.toString).value(); - result = _(numArray).invokeMap(Number.prototype.toString, 2).value(); - result = _(numArray).chain().invokeMap(Number.prototype.toString).value(); - result = _(numArray).chain().invokeMap(Number.prototype.toString, 2).value(); + _(numArray).invokeMap("toString"); // $ExpectType LoDashImplicitWrapper + _(numArray).invokeMap("toString", 2); // $ExpectType LoDashImplicitWrapper + _(numArray).invokeMap(Number.prototype.toString); // $ExpectType LoDashImplicitWrapper + _(numDict).invokeMap("toString"); // $ExpectType LoDashImplicitWrapper - result = _.invokeMap(numDict, 'toString'); - result = _.invokeMap(numDict, 'toString', 2); - result = _.invokeMap(numDict, 'toString'); - result = _.invokeMap(numDict, 'toString', 2); - result = _(numDict).invokeMap('toString').value(); - result = _(numDict).invokeMap('toString', 2).value(); - result = _(numDict).chain().invokeMap('toString').value(); - result = _(numDict).chain().invokeMap('toString', 2).value(); + _.chain(numArray).invokeMap("toString"); // $ExpectType LoDashExplicitWrapper + _.chain(numArray).invokeMap("toString", 2); // $ExpectType LoDashExplicitWrapper + _.chain(numArray).invokeMap(Number.prototype.toString); // $ExpectType LoDashExplicitWrapper + _.chain(numDict).invokeMap("toString"); // $ExpectType LoDashExplicitWrapper - result = _.invokeMap(numDict, Number.prototype.toString); - result = _.invokeMap(numDict, Number.prototype.toString, 2); - result = _.invokeMap(numDict, Number.prototype.toString); - result = _.invokeMap(numDict, Number.prototype.toString, 2); - result = _(numDict).invokeMap(Number.prototype.toString).value(); - result = _(numDict).invokeMap(Number.prototype.toString, 2).value(); - result = _(numDict).chain().invokeMap(Number.prototype.toString).value(); - result = _(numDict).chain().invokeMap(Number.prototype.toString, 2).value(); + fp.invokeMap("toString", numArray); // $ExpectType any[] + fp.invokeMap("toString")(numArray); // $ExpectType any[] + fp.invokeMap(Number.prototype.toString, numArray); // $ExpectType string[] + fp.invokeMap("toString", numDict); // $ExpectType any[] + fp.invokeMap(Number.prototype.toString, numDict); // $ExpectType string[] + + fp.invokeArgsMap("toString", [16], numArray); // $ExpectType any[] + fp.invokeArgsMap("toString")([16])(numArray); // $ExpectType any[] + fp.invokeArgsMap(Number.prototype.toString, [16], numArray); // $ExpectType string[] + fp.invokeArgsMap("toString", [16], numDict); // $ExpectType any[] + fp.invokeArgsMap(Number.prototype.toString, [16], numDict); // $ExpectType string[] } // _.map -namespace TestMap { - const array: AbcObject[] | null | undefined = anything; +{ const list: _.List | null | undefined = anything; const dictionary: _.Dictionary | null | undefined = anything; const numericDictionary: _.NumericDictionary | null | undefined = anything; const abcObject: AbcObject = anything; - { - _.map(array); // $ExpectType AbcObject[] - // $ExpectType number[] - _.map(array, (value, index, collection) => { - value; // $ExpectType AbcObject - index; // $ExpectType number - collection; // $ExpectType AbcObject[] - return 0; - }); + _.map(list); // $ExpectType AbcObject[] + // $ExpectType number[] + _.map(list, (value, index, collection) => { + value; // $ExpectType AbcObject + index; // $ExpectType number + collection; // $ExpectType ArrayLike + return 0; + }); + _.map(dictionary); // $ExpectType AbcObject[] + // $ExpectType number[] + _.map(dictionary, (value, key, collection) => { + value; // $ExpectType AbcObject + key; // $ExpectType string + collection; // $ExpectType Dictionary + return 0; + }); + _.map(numericDictionary); // $ExpectType AbcObject[] + // $ExpectType number[] + _.map(numericDictionary, (value, key, collection) => { + /* Broken in TS 2.4: value; // AbcObject */ + key; // $ExpectType string + collection; // $ExpectType NumericDictionary + return 0; + }); + _.map(list, "a"); // $ExpectType number[] + _.map(dictionary, "a"); // $ExpectType number[] + _.map(numericDictionary, "a"); // $ExpectType number[] + _.map(list, "d.0.b"); // $ExpectType any[] + _.map(dictionary, "d.0.b"); // $ExpectType any[] + _.map(numericDictionary, "d.0.b"); // $ExpectType any[] + _.map(list, { a: 42 }); // $ExpectType boolean[] + _.map(dictionary, { a: 42 }); // $ExpectType boolean[] + _.map(numericDictionary, { a: 42 }); // $ExpectType boolean[] - _.map(list); // $ExpectType AbcObject[] - // $ExpectType number[] - _.map(list, (value, index, collection) => { - value; // $ExpectType AbcObject - index; // $ExpectType number - collection; // $ExpectType ArrayLike - return 0; - }); + _(list).map(); // $ExpectType LoDashImplicitWrapper + // $ExpectType LoDashImplicitWrapper + _(list).map((value, index, collection) => { + value; // $ExpectType AbcObject + index; // $ExpectType number + collection; // $ExpectType ArrayLike + return 0; + }); + _(dictionary).map(); // $ExpectType LoDashImplicitWrapper + // $ExpectType LoDashImplicitWrapper + _(dictionary).map((value, key, collection) => { + value; // $ExpectType AbcObject + key; // $ExpectType string + collection; // $ExpectType Dictionary + return 0; + }); + _(numericDictionary).map(); // $ExpectType LoDashImplicitWrapper + // $ExpectType LoDashImplicitWrapper + _(numericDictionary).map((value, key, collection) => { + /* Broken in TS 2.4: value; // AbcObject */ + key; // $ExpectType string + collection; // $ExpectType NumericDictionary + return 0; + }); + _(list).map("a"); // $ExpectType LoDashImplicitWrapper + _(dictionary).map("a"); // $ExpectType LoDashImplicitWrapper + _(numericDictionary).map("a"); // $ExpectType LoDashImplicitWrapper + _(list).map("d.0.b"); // $ExpectType LoDashImplicitWrapper + _(dictionary).map("d.0.b"); // $ExpectType LoDashImplicitWrapper + _(numericDictionary).map("d.0.b"); // $ExpectType LoDashImplicitWrapper + _(list).map({ a: 42 }); // $ExpectType LoDashImplicitWrapper + _(dictionary).map({ a: 42 }); // $ExpectType LoDashImplicitWrapper + _(numericDictionary).map({ a: 42 }); // $ExpectType LoDashImplicitWrapper - _.map(dictionary); // $ExpectType AbcObject[] - // $ExpectType number[] - _.map(dictionary, (value, key, collection) => { - value; // $ExpectType AbcObject - key; // $ExpectType string - collection; // $ExpectType Dictionary - return 0; - }); + _.chain(list).map(); // $ExpectType LoDashExplicitWrapper + // $ExpectType LoDashExplicitWrapper + _.chain(list).map((value, index, collection) => { + value; // $ExpectType AbcObject + index; // $ExpectType number + collection; // $ExpectType ArrayLike + return 0; + }); + _.chain(dictionary).map(); // $ExpectType LoDashExplicitWrapper + // $ExpectType LoDashExplicitWrapper + _.chain(dictionary).map((value, key, collection) => { + value; // $ExpectType AbcObject + key; // $ExpectType string + collection; // $ExpectType Dictionary + return 0; + }); + _.chain(numericDictionary).map(); // $ExpectType LoDashExplicitWrapper + // $ExpectType LoDashExplicitWrapper + _.chain(numericDictionary).map((value, key, collection) => { + /* Broken in TS 2.4: value; // AbcObject */ + key; // $ExpectType string + collection; // $ExpectType NumericDictionary + return 0; + }); + _.chain(list).map("a"); // $ExpectType LoDashExplicitWrapper + _.chain(dictionary).map("a"); // $ExpectType LoDashExplicitWrapper + _.chain(numericDictionary).map("a"); // $ExpectType LoDashExplicitWrapper + _.chain(list).map("d.0.b"); // $ExpectType LoDashExplicitWrapper + _.chain(dictionary).map("d.0.b"); // $ExpectType LoDashExplicitWrapper + _.chain(numericDictionary).map("d.0.b"); // $ExpectType LoDashExplicitWrapper + _.chain(list).map({ a: 42 }); // $ExpectType LoDashExplicitWrapper + _.chain(dictionary).map({ a: 42 }); // $ExpectType LoDashExplicitWrapper + _.chain(numericDictionary).map({ a: 42 }); // $ExpectType LoDashExplicitWrapper - _.map(numericDictionary); // $ExpectType AbcObject[] - // $ExpectType number[] - _.map(numericDictionary, (value, key, collection) => { - /* Broken in TS 2.4: value; // AbcObject */ - key; // $ExpectType string - collection; // $ExpectType NumericDictionary - return 0; - }); - - _.map(array, 'a'); // $ExpectType number[] - _.map(list, 'a'); // $ExpectType number[] - _.map(dictionary, 'a'); // $ExpectType number[] - _.map(numericDictionary, 'a'); // $ExpectType number[] - - _.map(array, 'd.0.b'); // $ExpectType any[] - _.map(list, 'd.0.b'); // $ExpectType any[] - _.map(dictionary, 'd.0.b'); // $ExpectType any[] - _.map(numericDictionary, 'd.0.b'); // $ExpectType any[] - - // _.matches iteratee shorthand. - _.map(array, {}); // $ExpectType boolean[] - _.map(list, {}); // $ExpectType boolean[] - _.map(dictionary, {}); // $ExpectType boolean[] - _.map(numericDictionary, {}); // $ExpectType boolean[] - } - - { - _(array).map(); // $ExpectType LoDashImplicitWrapper - // $ExpectType LoDashImplicitWrapper - _(array).map((value, index, collection) => { - value; // $ExpectType AbcObject - index; // $ExpectType number - collection; // $ExpectType AbcObject[] - return 0; - }); - - _(list).map(); // $ExpectType LoDashImplicitWrapper - // $ExpectType LoDashImplicitWrapper - _(list).map((value, index, collection) => { - value; // $ExpectType AbcObject - index; // $ExpectType number - collection; // $ExpectType ArrayLike - return 0; - }); - - _(dictionary).map(); // $ExpectType LoDashImplicitWrapper - // $ExpectType LoDashImplicitWrapper - _(dictionary).map((value, key, collection) => { - value; // $ExpectType AbcObject - key; // $ExpectType string - collection; // $ExpectType Dictionary - return 0; - }); - - _(numericDictionary).map(); // $ExpectType LoDashImplicitWrapper - // $ExpectType LoDashImplicitWrapper - _(numericDictionary).map((value, key, collection) => { - /* Broken in TS 2.4: value; // AbcObject */ - key; // $ExpectType string - collection; // $ExpectType NumericDictionary - return 0; - }); - - _(array).map('a'); // $ExpectType LoDashImplicitWrapper - _(list).map('a'); // $ExpectType LoDashImplicitWrapper - _(dictionary).map('a'); // $ExpectType LoDashImplicitWrapper - _(numericDictionary).map('a'); // $ExpectType LoDashImplicitWrapper - - _(array).map('d.0.b'); // $ExpectType LoDashImplicitWrapper - _(list).map('d.0.b'); // $ExpectType LoDashImplicitWrapper - _(dictionary).map('d.0.b'); // $ExpectType LoDashImplicitWrapper - _(numericDictionary).map('d.0.b'); // $ExpectType LoDashImplicitWrapper - - _(array).map({}); // $ExpectType LoDashImplicitWrapper - _(list).map({}); // $ExpectType LoDashImplicitWrapper - _(dictionary).map({}); // $ExpectType LoDashImplicitWrapper - _(numericDictionary).map({}); // $ExpectType LoDashImplicitWrapper - } - - { - _(array).chain().map(); // $ExpectType LoDashExplicitWrapper - // $ExpectType LoDashExplicitWrapper - _(array).chain().map((value, index, collection) => { - value; // $ExpectType AbcObject - index; // $ExpectType number - collection; // $ExpectType AbcObject[] - return 0; - }); - - _(list).chain().map(); // $ExpectType LoDashExplicitWrapper - // $ExpectType LoDashExplicitWrapper - _(list).chain().map((value, index, collection) => { - value; // $ExpectType AbcObject - index; // $ExpectType number - collection; // $ExpectType ArrayLike - return 0; - }); - - _(dictionary).chain().map(); // $ExpectType LoDashExplicitWrapper - // $ExpectType LoDashExplicitWrapper - _(dictionary).chain().map((value, key, collection) => { - value; // $ExpectType AbcObject - key; // $ExpectType string - collection; // $ExpectType Dictionary - return 0; - }); - - _(numericDictionary).chain().map(); // $ExpectType LoDashExplicitWrapper - // $ExpectType LoDashExplicitWrapper - _(numericDictionary).chain().map((value, key, collection) => { - /* Broken in TS 2.4: value; // AbcObject */ - key; // $ExpectType string - collection; // $ExpectType NumericDictionary - return 0; - }); - - _(array).chain().map('a'); // $ExpectType LoDashExplicitWrapper - _(list).chain().map('a'); // $ExpectType LoDashExplicitWrapper - _(dictionary).chain().map('a'); // $ExpectType LoDashExplicitWrapper - _(numericDictionary).chain().map('a'); // $ExpectType LoDashExplicitWrapper - - _(array).chain().map('d.0.b'); // $ExpectType LoDashExplicitWrapper - _(list).chain().map('d.0.b'); // $ExpectType LoDashExplicitWrapper - _(dictionary).chain().map('d.0.b'); // $ExpectType LoDashExplicitWrapper - _(numericDictionary).chain().map('d.0.b'); // $ExpectType LoDashExplicitWrapper - - _(array).chain().map({}); // $ExpectType LoDashExplicitWrapper - _(list).chain().map({}); // $ExpectType LoDashExplicitWrapper - _(dictionary).chain().map({}); // $ExpectType LoDashExplicitWrapper - _(numericDictionary).chain().map({}); // $ExpectType LoDashExplicitWrapper - } - - { - // "pluck"-style map. - _.map([{a: 1}, {a: 2}], 'a'); // $ExpectType number[] - _.map({a: {b: 'str'}, c: {b: 1}}, 'b'); // ExpectType (string | number)[] - - _([{a: 1}, {a: 2}]).map('a').value(); // $ExpectType number[] - _.chain([{a: 1}, {a: 2}]).map('a').value(); // $ExpectType number[] - _([{a: 1}, {a: 2}]).chain().map('a').value(); // $ExpectType number[] - } - - { - // $ExpectType number[] - _.map(['a', 'b', 'c'], ( - v, // $ExpectType string - k // $ExpectType number - ) => k); - } + const valueIterator = (value: AbcObject): number => value.a; + fp.map(valueIterator)(list); // $ExpectType number[] + fp.map(valueIterator, dictionary); // $ExpectType number[] + fp.map("a", list); // $ExpectType number[] + fp.map({ a: 42 }, list); // $ExpectType boolean[] + fp.map(["a", 42], dictionary); // $ExpectType boolean[] } // _.partition -namespace TestPartition { - { - let result: any[][]; +{ + const list: ArrayLike | null | undefined = anything; - result = _.partition(anything, (n) => { - n; // $ExpectType any - return n < 'c'; - }); - } + // $ExpectType [any[], any[]] + _.partition(anything, (value) => { + value; // $ExpectType any + return value < "c"; + }); + // $ExpectType [string[], string[]] + _.partition("abcd", (value) => { + value; // $ExpectType string + return value < "c"; + }); + // $ExpectType [AbcObject[], AbcObject[]] + _.partition(list, (value) => { + value; // $ExpectType AbcObject + return true; + }); - { - let result: string[][]; + // $ExpectType LoDashImplicitWrapper<[any[], any[]]> + _(anything).partition((value) => { + value; // $ExpectType any + return value < "c"; + }); + // $ExpectType LoDashImplicitWrapper<[string[], string[]]> + _("abcd").partition((value) => { + value; // $ExpectType string + return value < "c"; + }); + // $ExpectType LoDashImplicitWrapper<[AbcObject[], AbcObject[]]> + _(list).partition((value) => { + value; // $ExpectType AbcObject + return true; + }); - result = _.partition('abcd', (n) => { - n; // $ExpectType string - return n < 'c'; - }); - result = _.partition(['a', 'b', 'c', 'd'], (n) => { - n; // $ExpectType string - return n < 'c'; - }); - } + // $ExpectType LoDashExplicitWrapper<[any[], any[]]> + _.chain(anything).partition((value) => { + value; // $ExpectType any + return value < "c"; + }); + // $ExpectType LoDashExplicitWrapper<[string[], string[]]> + _.chain("abcd").partition((value) => { + value; // $ExpectType string + return value < "c"; + }); + // $ExpectType LoDashExplicitWrapper<[AbcObject[], AbcObject[]]> + _.chain(list).partition((value) => { + value; // $ExpectType AbcObject + return true; + }); - { - let result: number[][]; - - 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; // $ExpectType number - return n < 3; - }); - } - - { - let result: Array>; - - result = _.partition([{a: 1}, {a: 2}], {a: 2}); - result = _.partition({0: {a: 1}, 1: {a: 2}, length: 2}, {a: 2}); - result = _.partition({0: {a: 1}, 1: {a: 2}}, {a: 2}); - result = _.partition([{a: 1}, {a: 2}], 'a'); - result = _.partition([{a: 1}, {a: 2}], ['a', 2]); - result = _.partition({0: {a: 1}, 1: {a: 2}, length: 2}, 'a'); - result = _.partition({0: {a: 1}, 1: {a: 2}, length: 2}, ['a', 2]); - result = _.partition({0: {a: 1}, 1: {a: 2}}, 'a'); - result = _.partition({0: {a: 1}, 1: {a: 2}}, ['a', 2]); - } - - { - _.partition(null, 'a'); - } - - { - let result: _.LoDashImplicitWrapper; - - result = _(anything).partition((n) => { - n; // $ExpectType any - return n < 'c'; - }); - } - - { - let result: _.LoDashImplicitWrapper; - - result = _('abcd').partition((n) => { - n; // $ExpectType string - return n < 'c'; - }); - result = _(['a', 'b', 'c', 'd']).partition((n) => { - n; // $ExpectType string - return n < 'c'; - }); - } - - { - let result: _.LoDashImplicitWrapper; - - result = _([1, 2, 3, 4]).partition((n) => n < 3); - result = _({0: 1, 1: 2, 2: 3, 3: 4, length: 4}).partition((n) => n < 3); - result = _({a: 1, b: 2, c: 3, d: 4}).partition((n) => { - n; // $ExpectType number - return n < 3; - }); - } - - { - let result: _.LoDashImplicitWrapper>>; - - result = _([{a: 1}, {a: 2}]).partition({a: 2}); - result = _({0: {a: 1}, 1: {a: 2}, length: 2}).partition({a: 2}); - result = _({0: {a: 1}, 1: {a: 2}}).partition({a: 2}); - result = _([{a: 1}, {a: 2}]).partition('a'); - result = _([{a: 1}, {a: 2}]).partition(['a', 2]); - result = _({0: {a: 1}, 1: {a: 2}}).partition('a'); - result = _({0: {a: 1}, 1: {a: 2}}).partition(['a', 2]); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _.chain(anything).partition((n) => { - n; // $ExpectType any - return n < 'c'; - }); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _.chain('abcd').partition((n) => { - n; // $ExpectType string - return n < 'c'; - }); - result = _.chain(['a', 'b', 'c', 'd']).partition((n) => { - n; // $ExpectType string - return n < 'c'; - }); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _.chain([1, 2, 3, 4]).partition((n) => n < 3); - result = _.chain({0: 1, 1: 2, 2: 3, 3: 4, length: 4}).partition((n) => n < 3); - result = _.chain({a: 1, b: 2, c: 3, d: 4}).partition((n) => { - n; // $ExpectType number - return n < 3; - }); - } - - { - let result: _.LoDashExplicitWrapper>>; - - result = _.chain([{a: 1}, {a: 2}]).partition({a: 2}); - result = _.chain({0: {a: 1}, 1: {a: 2}, length: 2}).partition({a: 2}); - result = _.chain({0: {a: 1}, 1: {a: 2}}).partition({a: 2}); - result = _.chain([{a: 1}, {a: 2}]).partition('a'); - result = _.chain([{a: 1}, {a: 2}]).partition(['a', 2]); - result = _.chain({0: {a: 1}, 1: {a: 2}}).partition('a'); - result = _.chain({0: {a: 1}, 1: {a: 2}}).partition(['a', 2]); - } + // $ExpectType [any[], any[]] + fp.partition((value) => { + value; // $ExpectType any + return value < "c"; + }, anything); + // $ExpectType [any[], any[]] + fp.partition((value: any) => value < "c")(anything); + // $ExpectType [string[], string[]] + fp.partition((value) => { + value; // $ExpectType string + return value < "c"; + }, "abcd"); + // $ExpectType [AbcObject[], AbcObject[]] + fp.partition((value) => { + value; // $ExpectType AbcObject + return true; + }, list); } -namespace TestReduce { +// _.reduce +{ interface ABC { [key: string]: number; a: number; b: number; c: number; } - - // $ExpectType number | undefined - _.reduce([1, 2, 3], (sum: number, num: number) => sum + num); - // $ExpectType number | undefined - _.reduce(null, (sum: number, num: number) => sum + num); - - // chained - _([1, 2 ,3]).reduce((sum: number, num: number) => sum + num); - _.chain([1, 2 ,3]).reduce((sum: number, num: number) => sum + num).value(); - - // $ExpectType ABC - _.reduce({ 'a': 1, 'b': 2, 'c': 3 }, (r: ABC, num: number, key: string) => { - r[key] = num * 3; - return r; - // tslint:disable-next-line:no-object-literal-type-assertion - }, {} as ABC); - - // $ExpectType number | undefined - _([1, 2, 3]).reduce((sum: number, num: number) => sum + num); - const initial: ABC = { a: 1, b: 2, c: 3 }; - // $ExpectType ABC - _({ 'a': 1, 'b': 2, 'c': 3 }).reduce((r: ABC, num: number, key: string) => { - r[key] = num * 3; - return r; - // tslint:disable-next-line:no-object-literal-type-assertion - }, initial); - // $ExpectType number[] - _.reduceRight([[0, 1], [2, 3], [4, 5]], (a: number[], b: number[]) => a.concat(b), []); + _.reduce([1, 2, 3], (sum: number, num: number) => sum + num); // $ExpectType number | undefined + _.reduce(null, (sum: number, num: number) => sum + num); // $ExpectType number | undefined + _.reduce({ a: 1, b: 2, c: 3 }, (r: ABC, num: number, key: string) => r, initial); // $ExpectType ABC + + _([1, 2, 3]).reduce((sum: number, num: number) => sum + num); // $ExpectType number | undefined + _({ a: 1, b: 2, c: 3 }).reduce((r: ABC, num: number, key: string) => r, initial); // $ExpectType ABC + + _.chain([1, 2, 3]).reduce((sum: number, num: number) => sum + num); // $ExpectType LoDashExplicitWrapper + _.chain({ a: 1, b: 2, c: 3 }).reduce((r: ABC, num: number, key: string) => r, initial); // $ExpectType LoDashExplicitWrapper + + fp.reduce((s: string, num: number) => s + num, "", [1, 2, 3]); // $ExpectType string + fp.reduce((s: string, num: number) => s + num)("")([1, 2, 3]); // $ExpectType string + + _.reduceRight([1, 2, 3], (sum: number, num: number) => sum + num); // $ExpectType number | undefined + _.reduceRight(null, (sum: number, num: number) => sum + num); // $ExpectType number | undefined + _.reduceRight({ a: 1, b: 2, c: 3 }, (r: ABC, num: number, key: string) => r, initial); // $ExpectType ABC + + _([1, 2, 3]).reduceRight((sum: number, num: number) => sum + num); // $ExpectType number | undefined + _({ a: 1, b: 2, c: 3 }).reduceRight((r: ABC, num: number, key: string) => r, initial); // $ExpectType ABC + + _.chain([1, 2, 3]).reduceRight((sum: number, num: number) => sum + num); // $ExpectType LoDashExplicitWrapper + _.chain({ a: 1, b: 2, c: 3 }).reduceRight((r: ABC, num: number, key: string) => r, initial); // $ExpectType LoDashExplicitWrapper + + fp.reduceRight((num: number, s: string) => s + num, "", [1, 2, 3]); // $ExpectType string + fp.reduceRight((num: number, s: string) => s + num)("")([1, 2, 3]); // $ExpectType string } // _.reject -namespace TestReject { - let array: AbcObject[] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; - let obj: any = {}; - let dictionary: _.Dictionary | null | undefined = obj; +{ + const list: _.List | null | undefined = anything; + const dictionary: _.Dictionary | null | undefined = anything; - let stringIterator = (char: string, index: number, string: string) => true; - let listIterator = (value: AbcObject, index: number, collection: _.List) => true; - let dictionaryIterator = (value: AbcObject, key: string, collection: _.Dictionary) => true; + const stringIterator = (char: string, index: number, string: string) => true; + const listIterator = (value: AbcObject, index: number, collection: _.List) => true; + const dictionaryIterator = (value: AbcObject, key: string, collection: _.Dictionary) => true; + const valueIterator = (value: AbcObject) => true; - { - let result: string[]; + _.reject("", stringIterator); // $ExpectType string[] + _.reject(list, listIterator); // $ExpectType AbcObject[] + _.reject(list, ""); // $ExpectType AbcObject[] + _.reject(list, { a: 42 }); // $ExpectType AbcObject[] + _.reject(dictionary, dictionaryIterator); // $ExpectType AbcObject[] + _.reject(dictionary, ""); // $ExpectType AbcObject[] + _.reject(dictionary, { a: 42 }); // $ExpectType AbcObject[] - result = _.reject('', stringIterator); - } + _("").reject(stringIterator); // $ExpectType LoDashImplicitWrapper + _(list).reject(listIterator); // $ExpectType LoDashImplicitWrapper + _(list).reject(""); // $ExpectType LoDashImplicitWrapper + _(list).reject({ a: 42 }); // $ExpectType LoDashImplicitWrapper + _(dictionary).reject(dictionaryIterator); // $ExpectType LoDashImplicitWrapper + _(dictionary).reject(""); // $ExpectType LoDashImplicitWrapper + _(dictionary).reject({ a: 42 }); // $ExpectType LoDashImplicitWrapper - { - let result: AbcObject[]; + _.chain("").reject(stringIterator); // $ExpectType LoDashExplicitWrapper + _.chain(list).reject(listIterator); // $ExpectType LoDashExplicitWrapper + _.chain(list).reject(""); // $ExpectType LoDashExplicitWrapper + _.chain(list).reject({ a: 42 }); // $ExpectType LoDashExplicitWrapper + _.chain(dictionary).reject(dictionaryIterator); // $ExpectType LoDashExplicitWrapper + _.chain(dictionary).reject(""); // $ExpectType LoDashExplicitWrapper + _.chain(dictionary).reject({ a: 42 }); // $ExpectType LoDashExplicitWrapper - result = _.reject(array, listIterator); - result = _.reject(array, ''); - result = _.reject(array, {a: 42}); - - result = _.reject(list, listIterator); - result = _.reject(list, ''); - result = _.reject(list, {a: 42}); - - result = _.reject(dictionary, dictionaryIterator); - result = _.reject(dictionary, ''); - result = _.reject(dictionary, {a: 42}); - } - - { - let result: _.LoDashImplicitArrayWrapper; - - result = _('').reject(stringIterator); - } - - { - let result: _.LoDashImplicitArrayWrapper; - - result = _(array).reject(listIterator); - result = _(array).reject(''); - result = _(array).reject({a: 42}); - - result = _(list).reject(listIterator); - result = _(list).reject(''); - result = _(list).reject({a: 42}); - - result = _(dictionary).reject(dictionaryIterator); - result = _(dictionary).reject(''); - result = _(dictionary).reject({a: 42}); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _('').chain().reject(stringIterator); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _(array).chain().reject(listIterator); - result = _(array).chain().reject(''); - result = _(array).chain().reject({a: 42}); - - result = _(list).chain().reject(listIterator); - result = _(list).chain().reject(''); - result = _(list).chain().reject({a: 42}); - - result = _(dictionary).chain().reject(dictionaryIterator); - result = _(dictionary).chain().reject(''); - result = _(dictionary).chain().reject({a: 42}); - } + fp.reject(valueIterator, list); // $ExpectType AbcObject[] + fp.reject(valueIterator)(list); // $ExpectType AbcObject[] + fp.reject(valueIterator, dictionary); // $ExpectType AbcObject[] + fp.reject("a", list); // $ExpectType AbcObject[] + fp.reject({ a: 42 }, list); // $ExpectType AbcObject[] + fp.reject(["a", 42], list); // $ExpectType AbcObject[] } // _.sample -namespace TestSample { - let array: string[] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; - let obj: any = {}; - let dictionary: _.Dictionary | null | undefined = obj; - let numericDictionary: _.NumericDictionary | null | undefined= obj; - - { - let result: string | undefined; - - result = _.sample('abc'); - result = _.sample(array); - result = _.sample(list); - result = _.sample(dictionary); - result = _.sample(numericDictionary); - result = _.sample({a: 'foo'}); - result = _.sample({a: 'foo'}); - - result = _('abc').sample(); - result = _(array).sample(); - result = _(list).sample(); - result = _(dictionary).sample(); - result = _(numericDictionary).sample(); - result = _({a: 'foo'}).sample(); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _('abc').chain().sample(); - result = _(array).chain().sample(); - result = _(list).chain().sample(); - result = _(dictionary).chain().sample(); - result = _(numericDictionary).chain().sample(); - result = _({a: 'foo'}).chain().sample(); - } -} - // _.sampleSize -namespace TestSampleSize { - let array: string[] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; - let obj: any = {}; - let dictionary: _.Dictionary | null | undefined = obj; - let numericDictionary: _.NumericDictionary | null | undefined = obj; +{ + const list: _.List | null | undefined = anything; + const dictionary: _.Dictionary | null | undefined = anything; + const numericDictionary: _.NumericDictionary | null | undefined = anything; - { - let result: string[]; + _.sample("abc"); // $ExpectType string | undefined + _.sample(list); // $ExpectType string | undefined + _.sample(dictionary); // $ExpectType string | undefined + _.sample(numericDictionary); // $ExpectType string | undefined + _.sample({ a: "foo" }); // $ExpectType string | undefined - result = _.sampleSize('abc'); - result = _.sampleSize('abc', 42); - result = _.sampleSize(array); - result = _.sampleSize(array, 42); - result = _.sampleSize(list); - result = _.sampleSize(list, 42); - result = _.sampleSize(dictionary); - result = _.sampleSize(dictionary, 42); - result = _.sampleSize(numericDictionary); - result = _.sampleSize(numericDictionary, 42); - result = _.sampleSize({a: 'foo'}); - result = _.sampleSize({a: 'foo'}, 42); - result = _.sampleSize({a: 'foo'}); - result = _.sampleSize({a: 'foo'}, 42); - } + _("abc").sample(); // $ExpectType string | undefined + _(list).sample(); // $ExpectType string | undefined + _(dictionary).sample(); // $ExpectType string | undefined + _(numericDictionary).sample(); // $ExpectType string | undefined + _({ a: "foo" }).sample(); // $ExpectType string | undefined - { - let result: _.LoDashImplicitArrayWrapper; + _.chain("abc").sample(); // $ExpectType LoDashExplicitWrapper + _.chain(list).sample(); // $ExpectType LoDashExplicitWrapper + _.chain(dictionary).sample(); // $ExpectType LoDashExplicitWrapper + _.chain(numericDictionary).sample(); // $ExpectType LoDashExplicitWrapper + _.chain({ a: "foo" }).sample(); // $ExpectType LoDashExplicitWrapper - result = _('abc').sampleSize(); - result = _('abc').sampleSize(42); - result = _(array).sampleSize(); - result = _(array).sampleSize(42); - result = _(list).sampleSize(); - result = _(list).sampleSize(42); - result = _(dictionary).sampleSize(); - result = _(dictionary).sampleSize(42); - result = _(numericDictionary).sampleSize(); - result = _(numericDictionary).sampleSize(42); - result = _({a: 'foo'}).sampleSize(); - result = _({a: 'foo'}).sampleSize(42); - } + fp.sample("abc"); // $ExpectType string | undefined + fp.sample(list); // $ExpectType string | undefined + fp.sample({ a: "foo" }); // $ExpectType string | undefined - { - let result: _.LoDashExplicitArrayWrapper; + _.sampleSize("abc"); // $ExpectType string[] + _.sampleSize("abc", 3); // $ExpectType string[] + _.sampleSize(list, 3); // $ExpectType string[] + _.sampleSize(dictionary, 3); // $ExpectType string[] + _.sampleSize(numericDictionary, 3); // $ExpectType string[] + _.sampleSize({ a: "foo" }, 3); // $ExpectType string[] - result = _('abc').chain().sampleSize(); - result = _('abc').chain().sampleSize(42); - result = _(array).chain().sampleSize(); - result = _(array).chain().sampleSize(42); - result = _(list).chain().sampleSize(); - result = _(list).chain().sampleSize(42); - result = _(dictionary).chain().sampleSize(); - result = _(dictionary).chain().sampleSize(42); - result = _(numericDictionary).chain().sampleSize(); - result = _(numericDictionary).chain().sampleSize(42); - result = _({a: 'foo'}).chain().sampleSize(); - result = _({a: 'foo'}).chain().sampleSize(42); - } + _("abc").sampleSize(); // $ExpectType LoDashImplicitWrapper + _("abc").sampleSize(3); // $ExpectType LoDashImplicitWrapper + _(list).sampleSize(3); // $ExpectType LoDashImplicitWrapper + _(dictionary).sampleSize(3); // $ExpectType LoDashImplicitWrapper + _(numericDictionary).sampleSize(3); // $ExpectType LoDashImplicitWrapper + _({ a: "foo" }).sampleSize(3); // $ExpectType LoDashImplicitWrapper + + _.chain("abc").sampleSize(); // $ExpectType LoDashExplicitWrapper + _.chain("abc").sampleSize(3); // $ExpectType LoDashExplicitWrapper + _.chain(list).sampleSize(3); // $ExpectType LoDashExplicitWrapper + _.chain(dictionary).sampleSize(3); // $ExpectType LoDashExplicitWrapper + _.chain(numericDictionary).sampleSize(3); // $ExpectType LoDashExplicitWrapper + _.chain({ a: "foo" }).sampleSize(3); // $ExpectType LoDashExplicitWrapper + + fp.sampleSize(3, "abc"); // $ExpectType string[] + fp.sampleSize(3)(list); // $ExpectType string[] + fp.sampleSize(3)({ a: "foo" }); // $ExpectType string[] } // _.shuffle -namespace TestShuffle { - let array: AbcObject[] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; - let obj: any = {}; - let dictionary: _.Dictionary | null | undefined = obj; +{ + const list: _.List | null | undefined = anything; + const dictionary: _.Dictionary | null | undefined = anything; - { - let result: string[]; - - result = _.shuffle('abc'); - } - - { - let result: AbcObject[]; - - 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(); - } + _.shuffle("abc"); // $ExpectType string[] + _.shuffle(list); // $ExpectType AbcObject[] + _.shuffle(dictionary); // $ExpectType AbcObject[] + _("abc").shuffle(); // $ExpectType LoDashImplicitWrapper + _(list).shuffle(); // $ExpectType LoDashImplicitWrapper + _(dictionary).shuffle(); // $ExpectType LoDashImplicitWrapper + _.chain("abc").shuffle(); // $ExpectType LoDashExplicitWrapper + _.chain(list).shuffle(); // $ExpectType LoDashExplicitWrapper + _.chain(dictionary).shuffle(); // $ExpectType LoDashExplicitWrapper + fp.shuffle("abc"); // $ExpectType string[] + fp.shuffle(list); // $ExpectType AbcObject[] + fp.shuffle(dictionary); // $ExpectType AbcObject[] } // _.size -namespace TestSize { - type SampleType = {a: string; b: number; c: boolean;}; +{ + const list: _.List | null | undefined = anything; + const dictionary: _.Dictionary | null | undefined = anything; - let array: SampleType[] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; - let obj: any = {}; - let dictionary: _.Dictionary | null | undefined = obj; - - { - 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(); - } + _.size(list); // $ExpectType number + _.size(dictionary); // $ExpectType number + _.size(""); // $ExpectType number + _(list).size(); // $ExpectType number + _(dictionary).size(); // $ExpectType number + _("").size(); // $ExpectType number + _.chain(list).size(); // $ExpectType LoDashExplicitWrapper + _.chain(dictionary).size(); // $ExpectType LoDashExplicitWrapper + _.chain("").size(); // $ExpectType LoDashExplicitWrapper + fp.size(list); // $ExpectType number + fp.size(dictionary); // $ExpectType number + fp.size(""); // $ExpectType number } // _.some -namespace TestSome { - type SampleObject = {a: number; b: string; c: boolean;}; +{ + const list: _.List | null | undefined = anything; + const dictionary: _.Dictionary | null | undefined = anything; + const numericDictionary: _.NumericDictionary | null | undefined = anything; - let array: SampleObject[] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; - let obj: any = {}; - let dictionary: _.Dictionary | null | undefined = obj; - let numericDictionary: _.NumericDictionary | null | undefined = obj; - let sampleObject: SampleObject | null | undefined = obj; + const listIterator = (value: AbcObject, index: number, collection: _.List) => true; + const dictionaryIterator = (value: AbcObject, key: string, collection: _.Dictionary) => true; + const numericDictionaryIterator = (value: AbcObject, key: string, collection: _.NumericDictionary) => true; + const valueIterator = (value: AbcObject) => true; - let listIterator = (value: SampleObject, index: number, collection: _.List) => true; - let dictionaryIterator = (value: SampleObject, key: string, collection: _.Dictionary) => true; - let numericDictionaryIterator = (value: SampleObject, key: string, collection: _.NumericDictionary) => true; - let objectIterator = (value: any, key: string, collection: any) => true; + _.some(list); // $ExpectType boolean + _.some(list, listIterator); // $ExpectType boolean + _.some(list, "a"); // $ExpectType boolean + _.some(list, ["a", 42]); // $ExpectType boolean + _.some(list, { a: 42 }); // $ExpectType boolean - { - let result: boolean; + _.some(dictionary); // $ExpectType boolean + _.some(dictionary, dictionaryIterator); // $ExpectType boolean + _.some(dictionary, "a"); // $ExpectType boolean + _.some(dictionary, ["a", 42]); // $ExpectType boolean + _.some(dictionary, { a: 42 }); // $ExpectType boolean - result = _.some(array); - result = _.some(array, listIterator); - result = _.some(array, 'a'); - result = _.some(array, ['a', 42]); - result = _.some(array, {a: 42}); + _.some(numericDictionary); // $ExpectType boolean + _.some(numericDictionary, numericDictionaryIterator); // $ExpectType boolean + _.some(numericDictionary, "a"); // $ExpectType boolean + _.some(numericDictionary, ["a", 42]); // $ExpectType boolean + _.some(numericDictionary, { a: 42 }); // $ExpectType boolean - result = _.some(list); - result = _.some(list, listIterator); - result = _.some(list, 'a'); - result = _.some(list, ['a', 42]); - result = _.some(list, {a: 42}); + _(list).some(); // $ExpectType boolean + _(list).some(listIterator); // $ExpectType boolean + _(list).some("a"); // $ExpectType boolean + _(list).some(["a", 42]); // $ExpectType boolean + _(list).some({ a: 42 }); // $ExpectType boolean - result = _.some(dictionary); - result = _.some(numericDictionary, numericDictionaryIterator); - result = _.some(dictionary, (value, key, collection) => { - value; // $ExpectType SampleObject - key; // $ExpectType string - collection; // $ExpectType Dictionary - return true; - }); - result = _.some(dictionary, 'a'); - result = _.some(dictionary, ['a', 42]); - result = _.some(dictionary, {a: 42}); + _(dictionary).some(); // $ExpectType boolean + _(dictionary).some(dictionaryIterator); // $ExpectType boolean + _(dictionary).some("a"); // $ExpectType boolean + _(dictionary).some(["a", 42]); // $ExpectType boolean + _(dictionary).some({ a: 42 }); // $ExpectType boolean - result = _.some(numericDictionary); - result = _.some(numericDictionary, numericDictionaryIterator); - result = _.some(numericDictionary, 'a'); - result = _.some(numericDictionary, ['a', 42]); - result = _.some(numericDictionary, {a: 42}); + _(numericDictionary).some(); // $ExpectType boolean + _(numericDictionary).some(numericDictionaryIterator); // $ExpectType boolean + _(numericDictionary).some("a"); // $ExpectType boolean + _(numericDictionary).some(["a", 42]); // $ExpectType boolean + _(numericDictionary).some({ a: 42 }); // $ExpectType boolean - result = _.some(sampleObject); - result = _.some(sampleObject, objectIterator); - result = _.some(sampleObject, 'a'); - result = _.some(sampleObject, ['a', 42]); + _.chain(list).some(); // $ExpectType LoDashExplicitWrapper + _.chain(list).some(listIterator); // $ExpectType LoDashExplicitWrapper + _.chain(list).some("a"); // $ExpectType LoDashExplicitWrapper + _.chain(list).some(["a", 42]); // $ExpectType LoDashExplicitWrapper + _.chain(list).some({ a: 42 }); // $ExpectType LoDashExplicitWrapper - result = _(array).some(); - result = _(array).some(listIterator); - result = _(array).some('a'); - result = _(array).some(['a', 42]); - result = _(array).some({a: 42}); + _.chain(dictionary).some(); // $ExpectType LoDashExplicitWrapper + _.chain(dictionary).some(dictionaryIterator); // $ExpectType LoDashExplicitWrapper + _.chain(dictionary).some("a"); // $ExpectType LoDashExplicitWrapper + _.chain(dictionary).some(["a", 42]); // $ExpectType LoDashExplicitWrapper + _.chain(dictionary).some({ a: 42 }); // $ExpectType LoDashExplicitWrapper - result = _(list).some(); - result = _(list).some(listIterator); - result = _(list).some('a'); - result = _(list).some(['a', 42]); - result = _(list).some({a: 42}); + _.chain(numericDictionary).some(); // $ExpectType LoDashExplicitWrapper + _.chain(numericDictionary).some(numericDictionaryIterator); // $ExpectType LoDashExplicitWrapper + _.chain(numericDictionary).some("a"); // $ExpectType LoDashExplicitWrapper + _.chain(numericDictionary).some(["a", 42]); // $ExpectType LoDashExplicitWrapper + _.chain(numericDictionary).some({ a: 42 }); // $ExpectType LoDashExplicitWrapper - result = _(dictionary).some(); - result = _(dictionary).some(dictionaryIterator); - result = _(dictionary).some('a'); - result = _(dictionary).some(['a', 42]); - result = _(dictionary).some({a: 42}); + fp.some(valueIterator, list); // $ExpectType boolean + fp.some("a")(list); // $ExpectType boolean + fp.some({ a: 42 }, list); // $ExpectType boolean + fp.some(["a", 42], list); // $ExpectType boolean - result = _(numericDictionary).some(); - result = _(numericDictionary).some(numericDictionaryIterator); - result = _(numericDictionary).some('a'); - result = _(numericDictionary).some(['a', 42]); - result = _(numericDictionary).some({a: 42}); + fp.some(valueIterator, dictionary); // $ExpectType boolean + fp.some("a")(dictionary); // $ExpectType boolean + fp.some({ a: 42 })(dictionary); // $ExpectType boolean + fp.some(["a", 42])(dictionary); // $ExpectType boolean - result = _(sampleObject).some(); - result = _(sampleObject).some(objectIterator); - result = _(sampleObject).some('a'); - result = _(sampleObject).some(['a', 42]); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(array).chain().some(); - result = _(array).chain().some(listIterator); - result = _(array).chain().some('a'); - result = _(array).chain().some(['a', 42]); - result = _(array).chain().some({a: 42}); - - result = _(list).chain().some(); - result = _(list).chain().some(listIterator); - result = _(list).chain().some('a'); - result = _(list).chain().some(['a', 42]); - result = _(list).chain().some({a: 42}); - - result = _(dictionary).chain().some(); - result = _(dictionary).chain().some(dictionaryIterator); - result = _(dictionary).chain().some('a'); - result = _(dictionary).chain().some(['a', 42]); - result = _(dictionary).chain().some({a: 42}); - - result = _(numericDictionary).chain().some(); - result = _(numericDictionary).chain().some(numericDictionaryIterator); - result = _(numericDictionary).chain().some('a'); - result = _(numericDictionary).chain().some(['a', 42]); - result = _(numericDictionary).chain().some({a: 42}); - - result = _(sampleObject).chain().some(); - result = _(sampleObject).chain().some(objectIterator); - result = _(sampleObject).chain().some('a'); - result = _(sampleObject).chain().some(['a', 42]); - } + fp.some(valueIterator, numericDictionary); // $ExpectType boolean + fp.some("a")(numericDictionary); // $ExpectType boolean + fp.some({ a: 42 })(numericDictionary); // $ExpectType boolean + fp.some(["a", 42])(numericDictionary); // $ExpectType boolean } // _.sortBy -namespace TestSortBy { - let array: AbcObject[] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; - let obj: any = {}; - let dictionary: _.Dictionary | null | undefined = obj; +{ + const list: _.List | null | undefined = anything; + const dictionary: _.Dictionary | null | undefined = anything; - let listIterator = (value: AbcObject, index: number, collection: _.List) => 0; - let dictionaryIterator = (value: AbcObject, key: string, collection: _.Dictionary) => 0; + const listIterator = (value: AbcObject, index: number, collection: _.List) => 0; + const dictionaryIterator = (value: AbcObject, key: string, collection: _.Dictionary) => 0; + const valueIterator = (value: AbcObject) => 0; - { - let result: AbcObject[]; + _.sortBy(list); // $ExpectType AbcObject[] + _.sortBy(list, listIterator); // $ExpectType AbcObject[] + _.sortBy(list, listIterator, listIterator); // $ExpectType AbcObject[] + _.sortBy(list, [listIterator, listIterator]); // $ExpectType AbcObject[] + _.sortBy(list, ""); // $ExpectType AbcObject[] + _.sortBy(list, { a: 42 }); // $ExpectType AbcObject[] + _.sortBy(dictionary); // $ExpectType AbcObject[] + _.sortBy(dictionary, dictionaryIterator); // $ExpectType AbcObject[] + _.sortBy(dictionary, ""); // $ExpectType AbcObject[] + _.sortBy(dictionary, { a: 42 }); // $ExpectType AbcObject[] - result = _.sortBy(array); - result = _.sortBy(array, listIterator); - result = _.sortBy(array, ''); - result = _.sortBy(array, {a: 42}); + _(list).sortBy(); // $ExpectType LoDashImplicitWrapper + _(list).sortBy(listIterator); // $ExpectType LoDashImplicitWrapper + _(list).sortBy(listIterator, listIterator); // $ExpectType LoDashImplicitWrapper + _(list).sortBy([listIterator, listIterator]); // $ExpectType LoDashImplicitWrapper + _(list).sortBy(""); // $ExpectType LoDashImplicitWrapper + _(list).sortBy({ a: 42 }); // $ExpectType LoDashImplicitWrapper + _(dictionary).sortBy(); // $ExpectType LoDashImplicitWrapper + _(dictionary).sortBy(dictionaryIterator); // $ExpectType LoDashImplicitWrapper + _(dictionary).sortBy(""); // $ExpectType LoDashImplicitWrapper + _(dictionary).sortBy({ a: 42 }); // $ExpectType LoDashImplicitWrapper - result = _.sortBy(list); - result = _.sortBy(list, listIterator); - result = _.sortBy(list, ''); - result = _.sortBy(list, {a: 42}); + _.chain(list).sortBy(); // $ExpectType LoDashExplicitWrapper + _.chain(list).sortBy(listIterator); // $ExpectType LoDashExplicitWrapper + _.chain(list).sortBy(listIterator, listIterator); // $ExpectType LoDashExplicitWrapper + _.chain(list).sortBy([listIterator, listIterator]); // $ExpectType LoDashExplicitWrapper + _.chain(list).sortBy(""); // $ExpectType LoDashExplicitWrapper + _.chain(list).sortBy({ a: 42 }); // $ExpectType LoDashExplicitWrapper + _.chain(dictionary).sortBy(); // $ExpectType LoDashExplicitWrapper + _.chain(dictionary).sortBy(dictionaryIterator); // $ExpectType LoDashExplicitWrapper + _.chain(dictionary).sortBy(""); // $ExpectType LoDashExplicitWrapper + _.chain(dictionary).sortBy({ a: 42 }); // $ExpectType LoDashExplicitWrapper - result = _.sortBy(dictionary); - result = _.sortBy(dictionary, dictionaryIterator); - result = _.sortBy(dictionary, ''); - result = _.sortBy(dictionary, {a: 42}); - } - - { - let result: _.LoDashImplicitArrayWrapper; - - result = _(array).sortBy(); - result = _(array).sortBy(listIterator); - result = _(array).sortBy(''); - result = _(array).sortBy({a: 42}); - - result = _(list).sortBy(); - result = _(list).sortBy(listIterator); - result = _(list).sortBy(''); - result = _(list).sortBy({a: 42}); - - result = _(dictionary).sortBy(); - result = _(dictionary).sortBy(dictionaryIterator); - result = _(dictionary).sortBy(''); - result = _(dictionary).sortBy({a: 42}); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _(array).chain().sortBy(); - result = _(array).chain().sortBy(listIterator); - result = _(array).chain().sortBy(''); - result = _(array).chain().sortBy({a: 42}); - - result = _(list).chain().sortBy(); - result = _(list).chain().sortBy(listIterator); - result = _(list).chain().sortBy(''); - result = _(list).chain().sortBy({a: 42}); - - result = _(dictionary).chain().sortBy(); - result = _(dictionary).chain().sortBy(dictionaryIterator); - result = _(dictionary).chain().sortBy(''); - result = _(dictionary).chain().sortBy({a: 42}); - } + fp.sortBy(fp.identity, "bca"); // $ExpectType string[] + fp.sortBy(valueIterator, list); // $ExpectType AbcObject[] + fp.sortBy(valueIterator)(list); // $ExpectType AbcObject[] + fp.sortBy([valueIterator, valueIterator])(list); // $ExpectType AbcObject[] + fp.sortBy("a", list); // $ExpectType AbcObject[] + fp.sortBy({ a: 42 }, list); // $ExpectType AbcObject[] + fp.sortBy(fp.identity, dictionary); // $ExpectType AbcObject[] + fp.sortBy(valueIterator, dictionary); // $ExpectType AbcObject[] + fp.sortBy("a", dictionary); // $ExpectType AbcObject[] + fp.sortBy({ a: 42 }, dictionary); // $ExpectType AbcObject[] } -_.sortBy(stoogesAges, stooge => Math.sin(stooge.age), stooge => stooge.name.slice(1)); // $ExpectType StoogesAge[] -_.sortBy(stoogesAges, ['name', 'age']); // $ExpectType StoogesAge[] -_.sortBy(stoogesAges, 'name', stooge => Math.sin(stooge.age)); // $ExpectType StoogesAge[] - -_(foodsOrganic).sortBy('organic', (food) => food.name, { organic: true }).value(); // $ExpectType FoodOrganic[] - // _.orderBy -namespace TestorderBy { - type SampleObject = {a: number; b: string; c: boolean}; +{ + const list: _.List | null | undefined = anything; + const numericDictionary: _.NumericDictionary | null | undefined = anything; + const dictionary: _.Dictionary | null | undefined = anything; - const array: SampleObject[] | null | undefined = anything; - const list: _.List | null | undefined = anything; - const numericDictionary: _.NumericDictionary | null | undefined = anything; - const dictionary: _.Dictionary | null | undefined = anything; - const orders: boolean|string|Array = anything; + _.orderBy("acbd", (value) => 1); // $ExpectType string[] + _.orderBy("acbd", (value) => 1, true); // $ExpectType string[] + _.orderBy("acbd", [(value) => 1, (value) => 2], [true, false]); // $ExpectType string[] + _.orderBy(list, (value) => 1); // $ExpectType AbcObject[] + _.orderBy(list, (value) => 1, true); // $ExpectType AbcObject[] + _.orderBy(list, [(value) => 1, (value) => 2], [true, false]); // $ExpectType AbcObject[] + _.orderBy(dictionary, (value) => 1); // $ExpectType AbcObject[] + _.orderBy(dictionary, (value) => 1, true); // $ExpectType AbcObject[] + // These fail in TS 2.4 + // _.orderBy(numericDictionary, (value) => 1); // AbcObject[] + // _.orderBy(numericDictionary, (value) => 1, true); // AbcObject[] - { - let iteratees: ((value: string) => any)|Array<(value: string) => any> = anything; - let result: string[]; + _(list).orderBy((value) => 1); // $ExpectType LoDashImplicitWrapper + _(list).orderBy((value) => 1, true); // $ExpectType LoDashImplicitWrapper + _(list).orderBy([(value) => 1, (value) => 2], true); // $ExpectType LoDashImplicitWrapper + _(dictionary).orderBy((value) => 1); // $ExpectType LoDashImplicitWrapper + _(dictionary).orderBy((value) => 1, true); // $ExpectType LoDashImplicitWrapper + // These fail in TS 2.4 + // _(numericDictionary).orderBy((value) => 1); // LoDashImplicitWrapper + // _(numericDictionary).orderBy((value) => 1, true); // LoDashImplicitWrapper - result = _.orderBy('acbd', iteratees); - result = _.orderBy('acbd', iteratees, orders); - } + _.chain(list).orderBy((value) => 1); // $ExpectType LoDashExplicitWrapper + _.chain(list).orderBy((value) => 1, true); // $ExpectType LoDashExplicitWrapper + _.chain(list).orderBy([(value) => 1, (value) => 2], true); // $ExpectType LoDashExplicitWrapper + _.chain(dictionary).orderBy((value) => 1); // $ExpectType LoDashExplicitWrapper + _.chain(dictionary).orderBy((value) => 1, true); // $ExpectType LoDashExplicitWrapper + // These fail in TS 2.4 + // _.chain(numericDictionary).orderBy((value) => 1); // LoDashExplicitWrapper + // _.chain(numericDictionary).orderBy((value) => 1, true); // LoDashExplicitWrapper - { - const iteratees: ((value: SampleObject) => _.NotVoid)|string|_.PartialDeep|Array<((value: SampleObject) => _.NotVoid)|string|_.PartialDeep> = anything; - let result: SampleObject[]; - - result = _.orderBy(array, iteratees); - result = _.orderBy(array, iteratees, orders); - - result = _.orderBy(list, iteratees); - result = _.orderBy(list, iteratees, orders); - - result = _.orderBy(numericDictionary, iteratees); - result = _.orderBy(numericDictionary, iteratees, orders); - - result = _.orderBy(dictionary, iteratees); - result = _.orderBy(dictionary, iteratees, orders); - } - - { - const iteratees: ((value: SampleObject) => _.NotVoid)|string|_.PartialDeep|Array<((value: SampleObject) => _.NotVoid)|string|_.PartialDeep> = anything; - let result: _.LoDashImplicitArrayWrapper; - - result = _(array).orderBy(iteratees); - result = _(array).orderBy(iteratees, orders); - - result = _(list).orderBy(iteratees); - result = _(list).orderBy(iteratees, orders); - - result = _(numericDictionary).orderBy(iteratees); - result = _(numericDictionary).orderBy(iteratees, orders); - - result = _(dictionary).orderBy(iteratees); - result = _(dictionary).orderBy(iteratees, orders); - } - - { - const iteratees: ((value: SampleObject) => _.NotVoid)|string|_.PartialDeep|Array<((value: SampleObject) => _.NotVoid)|string|_.PartialDeep> = anything; - let result: _.LoDashExplicitArrayWrapper; - - result = _(array).chain().orderBy(iteratees); - result = _(array).chain().orderBy(iteratees, orders); - - result = _(list).chain().orderBy(iteratees); - result = _(list).chain().orderBy(iteratees, orders); - - result = _(numericDictionary).chain().orderBy(iteratees); - result = _(numericDictionary).chain().orderBy(iteratees, orders); - - result = _(dictionary).chain().orderBy(iteratees); - result = _(dictionary).chain().orderBy(iteratees, orders); - } + fp.orderBy(fp.identity, "asc", "bca"); // $ExpectType string[] + fp.orderBy(fp.identity, true, "bca"); // $ExpectType string[] + fp.orderBy((value: AbcObject) => 1, true, list); // $ExpectType AbcObject[] + fp.orderBy([(value: AbcObject) => 1, (value: AbcObject) => 1])([true, false])(list); // $ExpectType AbcObject[] + fp.orderBy("a", true, list); // $ExpectType AbcObject[] + fp.orderBy({ a: 42 }, true, list); // $ExpectType AbcObject[] + fp.orderBy((value: AbcObject) => 1, true, dictionary); // $ExpectType AbcObject[] + fp.orderBy("a", true, dictionary); // $ExpectType AbcObject[] + fp.orderBy({ a: 42 }, true, dictionary); // $ExpectType AbcObject[] } /******** * Date * ********/ -namespace TestNow { - { - let result: number; +_.now(); // $ExpectType number +_({}).now(); // $ExpectType number +_.chain({}).now(); // $ExpectType LoDashExplicitWrapper +fp.now(); // $ExpectType number - result = _.now(); - result = _(42).now(); - result = _([]).now(); - result = _({}).now(); - } +/************ + * Function * + ************/ - { - let result: _.LoDashExplicitWrapper; - - result = _(42).chain().now(); - result = _([]).chain().now(); - result = _({}).chain().now(); - } -} - -/************* - * Functions * - *************/ // _.after -namespace TestAfter { - type Func = (a: string, b: number) => boolean; - - let func: Func = (a, b) => true; - - { - let result: Func; - - _.after(42, func); - } - - { - let result: _.LoDashImplicitObjectWrapper; - - _(42).after(func); - } - - { - let result: _.LoDashExplicitObjectWrapper; - - _(42).chain().after(func); - } +{ + _.after(42, (a: string, b: number): boolean => true); // $ExpectType (a: string, b: number) => boolean + _(42).after((a: string, b: number): boolean => true); // $ExpectType LoDashImplicitWrapper<(a: string, b: number) => boolean> + _.chain(42).after((a: string, b: number): boolean => true); // $ExpectType LoDashExplicitWrapper<(a: string, b: number) => boolean> + fp.after((a: string, b: number): boolean => true, 42); // $ExpectType (a: string, b: number) => boolean + fp.after((a: string, b: number): boolean => true)(42); // $ExpectType (a: string, b: number) => boolean } // _.ary -namespace TestAry { - type SampleFunc = (a: number, b: string) => boolean; +{ + const func = (a: string, b: number) => true; - let func: SampleFunc = (a, b) => true; - - { - 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); - } + _.ary(func); // $ExpectType (...args: any[]) => any + _.ary(func, 2); // $ExpectType (...args: any[]) => any + _(func).ary(); // $ExpectType LoDashImplicitWrapper<(...args: any[]) => any> + _(func).ary(2); // $ExpectType LoDashImplicitWrapper<(...args: any[]) => any> + _.chain(func).ary(); // $ExpectType LoDashExplicitWrapper<(...args: any[]) => any> + _.chain(func).ary(2); // $ExpectType LoDashExplicitWrapper<(...args: any[]) => any> + fp.ary(1, func); // $ExpectType (...args: any[]) => any } // _.before -namespace TestBefore { - type Func = (a: string, b: number) => boolean; - - let func: Func = (a, b) => true; - - { - let result: Func; - - _.before(42, func); - } - - { - let result: _.LoDashImplicitObjectWrapper; - - _(42).before(func); - } - - { - let result: _.LoDashExplicitObjectWrapper; - - _(42).chain().before(func); - } +{ + _.before(42, (a: string, b: number): boolean => true); // $ExpectType (a: string, b: number) => boolean + _(42).before((a: string, b: number): boolean => true); // $ExpectType LoDashImplicitWrapper<(a: string, b: number) => boolean> + _.chain(42).before((a: string, b: number): boolean => true); // $ExpectType LoDashExplicitWrapper<(a: string, b: number) => boolean> + fp.before((a: string, b: number): boolean => true, 42); // $ExpectType (a: string, b: number) => boolean + fp.before((a: string, b: number): boolean => true)(42); // $ExpectType (a: string, b: number) => boolean } // _.bind -namespace TestBind { - type SampleFunc = (a: number, b: string) => boolean; +{ + const func = (a: string, b: number) => true; - let func: SampleFunc = (a, b) => true; - - { - type SampleResult = (a: number, b: string) => boolean; - - let result: SampleResult; - - result = _.bind(func, anything); - result = _.bind(func, anything); - } - - { - type SampleResult = (b: string) => boolean; - - let result: SampleResult; - - result = _.bind(func, anything, 42); - result = _.bind(func, anything, 42); - } - - { - type SampleResult = () => boolean; - - let result: SampleResult; - - result = _.bind(func, anything, 42, ''); - result = _.bind(func, anything, 42, ''); - } - - { - type SampleResult = (a: number, b: string) => boolean; - - let result: _.LoDashImplicitObjectWrapper; - - result = _(func).bind(anything); - } - - { - type SampleResult = (b: string) => boolean; - - let result: _.LoDashImplicitObjectWrapper; - - result = _(func).bind(anything, 42); - } - - { - type SampleResult = () => boolean; - - let result: _.LoDashImplicitObjectWrapper; - - result = _(func).bind(anything, 42, ''); - } - - { - type SampleResult = (a: number, b: string) => boolean; - - let result: _.LoDashExplicitObjectWrapper; - - result = _(func).chain().bind(anything); - } - - { - type SampleResult = (b: string) => boolean; - - let result: _.LoDashExplicitWrapper; - - result = _(func).chain().bind(anything, 42); - } - - { - type SampleResult = () => boolean; - - let result: _.LoDashExplicitWrapper; - - result = _(func).chain().bind(anything, 42, ''); - } + _.bind(func, anything); // $ExpectType (...args: any[]) => any + _.bind(func, anything, 42); // $ExpectType (...args: any[]) => any + _.bind(func, anything, 42, ""); // $ExpectType (...args: any[]) => any + _(func).bind(anything); // $ExpectType LoDashImplicitWrapper<(...args: any[]) => any> + _(func).bind(anything, 42); // $ExpectType LoDashImplicitWrapper<(...args: any[]) => any> + _(func).bind(anything, 42, ""); // $ExpectType LoDashImplicitWrapper<(...args: any[]) => any> + _.chain(func).bind(anything); // $ExpectType LoDashExplicitWrapper<(...args: any[]) => any> + _.chain(func).bind(anything, 42); // $ExpectType LoDashExplicitWrapper<(...args: any[]) => any> + _.chain(func).bind(anything, 42, ""); // $ExpectType LoDashExplicitWrapper<(...args: any[]) => any> + fp.bind((a: string, b: number) => true, anything); // $ExpectType (...args: any[]) => any + fp.bind((a: string, b: number) => true)(anything); // $ExpectType (...args: any[]) => any } // _.bindAll -namespace TestBindAll { - interface SampleObject { - a(): void; - b(): void; - c(): void; - } +{ + const object = { a: () => {}, b: () => {}, c: () => {} }; - let object: SampleObject = { a: () => {}, b: () => {}, c: () => {} }; - - { - 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'); - } + _.bindAll(object); // $ExpectType { a: () => void; b: () => void; c: () => void; } + _.bindAll(object, "a", ["b", "c"]); // $ExpectType { a: () => void; b: () => void; c: () => void; } + _(object).bindAll(); // $ExpectType LoDashImplicitWrapper<{ a: () => void; b: () => void; c: () => void; }> + _(object).bindAll("a", ["b", "c"]); // $ExpectType LoDashImplicitWrapper<{ a: () => void; b: () => void; c: () => void; }> + _.chain(object).bindAll(); // $ExpectType LoDashExplicitWrapper<{ a: () => void; b: () => void; c: () => void; }> + _.chain(object).bindAll("a", ["b", "c"]); // $ExpectType LoDashExplicitWrapper<{ a: () => void; b: () => void; c: () => void; }> + fp.bindAll("a", object); // $ExpectType { a: () => void; b: () => void; c: () => void; } + fp.bindAll(["b", "c"])(object); // $ExpectType { a: () => void; b: () => void; c: () => void; } } // _.bindKey -namespace TestBindKey { - let object = { +{ + const object = { foo: (a: number, b: string) => true, }; - { - type SampleResult = (a: number, b: string) => boolean; - - let result: SampleResult; - - result = _.bindKey(object, 'foo'); - } - - { - type SampleResult = (b: string) => boolean; - - let result: SampleResult; - - result = _.bindKey(object, 'foo', 42); - } - - { - type SampleResult = () => boolean; - - let result: SampleResult; - - 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, ''); - } + _.bindKey(object, "foo"); // $ExpectType (...args: any[]) => any + _.bindKey(object, "foo", 42, ""); // $ExpectType (...args: any[]) => any + _(object).bindKey("foo"); // $ExpectType LoDashImplicitWrapper<(...args: any[]) => any> + _(object).bindKey("foo", 42, ""); // $ExpectType LoDashImplicitWrapper<(...args: any[]) => any> + _.chain(object).bindKey("foo"); // $ExpectType LoDashExplicitWrapper<(...args: any[]) => any> + _.chain(object).bindKey("foo", 42, ""); // $ExpectType LoDashExplicitWrapper<(...args: any[]) => any> + fp.bindKey(object, "foo"); // $ExpectType (...args: any[]) => any + fp.bindKey(object)("foo"); // $ExpectType (...args: any[]) => any } // _.curry -const testCurryFn = (a: number, b: number, c: number) => [a, b, c]; -let curryResult0: number[] -let curryResult1: _.CurriedFunction1 -let curryResult2: _.CurriedFunction2 +{ + const testCurry = (a: string, b: number, c: boolean): [string, number, boolean] => [a, b, c]; + _.curry(testCurry)("1", 2, true); // $ExpectType [string, number, boolean] + _.curry(testCurry)("1", 2)(true); // $ExpectType [string, number, boolean] + _.curry(testCurry)("1")(2, true); // $ExpectType [string, number, boolean] + _.curry(testCurry)("1")(2)(true); // $ExpectType [string, number, boolean] + _.curry(testCurry)("1", 2); // $ExpectType CurriedFunction1 + _.curry(testCurry)("1")(2); // $ExpectType CurriedFunction1 + _.curry(testCurry)("1"); // $ExpectType CurriedFunction2 + _.curry(testCurry); // $ExpectType CurriedFunction3 + _(testCurry).curry(); // $ExpectType LoDashImplicitWrapper> + _.chain(testCurry).curry(); // $ExpectType LoDashExplicitWrapper> -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); + fp.curry(testCurry)("1", 2, true); // $ExpectType [string, number, boolean] + fp.curry(testCurry)("1", 2)(true); // $ExpectType [string, number, boolean] + fp.curry(testCurry)("1")(2, true); // $ExpectType [string, number, boolean] + fp.curry(testCurry)("1")(2)(true); // $ExpectType [string, number, boolean] + fp.curry(testCurry)("1", 2); // $ExpectType CurriedFunction1 + fp.curry(testCurry)("1")(2); // $ExpectType CurriedFunction1 + fp.curry(testCurry)("1"); // $ExpectType CurriedFunction2 + fp.curry(testCurry); // $ExpectType CurriedFunction3 -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 + _.curryRight(testCurry)("1", 2, true); // $ExpectType [string, number, boolean] + _.curryRight(testCurry)(2, true)("1"); // $ExpectType [string, number, boolean] + _.curryRight(testCurry)(true)("1", 2); // $ExpectType [string, number, boolean] + _.curryRight(testCurry)(true)(2)("1"); // $ExpectType [string, number, boolean] + _.curryRight(testCurry)(2, true); // $ExpectType RightCurriedFunction1 + _.curryRight(testCurry)(true)(2); // $ExpectType RightCurriedFunction1 + _.curryRight(testCurry)(true); // $ExpectType RightCurriedFunction2 + _.curryRight(testCurry); // $ExpectType RightCurriedFunction3 + _(testCurry).curryRight(); // $ExpectType LoDashImplicitWrapper> + _.chain(testCurry).curryRight(); // $ExpectType LoDashExplicitWrapper> -// _.curryRight -const 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: _.RightCurriedFunction1; -let curryResult8: _.RightCurriedFunction2; -let curryResult9: _.RightCurriedFunction3; -curryResult3 = _.curryRight(testCurry2)("1", 2, true); -curryResult3 = _.curryRight(testCurry2)( 2,true)("1"); -curryResult3 = _.curryRight(testCurry2)(true)( "1",2); -curryResult3 = _.curryRight(testCurry2)(true)(2)("1"); -curryResult7 = _.curryRight(testCurry2)(2,true); -curryResult7 = _.curryRight(testCurry2)(true)(2); -curryResult8 = _.curryRight(testCurry2)(true); -curryResult9 = _.curryRight(testCurry2); + fp.curryRight(testCurry)("1", 2, true); // $ExpectType [string, number, boolean] + fp.curryRight(testCurry)(true)("1", 2); // $ExpectType [string, number, boolean] + fp.curryRight(testCurry)(2, true)("1"); // $ExpectType [string, number, boolean] + fp.curryRight(testCurry)(true)(2)("1"); // $ExpectType [string, number, boolean] + fp.curryRight(testCurry)(2, true); // $ExpectType RightCurriedFunction1 + fp.curryRight(testCurry)(true)(2); // $ExpectType RightCurriedFunction1 + fp.curryRight(testCurry)(true); // $ExpectType RightCurriedFunction2 + fp.curryRight(testCurry); // $ExpectType RightCurriedFunction3 +} // _.debounce -namespace TestDebounce { - type SampleFunc = (n: number, s: string) => boolean; +{ + const func = (n: number, s: string): boolean => true; + const options: _.DebounceSettings = { + leading: true, + maxWait: 100, + trailing: false, + }; - interface Options { - leading?: boolean; - maxWait?: number; - trailing?: boolean; - } + const result = _.debounce(func); // $ExpectType ((n: number, s: string) => boolean) & Cancelable + result.cancel(); // $ExpectType void + result.flush(); // $ExpectType void + _.debounce(func, 42); // $ExpectType ((n: number, s: string) => boolean) & Cancelable + _.debounce(func, 42, options); // $ExpectType ((n: number, s: string) => boolean) & Cancelable - interface ResultFunc { - (n: number, s: string): boolean; - cancel(): void; - flush(): void; - } - - let func: SampleFunc = (a, b) => true; - 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); - } + _(func).debounce(42, options); // $ExpectType LoDashImplicitWrapper<((n: number, s: string) => boolean) & Cancelable> + _.chain(func).debounce(42, options); // $ExpectType LoDashExplicitWrapper<((n: number, s: string) => boolean) & Cancelable> + fp.debounce(42, func); // $ExpectType ((n: number, s: string) => boolean) & Cancelable + fp.debounce(42)(func); // $ExpectType ((n: number, s: string) => boolean) & Cancelable } // _.defer -namespace TestDefer { - type SampleFunc = (a: number, b: string) => boolean; +{ + const func = (a: number, b: string) => true; - let func: SampleFunc = (a, b) => true; - - { - let result: number; - - result = _.defer(func); - result = _.defer(func, anything); - result = _.defer(func, anything, anything); - result = _.defer(func, anything, anything, anything); - } - - { - let result: _.LoDashImplicitWrapper; - - result = _(func).defer(); - result = _(func).defer(anything); - result = _(func).defer(anything, anything); - result = _(func).defer(anything, anything, anything); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(func).chain().defer(); - result = _(func).chain().defer(anything); - result = _(func).chain().defer(anything, anything); - result = _(func).chain().defer(anything, anything, anything); - } + _.defer(func); // $ExpectType number + _.defer(func, anything, anything, anything); // $ExpectType number + _(func).defer(); // $ExpectType LoDashImplicitWrapper + _(func).defer(anything, anything, anything); // $ExpectType LoDashImplicitWrapper + _.chain(func).defer(); // $ExpectType LoDashExplicitWrapper + _.chain(func).defer(anything, anything, anything); // $ExpectType LoDashExplicitWrapper + fp.defer(func); // $ExpectType number } // _.delay -namespace TestDelay { - type SampleFunc = (a: number, b: string) => boolean; +{ + const func = (a: number, b: string) => true; - let func: SampleFunc = (a, b) => true; - - { - 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, ''); - } + _.delay(func, 500); // $ExpectType number + _.delay(func, 500, anything, anything); // $ExpectType number + _(func).delay(500); // $ExpectType LoDashImplicitWrapper + _(func).delay(500, anything, anything); // $ExpectType LoDashImplicitWrapper + _.chain(func).delay(500); // $ExpectType LoDashExplicitWrapper + _.chain(func).delay(500, anything, anything); // $ExpectType LoDashExplicitWrapper + fp.delay(500, func); // $ExpectType number + fp.delay(500)(func); // $ExpectType number } // _.flip -namespace TestFlip { - type Func = (a: string, b: number) => boolean; - - let func: Func = (a, b) => true; - - { - let result: Func; - - result = _.flip(func); - } - - { - let result: _.LoDashImplicitObjectWrapper; - - result = _(func).flip(); - } - - { - let result: _.LoDashExplicitObjectWrapper; - - result = _(func).chain().flip(); - } +{ + // TODO: fix - output arguments should be reversed + _.flip((a: string, b: number): boolean => true); // $ExpectType (a: string, b: number) => boolean + _((a: string, b: number): boolean => true).flip(); // $ExpectType LoDashImplicitWrapper<(a: string, b: number) => boolean> + _.chain((a: string, b: number): boolean => true).flip(); // $ExpectType LoDashExplicitWrapper<(a: string, b: number) => boolean> + fp.flip((a: string, b: number): boolean => true); // $ExpectType (a: string, b: number) => boolean } // _.flow -namespace TestFlow { - let Fn1 = (n: number) => 0; - let Fn2 = (m: number, n: number) => 0; - let Fn3 = (a: number) => ""; - let Fn4 = (a: string) => 0; - - { - // type infer test - let result: (m: number, n: number) => number; - - result = _.flow(Fn2, Fn1); - result = _.flow(Fn2, Fn1, Fn1); - result = _.flow(Fn2, Fn1, Fn1, Fn1); - result = _.flow(Fn2, Fn1, Fn1, Fn1, Fn1); - result = _.flow(Fn2, Fn1, Fn1, Fn1, Fn1, Fn1); - result = _.flow(Fn2, Fn1, Fn1, Fn1, Fn1, Fn1, Fn1); - result = _.flow(Fn2, Fn1, Fn3, Fn4); - result = _.flow([Fn2, Fn1, Fn3, Fn4]); - } - - { - let result: (m: number, n: number) => number; - - result = _.flow(Fn2, Fn1); - result = _.flow(Fn2, Fn1, Fn1); - result = _.flow(Fn2, Fn1, Fn1, Fn1); - result = _.flow([Fn1, Fn1, Fn1, Fn2]); - } - - { - let result: _.LoDashImplicitObjectWrapper<(m: number, n: number) => number>; - - result = _(Fn2).flow(Fn1); - result = _(Fn2).flow(Fn1, Fn1); - result = _(Fn2).flow(Fn1, Fn1, Fn1); - result = _(Fn2).flow([Fn1, Fn1, Fn1]); - } - - { - let result: _.LoDashExplicitObjectWrapper<(m: number, n: number) => number>; - - result = _(Fn2).chain().flow(Fn1); - result = _(Fn2).chain().flow(Fn1, Fn1); - result = _(Fn2).chain().flow(Fn1, Fn1, Fn1); - result = _(Fn2).chain().flow([Fn1, Fn1, Fn1]); - } -} - // _.flowRight -namespace TestFlowRight { - let Fn1 = (n: number) => 0; - let Fn2 = (m: number, n: number) => 0; +{ + const fn1 = (n: number): number => 0; + const fn2 = (m: number, n: number): number => 0; + const fn3 = (a: number): string => ""; + const fn4 = (a: string): boolean => true; - { - let result: (m: number, n: number) => number; + _.flow(fn2, fn1); // $ExpectType (a1: number, a2: number) => number + _.flow(fn2, fn1, fn1, fn1, fn1, fn1, fn1); // $ExpectType (a1: number, a2: number) => number + _.flow(fn2, fn1, fn3, fn4); // $ExpectType (a1: number, a2: number) => boolean + _.flow([fn2, fn1, fn3, fn4]); // $ExpectType (...args: any[]) => any - result = _.flowRight(Fn1, Fn2); - result = _.flowRight(Fn1, Fn1, Fn2); - result = _.flowRight(Fn1, Fn1, Fn1, Fn2); - result = _.flowRight([Fn1, Fn1, Fn1, Fn2]); - } + _(fn2).flow(fn1); // $ExpectType LoDashImplicitWrapper<(a1: number, a2: number) => number> + _(fn2).flow(fn1, fn1); // $ExpectType LoDashImplicitWrapper<(a1: number, a2: number) => number> + _(fn2).flow(fn1, fn1, fn1); // $ExpectType LoDashImplicitWrapper<(a1: number, a2: number) => number> + _(fn2).flow([fn1, fn1, fn1]); // $ExpectType LoDashImplicitWrapper<(...args: any[]) => any> - { - let result: _.LoDashImplicitObjectWrapper<(m: number, n: number) => number>; + _.chain(fn2).flow(fn1); // $ExpectType LoDashExplicitWrapper<(a1: number, a2: number) => number> + _.chain(fn2).flow(fn1, fn1); // $ExpectType LoDashExplicitWrapper<(a1: number, a2: number) => number> + _.chain(fn2).flow(fn1, fn1, fn1); // $ExpectType LoDashExplicitWrapper<(a1: number, a2: number) => number> + _.chain(fn2).flow([fn1, fn1, fn1]); // $ExpectType LoDashExplicitWrapper<(...args: any[]) => any> - result = _(Fn1).flowRight(Fn2); - result = _(Fn1).flowRight(Fn1, Fn2); - result = _(Fn1).flowRight(Fn1, Fn1, Fn2); - result = _(Fn1).flowRight([Fn1, Fn1, Fn2]); - } + fp.flow(fn1, fn1); // $ExpectType (a1: number) => number + fp.flow(fn1, fn3); // $ExpectType (a1: number) => string + fp.flow(fn2, fn1, fn1); // $ExpectType (a1: number, a2: number) => number + fp.flow(fn2, fn1, fn1, fn1); // $ExpectType (a1: number, a2: number) => number + fp.flow(fn2, fn1, fn1, fn1, fn1); // $ExpectType (a1: number, a2: number) => number + fp.flow(fn2, fn1, fn1, fn1, fn1, fn1); // $ExpectType (a1: number, a2: number) => number + fp.flow(fn2, fn1, fn1, fn1, fn1, fn1, fn1); // $ExpectType (a1: number, a2: number) => number + fp.flow(fn2, fn3); // $ExpectType (a1: number, a2: number) => string + fp.flow(fn2, fn3, fn4); // $ExpectType (a1: number, a2: number) => boolean + fp.flow(fn2, fn1, fn3, fn4); // $ExpectType (a1: number, a2: number) => boolean + fp.flow([fn2, fn1, fn3, fn4]); // $ExpectType (...args: any[]) => any - { - let result: _.LoDashExplicitObjectWrapper<(m: number, n: number) => number>; + _.flowRight(fn1, fn2); // $ExpectType (a1: number, a2: number) => number + _.flowRight(fn1, fn1, fn2); // $ExpectType (a1: number, a2: number) => number + _.flowRight(fn1, fn1, fn1, fn2); // $ExpectType (a1: number, a2: number) => number + _.flowRight([fn1, fn1, fn1, fn2]); // $ExpectType (...args: any[]) => any - result = _(Fn1).chain().flowRight(Fn2); - result = _(Fn1).chain().flowRight(Fn1, Fn2); - result = _(Fn1).chain().flowRight(Fn1, Fn1, Fn2); - result = _(Fn1).chain().flowRight([Fn1, Fn1, Fn2]); - } + _(fn1).flowRight(fn2); // $ExpectType LoDashImplicitWrapper<(a1: number, a2: number) => number> + _(fn1).flowRight(fn1, fn2); // $ExpectType LoDashImplicitWrapper<(a1: number, a2: number) => number> + _(fn1).flowRight(fn1, fn1, fn2); // $ExpectType LoDashImplicitWrapper<(a1: number, a2: number) => number> + _(fn1).flowRight([fn1, fn1, fn2]); // $ExpectType LoDashImplicitWrapper<(...args: any[]) => any> + + _.chain(fn1).flowRight(fn2); // $ExpectType LoDashExplicitWrapper<(a1: number, a2: number) => number> + _.chain(fn1).flowRight(fn1, fn2); // $ExpectType LoDashExplicitWrapper<(a1: number, a2: number) => number> + _.chain(fn1).flowRight(fn1, fn1, fn2); // $ExpectType LoDashExplicitWrapper<(a1: number, a2: number) => number> + _.chain(fn1).flowRight([fn1, fn1, fn2]); // $ExpectType LoDashExplicitWrapper<(...args: any[]) => any> + + fp.flowRight(fn1, fn1); // $ExpectType (a1: number) => number + fp.flowRight(fn3, fn1); // $ExpectType (a1: number) => string + fp.flowRight(fn1, fn1, fn2); // $ExpectType (a1: number, a2: number) => number + fp.flowRight(fn1, fn1, fn1, fn2); // $ExpectType (a1: number, a2: number) => number + fp.flowRight(fn1, fn1, fn1, fn1, fn2); // $ExpectType (a1: number, a2: number) => number + fp.flowRight(fn1, fn1, fn1, fn1, fn1, fn2); // $ExpectType (a1: number, a2: number) => number + fp.flowRight(fn1, fn1, fn1, fn1, fn1, fn1, fn2); // $ExpectType (a1: number, a2: number) => number + fp.flowRight(fn3, fn2); // $ExpectType (a1: number, a2: number) => string + fp.flowRight(fn4, fn3, fn2); // $ExpectType (a1: number, a2: number) => boolean + fp.flowRight(fn4, fn3, fn1, fn2); // $ExpectType (a1: number, a2: number) => boolean + fp.flowRight([fn4, fn3, fn1, fn2]); // $ExpectType (...args: any[]) => any } // _.memoize -namespace TestMemoize { - { - let fn: any = () => {}; - let memoizedFunction: _.MemoizedFunction = fn; - let cache: _.MapCache = memoizedFunction.cache; - } +{ + const memoizedFunction: _.MemoizedFunction = anything; + memoizedFunction.cache; // $ExpectType MapCache - interface MemoizedResultFn extends _.MemoizedFunction { - (a1: string, a2: number): boolean; - } + const testMapCache: _.MapCache = { + delete(key: string) { return true; }, + get(key: string): any { return 1; }, + has(key: string) { return true; }, + set(key: string, value: any): _.Dictionary { return {}; }, + clear() { }, + }; - let memoizeFn = (a1: string, a2: number) => true; - let memoizeResolverFn = (a1: string, a2: number) => ""; + const memoizeFn = (a1: string, a2: number): boolean => true; + const memoizeResolverFn = (a1: string, a2: number) => ""; - { - let result: MemoizedResultFn; + _.memoize(memoizeFn); // $ExpectType ((a1: string, a2: number) => boolean) & MemoizedFunction + _.memoize(memoizeFn, memoizeResolverFn); // $ExpectType ((a1: string, a2: number) => boolean) & MemoizedFunction + _(memoizeFn).memoize(); // $ExpectType LoDashImplicitWrapper<((a1: string, a2: number) => boolean) & MemoizedFunction> + _(memoizeFn).memoize(memoizeResolverFn); // $ExpectType LoDashImplicitWrapper<((a1: string, a2: number) => boolean) & MemoizedFunction> + _.chain(memoizeFn).memoize(); // $ExpectType LoDashExplicitWrapper<((a1: string, a2: number) => boolean) & MemoizedFunction> + _.chain(memoizeFn).memoize(memoizeResolverFn); // $ExpectType LoDashExplicitWrapper<((a1: string, a2: number) => boolean) & MemoizedFunction> + fp.memoize(memoizeFn); // $ExpectType ((a1: string, a2: number) => boolean) & MemoizedFunction - result = _.memoize(memoizeFn); - result = _.memoize(memoizeFn, memoizeResolverFn); - - result('foo', 1); - result.cache.get('foo1'); - } - - { - let result: _.LoDashImplicitObjectWrapper; - - result = _(memoizeFn).memoize(); - result = _(memoizeFn).memoize(memoizeResolverFn); - } - - { - let result: _.LoDashExplicitObjectWrapper; - - result = _(memoizeFn).chain().memoize(); - result = _(memoizeFn).chain().memoize(memoizeResolverFn); - } - - interface MemoizeCache { - delete(key: K): boolean; - get(key: K): V; - has(key: K): boolean; - set(key: K, value: V): this; - clear(): void; - } - class MemoizeCacheClass implements MemoizeCache { - delete: (key: any) => true; - get: (key: any) => 1; - has: (key: any) => true; - set: (key: any, value: any) => this; - clear: () => { }; - } - - _.memoize.Cache = MemoizeCacheClass; + // $ExpectType MapCache + new _.memoize.Cache(); } // _.overArgs -namespace TestOverArgs { - type Func1 = (a: boolean) => boolean; - type Func2 = (a: boolean, b: boolean) => boolean; +{ + const func = (a: number, b: string) => true; - let func1: Func1 = (a) => true; - let func2: Func2 = (a, b) => true; + _.overArgs(func, (a: number) => true, (b: string) => true); // $ExpectType (...args: any[]) => any + _.overArgs(func, [(a: number) => true, (b: string) => true]); // $ExpectType (...args: any[]) => any + _(func).overArgs((a: number) => true, (b: string) => true); // $ExpectType LoDashImplicitWrapper<(...args: any[]) => any> + _(func).overArgs([(a: number) => true, (b: string) => true]); // $ExpectType LoDashImplicitWrapper<(...args: any[]) => any> + _.chain(func).overArgs((a: number) => true, (b: string) => true); // $ExpectType LoDashExplicitWrapper<(...args: any[]) => any> + _.chain(func).overArgs([(a: number) => true, (b: string) => true]); // $ExpectType LoDashExplicitWrapper<(...args: any[]) => any> - let transform1 = (a: string) => true; - let transform2 = (b: number) => true; - - { - let result: (a: string) => boolean; - - result = _.overArgs(func1, transform1); - result = _.overArgs(func1, [transform1]); - } - - { - let result: (a: string, b: number) => boolean; - - result = _.overArgs(func2, transform1, transform2); - result = _.overArgs(func2, [transform1, transform2]); - } - - { - let result: _.LoDashImplicitObjectWrapper<(a: string) => boolean>; - - result = _(func1).overArgs(transform1); - result = _(func1).overArgs([transform1]); - } - - { - let result: _.LoDashImplicitObjectWrapper<(a: string, b: number) => boolean>; - - result = _(func2).overArgs(transform1, transform2); - result = _(func2).overArgs([transform1, transform2]); - } - - { - let result: _.LoDashExplicitObjectWrapper<(a: string) => boolean>; - - result = _(func1).chain().overArgs(transform1); - result = _(func1).chain().overArgs([transform1]); - } - - { - let result: _.LoDashExplicitObjectWrapper<(a: string, b: number) => boolean>; - - result = _(func2).chain().overArgs(transform1, transform2); - result = _(func2).chain().overArgs([transform1, transform2]); - } + fp.overArgs(func, [(a: number) => true, (b: string) => true]); // $ExpectType (...args: any[]) => any + fp.overArgs(func)([(a: number) => true, (b: string) => true]); // $ExpectType (...args: any[]) => any } // _.negate -namespace TestNegate { - type PredicateFn = (a1: number, a2: number) => boolean; - - const predicate = (a1: number, a2: number) => a1 > a2; - - { - let result: PredicateFn; - - result = _.negate(predicate); - } - - { - let result: _.LoDashImplicitObjectWrapper; - - result = _(predicate).negate(); - } - - { - let result: _.LoDashExplicitObjectWrapper; - - result = _(predicate).chain().negate(); - } +{ + _.negate((a1: number, a2: number): boolean => true); // $ExpectType (a1: number, a2: number) => boolean + _((a1: number, a2: number): boolean => true).negate(); // $ExpectType LoDashImplicitWrapper<(a1: number, a2: number) => boolean> + _.chain((a1: number, a2: number): boolean => true).negate(); // $ExpectType LoDashExplicitWrapper<(a1: number, a2: number) => boolean> + fp.negate((a1: number, a2: number): boolean => true); // $ExpectType (a1: number, a2: number) => boolean } // _.once -namespace TestOnce { - type Func = (a: string, b: number) => boolean; - - let func: Func = (a, b) => true; - - { - let result: Func; - - result = _.once(func); - } - - { - let result: _.LoDashImplicitObjectWrapper; - - result = _(func).once(); - } - - { - let result: _.LoDashExplicitObjectWrapper; - - result = _(func).chain().once(); - } +{ + _.once((a: string, b: number): boolean => true); // $ExpectType (a: string, b: number) => boolean + _((a: string, b: number): boolean => true).once(); // $ExpectType LoDashImplicitWrapper<(a: string, b: number) => boolean> + _.chain((a: string, b: number): boolean => true).once(); // $ExpectType LoDashExplicitWrapper<(a: string, b: number) => boolean> + fp.once((a: string, b: number): boolean => true); // $ExpectType (a: string, b: number) => boolean } -const greetPartial = (greeting: string, name: string) => `${greeting} ${name}`; -const hi = _.partial(greetPartial, 'hi'); -hi('moe'); +// _.rearg +{ + const testReargFn = (a: string, b: string, c: string) => [a, b, c]; + _.rearg(testReargFn, 2, 0, 1); // $ExpectType (...args: any[]) => any + _.rearg(testReargFn, [2, 0, 1]); // $ExpectType (...args: any[]) => any + _(testReargFn).rearg(2, 0, 1); // $ExpectType LoDashImplicitWrapper<(...args: any[]) => any> + _(testReargFn).rearg([2, 0, 1]); // $ExpectType LoDashImplicitWrapper<(...args: any[]) => any> + _.chain(testReargFn).rearg(2, 0, 1); // $ExpectType LoDashExplicitWrapper<(...args: any[]) => any> + _.chain(testReargFn).rearg([2, 0, 1]); // $ExpectType LoDashExplicitWrapper<(...args: any[]) => any> -const defaultsDeep: (...args: any[]) => any = _.partialRight(_.merge, _.defaults); - -const optionsPartialRight = { - 'variable': 'data', - 'imports': { 'jq': $ } -}; - -defaultsDeep(optionsPartialRight, _.templateSettings); - -//_.rearg -const testReargFn = (a: string, b: string, c: string) => [a, b, c]; -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'); + fp.rearg([2, 0, 1], testReargFn); // $ExpectType (...args: any[]) => any + fp.rearg([2, 0, 1])(testReargFn); // $ExpectType (...args: any[]) => any +} // _.rest -namespace TestRest { - type Func = (a: string, b: number[]) => boolean; - type ResultFunc = (a: string, ...b: number[]) => boolean; - - let func: Func = (a, b) => true; - - { - let result: ResultFunc; - - result = _.rest(func); - result = _.rest(func, 1); - } - - { - let result: _.LoDashImplicitObjectWrapper; - - result = _(func).rest(); - result = _(func).rest(1); - } - - { - let result: _.LoDashExplicitObjectWrapper; - - result = _(func).chain().rest(); - result = _(func).chain().rest(1); - } +{ + _.rest((a: string, b: number[]) => true); // $ExpectType (...args: any[]) => any + _.rest((a: string, b: number[]) => true, 1); // $ExpectType (...args: any[]) => any + _((a: string, b: number[]) => true).rest(); // $ExpectType LoDashImplicitWrapper<(...args: any[]) => any> + _((a: string, b: number[]) => true).rest(1); // $ExpectType LoDashImplicitWrapper<(...args: any[]) => any> + _.chain((a: string, b: number[]) => true).rest(); // $ExpectType LoDashExplicitWrapper<(...args: any[]) => any> + _.chain((a: string, b: number[]) => true).rest(1); // $ExpectType LoDashExplicitWrapper<(...args: any[]) => any> + fp.rest((a: string, b: number[]) => true); // $ExpectType (...args: any[]) => any + fp.restFrom(1)((a: string, b: number[]) => true); // $ExpectType (...args: any[]) => any } -//_.spread -namespace TestSpread { - type SampleFunc = (args: Array) => boolean; - type SampleResult = (a: number, b: string) => boolean; - - let func: SampleFunc = (a) => true; - - { - let result: SampleResult; - - result = _.spread(func); - } - - { - let result: _.LoDashImplicitObjectWrapper; - - result = _(func).spread(); - } - - { - let result: _.LoDashExplicitObjectWrapper; - - result = _(func).chain().spread(); - } +// _.spread +{ + _.spread((a: Array): boolean => true); // $ExpectType (...args: any[]) => boolean + _((a: Array): boolean => true).spread(); // $ExpectType LoDashImplicitWrapper<(...args: any[]) => boolean> + _.chain((a: Array): boolean => true).spread(); // $ExpectType LoDashExplicitWrapper<(...args: any[]) => boolean> + fp.spread((a: Array): boolean => true); // $ExpectType (...args: any[]) => boolean } // _.throttle -namespace TestThrottle { - type SampleFunc = (n: number, s: string) => boolean; +{ + const options: _.ThrottleSettings = { + leading: true, + trailing: false, + }; - interface Options { - leading?: boolean; - trailing?: boolean; - } + const func = (a: number, b: string): boolean => true; - interface ResultFunc { - (n: number, s: string): boolean; - cancel(): void; - flush(): void; - } + _.throttle(func); // $ExpectType ((a: number, b: string) => boolean) & Cancelable + _.throttle(func, 42); // $ExpectType ((a: number, b: string) => boolean) & Cancelable + _.throttle(func, 42, options); // $ExpectType ((a: number, b: string) => boolean) & Cancelable + _(func).throttle(); // $ExpectType LoDashImplicitWrapper<((a: number, b: string) => boolean) & Cancelable> + _(func).throttle(42); // $ExpectType LoDashImplicitWrapper<((a: number, b: string) => boolean) & Cancelable> + _(func).throttle(42, options); // $ExpectType LoDashImplicitWrapper<((a: number, b: string) => boolean) & Cancelable> + _.chain(func).throttle(); // $ExpectType LoDashExplicitWrapper<((a: number, b: string) => boolean) & Cancelable> + _.chain(func).throttle(42); // $ExpectType LoDashExplicitWrapper<((a: number, b: string) => boolean) & Cancelable> + _.chain(func).throttle(42, options); // $ExpectType LoDashExplicitWrapper<((a: number, b: string) => boolean) & Cancelable> - let func: SampleFunc = (a, b) => true; - 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); - } + fp.throttle(42, func); // $ExpectType ((a: number, b: string) => boolean) & Cancelable + fp.throttle(42)(func); // $ExpectType ((a: number, b: string) => boolean) & Cancelable } // _.unary -namespace TestUnary { - type Func = (a: string, b: number[]) => boolean; - - let func: Func = (a, b) => true; - - { - let result: Func; - - result = _.unary(func); - } - - { - let result: _.LoDashImplicitObjectWrapper; - - result = _(func).unary(); - } - - { - let result: _.LoDashExplicitObjectWrapper; - - result = _(func).chain().unary(); - } +{ + _.unary((a: string, b: number): boolean => true); // $ExpectType (arg1: string) => boolean + _((a: string, b: number): boolean => true).unary(); // $ExpectType LoDashImplicitWrapper<(arg1: string) => boolean> + _.chain((a: string, b: number): boolean => true).unary(); // $ExpectType LoDashExplicitWrapper<(arg1: string) => boolean> + fp.unary((a: string, b: number): boolean => true); // $ExpectType (arg1: string) => boolean } // _.wrap -namespace 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 = { a: 1, b: "", c: true }; - let wrapper: SampleWrapper = (a, b, c) => true; - let result: SampleResult; - - result = _.wrap(value, wrapper); - } - - { - type SampleWrapper = (arg1: number, arg2: number, arg3: string) => boolean; - - let value = 0; - let wrapper: SampleWrapper = (a, b, c) => true; - let result: _.LoDashImplicitObjectWrapper; - - result = _(value).wrap(wrapper); - } - - { - type SampleWrapper = (arg1: number[], arg2: number, arg3: string) => boolean; - - let value: number[] = []; - let wrapper: SampleWrapper = (a, b, c) => true; - let result: _.LoDashImplicitObjectWrapper; - - result = _(value).wrap(wrapper); - } - - { - type SampleWrapper = (arg1: SampleValue, arg2: number, arg3: string) => boolean; - - let value: SampleValue = { a: 1, b: "", c: true }; - let wrapper: SampleWrapper = (a, b, c) => true; - let result: _.LoDashImplicitObjectWrapper; - - result = _(value).wrap(wrapper); - } - - { - type SampleWrapper = (arg1: number, arg2: number, arg3: string) => boolean; - - let value = 0; - let wrapper: SampleWrapper = (a, b, c) => true; - let result: _.LoDashExplicitObjectWrapper; - - result = _(value).chain().wrap(wrapper); - } - - { - type SampleWrapper = (arg1: number[], arg2: number, arg3: string) => boolean; - - let value: number[] = []; - let wrapper: SampleWrapper = (a, b, c) => true; - let result: _.LoDashExplicitObjectWrapper; - - result = _(value).chain().wrap(wrapper); - } - - { - type SampleWrapper = (arg1: SampleValue, arg2: number, arg3: string) => boolean; - - let value: SampleValue = { a: 1, b: "", c: true }; - let wrapper: SampleWrapper = (a, b, c) => true; - let result: _.LoDashExplicitObjectWrapper; - - result = _(value).chain().wrap(wrapper); - } +{ + _.wrap("a", (arg1: string, ...args: number[]): boolean => true); // $ExpectType (...args: number[]) => boolean + _("a").wrap((arg1: string, ...args: number[]): boolean => true); // $ExpectType LoDashImplicitWrapper<(...args: number[]) => boolean> + _.chain("a").wrap((arg1: string, ...args: number[]): boolean => true); // $ExpectType LoDashExplicitWrapper<(...args: number[]) => boolean> + fp.wrap((arg1: string, ...args: number[]): boolean => true, "a"); // $ExpectType (...args: number[]) => boolean + fp.wrap((arg1: string, ...args: number[]): boolean => true)("a"); // $ExpectType (...args: number[]) => boolean } /******** @@ -7951,1548 +3819,984 @@ namespace TestWrap { ********/ // _.castArray -namespace TestCastArray { - { - let result: number[]; +{ + _.castArray(42); // $ExpectType number[] + _.castArray([42]); // $ExpectType number[] + _.castArray({ a: 42 }); // $ExpectType { a: number; }[] + _(42).castArray(); // $ExpectType LoDashImplicitWrapper + _([42]).castArray(); // $ExpectType LoDashImplicitWrapper + _.chain(42).castArray(); // $ExpectType LoDashExplicitWrapper + _.chain([42]).castArray(); // $ExpectType LoDashExplicitWrapper - result = _.castArray(42); - } - - { - let result: _.LoDashImplicitArrayWrapper; - - result = _(42).castArray(); - result = _([42]).castArray(); - } - - { - let result: _.LoDashImplicitArrayWrapper<{a: number}>; - - result = _({a: 42}).castArray(); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _(42).chain().castArray(); - result = _([42]).chain().castArray(); - } - - { - let result: _.LoDashExplicitArrayWrapper<{a: number}>; - - result = _({a: 42}).chain().castArray(); - } + fp.castArray(42); // $ExpectType number[] + fp.castArray([42]); // $ExpectType number[] } // _.clone -namespace TestClone { - { - let result: number; - - result = _.clone(42); - result = _(42).clone(); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(42).chain().clone(); - } - - { - let result: string[]; - - result = _.clone(['']); - result = _(['']).clone(); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _(['']).chain().clone(); - } - - { - let result: {a: {b: number;};}; - - result = _.clone<{a: {b: number;};}>({a: {b: 42}}); - result = _({a: {b: 42}}).clone(); - } - - { - let result: _.LoDashExplicitObjectWrapper<{a: {b: number;};}>; - - result = _({a: {b: 42}}).chain().clone(); - } +{ + _.clone(42); // $ExpectType 42 + _.clone({ a: { b: 42 } }); // $ExpectType { a: { b: number; }; } + _(42).clone(); // $ExpectType number + _({ a: { b: 42 } }).clone(); // $ExpectType { a: { b: number; }; } + _.chain(42).clone(); // $ExpectType LoDashExplicitWrapper + _.chain({ a: { b: 42 } }).clone(); // $ExpectType LoDashExplicitWrapper<{ a: { b: number; }; }> + fp.clone(42); // $ExpectType 42 + fp.clone({ a: { b: 42 } }); // $ExpectType { a: { b: number; }; } } // _.cloneDeep -namespace TestCloneDeep { - { - let result: number; - - result = _.cloneDeep(42); - result = _(42).cloneDeep(); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(42).chain().cloneDeep(); - } - - { - let result: string[]; - - result = _.cloneDeep(['']); - result = _(['']).cloneDeep(); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _(['']).chain().cloneDeep(); - } - - { - let result: {a: {b: number;};}; - - result = _.cloneDeep<{a: {b: number;};}>({a: {b: 42}}); - result = _({a: {b: 42}}).cloneDeep(); - } - - { - let result: _.LoDashExplicitObjectWrapper<{a: {b: number;};}>; - - result = _({a: {b: 42}}).chain().cloneDeep(); - } +{ + _.cloneDeep(42); // $ExpectType 42 + _.cloneDeep({ a: { b: 42 } }); // $ExpectType { a: { b: number; }; } + _(42).cloneDeep(); // $ExpectType number + _({ a: { b: 42 } }).cloneDeep(); // $ExpectType { a: { b: number; }; } + _.chain(42).cloneDeep(); // $ExpectType LoDashExplicitWrapper + _.chain({ a: { b: 42 } }).cloneDeep(); // $ExpectType LoDashExplicitWrapper<{ a: { b: number; }; }> + fp.cloneDeep(42); // $ExpectType 42 + fp.cloneDeep({ a: { b: 42 } }); // $ExpectType { a: { b: number; }; } } // _.cloneDeepWith -namespace TestCloneDeepWith { - type CloneDeepWithCustomizer = (value: V) => R; +{ + const customizer = (x: any) => ""; - { - let customizer: CloneDeepWithCustomizer = (x) => ""; - let reslut: string; + _.cloneDeepWith(42, customizer); // $ExpectType any + _(42).cloneDeepWith(customizer); // $ExpectType any + _.chain(42).cloneDeepWith(customizer); // $ExpectType LoDashExplicitWrapper - result = _.cloneDeepWith(42, customizer); - result = _(42).cloneDeepWith(customizer); - } + _.cloneDeepWith({a: {b: 42}}, customizer); // $ExpectType any - { - let customizer: CloneDeepWithCustomizer = (x) => ""; - let result: _.LoDashExplicitWrapper; - - result = _(42).chain().cloneDeepWith(customizer); - } - - { - let customizer: CloneDeepWithCustomizer = (x) => []; - let reslut: string[]; - - result = _.cloneDeepWith([42], customizer); - result = _([42]).cloneDeepWith(customizer); - } - - { - let customizer: CloneDeepWithCustomizer = (x) => []; - let result: _.LoDashExplicitArrayWrapper; - - result = _([42]).chain().cloneDeepWith(customizer); - } - - { - let customizer: CloneDeepWithCustomizer<{a: {b: number;};}, {a: {b: string;};}> = (x) => ({ a: { b: "" } }); - let reslut: {a: {b: string;};}; - - result = _.cloneDeepWith({a: {b: 42}}, customizer); - result = _({a: {b: 42}}).cloneDeepWith(customizer); - } - - { - let customizer: CloneDeepWithCustomizer<{a: {b: number;};}, {a: {b: string;};}> = (x) => ({ a: { b: "" } }); - let result: _.LoDashExplicitObjectWrapper<{a: {b: string;};}>; - - result = _({a: {b: 42}}).chain().cloneDeepWith(customizer); - } + fp.cloneDeepWith((x) => "", 42); // $ExpectType any + fp.cloneDeepWith((x) => "")(42); // $ExpectType any + fp.cloneDeepWith((x) => "", [42]); // $ExpectType any + fp.cloneDeepWith((x) => "", { a: { b: 42 } }); // $ExpectType any } // _.cloneWith -namespace TestCloneWith { - type CloneWithCustomizer = (value: V) => R; - +{ { - let customizer: CloneWithCustomizer = (x) => ""; - let reslut: string; + const customizer = (x: number) => ""; - result = _.cloneWith(42, customizer); - result = _.cloneWith(42, customizer); - result = _(42).cloneWith(customizer); + _.cloneWith(42, customizer); // $ExpectType string + _(42).cloneWith(customizer); // $ExpectType string + _.chain(42).cloneWith(customizer); // $ExpectType LoDashExplicitWrapper + + fp.cloneWith(customizer, 42); // $ExpectType string + fp.cloneWith(customizer)(42); // $ExpectType string } { - let customizer: CloneWithCustomizer = (x) => ""; - let result: _.LoDashExplicitWrapper; + const customizer = (x: number): string | undefined => ""; - result = _(42).chain().cloneWith(customizer); - } + _.cloneWith(42, customizer); // string | 42 + _(42).cloneWith(customizer); // string | 42 + _.chain(42).cloneWith(customizer); // string | 42 - { - let customizer: CloneWithCustomizer = (x) => []; - let reslut: string[]; - - result = _.cloneWith([42], customizer); - result = _.cloneWith([42], customizer); - result = _([42]).cloneWith(customizer); - } - - { - let customizer: CloneWithCustomizer = (x) => []; - let result: _.LoDashExplicitArrayWrapper; - - result = _([42]).chain().cloneWith(customizer); - } - - { - let customizer: CloneWithCustomizer<{a: {b: number;};}, {a: {b: string;};}> = (x) => ({ a: { b: "" } }); - let reslut: {a: {b: string;};}; - - result = _.cloneWith({a: {b: 42}}, customizer); - result = _.cloneWith<{a: {b: number;};}, {a: {b: string;};}>({a: {b: 42}}, customizer); - result = _({a: {b: 42}}).cloneWith<{a: {b: string;};}>(customizer); - } - - { - let customizer: CloneWithCustomizer<{a: {b: number;};}, {a: {b: string;};}> = (x) => ({ a: { b: "" } }); - let result: _.LoDashExplicitObjectWrapper<{a: {b: string;};}>; - - result = _({a: {b: 42}}).chain().cloneWith<{a: {b: string;};}>(customizer); + // Note: TS 2.5 fails without explicit <42, string> + fp.cloneWith<42, string>(customizer, 42); // $ExpectType string | 42 + fp.cloneWith<42, string>(customizer)(42); // $ExpectType string | 42 } } // _.conforms -namespace TestConforms { - let result: boolean = _.conforms({foo: (v: string) => false})({foo: "foo"}); - let result2: boolean = _.conforms({})({foo: "foo"}); +{ + _.conforms({ foo: (v: string) => false })({ foo: "foo" }); // $ExpectType boolean + fp.conforms({ foo: (v: string) => false })({ foo: "foo" }); // $ExpectType boolean } // _.conformsTo -namespace TestConformsTo { - let result: boolean = _.conformsTo({foo: "foo"}, {foo: (v: string) => false}); - let result2: boolean = _.conformsTo({}, {foo: (v: string) => false}); +{ + _.conformsTo({ foo: "foo" }, { foo: (v: string) => false }); // $ExpectType boolean + _({ foo: "foo" }).conformsTo({ foo: (v: string) => false }); // $ExpectType boolean + _.chain({ foo: "foo" }).conformsTo({ foo: (v: string) => false }); // $ExpectType LoDashExplicitWrapper + + fp.conformsTo({ foo: (v: string) => false }, { foo: "foo" }); // $ExpectType boolean + fp.conformsTo({ foo: (v: string) => false })({ foo: "foo" }); // $ExpectType boolean } // _.eq -namespace TestEq { - let customizer: (value: any, other: any, indexOrKey?: number|string) => boolean; +{ + _.eq(anything, anything); // $ExpectType boolean + _(anything).eq(anything); // $ExpectType boolean + _.chain(anything).eq(anything); // $ExpectType LoDashExplicitWrapper - { - let result: boolean; - - result = _.eq(anything, anything); - - result = _(anything).eq(anything); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(anything).chain().eq(anything); - } + fp.eq(anything, anything); // $ExpectType boolean + fp.eq(anything)(anything); // $ExpectType boolean } // _.gt -namespace TestGt { - { - let result: boolean; +{ + _.gt(anything, anything); // $ExpectType boolean + _(anything).gt(anything); // $ExpectType boolean + _.chain(anything).gt(anything); // $ExpectType LoDashExplicitWrapper - result = _.gt(anything, anything); - result = _(1).gt(anything); - result = _([]).gt(anything); - result = _({}).gt(anything); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(1).chain().gt(anything); - result = _([]).chain().gt(anything); - result = _({}).chain().gt(anything); - } + fp.gt(anything, anything); // $ExpectType boolean + fp.gt(anything)(anything); // $ExpectType boolean } // _.gte -namespace TestGte { - { - let result: boolean; +{ + _.gte(anything, anything); // $ExpectType boolean + _(anything).gte(anything); // $ExpectType boolean + _.chain(anything).gte(anything); // $ExpectType LoDashExplicitWrapper - result = _.gte(anything, anything); - result = _(1).gte(anything); - result = _([]).gte(anything); - result = _({}).gte(anything); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(1).chain().gte(anything); - result = _([]).chain().gte(anything); - result = _({}).chain().gte(anything); - } + fp.gte(anything, anything); // $ExpectType boolean + fp.gte(anything)(anything); // $ExpectType boolean } // _.isArguments -namespace TestisArguments { - { - let value: number|IArguments = 0; +{ + const value: number | IArguments = 0; - if (_.isArguments(value)) { - let result: IArguments = value; - } - else { - let result: number = value; - } + if (_.isArguments(value)) { + const result: IArguments = value; + } else { + value; // $ExpectType number } - { - let result: boolean; - - result = _.isArguments(anything); - result = _(1).isArguments(); - result = _([]).isArguments(); - result = _({}).isArguments(); + if (fp.isArguments(value)) { + const result: IArguments = value; + } else { + value; // $ExpectType number } - { - let result: _.LoDashExplicitWrapper; - - result = _(1).chain().isArguments(); - result = _([]).chain().isArguments(); - result = _({}).chain().isArguments(); - } + _.isArguments(""); // $ExpectType boolean + _({}).isArguments(); // $ExpectType boolean + _.chain([]).isArguments(); // $ExpectType LoDashExplicitWrapper + fp.isArguments(anything); // $ExpectType boolean } // _.isArray -namespace TestIsArray { - { - let value: number|string[]|boolean[] = anything; +{ + const value: number | string[] | boolean[] = anything; - if (_.isArray(value)) { - value; // $ExpectType string[] | boolean[] - } - else { - value; // $ExpectType number - } + if (_.isArray(value)) { + const result: string[] | boolean[] = value; + } else { + value; // $ExpectType number } - { - let result: boolean; - - result = _.isArray(anything); - result = _(1).isArray(); - result = _([]).isArray(); - result = _({}).isArray(); + if (fp.isArray(value)) { + const result: string[] | boolean[] = value; + } else { + value; // $ExpectType number } - { - let result: _.LoDashExplicitWrapper; - - result = _(1).chain().isArray(); - result = _([]).chain().isArray(); - result = _({}).chain().isArray(); - } + _.isArray(anything); // $ExpectType boolean + _({}).isArray(); // $ExpectType boolean + _.chain([]).isArray(); // $ExpectType LoDashExplicitWrapper + fp.isArray(anything); // $ExpectType boolean } // _.isArrayBuffer -namespace TestIsArrayBuffer { - { - let value: ArrayBuffer|number = anything; +{ + const value: ArrayBuffer | number = anything; - if (_.isArrayBuffer(value)) { - value; // $ExpectType ArrayBuffer - } - else { - value; // $ExpectType number - } + if (_.isArrayBuffer(value)) { + value; // $ExpectType ArrayBuffer + } else { + value; // $ExpectType number } - { - let result: boolean; - - result = _.isArrayBuffer(anything); - result = _(1).isArrayBuffer(); - result = _([]).isArrayBuffer(); - result = _({}).isArrayBuffer(); + if (fp.isArrayBuffer(value)) { + value; // $ExpectType ArrayBuffer + } else { + value; // $ExpectType number } - { - let result: _.LoDashExplicitWrapper; - - result = _(1).chain().isArrayBuffer(); - result = _([]).chain().isArrayBuffer(); - result = _({}).chain().isArrayBuffer(); - } + _.isArrayBuffer(anything); // $ExpectType boolean + _({}).isArrayBuffer(); // $ExpectType boolean + _.chain([]).isArrayBuffer(); // $ExpectType LoDashExplicitWrapper + fp.isArrayBuffer(anything); // $ExpectType boolean } // _.isArrayLike -namespace TestIsArrayLike { +{ { - let value: string | string[] | { [index: number]: boolean, length: number } | [number, boolean] + const value: string | string[] | { [index: number]: boolean, length: number } | [number, boolean] | number | { length: string } | { a: string } | null | undefined = anything; if (_.isArrayLike(value)) { - let result: string | string[] | { [index: number]: boolean, length: number } | [number, boolean] = value; + const result: string | string[] | { [index: number]: boolean, length: number } | [number, boolean] = value; } else { - let result: number | { length: string } | { a: string; } | null | undefined = value; + const result: number | { length: string } | { a: string; } | null | undefined = value; + } + + if (fp.isArrayLike(value)) { + const result: string | string[] | { [index: number]: boolean; length: number; } | [number, boolean] = value; + } else { + const result: number | { length: string; } | { a: string; } | null | undefined = value; } } { - let value: boolean[] = anything; + const value: boolean[] = anything; if (_.isArrayLike(value)) { - let result: boolean[] = value; + const result: boolean[] = value; + } else { + value; // $ExpectType never } - else { + + if (fp.isArrayLike(value)) { + value; // $ExpectType boolean[] + } else { value; // $ExpectType never } } { - let value: () => number = anything; + const value: () => number = anything; if (_.isArrayLike(value)) { value; // $ExpectType never } else { value; // $ExpectType () => number } + + if (fp.isArrayLike(value)) { + value; // $ExpectType never + } else { + value; // $ExpectType () => number + } } { - let value: { a: string } = anything; + const value: { a: string } = anything; if (_.isArrayLike(value)) { - let result: { a: string, length: number } = value; + const result: { a: string, length: number } = value; + } else { + value; // $ExpectType { a: string; } } - else { + + if (fp.isArrayLike(value)) { + const result: { a: string, length: number } = value; + } else { value; // $ExpectType { a: string; } } } { - let value: any = anything; + const value: any = anything; if (_.isArrayLike(value)) { value; // $ExpectType any + } else { + value; // $ExpectType any } - else { + + if (fp.isArrayLike(value)) { + value; // $ExpectType any + } else { value; // $ExpectType any } } - { - let result: boolean; - - result = _.isArrayLike(anything); - result = _(1).isArrayLike(); - result = _([]).isArrayLike(); - result = _({}).isArrayLike(); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(1).chain().isArrayLike(); - result = _([]).chain().isArrayLike(); - result = _({}).chain().isArrayLike(); - } + _.isArrayLike(anything); // $ExpectType boolean + _({}).isArrayLike(); // $ExpectType boolean + _.chain([]).isArrayLike(); // $ExpectType LoDashExplicitWrapper + fp.isArrayLike(anything); // $ExpectType boolean } // _.isArrayLikeObject -namespace TestIsArrayLikeObject { +{ { - let value: string[] | { [index: number]: boolean, length: number } | [number, boolean] + const value: string[] | { [index: number]: boolean, length: number } | [number, boolean] | number | string | { length: string } | { a: string } | null | undefined = anything; if (_.isArrayLikeObject(value)) { - let result: string[] | { [index: number]: boolean, length: number } | [number, boolean] = value; + const result: string[] | { [index: number]: boolean, length: number } | [number, boolean] = value; } else { - let result: string | number | { length: string; } | { a: string; } | null | undefined = value; + const result: string | number | { length: string; } | { a: string; } | null | undefined = value; + } + + if (fp.isArrayLikeObject(value)) { + const result: string[] | [number, boolean] | { [index: number]: boolean; length: number; } = value; + } else { + const result: string | number | { length: string; } | { a: string; } | null | undefined = value; } } { - let value: boolean[] = anything; + const value: boolean[] = anything; if (_.isArrayLikeObject(value)) { - let result: boolean[] = value; + const result: boolean[] = value; + } else { + value; // $ExpectType never } - else { + + if (fp.isArrayLikeObject(value)) { + const result: boolean[] = value; + } else { value; // $ExpectType never } } { - let value: (a: string) => boolean = anything; + const value: (a: string) => boolean = anything; if (_.isArrayLikeObject(value)) { value; // $ExpectType never } else { value; // $ExpectType (a: string) => boolean } + + if (fp.isArrayLikeObject(value)) { + value; // $ExpectType never + } else { + value; // $ExpectType (a: string) => boolean + } } { - let value: { a: string } = anything; + const value: { a: string } = anything; if (_.isArrayLikeObject(value)) { - let result: { a: string, length: number } = value; + const result: { a: string, length: number } = value; + } else { + value; // $ExpectType { a: string; } } - else { + + if (fp.isArrayLikeObject(value)) { + const result: { a: string, length: number } = value; + } else { value; // $ExpectType { a: string; } } } { - let value: any = anything; + const value: any = anything; if (_.isArrayLikeObject(value)) { value; // $ExpectType any + } else { + value; // $ExpectType any } - else { + + if (fp.isArrayLikeObject(value)) { + value; // $ExpectType any + } else { value; // $ExpectType any } } - { - let result: boolean; - - result = _.isArrayLikeObject(anything); - result = _(1).isArrayLikeObject(); - result = _([]).isArrayLikeObject(); - result = _({}).isArrayLikeObject(); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(1).chain().isArrayLikeObject(); - result = _([]).chain().isArrayLikeObject(); - result = _({}).chain().isArrayLikeObject(); - } + _.isArrayLikeObject(anything); // $ExpectType boolean + _({}).isArrayLikeObject(); // $ExpectType boolean + _.chain([]).isArrayLikeObject(); // $ExpectType LoDashExplicitWrapper + fp.isArrayLikeObject(anything); // $ExpectType boolean } // _.isBoolean -namespace TestIsBoolean { - { - let value: number|boolean = 0; +{ + const value: number | boolean = 0; - if (_.isBoolean(value)) { - let result: boolean = value; - } - else { - let result: number = value; - } + if (_.isBoolean(value)) { + const result: boolean = value; + } else { + value; // $ExpectType number } - { - let result: boolean; - - result = _.isBoolean(anything); - result = _(1).isBoolean(); - result = _([]).isBoolean(); - result = _({}).isBoolean(); + if (fp.isBoolean(value)) { + const result: boolean = value; + } else { + value; // $ExpectType number } - { - let result: _.LoDashExplicitWrapper; - - result = _(1).chain().isBoolean(); - result = _([]).chain().isBoolean(); - result = _({}).chain().isBoolean(); - } + _.isBoolean(anything); // $ExpectType boolean + _({}).isBoolean(); // $ExpectType boolean + _.chain([]).isBoolean(); // $ExpectType LoDashExplicitWrapper } // _.isBuffer -namespace TestIsBuffer { - { - let result: boolean; - - result = _.isBuffer(anything); - result = _(1).isBuffer(); - result = _([]).isBuffer(); - result = _({}).isBuffer(); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(1).chain().isBuffer(); - result = _([]).chain().isBuffer(); - result = _({}).chain().isBuffer(); - } +{ + _.isBuffer(anything); // $ExpectType boolean + _({}).isBuffer(); // $ExpectType boolean + _.chain([]).isBuffer(); // $ExpectType LoDashExplicitWrapper + fp.isBuffer(anything); // $ExpectType boolean } // _.isDate { - { - let value: number|Date = 0; + const value: number | Date = 0; - if (_.isDate(value)) { - let result: Date = value; - } - else { - let result: number = value; - } + if (_.isDate(value)) { + const result: Date = value; + } else { + value; // $ExpectType number } - { - let result: boolean; - - result = _.isDate(anything); - result = _(42).isDate(); - result = _([]).isDate(); - result = _({}).isDate(); + if (fp.isDate(value)) { + const date: Date = value; + } else { + value; // $ExpectType number } - { - let result: _.LoDashExplicitWrapper; - - result = _(42).chain().isDate(); - result = _([]).chain().isDate(); - result = _({}).chain().isDate(); - } + _.isDate(anything); // $ExpectType boolean + _({}).isDate(); // $ExpectType boolean + _.chain([]).isDate(); // $ExpectType LoDashExplicitWrapper + fp.isDate(anything); // $ExpectType boolean } // _.isElement -namespace TestIsElement { - { - let result: boolean; - - result = _.isElement(anything); - - result = _(42).isElement(); - result = _([]).isElement(); - result = _({}).isElement(); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(42).chain().isElement(); - result = _([]).chain().isElement(); - result = _({}).chain().isElement(); - } +{ + _.isElement(anything); // $ExpectType boolean + _({}).isElement(); // $ExpectType boolean + _.chain([]).isElement(); // $ExpectType LoDashExplicitWrapper + fp.isElement(anything); // $ExpectType boolean } // _.isEmpty -namespace TestIsEmpty { - { - let result: boolean; - - result = _.isEmpty(anything); - result = _(1).isEmpty(); - result = _('').isEmpty(); - result = _([]).isEmpty(); - result = _({}).isEmpty(); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(1).chain().isEmpty(); - result = _('').chain().isEmpty(); - result = _([]).chain().isEmpty(); - result = _({}).chain().isEmpty(); - } +{ + _.isEmpty(anything); // $ExpectType boolean + _({}).isEmpty(); // $ExpectType boolean + _.chain([]).isEmpty(); // $ExpectType LoDashExplicitWrapper + fp.isEmpty(anything); // $ExpectType boolean } // _.isEqual -namespace TestIsEqual { - let customizer: (value: any, other: any, indexOrKey?: number|string) => boolean; +{ + _.isEqual(anything, anything); // $ExpectType boolean + _(anything).isEqual(anything); // $ExpectType boolean + _.chain(anything).isEqual(anything); // $ExpectType LoDashExplicitWrapper - { - let result: boolean; - - result = _.isEqual(anything, anything); - - result = _(anything).isEqual(anything); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(anything).chain().isEqual(anything); - } + fp.isEqual(anything, anything); // $ExpectType boolean + fp.isEqual(anything)(anything); // $ExpectType boolean + fp.equals(anything)(anything); // $ExpectType boolean } // _.isEqualWith -namespace TestIsEqualWith { - let customizer = (value: any, other: any, indexOrKey: number|string|symbol|undefined, parent: any, otherParent: any, stack: any) => true; +{ + const customizer = (value: any, other: any, indexOrKey: number|string|symbol|undefined, parent: any, otherParent: any, stack: any) => true; - { - let result: boolean; + _.isEqualWith(anything, anything, customizer); // $ExpectType boolean + _(anything).isEqualWith(anything, customizer); // $ExpectType boolean + _.chain(anything).isEqualWith(anything, customizer); // $ExpectType LoDashExplicitWrapper - result = _.isEqualWith(anything, anything, customizer); - - result = _(anything).isEqualWith(anything, customizer); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(anything).chain().isEqualWith(anything, customizer); - } + fp.isEqualWith(customizer, anything, anything); // $ExpectType boolean + fp.isEqualWith(customizer)(anything)(anything); // $ExpectType boolean } // _.isError -namespace TestIsError { - let x: any = 1; +{ { - let value: number|Error = x; + const value: number | Error = anything; if (_.isError(value)) { - let result: Error = value; + value; // $ExpectType Error + } else { + value; // $ExpectType number } - else { - let result: number = value; + + if (fp.isError(value)) { + value; // $ExpectType Error + } else { + value; // $ExpectType number } } { class CustomError extends Error { - custom: string + custom: string; } - let value: number|CustomError = x; + const value: number | CustomError = anything; if (_.isError(value)) { - let result: CustomError = value; - } - else { - let result: number = value; - } - } - - { - let result: boolean; - - result = _.isError(anything); - result = _(1).isError(); - result = _([]).isError(); - result = _({}).isError(); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(1).chain().isError(); - result = _([]).chain().isError(); - result = _({}).chain().isError(); - } -} - -// _.isFinite -namespace TestIsFinite { - { - let result: boolean; - - result = _.isFinite(anything); - result = _(1).isFinite(); - result = _([]).isFinite(); - result = _({}).isFinite(); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(1).chain().isFinite(); - result = _([]).chain().isFinite(); - result = _({}).chain().isFinite(); - } -} - -// _.isFunction -namespace TestIsFunction { - { - let value: number|(() => void) = anything; - - if (_.isFunction(value)) { - value; // $ExpectType () => void - } - else { + value; // $ExpectType CustomError + } else { value; // $ExpectType number } - if (_.isFunction(anything)) { - anything(); + if (fp.isError(value)) { + value; // $ExpectType CustomError + } else { + value; // $ExpectType number } } - { - let result: boolean; + _.isError(anything); // $ExpectType boolean + _({}).isError(); // $ExpectType boolean + _.chain([]).isError(); // $ExpectType LoDashExplicitWrapper + fp.isError(anything); // $ExpectType boolean +} - result = _.isFunction(anything); - result = _(1).isFunction(); - result = _([]).isFunction(); - result = _({}).isFunction(); +// _.isFinite +{ + _.isFinite(NaN); // $ExpectType boolean + _(42).isFinite(); // $ExpectType boolean + _.chain([]).isFinite(); // $ExpectType LoDashExplicitWrapper + fp.isFinite(anything); // $ExpectType boolean +} + +// _.isFunction +{ + const value: number | (() => void) = anything; + + if (_.isFunction(value)) { + value; // $ExpectType () => void + } else { + value; // $ExpectType number } - { - let result: _.LoDashExplicitWrapper; - - result = _(1).chain().isFunction(); - result = _([]).chain().isFunction(); - result = _({}).chain().isFunction(); + if (fp.isFunction(value)) { + value; // $ExpectType () => void + } else { + value; // $ExpectType number } + + if (_.isFunction(anything)) { + anything(); + } + + if (fp.isFunction(anything)) { + anything(); + } + + _.isFunction(anything); // $ExpectType boolean + _({}).isFunction(); // $ExpectType boolean + _.chain([]).isFunction(); // $ExpectType LoDashExplicitWrapper + fp.isFunction(anything); // $ExpectType boolean } // _.isInteger -namespace TestIsInteger { - { - let result: boolean; - - result = _.isInteger(anything); - - result = _(1).isInteger(); - result = _([]).isInteger(); - result = _({}).isInteger(); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(1).chain().isInteger(); - result = _([]).chain().isInteger(); - result = _({}).chain().isInteger(); - } +{ + _.isInteger(NaN); // $ExpectType boolean + _(42).isInteger(); // $ExpectType boolean + _.chain([]).isInteger(); // $ExpectType LoDashExplicitWrapper + fp.isInteger(anything); // $ExpectType boolean } // _.isLength -namespace TestIsLength { - { - let result: boolean; - - result = _.isLength(anything); - - result = _(1).isLength(); - result = _([]).isLength(); - result = _({}).isLength(); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(1).chain().isLength(); - result = _([]).chain().isLength(); - result = _({}).chain().isLength(); - } +{ + _.isLength(NaN); // $ExpectType boolean + _(42).isLength(); // $ExpectType boolean + _.chain([]).isLength(); // $ExpectType LoDashExplicitWrapper + fp.isLength(anything); // $ExpectType boolean } // _.isMap -namespace TestIsMap { - { - let value: number|Map = 0; +{ + const value: number | Map = 0; - if (_.isMap(value)) { - let result: Map = value; - } - else { - let result: number = value; - } + if (_.isMap(value)) { + const result: Map = value; + } else { + const result: number = value; } - { - let result: boolean; - - result = _.isMap(anything); - result = _(1).isMap(); - result = _([]).isMap(); - result = _({}).isMap(); + if (fp.isMap(value)) { + const result: Map = value; + } else { + const result: number = value; } - { - let result: _.LoDashExplicitWrapper; - - result = _(1).chain().isMap(); - result = _([]).chain().isMap(); - result = _({}).chain().isMap(); - } + _.isMap(anything); // $ExpectType boolean + _({}).isMap(); // $ExpectType boolean + _.chain([]).isMap(); // $ExpectType LoDashExplicitWrapper + fp.isMap(anything); // $ExpectType boolean } // _.isMatch -namespace TestIsMatch { +{ _.isMatch({}, {}); // $ExpectType boolean _({}).isMatch({}); // $ExpectType boolean _.chain({}).isMatch({}); // $ExpectType LoDashExplicitWrapper + fp.isMatch({}, {}); // $ExpectType boolean + fp.isMatch({})({}); // $ExpectType boolean } // _.isMatchWith -namespace TestIsMatchWith { - let testIsMatchCustiomizerFn = (value: any, other: any, indexOrKey: number|string|symbol) => true; +{ + const testIsMatchCustiomizerFn = (value: any, other: any, indexOrKey: number|string|symbol) => true; _.isMatchWith({}, {}, testIsMatchCustiomizerFn); // $ExpectType boolean _({}).isMatchWith({}, testIsMatchCustiomizerFn); // $ExpectType boolean _.chain({}).isMatchWith({}, testIsMatchCustiomizerFn); // $ExpectType LoDashExplicitWrapper + + fp.isMatchWith(testIsMatchCustiomizerFn, {}, {}); // $ExpectType boolean + fp.isMatchWith(testIsMatchCustiomizerFn)({})({}); // $ExpectType boolean } // _.isNaN -namespace TestIsNaN { - { - let result: boolean; - - result = _.isNaN(anything); - - result = _(1).isNaN(); - result = _([]).isNaN(); - result = _({}).isNaN(); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(1).chain().isNaN(); - result = _([]).chain().isNaN(); - result = _({}).chain().isNaN(); - } +{ + _.isNaN(NaN); // $ExpectType boolean + _(42).isNaN(); // $ExpectType boolean + _.chain([]).isNaN(); // $ExpectType LoDashExplicitWrapper + fp.isNaN(anything); // $ExpectType boolean } // _.isNative -namespace TestIsNative { - { - let value: number|(() => void) = anything; +{ + const value: number | (() => void) = anything; - if (_.isNative(value)) { - value; // $ExpectType () => void - } - else { - value; // $ExpectType number - } + if (_.isNative(value)) { + value; // $ExpectType () => void + } else { + value; // $ExpectType number } - { - let result: boolean; - - result = _.isNative(anything); - - result = _(1).isNative(); - result = _([]).isNative(); - result = _({}).isNative(); + if (fp.isNative(value)) { + value; // $ExpectType () => void + } else { + value; // $ExpectType number } - { - let result: _.LoDashExplicitWrapper; - - result = _(1).chain().isNative(); - result = _([]).chain().isNative(); - result = _({}).chain().isNative(); - } + _.isNative(anything); // $ExpectType boolean + _({}).isNative(); // $ExpectType boolean + _.chain([]).isNative(); // $ExpectType LoDashExplicitWrapper + fp.isNative(anything); // $ExpectType boolean } // _.isNil -namespace TestIsNil { - { - let result: boolean; - - result = _.isNil(anything); - - result = _(1).isNil(); - result = _([]).isNil(); - result = _({}).isNil(); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(1).chain().isNil(); - result = _([]).chain().isNil(); - result = _({}).chain().isNil(); - } +{ + _.isNil(null); // $ExpectType boolean + _(undefined).isNil(); // $ExpectType boolean + _.chain(NaN).isNil(); // $ExpectType LoDashExplicitWrapper + fp.isNil(undefined); // $ExpectType boolean } // _.isNull -namespace TestIsNull { - { - let result: boolean; - - result = _.isNull(anything); - - result = _(1).isNull(); - result = _([]).isNull(); - result = _({}).isNull(); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(1).chain().isNull(); - result = _([]).chain().isNull(); - result = _({}).chain().isNull(); - } +{ + _.isNull(null); // $ExpectType boolean + _(undefined).isNull(); // $ExpectType boolean + _.chain(NaN).isNull(); // $ExpectType LoDashExplicitWrapper + fp.isNull(undefined); // $ExpectType boolean } // _.isNumber -namespace TestIsNumber { - { - let value: string|number = 0; +{ + const value: string | number = 0; - if (_.isNumber(value)) { - let result: number = value; - } - else { - let result: string = value; - } + if (_.isNumber(value)) { + const result: number = value; + } else { + const result: string = value; } - { - let result: boolean; - - result = _.isNumber(anything); - - result = _(1).isNumber(); - result = _([]).isNumber(); - result = _({}).isNumber(); + if (fp.isNumber(value)) { + const result: number = value; + } else { + const result: string = value; } - { - let result: _.LoDashExplicitWrapper; - - result = _(1).chain().isNumber(); - result = _([]).chain().isNumber(); - result = _({}).chain().isNumber(); - } + _.isNumber(NaN); // $ExpectType boolean + _(42).isNumber(); // $ExpectType boolean + _.chain([]).isNumber(); // $ExpectType LoDashExplicitWrapper + fp.isNumber(anything); // $ExpectType boolean } // _.isObject -namespace TestIsObject { - { - let result: boolean; - - result = _.isObject(anything); - result = _(1).isObject(); - result = _([]).isObject(); - result = _({}).isObject(); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(1).chain().isObject(); - result = _([]).chain().isObject(); - result = _({}).chain().isObject(); - } +{ + _.isObject(NaN); // $ExpectType boolean + _(42).isObject(); // $ExpectType boolean + _.chain([]).isObject(); // $ExpectType LoDashExplicitWrapper + fp.isObject(anything); // $ExpectType boolean } // _.isObjectLike -namespace TestIsObjectLike { - { - let result: boolean; - - result = _.isObjectLike(anything); - result = _(1).isObjectLike(); - result = _([]).isObjectLike(); - result = _({}).isObjectLike(); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(1).chain().isObjectLike(); - result = _([]).chain().isObjectLike(); - result = _({}).chain().isObjectLike(); - } +{ + _.isObjectLike(NaN); // $ExpectType boolean + _(42).isObjectLike(); // $ExpectType boolean + _.chain([]).isObjectLike(); // $ExpectType LoDashExplicitWrapper + fp.isObjectLike(anything); // $ExpectType boolean } // _.isPlainObject -namespace TestIsPlainObject { - { - let result: boolean; - - result = _.isPlainObject(anything); - result = _(1).isPlainObject(); - result = _([]).isPlainObject(); - result = _({}).isPlainObject(); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(1).chain().isPlainObject(); - result = _([]).chain().isPlainObject(); - result = _({}).chain().isPlainObject(); - } +{ + _.isPlainObject(NaN); // $ExpectType boolean + _(42).isPlainObject(); // $ExpectType boolean + _.chain([]).isPlainObject(); // $ExpectType LoDashExplicitWrapper + fp.isPlainObject(anything); // $ExpectType boolean } // _.isRegExp -namespace TestIsRegExp { +{ { - let value: number|RegExp = /./; + const value: number | RegExp = anything; if (_.isRegExp(value)) { - let result: RegExp = value; + const result: RegExp = value; + } else { + const result: number = value; } - else { - let result: number = value; + + if (fp.isRegExp(value)) { + const result: RegExp = value; + } else { + const result: number = value; } } - { - let result: boolean; - - result = _.isRegExp(anything); - result = _(1).isRegExp(); - result = _([]).isRegExp(); - result = _({}).isRegExp(); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(1).chain().isRegExp(); - result = _([]).chain().isRegExp(); - result = _({}).chain().isRegExp(); - } + _.isRegExp(/./); // $ExpectType boolean + _(42).isRegExp(); // $ExpectType boolean + _.chain([]).isRegExp(); // $ExpectType LoDashExplicitWrapper + fp.isRegExp(anything); // $ExpectType boolean } // _.isSafeInteger -namespace TestIsSafeInteger { - { - let result: boolean; - - result = _.isSafeInteger(anything); - - result = _(1).isSafeInteger(); - result = _([]).isSafeInteger(); - result = _({}).isSafeInteger(); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(1).chain().isSafeInteger(); - result = _([]).chain().isSafeInteger(); - result = _({}).chain().isSafeInteger(); - } +{ + _.isSafeInteger(NaN); // $ExpectType boolean + _(42).isSafeInteger(); // $ExpectType boolean + _.chain([]).isSafeInteger(); // $ExpectType LoDashExplicitWrapper + fp.isSafeInteger(anything); // $ExpectType boolean } // _.isSet -namespace TestIsSet { - { - let value: number|Set = 0; +{ + const value: number | Set = 0; - if (_.isSet(value)) { - let result: Set = value; - } - else { - let result: number = value; - } + if (_.isSet(value)) { + const result: Set = value; + } else { + const result: number = value; } - { - let result: boolean; - - result = _.isSet(anything); - result = _(1).isSet(); - result = _([]).isSet(); - result = _({}).isSet(); + if (fp.isSet(value)) { + const result: Set = value; + } else { + const result: number = value; } - { - let result: _.LoDashExplicitWrapper; - - result = _(1).chain().isSet(); - result = _([]).chain().isSet(); - result = _({}).chain().isSet(); - } + _.isSet(NaN); // $ExpectType boolean + _(42).isSet(); // $ExpectType boolean + _.chain([]).isSet(); // $ExpectType LoDashExplicitWrapper + fp.isSet(anything); // $ExpectType boolean } // _.isString -namespace TestIsString { - { - let value: number|string = ''; +{ + const value: number | string = ""; - if (_.isString(value)) { - let result: string = value; - } - else { - let result: number = value; - } + if (_.isString(value)) { + const result: string = value; + } else { + const result: number = value; } - { - let result: boolean; - - result = _.isString(anything); - result = _(1).isString(); - result = _([]).isString(); - result = _({}).isString(); + if (fp.isString(value)) { + const result: string = value; + } else { + const result: number = value; } - { - let result: _.LoDashExplicitWrapper; - - result = _(1).chain().isString(); - result = _([]).chain().isString(); - result = _({}).chain().isString(); - } + _.isString(""); // $ExpectType boolean + _(42).isString(); // $ExpectType boolean + _.chain([]).isString(); // $ExpectType LoDashExplicitWrapper + fp.isString(anything); // $ExpectType boolean } // _.isSymbol -namespace TestIsSymbol { - { - let result: boolean; - - result = _.isSymbol(anything); - - result = _(1).isSymbol(); - result = _([]).isSymbol(); - result = _({}).isSymbol(); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(1).chain().isSymbol(); - result = _([]).chain().isSymbol(); - result = _({}).chain().isSymbol(); - } +{ + _.isSymbol(NaN); // $ExpectType boolean + _(42).isSymbol(); // $ExpectType boolean + _.chain([]).isSymbol(); // $ExpectType LoDashExplicitWrapper + fp.isSymbol(anything); // $ExpectType boolean } // _.isTypedArray -namespace TestIsTypedArray { - { - let result: boolean; - - result = _.isTypedArray([]); - result = _([]).isTypedArray(); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _([]).chain().isTypedArray(); - } +{ + _.isTypedArray(NaN); // $ExpectType boolean + _(42).isTypedArray(); // $ExpectType boolean + _.chain([]).isTypedArray(); // $ExpectType LoDashExplicitWrapper + fp.isTypedArray(anything); // $ExpectType boolean } // _.isUndefined -namespace TestIsUndefined { - { - let result: boolean; - - result = _.isUndefined(anything); - - result = _(1).isUndefined(); - result = _([]).isUndefined(); - result = _({}).isUndefined(); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(1).chain().isUndefined(); - result = _([]).chain().isUndefined(); - result = _({}).chain().isUndefined(); - } +{ + _.isUndefined(null); // $ExpectType boolean + _(undefined).isUndefined(); // $ExpectType boolean + _.chain(NaN).isUndefined(); // $ExpectType LoDashExplicitWrapper + fp.isUndefined(undefined); // $ExpectType boolean } // _.isWeakMap -namespace TestIsWeakMap { - { - let value: number | WeakMap = 0; +{ + const value: number | WeakMap = 0; - if (_.isWeakMap(value)) { - let result: WeakMap = value; - } - else { - let result: number = value; - } + if (_.isWeakMap(value)) { + const result: WeakMap = value; + } else { + const result: number = value; } - { - let result: boolean; - - result = _.isWeakMap(anything); - result = _(1).isWeakMap(); - result = _([]).isWeakMap(); - result = _({}).isWeakMap(); + if (fp.isWeakMap(value)) { + const result: WeakMap = value; + } else { + const result: number = value; } - { - let result: _.LoDashExplicitWrapper; - - result = _(1).chain().isWeakMap(); - result = _([]).chain().isWeakMap(); - result = _({}).chain().isWeakMap(); - } + _.isWeakMap(NaN); // $ExpectType boolean + _(42).isWeakMap(); // $ExpectType boolean + _.chain([]).isWeakMap(); // $ExpectType LoDashExplicitWrapper + fp.isWeakMap(anything); // $ExpectType boolean } // _.isWeakSet -namespace TestIsWeakSet { - { - let value: number | WeakSet = 0; +{ + const value: number | WeakSet = 0; - if (_.isWeakSet(value)) { - let result: WeakSet = value; - } - else { - let result: number = value; - } + if (_.isWeakSet(value)) { + const result: WeakSet = value; + } else { + const result: number = value; } - { - let result: boolean; - - result = _.isWeakSet(anything); - result = _(1).isWeakSet(); - result = _([]).isWeakSet(); - result = _({}).isWeakSet(); + if (fp.isWeakSet(value)) { + const result: WeakSet = value; + } else { + const result: number = value; } - { - let result: _.LoDashExplicitWrapper; - - result = _(1).chain().isWeakSet(); - result = _([]).chain().isWeakSet(); - result = _({}).chain().isWeakSet(); - } + _.isWeakSet(NaN); // $ExpectType boolean + _(42).isWeakSet(); // $ExpectType boolean + _.chain([]).isWeakSet(); // $ExpectType LoDashExplicitWrapper + fp.isWeakSet(anything); // $ExpectType boolean } // _.lt -namespace TestLt { - { - let result: boolean; +{ + _.lt(anything, anything); // $ExpectType boolean + _(anything).lt(anything); // $ExpectType boolean + _.chain(anything).lt(anything); // $ExpectType LoDashExplicitWrapper - result = _.lt(anything, anything); - result = _(1).lt(anything); - result = _([]).lt(anything); - result = _({}).lt(anything); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(1).chain().lt(anything); - result = _([]).chain().lt(anything); - result = _({}).chain().lt(anything); - } + fp.lt(anything, anything); // $ExpectType boolean + fp.lt(anything)(anything); // $ExpectType boolean } // _.lte -namespace TestLte { - { - let result: boolean; +{ + _.lte(anything, anything); // $ExpectType boolean + _(anything).lte(anything); // $ExpectType boolean + _.chain(anything).lte(anything); // $ExpectType LoDashExplicitWrapper - result = _.lte(anything, anything); - result = _(1).lte(anything); - result = _([]).lte(anything); - result = _({}).lte(anything); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(1).chain().lte(anything); - result = _([]).chain().lte(anything); - result = _({}).chain().lte(anything); - } + fp.lte(anything, anything); // $ExpectType boolean + fp.lte(anything)(anything); // $ExpectType boolean } // _.toArray -namespace TestToArray { - let array: AbcObject[] = []; - let list: _.List = []; - let dictionary: _.Dictionary = {}; - let numericDictionary: _.NumericDictionary = {}; +{ + const array: AbcObject[] = []; + const list: _.List = []; + const dictionary: _.Dictionary = {}; + const numericDictionary: _.NumericDictionary = {}; - { - let result: string[]; + _.toArray(""); // $ExpectType string[] + _.toArray(array); // $ExpectType AbcObject[] + _.toArray(list); // $ExpectType AbcObject[] + _.toArray(dictionary); // $ExpectType AbcObject[] + _.toArray(numericDictionary); // $ExpectType AbcObject[] - result = _.toArray(''); - result = _.toArray(''); - } + _(array).toArray(); // $ExpectType LoDashImplicitWrapper + _(list).toArray(); // $ExpectType LoDashImplicitWrapper + _(dictionary).toArray(); // $ExpectType LoDashImplicitWrapper + _(numericDictionary).toArray(); // $ExpectType LoDashImplicitWrapper - { - let result: AbcObject[]; + _.chain(array).toArray(); // $ExpectType LoDashExplicitWrapper + _.chain(list).toArray(); // $ExpectType LoDashExplicitWrapper + _.chain(dictionary).toArray(); // $ExpectType LoDashExplicitWrapper + _.chain(numericDictionary).toArray(); // $ExpectType LoDashExplicitWrapper - 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(); - } + fp.toArray(""); // $ExpectType string[] + fp.toArray(array); // $ExpectType AbcObject[] + fp.toArray(list); // $ExpectType AbcObject[] + fp.toArray(dictionary); // $ExpectType AbcObject[] + fp.toArray(numericDictionary); // $ExpectType AbcObject[] } // _.toPlainObject -namespace TestToPlainObject { - { - let result: AbcObject; - result = _.toPlainObject(); - result = _.toPlainObject(true); - result = _.toPlainObject(1); - result = _.toPlainObject('a'); - result = _.toPlainObject([]); - result = _.toPlainObject({}); - } +{ + _.toPlainObject(); // $ExpectType any + _.toPlainObject(true); // $ExpectType any + _.toPlainObject(1); // $ExpectType any + _.toPlainObject("a"); // $ExpectType any + _.toPlainObject([]); // $ExpectType any + _.toPlainObject({}); // $ExpectType any - { - let result: _.LoDashImplicitObjectWrapper; + _(true).toPlainObject(); // $ExpectType LoDashImplicitWrapper + _([""]).toPlainObject(); // $ExpectType LoDashImplicitWrapper + _({}).toPlainObject(); // $ExpectType LoDashImplicitWrapper - result = _(true).toPlainObject(); - result = _(1).toPlainObject(); - result = _('a').toPlainObject(); - result = _([1]).toPlainObject(); - result = _(['']).toPlainObject(); - result = _({}).toPlainObject(); - } + _.chain(true).toPlainObject(); // $ExpectType LoDashExplicitWrapper + _.chain([""]).toPlainObject(); // $ExpectType LoDashExplicitWrapper + _.chain({}).toPlainObject(); // $ExpectType LoDashExplicitWrapper + + fp.toPlainObject(true); // $ExpectType any + fp.toPlainObject(["a"]); // $ExpectType any + fp.toPlainObject({}); // $ExpectType any } // _.toFinite -namespace TestToFinite { - { - let result: number; - result = _.toFinite(true); - result = _.toFinite(1); - result = _.toFinite('3.2'); - result = _.toFinite([]); - result = _.toFinite({}); - } - - { - let result: number; - - result = _(true).toFinite(); - result = _(1).toFinite(); - result = _('3.2').toFinite(); - result = _([1]).toFinite(); - result = _([]).toFinite(); - result = _({}).toFinite(); - } +{ + _.toFinite(true); // $ExpectType number + _.toFinite(1); // $ExpectType number + _.toFinite("3.2"); // $ExpectType number + _(1).toFinite(); // $ExpectType number + _("3.2").toFinite(); // $ExpectType number + _.chain(1).toFinite(); // $ExpectType LoDashExplicitWrapper + _.chain("3.2").toFinite(); // $ExpectType LoDashExplicitWrapper + fp.toFinite(true); // $ExpectType number + fp.toFinite(1); // $ExpectType number + fp.toFinite("3.2"); // $ExpectType number } // _.toInteger -namespace TestToInteger { - { - let result: number; - result = _.toInteger(true); - result = _.toInteger(1); - result = _.toInteger('3.2'); - result = _.toInteger([]); - result = _.toInteger({}); - } - - { - let result: number; - - result = _(true).toInteger(); - result = _(1).toInteger(); - result = _('a').toInteger(); - result = _([1]).toInteger(); - result = _(['']).toInteger(); - result = _({}).toInteger(); - } +{ + _.toInteger(true); // $ExpectType number + _.toInteger(1); // $ExpectType number + _.toInteger("3.2"); // $ExpectType number + _(1).toInteger(); // $ExpectType number + _("3.2").toInteger(); // $ExpectType number + _.chain(1).toInteger(); // $ExpectType LoDashExplicitWrapper + _.chain("3.2").toInteger(); // $ExpectType LoDashExplicitWrapper + fp.toInteger(true); // $ExpectType number + fp.toInteger(1); // $ExpectType number + fp.toInteger("3.2"); // $ExpectType number } // _.toLength -namespace TestToLength { - { - let result: number; - result = _.toLength(true); - result = _.toLength(1); - result = _.toLength('a'); - result = _.toLength([]); - result = _.toLength({}); - } - - { - let result: number; - - result = _(true).toLength(); - result = _(1).toLength(); - result = _('a').toLength(); - result = _([1]).toLength(); - result = _(['']).toLength(); - result = _({}).toLength(); - } +{ + _.toLength(true); // $ExpectType number + _.toLength(1); // $ExpectType number + _.toLength("3.2"); // $ExpectType number + _(1).toLength(); // $ExpectType number + _("3.2").toLength(); // $ExpectType number + _.chain(1).toLength(); // $ExpectType LoDashExplicitWrapper + _.chain("3.2").toLength(); // $ExpectType LoDashExplicitWrapper + fp.toLength(true); // $ExpectType number + fp.toLength(1); // $ExpectType number + fp.toLength("3.2"); // $ExpectType number } // _.toNumber -namespace TestToNumber { - { - let result: number; - result = _.toNumber(true); - result = _.toNumber(1); - result = _.toNumber('a'); - result = _.toNumber([]); - result = _.toNumber({}); - } - - { - let result: number; - - result = _(true).toNumber(); - result = _(1).toNumber(); - result = _('a').toNumber(); - result = _([1]).toNumber(); - result = _(['']).toNumber(); - result = _({}).toNumber(); - } +{ + _.toNumber(true); // $ExpectType number + _.toNumber(1); // $ExpectType number + _.toNumber("3.2"); // $ExpectType number + _(1).toNumber(); // $ExpectType number + _("3.2").toNumber(); // $ExpectType number + _.chain(1).toNumber(); // $ExpectType LoDashExplicitWrapper + _.chain("3.2").toNumber(); // $ExpectType LoDashExplicitWrapper + fp.toNumber(true); // $ExpectType number + fp.toNumber(1); // $ExpectType number + fp.toNumber("3.2"); // $ExpectType number } // _.toSafeInteger -namespace TestToSafeInteger { - { - let result: number; - result = _.toSafeInteger(true); - result = _.toSafeInteger(1); - result = _.toSafeInteger('a'); - result = _.toSafeInteger([]); - result = _.toSafeInteger({}); - } - - { - let result: number; - - result = _(true).toSafeInteger(); - result = _(1).toSafeInteger(); - result = _('a').toSafeInteger(); - result = _([1]).toSafeInteger(); - result = _(['']).toSafeInteger(); - result = _({}).toSafeInteger(); - } +{ + _.toSafeInteger(true); // $ExpectType number + _.toSafeInteger(1); // $ExpectType number + _.toSafeInteger("3.2"); // $ExpectType number + _(1).toSafeInteger(); // $ExpectType number + _("3.2").toSafeInteger(); // $ExpectType number + _.chain(1).toSafeInteger(); // $ExpectType LoDashExplicitWrapper + _.chain("3.2").toSafeInteger(); // $ExpectType LoDashExplicitWrapper + fp.toSafeInteger(true); // $ExpectType number + fp.toSafeInteger(1); // $ExpectType number + fp.toSafeInteger("3.2"); // $ExpectType number } /******** @@ -9500,400 +4804,230 @@ namespace TestToSafeInteger { ********/ // _.add -namespace TestAdd { - { - let result: number; - - result = _.add(1, 1); - result = _(1).add(1); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(1).chain().add(1); - } +{ + _.add(1, 1); // $ExpectType number + _(1).add(1); // $ExpectType number + _(1).chain().add(1); // $ExpectType LoDashExplicitWrapper + fp.add(1, 1); // $ExpectType number + fp.add(1)(1); // $ExpectType number } // _.ceil -namespace 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); - } +{ + _.ceil(6.004); // $ExpectType number + _.ceil(6.004, 2); // $ExpectType number + _(6.004).ceil(); // $ExpectType number + _(6.004).ceil(2); // $ExpectType number + _(6.004).chain().ceil(); // $ExpectType LoDashExplicitWrapper + _(6.004).chain().ceil(2); // $ExpectType LoDashExplicitWrapper + fp.ceil(6.004); // $ExpectType number } // _.divide -namespace TestDivide { - { - let result: number; - - result = _.divide(6, 4); - - result = _(6).divide(4); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(6).chain().floor(4); - } +{ + _.divide(6, 4); // $ExpectType number + _(6).divide(4); // $ExpectType number + _(6).chain().floor(4); // $ExpectType LoDashExplicitWrapper + fp.divide(6, 4); // $ExpectType number + fp.divide(6)(4); // $ExpectType number } // _.floor -namespace 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); - } +{ + _.floor(4.006); // $ExpectType number + _.floor(0.046, 2); // $ExpectType number + _.floor(4060, -2); // $ExpectType number + _(4.006).floor(); // $ExpectType number + _(0.046).floor(2); // $ExpectType number + _(4060).floor(-2); // $ExpectType number + _(4.006).chain().floor(); // $ExpectType LoDashExplicitWrapper + _(0.046).chain().floor(2); // $ExpectType LoDashExplicitWrapper + _(4060).chain().floor(-2); // $ExpectType LoDashExplicitWrapper + fp.floor(4.006); // $ExpectType number } // _.max -namespace TestMax { - let array: number[] = []; - let list: _.List = []; +// _.min +{ + const list: ArrayLike = anything; - let result: number | undefined; + _.max(list); // $ExpectType string | undefined + _(list).max(); // $ExpectType string | undefined + _.chain(list).max(); // $ExpectType LoDashExplicitWrapper + fp.max(list); // $ExpectType string | undefined - result = _.max(array); - result = _.max(list); - - result = _(array).max(); - result = _(list).max(); + _.min(list); // $ExpectType string | undefined + _(list).min(); // $ExpectType string | undefined + _.chain(list).min(); // $ExpectType LoDashExplicitWrapper + fp.min(list); // $ExpectType string | undefined } // _.maxBy -namespace TestMaxBy { - let array: number[] = []; - let list: _.List = []; - let array2: AbcObject[] = []; - let list2: _.List = []; +// _.minBy +{ + const list: ArrayLike = anything; - let listIterator = (value: number, index: number, collection: _.List) => 0; + const listIterator = (value: AbcObject, index: number, collection: ArrayLike) => 0; + const valueIterator = (value: AbcObject) => 0; - let result: number | undefined; - let result2: AbcObject | undefined; + _.maxBy(list, listIterator); // $ExpectType AbcObject | undefined + _.maxBy(list, "a"); // $ExpectType AbcObject | undefined + _.maxBy(list, { a: 42 }); // $ExpectType AbcObject | undefined + _(list).maxBy(listIterator); // $ExpectType AbcObject | undefined + _(list).maxBy("a"); // $ExpectType AbcObject | undefined + _(list).maxBy({ a: 42 }); // $ExpectType AbcObject | undefined + _.chain(list).maxBy(listIterator); // $ExpectType LoDashExplicitWrapper + _.chain(list).maxBy("a"); // $ExpectType LoDashExplicitWrapper + _.chain(list).maxBy({ a: 42 }); // $ExpectType LoDashExplicitWrapper + fp.maxBy(valueIterator)(list); // $ExpectType AbcObject | undefined + fp.maxBy("a", list); // $ExpectType AbcObject | undefined + fp.maxBy({ a: 42 }, list); // $ExpectType AbcObject | undefined - result = _.maxBy(array); - result = _.maxBy(array, listIterator); - result = _.maxBy(array, ''); - result2 = _.maxBy(array2, {a: 42}); - - result = _.maxBy(list); - result = _.maxBy(list, listIterator); - result = _.maxBy(list, ''); - result2 = _.maxBy(list2, {a: 42}); - - result = _(array).maxBy(); - result = _(array).maxBy(listIterator); - result = _(array).maxBy(''); - result2 = _(array2).maxBy({a: 42}); - - result = _(list).maxBy(); - result = _(list).maxBy(listIterator); - result = _(list).maxBy(''); - result2 = _(list2).maxBy({a: 42}); + _.minBy(list, listIterator); // $ExpectType AbcObject | undefined + _.minBy(list, "a"); // $ExpectType AbcObject | undefined + _.minBy(list, { a: 42 }); // $ExpectType AbcObject | undefined + _(list).minBy(listIterator); // $ExpectType AbcObject | undefined + _(list).minBy("a"); // $ExpectType AbcObject | undefined + _(list).minBy({ a: 42 }); // $ExpectType AbcObject | undefined + _.chain(list).minBy(listIterator); // $ExpectType LoDashExplicitWrapper + _.chain(list).minBy("a"); // $ExpectType LoDashExplicitWrapper + _.chain(list).minBy({ a: 42 }); // $ExpectType LoDashExplicitWrapper + fp.minBy(valueIterator)(list); // $ExpectType AbcObject | undefined + fp.minBy("a", list); // $ExpectType AbcObject | undefined + fp.minBy({ a: 42 }, list); // $ExpectType AbcObject | undefined } // _.mean -namespace TestMean { - let array: number[] = []; +{ + const list: ArrayLike = anything; - let result: number; - - result = _.mean(array); - - result = _(array).mean(); + _.mean(list); // $ExpectType number + _(list).mean(); // $ExpectType number + _.chain(list).mean(); // $ExpectType LoDashExplicitWrapper + fp.mean(list); // $ExpectType number } // _.meanBy { - let array: AbcObject[] = []; + const list: ArrayLike = anything; - let result: number; + _.meanBy(list, (x) => x.a); // $ExpectType number + _.meanBy(list, "a"); // $ExpectType number + _(list).meanBy((x) => x.a); // $ExpectType number + _.chain(list).meanBy((x) => x.a); // $ExpectType LoDashExplicitWrapper - result = _.meanBy(array, (x) => x.a); - result = _.meanBy(array, 'a'); - - result = _(array).mean(); -} - -// _.min -namespace TestMin { - let array: number[] = []; - let list: _.List = []; - - let result: number | undefined; - - result = _.min(array); - result = _.min(list); - - result = _(array).min(); - result = _(list).min(); -} - -// _.minBy -namespace TestMinBy { - let array: number[] = []; - let list: _.List = []; - let array2: AbcObject[] = []; - let list2: _.List = []; - - let listIterator = (value: number, index: number, collection: _.List) => 0; - - let result: number | undefined; - let result2: AbcObject | undefined; - - result = _.minBy(array); - result = _.minBy(array, listIterator); - result = _.minBy(array, ''); - result2 = _.minBy(array2, {a: 42}); - - result = _.minBy(list); - result = _.minBy(list, listIterator); - result = _.minBy(list, ''); - result2 = _.minBy(list2, {a: 42}); - - result = _(array).minBy(); - result = _(array).minBy(listIterator); - result = _(array).minBy(''); - result2 = _(array2).minBy({a: 42}); - - result = _(list).minBy(); - result = _(list).minBy(listIterator); - result = _(list).minBy(''); - result2 = _(list2).minBy({a: 42}); + fp.meanBy((x) => x.a, list); // $ExpectType number + fp.meanBy((x: AbcObject) => x.a)(list); // $ExpectType number + fp.meanBy("a", list); // $ExpectType number } // _.multiply -namespace TestMultiply { - { - let result: number; - - result = _.multiply(6, 4); - - result = _(6).multiply(4); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(6).chain().multiply(4); - } +{ + _.multiply(6, 4); // $ExpectType number + _(6).multiply(4); // $ExpectType number + _(6).chain().multiply(4); // $ExpectType LoDashExplicitWrapper + fp.multiply(6, 4); // $ExpectType number + fp.multiply(6)(4); // $ExpectType number } // _.round -namespace TestRound { - { - let result: number; +{ + _.round(4.006); // $ExpectType number + _.round(4.006, 2); // $ExpectType number + _(4.006).round(); // $ExpectType number + _(4.006).round(2); // $ExpectType number + _(4.006).chain().round(); // $ExpectType LoDashExplicitWrapper + _(4.006).chain().round(2); // $ExpectType LoDashExplicitWrapper + fp.round(4.006); // $ExpectType 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); - } + // _.subtract +{ + _.subtract(3, 2); // $ExpectType number + _(3).subtract(2); // $ExpectType number + _(3).chain().subtract(2); // $ExpectType LoDashExplicitWrapper + fp.subtract(3, 2); // $ExpectType number + fp.subtract(3)(2); // $ExpectType number } // _.sum -namespace TestSum { - let array: number[] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; - let obj: any = {}; - let dictionary: _.Dictionary | null | undefined = obj; +{ + const list: ArrayLike | null | undefined = anything; - let listIterator = (value: number, index: number, collection: _.List) => 0; - let dictionaryIterator = (value: number, key: string, collection: _.Dictionary) => 0; - - { - let result: number; - - result = _.sum(array); - - result = _.sum(list); - - result = _(array).sum(); - - result = _(list).sum(); - - result = _(dictionary).sum(); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(array).chain().sum(); - - result = _(list).chain().sum(); - - result = _(dictionary).chain().sum(); - } + _.sum(list); // $ExpectType number + _(list).sum(); // $ExpectType number + _(list).chain().sum(); // $ExpectType LoDashExplicitWrapper + fp.sum(list); // $ExpectType number } // _.sumBy -namespace TestSumBy { - let array: number[] | null | undefined = [] as any; - let objectArray: Array<{ 'age': number }> | null | undefined = [] as any; +{ + const list: ArrayLike | null | undefined = anything; + const listIterator = (value: AbcObject) => 0; - let list: _.List | null | undefined = [] as any; - let objectList: _.List<{ 'age': number }> | null | undefined = [] as any; + _.sumBy(list, listIterator); // $ExpectType number + _.sumBy(list, "a"); // $ExpectType number + _(list).sumBy(listIterator); // $ExpectType number + _(list).sumBy("a"); // $ExpectType number + _(list).chain().sumBy(listIterator); // $ExpectType LoDashExplicitWrapper + _(list).chain().sumBy("a"); // $ExpectType LoDashExplicitWrapper - let listIterator = (value: number) => 0; - - { - let result: number; - - result = _.sumBy(array); - result = _.sumBy(array, listIterator); - result = _.sumBy(objectArray, 'age'); - - result = _.sumBy(list); - result = _.sumBy(list, listIterator); - result = _.sumBy(objectList, 'age'); - - result = _(array).sumBy(listIterator); - result = _(objectArray).sumBy('age'); - - result = _(list).sumBy(listIterator); - result = _(objectList).sumBy('age'); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(array).chain().sumBy(listIterator); - result = _(objectArray).chain().sumBy('age'); - - result = _(list).chain().sumBy(listIterator); - result = _(objectList).chain().sumBy('age'); - } + fp.sumBy(listIterator, list); // $ExpectType number + fp.sumBy("a")(list); // $ExpectType number } /********** * Number * **********/ - // _.subtract - namespace subtract { - { - let result: number; - - result = _.subtract(3, 2); - - result = _(3).subtract(2); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(3).chain().subtract(2); - } - } - // _.clamp -namespace TestInClamp { - { - let result: number; - - result = _.clamp(3, 2, 4); - result = _.clamp(3, 4); - - result = _(3).clamp(2, 4); - result = _(3).clamp(4); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(3).chain().clamp(2, 4); - } +{ + _.clamp(3, 2, 4); // $ExpectType number + _.clamp(3, 4); // $ExpectType number + _(3).clamp(2, 4); // $ExpectType number + _(3).clamp(4); // $ExpectType number + _.chain(3).clamp(2, 4); // $ExpectType LoDashExplicitWrapper + fp.clamp(2, 4, 3); // $ExpectType number + fp.clamp(2)(4)(3); // $ExpectType number } // _.inRange -namespace 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); - } +{ + _.inRange(3, 2, 4); // $ExpectType boolean + _.inRange(4, 8); // $ExpectType boolean + _(3).inRange(2, 4); // $ExpectType boolean + _(4).inRange(8); // $ExpectType boolean + _.chain(3).inRange(2, 4); // $ExpectType LoDashExplicitWrapper + _.chain(4).inRange(8); // $ExpectType LoDashExplicitWrapper + fp.inRange(2, 4, 3); // $ExpectType boolean + fp.inRange(2)(4)(3); // $ExpectType boolean } // _.random -namespace TestRandom { - { - let result: number; +{ + _.random(); // $ExpectType number + _.random(1); // $ExpectType number + _.random(1, 2); // $ExpectType number + _.random(1, 2, true); // $ExpectType number + _.random(1, true); // $ExpectType number + _.random(true); // $ExpectType number - result = _.random(); - result = _.random(1); - result = _.random(1, 2); - result = _.random(1, 2, true); - result = _.random(1, true); - result = _.random(true); + _(1).random(); // $ExpectType number + _(1).random(2); // $ExpectType number + _(1).random(2, true); // $ExpectType number + _(1).random(true); // $ExpectType number + _(true).random(); // $ExpectType number - result = _(1).random(); - result = _(1).random(2); - result = _(1).random(2, true); - result = _(1).random(true); - result = _(true).random(); - } + _.chain(1).random(); // $ExpectType LoDashExplicitWrapper + _.chain(1).random(2); // $ExpectType LoDashExplicitWrapper + _.chain(1).random(2, true); // $ExpectType LoDashExplicitWrapper + _.chain(1).random(true); // $ExpectType LoDashExplicitWrapper + _.chain(true).random(); // $ExpectType LoDashExplicitWrapper - { - let result: _.LoDashExplicitWrapper; + fp.random(1, 2); // $ExpectType number + fp.random(1)(2); // $ExpectType number - result = _(1).chain().random(); - result = _(1).chain().random(2); - result = _(1).chain().random(2, true); - result = _(1).chain().random(true); - result = _(true).chain().random(); - } - - // $ExpectType number[] - _.map([5, 5], _.random); + _.map([5, 5], _.random); // $ExpectType number[] } /********** @@ -9901,1813 +5035,558 @@ namespace TestRandom { **********/ // _.assign -namespace 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 = { a: "" }; - let s1: S1 = { a: 1 }; - let s2: S2 = { b: 1 }; - let s3: S3 = { c: 1 }; - let s4: S4 = { d: 1 }; - let s5: S5 = { e: 1 }; - - { - let result: Obj; - - result = _.assign(obj); - } - - { - let result: { a: number }; - - result = _.assign(obj, s1); - } - - { - let result: { a: number, b: number }; - - result = _.assign(obj, s1, s2); - } - - { - let result: { a: number, b: number, c: number }; - - result = _.assign(obj, s1, s2, s3); - } - - { - let result: { a: number, b: number, c: number, d: number }; - - result = _.assign(obj, s1, s2, s3, s4); - } - - { - let result: { a: number, b: number, c: number, d: number, e: number }; - - result = _.assign(obj, s1, s2, s3, s4, s5); - } - - { - let result: _.LoDashImplicitObjectWrapper; - - result = _(obj).assign(); - } - - { - let result: _.LoDashImplicitObjectWrapper<{ a: number & string }>; - - result = _(obj).assign(s1); - } - - { - let result: _.LoDashImplicitObjectWrapper<{ a: number & string, b: number }>; - - result = _(obj).assign(s1, s2); - } - - { - let result: _.LoDashImplicitObjectWrapper<{ a: number & string, b: number, c: number }>; - - result = _(obj).assign(s1, s2, s3); - } - - { - let result: _.LoDashImplicitObjectWrapper<{ a: number & string, b: number, c: number, d: number }>; - - result = _(obj).assign(s1, s2, s3, s4); - } - - { - let result: _.LoDashImplicitObjectWrapper<{ a: number, b: number, c: number, d: number, e: number }>; - - result = _(obj).assign(s1, s2, s3, s4, s5); - } - - { - let result: _.LoDashExplicitObjectWrapper; - - result = _(obj).chain().assign(); - } - - { - let result: _.LoDashExplicitObjectWrapper<{ a: number & string }>; - - result = _(obj).chain().assign(s1); - } - - { - let result: _.LoDashExplicitObjectWrapper<{ a: number & string, b: number }>; - - result = _(obj).chain().assign(s1, s2); - } - - { - let result: _.LoDashExplicitObjectWrapper<{ a: number & string, b: number, c: number }>; - - result = _(obj).chain().assign(s1, s2, s3); - } - - { - let result: _.LoDashExplicitObjectWrapper<{ a: number & string, b: number, c: number, d: number }>; - - result = _(obj).chain().assign(s1, s2, s3, s4); - } - - { - let result: _.LoDashExplicitObjectWrapper<{ a: number, b: number, c: number, d: number, e: number }>; - - result = _(obj).chain().assign(s1, s2, s3, s4, s5); - } -} - -// _.assignWith -namespace 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 = { a: "" }; - let s1: S1 = { a: 1 }; - let s2: S2 = { b: 1 }; - let s3: S3 = { c: 1 }; - let s4: S4 = { d: 1 }; - let s5: S5 = { e: 1 }; - - let customizer: (objectValue: any, sourceValue: any, key?: string, object?: {}, source?: {}) => any = (objectValue: any, sourceValue: any, key?: string, object?: {}, source?: {}) => 1; - - { - 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<{ a: number, b: number, c: number, d: number, e: number }>(obj, s1, s2, s3, s4, s5, customizer); - } - - { - let result: _.LoDashImplicitObjectWrapper; - - result = _(obj).assignWith(); - } - - { - let result: _.LoDashImplicitObjectWrapper<{ a: number & string }>; - result = _(obj).assignWith(s1, customizer); - } - - { - let result: _.LoDashImplicitObjectWrapper<{ a: number & string, b: number }>; - result = _(obj).assignWith(s1, s2, customizer); - } - - { - let result: _.LoDashImplicitObjectWrapper<{ a: number & string, b: number, c: number }>; - result = _(obj).assignWith(s1, s2, s3, customizer); - } - - { - let result: _.LoDashImplicitObjectWrapper<{ a: number & string, 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 & string }>; - result = _(obj).chain().assignWith(s1, customizer); - } - - { - let result: _.LoDashExplicitObjectWrapper<{ a: number & string, b: number }>; - result = _(obj).chain().assignWith(s1, s2, customizer); - } - - { - let result: _.LoDashExplicitObjectWrapper<{ a: number & string, b: number, c: number }>; - result = _(obj).chain().assignWith(s1, s2, s3, customizer); - } - - { - let result: _.LoDashExplicitObjectWrapper<{ a: number & string, 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(s1, s2, s3, s4, s5, customizer); - } -} - // _.assignIn -namespace 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 = { a: "" }; - let s1: S1 = { a: 1 }; - let s2: S2 = { b: 1 }; - let s3: S3 = { c: 1 }; - let s4: S4 = { d: 1 }; - let s5: S5 = { e: 1 }; - - let customizer: (objectValue: any, sourceValue: any, key?: string, object?: {}, source?: {}) => any = (objectValue: any, sourceValue: any, key?: string, object?: {}, source?: {}) => 1; - - { - 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<{ a: number, b: number, c: number, d: number, e: number }>(obj, s1, s2, s3, s4, s5); - } - - { - let result: _.LoDashImplicitObjectWrapper; - - result = _(obj).assignIn(); - } - - { - let result: _.LoDashImplicitObjectWrapper<{ a: number & string }>; - - result = _(obj).assignIn(s1); - } - - { - let result: _.LoDashImplicitObjectWrapper<{ a: number & string, b: number }>; - - result = _(obj).assignIn(s1, s2); - } - - { - let result: _.LoDashImplicitObjectWrapper<{ a: number & string, b: number, c: number }>; - - result = _(obj).assignIn(s1, s2, s3); - } - - { - let result: _.LoDashImplicitObjectWrapper<{ a: number & string, 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 & string }>; - - result = _(obj).chain().assignIn(s1); - } - - { - let result: _.LoDashExplicitObjectWrapper<{ a: number & string, b: number }>; - - result = _(obj).chain().assignIn(s1, s2); - } - - { - let result: _.LoDashExplicitObjectWrapper<{ a: number & string, b: number, c: number }>; - - result = _(obj).chain().assignIn(s1, s2, s3); - } - - { - let result: _.LoDashExplicitObjectWrapper<{ a: number & string, 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(s1, s2, s3, s4, s5); - } -} - +// _.assignWith // _.assignInWith -namespace 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 }; +// _.defaults +// _.extend +// _.extendWith +// _.merge +// _.mergeWith +{ + const obj = { a: "" }; + const s1 = { b: 1 }; + const s2 = { c: 1 }; + const s3 = { d: 1 }; + const s4 = { e: 1 }; + const s5 = { f: 1 }; - let obj: Obj = { a: "" }; - let s1: S1 = { a: 1 }; - let s2: S2 = { b: 1 }; - let s3: S3 = { c: 1 }; - let s4: S4 = { d: 1 }; - let s5: S5 = { e: 1 }; + const customizer = (objectValue: any, sourceValue: any, key: string | undefined, object: {} | undefined, source: {} | undefined) => 1; - let customizer: (objectValue: any, sourceValue: any, key?: string, object?: {}, source?: {}) => any = (objectValue: any, sourceValue: any, key?: string, object?: {}, source?: {}) => 1; + _.assign(obj); // $ExpectType { a: string; } + _.assign(obj, s1); // $ExpectType { a: string; } & { b: number; } + _.assign(obj, s1, s2, s3, s4); // $ExpectType { a: string; } & { b: number; } & { c: number; } & { d: number; } & { e: number; } + _.assign(obj, s1, s2, s3, s4, s5); + _(obj).assign(); // $ExpectType LoDashImplicitWrapper<{ a: string; }> + _(obj).assign(s1); // $ExpectType LoDashImplicitWrapper<{ a: string; } & { b: number; }> + _(obj).assign(s1, s2, s3, s4); // $ExpectType LoDashImplicitWrapper<{ a: string; } & { b: number; } & { c: number; } & { d: number; } & { e: number; }> + _(obj).assign(s1, s2, s3, s4, s5); + _.chain(obj).assign(); // $ExpectType LoDashExplicitWrapper<{ a: string; }> + _.chain(obj).assign(s1); // $ExpectType LoDashExplicitWrapper<{ a: string; } & { b: number; }> + _.chain(obj).assign(s1, s2, s3, s4); // $ExpectType LoDashExplicitWrapper<{ a: string; } & { b: number; } & { c: number; } & { d: number; } & { e: number; }> + _.chain(obj).assign(s1, s2, s3, s4, s5); + fp.assign(obj, s1); // $ExpectType { a: string; } & { b: number; } + fp.assign(obj)(s1); // $ExpectType { a: string; } & { b: number; } - { - let result: Obj; + _.assignIn(obj); // $ExpectType { a: string; } + _.assignIn(obj, s1); // $ExpectType { a: string; } & { b: number; } + _.assignIn(obj, s1, s2, s3, s4); // $ExpectType { a: string; } & { b: number; } & { c: number; } & { d: number; } & { e: number; } + _.assignIn(obj, s1, s2, s3, s4, s5); + _(obj).assignIn(); // $ExpectType LoDashImplicitWrapper<{ a: string; }> + _(obj).assignIn(s1); // $ExpectType LoDashImplicitWrapper<{ a: string; } & { b: number; }> + _(obj).assignIn(s1, s2, s3, s4); // $ExpectType LoDashImplicitWrapper<{ a: string; } & { b: number; } & { c: number; } & { d: number; } & { e: number; }> + _(obj).assignIn(s1, s2, s3, s4, s5); + _.chain(obj).assignIn(); // $ExpectType LoDashExplicitWrapper<{ a: string; }> + _.chain(obj).assignIn(s1); // $ExpectType LoDashExplicitWrapper<{ a: string; } & { b: number; }> + _.chain(obj).assignIn(s1, s2, s3, s4); // $ExpectType LoDashExplicitWrapper<{ a: string; } & { b: number; } & { c: number; } & { d: number; } & { e: number; }> + _.chain(obj).assignIn(s1, s2, s3, s4, s5); + fp.assignIn(obj, s1); // $ExpectType { a: string; } & { b: number; } + fp.assignIn(obj)(s1); // $ExpectType { a: string; } & { b: number; } - result = _.assignInWith(obj); - } + _.assignWith(obj); // $ExpectType { a: string; } + _.assignWith(obj, s1, customizer); // $ExpectType { a: string; } & { b: number; } + _.assignWith(obj, s1, s2, s3, s4, customizer); // $ExpectType { a: string; } & { b: number; } & { c: number; } & { d: number; } & { e: number; } + _.assignWith(obj, s1, s2, s3, s4, s5, customizer); + _(obj).assignWith(); // $ExpectType LoDashImplicitWrapper<{ a: string; }> + _(obj).assignWith(s1, customizer); // $ExpectType LoDashImplicitWrapper<{ a: string; } & { b: number; }> + _(obj).assignWith(s1, s2, s3, s4, customizer); // $ExpectType LoDashImplicitWrapper<{ a: string; } & { b: number; } & { c: number; } & { d: number; } & { e: number; }> + _(obj).assignWith(s1, s2, s3, s4, s5, customizer); + _.chain(obj).assignWith(); // $ExpectType LoDashExplicitWrapper<{ a: string; }> + _.chain(obj).assignWith(s1, customizer); // $ExpectType LoDashExplicitWrapper<{ a: string; } & { b: number; }> + _.chain(obj).assignWith(s1, s2, s3, s4, customizer); // $ExpectType LoDashExplicitWrapper<{ a: string; } & { b: number; } & { c: number; } & { d: number; } & { e: number; }> + _.chain(obj).assignWith(s1, s2, s3, s4, s5, customizer); + fp.assignWith(customizer, obj, s1); // $ExpectType { a: string; } & { b: number; } + fp.assignWith(customizer)(obj)(s1); // $ExpectType { a: string; } & { b: number; } - { - let result: { a: number }; - result = _.assignInWith(obj, s1, customizer); - } + _.assignInWith(obj); // $ExpectType { a: string; } + _.assignInWith(obj, s1, customizer); // $ExpectType { a: string; } & { b: number; } + _.assignInWith(obj, s1, s2, s3, s4, customizer); // $ExpectType { a: string; } & { b: number; } & { c: number; } & { d: number; } & { e: number; } + _.assignInWith(obj, s1, s2, s3, s4, s5, customizer); + _(obj).assignInWith(); // $ExpectType LoDashImplicitWrapper<{ a: string; }> + _(obj).assignInWith(s1, customizer); // $ExpectType LoDashImplicitWrapper<{ a: string; } & { b: number; }> + _(obj).assignInWith(s1, s2, s3, s4, customizer); // $ExpectType LoDashImplicitWrapper<{ a: string; } & { b: number; } & { c: number; } & { d: number; } & { e: number; }> + _(obj).assignInWith(s1, s2, s3, s4, s5, customizer); + _.chain(obj).assignInWith(); // $ExpectType LoDashExplicitWrapper<{ a: string; }> + _.chain(obj).assignInWith(s1, customizer); // $ExpectType LoDashExplicitWrapper<{ a: string; } & { b: number; }> + _.chain(obj).assignInWith(s1, s2, s3, s4, customizer); // $ExpectType LoDashExplicitWrapper<{ a: string; } & { b: number; } & { c: number; } & { d: number; } & { e: number; }> + _.chain(obj).assignInWith(s1, s2, s3, s4, s5, customizer); + fp.assignInWith(customizer, obj, s1); // $ExpectType { a: string; } & { b: number; } + fp.assignInWith(customizer)(obj)(s1); // $ExpectType { a: string; } & { b: number; } - { - let result: { a: number, b: number }; - result = _.assignInWith(obj, s1, s2, customizer); - } + _.defaults(obj); // $ExpectType { a: string; } + _.defaults(obj, s1); // $ExpectType { b: number; } & { a: string; } + _.defaults(obj, s1, s2, s3, s4); // $ExpectType { e: number; } & { d: number; } & { c: number; } & { b: number; } & { a: string; } + _.defaults(obj, s1, s2, s3, s4, s5); + _(obj).defaults(); // $ExpectType LoDashImplicitWrapper<{ a: string; }> + _(obj).defaults(s1); // $ExpectType LoDashImplicitWrapper<{ b: number; } & { a: string; }> + _(obj).defaults(s1, s2, s3, s4); // $ExpectType LoDashImplicitWrapper<{ e: number; } & { d: number; } & { c: number; } & { b: number; } & { a: string; }> + _(obj).defaults(s1, s2, s3, s4, s5); + _.chain(obj).defaults(); // $ExpectType LoDashExplicitWrapper<{ a: string; }> + _.chain(obj).defaults(s1); // $ExpectType LoDashExplicitWrapper<{ b: number; } & { a: string; }> + _.chain(obj).defaults(s1, s2, s3, s4); // $ExpectType LoDashExplicitWrapper<{ e: number; } & { d: number; } & { c: number; } & { b: number; } & { a: string; }> + _.chain(obj).defaults(s1, s2, s3, s4, s5); + fp.defaults(obj, s1); // $ExpectType { a: string; } & { b: number; } + fp.defaults(obj)(s1); // $ExpectType { a: string; } & { b: number; } - { - let result: { a: number, b: number, c: number }; - result = _.assignInWith(obj, s1, s2, s3, customizer); - } + _.extend(obj); // $ExpectType { a: string; } + _.extend(obj, s1); // $ExpectType { a: string; } & { b: number; } + _.extend(obj, s1, s2, s3, s4); // $ExpectType { a: string; } & { b: number; } & { c: number; } & { d: number; } & { e: number; } + _.extend(obj, s1, s2, s3, s4, s5); + _(obj).extend(); // $ExpectType LoDashImplicitWrapper<{ a: string; }> + _(obj).extend(s1); // $ExpectType LoDashImplicitWrapper<{ a: string; } & { b: number; }> + _(obj).extend(s1, s2, s3, s4); // $ExpectType LoDashImplicitWrapper<{ a: string; } & { b: number; } & { c: number; } & { d: number; } & { e: number; }> + _(obj).extend(s1, s2, s3, s4, s5); + _.chain(obj).extend(); // $ExpectType LoDashExplicitWrapper<{ a: string; }> + _.chain(obj).extend(s1); // $ExpectType LoDashExplicitWrapper<{ a: string; } & { b: number; }> + _.chain(obj).extend(s1, s2, s3, s4); // $ExpectType LoDashExplicitWrapper<{ a: string; } & { b: number; } & { c: number; } & { d: number; } & { e: number; }> + _.chain(obj).extend(s1, s2, s3, s4, s5); + fp.extend(obj, s1); // $ExpectType { a: string; } & { b: number; } + fp.extend(obj)(s1); // $ExpectType { a: string; } & { b: number; } - { - let result: { a: number, b: number, c: number, d: number }; - result = _.assignInWith(obj, s1, s2, s3, s4, customizer); - } + _.extendWith(obj); // $ExpectType { a: string; } + _.extendWith(obj, s1, customizer); // $ExpectType { a: string; } & { b: number; } + _.extendWith(obj, s1, s2, s3, s4, customizer); // $ExpectType { a: string; } & { b: number; } & { c: number; } & { d: number; } & { e: number; } + _.extendWith(obj, s1, s2, s3, s4, s5, customizer); + _(obj).extendWith(); // $ExpectType LoDashImplicitWrapper<{ a: string; }> + _(obj).extendWith(s1, customizer); // $ExpectType LoDashImplicitWrapper<{ a: string; } & { b: number; }> + _(obj).extendWith(s1, s2, s3, s4, customizer); // $ExpectType LoDashImplicitWrapper<{ a: string; } & { b: number; } & { c: number; } & { d: number; } & { e: number; }> + _(obj).extendWith(s1, s2, s3, s4, s5, customizer); + _.chain(obj).extendWith(); // $ExpectType LoDashExplicitWrapper<{ a: string; }> + _.chain(obj).extendWith(s1, customizer); // $ExpectType LoDashExplicitWrapper<{ a: string; } & { b: number; }> + _.chain(obj).extendWith(s1, s2, s3, s4, customizer); // $ExpectType LoDashExplicitWrapper<{ a: string; } & { b: number; } & { c: number; } & { d: number; } & { e: number; }> + _.chain(obj).extendWith(s1, s2, s3, s4, s5, customizer); + fp.extendWith(customizer, obj, s1); // $ExpectType { a: string; } & { b: number; } + fp.extendWith(customizer)(obj)(s1); // $ExpectType { a: string; } & { b: number; } - { - let result: { a: number, b: number, c: number, d: number, e: number }; - result = _.assignInWith<{ a: number, b: number, c: number, d: number, e: number }>(obj, s1, s2, s3, s4, s5, customizer); - } + _.merge(obj, s1); // $ExpectType { a: string; } & { b: number; } + _.merge(obj, s1, s2, s3, s4); // $ExpectType { a: string; } & { b: number; } & { c: number; } & { d: number; } & { e: number; } + _.merge(obj, s1, s2, s3, s4, s5); + _(obj).merge(s1); // $ExpectType LoDashImplicitWrapper<{ a: string; } & { b: number; }> + _(obj).merge(s1, s2, s3, s4); // $ExpectType LoDashImplicitWrapper<{ a: string; } & { b: number; } & { c: number; } & { d: number; } & { e: number; }> + _(obj).merge(s1, s2, s3, s4, s5); + _.chain(obj).merge(s1); // $ExpectType LoDashExplicitWrapper<{ a: string; } & { b: number; }> + _.chain(obj).merge(s1, s2, s3, s4); // $ExpectType LoDashExplicitWrapper<{ a: string; } & { b: number; } & { c: number; } & { d: number; } & { e: number; }> + _.chain(obj).merge(s1, s2, s3, s4, s5); + fp.merge(obj, s1); // $ExpectType { a: string; } & { b: number; } + fp.merge(obj)(s1); // $ExpectType { a: string; } & { b: number; } - { - let result: _.LoDashImplicitObjectWrapper; - - result = _(obj).assignInWith(); - } - - { - let result: _.LoDashImplicitObjectWrapper<{ a: number & string }>; - result = _(obj).assignInWith(s1, customizer); - } - - { - let result: _.LoDashImplicitObjectWrapper<{ a: number & string, b: number }>; - result = _(obj).assignInWith(s1, s2, customizer); - } - - { - let result: _.LoDashImplicitObjectWrapper<{ a: number & string, b: number, c: number }>; - result = _(obj).assignInWith(s1, s2, s3, customizer); - } - - { - let result: _.LoDashImplicitObjectWrapper<{ a: number & string, 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 & string }>; - result = _(obj).chain().assignInWith(s1, customizer); - } - - { - let result: _.LoDashExplicitObjectWrapper<{ a: number & string, b: number }>; - result = _(obj).chain().assignInWith(s1, s2, customizer); - } - - { - let result: _.LoDashExplicitObjectWrapper<{ a: number & string, b: number, c: number }>; - result = _(obj).chain().assignInWith(s1, s2, s3, customizer); - } - - { - let result: _.LoDashExplicitObjectWrapper<{ a: number & string, 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(s1, s2, s3, s4, s5, customizer); - } + _.mergeWith(obj, s1, customizer); // $ExpectType { a: string; } & { b: number; } + _.mergeWith(obj, s1, s2, s3, s4, customizer); // $ExpectType { a: string; } & { b: number; } & { c: number; } & { d: number; } & { e: number; } + _.mergeWith(obj, s1, s2, s3, s4, s5, customizer); + _(obj).mergeWith(s1, customizer); // $ExpectType LoDashImplicitWrapper<{ a: string; } & { b: number; }> + _(obj).mergeWith(s1, s2, s3, s4, customizer); // $ExpectType LoDashImplicitWrapper<{ a: string; } & { b: number; } & { c: number; } & { d: number; } & { e: number; }> + _(obj).mergeWith(s1, s2, s3, s4, s5, customizer); + _.chain(obj).mergeWith(s1, customizer); // $ExpectType LoDashExplicitWrapper<{ a: string; } & { b: number; }> + _.chain(obj).mergeWith(s1, s2, s3, s4, customizer); // $ExpectType LoDashExplicitWrapper<{ a: string; } & { b: number; } & { c: number; } & { d: number; } & { e: number; }> + _.chain(obj).mergeWith(s1, s2, s3, s4, s5, customizer); + fp.mergeWith(customizer, obj, s1); // $ExpectType { a: string; } & { b: number; } + fp.mergeWith(customizer)(obj)(s1); // $ExpectType { a: string; } & { b: number; } } // _.create -namespace TestCreate { - type SampleProto = {a: number}; - type SampleProps = {b: string}; +{ + const prototype = { a: 1 }; + const properties = { b: "" }; - let prototype: SampleProto = { a: 1 }; - let properties: SampleProps = { b: "" }; - - { - 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); - } + _.create(prototype, properties); // $ExpectType { a: number; } & { b: string; } + _(prototype).create(properties); // $ExpectType LoDashImplicitWrapper<{ a: number; } & { b: string; }> + _.chain(prototype).create(properties); // $ExpectType LoDashExplicitWrapper<{ a: number; } & { b: string; }> + // We can't expectType for this line because it fails in TS2.3 + const result: { a: number; } = fp.create(prototype); } -// _.defaults -namespace 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 = { a: "" }; - let s1: S1 = { a: 1 }; - let s2: S2 = { b: 1 }; - let s3: S3 = { c: 1 }; - let s4: S4 = { d: 1 }; - let s5: S5 = { e: 1 }; - - { - 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 & number }>; - - result = _(obj).defaults(s1); - } - - { - let result: _.LoDashImplicitObjectWrapper<{ a: string & number, b: number }>; - - result = _(obj).defaults(s1, s2); - } - - { - let result: _.LoDashImplicitObjectWrapper<{ a: string & number, b: number, c: number }>; - - result = _(obj).defaults(s1, s2, s3); - } - - { - let result: _.LoDashImplicitObjectWrapper<{ a: string & number, 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(s1, s2, s3, s4, s5); - } - - { - let result: _.LoDashExplicitObjectWrapper; - - result = _(obj).chain().defaults(); - } - - { - let result: _.LoDashExplicitObjectWrapper<{ a: string & number }>; - - result = _(obj).chain().defaults(s1); - } - - { - let result: _.LoDashExplicitObjectWrapper<{ a: string & number, b: number }>; - - result = _(obj).chain().defaults(s1, s2); - } - - { - let result: _.LoDashExplicitObjectWrapper<{ a: string & number, b: number, c: number }>; - - result = _(obj).chain().defaults(s1, s2, s3); - } - - { - let result: _.LoDashExplicitObjectWrapper<{ a: string & number, 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(s1, s2, s3, s4, s5); - } +{ + const obj = { a: "" }; + const s1 = { b: 1 }; + const s2 = { c: 1 }; + const s3 = { d: 1 }; + const s4 = { e: 1 }; + const s5 = { f: 1 }; } -//_.defaultsDeep -interface DefaultsDeepResult { - user: { - name: string; - age: number; - } +// _.defaultsDeep +{ + const testDefaultsDeepObject = { user: { name: "barney" } }; + const testDefaultsDeepSource = { user: { name: "fred", age: 36 } }; + _.defaultsDeep(testDefaultsDeepObject, testDefaultsDeepSource); // $ExpectType any + _(testDefaultsDeepObject).defaultsDeep(testDefaultsDeepSource); // $ExpectType LoDashImplicitWrapper + _.chain(testDefaultsDeepObject).defaultsDeep(testDefaultsDeepSource); // $ExpectType LoDashExplicitWrapper + + fp.defaultsDeep(testDefaultsDeepSource, testDefaultsDeepObject); // $ExpectType any + fp.defaultsDeep(testDefaultsDeepSource)(testDefaultsDeepObject); // $ExpectType any } -const TestDefaultsDeepObject = { 'user': { 'name': 'barney' } }; -const TestDefaultsDeepSource = { 'user': { 'name': 'fred', 'age': 36 } }; -result = _.defaultsDeep(TestDefaultsDeepObject, TestDefaultsDeepSource); -result = _(TestDefaultsDeepObject).defaultsDeep(TestDefaultsDeepSource).value(); // _.entries -namespace TestEntries { - const dictionary: _.Dictionary = anything; - const numericDictionary: _.NumericDictionary = anything; - const abcObject: AbcObject = anything; - - { - _.entries(dictionary); // $ExpectType [string, number][] - _.entries(numericDictionary); // $ExpectType [string, number][] - _.entries(abcObject); // $ExpectType [string, any][] - } - - { - _(dictionary).entries(); // $ExpectType LoDashImplicitWrapper<[string, number][]> - _(numericDictionary).entries(); // $ExpectType LoDashImplicitWrapper<[string, number][]> - _(abcObject).entries(); // $ExpectType LoDashImplicitWrapper<[string, any][]> - } - - { - _(dictionary).chain().entries(); // $ExpectType LoDashExplicitWrapper<[string, number][]> - _(numericDictionary).chain().entries(); // $ExpectType LoDashExplicitWrapper<[string, number][]> - _(abcObject).chain().entries(); // $ExpectType LoDashExplicitWrapper<[string, any][]> - } -} - // _.entriesIn -namespace TestEntriesIn { +{ const dictionary: _.Dictionary = anything; const numericDictionary: _.NumericDictionary = anything; const abcObject: AbcObject = anything; - { - _.entriesIn(dictionary); // $ExpectType [string, number][] - _.entriesIn(numericDictionary); // $ExpectType [string, number][] - _.entriesIn(abcObject); // $ExpectType [string, any][] - } - - { - _(dictionary).entriesIn(); // $ExpectType LoDashImplicitWrapper<[string, number][]> - _(numericDictionary).entriesIn(); // $ExpectType LoDashImplicitWrapper<[string, number][]> - _(abcObject).entriesIn(); // $ExpectType LoDashImplicitWrapper<[string, any][]> - } - - { - _(dictionary).chain().entriesIn(); // $ExpectType LoDashExplicitWrapper<[string, number][]> - _(numericDictionary).chain().entriesIn(); // $ExpectType LoDashExplicitWrapper<[string, number][]> - _(abcObject).chain().entriesIn(); // $ExpectType LoDashExplicitWrapper<[string, any][]> - } -} - -// _.extend -namespace 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 = { a: "" }; - let s1: S1 = { a: 1 }; - let s2: S2 = { b: 1 }; - let s3: S3 = { c: 1 }; - let s4: S4 = { d: 1 }; - let s5: S5 = { e: 1 }; - - let customizer: (objectValue: any, sourceValue: any, key?: string, object?: {}, source?: {}) => any = (objectValue: any, sourceValue: any, key?: string, object?: {}, source?: {}) => 1; - - { - let result: Obj; - - result = _.extend(obj); - } - - { - let result: { a: number }; - - result = _.extend(obj, s1); - } - - { - let result: { a: number, b: number }; - - result = _.extend(obj, s1, s2); - } - - { - let result: { a: number, b: number, c: number }; - - result = _.extend(obj, s1, s2, s3); - } - - { - let result: { a: number, b: number, c: number, d: number }; - - result = _.extend(obj, s1, s2, s3, s4); - } - - { - let result: { a: number, b: number, c: number, d: number, e: number }; - - result = _.extend<{ a: number, b: number, c: number, d: number, e: number }>(obj, s1, s2, s3, s4, s5); - } - - { - let result: _.LoDashImplicitObjectWrapper; - - result = _(obj).extend(); - } - - { - let result: _.LoDashImplicitObjectWrapper<{ a: number & string }>; - - result = _(obj).extend(s1); - } - - { - let result: _.LoDashImplicitObjectWrapper<{ a: number & string, b: number }>; - - result = _(obj).extend(s1, s2); - } - - { - let result: _.LoDashImplicitObjectWrapper<{ a: number & string, b: number, c: number }>; - - result = _(obj).extend(s1, s2, s3); - } - - { - let result: _.LoDashImplicitObjectWrapper<{ a: number & string, b: number, c: number, d: number }>; - - result = _(obj).extend(s1, s2, s3, s4); - } - - { - let result: _.LoDashImplicitObjectWrapper<{ a: number, b: number, c: number, d: number, e: number }>; - - result = _(obj).extend(s1, s2, s3, s4, s5); - } - - { - let result: _.LoDashExplicitObjectWrapper; - - result = _(obj).chain().extend(); - } - - { - let result: _.LoDashExplicitObjectWrapper<{ a: number & string }>; - - result = _(obj).chain().extend(s1); - } - - { - let result: _.LoDashExplicitObjectWrapper<{ a: number & string, b: number }>; - - result = _(obj).chain().extend(s1, s2); - } - - { - let result: _.LoDashExplicitObjectWrapper<{ a: number & string, b: number, c: number }>; - - result = _(obj).chain().extend(s1, s2, s3); - } - - { - let result: _.LoDashExplicitObjectWrapper<{ a: number & string, b: number, c: number, d: number }>; - - result = _(obj).chain().extend(s1, s2, s3, s4); - } - - { - let result: _.LoDashExplicitObjectWrapper<{ a: number, b: number, c: number, d: number, e: number }>; - - result = _(obj).chain().extend(s1, s2, s3, s4, s5); - } -} - -// _.extendWith -namespace TestExtendWith { - 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 = { a: "" }; - let s1: S1 = { a: 1 }; - let s2: S2 = { b: 1 }; - let s3: S3 = { c: 1 }; - let s4: S4 = { d: 1 }; - let s5: S5 = { e: 1 }; - - let customizer: (objectValue: any, sourceValue: any, key?: string, object?: {}, source?: {}) => any = (objectValue: any, sourceValue: any, key?: string, object?: {}, source?: {}) => 1; - - { - let result: Obj; - - result = _.extendWith(obj); - } - - { - let result: { a: number }; - - result = _.extendWith(obj, s1, customizer); - } - - { - let result: { a: number, b: number }; - - result = _.extendWith(obj, s1, s2, customizer); - } - - { - let result: { a: number, b: number, c: number }; - - result = _.extendWith(obj, s1, s2, s3, customizer); - } - - { - let result: { a: number, b: number, c: number, d: number }; - - result = _.extendWith(obj, s1, s2, s3, s4, customizer); - } - - { - let result: { a: number, b: number, c: number, d: number, e: number }; - - result = _.extendWith<{ a: number, b: number, c: number, d: number, e: number }>(obj, s1, s2, s3, s4, s5, customizer); - } - - { - let result: _.LoDashImplicitObjectWrapper; - - result = _(obj).extendWith(); - } - - { - let result: _.LoDashImplicitObjectWrapper<{ a: number & string }>; - - result = _(obj).extendWith(s1, customizer); - } - - { - let result: _.LoDashImplicitObjectWrapper<{ a: number & string, b: number }>; - - result = _(obj).extendWith(s1, s2, customizer); - } - - { - let result: _.LoDashImplicitObjectWrapper<{ a: number & string, b: number, c: number }>; - - result = _(obj).extendWith(s1, s2, s3, customizer); - } - - { - let result: _.LoDashImplicitObjectWrapper<{ a: number & string, b: number, c: number, d: number }>; - - result = _(obj).extendWith(s1, s2, s3, s4, customizer); - } - - { - let result: _.LoDashImplicitObjectWrapper<{ a: number, b: number, c: number, d: number, e: number }>; - - result = _(obj).extendWith(s1, s2, s3, s4, s5, customizer); - } - - { - let result: _.LoDashExplicitObjectWrapper; - - result = _(obj).chain().extendWith(); - } - - { - let result: _.LoDashExplicitObjectWrapper<{ a: number & string }>; - - result = _(obj).chain().extendWith(s1, customizer); - } - - { - let result: _.LoDashExplicitObjectWrapper<{ a: number & string, b: number }>; - - result = _(obj).chain().extendWith(s1, s2, customizer); - } - - { - let result: _.LoDashExplicitObjectWrapper<{ a: number & string, b: number, c: number }>; - - result = _(obj).chain().extendWith(s1, s2, s3, customizer); - } - - { - let result: _.LoDashExplicitObjectWrapper<{ a: number & string, b: number, c: number, d: number }>; - - result = _(obj).chain().extendWith(s1, s2, s3, s4, customizer); - } - - { - let result: _.LoDashExplicitObjectWrapper<{ a: number, b: number, c: number, d: number, e: number }>; - - result = _(obj).chain().extendWith(s1, s2, s3, s4, s5, customizer); - } + _.entries(dictionary); // $ExpectType [string, number][] + _.entries(numericDictionary); // $ExpectType [string, number][] + _.entries(abcObject); // $ExpectType [string, any][] + _(dictionary).entries(); // $ExpectType LoDashImplicitWrapper<[string, number][]> + _(numericDictionary).entries(); // $ExpectType LoDashImplicitWrapper<[string, number][]> + _.chain(dictionary).entries(); // $ExpectType LoDashExplicitWrapper<[string, number][]> + _.chain(numericDictionary).entries(); // $ExpectType LoDashExplicitWrapper<[string, number][]> + _.chain(abcObject).entries(); // $ExpectType LoDashExplicitWrapper<[string, any][]> + fp.entries(dictionary); // $ExpectType [string, number][] + + _.entriesIn(dictionary); // $ExpectType [string, number][] + _.entriesIn(numericDictionary); // $ExpectType [string, number][] + _.entriesIn(abcObject); // $ExpectType [string, any][] + _(dictionary).entriesIn(); // $ExpectType LoDashImplicitWrapper<[string, number][]> + _(numericDictionary).entriesIn(); // $ExpectType LoDashImplicitWrapper<[string, number][]> + _.chain(dictionary).entriesIn(); // $ExpectType LoDashExplicitWrapper<[string, number][]> + _.chain(numericDictionary).entriesIn(); // $ExpectType LoDashExplicitWrapper<[string, number][]> + _.chain(abcObject).entriesIn(); // $ExpectType LoDashExplicitWrapper<[string, any][]> + fp.entriesIn(dictionary); // $ExpectType [string, number][] } // _.findKey -namespace TestFindKey { - { - let a: keyof undefined; - let predicateFn = (value: any, key: string, object: {}) => true; - let result: string | undefined; - - result = _.findKey<{a: string;}>({a: ''}); - - result = _.findKey<{a: string;}>({a: ''}, predicateFn); - - result = _.findKey<{a: string;}>({a: ''}, ''); - - result = _.findKey({a: { b: 5 }}, {b: 42}); - - result = _.findKey({a: { b: 5 }}, ['b', 5]); - - result = _<{a: string;}>({a: ''}).findKey(); - - result = _<{a: string;}>({a: ''}).findKey(predicateFn); - - result = _<{a: string;}>({a: ''}).findKey(''); - - result = _({a: { b: 5 }}).findKey({b: 42}); - } - - { - let predicateFn = (value: string, key: string, collection: _.Dictionary) => true; - let result: string | undefined; - - result = _.findKey({a: ''}, predicateFn); - - result = _({a: ''}).findKey(predicateFn); - } - - { - let predicateFn = (value: any, key: string, object: {}) => true; - let result: _.LoDashExplicitWrapper; - - result = _<{a: string;}>({a: ''}).chain().findKey(); - - result = _<{a: string;}>({a: ''}).chain().findKey(predicateFn); - - result = _<{a: string;}>({a: ''}).chain().findKey(''); - - result = _({a: { b: 5 }}).chain().findKey({b: 42}); - } - - { - let predicateFn = (value: string, key: string, collection: _.Dictionary) => true; - let result: _.LoDashExplicitWrapper; - - result = _({a: ''}).chain().findKey(predicateFn); - } -} - // _.findLastKey -namespace TestFindLastKey { - { - let predicateFn = (value: any, key: string, object: {}) => true; - let result: string | undefined; +{ + const predicateFn = (value: string, key: string, object: { a: string }) => true; + const predicateFn2 = (value: number) => true; - result = _.findLastKey<{a: string;}>({a: ''}); + _.findKey({ a: "" }); // $ExpectType string | undefined + _.findKey({ a: "" }, predicateFn); // $ExpectType string | undefined + _.findKey({ a: "" }, ""); // $ExpectType string | undefined + _.findKey({ a: { b: 5 } }, { b: 42 }); // $ExpectType string | undefined + _.findKey({ a: { b: 5 } }, ["b", 5]); // $ExpectType string | undefined + _({ a: "" }).findKey(); // $ExpectType string | undefined + _({ a: "" }).findKey(predicateFn); // $ExpectType string | undefined + _({ a: "" }).findKey(""); // $ExpectType string | undefined + _({ a: { b: 5 } }).findKey({ b: 42 }); // $ExpectType string | undefined + _({ a: { b: 5 } }).findKey(["b", 5]); // $ExpectType string | undefined + _.chain({ a: "" }).findKey(); // $ExpectType LoDashExplicitWrapper + _.chain({ a: "" }).findKey(predicateFn); // $ExpectType LoDashExplicitWrapper + _.chain({ a: "" }).findKey(""); // $ExpectType LoDashExplicitWrapper + _.chain({ a: { b: 5 } }).findKey({ b: 42 }); // $ExpectType LoDashExplicitWrapper + _.chain({ a: { b: 5 } }).findKey(["b", 5]); // $ExpectType LoDashExplicitWrapper + fp.findKey(predicateFn2, { a: 1 }); // $ExpectType string | undefined + fp.findKey(predicateFn2)({ a: 1 }); // $ExpectType string | undefined - result = _.findLastKey<{a: string;}>({a: ''}, predicateFn); - - result = _.findLastKey<{a: string;}>({a: ''}, ''); - - result = _.findLastKey({a: { b: 5 }}, {b: 42}); - - result = _.findLastKey({a: { b: 5 }}, ['b', 5]); - - result = _<{a: string;}>({a: ''}).findLastKey(); - - result = _<{a: string;}>({a: ''}).findLastKey(predicateFn); - - result = _<{a: string;}>({a: ''}).findLastKey(''); - - result = _({a: { b: 5 }}).findLastKey({b: 42}); - } - - { - let predicateFn = (value: string, key: string, collection: _.Dictionary) => true; - let result: string | undefined; - - result = _.findLastKey({a: ''}, predicateFn); - - result = _({a: ''}).findLastKey(predicateFn); - } - - { - let predicateFn = (value: any, key: string, object: {}) => true; - let result: _.LoDashExplicitWrapper; - - result = _<{a: string;}>({a: ''}).chain().findLastKey(); - - result = _<{a: string;}>({a: ''}).chain().findLastKey(predicateFn); - - result = _<{a: string;}>({a: ''}).chain().findLastKey(''); - - result = _({a: { b: 5 }}).chain().findLastKey({b: 42}); - } - - { - let predicateFn = (value: string, key: string, collection: _.Dictionary) => true; - let result: _.LoDashExplicitWrapper; - - result = _({a: ''}).chain().findLastKey(predicateFn); - } + _.findLastKey({ a: "" }); // $ExpectType string | undefined + _.findLastKey({ a: "" }, predicateFn); // $ExpectType string | undefined + _.findLastKey({ a: "" }, ""); // $ExpectType string | undefined + _.findLastKey({ a: { b: 5 } }, { b: 42 }); // $ExpectType string | undefined + _.findLastKey({ a: { b: 5 } }, ["b", 5]); // $ExpectType string | undefined + _({ a: "" }).findLastKey(); // $ExpectType string | undefined + _({ a: "" }).findLastKey(predicateFn); // $ExpectType string | undefined + _({ a: "" }).findLastKey(""); // $ExpectType string | undefined + _({ a: { b: 5 } }).findLastKey({ b: 42 }); // $ExpectType string | undefined + _({ a: { b: 5 } }).findLastKey(["b", 5]); // $ExpectType string | undefined + _.chain({ a: "" }).findLastKey(); // $ExpectType LoDashExplicitWrapper + _.chain({ a: "" }).findLastKey(predicateFn); // $ExpectType LoDashExplicitWrapper + _.chain({ a: "" }).findLastKey(""); // $ExpectType LoDashExplicitWrapper + _.chain({ a: { b: 5 } }).findLastKey({ b: 42 }); // $ExpectType LoDashExplicitWrapper + _.chain({ a: { b: 5 } }).findLastKey(["b", 5]); // $ExpectType LoDashExplicitWrapper + fp.findLastKey(predicateFn2, { a: 1 }); // $ExpectType string | undefined + fp.findLastKey(predicateFn2)({ a: 1 }); // $ExpectType string | undefined } // _.forIn -namespace TestForIn { - type SampleObject = {a: number; b: string; c: boolean;}; - - let dictionary: _.Dictionary = {}; - let nilDictionary: _.Dictionary | null | undefined = anything; - let dictionaryIterator: (value: number, key: string, collection: _.Dictionary) => any = (value: number, key: string, collection: _.Dictionary) => 1; - - let object: SampleObject = { a: 1, b: "", c: true }; - let nilObject: SampleObject | null | undefined = anything; - let objectIterator: (element: any, key?: string, collection?: any) => any = (element: any, key?: string, collection?: any) => 1; - - { - let result: _.Dictionary; - - result = _.forIn(dictionary); - result = _.forIn(dictionary, dictionaryIterator); - } - - { - let result: _.Dictionary | null | undefined; - - result = _.forIn(nilDictionary); - result = _.forIn(nilDictionary, dictionaryIterator); - } - - { - let result: SampleObject; - - result = _.forIn(object); - result = _.forIn(object, objectIterator); - } - - { - let result: SampleObject | null | undefined; - - result = _.forIn(nilObject); - result = _.forIn(nilObject, objectIterator); - } - - { - let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; - - result = _(dictionary).forIn(); - result = _(dictionary).forIn(dictionaryIterator); - } - - { - let result: _.LoDashImplicitNillableObjectWrapper<_.Dictionary>; - - result = _(nilDictionary).forIn(); - result = _(nilDictionary).forIn(dictionaryIterator); - } - - { - let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; - - result = _(dictionary).chain().forIn(); - result = _(dictionary).chain().forIn(dictionaryIterator); - } - - { - let result: _.LoDashExplicitNillableObjectWrapper<_.Dictionary>; - - result = _(nilDictionary).chain().forIn(); - result = _(nilDictionary).chain().forIn(dictionaryIterator); - } -} - // _.forInRight -namespace TestForInRight { - type SampleObject = {a: number; b: string; c: boolean;}; - - let dictionary: _.Dictionary = {}; - let nilDictionary: _.Dictionary | null | undefined = anything; - let dictionaryIterator: (value: number, key: string, collection: _.Dictionary) => any = (value: number, key: string, collection: _.Dictionary) => 1; - - let object: SampleObject = { a: 1, b: "", c: true }; - let nilObject: SampleObject | null | undefined = anything; - let objectIterator: (element: any, key?: string, collection?: any) => any = (element: any, key?: string, collection?: any) => 1; - - { - let result: _.Dictionary; - - result = _.forInRight(dictionary); - result = _.forInRight(dictionary, dictionaryIterator); - } - - { - let result: _.Dictionary | null | undefined; - - result = _.forInRight(nilDictionary); - result = _.forInRight(nilDictionary, dictionaryIterator); - } - - { - let result: SampleObject; - - result = _.forInRight(object); - result = _.forInRight(object, objectIterator); - } - - { - let result: SampleObject | null | undefined; - - result = _.forInRight(nilObject); - result = _.forInRight(nilObject, objectIterator); - } - - { - let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; - - result = _(dictionary).forInRight(); - result = _(dictionary).forInRight(dictionaryIterator); - } - - { - let result: _.LoDashImplicitNillableObjectWrapper<_.Dictionary>; - - result = _(nilDictionary).forInRight(); - result = _(nilDictionary).forInRight(dictionaryIterator); - } - - { - let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; - - result = _(dictionary).chain().forInRight(); - result = _(dictionary).chain().forInRight(dictionaryIterator); - } - - { - let result: _.LoDashExplicitNillableObjectWrapper<_.Dictionary>; - - result = _(nilDictionary).chain().forInRight(); - result = _(nilDictionary).chain().forInRight(dictionaryIterator); - } -} - // _.forOwn -namespace TestForOwn { - type SampleObject = {a: number; b: string; c: boolean;}; - - let dictionary: _.Dictionary = {}; - let nilDictionary: _.Dictionary | null | undefined = anything; - let dictionaryIterator: (value: number, key: string, collection: _.Dictionary) => any = (value: number, key: string, collection: _.Dictionary) => 1; - - let object: SampleObject = { a: 1, b: "", c: true }; - let nilObject: SampleObject | null | undefined = anything; - let objectIterator: (element: any, key?: string, collection?: any) => any = (element: any, key?: string, collection?: any) => 1; - - { - let result: _.Dictionary; - - result = _.forOwn(dictionary); - result = _.forOwn(dictionary, dictionaryIterator); - } - - { - let result: _.Dictionary | null | undefined; - - result = _.forOwn(nilDictionary); - result = _.forOwn(nilDictionary, dictionaryIterator); - } - - { - let result: SampleObject; - - result = _.forOwn(object); - result = _.forOwn(object, objectIterator); - } - - { - let result: SampleObject | null | undefined; - - result = _.forOwn(nilObject); - result = _.forOwn(nilObject, objectIterator); - } - - { - let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; - - result = _(dictionary).forOwn(); - result = _(dictionary).forOwn(dictionaryIterator); - } - - { - let result: _.LoDashImplicitNillableObjectWrapper<_.Dictionary>; - - result = _(nilDictionary).forOwn(); - result = _(nilDictionary).forOwn(dictionaryIterator); - } - - { - let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; - - result = _(dictionary).chain().forOwn(); - result = _(dictionary).chain().forOwn(dictionaryIterator); - } - - { - let result: _.LoDashExplicitNillableObjectWrapper<_.Dictionary>; - - result = _(nilDictionary).chain().forOwn(); - result = _(nilDictionary).chain().forOwn(dictionaryIterator); - } -} - // _.forOwnRight -namespace TestForOwnRight { - type SampleObject = {a: number; b: string; c: boolean;}; +{ + const dictionary: _.Dictionary = {}; + const dictionaryIterator = (value: number, key: string, collection: _.Dictionary) => {}; + const dictionaryIterator2 = (value: number) => {}; - let dictionary: _.Dictionary = {}; - let nilDictionary: _.Dictionary | null | undefined = anything; - let dictionaryIterator: (value: number, key: string, collection: _.Dictionary) => any = (value: number, key: string, collection: _.Dictionary) => 1; + const object: AbcObject | null | undefined = anything; + const objectIterator = (element: string | number | boolean, key: string, collection: AbcObject) => {}; + const objectIterator2 = (element: number | string | boolean) => {}; - let object: SampleObject = { a: 1, b: "", c: true }; - let nilObject: SampleObject | null | undefined = anything; - let objectIterator: (element: any, key?: string, collection?: any) => any = (element: any, key?: string, collection?: any) => 1; + _.forIn(dictionary); // $ExpectType Dictionary + _.forIn(dictionary, dictionaryIterator); // $ExpectType Dictionary + _.forIn(object); // $ExpectType AbcObject | null | undefined + _.forIn(object, objectIterator); // $ExpectType AbcObject | null | undefined + _(object).forIn(); // $ExpectType LoDashImplicitWrapper + _(object).forIn(objectIterator); // $ExpectType LoDashImplicitWrapper + _.chain(object).forIn(); // $ExpectType LoDashExplicitWrapper + _.chain(object).forIn(objectIterator); // $ExpectType LoDashExplicitWrapper + fp.forIn(dictionaryIterator2, dictionary); // $ExpectType Dictionary + fp.forIn(objectIterator2)(object); // $ExpectType AbcObject | null | undefined - { - let result: _.Dictionary; + _.forInRight(dictionary); // $ExpectType Dictionary + _.forInRight(dictionary, dictionaryIterator); // $ExpectType Dictionary + _.forInRight(object); // $ExpectType AbcObject | null | undefined + _.forInRight(object, objectIterator); // $ExpectType AbcObject | null | undefined + _(object).forInRight(); // $ExpectType LoDashImplicitWrapper + _(object).forInRight(objectIterator); // $ExpectType LoDashImplicitWrapper + _.chain(object).forInRight(); // $ExpectType LoDashExplicitWrapper + _.chain(object).forInRight(objectIterator); // $ExpectType LoDashExplicitWrapper + fp.forInRight(dictionaryIterator2, dictionary); // $ExpectType Dictionary + fp.forInRight(objectIterator2)(object); // $ExpectType AbcObject | null | undefined - result = _.forOwnRight(dictionary); - result = _.forOwnRight(dictionary, dictionaryIterator); - } + _.forOwn(dictionary); // $ExpectType Dictionary + _.forOwn(dictionary, dictionaryIterator); // $ExpectType Dictionary + _.forOwn(object); // $ExpectType AbcObject | null | undefined + _.forOwn(object, objectIterator); // $ExpectType AbcObject | null | undefined + _(object).forOwn(); // $ExpectType LoDashImplicitWrapper + _(object).forOwn(objectIterator); // $ExpectType LoDashImplicitWrapper + _.chain(object).forOwn(); // $ExpectType LoDashExplicitWrapper + _.chain(object).forOwn(objectIterator); // $ExpectType LoDashExplicitWrapper + fp.forOwn(dictionaryIterator2, dictionary); // $ExpectType Dictionary + fp.forOwn(objectIterator2)(object); // $ExpectType AbcObject | null | undefined - { - let result: _.Dictionary | null | undefined; - - result = _.forOwnRight(nilDictionary); - result = _.forOwnRight(nilDictionary, dictionaryIterator); - } - - { - let result: SampleObject; - - result = _.forOwnRight(object); - result = _.forOwnRight(object, objectIterator); - } - - { - let result: SampleObject | null | undefined; - - result = _.forOwnRight(nilObject); - result = _.forOwnRight(nilObject, objectIterator); - } - - { - let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; - - result = _(dictionary).forOwnRight(); - result = _(dictionary).forOwnRight(dictionaryIterator); - } - - { - let result: _.LoDashImplicitNillableObjectWrapper<_.Dictionary>; - - result = _(nilDictionary).forOwnRight(); - result = _(nilDictionary).forOwnRight(dictionaryIterator); - } - - { - let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; - - result = _(dictionary).chain().forOwnRight(); - result = _(dictionary).chain().forOwnRight(dictionaryIterator); - } - - { - let result: _.LoDashExplicitNillableObjectWrapper<_.Dictionary>; - - result = _(nilDictionary).chain().forOwnRight(); - result = _(nilDictionary).chain().forOwnRight(dictionaryIterator); - } + _.forOwnRight(dictionary); // $ExpectType Dictionary + _.forOwnRight(dictionary, dictionaryIterator); // $ExpectType Dictionary + _.forOwnRight(object); // $ExpectType AbcObject | null | undefined + _.forOwnRight(object, objectIterator); // $ExpectType AbcObject | null | undefined + _(object).forOwnRight(); // $ExpectType LoDashImplicitWrapper + _(object).forOwnRight(objectIterator); // $ExpectType LoDashImplicitWrapper + _.chain(object).forOwnRight(); // $ExpectType LoDashExplicitWrapper + _.chain(object).forOwnRight(objectIterator); // $ExpectType LoDashExplicitWrapper + fp.forOwnRight(dictionaryIterator2, dictionary); // $ExpectType Dictionary + fp.forOwnRight(objectIterator2)(object); // $ExpectType AbcObject | null | undefined } // _.functions -namespace TestFunctions { - type SampleObject = {a: number; b: string; c: boolean;}; - - let object: SampleObject = { a: 1, b: "", c: true }; - - { - let result: string[]; - - result = _.functions(object); - } - - { - let result: _.LoDashImplicitArrayWrapper; - - result = _(object).functions(); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _(object).chain().functions(); - } -} - // _.functionsIn -namespace TestFunctionsIn { - type SampleObject = {a: number; b: string; c: boolean;}; +{ + const object: AbcObject = anything; - let object: SampleObject = { a: 1, b: "", c: true }; + _.functions(object); // $ExpectType string[] + _(object).functions(); // $ExpectType LoDashImplicitWrapper + _.chain(object).functions(); // $ExpectType LoDashExplicitWrapper + fp.functions(object); // $ExpectType string[] - { - let result: string[]; - - result = _.functionsIn(object); - } - - { - let result: _.LoDashImplicitArrayWrapper; - - result = _(object).functionsIn(); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _(object).chain().functionsIn(); - } + _.functionsIn(object); // $ExpectType string[] + _(object).functionsIn(); // $ExpectType LoDashImplicitWrapper + _.chain(object).functionsIn(); // $ExpectType LoDashExplicitWrapper + fp.functionsIn(object); // $ExpectType string[] } // _.get -namespace TestGet { +{ _.get([], Symbol.iterator); _.get([], [Symbol.iterator]); - _.get('abc', 1); // $ExpectType string - _('abc').get(1); // $ExpectType string - _.chain('abc').get(1); // $ExpectType LoDashExplicitWrapper - + _.get("abc", 1); // $ExpectType string + _.get("abc", ["0"], "_"); + _.get([42], 0, -1); // $ExpectType number _.get({ a: { b: true } }, "a"); // $ExpectType { b: boolean; } - _({ a: { b: true } }).get("a"); // $ExpectType { b: boolean; } - _.chain({ a: { b: true } }).get("a"); // $ExpectType LoDashExplicitWrapper<{ b: boolean; }> - _.get({ a: { b: true } }, ["a"]); // $ExpectType { b: boolean; } - _({ a: { b: true } }).get(["a"]); // $ExpectType { b: boolean; } - _.chain({ a: { b: true } }).get(["a"]); // $ExpectType LoDashExplicitWrapper<{ b: boolean; }> - _.get({ a: { b: true } }, ["a", "b"]); // $ExpectType any + + _("abc").get(1); // $ExpectType string + _("abc").get(["0"], "_"); + _([42]).get(0, -1); // $ExpectType number + _({ a: { b: true } }).get("a"); // $ExpectType { b: boolean; } + _({ a: { b: true } }).get(["a"]); // $ExpectType { b: boolean; } _({ a: { b: true } }).get(["a", "b"]); // $ExpectType any + + _.chain("abc").get(1); // $ExpectType LoDashExplicitWrapper + _.chain("abc").get(["0"], "_"); + _.chain([42]).get(0, -1); // $ExpectType LoDashExplicitWrapper + _.chain({ a: { b: true } }).get("a"); // $ExpectType LoDashExplicitWrapper<{ b: boolean; }> + _.chain({ a: { b: true } }).get(["a"]); // $ExpectType LoDashExplicitWrapper<{ b: boolean; }> _.chain({ a: { b: true } }).get(["a", "b"]); // $ExpectType LoDashExplicitWrapper - { - let result: string; + fp.get(Symbol.iterator, []); // $ExpectType any + fp.get(Symbol.iterator)([]); // $ExpectType any + fp.get([Symbol.iterator], []); // $ExpectType any + fp.get(1)("abc"); // $ExpectType string + fp.get("1")("abc"); // $ExpectType any + fp.get("a", { a: { b: true } }); // $ExpectType { b: boolean; } + fp.get<{ a: { b: boolean } }, "a">("a")({ a: { b: true } }); // $ExpectType { b: boolean; } + fp.get(["a", "b"])({ a: { b: true } }); // $ExpectType any + fp.get(0)([42]); // $ExpectType number - result = _.get('abc', '0'); - result = _.get('abc', '0', '_'); - result = _.get('abc', ['0']); - result = _.get('abc', ['0'], '_'); - - result = _.get('abc', '0'); - result = _.get('abc', '0', '_'); - result = _.get('abc', ['0']); - result = _.get('abc', ['0'], '_'); - - result = _('abc').get('0'); - result = _('abc').get('0', '_'); - result = _('abc').get(['0']); - result = _('abc').get(['0'], '_'); - } - - { - let result: number; - - result = _.get([42], '0'); - result = _.get([42], '0', -1); - result = _.get([42], ['0']); - result = _.get([42], ['0'], -1); - - result = _.get([42], '0'); - result = _.get([42], '0', -1); - result = _.get([42], ['0']); - result = _.get([42], ['0'], -1); - - result = _([42]).get('0'); - result = _([42]).get('0', -1); - result = _([42]).get(['0']); - result = _([42]).get(['0'], -1); - } - - { - let result: boolean; - - result = _.get({a: true}, 'a'); - result = _.get({a: true}, 'a', false); - result = _.get({a: true}, ['a']); - result = _.get({a: true}, ['a'], false); - - result = _.get({a: true}, 'a'); - result = _.get({a: true}, 'a', false); - result = _.get({a: true}, ['a']); - result = _.get({a: true}, ['a'], false); - - result = _({a: true}).get('a'); - result = _({a: true}).get('a', false); - result = _({a: true}).get(['a']); - result = _({a: true}).get(['a'], false); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _('abc').chain().get('0'); - result = _('abc').chain().get('0', '_'); - result = _('abc').chain().get(['0']); - result = _('abc').chain().get(['0'], '_'); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _([42]).chain().get('0'); - result = _([42]).chain().get('0', -1); - result = _([42]).chain().get(['0']); - result = _([42]).chain().get(['0'], -1); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _({a: true}).chain().get('a'); - result = _({a: true}).chain().get('a', false); - result = _({a: true}).chain().get(['a']); - result = _({a: true}).chain().get(['a'], false); - } + fp.getOr(-1, 0, [42]); // $ExpectType number + fp.getOr(-1)(0)([42]); // $ExpectType number + fp.getOr("empty" as "empty")(0)([42]); // $ExpectType number | "empty" } // _.has -namespace TestHas { - type SampleObject = {a: number; b: string; c: boolean;}; - - let object: SampleObject = { a: 1, b: "", c: true }; - - { - let result: boolean; - - result = _.has(object, ''); - result = _.has(object, 42); - result = _.has(object, ['', 42]); - - result = _(object).has(''); - result = _(object).has(42); - result = _(object).has(['', 42]); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(object).chain().has(''); - result = _(object).chain().has(42); - result = _(object).chain().has(['', 42]); - } -} - // _.hasIn -namespace TestHasIn { - type SampleObject = {a: number; b: string; c: boolean;}; +{ + const object: AbcObject = anything; - let object: SampleObject = { a: 1, b: "", c: true }; + _.has(object, ""); // $ExpectType boolean + _.has(object, 42); // $ExpectType boolean + _.has(object, ["", 42]); // $ExpectType boolean + _(object).has(""); // $ExpectType boolean + _(object).has(42); // $ExpectType boolean + _(object).has(["", 42]); // $ExpectType boolean + _.chain(object).has(""); // $ExpectType LoDashExplicitWrapper + _.chain(object).has(42); // $ExpectType LoDashExplicitWrapper + _.chain(object).has(["", 42]); // $ExpectType LoDashExplicitWrapper + fp.has("a", object); // $ExpectType boolean + fp.has("a")(object); // $ExpectType boolean + fp.has(["a", 42])(object); // $ExpectType boolean - { - let result: boolean; - - result = _.hasIn(object, ''); - result = _.hasIn(object, 42); - result = _.hasIn(object, ['', 42]); - - result = _(object).hasIn(''); - result = _(object).hasIn(42); - result = _(object).hasIn(['', 42]); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(object).chain().hasIn(''); - result = _(object).chain().hasIn(42); - result = _(object).chain().hasIn(['', 42]); - } + _.hasIn(object, ""); // $ExpectType boolean + _.hasIn(object, 42); // $ExpectType boolean + _.hasIn(object, ["", 42]); // $ExpectType boolean + _(object).hasIn(""); // $ExpectType boolean + _(object).hasIn(42); // $ExpectType boolean + _(object).hasIn(["", 42]); // $ExpectType boolean + _.chain(object).hasIn(""); // $ExpectType LoDashExplicitWrapper + _.chain(object).hasIn(42); // $ExpectType LoDashExplicitWrapper + _.chain(object).hasIn(["", 42]); // $ExpectType LoDashExplicitWrapper + fp.hasIn("a", object); // $ExpectType boolean + fp.hasIn("a")(object); // $ExpectType boolean + fp.hasIn(["a", 42])(object); // $ExpectType boolean } // _.invert -namespace TestInvert { - { - let result: _.Dictionary; - - result = _.invert({}); - } - - { - let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; - - result = _({}).invert(); - } - - { - let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; - - result = _({}).chain().invert(); - } +{ + _.invert({}); // $ExpectType Dictionary + _({}).invert(); // $ExpectType LoDashImplicitWrapper> + _.chain({}).invert(); // $ExpectType LoDashExplicitWrapper> + fp.invert({}); // $ExpectType Dictionary } // _.invertBy -namespace TestInvertBy { - let array: Array<{a: number;}> = []; - let list: _.List<{a: number;}> = []; - let dictionary: _.Dictionary<{a: number;}> = {}; - let numericDictionary: _.NumericDictionary<{a: number;}> = {}; +{ + const list: ArrayLike<{ a: number }> = anything; + const dictionary: _.Dictionary<{ a: number }> = {}; + const numericDictionary: _.NumericDictionary<{ a: number }> = {}; - let stringIterator: (value: string) => any = (value: string) => 1; - let arrayIterator: (value: {a: number;}) => any = (value: {a: number;}) => 1; - let listIterator: (value: {a: number;}) => any = (value: {a: number;}) => 1; - let dictionaryIterator: (value: {a: number;}) => any = (value: {a: number;}) => 1; - let numericDictionaryIterator: (value: {a: number;}) => any = (value: {a: number;}) => 1; + const stringIterator = (value: string) => 1; + const valueIterator = (value: {a: number }) => 1; - { - let result: _.Dictionary; + _.invertBy("foo"); // $ExpectType Dictionary + _.invertBy("foo", stringIterator); // $ExpectType Dictionary + _.invertBy(list); // $ExpectType Dictionary + _.invertBy(list, "a"); // $ExpectType Dictionary + _.invertBy(list, valueIterator); // $ExpectType Dictionary + _.invertBy(list, {a: 1}); // $ExpectType Dictionary + _.invertBy(dictionary); // $ExpectType Dictionary + _.invertBy(dictionary, "a"); // $ExpectType Dictionary + _.invertBy(dictionary, valueIterator); // $ExpectType Dictionary + _.invertBy(dictionary, {a: 1}); // $ExpectType Dictionary + _.invertBy(numericDictionary); // $ExpectType Dictionary + _.invertBy(numericDictionary, "a"); // $ExpectType Dictionary + _.invertBy(numericDictionary, valueIterator); // $ExpectType Dictionary + _.invertBy(numericDictionary, {a: 1}); // $ExpectType Dictionary - result = _.invertBy('foo'); - result = _.invertBy('foo', stringIterator); + _("foo").invertBy(stringIterator); // $ExpectType LoDashImplicitWrapper> + _(list).invertBy(); // $ExpectType LoDashImplicitWrapper> + _(list).invertBy("a"); // $ExpectType LoDashImplicitWrapper> + _(dictionary).invertBy(valueIterator); // $ExpectType LoDashImplicitWrapper> + _(numericDictionary).invertBy({a: 1}); // $ExpectType LoDashImplicitWrapper> - result = _.invertBy(array); - result = _.invertBy<{a: number;}>(array, 'a'); - result = _.invertBy<{a: number;}>(array, arrayIterator); - result = _.invertBy<{a: number;}>(array, {a: 1}); + _.chain("foo").invertBy(stringIterator); // $ExpectType LoDashExplicitWrapper> + _.chain(list).invertBy(); // $ExpectType LoDashExplicitWrapper> + _.chain(list).invertBy("a"); // $ExpectType LoDashExplicitWrapper> + _.chain(dictionary).invertBy(valueIterator); // $ExpectType LoDashExplicitWrapper> + _.chain(numericDictionary).invertBy({a: 1}); // $ExpectType LoDashExplicitWrapper> - result = _.invertBy(list); - result = _.invertBy<{a: number;}>(list, 'a'); - result = _.invertBy<{a: number;}>(list, listIterator); - result = _.invertBy<{a: number;}>(list, {a: 1}); - - result = _.invertBy(dictionary); - result = _.invertBy<{a: number;}>(dictionary, 'a'); - result = _.invertBy<{a: number;}>(dictionary, dictionaryIterator); - result = _.invertBy<{a: number;}>(dictionary, {a: 1}); - - result = _.invertBy(numericDictionary); - result = _.invertBy<{a: number;}>(numericDictionary, 'a'); - result = _.invertBy<{a: number;}>(numericDictionary, numericDictionaryIterator); - result = _.invertBy<{a: number;}>(numericDictionary, {a: 1}); - } - - { - let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; - - result = _('foo').invertBy(); - result = _('foo').invertBy(stringIterator); - - result = _(array).invertBy(); - result = _(array).invertBy('a'); - result = _(array).invertBy(arrayIterator); - result = _(array).invertBy({a: 1}); - - result = _(list).invertBy(); - result = _(list).invertBy('a'); - result = _(list).invertBy(listIterator); - result = _(list).invertBy<{a: number;}>({a: 1}); - - result = _(dictionary).invertBy(); - result = _(dictionary).invertBy('a'); - result = _(dictionary).invertBy(dictionaryIterator); - result = _(dictionary).invertBy<{a: number;}>({a: 1}); - - result = _(numericDictionary).invertBy(); - result = _(numericDictionary).invertBy('a'); - result = _(numericDictionary).invertBy(numericDictionaryIterator); - result = _(numericDictionary).invertBy<{a: number;}>({a: 1}); - } - - { - let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; - - result = _('foo').chain().invertBy(); - result = _('foo').chain().invertBy(stringIterator); - - result = _(array).chain().invertBy(); - result = _(array).chain().invertBy('a'); - result = _(array).chain().invertBy(arrayIterator); - result = _(array).chain().invertBy({a: 1}); - - result = _(list).chain().invertBy(); - result = _(list).chain().invertBy('a'); - result = _(list).chain().invertBy(listIterator); - result = _(list).chain().invertBy<{a: number;}>({a: 1}); - - result = _(dictionary).chain().invertBy(); - result = _(dictionary).chain().invertBy('a'); - result = _(dictionary).chain().invertBy(dictionaryIterator); - result = _(dictionary).chain().invertBy<{a: number;}>({a: 1}); - - result = _(numericDictionary).chain().invertBy(); - result = _(numericDictionary).chain().invertBy('a'); - result = _(numericDictionary).chain().invertBy(numericDictionaryIterator); - result = _(numericDictionary).chain().invertBy<{a: number;}>({a: 1}); - } + fp.invertBy(stringIterator, "foo"); // $ExpectType Dictionary + fp.invertBy(stringIterator)("foo"); // $ExpectType Dictionary + fp.invertBy(valueIterator)(list); // $ExpectType Dictionary + fp.invertBy("a")(list); // $ExpectType Dictionary + fp.invertBy({ a: 1 })(list); // $ExpectType Dictionary + fp.invertBy(valueIterator)(dictionary); // $ExpectType Dictionary + fp.invertBy("a")(dictionary); // $ExpectType Dictionary + fp.invertBy({ a: 1 })(dictionary); // $ExpectType Dictionary + fp.invertBy(valueIterator)(numericDictionary); // $ExpectType Dictionary + fp.invertBy("a")(numericDictionary); // $ExpectType Dictionary + fp.invertBy({ a: 1 })(numericDictionary); // $ExpectType Dictionary } // _.keys -namespace TestKeys { - let object: _.Dictionary | null | undefined = anything; - - { - let result: string[]; - - result = _.keys(object); - } - - { - let result: _.LoDashImplicitArrayWrapper; - - result = _(object).keys(); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _(object).chain().keys(); - } -} - // _.keysIn -namespace TestKeysIn { - let object: _.Dictionary | null | undefined = anything; +{ + const object: AbcObject | null | undefined = anything; - { - let result: string[]; + _.keys(object); // $ExpectType string[] + _(object).keys(); // $ExpectType LoDashImplicitWrapper + _.chain(object).keys(); // $ExpectType LoDashExplicitWrapper + fp.keys({}); // $ExpectType string[] - result = _.keysIn(object); - } - - { - let result: _.LoDashImplicitArrayWrapper; - - result = _(object).keysIn(); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _(object).chain().keysIn(); - } + _.keysIn(object); // $ExpectType string[] + _(object).keysIn(); // $ExpectType LoDashImplicitWrapper + _.chain(object).keysIn(); // $ExpectType LoDashExplicitWrapper + fp.keysIn({}); // $ExpectType string[] } // _.mapKeys -namespace TestMapKeys { - let array: AbcObject[] | null | undefined = [] as any; - let list: _.List| null | undefined = [] as any; - let dictionary: _.Dictionary | null | undefined = anything; - let numericDictionary: _.NumericDictionary | null | undefined = anything; - let abcObject: AbcObject = anything; +{ + const list: _.List| null | undefined = [] as any; + const dictionary: _.Dictionary | null | undefined = anything; + const numericDictionary: _.NumericDictionary | null | undefined = anything; + const abcObject: AbcObject = anything; - let listIterator = (value: AbcObject, index: number, collection: _.List) => ""; - let dictionaryIterator = (value: AbcObject, key: string, collection: _.Dictionary) => ""; - let numericDictionaryIterator = (value: AbcObject, key: string, collection: _.NumericDictionary) => ""; - let abcObjectIterator = (value: AbcObject[keyof AbcObject], key: string, collection: AbcObject) => ""; + const listIterator = (value: AbcObject, index: number, collection: _.List) => ""; + const dictionaryIterator = (value: AbcObject, key: string, collection: _.Dictionary) => ""; + const numericDictionaryIterator = (value: AbcObject, key: string, collection: _.NumericDictionary) => ""; + const abcObjectIterator = (value: AbcObject[keyof AbcObject], key: string, collection: AbcObject) => ""; - { - _.mapKeys(array); // $ExpectType Dictionary - _.mapKeys(array, listIterator); // $ExpectType Dictionary - _.mapKeys(array, ''); // $ExpectType Dictionary - _.mapKeys(array, {}); // $ExpectType Dictionary + _.mapKeys(list); // $ExpectType Dictionary + _.mapKeys(list, listIterator); // $ExpectType Dictionary + _.mapKeys(list, ""); // $ExpectType Dictionary + _.mapKeys(list, {}); // $ExpectType Dictionary - _.mapKeys(list); // $ExpectType Dictionary - _.mapKeys(list, listIterator); // $ExpectType Dictionary - _.mapKeys(list, ''); // $ExpectType Dictionary - _.mapKeys(list, {}); // $ExpectType Dictionary + _.mapKeys(dictionary); // $ExpectType Dictionary + _.mapKeys(dictionary, dictionaryIterator); // $ExpectType Dictionary + _.mapKeys(dictionary, ""); // $ExpectType Dictionary + _.mapKeys(dictionary, {}); // $ExpectType Dictionary - _.mapKeys(dictionary); // $ExpectType Dictionary - _.mapKeys(dictionary, dictionaryIterator); // $ExpectType Dictionary - _.mapKeys(dictionary, ''); // $ExpectType Dictionary - _.mapKeys(dictionary, {}); // $ExpectType Dictionary + /* Broken in TS 2.4 + _.mapKeys(numericDictionary); // Dictionary + _.mapKeys(numericDictionary, numericDictionaryIterator); // Dictionary + _.mapKeys(numericDictionary, ""); // Dictionary + _.mapKeys(numericDictionary, {}); // Dictionary + */ - /* Broken in TS 2.4 - _.mapKeys(numericDictionary); // Dictionary - _.mapKeys(numericDictionary, numericDictionaryIterator); // Dictionary - _.mapKeys(numericDictionary, ''); // Dictionary - _.mapKeys(numericDictionary, {}); // Dictionary - */ - } + _.mapKeys(abcObject); // $ExpectType Dictionary + _.mapKeys(abcObject, abcObjectIterator); // $ExpectType Dictionary + _.mapKeys(abcObject, ""); // $ExpectType Dictionary - { - _.mapKeys(abcObject); // $ExpectType Dictionary - _.mapKeys(abcObject, abcObjectIterator); // $ExpectType Dictionary - _.mapKeys(abcObject, ''); // $ExpectType Dictionary - } + _(list).mapKeys(); // $ExpectType LoDashImplicitWrapper> + _(list).mapKeys(listIterator); // $ExpectType LoDashImplicitWrapper> + _(list).mapKeys(""); // $ExpectType LoDashImplicitWrapper> + _(list).mapKeys({}); // $ExpectType LoDashImplicitWrapper> - { - _(array).mapKeys(); // $ExpectType LoDashImplicitWrapper> - _(array).mapKeys(listIterator); // $ExpectType LoDashImplicitWrapper> - _(array).mapKeys(''); // $ExpectType LoDashImplicitWrapper> - _(array).mapKeys({}); // $ExpectType LoDashImplicitWrapper> + _(dictionary).mapKeys(); // $ExpectType LoDashImplicitWrapper> + _(dictionary).mapKeys(dictionaryIterator); // $ExpectType LoDashImplicitWrapper> + _(dictionary).mapKeys(""); // $ExpectType LoDashImplicitWrapper> + _(dictionary).mapKeys({}); // $ExpectType LoDashImplicitWrapper> - _(list).mapKeys(); // $ExpectType LoDashImplicitWrapper> - _(list).mapKeys(listIterator); // $ExpectType LoDashImplicitWrapper> - _(list).mapKeys(''); // $ExpectType LoDashImplicitWrapper> - _(list).mapKeys({}); // $ExpectType LoDashImplicitWrapper> + /* Broken in TS 2.4 + _(numericDictionary).mapKeys(); // LoDashImplicitWrapper> + _(numericDictionary).mapKeys(numericDictionaryIterator); // LoDashImplicitWrapper> + _(numericDictionary).mapKeys(""); // LoDashImplicitWrapper> + _(numericDictionary).mapKeys({}); // LoDashImplicitWrapper> + */ - _(dictionary).mapKeys(); // $ExpectType LoDashImplicitWrapper> - _(dictionary).mapKeys(dictionaryIterator); // $ExpectType LoDashImplicitWrapper> - _(dictionary).mapKeys(''); // $ExpectType LoDashImplicitWrapper> - _(dictionary).mapKeys({}); // $ExpectType LoDashImplicitWrapper> + _(abcObject).mapKeys(); // $ExpectType LoDashImplicitWrapper> + _(abcObject).mapKeys(abcObjectIterator); // $ExpectType LoDashImplicitWrapper> + _(abcObject).mapKeys(""); // $ExpectType LoDashImplicitWrapper> - /* Broken in TS 2.4 - _(numericDictionary).mapKeys(); // LoDashImplicitWrapper> - _(numericDictionary).mapKeys(numericDictionaryIterator); // LoDashImplicitWrapper> - _(numericDictionary).mapKeys(''); // LoDashImplicitWrapper> - _(numericDictionary).mapKeys({}); // LoDashImplicitWrapper> - */ - } + _.chain(list).mapKeys(); // $ExpectType LoDashExplicitWrapper> + _.chain(list).mapKeys(listIterator); // $ExpectType LoDashExplicitWrapper> + _.chain(list).mapKeys(""); // $ExpectType LoDashExplicitWrapper> + _.chain(list).mapKeys({}); // $ExpectType LoDashExplicitWrapper> - { - _(abcObject).mapKeys(); // $ExpectType LoDashImplicitWrapper> - _(abcObject).mapKeys(abcObjectIterator); // $ExpectType LoDashImplicitWrapper> - _(abcObject).mapKeys(''); // $ExpectType LoDashImplicitWrapper> - } + _.chain(dictionary).mapKeys(); // $ExpectType LoDashExplicitWrapper> + _.chain(dictionary).mapKeys(dictionaryIterator); // $ExpectType LoDashExplicitWrapper> + _.chain(dictionary).mapKeys(""); // $ExpectType LoDashExplicitWrapper> + _.chain(dictionary).mapKeys({}); // $ExpectType LoDashExplicitWrapper> - { - _(array).chain().mapKeys(); // $ExpectType LoDashExplicitWrapper> - _(array).chain().mapKeys(listIterator); // $ExpectType LoDashExplicitWrapper> - _(array).chain().mapKeys(''); // $ExpectType LoDashExplicitWrapper> - _(array).chain().mapKeys({}); // $ExpectType LoDashExplicitWrapper> + /* Broken in TS 2.4 + _.chain(numericDictionary).mapKeys(); // LoDashExplicitWrapper> + _.chain(numericDictionary).mapKeys(numericDictionaryIterator); // LoDashExplicitWrapper> + _.chain(numericDictionary).mapKeys(""); // LoDashExplicitWrapper> + _.chain(numericDictionary).mapKeys({}); // LoDashExplicitWrapper> + */ - _(list).chain().mapKeys(); // $ExpectType LoDashExplicitWrapper> - _(list).chain().mapKeys(listIterator); // $ExpectType LoDashExplicitWrapper> - _(list).chain().mapKeys(''); // $ExpectType LoDashExplicitWrapper> - _(list).chain().mapKeys({}); // $ExpectType LoDashExplicitWrapper> + _.chain(abcObject).mapKeys(); // $ExpectType LoDashExplicitWrapper> + _.chain(abcObject).mapKeys(abcObjectIterator); // $ExpectType LoDashExplicitWrapper> + _.chain(abcObject).mapKeys(""); // $ExpectType LoDashExplicitWrapper> - _(dictionary).chain().mapKeys(); // $ExpectType LoDashExplicitWrapper> - _(dictionary).chain().mapKeys(dictionaryIterator); // $ExpectType LoDashExplicitWrapper> - _(dictionary).chain().mapKeys(''); // $ExpectType LoDashExplicitWrapper> - _(dictionary).chain().mapKeys({}); // $ExpectType LoDashExplicitWrapper> - - /* Broken in TS 2.4 - _(numericDictionary).chain().mapKeys(); // LoDashExplicitWrapper> - _(numericDictionary).chain().mapKeys(numericDictionaryIterator); // LoDashExplicitWrapper> - _(numericDictionary).chain().mapKeys(''); // LoDashExplicitWrapper> - _(numericDictionary).chain().mapKeys({}); // LoDashExplicitWrapper> - */ - } - - { - _(abcObject).chain().mapKeys(); // $ExpectType LoDashExplicitWrapper> - _(abcObject).chain().mapKeys(abcObjectIterator); // $ExpectType LoDashExplicitWrapper> - _(abcObject).chain().mapKeys(''); // $ExpectType LoDashExplicitWrapper> - } + const indexIterator = (index: number) => index + 1; + const keyIterator = (key: string) => "_" + key; + fp.mapKeys(indexIterator, list); // $ExpectType Dictionary + fp.mapKeys(keyIterator)(dictionary); // $ExpectType Dictionary + fp.mapKeys(keyIterator)(abcObject); // $ExpectType Dictionary } // _.mapValues @@ -11718,956 +5597,773 @@ namespace TestMapKeys { const abcObjectOrNull: AbcObject | null = anything; const key: string = anything; - { - // $ExpectType NumericDictionary - _.mapValues("foo", (char, index, str) => { - char; // $ExpectType string - index; // $ExpectType number - str; // $ExpectType string - return abcObject; - }); + // $ExpectType NumericDictionary + _.mapValues("foo", (char, index, str) => { + char; // $ExpectType string + index; // $ExpectType number + str; // $ExpectType string + return abcObject; + }); - // $ExpectType Dictionary - _.mapValues(dictionary, (value, key, collection) => { - value; // $ExpectType AbcObject - key; // $ExpectType string - collection; // $ExpectType Dictionary - return ""; - }); + // $ExpectType Dictionary + _.mapValues(dictionary, (value, key, collection) => { + value; // $ExpectType AbcObject + key; // $ExpectType string + collection; // $ExpectType Dictionary + return ""; + }); - // Can't really support NumericDictionary fully, but it at least gets treated like a Dictionary - // $ExpectType Dictionary - _.mapValues(numericDictionary, (value, key, collection) => { - value; // $ExpectType AbcObject - key; // $ExpectType string - collection; // $ExpectType Dictionary - return ""; - }); + // Can"t really support NumericDictionary fully, but it at least gets treated like a Dictionary + // $ExpectType Dictionary + _.mapValues(numericDictionary, (value, key, collection) => { + value; // $ExpectType AbcObject + key; // $ExpectType string + collection; // $ExpectType Dictionary + return ""; + }); - // $ExpectType { a: string; b: string; c: string; } - _.mapValues(abcObject, (value, key, collection) => { - value; // $ExpectType string | number | boolean - key; // $ExpectType string - collection; // $ExpectType AbcObject - return ""; - }); + // $ExpectType { a: string; b: string; c: string; } + _.mapValues(abcObject, (value, key, collection) => { + value; // $ExpectType string | number | boolean + key; // $ExpectType string + collection; // $ExpectType AbcObject + return ""; + }); - _.mapValues(dictionary, {}); // $ExpectType Dictionary - // Can't really support NumericDictionary fully, but it at least gets treated like a Dictionary - _.mapValues(numericDictionary, {}); // $ExpectType Dictionary - _.mapValues(abcObject, {}); // $ExpectType { a: boolean; b: boolean; c: boolean; } + _.mapValues(dictionary, {}); // $ExpectType Dictionary + // Can"t really support NumericDictionary fully, but it at least gets treated like a Dictionary + _.mapValues(numericDictionary, {}); // $ExpectType Dictionary + _.mapValues(abcObject, {}); // $ExpectType { a: boolean; b: boolean; c: boolean; } - _.mapValues(dictionary, "a"); // $ExpectType Dictionary - // Can't really support NumericDictionary fully, but it at least gets treated like a Dictionary - _.mapValues(numericDictionary, "a"); // $ExpectType Dictionary + _.mapValues(dictionary, "a"); // $ExpectType Dictionary + // Can"t really support NumericDictionary fully, but it at least gets treated like a Dictionary + _.mapValues(numericDictionary, "a"); // $ExpectType Dictionary - _.mapValues(abcObject, key); // $ExpectType { a: any; b: any; c: any; } - _.mapValues(dictionary, key); // $ExpectType Dictionary - // Can't really support NumericDictionary fully, but it at least gets treated like a Dictionary - _.mapValues(numericDictionary, key); // $ExpectType Dictionary + _.mapValues(abcObject, key); // $ExpectType { a: any; b: any; c: any; } + _.mapValues(dictionary, key); // $ExpectType Dictionary + // Can"t really support NumericDictionary fully, but it at least gets treated like a Dictionary + _.mapValues(numericDictionary, key); // $ExpectType Dictionary - _.mapValues("a"); // $ExpectType NumericDictionary - _.mapValues(dictionary); // $ExpectType Dictionary - // Can't really support NumericDictionary fully, but it at least gets treated like a Dictionary - _.mapValues(numericDictionary); // $ExpectType Dictionary - _.mapValues(abcObject); // $ExpectType AbcObject - _.mapValues(abcObjectOrNull); // $ExpectType Partial - } + _.mapValues("a"); // $ExpectType NumericDictionary + _.mapValues(dictionary); // $ExpectType Dictionary + // Can"t really support NumericDictionary fully, but it at least gets treated like a Dictionary + _.mapValues(numericDictionary); // $ExpectType Dictionary + _.mapValues(abcObject); // $ExpectType AbcObject + _.mapValues(abcObjectOrNull); // $ExpectType Partial - { - // $ExpectType LoDashImplicitWrapper> - _("foo").mapValues((char, index, str) => { - char; // $ExpectType string - index; // $ExpectType number - str; // $ExpectType string - return abcObject; - }); + // $ExpectType LoDashImplicitWrapper> + _("foo").mapValues((char, index, str) => { + char; // $ExpectType string + index; // $ExpectType number + str; // $ExpectType string + return abcObject; + }); - // $ExpectType LoDashImplicitWrapper> - _(dictionary).mapValues((value, key, collection) => { - value; // $ExpectType AbcObject - key; // $ExpectType string - collection; // $ExpectType Dictionary - return ""; - }); + // $ExpectType LoDashImplicitWrapper> + _(dictionary).mapValues((value, key, collection) => { + value; // $ExpectType AbcObject + key; // $ExpectType string + collection; // $ExpectType Dictionary + return ""; + }); - // Can't really support NumericDictionary fully, but it at least gets treated like a Dictionary - // $ExpectType LoDashImplicitWrapper> - _(numericDictionary).mapValues((value, key, collection) => { - value; // $ExpectType AbcObject - key; // $ExpectType string - collection; // $ExpectType Dictionary - return ""; - }); + // Can"t really support NumericDictionary fully, but it at least gets treated like a Dictionary + // $ExpectType LoDashImplicitWrapper> + _(numericDictionary).mapValues((value, key, collection) => { + value; // $ExpectType AbcObject + key; // $ExpectType string + collection; // $ExpectType Dictionary + return ""; + }); - // $ExpectType LoDashImplicitWrapper<{ a: string; b: string; c: string; }> - _(abcObject).mapValues((value, key, collection) => { - value; // $ExpectType string | number | boolean - key; // $ExpectType string - collection; // $ExpectType AbcObject - return ""; - }); + // $ExpectType LoDashImplicitWrapper<{ a: string; b: string; c: string; }> + _(abcObject).mapValues((value, key, collection) => { + value; // $ExpectType string | number | boolean + key; // $ExpectType string + collection; // $ExpectType AbcObject + return ""; + }); - _(dictionary).mapValues({}); // $ExpectType LoDashImplicitWrapper> - // Can't really support NumericDictionary fully, but it at least gets treated like a Dictionary - _(numericDictionary).mapValues({}); // $ExpectType LoDashImplicitWrapper> - _(abcObject).mapValues({}); // $ExpectType LoDashImplicitWrapper<{ a: boolean; b: boolean; c: boolean; }> + _(dictionary).mapValues({}); // $ExpectType LoDashImplicitWrapper> + // Can"t really support NumericDictionary fully, but it at least gets treated like a Dictionary + _(numericDictionary).mapValues({}); // $ExpectType LoDashImplicitWrapper> + _(abcObject).mapValues({}); // $ExpectType LoDashImplicitWrapper<{ a: boolean; b: boolean; c: boolean; }> - _(dictionary).mapValues("a"); // $ExpectType LoDashImplicitWrapper> - // Can't really support NumericDictionary fully, but it at least gets treated like a Dictionary - _(numericDictionary).mapValues("a"); // $ExpectType LoDashImplicitWrapper> + _(dictionary).mapValues("a"); // $ExpectType LoDashImplicitWrapper> + // Can"t really support NumericDictionary fully, but it at least gets treated like a Dictionary + _(numericDictionary).mapValues("a"); // $ExpectType LoDashImplicitWrapper> - _(abcObject).mapValues(key); // $ExpectType LoDashImplicitWrapper<{ a: any; b: any; c: any; }> - _(dictionary).mapValues(key); // $ExpectType LoDashImplicitWrapper> - // Can't really support NumericDictionary fully, but it at least gets treated like a Dictionary - _(numericDictionary).mapValues(key); // $ExpectType LoDashImplicitWrapper> + _(abcObject).mapValues(key); // $ExpectType LoDashImplicitWrapper<{ a: any; b: any; c: any; }> + _(dictionary).mapValues(key); // $ExpectType LoDashImplicitWrapper> + // Can"t really support NumericDictionary fully, but it at least gets treated like a Dictionary + _(numericDictionary).mapValues(key); // $ExpectType LoDashImplicitWrapper> - _("a").mapValues(); // $ExpectType LoDashImplicitWrapper> - _(dictionary).mapValues(); // $ExpectType LoDashImplicitWrapper> - // Can't really support NumericDictionary fully, but it at least gets treated like a Dictionary - _(numericDictionary).mapValues(); // $ExpectType LoDashImplicitWrapper> - _(abcObject).mapValues(); // $ExpectType LoDashImplicitWrapper - _(abcObjectOrNull).mapValues(); // $ExpectType LoDashImplicitWrapper> - } + _("a").mapValues(); // $ExpectType LoDashImplicitWrapper> + _(dictionary).mapValues(); // $ExpectType LoDashImplicitWrapper> + // Can"t really support NumericDictionary fully, but it at least gets treated like a Dictionary + _(numericDictionary).mapValues(); // $ExpectType LoDashImplicitWrapper> + _(abcObject).mapValues(); // $ExpectType LoDashImplicitWrapper + _(abcObjectOrNull).mapValues(); // $ExpectType LoDashImplicitWrapper> - { - // $ExpectType LoDashExplicitWrapper> - _("foo").chain().mapValues((char, index, str) => { - char; // $ExpectType string - index; // $ExpectType number - str; // $ExpectType string - return abcObject; - }); + // $ExpectType LoDashExplicitWrapper> + _.chain("foo").mapValues((char, index, str) => { + char; // $ExpectType string + index; // $ExpectType number + str; // $ExpectType string + return abcObject; + }); - // $ExpectType LoDashExplicitWrapper> - _(dictionary).chain().mapValues((value, key, collection) => { - value; // $ExpectType AbcObject - key; // $ExpectType string - collection; // $ExpectType Dictionary - return ""; - }); + // $ExpectType LoDashExplicitWrapper> + _.chain(dictionary).mapValues((value, key, collection) => { + value; // $ExpectType AbcObject + key; // $ExpectType string + collection; // $ExpectType Dictionary + return ""; + }); - // Can't really support NumericDictionary fully, but it at least gets treated like a Dictionary - // $ExpectType LoDashExplicitWrapper> - _(numericDictionary).chain().mapValues((value, key, collection) => { - value; // $ExpectType AbcObject - key; // $ExpectType string - collection; // $ExpectType Dictionary - return ""; - }); + // Can"t really support NumericDictionary fully, but it at least gets treated like a Dictionary + // $ExpectType LoDashExplicitWrapper> + _.chain(numericDictionary).mapValues((value, key, collection) => { + value; // $ExpectType AbcObject + key; // $ExpectType string + collection; // $ExpectType Dictionary + return ""; + }); - // $ExpectType LoDashExplicitWrapper<{ a: string; b: string; c: string; }> - _(abcObject).chain().mapValues((value, key, collection) => { - value; // $ExpectType string | number | boolean - key; // $ExpectType string - collection; // $ExpectType AbcObject - return ""; - }); + // $ExpectType LoDashExplicitWrapper<{ a: string; b: string; c: string; }> + _.chain(abcObject).mapValues((value, key, collection) => { + value; // $ExpectType string | number | boolean + key; // $ExpectType string + collection; // $ExpectType AbcObject + return ""; + }); - _(dictionary).chain().mapValues({}); // $ExpectType LoDashExplicitWrapper> - // Can't really support NumericDictionary fully, but it at least gets treated like a Dictionary - _(numericDictionary).chain().mapValues({}); // $ExpectType LoDashExplicitWrapper> - _(abcObject).chain().mapValues({}); // $ExpectType LoDashExplicitWrapper<{ a: boolean; b: boolean; c: boolean; }> + _.chain(dictionary).mapValues({}); // $ExpectType LoDashExplicitWrapper> + // Can"t really support NumericDictionary fully, but it at least gets treated like a Dictionary + _.chain(numericDictionary).mapValues({}); // $ExpectType LoDashExplicitWrapper> + _.chain(abcObject).mapValues({}); // $ExpectType LoDashExplicitWrapper<{ a: boolean; b: boolean; c: boolean; }> - _(dictionary).chain().mapValues("a"); // $ExpectType LoDashExplicitWrapper> - // Can't really support NumericDictionary fully, but it at least gets treated like a Dictionary - _(numericDictionary).chain().mapValues("a"); // $ExpectType LoDashExplicitWrapper> + _.chain(dictionary).mapValues("a"); // $ExpectType LoDashExplicitWrapper> + // Can"t really support NumericDictionary fully, but it at least gets treated like a Dictionary + _.chain(numericDictionary).mapValues("a"); // $ExpectType LoDashExplicitWrapper> - _(abcObject).chain().mapValues(key); // $ExpectType LoDashExplicitWrapper<{ a: any; b: any; c: any; }> - _(dictionary).chain().mapValues(key); // $ExpectType LoDashExplicitWrapper> - // Can't really support NumericDictionary fully, but it at least gets treated like a Dictionary - _(numericDictionary).chain().mapValues(key); // $ExpectType LoDashExplicitWrapper> + _.chain(abcObject).mapValues(key); // $ExpectType LoDashExplicitWrapper<{ a: any; b: any; c: any; }> + _.chain(dictionary).mapValues(key); // $ExpectType LoDashExplicitWrapper> + // Can"t really support NumericDictionary fully, but it at least gets treated like a Dictionary + _.chain(numericDictionary).mapValues(key); // $ExpectType LoDashExplicitWrapper> - _("a").chain().mapValues(); // $ExpectType LoDashExplicitWrapper> - _(dictionary).chain().mapValues(); // $ExpectType LoDashExplicitWrapper> - // Can't really support NumericDictionary fully, but it at least gets treated like a Dictionary - _(numericDictionary).chain().mapValues(); // $ExpectType LoDashExplicitWrapper> + _.chain("a").mapValues(); // $ExpectType LoDashExplicitWrapper> + _.chain(dictionary).mapValues(); // $ExpectType LoDashExplicitWrapper> + // Can"t really support NumericDictionary fully, but it at least gets treated like a Dictionary + _.chain(numericDictionary).mapValues(); // $ExpectType LoDashExplicitWrapper> - _(abcObject).chain().mapValues(); // $ExpectType LoDashExplicitWrapper - _(abcObjectOrNull).chain().mapValues(); // $ExpectType LoDashExplicitWrapper> - } -} + _.chain(abcObject).mapValues(); // $ExpectType LoDashExplicitWrapper + _.chain(abcObjectOrNull).mapValues(); // $ExpectType LoDashExplicitWrapper> -// _.merge -namespace TestMerge { - type InitialValue = { a : number }; - type MergingValue = { b : string }; - - const initialValue = { a : 1 }; - const mergingValue = { b : "hi" }; - - type ExpectedResult = { a: number, b: string }; - let result: ExpectedResult; - - // Test for basic merging - - result = _.merge(initialValue, mergingValue); - - result = _.merge(initialValue, {}, mergingValue); - - result = _.merge(initialValue, {}, {}, mergingValue); - - result = _.merge(initialValue, {}, {}, {}, mergingValue); - - // Once we get to the varargs version, you have to specify the result explicitly - result = _.merge(initialValue, {}, {}, {}, {}, mergingValue); - - type ComplicatedExpectedType = { a: number, b: string, c: {}, d: number[], e: boolean }; - - let complicatedResult: ComplicatedExpectedType = _.merge({ a: 1 }, - { b: "string" }, - { c: {} }, - { d: [1] }, - { e: true }); - // Test for type overriding - - type ExpectedTypeAfterOverriding = { a: boolean }; - - let 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).value(); - - result = _(initialValue).merge({}, {}, mergingValue).value(); - - result = _(initialValue).merge({}, {}, {}, mergingValue).value(); - - // Once we get to the varargs version, you have to specify the result explicitly - result = _(initialValue).merge({}, {}, {}, {}, mergingValue).value(); - - // Test complex multiple combinations with chaining - - complicatedResult = _({ a: 1 }).merge({ b: "string" }, - { c: {} }, - { d: [1] }, - { e: true }).value(); - - // Test for type overriding with chaining - - overriddenResult = _({ a: 1 }).merge({ a: "string" }, - { a: {} }, - { a: [1] }, - { a: true }).value(); - - { - let result: _.LoDashExplicitObjectWrapper; - // 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 }); - } - - { - let result: _.LoDashExplicitObjectWrapper; - - //result = _({ a: 1 }).chain().merge({ a: "string" }, { a: {} }, { a: [1] }, { a: true }); - } -} - -// _.mergeWith -namespace TestMergeWith { - type InitialValue = { a : number }; - type MergingValue = { b : string }; - - const initialValue = { a : 1 }; - const 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 = (value: any, srcValue: any, key: string, object: InitialValue, source: MergingValue) => 1; - - // 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(); - result = _(initialValue).mergeWith({}, {}, {}, {}, mergingValue, customizer).value(); + const valueIterator = (value: AbcObject) => ""; + fp.mapValues(valueIterator)(dictionary); // $ExpectType Dictionary + fp.mapValues("a", dictionary); // $ExpectType Dictionary + fp.mapValues(valueIterator)(numericDictionary); // $ExpectType Dictionary + fp.mapValues({ a: 42 })(numericDictionary); // $ExpectType Dictionary + fp.mapValues(value => "", abcObjectOrNull); // $ExpectType { a: string; b: string; c: string; } } // _.omit -namespace TestOmit { - let obj: AbcObject | null | undefined = anything; - let dictionary:_.Dictionary = anything; - let numericDictionary:_.NumericDictionary = anything; - let dictionaryWithNull:_.Dictionary = anything; - let numericDictionaryWithNull:_.NumericDictionary = anything; - let dictionaryWithUndefined:_.Dictionary = anything; - let numericDictionaryWithUndefined:_.NumericDictionary = anything; - let dictionaryWithNullAndUndefined:_.Dictionary = anything; - let numericDictionaryWithNullAndUndefined:_.NumericDictionary = anything; +{ + const obj: AbcObject | null | undefined = anything; + const dictionary: _.Dictionary = anything; + const numericDictionary: _.NumericDictionary = anything; - { - _.omit(obj, 'a'); // $ExpectType Partial - _.omit(obj, 0, 'a'); // $ExpectType Partial - _.omit(obj, ['b', 1], 0, 'a'); // $ExpectType Partial - _.omit(dictionary, 'a'); // $ExpectType Dictionary - _.omit(numericDictionary, 'a'); // $ExpectType NumericDictionary - _.omit(dictionaryWithNull, 'a'); // $ExpectType Dictionary - _.omit(numericDictionaryWithNull, 'a'); // $ExpectType NumericDictionary - _.omit(dictionaryWithUndefined, 'a'); // $ExpectType Dictionary - _.omit(numericDictionaryWithUndefined, 'a'); // $ExpectType NumericDictionary - _.omit(dictionaryWithNullAndUndefined, 'a'); // $ExpectType Dictionary - _.omit(numericDictionaryWithNullAndUndefined, 'a'); // $ExpectType NumericDictionary - } + _.omit(obj, "a"); // $ExpectType Partial + _.omit(obj, ["b", 1], 0, "a"); // $ExpectType Partial + _.omit(dictionary, "a"); // $ExpectType Dictionary + _.omit(numericDictionary, "a"); // $ExpectType NumericDictionary - { - _(obj).omit('a'); // $ExpectType LoDashImplicitWrapper> - _(obj).omit(0, 'a'); // $ExpectType LoDashImplicitWrapper> - _(obj).omit(['b', 1], 0, 'a'); // $ExpectType LoDashImplicitWrapper> - _(dictionary).omit('a'); // $ExpectType LoDashImplicitWrapper> - _(numericDictionary).omit('a'); // $ExpectType LoDashImplicitWrapper> - _(dictionaryWithNull).omit('a'); // $ExpectType LoDashImplicitWrapper> - _(numericDictionaryWithNull).omit('a'); // $ExpectType LoDashImplicitWrapper> - _(dictionaryWithUndefined).omit('a'); // $ExpectType LoDashImplicitWrapper> - _(numericDictionaryWithUndefined).omit('a'); // $ExpectType LoDashImplicitWrapper> - _(dictionaryWithNullAndUndefined).omit('a'); // $ExpectType LoDashImplicitWrapper> - _(numericDictionaryWithNullAndUndefined).omit('a'); // $ExpectType LoDashImplicitWrapper> - } + _(obj).omit("a"); // $ExpectType LoDashImplicitWrapper> + _(obj).omit(["b", 1], 0, "a"); // $ExpectType LoDashImplicitWrapper> + _(dictionary).omit("a"); // $ExpectType LoDashImplicitWrapper> + _(numericDictionary).omit("a"); // $ExpectType LoDashImplicitWrapper> - { - _(obj).chain().omit('a'); // $ExpectType LoDashExplicitWrapper> - _(obj).chain().omit(0, 'a'); // $ExpectType LoDashExplicitWrapper> - _(obj).chain().omit(['b', 1], 0, 'a'); // $ExpectType LoDashExplicitWrapper> - _(dictionary).chain().omit('a'); // $ExpectType LoDashExplicitWrapper> - _(numericDictionary).chain().omit('a'); // $ExpectType LoDashExplicitWrapper> - _(dictionaryWithNull).chain().omit('a'); // $ExpectType LoDashExplicitWrapper> - _(numericDictionaryWithNull).chain().omit('a'); // $ExpectType LoDashExplicitWrapper> - _(dictionaryWithUndefined).chain().omit('a'); // $ExpectType LoDashExplicitWrapper> - _(numericDictionaryWithUndefined).chain().omit('a'); // $ExpectType LoDashExplicitWrapper> - _(dictionaryWithNullAndUndefined).chain().omit('a'); // $ExpectType LoDashExplicitWrapper> - _(numericDictionaryWithNullAndUndefined).chain().omit('a'); // $ExpectType LoDashExplicitWrapper> - } + _.chain(obj).omit("a"); // $ExpectType LoDashExplicitWrapper> + _.chain(obj).omit(["b", 1], 0, "a"); // $ExpectType LoDashExplicitWrapper> + _.chain(dictionary).omit("a"); // $ExpectType LoDashExplicitWrapper> + _.chain(numericDictionary).omit("a"); // $ExpectType LoDashExplicitWrapper> + + fp.omit("a", obj); // $ExpectType Partial + fp.omit("a")(obj); // $ExpectType Partial + fp.omit(["a", "b"])(obj); // $ExpectType Partial } // _.omitBy -namespace TestOmitBy { - let obj: AbcObject | null | undefined = anything; - let predicate = (element: any, key: string) => true; +{ + const obj: AbcObject | null | undefined = anything; + const predicate = (element: string | number | boolean, key: string) => true; - { - let result: Partial; - - result = _.omitBy(obj, predicate); - } - - { - let result: _.LoDashImplicitWrapper>; - - result = _(obj).omitBy(predicate); - } - - { - let result: _.LoDashExplicitWrapper>; - - result = _(obj).chain().omitBy(predicate); - } + _.omitBy(obj, predicate); // $ExpectType Partial + _(obj).omitBy(predicate); // $ExpectType LoDashImplicitWrapper> + _.chain(obj).omitBy(predicate); // $ExpectType LoDashExplicitWrapper> + fp.omitBy(predicate, obj); // $ExpectType Partial + fp.omitBy(predicate)(obj); // $ExpectType Partial } // _.pick -namespace TestPick { +{ const obj1: AbcObject | null | undefined = anything; const obj2: AbcObject = anything; - const readonlyArray: string[] = ['a', 'b']; // TODO: Should be ReadonlyArray, but see comment on type Many - const literalsArray = ['a' as 'a', 'b' as 'b']; - const roLiteralsArray: Array<'a' | 'b'> = literalsArray; // TODO: Should be ReadonlyArray, but see comment on type Many + const readonlyArray: string[] = ["a", "b"]; // TODO: Should be ReadonlyArray, but see comment on type Many + const literalsArray = ["a" as "a", "b" as "b"]; + const roLiteralsArray: Array<"a" | "b"> = literalsArray; // TODO: Should be ReadonlyArray, but see comment on type Many - _.pick(obj1, 'a'); // $ExpectType PartialDeep - _.pick(obj1, 0, 'a'); // $ExpectType PartialDeep - _.pick(obj1, ['b', 1], 0, 'a'); // $ExpectType PartialDeep + _.pick(obj1, "a"); // $ExpectType PartialDeep + _.pick(obj1, 0, "a"); // $ExpectType PartialDeep + _.pick(obj1, ["b", 1], 0, "a"); // $ExpectType PartialDeep _.pick(obj1, readonlyArray); // $ExpectType PartialDeep // Broken in TS 2.4 - // _.pick(obj2, 'a', 'b'); // Pick + // _.pick(obj2, "a", "b"); // Pick _.pick(obj2, literalsArray); // $ExpectType Pick _.pick(obj2, roLiteralsArray); // $ExpectType Pick - _(obj1).pick('a'); // $ExpectType LoDashImplicitWrapper> - _(obj1).pick(0, 'a'); // $ExpectType LoDashImplicitWrapper> - _(obj1).pick(['b', 1], 0, 'a'); // $ExpectType LoDashImplicitWrapper> + _(obj1).pick("a"); // $ExpectType LoDashImplicitWrapper> + _(obj1).pick(0, "a"); // $ExpectType LoDashImplicitWrapper> + _(obj1).pick(["b", 1], 0, "a"); // $ExpectType LoDashImplicitWrapper> _(obj1).pick(readonlyArray); // $ExpectType LoDashImplicitWrapper> // Broken in TS 2.4 - // _(obj2).pick('a', 'b'); // LoDashImplicitWrapper> + // _(obj2).pick("a", "b"); // LoDashImplicitWrapper> _(obj2).pick(literalsArray); // $ExpectType LoDashImplicitWrapper> _(obj2).pick(roLiteralsArray); // $ExpectType LoDashImplicitWrapper> - _.chain(obj1).pick('a'); // $ExpectType LoDashExplicitWrapper> - _.chain(obj1).pick(0, 'a'); // $ExpectType LoDashExplicitWrapper> - _.chain(obj1).pick(['b', 1], 0, 'a'); // $ExpectType LoDashExplicitWrapper> + _.chain(obj1).pick("a"); // $ExpectType LoDashExplicitWrapper> + _.chain(obj1).pick(0, "a"); // $ExpectType LoDashExplicitWrapper> + _.chain(obj1).pick(["b", 1], 0, "a"); // $ExpectType LoDashExplicitWrapper> _.chain(obj1).pick(readonlyArray); // $ExpectType LoDashExplicitWrapper> // Broken in TS 2.4 - // _.chain(obj2).pick('a', 'b'); // LoDashExplicitWrapper> + // _.chain(obj2).pick("a", "b"); // LoDashExplicitWrapper> _.chain(obj2).pick(literalsArray); // $ExpectType LoDashExplicitWrapper> _.chain(obj2).pick(roLiteralsArray); // $ExpectType LoDashExplicitWrapper> + + fp.pick("a", obj2); // $ExpectType Pick + fp.pick("a")(obj2); // $ExpectType Pick + fp.pick(["a" as "a", "b" as "b"])(obj2); // $ExpectType Pick } // _.pickBy -namespace TestPickBy { - let obj: AbcObject | null | undefined = anything; - let predicate = (element: any, key: string) => true; +{ + const obj: AbcObject | null | undefined = anything; + const predicate = (element: string | number | boolean, key: string) => true; - { - let result: Partial; - - result = _.pickBy(obj, predicate); - } - - { - let result: _.LoDashImplicitWrapper>; - - result = _(obj).pickBy(predicate); - } - - { - let result: _.LoDashExplicitWrapper>; - - result = _(obj).chain().pickBy(predicate); - } + _.pickBy(obj, predicate); // $ExpectType Partial + _(obj).pickBy(predicate); // $ExpectType LoDashImplicitWrapper> + _.chain(obj).pickBy(predicate); // $ExpectType LoDashExplicitWrapper> + fp.pickBy(predicate, obj); // $ExpectType Partial + fp.pickBy(predicate)(obj); // $ExpectType Partial } // _.result -namespace TestResult { - { - let result: string; +{ + _.result("abc", "0"); // $ExpectType string + _.result("abc", 0, "_"); // $ExpectType string + _.result("abc", "0", () => "_"); // $ExpectType string + _.result("abc", ["0"]); // $ExpectType string + _.result("abc", [0], () => "_"); // $ExpectType string + _.result({ a: () => true }, "a"); // $ExpectType boolean + _("abc").result("0"); // $ExpectType string + _("abc").result(0, "_"); // $ExpectType string + _("abc").result("0", () => "_"); // $ExpectType string + _("abc").result(["0"]); // $ExpectType string + _("abc").result([0], () => "_"); // $ExpectType string + _({ a: () => true }).result("a"); // $ExpectType boolean + _.chain("abc").result("0"); // $ExpectType LoDashExplicitWrapper + _.chain("abc").result(0, "_"); // $ExpectType LoDashExplicitWrapper + _.chain("abc").result("0", () => "_"); // $ExpectType LoDashExplicitWrapper + _.chain("abc").result(["0"]); // $ExpectType LoDashExplicitWrapper + _.chain("abc").result([0], () => "_"); // $ExpectType LoDashExplicitWrapper + _.chain({ a: () => true }).result("a"); // $ExpectType LoDashExplicitWrapper - result = _.result('abc', '0'); - result = _.result('abc', '0', '_'); - result = _.result('abc', '0', () => '_'); - result = _.result('abc', ['0']); - result = _.result('abc', ['0'], '_'); - result = _.result('abc', ['0'], () => '_'); - - result = _('abc').result('0'); - result = _('abc').result('0', '_'); - result = _('abc').result('0', () => '_'); - result = _('abc').result(['0']); - result = _('abc').result(['0'], '_'); - result = _('abc').result(['0'], () => '_'); - } - - { - let result: number; - - result = _.result([42], '0'); - result = _.result([42], '0', -1); - result = _.result([42], '0', () => -1); - result = _.result([42], ['0']); - result = _.result([42], ['0'], -1); - result = _.result([42], ['0'], () => -1); - - result = _([42]).result('0'); - result = _([42]).result('0', -1); - result = _([42]).result('0', () => -1); - result = _([42]).result(['0']); - result = _([42]).result(['0'], -1); - result = _([42]).result(['0'], () => -1); - } - - { - let result: boolean; - - result = _.result({a: true}, 'a'); - result = _.result({a: true}, 'a', false); - result = _.result({a: true}, 'a', () => false); - result = _.result({a: true}, ['a']); - result = _.result({a: true}, ['a'], false); - result = _.result({a: true}, ['a'], () => false); - - result = _({a: true}).result('a'); - result = _({a: true}).result('a', false); - result = _({a: true}).result('a', () => false); - result = _({a: true}).result(['a']); - result = _({a: true}).result(['a'], false); - result = _({a: true}).result(['a'], () => false); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _('abc').chain().result('0'); - result = _('abc').chain().result('0', '_'); - result = _('abc').chain().result('0', '_'); - result = _('abc').chain().result(['0']); - result = _('abc').chain().result(['0'], () => '_'); - result = _('abc').chain().result(['0'], () => '_'); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _([42]).chain().result('0'); - result = _([42]).chain().result('0', -1); - result = _([42]).chain().result('0', () => -1); - result = _([42]).chain().result(['0']); - result = _([42]).chain().result(['0'], -1); - result = _([42]).chain().result(['0'], () => -1); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _({a: true}).chain().result('a'); - result = _({a: true}).chain().result('a', false); - result = _({a: true}).chain().result('a', () => false); - result = _({a: true}).chain().result(['a']); - result = _({a: true}).chain().result(['a'], false); - result = _({a: true}).chain().result(['a'], () => false); - } + fp.result("0", "abc"); // $ExpectType string + fp.result("0")("abc"); // $ExpectType string } // _.set -namespace TestSet { - type SampleObject = {a: {}}; - type SampleResult = {a: {b: number[]}}; - - let object: SampleObject = { a: {} }; - let value = 0; - - { - let result: SampleResult; - - result = _.set(object, 'a.b[1]', value); - result = _.set(object, ['a', 'b', 1], value); - } - - { - let result: _.LoDashImplicitObjectWrapper; - - result = _(object).set('a.b[1]', value); - result = _(object).set(['a', 'b', 1], value); - } - - { - let result: _.LoDashExplicitObjectWrapper; - - result = _(object).chain().set('a.b[1]', value); - result = _(object).chain().set(['a', 'b', 1], value); - } -} - // _.setWith -namespace TestSetWith { - type SampleResult = {a: {b: number[]}}; - - let object: SampleResult = { a: { b: [] } }; - let value = 0; - let customizer = (value: any, key: string, object: SampleResult) => 0; - - { - let result: SampleResult; - - result = _.setWith(object, 'a.b[1]', value); - result = _.setWith(object, 'a.b[1]', value, customizer); - result = _.setWith(object, ['a', 'b', 1], value); - result = _.setWith(object, ['a', 'b', 1], value, customizer); +{ + interface SampleResult { + a: { + b: number[]; + }; } - { - let result: _.LoDashImplicitObjectWrapper; + const object = { a: {} }; - result = _(object).setWith('a.b[1]', value); - result = _(object).setWith('a.b[1]', value, customizer); - result = _(object).setWith(['a', 'b', 1], value); - result = _(object).setWith(['a', 'b', 1], value, customizer); + _.set(object, "a.b[1]", 42); // $ExpectType SampleResult + _.set(object, ["a", "b", 1], 42); // $ExpectType SampleResult + + _(object).set("a.b[1]", 42); // $ExpectType LoDashImplicitWrapper + _(object).set(["a", "b", 1], 42); // $ExpectType LoDashImplicitWrapper + + _.chain(object).set("a.b[1]", 42); // $ExpectType LoDashExplicitWrapper + _.chain(object).set(["a", "b", 1], 42); // $ExpectType LoDashExplicitWrapper + + fp.set("a", 42, object); // $ExpectType { a: {}; } + fp.set("a.b[1]")(42)(object); // $ExpectType { a: {}; } + fp.set(["a", "b", 1])(42)(object); // $ExpectType { a: {}; } +} +{ + interface SampleResult { + a: { + b: number[]; + }; } - { - let result: _.LoDashExplicitObjectWrapper; + const object: SampleResult = { a: { b: [0, 1] } }; + const customizer = (value: any, key: string, object: SampleResult) => 0; - result = _(object).chain().setWith('a.b[1]', value); - result = _(object).chain().setWith('a.b[1]', value, customizer); - result = _(object).chain().setWith(['a', 'b', 1], value); - result = _(object).chain().setWith(['a', 'b', 1], value, customizer); - } + _.setWith(object, "a.b[1]", 42); // $ExpectType SampleResult + _.setWith(object, "a.b[1]", 42, customizer); // $ExpectType SampleResult + _.setWith(object, ["a", "b", 1], 42, customizer); // $ExpectType SampleResult + + _(object).setWith("a.b[1]", 42); // $ExpectType LoDashImplicitWrapper + _(object).setWith("a.b[1]", 42, customizer); // $ExpectType LoDashImplicitWrapper + _(object).setWith(["a", "b", 1], 42, customizer); // $ExpectType LoDashImplicitWrapper + + _.chain(object).setWith("a.b[1]", 42); // $ExpectType LoDashExplicitWrapper + _.chain(object).setWith("a.b[1]", 42, customizer); // $ExpectType LoDashExplicitWrapper + _.chain(object).setWith(["a", "b", 1], 42, customizer); // $ExpectType LoDashExplicitWrapper + + fp.setWith(customizer, "a", 42, object); // $ExpectType SampleResult + fp.setWith(customizer)("a.b[1]")(42)(object); // $ExpectType SampleResult + fp.setWith(customizer)(["a", "b", 1])(42)(object); // $ExpectType SampleResult } // _.toPairs -namespace TestToPairs { - let dictionary: _.Dictionary = {}; - let numericDictionary: _.NumericDictionary = {}; - let abcObject: AbcObject = anything; - - { - _.toPairs(dictionary); // $ExpectType [string, number][] - _.toPairs(numericDictionary); // $ExpectType [string, number][] - _.toPairs(abcObject); // $ExpectType [string, any][] - } - - { - _(dictionary).toPairs(); // $ExpectType LoDashImplicitWrapper<[string, number][]> - _(numericDictionary).toPairs(); // $ExpectType LoDashImplicitWrapper<[string, number][]> - _(abcObject).toPairs(); // $ExpectType LoDashImplicitWrapper<[string, any][]> - } - - { - _(dictionary).chain().toPairs(); // $ExpectType LoDashExplicitWrapper<[string, number][]> - _(numericDictionary).chain().toPairs(); // $ExpectType LoDashExplicitWrapper<[string, number][]> - _(abcObject).chain().toPairs(); // $ExpectType LoDashExplicitWrapper<[string, any][]> - } -} - // _.toPairsIn -namespace TestToPairsIn { - let dictionary: _.Dictionary = {}; - let numericDictionary: _.NumericDictionary = {}; - let abcObject: AbcObject = anything; +{ + const dictionary: _.Dictionary = {}; + const numericDictionary: _.NumericDictionary = {}; + const abcObject: AbcObject = anything; - { - _.toPairsIn(dictionary); // $ExpectType [string, number][] - _.toPairsIn(numericDictionary); // $ExpectType [string, number][] - _.toPairsIn(abcObject); // $ExpectType [string, any][] - } + _.toPairs(dictionary); // $ExpectType [string, number][] + _.toPairs(numericDictionary); // $ExpectType [string, number][] + _.toPairs(abcObject); // $ExpectType [string, any][] - { - _(dictionary).toPairsIn(); // $ExpectType LoDashImplicitWrapper<[string, number][]> - _(numericDictionary).toPairsIn(); // $ExpectType LoDashImplicitWrapper<[string, number][]> - _(abcObject).toPairsIn(); // $ExpectType LoDashImplicitWrapper<[string, any][]> - } + _(dictionary).toPairs(); // $ExpectType LoDashImplicitWrapper<[string, number][]> + _(numericDictionary).toPairs(); // $ExpectType LoDashImplicitWrapper<[string, number][]> + _(abcObject).toPairs(); // $ExpectType LoDashImplicitWrapper<[string, any][]> - { - _(dictionary).chain().toPairsIn(); // $ExpectType LoDashExplicitWrapper<[string, number][]> - _(numericDictionary).chain().toPairsIn(); // $ExpectType LoDashExplicitWrapper<[string, number][]> - _(abcObject).chain().toPairsIn(); // $ExpectType LoDashExplicitWrapper<[string, any][]> - } + _.chain(dictionary).toPairs(); // $ExpectType LoDashExplicitWrapper<[string, number][]> + _.chain(numericDictionary).toPairs(); // $ExpectType LoDashExplicitWrapper<[string, number][]> + _.chain(abcObject).toPairs(); // $ExpectType LoDashExplicitWrapper<[string, any][]> + + fp.toPairs(dictionary); // $ExpectType [string, number][] + + _.toPairsIn(dictionary); // $ExpectType [string, number][] + _.toPairsIn(numericDictionary); // $ExpectType [string, number][] + _.toPairsIn(abcObject); // $ExpectType [string, any][] + + _(dictionary).toPairsIn(); // $ExpectType LoDashImplicitWrapper<[string, number][]> + _(numericDictionary).toPairsIn(); // $ExpectType LoDashImplicitWrapper<[string, number][]> + _(abcObject).toPairsIn(); // $ExpectType LoDashImplicitWrapper<[string, any][]> + + _.chain(dictionary).toPairsIn(); // $ExpectType LoDashExplicitWrapper<[string, number][]> + _.chain(numericDictionary).toPairsIn(); // $ExpectType LoDashExplicitWrapper<[string, number][]> + _.chain(abcObject).toPairsIn(); // $ExpectType LoDashExplicitWrapper<[string, any][]> + + fp.toPairsIn(dictionary); // $ExpectType [string, number][] } // _.transform -namespace TestTransform { - let array: number[] = []; - let dictionary: _.Dictionary = {}; +{ + const array: number[] = []; + const dictionary: _.Dictionary = {}; { - let iterator = (acc: AbcObject[], curr: number, index?: number, arr?: number[]) => {}; - let accumulator: AbcObject[] = []; - let result: AbcObject[]; + const iterator = (acc: AbcObject[], curr: number, index?: number, arr?: number[]) => {}; + const accumulator: AbcObject[] = []; - result = _.transform(array); - result = _.transform(array, iterator); - result = _.transform(array, iterator, accumulator); - - result = _(array).transform().value(); - result = _(array).transform(iterator).value(); - result = _(array).transform(iterator, accumulator).value(); + _.transform(array); // $ExpectType any[] + _.transform(array, iterator); // $ExpectType AbcObject[] + _.transform(array, iterator, accumulator); // $ExpectType AbcObject[] + _(array).transform(); // $ExpectType LoDashImplicitWrapper + _(array).transform(iterator); // $ExpectType LoDashImplicitWrapper + _(array).transform(iterator, accumulator); // $ExpectType LoDashImplicitWrapper + _.chain(array).transform(iterator, accumulator); // $ExpectType LoDashExplicitWrapper } { - let iterator = (acc: _.Dictionary, curr: number, index?: number, arr?: number[]) => {}; - let accumulator: _.Dictionary = {}; - let result: _.Dictionary; + const iterator = (acc: _.Dictionary, curr: number, index?: number, arr?: number[]) => {}; + const accumulator: _.Dictionary = {}; - result = _.transform(array, iterator, accumulator); - - result = _(array).transform(iterator, accumulator).value(); + _.transform(array, iterator, accumulator); // $ExpectType Dictionary + _(array).transform(iterator, accumulator); // $ExpectType LoDashImplicitWrapper> + _.chain(array).transform(iterator, accumulator); // $ExpectType LoDashExplicitWrapper> } { - let iterator = (acc: _.Dictionary, curr: number, key?: string, dict?: _.Dictionary) => {}; - let accumulator: _.Dictionary = {}; - let result: _.Dictionary; + const iterator = (acc: _.Dictionary, curr: number, key?: string, dict?: _.Dictionary) => {}; + const accumulator: _.Dictionary = {}; - result = _.transform(dictionary); - result = _.transform(dictionary, iterator); - result = _.transform(dictionary, iterator, accumulator); - - result = _(dictionary).transform().value(); - result = _(dictionary).transform(iterator).value(); - result = _(dictionary).transform(iterator, accumulator).value(); + _.transform(dictionary); // $ExpectType Dictionary + _.transform(dictionary, iterator); // $ExpectType Dictionary + _.transform(dictionary, iterator, accumulator); // $ExpectType Dictionary + _(dictionary).transform(); // $ExpectType LoDashImplicitWrapper> + _(dictionary).transform(iterator); // $ExpectType LoDashImplicitWrapper> + _(dictionary).transform(iterator, accumulator); // $ExpectType LoDashImplicitWrapper> } { - let iterator = (acc: AbcObject[], curr: number, key?: string, dict?: _.Dictionary) => {}; - let accumulator: AbcObject[] = []; - let result: AbcObject[]; + const iterator = (acc: AbcObject[], curr: number, key?: string, dict?: _.Dictionary) => {}; + const accumulator: AbcObject[] = []; - result = _.transform(dictionary, iterator, accumulator); + _.transform(dictionary, iterator, accumulator); // $ExpectType AbcObject[] + _(dictionary).transform(iterator, accumulator); // $ExpectType LoDashImplicitWrapper + _.chain(dictionary).transform(iterator, accumulator); // $ExpectType LoDashExplicitWrapper + } - result = _(dictionary).transform(iterator, accumulator).value(); + { + const iterator = (acc: AbcObject[], curr: number): AbcObject => anything; + const accumulator: AbcObject[] = []; + + fp.transform(iterator, accumulator, array); // $ExpectType AbcObject[] + fp.transform(iterator)(accumulator)(array); // $ExpectType AbcObject[] + fp.transform(iterator)(accumulator)(dictionary); // $ExpectType AbcObject[] + } + + { + const iterator = (acc: _.Dictionary, curr: number): AbcObject => anything; + const accumulator: _.Dictionary = {}; + + fp.transform(iterator)(accumulator)(array); // $ExpectType Dictionary + fp.transform(iterator)(accumulator)(dictionary); // $ExpectType Dictionary } } // _.unset -namespace TestUnset { - type SampleObject = {a: {b: string; c: boolean}}; +{ + const object = { a: { b: "", c: true } }; - let object: SampleObject = { a: { b: "", c: true } }; - - { - let result: boolean; - - result = _.unset(object, 'a.b'); - result = _.unset(object, ['a', 'b']); - } - - { - let result: _.LoDashImplicitWrapper; - - result = _(object).unset('a.b'); - result = _(object).unset(['a', 'b']); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(object).chain().unset('a.b'); - result = _(object).chain().unset(['a', 'b']); - } + _.unset(object, "a.b"); // $ExpectType boolean + _.unset(object, ["a", "b"]); // $ExpectType boolean + _(object).unset("a.b"); // $ExpectType LoDashImplicitWrapper + _(object).unset(["a", "b"]); // $ExpectType LoDashImplicitWrapper + _.chain(object).unset("a.b"); // $ExpectType LoDashExplicitWrapper + _.chain(object).unset(["a", "b"]); // $ExpectType LoDashExplicitWrapper + fp.unset("a.b", object); // $ExpectType boolean + fp.unset("a.b")(object); // $ExpectType boolean + fp.unset(["a", "b"])(object); // $ExpectType boolean } // _.update -namespace TestUpdate { - type SampleResult = {a: {b: number[]}}; +{ + const object = { a: { b: [0] } }; + const updater = (value: any) => 0; - let object: SampleResult = { a: { b: [] } }; - let updater = (value: any) => 0; - - { - let result: SampleResult; - - result = _.update(object, 'a.b[1]', updater); - result = _.update(object, ['a', 'b', 1], updater); - } - - { - let result: _.LoDashImplicitObjectWrapper; - - result = _(object).update('a.b[1]', updater); - result = _(object).update(['a', 'b', 1], updater); - } - - { - let result: _.LoDashExplicitObjectWrapper; - - result = _(object).chain().update('a.b[1]', updater); - result = _(object).chain().update(['a', 'b', 1], updater); - } + _.update(object, "a.b[1]", updater); // $ExpectType any + _.update(object, ["a", "b", 1], updater); // $ExpectType any + _(object).update("a.b[1]", updater); // $ExpectType LoDashImplicitWrapper + _(object).update(["a", "b", 1], updater); // $ExpectType LoDashImplicitWrapper + _.chain(object).update("a.b[1]", updater); // $ExpectType LoDashExplicitWrapper + _.chain(object).update(["a", "b", 1], updater); // $ExpectType LoDashExplicitWrapper + fp.update("a.b[1]", updater, object); // $ExpectType any + fp.update(["a", "b", 1])(updater)(object); // $ExpectType any } // _.updateWith -namespace TestUpdateWith { - type SampleResult = {a: {b: number[]}}; - - let object: SampleResult = { a: { b: [] } }; - let updater = (value: any) => 0; - let customizer = (value: any, key: string, object: SampleResult) => 0; - - { - let result: SampleResult; - - result = _.updateWith(object, 'a.b[1]', updater); - result = _.updateWith(object, 'a.b[1]', updater, customizer); - result = _.updateWith(object, ['a', 'b', 1], updater); - result = _.updateWith(object, ['a', 'b', 1], updater, customizer); - - result = _.updateWith(object, 'a.b[1]', updater); - result = _.updateWith(object, 'a.b[1]', updater, customizer); - result = _.updateWith(object, ['a', 'b', 1], updater); - result = _.updateWith(object, ['a', 'b', 1], updater, customizer); +{ + interface SampleResult { + a: { + b: number[]; + }; } + const object: SampleResult = { a: { b: [] } }; + const updater = (value: any) => 0; + const customizer = (value: any, key: string, object: SampleResult) => 0; - { - let result: _.LoDashImplicitObjectWrapper; - - result = _(object).updateWith('a.b[1]', updater); - result = _(object).updateWith('a.b[1]', updater, customizer); - result = _(object).updateWith(['a', 'b', 1], updater); - result = _(object).updateWith(['a', 'b', 1], updater, customizer); - } - - { - let result: _.LoDashExplicitObjectWrapper; - - result = _(object).chain().updateWith('a.b[1]', updater); - result = _(object).chain().updateWith('a.b[1]', updater, customizer); - result = _(object).chain().updateWith(['a', 'b', 1], updater); - result = _(object).chain().updateWith(['a', 'b', 1], updater, customizer); - } + _.updateWith(object, "a.b[1]", updater); // $ExpectType SampleResult + _.updateWith(object, "a.b[1]", updater, customizer); // $ExpectType SampleResult + _.updateWith(object, ["a", "b", 1], updater, customizer); // $ExpectType SampleResult + _(object).updateWith("a.b[1]", updater); // $ExpectType LoDashImplicitWrapper + _(object).updateWith("a.b[1]", updater, customizer); // $ExpectType LoDashImplicitWrapper + _(object).updateWith(["a", "b", 1], updater, customizer); // $ExpectType LoDashImplicitWrapper + _.chain(object).updateWith("a.b[1]", updater, customizer); // $ExpectType LoDashExplicitWrapper + fp.updateWith(customizer, "a.b[1]", updater, object); // $ExpectType SampleResult + fp.updateWith(customizer)(["a", "b", 1])(updater)(object); // $ExpectType SampleResult } // _.values -namespace TestValues { - type SampleObject = {a: {}}; +// _.valuesIn +{ + const dict: _.Dictionary = {}; + const numDict: _.NumericDictionary = {}; + const list: _.List | null | undefined = anything; + const object: AbcObject = anything; + + _.values(123); // $ExpectType any[] + _.values(true); // $ExpectType any[] + _.values("hi"); // $ExpectType string[] + _.values(["h", "i"]); // $ExpectType string[] + _.values([true, false]); // $ExpectType boolean[] + _.values(dict); // $ExpectType AbcObject[] + _.values(numDict); // $ExpectType AbcObject[] + _.values(list); // $ExpectType AbcObject[] + _.values(object); // $ExpectType (string | number | boolean)[] + + _(true).values(); // $ExpectType LoDashImplicitWrapper + _("hi").values(); // $ExpectType LoDashImplicitWrapper + _(dict).values(); // $ExpectType LoDashImplicitWrapper + + _.chain(true).values(); // $ExpectType LoDashExplicitWrapper + _.chain("hi").values(); // $ExpectType LoDashExplicitWrapper + _.chain(dict).values(); // $ExpectType LoDashExplicitWrapper + + fp.values("hi"); // $ExpectType string[] + fp.values(["h", "i"]); // $ExpectType string[] + fp.values([true, false]); // $ExpectType boolean[] + fp.values(dict); // $ExpectType AbcObject[] + fp.values(numDict); // $ExpectType AbcObject[] + fp.values(list); // $ExpectType AbcObject[] + fp.values(object); // $ExpectType (string | number | boolean)[] + + _.valuesIn([true, false]); // $ExpectType boolean[] + _.valuesIn(dict); // $ExpectType AbcObject[] + _.valuesIn(numDict); // $ExpectType AbcObject[] + _.valuesIn(list); // $ExpectType AbcObject[] + _.valuesIn(object); // $ExpectType (string | number | boolean)[] + + _(dict).valuesIn(); // $ExpectType LoDashImplicitWrapper + _.chain(dict).valuesIn(); // $ExpectType LoDashExplicitWrapper + + fp.valuesIn(dict); // $ExpectType AbcObject[] + fp.valuesIn(numDict); // $ExpectType AbcObject[] + fp.valuesIn(list); // $ExpectType AbcObject[] + fp.valuesIn(object); // $ExpectType (string | number | boolean)[] +} + +/******* + * Seq * + *******/ + +// _ +{ + _(""); // $ExpectType LoDashImplicitWrapper + _(42); // $ExpectType LoDashImplicitWrapper + _(true); // $ExpectType LoDashImplicitWrapper + _([""]); // $ExpectType LoDashImplicitWrapper + _({ a: "" }); // $ExpectType LoDashImplicitWrapper<{ a: string; }> { - let result: any[]; - - result = _.values(123); - result = _.values(true); - result = _.values(null); + const a: AbcObject[] = []; + _(a); // $ExpectType LoDashImplicitWrapper } { - let result: string[]; - - result = _.values('hi'); - result = _.values(['h', 'i']); - } - - { - let result: number[]; - - result = _.values([1, 2]); - } - - { - let result: boolean[]; - - result = _.values([true, false]); - } - - { - let dict: _.Dictionary = {}; - let numDict: _.NumericDictionary = {}; - let list: _.List = []; - let object: {a: SampleObject} = { a: { a: {} } }; - let result: SampleObject[]; - - result = _.values(dict); - result = _.values(numDict); - result = _.values(list); - result = _.values(object); - } - - // Implicit wrapper - - { - let result: _.LoDashImplicitArrayWrapper; - - result = _(123).values(); - result = _(true).values(); - result = _(null).values(); - } - - { - let result: _.LoDashImplicitArrayWrapper; - - result = _('hi').values(); - result = _(['h', 'i']).values(); - } - - { - let result: _.LoDashImplicitArrayWrapper; - - result = _([1, 2]).values(); - } - - { - let result: _.LoDashImplicitArrayWrapper; - - result = _([true, false]).values(); - } - - { - let dict: _.Dictionary = {}; - let numDict: _.NumericDictionary = {}; - let list: _.List = []; - let object: {a: SampleObject} = { a: { a: {} } }; - let result: _.LoDashImplicitArrayWrapper; - - result = _(dict).values(); - result = _(numDict).values(); - result = _(list).values(); - result = _(object).values(); - } - - // Explicit wrapper - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _(123).chain().values(); - result = _(true).chain().values(); - result = _(null).chain().values(); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _('hi').chain().values(); - result = _(['h', 'i']).chain().values(); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _([1, 2]).chain().values(); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _([true, false]).chain().values(); - } - - { - let dict: _.Dictionary = {}; - let numDict: _.NumericDictionary = {}; - let list: _.List = []; - let object: {a: SampleObject} = { a: { a: {} } }; - let result: _.LoDashExplicitArrayWrapper; - - result = _(dict).chain().values(); - result = _(numDict).chain().values(); - result = _(list).chain().values(); - result = _(object).chain().values(); + const a: AbcObject[] | null | undefined = anything; + _(a); // $ExpectType LoDashImplicitWrapper } } -// _.valuesIn -namespace TestValuesIn { - let object: _.Dictionary = {}; +// _.chain +{ + _.chain(""); // $ExpectType LoDashExplicitWrapper + _("").chain(); // $ExpectType LoDashExplicitWrapper + _.chain("").chain(); // $ExpectType LoDashExplicitWrapper + _.chain(42); // $ExpectType LoDashExplicitWrapper + _.chain([""]); // $ExpectType LoDashExplicitWrapper + _.chain({ a: 42 }); // $ExpectType LoDashExplicitWrapper<{ a: number; }> +} - { - let result: AbcObject[]; +// _.tap +{ + // $ExpectType string + _.tap("a", (value) => { + value; // $ExpectType string + }); + // $ExpectType boolean[] + _.tap([true], (value) => { + value; // $ExpectType boolean[] + }); + // $ExpectType { a: number; } + _.tap({ a: 42 }, (value) => { + value; // $ExpectType { a: number; } + }); - result = _.valuesIn(object); - } + // $ExpectType LoDashImplicitWrapper + _("a").tap((value) => { + value; // $ExpectType string + }); + // $ExpectType LoDashImplicitWrapper + _([true]).tap((value) => { + value; // $ExpectType boolean[] + }); + // $ExpectType LoDashImplicitWrapper<{ a: number; }> + _({ a: 42 }).tap((value) => { + value; // $ExpectType { a: number; } + }); - { - let result: AbcObject[]; + // $ExpectType LoDashExplicitWrapper + _.chain("a").tap((value) => { + value; // $ExpectType string + }); + // $ExpectType LoDashExplicitWrapper + _.chain([true]).tap((value) => { + value; // $ExpectType boolean[] + }); + // $ExpectType LoDashExplicitWrapper<{ a: number; }> + _.chain({ a: 42 }).tap((value) => { + value; // $ExpectType { a: number; } + }); - // Without this type hint, this will fail to compile, as expected. - result = _.valuesIn({}); - } + fp.tap((value: string) => {}, "a" as string); // $ExpectType string + fp.tap((value: string) => {})("a"); // $ExpectType string + fp.tap((value: string[]) => {}, ["a"]); // $ExpectType string[] +} - { - let result: AbcObject[]; +// _.thru +{ + // $ExpectType number + _.thru("a", (value) => { + value; // $ExpectType string + return 1; + }); + // $ExpectType number + _.thru([true], (value) => { + value; // $ExpectType boolean[] + return 1; + }); + // $ExpectType number + _.thru({ a: 42 }, (value) => { + value; // $ExpectType { a: number; } + return 1; + }); - result = _.valuesIn(object); - } + // $ExpectType LoDashImplicitWrapper + _("a").thru((value) => { + value; // $ExpectType string + return 1; + }); + // $ExpectType LoDashImplicitWrapper + _([true]).thru((value) => { + value; // $ExpectType boolean[] + return 1; + }); + // $ExpectType LoDashImplicitWrapper + _({ a: 42 }).thru((value) => { + value; // $ExpectType { a: number; } + return 1; + }); - { - let result: _.LoDashImplicitArrayWrapper; + // $ExpectType LoDashExplicitWrapper + _.chain("a").thru((value) => { + value; // $ExpectType string + return 1; + }); + // $ExpectType LoDashExplicitWrapper + _.chain([true]).thru((value) => { + value; // $ExpectType boolean[] + return 1; + }); + // $ExpectType LoDashExplicitWrapper + _.chain({ a: 42 }).thru((value) => { + value; // $ExpectType { a: number; } + return 1; + }); - result = _(object).valuesIn(); - } + fp.thru((x: number) => x.toString(), 1); // $ExpectType string + fp.thru((x: number) => x.toString())(1); // $ExpectType string + fp.thru((x: number[]) => x.toString())([1]); // $ExpectType string +} - { - let result: _.LoDashExplicitArrayWrapper; +// _.prototype.commit +{ + _(42).commit(); // $ExpectType LoDashImplicitWrapper + _({ a: 42 }).commit(); // $ExpectType LoDashImplicitWrapper<{ a: number; }> + _.chain(42).commit(); // $ExpectType LoDashExplicitWrapper + _.chain({ a: 42 }).commit(); // $ExpectType LoDashExplicitWrapper<{ a: number; }> +} - result = _(object).chain().valuesIn(); - } +// _.prototype.concat +{ + const numberROA: number[] = [0]; // TODO: Should be ReadonlyArray, but see comment on type Many + + _.concat(1); // $ExpectType number[] + _.concat([1]); // $ExpectType number[] + _.concat(numberROA); // $ExpectType number[] + _.concat(1, 2); // $ExpectType number[] + _.concat(1, [1]); // $ExpectType number[] + _.concat(1, [1], numberROA); // $ExpectType number[] + + _(1).concat(2); // $ExpectType LoDashImplicitWrapper + _(1).concat([1]); // $ExpectType LoDashImplicitWrapper + _(1).concat([2], numberROA); // $ExpectType LoDashImplicitWrapper + _([1]).concat(2); // $ExpectType LoDashImplicitWrapper + _(numberROA).concat(numberROA); // $ExpectType LoDashImplicitWrapper + _(numberROA).concat(numberROA, numberROA); // $ExpectType LoDashImplicitWrapper + + _.chain(1).concat(2); // $ExpectType LoDashExplicitWrapper + _.chain(1).concat([1]); // $ExpectType LoDashExplicitWrapper + _.chain(1).concat([2], numberROA); // $ExpectType LoDashExplicitWrapper + _.chain([1]).concat(2); // $ExpectType LoDashExplicitWrapper + _.chain(numberROA).concat(numberROA); // $ExpectType LoDashExplicitWrapper + _.chain(numberROA).concat(numberROA, numberROA); // $ExpectType LoDashExplicitWrapper + + const abcObject: AbcObject = { a: 1, b: 'foo', c: true }; + const objectROA: AbcObject[] = [{ a: 1, b: 'foo', c: true }]; // TODO: Should be ReadonlyArray, but see comment on type Many + + _.concat(abcObject, abcObject); // $ExpectType AbcObject[] + _.concat(abcObject, [abcObject], objectROA); // $ExpectType AbcObject[] + + _(abcObject).concat(abcObject); // $ExpectType LoDashImplicitWrapper + _(abcObject).concat([abcObject], objectROA); // $ExpectType LoDashImplicitWrapper + + _.chain(abcObject).concat(abcObject); // $ExpectType LoDashExplicitWrapper + _.chain(abcObject).concat([abcObject], objectROA); // $ExpectType LoDashExplicitWrapper +} + +// _.prototype.plant +{ + _(anything).plant(""); // $ExpectType LoDashImplicitWrapper + _(anything).plant(42); // $ExpectType LoDashImplicitWrapper + _(anything).plant([""]); // $ExpectType LoDashImplicitWrapper + _(anything).plant({ a: 42 }); // $ExpectType LoDashImplicitWrapper<{ a: number; }> + + _.chain(anything).plant(""); // $ExpectType LoDashExplicitWrapper + _.chain(anything).plant(42); // $ExpectType LoDashExplicitWrapper + _.chain(anything).plant([""]); // $ExpectType LoDashExplicitWrapper + _.chain(anything).plant({ a: 42 }); // $ExpectType LoDashExplicitWrapper<{ a: number; }> +} + +// _.prototype.reverse +{ + _([42]).reverse(); // $ExpectType LoDashImplicitWrapper + _.chain([42]).reverse(); // $ExpectType LoDashExplicitWrapper +} + +// _.prototype.toString +{ + _('').toString(); // $ExpectType string + _(42).toString(); // $ExpectType string + _([true]).toString(); // $ExpectType string + _({}).toString(); // $ExpectType string + + _.chain('').toString(); // $ExpectType string + _.chain(42).toString(); // $ExpectType string + _.chain([true]).toString(); // $ExpectType string + _.chain({}).toString(); // $ExpectType string +} + +// _.prototype.value +// _.prototype.valueOf +// _.prototype.toJSON +{ + _("").value(); // $ExpectType string + _([true]).value(); // $ExpectType boolean[] + _({ a: 42 }).value(); // $ExpectType { a: number; } + _({ a: 42 }).valueOf(); // $ExpectType { a: number; } + _({ a: 42 }).toJSON(); // $ExpectType { a: number; } + + _.chain("").value(); // $ExpectType string + _.chain([true]).value(); // $ExpectType boolean[] + _.chain({ a: 42 }).value(); // $ExpectType { a: number; } + _.chain({ a: 42 }).valueOf(); // $ExpectType { a: number; } + _.chain({ a: 42 }).toJSON(); // $ExpectType { a: number; } } /********** @@ -12675,1650 +6371,824 @@ namespace TestValuesIn { **********/ // _.camelCase -namespace TestCamelCase { - { - let result: string; - - result = _.camelCase('Foo Bar'); - result = _('Foo Bar').camelCase(); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _('Foo Bar').chain().camelCase(); - } +{ + _.camelCase("Foo Bar"); // $ExpectType string + _("Foo Bar").camelCase(); // $ExpectType string + _.chain("Foo Bar").camelCase(); // $ExpectType LoDashExplicitWrapper + fp.camelCase("Foo Bar"); // $ExpectType string } // _.capitalize -namespace TestCapitalize { - { - let result: string; - - result = _.capitalize('fred'); - result = _('fred').capitalize(); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _('fred').chain().capitalize(); - } +{ + _.capitalize("fred"); // $ExpectType string + _("fred").capitalize(); // $ExpectType string + _.chain("fred").capitalize(); // $ExpectType LoDashExplicitWrapper + fp.capitalize("fred"); // $ExpectType string } // _.deburr -namespace TestDeburr { - { - let result: string; - - result = _.deburr('déjà vu'); - result = _('déjà vu').deburr(); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _('déjà vu').chain().deburr(); - } +{ + _.deburr("déjà vu"); // $ExpectType string + _("déjà vu").deburr(); // $ExpectType string + _.chain("déjà vu").deburr(); // $ExpectType LoDashExplicitWrapper + fp.deburr("déjà vu"); // $ExpectType string } // _.endsWith -namespace 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); - } +{ + _.endsWith("abc", "c"); // $ExpectType boolean + _.endsWith("abc", "c", 1); // $ExpectType boolean + _("abc").endsWith("c"); // $ExpectType boolean + _("abc").endsWith("c", 1); // $ExpectType boolean + _.chain("abc").endsWith("c"); // $ExpectType LoDashExplicitWrapper + _.chain("abc").endsWith("c", 1); // $ExpectType LoDashExplicitWrapper + fp.endsWith("c", "abc"); // $ExpectType boolean + fp.endsWith("c")("abc"); // $ExpectType boolean } // _.escape -namespace TestEscape { - { - let result: string; - - result = _.escape('fred, barney, & pebbles'); - result = _('fred, barney, & pebbles').escape(); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _('fred, barney, & pebbles').chain().escape(); - } +{ + _.escape("fred, barney, & pebbles"); // $ExpectType string + _("fred, barney, & pebbles").escape(); // $ExpectType string + _.chain("fred, barney, & pebbles").escape(); // $ExpectType LoDashExplicitWrapper + fp.escape("fred, barney, & pebbles"); // $ExpectType string } // _.escapeRegExp -namespace 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(); - } +{ + _.escapeRegExp("[lodash](https://lodash.com/)"); // $ExpectType string + _("[lodash](https://lodash.com/)").escapeRegExp(); // $ExpectType string + _.chain("[lodash](https://lodash.com/)").escapeRegExp(); // $ExpectType LoDashExplicitWrapper + fp.escapeRegExp("[lodash](https://lodash.com/)"); // $ExpectType string } // _.kebabCase -namespace TestKebabCase { - { - let result: string; - - result = _.kebabCase('Foo Bar'); - result = _('Foo Bar').kebabCase(); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _('Foo Bar').chain().kebabCase(); - } +{ + _.kebabCase("Foo Bar"); // $ExpectType string + _("Foo Bar").kebabCase(); // $ExpectType string + _.chain("Foo Bar").kebabCase(); // $ExpectType LoDashExplicitWrapper + fp.kebabCase("Foo Bar"); // $ExpectType string } // _.lowerCase -namespace TestLowerCase { - { - let result: string; - - result = _.lowerCase('Foo Bar'); - result = _('Foo Bar').lowerCase(); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _('Foo Bar').chain().lowerCase(); - } +{ + _.lowerCase("Foo Bar"); // $ExpectType string + _("Foo Bar").lowerCase(); // $ExpectType string + _.chain("Foo Bar").lowerCase(); // $ExpectType LoDashExplicitWrapper + fp.lowerCase("Foo Bar"); // $ExpectType string } // _.lowerFirst -namespace TestLowerFirst { - { - let result: string; - - result = _.lowerFirst('Foo Bar'); - result = _('Foo Bar').lowerFirst(); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _('Foo Bar').chain().lowerFirst(); - } +{ + _.lowerFirst("Foo Bar"); // $ExpectType string + _("Foo Bar").lowerFirst(); // $ExpectType string + _.chain("Foo Bar").lowerFirst(); // $ExpectType LoDashExplicitWrapper + fp.lowerFirst("Foo Bar"); // $ExpectType string } // _.pad -namespace TestPad { - { - let result: string; - - result = _.pad('abc'); - 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, '_-'); - } +{ + _.pad("abc"); // $ExpectType string + _.pad("abc", 8); // $ExpectType string + _.pad("abc", 8, "_-"); // $ExpectType string + _("abc").pad(); // $ExpectType string + _("abc").pad(8); // $ExpectType string + _("abc").pad(8, "_-"); // $ExpectType string + _.chain("abc").pad(); // $ExpectType LoDashExplicitWrapper + _.chain("abc").pad(8); // $ExpectType LoDashExplicitWrapper + _.chain("abc").pad(8, "_-"); // $ExpectType LoDashExplicitWrapper + fp.pad(8, "abc"); // $ExpectType string + fp.pad(8)("abc"); // $ExpectType string + fp.padChars("_", 8, "abc"); // $ExpectType string + fp.padChars("_")(8)("abc"); // $ExpectType string } // _.padEnd -namespace TestPadEnd { - { - let result: string; - - result = _.padEnd('abc'); - result = _.padEnd('abc', 6); - result = _.padEnd('abc', 6, '_-'); - - result = _('abc').padEnd(); - result = _('abc').padEnd(6); - result = _('abc').padEnd(6, '_-'); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _('abc').chain().padEnd(); - result = _('abc').chain().padEnd(6); - result = _('abc').chain().padEnd(6, '_-'); - } +{ + _.padEnd("abc"); // $ExpectType string + _.padEnd("abc", 6); // $ExpectType string + _.padEnd("abc", 6, "_-"); // $ExpectType string + _("abc").padEnd(); // $ExpectType string + _("abc").padEnd(6); // $ExpectType string + _("abc").padEnd(6, "_-"); // $ExpectType string + _.chain("abc").padEnd(); // $ExpectType LoDashExplicitWrapper + _.chain("abc").padEnd(6); // $ExpectType LoDashExplicitWrapper + _.chain("abc").padEnd(6, "_-"); // $ExpectType LoDashExplicitWrapper + fp.padEnd(8, "abc"); // $ExpectType string + fp.padEnd(8)("abc"); // $ExpectType string + fp.padCharsEnd("_", 8, "abc"); // $ExpectType string + fp.padCharsEnd("_")(8)("abc"); // $ExpectType string } // _.padStart -namespace TestPadStart { - { - let result: string; - - result = _.padStart('abc'); - result = _.padStart('abc', 6); - result = _.padStart('abc', 6, '_-'); - - result = _('abc').padStart(); - result = _('abc').padStart(6); - result = _('abc').padStart(6, '_-'); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _('abc').chain().padStart(); - result = _('abc').chain().padStart(6); - result = _('abc').chain().padStart(6, '_-'); - } +{ + _.padStart("abc"); // $ExpectType string + _.padStart("abc", 6); // $ExpectType string + _.padStart("abc", 6, "_-"); // $ExpectType string + _("abc").padStart(); // $ExpectType string + _("abc").padStart(6); // $ExpectType string + _("abc").padStart(6, "_-"); // $ExpectType string + _.chain("abc").padStart(); // $ExpectType LoDashExplicitWrapper + _.chain("abc").padStart(6); // $ExpectType LoDashExplicitWrapper + _.chain("abc").padStart(6, "_-"); // $ExpectType LoDashExplicitWrapper + fp.padStart(8, "abc"); // $ExpectType string + fp.padStart(8)("abc"); // $ExpectType string + fp.padCharsStart("_", 8, "abc"); // $ExpectType string + fp.padCharsStart("_")(8)("abc"); // $ExpectType string } // _.parseInt -namespace 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); - } +{ + _.parseInt("08"); // $ExpectType number + _.parseInt("08", 10); // $ExpectType number + _("08").parseInt(); // $ExpectType number + _("08").parseInt(10); // $ExpectType number + _.chain("08").parseInt(); // $ExpectType LoDashExplicitWrapper + _.chain("08").parseInt(10); // $ExpectType LoDashExplicitWrapper + fp.parseInt(10, "08"); // $ExpectType number + fp.parseInt(10)("08"); // $ExpectType number } // _.repeat -namespace TestRepeat { - { - let result: string; - result = _.repeat('*'); - result = _.repeat('*', 3); - - result = _('*').repeat(); - result = _('*').repeat(3); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _('*').chain().repeat(); - result = _('*').chain().repeat(3); - } +{ + _.repeat("*"); // $ExpectType string + _.repeat("*", 3); // $ExpectType string + _("*").repeat(); // $ExpectType string + _("*").repeat(3); // $ExpectType string + _.chain("*").repeat(); // $ExpectType LoDashExplicitWrapper + _.chain("*").repeat(3); // $ExpectType LoDashExplicitWrapper + fp.repeat(3, "*"); // $ExpectType string } // _.replace -namespace TestReplace { - let replacer = (match: string, offset: number, string: string) => 'Barney'; +{ + const replacer = (match: string, offset: number, string: string) => "Barney"; - { - let result: string; + _.replace("Hi Fred", "Fred", "Barney"); // $ExpectType string + _.replace("Hi Fred", "Fred", replacer); // $ExpectType string + _.replace("Hi Fred", /fred/i, "Barney"); // $ExpectType string + _.replace("Hi Fred", /fred/i, replacer); // $ExpectType string - result = _.replace('Hi Fred', 'Fred', 'Barney'); - result = _.replace('Hi Fred', 'Fred', replacer); + _("Hi Fred").replace("Fred", "Barney"); // $ExpectType string + _("Hi Fred").replace("Fred", replacer); // $ExpectType string + _("Hi Fred").replace(/fred/i, "Barney"); // $ExpectType string + _("Hi Fred").replace(/fred/i, replacer); // $ExpectType string - result = _.replace('Hi Fred', /fred/i, 'Barney'); - result = _.replace('Hi Fred', /fred/i, replacer); + _.chain("Hi Fred").replace("Fred", "Barney"); // $ExpectType LoDashExplicitWrapper + _.chain("Hi Fred").replace("Fred", replacer); // $ExpectType LoDashExplicitWrapper + _.chain("Hi Fred").replace(/fred/i, "Barney"); // $ExpectType LoDashExplicitWrapper + _.chain("Hi Fred").replace(/fred/i, replacer); // $ExpectType LoDashExplicitWrapper - result = _.replace('Fred', 'Barney'); - result = _.replace('Fred', replacer); - - result = _.replace(/fred/i, 'Barney'); - result = _.replace(/fred/i, replacer); - - result = _('Hi Fred').replace('Fred', 'Barney'); - result = _('Hi Fred').replace('Fred', replacer); - - result = _('Hi Fred').replace(/fred/i, 'Barney'); - result = _('Hi Fred').replace(/fred/i, replacer); - - result = _('Fred').replace('Barney'); - result = _('Fred').replace(replacer); - - result = _(/fred/i).replace('Barney'); - result = _(/fred/i).replace(replacer); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _('Hi Fred').chain().replace('Fred', 'Barney'); - result = _('Hi Fred').chain().replace('Fred', replacer); - - result = _('Hi Fred').chain().replace(/fred/i, 'Barney'); - result = _('Hi Fred').chain().replace(/fred/i, replacer); - - result = _('Fred').chain().replace('Barney'); - result = _('Fred').chain().replace(replacer); - - result = _(/fred/i).chain().replace('Barney'); - result = _(/fred/i).chain().replace(replacer); - } + fp.replace("Fred", "Barney", "Hi Fred"); // $ExpectType string + fp.replace("Fred")("Barney")("Hi Fred"); // $ExpectType string + fp.replace("Fred")(replacer)("Hi Fred"); // $ExpectType string + fp.replace(/fred/i)("Barney")("Hi Fred"); // $ExpectType string + fp.replace(/fred/i)(replacer)("Hi Fred"); // $ExpectType string } // _.snakeCase -namespace TestSnakeCase { - { - let result: string; - - result = _.snakeCase('Foo Bar'); - result = _('Foo Bar').snakeCase(); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _('Foo Bar').chain().snakeCase(); - } +{ + _.snakeCase("Foo Bar"); // $ExpectType string + _("Foo Bar").snakeCase(); // $ExpectType string + _.chain("Foo Bar").snakeCase(); // $ExpectType LoDashExplicitWrapper + fp.snakeCase("Foo Bar"); // $ExpectType string } // _.split -namespace TestSplit { - { - let result: string[]; +{ + _.split("a-b-c"); // $ExpectType string[] + _.split("a-b-c", "-"); // $ExpectType string[] + _.split("a-b-c", "-", 2); // $ExpectType string[] + _("a-b-c").split(); // $ExpectType LoDashImplicitWrapper + _("a-b-c").split("-"); // $ExpectType LoDashImplicitWrapper + _("a-b-c").split("-", 2); // $ExpectType LoDashImplicitWrapper + _.chain("a-b-c").split(); // $ExpectType LoDashExplicitWrapper + _.chain("a-b-c").split("-"); // $ExpectType LoDashExplicitWrapper + _.chain("a-b-c").split("-", 2); // $ExpectType LoDashExplicitWrapper + fp.split("-", "a-b-c"); // $ExpectType string[] + fp.split("-")("a-b-c"); // $ExpectType string[] - result = _.split('a-b-c'); - result = _.split('a-b-c', '-'); - result = _.split('a-b-c', '-', 2); - } - - { - let result: _.LoDashImplicitArrayWrapper; - - result = _('a-b-c').split(); - result = _('a-b-c').split('-'); - result = _('a-b-c').split('-', 2); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _('a-b-c').chain().split(); - result = _('a-b-c').chain().split('-'); - result = _('a-b-c').chain().split('-', 2); - } - - // $ExpectType string[][] - _.map(['abc', 'def'], _.split); + _.map(["abc", "def"], _.split); // $ExpectType string[][] } // _.startCase -namespace TestStartCase { - { - let result: string; - - result = _.startCase('--foo-bar'); - result = _('--foo-bar').startCase(); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _('--foo-bar').chain().startCase(); - } +{ + _.startCase("--foo-bar"); // $ExpectType string + _("--foo-bar").startCase(); // $ExpectType string + _.chain("--foo-bar").startCase(); // $ExpectType LoDashExplicitWrapper + fp.startCase("--foo-bar"); // $ExpectType string } // _.startsWith -namespace 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); - } +{ + _.startsWith("abc", "a"); // $ExpectType boolean + _.startsWith("abc", "a", 1); // $ExpectType boolean + _("abc").startsWith("a"); // $ExpectType boolean + _("abc").startsWith("a", 1); // $ExpectType boolean + _.chain("abc").startsWith("a"); // $ExpectType LoDashExplicitWrapper + _.chain("abc").startsWith("a", 1); // $ExpectType LoDashExplicitWrapper + fp.startsWith("a", "abc"); // $ExpectType boolean + fp.startsWith("a")("abc"); // $ExpectType boolean } // _.template -namespace TestTemplate { - interface TemplateExecutor { - (obj?: object): string; - source: string; - } +{ + const options: _.TemplateOptions = { + escape: / /, + evaluate: / /, + imports: {}, + interpolate: / /, + sourceURL: "", + variable: "a", + }; - let options: { - escape?: RegExp; - evaluate?: RegExp; - imports?: _.Dictionary; - interpolate?: RegExp; - sourceURL?: string; - variable?: string; - } = {}; + const result = _.template(""); + result.source; // $ExpectType string + result({}); // $ExpectType string - { - let result: TemplateExecutor; + _.template(""); // $ExpectType TemplateExecutor + _.template("", options); // $ExpectType TemplateExecutor + _("").template(); // $ExpectType TemplateExecutor + _("").template(options); // $ExpectType TemplateExecutor + _.chain("").template(); // $ExpectType LoDashExplicitWrapper + _.chain("").template(options); // $ExpectType LoDashExplicitWrapper - result = _.template(''); - result = _.template('', options); - - result = _('').template(); - result = _('').template(options); - } - - { - let result: _.LoDashExplicitObjectWrapper; - - result = _('').chain().template(); - result = _('').chain().template(options); - } + const result2 = fp.template(""); + result2(); // $ExpectType string + result2.source; // $ExpectType string } // _.toLower -namespace TestToLower { - { - let result: string; - - result = _.toLower('fred, barney, & pebbles'); - result = _('fred, barney, & pebbles').toLower(); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _('fred, barney, & pebbles').chain().toLower(); - } +{ + _.toLower("fred, barney, & pebbles"); // $ExpectType string + _("fred, barney, & pebbles").toLower(); // $ExpectType string + _.chain("fred, barney, & pebbles").toLower(); // $ExpectType LoDashExplicitWrapper + fp.toLower("fred, barney, & pebbles"); // $ExpectType string } // _.toUpper -namespace TestToUpper { - { - let result: string; - - result = _.toUpper('fred, barney, & pebbles'); - result = _('fred, barney, & pebbles').toUpper(); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _('fred, barney, & pebbles').chain().toUpper(); - } +{ + _.toUpper("fred, barney, & pebbles"); // $ExpectType string + _("fred, barney, & pebbles").toUpper(); // $ExpectType string + _.chain("fred, barney, & pebbles").toUpper(); // $ExpectType LoDashExplicitWrapper + fp.toUpper("fred, barney, & pebbles"); // $ExpectType string } // _.trim -namespace TestTrim { - { - let result: string; +{ + _.trim(); // $ExpectType string + _.trim(" abc "); // $ExpectType string + _.trim("-_-abc-_-", "_-"); // $ExpectType string + _("-_-abc-_-").trim(); // $ExpectType string + _("-_-abc-_-").trim("_-"); // $ExpectType string + _.chain("-_-abc-_-").trim(); // $ExpectType LoDashExplicitWrapper + _.chain("-_-abc-_-").trim("_-"); // $ExpectType LoDashExplicitWrapper + fp.trim(" abc "); // $ExpectType string + fp.trimChars(" ", " abc "); // $ExpectType string + fp.trimChars(" ")(" abc "); // $ExpectType 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('_-'); - } - - // $ExpectType string[] - _.map([' foo ', ' bar '], _.trim); + _.map([" foo ", " bar "], _.trim); // $ExpectType string[] } // _.trimEnd -namespace TestTrimEnd { - { - let result: string; - - result = _.trimEnd(); - result = _.trimEnd(' abc '); - result = _.trimEnd('-_-abc-_-', '_-'); - - result = _('-_-abc-_-').trimEnd(); - result = _('-_-abc-_-').trimEnd('_-'); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _('-_-abc-_-').chain().trimEnd(); - result = _('-_-abc-_-').chain().trimEnd('_-'); - } +{ + _.trimEnd(); // $ExpectType string + _.trimEnd(" abc "); // $ExpectType string + _.trimEnd("-_-abc-_-", "_-"); // $ExpectType string + _("-_-abc-_-").trimEnd(); // $ExpectType string + _("-_-abc-_-").trimEnd("_-"); // $ExpectType string + _.chain("-_-abc-_-").trimEnd(); // $ExpectType LoDashExplicitWrapper + _.chain("-_-abc-_-").trimEnd("_-"); // $ExpectType LoDashExplicitWrapper + fp.trimEnd(" abc "); // $ExpectType string + fp.trimCharsEnd(" ", " abc "); // $ExpectType string + fp.trimCharsEnd(" ")(" abc "); // $ExpectType string } // _.trimStart -namespace TestTrimStart { - { - let result: string; - - result = _.trimStart(); - result = _.trimStart(' abc '); - result = _.trimStart('-_-abc-_-', '_-'); - - result = _('-_-abc-_-').trimStart(); - result = _('-_-abc-_-').trimStart('_-'); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _('-_-abc-_-').chain().trimStart(); - result = _('-_-abc-_-').chain().trimStart('_-'); - } +{ + _.trimStart(); // $ExpectType string + _.trimStart(" abc "); // $ExpectType string + _.trimStart("-_-abc-_-", "_-"); // $ExpectType string + _("-_-abc-_-").trimStart(); // $ExpectType string + _("-_-abc-_-").trimStart("_-"); // $ExpectType string + _.chain("-_-abc-_-").trimStart(); // $ExpectType LoDashExplicitWrapper + _.chain("-_-abc-_-").trimStart("_-"); // $ExpectType LoDashExplicitWrapper + fp.trimStart(" abc "); // $ExpectType string + fp.trimCharsStart(" ", " abc "); // $ExpectType string + fp.trimCharsStart(" ")(" abc "); // $ExpectType string } // _.truncate -namespace TestTruncate { - { - let result: string; +{ + _.truncate("hi-diddly-ho there, neighborino"); // $ExpectType string + _.truncate("hi-diddly-ho there, neighborino", { length: 24, separator: " " }); // $ExpectType string + _.truncate("hi-diddly-ho there, neighborino", { length: 24, separator: /,? +/ }); // $ExpectType string + _.truncate("hi-diddly-ho there, neighborino", { omission: " […]" }); // $ExpectType string - result = _.truncate('hi-diddly-ho there, neighborino'); - 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': ' […]' }); + _("hi-diddly-ho there, neighborino").truncate(); // $ExpectType string + _("hi-diddly-ho there, neighborino").truncate({ length: 24, separator: " " }); // $ExpectType string + _("hi-diddly-ho there, neighborino").truncate({ length: 24, separator: /,? +/ }); // $ExpectType string + _("hi-diddly-ho there, neighborino").truncate({ omission: " […]" }); // $ExpectType string - result = _('hi-diddly-ho there, neighborino').truncate(); - 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': ' […]' }); - } + _.chain("hi-diddly-ho there, neighborino").truncate(); // $ExpectType LoDashExplicitWrapper + _.chain("hi-diddly-ho there, neighborino").truncate({ length: 24, separator: " " }); // $ExpectType LoDashExplicitWrapper + _.chain("hi-diddly-ho there, neighborino").truncate({ length: 24, separator: /,? +/ }); // $ExpectType LoDashExplicitWrapper + _.chain("hi-diddly-ho there, neighborino").truncate({ omission: " […]" }); // $ExpectType LoDashExplicitWrapper - { - let result: _.LoDashExplicitWrapper; - - result = _('hi-diddly-ho there, neighborino').chain().truncate(); - 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': ' […]' }); - } + fp.truncate({ length: 24, separator: " " }, "hi-diddly-ho there, neighborino"); // $ExpectType string + fp.truncate({ length: 24, separator: " " })("hi-diddly-ho there, neighborino"); // $ExpectType string + fp.truncate({ length: 24, separator: /,? +/ }, "hi-diddly-ho there, neighborino"); // $ExpectType string + fp.truncate({ omission: " […]" }, "hi-diddly-ho there, neighborino"); // $ExpectType string } // _.unescape -namespace TestUnescape { - { - let result: string; - - result = _.unescape('fred, barney, & pebbles'); - result = _('fred, barney, & pebbles').unescape(); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _('fred, barney, & pebbles').chain().unescape(); - } +{ + _.unescape("fred, barney, & pebbles"); // $ExpectType string + _("fred, barney, & pebbles").unescape(); // $ExpectType string + _.chain("fred, barney, & pebbles").unescape(); // $ExpectType LoDashExplicitWrapper + fp.unescape("fred, barney, & pebbles"); // $ExpectType string } // _.upperCase -namespace TestUpperCase { - { - let result: string; - - result = _.upperCase('fred, barney, & pebbles'); - result = _('fred, barney, & pebbles').upperCase(); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _('fred, barney, & pebbles').chain().upperCase(); - } +{ + _.upperCase("fred, barney, & pebbles"); // $ExpectType string + _("fred, barney, & pebbles").upperCase(); // $ExpectType string + _.chain("fred, barney, & pebbles").upperCase(); // $ExpectType LoDashExplicitWrapper + fp.upperCase("fred, barney, & pebbles"); // $ExpectType string } // _.upperFirst -namespace TestUpperFirst { - { - let result: string; - - result = _.upperFirst('fred, barney, & pebbles'); - result = _('fred, barney, & pebbles').upperFirst(); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _('fred, barney, & pebbles').chain().upperFirst(); - } +{ + _.upperFirst("fred, barney, & pebbles"); // $ExpectType string + _("fred, barney, & pebbles").upperFirst(); // $ExpectType string + _.chain("fred, barney, & pebbles").upperFirst(); // $ExpectType LoDashExplicitWrapper + fp.upperFirst("fred, barney, & pebbles"); // $ExpectType string } // _.words -namespace TestWords { - { - let result: string[]; +{ + _.words("fred, barney, & pebbles"); // $ExpectType string[] + _.words("fred, barney, & pebbles", /[^, ]+/g); // $ExpectType string[] + _("fred, barney, & pebbles").words(); // $ExpectType string[] + _("fred, barney, & pebbles").words(/[^, ]+/g); // $ExpectType string[] + _.chain("fred, barney, & pebbles").words(); // $ExpectType LoDashExplicitWrapper + _.chain("fred, barney, & pebbles").words(/[^, ]+/g); // $ExpectType LoDashExplicitWrapper + fp.words("fred, barney, & pebbles"); // $ExpectType 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); - } - - // $ExpectType string[][] - _.map(['fred, barney', 'pebbles'], _.words); + _.map(["fred, barney", "pebbles"], _.words); // $ExpectType string[][] } -/*********** - * Utility * - ***********/ +/******** + * Util * + ********/ // _.attempt -namespace TestAttempt { - let func: (...args: any[]) => {a: string} = (...args) => ({ a: "" }); +{ + const func = (...args: any[]): AbcObject => anything; - { - let result: {a: string}|Error; + // We can't use ExpectType here because typescript keeps changing what order the types appear. + let result: Error | AbcObject; + result = _.attempt(func); + result = _.attempt(func, "foo", "bar", "baz"); + result = _(func).attempt(); + result = _(func).attempt("foo", "bar", "baz"); - result = _.attempt<{a: string}>(func); - result = _.attempt<{a: string}>(func, 'foo', 'bar', 'baz'); - result = _(func).attempt<{a: string}>(); - result = _(func).attempt<{a: string}>('foo', 'bar', 'baz'); - } + let explicitResult: _.LoDashExplicitWrapper; + explicitResult = _.chain(func).attempt(); + explicitResult = _.chain(func).attempt("foo", "bar", "baz"); - { - let result: _.LoDashExplicitObjectWrapper<{a: string}|Error>; - - result = _(func).chain().attempt<{a: string}>(); - result = _(func).chain().attempt<{a: string}>('foo', 'bar', 'baz'); - } + result = fp.attempt(func); } // _.cond -namespace TestCond { - let pairPred1: (val: string) => boolean = (val) => true; - let pairPred2: (val: string) => boolean = (val) => false; - let pairRes1: (val: string) => number = (val) => 1; - let pairRes2: (val: string) => number = (val) => 2; +{ + const pairPred1 = (val: string) => true; + const pairPred2 = (val: string) => false; + const pairRes1 = (val: string) => 1; + const pairRes2 = (val: string) => 2; - { - let result: number; - - result = _.cond([[pairPred1, pairRes1],[pairPred2, pairRes2]])('hello'); - } + _.cond([[pairPred1, pairRes1], [pairPred2, pairRes2]])("hello"); // $ExpectType number + fp.cond([[pairPred1, pairRes1], [pairPred2, pairRes2]])("hello"); // $ExpectType number } // _.constant -namespace TestConstant { - { - let result: () => number; - result = _.constant(42); - } +{ + _.constant(42); // $ExpectType () => number + _.constant("a"); // $ExpectType () => string + _.constant([true]); // $ExpectType () => boolean[] + _.constant({ a: "" }); // $ExpectType () => { a: string; } - { - let result: () => string; - result = _.constant('a'); - } + _(42).constant(); // $ExpectType LoDashImplicitWrapper<() => number> + _("a").constant(); // $ExpectType LoDashImplicitWrapper<() => string> + _([true]).constant(); // $ExpectType LoDashImplicitWrapper<() => boolean[]> + _({ a: "" }).constant(); // $ExpectType LoDashImplicitWrapper<() => { a: string; }> - { - let result: () => boolean; - result = _.constant(true); - } + _.chain(42).constant(); // $ExpectType LoDashExplicitWrapper<() => number> + _.chain("a").constant(); // $ExpectType LoDashExplicitWrapper<() => string> + _.chain([true]).constant(); // $ExpectType LoDashExplicitWrapper<() => boolean[]> + _.chain({ a: "" }).constant(); // $ExpectType LoDashExplicitWrapper<() => { a: string; }> - { - 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(); - } - - { - 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(); - } + fp.constant(42); // $ExpectType () => number + fp.constant("a"); // $ExpectType () => string + fp.constant([true]); // $ExpectType () => boolean[] + fp.constant({ a: "" }); // $ExpectType () => { a: string; } } // _.defaultTo -namespace TestDefaultTo { - { - let result: number; - result = _.defaultTo(42, 42); - result = _.defaultTo(undefined, 42); - result = _.defaultTo(null, 42); - result = _.defaultTo(NaN, 42); - } +{ + _.defaultTo(42, 42); // $ExpectType 42 + _.defaultTo(undefined, 42); // $ExpectType 42 + _.defaultTo(null, 42); // $ExpectType 42 + _.defaultTo(NaN, 42); // $ExpectType number + _.defaultTo(undefined, "default"); // $ExpectType "default" + _.defaultTo(undefined, [true]); // $ExpectType boolean[] + _.defaultTo(undefined, { a: "" }); // $ExpectType { a: string; } - { - let result: string; - result = _.defaultTo('a', 'default'); - result = _.defaultTo(undefined, 'default'); - result = _.defaultTo(null, 'default'); - } + _(42).defaultTo(42); // $ExpectType number + _(undefined).defaultTo(42); // $ExpectType 42 + _(null).defaultTo(42); // $ExpectType 42 + _(NaN).defaultTo(42); // $ExpectType number + _(undefined).defaultTo("default"); // $ExpectType "default" + _(undefined).defaultTo([true]); // $ExpectType boolean[] + _(undefined).defaultTo({ a: "" }); // $ExpectType { a: string; } - { - let result: boolean; - result = _.defaultTo(true, true); - result = _.defaultTo(undefined, true); - result = _.defaultTo(null, true); - } + _.chain(42).defaultTo(42); // $ExpectType LoDashExplicitWrapper + _.chain(undefined).defaultTo(42); // $ExpectType LoDashExplicitWrapper<42> + _.chain(null).defaultTo(42); // $ExpectType LoDashExplicitWrapper<42> + _.chain(NaN).defaultTo(42); // $ExpectType LoDashExplicitWrapper + _.chain(undefined).defaultTo("default"); // $ExpectType LoDashExplicitWrapper<"default"> + _.chain(undefined).defaultTo([true]); // $ExpectType LoDashExplicitWrapper + _.chain(undefined).defaultTo({ a: "" }); // $ExpectType LoDashExplicitWrapper<{ a: string; }> - { - let result: string[]; - result = _.defaultTo(['a'], ['default']); - result = _.defaultTo(undefined, ['default']); - result = _.defaultTo(null, ['default']); - } + const n: number = anything; + fp.defaultTo(42, n); // $ExpectType number + fp.defaultTo(42)(n); // $ExpectType number + fp.defaultTo(42)(undefined); // $ExpectType number + fp.defaultTo(42)(null); // $ExpectType number + fp.defaultTo(42)(NaN); // $ExpectType number - { - let result: {a: string}; - result = _.defaultTo<{a: string}>({a: 'a'}, {a: 'a'}); - result = _.defaultTo<{a: string}>(undefined, {a: 'a'}); - result = _.defaultTo<{a: string}>(null, {a: 'a'}); - } - - { - let result: number; - result = _(42).defaultTo(42); - result = _(undefined).defaultTo(42); - result = _(null).defaultTo(42); - result = _(NaN).defaultTo(42); - } - - { - let result: string; - result = _('a').defaultTo('default'); - result = _(null).defaultTo('default'); - } - - { - let result: boolean; - result = _(true).defaultTo(true); - result = _(undefined).defaultTo(true); - result = _(null).defaultTo(true); - } - - { - let result: string[]; - result = _(['a']).defaultTo(['default']); - result = _(undefined).defaultTo(['default']); - result = _(null).defaultTo(['default']); - } - - { - let result: { a: string }; - result = _({ a: 'a' }).defaultTo({a : 'a'}); - result = _(undefined).defaultTo({a : 'a'}); - result = _(null).defaultTo({a : 'a'}); - } - - { - let result: _.LoDashExplicitObjectWrapper; - result = _(42).chain().defaultTo(42); - result = _(undefined).chain().defaultTo(42); - result = _(null).chain().defaultTo(42); - result = _(NaN).chain().defaultTo(42); - } - - { - let result: _.LoDashExplicitObjectWrapper; - result = _('a').chain().defaultTo('default'); - result = _(undefined).chain().defaultTo('default'); - result = _(null).chain().defaultTo('default'); - } - - { - let result: _.LoDashExplicitObjectWrapper; - result = _(true).chain().defaultTo(true); - result = _(undefined).chain().defaultTo(true); - result = _(null).chain().defaultTo(true); - } - - { - let result: _.LoDashExplicitObjectWrapper; - result = _(['a']).chain().defaultTo(['default']); - result = _(undefined).chain().defaultTo(['default']); - result = _(null).chain().defaultTo(['default']); - } - - { - let result: _.LoDashExplicitObjectWrapper<{ a: string }>; - result = _({ a: 'a' }).chain().defaultTo({a : 'a'}); - result = _(undefined).chain().defaultTo({a : 'a'}); - result = _(null).chain().defaultTo({a : 'a'}); - } + const arr: boolean[] | undefined = anything; + const result: boolean[] | "a" = fp.defaultTo("a", arr); } // _.identity -namespace TestIdentity { - { - let result: number; - - result = _.identity(42); - result = _(42).identity(); - } - - { - let result: number[]; - - result = _.identity([42]); - result = _([42]).identity(); - } - - { - let result: {a: number}; - - result = _.identity({a: 42}); - result = _({a: 42}).identity(); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(42).chain().identity(); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _([42]).chain().identity(); - } - - { - let result: _.LoDashExplicitObjectWrapper<{a: number}>; - - result = _({a: 42}).chain().identity(); - } - - { - let input: { a: number; } | null | undefined = anything; - _.identity(input); // $ExpectType { a: number; } | null | undefined - _.identity(); // $ExpectType undefined - } +{ + _.identity(42); // $ExpectType 42 + _.identity([""]); // $ExpectType string[] + _.identity({ a: true }); // $ExpectType { a: boolean; } + _(42).identity(); // $ExpectType number + _([""]).identity(); // $ExpectType string[] + _({ a: true }).identity(); // $ExpectType { a: boolean; } + _.chain(42).identity(); // $ExpectType LoDashExplicitWrapper + _.chain([""]).identity(); // $ExpectType LoDashExplicitWrapper + _.chain({ a: true }).identity(); // $ExpectType LoDashExplicitWrapper<{ a: boolean; }> + fp.identity(42); // $ExpectType 42 + fp.identity([""]); // $ExpectType string[] + fp.identity({ a: true }); // $ExpectType { a: boolean; } } // _.iteratee -namespace TestIteratee { - { - _.iteratee((...args: any[]): AbcObject => anything); // $ExpectType (...args: any[]) => AbcObject - _.iteratee((a: AbcObject): boolean => anything); // $ExpectType (a: AbcObject) => boolean - _.iteratee((a: AbcObject | undefined): a is undefined => anything); // $ExpectType (a: AbcObject | undefined) => a is undefined - } +{ + _.iteratee((a: AbcObject): boolean => anything); // $ExpectType (a: AbcObject) => boolean + _.iteratee((...args: any[]): AbcObject => anything); // $ExpectType (...args: any[]) => AbcObject + _.iteratee("a"); // $ExpectType (...args: any[]) => any + _.iteratee({ a: 42 }); // $ExpectType (...args: any[]) => any + _.iteratee(["a", 42]); // $ExpectType (...args: any[]) => any - { - let result: (object: any) => AbcObject; + _((a: AbcObject): boolean => anything).iteratee(); // $ExpectType LoDashImplicitWrapper<(a: AbcObject) => boolean> + _("a").iteratee(); // $ExpectType LoDashImplicitWrapper<(...args: any[]) => any> + _({ a: 42 }).iteratee(); // $ExpectType LoDashImplicitWrapper<(...args: any[]) => any> + _(["a", 42]).iteratee(); // $ExpectType LoDashImplicitWrapper<(...args: any[]) => any> - result = _.iteratee(''); - } + _.chain((a: AbcObject): boolean => anything).iteratee(); // $ExpectType LoDashExplicitWrapper<(a: AbcObject) => boolean> + _.chain("a").iteratee(); // $ExpectType LoDashExplicitWrapper<(...args: any[]) => any> + _.chain({ a: 42 }).iteratee(); // $ExpectType LoDashExplicitWrapper<(...args: any[]) => any> + _.chain(["a", 42]).iteratee(); // $ExpectType LoDashExplicitWrapper<(...args: any[]) => any> - { - let result: (object: any) => boolean; - - result = _.iteratee({}); - } - - { - let result: _.LoDashImplicitObjectWrapper<(...args: any[]) => AbcObject>; - - let func: (...args: any[]) => AbcObject = anything; - result = _(func).iteratee(); - } - - { - let result: _.LoDashImplicitObjectWrapper<(object: any) => AbcObject>; - - result = _('').iteratee(); - } - - { - let result: _.LoDashImplicitObjectWrapper<(object: any) => boolean>; - - result = _({}).iteratee(); - } - - { - let result: _.LoDashExplicitObjectWrapper<(...args: any[]) => AbcObject>; - - let func: (...args: any[]) => AbcObject = anything; - result = _(func).chain().iteratee(); - } - - { - let result: _.LoDashExplicitObjectWrapper<(object: any) => AbcObject>; - - result = _('').chain().iteratee(); - } - - { - let result: _.LoDashExplicitObjectWrapper<(object: any) => boolean>; - - result = _({}).chain().iteratee(); - } + fp.iteratee((a: AbcObject): boolean => anything); // $ExpectType (a: AbcObject) => boolean + fp.iteratee((...args: any[]): AbcObject => anything); // $ExpectType (...args: any[]) => AbcObject + fp.iteratee(""); // $ExpectType (...args: any[]) => any + fp.iteratee({ a: 42 }); // $ExpectType (...args: any[]) => any + fp.iteratee(["a", 42]); // $ExpectType (...args: any[]) => any } // _.matches -namespace TestMatches { - let source: AbcObject = { a: 1, b: "", c: true }; +{ + const source: AbcObject = { a: 1, b: "", c: true }; - { - let result: (value: any) => boolean; - result = _.matches(source); - } + _.matches(source); // $ExpectType (value: any) => boolean + _.matches(source); // $ExpectType (value: AbcObject) => boolean + _(source).matches(); // $ExpectType LoDashImplicitWrapper<(value: AbcObject) => boolean> + _.chain(source).matches(); // $ExpectType LoDashExplicitWrapper<(value: AbcObject) => boolean> - { - let result: (value: AbcObject) => boolean; - result = _.matches(source); - } - - { - let result: _.LoDashImplicitObjectWrapper<(value: AbcObject) => boolean>; - result = _(source).matches(); - } - - { - let result: _.LoDashExplicitObjectWrapper<(value: AbcObject) => boolean>; - result = _(source).chain().matches(); - } + fp.matches(source, {}); // $ExpectType boolean + fp.matches(source)({}); // $ExpectType boolean } // _.matchesProperty { - let path: string | string[] = []; - let source: AbcObject = { a: 1, b: "", c: true }; + const path: string | string[] = anything; + const source: AbcObject = { a: 1, b: "", c: true }; - { - let result: (value: any) => boolean; - - result = _.matchesProperty(path, source); - } - - { - let result: (value: AbcObject) => boolean; - - result = _.matchesProperty(path, source); - } - - { - let result: _.LoDashImplicitObjectWrapper<(value: any) => boolean>; - - result = _(path).matchesProperty(source); - } - - { - let result: _.LoDashImplicitObjectWrapper<(value: AbcObject) => boolean>; - - result = _(path).matchesProperty(source); - } - - { - let result: _.LoDashExplicitObjectWrapper<(value: any) => boolean>; - - result = _(path).chain().matchesProperty(source); - } - - { - let result: _.LoDashExplicitObjectWrapper<(value: AbcObject) => boolean>; - - result = _(path).chain().matchesProperty(source); - } + _.matchesProperty(path, source); // $ExpectType (value: any) => boolean + _.matchesProperty(path, source); // $ExpectType (value: AbcObject) => boolean + _(path).matchesProperty(source); // $ExpectType LoDashImplicitWrapper<(value: any) => boolean> + _(path).matchesProperty(source); + _.chain(path).matchesProperty(source); // $ExpectType LoDashExplicitWrapper<(value: any) => boolean> + fp.matchesProperty(path, source); // $ExpectType (value: any) => boolean } // _.method -namespace TestMethod { - { - let result: (object: any) => {a: string}; +{ + _.method("a.0"); // $ExpectType (object: any) => any + _.method("a.0", anything, anything, anything); // $ExpectType (object: any) => any + _.method(["a", 0]); // $ExpectType (object: any) => any + _.method(["a", 0], anything, anything, anything); // $ExpectType (object: any) => any - result = _.method('a.0'); - result = _.method('a.0', anything, anything); - result = _.method('a.0', anything, anything, anything); + _("a.0").method(); // $ExpectType LoDashImplicitWrapper<(object: any) => any> + _("a.0").method(anything, anything, anything); // $ExpectType LoDashImplicitWrapper<(object: any) => any> + _(["a", 0]).method(); // $ExpectType LoDashImplicitWrapper<(object: any) => any> + _(["a", 0]).method(anything, anything, anything); // $ExpectType LoDashImplicitWrapper<(object: any) => any> - result = _.method(['a', 0]); - result = _.method(['a', 0], anything); - result = _.method(['a', 0], anything, anything); - result = _.method(['a', 0], anything, anything, anything); - } + _.chain("a.0").method(); // $ExpectType LoDashExplicitWrapper<(object: any) => any> + _.chain("a.0").method(anything, anything, anything); // $ExpectType LoDashExplicitWrapper<(object: any) => any> + _.chain(["a", 0]).method(); // $ExpectType LoDashExplicitWrapper<(object: any) => any> + _.chain(["a", 0]).method(anything, anything, anything); // $ExpectType LoDashExplicitWrapper<(object: any) => any> - { - let result: (object: {a: string}) => {b: string}; - - result = _.method('a.0'); - result = _.method('a.0', anything, anything); - result = _.method('a.0', anything, anything, anything); - - result = _.method(['a', 0]); - result = _.method(['a', 0], anything); - result = _.method(['a', 0], anything, anything); - result = _.method(['a', 0], anything, anything, anything); - } - - { - let result: _.LoDashImplicitObjectWrapper<(object: any) => {a: string}>; - - result = _('a.0').method(); - result = _('a.0').method(anything); - result = _('a.0').method(anything, anything); - result = _('a.0').method(anything, anything, anything); - - result = _(['a', 0]).method(); - result = _(['a', 0]).method(anything); - result = _(['a', 0]).method(anything, anything); - result = _(['a', 0]).method(anything, anything, anything); - } - - { - let result: _.LoDashImplicitObjectWrapper<(object: {a: string}) => {b: string}>; - - result = _('a.0').method(); - result = _('a.0').method(anything); - result = _('a.0').method(anything, anything); - result = _('a.0').method(anything, anything, anything); - - result = _(['a', 0]).method(); - result = _(['a', 0]).method(anything); - result = _(['a', 0]).method(anything, anything); - result = _(['a', 0]).method(anything, anything, anything); - } - - { - let result: _.LoDashExplicitObjectWrapper<(object: any) => {a: string}>; - - result = _('a.0').chain().method(); - result = _('a.0').chain().method(anything); - result = _('a.0').chain().method(anything, anything); - result = _('a.0').chain().method(anything, anything, anything); - - result = _(['a', 0]).chain().method(); - result = _(['a', 0]).chain().method(anything); - result = _(['a', 0]).chain().method(anything, anything); - result = _(['a', 0]).chain().method(anything, anything, anything); - } - - { - let result: _.LoDashExplicitObjectWrapper<(object: {a: string}) => {b: string}>; - - result = _('a.0').chain().method(); - result = _('a.0').chain().method(anything); - result = _('a.0').chain().method(anything, anything); - result = _('a.0').chain().method(anything, anything, anything); - - result = _(['a', 0]).chain().method(); - result = _(['a', 0]).chain().method(anything); - result = _(['a', 0]).chain().method(anything, anything); - result = _(['a', 0]).chain().method(anything, anything, anything); - } + fp.method("a.0"); // $ExpectType (object: any) => any + fp.method(["a", 0]); // $ExpectType (object: any) => any + fp.method(Symbol.replace); // $ExpectType (object: any) => any } // _.methodOf -namespace TestMethodOf { - type SampleObject = { a: Array<{ b(): AbcObject }> }; - type ResultFn = (path: string | string[]) => AbcObject; +{ + const object: AbcObject = anything; - let object: SampleObject = { a: [] }; - - { - let result: ResultFn; - - result = _.methodOf(object); - result = _.methodOf(object, anything); - result = _.methodOf(object, anything, anything); - result = _.methodOf(object, anything, anything, anything); - } - - { - let result: _.LoDashImplicitObjectWrapper; - - result = _(object).methodOf(); - result = _(object).methodOf(anything); - result = _(object).methodOf(anything, anything); - result = _(object).methodOf(anything, anything, anything); - } - - { - let result: _.LoDashExplicitObjectWrapper; - - result = _(object).chain().methodOf(); - result = _(object).chain().methodOf(anything); - result = _(object).chain().methodOf(anything, anything); - result = _(object).chain().methodOf(anything, anything, anything); - } + _.methodOf(object); // $ExpectType (path: Many) => any + _.methodOf(object, anything, anything, anything); // $ExpectType (path: Many) => any + _(object).methodOf(); // $ExpectType LoDashImplicitWrapper<(path: Many) => any> + _(object).methodOf(anything, anything, anything); // $ExpectType LoDashImplicitWrapper<(path: Many) => any> + _.chain(object).methodOf(); // $ExpectType LoDashExplicitWrapper<(path: Many) => any> + _.chain(object).methodOf(anything, anything, anything); // $ExpectType LoDashExplicitWrapper<(path: Many) => any> + fp.methodOf(object); // $ExpectType (path: Many) => any } // _.mixin -namespace TestMixin { - let source: _.Dictionary<(...args: any[]) => any> = {}; - let dest: AbcObject = anything; - let options: {chain?: boolean} = {}; +{ + const source: _.Dictionary<(...args: any[]) => any> = {}; + const dest: AbcObject = anything; + const options: {chain?: boolean} = {}; - { - let result: _.LoDashStatic; + _.mixin(source); // $ExpectType LoDashStatic + _.mixin(source, options); // $ExpectType LoDashStatic + _.mixin(dest, source); // $ExpectType AbcObject + _.mixin(dest, source, options); // $ExpectType AbcObject - result = _.mixin(source); - result = _.mixin(source, options); - } + _(source).mixin(); // $ExpectType LoDashImplicitWrapper + _(source).mixin(options); // $ExpectType LoDashImplicitWrapper + _(dest).mixin(source); // $ExpectType LoDashImplicitWrapper + _(dest).mixin(source, options); // $ExpectType LoDashImplicitWrapper - { - let result: AbcObject; - - result = _.mixin(dest, source); - result = _.mixin(dest, source, options); - } - - { - let result: _.LoDashImplicitWrapper<_.LoDashStatic>; - - result = _(source).mixin(); - result = _(source).mixin(options); - } - - { - let result: _.LoDashImplicitWrapper; - - result = _(dest).mixin(source); - result = _(dest).mixin(source, options); - } - - { - let result: _.LoDashExplicitWrapper<_.LoDashStatic>; - - result = _(source).chain().mixin(); - result = _(source).chain().mixin(options); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(dest).chain().mixin(source); - result = _(dest).chain().mixin(source, options); - } + _.chain(source).mixin(); // $ExpectType LoDashExplicitWrapper + _.chain(source).mixin(options); // $ExpectType LoDashExplicitWrapper + _.chain(dest).mixin(source); // $ExpectType LoDashExplicitWrapper + _.chain(dest).mixin(source, options); // $ExpectType LoDashExplicitWrapper } // _.noConflict -namespace TestNoConflict { - { - let result: typeof _; - - result = _.noConflict(); - result = _(42).noConflict(); - result = _([]).noConflict(); - result = _({}).noConflict(); - } - - { - let result: _.LoDashExplicitObjectWrapper; - - result = _(42).chain().noConflict(); - result = _([]).chain().noConflict(); - result = _({}).chain().noConflict(); - } +{ + _.noConflict(); // $ExpectType LoDashStatic + _(42).noConflict(); // $ExpectType LoDashStatic + _.chain(42).noConflict(); // $ExpectType LoDashExplicitWrapper + fp.noConflict(); // $ExpectType LoDashStatic } // _.noop -namespace TestNoop { - { - let result: void; // tslint:disable-line:void-return +{ + _.noop(); // $ExpectType void + _.noop(1); // $ExpectType void + _.noop(true, "a", 1); // $ExpectType void + _("a").noop(true, "a", 1); // $ExpectType void + _.chain("a").noop(true, "a", 1); // $ExpectType LoDashExplicitWrapper - 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 = _(anything).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 = _(anything).chain().noop(true, 'a', 1); - } + fp.noop(); // $ExpectType void + fp.noop(1); // $ExpectType void + fp.noop(true, "a", 1); // $ExpectType void } -namespace TestNthArg { - type SampleFunc = (...args: any[]) => any; - - { - let result: SampleFunc; - - result = _.nthArg(); - result = _.nthArg(1); - } - - { - let result: _.LoDashImplicitObjectWrapper; - - result = _(1).nthArg(); - } - - { - let result: _.LoDashExplicitObjectWrapper; - - result = _(1).chain().nthArg(); - } +{ + _.nthArg(); // $ExpectType (...args: any[]) => any + _.nthArg(1); // $ExpectType (...args: any[]) => any + _(1).nthArg(); // $ExpectType LoDashImplicitWrapper<(...args: any[]) => any> + _.chain(1).nthArg(); // $ExpectType LoDashExplicitWrapper<(...args: any[]) => any> + fp.nthArg(1); // $ExpectType (...args: any[]) => any } // _.over -namespace TestOver { - { - let result: (...args: any[]) => number[]; +{ + _.over(Math.max); // $ExpectType (...args: any[]) => number[] + _.over(Math.max, Math.min); // $ExpectType (...args: any[]) => number[] + _.over([Math.max]); // $ExpectType (...args: any[]) => number[] + _.over([Math.max], [Math.min]); // $ExpectType (...args: any[]) => number[] - result = _.over(Math.max); - result = _.over(Math.max, Math.min); - result = _.over([Math.max]); - result = _.over([Math.max], [Math.min]); - } + _(Math.max).over(); // $ExpectType LoDashImplicitWrapper<(...args: any[]) => number[]> + _(Math.max).over(Math.min); // $ExpectType LoDashImplicitWrapper<(...args: any[]) => number[]> + _([Math.max]).over(); // $ExpectType LoDashImplicitWrapper<(...args: any[]) => number[]> + _([Math.max]).over([Math.min]); // $ExpectType LoDashImplicitWrapper<(...args: any[]) => number[]> - { - let result: _.LoDashImplicitObjectWrapper<(...args: any[]) => number[]>; + _.chain(Math.max).over(); // $ExpectType LoDashExplicitWrapper<(...args: any[]) => number[]> + _.chain(Math.max).over(Math.min); // $ExpectType LoDashExplicitWrapper<(...args: any[]) => number[]> + _.chain([Math.max]).over(); // $ExpectType LoDashExplicitWrapper<(...args: any[]) => number[]> + _.chain([Math.max]).over([Math.min]); // $ExpectType LoDashExplicitWrapper<(...args: any[]) => number[]> - result = _(Math.max).over(); - result = _(Math.max).over(Math.min); - result = _([Math.max]).over(); - result = _([Math.max]).over([Math.min]); - } - - { - let result: _.LoDashExplicitObjectWrapper<(...args: any[]) => number[]>; - - result = _(Math.max).chain().over(); - result = _(Math.max).chain().over(Math.min); - result = _([Math.max]).chain().over(); - result = _([Math.max]).chain().over([Math.min]); - } + fp.over(Math.max); // $ExpectType (...args: any[]) => number[] + fp.over([Math.max, Math.min]); // $ExpectType (...args: any[]) => number[] } // _.overEvery -namespace TestOverEvery { - { - let result: (...args: number[]) => boolean; - - result = _.overEvery((number) => true); - result = _.overEvery((number) => true, (number) => true); - result = _.overEvery([(number) => true]); - result = _.overEvery([(number) => true], [(number) => true]); - } - - { - let result: _.LoDashImplicitObjectWrapper<(...args: number[]) => boolean>; - - result = _(Math.max).overEvery(); - result = _(Math.max).overEvery((number) => true); - result = _([Math.max]).overEvery(); - result = _([Math.max]).overEvery([(number) => true]); - } - - { - let result: _.LoDashExplicitObjectWrapper<(...args: number[]) => boolean>; - - result = _(Math.max).chain().overEvery(); - result = _(Math.max).chain().overEvery((number) => true); - result = _([Math.max]).chain().overEvery(); - result = _([Math.max]).chain().overEvery([(number) => true]); - } -} - // _.overSome -namespace TestOverSome { - { - let result: (...args: number[]) => boolean; +{ + _.overEvery((number: number) => true); // $ExpectType (...args: number[]) => boolean + _.overEvery((number: number) => true, (number: number) => true); // $ExpectType (...args: number[]) => boolean + _.overEvery([(number: number) => true]); // $ExpectType (...args: number[]) => boolean + _.overEvery([(number: number) => true], [(number: number) => true]); // $ExpectType (...args: number[]) => boolean - result = _.overSome((n: number) => true); - result = _.overSome((n: number) => true, (n: number) => true); - result = _.overSome([(n: number) => true]); - result = _.overSome([(n: number) => true], [(n: number) => true]); - } + _(Math.max).overEvery(); // $ExpectType LoDashImplicitWrapper<(...args: number[]) => boolean> + _(Math.max).overEvery((number: number) => true); // $ExpectType LoDashImplicitWrapper<(...args: number[]) => boolean> + _([Math.max]).overEvery([(number: number) => true]); // $ExpectType LoDashImplicitWrapper<(...args: number[]) => boolean> - { - let result: _.LoDashImplicitObjectWrapper<(...args: number[]) => boolean>; + _.chain(Math.max).overEvery(); // $ExpectType LoDashExplicitWrapper<(...args: number[]) => boolean> + _.chain(Math.max).overEvery((number: number) => true); // $ExpectType LoDashExplicitWrapper<(...args: number[]) => boolean> + _.chain([Math.max]).overEvery([(number: number) => true]); // $ExpectType LoDashExplicitWrapper<(...args: number[]) => boolean> - result = _(Math.max).overSome(); - result = _(Math.max).overSome((n: number) => true); - result = _([Math.max]).overSome(); - result = _([Math.max]).overSome([(n: number) => true]); - } + fp.overEvery((number: number) => true); // $ExpectType (...args: number[]) => boolean + fp.overEvery([(number: number) => true, (number: number) => true]); // $ExpectType (...args: number[]) => boolean - { - let result: _.LoDashExplicitObjectWrapper<(...args: number[]) => boolean>; + _.overSome((number: number) => true); // $ExpectType (...args: number[]) => boolean + _.overSome((number: number) => true, (number: number) => true); // $ExpectType (...args: number[]) => boolean + _.overSome([(number: number) => true]); // $ExpectType (...args: number[]) => boolean + _.overSome([(number: number) => true], [(number: number) => true]); // $ExpectType (...args: number[]) => boolean - result = _(Math.max).chain().overSome(); - result = _(Math.max).chain().overSome((n: number) => true); - result = _([Math.max]).chain().overSome(); - result = _([Math.max]).chain().overSome([(n: number) => true]); - } + _(Math.max).overSome(); // $ExpectType LoDashImplicitWrapper<(...args: number[]) => boolean> + _(Math.max).overSome((number: number) => true); // $ExpectType LoDashImplicitWrapper<(...args: number[]) => boolean> + _([Math.max]).overSome([(number: number) => true]); // $ExpectType LoDashImplicitWrapper<(...args: number[]) => boolean> + + _.chain(Math.max).overSome(); // $ExpectType LoDashExplicitWrapper<(...args: number[]) => boolean> + _.chain(Math.max).overSome((number: number) => true); // $ExpectType LoDashExplicitWrapper<(...args: number[]) => boolean> + _.chain([Math.max]).overSome([(number: number) => true]); // $ExpectType LoDashExplicitWrapper<(...args: number[]) => boolean> + + fp.overSome((number: number) => true); // $ExpectType (...args: number[]) => boolean + fp.overSome([(number: number) => true, (number: number) => true]); // $ExpectType (...args: number[]) => boolean } // _.property -namespace 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(); - } + _.property("a.b[0]"); // $ExpectType (obj: SampleObject) => number + _.property(["a", "b", 0]); // $ExpectType (obj: SampleObject) => number + _("a.b[0]").property(); // $ExpectType LoDashImplicitWrapper<(obj: SampleObject) => number> + _(["a", "b", 0]).property(); // $ExpectType LoDashImplicitWrapper<(obj: SampleObject) => number> + _.chain("a.b[0]").property(); // $ExpectType LoDashExplicitWrapper<(obj: SampleObject) => number> + _.chain(["a", "b", 0]).property(); // $ExpectType LoDashExplicitWrapper<(obj: SampleObject) => number> + fp.property(Symbol.iterator)([]); // $ExpectType any + fp.property([Symbol.iterator], []); // $ExpectType any + fp.property(1)("abc"); // $ExpectType string } // _.propertyOf -namespace TestPropertyOf { - interface SampleObject { - a: { - b: number[]; - } - } +{ + _.propertyOf({}); // $ExpectType (path: Many) => any + _({}).propertyOf(); // $ExpectType LoDashImplicitWrapper<(path: Many) => any> + _.chain({}).propertyOf(); // $ExpectType LoDashExplicitWrapper<(path: Many) => any> - let object: SampleObject = { a: { b: [] } }; - - { - 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(); - } + fp.propertyOf(Symbol.iterator)([]); // $ExpectType any + fp.propertyOf([Symbol.iterator], []); // $ExpectType any + fp.propertyOf(1)("abc"); // $ExpectType string } // _.range -namespace 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); - } - - // $ExpectType number[][] - _.map([5, 5], _.range); -} - // _.rangeRight -namespace TestRangeRight { - { - let result: number[]; +{ + _.range(10); // $ExpectType number[] + _.range(1, 11); // $ExpectType number[] + _.range(0, 30, 5); // $ExpectType number[] + _(10).range(); // $ExpectType LoDashImplicitWrapper + _(1).range(11); // $ExpectType LoDashImplicitWrapper + _(0).range(30, 5); // $ExpectType LoDashImplicitWrapper + _.chain(10).range(); // $ExpectType LoDashExplicitWrapper + _.chain(1).range(11); // $ExpectType LoDashExplicitWrapper + _.chain(0).range(30, 5); // $ExpectType LoDashExplicitWrapper + fp.range(1, 11); // $ExpectType number[] + fp.range(1)(11); // $ExpectType number[] - result = _.rangeRight(10); - result = _.rangeRight(1, 11); - result = _.rangeRight(0, 30, 5); - } + _.rangeRight(10); // $ExpectType number[] + _.rangeRight(1, 11); // $ExpectType number[] + _.rangeRight(0, 30, 5); // $ExpectType number[] + _(10).rangeRight(); // $ExpectType LoDashImplicitWrapper + _(1).rangeRight(11); // $ExpectType LoDashImplicitWrapper + _(0).rangeRight(30, 5); // $ExpectType LoDashImplicitWrapper + _.chain(10).rangeRight(); // $ExpectType LoDashExplicitWrapper + _.chain(1).rangeRight(11); // $ExpectType LoDashExplicitWrapper + _.chain(0).rangeRight(30, 5); // $ExpectType LoDashExplicitWrapper + fp.rangeRight(1, 11); // $ExpectType number[] + fp.rangeRight(1)(11); // $ExpectType number[] - { - 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); - } - - // $ExpectType number[][] - _.map([5, 5], _.rangeRight); + _.map([5, 5], _.range); // $ExpectType number[][] + _.map([5, 5], _.rangeRight); // $ExpectType number[][] } // _.runInContext { - let result: typeof _; - result = _.runInContext(); - result = _.runInContext({}); - result = _({}).runInContext(); + _.runInContext(); // $ExpectType LoDashStatic + _.runInContext({}); // $ExpectType LoDashStatic + _({}).runInContext(); // $ExpectType LoDashStatic + fp.runInContext({}); // $ExpectType LoDashStatic } // _.stubArray { - { - let result: any[]; - - result = _.stubArray(); - result = _(anything).stubArray(); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _('a').chain().stubArray(); - result = _([1]).chain().stubArray(); - result = _(['']).chain().stubArray(); - result = _({}).chain().stubArray(); - result = _(anything).chain().stubArray(); - } + _.stubArray(); // $ExpectType any[] + _(anything).stubArray(); // $ExpectType any[] + _.chain(anything).stubArray(); // $ExpectType LoDashExplicitWrapper + fp.stubArray(); // $ExpectType any[] } // _.stubFalse { - { - let result: boolean; - - result = _.stubFalse(); - result = _(anything).stubFalse(); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _('a').chain().stubFalse(); - result = _([1]).chain().stubFalse(); - result = _(['']).chain().stubFalse(); - result = _({}).chain().stubFalse(); - result = _(anything).chain().stubFalse(); - } + _.stubFalse(); // $ExpectType boolean + _(anything).stubFalse(); // $ExpectType boolean + _.chain(anything).stubFalse(); // $ExpectType LoDashExplicitWrapper + fp.stubFalse(); // $ExpectType boolean } // _.stubObject { - { - let result: object; - - result = _.stubObject(); - result = _(anything).stubObject(); - } - - { - let result: _.LoDashExplicitObjectWrapper; - - result = _('a').chain().stubObject(); - result = _([1]).chain().stubObject(); - result = _(['']).chain().stubObject(); - result = _({}).chain().stubObject(); - result = _(anything).chain().stubObject(); - } + _.stubObject(); // $ExpectType any + _(anything).stubObject(); // $ExpectType any + _.chain(anything).stubObject(); // $ExpectType LoDashExplicitWrapper + fp.stubObject(); // $ExpectType any } // _.stubString { - { - let result: string; - - result = _.stubString(); - result = _(anything).stubString(); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _('a').chain().stubString(); - result = _([1]).chain().stubString(); - result = _(['']).chain().stubString(); - result = _({}).chain().stubString(); - result = _(anything).chain().stubString(); - } + _.stubString(); // $ExpectType string + _(anything).stubString(); // $ExpectType string + _.chain(anything).stubString(); // $ExpectType LoDashExplicitWrapper + fp.stubString(); // $ExpectType string } // _.stubTrue { - { - let result: boolean; - - result = _.stubTrue(); - result = _(anything).stubTrue(); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _('a').chain().stubTrue(); - result = _([1]).chain().stubTrue(); - result = _(['']).chain().stubTrue(); - result = _({}).chain().stubTrue(); - result = _(anything).chain().stubTrue(); - } + _.stubTrue(); // $ExpectType boolean + _(anything).stubTrue(); // $ExpectType boolean + _.chain(anything).stubTrue(); // $ExpectType LoDashExplicitWrapper + fp.stubTrue(); // $ExpectType boolean } // _.times -namespace TestTimes { - let iteratee: (num: number) => AbcObject = (num: number) => ({ a: 1, b: "", c: true }); +{ + const iteratee = (num: number): AbcObject => ({ a: 1, b: "", c: true }); - { - let result: number[]; - - result = _.times(42); - result = _(42).times(); - } - - { - let result: AbcObject[]; - - result = _.times(42, iteratee); - result = _(42).times(iteratee); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _(42).chain().times(); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _(42).chain().times(iteratee); - } + _.times(42); // $ExpectType number[] + _.times(42, iteratee); // $ExpectType AbcObject[] + _(42).times(); // $ExpectType number[] + _(42).times(iteratee); // $ExpectType AbcObject[] + _.chain(42).times(); // $ExpectType LoDashExplicitWrapper + _.chain(42).times(iteratee); // $ExpectType LoDashExplicitWrapper + fp.times(iteratee, 42); // $ExpectType AbcObject[] + fp.times(iteratee)(42); // $ExpectType AbcObject[] } // _.toPath -namespace 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(); - } +{ + _.toPath(1); // $ExpectType string[] + _.toPath("a[0].b.c"); // $ExpectType string[] + _.toPath(["a", 1]); // $ExpectType string[] + _(1).toPath(); // $ExpectType LoDashImplicitWrapper + _("a[0].b.c").toPath(); // $ExpectType LoDashImplicitWrapper + _(["a", 1]).toPath(); // $ExpectType LoDashImplicitWrapper + _.chain(1).toPath(); // $ExpectType LoDashExplicitWrapper + _.chain("a[0].b.c").toPath(); // $ExpectType LoDashExplicitWrapper + _.chain(["a", 1]).toPath(); // $ExpectType LoDashExplicitWrapper + fp.toPath(true); // $ExpectType string[] + fp.toPath(1); // $ExpectType string[] + fp.toPath("a"); // $ExpectType string[] + fp.toPath(["a"]); // $ExpectType string[] + fp.toPath({}); // $ExpectType string[] } // _.uniqueId -namespace TestUniqueId { - { - let result: string; - - result = _.uniqueId(); - result = _.uniqueId(''); - - result = _('').uniqueId(); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _('').chain().uniqueId(); - } +{ + _.uniqueId(); // $ExpectType string + _.uniqueId(""); // $ExpectType string + _("").uniqueId(); // $ExpectType string + _.chain("").uniqueId(); // $ExpectType LoDashExplicitWrapper + fp.uniqueId(""); // $ExpectType string } _.VERSION; // $ExpectType string @@ -14326,115 +7196,48 @@ _.templateSettings; // $ExpectType TemplateSettings // _.partial & _.partialRight { - function func0(): number { + const func0 = (): number => { return 42; - } - function func1(arg1: number): number { + }; + const func1 = (arg1: number): number => { return arg1 * 2; - } - function func2(arg1: number, arg2: string): number { + }; + const func2 = (arg1: number, arg2: string): number => { return arg1 * arg2.length; - } - function func3(arg1: number, arg2: string, arg3: boolean): number { + }; + const 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); + _.partial(func0); // $ExpectType Function0 // with arity 1 function - res____ = _.partial(func1, 42 ); - res1___ = _.partial(func1 ); + _.partial(func1, 42); // $ExpectType Function0 + _.partial(func1); // $ExpectType Function1 // with arity 2 function - res12__ = _.partial(func2 ); - res_2__ = _.partial(func2, 42 ); - res1___ = _.partial(func2, _, "foo"); - res____ = _.partial(func2, 42, "foo"); + _.partial(func2); // $ExpectType Function2 + _.partial(func2, 42); // $ExpectType Function1 + _.partial(func2, _, "foo"); // $ExpectType Function1 + _.partial(func2, 42, "foo"); // $ExpectType Function0 // 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); + _.partial(func3, 42, _, true); - // - // _.partialRight - // // with arity 0 function - res____ = _.partialRight(func0); + _.partialRight(func0); // $ExpectType Function0 // with arity 1 function - res____ = _.partialRight(func1, 42 ); - res1___ = _.partialRight(func1 ); + _.partialRight(func1, 42); // $ExpectType Function0 + _.partialRight(func1); // $ExpectType Function1 // with arity 2 function - res12__ = _.partialRight(func2 ); - res_2__ = _.partialRight(func2, 42, _); - res1___ = _.partialRight(func2, "foo"); - res____ = _.partialRight(func2, 42, "foo"); + _.partialRight(func2); // $ExpectType Function2 + _.partialRight(func2, 42, _); // $ExpectType Function1 + _.partialRight(func2, "foo"); // $ExpectType Function1 + _.partialRight(func2, 42, "foo"); // $ExpectType Function0 // 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); + _.partialRight(func3, 42, _, true); + + fp.partial([], func0); // $ExpectType (...args: any[]) => any + fp.partial([])(func0); // $ExpectType (...args: any[]) => any + fp.partial([42])(func1); // $ExpectType (...args: any[]) => any + fp.partialRight([])(func0); // $ExpectType (...args: any[]) => any + fp.partialRight([42])(func1); // $ExpectType (...args: any[]) => any } diff --git a/types/lodash/readme.md b/types/lodash/readme.md new file mode 100644 index 0000000000..d65d7f878f --- /dev/null +++ b/types/lodash/readme.md @@ -0,0 +1,62 @@ +# Notes for lodash developers + +## Folder Structure + +- Root + - `index.d.ts`: this is the main file that will be imported when people do `import _ from "lodash"`. + It references files for the lodash types. + - `fp.d.ts`: like `index.d.ts`, but for the functional programming variant of lodash. + See https://github.com/lodash/lodash/wiki/FP-Guide. + - `lodash-tests.ts`: contains test cases. Update these as necessary when you make a change. + - `tsconfig.json`: usually you shouldn't modify this file. However, if you add a new file, you should + probably add it to the `files` list in `tsconfig.json`. + - `tslint.json`: contains lint rules. The goal is to remove all of the rule overrides and match only the `dtslint/dt.json` rules. + - All other files: these exist so people can import individual functions, e.g. `import * as flatMap from "lodash/flatMap"` +- `common` directory: contains the main lodash types, split into multiple files for maintainability reasons. + These files are NOT meant to be imported directly - they should only be referenced by `index.d.ts`. +- `fp` directory: contains individual functions for `lodash/fp`. These files may be imported. + You should not modify these scripts directly - you should use a script to re-generate them (see below). +- `scripts` directory: contains code generation scripts. + - Before running any scripts, run `npm install` in this directory (it contains its own `package.json`). + - Most notable script is `npm run fp`, which re-generates all of the `fp` files. +- `v3` directory: contains types for lodash v3. + +## Different ways people might use lodash + +- Importing + - `import * as _ from "lodash"` + - `import * as _ from "lodash/fp"` + - `import { flatMap } from "lodash"` + - `import { flatMap } from "lodash/fp"` + - `import * as flatMap from "lodash/flatMap"` + - `import * as flatMap from "lodash/fp/flatMap"` + - `import * as flatMap from "lodash.flatmap"` (requires `npm install lodash.flatmap`) + - `import _ = require("lodash")` + - `import _ from "lodash"` (only if `esModuleInterop` is enabled) +- Global namespace + +## Before creating a PR + +- For every function you modify, don't forget to update the corresponding wrapper functions. +- Re-generate the `fp` types by opening a terminal in the `scripts` directory and running `npm run fp`. + - Note that this directory has its own `package.json`, so you'll need to run `npm install` first if you haven't already. +- Back at the root directory, do `npm run lint lodash` and make sure there are no errors. + +## FAQ +- I'm fixing a bug in v4. Should I also update the v3 types? + - In general, no. +- If the wrapper functions are almost copies of the original functions, shouldn't we auto-generate them like we do for `lodash/fp`? + - Good idea! If you have time, submit a PR. +- When I ran `npm run lint lodash`, I got an error that loks like `<--- Last few GCs --->`. + - Yeah, this error is really annoying. It means that node.js ran out of memory before it could run all of your tests. + - If you see somthing like `Test with 2.6` before that error, it means that there's an error in an older version of typescript. + The hard part is figuring out what the error is. + - The general procedure for diagnosing these errors is: + 1. Delete half of the tests in `lodash-tests.ts` (either the top half or the bottom half). + - If you delete the top half, don't delete the important stuff like `interface AbcObject`. + 2. Run `npm run lint lodash`. + 3. If it succeeds, add that half back and delete the other half. + 4. If it fails with a GC error, delete half of the remaining tests. + - Note: If both halfs succeed on their own, then the tests are probably just consuming too much memory. Try simplifying them until they pass. + 5. Repeat steps 1-4 until it gives you the real error message. Usually it's something obscure that only happens in TS 2.3/T.4, + so commenting/modifying the test is usually the best solution. diff --git a/types/lodash/scripts/generate-all.sh b/types/lodash/scripts/generate-all.sh index 2f79589533..a07bf37932 100644 --- a/types/lodash/scripts/generate-all.sh +++ b/types/lodash/scripts/generate-all.sh @@ -5,6 +5,7 @@ npm i ts-node -g ts-node ./generate-modules.ts +ts-node ./generate-fp.ts cd ../../../ diff --git a/types/lodash/scripts/generate-fp.ts b/types/lodash/scripts/generate-fp.ts new file mode 100644 index 0000000000..bbe648c6cd --- /dev/null +++ b/types/lodash/scripts/generate-fp.ts @@ -0,0 +1,841 @@ +// Script for converting the lodash types into unctional programming (FP) format. +// The convertion is done based on this guide: https://github.com/lodash/lodash/wiki/FP-Guide + +// Assumptions: +// - All functions are defined in one of the files in the "common" subfolder +// - All functions are defined inside of the LoDashStatic interface (although functions like _.partial may refer to another interface in the same file) +// - Consistent indentation is used for the start and end of the above interface +// - Consistent spacing is used for interface definitions: interface MyInterface { +// - Consistent line breaks (\n, \r, or \r\n) are used in all files +// - All overloads of a given function are defined in the same file + +import fs from "fs"; +import _ from "lodash"; +import convert from "lodash/fp/convert"; +import path from "path"; + +interface Definition { + name: string; + overloads: Overload[]; + jsdoc: string; +} +interface Interface { + name: string; + typeParams: TypeParam[]; + overloads: Overload[]; +} +interface Overload { + typeParams: TypeParam[]; + params: string[]; + returnType: string; + jsdoc: string; + tslintDisable?: string; +} +interface TypeParam { + name: string; + extends?: string; + equals?: string; +} + +let lineBreak = "\n"; +async function main() { + const commonTypes: string[] = []; + const tsconfigPath = path.join("..", "tsconfig.json"); + const tsconfigFile = await readFile(tsconfigPath); + lineBreak = _.find(["\r\n", "\n", "\r"], x => tsconfigFile.includes(x)) || "\n"; + + // Read each function definition and fp-ify it + const subfolders = ["common"]; + const promises: Array> = []; + for (const subfolder of subfolders) { + promises.push(new Promise((resolve, reject) => { + fs.readdir(path.join("..", subfolder), (err, files) => { + if (err) { + console.error(`failed to list directory contents for '${subfolder}': `, err); + reject(err); + return; + } + const filePaths = files.map(f => path.join("..", subfolder, f)); + try { + resolve(processDefinitions(filePaths, commonTypes)); + } catch (e) { + console.error(`failed to process files in '${subfolder}': `, e); + reject(e); + } + }); + })); + } + + let functionNames: string[]; + try { + functionNames = _.flatten(await Promise.all(promises)); + } catch (err) { + console.error("Failed to parse all functions: ", err); + return; + } + functionNames = _.sortedUniq(_.sortBy(functionNames, _.toLower)); + const fpFile = [ + "// AUTO-GENERATED: do not modify this file directly.", + "// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do:", + "// npm run fp", + "", + ...functionNames.map(f => `import ${f} = require("./fp/${f}");`), + "", + "export = _;", + "", + "declare const _: _.LoDashFp;", + "declare namespace _ {", + " interface LoDashFp {", + ...functionNames.map(f => ` ${f}: typeof ${f};`), + " }", + "}", + "", + "// Backward compatibility with --target es5", + "declare global {", + " // tslint:disable-next-line:no-empty-interface", + " interface Set { }", + " // tslint:disable-next-line:no-empty-interface", + " interface Map { }", + " // tslint:disable-next-line:no-empty-interface", + " interface WeakSet { }", + " // tslint:disable-next-line:no-empty-interface", + " interface WeakMap { }", + "}", + "", + ].join(lineBreak); + fs.writeFile(path.join("..", "fp.d.ts"), fpFile, (err) => { + if (err) + console.error("Failed to write fp.d.ts: ", err); + }); + + // Make sure the generated files are listed in tsconfig.json, so they are included in the lint checks + const tsconfig = tsconfigFile.split(lineBreak).filter(row => !row.includes("fp/") || row.includes("fp/convert.d.ts")); + const newRows = functionNames.map(f => ` "fp/${f}.d.ts",`); + newRows[newRows.length - 1] = newRows[newRows.length - 1].replace(",", ""); + + const insertIndex = _.findLastIndex(tsconfig, row => row.trim() === "]"); // Assume "files" is the last array + if (!tsconfig[insertIndex - 1].endsWith(",")) + tsconfig[insertIndex - 1] += ","; + tsconfig.splice(insertIndex, 0, ...newRows); + + fs.writeFile(tsconfigPath, tsconfig.join(lineBreak), (err) => { + if (err) + console.error(`Failed to write ${tsconfigPath}: `, err); + }); +} + +function readFile(filePath: string): Promise { + return new Promise((resolve, reject) => { + fs.readFile(filePath, "utf8", (err, data) => { + if (err) { + reject(err); + return; + } + try { + resolve(data); + } catch (e) { + reject(e); + } + }); + }); +} + +async function processDefinitions(filePaths: string[], commonTypes: string[]): Promise { + const builder: { [name: string]: (...args: number[][]) => () => Interface[] } = {}; + const unconvertedBuilder: { [name: string]: (...args: number[][]) => () => Interface[] } = {}; + for (const filePath of filePaths) { + const definitions = await parseFile(filePath, commonTypes); + for (const definition of definitions) { + if (definition.overloads.every(o => o.params.length <= 1 && o.returnType === "typeof _")) { + // Our convert technique doesn't work well on "typeof _" functions (or at least runInContext) + // Plus, if there are 0-1 parameters, there's nothing to curry anyways. + unconvertedBuilder[definition.name] = (...args: number[][]) => { + return () => curryOverloads(definition.overloads, definition.name, args[0] || [], -1, false); + }; + } else { + builder[definition.name] = (...args: Array) => { + // args were originally passed in as [0], [1], [2], [3], [4]. If they changed order, that indicates how the functoin was re-arged + // Return a function because some definitons (like rearg) expect to have a function return value + + // If any argument is a number instead of an array, then the argument at that index is being spread (e.g. assignAll, invokeArgs, partial, without) + const spreadIndex = args.findIndex(a => typeof a === "number"); + let isFixed = true; + if (spreadIndex !== -1) { + // If there's a spread parameter, convert() won't cap the number of arguments, so we need to do it manually + const arity = Math.max(spreadIndex, args[spreadIndex] as number) + 1; + args = args.slice(0, arity); + } else if (args.length > 4 || definition.name === "flow" || definition.name === "flowRight") { + // Arity wasn't fixed by convert() + isFixed = false; + } else { + // For some reason, convert() doesn't seems to tell us which functions have unchanged argument order. + // So we have to hard-code it. + const unchangedOrders = ["add", "assign", "assignIn", "bind", "bindKey", "concat", "difference", "divide", "eq", + "gt", "gte", "isEqual", "lt", "lte", "matchesProperty", "merge", "multiply", "overArgs", "partial", "partialRight", + "propertyOf", "random", "range", "rangeRight", "subtract", "zip", "zipObject", "zipObjectDeep"]; + if (unchangedOrders.includes(definition.name)) + args = _.sortBy(args as number[][], (a: number[]) => a[0]); + } + + return () => curryOverloads(definition.overloads, definition.name, _.flatten(args), spreadIndex, isFixed); + }; + } + } + } + + // Use convert() to tell us how functions will be rearged and aliased + const builderFp = convert(builder, { rearg: true, fixed: true, immutable: false, curry: false, cap: false }); + _.defaults(builderFp, unconvertedBuilder); + + const functionNames = Object.keys(builderFp).filter(key => key !== "convert" && typeof builderFp[key] === "function"); + for (const functionName of functionNames) { + // Assuming the maximum arity is 4. Pass one more arg than the max arity so we can detect if arguments weren't fixed. + const outputFn: (...args: any[]) => Interface[] = builderFp[functionName]([0], [1], [2], [3], [4]); + const commonTypeSearch = new RegExp(`\\b(${commonTypes.join("|")})\\b`, "g"); + commonTypeSearch.lastIndex; + let importCommon = false; + let output = outputFn([0], [1], [2], [3], [4]) + .map(interfaceToString) + .join(lineBreak) + .replace(commonTypeSearch, match => { + importCommon = true; + return `_.${match}`; + }); + if (!importCommon && output.includes("typeof _")) + importCommon = true; + const interfaceNameMatch = output.match(/(?:interface|type) ([A-Za-z0-9]+)/); + const interfaceName = (interfaceNameMatch ? interfaceNameMatch[1] : undefined) || _.upperFirst(functionName); + output = [ + "// AUTO-GENERATED: do not modify this file directly.", + "// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do:", + "// npm run fp", + importCommon ? `${lineBreak}import _ = require("../index");${lineBreak}` : '', + output, + "", + `declare const ${functionName}: ${interfaceName};`, + `export = ${functionName};`, + "", + ].join(lineBreak); + const targetFile = `../fp/${functionName}.d.ts`; + fs.writeFile(targetFile, output, (err) => { + if (err) + console.error(`failed to write file: ${targetFile}`, err); + }); + } + return functionNames; +} + +async function parseFile(filePath: string, commonTypes: string[]): Promise { + const definitionString = await readFile(filePath); + const newCommonTypeRegExp = / (?:type|interface) ([A-Za-z0-9]+)/g; + let newCommonType = newCommonTypeRegExp.exec(definitionString); + while (newCommonType) { + if (!commonTypes.includes(newCommonType[1])) + commonTypes.push(newCommonType[1]); + newCommonType = newCommonTypeRegExp.exec(definitionString); + } + + const definitons: Definition[] = []; + const lodashStaticRegExp = /( *)interface LoDashStatic {/g; + let lodashStaticMatch = lodashStaticRegExp.exec(definitionString); + while (lodashStaticMatch) { + const startIndex = lodashStaticMatch.index; + const endIndex = definitionString.indexOf(`${lineBreak}${lodashStaticMatch[1]}}`, startIndex); + if (endIndex === -1) { + const lineNumber = getLineNumber(definitionString, startIndex); + console.warn(`Failed to find end of interface 'LoDashStatic' (starting at ${filePath} line ${lineNumber}).`); + break; + } + const definitions = parseDefinitions(definitionString, startIndex + lodashStaticMatch[0].length, endIndex, filePath, commonTypes); + definitons.push(...definitions); + lodashStaticMatch = lodashStaticRegExp.exec(definitionString); + } + return definitons; +} + +function parseDefinitions(definitionString: string, startIndex: number, endIndex: number, filePath: string, commonTypes: string[], name?: string): Definition[] { + const overloadRegExp = name ? / [<(]/g : / (\w+)[<(:]/g; + overloadRegExp.lastIndex = startIndex; + let overloadMatch = overloadRegExp.exec(definitionString); + if (!overloadMatch) { + const lineNumber = getLineNumber(definitionString, startIndex); + console.warn(`No function definitions were found in interface at ${filePath} line ${lineNumber}.`); + return []; + } + const definitons: Definition[] = []; + let currentDefinition: Definition | undefined; + for (; overloadMatch && overloadMatch.index < endIndex; overloadMatch = overloadRegExp.exec(definitionString)) { + name = overloadMatch[1] || name!; + + const overloadStartIndex = overloadMatch.index; + if (!currentDefinition || name !== currentDefinition.name) { + if (currentDefinition && !_.isEmpty(currentDefinition.overloads)) + definitons.push(currentDefinition); + currentDefinition = { name, overloads: [], jsdoc: "" }; + const jsdocStartIndex = definitionString.lastIndexOf("/**", overloadStartIndex); + const jsdocEndIndex = definitionString.indexOf("*/", jsdocStartIndex); + if (jsdocStartIndex !== -1 && jsdocStartIndex > startIndex && jsdocEndIndex !== -1 && jsdocEndIndex < overloadStartIndex) { + // Verify that the comment is for this overload + const overloadTestIndex = definitionString.indexOf(" " + name, jsdocEndIndex); + if (overloadTestIndex === overloadStartIndex) + currentDefinition.jsdoc = definitionString.substring(jsdocStartIndex, jsdocEndIndex + 2).replace(/ /g, ""); + } + } + let overloadEndIndex = definitionString.indexOf(";", overloadStartIndex); + if (overloadEndIndex === -1 || overloadEndIndex > endIndex) { + const lineNumber = getLineNumber(definitionString, overloadStartIndex); + console.warn(`Overload does not end with semicolon! ${filePath} line ${lineNumber}`); + break; + } + overloadRegExp.lastIndex = overloadEndIndex; + if (name === "chain" || name === "mixin" || name.startsWith("prototype.")) + continue; + + const overloadString = definitionString.substring(overloadStartIndex, overloadEndIndex); + let paramStartIndex = overloadString.indexOf("("); + if (paramStartIndex !== -1) { + const overload: Overload = { typeParams: [], params: [], returnType: "", jsdoc: currentDefinition.jsdoc }; + + const previousLine = getPreviousLine(definitionString, overloadStartIndex).trim(); + if (previousLine.startsWith("// tslint:disable")) + overload.tslintDisable = previousLine; + + const typeParamStartIndex = overloadString.indexOf("<"); + if (typeParamStartIndex !== -1 && typeParamStartIndex < paramStartIndex) { + const typeParamEndIndex = overloadString.indexOf(">(", typeParamStartIndex); + if (typeParamEndIndex !== -1) { + paramStartIndex = typeParamEndIndex + 1; + overload.typeParams = overloadString + .substring(typeParamStartIndex + 1, typeParamEndIndex) + .split(",") + .map((tpString): TypeParam => { + const typeParam: TypeParam = { name: tpString }; + let parts = tpString.split(/=[^>]/); + if (parts[1]) + typeParam.equals = parts[1].trim(); + parts = tpString.split(" extends "); + if (parts[1]) + typeParam.extends = parts[1].trim(); + typeParam.name = parts[0].trim(); + return typeParam; + }); + } + } + const paramEndIndex = overloadString.indexOf("):", paramStartIndex); + if (paramEndIndex === -1) { + console.warn(`Failed to find parameter end position in overload for '${name}' (${filePath}).`); + continue; + } + overload.params = overloadString + .substring(paramStartIndex + 1, paramEndIndex) + .split(/,(?=[^,]+:)(?=(?:[^()]*|.*\(.*\).*)$)/m) // split on commas, but ignore Generic and (a, b) => c + .map(_.trim) + .map(o => _.trim(o, ",")) + .filter(o => !!o); + overload.returnType = overloadString.substring(paramEndIndex + 2).trim(); + currentDefinition.overloads.push(overload); + } else { + // This overload actually points to an interface. Try to find said interface and get the overloads from there. + const overloadParts = overloadString.split(":"); + const interfaceName = overloadParts[1].trim(); + if (interfaceName.startsWith("typeof ") || interfaceName.startsWith("LoDashStatic[")) { + // This is an alias (e.g. first: typeof _.head, or first: LoDashStatic['head']). + // Ignore it since convert() will create this alias based on the original function. + continue; + } + let interfaceStartIndex: number; + let interfaceEndIndex: number; + if (!interfaceName.startsWith("{")) { + const ignoreInterfaceNames = ["string", "TemplateSettings", "MapCacheConstructor"]; + if (ignoreInterfaceNames.includes(interfaceName)) + continue; + const interfaceRegExp = new RegExp(`( *)interface ${interfaceName} {`); + const interfaceMatch = interfaceRegExp.exec(definitionString); + if (!interfaceMatch) { + const lineNumber = getLineNumber(definitionString, overloadStartIndex); + console.warn(`Failed to parse function '${name}': interface '${interfaceName}' not found. (${filePath} line ${lineNumber})`); + continue; + } + interfaceStartIndex = interfaceMatch.index + interfaceMatch[0].length; + interfaceEndIndex = definitionString.indexOf(`${lineBreak}${interfaceMatch[1]}}`, interfaceStartIndex); + if (interfaceEndIndex === -1) { + const lineNumber = getLineNumber(definitionString, interfaceStartIndex); + console.warn(`Failed to find end of interface '${interfaceName}' (starting at ${filePath} line ${lineNumber}).`); + continue; + } + _.pull(commonTypes, interfaceName); + } else { + // This is an inline type definition + interfaceStartIndex = definitionString.indexOf("{", overloadStartIndex + overloadParts[0].length) + 1; + interfaceEndIndex = definitionString.indexOf("}", interfaceStartIndex); + if (interfaceEndIndex === -1 || interfaceEndIndex >= endIndex) { + console.warn(`Failed to find closing '}' character for property '${name}' (${filePath}).`); + continue; + } + overloadEndIndex = definitionString.indexOf(";", interfaceEndIndex); + if (overloadEndIndex === -1 || overloadEndIndex >= endIndex) { + const lineNumber = getLineNumber(definitionString, overloadStartIndex); + console.warn(`Overload does not end with semicolon! ${filePath} line ${lineNumber}`); + continue; + } + overloadRegExp.lastIndex = overloadEndIndex; + } + const [definition] = parseDefinitions(definitionString, interfaceStartIndex, interfaceEndIndex, filePath, commonTypes, name); + if (definition) { + for (const overload of definition.overloads) + overload.jsdoc = currentDefinition.jsdoc; + currentDefinition.overloads.push(...definition.overloads); + } + } + } + if (currentDefinition && !_.isEmpty(currentDefinition.overloads)) + definitons.push(currentDefinition); + return definitons; +} + +function curryOverloads(overloads: Overload[], functionName: string, paramOrder: number[], spreadIndex: number, isFixed: boolean): Interface[] { + overloads = _.cloneDeep(overloads); + + // Remove unused type parameters + for (const overload of overloads) { + for (let i = 0; i < overload.typeParams.length; ++i) { + const search = new RegExp(`\\b${overload.typeParams[i].name}\\b`); + if (overload.params.every(p => !search.test(p)) && !search.test(overload.returnType)) { + overload.typeParams.splice(i, 1); + --i; + } + } + if (overloads.some(o => o !== overload && _.isEqual(o, overload))) + _.pull(overloads, overload); + } + + if (!isFixed) { + // Non-fixed arity functions cannot be curried. + for (const overload of overloads) + overload.params = overload.params.map(p => p.replace(/\?:/g, ":")); // No optional parameters + return [{ + name: _.upperFirst(functionName), + typeParams: [], + overloads, + }]; + } + paramOrder = paramOrder.filter(p => typeof p === "number"); + const arity = paramOrder.length; + + if (spreadIndex !== -1) { + // The parameter at this index is an array that will be spread when passed down to the actual function (e.g. assignAll, invokeArgs, partial, without). + // For these parameters, we expect the input to be an array (so remove the "...") + + // Spread/rest parameters could be in any of the following formats: + // 1. The rest parameter is at spreadIndex, and it is the last parameter. + // 2. The rest parameter is immediately after spreadIndex, e.g. assign(object, ...sources[]). In this case, convert it to assignAll(...object[]) + // 3. The rest parameter is not the last parameter, e.g. assignWith(object, ...sources[], customizer) + if (spreadIndex === arity - 1) { + // cases 1-2 + for (let i = 0; i < overloads.length; ++i) { + const overload = overloads[i]; + if (overload.params.length === arity && overload.params[spreadIndex] && overload.params[spreadIndex].startsWith("...")) { + overload.params[spreadIndex] = overload.params[spreadIndex].replace("...", ""); + } else if (overload.params.length === arity + 1 && overload.params[spreadIndex + 1] && overload.params[spreadIndex + 1].startsWith("...")) { + overload.params.splice(spreadIndex + 1, 1); + const parts = overload.params[spreadIndex].split(":").map(_.trim); + parts[1] = `ReadonlyArray<${parts[1]}>`; + overload.params[spreadIndex] = `${parts[0]}: ${parts[1]}`; + } else { + _.pull(overloads, overload); + --i; + } + } + } else { + // case 3 + const overload = overloads[0]; + overloads = [{ + jsdoc: overload.jsdoc, + typeParams: [], + params: [ + ...overload.params.slice(0, spreadIndex), + "args: ReadonlyArray", + ...overload.params.slice(overload.params.length - (arity - spreadIndex - 1)), + ], + returnType: "any", + }]; + } + } + + let filteredOverloads = overloads.filter(o => o.params.length >= arity && o.params.slice(arity).every(p => p.includes("?") && !p.startsWith("iteratee")) + && o.params.every(p => !p.startsWith("...") && !p.startsWith("guard:"))); + if (filteredOverloads.length === 0) + filteredOverloads = overloads.filter(o => o.params.length >= arity && o.params.slice(arity).every(p => p.includes("?") || p.startsWith("...")) + && o.params.every(p => !p.startsWith("guard:"))); + if (filteredOverloads.length === 0) + filteredOverloads = overloads.filter(o => o.params.length > 0 && o.params.length <= arity + 1 && o.params[o.params.length - 1].startsWith("...")); + if (filteredOverloads.length === 0) + console.warn(`No matching overloads found for ${functionName} with arity ${arity}`); + + const restOverloads = overloads.filter(o => o.params.length > 0 && o.params[o.params.length - 1].startsWith("...")); + for (const restOverload of restOverloads) { + restOverload.params[restOverload.params.length - 1] = restOverload.params[restOverload.params.length - 1] + .substring(3) + .replace(/\[\]$/, "") + .replace(/: Array<(.+)>$/, ": $1"); + if (restOverload.params.length < arity) { + const paramToCopy = restOverload.params[restOverload.params.length - 1]; + const copiedParams = _.range(2, arity - restOverload.params.length + 2).map(i => paramToCopy.replace(/(^.+?):/, `$1${i}:`)); + restOverload.params.push(...copiedParams); + } + } + + for (const overload of filteredOverloads) + preProcessOverload(overload, functionName, arity); + + const interfaces = _.flatMap(filteredOverloads, (o, i) => { + const reargParams = o.params.map((p, i) => o.params[paramOrder.indexOf(i)]); + return curryOverload({ + typeParams: o.typeParams, + params: reargParams, + returnType: o.returnType, + jsdoc: o.jsdoc, + }, functionName, i + 1); + }); + if (interfaces.length === 0) + return []; + // Merge interfaces with the same name + const mainInterface = interfaces[0]; + const interfacesToMerge = interfaces.filter(i => i.name === mainInterface.name); + mergeInterfaces(interfacesToMerge); + _.remove(interfaces, i => i !== mainInterface && interfacesToMerge.includes(i)); + // Check for any non-main interfaces that should now be merged + for (const overload of mainInterface.overloads) { + const others = mainInterface.overloads.filter(o2 => o2 !== overload + && _.isEqual(overload.typeParams, o2.typeParams) + && _.isEqual(overload.params.map(getParamType), o2.params.map(getParamType))); + const returnInterface = interfaces.find(i => new RegExp(`\\b${i.name}\\b`).test(overload.returnType)); + for (const otherOverload of others) { + for (let i = 0; i < overload.params.length; ++i) { + const paramNames = _.uniq([overload].concat(others).map(o => getParamName(o.params[i]))); + if (paramNames.length > 1) { + // Some param names are different. Merge them. + const paramType = getParamType(overload.params[i]); + overload.params[i] = `${paramNames[0]}Or${paramNames.slice(1).map(_.upperFirst).join("Or")}: ${paramType}`; + } + } + if (otherOverload.returnType === overload.returnType) { + // Exact duplicate - remove the second overload + _.pull(mainInterface.overloads, otherOverload); + } else { + // Duplicate except for the return type. If the return types are both known interfaces, + // merge the interfaces so we can remove the second overload + const otherReturnInterface = interfaces.find(i => new RegExp(`\\b${i.name}\\b`).test(otherOverload.returnType)); + if (returnInterface && otherReturnInterface) { + _.remove(otherReturnInterface.overloads, o => new RegExp(`\\b${otherReturnInterface.name}\\b`).test(o.returnType)); + mergeInterfaces([returnInterface, otherReturnInterface]); + _.pull(interfaces, otherReturnInterface); + // Rename any other references to the removed interface(s) + for (const overload of _.flatMap(interfaces, i => i.overloads)) + overload.returnType = overload.returnType.replace(new RegExp(`\\b${otherReturnInterface.name}\\b`), returnInterface.name); + } + } + } + _.pull(mainInterface.overloads, ...others); + } + for (const interfaceDef of interfaces) + interfaceDef.overloads = mergeSimilarOverloads(interfaceDef.overloads); + return interfaces; +} + +function getParamName(param: string) { + return param.split(":", 1)[0]; +} + +function getParamType(param: string) { + const index = param.indexOf(":"); + return index !== -1 ? param.substring(index + 1).trim() : "any"; +} + +function preProcessOverload(overload: Overload, functionName: string, arity: number): void { + overload.params = overload.params + .slice(0, arity) + .map(p => p + .replace(/\?:/g, ":") // No optional parameters + .replace(/: *(?:Array<(.+)>|([^ |]+)\[\]|\((.+)\)\[\])$/, ": ReadonlyArray<$1$2$3>")); // Convert Array to ReadonlyArray because lodash/fp treats everything as immutable + // Cap the number of callback arguments + for (let i = 0; i < overload.params.length; ++i) + overload.params[i] = capCallback(overload.params[i], functionName); +} + +function capCallback(parameter: string, functionName: string): string { + // We don't support capping these callbacks yet, so flag them if detected + if (functionName !== "zipWith" && functionName !== "unzipWith" && /(?:iteratee|predicate|callback): *\((?:[^,)]+,[^)]+| *\.\.\..+)\) ?=>/.test(parameter)) + console.warn(`${functionName}: Failed to cap callback: ${parameter}`); + + // Special case for mapKeys: callback is capped to the key parameter only + if (functionName === "mapKeys") { + parameter = parameter + .replace(/(iteratee|predicate|callback): *(?:Array|List|NumericDictionary|String)Iteratee<(.+)>$/g, "$1: ValueIteratee") + .replace(/(iteratee|predicate|callback): *(?:Dictionary|Object)Iteratee<(.+)>$/g, "$1: ValueIteratee") + .replace(/(iteratee|predicate|callback): *(?:Array|List|NumericDictionary|String)Iteratee(?:Custom)?<(.+?),(.+)>$/g, "$1: ValueIterateeCustom") + .replace(/(iteratee|predicate|callback): *(?:Dictionary|Object)Iteratee(?:Custom)?<(.+?),(.+)>$/g, "$1: ValueIterateeCustom"); + } + + // Special case for reduceRight: callback argument order of (b, a) + if (functionName === "reduceRight") { + parameter = parameter + .replace(/(iteratee|predicate|callback): *Memo(Void)?(?:List|Object|Dictionary)Iterator<([^,>]+),([^,>]+)(?:,[^,>]+?()?)?>/g, "$1: Memo$2IteratorCappedRight<$3,$4>"); + } + + return parameter + .replace(/(iteratee|predicate|callback): *(?:Array|List|Dictionary|NumericDictionary|String)Iteratee<(.+)>$/g, "$1: ValueIteratee<$2>") + .replace(/(iteratee|predicate|callback): *(?:Array|List|Dictionary|NumericDictionary|String)Iteratee(?:Custom)?<(.+?),(.+)>$/g, "$1: ValueIterateeCustom<$2,$3>") + .replace(/(iteratee|predicate|callback): *(?:Array|List|Dictionary|NumericDictionary|String)IteratorTypeGuard<(.+?),(.+)>$/g, "$1: ValueIteratorTypeGuard<$2,$3>") + .replace(/(iteratee|predicate|callback): *ObjectIteratee<(.+)>$/g, "$1: ValueIteratee<$2[keyof $2]>") + .replace(/(iteratee|predicate|callback): *ObjectIterateeCustom<(.+?),(.+)>$/g, "$1: ValueIterateeCustom<$2[keyof $2],$3>") + .replace(/(iteratee|predicate|callback): *ObjectIteratorTypeGuard<(.+?),(.+)>$/g, "$1: ValueIteratorTypeGuard<$2[keyof $2],$3>") + .replace(/(iteratee|predicate|callback): *(?:Array|List|Dictionary|NumericDictionary)Iterator<(.+?), *(.+)>$/g, "$1: (value: $2) => $3") + .replace(/(iteratee|predicate|callback): *StringIterator<(.+)>$/g, "$1: (value: string) => $2") + .replace(/(iteratee|predicate|callback): *ObjectIterator<(.+?), *(.+?)>$/g, "$1: (value: $2[keyof $2]) => $3") + .replace(/(iteratee|predicate|callback): *Memo(Void)?(?:Array|List|Object|Dictionary)Iterator<([^,>]+),([^,>]+)(?:,[^,>]+?()?)?>/g, "$1: Memo$2IteratorCapped<$3,$4>") + .replace(/(iteratees|predicates|callbacks): *Many<(?:Array|List|Dictionary|NumericDictionary|String)Iteratee<(.+?)>>/g, "$1: Many>") + .replace(/(iteratees|predicates|callbacks): *Many>/g, "$1: Many>") + .replace(/(iteratees|predicates|callbacks): *Many<(?:Array|List|Dictionary|NumericDictionary)Iterator<(.+?), *(.+?)>>/g, "$1: Many<(value: $2) => $3>") + .replace(/(iteratees|predicates|callbacks): *Many>/g, "$1: Many<(value: $2[keyof $2]) => $3>"); +} + +function curryOverload(overload: Overload, functionName: string, overloadId: number): Interface[] { + let baseName = _.upperFirst(functionName); + if (baseName === "Pick") // A type called "Pick" already exists, so rename to avoid conflicts + baseName = "Lodash" + baseName; + if (overload.params.length <= 1) { + // Functions with 0 or 1 arguments are not curried. Just use a basic function type. + return [{ + name: baseName, + overloads: [overload], + typeParams: [], + }]; + } + + const interfaces: Interface[] = []; + let passTypeParams: TypeParam[] = []; + for (let i = 0; i < overload.params.length; ++i) { + const interfaceDef = { + name: getInterfaceName(baseName, overloadId, i, []), + typeParams: _.cloneDeep(passTypeParams), + overloads: curryParams( + overload.params.slice(i), + _.without(overload.typeParams, ...passTypeParams), + overload.returnType, + baseName, + passTypeParams, + overloadId, + i, + overload.jsdoc, + ), + }; + interfaces.push(interfaceDef); + const currentParams = overload.params.slice(0, i + 1); + const usedTypeParams = overload.typeParams.filter(tp => currentParams.some(p => new RegExp(`\\b${tp.name}\\b`).test(p))); + usedTypeParams.unshift(...overload.typeParams.filter(tp => !usedTypeParams.includes(tp) && usedTypeParams.some(tp2 => !!tp2.extends && new RegExp(`\\b${tp.name}\\b`).test(tp2.extends)))); + const unusedParams = overload.params.slice(i + 1).concat(overload.returnType); + passTypeParams = usedTypeParams.filter(tp => unusedParams.some(p => new RegExp(`\\b${tp.name}\\b`).test(p))); + } + // The T[keyof T] constraint doesn't work so well if it's the only constraint. Convert to a plain old T constraint so it can be merged with + // other ValueIteratee overloads + for (const interfaceDef of interfaces) { + for (const overload of interfaceDef.overloads) { + const objectTypeParam = overload.typeParams.find(tp => tp.name === "T" && (tp.extends === "object" || !tp.extends)); + if (objectTypeParam && overload.params.some(p => p.includes("T[keyof T]")) && !overload.params.some(p => /T(?!]|\[keyof T])/.test(p))) { + delete objectTypeParam.extends; + overload.params = overload.params.map(p => p.replace(/\bArray/g, " T[]").replace(/\bT\[keyof T]/g, "T")); + const fixInterfaceName = overload.returnType.split("<")[0]; + const fixInterface = interfaces.find(i => i.name === fixInterfaceName); + if (fixInterface) { + const fixTypeParam = fixInterface.typeParams.find(tp => tp.name === objectTypeParam.name && (tp.extends === "object" || !tp.extends)); + if (fixTypeParam) { + delete fixTypeParam.extends; + for (const fixOverload of fixInterface.overloads) { + // This overload has T referring to a whole object. But now T refers to a single element, so fix it. + // If there's only 1 usage, replace it with 'object'. If there are multiple, create a new type constraint. + const typeParamSearch = new RegExp(`\\b${fixTypeParam.name}\\b(?:(?!(?:\\[keyof ${fixTypeParam.name})?\\])|$)`); + const matches = fixOverload.params.concat(fixOverload.returnType).filter(value => typeParamSearch.test(value)); + let replacement = "object"; + if (matches.length >= 2) { + let i = 1; + const newTypeParam: TypeParam = { name: "T" + i, extends: replacement }; + while (fixInterface.typeParams.some(t => t.name === newTypeParam.name) || fixOverload.typeParams.some(t => t.name === newTypeParam.name)) + newTypeParam.name = "T" + (++i); + fixOverload.typeParams.push(newTypeParam); + replacement = newTypeParam.name; + } + fixOverload.params = fixOverload.params + .map(p => p.replace(new RegExp(typeParamSearch, "g"), replacement) + .replace(new RegExp(`\\bArray<${fixTypeParam.name}\\[keyof ${fixTypeParam.name}]>`, "g"), fixTypeParam.name + "[]") + .replace(new RegExp(`\\b${fixTypeParam.name}\\[keyof ${fixTypeParam.name}]`, "g"), fixTypeParam.name)); + if (!new RegExp(`\\b${baseName}[0-9]+x[0-9]+\\b`).test(fixOverload.returnType)) { + fixOverload.returnType = fixOverload.returnType + .replace(new RegExp(typeParamSearch, "g"), replacement) + .replace(new RegExp(`\\bArray<${fixTypeParam.name}\\[keyof ${fixTypeParam.name}]>`, "g"), fixTypeParam.name + "[]") + .replace(new RegExp(`\\b${fixTypeParam.name}\\[keyof ${fixTypeParam.name}]`, "g"), fixTypeParam.name); + } + } + } + } else { + console.warn(`Fixed T[keyof T] overload, but could not find corresponding interface '${fixInterfaceName}'.`); + } + } + } + } + return interfaces; +} + +function curryParams( + params: string[], + typeParams: TypeParam[], + returnType: string, + baseName: string, + interfaceTypeParams: TypeParam[], + overloadId: number, + index: number, + jsdoc: string, +): Overload[] { + // Assume params.length >= 1 + const overloads: Overload[] = [{ + typeParams: [], + params: [], + returnType: getInterfaceName(baseName, overloadId, index, interfaceTypeParams), + jsdoc, + }]; + for (let i = 1; i <= params.length; ++i) { + const currentParams = params.slice(0, i); + const usedTypeParams = i < params.length ? typeParams.filter(tp => currentParams.some(p => new RegExp(`\\b${tp.name}\\b`).test(p))) : typeParams; + usedTypeParams.unshift(...typeParams.filter(tp => !usedTypeParams.includes(tp) && usedTypeParams.some(tp2 => !!tp2.extends && new RegExp(`\\b${tp.name}\\b`).test(tp2.extends)))); + const unusedParams = params.slice(i).concat(returnType); + const passTypeParams = usedTypeParams.concat(interfaceTypeParams).filter(tp => unusedParams.some(p => new RegExp(`\\b${tp.name}\\b`).test(p))); + const currentReturnType = i < params.length ? getInterfaceName(baseName, overloadId, index + i, passTypeParams) : returnType; + + overloads.push({ + typeParams: _.cloneDeep(usedTypeParams), + params: currentParams, + returnType: currentReturnType, + jsdoc, + }); + } + return overloads; +} + +function mergeInterfaces(interfaces: Interface[]): void { + const mainInterface = interfaces[0]; + if (!mainInterface) + return; + mainInterface.overloads = _.uniqWith(_.flatMap(interfaces, i => i.overloads), _.isEqual); +} + +function mergeSimilarOverloads(overloads: Overload[]): Overload[] { + const newOverloads = _.cloneDeep(overloads); + for (const overload of newOverloads) { + // We can merge if all param types are the same except one, and the return types are the same. + const others = newOverloads.filter(o2 => o2 !== overload + && _.isEqual(overload.typeParams, o2.typeParams) + && overload.params.length === o2.params.length + && overload.params.length >= 1 + && overload.params.filter((p, i) => getParamType(p) !== getParamType(o2.params[i])).length <= 1 + && overload.returnType === o2.returnType); + if (_.isEmpty(others)) + continue; + + const differingParamIndexes = _(others) + .map(o2 => overload.params.findIndex((p, i) => getParamType(p) !== getParamType(o2.params[i]))) + .filter(i => i !== -1) + .uniq() + .value(); + if (differingParamIndexes.length > 1) + continue; // Only one param is different, but it's a different param for some overloads, so we can't merge + for (let i = 0; i < overload.params.length; ++i) { + const similarOverloads = [overload].concat(others); + const paramNames = _.uniq(similarOverloads.map(o => getParamName(o.params[i]))); + const newParamName = (paramNames.length > 1) ? `${paramNames[0]}Or${paramNames.slice(1).map(_.upperFirst).join("Or")}` : paramNames[0]; + + const newParamType = _(similarOverloads) + .map(o => o.params[i]) + .flatMap(p => getParamType(p).split("|")) + .map(_.trim) + .uniq() + .sortBy(type => type === "undefined" ? 2 : (type === "null" ? 1 : 0)) + .join(" | "); + overload.params[i] = `${newParamName}: ${newParamType}`; + } + _.pull(newOverloads, ...others); + } + return newOverloads; +} + +function getInterfaceName(baseName: string, overloadId: number, index: number, typeParams: TypeParam[]): string { + let interfaceName = baseName; + if (index > 0) + interfaceName += `${overloadId}x${index}${typeParamsToString(typeParams, false)}`; + return interfaceName; +} + +function interfaceToString(interfaceDef: Interface): string { + if (interfaceDef.overloads.length === 0) { + // No point in creating an empty interface + return ""; + } else if (interfaceDef.overloads.length === 1) { + // Don't create an interface for a single type. Instead use a basic type def. + let jsdoc = interfaceDef.overloads[0].jsdoc; + if (jsdoc) + jsdoc += lineBreak; + interfaceDef.overloads[0].jsdoc = ""; + return `type ${interfaceDef.name}${typeParamsToString(interfaceDef.typeParams)} =${lineBreak}${tab(jsdoc + overloadToString(interfaceDef.overloads[0], true), 1)}`; + } else { + const overloadStrings = interfaceDef.overloads.map(o => lineBreak + tab(overloadToString(o), 1)).join(""); + return `interface ${interfaceDef.name}${typeParamsToString(interfaceDef.typeParams)} {${overloadStrings}${lineBreak}}`; + } +} + +function overloadToString(overload: Overload, arrowSyntax = false): string { + const joinedParams = overload.params.join(", "); + let jsdoc = overload.jsdoc; + if (jsdoc) + jsdoc += lineBreak; + if (overload.tslintDisable) + jsdoc += overload.tslintDisable + lineBreak; + return `${jsdoc}${typeParamsToString(overload.typeParams)}(${joinedParams})${arrowSyntax ? " =>" : ":"} ${overload.returnType};`; +} + +function typeParamsToString(typeParams: TypeParam[], includeConstraints = true): string { + return typeParams.length > 0 ? `<${typeParams.map(tp => + tp.name + + (includeConstraints && tp.extends ? " extends " + tp.extends : "") + + (includeConstraints && tp.equals ? " = " + tp.equals : "") + ).join(", ")}>` : ""; +} + +function getPreviousLine(s: string, index: number): string { + const eol = s.lastIndexOf(lineBreak, index); + if (eol === -1) + return ""; + const bol = s.lastIndexOf(lineBreak, eol - 1); + if (bol === -1) + return ""; + return s.substring(bol + 1, eol); +} + +function getLineNumber(fileContents: string, index: number) { + return fileContents.substring(0, index).split(lineBreak).length + 1; +} + +function tab(s: string, count: number) { + const prepend: string = " ".repeat(count * 4); + return prepend + s.replace(/(?:\r\n|\n|\r)(.)/g, `${lineBreak}${prepend}$1`); +} + +function indexOfAny(source: string, values: string[], position?: number): number { + const indexes: number[] = []; + for (const value of values) { + const index = source.indexOf(value, position); + if (index !== -1) + indexes.push(index); + } + return indexes.length > 0 ? _.min(indexes)! : -1; +} + +main(); diff --git a/types/lodash/scripts/package.json b/types/lodash/scripts/package.json new file mode 100644 index 0000000000..f98c233642 --- /dev/null +++ b/types/lodash/scripts/package.json @@ -0,0 +1,14 @@ +{ + "private": true, + "name": "lodash-scripts", + "version": "0.0.1", + "scripts": { + "fp": "ts-node generate-fp" + }, + "devDependencies": { + "lodash": "^4.17.4", + "ts-node": "^4.1.0", + "typescript": "^2.7.1" + }, + "dependencies": {} +} diff --git a/types/lodash/scripts/tsconfig.json b/types/lodash/scripts/tsconfig.json index a06b8ed24f..023cb6a0cb 100644 --- a/types/lodash/scripts/tsconfig.json +++ b/types/lodash/scripts/tsconfig.json @@ -1,10 +1,18 @@ { "compilerOptions": { - "target": "es6", + "target": "es2017", + "module": "commonjs", "baseUrl": "../..", + "esModuleInterop": true, + "noEmit": true, + "noImplicitAny": true, + "pretty": true, + "strict": true, "typeRoots": [ "../../" ], - "types": [] + "types": [ + "lodash" + ] } -} \ No newline at end of file +} diff --git a/types/lodash/tsconfig.json b/types/lodash/tsconfig.json index 7ab3d8db99..926c4217d7 100644 --- a/types/lodash/tsconfig.json +++ b/types/lodash/tsconfig.json @@ -14,10 +14,12 @@ ], "types": [], "noEmit": true, - "forceConsistentCasingInFileNames": true + "forceConsistentCasingInFileNames": true, + "esModuleInterop": true }, "files": [ "index.d.ts", + "common/common.d.ts", "lodash-tests.ts", "add.d.ts", "after.d.ts", @@ -103,6 +105,7 @@ "forInRight.d.ts", "forOwn.d.ts", "forOwnRight.d.ts", + "fp.d.ts", "fromPairs.d.ts", "functions.d.ts", "functionsIn.d.ts", @@ -316,6 +319,402 @@ "zip.d.ts", "zipObject.d.ts", "zipObjectDeep.d.ts", - "zipWith.d.ts" + "zipWith.d.ts", + "common/array.d.ts", + "common/collection.d.ts", + "common/common.d.ts", + "common/date.d.ts", + "common/function.d.ts", + "common/lang.d.ts", + "common/math.d.ts", + "common/number.d.ts", + "common/object.d.ts", + "common/seq.d.ts", + "common/string.d.ts", + "common/util.d.ts", + "fp/convert.d.ts", + "fp/add.d.ts", + "fp/after.d.ts", + "fp/all.d.ts", + "fp/allPass.d.ts", + "fp/always.d.ts", + "fp/any.d.ts", + "fp/anyPass.d.ts", + "fp/apply.d.ts", + "fp/ary.d.ts", + "fp/assign.d.ts", + "fp/assignAll.d.ts", + "fp/assignAllWith.d.ts", + "fp/assignIn.d.ts", + "fp/assignInAll.d.ts", + "fp/assignInAllWith.d.ts", + "fp/assignInWith.d.ts", + "fp/assignWith.d.ts", + "fp/assoc.d.ts", + "fp/assocPath.d.ts", + "fp/at.d.ts", + "fp/attempt.d.ts", + "fp/before.d.ts", + "fp/bind.d.ts", + "fp/bindAll.d.ts", + "fp/bindKey.d.ts", + "fp/camelCase.d.ts", + "fp/capitalize.d.ts", + "fp/castArray.d.ts", + "fp/ceil.d.ts", + "fp/chunk.d.ts", + "fp/clamp.d.ts", + "fp/clone.d.ts", + "fp/cloneDeep.d.ts", + "fp/cloneDeepWith.d.ts", + "fp/cloneWith.d.ts", + "fp/compact.d.ts", + "fp/complement.d.ts", + "fp/compose.d.ts", + "fp/concat.d.ts", + "fp/cond.d.ts", + "fp/conforms.d.ts", + "fp/conformsTo.d.ts", + "fp/constant.d.ts", + "fp/contains.d.ts", + "fp/countBy.d.ts", + "fp/create.d.ts", + "fp/curry.d.ts", + "fp/curryN.d.ts", + "fp/curryRight.d.ts", + "fp/curryRightN.d.ts", + "fp/debounce.d.ts", + "fp/deburr.d.ts", + "fp/defaults.d.ts", + "fp/defaultsAll.d.ts", + "fp/defaultsDeep.d.ts", + "fp/defaultsDeepAll.d.ts", + "fp/defaultTo.d.ts", + "fp/defer.d.ts", + "fp/delay.d.ts", + "fp/difference.d.ts", + "fp/differenceBy.d.ts", + "fp/differenceWith.d.ts", + "fp/dissoc.d.ts", + "fp/dissocPath.d.ts", + "fp/divide.d.ts", + "fp/drop.d.ts", + "fp/dropLast.d.ts", + "fp/dropLastWhile.d.ts", + "fp/dropRight.d.ts", + "fp/dropRightWhile.d.ts", + "fp/dropWhile.d.ts", + "fp/each.d.ts", + "fp/eachRight.d.ts", + "fp/endsWith.d.ts", + "fp/entries.d.ts", + "fp/entriesIn.d.ts", + "fp/eq.d.ts", + "fp/equals.d.ts", + "fp/escape.d.ts", + "fp/escapeRegExp.d.ts", + "fp/every.d.ts", + "fp/extend.d.ts", + "fp/extendAll.d.ts", + "fp/extendAllWith.d.ts", + "fp/extendWith.d.ts", + "fp/F.d.ts", + "fp/fill.d.ts", + "fp/filter.d.ts", + "fp/find.d.ts", + "fp/findFrom.d.ts", + "fp/findIndex.d.ts", + "fp/findIndexFrom.d.ts", + "fp/findKey.d.ts", + "fp/findLast.d.ts", + "fp/findLastFrom.d.ts", + "fp/findLastIndex.d.ts", + "fp/findLastIndexFrom.d.ts", + "fp/findLastKey.d.ts", + "fp/first.d.ts", + "fp/flatMap.d.ts", + "fp/flatMapDeep.d.ts", + "fp/flatMapDepth.d.ts", + "fp/flatten.d.ts", + "fp/flattenDeep.d.ts", + "fp/flattenDepth.d.ts", + "fp/flip.d.ts", + "fp/floor.d.ts", + "fp/flow.d.ts", + "fp/flowRight.d.ts", + "fp/forEach.d.ts", + "fp/forEachRight.d.ts", + "fp/forIn.d.ts", + "fp/forInRight.d.ts", + "fp/forOwn.d.ts", + "fp/forOwnRight.d.ts", + "fp/fromPairs.d.ts", + "fp/functions.d.ts", + "fp/functionsIn.d.ts", + "fp/get.d.ts", + "fp/getOr.d.ts", + "fp/groupBy.d.ts", + "fp/gt.d.ts", + "fp/gte.d.ts", + "fp/has.d.ts", + "fp/hasIn.d.ts", + "fp/head.d.ts", + "fp/identical.d.ts", + "fp/identity.d.ts", + "fp/includes.d.ts", + "fp/includesFrom.d.ts", + "fp/indexBy.d.ts", + "fp/indexOf.d.ts", + "fp/indexOfFrom.d.ts", + "fp/init.d.ts", + "fp/initial.d.ts", + "fp/inRange.d.ts", + "fp/intersection.d.ts", + "fp/intersectionBy.d.ts", + "fp/intersectionWith.d.ts", + "fp/invert.d.ts", + "fp/invertBy.d.ts", + "fp/invertObj.d.ts", + "fp/invoke.d.ts", + "fp/invokeArgs.d.ts", + "fp/invokeArgsMap.d.ts", + "fp/invokeMap.d.ts", + "fp/isArguments.d.ts", + "fp/isArray.d.ts", + "fp/isArrayBuffer.d.ts", + "fp/isArrayLike.d.ts", + "fp/isArrayLikeObject.d.ts", + "fp/isBoolean.d.ts", + "fp/isBuffer.d.ts", + "fp/isDate.d.ts", + "fp/isElement.d.ts", + "fp/isEmpty.d.ts", + "fp/isEqual.d.ts", + "fp/isEqualWith.d.ts", + "fp/isError.d.ts", + "fp/isFinite.d.ts", + "fp/isFunction.d.ts", + "fp/isInteger.d.ts", + "fp/isLength.d.ts", + "fp/isMap.d.ts", + "fp/isMatch.d.ts", + "fp/isMatchWith.d.ts", + "fp/isNaN.d.ts", + "fp/isNative.d.ts", + "fp/isNil.d.ts", + "fp/isNull.d.ts", + "fp/isNumber.d.ts", + "fp/isObject.d.ts", + "fp/isObjectLike.d.ts", + "fp/isPlainObject.d.ts", + "fp/isRegExp.d.ts", + "fp/isSafeInteger.d.ts", + "fp/isSet.d.ts", + "fp/isString.d.ts", + "fp/isSymbol.d.ts", + "fp/isTypedArray.d.ts", + "fp/isUndefined.d.ts", + "fp/isWeakMap.d.ts", + "fp/isWeakSet.d.ts", + "fp/iteratee.d.ts", + "fp/join.d.ts", + "fp/juxt.d.ts", + "fp/kebabCase.d.ts", + "fp/keyBy.d.ts", + "fp/keys.d.ts", + "fp/keysIn.d.ts", + "fp/last.d.ts", + "fp/lastIndexOf.d.ts", + "fp/lastIndexOfFrom.d.ts", + "fp/lowerCase.d.ts", + "fp/lowerFirst.d.ts", + "fp/lt.d.ts", + "fp/lte.d.ts", + "fp/map.d.ts", + "fp/mapKeys.d.ts", + "fp/mapValues.d.ts", + "fp/matches.d.ts", + "fp/matchesProperty.d.ts", + "fp/max.d.ts", + "fp/maxBy.d.ts", + "fp/mean.d.ts", + "fp/meanBy.d.ts", + "fp/memoize.d.ts", + "fp/merge.d.ts", + "fp/mergeAll.d.ts", + "fp/mergeAllWith.d.ts", + "fp/mergeWith.d.ts", + "fp/method.d.ts", + "fp/methodOf.d.ts", + "fp/min.d.ts", + "fp/minBy.d.ts", + "fp/multiply.d.ts", + "fp/nAry.d.ts", + "fp/negate.d.ts", + "fp/noConflict.d.ts", + "fp/noop.d.ts", + "fp/now.d.ts", + "fp/nth.d.ts", + "fp/nthArg.d.ts", + "fp/omit.d.ts", + "fp/omitAll.d.ts", + "fp/omitBy.d.ts", + "fp/once.d.ts", + "fp/orderBy.d.ts", + "fp/over.d.ts", + "fp/overArgs.d.ts", + "fp/overEvery.d.ts", + "fp/overSome.d.ts", + "fp/pad.d.ts", + "fp/padChars.d.ts", + "fp/padCharsEnd.d.ts", + "fp/padCharsStart.d.ts", + "fp/padEnd.d.ts", + "fp/padStart.d.ts", + "fp/parseInt.d.ts", + "fp/partial.d.ts", + "fp/partialRight.d.ts", + "fp/partition.d.ts", + "fp/path.d.ts", + "fp/pathEq.d.ts", + "fp/pathOr.d.ts", + "fp/paths.d.ts", + "fp/pick.d.ts", + "fp/pickAll.d.ts", + "fp/pickBy.d.ts", + "fp/pipe.d.ts", + "fp/pluck.d.ts", + "fp/prop.d.ts", + "fp/propEq.d.ts", + "fp/property.d.ts", + "fp/propertyOf.d.ts", + "fp/propOr.d.ts", + "fp/props.d.ts", + "fp/pull.d.ts", + "fp/pullAll.d.ts", + "fp/pullAllBy.d.ts", + "fp/pullAllWith.d.ts", + "fp/pullAt.d.ts", + "fp/random.d.ts", + "fp/range.d.ts", + "fp/rangeRight.d.ts", + "fp/rangeStep.d.ts", + "fp/rangeStepRight.d.ts", + "fp/rearg.d.ts", + "fp/reduce.d.ts", + "fp/reduceRight.d.ts", + "fp/reject.d.ts", + "fp/remove.d.ts", + "fp/repeat.d.ts", + "fp/replace.d.ts", + "fp/rest.d.ts", + "fp/restFrom.d.ts", + "fp/result.d.ts", + "fp/reverse.d.ts", + "fp/round.d.ts", + "fp/runInContext.d.ts", + "fp/sample.d.ts", + "fp/sampleSize.d.ts", + "fp/set.d.ts", + "fp/setWith.d.ts", + "fp/shuffle.d.ts", + "fp/size.d.ts", + "fp/slice.d.ts", + "fp/snakeCase.d.ts", + "fp/some.d.ts", + "fp/sortBy.d.ts", + "fp/sortedIndex.d.ts", + "fp/sortedIndexBy.d.ts", + "fp/sortedIndexOf.d.ts", + "fp/sortedLastIndex.d.ts", + "fp/sortedLastIndexBy.d.ts", + "fp/sortedLastIndexOf.d.ts", + "fp/sortedUniq.d.ts", + "fp/sortedUniqBy.d.ts", + "fp/split.d.ts", + "fp/spread.d.ts", + "fp/spreadFrom.d.ts", + "fp/startCase.d.ts", + "fp/startsWith.d.ts", + "fp/stubArray.d.ts", + "fp/stubFalse.d.ts", + "fp/stubObject.d.ts", + "fp/stubString.d.ts", + "fp/stubTrue.d.ts", + "fp/subtract.d.ts", + "fp/sum.d.ts", + "fp/sumBy.d.ts", + "fp/symmetricDifference.d.ts", + "fp/symmetricDifferenceBy.d.ts", + "fp/symmetricDifferenceWith.d.ts", + "fp/T.d.ts", + "fp/tail.d.ts", + "fp/take.d.ts", + "fp/takeLast.d.ts", + "fp/takeLastWhile.d.ts", + "fp/takeRight.d.ts", + "fp/takeRightWhile.d.ts", + "fp/takeWhile.d.ts", + "fp/tap.d.ts", + "fp/template.d.ts", + "fp/throttle.d.ts", + "fp/thru.d.ts", + "fp/times.d.ts", + "fp/toArray.d.ts", + "fp/toFinite.d.ts", + "fp/toInteger.d.ts", + "fp/toLength.d.ts", + "fp/toLower.d.ts", + "fp/toNumber.d.ts", + "fp/toPairs.d.ts", + "fp/toPairsIn.d.ts", + "fp/toPath.d.ts", + "fp/toPlainObject.d.ts", + "fp/toSafeInteger.d.ts", + "fp/toString.d.ts", + "fp/toUpper.d.ts", + "fp/transform.d.ts", + "fp/trim.d.ts", + "fp/trimChars.d.ts", + "fp/trimCharsEnd.d.ts", + "fp/trimCharsStart.d.ts", + "fp/trimEnd.d.ts", + "fp/trimStart.d.ts", + "fp/truncate.d.ts", + "fp/unapply.d.ts", + "fp/unary.d.ts", + "fp/unescape.d.ts", + "fp/union.d.ts", + "fp/unionBy.d.ts", + "fp/unionWith.d.ts", + "fp/uniq.d.ts", + "fp/uniqBy.d.ts", + "fp/uniqueId.d.ts", + "fp/uniqWith.d.ts", + "fp/unnest.d.ts", + "fp/unset.d.ts", + "fp/unzip.d.ts", + "fp/unzipWith.d.ts", + "fp/update.d.ts", + "fp/updateWith.d.ts", + "fp/upperCase.d.ts", + "fp/upperFirst.d.ts", + "fp/useWith.d.ts", + "fp/values.d.ts", + "fp/valuesIn.d.ts", + "fp/where.d.ts", + "fp/whereEq.d.ts", + "fp/without.d.ts", + "fp/words.d.ts", + "fp/wrap.d.ts", + "fp/xor.d.ts", + "fp/xorBy.d.ts", + "fp/xorWith.d.ts", + "fp/zip.d.ts", + "fp/zipAll.d.ts", + "fp/zipObj.d.ts", + "fp/zipObject.d.ts", + "fp/zipObjectDeep.d.ts", + "fp/zipWith.d.ts" ] } \ No newline at end of file diff --git a/types/lodash/tslint.json b/types/lodash/tslint.json index 57df94df09..9457e4398f 100644 --- a/types/lodash/tslint.json +++ b/types/lodash/tslint.json @@ -2,20 +2,10 @@ "extends": "dtslint/dt.json", "rules": { // All are TODOs - "comment-format": [false], - "interface-over-type-literal": false, "jsdoc-format": false, "max-line-length": [false], - "no-namespace": false, "no-unnecessary-generics": false, - "no-void-expression": false, - "object-literal-key-quotes": false, - "one-line": false, - "prefer-const": false, - "semicolon": false, - "space-within-parens": false, "typedef-whitespace": [false], - "unified-signatures": false, - "whitespace": [false] + "unified-signatures": false } }