id int32 0 58k | repo stringlengths 5 67 | path stringlengths 4 116 | func_name stringlengths 0 58 | original_string stringlengths 52 373k | language stringclasses 1
value | code stringlengths 52 373k | code_tokens list | docstring stringlengths 4 11.8k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 86 226 |
|---|---|---|---|---|---|---|---|---|---|---|---|
57,100 | dominictarr/math-buffer | mod.js | mod | function mod(A, B) {
var C = 1, D = 0
var _B = B
if (B > A) return A
//shift B right until it it's just smaller than A.
while(B < A) {
B<<=1; C<<=1
}
//now, shift B back, while subtracting.
do {
B>>=1; C>>=1
//mark the bits where you could subtract.
//this becomes the quotent!
if(B ... | javascript | function mod(A, B) {
var C = 1, D = 0
var _B = B
if (B > A) return A
//shift B right until it it's just smaller than A.
while(B < A) {
B<<=1; C<<=1
}
//now, shift B back, while subtracting.
do {
B>>=1; C>>=1
//mark the bits where you could subtract.
//this becomes the quotent!
if(B ... | [
"function",
"mod",
"(",
"A",
",",
"B",
")",
"{",
"var",
"C",
"=",
"1",
",",
"D",
"=",
"0",
"var",
"_B",
"=",
"B",
"if",
"(",
"B",
">",
"A",
")",
"return",
"A",
"//shift B right until it it's just smaller than A.",
"while",
"(",
"B",
"<",
"A",
")",
... | calculate A % B | [
"calculate",
"A",
"%",
"B"
] | 0c646cddd2f23aa76a9e7182bad3cacfe21aa3d6 | https://github.com/dominictarr/math-buffer/blob/0c646cddd2f23aa76a9e7182bad3cacfe21aa3d6/mod.js#L4-L26 |
57,101 | vkiding/jud-styler | index.js | validate | function validate(json, done) {
var log = []
var err
try {
json = JSON.parse(JSON.stringify(json))
}
catch (e) {
err = e
json = {}
}
Object.keys(json).forEach(function (selector) {
var declarations = json[selector]
Object.keys(declarations).forEach(function (name) {
var value ... | javascript | function validate(json, done) {
var log = []
var err
try {
json = JSON.parse(JSON.stringify(json))
}
catch (e) {
err = e
json = {}
}
Object.keys(json).forEach(function (selector) {
var declarations = json[selector]
Object.keys(declarations).forEach(function (name) {
var value ... | [
"function",
"validate",
"(",
"json",
",",
"done",
")",
"{",
"var",
"log",
"=",
"[",
"]",
"var",
"err",
"try",
"{",
"json",
"=",
"JSON",
".",
"parse",
"(",
"JSON",
".",
"stringify",
"(",
"json",
")",
")",
"}",
"catch",
"(",
"e",
")",
"{",
"err",... | Validate a JSON Object and log errors & warnings
@param {object} json
@param {function} done which will be called with
- err:Error
- data.jsonStyle{}: `classname.propname.value`-like object
- data.log[{reason}] | [
"Validate",
"a",
"JSON",
"Object",
"and",
"log",
"errors",
"&",
"warnings"
] | 1563f84b9acd649bd546a8859e9a9226689ef1dc | https://github.com/vkiding/jud-styler/blob/1563f84b9acd649bd546a8859e9a9226689ef1dc/index.js#L166-L202 |
57,102 | jivesoftware/jive-persistence-sqlite | sqlite-schema-syncer.js | qParallel | function qParallel(funcs, count) {
var length = funcs.length;
if (!length) {
return q([]);
}
if (count == null) {
count = Infinity;
}
count = Math.max(count, 1);
count = Math.min(count, funcs.length);
var promises = [];
var values = [];
for (var i = 0; i < coun... | javascript | function qParallel(funcs, count) {
var length = funcs.length;
if (!length) {
return q([]);
}
if (count == null) {
count = Infinity;
}
count = Math.max(count, 1);
count = Math.min(count, funcs.length);
var promises = [];
var values = [];
for (var i = 0; i < coun... | [
"function",
"qParallel",
"(",
"funcs",
",",
"count",
")",
"{",
"var",
"length",
"=",
"funcs",
".",
"length",
";",
"if",
"(",
"!",
"length",
")",
"{",
"return",
"q",
"(",
"[",
"]",
")",
";",
"}",
"if",
"(",
"count",
"==",
"null",
")",
"{",
"coun... | Runs at most 'count' number of promise producing functions in parallel.
@param funcs
@param count
@returns {*} | [
"Runs",
"at",
"most",
"count",
"number",
"of",
"promise",
"producing",
"functions",
"in",
"parallel",
"."
] | e61374ba629159d69e0239e1fe7f609c8654dc32 | https://github.com/jivesoftware/jive-persistence-sqlite/blob/e61374ba629159d69e0239e1fe7f609c8654dc32/sqlite-schema-syncer.js#L456-L496 |
57,103 | jacobp100/color-forge | index.js | Color | function Color(values, spaceAlpha, space) {
this.values = values;
this.alpha = 1;
this.space = 'rgb';
this.originalColor = null;
if (space !== undefined) {
this.alpha = spaceAlpha;
this.space = space;
} else if (spaceAlpha !== undefined) {
if (typeof spaceAlpha === 'number') {
this.alpha = spaceAlpha;
... | javascript | function Color(values, spaceAlpha, space) {
this.values = values;
this.alpha = 1;
this.space = 'rgb';
this.originalColor = null;
if (space !== undefined) {
this.alpha = spaceAlpha;
this.space = space;
} else if (spaceAlpha !== undefined) {
if (typeof spaceAlpha === 'number') {
this.alpha = spaceAlpha;
... | [
"function",
"Color",
"(",
"values",
",",
"spaceAlpha",
",",
"space",
")",
"{",
"this",
".",
"values",
"=",
"values",
";",
"this",
".",
"alpha",
"=",
"1",
";",
"this",
".",
"space",
"=",
"'rgb'",
";",
"this",
".",
"originalColor",
"=",
"null",
";",
... | Shorthand for creation of a new color object.
@name ColorShorthand
@function
@param {Array} values - Values in the corresponding color space
@param {number} [alpha = 1] - Alpha of the color
Color instance
@constructor
@param {Array} values - Values in the corresponding color space
@param {number} [alpha=1] - Alph... | [
"Shorthand",
"for",
"creation",
"of",
"a",
"new",
"color",
"object",
"."
] | b9b561eda2ac932aae6e9bd512e84e72075da2a5 | https://github.com/jacobp100/color-forge/blob/b9b561eda2ac932aae6e9bd512e84e72075da2a5/index.js#L34-L50 |
57,104 | mrjoelkemp/ya | settings/scss-settings.js | isCompassInstalled | function isCompassInstalled() {
var deferred = q.defer(),
cmd = 'compass';
exec(cmd, function (err) {
deferred.resolve(! err);
});
return deferred.promise;
} | javascript | function isCompassInstalled() {
var deferred = q.defer(),
cmd = 'compass';
exec(cmd, function (err) {
deferred.resolve(! err);
});
return deferred.promise;
} | [
"function",
"isCompassInstalled",
"(",
")",
"{",
"var",
"deferred",
"=",
"q",
".",
"defer",
"(",
")",
",",
"cmd",
"=",
"'compass'",
";",
"exec",
"(",
"cmd",
",",
"function",
"(",
"err",
")",
"{",
"deferred",
".",
"resolve",
"(",
"!",
"err",
")",
";... | Resolves with whether or not the Compass gem is installed | [
"Resolves",
"with",
"whether",
"or",
"not",
"the",
"Compass",
"gem",
"is",
"installed"
] | 6cb44f31902daaed32b2d72168b15eebfb7fbfbb | https://github.com/mrjoelkemp/ya/blob/6cb44f31902daaed32b2d72168b15eebfb7fbfbb/settings/scss-settings.js#L37-L46 |
57,105 | swashcap/scino | index.js | scino | function scino (num, precision, options) {
if (typeof precision === 'object') {
options = precision
precision = undefined
}
if (typeof num !== 'number') {
return num
}
var parsed = parse(num, precision)
var opts = getValidOptions(options)
var coefficient = parsed.coefficient
var exponent =... | javascript | function scino (num, precision, options) {
if (typeof precision === 'object') {
options = precision
precision = undefined
}
if (typeof num !== 'number') {
return num
}
var parsed = parse(num, precision)
var opts = getValidOptions(options)
var coefficient = parsed.coefficient
var exponent =... | [
"function",
"scino",
"(",
"num",
",",
"precision",
",",
"options",
")",
"{",
"if",
"(",
"typeof",
"precision",
"===",
"'object'",
")",
"{",
"options",
"=",
"precision",
"precision",
"=",
"undefined",
"}",
"if",
"(",
"typeof",
"num",
"!==",
"'number'",
")... | Format a number using scientific notation.
@param {number} num
@param {number} [precision]
@param {Object} [options] Formatting options
@returns {string} Formatted number | [
"Format",
"a",
"number",
"using",
"scientific",
"notation",
"."
] | 654a0025b9018e52186b9462ce967983fca8cf05 | https://github.com/swashcap/scino/blob/654a0025b9018e52186b9462ce967983fca8cf05/index.js#L16-L44 |
57,106 | swashcap/scino | index.js | parse | function parse (num, precision) {
var exponent = Math.floor(Math.log10(Math.abs(num)))
var coefficient = new Decimal(num)
.mul(new Decimal(Math.pow(10, -1 * exponent)))
return {
coefficient: typeof precision === 'number'
? coefficient.toSD(precision).toNumber()
: coefficient.toNumber(),
e... | javascript | function parse (num, precision) {
var exponent = Math.floor(Math.log10(Math.abs(num)))
var coefficient = new Decimal(num)
.mul(new Decimal(Math.pow(10, -1 * exponent)))
return {
coefficient: typeof precision === 'number'
? coefficient.toSD(precision).toNumber()
: coefficient.toNumber(),
e... | [
"function",
"parse",
"(",
"num",
",",
"precision",
")",
"{",
"var",
"exponent",
"=",
"Math",
".",
"floor",
"(",
"Math",
".",
"log10",
"(",
"Math",
".",
"abs",
"(",
"num",
")",
")",
")",
"var",
"coefficient",
"=",
"new",
"Decimal",
"(",
"num",
")",
... | Parse a number into its base and exponent.
{@link http://mikemcl.github.io/decimal.js/#toSD}
@param {number} num
@param {number} [precision]
@returns {Object}
@property {number} coefficient
@property {number} exponent | [
"Parse",
"a",
"number",
"into",
"its",
"base",
"and",
"exponent",
"."
] | 654a0025b9018e52186b9462ce967983fca8cf05 | https://github.com/swashcap/scino/blob/654a0025b9018e52186b9462ce967983fca8cf05/index.js#L57-L68 |
57,107 | bredele/grout | index.js | render | function render(content, store) {
var type = typeof content;
var node = content;
if(type === 'function') node = render(content(), store);
else if(type === 'string') {
node = document.createTextNode('');
bind(content, function(data) {
node.nodeValue = data;
}, store);
}
else if(content ins... | javascript | function render(content, store) {
var type = typeof content;
var node = content;
if(type === 'function') node = render(content(), store);
else if(type === 'string') {
node = document.createTextNode('');
bind(content, function(data) {
node.nodeValue = data;
}, store);
}
else if(content ins... | [
"function",
"render",
"(",
"content",
",",
"store",
")",
"{",
"var",
"type",
"=",
"typeof",
"content",
";",
"var",
"node",
"=",
"content",
";",
"if",
"(",
"type",
"===",
"'function'",
")",
"node",
"=",
"render",
"(",
"content",
"(",
")",
",",
"store"... | Render virtual dom content.
@param {String|Array|Element} content
@param {DataStore?} store
@return {Element}
@api private | [
"Render",
"virtual",
"dom",
"content",
"."
] | 0cc8658cac07a27bab3287475b83deb0564b4b2e | https://github.com/bredele/grout/blob/0cc8658cac07a27bab3287475b83deb0564b4b2e/index.js#L54-L66 |
57,108 | bredele/grout | index.js | bind | function bind(text, fn, store) {
var data = store.data;
var tmpl = mouth(text, store.data);
var cb = tmpl[0];
var keys = tmpl[1];
fn(cb(store.data));
for(var l = keys.length; l--;) {
store.on('change ' + keys[l], function() {
fn(cb(store.data));
});
}
} | javascript | function bind(text, fn, store) {
var data = store.data;
var tmpl = mouth(text, store.data);
var cb = tmpl[0];
var keys = tmpl[1];
fn(cb(store.data));
for(var l = keys.length; l--;) {
store.on('change ' + keys[l], function() {
fn(cb(store.data));
});
}
} | [
"function",
"bind",
"(",
"text",
",",
"fn",
",",
"store",
")",
"{",
"var",
"data",
"=",
"store",
".",
"data",
";",
"var",
"tmpl",
"=",
"mouth",
"(",
"text",
",",
"store",
".",
"data",
")",
";",
"var",
"cb",
"=",
"tmpl",
"[",
"0",
"]",
";",
"v... | Bind virtual dom with data store.
@param {String} text
@param {Function} fn
@param {DataStore} store
@api private | [
"Bind",
"virtual",
"dom",
"with",
"data",
"store",
"."
] | 0cc8658cac07a27bab3287475b83deb0564b4b2e | https://github.com/bredele/grout/blob/0cc8658cac07a27bab3287475b83deb0564b4b2e/index.js#L78-L89 |
57,109 | bredele/grout | index.js | fragment | function fragment(arr, store) {
var el = document.createDocumentFragment();
for(var i = 0, l = arr.length; i < l; i++) {
el.appendChild(render(arr[i], store));
}
return el;
} | javascript | function fragment(arr, store) {
var el = document.createDocumentFragment();
for(var i = 0, l = arr.length; i < l; i++) {
el.appendChild(render(arr[i], store));
}
return el;
} | [
"function",
"fragment",
"(",
"arr",
",",
"store",
")",
"{",
"var",
"el",
"=",
"document",
".",
"createDocumentFragment",
"(",
")",
";",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"l",
"=",
"arr",
".",
"length",
";",
"i",
"<",
"l",
";",
"i",
"++",
"... | Render fragment of virtual dom.
@param {Array} arr
@param {DataStore} store
@return {DocumentFragment}
@api private | [
"Render",
"fragment",
"of",
"virtual",
"dom",
"."
] | 0cc8658cac07a27bab3287475b83deb0564b4b2e | https://github.com/bredele/grout/blob/0cc8658cac07a27bab3287475b83deb0564b4b2e/index.js#L101-L107 |
57,110 | bredele/grout | index.js | attributes | function attributes(el, attrs, store) {
for(var key in attrs) {
var value = attrs[key];
if(typeof value === 'object') value = styles(value);
else if(typeof value === 'function') {
var bool = key.substring(0, 2) === 'on';
if(bool) el.addEventListener(key.slice(2), value);
else el.setAttri... | javascript | function attributes(el, attrs, store) {
for(var key in attrs) {
var value = attrs[key];
if(typeof value === 'object') value = styles(value);
else if(typeof value === 'function') {
var bool = key.substring(0, 2) === 'on';
if(bool) el.addEventListener(key.slice(2), value);
else el.setAttri... | [
"function",
"attributes",
"(",
"el",
",",
"attrs",
",",
"store",
")",
"{",
"for",
"(",
"var",
"key",
"in",
"attrs",
")",
"{",
"var",
"value",
"=",
"attrs",
"[",
"key",
"]",
";",
"if",
"(",
"typeof",
"value",
"===",
"'object'",
")",
"value",
"=",
... | Render virtual dom attributes.
@param {Element} el
@param {Object} attrs
@param {DataStore} store
@api private | [
"Render",
"virtual",
"dom",
"attributes",
"."
] | 0cc8658cac07a27bab3287475b83deb0564b4b2e | https://github.com/bredele/grout/blob/0cc8658cac07a27bab3287475b83deb0564b4b2e/index.js#L119-L136 |
57,111 | bredele/grout | index.js | styles | function styles(obj) {
var str = '';
for(var key in obj) {
str += key + ':' + obj[key] + ';';
}
return str;
} | javascript | function styles(obj) {
var str = '';
for(var key in obj) {
str += key + ':' + obj[key] + ';';
}
return str;
} | [
"function",
"styles",
"(",
"obj",
")",
"{",
"var",
"str",
"=",
"''",
";",
"for",
"(",
"var",
"key",
"in",
"obj",
")",
"{",
"str",
"+=",
"key",
"+",
"':'",
"+",
"obj",
"[",
"key",
"]",
"+",
"';'",
";",
"}",
"return",
"str",
";",
"}"
] | Render virtual dom styles.
@param {Object} obj
@return {String}
@api private | [
"Render",
"virtual",
"dom",
"styles",
"."
] | 0cc8658cac07a27bab3287475b83deb0564b4b2e | https://github.com/bredele/grout/blob/0cc8658cac07a27bab3287475b83deb0564b4b2e/index.js#L148-L154 |
57,112 | frozzare/gulp-phpcpd | index.js | buildCommand | function buildCommand(options, dir) {
var cmd = options.bin;
if (options.reportFile) {
cmd += ' --log-pmd ' + options.reportFile;
}
cmd += ' --min-lines ' + options.minLines;
cmd += ' --min-tokens ' + options.minTokens;
if (options.exclude instanceof Array) {
for (var i = 0, l = options.exclude; ... | javascript | function buildCommand(options, dir) {
var cmd = options.bin;
if (options.reportFile) {
cmd += ' --log-pmd ' + options.reportFile;
}
cmd += ' --min-lines ' + options.minLines;
cmd += ' --min-tokens ' + options.minTokens;
if (options.exclude instanceof Array) {
for (var i = 0, l = options.exclude; ... | [
"function",
"buildCommand",
"(",
"options",
",",
"dir",
")",
"{",
"var",
"cmd",
"=",
"options",
".",
"bin",
";",
"if",
"(",
"options",
".",
"reportFile",
")",
"{",
"cmd",
"+=",
"' --log-pmd '",
"+",
"options",
".",
"reportFile",
";",
"}",
"cmd",
"+=",
... | Build command.
@param {object} options
@param {string} dir
@return string | [
"Build",
"command",
"."
] | 6c67e259943c7e4dc3e13ac48e240c51dd288c2f | https://github.com/frozzare/gulp-phpcpd/blob/6c67e259943c7e4dc3e13ac48e240c51dd288c2f/index.js#L37-L70 |
57,113 | mongodb-js/mj | commands/check.js | function(args, done) {
debug('checking required files with args', args);
var dir = path.resolve(args['<directory>']);
var tasks = [
'README*',
'LICENSE',
'.travis.yml',
'.gitignore'
].map(function requireFileExists(pattern) {
return function(cb) {
glob(pattern, {
cwd: dir
... | javascript | function(args, done) {
debug('checking required files with args', args);
var dir = path.resolve(args['<directory>']);
var tasks = [
'README*',
'LICENSE',
'.travis.yml',
'.gitignore'
].map(function requireFileExists(pattern) {
return function(cb) {
glob(pattern, {
cwd: dir
... | [
"function",
"(",
"args",
",",
"done",
")",
"{",
"debug",
"(",
"'checking required files with args'",
",",
"args",
")",
";",
"var",
"dir",
"=",
"path",
".",
"resolve",
"(",
"args",
"[",
"'<directory>'",
"]",
")",
";",
"var",
"tasks",
"=",
"[",
"'README*'"... | Checks for required files | [
"Checks",
"for",
"required",
"files"
] | a643970372c74baf8cfc7087cda80d3f6001fe7b | https://github.com/mongodb-js/mj/blob/a643970372c74baf8cfc7087cda80d3f6001fe7b/commands/check.js#L12-L47 | |
57,114 | mongodb-js/mj | commands/check.js | function(args, done) {
var dir = path.resolve(args['<directory>']);
var pkg = require(path.join(dir, 'package.json'));
var schema = Joi.object().keys({
name: Joi.string().min(1).max(30).regex(/^[a-zA-Z0-9][a-zA-Z0-9\.\-_]*$/).required(),
version: Joi.string().regex(/^[0-9]+\.[0-9]+[0-9+a-zA-Z\.\-]+$/).req... | javascript | function(args, done) {
var dir = path.resolve(args['<directory>']);
var pkg = require(path.join(dir, 'package.json'));
var schema = Joi.object().keys({
name: Joi.string().min(1).max(30).regex(/^[a-zA-Z0-9][a-zA-Z0-9\.\-_]*$/).required(),
version: Joi.string().regex(/^[0-9]+\.[0-9]+[0-9+a-zA-Z\.\-]+$/).req... | [
"function",
"(",
"args",
",",
"done",
")",
"{",
"var",
"dir",
"=",
"path",
".",
"resolve",
"(",
"args",
"[",
"'<directory>'",
"]",
")",
";",
"var",
"pkg",
"=",
"require",
"(",
"path",
".",
"join",
"(",
"dir",
",",
"'package.json'",
")",
")",
";",
... | Check package.json conforms | [
"Check",
"package",
".",
"json",
"conforms"
] | a643970372c74baf8cfc7087cda80d3f6001fe7b | https://github.com/mongodb-js/mj/blob/a643970372c74baf8cfc7087cda80d3f6001fe7b/commands/check.js#L50-L79 | |
57,115 | mongodb-js/mj | commands/check.js | function(args, done) {
function run(cmd) {
return function(cb) {
debug('testing `%s`', cmd);
var parts = cmd.split(' ');
var bin = parts.shift();
var args = parts;
var completed = false;
var child = spawn(bin, args, {
cwd: args['<directory>']
})
.on('erro... | javascript | function(args, done) {
function run(cmd) {
return function(cb) {
debug('testing `%s`', cmd);
var parts = cmd.split(' ');
var bin = parts.shift();
var args = parts;
var completed = false;
var child = spawn(bin, args, {
cwd: args['<directory>']
})
.on('erro... | [
"function",
"(",
"args",
",",
"done",
")",
"{",
"function",
"run",
"(",
"cmd",
")",
"{",
"return",
"function",
"(",
"cb",
")",
"{",
"debug",
"(",
"'testing `%s`'",
",",
"cmd",
")",
";",
"var",
"parts",
"=",
"cmd",
".",
"split",
"(",
"' '",
")",
"... | If I clone this repo and run `npm install && npm test` does it work? If there is an `npm start`, run that as well and make sure it stays up for 5 seconds and doesn't return an error. | [
"If",
"I",
"clone",
"this",
"repo",
"and",
"run",
"npm",
"install",
"&&",
"npm",
"test",
"does",
"it",
"work?",
"If",
"there",
"is",
"an",
"npm",
"start",
"run",
"that",
"as",
"well",
"and",
"make",
"sure",
"it",
"stays",
"up",
"for",
"5",
"seconds",... | a643970372c74baf8cfc7087cda80d3f6001fe7b | https://github.com/mongodb-js/mj/blob/a643970372c74baf8cfc7087cda80d3f6001fe7b/commands/check.js#L84-L160 | |
57,116 | iolo/node-toybox | utils.js | toBoolean | function toBoolean(str, fallback) {
if (typeof str === 'boolean') {
return str;
}
if (REGEXP_TRUE.test(str)) {
return true;
}
if (REGEXP_FALSE.test(str)) {
return false;
}
return fallback;
} | javascript | function toBoolean(str, fallback) {
if (typeof str === 'boolean') {
return str;
}
if (REGEXP_TRUE.test(str)) {
return true;
}
if (REGEXP_FALSE.test(str)) {
return false;
}
return fallback;
} | [
"function",
"toBoolean",
"(",
"str",
",",
"fallback",
")",
"{",
"if",
"(",
"typeof",
"str",
"===",
"'boolean'",
")",
"{",
"return",
"str",
";",
"}",
"if",
"(",
"REGEXP_TRUE",
".",
"test",
"(",
"str",
")",
")",
"{",
"return",
"true",
";",
"}",
"if",... | convert string to strict boolean.
@param {string|boolean} str
@param {boolean} [fallback]
@returns {boolean} | [
"convert",
"string",
"to",
"strict",
"boolean",
"."
] | d03e48b5e4b3deb022688fee59dd33a2b71819d0 | https://github.com/iolo/node-toybox/blob/d03e48b5e4b3deb022688fee59dd33a2b71819d0/utils.js#L57-L68 |
57,117 | iolo/node-toybox | utils.js | hashCode | function hashCode(str) {
var hash = 0xdeadbeef;
for (var i = str.length; i >= 0; --i) {
hash = (hash * 33) ^ str.charCodeAt(--i);
}
// turn to unsigned 32bit int
return hash >>> 0;
} | javascript | function hashCode(str) {
var hash = 0xdeadbeef;
for (var i = str.length; i >= 0; --i) {
hash = (hash * 33) ^ str.charCodeAt(--i);
}
// turn to unsigned 32bit int
return hash >>> 0;
} | [
"function",
"hashCode",
"(",
"str",
")",
"{",
"var",
"hash",
"=",
"0xdeadbeef",
";",
"for",
"(",
"var",
"i",
"=",
"str",
".",
"length",
";",
"i",
">=",
"0",
";",
"--",
"i",
")",
"{",
"hash",
"=",
"(",
"hash",
"*",
"33",
")",
"^",
"str",
".",
... | get a non-crypto hash code from a string.
@param {string} str
@returns {number} unsigned 32bit hash code
@see http://www.cse.yorku.ca/~oz/hash.html | [
"get",
"a",
"non",
"-",
"crypto",
"hash",
"code",
"from",
"a",
"string",
"."
] | d03e48b5e4b3deb022688fee59dd33a2b71819d0 | https://github.com/iolo/node-toybox/blob/d03e48b5e4b3deb022688fee59dd33a2b71819d0/utils.js#L77-L84 |
57,118 | iolo/node-toybox | utils.js | gravatarUrl | function gravatarUrl(email, size) {
var url = 'http://www.gravatar.com/avatar/';
if (email) {
url += crypto.createHash('md5').update(email.toLowerCase()).digest('hex');
}
if (size) {
url += '?s=' + size;
}
return url;
} | javascript | function gravatarUrl(email, size) {
var url = 'http://www.gravatar.com/avatar/';
if (email) {
url += crypto.createHash('md5').update(email.toLowerCase()).digest('hex');
}
if (size) {
url += '?s=' + size;
}
return url;
} | [
"function",
"gravatarUrl",
"(",
"email",
",",
"size",
")",
"{",
"var",
"url",
"=",
"'http://www.gravatar.com/avatar/'",
";",
"if",
"(",
"email",
")",
"{",
"url",
"+=",
"crypto",
".",
"createHash",
"(",
"'md5'",
")",
".",
"update",
"(",
"email",
".",
"toL... | get gravatar url.
@param {String} email
@param {Number} [size]
@return {String} gravatar url | [
"get",
"gravatar",
"url",
"."
] | d03e48b5e4b3deb022688fee59dd33a2b71819d0 | https://github.com/iolo/node-toybox/blob/d03e48b5e4b3deb022688fee59dd33a2b71819d0/utils.js#L93-L102 |
57,119 | iolo/node-toybox | utils.js | placeholderUrl | function placeholderUrl(width, height, text) {
var url = 'http://placehold.it/' + width;
if (height) {
url += 'x' + height;
}
if (text) {
url += '&text=' + encodeURIComponent(text);
}
return url;
} | javascript | function placeholderUrl(width, height, text) {
var url = 'http://placehold.it/' + width;
if (height) {
url += 'x' + height;
}
if (text) {
url += '&text=' + encodeURIComponent(text);
}
return url;
} | [
"function",
"placeholderUrl",
"(",
"width",
",",
"height",
",",
"text",
")",
"{",
"var",
"url",
"=",
"'http://placehold.it/'",
"+",
"width",
";",
"if",
"(",
"height",
")",
"{",
"url",
"+=",
"'x'",
"+",
"height",
";",
"}",
"if",
"(",
"text",
")",
"{",... | get placeholder image url.
@param {number} width
@param {number} [height=width]
@param {string} [text]
@returns {string} placeholder image url | [
"get",
"placeholder",
"image",
"url",
"."
] | d03e48b5e4b3deb022688fee59dd33a2b71819d0 | https://github.com/iolo/node-toybox/blob/d03e48b5e4b3deb022688fee59dd33a2b71819d0/utils.js#L112-L121 |
57,120 | iolo/node-toybox | utils.js | digestPassword | function digestPassword(password, salt, algorithm, encoding) {
var hash = (salt) ? crypto.createHmac(algorithm || 'sha1', salt) : crypto.createHash(algorithm || 'sha1');
return hash.update(password).digest(encoding || 'hex');
} | javascript | function digestPassword(password, salt, algorithm, encoding) {
var hash = (salt) ? crypto.createHmac(algorithm || 'sha1', salt) : crypto.createHash(algorithm || 'sha1');
return hash.update(password).digest(encoding || 'hex');
} | [
"function",
"digestPassword",
"(",
"password",
",",
"salt",
",",
"algorithm",
",",
"encoding",
")",
"{",
"var",
"hash",
"=",
"(",
"salt",
")",
"?",
"crypto",
".",
"createHmac",
"(",
"algorithm",
"||",
"'sha1'",
",",
"salt",
")",
":",
"crypto",
".",
"cr... | digest password string with optional salt.
@param {String} password
@param {String} [salt]
@param {String} [algorithm='sha1'] 'sha1', 'md5', 'sha256', 'sha512'...
@param {String} [encoding='hex'] 'hex', 'binary' or 'base64'
@return {String} digested password string | [
"digest",
"password",
"string",
"with",
"optional",
"salt",
"."
] | d03e48b5e4b3deb022688fee59dd33a2b71819d0 | https://github.com/iolo/node-toybox/blob/d03e48b5e4b3deb022688fee59dd33a2b71819d0/utils.js#L142-L145 |
57,121 | iolo/node-toybox | utils.js | digestFile | function digestFile(file, algorithm, encoding) {
return crypto.createHash(algorithm || 'md5').update(fs.readFileSync(file)).digest(encoding || 'hex');
} | javascript | function digestFile(file, algorithm, encoding) {
return crypto.createHash(algorithm || 'md5').update(fs.readFileSync(file)).digest(encoding || 'hex');
} | [
"function",
"digestFile",
"(",
"file",
",",
"algorithm",
",",
"encoding",
")",
"{",
"return",
"crypto",
".",
"createHash",
"(",
"algorithm",
"||",
"'md5'",
")",
".",
"update",
"(",
"fs",
".",
"readFileSync",
"(",
"file",
")",
")",
".",
"digest",
"(",
"... | digest file content.
@param {String} file
@param {String} [algorithm='md5'] 'sha1', 'md5', 'sha256', 'sha512'...
@param {String} [encoding='hex'] 'hex', 'binary' or 'base64'
@return {String} digest string | [
"digest",
"file",
"content",
"."
] | d03e48b5e4b3deb022688fee59dd33a2b71819d0 | https://github.com/iolo/node-toybox/blob/d03e48b5e4b3deb022688fee59dd33a2b71819d0/utils.js#L155-L157 |
57,122 | samsonjs/batteries | lib/array.js | flatten | function flatten(a) {
return a.reduce(function(flat, val) {
if (val && typeof val.flatten === 'function') {
flat = flat.concat(val.flatten());
}
else if (Array.isArray(val)) {
flat = flat.concat(flatten(val));
}
else {
flat.push(val);
}
return flat;
});
} | javascript | function flatten(a) {
return a.reduce(function(flat, val) {
if (val && typeof val.flatten === 'function') {
flat = flat.concat(val.flatten());
}
else if (Array.isArray(val)) {
flat = flat.concat(flatten(val));
}
else {
flat.push(val);
}
return flat;
});
} | [
"function",
"flatten",
"(",
"a",
")",
"{",
"return",
"a",
".",
"reduce",
"(",
"function",
"(",
"flat",
",",
"val",
")",
"{",
"if",
"(",
"val",
"&&",
"typeof",
"val",
".",
"flatten",
"===",
"'function'",
")",
"{",
"flat",
"=",
"flat",
".",
"concat",... | Based on underscore.js's flatten | [
"Based",
"on",
"underscore",
".",
"js",
"s",
"flatten"
] | 48ca583338a89a9ec344cda7011da92dfc2f6d03 | https://github.com/samsonjs/batteries/blob/48ca583338a89a9ec344cda7011da92dfc2f6d03/lib/array.js#L51-L64 |
57,123 | Livefyre/stream-client | src/StreamClient.js | StreamClient | function StreamClient(options) {
EventEmitter.call(this);
SockJS = options.SockJS || SockJS; // Facilitate testing
this.options = extend({}, options); // Clone
this.options.debug = this.options.debug || false;
this.options.retry = this.options.retry || 10; // Try to (re)connect 10 times before givin... | javascript | function StreamClient(options) {
EventEmitter.call(this);
SockJS = options.SockJS || SockJS; // Facilitate testing
this.options = extend({}, options); // Clone
this.options.debug = this.options.debug || false;
this.options.retry = this.options.retry || 10; // Try to (re)connect 10 times before givin... | [
"function",
"StreamClient",
"(",
"options",
")",
"{",
"EventEmitter",
".",
"call",
"(",
"this",
")",
";",
"SockJS",
"=",
"options",
".",
"SockJS",
"||",
"SockJS",
";",
"// Facilitate testing",
"this",
".",
"options",
"=",
"extend",
"(",
"{",
"}",
",",
"o... | Instantiates a Stream v4 client that is responsible for service discovery, login, connecting
and streaming events for a given stream. The client will emit messages 'start', 'data', 'end', 'close', 'error'.
@param options - Map containing hostname and optionally protocol, port and endpoint; retry and retryTimeout; debug... | [
"Instantiates",
"a",
"Stream",
"v4",
"client",
"that",
"is",
"responsible",
"for",
"service",
"discovery",
"login",
"connecting",
"and",
"streaming",
"events",
"for",
"a",
"given",
"stream",
".",
"The",
"client",
"will",
"emit",
"messages",
"start",
"data",
"e... | 61638ab22723b9cacbc6fbb8790d650760f8252f | https://github.com/Livefyre/stream-client/blob/61638ab22723b9cacbc6fbb8790d650760f8252f/src/StreamClient.js#L77-L120 |
57,124 | aliaksandr-master/node-verifier-schema | lib/loader.js | function (Schema, key) {
if (!this.KEY_SCHEMA_REG_EXP.test(key)) {
throw new Error('invalid schema key format. must be match with ' + this.KEY_SCHEMA_REG_EXP.source);
}
var schema = new Schema();
key.replace(this.KEY_SCHEMA_REG_EXP, this._patchFormat(schema));
return schema;
} | javascript | function (Schema, key) {
if (!this.KEY_SCHEMA_REG_EXP.test(key)) {
throw new Error('invalid schema key format. must be match with ' + this.KEY_SCHEMA_REG_EXP.source);
}
var schema = new Schema();
key.replace(this.KEY_SCHEMA_REG_EXP, this._patchFormat(schema));
return schema;
} | [
"function",
"(",
"Schema",
",",
"key",
")",
"{",
"if",
"(",
"!",
"this",
".",
"KEY_SCHEMA_REG_EXP",
".",
"test",
"(",
"key",
")",
")",
"{",
"throw",
"new",
"Error",
"(",
"'invalid schema key format. must be match with '",
"+",
"this",
".",
"KEY_SCHEMA_REG_EXP"... | parse schema hash key
@method
@private
@param {Schema#constructor} Schema
@param {String} key
@returns {Schema} | [
"parse",
"schema",
"hash",
"key"
] | dc49df3c4703928bcfd7447a59cdd70bafac21b0 | https://github.com/aliaksandr-master/node-verifier-schema/blob/dc49df3c4703928bcfd7447a59cdd70bafac21b0/lib/loader.js#L23-L33 | |
57,125 | aliaksandr-master/node-verifier-schema | lib/loader.js | function (Schema, fieldName, parent) {
var schema = new Schema();
var name = fieldName.replace(this.KEY_FIELD_REG_EXP, this._patchFormat(schema));
return parent.field(name).like(schema);
} | javascript | function (Schema, fieldName, parent) {
var schema = new Schema();
var name = fieldName.replace(this.KEY_FIELD_REG_EXP, this._patchFormat(schema));
return parent.field(name).like(schema);
} | [
"function",
"(",
"Schema",
",",
"fieldName",
",",
"parent",
")",
"{",
"var",
"schema",
"=",
"new",
"Schema",
"(",
")",
";",
"var",
"name",
"=",
"fieldName",
".",
"replace",
"(",
"this",
".",
"KEY_FIELD_REG_EXP",
",",
"this",
".",
"_patchFormat",
"(",
"... | parse fieldKey to field schema.
add field schema to parent schema
@method
@private
@param {String#constructor} Schema
@param {String} fieldName
@param {Schema} parent
@returns {Schema} child field schema | [
"parse",
"fieldKey",
"to",
"field",
"schema",
".",
"add",
"field",
"schema",
"to",
"parent",
"schema"
] | dc49df3c4703928bcfd7447a59cdd70bafac21b0 | https://github.com/aliaksandr-master/node-verifier-schema/blob/dc49df3c4703928bcfd7447a59cdd70bafac21b0/lib/loader.js#L77-L82 | |
57,126 | deathcap/block-models | demo.js | function(gl, vertices, uv) {
var verticesBuf = createBuffer(gl, new Float32Array(vertices))
var uvBuf = createBuffer(gl, new Float32Array(uv))
var mesh = createVAO(gl, [
{ buffer: verticesBuf,
size: 3
},
{
buffer: uvBuf,
size: 2
}
])
mesh.length = vertices.... | javascript | function(gl, vertices, uv) {
var verticesBuf = createBuffer(gl, new Float32Array(vertices))
var uvBuf = createBuffer(gl, new Float32Array(uv))
var mesh = createVAO(gl, [
{ buffer: verticesBuf,
size: 3
},
{
buffer: uvBuf,
size: 2
}
])
mesh.length = vertices.... | [
"function",
"(",
"gl",
",",
"vertices",
",",
"uv",
")",
"{",
"var",
"verticesBuf",
"=",
"createBuffer",
"(",
"gl",
",",
"new",
"Float32Array",
"(",
"vertices",
")",
")",
"var",
"uvBuf",
"=",
"createBuffer",
"(",
"gl",
",",
"new",
"Float32Array",
"(",
"... | create a mesh ready for rendering | [
"create",
"a",
"mesh",
"ready",
"for",
"rendering"
] | 70e9c3becfcbf367e31e5b158ea8766c2ffafb5e | https://github.com/deathcap/block-models/blob/70e9c3becfcbf367e31e5b158ea8766c2ffafb5e/demo.js#L54-L70 | |
57,127 | Industryswarm/isnode-mod-data | lib/mongodb/mongodb-core/lib/uri_parser.js | parseQueryString | function parseQueryString(query, options) {
const result = {};
let parsedQueryString = qs.parse(query);
for (const key in parsedQueryString) {
const value = parsedQueryString[key];
if (value === '' || value == null) {
throw new MongoParseError('Incomplete key value pair for option');
}
con... | javascript | function parseQueryString(query, options) {
const result = {};
let parsedQueryString = qs.parse(query);
for (const key in parsedQueryString) {
const value = parsedQueryString[key];
if (value === '' || value == null) {
throw new MongoParseError('Incomplete key value pair for option');
}
con... | [
"function",
"parseQueryString",
"(",
"query",
",",
"options",
")",
"{",
"const",
"result",
"=",
"{",
"}",
";",
"let",
"parsedQueryString",
"=",
"qs",
".",
"parse",
"(",
"query",
")",
";",
"for",
"(",
"const",
"key",
"in",
"parsedQueryString",
")",
"{",
... | Parses a query string according the connection string spec.
@param {String} query The query string to parse
@param {object} [options] The options used for options parsing
@return {Object|Error} The parsed query string as an object, or an error if one was encountered | [
"Parses",
"a",
"query",
"string",
"according",
"the",
"connection",
"string",
"spec",
"."
] | 5adc639b88a0d72cbeef23a6b5df7f4540745089 | https://github.com/Industryswarm/isnode-mod-data/blob/5adc639b88a0d72cbeef23a6b5df7f4540745089/lib/mongodb/mongodb-core/lib/uri_parser.js#L363-L385 |
57,128 | darrencruse/sugarlisp-match | matchexpr-gentab.js | varMatchingAny | function varMatchingAny(varnameAtom) {
return sl.list(sl.atom("::", {token: varnameAtom}), varnameAtom, sl.str("any"));
} | javascript | function varMatchingAny(varnameAtom) {
return sl.list(sl.atom("::", {token: varnameAtom}), varnameAtom, sl.str("any"));
} | [
"function",
"varMatchingAny",
"(",
"varnameAtom",
")",
"{",
"return",
"sl",
".",
"list",
"(",
"sl",
".",
"atom",
"(",
"\"::\"",
",",
"{",
"token",
":",
"varnameAtom",
"}",
")",
",",
"varnameAtom",
",",
"sl",
".",
"str",
"(",
"\"any\"",
")",
")",
";",... | return forms for a var matching anything | [
"return",
"forms",
"for",
"a",
"var",
"matching",
"anything"
] | 72073f96af040b4cae4a1649a6d0c4c96ec301cb | https://github.com/darrencruse/sugarlisp-match/blob/72073f96af040b4cae4a1649a6d0c4c96ec301cb/matchexpr-gentab.js#L102-L104 |
57,129 | kirchrath/tpaxx | client/packages/local/tpaxx-core/.sencha/package/Boot.js | function (url) {
// *WARNING WARNING WARNING*
// This method yields the most correct result we can get but it is EXPENSIVE!
// In ALL browsers! When called multiple times in a sequence, as if when
// we resolve dependencies for entries, it will cause garba... | javascript | function (url) {
// *WARNING WARNING WARNING*
// This method yields the most correct result we can get but it is EXPENSIVE!
// In ALL browsers! When called multiple times in a sequence, as if when
// we resolve dependencies for entries, it will cause garba... | [
"function",
"(",
"url",
")",
"{",
"// *WARNING WARNING WARNING*",
"// This method yields the most correct result we can get but it is EXPENSIVE!",
"// In ALL browsers! When called multiple times in a sequence, as if when",
"// we resolve dependencies for entries, it will cause garbage collection eve... | This method returns a canonical URL for the given URL.
For example, the following all produce the same canonical URL (which is the
last one):
http://foo.com/bar/baz/zoo/derp/../../goo/Thing.js?_dc=12345
http://foo.com/bar/baz/zoo/derp/../../goo/Thing.js
http://foo.com/bar/baz/zoo/derp/../jazz/../../goo/Thing.js
http:... | [
"This",
"method",
"returns",
"a",
"canonical",
"URL",
"for",
"the",
"given",
"URL",
"."
] | 3ccc5b77459d093e823d740ddc53feefb12a9344 | https://github.com/kirchrath/tpaxx/blob/3ccc5b77459d093e823d740ddc53feefb12a9344/client/packages/local/tpaxx-core/.sencha/package/Boot.js#L623-L652 | |
57,130 | kirchrath/tpaxx | client/packages/local/tpaxx-core/.sencha/package/Boot.js | function (name, value) {
if (typeof name === 'string') {
Boot.config[name] = value;
} else {
for (var s in name) {
Boot.setConfig(s, name[s]);
}
}
return Boot;
... | javascript | function (name, value) {
if (typeof name === 'string') {
Boot.config[name] = value;
} else {
for (var s in name) {
Boot.setConfig(s, name[s]);
}
}
return Boot;
... | [
"function",
"(",
"name",
",",
"value",
")",
"{",
"if",
"(",
"typeof",
"name",
"===",
"'string'",
")",
"{",
"Boot",
".",
"config",
"[",
"name",
"]",
"=",
"value",
";",
"}",
"else",
"{",
"for",
"(",
"var",
"s",
"in",
"name",
")",
"{",
"Boot",
"."... | Set the configuration.
@param {Object} config The config object to override the default values.
@return {Ext.Boot} this | [
"Set",
"the",
"configuration",
"."
] | 3ccc5b77459d093e823d740ddc53feefb12a9344 | https://github.com/kirchrath/tpaxx/blob/3ccc5b77459d093e823d740ddc53feefb12a9344/client/packages/local/tpaxx-core/.sencha/package/Boot.js#L668-L677 | |
57,131 | kirchrath/tpaxx | client/packages/local/tpaxx-core/.sencha/package/Boot.js | function (indexMap, loadOrder) {
// In older versions indexMap was an object instead of a sparse array
if (!('length' in indexMap)) {
var indexArray = [],
index;
for (index in indexMap) {
... | javascript | function (indexMap, loadOrder) {
// In older versions indexMap was an object instead of a sparse array
if (!('length' in indexMap)) {
var indexArray = [],
index;
for (index in indexMap) {
... | [
"function",
"(",
"indexMap",
",",
"loadOrder",
")",
"{",
"// In older versions indexMap was an object instead of a sparse array",
"if",
"(",
"!",
"(",
"'length'",
"in",
"indexMap",
")",
")",
"{",
"var",
"indexArray",
"=",
"[",
"]",
",",
"index",
";",
"for",
"(",... | this is a helper function used by Ext.Loader to flush out
'uses' arrays for classes in some Ext versions | [
"this",
"is",
"a",
"helper",
"function",
"used",
"by",
"Ext",
".",
"Loader",
"to",
"flush",
"out",
"uses",
"arrays",
"for",
"classes",
"in",
"some",
"Ext",
"versions"
] | 3ccc5b77459d093e823d740ddc53feefb12a9344 | https://github.com/kirchrath/tpaxx/blob/3ccc5b77459d093e823d740ddc53feefb12a9344/client/packages/local/tpaxx-core/.sencha/package/Boot.js#L821-L837 | |
57,132 | findhit/findhit-promise | lib/class.js | function ( fn, context ) {
// Initialize variables
this.state = Promise.STATE.INITIALIZED;
this.handlers = [];
this.value = fn;
// Rebind control functions to be run always on this promise
this.resolve = this.resolve.bind( this );
this.fulfill = this.fulfill.bind( this );
this.reject = this.reject.bin... | javascript | function ( fn, context ) {
// Initialize variables
this.state = Promise.STATE.INITIALIZED;
this.handlers = [];
this.value = fn;
// Rebind control functions to be run always on this promise
this.resolve = this.resolve.bind( this );
this.fulfill = this.fulfill.bind( this );
this.reject = this.reject.bin... | [
"function",
"(",
"fn",
",",
"context",
")",
"{",
"// Initialize variables",
"this",
".",
"state",
"=",
"Promise",
".",
"STATE",
".",
"INITIALIZED",
";",
"this",
".",
"handlers",
"=",
"[",
"]",
";",
"this",
".",
"value",
"=",
"fn",
";",
"// Rebind control... | INITIALIZE AND DESTROY METHODS | [
"INITIALIZE",
"AND",
"DESTROY",
"METHODS"
] | 828ccc151dfce8bdce673296f967e2ad8cd965e9 | https://github.com/findhit/findhit-promise/blob/828ccc151dfce8bdce673296f967e2ad8cd965e9/lib/class.js#L26-L50 | |
57,133 | findhit/findhit-promise | lib/class.js | function ( x ) {
if ( Util.is.Error( x ) ) {
return this.reject( x );
}
// Promise Resolution Procedure: https://github.com/promises-aplus/promises-spec#the-promise-resolution-procedure
try {
if ( x === this ) {
throw new TypeError('A promise cannot be resolved with itself.');
}
if ( Util.is... | javascript | function ( x ) {
if ( Util.is.Error( x ) ) {
return this.reject( x );
}
// Promise Resolution Procedure: https://github.com/promises-aplus/promises-spec#the-promise-resolution-procedure
try {
if ( x === this ) {
throw new TypeError('A promise cannot be resolved with itself.');
}
if ( Util.is... | [
"function",
"(",
"x",
")",
"{",
"if",
"(",
"Util",
".",
"is",
".",
"Error",
"(",
"x",
")",
")",
"{",
"return",
"this",
".",
"reject",
"(",
"x",
")",
";",
"}",
"// Promise Resolution Procedure: https://github.com/promises-aplus/promises-spec#the-promise-resolution-... | INNER API METHODS | [
"INNER",
"API",
"METHODS"
] | 828ccc151dfce8bdce673296f967e2ad8cd965e9 | https://github.com/findhit/findhit-promise/blob/828ccc151dfce8bdce673296f967e2ad8cd965e9/lib/class.js#L56-L88 | |
57,134 | findhit/findhit-promise | lib/class.js | function ( onRejected ) {
if ( onRejected && typeof onRejected !== 'function' ) throw new TypeError("onFulfilled is not a function");
var promise = this,
handler = new Promise.Handler({
onRejected: onRejected,
});
// Catch on entire promise chain
while( promise ) {
handler.handle( promise );
p... | javascript | function ( onRejected ) {
if ( onRejected && typeof onRejected !== 'function' ) throw new TypeError("onFulfilled is not a function");
var promise = this,
handler = new Promise.Handler({
onRejected: onRejected,
});
// Catch on entire promise chain
while( promise ) {
handler.handle( promise );
p... | [
"function",
"(",
"onRejected",
")",
"{",
"if",
"(",
"onRejected",
"&&",
"typeof",
"onRejected",
"!==",
"'function'",
")",
"throw",
"new",
"TypeError",
"(",
"\"onFulfilled is not a function\"",
")",
";",
"var",
"promise",
"=",
"this",
",",
"handler",
"=",
"new"... | OUTER API METHODS | [
"OUTER",
"API",
"METHODS"
] | 828ccc151dfce8bdce673296f967e2ad8cd965e9 | https://github.com/findhit/findhit-promise/blob/828ccc151dfce8bdce673296f967e2ad8cd965e9/lib/class.js#L246-L261 | |
57,135 | nachos/native-builder | lib/index.js | resolve | function resolve() {
return whichNativeNodish('..')
.then(function (results) {
var nwVersion = results.nwVersion;
var asVersion = results.asVersion;
debug('which-native-nodish output: %j', results);
var prefix = '';
var target = '';
var debugArg = process.env.BUILD_DEBUG ? ' ... | javascript | function resolve() {
return whichNativeNodish('..')
.then(function (results) {
var nwVersion = results.nwVersion;
var asVersion = results.asVersion;
debug('which-native-nodish output: %j', results);
var prefix = '';
var target = '';
var debugArg = process.env.BUILD_DEBUG ? ' ... | [
"function",
"resolve",
"(",
")",
"{",
"return",
"whichNativeNodish",
"(",
"'..'",
")",
".",
"then",
"(",
"function",
"(",
"results",
")",
"{",
"var",
"nwVersion",
"=",
"results",
".",
"nwVersion",
";",
"var",
"asVersion",
"=",
"results",
".",
"asVersion",
... | Resolve the build command
@returns {Q.promise} The build command | [
"Resolve",
"the",
"build",
"command"
] | 2ce8ed7485066f4d3ead1d7d5df0ae59e410fde3 | https://github.com/nachos/native-builder/blob/2ce8ed7485066f4d3ead1d7d5df0ae59e410fde3/lib/index.js#L13-L45 |
57,136 | BurntCaramel/react-sow | rgba.js | rgba | function rgba(r, g, b, a) {
return new RGBA(r, g, b, a);
} | javascript | function rgba(r, g, b, a) {
return new RGBA(r, g, b, a);
} | [
"function",
"rgba",
"(",
"r",
",",
"g",
",",
"b",
",",
"a",
")",
"{",
"return",
"new",
"RGBA",
"(",
"r",
",",
"g",
",",
"b",
",",
"a",
")",
";",
"}"
] | We want the underlying RGBA type to be an implementation detail | [
"We",
"want",
"the",
"underlying",
"RGBA",
"type",
"to",
"be",
"an",
"implementation",
"detail"
] | 1eee1227460deb058035f3d3a22cdafead600492 | https://github.com/BurntCaramel/react-sow/blob/1eee1227460deb058035f3d3a22cdafead600492/rgba.js#L36-L38 |
57,137 | leolmi/install-here | util.js | function(cb) {
cb = cb || _.noop;
const self = this;
self._step = 0;
if (self._stack.length<=0) return cb();
(function next() {
const step = _getStep(self);
if (!step) {
cb();
} else if (_.isFunction(step)) {
step.call(self, next);
} else if (_.isFunction(step... | javascript | function(cb) {
cb = cb || _.noop;
const self = this;
self._step = 0;
if (self._stack.length<=0) return cb();
(function next() {
const step = _getStep(self);
if (!step) {
cb();
} else if (_.isFunction(step)) {
step.call(self, next);
} else if (_.isFunction(step... | [
"function",
"(",
"cb",
")",
"{",
"cb",
"=",
"cb",
"||",
"_",
".",
"noop",
";",
"const",
"self",
"=",
"this",
";",
"self",
".",
"_step",
"=",
"0",
";",
"if",
"(",
"self",
".",
"_stack",
".",
"length",
"<=",
"0",
")",
"return",
"cb",
"(",
")",
... | Avvia lo stack di elementi
@param {function} [cb]
@returns {*} | [
"Avvia",
"lo",
"stack",
"di",
"elementi"
] | ef6532c711737e295753f47b202a5ad3b05b34f3 | https://github.com/leolmi/install-here/blob/ef6532c711737e295753f47b202a5ad3b05b34f3/util.js#L33-L48 | |
57,138 | YannickBochatay/JSYG.Menu | JSYG.Menu.js | Menu | function Menu(arg,opt) {
if ($.isPlainObject(arg) || Array.isArray(arg)) { opt = arg; arg = null; }
/**
* Conteneur du menu contextuel
*/
if (!arg) arg = document.createElement('ul');
if (arg) this.container = $(arg)[0];
/**
*... | javascript | function Menu(arg,opt) {
if ($.isPlainObject(arg) || Array.isArray(arg)) { opt = arg; arg = null; }
/**
* Conteneur du menu contextuel
*/
if (!arg) arg = document.createElement('ul');
if (arg) this.container = $(arg)[0];
/**
*... | [
"function",
"Menu",
"(",
"arg",
",",
"opt",
")",
"{",
"if",
"(",
"$",
".",
"isPlainObject",
"(",
"arg",
")",
"||",
"Array",
".",
"isArray",
"(",
"arg",
")",
")",
"{",
"opt",
"=",
"arg",
";",
"arg",
"=",
"null",
";",
"}",
"/**\n * Conteneur ... | Constructeur de menus
@param {Object} opt optionnel, objet définissant les options. Si défini, le menu est activé implicitement.
@returns {Menu} | [
"Constructeur",
"de",
"menus"
] | 39cd640f9b1d8c1c5ff01a54eb1b0de1f8fd6c11 | https://github.com/YannickBochatay/JSYG.Menu/blob/39cd640f9b1d8c1c5ff01a54eb1b0de1f8fd6c11/JSYG.Menu.js#L152-L174 |
57,139 | jeremyosborne/llogger | llogger.js | function() {
var currentIndent = [];
var i;
for (i = 0; i < this._currentIndent; i++) {
currentIndent[i] = this._singleIndent;
}
return currentIndent.join("");
} | javascript | function() {
var currentIndent = [];
var i;
for (i = 0; i < this._currentIndent; i++) {
currentIndent[i] = this._singleIndent;
}
return currentIndent.join("");
} | [
"function",
"(",
")",
"{",
"var",
"currentIndent",
"=",
"[",
"]",
";",
"var",
"i",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"_currentIndent",
";",
"i",
"++",
")",
"{",
"currentIndent",
"[",
"i",
"]",
"=",
"this",
".",
"_singl... | Return the current amount of indentation.
@return {String} The current indentation.
@private | [
"Return",
"the",
"current",
"amount",
"of",
"indentation",
"."
] | e0d820215de9b84e815ffba8e78b18bb84f58ec7 | https://github.com/jeremyosborne/llogger/blob/e0d820215de9b84e815ffba8e78b18bb84f58ec7/llogger.js#L75-L82 | |
57,140 | jeremyosborne/llogger | llogger.js | function() {
if (!this.quiet()) {
var prefix = this._callerInfo() + this._getIndent() + "#".magenta.bold;
var args = argsToArray(arguments).map(function(a) {
if (typeof a != "string") {
a = util.inspect(a);
}
return a.to... | javascript | function() {
if (!this.quiet()) {
var prefix = this._callerInfo() + this._getIndent() + "#".magenta.bold;
var args = argsToArray(arguments).map(function(a) {
if (typeof a != "string") {
a = util.inspect(a);
}
return a.to... | [
"function",
"(",
")",
"{",
"if",
"(",
"!",
"this",
".",
"quiet",
"(",
")",
")",
"{",
"var",
"prefix",
"=",
"this",
".",
"_callerInfo",
"(",
")",
"+",
"this",
".",
"_getIndent",
"(",
")",
"+",
"\"#\"",
".",
"magenta",
".",
"bold",
";",
"var",
"a... | Print message as a stylized diagnostic section header. | [
"Print",
"message",
"as",
"a",
"stylized",
"diagnostic",
"section",
"header",
"."
] | e0d820215de9b84e815ffba8e78b18bb84f58ec7 | https://github.com/jeremyosborne/llogger/blob/e0d820215de9b84e815ffba8e78b18bb84f58ec7/llogger.js#L111-L122 | |
57,141 | jeremyosborne/llogger | llogger.js | function() {
if (!this.quiet()) {
var hr = [];
for (var i = 0; i < 79; i++) {
hr[i] = "-";
}
console.log(this._callerInfo() + this._getIndent() + hr.join("").green);
}
} | javascript | function() {
if (!this.quiet()) {
var hr = [];
for (var i = 0; i < 79; i++) {
hr[i] = "-";
}
console.log(this._callerInfo() + this._getIndent() + hr.join("").green);
}
} | [
"function",
"(",
")",
"{",
"if",
"(",
"!",
"this",
".",
"quiet",
"(",
")",
")",
"{",
"var",
"hr",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"79",
";",
"i",
"++",
")",
"{",
"hr",
"[",
"i",
"]",
"=",
"\"-\"",
... | Prints out an 80 character horizontal rule. | [
"Prints",
"out",
"an",
"80",
"character",
"horizontal",
"rule",
"."
] | e0d820215de9b84e815ffba8e78b18bb84f58ec7 | https://github.com/jeremyosborne/llogger/blob/e0d820215de9b84e815ffba8e78b18bb84f58ec7/llogger.js#L217-L225 | |
57,142 | greggman/hft-sample-ui | src/hft/scripts/misc/input.js | function(keyDownFn, keyUpFn) {
var g_keyState = {};
var g_oldKeyState = {};
var updateKey = function(keyCode, state) {
g_keyState[keyCode] = state;
if (g_oldKeyState !== g_keyState) {
g_oldKeyState = state;
if (state) {
keyDownFn(keyCode);
} else {
ke... | javascript | function(keyDownFn, keyUpFn) {
var g_keyState = {};
var g_oldKeyState = {};
var updateKey = function(keyCode, state) {
g_keyState[keyCode] = state;
if (g_oldKeyState !== g_keyState) {
g_oldKeyState = state;
if (state) {
keyDownFn(keyCode);
} else {
ke... | [
"function",
"(",
"keyDownFn",
",",
"keyUpFn",
")",
"{",
"var",
"g_keyState",
"=",
"{",
"}",
";",
"var",
"g_oldKeyState",
"=",
"{",
"}",
";",
"var",
"updateKey",
"=",
"function",
"(",
"keyCode",
",",
"state",
")",
"{",
"g_keyState",
"[",
"keyCode",
"]",... | Sets up controller key functions
@param {callback(code, down)} keyDownFn a function to be
called when a key is pressed. It's passed the keycode
and true.
@param {callback(code, down)} keyUpFn a function to be called
when a key is released. It's passed the keycode and
false.
@memberOf module:Input | [
"Sets",
"up",
"controller",
"key",
"functions"
] | b9e20afd5183db73522bcfae48225c87e01f68c0 | https://github.com/greggman/hft-sample-ui/blob/b9e20afd5183db73522bcfae48225c87e01f68c0/src/hft/scripts/misc/input.js#L216-L242 | |
57,143 | codeactual/sinon-doublist | lib/sinon-doublist/index.js | sinonDoublist | function sinonDoublist(sinon, test, disableAutoSandbox) {
if (typeof test === 'string') {
adapters[test](sinon, disableAutoSandbox);
return;
}
Object.keys(mixin).forEach(function forEachKey(method) {
test[method] = mixin[method].bind(test);
});
if (!disableAutoSandbox) {
test.createSandbox(si... | javascript | function sinonDoublist(sinon, test, disableAutoSandbox) {
if (typeof test === 'string') {
adapters[test](sinon, disableAutoSandbox);
return;
}
Object.keys(mixin).forEach(function forEachKey(method) {
test[method] = mixin[method].bind(test);
});
if (!disableAutoSandbox) {
test.createSandbox(si... | [
"function",
"sinonDoublist",
"(",
"sinon",
",",
"test",
",",
"disableAutoSandbox",
")",
"{",
"if",
"(",
"typeof",
"test",
"===",
"'string'",
")",
"{",
"adapters",
"[",
"test",
"]",
"(",
"sinon",
",",
"disableAutoSandbox",
")",
";",
"return",
";",
"}",
"O... | Init sandbox and add its properties to the current context.
@param {object} sinon
@param {string|object} test
- `{object}` Current test context, ex. `this` inside a 'before each' hook, to receive the sandbox/mixins
- `{string}` Name of supported adapter which will automatically set up and tear down the sandbox/mixins
... | [
"Init",
"sandbox",
"and",
"add",
"its",
"properties",
"to",
"the",
"current",
"context",
"."
] | e262b3525fb6debbac5a37ea8057df2c1c8b95fb | https://github.com/codeactual/sinon-doublist/blob/e262b3525fb6debbac5a37ea8057df2c1c8b95fb/lib/sinon-doublist/index.js#L27-L39 |
57,144 | switer/gulp-here | lib/tag.js | function (str) {
// here:xx:xxx??inline
var matches = /^<!--\s*here\:(.*?)\s*-->$/.exec(str.trim())
if (!matches || !matches[1]) return null
var expr = matches[1]
var parts = expr.split('??')
var query = querystring.parse(parts[1] || '')
var isInline = ('inline' i... | javascript | function (str) {
// here:xx:xxx??inline
var matches = /^<!--\s*here\:(.*?)\s*-->$/.exec(str.trim())
if (!matches || !matches[1]) return null
var expr = matches[1]
var parts = expr.split('??')
var query = querystring.parse(parts[1] || '')
var isInline = ('inline' i... | [
"function",
"(",
"str",
")",
"{",
"// here:xx:xxx??inline",
"var",
"matches",
"=",
"/",
"^<!--\\s*here\\:(.*?)\\s*-->$",
"/",
".",
"exec",
"(",
"str",
".",
"trim",
"(",
")",
")",
"if",
"(",
"!",
"matches",
"||",
"!",
"matches",
"[",
"1",
"]",
")",
"ret... | Here' tag expression parse functon | [
"Here",
"tag",
"expression",
"parse",
"functon"
] | 911023a99bf0086b04d2198e5b9eb5b7bd8d2ae5 | https://github.com/switer/gulp-here/blob/911023a99bf0086b04d2198e5b9eb5b7bd8d2ae5/lib/tag.js#L77-L102 | |
57,145 | thlorenz/pretty-trace | pretty-trace.js | prettyLines | function prettyLines(lines, theme) {
if (!lines || !Array.isArray(lines)) throw new Error('Please supply an array of lines');
if (!theme) throw new Error('Please supply a theme');
function prettify(line) {
if (!line) return null;
return exports.line(line, theme);
}
return lines.map(prettify);
} | javascript | function prettyLines(lines, theme) {
if (!lines || !Array.isArray(lines)) throw new Error('Please supply an array of lines');
if (!theme) throw new Error('Please supply a theme');
function prettify(line) {
if (!line) return null;
return exports.line(line, theme);
}
return lines.map(prettify);
} | [
"function",
"prettyLines",
"(",
"lines",
",",
"theme",
")",
"{",
"if",
"(",
"!",
"lines",
"||",
"!",
"Array",
".",
"isArray",
"(",
"lines",
")",
")",
"throw",
"new",
"Error",
"(",
"'Please supply an array of lines'",
")",
";",
"if",
"(",
"!",
"theme",
... | Prettifies multiple lines.
@name prettyTrace::lines
@function
@param {Array.<string>} lines lines to be prettified
@param {Object} theme theme that specifies how to prettify a trace @see prettyTrace::line
@return {Array.<string>} the prettified lines | [
"Prettifies",
"multiple",
"lines",
"."
] | ecf0b0fd236459e260b20c8a8199a024ef8ceb62 | https://github.com/thlorenz/pretty-trace/blob/ecf0b0fd236459e260b20c8a8199a024ef8ceb62/pretty-trace.js#L171-L181 |
57,146 | anyfs/glob-stream-plugin | index.js | function(fs, ourGlob, negatives, opt) {
// remove path relativity to make globs make sense
ourGlob = resolveGlob(fs, ourGlob, opt);
var ourOpt = extend({}, opt);
delete ourOpt.root;
// create globbing stuff
var globber = new glob.Glob(fs, ourGlob, ourOpt);
// extract base path from glob
... | javascript | function(fs, ourGlob, negatives, opt) {
// remove path relativity to make globs make sense
ourGlob = resolveGlob(fs, ourGlob, opt);
var ourOpt = extend({}, opt);
delete ourOpt.root;
// create globbing stuff
var globber = new glob.Glob(fs, ourGlob, ourOpt);
// extract base path from glob
... | [
"function",
"(",
"fs",
",",
"ourGlob",
",",
"negatives",
",",
"opt",
")",
"{",
"// remove path relativity to make globs make sense",
"ourGlob",
"=",
"resolveGlob",
"(",
"fs",
",",
"ourGlob",
",",
"opt",
")",
";",
"var",
"ourOpt",
"=",
"extend",
"(",
"{",
"}"... | creates a stream for a single glob or filter | [
"creates",
"a",
"stream",
"for",
"a",
"single",
"glob",
"or",
"filter"
] | e2f90ccc5627511632cec2bff1b32dfc44372f23 | https://github.com/anyfs/glob-stream-plugin/blob/e2f90ccc5627511632cec2bff1b32dfc44372f23/index.js#L16-L61 | |
57,147 | anyfs/glob-stream-plugin | index.js | function(fs, globs, opt) {
if (!opt) opt = {};
if (typeof opt.cwd !== 'string') opt.cwd = fs.resolve('.');
if (typeof opt.dot !== 'boolean') opt.dot = false;
if (typeof opt.silent !== 'boolean') opt.silent = true;
if (typeof opt.nonull !== 'boolean') opt.nonull = false;
if (typeof opt.cwdbase !=... | javascript | function(fs, globs, opt) {
if (!opt) opt = {};
if (typeof opt.cwd !== 'string') opt.cwd = fs.resolve('.');
if (typeof opt.dot !== 'boolean') opt.dot = false;
if (typeof opt.silent !== 'boolean') opt.silent = true;
if (typeof opt.nonull !== 'boolean') opt.nonull = false;
if (typeof opt.cwdbase !=... | [
"function",
"(",
"fs",
",",
"globs",
",",
"opt",
")",
"{",
"if",
"(",
"!",
"opt",
")",
"opt",
"=",
"{",
"}",
";",
"if",
"(",
"typeof",
"opt",
".",
"cwd",
"!==",
"'string'",
")",
"opt",
".",
"cwd",
"=",
"fs",
".",
"resolve",
"(",
"'.'",
")",
... | creates a stream for multiple globs or filters | [
"creates",
"a",
"stream",
"for",
"multiple",
"globs",
"or",
"filters"
] | e2f90ccc5627511632cec2bff1b32dfc44372f23 | https://github.com/anyfs/glob-stream-plugin/blob/e2f90ccc5627511632cec2bff1b32dfc44372f23/index.js#L64-L124 | |
57,148 | wronex/node-conquer | bin/conquer.js | extensionsParser | function extensionsParser(str) {
// Convert the file extensions string to a list.
var list = str.split(',');
for (var i = 0; i < list.length; i++) {
// Make sure the file extension has the correct format: '.ext'
var ext = '.' + list[i].replace(/(^\s?\.?)|(\s?$)/g, '');
list[i] = ext.toLowerCase();
}
return l... | javascript | function extensionsParser(str) {
// Convert the file extensions string to a list.
var list = str.split(',');
for (var i = 0; i < list.length; i++) {
// Make sure the file extension has the correct format: '.ext'
var ext = '.' + list[i].replace(/(^\s?\.?)|(\s?$)/g, '');
list[i] = ext.toLowerCase();
}
return l... | [
"function",
"extensionsParser",
"(",
"str",
")",
"{",
"// Convert the file extensions string to a list.",
"var",
"list",
"=",
"str",
".",
"split",
"(",
"','",
")",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"list",
".",
"length",
";",
"i",
"++... | connected client of changes made to files. This will allow browsers to refresh their page. The WebSocket client will be sent 'restart' when the script is restarted and 'exit' when the script exists.
Parses the supplied string of comma seperated file extensions and returns an
array of its values.
@param {String} str - ... | [
"connected",
"client",
"of",
"changes",
"made",
"to",
"files",
".",
"This",
"will",
"allow",
"browsers",
"to",
"refresh",
"their",
"page",
".",
"The",
"WebSocket",
"client",
"will",
"be",
"sent",
"restart",
"when",
"the",
"script",
"is",
"restarted",
"and",
... | 48fa586d1fad15ad544d143d1ba4b97172fed0f1 | https://github.com/wronex/node-conquer/blob/48fa586d1fad15ad544d143d1ba4b97172fed0f1/bin/conquer.js#L36-L45 |
57,149 | wronex/node-conquer | bin/conquer.js | listParser | function listParser(str) {
var list = str.split(',');
for (var i = 0; i < list.length; i++)
list[i] = list[i].replace(/(^\s?)|(\s?$)/g, '');
return list;
} | javascript | function listParser(str) {
var list = str.split(',');
for (var i = 0; i < list.length; i++)
list[i] = list[i].replace(/(^\s?)|(\s?$)/g, '');
return list;
} | [
"function",
"listParser",
"(",
"str",
")",
"{",
"var",
"list",
"=",
"str",
".",
"split",
"(",
"','",
")",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"list",
".",
"length",
";",
"i",
"++",
")",
"list",
"[",
"i",
"]",
"=",
"list",
... | Parses the supplied string of comma seperated list and returns an array of
its values.
@param {String} str - a string on the format "value1, value2, value2".
@retruns {String[]} - a list of all the found extensions in @a str. | [
"Parses",
"the",
"supplied",
"string",
"of",
"comma",
"seperated",
"list",
"and",
"returns",
"an",
"array",
"of",
"its",
"values",
"."
] | 48fa586d1fad15ad544d143d1ba4b97172fed0f1 | https://github.com/wronex/node-conquer/blob/48fa586d1fad15ad544d143d1ba4b97172fed0f1/bin/conquer.js#L53-L58 |
57,150 | wronex/node-conquer | bin/conquer.js | kill | function kill(noMsg, signal) {
if (!instance)
return false;
try {
if (signal)
instance.kill(signal);
else
process.kill(instance.pid);
if ((noMsg || false) !== true)
logger.log('Killed', clc.green(script));
} catch (ex) {
// Process was already dead.
return false;
}
return true;
} | javascript | function kill(noMsg, signal) {
if (!instance)
return false;
try {
if (signal)
instance.kill(signal);
else
process.kill(instance.pid);
if ((noMsg || false) !== true)
logger.log('Killed', clc.green(script));
} catch (ex) {
// Process was already dead.
return false;
}
return true;
} | [
"function",
"kill",
"(",
"noMsg",
",",
"signal",
")",
"{",
"if",
"(",
"!",
"instance",
")",
"return",
"false",
";",
"try",
"{",
"if",
"(",
"signal",
")",
"instance",
".",
"kill",
"(",
"signal",
")",
";",
"else",
"process",
".",
"kill",
"(",
"instan... | Kills the parser.
@param {Boolean} [noMsg] - indicates if no message should be written to the
log. Defaults to false.
@param {String} [signal] - indicates which kill signal that sould be sent
toLowerCase the child process (only applicable on Linux). Defaults to null.
@return {Bool} - true if the process was killed; oth... | [
"Kills",
"the",
"parser",
"."
] | 48fa586d1fad15ad544d143d1ba4b97172fed0f1 | https://github.com/wronex/node-conquer/blob/48fa586d1fad15ad544d143d1ba4b97172fed0f1/bin/conquer.js#L68-L86 |
57,151 | wronex/node-conquer | bin/conquer.js | restart | function restart() {
logger.log('Restarting', clc.green(script));
notifyWebSocket('restart');
if (!kill(true)) {
// The process wasn't running, start it now.
start(true);
} /*else {
// The process will restart when its 'exit' event is emitted.
}*/
} | javascript | function restart() {
logger.log('Restarting', clc.green(script));
notifyWebSocket('restart');
if (!kill(true)) {
// The process wasn't running, start it now.
start(true);
} /*else {
// The process will restart when its 'exit' event is emitted.
}*/
} | [
"function",
"restart",
"(",
")",
"{",
"logger",
".",
"log",
"(",
"'Restarting'",
",",
"clc",
".",
"green",
"(",
"script",
")",
")",
";",
"notifyWebSocket",
"(",
"'restart'",
")",
";",
"if",
"(",
"!",
"kill",
"(",
"true",
")",
")",
"{",
"// The proces... | Restarts the parser. | [
"Restarts",
"the",
"parser",
"."
] | 48fa586d1fad15ad544d143d1ba4b97172fed0f1 | https://github.com/wronex/node-conquer/blob/48fa586d1fad15ad544d143d1ba4b97172fed0f1/bin/conquer.js#L89-L98 |
57,152 | wronex/node-conquer | bin/conquer.js | notifyWebSocket | function notifyWebSocket(message) {
if (!webSocketServer || !message)
return;
// Send the message to all connection in the WebSocket server.
for (var value in webSocketServer.conn) {
var connection = webSocketServer.conn[value];
if (connection)
connection.send(message)
}
} | javascript | function notifyWebSocket(message) {
if (!webSocketServer || !message)
return;
// Send the message to all connection in the WebSocket server.
for (var value in webSocketServer.conn) {
var connection = webSocketServer.conn[value];
if (connection)
connection.send(message)
}
} | [
"function",
"notifyWebSocket",
"(",
"message",
")",
"{",
"if",
"(",
"!",
"webSocketServer",
"||",
"!",
"message",
")",
"return",
";",
"// Send the message to all connection in the WebSocket server.",
"for",
"(",
"var",
"value",
"in",
"webSocketServer",
".",
"conn",
... | Notifies all connection WebSocket clients by sending them the supplied
message.
@param message {String} - a message that will be sent to all WebSocket
clients currently connected. | [
"Notifies",
"all",
"connection",
"WebSocket",
"clients",
"by",
"sending",
"them",
"the",
"supplied",
"message",
"."
] | 48fa586d1fad15ad544d143d1ba4b97172fed0f1 | https://github.com/wronex/node-conquer/blob/48fa586d1fad15ad544d143d1ba4b97172fed0f1/bin/conquer.js#L106-L116 |
57,153 | wronex/node-conquer | bin/conquer.js | start | function start(noMsg) {
if ((noMsg || false) !== true)
logger.log('Starting', clc.green(script), 'with', clc.magenta(parser));
if (instance)
return;
// Spawn an instance of the parser that will run the script.
instance = spawn(parser, parserParams);
// Redirect the parser/script's output to the console.
... | javascript | function start(noMsg) {
if ((noMsg || false) !== true)
logger.log('Starting', clc.green(script), 'with', clc.magenta(parser));
if (instance)
return;
// Spawn an instance of the parser that will run the script.
instance = spawn(parser, parserParams);
// Redirect the parser/script's output to the console.
... | [
"function",
"start",
"(",
"noMsg",
")",
"{",
"if",
"(",
"(",
"noMsg",
"||",
"false",
")",
"!==",
"true",
")",
"logger",
".",
"log",
"(",
"'Starting'",
",",
"clc",
".",
"green",
"(",
"script",
")",
",",
"'with'",
",",
"clc",
".",
"magenta",
"(",
"... | Starts and instance of the parser if none is running.
@param {Boolean} [noMsg] - indicates if no message should be written to the
log. Defaults to false. | [
"Starts",
"and",
"instance",
"of",
"the",
"parser",
"if",
"none",
"is",
"running",
"."
] | 48fa586d1fad15ad544d143d1ba4b97172fed0f1 | https://github.com/wronex/node-conquer/blob/48fa586d1fad15ad544d143d1ba4b97172fed0f1/bin/conquer.js#L123-L163 |
57,154 | relief-melone/limitpromises | src/services/service.getLaunchIndex.js | getLaunchIndex | function getLaunchIndex(PromiseArray){
return PromiseArray.map(r => {return (r.isRunning === false && r.isRejected === false && r.isResolved === false)}).indexOf(true)
} | javascript | function getLaunchIndex(PromiseArray){
return PromiseArray.map(r => {return (r.isRunning === false && r.isRejected === false && r.isResolved === false)}).indexOf(true)
} | [
"function",
"getLaunchIndex",
"(",
"PromiseArray",
")",
"{",
"return",
"PromiseArray",
".",
"map",
"(",
"r",
"=>",
"{",
"return",
"(",
"r",
".",
"isRunning",
"===",
"false",
"&&",
"r",
".",
"isRejected",
"===",
"false",
"&&",
"r",
".",
"isResolved",
"===... | Returns the first Element of a PromiseArray that hasn't been started yet
@param {Object[]} PromiseArray The PromiseArray in which a new promise should be started
@returns {Number} The index where you will start the resolveLaunchPromise | [
"Returns",
"the",
"first",
"Element",
"of",
"a",
"PromiseArray",
"that",
"hasn",
"t",
"been",
"started",
"yet"
] | 1735b92749740204b597c1c6026257d54ade8200 | https://github.com/relief-melone/limitpromises/blob/1735b92749740204b597c1c6026257d54ade8200/src/services/service.getLaunchIndex.js#L9-L11 |
57,155 | juju/maraca | lib/parsers.js | parseAnnotation | function parseAnnotation(entity) {
return {
annotations: entity.annotations ? {
bundleURL: entity.annotations['bundle-url'],
guiX: entity.annotations['gui-x'],
guiY: entity.annotations['gui-y']
} : undefined,
modelUUID: entity['model-uuid'],
tag: entity.tag
};
} | javascript | function parseAnnotation(entity) {
return {
annotations: entity.annotations ? {
bundleURL: entity.annotations['bundle-url'],
guiX: entity.annotations['gui-x'],
guiY: entity.annotations['gui-y']
} : undefined,
modelUUID: entity['model-uuid'],
tag: entity.tag
};
} | [
"function",
"parseAnnotation",
"(",
"entity",
")",
"{",
"return",
"{",
"annotations",
":",
"entity",
".",
"annotations",
"?",
"{",
"bundleURL",
":",
"entity",
".",
"annotations",
"[",
"'bundle-url'",
"]",
",",
"guiX",
":",
"entity",
".",
"annotations",
"[",
... | Parse an annotation.
@param {Object} entity - The entity details.
@param {Object} entity.annotations - The annotation details.
@param {String} entity.annotations.bunde-url - The bundle url.
@param {String} entity.annotations.gui-x - The x position for the gui.
@param {String} entity.annotations.gui-y - The y position f... | [
"Parse",
"an",
"annotation",
"."
] | 0f245c6e09ef215fb4726bf7650320be2f49b6a0 | https://github.com/juju/maraca/blob/0f245c6e09ef215fb4726bf7650320be2f49b6a0/lib/parsers.js#L21-L31 |
57,156 | juju/maraca | lib/parsers.js | parseAnnotations | function parseAnnotations(response) {
let entities = {};
Object.keys(response).forEach(key => {
entities[key] = parseAnnotation(response[key]);
});
return entities;
} | javascript | function parseAnnotations(response) {
let entities = {};
Object.keys(response).forEach(key => {
entities[key] = parseAnnotation(response[key]);
});
return entities;
} | [
"function",
"parseAnnotations",
"(",
"response",
")",
"{",
"let",
"entities",
"=",
"{",
"}",
";",
"Object",
".",
"keys",
"(",
"response",
")",
".",
"forEach",
"(",
"key",
"=>",
"{",
"entities",
"[",
"key",
"]",
"=",
"parseAnnotation",
"(",
"response",
... | Parse a collection of annotations.
@param {Object} response - The collection, containing annotations as described
in parseAnnotation().
@returns {Object} The parsed collection, containing annotations as described
in parseAnnotation(). | [
"Parse",
"a",
"collection",
"of",
"annotations",
"."
] | 0f245c6e09ef215fb4726bf7650320be2f49b6a0 | https://github.com/juju/maraca/blob/0f245c6e09ef215fb4726bf7650320be2f49b6a0/lib/parsers.js#L40-L46 |
57,157 | juju/maraca | lib/parsers.js | parseApplication | function parseApplication(entity) {
return {
charmURL: entity['charm-url'],
// Config is arbitrary so leave the keys as defined.
config: entity.config,
// Constraints are arbitrary so leave the keys as defined.
constraints: entity.constraints,
exposed: entity.exposed,
life: entity.life,
... | javascript | function parseApplication(entity) {
return {
charmURL: entity['charm-url'],
// Config is arbitrary so leave the keys as defined.
config: entity.config,
// Constraints are arbitrary so leave the keys as defined.
constraints: entity.constraints,
exposed: entity.exposed,
life: entity.life,
... | [
"function",
"parseApplication",
"(",
"entity",
")",
"{",
"return",
"{",
"charmURL",
":",
"entity",
"[",
"'charm-url'",
"]",
",",
"// Config is arbitrary so leave the keys as defined.",
"config",
":",
"entity",
".",
"config",
",",
"// Constraints are arbitrary so leave the... | Parse an application.
@param {Object} entity - The entity details.
@param {String} entity.charm-url - The charmstore URL for the entity.
@param {Object} entity.config - The arbitrary config details.
@param {String} entity.config."config-key" - The config value.
@param {Object} entity.constraints - The arbitrary constra... | [
"Parse",
"an",
"application",
"."
] | 0f245c6e09ef215fb4726bf7650320be2f49b6a0 | https://github.com/juju/maraca/blob/0f245c6e09ef215fb4726bf7650320be2f49b6a0/lib/parsers.js#L89-L111 |
57,158 | juju/maraca | lib/parsers.js | parseApplications | function parseApplications(response) {
let entities = {};
Object.keys(response).forEach(key => {
entities[key] = parseApplication(response[key]);
});
return entities;
} | javascript | function parseApplications(response) {
let entities = {};
Object.keys(response).forEach(key => {
entities[key] = parseApplication(response[key]);
});
return entities;
} | [
"function",
"parseApplications",
"(",
"response",
")",
"{",
"let",
"entities",
"=",
"{",
"}",
";",
"Object",
".",
"keys",
"(",
"response",
")",
".",
"forEach",
"(",
"key",
"=>",
"{",
"entities",
"[",
"key",
"]",
"=",
"parseApplication",
"(",
"response",
... | Parse a collection of applications.
@param {Object} response - The collection, containing applications as described
in parseApplication().
@returns {Object} The parsed collection, containing applications as described
in parseApplication(). | [
"Parse",
"a",
"collection",
"of",
"applications",
"."
] | 0f245c6e09ef215fb4726bf7650320be2f49b6a0 | https://github.com/juju/maraca/blob/0f245c6e09ef215fb4726bf7650320be2f49b6a0/lib/parsers.js#L120-L126 |
57,159 | juju/maraca | lib/parsers.js | parseMachine | function parseMachine(entity) {
return {
addresses: entity.addresses ? entity.addresses.map(address => ({
value: address.value,
type: address.type,
scope: address.scope
})) : undefined,
agentStatus: entity['agent-status'] ? {
current: entity['agent-status'].current,
message: ... | javascript | function parseMachine(entity) {
return {
addresses: entity.addresses ? entity.addresses.map(address => ({
value: address.value,
type: address.type,
scope: address.scope
})) : undefined,
agentStatus: entity['agent-status'] ? {
current: entity['agent-status'].current,
message: ... | [
"function",
"parseMachine",
"(",
"entity",
")",
"{",
"return",
"{",
"addresses",
":",
"entity",
".",
"addresses",
"?",
"entity",
".",
"addresses",
".",
"map",
"(",
"address",
"=>",
"(",
"{",
"value",
":",
"address",
".",
"value",
",",
"type",
":",
"add... | Parse a machine.
@param {Object} entity - The entity details.
@param {Object[]} entity.addresses - The list of address objects.
@param {String} entity.adresses[].value - The address.
@param {String} entity.adresses[].type - The address type.
@param {String} entity.adresses[].scope - The address scope.
@param {Object} e... | [
"Parse",
"a",
"machine",
"."
] | 0f245c6e09ef215fb4726bf7650320be2f49b6a0 | https://github.com/juju/maraca/blob/0f245c6e09ef215fb4726bf7650320be2f49b6a0/lib/parsers.js#L189-L221 |
57,160 | juju/maraca | lib/parsers.js | parseMachines | function parseMachines(response) {
let entities = {};
Object.keys(response).forEach(key => {
entities[key] = parseMachine(response[key]);
});
return entities;
} | javascript | function parseMachines(response) {
let entities = {};
Object.keys(response).forEach(key => {
entities[key] = parseMachine(response[key]);
});
return entities;
} | [
"function",
"parseMachines",
"(",
"response",
")",
"{",
"let",
"entities",
"=",
"{",
"}",
";",
"Object",
".",
"keys",
"(",
"response",
")",
".",
"forEach",
"(",
"key",
"=>",
"{",
"entities",
"[",
"key",
"]",
"=",
"parseMachine",
"(",
"response",
"[",
... | Parse a collection of machines.
@param {Object} response - The collection, containing machines as described
in parseMachine().
@returns {Object} The parsed collection, containing machines as described
in parseMachine(). | [
"Parse",
"a",
"collection",
"of",
"machines",
"."
] | 0f245c6e09ef215fb4726bf7650320be2f49b6a0 | https://github.com/juju/maraca/blob/0f245c6e09ef215fb4726bf7650320be2f49b6a0/lib/parsers.js#L230-L236 |
57,161 | juju/maraca | lib/parsers.js | parseRelation | function parseRelation(entity) {
return {
endpoints: entity.endpoints ? entity.endpoints.map(endpoint => ({
applicationName: endpoint['application-name'],
relation: {
name: endpoint.relation.name,
role: endpoint.relation.role,
'interface': endpoint.relation.interface,
o... | javascript | function parseRelation(entity) {
return {
endpoints: entity.endpoints ? entity.endpoints.map(endpoint => ({
applicationName: endpoint['application-name'],
relation: {
name: endpoint.relation.name,
role: endpoint.relation.role,
'interface': endpoint.relation.interface,
o... | [
"function",
"parseRelation",
"(",
"entity",
")",
"{",
"return",
"{",
"endpoints",
":",
"entity",
".",
"endpoints",
"?",
"entity",
".",
"endpoints",
".",
"map",
"(",
"endpoint",
"=>",
"(",
"{",
"applicationName",
":",
"endpoint",
"[",
"'application-name'",
"]... | Parse a relation.
@param {Object} entity - The entity details.
@param {Object[]} entity.endpoints - The list of endpoint objects.
@param {String} entity.endpoints[].application-name - The application name.
@param {Object} entity.endpoints[].relation - The relation details.
@param {String} entity.endpoints[].relation.na... | [
"Parse",
"a",
"relation",
"."
] | 0f245c6e09ef215fb4726bf7650320be2f49b6a0 | https://github.com/juju/maraca/blob/0f245c6e09ef215fb4726bf7650320be2f49b6a0/lib/parsers.js#L268-L285 |
57,162 | juju/maraca | lib/parsers.js | parseRelations | function parseRelations(response) {
let entities = {};
Object.keys(response).forEach(key => {
entities[key] = parseRelation(response[key]);
});
return entities;
} | javascript | function parseRelations(response) {
let entities = {};
Object.keys(response).forEach(key => {
entities[key] = parseRelation(response[key]);
});
return entities;
} | [
"function",
"parseRelations",
"(",
"response",
")",
"{",
"let",
"entities",
"=",
"{",
"}",
";",
"Object",
".",
"keys",
"(",
"response",
")",
".",
"forEach",
"(",
"key",
"=>",
"{",
"entities",
"[",
"key",
"]",
"=",
"parseRelation",
"(",
"response",
"[",... | Parse a collection of relations.
@param {Object} response - The collection, containing relations as described
in parseRelation().
@returns {Object} The parsed collection, containing relations as described
in parseRelation(). | [
"Parse",
"a",
"collection",
"of",
"relations",
"."
] | 0f245c6e09ef215fb4726bf7650320be2f49b6a0 | https://github.com/juju/maraca/blob/0f245c6e09ef215fb4726bf7650320be2f49b6a0/lib/parsers.js#L294-L300 |
57,163 | juju/maraca | lib/parsers.js | parseRemoteApplication | function parseRemoteApplication(entity) {
return {
life: entity.life,
modelUUID: entity['model-uuid'],
name: entity.name,
offerURL: entity['offer-url'],
offerUUID: entity['offer-uuid'],
status: entity.status ? {
current: entity.status.current,
message: entity.status.message,
... | javascript | function parseRemoteApplication(entity) {
return {
life: entity.life,
modelUUID: entity['model-uuid'],
name: entity.name,
offerURL: entity['offer-url'],
offerUUID: entity['offer-uuid'],
status: entity.status ? {
current: entity.status.current,
message: entity.status.message,
... | [
"function",
"parseRemoteApplication",
"(",
"entity",
")",
"{",
"return",
"{",
"life",
":",
"entity",
".",
"life",
",",
"modelUUID",
":",
"entity",
"[",
"'model-uuid'",
"]",
",",
"name",
":",
"entity",
".",
"name",
",",
"offerURL",
":",
"entity",
"[",
"'o... | Parse a remote application.
@param {Object} entity - The entity details.
@param {String} entity.life - The lifecycle status of the entity.
@param {String} entity.model-uuid - The model uuid this entity belongs to.
@param {String} entity.name - The entity name.
@param {String} entity.offer-url - The offer URL.
@param {S... | [
"Parse",
"a",
"remote",
"application",
"."
] | 0f245c6e09ef215fb4726bf7650320be2f49b6a0 | https://github.com/juju/maraca/blob/0f245c6e09ef215fb4726bf7650320be2f49b6a0/lib/parsers.js#L327-L341 |
57,164 | juju/maraca | lib/parsers.js | parseRemoteApplications | function parseRemoteApplications(response) {
let entities = {};
Object.keys(response).forEach(key => {
entities[key] = parseRemoteApplication(response[key]);
});
return entities;
} | javascript | function parseRemoteApplications(response) {
let entities = {};
Object.keys(response).forEach(key => {
entities[key] = parseRemoteApplication(response[key]);
});
return entities;
} | [
"function",
"parseRemoteApplications",
"(",
"response",
")",
"{",
"let",
"entities",
"=",
"{",
"}",
";",
"Object",
".",
"keys",
"(",
"response",
")",
".",
"forEach",
"(",
"key",
"=>",
"{",
"entities",
"[",
"key",
"]",
"=",
"parseRemoteApplication",
"(",
... | Parse a collection of remote applications.
@param {Object} response - The collection, containing remote applications as
described in parseRemoteApplication().
@returns {Object} The parsed collection, containing remote applications as
described in parseRemoteApplication(). | [
"Parse",
"a",
"collection",
"of",
"remote",
"applications",
"."
] | 0f245c6e09ef215fb4726bf7650320be2f49b6a0 | https://github.com/juju/maraca/blob/0f245c6e09ef215fb4726bf7650320be2f49b6a0/lib/parsers.js#L350-L356 |
57,165 | juju/maraca | lib/parsers.js | parseUnit | function parseUnit(entity) {
return {
agentStatus: entity['agent-status'] ? {
current: entity['agent-status'].current,
message: entity['agent-status'].message,
since: entity['agent-status'].since,
version: entity['agent-status'].version
} : undefined,
application: entity.applicatio... | javascript | function parseUnit(entity) {
return {
agentStatus: entity['agent-status'] ? {
current: entity['agent-status'].current,
message: entity['agent-status'].message,
since: entity['agent-status'].since,
version: entity['agent-status'].version
} : undefined,
application: entity.applicatio... | [
"function",
"parseUnit",
"(",
"entity",
")",
"{",
"return",
"{",
"agentStatus",
":",
"entity",
"[",
"'agent-status'",
"]",
"?",
"{",
"current",
":",
"entity",
"[",
"'agent-status'",
"]",
".",
"current",
",",
"message",
":",
"entity",
"[",
"'agent-status'",
... | Parse a unit.
@param entity {Object} The entity details.
@param {Object} entity.agent-status - The agent status.
@param {String} entity.agent-status.current - The current status.
@param {String} entity.agent-status.message - The status message.
@param {String} entity.agent-status.since - The datetime for when the statu... | [
"Parse",
"a",
"unit",
"."
] | 0f245c6e09ef215fb4726bf7650320be2f49b6a0 | https://github.com/juju/maraca/blob/0f245c6e09ef215fb4726bf7650320be2f49b6a0/lib/parsers.js#L415-L448 |
57,166 | juju/maraca | lib/parsers.js | parseUnits | function parseUnits(response) {
let entities = {};
Object.keys(response).forEach(key => {
entities[key] = parseUnit(response[key]);
});
return entities;
} | javascript | function parseUnits(response) {
let entities = {};
Object.keys(response).forEach(key => {
entities[key] = parseUnit(response[key]);
});
return entities;
} | [
"function",
"parseUnits",
"(",
"response",
")",
"{",
"let",
"entities",
"=",
"{",
"}",
";",
"Object",
".",
"keys",
"(",
"response",
")",
".",
"forEach",
"(",
"key",
"=>",
"{",
"entities",
"[",
"key",
"]",
"=",
"parseUnit",
"(",
"response",
"[",
"key"... | Parse a collection of units.
@param {Object} response - The collection, containing units as described
in parseUnit().
@returns {Object} The parsed collection, containing units as described
in parseUnit(). | [
"Parse",
"a",
"collection",
"of",
"units",
"."
] | 0f245c6e09ef215fb4726bf7650320be2f49b6a0 | https://github.com/juju/maraca/blob/0f245c6e09ef215fb4726bf7650320be2f49b6a0/lib/parsers.js#L457-L463 |
57,167 | juju/maraca | lib/parsers.js | parseMegaWatcher | function parseMegaWatcher(response) {
return {
annotations: parseAnnotations(response.annotations),
applications: parseApplications(response.applications),
machines: parseMachines(response.machines),
relations: parseRelations(response.relations),
remoteApplications: parseRemoteApplications(respons... | javascript | function parseMegaWatcher(response) {
return {
annotations: parseAnnotations(response.annotations),
applications: parseApplications(response.applications),
machines: parseMachines(response.machines),
relations: parseRelations(response.relations),
remoteApplications: parseRemoteApplications(respons... | [
"function",
"parseMegaWatcher",
"(",
"response",
")",
"{",
"return",
"{",
"annotations",
":",
"parseAnnotations",
"(",
"response",
".",
"annotations",
")",
",",
"applications",
":",
"parseApplications",
"(",
"response",
".",
"applications",
")",
",",
"machines",
... | Parse a full megawatcher object.
@param {Object} response - The collections of entites.
@param {Object} response.annotations - The collection of annotations.
@param {Object} response.applications - The collection of applications.
@param {Object} response.machines - The collection of machines.
@param {Object} response.r... | [
"Parse",
"a",
"full",
"megawatcher",
"object",
"."
] | 0f245c6e09ef215fb4726bf7650320be2f49b6a0 | https://github.com/juju/maraca/blob/0f245c6e09ef215fb4726bf7650320be2f49b6a0/lib/parsers.js#L480-L489 |
57,168 | FH-Potsdam/mqtt-controls | dist/index.js | init | function init() {
var _user = arguments.length <= 0 || arguments[0] === undefined ? 'try' : arguments[0];
var _pw = arguments.length <= 1 || arguments[1] === undefined ? 'try' : arguments[1];
var _clientId = arguments.length <= 2 || arguments[2] === undefined ? 'mqttControlsClient' : arguments[2];
var _broke... | javascript | function init() {
var _user = arguments.length <= 0 || arguments[0] === undefined ? 'try' : arguments[0];
var _pw = arguments.length <= 1 || arguments[1] === undefined ? 'try' : arguments[1];
var _clientId = arguments.length <= 2 || arguments[2] === undefined ? 'mqttControlsClient' : arguments[2];
var _broke... | [
"function",
"init",
"(",
")",
"{",
"var",
"_user",
"=",
"arguments",
".",
"length",
"<=",
"0",
"||",
"arguments",
"[",
"0",
"]",
"===",
"undefined",
"?",
"'try'",
":",
"arguments",
"[",
"0",
"]",
";",
"var",
"_pw",
"=",
"arguments",
".",
"length",
... | export var url = url; export var topics = topics; export var isSubscribed = isSubscribed; export var isPublishing = isPublishing; export var stopPub = stopPub; export var protocol = protocol; export var broker = broker; export var user = user; export var pw = pw; export var clientId = clientId;
init Initialize the l... | [
"export",
"var",
"url",
"=",
"url",
";",
"export",
"var",
"topics",
"=",
"topics",
";",
"export",
"var",
"isSubscribed",
"=",
"isSubscribed",
";",
"export",
"var",
"isPublishing",
"=",
"isPublishing",
";",
"export",
"var",
"stopPub",
"=",
"stopPub",
";",
"... | 762928c4218b94335114c2e35295e54b4f848531 | https://github.com/FH-Potsdam/mqtt-controls/blob/762928c4218b94335114c2e35295e54b4f848531/dist/index.js#L60-L80 |
57,169 | FH-Potsdam/mqtt-controls | dist/index.js | connect | function connect() {
console.log('Connecting client: ' + clientId + ' to url:"' + url + '"');
client = mqtt.connect(url, { 'clientId': clientId });
} | javascript | function connect() {
console.log('Connecting client: ' + clientId + ' to url:"' + url + '"');
client = mqtt.connect(url, { 'clientId': clientId });
} | [
"function",
"connect",
"(",
")",
"{",
"console",
".",
"log",
"(",
"'Connecting client: '",
"+",
"clientId",
"+",
"' to url:\"'",
"+",
"url",
"+",
"'\"'",
")",
";",
"client",
"=",
"mqtt",
".",
"connect",
"(",
"url",
",",
"{",
"'clientId'",
":",
"clientId"... | connect Connect your client to the broker | [
"connect",
"Connect",
"your",
"client",
"to",
"the",
"broker"
] | 762928c4218b94335114c2e35295e54b4f848531 | https://github.com/FH-Potsdam/mqtt-controls/blob/762928c4218b94335114c2e35295e54b4f848531/dist/index.js#L85-L88 |
57,170 | FH-Potsdam/mqtt-controls | dist/index.js | disconnect | function disconnect() {
var force = arguments.length <= 0 || arguments[0] === undefined ? false : arguments[0];
var cb = arguments.length <= 1 || arguments[1] === undefined ? undefined : arguments[1];
console.log('Disconnecting client: ' + clientId);
stopPub = true;
client.end(force, cb);
} | javascript | function disconnect() {
var force = arguments.length <= 0 || arguments[0] === undefined ? false : arguments[0];
var cb = arguments.length <= 1 || arguments[1] === undefined ? undefined : arguments[1];
console.log('Disconnecting client: ' + clientId);
stopPub = true;
client.end(force, cb);
} | [
"function",
"disconnect",
"(",
")",
"{",
"var",
"force",
"=",
"arguments",
".",
"length",
"<=",
"0",
"||",
"arguments",
"[",
"0",
"]",
"===",
"undefined",
"?",
"false",
":",
"arguments",
"[",
"0",
"]",
";",
"var",
"cb",
"=",
"arguments",
".",
"length... | disconnect disconnect from the broker
@param {Boolean} force force disconnect. Default: false
@param {Function} cb Callback function the be called after disconnect. Default: undefined | [
"disconnect",
"disconnect",
"from",
"the",
"broker"
] | 762928c4218b94335114c2e35295e54b4f848531 | https://github.com/FH-Potsdam/mqtt-controls/blob/762928c4218b94335114c2e35295e54b4f848531/dist/index.js#L94-L101 |
57,171 | FH-Potsdam/mqtt-controls | dist/index.js | reconnect | function reconnect() {
client.end(false, function () {
console.log('Reconnecting client: ' + clientId);
client.connect(url, { 'clientId': clientId });
});
} | javascript | function reconnect() {
client.end(false, function () {
console.log('Reconnecting client: ' + clientId);
client.connect(url, { 'clientId': clientId });
});
} | [
"function",
"reconnect",
"(",
")",
"{",
"client",
".",
"end",
"(",
"false",
",",
"function",
"(",
")",
"{",
"console",
".",
"log",
"(",
"'Reconnecting client: '",
"+",
"clientId",
")",
";",
"client",
".",
"connect",
"(",
"url",
",",
"{",
"'clientId'",
... | reconnect Reconnect to your broker | [
"reconnect",
"Reconnect",
"to",
"your",
"broker"
] | 762928c4218b94335114c2e35295e54b4f848531 | https://github.com/FH-Potsdam/mqtt-controls/blob/762928c4218b94335114c2e35295e54b4f848531/dist/index.js#L106-L111 |
57,172 | FH-Potsdam/mqtt-controls | dist/index.js | subscribe | function subscribe() {
console.log('Subscribing client ' + clientId + ' to topic: ' + topics.subscribe);
client.subscribe(topics.subscribe);
isSubscribed = true;
} | javascript | function subscribe() {
console.log('Subscribing client ' + clientId + ' to topic: ' + topics.subscribe);
client.subscribe(topics.subscribe);
isSubscribed = true;
} | [
"function",
"subscribe",
"(",
")",
"{",
"console",
".",
"log",
"(",
"'Subscribing client '",
"+",
"clientId",
"+",
"' to topic: '",
"+",
"topics",
".",
"subscribe",
")",
";",
"client",
".",
"subscribe",
"(",
"topics",
".",
"subscribe",
")",
";",
"isSubscribe... | subscribe Subscribes to your topics | [
"subscribe",
"Subscribes",
"to",
"your",
"topics"
] | 762928c4218b94335114c2e35295e54b4f848531 | https://github.com/FH-Potsdam/mqtt-controls/blob/762928c4218b94335114c2e35295e54b4f848531/dist/index.js#L116-L120 |
57,173 | FH-Potsdam/mqtt-controls | dist/index.js | publish | function publish() {
console.log('Client ' + clientId + ' is publishing to topic ' + topics.publish);
// client.on('message',()=>{});
// this is just for testing purpouse
// maybe we dont need to stop and start publishing
var timer = setInterval(function () {
client.publish(topics.publish, 'ping');
if... | javascript | function publish() {
console.log('Client ' + clientId + ' is publishing to topic ' + topics.publish);
// client.on('message',()=>{});
// this is just for testing purpouse
// maybe we dont need to stop and start publishing
var timer = setInterval(function () {
client.publish(topics.publish, 'ping');
if... | [
"function",
"publish",
"(",
")",
"{",
"console",
".",
"log",
"(",
"'Client '",
"+",
"clientId",
"+",
"' is publishing to topic '",
"+",
"topics",
".",
"publish",
")",
";",
"// client.on('message',()=>{});",
"// this is just for testing purpouse",
"// maybe we dont need to... | publish Start publishing in an interval to your broker this is more for testing then for real usage. | [
"publish",
"Start",
"publishing",
"in",
"an",
"interval",
"to",
"your",
"broker",
"this",
"is",
"more",
"for",
"testing",
"then",
"for",
"real",
"usage",
"."
] | 762928c4218b94335114c2e35295e54b4f848531 | https://github.com/FH-Potsdam/mqtt-controls/blob/762928c4218b94335114c2e35295e54b4f848531/dist/index.js#L147-L159 |
57,174 | FH-Potsdam/mqtt-controls | dist/index.js | send | function send() {
var message = arguments.length <= 0 || arguments[0] === undefined ? 'hello mqtt-controls' : arguments[0];
var topic = arguments.length <= 1 || arguments[1] === undefined ? null : arguments[1];
var t = undefined;
if (topic === null) {
t = topics.publish;
} else {
t = topic;
}
cli... | javascript | function send() {
var message = arguments.length <= 0 || arguments[0] === undefined ? 'hello mqtt-controls' : arguments[0];
var topic = arguments.length <= 1 || arguments[1] === undefined ? null : arguments[1];
var t = undefined;
if (topic === null) {
t = topics.publish;
} else {
t = topic;
}
cli... | [
"function",
"send",
"(",
")",
"{",
"var",
"message",
"=",
"arguments",
".",
"length",
"<=",
"0",
"||",
"arguments",
"[",
"0",
"]",
"===",
"undefined",
"?",
"'hello mqtt-controls'",
":",
"arguments",
"[",
"0",
"]",
";",
"var",
"topic",
"=",
"arguments",
... | Send one signal to the borker
@param {String} message - The message to send. Default: `{'hello mqtt-controls'}`
@param {String} topic - The topic to send to. Default: is `topics = {'subscribe':'/output/#','publih':'/input/'}` | [
"Send",
"one",
"signal",
"to",
"the",
"borker"
] | 762928c4218b94335114c2e35295e54b4f848531 | https://github.com/FH-Potsdam/mqtt-controls/blob/762928c4218b94335114c2e35295e54b4f848531/dist/index.js#L166-L177 |
57,175 | fin-hypergrid/fincanvas | src/js/gc-console-logger.js | consoleLogger | function consoleLogger(prefix, name, args, value) {
var result = value;
if (typeof value === 'string') {
result = '"' + result + '"';
}
name = prefix + name;
switch (args) {
case 'getter':
console.log(name, '=', result);
break;
case 'setter':
... | javascript | function consoleLogger(prefix, name, args, value) {
var result = value;
if (typeof value === 'string') {
result = '"' + result + '"';
}
name = prefix + name;
switch (args) {
case 'getter':
console.log(name, '=', result);
break;
case 'setter':
... | [
"function",
"consoleLogger",
"(",
"prefix",
",",
"name",
",",
"args",
",",
"value",
")",
"{",
"var",
"result",
"=",
"value",
";",
"if",
"(",
"typeof",
"value",
"===",
"'string'",
")",
"{",
"result",
"=",
"'\"'",
"+",
"result",
"+",
"'\"'",
";",
"}",
... | LONG RIGHTWARDS DOUBLE ARROW | [
"LONG",
"RIGHTWARDS",
"DOUBLE",
"ARROW"
] | 1e4afb877923e3f26b62ee61a00abb1c3a1a071f | https://github.com/fin-hypergrid/fincanvas/blob/1e4afb877923e3f26b62ee61a00abb1c3a1a071f/src/js/gc-console-logger.js#L5-L33 |
57,176 | RnbWd/parse-browserify | lib/object.js | function() {
var self = this;
if (self._refreshingCache) {
return;
}
self._refreshingCache = true;
Parse._objectEach(this.attributes, function(value, key) {
if (value instanceof Parse.Object) {
value._refreshCache();
} else if (_.isObject(value)) {
... | javascript | function() {
var self = this;
if (self._refreshingCache) {
return;
}
self._refreshingCache = true;
Parse._objectEach(this.attributes, function(value, key) {
if (value instanceof Parse.Object) {
value._refreshCache();
} else if (_.isObject(value)) {
... | [
"function",
"(",
")",
"{",
"var",
"self",
"=",
"this",
";",
"if",
"(",
"self",
".",
"_refreshingCache",
")",
"{",
"return",
";",
"}",
"self",
".",
"_refreshingCache",
"=",
"true",
";",
"Parse",
".",
"_objectEach",
"(",
"this",
".",
"attributes",
",",
... | Updates _hashedJSON to reflect the current state of this object.
Adds any changed hash values to the set of pending changes. | [
"Updates",
"_hashedJSON",
"to",
"reflect",
"the",
"current",
"state",
"of",
"this",
"object",
".",
"Adds",
"any",
"changed",
"hash",
"values",
"to",
"the",
"set",
"of",
"pending",
"changes",
"."
] | c19c1b798e4010a552e130b1a9ce3b5d084dc101 | https://github.com/RnbWd/parse-browserify/blob/c19c1b798e4010a552e130b1a9ce3b5d084dc101/lib/object.js#L352-L368 | |
57,177 | RnbWd/parse-browserify | lib/object.js | function(attrs) {
// Check for changes of magic fields.
var model = this;
var specialFields = ["id", "objectId", "createdAt", "updatedAt"];
Parse._arrayEach(specialFields, function(attr) {
if (attrs[attr]) {
if (attr === "objectId") {
model.id = attrs[attr];
... | javascript | function(attrs) {
// Check for changes of magic fields.
var model = this;
var specialFields = ["id", "objectId", "createdAt", "updatedAt"];
Parse._arrayEach(specialFields, function(attr) {
if (attrs[attr]) {
if (attr === "objectId") {
model.id = attrs[attr];
... | [
"function",
"(",
"attrs",
")",
"{",
"// Check for changes of magic fields.",
"var",
"model",
"=",
"this",
";",
"var",
"specialFields",
"=",
"[",
"\"id\"",
",",
"\"objectId\"",
",",
"\"createdAt\"",
",",
"\"updatedAt\"",
"]",
";",
"Parse",
".",
"_arrayEach",
"(",... | Pulls "special" fields like objectId, createdAt, etc. out of attrs
and puts them on "this" directly. Removes them from attrs.
@param attrs - A dictionary with the data for this Parse.Object. | [
"Pulls",
"special",
"fields",
"like",
"objectId",
"createdAt",
"etc",
".",
"out",
"of",
"attrs",
"and",
"puts",
"them",
"on",
"this",
"directly",
".",
"Removes",
"them",
"from",
"attrs",
"."
] | c19c1b798e4010a552e130b1a9ce3b5d084dc101 | https://github.com/RnbWd/parse-browserify/blob/c19c1b798e4010a552e130b1a9ce3b5d084dc101/lib/object.js#L473-L490 | |
57,178 | RnbWd/parse-browserify | lib/object.js | function(serverData) {
// Copy server data
var tempServerData = {};
Parse._objectEach(serverData, function(value, key) {
tempServerData[key] = Parse._decode(key, value);
});
this._serverData = tempServerData;
// Refresh the attributes.
this._rebuildAllEstimatedData();
... | javascript | function(serverData) {
// Copy server data
var tempServerData = {};
Parse._objectEach(serverData, function(value, key) {
tempServerData[key] = Parse._decode(key, value);
});
this._serverData = tempServerData;
// Refresh the attributes.
this._rebuildAllEstimatedData();
... | [
"function",
"(",
"serverData",
")",
"{",
"// Copy server data",
"var",
"tempServerData",
"=",
"{",
"}",
";",
"Parse",
".",
"_objectEach",
"(",
"serverData",
",",
"function",
"(",
"value",
",",
"key",
")",
"{",
"tempServerData",
"[",
"key",
"]",
"=",
"Parse... | Copies the given serverData to "this", refreshes attributes, and
clears pending changes; | [
"Copies",
"the",
"given",
"serverData",
"to",
"this",
"refreshes",
"attributes",
"and",
"clears",
"pending",
"changes",
";"
] | c19c1b798e4010a552e130b1a9ce3b5d084dc101 | https://github.com/RnbWd/parse-browserify/blob/c19c1b798e4010a552e130b1a9ce3b5d084dc101/lib/object.js#L496-L514 | |
57,179 | RnbWd/parse-browserify | lib/object.js | function(other) {
if (!other) {
return;
}
// This does the inverse of _mergeMagicFields.
this.id = other.id;
this.createdAt = other.createdAt;
this.updatedAt = other.updatedAt;
this._copyServerData(other._serverData);
this._hasData = true;
} | javascript | function(other) {
if (!other) {
return;
}
// This does the inverse of _mergeMagicFields.
this.id = other.id;
this.createdAt = other.createdAt;
this.updatedAt = other.updatedAt;
this._copyServerData(other._serverData);
this._hasData = true;
} | [
"function",
"(",
"other",
")",
"{",
"if",
"(",
"!",
"other",
")",
"{",
"return",
";",
"}",
"// This does the inverse of _mergeMagicFields.",
"this",
".",
"id",
"=",
"other",
".",
"id",
";",
"this",
".",
"createdAt",
"=",
"other",
".",
"createdAt",
";",
"... | Merges another object's attributes into this object. | [
"Merges",
"another",
"object",
"s",
"attributes",
"into",
"this",
"object",
"."
] | c19c1b798e4010a552e130b1a9ce3b5d084dc101 | https://github.com/RnbWd/parse-browserify/blob/c19c1b798e4010a552e130b1a9ce3b5d084dc101/lib/object.js#L519-L532 | |
57,180 | RnbWd/parse-browserify | lib/object.js | function(opSet, target) {
var self = this;
Parse._objectEach(opSet, function(change, key) {
target[key] = change._estimate(target[key], self, key);
if (target[key] === Parse.Op._UNSET) {
delete target[key];
}
});
} | javascript | function(opSet, target) {
var self = this;
Parse._objectEach(opSet, function(change, key) {
target[key] = change._estimate(target[key], self, key);
if (target[key] === Parse.Op._UNSET) {
delete target[key];
}
});
} | [
"function",
"(",
"opSet",
",",
"target",
")",
"{",
"var",
"self",
"=",
"this",
";",
"Parse",
".",
"_objectEach",
"(",
"opSet",
",",
"function",
"(",
"change",
",",
"key",
")",
"{",
"target",
"[",
"key",
"]",
"=",
"change",
".",
"_estimate",
"(",
"t... | Applies the set of Parse.Op in opSet to the object target. | [
"Applies",
"the",
"set",
"of",
"Parse",
".",
"Op",
"in",
"opSet",
"to",
"the",
"object",
"target",
"."
] | c19c1b798e4010a552e130b1a9ce3b5d084dc101 | https://github.com/RnbWd/parse-browserify/blob/c19c1b798e4010a552e130b1a9ce3b5d084dc101/lib/object.js#L628-L636 | |
57,181 | RnbWd/parse-browserify | lib/object.js | function() {
var self = this;
var previousAttributes = _.clone(this.attributes);
this.attributes = _.clone(this._serverData);
Parse._arrayEach(this._opSetQueue, function(opSet) {
self._applyOpSet(opSet, self.attributes);
Parse._objectEach(opSet, function(op, key) {
se... | javascript | function() {
var self = this;
var previousAttributes = _.clone(this.attributes);
this.attributes = _.clone(this._serverData);
Parse._arrayEach(this._opSetQueue, function(opSet) {
self._applyOpSet(opSet, self.attributes);
Parse._objectEach(opSet, function(op, key) {
se... | [
"function",
"(",
")",
"{",
"var",
"self",
"=",
"this",
";",
"var",
"previousAttributes",
"=",
"_",
".",
"clone",
"(",
"this",
".",
"attributes",
")",
";",
"this",
".",
"attributes",
"=",
"_",
".",
"clone",
"(",
"this",
".",
"_serverData",
")",
";",
... | Populates attributes by starting with the last known data from the
server, and applying all of the local changes that have been made since
then. | [
"Populates",
"attributes",
"by",
"starting",
"with",
"the",
"last",
"known",
"data",
"from",
"the",
"server",
"and",
"applying",
"all",
"of",
"the",
"local",
"changes",
"that",
"have",
"been",
"made",
"since",
"then",
"."
] | c19c1b798e4010a552e130b1a9ce3b5d084dc101 | https://github.com/RnbWd/parse-browserify/blob/c19c1b798e4010a552e130b1a9ce3b5d084dc101/lib/object.js#L686-L710 | |
57,182 | RnbWd/parse-browserify | lib/object.js | function(attr, amount) {
if (_.isUndefined(amount) || _.isNull(amount)) {
amount = 1;
}
return this.set(attr, new Parse.Op.Increment(amount));
} | javascript | function(attr, amount) {
if (_.isUndefined(amount) || _.isNull(amount)) {
amount = 1;
}
return this.set(attr, new Parse.Op.Increment(amount));
} | [
"function",
"(",
"attr",
",",
"amount",
")",
"{",
"if",
"(",
"_",
".",
"isUndefined",
"(",
"amount",
")",
"||",
"_",
".",
"isNull",
"(",
"amount",
")",
")",
"{",
"amount",
"=",
"1",
";",
"}",
"return",
"this",
".",
"set",
"(",
"attr",
",",
"new... | Atomically increments the value of the given attribute the next time the
object is saved. If no amount is specified, 1 is used by default.
@param attr {String} The key.
@param amount {Number} The amount to increment by. | [
"Atomically",
"increments",
"the",
"value",
"of",
"the",
"given",
"attribute",
"the",
"next",
"time",
"the",
"object",
"is",
"saved",
".",
"If",
"no",
"amount",
"is",
"specified",
"1",
"is",
"used",
"by",
"default",
"."
] | c19c1b798e4010a552e130b1a9ce3b5d084dc101 | https://github.com/RnbWd/parse-browserify/blob/c19c1b798e4010a552e130b1a9ce3b5d084dc101/lib/object.js#L867-L872 | |
57,183 | RnbWd/parse-browserify | lib/object.js | function() {
var json = _.clone(_.first(this._opSetQueue));
Parse._objectEach(json, function(op, key) {
json[key] = op.toJSON();
});
return json;
} | javascript | function() {
var json = _.clone(_.first(this._opSetQueue));
Parse._objectEach(json, function(op, key) {
json[key] = op.toJSON();
});
return json;
} | [
"function",
"(",
")",
"{",
"var",
"json",
"=",
"_",
".",
"clone",
"(",
"_",
".",
"first",
"(",
"this",
".",
"_opSetQueue",
")",
")",
";",
"Parse",
".",
"_objectEach",
"(",
"json",
",",
"function",
"(",
"op",
",",
"key",
")",
"{",
"json",
"[",
"... | Returns a JSON-encoded set of operations to be sent with the next save
request. | [
"Returns",
"a",
"JSON",
"-",
"encoded",
"set",
"of",
"operations",
"to",
"be",
"sent",
"with",
"the",
"next",
"save",
"request",
"."
] | c19c1b798e4010a552e130b1a9ce3b5d084dc101 | https://github.com/RnbWd/parse-browserify/blob/c19c1b798e4010a552e130b1a9ce3b5d084dc101/lib/object.js#L935-L941 | |
57,184 | atuttle/corq | corq.js | $item | function $item(corq, item){
var typeName = item.type;
if (!corq.callbacks[typeName]){
throw "Item handler not found for items of type `" + typeName + "`";
}
$debug(corq, 'Corq: Calling handler for item `' + typeName + '`');
$debug(corq, item.data);
var _next = function(){
var freq = (corq.delay) ? cor... | javascript | function $item(corq, item){
var typeName = item.type;
if (!corq.callbacks[typeName]){
throw "Item handler not found for items of type `" + typeName + "`";
}
$debug(corq, 'Corq: Calling handler for item `' + typeName + '`');
$debug(corq, item.data);
var _next = function(){
var freq = (corq.delay) ? cor... | [
"function",
"$item",
"(",
"corq",
",",
"item",
")",
"{",
"var",
"typeName",
"=",
"item",
".",
"type",
";",
"if",
"(",
"!",
"corq",
".",
"callbacks",
"[",
"typeName",
"]",
")",
"{",
"throw",
"\"Item handler not found for items of type `\"",
"+",
"typeName",
... | calls all necessary handlers for this item | [
"calls",
"all",
"necessary",
"handlers",
"for",
"this",
"item"
] | 02738b3fedf54012b2df7b7b8dd0c4b96505fad5 | https://github.com/atuttle/corq/blob/02738b3fedf54012b2df7b7b8dd0c4b96505fad5/corq.js#L105-L138 |
57,185 | jameswyse/rego | lib/Registry.js | getOrRegister | function getOrRegister(name, definition) {
if(name && !definition) {
return registry.get(name);
}
if(name && definition) {
return registry.register(name, definition);
}
return null;
} | javascript | function getOrRegister(name, definition) {
if(name && !definition) {
return registry.get(name);
}
if(name && definition) {
return registry.register(name, definition);
}
return null;
} | [
"function",
"getOrRegister",
"(",
"name",
",",
"definition",
")",
"{",
"if",
"(",
"name",
"&&",
"!",
"definition",
")",
"{",
"return",
"registry",
".",
"get",
"(",
"name",
")",
";",
"}",
"if",
"(",
"name",
"&&",
"definition",
")",
"{",
"return",
"reg... | get or register a service | [
"get",
"or",
"register",
"a",
"service"
] | 18565c733c91157ff1149e6e505ef84a3d6fd441 | https://github.com/jameswyse/rego/blob/18565c733c91157ff1149e6e505ef84a3d6fd441/lib/Registry.js#L19-L28 |
57,186 | allanmboyd/spidertest | lib/spider.js | extractHeaderCookies | function extractHeaderCookies(headerSet) {
var cookie = headerSet.cookie;
var cookies = cookie ? cookie.split(';') : [];
delete headerSet.cookie;
return cookies;
} | javascript | function extractHeaderCookies(headerSet) {
var cookie = headerSet.cookie;
var cookies = cookie ? cookie.split(';') : [];
delete headerSet.cookie;
return cookies;
} | [
"function",
"extractHeaderCookies",
"(",
"headerSet",
")",
"{",
"var",
"cookie",
"=",
"headerSet",
".",
"cookie",
";",
"var",
"cookies",
"=",
"cookie",
"?",
"cookie",
".",
"split",
"(",
"';'",
")",
":",
"[",
"]",
";",
"delete",
"headerSet",
".",
"cookie"... | Pull out the cookie from a header set. It is assumed that there is a max of 1 cookie header per header set. The
cookie is removed from the headerSet if found.
@param {Object} headerSet the set of headers from which to extract the cookies | [
"Pull",
"out",
"the",
"cookie",
"from",
"a",
"header",
"set",
".",
"It",
"is",
"assumed",
"that",
"there",
"is",
"a",
"max",
"of",
"1",
"cookie",
"header",
"per",
"header",
"set",
".",
"The",
"cookie",
"is",
"removed",
"from",
"the",
"headerSet",
"if",... | c3f5ddc583a963706d31ec464bc128ec2db672dc | https://github.com/allanmboyd/spidertest/blob/c3f5ddc583a963706d31ec464bc128ec2db672dc/lib/spider.js#L267-L272 |
57,187 | directiv/data-hyper-img | index.js | hyperImg | function hyperImg(store) {
this.compile = function(input) {
var path = input.split('.');
return {
path: input,
target: path[path.length - 1]
};
};
this.state = function(config, state) {
var res = store.get(config.path, state);
if (!res.completed) return false;
return state.set... | javascript | function hyperImg(store) {
this.compile = function(input) {
var path = input.split('.');
return {
path: input,
target: path[path.length - 1]
};
};
this.state = function(config, state) {
var res = store.get(config.path, state);
if (!res.completed) return false;
return state.set... | [
"function",
"hyperImg",
"(",
"store",
")",
"{",
"this",
".",
"compile",
"=",
"function",
"(",
"input",
")",
"{",
"var",
"path",
"=",
"input",
".",
"split",
"(",
"'.'",
")",
";",
"return",
"{",
"path",
":",
"input",
",",
"target",
":",
"path",
"[",
... | Initialize the 'hyper-img' directive
@param {StoreHyper} store | [
"Initialize",
"the",
"hyper",
"-",
"img",
"directive"
] | 18a285ecbef12e31d7dbc4186f9d50fa1e83aa98 | https://github.com/directiv/data-hyper-img/blob/18a285ecbef12e31d7dbc4186f9d50fa1e83aa98/index.js#L19-L40 |
57,188 | at88mph/opencadc-registry | registry.js | Registry | function Registry(opts) {
var defaultOptions = {
resourceCapabilitiesEndPoint:
'http://www.cadc-ccda.hia-iha.nrc-cnrc.gc.ca/reg/resource-caps'
}
var options = opts || {}
this.axiosConfig = {
method: 'get',
withCredentials: true,
crossDomain: true
}
this.resourceCapabilitiesURL = URL.... | javascript | function Registry(opts) {
var defaultOptions = {
resourceCapabilitiesEndPoint:
'http://www.cadc-ccda.hia-iha.nrc-cnrc.gc.ca/reg/resource-caps'
}
var options = opts || {}
this.axiosConfig = {
method: 'get',
withCredentials: true,
crossDomain: true
}
this.resourceCapabilitiesURL = URL.... | [
"function",
"Registry",
"(",
"opts",
")",
"{",
"var",
"defaultOptions",
"=",
"{",
"resourceCapabilitiesEndPoint",
":",
"'http://www.cadc-ccda.hia-iha.nrc-cnrc.gc.ca/reg/resource-caps'",
"}",
"var",
"options",
"=",
"opts",
"||",
"{",
"}",
"this",
".",
"axiosConfig",
"=... | Registry client constructor.
This client ALWAYS uses the JWT authorization.
@param {{}} opts
@constructor | [
"Registry",
"client",
"constructor",
"."
] | 379cd0479185ce1fd2e3cacd5f7ac6fe0672194a | https://github.com/at88mph/opencadc-registry/blob/379cd0479185ce1fd2e3cacd5f7ac6fe0672194a/registry.js#L18-L121 |
57,189 | beschoenen/grunt-contrib-template | tasks/template.js | getSourceCode | function getSourceCode(filepath) {
// The current folder
var dir = filepath.substring(0, filepath.lastIndexOf("/") + 1);
// Regex for file import
var fileRegex = /(?:["'])<!=\s*(.+)\b\s*!>(?:["'])?;?/;
// Regex for file extension
var fileExtRegex = /\..+$/;
// Read the file a... | javascript | function getSourceCode(filepath) {
// The current folder
var dir = filepath.substring(0, filepath.lastIndexOf("/") + 1);
// Regex for file import
var fileRegex = /(?:["'])<!=\s*(.+)\b\s*!>(?:["'])?;?/;
// Regex for file extension
var fileExtRegex = /\..+$/;
// Read the file a... | [
"function",
"getSourceCode",
"(",
"filepath",
")",
"{",
"// The current folder",
"var",
"dir",
"=",
"filepath",
".",
"substring",
"(",
"0",
",",
"filepath",
".",
"lastIndexOf",
"(",
"\"/\"",
")",
"+",
"1",
")",
";",
"// Regex for file import",
"var",
"fileRege... | Recursively resolve the template | [
"Recursively",
"resolve",
"the",
"template"
] | 59cf9e5e69469984799d6818092de71e3839956c | https://github.com/beschoenen/grunt-contrib-template/blob/59cf9e5e69469984799d6818092de71e3839956c/tasks/template.js#L29-L65 |
57,190 | WarWithinMe/grunt-seajs-build | tasks/seajs_build.js | function ( value, index, array ) {
if ( visited.hasOwnProperty(value) ) { return; }
visited[value] = true;
var deps = projectData.dependency[ value ];
if ( !deps ) { return; }
for ( var i = 0; i < deps.length; ++i ) {
var depAbsPath = projectData.id2File[ deps[i] ];
if (... | javascript | function ( value, index, array ) {
if ( visited.hasOwnProperty(value) ) { return; }
visited[value] = true;
var deps = projectData.dependency[ value ];
if ( !deps ) { return; }
for ( var i = 0; i < deps.length; ++i ) {
var depAbsPath = projectData.id2File[ deps[i] ];
if (... | [
"function",
"(",
"value",
",",
"index",
",",
"array",
")",
"{",
"if",
"(",
"visited",
".",
"hasOwnProperty",
"(",
"value",
")",
")",
"{",
"return",
";",
"}",
"visited",
"[",
"value",
"]",
"=",
"true",
";",
"var",
"deps",
"=",
"projectData",
".",
"d... | Finds out which file can be the entry point. | [
"Finds",
"out",
"which",
"file",
"can",
"be",
"the",
"entry",
"point",
"."
] | ff6ec8bebb0e83d2aaab3c78d4fb3580e4d80b1b | https://github.com/WarWithinMe/grunt-seajs-build/blob/ff6ec8bebb0e83d2aaab3c78d4fb3580e4d80b1b/tasks/seajs_build.js#L504-L521 | |
57,191 | YYago/fswsyn | index.js | writeFileSyncLong | function writeFileSyncLong(filepath, contents) {
const options = arguments[2] || { flag: 'w', encoding: 'utf8' };
let lastPath;
const pathNormal = path.normalize(filepath);
if (path.isAbsolute(pathNormal)) {
lastPath = pathNormal;
} else {
lastPath = path.resolve(pathNormal);
}
... | javascript | function writeFileSyncLong(filepath, contents) {
const options = arguments[2] || { flag: 'w', encoding: 'utf8' };
let lastPath;
const pathNormal = path.normalize(filepath);
if (path.isAbsolute(pathNormal)) {
lastPath = pathNormal;
} else {
lastPath = path.resolve(pathNormal);
}
... | [
"function",
"writeFileSyncLong",
"(",
"filepath",
",",
"contents",
")",
"{",
"const",
"options",
"=",
"arguments",
"[",
"2",
"]",
"||",
"{",
"flag",
":",
"'w'",
",",
"encoding",
":",
"'utf8'",
"}",
";",
"let",
"lastPath",
";",
"const",
"pathNormal",
"=",... | write a file with long path.
@param {*} filepath file path
@param {string} contents content
@param {object} param2 options default:{flag:'w',encoding:'utf8'}
WARRING:
不要在路径中使用单个“\\”符号作为路径分隔符,不管是Windows_NT系统还是Unix系统,它带来的问题目前无解。正则表达式:'/\\\\/g'无法匹配"\\",我也无能为力。
其实,这个问题貌似只出现Windows系统,在Unix系统中写代码的时候输入单个"\\"就已经发生了变化(用于转义)... | [
"write",
"a",
"file",
"with",
"long",
"path",
"."
] | d6fa34b8d079aa28bf9a2a94d82717edfcb8eeba | https://github.com/YYago/fswsyn/blob/d6fa34b8d079aa28bf9a2a94d82717edfcb8eeba/index.js#L213-L240 |
57,192 | wilmoore/function-accessor.js | index.js | isValid | function isValid (value, predicate, self) {
if (predicate instanceof Function) {
return predicate.call(self, value)
}
if (predicate instanceof RegExp) {
return predicate.test(value)
}
return true
} | javascript | function isValid (value, predicate, self) {
if (predicate instanceof Function) {
return predicate.call(self, value)
}
if (predicate instanceof RegExp) {
return predicate.test(value)
}
return true
} | [
"function",
"isValid",
"(",
"value",
",",
"predicate",
",",
"self",
")",
"{",
"if",
"(",
"predicate",
"instanceof",
"Function",
")",
"{",
"return",
"predicate",
".",
"call",
"(",
"self",
",",
"value",
")",
"}",
"if",
"(",
"predicate",
"instanceof",
"RegE... | Validates input per predicate if predicate is a `Function` or `RegExp`.
@param {*} value
Value to check.
@param {Function|RegExp} [predicate]
Predicate to check value against.
@param {Object} [self]
Object context.
@return {Boolean}
Whether value is valid. | [
"Validates",
"input",
"per",
"predicate",
"if",
"predicate",
"is",
"a",
"Function",
"or",
"RegExp",
"."
] | 49b6a8187b856b95a46b1a7703dbcea0cf3588b4 | https://github.com/wilmoore/function-accessor.js/blob/49b6a8187b856b95a46b1a7703dbcea0cf3588b4/index.js#L78-L88 |
57,193 | jimf/hour-convert | index.js | to12Hour | function to12Hour(hour) {
var meridiem = hour < 12 ? 'am' : 'pm';
return {
hour: ((hour + 11) % 12 + 1),
meridiem: meridiem,
meridian: meridiem
};
} | javascript | function to12Hour(hour) {
var meridiem = hour < 12 ? 'am' : 'pm';
return {
hour: ((hour + 11) % 12 + 1),
meridiem: meridiem,
meridian: meridiem
};
} | [
"function",
"to12Hour",
"(",
"hour",
")",
"{",
"var",
"meridiem",
"=",
"hour",
"<",
"12",
"?",
"'am'",
":",
"'pm'",
";",
"return",
"{",
"hour",
":",
"(",
"(",
"hour",
"+",
"11",
")",
"%",
"12",
"+",
"1",
")",
",",
"meridiem",
":",
"meridiem",
"... | Convert 24-hour time to 12-hour format.
@param {number} hour Hour to convert (0-23)
@return {object} { hour, meridiem } (meridian is also returned for backwards compatibility) | [
"Convert",
"24",
"-",
"hour",
"time",
"to",
"12",
"-",
"hour",
"format",
"."
] | f38d9700872cf99ebd6c87bbfeac1984d29d3c32 | https://github.com/jimf/hour-convert/blob/f38d9700872cf99ebd6c87bbfeac1984d29d3c32/index.js#L11-L18 |
57,194 | jimf/hour-convert | index.js | to24Hour | function to24Hour(time) {
var meridiem = time.meridiem || time.meridian;
return (meridiem === 'am' ? 0 : 12) + (time.hour % 12);
} | javascript | function to24Hour(time) {
var meridiem = time.meridiem || time.meridian;
return (meridiem === 'am' ? 0 : 12) + (time.hour % 12);
} | [
"function",
"to24Hour",
"(",
"time",
")",
"{",
"var",
"meridiem",
"=",
"time",
".",
"meridiem",
"||",
"time",
".",
"meridian",
";",
"return",
"(",
"meridiem",
"===",
"'am'",
"?",
"0",
":",
"12",
")",
"+",
"(",
"time",
".",
"hour",
"%",
"12",
")",
... | Convert 12-hour time to 24-hour format.
@param {object} time Time object
@param {number} time.hour Hour to convert (1-12)
@param {string} time.meridiem Hour meridiem (am/pm). 'time.meridian' is
supported for backwards compatibility.
@return {number} | [
"Convert",
"12",
"-",
"hour",
"time",
"to",
"24",
"-",
"hour",
"format",
"."
] | f38d9700872cf99ebd6c87bbfeac1984d29d3c32 | https://github.com/jimf/hour-convert/blob/f38d9700872cf99ebd6c87bbfeac1984d29d3c32/index.js#L29-L32 |
57,195 | greggman/hft-sample-ui | src/hft/scripts/misc/logger.js | function(args) {
var lastArgWasNumber = false;
var numArgs = args.length;
var strs = [];
for (var ii = 0; ii < numArgs; ++ii) {
var arg = args[ii];
if (arg === undefined) {
strs.push('undefined');
} else if (typeof arg === 'number') {
if (lastArgWasNumber) {
s... | javascript | function(args) {
var lastArgWasNumber = false;
var numArgs = args.length;
var strs = [];
for (var ii = 0; ii < numArgs; ++ii) {
var arg = args[ii];
if (arg === undefined) {
strs.push('undefined');
} else if (typeof arg === 'number') {
if (lastArgWasNumber) {
s... | [
"function",
"(",
"args",
")",
"{",
"var",
"lastArgWasNumber",
"=",
"false",
";",
"var",
"numArgs",
"=",
"args",
".",
"length",
";",
"var",
"strs",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"ii",
"=",
"0",
";",
"ii",
"<",
"numArgs",
";",
"++",
"ii",
... | FIX! or move to strings.js | [
"FIX!",
"or",
"move",
"to",
"strings",
".",
"js"
] | b9e20afd5183db73522bcfae48225c87e01f68c0 | https://github.com/greggman/hft-sample-ui/blob/b9e20afd5183db73522bcfae48225c87e01f68c0/src/hft/scripts/misc/logger.js#L81-L108 | |
57,196 | baseprime/grapnel-server | index.js | shouldRun | function shouldRun(verb) {
// Add extra middleware to check if this method matches the requested HTTP verb
return function wareShouldRun(req, res, next) {
var shouldRun = (this.running && (req.method === verb || verb.toLowerCase() === 'all'));
// Call next in stack if it matches
if (shou... | javascript | function shouldRun(verb) {
// Add extra middleware to check if this method matches the requested HTTP verb
return function wareShouldRun(req, res, next) {
var shouldRun = (this.running && (req.method === verb || verb.toLowerCase() === 'all'));
// Call next in stack if it matches
if (shou... | [
"function",
"shouldRun",
"(",
"verb",
")",
"{",
"// Add extra middleware to check if this method matches the requested HTTP verb",
"return",
"function",
"wareShouldRun",
"(",
"req",
",",
"res",
",",
"next",
")",
"{",
"var",
"shouldRun",
"=",
"(",
"this",
".",
"running... | Middleware to check whether or not handler should continue running
@param {String} HTTP Method
@return {Function} Middleware | [
"Middleware",
"to",
"check",
"whether",
"or",
"not",
"handler",
"should",
"continue",
"running"
] | 38b0148700f896c85b8c75713b27bfc5ebdf9bd5 | https://github.com/baseprime/grapnel-server/blob/38b0148700f896c85b8c75713b27bfc5ebdf9bd5/index.js#L119-L126 |
57,197 | Pocketbrain/native-ads-web-ad-library | helpers/xDomainStorageAPI.js | sendReadyMessage | function sendReadyMessage() {
var data = {
namespace: MESSAGE_NAMESPACE,
id: 'iframe-ready'
};
parent.postMessage(JSON.stringify(data), '*');
} | javascript | function sendReadyMessage() {
var data = {
namespace: MESSAGE_NAMESPACE,
id: 'iframe-ready'
};
parent.postMessage(JSON.stringify(data), '*');
} | [
"function",
"sendReadyMessage",
"(",
")",
"{",
"var",
"data",
"=",
"{",
"namespace",
":",
"MESSAGE_NAMESPACE",
",",
"id",
":",
"'iframe-ready'",
"}",
";",
"parent",
".",
"postMessage",
"(",
"JSON",
".",
"stringify",
"(",
"data",
")",
",",
"'*'",
")",
";"... | Send a message to the parent to indicate the page is done loading | [
"Send",
"a",
"message",
"to",
"the",
"parent",
"to",
"indicate",
"the",
"page",
"is",
"done",
"loading"
] | aafee1c42e0569ee77f334fc2c4eb71eb146957e | https://github.com/Pocketbrain/native-ads-web-ad-library/blob/aafee1c42e0569ee77f334fc2c4eb71eb146957e/helpers/xDomainStorageAPI.js#L59-L66 |
57,198 | kirchrath/tpaxx | client/packages/local/tpaxx-core/.sencha/package/Microloader.js | function (asset, result) {
var checksum;
result = Microloader.parseResult(result);
Microloader.remainingCachedAssets--;
if (!result.error) {
checksum = Microloader.checksum(result.content, asset.assetConfig.hash);
i... | javascript | function (asset, result) {
var checksum;
result = Microloader.parseResult(result);
Microloader.remainingCachedAssets--;
if (!result.error) {
checksum = Microloader.checksum(result.content, asset.assetConfig.hash);
i... | [
"function",
"(",
"asset",
",",
"result",
")",
"{",
"var",
"checksum",
";",
"result",
"=",
"Microloader",
".",
"parseResult",
"(",
"result",
")",
";",
"Microloader",
".",
"remainingCachedAssets",
"--",
";",
"if",
"(",
"!",
"result",
".",
"error",
")",
"{"... | Load the asset and seed its content into Boot to be evaluated in sequence | [
"Load",
"the",
"asset",
"and",
"seed",
"its",
"content",
"into",
"Boot",
"to",
"be",
"evaluated",
"in",
"sequence"
] | 3ccc5b77459d093e823d740ddc53feefb12a9344 | https://github.com/kirchrath/tpaxx/blob/3ccc5b77459d093e823d740ddc53feefb12a9344/client/packages/local/tpaxx-core/.sencha/package/Microloader.js#L449-L479 | |
57,199 | kirchrath/tpaxx | client/packages/local/tpaxx-core/.sencha/package/Microloader.js | function (content, delta) {
var output = [],
chunk, i, ln;
if (delta.length === 0) {
return content;
}
for (i = 0,ln = delta.length; i < ln; i++) {
chunk = delta[i];
if (typ... | javascript | function (content, delta) {
var output = [],
chunk, i, ln;
if (delta.length === 0) {
return content;
}
for (i = 0,ln = delta.length; i < ln; i++) {
chunk = delta[i];
if (typ... | [
"function",
"(",
"content",
",",
"delta",
")",
"{",
"var",
"output",
"=",
"[",
"]",
",",
"chunk",
",",
"i",
",",
"ln",
";",
"if",
"(",
"delta",
".",
"length",
"===",
"0",
")",
"{",
"return",
"content",
";",
"}",
"for",
"(",
"i",
"=",
"0",
","... | Delta patches content | [
"Delta",
"patches",
"content"
] | 3ccc5b77459d093e823d740ddc53feefb12a9344 | https://github.com/kirchrath/tpaxx/blob/3ccc5b77459d093e823d740ddc53feefb12a9344/client/packages/local/tpaxx-core/.sencha/package/Microloader.js#L534-L554 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.