Change to natural counting in range[N] operator (#3609)

* Add range operator and documentation

* Use 1-based counting in range[N], update docs
This commit is contained in:
Evan Balster
2018-12-02 08:39:28 +00:00
committed by Jeremy Ruston
parent 0f3912ba95
commit b9df224f99
2 changed files with 21 additions and 10 deletions
+9 -1
View File
@@ -34,8 +34,16 @@ exports.range = function(source,operator,options) {
}
switch(parts.length) {
case 1:
beg = 0;
end = parts[0];
if (end >= 1) {
beg = 1;
}
else if (end <= -1) {
beg = -1;
}
else {
return [];
}
inc = 1;
break;
case 2: