liquidscript 0.10.1 → 0.10.2
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d86b163ef0293732b6aca713fccb309af5239f05
|
4
|
+
data.tar.gz: 15b8b68dceba0eafbda48be35f3dd1b0b71d13a8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ee42e06c937b2243f25e2db3618533cb58179581459d61cf174733549398b2a353c56d1c33ebb1f0baaea47ac41efac7e9d60b751ba687b25371d0230bbe6509
|
7
|
+
data.tar.gz: 676fe68eb8b5a2af88b8d8bd25a1fd2a14dfd44e79e8284ffbef9c4e49117d36841858d82337c7f68123a5cf41a2b49f53f6428938ae782a31e748de38a0b7dc
|
@@ -28,11 +28,16 @@ module Liquidscript
|
|
28
28
|
def generate_range(code)
|
29
29
|
out = buffer
|
30
30
|
out << "(function(a, b) {\n" <<
|
31
|
-
indent! << "var out, i;\n"
|
31
|
+
indent! << "var out, i, t;\n" <<
|
32
|
+
indent << "out = [];\n" <<
|
33
|
+
indent << "if(a > b) {\n" <<
|
34
|
+
indent! << "t = a; a = b; b = t;\n" <<
|
35
|
+
unindent! << "}\n" <<
|
32
36
|
indent << "for(i = a; i <= b; i++) {\n" <<
|
33
37
|
indent! << "out.push(i);\n" <<
|
34
38
|
unindent! << "};\n" <<
|
35
|
-
indent << "return
|
39
|
+
indent << "return t === undefined ?" <<
|
40
|
+
"out : out.reverse();\n" <<
|
36
41
|
unindent! << "})(" << replace(code[1]) << ", " <<
|
37
42
|
replace(code[2]) << ")"
|
38
43
|
out
|
data/lib/liquidscript/version.rb
CHANGED
@@ -13,10 +13,14 @@ compiled: |
|
|
13
13
|
var test;
|
14
14
|
console = 3;
|
15
15
|
test = (function(a, b) {
|
16
|
-
var out, i;
|
16
|
+
var out, i, t;
|
17
|
+
out = [];
|
18
|
+
if(a > b) {
|
19
|
+
t = a; a = b; b = t;
|
20
|
+
}
|
17
21
|
for(i = a; i <= b; i++) {
|
18
22
|
out.push(i);
|
19
23
|
};
|
20
|
-
return out;
|
24
|
+
return t === undefined ? out : out.reverse();
|
21
25
|
})(0, console);
|
22
26
|
};
|