From 618f01a953e24c808d820539fe0020bbbd029fce Mon Sep 17 00:00:00 2001 From: DomiR Date: Wed, 13 Jan 2016 23:18:31 +0100 Subject: [PATCH] (feature) Removed aliase _.unique --- lodash/lodash-tests.ts | 162 ------------ lodash/lodash.d.ts | 552 +++++++---------------------------------- 2 files changed, 89 insertions(+), 625 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index f1c04cb4f..ed873436a 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -2003,168 +2003,6 @@ module TestUniq { } } -// _.unique -module TestUnique { - type SampleObject = {a: number; b: string; c: boolean}; - - let array: SampleObject[]; - let list: _.List; - - let stringIterator: (value: string, index: number, collection: string) => string; - let listIterator: (value: SampleObject, index: number, collection: _.List) => number; - - { - let result: string[]; - - result = _.unique('abc'); - result = _.unique('abc', true); - result = _.unique('abc', true, stringIterator); - result = _.unique('abc', true, stringIterator, any); - result = _.unique('abc', true, stringIterator); - result = _.unique('abc', true, stringIterator, any); - result = _.unique('abc', stringIterator); - result = _.unique('abc', stringIterator, any); - result = _.unique('abc', stringIterator); - result = _.unique('abc', stringIterator, any); - } - - { - let result: SampleObject[]; - - result = _.unique(array); - result = _.unique(array, true); - result = _.unique(array, true, listIterator); - result = _.unique(array, true, listIterator, any); - result = _.unique(array, true, listIterator); - result = _.unique(array, true, listIterator, any); - result = _.unique(array, listIterator); - result = _.unique(array, listIterator, any); - result = _.unique(array, listIterator); - result = _.unique(array, listIterator, any); - result = _.unique(array, true, 'a'); - result = _.unique(array, true, 'a', any); - result = _.unique(array, 'a'); - result = _.unique(array, 'a', any); - result = _.unique(array, true, {a: 42}); - result = _.unique<{a: number}, SampleObject>(array, true, {a: 42}); - result = _.unique(array, {a: 42}); - result = _.unique<{a: number}, SampleObject>(array, {a: 42}); - - result = _.unique(list); - result = _.unique(list, true); - result = _.unique(list, true, listIterator); - result = _.unique(list, true, listIterator, any); - result = _.unique(list, true, listIterator); - result = _.unique(list, true, listIterator, any); - result = _.unique(list, listIterator); - result = _.unique(list, listIterator, any); - result = _.unique(list, listIterator); - result = _.unique(list, listIterator, any); - result = _.unique(list, true, 'a'); - result = _.unique(list, true, 'a', any); - result = _.unique(list, 'a'); - result = _.unique(list, 'a', any); - result = _.unique(list, true, {a: 42}); - result = _.unique<{a: number}, SampleObject>(list, true, {a: 42}); - result = _.unique(list, {a: 42}); - result = _.unique<{a: number}, SampleObject>(list, {a: 42}); - } - - { - let result: _.LoDashImplicitArrayWrapper; - - result = _('abc').unique(); - result = _('abc').unique(true); - result = _('abc').unique(true, stringIterator); - result = _('abc').unique(true, stringIterator, any); - result = _('abc').unique(stringIterator); - result = _('abc').unique(stringIterator, any); - } - - { - let result: _.LoDashImplicitArrayWrapper; - - result = _(array).unique(); - result = _(array).unique(true); - result = _(array).unique(true, listIterator); - result = _(array).unique(true, listIterator, any); - result = _(array).unique(listIterator); - result = _(array).unique(listIterator, any); - result = _(array).unique(true, 'a'); - result = _(array).unique(true, 'a', any); - result = _(array).unique('a'); - result = _(array).unique('a', any); - result = _(array).unique<{a: number}>(true, {a: 42}); - result = _(array).unique<{a: number}>({a: 42}); - - result = _(list).unique(); - result = _(list).unique(true); - result = _(list).unique(true, listIterator); - result = _(list).unique(true, listIterator, any); - result = _(list).unique(true, listIterator); - result = _(list).unique(true, listIterator, any); - result = _(list).unique(listIterator); - result = _(list).unique(listIterator, any); - result = _(list).unique(listIterator); - result = _(list).unique(listIterator, any); - result = _(list).unique(true, 'a'); - result = _(list).unique(true, 'a', any); - result = _(list).unique('a'); - result = _(list).unique('a', any); - result = _(list).unique(true, {a: 42}); - result = _(list).unique<{a: number}, SampleObject>(true, {a: 42}); - result = _(list).unique({a: 42}); - result = _(list).unique<{a: number}, SampleObject>({a: 42}); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _('abc').chain().unique(); - result = _('abc').chain().unique(true); - result = _('abc').chain().unique(true, stringIterator); - result = _('abc').chain().unique(true, stringIterator, any); - result = _('abc').chain().unique(stringIterator); - result = _('abc').chain().unique(stringIterator, any); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _(array).chain().unique(); - result = _(array).chain().unique(true); - result = _(array).chain().unique(true, listIterator); - result = _(array).chain().unique(true, listIterator, any); - result = _(array).chain().unique(listIterator); - result = _(array).chain().unique(listIterator, any); - result = _(array).chain().unique(true, 'a'); - result = _(array).chain().unique(true, 'a', any); - result = _(array).chain().unique('a'); - result = _(array).chain().unique('a', any); - result = _(array).chain().unique<{a: number}>(true, {a: 42}); - result = _(array).chain().unique<{a: number}>({a: 42}); - - result = _(list).chain().unique(); - result = _(list).chain().unique(true); - result = _(list).chain().unique(true, listIterator); - result = _(list).chain().unique(true, listIterator, any); - result = _(list).chain().unique(true, listIterator); - result = _(list).chain().unique(true, listIterator, any); - result = _(list).chain().unique(listIterator); - result = _(list).chain().unique(listIterator, any); - result = _(list).chain().unique(listIterator); - result = _(list).chain().unique(listIterator, any); - result = _(list).chain().unique(true, 'a'); - result = _(list).chain().unique(true, 'a', any); - result = _(list).chain().unique('a'); - result = _(list).chain().unique('a', any); - result = _(list).chain().unique(true, {a: 42}); - result = _(list).chain().unique<{a: number}, SampleObject>(true, {a: 42}); - result = _(list).chain().unique({a: 42}); - result = _(list).chain().unique<{a: number}, SampleObject>({a: 42}); - } -} - // _.upzip module TestUnzip { let array = [['a', 'b'], [1, 2], [true, false]]; diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 43542ec89..103897a2b 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -11,11 +11,13 @@ TODO: - [ ] Made _.forEach, _.forIn, _.forOwn, & _.times implicitly end a chain sequence - [ ] Removed thisArg params from most methods +- [ ] Check for aliases in this group - [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 +- [ ] Check for aliases in this group - [x] Renamed _.first to _.head - [x] Renamed _.indexBy to _.keyBy - [x] Renamed _.invoke to _.invokeMap @@ -28,6 +30,7 @@ TODO: - [x] Renamed _.trimLeft & _.trimRight to _.trimStart & _.trimEnd - [x] Renamed _.trunc to _.truncate +- [ ] Check for aliases in this group - [x] Split _.indexOf & _.lastIndexOf into _.sortedIndexOf & _.sortedLastIndexOf - [x] Split _.max & _.min into _.maxBy & _.minBy - [x] Split _.omit & _.pick into _.omitBy & _.pickBy @@ -36,6 +39,7 @@ TODO: - [x] Split _.sortedLastIndex into _.sortedLastIndexBy - [ ] Split _.uniq into _.sortedUniq, _.sortedUniqBy, & _.uniqBy +- [ ] Check for aliases in this group - [ ] Absorbed _.sortByAll into _.sortBy - [x] Changed the category of _.at to “Object” - [x] Changed the category of _.bindAll to “Utility” @@ -48,89 +52,89 @@ TODO: - [ ] 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, & +- [ ] _.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, & +- [ ] _.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, & +- [ ] _.assignIn +- [ ] _.assignInWith +- [ ] _.assignWith +- [ ] _.functionsIn +- [ ] _.hasIn +- [ ] _.invoke +- [ ] _.mergeWith +- [ ] _.omitBy +- [ ] _.pickBy +- [ ] _.setWith +- [ ] _.toPairs +- [ ] _.toPairsIn - [ ] _.unset added 8 string methods: -- [ ] _.lowerCase, -- [ ] _.lowerFirst, -- [ ] _.replace, -- [ ] _.split, -- [ ] _.upperCase, -- [ ] _.upperFirst, -- [ ] _.toLower, & +- [ ] _.lowerCase +- [ ] _.lowerFirst +- [ ] _.replace +- [ ] _.split +- [ ] _.upperCase +- [ ] _.upperFirst +- [ ] _.toLower - [ ] _.toUpper added 8 utility methods: -- [ ] _.cond, -- [ ] _.conforms, -- [ ] _.nthArg, -- [ ] _.over, -- [ ] _.overEvery, -- [ ] _.overSome, -- [ ] _.rangeRight, & +- [ ] _.cond +- [ ] _.conforms +- [ ] _.nthArg +- [ ] _.over +- [ ] _.overEvery +- [ ] _.overSome +- [ ] _.rangeRight - [ ] _.toPath added 4 math methods: -- [ ] _.maxBy, -- [ ] _.mean, -- [ ] _.minBy, & +- [ ] _.maxBy +- [ ] _.mean +- [ ] _.minBy - [ ] _.sumBy added 2 function methods: @@ -153,7 +157,23 @@ Added 3 aliases - [x] _.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 +- [ ] Removed aliase _.all +- [ ] Removed aliase _.any +- [ ] Removed aliase _.backflow +- [ ] Removed aliase _.callback +- [ ] Removed aliase _.collect +- [ ] Removed aliase _.compose +- [ ] Removed aliase _.contains +- [ ] Removed aliase _.detect +- [ ] Removed aliase _.foldl +- [ ] Removed aliase _.foldr +- [ ] Removed aliase _.include +- [ ] Removed aliase _.inject +- [ ] Removed aliase _.methods +- [ ] Removed aliase _.object +- [ ] Removed aliase _.#run +- [ ] Removed aliase _.select +- [x] Removed aliase _.unique Other changes - [ ] Added clear method to _.memoize.Cache @@ -3767,400 +3787,6 @@ declare module _ { ): LoDashExplicitArrayWrapper; } - //_.unique - interface LoDashStatic { - /** - * @see _.uniq - */ - unique( - array: List, - isSorted?: boolean, - iteratee?: ListIterator, - thisArg?: any - ): T[]; - - /** - * @see _.uniq - */ - unique( - array: List, - isSorted?: boolean, - iteratee?: ListIterator, - thisArg?: any - ): T[]; - - /** - * @see _.uniq - */ - unique( - array: List, - iteratee?: ListIterator, - thisArg?: any - ): T[]; - - /** - * @see _.uniq - */ - unique( - array: List, - iteratee?: ListIterator, - thisArg?: any - ): T[]; - - /** - * @see _.uniq - */ - unique( - array: List, - isSorted?: boolean, - iteratee?: string, - thisArg?: any - ): T[]; - - /** - * @see _.uniq - */ - unique( - array: List, - iteratee?: string, - thisArg?: any - ): T[]; - - /** - * @see _.uniq - */ - unique( - array: List, - isSorted?: boolean, - iteratee?: Object - ): T[]; - - /** - * @see _.uniq - */ - unique( - array: List, - isSorted?: boolean, - iteratee?: TWhere - ): T[]; - - /** - * @see _.uniq - */ - unique( - array: List, - iteratee?: Object - ): T[]; - - /** - * @see _.uniq - */ - unique( - array: List, - iteratee?: TWhere - ): T[]; - } - - interface LoDashImplicitWrapper { - /** - * @see _.uniq - */ - unique( - isSorted?: boolean, - iteratee?: ListIterator, - thisArg?: any - ): LoDashImplicitArrayWrapper; - - /** - * @see _.uniq - */ - unique( - iteratee?: ListIterator, - thisArg?: any - ): LoDashImplicitArrayWrapper; - } - - interface LoDashImplicitArrayWrapper { - /** - * @see _.uniq - */ - unique( - isSorted?: boolean, - iteratee?: ListIterator, - thisArg?: any - ): LoDashImplicitArrayWrapper; - - /** - * @see _.uniq - */ - unique( - iteratee?: ListIterator, - thisArg?: any - ): LoDashImplicitArrayWrapper; - - /** - * @see _.uniq - */ - unique( - isSorted?: boolean, - iteratee?: string, - thisArg?: any - ): LoDashImplicitArrayWrapper; - - /** - * @see _.uniq - */ - unique( - iteratee?: string, - thisArg?: any - ): LoDashImplicitArrayWrapper; - - /** - * @see _.uniq - */ - unique( - isSorted?: boolean, - iteratee?: TWhere - ): LoDashImplicitArrayWrapper; - - /** - * @see _.uniq - */ - unique( - iteratee?: TWhere - ): LoDashImplicitArrayWrapper; - } - - interface LoDashImplicitObjectWrapper { - unique( - isSorted?: boolean, - iteratee?: ListIterator, - thisArg?: any - ): LoDashImplicitArrayWrapper; - - /** - * @see _.uniq - */ - unique( - isSorted?: boolean, - iteratee?: ListIterator, - thisArg?: any - ): LoDashImplicitArrayWrapper; - - /** - * @see _.uniq - */ - unique( - iteratee?: ListIterator, - thisArg?: any - ): LoDashImplicitArrayWrapper; - - /** - * @see _.uniq - */ - unique( - iteratee?: ListIterator, - thisArg?: any - ): LoDashImplicitArrayWrapper; - - /** - * @see _.uniq - */ - unique( - isSorted?: boolean, - iteratee?: string, - thisArg?: any - ): LoDashImplicitArrayWrapper; - - /** - * @see _.uniq - */ - unique( - iteratee?: string, - thisArg?: any - ): LoDashImplicitArrayWrapper; - - /** - * @see _.uniq - */ - unique( - isSorted?: boolean, - iteratee?: Object - ): LoDashImplicitArrayWrapper; - - /** - * @see _.uniq - */ - unique( - isSorted?: boolean, - iteratee?: TWhere - ): LoDashImplicitArrayWrapper; - - /** - * @see _.uniq - */ - unique( - iteratee?: Object - ): LoDashImplicitArrayWrapper; - - /** - * @see _.uniq - */ - unique( - iteratee?: TWhere - ): LoDashImplicitArrayWrapper; - } - - interface LoDashExplicitWrapper { - /** - * @see _.uniq - */ - unique( - isSorted?: boolean, - iteratee?: ListIterator, - thisArg?: any - ): LoDashExplicitArrayWrapper; - - /** - * @see _.uniq - */ - unique( - iteratee?: ListIterator, - thisArg?: any - ): LoDashExplicitArrayWrapper; - } - - interface LoDashExplicitArrayWrapper { - /** - * @see _.uniq - */ - unique( - isSorted?: boolean, - iteratee?: ListIterator, - thisArg?: any - ): LoDashExplicitArrayWrapper; - - /** - * @see _.uniq - */ - unique( - iteratee?: ListIterator, - thisArg?: any - ): LoDashExplicitArrayWrapper; - - /** - * @see _.uniq - */ - unique( - isSorted?: boolean, - iteratee?: string, - thisArg?: any - ): LoDashExplicitArrayWrapper; - - /** - * @see _.uniq - */ - unique( - iteratee?: string, - thisArg?: any - ): LoDashExplicitArrayWrapper; - - /** - * @see _.uniq - */ - unique( - isSorted?: boolean, - iteratee?: TWhere - ): LoDashExplicitArrayWrapper; - - /** - * @see _.uniq - */ - unique( - iteratee?: TWhere - ): LoDashExplicitArrayWrapper; - } - - interface LoDashExplicitObjectWrapper { - unique( - isSorted?: boolean, - iteratee?: ListIterator, - thisArg?: any - ): LoDashExplicitArrayWrapper; - - /** - * @see _.uniq - */ - unique( - isSorted?: boolean, - iteratee?: ListIterator, - thisArg?: any - ): LoDashExplicitArrayWrapper; - - /** - * @see _.uniq - */ - unique( - iteratee?: ListIterator, - thisArg?: any - ): LoDashExplicitArrayWrapper; - - /** - * @see _.uniq - */ - unique( - iteratee?: ListIterator, - thisArg?: any - ): LoDashExplicitArrayWrapper; - - /** - * @see _.uniq - */ - unique( - isSorted?: boolean, - iteratee?: string, - thisArg?: any - ): LoDashExplicitArrayWrapper; - - /** - * @see _.uniq - */ - unique( - iteratee?: string, - thisArg?: any - ): LoDashExplicitArrayWrapper; - - /** - * @see _.uniq - */ - unique( - isSorted?: boolean, - iteratee?: Object - ): LoDashExplicitArrayWrapper; - - /** - * @see _.uniq - */ - unique( - isSorted?: boolean, - iteratee?: TWhere - ): LoDashExplicitArrayWrapper; - - /** - * @see _.uniq - */ - unique( - iteratee?: Object - ): LoDashExplicitArrayWrapper; - - /** - * @see _.uniq - */ - unique( - iteratee?: TWhere - ): LoDashExplicitArrayWrapper; - } - //_.unzip interface LoDashStatic { /**