[Pkg-javascript-commits] [node-umd] 05/07: Overrides the last name in the chain regardless of previous definitions.
Bastien Roucariès
rouca at moszumanska.debian.org
Mon Apr 17 07:38:09 UTC 2017
This is an automated email from the git hooks/post-receive script.
rouca pushed a commit to annotated tag 2.0.0
in repository node-umd.
commit d469234239ddf1348fe779b2415751aa6629c4f3
Author: Quildreen "Sorella" Motta <quildreen at gmail.com>
Date: Thu Nov 28 22:50:21 2013 -0200
Overrides the last name in the chain regardless of previous definitions.
---
index.js | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)
diff --git a/index.js b/index.js
index e58d230..5124cdf 100644
--- a/index.js
+++ b/index.js
@@ -70,21 +70,15 @@ function compileNamespace(name) {
// Worst case, too many namespaces to care about
} else {
+ var valueContainer = names.pop()
return names.reduce(compileNamespaceStep, ['var ref$ = g'])
+ .concat(['ref$.' + camelCase(valueContainer) + ' = f()'])
.join(';\n ');
}
}
function compileNamespaceStep(code, name, i, names) {
- var value
-
- if (i === names.length - 1) {
- value = 'f()';
- } else {
- value = '{}';
- }
-
name = camelCase(name);
- code.push('ref$ = (ref$.' + name + ' || (ref$.' + name + ' = ' + value + '))')
+ code.push('ref$ = (ref$.' + name + ' || (ref$.' + name + ' = {}))')
return code
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-umd.git
More information about the Pkg-javascript-commits
mailing list