Avoid unnecessary return values
Showing
3 changed files
with
17 additions
and
27 deletions
... | @@ -161,7 +161,7 @@ | ... | @@ -161,7 +161,7 @@ |
161 | }; | 161 | }; |
162 | 162 | ||
163 | View.prototype.build = function() { | 163 | View.prototype.build = function() { |
164 | var bindingRegExp, el, eventRegExp, iterationRegExp, iterator, node, parseNode, skipNodes, _i, _len, _ref, _results, | 164 | var bindingRegExp, el, eventRegExp, iterationRegExp, iterator, node, parseNode, skipNodes, _i, _j, _len, _len1, _ref, _ref1, |
165 | _this = this; | 165 | _this = this; |
166 | this.bindings = []; | 166 | this.bindings = []; |
167 | skipNodes = []; | 167 | skipNodes = []; |
... | @@ -170,7 +170,7 @@ | ... | @@ -170,7 +170,7 @@ |
170 | eventRegExp = /^on-/; | 170 | eventRegExp = /^on-/; |
171 | iterationRegExp = /^each-/; | 171 | iterationRegExp = /^each-/; |
172 | parseNode = function(node) { | 172 | parseNode = function(node) { |
173 | var a, attribute, binding, context, ctx, dependencies, keypath, model, n, options, path, pipe, pipes, splitPath, type, _i, _j, _k, _l, _len, _len1, _len2, _len3, _ref, _ref1, _ref2, _results; | 173 | var a, attribute, binding, context, ctx, dependencies, keypath, model, n, options, path, pipe, pipes, splitPath, type, _i, _j, _k, _l, _len, _len1, _len2, _len3, _ref, _ref1, _ref2; |
174 | if (__indexOf.call(skipNodes, node) < 0) { | 174 | if (__indexOf.call(skipNodes, node) < 0) { |
175 | _ref = node.attributes; | 175 | _ref = node.attributes; |
176 | for (_i = 0, _len = _ref.length; _i < _len; _i++) { | 176 | for (_i = 0, _len = _ref.length; _i < _len; _i++) { |
... | @@ -190,31 +190,30 @@ | ... | @@ -190,31 +190,30 @@ |
190 | } | 190 | } |
191 | } | 191 | } |
192 | _ref2 = iterator || node.attributes; | 192 | _ref2 = iterator || node.attributes; |
193 | _results = []; | ||
194 | for (_k = 0, _len2 = _ref2.length; _k < _len2; _k++) { | 193 | for (_k = 0, _len2 = _ref2.length; _k < _len2; _k++) { |
195 | attribute = _ref2[_k]; | 194 | attribute = _ref2[_k]; |
196 | if (bindingRegExp.test(attribute.name)) { | 195 | if (bindingRegExp.test(attribute.name)) { |
197 | options = {}; | 196 | options = {}; |
198 | type = attribute.name.replace(bindingRegExp, ''); | 197 | type = attribute.name.replace(bindingRegExp, ''); |
199 | pipes = (function() { | 198 | pipes = (function() { |
200 | var _l, _len3, _ref3, _results1; | 199 | var _l, _len3, _ref3, _results; |
201 | _ref3 = attribute.value.split('|'); | 200 | _ref3 = attribute.value.split('|'); |
202 | _results1 = []; | 201 | _results = []; |
203 | for (_l = 0, _len3 = _ref3.length; _l < _len3; _l++) { | 202 | for (_l = 0, _len3 = _ref3.length; _l < _len3; _l++) { |
204 | pipe = _ref3[_l]; | 203 | pipe = _ref3[_l]; |
205 | _results1.push(pipe.trim()); | 204 | _results.push(pipe.trim()); |
206 | } | 205 | } |
207 | return _results1; | 206 | return _results; |
208 | })(); | 207 | })(); |
209 | context = (function() { | 208 | context = (function() { |
210 | var _l, _len3, _ref3, _results1; | 209 | var _l, _len3, _ref3, _results; |
211 | _ref3 = pipes.shift().split('>'); | 210 | _ref3 = pipes.shift().split('>'); |
212 | _results1 = []; | 211 | _results = []; |
213 | for (_l = 0, _len3 = _ref3.length; _l < _len3; _l++) { | 212 | for (_l = 0, _len3 = _ref3.length; _l < _len3; _l++) { |
214 | ctx = _ref3[_l]; | 213 | ctx = _ref3[_l]; |
215 | _results1.push(ctx.trim()); | 214 | _results.push(ctx.trim()); |
216 | } | 215 | } |
217 | return _results1; | 216 | return _results; |
218 | })(); | 217 | })(); |
219 | path = context.shift(); | 218 | path = context.shift(); |
220 | splitPath = path.split(/\.|:/); | 219 | splitPath = path.split(/\.|:/); |
... | @@ -244,31 +243,21 @@ | ... | @@ -244,31 +243,21 @@ |
244 | a = iterator[_l]; | 243 | a = iterator[_l]; |
245 | node.removeAttribute(a.name); | 244 | node.removeAttribute(a.name); |
246 | } | 245 | } |
247 | _results.push(iterator = null); | 246 | iterator = null; |
248 | } else { | ||
249 | _results.push(void 0); | ||
250 | } | 247 | } |
251 | } | 248 | } |
252 | return _results; | ||
253 | } | 249 | } |
254 | }; | 250 | }; |
255 | _ref = this.els; | 251 | _ref = this.els; |
256 | _results = []; | ||
257 | for (_i = 0, _len = _ref.length; _i < _len; _i++) { | 252 | for (_i = 0, _len = _ref.length; _i < _len; _i++) { |
258 | el = _ref[_i]; | 253 | el = _ref[_i]; |
259 | parseNode(el); | 254 | parseNode(el); |
260 | _results.push((function() { | ||
261 | var _j, _len1, _ref1, _results1; | ||
262 | _ref1 = el.getElementsByTagName('*'); | 255 | _ref1 = el.getElementsByTagName('*'); |
263 | _results1 = []; | ||
264 | for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) { | 256 | for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) { |
265 | node = _ref1[_j]; | 257 | node = _ref1[_j]; |
266 | _results1.push(parseNode(node)); | 258 | parseNode(node); |
267 | } | 259 | } |
268 | return _results1; | ||
269 | })()); | ||
270 | } | 260 | } |
271 | return _results; | ||
272 | }; | 261 | }; |
273 | 262 | ||
274 | View.prototype.bind = function() { | 263 | View.prototype.bind = function() { |
... | @@ -436,16 +425,14 @@ | ... | @@ -436,16 +425,14 @@ |
436 | formatters: Rivets.formatters, | 425 | formatters: Rivets.formatters, |
437 | config: Rivets.config, | 426 | config: Rivets.config, |
438 | configure: function(options) { | 427 | configure: function(options) { |
439 | var property, value, _results; | 428 | var property, value; |
440 | if (options == null) { | 429 | if (options == null) { |
441 | options = {}; | 430 | options = {}; |
442 | } | 431 | } |
443 | _results = []; | ||
444 | for (property in options) { | 432 | for (property in options) { |
445 | value = options[property]; | 433 | value = options[property]; |
446 | _results.push(Rivets.config[property] = value); | 434 | Rivets.config[property] = value; |
447 | } | 435 | } |
448 | return _results; | ||
449 | }, | 436 | }, |
450 | bind: function(el, models) { | 437 | bind: function(el, models) { |
451 | var view; | 438 | var view; | ... | ... |
This diff is collapsed.
Click to expand it.
... | @@ -165,10 +165,12 @@ class Rivets.View | ... | @@ -165,10 +165,12 @@ class Rivets.View |
165 | if iterator | 165 | if iterator |
166 | node.removeAttribute(a.name) for a in iterator | 166 | node.removeAttribute(a.name) for a in iterator |
167 | iterator = null | 167 | iterator = null |
168 | return | ||
168 | 169 | ||
169 | for el in @els | 170 | for el in @els |
170 | parseNode el | 171 | parseNode el |
171 | parseNode node for node in el.getElementsByTagName '*' | 172 | parseNode node for node in el.getElementsByTagName '*' |
173 | return | ||
172 | 174 | ||
173 | # Binds all of the current bindings for this view. | 175 | # Binds all of the current bindings for this view. |
174 | bind: => | 176 | bind: => |
... | @@ -291,6 +293,7 @@ rivets = | ... | @@ -291,6 +293,7 @@ rivets = |
291 | configure: (options={}) -> | 293 | configure: (options={}) -> |
292 | for property, value of options | 294 | for property, value of options |
293 | Rivets.config[property] = value | 295 | Rivets.config[property] = value |
296 | return | ||
294 | 297 | ||
295 | # Binds a set of model objects to a parent DOM element. Returns a Rivets.View | 298 | # Binds a set of model objects to a parent DOM element. Returns a Rivets.View |
296 | # instance. | 299 | # instance. | ... | ... |
-
Please register or sign in to post a comment