mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-08-26 11:12:19 +08:00
lodash: changed _.slice() method
This commit is contained in:
+12
-2
@@ -135,8 +135,6 @@ result = <number>_([1, 2, 3, 4]).pop();
|
||||
result = <_.LoDashArrayWrapper<number>>_([1, 2, 3, 4]).push(5, 6, 7);
|
||||
result = <_.LoDashArrayWrapper<number>>_([1, 2, 3, 4]).reverse();
|
||||
result = <number>_([1, 2, 3, 4]).shift();
|
||||
result = <_.LoDashArrayWrapper<number>>_([1, 2, 3, 4]).slice(1, 2);
|
||||
result = <_.LoDashArrayWrapper<number>>_([1, 2, 3, 4]).slice(2);
|
||||
result = <_.LoDashArrayWrapper<number>>_([1, 2, 3, 4]).sort((a, b) => 1);
|
||||
result = <_.LoDashArrayWrapper<number>>_([1, 2, 3, 4]).splice(1);
|
||||
result = <_.LoDashArrayWrapper<number>>_([1, 2, 3, 4]).splice(1, 2, 5, 6);
|
||||
@@ -315,6 +313,18 @@ result = <IFoodOrganic[]>_.remove(foodsOrganic, 'organic');
|
||||
result = <IFoodType[]>_.remove(foodsType, { 'type': 'vegetable' });
|
||||
var typedResult: IFoodType[] = _.remove([ <IFoodType>{ name: 'apple' }, <IFoodType>{ name: 'orange' }], <IFoodType>{ name: 'orange' });
|
||||
|
||||
// _.slice
|
||||
{
|
||||
let testSliceArray: TResult[];
|
||||
let result: TResult[];
|
||||
result = _.slice(testSliceArray);
|
||||
result = _.slice(testSliceArray, 42);
|
||||
result = _.slice(testSliceArray, 42, 42);
|
||||
result = _(testSliceArray).slice().value();
|
||||
result = _(testSliceArray).slice(42).value();
|
||||
result = _(testSliceArray).slice(42, 42).value();
|
||||
}
|
||||
|
||||
result = <number>_.sortedIndex([20, 30, 50], 40);
|
||||
result = <number>_.sortedIndex([{ 'x': 20 }, { 'x': 30 }, { 'x': 50 }], { 'x': 40 }, 'x');
|
||||
var sortedIndexDict: { wordToNumber: { [idx: string]: number } } = {
|
||||
|
||||
Vendored
+27
-1
@@ -258,7 +258,6 @@ declare module _ {
|
||||
push(...items: T[]): LoDashArrayWrapper<T>;
|
||||
reverse(): LoDashArrayWrapper<T>;
|
||||
shift(): T;
|
||||
slice(start: number, end?: number): LoDashArrayWrapper<T>;
|
||||
sort(compareFn?: (a: T, b: T) => number): LoDashArrayWrapper<T>;
|
||||
splice(start: number): LoDashArrayWrapper<T>;
|
||||
splice(start: number, deleteCount: number, ...items: any[]): LoDashArrayWrapper<T>;
|
||||
@@ -1417,6 +1416,33 @@ declare module _ {
|
||||
whereValue: W): T[];
|
||||
}
|
||||
|
||||
//_.slice
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
* Creates a slice of array from start up to, but not including, end.
|
||||
*
|
||||
* @param array The array to slice.
|
||||
* @param start The start position.
|
||||
* @param end The end position.
|
||||
* @return Returns the slice of array.
|
||||
*/
|
||||
slice<T>(
|
||||
array: T[],
|
||||
start?: number,
|
||||
end?: number
|
||||
): T[];
|
||||
}
|
||||
|
||||
interface LoDashArrayWrapper<T> {
|
||||
/**
|
||||
* @see _.slice
|
||||
*/
|
||||
slice(
|
||||
start?: number,
|
||||
end?: number
|
||||
): LoDashArrayWrapper<T>;
|
||||
}
|
||||
|
||||
//_.sortedIndex
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user