mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-08-30 11:14:27 +08:00
Merge pull request #6201 from chrootsu/lodash-dropRightWhile
lodash: added signatures of the method _.dropRightWhile
This commit is contained in:
+42
-6
@@ -240,6 +240,42 @@ module TestDropRight {
|
||||
result = _(list).dropRight<TResult>(42).value();
|
||||
}
|
||||
|
||||
// _.dropRightWhile
|
||||
module TestDropRightWhile {
|
||||
let array: TResult[];
|
||||
let list: _.List<TResult>;
|
||||
let predicateFn: (value: TResult, index: number, collection: _.List<TResult>) => boolean;
|
||||
let result: TResult[];
|
||||
|
||||
result = _.dropRightWhile<TResult>(array);
|
||||
result = _.dropRightWhile<TResult>(array, predicateFn);
|
||||
result = _.dropRightWhile<TResult>(array, predicateFn, any);
|
||||
result = _.dropRightWhile<TResult>(array, '');
|
||||
result = _.dropRightWhile<TResult>(array, '', any);
|
||||
result = _.dropRightWhile<{a: number;}, TResult>(array, {a: 42});
|
||||
|
||||
result = _.dropRightWhile<TResult>(list);
|
||||
result = _.dropRightWhile<TResult>(list, predicateFn);
|
||||
result = _.dropRightWhile<TResult>(list, predicateFn, any);
|
||||
result = _.dropRightWhile<TResult>(list, '');
|
||||
result = _.dropRightWhile<TResult>(list, '', any);
|
||||
result = _.dropRightWhile<{a: number;}, TResult>(list, {a: 42});
|
||||
|
||||
result = _(array).dropRightWhile().value();
|
||||
result = _(array).dropRightWhile(predicateFn).value();
|
||||
result = _(array).dropRightWhile(predicateFn, any).value();
|
||||
result = _(array).dropRightWhile('').value();
|
||||
result = _(array).dropRightWhile('', any).value();
|
||||
result = _(array).dropRightWhile<{a: number;}>({a: 42}).value();
|
||||
|
||||
result = _(list).dropRightWhile<TResult>().value();
|
||||
result = _(list).dropRightWhile<TResult>(predicateFn).value();
|
||||
result = _(list).dropRightWhile<TResult>(predicateFn, any).value();
|
||||
result = _(list).dropRightWhile<TResult>('').value();
|
||||
result = _(list).dropRightWhile<TResult>('', any).value();
|
||||
result = _(list).dropRightWhile<{a: number;}, TResult>({a: 42}).value();
|
||||
}
|
||||
|
||||
// _.dropWhile
|
||||
module TestDropWhile {
|
||||
let array: TResult[];
|
||||
@@ -250,14 +286,14 @@ module TestDropWhile {
|
||||
result = _.dropWhile<TResult>(array);
|
||||
result = _.dropWhile<TResult>(array, predicateFn);
|
||||
result = _.dropWhile<TResult>(array, predicateFn, any);
|
||||
result = _.dropWhile<TResult>(array, '')
|
||||
result = _.dropWhile<TResult>(array, '');
|
||||
result = _.dropWhile<TResult>(array, '', any);
|
||||
result = _.dropWhile<{a: number;}, TResult>(array, {a: 42});
|
||||
|
||||
result = _.dropWhile<TResult>(list);
|
||||
result = _.dropWhile<TResult>(list, predicateFn);
|
||||
result = _.dropWhile<TResult>(list, predicateFn, any);
|
||||
result = _.dropWhile<TResult>(list, '')
|
||||
result = _.dropWhile<TResult>(list, '');
|
||||
result = _.dropWhile<TResult>(list, '', any);
|
||||
result = _.dropWhile<{a: number;}, TResult>(list, {a: 42});
|
||||
|
||||
@@ -648,14 +684,14 @@ module TestTakeRightWhile {
|
||||
result = _.takeRightWhile<TResult>(array);
|
||||
result = _.takeRightWhile<TResult>(array, predicateFn);
|
||||
result = _.takeRightWhile<TResult>(array, predicateFn, any);
|
||||
result = _.takeRightWhile<TResult>(array, '')
|
||||
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, '');
|
||||
result = _.takeRightWhile<TResult>(list, '', any);
|
||||
result = _.takeRightWhile<{a: number;}, TResult>(list, {a: 42});
|
||||
|
||||
@@ -684,14 +720,14 @@ module TestTakeWhile {
|
||||
result = _.takeWhile<TResult>(array);
|
||||
result = _.takeWhile<TResult>(array, predicateFn);
|
||||
result = _.takeWhile<TResult>(array, predicateFn, any);
|
||||
result = _.takeWhile<TResult>(array, '')
|
||||
result = _.takeWhile<TResult>(array, '');
|
||||
result = _.takeWhile<TResult>(array, '', any);
|
||||
result = _.takeWhile<{a: number;}, TResult>(array, {a: 42});
|
||||
|
||||
result = _.takeWhile<TResult>(list);
|
||||
result = _.takeWhile<TResult>(list, predicateFn);
|
||||
result = _.takeWhile<TResult>(list, predicateFn, any);
|
||||
result = _.takeWhile<TResult>(list, '')
|
||||
result = _.takeWhile<TResult>(list, '');
|
||||
result = _.takeWhile<TResult>(list, '', any);
|
||||
result = _.takeWhile<{a: number;}, TResult>(list, {a: 42});
|
||||
|
||||
|
||||
Vendored
+94
@@ -457,6 +457,100 @@ declare module _ {
|
||||
dropRight<TResult>(n?: number): LoDashArrayWrapper<TResult>;
|
||||
}
|
||||
|
||||
//_.dropRightWhile
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
* Creates a slice of array excluding elements dropped from the end. Elements are dropped 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
|
||||
* match 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.
|
||||
*/
|
||||
dropRightWhile<TValue>(
|
||||
array: List<TValue>,
|
||||
predicate?: ListIterator<TValue, boolean>,
|
||||
thisArg?: any
|
||||
): TValue[];
|
||||
|
||||
/**
|
||||
* @see _.dropRightWhile
|
||||
*/
|
||||
dropRightWhile<TValue>(
|
||||
array: List<TValue>,
|
||||
predicate?: string,
|
||||
thisArg?: any
|
||||
): TValue[];
|
||||
|
||||
/**
|
||||
* @see _.dropRightWhile
|
||||
*/
|
||||
dropRightWhile<TWhere, TValue>(
|
||||
array: List<TValue>,
|
||||
predicate?: TWhere
|
||||
): TValue[];
|
||||
}
|
||||
|
||||
interface LoDashArrayWrapper<T> {
|
||||
/**
|
||||
* @see _.dropRightWhile
|
||||
*/
|
||||
dropRightWhile(
|
||||
predicate?: ListIterator<T, boolean>,
|
||||
thisArg?: any
|
||||
): LoDashArrayWrapper<T>;
|
||||
|
||||
/**
|
||||
* @see _.dropRightWhile
|
||||
*/
|
||||
dropRightWhile(
|
||||
predicate?: string,
|
||||
thisArg?: any
|
||||
): LoDashArrayWrapper<T>;
|
||||
|
||||
/**
|
||||
* @see _.dropRightWhile
|
||||
*/
|
||||
dropRightWhile<TWhere>(
|
||||
predicate?: TWhere
|
||||
): LoDashArrayWrapper<T>;
|
||||
}
|
||||
|
||||
interface LoDashObjectWrapper<T> {
|
||||
/**
|
||||
* @see _.dropRightWhile
|
||||
*/
|
||||
dropRightWhile<TValue>(
|
||||
predicate?: ListIterator<TValue, boolean>,
|
||||
thisArg?: any
|
||||
): LoDashArrayWrapper<TValue>;
|
||||
|
||||
/**
|
||||
* @see _.dropRightWhile
|
||||
*/
|
||||
dropRightWhile<TValue>(
|
||||
predicate?: string,
|
||||
thisArg?: any
|
||||
): LoDashArrayWrapper<TValue>;
|
||||
|
||||
/**
|
||||
* @see _.dropRightWhile
|
||||
*/
|
||||
dropRightWhile<TWhere, TValue>(
|
||||
predicate?: TWhere
|
||||
): LoDashArrayWrapper<TValue>;
|
||||
}
|
||||
|
||||
//_.dropWhile
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user