lodash: changed _.range() method

This commit is contained in:
Ilya Mochalov
2015-08-15 22:52:10 +05:00
parent 5109e1269d
commit 88a353262b
2 changed files with 41 additions and 32 deletions
+8 -7
View File
@@ -303,13 +303,6 @@ result = <_.LoDashObjectWrapper<_.Dictionary<any>>>_([['moe', 30], ['larry', 40]
result = <number[]>_.pull([1, 2, 3, 1, 2, 3], 2, 3);
result = <number[]>_.pullAt([1, 2, 3, 1, 2, 3], 2, 3);
result = <number[]>_.range(10);
result = <number[]>_.range(1, 11);
result = <number[]>_.range(0, 30, 5);
result = <number[]>_.range(0, -10, -1);
result = <number[]>_.range(1, 4, 0);
result = <number[]>_.range(0);
result = <number[]>_.remove([1, 2, 3, 4, 5, 6], function (num: number) { return num % 2 == 0; });
result = <IFoodOrganic[]>_.remove(foodsOrganic, 'organic');
result = <IFoodType[]>_.remove(foodsType, { 'type': 'vegetable' });
@@ -1501,6 +1494,14 @@ result = <(path: string|string[]) => any>_.propertyOf({});
result = <(path: string|string[]) => any>_.propertyOf<TestPropertyOfObject>(testPropertyOfObject);
result = <(path: string|string[]) => any>_({}).propertyOf().value();
// _.range
result = <number[]>_.range(10);
result = <number[]>_.range(1, 11);
result = <number[]>_.range(0, 30, 5);
result = <number[]>_(10).range().value();
result = <number[]>_(1).range(11).value();
result = <number[]>_(0).range(30, 5).value();
result = <_.TemplateExecutor>_.template('hello <%= name %>');
result = <string>_.template('<b><%- value %></b>', { 'value': '<script>' });
+33 -25
View File
@@ -1133,31 +1133,6 @@ declare module _ {
...values: any[]): any[];
}
//_.range
interface LoDashStatic {
/**
* Creates an array of numbers (positive and/or negative) progressing from start up
* to but not including end. If start is less than stop a zero-length range is created
* unless a negative step is specified.
* @param start The start of the range.
* @param end The end of the range.
* @param step The value to increment or decrement by.
* @return Returns a new range array.
**/
range(
start: number,
stop: number,
step?: number): number[];
/**
* @see _.range
* @param end The end of the range.
* @return Returns a new range array.
* @note If start is not specified the implementation will never pull the step (step = arguments[2] || 0)
**/
range(stop: number): number[];
}
//_.remove
interface LoDashStatic {
/**
@@ -7423,6 +7398,39 @@ declare module _ {
propertyOf(): LoDashObjectWrapper<(path: string|string[]) => any>;
}
//_.range
interface LoDashStatic {
/**
* Creates an array of numbers (positive and/or negative) progressing from start up to, but not including, end.
* If end is not specified its set to start with start then set to 0. If end is less than start a zero-length
* range is created unless a negative step is specified.
* @param start The start of the range.
* @param end The end of the range.
* @param step The value to increment or decrement by.
* @return Returns a new range array.
*/
range(
start: number,
end: number,
step?: number): number[];
/**
* @see _.range
*/
range(
end: number,
step?: number): number[];
}
interface LoDashWrapper<T> {
/**
* @see _.range
*/
range(
end?: number,
step?: number): LoDashArrayWrapper<number>;
}
//_.random
interface LoDashStatic {
/**