mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-20 16:57:59 +01:00
Sorry, stashed changes including:
Change util.range to accept an increment as the third argument.
Sanitize Makefile.doc
This commit is contained in:
@@ -519,25 +519,28 @@ const util = { //{{{
|
||||
},
|
||||
|
||||
/**
|
||||
* A generator that returns the values between <b>start</b> and <b>end</b>.
|
||||
* If <b>reverse</b> is true then the values are returned in reverse order.
|
||||
* A generator that returns the values between <b>start</b> and <b>end</b>,
|
||||
* in <b>step</b> increments.
|
||||
*
|
||||
* @param {number} start The interval's start value.
|
||||
* @param {number} end The interval's end value.
|
||||
* @param {boolean} reverse Reverse the order in which the values are produced.
|
||||
* @param {boolean} step The value to step the range by. May be
|
||||
* negative. @default 1
|
||||
* @returns {Iterator(Object)}
|
||||
*/
|
||||
range: function range(start, end, reverse)
|
||||
range: function range(start, end, step)
|
||||
{
|
||||
if (!reverse)
|
||||
if (!step)
|
||||
step = 1;
|
||||
if (step > 0)
|
||||
{
|
||||
while (start < end)
|
||||
yield start++;
|
||||
for (; start < end; start += step)
|
||||
yield start;
|
||||
}
|
||||
else
|
||||
{
|
||||
while (start > end)
|
||||
yield --start;
|
||||
yield start += step;
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user