fix semicolons

This commit is contained in:
rolux 2014-08-19 10:19:59 +02:00
parent 4fbfc139b4
commit 1b90cc6ac8
12 changed files with 38 additions and 38 deletions

View file

@ -15,7 +15,7 @@
}, that, function() {
callback(type == 'string' ? results.join('') : results);
});
};
}
Ox.asyncMap = function(array, iterator, that, callback) {
array = Ox.makeArray(array);

View file

@ -311,7 +311,7 @@ Ox.max <f> Returns the maximum value of a collection
Ox.max = function(collection) {
var ret, values = Ox.values(collection);
if (values.length < Ox.STACK_LENGTH) {
ret = Math.max.apply(null, values)
ret = Math.max.apply(null, values);
} else {
ret = values.reduce(function(previousValue, currentValue) {
return Math.max(previousValue, currentValue);
@ -334,7 +334,7 @@ Ox.min <f> Returns the minimum value of a collection
Ox.min = function(collection) {
var ret, values = Ox.values(collection);
if (values.length < Ox.STACK_LENGTH) {
ret = Math.min.apply(null, values)
ret = Math.min.apply(null, values);
} else {
ret = values.reduce(function(previousValue, currentValue) {
return Math.min(previousValue, currentValue);
@ -507,6 +507,7 @@ Ox.some <f> Tests if one or more elements of a collection meet a given condition
false
@*/
Ox.some = function(collection, iterator) {
// FIXME: use forEach and break!
return Ox.filter(Ox.values(collection), iterator || Ox.identity).length > 0;
};

View file

@ -116,8 +116,7 @@ Ox.localStorage = function(namespace) {
// this will fail if third party cookies/storage is not allowed
localStorage = window.localStorage || {};
// FF 3.6 can't assign to or iterate over localStorage
for (var key in localStorage) {};
for (var key in localStorage) {}
// In Safari (OS X or iOS) is in private browsing mode,
// it appears as though localStorage is available,
// but trying to call .setItem throws an exception.
@ -147,11 +146,11 @@ Ox.localStorage = function(namespace) {
ret = storage;
}
return ret;
};
}
// IE 8 doesn't like `storage.delete`
storage['delete'] = function() {
var keys = arguments.length == 0 ? Object.keys(storage())
: Ox.slice(arguments)
: Ox.slice(arguments);
keys.forEach(function(key) {
delete localStorage[namespace + '.' + key];
});
@ -276,7 +275,7 @@ Ox.print = function() {
Ox.trace = function() {
var args = Ox.slice(arguments);
try {
throw new Error()
throw new Error();
} catch (e) {
if (e.stack) {
args.push('\n' + e.stack.split('\n').slice(2).join('\n'));

View file

@ -29,7 +29,7 @@ Ox.getDateInWeek = function(date, weekday, utc) {
return v.slice(0, 3) == weekday.slice(0, 3);
}) + 1;
return Ox.setDate(date, Ox.getDate(date, utc) - sourceWeekday + targetWeekday, utc);
}
};
//@ Ox.getDay <f> Get the weekday of a date, optionally UTC
// see Ox.setSeconds for source code
@ -76,7 +76,7 @@ Ox.getDaysInMonth = function(year, month) {
}) + 1;
// Set to 1 AM since we may hit a DST change
return new Date(year, month, 0, 1).getDate();
}
};
/*@
Ox.getDaysInYear <f> Get the number of days in a given year
@ -101,7 +101,7 @@ Ox.getFirstDayOfTheYear = function(date, utc) {
date = Ox.makeDate(date);
date = Ox.setMonth(date, 0, utc);
date = Ox.setDate(date, 1, utc);
return Ox.getDay(date, utc)
return Ox.getDay(date, utc);
};
//@ Ox.getFullYear <f> Get the year of a date, optionally UTC
@ -356,11 +356,11 @@ Ox.parseDateRange = function(start, end, utc) {
].forEach(function(part) {
Ox['get' + part] = function(date, utc) {
return Ox.makeDate(date)['get' + (utc ? 'UTC' : '') + part]();
}
};
// Ox.setPart(date) modifies date
Ox['set' + part] = function(date, num, utc) {
return (
Ox.isDate(date) ? date : new Date(date)
)['set' + (utc ? 'UTC' : '') + part](num);
}
};
});

View file

@ -236,7 +236,7 @@ Ox.decodeDeflate = function(string, callback) {
error();
}
callback(string);
}
};
image.onerror = error;
image.src = 'data:image/png;base64,' + btoa(data);
};

View file

@ -152,7 +152,7 @@
}
});
return ret;
};
}
/*@
Ox.addLinks <f> Takes a string and adds links for e-mail addresses and URLs
@ -195,7 +195,7 @@
return char == ':' ? ':'
: '&#'
+ (Math.random() < 0.5 ? code : 'x' + code.toString(16))
+ ';'
+ ';';
});
});
return '<a href="' + parts[0] + '">' + parts[1] + '</a>';
@ -341,7 +341,7 @@
// if decoding entities has created new tags, ignore them
splitHTMLTags(string, entities.map(function(entity) {
var ret = entity.position + offset;
offset += entity.length - entity.value.length
offset += entity.length - entity.value.length;
return ret;
})).forEach(function(v, i) {
if (i % 2 == 0) {

View file

@ -140,7 +140,7 @@ Ox.doc = (function() {
}
Ox.last(child[key_])[key].push(value);
}
})
});
});
});
});
@ -163,7 +163,7 @@ Ox.doc = (function() {
}
if (!Ox.contains(visited, name)) {
visited.push(name);
stack.push(name)
stack.push(name);
Ox.forEach(nodes, function(parent, name_) {
parent == name && visit(name_, stack);
});
@ -174,7 +174,7 @@ Ox.doc = (function() {
visit(name);
});
sorted.forEach(function(name) {
chains[name] = [nodes[name]].concat(chains[nodes[name]] || [])
chains[name] = [nodes[name]].concat(chains[nodes[name]] || []);
});
return chains;
}
@ -256,13 +256,13 @@ Ox.doc = (function() {
}
} else {
item.description = item.description
? item.description + ' ' + line : line
? item.description + ' ' + line : line;
}
}
});
item.summary = Ox.parseMarkdown(item.summary);
if (item.description) {
item.description = Ox.parseMarkdown(item.description)
item.description = Ox.parseMarkdown(item.description);
}
if (item.types[0] == 'function') {
item.order = Ox.unique(order);
@ -347,7 +347,7 @@ Ox.doc = (function() {
);
}
} else {
section = tree.line
section = tree.line;
}
});
return items;
@ -433,7 +433,7 @@ Ox.doc = (function() {
string.split('|').forEach(function(string) {
var unwrapped = unwrap(string);
if (unwrapped in types) {
ret.types.push(wrap(types[unwrapped]))
ret.types.push(wrap(types[unwrapped]));
} else if (
(type = Ox.filter(Ox.values(types), function(type) {
return Ox.startsWith(type, unwrapped);
@ -470,10 +470,10 @@ Ox.doc = (function() {
callback(addInheritedProperties(items));
}
});
})
});
}
return ret;
}
};
}());
/*@
@ -855,7 +855,7 @@ Ox.test = function(argument, callback) {
if (arguments.length == 2) {
if (Ox.typeOf(argument) == 'string' && Ox.contains(argument, '\n')) {
// source code
runTests(Ox.doc(argument))
runTests(Ox.doc(argument));
} else {
argument = Ox.makeArray(argument);
if (Ox.typeOf(argument[0]) == 'string') {
@ -963,7 +963,7 @@ Ox.tokenize = (function() {
) || (
token.type == 'operator'
&& ['++', '--', ')', ']', '}'].indexOf(token.value) == -1
)
);
}
return isRegExp;
}

View file

@ -14,7 +14,7 @@ Ox.extend = function(object) {
if (!Ox.isObject(args[0])) {
args = [Ox.makeObject(args)];
}
Ox.forEach(args, function(arg, i) {
Ox.forEach(args, function(arg) {
Ox.forEach(arg, function(value, key) {
object[key] = value;
});
@ -85,7 +85,7 @@ Ox.getset = function(object, args, callback, that) {
};
Ox.hasOwn = function(object, value) {
return Object.prototype.hasOwnProperty.call(object, value)
return Object.prototype.hasOwnProperty.call(object, value);
};
/*@

View file

@ -43,7 +43,7 @@
String(string).split('').forEach(function(char) {
binary += Ox.pad(char.charCodeAt(0).toString(2), 'left', 8, '0');
});
binary = Ox.pad(binary, Math.ceil(binary.length / 6) * 6, '0')
binary = Ox.pad(binary, Math.ceil(binary.length / 6) * 6, '0');
while (binary) {
ret += chars[parseInt(binary.slice(0, 6), 2)];
binary = binary.slice(6);
@ -206,7 +206,7 @@
return '"' + value.split('').map(function(char) {
return replace[char] || char;
}).join('') + '"';
};
}
return {
parse: function parse(string) {
return eval('(' + string + ')');
@ -427,4 +427,4 @@
}
}
})(this);
}(this));

View file

@ -9,5 +9,5 @@ Ox.escapeRegExp <f> Escapes a string for use in a regular expression
@*/
// see https://developer.mozilla.org/en/JavaScript/Guide/Regular_Expressions
Ox.escapeRegExp = function(string) {
return (string + '').replace(/([\/\\^$*+?.\-|(){}[\]])/g, '\\$1')
return (string + '').replace(/([\/\\^$*+?.\-|(){}[\]])/g, '\\$1');
};

View file

@ -398,7 +398,7 @@ Ox.parseUserAgent = function(userAgent) {
['BSD', 'Linux', 'Unix'].indexOf(name) > -1
? '(' + version + ')'
: version
)
);
}
userAgentData[key] = {
name: names[name] || name,
@ -597,7 +597,7 @@ Ox.words = function(string) {
return array.filter(function(v, i) {
return i % 2 == !startsWithWord;
});
}
};
/*@
Ox.wordwrap <f> Wrap a string at word boundaries

View file

@ -248,7 +248,7 @@ Ox.isNaN <f> Tests if a value is `NaN`
@*/
Ox.isNaN = function(value) {
return value !== value;
}
};
/*@
Ox.isNull <f> Tests if a value is `null`
@ -420,7 +420,7 @@ if (
if (value === null) {
type = 'null';
} else if (value === void 0) {
type = 'undefined'
type = 'undefined';
} else if (type == 'object' && typeof value.callee == 'function') {
type = 'arguments';
} else if (