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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
tjmehta/validate-reql | lib/validate-reql.js | validateReQL | function validateReQL (reql, reqlOpts, whitelist) {
var args = assertArgs(arguments, {
'reql': '*',
'[reqlOpts]': 'object',
'whitelist': 'array'
})
reql = args.reql
reqlOpts = args.reqlOpts
whitelist = args.whitelist
var firstErr
var errCount = 0
var promises = whitelist.map(function (reqlVa... | javascript | function validateReQL (reql, reqlOpts, whitelist) {
var args = assertArgs(arguments, {
'reql': '*',
'[reqlOpts]': 'object',
'whitelist': 'array'
})
reql = args.reql
reqlOpts = args.reqlOpts
whitelist = args.whitelist
var firstErr
var errCount = 0
var promises = whitelist.map(function (reqlVa... | [
"function",
"validateReQL",
"(",
"reql",
",",
"reqlOpts",
",",
"whitelist",
")",
"{",
"var",
"args",
"=",
"assertArgs",
"(",
"arguments",
",",
"{",
"'reql'",
":",
"'*'",
",",
"'[reqlOpts]'",
":",
"'object'",
",",
"'whitelist'",
":",
"'array'",
"}",
")",
... | validate reql and reql opts
@param {Object} reql rethinkdb query reql
@param {Object} [reqlOpts] rethinkdb reql opts
@param {Array} whitelist reql validators/queries
@return {Promise.<Boolean>} isValid promise | [
"validate",
"reql",
"and",
"reql",
"opts"
] | e510f5202e3ef0188a0632fff617c69940083785 | https://github.com/tjmehta/validate-reql/blob/e510f5202e3ef0188a0632fff617c69940083785/lib/validate-reql.js#L22-L47 | train |
sendanor/nor-rest | src/request.js | do_plain | function do_plain(url, opts) {
opts = do_args(url, opts);
if(opts.redirect_loop_counter === undefined) {
opts.redirect_loop_counter = 10;
}
var buffer;
var d = Q.defer();
var req = require(opts.protocol).request(opts.url, function(res) {
var buffer = "";
res.setEncoding('utf8');
function collect_chunks(ch... | javascript | function do_plain(url, opts) {
opts = do_args(url, opts);
if(opts.redirect_loop_counter === undefined) {
opts.redirect_loop_counter = 10;
}
var buffer;
var d = Q.defer();
var req = require(opts.protocol).request(opts.url, function(res) {
var buffer = "";
res.setEncoding('utf8');
function collect_chunks(ch... | [
"function",
"do_plain",
"(",
"url",
",",
"opts",
")",
"{",
"opts",
"=",
"do_args",
"(",
"url",
",",
"opts",
")",
";",
"if",
"(",
"opts",
".",
"redirect_loop_counter",
"===",
"undefined",
")",
"{",
"opts",
".",
"redirect_loop_counter",
"=",
"10",
";",
"... | Performs generic request | [
"Performs",
"generic",
"request"
] | b2571e689c7a7e5129e361a7c66c7e5e946d4ca1 | https://github.com/sendanor/nor-rest/blob/b2571e689c7a7e5129e361a7c66c7e5e946d4ca1/src/request.js#L55-L118 | train |
sendanor/nor-rest | src/request.js | do_js | function do_js(url, opts) {
opts = opts || {};
if(is.object(opts) && is['function'](opts.body)) {
opts.body = FUNCTION(opts.body).stringify();
} else if(is.object(opts) && is.string(opts.body)) {
} else {
throw new TypeError('opts.body is not function nor string');
}
opts.headers = opts.headers || {};
if(opt... | javascript | function do_js(url, opts) {
opts = opts || {};
if(is.object(opts) && is['function'](opts.body)) {
opts.body = FUNCTION(opts.body).stringify();
} else if(is.object(opts) && is.string(opts.body)) {
} else {
throw new TypeError('opts.body is not function nor string');
}
opts.headers = opts.headers || {};
if(opt... | [
"function",
"do_js",
"(",
"url",
",",
"opts",
")",
"{",
"opts",
"=",
"opts",
"||",
"{",
"}",
";",
"if",
"(",
"is",
".",
"object",
"(",
"opts",
")",
"&&",
"is",
"[",
"'function'",
"]",
"(",
"opts",
".",
"body",
")",
")",
"{",
"opts",
".",
"bod... | JavaScript function request | [
"JavaScript",
"function",
"request"
] | b2571e689c7a7e5129e361a7c66c7e5e946d4ca1 | https://github.com/sendanor/nor-rest/blob/b2571e689c7a7e5129e361a7c66c7e5e946d4ca1/src/request.js#L137-L159 | train |
rmariuzzo/entrify | index.js | entrify | function entrify(dir, options = {}) {
if (!dir) {
throw new Error('the path is required')
}
if (typeof dir !== 'string') {
throw new Error('the path must be a string')
}
options = Object.assign({}, defaults, options)
return entrifyFromPkg(dir, options)
} | javascript | function entrify(dir, options = {}) {
if (!dir) {
throw new Error('the path is required')
}
if (typeof dir !== 'string') {
throw new Error('the path must be a string')
}
options = Object.assign({}, defaults, options)
return entrifyFromPkg(dir, options)
} | [
"function",
"entrify",
"(",
"dir",
",",
"options",
"=",
"{",
"}",
")",
"{",
"if",
"(",
"!",
"dir",
")",
"{",
"throw",
"new",
"Error",
"(",
"'the path is required'",
")",
"}",
"if",
"(",
"typeof",
"dir",
"!==",
"'string'",
")",
"{",
"throw",
"new",
... | Entrify a path.
@param {String} dir The path.
@param {Object} options Hash of options. | [
"Entrify",
"a",
"path",
"."
] | cd3f67fea55a78f95ae168cd66c9173d36a446a8 | https://github.com/rmariuzzo/entrify/blob/cd3f67fea55a78f95ae168cd66c9173d36a446a8/index.js#L33-L47 | train |
rmariuzzo/entrify | index.js | entrifyFromPkg | function entrifyFromPkg(dir, options) {
// Find package.json files.
const pkgPaths = glob.sync('**/package.json', { cwd: dir, nodir: true, absolute: true })
pkgPaths.forEach((pkgPath) => {
console.log('[entrify]', 'Found:', pkgPath)
const pkg = require(pkgPath)
// A package.json file should have a ... | javascript | function entrifyFromPkg(dir, options) {
// Find package.json files.
const pkgPaths = glob.sync('**/package.json', { cwd: dir, nodir: true, absolute: true })
pkgPaths.forEach((pkgPath) => {
console.log('[entrify]', 'Found:', pkgPath)
const pkg = require(pkgPath)
// A package.json file should have a ... | [
"function",
"entrifyFromPkg",
"(",
"dir",
",",
"options",
")",
"{",
"// Find package.json files.",
"const",
"pkgPaths",
"=",
"glob",
".",
"sync",
"(",
"'**/package.json'",
",",
"{",
"cwd",
":",
"dir",
",",
"nodir",
":",
"true",
",",
"absolute",
":",
"true",
... | Entrify a directory by creating an index.js file when a valid package.json is found.
@param {String} dir The directory to entrify.
@param {Object} options Hash of options. | [
"Entrify",
"a",
"directory",
"by",
"creating",
"an",
"index",
".",
"js",
"file",
"when",
"a",
"valid",
"package",
".",
"json",
"is",
"found",
"."
] | cd3f67fea55a78f95ae168cd66c9173d36a446a8 | https://github.com/rmariuzzo/entrify/blob/cd3f67fea55a78f95ae168cd66c9173d36a446a8/index.js#L55-L96 | train |
rmariuzzo/entrify | index.js | indexTemplate | function indexTemplate(format, data) {
if (format === 'cjs') {
return `module.exports = require('${data.main}')`
}
if (format === 'esm') {
return `import ${data.name} from '${data.main}'
export default ${data.name}`
}
} | javascript | function indexTemplate(format, data) {
if (format === 'cjs') {
return `module.exports = require('${data.main}')`
}
if (format === 'esm') {
return `import ${data.name} from '${data.main}'
export default ${data.name}`
}
} | [
"function",
"indexTemplate",
"(",
"format",
",",
"data",
")",
"{",
"if",
"(",
"format",
"===",
"'cjs'",
")",
"{",
"return",
"`",
"${",
"data",
".",
"main",
"}",
"`",
"}",
"if",
"(",
"format",
"===",
"'esm'",
")",
"{",
"return",
"`",
"${",
"data",
... | Utility functions.
@private
Create contents for an index.js file.
@param {String} format The format to use. 'cjs' or 'esm'.
@param {Object} data The data to use as part of the template. | [
"Utility",
"functions",
"."
] | cd3f67fea55a78f95ae168cd66c9173d36a446a8 | https://github.com/rmariuzzo/entrify/blob/cd3f67fea55a78f95ae168cd66c9173d36a446a8/index.js#L109-L118 | train |
rmariuzzo/entrify | index.js | camelize | function camelize(str) {
return str.replace(/(?:^\w|[A-Z]|\b\w)/g, (letter, index) => {
return index === 0 ? letter.toLowerCase() : letter.toUpperCase()
}).replace(/[\s\-_]+/g, '')
} | javascript | function camelize(str) {
return str.replace(/(?:^\w|[A-Z]|\b\w)/g, (letter, index) => {
return index === 0 ? letter.toLowerCase() : letter.toUpperCase()
}).replace(/[\s\-_]+/g, '')
} | [
"function",
"camelize",
"(",
"str",
")",
"{",
"return",
"str",
".",
"replace",
"(",
"/",
"(?:^\\w|[A-Z]|\\b\\w)",
"/",
"g",
",",
"(",
"letter",
",",
"index",
")",
"=>",
"{",
"return",
"index",
"===",
"0",
"?",
"letter",
".",
"toLowerCase",
"(",
")",
... | Convert a string to camelCase.
@param {String} str The string to camelize.
@return {String} The camelized version of the provided string. | [
"Convert",
"a",
"string",
"to",
"camelCase",
"."
] | cd3f67fea55a78f95ae168cd66c9173d36a446a8 | https://github.com/rmariuzzo/entrify/blob/cd3f67fea55a78f95ae168cd66c9173d36a446a8/index.js#L126-L130 | train |
me-ventures/microservice-toolkit | src/swagger/corsMiddleware.js | getOperationResponseHeaders | function getOperationResponseHeaders(operation) {
var headers = [];
if (operation) {
_.each(operation.responses, function(response, responseCode) {
// Convert responseCode to a numeric value for sorting ("default" comes last)
responseCode = parseInt(responseCode) || 999;
... | javascript | function getOperationResponseHeaders(operation) {
var headers = [];
if (operation) {
_.each(operation.responses, function(response, responseCode) {
// Convert responseCode to a numeric value for sorting ("default" comes last)
responseCode = parseInt(responseCode) || 999;
... | [
"function",
"getOperationResponseHeaders",
"(",
"operation",
")",
"{",
"var",
"headers",
"=",
"[",
"]",
";",
"if",
"(",
"operation",
")",
"{",
"_",
".",
"each",
"(",
"operation",
".",
"responses",
",",
"function",
"(",
"response",
",",
"responseCode",
")",... | Returns all response headers for the given Swagger operation, sorted by HTTP response code.
@param {object} operation - The Operation object from the Swagger API
@returns {{responseCode: integer, name: string, value: string}[]} | [
"Returns",
"all",
"response",
"headers",
"for",
"the",
"given",
"Swagger",
"operation",
"sorted",
"by",
"HTTP",
"response",
"code",
"."
] | 9aedc9542dffdc274a5142515bd22e92833220d2 | https://github.com/me-ventures/microservice-toolkit/blob/9aedc9542dffdc274a5142515bd22e92833220d2/src/swagger/corsMiddleware.js#L141-L163 | train |
wunderbyte/grunt-spiritual-edbml | src/header.js | cast | function cast(string) {
var result = String(string);
switch (result) {
case 'null':
result = null;
break;
case 'true':
case 'false':
result = result === 'true';
break;
default:
if (String(parseInt(result, 10)) === result) {
result = parseInt(result, 10);
} else if (String(parseFloat(resu... | javascript | function cast(string) {
var result = String(string);
switch (result) {
case 'null':
result = null;
break;
case 'true':
case 'false':
result = result === 'true';
break;
default:
if (String(parseInt(result, 10)) === result) {
result = parseInt(result, 10);
} else if (String(parseFloat(resu... | [
"function",
"cast",
"(",
"string",
")",
"{",
"var",
"result",
"=",
"String",
"(",
"string",
")",
";",
"switch",
"(",
"result",
")",
"{",
"case",
"'null'",
":",
"result",
"=",
"null",
";",
"break",
";",
"case",
"'true'",
":",
"case",
"'false'",
":",
... | Autocast string to an inferred type. "123" returns a number
while "true" and false" return a boolean. Empty string evals
to `true` in order to support HTML attribute minimization.
@param {string} string
@returns {object} | [
"Autocast",
"string",
"to",
"an",
"inferred",
"type",
".",
"123",
"returns",
"a",
"number",
"while",
"true",
"and",
"false",
"return",
"a",
"boolean",
".",
"Empty",
"string",
"evals",
"to",
"true",
"in",
"order",
"to",
"support",
"HTML",
"attribute",
"mini... | 2ba0aa8042eceee917f1ee48c7881345df3bce46 | https://github.com/wunderbyte/grunt-spiritual-edbml/blob/2ba0aa8042eceee917f1ee48c7881345df3bce46/src/header.js#L23-L42 | train |
moov2/grunt-orchard-development | tasks/remove-modules.js | function (srcpath) {
return fs.readdirSync(srcpath).filter(function(file) {
return fs.statSync(path.join(srcpath, file)).isDirectory();
});
} | javascript | function (srcpath) {
return fs.readdirSync(srcpath).filter(function(file) {
return fs.statSync(path.join(srcpath, file)).isDirectory();
});
} | [
"function",
"(",
"srcpath",
")",
"{",
"return",
"fs",
".",
"readdirSync",
"(",
"srcpath",
")",
".",
"filter",
"(",
"function",
"(",
"file",
")",
"{",
"return",
"fs",
".",
"statSync",
"(",
"path",
".",
"join",
"(",
"srcpath",
",",
"file",
")",
")",
... | Returns directories inside the directory associated to the provided path. | [
"Returns",
"directories",
"inside",
"the",
"directory",
"associated",
"to",
"the",
"provided",
"path",
"."
] | 658c5bae73f894469d099a7c2d735f9cda08d0cc | https://github.com/moov2/grunt-orchard-development/blob/658c5bae73f894469d099a7c2d735f9cda08d0cc/tasks/remove-modules.js#L26-L30 | train | |
moov2/grunt-orchard-development | tasks/remove-modules.js | function (csprojFilePath, success, error) {
var parser = new xml2js.Parser(),
projectGuid;
fs.readFile(csprojFilePath, function(err, data) {
if (typeof(data) !== 'undefined') {
parser.parseString(data, function (err, result) {
... | javascript | function (csprojFilePath, success, error) {
var parser = new xml2js.Parser(),
projectGuid;
fs.readFile(csprojFilePath, function(err, data) {
if (typeof(data) !== 'undefined') {
parser.parseString(data, function (err, result) {
... | [
"function",
"(",
"csprojFilePath",
",",
"success",
",",
"error",
")",
"{",
"var",
"parser",
"=",
"new",
"xml2js",
".",
"Parser",
"(",
")",
",",
"projectGuid",
";",
"fs",
".",
"readFile",
"(",
"csprojFilePath",
",",
"function",
"(",
"err",
",",
"data",
... | Extracts the project GUID from the provided .csproj file. | [
"Extracts",
"the",
"project",
"GUID",
"from",
"the",
"provided",
".",
"csproj",
"file",
"."
] | 658c5bae73f894469d099a7c2d735f9cda08d0cc | https://github.com/moov2/grunt-orchard-development/blob/658c5bae73f894469d099a7c2d735f9cda08d0cc/tasks/remove-modules.js#L35-L54 | train | |
moov2/grunt-orchard-development | tasks/remove-modules.js | function () {
fs.writeFile(solutionFile, solutionFileContents, function(err) {
if (err) {
grunt.fail.warning('Failed to update solution file.');
}
done();
});
} | javascript | function () {
fs.writeFile(solutionFile, solutionFileContents, function(err) {
if (err) {
grunt.fail.warning('Failed to update solution file.');
}
done();
});
} | [
"function",
"(",
")",
"{",
"fs",
".",
"writeFile",
"(",
"solutionFile",
",",
"solutionFileContents",
",",
"function",
"(",
"err",
")",
"{",
"if",
"(",
"err",
")",
"{",
"grunt",
".",
"fail",
".",
"warning",
"(",
"'Failed to update solution file.'",
")",
";"... | Writes the update contents of the solution to file. | [
"Writes",
"the",
"update",
"contents",
"of",
"the",
"solution",
"to",
"file",
"."
] | 658c5bae73f894469d099a7c2d735f9cda08d0cc | https://github.com/moov2/grunt-orchard-development/blob/658c5bae73f894469d099a7c2d735f9cda08d0cc/tasks/remove-modules.js#L84-L92 | train | |
tgi-io/tgi-store-json-file | dist/tgi-store-json-file.spec.js | storeActors | function storeActors() {
test.actorsStored = 0;
for (var i = 0; i < test.actorsInfo.length; i++) {
test.actor.set('ID', null);
test.actor.set('name', test.actorsInfo[i][0]);
test.actor.set('born', test.actorsInfo[i][1]);
test.actor.set('isMale', test.actorsInfo[i][2]);
... | javascript | function storeActors() {
test.actorsStored = 0;
for (var i = 0; i < test.actorsInfo.length; i++) {
test.actor.set('ID', null);
test.actor.set('name', test.actorsInfo[i][0]);
test.actor.set('born', test.actorsInfo[i][1]);
test.actor.set('isMale', test.actorsInfo[i][2]);
... | [
"function",
"storeActors",
"(",
")",
"{",
"test",
".",
"actorsStored",
"=",
"0",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"test",
".",
"actorsInfo",
".",
"length",
";",
"i",
"++",
")",
"{",
"test",
".",
"actor",
".",
"set",
"(",
"'... | callback after model cleaned now, build List and add to store | [
"callback",
"after",
"model",
"cleaned",
"now",
"build",
"List",
"and",
"add",
"to",
"store"
] | 21f5c4164326c5e80989f19413d26ba591f362ac | https://github.com/tgi-io/tgi-store-json-file/blob/21f5c4164326c5e80989f19413d26ba591f362ac/dist/tgi-store-json-file.spec.js#L1617-L1626 | train |
tgi-io/tgi-store-json-file | dist/tgi-store-json-file.spec.js | actorStored | function actorStored(model, error) {
if (typeof error != 'undefined') {
callback(error);
return;
}
if (++test.actorsStored >= test.actorsInfo.length) {
getAllActors();
}
} | javascript | function actorStored(model, error) {
if (typeof error != 'undefined') {
callback(error);
return;
}
if (++test.actorsStored >= test.actorsInfo.length) {
getAllActors();
}
} | [
"function",
"actorStored",
"(",
"model",
",",
"error",
")",
"{",
"if",
"(",
"typeof",
"error",
"!=",
"'undefined'",
")",
"{",
"callback",
"(",
"error",
")",
";",
"return",
";",
"}",
"if",
"(",
"++",
"test",
".",
"actorsStored",
">=",
"test",
".",
"ac... | callback after actor stored | [
"callback",
"after",
"actor",
"stored"
] | 21f5c4164326c5e80989f19413d26ba591f362ac | https://github.com/tgi-io/tgi-store-json-file/blob/21f5c4164326c5e80989f19413d26ba591f362ac/dist/tgi-store-json-file.spec.js#L1629-L1637 | train |
tgi-io/tgi-store-json-file | dist/tgi-store-json-file.spec.js | getAllActors | function getAllActors() {
try {
storeBeingTested.getList(test.list, {}, function (list, error) {
if (typeof error != 'undefined') {
callback(error);
return;
}
test.shouldBeTrue(list._items.length == 20, '20');
getTomHanks();
});
... | javascript | function getAllActors() {
try {
storeBeingTested.getList(test.list, {}, function (list, error) {
if (typeof error != 'undefined') {
callback(error);
return;
}
test.shouldBeTrue(list._items.length == 20, '20');
getTomHanks();
});
... | [
"function",
"getAllActors",
"(",
")",
"{",
"try",
"{",
"storeBeingTested",
".",
"getList",
"(",
"test",
".",
"list",
",",
"{",
"}",
",",
"function",
"(",
"list",
",",
"error",
")",
"{",
"if",
"(",
"typeof",
"error",
"!=",
"'undefined'",
")",
"{",
"ca... | test getting all 20 | [
"test",
"getting",
"all",
"20"
] | 21f5c4164326c5e80989f19413d26ba591f362ac | https://github.com/tgi-io/tgi-store-json-file/blob/21f5c4164326c5e80989f19413d26ba591f362ac/dist/tgi-store-json-file.spec.js#L1640-L1654 | train |
tgi-io/tgi-store-json-file | dist/tgi-store-json-file.spec.js | getTomHanks | function getTomHanks() {
try {
storeBeingTested.getList(test.list, {name: "Tom Hanks"}, function (list, error) {
if (typeof error != 'undefined') {
callback(error);
return;
}
test.shouldBeTrue(list._items.length == 1, ('1 not ' + list._items.length));
... | javascript | function getTomHanks() {
try {
storeBeingTested.getList(test.list, {name: "Tom Hanks"}, function (list, error) {
if (typeof error != 'undefined') {
callback(error);
return;
}
test.shouldBeTrue(list._items.length == 1, ('1 not ' + list._items.length));
... | [
"function",
"getTomHanks",
"(",
")",
"{",
"try",
"{",
"storeBeingTested",
".",
"getList",
"(",
"test",
".",
"list",
",",
"{",
"name",
":",
"\"Tom Hanks\"",
"}",
",",
"function",
"(",
"list",
",",
"error",
")",
"{",
"if",
"(",
"typeof",
"error",
"!=",
... | only one Tom Hanks | [
"only",
"one",
"Tom",
"Hanks"
] | 21f5c4164326c5e80989f19413d26ba591f362ac | https://github.com/tgi-io/tgi-store-json-file/blob/21f5c4164326c5e80989f19413d26ba591f362ac/dist/tgi-store-json-file.spec.js#L1657-L1671 | train |
tgi-io/tgi-store-json-file | dist/tgi-store-json-file.spec.js | getAlphabetical | function getAlphabetical() {
try {
storeBeingTested.getList(test.list, {}, {name: 1}, function (list, error) {
if (typeof error != 'undefined') {
callback(error);
return;
}
// Verify each move returns true when move succeeds
test.shouldBeTrue... | javascript | function getAlphabetical() {
try {
storeBeingTested.getList(test.list, {}, {name: 1}, function (list, error) {
if (typeof error != 'undefined') {
callback(error);
return;
}
// Verify each move returns true when move succeeds
test.shouldBeTrue... | [
"function",
"getAlphabetical",
"(",
")",
"{",
"try",
"{",
"storeBeingTested",
".",
"getList",
"(",
"test",
".",
"list",
",",
"{",
"}",
",",
"{",
"name",
":",
"1",
"}",
",",
"function",
"(",
"list",
",",
"error",
")",
"{",
"if",
"(",
"typeof",
"erro... | Retrieve list alphabetically by name test order parameter | [
"Retrieve",
"list",
"alphabetically",
"by",
"name",
"test",
"order",
"parameter"
] | 21f5c4164326c5e80989f19413d26ba591f362ac | https://github.com/tgi-io/tgi-store-json-file/blob/21f5c4164326c5e80989f19413d26ba591f362ac/dist/tgi-store-json-file.spec.js#L1713-L1733 | train |
tgi-io/tgi-store-json-file | dist/tgi-store-json-file.spec.js | storeStooges | function storeStooges() {
self.log(self.oldStoogesFound);
self.log(self.oldStoogesKilled);
spec.integrationStore.putModel(self.moe, stoogeStored);
spec.integrationStore.putModel(self.larry, stoogeStored);
spec.integrationStore.putModel(self.shemp, stoogeStored);
... | javascript | function storeStooges() {
self.log(self.oldStoogesFound);
self.log(self.oldStoogesKilled);
spec.integrationStore.putModel(self.moe, stoogeStored);
spec.integrationStore.putModel(self.larry, stoogeStored);
spec.integrationStore.putModel(self.shemp, stoogeStored);
... | [
"function",
"storeStooges",
"(",
")",
"{",
"self",
".",
"log",
"(",
"self",
".",
"oldStoogesFound",
")",
";",
"self",
".",
"log",
"(",
"self",
".",
"oldStoogesKilled",
")",
";",
"spec",
".",
"integrationStore",
".",
"putModel",
"(",
"self",
".",
"moe",
... | callback to store new stooges | [
"callback",
"to",
"store",
"new",
"stooges"
] | 21f5c4164326c5e80989f19413d26ba591f362ac | https://github.com/tgi-io/tgi-store-json-file/blob/21f5c4164326c5e80989f19413d26ba591f362ac/dist/tgi-store-json-file.spec.js#L2618-L2624 | train |
tgi-io/tgi-store-json-file | dist/tgi-store-json-file.spec.js | stoogeRetrieved | function stoogeRetrieved(model, error) {
if (typeof error != 'undefined') {
callback(error);
return;
}
self.stoogesRetrieved.push(model);
if (self.stoogesRetrieved.length == 3) {
self.shouldBeTrue(true,'here');
// Now we have stored... | javascript | function stoogeRetrieved(model, error) {
if (typeof error != 'undefined') {
callback(error);
return;
}
self.stoogesRetrieved.push(model);
if (self.stoogesRetrieved.length == 3) {
self.shouldBeTrue(true,'here');
// Now we have stored... | [
"function",
"stoogeRetrieved",
"(",
"model",
",",
"error",
")",
"{",
"if",
"(",
"typeof",
"error",
"!=",
"'undefined'",
")",
"{",
"callback",
"(",
"error",
")",
";",
"return",
";",
"}",
"self",
".",
"stoogesRetrieved",
".",
"push",
"(",
"model",
")",
"... | callback after retrieving stored stooges | [
"callback",
"after",
"retrieving",
"stored",
"stooges"
] | 21f5c4164326c5e80989f19413d26ba591f362ac | https://github.com/tgi-io/tgi-store-json-file/blob/21f5c4164326c5e80989f19413d26ba591f362ac/dist/tgi-store-json-file.spec.js#L2651-L2684 | train |
tgi-io/tgi-store-json-file | dist/tgi-store-json-file.spec.js | stoogeChanged | function stoogeChanged(model, error) {
if (typeof error != 'undefined') {
callback(error);
return;
}
self.shouldBeTrue(model.get('name') == 'Curly','Curly');
var curly = new self.Stooge();
curly.set('id', model.get('id'));
try {
... | javascript | function stoogeChanged(model, error) {
if (typeof error != 'undefined') {
callback(error);
return;
}
self.shouldBeTrue(model.get('name') == 'Curly','Curly');
var curly = new self.Stooge();
curly.set('id', model.get('id'));
try {
... | [
"function",
"stoogeChanged",
"(",
"model",
",",
"error",
")",
"{",
"if",
"(",
"typeof",
"error",
"!=",
"'undefined'",
")",
"{",
"callback",
"(",
"error",
")",
";",
"return",
";",
"}",
"self",
".",
"shouldBeTrue",
"(",
"model",
".",
"get",
"(",
"'name'"... | callback after storing changed stooge | [
"callback",
"after",
"storing",
"changed",
"stooge"
] | 21f5c4164326c5e80989f19413d26ba591f362ac | https://github.com/tgi-io/tgi-store-json-file/blob/21f5c4164326c5e80989f19413d26ba591f362ac/dist/tgi-store-json-file.spec.js#L2687-L2701 | train |
tgi-io/tgi-store-json-file | dist/tgi-store-json-file.spec.js | storeChangedShempToCurly | function storeChangedShempToCurly(model, error) {
if (typeof error != 'undefined') {
callback(error);
return;
}
self.shouldBeTrue(model.get('name') == 'Curly','Curly');
// Now test delete
self.deletedModelId = model.get('id'); // Remember this
... | javascript | function storeChangedShempToCurly(model, error) {
if (typeof error != 'undefined') {
callback(error);
return;
}
self.shouldBeTrue(model.get('name') == 'Curly','Curly');
// Now test delete
self.deletedModelId = model.get('id'); // Remember this
... | [
"function",
"storeChangedShempToCurly",
"(",
"model",
",",
"error",
")",
"{",
"if",
"(",
"typeof",
"error",
"!=",
"'undefined'",
")",
"{",
"callback",
"(",
"error",
")",
";",
"return",
";",
"}",
"self",
".",
"shouldBeTrue",
"(",
"model",
".",
"get",
"(",... | callback after retrieving changed stooge | [
"callback",
"after",
"retrieving",
"changed",
"stooge"
] | 21f5c4164326c5e80989f19413d26ba591f362ac | https://github.com/tgi-io/tgi-store-json-file/blob/21f5c4164326c5e80989f19413d26ba591f362ac/dist/tgi-store-json-file.spec.js#L2704-L2713 | train |
tgi-io/tgi-store-json-file | dist/tgi-store-json-file.spec.js | stoogeDeleted | function stoogeDeleted(model, error) {
if (typeof error != 'undefined') {
callback(error);
return;
}
// model parameter is what was deleted
self.shouldBeTrue(undefined === model.get('id')); // ID removed
self.shouldBeTrue(model.get('name') == 'Cu... | javascript | function stoogeDeleted(model, error) {
if (typeof error != 'undefined') {
callback(error);
return;
}
// model parameter is what was deleted
self.shouldBeTrue(undefined === model.get('id')); // ID removed
self.shouldBeTrue(model.get('name') == 'Cu... | [
"function",
"stoogeDeleted",
"(",
"model",
",",
"error",
")",
"{",
"if",
"(",
"typeof",
"error",
"!=",
"'undefined'",
")",
"{",
"callback",
"(",
"error",
")",
";",
"return",
";",
"}",
"// model parameter is what was deleted",
"self",
".",
"shouldBeTrue",
"(",
... | callback when Curly is deleted | [
"callback",
"when",
"Curly",
"is",
"deleted"
] | 21f5c4164326c5e80989f19413d26ba591f362ac | https://github.com/tgi-io/tgi-store-json-file/blob/21f5c4164326c5e80989f19413d26ba591f362ac/dist/tgi-store-json-file.spec.js#L2716-L2728 | train |
tgi-io/tgi-store-json-file | dist/tgi-store-json-file.spec.js | hesDeadJim | function hesDeadJim(model, error) {
if (typeof error != 'undefined') {
if ((error != 'Error: id not found in store') && (error != 'Error: model not found in store')) {
callback(error);
return;
}
} else {
callback(Error('no error deletin... | javascript | function hesDeadJim(model, error) {
if (typeof error != 'undefined') {
if ((error != 'Error: id not found in store') && (error != 'Error: model not found in store')) {
callback(error);
return;
}
} else {
callback(Error('no error deletin... | [
"function",
"hesDeadJim",
"(",
"model",
",",
"error",
")",
"{",
"if",
"(",
"typeof",
"error",
"!=",
"'undefined'",
")",
"{",
"if",
"(",
"(",
"error",
"!=",
"'Error: id not found in store'",
")",
"&&",
"(",
"error",
"!=",
"'Error: model not found in store'",
")... | callback after lookup of dead stooge | [
"callback",
"after",
"lookup",
"of",
"dead",
"stooge"
] | 21f5c4164326c5e80989f19413d26ba591f362ac | https://github.com/tgi-io/tgi-store-json-file/blob/21f5c4164326c5e80989f19413d26ba591f362ac/dist/tgi-store-json-file.spec.js#L2731-L2754 | train |
MakerCollider/upm_mc | doxy/node/generators/yuidoc/generator.js | generateDocs | function generateDocs(specjs) {
var docs = GENERATE_MODULE(specjs.MODULE, '');
GENERATE_TYPE = (function(enums) {
return function(type) {
return (_.contains(enums, type) ? ('Enum ' + type) : type);
}
})(_.keys(specjs.ENUMS_BY_GROUP));
docs = _.reduce(specjs.METHODS, function(memo, methodSpec, m... | javascript | function generateDocs(specjs) {
var docs = GENERATE_MODULE(specjs.MODULE, '');
GENERATE_TYPE = (function(enums) {
return function(type) {
return (_.contains(enums, type) ? ('Enum ' + type) : type);
}
})(_.keys(specjs.ENUMS_BY_GROUP));
docs = _.reduce(specjs.METHODS, function(memo, methodSpec, m... | [
"function",
"generateDocs",
"(",
"specjs",
")",
"{",
"var",
"docs",
"=",
"GENERATE_MODULE",
"(",
"specjs",
".",
"MODULE",
",",
"''",
")",
";",
"GENERATE_TYPE",
"=",
"(",
"function",
"(",
"enums",
")",
"{",
"return",
"function",
"(",
"type",
")",
"{",
"... | generate YuiDocs-style documentation | [
"generate",
"YuiDocs",
"-",
"style",
"documentation"
] | 525e775a17b85c30716c00435a2acb26bb198c12 | https://github.com/MakerCollider/upm_mc/blob/525e775a17b85c30716c00435a2acb26bb198c12/doxy/node/generators/yuidoc/generator.js#L30-L59 | train |
MakerCollider/upm_mc | doxy/node/generators/yuidoc/generator.js | GENERATE_CLASSES | function GENERATE_CLASSES(classes, parent) {
return _.reduce(classes, function(memo, classSpec, className) {
return memo
+ GENERATE_CLASS(className, classSpec.description, parent, classSpec.parent)
+ _.reduce(classSpec.methods, function(memo, methodSpec, methodName) {
return memo += GENERATE_M... | javascript | function GENERATE_CLASSES(classes, parent) {
return _.reduce(classes, function(memo, classSpec, className) {
return memo
+ GENERATE_CLASS(className, classSpec.description, parent, classSpec.parent)
+ _.reduce(classSpec.methods, function(memo, methodSpec, methodName) {
return memo += GENERATE_M... | [
"function",
"GENERATE_CLASSES",
"(",
"classes",
",",
"parent",
")",
"{",
"return",
"_",
".",
"reduce",
"(",
"classes",
",",
"function",
"(",
"memo",
",",
"classSpec",
",",
"className",
")",
"{",
"return",
"memo",
"+",
"GENERATE_CLASS",
"(",
"className",
",... | generate spec for the given list of classes | [
"generate",
"spec",
"for",
"the",
"given",
"list",
"of",
"classes"
] | 525e775a17b85c30716c00435a2acb26bb198c12 | https://github.com/MakerCollider/upm_mc/blob/525e775a17b85c30716c00435a2acb26bb198c12/doxy/node/generators/yuidoc/generator.js#L76-L90 | train |
MakerCollider/upm_mc | doxy/node/generators/yuidoc/generator.js | GENERATE_CLASS | function GENERATE_CLASS(name, description, namespace, parent) {
return GENERATE_DOC(description + '\n'
+ '@class ' + name + '\n'
+ (namespace ? ('@module ' + namespace + '\n') : '')
/*
TODO: leave out until figure out what swig does with inheritance
+ (parent ? ('@extends ' + parent + '\n') : '')... | javascript | function GENERATE_CLASS(name, description, namespace, parent) {
return GENERATE_DOC(description + '\n'
+ '@class ' + name + '\n'
+ (namespace ? ('@module ' + namespace + '\n') : '')
/*
TODO: leave out until figure out what swig does with inheritance
+ (parent ? ('@extends ' + parent + '\n') : '')... | [
"function",
"GENERATE_CLASS",
"(",
"name",
",",
"description",
",",
"namespace",
",",
"parent",
")",
"{",
"return",
"GENERATE_DOC",
"(",
"description",
"+",
"'\\n'",
"+",
"'@class '",
"+",
"name",
"+",
"'\\n'",
"+",
"(",
"namespace",
"?",
"(",
"'@module '",
... | generate class spec | [
"generate",
"class",
"spec"
] | 525e775a17b85c30716c00435a2acb26bb198c12 | https://github.com/MakerCollider/upm_mc/blob/525e775a17b85c30716c00435a2acb26bb198c12/doxy/node/generators/yuidoc/generator.js#L94-L103 | train |
MakerCollider/upm_mc | doxy/node/generators/yuidoc/generator.js | GENERATE_ENUM | function GENERATE_ENUM(name, spec, parent) {
return GENERATE_DOC(spec.description + '\n'
+ '@property ' + name + '\n'
+ '@type Enum ' + spec.type + '\n'
+ '@for ' + (parent ? parent : 'common') + '\n');
} | javascript | function GENERATE_ENUM(name, spec, parent) {
return GENERATE_DOC(spec.description + '\n'
+ '@property ' + name + '\n'
+ '@type Enum ' + spec.type + '\n'
+ '@for ' + (parent ? parent : 'common') + '\n');
} | [
"function",
"GENERATE_ENUM",
"(",
"name",
",",
"spec",
",",
"parent",
")",
"{",
"return",
"GENERATE_DOC",
"(",
"spec",
".",
"description",
"+",
"'\\n'",
"+",
"'@property '",
"+",
"name",
"+",
"'\\n'",
"+",
"'@type Enum '",
"+",
"spec",
".",
"type",
"+",
... | generate enum spec | [
"generate",
"enum",
"spec"
] | 525e775a17b85c30716c00435a2acb26bb198c12 | https://github.com/MakerCollider/upm_mc/blob/525e775a17b85c30716c00435a2acb26bb198c12/doxy/node/generators/yuidoc/generator.js#L120-L125 | train |
MakerCollider/upm_mc | doxy/node/generators/yuidoc/generator.js | GENERATE_VAR | function GENERATE_VAR(name, spec, parent) {
return GENERATE_DOC(spec.description + '\n'
+ '@property ' + name + '\n'
+ '@type ' + spec.type + '\n'
+ '@for ' + parent + '\n');
} | javascript | function GENERATE_VAR(name, spec, parent) {
return GENERATE_DOC(spec.description + '\n'
+ '@property ' + name + '\n'
+ '@type ' + spec.type + '\n'
+ '@for ' + parent + '\n');
} | [
"function",
"GENERATE_VAR",
"(",
"name",
",",
"spec",
",",
"parent",
")",
"{",
"return",
"GENERATE_DOC",
"(",
"spec",
".",
"description",
"+",
"'\\n'",
"+",
"'@property '",
"+",
"name",
"+",
"'\\n'",
"+",
"'@type '",
"+",
"spec",
".",
"type",
"+",
"'\\n'... | generate variable specs | [
"generate",
"variable",
"specs"
] | 525e775a17b85c30716c00435a2acb26bb198c12 | https://github.com/MakerCollider/upm_mc/blob/525e775a17b85c30716c00435a2acb26bb198c12/doxy/node/generators/yuidoc/generator.js#L129-L134 | train |
marcin-chwedczuk/format.js | lib/bigint.js | function(lDigits, rDigits) {
var difference = [];
// assert: lDigits.length >= rDigits.length
var carry = 0, i;
for (i = 0; i < rDigits.length; i += 1) {
difference[i] = lDigits[i] - rDigits[i] + carry;
if (difference[i] < 0) {
difference[i] += 2;
carry = ... | javascript | function(lDigits, rDigits) {
var difference = [];
// assert: lDigits.length >= rDigits.length
var carry = 0, i;
for (i = 0; i < rDigits.length; i += 1) {
difference[i] = lDigits[i] - rDigits[i] + carry;
if (difference[i] < 0) {
difference[i] += 2;
carry = ... | [
"function",
"(",
"lDigits",
",",
"rDigits",
")",
"{",
"var",
"difference",
"=",
"[",
"]",
";",
"// assert: lDigits.length >= rDigits.length",
"var",
"carry",
"=",
"0",
",",
"i",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"rDigits",
".",
"length",
"... | lDigits must represent number that is greater than number representated by rDigits. | [
"lDigits",
"must",
"represent",
"number",
"that",
"is",
"greater",
"than",
"number",
"representated",
"by",
"rDigits",
"."
] | 01b146bc160cba9a70f6bdf6094bf353b4c56b5d | https://github.com/marcin-chwedczuk/format.js/blob/01b146bc160cba9a70f6bdf6094bf353b4c56b5d/lib/bigint.js#L170-L206 | train | |
marcin-chwedczuk/format.js | lib/bigint.js | function(normalizedLeft, normalizedRight) {
if (normalizedLeft.length !== normalizedRight.length) {
return normalizedLeft.length - normalizedRight.length;
}
for (var i = normalizedLeft.length - 1; i >= 0; i -= 1) {
if (normalizedLeft[i] !== normalizedRight[i]) {
return normalize... | javascript | function(normalizedLeft, normalizedRight) {
if (normalizedLeft.length !== normalizedRight.length) {
return normalizedLeft.length - normalizedRight.length;
}
for (var i = normalizedLeft.length - 1; i >= 0; i -= 1) {
if (normalizedLeft[i] !== normalizedRight[i]) {
return normalize... | [
"function",
"(",
"normalizedLeft",
",",
"normalizedRight",
")",
"{",
"if",
"(",
"normalizedLeft",
".",
"length",
"!==",
"normalizedRight",
".",
"length",
")",
"{",
"return",
"normalizedLeft",
".",
"length",
"-",
"normalizedRight",
".",
"length",
";",
"}",
"for... | compares numbers represented by two NORMALIZED digits arrays | [
"compares",
"numbers",
"represented",
"by",
"two",
"NORMALIZED",
"digits",
"arrays"
] | 01b146bc160cba9a70f6bdf6094bf353b4c56b5d | https://github.com/marcin-chwedczuk/format.js/blob/01b146bc160cba9a70f6bdf6094bf353b4c56b5d/lib/bigint.js#L459-L471 | train | |
redisjs/jsr-server | lib/socket.js | SocketProxy | function SocketProxy() {
// the socket we are paired with
this.pair = null;
// internal sockets have fd -1
this._handle = {fd: -1};
// mimic a remote address / remote port
this.remoteAddress = '0.0.0.0';
this.remotePort = '0';
// give the client some time to listen
// for the connect event
functi... | javascript | function SocketProxy() {
// the socket we are paired with
this.pair = null;
// internal sockets have fd -1
this._handle = {fd: -1};
// mimic a remote address / remote port
this.remoteAddress = '0.0.0.0';
this.remotePort = '0';
// give the client some time to listen
// for the connect event
functi... | [
"function",
"SocketProxy",
"(",
")",
"{",
"// the socket we are paired with",
"this",
".",
"pair",
"=",
"null",
";",
"// internal sockets have fd -1",
"this",
".",
"_handle",
"=",
"{",
"fd",
":",
"-",
"1",
"}",
";",
"// mimic a remote address / remote port",
"this",... | Abstract socket class used to create a bi-directional link between
a server and a client connecting in the same process.
Simulates the `net.Socket` class so that the code flows in exactly
the same way but bypasses encoding, decoding and TCP transmission
overhead. | [
"Abstract",
"socket",
"class",
"used",
"to",
"create",
"a",
"bi",
"-",
"directional",
"link",
"between",
"a",
"server",
"and",
"a",
"client",
"connecting",
"in",
"the",
"same",
"process",
"."
] | 49413052d3039524fbdd2ade0ef9bae26cb4d647 | https://github.com/redisjs/jsr-server/blob/49413052d3039524fbdd2ade0ef9bae26cb4d647/lib/socket.js#L12-L29 | train |
loggur-legacy/baucis-decorator-deep-select | index.js | gatherPopulateParams | function gatherPopulateParams (populate, pointers, model, deepPath) {
var modelName = model.modelName;
var paths = model.schema.paths;
var path = '';
var options;
var params;
var ref;
var deep = false;
while (deepPath.length) {
path += (path ? '.' : '')+deepPath.shift();
options = paths[path]... | javascript | function gatherPopulateParams (populate, pointers, model, deepPath) {
var modelName = model.modelName;
var paths = model.schema.paths;
var path = '';
var options;
var params;
var ref;
var deep = false;
while (deepPath.length) {
path += (path ? '.' : '')+deepPath.shift();
options = paths[path]... | [
"function",
"gatherPopulateParams",
"(",
"populate",
",",
"pointers",
",",
"model",
",",
"deepPath",
")",
"{",
"var",
"modelName",
"=",
"model",
".",
"modelName",
";",
"var",
"paths",
"=",
"model",
".",
"schema",
".",
"paths",
";",
"var",
"path",
"=",
"'... | Gathers the params required for population of some deep path, if any.
@param {Array} populate
@param {Object} pointers
@param {Model} model
@param {Array} deepPath
@return {Boolean} true if deep population
@api private | [
"Gathers",
"the",
"params",
"required",
"for",
"population",
"of",
"some",
"deep",
"path",
"if",
"any",
"."
] | 8f14bb6aca76d43fd163d2142ff49c3058ddc657 | https://github.com/loggur-legacy/baucis-decorator-deep-select/blob/8f14bb6aca76d43fd163d2142ff49c3058ddc657/index.js#L117-L166 | train |
loggur-legacy/baucis-decorator-deep-select | index.js | selectPointers | function selectPointers (params) {
if (params.pointers) {
delete params.pointers['-_id'];
params.select = Object.keys(params.pointers).join(' ');
} else {
delete params.select;
}
return params.select;
} | javascript | function selectPointers (params) {
if (params.pointers) {
delete params.pointers['-_id'];
params.select = Object.keys(params.pointers).join(' ');
} else {
delete params.select;
}
return params.select;
} | [
"function",
"selectPointers",
"(",
"params",
")",
"{",
"if",
"(",
"params",
".",
"pointers",
")",
"{",
"delete",
"params",
".",
"pointers",
"[",
"'-_id'",
"]",
";",
"params",
".",
"select",
"=",
"Object",
".",
"keys",
"(",
"params",
".",
"pointers",
")... | Sets the `select` parameter to the keys of the `pointers` and ensures `_id`
can't be hidden.
@param {Object} params
@return {String} select
@api private | [
"Sets",
"the",
"select",
"parameter",
"to",
"the",
"keys",
"of",
"the",
"pointers",
"and",
"ensures",
"_id",
"can",
"t",
"be",
"hidden",
"."
] | 8f14bb6aca76d43fd163d2142ff49c3058ddc657 | https://github.com/loggur-legacy/baucis-decorator-deep-select/blob/8f14bb6aca76d43fd163d2142ff49c3058ddc657/index.js#L176-L184 | train |
gethuman/taste | lib/taste.js | firstBite | function firstBite(dir) {
targetDir = dir || path.join(__dirname, '../../..');
if (targetDir.substring(targetDir.length - 1) === '/') {
targetDir = targetDir.substring(0, targetDir.length - 1);
}
} | javascript | function firstBite(dir) {
targetDir = dir || path.join(__dirname, '../../..');
if (targetDir.substring(targetDir.length - 1) === '/') {
targetDir = targetDir.substring(0, targetDir.length - 1);
}
} | [
"function",
"firstBite",
"(",
"dir",
")",
"{",
"targetDir",
"=",
"dir",
"||",
"path",
".",
"join",
"(",
"__dirname",
",",
"'../../..'",
")",
";",
"if",
"(",
"targetDir",
".",
"substring",
"(",
"targetDir",
".",
"length",
"-",
"1",
")",
"===",
"'/'",
... | chai.config.truncateThreshold = 0;
Initialize taste with the input params
@param dir | [
"chai",
".",
"config",
".",
"truncateThreshold",
"=",
"0",
";",
"Initialize",
"taste",
"with",
"the",
"input",
"params"
] | f06938fe0c182235e88403e3341a94b6f47c2e2d | https://github.com/gethuman/taste/blob/f06938fe0c182235e88403e3341a94b6f47c2e2d/lib/taste.js#L27-L33 | train |
gethuman/taste | lib/taste.js | eventuallyEqual | function eventuallyEqual(promise, expected, done) {
all([
promise.should.be.fulfilled,
promise.should.eventually.deep.equal(expected)
], done);
} | javascript | function eventuallyEqual(promise, expected, done) {
all([
promise.should.be.fulfilled,
promise.should.eventually.deep.equal(expected)
], done);
} | [
"function",
"eventuallyEqual",
"(",
"promise",
",",
"expected",
",",
"done",
")",
"{",
"all",
"(",
"[",
"promise",
".",
"should",
".",
"be",
".",
"fulfilled",
",",
"promise",
".",
"should",
".",
"eventually",
".",
"deep",
".",
"equal",
"(",
"expected",
... | Shorthand for just making sure a promise eventually equals a value
@param promise
@param expected
@param done | [
"Shorthand",
"for",
"just",
"making",
"sure",
"a",
"promise",
"eventually",
"equals",
"a",
"value"
] | f06938fe0c182235e88403e3341a94b6f47c2e2d | https://github.com/gethuman/taste/blob/f06938fe0c182235e88403e3341a94b6f47c2e2d/lib/taste.js#L51-L56 | train |
gethuman/taste | lib/taste.js | eventuallyRejectedWith | function eventuallyRejectedWith(promise, expected, done) {
all([
promise.should.be.rejectedWith(expected)
], done);
} | javascript | function eventuallyRejectedWith(promise, expected, done) {
all([
promise.should.be.rejectedWith(expected)
], done);
} | [
"function",
"eventuallyRejectedWith",
"(",
"promise",
",",
"expected",
",",
"done",
")",
"{",
"all",
"(",
"[",
"promise",
".",
"should",
".",
"be",
".",
"rejectedWith",
"(",
"expected",
")",
"]",
",",
"done",
")",
";",
"}"
] | Shorthand for making sure the promise will eventually be rejected
@param promise
@param expected
@param done | [
"Shorthand",
"for",
"making",
"sure",
"the",
"promise",
"will",
"eventually",
"be",
"rejected"
] | f06938fe0c182235e88403e3341a94b6f47c2e2d | https://github.com/gethuman/taste/blob/f06938fe0c182235e88403e3341a94b6f47c2e2d/lib/taste.js#L86-L90 | train |
web-mech/can-stream-x | interface-factory.js | function (updated) {
// When the stream passes a new values, save a reference to it and call
// the compute's internal `updated` method (which ultimately calls `get`)
streamHandler = function (val) {
lastValue = val;
updated();
};
... | javascript | function (updated) {
// When the stream passes a new values, save a reference to it and call
// the compute's internal `updated` method (which ultimately calls `get`)
streamHandler = function (val) {
lastValue = val;
updated();
};
... | [
"function",
"(",
"updated",
")",
"{",
"// When the stream passes a new values, save a reference to it and call",
"// the compute's internal `updated` method (which ultimately calls `get`)",
"streamHandler",
"=",
"function",
"(",
"val",
")",
"{",
"lastValue",
"=",
"val",
";",
"upd... | When the compute is bound, bind to the resolved stream | [
"When",
"the",
"compute",
"is",
"bound",
"bind",
"to",
"the",
"resolved",
"stream"
] | bb025a313c2432861ba7293c6d8f6128f187ced8 | https://github.com/web-mech/can-stream-x/blob/bb025a313c2432861ba7293c6d8f6128f187ced8/interface-factory.js#L89-L98 | train | |
chanoch/simple-react-router | src/route/SetRoute.js | setRoot | function setRoot(mountpath) {
// mount to root if not mountpath
let root=mountpath?mountpath:"";
// add leading slash if needed
root=root.match(/^\/.*/)?root:`/${root}`;
// chop off trailing slash
root=root.match(/^.*\/$/)?root.substring(0,root.length-1):root;
// if root is just slash then... | javascript | function setRoot(mountpath) {
// mount to root if not mountpath
let root=mountpath?mountpath:"";
// add leading slash if needed
root=root.match(/^\/.*/)?root:`/${root}`;
// chop off trailing slash
root=root.match(/^.*\/$/)?root.substring(0,root.length-1):root;
// if root is just slash then... | [
"function",
"setRoot",
"(",
"mountpath",
")",
"{",
"// mount to root if not mountpath",
"let",
"root",
"=",
"mountpath",
"?",
"mountpath",
":",
"\"\"",
";",
"// add leading slash if needed",
"root",
"=",
"root",
".",
"match",
"(",
"/",
"^\\/.*",
"/",
")",
"?",
... | make sure that mountpath has a leading slash and no training slash | [
"make",
"sure",
"that",
"mountpath",
"has",
"a",
"leading",
"slash",
"and",
"no",
"training",
"slash"
] | 3c71feeeb039111f33c934257732e2ea6ddde9ff | https://github.com/chanoch/simple-react-router/blob/3c71feeeb039111f33c934257732e2ea6ddde9ff/src/route/SetRoute.js#L19-L30 | train |
tnantoka/LooseLeaf | skeleton/public/javascripts/lib/cleditor/jquery.cleditor.js | popupClick | function popupClick(e) {
var editor = this,
popup = e.data.popup,
target = e.target;
// Check for message and prompt popups
if (popup === popups.msg || $(popup).hasClass(PROMPT_CLASS))
return;
// Get the button info
var buttonDiv = $.data(popup, BUTTON),
... | javascript | function popupClick(e) {
var editor = this,
popup = e.data.popup,
target = e.target;
// Check for message and prompt popups
if (popup === popups.msg || $(popup).hasClass(PROMPT_CLASS))
return;
// Get the button info
var buttonDiv = $.data(popup, BUTTON),
... | [
"function",
"popupClick",
"(",
"e",
")",
"{",
"var",
"editor",
"=",
"this",
",",
"popup",
"=",
"e",
".",
"data",
".",
"popup",
",",
"target",
"=",
"e",
".",
"target",
";",
"// Check for message and prompt popups\r",
"if",
"(",
"popup",
"===",
"popups",
"... | popupClick - click event handler for popup items | [
"popupClick",
"-",
"click",
"event",
"handler",
"for",
"popup",
"items"
] | 0c6333977224d8f4ef7ad40415aa69e0ff76f7b5 | https://github.com/tnantoka/LooseLeaf/blob/0c6333977224d8f4ef7ad40415aa69e0ff76f7b5/skeleton/public/javascripts/lib/cleditor/jquery.cleditor.js#L500-L560 | train |
tnantoka/LooseLeaf | skeleton/public/javascripts/lib/cleditor/jquery.cleditor.js | createPopup | function createPopup(popupName, options, popupTypeClass, popupContent, popupHover) {
// Check if popup already exists
if (popups[popupName])
return popups[popupName];
// Create the popup
var $popup = $(DIV_TAG)
.hide()
.addClass(POPUP_CLASS)
.appendTo("body");
... | javascript | function createPopup(popupName, options, popupTypeClass, popupContent, popupHover) {
// Check if popup already exists
if (popups[popupName])
return popups[popupName];
// Create the popup
var $popup = $(DIV_TAG)
.hide()
.addClass(POPUP_CLASS)
.appendTo("body");
... | [
"function",
"createPopup",
"(",
"popupName",
",",
"options",
",",
"popupTypeClass",
",",
"popupContent",
",",
"popupHover",
")",
"{",
"// Check if popup already exists\r",
"if",
"(",
"popups",
"[",
"popupName",
"]",
")",
"return",
"popups",
"[",
"popupName",
"]",
... | createPopup - creates a popup and adds it to the body | [
"createPopup",
"-",
"creates",
"a",
"popup",
"and",
"adds",
"it",
"to",
"the",
"body"
] | 0c6333977224d8f4ef7ad40415aa69e0ff76f7b5 | https://github.com/tnantoka/LooseLeaf/blob/0c6333977224d8f4ef7ad40415aa69e0ff76f7b5/skeleton/public/javascripts/lib/cleditor/jquery.cleditor.js#L584-L668 | train |
tnantoka/LooseLeaf | skeleton/public/javascripts/lib/cleditor/jquery.cleditor.js | disable | function disable(editor, disabled) {
// Update the textarea and save the state
if (disabled) {
editor.$area.attr(DISABLED, DISABLED);
editor.disabled = true;
}
else {
editor.$area.removeAttr(DISABLED);
delete editor.disabled;
}
// Switch the iframe into desi... | javascript | function disable(editor, disabled) {
// Update the textarea and save the state
if (disabled) {
editor.$area.attr(DISABLED, DISABLED);
editor.disabled = true;
}
else {
editor.$area.removeAttr(DISABLED);
delete editor.disabled;
}
// Switch the iframe into desi... | [
"function",
"disable",
"(",
"editor",
",",
"disabled",
")",
"{",
"// Update the textarea and save the state\r",
"if",
"(",
"disabled",
")",
"{",
"editor",
".",
"$area",
".",
"attr",
"(",
"DISABLED",
",",
"DISABLED",
")",
";",
"editor",
".",
"disabled",
"=",
... | disable - enables or disables the editor | [
"disable",
"-",
"enables",
"or",
"disables",
"the",
"editor"
] | 0c6333977224d8f4ef7ad40415aa69e0ff76f7b5 | https://github.com/tnantoka/LooseLeaf/blob/0c6333977224d8f4ef7ad40415aa69e0ff76f7b5/skeleton/public/javascripts/lib/cleditor/jquery.cleditor.js#L671-L697 | train |
tnantoka/LooseLeaf | skeleton/public/javascripts/lib/cleditor/jquery.cleditor.js | execCommand | function execCommand(editor, command, value, useCSS, button) {
// Restore the current ie selection
restoreRange(editor);
// Set the styling method
if (!ie) {
if (useCSS === undefined || useCSS === null)
useCSS = editor.options.useCSS;
editor.doc.execCommand("styleWithCSS",... | javascript | function execCommand(editor, command, value, useCSS, button) {
// Restore the current ie selection
restoreRange(editor);
// Set the styling method
if (!ie) {
if (useCSS === undefined || useCSS === null)
useCSS = editor.options.useCSS;
editor.doc.execCommand("styleWithCSS",... | [
"function",
"execCommand",
"(",
"editor",
",",
"command",
",",
"value",
",",
"useCSS",
",",
"button",
")",
"{",
"// Restore the current ie selection\r",
"restoreRange",
"(",
"editor",
")",
";",
"// Set the styling method\r",
"if",
"(",
"!",
"ie",
")",
"{",
"if",... | execCommand - executes a designMode command | [
"execCommand",
"-",
"executes",
"a",
"designMode",
"command"
] | 0c6333977224d8f4ef7ad40415aa69e0ff76f7b5 | https://github.com/tnantoka/LooseLeaf/blob/0c6333977224d8f4ef7ad40415aa69e0ff76f7b5/skeleton/public/javascripts/lib/cleditor/jquery.cleditor.js#L700-L735 | train |
tnantoka/LooseLeaf | skeleton/public/javascripts/lib/cleditor/jquery.cleditor.js | focus | function focus(editor) {
setTimeout(function() {
if (sourceMode(editor)) editor.$area.focus();
else editor.$frame[0].contentWindow.focus();
refreshButtons(editor);
}, 0);
} | javascript | function focus(editor) {
setTimeout(function() {
if (sourceMode(editor)) editor.$area.focus();
else editor.$frame[0].contentWindow.focus();
refreshButtons(editor);
}, 0);
} | [
"function",
"focus",
"(",
"editor",
")",
"{",
"setTimeout",
"(",
"function",
"(",
")",
"{",
"if",
"(",
"sourceMode",
"(",
"editor",
")",
")",
"editor",
".",
"$area",
".",
"focus",
"(",
")",
";",
"else",
"editor",
".",
"$frame",
"[",
"0",
"]",
".",
... | focus - sets focus to either the textarea or iframe | [
"focus",
"-",
"sets",
"focus",
"to",
"either",
"the",
"textarea",
"or",
"iframe"
] | 0c6333977224d8f4ef7ad40415aa69e0ff76f7b5 | https://github.com/tnantoka/LooseLeaf/blob/0c6333977224d8f4ef7ad40415aa69e0ff76f7b5/skeleton/public/javascripts/lib/cleditor/jquery.cleditor.js#L738-L744 | train |
tnantoka/LooseLeaf | skeleton/public/javascripts/lib/cleditor/jquery.cleditor.js | hidePopups | function hidePopups() {
$.each(popups, function(idx, popup) {
$(popup)
.hide()
.unbind(CLICK)
.removeData(BUTTON);
});
} | javascript | function hidePopups() {
$.each(popups, function(idx, popup) {
$(popup)
.hide()
.unbind(CLICK)
.removeData(BUTTON);
});
} | [
"function",
"hidePopups",
"(",
")",
"{",
"$",
".",
"each",
"(",
"popups",
",",
"function",
"(",
"idx",
",",
"popup",
")",
"{",
"$",
"(",
"popup",
")",
".",
"hide",
"(",
")",
".",
"unbind",
"(",
"CLICK",
")",
".",
"removeData",
"(",
"BUTTON",
")",... | hidePopups - hides all popups | [
"hidePopups",
"-",
"hides",
"all",
"popups"
] | 0c6333977224d8f4ef7ad40415aa69e0ff76f7b5 | https://github.com/tnantoka/LooseLeaf/blob/0c6333977224d8f4ef7ad40415aa69e0ff76f7b5/skeleton/public/javascripts/lib/cleditor/jquery.cleditor.js#L774-L781 | train |
tnantoka/LooseLeaf | skeleton/public/javascripts/lib/cleditor/jquery.cleditor.js | imagesPath | function imagesPath() {
var cssFile = "jquery.cleditor.css",
href = $("link[href$='" + cssFile +"']").attr("href");
return href.substr(0, href.length - cssFile.length) + "images/";
} | javascript | function imagesPath() {
var cssFile = "jquery.cleditor.css",
href = $("link[href$='" + cssFile +"']").attr("href");
return href.substr(0, href.length - cssFile.length) + "images/";
} | [
"function",
"imagesPath",
"(",
")",
"{",
"var",
"cssFile",
"=",
"\"jquery.cleditor.css\"",
",",
"href",
"=",
"$",
"(",
"\"link[href$='\"",
"+",
"cssFile",
"+",
"\"']\"",
")",
".",
"attr",
"(",
"\"href\"",
")",
";",
"return",
"href",
".",
"substr",
"(",
"... | imagesPath - returns the path to the images folder | [
"imagesPath",
"-",
"returns",
"the",
"path",
"to",
"the",
"images",
"folder"
] | 0c6333977224d8f4ef7ad40415aa69e0ff76f7b5 | https://github.com/tnantoka/LooseLeaf/blob/0c6333977224d8f4ef7ad40415aa69e0ff76f7b5/skeleton/public/javascripts/lib/cleditor/jquery.cleditor.js#L784-L788 | train |
tnantoka/LooseLeaf | skeleton/public/javascripts/lib/cleditor/jquery.cleditor.js | refreshButtons | function refreshButtons(editor) {
// Webkit requires focus before queryCommandEnabled will return anything but false
if (!iOS && $.browser.webkit && !editor.focused) {
editor.$frame[0].contentWindow.focus();
window.focus();
editor.focused = true;
}
// Get the object used for... | javascript | function refreshButtons(editor) {
// Webkit requires focus before queryCommandEnabled will return anything but false
if (!iOS && $.browser.webkit && !editor.focused) {
editor.$frame[0].contentWindow.focus();
window.focus();
editor.focused = true;
}
// Get the object used for... | [
"function",
"refreshButtons",
"(",
"editor",
")",
"{",
"// Webkit requires focus before queryCommandEnabled will return anything but false\r",
"if",
"(",
"!",
"iOS",
"&&",
"$",
".",
"browser",
".",
"webkit",
"&&",
"!",
"editor",
".",
"focused",
")",
"{",
"editor",
"... | refreshButtons - enables or disables buttons based on availability | [
"refreshButtons",
"-",
"enables",
"or",
"disables",
"buttons",
"based",
"on",
"availability"
] | 0c6333977224d8f4ef7ad40415aa69e0ff76f7b5 | https://github.com/tnantoka/LooseLeaf/blob/0c6333977224d8f4ef7ad40415aa69e0ff76f7b5/skeleton/public/javascripts/lib/cleditor/jquery.cleditor.js#L917-L980 | train |
tnantoka/LooseLeaf | skeleton/public/javascripts/lib/cleditor/jquery.cleditor.js | selectedHTML | function selectedHTML(editor) {
restoreRange(editor);
var range = getRange(editor);
if (ie)
return range.htmlText;
var layer = $("<layer>")[0];
layer.appendChild(range.cloneContents());
var html = layer.innerHTML;
layer = null;
return html;
} | javascript | function selectedHTML(editor) {
restoreRange(editor);
var range = getRange(editor);
if (ie)
return range.htmlText;
var layer = $("<layer>")[0];
layer.appendChild(range.cloneContents());
var html = layer.innerHTML;
layer = null;
return html;
} | [
"function",
"selectedHTML",
"(",
"editor",
")",
"{",
"restoreRange",
"(",
"editor",
")",
";",
"var",
"range",
"=",
"getRange",
"(",
"editor",
")",
";",
"if",
"(",
"ie",
")",
"return",
"range",
".",
"htmlText",
";",
"var",
"layer",
"=",
"$",
"(",
"\"<... | selectedHTML - returns the current HTML selection or and empty string | [
"selectedHTML",
"-",
"returns",
"the",
"current",
"HTML",
"selection",
"or",
"and",
"empty",
"string"
] | 0c6333977224d8f4ef7ad40415aa69e0ff76f7b5 | https://github.com/tnantoka/LooseLeaf/blob/0c6333977224d8f4ef7ad40415aa69e0ff76f7b5/skeleton/public/javascripts/lib/cleditor/jquery.cleditor.js#L997-L1007 | train |
tnantoka/LooseLeaf | skeleton/public/javascripts/lib/cleditor/jquery.cleditor.js | selectedText | function selectedText(editor) {
restoreRange(editor);
if (ie) return getRange(editor).text;
return getSelection(editor).toString();
} | javascript | function selectedText(editor) {
restoreRange(editor);
if (ie) return getRange(editor).text;
return getSelection(editor).toString();
} | [
"function",
"selectedText",
"(",
"editor",
")",
"{",
"restoreRange",
"(",
"editor",
")",
";",
"if",
"(",
"ie",
")",
"return",
"getRange",
"(",
"editor",
")",
".",
"text",
";",
"return",
"getSelection",
"(",
"editor",
")",
".",
"toString",
"(",
")",
";"... | selectedText - returns the current text selection or and empty string | [
"selectedText",
"-",
"returns",
"the",
"current",
"text",
"selection",
"or",
"and",
"empty",
"string"
] | 0c6333977224d8f4ef7ad40415aa69e0ff76f7b5 | https://github.com/tnantoka/LooseLeaf/blob/0c6333977224d8f4ef7ad40415aa69e0ff76f7b5/skeleton/public/javascripts/lib/cleditor/jquery.cleditor.js#L1010-L1014 | train |
tnantoka/LooseLeaf | skeleton/public/javascripts/lib/cleditor/jquery.cleditor.js | showMessage | function showMessage(editor, message, button) {
var popup = createPopup("msg", editor.options, MSG_CLASS);
popup.innerHTML = message;
showPopup(editor, popup, button);
} | javascript | function showMessage(editor, message, button) {
var popup = createPopup("msg", editor.options, MSG_CLASS);
popup.innerHTML = message;
showPopup(editor, popup, button);
} | [
"function",
"showMessage",
"(",
"editor",
",",
"message",
",",
"button",
")",
"{",
"var",
"popup",
"=",
"createPopup",
"(",
"\"msg\"",
",",
"editor",
".",
"options",
",",
"MSG_CLASS",
")",
";",
"popup",
".",
"innerHTML",
"=",
"message",
";",
"showPopup",
... | showMessage - alert replacement | [
"showMessage",
"-",
"alert",
"replacement"
] | 0c6333977224d8f4ef7ad40415aa69e0ff76f7b5 | https://github.com/tnantoka/LooseLeaf/blob/0c6333977224d8f4ef7ad40415aa69e0ff76f7b5/skeleton/public/javascripts/lib/cleditor/jquery.cleditor.js#L1017-L1021 | train |
tnantoka/LooseLeaf | skeleton/public/javascripts/lib/cleditor/jquery.cleditor.js | showPopup | function showPopup(editor, popup, button) {
var offset, left, top, $popup = $(popup);
// Determine the popup location
if (button) {
var $button = $(button);
offset = $button.offset();
left = --offset.left;
top = offset.top + $button.height();
}
else {
var ... | javascript | function showPopup(editor, popup, button) {
var offset, left, top, $popup = $(popup);
// Determine the popup location
if (button) {
var $button = $(button);
offset = $button.offset();
left = --offset.left;
top = offset.top + $button.height();
}
else {
var ... | [
"function",
"showPopup",
"(",
"editor",
",",
"popup",
",",
"button",
")",
"{",
"var",
"offset",
",",
"left",
",",
"top",
",",
"$popup",
"=",
"$",
"(",
"popup",
")",
";",
"// Determine the popup location\r",
"if",
"(",
"button",
")",
"{",
"var",
"$button"... | showPopup - shows a popup | [
"showPopup",
"-",
"shows",
"a",
"popup"
] | 0c6333977224d8f4ef7ad40415aa69e0ff76f7b5 | https://github.com/tnantoka/LooseLeaf/blob/0c6333977224d8f4ef7ad40415aa69e0ff76f7b5/skeleton/public/javascripts/lib/cleditor/jquery.cleditor.js#L1024-L1058 | train |
tnantoka/LooseLeaf | skeleton/public/javascripts/lib/cleditor/jquery.cleditor.js | updateFrame | function updateFrame(editor, checkForChange) {
var code = editor.$area.val(),
options = editor.options,
updateFrameCallback = options.updateFrame,
$body = $(editor.doc.body);
// Check for textarea change to avoid unnecessary firing
// of potentially heavy updateFrame callback... | javascript | function updateFrame(editor, checkForChange) {
var code = editor.$area.val(),
options = editor.options,
updateFrameCallback = options.updateFrame,
$body = $(editor.doc.body);
// Check for textarea change to avoid unnecessary firing
// of potentially heavy updateFrame callback... | [
"function",
"updateFrame",
"(",
"editor",
",",
"checkForChange",
")",
"{",
"var",
"code",
"=",
"editor",
".",
"$area",
".",
"val",
"(",
")",
",",
"options",
"=",
"editor",
".",
"options",
",",
"updateFrameCallback",
"=",
"options",
".",
"updateFrame",
",",... | updateFrame - updates the iframe with the textarea contents | [
"updateFrame",
"-",
"updates",
"the",
"iframe",
"with",
"the",
"textarea",
"contents"
] | 0c6333977224d8f4ef7ad40415aa69e0ff76f7b5 | https://github.com/tnantoka/LooseLeaf/blob/0c6333977224d8f4ef7ad40415aa69e0ff76f7b5/skeleton/public/javascripts/lib/cleditor/jquery.cleditor.js#L1066-L1098 | train |
tnantoka/LooseLeaf | skeleton/public/javascripts/lib/cleditor/jquery.cleditor.js | updateTextArea | function updateTextArea(editor, checkForChange) {
var html = $(editor.doc.body).html(),
options = editor.options,
updateTextAreaCallback = options.updateTextArea,
$area = editor.$area;
// Check for iframe change to avoid unnecessary firing
// of potentially heavy updateTextArea c... | javascript | function updateTextArea(editor, checkForChange) {
var html = $(editor.doc.body).html(),
options = editor.options,
updateTextAreaCallback = options.updateTextArea,
$area = editor.$area;
// Check for iframe change to avoid unnecessary firing
// of potentially heavy updateTextArea c... | [
"function",
"updateTextArea",
"(",
"editor",
",",
"checkForChange",
")",
"{",
"var",
"html",
"=",
"$",
"(",
"editor",
".",
"doc",
".",
"body",
")",
".",
"html",
"(",
")",
",",
"options",
"=",
"editor",
".",
"options",
",",
"updateTextAreaCallback",
"=",
... | updateTextArea - updates the textarea with the iframe contents | [
"updateTextArea",
"-",
"updates",
"the",
"textarea",
"with",
"the",
"iframe",
"contents"
] | 0c6333977224d8f4ef7ad40415aa69e0ff76f7b5 | https://github.com/tnantoka/LooseLeaf/blob/0c6333977224d8f4ef7ad40415aa69e0ff76f7b5/skeleton/public/javascripts/lib/cleditor/jquery.cleditor.js#L1101-L1130 | train |
redisjs/jsr-server | lib/response.js | send | function send(err, reply, cb) {
// invoke before function, used to end a slowlog
// timer before sending output
if(this.before) this.before();
if(this.cb) {
return this.cb(err, reply);
}
this.conn.write(err || reply, cb);
} | javascript | function send(err, reply, cb) {
// invoke before function, used to end a slowlog
// timer before sending output
if(this.before) this.before();
if(this.cb) {
return this.cb(err, reply);
}
this.conn.write(err || reply, cb);
} | [
"function",
"send",
"(",
"err",
",",
"reply",
",",
"cb",
")",
"{",
"// invoke before function, used to end a slowlog",
"// timer before sending output",
"if",
"(",
"this",
".",
"before",
")",
"this",
".",
"before",
"(",
")",
";",
"if",
"(",
"this",
".",
"cb",
... | Send a response to the client that made the request.
@param err An error instance.
@param reply A reply array, string, integer or null.
@param cb A write callback. | [
"Send",
"a",
"response",
"to",
"the",
"client",
"that",
"made",
"the",
"request",
"."
] | 49413052d3039524fbdd2ade0ef9bae26cb4d647 | https://github.com/redisjs/jsr-server/blob/49413052d3039524fbdd2ade0ef9bae26cb4d647/lib/response.js#L29-L39 | train |
millionsjs/millions | src/webgl/vertgen.js | genCap | function genCap(point, ux, uy, v1i, v2i, pushVert, pushIndices) {
if (!point.cap) {
genRoundedCap(point, ux, uy, v1i, v2i, pushVert, pushIndices);
} else {
switch (point.cap.type) {
case LineCaps.LINECAP_TYPE_ARROW:
genArrowCap(point, ux, uy, v1i, v2i, pushVert, pushI... | javascript | function genCap(point, ux, uy, v1i, v2i, pushVert, pushIndices) {
if (!point.cap) {
genRoundedCap(point, ux, uy, v1i, v2i, pushVert, pushIndices);
} else {
switch (point.cap.type) {
case LineCaps.LINECAP_TYPE_ARROW:
genArrowCap(point, ux, uy, v1i, v2i, pushVert, pushI... | [
"function",
"genCap",
"(",
"point",
",",
"ux",
",",
"uy",
",",
"v1i",
",",
"v2i",
",",
"pushVert",
",",
"pushIndices",
")",
"{",
"if",
"(",
"!",
"point",
".",
"cap",
")",
"{",
"genRoundedCap",
"(",
"point",
",",
"ux",
",",
"uy",
",",
"v1i",
",",
... | capgen shouldn't push more than two verts and 6 indices | [
"capgen",
"shouldn",
"t",
"push",
"more",
"than",
"two",
"verts",
"and",
"6",
"indices"
] | d56741bb5e88daf4cdebcec24c4ba542534d5d1a | https://github.com/millionsjs/millions/blob/d56741bb5e88daf4cdebcec24c4ba542534d5d1a/src/webgl/vertgen.js#L65-L87 | train |
sendanor/nor-nopg | src/schema/v0033.js | function(db) {
var views_uuid = uuid();
debug.assert(views_uuid).is('uuid');
return db.query('CREATE SEQUENCE views_seq')
.query(['CREATE TABLE IF NOT EXISTS views (',
" id uuid PRIMARY KEY NOT NULL default uuid_generate_v5('"+views_uuid+"', nextval('views_seq'::regclass)::text),",
' types_id uuid R... | javascript | function(db) {
var views_uuid = uuid();
debug.assert(views_uuid).is('uuid');
return db.query('CREATE SEQUENCE views_seq')
.query(['CREATE TABLE IF NOT EXISTS views (',
" id uuid PRIMARY KEY NOT NULL default uuid_generate_v5('"+views_uuid+"', nextval('views_seq'::regclass)::text),",
' types_id uuid R... | [
"function",
"(",
"db",
")",
"{",
"var",
"views_uuid",
"=",
"uuid",
"(",
")",
";",
"debug",
".",
"assert",
"(",
"views_uuid",
")",
".",
"is",
"(",
"'uuid'",
")",
";",
"return",
"db",
".",
"query",
"(",
"'CREATE SEQUENCE views_seq'",
")",
".",
"query",
... | The views table | [
"The",
"views",
"table"
] | 0d99b86c1a1996b5828b56de8de23700df8bbc0c | https://github.com/sendanor/nor-nopg/blob/0d99b86c1a1996b5828b56de8de23700df8bbc0c/src/schema/v0033.js#L11-L35 | train | |
yadirhb/vitruvio | source/src/System/EventManager.js | function (target, eventName, listener, useCapture) {
var ver = System.utils.UserAgent.IE.getVersion();
if (is(target, System.EventEmitter)) {
target.on(eventName, listener, useCapture);
} else if ((ver != -1 && ver <= 8) || is(target, Element)) {
if (ver != -1 && ver < 11... | javascript | function (target, eventName, listener, useCapture) {
var ver = System.utils.UserAgent.IE.getVersion();
if (is(target, System.EventEmitter)) {
target.on(eventName, listener, useCapture);
} else if ((ver != -1 && ver <= 8) || is(target, Element)) {
if (ver != -1 && ver < 11... | [
"function",
"(",
"target",
",",
"eventName",
",",
"listener",
",",
"useCapture",
")",
"{",
"var",
"ver",
"=",
"System",
".",
"utils",
".",
"UserAgent",
".",
"IE",
".",
"getVersion",
"(",
")",
";",
"if",
"(",
"is",
"(",
"target",
",",
"System",
".",
... | Adds a listener to the specified target.
@param target {Object} The target which will be observed.
@param eventName {String} The event name.
@param listener {Function} The listener instance.
@param useCapture {Boolean} True to use capture or False otherwise.
@returns Target object for chaining. | [
"Adds",
"a",
"listener",
"to",
"the",
"specified",
"target",
"."
] | 2cb640e31bedfb554e6766e1e5c61fbb14226b3b | https://github.com/yadirhb/vitruvio/blob/2cb640e31bedfb554e6766e1e5c61fbb14226b3b/source/src/System/EventManager.js#L14-L24 | train | |
philipbordallo/eslint-config | src/utilities/combineRules.js | combineRules | async function combineRules(rulesList) {
return Object.keys(rulesList)
.reduce(async (collection, definitions) => {
const isEnabled = rulesList[definitions];
let { default: rules } = await import(`../rules/${definitions}`);
if (!isEnabled) rules = await disableRules(rules);
const previou... | javascript | async function combineRules(rulesList) {
return Object.keys(rulesList)
.reduce(async (collection, definitions) => {
const isEnabled = rulesList[definitions];
let { default: rules } = await import(`../rules/${definitions}`);
if (!isEnabled) rules = await disableRules(rules);
const previou... | [
"async",
"function",
"combineRules",
"(",
"rulesList",
")",
"{",
"return",
"Object",
".",
"keys",
"(",
"rulesList",
")",
".",
"reduce",
"(",
"async",
"(",
"collection",
",",
"definitions",
")",
"=>",
"{",
"const",
"isEnabled",
"=",
"rulesList",
"[",
"defin... | Combine all the rules of the rules list given
@param {Object} rulesList – A list of rules to use
@returns {Promise} A promise to return a combined list of all rules | [
"Combine",
"all",
"the",
"rules",
"of",
"the",
"rules",
"list",
"given"
] | a2f1bff442fdb8ee622f842f075fa10d555302a4 | https://github.com/philipbordallo/eslint-config/blob/a2f1bff442fdb8ee622f842f075fa10d555302a4/src/utilities/combineRules.js#L9-L24 | train |
tjmehta/request-to-json | index.js | reqToJSON | function reqToJSON (req, additional) {
additional = additional || []
if (additional === true) {
additional = [
'rawHeaders',
'rawTrailers',
// express/koa
'fresh',
'cookies',
'ip',
'ips',
'stale',
'subdomains'
]
}
var keys = [
'body',
'header... | javascript | function reqToJSON (req, additional) {
additional = additional || []
if (additional === true) {
additional = [
'rawHeaders',
'rawTrailers',
// express/koa
'fresh',
'cookies',
'ip',
'ips',
'stale',
'subdomains'
]
}
var keys = [
'body',
'header... | [
"function",
"reqToJSON",
"(",
"req",
",",
"additional",
")",
"{",
"additional",
"=",
"additional",
"||",
"[",
"]",
"if",
"(",
"additional",
"===",
"true",
")",
"{",
"additional",
"=",
"[",
"'rawHeaders'",
",",
"'rawTrailers'",
",",
"// express/koa",
"'fresh'... | return a json representation of a request
@param {IncomingMessage} req request (client incoming-message or client-request)
@param {Array} additional additional properties to pick from request
@return {Object} resJSON | [
"return",
"a",
"json",
"representation",
"of",
"a",
"request"
] | c923b13c84e718e509132d27e741666c77bb7cbf | https://github.com/tjmehta/request-to-json/blob/c923b13c84e718e509132d27e741666c77bb7cbf/index.js#L14-L46 | train |
on-point/thin-orm | join.js | Join | function Join(name) {
this.name = name;
this.criteria = null;
this.table = null;
this.map = null;
this.type = this.ONE_TO_ONE;
this.default = false;
} | javascript | function Join(name) {
this.name = name;
this.criteria = null;
this.table = null;
this.map = null;
this.type = this.ONE_TO_ONE;
this.default = false;
} | [
"function",
"Join",
"(",
"name",
")",
"{",
"this",
".",
"name",
"=",
"name",
";",
"this",
".",
"criteria",
"=",
"null",
";",
"this",
".",
"table",
"=",
"null",
";",
"this",
".",
"map",
"=",
"null",
";",
"this",
".",
"type",
"=",
"this",
".",
"O... | a join model | [
"a",
"join",
"model"
] | 761783a133ef6983f46060af68febc07e1f880e8 | https://github.com/on-point/thin-orm/blob/761783a133ef6983f46060af68febc07e1f880e8/join.js#L2-L9 | train |
tolokoban/ToloFrameWork | lib/compiler-js.js | compileDEP | function compileDEP( project, src, watch ) {
const
moduleName = src.name(),
depFilename = Util.replaceExtension( moduleName, '.dep' );
if ( !project.srcOrLibPath( depFilename ) ) return '';
const depFile = new Source( project, depFilename );
let code = '';
try {
const depJSON = Tol... | javascript | function compileDEP( project, src, watch ) {
const
moduleName = src.name(),
depFilename = Util.replaceExtension( moduleName, '.dep' );
if ( !project.srcOrLibPath( depFilename ) ) return '';
const depFile = new Source( project, depFilename );
let code = '';
try {
const depJSON = Tol... | [
"function",
"compileDEP",
"(",
"project",
",",
"src",
",",
"watch",
")",
"{",
"const",
"moduleName",
"=",
"src",
".",
"name",
"(",
")",
",",
"depFilename",
"=",
"Util",
".",
"replaceExtension",
"(",
"moduleName",
",",
"'.dep'",
")",
";",
"if",
"(",
"!"... | DEP file is here to load GLOBAL variable into the module.
@param {Project} project - Current project.
@param {Source} src - Module source file.
@param {array} watch - Array of files to watch for rebuild.
@returns {string} Javascript defining the const variable GLOBAL. | [
"DEP",
"file",
"is",
"here",
"to",
"load",
"GLOBAL",
"variable",
"into",
"the",
"module",
"."
] | 730845a833a9660ebfdb60ad027ebaab5ac871b6 | https://github.com/tolokoban/ToloFrameWork/blob/730845a833a9660ebfdb60ad027ebaab5ac871b6/lib/compiler-js.js#L120-L142 | train |
tolokoban/ToloFrameWork | lib/compiler-js.js | processAttributeVar | function processAttributeVar( project, depJSON, watch, depAbsPath ) {
if ( typeof depJSON.var === 'undefined' ) return '';
let
head = 'const GLOBAL = {',
firstItem = true;
Object.keys( depJSON.var ).forEach( function forEachVarName( varName ) {
const
varFilename = depJSON.var[ varN... | javascript | function processAttributeVar( project, depJSON, watch, depAbsPath ) {
if ( typeof depJSON.var === 'undefined' ) return '';
let
head = 'const GLOBAL = {',
firstItem = true;
Object.keys( depJSON.var ).forEach( function forEachVarName( varName ) {
const
varFilename = depJSON.var[ varN... | [
"function",
"processAttributeVar",
"(",
"project",
",",
"depJSON",
",",
"watch",
",",
"depAbsPath",
")",
"{",
"if",
"(",
"typeof",
"depJSON",
".",
"var",
"===",
"'undefined'",
")",
"return",
"''",
";",
"let",
"head",
"=",
"'const GLOBAL = {'",
",",
"firstIte... | In the DEP file, we can find the attribute "var".
It will load text file contents into the GLOBAL variable of the module.
@param {Project} project - Current project.
@param {objetc} depJSON - Parsing of the JSON DEP file.
@param {array} watch - Array of files to watch for rebuild.
@param {string} depAbsPath - Absolute ... | [
"In",
"the",
"DEP",
"file",
"we",
"can",
"find",
"the",
"attribute",
"var",
".",
"It",
"will",
"load",
"text",
"file",
"contents",
"into",
"the",
"GLOBAL",
"variable",
"of",
"the",
"module",
"."
] | 730845a833a9660ebfdb60ad027ebaab5ac871b6 | https://github.com/tolokoban/ToloFrameWork/blob/730845a833a9660ebfdb60ad027ebaab5ac871b6/lib/compiler-js.js#L154-L187 | train |
tblobaum/fleet-panel | public/bundle.js | filtered | function filtered(js) {
return js.substr(1).split('|').reduce(function(js, filter){
var parts = filter.split(':')
, name = parts.shift()
, args = parts.shift() || '';
if (args) args = ', ' + args;
return 'filters.' + name + '(' + js + args + ')';
});
} | javascript | function filtered(js) {
return js.substr(1).split('|').reduce(function(js, filter){
var parts = filter.split(':')
, name = parts.shift()
, args = parts.shift() || '';
if (args) args = ', ' + args;
return 'filters.' + name + '(' + js + args + ')';
});
} | [
"function",
"filtered",
"(",
"js",
")",
"{",
"return",
"js",
".",
"substr",
"(",
"1",
")",
".",
"split",
"(",
"'|'",
")",
".",
"reduce",
"(",
"function",
"(",
"js",
",",
"filter",
")",
"{",
"var",
"parts",
"=",
"filter",
".",
"split",
"(",
"':'",... | Translate filtered code into function calls.
@param {String} js
@return {String}
@api private | [
"Translate",
"filtered",
"code",
"into",
"function",
"calls",
"."
] | 0ec0b4df68e54ff7b0b60c7d21b8d8520075bceb | https://github.com/tblobaum/fleet-panel/blob/0ec0b4df68e54ff7b0b60c7d21b8d8520075bceb/public/bundle.js#L4604-L4612 | train |
tblobaum/fleet-panel | public/bundle.js | resolveInclude | function resolveInclude(name, filename) {
var path = join(dirname(filename), name);
var ext = extname(name);
if (!ext) path += '.ejs';
return path;
} | javascript | function resolveInclude(name, filename) {
var path = join(dirname(filename), name);
var ext = extname(name);
if (!ext) path += '.ejs';
return path;
} | [
"function",
"resolveInclude",
"(",
"name",
",",
"filename",
")",
"{",
"var",
"path",
"=",
"join",
"(",
"dirname",
"(",
"filename",
")",
",",
"name",
")",
";",
"var",
"ext",
"=",
"extname",
"(",
"name",
")",
";",
"if",
"(",
"!",
"ext",
")",
"path",
... | Resolve include `name` relative to `filename`.
@param {String} name
@param {String} filename
@return {String}
@api private | [
"Resolve",
"include",
"name",
"relative",
"to",
"filename",
"."
] | 0ec0b4df68e54ff7b0b60c7d21b8d8520075bceb | https://github.com/tblobaum/fleet-panel/blob/0ec0b4df68e54ff7b0b60c7d21b8d8520075bceb/public/bundle.js#L4853-L4858 | train |
bentomas/node-async-testing | lib/console-runner.js | suiteFinished | function suiteFinished(suite, status, results) {
suite.finished = true;
suite.status = status;
suite.duration = new Date() - suite.startTime;
suite.results = results;
delete suite.startTime;
if (suite.index == finishedIndex) {
for (var i = finishedIndex; i < suites.length; i++) {
... | javascript | function suiteFinished(suite, status, results) {
suite.finished = true;
suite.status = status;
suite.duration = new Date() - suite.startTime;
suite.results = results;
delete suite.startTime;
if (suite.index == finishedIndex) {
for (var i = finishedIndex; i < suites.length; i++) {
... | [
"function",
"suiteFinished",
"(",
"suite",
",",
"status",
",",
"results",
")",
"{",
"suite",
".",
"finished",
"=",
"true",
";",
"suite",
".",
"status",
"=",
"status",
";",
"suite",
".",
"duration",
"=",
"new",
"Date",
"(",
")",
"-",
"suite",
".",
"st... | we want to output the suite results in the order they were given to us, so as suties finish we buffer them, and then output them in the right order when we can | [
"we",
"want",
"to",
"output",
"the",
"suite",
"results",
"in",
"the",
"order",
"they",
"were",
"given",
"to",
"us",
"so",
"as",
"suties",
"finish",
"we",
"buffer",
"them",
"and",
"then",
"output",
"them",
"in",
"the",
"right",
"order",
"when",
"we",
"c... | 82384ba4b8444e4659464bad661788827ea721aa | https://github.com/bentomas/node-async-testing/blob/82384ba4b8444e4659464bad661788827ea721aa/lib/console-runner.js#L127-L154 | train |
BugBusterSWE/burstmake | src/solver.js | function ( config, actual ) {
// In this way, if any topic declare the compilerOptions this will not
// include in the tsconfig.json
if ( actual.compilerOptions !== undefined ) {
if ( config.compilerOptions === undefined ) {
// Attach an empty object
config.compilerOptions = {};
}
// In the ... | javascript | function ( config, actual ) {
// In this way, if any topic declare the compilerOptions this will not
// include in the tsconfig.json
if ( actual.compilerOptions !== undefined ) {
if ( config.compilerOptions === undefined ) {
// Attach an empty object
config.compilerOptions = {};
}
// In the ... | [
"function",
"(",
"config",
",",
"actual",
")",
"{",
"// In this way, if any topic declare the compilerOptions this will not",
"// include in the tsconfig.json",
"if",
"(",
"actual",
".",
"compilerOptions",
"!==",
"undefined",
")",
"{",
"if",
"(",
"config",
".",
"compilerO... | The function stored in buildRule tell as get the configuration in the actual level of hierarchy and how it integrate with them. | [
"The",
"function",
"stored",
"in",
"buildRule",
"tell",
"as",
"get",
"the",
"configuration",
"in",
"the",
"actual",
"level",
"of",
"hierarchy",
"and",
"how",
"it",
"integrate",
"with",
"them",
"."
] | 2027b650e451f49d1f9ef64af6038f93b4e744c5 | https://github.com/BugBusterSWE/burstmake/blob/2027b650e451f49d1f9ef64af6038f93b4e744c5/src/solver.js#L51-L126 | train | |
redisjs/jsr-exec | lib/database.js | proxy | function proxy(req, res) {
var method = req.db[req.cmd]
, args;
// append the request object to the args
// required so that database events can pass
// request and thereby connection information
// when emitting events by key, this allows
// transactional semantics
args = req.args.slice(0).concat(re... | javascript | function proxy(req, res) {
var method = req.db[req.cmd]
, args;
// append the request object to the args
// required so that database events can pass
// request and thereby connection information
// when emitting events by key, this allows
// transactional semantics
args = req.args.slice(0).concat(re... | [
"function",
"proxy",
"(",
"req",
",",
"res",
")",
"{",
"var",
"method",
"=",
"req",
".",
"db",
"[",
"req",
".",
"cmd",
"]",
",",
"args",
";",
"// append the request object to the args",
"// required so that database events can pass",
"// request and thereby connection... | Proxy command execution to a database method.
This method returns the reply from the database method
but does not send a reply to a client.
Sometimes command implementations may wish to operate on the reply
before returning to the client, typically to coerce a database response.
@param req The incoming request.
@par... | [
"Proxy",
"command",
"execution",
"to",
"a",
"database",
"method",
"."
] | aeaf62051b12487cf1c41125acacd03deb96d539 | https://github.com/redisjs/jsr-exec/blob/aeaf62051b12487cf1c41125acacd03deb96d539/lib/database.js#L27-L38 | train |
redisjs/jsr-exec | lib/database.js | execute | function execute(req, res) {
var proxy = req.exec ? req.exec.proxy : this.proxy;
res.send(null, proxy(req, res));
} | javascript | function execute(req, res) {
var proxy = req.exec ? req.exec.proxy : this.proxy;
res.send(null, proxy(req, res));
} | [
"function",
"execute",
"(",
"req",
",",
"res",
")",
"{",
"var",
"proxy",
"=",
"req",
".",
"exec",
"?",
"req",
".",
"exec",
".",
"proxy",
":",
"this",
".",
"proxy",
";",
"res",
".",
"send",
"(",
"null",
",",
"proxy",
"(",
"req",
",",
"res",
")",... | Abstract database command proxy.
@param req The incoming request.
@param res The outbound response. | [
"Abstract",
"database",
"command",
"proxy",
"."
] | aeaf62051b12487cf1c41125acacd03deb96d539 | https://github.com/redisjs/jsr-exec/blob/aeaf62051b12487cf1c41125acacd03deb96d539/lib/database.js#L46-L49 | train |
ENOW-IJI/ENOW-console | dist/src/util.js | function (model, values, functionPrefix) {
// for a string, see if it has parameter matches, and if so, try to make the substitutions.
var getValue = function (fromString) {
var matches = fromString.match(/(\${.*?})/g);
if (matches != null) {
... | javascript | function (model, values, functionPrefix) {
// for a string, see if it has parameter matches, and if so, try to make the substitutions.
var getValue = function (fromString) {
var matches = fromString.match(/(\${.*?})/g);
if (matches != null) {
... | [
"function",
"(",
"model",
",",
"values",
",",
"functionPrefix",
")",
"{",
"// for a string, see if it has parameter matches, and if so, try to make the substitutions.",
"var",
"getValue",
"=",
"function",
"(",
"fromString",
")",
"{",
"var",
"matches",
"=",
"fromString",
"... | take the given model and expand out any parameters. 'functionPrefix' is optional, and if present, helps jsplumb figure out what to do if a value is a Function. if you do not provide it, jsplumb will run the given values through any functions it finds, and use the function's output as the value in the result. if you do ... | [
"take",
"the",
"given",
"model",
"and",
"expand",
"out",
"any",
"parameters",
".",
"functionPrefix",
"is",
"optional",
"and",
"if",
"present",
"helps",
"jsplumb",
"figure",
"out",
"what",
"to",
"do",
"if",
"a",
"value",
"is",
"a",
"Function",
".",
"if",
... | f241ed4e645a7da0cd1a6ca86e896a5b73be53e5 | https://github.com/ENOW-IJI/ENOW-console/blob/f241ed4e645a7da0cd1a6ca86e896a5b73be53e5/dist/src/util.js#L187-L230 | train | |
IonicaBizau/barbe | lib/index.js | barbe | function barbe(text, arr, data) {
if (!Array.isArray(arr)) {
data = arr;
arr = ["{", "}"];
}
if (!data || data.constructor !== Object) {
return text;
}
arr = arr.map(regexEscape);
let deep = (obj, path) => {
iterateObject(obj, (value, c) => {
path.p... | javascript | function barbe(text, arr, data) {
if (!Array.isArray(arr)) {
data = arr;
arr = ["{", "}"];
}
if (!data || data.constructor !== Object) {
return text;
}
arr = arr.map(regexEscape);
let deep = (obj, path) => {
iterateObject(obj, (value, c) => {
path.p... | [
"function",
"barbe",
"(",
"text",
",",
"arr",
",",
"data",
")",
"{",
"if",
"(",
"!",
"Array",
".",
"isArray",
"(",
"arr",
")",
")",
"{",
"data",
"=",
"arr",
";",
"arr",
"=",
"[",
"\"{\"",
",",
"\"}\"",
"]",
";",
"}",
"if",
"(",
"!",
"data",
... | barbe
Renders the input template including the data.
@name barbe
@function
@param {String} text The template text.
@param {Array} arr An array of two elements: the first one being the start snippet (default: `"{"`) and the second one being the end snippet (default: `"}"`).
@param {Object} data The template data.
@retu... | [
"barbe",
"Renders",
"the",
"input",
"template",
"including",
"the",
"data",
"."
] | 6b3822ca9e166b2b99996d1a5c70f05fb20ff501 | https://github.com/IonicaBizau/barbe/blob/6b3822ca9e166b2b99996d1a5c70f05fb20ff501/lib/index.js#L19-L50 | train |
robotlolita/specify-reporter-spec | index.js | pad | function pad(n, s) {
var before = Array(n + 1).join(' ')
return s.split(/\r\n|\r|\n/)
.map(function(a){ return before + a })
.join('\n')
} | javascript | function pad(n, s) {
var before = Array(n + 1).join(' ')
return s.split(/\r\n|\r|\n/)
.map(function(a){ return before + a })
.join('\n')
} | [
"function",
"pad",
"(",
"n",
",",
"s",
")",
"{",
"var",
"before",
"=",
"Array",
"(",
"n",
"+",
"1",
")",
".",
"join",
"(",
"' '",
")",
"return",
"s",
".",
"split",
"(",
"/",
"\\r\\n|\\r|\\n",
"/",
")",
".",
"map",
"(",
"function",
"(",
"a",
"... | Pads a String with some whitespace.
@summary Number, String → String | [
"Pads",
"a",
"String",
"with",
"some",
"whitespace",
"."
] | 1e1f9ae8e0b3481783295df1de1e07f4a7d75648 | https://github.com/robotlolita/specify-reporter-spec/blob/1e1f9ae8e0b3481783295df1de1e07f4a7d75648/index.js#L29-L35 | train |
robotlolita/specify-reporter-spec | index.js | maybeRenderSuite | function maybeRenderSuite(signal) { return function(a) {
return a.cata({
Suite: function(){ return Just([signal.path.length, a.name]) }
, Case: Nothing
})
}} | javascript | function maybeRenderSuite(signal) { return function(a) {
return a.cata({
Suite: function(){ return Just([signal.path.length, a.name]) }
, Case: Nothing
})
}} | [
"function",
"maybeRenderSuite",
"(",
"signal",
")",
"{",
"return",
"function",
"(",
"a",
")",
"{",
"return",
"a",
".",
"cata",
"(",
"{",
"Suite",
":",
"function",
"(",
")",
"{",
"return",
"Just",
"(",
"[",
"signal",
".",
"path",
".",
"length",
",",
... | Shows that a suite has started.
@summary Signal → Test → Maybe[(Int, String)] | [
"Shows",
"that",
"a",
"suite",
"has",
"started",
"."
] | 1e1f9ae8e0b3481783295df1de1e07f4a7d75648 | https://github.com/robotlolita/specify-reporter-spec/blob/1e1f9ae8e0b3481783295df1de1e07f4a7d75648/index.js#L52-L57 | train |
robotlolita/specify-reporter-spec | index.js | logs | function logs(a) {
return a.isIgnored? ''
: a.log.length === 0? ''
: /* otherwise */ '\n' + pad( 2
, '=== Captured logs:\n'
+ a.log.map(function(x){
return faded('- '... | javascript | function logs(a) {
return a.isIgnored? ''
: a.log.length === 0? ''
: /* otherwise */ '\n' + pad( 2
, '=== Captured logs:\n'
+ a.log.map(function(x){
return faded('- '... | [
"function",
"logs",
"(",
"a",
")",
"{",
"return",
"a",
".",
"isIgnored",
"?",
"''",
":",
"a",
".",
"log",
".",
"length",
"===",
"0",
"?",
"''",
":",
"/* otherwise */",
"'\\n'",
"+",
"pad",
"(",
"2",
",",
"'=== Captured logs:\\n'",
"+",
"a",
".",
"l... | Shows the logs of a result
@summary Result → String | [
"Shows",
"the",
"logs",
"of",
"a",
"result"
] | 1e1f9ae8e0b3481783295df1de1e07f4a7d75648 | https://github.com/robotlolita/specify-reporter-spec/blob/1e1f9ae8e0b3481783295df1de1e07f4a7d75648/index.js#L64-L72 | train |
Psychopoulet/node-promfs | lib/extends/_filesToFile.js | _filesToFile | function _filesToFile (files, target, separator, callback) {
if ("undefined" === typeof files) {
throw new ReferenceError("missing \"files\" argument");
}
else if ("object" !== typeof files || !(files instanceof Array)) {
throw new TypeError("\"files\" argument is not an Array");
}
else if ("... | javascript | function _filesToFile (files, target, separator, callback) {
if ("undefined" === typeof files) {
throw new ReferenceError("missing \"files\" argument");
}
else if ("object" !== typeof files || !(files instanceof Array)) {
throw new TypeError("\"files\" argument is not an Array");
}
else if ("... | [
"function",
"_filesToFile",
"(",
"files",
",",
"target",
",",
"separator",
",",
"callback",
")",
"{",
"if",
"(",
"\"undefined\"",
"===",
"typeof",
"files",
")",
"{",
"throw",
"new",
"ReferenceError",
"(",
"\"missing \\\"files\\\" argument\"",
")",
";",
"}",
"e... | methods
Async filesToFile
@param {Array} files : files to read
@param {string} target : file to write in
@param {string} separator : files separator
@param {function|null} callback : operation's result
@returns {void} | [
"methods",
"Async",
"filesToFile"
] | 016e272fc58c6ef6eae5ea551a0e8873f0ac20cc | https://github.com/Psychopoulet/node-promfs/blob/016e272fc58c6ef6eae5ea551a0e8873f0ac20cc/lib/extends/_filesToFile.js#L29-L118 | train |
Psychopoulet/node-promfs | lib/extends/_rmdirp.js | _removeDirectoryContentProm | function _removeDirectoryContentProm (contents) {
const content = contents.shift();
return isDirectoryProm(content).then((exists) => {
return exists ? new Promise((resolve, reject) => {
_rmdirp(content, (err) => {
return err ? reject(err) : resolve();
});
}) : new Promise((resolve, re... | javascript | function _removeDirectoryContentProm (contents) {
const content = contents.shift();
return isDirectoryProm(content).then((exists) => {
return exists ? new Promise((resolve, reject) => {
_rmdirp(content, (err) => {
return err ? reject(err) : resolve();
});
}) : new Promise((resolve, re... | [
"function",
"_removeDirectoryContentProm",
"(",
"contents",
")",
"{",
"const",
"content",
"=",
"contents",
".",
"shift",
"(",
")",
";",
"return",
"isDirectoryProm",
"(",
"content",
")",
".",
"then",
"(",
"(",
"exists",
")",
"=>",
"{",
"return",
"exists",
"... | methods
Remove directory's content
@param {Array} contents : directory content
@returns {Promise}: Operation's result | [
"methods",
"Remove",
"directory",
"s",
"content"
] | 016e272fc58c6ef6eae5ea551a0e8873f0ac20cc | https://github.com/Psychopoulet/node-promfs/blob/016e272fc58c6ef6eae5ea551a0e8873f0ac20cc/lib/extends/_rmdirp.js#L25-L49 | train |
Psychopoulet/node-promfs | lib/extends/_rmdirp.js | _emptyDirectoryProm | function _emptyDirectoryProm (directory) {
return new Promise((resolve, reject) => {
readdir(directory, (err, files) => {
return err ? reject(err) : resolve(files);
});
}).then((files) => {
const result = [];
for (let i = 0; i < files.length; ++i) {
result.push(join(directory, fil... | javascript | function _emptyDirectoryProm (directory) {
return new Promise((resolve, reject) => {
readdir(directory, (err, files) => {
return err ? reject(err) : resolve(files);
});
}).then((files) => {
const result = [];
for (let i = 0; i < files.length; ++i) {
result.push(join(directory, fil... | [
"function",
"_emptyDirectoryProm",
"(",
"directory",
")",
"{",
"return",
"new",
"Promise",
"(",
"(",
"resolve",
",",
"reject",
")",
"=>",
"{",
"readdir",
"(",
"directory",
",",
"(",
"err",
",",
"files",
")",
"=>",
"{",
"return",
"err",
"?",
"reject",
"... | Async empty directory
@param {string} directory : directory path
@returns {Promise}: Operation's result | [
"Async",
"empty",
"directory"
] | 016e272fc58c6ef6eae5ea551a0e8873f0ac20cc | https://github.com/Psychopoulet/node-promfs/blob/016e272fc58c6ef6eae5ea551a0e8873f0ac20cc/lib/extends/_rmdirp.js#L56-L78 | train |
tnantoka/LooseLeaf | skeleton/public/javascripts/lib/cleditor/plugins/jquery.cleditor.xhtml.js | parseEndTag | function parseEndTag(tag, tagName) {
// If no tag name is provided, clean shop
if (!tagName)
var pos = 0;
// Find the closest opened tag of the same type
else {
tagName = tagName.toLowerCase();
for (var pos = stack.length - 1; pos >= 0; pos--)
if (st... | javascript | function parseEndTag(tag, tagName) {
// If no tag name is provided, clean shop
if (!tagName)
var pos = 0;
// Find the closest opened tag of the same type
else {
tagName = tagName.toLowerCase();
for (var pos = stack.length - 1; pos >= 0; pos--)
if (st... | [
"function",
"parseEndTag",
"(",
"tag",
",",
"tagName",
")",
"{",
"// If no tag name is provided, clean shop\r",
"if",
"(",
"!",
"tagName",
")",
"var",
"pos",
"=",
"0",
";",
"// Find the closest opened tag of the same type\r",
"else",
"{",
"tagName",
"=",
"tagName",
... | parseEndTag - handles a closing tag | [
"parseEndTag",
"-",
"handles",
"a",
"closing",
"tag"
] | 0c6333977224d8f4ef7ad40415aa69e0ff76f7b5 | https://github.com/tnantoka/LooseLeaf/blob/0c6333977224d8f4ef7ad40415aa69e0ff76f7b5/skeleton/public/javascripts/lib/cleditor/plugins/jquery.cleditor.xhtml.js#L198-L221 | train |
kaelzhang/node-multi-profile | index.js | Profile | function Profile(options) {
this.path = node_path.resolve(profile.resolveHomePath(options.path));
this.schema = options.schema;
this.context = options.context || null;
this.raw_data = {};
this.codec = this._get_codec(options.codec);
this.options = options;
} | javascript | function Profile(options) {
this.path = node_path.resolve(profile.resolveHomePath(options.path));
this.schema = options.schema;
this.context = options.context || null;
this.raw_data = {};
this.codec = this._get_codec(options.codec);
this.options = options;
} | [
"function",
"Profile",
"(",
"options",
")",
"{",
"this",
".",
"path",
"=",
"node_path",
".",
"resolve",
"(",
"profile",
".",
"resolveHomePath",
"(",
"options",
".",
"path",
")",
")",
";",
"this",
".",
"schema",
"=",
"options",
".",
"schema",
";",
"this... | Constructor of Profile has no fault-tolerance, make sure you pass the right parameters @param {Object} options - path: {node_path} path to save the profiles | [
"Constructor",
"of",
"Profile",
"has",
"no",
"fault",
"-",
"tolerance",
"make",
"sure",
"you",
"pass",
"the",
"right",
"parameters"
] | c801e3f3fd2d17b4495f0eed9af3efd72df3304d | https://github.com/kaelzhang/node-multi-profile/blob/c801e3f3fd2d17b4495f0eed9af3efd72df3304d/index.js#L87-L95 | train |
kaelzhang/node-multi-profile | index.js | function(name, force, callback) {
var err = null;
var profiles = this.all();
if (~profiles.indexOf(name)) {
err = 'Profile "' + name + '" already exists.';
} else if (!force && ~RESERVED_PROFILE_NAME.indexOf(name)) {
err = 'Profile name "' + name + '" is reserved by `multi-profile`';
... | javascript | function(name, force, callback) {
var err = null;
var profiles = this.all();
if (~profiles.indexOf(name)) {
err = 'Profile "' + name + '" already exists.';
} else if (!force && ~RESERVED_PROFILE_NAME.indexOf(name)) {
err = 'Profile name "' + name + '" is reserved by `multi-profile`';
... | [
"function",
"(",
"name",
",",
"force",
",",
"callback",
")",
"{",
"var",
"err",
"=",
"null",
";",
"var",
"profiles",
"=",
"this",
".",
"all",
"(",
")",
";",
"if",
"(",
"~",
"profiles",
".",
"indexOf",
"(",
"name",
")",
")",
"{",
"err",
"=",
"'P... | Add a new profile. Adding a profile will not do nothing about initialization | [
"Add",
"a",
"new",
"profile",
".",
"Adding",
"a",
"profile",
"will",
"not",
"do",
"nothing",
"about",
"initialization"
] | c801e3f3fd2d17b4495f0eed9af3efd72df3304d | https://github.com/kaelzhang/node-multi-profile/blob/c801e3f3fd2d17b4495f0eed9af3efd72df3304d/index.js#L233-L258 | train | |
kaelzhang/node-multi-profile | index.js | function(name) {
this.profile = trait(Object.create(this.schema), {
context: this.context
});
var profile_dir = this.profile_dir = node_path.join(this.path, name);
if (!fs.isDir(profile_dir)) {
fs.mkdir(profile_dir);
}
var profile_file = this.profile_file = node_path.join(profile_... | javascript | function(name) {
this.profile = trait(Object.create(this.schema), {
context: this.context
});
var profile_dir = this.profile_dir = node_path.join(this.path, name);
if (!fs.isDir(profile_dir)) {
fs.mkdir(profile_dir);
}
var profile_file = this.profile_file = node_path.join(profile_... | [
"function",
"(",
"name",
")",
"{",
"this",
".",
"profile",
"=",
"trait",
"(",
"Object",
".",
"create",
"(",
"this",
".",
"schema",
")",
",",
"{",
"context",
":",
"this",
".",
"context",
"}",
")",
";",
"var",
"profile_dir",
"=",
"this",
".",
"profil... | Initialize the current profile, and create necessary files and dirs if not exists. Initialize properties of current profile | [
"Initialize",
"the",
"current",
"profile",
"and",
"create",
"necessary",
"files",
"and",
"dirs",
"if",
"not",
"exists",
".",
"Initialize",
"properties",
"of",
"current",
"profile"
] | c801e3f3fd2d17b4495f0eed9af3efd72df3304d | https://github.com/kaelzhang/node-multi-profile/blob/c801e3f3fd2d17b4495f0eed9af3efd72df3304d/index.js#L423-L442 | train | |
pimbrouwers/ditto-hbs | src/index.js | discover | function discover(pattern, callback) {
glob(pattern, function (err, filepaths) {
if (err) callback(err);
callback(null, filepaths);
});
} | javascript | function discover(pattern, callback) {
glob(pattern, function (err, filepaths) {
if (err) callback(err);
callback(null, filepaths);
});
} | [
"function",
"discover",
"(",
"pattern",
",",
"callback",
")",
"{",
"glob",
"(",
"pattern",
",",
"function",
"(",
"err",
",",
"filepaths",
")",
"{",
"if",
"(",
"err",
")",
"callback",
"(",
"err",
")",
";",
"callback",
"(",
"null",
",",
"filepaths",
")... | Discover files for given file pattern
@param {String} pattern glob pattern
@param {Function.<Error, Array.<string>>} callback | [
"Discover",
"files",
"for",
"given",
"file",
"pattern"
] | 50c7af39b51d9fd4bd627ea7a0ccebc62da8dc74 | https://github.com/pimbrouwers/ditto-hbs/blob/50c7af39b51d9fd4bd627ea7a0ccebc62da8dc74/src/index.js#L23-L28 | train |
pimbrouwers/ditto-hbs | src/index.js | registerPartials | function registerPartials(filepaths, callback) {
async.map(filepaths, registerPartial, function (err) {
if (err) callback(err);
callback(null);
});
} | javascript | function registerPartials(filepaths, callback) {
async.map(filepaths, registerPartial, function (err) {
if (err) callback(err);
callback(null);
});
} | [
"function",
"registerPartials",
"(",
"filepaths",
",",
"callback",
")",
"{",
"async",
".",
"map",
"(",
"filepaths",
",",
"registerPartial",
",",
"function",
"(",
"err",
")",
"{",
"if",
"(",
"err",
")",
"callback",
"(",
"err",
")",
";",
"callback",
"(",
... | Read hbs partial files
@param {Array.<String>} filepaths
@param {Function.<Error>} callback | [
"Read",
"hbs",
"partial",
"files"
] | 50c7af39b51d9fd4bd627ea7a0ccebc62da8dc74 | https://github.com/pimbrouwers/ditto-hbs/blob/50c7af39b51d9fd4bd627ea7a0ccebc62da8dc74/src/index.js#L51-L56 | train |
pimbrouwers/ditto-hbs | src/index.js | registerPartial | function registerPartial(filepath, callback) {
fs.readFile(filepath, 'utf8', function (err, data) {
if (err) callback(err);
hbs.registerPartial(path.parse(filepath).name, data);
callback(null);
});
} | javascript | function registerPartial(filepath, callback) {
fs.readFile(filepath, 'utf8', function (err, data) {
if (err) callback(err);
hbs.registerPartial(path.parse(filepath).name, data);
callback(null);
});
} | [
"function",
"registerPartial",
"(",
"filepath",
",",
"callback",
")",
"{",
"fs",
".",
"readFile",
"(",
"filepath",
",",
"'utf8'",
",",
"function",
"(",
"err",
",",
"data",
")",
"{",
"if",
"(",
"err",
")",
"callback",
"(",
"err",
")",
";",
"hbs",
".",... | Read file into buffer and register as hbs partials
@param {String} filepath
@param {Function.<Error>} callback | [
"Read",
"file",
"into",
"buffer",
"and",
"register",
"as",
"hbs",
"partials"
] | 50c7af39b51d9fd4bd627ea7a0ccebc62da8dc74 | https://github.com/pimbrouwers/ditto-hbs/blob/50c7af39b51d9fd4bd627ea7a0ccebc62da8dc74/src/index.js#L63-L69 | train |
pimbrouwers/ditto-hbs | src/index.js | registerTemplates | function registerTemplates(filepaths, callback) {
async.map(filepaths, registerTemplate, function (err, templates) {
if (err) callback(err);
callback(null, templates);
});
} | javascript | function registerTemplates(filepaths, callback) {
async.map(filepaths, registerTemplate, function (err, templates) {
if (err) callback(err);
callback(null, templates);
});
} | [
"function",
"registerTemplates",
"(",
"filepaths",
",",
"callback",
")",
"{",
"async",
".",
"map",
"(",
"filepaths",
",",
"registerTemplate",
",",
"function",
"(",
"err",
",",
"templates",
")",
"{",
"if",
"(",
"err",
")",
"callback",
"(",
"err",
")",
";"... | Read hbs template files
@param {Array.<String>} filepaths
@param {Function.<Error>} callback | [
"Read",
"hbs",
"template",
"files"
] | 50c7af39b51d9fd4bd627ea7a0ccebc62da8dc74 | https://github.com/pimbrouwers/ditto-hbs/blob/50c7af39b51d9fd4bd627ea7a0ccebc62da8dc74/src/index.js#L76-L81 | train |
pimbrouwers/ditto-hbs | src/index.js | registerTemplate | function registerTemplate(filepath, callback) {
fs.readFile(filepath, 'utf8', function (err, data) {
if (err) callback(err);
callback(null, {
name: path.parse(filepath).name,
template: hbs.compile(data)
});
});
} | javascript | function registerTemplate(filepath, callback) {
fs.readFile(filepath, 'utf8', function (err, data) {
if (err) callback(err);
callback(null, {
name: path.parse(filepath).name,
template: hbs.compile(data)
});
});
} | [
"function",
"registerTemplate",
"(",
"filepath",
",",
"callback",
")",
"{",
"fs",
".",
"readFile",
"(",
"filepath",
",",
"'utf8'",
",",
"function",
"(",
"err",
",",
"data",
")",
"{",
"if",
"(",
"err",
")",
"callback",
"(",
"err",
")",
";",
"callback",
... | Read file into buffer and register as hbs template
@param {String} filepath
@param {Function.<Error, Object>} callback | [
"Read",
"file",
"into",
"buffer",
"and",
"register",
"as",
"hbs",
"template"
] | 50c7af39b51d9fd4bd627ea7a0ccebc62da8dc74 | https://github.com/pimbrouwers/ditto-hbs/blob/50c7af39b51d9fd4bd627ea7a0ccebc62da8dc74/src/index.js#L88-L96 | train |
ChALkeR/Jergal | lib/versions.js | satisfies | function satisfies(version, range) {
range = range.trim();
// Range '<=99.999.99999' means "all versions", but fails on "2014.10.20-1"
if (range === '<=99.999.99999') return true;
// If semver satisfies, we return true
if (semver.satisfies(version, range)) return true;
// If range is a specific version, ... | javascript | function satisfies(version, range) {
range = range.trim();
// Range '<=99.999.99999' means "all versions", but fails on "2014.10.20-1"
if (range === '<=99.999.99999') return true;
// If semver satisfies, we return true
if (semver.satisfies(version, range)) return true;
// If range is a specific version, ... | [
"function",
"satisfies",
"(",
"version",
",",
"range",
")",
"{",
"range",
"=",
"range",
".",
"trim",
"(",
")",
";",
"// Range '<=99.999.99999' means \"all versions\", but fails on \"2014.10.20-1\"",
"if",
"(",
"range",
"===",
"'<=99.999.99999'",
")",
"return",
"true",... | A more loose check that semver, using a simple order check | [
"A",
"more",
"loose",
"check",
"that",
"semver",
"using",
"a",
"simple",
"order",
"check"
] | 21141fb6c4af90d37af2c6cec074a58aaf67a5d0 | https://github.com/ChALkeR/Jergal/blob/21141fb6c4af90d37af2c6cec074a58aaf67a5d0/lib/versions.js#L4-L47 | train |
b-heilman/bmoor | src/object.js | explode | function explode( target, mappings ){
if (!mappings ){
mappings = target;
target = {};
}
bmoor.iterate( mappings, function( val, mapping ){
bmoor.set( target, mapping, val );
});
return target;
} | javascript | function explode( target, mappings ){
if (!mappings ){
mappings = target;
target = {};
}
bmoor.iterate( mappings, function( val, mapping ){
bmoor.set( target, mapping, val );
});
return target;
} | [
"function",
"explode",
"(",
"target",
",",
"mappings",
")",
"{",
"if",
"(",
"!",
"mappings",
")",
"{",
"mappings",
"=",
"target",
";",
"target",
"=",
"{",
"}",
";",
"}",
"bmoor",
".",
"iterate",
"(",
"mappings",
",",
"function",
"(",
"val",
",",
"m... | Takes a hash and uses the indexs as namespaces to add properties to an objs
@function explode
@param {object} target The object to map the variables onto
@param {object} mappings An object orientended as [ namespace ] => value
@return {object} The object that has had content mapped into it | [
"Takes",
"a",
"hash",
"and",
"uses",
"the",
"indexs",
"as",
"namespaces",
"to",
"add",
"properties",
"to",
"an",
"objs"
] | b21a315b477093c14e5f32d857b4644a5a0a36fd | https://github.com/b-heilman/bmoor/blob/b21a315b477093c14e5f32d857b4644a5a0a36fd/src/object.js#L40-L51 | train |
b-heilman/bmoor | src/object.js | mask | function mask( obj ){
if ( Object.create ){
var T = function Masked(){};
T.prototype = obj;
return new T();
}else{
return Object.create( obj );
}
} | javascript | function mask( obj ){
if ( Object.create ){
var T = function Masked(){};
T.prototype = obj;
return new T();
}else{
return Object.create( obj );
}
} | [
"function",
"mask",
"(",
"obj",
")",
"{",
"if",
"(",
"Object",
".",
"create",
")",
"{",
"var",
"T",
"=",
"function",
"Masked",
"(",
")",
"{",
"}",
";",
"T",
".",
"prototype",
"=",
"obj",
";",
"return",
"new",
"T",
"(",
")",
";",
"}",
"else",
... | Create a new instance from an object and some arguments
@function mask
@param {function} obj The basis for the constructor
@param {array} args The arguments to pass to the constructor
@return {object} The new object that has been constructed | [
"Create",
"a",
"new",
"instance",
"from",
"an",
"object",
"and",
"some",
"arguments"
] | b21a315b477093c14e5f32d857b4644a5a0a36fd | https://github.com/b-heilman/bmoor/blob/b21a315b477093c14e5f32d857b4644a5a0a36fd/src/object.js#L115-L125 | train |
b-heilman/bmoor | src/object.js | merge | function merge( to ){
var from,
i, c,
m = function( val, key ){
to[ key ] = merge( to[key], val );
};
for( i = 1, c = arguments.length; i < c; i++ ){
from = arguments[i];
if ( to === from ){
continue;
}else if ( to && to.merge ){
to.merge( from );
}else if ( !bmoor.isObject(from... | javascript | function merge( to ){
var from,
i, c,
m = function( val, key ){
to[ key ] = merge( to[key], val );
};
for( i = 1, c = arguments.length; i < c; i++ ){
from = arguments[i];
if ( to === from ){
continue;
}else if ( to && to.merge ){
to.merge( from );
}else if ( !bmoor.isObject(from... | [
"function",
"merge",
"(",
"to",
")",
"{",
"var",
"from",
",",
"i",
",",
"c",
",",
"m",
"=",
"function",
"(",
"val",
",",
"key",
")",
"{",
"to",
"[",
"key",
"]",
"=",
"merge",
"(",
"to",
"[",
"key",
"]",
",",
"val",
")",
";",
"}",
";",
"fo... | Deep copy version of extend | [
"Deep",
"copy",
"version",
"of",
"extend"
] | b21a315b477093c14e5f32d857b4644a5a0a36fd | https://github.com/b-heilman/bmoor/blob/b21a315b477093c14e5f32d857b4644a5a0a36fd/src/object.js#L165-L189 | train |
b-heilman/bmoor | src/object.js | equals | function equals( obj1, obj2 ){
var t1 = typeof obj1,
t2 = typeof obj2,
c,
i,
keyCheck;
if ( obj1 === obj2 ){
return true;
}else if ( obj1 !== obj1 && obj2 !== obj2 ){
return true; // silly NaN
}else if ( obj1 === null || obj1 === undefined || obj2 === null || obj2 === undefined ){
return ... | javascript | function equals( obj1, obj2 ){
var t1 = typeof obj1,
t2 = typeof obj2,
c,
i,
keyCheck;
if ( obj1 === obj2 ){
return true;
}else if ( obj1 !== obj1 && obj2 !== obj2 ){
return true; // silly NaN
}else if ( obj1 === null || obj1 === undefined || obj2 === null || obj2 === undefined ){
return ... | [
"function",
"equals",
"(",
"obj1",
",",
"obj2",
")",
"{",
"var",
"t1",
"=",
"typeof",
"obj1",
",",
"t2",
"=",
"typeof",
"obj2",
",",
"c",
",",
"i",
",",
"keyCheck",
";",
"if",
"(",
"obj1",
"===",
"obj2",
")",
"{",
"return",
"true",
";",
"}",
"e... | A general comparison algorithm to test if two objects are equal
@function equals
@param {object} obj1 The object to copy the content from
@param {object} obj2 The object into which to copy the content
@preturns {boolean} | [
"A",
"general",
"comparison",
"algorithm",
"to",
"test",
"if",
"two",
"objects",
"are",
"equal"
] | b21a315b477093c14e5f32d857b4644a5a0a36fd | https://github.com/b-heilman/bmoor/blob/b21a315b477093c14e5f32d857b4644a5a0a36fd/src/object.js#L199-L256 | train |
unkelpehr/YAEventEmitter | index.js | exec | function exec (func, context, args) {
switch (args.length) {
case 0: func.call(context); break;
case 1: func.call(context, args[0]); break;
case 2: func.call(context, args[0], args[1]); break;
case 3: func.call(context, args[0], args[1], args[2]); break;
case 4: func.call(context, args[0], args[1], args[2], ... | javascript | function exec (func, context, args) {
switch (args.length) {
case 0: func.call(context); break;
case 1: func.call(context, args[0]); break;
case 2: func.call(context, args[0], args[1]); break;
case 3: func.call(context, args[0], args[1], args[2]); break;
case 4: func.call(context, args[0], args[1], args[2], ... | [
"function",
"exec",
"(",
"func",
",",
"context",
",",
"args",
")",
"{",
"switch",
"(",
"args",
".",
"length",
")",
"{",
"case",
"0",
":",
"func",
".",
"call",
"(",
"context",
")",
";",
"break",
";",
"case",
"1",
":",
"func",
".",
"call",
"(",
"... | Helper function for fast execution of functions with dynamic parameters.
@param {Function} func Function to execute
@param {Object} context Object used as `this`-value
@param {Array} args Array of arguments to pass | [
"Helper",
"function",
"for",
"fast",
"execution",
"of",
"functions",
"with",
"dynamic",
"parameters",
"."
] | 2015e0a482bfbb3d419d4820921b71e5a8db9d46 | https://github.com/unkelpehr/YAEventEmitter/blob/2015e0a482bfbb3d419d4820921b71e5a8db9d46/index.js#L7-L16 | train |
unkelpehr/YAEventEmitter | index.js | propagate | function propagate (parent, prefix) {
var self = this;
if (!parent || typeof parent.emit !== 'function') {
throw new TypeError('"parent" argument must implement an "emit" method');
}
self.parent = parent;
self.parentPrefix = prefix;
return this;
} | javascript | function propagate (parent, prefix) {
var self = this;
if (!parent || typeof parent.emit !== 'function') {
throw new TypeError('"parent" argument must implement an "emit" method');
}
self.parent = parent;
self.parentPrefix = prefix;
return this;
} | [
"function",
"propagate",
"(",
"parent",
",",
"prefix",
")",
"{",
"var",
"self",
"=",
"this",
";",
"if",
"(",
"!",
"parent",
"||",
"typeof",
"parent",
".",
"emit",
"!==",
"'function'",
")",
"{",
"throw",
"new",
"TypeError",
"(",
"'\"parent\" argument must i... | Adds the parent eventemitter to the end of the bubblers array.
When this eventemitter has emitted an event it will emit the same event on the parent.
This function is namespaced under 'EventEmitter' because it's usually not part of what
people perceive as an event emitter.
@param {EventEmitter} parent The eventemi... | [
"Adds",
"the",
"parent",
"eventemitter",
"to",
"the",
"end",
"of",
"the",
"bubblers",
"array",
".",
"When",
"this",
"eventemitter",
"has",
"emitted",
"an",
"event",
"it",
"will",
"emit",
"the",
"same",
"event",
"on",
"the",
"parent",
"."
] | 2015e0a482bfbb3d419d4820921b71e5a8db9d46 | https://github.com/unkelpehr/YAEventEmitter/blob/2015e0a482bfbb3d419d4820921b71e5a8db9d46/index.js#L51-L62 | train |
rickyclegg/this | build/debug/this_debug_0.1.7.js | hasCompleteEventParams | function hasCompleteEventParams(eventType, listener) {
var hasParams = eventType && listener,
isTypeString = typeof eventType === 'string',
isTypeFunction = typeof listener === 'function';
if (!isTypeFunction) {
throw new TypeError(EventDispatcher.TYPE_ERROR);
... | javascript | function hasCompleteEventParams(eventType, listener) {
var hasParams = eventType && listener,
isTypeString = typeof eventType === 'string',
isTypeFunction = typeof listener === 'function';
if (!isTypeFunction) {
throw new TypeError(EventDispatcher.TYPE_ERROR);
... | [
"function",
"hasCompleteEventParams",
"(",
"eventType",
",",
"listener",
")",
"{",
"var",
"hasParams",
"=",
"eventType",
"&&",
"listener",
",",
"isTypeString",
"=",
"typeof",
"eventType",
"===",
"'string'",
",",
"isTypeFunction",
"=",
"typeof",
"listener",
"===",
... | Checks if params exist and match the correct types.
@param {String} eventType
@param {Function} listener
@returns {Boolean}
@private
@throws {TypeError} The listener specified is not a function. | [
"Checks",
"if",
"params",
"exist",
"and",
"match",
"the",
"correct",
"types",
"."
] | a3186c3d1c3be93734b7404998ff6305bf43f857 | https://github.com/rickyclegg/this/blob/a3186c3d1c3be93734b7404998ff6305bf43f857/build/debug/this_debug_0.1.7.js#L179-L189 | train |
cli-kit/cli-description | index.js | Description | function Description(def) {
if(typeof def === 'string') {
this.parse(def);
}else if(def
&& typeof def === 'object'
&& typeof def.txt === 'string'
&& typeof def.md === 'string') {
this.md = def.md;
this.txt = def.txt;
}else{
throw new Error('invalid value for description');
}
} | javascript | function Description(def) {
if(typeof def === 'string') {
this.parse(def);
}else if(def
&& typeof def === 'object'
&& typeof def.txt === 'string'
&& typeof def.md === 'string') {
this.md = def.md;
this.txt = def.txt;
}else{
throw new Error('invalid value for description');
}
} | [
"function",
"Description",
"(",
"def",
")",
"{",
"if",
"(",
"typeof",
"def",
"===",
"'string'",
")",
"{",
"this",
".",
"parse",
"(",
"def",
")",
";",
"}",
"else",
"if",
"(",
"def",
"&&",
"typeof",
"def",
"===",
"'object'",
"&&",
"typeof",
"def",
".... | Encapsulates a string represented as markdown and plain text. | [
"Encapsulates",
"a",
"string",
"represented",
"as",
"markdown",
"and",
"plain",
"text",
"."
] | 41779925dbf66bd41c6c039f6a834937113e3660 | https://github.com/cli-kit/cli-description/blob/41779925dbf66bd41c6c039f6a834937113e3660/index.js#L10-L22 | train |
rhdeck/yarnif | index.js | useYarn | function useYarn(setYarn) {
if (typeof setYarn !== "undefined") {
allowYarn = setYarn;
}
if (typeof allowYarn !== "undefined") {
return allowYarn;
}
return getYarnVersionIfAvailable() ? true : false;
} | javascript | function useYarn(setYarn) {
if (typeof setYarn !== "undefined") {
allowYarn = setYarn;
}
if (typeof allowYarn !== "undefined") {
return allowYarn;
}
return getYarnVersionIfAvailable() ? true : false;
} | [
"function",
"useYarn",
"(",
"setYarn",
")",
"{",
"if",
"(",
"typeof",
"setYarn",
"!==",
"\"undefined\"",
")",
"{",
"allowYarn",
"=",
"setYarn",
";",
"}",
"if",
"(",
"typeof",
"allowYarn",
"!==",
"\"undefined\"",
")",
"{",
"return",
"allowYarn",
";",
"}",
... | Use Yarn if available, it's much faster than the npm client. Return the version of yarn installed on the system, null if yarn is not available. | [
"Use",
"Yarn",
"if",
"available",
"it",
"s",
"much",
"faster",
"than",
"the",
"npm",
"client",
".",
"Return",
"the",
"version",
"of",
"yarn",
"installed",
"on",
"the",
"system",
"null",
"if",
"yarn",
"is",
"not",
"available",
"."
] | 6d9c587e634807ce4df4900f26430d063f49188d | https://github.com/rhdeck/yarnif/blob/6d9c587e634807ce4df4900f26430d063f49188d/index.js#L8-L16 | train |
qiangyt/qnode-config | src/ConfigHelper.js | _load | function _load(file, defaultConfig, dump) {
const f = normalize(file);
const b = f.base;
const p = f.profile;
const ext = f.ext;
if (ext) {
const p = b + ext;
let r = loadSpecific(b, '.js', p, defaultConfig, dump);
if (r) return r;
if (defaultConfig) return default... | javascript | function _load(file, defaultConfig, dump) {
const f = normalize(file);
const b = f.base;
const p = f.profile;
const ext = f.ext;
if (ext) {
const p = b + ext;
let r = loadSpecific(b, '.js', p, defaultConfig, dump);
if (r) return r;
if (defaultConfig) return default... | [
"function",
"_load",
"(",
"file",
",",
"defaultConfig",
",",
"dump",
")",
"{",
"const",
"f",
"=",
"normalize",
"(",
"file",
")",
";",
"const",
"b",
"=",
"f",
".",
"base",
";",
"const",
"p",
"=",
"f",
".",
"profile",
";",
"const",
"ext",
"=",
"f",... | Read a configuration file.
Support format: yaml, json, js.
Support extension: .yml, .yaml, .json, .js
@param {*} file 1) if it is a string, I will think it a full path
2) if it is a object, I will think it is structured as:
{
dir: '', // directory name. optional, working dir by default
name: '', // file name, withou... | [
"Read",
"a",
"configuration",
"file",
"."
] | d7b15d6ed72e82d4ca26230d25811ae1669ba7a6 | https://github.com/qiangyt/qnode-config/blob/d7b15d6ed72e82d4ca26230d25811ae1669ba7a6/src/ConfigHelper.js#L131-L164 | train |
microscopejs/microscope-web | src/HttpApplication.js | HttpApplication | function HttpApplication() {
this.app = express();
this._registerConfigurations();
this._registerMiddlewares();
this._registerControllers();
this._registerAreas();
this.initialize.apply(this, arguments);
} | javascript | function HttpApplication() {
this.app = express();
this._registerConfigurations();
this._registerMiddlewares();
this._registerControllers();
this._registerAreas();
this.initialize.apply(this, arguments);
} | [
"function",
"HttpApplication",
"(",
")",
"{",
"this",
".",
"app",
"=",
"express",
"(",
")",
";",
"this",
".",
"_registerConfigurations",
"(",
")",
";",
"this",
".",
"_registerMiddlewares",
"(",
")",
";",
"this",
".",
"_registerControllers",
"(",
")",
";",
... | HttpApplication class Constructor instantiate express application | [
"HttpApplication",
"class",
"Constructor",
"instantiate",
"express",
"application"
] | 6571546825b2457e12b98048517f79ec62d16cc4 | https://github.com/microscopejs/microscope-web/blob/6571546825b2457e12b98048517f79ec62d16cc4/src/HttpApplication.js#L8-L15 | train |
christkv/vitesse | lib/custom.js | function(parent, field, options) {
options = options || {};
// Unique id for this node's generated method
this.id = utils.generateId();
// Link to parent node
this.parent = parent;
// The field related to this node
this.field = field;
// Any options
this.options = options;
// Just some metadata
... | javascript | function(parent, field, options) {
options = options || {};
// Unique id for this node's generated method
this.id = utils.generateId();
// Link to parent node
this.parent = parent;
// The field related to this node
this.field = field;
// Any options
this.options = options;
// Just some metadata
... | [
"function",
"(",
"parent",
",",
"field",
",",
"options",
")",
"{",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"// Unique id for this node's generated method",
"this",
".",
"id",
"=",
"utils",
".",
"generateId",
"(",
")",
";",
"// Link to parent node",
"th... | The CustomNode class represents a value that can be anything
@class
@return {CustomNode} a CustomNode instance. | [
"The",
"CustomNode",
"class",
"represents",
"a",
"value",
"that",
"can",
"be",
"anything"
] | 6f40f7eaafa7f22644c4c6df80c0bf0590c502ba | https://github.com/christkv/vitesse/blob/6f40f7eaafa7f22644c4c6df80c0bf0590c502ba/lib/custom.js#L13-L27 | train | |
kmulvey/grunt-beaker | tasks/beaker.js | statFile | function statFile(path, sizes_data, sizes_file_path){
writeFileData(path, fs.statSync(path).mtime.getTime(), fs.statSync(path).size, sizes_data, sizes_file_path);
} | javascript | function statFile(path, sizes_data, sizes_file_path){
writeFileData(path, fs.statSync(path).mtime.getTime(), fs.statSync(path).size, sizes_data, sizes_file_path);
} | [
"function",
"statFile",
"(",
"path",
",",
"sizes_data",
",",
"sizes_file_path",
")",
"{",
"writeFileData",
"(",
"path",
",",
"fs",
".",
"statSync",
"(",
"path",
")",
".",
"mtime",
".",
"getTime",
"(",
")",
",",
"fs",
".",
"statSync",
"(",
"path",
")",
... | return the mtime and sizefor file | [
"return",
"the",
"mtime",
"and",
"sizefor",
"file"
] | 94b7a9082b178f0e7961fecf157fb627fc457dcd | https://github.com/kmulvey/grunt-beaker/blob/94b7a9082b178f0e7961fecf157fb627fc457dcd/tasks/beaker.js#L48-L50 | train |
kmulvey/grunt-beaker | tasks/beaker.js | writeFileData | function writeFileData(file_path, time, size, sizes_data, sizes_file_path){
var file_ext = path.extname(file_path).replace('.','');
var file_name = path.basename(file_path);
// create file type object if it doesnt exist
if(sizes_data[file_ext] === undefined){
sizes_data[file_ext] = {};
}
// create fi... | javascript | function writeFileData(file_path, time, size, sizes_data, sizes_file_path){
var file_ext = path.extname(file_path).replace('.','');
var file_name = path.basename(file_path);
// create file type object if it doesnt exist
if(sizes_data[file_ext] === undefined){
sizes_data[file_ext] = {};
}
// create fi... | [
"function",
"writeFileData",
"(",
"file_path",
",",
"time",
",",
"size",
",",
"sizes_data",
",",
"sizes_file_path",
")",
"{",
"var",
"file_ext",
"=",
"path",
".",
"extname",
"(",
"file_path",
")",
".",
"replace",
"(",
"'.'",
",",
"''",
")",
";",
"var",
... | create the correct data structure and write it to the file | [
"create",
"the",
"correct",
"data",
"structure",
"and",
"write",
"it",
"to",
"the",
"file"
] | 94b7a9082b178f0e7961fecf157fb627fc457dcd | https://github.com/kmulvey/grunt-beaker/blob/94b7a9082b178f0e7961fecf157fb627fc457dcd/tasks/beaker.js#L53-L74 | train |
redisjs/jsr-script | lib/runner.js | ScriptRunner | function ScriptRunner() {
this.flush();
function onMessage(msg, handle) {
var script, digest;
switch(msg.event) {
case 'loglevel':
log.level(msg.level);
break;
case 'eval':
try {
script = this.load(msg.source).script;
this.run(script, msg.args);
... | javascript | function ScriptRunner() {
this.flush();
function onMessage(msg, handle) {
var script, digest;
switch(msg.event) {
case 'loglevel':
log.level(msg.level);
break;
case 'eval':
try {
script = this.load(msg.source).script;
this.run(script, msg.args);
... | [
"function",
"ScriptRunner",
"(",
")",
"{",
"this",
".",
"flush",
"(",
")",
";",
"function",
"onMessage",
"(",
"msg",
",",
"handle",
")",
"{",
"var",
"script",
",",
"digest",
";",
"switch",
"(",
"msg",
".",
"event",
")",
"{",
"case",
"'loglevel'",
":"... | Encapsulates script cache, compilation and execution. | [
"Encapsulates",
"script",
"cache",
"compilation",
"and",
"execution",
"."
] | eab3df935372724a82a9ad9ba3bca7e6e165e9d1 | https://github.com/redisjs/jsr-script/blob/eab3df935372724a82a9ad9ba3bca7e6e165e9d1/lib/runner.js#L16-L61 | 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.