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
+2 -1
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
+2 -1
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
+2 -1
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
+2 -1
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
+2 -1
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
+2 -1
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
+2 -1
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.
+2 -1
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.
+2 -1
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
+2 -1
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
+2 -1
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.
+2 -1
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
+2 -1
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.
+2 -1
View File
@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
first: typeof _.head; // tslint:disable-line:no-unnecessary-qualifier
}
+2 -1
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
+2 -1
View File
@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
/**
* Recursively flattens a nested array.
+2 -1
View File
@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
/**
* Recursively flatten array up to depth times.
+2 -1
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
+2 -1
View File
@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
/**
* Gets the first element of array.
+2 -1
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`
+2 -1
View File
@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
/**
* Gets all but the last element of array.
+2 -1
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
+2 -1
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`
+2 -1
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
+2 -1
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`.
+2 -1
View File
@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
/**
* Gets the last element of array.
+2 -1
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.
+2 -1
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.
+2 -1
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.
+2 -1
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.
+2 -1
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
+2 -1
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
+2 -1
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.
+2 -1
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
+2 -1
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
+2 -1
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.
+2 -1
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
+2 -1
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
+2 -1
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
+2 -1
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
+2 -1
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`
+2 -1
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
+2 -1
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
+2 -1
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
+2 -1
View File
@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
/**
* Gets all but the first element of array.
+2 -1
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.
+2 -1
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.
+2 -1
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
+2 -1
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
+2 -1
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
+2 -1
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
+2 -1
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
+2 -1
View File
@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
/**
* Creates a duplicate-free version of an array, using
+2 -1
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
+2 -1
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
+2 -1
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
+2 -1
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
+2 -1
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.
+2 -1
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.
+2 -1
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
+2 -1
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
+2 -1
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,
+2 -1
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
+2 -1
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.
+2 -1
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
+2 -1
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
+2 -1
View File
@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
each: typeof _.forEach; // tslint:disable-line:no-unnecessary-qualifier
}
+2 -1
View File
@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
eachRight: typeof _.forEachRight; // tslint:disable-line:no-unnecessary-qualifier
}
+2 -1
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
+2 -1
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
+2 -1
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.
+2 -1
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
+2 -1
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
+2 -1
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
+2 -1
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
+2 -1
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
+2 -1
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.
+2 -1
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
+2 -1
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,
+2 -1
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
+2 -1
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
+2 -1
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
+2 -1
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
+2 -1
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,
+2 -1
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
+2 -1
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
+2 -1
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
+2 -1
View File
@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface LoDashStatic {
/**
* Gets a random element from collection.
+2 -1
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.
+2 -1
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.
+2 -1
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
+2 -1
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
+2 -1
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
+4 -3
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 {
/**
+2 -1
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).
+2 -1
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.
+2 -1
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.
+2 -1
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
+2 -1
View File
@@ -1,4 +1,5 @@
declare namespace _ {
import * as _ from "..";
declare module ".." {
interface FunctionBind {
placeholder: any;
+2 -1
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