lodash: Use module augmentation instead of namespace augmentation to avoid declaring _ as a global variable (#23164)

This commit is contained in:
Andy
2018-01-24 11:17:18 -08:00
committed by GitHub
parent d2d44d9032
commit 0f4014dbf9
316 changed files with 638 additions and 317 deletions

View File

@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
/**
* Creates an array of elements split into groups the length of size. If collection cant be split evenly, the

View File

@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
/**
* Creates an array with all falsey values removed. The values false, null, 0, "", undefined, and NaN are

View File

@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
/**
* Creates a new array concatenating `array` with any additional arrays

View File

@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
/**
* Creates an array of unique array values not included in the other provided arrays using SameValueZero for

View File

@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
/**
* This method is like _.difference except that it accepts iteratee which is invoked for each element of array

View File

@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
/**
* Creates an array of unique `array` values not included in the other

View File

@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
/**
* Creates a slice of array with n elements dropped from the beginning.

View File

@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
/**
* Creates a slice of array with n elements dropped from the end.

View File

@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
/**
* Creates a slice of array excluding elements dropped from the end. Elements are dropped until predicate

View File

@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
/**
* Creates a slice of array excluding elements dropped from the beginning. Elements are dropped until predicate

View File

@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
/**
* Fills elements of array with value from start up to, but not including, end.

View File

@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
/**
* This method is like _.find except that it returns the index of the first element predicate returns truthy

View File

@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
/**
* This method is like _.findIndex except that it iterates over elements of collection from right to left.

View File

@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
first: typeof _.head; // tslint:disable-line:no-unnecessary-qualifier
}

View File

@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
/**
* Flattens a nested array. If isDeep is true the array is recursively flattened, otherwise its only

View File

@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
/**
* Recursively flattens a nested array.

View File

@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
/**
* Recursively flatten array up to depth times.

View File

@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
/**
* The inverse of `_.toPairs`; this method returns an object composed

View File

@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
/**
* Gets the first element of array.

View File

@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
/**
* Gets the index at which the first occurrence of `value` is found in `array`

View File

@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
/**
* Gets all but the last element of array.

View File

@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
/**
* Creates an array of unique values that are included in all of the provided arrays using SameValueZero for

View File

@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
/**
* This method is like `_.intersection` except that it accepts `iteratee`

View File

@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
/**
* Creates an array of unique `array` values not included in the other

View File

@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
/**
* Converts all elements in `array` into a string separated by `separator`.

View File

@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
/**
* Gets the last element of array.

View File

@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
/**
* This method is like _.indexOf except that it iterates over elements of array from right to left.

View File

@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
/**
* Gets the element at index `n` of `array`. If `n` is negative, the nth element from the end is returned.

View File

@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
/**
* Removes all provided values from array using SameValueZero for equality comparisons.

View File

@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
/**
* This method is like `_.pull` except that it accepts an array of values to remove.

View File

@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
/**
* This method is like `_.pullAll` except that it accepts `iteratee` which is

View File

@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
/**
* This method is like `_.pullAll` except that it accepts `comparator` which is

View File

@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
/**
* Removes elements from array corresponding to the given indexes and returns an array of the removed elements.

View File

@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
/**
* Removes all elements from array that predicate returns truthy for and returns an array of the removed

View File

@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
/**
* Reverses `array` so that the first element becomes the last, the second

View File

@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
/**
* Creates a slice of array from start up to, but not including, end.

View File

@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
/**
* Uses a binary search to determine the lowest index at which `value` should

View File

@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
/**
* Uses a binary search to determine the lowest index at which `value` should

View File

@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
/**
* This method is like `_.indexOf` except that it performs a binary

View File

@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
/**
* This method is like `_.sortedIndex` except that it returns the highest

View File

@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
/**
* This method is like `_.sortedLastIndex` except that it accepts `iteratee`

View File

@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
/**
* This method is like `_.lastIndexOf` except that it performs a binary

View File

@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
/**
* This method is like `_.uniq` except that it's designed and optimized

View File

@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
/**
* This method is like `_.uniqBy` except that it's designed and optimized

View File

@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
/**
* Gets all but the first element of array.

View File

@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
/**
* Creates a slice of array with n elements taken from the beginning.

View File

@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
/**
* Creates a slice of array with n elements taken from the end.

View File

@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
/**
* Creates a slice of array with elements taken from the end. Elements are taken until predicate returns

View File

@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
/**
* Creates a slice of array with elements taken from the beginning. Elements are taken until predicate returns

View File

@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
/**
* Creates an array of unique values, in order, from all of the provided arrays using SameValueZero for

View File

@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
/**
* This method is like `_.union` except that it accepts `iteratee` which is

View File

@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
/**
* This method is like `_.union` except that it accepts `comparator` which

View File

@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
/**
* Creates a duplicate-free version of an array, using

View File

@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
/**
* This method is like `_.uniq` except that it accepts `iteratee` which is

View File

@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
/**
* This method is like `_.uniq` except that it accepts `comparator` which

View File

@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
/**
* This method is like _.zip except that it accepts an array of grouped elements and creates an array

View File

@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
/**
* This method is like _.unzip except that it accepts an iteratee to specify how regrouped values should be

View File

@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
/**
* Creates an array excluding all provided values using SameValueZero for equality comparisons.

View File

@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
/**
* Creates an array of unique values that is the symmetric difference of the provided arrays.

View File

@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
/**
* This method is like `_.xor` except that it accepts `iteratee` which is

View File

@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
/**
* This method is like `_.xor` except that it accepts `comparator` which is

View File

@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
/**
* Creates an array of grouped elements, the first of which contains the first elements of the given arrays,

View File

@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
/**
* This method is like _.fromPairs except that it accepts two arrays, one of property

View File

@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
/**
* This method is like _.zipObject except that it supports property paths.

View File

@@ -1,4 +1,5 @@
declare namespace _ {
import _ = require("..");
declare module ".." {
interface LoDashStatic {
/**
* This method is like _.zip except that it accepts an iteratee to specify how grouped values should be

View File

@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
/**
* Creates an object composed of keys generated from the results of running each element of collection through

View File

@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
each: typeof _.forEach; // tslint:disable-line:no-unnecessary-qualifier
}

View File

@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
eachRight: typeof _.forEachRight; // tslint:disable-line:no-unnecessary-qualifier
}

View File

@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
/**
* Checks if predicate returns truthy for all elements of collection. Iteration is stopped once predicate

View File

@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
/**
* Iterates over elements of collection, returning an array of all elements predicate returns truthy for. The

View File

@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
/**
* Iterates over elements of collection, returning the first element predicate returns truthy for.

View File

@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
/**
* This method is like _.find except that it iterates over elements of a collection from

View File

@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
/**
* Creates an array of flattened values by running each element in collection through iteratee

View File

@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
/**
* This method is like `_.flatMap` except that it recursively flattens the

View File

@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
/**
* This method is like `_.flatMap` except that it recursively flattens the

View File

@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
/**
* Iterates over elements of collection invoking iteratee for each element. The iteratee is bound to thisArg

View File

@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
/**
* This method is like _.forEach except that it iterates over elements of collection from right to left.

View File

@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
/**
* Creates an object composed of keys generated from the results of running each element of collection through

View File

@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
/**
* Checks if target is in collection using SameValueZero for equality comparisons. If fromIndex is negative,

View File

@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
/**
* Invokes the method named by methodName on each element in the collection returning

View File

@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
/**
* Creates an object composed of keys generated from the results of running each element of collection through

View File

@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
/**
* Creates an array of values by running each element in collection through iteratee. The iteratee is bound to

View File

@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
/**
* This method is like `_.sortBy` except that it allows specifying the sort

View File

@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
/**
* Creates an array of elements split into two groups, the first of which contains elements predicate returns truthy for,

View File

@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
/**
* Reduces a collection to a value which is the accumulated result of running each

View File

@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
/**
* This method is like _.reduce except that it iterates over elements of a collection from

View File

@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
/**
* The opposite of _.filter; this method returns the elements of collection that predicate does not return

View File

@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
/**
* Gets a random element from collection.

View File

@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
/**
* Gets n random elements at unique keys from collection up to the size of collection.

View File

@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
/**
* Creates an array of shuffled values, using a version of the Fisher-Yates shuffle.

View File

@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
/**
* Gets the size of collection by returning its length for array-like values or the number of own enumerable

View File

@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
/**
* Checks if predicate returns truthy for any element of collection. Iteration is stopped once predicate

View File

@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
/**
* Creates an array of elements, sorted in ascending order by the results of

View File

@@ -1,6 +1,7 @@
declare let _: _.LoDashStatic;
type PartialObject<T> = Partial<T>;
declare namespace _ {
import * as _ from "..";
type GlobalPartial<T> = Partial<T>;
declare module ".." {
type PartialObject<T> = GlobalPartial<T>;
type Many<T> = T | T[];
interface LoDashStatic {
/**

View File

@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
/**
* Gets the number of milliseconds that have elapsed since the Unix epoch (1 January 1970 00:00:00 UTC).

View File

@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
/**
* The opposite of _.before; this method creates a function that invokes func once its called n or more times.

View File

@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
/**
* Creates a function that accepts up to n arguments ignoring any additional arguments.

View File

@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
/**
* Creates a function that invokes func, with the this binding and arguments of the created function, while

View File

@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface FunctionBind {
placeholder: any;

View File

@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface FunctionBindKey {
placeholder: any;

Some files were not shown because too many files have changed in this diff Show More