id int32 0 58k | repo stringlengths 5 67 | path stringlengths 4 116 | func_name stringlengths 0 58 | original_string stringlengths 52 373k | language stringclasses 1
value | code stringlengths 52 373k | code_tokens list | docstring stringlengths 4 11.8k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 86 226 |
|---|---|---|---|---|---|---|---|---|---|---|---|
51,500 | wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-edb.js | function() {
var count = 0,
elm = this.element();
if (this._map) {
if ((count = edbml.FunctionUpdate._remap(elm, this._map))) {
this._report("remapped " + count + " keys");
}
} else {
if ((count = edbml.FunctionUpdate._revoke(elm))) {
this._report("revoked " + count + " keys");
}
}
} | javascript | function() {
var count = 0,
elm = this.element();
if (this._map) {
if ((count = edbml.FunctionUpdate._remap(elm, this._map))) {
this._report("remapped " + count + " keys");
}
} else {
if ((count = edbml.FunctionUpdate._revoke(elm))) {
this._report("revoked " + count + " keys");
}
}
} | [
"function",
"(",
")",
"{",
"var",
"count",
"=",
"0",
",",
"elm",
"=",
"this",
".",
"element",
"(",
")",
";",
"if",
"(",
"this",
".",
"_map",
")",
"{",
"if",
"(",
"(",
"count",
"=",
"edbml",
".",
"FunctionUpdate",
".",
"_remap",
"(",
"elm",
",",... | Do the update. | [
"Do",
"the",
"update",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-edb.js#L4130-L4142 | |
51,501 | wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-edb.js | function(element) {
var atts = [];
new gui.Crawler('functionupdate').descend(element, {
handleElement: function(elm) {
if (elm !== element) {
Array.forEach(elm.attributes, function(att) {
if (att.value.contains("edbml.$run")) {
atts.push([elm, att]);
}
});
if (elm.spirit && ... | javascript | function(element) {
var atts = [];
new gui.Crawler('functionupdate').descend(element, {
handleElement: function(elm) {
if (elm !== element) {
Array.forEach(elm.attributes, function(att) {
if (att.value.contains("edbml.$run")) {
atts.push([elm, att]);
}
});
if (elm.spirit && ... | [
"function",
"(",
"element",
")",
"{",
"var",
"atts",
"=",
"[",
"]",
";",
"new",
"gui",
".",
"Crawler",
"(",
"'functionupdate'",
")",
".",
"descend",
"(",
"element",
",",
"{",
"handleElement",
":",
"function",
"(",
"elm",
")",
"{",
"if",
"(",
"elm",
... | Collect attributes from DOM subtree that
somewhat resemble EDBML poke statements.
@returns {Array<Array<Node>>} | [
"Collect",
"attributes",
"from",
"DOM",
"subtree",
"that",
"somewhat",
"resemble",
"EDBML",
"poke",
"statements",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-edb.js#L4210-L4227 | |
51,502 | wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-edb.js | function() {
gui.Plugin.prototype.ondestruct.call(this);
if (this.loaded) {
gui.Tick.cancelFrame(this._frameindex);
this.spirit.life.remove(gui.LIFE_ENTER, this);
gui.Broadcast.remove(edb.BROADCAST_ACCESS, this);
if (this.$input) { // TODO: interface for this (dispose)
this.$input.ondestruct(... | javascript | function() {
gui.Plugin.prototype.ondestruct.call(this);
if (this.loaded) {
gui.Tick.cancelFrame(this._frameindex);
this.spirit.life.remove(gui.LIFE_ENTER, this);
gui.Broadcast.remove(edb.BROADCAST_ACCESS, this);
if (this.$input) { // TODO: interface for this (dispose)
this.$input.ondestruct(... | [
"function",
"(",
")",
"{",
"gui",
".",
"Plugin",
".",
"prototype",
".",
"ondestruct",
".",
"call",
"(",
"this",
")",
";",
"if",
"(",
"this",
".",
"loaded",
")",
"{",
"gui",
".",
"Tick",
".",
"cancelFrame",
"(",
"this",
".",
"_frameindex",
")",
";",... | Destruction time. | [
"Destruction",
"time",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-edb.js#L4274-L4285 | |
51,503 | wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-edb.js | function(html) {
var changed = this._html !== html;
var focused = this._focusedfield();
if (changed) {
this._html = html;
this._updater.update(html);
if(focused) {
this._restorefocus(focused);
}
}
this._status(this.spirit);
this.ran = true; // TODO: deprecate and use 'spirit.life.... | javascript | function(html) {
var changed = this._html !== html;
var focused = this._focusedfield();
if (changed) {
this._html = html;
this._updater.update(html);
if(focused) {
this._restorefocus(focused);
}
}
this._status(this.spirit);
this.ran = true; // TODO: deprecate and use 'spirit.life.... | [
"function",
"(",
"html",
")",
"{",
"var",
"changed",
"=",
"this",
".",
"_html",
"!==",
"html",
";",
"var",
"focused",
"=",
"this",
".",
"_focusedfield",
"(",
")",
";",
"if",
"(",
"changed",
")",
"{",
"this",
".",
"_html",
"=",
"html",
";",
"this",
... | Write the actual HTML to screen. You should probably only
call this method if you are producing your own markup
somehow, ie. not using EDBML templates out of the box.
@param {String} html | [
"Write",
"the",
"actual",
"HTML",
"to",
"screen",
".",
"You",
"should",
"probably",
"only",
"call",
"this",
"method",
"if",
"you",
"are",
"producing",
"your",
"own",
"markup",
"somehow",
"ie",
".",
"not",
"using",
"EDBML",
"templates",
"out",
"of",
"the",
... | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-edb.js#L4350-L4362 | |
51,504 | wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-edb.js | function(changes) {
if (changes.some(function(c) {
var id = c.object.$instanceid,
clas = c.object.$classname,
name = c.name;
if(edbml.$rendering && edbml.$rendering[id]) {
console.error(
'Don\'t update "' + name + '" of the ' + clas + ' while ' +
'rendering, it will cause the ren... | javascript | function(changes) {
if (changes.some(function(c) {
var id = c.object.$instanceid,
clas = c.object.$classname,
name = c.name;
if(edbml.$rendering && edbml.$rendering[id]) {
console.error(
'Don\'t update "' + name + '" of the ' + clas + ' while ' +
'rendering, it will cause the ren... | [
"function",
"(",
"changes",
")",
"{",
"if",
"(",
"changes",
".",
"some",
"(",
"function",
"(",
"c",
")",
"{",
"var",
"id",
"=",
"c",
".",
"object",
".",
"$instanceid",
",",
"clas",
"=",
"c",
".",
"object",
".",
"$classname",
",",
"name",
"=",
"c"... | Handle change.
@param {Array<edb.Change>} changes | [
"Handle",
"change",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-edb.js#L4426-L4451 | |
51,505 | wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-edb.js | function(l) {
if (l.type === gui.LIFE_ENTER) {
if (!this.spirit.life.rendered) { // spirit did a manual run?
this.run.apply(this, this._arguments || []);
}
this.spirit.life.remove(l.type, this);
this._arguments = null;
}
} | javascript | function(l) {
if (l.type === gui.LIFE_ENTER) {
if (!this.spirit.life.rendered) { // spirit did a manual run?
this.run.apply(this, this._arguments || []);
}
this.spirit.life.remove(l.type, this);
this._arguments = null;
}
} | [
"function",
"(",
"l",
")",
"{",
"if",
"(",
"l",
".",
"type",
"===",
"gui",
".",
"LIFE_ENTER",
")",
"{",
"if",
"(",
"!",
"this",
".",
"spirit",
".",
"life",
".",
"rendered",
")",
"{",
"// spirit did a manual run?",
"this",
".",
"run",
".",
"apply",
... | Handle life.
@param {gui.Life} life | [
"Handle",
"life",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-edb.js#L4457-L4465 | |
51,506 | wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-edb.js | function() {
edbml.$rendering = this._oldfokkers || {};
gui.Broadcast.add(edb.BROADCAST_ACCESS, this);
edb.$accessaware = true;
this._newfokkers = {};
} | javascript | function() {
edbml.$rendering = this._oldfokkers || {};
gui.Broadcast.add(edb.BROADCAST_ACCESS, this);
edb.$accessaware = true;
this._newfokkers = {};
} | [
"function",
"(",
")",
"{",
"edbml",
".",
"$rendering",
"=",
"this",
".",
"_oldfokkers",
"||",
"{",
"}",
";",
"gui",
".",
"Broadcast",
".",
"add",
"(",
"edb",
".",
"BROADCAST_ACCESS",
",",
"this",
")",
";",
"edb",
".",
"$accessaware",
"=",
"true",
";"... | Start it. | [
"Start",
"it",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-edb.js#L4553-L4558 | |
51,507 | wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-edb.js | function() {
var oldfokkers = this._oldfokkers,
newfokkers = this._newfokkers;
edbml.$rendering = null;
gui.Broadcast.remove(edb.BROADCAST_ACCESS, this);
edb.$accessaware = false;
Object.keys(oldfokkers).forEach(function(id) {
if (!newfokkers[id]) {
oldfokkers[id].object.removeObserver(this... | javascript | function() {
var oldfokkers = this._oldfokkers,
newfokkers = this._newfokkers;
edbml.$rendering = null;
gui.Broadcast.remove(edb.BROADCAST_ACCESS, this);
edb.$accessaware = false;
Object.keys(oldfokkers).forEach(function(id) {
if (!newfokkers[id]) {
oldfokkers[id].object.removeObserver(this... | [
"function",
"(",
")",
"{",
"var",
"oldfokkers",
"=",
"this",
".",
"_oldfokkers",
",",
"newfokkers",
"=",
"this",
".",
"_newfokkers",
";",
"edbml",
".",
"$rendering",
"=",
"null",
";",
"gui",
".",
"Broadcast",
".",
"remove",
"(",
"edb",
".",
"BROADCAST_AC... | Stop it. | [
"Stop",
"it",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-edb.js#L4563-L4589 | |
51,508 | wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-edb.js | function() {
gui.Tick.cancelFrame(this._frameindex);
var spirit = this.spirit;
var input = this.$input;
var runnow = function() {
if (!spirit.life.destructed && (!input || input.done)) {
this.run();
}
}.bind(this);
if (spirit.life.entered) {
if (spirit.life.rendered) {
this._fram... | javascript | function() {
gui.Tick.cancelFrame(this._frameindex);
var spirit = this.spirit;
var input = this.$input;
var runnow = function() {
if (!spirit.life.destructed && (!input || input.done)) {
this.run();
}
}.bind(this);
if (spirit.life.entered) {
if (spirit.life.rendered) {
this._fram... | [
"function",
"(",
")",
"{",
"gui",
".",
"Tick",
".",
"cancelFrame",
"(",
"this",
".",
"_frameindex",
")",
";",
"var",
"spirit",
"=",
"this",
".",
"spirit",
";",
"var",
"input",
"=",
"this",
".",
"$input",
";",
"var",
"runnow",
"=",
"function",
"(",
... | Schedule rendering. | [
"Schedule",
"rendering",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-edb.js#L4594-L4612 | |
51,509 | wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-edb.js | function(elm) {
var index = -1;
var parts = [];
function hasid(elm) {
if (elm.id) {
try {
gui.DOMPlugin.q(elm.parentNode, elm.id);
return true;
} catch (malformedexception) {}
}
return false;
}
while (elm && elm.nodeType === Node.ELEMENT_NODE) {
if (hasid(elm)) {
... | javascript | function(elm) {
var index = -1;
var parts = [];
function hasid(elm) {
if (elm.id) {
try {
gui.DOMPlugin.q(elm.parentNode, elm.id);
return true;
} catch (malformedexception) {}
}
return false;
}
while (elm && elm.nodeType === Node.ELEMENT_NODE) {
if (hasid(elm)) {
... | [
"function",
"(",
"elm",
")",
"{",
"var",
"index",
"=",
"-",
"1",
";",
"var",
"parts",
"=",
"[",
"]",
";",
"function",
"hasid",
"(",
"elm",
")",
"{",
"if",
"(",
"elm",
".",
"id",
")",
"{",
"try",
"{",
"gui",
".",
"DOMPlugin",
".",
"q",
"(",
... | Compute selector for form field. We scope it to
nearest element ID or fallback to document body.
@param {Element} element
@returns {string} | [
"Compute",
"selector",
"for",
"form",
"field",
".",
"We",
"scope",
"it",
"to",
"nearest",
"element",
"ID",
"or",
"fallback",
"to",
"document",
"body",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-edb.js#L4691-L4719 | |
51,510 | wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-edb.js | function(selector) {
var texts = 'textarea, input:not([type=checkbox]):not([type=radio])';
var field = gui.DOMPlugin.qdoc(selector);
if(field && field !== document.activeElement) {
field.focus();
if (gui.CSSPlugin.matches(field, texts)) {
field.setSelectionRange(
field.value.length,
fi... | javascript | function(selector) {
var texts = 'textarea, input:not([type=checkbox]):not([type=radio])';
var field = gui.DOMPlugin.qdoc(selector);
if(field && field !== document.activeElement) {
field.focus();
if (gui.CSSPlugin.matches(field, texts)) {
field.setSelectionRange(
field.value.length,
fi... | [
"function",
"(",
"selector",
")",
"{",
"var",
"texts",
"=",
"'textarea, input:not([type=checkbox]):not([type=radio])'",
";",
"var",
"field",
"=",
"gui",
".",
"DOMPlugin",
".",
"qdoc",
"(",
"selector",
")",
";",
"if",
"(",
"field",
"&&",
"field",
"!==",
"docume... | Refocus that form field.
@param {string} selector | [
"Refocus",
"that",
"form",
"field",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-edb.js#L4725-L4737 | |
51,511 | wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-edb.js | function() {
gui.Spirit.prototype.onconfigure.call(this);
if (this.dom.embedded()) {
var id, parent = this.dom.parent(gui.Spirit);
if (parent && (id = this.scriptid)) {
parent.script.load(gui.Object.lookup(id));
}
}
} | javascript | function() {
gui.Spirit.prototype.onconfigure.call(this);
if (this.dom.embedded()) {
var id, parent = this.dom.parent(gui.Spirit);
if (parent && (id = this.scriptid)) {
parent.script.load(gui.Object.lookup(id));
}
}
} | [
"function",
"(",
")",
"{",
"gui",
".",
"Spirit",
".",
"prototype",
".",
"onconfigure",
".",
"call",
"(",
"this",
")",
";",
"if",
"(",
"this",
".",
"dom",
".",
"embedded",
"(",
")",
")",
"{",
"var",
"id",
",",
"parent",
"=",
"this",
".",
"dom",
... | Load script into parent spirit. This spirit will
automatically destruct when the script executes. | [
"Load",
"script",
"into",
"parent",
"spirit",
".",
"This",
"spirit",
"will",
"automatically",
"destruct",
"when",
"the",
"script",
"executes",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-edb.js#L4761-L4769 | |
51,512 | wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-edb.js | function() {
/*
* Automatically load spirit scripts by naming convention?
* ns.MySpirit would automatically load ns.MySpirit.edbml
*/
var edbmlscript, basespirit = gui.Spirit.prototype;
gui.Function.decorateAfter(basespirit, 'onconfigure', function() {
if (edbml.bootload && !this.script.loaded) {
... | javascript | function() {
/*
* Automatically load spirit scripts by naming convention?
* ns.MySpirit would automatically load ns.MySpirit.edbml
*/
var edbmlscript, basespirit = gui.Spirit.prototype;
gui.Function.decorateAfter(basespirit, 'onconfigure', function() {
if (edbml.bootload && !this.script.loaded) {
... | [
"function",
"(",
")",
"{",
"/*\n\t\t * Automatically load spirit scripts by naming convention?\n\t\t * ns.MySpirit would automatically load ns.MySpirit.edbml\n\t\t */",
"var",
"edbmlscript",
",",
"basespirit",
"=",
"gui",
".",
"Spirit",
".",
"prototype",
";",
"gui",
".",
"Functio... | Setup environment. | [
"Setup",
"environment",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-edb.js#L4851-L4877 | |
51,513 | cafjs/caf_conduit | lib/conduit.js | function(node) {
var newNode = function(data, next) {
var that = {};
that.getData = function() {
return data;
};
that.getNext = function() {
return next;
};
return that;
};
var top ... | javascript | function(node) {
var newNode = function(data, next) {
var that = {};
that.getData = function() {
return data;
};
that.getNext = function() {
return next;
};
return that;
};
var top ... | [
"function",
"(",
"node",
")",
"{",
"var",
"newNode",
"=",
"function",
"(",
"data",
",",
"next",
")",
"{",
"var",
"that",
"=",
"{",
"}",
";",
"that",
".",
"getData",
"=",
"function",
"(",
")",
"{",
"return",
"data",
";",
"}",
";",
"that",
".",
"... | An immutable stack as base class. | [
"An",
"immutable",
"stack",
"as",
"base",
"class",
"."
] | 72b4856dddfca76be7de605c1c60bcd1b8315996 | https://github.com/cafjs/caf_conduit/blob/72b4856dddfca76be7de605c1c60bcd1b8315996/lib/conduit.js#L134-L186 | |
51,514 | redisjs/jsr-server | lib/command/database/hash/hscan.js | execute | function execute(req, res) {
//console.dir(req.args);
var hmap = req.db.getKey(req.args[0], req);
if(hmap === undefined) {
return res.send(null, [0, []]);
}
//console.dir(hmap.getKeys())
var scanner = new Scanner(
hmap.getKeys(),
req.info.cursor,
req.info.pattern,
req.info.count,
hma... | javascript | function execute(req, res) {
//console.dir(req.args);
var hmap = req.db.getKey(req.args[0], req);
if(hmap === undefined) {
return res.send(null, [0, []]);
}
//console.dir(hmap.getKeys())
var scanner = new Scanner(
hmap.getKeys(),
req.info.cursor,
req.info.pattern,
req.info.count,
hma... | [
"function",
"execute",
"(",
"req",
",",
"res",
")",
"{",
"//console.dir(req.args);",
"var",
"hmap",
"=",
"req",
".",
"db",
".",
"getKey",
"(",
"req",
".",
"args",
"[",
"0",
"]",
",",
"req",
")",
";",
"if",
"(",
"hmap",
"===",
"undefined",
")",
"{",... | Respond to the HSCAN command. | [
"Respond",
"to",
"the",
"HSCAN",
"command",
"."
] | 49413052d3039524fbdd2ade0ef9bae26cb4d647 | https://github.com/redisjs/jsr-server/blob/49413052d3039524fbdd2ade0ef9bae26cb4d647/lib/command/database/hash/hscan.js#L19-L34 |
51,515 | hbouvier/node-tagger | lib/util/rest.js | lexPhrase | function lexPhrase(req, res) {
var now = elapse.start();
var body = req ? req.body : null;
var phrase = typeof(body) === 'object' ? body.phrase : null;
if (!phrase) {
return res.jsonp(412, {"code":412, "message": meta.module + '|lex|EXCEPTION|invalid request body: ' + (b... | javascript | function lexPhrase(req, res) {
var now = elapse.start();
var body = req ? req.body : null;
var phrase = typeof(body) === 'object' ? body.phrase : null;
if (!phrase) {
return res.jsonp(412, {"code":412, "message": meta.module + '|lex|EXCEPTION|invalid request body: ' + (b... | [
"function",
"lexPhrase",
"(",
"req",
",",
"res",
")",
"{",
"var",
"now",
"=",
"elapse",
".",
"start",
"(",
")",
";",
"var",
"body",
"=",
"req",
"?",
"req",
".",
"body",
":",
"null",
";",
"var",
"phrase",
"=",
"typeof",
"(",
"body",
")",
"===",
... | HTTP Request to lex a phrase
@param req: an HTTP request
@param res: an HTTP response
curl -X POST -H "Content-Type: application/json" -d '{"phrase":"bye there"}' http://tagger.beeker.c9.io/ws/lex/phrase | [
"HTTP",
"Request",
"to",
"lex",
"a",
"phrase"
] | 51a6a9b6158e83cbbc4d3d4f10fde19ac796510b | https://github.com/hbouvier/node-tagger/blob/51a6a9b6158e83cbbc4d3d4f10fde19ac796510b/lib/util/rest.js#L27-L37 |
51,516 | eliascodes/modload | lib/tree.js | walk | function walk (dir, mapper, exclude, include, stopfile) {
let files = fs.readdirSync(dir).map((file) => path.join(dir, file))
if (exclude)
files = files.filter((file) => !exclude.test(file))
let directories = files.filter(utils.is.dir)
files = files.filter(utils.is.file)
if (include)
files = files.... | javascript | function walk (dir, mapper, exclude, include, stopfile) {
let files = fs.readdirSync(dir).map((file) => path.join(dir, file))
if (exclude)
files = files.filter((file) => !exclude.test(file))
let directories = files.filter(utils.is.dir)
files = files.filter(utils.is.file)
if (include)
files = files.... | [
"function",
"walk",
"(",
"dir",
",",
"mapper",
",",
"exclude",
",",
"include",
",",
"stopfile",
")",
"{",
"let",
"files",
"=",
"fs",
".",
"readdirSync",
"(",
"dir",
")",
".",
"map",
"(",
"(",
"file",
")",
"=>",
"path",
".",
"join",
"(",
"dir",
",... | Recursively walk a directory and return array of files
@returns {array} of files found in the directory
@param {string} dir - Root directory to traverse
@param {function} mapper - (Optional) Transforms each filepath
@param {RegExp} exclude - (Optional) Pattern for files to exclude from results
@param {RegExp} include -... | [
"Recursively",
"walk",
"a",
"directory",
"and",
"return",
"array",
"of",
"files"
] | bc3bad88c8b677970bb9154764db7bbf72401d3a | https://github.com/eliascodes/modload/blob/bc3bad88c8b677970bb9154764db7bbf72401d3a/lib/tree.js#L19-L47 |
51,517 | jmarthernandez/chat-parser | src/emoticons.js | getEmoticons | function getEmoticons(arr) {
var nested = arr.map(function (str) {
return str.match(between);
});
return flatten(nested)
.filter(function (el) {
return el;
})
.filter(emoticonsPredicate)
.map(function (str) {
return str.slice(1, str.length - 1);
});
} | javascript | function getEmoticons(arr) {
var nested = arr.map(function (str) {
return str.match(between);
});
return flatten(nested)
.filter(function (el) {
return el;
})
.filter(emoticonsPredicate)
.map(function (str) {
return str.slice(1, str.length - 1);
});
} | [
"function",
"getEmoticons",
"(",
"arr",
")",
"{",
"var",
"nested",
"=",
"arr",
".",
"map",
"(",
"function",
"(",
"str",
")",
"{",
"return",
"str",
".",
"match",
"(",
"between",
")",
";",
"}",
")",
";",
"return",
"flatten",
"(",
"nested",
")",
".",
... | Parses tokenized array into emoticon strings
@func
@param {array} arr - a chat input string split on whitespace | [
"Parses",
"tokenized",
"array",
"into",
"emoticon",
"strings"
] | 62e7e28cca35318158e4a807b30dd8d5d88718ac | https://github.com/jmarthernandez/chat-parser/blob/62e7e28cca35318158e4a807b30dd8d5d88718ac/src/emoticons.js#L31-L44 |
51,518 | kevoree/kevoree-js-node-javascript | lib/AdaptationEngine.js | function (diffSeq, targetModel) {
var self = this;
this.targetModel = targetModel;
// know if a trace has already been added to cmdList for {path <-> AdaptationPrimitive}
var traceAlreadyProcessed = function (cmd) {
return self.alreadyProcessedTraces[cmd.modelElement.path()] && self.alreadyProcessedTraces[c... | javascript | function (diffSeq, targetModel) {
var self = this;
this.targetModel = targetModel;
// know if a trace has already been added to cmdList for {path <-> AdaptationPrimitive}
var traceAlreadyProcessed = function (cmd) {
return self.alreadyProcessedTraces[cmd.modelElement.path()] && self.alreadyProcessedTraces[c... | [
"function",
"(",
"diffSeq",
",",
"targetModel",
")",
"{",
"var",
"self",
"=",
"this",
";",
"this",
".",
"targetModel",
"=",
"targetModel",
";",
"// know if a trace has already been added to cmdList for {path <-> AdaptationPrimitive}",
"var",
"traceAlreadyProcessed",
"=",
... | Process traces to find the right adaptation primitive command
Returns a command to execute in order to do the adaptation logic
@param diffSeq
@param targetModel
@returns {Array} | [
"Process",
"traces",
"to",
"find",
"the",
"right",
"adaptation",
"primitive",
"command",
"Returns",
"a",
"command",
"to",
"execute",
"in",
"order",
"to",
"do",
"the",
"adaptation",
"logic"
] | a1bcce1b76317bc90eb2d0c1c0c70525eaa1d70d | https://github.com/kevoree/kevoree-js-node-javascript/blob/a1bcce1b76317bc90eb2d0c1c0c70525eaa1d70d/lib/AdaptationEngine.js#L78-L132 | |
51,519 | kevoree/kevoree-js-node-javascript | lib/AdaptationEngine.js | function (cmd) {
self.alreadyProcessedTraces[cmd.modelElement.path()] = self.alreadyProcessedTraces[cmd.modelElement.path()] || {};
self.alreadyProcessedTraces[cmd.modelElement.path()][cmd.toString()] = cmd;
} | javascript | function (cmd) {
self.alreadyProcessedTraces[cmd.modelElement.path()] = self.alreadyProcessedTraces[cmd.modelElement.path()] || {};
self.alreadyProcessedTraces[cmd.modelElement.path()][cmd.toString()] = cmd;
} | [
"function",
"(",
"cmd",
")",
"{",
"self",
".",
"alreadyProcessedTraces",
"[",
"cmd",
".",
"modelElement",
".",
"path",
"(",
")",
"]",
"=",
"self",
".",
"alreadyProcessedTraces",
"[",
"cmd",
".",
"modelElement",
".",
"path",
"(",
")",
"]",
"||",
"{",
"}... | add a trace to the processed trace map | [
"add",
"a",
"trace",
"to",
"the",
"processed",
"trace",
"map"
] | a1bcce1b76317bc90eb2d0c1c0c70525eaa1d70d | https://github.com/kevoree/kevoree-js-node-javascript/blob/a1bcce1b76317bc90eb2d0c1c0c70525eaa1d70d/lib/AdaptationEngine.js#L88-L91 | |
51,520 | kevoree/kevoree-js-node-javascript | lib/AdaptationEngine.js | function (element) {
if (element) {
if (element.metaClassName() === 'org.kevoree.ComponentInstance') {
// if parent is this node platform: it's ok
return (element.eContainer().name === this.node.getName());
} else if (element.metaClassName() === 'org.kevoree.Channel') {
// if this channel has bindi... | javascript | function (element) {
if (element) {
if (element.metaClassName() === 'org.kevoree.ComponentInstance') {
// if parent is this node platform: it's ok
return (element.eContainer().name === this.node.getName());
} else if (element.metaClassName() === 'org.kevoree.Channel') {
// if this channel has bindi... | [
"function",
"(",
"element",
")",
"{",
"if",
"(",
"element",
")",
"{",
"if",
"(",
"element",
".",
"metaClassName",
"(",
")",
"===",
"'org.kevoree.ComponentInstance'",
")",
"{",
"// if parent is this node platform: it's ok",
"return",
"(",
"element",
".",
"eContaine... | know if an modelElement is related to the current plarform node
@param element
@returns {boolean} | [
"know",
"if",
"an",
"modelElement",
"is",
"related",
"to",
"the",
"current",
"plarform",
"node"
] | a1bcce1b76317bc90eb2d0c1c0c70525eaa1d70d | https://github.com/kevoree/kevoree-js-node-javascript/blob/a1bcce1b76317bc90eb2d0c1c0c70525eaa1d70d/lib/AdaptationEngine.js#L476-L524 | |
51,521 | kevoree/kevoree-js-node-javascript | lib/AdaptationEngine.js | function (list) {
list.sort(function (a, b) {
if (COMMAND_RANK[a.toString()] > COMMAND_RANK[b.toString()]) {
return 1;
} else if (COMMAND_RANK[a.toString()] < COMMAND_RANK[b.toString()]) {
return -1;
} else {
return 0;
}
});
return list;
} | javascript | function (list) {
list.sort(function (a, b) {
if (COMMAND_RANK[a.toString()] > COMMAND_RANK[b.toString()]) {
return 1;
} else if (COMMAND_RANK[a.toString()] < COMMAND_RANK[b.toString()]) {
return -1;
} else {
return 0;
}
});
return list;
} | [
"function",
"(",
"list",
")",
"{",
"list",
".",
"sort",
"(",
"function",
"(",
"a",
",",
"b",
")",
"{",
"if",
"(",
"COMMAND_RANK",
"[",
"a",
".",
"toString",
"(",
")",
"]",
">",
"COMMAND_RANK",
"[",
"b",
".",
"toString",
"(",
")",
"]",
")",
"{",... | Sorts primitives array according to COMMAND_RANK
@param list
@returns {*} | [
"Sorts",
"primitives",
"array",
"according",
"to",
"COMMAND_RANK"
] | a1bcce1b76317bc90eb2d0c1c0c70525eaa1d70d | https://github.com/kevoree/kevoree-js-node-javascript/blob/a1bcce1b76317bc90eb2d0c1c0c70525eaa1d70d/lib/AdaptationEngine.js#L599-L611 | |
51,522 | redisjs/jsr-store | lib/command/keys.js | del | function del(/* key-1, key-N, req */) {
var args = slice.call(arguments, 0)
, req = typeof args[args.length-1] === 'object' ? args.pop() : null;
var deleted = 0;
for(var i = 0;i < args.length;i++) {
if(this.keyExists(args[i])) {
this.delKey(args[i], req);
deleted++;
}
}
return deleted;... | javascript | function del(/* key-1, key-N, req */) {
var args = slice.call(arguments, 0)
, req = typeof args[args.length-1] === 'object' ? args.pop() : null;
var deleted = 0;
for(var i = 0;i < args.length;i++) {
if(this.keyExists(args[i])) {
this.delKey(args[i], req);
deleted++;
}
}
return deleted;... | [
"function",
"del",
"(",
"/* key-1, key-N, req */",
")",
"{",
"var",
"args",
"=",
"slice",
".",
"call",
"(",
"arguments",
",",
"0",
")",
",",
"req",
"=",
"typeof",
"args",
"[",
"args",
".",
"length",
"-",
"1",
"]",
"===",
"'object'",
"?",
"args",
".",... | Removes the specified keys. A key is ignored if it does not exist. | [
"Removes",
"the",
"specified",
"keys",
".",
"A",
"key",
"is",
"ignored",
"if",
"it",
"does",
"not",
"exist",
"."
] | b2b5c5b0347819f8a388b5d67e121ee8d73f328c | https://github.com/redisjs/jsr-store/blob/b2b5c5b0347819f8a388b5d67e121ee8d73f328c/lib/command/keys.js#L9-L20 |
51,523 | redisjs/jsr-store | lib/command/keys.js | rename | function rename(key, newkey, req) {
var val = this.getKey(key);
this.delKey(key);
this.setKey(newkey, val);
return OK;
} | javascript | function rename(key, newkey, req) {
var val = this.getKey(key);
this.delKey(key);
this.setKey(newkey, val);
return OK;
} | [
"function",
"rename",
"(",
"key",
",",
"newkey",
",",
"req",
")",
"{",
"var",
"val",
"=",
"this",
".",
"getKey",
"(",
"key",
")",
";",
"this",
".",
"delKey",
"(",
"key",
")",
";",
"this",
".",
"setKey",
"(",
"newkey",
",",
"val",
")",
";",
"ret... | Rename a key.
Expected that command validation has already check that the key names
do not match and that the target key does exist. | [
"Rename",
"a",
"key",
"."
] | b2b5c5b0347819f8a388b5d67e121ee8d73f328c | https://github.com/redisjs/jsr-store/blob/b2b5c5b0347819f8a388b5d67e121ee8d73f328c/lib/command/keys.js#L28-L33 |
51,524 | redisjs/jsr-store | lib/command/keys.js | renamenx | function renamenx(key, newkey, req) {
var exists = this.keyExists(newkey);
if(!exists) {
this.rename(key, newkey, req);
}
return exists ? 0 : 1;
} | javascript | function renamenx(key, newkey, req) {
var exists = this.keyExists(newkey);
if(!exists) {
this.rename(key, newkey, req);
}
return exists ? 0 : 1;
} | [
"function",
"renamenx",
"(",
"key",
",",
"newkey",
",",
"req",
")",
"{",
"var",
"exists",
"=",
"this",
".",
"keyExists",
"(",
"newkey",
")",
";",
"if",
"(",
"!",
"exists",
")",
"{",
"this",
".",
"rename",
"(",
"key",
",",
"newkey",
",",
"req",
")... | Rename a key, only if the new key does not exist.
Expected that the command has validated according the rules for
RENAME. | [
"Rename",
"a",
"key",
"only",
"if",
"the",
"new",
"key",
"does",
"not",
"exist",
"."
] | b2b5c5b0347819f8a388b5d67e121ee8d73f328c | https://github.com/redisjs/jsr-store/blob/b2b5c5b0347819f8a388b5d67e121ee8d73f328c/lib/command/keys.js#L41-L47 |
51,525 | redisjs/jsr-store | lib/command/keys.js | move | function move(key, index, req) {
var val = this.getKey(key)
, db = this.store.getDatabase(index, this.options);
//console.dir(val);
if(!val || db.keyExists(key)) return 0;
db.setKey(key, val);
this.delKey(key);
return 1;
} | javascript | function move(key, index, req) {
var val = this.getKey(key)
, db = this.store.getDatabase(index, this.options);
//console.dir(val);
if(!val || db.keyExists(key)) return 0;
db.setKey(key, val);
this.delKey(key);
return 1;
} | [
"function",
"move",
"(",
"key",
",",
"index",
",",
"req",
")",
"{",
"var",
"val",
"=",
"this",
".",
"getKey",
"(",
"key",
")",
",",
"db",
"=",
"this",
".",
"store",
".",
"getDatabase",
"(",
"index",
",",
"this",
".",
"options",
")",
";",
"//conso... | Move a key from this database to another database. | [
"Move",
"a",
"key",
"from",
"this",
"database",
"to",
"another",
"database",
"."
] | b2b5c5b0347819f8a388b5d67e121ee8d73f328c | https://github.com/redisjs/jsr-store/blob/b2b5c5b0347819f8a388b5d67e121ee8d73f328c/lib/command/keys.js#L66-L74 |
51,526 | gethuman/pancakes-angular | lib/transformers/ng.app.transformer.js | transform | function transform(flapjack, options) {
var filePath = options.filePath;
var appName = this.getAppName(filePath, options.appName);
var appInfo = this.pancakes.cook(flapjack, null);
var validations = this.getSchemaValidations(appInfo, null);
var schema = this.stringify(validations);
var deps = (o... | javascript | function transform(flapjack, options) {
var filePath = options.filePath;
var appName = this.getAppName(filePath, options.appName);
var appInfo = this.pancakes.cook(flapjack, null);
var validations = this.getSchemaValidations(appInfo, null);
var schema = this.stringify(validations);
var deps = (o... | [
"function",
"transform",
"(",
"flapjack",
",",
"options",
")",
"{",
"var",
"filePath",
"=",
"options",
".",
"filePath",
";",
"var",
"appName",
"=",
"this",
".",
"getAppName",
"(",
"filePath",
",",
"options",
".",
"appName",
")",
";",
"var",
"appInfo",
"=... | Pull together the template model and generate the template
@param flapjack
@param options
@returns {Q} | [
"Pull",
"together",
"the",
"template",
"model",
"and",
"generate",
"the",
"template"
] | 9589b7ba09619843e271293088005c62ed23f355 | https://github.com/gethuman/pancakes-angular/blob/9589b7ba09619843e271293088005c62ed23f355/lib/transformers/ng.app.transformer.js#L15-L33 |
51,527 | gethuman/pancakes-angular | lib/transformers/ng.app.transformer.js | getSchemaValidations | function getSchemaValidations(appInfo, resources) {
if (!appInfo.includeSchemas) { return null; }
// if resources not passed in, then get from pancakes
resources = resources || this.pancakes.cook('resources', null);
var validations = {};
_.each(resources, function (resource) {
_.each(resou... | javascript | function getSchemaValidations(appInfo, resources) {
if (!appInfo.includeSchemas) { return null; }
// if resources not passed in, then get from pancakes
resources = resources || this.pancakes.cook('resources', null);
var validations = {};
_.each(resources, function (resource) {
_.each(resou... | [
"function",
"getSchemaValidations",
"(",
"appInfo",
",",
"resources",
")",
"{",
"if",
"(",
"!",
"appInfo",
".",
"includeSchemas",
")",
"{",
"return",
"null",
";",
"}",
"// if resources not passed in, then get from pancakes",
"resources",
"=",
"resources",
"||",
"thi... | Get the stringified version of the schem
@param appInfo
@param resources
@returns {*} | [
"Get",
"the",
"stringified",
"version",
"of",
"the",
"schem"
] | 9589b7ba09619843e271293088005c62ed23f355 | https://github.com/gethuman/pancakes-angular/blob/9589b7ba09619843e271293088005c62ed23f355/lib/transformers/ng.app.transformer.js#L41-L60 |
51,528 | gethuman/pancakes-angular | lib/transformers/ng.app.transformer.js | stringify | function stringify(validations) {
if (!validations) { return ''; }
return JSON.stringify(validations, function (key, value) {
if (_.isRegExp(value)) { return value.toString(); }
switch (value) {
case String: return 'String';
case Boolean: return 'Boolean';
... | javascript | function stringify(validations) {
if (!validations) { return ''; }
return JSON.stringify(validations, function (key, value) {
if (_.isRegExp(value)) { return value.toString(); }
switch (value) {
case String: return 'String';
case Boolean: return 'Boolean';
... | [
"function",
"stringify",
"(",
"validations",
")",
"{",
"if",
"(",
"!",
"validations",
")",
"{",
"return",
"''",
";",
"}",
"return",
"JSON",
".",
"stringify",
"(",
"validations",
",",
"function",
"(",
"key",
",",
"value",
")",
"{",
"if",
"(",
"_",
"."... | Stringify the validations object
@param validations
@returns {*} | [
"Stringify",
"the",
"validations",
"object"
] | 9589b7ba09619843e271293088005c62ed23f355 | https://github.com/gethuman/pancakes-angular/blob/9589b7ba09619843e271293088005c62ed23f355/lib/transformers/ng.app.transformer.js#L67-L81 |
51,529 | hypergroup/hyper-client-superagent | index.js | Client | function Client(API_URL, token, opts) {
if (!(this instanceof Client)) return new Client(API_URL, token, opts);
if (typeof token == 'object') {
opts = token;
token = null;
}
Emitter.call(this);
var self = this;
opts = opts || {};
self.cache = new LRU(opts.maxSize || 500);
self.pending = {};
... | javascript | function Client(API_URL, token, opts) {
if (!(this instanceof Client)) return new Client(API_URL, token, opts);
if (typeof token == 'object') {
opts = token;
token = null;
}
Emitter.call(this);
var self = this;
opts = opts || {};
self.cache = new LRU(opts.maxSize || 500);
self.pending = {};
... | [
"function",
"Client",
"(",
"API_URL",
",",
"token",
",",
"opts",
")",
"{",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"Client",
")",
")",
"return",
"new",
"Client",
"(",
"API_URL",
",",
"token",
",",
"opts",
")",
";",
"if",
"(",
"typeof",
"token",
... | Create a client | [
"Create",
"a",
"client"
] | 4c1c7c2014386ac93b4804b50eabfe1c3b5a23f6 | https://github.com/hypergroup/hyper-client-superagent/blob/4c1c7c2014386ac93b4804b50eabfe1c3b5a23f6/index.js#L24-L50 |
51,530 | hypergroup/hyper-client-superagent | index.js | HyperError | function HyperError(res) {
Error.call(this);
Error.captureStackTrace(this, arguments.callee);
this.name = 'HyperError';
this.status = res.status;
if (res.body && res.body.error) this.message = res.body.error.message;
else this.message = res.text;
} | javascript | function HyperError(res) {
Error.call(this);
Error.captureStackTrace(this, arguments.callee);
this.name = 'HyperError';
this.status = res.status;
if (res.body && res.body.error) this.message = res.body.error.message;
else this.message = res.text;
} | [
"function",
"HyperError",
"(",
"res",
")",
"{",
"Error",
".",
"call",
"(",
"this",
")",
";",
"Error",
".",
"captureStackTrace",
"(",
"this",
",",
"arguments",
".",
"callee",
")",
";",
"this",
".",
"name",
"=",
"'HyperError'",
";",
"this",
".",
"status"... | Create a hyper error given a superagent response
@param {Response} res | [
"Create",
"a",
"hyper",
"error",
"given",
"a",
"superagent",
"response"
] | 4c1c7c2014386ac93b4804b50eabfe1c3b5a23f6 | https://github.com/hypergroup/hyper-client-superagent/blob/4c1c7c2014386ac93b4804b50eabfe1c3b5a23f6/index.js#L270-L277 |
51,531 | akaspin/tav | index.js | function(spec, banner, strict) {
spec = spec || {};
banner = banner || "Usage:";
var self = this;
var incoming = process.argv.slice(2); // incoming params
/**
* Returns extra items frob b
* @param a
* @param b
* @returns {Array}
... | javascript | function(spec, banner, strict) {
spec = spec || {};
banner = banner || "Usage:";
var self = this;
var incoming = process.argv.slice(2); // incoming params
/**
* Returns extra items frob b
* @param a
* @param b
* @returns {Array}
... | [
"function",
"(",
"spec",
",",
"banner",
",",
"strict",
")",
"{",
"spec",
"=",
"spec",
"||",
"{",
"}",
";",
"banner",
"=",
"banner",
"||",
"\"Usage:\"",
";",
"var",
"self",
"=",
"this",
";",
"var",
"incoming",
"=",
"process",
".",
"argv",
".",
"slic... | Sets options.
@param spec Specification
@param banner Banner
@param strict Assume unexpected params as error. | [
"Sets",
"options",
"."
] | 1a7402ba5cd59cacecabad80e4a51f4a3ca66f1e | https://github.com/akaspin/tav/blob/1a7402ba5cd59cacecabad80e4a51f4a3ca66f1e/index.js#L16-L134 | |
51,532 | akaspin/tav | index.js | function(parsed) {
var end = false, message = "", code = 0, outer = console.log;
var setted = Object.keys(self);
var specced = Object.keys(parsed);
var required = arrayDiff(setted, specced);
var unexpected = arrayDiff(specced, setted);
... | javascript | function(parsed) {
var end = false, message = "", code = 0, outer = console.log;
var setted = Object.keys(self);
var specced = Object.keys(parsed);
var required = arrayDiff(setted, specced);
var unexpected = arrayDiff(specced, setted);
... | [
"function",
"(",
"parsed",
")",
"{",
"var",
"end",
"=",
"false",
",",
"message",
"=",
"\"\"",
",",
"code",
"=",
"0",
",",
"outer",
"=",
"console",
".",
"log",
";",
"var",
"setted",
"=",
"Object",
".",
"keys",
"(",
"self",
")",
";",
"var",
"specce... | Check conditions. If help setted - always exit.
@param parsed Parsed specs | [
"Check",
"conditions",
".",
"If",
"help",
"setted",
"-",
"always",
"exit",
"."
] | 1a7402ba5cd59cacecabad80e4a51f4a3ca66f1e | https://github.com/akaspin/tav/blob/1a7402ba5cd59cacecabad80e4a51f4a3ca66f1e/index.js#L37-L83 | |
51,533 | redisjs/jsr-server | lib/command/database/string/bitop.js | validate | function validate(cmd, args, info) {
AbstractCommand.prototype.validate.apply(this, arguments);
var op = ('' + args[0]).toLowerCase();
if(op !== BITOP.AND && op !== BITOP.OR
&& op !== BITOP.XOR && op !== BITOP.NOT) {
throw CommandSyntax;
}
if(op === BITOP.NOT && args.length !== 3) {
throw BitopNot... | javascript | function validate(cmd, args, info) {
AbstractCommand.prototype.validate.apply(this, arguments);
var op = ('' + args[0]).toLowerCase();
if(op !== BITOP.AND && op !== BITOP.OR
&& op !== BITOP.XOR && op !== BITOP.NOT) {
throw CommandSyntax;
}
if(op === BITOP.NOT && args.length !== 3) {
throw BitopNot... | [
"function",
"validate",
"(",
"cmd",
",",
"args",
",",
"info",
")",
"{",
"AbstractCommand",
".",
"prototype",
".",
"validate",
".",
"apply",
"(",
"this",
",",
"arguments",
")",
";",
"var",
"op",
"=",
"(",
"''",
"+",
"args",
"[",
"0",
"]",
")",
".",
... | Validate the BITOP command. | [
"Validate",
"the",
"BITOP",
"command",
"."
] | 49413052d3039524fbdd2ade0ef9bae26cb4d647 | https://github.com/redisjs/jsr-server/blob/49413052d3039524fbdd2ade0ef9bae26cb4d647/lib/command/database/string/bitop.js#L21-L32 |
51,534 | redisjs/jsr-server | lib/state.js | ServerState | function ServerState() {
// server configuration
this._conf = new Configuration();
this._conf.once('load', this.onConfigLoad.bind(this));
// the server bind address information
// if listen() is never called this is null
this._addr = null;
// timestamp for the last save of the rdb file
this._lastsave... | javascript | function ServerState() {
// server configuration
this._conf = new Configuration();
this._conf.once('load', this.onConfigLoad.bind(this));
// the server bind address information
// if listen() is never called this is null
this._addr = null;
// timestamp for the last save of the rdb file
this._lastsave... | [
"function",
"ServerState",
"(",
")",
"{",
"// server configuration",
"this",
".",
"_conf",
"=",
"new",
"Configuration",
"(",
")",
";",
"this",
".",
"_conf",
".",
"once",
"(",
"'load'",
",",
"this",
".",
"onConfigLoad",
".",
"bind",
"(",
"this",
")",
")",... | Encapsulates the state of the server. | [
"Encapsulates",
"the",
"state",
"of",
"the",
"server",
"."
] | 49413052d3039524fbdd2ade0ef9bae26cb4d647 | https://github.com/redisjs/jsr-server/blob/49413052d3039524fbdd2ade0ef9bae26cb4d647/lib/state.js#L19-L74 |
51,535 | redisjs/jsr-server | lib/state.js | pause | function pause(timeout) {
var log = this._logger;
// keep list of matching clients
var clients = [];
this._conn.forEach(function(conn) {
if(!conn.client.isSlave()) {
clients.push(conn);
conn.pause();
}
})
function resume() {
log.notice('resume %s connections', clients.length);
cl... | javascript | function pause(timeout) {
var log = this._logger;
// keep list of matching clients
var clients = [];
this._conn.forEach(function(conn) {
if(!conn.client.isSlave()) {
clients.push(conn);
conn.pause();
}
})
function resume() {
log.notice('resume %s connections', clients.length);
cl... | [
"function",
"pause",
"(",
"timeout",
")",
"{",
"var",
"log",
"=",
"this",
".",
"_logger",
";",
"// keep list of matching clients",
"var",
"clients",
"=",
"[",
"]",
";",
"this",
".",
"_conn",
".",
"forEach",
"(",
"function",
"(",
"conn",
")",
"{",
"if",
... | Pause normal and pubsub clients. | [
"Pause",
"normal",
"and",
"pubsub",
"clients",
"."
] | 49413052d3039524fbdd2ade0ef9bae26cb4d647 | https://github.com/redisjs/jsr-server/blob/49413052d3039524fbdd2ade0ef9bae26cb4d647/lib/state.js#L81-L99 |
51,536 | redisjs/jsr-server | lib/state.js | expire | function expire() {
var dbs = this._store.databases, i;
for(i in dbs) {
dbs[i].delExpiredKeys();
}
} | javascript | function expire() {
var dbs = this._store.databases, i;
for(i in dbs) {
dbs[i].delExpiredKeys();
}
} | [
"function",
"expire",
"(",
")",
"{",
"var",
"dbs",
"=",
"this",
".",
"_store",
".",
"databases",
",",
"i",
";",
"for",
"(",
"i",
"in",
"dbs",
")",
"{",
"dbs",
"[",
"i",
"]",
".",
"delExpiredKeys",
"(",
")",
";",
"}",
"}"
] | Scheduler tick event that handles expiring keys.
Passive expiry. | [
"Scheduler",
"tick",
"event",
"that",
"handles",
"expiring",
"keys",
"."
] | 49413052d3039524fbdd2ade0ef9bae26cb4d647 | https://github.com/redisjs/jsr-server/blob/49413052d3039524fbdd2ade0ef9bae26cb4d647/lib/state.js#L106-L111 |
51,537 | redisjs/jsr-server | lib/state.js | debug | function debug(rusage, memory) {
var dbs = this._store.databases
, i
, db
, size;
for(i in dbs) {
db = dbs[i];
size = db.dbsize();
if(size) {
this._logger.debug('DB %s: %s keys (%s volatile)', i, size, db.expiring);
}
}
this._logger.debug('%s clients connected, %s heap, %s rss ... | javascript | function debug(rusage, memory) {
var dbs = this._store.databases
, i
, db
, size;
for(i in dbs) {
db = dbs[i];
size = db.dbsize();
if(size) {
this._logger.debug('DB %s: %s keys (%s volatile)', i, size, db.expiring);
}
}
this._logger.debug('%s clients connected, %s heap, %s rss ... | [
"function",
"debug",
"(",
"rusage",
",",
"memory",
")",
"{",
"var",
"dbs",
"=",
"this",
".",
"_store",
".",
"databases",
",",
"i",
",",
"db",
",",
"size",
";",
"for",
"(",
"i",
"in",
"dbs",
")",
"{",
"db",
"=",
"dbs",
"[",
"i",
"]",
";",
"siz... | Listener for the debug log event. | [
"Listener",
"for",
"the",
"debug",
"log",
"event",
"."
] | 49413052d3039524fbdd2ade0ef9bae26cb4d647 | https://github.com/redisjs/jsr-server/blob/49413052d3039524fbdd2ade0ef9bae26cb4d647/lib/state.js#L116-L130 |
51,538 | redisjs/jsr-server | lib/state.js | onConfigLoad | function onConfigLoad() {
var file = this._conf.get(ConfigName.LOGFILE);
this._logger.level(this._conf.get(ConfigName.LOGLEVEL));
//console.dir('config loaded.');
if(file && !this._conf.get(ConfigName.DAEMONIZE)) {
this._logger.stream(file);
}
if(this._conf.isDefault()) {
this._logger.warning('no co... | javascript | function onConfigLoad() {
var file = this._conf.get(ConfigName.LOGFILE);
this._logger.level(this._conf.get(ConfigName.LOGLEVEL));
//console.dir('config loaded.');
if(file && !this._conf.get(ConfigName.DAEMONIZE)) {
this._logger.stream(file);
}
if(this._conf.isDefault()) {
this._logger.warning('no co... | [
"function",
"onConfigLoad",
"(",
")",
"{",
"var",
"file",
"=",
"this",
".",
"_conf",
".",
"get",
"(",
"ConfigName",
".",
"LOGFILE",
")",
";",
"this",
".",
"_logger",
".",
"level",
"(",
"this",
".",
"_conf",
".",
"get",
"(",
"ConfigName",
".",
"LOGLEV... | Listener for the config load event. | [
"Listener",
"for",
"the",
"config",
"load",
"event",
"."
] | 49413052d3039524fbdd2ade0ef9bae26cb4d647 | https://github.com/redisjs/jsr-server/blob/49413052d3039524fbdd2ade0ef9bae26cb4d647/lib/state.js#L135-L150 |
51,539 | Wizcorp/panopticon | index.js | Panopticon | function Panopticon(options) {
var isInstance = this instanceof Panopticon;
if (!isInstance) {
return new Panopticon(options);
}
EventEmitter.call(this);
this.id = instanceCount;
instanceCount += 1;
// First we sort out the methods and data which handle are local to this process.
genericSetup(this, options... | javascript | function Panopticon(options) {
var isInstance = this instanceof Panopticon;
if (!isInstance) {
return new Panopticon(options);
}
EventEmitter.call(this);
this.id = instanceCount;
instanceCount += 1;
// First we sort out the methods and data which handle are local to this process.
genericSetup(this, options... | [
"function",
"Panopticon",
"(",
"options",
")",
"{",
"var",
"isInstance",
"=",
"this",
"instanceof",
"Panopticon",
";",
"if",
"(",
"!",
"isInstance",
")",
"{",
"return",
"new",
"Panopticon",
"(",
"options",
")",
";",
"}",
"EventEmitter",
".",
"call",
"(",
... | The constructor for Panopticon. Handles the differences between master and worker processes.
Please refer to the README for more information.
@param {Object} options The configuration object.
@param {Number} options.startTime Time in ms elapsed since 1 January 1970 00:00:00 UTC.
@param {String} ... | [
"The",
"constructor",
"for",
"Panopticon",
".",
"Handles",
"the",
"differences",
"between",
"master",
"and",
"worker",
"processes",
".",
"Please",
"refer",
"to",
"the",
"README",
"for",
"more",
"information",
"."
] | e0d660cd5287b45aafdb5a91e54affa7364b14e0 | https://github.com/Wizcorp/panopticon/blob/e0d660cd5287b45aafdb5a91e54affa7364b14e0/index.js#L48-L71 |
51,540 | killmenot/jasmine-spy-matchers | lib/mixins/CallTracker.js | function(index) {
var calls = this.all();
var call = calls[index];
return call ? call.object : null;
} | javascript | function(index) {
var calls = this.all();
var call = calls[index];
return call ? call.object : null;
} | [
"function",
"(",
"index",
")",
"{",
"var",
"calls",
"=",
"this",
".",
"all",
"(",
")",
";",
"var",
"call",
"=",
"calls",
"[",
"index",
"]",
";",
"return",
"call",
"?",
"call",
".",
"object",
":",
"null",
";",
"}"
] | Get the this that were passed to a specific invocation of this spy.
@name Spy#calls#thisArgFor
@function
@param {Integer} index The 0-based invocation index.
@return {Object} | [
"Get",
"the",
"this",
"that",
"were",
"passed",
"to",
"a",
"specific",
"invocation",
"of",
"this",
"spy",
"."
] | dc1ad0988220bbc2cfb44eaabc3473a00145c2a2 | https://github.com/killmenot/jasmine-spy-matchers/blob/dc1ad0988220bbc2cfb44eaabc3473a00145c2a2/lib/mixins/CallTracker.js#L13-L18 | |
51,541 | viatsyshyn/emp.ria | syntax/tokenizer.js | isBuildInType | function isBuildInType(type) {
return type === Function
|| type === String
|| type === Boolean
|| type === Number
|| type === RegExp
|| type === Object
|| type === Array
|| type === Date
} | javascript | function isBuildInType(type) {
return type === Function
|| type === String
|| type === Boolean
|| type === Number
|| type === RegExp
|| type === Object
|| type === Array
|| type === Date
} | [
"function",
"isBuildInType",
"(",
"type",
")",
"{",
"return",
"type",
"===",
"Function",
"||",
"type",
"===",
"String",
"||",
"type",
"===",
"Boolean",
"||",
"type",
"===",
"Number",
"||",
"type",
"===",
"RegExp",
"||",
"type",
"===",
"Object",
"||",
"ty... | Checks if type is native js constructor
@param {*} type
@return {Boolean} | [
"Checks",
"if",
"type",
"is",
"native",
"js",
"constructor"
] | 59286e792748a69fc463597e082daf7873529fae | https://github.com/viatsyshyn/emp.ria/blob/59286e792748a69fc463597e082daf7873529fae/syntax/tokenizer.js#L12-L21 |
51,542 | viatsyshyn/emp.ria | syntax/tokenizer.js | isCustomType | function isCustomType(type) {
return ria.__API.isClassConstructor(type)
|| ria.__API.isInterface(type)
|| ria.__API.isEnum(type)
|| ria.__API.isIdentifier(type)
|| ria.__API.isDelegate(type)
|| ria.__API.isSpecification(type);
//|| ArrayOfD... | javascript | function isCustomType(type) {
return ria.__API.isClassConstructor(type)
|| ria.__API.isInterface(type)
|| ria.__API.isEnum(type)
|| ria.__API.isIdentifier(type)
|| ria.__API.isDelegate(type)
|| ria.__API.isSpecification(type);
//|| ArrayOfD... | [
"function",
"isCustomType",
"(",
"type",
")",
"{",
"return",
"ria",
".",
"__API",
".",
"isClassConstructor",
"(",
"type",
")",
"||",
"ria",
".",
"__API",
".",
"isInterface",
"(",
"type",
")",
"||",
"ria",
".",
"__API",
".",
"isEnum",
"(",
"type",
")",
... | Checks if type is ria enabled custom constructor
@param {*} type
@return {Boolean} | [
"Checks",
"if",
"type",
"is",
"ria",
"enabled",
"custom",
"constructor"
] | 59286e792748a69fc463597e082daf7873529fae | https://github.com/viatsyshyn/emp.ria/blob/59286e792748a69fc463597e082daf7873529fae/syntax/tokenizer.js#L28-L37 |
51,543 | aaronmccall/ampersand-model-patch-mixin | lib/utils.js | smartIndexOf | function smartIndexOf(array, test) {
var index = -1;
if (!array || !test) return index;
var length = array.length;
if (!length) return index;
while (++index < length) {
if (test(array[index], index, array)) return index;
}
return -1;
} | javascript | function smartIndexOf(array, test) {
var index = -1;
if (!array || !test) return index;
var length = array.length;
if (!length) return index;
while (++index < length) {
if (test(array[index], index, array)) return index;
}
return -1;
} | [
"function",
"smartIndexOf",
"(",
"array",
",",
"test",
")",
"{",
"var",
"index",
"=",
"-",
"1",
";",
"if",
"(",
"!",
"array",
"||",
"!",
"test",
")",
"return",
"index",
";",
"var",
"length",
"=",
"array",
".",
"length",
";",
"if",
"(",
"!",
"leng... | Find index of array member that passes test | [
"Find",
"index",
"of",
"array",
"member",
"that",
"passes",
"test"
] | 28dd7797a306dcaa79d2eefdf904a4bb4fbdebbc | https://github.com/aaronmccall/ampersand-model-patch-mixin/blob/28dd7797a306dcaa79d2eefdf904a4bb4fbdebbc/lib/utils.js#L2-L11 |
51,544 | aaronmccall/ampersand-model-patch-mixin | lib/utils.js | indexById | function indexById(array, id) {
if (!array) return -1;
return smartIndexOf(array, function (obj) {
return obj.id === id;
});
} | javascript | function indexById(array, id) {
if (!array) return -1;
return smartIndexOf(array, function (obj) {
return obj.id === id;
});
} | [
"function",
"indexById",
"(",
"array",
",",
"id",
")",
"{",
"if",
"(",
"!",
"array",
")",
"return",
"-",
"1",
";",
"return",
"smartIndexOf",
"(",
"array",
",",
"function",
"(",
"obj",
")",
"{",
"return",
"obj",
".",
"id",
"===",
"id",
";",
"}",
"... | Returns index of object with matching id property | [
"Returns",
"index",
"of",
"object",
"with",
"matching",
"id",
"property"
] | 28dd7797a306dcaa79d2eefdf904a4bb4fbdebbc | https://github.com/aaronmccall/ampersand-model-patch-mixin/blob/28dd7797a306dcaa79d2eefdf904a4bb4fbdebbc/lib/utils.js#L15-L20 |
51,545 | gtuk/tvmaze-api | tvmaze.js | querySearch | function querySearch( query, single, embed, callback ) {
var embd = '';
if ( single ) {
for ( var key in embed ) {
if ( embed.hasOwnProperty(key) ) {
embd += '&embed[]=' + embed[key];
}
}
}
var url = apiBaseUrl + ( single ? endpoints['query']... | javascript | function querySearch( query, single, embed, callback ) {
var embd = '';
if ( single ) {
for ( var key in embed ) {
if ( embed.hasOwnProperty(key) ) {
embd += '&embed[]=' + embed[key];
}
}
}
var url = apiBaseUrl + ( single ? endpoints['query']... | [
"function",
"querySearch",
"(",
"query",
",",
"single",
",",
"embed",
",",
"callback",
")",
"{",
"var",
"embd",
"=",
"''",
";",
"if",
"(",
"single",
")",
"{",
"for",
"(",
"var",
"key",
"in",
"embed",
")",
"{",
"if",
"(",
"embed",
".",
"hasOwnProper... | Search by query string
@param query
@param single
@param embed
@param callback | [
"Search",
"by",
"query",
"string"
] | 94597b17ac5ce84846e3348e0c557f7be106d8c4 | https://github.com/gtuk/tvmaze-api/blob/94597b17ac5ce84846e3348e0c557f7be106d8c4/tvmaze.js#L29-L44 |
51,546 | gtuk/tvmaze-api | tvmaze.js | idSearch | function idSearch( id, type, callback ) {
if ( ! endpoints['id'].hasOwnProperty(type) ) {
return callback(new Error('No valid type'));
}
var url = apiBaseUrl+endpoints['id'][type] + id;
fetch(url, function(result) {
callback(result);
});
} | javascript | function idSearch( id, type, callback ) {
if ( ! endpoints['id'].hasOwnProperty(type) ) {
return callback(new Error('No valid type'));
}
var url = apiBaseUrl+endpoints['id'][type] + id;
fetch(url, function(result) {
callback(result);
});
} | [
"function",
"idSearch",
"(",
"id",
",",
"type",
",",
"callback",
")",
"{",
"if",
"(",
"!",
"endpoints",
"[",
"'id'",
"]",
".",
"hasOwnProperty",
"(",
"type",
")",
")",
"{",
"return",
"callback",
"(",
"new",
"Error",
"(",
"'No valid type'",
")",
")",
... | Search by imdb, tvrage or tvdb id
@param id
@param type
@param callback | [
"Search",
"by",
"imdb",
"tvrage",
"or",
"tvdb",
"id"
] | 94597b17ac5ce84846e3348e0c557f7be106d8c4 | https://github.com/gtuk/tvmaze-api/blob/94597b17ac5ce84846e3348e0c557f7be106d8c4/tvmaze.js#L53-L63 |
51,547 | gtuk/tvmaze-api | tvmaze.js | showSearch | function showSearch( id, embed, callback ) {
var embd = '';
for ( var key in embed ) {
if ( embed.hasOwnProperty(key) ) {
embd += ( 0 == key ? '?' : '&' ) + 'embed[]=' + embed[key];
}
}
var url = apiBaseUrl+endpoints['show'] + id + embd;
fetch(url, function(result) {
... | javascript | function showSearch( id, embed, callback ) {
var embd = '';
for ( var key in embed ) {
if ( embed.hasOwnProperty(key) ) {
embd += ( 0 == key ? '?' : '&' ) + 'embed[]=' + embed[key];
}
}
var url = apiBaseUrl+endpoints['show'] + id + embd;
fetch(url, function(result) {
... | [
"function",
"showSearch",
"(",
"id",
",",
"embed",
",",
"callback",
")",
"{",
"var",
"embd",
"=",
"''",
";",
"for",
"(",
"var",
"key",
"in",
"embed",
")",
"{",
"if",
"(",
"embed",
".",
"hasOwnProperty",
"(",
"key",
")",
")",
"{",
"embd",
"+=",
"(... | Get show infos by id
@param id
@param embed
@param callback | [
"Get",
"show",
"infos",
"by",
"id"
] | 94597b17ac5ce84846e3348e0c557f7be106d8c4 | https://github.com/gtuk/tvmaze-api/blob/94597b17ac5ce84846e3348e0c557f7be106d8c4/tvmaze.js#L72-L85 |
51,548 | gtuk/tvmaze-api | tvmaze.js | showPeople | function showPeople( id, callback ) {
var url = apiBaseUrl+endpoints['people'] + id;
fetch(url, function(result) {
callback(result);
});
} | javascript | function showPeople( id, callback ) {
var url = apiBaseUrl+endpoints['people'] + id;
fetch(url, function(result) {
callback(result);
});
} | [
"function",
"showPeople",
"(",
"id",
",",
"callback",
")",
"{",
"var",
"url",
"=",
"apiBaseUrl",
"+",
"endpoints",
"[",
"'people'",
"]",
"+",
"id",
";",
"fetch",
"(",
"url",
",",
"function",
"(",
"result",
")",
"{",
"callback",
"(",
"result",
")",
";... | Get people main information by id
@param id
@param callback | [
"Get",
"people",
"main",
"information",
"by",
"id"
] | 94597b17ac5ce84846e3348e0c557f7be106d8c4 | https://github.com/gtuk/tvmaze-api/blob/94597b17ac5ce84846e3348e0c557f7be106d8c4/tvmaze.js#L93-L99 |
51,549 | gtuk/tvmaze-api | tvmaze.js | scheduleSearch | function scheduleSearch( country, date, callback ) {
var url = apiBaseUrl+endpoints['schedule'].replace('$1', country).replace('$2', date);
fetch(url, function(result) {
callback(result);
});
} | javascript | function scheduleSearch( country, date, callback ) {
var url = apiBaseUrl+endpoints['schedule'].replace('$1', country).replace('$2', date);
fetch(url, function(result) {
callback(result);
});
} | [
"function",
"scheduleSearch",
"(",
"country",
",",
"date",
",",
"callback",
")",
"{",
"var",
"url",
"=",
"apiBaseUrl",
"+",
"endpoints",
"[",
"'schedule'",
"]",
".",
"replace",
"(",
"'$1'",
",",
"country",
")",
".",
"replace",
"(",
"'$2'",
",",
"date",
... | Search schedule for specific country and date
@param country
@param date
@param callback | [
"Search",
"schedule",
"for",
"specific",
"country",
"and",
"date"
] | 94597b17ac5ce84846e3348e0c557f7be106d8c4 | https://github.com/gtuk/tvmaze-api/blob/94597b17ac5ce84846e3348e0c557f7be106d8c4/tvmaze.js#L108-L114 |
51,550 | gtuk/tvmaze-api | tvmaze.js | fetch | function fetch( url, callback ) {
request({ url: url, json: true }, function( err, resp, data ) {
if (err) {
return callback(err);
}
if ( 200 != resp.statusCode ) {
return callback(new Error(resp.statusMessage));
}
callback(data);
});
} | javascript | function fetch( url, callback ) {
request({ url: url, json: true }, function( err, resp, data ) {
if (err) {
return callback(err);
}
if ( 200 != resp.statusCode ) {
return callback(new Error(resp.statusMessage));
}
callback(data);
});
} | [
"function",
"fetch",
"(",
"url",
",",
"callback",
")",
"{",
"request",
"(",
"{",
"url",
":",
"url",
",",
"json",
":",
"true",
"}",
",",
"function",
"(",
"err",
",",
"resp",
",",
"data",
")",
"{",
"if",
"(",
"err",
")",
"{",
"return",
"callback",
... | Actual request against the tvmaze api
@param url
@param callback | [
"Actual",
"request",
"against",
"the",
"tvmaze",
"api"
] | 94597b17ac5ce84846e3348e0c557f7be106d8c4 | https://github.com/gtuk/tvmaze-api/blob/94597b17ac5ce84846e3348e0c557f7be106d8c4/tvmaze.js#L122-L134 |
51,551 | tolokoban/ToloFrameWork | lib/context.js | function( packageFilename, options ) {
if( typeof options === 'undefined' ) options = {};
packageFilename = Path.resolve( packageFilename );
if( false == FS.existsSync() )
this.fatal( "Package file not found: \"" + packageFilename + "\"" );
var prjDir = Path.dirname( packageFilename );
... | javascript | function( packageFilename, options ) {
if( typeof options === 'undefined' ) options = {};
packageFilename = Path.resolve( packageFilename );
if( false == FS.existsSync() )
this.fatal( "Package file not found: \"" + packageFilename + "\"" );
var prjDir = Path.dirname( packageFilename );
... | [
"function",
"(",
"packageFilename",
",",
"options",
")",
"{",
"if",
"(",
"typeof",
"options",
"===",
"'undefined'",
")",
"options",
"=",
"{",
"}",
";",
"packageFilename",
"=",
"Path",
".",
"resolve",
"(",
"packageFilename",
")",
";",
"if",
"(",
"false",
... | This is the context of a project. A project is definied by its `package.json` file. | [
"This",
"is",
"the",
"context",
"of",
"a",
"project",
".",
"A",
"project",
"is",
"definied",
"by",
"its",
"package",
".",
"json",
"file",
"."
] | 730845a833a9660ebfdb60ad027ebaab5ac871b6 | https://github.com/tolokoban/ToloFrameWork/blob/730845a833a9660ebfdb60ad027ebaab5ac871b6/lib/context.js#L10-L26 | |
51,552 | beemo-js/beemo | lib/components/validation/annotations/constraints.js | addAnnotation | function addAnnotation(target, key, index, data) {
const classAnnotationsStore = container.get(AnnotationsServiceName.ClassAnnotationsStore);
if (index === undefined) {
// property
classAnnotationsStore.addPropertyAnnotation(target.constructor, key, Constraints, data);
}
else {
/... | javascript | function addAnnotation(target, key, index, data) {
const classAnnotationsStore = container.get(AnnotationsServiceName.ClassAnnotationsStore);
if (index === undefined) {
// property
classAnnotationsStore.addPropertyAnnotation(target.constructor, key, Constraints, data);
}
else {
/... | [
"function",
"addAnnotation",
"(",
"target",
",",
"key",
",",
"index",
",",
"data",
")",
"{",
"const",
"classAnnotationsStore",
"=",
"container",
".",
"get",
"(",
"AnnotationsServiceName",
".",
"ClassAnnotationsStore",
")",
";",
"if",
"(",
"index",
"===",
"unde... | Annotation to property or method | [
"Annotation",
"to",
"property",
"or",
"method"
] | b3fb926c03f55803ae49bf730c09ecbbdd78b8b8 | https://github.com/beemo-js/beemo/blob/b3fb926c03f55803ae49bf730c09ecbbdd78b8b8/lib/components/validation/annotations/constraints.js#L5-L15 |
51,553 | derdesign/protos | middleware/static_server/static_server.js | createStaticFileRegex | function createStaticFileRegex() {
var regex = '^\\/(',
staticViews = this.views.static;
// Get directories in public/
var files = getStaticDirs.call(this);
// Iterate over files and append to regex
for (var path, dir, re, i=0; i < files.length; i++) {
dir = files[i];
path = dir.replace(this.re... | javascript | function createStaticFileRegex() {
var regex = '^\\/(',
staticViews = this.views.static;
// Get directories in public/
var files = getStaticDirs.call(this);
// Iterate over files and append to regex
for (var path, dir, re, i=0; i < files.length; i++) {
dir = files[i];
path = dir.replace(this.re... | [
"function",
"createStaticFileRegex",
"(",
")",
"{",
"var",
"regex",
"=",
"'^\\\\/('",
",",
"staticViews",
"=",
"this",
".",
"views",
".",
"static",
";",
"// Get directories in public/",
"var",
"files",
"=",
"getStaticDirs",
".",
"call",
"(",
"this",
")",
";",
... | Creates the static file regex
@private | [
"Creates",
"the",
"static",
"file",
"regex"
] | 0b679b2a7581dfbb5d065fd4b0914436ef4ef2c9 | https://github.com/derdesign/protos/blob/0b679b2a7581dfbb5d065fd4b0914436ef4ef2c9/middleware/static_server/static_server.js#L45-L72 |
51,554 | derdesign/protos | middleware/static_server/static_server.js | getStaticDirs | function getStaticDirs() {
var files = fs.readdirSync(this.path + '/' + this.paths.public),
dirs = [];
for (var file, stat, i=0; i < files.length; i++) {
file = files[i];
stat = fs.lstatSync(this.path + '/' + this.paths.public + file);
if ( stat.isDirectory() ) dirs.push(file);
}
return dirs;
} | javascript | function getStaticDirs() {
var files = fs.readdirSync(this.path + '/' + this.paths.public),
dirs = [];
for (var file, stat, i=0; i < files.length; i++) {
file = files[i];
stat = fs.lstatSync(this.path + '/' + this.paths.public + file);
if ( stat.isDirectory() ) dirs.push(file);
}
return dirs;
} | [
"function",
"getStaticDirs",
"(",
")",
"{",
"var",
"files",
"=",
"fs",
".",
"readdirSync",
"(",
"this",
".",
"path",
"+",
"'/'",
"+",
"this",
".",
"paths",
".",
"public",
")",
",",
"dirs",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"file",
",",
"stat... | Gets the static directories available in the application's public
@returns {array}
@private | [
"Gets",
"the",
"static",
"directories",
"available",
"in",
"the",
"application",
"s",
"public"
] | 0b679b2a7581dfbb5d065fd4b0914436ef4ef2c9 | https://github.com/derdesign/protos/blob/0b679b2a7581dfbb5d065fd4b0914436ef4ef2c9/middleware/static_server/static_server.js#L81-L90 |
51,555 | byron-dupreez/aws-stream-consumer-core | sequencing.js | sequenceMessages | function sequenceMessages(batch, context) {
const states = batch.states;
const messages = batch.messages;
if (messages.length < 2 || !context.streamProcessing.sequencingRequired) {
return messages;
}
// First prepare the messages for sequencing by normalizing all of the messages' sequence numbers
prep... | javascript | function sequenceMessages(batch, context) {
const states = batch.states;
const messages = batch.messages;
if (messages.length < 2 || !context.streamProcessing.sequencingRequired) {
return messages;
}
// First prepare the messages for sequencing by normalizing all of the messages' sequence numbers
prep... | [
"function",
"sequenceMessages",
"(",
"batch",
",",
"context",
")",
"{",
"const",
"states",
"=",
"batch",
".",
"states",
";",
"const",
"messages",
"=",
"batch",
".",
"messages",
";",
"if",
"(",
"messages",
".",
"length",
"<",
"2",
"||",
"!",
"context",
... | Sequences the given entire batch of messages by linking messages with the same keys to each other via their
nextMessage and prevMessage properties in sequences determined by their sequence numbers.
@param {Batch} batch - the batch containing the messages to be sequenced
@param {StreamConsumerContext} context - the cont... | [
"Sequences",
"the",
"given",
"entire",
"batch",
"of",
"messages",
"by",
"linking",
"messages",
"with",
"the",
"same",
"keys",
"to",
"each",
"other",
"via",
"their",
"nextMessage",
"and",
"prevMessage",
"properties",
"in",
"sequences",
"determined",
"by",
"their"... | 9b256084297f80d373bcf483aaf68a9da176b3d7 | https://github.com/byron-dupreez/aws-stream-consumer-core/blob/9b256084297f80d373bcf483aaf68a9da176b3d7/sequencing.js#L283-L351 |
51,556 | Frederikbh/tickspotv2-api | lib/service.js | getAuthorization | function getAuthorization(user, auth) {
if (auth === AUTH_BASIC) {
return 'Basic ' + btoa(user.username + ':' + user.password);
} else if (auth === AUTH_TOKEN) {
return 'Token token=' + user.token;
}
} | javascript | function getAuthorization(user, auth) {
if (auth === AUTH_BASIC) {
return 'Basic ' + btoa(user.username + ':' + user.password);
} else if (auth === AUTH_TOKEN) {
return 'Token token=' + user.token;
}
} | [
"function",
"getAuthorization",
"(",
"user",
",",
"auth",
")",
"{",
"if",
"(",
"auth",
"===",
"AUTH_BASIC",
")",
"{",
"return",
"'Basic '",
"+",
"btoa",
"(",
"user",
".",
"username",
"+",
"':'",
"+",
"user",
".",
"password",
")",
";",
"}",
"else",
"i... | Gets the correctly formatted authorization header | [
"Gets",
"the",
"correctly",
"formatted",
"authorization",
"header"
] | 07fb0cdf62e9eb9cb05f74be07130c7472b2bf84 | https://github.com/Frederikbh/tickspotv2-api/blob/07fb0cdf62e9eb9cb05f74be07130c7472b2bf84/lib/service.js#L10-L16 |
51,557 | Frederikbh/tickspotv2-api | lib/service.js | getParams | function getParams(user, auth, url, options, headers) {
return _.extend({
url: url,
headers: _.extend({
'User-Agent': user.userAgent,
'Authorization': getAuthorization(user, auth)
}, headers)
}, options);
} | javascript | function getParams(user, auth, url, options, headers) {
return _.extend({
url: url,
headers: _.extend({
'User-Agent': user.userAgent,
'Authorization': getAuthorization(user, auth)
}, headers)
}, options);
} | [
"function",
"getParams",
"(",
"user",
",",
"auth",
",",
"url",
",",
"options",
",",
"headers",
")",
"{",
"return",
"_",
".",
"extend",
"(",
"{",
"url",
":",
"url",
",",
"headers",
":",
"_",
".",
"extend",
"(",
"{",
"'User-Agent'",
":",
"user",
".",... | Creates the params object for the request | [
"Creates",
"the",
"params",
"object",
"for",
"the",
"request"
] | 07fb0cdf62e9eb9cb05f74be07130c7472b2bf84 | https://github.com/Frederikbh/tickspotv2-api/blob/07fb0cdf62e9eb9cb05f74be07130c7472b2bf84/lib/service.js#L19-L27 |
51,558 | Frederikbh/tickspotv2-api | lib/service.js | makeRequest | function makeRequest(user, auth, url, cb, options = {}, headers = {}) {
const params = getParams(user, auth, url, options, headers);
const promise = new Promise((resolve, reject) => {
request(params, (err, response, body) => {
if (!err && [200, 201, 204, 301].indexOf(response.statusCode) > ... | javascript | function makeRequest(user, auth, url, cb, options = {}, headers = {}) {
const params = getParams(user, auth, url, options, headers);
const promise = new Promise((resolve, reject) => {
request(params, (err, response, body) => {
if (!err && [200, 201, 204, 301].indexOf(response.statusCode) > ... | [
"function",
"makeRequest",
"(",
"user",
",",
"auth",
",",
"url",
",",
"cb",
",",
"options",
"=",
"{",
"}",
",",
"headers",
"=",
"{",
"}",
")",
"{",
"const",
"params",
"=",
"getParams",
"(",
"user",
",",
"auth",
",",
"url",
",",
"options",
",",
"h... | Makes the http request | [
"Makes",
"the",
"http",
"request"
] | 07fb0cdf62e9eb9cb05f74be07130c7472b2bf84 | https://github.com/Frederikbh/tickspotv2-api/blob/07fb0cdf62e9eb9cb05f74be07130c7472b2bf84/lib/service.js#L30-L47 |
51,559 | Frederikbh/tickspotv2-api | lib/service.js | extractHeaders | function extractHeaders(options) {
let headers = {};
if (options && options.headers) {
headers = options.headers;
delete options.headers;
}
return headers;
} | javascript | function extractHeaders(options) {
let headers = {};
if (options && options.headers) {
headers = options.headers;
delete options.headers;
}
return headers;
} | [
"function",
"extractHeaders",
"(",
"options",
")",
"{",
"let",
"headers",
"=",
"{",
"}",
";",
"if",
"(",
"options",
"&&",
"options",
".",
"headers",
")",
"{",
"headers",
"=",
"options",
".",
"headers",
";",
"delete",
"options",
".",
"headers",
";",
"}"... | Extract headers from options object | [
"Extract",
"headers",
"from",
"options",
"object"
] | 07fb0cdf62e9eb9cb05f74be07130c7472b2bf84 | https://github.com/Frederikbh/tickspotv2-api/blob/07fb0cdf62e9eb9cb05f74be07130c7472b2bf84/lib/service.js#L64-L71 |
51,560 | Frederikbh/tickspotv2-api | lib/service.js | parseArguments | function parseArguments(options, callback) {
if (_.isUndefined(options) && _.isUndefined(callback)) { // No params
return [{}, undefined];
}
if (!_.isUndefined(options) && _.isFunction(options)) { // Only callback param
callback = options;
options = {};
}
return [options, cal... | javascript | function parseArguments(options, callback) {
if (_.isUndefined(options) && _.isUndefined(callback)) { // No params
return [{}, undefined];
}
if (!_.isUndefined(options) && _.isFunction(options)) { // Only callback param
callback = options;
options = {};
}
return [options, cal... | [
"function",
"parseArguments",
"(",
"options",
",",
"callback",
")",
"{",
"if",
"(",
"_",
".",
"isUndefined",
"(",
"options",
")",
"&&",
"_",
".",
"isUndefined",
"(",
"callback",
")",
")",
"{",
"// No params",
"return",
"[",
"{",
"}",
",",
"undefined",
... | Parses arguments provided, makes it possible to only apply a callback function | [
"Parses",
"arguments",
"provided",
"makes",
"it",
"possible",
"to",
"only",
"apply",
"a",
"callback",
"function"
] | 07fb0cdf62e9eb9cb05f74be07130c7472b2bf84 | https://github.com/Frederikbh/tickspotv2-api/blob/07fb0cdf62e9eb9cb05f74be07130c7472b2bf84/lib/service.js#L74-L83 |
51,561 | Frederikbh/tickspotv2-api | lib/service.js | http | function http(tick, args) {
let url = 'https://www.tickspot.com/' + tick.subscriptionID + '/api/v2/';
url += args.paths.join('/') + '.json';
if (args.query) {
url += '?';
url += _.pairs(args.query).map(p => p.join('=')).join('&');
}
return url;
} | javascript | function http(tick, args) {
let url = 'https://www.tickspot.com/' + tick.subscriptionID + '/api/v2/';
url += args.paths.join('/') + '.json';
if (args.query) {
url += '?';
url += _.pairs(args.query).map(p => p.join('=')).join('&');
}
return url;
} | [
"function",
"http",
"(",
"tick",
",",
"args",
")",
"{",
"let",
"url",
"=",
"'https://www.tickspot.com/'",
"+",
"tick",
".",
"subscriptionID",
"+",
"'/api/v2/'",
";",
"url",
"+=",
"args",
".",
"paths",
".",
"join",
"(",
"'/'",
")",
"+",
"'.json'",
";",
... | Formats the url | [
"Formats",
"the",
"url"
] | 07fb0cdf62e9eb9cb05f74be07130c7472b2bf84 | https://github.com/Frederikbh/tickspotv2-api/blob/07fb0cdf62e9eb9cb05f74be07130c7472b2bf84/lib/service.js#L86-L95 |
51,562 | Frederikbh/tickspotv2-api | lib/service.js | extractPage | function extractPage(options) {
let page = 1;
if (options && options.page) {
page = options.page;
delete options.page;
}
return page;
} | javascript | function extractPage(options) {
let page = 1;
if (options && options.page) {
page = options.page;
delete options.page;
}
return page;
} | [
"function",
"extractPage",
"(",
"options",
")",
"{",
"let",
"page",
"=",
"1",
";",
"if",
"(",
"options",
"&&",
"options",
".",
"page",
")",
"{",
"page",
"=",
"options",
".",
"page",
";",
"delete",
"options",
".",
"page",
";",
"}",
"return",
"page",
... | Extracts page from options | [
"Extracts",
"page",
"from",
"options"
] | 07fb0cdf62e9eb9cb05f74be07130c7472b2bf84 | https://github.com/Frederikbh/tickspotv2-api/blob/07fb0cdf62e9eb9cb05f74be07130c7472b2bf84/lib/service.js#L98-L105 |
51,563 | derdesign/protos | middleware/cookie_parser/application.js | parseCookie | function parseCookie(str) {
var obj = {},
pairs = str.split(/[;,] */);
for (var pair,eqlIndex,key,val,i=0; i < pairs.length; i++) {
pair = pairs[i];
eqlIndex = pair.indexOf('=');
key = pair.substr(0, eqlIndex).trim().toLowerCase();
val = pair.substr(++eqlIndex, pair.length).trim();
if ('"' ... | javascript | function parseCookie(str) {
var obj = {},
pairs = str.split(/[;,] */);
for (var pair,eqlIndex,key,val,i=0; i < pairs.length; i++) {
pair = pairs[i];
eqlIndex = pair.indexOf('=');
key = pair.substr(0, eqlIndex).trim().toLowerCase();
val = pair.substr(++eqlIndex, pair.length).trim();
if ('"' ... | [
"function",
"parseCookie",
"(",
"str",
")",
"{",
"var",
"obj",
"=",
"{",
"}",
",",
"pairs",
"=",
"str",
".",
"split",
"(",
"/",
"[;,] *",
"/",
")",
";",
"for",
"(",
"var",
"pair",
",",
"eqlIndex",
",",
"key",
",",
"val",
",",
"i",
"=",
"0",
"... | Parses the cookie header
@param {string} str
@returns {object}
@private | [
"Parses",
"the",
"cookie",
"header"
] | 0b679b2a7581dfbb5d065fd4b0914436ef4ef2c9 | https://github.com/derdesign/protos/blob/0b679b2a7581dfbb5d065fd4b0914436ef4ef2c9/middleware/cookie_parser/application.js#L32-L56 |
51,564 | derdesign/protos | middleware/cookie_parser/application.js | getRequestCookies | function getRequestCookies(req) {
if (req.headers.cookie != null) {
try {
return parseCookie(req.headers.cookie);
} catch (e) {
this.log(req.urlData.pathname, "Error parsing cookie header: " + e.toString());
return {};
}
} else {
return {};
}
} | javascript | function getRequestCookies(req) {
if (req.headers.cookie != null) {
try {
return parseCookie(req.headers.cookie);
} catch (e) {
this.log(req.urlData.pathname, "Error parsing cookie header: " + e.toString());
return {};
}
} else {
return {};
}
} | [
"function",
"getRequestCookies",
"(",
"req",
")",
"{",
"if",
"(",
"req",
".",
"headers",
".",
"cookie",
"!=",
"null",
")",
"{",
"try",
"{",
"return",
"parseCookie",
"(",
"req",
".",
"headers",
".",
"cookie",
")",
";",
"}",
"catch",
"(",
"e",
")",
"... | Parses the request cookies
@param {object} req
@returns {object}
@private | [
"Parses",
"the",
"request",
"cookies"
] | 0b679b2a7581dfbb5d065fd4b0914436ef4ef2c9 | https://github.com/derdesign/protos/blob/0b679b2a7581dfbb5d065fd4b0914436ef4ef2c9/middleware/cookie_parser/application.js#L66-L77 |
51,565 | shadybones/fakery | examples/use_features.js | function(a,b){
if(b[0]=="my-id") {
var fakeResult = [];
return fakeResult;
}else return document.getElementById.apply(document,b);
} | javascript | function(a,b){
if(b[0]=="my-id") {
var fakeResult = [];
return fakeResult;
}else return document.getElementById.apply(document,b);
} | [
"function",
"(",
"a",
",",
"b",
")",
"{",
"if",
"(",
"b",
"[",
"0",
"]",
"==",
"\"my-id\"",
")",
"{",
"var",
"fakeResult",
"=",
"[",
"]",
";",
"return",
"fakeResult",
";",
"}",
"else",
"return",
"document",
".",
"getElementById",
".",
"apply",
"(",... | a = fake object, b = args | [
"a",
"=",
"fake",
"object",
"b",
"=",
"args"
] | 0ca9adec545595f4cdeaadbf9a3c33d0514b5061 | https://github.com/shadybones/fakery/blob/0ca9adec545595f4cdeaadbf9a3c33d0514b5061/examples/use_features.js#L23-L28 | |
51,566 | Digznav/bilberry | git-porcelain-status.js | gitPorcelainStatus | function gitPorcelainStatus() {
return git('status --porcelain -b', stdout => {
const status = gitUtil.extractStatus(stdout);
let parsedStatus = Object.values(status.index).concat(Object.values(status.workingTree));
// Flattened
parsedStatus = parsedStatus.reduce((a, b) => a.concat(b), []);
retu... | javascript | function gitPorcelainStatus() {
return git('status --porcelain -b', stdout => {
const status = gitUtil.extractStatus(stdout);
let parsedStatus = Object.values(status.index).concat(Object.values(status.workingTree));
// Flattened
parsedStatus = parsedStatus.reduce((a, b) => a.concat(b), []);
retu... | [
"function",
"gitPorcelainStatus",
"(",
")",
"{",
"return",
"git",
"(",
"'status --porcelain -b'",
",",
"stdout",
"=>",
"{",
"const",
"status",
"=",
"gitUtil",
".",
"extractStatus",
"(",
"stdout",
")",
";",
"let",
"parsedStatus",
"=",
"Object",
".",
"values",
... | Verify the status of the repository.
@return {object} Current branch and the status of hte repository. | [
"Verify",
"the",
"status",
"of",
"the",
"repository",
"."
] | ef6db49de6c8b0d2f4f9d3e10e8a8153e39ffcc4 | https://github.com/Digznav/bilberry/blob/ef6db49de6c8b0d2f4f9d3e10e8a8153e39ffcc4/git-porcelain-status.js#L8-L22 |
51,567 | LoveKino/ast-transfer | src/lazy/lazyCode.js | function(args, fn, type) {
this.args = args;
this.fn = fn;
this.type = type;
this.id = prefix + _code_node_id_count++;
} | javascript | function(args, fn, type) {
this.args = args;
this.fn = fn;
this.type = type;
this.id = prefix + _code_node_id_count++;
} | [
"function",
"(",
"args",
",",
"fn",
",",
"type",
")",
"{",
"this",
".",
"args",
"=",
"args",
";",
"this",
".",
"fn",
"=",
"fn",
";",
"this",
".",
"type",
"=",
"type",
";",
"this",
".",
"id",
"=",
"prefix",
"+",
"_code_node_id_count",
"++",
";",
... | Normally, when reduce a production, will new a LazyCode object
TODO fast way to indicate ancestor-descendant relationship | [
"Normally",
"when",
"reduce",
"a",
"production",
"will",
"new",
"a",
"LazyCode",
"object"
] | d0592343589e55ddee5ed9816632c7160a09d205 | https://github.com/LoveKino/ast-transfer/blob/d0592343589e55ddee5ed9816632c7160a09d205/src/lazy/lazyCode.js#L12-L18 | |
51,568 | cli-kit/cli-help | lib/doc/gnu.js | function() {
HelpDocument.apply(this, arguments);
this.useCustom = false;
this.sections = [
HelpDocument.SYNOPSIS,
HelpDocument.DESCRIPTION,
HelpDocument.COMMANDS,
HelpDocument.OPTIONS,
HelpDocument.BUGS
]
} | javascript | function() {
HelpDocument.apply(this, arguments);
this.useCustom = false;
this.sections = [
HelpDocument.SYNOPSIS,
HelpDocument.DESCRIPTION,
HelpDocument.COMMANDS,
HelpDocument.OPTIONS,
HelpDocument.BUGS
]
} | [
"function",
"(",
")",
"{",
"HelpDocument",
".",
"apply",
"(",
"this",
",",
"arguments",
")",
";",
"this",
".",
"useCustom",
"=",
"false",
";",
"this",
".",
"sections",
"=",
"[",
"HelpDocument",
".",
"SYNOPSIS",
",",
"HelpDocument",
".",
"DESCRIPTION",
",... | Write help as a plain text document as if it were
being sent to a tty. | [
"Write",
"help",
"as",
"a",
"plain",
"text",
"document",
"as",
"if",
"it",
"were",
"being",
"sent",
"to",
"a",
"tty",
"."
] | 09613efdd753452b466d4deb7c5391c4926e3f04 | https://github.com/cli-kit/cli-help/blob/09613efdd753452b466d4deb7c5391c4926e3f04/lib/doc/gnu.js#L12-L22 | |
51,569 | pimbrouwers/ditto | src/index.js | clean | function clean (callback) {
if (this._clobber) {
rimraf(path.join(destination, this._clobberGlob), callback);
}
else {
callback(null);
}
} | javascript | function clean (callback) {
if (this._clobber) {
rimraf(path.join(destination, this._clobberGlob), callback);
}
else {
callback(null);
}
} | [
"function",
"clean",
"(",
"callback",
")",
"{",
"if",
"(",
"this",
".",
"_clobber",
")",
"{",
"rimraf",
"(",
"path",
".",
"join",
"(",
"destination",
",",
"this",
".",
"_clobberGlob",
")",
",",
"callback",
")",
";",
"}",
"else",
"{",
"callback",
"(",... | Clean destination if clobber
@param {Function} callback | [
"Clean",
"destination",
"if",
"clobber"
] | 0217cecdec04606e896d3339f40e75b47dea8b77 | https://github.com/pimbrouwers/ditto/blob/0217cecdec04606e896d3339f40e75b47dea8b77/src/index.js#L124-L131 |
51,570 | pimbrouwers/ditto | src/index.js | discover | function discover (callback) {
glob(path.join(this._source, '/**/*.*'), function (err, filepaths) {
if (err) callback(err);
callback(null, filepaths);
});
} | javascript | function discover (callback) {
glob(path.join(this._source, '/**/*.*'), function (err, filepaths) {
if (err) callback(err);
callback(null, filepaths);
});
} | [
"function",
"discover",
"(",
"callback",
")",
"{",
"glob",
"(",
"path",
".",
"join",
"(",
"this",
".",
"_source",
",",
"'/**/*.*'",
")",
",",
"function",
"(",
"err",
",",
"filepaths",
")",
"{",
"if",
"(",
"err",
")",
"callback",
"(",
"err",
")",
";... | Discover & parse files in source directory
@param {Function.<Error, Array.<string>>} callback | [
"Discover",
"&",
"parse",
"files",
"in",
"source",
"directory"
] | 0217cecdec04606e896d3339f40e75b47dea8b77 | https://github.com/pimbrouwers/ditto/blob/0217cecdec04606e896d3339f40e75b47dea8b77/src/index.js#L137-L142 |
51,571 | pimbrouwers/ditto | src/index.js | run | function run (files, callback) {
let self = this,
i = 0;
function next(err, files) {
let mw = self.middleware[i++];
if (mw) {
mw(files, self, next);
}
else {
callback(null, files);
}
};
next(null, files);
} | javascript | function run (files, callback) {
let self = this,
i = 0;
function next(err, files) {
let mw = self.middleware[i++];
if (mw) {
mw(files, self, next);
}
else {
callback(null, files);
}
};
next(null, files);
} | [
"function",
"run",
"(",
"files",
",",
"callback",
")",
"{",
"let",
"self",
"=",
"this",
",",
"i",
"=",
"0",
";",
"function",
"next",
"(",
"err",
",",
"files",
")",
"{",
"let",
"mw",
"=",
"self",
".",
"middleware",
"[",
"i",
"++",
"]",
";",
"if"... | Run middleware pipeline
@param {Function} callback | [
"Run",
"middleware",
"pipeline"
] | 0217cecdec04606e896d3339f40e75b47dea8b77 | https://github.com/pimbrouwers/ditto/blob/0217cecdec04606e896d3339f40e75b47dea8b77/src/index.js#L182-L199 |
51,572 | pimbrouwers/ditto | src/index.js | writeFile | function writeFile (file, callback) {
fs.outputFile(path.resolve(this._destination, path.join(file.path.dir, file.path.name + file.path.ext)), file.content, function (err) {
if (err) callback(err);
callback(null);
});
} | javascript | function writeFile (file, callback) {
fs.outputFile(path.resolve(this._destination, path.join(file.path.dir, file.path.name + file.path.ext)), file.content, function (err) {
if (err) callback(err);
callback(null);
});
} | [
"function",
"writeFile",
"(",
"file",
",",
"callback",
")",
"{",
"fs",
".",
"outputFile",
"(",
"path",
".",
"resolve",
"(",
"this",
".",
"_destination",
",",
"path",
".",
"join",
"(",
"file",
".",
"path",
".",
"dir",
",",
"file",
".",
"path",
".",
... | Write file to disk
@param {Object.<DittoFile>} file DittoFile
@param {Function.<Error>} callback | [
"Write",
"file",
"to",
"disk"
] | 0217cecdec04606e896d3339f40e75b47dea8b77 | https://github.com/pimbrouwers/ditto/blob/0217cecdec04606e896d3339f40e75b47dea8b77/src/index.js#L218-L223 |
51,573 | tolokoban/ToloFrameWork | ker/com/x-widget/x-widget.com.js | getRootChildren | function getRootChildren( root, libs, com ) {
var src = ( root.attribs.src || "" ).trim( );
if ( src.length > 0 ) {
if (!libs.fileExists( src )) {
libs.fatal( "File not found: \"" + src + "\"!" );
}
// Add a compilation dependency on the include file.
libs.addInclude( src );
var content = ... | javascript | function getRootChildren( root, libs, com ) {
var src = ( root.attribs.src || "" ).trim( );
if ( src.length > 0 ) {
if (!libs.fileExists( src )) {
libs.fatal( "File not found: \"" + src + "\"!" );
}
// Add a compilation dependency on the include file.
libs.addInclude( src );
var content = ... | [
"function",
"getRootChildren",
"(",
"root",
",",
"libs",
",",
"com",
")",
"{",
"var",
"src",
"=",
"(",
"root",
".",
"attribs",
".",
"src",
"||",
"\"\"",
")",
".",
"trim",
"(",
")",
";",
"if",
"(",
"src",
".",
"length",
">",
"0",
")",
"{",
"if",... | If root has got a `src` attribute, we load a file and put its content as children of `root`. | [
"If",
"root",
"has",
"got",
"a",
"src",
"attribute",
"we",
"load",
"a",
"file",
"and",
"put",
"its",
"content",
"as",
"children",
"of",
"root",
"."
] | 730845a833a9660ebfdb60ad027ebaab5ac871b6 | https://github.com/tolokoban/ToloFrameWork/blob/730845a833a9660ebfdb60ad027ebaab5ac871b6/ker/com/x-widget/x-widget.com.js#L227-L238 |
51,574 | tolokoban/ToloFrameWork | ker/com/x-widget/x-widget.com.js | getPropertiesAndBindings | function getPropertiesAndBindings( root, libs, com, indent ) {
// Attributes can have post initialization, especially for data bindings.
var postInit = {};
var hasPostInit = false;
var key,
val,
values;
var bindings;
var slots;
for ( key in root.attribs ) {
if ( key.charAt( 0 ) == '$' ) {
... | javascript | function getPropertiesAndBindings( root, libs, com, indent ) {
// Attributes can have post initialization, especially for data bindings.
var postInit = {};
var hasPostInit = false;
var key,
val,
values;
var bindings;
var slots;
for ( key in root.attribs ) {
if ( key.charAt( 0 ) == '$' ) {
... | [
"function",
"getPropertiesAndBindings",
"(",
"root",
",",
"libs",
",",
"com",
",",
"indent",
")",
"{",
"// Attributes can have post initialization, especially for data bindings.",
"var",
"postInit",
"=",
"{",
"}",
";",
"var",
"hasPostInit",
"=",
"false",
";",
"var",
... | Properties and bindings. | [
"Properties",
"and",
"bindings",
"."
] | 730845a833a9660ebfdb60ad027ebaab5ac871b6 | https://github.com/tolokoban/ToloFrameWork/blob/730845a833a9660ebfdb60ad027ebaab5ac871b6/ker/com/x-widget/x-widget.com.js#L243-L317 |
51,575 | vesln/sourcery | lib/resource.js | Resource | function Resource(attributes) {
this.engine = engine;
this.name = !this.name ? this.name : this.name.toLowerCase();
this.queryParams = {};
this.attributes = {};
this.load(attributes || {});
} | javascript | function Resource(attributes) {
this.engine = engine;
this.name = !this.name ? this.name : this.name.toLowerCase();
this.queryParams = {};
this.attributes = {};
this.load(attributes || {});
} | [
"function",
"Resource",
"(",
"attributes",
")",
"{",
"this",
".",
"engine",
"=",
"engine",
";",
"this",
".",
"name",
"=",
"!",
"this",
".",
"name",
"?",
"this",
".",
"name",
":",
"this",
".",
"name",
".",
"toLowerCase",
"(",
")",
";",
"this",
".",
... | Base resource. All resources inherit from it.
@param {Object} attributes to be set
@constructor | [
"Base",
"resource",
".",
"All",
"resources",
"inherit",
"from",
"it",
"."
] | e3e7c3de6bbb2d0e1ef0a546fb9af00d10653ce5 | https://github.com/vesln/sourcery/blob/e3e7c3de6bbb2d0e1ef0a546fb9af00d10653ce5/lib/resource.js#L29-L35 |
51,576 | redisjs/jsr-server | lib/daemon.js | daemonize | function daemonize(file, conf, args) {
/* istanbul ignore next: never parse argv in test env */
args = args || process.argv.slice(2);
args.unshift(file);
var logfile = conf.get(ConfigKey.LOGFILE) || '/dev/null'
//var logfile = conf.get(ConfigKey.LOGFILE) || 'daemon.log'
, out = fs.openSync(logfile, 'a')
... | javascript | function daemonize(file, conf, args) {
/* istanbul ignore next: never parse argv in test env */
args = args || process.argv.slice(2);
args.unshift(file);
var logfile = conf.get(ConfigKey.LOGFILE) || '/dev/null'
//var logfile = conf.get(ConfigKey.LOGFILE) || 'daemon.log'
, out = fs.openSync(logfile, 'a')
... | [
"function",
"daemonize",
"(",
"file",
",",
"conf",
",",
"args",
")",
"{",
"/* istanbul ignore next: never parse argv in test env */",
"args",
"=",
"args",
"||",
"process",
".",
"argv",
".",
"slice",
"(",
"2",
")",
";",
"args",
".",
"unshift",
"(",
"file",
")... | Create the daemon process. | [
"Create",
"the",
"daemon",
"process",
"."
] | 49413052d3039524fbdd2ade0ef9bae26cb4d647 | https://github.com/redisjs/jsr-server/blob/49413052d3039524fbdd2ade0ef9bae26cb4d647/lib/daemon.js#L14-L38 |
51,577 | redisjs/jsr-server | lib/daemon.js | write | function write(conf) {
var contents = process.pid + EOL
, file = conf.get(ConfigKey.PIDFILE);
// can be the empty string
if(file) {
try {
fs.writeFileSync(file, contents);
log.notice('wrote pid %s to %s', process.pid, file);
}catch(e) {
log.warning('failed to write pid file (%s): %s'... | javascript | function write(conf) {
var contents = process.pid + EOL
, file = conf.get(ConfigKey.PIDFILE);
// can be the empty string
if(file) {
try {
fs.writeFileSync(file, contents);
log.notice('wrote pid %s to %s', process.pid, file);
}catch(e) {
log.warning('failed to write pid file (%s): %s'... | [
"function",
"write",
"(",
"conf",
")",
"{",
"var",
"contents",
"=",
"process",
".",
"pid",
"+",
"EOL",
",",
"file",
"=",
"conf",
".",
"get",
"(",
"ConfigKey",
".",
"PIDFILE",
")",
";",
"// can be the empty string",
"if",
"(",
"file",
")",
"{",
"try",
... | Write the pid file. | [
"Write",
"the",
"pid",
"file",
"."
] | 49413052d3039524fbdd2ade0ef9bae26cb4d647 | https://github.com/redisjs/jsr-server/blob/49413052d3039524fbdd2ade0ef9bae26cb4d647/lib/daemon.js#L43-L55 |
51,578 | redisjs/jsr-server | lib/daemon.js | remove | function remove(conf) {
var file = conf.get(ConfigKey.PIDFILE);
// can be the empty string
if(file) {
log.notice('removing pid file %s', file);
try {
fs.unlinkSync(file);
}catch(e) {
log.warning('failed to remove pid file (%s): %s', file, e.message);
}
}
} | javascript | function remove(conf) {
var file = conf.get(ConfigKey.PIDFILE);
// can be the empty string
if(file) {
log.notice('removing pid file %s', file);
try {
fs.unlinkSync(file);
}catch(e) {
log.warning('failed to remove pid file (%s): %s', file, e.message);
}
}
} | [
"function",
"remove",
"(",
"conf",
")",
"{",
"var",
"file",
"=",
"conf",
".",
"get",
"(",
"ConfigKey",
".",
"PIDFILE",
")",
";",
"// can be the empty string",
"if",
"(",
"file",
")",
"{",
"log",
".",
"notice",
"(",
"'removing pid file %s'",
",",
"file",
... | Remove the pid file. | [
"Remove",
"the",
"pid",
"file",
"."
] | 49413052d3039524fbdd2ade0ef9bae26cb4d647 | https://github.com/redisjs/jsr-server/blob/49413052d3039524fbdd2ade0ef9bae26cb4d647/lib/daemon.js#L60-L71 |
51,579 | Lindurion/closure-pro-build | 3p/closure-library-20130212/third_party/closure/goog/dojo/dom/query.js | function(node, root) {
var pn = node.parentNode;
while (pn) {
if (pn == root) {
break;
}
pn = pn.parentNode;
}
return !!pn;
} | javascript | function(node, root) {
var pn = node.parentNode;
while (pn) {
if (pn == root) {
break;
}
pn = pn.parentNode;
}
return !!pn;
} | [
"function",
"(",
"node",
",",
"root",
")",
"{",
"var",
"pn",
"=",
"node",
".",
"parentNode",
";",
"while",
"(",
"pn",
")",
"{",
"if",
"(",
"pn",
"==",
"root",
")",
"{",
"break",
";",
"}",
"pn",
"=",
"pn",
".",
"parentNode",
";",
"}",
"return",
... | test to see if node is below root | [
"test",
"to",
"see",
"if",
"node",
"is",
"below",
"root"
] | c279d0fcc3a65969d2fe965f55e627b074792f1a | https://github.com/Lindurion/closure-pro-build/blob/c279d0fcc3a65969d2fe965f55e627b074792f1a/3p/closure-library-20130212/third_party/closure/goog/dojo/dom/query.js#L988-L997 | |
51,580 | Lindurion/closure-pro-build | 3p/closure-library-20130212/third_party/closure/goog/dojo/dom/query.js | function(node, bag) {
if (!bag) {
return 1;
}
var id = _nodeUID(node);
if (!bag[id]) {
return bag[id] = 1;
}
return 0;
} | javascript | function(node, bag) {
if (!bag) {
return 1;
}
var id = _nodeUID(node);
if (!bag[id]) {
return bag[id] = 1;
}
return 0;
} | [
"function",
"(",
"node",
",",
"bag",
")",
"{",
"if",
"(",
"!",
"bag",
")",
"{",
"return",
"1",
";",
"}",
"var",
"id",
"=",
"_nodeUID",
"(",
"node",
")",
";",
"if",
"(",
"!",
"bag",
"[",
"id",
"]",
")",
"{",
"return",
"bag",
"[",
"id",
"]",
... | determine if a node in is unique in a 'bag'. In this case we don't want to flatten a list of unique items, but rather just tell if the item in question is already in the bag. Normally we'd just use hash lookup to do this for us but IE's DOM is busted so we can't really count on that. On the upside, it gives us a built ... | [
"determine",
"if",
"a",
"node",
"in",
"is",
"unique",
"in",
"a",
"bag",
".",
"In",
"this",
"case",
"we",
"don",
"t",
"want",
"to",
"flatten",
"a",
"list",
"of",
"unique",
"items",
"but",
"rather",
"just",
"tell",
"if",
"the",
"item",
"in",
"question"... | c279d0fcc3a65969d2fe965f55e627b074792f1a | https://github.com/Lindurion/closure-pro-build/blob/c279d0fcc3a65969d2fe965f55e627b074792f1a/3p/closure-library-20130212/third_party/closure/goog/dojo/dom/query.js#L1402-L1411 | |
51,581 | Lindurion/closure-pro-build | 3p/closure-library-20130212/third_party/closure/goog/dojo/dom/query.js | function(query, root) {
// NOTE: elementsById is not currently supported
// NOTE: ignores xpath-ish queries for now
//Set list constructor to desired value. This can change
//between calls, so always re-assign here.
if (!query) {
return [];
}
if (query.constructor == Array) {
... | javascript | function(query, root) {
// NOTE: elementsById is not currently supported
// NOTE: ignores xpath-ish queries for now
//Set list constructor to desired value. This can change
//between calls, so always re-assign here.
if (!query) {
return [];
}
if (query.constructor == Array) {
... | [
"function",
"(",
"query",
",",
"root",
")",
"{",
"// NOTE: elementsById is not currently supported",
"// NOTE: ignores xpath-ish queries for now",
"//Set list constructor to desired value. This can change",
"//between calls, so always re-assign here.",
"if",
"(",
"!",
"query",
")",
"... | The main executor. Type specification from above.
@param {string|Array} query The query.
@param {(string|Node)=} root The root.
@return {!Array} The elements that matched the query. | [
"The",
"main",
"executor",
".",
"Type",
"specification",
"from",
"above",
"."
] | c279d0fcc3a65969d2fe965f55e627b074792f1a | https://github.com/Lindurion/closure-pro-build/blob/c279d0fcc3a65969d2fe965f55e627b074792f1a/3p/closure-library-20130212/third_party/closure/goog/dojo/dom/query.js#L1472-L1525 | |
51,582 | novemberborn/legendary | lib/private/resolution.js | Propagator | function Propagator(
constructor, transforms,
cancellable, signalCancelled) {
this._constructor = constructor || promise.Promise;
this._transforms = transforms;
this._cancellable = cancellable === true;
this._signalCancelled = signalCancelled;
this._state = INITIALIZED;
this._resolved = false;
th... | javascript | function Propagator(
constructor, transforms,
cancellable, signalCancelled) {
this._constructor = constructor || promise.Promise;
this._transforms = transforms;
this._cancellable = cancellable === true;
this._signalCancelled = signalCancelled;
this._state = INITIALIZED;
this._resolved = false;
th... | [
"function",
"Propagator",
"(",
"constructor",
",",
"transforms",
",",
"cancellable",
",",
"signalCancelled",
")",
"{",
"this",
".",
"_constructor",
"=",
"constructor",
"||",
"promise",
".",
"Promise",
";",
"this",
".",
"_transforms",
"=",
"transforms",
";",
"t... | Propagators propagate the state of a promise to added callbacks, optionally transforming it first. The transformation may result in a thenable. The propagator will only attempt to resolve the state of the thenable when callbacks are added. | [
"Propagators",
"propagate",
"the",
"state",
"of",
"a",
"promise",
"to",
"added",
"callbacks",
"optionally",
"transforming",
"it",
"first",
".",
"The",
"transformation",
"may",
"result",
"in",
"a",
"thenable",
".",
"The",
"propagator",
"will",
"only",
"attempt",
... | 8420f2dd20e2e3eaced51385fb6b0dc65b81a9fc | https://github.com/novemberborn/legendary/blob/8420f2dd20e2e3eaced51385fb6b0dc65b81a9fc/lib/private/resolution.js#L62-L81 |
51,583 | wscn-FED/wscn-react-vendor | dist/wscn-react-vendor.js | nodeIsRenderedByOtherInstance | function nodeIsRenderedByOtherInstance(container) {
var rootEl = getReactRootElementInContainer(container);
return !!(rootEl && isReactNode(rootEl) && !ReactDOMComponentTree.getInstanceFromNode(rootEl));
} | javascript | function nodeIsRenderedByOtherInstance(container) {
var rootEl = getReactRootElementInContainer(container);
return !!(rootEl && isReactNode(rootEl) && !ReactDOMComponentTree.getInstanceFromNode(rootEl));
} | [
"function",
"nodeIsRenderedByOtherInstance",
"(",
"container",
")",
"{",
"var",
"rootEl",
"=",
"getReactRootElementInContainer",
"(",
"container",
")",
";",
"return",
"!",
"!",
"(",
"rootEl",
"&&",
"isReactNode",
"(",
"rootEl",
")",
"&&",
"!",
"ReactDOMComponentTr... | True if the supplied DOM node is a React DOM element and
it has been rendered by another copy of React.
@param {?DOMElement} node The candidate DOM node.
@return {boolean} True if the DOM has been rendered by another copy of React
@internal | [
"True",
"if",
"the",
"supplied",
"DOM",
"node",
"is",
"a",
"React",
"DOM",
"element",
"and",
"it",
"has",
"been",
"rendered",
"by",
"another",
"copy",
"of",
"React",
"."
] | 4a7fb1020c20ba3ffe71a2ad959f24ed0bacbdb2 | https://github.com/wscn-FED/wscn-react-vendor/blob/4a7fb1020c20ba3ffe71a2ad959f24ed0bacbdb2/dist/wscn-react-vendor.js#L12418-L12421 |
51,584 | wscn-FED/wscn-react-vendor | dist/wscn-react-vendor.js | isReactNode | function isReactNode(node) {
return isValidContainer(node) && (node.hasAttribute(ROOT_ATTR_NAME) || node.hasAttribute(ATTR_NAME));
} | javascript | function isReactNode(node) {
return isValidContainer(node) && (node.hasAttribute(ROOT_ATTR_NAME) || node.hasAttribute(ATTR_NAME));
} | [
"function",
"isReactNode",
"(",
"node",
")",
"{",
"return",
"isValidContainer",
"(",
"node",
")",
"&&",
"(",
"node",
".",
"hasAttribute",
"(",
"ROOT_ATTR_NAME",
")",
"||",
"node",
".",
"hasAttribute",
"(",
"ATTR_NAME",
")",
")",
";",
"}"
] | True if the supplied DOM node is a valid React node element.
@param {?DOMElement} node The candidate DOM node.
@return {boolean} True if the DOM is a valid React DOM node.
@internal | [
"True",
"if",
"the",
"supplied",
"DOM",
"node",
"is",
"a",
"valid",
"React",
"node",
"element",
"."
] | 4a7fb1020c20ba3ffe71a2ad959f24ed0bacbdb2 | https://github.com/wscn-FED/wscn-react-vendor/blob/4a7fb1020c20ba3ffe71a2ad959f24ed0bacbdb2/dist/wscn-react-vendor.js#L12441-L12443 |
51,585 | wscn-FED/wscn-react-vendor | dist/wscn-react-vendor.js | function (root, className) {
var all = ReactTestUtils.scryRenderedDOMComponentsWithClass(root, className);
if (all.length !== 1) {
throw new Error('Did not find exactly one match (found: ' + all.length + ') ' + 'for class:' + className);
}
return all[0];
} | javascript | function (root, className) {
var all = ReactTestUtils.scryRenderedDOMComponentsWithClass(root, className);
if (all.length !== 1) {
throw new Error('Did not find exactly one match (found: ' + all.length + ') ' + 'for class:' + className);
}
return all[0];
} | [
"function",
"(",
"root",
",",
"className",
")",
"{",
"var",
"all",
"=",
"ReactTestUtils",
".",
"scryRenderedDOMComponentsWithClass",
"(",
"root",
",",
"className",
")",
";",
"if",
"(",
"all",
".",
"length",
"!==",
"1",
")",
"{",
"throw",
"new",
"Error",
... | Like scryRenderedDOMComponentsWithClass but expects there to be one result,
and returns that one result, or throws exception if there is any other
number of matches besides one.
@return {!ReactDOMComponent} The one match. | [
"Like",
"scryRenderedDOMComponentsWithClass",
"but",
"expects",
"there",
"to",
"be",
"one",
"result",
"and",
"returns",
"that",
"one",
"result",
"or",
"throws",
"exception",
"if",
"there",
"is",
"any",
"other",
"number",
"of",
"matches",
"besides",
"one",
"."
] | 4a7fb1020c20ba3ffe71a2ad959f24ed0bacbdb2 | https://github.com/wscn-FED/wscn-react-vendor/blob/4a7fb1020c20ba3ffe71a2ad959f24ed0bacbdb2/dist/wscn-react-vendor.js#L15590-L15596 | |
51,586 | wscn-FED/wscn-react-vendor | dist/wscn-react-vendor.js | function (root, tagName) {
return ReactTestUtils.findAllInRenderedTree(root, function (inst) {
return ReactTestUtils.isDOMComponent(inst) && inst.tagName.toUpperCase() === tagName.toUpperCase();
});
} | javascript | function (root, tagName) {
return ReactTestUtils.findAllInRenderedTree(root, function (inst) {
return ReactTestUtils.isDOMComponent(inst) && inst.tagName.toUpperCase() === tagName.toUpperCase();
});
} | [
"function",
"(",
"root",
",",
"tagName",
")",
"{",
"return",
"ReactTestUtils",
".",
"findAllInRenderedTree",
"(",
"root",
",",
"function",
"(",
"inst",
")",
"{",
"return",
"ReactTestUtils",
".",
"isDOMComponent",
"(",
"inst",
")",
"&&",
"inst",
".",
"tagName... | Finds all instance of components in the rendered tree that are DOM
components with the tag name matching `tagName`.
@return {array} an array of all the matches. | [
"Finds",
"all",
"instance",
"of",
"components",
"in",
"the",
"rendered",
"tree",
"that",
"are",
"DOM",
"components",
"with",
"the",
"tag",
"name",
"matching",
"tagName",
"."
] | 4a7fb1020c20ba3ffe71a2ad959f24ed0bacbdb2 | https://github.com/wscn-FED/wscn-react-vendor/blob/4a7fb1020c20ba3ffe71a2ad959f24ed0bacbdb2/dist/wscn-react-vendor.js#L15603-L15607 | |
51,587 | wscn-FED/wscn-react-vendor | dist/wscn-react-vendor.js | function (root, tagName) {
var all = ReactTestUtils.scryRenderedDOMComponentsWithTag(root, tagName);
if (all.length !== 1) {
throw new Error('Did not find exactly one match (found: ' + all.length + ') ' + 'for tag:' + tagName);
}
return all[0];
} | javascript | function (root, tagName) {
var all = ReactTestUtils.scryRenderedDOMComponentsWithTag(root, tagName);
if (all.length !== 1) {
throw new Error('Did not find exactly one match (found: ' + all.length + ') ' + 'for tag:' + tagName);
}
return all[0];
} | [
"function",
"(",
"root",
",",
"tagName",
")",
"{",
"var",
"all",
"=",
"ReactTestUtils",
".",
"scryRenderedDOMComponentsWithTag",
"(",
"root",
",",
"tagName",
")",
";",
"if",
"(",
"all",
".",
"length",
"!==",
"1",
")",
"{",
"throw",
"new",
"Error",
"(",
... | Like scryRenderedDOMComponentsWithTag but expects there to be one result,
and returns that one result, or throws exception if there is any other
number of matches besides one.
@return {!ReactDOMComponent} The one match. | [
"Like",
"scryRenderedDOMComponentsWithTag",
"but",
"expects",
"there",
"to",
"be",
"one",
"result",
"and",
"returns",
"that",
"one",
"result",
"or",
"throws",
"exception",
"if",
"there",
"is",
"any",
"other",
"number",
"of",
"matches",
"besides",
"one",
"."
] | 4a7fb1020c20ba3ffe71a2ad959f24ed0bacbdb2 | https://github.com/wscn-FED/wscn-react-vendor/blob/4a7fb1020c20ba3ffe71a2ad959f24ed0bacbdb2/dist/wscn-react-vendor.js#L15615-L15621 | |
51,588 | wscn-FED/wscn-react-vendor | dist/wscn-react-vendor.js | function (root, componentType) {
return ReactTestUtils.findAllInRenderedTree(root, function (inst) {
return ReactTestUtils.isCompositeComponentWithType(inst, componentType);
});
} | javascript | function (root, componentType) {
return ReactTestUtils.findAllInRenderedTree(root, function (inst) {
return ReactTestUtils.isCompositeComponentWithType(inst, componentType);
});
} | [
"function",
"(",
"root",
",",
"componentType",
")",
"{",
"return",
"ReactTestUtils",
".",
"findAllInRenderedTree",
"(",
"root",
",",
"function",
"(",
"inst",
")",
"{",
"return",
"ReactTestUtils",
".",
"isCompositeComponentWithType",
"(",
"inst",
",",
"componentTyp... | Finds all instances of components with type equal to `componentType`.
@return {array} an array of all the matches. | [
"Finds",
"all",
"instances",
"of",
"components",
"with",
"type",
"equal",
"to",
"componentType",
"."
] | 4a7fb1020c20ba3ffe71a2ad959f24ed0bacbdb2 | https://github.com/wscn-FED/wscn-react-vendor/blob/4a7fb1020c20ba3ffe71a2ad959f24ed0bacbdb2/dist/wscn-react-vendor.js#L15627-L15631 | |
51,589 | wscn-FED/wscn-react-vendor | dist/wscn-react-vendor.js | function (root, componentType) {
var all = ReactTestUtils.scryRenderedComponentsWithType(root, componentType);
if (all.length !== 1) {
throw new Error('Did not find exactly one match (found: ' + all.length + ') ' + 'for componentType:' + componentType);
}
return all[0];
} | javascript | function (root, componentType) {
var all = ReactTestUtils.scryRenderedComponentsWithType(root, componentType);
if (all.length !== 1) {
throw new Error('Did not find exactly one match (found: ' + all.length + ') ' + 'for componentType:' + componentType);
}
return all[0];
} | [
"function",
"(",
"root",
",",
"componentType",
")",
"{",
"var",
"all",
"=",
"ReactTestUtils",
".",
"scryRenderedComponentsWithType",
"(",
"root",
",",
"componentType",
")",
";",
"if",
"(",
"all",
".",
"length",
"!==",
"1",
")",
"{",
"throw",
"new",
"Error"... | Same as `scryRenderedComponentsWithType` but expects there to be one result
and returns that one result, or throws exception if there is any other
number of matches besides one.
@return {!ReactComponent} The one match. | [
"Same",
"as",
"scryRenderedComponentsWithType",
"but",
"expects",
"there",
"to",
"be",
"one",
"result",
"and",
"returns",
"that",
"one",
"result",
"or",
"throws",
"exception",
"if",
"there",
"is",
"any",
"other",
"number",
"of",
"matches",
"besides",
"one",
".... | 4a7fb1020c20ba3ffe71a2ad959f24ed0bacbdb2 | https://github.com/wscn-FED/wscn-react-vendor/blob/4a7fb1020c20ba3ffe71a2ad959f24ed0bacbdb2/dist/wscn-react-vendor.js#L15639-L15645 | |
51,590 | wscn-FED/wscn-react-vendor | dist/wscn-react-vendor.js | function (topLevelType, node, fakeNativeEvent) {
fakeNativeEvent.target = node;
ReactBrowserEventEmitter.ReactEventListener.dispatchEvent(topLevelType, fakeNativeEvent);
} | javascript | function (topLevelType, node, fakeNativeEvent) {
fakeNativeEvent.target = node;
ReactBrowserEventEmitter.ReactEventListener.dispatchEvent(topLevelType, fakeNativeEvent);
} | [
"function",
"(",
"topLevelType",
",",
"node",
",",
"fakeNativeEvent",
")",
"{",
"fakeNativeEvent",
".",
"target",
"=",
"node",
";",
"ReactBrowserEventEmitter",
".",
"ReactEventListener",
".",
"dispatchEvent",
"(",
"topLevelType",
",",
"fakeNativeEvent",
")",
";",
... | Simulates a top level event being dispatched from a raw event that occurred
on an `Element` node.
@param {Object} topLevelType A type from `EventConstants.topLevelTypes`
@param {!Element} node The dom to simulate an event occurring on.
@param {?Event} fakeNativeEvent Fake native event to use in SyntheticEvent. | [
"Simulates",
"a",
"top",
"level",
"event",
"being",
"dispatched",
"from",
"a",
"raw",
"event",
"that",
"occurred",
"on",
"an",
"Element",
"node",
"."
] | 4a7fb1020c20ba3ffe71a2ad959f24ed0bacbdb2 | https://github.com/wscn-FED/wscn-react-vendor/blob/4a7fb1020c20ba3ffe71a2ad959f24ed0bacbdb2/dist/wscn-react-vendor.js#L15677-L15680 | |
51,591 | wscn-FED/wscn-react-vendor | dist/wscn-react-vendor.js | matchesSelector | function matchesSelector(element, selector) {
var matchesImpl = element.matches || element.webkitMatchesSelector || element.mozMatchesSelector || element.msMatchesSelector || function (s) {
return matchesSelector_SLOW(element, s);
};
return matchesImpl.call(element, selector);
} | javascript | function matchesSelector(element, selector) {
var matchesImpl = element.matches || element.webkitMatchesSelector || element.mozMatchesSelector || element.msMatchesSelector || function (s) {
return matchesSelector_SLOW(element, s);
};
return matchesImpl.call(element, selector);
} | [
"function",
"matchesSelector",
"(",
"element",
",",
"selector",
")",
"{",
"var",
"matchesImpl",
"=",
"element",
".",
"matches",
"||",
"element",
".",
"webkitMatchesSelector",
"||",
"element",
".",
"mozMatchesSelector",
"||",
"element",
".",
"msMatchesSelector",
"|... | Tests whether the element matches the selector specified
@param {DOMNode|DOMWindow} element the element that we are querying
@param {string} selector the CSS selector
@return {boolean} true if the element matches the selector, false if not | [
"Tests",
"whether",
"the",
"element",
"matches",
"the",
"selector",
"specified"
] | 4a7fb1020c20ba3ffe71a2ad959f24ed0bacbdb2 | https://github.com/wscn-FED/wscn-react-vendor/blob/4a7fb1020c20ba3ffe71a2ad959f24ed0bacbdb2/dist/wscn-react-vendor.js#L21658-L21663 |
51,592 | radixdlt/radixdlt-js-lite | src/connection-handler.js | registerApp | function registerApp(name, description, permissions) {
const CONNECTION = new Connection();
return new Promise((resolve, reject) => {
CONNECTION.register(name, description, permissions)
.then(() => resolve(new ConnectionHandler(CONNECTION)))
.catch((error) => reject(error));
});
} | javascript | function registerApp(name, description, permissions) {
const CONNECTION = new Connection();
return new Promise((resolve, reject) => {
CONNECTION.register(name, description, permissions)
.then(() => resolve(new ConnectionHandler(CONNECTION)))
.catch((error) => reject(error));
});
} | [
"function",
"registerApp",
"(",
"name",
",",
"description",
",",
"permissions",
")",
"{",
"const",
"CONNECTION",
"=",
"new",
"Connection",
"(",
")",
";",
"return",
"new",
"Promise",
"(",
"(",
"resolve",
",",
"reject",
")",
"=>",
"{",
"CONNECTION",
".",
"... | Register an App.
@param {string} name - App's name.
@param {string} description - App's description.
@param {string[]} permissions - Permissions requested by this App.
@returns {Promise} | [
"Register",
"an",
"App",
"."
] | 8ee699d9eed3c7f843ea45c81f2924dfb419d903 | https://github.com/radixdlt/radixdlt-js-lite/blob/8ee699d9eed3c7f843ea45c81f2924dfb419d903/src/connection-handler.js#L65-L73 |
51,593 | radixdlt/radixdlt-js-lite | src/connection-handler.js | connectApp | function connectApp(token) {
const CONNECTION = new Connection();
return new Promise((resolve, reject) => {
CONNECTION.connect(token)
.then(() => resolve(new ConnectionHandler(CONNECTION)))
.catch((error) => reject(error));
});
} | javascript | function connectApp(token) {
const CONNECTION = new Connection();
return new Promise((resolve, reject) => {
CONNECTION.connect(token)
.then(() => resolve(new ConnectionHandler(CONNECTION)))
.catch((error) => reject(error));
});
} | [
"function",
"connectApp",
"(",
"token",
")",
"{",
"const",
"CONNECTION",
"=",
"new",
"Connection",
"(",
")",
";",
"return",
"new",
"Promise",
"(",
"(",
"resolve",
",",
"reject",
")",
"=>",
"{",
"CONNECTION",
".",
"connect",
"(",
"token",
")",
".",
"the... | Re-connects an App with a valid token.
@param {string} token - Auth token.
@returns {Promise} | [
"Re",
"-",
"connects",
"an",
"App",
"with",
"a",
"valid",
"token",
"."
] | 8ee699d9eed3c7f843ea45c81f2924dfb419d903 | https://github.com/radixdlt/radixdlt-js-lite/blob/8ee699d9eed3c7f843ea45c81f2924dfb419d903/src/connection-handler.js#L80-L88 |
51,594 | darrylwest/node-messaging-commons | browser/browser-messaging-commons.js | function(options) {
'use strict';
var client = this,
log = options.log,
socketHost = options.socketHost,
hubName = options.hubName,
hub;
/**
* open the public/private channels to begin exchanges
*/
this.subscribe = function(channelName, handler, callback) {
... | javascript | function(options) {
'use strict';
var client = this,
log = options.log,
socketHost = options.socketHost,
hubName = options.hubName,
hub;
/**
* open the public/private channels to begin exchanges
*/
this.subscribe = function(channelName, handler, callback) {
... | [
"function",
"(",
"options",
")",
"{",
"'use strict'",
";",
"var",
"client",
"=",
"this",
",",
"log",
"=",
"options",
".",
"log",
",",
"socketHost",
"=",
"options",
".",
"socketHost",
",",
"hubName",
"=",
"options",
".",
"hubName",
",",
"hub",
";",
"/**... | AbstractMessageClient - browser side base class
@author: darryl.west@roundpeg.com
@created: 8/31/14 | [
"AbstractMessageClient",
"-",
"browser",
"side",
"base",
"class"
] | 31907d87ced947075013a79f879e71a310eb52e1 | https://github.com/darrylwest/node-messaging-commons/blob/31907d87ced947075013a79f879e71a310eb52e1/browser/browser-messaging-commons.js#L7-L88 | |
51,595 | pzlr/build-core | lib/block.js | validateCache | function validateCache(path, cache) {
const
{mtime} = fs.statSync(path);
return {
mtime,
fromCache: Boolean(cache[path] && Sugar.Date.is(mtime, cache[path].mtime))
};
} | javascript | function validateCache(path, cache) {
const
{mtime} = fs.statSync(path);
return {
mtime,
fromCache: Boolean(cache[path] && Sugar.Date.is(mtime, cache[path].mtime))
};
} | [
"function",
"validateCache",
"(",
"path",
",",
"cache",
")",
"{",
"const",
"{",
"mtime",
"}",
"=",
"fs",
".",
"statSync",
"(",
"path",
")",
";",
"return",
"{",
"mtime",
",",
"fromCache",
":",
"Boolean",
"(",
"cache",
"[",
"path",
"]",
"&&",
"Sugar",
... | Validates a file by the specified path and return meta information
@param {string} path
@param {!Object} cache - cache object
@returns {{mtime: !Object, fromCache: boolean}} | [
"Validates",
"a",
"file",
"by",
"the",
"specified",
"path",
"and",
"return",
"meta",
"information"
] | 11e20eda500682b9fa62c7804c66be1714df0df4 | https://github.com/pzlr/build-core/blob/11e20eda500682b9fa62c7804c66be1714df0df4/lib/block.js#L30-L38 |
51,596 | pzlr/build-core | lib/block.js | getFile | function getFile(path) {
const
cache = validateCache(path, filesCache);
if (!cache.fromCache) {
filesCache[path] = {
mtime: cache.mtime,
content: fs.readFileSync(path, 'utf-8')
};
}
return filesCache[path].content;
} | javascript | function getFile(path) {
const
cache = validateCache(path, filesCache);
if (!cache.fromCache) {
filesCache[path] = {
mtime: cache.mtime,
content: fs.readFileSync(path, 'utf-8')
};
}
return filesCache[path].content;
} | [
"function",
"getFile",
"(",
"path",
")",
"{",
"const",
"cache",
"=",
"validateCache",
"(",
"path",
",",
"filesCache",
")",
";",
"if",
"(",
"!",
"cache",
".",
"fromCache",
")",
"{",
"filesCache",
"[",
"path",
"]",
"=",
"{",
"mtime",
":",
"cache",
".",... | Returns a file content by the specified path
@param {string} path
@returns {string} | [
"Returns",
"a",
"file",
"content",
"by",
"the",
"specified",
"path"
] | 11e20eda500682b9fa62c7804c66be1714df0df4 | https://github.com/pzlr/build-core/blob/11e20eda500682b9fa62c7804c66be1714df0df4/lib/block.js#L46-L58 |
51,597 | gethuman/pancakes-recipe | utils/bulk.change.js | BulkChange | function BulkChange(model) {
this.model = model;
this.bulk = model.collection.initializeUnorderedBulkOp();
this.isChange = false;
} | javascript | function BulkChange(model) {
this.model = model;
this.bulk = model.collection.initializeUnorderedBulkOp();
this.isChange = false;
} | [
"function",
"BulkChange",
"(",
"model",
")",
"{",
"this",
".",
"model",
"=",
"model",
";",
"this",
".",
"bulk",
"=",
"model",
".",
"collection",
".",
"initializeUnorderedBulkOp",
"(",
")",
";",
"this",
".",
"isChange",
"=",
"false",
";",
"}"
] | Constructor used to start the undordered bulk operation
@param model
@constructor | [
"Constructor",
"used",
"to",
"start",
"the",
"undordered",
"bulk",
"operation"
] | ea3feb8839e2edaf1b4577c052b8958953db4498 | https://github.com/gethuman/pancakes-recipe/blob/ea3feb8839e2edaf1b4577c052b8958953db4498/utils/bulk.change.js#L14-L18 |
51,598 | quantumpayments/media | bin/view.js | getMediaByBuffer | function getMediaByBuffer (uri, cert, mode, user, safe, bufferURI) {
var bufferPath = root
if (bufferURI) {
bufferPath += '/../' + url.parse(bufferURI).path
}
return new Promise(function (resolve, reject) {
// var bufferPath = __dirname + '/../data/buffer/image/'
debug('bufferPath', bufferPath)
... | javascript | function getMediaByBuffer (uri, cert, mode, user, safe, bufferURI) {
var bufferPath = root
if (bufferURI) {
bufferPath += '/../' + url.parse(bufferURI).path
}
return new Promise(function (resolve, reject) {
// var bufferPath = __dirname + '/../data/buffer/image/'
debug('bufferPath', bufferPath)
... | [
"function",
"getMediaByBuffer",
"(",
"uri",
",",
"cert",
",",
"mode",
",",
"user",
",",
"safe",
",",
"bufferURI",
")",
"{",
"var",
"bufferPath",
"=",
"root",
"if",
"(",
"bufferURI",
")",
"{",
"bufferPath",
"+=",
"'/../'",
"+",
"url",
".",
"parse",
"(",... | Get Media item from buffer
@param {string} uri The uri to get it from.
@param {string} cert Location of an X.509 cert.
@param {string} mode Mode api | http | buffer.
@param {string} user The WebID of the user.
@param {number} safe Whether safe search is on.
@param {string} bufferURI The ... | [
"Get",
"Media",
"item",
"from",
"buffer"
] | b53034e6dd2a94dca950e60a49e403aceaa1cdf1 | https://github.com/quantumpayments/media/blob/b53034e6dd2a94dca950e60a49e403aceaa1cdf1/bin/view.js#L104-L140 |
51,599 | quantumpayments/media | bin/view.js | addMediaToBuffer | function addMediaToBuffer (uri, cert, mode, user, safe, bufferURI) {
// var bufferPath = root
// if (bufferURI) {
// bufferPath += '/../' + url.parse(bufferURI).path
// }
setTimeout(() => {
try {
// fs.unlinkSync(lastFile)
} catch (e) {
console.error(e)
}
var params = {}
para... | javascript | function addMediaToBuffer (uri, cert, mode, user, safe, bufferURI) {
// var bufferPath = root
// if (bufferURI) {
// bufferPath += '/../' + url.parse(bufferURI).path
// }
setTimeout(() => {
try {
// fs.unlinkSync(lastFile)
} catch (e) {
console.error(e)
}
var params = {}
para... | [
"function",
"addMediaToBuffer",
"(",
"uri",
",",
"cert",
",",
"mode",
",",
"user",
",",
"safe",
",",
"bufferURI",
")",
"{",
"// var bufferPath = root",
"// if (bufferURI) {",
"// bufferPath += '/../' + url.parse(bufferURI).path",
"// }",
"setTimeout",
"(",
"(",
")",
... | Adds media to buffer
@param {string} uri The uri to get it from.
@param {string} cert Location of an X.509 cert.
@param {string} mode Mode api | http | buffer.
@param {string} user The WebID of the user.
@param {number} safe Whether safe search is on.
@param {string} bufferURI The URI of... | [
"Adds",
"media",
"to",
"buffer"
] | b53034e6dd2a94dca950e60a49e403aceaa1cdf1 | https://github.com/quantumpayments/media/blob/b53034e6dd2a94dca950e60a49e403aceaa1cdf1/bin/view.js#L152-L199 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.