diff --git a/source/Ox/js/Async.js b/source/Ox/js/Async.js index 064d1075..7607d841 100644 --- a/source/Ox/js/Async.js +++ b/source/Ox/js/Async.js @@ -15,7 +15,7 @@ }, that, function() { callback(type == 'string' ? results.join('') : results); }); - }; + } Ox.asyncMap = function(array, iterator, that, callback) { array = Ox.makeArray(array); diff --git a/source/Ox/js/Collection.js b/source/Ox/js/Collection.js index 0ef492b2..7a446d1f 100644 --- a/source/Ox/js/Collection.js +++ b/source/Ox/js/Collection.js @@ -311,7 +311,7 @@ Ox.max 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 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 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; }; diff --git a/source/Ox/js/Core.js b/source/Ox/js/Core.js index c24da952..7768e942 100644 --- a/source/Ox/js/Core.js +++ b/source/Ox/js/Core.js @@ -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')); diff --git a/source/Ox/js/Date.js b/source/Ox/js/Date.js index 1173c268..09778b37 100644 --- a/source/Ox/js/Date.js +++ b/source/Ox/js/Date.js @@ -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 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 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 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); - } + }; }); diff --git a/source/Ox/js/Encoding.js b/source/Ox/js/Encoding.js index 52955ae6..697f45e3 100644 --- a/source/Ox/js/Encoding.js +++ b/source/Ox/js/Encoding.js @@ -236,7 +236,7 @@ Ox.decodeDeflate = function(string, callback) { error(); } callback(string); - } + }; image.onerror = error; image.src = 'data:image/png;base64,' + btoa(data); }; diff --git a/source/Ox/js/HTML.js b/source/Ox/js/HTML.js index d70048be..2ad2c8cb 100644 --- a/source/Ox/js/HTML.js +++ b/source/Ox/js/HTML.js @@ -152,7 +152,7 @@ } }); return ret; - }; + } /*@ Ox.addLinks 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 '' + parts[1] + ''; @@ -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) { diff --git a/source/Ox/js/JavaScript.js b/source/Ox/js/JavaScript.js index 1a782c61..0cc1a3ac 100644 --- a/source/Ox/js/JavaScript.js +++ b/source/Ox/js/JavaScript.js @@ -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; } diff --git a/source/Ox/js/Object.js b/source/Ox/js/Object.js index 5daeb993..768ad1d0 100644 --- a/source/Ox/js/Object.js +++ b/source/Ox/js/Object.js @@ -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); }; /*@ diff --git a/source/Ox/js/Polyfill.js b/source/Ox/js/Polyfill.js index 3208625e..98cd94d3 100644 --- a/source/Ox/js/Polyfill.js +++ b/source/Ox/js/Polyfill.js @@ -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)); diff --git a/source/Ox/js/RegExp.js b/source/Ox/js/RegExp.js index 1314c27c..ac636e2f 100644 --- a/source/Ox/js/RegExp.js +++ b/source/Ox/js/RegExp.js @@ -9,5 +9,5 @@ Ox.escapeRegExp 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'); }; \ No newline at end of file diff --git a/source/Ox/js/String.js b/source/Ox/js/String.js index 8fa1f2f2..7dd1e004 100644 --- a/source/Ox/js/String.js +++ b/source/Ox/js/String.js @@ -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 Wrap a string at word boundaries diff --git a/source/Ox/js/Type.js b/source/Ox/js/Type.js index ce4c0f41..e1c4b64f 100644 --- a/source/Ox/js/Type.js +++ b/source/Ox/js/Type.js @@ -248,7 +248,7 @@ Ox.isNaN Tests if a value is `NaN` @*/ Ox.isNaN = function(value) { return value !== value; -} +}; /*@ Ox.isNull 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 (