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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
jonschlinkert/normalize-keywords | words.js | common | function common(words) {
return _.map(words, function(o) {
return o.word.toLowerCase();
}).sort();
} | javascript | function common(words) {
return _.map(words, function(o) {
return o.word.toLowerCase();
}).sort();
} | [
"function",
"common",
"(",
"words",
")",
"{",
"return",
"_",
".",
"map",
"(",
"words",
",",
"function",
"(",
"o",
")",
"{",
"return",
"o",
".",
"word",
".",
"toLowerCase",
"(",
")",
";",
"}",
")",
".",
"sort",
"(",
")",
";",
"}"
] | Get an array of the 100 most common english words | [
"Get",
"an",
"array",
"of",
"the",
"100",
"most",
"common",
"english",
"words"
] | f4d1a92fab85c49636929d3a23652b1795b9ac22 | https://github.com/jonschlinkert/normalize-keywords/blob/f4d1a92fab85c49636929d3a23652b1795b9ac22/words.js#L10-L14 | train |
cli-kit/cli-mid-unparsed | index.js | filter | function filter(unparsed) {
var cmds = this.commands()
, alias = this.finder.getCommandByName;
var i, l = unparsed.length;
for(i = 0;i < l;i++) {
//console.log('unparsed filter %s', unparsed[i]);
if(alias(unparsed[i], cmds)) {
unparsed.splice(i, 1);
i--;
l--;
}
}
//console.lo... | javascript | function filter(unparsed) {
var cmds = this.commands()
, alias = this.finder.getCommandByName;
var i, l = unparsed.length;
for(i = 0;i < l;i++) {
//console.log('unparsed filter %s', unparsed[i]);
if(alias(unparsed[i], cmds)) {
unparsed.splice(i, 1);
i--;
l--;
}
}
//console.lo... | [
"function",
"filter",
"(",
"unparsed",
")",
"{",
"var",
"cmds",
"=",
"this",
".",
"commands",
"(",
")",
",",
"alias",
"=",
"this",
".",
"finder",
".",
"getCommandByName",
";",
"var",
"i",
",",
"l",
"=",
"unparsed",
".",
"length",
";",
"for",
"(",
"... | Filters commands from the unparsed arguments array.
Note that currently this only filters top-level commands. | [
"Filters",
"commands",
"from",
"the",
"unparsed",
"arguments",
"array",
"."
] | 7b5432ab5718ff388f690047448018b6459ee4cb | https://github.com/cli-kit/cli-mid-unparsed/blob/7b5432ab5718ff388f690047448018b6459ee4cb/index.js#L8-L22 | train |
leoxy520/Sling2JCR | index.js | startUp | function startUp(dir) {
var config = {
jcr_root: dir,
servers: [{
host: commander.host || "http://localhost:4502",
username: commander.username || "admin",
password: commander.password || "admin"
}]
};
//create a new instance
va... | javascript | function startUp(dir) {
var config = {
jcr_root: dir,
servers: [{
host: commander.host || "http://localhost:4502",
username: commander.username || "admin",
password: commander.password || "admin"
}]
};
//create a new instance
va... | [
"function",
"startUp",
"(",
"dir",
")",
"{",
"var",
"config",
"=",
"{",
"jcr_root",
":",
"dir",
",",
"servers",
":",
"[",
"{",
"host",
":",
"commander",
".",
"host",
"||",
"\"http://localhost:4502\"",
",",
"username",
":",
"commander",
".",
"username",
"... | end with parse to parse through the input | [
"end",
"with",
"parse",
"to",
"parse",
"through",
"the",
"input"
] | f7bc671c0de6d2d6b4e039da1a67b7456186179b | https://github.com/leoxy520/Sling2JCR/blob/f7bc671c0de6d2d6b4e039da1a67b7456186179b/index.js#L17-L43 | train |
flowthings/node-client | flowthings/websocketFactory.js | crudable | function crudable(flowthingsWs) {
return {
create: function(obj, params, responseHandler, cb) {
if (typeof params === 'function') {
cb = responseHandler; responseHandler = params; params = {};
} else if (!params) {
params = {};
}
baseWs(flowthingsWs, this.objectType, 'crea... | javascript | function crudable(flowthingsWs) {
return {
create: function(obj, params, responseHandler, cb) {
if (typeof params === 'function') {
cb = responseHandler; responseHandler = params; params = {};
} else if (!params) {
params = {};
}
baseWs(flowthingsWs, this.objectType, 'crea... | [
"function",
"crudable",
"(",
"flowthingsWs",
")",
"{",
"return",
"{",
"create",
":",
"function",
"(",
"obj",
",",
"params",
",",
"responseHandler",
",",
"cb",
")",
"{",
"if",
"(",
"typeof",
"params",
"===",
"'function'",
")",
"{",
"cb",
"=",
"responseHan... | These are in the private API. We don't really want people to access them directly. | [
"These",
"are",
"in",
"the",
"private",
"API",
".",
"We",
"don",
"t",
"really",
"want",
"people",
"to",
"access",
"them",
"directly",
"."
] | 0a9e9660e28bface0da4e919fd1e2617deabbf77 | https://github.com/flowthings/node-client/blob/0a9e9660e28bface0da4e919fd1e2617deabbf77/flowthings/websocketFactory.js#L247-L299 | train |
flowthings/node-client | flowthings/websocketFactory.js | dropCreate | function dropCreate(flowthingsWs) {
return {
create: function(drop, params, responseHandler, cb) {
if (typeof params === 'function') {
cb = responseHandler; responseHandler = params; params = {};
} else if (!params) {
params = {};
}
if (this.flowId.charAt(0) === '/') {
... | javascript | function dropCreate(flowthingsWs) {
return {
create: function(drop, params, responseHandler, cb) {
if (typeof params === 'function') {
cb = responseHandler; responseHandler = params; params = {};
} else if (!params) {
params = {};
}
if (this.flowId.charAt(0) === '/') {
... | [
"function",
"dropCreate",
"(",
"flowthingsWs",
")",
"{",
"return",
"{",
"create",
":",
"function",
"(",
"drop",
",",
"params",
",",
"responseHandler",
",",
"cb",
")",
"{",
"if",
"(",
"typeof",
"params",
"===",
"'function'",
")",
"{",
"cb",
"=",
"response... | can I roll this into the normal create? | [
"can",
"I",
"roll",
"this",
"into",
"the",
"normal",
"create?"
] | 0a9e9660e28bface0da4e919fd1e2617deabbf77 | https://github.com/flowthings/node-client/blob/0a9e9660e28bface0da4e919fd1e2617deabbf77/flowthings/websocketFactory.js#L318-L336 | train |
biggora/trinte-creator | scripts/controllers/AppsController.js | function(req, res, next) {
/**
* If you want to redirect to another controller, uncomment
*/
var controllers = [];
fs.readdir(__dirname + '/', function(err, files) {
if (err) {
throw err;
}
files.forEach(function(file) {
... | javascript | function(req, res, next) {
/**
* If you want to redirect to another controller, uncomment
*/
var controllers = [];
fs.readdir(__dirname + '/', function(err, files) {
if (err) {
throw err;
}
files.forEach(function(file) {
... | [
"function",
"(",
"req",
",",
"res",
",",
"next",
")",
"{",
"/**\n * If you want to redirect to another controller, uncomment\n */",
"var",
"controllers",
"=",
"[",
"]",
";",
"fs",
".",
"readdir",
"(",
"__dirname",
"+",
"'/'",
",",
"function",
"(",
... | Default Application index - shows a list of the controllers.
Redirect here if you prefer another controller to be your index.
@param req
@param res
@param next | [
"Default",
"Application",
"index",
"-",
"shows",
"a",
"list",
"of",
"the",
"controllers",
".",
"Redirect",
"here",
"if",
"you",
"prefer",
"another",
"controller",
"to",
"be",
"your",
"index",
"."
] | fdd723405418967ca8a690867940863fd77e636b | https://github.com/biggora/trinte-creator/blob/fdd723405418967ca8a690867940863fd77e636b/scripts/controllers/AppsController.js#L20-L46 | train | |
Psychopoulet/node-promfs | lib/extends/_mkdirp.js | _mkdirp | function _mkdirp (directory, mode, callback) {
if ("undefined" === typeof directory) {
throw new ReferenceError("missing \"directory\" argument");
}
else if ("string" !== typeof directory) {
throw new TypeError("\"directory\" argument is not a string");
}
else if ("" === directory.trim()) {
... | javascript | function _mkdirp (directory, mode, callback) {
if ("undefined" === typeof directory) {
throw new ReferenceError("missing \"directory\" argument");
}
else if ("string" !== typeof directory) {
throw new TypeError("\"directory\" argument is not a string");
}
else if ("" === directory.trim()) {
... | [
"function",
"_mkdirp",
"(",
"directory",
",",
"mode",
",",
"callback",
")",
"{",
"if",
"(",
"\"undefined\"",
"===",
"typeof",
"directory",
")",
"{",
"throw",
"new",
"ReferenceError",
"(",
"\"missing \\\"directory\\\" argument\"",
")",
";",
"}",
"else",
"if",
"... | methods
Async mkdirp
@param {string} directory : directory path
@param {number} mode : creation mode
@param {function|null} callback : operation's result
@returns {void} | [
"methods",
"Async",
"mkdirp"
] | 016e272fc58c6ef6eae5ea551a0e8873f0ac20cc | https://github.com/Psychopoulet/node-promfs/blob/016e272fc58c6ef6eae5ea551a0e8873f0ac20cc/lib/extends/_mkdirp.js#L27-L93 | train |
redisjs/jsr-server | lib/command/server/debug.js | diff | function diff(req, res) {
// defined and loaded commands
var cmds = this.execs
// map of all standard top-level commands
, map = Constants.MAP
// output multi bulk reply list
, list = []
, k;
for(k in map) {
if(!cmds[k]) list.push(k);
}
res.send(null, list);
} | javascript | function diff(req, res) {
// defined and loaded commands
var cmds = this.execs
// map of all standard top-level commands
, map = Constants.MAP
// output multi bulk reply list
, list = []
, k;
for(k in map) {
if(!cmds[k]) list.push(k);
}
res.send(null, list);
} | [
"function",
"diff",
"(",
"req",
",",
"res",
")",
"{",
"// defined and loaded commands",
"var",
"cmds",
"=",
"this",
".",
"execs",
"// map of all standard top-level commands",
",",
"map",
"=",
"Constants",
".",
"MAP",
"// output multi bulk reply list",
",",
"list",
"... | Respond to the DIFF subcommand.
Non-standard debug subcommand that returns a diff between the list
of standard redis commands and the commands loaded.
Primarily useful to determine which commands have not yet been
implemented, but in a scenario where commands have been renamed, deleted
or custom commands loaded this ... | [
"Respond",
"to",
"the",
"DIFF",
"subcommand",
"."
] | 49413052d3039524fbdd2ade0ef9bae26cb4d647 | https://github.com/redisjs/jsr-server/blob/49413052d3039524fbdd2ade0ef9bae26cb4d647/lib/command/server/debug.js#L33-L47 | train |
redisjs/jsr-server | lib/command/server/debug.js | reload | function reload(req, res) {
var log = this.log;
if(Persistence.loading) {
return res.send(new Error('database load in progress'));
}
Persistence.load(this.state.store, this.state.conf,
function onLoad(err, time, diff, version) {
if(err) return log.warning('db reload error: %s', err.message);
... | javascript | function reload(req, res) {
var log = this.log;
if(Persistence.loading) {
return res.send(new Error('database load in progress'));
}
Persistence.load(this.state.store, this.state.conf,
function onLoad(err, time, diff, version) {
if(err) return log.warning('db reload error: %s', err.message);
... | [
"function",
"reload",
"(",
"req",
",",
"res",
")",
"{",
"var",
"log",
"=",
"this",
".",
"log",
";",
"if",
"(",
"Persistence",
".",
"loading",
")",
"{",
"return",
"res",
".",
"send",
"(",
"new",
"Error",
"(",
"'database load in progress'",
")",
")",
"... | Respond to the RELOAD subcommand. | [
"Respond",
"to",
"the",
"RELOAD",
"subcommand",
"."
] | 49413052d3039524fbdd2ade0ef9bae26cb4d647 | https://github.com/redisjs/jsr-server/blob/49413052d3039524fbdd2ade0ef9bae26cb4d647/lib/command/server/debug.js#L52-L65 | train |
Nazariglez/perenquen | lib/pixi/src/core/math/shapes/Ellipse.js | Ellipse | function Ellipse(x, y, width, height)
{
/**
* @member {number}
* @default 0
*/
this.x = x || 0;
/**
* @member {number}
* @default 0
*/
this.y = y || 0;
/**
* @member {number}
* @default 0
*/
this.width = width || 0;
/**
* @member {number}
... | javascript | function Ellipse(x, y, width, height)
{
/**
* @member {number}
* @default 0
*/
this.x = x || 0;
/**
* @member {number}
* @default 0
*/
this.y = y || 0;
/**
* @member {number}
* @default 0
*/
this.width = width || 0;
/**
* @member {number}
... | [
"function",
"Ellipse",
"(",
"x",
",",
"y",
",",
"width",
",",
"height",
")",
"{",
"/**\n * @member {number}\n * @default 0\n */",
"this",
".",
"x",
"=",
"x",
"||",
"0",
";",
"/**\n * @member {number}\n * @default 0\n */",
"this",
".",
"y",
"=... | The Ellipse object can be used to specify a hit area for displayObjects
@class
@memberof PIXI
@param x {number} The X coordinate of the center of the ellipse
@param y {number} The Y coordinate of the center of the ellipse
@param width {number} The half width of this ellipse
@param height {number} The half height of th... | [
"The",
"Ellipse",
"object",
"can",
"be",
"used",
"to",
"specify",
"a",
"hit",
"area",
"for",
"displayObjects"
] | e023964d05afeefebdcac4e2044819fdfa3899ae | https://github.com/Nazariglez/perenquen/blob/e023964d05afeefebdcac4e2044819fdfa3899ae/lib/pixi/src/core/math/shapes/Ellipse.js#L14-L46 | train |
haraldrudell/apprunner | lib/apperror.js | apiError | function apiError(err) {
var f = testProbe ? testProbe : anomaly.anomaly
f.apply(this, Array.prototype.slice.call(arguments))
} | javascript | function apiError(err) {
var f = testProbe ? testProbe : anomaly.anomaly
f.apply(this, Array.prototype.slice.call(arguments))
} | [
"function",
"apiError",
"(",
"err",
")",
"{",
"var",
"f",
"=",
"testProbe",
"?",
"testProbe",
":",
"anomaly",
".",
"anomaly",
"f",
".",
"apply",
"(",
"this",
",",
"Array",
".",
"prototype",
".",
"slice",
".",
"call",
"(",
"arguments",
")",
")",
"}"
] | report error from unknown api | [
"report",
"error",
"from",
"unknown",
"api"
] | 8d7dead166c919d160b429e00c49a62027994c33 | https://github.com/haraldrudell/apprunner/blob/8d7dead166c919d160b429e00c49a62027994c33/lib/apperror.js#L16-L19 | train |
cortexjs-legacy/cortex-scaffold-generator | index.js | function (done) {
var root = node_path.join(__dirname, 'templates', template);
fs.exists(root, function(exists){
if(exists){
template_root = root;
}else{
template_root = node_path.join(DIR_CUSTOM_TEMPLATES, template)
}
done(null);
});
} | javascript | function (done) {
var root = node_path.join(__dirname, 'templates', template);
fs.exists(root, function(exists){
if(exists){
template_root = root;
}else{
template_root = node_path.join(DIR_CUSTOM_TEMPLATES, template)
}
done(null);
});
} | [
"function",
"(",
"done",
")",
"{",
"var",
"root",
"=",
"node_path",
".",
"join",
"(",
"__dirname",
",",
"'templates'",
",",
"template",
")",
";",
"fs",
".",
"exists",
"(",
"root",
",",
"function",
"(",
"exists",
")",
"{",
"if",
"(",
"exists",
")",
... | set template root | [
"set",
"template",
"root"
] | da5e4b18832e478176babb9c065d3e3178b88331 | https://github.com/cortexjs-legacy/cortex-scaffold-generator/blob/da5e4b18832e478176babb9c065d3e3178b88331/index.js#L75-L86 | train | |
cortexjs-legacy/cortex-scaffold-generator | index.js | function (done) {
var p = clone(pkg);
delete p.devDependencies;
var content = JSON.stringify(p, null, 2);
write_if_not_exists('package.json', content, done);
} | javascript | function (done) {
var p = clone(pkg);
delete p.devDependencies;
var content = JSON.stringify(p, null, 2);
write_if_not_exists('package.json', content, done);
} | [
"function",
"(",
"done",
")",
"{",
"var",
"p",
"=",
"clone",
"(",
"pkg",
")",
";",
"delete",
"p",
".",
"devDependencies",
";",
"var",
"content",
"=",
"JSON",
".",
"stringify",
"(",
"p",
",",
"null",
",",
"2",
")",
";",
"write_if_not_exists",
"(",
"... | write package.json | [
"write",
"package",
".",
"json"
] | da5e4b18832e478176babb9c065d3e3178b88331 | https://github.com/cortexjs-legacy/cortex-scaffold-generator/blob/da5e4b18832e478176babb9c065d3e3178b88331/index.js#L116-L121 | train | |
timrwood/grunt-haychtml | lib/haychtml.js | extensionMatches | function extensionMatches (filename) {
var extname = path.extname(filename);
if (extname) {
return extname === extension;
}
return true;
} | javascript | function extensionMatches (filename) {
var extname = path.extname(filename);
if (extname) {
return extname === extension;
}
return true;
} | [
"function",
"extensionMatches",
"(",
"filename",
")",
"{",
"var",
"extname",
"=",
"path",
".",
"extname",
"(",
"filename",
")",
";",
"if",
"(",
"extname",
")",
"{",
"return",
"extname",
"===",
"extension",
";",
"}",
"return",
"true",
";",
"}"
] | We only want files that end with the correct extension | [
"We",
"only",
"want",
"files",
"that",
"end",
"with",
"the",
"correct",
"extension"
] | 70bfa1ba754d91ae481a8b3ab0a2a566b7d73b1c | https://github.com/timrwood/grunt-haychtml/blob/70bfa1ba754d91ae481a8b3ab0a2a566b7d73b1c/lib/haychtml.js#L106-L112 | train |
timrwood/grunt-haychtml | lib/haychtml.js | handleDirectoryOrFile | function handleDirectoryOrFile (filename) {
var absolutePath = path.join(dir, recursePath, filename),
relativePath = path.join(recursePath, filename);
if (fs.statSync(absolutePath).isDirectory()) {
find(dir, extension, relativePath).forEach(addFileToOutput);
} else {
addFileToOutput(new File(relativePat... | javascript | function handleDirectoryOrFile (filename) {
var absolutePath = path.join(dir, recursePath, filename),
relativePath = path.join(recursePath, filename);
if (fs.statSync(absolutePath).isDirectory()) {
find(dir, extension, relativePath).forEach(addFileToOutput);
} else {
addFileToOutput(new File(relativePat... | [
"function",
"handleDirectoryOrFile",
"(",
"filename",
")",
"{",
"var",
"absolutePath",
"=",
"path",
".",
"join",
"(",
"dir",
",",
"recursePath",
",",
"filename",
")",
",",
"relativePath",
"=",
"path",
".",
"join",
"(",
"recursePath",
",",
"filename",
")",
... | If the path is a file, create a File object and add it to the output array. | [
"If",
"the",
"path",
"is",
"a",
"file",
"create",
"a",
"File",
"object",
"and",
"add",
"it",
"to",
"the",
"output",
"array",
"."
] | 70bfa1ba754d91ae481a8b3ab0a2a566b7d73b1c | https://github.com/timrwood/grunt-haychtml/blob/70bfa1ba754d91ae481a8b3ab0a2a566b7d73b1c/lib/haychtml.js#L124-L133 | train |
tjmehta/mongooseware | lib/method-lists/list-class-methods.js | listClassMethods | function listClassMethods (Model) {
var classMethods = Object.keys(Model.schema.statics);
for (var method in Model) {
if (!isPrivateMethod(method) && isFunction(Model[method])) {
classMethods.push(method);
}
}
return classMethods;
} | javascript | function listClassMethods (Model) {
var classMethods = Object.keys(Model.schema.statics);
for (var method in Model) {
if (!isPrivateMethod(method) && isFunction(Model[method])) {
classMethods.push(method);
}
}
return classMethods;
} | [
"function",
"listClassMethods",
"(",
"Model",
")",
"{",
"var",
"classMethods",
"=",
"Object",
".",
"keys",
"(",
"Model",
".",
"schema",
".",
"statics",
")",
";",
"for",
"(",
"var",
"method",
"in",
"Model",
")",
"{",
"if",
"(",
"!",
"isPrivateMethod",
"... | Returns list of non-private class methods
@param {Object} Model
@return {Array} | [
"Returns",
"list",
"of",
"non",
"-",
"private",
"class",
"methods"
] | c62ce0bac82880826b3528231e08f5e5b3efdb83 | https://github.com/tjmehta/mongooseware/blob/c62ce0bac82880826b3528231e08f5e5b3efdb83/lib/method-lists/list-class-methods.js#L18-L26 | train |
DeadAlready/node-foldermap | lib/utils.js | clone | function clone(obj) {
if (typeof obj !== 'object') {
return obj;
}
var ret;
if (util.isArray(obj)) {
ret = [];
obj.forEach(function (val) {
ret.push(clone(val));
});
return ret;
}
ret = {};
Object.keys(obj).forEach(function (key) {
... | javascript | function clone(obj) {
if (typeof obj !== 'object') {
return obj;
}
var ret;
if (util.isArray(obj)) {
ret = [];
obj.forEach(function (val) {
ret.push(clone(val));
});
return ret;
}
ret = {};
Object.keys(obj).forEach(function (key) {
... | [
"function",
"clone",
"(",
"obj",
")",
"{",
"if",
"(",
"typeof",
"obj",
"!==",
"'object'",
")",
"{",
"return",
"obj",
";",
"}",
"var",
"ret",
";",
"if",
"(",
"util",
".",
"isArray",
"(",
"obj",
")",
")",
"{",
"ret",
"=",
"[",
"]",
";",
"obj",
... | Function for creating a clone of an object
@param o {Object} object to clone
@return {Object} | [
"Function",
"for",
"creating",
"a",
"clone",
"of",
"an",
"object"
] | be6048cb3b3e9fa3b6f36542cb8835d48c7bde1d | https://github.com/DeadAlready/node-foldermap/blob/be6048cb3b3e9fa3b6f36542cb8835d48c7bde1d/lib/utils.js#L14-L31 | train |
DeadAlready/node-foldermap | lib/utils.js | extend | function extend(a, b, noClone) { // A extends B
a = a || {};
if (typeof a !== 'object') {
return noClone ? b : clone(b);
}
if (typeof b !== 'object') {
return b;
}
if (!noClone) {
a = clone(a);
}
Object.keys(b).forEach(function (key) {
if (!a.hasOwnPro... | javascript | function extend(a, b, noClone) { // A extends B
a = a || {};
if (typeof a !== 'object') {
return noClone ? b : clone(b);
}
if (typeof b !== 'object') {
return b;
}
if (!noClone) {
a = clone(a);
}
Object.keys(b).forEach(function (key) {
if (!a.hasOwnPro... | [
"function",
"extend",
"(",
"a",
",",
"b",
",",
"noClone",
")",
"{",
"// A extends B",
"a",
"=",
"a",
"||",
"{",
"}",
";",
"if",
"(",
"typeof",
"a",
"!==",
"'object'",
")",
"{",
"return",
"noClone",
"?",
"b",
":",
"clone",
"(",
"b",
")",
";",
"}... | A extends B
util.inherits works only with objects derived from Object
@return {Object} Extended object | [
"A",
"extends",
"B"
] | be6048cb3b3e9fa3b6f36542cb8835d48c7bde1d | https://github.com/DeadAlready/node-foldermap/blob/be6048cb3b3e9fa3b6f36542cb8835d48c7bde1d/lib/utils.js#L40-L65 | train |
Zingle/tlsfs | index.js | readCertsSync | function readCertsSync(paths) {
var opts = {};
if (!(paths instanceof Array))
throw new TypeError("readCertsSync expects Array argument");
switch (paths.length) {
case 1:
opts.pfx = fs.readFileSync(paths[0]);
break;
case 2:
opts.cert = fs.readFil... | javascript | function readCertsSync(paths) {
var opts = {};
if (!(paths instanceof Array))
throw new TypeError("readCertsSync expects Array argument");
switch (paths.length) {
case 1:
opts.pfx = fs.readFileSync(paths[0]);
break;
case 2:
opts.cert = fs.readFil... | [
"function",
"readCertsSync",
"(",
"paths",
")",
"{",
"var",
"opts",
"=",
"{",
"}",
";",
"if",
"(",
"!",
"(",
"paths",
"instanceof",
"Array",
")",
")",
"throw",
"new",
"TypeError",
"(",
"\"readCertsSync expects Array argument\"",
")",
";",
"switch",
"(",
"p... | Read TLS certs from filesystem synchronously. Return TLS options object
with 'pfx' or 'cert', 'key', and 'ca' options, depending on the number of
paths provided.
@param {string[]} paths
@returns {object} | [
"Read",
"TLS",
"certs",
"from",
"filesystem",
"synchronously",
".",
"Return",
"TLS",
"options",
"object",
"with",
"pfx",
"or",
"cert",
"key",
"and",
"ca",
"options",
"depending",
"on",
"the",
"number",
"of",
"paths",
"provided",
"."
] | ea541c70728263867b9277369943f039c9b82bbd | https://github.com/Zingle/tlsfs/blob/ea541c70728263867b9277369943f039c9b82bbd/index.js#L11-L35 | train |
Zingle/tlsfs | index.js | readCerts | function readCerts(paths, done) {
if (!(paths instanceof Array))
throw new TypeError("readCertsSync expects Array argument");
async.map(paths, fs.readFile, function(err, files) {
var opts = {};
if (err) done(err);
else switch (files.length) {
case 1:
... | javascript | function readCerts(paths, done) {
if (!(paths instanceof Array))
throw new TypeError("readCertsSync expects Array argument");
async.map(paths, fs.readFile, function(err, files) {
var opts = {};
if (err) done(err);
else switch (files.length) {
case 1:
... | [
"function",
"readCerts",
"(",
"paths",
",",
"done",
")",
"{",
"if",
"(",
"!",
"(",
"paths",
"instanceof",
"Array",
")",
")",
"throw",
"new",
"TypeError",
"(",
"\"readCertsSync expects Array argument\"",
")",
";",
"async",
".",
"map",
"(",
"paths",
",",
"fs... | Read TLS certs from filesystem. Pass TLS options object to callback with
'pfx' or 'cert', 'key', and 'ca' options, depending on the number of paths
provided.
@param {string[]} paths
@param {function} done | [
"Read",
"TLS",
"certs",
"from",
"filesystem",
".",
"Pass",
"TLS",
"options",
"object",
"to",
"callback",
"with",
"pfx",
"or",
"cert",
"key",
"and",
"ca",
"options",
"depending",
"on",
"the",
"number",
"of",
"paths",
"provided",
"."
] | ea541c70728263867b9277369943f039c9b82bbd | https://github.com/Zingle/tlsfs/blob/ea541c70728263867b9277369943f039c9b82bbd/index.js#L44-L68 | train |
nerdvibe/awesome_starter | error_handling.js | expressResponseError_silent | function expressResponseError_silent(response, message) {
let errorMessage = "there was an error in the request";
if(message)
errorMessage = message
response.json({ success: false, error: errorMessage });
} | javascript | function expressResponseError_silent(response, message) {
let errorMessage = "there was an error in the request";
if(message)
errorMessage = message
response.json({ success: false, error: errorMessage });
} | [
"function",
"expressResponseError_silent",
"(",
"response",
",",
"message",
")",
"{",
"let",
"errorMessage",
"=",
"\"there was an error in the request\"",
";",
"if",
"(",
"message",
")",
"errorMessage",
"=",
"message",
"response",
".",
"json",
"(",
"{",
"success",
... | General internal error for express | [
"General",
"internal",
"error",
"for",
"express"
] | 9440d54c43dd8459f6cb5865cc65d5f0ce352523 | https://github.com/nerdvibe/awesome_starter/blob/9440d54c43dd8459f6cb5865cc65d5f0ce352523/error_handling.js#L11-L16 | train |
nerdvibe/awesome_starter | error_handling.js | expressResponseError | function expressResponseError(response, error, message) {
let errorMessage = "there was an error in the request";
if(message)
errorMessage = message
response.json({ success: false, error: errorMessage });
console.error(error);
} | javascript | function expressResponseError(response, error, message) {
let errorMessage = "there was an error in the request";
if(message)
errorMessage = message
response.json({ success: false, error: errorMessage });
console.error(error);
} | [
"function",
"expressResponseError",
"(",
"response",
",",
"error",
",",
"message",
")",
"{",
"let",
"errorMessage",
"=",
"\"there was an error in the request\"",
";",
"if",
"(",
"message",
")",
"errorMessage",
"=",
"message",
"response",
".",
"json",
"(",
"{",
"... | General internal error for express with console.error | [
"General",
"internal",
"error",
"for",
"express",
"with",
"console",
".",
"error"
] | 9440d54c43dd8459f6cb5865cc65d5f0ce352523 | https://github.com/nerdvibe/awesome_starter/blob/9440d54c43dd8459f6cb5865cc65d5f0ce352523/error_handling.js#L21-L27 | train |
jonschlinkert/normalize-keywords | index.js | properize | function properize(word, options) {
options = _.extend({inflect: false}, options);
if (!/\./.test(word)) {
word = changeCase(word);
if (options.inflect === false) {
return word;
}
return inflection.singularize(word);
}
return word;
} | javascript | function properize(word, options) {
options = _.extend({inflect: false}, options);
if (!/\./.test(word)) {
word = changeCase(word);
if (options.inflect === false) {
return word;
}
return inflection.singularize(word);
}
return word;
} | [
"function",
"properize",
"(",
"word",
",",
"options",
")",
"{",
"options",
"=",
"_",
".",
"extend",
"(",
"{",
"inflect",
":",
"false",
"}",
",",
"options",
")",
";",
"if",
"(",
"!",
"/",
"\\.",
"/",
".",
"test",
"(",
"word",
")",
")",
"{",
"wor... | Make the word lowercase, dashed, and singular.
@param {String} `word`
@return {String} | [
"Make",
"the",
"word",
"lowercase",
"dashed",
"and",
"singular",
"."
] | f4d1a92fab85c49636929d3a23652b1795b9ac22 | https://github.com/jonschlinkert/normalize-keywords/blob/f4d1a92fab85c49636929d3a23652b1795b9ac22/index.js#L60-L70 | train |
jonschlinkert/normalize-keywords | index.js | chop | function chop(keywords) {
return keywords.slice(0)
.reduce(function(acc, ele) {
acc = acc.concat(ele.split('-'));
return acc;
}, []);
} | javascript | function chop(keywords) {
return keywords.slice(0)
.reduce(function(acc, ele) {
acc = acc.concat(ele.split('-'));
return acc;
}, []);
} | [
"function",
"chop",
"(",
"keywords",
")",
"{",
"return",
"keywords",
".",
"slice",
"(",
"0",
")",
".",
"reduce",
"(",
"function",
"(",
"acc",
",",
"ele",
")",
"{",
"acc",
"=",
"acc",
".",
"concat",
"(",
"ele",
".",
"split",
"(",
"'-'",
")",
")",
... | Clone the array and split words by dashes,
then concat the results back into the array
@param {Array} keywords
@return {Array} | [
"Clone",
"the",
"array",
"and",
"split",
"words",
"by",
"dashes",
"then",
"concat",
"the",
"results",
"back",
"into",
"the",
"array"
] | f4d1a92fab85c49636929d3a23652b1795b9ac22 | https://github.com/jonschlinkert/normalize-keywords/blob/f4d1a92fab85c49636929d3a23652b1795b9ac22/index.js#L80-L86 | train |
jonschlinkert/normalize-keywords | index.js | changeCase | function changeCase(str) {
if (str == null) return '';
str = String(str);
str = str.replace(/\./g, 'zzz')
str = str.replace(/_/g, '-')
str = str.replace(/([A-Z]+)/g, function (_, $1) {
return '-' + $1.toLowerCase();
});
str = str.replace(/[^a-z-]+/g, '-')
str = str.replace(/^[-\s]+|[-\s]+$/g, '');
... | javascript | function changeCase(str) {
if (str == null) return '';
str = String(str);
str = str.replace(/\./g, 'zzz')
str = str.replace(/_/g, '-')
str = str.replace(/([A-Z]+)/g, function (_, $1) {
return '-' + $1.toLowerCase();
});
str = str.replace(/[^a-z-]+/g, '-')
str = str.replace(/^[-\s]+|[-\s]+$/g, '');
... | [
"function",
"changeCase",
"(",
"str",
")",
"{",
"if",
"(",
"str",
"==",
"null",
")",
"return",
"''",
";",
"str",
"=",
"String",
"(",
"str",
")",
";",
"str",
"=",
"str",
".",
"replace",
"(",
"/",
"\\.",
"/",
"g",
",",
"'zzz'",
")",
"str",
"=",
... | Convert camelcase to slugs, remove leading and trailing
dashes and whitespace. Convert underscores to dashes.
@param {String} `str`
@return {String} | [
"Convert",
"camelcase",
"to",
"slugs",
"remove",
"leading",
"and",
"trailing",
"dashes",
"and",
"whitespace",
".",
"Convert",
"underscores",
"to",
"dashes",
"."
] | f4d1a92fab85c49636929d3a23652b1795b9ac22 | https://github.com/jonschlinkert/normalize-keywords/blob/f4d1a92fab85c49636929d3a23652b1795b9ac22/index.js#L109-L121 | train |
jonschlinkert/normalize-keywords | index.js | sanitize | function sanitize(arr, opts) {
return _.reduce(arr, function (acc, keywords) {
keywords = keywords.split(' ').filter(Boolean);
return acc.concat(keywords).map(function (keyword, i) {
if (opts && opts.sanitize) {
return opts.sanitize(keyword, i, keywords);
}
return keyword.toLowerCase... | javascript | function sanitize(arr, opts) {
return _.reduce(arr, function (acc, keywords) {
keywords = keywords.split(' ').filter(Boolean);
return acc.concat(keywords).map(function (keyword, i) {
if (opts && opts.sanitize) {
return opts.sanitize(keyword, i, keywords);
}
return keyword.toLowerCase... | [
"function",
"sanitize",
"(",
"arr",
",",
"opts",
")",
"{",
"return",
"_",
".",
"reduce",
"(",
"arr",
",",
"function",
"(",
"acc",
",",
"keywords",
")",
"{",
"keywords",
"=",
"keywords",
".",
"split",
"(",
"' '",
")",
".",
"filter",
"(",
"Boolean",
... | Clean up empty values, sentences, and non-word characters
that shouldn't polute the keywords.
@param {Array} `arr`
@return {Array} | [
"Clean",
"up",
"empty",
"values",
"sentences",
"and",
"non",
"-",
"word",
"characters",
"that",
"shouldn",
"t",
"polute",
"the",
"keywords",
"."
] | f4d1a92fab85c49636929d3a23652b1795b9ac22 | https://github.com/jonschlinkert/normalize-keywords/blob/f4d1a92fab85c49636929d3a23652b1795b9ac22/index.js#L132-L142 | train |
jonschlinkert/normalize-keywords | index.js | uniq | function uniq(arr) {
if (arr == null || arr.length === 0) {
return [];
}
return _.reduce(arr, function(acc, ele) {
var letter = exclusions.singleLetters;
if (acc.indexOf(ele) === -1 && letter.indexOf(ele) === -1) {
acc.push(ele);
}
return acc;
}, []);
} | javascript | function uniq(arr) {
if (arr == null || arr.length === 0) {
return [];
}
return _.reduce(arr, function(acc, ele) {
var letter = exclusions.singleLetters;
if (acc.indexOf(ele) === -1 && letter.indexOf(ele) === -1) {
acc.push(ele);
}
return acc;
}, []);
} | [
"function",
"uniq",
"(",
"arr",
")",
"{",
"if",
"(",
"arr",
"==",
"null",
"||",
"arr",
".",
"length",
"===",
"0",
")",
"{",
"return",
"[",
"]",
";",
"}",
"return",
"_",
".",
"reduce",
"(",
"arr",
",",
"function",
"(",
"acc",
",",
"ele",
")",
... | Uniqueify keywords.
@param {Array} `arr`
@return {Array} | [
"Uniqueify",
"keywords",
"."
] | f4d1a92fab85c49636929d3a23652b1795b9ac22 | https://github.com/jonschlinkert/normalize-keywords/blob/f4d1a92fab85c49636929d3a23652b1795b9ac22/index.js#L152-L165 | train |
ecliptic/webpack-blocks-copy | lib/index.js | copy | function copy (from, to) {
return Object.assign(
function (context) {
return function (prevConfig) {
context.copyPlugin = context.copyPlugin || {patterns: []}
// Merge the provided simple pattern into the config
context.copyPlugin = _extends({}, context.copyPlugin, {
patte... | javascript | function copy (from, to) {
return Object.assign(
function (context) {
return function (prevConfig) {
context.copyPlugin = context.copyPlugin || {patterns: []}
// Merge the provided simple pattern into the config
context.copyPlugin = _extends({}, context.copyPlugin, {
patte... | [
"function",
"copy",
"(",
"from",
",",
"to",
")",
"{",
"return",
"Object",
".",
"assign",
"(",
"function",
"(",
"context",
")",
"{",
"return",
"function",
"(",
"prevConfig",
")",
"{",
"context",
".",
"copyPlugin",
"=",
"context",
".",
"copyPlugin",
"||",
... | Adds a simple copy pattern to the list of patterns for the plugin. | [
"Adds",
"a",
"simple",
"copy",
"pattern",
"to",
"the",
"list",
"of",
"patterns",
"for",
"the",
"plugin",
"."
] | 3bd12137a35a9237a9bdc6c4443e5ed29bfc8812 | https://github.com/ecliptic/webpack-blocks-copy/blob/3bd12137a35a9237a9bdc6c4443e5ed29bfc8812/lib/index.js#L36-L55 | train |
ecliptic/webpack-blocks-copy | lib/index.js | copyPattern | function copyPattern (pattern) {
return Object.assign(
function (context) {
return function (prevConfig) {
context.copyPlugin = context.copyPlugin || {patterns: []}
// Merge the provided advanced pattern into the config
context.copyPlugin = _extends({}, context.copyPlugin, {
... | javascript | function copyPattern (pattern) {
return Object.assign(
function (context) {
return function (prevConfig) {
context.copyPlugin = context.copyPlugin || {patterns: []}
// Merge the provided advanced pattern into the config
context.copyPlugin = _extends({}, context.copyPlugin, {
... | [
"function",
"copyPattern",
"(",
"pattern",
")",
"{",
"return",
"Object",
".",
"assign",
"(",
"function",
"(",
"context",
")",
"{",
"return",
"function",
"(",
"prevConfig",
")",
"{",
"context",
".",
"copyPlugin",
"=",
"context",
".",
"copyPlugin",
"||",
"{"... | Adds an advanced pattern to the list of patterns for the plugin. | [
"Adds",
"an",
"advanced",
"pattern",
"to",
"the",
"list",
"of",
"patterns",
"for",
"the",
"plugin",
"."
] | 3bd12137a35a9237a9bdc6c4443e5ed29bfc8812 | https://github.com/ecliptic/webpack-blocks-copy/blob/3bd12137a35a9237a9bdc6c4443e5ed29bfc8812/lib/index.js#L60-L77 | train |
ecliptic/webpack-blocks-copy | lib/index.js | copyOptions | function copyOptions (options) {
return Object.assign(
function (context) {
return function (prevConfig) {
context.copyPlugin = context.copyPlugin || {}
// Merge the provided copy plugin config into the context
context.copyPlugin = _extends({}, context.copyPlugin, {
option... | javascript | function copyOptions (options) {
return Object.assign(
function (context) {
return function (prevConfig) {
context.copyPlugin = context.copyPlugin || {}
// Merge the provided copy plugin config into the context
context.copyPlugin = _extends({}, context.copyPlugin, {
option... | [
"function",
"copyOptions",
"(",
"options",
")",
"{",
"return",
"Object",
".",
"assign",
"(",
"function",
"(",
"context",
")",
"{",
"return",
"function",
"(",
"prevConfig",
")",
"{",
"context",
".",
"copyPlugin",
"=",
"context",
".",
"copyPlugin",
"||",
"{"... | Sets options for the copy plugin. | [
"Sets",
"options",
"for",
"the",
"copy",
"plugin",
"."
] | 3bd12137a35a9237a9bdc6c4443e5ed29bfc8812 | https://github.com/ecliptic/webpack-blocks-copy/blob/3bd12137a35a9237a9bdc6c4443e5ed29bfc8812/lib/index.js#L82-L99 | train |
ecliptic/webpack-blocks-copy | lib/index.js | postConfig | function postConfig (context, _ref) {
var merge = _ref.merge
return function (prevConfig) {
var _context$copyPlugin = context.copyPlugin,
patterns = _context$copyPlugin.patterns,
options = _context$copyPlugin.options
var plugin = new _copyWebpackPlugin2.default(patterns, options)
return me... | javascript | function postConfig (context, _ref) {
var merge = _ref.merge
return function (prevConfig) {
var _context$copyPlugin = context.copyPlugin,
patterns = _context$copyPlugin.patterns,
options = _context$copyPlugin.options
var plugin = new _copyWebpackPlugin2.default(patterns, options)
return me... | [
"function",
"postConfig",
"(",
"context",
",",
"_ref",
")",
"{",
"var",
"merge",
"=",
"_ref",
".",
"merge",
"return",
"function",
"(",
"prevConfig",
")",
"{",
"var",
"_context$copyPlugin",
"=",
"context",
".",
"copyPlugin",
",",
"patterns",
"=",
"_context$co... | Instantiate the copy plugin. | [
"Instantiate",
"the",
"copy",
"plugin",
"."
] | 3bd12137a35a9237a9bdc6c4443e5ed29bfc8812 | https://github.com/ecliptic/webpack-blocks-copy/blob/3bd12137a35a9237a9bdc6c4443e5ed29bfc8812/lib/index.js#L104-L115 | train |
MORPOL/createClass | createclass.js | function( mElement, aArray ) {
for( var i=0; i<aArray.length; i++ )
if( aArray[i]==mElement )
return i;
return -1;
} | javascript | function( mElement, aArray ) {
for( var i=0; i<aArray.length; i++ )
if( aArray[i]==mElement )
return i;
return -1;
} | [
"function",
"(",
"mElement",
",",
"aArray",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"aArray",
".",
"length",
";",
"i",
"++",
")",
"if",
"(",
"aArray",
"[",
"i",
"]",
"==",
"mElement",
")",
"return",
"i",
";",
"return",
"-",
... | Check whether or not the given element exists in the given array
@param mElement The element to be searched for (double equal comparison)
@param aArray The array to be searched
@return The index of the element within the array or -1 if it wasn't found | [
"Check",
"whether",
"or",
"not",
"the",
"given",
"element",
"exists",
"in",
"the",
"given",
"array"
] | 3e839121357fd25ff1b20fcd4ca02062f1192583 | https://github.com/MORPOL/createClass/blob/3e839121357fd25ff1b20fcd4ca02062f1192583/createclass.js#L57-L63 | train | |
MORPOL/createClass | createclass.js | function() {
var v = [];
for( var i in this )
if( typeof this[i]=="function" && this[i].__virtual )
v.push( i );
if( v.length )
createClass.log( 'error', 'INCOMPLETE CLASS '+this.__className+' HAS AT LEAST ONE PURE VIRTUAL FUNCTION: '+v.join(", ") );
} | javascript | function() {
var v = [];
for( var i in this )
if( typeof this[i]=="function" && this[i].__virtual )
v.push( i );
if( v.length )
createClass.log( 'error', 'INCOMPLETE CLASS '+this.__className+' HAS AT LEAST ONE PURE VIRTUAL FUNCTION: '+v.join(", ") );
} | [
"function",
"(",
")",
"{",
"var",
"v",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"i",
"in",
"this",
")",
"if",
"(",
"typeof",
"this",
"[",
"i",
"]",
"==",
"\"function\"",
"&&",
"this",
"[",
"i",
"]",
".",
"__virtual",
")",
"v",
".",
"push",
"(",... | Check for virtual errors, i.e. functions that should have been overridden, but weren't | [
"Check",
"for",
"virtual",
"errors",
"i",
".",
"e",
".",
"functions",
"that",
"should",
"have",
"been",
"overridden",
"but",
"weren",
"t"
] | 3e839121357fd25ff1b20fcd4ca02062f1192583 | https://github.com/MORPOL/createClass/blob/3e839121357fd25ff1b20fcd4ca02062f1192583/createclass.js#L291-L299 | train | |
tjmehta/string-reduce | index.js | stringReduce | function stringReduce (string, reducerCallback, initialValue) {
if (string.length === 0) {
assertErr(initialValue, TypeError, 'Reduce of empty string with no initial value')
return initialValue
}
var initialValuePassed = arguments.length === 3
var result
var startIndex
if (initialValuePassed) {
... | javascript | function stringReduce (string, reducerCallback, initialValue) {
if (string.length === 0) {
assertErr(initialValue, TypeError, 'Reduce of empty string with no initial value')
return initialValue
}
var initialValuePassed = arguments.length === 3
var result
var startIndex
if (initialValuePassed) {
... | [
"function",
"stringReduce",
"(",
"string",
",",
"reducerCallback",
",",
"initialValue",
")",
"{",
"if",
"(",
"string",
".",
"length",
"===",
"0",
")",
"{",
"assertErr",
"(",
"initialValue",
",",
"TypeError",
",",
"'Reduce of empty string with no initial value'",
"... | reduce a string to a value
@param {string} string string to reduce
@param {function} reducerCb reducer function
@param {*} initialValue reduce initial value
@return {*} result | [
"reduce",
"a",
"string",
"to",
"a",
"value"
] | ff3e69a3b68115c793aa2d43f2ab3376688527a2 | https://github.com/tjmehta/string-reduce/blob/ff3e69a3b68115c793aa2d43f2ab3376688527a2/index.js#L12-L37 | train |
nknapp/deep-aplus | index.js | handleAny | function handleAny (obj) {
if (isPromiseAlike(obj)) {
return obj.then(handleAny)
} else if (isPlainObject(obj)) {
return handleObject(obj)
} else if (Object.prototype.toString.call(obj) === '[object Array]') {
return handleArray(obj)
} else {
return new Promise(function (resolve,... | javascript | function handleAny (obj) {
if (isPromiseAlike(obj)) {
return obj.then(handleAny)
} else if (isPlainObject(obj)) {
return handleObject(obj)
} else if (Object.prototype.toString.call(obj) === '[object Array]') {
return handleArray(obj)
} else {
return new Promise(function (resolve,... | [
"function",
"handleAny",
"(",
"obj",
")",
"{",
"if",
"(",
"isPromiseAlike",
"(",
"obj",
")",
")",
"{",
"return",
"obj",
".",
"then",
"(",
"handleAny",
")",
"}",
"else",
"if",
"(",
"isPlainObject",
"(",
"obj",
")",
")",
"{",
"return",
"handleObject",
... | Return a promise for an object, array, or other value, with all internal promises resolved.
@param {*} obj
@returns {Promise<*>}
@private | [
"Return",
"a",
"promise",
"for",
"an",
"object",
"array",
"or",
"other",
"value",
"with",
"all",
"internal",
"promises",
"resolved",
"."
] | da8c5432e895c5087dc1f1a2234be4273ab0592c | https://github.com/nknapp/deep-aplus/blob/da8c5432e895c5087dc1f1a2234be4273ab0592c/index.js#L78-L90 | train |
redisjs/jsr-server | lib/command/database/key/dump.js | execute | function execute(req, res) {
var value = req.db.getKey(req.args[0], req);
if(value === undefined) return res.send(null, null);
var buf = dump(
{value: value}, value.rtype || Constants.TYPE_NAMES.STRING, null);
res.send(null, buf);
} | javascript | function execute(req, res) {
var value = req.db.getKey(req.args[0], req);
if(value === undefined) return res.send(null, null);
var buf = dump(
{value: value}, value.rtype || Constants.TYPE_NAMES.STRING, null);
res.send(null, buf);
} | [
"function",
"execute",
"(",
"req",
",",
"res",
")",
"{",
"var",
"value",
"=",
"req",
".",
"db",
".",
"getKey",
"(",
"req",
".",
"args",
"[",
"0",
"]",
",",
"req",
")",
";",
"if",
"(",
"value",
"===",
"undefined",
")",
"return",
"res",
".",
"sen... | Respond to the DUMP command. | [
"Respond",
"to",
"the",
"DUMP",
"command",
"."
] | 49413052d3039524fbdd2ade0ef9bae26cb4d647 | https://github.com/redisjs/jsr-server/blob/49413052d3039524fbdd2ade0ef9bae26cb4d647/lib/command/database/key/dump.js#L18-L24 | train |
rendrjs/grunt-rendr-stitch | tasks/rendr_stitch.js | assertFiles | function assertFiles(expectedNumFiles, tmpDir, callback) {
function countFiles() {
var numFiles = 0;
grunt.file.recurse(tmpDir, function(abspath, rootdir, subdir, filename) {
numFiles++;
});
return numFiles === expectedNumFiles;
}
var interval = setInterval(function() {
... | javascript | function assertFiles(expectedNumFiles, tmpDir, callback) {
function countFiles() {
var numFiles = 0;
grunt.file.recurse(tmpDir, function(abspath, rootdir, subdir, filename) {
numFiles++;
});
return numFiles === expectedNumFiles;
}
var interval = setInterval(function() {
... | [
"function",
"assertFiles",
"(",
"expectedNumFiles",
",",
"tmpDir",
",",
"callback",
")",
"{",
"function",
"countFiles",
"(",
")",
"{",
"var",
"numFiles",
"=",
"0",
";",
"grunt",
".",
"file",
".",
"recurse",
"(",
"tmpDir",
",",
"function",
"(",
"abspath",
... | Sometimes, the Stitch compliation appears to happen before all files are copied over to
the `tmpDir`. We simply wait until they are. | [
"Sometimes",
"the",
"Stitch",
"compliation",
"appears",
"to",
"happen",
"before",
"all",
"files",
"are",
"copied",
"over",
"to",
"the",
"tmpDir",
".",
"We",
"simply",
"wait",
"until",
"they",
"are",
"."
] | de05755007d4af4817c7f4b46c31e4d96c42aee1 | https://github.com/rendrjs/grunt-rendr-stitch/blob/de05755007d4af4817c7f4b46c31e4d96c42aee1/tasks/rendr_stitch.js#L117-L132 | train |
AndreasMadsen/thintalk | lib/layers/TCP.js | jsonStream | function jsonStream(target, socket) {
// first set the channel encodeing to utf8
socket.setEncoding('utf8');
// data chunks may not contain a complete json string, thats why we store the data
var jsonBuffer = '';
// emits when new data from TCP connection is received
socket.on('data', function (chunk) {
... | javascript | function jsonStream(target, socket) {
// first set the channel encodeing to utf8
socket.setEncoding('utf8');
// data chunks may not contain a complete json string, thats why we store the data
var jsonBuffer = '';
// emits when new data from TCP connection is received
socket.on('data', function (chunk) {
... | [
"function",
"jsonStream",
"(",
"target",
",",
"socket",
")",
"{",
"// first set the channel encodeing to utf8",
"socket",
".",
"setEncoding",
"(",
"'utf8'",
")",
";",
"// data chunks may not contain a complete json string, thats why we store the data",
"var",
"jsonBuffer",
"=",... | Since data from a socket comes in buffer streams in an unknown length this helper store the data until a complete json object has been received when a json object is received it will emit the message event on target. JSON strings will be isolated by a newline sign. | [
"Since",
"data",
"from",
"a",
"socket",
"comes",
"in",
"buffer",
"streams",
"in",
"an",
"unknown",
"length",
"this",
"helper",
"store",
"the",
"data",
"until",
"a",
"complete",
"json",
"object",
"has",
"been",
"received",
"when",
"a",
"json",
"object",
"is... | 1ea0c2703d303874fc50d8efb2013ee4d7dadeb1 | https://github.com/AndreasMadsen/thintalk/blob/1ea0c2703d303874fc50d8efb2013ee4d7dadeb1/lib/layers/TCP.js#L21-L53 | train |
congajs/conga-twig | lib/tags/twig.tag.assets.js | function (token, context, chain) {
var i ,
len ,
files = [] ,
output = '' ,
viewData = Object.create(context) ,
env = container.getParameter('kernel.environment') ,
data = container.get('assets.template.helper.assets')
.assets(token.files[0], token.files[1], token.files[2], false);
... | javascript | function (token, context, chain) {
var i ,
len ,
files = [] ,
output = '' ,
viewData = Object.create(context) ,
env = container.getParameter('kernel.environment') ,
data = container.get('assets.template.helper.assets')
.assets(token.files[0], token.files[1], token.files[2], false);
... | [
"function",
"(",
"token",
",",
"context",
",",
"chain",
")",
"{",
"var",
"i",
",",
"len",
",",
"files",
"=",
"[",
"]",
",",
"output",
"=",
"''",
",",
"viewData",
"=",
"Object",
".",
"create",
"(",
"context",
")",
",",
"env",
"=",
"container",
"."... | Runs when the template is rendered | [
"Runs",
"when",
"the",
"template",
"is",
"rendered"
] | a3d60fccb655fcf5afa91f254632c48675bebda5 | https://github.com/congajs/conga-twig/blob/a3d60fccb655fcf5afa91f254632c48675bebda5/lib/tags/twig.tag.assets.js#L85-L120 | train | |
jaredhanson/jsmt | lib/module.js | Module | function Module(id, parent) {
this.id = id
this.parent = parent;
if (parent && parent.children) {
parent.children.push(this);
}
this.children = [];
this.filename = null;
this.format = undefined;
this.loaded = false;
} | javascript | function Module(id, parent) {
this.id = id
this.parent = parent;
if (parent && parent.children) {
parent.children.push(this);
}
this.children = [];
this.filename = null;
this.format = undefined;
this.loaded = false;
} | [
"function",
"Module",
"(",
"id",
",",
"parent",
")",
"{",
"this",
".",
"id",
"=",
"id",
"this",
".",
"parent",
"=",
"parent",
";",
"if",
"(",
"parent",
"&&",
"parent",
".",
"children",
")",
"{",
"parent",
".",
"children",
".",
"push",
"(",
"this",
... | `Module` constructor.
Constructs a new module with the given `id` and `parent`. If `parent` is
not null, the created module will be added as a child of `parent`.
@param {String} id
@param {Module} parent
@api public | [
"Module",
"constructor",
"."
] | 13962176250ef41931d8f7e2290d630bd492e4af | https://github.com/jaredhanson/jsmt/blob/13962176250ef41931d8f7e2290d630bd492e4af/lib/module.js#L25-L36 | train |
jakekara/datab.js | src/datab-data.js | function( matrix )
{
// default to empty 2d array
if ( typeof( matrix ) == "undefined" )
var matrix = []; // zero rows
// store rows for O(n) retrieval after initial
// operation. sacrifices memory efficiency
this.__rows = matrix;
this.__cols = d3.transpose(matrix);
// get the default in... | javascript | function( matrix )
{
// default to empty 2d array
if ( typeof( matrix ) == "undefined" )
var matrix = []; // zero rows
// store rows for O(n) retrieval after initial
// operation. sacrifices memory efficiency
this.__rows = matrix;
this.__cols = d3.transpose(matrix);
// get the default in... | [
"function",
"(",
"matrix",
")",
"{",
"// default to empty 2d array",
"if",
"(",
"typeof",
"(",
"matrix",
")",
"==",
"\"undefined\"",
")",
"var",
"matrix",
"=",
"[",
"]",
";",
"// zero rows",
"// store rows for O(n) retrieval after initial",
"// operation. sacrifices mem... | create a data object from a two-dimensional array
@constructor
@arg matrix - a matrix (2d-array) of the table | [
"create",
"a",
"data",
"object",
"from",
"a",
"two",
"-",
"dimensional",
"array"
] | 696246bf461609bf1fd145634307f4c7d3edc82a | https://github.com/jakekara/datab.js/blob/696246bf461609bf1fd145634307f4c7d3edc82a/src/datab-data.js#L41-L73 | train | |
vkiding/judpack-lib | src/cordova/plugin_parser.js | plugin_parser | function plugin_parser(xmlPath) {
this.path = xmlPath;
this.doc = xml.parseElementtreeSync(xmlPath);
this.platforms = this.doc.findall('platform').map(function(p) {
return p.attrib.name;
});
} | javascript | function plugin_parser(xmlPath) {
this.path = xmlPath;
this.doc = xml.parseElementtreeSync(xmlPath);
this.platforms = this.doc.findall('platform').map(function(p) {
return p.attrib.name;
});
} | [
"function",
"plugin_parser",
"(",
"xmlPath",
")",
"{",
"this",
".",
"path",
"=",
"xmlPath",
";",
"this",
".",
"doc",
"=",
"xml",
".",
"parseElementtreeSync",
"(",
"xmlPath",
")",
";",
"this",
".",
"platforms",
"=",
"this",
".",
"doc",
".",
"findall",
"... | Deprecated. Use PluginInfo instead. | [
"Deprecated",
".",
"Use",
"PluginInfo",
"instead",
"."
] | 8657cecfec68221109279106adca8dbc81f430f4 | https://github.com/vkiding/judpack-lib/blob/8657cecfec68221109279106adca8dbc81f430f4/src/cordova/plugin_parser.js#L23-L29 | train |
tolokoban/ToloFrameWork | ker/mod/tfw.view.icon.js | onContentChanged | function onContentChanged( contentStringOrObject ) {
try {
const
isString = typeof contentStringOrObject === 'string',
content = isString ? Icons.iconsBook[ contentStringOrObject ] : contentStringOrObject;
this._content = createSvgFromDefinition.call( this, content );
... | javascript | function onContentChanged( contentStringOrObject ) {
try {
const
isString = typeof contentStringOrObject === 'string',
content = isString ? Icons.iconsBook[ contentStringOrObject ] : contentStringOrObject;
this._content = createSvgFromDefinition.call( this, content );
... | [
"function",
"onContentChanged",
"(",
"contentStringOrObject",
")",
"{",
"try",
"{",
"const",
"isString",
"=",
"typeof",
"contentStringOrObject",
"===",
"'string'",
",",
"content",
"=",
"isString",
"?",
"Icons",
".",
"iconsBook",
"[",
"contentStringOrObject",
"]",
... | Create SVG icon from `content`
@this ViewXJS
@param {object|string} contentStringOrObject - Can be an icon name or a SVG description.
@returns {undefined} | [
"Create",
"SVG",
"icon",
"from",
"content"
] | 730845a833a9660ebfdb60ad027ebaab5ac871b6 | https://github.com/tolokoban/ToloFrameWork/blob/730845a833a9660ebfdb60ad027ebaab5ac871b6/ker/mod/tfw.view.icon.js#L30-L50 | train |
tolokoban/ToloFrameWork | ker/mod/tfw.view.icon.js | updatePen | function updatePen( penIndex, penColor = "0" ) {
if ( !this._content ) return;
let elementsToFill = this._content.elementsToFillPerColor[ penIndex ];
if ( !Array.isArray( elementsToFill ) ) elementsToFill = [];
let elementsToStroke = this._content.elementsToStrokePerColor[ penIndex ];
if ( !Array.i... | javascript | function updatePen( penIndex, penColor = "0" ) {
if ( !this._content ) return;
let elementsToFill = this._content.elementsToFillPerColor[ penIndex ];
if ( !Array.isArray( elementsToFill ) ) elementsToFill = [];
let elementsToStroke = this._content.elementsToStrokePerColor[ penIndex ];
if ( !Array.i... | [
"function",
"updatePen",
"(",
"penIndex",
",",
"penColor",
"=",
"\"0\"",
")",
"{",
"if",
"(",
"!",
"this",
".",
"_content",
")",
"return",
";",
"let",
"elementsToFill",
"=",
"this",
".",
"_content",
".",
"elementsToFillPerColor",
"[",
"penIndex",
"]",
";",... | Update the color of a pen.
@this ViewXJS
@param {integer} penIndex - The index of the pen.
@param {string} penColor - The new color of this pen.
@returns {undefined} | [
"Update",
"the",
"color",
"of",
"a",
"pen",
"."
] | 730845a833a9660ebfdb60ad027ebaab5ac871b6 | https://github.com/tolokoban/ToloFrameWork/blob/730845a833a9660ebfdb60ad027ebaab5ac871b6/ker/mod/tfw.view.icon.js#L198-L207 | train |
baaae/charge | lib/index.js | aliasesTaken | function aliasesTaken (arr) {
var taken
for (var ind in arr) {
if (!arr.hasOwnProperty(ind)) continue;
if (aliasTaken(arr[ind]) !== false) return arr[ind];
}
return false;
} | javascript | function aliasesTaken (arr) {
var taken
for (var ind in arr) {
if (!arr.hasOwnProperty(ind)) continue;
if (aliasTaken(arr[ind]) !== false) return arr[ind];
}
return false;
} | [
"function",
"aliasesTaken",
"(",
"arr",
")",
"{",
"var",
"taken",
"for",
"(",
"var",
"ind",
"in",
"arr",
")",
"{",
"if",
"(",
"!",
"arr",
".",
"hasOwnProperty",
"(",
"ind",
")",
")",
"continue",
";",
"if",
"(",
"aliasTaken",
"(",
"arr",
"[",
"ind",... | return false if _any_ one of them is in use | [
"return",
"false",
"if",
"_any_",
"one",
"of",
"them",
"is",
"in",
"use"
] | af756ab21edc7e96d68e217225f3e386b72f0af1 | https://github.com/baaae/charge/blob/af756ab21edc7e96d68e217225f3e386b72f0af1/lib/index.js#L147-L154 | train |
reptilbud/hapi-swagger | public/swaggerui/swagger-ui.js | simpleChar | function simpleChar(character) {
return CHAR_TAB !== character &&
CHAR_LINE_FEED !== character &&
CHAR_CARRIAGE_RETURN !== character &&
CHAR_COMMA !== character &&
CHAR_LEFT_SQUARE_BRACKET !== character &&
CHAR_RIGHT_SQUARE_... | javascript | function simpleChar(character) {
return CHAR_TAB !== character &&
CHAR_LINE_FEED !== character &&
CHAR_CARRIAGE_RETURN !== character &&
CHAR_COMMA !== character &&
CHAR_LEFT_SQUARE_BRACKET !== character &&
CHAR_RIGHT_SQUARE_... | [
"function",
"simpleChar",
"(",
"character",
")",
"{",
"return",
"CHAR_TAB",
"!==",
"character",
"&&",
"CHAR_LINE_FEED",
"!==",
"character",
"&&",
"CHAR_CARRIAGE_RETURN",
"!==",
"character",
"&&",
"CHAR_COMMA",
"!==",
"character",
"&&",
"CHAR_LEFT_SQUARE_BRACKET",
"!==... | Returns true if character can be found in a simple scalar | [
"Returns",
"true",
"if",
"character",
"can",
"be",
"found",
"in",
"a",
"simple",
"scalar"
] | 8a4a1059f060a7100270e837d2759c6a2b9c7e74 | https://github.com/reptilbud/hapi-swagger/blob/8a4a1059f060a7100270e837d2759c6a2b9c7e74/public/swaggerui/swagger-ui.js#L7770-L7791 | train |
reptilbud/hapi-swagger | public/swaggerui/swagger-ui.js | needsHexEscape | function needsHexEscape(character) {
return !((0x00020 <= character && character <= 0x00007E) ||
(0x00085 === character) ||
(0x000A0 <= character && character <= 0x00D7FF) ||
(0x0E000 <= character && character <= 0x00FFFD) ||
(0x10000 <= character &&... | javascript | function needsHexEscape(character) {
return !((0x00020 <= character && character <= 0x00007E) ||
(0x00085 === character) ||
(0x000A0 <= character && character <= 0x00D7FF) ||
(0x0E000 <= character && character <= 0x00FFFD) ||
(0x10000 <= character &&... | [
"function",
"needsHexEscape",
"(",
"character",
")",
"{",
"return",
"!",
"(",
"(",
"0x00020",
"<=",
"character",
"&&",
"character",
"<=",
"0x00007E",
")",
"||",
"(",
"0x00085",
"===",
"character",
")",
"||",
"(",
"0x000A0",
"<=",
"character",
"&&",
"charac... | Returns true if the character code needs to be escaped. | [
"Returns",
"true",
"if",
"the",
"character",
"code",
"needs",
"to",
"be",
"escaped",
"."
] | 8a4a1059f060a7100270e837d2759c6a2b9c7e74 | https://github.com/reptilbud/hapi-swagger/blob/8a4a1059f060a7100270e837d2759c6a2b9c7e74/public/swaggerui/swagger-ui.js#L7794-L7800 | train |
reptilbud/hapi-swagger | public/swaggerui/swagger-ui.js | fromCodePoint | function fromCodePoint(cp) {
return (cp < 0x10000) ? String.fromCharCode(cp) :
String.fromCharCode(0xD800 + ((cp - 0x10000) >> 10)) +
String.fromCharCode(0xDC00 + ((cp - 0x10000) & 1023));
} | javascript | function fromCodePoint(cp) {
return (cp < 0x10000) ? String.fromCharCode(cp) :
String.fromCharCode(0xD800 + ((cp - 0x10000) >> 10)) +
String.fromCharCode(0xDC00 + ((cp - 0x10000) & 1023));
} | [
"function",
"fromCodePoint",
"(",
"cp",
")",
"{",
"return",
"(",
"cp",
"<",
"0x10000",
")",
"?",
"String",
".",
"fromCharCode",
"(",
"cp",
")",
":",
"String",
".",
"fromCharCode",
"(",
"0xD800",
"+",
"(",
"(",
"cp",
"-",
"0x10000",
")",
">>",
"10",
... | ECMA-262 11.6 Identifier Names and Identifiers | [
"ECMA",
"-",
"262",
"11",
".",
"6",
"Identifier",
"Names",
"and",
"Identifiers"
] | 8a4a1059f060a7100270e837d2759c6a2b9c7e74 | https://github.com/reptilbud/hapi-swagger/blob/8a4a1059f060a7100270e837d2759c6a2b9c7e74/public/swaggerui/swagger-ui.js#L11449-L11453 | train |
reptilbud/hapi-swagger | public/swaggerui/swagger-ui.js | isKeyword | function isKeyword(id) {
switch (id.length) {
case 2:
return (id === 'if') || (id === 'in') || (id === 'do');
case 3:
return (id === 'var') || (id === 'for') || (id === 'new') ||
(id === 'try') || (id === 'let');
case 4:
return (id === ... | javascript | function isKeyword(id) {
switch (id.length) {
case 2:
return (id === 'if') || (id === 'in') || (id === 'do');
case 3:
return (id === 'var') || (id === 'for') || (id === 'new') ||
(id === 'try') || (id === 'let');
case 4:
return (id === ... | [
"function",
"isKeyword",
"(",
"id",
")",
"{",
"switch",
"(",
"id",
".",
"length",
")",
"{",
"case",
"2",
":",
"return",
"(",
"id",
"===",
"'if'",
")",
"||",
"(",
"id",
"===",
"'in'",
")",
"||",
"(",
"id",
"===",
"'do'",
")",
";",
"case",
"3",
... | ECMA-262 11.6.2.1 Keywords | [
"ECMA",
"-",
"262",
"11",
".",
"6",
".",
"2",
".",
"1",
"Keywords"
] | 8a4a1059f060a7100270e837d2759c6a2b9c7e74 | https://github.com/reptilbud/hapi-swagger/blob/8a4a1059f060a7100270e837d2759c6a2b9c7e74/public/swaggerui/swagger-ui.js#L11509-L11535 | train |
reptilbud/hapi-swagger | public/swaggerui/swagger-ui.js | scanPunctuator | function scanPunctuator() {
var token, str;
token = {
type: Token.Punctuator,
value: '',
lineNumber: lineNumber,
lineStart: lineStart,
start: index,
end: index
};
// Check for most common single-character punctuato... | javascript | function scanPunctuator() {
var token, str;
token = {
type: Token.Punctuator,
value: '',
lineNumber: lineNumber,
lineStart: lineStart,
start: index,
end: index
};
// Check for most common single-character punctuato... | [
"function",
"scanPunctuator",
"(",
")",
"{",
"var",
"token",
",",
"str",
";",
"token",
"=",
"{",
"type",
":",
"Token",
".",
"Punctuator",
",",
"value",
":",
"''",
",",
"lineNumber",
":",
"lineNumber",
",",
"lineStart",
":",
"lineStart",
",",
"start",
"... | ECMA-262 11.7 Punctuators | [
"ECMA",
"-",
"262",
"11",
".",
"7",
"Punctuators"
] | 8a4a1059f060a7100270e837d2759c6a2b9c7e74 | https://github.com/reptilbud/hapi-swagger/blob/8a4a1059f060a7100270e837d2759c6a2b9c7e74/public/swaggerui/swagger-ui.js#L11902-L11998 | train |
reptilbud/hapi-swagger | public/swaggerui/swagger-ui.js | scanTemplate | function scanTemplate() {
var cooked = '', ch, start, rawOffset, terminated, head, tail, restore, unescaped;
terminated = false;
tail = false;
start = index;
head = (source[index] === '`');
rawOffset = 2;
++index;
while (index < length) {
ch... | javascript | function scanTemplate() {
var cooked = '', ch, start, rawOffset, terminated, head, tail, restore, unescaped;
terminated = false;
tail = false;
start = index;
head = (source[index] === '`');
rawOffset = 2;
++index;
while (index < length) {
ch... | [
"function",
"scanTemplate",
"(",
")",
"{",
"var",
"cooked",
"=",
"''",
",",
"ch",
",",
"start",
",",
"rawOffset",
",",
"terminated",
",",
"head",
",",
"tail",
",",
"restore",
",",
"unescaped",
";",
"terminated",
"=",
"false",
";",
"tail",
"=",
"false",... | ECMA-262 11.8.6 Template Literal Lexical Components | [
"ECMA",
"-",
"262",
"11",
".",
"8",
".",
"6",
"Template",
"Literal",
"Lexical",
"Components"
] | 8a4a1059f060a7100270e837d2759c6a2b9c7e74 | https://github.com/reptilbud/hapi-swagger/blob/8a4a1059f060a7100270e837d2759c6a2b9c7e74/public/swaggerui/swagger-ui.js#L12305-L12425 | train |
reptilbud/hapi-swagger | public/swaggerui/swagger-ui.js | parseArrayPattern | function parseArrayPattern(params, kind) {
var node = new Node(), elements = [], rest, restNode;
expect('[');
while (!match(']')) {
if (match(',')) {
lex();
elements.push(null);
} else {
if (match('...')) {
... | javascript | function parseArrayPattern(params, kind) {
var node = new Node(), elements = [], rest, restNode;
expect('[');
while (!match(']')) {
if (match(',')) {
lex();
elements.push(null);
} else {
if (match('...')) {
... | [
"function",
"parseArrayPattern",
"(",
"params",
",",
"kind",
")",
"{",
"var",
"node",
"=",
"new",
"Node",
"(",
")",
",",
"elements",
"=",
"[",
"]",
",",
"rest",
",",
"restNode",
";",
"expect",
"(",
"'['",
")",
";",
"while",
"(",
"!",
"match",
"(",
... | ECMA-262 13.3.3 Destructuring Binding Patterns | [
"ECMA",
"-",
"262",
"13",
".",
"3",
".",
"3",
"Destructuring",
"Binding",
"Patterns"
] | 8a4a1059f060a7100270e837d2759c6a2b9c7e74 | https://github.com/reptilbud/hapi-swagger/blob/8a4a1059f060a7100270e837d2759c6a2b9c7e74/public/swaggerui/swagger-ui.js#L13838-L13867 | train |
reptilbud/hapi-swagger | public/swaggerui/swagger-ui.js | parsePropertyFunction | function parsePropertyFunction(node, paramInfo, isGenerator) {
var previousStrict, body;
isAssignmentTarget = isBindingElement = false;
previousStrict = strict;
body = isolateCoverGrammar(parseFunctionSourceElements);
if (strict && paramInfo.firstRestricted) {
tole... | javascript | function parsePropertyFunction(node, paramInfo, isGenerator) {
var previousStrict, body;
isAssignmentTarget = isBindingElement = false;
previousStrict = strict;
body = isolateCoverGrammar(parseFunctionSourceElements);
if (strict && paramInfo.firstRestricted) {
tole... | [
"function",
"parsePropertyFunction",
"(",
"node",
",",
"paramInfo",
",",
"isGenerator",
")",
"{",
"var",
"previousStrict",
",",
"body",
";",
"isAssignmentTarget",
"=",
"isBindingElement",
"=",
"false",
";",
"previousStrict",
"=",
"strict",
";",
"body",
"=",
"iso... | ECMA-262 12.2.6 Object Initializer | [
"ECMA",
"-",
"262",
"12",
".",
"2",
".",
"6",
"Object",
"Initializer"
] | 8a4a1059f060a7100270e837d2759c6a2b9c7e74 | https://github.com/reptilbud/hapi-swagger/blob/8a4a1059f060a7100270e837d2759c6a2b9c7e74/public/swaggerui/swagger-ui.js#L13977-L13994 | train |
reptilbud/hapi-swagger | public/swaggerui/swagger-ui.js | parseTemplateElement | function parseTemplateElement(option) {
var node, token;
if (lookahead.type !== Token.Template || (option.head && !lookahead.head)) {
throwUnexpectedToken();
}
node = new Node();
token = lex();
return node.finishTemplateElement({ raw: token.value.raw, cooke... | javascript | function parseTemplateElement(option) {
var node, token;
if (lookahead.type !== Token.Template || (option.head && !lookahead.head)) {
throwUnexpectedToken();
}
node = new Node();
token = lex();
return node.finishTemplateElement({ raw: token.value.raw, cooke... | [
"function",
"parseTemplateElement",
"(",
"option",
")",
"{",
"var",
"node",
",",
"token",
";",
"if",
"(",
"lookahead",
".",
"type",
"!==",
"Token",
".",
"Template",
"||",
"(",
"option",
".",
"head",
"&&",
"!",
"lookahead",
".",
"head",
")",
")",
"{",
... | ECMA-262 12.2.9 Template Literals | [
"ECMA",
"-",
"262",
"12",
".",
"2",
".",
"9",
"Template",
"Literals"
] | 8a4a1059f060a7100270e837d2759c6a2b9c7e74 | https://github.com/reptilbud/hapi-swagger/blob/8a4a1059f060a7100270e837d2759c6a2b9c7e74/public/swaggerui/swagger-ui.js#L14248-L14259 | train |
reptilbud/hapi-swagger | public/swaggerui/swagger-ui.js | parseGroupExpression | function parseGroupExpression() {
var expr, expressions, startToken, i, params = [];
expect('(');
if (match(')')) {
lex();
if (!match('=>')) {
expect('=>');
}
return {
type: PlaceHolders.ArrowParameterPlaceHolder,
... | javascript | function parseGroupExpression() {
var expr, expressions, startToken, i, params = [];
expect('(');
if (match(')')) {
lex();
if (!match('=>')) {
expect('=>');
}
return {
type: PlaceHolders.ArrowParameterPlaceHolder,
... | [
"function",
"parseGroupExpression",
"(",
")",
"{",
"var",
"expr",
",",
"expressions",
",",
"startToken",
",",
"i",
",",
"params",
"=",
"[",
"]",
";",
"expect",
"(",
"'('",
")",
";",
"if",
"(",
"match",
"(",
"')'",
")",
")",
"{",
"lex",
"(",
")",
... | ECMA-262 12.2.10 The Grouping Operator | [
"ECMA",
"-",
"262",
"12",
".",
"2",
".",
"10",
"The",
"Grouping",
"Operator"
] | 8a4a1059f060a7100270e837d2759c6a2b9c7e74 | https://github.com/reptilbud/hapi-swagger/blob/8a4a1059f060a7100270e837d2759c6a2b9c7e74/public/swaggerui/swagger-ui.js#L14279-L14377 | train |
reptilbud/hapi-swagger | public/swaggerui/swagger-ui.js | parsePrimaryExpression | function parsePrimaryExpression() {
var type, token, expr, node;
if (match('(')) {
isBindingElement = false;
return inheritCoverGrammar(parseGroupExpression);
}
if (match('[')) {
return inheritCoverGrammar(parseArrayInitializer);
}
i... | javascript | function parsePrimaryExpression() {
var type, token, expr, node;
if (match('(')) {
isBindingElement = false;
return inheritCoverGrammar(parseGroupExpression);
}
if (match('[')) {
return inheritCoverGrammar(parseArrayInitializer);
}
i... | [
"function",
"parsePrimaryExpression",
"(",
")",
"{",
"var",
"type",
",",
"token",
",",
"expr",
",",
"node",
";",
"if",
"(",
"match",
"(",
"'('",
")",
")",
"{",
"isBindingElement",
"=",
"false",
";",
"return",
"inheritCoverGrammar",
"(",
"parseGroupExpression... | ECMA-262 12.2 Primary Expressions | [
"ECMA",
"-",
"262",
"12",
".",
"2",
"Primary",
"Expressions"
] | 8a4a1059f060a7100270e837d2759c6a2b9c7e74 | https://github.com/reptilbud/hapi-swagger/blob/8a4a1059f060a7100270e837d2759c6a2b9c7e74/public/swaggerui/swagger-ui.js#L14382-L14459 | train |
reptilbud/hapi-swagger | public/swaggerui/swagger-ui.js | parseArguments | function parseArguments() {
var args = [], expr;
expect('(');
if (!match(')')) {
while (startIndex < length) {
if (match('...')) {
expr = new Node();
lex();
expr.finishSpreadElement(isolateCoverGrammar(pars... | javascript | function parseArguments() {
var args = [], expr;
expect('(');
if (!match(')')) {
while (startIndex < length) {
if (match('...')) {
expr = new Node();
lex();
expr.finishSpreadElement(isolateCoverGrammar(pars... | [
"function",
"parseArguments",
"(",
")",
"{",
"var",
"args",
"=",
"[",
"]",
",",
"expr",
";",
"expect",
"(",
"'('",
")",
";",
"if",
"(",
"!",
"match",
"(",
"')'",
")",
")",
"{",
"while",
"(",
"startIndex",
"<",
"length",
")",
"{",
"if",
"(",
"ma... | ECMA-262 12.3 Left-Hand-Side Expressions | [
"ECMA",
"-",
"262",
"12",
".",
"3",
"Left",
"-",
"Hand",
"-",
"Side",
"Expressions"
] | 8a4a1059f060a7100270e837d2759c6a2b9c7e74 | https://github.com/reptilbud/hapi-swagger/blob/8a4a1059f060a7100270e837d2759c6a2b9c7e74/public/swaggerui/swagger-ui.js#L14463-L14488 | train |
reptilbud/hapi-swagger | public/swaggerui/swagger-ui.js | parseNewExpression | function parseNewExpression() {
var callee, args, node = new Node();
expectKeyword('new');
if (match('.')) {
lex();
if (lookahead.type === Token.Identifier && lookahead.value === 'target') {
if (state.inFunctionBody) {
lex();
... | javascript | function parseNewExpression() {
var callee, args, node = new Node();
expectKeyword('new');
if (match('.')) {
lex();
if (lookahead.type === Token.Identifier && lookahead.value === 'target') {
if (state.inFunctionBody) {
lex();
... | [
"function",
"parseNewExpression",
"(",
")",
"{",
"var",
"callee",
",",
"args",
",",
"node",
"=",
"new",
"Node",
"(",
")",
";",
"expectKeyword",
"(",
"'new'",
")",
";",
"if",
"(",
"match",
"(",
"'.'",
")",
")",
"{",
"lex",
"(",
")",
";",
"if",
"("... | ECMA-262 12.3.3 The new Operator | [
"ECMA",
"-",
"262",
"12",
".",
"3",
".",
"3",
"The",
"new",
"Operator"
] | 8a4a1059f060a7100270e837d2759c6a2b9c7e74 | https://github.com/reptilbud/hapi-swagger/blob/8a4a1059f060a7100270e837d2759c6a2b9c7e74/public/swaggerui/swagger-ui.js#L14522-L14544 | train |
reptilbud/hapi-swagger | public/swaggerui/swagger-ui.js | parseLeftHandSideExpressionAllowCall | function parseLeftHandSideExpressionAllowCall() {
var quasi, expr, args, property, startToken, previousAllowIn = state.allowIn;
startToken = lookahead;
state.allowIn = true;
if (matchKeyword('super') && state.inFunctionBody) {
expr = new Node();
lex();
... | javascript | function parseLeftHandSideExpressionAllowCall() {
var quasi, expr, args, property, startToken, previousAllowIn = state.allowIn;
startToken = lookahead;
state.allowIn = true;
if (matchKeyword('super') && state.inFunctionBody) {
expr = new Node();
lex();
... | [
"function",
"parseLeftHandSideExpressionAllowCall",
"(",
")",
"{",
"var",
"quasi",
",",
"expr",
",",
"args",
",",
"property",
",",
"startToken",
",",
"previousAllowIn",
"=",
"state",
".",
"allowIn",
";",
"startToken",
"=",
"lookahead",
";",
"state",
".",
"allo... | ECMA-262 12.3.4 Function Calls | [
"ECMA",
"-",
"262",
"12",
".",
"3",
".",
"4",
"Function",
"Calls"
] | 8a4a1059f060a7100270e837d2759c6a2b9c7e74 | https://github.com/reptilbud/hapi-swagger/blob/8a4a1059f060a7100270e837d2759c6a2b9c7e74/public/swaggerui/swagger-ui.js#L14548-L14591 | train |
reptilbud/hapi-swagger | public/swaggerui/swagger-ui.js | parsePostfixExpression | function parsePostfixExpression() {
var expr, token, startToken = lookahead;
expr = inheritCoverGrammar(parseLeftHandSideExpressionAllowCall);
if (!hasLineTerminator && lookahead.type === Token.Punctuator) {
if (match('++') || match('--')) {
// ECMA-262 11.3.1, 11.3... | javascript | function parsePostfixExpression() {
var expr, token, startToken = lookahead;
expr = inheritCoverGrammar(parseLeftHandSideExpressionAllowCall);
if (!hasLineTerminator && lookahead.type === Token.Punctuator) {
if (match('++') || match('--')) {
// ECMA-262 11.3.1, 11.3... | [
"function",
"parsePostfixExpression",
"(",
")",
"{",
"var",
"expr",
",",
"token",
",",
"startToken",
"=",
"lookahead",
";",
"expr",
"=",
"inheritCoverGrammar",
"(",
"parseLeftHandSideExpressionAllowCall",
")",
";",
"if",
"(",
"!",
"hasLineTerminator",
"&&",
"looka... | ECMA-262 12.4 Postfix Expressions | [
"ECMA",
"-",
"262",
"12",
".",
"4",
"Postfix",
"Expressions"
] | 8a4a1059f060a7100270e837d2759c6a2b9c7e74 | https://github.com/reptilbud/hapi-swagger/blob/8a4a1059f060a7100270e837d2759c6a2b9c7e74/public/swaggerui/swagger-ui.js#L14635-L14659 | train |
reptilbud/hapi-swagger | public/swaggerui/swagger-ui.js | parseUnaryExpression | function parseUnaryExpression() {
var token, expr, startToken;
if (lookahead.type !== Token.Punctuator && lookahead.type !== Token.Keyword) {
expr = parsePostfixExpression();
} else if (match('++') || match('--')) {
startToken = lookahead;
token = lex();
... | javascript | function parseUnaryExpression() {
var token, expr, startToken;
if (lookahead.type !== Token.Punctuator && lookahead.type !== Token.Keyword) {
expr = parsePostfixExpression();
} else if (match('++') || match('--')) {
startToken = lookahead;
token = lex();
... | [
"function",
"parseUnaryExpression",
"(",
")",
"{",
"var",
"token",
",",
"expr",
",",
"startToken",
";",
"if",
"(",
"lookahead",
".",
"type",
"!==",
"Token",
".",
"Punctuator",
"&&",
"lookahead",
".",
"type",
"!==",
"Token",
".",
"Keyword",
")",
"{",
"exp... | ECMA-262 12.5 Unary Operators | [
"ECMA",
"-",
"262",
"12",
".",
"5",
"Unary",
"Operators"
] | 8a4a1059f060a7100270e837d2759c6a2b9c7e74 | https://github.com/reptilbud/hapi-swagger/blob/8a4a1059f060a7100270e837d2759c6a2b9c7e74/public/swaggerui/swagger-ui.js#L14663-L14702 | train |
reptilbud/hapi-swagger | public/swaggerui/swagger-ui.js | parseConditionalExpression | function parseConditionalExpression() {
var expr, previousAllowIn, consequent, alternate, startToken;
startToken = lookahead;
expr = inheritCoverGrammar(parseBinaryExpression);
if (match('?')) {
lex();
previousAllowIn = state.allowIn;
state.allowIn =... | javascript | function parseConditionalExpression() {
var expr, previousAllowIn, consequent, alternate, startToken;
startToken = lookahead;
expr = inheritCoverGrammar(parseBinaryExpression);
if (match('?')) {
lex();
previousAllowIn = state.allowIn;
state.allowIn =... | [
"function",
"parseConditionalExpression",
"(",
")",
"{",
"var",
"expr",
",",
"previousAllowIn",
",",
"consequent",
",",
"alternate",
",",
"startToken",
";",
"startToken",
"=",
"lookahead",
";",
"expr",
"=",
"inheritCoverGrammar",
"(",
"parseBinaryExpression",
")",
... | ECMA-262 12.13 Conditional Operator | [
"ECMA",
"-",
"262",
"12",
".",
"13",
"Conditional",
"Operator"
] | 8a4a1059f060a7100270e837d2759c6a2b9c7e74 | https://github.com/reptilbud/hapi-swagger/blob/8a4a1059f060a7100270e837d2759c6a2b9c7e74/public/swaggerui/swagger-ui.js#L14839-L14859 | train |
reptilbud/hapi-swagger | public/swaggerui/swagger-ui.js | parseYieldExpression | function parseYieldExpression() {
var argument, expr, delegate, previousAllowYield;
argument = null;
expr = new Node();
delegate = false;
expectKeyword('yield');
if (!hasLineTerminator) {
previousAllowYield = state.allowYield;
state.allowYield =... | javascript | function parseYieldExpression() {
var argument, expr, delegate, previousAllowYield;
argument = null;
expr = new Node();
delegate = false;
expectKeyword('yield');
if (!hasLineTerminator) {
previousAllowYield = state.allowYield;
state.allowYield =... | [
"function",
"parseYieldExpression",
"(",
")",
"{",
"var",
"argument",
",",
"expr",
",",
"delegate",
",",
"previousAllowYield",
";",
"argument",
"=",
"null",
";",
"expr",
"=",
"new",
"Node",
"(",
")",
";",
"delegate",
"=",
"false",
";",
"expectKeyword",
"("... | ECMA-262 14.4 Yield expression | [
"ECMA",
"-",
"262",
"14",
".",
"4",
"Yield",
"expression"
] | 8a4a1059f060a7100270e837d2759c6a2b9c7e74 | https://github.com/reptilbud/hapi-swagger/blob/8a4a1059f060a7100270e837d2759c6a2b9c7e74/public/swaggerui/swagger-ui.js#L15002-L15027 | train |
reptilbud/hapi-swagger | public/swaggerui/swagger-ui.js | parseAssignmentExpression | function parseAssignmentExpression() {
var token, expr, right, list, startToken;
startToken = lookahead;
token = lookahead;
if (!state.allowYield && matchKeyword('yield')) {
return parseYieldExpression();
}
expr = parseConditionalExpression();
if (... | javascript | function parseAssignmentExpression() {
var token, expr, right, list, startToken;
startToken = lookahead;
token = lookahead;
if (!state.allowYield && matchKeyword('yield')) {
return parseYieldExpression();
}
expr = parseConditionalExpression();
if (... | [
"function",
"parseAssignmentExpression",
"(",
")",
"{",
"var",
"token",
",",
"expr",
",",
"right",
",",
"list",
",",
"startToken",
";",
"startToken",
"=",
"lookahead",
";",
"token",
"=",
"lookahead",
";",
"if",
"(",
"!",
"state",
".",
"allowYield",
"&&",
... | ECMA-262 12.14 Assignment Operators | [
"ECMA",
"-",
"262",
"12",
".",
"14",
"Assignment",
"Operators"
] | 8a4a1059f060a7100270e837d2759c6a2b9c7e74 | https://github.com/reptilbud/hapi-swagger/blob/8a4a1059f060a7100270e837d2759c6a2b9c7e74/public/swaggerui/swagger-ui.js#L15031-L15083 | train |
reptilbud/hapi-swagger | public/swaggerui/swagger-ui.js | parseExpression | function parseExpression() {
var expr, startToken = lookahead, expressions;
expr = isolateCoverGrammar(parseAssignmentExpression);
if (match(',')) {
expressions = [expr];
while (startIndex < length) {
if (!match(',')) {
break;
... | javascript | function parseExpression() {
var expr, startToken = lookahead, expressions;
expr = isolateCoverGrammar(parseAssignmentExpression);
if (match(',')) {
expressions = [expr];
while (startIndex < length) {
if (!match(',')) {
break;
... | [
"function",
"parseExpression",
"(",
")",
"{",
"var",
"expr",
",",
"startToken",
"=",
"lookahead",
",",
"expressions",
";",
"expr",
"=",
"isolateCoverGrammar",
"(",
"parseAssignmentExpression",
")",
";",
"if",
"(",
"match",
"(",
"','",
")",
")",
"{",
"express... | ECMA-262 12.15 Comma Operator | [
"ECMA",
"-",
"262",
"12",
".",
"15",
"Comma",
"Operator"
] | 8a4a1059f060a7100270e837d2759c6a2b9c7e74 | https://github.com/reptilbud/hapi-swagger/blob/8a4a1059f060a7100270e837d2759c6a2b9c7e74/public/swaggerui/swagger-ui.js#L15087-L15107 | train |
reptilbud/hapi-swagger | public/swaggerui/swagger-ui.js | parseStatementListItem | function parseStatementListItem() {
if (lookahead.type === Token.Keyword) {
switch (lookahead.value) {
case 'export':
if (state.sourceType !== 'module') {
tolerateUnexpectedToken(lookahead, Messages.IllegalExportDeclaration);
}
... | javascript | function parseStatementListItem() {
if (lookahead.type === Token.Keyword) {
switch (lookahead.value) {
case 'export':
if (state.sourceType !== 'module') {
tolerateUnexpectedToken(lookahead, Messages.IllegalExportDeclaration);
}
... | [
"function",
"parseStatementListItem",
"(",
")",
"{",
"if",
"(",
"lookahead",
".",
"type",
"===",
"Token",
".",
"Keyword",
")",
"{",
"switch",
"(",
"lookahead",
".",
"value",
")",
"{",
"case",
"'export'",
":",
"if",
"(",
"state",
".",
"sourceType",
"!==",... | ECMA-262 13.2 Block | [
"ECMA",
"-",
"262",
"13",
".",
"2",
"Block"
] | 8a4a1059f060a7100270e837d2759c6a2b9c7e74 | https://github.com/reptilbud/hapi-swagger/blob/8a4a1059f060a7100270e837d2759c6a2b9c7e74/public/swaggerui/swagger-ui.js#L15111-L15138 | train |
reptilbud/hapi-swagger | public/swaggerui/swagger-ui.js | parseLexicalBinding | function parseLexicalBinding(kind, options) {
var init = null, id, node = new Node(), params = [];
id = parsePattern(params, kind);
// ECMA-262 12.2.1
if (strict && id.type === Syntax.Identifier && isRestrictedWord(id.name)) {
tolerateError(Messages.StrictVarName);
... | javascript | function parseLexicalBinding(kind, options) {
var init = null, id, node = new Node(), params = [];
id = parsePattern(params, kind);
// ECMA-262 12.2.1
if (strict && id.type === Syntax.Identifier && isRestrictedWord(id.name)) {
tolerateError(Messages.StrictVarName);
... | [
"function",
"parseLexicalBinding",
"(",
"kind",
",",
"options",
")",
"{",
"var",
"init",
"=",
"null",
",",
"id",
",",
"node",
"=",
"new",
"Node",
"(",
")",
",",
"params",
"=",
"[",
"]",
";",
"id",
"=",
"parsePattern",
"(",
"params",
",",
"kind",
")... | ECMA-262 13.3.1 Let and Const Declarations | [
"ECMA",
"-",
"262",
"13",
".",
"3",
".",
"1",
"Let",
"and",
"Const",
"Declarations"
] | 8a4a1059f060a7100270e837d2759c6a2b9c7e74 | https://github.com/reptilbud/hapi-swagger/blob/8a4a1059f060a7100270e837d2759c6a2b9c7e74/public/swaggerui/swagger-ui.js#L15240-L15261 | train |
reptilbud/hapi-swagger | public/swaggerui/swagger-ui.js | parseIfStatement | function parseIfStatement(node) {
var test, consequent, alternate;
expectKeyword('if');
expect('(');
test = parseExpression();
expect(')');
consequent = parseStatement();
if (matchKeyword('else')) {
lex();
alternate = parseStatement()... | javascript | function parseIfStatement(node) {
var test, consequent, alternate;
expectKeyword('if');
expect('(');
test = parseExpression();
expect(')');
consequent = parseStatement();
if (matchKeyword('else')) {
lex();
alternate = parseStatement()... | [
"function",
"parseIfStatement",
"(",
"node",
")",
"{",
"var",
"test",
",",
"consequent",
",",
"alternate",
";",
"expectKeyword",
"(",
"'if'",
")",
";",
"expect",
"(",
"'('",
")",
";",
"test",
"=",
"parseExpression",
"(",
")",
";",
"expect",
"(",
"')'",
... | ECMA-262 13.6 If statement | [
"ECMA",
"-",
"262",
"13",
".",
"6",
"If",
"statement"
] | 8a4a1059f060a7100270e837d2759c6a2b9c7e74 | https://github.com/reptilbud/hapi-swagger/blob/8a4a1059f060a7100270e837d2759c6a2b9c7e74/public/swaggerui/swagger-ui.js#L15377-L15398 | train |
reptilbud/hapi-swagger | public/swaggerui/swagger-ui.js | parseDoWhileStatement | function parseDoWhileStatement(node) {
var body, test, oldInIteration;
expectKeyword('do');
oldInIteration = state.inIteration;
state.inIteration = true;
body = parseStatement();
state.inIteration = oldInIteration;
expectKeyword('while');
expect('(')... | javascript | function parseDoWhileStatement(node) {
var body, test, oldInIteration;
expectKeyword('do');
oldInIteration = state.inIteration;
state.inIteration = true;
body = parseStatement();
state.inIteration = oldInIteration;
expectKeyword('while');
expect('(')... | [
"function",
"parseDoWhileStatement",
"(",
"node",
")",
"{",
"var",
"body",
",",
"test",
",",
"oldInIteration",
";",
"expectKeyword",
"(",
"'do'",
")",
";",
"oldInIteration",
"=",
"state",
".",
"inIteration",
";",
"state",
".",
"inIteration",
"=",
"true",
";"... | ECMA-262 13.7 Iteration Statements | [
"ECMA",
"-",
"262",
"13",
".",
"7",
"Iteration",
"Statements"
] | 8a4a1059f060a7100270e837d2759c6a2b9c7e74 | https://github.com/reptilbud/hapi-swagger/blob/8a4a1059f060a7100270e837d2759c6a2b9c7e74/public/swaggerui/swagger-ui.js#L15402-L15427 | train |
reptilbud/hapi-swagger | public/swaggerui/swagger-ui.js | parseContinueStatement | function parseContinueStatement(node) {
var label = null, key;
expectKeyword('continue');
// Optimize the most common form: 'continue;'.
if (source.charCodeAt(startIndex) === 0x3B) {
lex();
if (!state.inIteration) {
throwError(Messages.IllegalCo... | javascript | function parseContinueStatement(node) {
var label = null, key;
expectKeyword('continue');
// Optimize the most common form: 'continue;'.
if (source.charCodeAt(startIndex) === 0x3B) {
lex();
if (!state.inIteration) {
throwError(Messages.IllegalCo... | [
"function",
"parseContinueStatement",
"(",
"node",
")",
"{",
"var",
"label",
"=",
"null",
",",
"key",
";",
"expectKeyword",
"(",
"'continue'",
")",
";",
"// Optimize the most common form: 'continue;'.",
"if",
"(",
"source",
".",
"charCodeAt",
"(",
"startIndex",
")... | ECMA-262 13.8 The continue statement | [
"ECMA",
"-",
"262",
"13",
".",
"8",
"The",
"continue",
"statement"
] | 8a4a1059f060a7100270e837d2759c6a2b9c7e74 | https://github.com/reptilbud/hapi-swagger/blob/8a4a1059f060a7100270e837d2759c6a2b9c7e74/public/swaggerui/swagger-ui.js#L15592-L15632 | train |
reptilbud/hapi-swagger | public/swaggerui/swagger-ui.js | parseReturnStatement | function parseReturnStatement(node) {
var argument = null;
expectKeyword('return');
if (!state.inFunctionBody) {
tolerateError(Messages.IllegalReturn);
}
// 'return' followed by a space and an identifier is very common.
if (source.charCodeAt(lastIndex) === ... | javascript | function parseReturnStatement(node) {
var argument = null;
expectKeyword('return');
if (!state.inFunctionBody) {
tolerateError(Messages.IllegalReturn);
}
// 'return' followed by a space and an identifier is very common.
if (source.charCodeAt(lastIndex) === ... | [
"function",
"parseReturnStatement",
"(",
"node",
")",
"{",
"var",
"argument",
"=",
"null",
";",
"expectKeyword",
"(",
"'return'",
")",
";",
"if",
"(",
"!",
"state",
".",
"inFunctionBody",
")",
"{",
"tolerateError",
"(",
"Messages",
".",
"IllegalReturn",
")",... | ECMA-262 13.10 The return statement | [
"ECMA",
"-",
"262",
"13",
".",
"10",
"The",
"return",
"statement"
] | 8a4a1059f060a7100270e837d2759c6a2b9c7e74 | https://github.com/reptilbud/hapi-swagger/blob/8a4a1059f060a7100270e837d2759c6a2b9c7e74/public/swaggerui/swagger-ui.js#L15676-L15708 | train |
reptilbud/hapi-swagger | public/swaggerui/swagger-ui.js | parseWithStatement | function parseWithStatement(node) {
var object, body;
if (strict) {
tolerateError(Messages.StrictModeWith);
}
expectKeyword('with');
expect('(');
object = parseExpression();
expect(')');
body = parseStatement();
return node.finis... | javascript | function parseWithStatement(node) {
var object, body;
if (strict) {
tolerateError(Messages.StrictModeWith);
}
expectKeyword('with');
expect('(');
object = parseExpression();
expect(')');
body = parseStatement();
return node.finis... | [
"function",
"parseWithStatement",
"(",
"node",
")",
"{",
"var",
"object",
",",
"body",
";",
"if",
"(",
"strict",
")",
"{",
"tolerateError",
"(",
"Messages",
".",
"StrictModeWith",
")",
";",
"}",
"expectKeyword",
"(",
"'with'",
")",
";",
"expect",
"(",
"'... | ECMA-262 13.11 The with statement | [
"ECMA",
"-",
"262",
"13",
".",
"11",
"The",
"with",
"statement"
] | 8a4a1059f060a7100270e837d2759c6a2b9c7e74 | https://github.com/reptilbud/hapi-swagger/blob/8a4a1059f060a7100270e837d2759c6a2b9c7e74/public/swaggerui/swagger-ui.js#L15712-L15730 | train |
reptilbud/hapi-swagger | public/swaggerui/swagger-ui.js | parseSwitchCase | function parseSwitchCase() {
var test, consequent = [], statement, node = new Node();
if (matchKeyword('default')) {
lex();
test = null;
} else {
expectKeyword('case');
test = parseExpression();
}
expect(':');
while (start... | javascript | function parseSwitchCase() {
var test, consequent = [], statement, node = new Node();
if (matchKeyword('default')) {
lex();
test = null;
} else {
expectKeyword('case');
test = parseExpression();
}
expect(':');
while (start... | [
"function",
"parseSwitchCase",
"(",
")",
"{",
"var",
"test",
",",
"consequent",
"=",
"[",
"]",
",",
"statement",
",",
"node",
"=",
"new",
"Node",
"(",
")",
";",
"if",
"(",
"matchKeyword",
"(",
"'default'",
")",
")",
"{",
"lex",
"(",
")",
";",
"test... | ECMA-262 13.12 The switch statement | [
"ECMA",
"-",
"262",
"13",
".",
"12",
"The",
"switch",
"statement"
] | 8a4a1059f060a7100270e837d2759c6a2b9c7e74 | https://github.com/reptilbud/hapi-swagger/blob/8a4a1059f060a7100270e837d2759c6a2b9c7e74/public/swaggerui/swagger-ui.js#L15734-L15755 | train |
reptilbud/hapi-swagger | public/swaggerui/swagger-ui.js | parseThrowStatement | function parseThrowStatement(node) {
var argument;
expectKeyword('throw');
if (hasLineTerminator) {
throwError(Messages.NewlineAfterThrow);
}
argument = parseExpression();
consumeSemicolon();
return node.finishThrowStatement(argument);
} | javascript | function parseThrowStatement(node) {
var argument;
expectKeyword('throw');
if (hasLineTerminator) {
throwError(Messages.NewlineAfterThrow);
}
argument = parseExpression();
consumeSemicolon();
return node.finishThrowStatement(argument);
} | [
"function",
"parseThrowStatement",
"(",
"node",
")",
"{",
"var",
"argument",
";",
"expectKeyword",
"(",
"'throw'",
")",
";",
"if",
"(",
"hasLineTerminator",
")",
"{",
"throwError",
"(",
"Messages",
".",
"NewlineAfterThrow",
")",
";",
"}",
"argument",
"=",
"p... | ECMA-262 13.14 The throw statement | [
"ECMA",
"-",
"262",
"13",
".",
"14",
"The",
"throw",
"statement"
] | 8a4a1059f060a7100270e837d2759c6a2b9c7e74 | https://github.com/reptilbud/hapi-swagger/blob/8a4a1059f060a7100270e837d2759c6a2b9c7e74/public/swaggerui/swagger-ui.js#L15804-L15818 | train |
reptilbud/hapi-swagger | public/swaggerui/swagger-ui.js | parseCatchClause | function parseCatchClause() {
var param, params = [], paramMap = {}, key, i, body, node = new Node();
expectKeyword('catch');
expect('(');
if (match(')')) {
throwUnexpectedToken(lookahead);
}
param = parsePattern(params);
for (i = 0; i < params.leng... | javascript | function parseCatchClause() {
var param, params = [], paramMap = {}, key, i, body, node = new Node();
expectKeyword('catch');
expect('(');
if (match(')')) {
throwUnexpectedToken(lookahead);
}
param = parsePattern(params);
for (i = 0; i < params.leng... | [
"function",
"parseCatchClause",
"(",
")",
"{",
"var",
"param",
",",
"params",
"=",
"[",
"]",
",",
"paramMap",
"=",
"{",
"}",
",",
"key",
",",
"i",
",",
"body",
",",
"node",
"=",
"new",
"Node",
"(",
")",
";",
"expectKeyword",
"(",
"'catch'",
")",
... | ECMA-262 13.15 The try statement | [
"ECMA",
"-",
"262",
"13",
".",
"15",
"The",
"try",
"statement"
] | 8a4a1059f060a7100270e837d2759c6a2b9c7e74 | https://github.com/reptilbud/hapi-swagger/blob/8a4a1059f060a7100270e837d2759c6a2b9c7e74/public/swaggerui/swagger-ui.js#L15822-L15849 | train |
reptilbud/hapi-swagger | public/swaggerui/swagger-ui.js | parseFunctionSourceElements | function parseFunctionSourceElements() {
var statement, body = [], token, directive, firstRestricted,
oldLabelSet, oldInIteration, oldInSwitch, oldInFunctionBody, oldParenthesisCount,
node = new Node();
expect('{');
while (startIndex < length) {
if (lookahea... | javascript | function parseFunctionSourceElements() {
var statement, body = [], token, directive, firstRestricted,
oldLabelSet, oldInIteration, oldInSwitch, oldInFunctionBody, oldParenthesisCount,
node = new Node();
expect('{');
while (startIndex < length) {
if (lookahea... | [
"function",
"parseFunctionSourceElements",
"(",
")",
"{",
"var",
"statement",
",",
"body",
"=",
"[",
"]",
",",
"token",
",",
"directive",
",",
"firstRestricted",
",",
"oldLabelSet",
",",
"oldInIteration",
",",
"oldInSwitch",
",",
"oldInFunctionBody",
",",
"oldPa... | ECMA-262 14.1 Function Definition | [
"ECMA",
"-",
"262",
"14",
".",
"1",
"Function",
"Definition"
] | 8a4a1059f060a7100270e837d2759c6a2b9c7e74 | https://github.com/reptilbud/hapi-swagger/blob/8a4a1059f060a7100270e837d2759c6a2b9c7e74/public/swaggerui/swagger-ui.js#L15971-L16031 | train |
reptilbud/hapi-swagger | public/swaggerui/swagger-ui.js | parseModuleSpecifier | function parseModuleSpecifier() {
var node = new Node();
if (lookahead.type !== Token.StringLiteral) {
throwError(Messages.InvalidModuleSpecifier);
}
return node.finishLiteral(lex());
} | javascript | function parseModuleSpecifier() {
var node = new Node();
if (lookahead.type !== Token.StringLiteral) {
throwError(Messages.InvalidModuleSpecifier);
}
return node.finishLiteral(lex());
} | [
"function",
"parseModuleSpecifier",
"(",
")",
"{",
"var",
"node",
"=",
"new",
"Node",
"(",
")",
";",
"if",
"(",
"lookahead",
".",
"type",
"!==",
"Token",
".",
"StringLiteral",
")",
"{",
"throwError",
"(",
"Messages",
".",
"InvalidModuleSpecifier",
")",
";"... | ECMA-262 15.2 Modules | [
"ECMA",
"-",
"262",
"15",
".",
"2",
"Modules"
] | 8a4a1059f060a7100270e837d2759c6a2b9c7e74 | https://github.com/reptilbud/hapi-swagger/blob/8a4a1059f060a7100270e837d2759c6a2b9c7e74/public/swaggerui/swagger-ui.js#L16348-L16355 | train |
reptilbud/hapi-swagger | public/swaggerui/swagger-ui.js | parseScriptBody | function parseScriptBody() {
var statement, body = [], token, directive, firstRestricted;
while (startIndex < length) {
token = lookahead;
if (token.type !== Token.StringLiteral) {
break;
}
statement = parseStatementListItem();
... | javascript | function parseScriptBody() {
var statement, body = [], token, directive, firstRestricted;
while (startIndex < length) {
token = lookahead;
if (token.type !== Token.StringLiteral) {
break;
}
statement = parseStatementListItem();
... | [
"function",
"parseScriptBody",
"(",
")",
"{",
"var",
"statement",
",",
"body",
"=",
"[",
"]",
",",
"token",
",",
"directive",
",",
"firstRestricted",
";",
"while",
"(",
"startIndex",
"<",
"length",
")",
"{",
"token",
"=",
"lookahead",
";",
"if",
"(",
"... | ECMA-262 15.1 Scripts | [
"ECMA",
"-",
"262",
"15",
".",
"1",
"Scripts"
] | 8a4a1059f060a7100270e837d2759c6a2b9c7e74 | https://github.com/reptilbud/hapi-swagger/blob/8a4a1059f060a7100270e837d2759c6a2b9c7e74/public/swaggerui/swagger-ui.js#L16612-L16649 | train |
reptilbud/hapi-swagger | public/swaggerui/swagger-ui.js | function(){
// Initialize the API object
if (this.mainView) {
this.mainView.clear();
}
var url = this.options.url;
if (url && url.indexOf('http') !== 0) {
url = this.buildUrl(window.location.href.toString(), url);
}
if(this.api) {
this.options.authorizations = this.api.clie... | javascript | function(){
// Initialize the API object
if (this.mainView) {
this.mainView.clear();
}
var url = this.options.url;
if (url && url.indexOf('http') !== 0) {
url = this.buildUrl(window.location.href.toString(), url);
}
if(this.api) {
this.options.authorizations = this.api.clie... | [
"function",
"(",
")",
"{",
"// Initialize the API object",
"if",
"(",
"this",
".",
"mainView",
")",
"{",
"this",
".",
"mainView",
".",
"clear",
"(",
")",
";",
"}",
"var",
"url",
"=",
"this",
".",
"options",
".",
"url",
";",
"if",
"(",
"url",
"&&",
... | Create an api and render | [
"Create",
"an",
"api",
"and",
"render"
] | 8a4a1059f060a7100270e837d2759c6a2b9c7e74 | https://github.com/reptilbud/hapi-swagger/blob/8a4a1059f060a7100270e837d2759c6a2b9c7e74/public/swaggerui/swagger-ui.js#L24808-L24824 | train | |
tolokoban/ToloFrameWork | ker/com/x-row/x-row.com.js | flushCurrentCell | function flushCurrentCell() {
if (currentCell.children.length > 0) {
cells.push(currentCell);
currentCell = N.tag("div");
cellsWeights.push(1);
totalWeight++;
}
} | javascript | function flushCurrentCell() {
if (currentCell.children.length > 0) {
cells.push(currentCell);
currentCell = N.tag("div");
cellsWeights.push(1);
totalWeight++;
}
} | [
"function",
"flushCurrentCell",
"(",
")",
"{",
"if",
"(",
"currentCell",
".",
"children",
".",
"length",
">",
"0",
")",
"{",
"cells",
".",
"push",
"(",
"currentCell",
")",
";",
"currentCell",
"=",
"N",
".",
"tag",
"(",
"\"div\"",
")",
";",
"cellsWeight... | Push `currentCell` to `cells` if `currentCell` is not empty. | [
"Push",
"currentCell",
"to",
"cells",
"if",
"currentCell",
"is",
"not",
"empty",
"."
] | 730845a833a9660ebfdb60ad027ebaab5ac871b6 | https://github.com/tolokoban/ToloFrameWork/blob/730845a833a9660ebfdb60ad027ebaab5ac871b6/ker/com/x-row/x-row.com.js#L49-L56 | train |
finvernizzi/mplane_http_transport | ssl_files.js | readFileContent | function readFileContent(fileName){
try{
return(fs.readFileSync(fileName , "utf-8"));
}catch(e){
console.log("---readFileContent-- Error reading file "+fileName);
console.log(e);
return null;
}
} | javascript | function readFileContent(fileName){
try{
return(fs.readFileSync(fileName , "utf-8"));
}catch(e){
console.log("---readFileContent-- Error reading file "+fileName);
console.log(e);
return null;
}
} | [
"function",
"readFileContent",
"(",
"fileName",
")",
"{",
"try",
"{",
"return",
"(",
"fs",
".",
"readFileSync",
"(",
"fileName",
",",
"\"utf-8\"",
")",
")",
";",
"}",
"catch",
"(",
"e",
")",
"{",
"console",
".",
"log",
"(",
"\"---readFileContent-- Error re... | Reads cert and keys
@param fileName (full path)
@returns {*} | [
"Reads",
"cert",
"and",
"keys"
] | 1102d8e1458c3010f3b126b536434114c790b180 | https://github.com/finvernizzi/mplane_http_transport/blob/1102d8e1458c3010f3b126b536434114c790b180/ssl_files.js#L48-L56 | train |
RoboterHund/April1 | modules/output.js | output | function output (consumer, template, params, getDefault) {
return new Output (consumer, template, params, getDefault);
} | javascript | function output (consumer, template, params, getDefault) {
return new Output (consumer, template, params, getDefault);
} | [
"function",
"output",
"(",
"consumer",
",",
"template",
",",
"params",
",",
"getDefault",
")",
"{",
"return",
"new",
"Output",
"(",
"consumer",
",",
"template",
",",
"params",
",",
"getDefault",
")",
";",
"}"
] | output generator constructor wrapper
@param {Consumer} consumer passed to constructor
@param {Array} template passed to constructor
@param {Parameterizer} [params] passed to constructor
@param getDefault
@returns {Output} initialized output generator | [
"output",
"generator",
"constructor",
"wrapper"
] | f4fead4d8190d0b7bdc7b649f4c2c0e9728ef30b | https://github.com/RoboterHund/April1/blob/f4fead4d8190d0b7bdc7b649f4c2c0e9728ef30b/modules/output.js#L44-L46 | train |
itsa/itsa-io | io.js | function (xhr, options, promise) {
console.log(NAME, '_initXHR');
var instance = this,
url = options.url,
method = options.method || GET,
headers = options.headers || {}, // all request will get some headers
async = !options.sync,
... | javascript | function (xhr, options, promise) {
console.log(NAME, '_initXHR');
var instance = this,
url = options.url,
method = options.method || GET,
headers = options.headers || {}, // all request will get some headers
async = !options.sync,
... | [
"function",
"(",
"xhr",
",",
"options",
",",
"promise",
")",
"{",
"console",
".",
"log",
"(",
"NAME",
",",
"'_initXHR'",
")",
";",
"var",
"instance",
"=",
"this",
",",
"url",
"=",
"options",
".",
"url",
",",
"method",
"=",
"options",
".",
"method",
... | Initializes the xhr-instance, based on the config-params.
This method is the standard way of doing xhr-requests without processing streams.
@method _initXHR
@param xhr {Object} xhr-instance
@param options {Object}
@param [options.url] {String} The url to which the request is sent.
@param [options.method='GET'] {String... | [
"Initializes",
"the",
"xhr",
"-",
"instance",
"based",
"on",
"the",
"config",
"-",
"params",
".",
"This",
"method",
"is",
"the",
"standard",
"way",
"of",
"doing",
"xhr",
"-",
"requests",
"without",
"processing",
"streams",
"."
] | 790c77db5cfd3ee953256bfadd60218fb3a5041e | https://github.com/itsa/itsa-io/blob/790c77db5cfd3ee953256bfadd60218fb3a5041e/io.js#L89-L156 | train | |
itsa/itsa-io | io.js | function(xhr, promise, headers, method) {
// XDR cannot set requestheaders, only XHR:
if (!xhr._isXDR) {
console.log(NAME, '_setHeaders');
var name;
if ((method!=='POST') && (method!=='PUT')) {
// force GET-request to make a req... | javascript | function(xhr, promise, headers, method) {
// XDR cannot set requestheaders, only XHR:
if (!xhr._isXDR) {
console.log(NAME, '_setHeaders');
var name;
if ((method!=='POST') && (method!=='PUT')) {
// force GET-request to make a req... | [
"function",
"(",
"xhr",
",",
"promise",
",",
"headers",
",",
"method",
")",
"{",
"// XDR cannot set requestheaders, only XHR:",
"if",
"(",
"!",
"xhr",
".",
"_isXDR",
")",
"{",
"console",
".",
"log",
"(",
"NAME",
",",
"'_setHeaders'",
")",
";",
"var",
"name... | Adds the `headers`-object to `xhr`-headers.
@method _setHeaders
@param xhr {Object} containing the xhr-instance
@param headers {Object} containing all headers
@param method {String} the request-method used
@private | [
"Adds",
"the",
"headers",
"-",
"object",
"to",
"xhr",
"-",
"headers",
"."
] | 790c77db5cfd3ee953256bfadd60218fb3a5041e | https://github.com/itsa/itsa-io/blob/790c77db5cfd3ee953256bfadd60218fb3a5041e/io.js#L167-L186 | train | |
itsa/itsa-io | io.js | function(data) {
var paramArray = [],
key, value;
// TODO: use `object` module
for (key in data) {
value = data[key];
key = ENCODE_URI_COMPONENT(key);
paramArray.push((value === null) ? key : (key + '=' + ENCODE_URI_COMPONEN... | javascript | function(data) {
var paramArray = [],
key, value;
// TODO: use `object` module
for (key in data) {
value = data[key];
key = ENCODE_URI_COMPONENT(key);
paramArray.push((value === null) ? key : (key + '=' + ENCODE_URI_COMPONEN... | [
"function",
"(",
"data",
")",
"{",
"var",
"paramArray",
"=",
"[",
"]",
",",
"key",
",",
"value",
";",
"// TODO: use `object` module",
"for",
"(",
"key",
"in",
"data",
")",
"{",
"value",
"=",
"data",
"[",
"key",
"]",
";",
"key",
"=",
"ENCODE_URI_COMPONE... | Stringifies an object into one string with every pair separated by `&`
@method _toQueryString
@param data {Object} containing key-value pairs
@return {String} stringified presentation of the object, with every pair separated by `&`
@private | [
"Stringifies",
"an",
"object",
"into",
"one",
"string",
"with",
"every",
"pair",
"separated",
"by",
"&"
] | 790c77db5cfd3ee953256bfadd60218fb3a5041e | https://github.com/itsa/itsa-io/blob/790c77db5cfd3ee953256bfadd60218fb3a5041e/io.js#L247-L258 | train | |
ibm-bluemix-mobile-services/bms-monitoring-sdk-node | AnalyticsEventEmitter.js | AnalyticsEventEmitter | function AnalyticsEventEmitter(logger, utils, CONSTANT, onErrorCallback, optionalArguments, serviceName) {
'use strict';
this.logger = logger || {};
this.utils = utils || {};
this.CONSTANT = CONSTANT || {};
optionalArguments = optionalArguments || {};
this.settings = optionalArguments.settings;
this.re... | javascript | function AnalyticsEventEmitter(logger, utils, CONSTANT, onErrorCallback, optionalArguments, serviceName) {
'use strict';
this.logger = logger || {};
this.utils = utils || {};
this.CONSTANT = CONSTANT || {};
optionalArguments = optionalArguments || {};
this.settings = optionalArguments.settings;
this.re... | [
"function",
"AnalyticsEventEmitter",
"(",
"logger",
",",
"utils",
",",
"CONSTANT",
",",
"onErrorCallback",
",",
"optionalArguments",
",",
"serviceName",
")",
"{",
"'use strict'",
";",
"this",
".",
"logger",
"=",
"logger",
"||",
"{",
"}",
";",
"this",
".",
"u... | This is the main class that gets returned by our SDK init method. It contains several public functions intended to be consumed by users of the SDK. Similar to AnalyticsSDK.java for our java SDK. See README.md for detailed documentation. | [
"This",
"is",
"the",
"main",
"class",
"that",
"gets",
"returned",
"by",
"our",
"SDK",
"init",
"method",
".",
"It",
"contains",
"several",
"public",
"functions",
"intended",
"to",
"be",
"consumed",
"by",
"users",
"of",
"the",
"SDK",
".",
"Similar",
"to",
... | 5b26fbd3b8adacb3fa9f4a0cbd60c8eae1a44df9 | https://github.com/ibm-bluemix-mobile-services/bms-monitoring-sdk-node/blob/5b26fbd3b8adacb3fa9f4a0cbd60c8eae1a44df9/AnalyticsEventEmitter.js#L16-L36 | train |
ibm-bluemix-mobile-services/bms-monitoring-sdk-node | AnalyticsEventEmitter.js | function (types) {
that.logger.logEnter('callback in loadEventTypes, types:\n' + JSON.stringify(types));
// The "raw" event type data has a deeply-nested structure and it
// contains a bunch of stuff we're not interested in. We'll just
// store the names of each type's properties.
Object.keys(typ... | javascript | function (types) {
that.logger.logEnter('callback in loadEventTypes, types:\n' + JSON.stringify(types));
// The "raw" event type data has a deeply-nested structure and it
// contains a bunch of stuff we're not interested in. We'll just
// store the names of each type's properties.
Object.keys(typ... | [
"function",
"(",
"types",
")",
"{",
"that",
".",
"logger",
".",
"logEnter",
"(",
"'callback in loadEventTypes, types:\\n'",
"+",
"JSON",
".",
"stringify",
"(",
"types",
")",
")",
";",
"// The \"raw\" event type data has a deeply-nested structure and it",
"// contains a bu... | Get the event types from the analytics repository. | [
"Get",
"the",
"event",
"types",
"from",
"the",
"analytics",
"repository",
"."
] | 5b26fbd3b8adacb3fa9f4a0cbd60c8eae1a44df9 | https://github.com/ibm-bluemix-mobile-services/bms-monitoring-sdk-node/blob/5b26fbd3b8adacb3fa9f4a0cbd60c8eae1a44df9/AnalyticsEventEmitter.js#L61-L84 | train | |
Becklyn/becklyn-gulp | lib/jshint-helper.js | function (filePath, options)
{
gulpUtil.log(gulpUtil.colors.blue("jsHint"), pathHelper.makeRelative(filePath));
var jsHintConfig = jsHintConfigHelper.getRules(xtend({
lookup: false,
esnext: false
}, options));
gulp.src(filePath)
.pipe(plumber())
... | javascript | function (filePath, options)
{
gulpUtil.log(gulpUtil.colors.blue("jsHint"), pathHelper.makeRelative(filePath));
var jsHintConfig = jsHintConfigHelper.getRules(xtend({
lookup: false,
esnext: false
}, options));
gulp.src(filePath)
.pipe(plumber())
... | [
"function",
"(",
"filePath",
",",
"options",
")",
"{",
"gulpUtil",
".",
"log",
"(",
"gulpUtil",
".",
"colors",
".",
"blue",
"(",
"\"jsHint\"",
")",
",",
"pathHelper",
".",
"makeRelative",
"(",
"filePath",
")",
")",
";",
"var",
"jsHintConfig",
"=",
"jsHin... | Lints a given file
@param {string} filePath
@param {{esnext: boolean}} [options] | [
"Lints",
"a",
"given",
"file"
] | 1c633378d561f07101f9db19ccd153617b8e0252 | https://github.com/Becklyn/becklyn-gulp/blob/1c633378d561f07101f9db19ccd153617b8e0252/lib/jshint-helper.js#L20-L33 | train | |
draykcirb/brickyard-webpack | index.js | moveETP2End | function moveETP2End(config) {
if (!ExtractTextPlugin) return
const etps = config.plugins.filter(val => val instanceof ExtractTextPlugin)
_.chain(config.plugins)
.pullAll(etps)
.push(...etps)
.value()
} | javascript | function moveETP2End(config) {
if (!ExtractTextPlugin) return
const etps = config.plugins.filter(val => val instanceof ExtractTextPlugin)
_.chain(config.plugins)
.pullAll(etps)
.push(...etps)
.value()
} | [
"function",
"moveETP2End",
"(",
"config",
")",
"{",
"if",
"(",
"!",
"ExtractTextPlugin",
")",
"return",
"const",
"etps",
"=",
"config",
".",
"plugins",
".",
"filter",
"(",
"val",
"=>",
"val",
"instanceof",
"ExtractTextPlugin",
")",
"_",
".",
"chain",
"(",
... | mutate. The etps should behind CommonsChunkPlugin
@param config | [
"mutate",
".",
"The",
"etps",
"should",
"behind",
"CommonsChunkPlugin"
] | 8b5f3fcc6ca8b8c9fae0c2908b4cc77065155ad6 | https://github.com/draykcirb/brickyard-webpack/blob/8b5f3fcc6ca8b8c9fae0c2908b4cc77065155ad6/index.js#L77-L86 | train |
draykcirb/brickyard-webpack | index.js | defineGlobalVars | function defineGlobalVars(runtimeConfig, isDebug) {
const globals = Object.assign({}, runtimeConfig.globals, {
APP_DEBUG_MODE: isDebug || !!runtimeConfig.debuggable
})
return new webpack.DefinePlugin(globals)
} | javascript | function defineGlobalVars(runtimeConfig, isDebug) {
const globals = Object.assign({}, runtimeConfig.globals, {
APP_DEBUG_MODE: isDebug || !!runtimeConfig.debuggable
})
return new webpack.DefinePlugin(globals)
} | [
"function",
"defineGlobalVars",
"(",
"runtimeConfig",
",",
"isDebug",
")",
"{",
"const",
"globals",
"=",
"Object",
".",
"assign",
"(",
"{",
"}",
",",
"runtimeConfig",
".",
"globals",
",",
"{",
"APP_DEBUG_MODE",
":",
"isDebug",
"||",
"!",
"!",
"runtimeConfig"... | define globals variables for injecting them into source scope
@param runtimeConfig
@param isDebug
@returns {object} | [
"define",
"globals",
"variables",
"for",
"injecting",
"them",
"into",
"source",
"scope"
] | 8b5f3fcc6ca8b8c9fae0c2908b4cc77065155ad6 | https://github.com/draykcirb/brickyard-webpack/blob/8b5f3fcc6ca8b8c9fae0c2908b4cc77065155ad6/index.js#L134-L140 | train |
launchbadge/node-bardo | src/db/execute.js | assertContext | function assertContext() {
return new Promise(function(resolve, reject) {
// Check if we're in an active session
let d = process.domain
if (d == null ||
d.context == null ||
d.context.bardo == null) {
// Begin the session before proceeding
return begin().then((ctx) => {
... | javascript | function assertContext() {
return new Promise(function(resolve, reject) {
// Check if we're in an active session
let d = process.domain
if (d == null ||
d.context == null ||
d.context.bardo == null) {
// Begin the session before proceeding
return begin().then((ctx) => {
... | [
"function",
"assertContext",
"(",
")",
"{",
"return",
"new",
"Promise",
"(",
"function",
"(",
"resolve",
",",
"reject",
")",
"{",
"// Check if we're in an active session",
"let",
"d",
"=",
"process",
".",
"domain",
"if",
"(",
"d",
"==",
"null",
"||",
"d",
... | Assert that we have a database context | [
"Assert",
"that",
"we",
"have",
"a",
"database",
"context"
] | fb790c4529410f79c67a5ecbada318f67b4f808b | https://github.com/launchbadge/node-bardo/blob/fb790c4529410f79c67a5ecbada318f67b4f808b/src/db/execute.js#L8-L24 | train |
launchbadge/node-bardo | src/db/execute.js | execute_ | function execute_(ctx, statement, values) {
return new Promise(function(resolve, reject) {
if (/^begin/i.test(statement)) {
// If this is a `BEGIN` statement; put us in a transaction
ctx.inTransaction = true
} else if (/^(commit|rollback)/i.test(statement)) {
// Else if this is a `COMMIT` or... | javascript | function execute_(ctx, statement, values) {
return new Promise(function(resolve, reject) {
if (/^begin/i.test(statement)) {
// If this is a `BEGIN` statement; put us in a transaction
ctx.inTransaction = true
} else if (/^(commit|rollback)/i.test(statement)) {
// Else if this is a `COMMIT` or... | [
"function",
"execute_",
"(",
"ctx",
",",
"statement",
",",
"values",
")",
"{",
"return",
"new",
"Promise",
"(",
"function",
"(",
"resolve",
",",
"reject",
")",
"{",
"if",
"(",
"/",
"^begin",
"/",
"i",
".",
"test",
"(",
"statement",
")",
")",
"{",
"... | Actually execute the statement | [
"Actually",
"execute",
"the",
"statement"
] | fb790c4529410f79c67a5ecbada318f67b4f808b | https://github.com/launchbadge/node-bardo/blob/fb790c4529410f79c67a5ecbada318f67b4f808b/src/db/execute.js#L44-L91 | train |
Becklyn/becklyn-gulp | tasks/scss.js | issueCountReporter | function issueCountReporter (file)
{
if (!file.scsslint.success)
{
totalIssues += file.scsslint.issues.length;
}
scssLintReporter.defaultReporter(file);
} | javascript | function issueCountReporter (file)
{
if (!file.scsslint.success)
{
totalIssues += file.scsslint.issues.length;
}
scssLintReporter.defaultReporter(file);
} | [
"function",
"issueCountReporter",
"(",
"file",
")",
"{",
"if",
"(",
"!",
"file",
".",
"scsslint",
".",
"success",
")",
"{",
"totalIssues",
"+=",
"file",
".",
"scsslint",
".",
"issues",
".",
"length",
";",
"}",
"scssLintReporter",
".",
"defaultReporter",
"(... | Wraps the default SCSS Lint Reporter and
counts the total amount of issues
@param {{
scsslint: {
success: bool,
errors: int,
warnings: int,
issues: Array.<{
line: int,
column: int,
severity: string,
reason: string,
}>
}}} file | [
"Wraps",
"the",
"default",
"SCSS",
"Lint",
"Reporter",
"and",
"counts",
"the",
"total",
"amount",
"of",
"issues"
] | 1c633378d561f07101f9db19ccd153617b8e0252 | https://github.com/Becklyn/becklyn-gulp/blob/1c633378d561f07101f9db19ccd153617b8e0252/tasks/scss.js#L48-L56 | train |
Becklyn/becklyn-gulp | tasks/scss.js | compileSingleFile | function compileSingleFile (filePath, isDebug, options)
{
var outputPath = "./" + path.dirname(filePath).replace("assets/scss", "public/css");
gulpUtil.log(gulpUtil.colors.blue("Sass"), pathHelper.makeRelative(filePath), " -> ", outputPath + "/" + path.basename(filePath).replace(/\.scss$/, ".css"));
var in... | javascript | function compileSingleFile (filePath, isDebug, options)
{
var outputPath = "./" + path.dirname(filePath).replace("assets/scss", "public/css");
gulpUtil.log(gulpUtil.colors.blue("Sass"), pathHelper.makeRelative(filePath), " -> ", outputPath + "/" + path.basename(filePath).replace(/\.scss$/, ".css"));
var in... | [
"function",
"compileSingleFile",
"(",
"filePath",
",",
"isDebug",
",",
"options",
")",
"{",
"var",
"outputPath",
"=",
"\"./\"",
"+",
"path",
".",
"dirname",
"(",
"filePath",
")",
".",
"replace",
"(",
"\"assets/scss\"",
",",
"\"public/css\"",
")",
";",
"gulpU... | Compiles a single Sass file
@param {string} filePath
@param {boolean} isDebug
@param {SassTaskOptions} options
@returns {*} | [
"Compiles",
"a",
"single",
"Sass",
"file"
] | 1c633378d561f07101f9db19ccd153617b8e0252 | https://github.com/Becklyn/becklyn-gulp/blob/1c633378d561f07101f9db19ccd153617b8e0252/tasks/scss.js#L87-L124 | train |
Becklyn/becklyn-gulp | tasks/scss.js | lintFiles | function lintFiles (src)
{
gulp.src(src)
.pipe(scssLint({
config: __dirname + "/../config/scss-lint.yml",
customReport: issueCountReporter
}))
.on('error', function (error)
{
gulpUtil.log(gulpUtil.colors.red('An error has occurred while executing s... | javascript | function lintFiles (src)
{
gulp.src(src)
.pipe(scssLint({
config: __dirname + "/../config/scss-lint.yml",
customReport: issueCountReporter
}))
.on('error', function (error)
{
gulpUtil.log(gulpUtil.colors.red('An error has occurred while executing s... | [
"function",
"lintFiles",
"(",
"src",
")",
"{",
"gulp",
".",
"src",
"(",
"src",
")",
".",
"pipe",
"(",
"scssLint",
"(",
"{",
"config",
":",
"__dirname",
"+",
"\"/../config/scss-lint.yml\"",
",",
"customReport",
":",
"issueCountReporter",
"}",
")",
")",
".",... | Lints the given files
@param {string} src | [
"Lints",
"the",
"given",
"files"
] | 1c633378d561f07101f9db19ccd153617b8e0252 | https://github.com/Becklyn/becklyn-gulp/blob/1c633378d561f07101f9db19ccd153617b8e0252/tasks/scss.js#L133-L145 | train |
Becklyn/becklyn-gulp | tasks/scss.js | startWatcherForLinting | function startWatcherForLinting (src)
{
watch(src,
function (file)
{
if (file.path)
{
lintFiles(file.path);
}
}
);
} | javascript | function startWatcherForLinting (src)
{
watch(src,
function (file)
{
if (file.path)
{
lintFiles(file.path);
}
}
);
} | [
"function",
"startWatcherForLinting",
"(",
"src",
")",
"{",
"watch",
"(",
"src",
",",
"function",
"(",
"file",
")",
"{",
"if",
"(",
"file",
".",
"path",
")",
"{",
"lintFiles",
"(",
"file",
".",
"path",
")",
";",
"}",
"}",
")",
";",
"}"
] | Starts a watcher that lints the changed files
@param {string} src | [
"Starts",
"a",
"watcher",
"that",
"lints",
"the",
"changed",
"files"
] | 1c633378d561f07101f9db19ccd153617b8e0252 | https://github.com/Becklyn/becklyn-gulp/blob/1c633378d561f07101f9db19ccd153617b8e0252/tasks/scss.js#L153-L164 | train |
Becklyn/becklyn-gulp | tasks/scss.js | compileAllFiles | function compileAllFiles (src, isDebug, options)
{
glob(src,
function (err, files)
{
if (err) throw err;
for (var i = 0, l = files.length; i < l; i++)
{
// only start compilation at root files
if (sassHelpers.isRootFile(files[i]))
... | javascript | function compileAllFiles (src, isDebug, options)
{
glob(src,
function (err, files)
{
if (err) throw err;
for (var i = 0, l = files.length; i < l; i++)
{
// only start compilation at root files
if (sassHelpers.isRootFile(files[i]))
... | [
"function",
"compileAllFiles",
"(",
"src",
",",
"isDebug",
",",
"options",
")",
"{",
"glob",
"(",
"src",
",",
"function",
"(",
"err",
",",
"files",
")",
"{",
"if",
"(",
"err",
")",
"throw",
"err",
";",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"l",
... | Compiles all files in the given selector
@param {string} src all what is accepted by glob
@param {bool} isDebug
@param {SassTaskOptions} options | [
"Compiles",
"all",
"files",
"in",
"the",
"given",
"selector"
] | 1c633378d561f07101f9db19ccd153617b8e0252 | https://github.com/Becklyn/becklyn-gulp/blob/1c633378d561f07101f9db19ccd153617b8e0252/tasks/scss.js#L175-L192 | train |
novadiscovery/nway | lib/parser.js | makeModule | function makeModule(index) {
var stored, src, srcPath, relpath;
// Prepare module
var module = new Module({
uid: index
,req: []
,path: index
,relpath: null
,isNodeModule: false
,isAsyncModule: arequirePath === index
,arequirePath: arequirePath
,index: index
});
if(~modul... | javascript | function makeModule(index) {
var stored, src, srcPath, relpath;
// Prepare module
var module = new Module({
uid: index
,req: []
,path: index
,relpath: null
,isNodeModule: false
,isAsyncModule: arequirePath === index
,arequirePath: arequirePath
,index: index
});
if(~modul... | [
"function",
"makeModule",
"(",
"index",
")",
"{",
"var",
"stored",
",",
"src",
",",
"srcPath",
",",
"relpath",
";",
"// Prepare module",
"var",
"module",
"=",
"new",
"Module",
"(",
"{",
"uid",
":",
"index",
",",
"req",
":",
"[",
"]",
",",
"path",
":"... | Create a module object for the index receives an absolute filepath to parse, and return a new Module object | [
"Create",
"a",
"module",
"object",
"for",
"the",
"index",
"receives",
"an",
"absolute",
"filepath",
"to",
"parse",
"and",
"return",
"a",
"new",
"Module",
"object"
] | fa31c6fe56f2305721e581ac25e8ac9a87e15dda | https://github.com/novadiscovery/nway/blob/fa31c6fe56f2305721e581ac25e8ac9a87e15dda/lib/parser.js#L140-L219 | train |
bucharest-gold/unifiedpush-admin-client | lib/installations.js | update | function update (client) {
return function update (options) {
options = options || {};
const req = {
url: `${client.baseUrl}/rest/applications/${options.variantId}/installations/${options.installation.id}`,
body: options.installation,
method: 'PUT'
};
return request(client, req)
... | javascript | function update (client) {
return function update (options) {
options = options || {};
const req = {
url: `${client.baseUrl}/rest/applications/${options.variantId}/installations/${options.installation.id}`,
body: options.installation,
method: 'PUT'
};
return request(client, req)
... | [
"function",
"update",
"(",
"client",
")",
"{",
"return",
"function",
"update",
"(",
"options",
")",
"{",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"const",
"req",
"=",
"{",
"url",
":",
"`",
"${",
"client",
".",
"baseUrl",
"}",
"${",
"options",
... | A function to update an existing installation.
@param {object} options - An options object that is the JSON representation of the Variant to Update
@param {string} options.variantId - The id of the push application
@param {object} options.installation - the installation object
@param {string} options.installation.id - ... | [
"A",
"function",
"to",
"update",
"an",
"existing",
"installation",
"."
] | a39c98c9a383d7f87cb5cbbc25c4371ea1ad049e | https://github.com/bucharest-gold/unifiedpush-admin-client/blob/a39c98c9a383d7f87cb5cbbc25c4371ea1ad049e/lib/installations.js#L73-L91 | train |
Nazariglez/perenquen | lib/pixi/src/core/textures/BaseTexture.js | BaseTexture | function BaseTexture(source, scaleMode, resolution)
{
EventEmitter.call(this);
this.uuid = utils.uuid();
/**
* The Resolution of the texture.
*
* @member {number}
*/
this.resolution = resolution || 1;
/**
* The width of the base texture set when the image has loaded
... | javascript | function BaseTexture(source, scaleMode, resolution)
{
EventEmitter.call(this);
this.uuid = utils.uuid();
/**
* The Resolution of the texture.
*
* @member {number}
*/
this.resolution = resolution || 1;
/**
* The width of the base texture set when the image has loaded
... | [
"function",
"BaseTexture",
"(",
"source",
",",
"scaleMode",
",",
"resolution",
")",
"{",
"EventEmitter",
".",
"call",
"(",
"this",
")",
";",
"this",
".",
"uuid",
"=",
"utils",
".",
"uuid",
"(",
")",
";",
"/**\n * The Resolution of the texture.\n *\n ... | A texture stores the information that represents an image. All textures have a base texture.
@class
@memberof PIXI
@param source {Image|Canvas} the source object of the texture.
@param [scaleMode=scaleModes.DEFAULT] {number} See {@link SCALE_MODES} for possible values
@param resolution {number} the resolution of the t... | [
"A",
"texture",
"stores",
"the",
"information",
"that",
"represents",
"an",
"image",
".",
"All",
"textures",
"have",
"a",
"base",
"texture",
"."
] | e023964d05afeefebdcac4e2044819fdfa3899ae | https://github.com/Nazariglez/perenquen/blob/e023964d05afeefebdcac4e2044819fdfa3899ae/lib/pixi/src/core/textures/BaseTexture.js#L14-L160 | 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.