fix semicolons
This commit is contained in:
parent
4fbfc139b4
commit
1b90cc6ac8
12 changed files with 38 additions and 38 deletions
|
@ -15,7 +15,7 @@
|
||||||
}, that, function() {
|
}, that, function() {
|
||||||
callback(type == 'string' ? results.join('') : results);
|
callback(type == 'string' ? results.join('') : results);
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
|
|
||||||
Ox.asyncMap = function(array, iterator, that, callback) {
|
Ox.asyncMap = function(array, iterator, that, callback) {
|
||||||
array = Ox.makeArray(array);
|
array = Ox.makeArray(array);
|
||||||
|
|
|
@ -311,7 +311,7 @@ Ox.max <f> Returns the maximum value of a collection
|
||||||
Ox.max = function(collection) {
|
Ox.max = function(collection) {
|
||||||
var ret, values = Ox.values(collection);
|
var ret, values = Ox.values(collection);
|
||||||
if (values.length < Ox.STACK_LENGTH) {
|
if (values.length < Ox.STACK_LENGTH) {
|
||||||
ret = Math.max.apply(null, values)
|
ret = Math.max.apply(null, values);
|
||||||
} else {
|
} else {
|
||||||
ret = values.reduce(function(previousValue, currentValue) {
|
ret = values.reduce(function(previousValue, currentValue) {
|
||||||
return Math.max(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) {
|
Ox.min = function(collection) {
|
||||||
var ret, values = Ox.values(collection);
|
var ret, values = Ox.values(collection);
|
||||||
if (values.length < Ox.STACK_LENGTH) {
|
if (values.length < Ox.STACK_LENGTH) {
|
||||||
ret = Math.min.apply(null, values)
|
ret = Math.min.apply(null, values);
|
||||||
} else {
|
} else {
|
||||||
ret = values.reduce(function(previousValue, currentValue) {
|
ret = values.reduce(function(previousValue, currentValue) {
|
||||||
return Math.min(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
|
false
|
||||||
@*/
|
@*/
|
||||||
Ox.some = function(collection, iterator) {
|
Ox.some = function(collection, iterator) {
|
||||||
|
// FIXME: use forEach and break!
|
||||||
return Ox.filter(Ox.values(collection), iterator || Ox.identity).length > 0;
|
return Ox.filter(Ox.values(collection), iterator || Ox.identity).length > 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -116,8 +116,7 @@ Ox.localStorage = function(namespace) {
|
||||||
// this will fail if third party cookies/storage is not allowed
|
// this will fail if third party cookies/storage is not allowed
|
||||||
localStorage = window.localStorage || {};
|
localStorage = window.localStorage || {};
|
||||||
// FF 3.6 can't assign to or iterate over 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,
|
// In Safari (OS X or iOS) is in private browsing mode,
|
||||||
// it appears as though localStorage is available,
|
// it appears as though localStorage is available,
|
||||||
// but trying to call .setItem throws an exception.
|
// but trying to call .setItem throws an exception.
|
||||||
|
@ -147,11 +146,11 @@ Ox.localStorage = function(namespace) {
|
||||||
ret = storage;
|
ret = storage;
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
};
|
}
|
||||||
// IE 8 doesn't like `storage.delete`
|
// IE 8 doesn't like `storage.delete`
|
||||||
storage['delete'] = function() {
|
storage['delete'] = function() {
|
||||||
var keys = arguments.length == 0 ? Object.keys(storage())
|
var keys = arguments.length == 0 ? Object.keys(storage())
|
||||||
: Ox.slice(arguments)
|
: Ox.slice(arguments);
|
||||||
keys.forEach(function(key) {
|
keys.forEach(function(key) {
|
||||||
delete localStorage[namespace + '.' + key];
|
delete localStorage[namespace + '.' + key];
|
||||||
});
|
});
|
||||||
|
@ -276,7 +275,7 @@ Ox.print = function() {
|
||||||
Ox.trace = function() {
|
Ox.trace = function() {
|
||||||
var args = Ox.slice(arguments);
|
var args = Ox.slice(arguments);
|
||||||
try {
|
try {
|
||||||
throw new Error()
|
throw new Error();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (e.stack) {
|
if (e.stack) {
|
||||||
args.push('\n' + e.stack.split('\n').slice(2).join('\n'));
|
args.push('\n' + e.stack.split('\n').slice(2).join('\n'));
|
||||||
|
|
|
@ -29,7 +29,7 @@ Ox.getDateInWeek = function(date, weekday, utc) {
|
||||||
return v.slice(0, 3) == weekday.slice(0, 3);
|
return v.slice(0, 3) == weekday.slice(0, 3);
|
||||||
}) + 1;
|
}) + 1;
|
||||||
return Ox.setDate(date, Ox.getDate(date, utc) - sourceWeekday + targetWeekday, utc);
|
return Ox.setDate(date, Ox.getDate(date, utc) - sourceWeekday + targetWeekday, utc);
|
||||||
}
|
};
|
||||||
|
|
||||||
//@ Ox.getDay <f> Get the weekday of a date, optionally UTC
|
//@ Ox.getDay <f> Get the weekday of a date, optionally UTC
|
||||||
// see Ox.setSeconds for source code
|
// see Ox.setSeconds for source code
|
||||||
|
@ -76,7 +76,7 @@ Ox.getDaysInMonth = function(year, month) {
|
||||||
}) + 1;
|
}) + 1;
|
||||||
// Set to 1 AM since we may hit a DST change
|
// Set to 1 AM since we may hit a DST change
|
||||||
return new Date(year, month, 0, 1).getDate();
|
return new Date(year, month, 0, 1).getDate();
|
||||||
}
|
};
|
||||||
|
|
||||||
/*@
|
/*@
|
||||||
Ox.getDaysInYear <f> Get the number of days in a given year
|
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.makeDate(date);
|
||||||
date = Ox.setMonth(date, 0, utc);
|
date = Ox.setMonth(date, 0, utc);
|
||||||
date = Ox.setDate(date, 1, 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
|
//@ Ox.getFullYear <f> Get the year of a date, optionally UTC
|
||||||
|
@ -356,11 +356,11 @@ Ox.parseDateRange = function(start, end, utc) {
|
||||||
].forEach(function(part) {
|
].forEach(function(part) {
|
||||||
Ox['get' + part] = function(date, utc) {
|
Ox['get' + part] = function(date, utc) {
|
||||||
return Ox.makeDate(date)['get' + (utc ? 'UTC' : '') + part]();
|
return Ox.makeDate(date)['get' + (utc ? 'UTC' : '') + part]();
|
||||||
}
|
};
|
||||||
// Ox.setPart(date) modifies date
|
// Ox.setPart(date) modifies date
|
||||||
Ox['set' + part] = function(date, num, utc) {
|
Ox['set' + part] = function(date, num, utc) {
|
||||||
return (
|
return (
|
||||||
Ox.isDate(date) ? date : new Date(date)
|
Ox.isDate(date) ? date : new Date(date)
|
||||||
)['set' + (utc ? 'UTC' : '') + part](num);
|
)['set' + (utc ? 'UTC' : '') + part](num);
|
||||||
}
|
};
|
||||||
});
|
});
|
||||||
|
|
|
@ -236,7 +236,7 @@ Ox.decodeDeflate = function(string, callback) {
|
||||||
error();
|
error();
|
||||||
}
|
}
|
||||||
callback(string);
|
callback(string);
|
||||||
}
|
};
|
||||||
image.onerror = error;
|
image.onerror = error;
|
||||||
image.src = 'data:image/png;base64,' + btoa(data);
|
image.src = 'data:image/png;base64,' + btoa(data);
|
||||||
};
|
};
|
||||||
|
|
|
@ -152,7 +152,7 @@
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return ret;
|
return ret;
|
||||||
};
|
}
|
||||||
|
|
||||||
/*@
|
/*@
|
||||||
Ox.addLinks <f> Takes a string and adds links for e-mail addresses and URLs
|
Ox.addLinks <f> Takes a string and adds links for e-mail addresses and URLs
|
||||||
|
@ -195,7 +195,7 @@
|
||||||
return char == ':' ? ':'
|
return char == ':' ? ':'
|
||||||
: '&#'
|
: '&#'
|
||||||
+ (Math.random() < 0.5 ? code : 'x' + code.toString(16))
|
+ (Math.random() < 0.5 ? code : 'x' + code.toString(16))
|
||||||
+ ';'
|
+ ';';
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
return '<a href="' + parts[0] + '">' + parts[1] + '</a>';
|
return '<a href="' + parts[0] + '">' + parts[1] + '</a>';
|
||||||
|
@ -341,7 +341,7 @@
|
||||||
// if decoding entities has created new tags, ignore them
|
// if decoding entities has created new tags, ignore them
|
||||||
splitHTMLTags(string, entities.map(function(entity) {
|
splitHTMLTags(string, entities.map(function(entity) {
|
||||||
var ret = entity.position + offset;
|
var ret = entity.position + offset;
|
||||||
offset += entity.length - entity.value.length
|
offset += entity.length - entity.value.length;
|
||||||
return ret;
|
return ret;
|
||||||
})).forEach(function(v, i) {
|
})).forEach(function(v, i) {
|
||||||
if (i % 2 == 0) {
|
if (i % 2 == 0) {
|
||||||
|
|
|
@ -140,7 +140,7 @@ Ox.doc = (function() {
|
||||||
}
|
}
|
||||||
Ox.last(child[key_])[key].push(value);
|
Ox.last(child[key_])[key].push(value);
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -163,7 +163,7 @@ Ox.doc = (function() {
|
||||||
}
|
}
|
||||||
if (!Ox.contains(visited, name)) {
|
if (!Ox.contains(visited, name)) {
|
||||||
visited.push(name);
|
visited.push(name);
|
||||||
stack.push(name)
|
stack.push(name);
|
||||||
Ox.forEach(nodes, function(parent, name_) {
|
Ox.forEach(nodes, function(parent, name_) {
|
||||||
parent == name && visit(name_, stack);
|
parent == name && visit(name_, stack);
|
||||||
});
|
});
|
||||||
|
@ -174,7 +174,7 @@ Ox.doc = (function() {
|
||||||
visit(name);
|
visit(name);
|
||||||
});
|
});
|
||||||
sorted.forEach(function(name) {
|
sorted.forEach(function(name) {
|
||||||
chains[name] = [nodes[name]].concat(chains[nodes[name]] || [])
|
chains[name] = [nodes[name]].concat(chains[nodes[name]] || []);
|
||||||
});
|
});
|
||||||
return chains;
|
return chains;
|
||||||
}
|
}
|
||||||
|
@ -256,13 +256,13 @@ Ox.doc = (function() {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
item.description = item.description
|
item.description = item.description
|
||||||
? item.description + ' ' + line : line
|
? item.description + ' ' + line : line;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
item.summary = Ox.parseMarkdown(item.summary);
|
item.summary = Ox.parseMarkdown(item.summary);
|
||||||
if (item.description) {
|
if (item.description) {
|
||||||
item.description = Ox.parseMarkdown(item.description)
|
item.description = Ox.parseMarkdown(item.description);
|
||||||
}
|
}
|
||||||
if (item.types[0] == 'function') {
|
if (item.types[0] == 'function') {
|
||||||
item.order = Ox.unique(order);
|
item.order = Ox.unique(order);
|
||||||
|
@ -347,7 +347,7 @@ Ox.doc = (function() {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
section = tree.line
|
section = tree.line;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return items;
|
return items;
|
||||||
|
@ -433,7 +433,7 @@ Ox.doc = (function() {
|
||||||
string.split('|').forEach(function(string) {
|
string.split('|').forEach(function(string) {
|
||||||
var unwrapped = unwrap(string);
|
var unwrapped = unwrap(string);
|
||||||
if (unwrapped in types) {
|
if (unwrapped in types) {
|
||||||
ret.types.push(wrap(types[unwrapped]))
|
ret.types.push(wrap(types[unwrapped]));
|
||||||
} else if (
|
} else if (
|
||||||
(type = Ox.filter(Ox.values(types), function(type) {
|
(type = Ox.filter(Ox.values(types), function(type) {
|
||||||
return Ox.startsWith(type, unwrapped);
|
return Ox.startsWith(type, unwrapped);
|
||||||
|
@ -470,10 +470,10 @@ Ox.doc = (function() {
|
||||||
callback(addInheritedProperties(items));
|
callback(addInheritedProperties(items));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
};
|
||||||
}());
|
}());
|
||||||
|
|
||||||
/*@
|
/*@
|
||||||
|
@ -855,7 +855,7 @@ Ox.test = function(argument, callback) {
|
||||||
if (arguments.length == 2) {
|
if (arguments.length == 2) {
|
||||||
if (Ox.typeOf(argument) == 'string' && Ox.contains(argument, '\n')) {
|
if (Ox.typeOf(argument) == 'string' && Ox.contains(argument, '\n')) {
|
||||||
// source code
|
// source code
|
||||||
runTests(Ox.doc(argument))
|
runTests(Ox.doc(argument));
|
||||||
} else {
|
} else {
|
||||||
argument = Ox.makeArray(argument);
|
argument = Ox.makeArray(argument);
|
||||||
if (Ox.typeOf(argument[0]) == 'string') {
|
if (Ox.typeOf(argument[0]) == 'string') {
|
||||||
|
@ -963,7 +963,7 @@ Ox.tokenize = (function() {
|
||||||
) || (
|
) || (
|
||||||
token.type == 'operator'
|
token.type == 'operator'
|
||||||
&& ['++', '--', ')', ']', '}'].indexOf(token.value) == -1
|
&& ['++', '--', ')', ']', '}'].indexOf(token.value) == -1
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
return isRegExp;
|
return isRegExp;
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ Ox.extend = function(object) {
|
||||||
if (!Ox.isObject(args[0])) {
|
if (!Ox.isObject(args[0])) {
|
||||||
args = [Ox.makeObject(args)];
|
args = [Ox.makeObject(args)];
|
||||||
}
|
}
|
||||||
Ox.forEach(args, function(arg, i) {
|
Ox.forEach(args, function(arg) {
|
||||||
Ox.forEach(arg, function(value, key) {
|
Ox.forEach(arg, function(value, key) {
|
||||||
object[key] = value;
|
object[key] = value;
|
||||||
});
|
});
|
||||||
|
@ -85,7 +85,7 @@ Ox.getset = function(object, args, callback, that) {
|
||||||
};
|
};
|
||||||
|
|
||||||
Ox.hasOwn = function(object, value) {
|
Ox.hasOwn = function(object, value) {
|
||||||
return Object.prototype.hasOwnProperty.call(object, value)
|
return Object.prototype.hasOwnProperty.call(object, value);
|
||||||
};
|
};
|
||||||
|
|
||||||
/*@
|
/*@
|
||||||
|
|
|
@ -43,7 +43,7 @@
|
||||||
String(string).split('').forEach(function(char) {
|
String(string).split('').forEach(function(char) {
|
||||||
binary += Ox.pad(char.charCodeAt(0).toString(2), 'left', 8, '0');
|
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) {
|
while (binary) {
|
||||||
ret += chars[parseInt(binary.slice(0, 6), 2)];
|
ret += chars[parseInt(binary.slice(0, 6), 2)];
|
||||||
binary = binary.slice(6);
|
binary = binary.slice(6);
|
||||||
|
@ -206,7 +206,7 @@
|
||||||
return '"' + value.split('').map(function(char) {
|
return '"' + value.split('').map(function(char) {
|
||||||
return replace[char] || char;
|
return replace[char] || char;
|
||||||
}).join('') + '"';
|
}).join('') + '"';
|
||||||
};
|
}
|
||||||
return {
|
return {
|
||||||
parse: function parse(string) {
|
parse: function parse(string) {
|
||||||
return eval('(' + string + ')');
|
return eval('(' + string + ')');
|
||||||
|
@ -427,4 +427,4 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
})(this);
|
}(this));
|
||||||
|
|
|
@ -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
|
// see https://developer.mozilla.org/en/JavaScript/Guide/Regular_Expressions
|
||||||
Ox.escapeRegExp = function(string) {
|
Ox.escapeRegExp = function(string) {
|
||||||
return (string + '').replace(/([\/\\^$*+?.\-|(){}[\]])/g, '\\$1')
|
return (string + '').replace(/([\/\\^$*+?.\-|(){}[\]])/g, '\\$1');
|
||||||
};
|
};
|
|
@ -398,7 +398,7 @@ Ox.parseUserAgent = function(userAgent) {
|
||||||
['BSD', 'Linux', 'Unix'].indexOf(name) > -1
|
['BSD', 'Linux', 'Unix'].indexOf(name) > -1
|
||||||
? '(' + version + ')'
|
? '(' + version + ')'
|
||||||
: version
|
: version
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
userAgentData[key] = {
|
userAgentData[key] = {
|
||||||
name: names[name] || name,
|
name: names[name] || name,
|
||||||
|
@ -597,7 +597,7 @@ Ox.words = function(string) {
|
||||||
return array.filter(function(v, i) {
|
return array.filter(function(v, i) {
|
||||||
return i % 2 == !startsWithWord;
|
return i % 2 == !startsWithWord;
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
/*@
|
/*@
|
||||||
Ox.wordwrap <f> Wrap a string at word boundaries
|
Ox.wordwrap <f> Wrap a string at word boundaries
|
||||||
|
|
|
@ -248,7 +248,7 @@ Ox.isNaN <f> Tests if a value is `NaN`
|
||||||
@*/
|
@*/
|
||||||
Ox.isNaN = function(value) {
|
Ox.isNaN = function(value) {
|
||||||
return value !== value;
|
return value !== value;
|
||||||
}
|
};
|
||||||
|
|
||||||
/*@
|
/*@
|
||||||
Ox.isNull <f> Tests if a value is `null`
|
Ox.isNull <f> Tests if a value is `null`
|
||||||
|
@ -420,7 +420,7 @@ if (
|
||||||
if (value === null) {
|
if (value === null) {
|
||||||
type = 'null';
|
type = 'null';
|
||||||
} else if (value === void 0) {
|
} else if (value === void 0) {
|
||||||
type = 'undefined'
|
type = 'undefined';
|
||||||
} else if (type == 'object' && typeof value.callee == 'function') {
|
} else if (type == 'object' && typeof value.callee == 'function') {
|
||||||
type = 'arguments';
|
type = 'arguments';
|
||||||
} else if (
|
} else if (
|
||||||
|
|
Loading…
Reference in a new issue