(feature) Fist step to upgrade lodash to 4.0.0

This commit is contained in:
DomiR
2016-01-23 14:39:10 +01:00
parent 0bc09e91dd
commit 808a31e15f
11 changed files with 25265 additions and 248 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
/// <reference path="../jquery/jquery.d.ts" />
/// <reference path="../lodash/lodash.d.ts" />
/// <reference path='../lodash/lodash-3.10.d.ts' />
/// <reference path="./backbone-global.d.ts" />
function test_events() {
+1 -1
View File
@@ -4,7 +4,7 @@
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../bluebird/bluebird.d.ts" />
/// <reference path="../lodash/lodash.d.ts" />
/// <reference path='../lodash/lodash-3.10.d.ts' />
/// <reference path="../knex/knex.d.ts" />
declare module 'bookshelf' {
+1 -1
View File
@@ -1,5 +1,5 @@
/// <reference path='knex.d.ts' />
/// <reference path='../lodash/lodash.d.ts' />
/// <reference path='../lodash/lodash-3.10.d.ts' />
import Knex = require('knex');
import _ = require('lodash');
'use strict';
+1 -1
View File
@@ -1,5 +1,5 @@
/// <reference path="lodash-decorators.d.ts" />
/// <reference path="../lodash/lodash.d.ts" />
/// <reference path='../lodash/lodash-3.10.d.ts' />
//
// With Arguments
+1 -1
View File
@@ -3,7 +3,7 @@
// Definitions by: Qubo <https://github.com/tkqubo>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
///<reference path="../lodash/lodash.d.ts"/>
/// <reference path='../lodash/lodash-3.10.d.ts' />
declare module "lodash-decorators" {
+14991
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+63 -75
View File
@@ -3941,12 +3941,6 @@ module TestFind {
result = _(dictionary).find<{a: number}, TResult>({a: 42});
}
result = <number>_.findWhere([1, 2, 3, 4], function (num) {
return num % 2 == 0;
});
result = <IFoodCombined>_.findWhere(foodsCombined, { 'type': 'vegetable' });
result = <IFoodCombined>_.findWhere(foodsCombined, 'organic');
result = <number>_.findLast([1, 2, 3, 4], function (num) {
return num % 2 == 0;
});
@@ -4657,68 +4651,69 @@ result = <{a: number}[][]>_([{a: 1}, {a: 2}]).partition('a', 2).value();
result = <{a: number}[][]>_({0: {a: 1}, 1: {a: 2}}).partition<{a: number}>('a').value();
result = <{a: number}[][]>_({0: {a: 1}, 1: {a: 2}}).partition<{a: number}>('a', 2).value();
// _.pluck
module TestPluck {
interface SampleObject {
d: {b: TResult}[];
}
let array: SampleObject[];
let list: _.List<SampleObject>;
let dictionary: _.Dictionary<SampleObject>;
{
let result: any[];
result = _.pluck<SampleObject>(array, 'd.0.b');
result = _.pluck<SampleObject>(array, ['d', 0, 'b']);
result = _.pluck<SampleObject>(list, 'd.0.b');
result = _.pluck<SampleObject>(list, ['d', 0, 'b']);
result = _.pluck<SampleObject>(dictionary, 'd.0.b');
result = _.pluck<SampleObject>(dictionary, ['d', 0, 'b']);
}
{
let result: TResult[];
result = _.pluck<SampleObject, TResult>(array, 'd.0.b');
result = _.pluck<SampleObject, TResult>(array, ['d', 0, 'b']);
result = _.pluck<SampleObject, TResult>(list, 'd.0.b');
result = _.pluck<SampleObject, TResult>(list, ['d', 0, 'b']);
result = _.pluck<SampleObject, TResult>(dictionary, 'd.0.b');
result = _.pluck<SampleObject, TResult>(dictionary, ['d', 0, 'b']);
}
{
let result: _.LoDashImplicitArrayWrapper<TResult>;
result = _(array).pluck<TResult>('d.0.b');
result = _(array).pluck<TResult>(['d', 0, 'b']);
result = _(list).pluck<TResult>('d.0.b');
result = _(list).pluck<TResult>(['d', 0, 'b']);
result = _(dictionary).pluck<TResult>('d.0.b');
result = _(dictionary).pluck<TResult>(['d', 0, 'b']);
}
{
let result: _.LoDashExplicitArrayWrapper<TResult>;
result = _(array).chain().pluck<TResult>('d.0.b');
result = _(array).chain().pluck<TResult>(['d', 0, 'b']);
result = _(list).chain().pluck<TResult>('d.0.b');
result = _(list).chain().pluck<TResult>(['d', 0, 'b']);
result = _(dictionary).chain().pluck<TResult>('d.0.b');
result = _(dictionary).chain().pluck<TResult>(['d', 0, 'b']);
}
}
// TODO
// _.map with iteratee shorthand
// module TestMapInsteadOfPluck {
// interface SampleObject {
// d: {b: TResult}[];
// }
//
// let array: SampleObject[];
// let list: _.List<SampleObject>;
// let dictionary: _.Dictionary<SampleObject>;
//
// {
// let result: any[];
//
// result = _.map<SampleObject>(array, 'd.0.b');
// result = _.map<SampleObject>(array, ['d', 0, 'b']);
//
// result = _.map<SampleObject>(list, 'd.0.b');
// result = _.map<SampleObject>(list, ['d', 0, 'b']);
//
// result = _.map<SampleObject>(dictionary, 'd.0.b');
// result = _.map<SampleObject>(dictionary, ['d', 0, 'b']);
// }
//
// {
// let result: TResult[];
//
// result = _.map<SampleObject, TResult>(array, 'd.0.b');
// result = _.map<SampleObject, TResult>(array, ['d', 0, 'b']);
//
// result = _.map<SampleObject, TResult>(list, 'd.0.b');
// result = _.map<SampleObject, TResult>(list, ['d', 0, 'b']);
//
// result = _.map<SampleObject, TResult>(dictionary, 'd.0.b');
// result = _.map<SampleObject, TResult>(dictionary, ['d', 0, 'b']);
// }
//
// {
// let result: _.LoDashImplicitArrayWrapper<TResult>;
//
// result = _(array).map<TResult>('d.0.b');
// result = _(array).map<TResult>(['d', 0, 'b']);
//
// result = _(list).map<TResult>('d.0.b');
// result = _(list).map<TResult>(['d', 0, 'b']);
//
// result = _(dictionary).map<TResult>('d.0.b');
// result = _(dictionary).map<TResult>(['d', 0, 'b']);
// }
//
// {
// let result: _.LoDashExplicitArrayWrapper<TResult>;
//
// result = _(array).chain().map<TResult>('d.0.b');
// result = _(array).chain().map<TResult>(['d', 0, 'b']);
//
// result = _(list).chain().map<TResult>('d.0.b');
// result = _(list).chain().map<TResult>(['d', 0, 'b']);
//
// result = _(dictionary).chain().map<TResult>('d.0.b');
// result = _(dictionary).chain().map<TResult>(['d', 0, 'b']);
// }
// }
interface ABC {
[index: string]: number;
@@ -5386,12 +5381,6 @@ module TestSortByOrder {
}
}
result = <IStoogesCombined[]>_.where(stoogesCombined, { 'age': 40 });
result = <IStoogesCombined[]>_.where(stoogesCombined, { 'quotes': ['Poifect!'] });
result = <IStoogesCombined[]>_(stoogesCombined).where({ 'age': 40 }).value();
result = <IStoogesCombined[]>_(stoogesCombined).where({ 'quotes': ['Poifect!'] }).value();
/********
* Date *
********/
@@ -9992,7 +9981,6 @@ module TestUniqueId {
}
result = <string>_.VERSION;
result = <_.Support>_.support;
result = <_.TemplateSettings>_.templateSettings;
// _.partial & _.partialRight
+188 -166
View File
@@ -3,6 +3,194 @@
// Definitions by: Brian Zengel <https://github.com/bczengel>, Ilya Mochalov <https://github.com/chrootsu>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/**
# 4.0.0 Changelog (https://github.com/lodash/lodash/wiki/Changelog)
TODO:
- [ ] Made _.forEach, _.forIn, _.forOwn, & _.times implicitly end a chain sequence
- [ ] Removed _.pluck in favor of _.map with iteratee shorthand
- [ ] Removed thisArg params from most methods
- [ ] Split _.max & _.min into _.maxBy & _.minBy
- [x] Removed _.support
- [x] Removed _.findWhere in favor of _.find with iteratee shorthand
- [x] Removed _.where in favor of _.filter with iteratee shorthand
- [x] Removed _.pluck in favor of _.map with iteratee shorthand
- [ ] Renamed _.first to _.head
- [ ] Renamed _.indexBy to _.keyBy
- [ ] Renamed _.invoke to _.invokeMap
- [ ] Renamed _.modArgs to _.overArgs
- [ ] Renamed _.padLeft & _.padRight to _.padStart & _.padEnd
- [ ] Renamed _.pairs to _.toPairs
- [ ] Renamed _.rest to _.tail
- [ ] Renamed _.restParam to _.rest
- [ ] Renamed _.sortByOrder to _.orderBy
- [ ] Renamed _.trimLeft & _.trimRight to _.trimStart & _.trimEnd
- [ ] Renamed _.trunc to _.truncate
- [ ] Split _.indexOf & _.lastIndexOf into _.sortedIndexOf & _.sortedLastIndexOf
- [ ] Split _.max & _.min into _.maxBy & _.minBy
- [ ] Split _.omit & _.pick into _.omitBy & _.pickBy
- [ ] Split _.sample into _.sampleSize
- [ ] Split _.sortedIndex into _.sortedIndexBy
- [ ] Split _.sortedLastIndex into _.sortedLastIndexBy
- [ ] Split _.uniq into _.sortedUniq, _.sortedUniqBy, & _.uniqBy
- [ ] Absorbed _.sortByAll into _.sortBy
- [ ] Changed the category of _.at to Object
- [ ] Changed the category of _.bindAll to Utility
- [ ] Made By methods provide a single param to iteratees
- [ ] Made _.capitalize uppercase the first character & lowercase the rest
- [ ] Made _.functions return only own method names
- [ ] Made _.words chainable by default
- [ ] Removed isDeep params from _.clone & _.flatten
- [ ] Removed _.bindAll support for binding all methods when no names are provided
- [ ] Removed func-first param signature from _.before & _.after
added 23 array methods:
- [ ] _.concat,
- [ ] _.differenceBy,
- [ ] _.differenceWith,
- [ ] _.flatMap,
- [ ] _.fromPairs,
- [ ] _.intersectionBy,
- [ ] _.intersectionWith,
- [ ] _.join,
- [ ] _.pullAll,
- [ ] _.pullAllBy,
- [ ] _.reverse,
- [ ] _.sortedIndexBy,
- [ ] _.sortedIndexOf,
- [ ] _.sortedLastIndexBy,
- [ ] _.sortedLastIndexOf,
- [ ] _.sortedUniq,
- [ ] _.sortedUniqBy,
- [ ] _.unionBy,
- [ ] _.unionWith,
- [ ] _.uniqBy,
- [ ] _.uniqWith,
- [ ] _.xorBy, &
- [ ] _.xorWith
added 18 lang methods:
- [ ] _.cloneDeepWith,
- [ ] _.cloneWith,
- [ ] _.eq,
- [ ] _.isArrayLike,
- [ ] _.isArrayLikeObject,
- [ ] _.isEqualWith,
- [ ] _.isInteger,
- [ ] _.isLength,
- [ ] _.isMatchWith,
- [ ] _.isNil,
- [ ] _.isObjectLike,
- [ ] _.isSafeInteger,
- [ ] _.isSymbol,
- [ ] _.toInteger,
- [ ] _.toLength,
- [ ] _.toNumber,
- [ ] _.toSafeInteger, &
- [ ] _.toString
added 13 object methods:
- [ ] _.assignIn,
- [ ] _.assignInWith,
- [ ] _.assignWith,
- [ ] _.functionsIn,
- [ ] _.hasIn,
- [ ] _.invoke,
- [ ] _.mergeWith,
- [ ] _.omitBy,
- [ ] _.pickBy,
- [ ] _.setWith,
- [ ] _.toPairs,
- [ ] _.toPairsIn, &
- [ ] _.unset
added 8 string methods:
- [ ] _.lowerCase,
- [ ] _.lowerFirst,
- [ ] _.replace,
- [ ] _.split,
- [ ] _.upperCase,
- [ ] _.upperFirst,
- [ ] _.toLower, &
- [ ] _.toUpper
added 8 utility methods:
- [ ] _.cond,
- [ ] _.conforms,
- [ ] _.nthArg,
- [ ] _.over,
- [ ] _.overEvery,
- [ ] _.overSome,
- [ ] _.rangeRight, &
- [ ] _.toPath
added 4 math methods:
- [ ] _.maxBy,
- [ ] _.mean,
- [ ] _.minBy, &
- [ ] _.sumBy
added 2 function methods:
- [ ] _.flip &
- [ ] _.unary
added 2 number methods:
- [ ] _.clamp &
- [ ] _.subtract
added chain method:
- [ ] _#next
added collection method:
- [ ] _.sampleSize
Added 3 aliases
- [ ] _.extend as an alias of _.assignIn
- [ ] _.extendWith as an alias of _.assignInWith
- [ ] _.first as an alias of _.head
Removed 17 aliases
- [ ] _.all, _.any, _.backflow, _.callback, _.collect, _.compose, _.contains, _.detect, _.foldl, _.foldr, _.include, _.inject, _.methods, _.object, _.#run, _.select, & _.unique
Other changes
- [ ] Added clear method to _.memoize.Cache
- [ ] Added flush method to debounced & throttled functions
- [ ] Added support for ES6 maps, sets, & symbols to _.clone, _.isEqual, & _.toArray
- [ ] Added support for array buffers to _.isEqual
- [ ] Added support for converting iterators to _.toArray
- [ ] Added support for deep paths to _.zipObject
- [ ] Changed UMD to export to window or self when available regardless of other exports
- [ ] Enabled _.flow & _.flowRight to accept an array of functions
- [ ] Ensured Collection methods treat functions as objects
- [ ] Ensured debounce cancel clears args & thisArg references
- [ ] Ensured _.add, _.subtract, & _.sum dont skip NaN values
- [ ] Ensured _.assign, _.defaults, & _.merge coerce object values to objects
- [ ] Ensured _.bindKey bound functions call object[key] when called with the new operator
- [ ] Ensured _.clone treats generators like functions
- [ ] Ensured _.clone produces clones with the sources [[Prototype]]
- [ ] Ensured _.defaults assigns properties that shadow Object.prototype
- [ ] Ensured _.defaultsDeep doesnt merge a string into an array
- [ ] Ensured _.defaultsDeep & _.merge dont modify sources
- [ ] Ensured _.defaultsDeep works with circular references
- [ ] Ensured _.isFunction returns true for generator functions
- [ ] Ensured _.keys skips length on strict mode arguments objects in Safari 9
- [ ] Ensured _.merge assigns typed arrays directly
- [ ] Ensured _.merge doesnt convert strings to arrays
- [ ] Ensured _.merge merges plain-objects onto non plain-objects
- [ ] Ensured _#plant resets iterator data of cloned sequences
- [ ] Ensured _.random swaps min & max if min is greater than max
- [ ] Ensured _.range preserves the sign of start of -0
- [ ] Ensured _.reduce & _.reduceRight use getIteratee in their array branch
- [ ] Fixed rounding issue with the precision param of _.floor
- [ ] Made _(...) an iterator & iterable
- [ ] Made _.drop, _.take, & right forms coerce n of undefined to 0
*/
declare var _: _.LoDashStatic;
declare module _ {
@@ -51,11 +239,6 @@ declare module _ {
**/
VERSION: string;
/**
* An object used to flag environments features.
**/
support: Support;
/**
* By default, the template delimiters used by Lo-Dash are similar to those in embedded Ruby
* (ERB). Change the following template settings to use alternative delimiters.
@@ -5871,81 +6054,6 @@ declare module _ {
): TResult;
}
//_.findWhere
interface LoDashStatic {
/**
* @see _.find
**/
findWhere<T>(
collection: Array<T>,
callback: ListIterator<T, boolean>,
thisArg?: any): T;
/**
* @see _.find
**/
findWhere<T>(
collection: List<T>,
callback: ListIterator<T, boolean>,
thisArg?: any): T;
/**
* @see _.find
**/
findWhere<T>(
collection: Dictionary<T>,
callback: DictionaryIterator<T, boolean>,
thisArg?: any): T;
/**
* @see _.find
* @param _.matches style callback
**/
findWhere<W, T>(
collection: Array<T>,
whereValue: W): T;
/**
* @see _.find
* @param _.matches style callback
**/
findWhere<W, T>(
collection: List<T>,
whereValue: W): T;
/**
* @see _.find
* @param _.matches style callback
**/
findWhere<W, T>(
collection: Dictionary<T>,
whereValue: W): T;
/**
* @see _.find
* @param _.property style callback
**/
findWhere<T>(
collection: Array<T>,
pluckValue: string): T;
/**
* @see _.find
* @param _.property style callback
**/
findWhere<T>(
collection: List<T>,
pluckValue: string): T;
/**
* @see _.find
* @param _.property style callback
**/
findWhere<T>(
collection: Dictionary<T>,
pluckValue: string): T;
}
//_.findLast
interface LoDashStatic {
/**
@@ -7276,57 +7384,6 @@ declare module _ {
pluckValue: string): LoDashImplicitArrayWrapper<TResult[]>;
}
//_.pluck
interface LoDashStatic {
/**
* Gets the property value of path from all elements in collection.
*
* @param collection The collection to iterate over.
* @param path The path of the property to pluck.
* @return A new array of property values.
*/
pluck<T extends {}>(
collection: List<T>|Dictionary<T>,
path: StringRepresentable|StringRepresentable[]
): any[];
/**
* @see _.pluck
*/
pluck<T extends {}, TResult>(
collection: List<T>|Dictionary<T>,
path: StringRepresentable|StringRepresentable[]
): TResult[];
}
interface LoDashImplicitArrayWrapper<T> {
/**
* @see _.pluck
*/
pluck<TResult>(path: StringRepresentable|StringRepresentable[]): LoDashImplicitArrayWrapper<TResult>;
}
interface LoDashImplicitObjectWrapper<T> {
/**
* @see _.pluck
*/
pluck<TResult>(path: StringRepresentable|StringRepresentable[]): LoDashImplicitArrayWrapper<TResult>;
}
interface LoDashExplicitArrayWrapper<T> {
/**
* @see _.pluck
*/
pluck<TResult>(path: StringRepresentable|StringRepresentable[]): LoDashExplicitArrayWrapper<TResult>;
}
interface LoDashExplicitObjectWrapper<T> {
/**
* @see _.pluck
*/
pluck<TResult>(path: StringRepresentable|StringRepresentable[]): LoDashExplicitArrayWrapper<TResult>;
}
//_.reduce
interface LoDashStatic {
/**
@@ -8909,41 +8966,6 @@ declare module _ {
): LoDashExplicitArrayWrapper<T>;
}
//_.where
interface LoDashStatic {
/**
* Performs a deep comparison of each element in a collection to the given properties
* object, returning an array of all elements that have equivalent property values.
* @param collection The collection to iterate over.
* @param properties The object of property values to filter by.
* @return A new array of elements that have the given properties.
**/
where<T, U extends {}>(
list: Array<T>,
properties: U): T[];
/**
* @see _.where
**/
where<T, U extends {}>(
list: List<T>,
properties: U): T[];
/**
* @see _.where
**/
where<T, U extends {}>(
list: Dictionary<T>,
properties: U): T[];
}
interface LoDashImplicitArrayWrapper<T> {
/**
* @see _.where
**/
where<U extends {}>(properties: U): LoDashImplicitArrayWrapper<T>;
}
/********
* Date *
********/
+1 -1
View File
@@ -6,7 +6,7 @@
// Based on original work by: samuelneff <https://github.com/samuelneff/sequelize-auto-ts/blob/master/lib/sequelize.d.ts>
/// <reference path="../node/node.d.ts" />
/// <reference path="../lodash/lodash.d.ts" />
/// <reference path='../lodash/lodash-3.10.d.ts' />
declare module "sequelize"
{
+1 -1
View File
@@ -5,7 +5,7 @@
// Based on original work by: samuelneff <https://github.com/samuelneff/sequelize-auto-ts/blob/master/lib/sequelize.d.ts>
/// <reference path="../lodash/lodash.d.ts" />
/// <reference path='../lodash/lodash-3.10.d.ts' />
/// <reference path="../bluebird/bluebird.d.ts" />
/// <reference path="../validator/validator.d.ts" />