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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
53,500 | jonschlinkert/conflicts | lib/diff.js | diffImage | function diffImage(existing, proposed, options) {
let { bytes, dateformat, imageSize, Table, toFile, colors } = utils;
existing = toFile(existing, options);
proposed = toFile(proposed, options);
let table = new Table({ head: ['Attribute', 'Existing', 'Replacement', 'Diff'] });
let dimensionsA = imageSize(ex... | javascript | function diffImage(existing, proposed, options) {
let { bytes, dateformat, imageSize, Table, toFile, colors } = utils;
existing = toFile(existing, options);
proposed = toFile(proposed, options);
let table = new Table({ head: ['Attribute', 'Existing', 'Replacement', 'Diff'] });
let dimensionsA = imageSize(ex... | [
"function",
"diffImage",
"(",
"existing",
",",
"proposed",
",",
"options",
")",
"{",
"let",
"{",
"bytes",
",",
"dateformat",
",",
"imageSize",
",",
"Table",
",",
"toFile",
",",
"colors",
"}",
"=",
"utils",
";",
"existing",
"=",
"toFile",
"(",
"existing",... | Shows table of the differences in stats between two binary files.
@param {String} `filepath` File path of the existing (old) file.
@param {Buffer} `contents` Buffered contents of the proposed (new) file. | [
"Shows",
"table",
"of",
"the",
"differences",
"in",
"stats",
"between",
"two",
"binary",
"files",
"."
] | 0f45ab63f6cc24a03ce381b3d2159283923bc20d | https://github.com/jonschlinkert/conflicts/blob/0f45ab63f6cc24a03ce381b3d2159283923bc20d/lib/diff.js#L114-L167 |
53,501 | moxystudio/react-redata | src/composition/compose.js | defaultShouldReload | function defaultShouldReload(items, params) {
// Go through all and check if any redata shouldReload.
for (const key in items) {
if (items[key].shouldReload(params)) {
return true;
}
}
return false;
} | javascript | function defaultShouldReload(items, params) {
// Go through all and check if any redata shouldReload.
for (const key in items) {
if (items[key].shouldReload(params)) {
return true;
}
}
return false;
} | [
"function",
"defaultShouldReload",
"(",
"items",
",",
"params",
")",
"{",
"// Go through all and check if any redata shouldReload.",
"for",
"(",
"const",
"key",
"in",
"items",
")",
"{",
"if",
"(",
"items",
"[",
"key",
"]",
".",
"shouldReload",
"(",
"params",
")"... | Default shouldReload that goes through each item redata and asks if the reload is necessary. If any says that it is, a redata happens. | [
"Default",
"shouldReload",
"that",
"goes",
"through",
"each",
"item",
"redata",
"and",
"asks",
"if",
"the",
"reload",
"is",
"necessary",
".",
"If",
"any",
"says",
"that",
"it",
"is",
"a",
"redata",
"happens",
"."
] | 19f5c548b8dbc3f71fb14077e9740f9dd62bb10a | https://github.com/moxystudio/react-redata/blob/19f5c548b8dbc3f71fb14077e9740f9dd62bb10a/src/composition/compose.js#L14-L23 |
53,502 | derikb/rpg-table-randomizer | src/random_name.js | function (number, name_type, create) {
const names = { male: [], female: [] };
if (typeof create === 'undefined') { create = false; }
if (typeof number === 'undefined') { number = 10; }
if (typeof name_type === 'undefined' || name_type === '') {
name_type = 'random';
}
for (let i = 1; i <= number; i++... | javascript | function (number, name_type, create) {
const names = { male: [], female: [] };
if (typeof create === 'undefined') { create = false; }
if (typeof number === 'undefined') { number = 10; }
if (typeof name_type === 'undefined' || name_type === '') {
name_type = 'random';
}
for (let i = 1; i <= number; i++... | [
"function",
"(",
"number",
",",
"name_type",
",",
"create",
")",
"{",
"const",
"names",
"=",
"{",
"male",
":",
"[",
"]",
",",
"female",
":",
"[",
"]",
"}",
";",
"if",
"(",
"typeof",
"create",
"===",
"'undefined'",
")",
"{",
"create",
"=",
"false",
... | Generate a bunch of names, half male, half female
@param {Number} [number=10] number of names in the list (half will be male, half will be female)
@param {String} [name_type] type of name or else it will randomly select
@param {Bool} [create=false] new names or just pick from list
@return {Object} arrays of names insid... | [
"Generate",
"a",
"bunch",
"of",
"names",
"half",
"male",
"half",
"female"
] | 988814794b1ee26c24c2a979646e4d13fdd2b7be | https://github.com/derikb/rpg-table-randomizer/blob/988814794b1ee26c24c2a979646e4d13fdd2b7be/src/random_name.js#L23-L40 | |
53,503 | derikb/rpg-table-randomizer | src/random_name.js | function (name_type, gender, style) {
let name = '';
if (typeof name_type === 'undefined' || name_type === '' || name_type === 'random') {
// randomize a type...
name_type = randomizer.rollRandom(Object.keys(namedata.options));
}
if (typeof gender === 'undefined' || gender === 'random') {
// randomi... | javascript | function (name_type, gender, style) {
let name = '';
if (typeof name_type === 'undefined' || name_type === '' || name_type === 'random') {
// randomize a type...
name_type = randomizer.rollRandom(Object.keys(namedata.options));
}
if (typeof gender === 'undefined' || gender === 'random') {
// randomi... | [
"function",
"(",
"name_type",
",",
"gender",
",",
"style",
")",
"{",
"let",
"name",
"=",
"''",
";",
"if",
"(",
"typeof",
"name_type",
"===",
"'undefined'",
"||",
"name_type",
"===",
"''",
"||",
"name_type",
"===",
"'random'",
")",
"{",
"// randomize a type... | Select a name from one of the lists
@param {String} name_type What name list/process to use else random
@param {String} gender male, female, random, ''
@param {String} style first=first name only, else full name
@returns {String} a name | [
"Select",
"a",
"name",
"from",
"one",
"of",
"the",
"lists"
] | 988814794b1ee26c24c2a979646e4d13fdd2b7be | https://github.com/derikb/rpg-table-randomizer/blob/988814794b1ee26c24c2a979646e4d13fdd2b7be/src/random_name.js#L48-L83 | |
53,504 | derikb/rpg-table-randomizer | src/random_name.js | function (name_type, gender, style) {
if (typeof name_type === 'undefined' || name_type === '' || name_type === 'random') {
// randomize a type...
name_type = randomizer.rollRandom(Object.keys(namedata.options));
}
if (typeof style === 'undefined') { style = ''; }
if (!namedata[name_type]) { return ''; }
... | javascript | function (name_type, gender, style) {
if (typeof name_type === 'undefined' || name_type === '' || name_type === 'random') {
// randomize a type...
name_type = randomizer.rollRandom(Object.keys(namedata.options));
}
if (typeof style === 'undefined') { style = ''; }
if (!namedata[name_type]) { return ''; }
... | [
"function",
"(",
"name_type",
",",
"gender",
",",
"style",
")",
"{",
"if",
"(",
"typeof",
"name_type",
"===",
"'undefined'",
"||",
"name_type",
"===",
"''",
"||",
"name_type",
"===",
"'random'",
")",
"{",
"// randomize a type...",
"name_type",
"=",
"randomizer... | Create a name using Markov chains
@param {String} [name_type=random] what list/process to use
@param {String} [gender=random] male or female or both
@param {String} style first=first name only, else full name
@returns {String} a name | [
"Create",
"a",
"name",
"using",
"Markov",
"chains"
] | 988814794b1ee26c24c2a979646e4d13fdd2b7be | https://github.com/derikb/rpg-table-randomizer/blob/988814794b1ee26c24c2a979646e4d13fdd2b7be/src/random_name.js#L120-L165 | |
53,505 | derikb/rpg-table-randomizer | src/random_name.js | function (name) {
const leave_lower = ['of', 'the', 'from', 'de', 'le', 'la'];
// need to find spaces in name and capitalize letter after space
const parts = name.split(' ');
const upper_parts = parts.map((w) => {
return (leave_lower.indexOf(w) >= 0) ? w : `${r_helpers.capitalize(w)}`;
});
return upper_p... | javascript | function (name) {
const leave_lower = ['of', 'the', 'from', 'de', 'le', 'la'];
// need to find spaces in name and capitalize letter after space
const parts = name.split(' ');
const upper_parts = parts.map((w) => {
return (leave_lower.indexOf(w) >= 0) ? w : `${r_helpers.capitalize(w)}`;
});
return upper_p... | [
"function",
"(",
"name",
")",
"{",
"const",
"leave_lower",
"=",
"[",
"'of'",
",",
"'the'",
",",
"'from'",
",",
"'de'",
",",
"'le'",
",",
"'la'",
"]",
";",
"// need to find spaces in name and capitalize letter after space",
"const",
"parts",
"=",
"name",
".",
"... | Capitalize names, account for multiword lastnames like "Van Hausen"
@param {String} name a name
@return {String} name capitalized | [
"Capitalize",
"names",
"account",
"for",
"multiword",
"lastnames",
"like",
"Van",
"Hausen"
] | 988814794b1ee26c24c2a979646e4d13fdd2b7be | https://github.com/derikb/rpg-table-randomizer/blob/988814794b1ee26c24c2a979646e4d13fdd2b7be/src/random_name.js#L171-L179 | |
53,506 | derikb/rpg-table-randomizer | src/random_name.js | function () {
let name = '';
const scount = randomizer.getWeightedRandom(namedata.holmesian_scount.values, namedata.holmesian_scount.weights);
for (let i = 1; i <= scount; i++) {
name += randomizer.rollRandom(namedata.holmesian_syllables); // array
if (i < scount) {
name += randomizer.getWeightedRando... | javascript | function () {
let name = '';
const scount = randomizer.getWeightedRandom(namedata.holmesian_scount.values, namedata.holmesian_scount.weights);
for (let i = 1; i <= scount; i++) {
name += randomizer.rollRandom(namedata.holmesian_syllables); // array
if (i < scount) {
name += randomizer.getWeightedRando... | [
"function",
"(",
")",
"{",
"let",
"name",
"=",
"''",
";",
"const",
"scount",
"=",
"randomizer",
".",
"getWeightedRandom",
"(",
"namedata",
".",
"holmesian_scount",
".",
"values",
",",
"namedata",
".",
"holmesian_scount",
".",
"weights",
")",
";",
"for",
"(... | Generate a Holmes name
@returns {String} name | [
"Generate",
"a",
"Holmes",
"name"
] | 988814794b1ee26c24c2a979646e4d13fdd2b7be | https://github.com/derikb/rpg-table-randomizer/blob/988814794b1ee26c24c2a979646e4d13fdd2b7be/src/random_name.js#L184-L202 | |
53,507 | spacemaus/postvox | vox-common/chain.js | isPromise | function isPromise(v) {
return v && v.isFulfilled && v.then && v.catch && v.value;
} | javascript | function isPromise(v) {
return v && v.isFulfilled && v.then && v.catch && v.value;
} | [
"function",
"isPromise",
"(",
"v",
")",
"{",
"return",
"v",
"&&",
"v",
".",
"isFulfilled",
"&&",
"v",
".",
"then",
"&&",
"v",
".",
"catch",
"&&",
"v",
".",
"value",
";",
"}"
] | instanceof doesn't seem to work across modules. | [
"instanceof",
"doesn",
"t",
"seem",
"to",
"work",
"across",
"modules",
"."
] | de98e5ed37edaee1b1edadf93e15eb8f8d21f457 | https://github.com/spacemaus/postvox/blob/de98e5ed37edaee1b1edadf93e15eb8f8d21f457/vox-common/chain.js#L98-L100 |
53,508 | nodejitsu/npm-documentation-pagelet | npm.js | Help | function Help(filename, path, github, preprocess) {
if (!(this instanceof Help)) return new Help(filename, path, preprocess);
this.html = '';
this.path = path;
this.github = github;
this.filename = filename;
this.preprocess = preprocess;
this.url = filename.slice(0, -3);
this.title = filename.slice(0, ... | javascript | function Help(filename, path, github, preprocess) {
if (!(this instanceof Help)) return new Help(filename, path, preprocess);
this.html = '';
this.path = path;
this.github = github;
this.filename = filename;
this.preprocess = preprocess;
this.url = filename.slice(0, -3);
this.title = filename.slice(0, ... | [
"function",
"Help",
"(",
"filename",
",",
"path",
",",
"github",
",",
"preprocess",
")",
"{",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"Help",
")",
")",
"return",
"new",
"Help",
"(",
"filename",
",",
"path",
",",
"preprocess",
")",
";",
"this",
"."... | Representation of a single HELP document.
@constructor
@param {String} filename The name of the help file.
@param {String} path The absolute location of the file.
@param {Object} github Github user/repo of the help files.
@param {Function} preprocess Optional content pre-processor.
@api public | [
"Representation",
"of",
"a",
"single",
"HELP",
"document",
"."
] | d45006c68cad8f14c63fd86b6be6f8569d5a1a09 | https://github.com/nodejitsu/npm-documentation-pagelet/blob/d45006c68cad8f14c63fd86b6be6f8569d5a1a09/npm.js#L19-L33 |
53,509 | ericmorand/generator-ahead | lib/util/prompt-suggestion.js | function (question, defaultValue) {
// For simplicity we uncheck all boxes and
// use .default to set the active ones.
_.each(question.choices, function (choice) {
if (typeof choice === 'object') {
choice.checked = false;
}
});
return defaultValue;
} | javascript | function (question, defaultValue) {
// For simplicity we uncheck all boxes and
// use .default to set the active ones.
_.each(question.choices, function (choice) {
if (typeof choice === 'object') {
choice.checked = false;
}
});
return defaultValue;
} | [
"function",
"(",
"question",
",",
"defaultValue",
")",
"{",
"// For simplicity we uncheck all boxes and",
"// use .default to set the active ones.",
"_",
".",
"each",
"(",
"question",
".",
"choices",
",",
"function",
"(",
"choice",
")",
"{",
"if",
"(",
"typeof",
"ch... | Returns the default value for a checkbox.
@param {Object} question Inquirer prompt item
@param {*} defaultValue The stored default value
@return {*} Default value to set
@private | [
"Returns",
"the",
"default",
"value",
"for",
"a",
"checkbox",
"."
] | 7d9d67e5996881c2b47333f9ae57db7cd4e3cb42 | https://github.com/ericmorand/generator-ahead/blob/7d9d67e5996881c2b47333f9ae57db7cd4e3cb42/lib/util/prompt-suggestion.js#L19-L29 | |
53,510 | ericmorand/generator-ahead | lib/util/prompt-suggestion.js | function (question, defaultValue) {
var choiceValues = _.map(question.choices, function (choice) {
if (typeof choice === 'object') {
return choice.value;
} else {
return choice;
}
});
return choiceValues.indexOf(defaultValue);
} | javascript | function (question, defaultValue) {
var choiceValues = _.map(question.choices, function (choice) {
if (typeof choice === 'object') {
return choice.value;
} else {
return choice;
}
});
return choiceValues.indexOf(defaultValue);
} | [
"function",
"(",
"question",
",",
"defaultValue",
")",
"{",
"var",
"choiceValues",
"=",
"_",
".",
"map",
"(",
"question",
".",
"choices",
",",
"function",
"(",
"choice",
")",
"{",
"if",
"(",
"typeof",
"choice",
"===",
"'object'",
")",
"{",
"return",
"c... | Returns the default value for a list.
@param {Object} question Inquirer prompt item
@param {*} defaultValue The stored default value
@return {*} Default value to set
@private | [
"Returns",
"the",
"default",
"value",
"for",
"a",
"list",
"."
] | 7d9d67e5996881c2b47333f9ae57db7cd4e3cb42 | https://github.com/ericmorand/generator-ahead/blob/7d9d67e5996881c2b47333f9ae57db7cd4e3cb42/lib/util/prompt-suggestion.js#L39-L49 | |
53,511 | ericmorand/generator-ahead | lib/util/prompt-suggestion.js | function (question, answer) {
var choiceValues = _.map(question.choices, 'value');
var choiceIndex = choiceValues.indexOf(answer);
// Check if answer is not equal to default value
if (question.default !== choiceIndex) {
return true;
}
return false;
} | javascript | function (question, answer) {
var choiceValues = _.map(question.choices, 'value');
var choiceIndex = choiceValues.indexOf(answer);
// Check if answer is not equal to default value
if (question.default !== choiceIndex) {
return true;
}
return false;
} | [
"function",
"(",
"question",
",",
"answer",
")",
"{",
"var",
"choiceValues",
"=",
"_",
".",
"map",
"(",
"question",
".",
"choices",
",",
"'value'",
")",
";",
"var",
"choiceIndex",
"=",
"choiceValues",
".",
"indexOf",
"(",
"answer",
")",
";",
"// Check if... | Return true if the answer should be store in
the global store, otherwise false.
@param {Object} question Inquirer prompt item
@param {String|Array} answer The inquirer answer
@return {Boolean} Answer to be stored
@private | [
"Return",
"true",
"if",
"the",
"answer",
"should",
"be",
"store",
"in",
"the",
"global",
"store",
"otherwise",
"false",
"."
] | 7d9d67e5996881c2b47333f9ae57db7cd4e3cb42 | https://github.com/ericmorand/generator-ahead/blob/7d9d67e5996881c2b47333f9ae57db7cd4e3cb42/lib/util/prompt-suggestion.js#L60-L70 | |
53,512 | aledbf/deis-api | lib/ps.js | scale | function scale(appName, configuration, callback) {
if (!isObject(configuration)) {
return callback(new Error('To scale pass an object with the type as key'));
}
var url = format('/%s/apps/%s/scale/', deis.version, appName);
commons.post(url, configuration, 204, callback);
} | javascript | function scale(appName, configuration, callback) {
if (!isObject(configuration)) {
return callback(new Error('To scale pass an object with the type as key'));
}
var url = format('/%s/apps/%s/scale/', deis.version, appName);
commons.post(url, configuration, 204, callback);
} | [
"function",
"scale",
"(",
"appName",
",",
"configuration",
",",
"callback",
")",
"{",
"if",
"(",
"!",
"isObject",
"(",
"configuration",
")",
")",
"{",
"return",
"callback",
"(",
"new",
"Error",
"(",
"'To scale pass an object with the type as key'",
")",
")",
"... | scale an application | [
"scale",
"an",
"application"
] | f0833789998032b11221a3a617bb566ade1fcc13 | https://github.com/aledbf/deis-api/blob/f0833789998032b11221a3a617bb566ade1fcc13/lib/ps.js#L11-L18 |
53,513 | aledbf/deis-api | lib/ps.js | byType | function byType(appName, type, callback) {
var url = format('/%s/apps/%s/containers/%s/', deis.version, appName, type);
commons.get(url, callback);
} | javascript | function byType(appName, type, callback) {
var url = format('/%s/apps/%s/containers/%s/', deis.version, appName, type);
commons.get(url, callback);
} | [
"function",
"byType",
"(",
"appName",
",",
"type",
",",
"callback",
")",
"{",
"var",
"url",
"=",
"format",
"(",
"'/%s/apps/%s/containers/%s/'",
",",
"deis",
".",
"version",
",",
"appName",
",",
"type",
")",
";",
"commons",
".",
"get",
"(",
"url",
",",
... | list application containers and their status | [
"list",
"application",
"containers",
"and",
"their",
"status"
] | f0833789998032b11221a3a617bb566ade1fcc13 | https://github.com/aledbf/deis-api/blob/f0833789998032b11221a3a617bb566ade1fcc13/lib/ps.js#L30-L33 |
53,514 | lesx/lesx-jsx | lib/babel-core/src/config/index.js | loadConfig | function loadConfig(opts) {
if (opts != null && (typeof opts === "undefined" ? "undefined" : (0, _typeof3.default)(opts)) !== "object") {
throw new Error("Babel options must be an object, null, or undefined");
}
return (0, _optionManager2.default)(opts || {});
} | javascript | function loadConfig(opts) {
if (opts != null && (typeof opts === "undefined" ? "undefined" : (0, _typeof3.default)(opts)) !== "object") {
throw new Error("Babel options must be an object, null, or undefined");
}
return (0, _optionManager2.default)(opts || {});
} | [
"function",
"loadConfig",
"(",
"opts",
")",
"{",
"if",
"(",
"opts",
"!=",
"null",
"&&",
"(",
"typeof",
"opts",
"===",
"\"undefined\"",
"?",
"\"undefined\"",
":",
"(",
"0",
",",
"_typeof3",
".",
"default",
")",
"(",
"opts",
")",
")",
"!==",
"\"object\""... | Standard API for loading Babel configuration data. Not for public consumption. | [
"Standard",
"API",
"for",
"loading",
"Babel",
"configuration",
"data",
".",
"Not",
"for",
"public",
"consumption",
"."
] | 6b82f5ee115add3fb61b83c8e22e83fad66ad437 | https://github.com/lesx/lesx-jsx/blob/6b82f5ee115add3fb61b83c8e22e83fad66ad437/lib/babel-core/src/config/index.js#L24-L30 |
53,515 | davidfig/dom-ease | docs/code.js | createVelocity | function createVelocity()
{
const duration = 2000
const easing = 'easeInOutSine'
Velocity(box('scaleX'), { scaleX: 2 }, { duration, easing, loop: true })
Velocity(box('scaleY'), { scaleY: 2 }, { duration, easing, loop: true })
Velocity(box('top/left'), { left: window.innerWidth / 2, top: windo... | javascript | function createVelocity()
{
const duration = 2000
const easing = 'easeInOutSine'
Velocity(box('scaleX'), { scaleX: 2 }, { duration, easing, loop: true })
Velocity(box('scaleY'), { scaleY: 2 }, { duration, easing, loop: true })
Velocity(box('top/left'), { left: window.innerWidth / 2, top: windo... | [
"function",
"createVelocity",
"(",
")",
"{",
"const",
"duration",
"=",
"2000",
"const",
"easing",
"=",
"'easeInOutSine'",
"Velocity",
"(",
"box",
"(",
"'scaleX'",
")",
",",
"{",
"scaleX",
":",
"2",
"}",
",",
"{",
"duration",
",",
"easing",
",",
"loop",
... | compare speed with velocity-animate | [
"compare",
"speed",
"with",
"velocity",
"-",
"animate"
] | 4abc692d968593dd41546bb4d2fc7d9d861e8007 | https://github.com/davidfig/dom-ease/blob/4abc692d968593dd41546bb4d2fc7d9d861e8007/docs/code.js#L49-L62 |
53,516 | thlorenz/node-traceur | src/node/inline-module.js | wrapProgram | function wrapProgram(tree, url, commonPath) {
var name = generateNameForUrl(url, commonPath);
return new Program(null,
[new ModuleDefinition(null,
createIdentifierToken(name), tree.programElements)]);
} | javascript | function wrapProgram(tree, url, commonPath) {
var name = generateNameForUrl(url, commonPath);
return new Program(null,
[new ModuleDefinition(null,
createIdentifierToken(name), tree.programElements)]);
} | [
"function",
"wrapProgram",
"(",
"tree",
",",
"url",
",",
"commonPath",
")",
"{",
"var",
"name",
"=",
"generateNameForUrl",
"(",
"url",
",",
"commonPath",
")",
";",
"return",
"new",
"Program",
"(",
"null",
",",
"[",
"new",
"ModuleDefinition",
"(",
"null",
... | Wraps a program in a module definition.
@param {ProgramTree} tree The original program tree.
@param {string} url The relative URL of the module that the program
represents.
@param {string} commonPath The base path of all the files. This is passed
along to |generateNameForUrl|.
@return {[ProgramTree} A new program tre... | [
"Wraps",
"a",
"program",
"in",
"a",
"module",
"definition",
"."
] | 79a21ad03831ba36df504988b05022404ad8f9c3 | https://github.com/thlorenz/node-traceur/blob/79a21ad03831ba36df504988b05022404ad8f9c3/src/node/inline-module.js#L51-L56 |
53,517 | thlorenz/node-traceur | src/node/inline-module.js | inlineAndCompile | function inlineAndCompile(filenames, options, reporter, callback, errback) {
// The caller needs to do a chdir.
var basePath = './';
var depTarget = options && options.depTarget;
var loadCount = 0;
var elements = [];
var project = new Project(basePath);
var loader = new InlineCodeLoader(reporter, projec... | javascript | function inlineAndCompile(filenames, options, reporter, callback, errback) {
// The caller needs to do a chdir.
var basePath = './';
var depTarget = options && options.depTarget;
var loadCount = 0;
var elements = [];
var project = new Project(basePath);
var loader = new InlineCodeLoader(reporter, projec... | [
"function",
"inlineAndCompile",
"(",
"filenames",
",",
"options",
",",
"reporter",
",",
"callback",
",",
"errback",
")",
"{",
"// The caller needs to do a chdir.",
"var",
"basePath",
"=",
"'./'",
";",
"var",
"depTarget",
"=",
"options",
"&&",
"options",
".",
"de... | Compiles the files in "filenames" along with any associated modules, into a
single js file, in proper module dependency order.
@param {Array.<string>} filenames The list of files to compile and concat.
@param {Object} options A container for misc options. 'depTarget' is the
only currently available option, which resul... | [
"Compiles",
"the",
"files",
"in",
"filenames",
"along",
"with",
"any",
"associated",
"modules",
"into",
"a",
"single",
"js",
"file",
"in",
"proper",
"module",
"dependency",
"order",
"."
] | 79a21ad03831ba36df504988b05022404ad8f9c3 | https://github.com/thlorenz/node-traceur/blob/79a21ad03831ba36df504988b05022404ad8f9c3/src/node/inline-module.js#L181-L213 |
53,518 | SolarNetwork/solarnetwork-d3 | solarnetwork-d3.js | sn_util_copyAll | function sn_util_copyAll(obj1, obj2) {
var keys = Object.getOwnPropertyNames(obj1), i, len, key, desc;
if (obj2 === undefined) {
obj2 = {};
}
for (i = 0, len = keys.length; i < len; i += 1) {
key = keys[i];
desc = Object.getOwnPropertyDescriptor(obj1, key);
if (desc) {
Ob... | javascript | function sn_util_copyAll(obj1, obj2) {
var keys = Object.getOwnPropertyNames(obj1), i, len, key, desc;
if (obj2 === undefined) {
obj2 = {};
}
for (i = 0, len = keys.length; i < len; i += 1) {
key = keys[i];
desc = Object.getOwnPropertyDescriptor(obj1, key);
if (desc) {
Ob... | [
"function",
"sn_util_copyAll",
"(",
"obj1",
",",
"obj2",
")",
"{",
"var",
"keys",
"=",
"Object",
".",
"getOwnPropertyNames",
"(",
"obj1",
")",
",",
"i",
",",
"len",
",",
"key",
",",
"desc",
";",
"if",
"(",
"obj2",
"===",
"undefined",
")",
"{",
"obj2"... | Copy the enumerable and non-enumerable own properties of `obj` onto `obj2` and return `obj2`.
@param {Object} obj1 - The object to copy enumerable properties from.
@param {Object} [obj2] - The optional object to copy the properties to. If not
provided a new object will be created.
@returns {Object} The object whose pr... | [
"Copy",
"the",
"enumerable",
"and",
"non",
"-",
"enumerable",
"own",
"properties",
"of",
"obj",
"onto",
"obj2",
"and",
"return",
"obj2",
"."
] | 26848b1c303b98b7c0ddeefb8c68c5f5bf78927e | https://github.com/SolarNetwork/solarnetwork-d3/blob/26848b1c303b98b7c0ddeefb8c68c5f5bf78927e/solarnetwork-d3.js#L86-L101 |
53,519 | SolarNetwork/solarnetwork-d3 | solarnetwork-d3.js | sn_util_merge | function sn_util_merge(obj1, obj2) {
var prop, desc;
if (obj2 === undefined) {
obj2 = {};
}
for (prop in obj1) {
if (obj1.hasOwnProperty(prop) && obj2[prop] === undefined) {
desc = Object.getOwnPropertyDescriptor(obj1, prop);
if (desc) {
Object.defineProperty(obj2, ... | javascript | function sn_util_merge(obj1, obj2) {
var prop, desc;
if (obj2 === undefined) {
obj2 = {};
}
for (prop in obj1) {
if (obj1.hasOwnProperty(prop) && obj2[prop] === undefined) {
desc = Object.getOwnPropertyDescriptor(obj1, prop);
if (desc) {
Object.defineProperty(obj2, ... | [
"function",
"sn_util_merge",
"(",
"obj1",
",",
"obj2",
")",
"{",
"var",
"prop",
",",
"desc",
";",
"if",
"(",
"obj2",
"===",
"undefined",
")",
"{",
"obj2",
"=",
"{",
"}",
";",
"}",
"for",
"(",
"prop",
"in",
"obj1",
")",
"{",
"if",
"(",
"obj1",
"... | Copy the enumerable own properties of `obj1` that don't already exist on `obj2` into `obj2` and return `obj2`.
@param {Object} obj1 - The object to copy enumerable properties from.
@param {Object} [obj2] - The optional object to copy the properties to. If not
provided a new object will be created.
@returns {Object} Th... | [
"Copy",
"the",
"enumerable",
"own",
"properties",
"of",
"obj1",
"that",
"don",
"t",
"already",
"exist",
"on",
"obj2",
"into",
"obj2",
"and",
"return",
"obj2",
"."
] | 26848b1c303b98b7c0ddeefb8c68c5f5bf78927e | https://github.com/SolarNetwork/solarnetwork-d3/blob/26848b1c303b98b7c0ddeefb8c68c5f5bf78927e/solarnetwork-d3.js#L112-L128 |
53,520 | SolarNetwork/solarnetwork-d3 | solarnetwork-d3.js | sn_util_arraysAreEqual | function sn_util_arraysAreEqual(a1, a2) {
var i, len;
if (!(Array.isArray(a1) && Array.isArray(a2))) {
return false;
}
if (a1.length !== a2.length) {
return false;
}
for (i = 0, len = a1.length; i < len; i += 1) {
if (Array.isArray(a1[i]) && Array.isArray(a2[i]) && arraysAreEqu... | javascript | function sn_util_arraysAreEqual(a1, a2) {
var i, len;
if (!(Array.isArray(a1) && Array.isArray(a2))) {
return false;
}
if (a1.length !== a2.length) {
return false;
}
for (i = 0, len = a1.length; i < len; i += 1) {
if (Array.isArray(a1[i]) && Array.isArray(a2[i]) && arraysAreEqu... | [
"function",
"sn_util_arraysAreEqual",
"(",
"a1",
",",
"a2",
")",
"{",
"var",
"i",
",",
"len",
";",
"if",
"(",
"!",
"(",
"Array",
".",
"isArray",
"(",
"a1",
")",
"&&",
"Array",
".",
"isArray",
"(",
"a2",
")",
")",
")",
"{",
"return",
"false",
";",... | Compare two arrays for equality, that is they have the same length and same values
using strict quality.
@param {Array} a1 The first array to compare.
@param {Array} a2 The second array to compare.
@return {Boolean} True if the arrays are equal.
@since 0.2.0
@preserve | [
"Compare",
"two",
"arrays",
"for",
"equality",
"that",
"is",
"they",
"have",
"the",
"same",
"length",
"and",
"same",
"values",
"using",
"strict",
"quality",
"."
] | 26848b1c303b98b7c0ddeefb8c68c5f5bf78927e | https://github.com/SolarNetwork/solarnetwork-d3/blob/26848b1c303b98b7c0ddeefb8c68c5f5bf78927e/solarnetwork-d3.js#L139-L155 |
53,521 | SolarNetwork/solarnetwork-d3 | solarnetwork-d3.js | sn_util_superMethod | function sn_util_superMethod(name) {
var that = this, method = that[name];
return function() {
return method.apply(that, arguments);
};
} | javascript | function sn_util_superMethod(name) {
var that = this, method = that[name];
return function() {
return method.apply(that, arguments);
};
} | [
"function",
"sn_util_superMethod",
"(",
"name",
")",
"{",
"var",
"that",
"=",
"this",
",",
"method",
"=",
"that",
"[",
"name",
"]",
";",
"return",
"function",
"(",
")",
"{",
"return",
"method",
".",
"apply",
"(",
"that",
",",
"arguments",
")",
";",
"... | Get a proxy method for a "super" class' method on the `this` objct.
@param {String} name - The name of the method to get a proxy for.
@returns {Function} A function that calls the `name` function of the `this` object.
@since 0.0.4
@preserve | [
"Get",
"a",
"proxy",
"method",
"for",
"a",
"super",
"class",
"method",
"on",
"the",
"this",
"objct",
"."
] | 26848b1c303b98b7c0ddeefb8c68c5f5bf78927e | https://github.com/SolarNetwork/solarnetwork-d3/blob/26848b1c303b98b7c0ddeefb8c68c5f5bf78927e/solarnetwork-d3.js#L164-L169 |
53,522 | SolarNetwork/solarnetwork-d3 | solarnetwork-d3.js | sn_api_user_queueInstructionURL | function sn_api_user_queueInstructionURL(topic, parameters) {
var url = sn_api_user_baseURL(this) + "/instr/add?nodeId=" + this.nodeId + "&topic=" + encodeURIComponent(topic);
if (Array.isArray(parameters)) {
var i, len;
for (i = 0, len = parameters.length; i < len; i++) {
url += "&" + encod... | javascript | function sn_api_user_queueInstructionURL(topic, parameters) {
var url = sn_api_user_baseURL(this) + "/instr/add?nodeId=" + this.nodeId + "&topic=" + encodeURIComponent(topic);
if (Array.isArray(parameters)) {
var i, len;
for (i = 0, len = parameters.length; i < len; i++) {
url += "&" + encod... | [
"function",
"sn_api_user_queueInstructionURL",
"(",
"topic",
",",
"parameters",
")",
"{",
"var",
"url",
"=",
"sn_api_user_baseURL",
"(",
"this",
")",
"+",
"\"/instr/add?nodeId=\"",
"+",
"this",
".",
"nodeId",
"+",
"\"&topic=\"",
"+",
"encodeURIComponent",
"(",
"to... | Generate a URL for posting an instruction request.
@param {String} topic - The instruction topic.
@param {Array} parameters - An array of parameter objects in the form <code>{name:n1, value:v1}</code>.
@preserve | [
"Generate",
"a",
"URL",
"for",
"posting",
"an",
"instruction",
"request",
"."
] | 26848b1c303b98b7c0ddeefb8c68c5f5bf78927e | https://github.com/SolarNetwork/solarnetwork-d3/blob/26848b1c303b98b7c0ddeefb8c68c5f5bf78927e/solarnetwork-d3.js#L458-L467 |
53,523 | SolarNetwork/solarnetwork-d3 | solarnetwork-d3.js | function(key, enabled) {
var val = enabled;
if (key === undefined) {
return this;
}
if (val === undefined) {
val = this.map[key] === undefined;
}
return this.value(key, val === true ? true : null);
} | javascript | function(key, enabled) {
var val = enabled;
if (key === undefined) {
return this;
}
if (val === undefined) {
val = this.map[key] === undefined;
}
return this.value(key, val === true ? true : null);
} | [
"function",
"(",
"key",
",",
"enabled",
")",
"{",
"var",
"val",
"=",
"enabled",
";",
"if",
"(",
"key",
"===",
"undefined",
")",
"{",
"return",
"this",
";",
"}",
"if",
"(",
"val",
"===",
"undefined",
")",
"{",
"val",
"=",
"this",
".",
"map",
"[",
... | Set or toggle the enabled status of a given key.
<p>If the <em>enabled</em> parameter is not passed, then the enabled
status will be toggled to its opposite value.</p>
@param {String} key they key to set
@param {Boolean} enabled the optional enabled value to set
@returns {sn.Configuration} this object to allow method... | [
"Set",
"or",
"toggle",
"the",
"enabled",
"status",
"of",
"a",
"given",
"key",
"."
] | 26848b1c303b98b7c0ddeefb8c68c5f5bf78927e | https://github.com/SolarNetwork/solarnetwork-d3/blob/26848b1c303b98b7c0ddeefb8c68c5f5bf78927e/solarnetwork-d3.js#L1765-L1774 | |
53,524 | SolarNetwork/solarnetwork-d3 | solarnetwork-d3.js | function(key, newValue) {
var me = this;
if (arguments.length === 1) {
return this.map[key];
}
if (newValue === null) {
delete this.map[key];
if (this.hasOwnProperty(key)) {
delete this[key];
}
} else {
this.map[key] = newValue;
if ... | javascript | function(key, newValue) {
var me = this;
if (arguments.length === 1) {
return this.map[key];
}
if (newValue === null) {
delete this.map[key];
if (this.hasOwnProperty(key)) {
delete this[key];
}
} else {
this.map[key] = newValue;
if ... | [
"function",
"(",
"key",
",",
"newValue",
")",
"{",
"var",
"me",
"=",
"this",
";",
"if",
"(",
"arguments",
".",
"length",
"===",
"1",
")",
"{",
"return",
"this",
".",
"map",
"[",
"key",
"]",
";",
"}",
"if",
"(",
"newValue",
"===",
"null",
")",
"... | Get or set a configuration value.
@param {String} key The key to get or set the value for
@param [newValue] If defined, the new value to set for the given {@code key}.
If {@code null} then the value will be removed.
@returns If called as a getter, the associated value for the given {@code key},
otherwise this object.
... | [
"Get",
"or",
"set",
"a",
"configuration",
"value",
"."
] | 26848b1c303b98b7c0ddeefb8c68c5f5bf78927e | https://github.com/SolarNetwork/solarnetwork-d3/blob/26848b1c303b98b7c0ddeefb8c68c5f5bf78927e/solarnetwork-d3.js#L1785-L1811 | |
53,525 | SolarNetwork/solarnetwork-d3 | solarnetwork-d3.js | sn_net_encodeURLQueryTerms | function sn_net_encodeURLQueryTerms(parameters) {
var result = "", prop, val, i, len;
function handleValue(k, v) {
if (result.length) {
result += "&";
}
result += encodeURIComponent(k) + "=" + encodeURIComponent(v);
}
if (parameters) {
for (prop in parameters) {
i... | javascript | function sn_net_encodeURLQueryTerms(parameters) {
var result = "", prop, val, i, len;
function handleValue(k, v) {
if (result.length) {
result += "&";
}
result += encodeURIComponent(k) + "=" + encodeURIComponent(v);
}
if (parameters) {
for (prop in parameters) {
i... | [
"function",
"sn_net_encodeURLQueryTerms",
"(",
"parameters",
")",
"{",
"var",
"result",
"=",
"\"\"",
",",
"prop",
",",
"val",
",",
"i",
",",
"len",
";",
"function",
"handleValue",
"(",
"k",
",",
"v",
")",
"{",
"if",
"(",
"result",
".",
"length",
")",
... | Encode the properties of an object as a URL query string.
<p>If an object property has an array value, multiple URL parameters will be encoded for that property.</p>
@param {Object} an object to encode as URL parameters
@return {String} the encoded query parameters
@preserve | [
"Encode",
"the",
"properties",
"of",
"an",
"object",
"as",
"a",
"URL",
"query",
"string",
"."
] | 26848b1c303b98b7c0ddeefb8c68c5f5bf78927e | https://github.com/SolarNetwork/solarnetwork-d3/blob/26848b1c303b98b7c0ddeefb8c68c5f5bf78927e/solarnetwork-d3.js#L6232-L6255 |
53,526 | SolarNetwork/solarnetwork-d3 | solarnetwork-d3.js | generateCanonicalRequestMessage | function generateCanonicalRequestMessage(params) {
var msg = (params.method === undefined ? "GET" : params.method.toUpperCase()) + "\n" + params.uri.path + "\n" + (params.queryParams ? params.queryParams : "") + "\n";
params.headers.headerNames.forEach(function(name) {
msg += name + ":" + params.hea... | javascript | function generateCanonicalRequestMessage(params) {
var msg = (params.method === undefined ? "GET" : params.method.toUpperCase()) + "\n" + params.uri.path + "\n" + (params.queryParams ? params.queryParams : "") + "\n";
params.headers.headerNames.forEach(function(name) {
msg += name + ":" + params.hea... | [
"function",
"generateCanonicalRequestMessage",
"(",
"params",
")",
"{",
"var",
"msg",
"=",
"(",
"params",
".",
"method",
"===",
"undefined",
"?",
"\"GET\"",
":",
"params",
".",
"method",
".",
"toUpperCase",
"(",
")",
")",
"+",
"\"\\n\"",
"+",
"params",
"."... | Generate the canonical request message for a set of request parameters.
@param {Object} params the request parameters
@param {String} params.method the HTTP request method
@param {Object} params.uri a parsed URI object for the request
@param {String} params.queryParams the canonical query parameters string
@param {Obj... | [
"Generate",
"the",
"canonical",
"request",
"message",
"for",
"a",
"set",
"of",
"request",
"parameters",
"."
] | 26848b1c303b98b7c0ddeefb8c68c5f5bf78927e | https://github.com/SolarNetwork/solarnetwork-d3/blob/26848b1c303b98b7c0ddeefb8c68c5f5bf78927e/solarnetwork-d3.js#L6381-L6389 |
53,527 | SolarNetwork/solarnetwork-d3 | solarnetwork-d3.js | function(location) {
return Math.sqrt(Math.pow(location.x - this.matrix[4], 2), Math.pow(location.y - this.matrix[5], 2));
} | javascript | function(location) {
return Math.sqrt(Math.pow(location.x - this.matrix[4], 2), Math.pow(location.y - this.matrix[5], 2));
} | [
"function",
"(",
"location",
")",
"{",
"return",
"Math",
".",
"sqrt",
"(",
"Math",
".",
"pow",
"(",
"location",
".",
"x",
"-",
"this",
".",
"matrix",
"[",
"4",
"]",
",",
"2",
")",
",",
"Math",
".",
"pow",
"(",
"location",
".",
"y",
"-",
"this",... | Get the 2D distance between a location and this matrix's translation.
@param location a location object, with x,y Number properties
@returns {Number} the calculated distance
@preserve | [
"Get",
"the",
"2D",
"distance",
"between",
"a",
"location",
"and",
"this",
"matrix",
"s",
"translation",
"."
] | 26848b1c303b98b7c0ddeefb8c68c5f5bf78927e | https://github.com/SolarNetwork/solarnetwork-d3/blob/26848b1c303b98b7c0ddeefb8c68c5f5bf78927e/solarnetwork-d3.js#L6911-L6913 | |
53,528 | SolarNetwork/solarnetwork-d3 | solarnetwork-d3.js | function(elm) {
var m = this.support.use3d === true ? this.toMatrix3D() : this.toMatrix2D();
elm.style[this.support.tProp] = m;
} | javascript | function(elm) {
var m = this.support.use3d === true ? this.toMatrix3D() : this.toMatrix2D();
elm.style[this.support.tProp] = m;
} | [
"function",
"(",
"elm",
")",
"{",
"var",
"m",
"=",
"this",
".",
"support",
".",
"use3d",
"===",
"true",
"?",
"this",
".",
"toMatrix3D",
"(",
")",
":",
"this",
".",
"toMatrix2D",
"(",
")",
";",
"elm",
".",
"style",
"[",
"this",
".",
"support",
"."... | Apply the matrix transform to an element.
<p>If {@code support.use3d} is <em>true</em>, the {@link #toMatrix3D()} transform
is used, otherwise {@link #toMatrix2D()} is used. Found that legibility of
text was too blurry on older displays when 3D transform was applied,
but 3D transform provide better performance on hi-r... | [
"Apply",
"the",
"matrix",
"transform",
"to",
"an",
"element",
"."
] | 26848b1c303b98b7c0ddeefb8c68c5f5bf78927e | https://github.com/SolarNetwork/solarnetwork-d3/blob/26848b1c303b98b7c0ddeefb8c68c5f5bf78927e/solarnetwork-d3.js#L6925-L6928 | |
53,529 | SolarNetwork/solarnetwork-d3 | solarnetwork-d3.js | function(elm, finished) {
var listener = undefined;
var self = this;
listener = function(event) {
if (event.target === elm) {
elm.removeEventListener(self.support.trEndEvent, listener, false);
finished.apply(elm);
}
};
elm.addEventListener(self.support.t... | javascript | function(elm, finished) {
var listener = undefined;
var self = this;
listener = function(event) {
if (event.target === elm) {
elm.removeEventListener(self.support.trEndEvent, listener, false);
finished.apply(elm);
}
};
elm.addEventListener(self.support.t... | [
"function",
"(",
"elm",
",",
"finished",
")",
"{",
"var",
"listener",
"=",
"undefined",
";",
"var",
"self",
"=",
"this",
";",
"listener",
"=",
"function",
"(",
"event",
")",
"{",
"if",
"(",
"event",
".",
"target",
"===",
"elm",
")",
"{",
"elm",
"."... | Apply a one-time animation callback listener.
@param elm the element to add the one-time listener to
@param finished
@preserve | [
"Apply",
"a",
"one",
"-",
"time",
"animation",
"callback",
"listener",
"."
] | 26848b1c303b98b7c0ddeefb8c68c5f5bf78927e | https://github.com/SolarNetwork/solarnetwork-d3/blob/26848b1c303b98b7c0ddeefb8c68c5f5bf78927e/solarnetwork-d3.js#L6936-L6946 | |
53,530 | SolarNetwork/solarnetwork-d3 | solarnetwork-d3.js | function(elm, timing, duration, finished) {
var self = this;
this.animateListen(elm, function() {
elm.style[self.support.trProp] = "";
if (finished !== undefined) {
finished.apply(elm);
}
});
var cssValue = this.support.trTransform + " " + (duration !== undefine... | javascript | function(elm, timing, duration, finished) {
var self = this;
this.animateListen(elm, function() {
elm.style[self.support.trProp] = "";
if (finished !== undefined) {
finished.apply(elm);
}
});
var cssValue = this.support.trTransform + " " + (duration !== undefine... | [
"function",
"(",
"elm",
",",
"timing",
",",
"duration",
",",
"finished",
")",
"{",
"var",
"self",
"=",
"this",
";",
"this",
".",
"animateListen",
"(",
"elm",
",",
"function",
"(",
")",
"{",
"elm",
".",
"style",
"[",
"self",
".",
"support",
".",
"tr... | Apply the matrix transform to an element, with an "ease out" transition.
<p>Calls {@link #apply(elm)} internally.</p>
@param {Element} elm the element to apply the transform to
@param {String} timing the CSS timing function to use
@param {String} duration the CSS duration to use
@param {Function} finished an optional... | [
"Apply",
"the",
"matrix",
"transform",
"to",
"an",
"element",
"with",
"an",
"ease",
"out",
"transition",
"."
] | 26848b1c303b98b7c0ddeefb8c68c5f5bf78927e | https://github.com/SolarNetwork/solarnetwork-d3/blob/26848b1c303b98b7c0ddeefb8c68c5f5bf78927e/solarnetwork-d3.js#L6959-L6970 | |
53,531 | gyandeeps/load-perf | lib/index.js | check | function check(suppliedOptions){
var options = assign(Object.create(defaultOptions), suppliedOptions || {});
var packageJson = require(path.resolve(process.cwd(), options.package));
var checkDevDependencies = !!options.checkDevDependencies;
var checkDependencies = !!options.checkDependencies;
var mo... | javascript | function check(suppliedOptions){
var options = assign(Object.create(defaultOptions), suppliedOptions || {});
var packageJson = require(path.resolve(process.cwd(), options.package));
var checkDevDependencies = !!options.checkDevDependencies;
var checkDependencies = !!options.checkDependencies;
var mo... | [
"function",
"check",
"(",
"suppliedOptions",
")",
"{",
"var",
"options",
"=",
"assign",
"(",
"Object",
".",
"create",
"(",
"defaultOptions",
")",
",",
"suppliedOptions",
"||",
"{",
"}",
")",
";",
"var",
"packageJson",
"=",
"require",
"(",
"path",
".",
"r... | Main function which calculates the times for each modules
@param {object} suppliedOptions - Options to be passed in.
@return {{moduleTimes: {dependencies: {}, devDependencies: {}}, loadTime: int}} | [
"Main",
"function",
"which",
"calculates",
"the",
"times",
"for",
"each",
"modules"
] | 045eb27e79699db621f57175db7e62e3857c10c0 | https://github.com/gyandeeps/load-perf/blob/045eb27e79699db621f57175db7e62e3857c10c0/lib/index.js#L24-L65 |
53,532 | purtuga/observables | src/objectWatchProp.js | setCallbackAsWatcherOf | function setCallbackAsWatcherOf(callback, watchersSet) {
if (!callback[WATCHER_IDENTIFIER]) {
defineProperty(callback, WATCHER_IDENTIFIER, { watching: new Set() });
defineProperty(callback, "stopWatchingAll", function(){
callback[WATCHER_IDENTIFIER].watching.forEach(watcherList =>
... | javascript | function setCallbackAsWatcherOf(callback, watchersSet) {
if (!callback[WATCHER_IDENTIFIER]) {
defineProperty(callback, WATCHER_IDENTIFIER, { watching: new Set() });
defineProperty(callback, "stopWatchingAll", function(){
callback[WATCHER_IDENTIFIER].watching.forEach(watcherList =>
... | [
"function",
"setCallbackAsWatcherOf",
"(",
"callback",
",",
"watchersSet",
")",
"{",
"if",
"(",
"!",
"callback",
"[",
"WATCHER_IDENTIFIER",
"]",
")",
"{",
"defineProperty",
"(",
"callback",
",",
"WATCHER_IDENTIFIER",
",",
"{",
"watching",
":",
"new",
"Set",
"(... | Store a reference to the Set instance provided on input, on the callback.
@private
@param {Function} callback
@param {Set} watchersSet | [
"Store",
"a",
"reference",
"to",
"the",
"Set",
"instance",
"provided",
"on",
"input",
"on",
"the",
"callback",
"."
] | 68847b1294734c4cd50b26e5f6156a8b460f77a2 | https://github.com/purtuga/observables/blob/68847b1294734c4cd50b26e5f6156a8b460f77a2/src/objectWatchProp.js#L428-L441 |
53,533 | bobmonteverde/d3-simple-tooltip | src/tooltip.js | offsetTop | function offsetTop (elem) {
let top = 0
do {
if (!isNaN(elem.offsetTop)) top += elem.offsetTop
} while (elem = elem.offsetParent)
return top
} | javascript | function offsetTop (elem) {
let top = 0
do {
if (!isNaN(elem.offsetTop)) top += elem.offsetTop
} while (elem = elem.offsetParent)
return top
} | [
"function",
"offsetTop",
"(",
"elem",
")",
"{",
"let",
"top",
"=",
"0",
"do",
"{",
"if",
"(",
"!",
"isNaN",
"(",
"elem",
".",
"offsetTop",
")",
")",
"top",
"+=",
"elem",
".",
"offsetTop",
"}",
"while",
"(",
"elem",
"=",
"elem",
".",
"offsetParent",... | Recursively calculate top offset of an element from the body | [
"Recursively",
"calculate",
"top",
"offset",
"of",
"an",
"element",
"from",
"the",
"body"
] | 19994f5bc61cea303b7a855d1aebfccd3220abf6 | https://github.com/bobmonteverde/d3-simple-tooltip/blob/19994f5bc61cea303b7a855d1aebfccd3220abf6/src/tooltip.js#L23-L31 |
53,534 | bobmonteverde/d3-simple-tooltip | src/tooltip.js | offsetLeft | function offsetLeft (elem) {
let left = 0
do {
if (!isNaN(elem.offsetLeft)) left += elem.offsetLeft
} while (elem = elem.offsetParent )
return left
} | javascript | function offsetLeft (elem) {
let left = 0
do {
if (!isNaN(elem.offsetLeft)) left += elem.offsetLeft
} while (elem = elem.offsetParent )
return left
} | [
"function",
"offsetLeft",
"(",
"elem",
")",
"{",
"let",
"left",
"=",
"0",
"do",
"{",
"if",
"(",
"!",
"isNaN",
"(",
"elem",
".",
"offsetLeft",
")",
")",
"left",
"+=",
"elem",
".",
"offsetLeft",
"}",
"while",
"(",
"elem",
"=",
"elem",
".",
"offsetPar... | Recursively calculate left offset of an element from the body | [
"Recursively",
"calculate",
"left",
"offset",
"of",
"an",
"element",
"from",
"the",
"body"
] | 19994f5bc61cea303b7a855d1aebfccd3220abf6 | https://github.com/bobmonteverde/d3-simple-tooltip/blob/19994f5bc61cea303b7a855d1aebfccd3220abf6/src/tooltip.js#L34-L42 |
53,535 | cirocosta/yaspm | src/spm.js | enhanceSpm | function enhanceSpm (comName, checkSignature, fn) {
var sp = new SerialPort(comName)
, open = false;
sp.writable = true;
sp.on('open', function() {
open = true;
if (checkSignature)
getSignature(sp, function(e, sig) {
fn(e, sp, sig);
});
else
fn(null, sp, null);
});
... | javascript | function enhanceSpm (comName, checkSignature, fn) {
var sp = new SerialPort(comName)
, open = false;
sp.writable = true;
sp.on('open', function() {
open = true;
if (checkSignature)
getSignature(sp, function(e, sig) {
fn(e, sp, sig);
});
else
fn(null, sp, null);
});
... | [
"function",
"enhanceSpm",
"(",
"comName",
",",
"checkSignature",
",",
"fn",
")",
"{",
"var",
"sp",
"=",
"new",
"SerialPort",
"(",
"comName",
")",
",",
"open",
"=",
"false",
";",
"sp",
".",
"writable",
"=",
"true",
";",
"sp",
".",
"on",
"(",
"'open'",... | Main function to be exported. It exposes a
better serialport.
@param {[type]} comName the comName
returned from the
port listing
@param {Function} fn callback function
to be called with
(err|sp|signature) | [
"Main",
"function",
"to",
"be",
"exported",
".",
"It",
"exposes",
"a",
"better",
"serialport",
"."
] | 676524906425ba99b1e6f95a75ce4a82501a0ee9 | https://github.com/cirocosta/yaspm/blob/676524906425ba99b1e6f95a75ce4a82501a0ee9/src/spm.js#L15-L35 |
53,536 | cirocosta/yaspm | src/spm.js | getSignature | function getSignature (sp, fn) {
var start = null
, sig = ''
, timer;
var handleSignature = function(data) {
if (data)
sig += data.toString() || '';
clearTimeout(timer);
if (!start && data) {
start = Date.now();
} else if (Date.now() - start > 100) {
sp.removeListener('d... | javascript | function getSignature (sp, fn) {
var start = null
, sig = ''
, timer;
var handleSignature = function(data) {
if (data)
sig += data.toString() || '';
clearTimeout(timer);
if (!start && data) {
start = Date.now();
} else if (Date.now() - start > 100) {
sp.removeListener('d... | [
"function",
"getSignature",
"(",
"sp",
",",
"fn",
")",
"{",
"var",
"start",
"=",
"null",
",",
"sig",
"=",
"''",
",",
"timer",
";",
"var",
"handleSignature",
"=",
"function",
"(",
"data",
")",
"{",
"if",
"(",
"data",
")",
"sig",
"+=",
"data",
".",
... | Given a SerialPort obj, tries to get the
signature emitted from the device.
@param {Object} sp sp
@param {Function} fn callback fn. Resolves
with (err | serialport |
signature) when ready. | [
"Given",
"a",
"SerialPort",
"obj",
"tries",
"to",
"get",
"the",
"signature",
"emitted",
"from",
"the",
"device",
"."
] | 676524906425ba99b1e6f95a75ce4a82501a0ee9 | https://github.com/cirocosta/yaspm/blob/676524906425ba99b1e6f95a75ce4a82501a0ee9/src/spm.js#L45-L67 |
53,537 | BladeRunnerJS/emitr | src/Emitter.js | listen | function listen(eventIdentifier, callback, context) {
if (typeof callback !== 'function') { throw new TypeError('on: Illegal Argument: callback must be a function, was ' + (typeof callback)); }
// This allows us to work even if the constructor hasn't been called. Useful for mixins.
if (this._emitterListeners ==... | javascript | function listen(eventIdentifier, callback, context) {
if (typeof callback !== 'function') { throw new TypeError('on: Illegal Argument: callback must be a function, was ' + (typeof callback)); }
// This allows us to work even if the constructor hasn't been called. Useful for mixins.
if (this._emitterListeners ==... | [
"function",
"listen",
"(",
"eventIdentifier",
",",
"callback",
",",
"context",
")",
"{",
"if",
"(",
"typeof",
"callback",
"!==",
"'function'",
")",
"{",
"throw",
"new",
"TypeError",
"(",
"'on: Illegal Argument: callback must be a function, was '",
"+",
"(",
"typeof"... | Registers a listener for an event.
If context is provided, then the <code>this</code> pointer will refer to it
inside the callback.
@param {*} eventIdentifier The identifier of the event that the callback should listen to.
@param {function} callback The function that should be called whenever the event is triggered. ... | [
"Registers",
"a",
"listener",
"for",
"an",
"event",
"."
] | 66ec84c3db3ff0f83a6ced87b805b2d3934d5613 | https://github.com/BladeRunnerJS/emitr/blob/66ec84c3db3ff0f83a6ced87b805b2d3934d5613/src/Emitter.js#L70-L105 |
53,538 | BladeRunnerJS/emitr | src/Emitter.js | function(eventIdentifier, callback, context) {
if (typeof callback !== 'function') { throw new TypeError('once: Illegal Argument: callback must be a function, was ' + (typeof callback)); }
var off = this.off.bind(this), hasFired = false;
function onceEventHandler() {
if (hasFired === false) {
hasFired = ... | javascript | function(eventIdentifier, callback, context) {
if (typeof callback !== 'function') { throw new TypeError('once: Illegal Argument: callback must be a function, was ' + (typeof callback)); }
var off = this.off.bind(this), hasFired = false;
function onceEventHandler() {
if (hasFired === false) {
hasFired = ... | [
"function",
"(",
"eventIdentifier",
",",
"callback",
",",
"context",
")",
"{",
"if",
"(",
"typeof",
"callback",
"!==",
"'function'",
")",
"{",
"throw",
"new",
"TypeError",
"(",
"'once: Illegal Argument: callback must be a function, was '",
"+",
"(",
"typeof",
"callb... | Registers a listener to receive an event only once.
If context is provided, then the <code>this</code> pointer will refer to it
inside the callback.
@param {*} eventIdentifier The identifier of the event that the callback should listen to.
@param {function} callback The function that should be called the first time t... | [
"Registers",
"a",
"listener",
"to",
"receive",
"an",
"event",
"only",
"once",
"."
] | 66ec84c3db3ff0f83a6ced87b805b2d3934d5613 | https://github.com/BladeRunnerJS/emitr/blob/66ec84c3db3ff0f83a6ced87b805b2d3934d5613/src/Emitter.js#L117-L135 | |
53,539 | BladeRunnerJS/emitr | src/Emitter.js | off | function off(eventIdentifier, callback, context) {
// not initialised - so no listeners of any kind
if (this._emitterListeners == null) { return false; }
if (arguments.length === 0) {
// clear all listeners.
if (this._emitterMetaEventsOn === true) {
var allListeners = this._emitterListeners.getValues()... | javascript | function off(eventIdentifier, callback, context) {
// not initialised - so no listeners of any kind
if (this._emitterListeners == null) { return false; }
if (arguments.length === 0) {
// clear all listeners.
if (this._emitterMetaEventsOn === true) {
var allListeners = this._emitterListeners.getValues()... | [
"function",
"off",
"(",
"eventIdentifier",
",",
"callback",
",",
"context",
")",
"{",
"// not initialised - so no listeners of any kind",
"if",
"(",
"this",
".",
"_emitterListeners",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"arguments",
".... | Clear previously registered listeners.
With no arguments, this clears all listeners from this Emitter.
With one argument, this clears all listeners registered to a particular event.
With two or three arguments, this clears a specific listener.
@param {?*} eventIdentifier The identifier of the event to clear. If nul... | [
"Clear",
"previously",
"registered",
"listeners",
"."
] | 66ec84c3db3ff0f83a6ced87b805b2d3934d5613 | https://github.com/BladeRunnerJS/emitr/blob/66ec84c3db3ff0f83a6ced87b805b2d3934d5613/src/Emitter.js#L151-L193 |
53,540 | BladeRunnerJS/emitr | src/Emitter.js | trigger | function trigger(event) {
var args;
var anyListeners = false;
if (this._emitterListeners != null) {
args = slice.call(arguments, 1);
if (this._emitterListeners.hasAny(event)) {
anyListeners = true;
notify(this._emitterListeners.getValues(event), Emitter.suppressErrors, args);
}
// navigate up... | javascript | function trigger(event) {
var args;
var anyListeners = false;
if (this._emitterListeners != null) {
args = slice.call(arguments, 1);
if (this._emitterListeners.hasAny(event)) {
anyListeners = true;
notify(this._emitterListeners.getValues(event), Emitter.suppressErrors, args);
}
// navigate up... | [
"function",
"trigger",
"(",
"event",
")",
"{",
"var",
"args",
";",
"var",
"anyListeners",
"=",
"false",
";",
"if",
"(",
"this",
".",
"_emitterListeners",
"!=",
"null",
")",
"{",
"args",
"=",
"slice",
".",
"call",
"(",
"arguments",
",",
"1",
")",
";",... | Fires an event, causing all the listeners registered for this event to be called.
If the event is an object, this will also call any listeners registered for
its class or any superclasses will also fire.
@param {*} event The event to fire.
@param {...*} [args] Optional arguments to pass to the listeners.
@returns {bo... | [
"Fires",
"an",
"event",
"causing",
"all",
"the",
"listeners",
"registered",
"for",
"this",
"event",
"to",
"be",
"called",
"."
] | 66ec84c3db3ff0f83a6ced87b805b2d3934d5613 | https://github.com/BladeRunnerJS/emitr/blob/66ec84c3db3ff0f83a6ced87b805b2d3934d5613/src/Emitter.js#L205-L232 |
53,541 | BladeRunnerJS/emitr | src/Emitter.js | clearListeners | function clearListeners(context) {
if (context == null) { throw new Error('clearListeners: context must be provided.'); }
// notify for every listener we throw out.
var removedListeners, trackRemovals = false;
if (this._emitterMetaEventsOn === true) {
trackRemovals = true;
removedListeners = [];
}
thi... | javascript | function clearListeners(context) {
if (context == null) { throw new Error('clearListeners: context must be provided.'); }
// notify for every listener we throw out.
var removedListeners, trackRemovals = false;
if (this._emitterMetaEventsOn === true) {
trackRemovals = true;
removedListeners = [];
}
thi... | [
"function",
"clearListeners",
"(",
"context",
")",
"{",
"if",
"(",
"context",
"==",
"null",
")",
"{",
"throw",
"new",
"Error",
"(",
"'clearListeners: context must be provided.'",
")",
";",
"}",
"// notify for every listener we throw out.",
"var",
"removedListeners",
"... | Clears all listeners registered for a particular context.
@param {Object} context The context that all listeners should be removed for. May not be null. | [
"Clears",
"all",
"listeners",
"registered",
"for",
"a",
"particular",
"context",
"."
] | 66ec84c3db3ff0f83a6ced87b805b2d3934d5613 | https://github.com/BladeRunnerJS/emitr/blob/66ec84c3db3ff0f83a6ced87b805b2d3934d5613/src/Emitter.js#L239-L257 |
53,542 | highly-attractive-people/jsonapi-relate | index.js | getIncluded | function getIncluded(payload, type, id) {
for (var i = payload.included.length - 1; i >= 0; i--) {
if (payload.included[i].id === id && payload.included[i].type === type) {
return payload.included[i];
}
}
} | javascript | function getIncluded(payload, type, id) {
for (var i = payload.included.length - 1; i >= 0; i--) {
if (payload.included[i].id === id && payload.included[i].type === type) {
return payload.included[i];
}
}
} | [
"function",
"getIncluded",
"(",
"payload",
",",
"type",
",",
"id",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"payload",
".",
"included",
".",
"length",
"-",
"1",
";",
"i",
">=",
"0",
";",
"i",
"--",
")",
"{",
"if",
"(",
"payload",
".",
"included",
... | Fetches an included object from a payload by its id
@param {Object} payload
The payload encapsulating the included data
@param {String} type
The entity type to retrieve
@param {String} id
The id of the desired included data
@return {Object}
The found included data | [
"Fetches",
"an",
"included",
"object",
"from",
"a",
"payload",
"by",
"its",
"id"
] | 60da29962ea0fc2767b6d87d0bf8b25669eb996d | https://github.com/highly-attractive-people/jsonapi-relate/blob/60da29962ea0fc2767b6d87d0bf8b25669eb996d/index.js#L14-L20 |
53,543 | highly-attractive-people/jsonapi-relate | index.js | getDeepRelationship | function getDeepRelationship(payload, parentResource, deepKey) {
var path = deepKey.split('.');
var subResources = parentResource;
for (var i = 0; i < path.length; i++) {
if (Array.isArray(subResources)) {
subResources = subResources.reduce(function (results, subResource) {
return results.concat... | javascript | function getDeepRelationship(payload, parentResource, deepKey) {
var path = deepKey.split('.');
var subResources = parentResource;
for (var i = 0; i < path.length; i++) {
if (Array.isArray(subResources)) {
subResources = subResources.reduce(function (results, subResource) {
return results.concat... | [
"function",
"getDeepRelationship",
"(",
"payload",
",",
"parentResource",
",",
"deepKey",
")",
"{",
"var",
"path",
"=",
"deepKey",
".",
"split",
"(",
"'.'",
")",
";",
"var",
"subResources",
"=",
"parentResource",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";... | Fetches specified related data associated to a resource,
and related data assocociated to that included resource...
@param {Object} payload
The payload encapsulating the included data
@param {Object} parentResource
The first resource to find included data for
@param {String} deepKey
The relationship to included data t... | [
"Fetches",
"specified",
"related",
"data",
"associated",
"to",
"a",
"resource",
"and",
"related",
"data",
"assocociated",
"to",
"that",
"included",
"resource",
"..."
] | 60da29962ea0fc2767b6d87d0bf8b25669eb996d | https://github.com/highly-attractive-people/jsonapi-relate/blob/60da29962ea0fc2767b6d87d0bf8b25669eb996d/index.js#L86-L102 |
53,544 | rkaw92/esdf | EventSourcedAggregate.js | AggregateTypeMismatch | function AggregateTypeMismatch(expected, got){
this.name = 'AggregateTypeMismatch';
this.message = 'Aggregate type mismatch: expected (' + typeof(expected) + ')' + expected + ', got (' + typeof(got) + ')' + got;
this.labels = {
expected: expected,
got: got,
critical: true // This error precludes retry attempts... | javascript | function AggregateTypeMismatch(expected, got){
this.name = 'AggregateTypeMismatch';
this.message = 'Aggregate type mismatch: expected (' + typeof(expected) + ')' + expected + ', got (' + typeof(got) + ')' + got;
this.labels = {
expected: expected,
got: got,
critical: true // This error precludes retry attempts... | [
"function",
"AggregateTypeMismatch",
"(",
"expected",
",",
"got",
")",
"{",
"this",
".",
"name",
"=",
"'AggregateTypeMismatch'",
";",
"this",
".",
"message",
"=",
"'Aggregate type mismatch: expected ('",
"+",
"typeof",
"(",
"expected",
")",
"+",
"')'",
"+",
"exp... | Aggregate-event type mismatch. Generated when a commit labelled with another AggregateType is applied to an aggregate.
Also occurs when a snapshot type mismatch takes place.
This prevents loading an aggregateID as another, unrelated aggregate type and trashing the database or bypassing logic restrictions.
@constructor
... | [
"Aggregate",
"-",
"event",
"type",
"mismatch",
".",
"Generated",
"when",
"a",
"commit",
"labelled",
"with",
"another",
"AggregateType",
"is",
"applied",
"to",
"an",
"aggregate",
".",
"Also",
"occurs",
"when",
"a",
"snapshot",
"type",
"mismatch",
"takes",
"plac... | 9c6bd2c278428096cb8c1ceeca62a5493d19613e | https://github.com/rkaw92/esdf/blob/9c6bd2c278428096cb8c1ceeca62a5493d19613e/EventSourcedAggregate.js#L21-L29 |
53,545 | four43/admiral-cli | lib/error/abstract-error.js | AbstractCliError | function AbstractCliError(message, statusCode) {
Error.call(this, message, statusCode);
Error.captureStackTrace(this, AbstractCliError);
this.message = message || this.message
} | javascript | function AbstractCliError(message, statusCode) {
Error.call(this, message, statusCode);
Error.captureStackTrace(this, AbstractCliError);
this.message = message || this.message
} | [
"function",
"AbstractCliError",
"(",
"message",
",",
"statusCode",
")",
"{",
"Error",
".",
"call",
"(",
"this",
",",
"message",
",",
"statusCode",
")",
";",
"Error",
".",
"captureStackTrace",
"(",
"this",
",",
"AbstractCliError",
")",
";",
"this",
".",
"me... | Abstract CLI Error
General error for CLI, all errors are children of this.
@param message
@param statusCode
@constructor | [
"Abstract",
"CLI",
"Error"
] | f6049dbb783a2c85c601c09ba7abc7dd87bd11fe | https://github.com/four43/admiral-cli/blob/f6049dbb783a2c85c601c09ba7abc7dd87bd11fe/lib/error/abstract-error.js#L10-L15 |
53,546 | leoasis/makery.js | makery.js | createInstanceOf | function createInstanceOf(ctor, args) {
var tempCtor = function() {
// This will return the instance or the explicit return of the ctor
// accordingly.
// Remember that if you return a primitive type, the constructor will
// still return the object instance.
return ctor.apply(this, arg... | javascript | function createInstanceOf(ctor, args) {
var tempCtor = function() {
// This will return the instance or the explicit return of the ctor
// accordingly.
// Remember that if you return a primitive type, the constructor will
// still return the object instance.
return ctor.apply(this, arg... | [
"function",
"createInstanceOf",
"(",
"ctor",
",",
"args",
")",
"{",
"var",
"tempCtor",
"=",
"function",
"(",
")",
"{",
"// This will return the instance or the explicit return of the ctor",
"// accordingly.",
"// Remember that if you return a primitive type, the constructor will",
... | We need a custom creation of an instance because we cannot pass a dynamic amount of args into a constructor when calling them with "new", so we must first call it with a fake constructor with the same prototype and then apply the real one with the correct args. | [
"We",
"need",
"a",
"custom",
"creation",
"of",
"an",
"instance",
"because",
"we",
"cannot",
"pass",
"a",
"dynamic",
"amount",
"of",
"args",
"into",
"a",
"constructor",
"when",
"calling",
"them",
"with",
"new",
"so",
"we",
"must",
"first",
"call",
"it",
"... | f50201fa2054eb9b8f66f48a1126c4872a569483 | https://github.com/leoasis/makery.js/blob/f50201fa2054eb9b8f66f48a1126c4872a569483/makery.js#L87-L98 |
53,547 | scisco/yaml-files | bin/cli.js | merge | function merge(input, output) {
const text = fs.readFileSync(input, 'utf8');
const loaded = yaml.safeLoad(text.toString(), { schema: yamlfiles.YAML_FILES_SCHEMA });
// write to output
fs.writeFileSync(output, yaml.safeDump(loaded));
return output;
} | javascript | function merge(input, output) {
const text = fs.readFileSync(input, 'utf8');
const loaded = yaml.safeLoad(text.toString(), { schema: yamlfiles.YAML_FILES_SCHEMA });
// write to output
fs.writeFileSync(output, yaml.safeDump(loaded));
return output;
} | [
"function",
"merge",
"(",
"input",
",",
"output",
")",
"{",
"const",
"text",
"=",
"fs",
".",
"readFileSync",
"(",
"input",
",",
"'utf8'",
")",
";",
"const",
"loaded",
"=",
"yaml",
".",
"safeLoad",
"(",
"text",
".",
"toString",
"(",
")",
",",
"{",
"... | parse-merge a given yaml file and save it to a
given output
@param {string} input - input yaml file path
@param {string} output - output yaml file path
@returns {string} the output path | [
"parse",
"-",
"merge",
"a",
"given",
"yaml",
"file",
"and",
"save",
"it",
"to",
"a",
"given",
"output"
] | 71de1364800a24a5cf86b12264fb6345eaf8f283 | https://github.com/scisco/yaml-files/blob/71de1364800a24a5cf86b12264fb6345eaf8f283/bin/cli.js#L17-L24 |
53,548 | aleclarson/quest | index.js | concat | function concat(res, done) {
const chunks = []
res
.on('data', chunk => {
chunks.push(chunk)
})
.on('end', () => {
done(Buffer.concat(chunks))
})
} | javascript | function concat(res, done) {
const chunks = []
res
.on('data', chunk => {
chunks.push(chunk)
})
.on('end', () => {
done(Buffer.concat(chunks))
})
} | [
"function",
"concat",
"(",
"res",
",",
"done",
")",
"{",
"const",
"chunks",
"=",
"[",
"]",
"res",
".",
"on",
"(",
"'data'",
",",
"chunk",
"=>",
"{",
"chunks",
".",
"push",
"(",
"chunk",
")",
"}",
")",
".",
"on",
"(",
"'end'",
",",
"(",
")",
"... | Buffer the entire stream into memory. | [
"Buffer",
"the",
"entire",
"stream",
"into",
"memory",
"."
] | c8f9e1729304aebe6ed6a805f4798f2945eebd2a | https://github.com/aleclarson/quest/blob/c8f9e1729304aebe6ed6a805f4798f2945eebd2a/index.js#L194-L203 |
53,549 | linyngfly/omelo | lib/util/appUtil.js | function(app, args) {
let serverType = args.serverType || Constants.RESERVED.MASTER;
let serverId = args.id || app.getMaster().id;
let mode = args.mode || Constants.RESERVED.CLUSTER;
let masterha = args.masterha || 'false';
let type = args.type || Constants.RESERVED.ALL;
let startId = args.startId;
app.s... | javascript | function(app, args) {
let serverType = args.serverType || Constants.RESERVED.MASTER;
let serverId = args.id || app.getMaster().id;
let mode = args.mode || Constants.RESERVED.CLUSTER;
let masterha = args.masterha || 'false';
let type = args.type || Constants.RESERVED.ALL;
let startId = args.startId;
app.s... | [
"function",
"(",
"app",
",",
"args",
")",
"{",
"let",
"serverType",
"=",
"args",
".",
"serverType",
"||",
"Constants",
".",
"RESERVED",
".",
"MASTER",
";",
"let",
"serverId",
"=",
"args",
".",
"id",
"||",
"app",
".",
"getMaster",
"(",
")",
".",
"id",... | Process server start command | [
"Process",
"server",
"start",
"command"
] | fb5f79fa31c69de36bd1c370bad5edfa753ca601 | https://github.com/linyngfly/omelo/blob/fb5f79fa31c69de36bd1c370bad5edfa753ca601/lib/util/appUtil.js#L163-L188 | |
53,550 | yanatan16/node-redis-eval | index.js | onerror | function onerror(cb) {
return function (err) {
if (err) {
shas = {}
arguments[0] = err instanceof Error ? err : new Error(err.toString())
}
cb.apply(null, arguments)
}
} | javascript | function onerror(cb) {
return function (err) {
if (err) {
shas = {}
arguments[0] = err instanceof Error ? err : new Error(err.toString())
}
cb.apply(null, arguments)
}
} | [
"function",
"onerror",
"(",
"cb",
")",
"{",
"return",
"function",
"(",
"err",
")",
"{",
"if",
"(",
"err",
")",
"{",
"shas",
"=",
"{",
"}",
"arguments",
"[",
"0",
"]",
"=",
"err",
"instanceof",
"Error",
"?",
"err",
":",
"new",
"Error",
"(",
"err",... | If an error occurs, we must be prudent and assume data was lost. We clean the shas cache. | [
"If",
"an",
"error",
"occurs",
"we",
"must",
"be",
"prudent",
"and",
"assume",
"data",
"was",
"lost",
".",
"We",
"clean",
"the",
"shas",
"cache",
"."
] | 8ce7fda84a8246e8e8f9d39ab3caca506a4960f7 | https://github.com/yanatan16/node-redis-eval/blob/8ce7fda84a8246e8e8f9d39ab3caca506a4960f7/index.js#L51-L59 |
53,551 | yanatan16/node-redis-eval | index.js | evalSha | function evalSha(redis, sha, keys, args, callback) {
if (sha) {
return redis.evalsha.apply(redis, _.flatten([sha, keys.length, keys, args, callback]));
}
return callback(new Error('evalsha called for not loaded script'));
} | javascript | function evalSha(redis, sha, keys, args, callback) {
if (sha) {
return redis.evalsha.apply(redis, _.flatten([sha, keys.length, keys, args, callback]));
}
return callback(new Error('evalsha called for not loaded script'));
} | [
"function",
"evalSha",
"(",
"redis",
",",
"sha",
",",
"keys",
",",
"args",
",",
"callback",
")",
"{",
"if",
"(",
"sha",
")",
"{",
"return",
"redis",
".",
"evalsha",
".",
"apply",
"(",
"redis",
",",
"_",
".",
"flatten",
"(",
"[",
"sha",
",",
"keys... | Evaluate a script that is already loaded | [
"Evaluate",
"a",
"script",
"that",
"is",
"already",
"loaded"
] | 8ce7fda84a8246e8e8f9d39ab3caca506a4960f7 | https://github.com/yanatan16/node-redis-eval/blob/8ce7fda84a8246e8e8f9d39ab3caca506a4960f7/index.js#L84-L89 |
53,552 | yanatan16/node-redis-eval | index.js | loadScript | function loadScript(redis, script_name, script, callback) {
redis.multi()
.script('load', script)
.exec(function (err, sha1) {
if (err) {
return callback(err);
}
shas[script_name] = sha1 && sha1.length && sha1[0];
callback(null, sha1);
});
} | javascript | function loadScript(redis, script_name, script, callback) {
redis.multi()
.script('load', script)
.exec(function (err, sha1) {
if (err) {
return callback(err);
}
shas[script_name] = sha1 && sha1.length && sha1[0];
callback(null, sha1);
});
} | [
"function",
"loadScript",
"(",
"redis",
",",
"script_name",
",",
"script",
",",
"callback",
")",
"{",
"redis",
".",
"multi",
"(",
")",
".",
"script",
"(",
"'load'",
",",
"script",
")",
".",
"exec",
"(",
"function",
"(",
"err",
",",
"sha1",
")",
"{",
... | Load a script into the script cache | [
"Load",
"a",
"script",
"into",
"the",
"script",
"cache"
] | 8ce7fda84a8246e8e8f9d39ab3caca506a4960f7 | https://github.com/yanatan16/node-redis-eval/blob/8ce7fda84a8246e8e8f9d39ab3caca506a4960f7/index.js#L92-L102 |
53,553 | linyngfly/omelo | lib/master/starter.js | function(command, host, options, cb) {
let child = null;
if(env === Constants.RESERVED.ENV_DEV) {
child = cp.spawn(command, options);
let prefix = command === Constants.COMMAND.SSH ? '[' + host + '] ' : '';
child.stderr.on('data', function (chunk) {
let msg = chunk.toString();
process.stde... | javascript | function(command, host, options, cb) {
let child = null;
if(env === Constants.RESERVED.ENV_DEV) {
child = cp.spawn(command, options);
let prefix = command === Constants.COMMAND.SSH ? '[' + host + '] ' : '';
child.stderr.on('data', function (chunk) {
let msg = chunk.toString();
process.stde... | [
"function",
"(",
"command",
",",
"host",
",",
"options",
",",
"cb",
")",
"{",
"let",
"child",
"=",
"null",
";",
"if",
"(",
"env",
"===",
"Constants",
".",
"RESERVED",
".",
"ENV_DEV",
")",
"{",
"child",
"=",
"cp",
".",
"spawn",
"(",
"command",
",",
... | Fork child process to run command.
@param {String} command
@param {Object} options
@param {Callback} callback | [
"Fork",
"child",
"process",
"to",
"run",
"command",
"."
] | fb5f79fa31c69de36bd1c370bad5edfa753ca601 | https://github.com/linyngfly/omelo/blob/fb5f79fa31c69de36bd1c370bad5edfa753ca601/lib/master/starter.js#L188-L220 | |
53,554 | tmpfs/ttycolor | lib/parse.js | opt | function opt(argv, arg, index, key) {
var value = argv[index + 1], equals = arg.indexOf('=');
if(equals > -1) {
value = arg.substr(equals + 1);
}
if(value && ~keys.indexOf(value)) {
return value;
}
if(arg === option[key]) {
return modes[key];
}
} | javascript | function opt(argv, arg, index, key) {
var value = argv[index + 1], equals = arg.indexOf('=');
if(equals > -1) {
value = arg.substr(equals + 1);
}
if(value && ~keys.indexOf(value)) {
return value;
}
if(arg === option[key]) {
return modes[key];
}
} | [
"function",
"opt",
"(",
"argv",
",",
"arg",
",",
"index",
",",
"key",
")",
"{",
"var",
"value",
"=",
"argv",
"[",
"index",
"+",
"1",
"]",
",",
"equals",
"=",
"arg",
".",
"indexOf",
"(",
"'='",
")",
";",
"if",
"(",
"equals",
">",
"-",
"1",
")"... | parse long options | [
"parse",
"long",
"options"
] | 4b72de7f61bfd922f227f3f4e7c61fb95ff9c023 | https://github.com/tmpfs/ttycolor/blob/4b72de7f61bfd922f227f3f4e7c61fb95ff9c023/lib/parse.js#L33-L44 |
53,555 | twolfson/fs-memory-store | lib/fs-memory-store.js | Store | function Store(dir, options) {
// Specify the directory and its options
assert(dir, '`Store` expected a `dir` (directory) to be passed in but it was not defined');
this.dir = dir;
this.memoryCache = {};
// Fallback options
options = options || {};
this.ext = options.ext || Store.ext;
this.stringify = o... | javascript | function Store(dir, options) {
// Specify the directory and its options
assert(dir, '`Store` expected a `dir` (directory) to be passed in but it was not defined');
this.dir = dir;
this.memoryCache = {};
// Fallback options
options = options || {};
this.ext = options.ext || Store.ext;
this.stringify = o... | [
"function",
"Store",
"(",
"dir",
",",
"options",
")",
"{",
"// Specify the directory and its options",
"assert",
"(",
"dir",
",",
"'`Store` expected a `dir` (directory) to be passed in but it was not defined'",
")",
";",
"this",
".",
"dir",
"=",
"dir",
";",
"this",
".",... | Filesystem storage system with in-memory cache
@param dir {String} Directory to generate our store inside of
@param options {Object} Container for options/flags
@param [options.ext='.json'] {String} Optional extension to save values under
@param [options.stringify=JSON.stringify] {Function} Optional stringifier to pass... | [
"Filesystem",
"storage",
"system",
"with",
"in",
"-",
"memory",
"cache"
] | 2f3b6e336097ec1d5f1a29c4ecbed70fbece1032 | https://github.com/twolfson/fs-memory-store/blob/2f3b6e336097ec1d5f1a29c4ecbed70fbece1032/lib/fs-memory-store.js#L16-L27 |
53,556 | soldair/node-repipe | index.js | resumeable | function resumeable(last,source,s){
source.last = last;
source.on('data',function(data){
source.last = data;
s.write(data);
})
var onPause = function(){
source.pause();
};
var onDrain = function(){
source.resume();
};
var onEnd = function(){
source.end();
};
var cleanup = fun... | javascript | function resumeable(last,source,s){
source.last = last;
source.on('data',function(data){
source.last = data;
s.write(data);
})
var onPause = function(){
source.pause();
};
var onDrain = function(){
source.resume();
};
var onEnd = function(){
source.end();
};
var cleanup = fun... | [
"function",
"resumeable",
"(",
"last",
",",
"source",
",",
"s",
")",
"{",
"source",
".",
"last",
"=",
"last",
";",
"source",
".",
"on",
"(",
"'data'",
",",
"function",
"(",
"data",
")",
"{",
"source",
".",
"last",
"=",
"data",
";",
"s",
".",
"wri... | its kinda like pipe except everythig bubbles. | [
"its",
"kinda",
"like",
"pipe",
"except",
"everythig",
"bubbles",
"."
] | b7e67005a4c49e2820eb08f036b2d441dbf31091 | https://github.com/soldair/node-repipe/blob/b7e67005a4c49e2820eb08f036b2d441dbf31091/index.js#L34-L74 |
53,557 | bvalosek/grunt-infusionsoft | tasks/generator/Scraper.js | function()
{
var url = this.docsUrl;
var _this = this;
var d = Q.defer();
// Need to create an array of promises for all the pages and their hash
Q.nfcall(request, url + '/api-docs').then(function(data) {
var $ = cheerio.load(data);
var list... | javascript | function()
{
var url = this.docsUrl;
var _this = this;
var d = Q.defer();
// Need to create an array of promises for all the pages and their hash
Q.nfcall(request, url + '/api-docs').then(function(data) {
var $ = cheerio.load(data);
var list... | [
"function",
"(",
")",
"{",
"var",
"url",
"=",
"this",
".",
"docsUrl",
";",
"var",
"_this",
"=",
"this",
";",
"var",
"d",
"=",
"Q",
".",
"defer",
"(",
")",
";",
"// Need to create an array of promises for all the pages and their hash",
"Q",
".",
"nfcall",
"("... | Get a promise representing an eventua lhash for all the infusionsoft API service calls | [
"Get",
"a",
"promise",
"representing",
"an",
"eventua",
"lhash",
"for",
"all",
"the",
"infusionsoft",
"API",
"service",
"calls"
] | 847dfde26021cb228ea4004c6a6d148d56e95703 | https://github.com/bvalosek/grunt-infusionsoft/blob/847dfde26021cb228ea4004c6a6d148d56e95703/tasks/generator/Scraper.js#L29-L63 | |
53,558 | bvalosek/grunt-infusionsoft | tasks/generator/Scraper.js | function()
{
var url = this.tableUrl;
var _this = this;
var d = new Q.defer();
var tableInfo;
this.getTableInfo()
.then(function(info) {
tableInfo = info;
return Q.nfcall(request, url + '/index.html');
})
.the... | javascript | function()
{
var url = this.tableUrl;
var _this = this;
var d = new Q.defer();
var tableInfo;
this.getTableInfo()
.then(function(info) {
tableInfo = info;
return Q.nfcall(request, url + '/index.html');
})
.the... | [
"function",
"(",
")",
"{",
"var",
"url",
"=",
"this",
".",
"tableUrl",
";",
"var",
"_this",
"=",
"this",
";",
"var",
"d",
"=",
"new",
"Q",
".",
"defer",
"(",
")",
";",
"var",
"tableInfo",
";",
"this",
".",
"getTableInfo",
"(",
")",
".",
"then",
... | Load all the tables up | [
"Load",
"all",
"the",
"tables",
"up"
] | 847dfde26021cb228ea4004c6a6d148d56e95703 | https://github.com/bvalosek/grunt-infusionsoft/blob/847dfde26021cb228ea4004c6a6d148d56e95703/tasks/generator/Scraper.js#L66-L103 | |
53,559 | bvalosek/grunt-infusionsoft | tasks/generator/Scraper.js | function(tableUrl)
{
var _this = this;
return Q.nfcall(request, tableUrl).then(function(data) {
var $ = cheerio.load(data);
var title = $('h2').first().text();
var $rows = $('table tr');
_this.tables.push(title);
var ret = {
... | javascript | function(tableUrl)
{
var _this = this;
return Q.nfcall(request, tableUrl).then(function(data) {
var $ = cheerio.load(data);
var title = $('h2').first().text();
var $rows = $('table tr');
_this.tables.push(title);
var ret = {
... | [
"function",
"(",
"tableUrl",
")",
"{",
"var",
"_this",
"=",
"this",
";",
"return",
"Q",
".",
"nfcall",
"(",
"request",
",",
"tableUrl",
")",
".",
"then",
"(",
"function",
"(",
"data",
")",
"{",
"var",
"$",
"=",
"cheerio",
".",
"load",
"(",
"data",
... | Scrape the actual table page to get the individiual fields | [
"Scrape",
"the",
"actual",
"table",
"page",
"to",
"get",
"the",
"individiual",
"fields"
] | 847dfde26021cb228ea4004c6a6d148d56e95703 | https://github.com/bvalosek/grunt-infusionsoft/blob/847dfde26021cb228ea4004c6a6d148d56e95703/tasks/generator/Scraper.js#L127-L162 | |
53,560 | bvalosek/grunt-infusionsoft | tasks/generator/Scraper.js | function(href)
{
var _this = this;
return Q.nfcall(request, href).then(function(data) {
var $ = cheerio.load(data);
var serviceName =
$('.collection')
.first()
.text()
.trim()
.replace(/\./g, '');
... | javascript | function(href)
{
var _this = this;
return Q.nfcall(request, href).then(function(data) {
var $ = cheerio.load(data);
var serviceName =
$('.collection')
.first()
.text()
.trim()
.replace(/\./g, '');
... | [
"function",
"(",
"href",
")",
"{",
"var",
"_this",
"=",
"this",
";",
"return",
"Q",
".",
"nfcall",
"(",
"request",
",",
"href",
")",
".",
"then",
"(",
"function",
"(",
"data",
")",
"{",
"var",
"$",
"=",
"cheerio",
".",
"load",
"(",
"data",
")",
... | Given a URL, parse all of the methods and corresponding parameter names for a Service API endpoint, return promise for node of information | [
"Given",
"a",
"URL",
"parse",
"all",
"of",
"the",
"methods",
"and",
"corresponding",
"parameter",
"names",
"for",
"a",
"Service",
"API",
"endpoint",
"return",
"promise",
"for",
"node",
"of",
"information"
] | 847dfde26021cb228ea4004c6a6d148d56e95703 | https://github.com/bvalosek/grunt-infusionsoft/blob/847dfde26021cb228ea4004c6a6d148d56e95703/tasks/generator/Scraper.js#L166-L224 | |
53,561 | jurca/js-lock | Lock.js | generateLockName | function generateLockName() {
let subMark = Math.floor(Math.random() * 1000).toString(36)
return `Lock:${Date.now().toString(36)}:${subMark}`
} | javascript | function generateLockName() {
let subMark = Math.floor(Math.random() * 1000).toString(36)
return `Lock:${Date.now().toString(36)}:${subMark}`
} | [
"function",
"generateLockName",
"(",
")",
"{",
"let",
"subMark",
"=",
"Math",
".",
"floor",
"(",
"Math",
".",
"random",
"(",
")",
"*",
"1000",
")",
".",
"toString",
"(",
"36",
")",
"return",
"`",
"${",
"Date",
".",
"now",
"(",
")",
".",
"toString",... | Generates a new, most likely unique, name for a freshly created lock that
was not provided with a custom name.
@return {string} The generated name for the lock. | [
"Generates",
"a",
"new",
"most",
"likely",
"unique",
"name",
"for",
"a",
"freshly",
"created",
"lock",
"that",
"was",
"not",
"provided",
"with",
"a",
"custom",
"name",
"."
] | 096511400e91799529f1225550efec9ae2af84c8 | https://github.com/jurca/js-lock/blob/096511400e91799529f1225550efec9ae2af84c8/Lock.js#L239-L242 |
53,562 | vslinko/mystem-stream | lib/parseResponse.js | parseResponse | function parseResponse(mystemResponse) {
var mystemResponseFacts = mystemResponse.slice(mystemResponse.indexOf("{") + 1, -1),
factRegexp = /([^,]+\([^)]+\)|[^,]+)/g,
facts = [],
fact;
while (fact = factRegexp.exec(mystemResponseFacts)) {
facts.push(fact[0]);
}
var resul... | javascript | function parseResponse(mystemResponse) {
var mystemResponseFacts = mystemResponse.slice(mystemResponse.indexOf("{") + 1, -1),
factRegexp = /([^,]+\([^)]+\)|[^,]+)/g,
facts = [],
fact;
while (fact = factRegexp.exec(mystemResponseFacts)) {
facts.push(fact[0]);
}
var resul... | [
"function",
"parseResponse",
"(",
"mystemResponse",
")",
"{",
"var",
"mystemResponseFacts",
"=",
"mystemResponse",
".",
"slice",
"(",
"mystemResponse",
".",
"indexOf",
"(",
"\"{\"",
")",
"+",
"1",
",",
"-",
"1",
")",
",",
"factRegexp",
"=",
"/",
"([^,]+\\([^... | Node.js wrapper for `MyStem` morphology text analyzer.
Copyright Vyacheslav Slinko <vyacheslav.slinko@gmail.com> | [
"Node",
".",
"js",
"wrapper",
"for",
"MyStem",
"morphology",
"text",
"analyzer",
".",
"Copyright",
"Vyacheslav",
"Slinko",
"<vyacheslav",
".",
"slinko"
] | 7f98fac4dfdee2d031eba40f682907cb1f2fdce2 | https://github.com/vslinko/mystem-stream/blob/7f98fac4dfdee2d031eba40f682907cb1f2fdce2/lib/parseResponse.js#L6-L25 |
53,563 | gunins/stonewall | dist/es6/dev/widget/Constructor.js | applyEvents | function applyEvents(context, child, data) {
var events = context.events[child.name];
if (events !== undefined && child.el !== undefined && child.data.type !== 'cp') {
events.forEach((event)=> {
context._events.push(child.on(event.name, event.action, context, data));
... | javascript | function applyEvents(context, child, data) {
var events = context.events[child.name];
if (events !== undefined && child.el !== undefined && child.data.type !== 'cp') {
events.forEach((event)=> {
context._events.push(child.on(event.name, event.action, context, data));
... | [
"function",
"applyEvents",
"(",
"context",
",",
"child",
",",
"data",
")",
"{",
"var",
"events",
"=",
"context",
".",
"events",
"[",
"child",
".",
"name",
"]",
";",
"if",
"(",
"events",
"!==",
"undefined",
"&&",
"child",
".",
"el",
"!==",
"undefined",
... | Aplying Events to elements @private applyEvents @param {dom.Element} element @param {Array} events @param {Object} data | [
"Aplying",
"Events",
"to",
"elements"
] | eebc6376f83115b6e29d4539582830e917f0e80e | https://github.com/gunins/stonewall/blob/eebc6376f83115b6e29d4539582830e917f0e80e/dist/es6/dev/widget/Constructor.js#L504-L511 |
53,564 | aigarsdz/metalsmith-mallet | lib/index.js | function (file) {
var match = pattern.exec(basename(file));
return { date: match[1], url: match[2] };
} | javascript | function (file) {
var match = pattern.exec(basename(file));
return { date: match[1], url: match[2] };
} | [
"function",
"(",
"file",
")",
"{",
"var",
"match",
"=",
"pattern",
".",
"exec",
"(",
"basename",
"(",
"file",
")",
")",
";",
"return",
"{",
"date",
":",
"match",
"[",
"1",
"]",
",",
"url",
":",
"match",
"[",
"2",
"]",
"}",
";",
"}"
] | Extracts date and permalink parts from a Jekyll style post.
@example
parseJekyllStylePost("2014-04-05-hello-world.md");
//=> { date: "2014-04-05", url: "hello-world" }
@param {String} file
@return {Object.<string, string>} | [
"Extracts",
"date",
"and",
"permalink",
"parts",
"from",
"a",
"Jekyll",
"style",
"post",
"."
] | 6b2b7398d74aab3c07a80cee52b7b980381fe29a | https://github.com/aigarsdz/metalsmith-mallet/blob/6b2b7398d74aab3c07a80cee52b7b980381fe29a/lib/index.js#L39-L43 | |
53,565 | aigarsdz/metalsmith-mallet | lib/index.js | function (userOptions) {
var defaultOptions = { ignore: [], collection: null, jekyllStyleLayout: true };
for (var opt in userOptions) defaultOptions[opt] = userOptions[opt];
return defaultOptions;
} | javascript | function (userOptions) {
var defaultOptions = { ignore: [], collection: null, jekyllStyleLayout: true };
for (var opt in userOptions) defaultOptions[opt] = userOptions[opt];
return defaultOptions;
} | [
"function",
"(",
"userOptions",
")",
"{",
"var",
"defaultOptions",
"=",
"{",
"ignore",
":",
"[",
"]",
",",
"collection",
":",
"null",
",",
"jekyllStyleLayout",
":",
"true",
"}",
";",
"for",
"(",
"var",
"opt",
"in",
"userOptions",
")",
"defaultOptions",
"... | Merges user provided options with the defaults.
@param {Object} userOptions
@return {Object} Default: { ignore: [] } | [
"Merges",
"user",
"provided",
"options",
"with",
"the",
"defaults",
"."
] | 6b2b7398d74aab3c07a80cee52b7b980381fe29a | https://github.com/aigarsdz/metalsmith-mallet/blob/6b2b7398d74aab3c07a80cee52b7b980381fe29a/lib/index.js#L62-L68 | |
53,566 | pagespace/pagespace | static/dashboard/app/forms/bs-has-error.js | getClosestFormName | function getClosestFormName(element) {
var parent = element.parent();
if(parent[0].tagName.toLowerCase() === 'form') {
return parent.attr('name') || null;
} else {
return getClosestFormName(parent);
... | javascript | function getClosestFormName(element) {
var parent = element.parent();
if(parent[0].tagName.toLowerCase() === 'form') {
return parent.attr('name') || null;
} else {
return getClosestFormName(parent);
... | [
"function",
"getClosestFormName",
"(",
"element",
")",
"{",
"var",
"parent",
"=",
"element",
".",
"parent",
"(",
")",
";",
"if",
"(",
"parent",
"[",
"0",
"]",
".",
"tagName",
".",
"toLowerCase",
"(",
")",
"===",
"'form'",
")",
"{",
"return",
"parent",
... | find parent form | [
"find",
"parent",
"form"
] | 943c45ddd9aaa4f3136e1ba4c2593aa0289daf43 | https://github.com/pagespace/pagespace/blob/943c45ddd9aaa4f3136e1ba4c2593aa0289daf43/static/dashboard/app/forms/bs-has-error.js#L8-L15 |
53,567 | zkochan/frame-message | lib/subscriber.js | Subscriber | function Subscriber(opts) {
opts = opts || {};
this._channel = opts.channel || 'default';
this._subscribers = [];
/* for mocking */
var addEventListener = opts.addEventListener || window.addEventListener;
var attachEvent = opts.attachEvent || window.attachEvent;
var _this = this;
function onMessage(e... | javascript | function Subscriber(opts) {
opts = opts || {};
this._channel = opts.channel || 'default';
this._subscribers = [];
/* for mocking */
var addEventListener = opts.addEventListener || window.addEventListener;
var attachEvent = opts.attachEvent || window.attachEvent;
var _this = this;
function onMessage(e... | [
"function",
"Subscriber",
"(",
"opts",
")",
"{",
"opts",
"=",
"opts",
"||",
"{",
"}",
";",
"this",
".",
"_channel",
"=",
"opts",
".",
"channel",
"||",
"'default'",
";",
"this",
".",
"_subscribers",
"=",
"[",
"]",
";",
"/* for mocking */",
"var",
"addEv... | An object for subscribing to frame messages.
@param {String} [opts.channel=default] - The name of the messaging channel to
subscribe to. | [
"An",
"object",
"for",
"subscribing",
"to",
"frame",
"messages",
"."
] | 550c49694019f0c8f60fe31140eb93947b52c22a | https://github.com/zkochan/frame-message/blob/550c49694019f0c8f60fe31140eb93947b52c22a/lib/subscriber.js#L19-L44 |
53,568 | joemccann/photopipe | database/redis-client.js | function(keys){
console.log('\nInitializing keys in Redis...\n')
keys.forEach(function(el,i){
client.get(el.key, function(e,d){
if(e) {
console.log("Error trying to get %s ", el.key)
return console.error(e)
}
// checking for falsey values only is a bad idea
if(typeof... | javascript | function(keys){
console.log('\nInitializing keys in Redis...\n')
keys.forEach(function(el,i){
client.get(el.key, function(e,d){
if(e) {
console.log("Error trying to get %s ", el.key)
return console.error(e)
}
// checking for falsey values only is a bad idea
if(typeof... | [
"function",
"(",
"keys",
")",
"{",
"console",
".",
"log",
"(",
"'\\nInitializing keys in Redis...\\n'",
")",
"keys",
".",
"forEach",
"(",
"function",
"(",
"el",
",",
"i",
")",
"{",
"client",
".",
"get",
"(",
"el",
".",
"key",
",",
"function",
"(",
"e",... | Upon firing up, make sure these baseline keys are set | [
"Upon",
"firing",
"up",
"make",
"sure",
"these",
"baseline",
"keys",
"are",
"set"
] | 20318fde11163a8b732b077a141a8d8530372333 | https://github.com/joemccann/photopipe/blob/20318fde11163a8b732b077a141a8d8530372333/database/redis-client.js#L15-L57 | |
53,569 | joemccann/photopipe | database/redis-client.js | function(userObj, setname, hashPrefix, cb){
console.log("\nCreating new user account %s", userObj.network.username)
/*
userObj = {
network: {
type : 'facebook',
first_name: 'Joe',
last_name: 'McCann',
username: 'joemccann',
full_n... | javascript | function(userObj, setname, hashPrefix, cb){
console.log("\nCreating new user account %s", userObj.network.username)
/*
userObj = {
network: {
type : 'facebook',
first_name: 'Joe',
last_name: 'McCann',
username: 'joemccann',
full_n... | [
"function",
"(",
"userObj",
",",
"setname",
",",
"hashPrefix",
",",
"cb",
")",
"{",
"console",
".",
"log",
"(",
"\"\\nCreating new user account %s\"",
",",
"userObj",
".",
"network",
".",
"username",
")",
"/*\n userObj = {\n network: {\n type : 'fac... | Create a new user account in Redis setname is the name of the set to add to hashPrefix is the prefix to identify the hash | [
"Create",
"a",
"new",
"user",
"account",
"in",
"Redis",
"setname",
"is",
"the",
"name",
"of",
"the",
"set",
"to",
"add",
"to",
"hashPrefix",
"is",
"the",
"prefix",
"to",
"identify",
"the",
"hash"
] | 20318fde11163a8b732b077a141a8d8530372333 | https://github.com/joemccann/photopipe/blob/20318fde11163a8b732b077a141a8d8530372333/database/redis-client.js#L138-L201 | |
53,570 | joemccann/photopipe | database/redis-client.js | function(userObj, setname, hashPrefix, cb){
// client.srem('users',userObj.uuid, redis.print)
var _uuid = sha1('photopipe', userObj.email_address)
client.srem(setname, _uuid, function(e,d){
if(cb){
return cb(e,d)
}
userSetRemoveHandler(e,d)... | javascript | function(userObj, setname, hashPrefix, cb){
// client.srem('users',userObj.uuid, redis.print)
var _uuid = sha1('photopipe', userObj.email_address)
client.srem(setname, _uuid, function(e,d){
if(cb){
return cb(e,d)
}
userSetRemoveHandler(e,d)... | [
"function",
"(",
"userObj",
",",
"setname",
",",
"hashPrefix",
",",
"cb",
")",
"{",
"// client.srem('users',userObj.uuid, redis.print)",
"var",
"_uuid",
"=",
"sha1",
"(",
"'photopipe'",
",",
"userObj",
".",
"email_address",
")",
"client",
".",
"srem",
"(",
"setn... | Delete user's account from Redis. | [
"Delete",
"user",
"s",
"account",
"from",
"Redis",
"."
] | 20318fde11163a8b732b077a141a8d8530372333 | https://github.com/joemccann/photopipe/blob/20318fde11163a8b732b077a141a8d8530372333/database/redis-client.js#L203-L222 | |
53,571 | joemccann/photopipe | database/redis-client.js | function(e,d){
if(e){
console.log("User set add data response: %s", d)
e && console.error(e)
return
}
console.log("User set add data response with no error: %s", d)
} | javascript | function(e,d){
if(e){
console.log("User set add data response: %s", d)
e && console.error(e)
return
}
console.log("User set add data response with no error: %s", d)
} | [
"function",
"(",
"e",
",",
"d",
")",
"{",
"if",
"(",
"e",
")",
"{",
"console",
".",
"log",
"(",
"\"User set add data response: %s\"",
",",
"d",
")",
"e",
"&&",
"console",
".",
"error",
"(",
"e",
")",
"return",
"}",
"console",
".",
"log",
"(",
"\"Us... | Callback after setting user to the set of users | [
"Callback",
"after",
"setting",
"user",
"to",
"the",
"set",
"of",
"users"
] | 20318fde11163a8b732b077a141a8d8530372333 | https://github.com/joemccann/photopipe/blob/20318fde11163a8b732b077a141a8d8530372333/database/redis-client.js#L224-L231 | |
53,572 | MegrezZhu/SYSU-JWXT | index.js | decorate | function decorate (fn) {
return async function (...args) {
try {
return fn.call(this, ...args);
} catch (err) {
this.logger && this.logger.error(err.message);
throw err;
}
};
} | javascript | function decorate (fn) {
return async function (...args) {
try {
return fn.call(this, ...args);
} catch (err) {
this.logger && this.logger.error(err.message);
throw err;
}
};
} | [
"function",
"decorate",
"(",
"fn",
")",
"{",
"return",
"async",
"function",
"(",
"...",
"args",
")",
"{",
"try",
"{",
"return",
"fn",
".",
"call",
"(",
"this",
",",
"...",
"args",
")",
";",
"}",
"catch",
"(",
"err",
")",
"{",
"this",
".",
"logger... | decorator-like function that wraps the methods | [
"decorator",
"-",
"like",
"function",
"that",
"wraps",
"the",
"methods"
] | 125c51328994d8c538463116758a5a710a185646 | https://github.com/MegrezZhu/SYSU-JWXT/blob/125c51328994d8c538463116758a5a710a185646/index.js#L35-L44 |
53,573 | maxcnunes/spawn-auto-restart | src/index.js | start | function start() {
proc = spawn(procCommand, procArgs, procOptions);
var onClose = function (code) {
if (!restarting) {
process.exit(code);
}
start();
restarting = false;
};
proc.on('error', function () {
debug('restarting due error');
restarting = true;
... | javascript | function start() {
proc = spawn(procCommand, procArgs, procOptions);
var onClose = function (code) {
if (!restarting) {
process.exit(code);
}
start();
restarting = false;
};
proc.on('error', function () {
debug('restarting due error');
restarting = true;
... | [
"function",
"start",
"(",
")",
"{",
"proc",
"=",
"spawn",
"(",
"procCommand",
",",
"procArgs",
",",
"procOptions",
")",
";",
"var",
"onClose",
"=",
"function",
"(",
"code",
")",
"{",
"if",
"(",
"!",
"restarting",
")",
"{",
"process",
".",
"exit",
"("... | start the child process | [
"start",
"the",
"child",
"process"
] | ba0b9cfd4a4b55abe6b65f4c77fc4fa56bff589b | https://github.com/maxcnunes/spawn-auto-restart/blob/ba0b9cfd4a4b55abe6b65f4c77fc4fa56bff589b/src/index.js#L42-L60 |
53,574 | 75lb/common-sequence | lib/common-sequence.js | commonSequence | function commonSequence(a, b){
var result = [];
for (var i = 0; i < Math.min(a.length, b.length); i++){
if (a[i] === b[i]){
result.push(a[i]);
} else {
break;
}
}
return result;
} | javascript | function commonSequence(a, b){
var result = [];
for (var i = 0; i < Math.min(a.length, b.length); i++){
if (a[i] === b[i]){
result.push(a[i]);
} else {
break;
}
}
return result;
} | [
"function",
"commonSequence",
"(",
"a",
",",
"b",
")",
"{",
"var",
"result",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"Math",
".",
"min",
"(",
"a",
".",
"length",
",",
"b",
".",
"length",
")",
";",
"i",
"++",
")"... | Returns the initial elements which both input arrays have in common
@param {Array} - first array to compare
@param {Array} - second array to compare
@returns {Array}
@alias module:common-sequence | [
"Returns",
"the",
"initial",
"elements",
"which",
"both",
"input",
"arrays",
"have",
"in",
"common"
] | bdfd45b1358fd8fc8f90c90dde9960cc9555fb01 | https://github.com/75lb/common-sequence/blob/bdfd45b1358fd8fc8f90c90dde9960cc9555fb01/lib/common-sequence.js#L34-L44 |
53,575 | jmanero/simple-uid | index.js | generator | function generator(url) {
var randomnesss = Crypto.randomBytes(24);
randomnesss.writeDoubleBE(Date.now(), 0);
randomnesss.writeUInt32BE(process.pid, 8);
var output = randomnesss.toString('base64');
// URL safe
if (url) {
output = output.replace(/\//g, '_');
output = output.replace(/\+/g, '-');
}
return o... | javascript | function generator(url) {
var randomnesss = Crypto.randomBytes(24);
randomnesss.writeDoubleBE(Date.now(), 0);
randomnesss.writeUInt32BE(process.pid, 8);
var output = randomnesss.toString('base64');
// URL safe
if (url) {
output = output.replace(/\//g, '_');
output = output.replace(/\+/g, '-');
}
return o... | [
"function",
"generator",
"(",
"url",
")",
"{",
"var",
"randomnesss",
"=",
"Crypto",
".",
"randomBytes",
"(",
"24",
")",
";",
"randomnesss",
".",
"writeDoubleBE",
"(",
"Date",
".",
"now",
"(",
")",
",",
"0",
")",
";",
"randomnesss",
".",
"writeUInt32BE",
... | Generates a string composed of the millisecond date, the current PID, and
some random bytes
@returns String | [
"Generates",
"a",
"string",
"composed",
"of",
"the",
"millisecond",
"date",
"the",
"current",
"PID",
"and",
"some",
"random",
"bytes"
] | 19e8a40bd800b7e31a41b7ca5cfec56e6f8507dd | https://github.com/jmanero/simple-uid/blob/19e8a40bd800b7e31a41b7ca5cfec56e6f8507dd/index.js#L9-L23 |
53,576 | NumminorihSF/bramqp-wrapper | domain/confirm.js | Confirm | function Confirm(client, channel){
EE.call(this);
this.client = client;
this.channel = channel;
this.id = channel.$getId();
return this;
} | javascript | function Confirm(client, channel){
EE.call(this);
this.client = client;
this.channel = channel;
this.id = channel.$getId();
return this;
} | [
"function",
"Confirm",
"(",
"client",
",",
"channel",
")",
"{",
"EE",
".",
"call",
"(",
"this",
")",
";",
"this",
".",
"client",
"=",
"client",
";",
"this",
".",
"channel",
"=",
"channel",
";",
"this",
".",
"id",
"=",
"channel",
".",
"$getId",
"(",... | Work with confirms.
The Confirm class allows publishers to put the channel in confirm mode and susequently
be notified when messages have been handled by the broker.
The intention is that all messages published on a channel in confirm mode will be
acknowledged at some point. By acknowledging a message the broker assum... | [
"Work",
"with",
"confirms",
"."
] | 3e2bd769a2828f7592eba79556c9ef1491177781 | https://github.com/NumminorihSF/bramqp-wrapper/blob/3e2bd769a2828f7592eba79556c9ef1491177781/domain/confirm.js#L27-L34 |
53,577 | reworkcss/rework-plugin-mixin | index.js | mixin | function mixin(rework, declarations, mixins) {
for (var i = 0; i < declarations.length; ++i) {
var decl = declarations[i];
if ('comment' == decl.type) continue;
var key = decl.property;
var val = decl.value;
var fn = mixins[key];
if (!fn) continue;
// invoke mixin
var ret = fn.call(r... | javascript | function mixin(rework, declarations, mixins) {
for (var i = 0; i < declarations.length; ++i) {
var decl = declarations[i];
if ('comment' == decl.type) continue;
var key = decl.property;
var val = decl.value;
var fn = mixins[key];
if (!fn) continue;
// invoke mixin
var ret = fn.call(r... | [
"function",
"mixin",
"(",
"rework",
",",
"declarations",
",",
"mixins",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"declarations",
".",
"length",
";",
"++",
"i",
")",
"{",
"var",
"decl",
"=",
"declarations",
"[",
"i",
"]",
";",
"i... | Visit declarations and apply mixins.
@param {Rework} rework
@param {Array} declarations
@param {Object} mixins
@api private | [
"Visit",
"declarations",
"and",
"apply",
"mixins",
"."
] | cd7c6edfad40cccff67cf764e90e9c4fd0c49f71 | https://github.com/reworkcss/rework-plugin-mixin/blob/cd7c6edfad40cccff67cf764e90e9c4fd0c49f71/index.js#L30-L66 |
53,578 | lamansky/cached-function | index.js | generateKey | function generateKey (args, strictArgMatch = true) {
args = Array.from(args)
if (strictArgMatch) return args
return args.map(arg => maybeStringify(arg))
} | javascript | function generateKey (args, strictArgMatch = true) {
args = Array.from(args)
if (strictArgMatch) return args
return args.map(arg => maybeStringify(arg))
} | [
"function",
"generateKey",
"(",
"args",
",",
"strictArgMatch",
"=",
"true",
")",
"{",
"args",
"=",
"Array",
".",
"from",
"(",
"args",
")",
"if",
"(",
"strictArgMatch",
")",
"return",
"args",
"return",
"args",
".",
"map",
"(",
"arg",
"=>",
"maybeStringify... | Generates the representation of function arguments which will be used to store
and retrieve return values in the cache.
@param {array|object} args An array-like collection of the function's arguments.
@param {bool} [strictArgMatch=true] Whether or not to match function arguments
based on their serialized representati... | [
"Generates",
"the",
"representation",
"of",
"function",
"arguments",
"which",
"will",
"be",
"used",
"to",
"store",
"and",
"retrieve",
"return",
"values",
"in",
"the",
"cache",
"."
] | 794ade3f2bd93160d110ad776648e75716ea2500 | https://github.com/lamansky/cached-function/blob/794ade3f2bd93160d110ad776648e75716ea2500/index.js#L29-L33 |
53,579 | windmaomao/ng-admin-restify | src/ng-admin.js | function(model) {
var fields = _.keys(model);
var updated = {};
_.each(fields, function(field) {
var updatedField = {};
var modelField = {};
if (!(field === Object(field))) {
updatedField.field = field;
if (!(model[field] === Object(model[field]))) {... | javascript | function(model) {
var fields = _.keys(model);
var updated = {};
_.each(fields, function(field) {
var updatedField = {};
var modelField = {};
if (!(field === Object(field))) {
updatedField.field = field;
if (!(model[field] === Object(model[field]))) {... | [
"function",
"(",
"model",
")",
"{",
"var",
"fields",
"=",
"_",
".",
"keys",
"(",
"model",
")",
";",
"var",
"updated",
"=",
"{",
"}",
";",
"_",
".",
"each",
"(",
"fields",
",",
"function",
"(",
"field",
")",
"{",
"var",
"updatedField",
"=",
"{",
... | convert model and merge with nga fields | [
"convert",
"model",
"and",
"merge",
"with",
"nga",
"fields"
] | d86d8c12eb07e1b23def2f5de0832aa357c2a731 | https://github.com/windmaomao/ng-admin-restify/blob/d86d8c12eb07e1b23def2f5de0832aa357c2a731/src/ng-admin.js#L227-L249 | |
53,580 | supercrabtree/tie-dye | rgbToHex.js | rgbToHex | function rgbToHex(r, g, b) {
var integer = ((Math.round(r) & 0xFF) << 16)
+ ((Math.round(g) & 0xFF) << 8)
+ (Math.round(b) & 0xFF);
var string = integer.toString(16).toUpperCase();
return '#' + ('000000'.substring(string.length) + string);
} | javascript | function rgbToHex(r, g, b) {
var integer = ((Math.round(r) & 0xFF) << 16)
+ ((Math.round(g) & 0xFF) << 8)
+ (Math.round(b) & 0xFF);
var string = integer.toString(16).toUpperCase();
return '#' + ('000000'.substring(string.length) + string);
} | [
"function",
"rgbToHex",
"(",
"r",
",",
"g",
",",
"b",
")",
"{",
"var",
"integer",
"=",
"(",
"(",
"Math",
".",
"round",
"(",
"r",
")",
"&",
"0xFF",
")",
"<<",
"16",
")",
"+",
"(",
"(",
"Math",
".",
"round",
"(",
"g",
")",
"&",
"0xFF",
")",
... | Convert a color from RGB to hexidecimal
@param {number} r - A value from 0 - 255
@param {number} g - A value from 0 - 255
@param {number} b - A value from 0 - 255
@returns {string} In the format #000000 | [
"Convert",
"a",
"color",
"from",
"RGB",
"to",
"hexidecimal"
] | 1bf045767ce1a3fcf88450fbf95f72b5646f63df | https://github.com/supercrabtree/tie-dye/blob/1bf045767ce1a3fcf88450fbf95f72b5646f63df/rgbToHex.js#L9-L16 |
53,581 | espadrine/queread | src/tokenizer/time.js | nthWeekDay | function nthWeekDay(countDays, weekDay, year, month, day) {
let countedDays = 0
if (countDays >= 0) {
month = month || 1
let monthStr = String(month)
if (monthStr.length === 1) { monthStr = "0" + monthStr }
day = day || 1
let dayStr = String(day)
if (dayStr.length === 1) { dayStr = "0" + day... | javascript | function nthWeekDay(countDays, weekDay, year, month, day) {
let countedDays = 0
if (countDays >= 0) {
month = month || 1
let monthStr = String(month)
if (monthStr.length === 1) { monthStr = "0" + monthStr }
day = day || 1
let dayStr = String(day)
if (dayStr.length === 1) { dayStr = "0" + day... | [
"function",
"nthWeekDay",
"(",
"countDays",
",",
"weekDay",
",",
"year",
",",
"month",
",",
"day",
")",
"{",
"let",
"countedDays",
"=",
"0",
"if",
"(",
"countDays",
">=",
"0",
")",
"{",
"month",
"=",
"month",
"||",
"1",
"let",
"monthStr",
"=",
"Strin... | eg. second friday of 2015 | [
"eg",
".",
"second",
"friday",
"of",
"2015"
] | 5a0d5017ee1d1911983cc5252a27e160438837f7 | https://github.com/espadrine/queread/blob/5a0d5017ee1d1911983cc5252a27e160438837f7/src/tokenizer/time.js#L507-L545 |
53,582 | espadrine/queread | src/tokenizer/time.js | lastDayOfMonth | function lastDayOfMonth(time) {
let year = time.getUTCFullYear()
let nextMonth = time.getUTCMonth() + 2
if (nextMonth > 12) {
year++
nextMonth = 1
}
let nextMonthStr = String(nextMonth)
if (nextMonthStr.length === 1) { nextMonthStr = '0' + nextMonthStr }
let date = new Date(`${year}-${nextMonthStr... | javascript | function lastDayOfMonth(time) {
let year = time.getUTCFullYear()
let nextMonth = time.getUTCMonth() + 2
if (nextMonth > 12) {
year++
nextMonth = 1
}
let nextMonthStr = String(nextMonth)
if (nextMonthStr.length === 1) { nextMonthStr = '0' + nextMonthStr }
let date = new Date(`${year}-${nextMonthStr... | [
"function",
"lastDayOfMonth",
"(",
"time",
")",
"{",
"let",
"year",
"=",
"time",
".",
"getUTCFullYear",
"(",
")",
"let",
"nextMonth",
"=",
"time",
".",
"getUTCMonth",
"(",
")",
"+",
"2",
"if",
"(",
"nextMonth",
">",
"12",
")",
"{",
"year",
"++",
"nex... | Takes a Date, returns the date of the last day of the corresponding month. eg, 31. | [
"Takes",
"a",
"Date",
"returns",
"the",
"date",
"of",
"the",
"last",
"day",
"of",
"the",
"corresponding",
"month",
".",
"eg",
"31",
"."
] | 5a0d5017ee1d1911983cc5252a27e160438837f7 | https://github.com/espadrine/queread/blob/5a0d5017ee1d1911983cc5252a27e160438837f7/src/tokenizer/time.js#L563-L574 |
53,583 | boylesoftware/x2node-rsparser | index.js | processKeyProperty | function processKeyProperty(propDesc, keyPropContainer) {
// get the key property descriptor
const keyPropName = propDesc._keyPropertyName;
if (!keyPropContainer.hasProperty(keyPropName))
throw invalidPropDef(
propDesc, 'key property ' + keyPropName +
' not found among the target object properties.');
con... | javascript | function processKeyProperty(propDesc, keyPropContainer) {
// get the key property descriptor
const keyPropName = propDesc._keyPropertyName;
if (!keyPropContainer.hasProperty(keyPropName))
throw invalidPropDef(
propDesc, 'key property ' + keyPropName +
' not found among the target object properties.');
con... | [
"function",
"processKeyProperty",
"(",
"propDesc",
",",
"keyPropContainer",
")",
"{",
"// get the key property descriptor",
"const",
"keyPropName",
"=",
"propDesc",
".",
"_keyPropertyName",
";",
"if",
"(",
"!",
"keyPropContainer",
".",
"hasProperty",
"(",
"keyPropName",... | Process key property name definition attribute and set the property
descriptor's key property value type and reference target accordingly.
@private
@param {module:x2node-records~PropertyDescriptor} propDesc Map property
descriptor.
@param {module:x2node-records~PropertiesContainer} keyPropContainer Key
property contai... | [
"Process",
"key",
"property",
"name",
"definition",
"attribute",
"and",
"set",
"the",
"property",
"descriptor",
"s",
"key",
"property",
"value",
"type",
"and",
"reference",
"target",
"accordingly",
"."
] | 716526a2f2653b22ee1455800dce1bd95f25ddfb | https://github.com/boylesoftware/x2node-rsparser/blob/716526a2f2653b22ee1455800dce1bd95f25ddfb/index.js#L187-L207 |
53,584 | linyngfly/omelo | lib/connectors/commands/handshake.js | function(opts) {
opts = opts || {};
this.userHandshake = opts.handshake;
if(opts.heartbeat) {
this.heartbeatSec = opts.heartbeat;
this.heartbeat = opts.heartbeat * 1000;
}
this.checkClient = opts.checkClient;
this.useDict = opts.useDict;
this.useProtobuf = opts.useProtobuf;
this.useCrypto = o... | javascript | function(opts) {
opts = opts || {};
this.userHandshake = opts.handshake;
if(opts.heartbeat) {
this.heartbeatSec = opts.heartbeat;
this.heartbeat = opts.heartbeat * 1000;
}
this.checkClient = opts.checkClient;
this.useDict = opts.useDict;
this.useProtobuf = opts.useProtobuf;
this.useCrypto = o... | [
"function",
"(",
"opts",
")",
"{",
"opts",
"=",
"opts",
"||",
"{",
"}",
";",
"this",
".",
"userHandshake",
"=",
"opts",
".",
"handshake",
";",
"if",
"(",
"opts",
".",
"heartbeat",
")",
"{",
"this",
".",
"heartbeatSec",
"=",
"opts",
".",
"heartbeat",
... | Process the handshake request.
@param {Object} opts option parameters
opts.handshake(msg, cb(err, resp)) handshake callback. msg is the handshake message from client.
opts.hearbeat heartbeat interval (level?)
opts.version required client level | [
"Process",
"the",
"handshake",
"request",
"."
] | fb5f79fa31c69de36bd1c370bad5edfa753ca601 | https://github.com/linyngfly/omelo/blob/fb5f79fa31c69de36bd1c370bad5edfa753ca601/lib/connectors/commands/handshake.js#L16-L30 | |
53,585 | ariatemplates/noder-js | src/plugins/noderError/evalError.js | formatError | function formatError(err, input) {
var msg = err.message.replace(/\s*\(\d*\:\d*\)\s*$/i, ''); // remove line number / col number
var bm = ('' + input.slice(0, err.pos)).match(/.*$/i);
var am = ('' + input.slice(err.pos)).match(/.*/i);
var before = bm ? bm[0] : '';
var after = am ? am[0] : '';
... | javascript | function formatError(err, input) {
var msg = err.message.replace(/\s*\(\d*\:\d*\)\s*$/i, ''); // remove line number / col number
var bm = ('' + input.slice(0, err.pos)).match(/.*$/i);
var am = ('' + input.slice(err.pos)).match(/.*/i);
var before = bm ? bm[0] : '';
var after = am ? am[0] : '';
... | [
"function",
"formatError",
"(",
"err",
",",
"input",
")",
"{",
"var",
"msg",
"=",
"err",
".",
"message",
".",
"replace",
"(",
"/",
"\\s*\\(\\d*\\:\\d*\\)\\s*$",
"/",
"i",
",",
"''",
")",
";",
"// remove line number / col number",
"var",
"bm",
"=",
"(",
"''... | Format the error as an error structure with line extract information | [
"Format",
"the",
"error",
"as",
"an",
"error",
"structure",
"with",
"line",
"extract",
"information"
] | c2db684299d907b2035fa427f030cf08da8ceb57 | https://github.com/ariatemplates/noder-js/blob/c2db684299d907b2035fa427f030cf08da8ceb57/src/plugins/noderError/evalError.js#L22-L46 |
53,586 | SolarNetwork/solarnetwork-d3 | src/ui/pixelWidth.js | sn_ui_pixelWidth | function sn_ui_pixelWidth(selector) {
if ( selector === undefined ) {
return undefined;
}
var styleWidth = d3.select(selector).style('width');
if ( !styleWidth ) {
return null;
}
var pixels = styleWidth.match(/([0-9.]+)px/);
if ( pixels === null ) {
return null;
}
var result = Math.floor(pixels[1]);
if ... | javascript | function sn_ui_pixelWidth(selector) {
if ( selector === undefined ) {
return undefined;
}
var styleWidth = d3.select(selector).style('width');
if ( !styleWidth ) {
return null;
}
var pixels = styleWidth.match(/([0-9.]+)px/);
if ( pixels === null ) {
return null;
}
var result = Math.floor(pixels[1]);
if ... | [
"function",
"sn_ui_pixelWidth",
"(",
"selector",
")",
"{",
"if",
"(",
"selector",
"===",
"undefined",
")",
"{",
"return",
"undefined",
";",
"}",
"var",
"styleWidth",
"=",
"d3",
".",
"select",
"(",
"selector",
")",
".",
"style",
"(",
"'width'",
")",
";",
... | Get the width of an element based on a selector, in pixels.
@param {string} selector - a selector to an element to get the width of
@returns {number} the width, or {@code undefined} if {@code selector} is undefined,
or {@code null} if the width cannot be computed in pixels | [
"Get",
"the",
"width",
"of",
"an",
"element",
"based",
"on",
"a",
"selector",
"in",
"pixels",
"."
] | 26848b1c303b98b7c0ddeefb8c68c5f5bf78927e | https://github.com/SolarNetwork/solarnetwork-d3/blob/26848b1c303b98b7c0ddeefb8c68c5f5bf78927e/src/ui/pixelWidth.js#L12-L29 |
53,587 | moxystudio/react-redata | src/redata.js | create | function create(loader, shouldReload = defaultShouldReload, mapper = defaultMapper, initialCtx = defaultInitialCtx) {
// Initialise context, which is passed around and holds the lastData.
const ctx = initialCtx; // TODO: instead of providing a full initial context, the redata() function below should receive
... | javascript | function create(loader, shouldReload = defaultShouldReload, mapper = defaultMapper, initialCtx = defaultInitialCtx) {
// Initialise context, which is passed around and holds the lastData.
const ctx = initialCtx; // TODO: instead of providing a full initial context, the redata() function below should receive
... | [
"function",
"create",
"(",
"loader",
",",
"shouldReload",
"=",
"defaultShouldReload",
",",
"mapper",
"=",
"defaultMapper",
",",
"initialCtx",
"=",
"defaultInitialCtx",
")",
"{",
"// Initialise context, which is passed around and holds the lastData.",
"const",
"ctx",
"=",
... | redata's data object definition
@typedef {Object} Data
@property {boolean} loading - true if the loader is still running, false otherwise.
@property {error} error - instance of Error in case the loader failed, undefined otherwise.
@property {*} result - result of the loader, or undefined if the loader is still running.... | [
"redata",
"s",
"data",
"object",
"definition"
] | 19f5c548b8dbc3f71fb14077e9740f9dd62bb10a | https://github.com/moxystudio/react-redata/blob/19f5c548b8dbc3f71fb14077e9740f9dd62bb10a/src/redata.js#L20-L57 |
53,588 | molnarg/node-http2-protocol | example/client.js | onConnection | function onConnection() {
var endpoint = new http2.Endpoint(log, 'CLIENT', {});
endpoint.pipe(socket).pipe(endpoint);
// Sending request
var stream = endpoint.createStream();
stream.headers({
':method': 'GET',
':scheme': url.protocol.slice(0, url.protocol.length - 1),
':authority': url.hostname,
... | javascript | function onConnection() {
var endpoint = new http2.Endpoint(log, 'CLIENT', {});
endpoint.pipe(socket).pipe(endpoint);
// Sending request
var stream = endpoint.createStream();
stream.headers({
':method': 'GET',
':scheme': url.protocol.slice(0, url.protocol.length - 1),
':authority': url.hostname,
... | [
"function",
"onConnection",
"(",
")",
"{",
"var",
"endpoint",
"=",
"new",
"http2",
".",
"Endpoint",
"(",
"log",
",",
"'CLIENT'",
",",
"{",
"}",
")",
";",
"endpoint",
".",
"pipe",
"(",
"socket",
")",
".",
"pipe",
"(",
"endpoint",
")",
";",
"// Sending... | Handling the connection | [
"Handling",
"the",
"connection"
] | a03dff630a33771d045ac0362023afb84b441aa4 | https://github.com/molnarg/node-http2-protocol/blob/a03dff630a33771d045ac0362023afb84b441aa4/example/client.js#L25-L49 |
53,589 | thlorenz/node-traceur | demo/generators.js | iterateElements | function iterateElements(array) {
return {
__iterator__: function() {
var index = 0;
var current;
return {
get current() {
return current;
},
moveNext: function() {
if (index < array.length) {
current = array[index++];
return tr... | javascript | function iterateElements(array) {
return {
__iterator__: function() {
var index = 0;
var current;
return {
get current() {
return current;
},
moveNext: function() {
if (index < array.length) {
current = array[index++];
return tr... | [
"function",
"iterateElements",
"(",
"array",
")",
"{",
"return",
"{",
"__iterator__",
":",
"function",
"(",
")",
"{",
"var",
"index",
"=",
"0",
";",
"var",
"current",
";",
"return",
"{",
"get",
"current",
"(",
")",
"{",
"return",
"current",
";",
"}",
... | Example 1. Writing an iterator over an array | [
"Example",
"1",
".",
"Writing",
"an",
"iterator",
"over",
"an",
"array"
] | 79a21ad03831ba36df504988b05022404ad8f9c3 | https://github.com/thlorenz/node-traceur/blob/79a21ad03831ba36df504988b05022404ad8f9c3/demo/generators.js#L4-L23 |
53,590 | BetterCallSky/decorate-it | dist/decorator.js | validate | function validate(method) {
var decorated = function validateDecorator() {
var params = method.params;
var schema = method.schema;
for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
args[_key2] = arguments[_key2];
}
var value = _combineObject(param... | javascript | function validate(method) {
var decorated = function validateDecorator() {
var params = method.params;
var schema = method.schema;
for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
args[_key2] = arguments[_key2];
}
var value = _combineObject(param... | [
"function",
"validate",
"(",
"method",
")",
"{",
"var",
"decorated",
"=",
"function",
"validateDecorator",
"(",
")",
"{",
"var",
"params",
"=",
"method",
".",
"params",
";",
"var",
"schema",
"=",
"method",
".",
"schema",
";",
"for",
"(",
"var",
"_len2",
... | Decorator for validating with Joi
@param {Function} method the method to decorate
@param {Array} method.params the method parameters
@param {Object} method.schema the joi schema
@param {Boolean} method.sync the flag if method is sync or async
@returns {Function} the decorator | [
"Decorator",
"for",
"validating",
"with",
"Joi"
] | 8807a65c80a88255227c4ce818d151b4dc979683 | https://github.com/BetterCallSky/decorate-it/blob/8807a65c80a88255227c4ce818d151b4dc979683/dist/decorator.js#L218-L247 |
53,591 | BetterCallSky/decorate-it | dist/decorator.js | decorate | function decorate(service, serviceName) {
var logger = _config.loggerFactory(serviceName, _config);
_lodash2.default.map(service, function (method, name) {
method.methodName = name;
if (!method.params) {
method.params = (0, _getParameterNames2.default)(method);
}
service[name] = log(validate(m... | javascript | function decorate(service, serviceName) {
var logger = _config.loggerFactory(serviceName, _config);
_lodash2.default.map(service, function (method, name) {
method.methodName = name;
if (!method.params) {
method.params = (0, _getParameterNames2.default)(method);
}
service[name] = log(validate(m... | [
"function",
"decorate",
"(",
"service",
",",
"serviceName",
")",
"{",
"var",
"logger",
"=",
"_config",
".",
"loggerFactory",
"(",
"serviceName",
",",
"_config",
")",
";",
"_lodash2",
".",
"default",
".",
"map",
"(",
"service",
",",
"function",
"(",
"method... | Decorate all methods in the service
@param {Object} service the service object
@param {String} serviceName the service name | [
"Decorate",
"all",
"methods",
"in",
"the",
"service"
] | 8807a65c80a88255227c4ce818d151b4dc979683 | https://github.com/BetterCallSky/decorate-it/blob/8807a65c80a88255227c4ce818d151b4dc979683/dist/decorator.js#L254-L263 |
53,592 | zenozeng/interval.js | lib/interval.js | Interval | function Interval(func, options) {
this.func = func;
this.delay = options.delay || 16;
this.lifetime = options.lifetime;
this.useRequestAnimationFrame = options.useRequestAnimationFrame && window.requestAnimationFrame && window.cancelAnimationFrame;
this.interval = null;
this.gcTimeout = null;
} | javascript | function Interval(func, options) {
this.func = func;
this.delay = options.delay || 16;
this.lifetime = options.lifetime;
this.useRequestAnimationFrame = options.useRequestAnimationFrame && window.requestAnimationFrame && window.cancelAnimationFrame;
this.interval = null;
this.gcTimeout = null;
} | [
"function",
"Interval",
"(",
"func",
",",
"options",
")",
"{",
"this",
".",
"func",
"=",
"func",
";",
"this",
".",
"delay",
"=",
"options",
".",
"delay",
"||",
"16",
";",
"this",
".",
"lifetime",
"=",
"options",
".",
"lifetime",
";",
"this",
".",
"... | Interval.js
@constructor
@param {function} func - The function you want to be called repeatly
@param {int} delay - milliseconds that should wait before each call
@param {int} lifetime - if set, clearInterval will be called after `lifetime` milliseconds | [
"Interval",
".",
"js"
] | 7a8d112378b44a0e2ae6f989c65d290200ea6485 | https://github.com/zenozeng/interval.js/blob/7a8d112378b44a0e2ae6f989c65d290200ea6485/lib/interval.js#L9-L16 |
53,593 | cirocosta/yaspm | src/Device.js | Device | function Device (device, sp) {
if (!(device && sp))
throw new Error('a Device and a SerialPort must be passed');
for (var i in device)
this[i] = device[i];
this._open = false;
this._sp = sp;
EventEmitter.call(this);
} | javascript | function Device (device, sp) {
if (!(device && sp))
throw new Error('a Device and a SerialPort must be passed');
for (var i in device)
this[i] = device[i];
this._open = false;
this._sp = sp;
EventEmitter.call(this);
} | [
"function",
"Device",
"(",
"device",
",",
"sp",
")",
"{",
"if",
"(",
"!",
"(",
"device",
"&&",
"sp",
")",
")",
"throw",
"new",
"Error",
"(",
"'a Device and a SerialPort must be passed'",
")",
";",
"for",
"(",
"var",
"i",
"in",
"device",
")",
"this",
"[... | Represents a valid Device.
emits:
- connect
- disconnect
- error
@param {obj} device the info about the device
@param {obj} sp serialport object | [
"Represents",
"a",
"valid",
"Device",
"."
] | 676524906425ba99b1e6f95a75ce4a82501a0ee9 | https://github.com/cirocosta/yaspm/blob/676524906425ba99b1e6f95a75ce4a82501a0ee9/src/Device.js#L21-L32 |
53,594 | NumminorihSF/bramqp-wrapper | domain/exchange.js | Exchange | function Exchange(client, channel){
EE.call(this);
this.client = client;
this.channel = channel;
this.id = channel.$getId();
return this;
} | javascript | function Exchange(client, channel){
EE.call(this);
this.client = client;
this.channel = channel;
this.id = channel.$getId();
return this;
} | [
"function",
"Exchange",
"(",
"client",
",",
"channel",
")",
"{",
"EE",
".",
"call",
"(",
"this",
")",
";",
"this",
".",
"client",
"=",
"client",
";",
"this",
".",
"channel",
"=",
"channel",
";",
"this",
".",
"id",
"=",
"channel",
".",
"$getId",
"("... | Work with exchanges.
Exchanges match and distribute messages across queues.
Exchanges can be configured in the server or declared at runtime.
@extends EventEmitter
@param {BRAMQPClient} client Client object that returns from bramqp#openAMQPCommunication() method.
@param {Channel} channel Channel object (should be open... | [
"Work",
"with",
"exchanges",
"."
] | 3e2bd769a2828f7592eba79556c9ef1491177781 | https://github.com/NumminorihSF/bramqp-wrapper/blob/3e2bd769a2828f7592eba79556c9ef1491177781/domain/exchange.js#L26-L33 |
53,595 | brandtabbott/spotify-server | public/js/spotify-client.js | sortByAttributeNameComparitor | function sortByAttributeNameComparitor(a,b) {
if (a.attributes.name < b.attributes.name)
return -1;
if (a.attributes.name > b.attributes.name)
return 1;
return 0;
} | javascript | function sortByAttributeNameComparitor(a,b) {
if (a.attributes.name < b.attributes.name)
return -1;
if (a.attributes.name > b.attributes.name)
return 1;
return 0;
} | [
"function",
"sortByAttributeNameComparitor",
"(",
"a",
",",
"b",
")",
"{",
"if",
"(",
"a",
".",
"attributes",
".",
"name",
"<",
"b",
".",
"attributes",
".",
"name",
")",
"return",
"-",
"1",
";",
"if",
"(",
"a",
".",
"attributes",
".",
"name",
">",
... | Sort function for playlists | [
"Sort",
"function",
"for",
"playlists"
] | d4451e64faaa201c620a118f4978f3c1b514386f | https://github.com/brandtabbott/spotify-server/blob/d4451e64faaa201c620a118f4978f3c1b514386f/public/js/spotify-client.js#L207-L214 |
53,596 | ashpool/telldus-live-promise | lib/devices.js | turnOn | function turnOn(device) {
return api.request('/device/turnOn?' + querystring.stringify({id: device.id || device}));
} | javascript | function turnOn(device) {
return api.request('/device/turnOn?' + querystring.stringify({id: device.id || device}));
} | [
"function",
"turnOn",
"(",
"device",
")",
"{",
"return",
"api",
".",
"request",
"(",
"'/device/turnOn?'",
"+",
"querystring",
".",
"stringify",
"(",
"{",
"id",
":",
"device",
".",
"id",
"||",
"device",
"}",
")",
")",
";",
"}"
] | Turns a device off
@param device either {id: anId} or anId
@returns {*} a Promise | [
"Turns",
"a",
"device",
"off"
] | ee13365136da640d78907f468b19580bdd8545d8 | https://github.com/ashpool/telldus-live-promise/blob/ee13365136da640d78907f468b19580bdd8545d8/lib/devices.js#L17-L19 |
53,597 | ashpool/telldus-live-promise | lib/devices.js | turnOff | function turnOff(device) {
return api.request('/device/turnOff?' + querystring.stringify({id: device.id || device}));
} | javascript | function turnOff(device) {
return api.request('/device/turnOff?' + querystring.stringify({id: device.id || device}));
} | [
"function",
"turnOff",
"(",
"device",
")",
"{",
"return",
"api",
".",
"request",
"(",
"'/device/turnOff?'",
"+",
"querystring",
".",
"stringify",
"(",
"{",
"id",
":",
"device",
".",
"id",
"||",
"device",
"}",
")",
")",
";",
"}"
] | Turns a device on
@param device either {id: anId} or anId
@returns {*} a Promise | [
"Turns",
"a",
"device",
"on"
] | ee13365136da640d78907f468b19580bdd8545d8 | https://github.com/ashpool/telldus-live-promise/blob/ee13365136da640d78907f468b19580bdd8545d8/lib/devices.js#L26-L28 |
53,598 | ashpool/telldus-live-promise | lib/devices.js | history | function history(device, from, to) {
return api.request('/device/history?' + querystring.stringify({id: device.id || device, from: from, to: to}));
} | javascript | function history(device, from, to) {
return api.request('/device/history?' + querystring.stringify({id: device.id || device, from: from, to: to}));
} | [
"function",
"history",
"(",
"device",
",",
"from",
",",
"to",
")",
"{",
"return",
"api",
".",
"request",
"(",
"'/device/history?'",
"+",
"querystring",
".",
"stringify",
"(",
"{",
"id",
":",
"device",
".",
"id",
"||",
"device",
",",
"from",
":",
"from"... | Returns device history
@param device either {id: anId} or anId
@param from timestamp in seconds
@param to timestamp in seconds
@returns {*} a Promise | [
"Returns",
"device",
"history"
] | ee13365136da640d78907f468b19580bdd8545d8 | https://github.com/ashpool/telldus-live-promise/blob/ee13365136da640d78907f468b19580bdd8545d8/lib/devices.js#L37-L39 |
53,599 | iolo/express-toybox | multipart.js | multipart | function multipart(options) {
options = options || {};
DEBUG && debug('configure http multipart middleware', options);
return function (req, res, next) {
if (req._body || !req.is('multipart/form-data') || 'POST' !== req.method) {
return next();
}
DEBUG && debug('got mult... | javascript | function multipart(options) {
options = options || {};
DEBUG && debug('configure http multipart middleware', options);
return function (req, res, next) {
if (req._body || !req.is('multipart/form-data') || 'POST' !== req.method) {
return next();
}
DEBUG && debug('got mult... | [
"function",
"multipart",
"(",
"options",
")",
"{",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"DEBUG",
"&&",
"debug",
"(",
"'configure http multipart middleware'",
",",
"options",
")",
";",
"return",
"function",
"(",
"req",
",",
"res",
",",
"next",
")... | multipart middleware using "multiparty".
@param {*} [options]
@param {String} [encoding='utf8']
@param {String} [uploadDir=os.tmpdir()]
@param {String} [keepExtensions=false]
@param {Number} [maxFields=2*1024*1024]
@param {Number} [maxFieldsSize=1000]
@param {Number} [maxFilesSize=Infinity]
@param {String} [hash=false... | [
"multipart",
"middleware",
"using",
"multiparty",
"."
] | c375a1388cfc167017e8dcd2325e71ca86ccb994 | https://github.com/iolo/express-toybox/blob/c375a1388cfc167017e8dcd2325e71ca86ccb994/multipart.js#L28-L51 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.