(feature) Rename _.indexBy to _.keyBy

This commit is contained in:
DomiR
2016-01-13 17:07:22 +01:00
parent 5abdddd2ab
commit b7f28d2d86
2 changed files with 139 additions and 139 deletions

View File

@@ -4384,8 +4384,8 @@ module TestIncludes {
}
}
// _.indexBy
module TestIndexBy {
// _.keyBy
module TestKeyBy {
type SampleObject = {a: number; b: string; c: boolean;};
let array: SampleObject[];
@@ -4401,131 +4401,131 @@ module TestIndexBy {
{
let result: _.Dictionary<string>;
result = _.indexBy<string>('abcd');
result = _.indexBy<string>('abcd', stringIterator);
result = _.indexBy<string>('abcd', stringIterator, any);
result = _.keyBy<string>('abcd');
result = _.keyBy<string>('abcd', stringIterator);
result = _.keyBy<string>('abcd', stringIterator, any);
}
{
let result: _.Dictionary<SampleObject>;
result = _.indexBy<SampleObject>(array);
result = _.indexBy<SampleObject>(array, listIterator);
result = _.indexBy<SampleObject>(array, listIterator, any);
result = _.indexBy<SampleObject>(array, 'a');
result = _.indexBy<SampleObject>(array, 'a', any);
result = _.indexBy<{a: number}, SampleObject>(array, {a: 42});
result = _.indexBy<SampleObject>(array, {a: 42});
result = _.keyBy<SampleObject>(array);
result = _.keyBy<SampleObject>(array, listIterator);
result = _.keyBy<SampleObject>(array, listIterator, any);
result = _.keyBy<SampleObject>(array, 'a');
result = _.keyBy<SampleObject>(array, 'a', any);
result = _.keyBy<{a: number}, SampleObject>(array, {a: 42});
result = _.keyBy<SampleObject>(array, {a: 42});
result = _.indexBy<SampleObject>(list);
result = _.indexBy<SampleObject>(list, listIterator);
result = _.indexBy<SampleObject>(list, listIterator, any);
result = _.indexBy<SampleObject>(list, 'a');
result = _.indexBy<SampleObject>(list, 'a', any);
result = _.indexBy<{a: number}, SampleObject>(list, {a: 42});
result = _.indexBy<SampleObject>(list, {a: 42});
result = _.keyBy<SampleObject>(list);
result = _.keyBy<SampleObject>(list, listIterator);
result = _.keyBy<SampleObject>(list, listIterator, any);
result = _.keyBy<SampleObject>(list, 'a');
result = _.keyBy<SampleObject>(list, 'a', any);
result = _.keyBy<{a: number}, SampleObject>(list, {a: 42});
result = _.keyBy<SampleObject>(list, {a: 42});
result = _.indexBy<SampleObject>(numericDictionary);
result = _.indexBy<SampleObject>(numericDictionary, numericDictionaryIterator);
result = _.indexBy<SampleObject>(numericDictionary, numericDictionaryIterator, any);
result = _.indexBy<SampleObject>(numericDictionary, 'a');
result = _.indexBy<SampleObject>(numericDictionary, 'a', any);
result = _.indexBy<{a: number}, SampleObject>(numericDictionary, {a: 42});
result = _.indexBy<SampleObject>(numericDictionary, {a: 42});
result = _.keyBy<SampleObject>(numericDictionary);
result = _.keyBy<SampleObject>(numericDictionary, numericDictionaryIterator);
result = _.keyBy<SampleObject>(numericDictionary, numericDictionaryIterator, any);
result = _.keyBy<SampleObject>(numericDictionary, 'a');
result = _.keyBy<SampleObject>(numericDictionary, 'a', any);
result = _.keyBy<{a: number}, SampleObject>(numericDictionary, {a: 42});
result = _.keyBy<SampleObject>(numericDictionary, {a: 42});
result = _.indexBy<SampleObject>(dictionary);
result = _.indexBy<SampleObject>(dictionary, dictionaryIterator);
result = _.indexBy<SampleObject>(dictionary, dictionaryIterator, any);
result = _.indexBy<SampleObject>(dictionary, 'a');
result = _.indexBy<SampleObject>(dictionary, 'a', any);
result = _.indexBy<{a: number}, SampleObject>(dictionary, {a: 42});
result = _.indexBy<SampleObject>(dictionary, {a: 42});
result = _.keyBy<SampleObject>(dictionary);
result = _.keyBy<SampleObject>(dictionary, dictionaryIterator);
result = _.keyBy<SampleObject>(dictionary, dictionaryIterator, any);
result = _.keyBy<SampleObject>(dictionary, 'a');
result = _.keyBy<SampleObject>(dictionary, 'a', any);
result = _.keyBy<{a: number}, SampleObject>(dictionary, {a: 42});
result = _.keyBy<SampleObject>(dictionary, {a: 42});
}
{
let result: _.LoDashImplicitObjectWrapper<_.Dictionary<string>>;
result = _('abcd').indexBy();
result = _('abcd').indexBy(stringIterator);
result = _('abcd').indexBy(stringIterator, any);
result = _('abcd').keyBy();
result = _('abcd').keyBy(stringIterator);
result = _('abcd').keyBy(stringIterator, any);
}
{
let result: _.LoDashImplicitObjectWrapper<_.Dictionary<SampleObject>>;
result = _(array).indexBy();
result = _(array).indexBy(listIterator);
result = _(array).indexBy(listIterator, any);
result = _(array).indexBy('a');
result = _(array).indexBy('a', any);
result = _(array).indexBy<{a: number}>({a: 42});
result = _(array).keyBy();
result = _(array).keyBy(listIterator);
result = _(array).keyBy(listIterator, any);
result = _(array).keyBy('a');
result = _(array).keyBy('a', any);
result = _(array).keyBy<{a: number}>({a: 42});
result = _(list).indexBy<SampleObject>();
result = _(list).indexBy<SampleObject>(listIterator);
result = _(list).indexBy<SampleObject>(listIterator, any);
result = _(list).indexBy<SampleObject>('a');
result = _(list).indexBy<SampleObject>('a', any);
result = _(list).indexBy<{a: number}, SampleObject>({a: 42});
result = _(list).indexBy<SampleObject>({a: 42});
result = _(list).keyBy<SampleObject>();
result = _(list).keyBy<SampleObject>(listIterator);
result = _(list).keyBy<SampleObject>(listIterator, any);
result = _(list).keyBy<SampleObject>('a');
result = _(list).keyBy<SampleObject>('a', any);
result = _(list).keyBy<{a: number}, SampleObject>({a: 42});
result = _(list).keyBy<SampleObject>({a: 42});
result = _(numericDictionary).indexBy<SampleObject>();
result = _(numericDictionary).indexBy<SampleObject>(numericDictionaryIterator);
result = _(numericDictionary).indexBy<SampleObject>(numericDictionaryIterator, any);
result = _(numericDictionary).indexBy<SampleObject>('a');
result = _(numericDictionary).indexBy<SampleObject>('a', any);
result = _(numericDictionary).indexBy<{a: number}, SampleObject>({a: 42});
result = _(numericDictionary).indexBy<SampleObject>({a: 42});
result = _(numericDictionary).keyBy<SampleObject>();
result = _(numericDictionary).keyBy<SampleObject>(numericDictionaryIterator);
result = _(numericDictionary).keyBy<SampleObject>(numericDictionaryIterator, any);
result = _(numericDictionary).keyBy<SampleObject>('a');
result = _(numericDictionary).keyBy<SampleObject>('a', any);
result = _(numericDictionary).keyBy<{a: number}, SampleObject>({a: 42});
result = _(numericDictionary).keyBy<SampleObject>({a: 42});
result = _(dictionary).indexBy<SampleObject>();
result = _(dictionary).indexBy<SampleObject>(dictionaryIterator);
result = _(dictionary).indexBy<SampleObject>(dictionaryIterator, any);
result = _(dictionary).indexBy<SampleObject>('a');
result = _(dictionary).indexBy<SampleObject>('a', any);
result = _(dictionary).indexBy<{a: number}, SampleObject>({a: 42});
result = _(dictionary).indexBy<SampleObject>({a: 42});
result = _(dictionary).keyBy<SampleObject>();
result = _(dictionary).keyBy<SampleObject>(dictionaryIterator);
result = _(dictionary).keyBy<SampleObject>(dictionaryIterator, any);
result = _(dictionary).keyBy<SampleObject>('a');
result = _(dictionary).keyBy<SampleObject>('a', any);
result = _(dictionary).keyBy<{a: number}, SampleObject>({a: 42});
result = _(dictionary).keyBy<SampleObject>({a: 42});
}
{
let result: _.LoDashExplicitObjectWrapper<_.Dictionary<string>>;
result = _('abcd').chain().indexBy();
result = _('abcd').chain().indexBy(stringIterator);
result = _('abcd').chain().indexBy(stringIterator, any);
result = _('abcd').chain().keyBy();
result = _('abcd').chain().keyBy(stringIterator);
result = _('abcd').chain().keyBy(stringIterator, any);
}
{
let result: _.LoDashExplicitObjectWrapper<_.Dictionary<SampleObject>>;
result = _(array).chain().indexBy();
result = _(array).chain().indexBy(listIterator);
result = _(array).chain().indexBy(listIterator, any);
result = _(array).chain().indexBy('a');
result = _(array).chain().indexBy('a', any);
result = _(array).chain().indexBy<{a: number}>({a: 42});
result = _(array).chain().keyBy();
result = _(array).chain().keyBy(listIterator);
result = _(array).chain().keyBy(listIterator, any);
result = _(array).chain().keyBy('a');
result = _(array).chain().keyBy('a', any);
result = _(array).chain().keyBy<{a: number}>({a: 42});
result = _(list).chain().indexBy<SampleObject>();
result = _(list).chain().indexBy<SampleObject>(listIterator);
result = _(list).chain().indexBy<SampleObject>(listIterator, any);
result = _(list).chain().indexBy<SampleObject>('a');
result = _(list).chain().indexBy<SampleObject>('a', any);
result = _(list).chain().indexBy<{a: number}, SampleObject>({a: 42});
result = _(list).chain().indexBy<SampleObject>({a: 42});
result = _(list).chain().keyBy<SampleObject>();
result = _(list).chain().keyBy<SampleObject>(listIterator);
result = _(list).chain().keyBy<SampleObject>(listIterator, any);
result = _(list).chain().keyBy<SampleObject>('a');
result = _(list).chain().keyBy<SampleObject>('a', any);
result = _(list).chain().keyBy<{a: number}, SampleObject>({a: 42});
result = _(list).chain().keyBy<SampleObject>({a: 42});
result = _(numericDictionary).chain().indexBy<SampleObject>();
result = _(numericDictionary).chain().indexBy<SampleObject>(numericDictionaryIterator);
result = _(numericDictionary).chain().indexBy<SampleObject>(numericDictionaryIterator, any);
result = _(numericDictionary).chain().indexBy<SampleObject>('a');
result = _(numericDictionary).chain().indexBy<SampleObject>('a', any);
result = _(numericDictionary).chain().indexBy<{a: number}, SampleObject>({a: 42});
result = _(numericDictionary).chain().indexBy<SampleObject>({a: 42});
result = _(numericDictionary).chain().keyBy<SampleObject>();
result = _(numericDictionary).chain().keyBy<SampleObject>(numericDictionaryIterator);
result = _(numericDictionary).chain().keyBy<SampleObject>(numericDictionaryIterator, any);
result = _(numericDictionary).chain().keyBy<SampleObject>('a');
result = _(numericDictionary).chain().keyBy<SampleObject>('a', any);
result = _(numericDictionary).chain().keyBy<{a: number}, SampleObject>({a: 42});
result = _(numericDictionary).chain().keyBy<SampleObject>({a: 42});
result = _(dictionary).chain().indexBy<SampleObject>();
result = _(dictionary).chain().indexBy<SampleObject>(dictionaryIterator);
result = _(dictionary).chain().indexBy<SampleObject>(dictionaryIterator, any);
result = _(dictionary).chain().indexBy<SampleObject>('a');
result = _(dictionary).chain().indexBy<SampleObject>('a', any);
result = _(dictionary).chain().indexBy<{a: number}, SampleObject>({a: 42});
result = _(dictionary).chain().indexBy<SampleObject>({a: 42});
result = _(dictionary).chain().keyBy<SampleObject>();
result = _(dictionary).chain().keyBy<SampleObject>(dictionaryIterator);
result = _(dictionary).chain().keyBy<SampleObject>(dictionaryIterator, any);
result = _(dictionary).chain().keyBy<SampleObject>('a');
result = _(dictionary).chain().keyBy<SampleObject>('a', any);
result = _(dictionary).chain().keyBy<{a: number}, SampleObject>({a: 42});
result = _(dictionary).chain().keyBy<SampleObject>({a: 42});
}
}

92
lodash/lodash.d.ts vendored
View File

@@ -19,7 +19,7 @@ TODO:
- [x] Removed _.pluck in favor of _.map with iteratee shorthand
- [x] Renamed _.first to _.head
- [ ] Renamed _.indexBy to _.keyBy
- [x] Renamed _.indexBy to _.keyBy
- [ ] Renamed _.invoke to _.invokeMap
- [ ] Renamed _.modArgs to _.overArgs
- [ ] Renamed _.padLeft & _.padRight to _.padStart & _.padEnd
@@ -208,7 +208,7 @@ declare module _ {
* after, assign, bind, bindAll, bindKey, chain, chunk, compact, compose, concat, countBy,
* createCallback, curry, debounce, defaults, defer, delay, difference, filter, flatten,
* forEach, forEachRight, forIn, forInRight, forOwn, forOwnRight, functions, groupBy,
* indexBy, initial, intersection, invert, invoke, keys, map, max, memoize, merge, min,
* keyBy, initial, intersection, invert, invoke, keys, map, max, memoize, merge, min,
* object, omit, once, pairs, partial, partialRight, pick, pluck, pull, push, range, reject,
* remove, rest, reverse, sample, shuffle, slice, sort, sortBy, splice, tap, throttle, times,
* toArray, transform, union, uniq, unshift, unzip, values, where, without, wrap, and zip
@@ -6732,7 +6732,7 @@ declare module _ {
): LoDashExplicitWrapper<boolean>;
}
//_.indexBy
//_.keyBy
interface LoDashStatic {
/**
* Creates an object composed of keys generated from the results of running each element of collection through
@@ -6754,51 +6754,51 @@ declare module _ {
* @param thisArg The this binding of iteratee.
* @return Returns the composed aggregate object.
*/
indexBy<T>(
keyBy<T>(
collection: List<T>,
iteratee?: ListIterator<T, any>,
thisArg?: any
): Dictionary<T>;
/**
* @see _.indexBy
* @see _.keyBy
*/
indexBy<T>(
keyBy<T>(
collection: NumericDictionary<T>,
iteratee?: NumericDictionaryIterator<T, any>,
thisArg?: any
): Dictionary<T>;
/**
* @see _.indexBy
* @see _.keyBy
*/
indexBy<T>(
keyBy<T>(
collection: Dictionary<T>,
iteratee?: DictionaryIterator<T, any>,
thisArg?: any
): Dictionary<T>;
/**
* @see _.indexBy
* @see _.keyBy
*/
indexBy<T>(
keyBy<T>(
collection: List<T>|NumericDictionary<T>|Dictionary<T>,
iteratee?: string,
thisArg?: any
): Dictionary<T>;
/**
* @see _.indexBy
* @see _.keyBy
*/
indexBy<W extends Object, T>(
keyBy<W extends Object, T>(
collection: List<T>|NumericDictionary<T>|Dictionary<T>,
iteratee?: W
): Dictionary<T>;
/**
* @see _.indexBy
* @see _.keyBy
*/
indexBy<T>(
keyBy<T>(
collection: List<T>|NumericDictionary<T>|Dictionary<T>,
iteratee?: Object
): Dictionary<T>;
@@ -6806,9 +6806,9 @@ declare module _ {
interface LoDashImplicitWrapper<T> {
/**
* @see _.indexBy
* @see _.keyBy
*/
indexBy(
keyBy(
iteratee?: ListIterator<T, any>,
thisArg?: any
): LoDashImplicitObjectWrapper<Dictionary<T>>;
@@ -6816,66 +6816,66 @@ declare module _ {
interface LoDashImplicitArrayWrapper<T> {
/**
* @see _.indexBy
* @see _.keyBy
*/
indexBy(
keyBy(
iteratee?: ListIterator<T, any>,
thisArg?: any
): LoDashImplicitObjectWrapper<Dictionary<T>>;
/**
* @see _.indexBy
* @see _.keyBy
*/
indexBy(
keyBy(
iteratee?: string,
thisArg?: any
): LoDashImplicitObjectWrapper<Dictionary<T>>;
/**
* @see _.indexBy
* @see _.keyBy
*/
indexBy<W extends Object>(
keyBy<W extends Object>(
iteratee?: W
): LoDashImplicitObjectWrapper<Dictionary<T>>;
}
interface LoDashImplicitObjectWrapper<T> {
/**
* @see _.indexBy
* @see _.keyBy
*/
indexBy<T>(
keyBy<T>(
iteratee?: ListIterator<T, any>|NumericDictionaryIterator<T, any>|DictionaryIterator<T, any>,
thisArg?: any
): LoDashImplicitObjectWrapper<Dictionary<T>>;
/**
* @see _.indexBy
* @see _.keyBy
*/
indexBy<T>(
keyBy<T>(
iteratee?: string,
thisArg?: any
): LoDashImplicitObjectWrapper<Dictionary<T>>;
/**
* @see _.indexBy
* @see _.keyBy
*/
indexBy<W extends Object, T>(
keyBy<W extends Object, T>(
iteratee?: W
): LoDashImplicitObjectWrapper<Dictionary<T>>;
/**
* @see _.indexBy
* @see _.keyBy
*/
indexBy<T>(
keyBy<T>(
iteratee?: Object
): LoDashImplicitObjectWrapper<Dictionary<T>>;
}
interface LoDashExplicitWrapper<T> {
/**
* @see _.indexBy
* @see _.keyBy
*/
indexBy(
keyBy(
iteratee?: ListIterator<T, any>,
thisArg?: any
): LoDashExplicitObjectWrapper<Dictionary<T>>;
@@ -6883,57 +6883,57 @@ declare module _ {
interface LoDashExplicitArrayWrapper<T> {
/**
* @see _.indexBy
* @see _.keyBy
*/
indexBy(
keyBy(
iteratee?: ListIterator<T, any>,
thisArg?: any
): LoDashExplicitObjectWrapper<Dictionary<T>>;
/**
* @see _.indexBy
* @see _.keyBy
*/
indexBy(
keyBy(
iteratee?: string,
thisArg?: any
): LoDashExplicitObjectWrapper<Dictionary<T>>;
/**
* @see _.indexBy
* @see _.keyBy
*/
indexBy<W extends Object>(
keyBy<W extends Object>(
iteratee?: W
): LoDashExplicitObjectWrapper<Dictionary<T>>;
}
interface LoDashExplicitObjectWrapper<T> {
/**
* @see _.indexBy
* @see _.keyBy
*/
indexBy<T>(
keyBy<T>(
iteratee?: ListIterator<T, any>|NumericDictionaryIterator<T, any>|DictionaryIterator<T, any>,
thisArg?: any
): LoDashExplicitObjectWrapper<Dictionary<T>>;
/**
* @see _.indexBy
* @see _.keyBy
*/
indexBy<T>(
keyBy<T>(
iteratee?: string,
thisArg?: any
): LoDashExplicitObjectWrapper<Dictionary<T>>;
/**
* @see _.indexBy
* @see _.keyBy
*/
indexBy<W extends Object, T>(
keyBy<W extends Object, T>(
iteratee?: W
): LoDashExplicitObjectWrapper<Dictionary<T>>;
/**
* @see _.indexBy
* @see _.keyBy
*/
indexBy<T>(
keyBy<T>(
iteratee?: Object
): LoDashExplicitObjectWrapper<Dictionary<T>>;
}