- commit
- f4287dfb6c4aa08e899947fa2611444db635d893
- parent
- 660237d2d60927914bc54eebb9c2774c11209e2e
- Author
- Tobias Bengfort <tobias.bengfort@gmx.net>
- Date
- 2015-08-28 09:00
switch from void 0 to undefined - easier to read - can be optimised (via alias)
Diffstat
| M | src/muu-directive.js | 4 | ++-- |
| M | src/muu-location.js | 12 | ++++++------ |
| M | src/muu-registry.js | 4 | ++-- |
| M | src/muu-search.js | 2 | +- |
| M | src/muu-template.js | 2 | +- |
5 files changed, 12 insertions, 12 deletions
diff --git a/src/muu-directive.js b/src/muu-directive.js
@@ -131,7 +131,7 @@ define('muu-directive', ['muu-dom-helpers', 'muu-js-helpers', 'muu-update-dom'],
131 131 * @return {string|number|boolean|*}
132 132 */
133 133 this.getModel = function(name, _default) {
134 -1 if (name === void 0) {
-1 134 if (name === undefined) {
135 135 var model = {};
136 136 _.forEach(self.querySelectorAll('[name]'), function(element) {
137 137 model[element.name] = self.getModel(element.name);
@@ -139,7 +139,7 @@ define('muu-directive', ['muu-dom-helpers', 'muu-js-helpers', 'muu-update-dom'],
139 139 return model;
140 140 } else {
141 141 var element = self.querySelector('[name=' + name + ']');
142 -1 if (element === void 0) {
-1 142 if (element === undefined) {
143 143 return _default;
144 144 } else if (element.type === 'checkbox') {
145 145 return element.checked;
diff --git a/src/muu-location.js b/src/muu-location.js
@@ -23,7 +23,7 @@ define('muu-location', ['muu-search'], function(q) {
23 23 * @return {muu-location}
24 24 */
25 25 loc.url = function(value, replace) {
26 -1 if (value === void 0) {
-1 26 if (value === undefined) {
27 27 return location.pathname + location.search + location.hash;
28 28 } else if (replace) {
29 29 history.replaceState(null, null, value);
@@ -62,7 +62,7 @@ define('muu-location', ['muu-search'], function(q) {
62 62 * @return {muu-location}
63 63 */
64 64 loc.path = function(value, replace) {
65 -1 if (value === void 0) {
-1 65 if (value === undefined) {
66 66 return location.pathname;
67 67 } else {
68 68 var url = value + location.search + location.hash;
@@ -72,7 +72,7 @@ define('muu-location', ['muu-search'], function(q) {
72 72 };
73 73
74 74 var _search = function(value, replace) {
75 -1 if (value === void 0) {
-1 75 if (value === undefined) {
76 76 return location.search;
77 77 } else {
78 78 if (value && value[0] !== '?') {
@@ -100,8 +100,8 @@ define('muu-location', ['muu-search'], function(q) {
100 100 * @return {muu-location}
101 101 */
102 102 loc.search = function(key, value, replace) {
103 -1 if (key !== void 0) {
104 -1 if (value !== void 0) {
-1 103 if (key !== undefined) {
-1 104 if (value !== undefined) {
105 105 var search = q.parse(_search());
106 106 search[key] = value;
107 107 return _search(q.unparse(search), replace);
@@ -121,7 +121,7 @@ define('muu-location', ['muu-search'], function(q) {
121 121 * @return {muu-location}
122 122 */
123 123 loc.hash = function(value, replace) {
124 -1 if (value === void 0) {
-1 124 if (value === undefined) {
125 125 if (location.hash) {
126 126 return location.hash.slice(1);
127 127 } else {
diff --git a/src/muu-registry.js b/src/muu-registry.js
@@ -86,7 +86,7 @@ define('muu-registry', ['muu-template', 'muu-directive', 'muu-js-helpers', 'muu-
86 86 * @return {Directive}
87 87 */
88 88 this.link = function(element, type) {
89 -1 if (type === void 0) {
-1 89 if (type === undefined) {
90 90 type = element.getAttribute('type');
91 91 }
92 92
@@ -106,7 +106,7 @@ define('muu-registry', ['muu-template', 'muu-directive', 'muu-js-helpers', 'muu-
106 106 element.directive = directive;
107 107 }
108 108
109 -1 if (unlink !== void 0) {
-1 109 if (unlink !== undefined) {
110 110 $.destroy(element, unlink);
111 111 }
112 112
diff --git a/src/muu-search.js b/src/muu-search.js
@@ -28,7 +28,7 @@ define('muu-search', ['muu-js-helpers'], function(_) {
28 28 };
29 29
30 30 var unparseItem = function(key, value) {
31 -1 if (value === void 0 || value === null || value === false) {
-1 31 if (value === undefined || value === null || value === false) {
32 32 return [];
33 33 } else if (_.isArray(value)) {
34 34 return _.flatten(_.map(value, function(v) {
diff --git a/src/muu-template.js b/src/muu-template.js
@@ -159,7 +159,7 @@ define('muu-template', ['muu-js-helpers', 'muu-dom-helpers'], function(_, $) {
159 159 var parseTemplate = function(template, loopName) {
160 160 var openIndex = template.indexOf(openTag);
161 161 if (openIndex === -1) {
162 -1 if (loopName === void 0) {
-1 162 if (loopName === undefined) {
163 163 return function() {
164 164 return template;
165 165 };