///
declare var $: any, jQuery: any;
interface IFoodOrganic {
name: string;
organic: boolean;
}
interface IFoodType {
name: string;
type: string;
}
interface IFoodCombined {
name: string;
organic: boolean;
type: string;
}
interface IStoogesQuote {
name: string;
quotes: string[];
}
interface IStoogesAge {
name: string;
age: number;
}
interface IStoogesCombined {
name: string;
age: number;
quotes: string[];
}
interface IKey {
dir: string;
code: number;
}
interface IDictionary {
[index: string]: T;
}
var foodsOrganic: IFoodOrganic[] = [
{ name: 'banana', organic: true },
{ name: 'beet', organic: false },
];
var foodsType: IFoodType[] = [
{ name: 'apple', type: 'fruit' },
{ name: 'banana', type: 'fruit' },
{ name: 'beet', type: 'vegetable' }
];
var foodsCombined: IFoodCombined[] = [
{ 'name': 'apple', 'organic': false, 'type': 'fruit' },
{ 'name': 'carrot', 'organic': true, 'type': 'vegetable' }
];
var stoogesQuotes: IStoogesQuote[] = [
{ 'name': 'curly', 'quotes': ['Oh, a wise guy, eh?', 'Poifect!'] },
{ 'name': 'moe', 'quotes': ['Spread out!', 'You knucklehead!'] }
];
var stoogesAges: IStoogesAge[] = [
{ 'name': 'moe', 'age': 40 },
{ 'name': 'larry', 'age': 50 }
];
var stoogesAgesDict: IDictionary = {
first: { 'name': 'moe', 'age': 40 },
second: { 'name': 'larry', 'age': 50 }
};
var stoogesCombined: IStoogesCombined[] = [
{ 'name': 'curly', 'age': 30, 'quotes': ['Oh, a wise guy, eh?', 'Poifect!'] },
{ 'name': 'moe', 'age': 40, 'quotes': ['Spread out!', 'You knucklehead!'] }
];
var keys: IKey[] = [
{ 'dir': 'left', 'code': 97 },
{ 'dir': 'right', 'code': 100 }
];
class Dog {
constructor(public name: string) { }
public bark() {
console.log('Woof, woof!');
}
}
var result: any;
var any: any;
interface TResult {
a: number;
b: string;
c: boolean;
}
// _.MapCache
var testMapCache: _.MapCache;
result = <(key: string) => boolean>testMapCache.delete;
result = <(key: string) => any>testMapCache.get;
result = <(key: string) => boolean>testMapCache.has;
result = <(key: string, value: any) => _.Dictionary>testMapCache.set;
// _
namespace TestWrapper {
{
let result: _.LoDashImplicitWrapper;
result = _('');
}
{
let result: _.LoDashImplicitWrapper;
result = _(42);
}
{
let result: _.LoDashImplicitWrapper;
result = _(true);
}
{
let result: _.LoDashImplicitArrayWrapper;
result = _(['']);
}
{
let result: _.LoDashImplicitObjectWrapper<{a: string}>;
result = _<{a: string}>({a: ''});
}
}
//Wrapped array shortcut methods
result = _([1, 2, 3, 4]).pop();
result = <_.LoDashImplicitArrayWrapper>_([1, 2, 3, 4]).push(5, 6, 7);
result = _([1, 2, 3, 4]).shift();
result = <_.LoDashImplicitArrayWrapper>_([1, 2, 3, 4]).sort((a, b) => 1);
result = <_.LoDashImplicitArrayWrapper>_([1, 2, 3, 4]).splice(1);
result = <_.LoDashImplicitArrayWrapper>_([1, 2, 3, 4]).splice(1, 2, 5, 6);
result = <_.LoDashImplicitArrayWrapper>_([1, 2, 3, 4]).unshift(5, 6);
/*********
* Array *
*********/
// _.chunk
namespace TestChunk {
let array: TResult[];
let list: _.List;
{
let result: TResult[][];
result = _.chunk(array);
result = _.chunk(array, 42);
result = _.chunk(list);
result = _.chunk(list, 42);
}
{
let result: _.LoDashImplicitArrayWrapper;
result = _(array).chunk();
result = _(array).chunk(42);
result = _(list).chunk();
result = _(list).chunk(42);
}
{
let result: _.LoDashExplicitArrayWrapper;
result = _(array).chain().chunk();
result = _(array).chain().chunk(42);
result = _(list).chain().chunk();
result = _(list).chain().chunk(42);
}
}
// _.compact
namespace TestCompact {
let array: TResult[];
let list: _.List;
{
let result: TResult[];
result = _.compact();
result = _.compact(array);
result = _.compact(list);
}
{
let result: _.LoDashImplicitArrayWrapper;
result = _(array).compact();
result = _(list).compact();
}
{
let result: _.LoDashExplicitArrayWrapper;
result = _(array).chain().compact();
result = _(list).chain().compact();
}
}
// _.difference
namespace TestDifference {
let array: TResult[];
let list: _.List;
{
let result: TResult[];
result = _.difference(array);
result = _.difference(array, array);
result = _.difference(array, list, array);
result = _.difference(array, array, list, array);
result = _.difference(list);
result = _.difference(list, list);
result = _.difference(list, array, list);
result = _.difference(list, list, array, list);
}
{
let result: _.LoDashImplicitArrayWrapper;
result = _(array).difference();
result = _(array).difference(array);
result = _(array).difference(list, array);
result = _(array).difference(array, list, array);
result = _(list).difference();
result = _(list).difference(list);
result = _(list).difference(array, list);
result = _(list).difference(list, array, list);
}
{
let result: _.LoDashExplicitArrayWrapper;
result = _(array).chain().difference();
result = _(array).chain().difference(array);
result = _(array).chain().difference(list, array);
result = _(array).chain().difference(array, list, array);
result = _(list).chain().difference();
result = _(list).chain().difference(list);
result = _(list).chain().difference(array, list);
result = _(list).chain().difference(list, array, list);
}
}
// _.differenceBy
namespace TestDifferenceBy {
let array: TResult[];
let list: _.List;
let iteratee: (value: TResult) => any;
{
let result: TResult[];
result = _.differenceBy(array, array);
result = _.differenceBy(array, list, array);
result = _.differenceBy(array, array, list, array);
result = _.differenceBy(array, list, array, list, array);
result = _.differenceBy(array, array, list, array, list, array);
result = _.differenceBy(array, list, array, list, array, list, array);
result = _.differenceBy(array, array, iteratee);
result = _.differenceBy(array, list, array, iteratee);
result = _.differenceBy(array, array, list, array, iteratee);
result = _.differenceBy(array, list, array, list, array, iteratee);
result = _.differenceBy(array, array, list, array, list, array, iteratee);
result = _.differenceBy(array, list, array, list, array, list, array, iteratee);
result = _.differenceBy(array, array, 'a');
result = _.differenceBy(array, list, array, 'a');
result = _.differenceBy(array, array, list, array, 'a');
result = _.differenceBy(array, list, array, list, array, 'a');
result = _.differenceBy(array, array, list, array, list, array, 'a');
result = _.differenceBy(array, list, array, list, array, list, array, 'a');
result = _.differenceBy(array, array, {a: 1});
result = _.differenceBy(array, list, array, {a: 1});
result = _.differenceBy(array, array, list, array, {a: 1});
result = _.differenceBy(array, list, array, list, array, {a: 1});
result = _.differenceBy(array, array, list, array, list, array, {a: 1});
result = _.differenceBy(array, list, array, list, array, list, array, {a: 1});
result = _.differenceBy(list, list);
result = _.differenceBy(list, array, list);
result = _.differenceBy(list, list, array, list);
result = _.differenceBy(list, array, list, array, list);
result = _.differenceBy(list, list, array, list, array, list);
result = _.differenceBy(list, array, list, array, list, array, list);
result = _.differenceBy(list, list, iteratee);
result = _.differenceBy(list, array, list, iteratee);
result = _.differenceBy(list, list, array, list, iteratee);
result = _.differenceBy(list, array, list, array, list, iteratee);
result = _.differenceBy(list, list, array, list, array, list, iteratee);
result = _.differenceBy(list, array, list, array, list, array, list, iteratee);
result = _.differenceBy(list, list, 'a');
result = _.differenceBy(list, array, list, 'a');
result = _.differenceBy(list, list, array, list, 'a');
result = _.differenceBy(list, array, list, array, list, 'a');
result = _.differenceBy(list, list, array, list, array, list, 'a');
result = _.differenceBy(list, array, list, array, list, array, list, 'a');
result = _.differenceBy(list, list, {a: 1});
result = _.differenceBy(list, array, list, {a: 1});
result = _.differenceBy(list, list, array, list, {a: 1});
result = _.differenceBy(list, array, list, array, list, {a: 1});
result = _.differenceBy(list, list, array, list, array, list, {a: 1});
result = _.differenceBy(list, array, list, array, list, array, list, {a: 1});
}
{
let result: _.LoDashImplicitArrayWrapper;
result = _(array).differenceBy(array);
result = _(array).differenceBy(list, array);
result = _(array).differenceBy(array, list, array);
result = _(array).differenceBy(list, array, list, array);
result = _(array).differenceBy(array, list, array, list, array);
result = _(array).differenceBy(list, array, list, array, list, array);
result = _(array).differenceBy(array, iteratee);
result = _(array).differenceBy(list, array, iteratee);
result = _(array).differenceBy(array, list, array, iteratee);
result = _(array).differenceBy(list, array, list, array, iteratee);
result = _(array).differenceBy(array, list, array, list, array, iteratee);
result = _(array).differenceBy(list, array, list, array, list, array, iteratee);
result = _(array).differenceBy(array, 'a');
result = _(array).differenceBy(list, array, 'a');
result = _(array).differenceBy(array, list, array, 'a');
result = _(array).differenceBy(list, array, list, array, 'a');
result = _(array).differenceBy(array, list, array, list, array, 'a');
result = _(array).differenceBy(list, array, list, array, list, array, 'a');
result = _(array).differenceBy(array, {a: 1});
result = _(array).differenceBy(list, array, {a: 1});
result = _(array).differenceBy(array, list, array, {a: 1});
result = _(array).differenceBy(list, array, list, array, {a: 1});
result = _(array).differenceBy(array, list, array, list, array, {a: 1});
result = _(array).differenceBy(list, array, list, array, list, array, {a: 1});
result = _(list).differenceBy(list);
result = _(list).differenceBy(array, list);
result = _(list).differenceBy(list, array, list);
result = _(list).differenceBy(array, list, array, list);
result = _(list).differenceBy(list, array, list, array, list);
result = _(list).differenceBy(array, list, array, list, array, list);
result = _(list).differenceBy(list, iteratee);
result = _(list).differenceBy(array, list, iteratee);
result = _(list).differenceBy(list, array, list, iteratee);
result = _(list).differenceBy(array, list, array, list, iteratee);
result = _(list).differenceBy(list, array, list, array, list, iteratee);
result = _(list).differenceBy(array, list, array, list, array, list, iteratee);
result = _(list).differenceBy(list, 'a');
result = _(list).differenceBy(array, list, 'a');
result = _(list).differenceBy(list, array, list, 'a');
result = _(list).differenceBy(array, list, array, list, 'a');
result = _(list).differenceBy(list, array, list, array, list, 'a');
result = _(list).differenceBy(array, list, array, list, array, list, 'a');
result = _(list).differenceBy(list, {a: 1});
result = _(list).differenceBy(array, list, {a: 1});
result = _(list).differenceBy(list, array, list, {a: 1});
result = _(list).differenceBy(array, list, array, list, {a: 1});
result = _(list).differenceBy(list, array, list, array, list, {a: 1});
result = _(list).differenceBy(array, list, array, list, array, list, {a: 1});
}
{
let result: _.LoDashExplicitArrayWrapper;
result = _(array).chain().differenceBy(array);
result = _(array).chain().differenceBy(list, array);
result = _(array).chain().differenceBy(array, list, array);
result = _(array).chain().differenceBy(list, array, list, array);
result = _(array).chain().differenceBy(array, list, array, list, array);
result = _(array).chain().differenceBy(list, array, list, array, list, array);
result = _(array).chain().differenceBy(array, iteratee);
result = _(array).chain().differenceBy(list, array, iteratee);
result = _(array).chain().differenceBy(array, list, array, iteratee);
result = _(array).chain().differenceBy(list, array, list, array, iteratee);
result = _(array).chain().differenceBy(array, list, array, list, array, iteratee);
result = _(array).chain().differenceBy(list, array, list, array, list, array, iteratee);
result = _(array).chain().differenceBy(array, 'a');
result = _(array).chain().differenceBy(list, array, 'a');
result = _(array).chain().differenceBy(array, list, array, 'a');
result = _(array).chain().differenceBy(list, array, list, array, 'a');
result = _(array).chain().differenceBy(array, list, array, list, array, 'a');
result = _(array).chain().differenceBy(list, array, list, array, list, array, 'a');
result = _(array).chain().differenceBy(array, {a: 1});
result = _(array).chain().differenceBy(list, array, {a: 1});
result = _(array).chain().differenceBy(array, list, array, {a: 1});
result = _(array).chain().differenceBy(list, array, list, array, {a: 1});
result = _(array).chain().differenceBy(array, list, array, list, array, {a: 1});
result = _(array).chain().differenceBy(list, array, list, array, list, array, {a: 1});
result = _(list).chain().differenceBy(list);
result = _(list).chain().differenceBy(array, list);
result = _(list).chain().differenceBy(list, array, list);
result = _(list).chain().differenceBy(array, list, array, list);
result = _(list).chain().differenceBy(list, array, list, array, list);
result = _(list).chain().differenceBy(array, list, array, list, array, list);
result = _(list).chain().differenceBy(list, iteratee);
result = _(list).chain().differenceBy(array, list, iteratee);
result = _(list).chain().differenceBy(list, array, list, iteratee);
result = _(list).chain().differenceBy(array, list, array, list, iteratee);
result = _(list).chain().differenceBy(list, array, list, array, list, iteratee);
result = _(list).chain().differenceBy(array, list, array, list, array, list, iteratee);
result = _(list).chain().differenceBy(list, 'a');
result = _(list).chain().differenceBy(array, list, 'a');
result = _(list).chain().differenceBy(list, array, list, 'a');
result = _(list).chain().differenceBy(array, list, array, list, 'a');
result = _(list).chain().differenceBy(list, array, list, array, list, 'a');
result = _(list).chain().differenceBy(array, list, array, list, array, list, 'a');
result = _(list).chain().differenceBy(list, {a: 1});
result = _(list).chain().differenceBy(array, list, {a: 1});
result = _(list).chain().differenceBy(list, array, list, {a: 1});
result = _(list).chain().differenceBy(array, list, array, list, {a: 1});
result = _(list).chain().differenceBy(list, array, list, array, list, {a: 1});
result = _(list).chain().differenceBy(array, list, array, list, array, list, {a: 1});
}
}
// _.drop
{
let array: TResult[];
let list: _.List;
{
let result: TResult[];
result = _.drop(array);
result = _.drop(array, 42);
result = _.drop(list);
result = _.drop(list, 42);
}
{
let result: _.LoDashImplicitArrayWrapper;
result = _(array).drop();
result = _(array).drop(42);
result = _(list).drop();
result = _(list).drop(42);
}
{
let result: _.LoDashExplicitArrayWrapper;
result = _(array).chain().drop();
result = _(array).chain().drop(42);
result = _(list).chain().drop();
result = _(list).chain().drop(42);
}
}
// _.dropRight
namespace TestDropRight {
let array: TResult[];
let list: _.List;
{
let result: TResult[];
result = _.dropRight(array);
result = _.dropRight(array, 42);
result = _.dropRight(list);
result = _.dropRight(list, 42);
}
{
let result: _.LoDashImplicitArrayWrapper;
result = _(array).dropRight();
result = _(array).dropRight(42);
result = _(list).dropRight();
result = _(list).dropRight(42);
}
{
let result: _.LoDashExplicitArrayWrapper;
result = _(array).chain().dropRight();
result = _(array).chain().dropRight(42);
result = _(list).chain().dropRight();
result = _(list).chain().dropRight(42);
}
}
// _.dropRightWhile
namespace TestDropRightWhile {
let array: TResult[];
let list: _.List;
let predicateFn: (value: TResult, index: number, collection: _.List) => boolean;
{
let result: TResult[];
result = _.dropRightWhile(array);
result = _.dropRightWhile(array, predicateFn);
result = _.dropRightWhile(array, predicateFn, any);
result = _.dropRightWhile(array, '');
result = _.dropRightWhile(array, '', any);
result = _.dropRightWhile<{a: number;}, TResult>(array, {a: 42});
result = _.dropRightWhile(list);
result = _.dropRightWhile(list, predicateFn);
result = _.dropRightWhile(list, predicateFn, any);
result = _.dropRightWhile(list, '');
result = _.dropRightWhile(list, '', any);
result = _.dropRightWhile<{a: number;}, TResult>(list, {a: 42});
}
{
let result: _.LoDashImplicitArrayWrapper;
result = _(array).dropRightWhile();
result = _(array).dropRightWhile(predicateFn);
result = _(array).dropRightWhile(predicateFn, any);
result = _(array).dropRightWhile('');
result = _(array).dropRightWhile('', any);
result = _(array).dropRightWhile<{a: number;}>({a: 42});
result = _(list).dropRightWhile();
result = _(list).dropRightWhile(predicateFn);
result = _(list).dropRightWhile(predicateFn, any);
result = _(list).dropRightWhile('');
result = _(list).dropRightWhile('', any);
result = _(list).dropRightWhile<{a: number;}, TResult>({a: 42});
}
{
let result: _.LoDashExplicitArrayWrapper;
result = _(array).chain().dropRightWhile();
result = _(array).chain().dropRightWhile(predicateFn);
result = _(array).chain().dropRightWhile(predicateFn, any);
result = _(array).chain().dropRightWhile('');
result = _(array).chain().dropRightWhile('', any);
result = _(array).chain().dropRightWhile<{a: number;}>({a: 42});
result = _(list).chain().dropRightWhile();
result = _(list).chain().dropRightWhile(predicateFn);
result = _(list).chain().dropRightWhile(predicateFn, any);
result = _(list).chain().dropRightWhile('');
result = _(list).chain().dropRightWhile('', any);
result = _(list).chain().dropRightWhile<{a: number;}, TResult>({a: 42});
}
}
// _.dropWhile
namespace TestDropWhile {
let array: TResult[];
let list: _.List;
let predicateFn: (value: TResult, index: number, collection: _.List) => boolean;
{
let result: TResult[];
result = _.dropWhile(array);
result = _.dropWhile(array, predicateFn);
result = _.dropWhile(array, predicateFn, any);
result = _.dropWhile(array, '');
result = _.dropWhile(array, '', any);
result = _.dropWhile<{a: number;}, TResult>(array, {a: 42});
result = _.dropWhile(list);
result = _.dropWhile(list, predicateFn);
result = _.dropWhile(list, predicateFn, any);
result = _.dropWhile(list, '');
result = _.dropWhile(list, '', any);
result = _.dropWhile<{a: number;}, TResult>(list, {a: 42});
}
{
let result: _.LoDashImplicitArrayWrapper;
result = _(array).dropWhile();
result = _(array).dropWhile(predicateFn);
result = _(array).dropWhile(predicateFn, any);
result = _(array).dropWhile('');
result = _(array).dropWhile('', any);
result = _(array).dropWhile<{a: number;}>({a: 42});
result = _(list).dropWhile();
result = _(list).dropWhile