id int32 0 58k | repo stringlengths 5 67 | path stringlengths 4 116 | func_name stringlengths 0 58 | original_string stringlengths 52 373k | language stringclasses 1
value | code stringlengths 52 373k | code_tokens list | docstring stringlengths 4 11.8k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 86 226 |
|---|---|---|---|---|---|---|---|---|---|---|---|
51,800 | 0of/ver-iterator | lib/npm.js | listInstalledVer | function listInstalledVer(name, dir) {
var _child$spawnSync3 = _child_process2['default'].spawnSync(npmCommand, ['list', name, '--depth', '0', '--json'], { cwd: dir });
var stdout = _child$spawnSync3.stdout;
var error = _child$spawnSync3.error;
var status = _child$spawnSync3.status;
... | javascript | function listInstalledVer(name, dir) {
var _child$spawnSync3 = _child_process2['default'].spawnSync(npmCommand, ['list', name, '--depth', '0', '--json'], { cwd: dir });
var stdout = _child$spawnSync3.stdout;
var error = _child$spawnSync3.error;
var status = _child$spawnSync3.status;
... | [
"function",
"listInstalledVer",
"(",
"name",
",",
"dir",
")",
"{",
"var",
"_child$spawnSync3",
"=",
"_child_process2",
"[",
"'default'",
"]",
".",
"spawnSync",
"(",
"npmCommand",
",",
"[",
"'list'",
",",
"name",
",",
"'--depth'",
",",
"'0'",
",",
"'--json'",... | list specific package version via npm
@param {String} [name] published package name
@param {String} [dir] list directory
@public | [
"list",
"specific",
"package",
"version",
"via",
"npm"
] | a51726c02dfd14488190860f4d90903574ed8e37 | https://github.com/0of/ver-iterator/blob/a51726c02dfd14488190860f4d90903574ed8e37/lib/npm.js#L57-L70 |
51,801 | 0of/ver-iterator | lib/npm.js | uninstalledVer | function uninstalledVer(name, ver, dir) {
var _child$spawnSync4 = _child_process2['default'].spawnSync(npmCommand, ['uninstall', ver.length === 0 ? name : name + '@' + ver], { cwd: dir });
var error = _child$spawnSync4.error;
if (error) throw error;
} | javascript | function uninstalledVer(name, ver, dir) {
var _child$spawnSync4 = _child_process2['default'].spawnSync(npmCommand, ['uninstall', ver.length === 0 ? name : name + '@' + ver], { cwd: dir });
var error = _child$spawnSync4.error;
if (error) throw error;
} | [
"function",
"uninstalledVer",
"(",
"name",
",",
"ver",
",",
"dir",
")",
"{",
"var",
"_child$spawnSync4",
"=",
"_child_process2",
"[",
"'default'",
"]",
".",
"spawnSync",
"(",
"npmCommand",
",",
"[",
"'uninstall'",
",",
"ver",
".",
"length",
"===",
"0",
"?"... | uninstall package via npm
@param {String} [name] published package name
@param {String} [ver] install version
@param {String} [dir] uninstall directory
@public | [
"uninstall",
"package",
"via",
"npm"
] | a51726c02dfd14488190860f4d90903574ed8e37 | https://github.com/0of/ver-iterator/blob/a51726c02dfd14488190860f4d90903574ed8e37/lib/npm.js#L80-L86 |
51,802 | gethuman/pancakes-recipe | utils/validation.js | getSchema | function getSchema(path) {
var parts = path.split('.');
var collectionName = parts[0];
var fieldName = parts[1];
// if format not user.field or field not in the schemaDefinitions object, then log error without breaking
if (parts.length !== 2 || !schemaDefinitions[collectionName]... | javascript | function getSchema(path) {
var parts = path.split('.');
var collectionName = parts[0];
var fieldName = parts[1];
// if format not user.field or field not in the schemaDefinitions object, then log error without breaking
if (parts.length !== 2 || !schemaDefinitions[collectionName]... | [
"function",
"getSchema",
"(",
"path",
")",
"{",
"var",
"parts",
"=",
"path",
".",
"split",
"(",
"'.'",
")",
";",
"var",
"collectionName",
"=",
"parts",
"[",
"0",
"]",
";",
"var",
"fieldName",
"=",
"parts",
"[",
"1",
"]",
";",
"// if format not user.fie... | Take a string like user.password and get the schemaDefinitions for it
@param path
@returns {*} | [
"Take",
"a",
"string",
"like",
"user",
".",
"password",
"and",
"get",
"the",
"schemaDefinitions",
"for",
"it"
] | ea3feb8839e2edaf1b4577c052b8958953db4498 | https://github.com/gethuman/pancakes-recipe/blob/ea3feb8839e2edaf1b4577c052b8958953db4498/utils/validation.js#L61-L73 |
51,803 | gethuman/pancakes-recipe | utils/validation.js | parseValidateAttr | function parseValidateAttr(validateAttr, schema, validateFns) {
// if an array, loop through and recurse
if (_.isArray(validateAttr)) {
_.each(validateAttr, function (validator) {
parseValidateAttr(validator, schema, validateFns);
});
return;
... | javascript | function parseValidateAttr(validateAttr, schema, validateFns) {
// if an array, loop through and recurse
if (_.isArray(validateAttr)) {
_.each(validateAttr, function (validator) {
parseValidateAttr(validator, schema, validateFns);
});
return;
... | [
"function",
"parseValidateAttr",
"(",
"validateAttr",
",",
"schema",
",",
"validateFns",
")",
"{",
"// if an array, loop through and recurse",
"if",
"(",
"_",
".",
"isArray",
"(",
"validateAttr",
")",
")",
"{",
"_",
".",
"each",
"(",
"validateAttr",
",",
"functi... | Take thing originally from the gh-validate attribute and turn it into an obj and fns array
@param validateAttr
@param schema
@param validateFns | [
"Take",
"thing",
"originally",
"from",
"the",
"gh",
"-",
"validate",
"attribute",
"and",
"turn",
"it",
"into",
"an",
"obj",
"and",
"fns",
"array"
] | ea3feb8839e2edaf1b4577c052b8958953db4498 | https://github.com/gethuman/pancakes-recipe/blob/ea3feb8839e2edaf1b4577c052b8958953db4498/utils/validation.js#L92-L113 |
51,804 | gethuman/pancakes-recipe | utils/validation.js | generateValidationFn | function generateValidationFn(schema) {
return function (req) {
// if already an error, return without doing any additional validation
if (req.error) { return req; }
var keys = Object.keys(schema);
var len = (req.value && req.value.trim().length) || 0;
... | javascript | function generateValidationFn(schema) {
return function (req) {
// if already an error, return without doing any additional validation
if (req.error) { return req; }
var keys = Object.keys(schema);
var len = (req.value && req.value.trim().length) || 0;
... | [
"function",
"generateValidationFn",
"(",
"schema",
")",
"{",
"return",
"function",
"(",
"req",
")",
"{",
"// if already an error, return without doing any additional validation",
"if",
"(",
"req",
".",
"error",
")",
"{",
"return",
"req",
";",
"}",
"var",
"keys",
"... | Generate validator function off of the given schema object
@param schema
@returns {Function} | [
"Generate",
"validator",
"function",
"off",
"of",
"the",
"given",
"schema",
"object"
] | ea3feb8839e2edaf1b4577c052b8958953db4498 | https://github.com/gethuman/pancakes-recipe/blob/ea3feb8839e2edaf1b4577c052b8958953db4498/utils/validation.js#L120-L149 |
51,805 | tolokoban/ToloFrameWork | lib/module.js | getCandidates | function getCandidates(moduleName, srcPath) {
const
candidates = [],
moduleNames = getSynonyms(moduleName);
for( const path of srcPath) {
for( const name of moduleNames) {
candidates.push( Path.resolve( path, "mod", name) );
}
}
return candidates;
} | javascript | function getCandidates(moduleName, srcPath) {
const
candidates = [],
moduleNames = getSynonyms(moduleName);
for( const path of srcPath) {
for( const name of moduleNames) {
candidates.push( Path.resolve( path, "mod", name) );
}
}
return candidates;
} | [
"function",
"getCandidates",
"(",
"moduleName",
",",
"srcPath",
")",
"{",
"const",
"candidates",
"=",
"[",
"]",
",",
"moduleNames",
"=",
"getSynonyms",
"(",
"moduleName",
")",
";",
"for",
"(",
"const",
"path",
"of",
"srcPath",
")",
"{",
"for",
"(",
"cons... | List all possible absolute pathes for the given module.
@param {string} moduleName - Name of the module (with dots).
@param {array} srcPath - Array of absolute pathes where to look for sources.
Module's files lie in the subdirectory `mod/` of a source directory.
@returns {array} Array of absolute module pathes in orde... | [
"List",
"all",
"possible",
"absolute",
"pathes",
"for",
"the",
"given",
"module",
"."
] | 730845a833a9660ebfdb60ad027ebaab5ac871b6 | https://github.com/tolokoban/ToloFrameWork/blob/730845a833a9660ebfdb60ad027ebaab5ac871b6/lib/module.js#L65-L76 |
51,806 | tolokoban/ToloFrameWork | lib/module.js | getFirstViableCandidate | function getFirstViableCandidate(candidates) {
for( const candidate of candidates) {
const fileJS = `${candidate}.js`;
if( Fs.existsSync(fileJS) ) return candidate;
const fileXJS = `${candidate}.xjs`;
if( Fs.existsSync(fileXJS) ) return candidate;
}
return candidates[0];
} | javascript | function getFirstViableCandidate(candidates) {
for( const candidate of candidates) {
const fileJS = `${candidate}.js`;
if( Fs.existsSync(fileJS) ) return candidate;
const fileXJS = `${candidate}.xjs`;
if( Fs.existsSync(fileXJS) ) return candidate;
}
return candidates[0];
} | [
"function",
"getFirstViableCandidate",
"(",
"candidates",
")",
"{",
"for",
"(",
"const",
"candidate",
"of",
"candidates",
")",
"{",
"const",
"fileJS",
"=",
"`",
"${",
"candidate",
"}",
"`",
";",
"if",
"(",
"Fs",
".",
"existsSync",
"(",
"fileJS",
")",
")"... | A candidate is viable if the `js` or the `xjs` file exists.
@param {array} candidates - Pathes of module files (without extension).
@returns {string} The first candidate if no module has been found. | [
"A",
"candidate",
"is",
"viable",
"if",
"the",
"js",
"or",
"the",
"xjs",
"file",
"exists",
"."
] | 730845a833a9660ebfdb60ad027ebaab5ac871b6 | https://github.com/tolokoban/ToloFrameWork/blob/730845a833a9660ebfdb60ad027ebaab5ac871b6/lib/module.js#L103-L112 |
51,807 | mrcarlberg/objj-transpiler | ObjJAcornCompiler.js | setupOptions | function setupOptions(opts) {
var options = Object.create(null);
for (var opt in defaultOptions) {
if (opts && Object.prototype.hasOwnProperty.call(opts, opt)) {
var incomingOpt = opts[opt];
options[opt] = typeof incomingOpt === 'function' ? incomingOpt() : incomingOpt;
}... | javascript | function setupOptions(opts) {
var options = Object.create(null);
for (var opt in defaultOptions) {
if (opts && Object.prototype.hasOwnProperty.call(opts, opt)) {
var incomingOpt = opts[opt];
options[opt] = typeof incomingOpt === 'function' ? incomingOpt() : incomingOpt;
}... | [
"function",
"setupOptions",
"(",
"opts",
")",
"{",
"var",
"options",
"=",
"Object",
".",
"create",
"(",
"null",
")",
";",
"for",
"(",
"var",
"opt",
"in",
"defaultOptions",
")",
"{",
"if",
"(",
"opts",
"&&",
"Object",
".",
"prototype",
".",
"hasOwnPrope... | We copy the options to a new object as we don't want to mess up incoming options when we start compiling. | [
"We",
"copy",
"the",
"options",
"to",
"a",
"new",
"object",
"as",
"we",
"don",
"t",
"want",
"to",
"mess",
"up",
"incoming",
"options",
"when",
"we",
"start",
"compiling",
"."
] | d9117b580cb829142fdbebf6806e9a78e7c51f46 | https://github.com/mrcarlberg/objj-transpiler/blob/d9117b580cb829142fdbebf6806e9a78e7c51f46/ObjJAcornCompiler.js#L685-L697 |
51,808 | mrcarlberg/objj-transpiler | ObjJAcornCompiler.js | surroundExpression | function surroundExpression(c) {
return function(node, st, override, format) {
st.compiler.jsBuffer.concat("(");
c(node, st, override, format);
st.compiler.jsBuffer.concat(")");
}
} | javascript | function surroundExpression(c) {
return function(node, st, override, format) {
st.compiler.jsBuffer.concat("(");
c(node, st, override, format);
st.compiler.jsBuffer.concat(")");
}
} | [
"function",
"surroundExpression",
"(",
"c",
")",
"{",
"return",
"function",
"(",
"node",
",",
"st",
",",
"override",
",",
"format",
")",
"{",
"st",
".",
"compiler",
".",
"jsBuffer",
".",
"concat",
"(",
"\"(\"",
")",
";",
"c",
"(",
"node",
",",
"st",
... | Surround expression with parentheses | [
"Surround",
"expression",
"with",
"parentheses"
] | d9117b580cb829142fdbebf6806e9a78e7c51f46 | https://github.com/mrcarlberg/objj-transpiler/blob/d9117b580cb829142fdbebf6806e9a78e7c51f46/ObjJAcornCompiler.js#L1183-L1189 |
51,809 | mrcarlberg/objj-transpiler | ObjJAcornCompiler.js | function(node, st, c) {
var compiler = st.compiler;
if (compiler.generate)
compiler.jsBuffer.concat(node.name, node);
} | javascript | function(node, st, c) {
var compiler = st.compiler;
if (compiler.generate)
compiler.jsBuffer.concat(node.name, node);
} | [
"function",
"(",
"node",
",",
"st",
",",
"c",
")",
"{",
"var",
"compiler",
"=",
"st",
".",
"compiler",
";",
"if",
"(",
"compiler",
".",
"generate",
")",
"compiler",
".",
"jsBuffer",
".",
"concat",
"(",
"node",
".",
"name",
",",
"node",
")",
";",
... | Use this when there should not be a look up to issue warnings or add 'self.' before ivars | [
"Use",
"this",
"when",
"there",
"should",
"not",
"be",
"a",
"look",
"up",
"to",
"issue",
"warnings",
"or",
"add",
"self",
".",
"before",
"ivars"
] | d9117b580cb829142fdbebf6806e9a78e7c51f46 | https://github.com/mrcarlberg/objj-transpiler/blob/d9117b580cb829142fdbebf6806e9a78e7c51f46/ObjJAcornCompiler.js#L2282-L2286 | |
51,810 | feedhenry/fh-mbaas-middleware | lib/util/common.js | buildErrorObject | function buildErrorObject(params){
params = params || {};
//If the userDetail is already set, not building the error object again.
if(params.err && params.err.userDetail){
return params;
}
var err = params.err || {message: "Unexpected Error"};
var msg = params.msg || params.err.message || "Unexpected ... | javascript | function buildErrorObject(params){
params = params || {};
//If the userDetail is already set, not building the error object again.
if(params.err && params.err.userDetail){
return params;
}
var err = params.err || {message: "Unexpected Error"};
var msg = params.msg || params.err.message || "Unexpected ... | [
"function",
"buildErrorObject",
"(",
"params",
")",
"{",
"params",
"=",
"params",
"||",
"{",
"}",
";",
"//If the userDetail is already set, not building the error object again.",
"if",
"(",
"params",
".",
"err",
"&&",
"params",
".",
"err",
".",
"userDetail",
")",
... | First step to creating common error codes.
TODO: Make A Module..
@param err
@param msg
@param code
@returns {{error: string}} | [
"First",
"step",
"to",
"creating",
"common",
"error",
"codes",
"."
] | f906e98efbb4b0963bf5137b34b5e0589ba24e69 | https://github.com/feedhenry/fh-mbaas-middleware/blob/f906e98efbb4b0963bf5137b34b5e0589ba24e69/lib/util/common.js#L19-L46 |
51,811 | feedhenry/fh-mbaas-middleware | lib/util/common.js | setResponseHeaders | function setResponseHeaders(res) {
if(res.setHeader) {
var contentType = res.getHeader('content-type');
if (!contentType) {
res.setHeader('Content-Type', 'application/json');
}
}
} | javascript | function setResponseHeaders(res) {
if(res.setHeader) {
var contentType = res.getHeader('content-type');
if (!contentType) {
res.setHeader('Content-Type', 'application/json');
}
}
} | [
"function",
"setResponseHeaders",
"(",
"res",
")",
"{",
"if",
"(",
"res",
".",
"setHeader",
")",
"{",
"var",
"contentType",
"=",
"res",
".",
"getHeader",
"(",
"'content-type'",
")",
";",
"if",
"(",
"!",
"contentType",
")",
"{",
"res",
".",
"setHeader",
... | set default response headers | [
"set",
"default",
"response",
"headers"
] | f906e98efbb4b0963bf5137b34b5e0589ba24e69 | https://github.com/feedhenry/fh-mbaas-middleware/blob/f906e98efbb4b0963bf5137b34b5e0589ba24e69/lib/util/common.js#L49-L56 |
51,812 | feedhenry/fh-mbaas-middleware | lib/util/common.js | handleError | function handleError(err, msg, code, req, res){
logError(err, msg, code, req);
var response = buildErrorObject({
err: err,
msg: msg,
httpCode: code
});
res.statusCode = response.httpCode;
res.end(JSON.stringify(response.errorFields));
} | javascript | function handleError(err, msg, code, req, res){
logError(err, msg, code, req);
var response = buildErrorObject({
err: err,
msg: msg,
httpCode: code
});
res.statusCode = response.httpCode;
res.end(JSON.stringify(response.errorFields));
} | [
"function",
"handleError",
"(",
"err",
",",
"msg",
",",
"code",
",",
"req",
",",
"res",
")",
"{",
"logError",
"(",
"err",
",",
"msg",
",",
"code",
",",
"req",
")",
";",
"var",
"response",
"=",
"buildErrorObject",
"(",
"{",
"err",
":",
"err",
",",
... | generic error handler | [
"generic",
"error",
"handler"
] | f906e98efbb4b0963bf5137b34b5e0589ba24e69 | https://github.com/feedhenry/fh-mbaas-middleware/blob/f906e98efbb4b0963bf5137b34b5e0589ba24e69/lib/util/common.js#L79-L90 |
51,813 | feedhenry/fh-mbaas-middleware | lib/util/common.js | sortObject | function sortObject(obj) {
assert.ok(_.isObject(obj), 'Parameter should be an object! - ' + util.inspect(obj));
assert.ok(!_.isArray(obj), 'Parameter should be an object, got array: ' + util.inspect(obj));
var sortedKeys = _.keys(obj).sort();
var sortedObjs = [];
_.each(sortedKeys, function(key) {
var v... | javascript | function sortObject(obj) {
assert.ok(_.isObject(obj), 'Parameter should be an object! - ' + util.inspect(obj));
assert.ok(!_.isArray(obj), 'Parameter should be an object, got array: ' + util.inspect(obj));
var sortedKeys = _.keys(obj).sort();
var sortedObjs = [];
_.each(sortedKeys, function(key) {
var v... | [
"function",
"sortObject",
"(",
"obj",
")",
"{",
"assert",
".",
"ok",
"(",
"_",
".",
"isObject",
"(",
"obj",
")",
",",
"'Parameter should be an object! - '",
"+",
"util",
".",
"inspect",
"(",
"obj",
")",
")",
";",
"assert",
".",
"ok",
"(",
"!",
"_",
"... | converts an object with arbitrary keys into an array sorted by keys | [
"converts",
"an",
"object",
"with",
"arbitrary",
"keys",
"into",
"an",
"array",
"sorted",
"by",
"keys"
] | f906e98efbb4b0963bf5137b34b5e0589ba24e69 | https://github.com/feedhenry/fh-mbaas-middleware/blob/f906e98efbb4b0963bf5137b34b5e0589ba24e69/lib/util/common.js#L105-L119 |
51,814 | Digznav/bilberry | git-tags-info.js | gitTagsInfo | function gitTagsInfo(newTag) {
const date = new Date().toISOString();
return Promise.all([
git('git tag -l', stdout => {
const allTags = stdout
.toString()
.trim()
.split('\n')
.sort((a, b) => {
if (Semver.lt(a, b)) return -1;
if (Semver.gt(a, b)) retur... | javascript | function gitTagsInfo(newTag) {
const date = new Date().toISOString();
return Promise.all([
git('git tag -l', stdout => {
const allTags = stdout
.toString()
.trim()
.split('\n')
.sort((a, b) => {
if (Semver.lt(a, b)) return -1;
if (Semver.gt(a, b)) retur... | [
"function",
"gitTagsInfo",
"(",
"newTag",
")",
"{",
"const",
"date",
"=",
"new",
"Date",
"(",
")",
".",
"toISOString",
"(",
")",
";",
"return",
"Promise",
".",
"all",
"(",
"[",
"git",
"(",
"'git tag -l'",
",",
"stdout",
"=>",
"{",
"const",
"allTags",
... | Information of existing tags.
@param {string} newTag Tag.
@return {array} Full info of tags and the first commit. | [
"Information",
"of",
"existing",
"tags",
"."
] | ef6db49de6c8b0d2f4f9d3e10e8a8153e39ffcc4 | https://github.com/Digznav/bilberry/blob/ef6db49de6c8b0d2f4f9d3e10e8a8153e39ffcc4/git-tags-info.js#L11-L61 |
51,815 | sendanor/nor-nopg | src/schema/v0026.js | get_property | function get_property(obj, path) {
if(!is_object(obj)) { return error('get_property(obj, ...) not object: '+ obj); }
if(!is_string(path)) { return error('get_property(..., path) not string: '+ path); }
return path.split('.').reduce(get_property_step, obj);
} | javascript | function get_property(obj, path) {
if(!is_object(obj)) { return error('get_property(obj, ...) not object: '+ obj); }
if(!is_string(path)) { return error('get_property(..., path) not string: '+ path); }
return path.split('.').reduce(get_property_step, obj);
} | [
"function",
"get_property",
"(",
"obj",
",",
"path",
")",
"{",
"if",
"(",
"!",
"is_object",
"(",
"obj",
")",
")",
"{",
"return",
"error",
"(",
"'get_property(obj, ...) not object: '",
"+",
"obj",
")",
";",
"}",
"if",
"(",
"!",
"is_string",
"(",
"path",
... | Get value of property from provided object using a path.
@param obj {object} The object from where to find the value.
@param path {string} The path to the value in object.
@returns {mixed} The value from the object at the end of path or `undefined` if any part is missing. | [
"Get",
"value",
"of",
"property",
"from",
"provided",
"object",
"using",
"a",
"path",
"."
] | 0d99b86c1a1996b5828b56de8de23700df8bbc0c | https://github.com/sendanor/nor-nopg/blob/0d99b86c1a1996b5828b56de8de23700df8bbc0c/src/schema/v0026.js#L104-L108 |
51,816 | sendanor/nor-nopg | src/schema/v0026.js | get_pg_prop | function get_pg_prop(name) {
if(name[0] === '$') {
return name.substr(1);
}
var parts = name.split('.');
if(parts.length === 1) {
return "content->>'" + name + "'";
}
if(parts.length === 2) {
return "content->'" + parts.join("'->>'") + "'";
}
return "content->'" + par... | javascript | function get_pg_prop(name) {
if(name[0] === '$') {
return name.substr(1);
}
var parts = name.split('.');
if(parts.length === 1) {
return "content->>'" + name + "'";
}
if(parts.length === 2) {
return "content->'" + parts.join("'->>'") + "'";
}
return "content->'" + par... | [
"function",
"get_pg_prop",
"(",
"name",
")",
"{",
"if",
"(",
"name",
"[",
"0",
"]",
"===",
"'$'",
")",
"{",
"return",
"name",
".",
"substr",
"(",
"1",
")",
";",
"}",
"var",
"parts",
"=",
"name",
".",
"split",
"(",
"'.'",
")",
";",
"if",
"(",
... | Get PostgreSQL style property expression | [
"Get",
"PostgreSQL",
"style",
"property",
"expression"
] | 0d99b86c1a1996b5828b56de8de23700df8bbc0c | https://github.com/sendanor/nor-nopg/blob/0d99b86c1a1996b5828b56de8de23700df8bbc0c/src/schema/v0026.js#L111-L128 |
51,817 | sendanor/nor-nopg | src/schema/v0026.js | expression_query | function expression_query(parent, prop, type_name, type_prop, fields) {
fields = (fields || [{'query':'*'}]);
var map = {};
var query = "SELECT "+fields.map(function(f, i) {
var k;
if(f.key) {
k = 'p__' + i;
map[k] = f;
return f.query + ' AS ' + k;
} else {
return f... | javascript | function expression_query(parent, prop, type_name, type_prop, fields) {
fields = (fields || [{'query':'*'}]);
var map = {};
var query = "SELECT "+fields.map(function(f, i) {
var k;
if(f.key) {
k = 'p__' + i;
map[k] = f;
return f.query + ' AS ' + k;
} else {
return f... | [
"function",
"expression_query",
"(",
"parent",
",",
"prop",
",",
"type_name",
",",
"type_prop",
",",
"fields",
")",
"{",
"fields",
"=",
"(",
"fields",
"||",
"[",
"{",
"'query'",
":",
"'*'",
"}",
"]",
")",
";",
"var",
"map",
"=",
"{",
"}",
";",
"var... | Execute query for document expressions
@param parent {object} The parent document object
@param prop {string} The name of the property where results are saved in the parent
@param type_name {string} The name of the type of related documents
@param type_prop {string} The property name in the related document for the UUI... | [
"Execute",
"query",
"for",
"document",
"expressions"
] | 0d99b86c1a1996b5828b56de8de23700df8bbc0c | https://github.com/sendanor/nor-nopg/blob/0d99b86c1a1996b5828b56de8de23700df8bbc0c/src/schema/v0026.js#L137-L196 |
51,818 | sdolard/node-netasqsyslog | lib/syslog.js | function (config) { // ctor
var
me = this;
config = config || {};
this.directory = config.directory;
this.output = config.output || process.stdout;
this.filesMaxSize = config.filesMaxSize || 1024 * 1024 * 1024 * 4 // 4 Go
this.writer = syslogwriter.create({
directory: this.directory,
filesMaxSize: t... | javascript | function (config) { // ctor
var
me = this;
config = config || {};
this.directory = config.directory;
this.output = config.output || process.stdout;
this.filesMaxSize = config.filesMaxSize || 1024 * 1024 * 1024 * 4 // 4 Go
this.writer = syslogwriter.create({
directory: this.directory,
filesMaxSize: t... | [
"function",
"(",
"config",
")",
"{",
"// ctor",
"var",
"me",
"=",
"this",
";",
"config",
"=",
"config",
"||",
"{",
"}",
";",
"this",
".",
"directory",
"=",
"config",
".",
"directory",
";",
"this",
".",
"output",
"=",
"config",
".",
"output",
"||",
... | Read NETASQ syslog and put them in files
@public
@class
@param config.directory: {directory}
@param config.output: {Writable Stream} // default to process.stdout
@param config.filesMaxSize: {number} as Bytes // default 4GB
@param Syslog.config {object}
@inherits Syslog | [
"Read",
"NETASQ",
"syslog",
"and",
"put",
"them",
"in",
"files"
] | a626249695971f47f0a63d22a2dd496560d66094 | https://github.com/sdolard/node-netasqsyslog/blob/a626249695971f47f0a63d22a2dd496560d66094/lib/syslog.js#L195-L214 | |
51,819 | tolokoban/ToloFrameWork | ker/mod/tfw.font-loader.js | fontAPI | function fontAPI( fonts ) {
var promises = [];
fonts.forEach(function (font) {
var pro = document.fonts.load( '64px "' + font + '"' );
promises.push( pro );
});
return Promise.all( promises );
} | javascript | function fontAPI( fonts ) {
var promises = [];
fonts.forEach(function (font) {
var pro = document.fonts.load( '64px "' + font + '"' );
promises.push( pro );
});
return Promise.all( promises );
} | [
"function",
"fontAPI",
"(",
"fonts",
")",
"{",
"var",
"promises",
"=",
"[",
"]",
";",
"fonts",
".",
"forEach",
"(",
"function",
"(",
"font",
")",
"{",
"var",
"pro",
"=",
"document",
".",
"fonts",
".",
"load",
"(",
"'64px \"'",
"+",
"font",
"+",
"'\... | Use the modern Font API. | [
"Use",
"the",
"modern",
"Font",
"API",
"."
] | 730845a833a9660ebfdb60ad027ebaab5ac871b6 | https://github.com/tolokoban/ToloFrameWork/blob/730845a833a9660ebfdb60ad027ebaab5ac871b6/ker/mod/tfw.font-loader.js#L18-L25 |
51,820 | tolokoban/ToloFrameWork | ker/mod/tfw.font-loader.js | fallback | function fallback( fonts ) {
return new Promise(function (resolve, reject) {
var divs = [];
var body = document.body;
fonts.forEach(function (font) {
var div = document.createElement( 'div' );
div.className = 'tfw-font-loader';
div.style.fontFamily = font;... | javascript | function fallback( fonts ) {
return new Promise(function (resolve, reject) {
var divs = [];
var body = document.body;
fonts.forEach(function (font) {
var div = document.createElement( 'div' );
div.className = 'tfw-font-loader';
div.style.fontFamily = font;... | [
"function",
"fallback",
"(",
"fonts",
")",
"{",
"return",
"new",
"Promise",
"(",
"function",
"(",
"resolve",
",",
"reject",
")",
"{",
"var",
"divs",
"=",
"[",
"]",
";",
"var",
"body",
"=",
"document",
".",
"body",
";",
"fonts",
".",
"forEach",
"(",
... | For old browsers, use a not-always-working trick. | [
"For",
"old",
"browsers",
"use",
"a",
"not",
"-",
"always",
"-",
"working",
"trick",
"."
] | 730845a833a9660ebfdb60ad027ebaab5ac871b6 | https://github.com/tolokoban/ToloFrameWork/blob/730845a833a9660ebfdb60ad027ebaab5ac871b6/ker/mod/tfw.font-loader.js#L31-L49 |
51,821 | Crafity/crafity-core | lib/modules/crafity.Exception.js | Exception | function Exception(message, innerException) {
if (!message) {
throw new Exception("Argument 'message' is required but was '" +
(message === null ? "null" : "undefined") + "'");
}
if (typeof message !== 'string') {
throw new Exception("Argument 'message' must be of type 'string' but was '" + typeof m... | javascript | function Exception(message, innerException) {
if (!message) {
throw new Exception("Argument 'message' is required but was '" +
(message === null ? "null" : "undefined") + "'");
}
if (typeof message !== 'string') {
throw new Exception("Argument 'message' must be of type 'string' but was '" + typeof m... | [
"function",
"Exception",
"(",
"message",
",",
"innerException",
")",
"{",
"if",
"(",
"!",
"message",
")",
"{",
"throw",
"new",
"Exception",
"(",
"\"Argument 'message' is required but was '\"",
"+",
"(",
"message",
"===",
"null",
"?",
"\"null\"",
":",
"\"undefine... | A type representing an Exception
@param message The message for the exception
@param innerException The inner exception
@param constructor A constructor of an object to inherit from Exception | [
"A",
"type",
"representing",
"an",
"Exception"
] | c0f2271fa6f9c1164450928b2b480f397c9ec20b | https://github.com/Crafity/crafity-core/blob/c0f2271fa6f9c1164450928b2b480f397c9ec20b/lib/modules/crafity.Exception.js#L25-L44 |
51,822 | LevInteractive/allwrite-middleware-connect | index.js | request | function request(remoteUrl) {
return new Promise((resolve, reject) => {
const get = adapters[url.parse(remoteUrl).protocol].get;
get(remoteUrl, res => {
const { statusCode } = res;
const contentType = res.headers['content-type'];
let rawData = '';
// If it's not a 200 and not a 404 th... | javascript | function request(remoteUrl) {
return new Promise((resolve, reject) => {
const get = adapters[url.parse(remoteUrl).protocol].get;
get(remoteUrl, res => {
const { statusCode } = res;
const contentType = res.headers['content-type'];
let rawData = '';
// If it's not a 200 and not a 404 th... | [
"function",
"request",
"(",
"remoteUrl",
")",
"{",
"return",
"new",
"Promise",
"(",
"(",
"resolve",
",",
"reject",
")",
"=>",
"{",
"const",
"get",
"=",
"adapters",
"[",
"url",
".",
"parse",
"(",
"remoteUrl",
")",
".",
"protocol",
"]",
".",
"get",
";"... | Request Allwrite Server.
@param {string} url The url to request.
@return {Promise} | [
"Request",
"Allwrite",
"Server",
"."
] | 03f85b741a667d81f9954924083499bc060e2a4b | https://github.com/LevInteractive/allwrite-middleware-connect/blob/03f85b741a667d81f9954924083499bc060e2a4b/index.js#L13-L45 |
51,823 | bdchauvette/nano-blue | lib/nano-blue.js | deepPromisify | function deepPromisify(obj) {
return _.transform(obj, function(promisifiedObj, value, key) {
if (blacklist.has(key)) {
promisifiedObj[key] = value;
return;
}
if (typeof value === 'function') {
promisifiedObj[key] = bluebird.promisify(value, obj);
} else if (typeof value === 'object'... | javascript | function deepPromisify(obj) {
return _.transform(obj, function(promisifiedObj, value, key) {
if (blacklist.has(key)) {
promisifiedObj[key] = value;
return;
}
if (typeof value === 'function') {
promisifiedObj[key] = bluebird.promisify(value, obj);
} else if (typeof value === 'object'... | [
"function",
"deepPromisify",
"(",
"obj",
")",
"{",
"return",
"_",
".",
"transform",
"(",
"obj",
",",
"function",
"(",
"promisifiedObj",
",",
"value",
",",
"key",
")",
"{",
"if",
"(",
"blacklist",
".",
"has",
"(",
"key",
")",
")",
"{",
"promisifiedObj",... | Promisifies the exposed functions on an object
Based on a similar function in `qano`
@ref https://github.com/jclohmann/qano | [
"Promisifies",
"the",
"exposed",
"functions",
"on",
"an",
"object",
"Based",
"on",
"a",
"similar",
"function",
"in",
"qano"
] | 9dc0563eeaf40e9cb141c4478afece6d1f81aab5 | https://github.com/bdchauvette/nano-blue/blob/9dc0563eeaf40e9cb141c4478afece6d1f81aab5/lib/nano-blue.js#L15-L30 |
51,824 | nrn/mid | t/mid.js | rep | function rep (num, str) {
return function (arr, done) {
arr.forEach(function (i, idx) {
var s = ''
if (typeof i === 'string') s = i
if (idx === 0) return
else if (idx/num === Math.floor(idx/num)) arr[idx] = s + str
})
done()
}
} | javascript | function rep (num, str) {
return function (arr, done) {
arr.forEach(function (i, idx) {
var s = ''
if (typeof i === 'string') s = i
if (idx === 0) return
else if (idx/num === Math.floor(idx/num)) arr[idx] = s + str
})
done()
}
} | [
"function",
"rep",
"(",
"num",
",",
"str",
")",
"{",
"return",
"function",
"(",
"arr",
",",
"done",
")",
"{",
"arr",
".",
"forEach",
"(",
"function",
"(",
"i",
",",
"idx",
")",
"{",
"var",
"s",
"=",
"''",
"if",
"(",
"typeof",
"i",
"===",
"'stri... | Work for tests | [
"Work",
"for",
"tests"
] | d7a5555565292777947a24fe053b690b101b361b | https://github.com/nrn/mid/blob/d7a5555565292777947a24fe053b690b101b361b/t/mid.js#L52-L62 |
51,825 | ashleydavis/routey | fileMgr.js | function (dirPath) {
var dirContents = fs.readdirSync(dirPath);
return dirContents.filter(function (subDirName) {
// Filter out non-directories.
var subDirPath = path.join(dirPath, subDirName);
return fs.lstatSync(subDirPath).isDirectory();
});
} | javascript | function (dirPath) {
var dirContents = fs.readdirSync(dirPath);
return dirContents.filter(function (subDirName) {
// Filter out non-directories.
var subDirPath = path.join(dirPath, subDirName);
return fs.lstatSync(subDirPath).isDirectory();
});
} | [
"function",
"(",
"dirPath",
")",
"{",
"var",
"dirContents",
"=",
"fs",
".",
"readdirSync",
"(",
"dirPath",
")",
";",
"return",
"dirContents",
".",
"filter",
"(",
"function",
"(",
"subDirName",
")",
"{",
"// Filter out non-directories.",
"var",
"subDirPath",
"=... | Get a list of directories from the specified path. | [
"Get",
"a",
"list",
"of",
"directories",
"from",
"the",
"specified",
"path",
"."
] | dd5e797603f6f0b584d6712165e9b73c7d8efc78 | https://github.com/ashleydavis/routey/blob/dd5e797603f6f0b584d6712165e9b73c7d8efc78/fileMgr.js#L13-L21 | |
51,826 | jmjuanes/utily | lib/task.js | function(name)
{
//Check if the queue exists
if(typeof tasks[name] !== 'object'){ return; }
//Check if queue is paused
if(tasks[name].paused === true)
{
//Set task queue running false
tasks[name].running = false;
}
else
{
//Set queue running
tasks[name].running = true;
//Check the ... | javascript | function(name)
{
//Check if the queue exists
if(typeof tasks[name] !== 'object'){ return; }
//Check if queue is paused
if(tasks[name].paused === true)
{
//Set task queue running false
tasks[name].running = false;
}
else
{
//Set queue running
tasks[name].running = true;
//Check the ... | [
"function",
"(",
"name",
")",
"{",
"//Check if the queue exists",
"if",
"(",
"typeof",
"tasks",
"[",
"name",
"]",
"!==",
"'object'",
")",
"{",
"return",
";",
"}",
"//Check if queue is paused",
"if",
"(",
"tasks",
"[",
"name",
"]",
".",
"paused",
"===",
"tr... | Run a task by name | [
"Run",
"a",
"task",
"by",
"name"
] | f620180aa21fc8ece0f7b2c268cda335e9e28831 | https://github.com/jmjuanes/utily/blob/f620180aa21fc8ece0f7b2c268cda335e9e28831/lib/task.js#L5-L44 | |
51,827 | copress/copress-component-oauth2 | lib/errors/oauth2error.js | OAuth2Error | function OAuth2Error(message, code, uri, status) {
Error.call(this);
this.message = message;
this.code = code || 'server_error';
this.uri = uri;
this.status = status || 500;
} | javascript | function OAuth2Error(message, code, uri, status) {
Error.call(this);
this.message = message;
this.code = code || 'server_error';
this.uri = uri;
this.status = status || 500;
} | [
"function",
"OAuth2Error",
"(",
"message",
",",
"code",
",",
"uri",
",",
"status",
")",
"{",
"Error",
".",
"call",
"(",
"this",
")",
";",
"this",
".",
"message",
"=",
"message",
";",
"this",
".",
"code",
"=",
"code",
"||",
"'server_error'",
";",
"thi... | `OAuth2Error` error.
@api public | [
"OAuth2Error",
"error",
"."
] | 4819f379a0d42753bfd51e237c5c3aaddee37544 | https://github.com/copress/copress-component-oauth2/blob/4819f379a0d42753bfd51e237c5c3aaddee37544/lib/errors/oauth2error.js#L6-L12 |
51,828 | asavoy/grunt-requirejs-auto-bundles | lib/factorise.js | factoriseBundles | function factoriseBundles(modules, duplicates, loaderConfig, maxBundles) {
// Remember all dependencies, along with related information.
// dependencyId -> { mains: [...], size: 123 }
var allDependencies = {};
// Each module that is duplicated, is a module shared by two or more mains.
// So we gro... | javascript | function factoriseBundles(modules, duplicates, loaderConfig, maxBundles) {
// Remember all dependencies, along with related information.
// dependencyId -> { mains: [...], size: 123 }
var allDependencies = {};
// Each module that is duplicated, is a module shared by two or more mains.
// So we gro... | [
"function",
"factoriseBundles",
"(",
"modules",
",",
"duplicates",
",",
"loaderConfig",
",",
"maxBundles",
")",
"{",
"// Remember all dependencies, along with related information.",
"// dependencyId -> { mains: [...], size: 123 }",
"var",
"allDependencies",
"=",
"{",
"}",
";",
... | Calculate bundles from list of main modules and duplicates.
Modules should be same as modules: used in requirejs config options.
Duplicates looks like:
{
"jquery/jquery.js": ["pages/page1.js", "pages/page2.js"]
}
The output should be:
{
"bundles: {
"bundle1": ["jquery"],
"bundle2": ["lodash"]
},
"modules: [{
"name":... | [
"Calculate",
"bundles",
"from",
"list",
"of",
"main",
"modules",
"and",
"duplicates",
"."
] | c0f587c9720943dd32098203d2c71ab1387f1700 | https://github.com/asavoy/grunt-requirejs-auto-bundles/blob/c0f587c9720943dd32098203d2c71ab1387f1700/lib/factorise.js#L39-L118 |
51,829 | MostlyJS/mostly-feathers-mongoose | src/plugins/mongoose-cache.js | function (collectionKey, queryKey) {
return new Promise(function (ok) {
redisClient.multi().get(collectionKey).get(queryKey).exec(function (err, results) {
if (err) {
err.message = util.format('mongoose cache error %s', queryKey);
debug(err);
ok([null, null]); // ignore error, instea... | javascript | function (collectionKey, queryKey) {
return new Promise(function (ok) {
redisClient.multi().get(collectionKey).get(queryKey).exec(function (err, results) {
if (err) {
err.message = util.format('mongoose cache error %s', queryKey);
debug(err);
ok([null, null]); // ignore error, instea... | [
"function",
"(",
"collectionKey",
",",
"queryKey",
")",
"{",
"return",
"new",
"Promise",
"(",
"function",
"(",
"ok",
")",
"{",
"redisClient",
".",
"multi",
"(",
")",
".",
"get",
"(",
"collectionKey",
")",
".",
"get",
"(",
"queryKey",
")",
".",
"exec",
... | get query result = require(redis cache and check lastWrite | [
"get",
"query",
"result",
"=",
"require",
"(",
"redis",
"cache",
"and",
"check",
"lastWrite"
] | d20e150e054c784cc7db7c2487399e4f4eb730de | https://github.com/MostlyJS/mostly-feathers-mongoose/blob/d20e150e054c784cc7db7c2487399e4f4eb730de/src/plugins/mongoose-cache.js#L21-L43 | |
51,830 | alex-wdmg/jquery-helper | build/helper.js | smoothScroll | function smoothScroll() {
if (window.addEventListener)
window.addEventListener('DOMMouseScroll', wheel, false);
window.onmousewheel = document.onmousewheel = wheel;
var hb = {
sTop: 0,
sDelta: 0
};
function wheel(event) {
var distance = jQuery.browser.webkit ? 60 : 120;
if (event.wheelDelta)
delt... | javascript | function smoothScroll() {
if (window.addEventListener)
window.addEventListener('DOMMouseScroll', wheel, false);
window.onmousewheel = document.onmousewheel = wheel;
var hb = {
sTop: 0,
sDelta: 0
};
function wheel(event) {
var distance = jQuery.browser.webkit ? 60 : 120;
if (event.wheelDelta)
delt... | [
"function",
"smoothScroll",
"(",
")",
"{",
"if",
"(",
"window",
".",
"addEventListener",
")",
"window",
".",
"addEventListener",
"(",
"'DOMMouseScroll'",
",",
"wheel",
",",
"false",
")",
";",
"window",
".",
"onmousewheel",
"=",
"document",
".",
"onmousewheel",... | Smooth scroll plugin | [
"Smooth",
"scroll",
"plugin"
] | 39f8ac6c6b72fbf51f7aa5026d8a0d2c8361be57 | https://github.com/alex-wdmg/jquery-helper/blob/39f8ac6c6b72fbf51f7aa5026d8a0d2c8361be57/build/helper.js#L717-L757 |
51,831 | vimsucks/ezini | dist/ini.js | stringifySync | function stringifySync(obj) {
var output = "";
var firstOccur = true;
Object.keys(obj).forEach(function (key) {
if (typeof obj[key] === "string") {
output += key + "=" + obj[key];
output += os.EOL;
} else {
if (firstOccur) {
firstOccur = false;
} else {
output += os.EOL;
}
output += "... | javascript | function stringifySync(obj) {
var output = "";
var firstOccur = true;
Object.keys(obj).forEach(function (key) {
if (typeof obj[key] === "string") {
output += key + "=" + obj[key];
output += os.EOL;
} else {
if (firstOccur) {
firstOccur = false;
} else {
output += os.EOL;
}
output += "... | [
"function",
"stringifySync",
"(",
"obj",
")",
"{",
"var",
"output",
"=",
"\"\"",
";",
"var",
"firstOccur",
"=",
"true",
";",
"Object",
".",
"keys",
"(",
"obj",
")",
".",
"forEach",
"(",
"function",
"(",
"key",
")",
"{",
"if",
"(",
"typeof",
"obj",
... | Stringify an object to an ini-format string
@param {Object} obj Object to be stringify
@returns {string} INI-format string which is stringified from given object | [
"Stringify",
"an",
"object",
"to",
"an",
"ini",
"-",
"format",
"string"
] | 3bd04b8cd0694213dcfa3075b56536bf725daefe | https://github.com/vimsucks/ezini/blob/3bd04b8cd0694213dcfa3075b56536bf725daefe/dist/ini.js#L72-L107 |
51,832 | vimsucks/ezini | dist/ini.js | stringify | function stringify(obj, callback) {
process.nextTick(function () {
var str = stringifySync(obj);
callback(str);
});
} | javascript | function stringify(obj, callback) {
process.nextTick(function () {
var str = stringifySync(obj);
callback(str);
});
} | [
"function",
"stringify",
"(",
"obj",
",",
"callback",
")",
"{",
"process",
".",
"nextTick",
"(",
"function",
"(",
")",
"{",
"var",
"str",
"=",
"stringifySync",
"(",
"obj",
")",
";",
"callback",
"(",
"str",
")",
";",
"}",
")",
";",
"}"
] | Async wrapper of function stringifySync
@param {Object} obj Object to be stringify
@param callback Callback after parsing complete,
should have one parameter: str(stringified from given object) | [
"Async",
"wrapper",
"of",
"function",
"stringifySync"
] | 3bd04b8cd0694213dcfa3075b56536bf725daefe | https://github.com/vimsucks/ezini/blob/3bd04b8cd0694213dcfa3075b56536bf725daefe/dist/ini.js#L115-L120 |
51,833 | warmsea/WarmseaJS | dist/warmsea.js | function(behavior) {
return function(obj, iteratee, context) {
var result = {};
iteratee = _.iteratee(iteratee, context);
_.each(obj, function(value, index) {
var key = iteratee(value, index, obj);
behavior(result, value, key);
});
return result;
};
} | javascript | function(behavior) {
return function(obj, iteratee, context) {
var result = {};
iteratee = _.iteratee(iteratee, context);
_.each(obj, function(value, index) {
var key = iteratee(value, index, obj);
behavior(result, value, key);
});
return result;
};
} | [
"function",
"(",
"behavior",
")",
"{",
"return",
"function",
"(",
"obj",
",",
"iteratee",
",",
"context",
")",
"{",
"var",
"result",
"=",
"{",
"}",
";",
"iteratee",
"=",
"_",
".",
"iteratee",
"(",
"iteratee",
",",
"context",
")",
";",
"_",
".",
"ea... | An internal function used for aggregate "group by" operations. | [
"An",
"internal",
"function",
"used",
"for",
"aggregate",
"group",
"by",
"operations",
"."
] | 58c32c75b26647bbec39dc401a78b0fdb5896c8d | https://github.com/warmsea/WarmseaJS/blob/58c32c75b26647bbec39dc401a78b0fdb5896c8d/dist/warmsea.js#L370-L380 | |
51,834 | mysticatea/warun | bin/events.js | emitSIGINT | function emitSIGINT() {
if (rl) {
rl.close()
rl = null
}
if (ipcListener) {
process.removeListener("message", ipcListener)
ipcListener = null
}
emitter.emit("SIGINT")
} | javascript | function emitSIGINT() {
if (rl) {
rl.close()
rl = null
}
if (ipcListener) {
process.removeListener("message", ipcListener)
ipcListener = null
}
emitter.emit("SIGINT")
} | [
"function",
"emitSIGINT",
"(",
")",
"{",
"if",
"(",
"rl",
")",
"{",
"rl",
".",
"close",
"(",
")",
"rl",
"=",
"null",
"}",
"if",
"(",
"ipcListener",
")",
"{",
"process",
".",
"removeListener",
"(",
"\"message\"",
",",
"ipcListener",
")",
"ipcListener",
... | Emit SIGINT event.
@returns {void} | [
"Emit",
"SIGINT",
"event",
"."
] | 9dc36fa1aeddf6540f0effd6726a056d9a3287f1 | https://github.com/mysticatea/warun/blob/9dc36fa1aeddf6540f0effd6726a056d9a3287f1/bin/events.js#L19-L30 |
51,835 | tolokoban/ToloFrameWork | ker/tfw3.js | function(className) {
var cls = _classes[className];
if (!cls) {
var k, name,
def = window["TFW::" + className];
if (!def) {
throw new Error(
"[TFW3] This class has not been defined: \"" + className + "\"!\n"
... | javascript | function(className) {
var cls = _classes[className];
if (!cls) {
var k, name,
def = window["TFW::" + className];
if (!def) {
throw new Error(
"[TFW3] This class has not been defined: \"" + className + "\"!\n"
... | [
"function",
"(",
"className",
")",
"{",
"var",
"cls",
"=",
"_classes",
"[",
"className",
"]",
";",
"if",
"(",
"!",
"cls",
")",
"{",
"var",
"k",
",",
"name",
",",
"def",
"=",
"window",
"[",
"\"TFW::\"",
"+",
"className",
"]",
";",
"if",
"(",
"!",
... | Load class definition. | [
"Load",
"class",
"definition",
"."
] | 730845a833a9660ebfdb60ad027ebaab5ac871b6 | https://github.com/tolokoban/ToloFrameWork/blob/730845a833a9660ebfdb60ad027ebaab5ac871b6/ker/tfw3.js#L261-L341 | |
51,836 | hypergroup/hyper-json-immutable-parse | index.js | parse | function parse(base, key, value) {
var type = typeof value;
// resolve local JSON pointers
if (key === 'href' && type === 'string') return formatHref(base, value);
// TODO resolve "/" paths
if (!value || type !== 'object') return value;
var obj = copy(value);
if (key === '' || obj.href) seal(base || o... | javascript | function parse(base, key, value) {
var type = typeof value;
// resolve local JSON pointers
if (key === 'href' && type === 'string') return formatHref(base, value);
// TODO resolve "/" paths
if (!value || type !== 'object') return value;
var obj = copy(value);
if (key === '' || obj.href) seal(base || o... | [
"function",
"parse",
"(",
"base",
",",
"key",
",",
"value",
")",
"{",
"var",
"type",
"=",
"typeof",
"value",
";",
"// resolve local JSON pointers",
"if",
"(",
"key",
"===",
"'href'",
"&&",
"type",
"===",
"'string'",
")",
"return",
"formatHref",
"(",
"base"... | Parse a key value pair
@param {String} href
@param {String} key
@param {Any} value | [
"Parse",
"a",
"key",
"value",
"pair"
] | b77467c70bfe1c5b49f749a915fe585d7bac256d | https://github.com/hypergroup/hyper-json-immutable-parse/blob/b77467c70bfe1c5b49f749a915fe585d7bac256d/index.js#L26-L40 |
51,837 | zipscene/polytoken | lib/geometry.js | getPointLineSegmentState | function getPointLineSegmentState([ x, y ], [ [ beginX, beginY ], [ endX, endY ] ]) {
if (!isPointInLine([ x, y ], [ [ beginX, beginY ], [ endX, endY ] ])) {
return OUTSIDE;
}
if (beginX === endX) {
if (roundToFiveSignificantDigits((y - beginY) * (y - endY)) < 0) {
return INSIDE;
} else if (roundToFiveSigni... | javascript | function getPointLineSegmentState([ x, y ], [ [ beginX, beginY ], [ endX, endY ] ]) {
if (!isPointInLine([ x, y ], [ [ beginX, beginY ], [ endX, endY ] ])) {
return OUTSIDE;
}
if (beginX === endX) {
if (roundToFiveSignificantDigits((y - beginY) * (y - endY)) < 0) {
return INSIDE;
} else if (roundToFiveSigni... | [
"function",
"getPointLineSegmentState",
"(",
"[",
"x",
",",
"y",
"]",
",",
"[",
"[",
"beginX",
",",
"beginY",
"]",
",",
"[",
"endX",
",",
"endY",
"]",
"]",
")",
"{",
"if",
"(",
"!",
"isPointInLine",
"(",
"[",
"x",
",",
"y",
"]",
",",
"[",
"[",
... | Get the state of a point in relationship to a line segment
@method getPointLineSegmentState
@param {Number[]} [ x, y ] - coordinates of the point
@param {Number[][]} [ [ beginX, beginY ], [ endX, endY ] ] - coordinates of begin and end points of the line segment
@return {String} - return the state of the point. Can on... | [
"Get",
"the",
"state",
"of",
"a",
"point",
"in",
"relationship",
"to",
"a",
"line",
"segment"
] | e2cab71d0c3cdec6ff702b7bb434b585ba13efe0 | https://github.com/zipscene/polytoken/blob/e2cab71d0c3cdec6ff702b7bb434b585ba13efe0/lib/geometry.js#L45-L75 |
51,838 | zipscene/polytoken | lib/geometry.js | getLineIntersect | function getLineIntersect([ line1Begin, line1End ], [ line2Begin, line2End ]) {
let [ x1Begin, y1Begin ] = line1Begin;
let [ x1End, y1End ] = line1End;
let [ x2Begin, y2Begin ] = line2Begin;
let [ x2End, y2End ] = line2End;
if ((x1Begin === x1End && y1Begin === y1End) || (x2Begin === x2End && y2Begin === y2End)) {... | javascript | function getLineIntersect([ line1Begin, line1End ], [ line2Begin, line2End ]) {
let [ x1Begin, y1Begin ] = line1Begin;
let [ x1End, y1End ] = line1End;
let [ x2Begin, y2Begin ] = line2Begin;
let [ x2End, y2End ] = line2End;
if ((x1Begin === x1End && y1Begin === y1End) || (x2Begin === x2End && y2Begin === y2End)) {... | [
"function",
"getLineIntersect",
"(",
"[",
"line1Begin",
",",
"line1End",
"]",
",",
"[",
"line2Begin",
",",
"line2End",
"]",
")",
"{",
"let",
"[",
"x1Begin",
",",
"y1Begin",
"]",
"=",
"line1Begin",
";",
"let",
"[",
"x1End",
",",
"y1End",
"]",
"=",
"line... | Get the intersect point of two lines
@method getLineIntersect
@param {Number[]} line1Begin - coordianates of first point in line1
@param {Number[]} line1End - coordianates of second point of line1
@param {Number[]} line2Begin - coordianates of first point in line2
@param {Number[]} line2End - coordianates of second p... | [
"Get",
"the",
"intersect",
"point",
"of",
"two",
"lines"
] | e2cab71d0c3cdec6ff702b7bb434b585ba13efe0 | https://github.com/zipscene/polytoken/blob/e2cab71d0c3cdec6ff702b7bb434b585ba13efe0/lib/geometry.js#L115-L168 |
51,839 | zipscene/polytoken | lib/geometry.js | getLineSegmentsIntersectState | function getLineSegmentsIntersectState([ line1Begin, line1End ], [ line2Begin, line2End ]) {
let [ x1Begin, y1Begin ] = line1Begin;
let [ x1End, y1End ] = line1End;
let [ x2Begin, y2Begin ] = line2Begin;
let [ x2End, y2End ] = line2End;
if ((x1Begin === x1End && y1Begin === y1End) || (x2Begin === x2End && y2Begin ... | javascript | function getLineSegmentsIntersectState([ line1Begin, line1End ], [ line2Begin, line2End ]) {
let [ x1Begin, y1Begin ] = line1Begin;
let [ x1End, y1End ] = line1End;
let [ x2Begin, y2Begin ] = line2Begin;
let [ x2End, y2End ] = line2End;
if ((x1Begin === x1End && y1Begin === y1End) || (x2Begin === x2End && y2Begin ... | [
"function",
"getLineSegmentsIntersectState",
"(",
"[",
"line1Begin",
",",
"line1End",
"]",
",",
"[",
"line2Begin",
",",
"line2End",
"]",
")",
"{",
"let",
"[",
"x1Begin",
",",
"y1Begin",
"]",
"=",
"line1Begin",
";",
"let",
"[",
"x1End",
",",
"y1End",
"]",
... | Get the state of line segment line2 relative to line segment line1. Available states are INTERSECT,
UNINTERSECT, INCLUDED, OVERLAP and TANGENT
@getLineSegmentsIntersectState
@param {Number[][]} - coordinates of begin and end of line segment line1
@param {Number[][]} - coordinates of begin and end of line segment line2... | [
"Get",
"the",
"state",
"of",
"line",
"segment",
"line2",
"relative",
"to",
"line",
"segment",
"line1",
".",
"Available",
"states",
"are",
"INTERSECT",
"UNINTERSECT",
"INCLUDED",
"OVERLAP",
"and",
"TANGENT"
] | e2cab71d0c3cdec6ff702b7bb434b585ba13efe0 | https://github.com/zipscene/polytoken/blob/e2cab71d0c3cdec6ff702b7bb434b585ba13efe0/lib/geometry.js#L181-L239 |
51,840 | zipscene/polytoken | lib/geometry.js | getRandPointInLineSegment | function getRandPointInLineSegment([ [ beginX, beginY ], [ endX, endY ] ]) {
let smallX = beginX <= endX ? beginX : endX;
let largeX = beginX >= endX ? beginX : endX;
let smallY = beginY <= endY ? beginY : endY;
let largeY = beginY >= endY ? beginY : endY;
if (beginY === endY) return [ roundToFiveSignificantDigits... | javascript | function getRandPointInLineSegment([ [ beginX, beginY ], [ endX, endY ] ]) {
let smallX = beginX <= endX ? beginX : endX;
let largeX = beginX >= endX ? beginX : endX;
let smallY = beginY <= endY ? beginY : endY;
let largeY = beginY >= endY ? beginY : endY;
if (beginY === endY) return [ roundToFiveSignificantDigits... | [
"function",
"getRandPointInLineSegment",
"(",
"[",
"[",
"beginX",
",",
"beginY",
"]",
",",
"[",
"endX",
",",
"endY",
"]",
"]",
")",
"{",
"let",
"smallX",
"=",
"beginX",
"<=",
"endX",
"?",
"beginX",
":",
"endX",
";",
"let",
"largeX",
"=",
"beginX",
">... | Get a random point in given line segment
@method getRandPointInLineSegment
@param {Number[][]} - coordinates of begin and end points of the line segment
@return {Number[]} - coordinates of generated random point | [
"Get",
"a",
"random",
"point",
"in",
"given",
"line",
"segment"
] | e2cab71d0c3cdec6ff702b7bb434b585ba13efe0 | https://github.com/zipscene/polytoken/blob/e2cab71d0c3cdec6ff702b7bb434b585ba13efe0/lib/geometry.js#L249-L261 |
51,841 | zipscene/polytoken | lib/geometry.js | getLinearRingsIntersectState | function getLinearRingsIntersectState(linearRing1, linearRing2) {
let isLinearRingsTouching = false;
for (let i = 0; i < linearRing1.length - 1; i++) {
for (let j = 0; j < linearRing2.length - 1; j++) {
let state = getLineSegmentsIntersectState(
[ linearRing2[j], linearRing2[j + 1] ], [ linearRing1[i], linea... | javascript | function getLinearRingsIntersectState(linearRing1, linearRing2) {
let isLinearRingsTouching = false;
for (let i = 0; i < linearRing1.length - 1; i++) {
for (let j = 0; j < linearRing2.length - 1; j++) {
let state = getLineSegmentsIntersectState(
[ linearRing2[j], linearRing2[j + 1] ], [ linearRing1[i], linea... | [
"function",
"getLinearRingsIntersectState",
"(",
"linearRing1",
",",
"linearRing2",
")",
"{",
"let",
"isLinearRingsTouching",
"=",
"false",
";",
"for",
"(",
"let",
"i",
"=",
"0",
";",
"i",
"<",
"linearRing1",
".",
"length",
"-",
"1",
";",
"i",
"++",
")",
... | Get the state of lienarRing2 in relationship to linearRing1
@method getLinearRingsIntersectState
@param {Number[][]} - coordinates of linearRing1
@param {Number\[][]} - coordinates of linearRing2
@return {String} - return the state. It can only be one of: 'intersect', 'outside'
and 'inside' | [
"Get",
"the",
"state",
"of",
"lienarRing2",
"in",
"relationship",
"to",
"linearRing1"
] | e2cab71d0c3cdec6ff702b7bb434b585ba13efe0 | https://github.com/zipscene/polytoken/blob/e2cab71d0c3cdec6ff702b7bb434b585ba13efe0/lib/geometry.js#L273-L327 |
51,842 | zipscene/polytoken | lib/geometry.js | getRayLineSegmentIntersectState | function getRayLineSegmentIntersectState([ rayOrigin, rayPoint ], [ lineBegin, lineEnd ]) {
// Find unit deviations for ray and point
let dRay = vectorSubtract(rayPoint, rayOrigin);
let dLine = vectorSubtract(lineEnd, lineBegin);
if (vectorCross(dRay, dLine) === 0) {
if (vectorCross(vectorSubtract(lineBegin, ray... | javascript | function getRayLineSegmentIntersectState([ rayOrigin, rayPoint ], [ lineBegin, lineEnd ]) {
// Find unit deviations for ray and point
let dRay = vectorSubtract(rayPoint, rayOrigin);
let dLine = vectorSubtract(lineEnd, lineBegin);
if (vectorCross(dRay, dLine) === 0) {
if (vectorCross(vectorSubtract(lineBegin, ray... | [
"function",
"getRayLineSegmentIntersectState",
"(",
"[",
"rayOrigin",
",",
"rayPoint",
"]",
",",
"[",
"lineBegin",
",",
"lineEnd",
"]",
")",
"{",
"// Find unit deviations for ray and point",
"let",
"dRay",
"=",
"vectorSubtract",
"(",
"rayPoint",
",",
"rayOrigin",
")... | get the state of ray in relationship to a line segment
@method getRayLineSegmentIntersectState
@param {Number[][]} [ point, point2 ] - `point` is the begin point of the ray. `point2` is a point in ray
@param {Number[][]} [ lineBegin, lineEnd ] - coordinates of begin and end point of line segment
@return {String} - ret... | [
"get",
"the",
"state",
"of",
"ray",
"in",
"relationship",
"to",
"a",
"line",
"segment"
] | e2cab71d0c3cdec6ff702b7bb434b585ba13efe0 | https://github.com/zipscene/polytoken/blob/e2cab71d0c3cdec6ff702b7bb434b585ba13efe0/lib/geometry.js#L338-L370 |
51,843 | zipscene/polytoken | lib/geometry.js | pointLinearRingState | function pointLinearRingState(point, linearRing) {
let { topLeftVertex, width, height } = getBoundingBox(linearRing);
let [ minX, maxY ] = topLeftVertex;
let maxX = minX + width;
let minY = maxY - height;
let [ x, y ] = point;
if (x < minX || x > maxX || y < minY || y > maxY) return OUTSIDE;
for (let i = 0; i < ... | javascript | function pointLinearRingState(point, linearRing) {
let { topLeftVertex, width, height } = getBoundingBox(linearRing);
let [ minX, maxY ] = topLeftVertex;
let maxX = minX + width;
let minY = maxY - height;
let [ x, y ] = point;
if (x < minX || x > maxX || y < minY || y > maxY) return OUTSIDE;
for (let i = 0; i < ... | [
"function",
"pointLinearRingState",
"(",
"point",
",",
"linearRing",
")",
"{",
"let",
"{",
"topLeftVertex",
",",
"width",
",",
"height",
"}",
"=",
"getBoundingBox",
"(",
"linearRing",
")",
";",
"let",
"[",
"minX",
",",
"maxY",
"]",
"=",
"topLeftVertex",
";... | Get the state of point in relationship to a linear ring
@method pointLinearRingState
@param {Number[]} point - coordinates of the point
@param {Number[][]} - linearRing - coordinates of vertexes of the linear ring
@return {String} - return the state. Can only be one of: 'outside', 'inside'
and 'tangent' | [
"Get",
"the",
"state",
"of",
"point",
"in",
"relationship",
"to",
"a",
"linear",
"ring"
] | e2cab71d0c3cdec6ff702b7bb434b585ba13efe0 | https://github.com/zipscene/polytoken/blob/e2cab71d0c3cdec6ff702b7bb434b585ba13efe0/lib/geometry.js#L382-L420 |
51,844 | zipscene/polytoken | lib/geometry.js | getBoundingBox | function getBoundingBox(linearRing) {
if (!Array.isArray(linearRing)) {
throw new XError(XError.INVALID_ARGUMENT, 'linearRing must be an array');
}
let leftX = Infinity;
let rightX = -Infinity;
let bottomY = Infinity;
let topY = -Infinity;
for (let point of linearRing) {
if (!Array.isArray(point) || point.l... | javascript | function getBoundingBox(linearRing) {
if (!Array.isArray(linearRing)) {
throw new XError(XError.INVALID_ARGUMENT, 'linearRing must be an array');
}
let leftX = Infinity;
let rightX = -Infinity;
let bottomY = Infinity;
let topY = -Infinity;
for (let point of linearRing) {
if (!Array.isArray(point) || point.l... | [
"function",
"getBoundingBox",
"(",
"linearRing",
")",
"{",
"if",
"(",
"!",
"Array",
".",
"isArray",
"(",
"linearRing",
")",
")",
"{",
"throw",
"new",
"XError",
"(",
"XError",
".",
"INVALID_ARGUMENT",
",",
"'linearRing must be an array'",
")",
";",
"}",
"let"... | Get the bounding box of given linear ring
@method getBoundingBox
@param {Number[][]} linearRing - coordinates of vertexes of the linear ring
@return {Object} - return an object like this: { topLeftVertex: [ 2, 3 ], width: 1, height: 2 },
where `topLeftVertex` is the top left vertex of the bounding box | [
"Get",
"the",
"bounding",
"box",
"of",
"given",
"linear",
"ring"
] | e2cab71d0c3cdec6ff702b7bb434b585ba13efe0 | https://github.com/zipscene/polytoken/blob/e2cab71d0c3cdec6ff702b7bb434b585ba13efe0/lib/geometry.js#L431-L455 |
51,845 | zipscene/polytoken | lib/geometry.js | squareLinearRingIntersectState | function squareLinearRingIntersectState(linearRing, topLeftVertex, squareSize) {
let [ topLeftX, topLeftY ] = topLeftVertex;
let topRightVertex = [ topLeftX + squareSize, topLeftY ];
let bottomRightVertex = [ topLeftX + squareSize, topLeftY - squareSize ];
let bottomLeftVertex = [ topLeftX, topLeftY - squareSize ];... | javascript | function squareLinearRingIntersectState(linearRing, topLeftVertex, squareSize) {
let [ topLeftX, topLeftY ] = topLeftVertex;
let topRightVertex = [ topLeftX + squareSize, topLeftY ];
let bottomRightVertex = [ topLeftX + squareSize, topLeftY - squareSize ];
let bottomLeftVertex = [ topLeftX, topLeftY - squareSize ];... | [
"function",
"squareLinearRingIntersectState",
"(",
"linearRing",
",",
"topLeftVertex",
",",
"squareSize",
")",
"{",
"let",
"[",
"topLeftX",
",",
"topLeftY",
"]",
"=",
"topLeftVertex",
";",
"let",
"topRightVertex",
"=",
"[",
"topLeftX",
"+",
"squareSize",
",",
"t... | Get the state of a square linear ring in relationship to another linear ring
@method squareLinearRingIntersectState
@param {Numner[][]} linearRing - coordinates of the linear ring
@param {Number[]} topLeftVertex - coordinates of the top left vertx of the square
@param {Number} squareSize - size of edge of the square
@... | [
"Get",
"the",
"state",
"of",
"a",
"square",
"linear",
"ring",
"in",
"relationship",
"to",
"another",
"linear",
"ring"
] | e2cab71d0c3cdec6ff702b7bb434b585ba13efe0 | https://github.com/zipscene/polytoken/blob/e2cab71d0c3cdec6ff702b7bb434b585ba13efe0/lib/geometry.js#L468-L475 |
51,846 | defeo/was_framework | demo/static/update_user.js | ajax_return | function ajax_return(data, status, xhr) {
// If the update was successfull
if (data.ok) {
// Forget old value
this.removeData('old-value');
// Add a green V to the right
this.parent().next()
.off('click')
.html('V')
.css('color', 'LimeGreen')
.attr('title', 'Update OK');
// If we modif... | javascript | function ajax_return(data, status, xhr) {
// If the update was successfull
if (data.ok) {
// Forget old value
this.removeData('old-value');
// Add a green V to the right
this.parent().next()
.off('click')
.html('V')
.css('color', 'LimeGreen')
.attr('title', 'Update OK');
// If we modif... | [
"function",
"ajax_return",
"(",
"data",
",",
"status",
",",
"xhr",
")",
"{",
"// If the update was successfull",
"if",
"(",
"data",
".",
"ok",
")",
"{",
"// Forget old value",
"this",
".",
"removeData",
"(",
"'old-value'",
")",
";",
"// Add a green V to the right"... | This function is called when the AJAX request returns | [
"This",
"function",
"is",
"called",
"when",
"the",
"AJAX",
"request",
"returns"
] | ab52bbbf5943e9062fe6ea82f1fea637a11d727a | https://github.com/defeo/was_framework/blob/ab52bbbf5943e9062fe6ea82f1fea637a11d727a/demo/static/update_user.js#L63-L101 |
51,847 | feedhenry/fh-mbaas-middleware | lib/models.js | init | function init(config, cb) {
connection = mongoose.createConnection(config.mongoUrl);
var firstCallback = true;
connection.on('error', function(err) {
log.logger.error('Mongo error: ' + util.inspect(err));
if (firstCallback) {
firstCallback = false;
return cb(err);
} else ... | javascript | function init(config, cb) {
connection = mongoose.createConnection(config.mongoUrl);
var firstCallback = true;
connection.on('error', function(err) {
log.logger.error('Mongo error: ' + util.inspect(err));
if (firstCallback) {
firstCallback = false;
return cb(err);
} else ... | [
"function",
"init",
"(",
"config",
",",
"cb",
")",
"{",
"connection",
"=",
"mongoose",
".",
"createConnection",
"(",
"config",
".",
"mongoUrl",
")",
";",
"var",
"firstCallback",
"=",
"true",
";",
"connection",
".",
"on",
"(",
"'error'",
",",
"function",
... | init our Mongo database | [
"init",
"our",
"Mongo",
"database"
] | f906e98efbb4b0963bf5137b34b5e0589ba24e69 | https://github.com/feedhenry/fh-mbaas-middleware/blob/f906e98efbb4b0963bf5137b34b5e0589ba24e69/lib/models.js#L9-L47 |
51,848 | feedhenry/fh-mbaas-middleware | lib/models.js | disconnect | function disconnect(cb) {
if (connection) {
log.logger.debug('Mongoose disconnected');
connection.close(cb);
} else {
cb();
}
} | javascript | function disconnect(cb) {
if (connection) {
log.logger.debug('Mongoose disconnected');
connection.close(cb);
} else {
cb();
}
} | [
"function",
"disconnect",
"(",
"cb",
")",
"{",
"if",
"(",
"connection",
")",
"{",
"log",
".",
"logger",
".",
"debug",
"(",
"'Mongoose disconnected'",
")",
";",
"connection",
".",
"close",
"(",
"cb",
")",
";",
"}",
"else",
"{",
"cb",
"(",
")",
";",
... | Close all db handles, etc | [
"Close",
"all",
"db",
"handles",
"etc"
] | f906e98efbb4b0963bf5137b34b5e0589ba24e69 | https://github.com/feedhenry/fh-mbaas-middleware/blob/f906e98efbb4b0963bf5137b34b5e0589ba24e69/lib/models.js#L50-L57 |
51,849 | andrewscwei/requiem | src/dom/removeFromChildRegistry.js | removeFromChildRegistry | function removeFromChildRegistry(childRegistry, child) {
assertType(childRegistry, 'object', false, 'Invalid child registry specified');
assertType(child, [Node, Array, 'string'], false, 'Invalid child(ren) or name specified');
if (typeof child === 'string') {
let targets = child.split('.');
let currentT... | javascript | function removeFromChildRegistry(childRegistry, child) {
assertType(childRegistry, 'object', false, 'Invalid child registry specified');
assertType(child, [Node, Array, 'string'], false, 'Invalid child(ren) or name specified');
if (typeof child === 'string') {
let targets = child.split('.');
let currentT... | [
"function",
"removeFromChildRegistry",
"(",
"childRegistry",
",",
"child",
")",
"{",
"assertType",
"(",
"childRegistry",
",",
"'object'",
",",
"false",
",",
"'Invalid child registry specified'",
")",
";",
"assertType",
"(",
"child",
",",
"[",
"Node",
",",
"Array",... | Removes a child or an array of children with the same name from the specified
child registry.
@param {Object} childRegistry - The child registry.
@param {Node|Array|string} child - Either one child element or an array of
multiple child elements with the same name
or the name in dot notation.
@alias module:requiem~dom... | [
"Removes",
"a",
"child",
"or",
"an",
"array",
"of",
"children",
"with",
"the",
"same",
"name",
"from",
"the",
"specified",
"child",
"registry",
"."
] | c4182bfffc9841c6de5718f689ad3c2060511777 | https://github.com/andrewscwei/requiem/blob/c4182bfffc9841c6de5718f689ad3c2060511777/src/dom/removeFromChildRegistry.js#L19-L71 |
51,850 | matter-in-motion/mm-http | http.js | function(path, contract) {
if (!contract) {
contract = path;
path = '/';
}
if (contract.handle) {
this.root.use(path, (req, res, next) => {
contract.handle(req, res, next)
});
} else {
this.root.use(path, contract);
}
return this;
} | javascript | function(path, contract) {
if (!contract) {
contract = path;
path = '/';
}
if (contract.handle) {
this.root.use(path, (req, res, next) => {
contract.handle(req, res, next)
});
} else {
this.root.use(path, contract);
}
return this;
} | [
"function",
"(",
"path",
",",
"contract",
")",
"{",
"if",
"(",
"!",
"contract",
")",
"{",
"contract",
"=",
"path",
";",
"path",
"=",
"'/'",
";",
"}",
"if",
"(",
"contract",
".",
"handle",
")",
"{",
"this",
".",
"root",
".",
"use",
"(",
"path",
... | use function will be added as the app use method | [
"use",
"function",
"will",
"be",
"added",
"as",
"the",
"app",
"use",
"method"
] | 0947bf7f6a5fa794a0d13d97d7162feaae895291 | https://github.com/matter-in-motion/mm-http/blob/0947bf7f6a5fa794a0d13d97d7162feaae895291/http.js#L19-L33 | |
51,851 | Becklyn/becklyn-gulp | tasks/js_bundle.js | logJsHintWarning | function logJsHintWarning (errors)
{
totalIssues += errors.length;
var sourceFile = pathHelper.makeRelative(this.resourcePath);
gulpUtil.log(gulpUtil.colors.yellow("jshint warning") + " in " + sourceFile);
for (var i = 0, l = errors.length; i < l; i++)
{
var error = errors[i];
gul... | javascript | function logJsHintWarning (errors)
{
totalIssues += errors.length;
var sourceFile = pathHelper.makeRelative(this.resourcePath);
gulpUtil.log(gulpUtil.colors.yellow("jshint warning") + " in " + sourceFile);
for (var i = 0, l = errors.length; i < l; i++)
{
var error = errors[i];
gul... | [
"function",
"logJsHintWarning",
"(",
"errors",
")",
"{",
"totalIssues",
"+=",
"errors",
".",
"length",
";",
"var",
"sourceFile",
"=",
"pathHelper",
".",
"makeRelative",
"(",
"this",
".",
"resourcePath",
")",
";",
"gulpUtil",
".",
"log",
"(",
"gulpUtil",
".",... | Logs jsHint warnings to the console
@param {Array.<{
raw: string,
code: string,
evidence: string,
line: number,
character: number,
scope: string,
reason: string
}>} errors | [
"Logs",
"jsHint",
"warnings",
"to",
"the",
"console"
] | 1c633378d561f07101f9db19ccd153617b8e0252 | https://github.com/Becklyn/becklyn-gulp/blob/1c633378d561f07101f9db19ccd153617b8e0252/tasks/js_bundle.js#L39-L68 |
51,852 | Becklyn/becklyn-gulp | tasks/js_bundle.js | reportTotalIssueCount | function reportTotalIssueCount ()
{
var outputColor = gulpUtil.colors.green;
if (totalIssues > 0)
{
outputColor = gulpUtil.colors.red;
}
gulpUtil.log(gulpUtil.colors.yellow('»»'), 'Total JS issues:', outputColor(totalIssues));
// Reset the issue count so we don't increment it every tim... | javascript | function reportTotalIssueCount ()
{
var outputColor = gulpUtil.colors.green;
if (totalIssues > 0)
{
outputColor = gulpUtil.colors.red;
}
gulpUtil.log(gulpUtil.colors.yellow('»»'), 'Total JS issues:', outputColor(totalIssues));
// Reset the issue count so we don't increment it every tim... | [
"function",
"reportTotalIssueCount",
"(",
")",
"{",
"var",
"outputColor",
"=",
"gulpUtil",
".",
"colors",
".",
"green",
";",
"if",
"(",
"totalIssues",
">",
"0",
")",
"{",
"outputColor",
"=",
"gulpUtil",
".",
"colors",
".",
"red",
";",
"}",
"gulpUtil",
".... | Reports the total amount of JavaScript issues detected by JsHint | [
"Reports",
"the",
"total",
"amount",
"of",
"JavaScript",
"issues",
"detected",
"by",
"JsHint"
] | 1c633378d561f07101f9db19ccd153617b8e0252 | https://github.com/Becklyn/becklyn-gulp/blob/1c633378d561f07101f9db19ccd153617b8e0252/tasks/js_bundle.js#L74-L86 |
51,853 | JustZisGuy/wildling | src/token.js | getTokenParameters | function getTokenParameters(index) {
let stringLength;
let indexWithOffset;
indexWithOffset = index;
for (stringLength = startLength; stringLength <= endLength; stringLength += 1) {
const offsetCount = variants.length ** stringLength;
if (indexWithOffset < offsetCount) {
break;
... | javascript | function getTokenParameters(index) {
let stringLength;
let indexWithOffset;
indexWithOffset = index;
for (stringLength = startLength; stringLength <= endLength; stringLength += 1) {
const offsetCount = variants.length ** stringLength;
if (indexWithOffset < offsetCount) {
break;
... | [
"function",
"getTokenParameters",
"(",
"index",
")",
"{",
"let",
"stringLength",
";",
"let",
"indexWithOffset",
";",
"indexWithOffset",
"=",
"index",
";",
"for",
"(",
"stringLength",
"=",
"startLength",
";",
"stringLength",
"<=",
"endLength",
";",
"stringLength",
... | calculate length of target combination and index for that particular length | [
"calculate",
"length",
"of",
"target",
"combination",
"and",
"index",
"for",
"that",
"particular",
"length"
] | 4745a99e523213cb3bfde5759c8390b79fa6ab88 | https://github.com/JustZisGuy/wildling/blob/4745a99e523213cb3bfde5759c8390b79fa6ab88/src/token.js#L16-L34 |
51,854 | byron-dupreez/aws-stream-consumer-core | esm-cache.js | clearCache | function clearCache() {
let deletedCount = 0;
const iter = eventSourceMappingKeysByFunctionAndStream.entries();
let next = iter.next();
while (!next.done) {
const [k, key] = next.value;
const deleted = eventSourceMappingPromisesByKey.delete(key);
eventSourceMappingKeysByFunctionAndStream.delete(k)... | javascript | function clearCache() {
let deletedCount = 0;
const iter = eventSourceMappingKeysByFunctionAndStream.entries();
let next = iter.next();
while (!next.done) {
const [k, key] = next.value;
const deleted = eventSourceMappingPromisesByKey.delete(key);
eventSourceMappingKeysByFunctionAndStream.delete(k)... | [
"function",
"clearCache",
"(",
")",
"{",
"let",
"deletedCount",
"=",
"0",
";",
"const",
"iter",
"=",
"eventSourceMappingKeysByFunctionAndStream",
".",
"entries",
"(",
")",
";",
"let",
"next",
"=",
"iter",
".",
"next",
"(",
")",
";",
"while",
"(",
"!",
"n... | Clears the event source mapping key and promise caches.
@return {number} the number of promises removed from the cache | [
"Clears",
"the",
"event",
"source",
"mapping",
"key",
"and",
"promise",
"caches",
"."
] | 9b256084297f80d373bcf483aaf68a9da176b3d7 | https://github.com/byron-dupreez/aws-stream-consumer-core/blob/9b256084297f80d373bcf483aaf68a9da176b3d7/esm-cache.js#L115-L134 |
51,855 | jsekamane/Cree | client/cree-client.js | loadPage | function loadPage(url) {
$("#container").load(url+" #container > *", function(response, status, xhr){
$('html,body').scrollTop(0); // Scroll to the top when loading new page.
if(status == "error"){
$("#container").prepend('<p class="alert alert-danger" role="alert"><strong>'+msgError+'</strong> '+xhr.status... | javascript | function loadPage(url) {
$("#container").load(url+" #container > *", function(response, status, xhr){
$('html,body').scrollTop(0); // Scroll to the top when loading new page.
if(status == "error"){
$("#container").prepend('<p class="alert alert-danger" role="alert"><strong>'+msgError+'</strong> '+xhr.status... | [
"function",
"loadPage",
"(",
"url",
")",
"{",
"$",
"(",
"\"#container\"",
")",
".",
"load",
"(",
"url",
"+",
"\" #container > *\"",
",",
"function",
"(",
"response",
",",
"status",
",",
"xhr",
")",
"{",
"$",
"(",
"'html,body'",
")",
".",
"scrollTop",
"... | Using AJAX, load the url that was received from the server through a 'load' message. | [
"Using",
"AJAX",
"load",
"the",
"url",
"that",
"was",
"received",
"from",
"the",
"server",
"through",
"a",
"load",
"message",
"."
] | ccff87d4bb5b95c8d96c44731033f29a82df871e | https://github.com/jsekamane/Cree/blob/ccff87d4bb5b95c8d96c44731033f29a82df871e/client/cree-client.js#L51-L61 |
51,856 | jsekamane/Cree | client/cree-client.js | next | function next() {
var data = new Object();
// Submit content of all forms -- except those with class 'ignore-form' -- before going to next page.
$('#container form:not(.ignore-form)').each(function(index) {
//console.log("Form no. "+index + " with the ID #" + $(this).attr('id') );
//console.log($( this )... | javascript | function next() {
var data = new Object();
// Submit content of all forms -- except those with class 'ignore-form' -- before going to next page.
$('#container form:not(.ignore-form)').each(function(index) {
//console.log("Form no. "+index + " with the ID #" + $(this).attr('id') );
//console.log($( this )... | [
"function",
"next",
"(",
")",
"{",
"var",
"data",
"=",
"new",
"Object",
"(",
")",
";",
"// Submit content of all forms -- except those with class 'ignore-form' -- before going to next page.",
"$",
"(",
"'#container form:not(.ignore-form)'",
")",
".",
"each",
"(",
"function"... | Continue to next stage | [
"Continue",
"to",
"next",
"stage"
] | ccff87d4bb5b95c8d96c44731033f29a82df871e | https://github.com/jsekamane/Cree/blob/ccff87d4bb5b95c8d96c44731033f29a82df871e/client/cree-client.js#L70-L84 |
51,857 | commonform-archive/commonform-serve-projects | index.js | requireAuthorization | function requireAuthorization(handler) {
return function(request, response, store, parameters) {
var handlerArguments = arguments
var publisher = parameters.publisher
var authorization = request.headers.authorization
if (authorization) {
var parsed = parseAuthorization(authorization)
if (p... | javascript | function requireAuthorization(handler) {
return function(request, response, store, parameters) {
var handlerArguments = arguments
var publisher = parameters.publisher
var authorization = request.headers.authorization
if (authorization) {
var parsed = parseAuthorization(authorization)
if (p... | [
"function",
"requireAuthorization",
"(",
"handler",
")",
"{",
"return",
"function",
"(",
"request",
",",
"response",
",",
"store",
",",
"parameters",
")",
"{",
"var",
"handlerArguments",
"=",
"arguments",
"var",
"publisher",
"=",
"parameters",
".",
"publisher",
... | Wrap a request handler function to check authoriztion. | [
"Wrap",
"a",
"request",
"handler",
"function",
"to",
"check",
"authoriztion",
"."
] | f4a6b40ba7f19a579b52ffbce88eeeaa11685bd5 | https://github.com/commonform-archive/commonform-serve-projects/blob/f4a6b40ba7f19a579b52ffbce88eeeaa11685bd5/index.js#L233-L252 |
51,858 | gethuman/pancakes-angular | lib/transformers/ng.apiclient.transformer.js | transform | function transform(flapjack, options) {
var moduleName = options.moduleName;
var filePath = options.filePath;
var appName = this.getAppName(filePath, options.appName);
var resource = this.pancakes.cook(moduleName, { flapjack: flapjack });
var templateModel = this.getTemplateModel(options.prefix, res... | javascript | function transform(flapjack, options) {
var moduleName = options.moduleName;
var filePath = options.filePath;
var appName = this.getAppName(filePath, options.appName);
var resource = this.pancakes.cook(moduleName, { flapjack: flapjack });
var templateModel = this.getTemplateModel(options.prefix, res... | [
"function",
"transform",
"(",
"flapjack",
",",
"options",
")",
"{",
"var",
"moduleName",
"=",
"options",
".",
"moduleName",
";",
"var",
"filePath",
"=",
"options",
".",
"filePath",
";",
"var",
"appName",
"=",
"this",
".",
"getAppName",
"(",
"filePath",
","... | Do the transformation
@param flapjack
@param options
@returns {*} | [
"Do",
"the",
"transformation"
] | 9589b7ba09619843e271293088005c62ed23f355 | https://github.com/gethuman/pancakes-angular/blob/9589b7ba09619843e271293088005c62ed23f355/lib/transformers/ng.apiclient.transformer.js#L16-L23 |
51,859 | gethuman/pancakes-angular | lib/transformers/ng.apiclient.transformer.js | getTemplateModel | function getTemplateModel(prefix, resource, appName) {
var methods = {};
// if no api or browser apiclient, then return null since we will skip
if (!resource.api || resource.adapters.browser !== 'apiclient') {
return null;
}
// loop through API routes and create method objects for the temp... | javascript | function getTemplateModel(prefix, resource, appName) {
var methods = {};
// if no api or browser apiclient, then return null since we will skip
if (!resource.api || resource.adapters.browser !== 'apiclient') {
return null;
}
// loop through API routes and create method objects for the temp... | [
"function",
"getTemplateModel",
"(",
"prefix",
",",
"resource",
",",
"appName",
")",
"{",
"var",
"methods",
"=",
"{",
"}",
";",
"// if no api or browser apiclient, then return null since we will skip",
"if",
"(",
"!",
"resource",
".",
"api",
"||",
"resource",
".",
... | Get the template model for an API Client
@param prefix
@param resource
@param appName
@returns {*} | [
"Get",
"the",
"template",
"model",
"for",
"an",
"API",
"Client"
] | 9589b7ba09619843e271293088005c62ed23f355 | https://github.com/gethuman/pancakes-angular/blob/9589b7ba09619843e271293088005c62ed23f355/lib/transformers/ng.apiclient.transformer.js#L32-L57 |
51,860 | hex7c0/logger-request-cli | lib/in.js | cc | function cc(line, params) {
var event = params[0];
var what = params[1];
try {
++event[line[what]].counter;
} catch (TypeError) {
event[line[what]] = {
counter: 1
};
}
return event;
} | javascript | function cc(line, params) {
var event = params[0];
var what = params[1];
try {
++event[line[what]].counter;
} catch (TypeError) {
event[line[what]] = {
counter: 1
};
}
return event;
} | [
"function",
"cc",
"(",
"line",
",",
"params",
")",
"{",
"var",
"event",
"=",
"params",
"[",
"0",
"]",
";",
"var",
"what",
"=",
"params",
"[",
"1",
"]",
";",
"try",
"{",
"++",
"event",
"[",
"line",
"[",
"what",
"]",
"]",
".",
"counter",
";",
"... | input for counter
@function cc
@param {String} line - line read
@param {Array} output - object stored
@return {Object} | [
"input",
"for",
"counter"
] | b1110592dd62e673561a1a4e1c4e122a2a93890a | https://github.com/hex7c0/logger-request-cli/blob/b1110592dd62e673561a1a4e1c4e122a2a93890a/lib/in.js#L53-L65 |
51,861 | hex7c0/logger-request-cli | lib/in.js | avg | function avg(line, params) {
var event = params[0];
var what = params[1];
var r = Number(line[what]);
event.what += r;
++event.total;
if (r > event.max) {
event.max = r;
}
if (r < event.min) {
event.min = r;
}
return event;
} | javascript | function avg(line, params) {
var event = params[0];
var what = params[1];
var r = Number(line[what]);
event.what += r;
++event.total;
if (r > event.max) {
event.max = r;
}
if (r < event.min) {
event.min = r;
}
return event;
} | [
"function",
"avg",
"(",
"line",
",",
"params",
")",
"{",
"var",
"event",
"=",
"params",
"[",
"0",
"]",
";",
"var",
"what",
"=",
"params",
"[",
"1",
"]",
";",
"var",
"r",
"=",
"Number",
"(",
"line",
"[",
"what",
"]",
")",
";",
"event",
".",
"w... | input for average
@function avg
@param {String} line - line read
@param {Array} output - object stored
@return {Object} | [
"input",
"for",
"average"
] | b1110592dd62e673561a1a4e1c4e122a2a93890a | https://github.com/hex7c0/logger-request-cli/blob/b1110592dd62e673561a1a4e1c4e122a2a93890a/lib/in.js#L75-L89 |
51,862 | influx6/ToolStack | lib/stack.utility.js | function(a,b,beStrict){
if(this.isArray(a) && this.isArray(b)){
var alen = a.length, i = 0;
if(beStrict){
if(alen !== (b).length){ return false; }
}
for(; i < alen; i++){
if(a[i] === undefined || b[i] === undefined) break;
... | javascript | function(a,b,beStrict){
if(this.isArray(a) && this.isArray(b)){
var alen = a.length, i = 0;
if(beStrict){
if(alen !== (b).length){ return false; }
}
for(; i < alen; i++){
if(a[i] === undefined || b[i] === undefined) break;
... | [
"function",
"(",
"a",
",",
"b",
",",
"beStrict",
")",
"{",
"if",
"(",
"this",
".",
"isArray",
"(",
"a",
")",
"&&",
"this",
".",
"isArray",
"(",
"b",
")",
")",
"{",
"var",
"alen",
"=",
"a",
".",
"length",
",",
"i",
"=",
"0",
";",
"if",
"(",
... | use to match arrays to arrays to ensure values are equal to each other, useStrict when set to true,ensures the size of properties of both arrays are the same | [
"use",
"to",
"match",
"arrays",
"to",
"arrays",
"to",
"ensure",
"values",
"are",
"equal",
"to",
"each",
"other",
"useStrict",
"when",
"set",
"to",
"true",
"ensures",
"the",
"size",
"of",
"properties",
"of",
"both",
"arrays",
"are",
"the",
"same"
] | d0c7b1acc1546f5e7ff9d04ca6c9222b2577e0db | https://github.com/influx6/ToolStack/blob/d0c7b1acc1546f5e7ff9d04ca6c9222b2577e0db/lib/stack.utility.js#L135-L151 | |
51,863 | influx6/ToolStack | lib/stack.utility.js | function(a,b,beStrict){
if(this.isObject(a) && this.isObject(b)){
var alen = this.keys(a).length, i;
for(i in a){
if(beStrict){
if(!(i in b)){
return false;
break;
}
}
if((i in b)){
... | javascript | function(a,b,beStrict){
if(this.isObject(a) && this.isObject(b)){
var alen = this.keys(a).length, i;
for(i in a){
if(beStrict){
if(!(i in b)){
return false;
break;
}
}
if((i in b)){
... | [
"function",
"(",
"a",
",",
"b",
",",
"beStrict",
")",
"{",
"if",
"(",
"this",
".",
"isObject",
"(",
"a",
")",
"&&",
"this",
".",
"isObject",
"(",
"b",
")",
")",
"{",
"var",
"alen",
"=",
"this",
".",
"keys",
"(",
"a",
")",
".",
"length",
",",
... | alternative when matching objects to objects,beStrict criteria here is to check if the object to be matched and the object to use to match have the same properties | [
"alternative",
"when",
"matching",
"objects",
"to",
"objects",
"beStrict",
"criteria",
"here",
"is",
"to",
"check",
"if",
"the",
"object",
"to",
"be",
"matched",
"and",
"the",
"object",
"to",
"use",
"to",
"match",
"have",
"the",
"same",
"properties"
] | d0c7b1acc1546f5e7ff9d04ca6c9222b2577e0db | https://github.com/influx6/ToolStack/blob/d0c7b1acc1546f5e7ff9d04ca6c9222b2577e0db/lib/stack.utility.js#L156-L176 | |
51,864 | influx6/ToolStack | lib/stack.utility.js | function(args){
if(this.isObject(args)){
return [this.keys(args),this.values(args)];
}
if(this.isArgument(args)){
return [].splice.call(args,0);
}
if(!this.isArray(args) && !this.isObject(args)){
return [args];
}
} | javascript | function(args){
if(this.isObject(args)){
return [this.keys(args),this.values(args)];
}
if(this.isArgument(args)){
return [].splice.call(args,0);
}
if(!this.isArray(args) && !this.isObject(args)){
return [args];
}
} | [
"function",
"(",
"args",
")",
"{",
"if",
"(",
"this",
".",
"isObject",
"(",
"args",
")",
")",
"{",
"return",
"[",
"this",
".",
"keys",
"(",
"args",
")",
",",
"this",
".",
"values",
"(",
"args",
")",
"]",
";",
"}",
"if",
"(",
"this",
".",
"isA... | takes a single supplied value and turns it into an array,if its an object returns an array containing two subarrays of keys and values in the return array,if a single variable,simple wraps it in an array, | [
"takes",
"a",
"single",
"supplied",
"value",
"and",
"turns",
"it",
"into",
"an",
"array",
"if",
"its",
"an",
"object",
"returns",
"an",
"array",
"containing",
"two",
"subarrays",
"of",
"keys",
"and",
"values",
"in",
"the",
"return",
"array",
"if",
"a",
"... | d0c7b1acc1546f5e7ff9d04ca6c9222b2577e0db | https://github.com/influx6/ToolStack/blob/d0c7b1acc1546f5e7ff9d04ca6c9222b2577e0db/lib/stack.utility.js#L212-L222 | |
51,865 | influx6/ToolStack | lib/stack.utility.js | function () {
var val = (1 + (Math.random() * (30000)) | 3);
if(!(val >= 10000)){
val += (10000 * Math.floor(Math.random * 9));
}
return val;
} | javascript | function () {
var val = (1 + (Math.random() * (30000)) | 3);
if(!(val >= 10000)){
val += (10000 * Math.floor(Math.random * 9));
}
return val;
} | [
"function",
"(",
")",
"{",
"var",
"val",
"=",
"(",
"1",
"+",
"(",
"Math",
".",
"random",
"(",
")",
"*",
"(",
"30000",
")",
")",
"|",
"3",
")",
";",
"if",
"(",
"!",
"(",
"val",
">=",
"10000",
")",
")",
"{",
"val",
"+=",
"(",
"10000",
"*",
... | simple function to generate random numbers of 4 lengths | [
"simple",
"function",
"to",
"generate",
"random",
"numbers",
"of",
"4",
"lengths"
] | d0c7b1acc1546f5e7ff9d04ca6c9222b2577e0db | https://github.com/influx6/ToolStack/blob/d0c7b1acc1546f5e7ff9d04ca6c9222b2577e0db/lib/stack.utility.js#L225-L231 | |
51,866 | influx6/ToolStack | lib/stack.utility.js | function(i,value){
if(!value) return;
var i = i || 1,message = "";
while(true){
message += value;
if((--i) <= 0) break;
}
return message;
} | javascript | function(i,value){
if(!value) return;
var i = i || 1,message = "";
while(true){
message += value;
if((--i) <= 0) break;
}
return message;
} | [
"function",
"(",
"i",
",",
"value",
")",
"{",
"if",
"(",
"!",
"value",
")",
"return",
";",
"var",
"i",
"=",
"i",
"||",
"1",
",",
"message",
"=",
"\"\"",
";",
"while",
"(",
"true",
")",
"{",
"message",
"+=",
"value",
";",
"if",
"(",
"(",
"--",... | for string just iterates a single as specificed in the first arguments | [
"for",
"string",
"just",
"iterates",
"a",
"single",
"as",
"specificed",
"in",
"the",
"first",
"arguments"
] | d0c7b1acc1546f5e7ff9d04ca6c9222b2577e0db | https://github.com/influx6/ToolStack/blob/d0c7b1acc1546f5e7ff9d04ca6c9222b2577e0db/lib/stack.utility.js#L242-L251 | |
51,867 | influx6/ToolStack | lib/stack.utility.js | function(o,value,fn){
if(this.isArray(o)){
return this._anyArray(o,value,fn);
}
if(this.isObject(o)){
return this._anyObject(o,value,fn);
}
} | javascript | function(o,value,fn){
if(this.isArray(o)){
return this._anyArray(o,value,fn);
}
if(this.isObject(o)){
return this._anyObject(o,value,fn);
}
} | [
"function",
"(",
"o",
",",
"value",
",",
"fn",
")",
"{",
"if",
"(",
"this",
".",
"isArray",
"(",
"o",
")",
")",
"{",
"return",
"this",
".",
"_anyArray",
"(",
"o",
",",
"value",
",",
"fn",
")",
";",
"}",
"if",
"(",
"this",
".",
"isObject",
"("... | returns the position of the first item that meets the value in an array | [
"returns",
"the",
"position",
"of",
"the",
"first",
"item",
"that",
"meets",
"the",
"value",
"in",
"an",
"array"
] | d0c7b1acc1546f5e7ff9d04ca6c9222b2577e0db | https://github.com/influx6/ToolStack/blob/d0c7b1acc1546f5e7ff9d04ca6c9222b2577e0db/lib/stack.utility.js#L352-L359 | |
51,868 | influx6/ToolStack | lib/stack.utility.js | function(arrays,result){
var self = this,flat = result || [];
this.forEach(arrays,function(a){
if(self.isArray(a)){
self.flatten(a,flat);
}else{
flat.push(a);
}
},self);
return flat;
} | javascript | function(arrays,result){
var self = this,flat = result || [];
this.forEach(arrays,function(a){
if(self.isArray(a)){
self.flatten(a,flat);
}else{
flat.push(a);
}
},self);
return flat;
} | [
"function",
"(",
"arrays",
",",
"result",
")",
"{",
"var",
"self",
"=",
"this",
",",
"flat",
"=",
"result",
"||",
"[",
"]",
";",
"this",
".",
"forEach",
"(",
"arrays",
",",
"function",
"(",
"a",
")",
"{",
"if",
"(",
"self",
".",
"isArray",
"(",
... | mainly works wth arrays only flattens an array that contains multiple arrays into a single array | [
"mainly",
"works",
"wth",
"arrays",
"only",
"flattens",
"an",
"array",
"that",
"contains",
"multiple",
"arrays",
"into",
"a",
"single",
"array"
] | d0c7b1acc1546f5e7ff9d04ca6c9222b2577e0db | https://github.com/influx6/ToolStack/blob/d0c7b1acc1546f5e7ff9d04ca6c9222b2577e0db/lib/stack.utility.js#L455-L468 | |
51,869 | influx6/ToolStack | lib/stack.utility.js | function(o,value){
var occurence = [];
this.forEach(o,function occurmover(e,i,b){
if(e === value){ occurence.push(i); }
},this);
return occurence;
} | javascript | function(o,value){
var occurence = [];
this.forEach(o,function occurmover(e,i,b){
if(e === value){ occurence.push(i); }
},this);
return occurence;
} | [
"function",
"(",
"o",
",",
"value",
")",
"{",
"var",
"occurence",
"=",
"[",
"]",
";",
"this",
".",
"forEach",
"(",
"o",
",",
"function",
"occurmover",
"(",
"e",
",",
"i",
",",
"b",
")",
"{",
"if",
"(",
"e",
"===",
"value",
")",
"{",
"occurence"... | returns an array of occurences index of a particular value | [
"returns",
"an",
"array",
"of",
"occurences",
"index",
"of",
"a",
"particular",
"value"
] | d0c7b1acc1546f5e7ff9d04ca6c9222b2577e0db | https://github.com/influx6/ToolStack/blob/d0c7b1acc1546f5e7ff9d04ca6c9222b2577e0db/lib/stack.utility.js#L482-L488 | |
51,870 | influx6/ToolStack | lib/stack.utility.js | function(o,value,fn){
this.forEach(o,function everymover(e,i,b){
if(e === value){
if(fn) fn.call(this,e,i,b);
}
},this);
return;
} | javascript | function(o,value,fn){
this.forEach(o,function everymover(e,i,b){
if(e === value){
if(fn) fn.call(this,e,i,b);
}
},this);
return;
} | [
"function",
"(",
"o",
",",
"value",
",",
"fn",
")",
"{",
"this",
".",
"forEach",
"(",
"o",
",",
"function",
"everymover",
"(",
"e",
",",
"i",
",",
"b",
")",
"{",
"if",
"(",
"e",
"===",
"value",
")",
"{",
"if",
"(",
"fn",
")",
"fn",
".",
"ca... | performs an operation on every item that has a particular value in the object | [
"performs",
"an",
"operation",
"on",
"every",
"item",
"that",
"has",
"a",
"particular",
"value",
"in",
"the",
"object"
] | d0c7b1acc1546f5e7ff9d04ca6c9222b2577e0db | https://github.com/influx6/ToolStack/blob/d0c7b1acc1546f5e7ff9d04ca6c9222b2577e0db/lib/stack.utility.js#L491-L498 | |
51,871 | influx6/ToolStack | lib/stack.utility.js | function(o,start,end){
var i = 0,len = o.length;
if(!len || len <= 0) return false;
start = Math.abs(start); end = Math.abs(end);
if(end > (len - start)){
end = (len - start);
}
for(; i < len; i++){
o[i] = o[start];
start +=1;
if(i >= end) break;
... | javascript | function(o,start,end){
var i = 0,len = o.length;
if(!len || len <= 0) return false;
start = Math.abs(start); end = Math.abs(end);
if(end > (len - start)){
end = (len - start);
}
for(; i < len; i++){
o[i] = o[start];
start +=1;
if(i >= end) break;
... | [
"function",
"(",
"o",
",",
"start",
",",
"end",
")",
"{",
"var",
"i",
"=",
"0",
",",
"len",
"=",
"o",
".",
"length",
";",
"if",
"(",
"!",
"len",
"||",
"len",
"<=",
"0",
")",
"return",
"false",
";",
"start",
"=",
"Math",
".",
"abs",
"(",
"st... | destructive splice,changes the giving array instead of returning a new one writing to only work with positive numbers only | [
"destructive",
"splice",
"changes",
"the",
"giving",
"array",
"instead",
"of",
"returning",
"a",
"new",
"one",
"writing",
"to",
"only",
"work",
"with",
"positive",
"numbers",
"only"
] | d0c7b1acc1546f5e7ff9d04ca6c9222b2577e0db | https://github.com/influx6/ToolStack/blob/d0c7b1acc1546f5e7ff9d04ca6c9222b2577e0db/lib/stack.utility.js#L516-L533 | |
51,872 | influx6/ToolStack | lib/stack.utility.js | function(a){
if(!a || !this.isArray(a)) return;
var i = 0,start = 0,len = a.length;
for(;i < len; i++){
if(!this.isUndefined(a[i]) && !this.isNull(a[i]) && !(this.isEmpty(a[i]))){
a[start]=a[i];
start += 1;
}
}
... | javascript | function(a){
if(!a || !this.isArray(a)) return;
var i = 0,start = 0,len = a.length;
for(;i < len; i++){
if(!this.isUndefined(a[i]) && !this.isNull(a[i]) && !(this.isEmpty(a[i]))){
a[start]=a[i];
start += 1;
}
}
... | [
"function",
"(",
"a",
")",
"{",
"if",
"(",
"!",
"a",
"||",
"!",
"this",
".",
"isArray",
"(",
"a",
")",
")",
"return",
";",
"var",
"i",
"=",
"0",
",",
"start",
"=",
"0",
",",
"len",
"=",
"a",
".",
"length",
";",
"for",
"(",
";",
"i",
"<",
... | normalizes an array,ensures theres no undefined or empty spaces between arrays | [
"normalizes",
"an",
"array",
"ensures",
"theres",
"no",
"undefined",
"or",
"empty",
"spaces",
"between",
"arrays"
] | d0c7b1acc1546f5e7ff9d04ca6c9222b2577e0db | https://github.com/influx6/ToolStack/blob/d0c7b1acc1546f5e7ff9d04ca6c9222b2577e0db/lib/stack.utility.js#L944-L958 | |
51,873 | atd-schubert/node-stream-lib | lib/random.js | Random | function Random(opts) {
Readable.apply(this, arguments);
if (opts && opts.objectMode) {
this.objectMode = true;
}
this.dictionary = ['1', '0'];
} | javascript | function Random(opts) {
Readable.apply(this, arguments);
if (opts && opts.objectMode) {
this.objectMode = true;
}
this.dictionary = ['1', '0'];
} | [
"function",
"Random",
"(",
"opts",
")",
"{",
"Readable",
".",
"apply",
"(",
"this",
",",
"arguments",
")",
";",
"if",
"(",
"opts",
"&&",
"opts",
".",
"objectMode",
")",
"{",
"this",
".",
"objectMode",
"=",
"true",
";",
"}",
"this",
".",
"dictionary",... | Create a stream of random values from dictionary
@author Arne Schubert <atd.schubert@gmail.com>
@constructor
@memberOf streamLib
@augments {stream.Readable} | [
"Create",
"a",
"stream",
"of",
"random",
"values",
"from",
"dictionary"
] | 90f27042fae84d2fbdbf9d28149b0673997f151a | https://github.com/atd-schubert/node-stream-lib/blob/90f27042fae84d2fbdbf9d28149b0673997f151a/lib/random.js#L18-L26 |
51,874 | gethuman/pancakes-recipe | services/adapters/redis/redis.adapter.js | createLocalCache | function createLocalCache() {
var localCache = lruCache({ max: 100, maxAge: 60000 });
return {
get: function (key) {
return new Q(localCache.get(key));
},
set: function (key, value) {
localCache.set(key, value);
},
del: function (key) {
... | javascript | function createLocalCache() {
var localCache = lruCache({ max: 100, maxAge: 60000 });
return {
get: function (key) {
return new Q(localCache.get(key));
},
set: function (key, value) {
localCache.set(key, value);
},
del: function (key) {
... | [
"function",
"createLocalCache",
"(",
")",
"{",
"var",
"localCache",
"=",
"lruCache",
"(",
"{",
"max",
":",
"100",
",",
"maxAge",
":",
"60000",
"}",
")",
";",
"return",
"{",
"get",
":",
"function",
"(",
"key",
")",
"{",
"return",
"new",
"Q",
"(",
"l... | Create local cache with same interface as remote
@returns {{get: Function, set: *}} | [
"Create",
"local",
"cache",
"with",
"same",
"interface",
"as",
"remote"
] | ea3feb8839e2edaf1b4577c052b8958953db4498 | https://github.com/gethuman/pancakes-recipe/blob/ea3feb8839e2edaf1b4577c052b8958953db4498/services/adapters/redis/redis.adapter.js#L68-L81 |
51,875 | gethuman/pancakes-recipe | services/adapters/redis/redis.adapter.js | connectToRedis | function connectToRedis(db, opts) {
// get the redis client
var client = redis.createClient(opts.port, opts.host);
// log any errors
client.on('error', function (err) {
redisOffline = true;
console.log('connectToRedis error: ' + err);
});
client.on('ready', function () {
... | javascript | function connectToRedis(db, opts) {
// get the redis client
var client = redis.createClient(opts.port, opts.host);
// log any errors
client.on('error', function (err) {
redisOffline = true;
console.log('connectToRedis error: ' + err);
});
client.on('ready', function () {
... | [
"function",
"connectToRedis",
"(",
"db",
",",
"opts",
")",
"{",
"// get the redis client",
"var",
"client",
"=",
"redis",
".",
"createClient",
"(",
"opts",
".",
"port",
",",
"opts",
".",
"host",
")",
";",
"// log any errors",
"client",
".",
"on",
"(",
"'er... | Create a connection to redis and select the appropriate database
@param db
@param opts
@returns {*} | [
"Create",
"a",
"connection",
"to",
"redis",
"and",
"select",
"the",
"appropriate",
"database"
] | ea3feb8839e2edaf1b4577c052b8958953db4498 | https://github.com/gethuman/pancakes-recipe/blob/ea3feb8839e2edaf1b4577c052b8958953db4498/services/adapters/redis/redis.adapter.js#L89-L125 |
51,876 | gethuman/pancakes-recipe | services/adapters/redis/redis.adapter.js | init | function init(config) {
var promises = [];
if (config.redis) {
_.each(config.redis.dbs, function (idx, name) {
promises.push(
connectToRedis(idx, config.redis)
.then(function (remoteCache) {
caches[name] = wrapRemoteCache(remoteCac... | javascript | function init(config) {
var promises = [];
if (config.redis) {
_.each(config.redis.dbs, function (idx, name) {
promises.push(
connectToRedis(idx, config.redis)
.then(function (remoteCache) {
caches[name] = wrapRemoteCache(remoteCac... | [
"function",
"init",
"(",
"config",
")",
"{",
"var",
"promises",
"=",
"[",
"]",
";",
"if",
"(",
"config",
".",
"redis",
")",
"{",
"_",
".",
"each",
"(",
"config",
".",
"redis",
".",
"dbs",
",",
"function",
"(",
"idx",
",",
"name",
")",
"{",
"pro... | During the initialization of a pancakes app, this will be called
and all the redis connections will be established.
@param config
@returns {*} | [
"During",
"the",
"initialization",
"of",
"a",
"pancakes",
"app",
"this",
"will",
"be",
"called",
"and",
"all",
"the",
"redis",
"connections",
"will",
"be",
"established",
"."
] | ea3feb8839e2edaf1b4577c052b8958953db4498 | https://github.com/gethuman/pancakes-recipe/blob/ea3feb8839e2edaf1b4577c052b8958953db4498/services/adapters/redis/redis.adapter.js#L134-L154 |
51,877 | gethuman/pancakes-recipe | services/adapters/redis/redis.adapter.js | get | function get(req) {
var cache = caches[this.name];
var returnVal = null;
if (cache && !redisOffline) {
try {
returnVal = cache.get(req.key);
}
catch (err) {
console.log('redis get err: ' + err);
}
}
... | javascript | function get(req) {
var cache = caches[this.name];
var returnVal = null;
if (cache && !redisOffline) {
try {
returnVal = cache.get(req.key);
}
catch (err) {
console.log('redis get err: ' + err);
}
}
... | [
"function",
"get",
"(",
"req",
")",
"{",
"var",
"cache",
"=",
"caches",
"[",
"this",
".",
"name",
"]",
";",
"var",
"returnVal",
"=",
"null",
";",
"if",
"(",
"cache",
"&&",
"!",
"redisOffline",
")",
"{",
"try",
"{",
"returnVal",
"=",
"cache",
".",
... | Get a value from cache
@param req | [
"Get",
"a",
"value",
"from",
"cache"
] | ea3feb8839e2edaf1b4577c052b8958953db4498 | https://github.com/gethuman/pancakes-recipe/blob/ea3feb8839e2edaf1b4577c052b8958953db4498/services/adapters/redis/redis.adapter.js#L179-L193 |
51,878 | gethuman/pancakes-recipe | services/adapters/redis/redis.adapter.js | set | function set(req) {
var cache = caches[this.name];
if (!cache) {
cache = caches[this.name] = createLocalCache();
}
if (!redisOffline) {
try {
(req.value || !cache.del) ?
cache.set(req.key, req.value) :
cache... | javascript | function set(req) {
var cache = caches[this.name];
if (!cache) {
cache = caches[this.name] = createLocalCache();
}
if (!redisOffline) {
try {
(req.value || !cache.del) ?
cache.set(req.key, req.value) :
cache... | [
"function",
"set",
"(",
"req",
")",
"{",
"var",
"cache",
"=",
"caches",
"[",
"this",
".",
"name",
"]",
";",
"if",
"(",
"!",
"cache",
")",
"{",
"cache",
"=",
"caches",
"[",
"this",
".",
"name",
"]",
"=",
"createLocalCache",
"(",
")",
";",
"}",
"... | Set a value in the cache
@param req | [
"Set",
"a",
"value",
"in",
"the",
"cache"
] | ea3feb8839e2edaf1b4577c052b8958953db4498 | https://github.com/gethuman/pancakes-recipe/blob/ea3feb8839e2edaf1b4577c052b8958953db4498/services/adapters/redis/redis.adapter.js#L199-L215 |
51,879 | gethuman/pancakes-recipe | services/adapters/redis/redis.adapter.js | clear | function clear() {
var cache = caches[this.name];
if (cache && cache.flush && !redisOffline) {
cache.flush();
}
} | javascript | function clear() {
var cache = caches[this.name];
if (cache && cache.flush && !redisOffline) {
cache.flush();
}
} | [
"function",
"clear",
"(",
")",
"{",
"var",
"cache",
"=",
"caches",
"[",
"this",
".",
"name",
"]",
";",
"if",
"(",
"cache",
"&&",
"cache",
".",
"flush",
"&&",
"!",
"redisOffline",
")",
"{",
"cache",
".",
"flush",
"(",
")",
";",
"}",
"}"
] | Remove all items from this cache | [
"Remove",
"all",
"items",
"from",
"this",
"cache"
] | ea3feb8839e2edaf1b4577c052b8958953db4498 | https://github.com/gethuman/pancakes-recipe/blob/ea3feb8839e2edaf1b4577c052b8958953db4498/services/adapters/redis/redis.adapter.js#L220-L225 |
51,880 | warelab/gramene-taxonomy-with-genomes | index.js | addCounts | function addCounts(o1, o2) {
var result;
if (o1 && o2) {
result = _.merge(o1, o2, function (a, b) {
return a + b;
});
}
else if (o1) {
result = o1;
}
else {
result = o2;
}
return result;
} | javascript | function addCounts(o1, o2) {
var result;
if (o1 && o2) {
result = _.merge(o1, o2, function (a, b) {
return a + b;
});
}
else if (o1) {
result = o1;
}
else {
result = o2;
}
return result;
} | [
"function",
"addCounts",
"(",
"o1",
",",
"o2",
")",
"{",
"var",
"result",
";",
"if",
"(",
"o1",
"&&",
"o2",
")",
"{",
"result",
"=",
"_",
".",
"merge",
"(",
"o1",
",",
"o2",
",",
"function",
"(",
"a",
",",
"b",
")",
"{",
"return",
"a",
"+",
... | given two objects that have the same keys and whose values are all integers return a new object that sums them together. If either object is null, return the other one. | [
"given",
"two",
"objects",
"that",
"have",
"the",
"same",
"keys",
"and",
"whose",
"values",
"are",
"all",
"integers",
"return",
"a",
"new",
"object",
"that",
"sums",
"them",
"together",
".",
"If",
"either",
"object",
"is",
"null",
"return",
"the",
"other",... | 347a7c8af49d0130941964944b4adfcde65c23c1 | https://github.com/warelab/gramene-taxonomy-with-genomes/blob/347a7c8af49d0130941964944b4adfcde65c23c1/index.js#L11-L25 |
51,881 | cmcampione/thingshub.org | server/src/bl/thingsMngr.js | getThingUserRights | function getThingUserRights(userId, username, thing) {
if (!userId && !username)
throw new utils.ErrorCustom(httpStatusCodes.INTERNAL_SERVER_ERROR, "userId or usernane must be not empty", 28);
if (!thing)
throw new utils.ErrorCustom(httpStatusCodes.INTERNAL_SERVER_ERROR, "Thing can't be null", 27);
let thingUs... | javascript | function getThingUserRights(userId, username, thing) {
if (!userId && !username)
throw new utils.ErrorCustom(httpStatusCodes.INTERNAL_SERVER_ERROR, "userId or usernane must be not empty", 28);
if (!thing)
throw new utils.ErrorCustom(httpStatusCodes.INTERNAL_SERVER_ERROR, "Thing can't be null", 27);
let thingUs... | [
"function",
"getThingUserRights",
"(",
"userId",
",",
"username",
",",
"thing",
")",
"{",
"if",
"(",
"!",
"userId",
"&&",
"!",
"username",
")",
"throw",
"new",
"utils",
".",
"ErrorCustom",
"(",
"httpStatusCodes",
".",
"INTERNAL_SERVER_ERROR",
",",
"\"userId or... | First search is by userId after it searchs by username Can return null | [
"First",
"search",
"is",
"by",
"userId",
"after",
"it",
"searchs",
"by",
"username",
"Can",
"return",
"null"
] | b9a2e74bddebb80ff473001be93e19ef1578892a | https://github.com/cmcampione/thingshub.org/blob/b9a2e74bddebb80ff473001be93e19ef1578892a/server/src/bl/thingsMngr.js#L19-L34 |
51,882 | cmcampione/thingshub.org | server/src/bl/thingsMngr.js | getThingUserClaims | function getThingUserClaims(user, thing, isSuperAdministrator) {
if (!thing)
throw new utils.ErrorCustom(httpStatusCodes.INTERNAL_SERVER_ERROR, "Thing can't be null", 26);
let thingUserClaimsAndRights = {
read : thing.publicReadClaims,
change : thing.publicChangeClaims
};
if (user) {
thingUserClaimsA... | javascript | function getThingUserClaims(user, thing, isSuperAdministrator) {
if (!thing)
throw new utils.ErrorCustom(httpStatusCodes.INTERNAL_SERVER_ERROR, "Thing can't be null", 26);
let thingUserClaimsAndRights = {
read : thing.publicReadClaims,
change : thing.publicChangeClaims
};
if (user) {
thingUserClaimsA... | [
"function",
"getThingUserClaims",
"(",
"user",
",",
"thing",
",",
"isSuperAdministrator",
")",
"{",
"if",
"(",
"!",
"thing",
")",
"throw",
"new",
"utils",
".",
"ErrorCustom",
"(",
"httpStatusCodes",
".",
"INTERNAL_SERVER_ERROR",
",",
"\"Thing can't be null\"",
","... | All paths return to something. It never returns null except for exceptions The User may be null as anonymous. If User is anonymous returns Thing's PublicClaims | [
"All",
"paths",
"return",
"to",
"something",
".",
"It",
"never",
"returns",
"null",
"except",
"for",
"exceptions",
"The",
"User",
"may",
"be",
"null",
"as",
"anonymous",
".",
"If",
"User",
"is",
"anonymous",
"returns",
"Thing",
"s",
"PublicClaims"
] | b9a2e74bddebb80ff473001be93e19ef1578892a | https://github.com/cmcampione/thingshub.org/blob/b9a2e74bddebb80ff473001be93e19ef1578892a/server/src/bl/thingsMngr.js#L38-L67 |
51,883 | cmcampione/thingshub.org | server/src/bl/thingsMngr.js | getThing | async function getThing(user, thingId, deletedStatus, userRole, userStatus, userVisibility) {
if (!thingId)
throw new utils.ErrorCustom(httpStatusCodes.BAD_REQUEST, "Thing's Id not valid", 37);
let thing = await findThingById(thingId);
if (!thing)
{
// Returns httpStatusCodes.UNAUTHORIZED to Reset Some Malici... | javascript | async function getThing(user, thingId, deletedStatus, userRole, userStatus, userVisibility) {
if (!thingId)
throw new utils.ErrorCustom(httpStatusCodes.BAD_REQUEST, "Thing's Id not valid", 37);
let thing = await findThingById(thingId);
if (!thing)
{
// Returns httpStatusCodes.UNAUTHORIZED to Reset Some Malici... | [
"async",
"function",
"getThing",
"(",
"user",
",",
"thingId",
",",
"deletedStatus",
",",
"userRole",
",",
"userStatus",
",",
"userVisibility",
")",
"{",
"if",
"(",
"!",
"thingId",
")",
"throw",
"new",
"utils",
".",
"ErrorCustom",
"(",
"httpStatusCodes",
".",... | Not optimized using the CheckThingAccess function. It does not get optimized because staying so you have a capillary control of where it eventually snaps the error | [
"Not",
"optimized",
"using",
"the",
"CheckThingAccess",
"function",
".",
"It",
"does",
"not",
"get",
"optimized",
"because",
"staying",
"so",
"you",
"have",
"a",
"capillary",
"control",
"of",
"where",
"it",
"eventually",
"snaps",
"the",
"error"
] | b9a2e74bddebb80ff473001be93e19ef1578892a | https://github.com/cmcampione/thingshub.org/blob/b9a2e74bddebb80ff473001be93e19ef1578892a/server/src/bl/thingsMngr.js#L127-L181 |
51,884 | cmcampione/thingshub.org | server/src/bl/thingsMngr.js | getThingPosition | function getThingPosition(user, parentThing, childThing) {
if (!childThing)
throw new utils.ErrorCustom(httpStatusCodes.INTERNAL_SERVER_ERROR, "Child Thing can't be null", 29);
// If User is equal to null as it may be anonymous or is a SuperAdministrator who has no relationship with Thing
if (!user)
return nul... | javascript | function getThingPosition(user, parentThing, childThing) {
if (!childThing)
throw new utils.ErrorCustom(httpStatusCodes.INTERNAL_SERVER_ERROR, "Child Thing can't be null", 29);
// If User is equal to null as it may be anonymous or is a SuperAdministrator who has no relationship with Thing
if (!user)
return nul... | [
"function",
"getThingPosition",
"(",
"user",
",",
"parentThing",
",",
"childThing",
")",
"{",
"if",
"(",
"!",
"childThing",
")",
"throw",
"new",
"utils",
".",
"ErrorCustom",
"(",
"httpStatusCodes",
".",
"INTERNAL_SERVER_ERROR",
",",
"\"Child Thing can't be null\"",
... | User may be null as it may be anonymous or is a SuperAdministrator who has no relationship with Thing It may return null for old Thing created before Position Management | [
"User",
"may",
"be",
"null",
"as",
"it",
"may",
"be",
"anonymous",
"or",
"is",
"a",
"SuperAdministrator",
"who",
"has",
"no",
"relationship",
"with",
"Thing",
"It",
"may",
"return",
"null",
"for",
"old",
"Thing",
"created",
"before",
"Position",
"Management"... | b9a2e74bddebb80ff473001be93e19ef1578892a | https://github.com/cmcampione/thingshub.org/blob/b9a2e74bddebb80ff473001be93e19ef1578892a/server/src/bl/thingsMngr.js#L277-L290 |
51,885 | tolokoban/ToloFrameWork | ker/cls/WTag.js | function(signal, arg, emitter) {
var widget = this,
slot;
if (typeof emitter === 'undefined') emitter = this;
console.log("fire(" + signal + ")", arg);
if (signal.charAt(0) == '@') {
// This is a global signal.
slot = $$.statics... | javascript | function(signal, arg, emitter) {
var widget = this,
slot;
if (typeof emitter === 'undefined') emitter = this;
console.log("fire(" + signal + ")", arg);
if (signal.charAt(0) == '@') {
// This is a global signal.
slot = $$.statics... | [
"function",
"(",
"signal",
",",
"arg",
",",
"emitter",
")",
"{",
"var",
"widget",
"=",
"this",
",",
"slot",
";",
"if",
"(",
"typeof",
"emitter",
"===",
"'undefined'",
")",
"emitter",
"=",
"this",
";",
"console",
".",
"log",
"(",
"\"fire(\"",
"+",
"si... | Fire a "signal" up to the parents widgets.
If a slot returns false, the event is fired up to the parents.
@param signal Name of the signal to trigger.
@param arg Optional argument to sent with this signal.
@param emitter Optional reference to the signal's emitter.
@memberof WTag | [
"Fire",
"a",
"signal",
"up",
"to",
"the",
"parents",
"widgets",
".",
"If",
"a",
"slot",
"returns",
"false",
"the",
"event",
"is",
"fired",
"up",
"to",
"the",
"parents",
"."
] | 730845a833a9660ebfdb60ad027ebaab5ac871b6 | https://github.com/tolokoban/ToloFrameWork/blob/730845a833a9660ebfdb60ad027ebaab5ac871b6/ker/cls/WTag.js#L89-L125 | |
51,886 | tolokoban/ToloFrameWork | ker/cls/WTag.js | function(signal, arg) {
var slot = this._slots[signal];
if (slot) {
slot.call(this, arg, signal);
return true;
}
return false;
} | javascript | function(signal, arg) {
var slot = this._slots[signal];
if (slot) {
slot.call(this, arg, signal);
return true;
}
return false;
} | [
"function",
"(",
"signal",
",",
"arg",
")",
"{",
"var",
"slot",
"=",
"this",
".",
"_slots",
"[",
"signal",
"]",
";",
"if",
"(",
"slot",
")",
"{",
"slot",
".",
"call",
"(",
"this",
",",
"arg",
",",
"signal",
")",
";",
"return",
"true",
";",
"}",... | Call the slot mapped to the "signal".
@param signal : name of the signal on which this object may be registred.
@param arg : argument to pass to the registred slot.
@memberof WTag | [
"Call",
"the",
"slot",
"mapped",
"to",
"the",
"signal",
"."
] | 730845a833a9660ebfdb60ad027ebaab5ac871b6 | https://github.com/tolokoban/ToloFrameWork/blob/730845a833a9660ebfdb60ad027ebaab5ac871b6/ker/cls/WTag.js#L161-L168 | |
51,887 | tolokoban/ToloFrameWork | ker/cls/WTag.js | function() {
var element = this._element;
while (element.parentNode) {
element = element.parentNode;
if (element.$widget) {
return element.$widget;
}
}
return null;
} | javascript | function() {
var element = this._element;
while (element.parentNode) {
element = element.parentNode;
if (element.$widget) {
return element.$widget;
}
}
return null;
} | [
"function",
"(",
")",
"{",
"var",
"element",
"=",
"this",
".",
"_element",
";",
"while",
"(",
"element",
".",
"parentNode",
")",
"{",
"element",
"=",
"element",
".",
"parentNode",
";",
"if",
"(",
"element",
".",
"$widget",
")",
"{",
"return",
"element"... | Get the parent widget.
@memberof WTag | [
"Get",
"the",
"parent",
"widget",
"."
] | 730845a833a9660ebfdb60ad027ebaab5ac871b6 | https://github.com/tolokoban/ToloFrameWork/blob/730845a833a9660ebfdb60ad027ebaab5ac871b6/ker/cls/WTag.js#L182-L191 | |
51,888 | tolokoban/ToloFrameWork | ker/cls/WTag.js | function(id) {
if (!$$.App) $$.App = this;
if (!$$.App._languages) {
// Initialise localization.
var languages = [],
langStyle = document.createElement("style"),
children = document.querySelectorAll("[lang]");
docume... | javascript | function(id) {
if (!$$.App) $$.App = this;
if (!$$.App._languages) {
// Initialise localization.
var languages = [],
langStyle = document.createElement("style"),
children = document.querySelectorAll("[lang]");
docume... | [
"function",
"(",
"id",
")",
"{",
"if",
"(",
"!",
"$$",
".",
"App",
")",
"$$",
".",
"App",
"=",
"this",
";",
"if",
"(",
"!",
"$$",
".",
"App",
".",
"_languages",
")",
"{",
"// Initialise localization.",
"var",
"languages",
"=",
"[",
"]",
",",
"lan... | Return or set the current language.
@memberof WTag | [
"Return",
"or",
"set",
"the",
"current",
"language",
"."
] | 730845a833a9660ebfdb60ad027ebaab5ac871b6 | https://github.com/tolokoban/ToloFrameWork/blob/730845a833a9660ebfdb60ad027ebaab5ac871b6/ker/cls/WTag.js#L197-L264 | |
51,889 | tolokoban/ToloFrameWork | ker/cls/WTag.js | function(name) {
if (typeof name === 'undefined') return this._element;
var e = this._element.querySelector("[name='" + name + "']");
if (!e) {
throw new Error(
"[WTag.get] Can't find child [name=\""
+ name + "\"] in element... | javascript | function(name) {
if (typeof name === 'undefined') return this._element;
var e = this._element.querySelector("[name='" + name + "']");
if (!e) {
throw new Error(
"[WTag.get] Can't find child [name=\""
+ name + "\"] in element... | [
"function",
"(",
"name",
")",
"{",
"if",
"(",
"typeof",
"name",
"===",
"'undefined'",
")",
"return",
"this",
".",
"_element",
";",
"var",
"e",
"=",
"this",
".",
"_element",
".",
"querySelector",
"(",
"\"[name='\"",
"+",
"name",
"+",
"\"']\"",
")",
";",... | Get an element with this `name` among this element's
children.
@memberof WTag | [
"Get",
"an",
"element",
"with",
"this",
"name",
"among",
"this",
"element",
"s",
"children",
"."
] | 730845a833a9660ebfdb60ad027ebaab5ac871b6 | https://github.com/tolokoban/ToloFrameWork/blob/730845a833a9660ebfdb60ad027ebaab5ac871b6/ker/cls/WTag.js#L271-L281 | |
51,890 | tolokoban/ToloFrameWork | ker/cls/WTag.js | function(vars, slot, getter) {
if (!Array.isArray(vars)) {
vars = [vars];
}
if (vars.length == 0) return null;
if (typeof slot === 'string') {
slot = this[slot];
}
if (typeof getter === 'undefined') {
... | javascript | function(vars, slot, getter) {
if (!Array.isArray(vars)) {
vars = [vars];
}
if (vars.length == 0) return null;
if (typeof slot === 'string') {
slot = this[slot];
}
if (typeof getter === 'undefined') {
... | [
"function",
"(",
"vars",
",",
"slot",
",",
"getter",
")",
"{",
"if",
"(",
"!",
"Array",
".",
"isArray",
"(",
"vars",
")",
")",
"{",
"vars",
"=",
"[",
"vars",
"]",
";",
"}",
"if",
"(",
"vars",
".",
"length",
"==",
"0",
")",
"return",
"null",
"... | Bind to data updates.
When the data changed, the `slot` is call with `this` object
and the data's value as unique argument.
@param {array} vars array of names of data to watch.
@param {function} slot function to call when data changed.
@param {string} slot name of the method to call when data changed.
@param {function... | [
"Bind",
"to",
"data",
"updates",
".",
"When",
"the",
"data",
"changed",
"the",
"slot",
"is",
"call",
"with",
"this",
"object",
"and",
"the",
"data",
"s",
"value",
"as",
"unique",
"argument",
"."
] | 730845a833a9660ebfdb60ad027ebaab5ac871b6 | https://github.com/tolokoban/ToloFrameWork/blob/730845a833a9660ebfdb60ad027ebaab5ac871b6/ker/cls/WTag.js#L398-L423 | |
51,891 | tolokoban/ToloFrameWork | ker/cls/WTag.js | function(vars, listener) {
if (!Array.isArray(vars)) {
vars = [vars];
}
if (vars.length == 0) return null;
var found = false;
vars.forEach(
function(name) {
var data = this.findDataBinding(name);
... | javascript | function(vars, listener) {
if (!Array.isArray(vars)) {
vars = [vars];
}
if (vars.length == 0) return null;
var found = false;
vars.forEach(
function(name) {
var data = this.findDataBinding(name);
... | [
"function",
"(",
"vars",
",",
"listener",
")",
"{",
"if",
"(",
"!",
"Array",
".",
"isArray",
"(",
"vars",
")",
")",
"{",
"vars",
"=",
"[",
"vars",
"]",
";",
"}",
"if",
"(",
"vars",
".",
"length",
"==",
"0",
")",
"return",
"null",
";",
"var",
... | Detach this object from data binding.
@param {array} vars array of names of data to watch.
@param {object} listner the listener to remove.
@memberof WTag | [
"Detach",
"this",
"object",
"from",
"data",
"binding",
"."
] | 730845a833a9660ebfdb60ad027ebaab5ac871b6 | https://github.com/tolokoban/ToloFrameWork/blob/730845a833a9660ebfdb60ad027ebaab5ac871b6/ker/cls/WTag.js#L432-L453 | |
51,892 | jmjuanes/minsql | lib/query/where.js | QueryWhere | function QueryWhere(data)
{
//Initialize the string
var sql = '';
//Check the type
if(typeof data === 'string')
{
//Return the where
return data;
}
//Get all data
for(var key in data)
{
//Save data value
var value = data[key];
//Check the data type
if(typeof value === 'string'... | javascript | function QueryWhere(data)
{
//Initialize the string
var sql = '';
//Check the type
if(typeof data === 'string')
{
//Return the where
return data;
}
//Get all data
for(var key in data)
{
//Save data value
var value = data[key];
//Check the data type
if(typeof value === 'string'... | [
"function",
"QueryWhere",
"(",
"data",
")",
"{",
"//Initialize the string\r",
"var",
"sql",
"=",
"''",
";",
"//Check the type\r",
"if",
"(",
"typeof",
"data",
"===",
"'string'",
")",
"{",
"//Return the where\r",
"return",
"data",
";",
"}",
"//Get all data\r",
"f... | Query String Where function | [
"Query",
"String",
"Where",
"function"
] | 80eddd97e858545997b30e3c9bc067d5fc2df5a0 | https://github.com/jmjuanes/minsql/blob/80eddd97e858545997b30e3c9bc067d5fc2df5a0/lib/query/where.js#L2-L40 |
51,893 | Nazariglez/perenquen | lib/pixi/src/filters/rgb/RGBSplitFilter.js | RGBSplitFilter | function RGBSplitFilter()
{
core.AbstractFilter.call(this,
// vertex shader
null,
// fragment shader
fs.readFileSync(__dirname + '/rgbSplit.frag', 'utf8'),
// custom uniforms
{
red: { type: 'v2', value: { x: 20, y: 20 } },
green: { ... | javascript | function RGBSplitFilter()
{
core.AbstractFilter.call(this,
// vertex shader
null,
// fragment shader
fs.readFileSync(__dirname + '/rgbSplit.frag', 'utf8'),
// custom uniforms
{
red: { type: 'v2', value: { x: 20, y: 20 } },
green: { ... | [
"function",
"RGBSplitFilter",
"(",
")",
"{",
"core",
".",
"AbstractFilter",
".",
"call",
"(",
"this",
",",
"// vertex shader",
"null",
",",
"// fragment shader",
"fs",
".",
"readFileSync",
"(",
"__dirname",
"+",
"'/rgbSplit.frag'",
",",
"'utf8'",
")",
",",
"//... | An RGB Split Filter.
@class
@extends AbstractFilter
@namespace PIXI | [
"An",
"RGB",
"Split",
"Filter",
"."
] | e023964d05afeefebdcac4e2044819fdfa3899ae | https://github.com/Nazariglez/perenquen/blob/e023964d05afeefebdcac4e2044819fdfa3899ae/lib/pixi/src/filters/rgb/RGBSplitFilter.js#L12-L27 |
51,894 | Tennu/tennu-plugins | lib/errors.js | NoSuchPlugin | function NoSuchPlugin (message, name, paths) {
UnmetDependency.call(this, message);
this.name = name;
this.paths = paths;
} | javascript | function NoSuchPlugin (message, name, paths) {
UnmetDependency.call(this, message);
this.name = name;
this.paths = paths;
} | [
"function",
"NoSuchPlugin",
"(",
"message",
",",
"name",
",",
"paths",
")",
"{",
"UnmetDependency",
".",
"call",
"(",
"this",
",",
"message",
")",
";",
"this",
".",
"name",
"=",
"name",
";",
"this",
".",
"paths",
"=",
"paths",
";",
"}"
] | Thrown when a module cannot be found. | [
"Thrown",
"when",
"a",
"module",
"cannot",
"be",
"found",
"."
] | 4d93df08514e9ccabf71a907e785d67cebfc9755 | https://github.com/Tennu/tennu-plugins/blob/4d93df08514e9ccabf71a907e785d67cebfc9755/lib/errors.js#L11-L15 |
51,895 | Tennu/tennu-plugins | lib/errors.js | PluginInitializationError | function PluginInitializationError (message, module) {
this.message = message;
this.stack = new Error().stack;
this.module = module;
} | javascript | function PluginInitializationError (message, module) {
this.message = message;
this.stack = new Error().stack;
this.module = module;
} | [
"function",
"PluginInitializationError",
"(",
"message",
",",
"module",
")",
"{",
"this",
".",
"message",
"=",
"message",
";",
"this",
".",
"stack",
"=",
"new",
"Error",
"(",
")",
".",
"stack",
";",
"this",
".",
"module",
"=",
"module",
";",
"}"
] | Thrown when a module cannot be initialized. | [
"Thrown",
"when",
"a",
"module",
"cannot",
"be",
"initialized",
"."
] | 4d93df08514e9ccabf71a907e785d67cebfc9755 | https://github.com/Tennu/tennu-plugins/blob/4d93df08514e9ccabf71a907e785d67cebfc9755/lib/errors.js#L39-L43 |
51,896 | chanoch/simple-react-router | src/Configuration.js | instantiateDrivers | function instantiateDrivers(config, defaultDriverInstance) {
config.actionConfigs.forEach(action => {
action.driverInstance=action.driver?action.driver():defaultDriverInstance;
});
return config;
} | javascript | function instantiateDrivers(config, defaultDriverInstance) {
config.actionConfigs.forEach(action => {
action.driverInstance=action.driver?action.driver():defaultDriverInstance;
});
return config;
} | [
"function",
"instantiateDrivers",
"(",
"config",
",",
"defaultDriverInstance",
")",
"{",
"config",
".",
"actionConfigs",
".",
"forEach",
"(",
"action",
"=>",
"{",
"action",
".",
"driverInstance",
"=",
"action",
".",
"driver",
"?",
"action",
".",
"driver",
"(",... | Instantiate the driver for each configuration. If no driver has been specified,
this will provide the config with a default driver.
The default driver is usually a null driver - which has no impact. | [
"Instantiate",
"the",
"driver",
"for",
"each",
"configuration",
".",
"If",
"no",
"driver",
"has",
"been",
"specified",
"this",
"will",
"provide",
"the",
"config",
"with",
"a",
"default",
"driver",
"."
] | 3c71feeeb039111f33c934257732e2ea6ddde9ff | https://github.com/chanoch/simple-react-router/blob/3c71feeeb039111f33c934257732e2ea6ddde9ff/src/Configuration.js#L109-L114 |
51,897 | chanoch/simple-react-router | src/Configuration.js | initEnhancers | function initEnhancers(routes) {
invariant(routes.filter(actionConfig => !actionConfig.driverInstance).length===0, 'Routes must have instantiated drivers');
return routes
.filter(actionConfig => actionConfig.driverInstance.middleware)
.map(actionConfig => actionConfig.driverInstance.middleware(... | javascript | function initEnhancers(routes) {
invariant(routes.filter(actionConfig => !actionConfig.driverInstance).length===0, 'Routes must have instantiated drivers');
return routes
.filter(actionConfig => actionConfig.driverInstance.middleware)
.map(actionConfig => actionConfig.driverInstance.middleware(... | [
"function",
"initEnhancers",
"(",
"routes",
")",
"{",
"invariant",
"(",
"routes",
".",
"filter",
"(",
"actionConfig",
"=>",
"!",
"actionConfig",
".",
"driverInstance",
")",
".",
"length",
"===",
"0",
",",
"'Routes must have instantiated drivers'",
")",
";",
"ret... | Get a list of action configurations which have a middleware defined and
return an array of those redux state enhancers functions
@param {ActionConfig} actionConfigs | [
"Get",
"a",
"list",
"of",
"action",
"configurations",
"which",
"have",
"a",
"middleware",
"defined",
"and",
"return",
"an",
"array",
"of",
"those",
"redux",
"state",
"enhancers",
"functions"
] | 3c71feeeb039111f33c934257732e2ea6ddde9ff | https://github.com/chanoch/simple-react-router/blob/3c71feeeb039111f33c934257732e2ea6ddde9ff/src/Configuration.js#L142-L148 |
51,898 | jtanx/ctagz | ctagz.js | findCTagsFile | function findCTagsFile(searchPath, tagFilePattern = '{.,}tags') {
const ctagsFinder = function ctagsFinder(tagPath) {
console.error(`ctagz: Searching ${tagPath}`)
return fs.readdirAsync(tagPath).then(files => {
const matched = files.filter(minimatch.filter(tagFilePattern)).sort()
... | javascript | function findCTagsFile(searchPath, tagFilePattern = '{.,}tags') {
const ctagsFinder = function ctagsFinder(tagPath) {
console.error(`ctagz: Searching ${tagPath}`)
return fs.readdirAsync(tagPath).then(files => {
const matched = files.filter(minimatch.filter(tagFilePattern)).sort()
... | [
"function",
"findCTagsFile",
"(",
"searchPath",
",",
"tagFilePattern",
"=",
"'{.,}tags'",
")",
"{",
"const",
"ctagsFinder",
"=",
"function",
"ctagsFinder",
"(",
"tagPath",
")",
"{",
"console",
".",
"error",
"(",
"`",
"${",
"tagPath",
"}",
"`",
")",
"return",... | Finds the CTags file from the specified search path and pattern
@param {string} searchPath The path to search. This may either be a
file or directory. If a file is passed,
its directory is searched. If the tag file
is not found, its parent directories are
then searched.
@param {string} tagFilePattern The search pattern... | [
"Finds",
"the",
"CTags",
"file",
"from",
"the",
"specified",
"search",
"path",
"and",
"pattern"
] | 9f9da9c578c78ba2b3b869ea3cfe465d50681740 | https://github.com/jtanx/ctagz/blob/9f9da9c578c78ba2b3b869ea3cfe465d50681740/ctagz.js#L444-L482 |
51,899 | jtanx/ctagz | ctagz.js | findCTagsBSearch | function findCTagsBSearch(searchPath, tag, ignoreCase = false, tagFilePattern = '{.,}tags') {
const ctags = findCTagsFile(searchPath, tagFilePattern)
.disposer(tags => {
if (tags) {
tags.destroy()
}
})
return Promise.using(ctags, tags => {
if (tag... | javascript | function findCTagsBSearch(searchPath, tag, ignoreCase = false, tagFilePattern = '{.,}tags') {
const ctags = findCTagsFile(searchPath, tagFilePattern)
.disposer(tags => {
if (tags) {
tags.destroy()
}
})
return Promise.using(ctags, tags => {
if (tag... | [
"function",
"findCTagsBSearch",
"(",
"searchPath",
",",
"tag",
",",
"ignoreCase",
"=",
"false",
",",
"tagFilePattern",
"=",
"'{.,}tags'",
")",
"{",
"const",
"ctags",
"=",
"findCTagsFile",
"(",
"searchPath",
",",
"tagFilePattern",
")",
".",
"disposer",
"(",
"ta... | Finds the CTags file from the specified search pattern and
searches it for the specified tag
@param {string} searchPath The path to search for the tags file
@param {string} tag The tag to search for in the tags file
@param {bool} ignoreCase Whether or not to ignore case when searching
@param {string} tagFilePattern T... | [
"Finds",
"the",
"CTags",
"file",
"from",
"the",
"specified",
"search",
"pattern",
"and",
"searches",
"it",
"for",
"the",
"specified",
"tag"
] | 9f9da9c578c78ba2b3b869ea3cfe465d50681740 | https://github.com/jtanx/ctagz/blob/9f9da9c578c78ba2b3b869ea3cfe465d50681740/ctagz.js#L495-L511 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.