lodash: changed _.head

This commit is contained in:
Ilya Mochalov
2016-03-21 03:48:28 +05:00
parent 6766ed1d0f
commit 4cc6a6f7c9
4 changed files with 239 additions and 27 deletions
+60 -10
View File
@@ -652,11 +652,36 @@ namespace TestFindLastIndex {
namespace TestFirst {
let array: TResult[];
let list: _.List<TResult>;
let result: TResult;
result = _.first<TResult>(array);
result = _.first<TResult>(list);
result = _(array).first();
result = _(list).first<TResult>();
{
let result: string;
result = _.first('abc');
result = _('abc').first();
}
{
let result: TResult;
result = _.first<TResult>(array);
result = _.first<TResult>(list);
result = _(array).first();
result = _(list).first<TResult>();
}
{
let result: _.LoDashExplicitWrapper<string>;
result = _('abc').chain().first();
}
{
let result: _.LoDashExplicitObjectWrapper<TResult>;
result = _(array).chain().first<_.LoDashExplicitObjectWrapper<TResult>>();
result = _(list).chain().first<_.LoDashExplicitObjectWrapper<TResult>>();
}
}
// _.flatten
@@ -839,11 +864,36 @@ namespace TestFlattenDeep {
namespace TestHead {
let array: TResult[];
let list: _.List<TResult>;
let result: TResult;
result = _.head<TResult>(array);
result = _.head<TResult>(list);
result = _(array).head();
result = _(list).head<TResult>();
{
let result: string;
result = _.head('abc');
result = _('abc').head();
}
{
let result: TResult;
result = _.head<TResult>(array);
result = _.head<TResult>(list);
result = _(array).head();
result = _(list).head<TResult>();
}
{
let result: _.LoDashExplicitWrapper<string>;
result = _('abc').chain().head();
}
{
let result: _.LoDashExplicitObjectWrapper<TResult>;
result = _(array).chain().head<_.LoDashExplicitObjectWrapper<TResult>>();
result = _(list).chain().head<_.LoDashExplicitObjectWrapper<TResult>>();
}
}
// _.indexOf
+58 -2
View File
@@ -1166,6 +1166,13 @@ declare module _ {
first<T>(array: List<T>): T;
}
interface LoDashImplicitWrapper<T> {
/**
* @see _.first
*/
first(): string;
}
interface LoDashImplicitArrayWrapper<T> {
/**
* @see _.first
@@ -1177,7 +1184,28 @@ declare module _ {
/**
* @see _.first
*/
first<TResult>(): TResult;
first<T>(): T;
}
interface LoDashExplicitWrapper<T> {
/**
* @see _.first
*/
first(): LoDashExplicitWrapper<string>;
}
interface LoDashExplicitArrayWrapper<T> {
/**
* @see _.first
*/
first<T>(): T;
}
interface LoDashExplicitObjectWrapper<T> {
/**
* @see _.first
*/
first<T>(): T;
}
interface RecursiveArray<T> extends Array<T|RecursiveArray<T>> {}
@@ -1309,6 +1337,13 @@ declare module _ {
head<T>(array: List<T>): T;
}
interface LoDashImplicitWrapper<T> {
/**
* @see _.first
*/
head(): string;
}
interface LoDashImplicitArrayWrapper<T> {
/**
* @see _.first
@@ -1320,7 +1355,28 @@ declare module _ {
/**
* @see _.first
*/
head<TResult>(): TResult;
head<T>(): T;
}
interface LoDashExplicitWrapper<T> {
/**
* @see _.first
*/
head(): LoDashExplicitWrapper<string>;
}
interface LoDashExplicitArrayWrapper<T> {
/**
* @see _.first
*/
head<T>(): T;
}
interface LoDashExplicitObjectWrapper<T> {
/**
* @see _.first
*/
head<T>(): T;
}
//_.indexOf
+60 -10
View File
@@ -811,11 +811,36 @@ namespace TestFindLastIndex {
namespace TestFirst {
let array: TResult[];
let list: _.List<TResult>;
let result: TResult;
result = _.first<TResult>(array);
result = _.first<TResult>(list);
result = _(array).first();
result = _(list).first<TResult>();
{
let result: string;
result = _.first('abc');
result = _('abc').first();
}
{
let result: TResult;
result = _.first<TResult>(array);
result = _.first<TResult>(list);
result = _(array).first();
result = _(list).first<TResult>();
}
{
let result: _.LoDashExplicitWrapper<string>;
result = _('abc').chain().first();
}
{
let result: _.LoDashExplicitObjectWrapper<TResult>;
result = _(array).chain().first<_.LoDashExplicitObjectWrapper<TResult>>();
result = _(list).chain().first<_.LoDashExplicitObjectWrapper<TResult>>();
}
}
// _.flatten
@@ -998,11 +1023,36 @@ namespace TestFlattenDeep {
namespace TestHead {
let array: TResult[];
let list: _.List<TResult>;
let result: TResult;
result = _.head<TResult>(array);
result = _.head<TResult>(list);
result = _(array).head();
result = _(list).head<TResult>();
{
let result: string;
result = _.head('abc');
result = _('abc').head();
}
{
let result: TResult;
result = _.head<TResult>(array);
result = _.head<TResult>(list);
result = _(array).head();
result = _(list).head<TResult>();
}
{
let result: _.LoDashExplicitWrapper<string>;
result = _('abc').chain().head();
}
{
let result: _.LoDashExplicitObjectWrapper<TResult>;
result = _(array).chain().head<_.LoDashExplicitObjectWrapper<TResult>>();
result = _(list).chain().head<_.LoDashExplicitObjectWrapper<TResult>>();
}
}
// _.indexOf
+61 -5
View File
@@ -1871,12 +1871,19 @@ declare module _ {
//_.first
interface LoDashStatic {
/**
/**
* @see _.head
*/
first<T>(array: List<T>): T;
}
interface LoDashImplicitWrapper<T> {
/**
* @see _.head
*/
first(): string;
}
interface LoDashImplicitArrayWrapper<T> {
/**
* @see _.head
@@ -1888,7 +1895,28 @@ declare module _ {
/**
* @see _.head
*/
first<TResult>(): TResult;
first<T>(): T;
}
interface LoDashExplicitWrapper<T> {
/**
* @see _.head
*/
first(): LoDashExplicitWrapper<string>;
}
interface LoDashExplicitArrayWrapper<T> {
/**
* @see _.head
*/
first<T>(): T;
}
interface LoDashExplicitObjectWrapper<T> {
/**
* @see _.head
*/
first<T>(): T;
}
interface RecursiveArray<T> extends Array<T|RecursiveArray<T>> {}
@@ -2074,18 +2102,46 @@ declare module _ {
head<T>(array: List<T>): T;
}
interface LoDashImplicitWrapper<T> {
/**
* @see _.head
*/
head(): string;
}
interface LoDashImplicitArrayWrapper<T> {
/**
* @see _.first
* @see _.head
*/
head(): T;
}
interface LoDashImplicitObjectWrapper<T> {
/**
* @see _.first
* @see _.head
*/
head<TResult>(): TResult;
head<T>(): T;
}
interface LoDashExplicitWrapper<T> {
/**
* @see _.head
*/
head(): LoDashExplicitWrapper<string>;
}
interface LoDashExplicitArrayWrapper<T> {
/**
* @see _.head
*/
head<T>(): T;
}
interface LoDashExplicitObjectWrapper<T> {
/**
* @see _.head
*/
head<T>(): T;
}
//_.indexOf