mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-12 04:50:18 +00:00
Merge pull request #6154 from chrootsu/lodash-takeRightWhile
lodash: added signatures of the method _.takeRightWhile
This commit is contained in:
@@ -612,6 +612,42 @@ module TestTake {
|
||||
result = _(testTakeRightList).takeRight<TResult>(42).value();
|
||||
}
|
||||
|
||||
// _.takeRightWhile
|
||||
module TestTakeRightWhile {
|
||||
let array: TResult[];
|
||||
let list: _.List<TResult>;
|
||||
let predicateFn: (value: TResult, index: number, collection: _.List<TResult>) => boolean;
|
||||
let result: TResult[];
|
||||
|
||||
result = _.takeRightWhile<TResult>(array);
|
||||
result = _.takeRightWhile<TResult>(array, predicateFn);
|
||||
result = _.takeRightWhile<TResult>(array, predicateFn, any);
|
||||
result = _.takeRightWhile<TResult>(array, '')
|
||||
result = _.takeRightWhile<TResult>(array, '', any);
|
||||
result = _.takeRightWhile<{a: number;}, TResult>(array, {a: 42});
|
||||
|
||||
result = _.takeRightWhile<TResult>(list);
|
||||
result = _.takeRightWhile<TResult>(list, predicateFn);
|
||||
result = _.takeRightWhile<TResult>(list, predicateFn, any);
|
||||
result = _.takeRightWhile<TResult>(list, '')
|
||||
result = _.takeRightWhile<TResult>(list, '', any);
|
||||
result = _.takeRightWhile<{a: number;}, TResult>(list, {a: 42});
|
||||
|
||||
result = _(array).takeRightWhile().value();
|
||||
result = _(array).takeRightWhile(predicateFn).value();
|
||||
result = _(array).takeRightWhile(predicateFn, any).value();
|
||||
result = _(array).takeRightWhile('').value();
|
||||
result = _(array).takeRightWhile('', any).value();
|
||||
result = _(array).takeRightWhile<{a: number;}>({a: 42}).value();
|
||||
|
||||
result = _(list).takeRightWhile<TResult>().value();
|
||||
result = _(list).takeRightWhile<TResult>(predicateFn).value();
|
||||
result = _(list).takeRightWhile<TResult>(predicateFn, any).value();
|
||||
result = _(list).takeRightWhile<TResult>('').value();
|
||||
result = _(list).takeRightWhile<TResult>('', any).value();
|
||||
result = _(list).takeRightWhile<{a: number;}, TResult>({a: 42}).value();
|
||||
}
|
||||
|
||||
result = <number[]>_.union([1, 2, 3], [101, 2, 1, 10], [2, 1]);
|
||||
|
||||
result = <number[]>_([1, 2, 3]).union([101, 2, 1, 10], [2, 1]).value();
|
||||
|
||||
Vendored
+94
@@ -1437,6 +1437,100 @@ declare module _ {
|
||||
takeRight<TResult>(n?: number): LoDashArrayWrapper<TResult>;
|
||||
}
|
||||
|
||||
//_.takeRightWhile
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
* Creates a slice of array with elements taken from the end. Elements are taken until predicate returns
|
||||
* falsey. The predicate is bound to thisArg and invoked with three arguments: (value, index, array).
|
||||
*
|
||||
* If a property name is provided for predicate the created _.property style callback returns the property
|
||||
* value of the given element.
|
||||
*
|
||||
* If a value is also provided for thisArg the created _.matchesProperty style callback returns true for
|
||||
* elements that have a matching property value, else false.
|
||||
*
|
||||
* If an object is provided for predicate the created _.matches style callback returns true for elements that
|
||||
* have the properties of the given object, else false.
|
||||
*
|
||||
* @param array The array to query.
|
||||
* @param predicate The function invoked per iteration.
|
||||
* @param thisArg The this binding of predicate.
|
||||
* @return Returns the slice of array.
|
||||
*/
|
||||
takeRightWhile<TValue>(
|
||||
array: List<TValue>,
|
||||
predicate?: ListIterator<TValue, boolean>,
|
||||
thisArg?: any
|
||||
): TValue[];
|
||||
|
||||
/**
|
||||
* @see _.takeRightWhile
|
||||
*/
|
||||
takeRightWhile<TValue>(
|
||||
array: List<TValue>,
|
||||
predicate?: string,
|
||||
thisArg?: any
|
||||
): TValue[];
|
||||
|
||||
/**
|
||||
* @see _.takeRightWhile
|
||||
*/
|
||||
takeRightWhile<TWhere, TValue>(
|
||||
array: List<TValue>,
|
||||
predicate?: TWhere
|
||||
): TValue[];
|
||||
}
|
||||
|
||||
interface LoDashArrayWrapper<T> {
|
||||
/**
|
||||
* @see _.takeRightWhile
|
||||
*/
|
||||
takeRightWhile(
|
||||
predicate?: ListIterator<T, boolean>,
|
||||
thisArg?: any
|
||||
): LoDashArrayWrapper<T>;
|
||||
|
||||
/**
|
||||
* @see _.takeRightWhile
|
||||
*/
|
||||
takeRightWhile(
|
||||
predicate?: string,
|
||||
thisArg?: any
|
||||
): LoDashArrayWrapper<T>;
|
||||
|
||||
/**
|
||||
* @see _.takeRightWhile
|
||||
*/
|
||||
takeRightWhile<TWhere>(
|
||||
predicate?: TWhere
|
||||
): LoDashArrayWrapper<T>;
|
||||
}
|
||||
|
||||
interface LoDashObjectWrapper<T> {
|
||||
/**
|
||||
* @see _.takeRightWhile
|
||||
*/
|
||||
takeRightWhile<TValue>(
|
||||
predicate?: ListIterator<TValue, boolean>,
|
||||
thisArg?: any
|
||||
): LoDashArrayWrapper<TValue>;
|
||||
|
||||
/**
|
||||
* @see _.takeRightWhile
|
||||
*/
|
||||
takeRightWhile<TValue>(
|
||||
predicate?: string,
|
||||
thisArg?: any
|
||||
): LoDashArrayWrapper<TValue>;
|
||||
|
||||
/**
|
||||
* @see _.takeRightWhile
|
||||
*/
|
||||
takeRightWhile<TWhere, TValue>(
|
||||
predicate?: TWhere
|
||||
): LoDashArrayWrapper<TValue>;
|
||||
}
|
||||
|
||||
//_.union
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user