@fraczak/k 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/k.coffee +1 -1
- package/k.js +1 -1
- package/k.sh +1 -1
- package/package.json +1 -1
- package/run.coffee +6 -6
- package/run.js +5 -5
package/k.coffee
CHANGED
package/k.js
CHANGED
package/k.sh
CHANGED
package/package.json
CHANGED
package/run.coffee
CHANGED
|
@@ -35,7 +35,7 @@ builtin =
|
|
|
35
35
|
|
|
36
36
|
|
|
37
37
|
run = (exp, value) ->
|
|
38
|
-
return undefined
|
|
38
|
+
return undefined if value is undefined
|
|
39
39
|
try
|
|
40
40
|
switch exp.op
|
|
41
41
|
when "identity"
|
|
@@ -51,26 +51,26 @@ run = (exp, value) ->
|
|
|
51
51
|
when "comp"
|
|
52
52
|
return exp.comp.reduce (value, exp) ->
|
|
53
53
|
value = run exp, value
|
|
54
|
-
throw new Error "Undefined"
|
|
54
|
+
throw new Error "Undefined" if value is undefined
|
|
55
55
|
value
|
|
56
56
|
, value
|
|
57
57
|
when "vector"
|
|
58
58
|
return exp.vector.map (exp) ->
|
|
59
59
|
result = run exp, value
|
|
60
|
-
throw new Error "Undefined"
|
|
60
|
+
throw new Error "Undefined" if result is undefined
|
|
61
61
|
result
|
|
62
62
|
when "union"
|
|
63
63
|
for e in exp.union
|
|
64
64
|
result = try run e, value
|
|
65
|
-
return result
|
|
65
|
+
return result unless result is undefined
|
|
66
66
|
return undefined
|
|
67
67
|
when "product"
|
|
68
68
|
return exp.product.reduce (result, {label, exp}) ->
|
|
69
69
|
do (value = run exp, value) ->
|
|
70
|
-
throw new Error "Undefined"
|
|
70
|
+
throw new Error "Undefined" if value is undefined
|
|
71
71
|
result[label] = value
|
|
72
72
|
result
|
|
73
73
|
, {}
|
|
74
74
|
|
|
75
75
|
|
|
76
|
-
module.exports = run
|
|
76
|
+
module.exports = run
|
package/run.js
CHANGED
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
|
|
89
89
|
run = function(exp, value) {
|
|
90
90
|
var e, i, len, ref, result;
|
|
91
|
-
if (value
|
|
91
|
+
if (value === void 0) {
|
|
92
92
|
return void 0;
|
|
93
93
|
}
|
|
94
94
|
try {
|
|
@@ -110,7 +110,7 @@
|
|
|
110
110
|
case "comp":
|
|
111
111
|
return exp.comp.reduce(function(value, exp) {
|
|
112
112
|
value = run(exp, value);
|
|
113
|
-
if (value
|
|
113
|
+
if (value === void 0) {
|
|
114
114
|
throw new Error("Undefined");
|
|
115
115
|
}
|
|
116
116
|
return value;
|
|
@@ -119,7 +119,7 @@
|
|
|
119
119
|
return exp.vector.map(function(exp) {
|
|
120
120
|
var result;
|
|
121
121
|
result = run(exp, value);
|
|
122
|
-
if (result
|
|
122
|
+
if (result === void 0) {
|
|
123
123
|
throw new Error("Undefined");
|
|
124
124
|
}
|
|
125
125
|
return result;
|
|
@@ -133,7 +133,7 @@
|
|
|
133
133
|
return run(e, value);
|
|
134
134
|
} catch (error) {}
|
|
135
135
|
})();
|
|
136
|
-
if (result
|
|
136
|
+
if (result !== void 0) {
|
|
137
137
|
return result;
|
|
138
138
|
}
|
|
139
139
|
}
|
|
@@ -141,7 +141,7 @@
|
|
|
141
141
|
case "product":
|
|
142
142
|
return exp.product.reduce(function(result, {label, exp}) {
|
|
143
143
|
return (function(value) {
|
|
144
|
-
if (value
|
|
144
|
+
if (value === void 0) {
|
|
145
145
|
throw new Error("Undefined");
|
|
146
146
|
}
|
|
147
147
|
result[label] = value;
|