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 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
vkiding/judpack-lib | src/cordova/util.js | cdProjectRoot | function cdProjectRoot(dir) {
var projectRoot = this.isCordova(dir);
if (!projectRoot) {
throw new CordovaError('Current working directory is not a judpack project.');
}
if (!origCwd) {
origCwd = process.env.PWD || process.cwd();
}
process.env.PWD = projectRoot;
process.chdir... | javascript | function cdProjectRoot(dir) {
var projectRoot = this.isCordova(dir);
if (!projectRoot) {
throw new CordovaError('Current working directory is not a judpack project.');
}
if (!origCwd) {
origCwd = process.env.PWD || process.cwd();
}
process.env.PWD = projectRoot;
process.chdir... | [
"function",
"cdProjectRoot",
"(",
"dir",
")",
"{",
"var",
"projectRoot",
"=",
"this",
".",
"isCordova",
"(",
"dir",
")",
";",
"if",
"(",
"!",
"projectRoot",
")",
"{",
"throw",
"new",
"CordovaError",
"(",
"'Current working directory is not a judpack project.'",
"... | Cd to project root dir and return its path. Throw CordovaError if not in a Corodva project. | [
"Cd",
"to",
"project",
"root",
"dir",
"and",
"return",
"its",
"path",
".",
"Throw",
"CordovaError",
"if",
"not",
"in",
"a",
"Corodva",
"project",
"."
] | 8657cecfec68221109279106adca8dbc81f430f4 | https://github.com/vkiding/judpack-lib/blob/8657cecfec68221109279106adca8dbc81f430f4/src/cordova/util.js#L160-L171 | train |
vkiding/judpack-lib | src/cordova/util.js | deleteSvnFolders | function deleteSvnFolders(dir) {
var contents = fs.readdirSync(dir);
contents.forEach(function(entry) {
var fullpath = path.join(dir, entry);
if (fs.statSync(fullpath).isDirectory()) {
if (entry == '.svn') {
shell.rm('-rf', fullpath);
} else module.exports... | javascript | function deleteSvnFolders(dir) {
var contents = fs.readdirSync(dir);
contents.forEach(function(entry) {
var fullpath = path.join(dir, entry);
if (fs.statSync(fullpath).isDirectory()) {
if (entry == '.svn') {
shell.rm('-rf', fullpath);
} else module.exports... | [
"function",
"deleteSvnFolders",
"(",
"dir",
")",
"{",
"var",
"contents",
"=",
"fs",
".",
"readdirSync",
"(",
"dir",
")",
";",
"contents",
".",
"forEach",
"(",
"function",
"(",
"entry",
")",
"{",
"var",
"fullpath",
"=",
"path",
".",
"join",
"(",
"dir",
... | Recursively deletes .svn folders from a target path | [
"Recursively",
"deletes",
".",
"svn",
"folders",
"from",
"a",
"target",
"path"
] | 8657cecfec68221109279106adca8dbc81f430f4 | https://github.com/vkiding/judpack-lib/blob/8657cecfec68221109279106adca8dbc81f430f4/src/cordova/util.js#L204-L214 | train |
vkiding/judpack-lib | src/cordova/util.js | findPlugins | function findPlugins(pluginPath) {
var plugins = [],
stats;
if (exports.existsSync(pluginPath)) {
plugins = fs.readdirSync(pluginPath).filter(function (fileName) {
stats = fs.statSync(path.join(pluginPath, fileName));
return fileName != '.svn' && fileName != 'CVS' && sta... | javascript | function findPlugins(pluginPath) {
var plugins = [],
stats;
if (exports.existsSync(pluginPath)) {
plugins = fs.readdirSync(pluginPath).filter(function (fileName) {
stats = fs.statSync(path.join(pluginPath, fileName));
return fileName != '.svn' && fileName != 'CVS' && sta... | [
"function",
"findPlugins",
"(",
"pluginPath",
")",
"{",
"var",
"plugins",
"=",
"[",
"]",
",",
"stats",
";",
"if",
"(",
"exports",
".",
"existsSync",
"(",
"pluginPath",
")",
")",
"{",
"plugins",
"=",
"fs",
".",
"readdirSync",
"(",
"pluginPath",
")",
"."... | list the directories in the path, ignoring any files | [
"list",
"the",
"directories",
"in",
"the",
"path",
"ignoring",
"any",
"files"
] | 8657cecfec68221109279106adca8dbc81f430f4 | https://github.com/vkiding/judpack-lib/blob/8657cecfec68221109279106adca8dbc81f430f4/src/cordova/util.js#L246-L258 | train |
vkiding/judpack-lib | src/cordova/util.js | getAvailableNpmVersions | function getAvailableNpmVersions(module_name) {
var npm = require('npm');
return Q.nfcall(npm.load).then(function () {
return Q.ninvoke(npm.commands, 'view', [module_name, 'versions'], /* silent = */ true).then(function (result) {
// result is an object in the form:
// {'<ver... | javascript | function getAvailableNpmVersions(module_name) {
var npm = require('npm');
return Q.nfcall(npm.load).then(function () {
return Q.ninvoke(npm.commands, 'view', [module_name, 'versions'], /* silent = */ true).then(function (result) {
// result is an object in the form:
// {'<ver... | [
"function",
"getAvailableNpmVersions",
"(",
"module_name",
")",
"{",
"var",
"npm",
"=",
"require",
"(",
"'npm'",
")",
";",
"return",
"Q",
".",
"nfcall",
"(",
"npm",
".",
"load",
")",
".",
"then",
"(",
"function",
"(",
")",
"{",
"return",
"Q",
".",
"n... | Returns a promise for an array of versions available for the specified npm module.
@param {string} module_name - npm module name.
@returns {Promise} Promise for an array of versions. | [
"Returns",
"a",
"promise",
"for",
"an",
"array",
"of",
"versions",
"available",
"for",
"the",
"specified",
"npm",
"module",
"."
] | 8657cecfec68221109279106adca8dbc81f430f4 | https://github.com/vkiding/judpack-lib/blob/8657cecfec68221109279106adca8dbc81f430f4/src/cordova/util.js#L438-L448 | train |
redisjs/jsr-server | lib/command/server/flushall.js | execute | function execute(req, res) {
// TODO: ensure a conflict is triggered on all watched keys
this.store.flushall();
res.send(null, Constants.OK);
} | javascript | function execute(req, res) {
// TODO: ensure a conflict is triggered on all watched keys
this.store.flushall();
res.send(null, Constants.OK);
} | [
"function",
"execute",
"(",
"req",
",",
"res",
")",
"{",
"// TODO: ensure a conflict is triggered on all watched keys",
"this",
".",
"store",
".",
"flushall",
"(",
")",
";",
"res",
".",
"send",
"(",
"null",
",",
"Constants",
".",
"OK",
")",
";",
"}"
] | Respond to the FLUSHALL command. | [
"Respond",
"to",
"the",
"FLUSHALL",
"command",
"."
] | 49413052d3039524fbdd2ade0ef9bae26cb4d647 | https://github.com/redisjs/jsr-server/blob/49413052d3039524fbdd2ade0ef9bae26cb4d647/lib/command/server/flushall.js#L17-L21 | train |
solid-live/solidbot | lib/bots/chain.js | bot | function bot(job, done) {
var jobs = job.data.jobs
console.log(job.data.jobs)
if (!jobs) {
done()
return
}
for (var i = 0; i < jobs.length; i++) {
var j = jobs[i]
debug('Running : ' + j)
}
done()
} | javascript | function bot(job, done) {
var jobs = job.data.jobs
console.log(job.data.jobs)
if (!jobs) {
done()
return
}
for (var i = 0; i < jobs.length; i++) {
var j = jobs[i]
debug('Running : ' + j)
}
done()
} | [
"function",
"bot",
"(",
"job",
",",
"done",
")",
"{",
"var",
"jobs",
"=",
"job",
".",
"data",
".",
"jobs",
"console",
".",
"log",
"(",
"job",
".",
"data",
".",
"jobs",
")",
"if",
"(",
"!",
"jobs",
")",
"{",
"done",
"(",
")",
"return",
"}",
"f... | runs a chained command
@param {object} job A kue job.
@param {object} done Called after done. | [
"runs",
"a",
"chained",
"command"
] | c91bfef38ab01f7f88fb6bf1b1bc4875aea0ceda | https://github.com/solid-live/solidbot/blob/c91bfef38ab01f7f88fb6bf1b1bc4875aea0ceda/lib/bots/chain.js#L12-L27 | train |
Fovea/jackbone | examples/todolist/js/main.js | function($li, model) {
$li.attr('todo-cid', model.cid);
$li.toggleClass('todo-done', model.done);
$li.text(model.title);
} | javascript | function($li, model) {
$li.attr('todo-cid', model.cid);
$li.toggleClass('todo-done', model.done);
$li.text(model.title);
} | [
"function",
"(",
"$li",
",",
"model",
")",
"{",
"$li",
".",
"attr",
"(",
"'todo-cid'",
",",
"model",
".",
"cid",
")",
";",
"$li",
".",
"toggleClass",
"(",
"'todo-done'",
",",
"model",
".",
"done",
")",
";",
"$li",
".",
"text",
"(",
"model",
".",
... | Change a row in the list | [
"Change",
"a",
"row",
"in",
"the",
"list"
] | 94631030d20c6ff5c331cb824e135120f60c4ff2 | https://github.com/Fovea/jackbone/blob/94631030d20c6ff5c331cb824e135120f60c4ff2/examples/todolist/js/main.js#L85-L89 | train | |
Fovea/jackbone | examples/todolist/js/main.js | function (e) {
if (e && e.preventDefault) e.preventDefault();
var $el = $(e.target);
var cid = $el.attr('todo-cid');
if (cid) {
this.options.toggleItem(cid);
}
return false;
} | javascript | function (e) {
if (e && e.preventDefault) e.preventDefault();
var $el = $(e.target);
var cid = $el.attr('todo-cid');
if (cid) {
this.options.toggleItem(cid);
}
return false;
} | [
"function",
"(",
"e",
")",
"{",
"if",
"(",
"e",
"&&",
"e",
".",
"preventDefault",
")",
"e",
".",
"preventDefault",
"(",
")",
";",
"var",
"$el",
"=",
"$",
"(",
"e",
".",
"target",
")",
";",
"var",
"cid",
"=",
"$el",
".",
"attr",
"(",
"'todo-cid'... | Handles click on the listview Retrieves the cid of the object, calls Controller's `toggleItem` method if the clicked element contains a valid `todo-cid`. | [
"Handles",
"click",
"on",
"the",
"listview",
"Retrieves",
"the",
"cid",
"of",
"the",
"object",
"calls",
"Controller",
"s",
"toggleItem",
"method",
"if",
"the",
"clicked",
"element",
"contains",
"a",
"valid",
"todo",
"-",
"cid",
"."
] | 94631030d20c6ff5c331cb824e135120f60c4ff2 | https://github.com/Fovea/jackbone/blob/94631030d20c6ff5c331cb824e135120f60c4ff2/examples/todolist/js/main.js#L134-L142 | train | |
chatphrase/caress | lib/caress.js | parseTextBody | function parseTextBody(req, res, next){
if (req.body === undefined) {
req.body = '';
req.on('data', function(chunk){ req.body += chunk });
req.on('end', next);
} else {
next();
}
} | javascript | function parseTextBody(req, res, next){
if (req.body === undefined) {
req.body = '';
req.on('data', function(chunk){ req.body += chunk });
req.on('end', next);
} else {
next();
}
} | [
"function",
"parseTextBody",
"(",
"req",
",",
"res",
",",
"next",
")",
"{",
"if",
"(",
"req",
".",
"body",
"===",
"undefined",
")",
"{",
"req",
".",
"body",
"=",
"''",
";",
"req",
".",
"on",
"(",
"'data'",
",",
"function",
"(",
"chunk",
")",
"{",... | Middleware to handle text bodies. | [
"Middleware",
"to",
"handle",
"text",
"bodies",
"."
] | 1634c127e90c8140baf5e2803a2938ffaf0414c4 | https://github.com/chatphrase/caress/blob/1634c127e90c8140baf5e2803a2938ffaf0414c4/lib/caress.js#L33-L41 | train |
noblesamurai/noblerecord | src/model.js | reload | function reload() {
var params = {}
params[model.primary] = me[model.primary]
var act = new NobleMachine(model.find(params));
act.next(function(newInst) {
if (newInst) {
for (var col in model.columns) {
me[col] = newInst[col];
}
act.toNext(me);
} else {
for (var key i... | javascript | function reload() {
var params = {}
params[model.primary] = me[model.primary]
var act = new NobleMachine(model.find(params));
act.next(function(newInst) {
if (newInst) {
for (var col in model.columns) {
me[col] = newInst[col];
}
act.toNext(me);
} else {
for (var key i... | [
"function",
"reload",
"(",
")",
"{",
"var",
"params",
"=",
"{",
"}",
"params",
"[",
"model",
".",
"primary",
"]",
"=",
"me",
"[",
"model",
".",
"primary",
"]",
"var",
"act",
"=",
"new",
"NobleMachine",
"(",
"model",
".",
"find",
"(",
"params",
")",... | Reloads the object's properties with the current database values. | [
"Reloads",
"the",
"object",
"s",
"properties",
"with",
"the",
"current",
"database",
"values",
"."
] | fc7d3aac186598c4c7023f5448979d4162ab5e38 | https://github.com/noblesamurai/noblerecord/blob/fc7d3aac186598c4c7023f5448979d4162ab5e38/src/model.js#L120-L144 | train |
noblesamurai/noblerecord | src/model.js | destroy | function destroy() {
var act = new NobleMachine(function() {
if (me.onDestroy) {
var preact = me.onDestroy();
if (preact && preact.start instanceof Function) {
act.toNext(preact)
return;
}
}
});
act.next(function() {
var sql = "DELETE FROM " + model.table
+ " WHERE... | javascript | function destroy() {
var act = new NobleMachine(function() {
if (me.onDestroy) {
var preact = me.onDestroy();
if (preact && preact.start instanceof Function) {
act.toNext(preact)
return;
}
}
});
act.next(function() {
var sql = "DELETE FROM " + model.table
+ " WHERE... | [
"function",
"destroy",
"(",
")",
"{",
"var",
"act",
"=",
"new",
"NobleMachine",
"(",
"function",
"(",
")",
"{",
"if",
"(",
"me",
".",
"onDestroy",
")",
"{",
"var",
"preact",
"=",
"me",
".",
"onDestroy",
"(",
")",
";",
"if",
"(",
"preact",
"&&",
"... | Removes this object's corresponding database row. | [
"Removes",
"this",
"object",
"s",
"corresponding",
"database",
"row",
"."
] | fc7d3aac186598c4c7023f5448979d4162ab5e38 | https://github.com/noblesamurai/noblerecord/blob/fc7d3aac186598c4c7023f5448979d4162ab5e38/src/model.js#L149-L181 | train |
noblesamurai/noblerecord | src/model.js | setValue | function setValue(key, val) {
//util.log(key + ": " + JSON.stringify(val));
if (val === null) {
me.values[key] = null;
} else if (val === undefined) {
me.values[key] = undefined;
} else {
type = model.columns[key]['DATA_TYPE'];
switch (type) {
case 'datetime':
case 'timestamp':
... | javascript | function setValue(key, val) {
//util.log(key + ": " + JSON.stringify(val));
if (val === null) {
me.values[key] = null;
} else if (val === undefined) {
me.values[key] = undefined;
} else {
type = model.columns[key]['DATA_TYPE'];
switch (type) {
case 'datetime':
case 'timestamp':
... | [
"function",
"setValue",
"(",
"key",
",",
"val",
")",
"{",
"//util.log(key + \": \" + JSON.stringify(val));",
"if",
"(",
"val",
"===",
"null",
")",
"{",
"me",
".",
"values",
"[",
"key",
"]",
"=",
"null",
";",
"}",
"else",
"if",
"(",
"val",
"===",
"undefin... | Generic setter for SQL-correspondent values. Forces typecasting for database compatibility. | [
"Generic",
"setter",
"for",
"SQL",
"-",
"correspondent",
"values",
".",
"Forces",
"typecasting",
"for",
"database",
"compatibility",
"."
] | fc7d3aac186598c4c7023f5448979d4162ab5e38 | https://github.com/noblesamurai/noblerecord/blob/fc7d3aac186598c4c7023f5448979d4162ab5e38/src/model.js#L184-L215 | train |
Nazariglez/perenquen | lib/pixi/src/interaction/InteractionManager.js | InteractionManager | function InteractionManager(renderer, options)
{
options = options || {};
/**
* The renderer this interaction manager works for.
*
* @member {SystemRenderer}
*/
this.renderer = renderer;
/**
* Should default browser actions automatically be prevented.
*
* @member {bo... | javascript | function InteractionManager(renderer, options)
{
options = options || {};
/**
* The renderer this interaction manager works for.
*
* @member {SystemRenderer}
*/
this.renderer = renderer;
/**
* Should default browser actions automatically be prevented.
*
* @member {bo... | [
"function",
"InteractionManager",
"(",
"renderer",
",",
"options",
")",
"{",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"/**\n * The renderer this interaction manager works for.\n *\n * @member {SystemRenderer}\n */",
"this",
".",
"renderer",
"=",
"render... | The interaction manager deals with mouse and touch events. Any DisplayObject can be interactive
if its interactive parameter is set to true
This manager also supports multitouch.
@class
@memberof PIXI.interaction
@param renderer {CanvasRenderer|WebGLRenderer} A reference to the current renderer
@param [options] {objec... | [
"The",
"interaction",
"manager",
"deals",
"with",
"mouse",
"and",
"touch",
"events",
".",
"Any",
"DisplayObject",
"can",
"be",
"interactive",
"if",
"its",
"interactive",
"parameter",
"is",
"set",
"to",
"true",
"This",
"manager",
"also",
"supports",
"multitouch",... | e023964d05afeefebdcac4e2044819fdfa3899ae | https://github.com/Nazariglez/perenquen/blob/e023964d05afeefebdcac4e2044819fdfa3899ae/lib/pixi/src/interaction/InteractionManager.js#L22-L165 | train |
integreat-io/great-uri-template | lib/filters/lower.js | lower | function lower (value) {
if (value === null || value === undefined) {
return value
}
return String.prototype.toLowerCase.call(value)
} | javascript | function lower (value) {
if (value === null || value === undefined) {
return value
}
return String.prototype.toLowerCase.call(value)
} | [
"function",
"lower",
"(",
"value",
")",
"{",
"if",
"(",
"value",
"===",
"null",
"||",
"value",
"===",
"undefined",
")",
"{",
"return",
"value",
"}",
"return",
"String",
".",
"prototype",
".",
"toLowerCase",
".",
"call",
"(",
"value",
")",
"}"
] | Returns the value in lower case.
@param {string} value - The value
@returns {string} Lower case value | [
"Returns",
"the",
"value",
"in",
"lower",
"case",
"."
] | 0e896ead0567737cf31a4a8b76a26cfa6ce60759 | https://github.com/integreat-io/great-uri-template/blob/0e896ead0567737cf31a4a8b76a26cfa6ce60759/lib/filters/lower.js#L6-L11 | train |
dalekjs/dalek-reporter-html | index.js | Reporter | function Reporter (opts) {
this.events = opts.events;
this.config = opts.config;
this.temporaryAssertions = [];
this.temp = {};
var defaultReportFolder = 'report/dalek';
this.dest = this.config.get('html-reporter') && this.config.get('html-reporter').dest ? this.config.get('html-reporter').dest : defaultRe... | javascript | function Reporter (opts) {
this.events = opts.events;
this.config = opts.config;
this.temporaryAssertions = [];
this.temp = {};
var defaultReportFolder = 'report/dalek';
this.dest = this.config.get('html-reporter') && this.config.get('html-reporter').dest ? this.config.get('html-reporter').dest : defaultRe... | [
"function",
"Reporter",
"(",
"opts",
")",
"{",
"this",
".",
"events",
"=",
"opts",
".",
"events",
";",
"this",
".",
"config",
"=",
"opts",
".",
"config",
";",
"this",
".",
"temporaryAssertions",
"=",
"[",
"]",
";",
"this",
".",
"temp",
"=",
"{",
"}... | The HTML reporter can produce a set of HTML files with the results of your testrun.
The reporter can be installed with the following command:
```bash
$ npm install dalek-reporter-html --save-dev
```
By default the files will be written to the `report/dalek/` folder,
you can change this by adding a config option to t... | [
"The",
"HTML",
"reporter",
"can",
"produce",
"a",
"set",
"of",
"HTML",
"files",
"with",
"the",
"results",
"of",
"your",
"testrun",
"."
] | af32ea029e2341a6c9705c38f071f9d9d93a66dd | https://github.com/dalekjs/dalek-reporter-html/blob/af32ea029e2341a6c9705c38f071f9d9d93a66dd/index.js#L72-L84 | train |
dalekjs/dalek-reporter-html | index.js | function () {
// render stylesheets
var precss = fs.readFileSync(__dirname + '/themes/default/styl/default.styl', 'utf8');
stylus.render(precss, { filename: 'default.css' }, function(err, css){
if (err) {
throw err;
}
this.styles = css;
}.bind(this));
// collect client js... | javascript | function () {
// render stylesheets
var precss = fs.readFileSync(__dirname + '/themes/default/styl/default.styl', 'utf8');
stylus.render(precss, { filename: 'default.css' }, function(err, css){
if (err) {
throw err;
}
this.styles = css;
}.bind(this));
// collect client js... | [
"function",
"(",
")",
"{",
"// render stylesheets",
"var",
"precss",
"=",
"fs",
".",
"readFileSync",
"(",
"__dirname",
"+",
"'/themes/default/styl/default.styl'",
",",
"'utf8'",
")",
";",
"stylus",
".",
"render",
"(",
"precss",
",",
"{",
"filename",
":",
"'def... | Loads and prepares all the templates for
CSS, JS & HTML
@method loadTemplates
@chainable | [
"Loads",
"and",
"prepares",
"all",
"the",
"templates",
"for",
"CSS",
"JS",
"&",
"HTML"
] | af32ea029e2341a6c9705c38f071f9d9d93a66dd | https://github.com/dalekjs/dalek-reporter-html/blob/af32ea029e2341a6c9705c38f071f9d9d93a66dd/index.js#L121-L149 | train | |
dalekjs/dalek-reporter-html | index.js | function (data) {
this.detailContents.testResult = data;
this.detailContents.styles = this.styles;
this.detailContents.js = this.js;
fs.writeFileSync(this.dest + '/details/' + data.id + '.html', this.templates.detail(this.detailContents), 'utf8');
return this;
} | javascript | function (data) {
this.detailContents.testResult = data;
this.detailContents.styles = this.styles;
this.detailContents.js = this.js;
fs.writeFileSync(this.dest + '/details/' + data.id + '.html', this.templates.detail(this.detailContents), 'utf8');
return this;
} | [
"function",
"(",
"data",
")",
"{",
"this",
".",
"detailContents",
".",
"testResult",
"=",
"data",
";",
"this",
".",
"detailContents",
".",
"styles",
"=",
"this",
".",
"styles",
";",
"this",
".",
"detailContents",
".",
"js",
"=",
"this",
".",
"js",
";",... | Writes a detail page to the file system
@method finishDetailPage
@param {object} data Event data
@chainable | [
"Writes",
"a",
"detail",
"page",
"to",
"the",
"file",
"system"
] | af32ea029e2341a6c9705c38f071f9d9d93a66dd | https://github.com/dalekjs/dalek-reporter-html/blob/af32ea029e2341a6c9705c38f071f9d9d93a66dd/index.js#L223-L229 | train | |
dalekjs/dalek-reporter-html | index.js | function (data) {
var body = '';
var contents = '';
var tests = '';
var banner = '';
// add test results
var keys = Object.keys(this.output.test);
keys.forEach(function (key) {
tests += this.output.test[key];
}.bind(this));
// compile the test result template
body = this.... | javascript | function (data) {
var body = '';
var contents = '';
var tests = '';
var banner = '';
// add test results
var keys = Object.keys(this.output.test);
keys.forEach(function (key) {
tests += this.output.test[key];
}.bind(this));
// compile the test result template
body = this.... | [
"function",
"(",
"data",
")",
"{",
"var",
"body",
"=",
"''",
";",
"var",
"contents",
"=",
"''",
";",
"var",
"tests",
"=",
"''",
";",
"var",
"banner",
"=",
"''",
";",
"// add test results",
"var",
"keys",
"=",
"Object",
".",
"keys",
"(",
"this",
"."... | Writes the index page to the filesystem
@method outputRunnerFinished
@param {object} data Event data
@chainable | [
"Writes",
"the",
"index",
"page",
"to",
"the",
"filesystem"
] | af32ea029e2341a6c9705c38f071f9d9d93a66dd | https://github.com/dalekjs/dalek-reporter-html/blob/af32ea029e2341a6c9705c38f071f9d9d93a66dd/index.js#L252-L278 | train | |
dalekjs/dalek-reporter-html | index.js | function (data) {
data.assertionInfo = this.temporaryAssertions;
data.browser = this.temp.browser;
this.output.test[data.id] = this.templates.test(data);
this.temporaryAssertions = [];
return this;
} | javascript | function (data) {
data.assertionInfo = this.temporaryAssertions;
data.browser = this.temp.browser;
this.output.test[data.id] = this.templates.test(data);
this.temporaryAssertions = [];
return this;
} | [
"function",
"(",
"data",
")",
"{",
"data",
".",
"assertionInfo",
"=",
"this",
".",
"temporaryAssertions",
";",
"data",
".",
"browser",
"=",
"this",
".",
"temp",
".",
"browser",
";",
"this",
".",
"output",
".",
"test",
"[",
"data",
".",
"id",
"]",
"="... | Pushes an test result to the index output queue
@method outputTestFinished
@param {object} data Event data
@chainable | [
"Pushes",
"an",
"test",
"result",
"to",
"the",
"index",
"output",
"queue"
] | af32ea029e2341a6c9705c38f071f9d9d93a66dd | https://github.com/dalekjs/dalek-reporter-html/blob/af32ea029e2341a6c9705c38f071f9d9d93a66dd/index.js#L301-L307 | train | |
Meesayen/gladius-forge | index.js | function() {
var src = config.paths.src;
var out = config.paths.out;
src.base = src.base || 'src/';
src.styles = src.styles || 'styles/';
src.scripts = src.scripts || 'scripts/';
src.esnextExtension = src.esnextExtension || '.es6';
src.views = src.templates || '../views/';
src.partials = src.partials !... | javascript | function() {
var src = config.paths.src;
var out = config.paths.out;
src.base = src.base || 'src/';
src.styles = src.styles || 'styles/';
src.scripts = src.scripts || 'scripts/';
src.esnextExtension = src.esnextExtension || '.es6';
src.views = src.templates || '../views/';
src.partials = src.partials !... | [
"function",
"(",
")",
"{",
"var",
"src",
"=",
"config",
".",
"paths",
".",
"src",
";",
"var",
"out",
"=",
"config",
".",
"paths",
".",
"out",
";",
"src",
".",
"base",
"=",
"src",
".",
"base",
"||",
"'src/'",
";",
"src",
".",
"styles",
"=",
"src... | paths normalization helper | [
"paths",
"normalization",
"helper"
] | fa3e0280cf306f2b9232f302e1af7e9c54462199 | https://github.com/Meesayen/gladius-forge/blob/fa3e0280cf306f2b9232f302e1af7e9c54462199/index.js#L30-L62 | train | |
Meesayen/gladius-forge | index.js | function(_gulp, _config) {
if (!_gulp) {
throw 'Error: A Gulp instance should be passed to the gulpConfig method.';
}
gulp = _gulp;
config = _config || { paths: { src: {}, out: {} } };
plugins = elaboratePlugins();
paths = elaboratePaths();
lrport = _config.liveReloadPort || lrport;
server = _conf... | javascript | function(_gulp, _config) {
if (!_gulp) {
throw 'Error: A Gulp instance should be passed to the gulpConfig method.';
}
gulp = _gulp;
config = _config || { paths: { src: {}, out: {} } };
plugins = elaboratePlugins();
paths = elaboratePaths();
lrport = _config.liveReloadPort || lrport;
server = _conf... | [
"function",
"(",
"_gulp",
",",
"_config",
")",
"{",
"if",
"(",
"!",
"_gulp",
")",
"{",
"throw",
"'Error: A Gulp instance should be passed to the gulpConfig method.'",
";",
"}",
"gulp",
"=",
"_gulp",
";",
"config",
"=",
"_config",
"||",
"{",
"paths",
":",
"{",
... | Gladius Forge configuration function.
@param {Object} _gulp: The gulp instance created from the gulpfile.js
@param {Object} config: Configuration object | [
"Gladius",
"Forge",
"configuration",
"function",
"."
] | fa3e0280cf306f2b9232f302e1af7e9c54462199 | https://github.com/Meesayen/gladius-forge/blob/fa3e0280cf306f2b9232f302e1af7e9c54462199/index.js#L150-L168 | train | |
Meesayen/gladius-forge | index.js | function(addExtraWatchers) {
/* Watchers -------------------------------------------------------------- */
gulp.task('watch', ['serve'], function () {
gulp.watch(paths.src.es6, ['bundle-js:dev:clean']);
gulp.watch(paths.src.js, ['bundle-js:dev:clean']);
gulp.watch(paths.src.styles, ['styles']);
gulp... | javascript | function(addExtraWatchers) {
/* Watchers -------------------------------------------------------------- */
gulp.task('watch', ['serve'], function () {
gulp.watch(paths.src.es6, ['bundle-js:dev:clean']);
gulp.watch(paths.src.js, ['bundle-js:dev:clean']);
gulp.watch(paths.src.styles, ['styles']);
gulp... | [
"function",
"(",
"addExtraWatchers",
")",
"{",
"/* Watchers -------------------------------------------------------------- */",
"gulp",
".",
"task",
"(",
"'watch'",
",",
"[",
"'serve'",
"]",
",",
"function",
"(",
")",
"{",
"gulp",
".",
"watch",
"(",
"paths",
".",
... | Gladius Forge watchers setup function. It takes a list of extra watchers
to add to the process.
@param {list<function>} extraWatchers: List of extra watchers to add. | [
"Gladius",
"Forge",
"watchers",
"setup",
"function",
".",
"It",
"takes",
"a",
"list",
"of",
"extra",
"watchers",
"to",
"add",
"to",
"the",
"process",
"."
] | fa3e0280cf306f2b9232f302e1af7e9c54462199 | https://github.com/Meesayen/gladius-forge/blob/fa3e0280cf306f2b9232f302e1af7e9c54462199/index.js#L493-L504 | train | |
Meesayen/gladius-forge | index.js | function(extensions) {
var
extensions = extensions || {},
devExts = extensions.development || [],
testExts = extensions.test || [],
prodExts = extensions.production || [];
gulp.task('default', ['development']);
gulp.task('post-install-development', [
'karma:dev',
'styles',
'bundle-js... | javascript | function(extensions) {
var
extensions = extensions || {},
devExts = extensions.development || [],
testExts = extensions.test || [],
prodExts = extensions.production || [];
gulp.task('default', ['development']);
gulp.task('post-install-development', [
'karma:dev',
'styles',
'bundle-js... | [
"function",
"(",
"extensions",
")",
"{",
"var",
"extensions",
"=",
"extensions",
"||",
"{",
"}",
",",
"devExts",
"=",
"extensions",
".",
"development",
"||",
"[",
"]",
",",
"testExts",
"=",
"extensions",
".",
"test",
"||",
"[",
"]",
",",
"prodExts",
"=... | Gladius Forge main tasks setup function. It can extend main tasks with
extra externally defined tasks via an "extension" parameter.
@param {Object} extensions: object descriptor of extra tasks to add for
each main task. | [
"Gladius",
"Forge",
"main",
"tasks",
"setup",
"function",
".",
"It",
"can",
"extend",
"main",
"tasks",
"with",
"extra",
"externally",
"defined",
"tasks",
"via",
"an",
"extension",
"parameter",
"."
] | fa3e0280cf306f2b9232f302e1af7e9c54462199 | https://github.com/Meesayen/gladius-forge/blob/fa3e0280cf306f2b9232f302e1af7e9c54462199/index.js#L513-L549 | train | |
mprinc/qpp | index.js | function(name, resourcesNo, waitForMoreDemandingConsumers, debug){
/**
@memberof! qpp.SemaphoreMultiReservation#
@var {string} name - name of the semaphore
*/
this.name = name || "semaphore";
resourcesNo = resourcesNo || 1;
/**
@memberof! qpp.SemaphoreMultiReservation#
@private
@var {string} initia... | javascript | function(name, resourcesNo, waitForMoreDemandingConsumers, debug){
/**
@memberof! qpp.SemaphoreMultiReservation#
@var {string} name - name of the semaphore
*/
this.name = name || "semaphore";
resourcesNo = resourcesNo || 1;
/**
@memberof! qpp.SemaphoreMultiReservation#
@private
@var {string} initia... | [
"function",
"(",
"name",
",",
"resourcesNo",
",",
"waitForMoreDemandingConsumers",
",",
"debug",
")",
"{",
"/**\n\t\t@memberof! qpp.SemaphoreMultiReservation#\n\t\t@var {string} name - name of the semaphore\n\t\t*/",
"this",
".",
"name",
"=",
"name",
"||",
"\"semaphore\"",
";",... | Constructor function. Creates a new semaphore with optional name and resources number
@classdesc This is a class that provides promises enabled semaphores.
It differs from the class Semaphore (@see {@link qpp.Semaphore} ) in a way
it supports allocation of more than one resource in one wait() call
@example
Example of... | [
"Constructor",
"function",
".",
"Creates",
"a",
"new",
"semaphore",
"with",
"optional",
"name",
"and",
"resources",
"number"
] | 379d132c61b06d54dc532947c1bcd7029665739d | https://github.com/mprinc/qpp/blob/379d132c61b06d54dc532947c1bcd7029665739d/index.js#L362-L407 | train | |
mprinc/qpp | index.js | function(resourcesNo, debug){
resourcesNo = resourcesNo || 1;
/**
@memberof! qpp.SemaphoresHash#
@var {Array.<string,QPP.Semaphore>} semaphores - array hash of semaphores
*/
this.semaphores = {};
/**
@memberof! qpp.SemaphoresHash#
@private
@var {string} initialResources - initial (total) number of r... | javascript | function(resourcesNo, debug){
resourcesNo = resourcesNo || 1;
/**
@memberof! qpp.SemaphoresHash#
@var {Array.<string,QPP.Semaphore>} semaphores - array hash of semaphores
*/
this.semaphores = {};
/**
@memberof! qpp.SemaphoresHash#
@private
@var {string} initialResources - initial (total) number of r... | [
"function",
"(",
"resourcesNo",
",",
"debug",
")",
"{",
"resourcesNo",
"=",
"resourcesNo",
"||",
"1",
";",
"/**\n\t\t@memberof! qpp.SemaphoresHash#\n\t\t@var {Array.<string,QPP.Semaphore>} semaphores - array hash of semaphores\n\t\t*/",
"this",
".",
"semaphores",
"=",
"{",
"}",... | Constructor function. Creates a new SemaphoresHash with optional and resources number
@classdesc This is a class that provides promises enabled SemaphoresHashes.
It is possible to create a SemaphoresHash with a name and speciffic number of resources that we can wait for to get available,
and release them when we do no... | [
"Constructor",
"function",
".",
"Creates",
"a",
"new",
"SemaphoresHash",
"with",
"optional",
"and",
"resources",
"number"
] | 379d132c61b06d54dc532947c1bcd7029665739d | https://github.com/mprinc/qpp/blob/379d132c61b06d54dc532947c1bcd7029665739d/index.js#L535-L554 | train | |
appache/appache | src/core/plugins/inherit/addInheritance.js | buildConfig | function buildConfig(
config, items, item, inheritableConfigs = {}, visitedItems = []
) {
let { id } = item
if (visitedItems.includes(id)) {
throw new Error(`Item "${id}" has cyclic dependencies`)
}
let _extends = item.extends || DEFAULT
let inheritedConfig = inheritableConfigs[_extends]
visitedItem... | javascript | function buildConfig(
config, items, item, inheritableConfigs = {}, visitedItems = []
) {
let { id } = item
if (visitedItems.includes(id)) {
throw new Error(`Item "${id}" has cyclic dependencies`)
}
let _extends = item.extends || DEFAULT
let inheritedConfig = inheritableConfigs[_extends]
visitedItem... | [
"function",
"buildConfig",
"(",
"config",
",",
"items",
",",
"item",
",",
"inheritableConfigs",
"=",
"{",
"}",
",",
"visitedItems",
"=",
"[",
"]",
")",
"{",
"let",
"{",
"id",
"}",
"=",
"item",
"if",
"(",
"visitedItems",
".",
"includes",
"(",
"id",
")... | Mutates inheritableConfigs and visitedItems | [
"Mutates",
"inheritableConfigs",
"and",
"visitedItems"
] | 6f6f6534367a2e8ab1ec6672bdc169a124083ea9 | https://github.com/appache/appache/blob/6f6f6534367a2e8ab1ec6672bdc169a124083ea9/src/core/plugins/inherit/addInheritance.js#L49-L77 | train |
jasonsites/proxy-es-aws | src/cli.js | setCliConfiguration | function setCliConfiguration() {
return yargs
.usage('usage: $0 [options] <aws-elasticsearch-cluster-endpoint>')
.option('h', {
alias: 'host',
default: HOST || '127.0.0.1',
demand: false,
describe: 'Host IP Address',
type: 'string',
})
.option('p', {
alias: 'port',
... | javascript | function setCliConfiguration() {
return yargs
.usage('usage: $0 [options] <aws-elasticsearch-cluster-endpoint>')
.option('h', {
alias: 'host',
default: HOST || '127.0.0.1',
demand: false,
describe: 'Host IP Address',
type: 'string',
})
.option('p', {
alias: 'port',
... | [
"function",
"setCliConfiguration",
"(",
")",
"{",
"return",
"yargs",
".",
"usage",
"(",
"'usage: $0 [options] <aws-elasticsearch-cluster-endpoint>'",
")",
".",
"option",
"(",
"'h'",
",",
"{",
"alias",
":",
"'host'",
",",
"default",
":",
"HOST",
"||",
"'127.0.0.1'"... | Defines CLI options
@return {Object} | [
"Defines",
"CLI",
"options"
] | b2625106d877fea76f74b0b88ed8568a8ff61612 | https://github.com/jasonsites/proxy-es-aws/blob/b2625106d877fea76f74b0b88ed8568a8ff61612/src/cli.js#L26-L74 | train |
jmjuanes/minsql | lib/create.js | CreateRows | function CreateRows(obj)
{
//Start the output
var out = '';
//Get all
for(var key in obj)
{
//Check the out
if(out !== '')
{
//Add a comma
out = out + ', ';
}
//Add the row
out = out + key + ' ' + obj[key];
}
//Return the output
return out;
} | javascript | function CreateRows(obj)
{
//Start the output
var out = '';
//Get all
for(var key in obj)
{
//Check the out
if(out !== '')
{
//Add a comma
out = out + ', ';
}
//Add the row
out = out + key + ' ' + obj[key];
}
//Return the output
return out;
} | [
"function",
"CreateRows",
"(",
"obj",
")",
"{",
"//Start the output",
"var",
"out",
"=",
"''",
";",
"//Get all",
"for",
"(",
"var",
"key",
"in",
"obj",
")",
"{",
"//Check the out",
"if",
"(",
"out",
"!==",
"''",
")",
"{",
"//Add a comma",
"out",
"=",
"... | Create the Rows | [
"Create",
"the",
"Rows"
] | 80eddd97e858545997b30e3c9bc067d5fc2df5a0 | https://github.com/jmjuanes/minsql/blob/80eddd97e858545997b30e3c9bc067d5fc2df5a0/lib/create.js#L33-L54 | train |
pkrll/JavaScript | Progressbar/Example/progressbar-1.1.js | function () {
if (this.settings.parentElement === false)
return this.createErrorMessage("No parent element set!");
// This is the container in
// which the bar resides
this.progressBar = $("<progress>").attr({
"id": "progress-bar",
"value": 0,
"max": 100
}).appendTo(this.settings.parentEl... | javascript | function () {
if (this.settings.parentElement === false)
return this.createErrorMessage("No parent element set!");
// This is the container in
// which the bar resides
this.progressBar = $("<progress>").attr({
"id": "progress-bar",
"value": 0,
"max": 100
}).appendTo(this.settings.parentEl... | [
"function",
"(",
")",
"{",
"if",
"(",
"this",
".",
"settings",
".",
"parentElement",
"===",
"false",
")",
"return",
"this",
".",
"createErrorMessage",
"(",
"\"No parent element set!\"",
")",
";",
"// This is the container in",
"// which the bar resides",
"this",
"."... | Creates the progress bar element | [
"Creates",
"the",
"progress",
"bar",
"element"
] | 2757281c61e14895694d921b98a699a96cb6d346 | https://github.com/pkrll/JavaScript/blob/2757281c61e14895694d921b98a699a96cb6d346/Progressbar/Example/progressbar-1.1.js#L56-L70 | train | |
pkrll/JavaScript | Progressbar/Example/progressbar-1.1.js | function (progress) {
var _this = this;
this.progressBar.animate({
value: progress
}, 1, function() {
_this.onProgress(progress);
});
this.progress = progress;
} | javascript | function (progress) {
var _this = this;
this.progressBar.animate({
value: progress
}, 1, function() {
_this.onProgress(progress);
});
this.progress = progress;
} | [
"function",
"(",
"progress",
")",
"{",
"var",
"_this",
"=",
"this",
";",
"this",
".",
"progressBar",
".",
"animate",
"(",
"{",
"value",
":",
"progress",
"}",
",",
"1",
",",
"function",
"(",
")",
"{",
"_this",
".",
"onProgress",
"(",
"progress",
")",
... | Animates the progress bar | [
"Animates",
"the",
"progress",
"bar"
] | 2757281c61e14895694d921b98a699a96cb6d346 | https://github.com/pkrll/JavaScript/blob/2757281c61e14895694d921b98a699a96cb6d346/Progressbar/Example/progressbar-1.1.js#L72-L80 | train | |
vowsjs/cli-easy | lib/cli-easy/batch.js | onExec | function onExec (err, stdout, stderr) {
callback(null, {
err: err,
stdout: stdout,
stderr: stderr
});
} | javascript | function onExec (err, stdout, stderr) {
callback(null, {
err: err,
stdout: stdout,
stderr: stderr
});
} | [
"function",
"onExec",
"(",
"err",
",",
"stdout",
",",
"stderr",
")",
"{",
"callback",
"(",
"null",
",",
"{",
"err",
":",
"err",
",",
"stdout",
":",
"stdout",
",",
"stderr",
":",
"stderr",
"}",
")",
";",
"}"
] | Combine results in one object and pass them to callback Add err to result, because we want it to be a part of test assertions | [
"Combine",
"results",
"in",
"one",
"object",
"and",
"pass",
"them",
"to",
"callback",
"Add",
"err",
"to",
"result",
"because",
"we",
"want",
"it",
"to",
"be",
"a",
"part",
"of",
"test",
"assertions"
] | ad9e5aa789d78d827c6ab4f336087d6df08fdb12 | https://github.com/vowsjs/cli-easy/blob/ad9e5aa789d78d827c6ab4f336087d6df08fdb12/lib/cli-easy/batch.js#L117-L123 | train |
PanthR/panthrMath | panthrMath/distributions/nbinom.js | pnbinom | function pnbinom(size, prob, lowerTail, logp) {
logp = logp === true;
lowerTail = lowerTail !== false;
return function(x) {
if (utils.hasNaN(x, size, prob) ||
size < 0 || prob <= 0 || prob > 1 ||
utils.isInfinite(size)) {
return NaN;
}
... | javascript | function pnbinom(size, prob, lowerTail, logp) {
logp = logp === true;
lowerTail = lowerTail !== false;
return function(x) {
if (utils.hasNaN(x, size, prob) ||
size < 0 || prob <= 0 || prob > 1 ||
utils.isInfinite(size)) {
return NaN;
}
... | [
"function",
"pnbinom",
"(",
"size",
",",
"prob",
",",
"lowerTail",
",",
"logp",
")",
"{",
"logp",
"=",
"logp",
"===",
"true",
";",
"lowerTail",
"=",
"lowerTail",
"!==",
"false",
";",
"return",
"function",
"(",
"x",
")",
"{",
"if",
"(",
"utils",
".",
... | Evaluates the lower-tail cdf at `x` for the negative binomial distribution.
`size` must be strictly positive, and `prob` must be in `(0, 1]`.
`lowerTail` defaults to `true`; if `lowerTail` is `false`, returns
the upper tail probability instead.
`logp` defaults to `false`; if `logp` is `true`, returns the logarithm
o... | [
"Evaluates",
"the",
"lower",
"-",
"tail",
"cdf",
"at",
"x",
"for",
"the",
"negative",
"binomial",
"distribution",
"."
] | 54d249ca9903a9535f963da711bd3a87fb229c0b | https://github.com/PanthR/panthrMath/blob/54d249ca9903a9535f963da711bd3a87fb229c0b/panthrMath/distributions/nbinom.js#L91-L111 | train |
PanthR/panthrMath | panthrMath/distributions/nbinom.js | rnbinom | function rnbinom(size, prob) {
var rg;
if (size <= 0 || prob <= 0 || prob > 1) {
return function() { return NaN; };
}
if (prob === 1) { return function() { return 0; }; }
rg = rgamma(size, (1 - prob) / prob);
return function() { return rpois(rg())(); };
} | javascript | function rnbinom(size, prob) {
var rg;
if (size <= 0 || prob <= 0 || prob > 1) {
return function() { return NaN; };
}
if (prob === 1) { return function() { return 0; }; }
rg = rgamma(size, (1 - prob) / prob);
return function() { return rpois(rg())(); };
} | [
"function",
"rnbinom",
"(",
"size",
",",
"prob",
")",
"{",
"var",
"rg",
";",
"if",
"(",
"size",
"<=",
"0",
"||",
"prob",
"<=",
"0",
"||",
"prob",
">",
"1",
")",
"{",
"return",
"function",
"(",
")",
"{",
"return",
"NaN",
";",
"}",
";",
"}",
"i... | Returns a random variate from the negative binomial distribution.
`size` must be strictly positive, and `prob` must be in `(0, 1]`.
@fullName rnbinom(size, prob)()
@memberof nbinom | [
"Returns",
"a",
"random",
"variate",
"from",
"the",
"negative",
"binomial",
"distribution",
"."
] | 54d249ca9903a9535f963da711bd3a87fb229c0b | https://github.com/PanthR/panthrMath/blob/54d249ca9903a9535f963da711bd3a87fb229c0b/panthrMath/distributions/nbinom.js#L182-L191 | train |
PanthR/panthrMath | panthrMath/distributions/nbinom.js | function(size, prob) {
return {
d: function(x, logp) { return dnbinom(size, prob, logp)(x); },
p: function(q, lowerTail, logp) {
return pnbinom(size, prob, lowerTail, logp)(q);
},
q: function(p, lowerTail, logp) {
return qnbinom(size... | javascript | function(size, prob) {
return {
d: function(x, logp) { return dnbinom(size, prob, logp)(x); },
p: function(q, lowerTail, logp) {
return pnbinom(size, prob, lowerTail, logp)(q);
},
q: function(p, lowerTail, logp) {
return qnbinom(size... | [
"function",
"(",
"size",
",",
"prob",
")",
"{",
"return",
"{",
"d",
":",
"function",
"(",
"x",
",",
"logp",
")",
"{",
"return",
"dnbinom",
"(",
"size",
",",
"prob",
",",
"logp",
")",
"(",
"x",
")",
";",
"}",
",",
"p",
":",
"function",
"(",
"q... | Returns an object representing a negative binomial distribution with
given parameters `size` and `prob`. The object has
properties `d`, `p`, `q`, `r`.
`size` must be strictly positive, and `prob` must be in `(0, 1]`.
```
nbinom(size, prob).d(x, logp) // same as dnbinom(size, prob, logp)(x)
nbinom(size, pr... | [
"Returns",
"an",
"object",
"representing",
"a",
"negative",
"binomial",
"distribution",
"with",
"given",
"parameters",
"size",
"and",
"prob",
".",
"The",
"object",
"has",
"properties",
"d",
"p",
"q",
"r",
"."
] | 54d249ca9903a9535f963da711bd3a87fb229c0b | https://github.com/PanthR/panthrMath/blob/54d249ca9903a9535f963da711bd3a87fb229c0b/panthrMath/distributions/nbinom.js#L209-L220 | train | |
taoyuan/wide | lib/logger.js | emit | function emit(name, next) {
var transport = that.transports[name];
if ((transport.level && that.levels[transport.level] <= that.levels[level])
|| (!transport.level && that.levels[that.level] <= that.levels[level])) {
transport.log(rec, function (err) {
if (err) {
... | javascript | function emit(name, next) {
var transport = that.transports[name];
if ((transport.level && that.levels[transport.level] <= that.levels[level])
|| (!transport.level && that.levels[that.level] <= that.levels[level])) {
transport.log(rec, function (err) {
if (err) {
... | [
"function",
"emit",
"(",
"name",
",",
"next",
")",
"{",
"var",
"transport",
"=",
"that",
".",
"transports",
"[",
"name",
"]",
";",
"if",
"(",
"(",
"transport",
".",
"level",
"&&",
"that",
".",
"levels",
"[",
"transport",
".",
"level",
"]",
"<=",
"t... | Log for each transport and emit 'logging' event | [
"Log",
"for",
"each",
"transport",
"and",
"emit",
"logging",
"event"
] | a3bc92580f43c56001d8a6d72b45b0e44ba3a7c6 | https://github.com/taoyuan/wide/blob/a3bc92580f43c56001d8a6d72b45b0e44ba3a7c6/lib/logger.js#L290-L306 | train |
taoyuan/wide | lib/logger.js | cb | function cb(err) {
if (callback) {
if (err) return callback(err);
callback(null, rec);
}
callback = null;
if (!err) {
that.emit('logged', rec);
}
} | javascript | function cb(err) {
if (callback) {
if (err) return callback(err);
callback(null, rec);
}
callback = null;
if (!err) {
that.emit('logged', rec);
}
} | [
"function",
"cb",
"(",
"err",
")",
"{",
"if",
"(",
"callback",
")",
"{",
"if",
"(",
"err",
")",
"return",
"callback",
"(",
"err",
")",
";",
"callback",
"(",
"null",
",",
"rec",
")",
";",
"}",
"callback",
"=",
"null",
";",
"if",
"(",
"!",
"err",... | Respond to the callback | [
"Respond",
"to",
"the",
"callback"
] | a3bc92580f43c56001d8a6d72b45b0e44ba3a7c6 | https://github.com/taoyuan/wide/blob/a3bc92580f43c56001d8a6d72b45b0e44ba3a7c6/lib/logger.js#L311-L320 | train |
taoyuan/wide | lib/logger.js | queryTransport | function queryTransport(transport, next) {
if (options.query) {
options.query = transport.formatQuery(query);
}
transport.query(options, function (err, results) {
if (err) {
return next(err);
}
next(null, transport.formatResults(r... | javascript | function queryTransport(transport, next) {
if (options.query) {
options.query = transport.formatQuery(query);
}
transport.query(options, function (err, results) {
if (err) {
return next(err);
}
next(null, transport.formatResults(r... | [
"function",
"queryTransport",
"(",
"transport",
",",
"next",
")",
"{",
"if",
"(",
"options",
".",
"query",
")",
"{",
"options",
".",
"query",
"=",
"transport",
".",
"formatQuery",
"(",
"query",
")",
";",
"}",
"transport",
".",
"query",
"(",
"options",
... | Helper function to query a single transport | [
"Helper",
"function",
"to",
"query",
"a",
"single",
"transport"
] | a3bc92580f43c56001d8a6d72b45b0e44ba3a7c6 | https://github.com/taoyuan/wide/blob/a3bc92580f43c56001d8a6d72b45b0e44ba3a7c6/lib/logger.js#L360-L372 | train |
taoyuan/wide | lib/logger.js | addResults | function addResults(transport, next) {
queryTransport(transport, function (err, result) {
//
// queryTransport could potentially invoke the callback
// multiple times since Transport code can be unpredictable.
//
if (next) {
result = er... | javascript | function addResults(transport, next) {
queryTransport(transport, function (err, result) {
//
// queryTransport could potentially invoke the callback
// multiple times since Transport code can be unpredictable.
//
if (next) {
result = er... | [
"function",
"addResults",
"(",
"transport",
",",
"next",
")",
"{",
"queryTransport",
"(",
"transport",
",",
"function",
"(",
"err",
",",
"result",
")",
"{",
"//",
"// queryTransport could potentially invoke the callback",
"// multiple times since Transport code can be unpre... | Helper function to accumulate the results from `queryTransport` into the `results`. | [
"Helper",
"function",
"to",
"accumulate",
"the",
"results",
"from",
"queryTransport",
"into",
"the",
"results",
"."
] | a3bc92580f43c56001d8a6d72b45b0e44ba3a7c6 | https://github.com/taoyuan/wide/blob/a3bc92580f43c56001d8a6d72b45b0e44ba3a7c6/lib/logger.js#L378-L395 | train |
aureooms/js-grammar | lib/ll1/first.js | first | function first(FIRST, rule) {
var terminals = new Set();
var read = true;
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;
try {
for (var _iterator = rule[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iter... | javascript | function first(FIRST, rule) {
var terminals = new Set();
var read = true;
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;
try {
for (var _iterator = rule[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iter... | [
"function",
"first",
"(",
"FIRST",
",",
"rule",
")",
"{",
"var",
"terminals",
"=",
"new",
"Set",
"(",
")",
";",
"var",
"read",
"=",
"true",
";",
"var",
"_iteratorNormalCompletion",
"=",
"true",
";",
"var",
"_didIteratorError",
"=",
"false",
";",
"var",
... | Generate FIRST set for any rule given the FIRST sets for the nonterminals.
@param {Map} FIRST
@param {Array} rule
@returns {Set} | [
"Generate",
"FIRST",
"set",
"for",
"any",
"rule",
"given",
"the",
"FIRST",
"sets",
"for",
"the",
"nonterminals",
"."
] | 28c4d1a3175327b33766c34539eab317303e26c5 | https://github.com/aureooms/js-grammar/blob/28c4d1a3175327b33766c34539eab317303e26c5/lib/ll1/first.js#L21-L63 | train |
vivangkumar/node-data-structures | lib/Iterator.js | function() {
this._nextCalled = true;
if(this._collection.size() > 0) {
if(this._hasNextCalled) {
this._hasNextCalled = false;
this._pos --;
}
this._pos ++;
this._nextElement = this._collection.getAll()[this._pos];
... | javascript | function() {
this._nextCalled = true;
if(this._collection.size() > 0) {
if(this._hasNextCalled) {
this._hasNextCalled = false;
this._pos --;
}
this._pos ++;
this._nextElement = this._collection.getAll()[this._pos];
... | [
"function",
"(",
")",
"{",
"this",
".",
"_nextCalled",
"=",
"true",
";",
"if",
"(",
"this",
".",
"_collection",
".",
"size",
"(",
")",
">",
"0",
")",
"{",
"if",
"(",
"this",
".",
"_hasNextCalled",
")",
"{",
"this",
".",
"_hasNextCalled",
"=",
"fals... | Returns the next element in the iteration.
@throws Error | [
"Returns",
"the",
"next",
"element",
"in",
"the",
"iteration",
"."
] | 703d0795fba9d15534fa149f605d54fcfe0844e0 | https://github.com/vivangkumar/node-data-structures/blob/703d0795fba9d15534fa149f605d54fcfe0844e0/lib/Iterator.js#L34-L51 | train | |
vivangkumar/node-data-structures | lib/Iterator.js | function() {
if(this._collection.getAll()[this._pos + 1]) {
this._hasNext = true;
} else {
this._hasNext = false;
}
if(!this._nextCalled) {
this._pos ++;
this._hasNextCalled = true;
}
return this._hasNex... | javascript | function() {
if(this._collection.getAll()[this._pos + 1]) {
this._hasNext = true;
} else {
this._hasNext = false;
}
if(!this._nextCalled) {
this._pos ++;
this._hasNextCalled = true;
}
return this._hasNex... | [
"function",
"(",
")",
"{",
"if",
"(",
"this",
".",
"_collection",
".",
"getAll",
"(",
")",
"[",
"this",
".",
"_pos",
"+",
"1",
"]",
")",
"{",
"this",
".",
"_hasNext",
"=",
"true",
";",
"}",
"else",
"{",
"this",
".",
"_hasNext",
"=",
"false",
";... | Returns true if there are more elements.
@return boolean
@throws Error | [
"Returns",
"true",
"if",
"there",
"are",
"more",
"elements",
"."
] | 703d0795fba9d15534fa149f605d54fcfe0844e0 | https://github.com/vivangkumar/node-data-structures/blob/703d0795fba9d15534fa149f605d54fcfe0844e0/lib/Iterator.js#L58-L71 | train | |
wallacegibbon/sqlmaker | index.js | mkInsert | function mkInsert(table, obj) {
const ks = Object.keys(obj).map(x => `\`${x}\``);
const vs = Object.values(obj).map(toMysqlObj);
return `INSERT INTO \`${table}\`(${ks}) VALUES(${vs})`;
} | javascript | function mkInsert(table, obj) {
const ks = Object.keys(obj).map(x => `\`${x}\``);
const vs = Object.values(obj).map(toMysqlObj);
return `INSERT INTO \`${table}\`(${ks}) VALUES(${vs})`;
} | [
"function",
"mkInsert",
"(",
"table",
",",
"obj",
")",
"{",
"const",
"ks",
"=",
"Object",
".",
"keys",
"(",
"obj",
")",
".",
"map",
"(",
"x",
"=>",
"`",
"\\`",
"${",
"x",
"}",
"\\`",
"`",
")",
";",
"const",
"vs",
"=",
"Object",
".",
"values",
... | INSERT is the simplest operation, because there is no WHERE part in it.
@param {Object} obj - Object like { name: "Abc", age: 15 }.
@returns {string} - e.g. "INSERT INTO X(name, age) VALUES('Abc', 15)" | [
"INSERT",
"is",
"the",
"simplest",
"operation",
"because",
"there",
"is",
"no",
"WHERE",
"part",
"in",
"it",
"."
] | 58e4b84ca120e6ff1b12779f941c04b431e961be | https://github.com/wallacegibbon/sqlmaker/blob/58e4b84ca120e6ff1b12779f941c04b431e961be/index.js#L21-L26 | train |
wallacegibbon/sqlmaker | index.js | toMysqlObj | function toMysqlObj(obj) {
if (obj === undefined || obj === null)
return "NULL";
switch (obj.constructor) {
case Date:
return `'${formatDate(obj)}'`;
case String:
return `'${obj.replace(/'/g, "''")}'`;
case Number:
return obj;
default:
throw new TypeError(`${util.inspect(obj)}`);
}... | javascript | function toMysqlObj(obj) {
if (obj === undefined || obj === null)
return "NULL";
switch (obj.constructor) {
case Date:
return `'${formatDate(obj)}'`;
case String:
return `'${obj.replace(/'/g, "''")}'`;
case Number:
return obj;
default:
throw new TypeError(`${util.inspect(obj)}`);
}... | [
"function",
"toMysqlObj",
"(",
"obj",
")",
"{",
"if",
"(",
"obj",
"===",
"undefined",
"||",
"obj",
"===",
"null",
")",
"return",
"\"NULL\"",
";",
"switch",
"(",
"obj",
".",
"constructor",
")",
"{",
"case",
"Date",
":",
"return",
"`",
"${",
"formatDate"... | Transform normal Javascript object to Mysql object. Only String, Number,
Date are supported. | [
"Transform",
"normal",
"Javascript",
"object",
"to",
"Mysql",
"object",
".",
"Only",
"String",
"Number",
"Date",
"are",
"supported",
"."
] | 58e4b84ca120e6ff1b12779f941c04b431e961be | https://github.com/wallacegibbon/sqlmaker/blob/58e4b84ca120e6ff1b12779f941c04b431e961be/index.js#L84-L101 | train |
atd-schubert/node-stream-lib | lib/pipe.js | function (chain) {
if (chain.readable) {
chain.chainAfter = chain.chainAfter || Pipe.Chain.prototype.chainAfter;
chain.nextChain = chain.nextChain || Pipe.Chain.prototype.nextChain;
}
if (chain.writable) { // Duplex
chain.chainBefore = chain.chainBefore || Pip... | javascript | function (chain) {
if (chain.readable) {
chain.chainAfter = chain.chainAfter || Pipe.Chain.prototype.chainAfter;
chain.nextChain = chain.nextChain || Pipe.Chain.prototype.nextChain;
}
if (chain.writable) { // Duplex
chain.chainBefore = chain.chainBefore || Pip... | [
"function",
"(",
"chain",
")",
"{",
"if",
"(",
"chain",
".",
"readable",
")",
"{",
"chain",
".",
"chainAfter",
"=",
"chain",
".",
"chainAfter",
"||",
"Pipe",
".",
"Chain",
".",
"prototype",
".",
"chainAfter",
";",
"chain",
".",
"nextChain",
"=",
"chain... | Enhance a stream to a chainable one
@private
@param {stream} chain | [
"Enhance",
"a",
"stream",
"to",
"a",
"chainable",
"one"
] | 90f27042fae84d2fbdbf9d28149b0673997f151a | https://github.com/atd-schubert/node-stream-lib/blob/90f27042fae84d2fbdbf9d28149b0673997f151a/lib/pipe.js#L78-L92 | train | |
atd-schubert/node-stream-lib | lib/pipe.js | function (chain) {
if (chain.previousChain) {
chain.previousChain.unpipe(chain);
chain.previousChain.pipe(this);
chain.previousChain.nextChain = this;
}
if (this.autoEnhance) {
this.enhanceForeignStream(chain);
}
this.pipe(chain)... | javascript | function (chain) {
if (chain.previousChain) {
chain.previousChain.unpipe(chain);
chain.previousChain.pipe(this);
chain.previousChain.nextChain = this;
}
if (this.autoEnhance) {
this.enhanceForeignStream(chain);
}
this.pipe(chain)... | [
"function",
"(",
"chain",
")",
"{",
"if",
"(",
"chain",
".",
"previousChain",
")",
"{",
"chain",
".",
"previousChain",
".",
"unpipe",
"(",
"chain",
")",
";",
"chain",
".",
"previousChain",
".",
"pipe",
"(",
"this",
")",
";",
"chain",
".",
"previousChai... | Chain this chain before the stream given as parameter
@param {stream.Writable|stream.Transform|stream.Duplex} chain - Next stream
@returns {Pipe.Chain} | [
"Chain",
"this",
"chain",
"before",
"the",
"stream",
"given",
"as",
"parameter"
] | 90f27042fae84d2fbdbf9d28149b0673997f151a | https://github.com/atd-schubert/node-stream-lib/blob/90f27042fae84d2fbdbf9d28149b0673997f151a/lib/pipe.js#L98-L114 | train | |
ernestoalejo/grunt-diff-deploy | tasks/push.js | function(callback) {
ftpout.raw.pwd(function(err) {
if (err && err.code === 530) {
grunt.fatal('bad username or password');
}
callback(err);
});
} | javascript | function(callback) {
ftpout.raw.pwd(function(err) {
if (err && err.code === 530) {
grunt.fatal('bad username or password');
}
callback(err);
});
} | [
"function",
"(",
"callback",
")",
"{",
"ftpout",
".",
"raw",
".",
"pwd",
"(",
"function",
"(",
"err",
")",
"{",
"if",
"(",
"err",
"&&",
"err",
".",
"code",
"===",
"530",
")",
"{",
"grunt",
".",
"fatal",
"(",
"'bad username or password'",
")",
";",
... | Check user name & password | [
"Check",
"user",
"name",
"&",
"password"
] | c1cdf9f95865fcb784499418e60a0b7682786c91 | https://github.com/ernestoalejo/grunt-diff-deploy/blob/c1cdf9f95865fcb784499418e60a0b7682786c91/tasks/push.js#L78-L85 | train | |
ernestoalejo/grunt-diff-deploy | tasks/push.js | function(callback) {
grunt.log.write(wrap('===== saving hashes... '));
ftpout.put(new Buffer(JSON.stringify(localHashes)), 'push-hashes', function(err) {
if (err) { done(err); }
grunt.log.writeln(wrapRight('[SUCCESS]').green);
callback();
});
} | javascript | function(callback) {
grunt.log.write(wrap('===== saving hashes... '));
ftpout.put(new Buffer(JSON.stringify(localHashes)), 'push-hashes', function(err) {
if (err) { done(err); }
grunt.log.writeln(wrapRight('[SUCCESS]').green);
callback();
});
} | [
"function",
"(",
"callback",
")",
"{",
"grunt",
".",
"log",
".",
"write",
"(",
"wrap",
"(",
"'===== saving hashes... '",
")",
")",
";",
"ftpout",
".",
"put",
"(",
"new",
"Buffer",
"(",
"JSON",
".",
"stringify",
"(",
"localHashes",
")",
")",
",",
"'push... | Change folder & files perms | [
"Change",
"folder",
"&",
"files",
"perms"
] | c1cdf9f95865fcb784499418e60a0b7682786c91 | https://github.com/ernestoalejo/grunt-diff-deploy/blob/c1cdf9f95865fcb784499418e60a0b7682786c91/tasks/push.js#L269-L276 | train | |
ernestoalejo/grunt-diff-deploy | tasks/push.js | function(localHashes, files, done) {
fetchRemoteHashes(function(err, remoteHashes) {
done(err, localHashes, remoteHashes, files);
});
} | javascript | function(localHashes, files, done) {
fetchRemoteHashes(function(err, remoteHashes) {
done(err, localHashes, remoteHashes, files);
});
} | [
"function",
"(",
"localHashes",
",",
"files",
",",
"done",
")",
"{",
"fetchRemoteHashes",
"(",
"function",
"(",
"err",
",",
"remoteHashes",
")",
"{",
"done",
"(",
"err",
",",
"localHashes",
",",
"remoteHashes",
",",
"files",
")",
";",
"}",
")",
";",
"}... | Fetch the remote hashes | [
"Fetch",
"the",
"remote",
"hashes"
] | c1cdf9f95865fcb784499418e60a0b7682786c91 | https://github.com/ernestoalejo/grunt-diff-deploy/blob/c1cdf9f95865fcb784499418e60a0b7682786c91/tasks/push.js#L330-L334 | train | |
psalaets/ray-vs-line-segment | index.js | rayVsLineSegment | function rayVsLineSegment(ray, segment) {
var result = lineIntersect.checkIntersection(
ray.start.x, ray.start.y, ray.end.x, ray.end.y,
segment.start.x, segment.start.y, segment.end.x, segment.end.y
);
// definitely no intersection
if (result.type == 'none' || result.type == 'parallel') return null;
... | javascript | function rayVsLineSegment(ray, segment) {
var result = lineIntersect.checkIntersection(
ray.start.x, ray.start.y, ray.end.x, ray.end.y,
segment.start.x, segment.start.y, segment.end.x, segment.end.y
);
// definitely no intersection
if (result.type == 'none' || result.type == 'parallel') return null;
... | [
"function",
"rayVsLineSegment",
"(",
"ray",
",",
"segment",
")",
"{",
"var",
"result",
"=",
"lineIntersect",
".",
"checkIntersection",
"(",
"ray",
".",
"start",
".",
"x",
",",
"ray",
".",
"start",
".",
"y",
",",
"ray",
".",
"end",
".",
"x",
",",
"ray... | Finds where a ray hits a line segment, if at all.
@param {object} ray - Object that looks like
{
start: {x: number, y: number},
end: {x: number, y: number}
}
@param {object} segment - Object that looks like
{
start: {x: number, y: number},
end: {x: number, y: number}
}
@return {object} point (x/y) where ray hits seg... | [
"Finds",
"where",
"a",
"ray",
"hits",
"a",
"line",
"segment",
"if",
"at",
"all",
"."
] | 7dfde5f2c7853bf34ca4394fa897f4c315a9be88 | https://github.com/psalaets/ray-vs-line-segment/blob/7dfde5f2c7853bf34ca4394fa897f4c315a9be88/index.js#L21-L44 | train |
influx6/ToolStack | lib/stack.structures.js | function(elem){
if(!this.root){
this.root = struct.Node(elem);
this.tail = this.root;
this.size = 1;
return this;
// this.root.isRoot = true;
}
this.root.prepend(elem);
this.root = this.root.previous;... | javascript | function(elem){
if(!this.root){
this.root = struct.Node(elem);
this.tail = this.root;
this.size = 1;
return this;
// this.root.isRoot = true;
}
this.root.prepend(elem);
this.root = this.root.previous;... | [
"function",
"(",
"elem",
")",
"{",
"if",
"(",
"!",
"this",
".",
"root",
")",
"{",
"this",
".",
"root",
"=",
"struct",
".",
"Node",
"(",
"elem",
")",
";",
"this",
".",
"tail",
"=",
"this",
".",
"root",
";",
"this",
".",
"size",
"=",
"1",
";",
... | adds from the back of the tail element | [
"adds",
"from",
"the",
"back",
"of",
"the",
"tail",
"element"
] | d0c7b1acc1546f5e7ff9d04ca6c9222b2577e0db | https://github.com/influx6/ToolStack/blob/d0c7b1acc1546f5e7ff9d04ca6c9222b2577e0db/lib/stack.structures.js#L111-L124 | train | |
influx6/ToolStack | lib/stack.structures.js | function(elem){
if(!this.root){
this.root = struct.Node(elem);
this.tail = this.root;
this.size = 1;
return this;
// this.root.isRoot = true;
}
// this.add(elem);
this.tail.append(elem);
th... | javascript | function(elem){
if(!this.root){
this.root = struct.Node(elem);
this.tail = this.root;
this.size = 1;
return this;
// this.root.isRoot = true;
}
// this.add(elem);
this.tail.append(elem);
th... | [
"function",
"(",
"elem",
")",
"{",
"if",
"(",
"!",
"this",
".",
"root",
")",
"{",
"this",
".",
"root",
"=",
"struct",
".",
"Node",
"(",
"elem",
")",
";",
"this",
".",
"tail",
"=",
"this",
".",
"root",
";",
"this",
".",
"size",
"=",
"1",
";",
... | adds in front of the tail element | [
"adds",
"in",
"front",
"of",
"the",
"tail",
"element"
] | d0c7b1acc1546f5e7ff9d04ca6c9222b2577e0db | https://github.com/influx6/ToolStack/blob/d0c7b1acc1546f5e7ff9d04ca6c9222b2577e0db/lib/stack.structures.js#L126-L139 | train | |
influx6/ToolStack | lib/stack.structures.js | function(){
if(!this.size) return;
var n = this.root, pr = n.previous, nx = n.next;
if(this.size === 1){
this.root = this.tail = null; this.size = 0;
return n;
}
nx.previous = pr;
delete this.root;
this... | javascript | function(){
if(!this.size) return;
var n = this.root, pr = n.previous, nx = n.next;
if(this.size === 1){
this.root = this.tail = null; this.size = 0;
return n;
}
nx.previous = pr;
delete this.root;
this... | [
"function",
"(",
")",
"{",
"if",
"(",
"!",
"this",
".",
"size",
")",
"return",
";",
"var",
"n",
"=",
"this",
".",
"root",
",",
"pr",
"=",
"n",
".",
"previous",
",",
"nx",
"=",
"n",
".",
"next",
";",
"if",
"(",
"this",
".",
"size",
"===",
"1... | pops of the root of the list | [
"pops",
"of",
"the",
"root",
"of",
"the",
"list"
] | d0c7b1acc1546f5e7ff9d04ca6c9222b2577e0db | https://github.com/influx6/ToolStack/blob/d0c7b1acc1546f5e7ff9d04ca6c9222b2577e0db/lib/stack.structures.js#L141-L153 | train | |
skerit/alchemy | lib/core/client_alchemy.js | markLinkElement | function markLinkElement(element, active_nr) {
var mark_wrapper;
// Always remove the current classes
element.classList.remove('active-link');
element.classList.remove('active-sublink');
if (element.parentElement && element.parentElement.classList.contains('js-he-link-wrapper')) {
markLinkElement(element.pare... | javascript | function markLinkElement(element, active_nr) {
var mark_wrapper;
// Always remove the current classes
element.classList.remove('active-link');
element.classList.remove('active-sublink');
if (element.parentElement && element.parentElement.classList.contains('js-he-link-wrapper')) {
markLinkElement(element.pare... | [
"function",
"markLinkElement",
"(",
"element",
",",
"active_nr",
")",
"{",
"var",
"mark_wrapper",
";",
"// Always remove the current classes",
"element",
".",
"classList",
".",
"remove",
"(",
"'active-link'",
")",
";",
"element",
".",
"classList",
".",
"remove",
"... | Mark element as active or not
@author Jelle De Loecker <jelle@develry.be>
@since 0.3.0
@version 0.3.0
@param {Element} element
@param {Number} active_nr | [
"Mark",
"element",
"as",
"active",
"or",
"not"
] | ede1dad07a5a737d5d1e10c2ff87fdfb057443f8 | https://github.com/skerit/alchemy/blob/ede1dad07a5a737d5d1e10c2ff87fdfb057443f8/lib/core/client_alchemy.js#L439-L460 | train |
sjberry/bristol-hipchat | main.js | Target | function Target(options = {}) {
options = clone(options);
let client = new Hipchatter(options.token);
let room = options.room;
delete options.token;
delete options.room;
let proto = {
message_format: 'html',
notify: false
};
for (let key in options) {
if (!options.hasOwnProperty(key)) {
break;
}
... | javascript | function Target(options = {}) {
options = clone(options);
let client = new Hipchatter(options.token);
let room = options.room;
delete options.token;
delete options.room;
let proto = {
message_format: 'html',
notify: false
};
for (let key in options) {
if (!options.hasOwnProperty(key)) {
break;
}
... | [
"function",
"Target",
"(",
"options",
"=",
"{",
"}",
")",
"{",
"options",
"=",
"clone",
"(",
"options",
")",
";",
"let",
"client",
"=",
"new",
"Hipchatter",
"(",
"options",
".",
"token",
")",
";",
"let",
"room",
"=",
"options",
".",
"room",
";",
"d... | Creates and configures an instance of the bristol-hipchat target. Establishes message defaults by way of an internal
Message constructor.
@constructor
@param {Object} options
@param {String} options.token The API key (must have the notification permission to send messages).
@param {Number} options.room The Room ID to ... | [
"Creates",
"and",
"configures",
"an",
"instance",
"of",
"the",
"bristol",
"-",
"hipchat",
"target",
".",
"Establishes",
"message",
"defaults",
"by",
"way",
"of",
"an",
"internal",
"Message",
"constructor",
"."
] | c90f64721543e3b00e28657ba841fbc04214dbf9 | https://github.com/sjberry/bristol-hipchat/blob/c90f64721543e3b00e28657ba841fbc04214dbf9/main.js#L23-L83 | train |
CascadeEnergy/dispatch-fn | index.js | dispatch | function dispatch() {
var commands = [].slice.call(arguments);
return function fn() {
var args = [].slice.call(arguments);
var result;
for (var i = 0; i < commands.length; i++) {
result = commands[i].apply(undefined, args);
if (result !== undefined) {
break;
}
}
ret... | javascript | function dispatch() {
var commands = [].slice.call(arguments);
return function fn() {
var args = [].slice.call(arguments);
var result;
for (var i = 0; i < commands.length; i++) {
result = commands[i].apply(undefined, args);
if (result !== undefined) {
break;
}
}
ret... | [
"function",
"dispatch",
"(",
")",
"{",
"var",
"commands",
"=",
"[",
"]",
".",
"slice",
".",
"call",
"(",
"arguments",
")",
";",
"return",
"function",
"fn",
"(",
")",
"{",
"var",
"args",
"=",
"[",
"]",
".",
"slice",
".",
"call",
"(",
"arguments",
... | Dispatch returns a function which iterates a series of commands
looking for one to return something other than undefined.
@param commands
@returns {Function} | [
"Dispatch",
"returns",
"a",
"function",
"which",
"iterates",
"a",
"series",
"of",
"commands",
"looking",
"for",
"one",
"to",
"return",
"something",
"other",
"than",
"undefined",
"."
] | e3ac8135f4c15c21016c9c972a9652b09474074d | https://github.com/CascadeEnergy/dispatch-fn/blob/e3ac8135f4c15c21016c9c972a9652b09474074d/index.js#L8-L25 | train |
hyjin/node-oauth-toolkit | index.js | toArray | function toArray(obj) {
var key, val, arr = [];
for (key in obj) {
val = obj[key];
if (Array.isArray(val))
for (var i = 0; i < val.length; i++)
arr.push([ key, val[i] ]);
else
arr.push([ key, val ]);
}
return arr;
} | javascript | function toArray(obj) {
var key, val, arr = [];
for (key in obj) {
val = obj[key];
if (Array.isArray(val))
for (var i = 0; i < val.length; i++)
arr.push([ key, val[i] ]);
else
arr.push([ key, val ]);
}
return arr;
} | [
"function",
"toArray",
"(",
"obj",
")",
"{",
"var",
"key",
",",
"val",
",",
"arr",
"=",
"[",
"]",
";",
"for",
"(",
"key",
"in",
"obj",
")",
"{",
"val",
"=",
"obj",
"[",
"key",
"]",
";",
"if",
"(",
"Array",
".",
"isArray",
"(",
"val",
")",
"... | Maps object to bi-dimensional array @example toArray({ foo: 'A', bar: [ 'b', 'B' ]}) will be [ ['foo', 'A'], ['bar', 'b'], ['bar', 'B'] ] | [
"Maps",
"object",
"to",
"bi",
"-",
"dimensional",
"array"
] | 17135947c2b888cd1cfa0e80aa09f981ec1d854e | https://github.com/hyjin/node-oauth-toolkit/blob/17135947c2b888cd1cfa0e80aa09f981ec1d854e/index.js#L126-L137 | train |
chickendinosaur/yeoman-generator-node-package | generators/app/1-initializing.js | assignDeep | function assignDeep(dest, source) {
if (source && source.constructor === Object) {
var sourceBaseKeys = Object.keys(source);
for (var i = 0; i < sourceBaseKeys.length; ++i) {
var sourceBaseKey = sourceBaseKeys[i];
var destinationField = dest[sourceBaseKey];
var sourceField = source[sourceBaseKey];
if... | javascript | function assignDeep(dest, source) {
if (source && source.constructor === Object) {
var sourceBaseKeys = Object.keys(source);
for (var i = 0; i < sourceBaseKeys.length; ++i) {
var sourceBaseKey = sourceBaseKeys[i];
var destinationField = dest[sourceBaseKey];
var sourceField = source[sourceBaseKey];
if... | [
"function",
"assignDeep",
"(",
"dest",
",",
"source",
")",
"{",
"if",
"(",
"source",
"&&",
"source",
".",
"constructor",
"===",
"Object",
")",
"{",
"var",
"sourceBaseKeys",
"=",
"Object",
".",
"keys",
"(",
"source",
")",
";",
"for",
"(",
"var",
"i",
... | Object.assign removes special characters that are needed for the pacakge name
and ruins the default value. | [
"Object",
".",
"assign",
"removes",
"special",
"characters",
"that",
"are",
"needed",
"for",
"the",
"pacakge",
"name",
"and",
"ruins",
"the",
"default",
"value",
"."
] | 53e3020595294e10c5ef2428a385501a8a5cd2ac | https://github.com/chickendinosaur/yeoman-generator-node-package/blob/53e3020595294e10c5ef2428a385501a8a5cd2ac/generators/app/1-initializing.js#L92-L109 | train |
coderaiser/util-io | lib/util.js | check | function check(args, names) {
var msg = '',
name = '',
template = '{{ name }} coud not be empty!',
indexOf = Array.prototype.indexOf,
lenNames = names.length... | javascript | function check(args, names) {
var msg = '',
name = '',
template = '{{ name }} coud not be empty!',
indexOf = Array.prototype.indexOf,
lenNames = names.length... | [
"function",
"check",
"(",
"args",
",",
"names",
")",
"{",
"var",
"msg",
"=",
"''",
",",
"name",
"=",
"''",
",",
"template",
"=",
"'{{ name }} coud not be empty!'",
",",
"indexOf",
"=",
"Array",
".",
"prototype",
".",
"indexOf",
",",
"lenNames",
"=",
"nam... | Check is all arguments with names present
@param name
@param arg
@param type | [
"Check",
"is",
"all",
"arguments",
"with",
"names",
"present"
] | cccd3550f96a99e3176d24de5328663a3f7f1c1e | https://github.com/coderaiser/util-io/blob/cccd3550f96a99e3176d24de5328663a3f7f1c1e/lib/util.js#L72-L99 | train |
coderaiser/util-io | lib/util.js | type | function type(variable) {
var regExp = /\s([a-zA-Z]+)/,
str = {}.toString.call(variable),
typeBig = str.match(regExp)[1],
result = typeBig.toLowerCase();
return result;
} | javascript | function type(variable) {
var regExp = /\s([a-zA-Z]+)/,
str = {}.toString.call(variable),
typeBig = str.match(regExp)[1],
result = typeBig.toLowerCase();
return result;
} | [
"function",
"type",
"(",
"variable",
")",
"{",
"var",
"regExp",
"=",
"/",
"\\s([a-zA-Z]+)",
"/",
",",
"str",
"=",
"{",
"}",
".",
"toString",
".",
"call",
"(",
"variable",
")",
",",
"typeBig",
"=",
"str",
".",
"match",
"(",
"regExp",
")",
"[",
"1",
... | get type of variable
@param variable | [
"get",
"type",
"of",
"variable"
] | cccd3550f96a99e3176d24de5328663a3f7f1c1e | https://github.com/coderaiser/util-io/blob/cccd3550f96a99e3176d24de5328663a3f7f1c1e/lib/util.js#L285-L292 | train |
coderaiser/util-io | lib/util.js | function(callback) {
var ret,
isFunc = Util.type.function(callback),
args = [].slice.call(arguments, 1);
if (isFunc)
ret = callback.apply(null, args);
return ret;
... | javascript | function(callback) {
var ret,
isFunc = Util.type.function(callback),
args = [].slice.call(arguments, 1);
if (isFunc)
ret = callback.apply(null, args);
return ret;
... | [
"function",
"(",
"callback",
")",
"{",
"var",
"ret",
",",
"isFunc",
"=",
"Util",
".",
"type",
".",
"function",
"(",
"callback",
")",
",",
"args",
"=",
"[",
"]",
".",
"slice",
".",
"call",
"(",
"arguments",
",",
"1",
")",
";",
"if",
"(",
"isFunc",... | function do save exec of function
@param callback
@param arg1
...
@param argN | [
"function",
"do",
"save",
"exec",
"of",
"function"
] | cccd3550f96a99e3176d24de5328663a3f7f1c1e | https://github.com/coderaiser/util-io/blob/cccd3550f96a99e3176d24de5328663a3f7f1c1e/lib/util.js#L330-L339 | train | |
novemberborn/chai-sentinels | lib/Sentinel.js | Sentinel | function Sentinel(label, propertiesObject) {
if (!(this instanceof Sentinel)) {
return new Sentinel(label, propertiesObject);
}
if (typeof label === 'object' && label) {
propertiesObject = label;
label = undefined;
}
if (typeof label === 'number') {
label = String(label);
} else if (typeof... | javascript | function Sentinel(label, propertiesObject) {
if (!(this instanceof Sentinel)) {
return new Sentinel(label, propertiesObject);
}
if (typeof label === 'object' && label) {
propertiesObject = label;
label = undefined;
}
if (typeof label === 'number') {
label = String(label);
} else if (typeof... | [
"function",
"Sentinel",
"(",
"label",
",",
"propertiesObject",
")",
"{",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"Sentinel",
")",
")",
"{",
"return",
"new",
"Sentinel",
"(",
"label",
",",
"propertiesObject",
")",
";",
"}",
"if",
"(",
"typeof",
"label"... | If truey, `propertiesObject` is used to define properties on the sentinel instance. Can be used without `new`. | [
"If",
"truey",
"propertiesObject",
"is",
"used",
"to",
"define",
"properties",
"on",
"the",
"sentinel",
"instance",
".",
"Can",
"be",
"used",
"without",
"new",
"."
] | 23b52bb40eba43b053ed4236dddc8a5f9ba82d0c | https://github.com/novemberborn/chai-sentinels/blob/23b52bb40eba43b053ed4236dddc8a5f9ba82d0c/lib/Sentinel.js#L20-L53 | train |
johnpaulvaughan/itunes-music-library-path | index.js | _buildPaths | function _buildPaths() {
var home = os.homedir();
var path1 = path.resolve(home + '/Music/iTunes/iTunes Music Library.xml');
var path2 = path.resolve(home + '/Music/iTunes/iTunes Library.xml');
return [path1, path1];
} | javascript | function _buildPaths() {
var home = os.homedir();
var path1 = path.resolve(home + '/Music/iTunes/iTunes Music Library.xml');
var path2 = path.resolve(home + '/Music/iTunes/iTunes Library.xml');
return [path1, path1];
} | [
"function",
"_buildPaths",
"(",
")",
"{",
"var",
"home",
"=",
"os",
".",
"homedir",
"(",
")",
";",
"var",
"path1",
"=",
"path",
".",
"resolve",
"(",
"home",
"+",
"'/Music/iTunes/iTunes Music Library.xml'",
")",
";",
"var",
"path2",
"=",
"path",
".",
"res... | return an array containing the two most likely iTunes XML filepaths.
@param null
@return Array<string> | [
"return",
"an",
"array",
"containing",
"the",
"two",
"most",
"likely",
"iTunes",
"XML",
"filepaths",
"."
] | b798340d9ece1a8a9cc575e50a23f34df86a6ac5 | https://github.com/johnpaulvaughan/itunes-music-library-path/blob/b798340d9ece1a8a9cc575e50a23f34df86a6ac5/index.js#L25-L30 | train |
Wiredcraft/carcass | lib/proto/loader.js | function() {
var parser, source;
source = this.source();
if (source == null) {
return;
}
parser = this.parser();
if (parser != null) {
return parser(source);
} else {
return source;
}
} | javascript | function() {
var parser, source;
source = this.source();
if (source == null) {
return;
}
parser = this.parser();
if (parser != null) {
return parser(source);
} else {
return source;
}
} | [
"function",
"(",
")",
"{",
"var",
"parser",
",",
"source",
";",
"source",
"=",
"this",
".",
"source",
"(",
")",
";",
"if",
"(",
"source",
"==",
"null",
")",
"{",
"return",
";",
"}",
"parser",
"=",
"this",
".",
"parser",
"(",
")",
";",
"if",
"("... | Reload from source. Parse source if a parser is available.
@return {value} | [
"Reload",
"from",
"source",
".",
"Parse",
"source",
"if",
"a",
"parser",
"is",
"available",
"."
] | 3527ec0253f55abba8e6b255e7bf3412b3ca7501 | https://github.com/Wiredcraft/carcass/blob/3527ec0253f55abba8e6b255e7bf3412b3ca7501/lib/proto/loader.js#L22-L34 | train | |
dalekjs/dalek-driver-sauce | index.js | function (opts) {
// get the browser configuration & the browser module
var browserConf = {name: null};
var browser = opts.browserMo;
// prepare properties
this._initializeProperties(opts);
// create a new webdriver client instance
this.webdriverClient = new WD(browser, this.events);
// listen on bro... | javascript | function (opts) {
// get the browser configuration & the browser module
var browserConf = {name: null};
var browser = opts.browserMo;
// prepare properties
this._initializeProperties(opts);
// create a new webdriver client instance
this.webdriverClient = new WD(browser, this.events);
// listen on bro... | [
"function",
"(",
"opts",
")",
"{",
"// get the browser configuration & the browser module",
"var",
"browserConf",
"=",
"{",
"name",
":",
"null",
"}",
";",
"var",
"browser",
"=",
"opts",
".",
"browserMo",
";",
"// prepare properties",
"this",
".",
"_initializePropert... | Initializes the sauce labs driver & the remote browser instance
@param {object} opts Initializer options
@constructor | [
"Initializes",
"the",
"sauce",
"labs",
"driver",
"&",
"the",
"remote",
"browser",
"instance"
] | 4b3ef87a0c35a91db8456d074b0d47a3e0df58f7 | https://github.com/dalekjs/dalek-driver-sauce/blob/4b3ef87a0c35a91db8456d074b0d47a3e0df58f7/index.js#L42-L75 | train | |
dalekjs/dalek-driver-sauce | index.js | function (opts) {
// prepare properties
this.actionQueue = [];
this.config = opts.config;
this.lastCalledUrl = null;
this.driverStatus = {};
this.sessionStatus = {};
// store injcted options in object properties
this.events = opts.events;
this.reporterEvents = opts.reporter;
this... | javascript | function (opts) {
// prepare properties
this.actionQueue = [];
this.config = opts.config;
this.lastCalledUrl = null;
this.driverStatus = {};
this.sessionStatus = {};
// store injcted options in object properties
this.events = opts.events;
this.reporterEvents = opts.reporter;
this... | [
"function",
"(",
"opts",
")",
"{",
"// prepare properties",
"this",
".",
"actionQueue",
"=",
"[",
"]",
";",
"this",
".",
"config",
"=",
"opts",
".",
"config",
";",
"this",
".",
"lastCalledUrl",
"=",
"null",
";",
"this",
".",
"driverStatus",
"=",
"{",
"... | Initializes the driver properties
@method _initializeProperties
@param {object} opts Options needed to kick off the driver
@chainable
@private | [
"Initializes",
"the",
"driver",
"properties"
] | 4b3ef87a0c35a91db8456d074b0d47a3e0df58f7 | https://github.com/dalekjs/dalek-driver-sauce/blob/4b3ef87a0c35a91db8456d074b0d47a3e0df58f7/index.js#L175-L187 | train | |
dalekjs/dalek-driver-sauce | index.js | function (browser) {
// issue the kill command to the browser, when all tests are completed
this.events.on('tests:complete:sauce:' + this.browserName, browser.kill.bind(browser));
// clear the webdriver session, when all tests are completed
this.events.on('tests:complete:sauce:' + this.browserName, this... | javascript | function (browser) {
// issue the kill command to the browser, when all tests are completed
this.events.on('tests:complete:sauce:' + this.browserName, browser.kill.bind(browser));
// clear the webdriver session, when all tests are completed
this.events.on('tests:complete:sauce:' + this.browserName, this... | [
"function",
"(",
"browser",
")",
"{",
"// issue the kill command to the browser, when all tests are completed",
"this",
".",
"events",
".",
"on",
"(",
"'tests:complete:sauce:'",
"+",
"this",
".",
"browserName",
",",
"browser",
".",
"kill",
".",
"bind",
"(",
"browser",... | Binds listeners on browser events
@method _initializeProperties
@param {object} browser Browser module
@chainable
@private | [
"Binds",
"listeners",
"on",
"browser",
"events"
] | 4b3ef87a0c35a91db8456d074b0d47a3e0df58f7 | https://github.com/dalekjs/dalek-driver-sauce/blob/4b3ef87a0c35a91db8456d074b0d47a3e0df58f7/index.js#L198-L204 | train | |
dalekjs/dalek-driver-sauce | index.js | function () {
var deferred = Q.defer();
// store desired capabilities of this session
this.desiredCapabilities = this.browserData.getDesiredCapabilities(this.browserName, this.config);
this.browserDefaults = this.browserData.driverDefaults;
this.browserDefaults.status = this.browserData.getStatusDe... | javascript | function () {
var deferred = Q.defer();
// store desired capabilities of this session
this.desiredCapabilities = this.browserData.getDesiredCapabilities(this.browserName, this.config);
this.browserDefaults = this.browserData.driverDefaults;
this.browserDefaults.status = this.browserData.getStatusDe... | [
"function",
"(",
")",
"{",
"var",
"deferred",
"=",
"Q",
".",
"defer",
"(",
")",
";",
"// store desired capabilities of this session",
"this",
".",
"desiredCapabilities",
"=",
"this",
".",
"browserData",
".",
"getDesiredCapabilities",
"(",
"this",
".",
"browserName... | Checks if a webdriver session has already been established,
if not, create a new one
@method start
@return {object} promise Driver promise | [
"Checks",
"if",
"a",
"webdriver",
"session",
"has",
"already",
"been",
"established",
"if",
"not",
"create",
"a",
"new",
"one"
] | 4b3ef87a0c35a91db8456d074b0d47a3e0df58f7 | https://github.com/dalekjs/dalek-driver-sauce/blob/4b3ef87a0c35a91db8456d074b0d47a3e0df58f7/index.js#L214-L226 | train | |
dalekjs/dalek-driver-sauce | index.js | function () {
var result = Q.resolve();
// loop through all promises created by the remote methods
// this is synchronous, so it waits if a method is finished before
// the next one will be executed
this.actionQueue.forEach(function (f) {
result = result.then(f);
});
// flush the que... | javascript | function () {
var result = Q.resolve();
// loop through all promises created by the remote methods
// this is synchronous, so it waits if a method is finished before
// the next one will be executed
this.actionQueue.forEach(function (f) {
result = result.then(f);
});
// flush the que... | [
"function",
"(",
")",
"{",
"var",
"result",
"=",
"Q",
".",
"resolve",
"(",
")",
";",
"// loop through all promises created by the remote methods",
"// this is synchronous, so it waits if a method is finished before",
"// the next one will be executed",
"this",
".",
"actionQueue",... | Starts to execution of a batch of tests
@method end
@chainable | [
"Starts",
"to",
"execution",
"of",
"a",
"batch",
"of",
"tests"
] | 4b3ef87a0c35a91db8456d074b0d47a3e0df58f7 | https://github.com/dalekjs/dalek-driver-sauce/blob/4b3ef87a0c35a91db8456d074b0d47a3e0df58f7/index.js#L281-L295 | train | |
dalekjs/dalek-driver-sauce | index.js | function (sessionInfo) {
var defer = Q.defer();
this.sessionStatus = JSON.parse(sessionInfo).value;
this.events.emit('driver:sessionStatus:sauce:' + this.browserName, this.sessionStatus);
defer.resolve();
return defer.promise;
} | javascript | function (sessionInfo) {
var defer = Q.defer();
this.sessionStatus = JSON.parse(sessionInfo).value;
this.events.emit('driver:sessionStatus:sauce:' + this.browserName, this.sessionStatus);
defer.resolve();
return defer.promise;
} | [
"function",
"(",
"sessionInfo",
")",
"{",
"var",
"defer",
"=",
"Q",
".",
"defer",
"(",
")",
";",
"this",
".",
"sessionStatus",
"=",
"JSON",
".",
"parse",
"(",
"sessionInfo",
")",
".",
"value",
";",
"this",
".",
"events",
".",
"emit",
"(",
"'driver:se... | Loads the browser session status
@method _sessionStatus
@param {object} sessionInfo Session information
@return {object} promise Browser session promise
@private | [
"Loads",
"the",
"browser",
"session",
"status"
] | 4b3ef87a0c35a91db8456d074b0d47a3e0df58f7 | https://github.com/dalekjs/dalek-driver-sauce/blob/4b3ef87a0c35a91db8456d074b0d47a3e0df58f7/index.js#L328-L334 | train | |
dalekjs/dalek-driver-sauce | index.js | function (statusInfo) {
var defer = Q.defer();
this.driverStatus = JSON.parse(statusInfo).value;
this.events.emit('driver:status:sauce:' + this.browserName, this.driverStatus);
defer.resolve();
return defer.promise;
} | javascript | function (statusInfo) {
var defer = Q.defer();
this.driverStatus = JSON.parse(statusInfo).value;
this.events.emit('driver:status:sauce:' + this.browserName, this.driverStatus);
defer.resolve();
return defer.promise;
} | [
"function",
"(",
"statusInfo",
")",
"{",
"var",
"defer",
"=",
"Q",
".",
"defer",
"(",
")",
";",
"this",
".",
"driverStatus",
"=",
"JSON",
".",
"parse",
"(",
"statusInfo",
")",
".",
"value",
";",
"this",
".",
"events",
".",
"emit",
"(",
"'driver:statu... | Loads the browser driver status
@method _driverStatus
@param {object} statusInfo Driver status information
@return {object} promise Driver status promise
@private | [
"Loads",
"the",
"browser",
"driver",
"status"
] | 4b3ef87a0c35a91db8456d074b0d47a3e0df58f7 | https://github.com/dalekjs/dalek-driver-sauce/blob/4b3ef87a0c35a91db8456d074b0d47a3e0df58f7/index.js#L345-L351 | train | |
OpenSmartEnvironment/ose-lirc | lib/lirc/node.js | onError | function onError() { // {{{2
O.log.unhandled('LIRC ERROR', arguments);
delete this.socket;
setTimeout(connect.bind(null, this), 1000);
} | javascript | function onError() { // {{{2
O.log.unhandled('LIRC ERROR', arguments);
delete this.socket;
setTimeout(connect.bind(null, this), 1000);
} | [
"function",
"onError",
"(",
")",
"{",
"// {{{2",
"O",
".",
"log",
".",
"unhandled",
"(",
"'LIRC ERROR'",
",",
"arguments",
")",
";",
"delete",
"this",
".",
"socket",
";",
"setTimeout",
"(",
"connect",
".",
"bind",
"(",
"null",
",",
"this",
")",
",",
... | Entry Event Handlers {{{1 `this` is bound to entry. | [
"Entry",
"Event",
"Handlers",
"{{{",
"1",
"this",
"is",
"bound",
"to",
"entry",
"."
] | a9882e44d84d75420eae3da25f89977ac70a33fe | https://github.com/OpenSmartEnvironment/ose-lirc/blob/a9882e44d84d75420eae3da25f89977ac70a33fe/lib/lirc/node.js#L14-L20 | train |
lr360/fidem-signer | lib/auth-header.js | extractParameters | function extractParameters(header) {
var SEPARATOR = /(?: |,)/g;
var OPERATOR = /=/;
return header.split(SEPARATOR).reduce(function (parameters, property) {
var parts = property.split(OPERATOR).map(function (part) {
return part.trim();
});
if (parts.length === 2)
parameters[parts[0]] = p... | javascript | function extractParameters(header) {
var SEPARATOR = /(?: |,)/g;
var OPERATOR = /=/;
return header.split(SEPARATOR).reduce(function (parameters, property) {
var parts = property.split(OPERATOR).map(function (part) {
return part.trim();
});
if (parts.length === 2)
parameters[parts[0]] = p... | [
"function",
"extractParameters",
"(",
"header",
")",
"{",
"var",
"SEPARATOR",
"=",
"/",
"(?: |,)",
"/",
"g",
";",
"var",
"OPERATOR",
"=",
"/",
"=",
"/",
";",
"return",
"header",
".",
"split",
"(",
"SEPARATOR",
")",
".",
"reduce",
"(",
"function",
"(",
... | Extract parameters from header.
@param {string} header
@returns {object} | [
"Extract",
"parameters",
"from",
"header",
"."
] | 12b3265f5373195d2842a65ed0d0ae4f242027c9 | https://github.com/lr360/fidem-signer/blob/12b3265f5373195d2842a65ed0d0ae4f242027c9/lib/auth-header.js#L54-L68 | train |
jka6502/stratum | lib/require.js | each | function each(object, callback) {
if (!object) { return true; }
if (object.forEach) { return object.forEach(callback); }
if (object instanceof Array) {
var length = array ? array.length : 0;
for(var index = 0; index < length; index++) {
callback(array[index], index);
}
}else{
for(var ke... | javascript | function each(object, callback) {
if (!object) { return true; }
if (object.forEach) { return object.forEach(callback); }
if (object instanceof Array) {
var length = array ? array.length : 0;
for(var index = 0; index < length; index++) {
callback(array[index], index);
}
}else{
for(var ke... | [
"function",
"each",
"(",
"object",
",",
"callback",
")",
"{",
"if",
"(",
"!",
"object",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"object",
".",
"forEach",
")",
"{",
"return",
"object",
".",
"forEach",
"(",
"callback",
")",
";",
"}",
"if",
... | Generic iterator. Iterate over array elements, or object properties, invoking the `callback` specified on each item, using `Array.prototype.forEach` when available, or a polyfill, when not. | [
"Generic",
"iterator",
".",
"Iterate",
"over",
"array",
"elements",
"or",
"object",
"properties",
"invoking",
"the",
"callback",
"specified",
"on",
"each",
"item",
"using",
"Array",
".",
"prototype",
".",
"forEach",
"when",
"available",
"or",
"a",
"polyfill",
... | 698a8abfb07436eda76813786de2d49f08d4081b | https://github.com/jka6502/stratum/blob/698a8abfb07436eda76813786de2d49f08d4081b/lib/require.js#L15-L30 | train |
jka6502/stratum | lib/require.js | every | function every(object, callback) {
if (!object) { return true; }
if (object.every) { return object.every(callback); }
if (object instanceof Array) {
var length = array ? array.length : 0;
for(var index = 0; index < length; index++) {
if (!callback(array[index], index)) { return false; }
}
}... | javascript | function every(object, callback) {
if (!object) { return true; }
if (object.every) { return object.every(callback); }
if (object instanceof Array) {
var length = array ? array.length : 0;
for(var index = 0; index < length; index++) {
if (!callback(array[index], index)) { return false; }
}
}... | [
"function",
"every",
"(",
"object",
",",
"callback",
")",
"{",
"if",
"(",
"!",
"object",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"object",
".",
"every",
")",
"{",
"return",
"object",
".",
"every",
"(",
"callback",
")",
";",
"}",
"if",
"(... | Generic 'every' function. Tolerant of null 'objects' and works on arrays or arbitrary objects. | [
"Generic",
"every",
"function",
".",
"Tolerant",
"of",
"null",
"objects",
"and",
"works",
"on",
"arrays",
"or",
"arbitrary",
"objects",
"."
] | 698a8abfb07436eda76813786de2d49f08d4081b | https://github.com/jka6502/stratum/blob/698a8abfb07436eda76813786de2d49f08d4081b/lib/require.js#L62-L77 | train |
jka6502/stratum | lib/require.js | clone | function clone(object, deep) {
if (!object) { return object; }
var clone = object.prototype
? Object.create(object.prototype.constructor) : {};
for(var key in object) {
if (!object.hasOwnProperty(key)) { continue; }
clone[key] = deep ? clone(object[key], deep) : object[key];
}
return clo... | javascript | function clone(object, deep) {
if (!object) { return object; }
var clone = object.prototype
? Object.create(object.prototype.constructor) : {};
for(var key in object) {
if (!object.hasOwnProperty(key)) { continue; }
clone[key] = deep ? clone(object[key], deep) : object[key];
}
return clo... | [
"function",
"clone",
"(",
"object",
",",
"deep",
")",
"{",
"if",
"(",
"!",
"object",
")",
"{",
"return",
"object",
";",
"}",
"var",
"clone",
"=",
"object",
".",
"prototype",
"?",
"Object",
".",
"create",
"(",
"object",
".",
"prototype",
".",
"constru... | Create a clone of the object specified. If `deep` is truthy, clone any referenced properties too. | [
"Create",
"a",
"clone",
"of",
"the",
"object",
"specified",
".",
"If",
"deep",
"is",
"truthy",
"clone",
"any",
"referenced",
"properties",
"too",
"."
] | 698a8abfb07436eda76813786de2d49f08d4081b | https://github.com/jka6502/stratum/blob/698a8abfb07436eda76813786de2d49f08d4081b/lib/require.js#L102-L112 | train |
jka6502/stratum | lib/require.js | function(paths) {
var base = Script.current(this).absolute;
each(paths, function(item, index) {
var path = paths[index] = URL.absolute(URL.clean(item), base);
if (path[path.length - 1] !== '/') {
paths[index] += '/';
}
});
return paths;
} | javascript | function(paths) {
var base = Script.current(this).absolute;
each(paths, function(item, index) {
var path = paths[index] = URL.absolute(URL.clean(item), base);
if (path[path.length - 1] !== '/') {
paths[index] += '/';
}
});
return paths;
} | [
"function",
"(",
"paths",
")",
"{",
"var",
"base",
"=",
"Script",
".",
"current",
"(",
"this",
")",
".",
"absolute",
";",
"each",
"(",
"paths",
",",
"function",
"(",
"item",
",",
"index",
")",
"{",
"var",
"path",
"=",
"paths",
"[",
"index",
"]",
... | Resolve supplied paths relative to the current script, or page URL, to configure absolute base paths of a `Loader` instance. | [
"Resolve",
"supplied",
"paths",
"relative",
"to",
"the",
"current",
"script",
"or",
"page",
"URL",
"to",
"configure",
"absolute",
"base",
"paths",
"of",
"a",
"Loader",
"instance",
"."
] | 698a8abfb07436eda76813786de2d49f08d4081b | https://github.com/jka6502/stratum/blob/698a8abfb07436eda76813786de2d49f08d4081b/lib/require.js#L165-L174 | train | |
jka6502/stratum | lib/require.js | function(script) {
if (script.loader !== this) { return script.loader.load(script); }
Loader.loaded = false;
if (this.loaded[script.id]) { return true; }
if (this.failed[script.id]) {
throw new Error('No such file: ' + script.url);
}
this.pending[script.id] = script;
return false;
... | javascript | function(script) {
if (script.loader !== this) { return script.loader.load(script); }
Loader.loaded = false;
if (this.loaded[script.id]) { return true; }
if (this.failed[script.id]) {
throw new Error('No such file: ' + script.url);
}
this.pending[script.id] = script;
return false;
... | [
"function",
"(",
"script",
")",
"{",
"if",
"(",
"script",
".",
"loader",
"!==",
"this",
")",
"{",
"return",
"script",
".",
"loader",
".",
"load",
"(",
"script",
")",
";",
"}",
"Loader",
".",
"loaded",
"=",
"false",
";",
"if",
"(",
"this",
".",
"l... | Queue the `Script` specified for loading. | [
"Queue",
"the",
"Script",
"specified",
"for",
"loading",
"."
] | 698a8abfb07436eda76813786de2d49f08d4081b | https://github.com/jka6502/stratum/blob/698a8abfb07436eda76813786de2d49f08d4081b/lib/require.js#L185-L195 | train | |
jka6502/stratum | lib/require.js | function() {
if (Loader.loading) { return false; }
var count = 0;
if (some(this.pending, function(script) {
count++;
if (script.satisfied()) {
Loader.loading = script;
script.module.install();
script.load();
return true;
}
return false;
}) || count === 0) ... | javascript | function() {
if (Loader.loading) { return false; }
var count = 0;
if (some(this.pending, function(script) {
count++;
if (script.satisfied()) {
Loader.loading = script;
script.module.install();
script.load();
return true;
}
return false;
}) || count === 0) ... | [
"function",
"(",
")",
"{",
"if",
"(",
"Loader",
".",
"loading",
")",
"{",
"return",
"false",
";",
"}",
"var",
"count",
"=",
"0",
";",
"if",
"(",
"some",
"(",
"this",
".",
"pending",
",",
"function",
"(",
"script",
")",
"{",
"count",
"++",
";",
... | Begin loading the next viable `Script`. | [
"Begin",
"loading",
"the",
"next",
"viable",
"Script",
"."
] | 698a8abfb07436eda76813786de2d49f08d4081b | https://github.com/jka6502/stratum/blob/698a8abfb07436eda76813786de2d49f08d4081b/lib/require.js#L199-L215 | train | |
jka6502/stratum | lib/require.js | function() {
var pending = this.pending,
script;
for(var name in pending) {
if (!pending.hasOwnProperty(name)) { continue; }
var cycle = pending[name].cycle();
if (cycle) {
cycle[0].allow(cycle[1]);
this.load(cycle[0]);
return true;
}
}
} | javascript | function() {
var pending = this.pending,
script;
for(var name in pending) {
if (!pending.hasOwnProperty(name)) { continue; }
var cycle = pending[name].cycle();
if (cycle) {
cycle[0].allow(cycle[1]);
this.load(cycle[0]);
return true;
}
}
} | [
"function",
"(",
")",
"{",
"var",
"pending",
"=",
"this",
".",
"pending",
",",
"script",
";",
"for",
"(",
"var",
"name",
"in",
"pending",
")",
"{",
"if",
"(",
"!",
"pending",
".",
"hasOwnProperty",
"(",
"name",
")",
")",
"{",
"continue",
";",
"}",
... | Resolve a cyclic dependency between queued `Script`s. | [
"Resolve",
"a",
"cyclic",
"dependency",
"between",
"queued",
"Script",
"s",
"."
] | 698a8abfb07436eda76813786de2d49f08d4081b | https://github.com/jka6502/stratum/blob/698a8abfb07436eda76813786de2d49f08d4081b/lib/require.js#L219-L232 | train | |
jka6502/stratum | lib/require.js | function(script) {
script.module.uninstall();
if (script.stopped || (!script.callback && Loader.loading !== script)) {
script.loader.load(script);
Loader.next();
return;
}
this.loaded[script.id] = script;
delete this.pending[script.id];
Loader.loading = null;
Loader.next();
... | javascript | function(script) {
script.module.uninstall();
if (script.stopped || (!script.callback && Loader.loading !== script)) {
script.loader.load(script);
Loader.next();
return;
}
this.loaded[script.id] = script;
delete this.pending[script.id];
Loader.loading = null;
Loader.next();
... | [
"function",
"(",
"script",
")",
"{",
"script",
".",
"module",
".",
"uninstall",
"(",
")",
";",
"if",
"(",
"script",
".",
"stopped",
"||",
"(",
"!",
"script",
".",
"callback",
"&&",
"Loader",
".",
"loading",
"!==",
"script",
")",
")",
"{",
"script",
... | Event fired when a `Script` managed by this `Loader` has loaded. | [
"Event",
"fired",
"when",
"a",
"Script",
"managed",
"by",
"this",
"Loader",
"has",
"loaded",
"."
] | 698a8abfb07436eda76813786de2d49f08d4081b | https://github.com/jka6502/stratum/blob/698a8abfb07436eda76813786de2d49f08d4081b/lib/require.js#L236-L247 | train | |
jka6502/stratum | lib/require.js | function(script) {
script.module.uninstall();
if (Loader.loading === script) {
Loader.loading = null;
}
script.destroy();
if (!script.next()) {
delete this.pending[script.id];
this.failed[script.id] = script;
}
Loader.next();
} | javascript | function(script) {
script.module.uninstall();
if (Loader.loading === script) {
Loader.loading = null;
}
script.destroy();
if (!script.next()) {
delete this.pending[script.id];
this.failed[script.id] = script;
}
Loader.next();
} | [
"function",
"(",
"script",
")",
"{",
"script",
".",
"module",
".",
"uninstall",
"(",
")",
";",
"if",
"(",
"Loader",
".",
"loading",
"===",
"script",
")",
"{",
"Loader",
".",
"loading",
"=",
"null",
";",
"}",
"script",
".",
"destroy",
"(",
")",
";",... | Even fired when a `Script` managed by this `Loader` has failed. | [
"Even",
"fired",
"when",
"a",
"Script",
"managed",
"by",
"this",
"Loader",
"has",
"failed",
"."
] | 698a8abfb07436eda76813786de2d49f08d4081b | https://github.com/jka6502/stratum/blob/698a8abfb07436eda76813786de2d49f08d4081b/lib/require.js#L251-L262 | train | |
jka6502/stratum | lib/require.js | function(url) {
var loaded = this.loaded,
pending = this.pending,
failed = this.failed,
relative = this.relative(url);
return loaded[relative] || pending[relative] || [failed[relative]];
} | javascript | function(url) {
var loaded = this.loaded,
pending = this.pending,
failed = this.failed,
relative = this.relative(url);
return loaded[relative] || pending[relative] || [failed[relative]];
} | [
"function",
"(",
"url",
")",
"{",
"var",
"loaded",
"=",
"this",
".",
"loaded",
",",
"pending",
"=",
"this",
".",
"pending",
",",
"failed",
"=",
"this",
".",
"failed",
",",
"relative",
"=",
"this",
".",
"relative",
"(",
"url",
")",
";",
"return",
"l... | Find the first `Script` that matches the `url` passed, resolving possible base path relative urls. | [
"Find",
"the",
"first",
"Script",
"that",
"matches",
"the",
"url",
"passed",
"resolving",
"possible",
"base",
"path",
"relative",
"urls",
"."
] | 698a8abfb07436eda76813786de2d49f08d4081b | https://github.com/jka6502/stratum/blob/698a8abfb07436eda76813786de2d49f08d4081b/lib/require.js#L267-L274 | train | |
jka6502/stratum | lib/require.js | function(callback) {
var original = Loader.using;
Loader.using = this;
try{
callback();
}finally{
Loader.using = original;
}
} | javascript | function(callback) {
var original = Loader.using;
Loader.using = this;
try{
callback();
}finally{
Loader.using = original;
}
} | [
"function",
"(",
"callback",
")",
"{",
"var",
"original",
"=",
"Loader",
".",
"using",
";",
"Loader",
".",
"using",
"=",
"this",
";",
"try",
"{",
"callback",
"(",
")",
";",
"}",
"finally",
"{",
"Loader",
".",
"using",
"=",
"original",
";",
"}",
"}"... | Use this `Loader` for the duration of the callback specified. | [
"Use",
"this",
"Loader",
"for",
"the",
"duration",
"of",
"the",
"callback",
"specified",
"."
] | 698a8abfb07436eda76813786de2d49f08d4081b | https://github.com/jka6502/stratum/blob/698a8abfb07436eda76813786de2d49f08d4081b/lib/require.js#L349-L357 | train | |
jka6502/stratum | lib/require.js | function(url) {
var paths = this.paths;
for(var index = 0; index < paths.length; index++) {
var path = paths[index];
if (path === url.substring(0, path.length)) {
return url.substring(path.length);
}
}
return url;
} | javascript | function(url) {
var paths = this.paths;
for(var index = 0; index < paths.length; index++) {
var path = paths[index];
if (path === url.substring(0, path.length)) {
return url.substring(path.length);
}
}
return url;
} | [
"function",
"(",
"url",
")",
"{",
"var",
"paths",
"=",
"this",
".",
"paths",
";",
"for",
"(",
"var",
"index",
"=",
"0",
";",
"index",
"<",
"paths",
".",
"length",
";",
"index",
"++",
")",
"{",
"var",
"path",
"=",
"paths",
"[",
"index",
"]",
";"... | Find the `url` supplied, relative to the first matching base path. | [
"Find",
"the",
"url",
"supplied",
"relative",
"to",
"the",
"first",
"matching",
"base",
"path",
"."
] | 698a8abfb07436eda76813786de2d49f08d4081b | https://github.com/jka6502/stratum/blob/698a8abfb07436eda76813786de2d49f08d4081b/lib/require.js#L361-L370 | train | |
jka6502/stratum | lib/require.js | function() {
if (!this.remain.length) { return false; }
var next = this.remain.shift();
this.absolute = URL.absolute(this.url, next);
return true;
} | javascript | function() {
if (!this.remain.length) { return false; }
var next = this.remain.shift();
this.absolute = URL.absolute(this.url, next);
return true;
} | [
"function",
"(",
")",
"{",
"if",
"(",
"!",
"this",
".",
"remain",
".",
"length",
")",
"{",
"return",
"false",
";",
"}",
"var",
"next",
"=",
"this",
".",
"remain",
".",
"shift",
"(",
")",
";",
"this",
".",
"absolute",
"=",
"URL",
".",
"absolute",
... | Select the next viable `path` from the owning `Loader` to try and load this script from, returns true if another path is viable, false if there are no remaining acceptable paths. | [
"Select",
"the",
"next",
"viable",
"path",
"from",
"the",
"owning",
"Loader",
"to",
"try",
"and",
"load",
"this",
"script",
"from",
"returns",
"true",
"if",
"another",
"path",
"is",
"viable",
"false",
"if",
"there",
"are",
"no",
"remaining",
"acceptable",
... | 698a8abfb07436eda76813786de2d49f08d4081b | https://github.com/jka6502/stratum/blob/698a8abfb07436eda76813786de2d49f08d4081b/lib/require.js#L493-L498 | train | |
jka6502/stratum | lib/require.js | function() {
delete this.stopped;
if (this.callback) {
try{
this.module.exports = this.callback();
}catch(e) {
if (e === STOP_EVENT) {
this.onfail();
}else{
return this.onfail();
}
}
return this.onload();
}else{
this.create();
this.bind();
... | javascript | function() {
delete this.stopped;
if (this.callback) {
try{
this.module.exports = this.callback();
}catch(e) {
if (e === STOP_EVENT) {
this.onfail();
}else{
return this.onfail();
}
}
return this.onload();
}else{
this.create();
this.bind();
... | [
"function",
"(",
")",
"{",
"delete",
"this",
".",
"stopped",
";",
"if",
"(",
"this",
".",
"callback",
")",
"{",
"try",
"{",
"this",
".",
"module",
".",
"exports",
"=",
"this",
".",
"callback",
"(",
")",
";",
"}",
"catch",
"(",
"e",
")",
"{",
"i... | Attempt to load this `Script`. | [
"Attempt",
"to",
"load",
"this",
"Script",
"."
] | 698a8abfb07436eda76813786de2d49f08d4081b | https://github.com/jka6502/stratum/blob/698a8abfb07436eda76813786de2d49f08d4081b/lib/require.js#L502-L520 | train | |
jka6502/stratum | lib/require.js | function() {
if (this.events) { return; }
var tag = this.tag,
script = this,
prefix = '',
method = 'addEventListener';
// The alternative is nuking Redmond from orbit, its the only way to
// be sure...
if (!tag.addEventListener) {
prefix = 'on';
method = 'attachEvent';
... | javascript | function() {
if (this.events) { return; }
var tag = this.tag,
script = this,
prefix = '',
method = 'addEventListener';
// The alternative is nuking Redmond from orbit, its the only way to
// be sure...
if (!tag.addEventListener) {
prefix = 'on';
method = 'attachEvent';
... | [
"function",
"(",
")",
"{",
"if",
"(",
"this",
".",
"events",
")",
"{",
"return",
";",
"}",
"var",
"tag",
"=",
"this",
".",
"tag",
",",
"script",
"=",
"this",
",",
"prefix",
"=",
"''",
",",
"method",
"=",
"'addEventListener'",
";",
"// The alternative... | Bind events to indicate success, or failure, of loading this `Script` instance. | [
"Bind",
"events",
"to",
"indicate",
"success",
"or",
"failure",
"of",
"loading",
"this",
"Script",
"instance",
"."
] | 698a8abfb07436eda76813786de2d49f08d4081b | https://github.com/jka6502/stratum/blob/698a8abfb07436eda76813786de2d49f08d4081b/lib/require.js#L572-L616 | train | |
jka6502/stratum | lib/require.js | function() {
var depends = this.depends,
allowed = this.allowed;
return every(depends, function(depend) {
return depend.loader.loaded[depend.id]
|| depend.loader.failed[depend.id]
|| allowed[depend.id];
});
} | javascript | function() {
var depends = this.depends,
allowed = this.allowed;
return every(depends, function(depend) {
return depend.loader.loaded[depend.id]
|| depend.loader.failed[depend.id]
|| allowed[depend.id];
});
} | [
"function",
"(",
")",
"{",
"var",
"depends",
"=",
"this",
".",
"depends",
",",
"allowed",
"=",
"this",
".",
"allowed",
";",
"return",
"every",
"(",
"depends",
",",
"function",
"(",
"depend",
")",
"{",
"return",
"depend",
".",
"loader",
".",
"loaded",
... | Check whether this `Script`'s dependencies have been satisfied. | [
"Check",
"whether",
"this",
"Script",
"s",
"dependencies",
"have",
"been",
"satisfied",
"."
] | 698a8abfb07436eda76813786de2d49f08d4081b | https://github.com/jka6502/stratum/blob/698a8abfb07436eda76813786de2d49f08d4081b/lib/require.js#L665-L674 | train | |
jka6502/stratum | lib/require.js | function(requesters, parent) {
if (this.satisfied()) { return null; }
requesters = requesters || {};
var id = this.id;
if (requesters[id] && !parent.allowed[id]) {
return [parent, this];
}
requesters[id] = this;
var depends = this.depends;
for(var name in depends) {
if (!de... | javascript | function(requesters, parent) {
if (this.satisfied()) { return null; }
requesters = requesters || {};
var id = this.id;
if (requesters[id] && !parent.allowed[id]) {
return [parent, this];
}
requesters[id] = this;
var depends = this.depends;
for(var name in depends) {
if (!de... | [
"function",
"(",
"requesters",
",",
"parent",
")",
"{",
"if",
"(",
"this",
".",
"satisfied",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"requesters",
"=",
"requesters",
"||",
"{",
"}",
";",
"var",
"id",
"=",
"this",
".",
"id",
";",
"if",
"("... | Detect cyclic dependencies between this `Script` and those it depends on. | [
"Detect",
"cyclic",
"dependencies",
"between",
"this",
"Script",
"and",
"those",
"it",
"depends",
"on",
"."
] | 698a8abfb07436eda76813786de2d49f08d4081b | https://github.com/jka6502/stratum/blob/698a8abfb07436eda76813786de2d49f08d4081b/lib/require.js#L686-L706 | train | |
jka6502/stratum | lib/require.js | function() {
this.loaded = false;
this.stopped = true;
var current = Script.current(this.loader);
// Unbind and remove the relevant tag, if any.
this.destroy();
// Welcome traveller! You've discovered the ugly truth! This is
// the 'magic' of the require script, allowing execution t... | javascript | function() {
this.loaded = false;
this.stopped = true;
var current = Script.current(this.loader);
// Unbind and remove the relevant tag, if any.
this.destroy();
// Welcome traveller! You've discovered the ugly truth! This is
// the 'magic' of the require script, allowing execution t... | [
"function",
"(",
")",
"{",
"this",
".",
"loaded",
"=",
"false",
";",
"this",
".",
"stopped",
"=",
"true",
";",
"var",
"current",
"=",
"Script",
".",
"current",
"(",
"this",
".",
"loader",
")",
";",
"// Unbind and remove the relevant tag, if any.\r",
"this",
... | Stop this `Script` from executing, even if this function has been called from within the actual code referenced by `Script`. | [
"Stop",
"this",
"Script",
"from",
"executing",
"even",
"if",
"this",
"function",
"has",
"been",
"called",
"from",
"within",
"the",
"actual",
"code",
"referenced",
"by",
"Script",
"."
] | 698a8abfb07436eda76813786de2d49f08d4081b | https://github.com/jka6502/stratum/blob/698a8abfb07436eda76813786de2d49f08d4081b/lib/require.js#L711-L755 | train | |
jka6502/stratum | lib/require.js | function(url, base) {
if (!url || url.indexOf('://') !== -1) { return url; }
var anchor = document.createElement('a');
anchor.href = (base || location.href);
var protocol = anchor.protocol + '//',
host = anchor.host,
path = anchor.pathname,
parts = filter(path.split('/'), function(... | javascript | function(url, base) {
if (!url || url.indexOf('://') !== -1) { return url; }
var anchor = document.createElement('a');
anchor.href = (base || location.href);
var protocol = anchor.protocol + '//',
host = anchor.host,
path = anchor.pathname,
parts = filter(path.split('/'), function(... | [
"function",
"(",
"url",
",",
"base",
")",
"{",
"if",
"(",
"!",
"url",
"||",
"url",
".",
"indexOf",
"(",
"'://'",
")",
"!==",
"-",
"1",
")",
"{",
"return",
"url",
";",
"}",
"var",
"anchor",
"=",
"document",
".",
"createElement",
"(",
"'a'",
")",
... | Convert a relative url to an absolute, relative to the `base` url specified. | [
"Convert",
"a",
"relative",
"url",
"to",
"an",
"absolute",
"relative",
"to",
"the",
"base",
"url",
"specified",
"."
] | 698a8abfb07436eda76813786de2d49f08d4081b | https://github.com/jka6502/stratum/blob/698a8abfb07436eda76813786de2d49f08d4081b/lib/require.js#L931-L955 | train | |
jka6502/stratum | lib/require.js | function(url) {
var index = url ? url.lastIndexOf('/') : -1;
return index == -1 ? url : url.substring(0, index + 1);
} | javascript | function(url) {
var index = url ? url.lastIndexOf('/') : -1;
return index == -1 ? url : url.substring(0, index + 1);
} | [
"function",
"(",
"url",
")",
"{",
"var",
"index",
"=",
"url",
"?",
"url",
".",
"lastIndexOf",
"(",
"'/'",
")",
":",
"-",
"1",
";",
"return",
"index",
"==",
"-",
"1",
"?",
"url",
":",
"url",
".",
"substring",
"(",
"0",
",",
"index",
"+",
"1",
... | Remove the filename from a url, if possible, returning the url describing only the parent 'path'. | [
"Remove",
"the",
"filename",
"from",
"a",
"url",
"if",
"possible",
"returning",
"the",
"url",
"describing",
"only",
"the",
"parent",
"path",
"."
] | 698a8abfb07436eda76813786de2d49f08d4081b | https://github.com/jka6502/stratum/blob/698a8abfb07436eda76813786de2d49f08d4081b/lib/require.js#L959-L962 | train | |
jka6502/stratum | lib/require.js | extract | function extract(type) {
for(var index = 0; index < 3; index++) {
if (typeof args[index] === type) { return args[index]; }
}
} | javascript | function extract(type) {
for(var index = 0; index < 3; index++) {
if (typeof args[index] === type) { return args[index]; }
}
} | [
"function",
"extract",
"(",
"type",
")",
"{",
"for",
"(",
"var",
"index",
"=",
"0",
";",
"index",
"<",
"3",
";",
"index",
"++",
")",
"{",
"if",
"(",
"typeof",
"args",
"[",
"index",
"]",
"===",
"type",
")",
"{",
"return",
"args",
"[",
"index",
"... | Slightly looser than AMD, identify supplied parameters by type. | [
"Slightly",
"looser",
"than",
"AMD",
"identify",
"supplied",
"parameters",
"by",
"type",
"."
] | 698a8abfb07436eda76813786de2d49f08d4081b | https://github.com/jka6502/stratum/blob/698a8abfb07436eda76813786de2d49f08d4081b/lib/require.js#L1039-L1043 | train |
JohnnieFucker/dreamix-monitor | lib/systemMonitor.js | getBasicInfo | function getBasicInfo() {
const result = {};
for (const key in info) {
if (info.hasOwnProperty(key)) {
result[key] = info[key]();
}
}
return result;
} | javascript | function getBasicInfo() {
const result = {};
for (const key in info) {
if (info.hasOwnProperty(key)) {
result[key] = info[key]();
}
}
return result;
} | [
"function",
"getBasicInfo",
"(",
")",
"{",
"const",
"result",
"=",
"{",
"}",
";",
"for",
"(",
"const",
"key",
"in",
"info",
")",
"{",
"if",
"(",
"info",
".",
"hasOwnProperty",
"(",
"key",
")",
")",
"{",
"result",
"[",
"key",
"]",
"=",
"info",
"["... | get basic information of operating-system
@return {Object} result
@api private | [
"get",
"basic",
"information",
"of",
"operating",
"-",
"system"
] | c9e18d386f48a9bfca9dcb6211229cea3a0eed0e | https://github.com/JohnnieFucker/dreamix-monitor/blob/c9e18d386f48a9bfca9dcb6211229cea3a0eed0e/lib/systemMonitor.js#L50-L58 | train |
emeryrose/latest-torbrowser-version | index.js | checkPlatformSupported | function checkPlatformSupported(version, platform) {
const url = `${base}/${version}`;
if (platform === 'darwin') {
platform = 'osx64';
}
return new Promise((resolve, reject) => {
https.get(url, (res) => {
let body = '';
res.on('error', reject);
res.on('data', (d) => body += d.toStr... | javascript | function checkPlatformSupported(version, platform) {
const url = `${base}/${version}`;
if (platform === 'darwin') {
platform = 'osx64';
}
return new Promise((resolve, reject) => {
https.get(url, (res) => {
let body = '';
res.on('error', reject);
res.on('data', (d) => body += d.toStr... | [
"function",
"checkPlatformSupported",
"(",
"version",
",",
"platform",
")",
"{",
"const",
"url",
"=",
"`",
"${",
"base",
"}",
"${",
"version",
"}",
"`",
";",
"if",
"(",
"platform",
"===",
"'darwin'",
")",
"{",
"platform",
"=",
"'osx64'",
";",
"}",
"ret... | Scrapes the dist page by the given tor version and returns if the platform
is supported by the release
@param {string} version
@param {string} platform | [
"Scrapes",
"the",
"dist",
"page",
"by",
"the",
"given",
"tor",
"version",
"and",
"returns",
"if",
"the",
"platform",
"is",
"supported",
"by",
"the",
"release"
] | 2818e5f67528e44c41cfc414c2f470d0f2422b30 | https://github.com/emeryrose/latest-torbrowser-version/blob/2818e5f67528e44c41cfc414c2f470d0f2422b30/index.js#L77-L110 | train |
artsy/scribe-plugin-jump-link | index.js | function () {
return function (scribe) {
var jumpLinkCommand = new scribe.api.Command('createLink');
jumpLinkCommand.nodeName = 'A';
jumpLinkCommand.execute = function () {
var selection = new scribe.api.Selection(),
that = this;
var fullString = selection.selection.ba... | javascript | function () {
return function (scribe) {
var jumpLinkCommand = new scribe.api.Command('createLink');
jumpLinkCommand.nodeName = 'A';
jumpLinkCommand.execute = function () {
var selection = new scribe.api.Selection(),
that = this;
var fullString = selection.selection.ba... | [
"function",
"(",
")",
"{",
"return",
"function",
"(",
"scribe",
")",
"{",
"var",
"jumpLinkCommand",
"=",
"new",
"scribe",
".",
"api",
".",
"Command",
"(",
"'createLink'",
")",
";",
"jumpLinkCommand",
".",
"nodeName",
"=",
"'A'",
";",
"jumpLinkCommand",
"."... | The main plugin function | [
"The",
"main",
"plugin",
"function"
] | 4d6b6494fcca343666d91f89cf46114179622ffe | https://github.com/artsy/scribe-plugin-jump-link/blob/4d6b6494fcca343666d91f89cf46114179622ffe/index.js#L8-L40 | train | |
MakerCollider/node-red-contrib-smartnode-hook | html/scripts/highchart/modules/exporting.src.js | function (svg) {
return svg
.replace(/zIndex="[^"]+"/g, '')
.replace(/isShadow="[^"]+"/g, '')
.replace(/symbolName="[^"]+"/g, '')
.replace(/jQuery[0-9]+="[^"]+"/g, '')
.replace(/url\([^#]+#/g, 'url(#')
.replace(/<svg /, '<svg xmlns:xlink="http://www.w3.org/1999/xlink" ')
.replace(/ (NS[0-9]+\:)?h... | javascript | function (svg) {
return svg
.replace(/zIndex="[^"]+"/g, '')
.replace(/isShadow="[^"]+"/g, '')
.replace(/symbolName="[^"]+"/g, '')
.replace(/jQuery[0-9]+="[^"]+"/g, '')
.replace(/url\([^#]+#/g, 'url(#')
.replace(/<svg /, '<svg xmlns:xlink="http://www.w3.org/1999/xlink" ')
.replace(/ (NS[0-9]+\:)?h... | [
"function",
"(",
"svg",
")",
"{",
"return",
"svg",
".",
"replace",
"(",
"/",
"zIndex=\"[^\"]+\"",
"/",
"g",
",",
"''",
")",
".",
"replace",
"(",
"/",
"isShadow=\"[^\"]+\"",
"/",
"g",
",",
"''",
")",
".",
"replace",
"(",
"/",
"symbolName=\"[^\"]+\"",
"/... | A collection of regex fixes on the produces SVG to account for expando properties,
browser bugs, VML problems and other. Returns a cleaned SVG. | [
"A",
"collection",
"of",
"regex",
"fixes",
"on",
"the",
"produces",
"SVG",
"to",
"account",
"for",
"expando",
"properties",
"browser",
"bugs",
"VML",
"problems",
"and",
"other",
".",
"Returns",
"a",
"cleaned",
"SVG",
"."
] | 245c267e832968bad880ca009929043e82c7bc25 | https://github.com/MakerCollider/node-red-contrib-smartnode-hook/blob/245c267e832968bad880ca009929043e82c7bc25/html/scripts/highchart/modules/exporting.src.js#L198-L233 | train | |
MakerCollider/node-red-contrib-smartnode-hook | html/scripts/highchart/modules/exporting.src.js | function (options, chartOptions) {
var svg = this.getSVGForExport(options, chartOptions);
// merge the options
options = merge(this.options.exporting, options);
// do the post
Highcharts.post(options.url, {
filename: options.filename || 'chart',
type: options.type,
width: options.width || 0, // ... | javascript | function (options, chartOptions) {
var svg = this.getSVGForExport(options, chartOptions);
// merge the options
options = merge(this.options.exporting, options);
// do the post
Highcharts.post(options.url, {
filename: options.filename || 'chart',
type: options.type,
width: options.width || 0, // ... | [
"function",
"(",
"options",
",",
"chartOptions",
")",
"{",
"var",
"svg",
"=",
"this",
".",
"getSVGForExport",
"(",
"options",
",",
"chartOptions",
")",
";",
"// merge the options",
"options",
"=",
"merge",
"(",
"this",
".",
"options",
".",
"exporting",
",",
... | Submit the SVG representation of the chart to the server
@param {Object} options Exporting options. Possible members are url, type, width and formAttributes.
@param {Object} chartOptions Additional chart options for the SVG representation of the chart | [
"Submit",
"the",
"SVG",
"representation",
"of",
"the",
"chart",
"to",
"the",
"server"
] | 245c267e832968bad880ca009929043e82c7bc25 | https://github.com/MakerCollider/node-red-contrib-smartnode-hook/blob/245c267e832968bad880ca009929043e82c7bc25/html/scripts/highchart/modules/exporting.src.js#L372-L388 | train | |
MakerCollider/node-red-contrib-smartnode-hook | html/scripts/highchart/modules/exporting.src.js | function () {
var chart = this,
container = chart.container,
origDisplay = [],
origParent = container.parentNode,
body = doc.body,
childNodes = body.childNodes;
if (chart.isPrinting) { // block the button while in printing mode
return;
}
chart.isPrinting = true;
fireEvent(chart, 'beforeP... | javascript | function () {
var chart = this,
container = chart.container,
origDisplay = [],
origParent = container.parentNode,
body = doc.body,
childNodes = body.childNodes;
if (chart.isPrinting) { // block the button while in printing mode
return;
}
chart.isPrinting = true;
fireEvent(chart, 'beforeP... | [
"function",
"(",
")",
"{",
"var",
"chart",
"=",
"this",
",",
"container",
"=",
"chart",
".",
"container",
",",
"origDisplay",
"=",
"[",
"]",
",",
"origParent",
"=",
"container",
".",
"parentNode",
",",
"body",
"=",
"doc",
".",
"body",
",",
"childNodes"... | Print the chart | [
"Print",
"the",
"chart"
] | 245c267e832968bad880ca009929043e82c7bc25 | https://github.com/MakerCollider/node-red-contrib-smartnode-hook/blob/245c267e832968bad880ca009929043e82c7bc25/html/scripts/highchart/modules/exporting.src.js#L393-L444 | train | |
MakerCollider/node-red-contrib-smartnode-hook | html/scripts/highchart/modules/exporting.src.js | function (options) {
var chart = this,
renderer = chart.renderer,
btnOptions = merge(chart.options.navigation.buttonOptions, options),
onclick = btnOptions.onclick,
menuItems = btnOptions.menuItems,
symbol,
button,
symbolAttr = {
stroke: btnOptions.symbolStroke,
fill: btnOptions.symbolFil... | javascript | function (options) {
var chart = this,
renderer = chart.renderer,
btnOptions = merge(chart.options.navigation.buttonOptions, options),
onclick = btnOptions.onclick,
menuItems = btnOptions.menuItems,
symbol,
button,
symbolAttr = {
stroke: btnOptions.symbolStroke,
fill: btnOptions.symbolFil... | [
"function",
"(",
"options",
")",
"{",
"var",
"chart",
"=",
"this",
",",
"renderer",
"=",
"chart",
".",
"renderer",
",",
"btnOptions",
"=",
"merge",
"(",
"chart",
".",
"options",
".",
"navigation",
".",
"buttonOptions",
",",
"options",
")",
",",
"onclick"... | Add the export button to the chart | [
"Add",
"the",
"export",
"button",
"to",
"the",
"chart"
] | 245c267e832968bad880ca009929043e82c7bc25 | https://github.com/MakerCollider/node-red-contrib-smartnode-hook/blob/245c267e832968bad880ca009929043e82c7bc25/html/scripts/highchart/modules/exporting.src.js#L578-L677 | train |
Subsets and Splits
SQL Console for semeru/code-text-javascript
Retrieves 20,000 non-null code samples labeled as JavaScript, providing a basic overview of the dataset.