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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
47,100 | gwtw/js-binomial-heap | index.js | mergeHeaps | function mergeHeaps(a, b) {
if (typeof a.head === 'undefined') {
return b.head;
}
if (typeof b.head === 'undefined') {
return a.head;
}
var head;
var aNext = a.head;
var bNext = b.head;
if (a.head.degree <= b.head.degree) {
head = a.head;
aNext = aNext.sibling;
} else {
head = b.... | javascript | function mergeHeaps(a, b) {
if (typeof a.head === 'undefined') {
return b.head;
}
if (typeof b.head === 'undefined') {
return a.head;
}
var head;
var aNext = a.head;
var bNext = b.head;
if (a.head.degree <= b.head.degree) {
head = a.head;
aNext = aNext.sibling;
} else {
head = b.... | [
"function",
"mergeHeaps",
"(",
"a",
",",
"b",
")",
"{",
"if",
"(",
"typeof",
"a",
".",
"head",
"===",
"'undefined'",
")",
"{",
"return",
"b",
".",
"head",
";",
"}",
"if",
"(",
"typeof",
"b",
".",
"head",
"===",
"'undefined'",
")",
"{",
"return",
... | Merges two heaps together.
@private
@param {Node} a The head of the first heap to merge.
@param {Node} b The head of the second heap to merge.
@return {Node} The head of the merged heap. | [
"Merges",
"two",
"heaps",
"together",
"."
] | 75af9ee02d0089fdbaa54a2c5aa0bc6eb1d059b3 | https://github.com/gwtw/js-binomial-heap/blob/75af9ee02d0089fdbaa54a2c5aa0bc6eb1d059b3/index.js#L184-L221 |
47,101 | gwtw/js-binomial-heap | index.js | Node | function Node(key, value) {
this.key = key;
this.value = value;
this.degree = 0;
this.parent = undefined;
this.child = undefined;
this.sibling = undefined;
} | javascript | function Node(key, value) {
this.key = key;
this.value = value;
this.degree = 0;
this.parent = undefined;
this.child = undefined;
this.sibling = undefined;
} | [
"function",
"Node",
"(",
"key",
",",
"value",
")",
"{",
"this",
".",
"key",
"=",
"key",
";",
"this",
".",
"value",
"=",
"value",
";",
"this",
".",
"degree",
"=",
"0",
";",
"this",
".",
"parent",
"=",
"undefined",
";",
"this",
".",
"child",
"=",
... | Creates a Binomial Heap node.
@constructor
@param {Object} key The key of the new node.
@param {Object} value The value of the new node. | [
"Creates",
"a",
"Binomial",
"Heap",
"node",
"."
] | 75af9ee02d0089fdbaa54a2c5aa0bc6eb1d059b3 | https://github.com/gwtw/js-binomial-heap/blob/75af9ee02d0089fdbaa54a2c5aa0bc6eb1d059b3/index.js#L275-L282 |
47,102 | petarov/translitbg.js | src/translitbg.js | function() {
var result = new StringBuffer();
var array = this._input.split('');
// var prev = null;
for (var i = 0; i < array.length; i++) {
var cur = array[i];
var next = array[i + 1];
if (typeof next !== 'undefined') {
var curToken = cur + next;
... | javascript | function() {
var result = new StringBuffer();
var array = this._input.split('');
// var prev = null;
for (var i = 0; i < array.length; i++) {
var cur = array[i];
var next = array[i + 1];
if (typeof next !== 'undefined') {
var curToken = cur + next;
... | [
"function",
"(",
")",
"{",
"var",
"result",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"var",
"array",
"=",
"this",
".",
"_input",
".",
"split",
"(",
"''",
")",
";",
"// var prev = null;\r",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"array",... | Transforms Cyrillic to Latin characters.
@return {string} Transliterated text | [
"Transforms",
"Cyrillic",
"to",
"Latin",
"characters",
"."
] | 003e81703efd098ae0ea4bb711d1e70c9aa989db | https://github.com/petarov/translitbg.js/blob/003e81703efd098ae0ea4bb711d1e70c9aa989db/src/translitbg.js#L153-L185 | |
47,103 | toddself/jsondom | index.js | _regExpOrGTFO | function _regExpOrGTFO(expr){
var exp;
if(typeof expr === 'string'){
exp = new RegExp('^'+expr+'$');
} else if (expr instanceof RegExp){
exp = expr;
} else {
throw new Error('Needle must be either a string or a RegExp');
}
return exp;
} | javascript | function _regExpOrGTFO(expr){
var exp;
if(typeof expr === 'string'){
exp = new RegExp('^'+expr+'$');
} else if (expr instanceof RegExp){
exp = expr;
} else {
throw new Error('Needle must be either a string or a RegExp');
}
return exp;
} | [
"function",
"_regExpOrGTFO",
"(",
"expr",
")",
"{",
"var",
"exp",
";",
"if",
"(",
"typeof",
"expr",
"===",
"'string'",
")",
"{",
"exp",
"=",
"new",
"RegExp",
"(",
"'^'",
"+",
"expr",
"+",
"'$'",
")",
";",
"}",
"else",
"if",
"(",
"expr",
"instanceof... | Cohearses `expr` into a RegExp or throws an error if it can't
@private
@param {Mixed} expr RegExp or string.
@return {Object} Strict Regular Expression version of string | [
"Cohearses",
"expr",
"into",
"a",
"RegExp",
"or",
"throws",
"an",
"error",
"if",
"it",
"can",
"t"
] | d71d3ce355ab9a925bdf7a4754642e45c9678282 | https://github.com/toddself/jsondom/blob/d71d3ce355ab9a925bdf7a4754642e45c9678282/index.js#L33-L45 |
47,104 | 3rd-Eden/shrinkwrap | index.js | Shrinkwrap | function Shrinkwrap(options) {
this.fuse();
options = options || {};
options.registry = 'registry' in options
? options.registry
: 'http://registry.nodejitsu.com/';
options.production = 'production' in options
? options.production
: process.NODE_ENV === 'production';
options.optimize = 'op... | javascript | function Shrinkwrap(options) {
this.fuse();
options = options || {};
options.registry = 'registry' in options
? options.registry
: 'http://registry.nodejitsu.com/';
options.production = 'production' in options
? options.production
: process.NODE_ENV === 'production';
options.optimize = 'op... | [
"function",
"Shrinkwrap",
"(",
"options",
")",
"{",
"this",
".",
"fuse",
"(",
")",
";",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"options",
".",
"registry",
"=",
"'registry'",
"in",
"options",
"?",
"options",
".",
"registry",
":",
"'http://registr... | Generate a new Shrinkwrap from a given package or module.
Options:
- registry: URL of the npm registry we should use to read package information.
- production: Should we only include production packages.
- limit: Amount of parallel processing tasks we could use to retrieve data.
- optimize: Should we attempt to optim... | [
"Generate",
"a",
"new",
"Shrinkwrap",
"from",
"a",
"given",
"package",
"or",
"module",
"."
] | 60e0004e4092896e9ba6bd0d83bdc22a973812da | https://github.com/3rd-Eden/shrinkwrap/blob/60e0004e4092896e9ba6bd0d83bdc22a973812da/index.js#L43-L79 |
47,105 | 3rd-Eden/shrinkwrap | index.js | queue | function queue(packages, ref, depth) {
packages = shrinkwrap.dedupe(packages);
Shrinkwrap.dependencies.forEach(function each(key) {
if (this.production && 'devDependencies' === key) return;
if ('object' !== this.type(packages[key])) return;
Object.keys(packages[key]).forEach(function each(na... | javascript | function queue(packages, ref, depth) {
packages = shrinkwrap.dedupe(packages);
Shrinkwrap.dependencies.forEach(function each(key) {
if (this.production && 'devDependencies' === key) return;
if ('object' !== this.type(packages[key])) return;
Object.keys(packages[key]).forEach(function each(na... | [
"function",
"queue",
"(",
"packages",
",",
"ref",
",",
"depth",
")",
"{",
"packages",
"=",
"shrinkwrap",
".",
"dedupe",
"(",
"packages",
")",
";",
"Shrinkwrap",
".",
"dependencies",
".",
"forEach",
"(",
"function",
"each",
"(",
"key",
")",
"{",
"if",
"... | Scan the given package.json like structure for possible dependency
locations which will be automatically queued for fetching and processing.
@param {Object} packages The packages.json body.
@param {Object} ref The location of the new packages in the tree.
@param {Number} depth How deep was this package nested
@api pri... | [
"Scan",
"the",
"given",
"package",
".",
"json",
"like",
"structure",
"for",
"possible",
"dependency",
"locations",
"which",
"will",
"be",
"automatically",
"queued",
"for",
"fetching",
"and",
"processing",
"."
] | 60e0004e4092896e9ba6bd0d83bdc22a973812da | https://github.com/3rd-Eden/shrinkwrap/blob/60e0004e4092896e9ba6bd0d83bdc22a973812da/index.js#L139-L162 |
47,106 | 3rd-Eden/shrinkwrap | index.js | parent | function parent(dependent) {
var node = dependent
, result = [];
while (node.parent) {
if (!available(node.parent)) break;
result.push(node.parent);
node = node.parent;
}
return result;
} | javascript | function parent(dependent) {
var node = dependent
, result = [];
while (node.parent) {
if (!available(node.parent)) break;
result.push(node.parent);
node = node.parent;
}
return result;
} | [
"function",
"parent",
"(",
"dependent",
")",
"{",
"var",
"node",
"=",
"dependent",
",",
"result",
"=",
"[",
"]",
";",
"while",
"(",
"node",
".",
"parent",
")",
"{",
"if",
"(",
"!",
"available",
"(",
"node",
".",
"parent",
")",
")",
"break",
";",
... | Find suitable parent nodes which can hold this module without creating
a possible conflict because there two different versions of the module in
the dependency tree.
@param {Object} dependent A dependent of a module.
@returns {Array} parents.
@api private | [
"Find",
"suitable",
"parent",
"nodes",
"which",
"can",
"hold",
"this",
"module",
"without",
"creating",
"a",
"possible",
"conflict",
"because",
"there",
"two",
"different",
"versions",
"of",
"the",
"module",
"in",
"the",
"dependency",
"tree",
"."
] | 60e0004e4092896e9ba6bd0d83bdc22a973812da | https://github.com/3rd-Eden/shrinkwrap/blob/60e0004e4092896e9ba6bd0d83bdc22a973812da/index.js#L384-L396 |
47,107 | 3rd-Eden/shrinkwrap | index.js | available | function available(dependencies) {
if (!dependencies) return false;
return Object.keys(dependencies).every(function every(key) {
var dependency = dependencies[key];
if (!dependency) return false;
if (dependency.name !== name) return true;
if (dependency.version === version) return tru... | javascript | function available(dependencies) {
if (!dependencies) return false;
return Object.keys(dependencies).every(function every(key) {
var dependency = dependencies[key];
if (!dependency) return false;
if (dependency.name !== name) return true;
if (dependency.version === version) return tru... | [
"function",
"available",
"(",
"dependencies",
")",
"{",
"if",
"(",
"!",
"dependencies",
")",
"return",
"false",
";",
"return",
"Object",
".",
"keys",
"(",
"dependencies",
")",
".",
"every",
"(",
"function",
"every",
"(",
"key",
")",
"{",
"var",
"dependen... | Checks if the dependency tree does not already contain a different version
of this module.
@param {Object} dependencies The dependencies of a module.
@returns {Boolean} Available as module location.
@api private | [
"Checks",
"if",
"the",
"dependency",
"tree",
"does",
"not",
"already",
"contain",
"a",
"different",
"version",
"of",
"this",
"module",
"."
] | 60e0004e4092896e9ba6bd0d83bdc22a973812da | https://github.com/3rd-Eden/shrinkwrap/blob/60e0004e4092896e9ba6bd0d83bdc22a973812da/index.js#L406-L419 |
47,108 | oscmejia/libs | lib/libs/string.js | randomString | function randomString(_string_length, _mode) {
var string_length = _string_length;
if(string_length < 3)
string_length = 2;
var chars = chars_all;
if(_mode === 'lower_case') chars = chars_lower;
else if(_mode === 'upper_case') chars = chars_upper;
else if(_mode === 'nums_oly'... | javascript | function randomString(_string_length, _mode) {
var string_length = _string_length;
if(string_length < 3)
string_length = 2;
var chars = chars_all;
if(_mode === 'lower_case') chars = chars_lower;
else if(_mode === 'upper_case') chars = chars_upper;
else if(_mode === 'nums_oly'... | [
"function",
"randomString",
"(",
"_string_length",
",",
"_mode",
")",
"{",
"var",
"string_length",
"=",
"_string_length",
";",
"if",
"(",
"string_length",
"<",
"3",
")",
"string_length",
"=",
"2",
";",
"var",
"chars",
"=",
"chars_all",
";",
"if",
"(",
"_mo... | Generates a random string of the provided length, and including only
the required characters.
@param {int} _string_length
@param {String} _mode
@api public | [
"Generates",
"a",
"random",
"string",
"of",
"the",
"provided",
"length",
"and",
"including",
"only",
"the",
"required",
"characters",
"."
] | 81f8654af6ee922963e6cc3f6cda96ffa75142cf | https://github.com/oscmejia/libs/blob/81f8654af6ee922963e6cc3f6cda96ffa75142cf/lib/libs/string.js#L15-L35 |
47,109 | oscmejia/libs | lib/libs/string.js | randomKey | function randomKey(_numOfBlocks, _blockLength, _mode, _timestamp) {
var numOfBlocks = _numOfBlocks;
var blockLength = _blockLength;
if(numOfBlocks === undefined || numOfBlocks < 3) numOfBlocks = 2;
if(blockLength === undefined || blockLength < 3) blockLength = 2;
var key = "";
for (var ... | javascript | function randomKey(_numOfBlocks, _blockLength, _mode, _timestamp) {
var numOfBlocks = _numOfBlocks;
var blockLength = _blockLength;
if(numOfBlocks === undefined || numOfBlocks < 3) numOfBlocks = 2;
if(blockLength === undefined || blockLength < 3) blockLength = 2;
var key = "";
for (var ... | [
"function",
"randomKey",
"(",
"_numOfBlocks",
",",
"_blockLength",
",",
"_mode",
",",
"_timestamp",
")",
"{",
"var",
"numOfBlocks",
"=",
"_numOfBlocks",
";",
"var",
"blockLength",
"=",
"_blockLength",
";",
"if",
"(",
"numOfBlocks",
"===",
"undefined",
"||",
"n... | Generates a random key of the provided length, and including only
the required characters.
A key is separated by `-`.
Also has the option to timestamp the resulting string at the begining.
@param {int} _numOfBlocks
@param {int} _blockLength
@param {String} _mode
@param {Boolean} _timestamp
@api public | [
"Generates",
"a",
"random",
"key",
"of",
"the",
"provided",
"length",
"and",
"including",
"only",
"the",
"required",
"characters",
".",
"A",
"key",
"is",
"separated",
"by",
"-",
".",
"Also",
"has",
"the",
"option",
"to",
"timestamp",
"the",
"resulting",
"s... | 81f8654af6ee922963e6cc3f6cda96ffa75142cf | https://github.com/oscmejia/libs/blob/81f8654af6ee922963e6cc3f6cda96ffa75142cf/lib/libs/string.js#L50-L70 |
47,110 | jiridudekusy/uu5-to-markdown | src/converters/md2uu5/section.js | section | function section(state, startLine, endLine, silent) {
var ch,
level,
tmp,
pos = state.bMarks[startLine] + state.tShift[startLine],
max = state.eMarks[startLine];
if (pos >= max) {
return false;
}
ch = state.src.charCodeAt(pos);
if (ch !== 0x23 /* # */ || pos >= max) {
return false;
... | javascript | function section(state, startLine, endLine, silent) {
var ch,
level,
tmp,
pos = state.bMarks[startLine] + state.tShift[startLine],
max = state.eMarks[startLine];
if (pos >= max) {
return false;
}
ch = state.src.charCodeAt(pos);
if (ch !== 0x23 /* # */ || pos >= max) {
return false;
... | [
"function",
"section",
"(",
"state",
",",
"startLine",
",",
"endLine",
",",
"silent",
")",
"{",
"var",
"ch",
",",
"level",
",",
"tmp",
",",
"pos",
"=",
"state",
".",
"bMarks",
"[",
"startLine",
"]",
"+",
"state",
".",
"tShift",
"[",
"startLine",
"]",... | Block parser for UU5.Bricks.Section .
The section is defined similar to the header:
# {section} Section title
...section content...
{section}
@param state
@param startLine
@param endLine
@param silent
@returns {boolean} | [
"Block",
"parser",
"for",
"UU5",
".",
"Bricks",
".",
"Section",
"."
] | 559163aa8a4184e1a94888c4fc6d4302acbd857d | https://github.com/jiridudekusy/uu5-to-markdown/blob/559163aa8a4184e1a94888c4fc6d4302acbd857d/src/converters/md2uu5/section.js#L20-L121 |
47,111 | Heymdall/cron-to-text | src/cron-to-text.js | numberToDateName | function numberToDateName(value, type) {
if (type == 'dow') {
return locale.DOW[value - 1];
} else if (type == 'mon') {
return locale.MONTH[value - 1];
}
} | javascript | function numberToDateName(value, type) {
if (type == 'dow') {
return locale.DOW[value - 1];
} else if (type == 'mon') {
return locale.MONTH[value - 1];
}
} | [
"function",
"numberToDateName",
"(",
"value",
",",
"type",
")",
"{",
"if",
"(",
"type",
"==",
"'dow'",
")",
"{",
"return",
"locale",
".",
"DOW",
"[",
"value",
"-",
"1",
"]",
";",
"}",
"else",
"if",
"(",
"type",
"==",
"'mon'",
")",
"{",
"return",
... | Parse a number into day of week, or a month name;
used in dateList below.
@param {Number|String} value
@param {String} type
@returns {String} | [
"Parse",
"a",
"number",
"into",
"day",
"of",
"week",
"or",
"a",
"month",
"name",
";",
"used",
"in",
"dateList",
"below",
"."
] | a6a0ae74a4b98bb951a4ae0fa68778a3c7ab9978 | https://github.com/Heymdall/cron-to-text/blob/a6a0ae74a4b98bb951a4ae0fa68778a3c7ab9978/src/cron-to-text.js#L108-L114 |
47,112 | VisionistInc/jibe | public/js/share-codemirror-json.js | applyToShareJS | function applyToShareJS(cm, change) {
// CodeMirror changes give a text replacement.
var startPos = 0; // Get character position from # of chars in each line.
var i = 0; // i goes through all lines.
while (i < change.from.line) {
startPos += cm.lineInfo(i).text.length + 1; ... | javascript | function applyToShareJS(cm, change) {
// CodeMirror changes give a text replacement.
var startPos = 0; // Get character position from # of chars in each line.
var i = 0; // i goes through all lines.
while (i < change.from.line) {
startPos += cm.lineInfo(i).text.length + 1; ... | [
"function",
"applyToShareJS",
"(",
"cm",
",",
"change",
")",
"{",
"// CodeMirror changes give a text replacement.",
"var",
"startPos",
"=",
"0",
";",
"// Get character position from # of chars in each line.",
"var",
"i",
"=",
"0",
";",
"// i goes through all lines.",
"while... | Convert a CodeMirror change into an op understood by share.js | [
"Convert",
"a",
"CodeMirror",
"change",
"into",
"an",
"op",
"understood",
"by",
"share",
".",
"js"
] | 3a154c0d86a3bcf8980c5104daec099ec738a4e0 | https://github.com/VisionistInc/jibe/blob/3a154c0d86a3bcf8980c5104daec099ec738a4e0/public/js/share-codemirror-json.js#L101-L236 |
47,113 | quorrajs/Positron | lib/foundation/start.js | start | function start(CB, env) {
var app = this;
/*
|--------------------------------------------------------------------------
| Register The Environment Variables
|--------------------------------------------------------------------------
|
| Here we will register all of the ENV variables ... | javascript | function start(CB, env) {
var app = this;
/*
|--------------------------------------------------------------------------
| Register The Environment Variables
|--------------------------------------------------------------------------
|
| Here we will register all of the ENV variables ... | [
"function",
"start",
"(",
"CB",
",",
"env",
")",
"{",
"var",
"app",
"=",
"this",
";",
"/*\n |--------------------------------------------------------------------------\n | Register The Environment Variables\n |--------------------------------------------------------------------... | Application.prototype.start
@param CB
@param env | [
"Application",
".",
"prototype",
".",
"start"
] | a4bad5a5f581743d1885405c11ae26600fb957af | https://github.com/quorrajs/Positron/blob/a4bad5a5f581743d1885405c11ae26600fb957af/lib/foundation/start.js#L22-L152 |
47,114 | edloidas/roll-parser | src/complex/parse.js | parse | function parse( roll ) {
const result = parseAny( roll );
const type = result ? result.type : '';
switch ( type ) {
case Type.simple:
return mapToRoll( result );
case Type.classic:
return mapToRoll( result );
case Type.wod:
return mapToWodRoll( result );
default:
return nu... | javascript | function parse( roll ) {
const result = parseAny( roll );
const type = result ? result.type : '';
switch ( type ) {
case Type.simple:
return mapToRoll( result );
case Type.classic:
return mapToRoll( result );
case Type.wod:
return mapToWodRoll( result );
default:
return nu... | [
"function",
"parse",
"(",
"roll",
")",
"{",
"const",
"result",
"=",
"parseAny",
"(",
"roll",
")",
";",
"const",
"type",
"=",
"result",
"?",
"result",
".",
"type",
":",
"''",
";",
"switch",
"(",
"type",
")",
"{",
"case",
"Type",
".",
"simple",
":",
... | Parses simplified, classic or WoD roll notation.
@func
@since v2.0.0
@param {String} roll
@return {Roll|WodRoll|null}
@see parseSimpleRoll
@see parseClassicRoll
@see parseWodRoll
@example
parse('2 10 -1'); //=> { dice: 10, count: 2, modifier: -1 }
parse('2d10+1'); //=> { dice: 10, count: 2, modifier: 1 }
parse('4... | [
"Parses",
"simplified",
"classic",
"or",
"WoD",
"roll",
"notation",
"."
] | 38912b298edb0a4d67ba1c796d7ac159ebaf7901 | https://github.com/edloidas/roll-parser/blob/38912b298edb0a4d67ba1c796d7ac159ebaf7901/src/complex/parse.js#L21-L35 |
47,115 | IonicaBizau/git-status | lib/index.js | gitStatus | function gitStatus (options, cb) {
if (typeof options === "function") {
cb = options;
options = {};
}
spawno("git", ["status", "--porcelain", "-z"], options, (err, stdout, stderr) => {
if (err || stderr) { return cb(err || stderr, stdout); }
cb(null, parse(stdout));
});
... | javascript | function gitStatus (options, cb) {
if (typeof options === "function") {
cb = options;
options = {};
}
spawno("git", ["status", "--porcelain", "-z"], options, (err, stdout, stderr) => {
if (err || stderr) { return cb(err || stderr, stdout); }
cb(null, parse(stdout));
});
... | [
"function",
"gitStatus",
"(",
"options",
",",
"cb",
")",
"{",
"if",
"(",
"typeof",
"options",
"===",
"\"function\"",
")",
"{",
"cb",
"=",
"options",
";",
"options",
"=",
"{",
"}",
";",
"}",
"spawno",
"(",
"\"git\"",
",",
"[",
"\"status\"",
",",
"\"--... | gitStatus
A git-status wrapper.
[`parse-git-status`](https://github.com/jamestalmage/parse-git-status) is used to parse the output.
@name gitStatus
@function
@param {Object} options The `spawno` options.
@param {Function} cb The callback function. | [
"gitStatus",
"A",
"git",
"-",
"status",
"wrapper",
"."
] | b0298a14cbac920952e6a137177aa3a701d94441 | https://github.com/IonicaBizau/git-status/blob/b0298a14cbac920952e6a137177aa3a701d94441/lib/index.js#L19-L29 |
47,116 | Heymdall/cron-to-text | src/parseCron.js | getValue | function getValue(value, offset = 0, max = 9999) {
return isNaN(value) ? NAMES[value] || null : Math.min(+value + (offset), max);
} | javascript | function getValue(value, offset = 0, max = 9999) {
return isNaN(value) ? NAMES[value] || null : Math.min(+value + (offset), max);
} | [
"function",
"getValue",
"(",
"value",
",",
"offset",
"=",
"0",
",",
"max",
"=",
"9999",
")",
"{",
"return",
"isNaN",
"(",
"value",
")",
"?",
"NAMES",
"[",
"value",
"]",
"||",
"null",
":",
"Math",
".",
"min",
"(",
"+",
"value",
"+",
"(",
"offset",... | Returns the value + offset if value is a number, otherwise it
attempts to look up the value in the NAMES table and returns
that result instead.
@param {Number,String} value: The value that should be parsed
@param {Number=} offset: Any offset that must be added to the value
@param {Number=} max
@returns {Number|null} | [
"Returns",
"the",
"value",
"+",
"offset",
"if",
"value",
"is",
"a",
"number",
"otherwise",
"it",
"attempts",
"to",
"look",
"up",
"the",
"value",
"in",
"the",
"NAMES",
"table",
"and",
"returns",
"that",
"result",
"instead",
"."
] | a6a0ae74a4b98bb951a4ae0fa68778a3c7ab9978 | https://github.com/Heymdall/cron-to-text/blob/a6a0ae74a4b98bb951a4ae0fa68778a3c7ab9978/src/parseCron.js#L40-L42 |
47,117 | diosney/json2pot | index.js | setDefaultOptions | function setDefaultOptions(options) {
const defaultOptions = {
src : [
'**/*.i18n.json',
'**/i18n/*.json',
'!node_modules'
],
destFile : 'translations.pot',
headers : {
'X-Poedit-Basepath' : '..',
'X-Poedit-SourceCharset': 'UTF-8',
'X-Poedit... | javascript | function setDefaultOptions(options) {
const defaultOptions = {
src : [
'**/*.i18n.json',
'**/i18n/*.json',
'!node_modules'
],
destFile : 'translations.pot',
headers : {
'X-Poedit-Basepath' : '..',
'X-Poedit-SourceCharset': 'UTF-8',
'X-Poedit... | [
"function",
"setDefaultOptions",
"(",
"options",
")",
"{",
"const",
"defaultOptions",
"=",
"{",
"src",
":",
"[",
"'**/*.i18n.json'",
",",
"'**/i18n/*.json'",
",",
"'!node_modules'",
"]",
",",
"destFile",
":",
"'translations.pot'",
",",
"headers",
":",
"{",
"'X-P... | Set default options.
@param {Object} options
@return {Object} | [
"Set",
"default",
"options",
"."
] | a46c8dc0f479141824d05330d7b31cf72a5e8aa1 | https://github.com/diosney/json2pot/blob/a46c8dc0f479141824d05330d7b31cf72a5e8aa1/index.js#L17-L45 |
47,118 | marksmccann/boost-js | src/boost.js | function( str ) {
return str
// Replaces any - or _ characters with a space
.replace( /[-_]+/g, ' ')
// Removes any non alphanumeric characters
.replace( /[^\w\s]/g, '')
// Uppercases the first character in each group
// immediately followi... | javascript | function( str ) {
return str
// Replaces any - or _ characters with a space
.replace( /[-_]+/g, ' ')
// Removes any non alphanumeric characters
.replace( /[^\w\s]/g, '')
// Uppercases the first character in each group
// immediately followi... | [
"function",
"(",
"str",
")",
"{",
"return",
"str",
"// Replaces any - or _ characters with a space",
".",
"replace",
"(",
"/",
"[-_]+",
"/",
"g",
",",
"' '",
")",
"// Removes any non alphanumeric characters",
".",
"replace",
"(",
"/",
"[^\\w\\s]",
"/",
"g",
",",
... | Converts any string into a "javascript-friendly" version.
@param {string} str
@return {string} camelized | [
"Converts",
"any",
"string",
"into",
"a",
"javascript",
"-",
"friendly",
"version",
"."
] | 0ed0972c4f1ca07f45d5a74f70378007c1e625cd | https://github.com/marksmccann/boost-js/blob/0ed0972c4f1ca07f45d5a74f70378007c1e625cd/src/boost.js#L17-L28 | |
47,119 | marksmccann/boost-js | src/boost.js | function( str ) {
// if whole numbers, convert to integer
if( /^\d+$/.test(str) ) return parseInt( str );
// if decimal, convert to float
if( /^\d*\.\d+$/.test(str) ) return parseFloat( str );
// if "true" or "false", return boolean
if( /^true$/.test(str) ) return true;
... | javascript | function( str ) {
// if whole numbers, convert to integer
if( /^\d+$/.test(str) ) return parseInt( str );
// if decimal, convert to float
if( /^\d*\.\d+$/.test(str) ) return parseFloat( str );
// if "true" or "false", return boolean
if( /^true$/.test(str) ) return true;
... | [
"function",
"(",
"str",
")",
"{",
"// if whole numbers, convert to integer",
"if",
"(",
"/",
"^\\d+$",
"/",
".",
"test",
"(",
"str",
")",
")",
"return",
"parseInt",
"(",
"str",
")",
";",
"// if decimal, convert to float",
"if",
"(",
"/",
"^\\d*\\.\\d+$",
"/",
... | Intelligently converts a string to integer or boolean.
@param {string} str
@return {multi} str string|integer|boolean | [
"Intelligently",
"converts",
"a",
"string",
"to",
"integer",
"or",
"boolean",
"."
] | 0ed0972c4f1ca07f45d5a74f70378007c1e625cd | https://github.com/marksmccann/boost-js/blob/0ed0972c4f1ca07f45d5a74f70378007c1e625cd/src/boost.js#L36-L46 | |
47,120 | marksmccann/boost-js | src/boost.js | function( MyPlugin, defaults ) {
// make sure a function has been passed in to
// create a plugin from.
if (typeof MyPlugin === 'function') {
/**
* the plugin object, inherits all attributes and methods
* from the base plugin and the user's plugin
... | javascript | function( MyPlugin, defaults ) {
// make sure a function has been passed in to
// create a plugin from.
if (typeof MyPlugin === 'function') {
/**
* the plugin object, inherits all attributes and methods
* from the base plugin and the user's plugin
... | [
"function",
"(",
"MyPlugin",
",",
"defaults",
")",
"{",
"// make sure a function has been passed in to",
"// create a plugin from.",
"if",
"(",
"typeof",
"MyPlugin",
"===",
"'function'",
")",
"{",
"/**\n * the plugin object, inherits all attributes and methods\n ... | Creates a new plugin
@param {object} MyPlugin Class from which plugin will be created
@param {object} defaults Default settings for this plugin
@return {object} instance | [
"Creates",
"a",
"new",
"plugin"
] | 0ed0972c4f1ca07f45d5a74f70378007c1e625cd | https://github.com/marksmccann/boost-js/blob/0ed0972c4f1ca07f45d5a74f70378007c1e625cd/src/boost.js#L140-L194 | |
47,121 | marksmccann/boost-js | src/boost.js | function( element, options ) {
Boilerplate.call( this, element, options || {}, defaults || {} );
MyPlugin.call( this, element, options );
return this;
} | javascript | function( element, options ) {
Boilerplate.call( this, element, options || {}, defaults || {} );
MyPlugin.call( this, element, options );
return this;
} | [
"function",
"(",
"element",
",",
"options",
")",
"{",
"Boilerplate",
".",
"call",
"(",
"this",
",",
"element",
",",
"options",
"||",
"{",
"}",
",",
"defaults",
"||",
"{",
"}",
")",
";",
"MyPlugin",
".",
"call",
"(",
"this",
",",
"element",
",",
"op... | the plugin object, inherits all attributes and methods
from the base plugin and the user's plugin
@param {object} element
@param {object} options
@return {object} instance | [
"the",
"plugin",
"object",
"inherits",
"all",
"attributes",
"and",
"methods",
"from",
"the",
"base",
"plugin",
"and",
"the",
"user",
"s",
"plugin"
] | 0ed0972c4f1ca07f45d5a74f70378007c1e625cd | https://github.com/marksmccann/boost-js/blob/0ed0972c4f1ca07f45d5a74f70378007c1e625cd/src/boost.js#L154-L158 | |
47,122 | kengz/poly-socketio | src/start-io.js | ioServer | function ioServer(port = 6466, clientCount = 1, timeoutMs = 100000) {
if (global.io) {
// if already started
return Promise.resolve()
}
log.info(`Starting poly-socketio server on port: ${port}, expecting ${clientCount} IO clients`)
global.io = socketIO(server)
var count = clientCount
global.ioPromi... | javascript | function ioServer(port = 6466, clientCount = 1, timeoutMs = 100000) {
if (global.io) {
// if already started
return Promise.resolve()
}
log.info(`Starting poly-socketio server on port: ${port}, expecting ${clientCount} IO clients`)
global.io = socketIO(server)
var count = clientCount
global.ioPromi... | [
"function",
"ioServer",
"(",
"port",
"=",
"6466",
",",
"clientCount",
"=",
"1",
",",
"timeoutMs",
"=",
"100000",
")",
"{",
"if",
"(",
"global",
".",
"io",
")",
"{",
"// if already started",
"return",
"Promise",
".",
"resolve",
"(",
")",
"}",
"log",
"."... | Start a Socket IO server connecting to a brand new Express server for use in dev. Sets global.io too.
Has a failsafe for not starting multiple times even when called repeatedly by accident in the same thread.
@param {*} robot The hubot object
@return {server} server
/* istanbul ignore next | [
"Start",
"a",
"Socket",
"IO",
"server",
"connecting",
"to",
"a",
"brand",
"new",
"Express",
"server",
"for",
"use",
"in",
"dev",
".",
"Sets",
"global",
".",
"io",
"too",
".",
"Has",
"a",
"failsafe",
"for",
"not",
"starting",
"multiple",
"times",
"even",
... | 261f84d3b4267a6d1a36eadd6526ddb45369973e | https://github.com/kengz/poly-socketio/blob/261f84d3b4267a6d1a36eadd6526ddb45369973e/src/start-io.js#L21-L74 |
47,123 | YR/clock | src/index.js | run | function run() {
const current = now();
const queue = timeoutQueue.slice();
let interval = INTERVAL_MAX;
timeoutQueue.length = 0;
// Reset
if (runRafId > 0 || runTimeoutId > 0) {
stop();
}
for (let i = queue.length - 1; i >= 0; i--) {
const item = queue[i];
if (!item.cancelled) {
c... | javascript | function run() {
const current = now();
const queue = timeoutQueue.slice();
let interval = INTERVAL_MAX;
timeoutQueue.length = 0;
// Reset
if (runRafId > 0 || runTimeoutId > 0) {
stop();
}
for (let i = queue.length - 1; i >= 0; i--) {
const item = queue[i];
if (!item.cancelled) {
c... | [
"function",
"run",
"(",
")",
"{",
"const",
"current",
"=",
"now",
"(",
")",
";",
"const",
"queue",
"=",
"timeoutQueue",
".",
"slice",
"(",
")",
";",
"let",
"interval",
"=",
"INTERVAL_MAX",
";",
"timeoutQueue",
".",
"length",
"=",
"0",
";",
"// Reset",
... | Process outstanding queue items | [
"Process",
"outstanding",
"queue",
"items"
] | 015badf5fdaef050b708b3a01e7f000afd76ab40 | https://github.com/YR/clock/blob/015badf5fdaef050b708b3a01e7f000afd76ab40/src/index.js#L141-L183 |
47,124 | YR/clock | src/index.js | onVisibilityChangeFactory | function onVisibilityChangeFactory(hidden) {
return function onVisibilityChange(evt) {
if (document[hidden]) {
debug('disable while hidden');
stop();
} else {
debug('enable while visible');
if (process.env.NODE_ENV === 'development') {
const current = now();
for (let i... | javascript | function onVisibilityChangeFactory(hidden) {
return function onVisibilityChange(evt) {
if (document[hidden]) {
debug('disable while hidden');
stop();
} else {
debug('enable while visible');
if (process.env.NODE_ENV === 'development') {
const current = now();
for (let i... | [
"function",
"onVisibilityChangeFactory",
"(",
"hidden",
")",
"{",
"return",
"function",
"onVisibilityChange",
"(",
"evt",
")",
"{",
"if",
"(",
"document",
"[",
"hidden",
"]",
")",
"{",
"debug",
"(",
"'disable while hidden'",
")",
";",
"stop",
"(",
")",
";",
... | Generate visibilityChange handler
@param {String} hidden
@returns {Function} | [
"Generate",
"visibilityChange",
"handler"
] | 015badf5fdaef050b708b3a01e7f000afd76ab40 | https://github.com/YR/clock/blob/015badf5fdaef050b708b3a01e7f000afd76ab40/src/index.js#L203-L229 |
47,125 | justinhelmer/npm-publish-release | index.js | publishToNpm | function publishToNpm() {
return new Promise(function(resolve, reject) {
_spork('npm', ['publish'], done, _.partial(reject, new Error('failed to publish to npm')));
function done() {
if (!options.quiet) {
gutil.log('Published to \'' + chalk.cyan('npm') + '\'');
... | javascript | function publishToNpm() {
return new Promise(function(resolve, reject) {
_spork('npm', ['publish'], done, _.partial(reject, new Error('failed to publish to npm')));
function done() {
if (!options.quiet) {
gutil.log('Published to \'' + chalk.cyan('npm') + '\'');
... | [
"function",
"publishToNpm",
"(",
")",
"{",
"return",
"new",
"Promise",
"(",
"function",
"(",
"resolve",
",",
"reject",
")",
"{",
"_spork",
"(",
"'npm'",
",",
"[",
"'publish'",
"]",
",",
"done",
",",
"_",
".",
"partial",
"(",
"reject",
",",
"new",
"Er... | Publish the current codebase to npm.
@return {Bluebird promise} - Resolves or rejects (with nothing) based on the status of the `git` commands. | [
"Publish",
"the",
"current",
"codebase",
"to",
"npm",
"."
] | 9536354c2012097c77ca63f3ef6e0f394d3784e4 | https://github.com/justinhelmer/npm-publish-release/blob/9536354c2012097c77ca63f3ef6e0f394d3784e4/index.js#L168-L180 |
47,126 | justinhelmer/npm-publish-release | index.js | _spork | function _spork(command, args, resolve, reject) {
spork(command, args, {exit: false, quiet: true})
.on('exit:code', function(code) {
if (code === 0) {
resolve();
} else {
reject();
}
});
} | javascript | function _spork(command, args, resolve, reject) {
spork(command, args, {exit: false, quiet: true})
.on('exit:code', function(code) {
if (code === 0) {
resolve();
} else {
reject();
}
});
} | [
"function",
"_spork",
"(",
"command",
",",
"args",
",",
"resolve",
",",
"reject",
")",
"{",
"spork",
"(",
"command",
",",
"args",
",",
"{",
"exit",
":",
"false",
",",
"quiet",
":",
"true",
"}",
")",
".",
"on",
"(",
"'exit:code'",
",",
"function",
"... | Wrapper around spork to shorthand common behavior | [
"Wrapper",
"around",
"spork",
"to",
"shorthand",
"common",
"behavior"
] | 9536354c2012097c77ca63f3ef6e0f394d3784e4 | https://github.com/justinhelmer/npm-publish-release/blob/9536354c2012097c77ca63f3ef6e0f394d3784e4/index.js#L204-L213 |
47,127 | edus44/express-deliver | lib/loader/main.js | wrapMethod | function wrapMethod(app,fn){
//Override original express method
return function(){
let args = Array.prototype.slice.call(arguments)
//Check if any middleware argument is a generator function
for( let i=0; i<args.length; i++ ){
//Wrap this if necessary
args[i] = co... | javascript | function wrapMethod(app,fn){
//Override original express method
return function(){
let args = Array.prototype.slice.call(arguments)
//Check if any middleware argument is a generator function
for( let i=0; i<args.length; i++ ){
//Wrap this if necessary
args[i] = co... | [
"function",
"wrapMethod",
"(",
"app",
",",
"fn",
")",
"{",
"//Override original express method",
"return",
"function",
"(",
")",
"{",
"let",
"args",
"=",
"Array",
".",
"prototype",
".",
"slice",
".",
"call",
"(",
"arguments",
")",
"//Check if any middleware argu... | Wrap an express method handler
@param {ExpressApp} app
@param {Function} fn
@returns {Function} | [
"Wrap",
"an",
"express",
"method",
"handler"
] | 895abfaf2e5e48a00b4fef943dccaffcbf244780 | https://github.com/edus44/express-deliver/blob/895abfaf2e5e48a00b4fef943dccaffcbf244780/lib/loader/main.js#L69-L82 |
47,128 | chjj/rondo | lib/dom.js | function(el, deep) {
var sub = document.createElement(el.nodeName)
, attr = el.attributes
, i = attr.length;
while (i--) {
if (attr[i].nodeValue) {
sub.setAttribute(attr[i].name, attr[i].value);
}
}
if (el.namespaceURI) {
sub.namespaceURI = el.namespaceURI;
}
... | javascript | function(el, deep) {
var sub = document.createElement(el.nodeName)
, attr = el.attributes
, i = attr.length;
while (i--) {
if (attr[i].nodeValue) {
sub.setAttribute(attr[i].name, attr[i].value);
}
}
if (el.namespaceURI) {
sub.namespaceURI = el.namespaceURI;
}
... | [
"function",
"(",
"el",
",",
"deep",
")",
"{",
"var",
"sub",
"=",
"document",
".",
"createElement",
"(",
"el",
".",
"nodeName",
")",
",",
"attr",
"=",
"el",
".",
"attributes",
",",
"i",
"=",
"attr",
".",
"length",
";",
"while",
"(",
"i",
"--",
")"... | this gives a clean "userspace" clone with no events or data. .cloneNode is so damn buggy i dont even want to touch it. | [
"this",
"gives",
"a",
"clean",
"userspace",
"clone",
"with",
"no",
"events",
"or",
"data",
".",
".",
"cloneNode",
"is",
"so",
"damn",
"buggy",
"i",
"dont",
"even",
"want",
"to",
"touch",
"it",
"."
] | 5a0643a2e4ce74e25240517e1cf423df5a188008 | https://github.com/chjj/rondo/blob/5a0643a2e4ce74e25240517e1cf423df5a188008/lib/dom.js#L380-L404 | |
47,129 | chjj/rondo | lib/dom.js | function(el, sub) {
sub = normalize(sub);
DOM.removeAllListeners(el);
DOM.clearData(el);
DOM.clean(el);
//el.parentNode.replaceChild(sub, el);
el.parentNode.insertBefore(sub, el);
el.parentNode.removeChild(el);
return sub;
} | javascript | function(el, sub) {
sub = normalize(sub);
DOM.removeAllListeners(el);
DOM.clearData(el);
DOM.clean(el);
//el.parentNode.replaceChild(sub, el);
el.parentNode.insertBefore(sub, el);
el.parentNode.removeChild(el);
return sub;
} | [
"function",
"(",
"el",
",",
"sub",
")",
"{",
"sub",
"=",
"normalize",
"(",
"sub",
")",
";",
"DOM",
".",
"removeAllListeners",
"(",
"el",
")",
";",
"DOM",
".",
"clearData",
"(",
"el",
")",
";",
"DOM",
".",
"clean",
"(",
"el",
")",
";",
"//el.paren... | "replace this with that" | [
"replace",
"this",
"with",
"that"
] | 5a0643a2e4ce74e25240517e1cf423df5a188008 | https://github.com/chjj/rondo/blob/5a0643a2e4ce74e25240517e1cf423df5a188008/lib/dom.js#L559-L571 | |
47,130 | chjj/rondo | lib/dom.js | function(el, sub) {
sub = normalize(sub);
el.parentNode.insertBefore(sub, el);
return sub;
} | javascript | function(el, sub) {
sub = normalize(sub);
el.parentNode.insertBefore(sub, el);
return sub;
} | [
"function",
"(",
"el",
",",
"sub",
")",
"{",
"sub",
"=",
"normalize",
"(",
"sub",
")",
";",
"el",
".",
"parentNode",
".",
"insertBefore",
"(",
"sub",
",",
"el",
")",
";",
"return",
"sub",
";",
"}"
] | "insert that before this" | [
"insert",
"that",
"before",
"this"
] | 5a0643a2e4ce74e25240517e1cf423df5a188008 | https://github.com/chjj/rondo/blob/5a0643a2e4ce74e25240517e1cf423df5a188008/lib/dom.js#L576-L581 | |
47,131 | quorrajs/Positron | lib/config/Repository.js | Repository | function Repository(loader, environment) {
/**
* The loader implementation.
*
* @var {FileLoader}
* @protected
*/
this.__loader = loader;
/**
* The current environment.
*
* @var {string}
* @protected
*/
this.__environment = environment;
/**
*... | javascript | function Repository(loader, environment) {
/**
* The loader implementation.
*
* @var {FileLoader}
* @protected
*/
this.__loader = loader;
/**
* The current environment.
*
* @var {string}
* @protected
*/
this.__environment = environment;
/**
*... | [
"function",
"Repository",
"(",
"loader",
",",
"environment",
")",
"{",
"/**\n * The loader implementation.\n *\n * @var {FileLoader}\n * @protected\n */",
"this",
".",
"__loader",
"=",
"loader",
";",
"/**\n * The current environment.\n *\n * @var {string... | Create a new configuration repository.
@param {FileLoader} loader
@param {string} environment
@inherits NamespacedItemResolver
@return void | [
"Create",
"a",
"new",
"configuration",
"repository",
"."
] | a4bad5a5f581743d1885405c11ae26600fb957af | https://github.com/quorrajs/Positron/blob/a4bad5a5f581743d1885405c11ae26600fb957af/lib/config/Repository.js#L20-L57 |
47,132 | SamyPesse/parse-changelog | index.js | function() {
if (!version) return;
if (note) version.notes.push(note);
version.rawNote = normText(
_.chain(version.notes)
.map(function(note) {
return '* '+note.trim();
})
.value()
.join('\n')
);
version... | javascript | function() {
if (!version) return;
if (note) version.notes.push(note);
version.rawNote = normText(
_.chain(version.notes)
.map(function(note) {
return '* '+note.trim();
})
.value()
.join('\n')
);
version... | [
"function",
"(",
")",
"{",
"if",
"(",
"!",
"version",
")",
"return",
";",
"if",
"(",
"note",
")",
"version",
".",
"notes",
".",
"push",
"(",
"note",
")",
";",
"version",
".",
"rawNote",
"=",
"normText",
"(",
"_",
".",
"chain",
"(",
"version",
"."... | Push a new version and normalize notes | [
"Push",
"a",
"new",
"version",
"and",
"normalize",
"notes"
] | 2c4f5fb0c9d265aa6e39bed60c7d01d867cf07db | https://github.com/SamyPesse/parse-changelog/blob/2c4f5fb0c9d265aa6e39bed60c7d01d867cf07db/index.js#L32-L49 | |
47,133 | sdgluck/sw-register | index.js | register | function register (options, __mockSelf) {
var _self = __mockSelf || self
var navigator = _self.navigator
if (!('serviceWorker' in navigator)) {
return Promise.reject(new Error('Service Workers unsupported'))
}
var serviceWorker = navigator.serviceWorker.controller
return Promise.resolve()
.then(f... | javascript | function register (options, __mockSelf) {
var _self = __mockSelf || self
var navigator = _self.navigator
if (!('serviceWorker' in navigator)) {
return Promise.reject(new Error('Service Workers unsupported'))
}
var serviceWorker = navigator.serviceWorker.controller
return Promise.resolve()
.then(f... | [
"function",
"register",
"(",
"options",
",",
"__mockSelf",
")",
"{",
"var",
"_self",
"=",
"__mockSelf",
"||",
"self",
"var",
"navigator",
"=",
"_self",
".",
"navigator",
"if",
"(",
"!",
"(",
"'serviceWorker'",
"in",
"navigator",
")",
")",
"{",
"return",
... | Register or retrieve a Service Worker that controls the page.
@param {Object} options
@returns {Promise} | [
"Register",
"or",
"retrieve",
"a",
"Service",
"Worker",
"that",
"controls",
"the",
"page",
"."
] | 294873c5d3c0a7df143401e5f14de51e2771704d | https://github.com/sdgluck/sw-register/blob/294873c5d3c0a7df143401e5f14de51e2771704d/index.js#L18-L55 |
47,134 | agneta/platform | pages/scripts/helpers/debug.js | inspectObject | function inspectObject(object, options) {
var result = util.inspect(object, options);
console.log(result);
return result;
} | javascript | function inspectObject(object, options) {
var result = util.inspect(object, options);
console.log(result);
return result;
} | [
"function",
"inspectObject",
"(",
"object",
",",
"options",
")",
"{",
"var",
"result",
"=",
"util",
".",
"inspect",
"(",
"object",
",",
"options",
")",
";",
"console",
".",
"log",
"(",
"result",
")",
";",
"return",
"result",
";",
"}"
] | this solves circular reference in object | [
"this",
"solves",
"circular",
"reference",
"in",
"object"
] | 9364b03b06b91b64f786d0439a32b08bb018606f | https://github.com/agneta/platform/blob/9364b03b06b91b64f786d0439a32b08bb018606f/pages/scripts/helpers/debug.js#L24-L28 |
47,135 | arboleya/ways | lib/ways.js | Ways | function Ways(pattern, runner, destroyer, dependency){
if(flow && arguments.length < 3)
throw new Error('In `flow` mode you must to pass at least 3 args.');
var route = new Way(pattern, runner, destroyer, dependency);
routes.push(route);
return route;
} | javascript | function Ways(pattern, runner, destroyer, dependency){
if(flow && arguments.length < 3)
throw new Error('In `flow` mode you must to pass at least 3 args.');
var route = new Way(pattern, runner, destroyer, dependency);
routes.push(route);
return route;
} | [
"function",
"Ways",
"(",
"pattern",
",",
"runner",
",",
"destroyer",
",",
"dependency",
")",
"{",
"if",
"(",
"flow",
"&&",
"arguments",
".",
"length",
"<",
"3",
")",
"throw",
"new",
"Error",
"(",
"'In `flow` mode you must to pass at least 3 args.'",
")",
";",
... | Sets up a new route
@param {String} pattern Pattern string
@param {Function} runner Route's action runner
@param {Function} destroyer Optional, Route's action destroyer (flow mode)
@param {String} dependency Optional, specifies a dependency by pattern | [
"Sets",
"up",
"a",
"new",
"route"
] | 01a91066de320aa045a5301b2a905ba5f8f141f4 | https://github.com/arboleya/ways/blob/01a91066de320aa045a5301b2a905ba5f8f141f4/lib/ways.js#L38-L47 |
47,136 | feedhenry-raincatcher/raincatcher-angularjs | packages/angularjs-workorder/lib/workorder-detail/workorder-detail-controller.js | WorkorderDetailController | function WorkorderDetailController($state, WORKORDER_CONFIG, workorderStatusService) {
var self = this;
self.adminMode = WORKORDER_CONFIG.adminMode;
self.getColorIcon = function(status) {
return workorderStatusService.getStatusIconColor(status).statusColor;
};
} | javascript | function WorkorderDetailController($state, WORKORDER_CONFIG, workorderStatusService) {
var self = this;
self.adminMode = WORKORDER_CONFIG.adminMode;
self.getColorIcon = function(status) {
return workorderStatusService.getStatusIconColor(status).statusColor;
};
} | [
"function",
"WorkorderDetailController",
"(",
"$state",
",",
"WORKORDER_CONFIG",
",",
"workorderStatusService",
")",
"{",
"var",
"self",
"=",
"this",
";",
"self",
".",
"adminMode",
"=",
"WORKORDER_CONFIG",
".",
"adminMode",
";",
"self",
".",
"getColorIcon",
"=",
... | Controller for displaying workorder details to the user.
@param WORKORDER_CONFIG
@constructor | [
"Controller",
"for",
"displaying",
"workorder",
"details",
"to",
"the",
"user",
"."
] | b394689227901e18871ad9edd0ec226c5e6839e1 | https://github.com/feedhenry-raincatcher/raincatcher-angularjs/blob/b394689227901e18871ad9edd0ec226c5e6839e1/packages/angularjs-workorder/lib/workorder-detail/workorder-detail-controller.js#L9-L17 |
47,137 | jiridudekusy/uu5-to-markdown | src/converters/md2uu5/richText/richText.js | richtext | function richtext(state, startLine, endLine, silent, opts) {
let pos = state.bMarks[startLine] + state.tShift[startLine],
max = state.eMarks[startLine],
contentEndLine;
if (pos >= max) {
return false;
}
let line = state.getLines(startLine, startLine + 1, 0, false);
if (!line.startsWith(RICHTEXT... | javascript | function richtext(state, startLine, endLine, silent, opts) {
let pos = state.bMarks[startLine] + state.tShift[startLine],
max = state.eMarks[startLine],
contentEndLine;
if (pos >= max) {
return false;
}
let line = state.getLines(startLine, startLine + 1, 0, false);
if (!line.startsWith(RICHTEXT... | [
"function",
"richtext",
"(",
"state",
",",
"startLine",
",",
"endLine",
",",
"silent",
",",
"opts",
")",
"{",
"let",
"pos",
"=",
"state",
".",
"bMarks",
"[",
"startLine",
"]",
"+",
"state",
".",
"tShift",
"[",
"startLine",
"]",
",",
"max",
"=",
"stat... | Block parser for UU5.RichText.Block .
The rich text block is using following signature:
{richtext}
...richtext content...
{/richtext}
@param state
@param startLine
@param endLine
@param silent
@returns {boolean} | [
"Block",
"parser",
"for",
"UU5",
".",
"RichText",
".",
"Block",
"."
] | 559163aa8a4184e1a94888c4fc6d4302acbd857d | https://github.com/jiridudekusy/uu5-to-markdown/blob/559163aa8a4184e1a94888c4fc6d4302acbd857d/src/converters/md2uu5/richText/richText.js#L20-L62 |
47,138 | fti-technology/node-skytap | lib/rest.js | apiRequest | function apiRequest(args, next) {
var deferred = Q.defer()
, opts;
opts = {
json: true,
headers: headers,
};
if(args.version === 'v2') {
opts.headers.Accept = 'application/vnd.skytap.api.v2+json';
}
opts = arghelper.combine(opts, args);
opts = arghelper.convertAu... | javascript | function apiRequest(args, next) {
var deferred = Q.defer()
, opts;
opts = {
json: true,
headers: headers,
};
if(args.version === 'v2') {
opts.headers.Accept = 'application/vnd.skytap.api.v2+json';
}
opts = arghelper.combine(opts, args);
opts = arghelper.convertAu... | [
"function",
"apiRequest",
"(",
"args",
",",
"next",
")",
"{",
"var",
"deferred",
"=",
"Q",
".",
"defer",
"(",
")",
",",
"opts",
";",
"opts",
"=",
"{",
"json",
":",
"true",
",",
"headers",
":",
"headers",
",",
"}",
";",
"if",
"(",
"args",
".",
"... | Performs the api request based on the supplied arguments
@param {Object} args
@config {String} url - required
@config {String} method - required
@config {Object} auth - required
@config {String} auth.user - required
@config {String} auth.pass - required
@config {Object} body
@callback next
@return {Promise}
@api priv... | [
"Performs",
"the",
"api",
"request",
"based",
"on",
"the",
"supplied",
"arguments"
] | 1d5af43ee26aabfebe52627ea09f291c99923a49 | https://github.com/fti-technology/node-skytap/blob/1d5af43ee26aabfebe52627ea09f291c99923a49/lib/rest.js#L47-L100 |
47,139 | alexyoung/pop | lib/helpers.js | function(template, options) {
options = options || {};
options.pretty = true;
var fn = jade.compile(template, options);
return fn(options.locals);
} | javascript | function(template, options) {
options = options || {};
options.pretty = true;
var fn = jade.compile(template, options);
return fn(options.locals);
} | [
"function",
"(",
"template",
",",
"options",
")",
"{",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"options",
".",
"pretty",
"=",
"true",
";",
"var",
"fn",
"=",
"jade",
".",
"compile",
"(",
"template",
",",
"options",
")",
";",
"return",
"fn",
... | Renders a Jade template
@param {String} A Jade template
@param {Object} Options passed to Jade
@return {String} | [
"Renders",
"a",
"Jade",
"template"
] | 8a0b3f2605cb58e8ae6b34f1373dde00610e9858 | https://github.com/alexyoung/pop/blob/8a0b3f2605cb58e8ae6b34f1373dde00610e9858/lib/helpers.js#L25-L30 | |
47,140 | alexyoung/pop | lib/helpers.js | function(paginator) {
var template = '';
template += '.pages\n';
template += ' - if (paginator.previousPage)\n';
template += ' span.prev_next\n';
template += ' - if (paginator.previousPage === 1)\n';
template += ' span ←\n';
template += ' a.previous(href="/") Prev... | javascript | function(paginator) {
var template = '';
template += '.pages\n';
template += ' - if (paginator.previousPage)\n';
template += ' span.prev_next\n';
template += ' - if (paginator.previousPage === 1)\n';
template += ' span ←\n';
template += ' a.previous(href="/") Prev... | [
"function",
"(",
"paginator",
")",
"{",
"var",
"template",
"=",
"''",
";",
"template",
"+=",
"'.pages\\n'",
";",
"template",
"+=",
"' - if (paginator.previousPage)\\n'",
";",
"template",
"+=",
"' span.prev_next\\n'",
";",
"template",
"+=",
"' - if (paginator.... | Pagination links.
@param {Object} Paginator object
@return {String} | [
"Pagination",
"links",
"."
] | 8a0b3f2605cb58e8ae6b34f1373dde00610e9858 | https://github.com/alexyoung/pop/blob/8a0b3f2605cb58e8ae6b34f1373dde00610e9858/lib/helpers.js#L38-L62 | |
47,141 | alexyoung/pop | lib/helpers.js | function() {
var template
, site = this;
template = ''
+ '- for (var i = 0; i < paginator.items.length; i++)\n'
+ ' !{hNews(paginator.items[i], true)}\n';
return helpers.render(template, { locals: site.applyHelpers({ paginator: site.paginator }) });
} | javascript | function() {
var template
, site = this;
template = ''
+ '- for (var i = 0; i < paginator.items.length; i++)\n'
+ ' !{hNews(paginator.items[i], true)}\n';
return helpers.render(template, { locals: site.applyHelpers({ paginator: site.paginator }) });
} | [
"function",
"(",
")",
"{",
"var",
"template",
",",
"site",
"=",
"this",
";",
"template",
"=",
"''",
"+",
"'- for (var i = 0; i < paginator.items.length; i++)\\n'",
"+",
"' !{hNews(paginator.items[i], true)}\\n'",
";",
"return",
"helpers",
".",
"render",
"(",
"templat... | Generates paginated blog posts, suitable for use on an index page.
@return {String} | [
"Generates",
"paginated",
"blog",
"posts",
"suitable",
"for",
"use",
"on",
"an",
"index",
"page",
"."
] | 8a0b3f2605cb58e8ae6b34f1373dde00610e9858 | https://github.com/alexyoung/pop/blob/8a0b3f2605cb58e8ae6b34f1373dde00610e9858/lib/helpers.js#L69-L77 | |
47,142 | alexyoung/pop | lib/helpers.js | function(feed, summarise) {
var template = ''
, url = this.config.url
, title = this.config.title
, perPage = this.config.perPage
, posts = this.posts.slice(0, perPage)
, site = this;
summarise = typeof summarise === 'boolean' && summarise ? 3 : summarise;
perPage = site.posts... | javascript | function(feed, summarise) {
var template = ''
, url = this.config.url
, title = this.config.title
, perPage = this.config.perPage
, posts = this.posts.slice(0, perPage)
, site = this;
summarise = typeof summarise === 'boolean' && summarise ? 3 : summarise;
perPage = site.posts... | [
"function",
"(",
"feed",
",",
"summarise",
")",
"{",
"var",
"template",
"=",
"''",
",",
"url",
"=",
"this",
".",
"config",
".",
"url",
",",
"title",
"=",
"this",
".",
"config",
".",
"title",
",",
"perPage",
"=",
"this",
".",
"config",
".",
"perPage... | Atom Jade template.
@param {String} Feed URL
@param {Integer} Number of paragraphs to summarise
@return {String} | [
"Atom",
"Jade",
"template",
"."
] | 8a0b3f2605cb58e8ae6b34f1373dde00610e9858 | https://github.com/alexyoung/pop/blob/8a0b3f2605cb58e8ae6b34f1373dde00610e9858/lib/helpers.js#L87-L130 | |
47,143 | alexyoung/pop | lib/helpers.js | function() {
var allTags = [];
for (var key in this.posts) {
if (this.posts[key].tags) {
for (var i = 0; i < this.posts[key].tags.length; i++) {
var tag = this.posts[key].tags[i];
if (allTags.indexOf(tag) === -1) allTags.push(tag);
}
}
}
allTags.sort... | javascript | function() {
var allTags = [];
for (var key in this.posts) {
if (this.posts[key].tags) {
for (var i = 0; i < this.posts[key].tags.length; i++) {
var tag = this.posts[key].tags[i];
if (allTags.indexOf(tag) === -1) allTags.push(tag);
}
}
}
allTags.sort... | [
"function",
"(",
")",
"{",
"var",
"allTags",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"key",
"in",
"this",
".",
"posts",
")",
"{",
"if",
"(",
"this",
".",
"posts",
"[",
"key",
"]",
".",
"tags",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
";",... | Returns unique sorted tags for every post.
@return {Array} | [
"Returns",
"unique",
"sorted",
"tags",
"for",
"every",
"post",
"."
] | 8a0b3f2605cb58e8ae6b34f1373dde00610e9858 | https://github.com/alexyoung/pop/blob/8a0b3f2605cb58e8ae6b34f1373dde00610e9858/lib/helpers.js#L196-L217 | |
47,144 | alexyoung/pop | lib/helpers.js | function(tag) {
var posts = [];
for (var key in this.posts) {
if (this.posts[key].tags && this.posts[key].tags.indexOf(tag) !== -1) {
posts.push(this.posts[key]);
}
}
return posts;
} | javascript | function(tag) {
var posts = [];
for (var key in this.posts) {
if (this.posts[key].tags && this.posts[key].tags.indexOf(tag) !== -1) {
posts.push(this.posts[key]);
}
}
return posts;
} | [
"function",
"(",
"tag",
")",
"{",
"var",
"posts",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"key",
"in",
"this",
".",
"posts",
")",
"{",
"if",
"(",
"this",
".",
"posts",
"[",
"key",
"]",
".",
"tags",
"&&",
"this",
".",
"posts",
"[",
"key",
"]",
... | Get a set of posts for a tag.
@param {String} Tag name
@return {Array} | [
"Get",
"a",
"set",
"of",
"posts",
"for",
"a",
"tag",
"."
] | 8a0b3f2605cb58e8ae6b34f1373dde00610e9858 | https://github.com/alexyoung/pop/blob/8a0b3f2605cb58e8ae6b34f1373dde00610e9858/lib/helpers.js#L225-L233 | |
47,145 | alexyoung/pop | lib/helpers.js | function(text, length, moreText) {
var t = text.split('</p>');
return t.length < length ? text : t.slice(0, length).join('</p>') + '</p>' + moreText;
} | javascript | function(text, length, moreText) {
var t = text.split('</p>');
return t.length < length ? text : t.slice(0, length).join('</p>') + '</p>' + moreText;
} | [
"function",
"(",
"text",
",",
"length",
",",
"moreText",
")",
"{",
"var",
"t",
"=",
"text",
".",
"split",
"(",
"'</p>'",
")",
";",
"return",
"t",
".",
"length",
"<",
"length",
"?",
"text",
":",
"t",
".",
"slice",
"(",
"0",
",",
"length",
")",
"... | Truncates HTML based on paragraph counts.
@param {String} Text to truncate
@param {Integer} Number of paragraphs
@param {String} Text to append when truncated
@return {String} | [
"Truncates",
"HTML",
"based",
"on",
"paragraph",
"counts",
"."
] | 8a0b3f2605cb58e8ae6b34f1373dde00610e9858 | https://github.com/alexyoung/pop/blob/8a0b3f2605cb58e8ae6b34f1373dde00610e9858/lib/helpers.js#L341-L344 | |
47,146 | parsnick/laravel-elixir-bowerbundle | index.js | function(paths) {
return (
gulp
.src(paths.src.path)
.pipe(rework(
reworkUrl(function (url) {
return isRelative(url) ? path.basename(url) : url;
})
))
.pipe($.if(config.sourcemaps, $.sourcemaps.init({ loadMaps: true })))
.pipe($... | javascript | function(paths) {
return (
gulp
.src(paths.src.path)
.pipe(rework(
reworkUrl(function (url) {
return isRelative(url) ? path.basename(url) : url;
})
))
.pipe($.if(config.sourcemaps, $.sourcemaps.init({ loadMaps: true })))
.pipe($... | [
"function",
"(",
"paths",
")",
"{",
"return",
"(",
"gulp",
".",
"src",
"(",
"paths",
".",
"src",
".",
"path",
")",
".",
"pipe",
"(",
"rework",
"(",
"reworkUrl",
"(",
"function",
"(",
"url",
")",
"{",
"return",
"isRelative",
"(",
"url",
")",
"?",
... | Combine stylesheets.
@param {GulpPaths} paths
@return {stream} | [
"Combine",
"stylesheets",
"."
] | f6e7df503b4abec1c721a8b56b508162f714dd71 | https://github.com/parsnick/laravel-elixir-bowerbundle/blob/f6e7df503b4abec1c721a8b56b508162f714dd71/index.js#L107-L122 | |
47,147 | parsnick/laravel-elixir-bowerbundle | index.js | logMissingPackages | function logMissingPackages(bundle)
{
var missing = _(bundle.packages).reject('installed')
.map('name').uniq().value();
if ( ! missing.length) return;
console.log('')
console.log(
colors.black.bgRed('!!! ' + bundle.name + ' is missing ' + colors.bold(missing.length) + ' package(s)')
... | javascript | function logMissingPackages(bundle)
{
var missing = _(bundle.packages).reject('installed')
.map('name').uniq().value();
if ( ! missing.length) return;
console.log('')
console.log(
colors.black.bgRed('!!! ' + bundle.name + ' is missing ' + colors.bold(missing.length) + ' package(s)')
... | [
"function",
"logMissingPackages",
"(",
"bundle",
")",
"{",
"var",
"missing",
"=",
"_",
"(",
"bundle",
".",
"packages",
")",
".",
"reject",
"(",
"'installed'",
")",
".",
"map",
"(",
"'name'",
")",
".",
"uniq",
"(",
")",
".",
"value",
"(",
")",
";",
... | Log to console any packages that were requested but not installed.
@param {Bundle} bundle | [
"Log",
"to",
"console",
"any",
"packages",
"that",
"were",
"requested",
"but",
"not",
"installed",
"."
] | f6e7df503b4abec1c721a8b56b508162f714dd71 | https://github.com/parsnick/laravel-elixir-bowerbundle/blob/f6e7df503b4abec1c721a8b56b508162f714dd71/index.js#L193-L209 |
47,148 | goliney/coderoom | lib/coderoom.js | buildRooms | function buildRooms(baseRoom, dir, depth, attachments) {
depth++;
// group attachments
attachments = _.chain(attachments)
.clone()
.concat(baseRoom.getMedia(false).map(file => path.join('media', path.relative(commonFolder, file))))
.uniq()
.value(... | javascript | function buildRooms(baseRoom, dir, depth, attachments) {
depth++;
// group attachments
attachments = _.chain(attachments)
.clone()
.concat(baseRoom.getMedia(false).map(file => path.join('media', path.relative(commonFolder, file))))
.uniq()
.value(... | [
"function",
"buildRooms",
"(",
"baseRoom",
",",
"dir",
",",
"depth",
",",
"attachments",
")",
"{",
"depth",
"++",
";",
"// group attachments",
"attachments",
"=",
"_",
".",
"chain",
"(",
"attachments",
")",
".",
"clone",
"(",
")",
".",
"concat",
"(",
"ba... | depth=2, fixes path to targetDir | [
"depth",
"=",
"2",
"fixes",
"path",
"to",
"targetDir"
] | a8c30d45ae724dfc87348ffba5474cf62c10911c | https://github.com/goliney/coderoom/blob/a8c30d45ae724dfc87348ffba5474cf62c10911c/lib/coderoom.js#L103-L175 |
47,149 | theThings/jailed-node | sandbox/sandbox.js | function(url) {
var done = _onImportScript(url)
loadScript(
url,
function runScript(err, code) {
if (err) return done(err)
executeNormal(code, url, done)
}
)
} | javascript | function(url) {
var done = _onImportScript(url)
loadScript(
url,
function runScript(err, code) {
if (err) return done(err)
executeNormal(code, url, done)
}
)
} | [
"function",
"(",
"url",
")",
"{",
"var",
"done",
"=",
"_onImportScript",
"(",
"url",
")",
"loadScript",
"(",
"url",
",",
"function",
"runScript",
"(",
"err",
",",
"code",
")",
"{",
"if",
"(",
"err",
")",
"return",
"done",
"(",
"err",
")",
"executeNor... | Loads and executes the JavaScript file with the given url
@param {String} url of the script to load | [
"Loads",
"and",
"executes",
"the",
"JavaScript",
"file",
"with",
"the",
"given",
"url"
] | 6e453d97e74fbd1c0b27b982084f6fd7c1aa0173 | https://github.com/theThings/jailed-node/blob/6e453d97e74fbd1c0b27b982084f6fd7c1aa0173/sandbox/sandbox.js#L72-L81 | |
47,150 | theThings/jailed-node | sandbox/sandbox.js | function(url) {
var done = _onImportScript(url)
loadScript(
url,
function runScript(err, code) {
if (err) return done(err)
executeJailed(code, url, done)
}
)
} | javascript | function(url) {
var done = _onImportScript(url)
loadScript(
url,
function runScript(err, code) {
if (err) return done(err)
executeJailed(code, url, done)
}
)
} | [
"function",
"(",
"url",
")",
"{",
"var",
"done",
"=",
"_onImportScript",
"(",
"url",
")",
"loadScript",
"(",
"url",
",",
"function",
"runScript",
"(",
"err",
",",
"code",
")",
"{",
"if",
"(",
"err",
")",
"return",
"done",
"(",
"err",
")",
"executeJai... | Loads and executes the JavaScript file with the given url in a
jailed environment
@param {String} url of the script to load | [
"Loads",
"and",
"executes",
"the",
"JavaScript",
"file",
"with",
"the",
"given",
"url",
"in",
"a",
"jailed",
"environment"
] | 6e453d97e74fbd1c0b27b982084f6fd7c1aa0173 | https://github.com/theThings/jailed-node/blob/6e453d97e74fbd1c0b27b982084f6fd7c1aa0173/sandbox/sandbox.js#L89-L98 | |
47,151 | theThings/jailed-node | sandbox/sandbox.js | function(code, url, done) {
var vm = require('vm')
var sandbox = {}
var expose = [
'application',
'setTimeout',
'setInterval',
'clearTimeout',
'clearInterval'
]
for (var i = 0; i < expose.length; i++) {
sandbox[expose[i]] = global[expose[i]]
}
code = '"use strict";\n' + code
tr... | javascript | function(code, url, done) {
var vm = require('vm')
var sandbox = {}
var expose = [
'application',
'setTimeout',
'setInterval',
'clearTimeout',
'clearInterval'
]
for (var i = 0; i < expose.length; i++) {
sandbox[expose[i]] = global[expose[i]]
}
code = '"use strict";\n' + code
tr... | [
"function",
"(",
"code",
",",
"url",
",",
"done",
")",
"{",
"var",
"vm",
"=",
"require",
"(",
"'vm'",
")",
"var",
"sandbox",
"=",
"{",
"}",
"var",
"expose",
"=",
"[",
"'application'",
",",
"'setTimeout'",
",",
"'setInterval'",
",",
"'clearTimeout'",
",... | Executes the given code in a jailed environment, runs the
corresponding callback when done
@param {String} code to execute
@param {String} url of the script (for displaying the stack) | [
"Executes",
"the",
"given",
"code",
"in",
"a",
"jailed",
"environment",
"runs",
"the",
"corresponding",
"callback",
"when",
"done"
] | 6e453d97e74fbd1c0b27b982084f6fd7c1aa0173 | https://github.com/theThings/jailed-node/blob/6e453d97e74fbd1c0b27b982084f6fd7c1aa0173/sandbox/sandbox.js#L134-L156 | |
47,152 | theThings/jailed-node | sandbox/sandbox.js | function(url, done) {
var receive = function(res) {
if (res.statusCode != 200) {
var msg = 'Failed to load ' + url + '\n' +
'HTTP responce status code: ' + res.statusCode
printError(msg)
done(new Error(msg))
} else {
var content = ''
res
.on('end', function() {
... | javascript | function(url, done) {
var receive = function(res) {
if (res.statusCode != 200) {
var msg = 'Failed to load ' + url + '\n' +
'HTTP responce status code: ' + res.statusCode
printError(msg)
done(new Error(msg))
} else {
var content = ''
res
.on('end', function() {
... | [
"function",
"(",
"url",
",",
"done",
")",
"{",
"var",
"receive",
"=",
"function",
"(",
"res",
")",
"{",
"if",
"(",
"res",
".",
"statusCode",
"!=",
"200",
")",
"{",
"var",
"msg",
"=",
"'Failed to load '",
"+",
"url",
"+",
"'\\n'",
"+",
"'HTTP responce... | Downloads the script by remote url and provides its content as a
string to the callback
@param {String} url of the remote module to load
@param {Function} sCb success callback
@param {Function} fCb failure callback | [
"Downloads",
"the",
"script",
"by",
"remote",
"url",
"and",
"provides",
"its",
"content",
"as",
"a",
"string",
"to",
"the",
"callback"
] | 6e453d97e74fbd1c0b27b982084f6fd7c1aa0173 | https://github.com/theThings/jailed-node/blob/6e453d97e74fbd1c0b27b982084f6fd7c1aa0173/sandbox/sandbox.js#L220-L245 | |
47,153 | theThings/jailed-node | sandbox/sandbox.js | printError | function printError() {
var _log = [new Date().toGMTString().concat(' jailed:sandbox')].concat([].slice.call(arguments))
console.error.apply(null, _log)
} | javascript | function printError() {
var _log = [new Date().toGMTString().concat(' jailed:sandbox')].concat([].slice.call(arguments))
console.error.apply(null, _log)
} | [
"function",
"printError",
"(",
")",
"{",
"var",
"_log",
"=",
"[",
"new",
"Date",
"(",
")",
".",
"toGMTString",
"(",
")",
".",
"concat",
"(",
"' jailed:sandbox'",
")",
"]",
".",
"concat",
"(",
"[",
"]",
".",
"slice",
".",
"call",
"(",
"arguments",
"... | Prints error message and its stack
@param {Object} msg stack provided by error.stack or a message | [
"Prints",
"error",
"message",
"and",
"its",
"stack"
] | 6e453d97e74fbd1c0b27b982084f6fd7c1aa0173 | https://github.com/theThings/jailed-node/blob/6e453d97e74fbd1c0b27b982084f6fd7c1aa0173/sandbox/sandbox.js#L267-L270 |
47,154 | oscmejia/libs | lib/libs/number.js | random | function random(_length) {
var string_length = _length;
if(string_length < 0)
string_length = 1;
var chars = "0123456789";
var num = '';
for (var i=0; i<string_length; i++) {
var rnum = Math.floor(Math.random() * chars.length);
num += chars.substring(rnum,rnum+1)... | javascript | function random(_length) {
var string_length = _length;
if(string_length < 0)
string_length = 1;
var chars = "0123456789";
var num = '';
for (var i=0; i<string_length; i++) {
var rnum = Math.floor(Math.random() * chars.length);
num += chars.substring(rnum,rnum+1)... | [
"function",
"random",
"(",
"_length",
")",
"{",
"var",
"string_length",
"=",
"_length",
";",
"if",
"(",
"string_length",
"<",
"0",
")",
"string_length",
"=",
"1",
";",
"var",
"chars",
"=",
"\"0123456789\"",
";",
"var",
"num",
"=",
"''",
";",
"for",
"("... | Generates a random number of the provided length
@param {int} _length
@api public | [
"Generates",
"a",
"random",
"number",
"of",
"the",
"provided",
"length"
] | 81f8654af6ee922963e6cc3f6cda96ffa75142cf | https://github.com/oscmejia/libs/blob/81f8654af6ee922963e6cc3f6cda96ffa75142cf/lib/libs/number.js#L7-L21 |
47,155 | oscmejia/libs | lib/libs/number.js | randomBetween | function randomBetween(_min, _max) {
var max, min;
if(_min > _max){
min = _max;
max = _min;
}
else if(_min === _max){
return _min;
}
else{
max = _max;
min = _min;
}
var r = Math.floor(Math.random() * max) + min;
if(r > max)
return max;
if(r < min)
return min;
else... | javascript | function randomBetween(_min, _max) {
var max, min;
if(_min > _max){
min = _max;
max = _min;
}
else if(_min === _max){
return _min;
}
else{
max = _max;
min = _min;
}
var r = Math.floor(Math.random() * max) + min;
if(r > max)
return max;
if(r < min)
return min;
else... | [
"function",
"randomBetween",
"(",
"_min",
",",
"_max",
")",
"{",
"var",
"max",
",",
"min",
";",
"if",
"(",
"_min",
">",
"_max",
")",
"{",
"min",
"=",
"_max",
";",
"max",
"=",
"_min",
";",
"}",
"else",
"if",
"(",
"_min",
"===",
"_max",
")",
"{",... | Generates a random number between two numbers
@param {int} _min
@param {int} _max
@api public | [
"Generates",
"a",
"random",
"number",
"between",
"two",
"numbers"
] | 81f8654af6ee922963e6cc3f6cda96ffa75142cf | https://github.com/oscmejia/libs/blob/81f8654af6ee922963e6cc3f6cda96ffa75142cf/lib/libs/number.js#L30-L53 |
47,156 | brewster/imagine | lib/imagine/statsd.js | function (data) {
if (this.silent) {
return;
}
data = this.prefix ? this.prefix + '.' + data : data;
var buffer = new Buffer(data);
this.client.send(buffer, 0, buffer.length, this.port, this.host);
} | javascript | function (data) {
if (this.silent) {
return;
}
data = this.prefix ? this.prefix + '.' + data : data;
var buffer = new Buffer(data);
this.client.send(buffer, 0, buffer.length, this.port, this.host);
} | [
"function",
"(",
"data",
")",
"{",
"if",
"(",
"this",
".",
"silent",
")",
"{",
"return",
";",
"}",
"data",
"=",
"this",
".",
"prefix",
"?",
"this",
".",
"prefix",
"+",
"'.'",
"+",
"data",
":",
"data",
";",
"var",
"buffer",
"=",
"new",
"Buffer",
... | Send a request Do nothing if we've been silenced | [
"Send",
"a",
"request",
"Do",
"nothing",
"if",
"we",
"ve",
"been",
"silenced"
] | 42782ff6365f225f1fb9d90d3a654791286ef023 | https://github.com/brewster/imagine/blob/42782ff6365f225f1fb9d90d3a654791286ef023/lib/imagine/statsd.js#L44-L51 | |
47,157 | bjnortier/lathe | lib/bsp.js | function(obj) {
if (obj instanceof Cell) {
return {
inside: obj.inside
};
} else {
return {
back : serialize(obj.back),
front : serialize(obj.front),
plane: obj.plane,
shp: obj.shp,
complemented: obj.complemented,
};
}
} | javascript | function(obj) {
if (obj instanceof Cell) {
return {
inside: obj.inside
};
} else {
return {
back : serialize(obj.back),
front : serialize(obj.front),
plane: obj.plane,
shp: obj.shp,
complemented: obj.complemented,
};
}
} | [
"function",
"(",
"obj",
")",
"{",
"if",
"(",
"obj",
"instanceof",
"Cell",
")",
"{",
"return",
"{",
"inside",
":",
"obj",
".",
"inside",
"}",
";",
"}",
"else",
"{",
"return",
"{",
"back",
":",
"serialize",
"(",
"obj",
".",
"back",
")",
",",
"front... | Serialize to a non-circular Javascript object | [
"Serialize",
"to",
"a",
"non",
"-",
"circular",
"Javascript",
"object"
] | dca3ff6662fed9160f7b0ac82adad1af254b1147 | https://github.com/bjnortier/lathe/blob/dca3ff6662fed9160f7b0ac82adad1af254b1147/lib/bsp.js#L372-L386 | |
47,158 | zlash/kwyjibo | js/controller.js | Middleware | function Middleware(...middleware) {
return (ctr) => {
if (middleware != undefined) {
let c = exports.globalKCState.getOrInsertController(ctr);
c.middleware = middleware.concat(c.middleware);
}
};
} | javascript | function Middleware(...middleware) {
return (ctr) => {
if (middleware != undefined) {
let c = exports.globalKCState.getOrInsertController(ctr);
c.middleware = middleware.concat(c.middleware);
}
};
} | [
"function",
"Middleware",
"(",
"...",
"middleware",
")",
"{",
"return",
"(",
"ctr",
")",
"=>",
"{",
"if",
"(",
"middleware",
"!=",
"undefined",
")",
"{",
"let",
"c",
"=",
"exports",
".",
"globalKCState",
".",
"getOrInsertController",
"(",
"ctr",
")",
";"... | Adds express middleware to run before mounting the controller
@param { Express.RequestHandler[] } middleware - Array of middleware to add. | [
"Adds",
"express",
"middleware",
"to",
"run",
"before",
"mounting",
"the",
"controller"
] | 466da0e0445f04b48e0e0ff83ecaaa0554114c64 | https://github.com/zlash/kwyjibo/blob/466da0e0445f04b48e0e0ff83ecaaa0554114c64/js/controller.js#L157-L164 |
47,159 | zlash/kwyjibo | js/controller.js | ActionMiddleware | function ActionMiddleware(...middleware) {
return function (target, propertyKey, descriptor) {
if (middleware != undefined) {
let m = exports.globalKCState.getOrInsertController(target.constructor).getOrInsertMethod(propertyKey);
m.middleware = middleware.concat(m.middleware);
... | javascript | function ActionMiddleware(...middleware) {
return function (target, propertyKey, descriptor) {
if (middleware != undefined) {
let m = exports.globalKCState.getOrInsertController(target.constructor).getOrInsertMethod(propertyKey);
m.middleware = middleware.concat(m.middleware);
... | [
"function",
"ActionMiddleware",
"(",
"...",
"middleware",
")",
"{",
"return",
"function",
"(",
"target",
",",
"propertyKey",
",",
"descriptor",
")",
"{",
"if",
"(",
"middleware",
"!=",
"undefined",
")",
"{",
"let",
"m",
"=",
"exports",
".",
"globalKCState",
... | Adds express middleware to run before the method
@param { Express.RequestHandler[] } middleware - Array of middleware to add. | [
"Adds",
"express",
"middleware",
"to",
"run",
"before",
"the",
"method"
] | 466da0e0445f04b48e0e0ff83ecaaa0554114c64 | https://github.com/zlash/kwyjibo/blob/466da0e0445f04b48e0e0ff83ecaaa0554114c64/js/controller.js#L239-L246 |
47,160 | zlash/kwyjibo | js/controller.js | DocAction | function DocAction(docStr) {
return function (target, propertyKey, descriptor) {
let m = exports.globalKCState.getOrInsertController(target.constructor).getOrInsertMethod(propertyKey);
m.docString = docStr;
};
} | javascript | function DocAction(docStr) {
return function (target, propertyKey, descriptor) {
let m = exports.globalKCState.getOrInsertController(target.constructor).getOrInsertMethod(propertyKey);
m.docString = docStr;
};
} | [
"function",
"DocAction",
"(",
"docStr",
")",
"{",
"return",
"function",
"(",
"target",
",",
"propertyKey",
",",
"descriptor",
")",
"{",
"let",
"m",
"=",
"exports",
".",
"globalKCState",
".",
"getOrInsertController",
"(",
"target",
".",
"constructor",
")",
".... | Attach a documentation string to the method
@param {string} docStr - The documentation string. | [
"Attach",
"a",
"documentation",
"string",
"to",
"the",
"method"
] | 466da0e0445f04b48e0e0ff83ecaaa0554114c64 | https://github.com/zlash/kwyjibo/blob/466da0e0445f04b48e0e0ff83ecaaa0554114c64/js/controller.js#L262-L267 |
47,161 | zlash/kwyjibo | js/controller.js | OpenApiResponse | function OpenApiResponse(httpCode, description, type) {
return function (target, propertyKey, descriptor) {
let m = exports.globalKCState.getOrInsertController(target.constructor).getOrInsertMethod(propertyKey);
httpCode = httpCode.toString();
m.openApiResponses[httpCode] = { description: de... | javascript | function OpenApiResponse(httpCode, description, type) {
return function (target, propertyKey, descriptor) {
let m = exports.globalKCState.getOrInsertController(target.constructor).getOrInsertMethod(propertyKey);
httpCode = httpCode.toString();
m.openApiResponses[httpCode] = { description: de... | [
"function",
"OpenApiResponse",
"(",
"httpCode",
",",
"description",
",",
"type",
")",
"{",
"return",
"function",
"(",
"target",
",",
"propertyKey",
",",
"descriptor",
")",
"{",
"let",
"m",
"=",
"exports",
".",
"globalKCState",
".",
"getOrInsertController",
"("... | Attach a OpenApi Response to the method
@param {number|string} httpCode - The http code used for the response
@param {string} description - Response description
@param {string} type - The Open Api defined type. | [
"Attach",
"a",
"OpenApi",
"Response",
"to",
"the",
"method"
] | 466da0e0445f04b48e0e0ff83ecaaa0554114c64 | https://github.com/zlash/kwyjibo/blob/466da0e0445f04b48e0e0ff83ecaaa0554114c64/js/controller.js#L275-L281 |
47,162 | amobiz/json-normalizer | lib/normalize.js | async | function async(schema, values, optionalOptions, callbackFn) {
var options, callback;
options = optionalOptions || {};
callback = callbackFn || optionalOptions;
process.nextTick(_async);
function _async() {
deref(schema, options, function (err, derefSchema) {
var result;
if (err) {
callback(err);
... | javascript | function async(schema, values, optionalOptions, callbackFn) {
var options, callback;
options = optionalOptions || {};
callback = callbackFn || optionalOptions;
process.nextTick(_async);
function _async() {
deref(schema, options, function (err, derefSchema) {
var result;
if (err) {
callback(err);
... | [
"function",
"async",
"(",
"schema",
",",
"values",
",",
"optionalOptions",
",",
"callbackFn",
")",
"{",
"var",
"options",
",",
"callback",
";",
"options",
"=",
"optionalOptions",
"||",
"{",
"}",
";",
"callback",
"=",
"callbackFn",
"||",
"optionalOptions",
";... | Normalizes a loose json data object to a strict json-schema data object.
@context Don't care.
@param schema The schema used to normalize the given JSON data object.
@param data The JSON data object.
@param options Optional. Currently only accepts loader or array of loaders.
@param options.loader | options.loaders A lo... | [
"Normalizes",
"a",
"loose",
"json",
"data",
"object",
"to",
"a",
"strict",
"json",
"-",
"schema",
"data",
"object",
"."
] | 76a8ab1db2da4600dbd28c5c6c7fd11e43c0dd55 | https://github.com/amobiz/json-normalizer/blob/76a8ab1db2da4600dbd28c5c6c7fd11e43c0dd55/lib/normalize.js#L19-L38 |
47,163 | kevva/squeak | index.js | Squeak | function Squeak(opts) {
if (!(this instanceof Squeak)) {
return new Squeak(opts);
}
EventEmitter.call(this);
this.opts = opts || {};
this.align = this.opts.align !== false;
this.indent = this.opts.indent || 2;
this.separator = this.opts.separator || ' : ';
this.stream = this.opts.stream || process.stderr ||... | javascript | function Squeak(opts) {
if (!(this instanceof Squeak)) {
return new Squeak(opts);
}
EventEmitter.call(this);
this.opts = opts || {};
this.align = this.opts.align !== false;
this.indent = this.opts.indent || 2;
this.separator = this.opts.separator || ' : ';
this.stream = this.opts.stream || process.stderr ||... | [
"function",
"Squeak",
"(",
"opts",
")",
"{",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"Squeak",
")",
")",
"{",
"return",
"new",
"Squeak",
"(",
"opts",
")",
";",
"}",
"EventEmitter",
".",
"call",
"(",
"this",
")",
";",
"this",
".",
"opts",
"=",
... | Initialize a new `Squeak`
@param {Object} opts
@api public | [
"Initialize",
"a",
"new",
"Squeak"
] | 5fd68a6e256015bc2bed80a89047629fb6ebfd41 | https://github.com/kevva/squeak/blob/5fd68a6e256015bc2bed80a89047629fb6ebfd41/index.js#L16-L29 |
47,164 | amida-tech/cms-fhir | lib/cmsTxtToIntObj.js | hook | function hook(cps, section) {
var i, len;
if (section["section header"] === "empty") {
if (section["data"]) {
// Guess it's a claim
len = section["data"].length;
for (i = 0; i < len; i++) {
if (section["data"][i]["claim number"]) {
... | javascript | function hook(cps, section) {
var i, len;
if (section["section header"] === "empty") {
if (section["data"]) {
// Guess it's a claim
len = section["data"].length;
for (i = 0; i < len; i++) {
if (section["data"][i]["claim number"]) {
... | [
"function",
"hook",
"(",
"cps",
",",
"section",
")",
"{",
"var",
"i",
",",
"len",
";",
"if",
"(",
"section",
"[",
"\"section header\"",
"]",
"===",
"\"empty\"",
")",
"{",
"if",
"(",
"section",
"[",
"\"data\"",
"]",
")",
"{",
"// Guess it's a claim",
"l... | Massage each section trying to restore a broken structure if any | [
"Massage",
"each",
"section",
"trying",
"to",
"restore",
"a",
"broken",
"structure",
"if",
"any"
] | 34404ea5d9c3c3582ae72b877d9febd703b57d56 | https://github.com/amida-tech/cms-fhir/blob/34404ea5d9c3c3582ae72b877d9febd703b57d56/lib/cmsTxtToIntObj.js#L19-L51 |
47,165 | quorrajs/Positron | lib/view/helpers.js | elixir | function elixir(file, buildDirectory) {
if (!buildDirectory) {
buildDirectory = 'build';
}
var manifestPath = path.join(publicPath(buildDirectory), 'rev-manifest.json');
var manifest = require(manifestPath);
if (isset(manifest[file])) {
return '/'+ str.... | javascript | function elixir(file, buildDirectory) {
if (!buildDirectory) {
buildDirectory = 'build';
}
var manifestPath = path.join(publicPath(buildDirectory), 'rev-manifest.json');
var manifest = require(manifestPath);
if (isset(manifest[file])) {
return '/'+ str.... | [
"function",
"elixir",
"(",
"file",
",",
"buildDirectory",
")",
"{",
"if",
"(",
"!",
"buildDirectory",
")",
"{",
"buildDirectory",
"=",
"'build'",
";",
"}",
"var",
"manifestPath",
"=",
"path",
".",
"join",
"(",
"publicPath",
"(",
"buildDirectory",
")",
",",... | Get the path to a versioned Elixir file.
@param {String} file
@param {String} buildDirectory
@return {String}
@throws Error | [
"Get",
"the",
"path",
"to",
"a",
"versioned",
"Elixir",
"file",
"."
] | a4bad5a5f581743d1885405c11ae26600fb957af | https://github.com/quorrajs/Positron/blob/a4bad5a5f581743d1885405c11ae26600fb957af/lib/view/helpers.js#L22-L37 |
47,166 | Jam3/f1 | lib/parsers/getParser.js | function(states, targets, transitions) {
initMethods.forEach( function(method) {
method(states, targets, transitions);
});
} | javascript | function(states, targets, transitions) {
initMethods.forEach( function(method) {
method(states, targets, transitions);
});
} | [
"function",
"(",
"states",
",",
"targets",
",",
"transitions",
")",
"{",
"initMethods",
".",
"forEach",
"(",
"function",
"(",
"method",
")",
"{",
"method",
"(",
"states",
",",
"targets",
",",
"transitions",
")",
";",
"}",
")",
";",
"}"
] | This will be called when the `f1` instance is initialized.
@param {Object} states states the `f1` instance currently is using
@param {Object} targets targets the `f1` instance currently is using
@param {Array} transitions transitions the `f1` instance currently is using | [
"This",
"will",
"be",
"called",
"when",
"the",
"f1",
"instance",
"is",
"initialized",
"."
] | 31bf0f9f4491f08d8b453aff744ba22ceab94607 | https://github.com/Jam3/f1/blob/31bf0f9f4491f08d8b453aff744ba22ceab94607/lib/parsers/getParser.js#L38-L44 | |
47,167 | jaymell/nodeCf | src/config.js | parseExtraVars | function parseExtraVars(extraVars) {
if (!(_.isString(extraVars))) {
return undefined;
}
const myVars = _.split(extraVars, ' ').map(it => {
const v = _.split(it, '=');
if ( v.length != 2 )
throw new Error("Can't parse variable");
return v;
});
return _.fromPairs(myVars);
} | javascript | function parseExtraVars(extraVars) {
if (!(_.isString(extraVars))) {
return undefined;
}
const myVars = _.split(extraVars, ' ').map(it => {
const v = _.split(it, '=');
if ( v.length != 2 )
throw new Error("Can't parse variable");
return v;
});
return _.fromPairs(myVars);
} | [
"function",
"parseExtraVars",
"(",
"extraVars",
")",
"{",
"if",
"(",
"!",
"(",
"_",
".",
"isString",
"(",
"extraVars",
")",
")",
")",
"{",
"return",
"undefined",
";",
"}",
"const",
"myVars",
"=",
"_",
".",
"split",
"(",
"extraVars",
",",
"' '",
")",
... | given a string of one or more key-value pairs separated by '=', convert and return object | [
"given",
"a",
"string",
"of",
"one",
"or",
"more",
"key",
"-",
"value",
"pairs",
"separated",
"by",
"=",
"convert",
"and",
"return",
"object"
] | d0f499a1b0adf5c810c33698a66ef16db6bc590d | https://github.com/jaymell/nodeCf/blob/d0f499a1b0adf5c810c33698a66ef16db6bc590d/src/config.js#L102-L113 |
47,168 | jaymell/nodeCf | src/config.js | parseArgs | function parseArgs(argv) {
debug('parseArgs argv: ', argv);
// default action
var action = 'deploy';
if ( argv['_'].length >= 1 ) {
action = argv['_'][0];
}
failIfEmpty('e', 'environment', argv);
failIfAbsent('e', 'environment', argv);
if ('s' in argv || 'stacks' in argv) failIfEmpty('s', 'stacks'... | javascript | function parseArgs(argv) {
debug('parseArgs argv: ', argv);
// default action
var action = 'deploy';
if ( argv['_'].length >= 1 ) {
action = argv['_'][0];
}
failIfEmpty('e', 'environment', argv);
failIfAbsent('e', 'environment', argv);
if ('s' in argv || 'stacks' in argv) failIfEmpty('s', 'stacks'... | [
"function",
"parseArgs",
"(",
"argv",
")",
"{",
"debug",
"(",
"'parseArgs argv: '",
",",
"argv",
")",
";",
"// default action",
"var",
"action",
"=",
"'deploy'",
";",
"if",
"(",
"argv",
"[",
"'_'",
"]",
".",
"length",
">=",
"1",
")",
"{",
"action",
"="... | validate command line arguments | [
"validate",
"command",
"line",
"arguments"
] | d0f499a1b0adf5c810c33698a66ef16db6bc590d | https://github.com/jaymell/nodeCf/blob/d0f499a1b0adf5c810c33698a66ef16db6bc590d/src/config.js#L138-L159 |
47,169 | jaymell/nodeCf | src/config.js | loadConfigFile | async function loadConfigFile(filePath) {
const f = await Promise.any(
_.map(['.yml', '.yaml', '.json', ''], async(ext) =>
await utils.fileExists(`${filePath}${ext}`)));
if (f) {
return loadYaml(await fs.readFileAsync(f));
}
return undefined;
} | javascript | async function loadConfigFile(filePath) {
const f = await Promise.any(
_.map(['.yml', '.yaml', '.json', ''], async(ext) =>
await utils.fileExists(`${filePath}${ext}`)));
if (f) {
return loadYaml(await fs.readFileAsync(f));
}
return undefined;
} | [
"async",
"function",
"loadConfigFile",
"(",
"filePath",
")",
"{",
"const",
"f",
"=",
"await",
"Promise",
".",
"any",
"(",
"_",
".",
"map",
"(",
"[",
"'.yml'",
",",
"'.yaml'",
",",
"'.json'",
",",
"''",
"]",
",",
"async",
"(",
"ext",
")",
"=>",
"awa... | if file exists, load it, else return undefined. Iterate through various possible file extensions in attempt to find file. | [
"if",
"file",
"exists",
"load",
"it",
"else",
"return",
"undefined",
".",
"Iterate",
"through",
"various",
"possible",
"file",
"extensions",
"in",
"attempt",
"to",
"find",
"file",
"."
] | d0f499a1b0adf5c810c33698a66ef16db6bc590d | https://github.com/jaymell/nodeCf/blob/d0f499a1b0adf5c810c33698a66ef16db6bc590d/src/config.js#L192-L200 |
47,170 | feedhenry-raincatcher/raincatcher-angularjs | packages/angularjs-auth-keycloak/lib/profileData.js | extractAttributeFields | function extractAttributeFields(attributeFields) {
var attributes = {};
if (attributeFields) {
for (var field in attributeFields) {
if (attributeFields[field].length > 0) {
attributes[field] = attributeFields[field][0];
}
}
}
return attributes;
} | javascript | function extractAttributeFields(attributeFields) {
var attributes = {};
if (attributeFields) {
for (var field in attributeFields) {
if (attributeFields[field].length > 0) {
attributes[field] = attributeFields[field][0];
}
}
}
return attributes;
} | [
"function",
"extractAttributeFields",
"(",
"attributeFields",
")",
"{",
"var",
"attributes",
"=",
"{",
"}",
";",
"if",
"(",
"attributeFields",
")",
"{",
"for",
"(",
"var",
"field",
"in",
"attributeFields",
")",
"{",
"if",
"(",
"attributeFields",
"[",
"field"... | Extract attribute fields from the profile data returned by Keycloak
@param attributeFields - Object which contains all the attributes of a user | [
"Extract",
"attribute",
"fields",
"from",
"the",
"profile",
"data",
"returned",
"by",
"Keycloak"
] | b394689227901e18871ad9edd0ec226c5e6839e1 | https://github.com/feedhenry-raincatcher/raincatcher-angularjs/blob/b394689227901e18871ad9edd0ec226c5e6839e1/packages/angularjs-auth-keycloak/lib/profileData.js#L5-L15 |
47,171 | feedhenry-raincatcher/raincatcher-angularjs | packages/angularjs-auth-keycloak/lib/profileData.js | formatProfileData | function formatProfileData(profileData) {
var profile;
if (profileData) {
profile = extractAttributeFields(profileData.attributes);
profile.username = profileData.username;
profile.email = profileData.email;
}
return profile;
} | javascript | function formatProfileData(profileData) {
var profile;
if (profileData) {
profile = extractAttributeFields(profileData.attributes);
profile.username = profileData.username;
profile.email = profileData.email;
}
return profile;
} | [
"function",
"formatProfileData",
"(",
"profileData",
")",
"{",
"var",
"profile",
";",
"if",
"(",
"profileData",
")",
"{",
"profile",
"=",
"extractAttributeFields",
"(",
"profileData",
".",
"attributes",
")",
";",
"profile",
".",
"username",
"=",
"profileData",
... | Formats profile data as expected by the application
@param profileData - Object which contains the profile data of a user | [
"Formats",
"profile",
"data",
"as",
"expected",
"by",
"the",
"application"
] | b394689227901e18871ad9edd0ec226c5e6839e1 | https://github.com/feedhenry-raincatcher/raincatcher-angularjs/blob/b394689227901e18871ad9edd0ec226c5e6839e1/packages/angularjs-auth-keycloak/lib/profileData.js#L21-L29 |
47,172 | Jam3/f1 | index.js | f1 | function f1(settings) {
if(!(this instanceof f1)) {
return new f1(settings);
}
settings = settings || {};
var emitter = this;
var onUpdate = settings.onUpdate || noop;
var onState = settings.onState || noop;
// this is used to generate a "name" for an f1 instance if one isn't given
numInstances... | javascript | function f1(settings) {
if(!(this instanceof f1)) {
return new f1(settings);
}
settings = settings || {};
var emitter = this;
var onUpdate = settings.onUpdate || noop;
var onState = settings.onState || noop;
// this is used to generate a "name" for an f1 instance if one isn't given
numInstances... | [
"function",
"f1",
"(",
"settings",
")",
"{",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"f1",
")",
")",
"{",
"return",
"new",
"f1",
"(",
"settings",
")",
";",
"}",
"settings",
"=",
"settings",
"||",
"{",
"}",
";",
"var",
"emitter",
"=",
"this",
"... | To construct a new `f1` instance you can do it in two ways.
```javascript
ui = f1([ settigns ]);
```
or
```javascript
ui = new f1([ settings ]);
```
To construct an `f1` instance you can pass in an optional settings object. The following are properties you can pass in settings:
```javascript
{
onState: listenerState,... | [
"To",
"construct",
"a",
"new",
"f1",
"instance",
"you",
"can",
"do",
"it",
"in",
"two",
"ways",
"."
] | 31bf0f9f4491f08d8b453aff744ba22ceab94607 | https://github.com/Jam3/f1/blob/31bf0f9f4491f08d8b453aff744ba22ceab94607/index.js#L75-L138 |
47,173 | Jam3/f1 | index.js | function(transitions) {
this.defTransitions = Array.isArray(transitions) ? transitions : Array.prototype.slice.apply(arguments);
return this;
} | javascript | function(transitions) {
this.defTransitions = Array.isArray(transitions) ? transitions : Array.prototype.slice.apply(arguments);
return this;
} | [
"function",
"(",
"transitions",
")",
"{",
"this",
".",
"defTransitions",
"=",
"Array",
".",
"isArray",
"(",
"transitions",
")",
"?",
"transitions",
":",
"Array",
".",
"prototype",
".",
"slice",
".",
"apply",
"(",
"arguments",
")",
";",
"return",
"this",
... | defines how this `f1` instance can move between states.
For instance if we had two states out and idle you could define your transitions
like this:
```javascript
var ui = require('f1')();
ui.transitions( [
'out', 'idle', // defines that you can go from the out state to the idle state
'idle', 'out' // defines that yo... | [
"defines",
"how",
"this",
"f1",
"instance",
"can",
"move",
"between",
"states",
"."
] | 31bf0f9f4491f08d8b453aff744ba22ceab94607 | https://github.com/Jam3/f1/blob/31bf0f9f4491f08d8b453aff744ba22ceab94607/index.js#L344-L349 | |
47,174 | Jam3/f1 | index.js | function(parsersDefinitions) {
// check that the parsersDefinitions is an object
if(typeof parsersDefinitions !== 'object' || Array.isArray(parsersDefinitions)) {
throw new Error('parsers should be an Object that contains arrays of functions under init and update');
}
this.parser = this.parser |... | javascript | function(parsersDefinitions) {
// check that the parsersDefinitions is an object
if(typeof parsersDefinitions !== 'object' || Array.isArray(parsersDefinitions)) {
throw new Error('parsers should be an Object that contains arrays of functions under init and update');
}
this.parser = this.parser |... | [
"function",
"(",
"parsersDefinitions",
")",
"{",
"// check that the parsersDefinitions is an object",
"if",
"(",
"typeof",
"parsersDefinitions",
"!==",
"'object'",
"||",
"Array",
".",
"isArray",
"(",
"parsersDefinitions",
")",
")",
"{",
"throw",
"new",
"Error",
"(",
... | `f1` can target many different platforms. How it does this is by using parsers which
can target different platforms. Parsers apply calculated state objects to targets.
If working with the dom for instance your state could define values which will be applied
by the parser to the dom elements style object.
When calling... | [
"f1",
"can",
"target",
"many",
"different",
"platforms",
".",
"How",
"it",
"does",
"this",
"is",
"by",
"using",
"parsers",
"which",
"can",
"target",
"different",
"platforms",
".",
"Parsers",
"apply",
"calculated",
"state",
"objects",
"to",
"targets",
"."
] | 31bf0f9f4491f08d8b453aff744ba22ceab94607 | https://github.com/Jam3/f1/blob/31bf0f9f4491f08d8b453aff744ba22ceab94607/index.js#L368-L380 | |
47,175 | Jam3/f1 | index.js | function(initState) {
if(!this.isInitialized) {
this.isInitialized = true;
var driver = this.driver;
if(!this.defStates) {
throw new Error('You must define states before attempting to call init');
} else if(!this.defTransitions) {
throw new Error('You must define transit... | javascript | function(initState) {
if(!this.isInitialized) {
this.isInitialized = true;
var driver = this.driver;
if(!this.defStates) {
throw new Error('You must define states before attempting to call init');
} else if(!this.defTransitions) {
throw new Error('You must define transit... | [
"function",
"(",
"initState",
")",
"{",
"if",
"(",
"!",
"this",
".",
"isInitialized",
")",
"{",
"this",
".",
"isInitialized",
"=",
"true",
";",
"var",
"driver",
"=",
"this",
".",
"driver",
";",
"if",
"(",
"!",
"this",
".",
"defStates",
")",
"{",
"t... | Initializes `f1`. `init` will throw errors if required parameters such as
states and transitions are missing. The initial state for the `f1` instance
should be passed in.
@param {String} Initial state for the `f1` instance
@chainable | [
"Initializes",
"f1",
".",
"init",
"will",
"throw",
"errors",
"if",
"required",
"parameters",
"such",
"as",
"states",
"and",
"transitions",
"are",
"missing",
".",
"The",
"initial",
"state",
"for",
"the",
"f1",
"instance",
"should",
"be",
"passed",
"in",
"."
] | 31bf0f9f4491f08d8b453aff744ba22ceab94607 | https://github.com/Jam3/f1/blob/31bf0f9f4491f08d8b453aff744ba22ceab94607/index.js#L390-L425 | |
47,176 | Jam3/f1 | index.js | function(pathToTarget, target, parserDefinition) {
var data = this.data;
var parser = this.parser;
var animationData;
// if parse functions were passed in then create a new parser
if(parserDefinition) {
parser = new getParser(parserDefinition);
}
// if we have a parser then apply t... | javascript | function(pathToTarget, target, parserDefinition) {
var data = this.data;
var parser = this.parser;
var animationData;
// if parse functions were passed in then create a new parser
if(parserDefinition) {
parser = new getParser(parserDefinition);
}
// if we have a parser then apply t... | [
"function",
"(",
"pathToTarget",
",",
"target",
",",
"parserDefinition",
")",
"{",
"var",
"data",
"=",
"this",
".",
"data",
";",
"var",
"parser",
"=",
"this",
".",
"parser",
";",
"var",
"animationData",
";",
"// if parse functions were passed in then create a new ... | An advanced method where you can apply the current state f1
has calculated to any object.
Basically allows you to have one f1 object control multiple objects
or manually apply animations to objects.
@param {String} pathToTarget A path in the current state to the object you'd like to apply. The path should
be defined... | [
"An",
"advanced",
"method",
"where",
"you",
"can",
"apply",
"the",
"current",
"state",
"f1",
"has",
"calculated",
"to",
"any",
"object",
"."
] | 31bf0f9f4491f08d8b453aff744ba22ceab94607 | https://github.com/Jam3/f1/blob/31bf0f9f4491f08d8b453aff744ba22ceab94607/index.js#L510-L539 | |
47,177 | freshout-dev/thulium | etc/EJS/EJS.js | function(options){
this.type = options.type || EJS.type;
this.cache = options.cache != null ? options.cache : EJS.cache;
this.text = options.text || null;
this.name = options.name || null;
this.ext = options.ext || EJS.ext;
this.extMatch = new RegExp(this.ext.replace(/\./, '\.'));
} | javascript | function(options){
this.type = options.type || EJS.type;
this.cache = options.cache != null ? options.cache : EJS.cache;
this.text = options.text || null;
this.name = options.name || null;
this.ext = options.ext || EJS.ext;
this.extMatch = new RegExp(this.ext.replace(/\./, '\.'));
} | [
"function",
"(",
"options",
")",
"{",
"this",
".",
"type",
"=",
"options",
".",
"type",
"||",
"EJS",
".",
"type",
";",
"this",
".",
"cache",
"=",
"options",
".",
"cache",
"!=",
"null",
"?",
"options",
".",
"cache",
":",
"EJS",
".",
"cache",
";",
... | Sets options on this view to be rendered with.
@param {Object} options | [
"Sets",
"options",
"on",
"this",
"view",
"to",
"be",
"rendered",
"with",
"."
] | ba3173e700fbe810ce13063e7ad46e9b05bb49e7 | https://github.com/freshout-dev/thulium/blob/ba3173e700fbe810ce13063e7ad46e9b05bb49e7/etc/EJS/EJS.js#L128-L135 | |
47,178 | chjj/rondo | lib/ev.js | function(el, type, event) {
if (!el) {
// emit for ALL elements
el = document.getElementsByTagName('*');
var i = el.length;
while (i--) if (el[i].nodeType === 1) {
emit(el[i], type, event);
}
return;
}
event = event || {};
event.target = event.target || el;
event.type = event.ty... | javascript | function(el, type, event) {
if (!el) {
// emit for ALL elements
el = document.getElementsByTagName('*');
var i = el.length;
while (i--) if (el[i].nodeType === 1) {
emit(el[i], type, event);
}
return;
}
event = event || {};
event.target = event.target || el;
event.type = event.ty... | [
"function",
"(",
"el",
",",
"type",
",",
"event",
")",
"{",
"if",
"(",
"!",
"el",
")",
"{",
"// emit for ALL elements",
"el",
"=",
"document",
".",
"getElementsByTagName",
"(",
"'*'",
")",
";",
"var",
"i",
"=",
"el",
".",
"length",
";",
"while",
"(",... | emit a custom or native event, simulate bubbling | [
"emit",
"a",
"custom",
"or",
"native",
"event",
"simulate",
"bubbling"
] | 5a0643a2e4ce74e25240517e1cf423df5a188008 | https://github.com/chjj/rondo/blob/5a0643a2e4ce74e25240517e1cf423df5a188008/lib/ev.js#L366-L397 | |
47,179 | parsnick/laravel-elixir-bowerbundle | src/Package.js | Package | function Package(name)
{
var dotBowerJson = Package._readBowerJson(name) || {};
var overrides = globalOverrides[name] || {};
this.name = name;
this.installed = !! dotBowerJson.name;
this.main = overrides.main || dotBowerJson.main || [];
this.depend... | javascript | function Package(name)
{
var dotBowerJson = Package._readBowerJson(name) || {};
var overrides = globalOverrides[name] || {};
this.name = name;
this.installed = !! dotBowerJson.name;
this.main = overrides.main || dotBowerJson.main || [];
this.depend... | [
"function",
"Package",
"(",
"name",
")",
"{",
"var",
"dotBowerJson",
"=",
"Package",
".",
"_readBowerJson",
"(",
"name",
")",
"||",
"{",
"}",
";",
"var",
"overrides",
"=",
"globalOverrides",
"[",
"name",
"]",
"||",
"{",
"}",
";",
"this",
".",
"name",
... | Constructor for Package
@param {string} name | [
"Constructor",
"for",
"Package"
] | f6e7df503b4abec1c721a8b56b508162f714dd71 | https://github.com/parsnick/laravel-elixir-bowerbundle/blob/f6e7df503b4abec1c721a8b56b508162f714dd71/src/Package.js#L13-L22 |
47,180 | quorrajs/Positron | lib/http/SessionMiddleware.js | StartSession | function StartSession(app, next) {
this.__app = app;
this.__next = next;
/**
* Session config
*/
this.__config = this.__app.config.get('session');
this.sessionHandler = app.sessionHandler;
} | javascript | function StartSession(app, next) {
this.__app = app;
this.__next = next;
/**
* Session config
*/
this.__config = this.__app.config.get('session');
this.sessionHandler = app.sessionHandler;
} | [
"function",
"StartSession",
"(",
"app",
",",
"next",
")",
"{",
"this",
".",
"__app",
"=",
"app",
";",
"this",
".",
"__next",
"=",
"next",
";",
"/**\n * Session config\n */",
"this",
".",
"__config",
"=",
"this",
".",
"__app",
".",
"config",
".",
... | SessionMiddleware.js
@author: Harish Anchu <harishanchu@gmail.com>
@copyright Copyright (c) 2015-2016, QuorraJS.
@license See LICENSE.txt | [
"SessionMiddleware",
".",
"js"
] | a4bad5a5f581743d1885405c11ae26600fb957af | https://github.com/quorrajs/Positron/blob/a4bad5a5f581743d1885405c11ae26600fb957af/lib/http/SessionMiddleware.js#L9-L19 |
47,181 | feedhenry-raincatcher/raincatcher-angularjs | packages/angularjs-workflow/lib/workflow-process/workflow-process-steps/workflow-process-steps-controller.js | WorkflowProcessStepsController | function WorkflowProcessStepsController($scope, $state, wfmService, $timeout, $stateParams) {
var self = this;
var workorderId = $stateParams.workorderId;
function updateWorkflowState(workorder) {
//If the workflow is complete, then we can switch to the summary view.
if (wfmService.isCompleted(workorder)... | javascript | function WorkflowProcessStepsController($scope, $state, wfmService, $timeout, $stateParams) {
var self = this;
var workorderId = $stateParams.workorderId;
function updateWorkflowState(workorder) {
//If the workflow is complete, then we can switch to the summary view.
if (wfmService.isCompleted(workorder)... | [
"function",
"WorkflowProcessStepsController",
"(",
"$scope",
",",
"$state",
",",
"wfmService",
",",
"$timeout",
",",
"$stateParams",
")",
"{",
"var",
"self",
"=",
"this",
";",
"var",
"workorderId",
"=",
"$stateParams",
".",
"workorderId",
";",
"function",
"updat... | Lots of this will move to core.
Here, we render the current step of the workflow to the user.
@param $scope
@param $state
@param wfmService
@param $timeout
@param $stateParams
@constructor | [
"Lots",
"of",
"this",
"will",
"move",
"to",
"core",
"."
] | b394689227901e18871ad9edd0ec226c5e6839e1 | https://github.com/feedhenry-raincatcher/raincatcher-angularjs/blob/b394689227901e18871ad9edd0ec226c5e6839e1/packages/angularjs-workflow/lib/workflow-process/workflow-process-steps/workflow-process-steps-controller.js#L16-L60 |
47,182 | chjj/rondo | lib/zest.js | function(sel) {
var cap, param;
if (typeof sel !== 'string') {
if (sel.length > 1) {
var func = []
, i = 0
, l = sel.length;
for (; i < l; i++) {
func.push(parse(sel[i]));
}
l = func.length;
return function(el) {
for (i = 0; i < l; i++) {
... | javascript | function(sel) {
var cap, param;
if (typeof sel !== 'string') {
if (sel.length > 1) {
var func = []
, i = 0
, l = sel.length;
for (; i < l; i++) {
func.push(parse(sel[i]));
}
l = func.length;
return function(el) {
for (i = 0; i < l; i++) {
... | [
"function",
"(",
"sel",
")",
"{",
"var",
"cap",
",",
"param",
";",
"if",
"(",
"typeof",
"sel",
"!==",
"'string'",
")",
"{",
"if",
"(",
"sel",
".",
"length",
">",
"1",
")",
"{",
"var",
"func",
"=",
"[",
"]",
",",
"i",
"=",
"0",
",",
"l",
"="... | Parsing
parse simple selectors, return a `test` | [
"Parsing",
"parse",
"simple",
"selectors",
"return",
"a",
"test"
] | 5a0643a2e4ce74e25240517e1cf423df5a188008 | https://github.com/chjj/rondo/blob/5a0643a2e4ce74e25240517e1cf423df5a188008/lib/zest.js#L279-L317 | |
47,183 | chjj/rondo | lib/zest.js | function(sel) {
var filter = []
, comb = combinators.noop
, qname
, cap
, op
, len;
// add implicit universal selectors
sel = sel.replace(/(^|\s)(:|\[|\.|#)/g, '$1*$2');
while (cap = /\s*((?:\w+|\*)(?:[.#:][^\s]+|\[[^\]]+\])*)\s*$/.exec(sel)) {
len = sel.length - cap[0].length;
cap... | javascript | function(sel) {
var filter = []
, comb = combinators.noop
, qname
, cap
, op
, len;
// add implicit universal selectors
sel = sel.replace(/(^|\s)(:|\[|\.|#)/g, '$1*$2');
while (cap = /\s*((?:\w+|\*)(?:[.#:][^\s]+|\[[^\]]+\])*)\s*$/.exec(sel)) {
len = sel.length - cap[0].length;
cap... | [
"function",
"(",
"sel",
")",
"{",
"var",
"filter",
"=",
"[",
"]",
",",
"comb",
"=",
"combinators",
".",
"noop",
",",
"qname",
",",
"cap",
",",
"op",
",",
"len",
";",
"// add implicit universal selectors",
"sel",
"=",
"sel",
".",
"replace",
"(",
"/",
... | parse and compile the selector into a single filter function | [
"parse",
"and",
"compile",
"the",
"selector",
"into",
"a",
"single",
"filter",
"function"
] | 5a0643a2e4ce74e25240517e1cf423df5a188008 | https://github.com/chjj/rondo/blob/5a0643a2e4ce74e25240517e1cf423df5a188008/lib/zest.js#L321-L355 | |
47,184 | IonicaBizau/node-levenshtein-array | lib/index.js | LevArray | function LevArray (data, str) {
var result = [];
for (var i = 0; i < data.length; ++i) {
var cWord = data[i];
result.push({
l: LevDist(cWord, str)
, w: cWord
});
}
result.sort(function (a, b) {
return a.l > b.l ? 1 : -1;
});
return result;
} | javascript | function LevArray (data, str) {
var result = [];
for (var i = 0; i < data.length; ++i) {
var cWord = data[i];
result.push({
l: LevDist(cWord, str)
, w: cWord
});
}
result.sort(function (a, b) {
return a.l > b.l ? 1 : -1;
});
return result;
} | [
"function",
"LevArray",
"(",
"data",
",",
"str",
")",
"{",
"var",
"result",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"data",
".",
"length",
";",
"++",
"i",
")",
"{",
"var",
"cWord",
"=",
"data",
"[",
"i",
"]",
";... | LevArray
Finds the Levenshtein distance of an array, sorting it then.
@name LevArray
@function
@param {Array} data An array of strings.
@param {String} str The searched string.
@return {Array} An array of objects like this (it's sorted by levdist):
- `l` (Number): The Levenshtein distance value.
- `w` (String): The w... | [
"LevArray",
"Finds",
"the",
"Levenshtein",
"distance",
"of",
"an",
"array",
"sorting",
"it",
"then",
"."
] | d833b32773934ecc52477bcf7ae4ad2b228d8097 | https://github.com/IonicaBizau/node-levenshtein-array/blob/d833b32773934ecc52477bcf7ae4ad2b228d8097/lib/index.js#L17-L30 |
47,185 | StefanoVollono/angular-select | github-page/main.min.js | function () {
return $http({
method: 'GET',
url: 'https://api.punkapi.com/v2/beers'
}).then(function (response) {
var beerArray = response.data;
var newBeerArray = [];
beerArray.forEach( function (arrayItem) {
... | javascript | function () {
return $http({
method: 'GET',
url: 'https://api.punkapi.com/v2/beers'
}).then(function (response) {
var beerArray = response.data;
var newBeerArray = [];
beerArray.forEach( function (arrayItem) {
... | [
"function",
"(",
")",
"{",
"return",
"$http",
"(",
"{",
"method",
":",
"'GET'",
",",
"url",
":",
"'https://api.punkapi.com/v2/beers'",
"}",
")",
".",
"then",
"(",
"function",
"(",
"response",
")",
"{",
"var",
"beerArray",
"=",
"response",
".",
"data",
";... | Get beer list from service | [
"Get",
"beer",
"list",
"from",
"service"
] | b62dc06976b22a39bedadc1b67aa2039b73d8540 | https://github.com/StefanoVollono/angular-select/blob/b62dc06976b22a39bedadc1b67aa2039b73d8540/github-page/main.min.js#L43791-L43810 | |
47,186 | quorrajs/Positron | lib/routing/routeCompiler.js | findNextSeparator | function findNextSeparator(pattern) {
if ('' == pattern) {
// return empty string if pattern is empty or false (false which can be returned by substr)
return '';
}
// first remove all placeholders from the pattern so we can find the next real static character
pattern = pattern.replace(/\... | javascript | function findNextSeparator(pattern) {
if ('' == pattern) {
// return empty string if pattern is empty or false (false which can be returned by substr)
return '';
}
// first remove all placeholders from the pattern so we can find the next real static character
pattern = pattern.replace(/\... | [
"function",
"findNextSeparator",
"(",
"pattern",
")",
"{",
"if",
"(",
"''",
"==",
"pattern",
")",
"{",
"// return empty string if pattern is empty or false (false which can be returned by substr)",
"return",
"''",
";",
"}",
"// first remove all placeholders from the pattern so we... | Returns the next static character in the Route pattern that will serve as a separator.
@param {String} pattern The route pattern
@return string The next static character that functions as separator (or empty string when none available) | [
"Returns",
"the",
"next",
"static",
"character",
"in",
"the",
"Route",
"pattern",
"that",
"will",
"serve",
"as",
"a",
"separator",
"."
] | a4bad5a5f581743d1885405c11ae26600fb957af | https://github.com/quorrajs/Positron/blob/a4bad5a5f581743d1885405c11ae26600fb957af/lib/routing/routeCompiler.js#L126-L135 |
47,187 | quorrajs/Positron | lib/routing/routeCompiler.js | computeRegexp | function computeRegexp(tokens, index, firstOptional) {
var token = tokens[index];
if ('text' === token[0]) {
// Text tokens
return str.regexQuote(token[1]);
} else {
// Variable tokens
if (0 === index && 0 === firstOptional) {
// When the only token is an optional... | javascript | function computeRegexp(tokens, index, firstOptional) {
var token = tokens[index];
if ('text' === token[0]) {
// Text tokens
return str.regexQuote(token[1]);
} else {
// Variable tokens
if (0 === index && 0 === firstOptional) {
// When the only token is an optional... | [
"function",
"computeRegexp",
"(",
"tokens",
",",
"index",
",",
"firstOptional",
")",
"{",
"var",
"token",
"=",
"tokens",
"[",
"index",
"]",
";",
"if",
"(",
"'text'",
"===",
"token",
"[",
"0",
"]",
")",
"{",
"// Text tokens",
"return",
"str",
".",
"rege... | Computes the regexp used to match a specific token. It can be static text or a subpattern.
@param {Array} tokens The route tokens
@param {Number} index The index of the current token
@param {Number} firstOptional The index of the first optional token
@return string The regexp pattern for a single toke... | [
"Computes",
"the",
"regexp",
"used",
"to",
"match",
"a",
"specific",
"token",
".",
"It",
"can",
"be",
"static",
"text",
"or",
"a",
"subpattern",
"."
] | a4bad5a5f581743d1885405c11ae26600fb957af | https://github.com/quorrajs/Positron/blob/a4bad5a5f581743d1885405c11ae26600fb957af/lib/routing/routeCompiler.js#L145-L172 |
47,188 | quorrajs/Positron | lib/routing/routeCompiler.js | function (route) {
var staticPrefix = null;
var hostVariables = [];
var pathVariables = [];
var variables = [];
var tokens = [];
var regex = null;
var hostRegex = null;
var hostTokens = [];
var host;
if ('' !== (host = route.domain())) {
... | javascript | function (route) {
var staticPrefix = null;
var hostVariables = [];
var pathVariables = [];
var variables = [];
var tokens = [];
var regex = null;
var hostRegex = null;
var hostTokens = [];
var host;
if ('' !== (host = route.domain())) {
... | [
"function",
"(",
"route",
")",
"{",
"var",
"staticPrefix",
"=",
"null",
";",
"var",
"hostVariables",
"=",
"[",
"]",
";",
"var",
"pathVariables",
"=",
"[",
"]",
";",
"var",
"variables",
"=",
"[",
"]",
";",
"var",
"tokens",
"=",
"[",
"]",
";",
"var",... | Compiles the current route instance.
@param route A Route instance
@return CompiledRoute A CompiledRoute instance | [
"Compiles",
"the",
"current",
"route",
"instance",
"."
] | a4bad5a5f581743d1885405c11ae26600fb957af | https://github.com/quorrajs/Positron/blob/a4bad5a5f581743d1885405c11ae26600fb957af/lib/routing/routeCompiler.js#L182-L225 | |
47,189 | quorrajs/Positron | lib/support/utils.js | acceptParams | function acceptParams(str, index) {
var parts = str.split(/ *; */);
var ret = {value: parts[0], quality: 1, params: {}, originalIndex: index};
for (var i = 1; i < parts.length; ++i) {
var pms = parts[i].split(/ *= */);
if ('q' == pms[0]) {
ret.quality = parseFloat(pms[1]);
... | javascript | function acceptParams(str, index) {
var parts = str.split(/ *; */);
var ret = {value: parts[0], quality: 1, params: {}, originalIndex: index};
for (var i = 1; i < parts.length; ++i) {
var pms = parts[i].split(/ *= */);
if ('q' == pms[0]) {
ret.quality = parseFloat(pms[1]);
... | [
"function",
"acceptParams",
"(",
"str",
",",
"index",
")",
"{",
"var",
"parts",
"=",
"str",
".",
"split",
"(",
"/",
" *; *",
"/",
")",
";",
"var",
"ret",
"=",
"{",
"value",
":",
"parts",
"[",
"0",
"]",
",",
"quality",
":",
"1",
",",
"params",
"... | Parse accept params `str` returning an
object with `.value`, `.quality` and `.params`.
also includes `.originalIndex` for stable sorting
@param {String} str
@return {Object} | [
"Parse",
"accept",
"params",
"str",
"returning",
"an",
"object",
"with",
".",
"value",
".",
"quality",
"and",
".",
"params",
".",
"also",
"includes",
".",
"originalIndex",
"for",
"stable",
"sorting"
] | a4bad5a5f581743d1885405c11ae26600fb957af | https://github.com/quorrajs/Positron/blob/a4bad5a5f581743d1885405c11ae26600fb957af/lib/support/utils.js#L282-L296 |
47,190 | smikes/pure-fts | lib/thaw.js | parseJSON | function parseJSON(buf, cb) {
try {
cb(null, JSON.parse(buf));
} catch (err) {
return cb(err);
}
} | javascript | function parseJSON(buf, cb) {
try {
cb(null, JSON.parse(buf));
} catch (err) {
return cb(err);
}
} | [
"function",
"parseJSON",
"(",
"buf",
",",
"cb",
")",
"{",
"try",
"{",
"cb",
"(",
"null",
",",
"JSON",
".",
"parse",
"(",
"buf",
")",
")",
";",
"}",
"catch",
"(",
"err",
")",
"{",
"return",
"cb",
"(",
"err",
")",
";",
"}",
"}"
] | convert thrown exceptions into callback err | [
"convert",
"thrown",
"exceptions",
"into",
"callback",
"err"
] | 157db4136d3e99f00e1791a070f7fd64c7eadfb6 | https://github.com/smikes/pure-fts/blob/157db4136d3e99f00e1791a070f7fd64c7eadfb6/lib/thaw.js#L46-L52 |
47,191 | mikesamuel/pug-plugin-trusted-types | packages/plugin/index.js | multiMapSet | function multiMapSet(multimap, key, value) {
if (!multimap.has(key)) {
multimap.set(key, new Set());
}
const values = multimap.get(key);
if (!values.has(value)) {
values.add(value);
return true;
}
return false;
} | javascript | function multiMapSet(multimap, key, value) {
if (!multimap.has(key)) {
multimap.set(key, new Set());
}
const values = multimap.get(key);
if (!values.has(value)) {
values.add(value);
return true;
}
return false;
} | [
"function",
"multiMapSet",
"(",
"multimap",
",",
"key",
",",
"value",
")",
"{",
"if",
"(",
"!",
"multimap",
".",
"has",
"(",
"key",
")",
")",
"{",
"multimap",
".",
"set",
"(",
"key",
",",
"new",
"Set",
"(",
")",
")",
";",
"}",
"const",
"values",
... | Given a multimap that uses sets to collect values,
adds the value to the set for the given key. | [
"Given",
"a",
"multimap",
"that",
"uses",
"sets",
"to",
"collect",
"values",
"adds",
"the",
"value",
"to",
"the",
"set",
"for",
"the",
"given",
"key",
"."
] | 772c5aa30ca27d46dfddd654d7a60f16fa4519d6 | https://github.com/mikesamuel/pug-plugin-trusted-types/blob/772c5aa30ca27d46dfddd654d7a60f16fa4519d6/packages/plugin/index.js#L41-L51 |
47,192 | mikesamuel/pug-plugin-trusted-types | packages/plugin/index.js | transitiveClosure | function transitiveClosure(nodeLabels, graph) {
let madeProgress = false;
do {
madeProgress = false;
for (const [ src, values ] of Array.from(nodeLabels.entries())) {
const targets = graph[src];
if (targets) {
for (const target of targets) {
for (const value of values) {
... | javascript | function transitiveClosure(nodeLabels, graph) {
let madeProgress = false;
do {
madeProgress = false;
for (const [ src, values ] of Array.from(nodeLabels.entries())) {
const targets = graph[src];
if (targets) {
for (const target of targets) {
for (const value of values) {
... | [
"function",
"transitiveClosure",
"(",
"nodeLabels",
",",
"graph",
")",
"{",
"let",
"madeProgress",
"=",
"false",
";",
"do",
"{",
"madeProgress",
"=",
"false",
";",
"for",
"(",
"const",
"[",
"src",
",",
"values",
"]",
"of",
"Array",
".",
"from",
"(",
"n... | Given a set of graph nodes to labels, propagates labels to
across edges.
@param nodeLabels a Map of nodes to labels. Modified in place.
@param graph an adjacency table such that graph[src] is a series of targets,
nodes adjacent to src. | [
"Given",
"a",
"set",
"of",
"graph",
"nodes",
"to",
"labels",
"propagates",
"labels",
"to",
"across",
"edges",
"."
] | 772c5aa30ca27d46dfddd654d7a60f16fa4519d6 | https://github.com/mikesamuel/pug-plugin-trusted-types/blob/772c5aa30ca27d46dfddd654d7a60f16fa4519d6/packages/plugin/index.js#L61-L76 |
47,193 | mikesamuel/pug-plugin-trusted-types | packages/plugin/index.js | distrust | function distrust(msg, optAstNode) {
const { filename, line } = optAstNode || policyPath[policyPath.length - 2] || {};
const relfilename = options.basedir ? path.relative(options.basedir, filename) : filename;
report(`${ relfilename }:${ line }: ${ msg }`);
mayTrustOutput = false;
} | javascript | function distrust(msg, optAstNode) {
const { filename, line } = optAstNode || policyPath[policyPath.length - 2] || {};
const relfilename = options.basedir ? path.relative(options.basedir, filename) : filename;
report(`${ relfilename }:${ line }: ${ msg }`);
mayTrustOutput = false;
} | [
"function",
"distrust",
"(",
"msg",
",",
"optAstNode",
")",
"{",
"const",
"{",
"filename",
",",
"line",
"}",
"=",
"optAstNode",
"||",
"policyPath",
"[",
"policyPath",
".",
"length",
"-",
"2",
"]",
"||",
"{",
"}",
";",
"const",
"relfilename",
"=",
"opti... | Logs a message and flips a bit so that we do not bless the output of this template. | [
"Logs",
"a",
"message",
"and",
"flips",
"a",
"bit",
"so",
"that",
"we",
"do",
"not",
"bless",
"the",
"output",
"of",
"this",
"template",
"."
] | 772c5aa30ca27d46dfddd654d7a60f16fa4519d6 | https://github.com/mikesamuel/pug-plugin-trusted-types/blob/772c5aa30ca27d46dfddd654d7a60f16fa4519d6/packages/plugin/index.js#L150-L155 |
47,194 | mikesamuel/pug-plugin-trusted-types | packages/plugin/index.js | getContainerName | function getContainerName(skip = 0) {
let element = null;
let mixin = null;
for (let i = policyPath.length - (skip * 2); (i -= 2) >= 0;) {
const policyPathElement = policyPath[i];
if (typeof policyPathElement === 'object') {
if (policyPathElement.type === 'Tag') {
... | javascript | function getContainerName(skip = 0) {
let element = null;
let mixin = null;
for (let i = policyPath.length - (skip * 2); (i -= 2) >= 0;) {
const policyPathElement = policyPath[i];
if (typeof policyPathElement === 'object') {
if (policyPathElement.type === 'Tag') {
... | [
"function",
"getContainerName",
"(",
"skip",
"=",
"0",
")",
"{",
"let",
"element",
"=",
"null",
";",
"let",
"mixin",
"=",
"null",
";",
"for",
"(",
"let",
"i",
"=",
"policyPath",
".",
"length",
"-",
"(",
"skip",
"*",
"2",
")",
";",
"(",
"i",
"-=",... | Walk upwards to find the enclosing tag and mixin if any. | [
"Walk",
"upwards",
"to",
"find",
"the",
"enclosing",
"tag",
"and",
"mixin",
"if",
"any",
"."
] | 772c5aa30ca27d46dfddd654d7a60f16fa4519d6 | https://github.com/mikesamuel/pug-plugin-trusted-types/blob/772c5aa30ca27d46dfddd654d7a60f16fa4519d6/packages/plugin/index.js#L158-L174 |
47,195 | mikesamuel/pug-plugin-trusted-types | packages/plugin/index.js | addGuard | function addGuard(guard, expr) {
let safeExpr = null;
if (!isWellFormed(expr)) {
expr = '{/*Malformed Expression*/}';
}
needsRuntime = true;
safeExpr = ` rt_${ unpredictableSuffix }.${ guard }(${ expr }) `;
return safeExpr;
} | javascript | function addGuard(guard, expr) {
let safeExpr = null;
if (!isWellFormed(expr)) {
expr = '{/*Malformed Expression*/}';
}
needsRuntime = true;
safeExpr = ` rt_${ unpredictableSuffix }.${ guard }(${ expr }) `;
return safeExpr;
} | [
"function",
"addGuard",
"(",
"guard",
",",
"expr",
")",
"{",
"let",
"safeExpr",
"=",
"null",
";",
"if",
"(",
"!",
"isWellFormed",
"(",
"expr",
")",
")",
"{",
"expr",
"=",
"'{/*Malformed Expression*/}'",
";",
"}",
"needsRuntime",
"=",
"true",
";",
"safeEx... | Decorate expression text with a call to a guard function. | [
"Decorate",
"expression",
"text",
"with",
"a",
"call",
"to",
"a",
"guard",
"function",
"."
] | 772c5aa30ca27d46dfddd654d7a60f16fa4519d6 | https://github.com/mikesamuel/pug-plugin-trusted-types/blob/772c5aa30ca27d46dfddd654d7a60f16fa4519d6/packages/plugin/index.js#L235-L243 |
47,196 | mikesamuel/pug-plugin-trusted-types | packages/plugin/index.js | addScrubber | function addScrubber(scrubber, element, expr) {
let safeExpr = null;
if (!isWellFormed(expr)) {
expr = '{/*Malformed Expression*/}';
}
needsScrubber = true;
safeExpr = ` sc_${ unpredictableSuffix }.${ scrubber }(${ stringify(element || '*') }, ${ expr }) `;
return safeExpr;
... | javascript | function addScrubber(scrubber, element, expr) {
let safeExpr = null;
if (!isWellFormed(expr)) {
expr = '{/*Malformed Expression*/}';
}
needsScrubber = true;
safeExpr = ` sc_${ unpredictableSuffix }.${ scrubber }(${ stringify(element || '*') }, ${ expr }) `;
return safeExpr;
... | [
"function",
"addScrubber",
"(",
"scrubber",
",",
"element",
",",
"expr",
")",
"{",
"let",
"safeExpr",
"=",
"null",
";",
"if",
"(",
"!",
"isWellFormed",
"(",
"expr",
")",
")",
"{",
"expr",
"=",
"'{/*Malformed Expression*/}'",
";",
"}",
"needsScrubber",
"=",... | Decorate expression text with a call to a scrubber function that checks an entire attribute bundle at runtime. | [
"Decorate",
"expression",
"text",
"with",
"a",
"call",
"to",
"a",
"scrubber",
"function",
"that",
"checks",
"an",
"entire",
"attribute",
"bundle",
"at",
"runtime",
"."
] | 772c5aa30ca27d46dfddd654d7a60f16fa4519d6 | https://github.com/mikesamuel/pug-plugin-trusted-types/blob/772c5aa30ca27d46dfddd654d7a60f16fa4519d6/packages/plugin/index.js#L247-L255 |
47,197 | mikesamuel/pug-plugin-trusted-types | packages/plugin/index.js | checkCodeDoesNotInterfere | function checkCodeDoesNotInterfere(astNode, exprKey, isExpression) {
let expr = astNode[exprKey];
const seen = new Set();
const type = typeof expr;
if (type !== 'string') {
// expr may be true, not "true".
// This occurs for inferred expressions like valueless attributes.
... | javascript | function checkCodeDoesNotInterfere(astNode, exprKey, isExpression) {
let expr = astNode[exprKey];
const seen = new Set();
const type = typeof expr;
if (type !== 'string') {
// expr may be true, not "true".
// This occurs for inferred expressions like valueless attributes.
... | [
"function",
"checkCodeDoesNotInterfere",
"(",
"astNode",
",",
"exprKey",
",",
"isExpression",
")",
"{",
"let",
"expr",
"=",
"astNode",
"[",
"exprKey",
"]",
";",
"const",
"seen",
"=",
"new",
"Set",
"(",
")",
";",
"const",
"type",
"=",
"typeof",
"expr",
";... | If user expressions have free variables like pug_html then don't bless the output because we'd have to statically analyze the generated JS to preserve output integrity. | [
"If",
"user",
"expressions",
"have",
"free",
"variables",
"like",
"pug_html",
"then",
"don",
"t",
"bless",
"the",
"output",
"because",
"we",
"d",
"have",
"to",
"statically",
"analyze",
"the",
"generated",
"JS",
"to",
"preserve",
"output",
"integrity",
"."
] | 772c5aa30ca27d46dfddd654d7a60f16fa4519d6 | https://github.com/mikesamuel/pug-plugin-trusted-types/blob/772c5aa30ca27d46dfddd654d7a60f16fa4519d6/packages/plugin/index.js#L281-L349 |
47,198 | mikesamuel/pug-plugin-trusted-types | packages/plugin/index.js | noncifyAttrs | function noncifyAttrs(element, getValue, attrs) {
if (nonceValueExpression) {
if (element === 'script' || element === 'style' ||
(element === 'link' && (getValue('rel') || '').toLowerCase() === 'stylesheet')) {
if (attrs.findIndex(({ name }) => name === 'nonce') < 0) {
at... | javascript | function noncifyAttrs(element, getValue, attrs) {
if (nonceValueExpression) {
if (element === 'script' || element === 'style' ||
(element === 'link' && (getValue('rel') || '').toLowerCase() === 'stylesheet')) {
if (attrs.findIndex(({ name }) => name === 'nonce') < 0) {
at... | [
"function",
"noncifyAttrs",
"(",
"element",
",",
"getValue",
",",
"attrs",
")",
"{",
"if",
"(",
"nonceValueExpression",
")",
"{",
"if",
"(",
"element",
"===",
"'script'",
"||",
"element",
"===",
"'style'",
"||",
"(",
"element",
"===",
"'link'",
"&&",
"(",
... | Add nonce attributes to attribute sets as needed. | [
"Add",
"nonce",
"attributes",
"to",
"attribute",
"sets",
"as",
"needed",
"."
] | 772c5aa30ca27d46dfddd654d7a60f16fa4519d6 | https://github.com/mikesamuel/pug-plugin-trusted-types/blob/772c5aa30ca27d46dfddd654d7a60f16fa4519d6/packages/plugin/index.js#L352-L365 |
47,199 | mikesamuel/pug-plugin-trusted-types | packages/plugin/index.js | noncifyTag | function noncifyTag({ name, block: { nodes } }) {
if (name === 'form' && csrfInputValueExpression) {
nodes.unshift({
type: 'Conditional',
test: csrfInputValueExpression,
consequent: {
type: 'Block',
nodes: [
{
type: 'Tag',... | javascript | function noncifyTag({ name, block: { nodes } }) {
if (name === 'form' && csrfInputValueExpression) {
nodes.unshift({
type: 'Conditional',
test: csrfInputValueExpression,
consequent: {
type: 'Block',
nodes: [
{
type: 'Tag',... | [
"function",
"noncifyTag",
"(",
"{",
"name",
",",
"block",
":",
"{",
"nodes",
"}",
"}",
")",
"{",
"if",
"(",
"name",
"===",
"'form'",
"&&",
"csrfInputValueExpression",
")",
"{",
"nodes",
".",
"unshift",
"(",
"{",
"type",
":",
"'Conditional'",
",",
"test... | Add nonce attributes to tags as needed. | [
"Add",
"nonce",
"attributes",
"to",
"tags",
"as",
"needed",
"."
] | 772c5aa30ca27d46dfddd654d7a60f16fa4519d6 | https://github.com/mikesamuel/pug-plugin-trusted-types/blob/772c5aa30ca27d46dfddd654d7a60f16fa4519d6/packages/plugin/index.js#L368-L409 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.