mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-08 16:40:30 +08:00
MAJOR!! code refactor to support some awesome chaining logic where only appropriate methods will be available to continue the chain.
This commit is contained in:
+129
-100
@@ -85,43 +85,62 @@ var result;
|
||||
/*************
|
||||
* Chaining *
|
||||
*************/
|
||||
result = <_.LoDashWrapper<string>>_('test');
|
||||
result = <_.LoDashWrapper<string[]>>_(['test1', 'test2']);
|
||||
result = <LoDash.LoDashWrapper<string>>_('test');
|
||||
result = <LoDash.LoDashWrapper<number>>_(1);
|
||||
result = <LoDash.LoDashWrapper<boolean>>_(true);
|
||||
result = <LoDash.LoDashArrayWrapper<string>>_(['test1', 'test2']);
|
||||
result = <LoDash.LoDashObjectWrapper<LoDash.Dictionary<string>>>_({'key1': 'test1', 'key2': 'test2'});
|
||||
|
||||
result = <_.LoDashWrapper<string>>_('test').chain();
|
||||
result = <_.LoDashWrapper<string[]>>_(['test1', 'test2']).chain();
|
||||
result = <_.LoDashWrapper<string>>_.chain('test');
|
||||
result = <_.LoDashWrapper<string[]>>_.chain(['test1', 'test2']);
|
||||
result = <LoDash.LoDashWrapper<string>>_.chain('test');
|
||||
result = <LoDash.LoDashWrapper<string>>_('test').chain();
|
||||
result = <LoDash.LoDashWrapper<number>>_.chain(1);
|
||||
result = <LoDash.LoDashWrapper<number>>_(1).chain();
|
||||
result = <LoDash.LoDashWrapper<boolean>>_.chain(true);
|
||||
result = <LoDash.LoDashWrapper<boolean>>_(true).chain();
|
||||
result = <LoDash.LoDashArrayWrapper<string>>_.chain(['test1', 'test2']);
|
||||
result = <LoDash.LoDashArrayWrapper<string>>_(['test1', 'test2']).chain();
|
||||
result = <LoDash.LoDashObjectWrapper<LoDash.Dictionary<string>>>_.chain({'key1': 'test1', 'key2': 'test2'});
|
||||
result = <LoDash.LoDashObjectWrapper<LoDash.Dictionary<string>>>_({'key1': 'test1', 'key2': 'test2'}).chain();
|
||||
|
||||
result = <_.LoDashWrapper<number[]>>_([1, 2, 3, 4]).concat([5, 6, 7]);
|
||||
result = <_.LoDashWrapper<string>>_([1, 2, 3, 4]).join(',');
|
||||
result = <_.LoDashWrapper<number>>_([1, 2, 3, 4]).pop();
|
||||
//Wrapped array shortcut methods
|
||||
result = <LoDash.LoDashArrayWrapper<number>>_([1, 2, 3, 4]).concat(5, 6);
|
||||
result = <LoDash.LoDashWrapper<string>>_([1, 2, 3, 4]).join(',');
|
||||
result = <LoDash.LoDashWrapper<number>>_([1, 2, 3, 4]).pop();
|
||||
_([1, 2, 3, 4]).push(5, 6, 7);
|
||||
result = <_.LoDashWrapper<number[]>>_([1, 2, 3, 4]).reverse();
|
||||
result = <_.LoDashWrapper<number>>_([1, 2, 3, 4]).shift();
|
||||
result = <_.LoDashWrapper<number[]>>_([1, 2, 3, 4]).slice(1, 2);
|
||||
result = <_.LoDashWrapper<number[]>>_([1, 2, 3, 4]).slice(2);
|
||||
result = <_.LoDashWrapper<number[]>>_([1, 2, 3, 4]).sort((a, b) => 1);
|
||||
result = <_.LoDashWrapper<number[]>>_([1, 2, 3, 4]).splice(1);
|
||||
result = <_.LoDashWrapper<number[]>>_([1, 2, 3, 4]).splice(1, 2, 5, 6);
|
||||
result = <_.LoDashWrapper<number>>_([1, 2, 3, 4]).unshift(5, 6);
|
||||
result = <LoDash.LoDashArrayWrapper<number>>_([1, 2, 3, 4]).reverse();
|
||||
result = <LoDash.LoDashWrapper<number>>_([1, 2, 3, 4]).shift();
|
||||
result = <LoDash.LoDashArrayWrapper<number>>_([1, 2, 3, 4]).slice(1, 2);
|
||||
result = <LoDash.LoDashArrayWrapper<number>>_([1, 2, 3, 4]).slice(2);
|
||||
result = <LoDash.LoDashArrayWrapper<number>>_([1, 2, 3, 4]).sort((a, b) => 1);
|
||||
result = <LoDash.LoDashArrayWrapper<number>>_([1, 2, 3, 4]).splice(1);
|
||||
result = <LoDash.LoDashArrayWrapper<number>>_([1, 2, 3, 4]).splice(1, 2, 5, 6);
|
||||
result = <LoDash.LoDashWrapper<number>>_([1, 2, 3, 4]).unshift(5, 6);
|
||||
|
||||
result = <number[]>_.tap([1, 2, 3, 4], function(array) { console.log(array); });
|
||||
result = <_.LoDashWrapper<number[]>>_([1, 2, 3, 4]).tap(function(array) { console.log(array); });
|
||||
result = <LoDash.LoDashWrapper<string>>_('test').tap(function(value) { console.log(value); });
|
||||
result = <LoDash.LoDashArrayWrapper<number>>_([1, 2, 3, 4]).tap(function(array) { console.log(array); });
|
||||
result = <LoDash.LoDashObjectWrapper<LoDash.Dictionary<string>>>_({'key1': 'test1', 'key2': 'test2'}).tap(function(array) { console.log(array); });
|
||||
|
||||
result = <string>_('test').toString();
|
||||
result = <string>_([1, 2, 3]).toString();
|
||||
result = <string>_({'key1': 'test1', 'key2': 'test2'}).toString();
|
||||
|
||||
result = <string>_('test').valueOf();
|
||||
result = <number[]>_([1, 2, 3]).valueOf();
|
||||
result = <number[]>_([1, 2, 3]).value();
|
||||
result = <LoDash.Dictionary<string>>_({'key1': 'test1', 'key2': 'test2'}).valueOf();
|
||||
|
||||
/*************
|
||||
* Arrays *
|
||||
*************/
|
||||
result = <string>_('test').value();
|
||||
result = <number[]>_([1, 2, 3]).value();
|
||||
result = <LoDash.Dictionary<string>>_({'key1': 'test1', 'key2': 'test2'}).value();
|
||||
|
||||
// /*************
|
||||
// * Arrays *
|
||||
// *************/
|
||||
result = <any[]>_.compact([0, 1, false, 2, '', 3]);
|
||||
result = <_.LoDashWrapper<any[]>>_([0, 1, false, 2, '', 3]).compact();
|
||||
result = <LoDash.LoDashArrayWrapper<any>>_([0, 1, false, 2, '', 3]).compact();
|
||||
|
||||
result = <number[]>_.difference([1, 2, 3, 4, 5], [5, 2, 10]);
|
||||
result = <_.LoDashWrapper<number[]>>_([1, 2, 3, 4, 5]).difference([5, 2, 10]);
|
||||
result = <LoDash.LoDashArrayWrapper<number>>_([1, 2, 3, 4, 5]).difference([5, 2, 10]);
|
||||
|
||||
result = <number[]>_.rest([1, 2, 3]);
|
||||
result = <number[]>_.rest([1, 2, 3], 2);
|
||||
@@ -131,21 +150,21 @@ result = <number[]>_.rest([1, 2, 3], function(num) {
|
||||
result = <IFoodOrganic[]>_.rest(foodsOrganic, 'test');
|
||||
result = <IFoodType[]>_.rest(foodsType, { 'test': 'value' });
|
||||
|
||||
_.drop([1, 2, 3]);
|
||||
_.drop([1, 2, 3], 2);
|
||||
_.drop([1, 2, 3], function(num) {
|
||||
result = <number[]>_.drop([1, 2, 3]);
|
||||
result = <number[]>_.drop([1, 2, 3], 2);
|
||||
result = <number[]>_.drop([1, 2, 3], function(num) {
|
||||
return num < 3;
|
||||
});
|
||||
_.drop(foodsOrganic, 'test');
|
||||
_.drop(foodsType, { 'test': 'value' });
|
||||
result = <IFoodOrganic[]>_.drop(foodsOrganic, 'test');
|
||||
result = <IFoodType[]>_.drop(foodsType, { 'test': 'value' });
|
||||
|
||||
_.tail([1, 2, 3]);
|
||||
_.tail([1, 2, 3], 2);
|
||||
_.tail([1, 2, 3], function(num) {
|
||||
result = <number[]>_.tail([1, 2, 3]);
|
||||
result = <number[]>_.tail([1, 2, 3], 2);
|
||||
result = <number[]>_.tail([1, 2, 3], function(num) {
|
||||
return num < 3;
|
||||
});
|
||||
_.tail(foodsOrganic, 'test');
|
||||
_.tail(foodsType, { 'test': 'value' });
|
||||
result = <IFoodOrganic[]>_.tail(foodsOrganic, 'test');
|
||||
result = <IFoodType[]>_.tail(foodsType, { 'test': 'value' });
|
||||
|
||||
result = <number>_.findIndex(['apple', 'banana', 'beet'], function(f) {
|
||||
return /^b/.test(f);
|
||||
@@ -159,7 +178,6 @@ result = <number>_.findLastIndex(['apple', 'banana', 'beet'], function(f) {
|
||||
result = <number>_.findLastIndex(['apple', 'banana', 'beet'], 'apple');
|
||||
result = <number>_.findLastIndex([{ food: 'apple' }, { food: 'banana' }, { food: 'beet' }], { food: 'apple'});
|
||||
|
||||
|
||||
result = <number>_.first([1, 2, 3]);
|
||||
result = <number[]>_.first([1, 2, 3], 2);
|
||||
result = <number[]>_.first([1, 2, 3], function(num) {
|
||||
@@ -168,29 +186,29 @@ result = <number[]>_.first([1, 2, 3], function(num) {
|
||||
result = <IFoodOrganic[]>_.first(foodsOrganic, 'organic');
|
||||
result = <IFoodType[]>_.first(foodsType, { 'type': 'fruit' });
|
||||
|
||||
result = <number>_.head([1, 2, 3]);
|
||||
result = <number[]>_.head([1, 2, 3], 2);
|
||||
result = <number[]>_.head([1, 2, 3], function(num) {
|
||||
return num < 3;
|
||||
});
|
||||
result = <IFoodOrganic[]>_.head(foodsOrganic, 'organic');
|
||||
result = <IFoodType[]>_.head(foodsType, { 'type': 'fruit' });
|
||||
result = <number>_.head([1, 2, 3]);
|
||||
result = <number[]>_.head([1, 2, 3], 2);
|
||||
result = <number[]>_.head([1, 2, 3], function(num) {
|
||||
return num < 3;
|
||||
});
|
||||
result = <IFoodOrganic[]>_.head(foodsOrganic, 'organic');
|
||||
result = <IFoodType[]>_.head(foodsType, { 'type': 'fruit' });
|
||||
|
||||
result = <number>_.take([1, 2, 3]);
|
||||
result = <number[]>_.take([1, 2, 3], 2);
|
||||
result = <number[]>_.take([1, 2, 3], function(num) {
|
||||
return num < 3;
|
||||
});
|
||||
result = <IFoodOrganic[]>_.take(foodsOrganic, 'organic');
|
||||
result = <IFoodType[]>_.take(foodsType, { 'type': 'fruit' });
|
||||
result = <number>_.take([1, 2, 3]);
|
||||
result = <number[]>_.take([1, 2, 3], 2);
|
||||
result = <number[]>_.take([1, 2, 3], function(num) {
|
||||
return num < 3;
|
||||
});
|
||||
result = <IFoodOrganic[]>_.take(foodsOrganic, 'organic');
|
||||
result = <IFoodType[]>_.take(foodsType, { 'type': 'fruit' });
|
||||
|
||||
result = <number[]>_.flatten([1, [2], [3, [[4]]]]);
|
||||
result = <any[]>_.flatten([1, [2], [3, [[4]]]], true);
|
||||
result = <string[]>_.flatten(stoogesQuotes, 'quotes');
|
||||
|
||||
result = <number[]>_([1, [2], [3, [[4]]]]).flatten();
|
||||
result = <any[]>_([1, [2], [3, [[4]]]]).flatten(true);
|
||||
result = <string[]>_(stoogesQuotes).flatten('quotes');
|
||||
result = <LoDash.LoDashArrayWrapper<number>>_([1, [2], [3, [[4]]]]).flatten();
|
||||
result = <LoDash.LoDashArrayWrapper<number>>_([1, [2], [3, [[4]]]]).flatten(true);
|
||||
result = <LoDash.LoDashArrayWrapper<string>>_(stoogesQuotes).flatten('quotes');
|
||||
|
||||
result = <number>_.indexOf([1, 2, 3, 1, 2, 3], 2);
|
||||
result = <number>_.indexOf([1, 2, 3, 1, 2, 3], 2, 3);
|
||||
@@ -263,14 +281,14 @@ result = <{x: number;}[]>_.uniq([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
|
||||
result = <number[]>_.unique([1, 2.5, 3, 1.5, 2, 3.5], function(num) { return this.floor(num); }, Math);
|
||||
result = <{x: number;}[]>_.unique([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
|
||||
|
||||
result = <any[][]>_.unzip(['moe', 'larry'], [30, 40], [true, false]);
|
||||
result = <any[][]>_.zip(['moe', 'larry'], [30, 40], [true, false]);
|
||||
|
||||
result = <number[]>_.without([1, 2, 1, 0, 3, 1, 4], 0, 1);
|
||||
|
||||
/* *************
|
||||
* Collections *
|
||||
************* */
|
||||
result = <any[][]>_.zip(['moe', 'larry'], [30, 40], [true, false]);
|
||||
result = <any[][]>_.unzip(['moe', 'larry'], [30, 40], [true, false]);
|
||||
|
||||
// /* *************
|
||||
// * Collections *
|
||||
// ************* */
|
||||
|
||||
result = <string[]>_.at(['a', 'b', 'c', 'd', 'e'], [0, 2, 4]);
|
||||
result = <string[]>_.at(['moe', 'larry', 'curly'], 0, 2);
|
||||
@@ -285,13 +303,13 @@ result = <boolean>_.contains('curly', 'ur');
|
||||
result = <boolean>_.include({ 'name': 'moe', 'age': 40 }, 'moe');
|
||||
result = <boolean>_.include('curly', 'ur');
|
||||
|
||||
result = <_.Dictionary<number>>_.countBy([4.3, 6.1, 6.4], function(num) { return Math.floor(num); });
|
||||
result = <_.Dictionary<number>>_.countBy([4.3, 6.1, 6.4], function(num) { return this.floor(num); }, Math);
|
||||
result = <_.Dictionary<number>>_.countBy(['one', 'two', 'three'], 'length');
|
||||
result = <LoDash.Dictionary<number>>_.countBy([4.3, 6.1, 6.4], function(num) { return Math.floor(num); });
|
||||
result = <LoDash.Dictionary<number>>_.countBy([4.3, 6.1, 6.4], function(num) { return this.floor(num); }, Math);
|
||||
result = <LoDash.Dictionary<number>>_.countBy(['one', 'two', 'three'], 'length');
|
||||
|
||||
result = <_.LoDashWrapper<_.Dictionary<number>>>_([4.3, 6.1, 6.4]).countBy(function(num) { return Math.floor(num); });
|
||||
result = <_.LoDashWrapper<_.Dictionary<number>>>_([4.3, 6.1, 6.4]).countBy(function(num) { return this.floor(num); }, Math);
|
||||
result = <_.LoDashWrapper<_.Dictionary<number>>>_(['one', 'two', 'three']).countBy('length');
|
||||
result = <LoDash.LoDashObjectWrapper<LoDash.Dictionary<number>>>_([4.3, 6.1, 6.4]).countBy(function(num) { return Math.floor(num); });
|
||||
result = <LoDash.LoDashObjectWrapper<LoDash.Dictionary<number>>>_([4.3, 6.1, 6.4]).countBy(function(num) { return this.floor(num); }, Math);
|
||||
result = <LoDash.LoDashObjectWrapper<LoDash.Dictionary<number>>>_(['one', 'two', 'three']).countBy('length');
|
||||
|
||||
result = <boolean>_.every([true, 1, null, 'yes'], Boolean);
|
||||
result = <boolean>_.every(stoogesAges, 'age');
|
||||
@@ -313,9 +331,9 @@ result = <IFoodCombined[]>_.filter(foodsCombined, { 'type': 'fruit' });
|
||||
result = <IFoodCombined[]>_.select(foodsCombined, 'organic');
|
||||
result = <IFoodCombined[]>_.select(foodsCombined, { 'type': 'fruit' });
|
||||
|
||||
result = <number[]>_([1, 2, 3, 4, 5, 6]).select(function(num) { return num % 2 == 0; });
|
||||
result = <IFoodCombined[]>_(foodsCombined).select('organic');
|
||||
result = <IFoodCombined[]>_(foodsCombined).select({ 'type': 'fruit' });
|
||||
result = <number[]>_([1, 2, 3, 4, 5, 6]).select(function(num) { return num % 2 == 0; });
|
||||
result = <IFoodCombined[]>_(foodsCombined).select('organic');
|
||||
result = <IFoodCombined[]>_(foodsCombined).select({ 'type': 'fruit' });
|
||||
|
||||
result = <number>_.find([1, 2, 3, 4], function(num) {
|
||||
return num % 2 == 0;
|
||||
@@ -342,24 +360,30 @@ result = <IFoodCombined>_.findLast(foodsCombined, { 'type': 'vegetable' });
|
||||
result = <IFoodCombined>_.findLast(foodsCombined, 'organic');
|
||||
|
||||
result = <number[]>_.forEach([1, 2, 3], function(num) { console.log(num); });
|
||||
result = <_.Dictionary<number>>_.forEach({ 'one': 1, 'two': 2, 'three': 3 }, function(num) { console.log(num); });
|
||||
result = <LoDash.Dictionary<number>>_.forEach({ 'one': 1, 'two': 2, 'three': 3 }, function(num) { console.log(num); });
|
||||
|
||||
result = <number[]>_.each([1, 2, 3], function(num) { console.log(num); });
|
||||
result = <_.Dictionary<number>>_.each({ 'one': 1, 'two': 2, 'three': 3 }, function(num) { console.log(num); });
|
||||
result = <LoDash.Dictionary<number>>_.each({ 'one': 1, 'two': 2, 'three': 3 }, function(num) { console.log(num); });
|
||||
|
||||
result = <LoDash.LoDashArrayWrapper<number>>_([1, 2, 3]).forEach(function(num) { console.log(num); });
|
||||
result = <LoDash.LoDashObjectWrapper<LoDash.Dictionary<number>>>_({ 'one': 1, 'two': 2, 'three': 3 }).forEach(function(num) { console.log(num); });
|
||||
|
||||
result = <LoDash.LoDashArrayWrapper<number>>_([1, 2, 3]).each(function(num) { console.log(num); });
|
||||
result = <LoDash.LoDashObjectWrapper<LoDash.Dictionary<number>>>_({ 'one': 1, 'two': 2, 'three': 3 }).each(function(num) { console.log(num); });
|
||||
|
||||
result = <number[]>_.forEachRight([1, 2, 3], function(num) { console.log(num); });
|
||||
result = <_.Dictionary<number>>_.forEachRight({ 'one': 1, 'two': 2, 'three': 3 }, function(num) { console.log(num); });
|
||||
result = <LoDash.Dictionary<number>>_.forEachRight({ 'one': 1, 'two': 2, 'three': 3 }, function(num) { console.log(num); });
|
||||
|
||||
result = <number[]>_.eachRight([1, 2, 3], function(num) { console.log(num); });
|
||||
result = <_.Dictionary<number>>_.eachRight({ 'one': 1, 'two': 2, 'three': 3 }, function(num) { console.log(num); });
|
||||
result = <LoDash.Dictionary<number>>_.eachRight({ 'one': 1, 'two': 2, 'three': 3 }, function(num) { console.log(num); });
|
||||
|
||||
result = <_.Dictionary<number[]>>_.groupBy([4.2, 6.1, 6.4], function(num) { return Math.floor(num); });
|
||||
result = <_.Dictionary<number[]>>_.groupBy([4.2, 6.1, 6.4], function(num) { return this.floor(num); }, Math);
|
||||
result = <_.Dictionary<string[]>>_.groupBy(['one', 'two', 'three'], 'length');
|
||||
result = <LoDash.Dictionary<number[]>>_.groupBy([4.2, 6.1, 6.4], function(num) { return Math.floor(num); });
|
||||
result = <LoDash.Dictionary<number[]>>_.groupBy([4.2, 6.1, 6.4], function(num) { return this.floor(num); }, Math);
|
||||
result = <LoDash.Dictionary<string[]>>_.groupBy(['one', 'two', 'three'], 'length');
|
||||
|
||||
result = <_.Dictionary<IKey>>_.indexBy(keys, 'dir');
|
||||
result = <_.Dictionary<IKey>>_.indexBy(keys, function(key) { return String.fromCharCode(key.code); });
|
||||
result = <_.Dictionary<IKey>>_.indexBy(keys, function(key) { this.fromCharCode(key.code); }, String);
|
||||
result = <LoDash.Dictionary<IKey>>_.indexBy(keys, 'dir');
|
||||
result = <LoDash.Dictionary<IKey>>_.indexBy(keys, function(key) { return String.fromCharCode(key.code); });
|
||||
result = <LoDash.Dictionary<IKey>>_.indexBy(keys, function(key) { this.fromCharCode(key.code); }, String);
|
||||
|
||||
result = <any[]>_.invoke([[5, 1, 7], [3, 2, 1]], 'sort');
|
||||
result = <any[]>_.invoke([123, 456], String.prototype.split, '');
|
||||
@@ -407,7 +431,6 @@ result = <any>_.reduce({ 'a': 1, 'b': 2, 'c': 3 }, function(result, num, key) {
|
||||
}, {});
|
||||
|
||||
result = <any>_.reduceRight([[0, 1], [2, 3], [4, 5]], function(a, b) { return a.concat(b); }, []);
|
||||
|
||||
result = <any>_.foldr([[0, 1], [2, 3], [4, 5]], function(a, b) { return a.concat(b); }, []);
|
||||
|
||||
result = <number[]>_.reject([1, 2, 3, 4, 5, 6], function(num) { return num % 2 == 0; });
|
||||
@@ -514,21 +537,20 @@ var greet = function(formatted) {
|
||||
};
|
||||
|
||||
result = <Function>_.compose(greet, format);
|
||||
result = <_.LoDashWrapper<Function>>_(greet).compose(format);
|
||||
result = <LoDash.LoDashObjectWrapper<Function>>_(greet).compose(format);
|
||||
|
||||
var createCallbackObj = { name: 'Joe' };
|
||||
result = <() => any>_.createCallback('name');
|
||||
result = <() => boolean>_.createCallback(createCallbackObj);
|
||||
result = <_.LoDashWrapper<() => any>>_('name').createCallback();
|
||||
result = <_.LoDashWrapper<() => boolean>>_(createCallbackObj).createCallback();
|
||||
|
||||
result = <LoDash.LoDashObjectWrapper<() => any>>_('name').createCallback();
|
||||
result = <LoDash.LoDashObjectWrapper<() => boolean>>_(createCallbackObj).createCallback();
|
||||
|
||||
result = <Function>_.curry(function(a, b, c) {
|
||||
console.log(a + b + c);
|
||||
console.log(a + b + c);
|
||||
});
|
||||
|
||||
result = <_.LoDashWrapper<Function>>_(function(a, b, c) {
|
||||
console.log(a + b + c);
|
||||
result = <LoDash.LoDashObjectWrapper<Function>>_(function(a, b, c) {
|
||||
console.log(a + b + c);
|
||||
}).curry();
|
||||
|
||||
declare var source;
|
||||
@@ -543,23 +565,23 @@ source.addEventListener('message', <Function>_.debounce(function() {}, 250, {
|
||||
'maxWait': 1000
|
||||
}), false);
|
||||
|
||||
result = <_.LoDashWrapper<Function>>_(function() {}).debounce(150);
|
||||
result = <LoDash.LoDashObjectWrapper<Function>>_(function() {}).debounce(150);
|
||||
|
||||
jQuery('#postbox').on('click', <_.LoDashWrapper<Function>>_(function() {}).debounce(300, {
|
||||
jQuery('#postbox').on('click', <LoDash.LoDashObjectWrapper<Function>>_(function() {}).debounce(300, {
|
||||
'leading': true,
|
||||
'trailing': false
|
||||
}));
|
||||
|
||||
source.addEventListener('message', <_.LoDashWrapper<Function>>_(function() {}).debounce(250, {
|
||||
source.addEventListener('message', <LoDash.LoDashObjectWrapper<Function>>_(function() {}).debounce(250, {
|
||||
'maxWait': 1000
|
||||
}), false);
|
||||
|
||||
result = <number>_.defer(function() { console.log('deferred'); });
|
||||
result = <_.LoDashWrapper<number>>_(function() { console.log('deferred'); }).defer();
|
||||
result = <LoDash.LoDashWrapper<number>>_(function() { console.log('deferred'); }).defer();
|
||||
|
||||
var log = _.bind(console.log, console);
|
||||
result = <number>_.delay(log, 1000, 'logged later');
|
||||
result = <_.LoDashWrapper<number>>_(log).delay(1000, 'logged later');
|
||||
result = <LoDash.LoDashWrapper<number>>_(log).delay(1000, 'logged later');
|
||||
|
||||
var fibonacci = <Function>_.memoize(function(n) {
|
||||
return n < 2 ? n : fibonacci(n - 1) + fibonacci(n - 2);
|
||||
@@ -614,8 +636,8 @@ result = <any>_.assign({ 'name': 'moe' }, { 'age': 40 }, function(a, b) {
|
||||
return typeof a == 'undefined' ? b : a;
|
||||
});
|
||||
|
||||
result = <_.LoDashWrapper<any>>_({ 'name': 'moe' }).assign({ 'age': 40 });
|
||||
result = <_.LoDashWrapper<any>>_({ 'name': 'moe' }).assign({ 'age': 40 }, function(a, b) {
|
||||
result = <LoDash.LoDashObjectWrapper<any>>_({ 'name': 'moe' }).assign({ 'age': 40 });
|
||||
result = <LoDash.LoDashObjectWrapper<any>>_({ 'name': 'moe' }).assign({ 'age': 40 }, function(a, b) {
|
||||
return typeof a == 'undefined' ? b : a;
|
||||
});
|
||||
|
||||
@@ -624,8 +646,8 @@ result = <_.LoDashWrapper<any>>_({ 'name': 'moe' }).assign({ 'age': 40 }, functi
|
||||
return typeof a == 'undefined' ? b : a;
|
||||
});
|
||||
|
||||
result = <_.LoDashWrapper<any>>_({ 'name': 'moe' }).extend({ 'age': 40 });
|
||||
result = <_.LoDashWrapper<any>>_({ 'name': 'moe' }).extend({ 'age': 40 }, function(a, b) {
|
||||
result = <LoDash.LoDashObjectWrapper<any>>_({ 'name': 'moe' }).extend({ 'age': 40 });
|
||||
result = <LoDash.LoDashObjectWrapper<any>>_({ 'name': 'moe' }).extend({ 'age': 40 }, function(a, b) {
|
||||
return typeof a == 'undefined' ? b : a;
|
||||
});
|
||||
|
||||
@@ -660,7 +682,6 @@ result = <any>_.forInRight(new Dog('Dagny'), function(value, key) {
|
||||
console.log(key);
|
||||
});
|
||||
|
||||
|
||||
result = <any>_.forOwn({ '0': 'zero', '1': 'one', 'length': 2 }, function(num, key) {
|
||||
console.log(key);
|
||||
});
|
||||
@@ -670,7 +691,7 @@ result = <any>_.forOwnRight({ '0': 'zero', '1': 'one', 'length': 2 }, function(n
|
||||
});
|
||||
|
||||
result = <string[]>_.functions(_);
|
||||
result = <string[]>_.methods(_);
|
||||
result = <string[]>_.methods(_);
|
||||
|
||||
result = <boolean>_.has({ 'a': 1, 'b': 2, 'c': 3 }, 'b');
|
||||
|
||||
@@ -840,7 +861,7 @@ result = <any>_.result(object, 'stuff');
|
||||
var tempObject = {};
|
||||
result = <typeof _>_.runInContext(tempObject);
|
||||
|
||||
result = <_.TemplateExecutor>_.template('hello <%= name %>');
|
||||
result = <LoDash.TemplateExecutor>_.template('hello <%= name %>');
|
||||
result = <string>_.template('<b><%- value %></b>', { 'value': '<script>' });
|
||||
|
||||
var listTemplate = '<% _.forEach(people, function(name) { %><li><%- name %></li><% }); %>';
|
||||
@@ -850,10 +871,10 @@ result = <string>_.template('<% print("hello " + name); %>!', { 'name': 'larry'
|
||||
|
||||
var listTemplate = '<% $.each(people, function(name) { %><li><%- name %></li><% }); %>';
|
||||
result = <string>_.template(listTemplate, { 'people': ['moe', 'larry'] }, { 'imports': { '$': jQuery } });
|
||||
result = <_.TemplateExecutor>_.template('hello <%= name %>', null, { 'sourceURL': '/basic/greeting.jst' });
|
||||
result = <LoDash.TemplateExecutor>_.template('hello <%= name %>', null, { 'sourceURL': '/basic/greeting.jst' });
|
||||
|
||||
result = <_.TemplateExecutor>_.template('hi <%= data.name %>!', null, { 'variable': 'data' });
|
||||
result = <string>(<_.TemplateExecutor>result).source;
|
||||
result = <LoDash.TemplateExecutor>_.template('hi <%= data.name %>!', null, { 'variable': 'data' });
|
||||
result = <string>(<LoDash.TemplateExecutor>result).source;
|
||||
|
||||
function Mage() {
|
||||
this.castSpell = (n:number) => n;
|
||||
@@ -868,3 +889,11 @@ result = <string>_.unescape('Moe, Larry & Curly');
|
||||
|
||||
result = <string>_.uniqueId('contact_');
|
||||
result = <string>_.uniqueId();
|
||||
|
||||
/**********
|
||||
* Utilities *
|
||||
***********/
|
||||
|
||||
result = <string>_.VERSION;
|
||||
result = <LoDash.Support>_.support;
|
||||
result = <LoDash.TemplateSettings>_.templateSettings;
|
||||
|
||||
Vendored
+3636
-3282
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user