Skip to content

Commit

Permalink
Minor null check refactoring.
Browse files Browse the repository at this point in the history
  • Loading branch information
asual committed May 12, 2012
1 parent 5051639 commit ca9875b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/jquery.address.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
_st(_track, 10); _st(_track, 10);
}, },
_track = function() { _track = function() {
if (_opts.tracker !== 'null' && _opts.tracker !== null) { if (_opts.tracker !== 'null' && _opts.tracker !== NULL) {
var fn = $.isFunction(_opts.tracker) ? _opts.tracker : _t[_opts.tracker], var fn = $.isFunction(_opts.tracker) ? _opts.tracker : _t[_opts.tracker],
value = (_l.pathname + _l.search + value = (_l.pathname + _l.search +
($.address && !_supportsState() ? $.address.value() : '')) ($.address && !_supportsState() ? $.address.value() : ''))
Expand Down Expand Up @@ -143,7 +143,7 @@
_opts[param[0]] = param[1]; _opts[param[0]] = param[1];
} }
} }
_url = null; _url = NULL;
} }
_value = _href(); _value = _href();
}, },
Expand Down Expand Up @@ -537,22 +537,22 @@
if (value !== UNDEFINED) { if (value !== UNDEFINED) {
var names = this.parameterNames(); var names = this.parameterNames();
params = []; params = [];
value = value === UNDEFINED || value === null ? '' : value.toString(); value = value === UNDEFINED || value === NULL ? '' : value.toString();
for (i = 0; i < names.length; i++) { for (i = 0; i < names.length; i++) {
var n = names[i], var n = names[i],
v = this.parameter(n); v = this.parameter(n);
if (typeof v == STRING) { if (typeof v == STRING) {
v = [v]; v = [v];
} }
if (n == name) { if (n == name) {
v = (value === null || value === '') ? [] : v = (value === NULL || value === '') ? [] :
(append ? v.concat([value]) : [value]); (append ? v.concat([value]) : [value]);
} }
for (var j = 0; j < v.length; j++) { for (var j = 0; j < v.length; j++) {
params.push(n + '=' + v[j]); params.push(n + '=' + v[j]);
} }
} }
if ($.inArray(name, names) == -1 && value !== null && value !== '') { if ($.inArray(name, names) == -1 && value !== NULL && value !== '') {
params.push(name + '=' + value); params.push(name + '=' + value);
} }
this.queryString(params.join('&')); this.queryString(params.join('&'));
Expand Down

0 comments on commit ca9875b

Please sign in to comment.