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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
37,100 | feathers-plus/common | lib/hash/index.js | hashObject | function hashObject (obj) {
if (!isObject(obj)) return null;
return shortHash(JSON.stringify(sortKeys(obj, { deep: true })));
} | javascript | function hashObject (obj) {
if (!isObject(obj)) return null;
return shortHash(JSON.stringify(sortKeys(obj, { deep: true })));
} | [
"function",
"hashObject",
"(",
"obj",
")",
"{",
"if",
"(",
"!",
"isObject",
"(",
"obj",
")",
")",
"return",
"null",
";",
"return",
"shortHash",
"(",
"JSON",
".",
"stringify",
"(",
"sortKeys",
"(",
"obj",
",",
"{",
"deep",
":",
"true",
"}",
")",
")"... | Predictable hash for equivalent objects. | [
"Predictable",
"hash",
"for",
"equivalent",
"objects",
"."
] | 4d244d4ee2426e11095fe30542fb0e83721eeb03 | https://github.com/feathers-plus/common/blob/4d244d4ee2426e11095fe30542fb0e83721eeb03/lib/hash/index.js#L12-L15 |
37,101 | hilkenan/formgen-react | dist/validators/Validators.js | length | function length(desiredLength, formatError) {
'use strict';
return function (value) {
value = ((value !== null && value !== undefined) ? value : '');
if (value.length !== desiredLength) {
return formatError(value.length);
}
return '';
... | javascript | function length(desiredLength, formatError) {
'use strict';
return function (value) {
value = ((value !== null && value !== undefined) ? value : '');
if (value.length !== desiredLength) {
return formatError(value.length);
}
return '';
... | [
"function",
"length",
"(",
"desiredLength",
",",
"formatError",
")",
"{",
"'use strict'",
";",
"return",
"function",
"(",
"value",
")",
"{",
"value",
"=",
"(",
"(",
"value",
"!==",
"null",
"&&",
"value",
"!==",
"undefined",
")",
"?",
"value",
":",
"''",
... | Returns a validator that checks the length of a string and ensures its equal to a value. If input null return -1
@param desiredLength The length of the string
@param formatError a callback which takes the length and formats an appropriate error message for validation failed | [
"Returns",
"a",
"validator",
"that",
"checks",
"the",
"length",
"of",
"a",
"string",
"and",
"ensures",
"its",
"equal",
"to",
"a",
"value",
".",
"If",
"input",
"null",
"return",
"-",
"1"
] | e5c8938312b7e6f8cc32ec442af8787c542e60b6 | https://github.com/hilkenan/formgen-react/blob/e5c8938312b7e6f8cc32ec442af8787c542e60b6/dist/validators/Validators.js#L34-L43 |
37,102 | hilkenan/formgen-react | dist/validators/Validators.js | minValue | function minValue(bound, formatError) {
'use strict';
return function (value) {
if (value || !isNaN(parseFloat(value))) {
var intValue = Number(value);
if (!isNaN(intValue) && intValue < bound) {
return formatError(intValue);
... | javascript | function minValue(bound, formatError) {
'use strict';
return function (value) {
if (value || !isNaN(parseFloat(value))) {
var intValue = Number(value);
if (!isNaN(intValue) && intValue < bound) {
return formatError(intValue);
... | [
"function",
"minValue",
"(",
"bound",
",",
"formatError",
")",
"{",
"'use strict'",
";",
"return",
"function",
"(",
"value",
")",
"{",
"if",
"(",
"value",
"||",
"!",
"isNaN",
"(",
"parseFloat",
"(",
"value",
")",
")",
")",
"{",
"var",
"intValue",
"=",
... | Returns a validator that checks if a number is greater than the provided bound
@param bound The bound
@param formatError a callback which takes the length and formats an appropriate error message for validation failed | [
"Returns",
"a",
"validator",
"that",
"checks",
"if",
"a",
"number",
"is",
"greater",
"than",
"the",
"provided",
"bound"
] | e5c8938312b7e6f8cc32ec442af8787c542e60b6 | https://github.com/hilkenan/formgen-react/blob/e5c8938312b7e6f8cc32ec442af8787c542e60b6/dist/validators/Validators.js#L100-L111 |
37,103 | arunoda/laika | lib/app_pool.js | detectConfig | function detectConfig(appDir) {
var config = {};
var meteoriteUsed = fs.existsSync(path.resolve(appDir, './smart.json'));
if(meteoriteUsed) {
config.meteorite = true;
config.nodeBinary = helpers.getMeteoriteNode(appDir);
} else {
config.meteorite = false;
config.nodeBinary = help... | javascript | function detectConfig(appDir) {
var config = {};
var meteoriteUsed = fs.existsSync(path.resolve(appDir, './smart.json'));
if(meteoriteUsed) {
config.meteorite = true;
config.nodeBinary = helpers.getMeteoriteNode(appDir);
} else {
config.meteorite = false;
config.nodeBinary = help... | [
"function",
"detectConfig",
"(",
"appDir",
")",
"{",
"var",
"config",
"=",
"{",
"}",
";",
"var",
"meteoriteUsed",
"=",
"fs",
".",
"existsSync",
"(",
"path",
".",
"resolve",
"(",
"appDir",
",",
"'./smart.json'",
")",
")",
";",
"if",
"(",
"meteoriteUsed",
... | detect whether uses, meteor or meteorite and get the corret node version accordingly | [
"detect",
"whether",
"uses",
"meteor",
"or",
"meteorite",
"and",
"get",
"the",
"corret",
"node",
"version",
"accordingly"
] | 63199f900756a695aa5ab80341d0185a200c9403 | https://github.com/arunoda/laika/blob/63199f900756a695aa5ab80341d0185a200c9403/lib/app_pool.js#L78-L90 |
37,104 | rewgt/shadow-widget | lib/template.js | assignOneDual | function assignOneDual(bConns, item) {
var fn = exprDict[item];
if (!fn) return;
try {
var bConn = gui.connectTo[item];
if (bConn) {
// this action is listened
var oldValue = comp.state[item];
fn(comp); // try update with expression
var newValue = comp.state[item]... | javascript | function assignOneDual(bConns, item) {
var fn = exprDict[item];
if (!fn) return;
try {
var bConn = gui.connectTo[item];
if (bConn) {
// this action is listened
var oldValue = comp.state[item];
fn(comp); // try update with expression
var newValue = comp.state[item]... | [
"function",
"assignOneDual",
"(",
"bConns",
",",
"item",
")",
"{",
"var",
"fn",
"=",
"exprDict",
"[",
"item",
"]",
";",
"if",
"(",
"!",
"fn",
")",
"return",
";",
"try",
"{",
"var",
"bConn",
"=",
"gui",
".",
"connectTo",
"[",
"item",
"]",
";",
"if... | if return true means comp.state.xxx is changed | [
"if",
"return",
"true",
"means",
"comp",
".",
"state",
".",
"xxx",
"is",
"changed"
] | 5baa1f563d647b6d1ecb6c108bc5bcef150ea683 | https://github.com/rewgt/shadow-widget/blob/5baa1f563d647b6d1ecb6c108bc5bcef150ea683/lib/template.js#L3713-L3729 |
37,105 | sproutsocial/es6-import-validate | lib/ES6ModuleFile.js | function (filePath) {
var name = path.relative(this.opts.cwd, filePath);
name = path.join(path.dirname(name), path.basename(name, this.opts.extension));
return name;
} | javascript | function (filePath) {
var name = path.relative(this.opts.cwd, filePath);
name = path.join(path.dirname(name), path.basename(name, this.opts.extension));
return name;
} | [
"function",
"(",
"filePath",
")",
"{",
"var",
"name",
"=",
"path",
".",
"relative",
"(",
"this",
".",
"opts",
".",
"cwd",
",",
"filePath",
")",
";",
"name",
"=",
"path",
".",
"join",
"(",
"path",
".",
"dirname",
"(",
"name",
")",
",",
"path",
"."... | Only broken out to stub for windows backslash in tests | [
"Only",
"broken",
"out",
"to",
"stub",
"for",
"windows",
"backslash",
"in",
"tests"
] | e93776812c45aaa2a7c6145474c04ed3359ac4b2 | https://github.com/sproutsocial/es6-import-validate/blob/e93776812c45aaa2a7c6145474c04ed3359ac4b2/lib/ES6ModuleFile.js#L122-L128 | |
37,106 | pllee/luc | lib/array.js | fromIndex | function fromIndex(a, index) {
var arr = is.isArguments(a) ? arraySlice.call(a) : a;
return arraySlice.call(arr, index, arr.length);
} | javascript | function fromIndex(a, index) {
var arr = is.isArguments(a) ? arraySlice.call(a) : a;
return arraySlice.call(arr, index, arr.length);
} | [
"function",
"fromIndex",
"(",
"a",
",",
"index",
")",
"{",
"var",
"arr",
"=",
"is",
".",
"isArguments",
"(",
"a",
")",
"?",
"arraySlice",
".",
"call",
"(",
"a",
")",
":",
"a",
";",
"return",
"arraySlice",
".",
"call",
"(",
"arr",
",",
"index",
",... | Return the items in between the passed in index
and the end of the array.
Luc.Array.fromIndex([1,2,3,4,5], 1)
>[2, 3, 4, 5]
@param {Array/arguments} arr
@param {Number} index
@return {Array} the new array. | [
"Return",
"the",
"items",
"in",
"between",
"the",
"passed",
"in",
"index",
"and",
"the",
"end",
"of",
"the",
"array",
"."
] | eb6db9d3dfa75101c59eb35d8c969bc384c82a2a | https://github.com/pllee/luc/blob/eb6db9d3dfa75101c59eb35d8c969bc384c82a2a/lib/array.js#L164-L167 |
37,107 | pllee/luc | lib/array.js | each | function each(item, fn, thisArg) {
var arr = toArray(item);
return arr.forEach.call(arr, fn, thisArg);
} | javascript | function each(item, fn, thisArg) {
var arr = toArray(item);
return arr.forEach.call(arr, fn, thisArg);
} | [
"function",
"each",
"(",
"item",
",",
"fn",
",",
"thisArg",
")",
"{",
"var",
"arr",
"=",
"toArray",
"(",
"item",
")",
";",
"return",
"arr",
".",
"forEach",
".",
"call",
"(",
"arr",
",",
"fn",
",",
"thisArg",
")",
";",
"}"
] | Runs an Array.forEach after calling Luc.Array.toArray on the item.
It is very useful for setting up flexible api's that can handle none one or many.
Luc.Array.each(this.items, function(item) {
this._addItem(item);
});
vs.
if(Array.isArray(this.items)){
this.items.forEach(function(item) {
this._addItem(item);
})
}
el... | [
"Runs",
"an",
"Array",
".",
"forEach",
"after",
"calling",
"Luc",
".",
"Array",
".",
"toArray",
"on",
"the",
"item",
".",
"It",
"is",
"very",
"useful",
"for",
"setting",
"up",
"flexible",
"api",
"s",
"that",
"can",
"handle",
"none",
"one",
"or",
"many"... | eb6db9d3dfa75101c59eb35d8c969bc384c82a2a | https://github.com/pllee/luc/blob/eb6db9d3dfa75101c59eb35d8c969bc384c82a2a/lib/array.js#L193-L196 |
37,108 | koopjs/geohub | lib/request.js | geohubRequest | function geohubRequest (options, callback) {
if (options.url.indexOf('https://') !== 0) {
options.url = apiBase + options.url
}
options.headers = {
'User-Agent': 'geohub/' + pkg.version
}
// delete null/undefined access token to avoid 401 from github
if (options.qs && !options.qs.access_token) {
... | javascript | function geohubRequest (options, callback) {
if (options.url.indexOf('https://') !== 0) {
options.url = apiBase + options.url
}
options.headers = {
'User-Agent': 'geohub/' + pkg.version
}
// delete null/undefined access token to avoid 401 from github
if (options.qs && !options.qs.access_token) {
... | [
"function",
"geohubRequest",
"(",
"options",
",",
"callback",
")",
"{",
"if",
"(",
"options",
".",
"url",
".",
"indexOf",
"(",
"'https://'",
")",
"!==",
"0",
")",
"{",
"options",
".",
"url",
"=",
"apiBase",
"+",
"options",
".",
"url",
"}",
"options",
... | handles requests by geohub to the github API
@param {object} options - url (string), qs (object)
@param {Function} callback | [
"handles",
"requests",
"by",
"geohub",
"to",
"the",
"github",
"API"
] | d58c12daba4b33edc0b70333d440572f9c39e6db | https://github.com/koopjs/geohub/blob/d58c12daba4b33edc0b70333d440572f9c39e6db/lib/request.js#L12-L45 |
37,109 | vesln/b | lib/benchmark.js | Benchmark | function Benchmark(name, fn) {
this._name = name;
this._fn = fn;
this._async = fn.length > 1;
} | javascript | function Benchmark(name, fn) {
this._name = name;
this._fn = fn;
this._async = fn.length > 1;
} | [
"function",
"Benchmark",
"(",
"name",
",",
"fn",
")",
"{",
"this",
".",
"_name",
"=",
"name",
";",
"this",
".",
"_fn",
"=",
"fn",
";",
"this",
".",
"_async",
"=",
"fn",
".",
"length",
">",
"1",
";",
"}"
] | Benchmark constructor.
@param {String} name
@param {Function} fn
@constructor | [
"Benchmark",
"constructor",
"."
] | 9bddf3032885ae51095946a2f153e5b03cbec332 | https://github.com/vesln/b/blob/9bddf3032885ae51095946a2f153e5b03cbec332/lib/benchmark.js#L12-L16 |
37,110 | DesTincT/bemlint | lib/cli-engine.js | processText | function processText(text, filename, options) {
var filePath,
messages,
stats;
if (filename) {
filePath = path.resolve(filename);
}
filename = filename || "<text>";
debug("Linting " + filename);
messages = bemlint.verify(text, lodash.assign(Object.create(null), {
... | javascript | function processText(text, filename, options) {
var filePath,
messages,
stats;
if (filename) {
filePath = path.resolve(filename);
}
filename = filename || "<text>";
debug("Linting " + filename);
messages = bemlint.verify(text, lodash.assign(Object.create(null), {
... | [
"function",
"processText",
"(",
"text",
",",
"filename",
",",
"options",
")",
"{",
"var",
"filePath",
",",
"messages",
",",
"stats",
";",
"if",
"(",
"filename",
")",
"{",
"filePath",
"=",
"path",
".",
"resolve",
"(",
"filename",
")",
";",
"}",
"filenam... | Processes an source code using bemlint.
@param {string} text The source code to check.
@param {string} filename An optional string representing the texts filename.
@returns {Result} The results for linting on this text.
@private | [
"Processes",
"an",
"source",
"code",
"using",
"bemlint",
"."
] | e30963deae2c93f1d5e925389339ad740250dd68 | https://github.com/DesTincT/bemlint/blob/e30963deae2c93f1d5e925389339ad740250dd68/lib/cli-engine.js#L120-L148 |
37,111 | DesTincT/bemlint | lib/cli-engine.js | processFile | function processFile(filename, options) {
var text = fs.readFileSync(path.resolve(filename), "utf8"),
result = processText(text, filename, options);
return result;
} | javascript | function processFile(filename, options) {
var text = fs.readFileSync(path.resolve(filename), "utf8"),
result = processText(text, filename, options);
return result;
} | [
"function",
"processFile",
"(",
"filename",
",",
"options",
")",
"{",
"var",
"text",
"=",
"fs",
".",
"readFileSync",
"(",
"path",
".",
"resolve",
"(",
"filename",
")",
",",
"\"utf8\"",
")",
",",
"result",
"=",
"processText",
"(",
"text",
",",
"filename",... | Processes an individual file using bemlint. Files used here are known to
exist, so no need to check that here.
@param {string} filename The filename of the file being checked.
@param {Object} configHelper The configuration options for bemlint.
@param {Object} options The CLIEngine options object.
@returns {Result} The ... | [
"Processes",
"an",
"individual",
"file",
"using",
"bemlint",
".",
"Files",
"used",
"here",
"are",
"known",
"to",
"exist",
"so",
"no",
"need",
"to",
"check",
"that",
"here",
"."
] | e30963deae2c93f1d5e925389339ad740250dd68 | https://github.com/DesTincT/bemlint/blob/e30963deae2c93f1d5e925389339ad740250dd68/lib/cli-engine.js#L159-L166 |
37,112 | DesTincT/bemlint | lib/cli-engine.js | function(filePath) {
var ignoredPaths;
if (this.options.ignore) {
ignoredPaths = new IgnoredPaths(this.options);
return ignoredPaths.contains(filePath);
}
return false;
} | javascript | function(filePath) {
var ignoredPaths;
if (this.options.ignore) {
ignoredPaths = new IgnoredPaths(this.options);
return ignoredPaths.contains(filePath);
}
return false;
} | [
"function",
"(",
"filePath",
")",
"{",
"var",
"ignoredPaths",
";",
"if",
"(",
"this",
".",
"options",
".",
"ignore",
")",
"{",
"ignoredPaths",
"=",
"new",
"IgnoredPaths",
"(",
"this",
".",
"options",
")",
";",
"return",
"ignoredPaths",
".",
"contains",
"... | Checks if a given path is ignored by bemlint.
@param {string} filePath The path of the file to check.
@returns {boolean} Whether or not the given path is ignored. | [
"Checks",
"if",
"a",
"given",
"path",
"is",
"ignored",
"by",
"bemlint",
"."
] | e30963deae2c93f1d5e925389339ad740250dd68 | https://github.com/DesTincT/bemlint/blob/e30963deae2c93f1d5e925389339ad740250dd68/lib/cli-engine.js#L594-L603 | |
37,113 | djalmaoliveira/djf-xml | src/index.js | extractGroup | function extractGroup (xml, tagName) {
var itens = []
var regex = new RegExp(`<${tagName}.+?>(.+?)</${tagName}>`, 'gi')
var result = ''
for (result = regex.exec(xml); regex.lastIndex !== 0; result = regex.exec(xml)) {
itens.push(result[0])
}
return itens
} | javascript | function extractGroup (xml, tagName) {
var itens = []
var regex = new RegExp(`<${tagName}.+?>(.+?)</${tagName}>`, 'gi')
var result = ''
for (result = regex.exec(xml); regex.lastIndex !== 0; result = regex.exec(xml)) {
itens.push(result[0])
}
return itens
} | [
"function",
"extractGroup",
"(",
"xml",
",",
"tagName",
")",
"{",
"var",
"itens",
"=",
"[",
"]",
"var",
"regex",
"=",
"new",
"RegExp",
"(",
"`",
"${",
"tagName",
"}",
"${",
"tagName",
"}",
"`",
",",
"'gi'",
")",
"var",
"result",
"=",
"''",
"for",
... | Extract group of tags
@param {<string>} xml The xml
@param {<string>} tagName The tag name | [
"Extract",
"group",
"of",
"tags"
] | 6e70d3544c5c85eb3e5ca00aefee1e3c2e084788 | https://github.com/djalmaoliveira/djf-xml/blob/6e70d3544c5c85eb3e5ca00aefee1e3c2e084788/src/index.js#L7-L16 |
37,114 | djalmaoliveira/djf-xml | src/index.js | extract | function extract (xml, tagName, attributeName) {
if (!Array.isArray(tagName)) {
tagName = [tagName]
}
var found = null
var tagFound = null
for (var i = 0; i < tagName.length; i++) {
// without attributes
found = new RegExp(`<${tagName[i]}\\s*>(.+?)</${tagName[i]}>`, 'i').exec(xml)
if (found) ... | javascript | function extract (xml, tagName, attributeName) {
if (!Array.isArray(tagName)) {
tagName = [tagName]
}
var found = null
var tagFound = null
for (var i = 0; i < tagName.length; i++) {
// without attributes
found = new RegExp(`<${tagName[i]}\\s*>(.+?)</${tagName[i]}>`, 'i').exec(xml)
if (found) ... | [
"function",
"extract",
"(",
"xml",
",",
"tagName",
",",
"attributeName",
")",
"{",
"if",
"(",
"!",
"Array",
".",
"isArray",
"(",
"tagName",
")",
")",
"{",
"tagName",
"=",
"[",
"tagName",
"]",
"}",
"var",
"found",
"=",
"null",
"var",
"tagFound",
"=",
... | Extract value between tags.
@param {<string>} xml The xml
@param {<string|array>} tagName The tag name
@param {<string>} attributeName The attribute name
@return {string | null} | [
"Extract",
"value",
"between",
"tags",
"."
] | 6e70d3544c5c85eb3e5ca00aefee1e3c2e084788 | https://github.com/djalmaoliveira/djf-xml/blob/6e70d3544c5c85eb3e5ca00aefee1e3c2e084788/src/index.js#L26-L57 |
37,115 | karlkfi/ngindox | lib/util.js | routeType | function routeType(route) {
var fields = Object.keys(RouteTypeFields);
for (var i = 0, len = fields.length; i < len; i++) {
var field = fields[i];
if (route[field]) {
return RouteTypeFields[field];
}
}
return 'unknown';
} | javascript | function routeType(route) {
var fields = Object.keys(RouteTypeFields);
for (var i = 0, len = fields.length; i < len; i++) {
var field = fields[i];
if (route[field]) {
return RouteTypeFields[field];
}
}
return 'unknown';
} | [
"function",
"routeType",
"(",
"route",
")",
"{",
"var",
"fields",
"=",
"Object",
".",
"keys",
"(",
"RouteTypeFields",
")",
";",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"len",
"=",
"fields",
".",
"length",
";",
"i",
"<",
"len",
";",
"i",
"++",
")",... | Get the type of a route | [
"Get",
"the",
"type",
"of",
"a",
"route"
] | 2c0e8a682d7bde9e5d73a853f45bf1460f4664e9 | https://github.com/karlkfi/ngindox/blob/2c0e8a682d7bde9e5d73a853f45bf1460f4664e9/lib/util.js#L52-L61 |
37,116 | karlkfi/ngindox | lib/util.js | routeTypes | function routeTypes(routeMap) {
var typeSet = {};
var keys = Object.keys(routeMap);
for (var i = 0, len = keys.length; i < len; i++) {
var route = routeMap[keys[i]];
var type = routeType(route);
typeSet[type] = true;
}
// Use RouteTypeFields ordering
var typeList = [];
var fields = Object.keys(RouteTypeF... | javascript | function routeTypes(routeMap) {
var typeSet = {};
var keys = Object.keys(routeMap);
for (var i = 0, len = keys.length; i < len; i++) {
var route = routeMap[keys[i]];
var type = routeType(route);
typeSet[type] = true;
}
// Use RouteTypeFields ordering
var typeList = [];
var fields = Object.keys(RouteTypeF... | [
"function",
"routeTypes",
"(",
"routeMap",
")",
"{",
"var",
"typeSet",
"=",
"{",
"}",
";",
"var",
"keys",
"=",
"Object",
".",
"keys",
"(",
"routeMap",
")",
";",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"len",
"=",
"keys",
".",
"length",
";",
"i",
... | Get a list of route types found in the provided route map, in canonical order | [
"Get",
"a",
"list",
"of",
"route",
"types",
"found",
"in",
"the",
"provided",
"route",
"map",
"in",
"canonical",
"order"
] | 2c0e8a682d7bde9e5d73a853f45bf1460f4664e9 | https://github.com/karlkfi/ngindox/blob/2c0e8a682d7bde9e5d73a853f45bf1460f4664e9/lib/util.js#L64-L85 |
37,117 | shobhitsinghal624/passport-google-authcode | lib/passport-google-authcode/strategy.js | GoogleAuthCodeStrategy | function GoogleAuthCodeStrategy(options, verify) {
options = options || {};
options.authorizationURL = options.authorizationURL || 'https://accounts.google.com/o/oauth2/v2/auth';
options.tokenURL = options.tokenURL || 'https://www.googleapis.com/oauth2/v4/token';
this._passReqToCallback = options.passReqToCall... | javascript | function GoogleAuthCodeStrategy(options, verify) {
options = options || {};
options.authorizationURL = options.authorizationURL || 'https://accounts.google.com/o/oauth2/v2/auth';
options.tokenURL = options.tokenURL || 'https://www.googleapis.com/oauth2/v4/token';
this._passReqToCallback = options.passReqToCall... | [
"function",
"GoogleAuthCodeStrategy",
"(",
"options",
",",
"verify",
")",
"{",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"options",
".",
"authorizationURL",
"=",
"options",
".",
"authorizationURL",
"||",
"'https://accounts.google.com/o/oauth2/v2/auth'",
";",
"... | `GoogleAuthCodeStrategy` constructor.
The Google authentication strategy authenticates requests by delegating to
Google using the OAuth 2.0 protocol.
Applications must supply a `verify` callback which accepts an `accessToken`,
`refreshToken` and service-specific `profile`, and then calls the `done`
callback supplying... | [
"GoogleAuthCodeStrategy",
"constructor",
"."
] | 427d5c6290cf9d4568af869935f496f25f62dd6e | https://github.com/shobhitsinghal624/passport-google-authcode/blob/427d5c6290cf9d4568af869935f496f25f62dd6e/lib/passport-google-authcode/strategy.js#L41-L50 |
37,118 | Spectre/spectre | lib/query.js | isValidDate | function isValidDate(date) {
if (moment.isMoment(date)) {
return date.isValid();
} else {
return moment(date).isValid();
}
} | javascript | function isValidDate(date) {
if (moment.isMoment(date)) {
return date.isValid();
} else {
return moment(date).isValid();
}
} | [
"function",
"isValidDate",
"(",
"date",
")",
"{",
"if",
"(",
"moment",
".",
"isMoment",
"(",
"date",
")",
")",
"{",
"return",
"date",
".",
"isValid",
"(",
")",
";",
"}",
"else",
"{",
"return",
"moment",
"(",
"date",
")",
".",
"isValid",
"(",
")",
... | Validates a date
@param date
@returns {boolean} | [
"Validates",
"a",
"date"
] | 5ff2227cd31116699a6a23a9e8c057ad3b729a1c | https://github.com/Spectre/spectre/blob/5ff2227cd31116699a6a23a9e8c057ad3b729a1c/lib/query.js#L10-L16 |
37,119 | Spectre/spectre | lib/query.js | isValidQuery | function isValidQuery(definition) {
var requiredKeys = [
'event_name',
'resource_type',
'tracker_id'
];
return _.all(requiredKeys, function(key) {
return _.has(definition, key);
});
} | javascript | function isValidQuery(definition) {
var requiredKeys = [
'event_name',
'resource_type',
'tracker_id'
];
return _.all(requiredKeys, function(key) {
return _.has(definition, key);
});
} | [
"function",
"isValidQuery",
"(",
"definition",
")",
"{",
"var",
"requiredKeys",
"=",
"[",
"'event_name'",
",",
"'resource_type'",
",",
"'tracker_id'",
"]",
";",
"return",
"_",
".",
"all",
"(",
"requiredKeys",
",",
"function",
"(",
"key",
")",
"{",
"return",
... | Checks for required keys to execute a query
@param {definition} Query definition
@returns {boolean} | [
"Checks",
"for",
"required",
"keys",
"to",
"execute",
"a",
"query"
] | 5ff2227cd31116699a6a23a9e8c057ad3b729a1c | https://github.com/Spectre/spectre/blob/5ff2227cd31116699a6a23a9e8c057ad3b729a1c/lib/query.js#L24-L34 |
37,120 | maxkfranz/weaver | documentation/api/weaver.js-1.0.0-pre/weaver.js | function( fn ){
var req;
var fnName;
if( $$.is.object(fn) && fn.fn ){ // manual fn
req = fnAs( fn.fn, fn.name );
fnName = fn.name;
fn = fn.fn;
} else if( $$.is.fn(fn) ){ // auto fn
req = fn.toString();
fnName = fn.name;
} else if( $$.is.string(fn) ){ // stringified fn
... | javascript | function( fn ){
var req;
var fnName;
if( $$.is.object(fn) && fn.fn ){ // manual fn
req = fnAs( fn.fn, fn.name );
fnName = fn.name;
fn = fn.fn;
} else if( $$.is.fn(fn) ){ // auto fn
req = fn.toString();
fnName = fn.name;
} else if( $$.is.string(fn) ){ // stringified fn
... | [
"function",
"(",
"fn",
")",
"{",
"var",
"req",
";",
"var",
"fnName",
";",
"if",
"(",
"$$",
".",
"is",
".",
"object",
"(",
"fn",
")",
"&&",
"fn",
".",
"fn",
")",
"{",
"// manual fn",
"req",
"=",
"fnAs",
"(",
"fn",
".",
"fn",
",",
"fn",
".",
... | allows for requires with prototypes and subobjs etc | [
"allows",
"for",
"requires",
"with",
"prototypes",
"and",
"subobjs",
"etc"
] | bac2535114420379005acdfe2dad06331de88496 | https://github.com/maxkfranz/weaver/blob/bac2535114420379005acdfe2dad06331de88496/documentation/api/weaver.js-1.0.0-pre/weaver.js#L949-L1031 | |
37,121 | maxkfranz/weaver | documentation/api/weaver.js-1.0.0-pre/weaver.js | function( m ){
var _p = this._private;
if( _p.webworker ){
_p.webworker.postMessage( m );
}
if( _p.child ){
_p.child.send( m );
}
return this; // chaining
} | javascript | function( m ){
var _p = this._private;
if( _p.webworker ){
_p.webworker.postMessage( m );
}
if( _p.child ){
_p.child.send( m );
}
return this; // chaining
} | [
"function",
"(",
"m",
")",
"{",
"var",
"_p",
"=",
"this",
".",
"_private",
";",
"if",
"(",
"_p",
".",
"webworker",
")",
"{",
"_p",
".",
"webworker",
".",
"postMessage",
"(",
"m",
")",
";",
"}",
"if",
"(",
"_p",
".",
"child",
")",
"{",
"_p",
"... | send the thread a message | [
"send",
"the",
"thread",
"a",
"message"
] | bac2535114420379005acdfe2dad06331de88496 | https://github.com/maxkfranz/weaver/blob/bac2535114420379005acdfe2dad06331de88496/documentation/api/weaver.js-1.0.0-pre/weaver.js#L1206-L1218 | |
37,122 | maxkfranz/weaver | documentation/api/weaver.js-1.0.0-pre/weaver.js | function( fn, as ){
for( var i = 0; i < this.length; i++ ){
var thread = this[i];
thread.require( fn, as );
}
return this;
} | javascript | function( fn, as ){
for( var i = 0; i < this.length; i++ ){
var thread = this[i];
thread.require( fn, as );
}
return this;
} | [
"function",
"(",
"fn",
",",
"as",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"length",
";",
"i",
"++",
")",
"{",
"var",
"thread",
"=",
"this",
"[",
"i",
"]",
";",
"thread",
".",
"require",
"(",
"fn",
",",
"as",
... | require fn in all threads | [
"require",
"fn",
"in",
"all",
"threads"
] | bac2535114420379005acdfe2dad06331de88496 | https://github.com/maxkfranz/weaver/blob/bac2535114420379005acdfe2dad06331de88496/documentation/api/weaver.js-1.0.0-pre/weaver.js#L1346-L1354 | |
37,123 | maxkfranz/weaver | documentation/api/weaver.js-1.0.0-pre/weaver.js | function( fn ){
var pass = this._private.pass.shift();
return this.random().pass( pass ).run( fn );
} | javascript | function( fn ){
var pass = this._private.pass.shift();
return this.random().pass( pass ).run( fn );
} | [
"function",
"(",
"fn",
")",
"{",
"var",
"pass",
"=",
"this",
".",
"_private",
".",
"pass",
".",
"shift",
"(",
")",
";",
"return",
"this",
".",
"random",
"(",
")",
".",
"pass",
"(",
"pass",
")",
".",
"run",
"(",
"fn",
")",
";",
"}"
] | run on random thread | [
"run",
"on",
"random",
"thread"
] | bac2535114420379005acdfe2dad06331de88496 | https://github.com/maxkfranz/weaver/blob/bac2535114420379005acdfe2dad06331de88496/documentation/api/weaver.js-1.0.0-pre/weaver.js#L1365-L1369 | |
37,124 | maxkfranz/weaver | documentation/api/weaver.js-1.0.0-pre/weaver.js | function( m ){
for( var i = 0; i < this.length; i++ ){
var thread = this[i];
thread.message( m );
}
return this; // chaining
} | javascript | function( m ){
for( var i = 0; i < this.length; i++ ){
var thread = this[i];
thread.message( m );
}
return this; // chaining
} | [
"function",
"(",
"m",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"length",
";",
"i",
"++",
")",
"{",
"var",
"thread",
"=",
"this",
"[",
"i",
"]",
";",
"thread",
".",
"message",
"(",
"m",
")",
";",
"}",
"return",... | send all threads a message | [
"send",
"all",
"threads",
"a",
"message"
] | bac2535114420379005acdfe2dad06331de88496 | https://github.com/maxkfranz/weaver/blob/bac2535114420379005acdfe2dad06331de88496/documentation/api/weaver.js-1.0.0-pre/weaver.js#L1377-L1385 | |
37,125 | maxkfranz/weaver | documentation/api/weaver.js-1.0.0-pre/weaver.js | function( fn ){
var self = this;
var _p = self._private;
var subsize = self.spreadSize(); // number of pass eles to handle in each thread
var pass = _p.pass.shift().concat([]); // keep a copy
var runPs = [];
for( var i = 0; i < this.length; i++ ){
var thread = this[i];
... | javascript | function( fn ){
var self = this;
var _p = self._private;
var subsize = self.spreadSize(); // number of pass eles to handle in each thread
var pass = _p.pass.shift().concat([]); // keep a copy
var runPs = [];
for( var i = 0; i < this.length; i++ ){
var thread = this[i];
... | [
"function",
"(",
"fn",
")",
"{",
"var",
"self",
"=",
"this",
";",
"var",
"_p",
"=",
"self",
".",
"_private",
";",
"var",
"subsize",
"=",
"self",
".",
"spreadSize",
"(",
")",
";",
"// number of pass eles to handle in each thread",
"var",
"pass",
"=",
"_p",
... | split the data into slices to spread the data equally among threads | [
"split",
"the",
"data",
"into",
"slices",
"to",
"spread",
"the",
"data",
"equally",
"among",
"threads"
] | bac2535114420379005acdfe2dad06331de88496 | https://github.com/maxkfranz/weaver/blob/bac2535114420379005acdfe2dad06331de88496/documentation/api/weaver.js-1.0.0-pre/weaver.js#L1420-L1456 | |
37,126 | maxkfranz/weaver | documentation/api/weaver.js-1.0.0-pre/weaver.js | function( cmp ){
var self = this;
var P = this._private.pass[0].length;
var subsize = this.spreadSize();
var N = this.length;
cmp = cmp || function( a, b ){ // default comparison function
if( a < b ){
return -1;
} else if( a > b ){
return 1;
}
... | javascript | function( cmp ){
var self = this;
var P = this._private.pass[0].length;
var subsize = this.spreadSize();
var N = this.length;
cmp = cmp || function( a, b ){ // default comparison function
if( a < b ){
return -1;
} else if( a > b ){
return 1;
}
... | [
"function",
"(",
"cmp",
")",
"{",
"var",
"self",
"=",
"this",
";",
"var",
"P",
"=",
"this",
".",
"_private",
".",
"pass",
"[",
"0",
"]",
".",
"length",
";",
"var",
"subsize",
"=",
"this",
".",
"spreadSize",
"(",
")",
";",
"var",
"N",
"=",
"this... | sorts the passed array using a divide and conquer strategy | [
"sorts",
"the",
"passed",
"array",
"using",
"a",
"divide",
"and",
"conquer",
"strategy"
] | bac2535114420379005acdfe2dad06331de88496 | https://github.com/maxkfranz/weaver/blob/bac2535114420379005acdfe2dad06331de88496/documentation/api/weaver.js-1.0.0-pre/weaver.js#L1511-L1583 | |
37,127 | yoshuawuyts/from2-string | index.js | fromString | function fromString (string) {
assert.equal(typeof string, 'string')
return from(function (size, next) {
if (string.length <= 0) return this.push(null)
const chunk = string.slice(0, size)
string = string.slice(size)
next(null, chunk)
})
} | javascript | function fromString (string) {
assert.equal(typeof string, 'string')
return from(function (size, next) {
if (string.length <= 0) return this.push(null)
const chunk = string.slice(0, size)
string = string.slice(size)
next(null, chunk)
})
} | [
"function",
"fromString",
"(",
"string",
")",
"{",
"assert",
".",
"equal",
"(",
"typeof",
"string",
",",
"'string'",
")",
"return",
"from",
"(",
"function",
"(",
"size",
",",
"next",
")",
"{",
"if",
"(",
"string",
".",
"length",
"<=",
"0",
")",
"retu... | create a stream from a string str -> stream | [
"create",
"a",
"stream",
"from",
"a",
"string",
"str",
"-",
">",
"stream"
] | 5bf57ae03db720566538e799eecc0eeb5df0dd39 | https://github.com/yoshuawuyts/from2-string/blob/5bf57ae03db720566538e799eecc0eeb5df0dd39/index.js#L8-L19 |
37,128 | koopjs/geohub | lib/repo.js | repoSha | function repoSha (options, callback) {
var user = options.user
var repo = options.repo
var path = options.path || null
var branch = options.branch || 'master'
var token = options.token || null
if (!user || !repo || !path) {
return callback(new Error('must specify user, repo, path'))
}
var url = '/... | javascript | function repoSha (options, callback) {
var user = options.user
var repo = options.repo
var path = options.path || null
var branch = options.branch || 'master'
var token = options.token || null
if (!user || !repo || !path) {
return callback(new Error('must specify user, repo, path'))
}
var url = '/... | [
"function",
"repoSha",
"(",
"options",
",",
"callback",
")",
"{",
"var",
"user",
"=",
"options",
".",
"user",
"var",
"repo",
"=",
"options",
".",
"repo",
"var",
"path",
"=",
"options",
".",
"path",
"||",
"null",
"var",
"branch",
"=",
"options",
".",
... | get the SHA of a file in a github repository
@param {object} options - user, repo, path (optional), branch (optional), token (optional)
@param {Function} callback - err, sha | [
"get",
"the",
"SHA",
"of",
"a",
"file",
"in",
"a",
"github",
"repository"
] | d58c12daba4b33edc0b70333d440572f9c39e6db | https://github.com/koopjs/geohub/blob/d58c12daba4b33edc0b70333d440572f9c39e6db/lib/repo.js#L150-L175 |
37,129 | Vestorly/ember-cli-deploy-versioning | index.js | setVersioningContext | function setVersioningContext(context, key, value) {
const { versioning } = context;
versioning[key] = value;
if (key === 'previous') {
process.env.EMBER_DEPLOY_PREVIOUS_VERSION = value;
}
if (key === 'current') {
process.env.EMBER_DEPLOY_CURRENT_VERSION = value;
}
return { versioning };
} | javascript | function setVersioningContext(context, key, value) {
const { versioning } = context;
versioning[key] = value;
if (key === 'previous') {
process.env.EMBER_DEPLOY_PREVIOUS_VERSION = value;
}
if (key === 'current') {
process.env.EMBER_DEPLOY_CURRENT_VERSION = value;
}
return { versioning };
} | [
"function",
"setVersioningContext",
"(",
"context",
",",
"key",
",",
"value",
")",
"{",
"const",
"{",
"versioning",
"}",
"=",
"context",
";",
"versioning",
"[",
"key",
"]",
"=",
"value",
";",
"if",
"(",
"key",
"===",
"'previous'",
")",
"{",
"process",
... | Assigns values to the `context.versioning` object.
@property setVersioningContext
@param {Object} context
@param {String} key
@param {Mixed} value
@private | [
"Assigns",
"values",
"to",
"the",
"context",
".",
"versioning",
"object",
"."
] | 031941e99d9110b688088d378050bac59d4643a3 | https://github.com/Vestorly/ember-cli-deploy-versioning/blob/031941e99d9110b688088d378050bac59d4643a3/index.js#L312-L326 |
37,130 | gabrielcsapo/woof | util.js | flatten | function flatten (flags, allowShorthand, allowExtendedShorthand) {
let map = {}
Object.keys(flags).forEach((k) => {
const { alias, type, validate } = flags[k]
let value = { name: k }
if (type) value.type = type
if (validate) value.validate = validate
// include the name as value that can be inv... | javascript | function flatten (flags, allowShorthand, allowExtendedShorthand) {
let map = {}
Object.keys(flags).forEach((k) => {
const { alias, type, validate } = flags[k]
let value = { name: k }
if (type) value.type = type
if (validate) value.validate = validate
// include the name as value that can be inv... | [
"function",
"flatten",
"(",
"flags",
",",
"allowShorthand",
",",
"allowExtendedShorthand",
")",
"{",
"let",
"map",
"=",
"{",
"}",
"Object",
".",
"keys",
"(",
"flags",
")",
".",
"forEach",
"(",
"(",
"k",
")",
"=>",
"{",
"const",
"{",
"alias",
",",
"ty... | turns alias keys into a map
@method flatten
@param {Array<Object>} flags - keys defined by the user that need to be mapped
@param {Boolean} allowShorthand - allows the option to use short hand syntax such as - before the arg
@param {Boolean} allowExtendedShorthand - allows the option to use short hand syntax such as... | [
"turns",
"alias",
"keys",
"into",
"a",
"map"
] | 599f73cf8c767e758210b625483140192d91017b | https://github.com/gabrielcsapo/woof/blob/599f73cf8c767e758210b625483140192d91017b/util.js#L40-L73 |
37,131 | CreaturePhil/origindb | src/index.js | db | function db(objectName) {
if (_.isBoolean(save.hasLoaded)) deasync.loopWhile(() => !save.hasLoaded);
if (!_.has(objects, objectName)) objects[objectName] = {};
return createMethods(objects[objectName], save.bind(null, objectName));
} | javascript | function db(objectName) {
if (_.isBoolean(save.hasLoaded)) deasync.loopWhile(() => !save.hasLoaded);
if (!_.has(objects, objectName)) objects[objectName] = {};
return createMethods(objects[objectName], save.bind(null, objectName));
} | [
"function",
"db",
"(",
"objectName",
")",
"{",
"if",
"(",
"_",
".",
"isBoolean",
"(",
"save",
".",
"hasLoaded",
")",
")",
"deasync",
".",
"loopWhile",
"(",
"(",
")",
"=>",
"!",
"save",
".",
"hasLoaded",
")",
";",
"if",
"(",
"!",
"_",
".",
"has",
... | The database instance.
@param {string} objectName
@param {Object} methods | [
"The",
"database",
"instance",
"."
] | 7b919211c0cfdba8f8737c0cf09f81aa276df9dc | https://github.com/CreaturePhil/origindb/blob/7b919211c0cfdba8f8737c0cf09f81aa276df9dc/src/index.js#L47-L51 |
37,132 | JCloudYu/beson | deserialize.esm.js | __deserializeBoolean | function __deserializeBoolean(type, start, options) {
let end = start;
let data = type === DATA_TYPE.TRUE;
return { anchor: end, value: data };
} | javascript | function __deserializeBoolean(type, start, options) {
let end = start;
let data = type === DATA_TYPE.TRUE;
return { anchor: end, value: data };
} | [
"function",
"__deserializeBoolean",
"(",
"type",
",",
"start",
",",
"options",
")",
"{",
"let",
"end",
"=",
"start",
";",
"let",
"data",
"=",
"type",
"===",
"DATA_TYPE",
".",
"TRUE",
";",
"return",
"{",
"anchor",
":",
"end",
",",
"value",
":",
"data",
... | Deserialize boolean data
@param {string} type
@param {number} start - byteOffset
@param {DeserializeOptions} options
@returns {{anchor: number, value: boolean}} anchor: byteOffset
@private | [
"Deserialize",
"boolean",
"data"
] | de9f1f6be59599feb1a5e70085b42b0382600d0b | https://github.com/JCloudYu/beson/blob/de9f1f6be59599feb1a5e70085b42b0382600d0b/deserialize.esm.js#L258-L262 |
37,133 | JCloudYu/beson | deserialize.esm.js | __deserializeInt8 | function __deserializeInt8(buffer, start, options) {
let end = start + 1;
let dataView = new DataView(buffer);
let data = dataView.getInt8(start);
return { anchor: end, value:options.use_native_types ? data : Int8.from(data) };
} | javascript | function __deserializeInt8(buffer, start, options) {
let end = start + 1;
let dataView = new DataView(buffer);
let data = dataView.getInt8(start);
return { anchor: end, value:options.use_native_types ? data : Int8.from(data) };
} | [
"function",
"__deserializeInt8",
"(",
"buffer",
",",
"start",
",",
"options",
")",
"{",
"let",
"end",
"=",
"start",
"+",
"1",
";",
"let",
"dataView",
"=",
"new",
"DataView",
"(",
"buffer",
")",
";",
"let",
"data",
"=",
"dataView",
".",
"getInt8",
"(",
... | Deserialize Int8 data
@param {ArrayBuffer} buffer
@param {number} start - byteOffset
@param {DeserializeOptions} options
@returns {{anchor: number, value: Number|Int8}} anchor: byteOffset
@private | [
"Deserialize",
"Int8",
"data"
] | de9f1f6be59599feb1a5e70085b42b0382600d0b | https://github.com/JCloudYu/beson/blob/de9f1f6be59599feb1a5e70085b42b0382600d0b/deserialize.esm.js#L272-L277 |
37,134 | JCloudYu/beson | deserialize.esm.js | __deserializeInt16 | function __deserializeInt16(buffer, start, options) {
let end = start + 2;
let dataView = new DataView(buffer);
let data = dataView.getInt16(start, true);
return { anchor: end, value:options.use_native_types ? data : Int16.from(data) };
} | javascript | function __deserializeInt16(buffer, start, options) {
let end = start + 2;
let dataView = new DataView(buffer);
let data = dataView.getInt16(start, true);
return { anchor: end, value:options.use_native_types ? data : Int16.from(data) };
} | [
"function",
"__deserializeInt16",
"(",
"buffer",
",",
"start",
",",
"options",
")",
"{",
"let",
"end",
"=",
"start",
"+",
"2",
";",
"let",
"dataView",
"=",
"new",
"DataView",
"(",
"buffer",
")",
";",
"let",
"data",
"=",
"dataView",
".",
"getInt16",
"("... | Deserialize Int16 data
@param {ArrayBuffer} buffer
@param {number} start - byteOffset
@param {DeserializeOptions} options
@returns {{anchor: number, value: Number|Int16}} anchor: byteOffset
@private | [
"Deserialize",
"Int16",
"data"
] | de9f1f6be59599feb1a5e70085b42b0382600d0b | https://github.com/JCloudYu/beson/blob/de9f1f6be59599feb1a5e70085b42b0382600d0b/deserialize.esm.js#L287-L292 |
37,135 | JCloudYu/beson | deserialize.esm.js | __deserializeInt32 | function __deserializeInt32(buffer, start, options) {
let end = start + 4;
let dataView = new DataView(buffer);
let data = dataView.getInt32(start, true);
return { anchor: end, value:options.use_native_types ? data : Int32.from(data) };
} | javascript | function __deserializeInt32(buffer, start, options) {
let end = start + 4;
let dataView = new DataView(buffer);
let data = dataView.getInt32(start, true);
return { anchor: end, value:options.use_native_types ? data : Int32.from(data) };
} | [
"function",
"__deserializeInt32",
"(",
"buffer",
",",
"start",
",",
"options",
")",
"{",
"let",
"end",
"=",
"start",
"+",
"4",
";",
"let",
"dataView",
"=",
"new",
"DataView",
"(",
"buffer",
")",
";",
"let",
"data",
"=",
"dataView",
".",
"getInt32",
"("... | Deserialize Int32 data
@param {ArrayBuffer} buffer
@param {number} start - byteOffset
@param {DeserializeOptions} options
@returns {{anchor: number, value:number|Int32}} anchor: byteOffset
@private | [
"Deserialize",
"Int32",
"data"
] | de9f1f6be59599feb1a5e70085b42b0382600d0b | https://github.com/JCloudYu/beson/blob/de9f1f6be59599feb1a5e70085b42b0382600d0b/deserialize.esm.js#L302-L307 |
37,136 | JCloudYu/beson | deserialize.esm.js | __deserializeInt64 | function __deserializeInt64(buffer, start, options) {
let step = 4;
let length = 2;
let end = start + (step * length);
let dataView = new DataView(buffer);
let dataArray = [];
for (let i = start; i < end; i += step) {
dataArray.push(dataView.getUint32(i, true));
}
let data = new Int64(new Uint32Array(dataArra... | javascript | function __deserializeInt64(buffer, start, options) {
let step = 4;
let length = 2;
let end = start + (step * length);
let dataView = new DataView(buffer);
let dataArray = [];
for (let i = start; i < end; i += step) {
dataArray.push(dataView.getUint32(i, true));
}
let data = new Int64(new Uint32Array(dataArra... | [
"function",
"__deserializeInt64",
"(",
"buffer",
",",
"start",
",",
"options",
")",
"{",
"let",
"step",
"=",
"4",
";",
"let",
"length",
"=",
"2",
";",
"let",
"end",
"=",
"start",
"+",
"(",
"step",
"*",
"length",
")",
";",
"let",
"dataView",
"=",
"n... | Deserialize Int64 data
@param {ArrayBuffer} buffer
@param {number} start - byteOffset
@param {DeserializeOptions} options
@returns {{anchor: number, value: Int64}} anchor: byteOffset
@private | [
"Deserialize",
"Int64",
"data"
] | de9f1f6be59599feb1a5e70085b42b0382600d0b | https://github.com/JCloudYu/beson/blob/de9f1f6be59599feb1a5e70085b42b0382600d0b/deserialize.esm.js#L317-L328 |
37,137 | JCloudYu/beson | deserialize.esm.js | __deserializeIntVar | function __deserializeIntVar(buffer, start, options) {
const dataBuff = new Uint8Array(buffer);
if ( dataBuff[start] > 127 ) {
throw new Error( "Cannot support IntVar whose size is greater than 127 bytes" );
}
let index = 0, data_size = dataBuff[start], end = start + 1;
const result_buffer = new Uint8Array... | javascript | function __deserializeIntVar(buffer, start, options) {
const dataBuff = new Uint8Array(buffer);
if ( dataBuff[start] > 127 ) {
throw new Error( "Cannot support IntVar whose size is greater than 127 bytes" );
}
let index = 0, data_size = dataBuff[start], end = start + 1;
const result_buffer = new Uint8Array... | [
"function",
"__deserializeIntVar",
"(",
"buffer",
",",
"start",
",",
"options",
")",
"{",
"const",
"dataBuff",
"=",
"new",
"Uint8Array",
"(",
"buffer",
")",
";",
"if",
"(",
"dataBuff",
"[",
"start",
"]",
">",
"127",
")",
"{",
"throw",
"new",
"Error",
"... | Deserialize IntVar data
@param {ArrayBuffer} buffer
@param {number} start - byteOffset
@param {DeserializeOptions} options
@returns {{anchor: number, value: IntVar}} anchor: byteOffset
@private | [
"Deserialize",
"IntVar",
"data"
] | de9f1f6be59599feb1a5e70085b42b0382600d0b | https://github.com/JCloudYu/beson/blob/de9f1f6be59599feb1a5e70085b42b0382600d0b/deserialize.esm.js#L401-L419 |
37,138 | JCloudYu/beson | deserialize.esm.js | __deserializeUInt8 | function __deserializeUInt8(buffer, start, options) {
let end = start + 1;
let dataView = new DataView(buffer);
let data = dataView.getUint8(start);
return { anchor: end, value:options.use_native_types ? data : UInt8.from(data) };
} | javascript | function __deserializeUInt8(buffer, start, options) {
let end = start + 1;
let dataView = new DataView(buffer);
let data = dataView.getUint8(start);
return { anchor: end, value:options.use_native_types ? data : UInt8.from(data) };
} | [
"function",
"__deserializeUInt8",
"(",
"buffer",
",",
"start",
",",
"options",
")",
"{",
"let",
"end",
"=",
"start",
"+",
"1",
";",
"let",
"dataView",
"=",
"new",
"DataView",
"(",
"buffer",
")",
";",
"let",
"data",
"=",
"dataView",
".",
"getUint8",
"("... | Deserialize UInt8 data
@param {ArrayBuffer} buffer
@param {number} start - byteOffset
@param {DeserializeOptions} options
@returns {{anchor: number, value: Number|UInt8}} anchor: byteOffset
@private | [
"Deserialize",
"UInt8",
"data"
] | de9f1f6be59599feb1a5e70085b42b0382600d0b | https://github.com/JCloudYu/beson/blob/de9f1f6be59599feb1a5e70085b42b0382600d0b/deserialize.esm.js#L429-L434 |
37,139 | JCloudYu/beson | deserialize.esm.js | __deserializeUInt16 | function __deserializeUInt16(buffer, start, options) {
let end = start + 2;
let dataView = new DataView(buffer);
let data = dataView.getUint16(start, true);
return { anchor: end, value:options.use_native_types ? data : UInt16.from(data) };
} | javascript | function __deserializeUInt16(buffer, start, options) {
let end = start + 2;
let dataView = new DataView(buffer);
let data = dataView.getUint16(start, true);
return { anchor: end, value:options.use_native_types ? data : UInt16.from(data) };
} | [
"function",
"__deserializeUInt16",
"(",
"buffer",
",",
"start",
",",
"options",
")",
"{",
"let",
"end",
"=",
"start",
"+",
"2",
";",
"let",
"dataView",
"=",
"new",
"DataView",
"(",
"buffer",
")",
";",
"let",
"data",
"=",
"dataView",
".",
"getUint16",
"... | Deserialize UInt16 data
@param {ArrayBuffer} buffer
@param {number} start - byteOffset
@param {DeserializeOptions} options
@returns {{anchor: number, value: Number|UInt16}} anchor: byteOffset
@private | [
"Deserialize",
"UInt16",
"data"
] | de9f1f6be59599feb1a5e70085b42b0382600d0b | https://github.com/JCloudYu/beson/blob/de9f1f6be59599feb1a5e70085b42b0382600d0b/deserialize.esm.js#L444-L449 |
37,140 | JCloudYu/beson | deserialize.esm.js | __deserializeUInt32 | function __deserializeUInt32(buffer, start, options) {
let end = start + 4;
let dataView = new DataView(buffer);
let data = dataView.getUint32(start, true);
return { anchor: end, value:options.use_native_types ? data : UInt32.from(data) };
} | javascript | function __deserializeUInt32(buffer, start, options) {
let end = start + 4;
let dataView = new DataView(buffer);
let data = dataView.getUint32(start, true);
return { anchor: end, value:options.use_native_types ? data : UInt32.from(data) };
} | [
"function",
"__deserializeUInt32",
"(",
"buffer",
",",
"start",
",",
"options",
")",
"{",
"let",
"end",
"=",
"start",
"+",
"4",
";",
"let",
"dataView",
"=",
"new",
"DataView",
"(",
"buffer",
")",
";",
"let",
"data",
"=",
"dataView",
".",
"getUint32",
"... | Deserialize UInt32 data
@param {ArrayBuffer} buffer
@param {number} start - byteOffset
@param {DeserializeOptions} options
@returns {{anchor: number, value:number|UInt32}} anchor: byteOffset
@private | [
"Deserialize",
"UInt32",
"data"
] | de9f1f6be59599feb1a5e70085b42b0382600d0b | https://github.com/JCloudYu/beson/blob/de9f1f6be59599feb1a5e70085b42b0382600d0b/deserialize.esm.js#L459-L464 |
37,141 | JCloudYu/beson | deserialize.esm.js | __deserializeUIntVar | function __deserializeUIntVar(buffer, start, options) {
const dataBuff = new Uint8Array(buffer);
if ( dataBuff[start] > 127 ) {
throw new Error( "Cannot support UIntVar whose size is greater than 127 bytes" );
}
let index = 0, data_size = dataBuff[start], end = start + 1;
const result_buffer = new Uint8Arr... | javascript | function __deserializeUIntVar(buffer, start, options) {
const dataBuff = new Uint8Array(buffer);
if ( dataBuff[start] > 127 ) {
throw new Error( "Cannot support UIntVar whose size is greater than 127 bytes" );
}
let index = 0, data_size = dataBuff[start], end = start + 1;
const result_buffer = new Uint8Arr... | [
"function",
"__deserializeUIntVar",
"(",
"buffer",
",",
"start",
",",
"options",
")",
"{",
"const",
"dataBuff",
"=",
"new",
"Uint8Array",
"(",
"buffer",
")",
";",
"if",
"(",
"dataBuff",
"[",
"start",
"]",
">",
"127",
")",
"{",
"throw",
"new",
"Error",
... | Deserialize UIntVar data
@param {ArrayBuffer} buffer
@param {number} start - byteOffset
@param {DeserializeOptions} options
@returns {{anchor: number, value: UIntVar}} anchor: byteOffset
@private | [
"Deserialize",
"UIntVar",
"data"
] | de9f1f6be59599feb1a5e70085b42b0382600d0b | https://github.com/JCloudYu/beson/blob/de9f1f6be59599feb1a5e70085b42b0382600d0b/deserialize.esm.js#L558-L576 |
37,142 | JCloudYu/beson | deserialize.esm.js | __deserializeFloat32 | function __deserializeFloat32(buffer, start, options) {
let end = start + 4;
let dataView = new DataView(buffer);
let data = dataView.getFloat32(start, true);
return { anchor: end, value: data };
} | javascript | function __deserializeFloat32(buffer, start, options) {
let end = start + 4;
let dataView = new DataView(buffer);
let data = dataView.getFloat32(start, true);
return { anchor: end, value: data };
} | [
"function",
"__deserializeFloat32",
"(",
"buffer",
",",
"start",
",",
"options",
")",
"{",
"let",
"end",
"=",
"start",
"+",
"4",
";",
"let",
"dataView",
"=",
"new",
"DataView",
"(",
"buffer",
")",
";",
"let",
"data",
"=",
"dataView",
".",
"getFloat32",
... | Deserialize float data
@param {ArrayBuffer} buffer
@param {number} start - byteOffset
@param {DeserializeOptions} options
@returns {{anchor: number, value: number}} anchor: byteOffset, value: double
@private | [
"Deserialize",
"float",
"data"
] | de9f1f6be59599feb1a5e70085b42b0382600d0b | https://github.com/JCloudYu/beson/blob/de9f1f6be59599feb1a5e70085b42b0382600d0b/deserialize.esm.js#L586-L591 |
37,143 | JCloudYu/beson | deserialize.esm.js | __deserializeFloat64 | function __deserializeFloat64(buffer, start, options) {
let end = start + 8;
let dataView = new DataView(buffer);
let data = dataView.getFloat64(start, true);
return { anchor: end, value: data };
} | javascript | function __deserializeFloat64(buffer, start, options) {
let end = start + 8;
let dataView = new DataView(buffer);
let data = dataView.getFloat64(start, true);
return { anchor: end, value: data };
} | [
"function",
"__deserializeFloat64",
"(",
"buffer",
",",
"start",
",",
"options",
")",
"{",
"let",
"end",
"=",
"start",
"+",
"8",
";",
"let",
"dataView",
"=",
"new",
"DataView",
"(",
"buffer",
")",
";",
"let",
"data",
"=",
"dataView",
".",
"getFloat64",
... | Deserialize double data
@param {ArrayBuffer} buffer
@param {number} start - byteOffset
@param {DeserializeOptions} options
@returns {{anchor: number, value: number}} anchor: byteOffset, value: double
@private | [
"Deserialize",
"double",
"data"
] | de9f1f6be59599feb1a5e70085b42b0382600d0b | https://github.com/JCloudYu/beson/blob/de9f1f6be59599feb1a5e70085b42b0382600d0b/deserialize.esm.js#L601-L606 |
37,144 | JCloudYu/beson | deserialize.esm.js | __deserializeArray | function __deserializeArray(buffer, start, options) {
let dataView = new DataView(buffer);
let length = dataView.getUint32(start, true);
start += 4;
let end = start + length;
let data = [];
while (start < end) {
let subType, subData;
({ anchor: start, value: subType } = __deserializeType(buffer, start, option... | javascript | function __deserializeArray(buffer, start, options) {
let dataView = new DataView(buffer);
let length = dataView.getUint32(start, true);
start += 4;
let end = start + length;
let data = [];
while (start < end) {
let subType, subData;
({ anchor: start, value: subType } = __deserializeType(buffer, start, option... | [
"function",
"__deserializeArray",
"(",
"buffer",
",",
"start",
",",
"options",
")",
"{",
"let",
"dataView",
"=",
"new",
"DataView",
"(",
"buffer",
")",
";",
"let",
"length",
"=",
"dataView",
".",
"getUint32",
"(",
"start",
",",
"true",
")",
";",
"start",... | Deserialize array data
@param {ArrayBuffer} buffer
@param {number} start - byteOffset
@param {DeserializeOptions} options
@returns {{anchor: number, value: *[]}} anchor: byteOffset
@private | [
"Deserialize",
"array",
"data"
] | de9f1f6be59599feb1a5e70085b42b0382600d0b | https://github.com/JCloudYu/beson/blob/de9f1f6be59599feb1a5e70085b42b0382600d0b/deserialize.esm.js#L660-L673 |
37,145 | JCloudYu/beson | deserialize.esm.js | __deserializeObject | function __deserializeObject(buffer, start, options) {
let dataView = new DataView(buffer);
let length = dataView.getUint32(start, true);
start += 4;
let end = start + length;
let data = {};
while (start < end) {
let subType, subKey, subData;
({ anchor: start, value: subType } = __deserializeType(buffer, star... | javascript | function __deserializeObject(buffer, start, options) {
let dataView = new DataView(buffer);
let length = dataView.getUint32(start, true);
start += 4;
let end = start + length;
let data = {};
while (start < end) {
let subType, subKey, subData;
({ anchor: start, value: subType } = __deserializeType(buffer, star... | [
"function",
"__deserializeObject",
"(",
"buffer",
",",
"start",
",",
"options",
")",
"{",
"let",
"dataView",
"=",
"new",
"DataView",
"(",
"buffer",
")",
";",
"let",
"length",
"=",
"dataView",
".",
"getUint32",
"(",
"start",
",",
"true",
")",
";",
"start"... | Deserialize object data
@param {ArrayBuffer} buffer
@param {number} start - byteOffset
@param {DeserializeOptions} options
@returns {{anchor: number, value: {}}} anchor: byteOffset
@private | [
"Deserialize",
"object",
"data"
] | de9f1f6be59599feb1a5e70085b42b0382600d0b | https://github.com/JCloudYu/beson/blob/de9f1f6be59599feb1a5e70085b42b0382600d0b/deserialize.esm.js#L712-L726 |
37,146 | JCloudYu/beson | deserialize.esm.js | __deserializeDate | function __deserializeDate(buffer, start, options) {
let end = start + 8;
let dataView = new DataView(buffer);
let data = new Date(dataView.getFloat64(start, true));
return { anchor: end, value: data };
} | javascript | function __deserializeDate(buffer, start, options) {
let end = start + 8;
let dataView = new DataView(buffer);
let data = new Date(dataView.getFloat64(start, true));
return { anchor: end, value: data };
} | [
"function",
"__deserializeDate",
"(",
"buffer",
",",
"start",
",",
"options",
")",
"{",
"let",
"end",
"=",
"start",
"+",
"8",
";",
"let",
"dataView",
"=",
"new",
"DataView",
"(",
"buffer",
")",
";",
"let",
"data",
"=",
"new",
"Date",
"(",
"dataView",
... | Deserialize date data
@param {ArrayBuffer} buffer
@param {number} start - byteOffset
@param {DeserializeOptions} options
@returns {{anchor: number, value: Date}} anchor: byteOffset
@private | [
"Deserialize",
"date",
"data"
] | de9f1f6be59599feb1a5e70085b42b0382600d0b | https://github.com/JCloudYu/beson/blob/de9f1f6be59599feb1a5e70085b42b0382600d0b/deserialize.esm.js#L766-L771 |
37,147 | JCloudYu/beson | deserialize.esm.js | __deserializeObjectId | function __deserializeObjectId(buffer, start, options) {
let step = 1;
let length = 12;
let end = start + length;
let dataView = new DataView(buffer);
let dataArray = [];
for (let i = start; i < end; i += step) {
dataArray.push(dataView.getUint8(i));
}
let data = new ObjectId(Uint8Array.from(dataArray).buffer... | javascript | function __deserializeObjectId(buffer, start, options) {
let step = 1;
let length = 12;
let end = start + length;
let dataView = new DataView(buffer);
let dataArray = [];
for (let i = start; i < end; i += step) {
dataArray.push(dataView.getUint8(i));
}
let data = new ObjectId(Uint8Array.from(dataArray).buffer... | [
"function",
"__deserializeObjectId",
"(",
"buffer",
",",
"start",
",",
"options",
")",
"{",
"let",
"step",
"=",
"1",
";",
"let",
"length",
"=",
"12",
";",
"let",
"end",
"=",
"start",
"+",
"length",
";",
"let",
"dataView",
"=",
"new",
"DataView",
"(",
... | Deserialize ObjectId data
@param {ArrayBuffer} buffer
@param {number} start - byteOffset
@param {DeserializeOptions} options
@returns {{anchor: number, value: ObjectId}} anchor: byteOffset
@private | [
"Deserialize",
"ObjectId",
"data"
] | de9f1f6be59599feb1a5e70085b42b0382600d0b | https://github.com/JCloudYu/beson/blob/de9f1f6be59599feb1a5e70085b42b0382600d0b/deserialize.esm.js#L781-L792 |
37,148 | JCloudYu/beson | deserialize.esm.js | __deserializeArrayBuffer | function __deserializeArrayBuffer(buffer, start, options) {
let end = start + 4;
let [length] = new Uint32Array(buffer.slice(start, end));
end = end + length;
return {anchor:end, value:buffer.slice(start+4, end)};
} | javascript | function __deserializeArrayBuffer(buffer, start, options) {
let end = start + 4;
let [length] = new Uint32Array(buffer.slice(start, end));
end = end + length;
return {anchor:end, value:buffer.slice(start+4, end)};
} | [
"function",
"__deserializeArrayBuffer",
"(",
"buffer",
",",
"start",
",",
"options",
")",
"{",
"let",
"end",
"=",
"start",
"+",
"4",
";",
"let",
"[",
"length",
"]",
"=",
"new",
"Uint32Array",
"(",
"buffer",
".",
"slice",
"(",
"start",
",",
"end",
")",
... | Deserialize ArrayBuffer object
@param {ArrayBuffer} buffer
@param {Number} start
@returns {{anchor:Number, value:ArrayBuffer}}
@param {DeserializeOptions} options
@private | [
"Deserialize",
"ArrayBuffer",
"object"
] | de9f1f6be59599feb1a5e70085b42b0382600d0b | https://github.com/JCloudYu/beson/blob/de9f1f6be59599feb1a5e70085b42b0382600d0b/deserialize.esm.js#L802-L808 |
37,149 | jabney/regex-replace-loader | index.js | getRegex | function getRegex(regex, flags) {
var result = typeOf(regex) === 'String'
? new RegExp(regex, flags || '')
: regex
if (typeOf(result) !== 'RegExp') {
throw new Error(
NAME + ': option "regex" must be a string or a RegExp object')
}
return result
} | javascript | function getRegex(regex, flags) {
var result = typeOf(regex) === 'String'
? new RegExp(regex, flags || '')
: regex
if (typeOf(result) !== 'RegExp') {
throw new Error(
NAME + ': option "regex" must be a string or a RegExp object')
}
return result
} | [
"function",
"getRegex",
"(",
"regex",
",",
"flags",
")",
"{",
"var",
"result",
"=",
"typeOf",
"(",
"regex",
")",
"===",
"'String'",
"?",
"new",
"RegExp",
"(",
"regex",
",",
"flags",
"||",
"''",
")",
":",
"regex",
"if",
"(",
"typeOf",
"(",
"result",
... | Transform regex into a RegExp if it isn't one already.
@param {any} regex
@param {string} flags
@returns {RegExp} | [
"Transform",
"regex",
"into",
"a",
"RegExp",
"if",
"it",
"isn",
"t",
"one",
"already",
"."
] | 02bd4a780a39223b682ead55312306e32f7a7755 | https://github.com/jabney/regex-replace-loader/blob/02bd4a780a39223b682ead55312306e32f7a7755/index.js#L67-L78 |
37,150 | jabney/regex-replace-loader | index.js | getMatchFn | function getMatchFn(valueFn) {
return function () {
var len = arguments.length
// Create a RegExp match object.
var match = Array.prototype.slice.call(arguments, 0, -2)
.reduce(function (map, g, i) {
map[i] = g
return map
}, {index: arguments[len - 2], input: arguments[len - 1]... | javascript | function getMatchFn(valueFn) {
return function () {
var len = arguments.length
// Create a RegExp match object.
var match = Array.prototype.slice.call(arguments, 0, -2)
.reduce(function (map, g, i) {
map[i] = g
return map
}, {index: arguments[len - 2], input: arguments[len - 1]... | [
"function",
"getMatchFn",
"(",
"valueFn",
")",
"{",
"return",
"function",
"(",
")",
"{",
"var",
"len",
"=",
"arguments",
".",
"length",
"// Create a RegExp match object.",
"var",
"match",
"=",
"Array",
".",
"prototype",
".",
"slice",
".",
"call",
"(",
"argum... | Return a function for use with string.replace that converts that
function's arguments into a RegExpMatchArray and calls the
value function.
@param {(match: RegExpMatchArray) => string} valueFn
@returns {(m: string, ...args: string[], i: number, s: string) => string} | [
"Return",
"a",
"function",
"for",
"use",
"with",
"string",
".",
"replace",
"that",
"converts",
"that",
"function",
"s",
"arguments",
"into",
"a",
"RegExpMatchArray",
"and",
"calls",
"the",
"value",
"function",
"."
] | 02bd4a780a39223b682ead55312306e32f7a7755 | https://github.com/jabney/regex-replace-loader/blob/02bd4a780a39223b682ead55312306e32f7a7755/index.js#L108-L120 |
37,151 | jabney/regex-replace-loader | index.js | replace | function replace(regex, source, options) {
var valueOrFn = getValueOrMatchFn(options.value)
source.replace(regex, function () { return '' })
return source.replace(regex, valueOrFn)
} | javascript | function replace(regex, source, options) {
var valueOrFn = getValueOrMatchFn(options.value)
source.replace(regex, function () { return '' })
return source.replace(regex, valueOrFn)
} | [
"function",
"replace",
"(",
"regex",
",",
"source",
",",
"options",
")",
"{",
"var",
"valueOrFn",
"=",
"getValueOrMatchFn",
"(",
"options",
".",
"value",
")",
"source",
".",
"replace",
"(",
"regex",
",",
"function",
"(",
")",
"{",
"return",
"''",
"}",
... | Execute a replace operation and return the modified source.
@param {RegExp} regex
@param {string} source
@param {LoaderOptions} options
@returns {string} | [
"Execute",
"a",
"replace",
"operation",
"and",
"return",
"the",
"modified",
"source",
"."
] | 02bd4a780a39223b682ead55312306e32f7a7755 | https://github.com/jabney/regex-replace-loader/blob/02bd4a780a39223b682ead55312306e32f7a7755/index.js#L130-L134 |
37,152 | dvhb/webpack | scripts/getConfig.js | validateDependency | function validateDependency(packageJson, dependency) {
const version = findDependency(dependency.package, packageJson);
if (!version) {
return;
}
let major;
try {
major = semverUtils.parseRange(version)[0].major;
}
catch (exception) {
console.log('DvhbWebpack: cannot parse ' + dependency.name... | javascript | function validateDependency(packageJson, dependency) {
const version = findDependency(dependency.package, packageJson);
if (!version) {
return;
}
let major;
try {
major = semverUtils.parseRange(version)[0].major;
}
catch (exception) {
console.log('DvhbWebpack: cannot parse ' + dependency.name... | [
"function",
"validateDependency",
"(",
"packageJson",
",",
"dependency",
")",
"{",
"const",
"version",
"=",
"findDependency",
"(",
"dependency",
".",
"package",
",",
"packageJson",
")",
";",
"if",
"(",
"!",
"version",
")",
"{",
"return",
";",
"}",
"let",
"... | Check versions of a project dependency.
@param {Object} packageJson package.json.
@param {Object} dependency Dependency details. | [
"Check",
"versions",
"of",
"a",
"project",
"dependency",
"."
] | 1097f6c44f2d8da631e4df9ec0a01db23dbb352f | https://github.com/dvhb/webpack/blob/1097f6c44f2d8da631e4df9ec0a01db23dbb352f/scripts/getConfig.js#L205-L231 |
37,153 | karlkfi/ngindox | lib/nginx-transformer.js | toRouteMap | function toRouteMap(routeList) {
var routeMap = {};
for (var i = 0, len = routeList.length; i < len; i++) {
var route = routeList[i];
routeMap[route['path']] = route;
}
return routeMap;
} | javascript | function toRouteMap(routeList) {
var routeMap = {};
for (var i = 0, len = routeList.length; i < len; i++) {
var route = routeList[i];
routeMap[route['path']] = route;
}
return routeMap;
} | [
"function",
"toRouteMap",
"(",
"routeList",
")",
"{",
"var",
"routeMap",
"=",
"{",
"}",
";",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"len",
"=",
"routeList",
".",
"length",
";",
"i",
"<",
"len",
";",
"i",
"++",
")",
"{",
"var",
"route",
"=",
"ro... | Transforms route list into a map of routes indexed by path. | [
"Transforms",
"route",
"list",
"into",
"a",
"map",
"of",
"routes",
"indexed",
"by",
"path",
"."
] | 2c0e8a682d7bde9e5d73a853f45bf1460f4664e9 | https://github.com/karlkfi/ngindox/blob/2c0e8a682d7bde9e5d73a853f45bf1460f4664e9/lib/nginx-transformer.js#L197-L204 |
37,154 | hash-bang/Monoxide | index.js | function() {
var doc = this;
var newDoc = {};
_.forEach(this, function(v, k) {
if (doc.hasOwnProperty(k) && !_.startsWith(k, '$')) newDoc[k] = _.clone(v);
});
return newDoc;
} | javascript | function() {
var doc = this;
var newDoc = {};
_.forEach(this, function(v, k) {
if (doc.hasOwnProperty(k) && !_.startsWith(k, '$')) newDoc[k] = _.clone(v);
});
return newDoc;
} | [
"function",
"(",
")",
"{",
"var",
"doc",
"=",
"this",
";",
"var",
"newDoc",
"=",
"{",
"}",
";",
"_",
".",
"forEach",
"(",
"this",
",",
"function",
"(",
"v",
",",
"k",
")",
"{",
"if",
"(",
"doc",
".",
"hasOwnProperty",
"(",
"k",
")",
"&&",
"!"... | Transform a MonoxideDocument into a plain JavaScript object
@return {Object} Plain JavaScript object with all special properties and other gunk removed | [
"Transform",
"a",
"MonoxideDocument",
"into",
"a",
"plain",
"JavaScript",
"object"
] | 76b1cf33c8e5b6e36801daa31bde9b422601c3a6 | https://github.com/hash-bang/Monoxide/blob/76b1cf33c8e5b6e36801daa31bde9b422601c3a6/index.js#L2026-L2034 | |
37,155 | hash-bang/Monoxide | index.js | function() {
var doc = this;
var outDoc = doc.toObject(); // Rely on the toObject() syntax to strip out rubbish
doc.getOIDs().forEach(function(node) {
switch (node.fkType) {
case 'objectId':
var oidLeaf = _.get(doc, node.docPath);
if (_.isUndefined(oidLeaf)) return; // Ignore undef... | javascript | function() {
var doc = this;
var outDoc = doc.toObject(); // Rely on the toObject() syntax to strip out rubbish
doc.getOIDs().forEach(function(node) {
switch (node.fkType) {
case 'objectId':
var oidLeaf = _.get(doc, node.docPath);
if (_.isUndefined(oidLeaf)) return; // Ignore undef... | [
"function",
"(",
")",
"{",
"var",
"doc",
"=",
"this",
";",
"var",
"outDoc",
"=",
"doc",
".",
"toObject",
"(",
")",
";",
"// Rely on the toObject() syntax to strip out rubbish",
"doc",
".",
"getOIDs",
"(",
")",
".",
"forEach",
"(",
"function",
"(",
"node",
... | Transform a MonoxideDocument into a Mongo object
This function transforms all OID strings back into their Mongo equivalent
@return {Object} Plain JavaScript object with all special properties and other gunk removed | [
"Transform",
"a",
"MonoxideDocument",
"into",
"a",
"Mongo",
"object",
"This",
"function",
"transforms",
"all",
"OID",
"strings",
"back",
"into",
"their",
"Mongo",
"equivalent"
] | 76b1cf33c8e5b6e36801daa31bde9b422601c3a6 | https://github.com/hash-bang/Monoxide/blob/76b1cf33c8e5b6e36801daa31bde9b422601c3a6/index.js#L2041-L2071 | |
37,156 | hash-bang/Monoxide | index.js | function() {
var doc = this;
var stack = [];
_.forEach(model.$oids, function(fkType, schemaPath) {
if (fkType.type == 'subDocument') return; // Skip sub-documents (as they are stored against the parent anyway)
stack = stack.concat(doc.getNodesBySchemaPath(schemaPath)
.map(function(node) {
... | javascript | function() {
var doc = this;
var stack = [];
_.forEach(model.$oids, function(fkType, schemaPath) {
if (fkType.type == 'subDocument') return; // Skip sub-documents (as they are stored against the parent anyway)
stack = stack.concat(doc.getNodesBySchemaPath(schemaPath)
.map(function(node) {
... | [
"function",
"(",
")",
"{",
"var",
"doc",
"=",
"this",
";",
"var",
"stack",
"=",
"[",
"]",
";",
"_",
".",
"forEach",
"(",
"model",
".",
"$oids",
",",
"function",
"(",
"fkType",
",",
"schemaPath",
")",
"{",
"if",
"(",
"fkType",
".",
"type",
"==",
... | Return an array of all OID leaf nodes within the document
This function combines the behaviour of monoxide.utilities.extractFKs with monoxide.monoxideDocument.getNodesBySchemaPath)
@return {array} An array of all leaf nodes | [
"Return",
"an",
"array",
"of",
"all",
"OID",
"leaf",
"nodes",
"within",
"the",
"document",
"This",
"function",
"combines",
"the",
"behaviour",
"of",
"monoxide",
".",
"utilities",
".",
"extractFKs",
"with",
"monoxide",
".",
"monoxideDocument",
".",
"getNodesBySch... | 76b1cf33c8e5b6e36801daa31bde9b422601c3a6 | https://github.com/hash-bang/Monoxide/blob/76b1cf33c8e5b6e36801daa31bde9b422601c3a6/index.js#L2275-L2290 | |
37,157 | MathiasPaumgarten/grunt-shared-config | tasks/shared-config.js | generateJS | function generateJS( data ) {
var preparedData = prepareValues( data );
var content = JSON.stringify( preparedData, null, options.indention );
var output = outputPattern.js.replace( "{{name}}", options.name ).replace( "{{vars}}", content );
return options.singlequote ? output.replace( /"/g, "'" ) : output;... | javascript | function generateJS( data ) {
var preparedData = prepareValues( data );
var content = JSON.stringify( preparedData, null, options.indention );
var output = outputPattern.js.replace( "{{name}}", options.name ).replace( "{{vars}}", content );
return options.singlequote ? output.replace( /"/g, "'" ) : output;... | [
"function",
"generateJS",
"(",
"data",
")",
"{",
"var",
"preparedData",
"=",
"prepareValues",
"(",
"data",
")",
";",
"var",
"content",
"=",
"JSON",
".",
"stringify",
"(",
"preparedData",
",",
"null",
",",
"options",
".",
"indention",
")",
";",
"var",
"ou... | Generate JavaScript files | [
"Generate",
"JavaScript",
"files"
] | ff5ab985bcecc138e3b4a1bf91da77785a65bc64 | https://github.com/MathiasPaumgarten/grunt-shared-config/blob/ff5ab985bcecc138e3b4a1bf91da77785a65bc64/tasks/shared-config.js#L267-L273 |
37,158 | ircanywhere/irc-factory | examples/persistent.js | createClient | function createClient() {
rpc.emit('createClient', 'test', {
nick : 'simpleircbot',
user : 'testuser',
server : 'localhost',
realname: 'realbot',
port: 6667,
secure: false,
retryCount: 2,
retryWait: 3000
});
} | javascript | function createClient() {
rpc.emit('createClient', 'test', {
nick : 'simpleircbot',
user : 'testuser',
server : 'localhost',
realname: 'realbot',
port: 6667,
secure: false,
retryCount: 2,
retryWait: 3000
});
} | [
"function",
"createClient",
"(",
")",
"{",
"rpc",
".",
"emit",
"(",
"'createClient'",
",",
"'test'",
",",
"{",
"nick",
":",
"'simpleircbot'",
",",
"user",
":",
"'testuser'",
",",
"server",
":",
"'localhost'",
",",
"realname",
":",
"'realbot'",
",",
"port",... | handle incoming events, we don't use an event emitter because of the fact we want queueing. | [
"handle",
"incoming",
"events",
"we",
"don",
"t",
"use",
"an",
"event",
"emitter",
"because",
"of",
"the",
"fact",
"we",
"want",
"queueing",
"."
] | 6a7f739bda7fe3a6c6201edce2fab64699c17167 | https://github.com/ircanywhere/irc-factory/blob/6a7f739bda7fe3a6c6201edce2fab64699c17167/examples/persistent.js#L34-L45 |
37,159 | tilgovi/simple-xpath-position | src/xpath.js | nodePosition | function nodePosition(node) {
let name = node.nodeName
let position = 1
while ((node = node.previousSibling)) {
if (node.nodeName === name) position += 1
}
return position
} | javascript | function nodePosition(node) {
let name = node.nodeName
let position = 1
while ((node = node.previousSibling)) {
if (node.nodeName === name) position += 1
}
return position
} | [
"function",
"nodePosition",
"(",
"node",
")",
"{",
"let",
"name",
"=",
"node",
".",
"nodeName",
"let",
"position",
"=",
"1",
"while",
"(",
"(",
"node",
"=",
"node",
".",
"previousSibling",
")",
")",
"{",
"if",
"(",
"node",
".",
"nodeName",
"===",
"na... | Get the ordinal position of this node among its siblings of the same name. | [
"Get",
"the",
"ordinal",
"position",
"of",
"this",
"node",
"among",
"its",
"siblings",
"of",
"the",
"same",
"name",
"."
] | 6001d1d213d99da5c64782aa6a9fdfca11b7ef74 | https://github.com/tilgovi/simple-xpath-position/blob/6001d1d213d99da5c64782aa6a9fdfca11b7ef74/src/xpath.js#L94-L101 |
37,160 | tilgovi/simple-xpath-position | src/xpath.js | resolve | function resolve(path, root, resolver) {
try {
// Add a default value to each path part lacking a prefix.
let nspath = path.replace(/\/(?!\.)([^\/:\(]+)(?=\/|$)/g, '/_default_:$1')
return platformResolve(nspath, root, resolver)
} catch (err) {
return fallbackResolve(path, root)
}
} | javascript | function resolve(path, root, resolver) {
try {
// Add a default value to each path part lacking a prefix.
let nspath = path.replace(/\/(?!\.)([^\/:\(]+)(?=\/|$)/g, '/_default_:$1')
return platformResolve(nspath, root, resolver)
} catch (err) {
return fallbackResolve(path, root)
}
} | [
"function",
"resolve",
"(",
"path",
",",
"root",
",",
"resolver",
")",
"{",
"try",
"{",
"// Add a default value to each path part lacking a prefix.",
"let",
"nspath",
"=",
"path",
".",
"replace",
"(",
"/",
"\\/(?!\\.)([^\\/:\\(]+)(?=\\/|$)",
"/",
"g",
",",
"'/_defau... | Find a single node with XPath `path` | [
"Find",
"a",
"single",
"node",
"with",
"XPath",
"path"
] | 6001d1d213d99da5c64782aa6a9fdfca11b7ef74 | https://github.com/tilgovi/simple-xpath-position/blob/6001d1d213d99da5c64782aa6a9fdfca11b7ef74/src/xpath.js#L105-L113 |
37,161 | tilgovi/simple-xpath-position | src/xpath.js | fallbackResolve | function fallbackResolve(path, root) {
let steps = path.split("/")
let node = root
while (node) {
let step = steps.shift()
if (step === undefined) break
if (step === '.') continue
let [name, position] = step.split(/[\[\]]/)
name = name.replace('_default_:', '')
position = position ? parseI... | javascript | function fallbackResolve(path, root) {
let steps = path.split("/")
let node = root
while (node) {
let step = steps.shift()
if (step === undefined) break
if (step === '.') continue
let [name, position] = step.split(/[\[\]]/)
name = name.replace('_default_:', '')
position = position ? parseI... | [
"function",
"fallbackResolve",
"(",
"path",
",",
"root",
")",
"{",
"let",
"steps",
"=",
"path",
".",
"split",
"(",
"\"/\"",
")",
"let",
"node",
"=",
"root",
"while",
"(",
"node",
")",
"{",
"let",
"step",
"=",
"steps",
".",
"shift",
"(",
")",
"if",
... | Find a single node with XPath `path` using the simple, built-in evaluator. | [
"Find",
"a",
"single",
"node",
"with",
"XPath",
"path",
"using",
"the",
"simple",
"built",
"-",
"in",
"evaluator",
"."
] | 6001d1d213d99da5c64782aa6a9fdfca11b7ef74 | https://github.com/tilgovi/simple-xpath-position/blob/6001d1d213d99da5c64782aa6a9fdfca11b7ef74/src/xpath.js#L117-L130 |
37,162 | tilgovi/simple-xpath-position | src/xpath.js | platformResolve | function platformResolve(path, root, resolver) {
let document = getDocument(root)
let r = document.evaluate(path, root, resolver, FIRST_ORDERED_NODE_TYPE, null)
return r.singleNodeValue
} | javascript | function platformResolve(path, root, resolver) {
let document = getDocument(root)
let r = document.evaluate(path, root, resolver, FIRST_ORDERED_NODE_TYPE, null)
return r.singleNodeValue
} | [
"function",
"platformResolve",
"(",
"path",
",",
"root",
",",
"resolver",
")",
"{",
"let",
"document",
"=",
"getDocument",
"(",
"root",
")",
"let",
"r",
"=",
"document",
".",
"evaluate",
"(",
"path",
",",
"root",
",",
"resolver",
",",
"FIRST_ORDERED_NODE_T... | Find a single node with XPath `path` using `document.evaluate`. | [
"Find",
"a",
"single",
"node",
"with",
"XPath",
"path",
"using",
"document",
".",
"evaluate",
"."
] | 6001d1d213d99da5c64782aa6a9fdfca11b7ef74 | https://github.com/tilgovi/simple-xpath-position/blob/6001d1d213d99da5c64782aa6a9fdfca11b7ef74/src/xpath.js#L134-L138 |
37,163 | tilgovi/simple-xpath-position | src/xpath.js | findChild | function findChild(node, name, position) {
for (node = node.firstChild ; node ; node = node.nextSibling) {
if (nodeName(node) === name && --position === 0) break
}
return node
} | javascript | function findChild(node, name, position) {
for (node = node.firstChild ; node ; node = node.nextSibling) {
if (nodeName(node) === name && --position === 0) break
}
return node
} | [
"function",
"findChild",
"(",
"node",
",",
"name",
",",
"position",
")",
"{",
"for",
"(",
"node",
"=",
"node",
".",
"firstChild",
";",
"node",
";",
"node",
"=",
"node",
".",
"nextSibling",
")",
"{",
"if",
"(",
"nodeName",
"(",
"node",
")",
"===",
"... | Find the child of the given node by name and ordinal position. | [
"Find",
"the",
"child",
"of",
"the",
"given",
"node",
"by",
"name",
"and",
"ordinal",
"position",
"."
] | 6001d1d213d99da5c64782aa6a9fdfca11b7ef74 | https://github.com/tilgovi/simple-xpath-position/blob/6001d1d213d99da5c64782aa6a9fdfca11b7ef74/src/xpath.js#L142-L147 |
37,164 | silas/hapi-bunyan | lib/index.js | logEvent | function logEvent(ctx, data, request) {
if (!data) return;
var obj = {};
var msg = '';
if (ctx.includeTags && Array.isArray(data.tags)) {
obj.tags = ctx.joinTags ? data.tags.join(ctx.joinTags) : data.tags;
}
if (request) obj.req_id = request.id;
if (data instanceof Error) {
ctx.log.child(obj)[... | javascript | function logEvent(ctx, data, request) {
if (!data) return;
var obj = {};
var msg = '';
if (ctx.includeTags && Array.isArray(data.tags)) {
obj.tags = ctx.joinTags ? data.tags.join(ctx.joinTags) : data.tags;
}
if (request) obj.req_id = request.id;
if (data instanceof Error) {
ctx.log.child(obj)[... | [
"function",
"logEvent",
"(",
"ctx",
",",
"data",
",",
"request",
")",
"{",
"if",
"(",
"!",
"data",
")",
"return",
";",
"var",
"obj",
"=",
"{",
"}",
";",
"var",
"msg",
"=",
"''",
";",
"if",
"(",
"ctx",
".",
"includeTags",
"&&",
"Array",
".",
"is... | Event logger. | [
"Event",
"logger",
"."
] | 6f49b9ca431522a8448930f0df28d726afccda37 | https://github.com/silas/hapi-bunyan/blob/6f49b9ca431522a8448930f0df28d726afccda37/lib/index.js#L19-L53 |
37,165 | JCloudYu/beson | serialize.esm.js | __serializeIntVar | function __serializeIntVar(data) {
if ( data.size > 127 ) {
throw new Error( "Cannot support IntVar whose size is greater than 127 bytes" );
}
const size = new Uint8Array([data.size]);
return [size.buffer, data.toBytes().buffer];
} | javascript | function __serializeIntVar(data) {
if ( data.size > 127 ) {
throw new Error( "Cannot support IntVar whose size is greater than 127 bytes" );
}
const size = new Uint8Array([data.size]);
return [size.buffer, data.toBytes().buffer];
} | [
"function",
"__serializeIntVar",
"(",
"data",
")",
"{",
"if",
"(",
"data",
".",
"size",
">",
"127",
")",
"{",
"throw",
"new",
"Error",
"(",
"\"Cannot support IntVar whose size is greater than 127 bytes\"",
")",
";",
"}",
"const",
"size",
"=",
"new",
"Uint8Array"... | Serialize IntVar data
@param {IntVar} data
@returns {ArrayBuffer[]}
@private | [
"Serialize",
"IntVar",
"data"
] | de9f1f6be59599feb1a5e70085b42b0382600d0b | https://github.com/JCloudYu/beson/blob/de9f1f6be59599feb1a5e70085b42b0382600d0b/serialize.esm.js#L381-L388 |
37,166 | JCloudYu/beson | serialize.esm.js | __serializeUIntVar | function __serializeUIntVar(data) {
if ( data.size > 127 ) {
throw new Error( "Cannot support UIntVar whose size is greater than 127 bytes" );
}
const size = new Uint8Array([data.size]);
return [size.buffer, data.toBytes().buffer];
} | javascript | function __serializeUIntVar(data) {
if ( data.size > 127 ) {
throw new Error( "Cannot support UIntVar whose size is greater than 127 bytes" );
}
const size = new Uint8Array([data.size]);
return [size.buffer, data.toBytes().buffer];
} | [
"function",
"__serializeUIntVar",
"(",
"data",
")",
"{",
"if",
"(",
"data",
".",
"size",
">",
"127",
")",
"{",
"throw",
"new",
"Error",
"(",
"\"Cannot support UIntVar whose size is greater than 127 bytes\"",
")",
";",
"}",
"const",
"size",
"=",
"new",
"Uint8Arra... | Serialize UIntVar data
@param {UIntVar} data
@returns {ArrayBuffer[]}
@private | [
"Serialize",
"UIntVar",
"data"
] | de9f1f6be59599feb1a5e70085b42b0382600d0b | https://github.com/JCloudYu/beson/blob/de9f1f6be59599feb1a5e70085b42b0382600d0b/serialize.esm.js#L436-L443 |
37,167 | JCloudYu/beson | serialize.esm.js | __serializeArray | function __serializeArray(data, options=DEFAULT_OPTIONS) {
let dataBuffers = [];
// ignore undefined value
for (let key in data) {
let subData = data[key];
let subType = __getType(subData, options);
let subTypeBuffer = __serializeType(subType);
let subDataBuffers = __serializeData(subType, subData, options);... | javascript | function __serializeArray(data, options=DEFAULT_OPTIONS) {
let dataBuffers = [];
// ignore undefined value
for (let key in data) {
let subData = data[key];
let subType = __getType(subData, options);
let subTypeBuffer = __serializeType(subType);
let subDataBuffers = __serializeData(subType, subData, options);... | [
"function",
"__serializeArray",
"(",
"data",
",",
"options",
"=",
"DEFAULT_OPTIONS",
")",
"{",
"let",
"dataBuffers",
"=",
"[",
"]",
";",
"// ignore undefined value",
"for",
"(",
"let",
"key",
"in",
"data",
")",
"{",
"let",
"subData",
"=",
"data",
"[",
"key... | Serialize array data
@param {*[]} data
@param {Object} options
@param {boolean} options.sort_key
@param {boolean} options.streaming_array
@param {boolean} options.streaming_object
@returns {ArrayBuffer[]}
@private | [
"Serialize",
"array",
"data"
] | de9f1f6be59599feb1a5e70085b42b0382600d0b | https://github.com/JCloudYu/beson/blob/de9f1f6be59599feb1a5e70085b42b0382600d0b/serialize.esm.js#L492-L505 |
37,168 | JCloudYu/beson | serialize.esm.js | __serializeObject | function __serializeObject(data, options=DEFAULT_OPTIONS) {
let dataBuffers = [];
let allKeys = (options.sort_key === true) ? Object.keys(data).sort() : Object.keys(data);
// ignore undefined value
for (let key of allKeys) {
let subData = data[key];
if (subData === undefined) continue;
let subType = __getTyp... | javascript | function __serializeObject(data, options=DEFAULT_OPTIONS) {
let dataBuffers = [];
let allKeys = (options.sort_key === true) ? Object.keys(data).sort() : Object.keys(data);
// ignore undefined value
for (let key of allKeys) {
let subData = data[key];
if (subData === undefined) continue;
let subType = __getTyp... | [
"function",
"__serializeObject",
"(",
"data",
",",
"options",
"=",
"DEFAULT_OPTIONS",
")",
"{",
"let",
"dataBuffers",
"=",
"[",
"]",
";",
"let",
"allKeys",
"=",
"(",
"options",
".",
"sort_key",
"===",
"true",
")",
"?",
"Object",
".",
"keys",
"(",
"data",... | Serialize object data
@param {Object} data
@param {Object} options
@param {boolean} options.sort_key
@param {boolean} options.streaming_array
@param {boolean} options.streaming_object
@returns {ArrayBuffer[]}
@private | [
"Serialize",
"object",
"data"
] | de9f1f6be59599feb1a5e70085b42b0382600d0b | https://github.com/JCloudYu/beson/blob/de9f1f6be59599feb1a5e70085b42b0382600d0b/serialize.esm.js#L540-L557 |
37,169 | JCloudYu/beson | serialize.esm.js | __serializeArrayBuffer | function __serializeArrayBuffer(data) {
let length = data.byteLength;
let lengthData = new Uint32Array([length]);
return [lengthData.buffer, data];
} | javascript | function __serializeArrayBuffer(data) {
let length = data.byteLength;
let lengthData = new Uint32Array([length]);
return [lengthData.buffer, data];
} | [
"function",
"__serializeArrayBuffer",
"(",
"data",
")",
"{",
"let",
"length",
"=",
"data",
".",
"byteLength",
";",
"let",
"lengthData",
"=",
"new",
"Uint32Array",
"(",
"[",
"length",
"]",
")",
";",
"return",
"[",
"lengthData",
".",
"buffer",
",",
"data",
... | Serialize ArrayBuffer Object
@param {ArrayBuffer} data
@returns {ArrayBuffer[]}
@private | [
"Serialize",
"ArrayBuffer",
"Object"
] | de9f1f6be59599feb1a5e70085b42b0382600d0b | https://github.com/JCloudYu/beson/blob/de9f1f6be59599feb1a5e70085b42b0382600d0b/serialize.esm.js#L613-L617 |
37,170 | maxkfranz/weaver | documentation/js/Markdown.Editor.js | function (newMode, noSave) {
if (mode != newMode) {
mode = newMode;
if (!noSave) {
saveState();
}
}
if (!uaSniffed.isIE || mode != "moving") {
timer = setTimeout(refreshState, 1);
... | javascript | function (newMode, noSave) {
if (mode != newMode) {
mode = newMode;
if (!noSave) {
saveState();
}
}
if (!uaSniffed.isIE || mode != "moving") {
timer = setTimeout(refreshState, 1);
... | [
"function",
"(",
"newMode",
",",
"noSave",
")",
"{",
"if",
"(",
"mode",
"!=",
"newMode",
")",
"{",
"mode",
"=",
"newMode",
";",
"if",
"(",
"!",
"noSave",
")",
"{",
"saveState",
"(",
")",
";",
"}",
"}",
"if",
"(",
"!",
"uaSniffed",
".",
"isIE",
... | Set the mode for later logic steps. | [
"Set",
"the",
"mode",
"for",
"later",
"logic",
"steps",
"."
] | bac2535114420379005acdfe2dad06331de88496 | https://github.com/maxkfranz/weaver/blob/bac2535114420379005acdfe2dad06331de88496/documentation/js/Markdown.Editor.js#L411-L425 | |
37,171 | maxkfranz/weaver | documentation/js/Markdown.Editor.js | function () {
var currState = inputStateObj || new TextareaState(panels);
if (!currState) {
return false;
}
if (mode == "moving") {
if (!lastState) {
lastState = currState;
}
re... | javascript | function () {
var currState = inputStateObj || new TextareaState(panels);
if (!currState) {
return false;
}
if (mode == "moving") {
if (!lastState) {
lastState = currState;
}
re... | [
"function",
"(",
")",
"{",
"var",
"currState",
"=",
"inputStateObj",
"||",
"new",
"TextareaState",
"(",
"panels",
")",
";",
"if",
"(",
"!",
"currState",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"mode",
"==",
"\"moving\"",
")",
"{",
"if",
"("... | Push the input area state to the stack. | [
"Push",
"the",
"input",
"area",
"state",
"to",
"the",
"stack",
"."
] | bac2535114420379005acdfe2dad06331de88496 | https://github.com/maxkfranz/weaver/blob/bac2535114420379005acdfe2dad06331de88496/documentation/js/Markdown.Editor.js#L491-L514 | |
37,172 | maxkfranz/weaver | documentation/js/Markdown.Editor.js | function (event) {
if (!event.ctrlKey && !event.metaKey) {
var keyCode = event.keyCode;
if ((keyCode >= 33 && keyCode <= 40) || (keyCode >= 63232 && keyCode <= 63235)) {
// 33 - 40: page up/dn and arrow keys
// 63232 - 63235:... | javascript | function (event) {
if (!event.ctrlKey && !event.metaKey) {
var keyCode = event.keyCode;
if ((keyCode >= 33 && keyCode <= 40) || (keyCode >= 63232 && keyCode <= 63235)) {
// 33 - 40: page up/dn and arrow keys
// 63232 - 63235:... | [
"function",
"(",
"event",
")",
"{",
"if",
"(",
"!",
"event",
".",
"ctrlKey",
"&&",
"!",
"event",
".",
"metaKey",
")",
"{",
"var",
"keyCode",
"=",
"event",
".",
"keyCode",
";",
"if",
"(",
"(",
"keyCode",
">=",
"33",
"&&",
"keyCode",
"<=",
"40",
")... | Set the mode depending on what is going on in the input area. | [
"Set",
"the",
"mode",
"depending",
"on",
"what",
"is",
"going",
"on",
"in",
"the",
"input",
"area",
"."
] | bac2535114420379005acdfe2dad06331de88496 | https://github.com/maxkfranz/weaver/blob/bac2535114420379005acdfe2dad06331de88496/documentation/js/Markdown.Editor.js#L557-L590 | |
37,173 | maxkfranz/weaver | documentation/js/Markdown.Editor.js | function (inputElem, listener) {
util.addEvent(inputElem, "input", listener);
inputElem.onpaste = listener;
inputElem.ondrop = listener;
util.addEvent(inputElem, "keypress", listener);
util.addEvent(inputElem, "keydown", listener);
} | javascript | function (inputElem, listener) {
util.addEvent(inputElem, "input", listener);
inputElem.onpaste = listener;
inputElem.ondrop = listener;
util.addEvent(inputElem, "keypress", listener);
util.addEvent(inputElem, "keydown", listener);
} | [
"function",
"(",
"inputElem",
",",
"listener",
")",
"{",
"util",
".",
"addEvent",
"(",
"inputElem",
",",
"\"input\"",
",",
"listener",
")",
";",
"inputElem",
".",
"onpaste",
"=",
"listener",
";",
"inputElem",
".",
"ondrop",
"=",
"listener",
";",
"util",
... | The other legal value is "manual" Adds event listeners to elements | [
"The",
"other",
"legal",
"value",
"is",
"manual",
"Adds",
"event",
"listeners",
"to",
"elements"
] | bac2535114420379005acdfe2dad06331de88496 | https://github.com/maxkfranz/weaver/blob/bac2535114420379005acdfe2dad06331de88496/documentation/js/Markdown.Editor.js#L782-L790 | |
37,174 | maxkfranz/weaver | documentation/js/Markdown.Editor.js | function () {
if (timeout) {
clearTimeout(timeout);
timeout = undefined;
}
if (startType !== "manual") {
var delay = 0;
if (startType === "delayed") {
delay = elapsedTime;
... | javascript | function () {
if (timeout) {
clearTimeout(timeout);
timeout = undefined;
}
if (startType !== "manual") {
var delay = 0;
if (startType === "delayed") {
delay = elapsedTime;
... | [
"function",
"(",
")",
"{",
"if",
"(",
"timeout",
")",
"{",
"clearTimeout",
"(",
"timeout",
")",
";",
"timeout",
"=",
"undefined",
";",
"}",
"if",
"(",
"startType",
"!==",
"\"manual\"",
")",
"{",
"var",
"delay",
"=",
"0",
";",
"if",
"(",
"startType",
... | setTimeout is already used. Used as an event listener. | [
"setTimeout",
"is",
"already",
"used",
".",
"Used",
"as",
"an",
"event",
"listener",
"."
] | bac2535114420379005acdfe2dad06331de88496 | https://github.com/maxkfranz/weaver/blob/bac2535114420379005acdfe2dad06331de88496/documentation/js/Markdown.Editor.js#L840-L860 | |
37,175 | maxkfranz/weaver | documentation/js/Markdown.Editor.js | function (isCancel) {
util.removeEvent(doc.body, "keydown", checkEscape);
var text = input.value;
if (isCancel) {
text = null;
}
else {
// Fixes common pasting errors.
text = text.replace(/^http:\/\/(ht... | javascript | function (isCancel) {
util.removeEvent(doc.body, "keydown", checkEscape);
var text = input.value;
if (isCancel) {
text = null;
}
else {
// Fixes common pasting errors.
text = text.replace(/^http:\/\/(ht... | [
"function",
"(",
"isCancel",
")",
"{",
"util",
".",
"removeEvent",
"(",
"doc",
".",
"body",
",",
"\"keydown\"",
",",
"checkEscape",
")",
";",
"var",
"text",
"=",
"input",
".",
"value",
";",
"if",
"(",
"isCancel",
")",
"{",
"text",
"=",
"null",
";",
... | Dismisses the hyperlink input box. isCancel is true if we don't care about the input text. isCancel is false if we are going to keep the text. | [
"Dismisses",
"the",
"hyperlink",
"input",
"box",
".",
"isCancel",
"is",
"true",
"if",
"we",
"don",
"t",
"care",
"about",
"the",
"input",
"text",
".",
"isCancel",
"is",
"false",
"if",
"we",
"are",
"going",
"to",
"keep",
"the",
"text",
"."
] | bac2535114420379005acdfe2dad06331de88496 | https://github.com/maxkfranz/weaver/blob/bac2535114420379005acdfe2dad06331de88496/documentation/js/Markdown.Editor.js#L1038-L1056 | |
37,176 | lechu1985/basic-mouse-event-polyfill-phantomjs | index.js | function (eventType, params) {
params = params || {
bubbles: false,
cancelable: false,
ctrlKey: false,
altKey: false,
shiftKey: false,
metaKey: false
};
var mouseEvent = document.createEvent('MouseEvent');
mouseEvent.initMouseEvent(eventType, params.bubb... | javascript | function (eventType, params) {
params = params || {
bubbles: false,
cancelable: false,
ctrlKey: false,
altKey: false,
shiftKey: false,
metaKey: false
};
var mouseEvent = document.createEvent('MouseEvent');
mouseEvent.initMouseEvent(eventType, params.bubb... | [
"function",
"(",
"eventType",
",",
"params",
")",
"{",
"params",
"=",
"params",
"||",
"{",
"bubbles",
":",
"false",
",",
"cancelable",
":",
"false",
",",
"ctrlKey",
":",
"false",
",",
"altKey",
":",
"false",
",",
"shiftKey",
":",
"false",
",",
"metaKey... | Polyfills DOM4 MouseEvent | [
"Polyfills",
"DOM4",
"MouseEvent"
] | 235ff99c81fc8950803eebb87ba15a2b8ceaa571 | https://github.com/lechu1985/basic-mouse-event-polyfill-phantomjs/blob/235ff99c81fc8950803eebb87ba15a2b8ceaa571/index.js#L11-L24 | |
37,177 | eGavr/toc-md | lib/index.js | function (source, opts, cb) {
var callback,
options;
if (arguments.length === 2) {
options = defaults();
callback = opts;
} else {
options = defaults(opts);
callback = cb;
}
try {
source = api.clean(source)... | javascript | function (source, opts, cb) {
var callback,
options;
if (arguments.length === 2) {
options = defaults();
callback = opts;
} else {
options = defaults(opts);
callback = cb;
}
try {
source = api.clean(source)... | [
"function",
"(",
"source",
",",
"opts",
",",
"cb",
")",
"{",
"var",
"callback",
",",
"options",
";",
"if",
"(",
"arguments",
".",
"length",
"===",
"2",
")",
"{",
"options",
"=",
"defaults",
"(",
")",
";",
"callback",
"=",
"opts",
";",
"}",
"else",
... | Inserts a TOC object into a source
@param {String} source
@param {Object} [opts]
@param {Number} [opts.maxDepth]
@param {Char} [opts.bullet]
@param {Function} cb | [
"Inserts",
"a",
"TOC",
"object",
"into",
"a",
"source"
] | debdf98d7c1035eeec2a25350c5ab2263c2cd89e | https://github.com/eGavr/toc-md/blob/debdf98d7c1035eeec2a25350c5ab2263c2cd89e/lib/index.js#L14-L32 | |
37,178 | jeremyworboys/node-kit | lib/node-kit.js | Kit | function Kit(str, variables, forbiddenPaths) {
this._variables = variables || {};
this._forbiddenPaths = forbiddenPaths || [];
// Import file
if (fs.existsSync(str)) {
this.fileContents = fs.readFileSync(str).toString();
this.filename = path.basename(str);
this._fileDir = path.d... | javascript | function Kit(str, variables, forbiddenPaths) {
this._variables = variables || {};
this._forbiddenPaths = forbiddenPaths || [];
// Import file
if (fs.existsSync(str)) {
this.fileContents = fs.readFileSync(str).toString();
this.filename = path.basename(str);
this._fileDir = path.d... | [
"function",
"Kit",
"(",
"str",
",",
"variables",
",",
"forbiddenPaths",
")",
"{",
"this",
".",
"_variables",
"=",
"variables",
"||",
"{",
"}",
";",
"this",
".",
"_forbiddenPaths",
"=",
"forbiddenPaths",
"||",
"[",
"]",
";",
"// Import file",
"if",
"(",
"... | Create a new Kit object
@param {string} str
@param {Object} variables
@param {Array<string>} forbiddenPaths | [
"Create",
"a",
"new",
"Kit",
"object"
] | 3b26db2aedb218bade1fd32a51f604d8215657f1 | https://github.com/jeremyworboys/node-kit/blob/3b26db2aedb218bade1fd32a51f604d8215657f1/lib/node-kit.js#L28-L50 |
37,179 | maxkfranz/weaver | documentation/js/Markdown.Converter.js | encodeProblemUrlChars | function encodeProblemUrlChars(url) {
if (!url)
return "";
var len = url.length;
return url.replace(_problemUrlChars, function (match, offset) {
if (match == "~D") // escape for dollar
return "%24";
if (ma... | javascript | function encodeProblemUrlChars(url) {
if (!url)
return "";
var len = url.length;
return url.replace(_problemUrlChars, function (match, offset) {
if (match == "~D") // escape for dollar
return "%24";
if (ma... | [
"function",
"encodeProblemUrlChars",
"(",
"url",
")",
"{",
"if",
"(",
"!",
"url",
")",
"return",
"\"\"",
";",
"var",
"len",
"=",
"url",
".",
"length",
";",
"return",
"url",
".",
"replace",
"(",
"_problemUrlChars",
",",
"function",
"(",
"match",
",",
"o... | hex-encodes some unusual "problem" chars in URLs to avoid URL detection problems | [
"hex",
"-",
"encodes",
"some",
"unusual",
"problem",
"chars",
"in",
"URLs",
"to",
"avoid",
"URL",
"detection",
"problems"
] | bac2535114420379005acdfe2dad06331de88496 | https://github.com/maxkfranz/weaver/blob/bac2535114420379005acdfe2dad06331de88496/documentation/js/Markdown.Converter.js#L1291-L1306 |
37,180 | fortunejs/fortune-indexeddb | lib/index.js | reducer | function reducer (type, records) {
return reduce(records, function (hash, record) {
record = outputRecord.call(self, type, msgpack.decode(record))
hash[record[primaryKey]] = record
return hash
}, {})
} | javascript | function reducer (type, records) {
return reduce(records, function (hash, record) {
record = outputRecord.call(self, type, msgpack.decode(record))
hash[record[primaryKey]] = record
return hash
}, {})
} | [
"function",
"reducer",
"(",
"type",
",",
"records",
")",
"{",
"return",
"reduce",
"(",
"records",
",",
"function",
"(",
"hash",
",",
"record",
")",
"{",
"record",
"=",
"outputRecord",
".",
"call",
"(",
"self",
",",
"type",
",",
"msgpack",
".",
"decode"... | Populating memory database with results from IndexedDB. | [
"Populating",
"memory",
"database",
"with",
"results",
"from",
"IndexedDB",
"."
] | d3409a86e6eea88d0fca22b4d4674b1120ad74d9 | https://github.com/fortunejs/fortune-indexeddb/blob/d3409a86e6eea88d0fca22b4d4674b1120ad74d9/lib/index.js#L126-L132 |
37,181 | tobilg/marathon-event-bus-client | examples/example.js | function (name, data) {
console.log("Custom handler for " + name);
// Send information of the "deployment_info" event to an external service (here: Just an echo service)
request("https://echo.getpostman.com/get?name=" + name + "&startTime=" + data.timestamp, function (error, response... | javascript | function (name, data) {
console.log("Custom handler for " + name);
// Send information of the "deployment_info" event to an external service (here: Just an echo service)
request("https://echo.getpostman.com/get?name=" + name + "&startTime=" + data.timestamp, function (error, response... | [
"function",
"(",
"name",
",",
"data",
")",
"{",
"console",
".",
"log",
"(",
"\"Custom handler for \"",
"+",
"name",
")",
";",
"// Send information of the \"deployment_info\" event to an external service (here: Just an echo service)",
"request",
"(",
"\"https://echo.getpostman.c... | Specify the custom event handlers | [
"Specify",
"the",
"custom",
"event",
"handlers"
] | fc9b6851815d365ad2ab140cc47b328571ee9396 | https://github.com/tobilg/marathon-event-bus-client/blob/fc9b6851815d365ad2ab140cc47b328571ee9396/examples/example.js#L26-L38 | |
37,182 | chip-js/fragments-js | src/compile.js | compile | function compile(fragments, template) {
var walker = document.createTreeWalker(template, NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_TEXT);
var bindings = [], currentNode, parentNode, previousNode;
// Reset first node to ensure it isn't a fragment
walker.nextNode();
walker.previousNode();
// find bindings f... | javascript | function compile(fragments, template) {
var walker = document.createTreeWalker(template, NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_TEXT);
var bindings = [], currentNode, parentNode, previousNode;
// Reset first node to ensure it isn't a fragment
walker.nextNode();
walker.previousNode();
// find bindings f... | [
"function",
"compile",
"(",
"fragments",
",",
"template",
")",
"{",
"var",
"walker",
"=",
"document",
".",
"createTreeWalker",
"(",
"template",
",",
"NodeFilter",
".",
"SHOW_ELEMENT",
"|",
"NodeFilter",
".",
"SHOW_TEXT",
")",
";",
"var",
"bindings",
"=",
"["... | Walks the template DOM replacing any bindings and caching bindings onto the template object. | [
"Walks",
"the",
"template",
"DOM",
"replacing",
"any",
"bindings",
"and",
"caching",
"bindings",
"onto",
"the",
"template",
"object",
"."
] | 5d613ea42c3823423efb01fce4ffef80c7f5ce0f | https://github.com/chip-js/fragments-js/blob/5d613ea42c3823423efb01fce4ffef80c7f5ce0f/src/compile.js#L6-L29 |
37,183 | chip-js/fragments-js | src/compile.js | splitTextNode | function splitTextNode(fragments, node) {
if (!node.processed) {
node.processed = true;
var regex = fragments.binders.text._expr;
var content = node.nodeValue;
if (content.match(regex)) {
var match, lastIndex = 0, parts = [], fragment = document.createDocumentFragment();
while ((match = re... | javascript | function splitTextNode(fragments, node) {
if (!node.processed) {
node.processed = true;
var regex = fragments.binders.text._expr;
var content = node.nodeValue;
if (content.match(regex)) {
var match, lastIndex = 0, parts = [], fragment = document.createDocumentFragment();
while ((match = re... | [
"function",
"splitTextNode",
"(",
"fragments",
",",
"node",
")",
"{",
"if",
"(",
"!",
"node",
".",
"processed",
")",
"{",
"node",
".",
"processed",
"=",
"true",
";",
"var",
"regex",
"=",
"fragments",
".",
"binders",
".",
"text",
".",
"_expr",
";",
"v... | Splits text nodes with expressions in them so they can be bound individually, has parentNode passed in since it may be a document fragment which appears as null on node.parentNode. | [
"Splits",
"text",
"nodes",
"with",
"expressions",
"in",
"them",
"so",
"they",
"can",
"be",
"bound",
"individually",
"has",
"parentNode",
"passed",
"in",
"since",
"it",
"may",
"be",
"a",
"document",
"fragment",
"which",
"appears",
"as",
"null",
"on",
"node",
... | 5d613ea42c3823423efb01fce4ffef80c7f5ce0f | https://github.com/chip-js/fragments-js/blob/5d613ea42c3823423efb01fce4ffef80c7f5ce0f/src/compile.js#L137-L161 |
37,184 | utopiaio/Ethiopic-Calendar | index.js | ethCopticToJDN | function ethCopticToJDN(year, month, day, era) {
return (era + 365) + 365 * (year - 1) + Math.floor(year / 4) + 30 * month + day - 31;
} | javascript | function ethCopticToJDN(year, month, day, era) {
return (era + 365) + 365 * (year - 1) + Math.floor(year / 4) + 30 * month + day - 31;
} | [
"function",
"ethCopticToJDN",
"(",
"year",
",",
"month",
",",
"day",
",",
"era",
")",
"{",
"return",
"(",
"era",
"+",
"365",
")",
"+",
"365",
"*",
"(",
"year",
"-",
"1",
")",
"+",
"Math",
".",
"floor",
"(",
"year",
"/",
"4",
")",
"+",
"30",
"... | Computes the Julian day number of the given Coptic or Ethiopic date.
This method assumes that the JDN epoch offset has been set. This method
is called by copticToGregorian and ethiopicToGregorian which will set
the jdn offset context.
@param {Number} year year in the Ethiopic calendar
@param {Number} month month in th... | [
"Computes",
"the",
"Julian",
"day",
"number",
"of",
"the",
"given",
"Coptic",
"or",
"Ethiopic",
"date",
".",
"This",
"method",
"assumes",
"that",
"the",
"JDN",
"epoch",
"offset",
"has",
"been",
"set",
".",
"This",
"method",
"is",
"called",
"by",
"copticToG... | c4e15243fd792f57ecb1a85685ecaf8b4c781ee4 | https://github.com/utopiaio/Ethiopic-Calendar/blob/c4e15243fd792f57ecb1a85685ecaf8b4c781ee4/index.js#L42-L44 |
37,185 | utopiaio/Ethiopic-Calendar | index.js | jdnToGregorian | function jdnToGregorian(jdn, JD_OFFSET = JD_EPOCH_OFFSET_GREGORIAN, leapYear = isGregorianLeap) {
const nMonths = 12;
const monthDays = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
const r2000 = mod((jdn - JD_OFFSET), 730485);
const r400 = mod((jdn - JD_OFFSET), 146097);
const r100 = mod(r400, 36524)... | javascript | function jdnToGregorian(jdn, JD_OFFSET = JD_EPOCH_OFFSET_GREGORIAN, leapYear = isGregorianLeap) {
const nMonths = 12;
const monthDays = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
const r2000 = mod((jdn - JD_OFFSET), 730485);
const r400 = mod((jdn - JD_OFFSET), 146097);
const r100 = mod(r400, 36524)... | [
"function",
"jdnToGregorian",
"(",
"jdn",
",",
"JD_OFFSET",
"=",
"JD_EPOCH_OFFSET_GREGORIAN",
",",
"leapYear",
"=",
"isGregorianLeap",
")",
"{",
"const",
"nMonths",
"=",
"12",
";",
"const",
"monthDays",
"=",
"[",
"0",
",",
"31",
",",
"28",
",",
"31",
",",
... | converts JDN to Gregorian
@param {Number} jdn
@param {Number} JD_OFFSET
@param {Function} leapYear
@return {Number} | [
"converts",
"JDN",
"to",
"Gregorian"
] | c4e15243fd792f57ecb1a85685ecaf8b4c781ee4 | https://github.com/utopiaio/Ethiopic-Calendar/blob/c4e15243fd792f57ecb1a85685ecaf8b4c781ee4/index.js#L54-L94 |
37,186 | utopiaio/Ethiopic-Calendar | index.js | guessEra | function guessEra(jdn, JD_AM = JD_EPOCH_OFFSET_AMETE_MIHRET, JD_AA = JD_EPOCH_OFFSET_AMETE_ALEM) {
return (jdn >= (JD_AM + 365)) ? JD_AM : JD_AA;
} | javascript | function guessEra(jdn, JD_AM = JD_EPOCH_OFFSET_AMETE_MIHRET, JD_AA = JD_EPOCH_OFFSET_AMETE_ALEM) {
return (jdn >= (JD_AM + 365)) ? JD_AM : JD_AA;
} | [
"function",
"guessEra",
"(",
"jdn",
",",
"JD_AM",
"=",
"JD_EPOCH_OFFSET_AMETE_MIHRET",
",",
"JD_AA",
"=",
"JD_EPOCH_OFFSET_AMETE_ALEM",
")",
"{",
"return",
"(",
"jdn",
">=",
"(",
"JD_AM",
"+",
"365",
")",
")",
"?",
"JD_AM",
":",
"JD_AA",
";",
"}"
] | guesses ERA from JDN
@param {Number} jdn
@return {Number} | [
"guesses",
"ERA",
"from",
"JDN"
] | c4e15243fd792f57ecb1a85685ecaf8b4c781ee4 | https://github.com/utopiaio/Ethiopic-Calendar/blob/c4e15243fd792f57ecb1a85685ecaf8b4c781ee4/index.js#L102-L104 |
37,187 | utopiaio/Ethiopic-Calendar | index.js | gregorianToJDN | function gregorianToJDN(year = 1, month = 1, day = 1, JD_OFFSET = JD_EPOCH_OFFSET_GREGORIAN) {
const s = Math.floor(year / 4)
- Math.floor((year - 1) / 4)
- Math.floor(year / 100)
+ Math.floor((year - 1) / 100)
+ Math.floor(year / 400)
- Math.floor((year - 1) / 400);
... | javascript | function gregorianToJDN(year = 1, month = 1, day = 1, JD_OFFSET = JD_EPOCH_OFFSET_GREGORIAN) {
const s = Math.floor(year / 4)
- Math.floor((year - 1) / 4)
- Math.floor(year / 100)
+ Math.floor((year - 1) / 100)
+ Math.floor(year / 400)
- Math.floor((year - 1) / 400);
... | [
"function",
"gregorianToJDN",
"(",
"year",
"=",
"1",
",",
"month",
"=",
"1",
",",
"day",
"=",
"1",
",",
"JD_OFFSET",
"=",
"JD_EPOCH_OFFSET_GREGORIAN",
")",
"{",
"const",
"s",
"=",
"Math",
".",
"floor",
"(",
"year",
"/",
"4",
")",
"-",
"Math",
".",
... | given year, month and day of Gregorian returns JDN
@param {Number} year
@param {Number} month
@param {Number} day
@param {Number} JD_OFFSET
@return {Number} | [
"given",
"year",
"month",
"and",
"day",
"of",
"Gregorian",
"returns",
"JDN"
] | c4e15243fd792f57ecb1a85685ecaf8b4c781ee4 | https://github.com/utopiaio/Ethiopic-Calendar/blob/c4e15243fd792f57ecb1a85685ecaf8b4c781ee4/index.js#L115-L134 |
37,188 | utopiaio/Ethiopic-Calendar | index.js | jdnToEthiopic | function jdnToEthiopic(jdn, era = JD_EPOCH_OFFSET_AMETE_MIHRET) {
const r = mod((jdn - era), 1461);
const n = mod(r, 365) + 365 * Math.floor(r / 1460);
const year = 4 * Math.floor((jdn - era) / 1461) + Math.floor(r / 365) - Math.floor(r / 1460);
const month = Math.floor(n / 30) + 1;
const day = mod(n, 30) + ... | javascript | function jdnToEthiopic(jdn, era = JD_EPOCH_OFFSET_AMETE_MIHRET) {
const r = mod((jdn - era), 1461);
const n = mod(r, 365) + 365 * Math.floor(r / 1460);
const year = 4 * Math.floor((jdn - era) / 1461) + Math.floor(r / 365) - Math.floor(r / 1460);
const month = Math.floor(n / 30) + 1;
const day = mod(n, 30) + ... | [
"function",
"jdnToEthiopic",
"(",
"jdn",
",",
"era",
"=",
"JD_EPOCH_OFFSET_AMETE_MIHRET",
")",
"{",
"const",
"r",
"=",
"mod",
"(",
"(",
"jdn",
"-",
"era",
")",
",",
"1461",
")",
";",
"const",
"n",
"=",
"mod",
"(",
"r",
",",
"365",
")",
"+",
"365",
... | given a JDN and an era returns the Ethiopic equivalent
@param {Number} jdn
@param {Number} era
@return {Object} { year, month, day } | [
"given",
"a",
"JDN",
"and",
"an",
"era",
"returns",
"the",
"Ethiopic",
"equivalent"
] | c4e15243fd792f57ecb1a85685ecaf8b4c781ee4 | https://github.com/utopiaio/Ethiopic-Calendar/blob/c4e15243fd792f57ecb1a85685ecaf8b4c781ee4/index.js#L143-L152 |
37,189 | chip-js/fragments-js | src/fragments.js | Fragments | function Fragments(options) {
if (!options || !options.observations) {
throw new TypeError('Must provide an observations instance to Fragments in options.');
}
this.compiling = false;
this.observations = options.observations;
this.globals = options.observations.globals;
this.formatters = options.observ... | javascript | function Fragments(options) {
if (!options || !options.observations) {
throw new TypeError('Must provide an observations instance to Fragments in options.');
}
this.compiling = false;
this.observations = options.observations;
this.globals = options.observations.globals;
this.formatters = options.observ... | [
"function",
"Fragments",
"(",
"options",
")",
"{",
"if",
"(",
"!",
"options",
"||",
"!",
"options",
".",
"observations",
")",
"{",
"throw",
"new",
"TypeError",
"(",
"'Must provide an observations instance to Fragments in options.'",
")",
";",
"}",
"this",
".",
"... | A Fragments object serves as a registry for binders and formatters
@param {Observations} observations An instance of Observations for tracking changes to the data | [
"A",
"Fragments",
"object",
"serves",
"as",
"a",
"registry",
"for",
"binders",
"and",
"formatters"
] | 5d613ea42c3823423efb01fce4ffef80c7f5ce0f | https://github.com/chip-js/fragments-js/blob/5d613ea42c3823423efb01fce4ffef80c7f5ce0f/src/fragments.js#L18-L66 |
37,190 | chip-js/fragments-js | src/fragments.js | function(html) {
if (!html) {
throw new TypeError('Invalid html, cannot create a template from: ' + html);
}
var fragment = toFragment(html);
if (fragment.childNodes.length === 0) {
throw new Error('Cannot create a template from ' + html + ' because it is empty.');
}
var template = T... | javascript | function(html) {
if (!html) {
throw new TypeError('Invalid html, cannot create a template from: ' + html);
}
var fragment = toFragment(html);
if (fragment.childNodes.length === 0) {
throw new Error('Cannot create a template from ' + html + ' because it is empty.');
}
var template = T... | [
"function",
"(",
"html",
")",
"{",
"if",
"(",
"!",
"html",
")",
"{",
"throw",
"new",
"TypeError",
"(",
"'Invalid html, cannot create a template from: '",
"+",
"html",
")",
";",
"}",
"var",
"fragment",
"=",
"toFragment",
"(",
"html",
")",
";",
"if",
"(",
... | Takes an HTML string, an element, an array of elements, or a document fragment, and compiles it into a template.
Instances may then be created and bound to a given context.
@param {String|NodeList|HTMLCollection|HTMLTemplateElement|HTMLScriptElement|Node} html A Template can be created
from many different types of obje... | [
"Takes",
"an",
"HTML",
"string",
"an",
"element",
"an",
"array",
"of",
"elements",
"or",
"a",
"document",
"fragment",
"and",
"compiles",
"it",
"into",
"a",
"template",
".",
"Instances",
"may",
"then",
"be",
"created",
"and",
"bound",
"to",
"a",
"given",
... | 5d613ea42c3823423efb01fce4ffef80c7f5ce0f | https://github.com/chip-js/fragments-js/blob/5d613ea42c3823423efb01fce4ffef80c7f5ce0f/src/fragments.js#L85-L96 | |
37,191 | chip-js/fragments-js | src/fragments.js | function(template) {
if (template && !template.compiled) {
// Set compiling flag on fragments, but don't turn it false until the outermost template is done
var lastCompilingValue = this.compiling;
this.compiling = true;
// Set this before compiling so we don't get into infinite loops if ther... | javascript | function(template) {
if (template && !template.compiled) {
// Set compiling flag on fragments, but don't turn it false until the outermost template is done
var lastCompilingValue = this.compiling;
this.compiling = true;
// Set this before compiling so we don't get into infinite loops if ther... | [
"function",
"(",
"template",
")",
"{",
"if",
"(",
"template",
"&&",
"!",
"template",
".",
"compiled",
")",
"{",
"// Set compiling flag on fragments, but don't turn it false until the outermost template is done",
"var",
"lastCompilingValue",
"=",
"this",
".",
"compiling",
... | Takes a template instance and pre-compiles it
@param {Template} template A template
@return {Template} The template | [
"Takes",
"a",
"template",
"instance",
"and",
"pre",
"-",
"compiles",
"it"
] | 5d613ea42c3823423efb01fce4ffef80c7f5ce0f | https://github.com/chip-js/fragments-js/blob/5d613ea42c3823423efb01fce4ffef80c7f5ce0f/src/fragments.js#L104-L115 | |
37,192 | chip-js/fragments-js | src/fragments.js | function(element) {
if (!element.bindings) {
element.bindings = compile(this, element);
View.makeInstanceOf(element);
}
return element;
} | javascript | function(element) {
if (!element.bindings) {
element.bindings = compile(this, element);
View.makeInstanceOf(element);
}
return element;
} | [
"function",
"(",
"element",
")",
"{",
"if",
"(",
"!",
"element",
".",
"bindings",
")",
"{",
"element",
".",
"bindings",
"=",
"compile",
"(",
"this",
",",
"element",
")",
";",
"View",
".",
"makeInstanceOf",
"(",
"element",
")",
";",
"}",
"return",
"el... | Compiles bindings on an element. | [
"Compiles",
"bindings",
"on",
"an",
"element",
"."
] | 5d613ea42c3823423efb01fce4ffef80c7f5ce0f | https://github.com/chip-js/fragments-js/blob/5d613ea42c3823423efb01fce4ffef80c7f5ce0f/src/fragments.js#L121-L128 | |
37,193 | chip-js/fragments-js | src/fragments.js | function(context, expr, callback, callbackContext) {
if (typeof context === 'string') {
callbackContext = callback;
callback = expr;
expr = context;
context = null;
}
var observer = this.observations.createObserver(expr, callback, callbackContext);
if (context) {
observer.b... | javascript | function(context, expr, callback, callbackContext) {
if (typeof context === 'string') {
callbackContext = callback;
callback = expr;
expr = context;
context = null;
}
var observer = this.observations.createObserver(expr, callback, callbackContext);
if (context) {
observer.b... | [
"function",
"(",
"context",
",",
"expr",
",",
"callback",
",",
"callbackContext",
")",
"{",
"if",
"(",
"typeof",
"context",
"===",
"'string'",
")",
"{",
"callbackContext",
"=",
"callback",
";",
"callback",
"=",
"expr",
";",
"expr",
"=",
"context",
";",
"... | Observes an expression within a given context, calling the callback when it changes and returning the observer. | [
"Observes",
"an",
"expression",
"within",
"a",
"given",
"context",
"calling",
"the",
"callback",
"when",
"it",
"changes",
"and",
"returning",
"the",
"observer",
"."
] | 5d613ea42c3823423efb01fce4ffef80c7f5ce0f | https://github.com/chip-js/fragments-js/blob/5d613ea42c3823423efb01fce4ffef80c7f5ce0f/src/fragments.js#L149-L161 | |
37,194 | koggdal/matrixmath | Matrix.js | removeColumn | function removeColumn(values, col, colsPerRow) {
var n = 0;
for (var i = 0, l = values.length; i < l; i++) {
if (i % colsPerRow !== col) values[n++] = values[i];
}
values.length = n;
} | javascript | function removeColumn(values, col, colsPerRow) {
var n = 0;
for (var i = 0, l = values.length; i < l; i++) {
if (i % colsPerRow !== col) values[n++] = values[i];
}
values.length = n;
} | [
"function",
"removeColumn",
"(",
"values",
",",
"col",
",",
"colsPerRow",
")",
"{",
"var",
"n",
"=",
"0",
";",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"l",
"=",
"values",
".",
"length",
";",
"i",
"<",
"l",
";",
"i",
"++",
")",
"{",
"if",
"(",
... | Remove a column from the values array.
@param {Array} values Array of values.
@param {number} col Index of the column.
@param {number} colsPerRow Number of columns per row.
@private | [
"Remove",
"a",
"column",
"from",
"the",
"values",
"array",
"."
] | 4bbc721be90149964bc80221f3afccc1c5f91953 | https://github.com/koggdal/matrixmath/blob/4bbc721be90149964bc80221f3afccc1c5f91953/Matrix.js#L839-L845 |
37,195 | koggdal/matrixmath | Matrix.js | toArray | function toArray(matrix, array) {
for (var i = 0, l = matrix.length; i < l; i++) {
array[i] = matrix[i];
}
return array;
} | javascript | function toArray(matrix, array) {
for (var i = 0, l = matrix.length; i < l; i++) {
array[i] = matrix[i];
}
return array;
} | [
"function",
"toArray",
"(",
"matrix",
",",
"array",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"l",
"=",
"matrix",
".",
"length",
";",
"i",
"<",
"l",
";",
"i",
"++",
")",
"{",
"array",
"[",
"i",
"]",
"=",
"matrix",
"[",
"i",
"]",
";",... | Convert a matrix to an array with the values.
@param {Matrix} matrix The matrix instance.
@param {Array} array The array to use.
@return {Array} The array.
@private | [
"Convert",
"a",
"matrix",
"to",
"an",
"array",
"with",
"the",
"values",
"."
] | 4bbc721be90149964bc80221f3afccc1c5f91953 | https://github.com/koggdal/matrixmath/blob/4bbc721be90149964bc80221f3afccc1c5f91953/Matrix.js#L857-L863 |
37,196 | koggdal/matrixmath | Matrix.js | getData | function getData(matrix, array) {
toArray(matrix, array);
array.rows = matrix.rows;
array.cols = matrix.cols;
return array;
} | javascript | function getData(matrix, array) {
toArray(matrix, array);
array.rows = matrix.rows;
array.cols = matrix.cols;
return array;
} | [
"function",
"getData",
"(",
"matrix",
",",
"array",
")",
"{",
"toArray",
"(",
"matrix",
",",
"array",
")",
";",
"array",
".",
"rows",
"=",
"matrix",
".",
"rows",
";",
"array",
".",
"cols",
"=",
"matrix",
".",
"cols",
";",
"return",
"array",
";",
"}... | Get the matrix data as an array with properties for rows and cols.
@param {Matrix} matrix The matrix instance.
@param {Array} array The array to use.
@return {Array} The array.
@private | [
"Get",
"the",
"matrix",
"data",
"as",
"an",
"array",
"with",
"properties",
"for",
"rows",
"and",
"cols",
"."
] | 4bbc721be90149964bc80221f3afccc1c5f91953 | https://github.com/koggdal/matrixmath/blob/4bbc721be90149964bc80221f3afccc1c5f91953/Matrix.js#L875-L882 |
37,197 | tadam313/sheet-db | src/api/v3/index.js | getOperation | function getOperation(opType) {
var opname = Object.keys(APISPEC.operations)
.filter(function(operation) {
return operation === opType;
});
if (!opname.length) {
throw new ReferenceError('Operation is not supported');
}
// avoid mutation
return util._extend({}, ... | javascript | function getOperation(opType) {
var opname = Object.keys(APISPEC.operations)
.filter(function(operation) {
return operation === opType;
});
if (!opname.length) {
throw new ReferenceError('Operation is not supported');
}
// avoid mutation
return util._extend({}, ... | [
"function",
"getOperation",
"(",
"opType",
")",
"{",
"var",
"opname",
"=",
"Object",
".",
"keys",
"(",
"APISPEC",
".",
"operations",
")",
".",
"filter",
"(",
"function",
"(",
"operation",
")",
"{",
"return",
"operation",
"===",
"opType",
";",
"}",
")",
... | Retrieves te operation description
@param opType
@returns {*} | [
"Retrieves",
"te",
"operation",
"description"
] | 2ca1b85b8a6086a327d65b98b68b543fade84848 | https://github.com/tadam313/sheet-db/blob/2ca1b85b8a6086a327d65b98b68b543fade84848/src/api/v3/index.js#L76-L88 |
37,198 | tadam313/sheet-db | src/api/v3/index.js | getOperationContext | function getOperationContext(opType, options) {
var operation = getOperation(opType);
options = options || {};
options.visibility = !options.token ? 'public' : 'private';
options.apiRoot = APISPEC.root;
operation.headers = operation.headers || {};
operation.headers['GData-Version'] = Number(A... | javascript | function getOperationContext(opType, options) {
var operation = getOperation(opType);
options = options || {};
options.visibility = !options.token ? 'public' : 'private';
options.apiRoot = APISPEC.root;
operation.headers = operation.headers || {};
operation.headers['GData-Version'] = Number(A... | [
"function",
"getOperationContext",
"(",
"opType",
",",
"options",
")",
"{",
"var",
"operation",
"=",
"getOperation",
"(",
"opType",
")",
";",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"options",
".",
"visibility",
"=",
"!",
"options",
".",
"token",
... | Retrieves the operation context for the given type
@param opType
@param options
@returns {*} | [
"Retrieves",
"the",
"operation",
"context",
"for",
"the",
"given",
"type"
] | 2ca1b85b8a6086a327d65b98b68b543fade84848 | https://github.com/tadam313/sheet-db/blob/2ca1b85b8a6086a327d65b98b68b543fade84848/src/api/v3/index.js#L97-L119 |
37,199 | mikolalysenko/clean-pslg | clean-pslg.js | boundRat | function boundRat (r) {
var f = ratToFloat(r)
return [
nextafter(f, -Infinity),
nextafter(f, Infinity)
]
} | javascript | function boundRat (r) {
var f = ratToFloat(r)
return [
nextafter(f, -Infinity),
nextafter(f, Infinity)
]
} | [
"function",
"boundRat",
"(",
"r",
")",
"{",
"var",
"f",
"=",
"ratToFloat",
"(",
"r",
")",
"return",
"[",
"nextafter",
"(",
"f",
",",
"-",
"Infinity",
")",
",",
"nextafter",
"(",
"f",
",",
"Infinity",
")",
"]",
"}"
] | Bounds on a rational number when rounded to a float | [
"Bounds",
"on",
"a",
"rational",
"number",
"when",
"rounded",
"to",
"a",
"float"
] | c20e801e036bf2c8ebca6ea6c6631aa64fc334c7 | https://github.com/mikolalysenko/clean-pslg/blob/c20e801e036bf2c8ebca6ea6c6631aa64fc334c7/clean-pslg.js#L17-L23 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.