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,100 | wunderbyte/grunt-spiritual-edbml | tasks/things/outliner.js | parse | function parse(script, options, macros) {
var name = script.attr('id');
var text = script.text();
var atts = assistant.directives(script);
return compile(name, text, options, macros, atts);
} | javascript | function parse(script, options, macros) {
var name = script.attr('id');
var text = script.text();
var atts = assistant.directives(script);
return compile(name, text, options, macros, atts);
} | [
"function",
"parse",
"(",
"script",
",",
"options",
",",
"macros",
")",
"{",
"var",
"name",
"=",
"script",
".",
"attr",
"(",
"'id'",
")",
";",
"var",
"text",
"=",
"script",
".",
"text",
"(",
")",
";",
"var",
"atts",
"=",
"assistant",
".",
"directiv... | Parse single script.
@param {$} script
@param {???} macros
@returns {string} | [
"Parse",
"single",
"script",
"."
] | 2ba0aa8042eceee917f1ee48c7881345df3bce46 | https://github.com/wunderbyte/grunt-spiritual-edbml/blob/2ba0aa8042eceee917f1ee48c7881345df3bce46/tasks/things/outliner.js#L120-L125 |
51,101 | wunderbyte/grunt-spiritual-edbml | tasks/things/outliner.js | compile | function compile(name, edbml, options, macros, directives) {
var result = compiler.compile(edbml, options, macros, directives);
return assistant.declare(name, result);
} | javascript | function compile(name, edbml, options, macros, directives) {
var result = compiler.compile(edbml, options, macros, directives);
return assistant.declare(name, result);
} | [
"function",
"compile",
"(",
"name",
",",
"edbml",
",",
"options",
",",
"macros",
",",
"directives",
")",
"{",
"var",
"result",
"=",
"compiler",
".",
"compile",
"(",
"edbml",
",",
"options",
",",
"macros",
",",
"directives",
")",
";",
"return",
"assistant... | Compile EDBML to JS with directives.
@param {string} name
@param {string} edbml
@param {Map<string,object>} options
@param {Map<string,object>} options | [
"Compile",
"EDBML",
"to",
"JS",
"with",
"directives",
"."
] | 2ba0aa8042eceee917f1ee48c7881345df3bce46 | https://github.com/wunderbyte/grunt-spiritual-edbml/blob/2ba0aa8042eceee917f1ee48c7881345df3bce46/tasks/things/outliner.js#L134-L137 |
51,102 | epeios-q37/xdhelcq | js/jqte/uncompressed/jquery-te-1.4.0.js | addParams | function addParams(name,command,key,tag,emphasis)
{
var thisCssNo = buttons.length+1;
return buttons.push({name:name, cls:thisCssNo, command:command, key:key, tag:tag, emphasis:emphasis});
} | javascript | function addParams(name,command,key,tag,emphasis)
{
var thisCssNo = buttons.length+1;
return buttons.push({name:name, cls:thisCssNo, command:command, key:key, tag:tag, emphasis:emphasis});
} | [
"function",
"addParams",
"(",
"name",
",",
"command",
",",
"key",
",",
"tag",
",",
"emphasis",
")",
"{",
"var",
"thisCssNo",
"=",
"buttons",
".",
"length",
"+",
"1",
";",
"return",
"buttons",
".",
"push",
"(",
"{",
"name",
":",
"name",
",",
"cls",
... | insertion function for parameters to toolbar | [
"insertion",
"function",
"for",
"parameters",
"to",
"toolbar"
] | 8cffac0650297c313779c9fba545096be24e52a5 | https://github.com/epeios-q37/xdhelcq/blob/8cffac0650297c313779c9fba545096be24e52a5/js/jqte/uncompressed/jquery-te-1.4.0.js#L118-L122 |
51,103 | epeios-q37/xdhelcq | js/jqte/uncompressed/jquery-te-1.4.0.js | selectionGet | function selectionGet()
{
// for webkit, mozilla, opera
if (window.getSelection)
return window.getSelection();
// for ie
else if (document.selection && document.selection.createRange && document.selection.type != "None")
return document.selection.createRange();
} | javascript | function selectionGet()
{
// for webkit, mozilla, opera
if (window.getSelection)
return window.getSelection();
// for ie
else if (document.selection && document.selection.createRange && document.selection.type != "None")
return document.selection.createRange();
} | [
"function",
"selectionGet",
"(",
")",
"{",
"// for webkit, mozilla, opera\r",
"if",
"(",
"window",
".",
"getSelection",
")",
"return",
"window",
".",
"getSelection",
"(",
")",
";",
"// for ie\r",
"else",
"if",
"(",
"document",
".",
"selection",
"&&",
"document",... | get the selected text as plain format | [
"get",
"the",
"selected",
"text",
"as",
"plain",
"format"
] | 8cffac0650297c313779c9fba545096be24e52a5 | https://github.com/epeios-q37/xdhelcq/blob/8cffac0650297c313779c9fba545096be24e52a5/js/jqte/uncompressed/jquery-te-1.4.0.js#L391-L399 |
51,104 | epeios-q37/xdhelcq | js/jqte/uncompressed/jquery-te-1.4.0.js | selectionSet | function selectionSet(addCommand,thirdParam)
{
var range,
sel = selectionGet();
// for webkit, mozilla, opera
if (window.getSelection)
{
if (sel.anchorNode && sel.getRangeAt)
range = sel.getRangeAt(0);
if(range)
{
sel.removeAllRanges();
sel.... | javascript | function selectionSet(addCommand,thirdParam)
{
var range,
sel = selectionGet();
// for webkit, mozilla, opera
if (window.getSelection)
{
if (sel.anchorNode && sel.getRangeAt)
range = sel.getRangeAt(0);
if(range)
{
sel.removeAllRanges();
sel.... | [
"function",
"selectionSet",
"(",
"addCommand",
",",
"thirdParam",
")",
"{",
"var",
"range",
",",
"sel",
"=",
"selectionGet",
"(",
")",
";",
"// for webkit, mozilla, opera\r",
"if",
"(",
"window",
".",
"getSelection",
")",
"{",
"if",
"(",
"sel",
".",
"anchorN... | the function of changing to the selected text with "execCommand" method | [
"the",
"function",
"of",
"changing",
"to",
"the",
"selected",
"text",
"with",
"execCommand",
"method"
] | 8cffac0650297c313779c9fba545096be24e52a5 | https://github.com/epeios-q37/xdhelcq/blob/8cffac0650297c313779c9fba545096be24e52a5/js/jqte/uncompressed/jquery-te-1.4.0.js#L402-L434 |
51,105 | epeios-q37/xdhelcq | js/jqte/uncompressed/jquery-te-1.4.0.js | replaceSelection | function replaceSelection(tTag,tAttr,tVal) {
// first, prevent to conflict of different jqte editors
if(editor.not(":focus"))
editor.focus();
// for webkit, mozilla, opera
if (window.getSelection)
{
var selObj = selectionGet(), selRange, newElement, documentFragment;
... | javascript | function replaceSelection(tTag,tAttr,tVal) {
// first, prevent to conflict of different jqte editors
if(editor.not(":focus"))
editor.focus();
// for webkit, mozilla, opera
if (window.getSelection)
{
var selObj = selectionGet(), selRange, newElement, documentFragment;
... | [
"function",
"replaceSelection",
"(",
"tTag",
",",
"tAttr",
",",
"tVal",
")",
"{",
"// first, prevent to conflict of different jqte editors\r",
"if",
"(",
"editor",
".",
"not",
"(",
"\":focus\"",
")",
")",
"editor",
".",
"focus",
"(",
")",
";",
"// for webkit, mozi... | the function of changing to the selected text with tags and tags's attributes | [
"the",
"function",
"of",
"changing",
"to",
"the",
"selected",
"text",
"with",
"tags",
"and",
"tags",
"s",
"attributes"
] | 8cffac0650297c313779c9fba545096be24e52a5 | https://github.com/epeios-q37/xdhelcq/blob/8cffac0650297c313779c9fba545096be24e52a5/js/jqte/uncompressed/jquery-te-1.4.0.js#L437-L485 |
51,106 | epeios-q37/xdhelcq | js/jqte/uncompressed/jquery-te-1.4.0.js | function() {
var node,selection;
if(window.getSelection) {
selection = getSelection();
node = selection.anchorNode;
}
if(!node && document.selection && document.selection.createRange && document.selection.type != "None")
{
selection = document.selection;
var range = sele... | javascript | function() {
var node,selection;
if(window.getSelection) {
selection = getSelection();
node = selection.anchorNode;
}
if(!node && document.selection && document.selection.createRange && document.selection.type != "None")
{
selection = document.selection;
var range = sele... | [
"function",
"(",
")",
"{",
"var",
"node",
",",
"selection",
";",
"if",
"(",
"window",
".",
"getSelection",
")",
"{",
"selection",
"=",
"getSelection",
"(",
")",
";",
"node",
"=",
"selection",
".",
"anchorNode",
";",
"}",
"if",
"(",
"!",
"node",
"&&",... | the function of getting to the parent tag | [
"the",
"function",
"of",
"getting",
"to",
"the",
"parent",
"tag"
] | 8cffac0650297c313779c9fba545096be24e52a5 | https://github.com/epeios-q37/xdhelcq/blob/8cffac0650297c313779c9fba545096be24e52a5/js/jqte/uncompressed/jquery-te-1.4.0.js#L488-L506 | |
51,107 | epeios-q37/xdhelcq | js/jqte/uncompressed/jquery-te-1.4.0.js | selectText | function selectText(element)
{
if(element)
{
var element = element[0];
if (document.body.createTextRange)
{
var range = document.body.createTextRange();
range.moveToElementText(element);
range.select();
}
else if (window.getSelection)
{
... | javascript | function selectText(element)
{
if(element)
{
var element = element[0];
if (document.body.createTextRange)
{
var range = document.body.createTextRange();
range.moveToElementText(element);
range.select();
}
else if (window.getSelection)
{
... | [
"function",
"selectText",
"(",
"element",
")",
"{",
"if",
"(",
"element",
")",
"{",
"var",
"element",
"=",
"element",
"[",
"0",
"]",
";",
"if",
"(",
"document",
".",
"body",
".",
"createTextRange",
")",
"{",
"var",
"range",
"=",
"document",
".",
"bod... | the function of making selected to a element | [
"the",
"function",
"of",
"making",
"selected",
"to",
"a",
"element"
] | 8cffac0650297c313779c9fba545096be24e52a5 | https://github.com/epeios-q37/xdhelcq/blob/8cffac0650297c313779c9fba545096be24e52a5/js/jqte/uncompressed/jquery-te-1.4.0.js#L543-L575 |
51,108 | epeios-q37/xdhelcq | js/jqte/uncompressed/jquery-te-1.4.0.js | selected2link | function selected2link()
{
if(!toolbar.data("sourceOpened"))
{
var selectedTag = getSelectedNode(); // the selected node
var thisHrefLink = "http://"; // default the input value of the link-form-field
// display the link-form-field
linkAreaSwitch(true);
if(selectedTag)
... | javascript | function selected2link()
{
if(!toolbar.data("sourceOpened"))
{
var selectedTag = getSelectedNode(); // the selected node
var thisHrefLink = "http://"; // default the input value of the link-form-field
// display the link-form-field
linkAreaSwitch(true);
if(selectedTag)
... | [
"function",
"selected2link",
"(",
")",
"{",
"if",
"(",
"!",
"toolbar",
".",
"data",
"(",
"\"sourceOpened\"",
")",
")",
"{",
"var",
"selectedTag",
"=",
"getSelectedNode",
"(",
")",
";",
"// the selected node\r",
"var",
"thisHrefLink",
"=",
"\"http://\"",
";",
... | the function of converting text to link | [
"the",
"function",
"of",
"converting",
"text",
"to",
"link"
] | 8cffac0650297c313779c9fba545096be24e52a5 | https://github.com/epeios-q37/xdhelcq/blob/8cffac0650297c313779c9fba545096be24e52a5/js/jqte/uncompressed/jquery-te-1.4.0.js#L578-L656 |
51,109 | epeios-q37/xdhelcq | js/jqte/uncompressed/jquery-te-1.4.0.js | linkAreaSwitch | function linkAreaSwitch(status)
{
// remove all pre-link attribute (mark as "link will be added")
clearSetElement("["+setdatalink+"]:not([href])");
jQTE.find("["+setdatalink+"][href]").removeAttr(setdatalink);
if(status)
{
toolbar.data("linkOpened",true);
linkform.show();
... | javascript | function linkAreaSwitch(status)
{
// remove all pre-link attribute (mark as "link will be added")
clearSetElement("["+setdatalink+"]:not([href])");
jQTE.find("["+setdatalink+"][href]").removeAttr(setdatalink);
if(status)
{
toolbar.data("linkOpened",true);
linkform.show();
... | [
"function",
"linkAreaSwitch",
"(",
"status",
")",
"{",
"// remove all pre-link attribute (mark as \"link will be added\")\r",
"clearSetElement",
"(",
"\"[\"",
"+",
"setdatalink",
"+",
"\"]:not([href])\"",
")",
";",
"jQTE",
".",
"find",
"(",
"\"[\"",
"+",
"setdatalink",
... | the function of switching link-form-field | [
"the",
"function",
"of",
"switching",
"link",
"-",
"form",
"-",
"field"
] | 8cffac0650297c313779c9fba545096be24e52a5 | https://github.com/epeios-q37/xdhelcq/blob/8cffac0650297c313779c9fba545096be24e52a5/js/jqte/uncompressed/jquery-te-1.4.0.js#L698-L716 |
51,110 | epeios-q37/xdhelcq | js/jqte/uncompressed/jquery-te-1.4.0.js | linkInputSet | function linkInputSet(thisHrefLink)
{
var currentType = linktypes.data("linktype");
// if selected type of e-mail
if(currentType=="1" && (linkinput.val()=="http://" || linkinput.is("[value^=http://]") || !linkinput.is("[value^=mailto]")))
linkinput.val("mailto:");
else if(currentTyp... | javascript | function linkInputSet(thisHrefLink)
{
var currentType = linktypes.data("linktype");
// if selected type of e-mail
if(currentType=="1" && (linkinput.val()=="http://" || linkinput.is("[value^=http://]") || !linkinput.is("[value^=mailto]")))
linkinput.val("mailto:");
else if(currentTyp... | [
"function",
"linkInputSet",
"(",
"thisHrefLink",
")",
"{",
"var",
"currentType",
"=",
"linktypes",
".",
"data",
"(",
"\"linktype\"",
")",
";",
"// if selected type of e-mail\r",
"if",
"(",
"currentType",
"==",
"\"1\"",
"&&",
"(",
"linkinput",
".",
"val",
"(",
... | the function of updating the link-input according to the link-type | [
"the",
"function",
"of",
"updating",
"the",
"link",
"-",
"input",
"according",
"to",
"the",
"link",
"-",
"type"
] | 8cffac0650297c313779c9fba545096be24e52a5 | https://github.com/epeios-q37/xdhelcq/blob/8cffac0650297c313779c9fba545096be24e52a5/js/jqte/uncompressed/jquery-te-1.4.0.js#L728-L739 |
51,111 | epeios-q37/xdhelcq | js/jqte/uncompressed/jquery-te-1.4.0.js | refuseStyle | function refuseStyle(refStyle)
{
var selectedTag = getSelectedNode(); // the selected node
// if the selected node have attribute of "style" and it have unwanted style
if(selectedTag && selectedTag.is("[style]") && selectedTag.css(refStyle)!="")
{
var refValue = selectedTag.css(refSt... | javascript | function refuseStyle(refStyle)
{
var selectedTag = getSelectedNode(); // the selected node
// if the selected node have attribute of "style" and it have unwanted style
if(selectedTag && selectedTag.is("[style]") && selectedTag.css(refStyle)!="")
{
var refValue = selectedTag.css(refSt... | [
"function",
"refuseStyle",
"(",
"refStyle",
")",
"{",
"var",
"selectedTag",
"=",
"getSelectedNode",
"(",
")",
";",
"// the selected node\r",
"// if the selected node have attribute of \"style\" and it have unwanted style\r",
"if",
"(",
"selectedTag",
"&&",
"selectedTag",
".",... | the function of refusing some styles | [
"the",
"function",
"of",
"refusing",
"some",
"styles"
] | 8cffac0650297c313779c9fba545096be24e52a5 | https://github.com/epeios-q37/xdhelcq/blob/8cffac0650297c313779c9fba545096be24e52a5/js/jqte/uncompressed/jquery-te-1.4.0.js#L853-L872 |
51,112 | epeios-q37/xdhelcq | js/jqte/uncompressed/jquery-te-1.4.0.js | formatLabelView | function formatLabelView(str)
{
var formatLabel = formatbar.closest("."+vars.css+"_tool").find("."+vars.css+"_tool_label").find("."+vars.css+"_tool_text");
if(str.length > 10)
str = str.substr(0,7) + "...";
// change format label of button
formatLabel.html(str);
} | javascript | function formatLabelView(str)
{
var formatLabel = formatbar.closest("."+vars.css+"_tool").find("."+vars.css+"_tool_label").find("."+vars.css+"_tool_text");
if(str.length > 10)
str = str.substr(0,7) + "...";
// change format label of button
formatLabel.html(str);
} | [
"function",
"formatLabelView",
"(",
"str",
")",
"{",
"var",
"formatLabel",
"=",
"formatbar",
".",
"closest",
"(",
"\".\"",
"+",
"vars",
".",
"css",
"+",
"\"_tool\"",
")",
".",
"find",
"(",
"\".\"",
"+",
"vars",
".",
"css",
"+",
"\"_tool_label\"",
")",
... | change format label | [
"change",
"format",
"label"
] | 8cffac0650297c313779c9fba545096be24e52a5 | https://github.com/epeios-q37/xdhelcq/blob/8cffac0650297c313779c9fba545096be24e52a5/js/jqte/uncompressed/jquery-te-1.4.0.js#L912-L921 |
51,113 | epeios-q37/xdhelcq | js/jqte/uncompressed/jquery-te-1.4.0.js | extractToText | function extractToText(strings)
{
var $htmlContent, $htmlPattern, $htmlReplace;
// first remove to unnecessary gaps
$htmlContent = strings.replace(/\n/gim,'').replace(/\r/gim,'').replace(/\t/gim,'').replace(/ /gim,' ');
$htmlPattern = [
/\<span(|\s+.*?)><span(|\s+.*?)>(.*?)<\/spa... | javascript | function extractToText(strings)
{
var $htmlContent, $htmlPattern, $htmlReplace;
// first remove to unnecessary gaps
$htmlContent = strings.replace(/\n/gim,'').replace(/\r/gim,'').replace(/\t/gim,'').replace(/ /gim,' ');
$htmlPattern = [
/\<span(|\s+.*?)><span(|\s+.*?)>(.*?)<\/spa... | [
"function",
"extractToText",
"(",
"strings",
")",
"{",
"var",
"$htmlContent",
",",
"$htmlPattern",
",",
"$htmlReplace",
";",
"// first remove to unnecessary gaps\r",
"$htmlContent",
"=",
"strings",
".",
"replace",
"(",
"/",
"\\n",
"/",
"gim",
",",
"''",
")",
"."... | the function of insertion a specific form to texts | [
"the",
"function",
"of",
"insertion",
"a",
"specific",
"form",
"to",
"texts"
] | 8cffac0650297c313779c9fba545096be24e52a5 | https://github.com/epeios-q37/xdhelcq/blob/8cffac0650297c313779c9fba545096be24e52a5/js/jqte/uncompressed/jquery-te-1.4.0.js#L924-L985 |
51,114 | epeios-q37/xdhelcq | js/jqte/uncompressed/jquery-te-1.4.0.js | buttonEmphasize | function buttonEmphasize(e)
{
for(var n = 0; n < buttons.length; n++)
{
if(vars[buttons[n].name] && buttons[n].emphasis && buttons[n].tag!='')
detectElement(buttons[n].tag) ? toolbar.find('.'+vars.css+'_tool_'+buttons[n].cls).addClass(emphasize) : $('.'+vars.css+'_tool_'+buttons[n].cls).r... | javascript | function buttonEmphasize(e)
{
for(var n = 0; n < buttons.length; n++)
{
if(vars[buttons[n].name] && buttons[n].emphasis && buttons[n].tag!='')
detectElement(buttons[n].tag) ? toolbar.find('.'+vars.css+'_tool_'+buttons[n].cls).addClass(emphasize) : $('.'+vars.css+'_tool_'+buttons[n].cls).r... | [
"function",
"buttonEmphasize",
"(",
"e",
")",
"{",
"for",
"(",
"var",
"n",
"=",
"0",
";",
"n",
"<",
"buttons",
".",
"length",
";",
"n",
"++",
")",
"{",
"if",
"(",
"vars",
"[",
"buttons",
"[",
"n",
"]",
".",
"name",
"]",
"&&",
"buttons",
"[",
... | the function of highlighting the toolbar buttons according to the cursor position in jqte editor | [
"the",
"function",
"of",
"highlighting",
"the",
"toolbar",
"buttons",
"according",
"to",
"the",
"cursor",
"position",
"in",
"jqte",
"editor"
] | 8cffac0650297c313779c9fba545096be24e52a5 | https://github.com/epeios-q37/xdhelcq/blob/8cffac0650297c313779c9fba545096be24e52a5/js/jqte/uncompressed/jquery-te-1.4.0.js#L1031-L1064 |
51,115 | glo-js/glo-shader | index.js | update | function update (opt) {
// remove old shaders
disposeShaders()
var quiet = opt.quiet
var attributeBindings = opt.attributes
var vertSrc = opt.vertex || defaultVertex
var fragSrc = opt.fragment || defaultFragment
// re-compile source
vertexShader = compileShader(gl, gl.VERTEX_SHADER, v... | javascript | function update (opt) {
// remove old shaders
disposeShaders()
var quiet = opt.quiet
var attributeBindings = opt.attributes
var vertSrc = opt.vertex || defaultVertex
var fragSrc = opt.fragment || defaultFragment
// re-compile source
vertexShader = compileShader(gl, gl.VERTEX_SHADER, v... | [
"function",
"update",
"(",
"opt",
")",
"{",
"// remove old shaders",
"disposeShaders",
"(",
")",
"var",
"quiet",
"=",
"opt",
".",
"quiet",
"var",
"attributeBindings",
"=",
"opt",
".",
"attributes",
"var",
"vertSrc",
"=",
"opt",
".",
"vertex",
"||",
"defaultV... | reload shader with new source code | [
"reload",
"shader",
"with",
"new",
"source",
"code"
] | 618a5c7b59dcafe9992656e22bb5aa8b69083e01 | https://github.com/glo-js/glo-shader/blob/618a5c7b59dcafe9992656e22bb5aa8b69083e01/index.js#L73-L134 |
51,116 | GLcadet/react-webpack | utils/index.js | runCommand | function runCommand(cmd, args, options) {
return new Promise((resolve, reject) => {
const spwan = spawn(
cmd,
args,
Object.assign(
{
cwd: process.cwd(),
stdio: 'inherit',
shell: true,
},
options
)
)
spwan.on('exit', () => {
... | javascript | function runCommand(cmd, args, options) {
return new Promise((resolve, reject) => {
const spwan = spawn(
cmd,
args,
Object.assign(
{
cwd: process.cwd(),
stdio: 'inherit',
shell: true,
},
options
)
)
spwan.on('exit', () => {
... | [
"function",
"runCommand",
"(",
"cmd",
",",
"args",
",",
"options",
")",
"{",
"return",
"new",
"Promise",
"(",
"(",
"resolve",
",",
"reject",
")",
"=>",
"{",
"const",
"spwan",
"=",
"spawn",
"(",
"cmd",
",",
"args",
",",
"Object",
".",
"assign",
"(",
... | Spawns a child process and runs the specified command
By default, runs in the CWD and inherits stdio
Options are the same as node's child_process.spawn
@param {string} cmd
@param {array<string>} args
@param {object} options | [
"Spawns",
"a",
"child",
"process",
"and",
"runs",
"the",
"specified",
"command",
"By",
"default",
"runs",
"in",
"the",
"CWD",
"and",
"inherits",
"stdio",
"Options",
"are",
"the",
"same",
"as",
"node",
"s",
"child_process",
".",
"spawn"
] | 7fe018edbee94350c532be979aee9cd6b4683d96 | https://github.com/GLcadet/react-webpack/blob/7fe018edbee94350c532be979aee9cd6b4683d96/utils/index.js#L116-L135 |
51,117 | 360fy/plugin-boilerplate | src/PluginLoader.js | existsFile | function existsFile(file, permission) {
return Promise.resolve(fsPromise.accessAsync(file, permission))
.then(() => true)
.catch(() => false);
} | javascript | function existsFile(file, permission) {
return Promise.resolve(fsPromise.accessAsync(file, permission))
.then(() => true)
.catch(() => false);
} | [
"function",
"existsFile",
"(",
"file",
",",
"permission",
")",
"{",
"return",
"Promise",
".",
"resolve",
"(",
"fsPromise",
".",
"accessAsync",
"(",
"file",
",",
"permission",
")",
")",
".",
"then",
"(",
"(",
")",
"=>",
"true",
")",
".",
"catch",
"(",
... | eslint-disable-line no-bitwise | [
"eslint",
"-",
"disable",
"-",
"line",
"no",
"-",
"bitwise"
] | 0145f099e68242ed38f7c385584b107e2ff5084f | https://github.com/360fy/plugin-boilerplate/blob/0145f099e68242ed38f7c385584b107e2ff5084f/src/PluginLoader.js#L46-L50 |
51,118 | MaximTovstashev/brest | lib/utils/generate_returnable_error.js | generateReturnableError | function generateReturnableError(error) {
if (_.isError(error)) {
return {
body: {error: error.message},
options: {code: httpCodes.INTERNAL_SERVER_ERROR}
};
}
if (_.isString(error)) {
return {
body: {error},
options: {code: httpCodes.IN... | javascript | function generateReturnableError(error) {
if (_.isError(error)) {
return {
body: {error: error.message},
options: {code: httpCodes.INTERNAL_SERVER_ERROR}
};
}
if (_.isString(error)) {
return {
body: {error},
options: {code: httpCodes.IN... | [
"function",
"generateReturnableError",
"(",
"error",
")",
"{",
"if",
"(",
"_",
".",
"isError",
"(",
"error",
")",
")",
"{",
"return",
"{",
"body",
":",
"{",
"error",
":",
"error",
".",
"message",
"}",
",",
"options",
":",
"{",
"code",
":",
"httpCodes... | Generate proper returnable object according to received error type
@param {*} error
@return {Object} | [
"Generate",
"proper",
"returnable",
"object",
"according",
"to",
"received",
"error",
"type"
] | 9b0bd6ee452e55b86cd01d1647f0dff460ad191f | https://github.com/MaximTovstashev/brest/blob/9b0bd6ee452e55b86cd01d1647f0dff460ad191f/lib/utils/generate_returnable_error.js#L12-L49 |
51,119 | vlad-zhukov/jepa | scripts/build.js | build | async function build() {
const clientConfig = await webpackConfig({target: 'web', env: 'prod'});
const serverConfig = await webpackConfig({target: 'node', env: 'prod'});
return new Promise((resolve, reject) => {
console.log('Compiling client...');
// eslint-disable-next-line consistent-ret... | javascript | async function build() {
const clientConfig = await webpackConfig({target: 'web', env: 'prod'});
const serverConfig = await webpackConfig({target: 'node', env: 'prod'});
return new Promise((resolve, reject) => {
console.log('Compiling client...');
// eslint-disable-next-line consistent-ret... | [
"async",
"function",
"build",
"(",
")",
"{",
"const",
"clientConfig",
"=",
"await",
"webpackConfig",
"(",
"{",
"target",
":",
"'web'",
",",
"env",
":",
"'prod'",
"}",
")",
";",
"const",
"serverConfig",
"=",
"await",
"webpackConfig",
"(",
"{",
"target",
"... | First compile the client. We need it to properly output assets.json (asset manifest file with the correct hashes on file names BEFORE we can start the server compiler. | [
"First",
"compile",
"the",
"client",
".",
"We",
"need",
"it",
"to",
"properly",
"output",
"assets",
".",
"json",
"(",
"asset",
"manifest",
"file",
"with",
"the",
"correct",
"hashes",
"on",
"file",
"names",
"BEFORE",
"we",
"can",
"start",
"the",
"server",
... | 356a23f1838ef27adeca003adec2dd3b8c25343e | https://github.com/vlad-zhukov/jepa/blob/356a23f1838ef27adeca003adec2dd3b8c25343e/scripts/build.js#L10-L76 |
51,120 | jaredhanson/connect-lrdd | lib/link.js | Link | function Link(href, rel, type) {
if (typeof href == 'object') {
var options = href;
this.href = options.href;
this.template = options.template;
this.rel = options.rel;
this.type = options.type;
} else {
this.href = href;
this.rel = rel;
this.type = type;
}
this.titles = new Mu... | javascript | function Link(href, rel, type) {
if (typeof href == 'object') {
var options = href;
this.href = options.href;
this.template = options.template;
this.rel = options.rel;
this.type = options.type;
} else {
this.href = href;
this.rel = rel;
this.type = type;
}
this.titles = new Mu... | [
"function",
"Link",
"(",
"href",
",",
"rel",
",",
"type",
")",
"{",
"if",
"(",
"typeof",
"href",
"==",
"'object'",
")",
"{",
"var",
"options",
"=",
"href",
";",
"this",
".",
"href",
"=",
"options",
".",
"href",
";",
"this",
".",
"template",
"=",
... | `Link` constructor.
Constructs a new `Link` with the given `href`, `rel`, and `type`.
Alternatively, the link properties can be given as `options`.
Options:
- `href` uri reference
- `template` uri template
- `rel` link relation
- `type` media type
Examples:
new Link('http://services.example.com/aut... | [
"Link",
"constructor",
"."
] | 6d1f1f9b98cdd1ebc5fb3f048c4eddf5ef034ec1 | https://github.com/jaredhanson/connect-lrdd/blob/6d1f1f9b98cdd1ebc5fb3f048c4eddf5ef034ec1/lib/link.js#L32-L47 |
51,121 | photokandyStudios/yasmf-emitter | lib/index.js | on | function on(evt, handler) {
var _this = this;
var thisArg = arguments[2] === undefined ? null : arguments[2];
// if multiple events are passed, call our utility method `eachEvt` to deal with this.
// if it returns `true`, we should exit, because we're actually being cal... | javascript | function on(evt, handler) {
var _this = this;
var thisArg = arguments[2] === undefined ? null : arguments[2];
// if multiple events are passed, call our utility method `eachEvt` to deal with this.
// if it returns `true`, we should exit, because we're actually being cal... | [
"function",
"on",
"(",
"evt",
",",
"handler",
")",
"{",
"var",
"_this",
"=",
"this",
";",
"var",
"thisArg",
"=",
"arguments",
"[",
"2",
"]",
"===",
"undefined",
"?",
"null",
":",
"arguments",
"[",
"2",
"]",
";",
"// if multiple events are passed, call our ... | Registers a handler for one or more events bound to `thisArg`.
@param {string|Array<string>|Object} evt
@param {function} [handler]
@param {Object} [thisArg]
@throws {TypeError}
@returns {Emitter} | [
"Registers",
"a",
"handler",
"for",
"one",
"or",
"more",
"events",
"bound",
"to",
"thisArg",
"."
] | f972cb6f0304a54a8c16626f2a850a2371384c18 | https://github.com/photokandyStudios/yasmf-emitter/blob/f972cb6f0304a54a8c16626f2a850a2371384c18/lib/index.js#L132-L177 |
51,122 | photokandyStudios/yasmf-emitter | lib/index.js | off | function off(evt, handler) {
var _this2 = this;
var thisArg = arguments[2] === undefined ? null : arguments[2];
// handle multiple events appropriately.
if (eachEvt(evt, handler, thisArg, function () {
for (var _len3 = arguments.length, _ = Array(_len3),... | javascript | function off(evt, handler) {
var _this2 = this;
var thisArg = arguments[2] === undefined ? null : arguments[2];
// handle multiple events appropriately.
if (eachEvt(evt, handler, thisArg, function () {
for (var _len3 = arguments.length, _ = Array(_len3),... | [
"function",
"off",
"(",
"evt",
",",
"handler",
")",
"{",
"var",
"_this2",
"=",
"this",
";",
"var",
"thisArg",
"=",
"arguments",
"[",
"2",
"]",
"===",
"undefined",
"?",
"null",
":",
"arguments",
"[",
"2",
"]",
";",
"// handle multiple events appropriately."... | Removes handlers from an event. This one is a bit complicated, because it supports various
overloads that do slightly different things.
* If `evt`, `handler`, and `thisArg` are supplied, the handler is removed as would be expected.
If no `thisArg` is supplied, the `handler` is removed from the `null` category.
* If `h... | [
"Removes",
"handlers",
"from",
"an",
"event",
".",
"This",
"one",
"is",
"a",
"bit",
"complicated",
"because",
"it",
"supports",
"various",
"overloads",
"that",
"do",
"slightly",
"different",
"things",
"."
] | f972cb6f0304a54a8c16626f2a850a2371384c18 | https://github.com/photokandyStudios/yasmf-emitter/blob/f972cb6f0304a54a8c16626f2a850a2371384c18/lib/index.js#L197-L245 |
51,123 | photokandyStudios/yasmf-emitter | lib/index.js | once | function once(evt, handler) {
var thisArg = arguments[2] === undefined ? null : arguments[2];
var wrapper = undefined,
self = this;
// add a wrapper around the handler and listen to the requested event
this.on(evt, wrapper = function () {
... | javascript | function once(evt, handler) {
var thisArg = arguments[2] === undefined ? null : arguments[2];
var wrapper = undefined,
self = this;
// add a wrapper around the handler and listen to the requested event
this.on(evt, wrapper = function () {
... | [
"function",
"once",
"(",
"evt",
",",
"handler",
")",
"{",
"var",
"thisArg",
"=",
"arguments",
"[",
"2",
"]",
"===",
"undefined",
"?",
"null",
":",
"arguments",
"[",
"2",
"]",
";",
"var",
"wrapper",
"=",
"undefined",
",",
"self",
"=",
"this",
";",
"... | Register a handler that will execute once for an event. Otherwise the same as `on`.
@param {string|Array<string>|Object} evt
@param {function} handler
@param {Object} [thisArg] | [
"Register",
"a",
"handler",
"that",
"will",
"execute",
"once",
"for",
"an",
"event",
".",
"Otherwise",
"the",
"same",
"as",
"on",
"."
] | f972cb6f0304a54a8c16626f2a850a2371384c18 | https://github.com/photokandyStudios/yasmf-emitter/blob/f972cb6f0304a54a8c16626f2a850a2371384c18/lib/index.js#L255-L275 |
51,124 | photokandyStudios/yasmf-emitter | lib/index.js | emitSyncFlag | function emitSyncFlag(evt, args) {
var _this3 = this;
var async = arguments[2] === undefined ? true : arguments[2];
var sender = this,
eH = this[_eventHandlers];
// emit locally first to onEvent handlers
try {
(function () {
... | javascript | function emitSyncFlag(evt, args) {
var _this3 = this;
var async = arguments[2] === undefined ? true : arguments[2];
var sender = this,
eH = this[_eventHandlers];
// emit locally first to onEvent handlers
try {
(function () {
... | [
"function",
"emitSyncFlag",
"(",
"evt",
",",
"args",
")",
"{",
"var",
"_this3",
"=",
"this",
";",
"var",
"async",
"=",
"arguments",
"[",
"2",
"]",
"===",
"undefined",
"?",
"true",
":",
"arguments",
"[",
"2",
"]",
";",
"var",
"sender",
"=",
"this",
... | Emit an event, specifying whether or not the event is synchronous or async.
@param {string} evt
@param {Array<*>} args
@param {boolean} [async] | [
"Emit",
"an",
"event",
"specifying",
"whether",
"or",
"not",
"the",
"event",
"is",
"synchronous",
"or",
"async",
"."
] | f972cb6f0304a54a8c16626f2a850a2371384c18 | https://github.com/photokandyStudios/yasmf-emitter/blob/f972cb6f0304a54a8c16626f2a850a2371384c18/lib/index.js#L286-L370 |
51,125 | photokandyStudios/yasmf-emitter | lib/index.js | allOffFor | function allOffFor(o) {
var eH = this[_eventHandlers];
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;
try {
for (var _iterator = eH[Symbol.iterator](), _step; !(_iteratorNormalCompletion = ... | javascript | function allOffFor(o) {
var eH = this[_eventHandlers];
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;
try {
for (var _iterator = eH[Symbol.iterator](), _step; !(_iteratorNormalCompletion = ... | [
"function",
"allOffFor",
"(",
"o",
")",
"{",
"var",
"eH",
"=",
"this",
"[",
"_eventHandlers",
"]",
";",
"var",
"_iteratorNormalCompletion",
"=",
"true",
";",
"var",
"_didIteratorError",
"=",
"false",
";",
"var",
"_iteratorError",
"=",
"undefined",
";",
"try"... | Removes all handlers for all events for the supplied object.
@param {Object} o
@returns {Emitter} | [
"Removes",
"all",
"handlers",
"for",
"all",
"events",
"for",
"the",
"supplied",
"object",
"."
] | f972cb6f0304a54a8c16626f2a850a2371384c18 | https://github.com/photokandyStudios/yasmf-emitter/blob/f972cb6f0304a54a8c16626f2a850a2371384c18/lib/index.js#L409-L442 |
51,126 | novadiscovery/nway | lib/buildTree.js | builder | function builder(fromUID, node) {
debug('builder fromUID:%s',fromUID);
// Create a node (or use the provided one)
var node = node || new DepNode((packageId++).toString(), options);
// Get the entry point module object
var fromModule = findModule(fromUID);
// Add entry point to the module
node.addMod... | javascript | function builder(fromUID, node) {
debug('builder fromUID:%s',fromUID);
// Create a node (or use the provided one)
var node = node || new DepNode((packageId++).toString(), options);
// Get the entry point module object
var fromModule = findModule(fromUID);
// Add entry point to the module
node.addMod... | [
"function",
"builder",
"(",
"fromUID",
",",
"node",
")",
"{",
"debug",
"(",
"'builder fromUID:%s'",
",",
"fromUID",
")",
";",
"// Create a node (or use the provided one)",
"var",
"node",
"=",
"node",
"||",
"new",
"DepNode",
"(",
"(",
"packageId",
"++",
")",
".... | Build a module dependency tree
@param {string} fromUID Entry point module uniq id
@param {DepNode|null} node parent DepNode
@return {DepNode} A DepNode object (traversable as a DepNode tree)
@api public | [
"Build",
"a",
"module",
"dependency",
"tree"
] | fa31c6fe56f2305721e581ac25e8ac9a87e15dda | https://github.com/novadiscovery/nway/blob/fa31c6fe56f2305721e581ac25e8ac9a87e15dda/lib/buildTree.js#L73-L111 |
51,127 | mattfenwick/clojarse-js | lib/ast.js | extract | function extract(token) {
var obj = {};
Object.keys(token).map(function(k) {
if ( !ignore.has(k) ) {
obj[k] = token[k];
}
});
return obj;
} | javascript | function extract(token) {
var obj = {};
Object.keys(token).map(function(k) {
if ( !ignore.has(k) ) {
obj[k] = token[k];
}
});
return obj;
} | [
"function",
"extract",
"(",
"token",
")",
"{",
"var",
"obj",
"=",
"{",
"}",
";",
"Object",
".",
"keys",
"(",
"token",
")",
".",
"map",
"(",
"function",
"(",
"k",
")",
"{",
"if",
"(",
"!",
"ignore",
".",
"has",
"(",
"k",
")",
")",
"{",
"obj",
... | make a copy of an object, minus certain keys | [
"make",
"a",
"copy",
"of",
"an",
"object",
"minus",
"certain",
"keys"
] | 750321d5b80bb4c1c4aeedf2b994699d2cdfb979 | https://github.com/mattfenwick/clojarse-js/blob/750321d5b80bb4c1c4aeedf2b994699d2cdfb979/lib/ast.js#L46-L54 |
51,128 | MostlyJS/mostly-poplarjs | src/poplar.js | mergeListeners | function mergeListeners(emitter) {
var events = emitter._events;
_.each(events, function (fns, type) {
if (Array.isArray(fns)) {
_.each(fns, function (fn) {
if (_.isFunction(fn)) {
self.on(type, fn);
}
});
} else if (_.isFunction(fns)... | javascript | function mergeListeners(emitter) {
var events = emitter._events;
_.each(events, function (fns, type) {
if (Array.isArray(fns)) {
_.each(fns, function (fn) {
if (_.isFunction(fn)) {
self.on(type, fn);
}
});
} else if (_.isFunction(fns)... | [
"function",
"mergeListeners",
"(",
"emitter",
")",
"{",
"var",
"events",
"=",
"emitter",
".",
"_events",
";",
"_",
".",
"each",
"(",
"events",
",",
"function",
"(",
"fns",
",",
"type",
")",
"{",
"if",
"(",
"Array",
".",
"isArray",
"(",
"fns",
")",
... | look up all ApiBuilder listeners then add it to api | [
"look",
"up",
"all",
"ApiBuilder",
"listeners",
"then",
"add",
"it",
"to",
"api"
] | bda12a72891e8c8d338e7560e7fe9e11ad74a2d9 | https://github.com/MostlyJS/mostly-poplarjs/blob/bda12a72891e8c8d338e7560e7fe9e11ad74a2d9/src/poplar.js#L87-L100 |
51,129 | MostlyJS/mostly-poplarjs | src/poplar.js | mergeMethods | function mergeMethods(builder) {
var methods = builder.methods();
_.each(methods, function (fn, methodName) {
// e.g.: users.getUserInfo
self._methods[util.format('%s.%s', name, methodName)] = fn;
});
} | javascript | function mergeMethods(builder) {
var methods = builder.methods();
_.each(methods, function (fn, methodName) {
// e.g.: users.getUserInfo
self._methods[util.format('%s.%s', name, methodName)] = fn;
});
} | [
"function",
"mergeMethods",
"(",
"builder",
")",
"{",
"var",
"methods",
"=",
"builder",
".",
"methods",
"(",
")",
";",
"_",
".",
"each",
"(",
"methods",
",",
"function",
"(",
"fn",
",",
"methodName",
")",
"{",
"// e.g.: users.getUserInfo",
"self",
".",
"... | look up all ApiBuilder methods then add it to api | [
"look",
"up",
"all",
"ApiBuilder",
"methods",
"then",
"add",
"it",
"to",
"api"
] | bda12a72891e8c8d338e7560e7fe9e11ad74a2d9 | https://github.com/MostlyJS/mostly-poplarjs/blob/bda12a72891e8c8d338e7560e7fe9e11ad74a2d9/src/poplar.js#L103-L109 |
51,130 | vesln/surround | lib/surround.js | Surround | function Surround(obj, pattern) {
var self = this;
var regEX = new RegExp(pattern);
for(var fn in obj) {
var orig = obj[fn];
if (typeof(orig) != "function" || !regEX.test(fn))
continue;
// Already surrouneded.
if (obj[fn].__stacks) {
this.stacks = obj[fn].__stacks;
return thi... | javascript | function Surround(obj, pattern) {
var self = this;
var regEX = new RegExp(pattern);
for(var fn in obj) {
var orig = obj[fn];
if (typeof(orig) != "function" || !regEX.test(fn))
continue;
// Already surrouneded.
if (obj[fn].__stacks) {
this.stacks = obj[fn].__stacks;
return thi... | [
"function",
"Surround",
"(",
"obj",
",",
"pattern",
")",
"{",
"var",
"self",
"=",
"this",
";",
"var",
"regEX",
"=",
"new",
"RegExp",
"(",
"pattern",
")",
";",
"for",
"(",
"var",
"fn",
"in",
"obj",
")",
"{",
"var",
"orig",
"=",
"obj",
"[",
"fn",
... | Surround constructor.
@param {Object} Object
@param {Pattern} pattern
@constructor | [
"Surround",
"constructor",
"."
] | 665c261c0929610b3133a6746341522b59c5065f | https://github.com/vesln/surround/blob/665c261c0929610b3133a6746341522b59c5065f/lib/surround.js#L10-L47 |
51,131 | raincatcher-beta/raincatcher-file | lib/cloud/services/fileService.js | createTemporaryStorageFolder | function createTemporaryStorageFolder() {
fs.mkdir(imageDir, '0775', function(err) {
if (err && err.code !== 'EEXIST') {
console.log(err);
throw new Error(err);
}
});
} | javascript | function createTemporaryStorageFolder() {
fs.mkdir(imageDir, '0775', function(err) {
if (err && err.code !== 'EEXIST') {
console.log(err);
throw new Error(err);
}
});
} | [
"function",
"createTemporaryStorageFolder",
"(",
")",
"{",
"fs",
".",
"mkdir",
"(",
"imageDir",
",",
"'0775'",
",",
"function",
"(",
"err",
")",
"{",
"if",
"(",
"err",
"&&",
"err",
".",
"code",
"!==",
"'EEXIST'",
")",
"{",
"console",
".",
"log",
"(",
... | Create temporary storage folder used by mutler to store files before
uploading to permanent storage | [
"Create",
"temporary",
"storage",
"folder",
"used",
"by",
"mutler",
"to",
"store",
"files",
"before",
"uploading",
"to",
"permanent",
"storage"
] | 1a4b5d53505eb381a3d4c0bd384e743c39886c1d | https://github.com/raincatcher-beta/raincatcher-file/blob/1a4b5d53505eb381a3d4c0bd384e743c39886c1d/lib/cloud/services/fileService.js#L15-L22 |
51,132 | raincatcher-beta/raincatcher-file | lib/cloud/services/fileService.js | writeStreamToFile | function writeStreamToFile(fileMeta, stream) {
var deferred = q.defer();
stream.on('end', function() {
deferred.resolve(fileMeta);
});
stream.on('error', function(error) {
deferred.reject(error);
});
var filename = imageDir + '/' + fileMeta.uid;
stream.pipe(fs.createWriteStream(filename));
retur... | javascript | function writeStreamToFile(fileMeta, stream) {
var deferred = q.defer();
stream.on('end', function() {
deferred.resolve(fileMeta);
});
stream.on('error', function(error) {
deferred.reject(error);
});
var filename = imageDir + '/' + fileMeta.uid;
stream.pipe(fs.createWriteStream(filename));
retur... | [
"function",
"writeStreamToFile",
"(",
"fileMeta",
",",
"stream",
")",
"{",
"var",
"deferred",
"=",
"q",
".",
"defer",
"(",
")",
";",
"stream",
".",
"on",
"(",
"'end'",
",",
"function",
"(",
")",
"{",
"deferred",
".",
"resolve",
"(",
"fileMeta",
")",
... | Utility function for saving file in temp folder
@param fileMeta
@param stream | [
"Utility",
"function",
"for",
"saving",
"file",
"in",
"temp",
"folder"
] | 1a4b5d53505eb381a3d4c0bd384e743c39886c1d | https://github.com/raincatcher-beta/raincatcher-file/blob/1a4b5d53505eb381a3d4c0bd384e743c39886c1d/lib/cloud/services/fileService.js#L29-L40 |
51,133 | raincatcher-beta/raincatcher-file | lib/cloud/services/fileService.js | parseBase64Stream | function parseBase64Stream(req) {
var passthrough = false;
var accumulation = '';
var stream = req.pipe(through(function(chunk, enc, callback) {
if (!passthrough) {
accumulation += chunk;
var test = ';base64,';
var index = accumulation.indexOf(test);
if (index > -1) {
passthrou... | javascript | function parseBase64Stream(req) {
var passthrough = false;
var accumulation = '';
var stream = req.pipe(through(function(chunk, enc, callback) {
if (!passthrough) {
accumulation += chunk;
var test = ';base64,';
var index = accumulation.indexOf(test);
if (index > -1) {
passthrou... | [
"function",
"parseBase64Stream",
"(",
"req",
")",
"{",
"var",
"passthrough",
"=",
"false",
";",
"var",
"accumulation",
"=",
"''",
";",
"var",
"stream",
"=",
"req",
".",
"pipe",
"(",
"through",
"(",
"function",
"(",
"chunk",
",",
"enc",
",",
"callback",
... | Parse Base64 URL into stream that can be saved as file.
@param req | [
"Parse",
"Base64",
"URL",
"into",
"stream",
"that",
"can",
"be",
"saved",
"as",
"file",
"."
] | 1a4b5d53505eb381a3d4c0bd384e743c39886c1d | https://github.com/raincatcher-beta/raincatcher-file/blob/1a4b5d53505eb381a3d4c0bd384e743c39886c1d/lib/cloud/services/fileService.js#L47-L67 |
51,134 | dgeorges/modeljs | src/model.js | function (thisProperty, callbackArgs) {
return function (callback) {
function notifyListener() {
if (Model.asyncEvents) {
setTimeout(function () {
callback.apply(thisProperty, callbackArgs);
... | javascript | function (thisProperty, callbackArgs) {
return function (callback) {
function notifyListener() {
if (Model.asyncEvents) {
setTimeout(function () {
callback.apply(thisProperty, callbackArgs);
... | [
"function",
"(",
"thisProperty",
",",
"callbackArgs",
")",
"{",
"return",
"function",
"(",
"callback",
")",
"{",
"function",
"notifyListener",
"(",
")",
"{",
"if",
"(",
"Model",
".",
"asyncEvents",
")",
"{",
"setTimeout",
"(",
"function",
"(",
")",
"{",
... | This weird executeCallback function is a bit more complicated than it needs to be but is used to get around the JSLint warning of creating a function within the while loop below | [
"This",
"weird",
"executeCallback",
"function",
"is",
"a",
"bit",
"more",
"complicated",
"than",
"it",
"needs",
"to",
"be",
"but",
"is",
"used",
"to",
"get",
"around",
"the",
"JSLint",
"warning",
"of",
"creating",
"a",
"function",
"within",
"the",
"while",
... | 9a4f40a1c75c3a42cfeb451f9041a8186885f7b0 | https://github.com/dgeorges/modeljs/blob/9a4f40a1c75c3a42cfeb451f9041a8186885f7b0/src/model.js#L218-L255 | |
51,135 | dgeorges/modeljs | src/model.js | Property | function Property (name, value, parent, metadata) {
var myName = "/" + name;
if (parent) {
myName = parent.getName() + myName;
}
Object.defineProperty(this, "_name", {
value: myName,
enumerable: false
});
Object.definePro... | javascript | function Property (name, value, parent, metadata) {
var myName = "/" + name;
if (parent) {
myName = parent.getName() + myName;
}
Object.defineProperty(this, "_name", {
value: myName,
enumerable: false
});
Object.definePro... | [
"function",
"Property",
"(",
"name",
",",
"value",
",",
"parent",
",",
"metadata",
")",
"{",
"var",
"myName",
"=",
"\"/\"",
"+",
"name",
";",
"if",
"(",
"parent",
")",
"{",
"myName",
"=",
"parent",
".",
"getName",
"(",
")",
"+",
"myName",
";",
"}",... | A Property is a name value pair belonging to a Model.
@class Property
@constructor
@private used internally by the Model.prototype.createProperty method.
@param {[String]} name The name of the property
@param {[String, Boolean, Number, null, Date, Function, Object]} value The Property Value
@param {[Model]} pare... | [
"A",
"Property",
"is",
"a",
"name",
"value",
"pair",
"belonging",
"to",
"a",
"Model",
"."
] | 9a4f40a1c75c3a42cfeb451f9041a8186885f7b0 | https://github.com/dgeorges/modeljs/blob/9a4f40a1c75c3a42cfeb451f9041a8186885f7b0/src/model.js#L441-L494 |
51,136 | dgeorges/modeljs | src/model.js | Model | function Model(json, metadata, parent) {
var jsonModel = json || {},
modelMetadata = metadata || {},
modelName = modelMetadata.name !== undefined? modelMetadata.name : "root",
modelParent = parent || null;
if (modelMetadata.name) { // name is not part of the me... | javascript | function Model(json, metadata, parent) {
var jsonModel = json || {},
modelMetadata = metadata || {},
modelName = modelMetadata.name !== undefined? modelMetadata.name : "root",
modelParent = parent || null;
if (modelMetadata.name) { // name is not part of the me... | [
"function",
"Model",
"(",
"json",
",",
"metadata",
",",
"parent",
")",
"{",
"var",
"jsonModel",
"=",
"json",
"||",
"{",
"}",
",",
"modelMetadata",
"=",
"metadata",
"||",
"{",
"}",
",",
"modelName",
"=",
"modelMetadata",
".",
"name",
"!==",
"undefined",
... | The model Object that wraps the JSON.
@example
For examples see: <b>testPrimitiveSaveLoad</b>, <b>testObjectsSaveLoad</b>, <b>testComplexSaveLoad</b>
<b>testGetNameMethod</b> and <b>testSaveLoadWithMetaData</b>
@class Model
@constructor
@extends Property
@param {Object} json? The json object to be modeled.
@para... | [
"The",
"model",
"Object",
"that",
"wraps",
"the",
"JSON",
"."
] | 9a4f40a1c75c3a42cfeb451f9041a8186885f7b0 | https://github.com/dgeorges/modeljs/blob/9a4f40a1c75c3a42cfeb451f9041a8186885f7b0/src/model.js#L1010-L1038 |
51,137 | dgeorges/modeljs | src/model.js | propergateEvent | function propergateEvent (isAtoB, property /*, ... other event callback arguments */) {
var eventName = arguments[arguments.length-1]; //Since this is registered on the all event the last argument is the orginal Event name.
if (eventName === Model.Event.CHILD_DESTROYED) { //we listen to he des... | javascript | function propergateEvent (isAtoB, property /*, ... other event callback arguments */) {
var eventName = arguments[arguments.length-1]; //Since this is registered on the all event the last argument is the orginal Event name.
if (eventName === Model.Event.CHILD_DESTROYED) { //we listen to he des... | [
"function",
"propergateEvent",
"(",
"isAtoB",
",",
"property",
"/*, ... other event callback arguments */",
")",
"{",
"var",
"eventName",
"=",
"arguments",
"[",
"arguments",
".",
"length",
"-",
"1",
"]",
";",
"//Since this is registered on the all event the last argument is... | This function is registered on the ALL event to propagate its events to the
connected property. FYI 'this' is bound to the source linked property.
@param {Boolean} isAtoB [description]
@param {[type]} property On any event the first argument is the property the event was triggered on.
@return {[type]} [... | [
"This",
"function",
"is",
"registered",
"on",
"the",
"ALL",
"event",
"to",
"propagate",
"its",
"events",
"to",
"the",
"connected",
"property",
".",
"FYI",
"this",
"is",
"bound",
"to",
"the",
"source",
"linked",
"property",
"."
] | 9a4f40a1c75c3a42cfeb451f9041a8186885f7b0 | https://github.com/dgeorges/modeljs/blob/9a4f40a1c75c3a42cfeb451f9041a8186885f7b0/src/model.js#L1542-L1599 |
51,138 | Canop/file-archive | index.js | writeNewAsync | function writeNewAsync(filepath, data){
return new Promise((resolve, reject)=>{
fs.writeFile(filepath, data ,{ flag: "wx" }, function(err){
if (!err) resolve(true)
else reject(err)
})
})
} | javascript | function writeNewAsync(filepath, data){
return new Promise((resolve, reject)=>{
fs.writeFile(filepath, data ,{ flag: "wx" }, function(err){
if (!err) resolve(true)
else reject(err)
})
})
} | [
"function",
"writeNewAsync",
"(",
"filepath",
",",
"data",
")",
"{",
"return",
"new",
"Promise",
"(",
"(",
"resolve",
",",
"reject",
")",
"=>",
"{",
"fs",
".",
"writeFile",
"(",
"filepath",
",",
"data",
",",
"{",
"flag",
":",
"\"wx\"",
"}",
",",
"fun... | return a promise, fail with "EEXIST" when the file already exists | [
"return",
"a",
"promise",
"fail",
"with",
"EEXIST",
"when",
"the",
"file",
"already",
"exists"
] | 0b0aa383964f2dab78655a22a2e53683d79067c0 | https://github.com/Canop/file-archive/blob/0b0aa383964f2dab78655a22a2e53683d79067c0/index.js#L6-L13 |
51,139 | Canop/file-archive | index.js | readdirAsync | function readdirAsync(filepath){
return new Promise((resolve, reject)=>{
fs.readdir(filepath, (err, items)=>{
if (err) reject(err)
else resolve(items)
})
})
} | javascript | function readdirAsync(filepath){
return new Promise((resolve, reject)=>{
fs.readdir(filepath, (err, items)=>{
if (err) reject(err)
else resolve(items)
})
})
} | [
"function",
"readdirAsync",
"(",
"filepath",
")",
"{",
"return",
"new",
"Promise",
"(",
"(",
"resolve",
",",
"reject",
")",
"=>",
"{",
"fs",
".",
"readdir",
"(",
"filepath",
",",
"(",
"err",
",",
"items",
")",
"=>",
"{",
"if",
"(",
"err",
")",
"rej... | simple promisification of fs.readdir | [
"simple",
"promisification",
"of",
"fs",
".",
"readdir"
] | 0b0aa383964f2dab78655a22a2e53683d79067c0 | https://github.com/Canop/file-archive/blob/0b0aa383964f2dab78655a22a2e53683d79067c0/index.js#L16-L23 |
51,140 | cli-kit/cli-middleware | index.js | raise | function raise(err, parameters, cause) {
if(!(err instanceof Error)) {
err = wrap(err, parameters, cause);
}
throw err;
} | javascript | function raise(err, parameters, cause) {
if(!(err instanceof Error)) {
err = wrap(err, parameters, cause);
}
throw err;
} | [
"function",
"raise",
"(",
"err",
",",
"parameters",
",",
"cause",
")",
"{",
"if",
"(",
"!",
"(",
"err",
"instanceof",
"Error",
")",
")",
"{",
"err",
"=",
"wrap",
"(",
"err",
",",
"parameters",
",",
"cause",
")",
";",
"}",
"throw",
"err",
";",
"}"... | Default raise implementation.
@param err Error instance or string.
@param parameters Message replacement parameters.
@param cause An error that caused this error. | [
"Default",
"raise",
"implementation",
"."
] | 9ade9f64b2995940e2341df92a824b2f93df0228 | https://github.com/cli-kit/cli-middleware/blob/9ade9f64b2995940e2341df92a824b2f93df0228/index.js#L42-L47 |
51,141 | KyleBanks/cluster-utils | lib/Timeout.js | _runIfLocked | function _runIfLocked() {
var self = this;
self._clusterUtils._setLock(self.lockKey, function(err, lock) {
if (err) {
throw err;
} else if (!lock) {
return;
}
process.nextTick(self._func);
});
} | javascript | function _runIfLocked() {
var self = this;
self._clusterUtils._setLock(self.lockKey, function(err, lock) {
if (err) {
throw err;
} else if (!lock) {
return;
}
process.nextTick(self._func);
});
} | [
"function",
"_runIfLocked",
"(",
")",
"{",
"var",
"self",
"=",
"this",
";",
"self",
".",
"_clusterUtils",
".",
"_setLock",
"(",
"self",
".",
"lockKey",
",",
"function",
"(",
"err",
",",
"lock",
")",
"{",
"if",
"(",
"err",
")",
"{",
"throw",
"err",
... | Attempts to run the function provided if a lock can be achieved on the lock key. | [
"Attempts",
"to",
"run",
"the",
"function",
"provided",
"if",
"a",
"lock",
"can",
"be",
"achieved",
"on",
"the",
"lock",
"key",
"."
] | b24814ae413768b4bc671ee71dcc912c999bd20b | https://github.com/KyleBanks/cluster-utils/blob/b24814ae413768b4bc671ee71dcc912c999bd20b/lib/Timeout.js#L37-L49 |
51,142 | gethuman/pancakes-recipe | middleware/mw.auth.cookie.js | registerCookieJar | function registerCookieJar(server) {
var deferred = Q.defer();
server.register({
register: require('yar'),
options: {
cache: {
expiresIn: cookieConfig.ttl
},
cookieOptions: {
clearInvalid: t... | javascript | function registerCookieJar(server) {
var deferred = Q.defer();
server.register({
register: require('yar'),
options: {
cache: {
expiresIn: cookieConfig.ttl
},
cookieOptions: {
clearInvalid: t... | [
"function",
"registerCookieJar",
"(",
"server",
")",
"{",
"var",
"deferred",
"=",
"Q",
".",
"defer",
"(",
")",
";",
"server",
".",
"register",
"(",
"{",
"register",
":",
"require",
"(",
"'yar'",
")",
",",
"options",
":",
"{",
"cache",
":",
"{",
"expi... | Register the cookie jar using the Hapi yar library
@param server | [
"Register",
"the",
"cookie",
"jar",
"using",
"the",
"Hapi",
"yar",
"library"
] | ea3feb8839e2edaf1b4577c052b8958953db4498 | https://github.com/gethuman/pancakes-recipe/blob/ea3feb8839e2edaf1b4577c052b8958953db4498/middleware/mw.auth.cookie.js#L14-L35 |
51,143 | gethuman/pancakes-recipe | middleware/mw.auth.cookie.js | registerJwtCookie | function registerJwtCookie(server) {
server.state('jwt', {
ttl: cookieConfig.ttl,
domain: cookieConfig.domain,
isSecure: cookieConfig.isSecure,
path: '/'
});
} | javascript | function registerJwtCookie(server) {
server.state('jwt', {
ttl: cookieConfig.ttl,
domain: cookieConfig.domain,
isSecure: cookieConfig.isSecure,
path: '/'
});
} | [
"function",
"registerJwtCookie",
"(",
"server",
")",
"{",
"server",
".",
"state",
"(",
"'jwt'",
",",
"{",
"ttl",
":",
"cookieConfig",
".",
"ttl",
",",
"domain",
":",
"cookieConfig",
".",
"domain",
",",
"isSecure",
":",
"cookieConfig",
".",
"isSecure",
",",... | Register the cookie used for the JSON web token.
This is only used on the webserver since the API
will get the token in the header of the request.
@param server | [
"Register",
"the",
"cookie",
"used",
"for",
"the",
"JSON",
"web",
"token",
".",
"This",
"is",
"only",
"used",
"on",
"the",
"webserver",
"since",
"the",
"API",
"will",
"get",
"the",
"token",
"in",
"the",
"header",
"of",
"the",
"request",
"."
] | ea3feb8839e2edaf1b4577c052b8958953db4498 | https://github.com/gethuman/pancakes-recipe/blob/ea3feb8839e2edaf1b4577c052b8958953db4498/middleware/mw.auth.cookie.js#L44-L51 |
51,144 | gethuman/pancakes-recipe | middleware/mw.auth.cookie.js | getJwtFromCookie | function getJwtFromCookie(req, reply) {
var jwt = req.state && req.state.jwt;
if (jwt) {
req.headers = req.headers || {};
req.headers.authorization = jwt;
}
reply.continue();
} | javascript | function getJwtFromCookie(req, reply) {
var jwt = req.state && req.state.jwt;
if (jwt) {
req.headers = req.headers || {};
req.headers.authorization = jwt;
}
reply.continue();
} | [
"function",
"getJwtFromCookie",
"(",
"req",
",",
"reply",
")",
"{",
"var",
"jwt",
"=",
"req",
".",
"state",
"&&",
"req",
".",
"state",
".",
"jwt",
";",
"if",
"(",
"jwt",
")",
"{",
"req",
".",
"headers",
"=",
"req",
".",
"headers",
"||",
"{",
"}",... | Get the JWT token from the cookie and stick it into the request
@param req
@param reply | [
"Get",
"the",
"JWT",
"token",
"from",
"the",
"cookie",
"and",
"stick",
"it",
"into",
"the",
"request"
] | ea3feb8839e2edaf1b4577c052b8958953db4498 | https://github.com/gethuman/pancakes-recipe/blob/ea3feb8839e2edaf1b4577c052b8958953db4498/middleware/mw.auth.cookie.js#L58-L66 |
51,145 | gethuman/pancakes-recipe | middleware/mw.auth.cookie.js | init | function init(ctx) {
var server = ctx.server;
return registerCookieJar(server)
.then(function () {
registerJwtCookie(server);
server.ext('onPreAuth', getJwtFromCookie);
return new Q(ctx);
});
} | javascript | function init(ctx) {
var server = ctx.server;
return registerCookieJar(server)
.then(function () {
registerJwtCookie(server);
server.ext('onPreAuth', getJwtFromCookie);
return new Q(ctx);
});
} | [
"function",
"init",
"(",
"ctx",
")",
"{",
"var",
"server",
"=",
"ctx",
".",
"server",
";",
"return",
"registerCookieJar",
"(",
"server",
")",
".",
"then",
"(",
"function",
"(",
")",
"{",
"registerJwtCookie",
"(",
"server",
")",
";",
"server",
".",
"ext... | Register the cookie jar and move the token from the cookie to the request auth
@param ctx | [
"Register",
"the",
"cookie",
"jar",
"and",
"move",
"the",
"token",
"from",
"the",
"cookie",
"to",
"the",
"request",
"auth"
] | ea3feb8839e2edaf1b4577c052b8958953db4498 | https://github.com/gethuman/pancakes-recipe/blob/ea3feb8839e2edaf1b4577c052b8958953db4498/middleware/mw.auth.cookie.js#L72-L82 |
51,146 | ticup/tokepi | index.js | startsWithAny | function startsWithAny(string, vector) {
return _.any(vector.map(function (e) { return _str.startsWith(string, e); }));
} | javascript | function startsWithAny(string, vector) {
return _.any(vector.map(function (e) { return _str.startsWith(string, e); }));
} | [
"function",
"startsWithAny",
"(",
"string",
",",
"vector",
")",
"{",
"return",
"_",
".",
"any",
"(",
"vector",
".",
"map",
"(",
"function",
"(",
"e",
")",
"{",
"return",
"_str",
".",
"startsWith",
"(",
"string",
",",
"e",
")",
";",
"}",
")",
")",
... | True if the string starts with any element of given vector | [
"True",
"if",
"the",
"string",
"starts",
"with",
"any",
"element",
"of",
"given",
"vector"
] | af2aa446e76f03d32e1fe6833b0397d5915e5521 | https://github.com/ticup/tokepi/blob/af2aa446e76f03d32e1fe6833b0397d5915e5521/index.js#L252-L254 |
51,147 | ticup/tokepi | index.js | endsWithAny | function endsWithAny(string, vector) {
return _.any(vector.map(function (e) { return _str.endsWith(string, e); }));
} | javascript | function endsWithAny(string, vector) {
return _.any(vector.map(function (e) { return _str.endsWith(string, e); }));
} | [
"function",
"endsWithAny",
"(",
"string",
",",
"vector",
")",
"{",
"return",
"_",
".",
"any",
"(",
"vector",
".",
"map",
"(",
"function",
"(",
"e",
")",
"{",
"return",
"_str",
".",
"endsWith",
"(",
"string",
",",
"e",
")",
";",
"}",
")",
")",
";"... | True if the string ends with any element of given vector | [
"True",
"if",
"the",
"string",
"ends",
"with",
"any",
"element",
"of",
"given",
"vector"
] | af2aa446e76f03d32e1fe6833b0397d5915e5521 | https://github.com/ticup/tokepi/blob/af2aa446e76f03d32e1fe6833b0397d5915e5521/index.js#L256-L258 |
51,148 | demmer/validate-options | browser/specs/validate-options.spec.js | createReduce | function createReduce(dir) {
// Optimized iterator function as using arguments.length
// in the main function will deoptimize the, see #1991.
function iterator(obj, iteratee, memo, keys, index, length) {
for (; index >= 0 && index < len... | javascript | function createReduce(dir) {
// Optimized iterator function as using arguments.length
// in the main function will deoptimize the, see #1991.
function iterator(obj, iteratee, memo, keys, index, length) {
for (; index >= 0 && index < len... | [
"function",
"createReduce",
"(",
"dir",
")",
"{",
"// Optimized iterator function as using arguments.length",
"// in the main function will deoptimize the, see #1991.",
"function",
"iterator",
"(",
"obj",
",",
"iteratee",
",",
"memo",
",",
"keys",
",",
"index",
",",
"length... | Create a reducing function iterating left or right. Create a reducing function iterating left or right. | [
"Create",
"a",
"reducing",
"function",
"iterating",
"left",
"or",
"right",
".",
"Create",
"a",
"reducing",
"function",
"iterating",
"left",
"or",
"right",
"."
] | af18816366adca0b6da7347dcb31b9336b862a6d | https://github.com/demmer/validate-options/blob/af18816366adca0b6da7347dcb31b9336b862a6d/browser/specs/validate-options.spec.js#L295-L315 |
51,149 | skerit/alchemy | lib/app/helper/socket_helper.js | onResponse | function onResponse(packet) {
if (typeof that.callbacks[packet.respond_to] === 'function') {
try {
if (packet.data) {
packet.data = JSON.undry(packet.data);
}
} catch (err) {
console.log('ERROR UNDRYING PACKET:', err);
return;
}
if (packet.noData) {
that.callbacks[packet.respon... | javascript | function onResponse(packet) {
if (typeof that.callbacks[packet.respond_to] === 'function') {
try {
if (packet.data) {
packet.data = JSON.undry(packet.data);
}
} catch (err) {
console.log('ERROR UNDRYING PACKET:', err);
return;
}
if (packet.noData) {
that.callbacks[packet.respon... | [
"function",
"onResponse",
"(",
"packet",
")",
"{",
"if",
"(",
"typeof",
"that",
".",
"callbacks",
"[",
"packet",
".",
"respond_to",
"]",
"===",
"'function'",
")",
"{",
"try",
"{",
"if",
"(",
"packet",
".",
"data",
")",
"{",
"packet",
".",
"data",
"="... | The function that handles responses | [
"The",
"function",
"that",
"handles",
"responses"
] | ede1dad07a5a737d5d1e10c2ff87fdfb057443f8 | https://github.com/skerit/alchemy/blob/ede1dad07a5a737d5d1e10c2ff87fdfb057443f8/lib/app/helper/socket_helper.js#L450-L473 |
51,150 | skerit/alchemy | lib/app/helper/socket_helper.js | onPacket | function onPacket(packet) {
var respond;
try {
if (packet.data && typeof packet.data == 'object') {
packet.data = JSON.undry(packet.data);
}
} catch (err) {
console.log('ERROR UNDRYING PACKET:', err, packet);
return;
}
if (packet.respond) {
respond = function respond(err, data) {
var... | javascript | function onPacket(packet) {
var respond;
try {
if (packet.data && typeof packet.data == 'object') {
packet.data = JSON.undry(packet.data);
}
} catch (err) {
console.log('ERROR UNDRYING PACKET:', err, packet);
return;
}
if (packet.respond) {
respond = function respond(err, data) {
var... | [
"function",
"onPacket",
"(",
"packet",
")",
"{",
"var",
"respond",
";",
"try",
"{",
"if",
"(",
"packet",
".",
"data",
"&&",
"typeof",
"packet",
".",
"data",
"==",
"'object'",
")",
"{",
"packet",
".",
"data",
"=",
"JSON",
".",
"undry",
"(",
"packet",
... | The function that handles packets | [
"The",
"function",
"that",
"handles",
"packets"
] | ede1dad07a5a737d5d1e10c2ff87fdfb057443f8 | https://github.com/skerit/alchemy/blob/ede1dad07a5a737d5d1e10c2ff87fdfb057443f8/lib/app/helper/socket_helper.js#L476-L519 |
51,151 | christophehurpeau/springbokjs-dom | vendor/web-animations.js | function(inheritedTime) {
this._inheritedTime = inheritedTime;
this._updateTimeMarkers();
// The polyfill uses a sampling model whereby time values are propagated
// down the tree at each sample. However, for the media item, we need to use
// play() and pause().
// Handle the case of being out... | javascript | function(inheritedTime) {
this._inheritedTime = inheritedTime;
this._updateTimeMarkers();
// The polyfill uses a sampling model whereby time values are propagated
// down the tree at each sample. However, for the media item, we need to use
// play() and pause().
// Handle the case of being out... | [
"function",
"(",
"inheritedTime",
")",
"{",
"this",
".",
"_inheritedTime",
"=",
"inheritedTime",
";",
"this",
".",
"_updateTimeMarkers",
"(",
")",
";",
"// The polyfill uses a sampling model whereby time values are propagated",
"// down the tree at each sample. However, for the m... | This is called by the polyfill on each tick when our AnimationPlayer's tree is active. | [
"This",
"is",
"called",
"by",
"the",
"polyfill",
"on",
"each",
"tick",
"when",
"our",
"AnimationPlayer",
"s",
"tree",
"is",
"active",
"."
] | 6e14a87fbe71124a0cbb68d1cb8626689c3b18a1 | https://github.com/christophehurpeau/springbokjs-dom/blob/6e14a87fbe71124a0cbb68d1cb8626689c3b18a1/vendor/web-animations.js#L1574-L1643 | |
51,152 | christophehurpeau/springbokjs-dom | vendor/web-animations.js | function(offset, composite, easing) {
ASSERT_ENABLED && assert(
typeof offset === 'number' || offset === null,
'Invalid offset value');
ASSERT_ENABLED && assert(
composite === 'add' || composite === 'replace' || composite === null,
'Invalid composite value');
this.offset = offset;
this.c... | javascript | function(offset, composite, easing) {
ASSERT_ENABLED && assert(
typeof offset === 'number' || offset === null,
'Invalid offset value');
ASSERT_ENABLED && assert(
composite === 'add' || composite === 'replace' || composite === null,
'Invalid composite value');
this.offset = offset;
this.c... | [
"function",
"(",
"offset",
",",
"composite",
",",
"easing",
")",
"{",
"ASSERT_ENABLED",
"&&",
"assert",
"(",
"typeof",
"offset",
"===",
"'number'",
"||",
"offset",
"===",
"null",
",",
"'Invalid offset value'",
")",
";",
"ASSERT_ENABLED",
"&&",
"assert",
"(",
... | An internal representation of a keyframe. The Keyframe type from the spec is
just a dictionary and is not exposed.
@constructor | [
"An",
"internal",
"representation",
"of",
"a",
"keyframe",
".",
"The",
"Keyframe",
"type",
"from",
"the",
"spec",
"is",
"just",
"a",
"dictionary",
"and",
"is",
"not",
"exposed",
"."
] | 6e14a87fbe71124a0cbb68d1cb8626689c3b18a1 | https://github.com/christophehurpeau/springbokjs-dom/blob/6e14a87fbe71124a0cbb68d1cb8626689c3b18a1/vendor/web-animations.js#L2278-L2289 | |
51,153 | christophehurpeau/springbokjs-dom | vendor/web-animations.js | function(property, value, svgMode) {
if (value === 'inherit') {
return value;
}
return getType(property).toCssValue(value, svgMode);
} | javascript | function(property, value, svgMode) {
if (value === 'inherit') {
return value;
}
return getType(property).toCssValue(value, svgMode);
} | [
"function",
"(",
"property",
",",
"value",
",",
"svgMode",
")",
"{",
"if",
"(",
"value",
"===",
"'inherit'",
")",
"{",
"return",
"value",
";",
"}",
"return",
"getType",
"(",
"property",
")",
".",
"toCssValue",
"(",
"value",
",",
"svgMode",
")",
";",
... | Convert the provided interpolable value for the provided property to a CSS
value string. Note that SVG transforms do not require units for translate
or rotate values while CSS properties require 'px' or 'deg' units. | [
"Convert",
"the",
"provided",
"interpolable",
"value",
"for",
"the",
"provided",
"property",
"to",
"a",
"CSS",
"value",
"string",
".",
"Note",
"that",
"SVG",
"transforms",
"do",
"not",
"require",
"units",
"for",
"translate",
"or",
"rotate",
"values",
"while",
... | 6e14a87fbe71124a0cbb68d1cb8626689c3b18a1 | https://github.com/christophehurpeau/springbokjs-dom/blob/6e14a87fbe71124a0cbb68d1cb8626689c3b18a1/vendor/web-animations.js#L4715-L4720 | |
51,154 | Nazariglez/perenquen | lib/pixi/src/filters/pixelate/PixelateFilter.js | PixelateFilter | function PixelateFilter()
{
core.AbstractFilter.call(this,
// vertex shader
null,
// fragment shader
fs.readFileSync(__dirname + '/pixelate.frag', 'utf8'),
// custom uniforms
{
dimensions: { type: '4fv', value: new Float32Array([0, 0, 0, 0]) },
... | javascript | function PixelateFilter()
{
core.AbstractFilter.call(this,
// vertex shader
null,
// fragment shader
fs.readFileSync(__dirname + '/pixelate.frag', 'utf8'),
// custom uniforms
{
dimensions: { type: '4fv', value: new Float32Array([0, 0, 0, 0]) },
... | [
"function",
"PixelateFilter",
"(",
")",
"{",
"core",
".",
"AbstractFilter",
".",
"call",
"(",
"this",
",",
"// vertex shader",
"null",
",",
"// fragment shader",
"fs",
".",
"readFileSync",
"(",
"__dirname",
"+",
"'/pixelate.frag'",
",",
"'utf8'",
")",
",",
"//... | This filter applies a pixelate effect making display objects appear 'blocky'.
@class
@extends AbstractFilter
@memberof PIXI.filters | [
"This",
"filter",
"applies",
"a",
"pixelate",
"effect",
"making",
"display",
"objects",
"appear",
"blocky",
"."
] | e023964d05afeefebdcac4e2044819fdfa3899ae | https://github.com/Nazariglez/perenquen/blob/e023964d05afeefebdcac4e2044819fdfa3899ae/lib/pixi/src/filters/pixelate/PixelateFilter.js#L12-L25 |
51,155 | markuz-gj/marked-middleware | index.js | getUrl | function getUrl (url) {
var opt = {
url: url
, timeout: 10000 // 10 seconds
}
;
return new Promise(function(resolve, reject){
request(opt, function(err, res, body){
if (err) { return reject(err); }
resolve(body)
});
});
} | javascript | function getUrl (url) {
var opt = {
url: url
, timeout: 10000 // 10 seconds
}
;
return new Promise(function(resolve, reject){
request(opt, function(err, res, body){
if (err) { return reject(err); }
resolve(body)
});
});
} | [
"function",
"getUrl",
"(",
"url",
")",
"{",
"var",
"opt",
"=",
"{",
"url",
":",
"url",
",",
"timeout",
":",
"10000",
"// 10 seconds",
"}",
";",
"return",
"new",
"Promise",
"(",
"function",
"(",
"resolve",
",",
"reject",
")",
"{",
"request",
"(",
"opt... | A promise wrapper arount `request`. It timeout the request after 10 sec
@private
@param {String} url
@return {Promise} - resolve {String} with the request's body. Could be an `html` or `css`. | [
"A",
"promise",
"wrapper",
"arount",
"request",
".",
"It",
"timeout",
"the",
"request",
"after",
"10",
"sec"
] | 808d475faedef82eb958bfb8097bbcef00e0ff31 | https://github.com/markuz-gj/marked-middleware/blob/808d475faedef82eb958bfb8097bbcef00e0ff31/index.js#L49-L61 |
51,156 | markuz-gj/marked-middleware | index.js | readCss | function readCss () {
return new Promise(function(resolve, reject){
readFile(SRC, {encoding: 'utf8'}, function(err, str){
if (err) { return reject(err); }
resolve(str)
});
});
} | javascript | function readCss () {
return new Promise(function(resolve, reject){
readFile(SRC, {encoding: 'utf8'}, function(err, str){
if (err) { return reject(err); }
resolve(str)
});
});
} | [
"function",
"readCss",
"(",
")",
"{",
"return",
"new",
"Promise",
"(",
"function",
"(",
"resolve",
",",
"reject",
")",
"{",
"readFile",
"(",
"SRC",
",",
"{",
"encoding",
":",
"'utf8'",
"}",
",",
"function",
"(",
"err",
",",
"str",
")",
"{",
"if",
"... | Read local github's css
@private
@return {Promise} - resolves to a {String} with the local github's css | [
"Read",
"local",
"github",
"s",
"css"
] | 808d475faedef82eb958bfb8097bbcef00e0ff31 | https://github.com/markuz-gj/marked-middleware/blob/808d475faedef82eb958bfb8097bbcef00e0ff31/index.js#L125-L132 |
51,157 | markuz-gj/marked-middleware | index.js | getCss | function getCss () {
return checkTime().then(function(isOld){
if (isOld){
return writeCss().then(function(str){
if (!str) return readCss()
return str
})
}
return readCss()
})
} | javascript | function getCss () {
return checkTime().then(function(isOld){
if (isOld){
return writeCss().then(function(str){
if (!str) return readCss()
return str
})
}
return readCss()
})
} | [
"function",
"getCss",
"(",
")",
"{",
"return",
"checkTime",
"(",
")",
".",
"then",
"(",
"function",
"(",
"isOld",
")",
"{",
"if",
"(",
"isOld",
")",
"{",
"return",
"writeCss",
"(",
")",
".",
"then",
"(",
"function",
"(",
"str",
")",
"{",
"if",
"(... | It gets the css local or remote.
@private
@return {Promise} - it passes {String} with github's css to the next `then`. | [
"It",
"gets",
"the",
"css",
"local",
"or",
"remote",
"."
] | 808d475faedef82eb958bfb8097bbcef00e0ff31 | https://github.com/markuz-gj/marked-middleware/blob/808d475faedef82eb958bfb8097bbcef00e0ff31/index.js#L140-L151 |
51,158 | gethuman/pancakes-recipe | batch/db.archive/db.archive.batch.js | archiveResource | function archiveResource(resource, primary, archive) {
if (!resource.archive) { return true; }
var name = resource.name;
primary.bind(name);
archive.bind(name);
// get the archive criteria
var criteria = resource.archive();
log.info('Getting archive docs for '... | javascript | function archiveResource(resource, primary, archive) {
if (!resource.archive) { return true; }
var name = resource.name;
primary.bind(name);
archive.bind(name);
// get the archive criteria
var criteria = resource.archive();
log.info('Getting archive docs for '... | [
"function",
"archiveResource",
"(",
"resource",
",",
"primary",
",",
"archive",
")",
"{",
"if",
"(",
"!",
"resource",
".",
"archive",
")",
"{",
"return",
"true",
";",
"}",
"var",
"name",
"=",
"resource",
".",
"name",
";",
"primary",
".",
"bind",
"(",
... | Archive a particular resource
@param resource
@param primary
@param archive | [
"Archive",
"a",
"particular",
"resource"
] | ea3feb8839e2edaf1b4577c052b8958953db4498 | https://github.com/gethuman/pancakes-recipe/blob/ea3feb8839e2edaf1b4577c052b8958953db4498/batch/db.archive/db.archive.batch.js#L55-L96 |
51,159 | gethuman/pancakes-recipe | batch/db.archive/db.archive.batch.js | getDocsToArchive | function getDocsToArchive(criteria, primaryCollection) {
var deferred = Q.defer();
primaryCollection.find(criteria).toArray(function (err, items) {
err ? deferred.reject(err) : deferred.resolve(items);
});
return deferred.promise;
} | javascript | function getDocsToArchive(criteria, primaryCollection) {
var deferred = Q.defer();
primaryCollection.find(criteria).toArray(function (err, items) {
err ? deferred.reject(err) : deferred.resolve(items);
});
return deferred.promise;
} | [
"function",
"getDocsToArchive",
"(",
"criteria",
",",
"primaryCollection",
")",
"{",
"var",
"deferred",
"=",
"Q",
".",
"defer",
"(",
")",
";",
"primaryCollection",
".",
"find",
"(",
"criteria",
")",
".",
"toArray",
"(",
"function",
"(",
"err",
",",
"items"... | Get the documents to archive
@param criteria
@param primaryCollection | [
"Get",
"the",
"documents",
"to",
"archive"
] | ea3feb8839e2edaf1b4577c052b8958953db4498 | https://github.com/gethuman/pancakes-recipe/blob/ea3feb8839e2edaf1b4577c052b8958953db4498/batch/db.archive/db.archive.batch.js#L103-L111 |
51,160 | react-components/react-loading-status-mixin | index.js | function() {
var self = this;
var children = self._children;
var prev = self.state.childrenLoadingStatus;
var isLoading = false;
for (var k in children) {
if (children[k]) {
isLoading = true;
break;
}
}
if (prev === isLoading) return;
self.setState({children... | javascript | function() {
var self = this;
var children = self._children;
var prev = self.state.childrenLoadingStatus;
var isLoading = false;
for (var k in children) {
if (children[k]) {
isLoading = true;
break;
}
}
if (prev === isLoading) return;
self.setState({children... | [
"function",
"(",
")",
"{",
"var",
"self",
"=",
"this",
";",
"var",
"children",
"=",
"self",
".",
"_children",
";",
"var",
"prev",
"=",
"self",
".",
"state",
".",
"childrenLoadingStatus",
";",
"var",
"isLoading",
"=",
"false",
";",
"for",
"(",
"var",
... | Helper methods for updaing the child status
@api private | [
"Helper",
"methods",
"for",
"updaing",
"the",
"child",
"status"
] | 9138bd678508c4669aed69cf109bc1e7b6e61f3a | https://github.com/react-components/react-loading-status-mixin/blob/9138bd678508c4669aed69cf109bc1e7b6e61f3a/index.js#L96-L111 | |
51,161 | react-components/react-loading-status-mixin | index.js | function(isLoaded) {
var self = this;
var isLoading = !isLoaded;
var state = self.state;
var prev = state.loadingStatus;
isLoading = isLoading || false;
state.loadingStatus = isLoading;
self._notifyParentLoadingStatus(prev, !self.isLoaded());
} | javascript | function(isLoaded) {
var self = this;
var isLoading = !isLoaded;
var state = self.state;
var prev = state.loadingStatus;
isLoading = isLoading || false;
state.loadingStatus = isLoading;
self._notifyParentLoadingStatus(prev, !self.isLoaded());
} | [
"function",
"(",
"isLoaded",
")",
"{",
"var",
"self",
"=",
"this",
";",
"var",
"isLoading",
"=",
"!",
"isLoaded",
";",
"var",
"state",
"=",
"self",
".",
"state",
";",
"var",
"prev",
"=",
"state",
".",
"loadingStatus",
";",
"isLoading",
"=",
"isLoading"... | child
Set the loaded status for the component
@param {Boolean} isLoaded
@api public | [
"child",
"Set",
"the",
"loaded",
"status",
"for",
"the",
"component"
] | 9138bd678508c4669aed69cf109bc1e7b6e61f3a | https://github.com/react-components/react-loading-status-mixin/blob/9138bd678508c4669aed69cf109bc1e7b6e61f3a/index.js#L131-L141 | |
51,162 | react-components/react-loading-status-mixin | index.js | createScheduleStatusUpdate | function createScheduleStatusUpdate() {
var isChanging = false;
var shouldUpdate = false;
function update(self, fn) {
raf(function() {
if (self.isMounted()) fn();
isChanging = false;
if (shouldUpdate) update(self, fn);
shouldUpdate = false;
});
}
return function _scheduleStat... | javascript | function createScheduleStatusUpdate() {
var isChanging = false;
var shouldUpdate = false;
function update(self, fn) {
raf(function() {
if (self.isMounted()) fn();
isChanging = false;
if (shouldUpdate) update(self, fn);
shouldUpdate = false;
});
}
return function _scheduleStat... | [
"function",
"createScheduleStatusUpdate",
"(",
")",
"{",
"var",
"isChanging",
"=",
"false",
";",
"var",
"shouldUpdate",
"=",
"false",
";",
"function",
"update",
"(",
"self",
",",
"fn",
")",
"{",
"raf",
"(",
"function",
"(",
")",
"{",
"if",
"(",
"self",
... | Create a schedule status update function that is debounced | [
"Create",
"a",
"schedule",
"status",
"update",
"function",
"that",
"is",
"debounced"
] | 9138bd678508c4669aed69cf109bc1e7b6e61f3a | https://github.com/react-components/react-loading-status-mixin/blob/9138bd678508c4669aed69cf109bc1e7b6e61f3a/index.js#L170-L189 |
51,163 | shellzie/grunt-boot-server-async | tasks/boot_server_async.js | function(chunk){
if(printOutput){
if (chunk.indexOf(options.matchString) !== -1) {
child_process.stdout.removeListener('data', detachIfStarted);
printOutput = false;
done();
}
}
} | javascript | function(chunk){
if(printOutput){
if (chunk.indexOf(options.matchString) !== -1) {
child_process.stdout.removeListener('data', detachIfStarted);
printOutput = false;
done();
}
}
} | [
"function",
"(",
"chunk",
")",
"{",
"if",
"(",
"printOutput",
")",
"{",
"if",
"(",
"chunk",
".",
"indexOf",
"(",
"options",
".",
"matchString",
")",
"!==",
"-",
"1",
")",
"{",
"child_process",
".",
"stdout",
".",
"removeListener",
"(",
"'data'",
",",
... | detach the listener, which listens for changes in stdout, once matchString is output to terminal. otherwise, process will hang. | [
"detach",
"the",
"listener",
"which",
"listens",
"for",
"changes",
"in",
"stdout",
"once",
"matchString",
"is",
"output",
"to",
"terminal",
".",
"otherwise",
"process",
"will",
"hang",
"."
] | a992c7ccb0f837ee1a4e471fd66764b9cb22f132 | https://github.com/shellzie/grunt-boot-server-async/blob/a992c7ccb0f837ee1a4e471fd66764b9cb22f132/tasks/boot_server_async.js#L70-L78 | |
51,164 | andrewscwei/requiem | src/dom/getClassIndex.js | getClassIndex | function getClassIndex(element, className) {
assertType(element, Node, false, 'Invalid element specified');
assertType(className, 'string', false, `Invalid class name: ${className}`);
let classList = element.className.split(' ');
return classList.indexOf(className);
} | javascript | function getClassIndex(element, className) {
assertType(element, Node, false, 'Invalid element specified');
assertType(className, 'string', false, `Invalid class name: ${className}`);
let classList = element.className.split(' ');
return classList.indexOf(className);
} | [
"function",
"getClassIndex",
"(",
"element",
",",
"className",
")",
"{",
"assertType",
"(",
"element",
",",
"Node",
",",
"false",
",",
"'Invalid element specified'",
")",
";",
"assertType",
"(",
"className",
",",
"'string'",
",",
"false",
",",
"`",
"${",
"cl... | Gets the index of a specified class in a DOM element,
@param {Node} element - Target element.
@param {string} className - Target class name.
@return {number} Index of given class name. -1 if not found.
@alias module:requiem~dom.getClassIndex | [
"Gets",
"the",
"index",
"of",
"a",
"specified",
"class",
"in",
"a",
"DOM",
"element"
] | c4182bfffc9841c6de5718f689ad3c2060511777 | https://github.com/andrewscwei/requiem/blob/c4182bfffc9841c6de5718f689ad3c2060511777/src/dom/getClassIndex.js#L17-L22 |
51,165 | vkiding/jud-vue-render | src/render/browser/render/register.js | registerModuleEventListener | function registerModuleEventListener (name, module, meta) {
if (name !== 'globalEvent') {
module['addEventListener'] = function (evt, callbackId, options) {
return addEventListener.call(this, name, evt, callbackId, options)
}
module['removeAllEventListeners'] = function (evt) {
return removeAl... | javascript | function registerModuleEventListener (name, module, meta) {
if (name !== 'globalEvent') {
module['addEventListener'] = function (evt, callbackId, options) {
return addEventListener.call(this, name, evt, callbackId, options)
}
module['removeAllEventListeners'] = function (evt) {
return removeAl... | [
"function",
"registerModuleEventListener",
"(",
"name",
",",
"module",
",",
"meta",
")",
"{",
"if",
"(",
"name",
"!==",
"'globalEvent'",
")",
"{",
"module",
"[",
"'addEventListener'",
"]",
"=",
"function",
"(",
"evt",
",",
"callbackId",
",",
"options",
")",
... | register module event listener for every api module except 'globalEvent'. | [
"register",
"module",
"event",
"listener",
"for",
"every",
"api",
"module",
"except",
"globalEvent",
"."
] | 07d8ab08d0ef86cf2819e5f2bf1f4b06381f4d47 | https://github.com/vkiding/jud-vue-render/blob/07d8ab08d0ef86cf2819e5f2bf1f4b06381f4d47/src/render/browser/render/register.js#L10-L26 |
51,166 | pzlr/build-core | lib/validators.js | declaration | function declaration(obj) {
const
{error, value} = joi.validate(obj, declarationSchema);
if (error) {
throw new TypeError(`Invalid declaration object: ${error.message}`);
}
return value;
} | javascript | function declaration(obj) {
const
{error, value} = joi.validate(obj, declarationSchema);
if (error) {
throw new TypeError(`Invalid declaration object: ${error.message}`);
}
return value;
} | [
"function",
"declaration",
"(",
"obj",
")",
"{",
"const",
"{",
"error",
",",
"value",
"}",
"=",
"joi",
".",
"validate",
"(",
"obj",
",",
"declarationSchema",
")",
";",
"if",
"(",
"error",
")",
"{",
"throw",
"new",
"TypeError",
"(",
"`",
"${",
"error"... | Validates the specified package declaration
@template {T}
@param {T} obj
@returns {T} | [
"Validates",
"the",
"specified",
"package",
"declaration"
] | 11e20eda500682b9fa62c7804c66be1714df0df4 | https://github.com/pzlr/build-core/blob/11e20eda500682b9fa62c7804c66be1714df0df4/lib/validators.js#L70-L79 |
51,167 | redisjs/jsr-server | lib/command/server/client.js | getname | function getname(req, res) {
res.send(null, req.conn.client.name);
} | javascript | function getname(req, res) {
res.send(null, req.conn.client.name);
} | [
"function",
"getname",
"(",
"req",
",",
"res",
")",
"{",
"res",
".",
"send",
"(",
"null",
",",
"req",
".",
"conn",
".",
"client",
".",
"name",
")",
";",
"}"
] | Respond to the GETNAME subcommand. | [
"Respond",
"to",
"the",
"GETNAME",
"subcommand",
"."
] | 49413052d3039524fbdd2ade0ef9bae26cb4d647 | https://github.com/redisjs/jsr-server/blob/49413052d3039524fbdd2ade0ef9bae26cb4d647/lib/command/server/client.js#L22-L24 |
51,168 | redisjs/jsr-server | lib/command/server/client.js | setname | function setname(req, res) {
req.conn.client.name = req.args[0];
res.send(null, Constants.OK);
} | javascript | function setname(req, res) {
req.conn.client.name = req.args[0];
res.send(null, Constants.OK);
} | [
"function",
"setname",
"(",
"req",
",",
"res",
")",
"{",
"req",
".",
"conn",
".",
"client",
".",
"name",
"=",
"req",
".",
"args",
"[",
"0",
"]",
";",
"res",
".",
"send",
"(",
"null",
",",
"Constants",
".",
"OK",
")",
";",
"}"
] | Respond to the SETNAME subcommand. | [
"Respond",
"to",
"the",
"SETNAME",
"subcommand",
"."
] | 49413052d3039524fbdd2ade0ef9bae26cb4d647 | https://github.com/redisjs/jsr-server/blob/49413052d3039524fbdd2ade0ef9bae26cb4d647/lib/command/server/client.js#L29-L32 |
51,169 | redisjs/jsr-server | lib/command/server/client.js | list | function list(req, res) {
var s = '';
this.state.connections.forEach(function(conn) {
s += conn.toString();
})
res.send(null, s);
} | javascript | function list(req, res) {
var s = '';
this.state.connections.forEach(function(conn) {
s += conn.toString();
})
res.send(null, s);
} | [
"function",
"list",
"(",
"req",
",",
"res",
")",
"{",
"var",
"s",
"=",
"''",
";",
"this",
".",
"state",
".",
"connections",
".",
"forEach",
"(",
"function",
"(",
"conn",
")",
"{",
"s",
"+=",
"conn",
".",
"toString",
"(",
")",
";",
"}",
")",
"re... | Respond to the LIST subcommand. | [
"Respond",
"to",
"the",
"LIST",
"subcommand",
"."
] | 49413052d3039524fbdd2ade0ef9bae26cb4d647 | https://github.com/redisjs/jsr-server/blob/49413052d3039524fbdd2ade0ef9bae26cb4d647/lib/command/server/client.js#L37-L43 |
51,170 | redisjs/jsr-server | lib/command/server/client.js | pause | function pause(req, res) {
res.send(null, Constants.OK);
this.state.pause(req.args[0]);
} | javascript | function pause(req, res) {
res.send(null, Constants.OK);
this.state.pause(req.args[0]);
} | [
"function",
"pause",
"(",
"req",
",",
"res",
")",
"{",
"res",
".",
"send",
"(",
"null",
",",
"Constants",
".",
"OK",
")",
";",
"this",
".",
"state",
".",
"pause",
"(",
"req",
".",
"args",
"[",
"0",
"]",
")",
";",
"}"
] | Respond to the PAUSE subcommand. | [
"Respond",
"to",
"the",
"PAUSE",
"subcommand",
"."
] | 49413052d3039524fbdd2ade0ef9bae26cb4d647 | https://github.com/redisjs/jsr-server/blob/49413052d3039524fbdd2ade0ef9bae26cb4d647/lib/command/server/client.js#L48-L51 |
51,171 | redisjs/jsr-server | lib/command/server/client.js | kill | function kill(req, res) {
// TODO: implement filters
var conn;
// single ip:port
if(req.args.length === 1) {
conn = req.args[0];
// shouldn't get here, however there is a possible
// race condition whereby the target connection quits
// between validate and execute
if(!conn) return res.send... | javascript | function kill(req, res) {
// TODO: implement filters
var conn;
// single ip:port
if(req.args.length === 1) {
conn = req.args[0];
// shouldn't get here, however there is a possible
// race condition whereby the target connection quits
// between validate and execute
if(!conn) return res.send... | [
"function",
"kill",
"(",
"req",
",",
"res",
")",
"{",
"// TODO: implement filters",
"var",
"conn",
";",
"// single ip:port",
"if",
"(",
"req",
".",
"args",
".",
"length",
"===",
"1",
")",
"{",
"conn",
"=",
"req",
".",
"args",
"[",
"0",
"]",
";",
"// ... | Respond to the KILL subcommand. | [
"Respond",
"to",
"the",
"KILL",
"subcommand",
"."
] | 49413052d3039524fbdd2ade0ef9bae26cb4d647 | https://github.com/redisjs/jsr-server/blob/49413052d3039524fbdd2ade0ef9bae26cb4d647/lib/command/server/client.js#L56-L81 |
51,172 | redisjs/jsr-server | lib/command/server/client.js | validate | function validate(cmd, args, info) {
AbstractCommand.prototype.validate.apply(this, arguments);
var sub = info.command.sub
, cmd = ('' + sub.cmd)
, args = sub.args
, timeout
, conn;
if(cmd === Constants.SUBCOMMAND.client.pause.name) {
timeout = parseInt('' + args[0]);
// redis returns: 't... | javascript | function validate(cmd, args, info) {
AbstractCommand.prototype.validate.apply(this, arguments);
var sub = info.command.sub
, cmd = ('' + sub.cmd)
, args = sub.args
, timeout
, conn;
if(cmd === Constants.SUBCOMMAND.client.pause.name) {
timeout = parseInt('' + args[0]);
// redis returns: 't... | [
"function",
"validate",
"(",
"cmd",
",",
"args",
",",
"info",
")",
"{",
"AbstractCommand",
".",
"prototype",
".",
"validate",
".",
"apply",
"(",
"this",
",",
"arguments",
")",
";",
"var",
"sub",
"=",
"info",
".",
"command",
".",
"sub",
",",
"cmd",
"=... | Validate the CLIENT subcommands. | [
"Validate",
"the",
"CLIENT",
"subcommands",
"."
] | 49413052d3039524fbdd2ade0ef9bae26cb4d647 | https://github.com/redisjs/jsr-server/blob/49413052d3039524fbdd2ade0ef9bae26cb4d647/lib/command/server/client.js#L86-L118 |
51,173 | solid-live/solidbot | lib/bots/inbox.js | checkInbox | function checkInbox(uri, cert) {
console.log('checking inbox for:', uri, cert)
shell.ls([null, null, uri, cert], function(err, ret) {
if (err) {
console.error(err)
} else {
console.log(ret)
}
})
} | javascript | function checkInbox(uri, cert) {
console.log('checking inbox for:', uri, cert)
shell.ls([null, null, uri, cert], function(err, ret) {
if (err) {
console.error(err)
} else {
console.log(ret)
}
})
} | [
"function",
"checkInbox",
"(",
"uri",
",",
"cert",
")",
"{",
"console",
".",
"log",
"(",
"'checking inbox for:'",
",",
"uri",
",",
"cert",
")",
"shell",
".",
"ls",
"(",
"[",
"null",
",",
"null",
",",
"uri",
",",
"cert",
"]",
",",
"function",
"(",
"... | check a given inbox
@param {string} uri The inbox to check.
@param {string} cert Certificate location. | [
"check",
"a",
"given",
"inbox"
] | c91bfef38ab01f7f88fb6bf1b1bc4875aea0ceda | https://github.com/solid-live/solidbot/blob/c91bfef38ab01f7f88fb6bf1b1bc4875aea0ceda/lib/bots/inbox.js#L59-L69 |
51,174 | kryo2k/connect-mongoose | index.js | MongooseStore | function MongooseStore(session, mongooseModel) {
var
self = this;
if(!session || !session.Store) {
throw 'express-session was not passed in constructor.';
}
if(!mongooseModel || !mongooseModel.findById) {
throw 'Mongoose Model was not passed in constructor.';
}
var Store = session.Store;
/**... | javascript | function MongooseStore(session, mongooseModel) {
var
self = this;
if(!session || !session.Store) {
throw 'express-session was not passed in constructor.';
}
if(!mongooseModel || !mongooseModel.findById) {
throw 'Mongoose Model was not passed in constructor.';
}
var Store = session.Store;
/**... | [
"function",
"MongooseStore",
"(",
"session",
",",
"mongooseModel",
")",
"{",
"var",
"self",
"=",
"this",
";",
"if",
"(",
"!",
"session",
"||",
"!",
"session",
".",
"Store",
")",
"{",
"throw",
"'express-session was not passed in constructor.'",
";",
"}",
"if",
... | MongooseStore bootstrap constructor
@param {Express} Session Instance of express-session
@param {Model} mongooseModel Model to use for sessions
@return {Function} | [
"MongooseStore",
"bootstrap",
"constructor"
] | 74672a6bac57abe765dea423256407c4dacb8225 | https://github.com/kryo2k/connect-mongoose/blob/74672a6bac57abe765dea423256407c4dacb8225/index.js#L36-L150 |
51,175 | AckerApple/ack-host | modules/web.js | web | function web(){
this.router = routers
this.data = {}
this.data.portStruct = this.data.portStruct || {}
this.data.routers = {}
this.data.isClearRequires = this.data.isClearRequires || this.isProductionMode
this.data.consoleAll = this.data.consoleAll
this.data.consoleNonProductionErrors = true
return th... | javascript | function web(){
this.router = routers
this.data = {}
this.data.portStruct = this.data.portStruct || {}
this.data.routers = {}
this.data.isClearRequires = this.data.isClearRequires || this.isProductionMode
this.data.consoleAll = this.data.consoleAll
this.data.consoleNonProductionErrors = true
return th... | [
"function",
"web",
"(",
")",
"{",
"this",
".",
"router",
"=",
"routers",
"this",
".",
"data",
"=",
"{",
"}",
"this",
".",
"data",
".",
"portStruct",
"=",
"this",
".",
"data",
".",
"portStruct",
"||",
"{",
"}",
"this",
".",
"data",
".",
"routers",
... | request object CLASS
@scope: isClearRequires, consoleAll | [
"request",
"object",
"CLASS"
] | b8ff0563e236499a2b9add5bf1d3849b9137a520 | https://github.com/AckerApple/ack-host/blob/b8ff0563e236499a2b9add5bf1d3849b9137a520/modules/web.js#L19-L30 |
51,176 | jonschlinkert/test-helpers | index.js | helpers | function helpers (options) {
extend(helpers, Options.prototype);
var opts = extend({}, options);
helpers.option('dir', opts.dir || 'test');
helpers.option('fixtures', helpers.options.dir + '/fixtures');
helpers.option('actual', helpers.options.dir + '/actual');
helpers.config(opts);
return helpers;
} | javascript | function helpers (options) {
extend(helpers, Options.prototype);
var opts = extend({}, options);
helpers.option('dir', opts.dir || 'test');
helpers.option('fixtures', helpers.options.dir + '/fixtures');
helpers.option('actual', helpers.options.dir + '/actual');
helpers.config(opts);
return helpers;
} | [
"function",
"helpers",
"(",
"options",
")",
"{",
"extend",
"(",
"helpers",
",",
"Options",
".",
"prototype",
")",
";",
"var",
"opts",
"=",
"extend",
"(",
"{",
"}",
",",
"options",
")",
";",
"helpers",
".",
"option",
"(",
"'dir'",
",",
"opts",
".",
... | Initialize `helpers` with default `options`.
```js
var helpers = require('test-helpers')
helpers({dir: 'test'})
```
@method `helpers`
@param {Object} `options` Default options to use.
@api public | [
"Initialize",
"helpers",
"with",
"default",
"options",
"."
] | d13879220299ca7c1bb00d64ff51b5c4e87d4020 | https://github.com/jonschlinkert/test-helpers/blob/d13879220299ca7c1bb00d64ff51b5c4e87d4020/index.js#L31-L40 |
51,177 | nachos/nachos-config | lib/index.js | NachosConfig | function NachosConfig() {
var defaults = {
packages: nachosHome('packages'),
server: 'http://nachosjs.herokuapp.com',
defaults: {
shell: 'shell',
exts: {}
},
startup: []
};
debug('creating new settings file with these defaults: %j', defaults);
SettingsFile.call(this, 'nachos', ... | javascript | function NachosConfig() {
var defaults = {
packages: nachosHome('packages'),
server: 'http://nachosjs.herokuapp.com',
defaults: {
shell: 'shell',
exts: {}
},
startup: []
};
debug('creating new settings file with these defaults: %j', defaults);
SettingsFile.call(this, 'nachos', ... | [
"function",
"NachosConfig",
"(",
")",
"{",
"var",
"defaults",
"=",
"{",
"packages",
":",
"nachosHome",
"(",
"'packages'",
")",
",",
"server",
":",
"'http://nachosjs.herokuapp.com'",
",",
"defaults",
":",
"{",
"shell",
":",
"'shell'",
",",
"exts",
":",
"{",
... | Creating a settings file with nachos defaults
@constructor | [
"Creating",
"a",
"settings",
"file",
"with",
"nachos",
"defaults"
] | 310d6b2b0157e611d8a88bf55cc2a473966d8b8e | https://github.com/nachos/nachos-config/blob/310d6b2b0157e611d8a88bf55cc2a473966d8b8e/lib/index.js#L14-L30 |
51,178 | MakerCollider/node-red-contrib-smartnode-hook | html/scripts/highchart/modules/funnel.src.js | function () {
var data = this.data,
labelDistance = this.options.dataLabels.distance,
leftSide,
sign,
point,
i = data.length,
x,
y;
// In the original pie label anticollision logic, the slots are distributed
// from one labelDistance above to one labelDistance below the pie. In funnels
/... | javascript | function () {
var data = this.data,
labelDistance = this.options.dataLabels.distance,
leftSide,
sign,
point,
i = data.length,
x,
y;
// In the original pie label anticollision logic, the slots are distributed
// from one labelDistance above to one labelDistance below the pie. In funnels
/... | [
"function",
"(",
")",
"{",
"var",
"data",
"=",
"this",
".",
"data",
",",
"labelDistance",
"=",
"this",
".",
"options",
".",
"dataLabels",
".",
"distance",
",",
"leftSide",
",",
"sign",
",",
"point",
",",
"i",
"=",
"data",
".",
"length",
",",
"x",
"... | Extend the pie data label method | [
"Extend",
"the",
"pie",
"data",
"label",
"method"
] | 245c267e832968bad880ca009929043e82c7bc25 | https://github.com/MakerCollider/node-red-contrib-smartnode-hook/blob/245c267e832968bad880ca009929043e82c7bc25/html/scripts/highchart/modules/funnel.src.js#L256-L293 | |
51,179 | gethuman/jyt | lib/jyt.plugins.js | addPluginsToScope | function addPluginsToScope(scope) {
var name;
for (name in plugins) {
if (plugins.hasOwnProperty(name)) {
scope[name] = plugins[name];
}
}
} | javascript | function addPluginsToScope(scope) {
var name;
for (name in plugins) {
if (plugins.hasOwnProperty(name)) {
scope[name] = plugins[name];
}
}
} | [
"function",
"addPluginsToScope",
"(",
"scope",
")",
"{",
"var",
"name",
";",
"for",
"(",
"name",
"in",
"plugins",
")",
"{",
"if",
"(",
"plugins",
".",
"hasOwnProperty",
"(",
"name",
")",
")",
"{",
"scope",
"[",
"name",
"]",
"=",
"plugins",
"[",
"name... | Add all existing plugins to the input scope
@param scope | [
"Add",
"all",
"existing",
"plugins",
"to",
"the",
"input",
"scope"
] | 716be37e09217b4be917e179389f752212a428b3 | https://github.com/gethuman/jyt/blob/716be37e09217b4be917e179389f752212a428b3/lib/jyt.plugins.js#L16-L23 |
51,180 | gethuman/jyt | lib/jyt.plugins.js | registerPlugin | function registerPlugin(name, obj) {
if (name && name.length && obj) {
plugins[name] = obj;
}
} | javascript | function registerPlugin(name, obj) {
if (name && name.length && obj) {
plugins[name] = obj;
}
} | [
"function",
"registerPlugin",
"(",
"name",
",",
"obj",
")",
"{",
"if",
"(",
"name",
"&&",
"name",
".",
"length",
"&&",
"obj",
")",
"{",
"plugins",
"[",
"name",
"]",
"=",
"obj",
";",
"}",
"}"
] | Register a new plugin
@param name
@param obj | [
"Register",
"a",
"new",
"plugin"
] | 716be37e09217b4be917e179389f752212a428b3 | https://github.com/gethuman/jyt/blob/716be37e09217b4be917e179389f752212a428b3/lib/jyt.plugins.js#L30-L34 |
51,181 | gethuman/jyt | lib/jyt.plugins.js | init | function init() {
// ex. jif(true, div('blah'))
registerPlugin('jif', function jif(condition, elem) {
if (utils.isArray(elem)) {
elem = runtime.naked(elem, null);
}
return condition ? elem : null;
});
// ex. jeach({}, function (item) {})
registerPlugin('jeach',... | javascript | function init() {
// ex. jif(true, div('blah'))
registerPlugin('jif', function jif(condition, elem) {
if (utils.isArray(elem)) {
elem = runtime.naked(elem, null);
}
return condition ? elem : null;
});
// ex. jeach({}, function (item) {})
registerPlugin('jeach',... | [
"function",
"init",
"(",
")",
"{",
"// ex. jif(true, div('blah'))",
"registerPlugin",
"(",
"'jif'",
",",
"function",
"jif",
"(",
"condition",
",",
"elem",
")",
"{",
"if",
"(",
"utils",
".",
"isArray",
"(",
"elem",
")",
")",
"{",
"elem",
"=",
"runtime",
"... | Register common plugins | [
"Register",
"common",
"plugins"
] | 716be37e09217b4be917e179389f752212a428b3 | https://github.com/gethuman/jyt/blob/716be37e09217b4be917e179389f752212a428b3/lib/jyt.plugins.js#L39-L61 |
51,182 | sendanor/nor-nopg | src/InternalCursor.js | InternalCursor | function InternalCursor(parent, key) {
debug.assert(parent).is('object');
debug.assert(key).is('defined');
this.cursors = [{'parent':parent, 'key':key}];
} | javascript | function InternalCursor(parent, key) {
debug.assert(parent).is('object');
debug.assert(key).is('defined');
this.cursors = [{'parent':parent, 'key':key}];
} | [
"function",
"InternalCursor",
"(",
"parent",
",",
"key",
")",
"{",
"debug",
".",
"assert",
"(",
"parent",
")",
".",
"is",
"(",
"'object'",
")",
";",
"debug",
".",
"assert",
"(",
"key",
")",
".",
"is",
"(",
"'defined'",
")",
";",
"this",
".",
"curso... | Internal cursor object | [
"Internal",
"cursor",
"object"
] | 0d99b86c1a1996b5828b56de8de23700df8bbc0c | https://github.com/sendanor/nor-nopg/blob/0d99b86c1a1996b5828b56de8de23700df8bbc0c/src/InternalCursor.js#L8-L12 |
51,183 | defeo/was_framework | lib/db.js | connect_cb | function connect_cb(err, db) {
if (err) {
next(err);
} else {
if (db && db instanceof sqlite) { // Sqlite only
app.db = db;
// Use the query escaping facilities of mysql
app.db.escape = SqliteString.escape;
app.db.escapeId = SqliteString.escapeId;
app.db.format = SqliteString.format;
// Wrap... | javascript | function connect_cb(err, db) {
if (err) {
next(err);
} else {
if (db && db instanceof sqlite) { // Sqlite only
app.db = db;
// Use the query escaping facilities of mysql
app.db.escape = SqliteString.escape;
app.db.escapeId = SqliteString.escapeId;
app.db.format = SqliteString.format;
// Wrap... | [
"function",
"connect_cb",
"(",
"err",
",",
"db",
")",
"{",
"if",
"(",
"err",
")",
"{",
"next",
"(",
"err",
")",
";",
"}",
"else",
"{",
"if",
"(",
"db",
"&&",
"db",
"instanceof",
"sqlite",
")",
"{",
"// Sqlite only",
"app",
".",
"db",
"=",
"db",
... | This function is executed after the connection to the database has been established | [
"This",
"function",
"is",
"executed",
"after",
"the",
"connection",
"to",
"the",
"database",
"has",
"been",
"established"
] | ab52bbbf5943e9062fe6ea82f1fea637a11d727a | https://github.com/defeo/was_framework/blob/ab52bbbf5943e9062fe6ea82f1fea637a11d727a/lib/db.js#L28-L70 |
51,184 | xiamidaxia/xiami | meteor/accounts-password/password_server.js | function (user) {
if (user.id)
return {_id: user.id};
else if (user.username)
return {username: user.username};
else if (user.email)
return {"emails.address": user.email};
throw new Error("shouldn't happen (validation missed something)");
} | javascript | function (user) {
if (user.id)
return {_id: user.id};
else if (user.username)
return {username: user.username};
else if (user.email)
return {"emails.address": user.email};
throw new Error("shouldn't happen (validation missed something)");
} | [
"function",
"(",
"user",
")",
"{",
"if",
"(",
"user",
".",
"id",
")",
"return",
"{",
"_id",
":",
"user",
".",
"id",
"}",
";",
"else",
"if",
"(",
"user",
".",
"username",
")",
"return",
"{",
"username",
":",
"user",
".",
"username",
"}",
";",
"e... | Users can specify various keys to identify themselves with. @param user {Object} with one of `id`, `username`, or `email`. @returns A selector to pass to mongo to get the user record. | [
"Users",
"can",
"specify",
"various",
"keys",
"to",
"identify",
"themselves",
"with",
"."
] | 6fcee92c493c12bf8fd67c7068e67fa6a72a306b | https://github.com/xiamidaxia/xiami/blob/6fcee92c493c12bf8fd67c7068e67fa6a72a306b/meteor/accounts-password/password_server.js#L18-L26 | |
51,185 | xiamidaxia/xiami | meteor/accounts-password/password_server.js | function (options) {
// Unknown keys allowed, because a onCreateUserHook can take arbitrary
// options.
check(options, Match.ObjectIncluding({
username: Match.Optional(String),
email: Match.Optional(String),
password: Match.Optional(String),
srp: Match.Optional(SRP.matchVerifier)
}));
var use... | javascript | function (options) {
// Unknown keys allowed, because a onCreateUserHook can take arbitrary
// options.
check(options, Match.ObjectIncluding({
username: Match.Optional(String),
email: Match.Optional(String),
password: Match.Optional(String),
srp: Match.Optional(SRP.matchVerifier)
}));
var use... | [
"function",
"(",
"options",
")",
"{",
"// Unknown keys allowed, because a onCreateUserHook can take arbitrary",
"// options.",
"check",
"(",
"options",
",",
"Match",
".",
"ObjectIncluding",
"(",
"{",
"username",
":",
"Match",
".",
"Optional",
"(",
"String",
")",
",",
... | Shared createUser function called from the createUser method, both if originates in client or server code. Calls user provided hooks, does the actual user insertion. returns the user id | [
"Shared",
"createUser",
"function",
"called",
"from",
"the",
"createUser",
"method",
"both",
"if",
"originates",
"in",
"client",
"or",
"server",
"code",
".",
"Calls",
"user",
"provided",
"hooks",
"does",
"the",
"actual",
"user",
"insertion",
".",
"returns",
"t... | 6fcee92c493c12bf8fd67c7068e67fa6a72a306b | https://github.com/xiamidaxia/xiami/blob/6fcee92c493c12bf8fd67c7068e67fa6a72a306b/meteor/accounts-password/password_server.js#L534-L567 | |
51,186 | Coffeekraken/s-validator-component | dist/js/SValidatorComponent.js | setMessages | function setMessages() {
var messages = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
__messages = _extends({}, __messages, messages);
} | javascript | function setMessages() {
var messages = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
__messages = _extends({}, __messages, messages);
} | [
"function",
"setMessages",
"(",
")",
"{",
"var",
"messages",
"=",
"arguments",
".",
"length",
">",
"0",
"&&",
"arguments",
"[",
"0",
"]",
"!==",
"undefined",
"?",
"arguments",
"[",
"0",
"]",
":",
"{",
"}",
";",
"__messages",
"=",
"_extends",
"(",
"{"... | Set the messages
@param {Object} messages An object of messages to override | [
"Set",
"the",
"messages"
] | 84519fc1bb013ccd0a4683dbcf88f2c3e08a5f9c | https://github.com/Coffeekraken/s-validator-component/blob/84519fc1bb013ccd0a4683dbcf88f2c3e08a5f9c/dist/js/SValidatorComponent.js#L779-L783 |
51,187 | artdecocode/which-stream | build/index.js | whichStream | async function whichStream(config) {
const {
source,
destination,
} = config
let { readable, writable } = config
if (!(source || readable))
throw new Error('Please give either a source or readable.')
if (!(destination || writable))
throw new Error('Please give either a destination or writable... | javascript | async function whichStream(config) {
const {
source,
destination,
} = config
let { readable, writable } = config
if (!(source || readable))
throw new Error('Please give either a source or readable.')
if (!(destination || writable))
throw new Error('Please give either a destination or writable... | [
"async",
"function",
"whichStream",
"(",
"config",
")",
"{",
"const",
"{",
"source",
",",
"destination",
",",
"}",
"=",
"config",
"let",
"{",
"readable",
",",
"writable",
"}",
"=",
"config",
"if",
"(",
"!",
"(",
"source",
"||",
"readable",
")",
")",
... | Handles the flow of streams, and awaits for them to complete. The input can be specified either as a string with the `source` property, or as as stream with the `readable`. The output can also be given either as a string with the `destination`, or as a stream with the `writable`. If destination is passed as the `-`, th... | [
"Handles",
"the",
"flow",
"of",
"streams",
"and",
"awaits",
"for",
"them",
"to",
"complete",
".",
"The",
"input",
"can",
"be",
"specified",
"either",
"as",
"a",
"string",
"with",
"the",
"source",
"property",
"or",
"as",
"as",
"stream",
"with",
"the",
"re... | f019bbc83af3e272f4985f23a22c6dd1f2f2a54f | https://github.com/artdecocode/which-stream/blob/f019bbc83af3e272f4985f23a22c6dd1f2f2a54f/build/index.js#L16-L41 |
51,188 | 131/phar-stream | index.js | search | function search(stream, needle) {
var ss = new streamsearch(needle),
push = ss.push.bind(ss);
ss.maxMatches = 1;
var defered = defer();
stream.on("data", push);
stream.once("finish", function(){
defered.reject("No stub found in stream")
});
var pos = 0;
ss.on("info", function(isMatch, dat... | javascript | function search(stream, needle) {
var ss = new streamsearch(needle),
push = ss.push.bind(ss);
ss.maxMatches = 1;
var defered = defer();
stream.on("data", push);
stream.once("finish", function(){
defered.reject("No stub found in stream")
});
var pos = 0;
ss.on("info", function(isMatch, dat... | [
"function",
"search",
"(",
"stream",
",",
"needle",
")",
"{",
"var",
"ss",
"=",
"new",
"streamsearch",
"(",
"needle",
")",
",",
"push",
"=",
"ss",
".",
"push",
".",
"bind",
"(",
"ss",
")",
";",
"ss",
".",
"maxMatches",
"=",
"1",
";",
"var",
"defe... | search for a stub in a stream, return a promise | [
"search",
"for",
"a",
"stub",
"in",
"a",
"stream",
"return",
"a",
"promise"
] | 0a63b5d0adf3d04315bbd15d60d0cf24cfee68c2 | https://github.com/131/phar-stream/blob/0a63b5d0adf3d04315bbd15d60d0cf24cfee68c2/index.js#L20-L46 |
51,189 | marinvvasilev/appcelerator-githubauth | index.js | Plugin | function Plugin(server) {
this.server = server;
this.config = server.config;
//Check if we have the right config
this.checkConfiguration();
this.settings = this.config.githubAuth;
//Init if not present
if (typeof this.server.passport === "undefined")
this.initGithubAuth();
else
... | javascript | function Plugin(server) {
this.server = server;
this.config = server.config;
//Check if we have the right config
this.checkConfiguration();
this.settings = this.config.githubAuth;
//Init if not present
if (typeof this.server.passport === "undefined")
this.initGithubAuth();
else
... | [
"function",
"Plugin",
"(",
"server",
")",
"{",
"this",
".",
"server",
"=",
"server",
";",
"this",
".",
"config",
"=",
"server",
".",
"config",
";",
"//Check if we have the right config",
"this",
".",
"checkConfiguration",
"(",
")",
";",
"this",
".",
"setting... | Plugin initialization logic
@param Object server
@param Object testConfig - optional - configuration settings for testing purposes | [
"Plugin",
"initialization",
"logic"
] | 07bb77a1bc5720dc584b57b3de782cfc6fd5a06e | https://github.com/marinvvasilev/appcelerator-githubauth/blob/07bb77a1bc5720dc584b57b3de782cfc6fd5a06e/index.js#L9-L20 |
51,190 | nfroidure/common-services | src/lock.js | take | async function take(key) {
const previousLocks = LOCKS_MAP.get(key) || [];
let locksLength = previousLocks.length;
log('debug', `Taking the lock on ${key} (queue length was ${locksLength})`);
let release;
const newLock = {
releasePromise: new Promise(async (resolve, reject) => {
rel... | javascript | async function take(key) {
const previousLocks = LOCKS_MAP.get(key) || [];
let locksLength = previousLocks.length;
log('debug', `Taking the lock on ${key} (queue length was ${locksLength})`);
let release;
const newLock = {
releasePromise: new Promise(async (resolve, reject) => {
rel... | [
"async",
"function",
"take",
"(",
"key",
")",
"{",
"const",
"previousLocks",
"=",
"LOCKS_MAP",
".",
"get",
"(",
"key",
")",
"||",
"[",
"]",
";",
"let",
"locksLength",
"=",
"previousLocks",
".",
"length",
";",
"log",
"(",
"'debug'",
",",
"`",
"${",
"k... | Take the lock on the given resource key
@param {String} key
A unique key for the locked resource
@return {Promise}
A promise to be resolved when the lock
is gained or rejected if the lock release
timeout is reached. | [
"Take",
"the",
"lock",
"on",
"the",
"given",
"resource",
"key"
] | 09df32597fe798777abec0ef1f3a994e91046085 | https://github.com/nfroidure/common-services/blob/09df32597fe798777abec0ef1f3a994e91046085/src/lock.js#L86-L115 |
51,191 | nfroidure/common-services | src/lock.js | release | async function release(key) {
const previousLocks = LOCKS_MAP.get(key) || [];
const locksLength = previousLocks.length;
log(
'debug',
`Releasing the lock on ${key} (queue length was ${locksLength})`,
);
previousLocks.pop().release();
} | javascript | async function release(key) {
const previousLocks = LOCKS_MAP.get(key) || [];
const locksLength = previousLocks.length;
log(
'debug',
`Releasing the lock on ${key} (queue length was ${locksLength})`,
);
previousLocks.pop().release();
} | [
"async",
"function",
"release",
"(",
"key",
")",
"{",
"const",
"previousLocks",
"=",
"LOCKS_MAP",
".",
"get",
"(",
"key",
")",
"||",
"[",
"]",
";",
"const",
"locksLength",
"=",
"previousLocks",
".",
"length",
";",
"log",
"(",
"'debug'",
",",
"`",
"${",... | Release the lock on the given resource key
@param {String} key A unique key for the resource to release
@return {void} | [
"Release",
"the",
"lock",
"on",
"the",
"given",
"resource",
"key"
] | 09df32597fe798777abec0ef1f3a994e91046085 | https://github.com/nfroidure/common-services/blob/09df32597fe798777abec0ef1f3a994e91046085/src/lock.js#L122-L131 |
51,192 | nearform/docker-container | lib/registry.js | service | function service(root, cb) {
var registryPath = config.registryPath || path.join(root, 'registry');
fs.mkdir(registryPath, function(err) {
if (err && err.code !== 'EEXIST') {
logger.error(err);
return cb(err);
}
// swallow errors, it may exists
var server = registry({
... | javascript | function service(root, cb) {
var registryPath = config.registryPath || path.join(root, 'registry');
fs.mkdir(registryPath, function(err) {
if (err && err.code !== 'EEXIST') {
logger.error(err);
return cb(err);
}
// swallow errors, it may exists
var server = registry({
... | [
"function",
"service",
"(",
"root",
",",
"cb",
")",
"{",
"var",
"registryPath",
"=",
"config",
".",
"registryPath",
"||",
"path",
".",
"join",
"(",
"root",
",",
"'registry'",
")",
";",
"fs",
".",
"mkdir",
"(",
"registryPath",
",",
"function",
"(",
"err... | Starts the registry | [
"Starts",
"the",
"registry"
] | 724ff6a9d8d3c116f9a6b8239594c4b5cd5e8e17 | https://github.com/nearform/docker-container/blob/724ff6a9d8d3c116f9a6b8239594c4b5cd5e8e17/lib/registry.js#L95-L129 |
51,193 | happen-zhang/cakes | lib/cakes.js | Class | function Class(prop, superClass) {
var ClassType = function() {
function F(args) {
for (var name in ClassType.__prop) {
var val = ClassType.__prop[name];
this[name] = isObject(val) ? extend({}, val) : val;
}
if ... | javascript | function Class(prop, superClass) {
var ClassType = function() {
function F(args) {
for (var name in ClassType.__prop) {
var val = ClassType.__prop[name];
this[name] = isObject(val) ? extend({}, val) : val;
}
if ... | [
"function",
"Class",
"(",
"prop",
",",
"superClass",
")",
"{",
"var",
"ClassType",
"=",
"function",
"(",
")",
"{",
"function",
"F",
"(",
"args",
")",
"{",
"for",
"(",
"var",
"name",
"in",
"ClassType",
".",
"__prop",
")",
"{",
"var",
"val",
"=",
"Cl... | Create a class construct function.
@param {Function} prop Custom properties of class
@param {Function} superClass Super class
@return {Function} New class construct function | [
"Create",
"a",
"class",
"construct",
"function",
"."
] | a88a1d8d99b9ba6ec858d982c58c541d9483104f | https://github.com/happen-zhang/cakes/blob/a88a1d8d99b9ba6ec858d982c58c541d9483104f/lib/cakes.js#L38-L128 |
51,194 | sleeplessinc/jsond | index.js | accept | function accept(req, res, cb) {
var u = url.parse(req.url, true),
path = u.pathname
if(/^\/api\/?$/.test(path)) {
messageInit({cb:(cb || nop), req:req, res:res, path:path, query:u.query, u:u})
return;
}
if(req.method == "OPTIONS") {
res.writeHead(200, {
"Access-Control-Allow-Origin": "*", // to support... | javascript | function accept(req, res, cb) {
var u = url.parse(req.url, true),
path = u.pathname
if(/^\/api\/?$/.test(path)) {
messageInit({cb:(cb || nop), req:req, res:res, path:path, query:u.query, u:u})
return;
}
if(req.method == "OPTIONS") {
res.writeHead(200, {
"Access-Control-Allow-Origin": "*", // to support... | [
"function",
"accept",
"(",
"req",
",",
"res",
",",
"cb",
")",
"{",
"var",
"u",
"=",
"url",
".",
"parse",
"(",
"req",
".",
"url",
",",
"true",
")",
",",
"path",
"=",
"u",
".",
"pathname",
"if",
"(",
"/",
"^\\/api\\/?$",
"/",
".",
"test",
"(",
... | Every request starts here | [
"Every",
"request",
"starts",
"here"
] | 0f65a925d604edd5be74dc75aba19a3c1448307b | https://github.com/sleeplessinc/jsond/blob/0f65a925d604edd5be74dc75aba19a3c1448307b/index.js#L143-L162 |
51,195 | xiamidaxia/xiami | meteor/binary-heap/max-heap.js | function (data) {
var self = this;
self._heap = _.map(data, function (o) {
return { id: o.id, value: o.value };
});
_.each(data, function (o, i) {
self._heapIdx.set(o.id, i);
});
if (! data.length)
return;
// start from the first non-leaf - the parent of the last leaf
... | javascript | function (data) {
var self = this;
self._heap = _.map(data, function (o) {
return { id: o.id, value: o.value };
});
_.each(data, function (o, i) {
self._heapIdx.set(o.id, i);
});
if (! data.length)
return;
// start from the first non-leaf - the parent of the last leaf
... | [
"function",
"(",
"data",
")",
"{",
"var",
"self",
"=",
"this",
";",
"self",
".",
"_heap",
"=",
"_",
".",
"map",
"(",
"data",
",",
"function",
"(",
"o",
")",
"{",
"return",
"{",
"id",
":",
"o",
".",
"id",
",",
"value",
":",
"o",
".",
"value",
... | Builds a new heap in-place in linear time based on passed data | [
"Builds",
"a",
"new",
"heap",
"in",
"-",
"place",
"in",
"linear",
"time",
"based",
"on",
"passed",
"data"
] | 6fcee92c493c12bf8fd67c7068e67fa6a72a306b | https://github.com/xiamidaxia/xiami/blob/6fcee92c493c12bf8fd67c7068e67fa6a72a306b/meteor/binary-heap/max-heap.js#L44-L61 | |
51,196 | xiamidaxia/xiami | meteor/binary-heap/max-heap.js | function (iterator) {
var self = this;
_.each(self._heap, function (obj) {
return iterator(obj.value, obj.id);
});
} | javascript | function (iterator) {
var self = this;
_.each(self._heap, function (obj) {
return iterator(obj.value, obj.id);
});
} | [
"function",
"(",
"iterator",
")",
"{",
"var",
"self",
"=",
"this",
";",
"_",
".",
"each",
"(",
"self",
".",
"_heap",
",",
"function",
"(",
"obj",
")",
"{",
"return",
"iterator",
"(",
"obj",
".",
"value",
",",
"obj",
".",
"id",
")",
";",
"}",
")... | iterate over values in no particular order | [
"iterate",
"over",
"values",
"in",
"no",
"particular",
"order"
] | 6fcee92c493c12bf8fd67c7068e67fa6a72a306b | https://github.com/xiamidaxia/xiami/blob/6fcee92c493c12bf8fd67c7068e67fa6a72a306b/meteor/binary-heap/max-heap.js#L187-L192 | |
51,197 | feedhenry/fh-mbaas-middleware | lib/alerts/alerts.js | matchAndIssueAlertEmails | function matchAndIssueAlertEmails(eventDetails, alerts){
underscore.each(alerts, function(alert) {
if (shouldTriggerAlert(eventDetails, alert)){
issueAlertEmail(eventDetails, alert);
}
});
} | javascript | function matchAndIssueAlertEmails(eventDetails, alerts){
underscore.each(alerts, function(alert) {
if (shouldTriggerAlert(eventDetails, alert)){
issueAlertEmail(eventDetails, alert);
}
});
} | [
"function",
"matchAndIssueAlertEmails",
"(",
"eventDetails",
",",
"alerts",
")",
"{",
"underscore",
".",
"each",
"(",
"alerts",
",",
"function",
"(",
"alert",
")",
"{",
"if",
"(",
"shouldTriggerAlert",
"(",
"eventDetails",
",",
"alert",
")",
")",
"{",
"issue... | Iterate user defined alerts to incoming event message and send emails when appropriate
@param alerts | [
"Iterate",
"user",
"defined",
"alerts",
"to",
"incoming",
"event",
"message",
"and",
"send",
"emails",
"when",
"appropriate"
] | f906e98efbb4b0963bf5137b34b5e0589ba24e69 | https://github.com/feedhenry/fh-mbaas-middleware/blob/f906e98efbb4b0963bf5137b34b5e0589ba24e69/lib/alerts/alerts.js#L13-L19 |
51,198 | feedhenry/fh-mbaas-middleware | lib/alerts/alerts.js | shouldTriggerAlert | function shouldTriggerAlert(eventDetails, alert){
if (alert.alertEnabled){
// Event Message Criteria
var msgEventName = eventDetails.eventType;
var msgEventCategory = eventDetails.eventClass;
var msgEventSeverity = eventDetails.eventLevel;
// Saved Alert Criteria
var alertEventNames = ale... | javascript | function shouldTriggerAlert(eventDetails, alert){
if (alert.alertEnabled){
// Event Message Criteria
var msgEventName = eventDetails.eventType;
var msgEventCategory = eventDetails.eventClass;
var msgEventSeverity = eventDetails.eventLevel;
// Saved Alert Criteria
var alertEventNames = ale... | [
"function",
"shouldTriggerAlert",
"(",
"eventDetails",
",",
"alert",
")",
"{",
"if",
"(",
"alert",
".",
"alertEnabled",
")",
"{",
"// Event Message Criteria",
"var",
"msgEventName",
"=",
"eventDetails",
".",
"eventType",
";",
"var",
"msgEventCategory",
"=",
"event... | Test the Alert and see if we should send an email or not
@param alert | [
"Test",
"the",
"Alert",
"and",
"see",
"if",
"we",
"should",
"send",
"an",
"email",
"or",
"not"
] | f906e98efbb4b0963bf5137b34b5e0589ba24e69 | https://github.com/feedhenry/fh-mbaas-middleware/blob/f906e98efbb4b0963bf5137b34b5e0589ba24e69/lib/alerts/alerts.js#L25-L55 |
51,199 | feedhenry/fh-mbaas-middleware | lib/alerts/alerts.js | handler | function handler (eventDetails){
var Alert = models.getModels().Alert;
logger.logger.trace(loggerPrefix +'Processing Alerts for Event: ', eventDetails);
Alert.queryAlerts(eventDetails.uid, eventDetails.env, eventDetails.domain, function(err, alerts){
if(err) {
logger.logger.warn({ error:err }, loggerPr... | javascript | function handler (eventDetails){
var Alert = models.getModels().Alert;
logger.logger.trace(loggerPrefix +'Processing Alerts for Event: ', eventDetails);
Alert.queryAlerts(eventDetails.uid, eventDetails.env, eventDetails.domain, function(err, alerts){
if(err) {
logger.logger.warn({ error:err }, loggerPr... | [
"function",
"handler",
"(",
"eventDetails",
")",
"{",
"var",
"Alert",
"=",
"models",
".",
"getModels",
"(",
")",
".",
"Alert",
";",
"logger",
".",
"logger",
".",
"trace",
"(",
"loggerPrefix",
"+",
"'Processing Alerts for Event: '",
",",
"eventDetails",
")",
... | Handle an EVENT. We will take the EVENT details,
match the Alerts in Mongo that have been setup and
if a match is found, then send the email from the MBaaS
@param msg
@param headers
@param info
@param cb | [
"Handle",
"an",
"EVENT",
".",
"We",
"will",
"take",
"the",
"EVENT",
"details",
"match",
"the",
"Alerts",
"in",
"Mongo",
"that",
"have",
"been",
"setup",
"and",
"if",
"a",
"match",
"is",
"found",
"then",
"send",
"the",
"email",
"from",
"the",
"MBaaS"
] | f906e98efbb4b0963bf5137b34b5e0589ba24e69 | https://github.com/feedhenry/fh-mbaas-middleware/blob/f906e98efbb4b0963bf5137b34b5e0589ba24e69/lib/alerts/alerts.js#L103-L119 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.