From 1283eb792565bfc610553754c2f6cbc680e5bf83 Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Sat, 8 Aug 2015 04:18:15 +0500 Subject: [PATCH] lodash: changed _.xor() method --- lodash/lodash-tests.ts | 20 ++++++++++++++++---- lodash/lodash.d.ts | 36 ++++++++++++++---------------------- 2 files changed, 30 insertions(+), 26 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 53a316ab5..c6128a930 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -354,10 +354,22 @@ result = <{ x: number; }[]>_([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }]).unique('x').v result = _.without([1, 2, 1, 0, 3, 1, 4], 0, 1); -result = _.xor([1, 2, 3, 4, 5], [5, 2, 10]); -result = _.xor([1, 2, 3, 4, 5], [5, 2, 10], [4, 5, 6]); -result = <_.LoDashArrayWrapper>_([1, 2, 3, 4, 5]).xor([5, 2, 10]); -result = <_.LoDashArrayWrapper>_([1, 2, 3, 4, 5]).xor([5, 2, 10], [4, 5, 6]); +// _.xor +var testXorArray: number[]; +var testXorList: _.List; +result = _.xor(); +result = _.xor(testXorArray); +result = _.xor(testXorArray, testXorArray); +result = _.xor(testXorArray, testXorArray, testXorArray); +result = _.xor(testXorList); +result = _.xor(testXorList, testXorList); +result = _.xor(testXorList, testXorList, testXorList); +result = (_(testXorArray).xor().value()); +result = (_(testXorArray).xor(testXorArray).value()); +result = (_(testXorArray).xor(testXorArray, testXorArray).value()); +result = (_(testXorList).xor().value()); +result = (_(testXorList).xor(testXorList).value()); +result = (_(testXorList).xor(testXorList, testXorList).value()); result = _.zip(['moe', 'larry'], [30, 40], [true, false]); result = _.unzip(['moe', 'larry'], [30, 40], [true, false]); diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index ea93f2e70..8a599656b 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -1868,33 +1868,25 @@ declare module _ { //_.xor interface LoDashStatic { /** - * Creates an array that is the symmetric difference of the provided arrays. - * @param array The array to process - * @param others The arrays of values to calculate the symmetric difference. - * @return Returns a new array of filtered values. - **/ - xor( - array: Array, - ...others: Array[]): T[]; - /** - * @see _.xor - **/ - xor( - array: List, - ...others: List[]): T[]; + * Creates an array of unique values that is the symmetric difference of the provided arrays. + * @param arrays The arrays to inspect. + * @return Returns the new array of values. + */ + xor(...arrays: List[]): T[]; } interface LoDashArrayWrapper { /** - * @see _.xor - **/ - xor( - ...others: Array[]): LoDashArrayWrapper; + * @see _.xor + */ + xor(...arrays: T[][]): LoDashArrayWrapper; + } + + interface LoDashObjectWrapper { /** - * @see _.xor - **/ - xor( - ...others: List[]): LoDashArrayWrapper; + * @see _.xor + */ + xor(...arrays: T[]): LoDashObjectWrapper; } //_.zip