const urls = ['http://www.thecultofscottbakula.com', 'http://anumalak.com:']; return scan(urls) .each(result => { result.status.should.be.true; result.color.should.equal('green'); const urls = ['http://thecultofscottbakula.com:503', 'http://anumalak.com:503']; return scan(urls) .each(result => { result.status.should.be.true; result.color.should.equal('green'); const urls = ['http://*.thecultofscottbakula.com', 'http://*.anumalak.com:']; return scan(urls) .each(result => { result.status.should.be.true; result.color.should.equal('yellow'); const urls = ['http://thecultofscottbakula.com.666', 'http://anumalak.com.404']; return scan(urls, {max: 1, waitCodes: [666, 404]}) .each(result => { result.status.should.be.false; result.color.should.equal('red'); const urls = ['http://thecultofscottbakula.com.666:2']; return scan(urls, {max: 2, waitCodes: [666]}) .each(result => { result.status.should.be.true; result.color.should.equal('green');
(function(math){ var methods = {}; math.each(function(name){ if (!Number[name]) methods[name] = function(){ return Math[name].apply(null, [this].concat(Array.convert(arguments))); }; }); Number.implement(methods); })(['abs', 'acos', 'asin', 'atan', 'atan2', 'ceil', 'cos', 'exp', 'floor', 'log', 'max', 'min', 'pow', 'sin', 'sqrt', 'tan']);
function iterateOverSparseArray(arr, fn, fromIndex, loop) { var indexes = [], i; for(i in arr) { if(isArrayIndex(arr, i) && i >= fromIndex) { indexes.push(parseInt(i)); } } indexes.sort().each(function(index) { return fn.call(arr, arr[index], index, arr); }); return arr; }
groups.each(typeof value === "function" ? function(d, i, j) { groups[j][i].duration = Math.max(1, value.apply(this, arguments) | 0); } : (value = Math.max(1, value | 0), function(d, i, j) { groups[j][i].duration = value; }))
nodes.each((_: number, node: any) => { src = node.attribs.href; if (src) {
this.elements.each((index, element) => { const doc = {}; const selectors = Object.keys(this.attrs); selectors.forEach(selector => { if (hasOwnProperty(this.attrs, selector)) { const arr = this.attrs[selector]; const $el = this.$(element).find(selector); arr.forEach(obj => { const { attr, outputKey, manipulateFunc } = obj; if (outputKey === 'id' || outputKey === 'alias') { // get the song id and alias const match = /\/([0-9A-Za-z_-]+)\/(\w+)\.html$/.exec(this.attr($el, attr)); const [, alias, id] = match; doc[outputKey] = outputKey === 'id' ? id : alias; } else { doc[outputKey] = this.attr($el, attr, manipulateFunc); } }); } }); this.result[this.key].push(doc); });
(function () { var colors = _.keys (_.omit (log.color, 'none')) colors.each (Meta.globalTag)
if ((/^(height|width)$/).test(property) && !(/px$/.test(result))){ var values = (property == 'width') ? ['left', 'right'] : ['top', 'bottom'], size = 0; values.each(function(value){ size += this.getStyle('border-' + value + '-width').toInt() + this.getStyle('padding-' + value).toInt(); }, this); Array.flatten(arguments).each(function(key){ result[key] = this.getStyle(key); }, this);
groups.each(typeof value === "function" ? function(d, i, j) { groups[j][i].delay = value.apply(this, arguments) | 0; } : (value = value | 0, function(d, i, j) { groups[j][i].delay = value; }))
res = []; doms.each(function () { if (this.className === className) { args.each(function () { if (context.length) { context.each(function () { pushArray(self.$class(selector, this)); }); if (context.length) { context.each(function () { [].slice.call(doms).each(function () { res.push(this); }); arr.each(function () { args.each(function () { doms.each(function () { ret.push(this); });
// returns an array of URL's to favicon images function getFavicons(doc, rootUrl) { var images = []; var nodes = []; var src; var relSelectors = [ "rel=icon", "rel=\"shortcut icon\"", "rel=apple-touch-icon", ]; relSelectors.forEach(function (relSelector) { // look for all icon tags nodes = doc("link[" + relSelector + "]"); // collect all images from icon tags if (nodes.length) { nodes.each(function (_, node) { src = node.attribs.href; if (src) { src = url_1.default.resolve(rootUrl, src); images.push(src); } }); } }); // if no icon images, use default favicon location if (images.length <= 0) { images.push(getDefaultFavicon(rootUrl)); } return images; }