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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
9,100 | jagenjo/litegraph.js | build/litegraph.js | function(type, base_class) {
if (!base_class.prototype) {
throw "Cannot register a simple object, it must be a class with a prototype";
}
base_class.type = type;
if (LiteGraph.debug) {
console.log("Node registered: " + type);
}... | javascript | function(type, base_class) {
if (!base_class.prototype) {
throw "Cannot register a simple object, it must be a class with a prototype";
}
base_class.type = type;
if (LiteGraph.debug) {
console.log("Node registered: " + type);
}... | [
"function",
"(",
"type",
",",
"base_class",
")",
"{",
"if",
"(",
"!",
"base_class",
".",
"prototype",
")",
"{",
"throw",
"\"Cannot register a simple object, it must be a class with a prototype\"",
";",
"}",
"base_class",
".",
"type",
"=",
"type",
";",
"if",
"(",
... | used to add extra features to the search box
Register a node class so it can be listed when the user wants to create a new one
@method registerNodeType
@param {String} type name of the node and path
@param {Class} base_class class containing the structure of a node | [
"used",
"to",
"add",
"extra",
"features",
"to",
"the",
"search",
"box",
"Register",
"a",
"node",
"class",
"so",
"it",
"can",
"be",
"listed",
"when",
"the",
"user",
"wants",
"to",
"create",
"a",
"new",
"one"
] | b6ca97f2b1f6c3ec0be919070850a2f0df81f0b2 | https://github.com/jagenjo/litegraph.js/blob/b6ca97f2b1f6c3ec0be919070850a2f0df81f0b2/build/litegraph.js#L101-L188 | |
9,101 | jagenjo/litegraph.js | build/litegraph.js | function(
name,
func,
param_types,
return_type,
properties
) {
var params = Array(func.length);
var code = "";
var names = LiteGraph.getParameterNames(func);
for (var i = 0; i < names.length; ++i) {
... | javascript | function(
name,
func,
param_types,
return_type,
properties
) {
var params = Array(func.length);
var code = "";
var names = LiteGraph.getParameterNames(func);
for (var i = 0; i < names.length; ++i) {
... | [
"function",
"(",
"name",
",",
"func",
",",
"param_types",
",",
"return_type",
",",
"properties",
")",
"{",
"var",
"params",
"=",
"Array",
"(",
"func",
".",
"length",
")",
";",
"var",
"code",
"=",
"\"\"",
";",
"var",
"names",
"=",
"LiteGraph",
".",
"g... | Create a new nodetype by passing a function, it wraps it with a proper class and generates inputs according to the parameters of the function.
Useful to wrap simple methods that do not require properties, and that only process some input to generate an output.
@method wrapFunctionAsNode
@param {String} name node name w... | [
"Create",
"a",
"new",
"nodetype",
"by",
"passing",
"a",
"function",
"it",
"wraps",
"it",
"with",
"a",
"proper",
"class",
"and",
"generates",
"inputs",
"according",
"to",
"the",
"parameters",
"of",
"the",
"function",
".",
"Useful",
"to",
"wrap",
"simple",
"... | b6ca97f2b1f6c3ec0be919070850a2f0df81f0b2 | https://github.com/jagenjo/litegraph.js/blob/b6ca97f2b1f6c3ec0be919070850a2f0df81f0b2/build/litegraph.js#L200-L239 | |
9,102 | jagenjo/litegraph.js | build/litegraph.js | function(type, title, options) {
var base_class = this.registered_node_types[type];
if (!base_class) {
if (LiteGraph.debug) {
console.log(
'GraphNode type "' + type + '" not registered.'
);
}
... | javascript | function(type, title, options) {
var base_class = this.registered_node_types[type];
if (!base_class) {
if (LiteGraph.debug) {
console.log(
'GraphNode type "' + type + '" not registered.'
);
}
... | [
"function",
"(",
"type",
",",
"title",
",",
"options",
")",
"{",
"var",
"base_class",
"=",
"this",
".",
"registered_node_types",
"[",
"type",
"]",
";",
"if",
"(",
"!",
"base_class",
")",
"{",
"if",
"(",
"LiteGraph",
".",
"debug",
")",
"{",
"console",
... | Create a node of a given type with a name. The node is not attached to any graph yet.
@method createNode
@param {String} type full name of the node class. p.e. "math/sin"
@param {String} name a name to distinguish from other nodes
@param {Object} options to set options | [
"Create",
"a",
"node",
"of",
"a",
"given",
"type",
"with",
"a",
"name",
".",
"The",
"node",
"is",
"not",
"attached",
"to",
"any",
"graph",
"yet",
"."
] | b6ca97f2b1f6c3ec0be919070850a2f0df81f0b2 | https://github.com/jagenjo/litegraph.js/blob/b6ca97f2b1f6c3ec0be919070850a2f0df81f0b2/build/litegraph.js#L266-L326 | |
9,103 | jagenjo/litegraph.js | build/litegraph.js | function(category, filter) {
var r = [];
for (var i in this.registered_node_types) {
var type = this.registered_node_types[i];
if (filter && type.filter && type.filter != filter) {
continue;
}
if (category == ""... | javascript | function(category, filter) {
var r = [];
for (var i in this.registered_node_types) {
var type = this.registered_node_types[i];
if (filter && type.filter && type.filter != filter) {
continue;
}
if (category == ""... | [
"function",
"(",
"category",
",",
"filter",
")",
"{",
"var",
"r",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"i",
"in",
"this",
".",
"registered_node_types",
")",
"{",
"var",
"type",
"=",
"this",
".",
"registered_node_types",
"[",
"i",
"]",
";",
"if",
... | Returns a list of node types matching one category
@method getNodeType
@param {String} category category name
@return {Array} array with all the node classes | [
"Returns",
"a",
"list",
"of",
"node",
"types",
"matching",
"one",
"category"
] | b6ca97f2b1f6c3ec0be919070850a2f0df81f0b2 | https://github.com/jagenjo/litegraph.js/blob/b6ca97f2b1f6c3ec0be919070850a2f0df81f0b2/build/litegraph.js#L345-L363 | |
9,104 | jagenjo/litegraph.js | build/litegraph.js | function() {
var categories = { "": 1 };
for (var i in this.registered_node_types) {
if (
this.registered_node_types[i].category &&
!this.registered_node_types[i].skip_list
) {
categories[this.registered_... | javascript | function() {
var categories = { "": 1 };
for (var i in this.registered_node_types) {
if (
this.registered_node_types[i].category &&
!this.registered_node_types[i].skip_list
) {
categories[this.registered_... | [
"function",
"(",
")",
"{",
"var",
"categories",
"=",
"{",
"\"\"",
":",
"1",
"}",
";",
"for",
"(",
"var",
"i",
"in",
"this",
".",
"registered_node_types",
")",
"{",
"if",
"(",
"this",
".",
"registered_node_types",
"[",
"i",
"]",
".",
"category",
"&&",... | Returns a list with all the node type categories
@method getNodeTypesCategories
@return {Array} array with all the names of the categories | [
"Returns",
"a",
"list",
"with",
"all",
"the",
"node",
"type",
"categories"
] | b6ca97f2b1f6c3ec0be919070850a2f0df81f0b2 | https://github.com/jagenjo/litegraph.js/blob/b6ca97f2b1f6c3ec0be919070850a2f0df81f0b2/build/litegraph.js#L371-L386 | |
9,105 | jagenjo/litegraph.js | build/litegraph.js | function(obj, target) {
if (obj == null) {
return null;
}
var r = JSON.parse(JSON.stringify(obj));
if (!target) {
return r;
}
for (var i in r) {
target[i] = r[i];
}
return tar... | javascript | function(obj, target) {
if (obj == null) {
return null;
}
var r = JSON.parse(JSON.stringify(obj));
if (!target) {
return r;
}
for (var i in r) {
target[i] = r[i];
}
return tar... | [
"function",
"(",
"obj",
",",
"target",
")",
"{",
"if",
"(",
"obj",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"var",
"r",
"=",
"JSON",
".",
"parse",
"(",
"JSON",
".",
"stringify",
"(",
"obj",
")",
")",
";",
"if",
"(",
"!",
"target",
... | separated just to improve if it doesn't work | [
"separated",
"just",
"to",
"improve",
"if",
"it",
"doesn",
"t",
"work"
] | b6ca97f2b1f6c3ec0be919070850a2f0df81f0b2 | https://github.com/jagenjo/litegraph.js/blob/b6ca97f2b1f6c3ec0be919070850a2f0df81f0b2/build/litegraph.js#L434-L447 | |
9,106 | jagenjo/litegraph.js | build/litegraph.js | LLink | function LLink(id, type, origin_id, origin_slot, target_id, target_slot) {
this.id = id;
this.type = type;
this.origin_id = origin_id;
this.origin_slot = origin_slot;
this.target_id = target_id;
this.target_slot = target_slot;
this._data = null;
this._pos... | javascript | function LLink(id, type, origin_id, origin_slot, target_id, target_slot) {
this.id = id;
this.type = type;
this.origin_id = origin_id;
this.origin_slot = origin_slot;
this.target_id = target_id;
this.target_slot = target_slot;
this._data = null;
this._pos... | [
"function",
"LLink",
"(",
"id",
",",
"type",
",",
"origin_id",
",",
"origin_slot",
",",
"target_id",
",",
"target_slot",
")",
"{",
"this",
".",
"id",
"=",
"id",
";",
"this",
".",
"type",
"=",
"type",
";",
"this",
".",
"origin_id",
"=",
"origin_id",
"... | this is the class in charge of storing link information | [
"this",
"is",
"the",
"class",
"in",
"charge",
"of",
"storing",
"link",
"information"
] | b6ca97f2b1f6c3ec0be919070850a2f0df81f0b2 | https://github.com/jagenjo/litegraph.js/blob/b6ca97f2b1f6c3ec0be919070850a2f0df81f0b2/build/litegraph.js#L1954-L1964 |
9,107 | jagenjo/litegraph.js | build/litegraph.js | isInsideBounding | function isInsideBounding(p, bb) {
if (
p[0] < bb[0][0] ||
p[1] < bb[0][1] ||
p[0] > bb[1][0] ||
p[1] > bb[1][1]
) {
return false;
}
return true;
} | javascript | function isInsideBounding(p, bb) {
if (
p[0] < bb[0][0] ||
p[1] < bb[0][1] ||
p[0] > bb[1][0] ||
p[1] > bb[1][1]
) {
return false;
}
return true;
} | [
"function",
"isInsideBounding",
"(",
"p",
",",
"bb",
")",
"{",
"if",
"(",
"p",
"[",
"0",
"]",
"<",
"bb",
"[",
"0",
"]",
"[",
"0",
"]",
"||",
"p",
"[",
"1",
"]",
"<",
"bb",
"[",
"0",
"]",
"[",
"1",
"]",
"||",
"p",
"[",
"0",
"]",
">",
"... | point inside bounding box | [
"point",
"inside",
"bounding",
"box"
] | b6ca97f2b1f6c3ec0be919070850a2f0df81f0b2 | https://github.com/jagenjo/litegraph.js/blob/b6ca97f2b1f6c3ec0be919070850a2f0df81f0b2/build/litegraph.js#L9994-L10004 |
9,108 | jagenjo/litegraph.js | build/litegraph.js | hex2num | function hex2num(hex) {
if (hex.charAt(0) == "#") {
hex = hex.slice(1);
} //Remove the '#' char - if there is one.
hex = hex.toUpperCase();
var hex_alphabets = "0123456789ABCDEF";
var value = new Array(3);
var k = 0;
var int1, int2;
for (var i ... | javascript | function hex2num(hex) {
if (hex.charAt(0) == "#") {
hex = hex.slice(1);
} //Remove the '#' char - if there is one.
hex = hex.toUpperCase();
var hex_alphabets = "0123456789ABCDEF";
var value = new Array(3);
var k = 0;
var int1, int2;
for (var i ... | [
"function",
"hex2num",
"(",
"hex",
")",
"{",
"if",
"(",
"hex",
".",
"charAt",
"(",
"0",
")",
"==",
"\"#\"",
")",
"{",
"hex",
"=",
"hex",
".",
"slice",
"(",
"1",
")",
";",
"}",
"//Remove the '#' char - if there is one.",
"hex",
"=",
"hex",
".",
"toUpp... | Convert a hex value to its decimal value - the inputted hex must be in the format of a hex triplet - the kind we use for HTML colours. The function will return an array with three values. | [
"Convert",
"a",
"hex",
"value",
"to",
"its",
"decimal",
"value",
"-",
"the",
"inputted",
"hex",
"must",
"be",
"in",
"the",
"format",
"of",
"a",
"hex",
"triplet",
"-",
"the",
"kind",
"we",
"use",
"for",
"HTML",
"colours",
".",
"The",
"function",
"will",... | b6ca97f2b1f6c3ec0be919070850a2f0df81f0b2 | https://github.com/jagenjo/litegraph.js/blob/b6ca97f2b1f6c3ec0be919070850a2f0df81f0b2/build/litegraph.js#L10029-L10045 |
9,109 | jagenjo/litegraph.js | build/litegraph.js | num2hex | function num2hex(triplet) {
var hex_alphabets = "0123456789ABCDEF";
var hex = "#";
var int1, int2;
for (var i = 0; i < 3; i++) {
int1 = triplet[i] / 16;
int2 = triplet[i] % 16;
hex += hex_alphabets.charAt(int1) + hex_alphabets.charAt(int2);
}
... | javascript | function num2hex(triplet) {
var hex_alphabets = "0123456789ABCDEF";
var hex = "#";
var int1, int2;
for (var i = 0; i < 3; i++) {
int1 = triplet[i] / 16;
int2 = triplet[i] % 16;
hex += hex_alphabets.charAt(int1) + hex_alphabets.charAt(int2);
}
... | [
"function",
"num2hex",
"(",
"triplet",
")",
"{",
"var",
"hex_alphabets",
"=",
"\"0123456789ABCDEF\"",
";",
"var",
"hex",
"=",
"\"#\"",
";",
"var",
"int1",
",",
"int2",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"3",
";",
"i",
"++",
")",
... | Give a array with three values as the argument and the function will return the corresponding hex triplet. | [
"Give",
"a",
"array",
"with",
"three",
"values",
"as",
"the",
"argument",
"and",
"the",
"function",
"will",
"return",
"the",
"corresponding",
"hex",
"triplet",
"."
] | b6ca97f2b1f6c3ec0be919070850a2f0df81f0b2 | https://github.com/jagenjo/litegraph.js/blob/b6ca97f2b1f6c3ec0be919070850a2f0df81f0b2/build/litegraph.js#L10051-L10062 |
9,110 | jagenjo/litegraph.js | build/litegraph.js | inner_onclick | function inner_onclick(e) {
var value = this.value;
var close_parent = true;
if (that.current_submenu) {
that.current_submenu.close(e);
}
//global callback
if (options.callback) {
var r = options.callback.call(
... | javascript | function inner_onclick(e) {
var value = this.value;
var close_parent = true;
if (that.current_submenu) {
that.current_submenu.close(e);
}
//global callback
if (options.callback) {
var r = options.callback.call(
... | [
"function",
"inner_onclick",
"(",
"e",
")",
"{",
"var",
"value",
"=",
"this",
".",
"value",
";",
"var",
"close_parent",
"=",
"true",
";",
"if",
"(",
"that",
".",
"current_submenu",
")",
"{",
"that",
".",
"current_submenu",
".",
"close",
"(",
"e",
")",
... | menu option clicked | [
"menu",
"option",
"clicked"
] | b6ca97f2b1f6c3ec0be919070850a2f0df81f0b2 | https://github.com/jagenjo/litegraph.js/blob/b6ca97f2b1f6c3ec0be919070850a2f0df81f0b2/build/litegraph.js#L10313-L10377 |
9,111 | jagenjo/litegraph.js | build/litegraph.js | GraphInput | function GraphInput() {
this.addOutput("", "");
this.name_in_graph = "";
this.properties = {};
var that = this;
Object.defineProperty(this.properties, "name", {
get: function() {
return that.name_in_graph;
},
set: function(v) ... | javascript | function GraphInput() {
this.addOutput("", "");
this.name_in_graph = "";
this.properties = {};
var that = this;
Object.defineProperty(this.properties, "name", {
get: function() {
return that.name_in_graph;
},
set: function(v) ... | [
"function",
"GraphInput",
"(",
")",
"{",
"this",
".",
"addOutput",
"(",
"\"\"",
",",
"\"\"",
")",
";",
"this",
".",
"name_in_graph",
"=",
"\"\"",
";",
"this",
".",
"properties",
"=",
"{",
"}",
";",
"var",
"that",
"=",
"this",
";",
"Object",
".",
"d... | Input for a subgraph | [
"Input",
"for",
"a",
"subgraph"
] | b6ca97f2b1f6c3ec0be919070850a2f0df81f0b2 | https://github.com/jagenjo/litegraph.js/blob/b6ca97f2b1f6c3ec0be919070850a2f0df81f0b2/build/litegraph.js#L10798-L10869 |
9,112 | jagenjo/litegraph.js | build/litegraph.js | GraphOutput | function GraphOutput() {
this.addInput("", "");
this.name_in_graph = "";
this.properties = {};
var that = this;
Object.defineProperty(this.properties, "name", {
get: function() {
return that.name_in_graph;
},
set: function(v) ... | javascript | function GraphOutput() {
this.addInput("", "");
this.name_in_graph = "";
this.properties = {};
var that = this;
Object.defineProperty(this.properties, "name", {
get: function() {
return that.name_in_graph;
},
set: function(v) ... | [
"function",
"GraphOutput",
"(",
")",
"{",
"this",
".",
"addInput",
"(",
"\"\"",
",",
"\"\"",
")",
";",
"this",
".",
"name_in_graph",
"=",
"\"\"",
";",
"this",
".",
"properties",
"=",
"{",
"}",
";",
"var",
"that",
"=",
"this",
";",
"Object",
".",
"d... | Output for a subgraph | [
"Output",
"for",
"a",
"subgraph"
] | b6ca97f2b1f6c3ec0be919070850a2f0df81f0b2 | https://github.com/jagenjo/litegraph.js/blob/b6ca97f2b1f6c3ec0be919070850a2f0df81f0b2/build/litegraph.js#L10910-L10981 |
9,113 | jagenjo/litegraph.js | build/litegraph.js | Sequencer | function Sequencer() {
this.addInput("", LiteGraph.ACTION);
this.addInput("", LiteGraph.ACTION);
this.addInput("", LiteGraph.ACTION);
this.addInput("", LiteGraph.ACTION);
this.addInput("", LiteGraph.ACTION);
this.addInput("", LiteGraph.ACTION);
this.addOutp... | javascript | function Sequencer() {
this.addInput("", LiteGraph.ACTION);
this.addInput("", LiteGraph.ACTION);
this.addInput("", LiteGraph.ACTION);
this.addInput("", LiteGraph.ACTION);
this.addInput("", LiteGraph.ACTION);
this.addInput("", LiteGraph.ACTION);
this.addOutp... | [
"function",
"Sequencer",
"(",
")",
"{",
"this",
".",
"addInput",
"(",
"\"\"",
",",
"LiteGraph",
".",
"ACTION",
")",
";",
"this",
".",
"addInput",
"(",
"\"\"",
",",
"LiteGraph",
".",
"ACTION",
")",
";",
"this",
".",
"addInput",
"(",
"\"\"",
",",
"Lite... | Sequencer for events | [
"Sequencer",
"for",
"events"
] | b6ca97f2b1f6c3ec0be919070850a2f0df81f0b2 | https://github.com/jagenjo/litegraph.js/blob/b6ca97f2b1f6c3ec0be919070850a2f0df81f0b2/build/litegraph.js#L11397-L11412 |
9,114 | jagenjo/litegraph.js | build/litegraph.js | MathFormula | function MathFormula() {
this.addInput("x", "number");
this.addInput("y", "number");
this.addOutput("", "number");
this.properties = { x: 1.0, y: 1.0, formula: "x+y" };
this.code_widget = this.addWidget(
"text",
"F(x,y)",
this.propertie... | javascript | function MathFormula() {
this.addInput("x", "number");
this.addInput("y", "number");
this.addOutput("", "number");
this.properties = { x: 1.0, y: 1.0, formula: "x+y" };
this.code_widget = this.addWidget(
"text",
"F(x,y)",
this.propertie... | [
"function",
"MathFormula",
"(",
")",
"{",
"this",
".",
"addInput",
"(",
"\"x\"",
",",
"\"number\"",
")",
";",
"this",
".",
"addInput",
"(",
"\"y\"",
",",
"\"number\"",
")",
";",
"this",
".",
"addOutput",
"(",
"\"\"",
",",
"\"number\"",
")",
";",
"this"... | math library for safe math operations without eval | [
"math",
"library",
"for",
"safe",
"math",
"operations",
"without",
"eval"
] | b6ca97f2b1f6c3ec0be919070850a2f0df81f0b2 | https://github.com/jagenjo/litegraph.js/blob/b6ca97f2b1f6c3ec0be919070850a2f0df81f0b2/build/litegraph.js#L13717-L13734 |
9,115 | jagenjo/litegraph.js | build/litegraph.js | LGraphTextureScaleOffset | function LGraphTextureScaleOffset() {
this.addInput("in", "Texture");
this.addInput("scale", "vec2");
this.addInput("offset", "vec2");
this.addOutput("out", "Texture");
this.properties = {
offset: vec2.fromValues(0, 0),
scale: v... | javascript | function LGraphTextureScaleOffset() {
this.addInput("in", "Texture");
this.addInput("scale", "vec2");
this.addInput("offset", "vec2");
this.addOutput("out", "Texture");
this.properties = {
offset: vec2.fromValues(0, 0),
scale: v... | [
"function",
"LGraphTextureScaleOffset",
"(",
")",
"{",
"this",
".",
"addInput",
"(",
"\"in\"",
",",
"\"Texture\"",
")",
";",
"this",
".",
"addInput",
"(",
"\"scale\"",
",",
"\"vec2\"",
")",
";",
"this",
".",
"addInput",
"(",
"\"offset\"",
",",
"\"vec2\"",
... | Texture Scale Offset | [
"Texture",
"Scale",
"Offset"
] | b6ca97f2b1f6c3ec0be919070850a2f0df81f0b2 | https://github.com/jagenjo/litegraph.js/blob/b6ca97f2b1f6c3ec0be919070850a2f0df81f0b2/build/litegraph.js#L16540-L16550 |
9,116 | jagenjo/litegraph.js | build/litegraph.js | LGraphExposition | function LGraphExposition() {
this.addInput("in", "Texture");
this.addInput("exp", "number");
this.addOutput("out", "Texture");
this.properties = { exposition: 1, precision: LGraphTexture.LOW };
this._uniforms = { u_texture: 0, u_exposition: 1 };
} | javascript | function LGraphExposition() {
this.addInput("in", "Texture");
this.addInput("exp", "number");
this.addOutput("out", "Texture");
this.properties = { exposition: 1, precision: LGraphTexture.LOW };
this._uniforms = { u_texture: 0, u_exposition: 1 };
} | [
"function",
"LGraphExposition",
"(",
")",
"{",
"this",
".",
"addInput",
"(",
"\"in\"",
",",
"\"Texture\"",
")",
";",
"this",
".",
"addInput",
"(",
"\"exp\"",
",",
"\"number\"",
")",
";",
"this",
".",
"addOutput",
"(",
"\"out\"",
",",
"\"Texture\"",
")",
... | simple exposition, but plan to expand it to support different gamma curves | [
"simple",
"exposition",
"but",
"plan",
"to",
"expand",
"it",
"to",
"support",
"different",
"gamma",
"curves"
] | b6ca97f2b1f6c3ec0be919070850a2f0df81f0b2 | https://github.com/jagenjo/litegraph.js/blob/b6ca97f2b1f6c3ec0be919070850a2f0df81f0b2/build/litegraph.js#L19476-L19482 |
9,117 | rstudio/shiny-server | lib/router/directory-router.js | onDirectory | function onDirectory() {
var this_SendStream = this;
if (!/\/$/.test(reqUrl.pathname)) {
// No trailing slash? Redirect to add one
res.writeHead(301, {
'Location': reqUrl.pathname + '/' + (reqUrl.search || '')
});
res.end();
deferred.resolve(true);
r... | javascript | function onDirectory() {
var this_SendStream = this;
if (!/\/$/.test(reqUrl.pathname)) {
// No trailing slash? Redirect to add one
res.writeHead(301, {
'Location': reqUrl.pathname + '/' + (reqUrl.search || '')
});
res.end();
deferred.resolve(true);
r... | [
"function",
"onDirectory",
"(",
")",
"{",
"var",
"this_SendStream",
"=",
"this",
";",
"if",
"(",
"!",
"/",
"\\/$",
"/",
".",
"test",
"(",
"reqUrl",
".",
"pathname",
")",
")",
"{",
"// No trailing slash? Redirect to add one",
"res",
".",
"writeHead",
"(",
"... | Called when the URL requested is a directory | [
"Called",
"when",
"the",
"URL",
"requested",
"is",
"a",
"directory"
] | 0227ff5e5ce0182921446e45295873932507b36f | https://github.com/rstudio/shiny-server/blob/0227ff5e5ce0182921446e45295873932507b36f/lib/router/directory-router.js#L152-L188 |
9,118 | rstudio/shiny-server | lib/proxy/http.js | error500 | function error500(req, res, errorText, detail, templateDir, consoleLogFile, appSpec) {
fsutil.safeTail_p(consoleLogFile, 8192)
.fail(function(consoleLog) {
return;
})
.then(function(consoleLog) {
render.sendPage(res, 500, 'An error has occurred', {
template: 'error-500',
templateDir: templat... | javascript | function error500(req, res, errorText, detail, templateDir, consoleLogFile, appSpec) {
fsutil.safeTail_p(consoleLogFile, 8192)
.fail(function(consoleLog) {
return;
})
.then(function(consoleLog) {
render.sendPage(res, 500, 'An error has occurred', {
template: 'error-500',
templateDir: templat... | [
"function",
"error500",
"(",
"req",
",",
"res",
",",
"errorText",
",",
"detail",
",",
"templateDir",
",",
"consoleLogFile",
",",
"appSpec",
")",
"{",
"fsutil",
".",
"safeTail_p",
"(",
"consoleLogFile",
",",
"8192",
")",
".",
"fail",
"(",
"function",
"(",
... | Send a 500 error response | [
"Send",
"a",
"500",
"error",
"response"
] | 0227ff5e5ce0182921446e45295873932507b36f | https://github.com/rstudio/shiny-server/blob/0227ff5e5ce0182921446e45295873932507b36f/lib/proxy/http.js#L30-L57 |
9,119 | rstudio/shiny-server | lib/proxy/http.js | isKeepalive | function isKeepalive(req) {
var conn = req.headers.connection;
if (typeof(conn) === 'undefined' || conn === null)
conn = '';
conn = conn.trim().toLowerCase();
if (/\bclose\b/i.test(conn))
return false;
if (/\bkeep-alive\b/i.test(conn))
return true;
// No Connection header. Default to keepalive... | javascript | function isKeepalive(req) {
var conn = req.headers.connection;
if (typeof(conn) === 'undefined' || conn === null)
conn = '';
conn = conn.trim().toLowerCase();
if (/\bclose\b/i.test(conn))
return false;
if (/\bkeep-alive\b/i.test(conn))
return true;
// No Connection header. Default to keepalive... | [
"function",
"isKeepalive",
"(",
"req",
")",
"{",
"var",
"conn",
"=",
"req",
".",
"headers",
".",
"connection",
";",
"if",
"(",
"typeof",
"(",
"conn",
")",
"===",
"'undefined'",
"||",
"conn",
"===",
"null",
")",
"conn",
"=",
"''",
";",
"conn",
"=",
... | Determine if keepalive is desired by the client that generated this request | [
"Determine",
"if",
"keepalive",
"is",
"desired",
"by",
"the",
"client",
"that",
"generated",
"this",
"request"
] | 0227ff5e5ce0182921446e45295873932507b36f | https://github.com/rstudio/shiny-server/blob/0227ff5e5ce0182921446e45295873932507b36f/lib/proxy/http.js#L287-L304 |
9,120 | rstudio/shiny-server | lib/config/config.js | read_p | function read_p(path, schemaPath) {
return Q.nfcall(fs.readFile, path, 'utf8')
.then(function(cdata) {
return Q.nfcall(fs.readFile, schemaPath, 'utf8')
.then(function(sdata) {
return schema.applySchema(parse(cdata, path), parse(sdata, schemaPath));
});
});
} | javascript | function read_p(path, schemaPath) {
return Q.nfcall(fs.readFile, path, 'utf8')
.then(function(cdata) {
return Q.nfcall(fs.readFile, schemaPath, 'utf8')
.then(function(sdata) {
return schema.applySchema(parse(cdata, path), parse(sdata, schemaPath));
});
});
} | [
"function",
"read_p",
"(",
"path",
",",
"schemaPath",
")",
"{",
"return",
"Q",
".",
"nfcall",
"(",
"fs",
".",
"readFile",
",",
"path",
",",
"'utf8'",
")",
".",
"then",
"(",
"function",
"(",
"cdata",
")",
"{",
"return",
"Q",
".",
"nfcall",
"(",
"fs"... | Reads the given config file. The returned promise resolves to the ConfigNode
object at the root of the config file.
@param {String} path File path for the config file.
@returns {Promise} Promise that resolves to ConfigNode. | [
"Reads",
"the",
"given",
"config",
"file",
".",
"The",
"returned",
"promise",
"resolves",
"to",
"the",
"ConfigNode",
"object",
"at",
"the",
"root",
"of",
"the",
"config",
"file",
"."
] | 0227ff5e5ce0182921446e45295873932507b36f | https://github.com/rstudio/shiny-server/blob/0227ff5e5ce0182921446e45295873932507b36f/lib/config/config.js#L29-L37 |
9,121 | rstudio/shiny-server | lib/proxy/multiplex.js | MultiplexChannel | function MultiplexChannel(id, conn, properties) {
events.EventEmitter.call(this);
this.$id = id; // The channel id
this.$conn = conn; // The underlying SockJS connection
_.extend(this, properties); // Apply extra properties to this object
this.readyState = this.$conn.readyState;
assert(this.readyState ==... | javascript | function MultiplexChannel(id, conn, properties) {
events.EventEmitter.call(this);
this.$id = id; // The channel id
this.$conn = conn; // The underlying SockJS connection
_.extend(this, properties); // Apply extra properties to this object
this.readyState = this.$conn.readyState;
assert(this.readyState ==... | [
"function",
"MultiplexChannel",
"(",
"id",
",",
"conn",
",",
"properties",
")",
"{",
"events",
".",
"EventEmitter",
".",
"call",
"(",
"this",
")",
";",
"this",
".",
"$id",
"=",
"id",
";",
"// The channel id",
"this",
".",
"$conn",
"=",
"conn",
";",
"//... | Fake SockJS connection that can be multiplexed over a real SockJS connection. | [
"Fake",
"SockJS",
"connection",
"that",
"can",
"be",
"multiplexed",
"over",
"a",
"real",
"SockJS",
"connection",
"."
] | 0227ff5e5ce0182921446e45295873932507b36f | https://github.com/rstudio/shiny-server/blob/0227ff5e5ce0182921446e45295873932507b36f/lib/proxy/multiplex.js#L115-L122 |
9,122 | rstudio/shiny-server | lib/router/config-router.js | createServers | function createServers(conf) {
var seenKeys = map.create();
var servers = _.map(conf.search('server'), function(serverNode) {
var listenNode = serverNode.getOne('listen');
if (!listenNode)
throwForNode(serverNode,
new Error('Required "listen" directive is missing'));
var port = serverN... | javascript | function createServers(conf) {
var seenKeys = map.create();
var servers = _.map(conf.search('server'), function(serverNode) {
var listenNode = serverNode.getOne('listen');
if (!listenNode)
throwForNode(serverNode,
new Error('Required "listen" directive is missing'));
var port = serverN... | [
"function",
"createServers",
"(",
"conf",
")",
"{",
"var",
"seenKeys",
"=",
"map",
".",
"create",
"(",
")",
";",
"var",
"servers",
"=",
"_",
".",
"map",
"(",
"conf",
".",
"search",
"(",
"'server'",
")",
",",
"function",
"(",
"serverNode",
")",
"{",
... | Crawl the parsed and validated config file data to create an array of
ServerRouters. | [
"Crawl",
"the",
"parsed",
"and",
"validated",
"config",
"file",
"data",
"to",
"create",
"an",
"array",
"of",
"ServerRouters",
"."
] | 0227ff5e5ce0182921446e45295873932507b36f | https://github.com/rstudio/shiny-server/blob/0227ff5e5ce0182921446e45295873932507b36f/lib/router/config-router.js#L191-L248 |
9,123 | rstudio/shiny-server | lib/router/config-router.js | createLocation | function createLocation(locNode) {
// TODO: Include ancestor locations in path
var path = locNode.values.path;
var terminalLocation = !locNode.getOne('location', false);
var node = locNode.getOne(/^site_dir|user_dirs|app_dir|user_apps|redirect$/);
if (!node) {
// No directives. Only allow this if child l... | javascript | function createLocation(locNode) {
// TODO: Include ancestor locations in path
var path = locNode.values.path;
var terminalLocation = !locNode.getOne('location', false);
var node = locNode.getOne(/^site_dir|user_dirs|app_dir|user_apps|redirect$/);
if (!node) {
// No directives. Only allow this if child l... | [
"function",
"createLocation",
"(",
"locNode",
")",
"{",
"// TODO: Include ancestor locations in path",
"var",
"path",
"=",
"locNode",
".",
"values",
".",
"path",
";",
"var",
"terminalLocation",
"=",
"!",
"locNode",
".",
"getOne",
"(",
"'location'",
",",
"false",
... | Validates the location node, and returns the appropriate type of router
it represents. | [
"Validates",
"the",
"location",
"node",
"and",
"returns",
"the",
"appropriate",
"type",
"of",
"router",
"it",
"represents",
"."
] | 0227ff5e5ce0182921446e45295873932507b36f | https://github.com/rstudio/shiny-server/blob/0227ff5e5ce0182921446e45295873932507b36f/lib/router/config-router.js#L482-L527 |
9,124 | rstudio/shiny-server | lib/core/qutil.js | forEachPromise_p | function forEachPromise_p(array, iterator, accept, defaultValue) {
var deferred = Q.defer();
var i = 0;
function tryNext() {
if (i >= array.length) {
// We've reached the end of the list--give up
deferred.resolve(defaultValue);
}
else {
try {
// Try the next item in the list
... | javascript | function forEachPromise_p(array, iterator, accept, defaultValue) {
var deferred = Q.defer();
var i = 0;
function tryNext() {
if (i >= array.length) {
// We've reached the end of the list--give up
deferred.resolve(defaultValue);
}
else {
try {
// Try the next item in the list
... | [
"function",
"forEachPromise_p",
"(",
"array",
",",
"iterator",
",",
"accept",
",",
"defaultValue",
")",
"{",
"var",
"deferred",
"=",
"Q",
".",
"defer",
"(",
")",
";",
"var",
"i",
"=",
"0",
";",
"function",
"tryNext",
"(",
")",
"{",
"if",
"(",
"i",
... | Starting at the beginning of the array, pass an element to the iterator,
which should return a promise. If the promise resolves, test the value
using the accept function. If accepted, that value is the result. If not
accepted, move on to the next array element.
If any of the iterator-produced promises fails, then reje... | [
"Starting",
"at",
"the",
"beginning",
"of",
"the",
"array",
"pass",
"an",
"element",
"to",
"the",
"iterator",
"which",
"should",
"return",
"a",
"promise",
".",
"If",
"the",
"promise",
"resolves",
"test",
"the",
"value",
"using",
"the",
"accept",
"function",
... | 0227ff5e5ce0182921446e45295873932507b36f | https://github.com/rstudio/shiny-server/blob/0227ff5e5ce0182921446e45295873932507b36f/lib/core/qutil.js#L91-L124 |
9,125 | rstudio/shiny-server | lib/core/qutil.js | fapply | function fapply(func, object, args) {
try {
return Q.resolve(func.apply(object, args));
} catch(err) {
return Q.reject(err);
}
} | javascript | function fapply(func, object, args) {
try {
return Q.resolve(func.apply(object, args));
} catch(err) {
return Q.reject(err);
}
} | [
"function",
"fapply",
"(",
"func",
",",
"object",
",",
"args",
")",
"{",
"try",
"{",
"return",
"Q",
".",
"resolve",
"(",
"func",
".",
"apply",
"(",
"object",
",",
"args",
")",
")",
";",
"}",
"catch",
"(",
"err",
")",
"{",
"return",
"Q",
".",
"r... | Apply a synchronous function but wrap the result or exception in a promise.
Why doesn't Q.apply work this way?? | [
"Apply",
"a",
"synchronous",
"function",
"but",
"wrap",
"the",
"result",
"or",
"exception",
"in",
"a",
"promise",
".",
"Why",
"doesn",
"t",
"Q",
".",
"apply",
"work",
"this",
"way??"
] | 0227ff5e5ce0182921446e45295873932507b36f | https://github.com/rstudio/shiny-server/blob/0227ff5e5ce0182921446e45295873932507b36f/lib/core/qutil.js#L131-L137 |
9,126 | rstudio/shiny-server | lib/core/qutil.js | map_p | function map_p(collection, func_p) {
if (collection.length === 0)
return Q.resolve([]);
var results = [];
var lastFunc = Q.resolve(true);
_.each(collection, function(el, index) {
lastFunc = lastFunc.then(function() {
return func_p(collection[index])
.then(function(result) {
results[index... | javascript | function map_p(collection, func_p) {
if (collection.length === 0)
return Q.resolve([]);
var results = [];
var lastFunc = Q.resolve(true);
_.each(collection, function(el, index) {
lastFunc = lastFunc.then(function() {
return func_p(collection[index])
.then(function(result) {
results[index... | [
"function",
"map_p",
"(",
"collection",
",",
"func_p",
")",
"{",
"if",
"(",
"collection",
".",
"length",
"===",
"0",
")",
"return",
"Q",
".",
"resolve",
"(",
"[",
"]",
")",
";",
"var",
"results",
"=",
"[",
"]",
";",
"var",
"lastFunc",
"=",
"Q",
"... | Pass in a collection and a promise-returning function, and map_p will
do a sequential map operation and resolve to the results. | [
"Pass",
"in",
"a",
"collection",
"and",
"a",
"promise",
"-",
"returning",
"function",
"and",
"map_p",
"will",
"do",
"a",
"sequential",
"map",
"operation",
"and",
"resolve",
"to",
"the",
"results",
"."
] | 0227ff5e5ce0182921446e45295873932507b36f | https://github.com/rstudio/shiny-server/blob/0227ff5e5ce0182921446e45295873932507b36f/lib/core/qutil.js#L158-L177 |
9,127 | rstudio/shiny-server | lib/config/app-config.js | findConfig_p | function findConfig_p(appDir){
var filePath = path.join(appDir, ".shiny_app.conf");
return fsutil.safeStat_p(filePath)
.then(function(stat){
if (stat && stat.isFile()){
return (filePath);
}
throw new Error('Invalid app configuration file.');
});
} | javascript | function findConfig_p(appDir){
var filePath = path.join(appDir, ".shiny_app.conf");
return fsutil.safeStat_p(filePath)
.then(function(stat){
if (stat && stat.isFile()){
return (filePath);
}
throw new Error('Invalid app configuration file.');
});
} | [
"function",
"findConfig_p",
"(",
"appDir",
")",
"{",
"var",
"filePath",
"=",
"path",
".",
"join",
"(",
"appDir",
",",
"\".shiny_app.conf\"",
")",
";",
"return",
"fsutil",
".",
"safeStat_p",
"(",
"filePath",
")",
".",
"then",
"(",
"function",
"(",
"stat",
... | Check to see if there's a configuration file in the given app directory,
if so, parse it.
@param appDir The base directory in which the application is hosted.
@return A promise resolving to the path of the application-specific
configuration file | [
"Check",
"to",
"see",
"if",
"there",
"s",
"a",
"configuration",
"file",
"in",
"the",
"given",
"app",
"directory",
"if",
"so",
"parse",
"it",
"."
] | 0227ff5e5ce0182921446e45295873932507b36f | https://github.com/rstudio/shiny-server/blob/0227ff5e5ce0182921446e45295873932507b36f/lib/config/app-config.js#L92-L101 |
9,128 | rstudio/shiny-server | lib/core/render.js | sendClientAlertMessage | function sendClientAlertMessage(ws, alert) {
var msg = JSON.stringify({
custom: {
alert: alert
}
});
ws.write(msg);
} | javascript | function sendClientAlertMessage(ws, alert) {
var msg = JSON.stringify({
custom: {
alert: alert
}
});
ws.write(msg);
} | [
"function",
"sendClientAlertMessage",
"(",
"ws",
",",
"alert",
")",
"{",
"var",
"msg",
"=",
"JSON",
".",
"stringify",
"(",
"{",
"custom",
":",
"{",
"alert",
":",
"alert",
"}",
"}",
")",
";",
"ws",
".",
"write",
"(",
"msg",
")",
";",
"}"
] | Sends the given string to the client, where it will be displayed as a
JavaScript alert message. | [
"Sends",
"the",
"given",
"string",
"to",
"the",
"client",
"where",
"it",
"will",
"be",
"displayed",
"as",
"a",
"JavaScript",
"alert",
"message",
"."
] | 0227ff5e5ce0182921446e45295873932507b36f | https://github.com/rstudio/shiny-server/blob/0227ff5e5ce0182921446e45295873932507b36f/lib/core/render.js#L110-L117 |
9,129 | rstudio/shiny-server | lib/core/render.js | error404 | function error404(req, res, templateDir) {
sendPage(res, 404, 'Page not found', {
template: 'error-404',
templateDir: templateDir,
vars: {
message: "Sorry, but the page you requested doesn't exist."
}
});
} | javascript | function error404(req, res, templateDir) {
sendPage(res, 404, 'Page not found', {
template: 'error-404',
templateDir: templateDir,
vars: {
message: "Sorry, but the page you requested doesn't exist."
}
});
} | [
"function",
"error404",
"(",
"req",
",",
"res",
",",
"templateDir",
")",
"{",
"sendPage",
"(",
"res",
",",
"404",
",",
"'Page not found'",
",",
"{",
"template",
":",
"'error-404'",
",",
"templateDir",
":",
"templateDir",
",",
"vars",
":",
"{",
"message",
... | Send a 404 error response | [
"Send",
"a",
"404",
"error",
"response"
] | 0227ff5e5ce0182921446e45295873932507b36f | https://github.com/rstudio/shiny-server/blob/0227ff5e5ce0182921446e45295873932507b36f/lib/core/render.js#L121-L129 |
9,130 | rstudio/shiny-server | lib/core/render.js | errorAppOverloaded | function errorAppOverloaded(req, res, templateDir) {
sendPage(res, 503, 'Too Many Users', {
template: 'error-503-users',
templateDir: templateDir,
vars: {
message: "Sorry, but this application has exceeded its quota of concurrent users. Please try again later."
}
});
} | javascript | function errorAppOverloaded(req, res, templateDir) {
sendPage(res, 503, 'Too Many Users', {
template: 'error-503-users',
templateDir: templateDir,
vars: {
message: "Sorry, but this application has exceeded its quota of concurrent users. Please try again later."
}
});
} | [
"function",
"errorAppOverloaded",
"(",
"req",
",",
"res",
",",
"templateDir",
")",
"{",
"sendPage",
"(",
"res",
",",
"503",
",",
"'Too Many Users'",
",",
"{",
"template",
":",
"'error-503-users'",
",",
"templateDir",
":",
"templateDir",
",",
"vars",
":",
"{"... | Send a 503 error response | [
"Send",
"a",
"503",
"error",
"response"
] | 0227ff5e5ce0182921446e45295873932507b36f | https://github.com/rstudio/shiny-server/blob/0227ff5e5ce0182921446e45295873932507b36f/lib/core/render.js#L133-L141 |
9,131 | rstudio/shiny-server | lib/main.js | ping | function ping(req, res) {
if (url.parse(req.url).pathname == '/ping') {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('OK');
return true;
}
return false;
} | javascript | function ping(req, res) {
if (url.parse(req.url).pathname == '/ping') {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('OK');
return true;
}
return false;
} | [
"function",
"ping",
"(",
"req",
",",
"res",
")",
"{",
"if",
"(",
"url",
".",
"parse",
"(",
"req",
".",
"url",
")",
".",
"pathname",
"==",
"'/ping'",
")",
"{",
"res",
".",
"writeHead",
"(",
"200",
",",
"{",
"'Content-Type'",
":",
"'text/plain'",
"}"... | A simple router function that does nothing but respond "OK". Can be used for load balancer health checks, for example. | [
"A",
"simple",
"router",
"function",
"that",
"does",
"nothing",
"but",
"respond",
"OK",
".",
"Can",
"be",
"used",
"for",
"load",
"balancer",
"health",
"checks",
"for",
"example",
"."
] | 0227ff5e5ce0182921446e45295873932507b36f | https://github.com/rstudio/shiny-server/blob/0227ff5e5ce0182921446e45295873932507b36f/lib/main.js#L111-L118 |
9,132 | rstudio/shiny-server | lib/core/map.js | compact | function compact(x) {
function shouldDrop(key) {
return typeof(x[key]) === 'undefined' || x[key] === null;
}
return _.omit(x, _.filter(_.keys(x), shouldDrop))
} | javascript | function compact(x) {
function shouldDrop(key) {
return typeof(x[key]) === 'undefined' || x[key] === null;
}
return _.omit(x, _.filter(_.keys(x), shouldDrop))
} | [
"function",
"compact",
"(",
"x",
")",
"{",
"function",
"shouldDrop",
"(",
"key",
")",
"{",
"return",
"typeof",
"(",
"x",
"[",
"key",
"]",
")",
"===",
"'undefined'",
"||",
"x",
"[",
"key",
"]",
"===",
"null",
";",
"}",
"return",
"_",
".",
"omit",
... | Return a copy of object x with null or undefined "own" properties removed. | [
"Return",
"a",
"copy",
"of",
"object",
"x",
"with",
"null",
"or",
"undefined",
"own",
"properties",
"removed",
"."
] | 0227ff5e5ce0182921446e45295873932507b36f | https://github.com/rstudio/shiny-server/blob/0227ff5e5ce0182921446e45295873932507b36f/lib/core/map.js#L28-L33 |
9,133 | machty/ember-concurrency | vendor/dummy-deps/rx.js | AnonymousObserver | function AnonymousObserver(onNext, onError, onCompleted) {
__super__.call(this);
this._onNext = onNext;
this._onError = onError;
this._onCompleted = onCompleted;
} | javascript | function AnonymousObserver(onNext, onError, onCompleted) {
__super__.call(this);
this._onNext = onNext;
this._onError = onError;
this._onCompleted = onCompleted;
} | [
"function",
"AnonymousObserver",
"(",
"onNext",
",",
"onError",
",",
"onCompleted",
")",
"{",
"__super__",
".",
"call",
"(",
"this",
")",
";",
"this",
".",
"_onNext",
"=",
"onNext",
";",
"this",
".",
"_onError",
"=",
"onError",
";",
"this",
".",
"_onComp... | Creates an observer from the specified OnNext, OnError, and OnCompleted actions.
@param {Any} onNext Observer's OnNext action implementation.
@param {Any} onError Observer's OnError action implementation.
@param {Any} onCompleted Observer's OnCompleted action implementation. | [
"Creates",
"an",
"observer",
"from",
"the",
"specified",
"OnNext",
"OnError",
"and",
"OnCompleted",
"actions",
"."
] | 6b1a46e5ccd5495412409a29d82b5fcc6dae2272 | https://github.com/machty/ember-concurrency/blob/6b1a46e5ccd5495412409a29d82b5fcc6dae2272/vendor/dummy-deps/rx.js#L1806-L1811 |
9,134 | machty/ember-concurrency | vendor/dummy-deps/rx.js | arrayIndexOfComparer | function arrayIndexOfComparer(array, item, comparer) {
for (var i = 0, len = array.length; i < len; i++) {
if (comparer(array[i], item)) { return i; }
}
return -1;
} | javascript | function arrayIndexOfComparer(array, item, comparer) {
for (var i = 0, len = array.length; i < len; i++) {
if (comparer(array[i], item)) { return i; }
}
return -1;
} | [
"function",
"arrayIndexOfComparer",
"(",
"array",
",",
"item",
",",
"comparer",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"len",
"=",
"array",
".",
"length",
";",
"i",
"<",
"len",
";",
"i",
"++",
")",
"{",
"if",
"(",
"comparer",
"(",
"arra... | Swap out for Array.findIndex | [
"Swap",
"out",
"for",
"Array",
".",
"findIndex"
] | 6b1a46e5ccd5495412409a29d82b5fcc6dae2272 | https://github.com/machty/ember-concurrency/blob/6b1a46e5ccd5495412409a29d82b5fcc6dae2272/vendor/dummy-deps/rx.js#L5256-L5261 |
9,135 | machty/ember-concurrency | vendor/dummy-deps/rx.js | VirtualTimeScheduler | function VirtualTimeScheduler(initialClock, comparer) {
this.clock = initialClock;
this.comparer = comparer;
this.isEnabled = false;
this.queue = new PriorityQueue(1024);
__super__.call(this);
} | javascript | function VirtualTimeScheduler(initialClock, comparer) {
this.clock = initialClock;
this.comparer = comparer;
this.isEnabled = false;
this.queue = new PriorityQueue(1024);
__super__.call(this);
} | [
"function",
"VirtualTimeScheduler",
"(",
"initialClock",
",",
"comparer",
")",
"{",
"this",
".",
"clock",
"=",
"initialClock",
";",
"this",
".",
"comparer",
"=",
"comparer",
";",
"this",
".",
"isEnabled",
"=",
"false",
";",
"this",
".",
"queue",
"=",
"new"... | Creates a new virtual time scheduler with the specified initial clock value and absolute time comparer.
@constructor
@param {Number} initialClock Initial value for the clock.
@param {Function} comparer Comparer to determine causality of events based on absolute time. | [
"Creates",
"a",
"new",
"virtual",
"time",
"scheduler",
"with",
"the",
"specified",
"initial",
"clock",
"value",
"and",
"absolute",
"time",
"comparer",
"."
] | 6b1a46e5ccd5495412409a29d82b5fcc6dae2272 | https://github.com/machty/ember-concurrency/blob/6b1a46e5ccd5495412409a29d82b5fcc6dae2272/vendor/dummy-deps/rx.js#L10873-L10879 |
9,136 | machty/ember-concurrency | vendor/dummy-deps/rx.js | HistoricalScheduler | function HistoricalScheduler(initialClock, comparer) {
var clock = initialClock == null ? 0 : initialClock;
var cmp = comparer || defaultSubComparer;
__super__.call(this, clock, cmp);
} | javascript | function HistoricalScheduler(initialClock, comparer) {
var clock = initialClock == null ? 0 : initialClock;
var cmp = comparer || defaultSubComparer;
__super__.call(this, clock, cmp);
} | [
"function",
"HistoricalScheduler",
"(",
"initialClock",
",",
"comparer",
")",
"{",
"var",
"clock",
"=",
"initialClock",
"==",
"null",
"?",
"0",
":",
"initialClock",
";",
"var",
"cmp",
"=",
"comparer",
"||",
"defaultSubComparer",
";",
"__super__",
".",
"call",
... | Creates a new historical scheduler with the specified initial clock value.
@constructor
@param {Number} initialClock Initial value for the clock.
@param {Function} comparer Comparer to determine causality of events based on absolute time. | [
"Creates",
"a",
"new",
"historical",
"scheduler",
"with",
"the",
"specified",
"initial",
"clock",
"value",
"."
] | 6b1a46e5ccd5495412409a29d82b5fcc6dae2272 | https://github.com/machty/ember-concurrency/blob/6b1a46e5ccd5495412409a29d82b5fcc6dae2272/vendor/dummy-deps/rx.js#L11067-L11071 |
9,137 | machty/ember-concurrency | vendor/dummy-deps/rx.js | function (ticks, value) {
return typeof value === 'function' ?
new Recorded(ticks, new OnNextPredicate(value)) :
new Recorded(ticks, Notification.createOnNext(value));
} | javascript | function (ticks, value) {
return typeof value === 'function' ?
new Recorded(ticks, new OnNextPredicate(value)) :
new Recorded(ticks, Notification.createOnNext(value));
} | [
"function",
"(",
"ticks",
",",
"value",
")",
"{",
"return",
"typeof",
"value",
"===",
"'function'",
"?",
"new",
"Recorded",
"(",
"ticks",
",",
"new",
"OnNextPredicate",
"(",
"value",
")",
")",
":",
"new",
"Recorded",
"(",
"ticks",
",",
"Notification",
".... | Factory method for an OnNext notification record at a given time with a given value or a predicate function.
1 - ReactiveTest.onNext(200, 42);
2 - ReactiveTest.onNext(200, function (x) { return x.length == 2; });
@param ticks Recorded virtual time the OnNext notification occurs.
@param value Recorded value stored in ... | [
"Factory",
"method",
"for",
"an",
"OnNext",
"notification",
"record",
"at",
"a",
"given",
"time",
"with",
"a",
"given",
"value",
"or",
"a",
"predicate",
"function",
"."
] | 6b1a46e5ccd5495412409a29d82b5fcc6dae2272 | https://github.com/machty/ember-concurrency/blob/6b1a46e5ccd5495412409a29d82b5fcc6dae2272/vendor/dummy-deps/rx.js#L11142-L11146 | |
9,138 | machty/ember-concurrency | vendor/dummy-deps/rx.js | function (ticks, error) {
return typeof error === 'function' ?
new Recorded(ticks, new OnErrorPredicate(error)) :
new Recorded(ticks, Notification.createOnError(error));
} | javascript | function (ticks, error) {
return typeof error === 'function' ?
new Recorded(ticks, new OnErrorPredicate(error)) :
new Recorded(ticks, Notification.createOnError(error));
} | [
"function",
"(",
"ticks",
",",
"error",
")",
"{",
"return",
"typeof",
"error",
"===",
"'function'",
"?",
"new",
"Recorded",
"(",
"ticks",
",",
"new",
"OnErrorPredicate",
"(",
"error",
")",
")",
":",
"new",
"Recorded",
"(",
"ticks",
",",
"Notification",
"... | Factory method for an OnError notification record at a given time with a given error.
1 - ReactiveTest.onNext(200, new Error('error'));
2 - ReactiveTest.onNext(200, function (e) { return e.message === 'error'; });
@param ticks Recorded virtual time the OnError notification occurs.
@param exception Recorded exception ... | [
"Factory",
"method",
"for",
"an",
"OnError",
"notification",
"record",
"at",
"a",
"given",
"time",
"with",
"a",
"given",
"error",
"."
] | 6b1a46e5ccd5495412409a29d82b5fcc6dae2272 | https://github.com/machty/ember-concurrency/blob/6b1a46e5ccd5495412409a29d82b5fcc6dae2272/vendor/dummy-deps/rx.js#L11157-L11161 | |
9,139 | machty/ember-concurrency | vendor/dummy-deps/rx.js | AsyncSubject | function AsyncSubject() {
__super__.call(this);
this.isDisposed = false;
this.isStopped = false;
this.hasValue = false;
this.observers = [];
this.hasError = false;
} | javascript | function AsyncSubject() {
__super__.call(this);
this.isDisposed = false;
this.isStopped = false;
this.hasValue = false;
this.observers = [];
this.hasError = false;
} | [
"function",
"AsyncSubject",
"(",
")",
"{",
"__super__",
".",
"call",
"(",
"this",
")",
";",
"this",
".",
"isDisposed",
"=",
"false",
";",
"this",
".",
"isStopped",
"=",
"false",
";",
"this",
".",
"hasValue",
"=",
"false",
";",
"this",
".",
"observers",... | Creates a subject that can only receive one value and that value is cached for all future observations.
@constructor | [
"Creates",
"a",
"subject",
"that",
"can",
"only",
"receive",
"one",
"value",
"and",
"that",
"value",
"is",
"cached",
"for",
"all",
"future",
"observations",
"."
] | 6b1a46e5ccd5495412409a29d82b5fcc6dae2272 | https://github.com/machty/ember-concurrency/blob/6b1a46e5ccd5495412409a29d82b5fcc6dae2272/vendor/dummy-deps/rx.js#L11783-L11790 |
9,140 | intel-iot-devkit/upm | examples/javascript/zfm20-register.js | exit | function exit()
{
myFingerprintSensor = null;
fingerprint_lib.cleanUp();
fingerprint_lib = null;
console.log("Exiting");
process.exit(0);
} | javascript | function exit()
{
myFingerprintSensor = null;
fingerprint_lib.cleanUp();
fingerprint_lib = null;
console.log("Exiting");
process.exit(0);
} | [
"function",
"exit",
"(",
")",
"{",
"myFingerprintSensor",
"=",
"null",
";",
"fingerprint_lib",
".",
"cleanUp",
"(",
")",
";",
"fingerprint_lib",
"=",
"null",
";",
"console",
".",
"log",
"(",
"\"Exiting\"",
")",
";",
"process",
".",
"exit",
"(",
"0",
")",... | Print message when exiting | [
"Print",
"message",
"when",
"exiting"
] | 5cf20df96c6b35c19d5b871ba4e319e96b4df72d | https://github.com/intel-iot-devkit/upm/blob/5cf20df96c6b35c19d5b871ba4e319e96b4df72d/examples/javascript/zfm20-register.js#L126-L133 |
9,141 | intel-iot-devkit/upm | examples/javascript/md-stepper.js | start | function start()
{
if (motor)
{
// configure it, for this example, we'll assume 200 steps per rev
motor.configStepper(200);
motor.setStepperSteps(100);
// start it going at 10 RPM
motor.enableStepper(mdObj.MD.STEP_DIR_CW, 10);
}
} | javascript | function start()
{
if (motor)
{
// configure it, for this example, we'll assume 200 steps per rev
motor.configStepper(200);
motor.setStepperSteps(100);
// start it going at 10 RPM
motor.enableStepper(mdObj.MD.STEP_DIR_CW, 10);
}
} | [
"function",
"start",
"(",
")",
"{",
"if",
"(",
"motor",
")",
"{",
"// configure it, for this example, we'll assume 200 steps per rev",
"motor",
".",
"configStepper",
"(",
"200",
")",
";",
"motor",
".",
"setStepperSteps",
"(",
"100",
")",
";",
"// start it going at 1... | This example demonstrates using the MD to drive a stepper motor | [
"This",
"example",
"demonstrates",
"using",
"the",
"MD",
"to",
"drive",
"a",
"stepper",
"motor"
] | 5cf20df96c6b35c19d5b871ba4e319e96b4df72d | https://github.com/intel-iot-devkit/upm/blob/5cf20df96c6b35c19d5b871ba4e319e96b4df72d/examples/javascript/md-stepper.js#L29-L39 |
9,142 | intel-iot-devkit/upm | examples/javascript/adis16448.js | periodicActivity | function periodicActivity()
{
//Read & Scale Gyro/Accel Data
var xgyro = imu.gyroScale(imu.regRead(0x04));
var ygyro = imu.gyroScale(imu.regRead(0x06));
var zgyro = imu.gyroScale(imu.regRead(0x08));
var xaccl = imu.accelScale(imu.regRead(0x0A));
var yaccl = imu.accelScale(imu.regRead(0x0C));... | javascript | function periodicActivity()
{
//Read & Scale Gyro/Accel Data
var xgyro = imu.gyroScale(imu.regRead(0x04));
var ygyro = imu.gyroScale(imu.regRead(0x06));
var zgyro = imu.gyroScale(imu.regRead(0x08));
var xaccl = imu.accelScale(imu.regRead(0x0A));
var yaccl = imu.accelScale(imu.regRead(0x0C));... | [
"function",
"periodicActivity",
"(",
")",
"{",
"//Read & Scale Gyro/Accel Data",
"var",
"xgyro",
"=",
"imu",
".",
"gyroScale",
"(",
"imu",
".",
"regRead",
"(",
"0x04",
")",
")",
";",
"var",
"ygyro",
"=",
"imu",
".",
"gyroScale",
"(",
"imu",
".",
"regRead",... | Call the periodicActivity function | [
"Call",
"the",
"periodicActivity",
"function"
] | 5cf20df96c6b35c19d5b871ba4e319e96b4df72d | https://github.com/intel-iot-devkit/upm/blob/5cf20df96c6b35c19d5b871ba4e319e96b4df72d/examples/javascript/adis16448.js#L48-L67 |
9,143 | intel-iot-devkit/upm | examples/javascript/ttp223.js | readSensorValue | function readSensorValue() {
if ( touch.isPressed() ) {
console.log(touch.name() + " is pressed");
} else {
console.log(touch.name() + " is not pressed");
}
} | javascript | function readSensorValue() {
if ( touch.isPressed() ) {
console.log(touch.name() + " is pressed");
} else {
console.log(touch.name() + " is not pressed");
}
} | [
"function",
"readSensorValue",
"(",
")",
"{",
"if",
"(",
"touch",
".",
"isPressed",
"(",
")",
")",
"{",
"console",
".",
"log",
"(",
"touch",
".",
"name",
"(",
")",
"+",
"\" is pressed\"",
")",
";",
"}",
"else",
"{",
"console",
".",
"log",
"(",
"tou... | Check whether or not a finger is near the touch sensor and print accordingly, waiting one second between readings | [
"Check",
"whether",
"or",
"not",
"a",
"finger",
"is",
"near",
"the",
"touch",
"sensor",
"and",
"print",
"accordingly",
"waiting",
"one",
"second",
"between",
"readings"
] | 5cf20df96c6b35c19d5b871ba4e319e96b4df72d | https://github.com/intel-iot-devkit/upm/blob/5cf20df96c6b35c19d5b871ba4e319e96b4df72d/examples/javascript/ttp223.js#L33-L39 |
9,144 | intel-iot-devkit/upm | examples/javascript/bno055.js | outputData | function outputData()
{
sensor.update();
var floatData = sensor.getEulerAngles();
console.log("Euler: Heading: " + floatData.get(0)
+ " Roll: " + floatData.get(1)
+ " Pitch: " + floatData.get(2)
+ " degrees");
floatData = sensor.getQuaternions();
con... | javascript | function outputData()
{
sensor.update();
var floatData = sensor.getEulerAngles();
console.log("Euler: Heading: " + floatData.get(0)
+ " Roll: " + floatData.get(1)
+ " Pitch: " + floatData.get(2)
+ " degrees");
floatData = sensor.getQuaternions();
con... | [
"function",
"outputData",
"(",
")",
"{",
"sensor",
".",
"update",
"(",
")",
";",
"var",
"floatData",
"=",
"sensor",
".",
"getEulerAngles",
"(",
")",
";",
"console",
".",
"log",
"(",
"\"Euler: Heading: \"",
"+",
"floatData",
".",
"get",
"(",
"0",
")",
"... | now output various fusion data every 250 milliseconds | [
"now",
"output",
"various",
"fusion",
"data",
"every",
"250",
"milliseconds"
] | 5cf20df96c6b35c19d5b871ba4e319e96b4df72d | https://github.com/intel-iot-devkit/upm/blob/5cf20df96c6b35c19d5b871ba4e319e96b4df72d/examples/javascript/bno055.js#L67-L96 |
9,145 | intel-iot-devkit/upm | examples/javascript/tm1637.js | update | function update(){
now = new Date();
var time = now.getHours().toString() + ("0" + now.getMinutes().toString()).slice(-2);
display.writeString(time);
display.setColon(colon = !colon);
} | javascript | function update(){
now = new Date();
var time = now.getHours().toString() + ("0" + now.getMinutes().toString()).slice(-2);
display.writeString(time);
display.setColon(colon = !colon);
} | [
"function",
"update",
"(",
")",
"{",
"now",
"=",
"new",
"Date",
"(",
")",
";",
"var",
"time",
"=",
"now",
".",
"getHours",
"(",
")",
".",
"toString",
"(",
")",
"+",
"(",
"\"0\"",
"+",
"now",
".",
"getMinutes",
"(",
")",
".",
"toString",
"(",
")... | Display and time update function | [
"Display",
"and",
"time",
"update",
"function"
] | 5cf20df96c6b35c19d5b871ba4e319e96b4df72d | https://github.com/intel-iot-devkit/upm/blob/5cf20df96c6b35c19d5b871ba4e319e96b4df72d/examples/javascript/tm1637.js#L41-L46 |
9,146 | intel-iot-devkit/upm | examples/javascript/ili9341.js | rotateScreen | function rotateScreen(r) {
lcd.setRotation(r);
lcd.fillRect(0, 0, 5, 5, ili9341.ILI9341_WHITE);
if (r < 4) {
r++;
setTimeout(function() { rotateScreen(r); }, 1000);
}
} | javascript | function rotateScreen(r) {
lcd.setRotation(r);
lcd.fillRect(0, 0, 5, 5, ili9341.ILI9341_WHITE);
if (r < 4) {
r++;
setTimeout(function() { rotateScreen(r); }, 1000);
}
} | [
"function",
"rotateScreen",
"(",
"r",
")",
"{",
"lcd",
".",
"setRotation",
"(",
"r",
")",
";",
"lcd",
".",
"fillRect",
"(",
"0",
",",
"0",
",",
"5",
",",
"5",
",",
"ili9341",
".",
"ILI9341_WHITE",
")",
";",
"if",
"(",
"r",
"<",
"4",
")",
"{",
... | Test screen rotation | [
"Test",
"screen",
"rotation"
] | 5cf20df96c6b35c19d5b871ba4e319e96b4df72d | https://github.com/intel-iot-devkit/upm/blob/5cf20df96c6b35c19d5b871ba4e319e96b4df72d/examples/javascript/ili9341.js#L65-L72 |
9,147 | pkgcloud/pkgcloud | lib/pkgcloud/openstack/compute/client/extensions/networks-base.js | function (callback) {
return this._request({
path: this._extension
}, function (err, body, res) {
return err
? callback(err)
: callback(null, body.networks, res);
});
} | javascript | function (callback) {
return this._request({
path: this._extension
}, function (err, body, res) {
return err
? callback(err)
: callback(null, body.networks, res);
});
} | [
"function",
"(",
"callback",
")",
"{",
"return",
"this",
".",
"_request",
"(",
"{",
"path",
":",
"this",
".",
"_extension",
"}",
",",
"function",
"(",
"err",
",",
"body",
",",
"res",
")",
"{",
"return",
"err",
"?",
"callback",
"(",
"err",
")",
":",... | client.getNetworks
@description Display the currently available networks
@param {Function} callback f(err, networks) where networks is an array of networks
@returns {*} | [
"client",
".",
"getNetworks"
] | 44e08a0063252829cdb5e9a8b430c2f4c08b91ad | https://github.com/pkgcloud/pkgcloud/blob/44e08a0063252829cdb5e9a8b430c2f4c08b91ad/lib/pkgcloud/openstack/compute/client/extensions/networks-base.js#L26-L34 | |
9,148 | pkgcloud/pkgcloud | lib/pkgcloud/openstack/compute/client/extensions/networks-base.js | function (network, callback) {
var networkId = (typeof network === 'object') ? network.id : network;
return this._request({
path: urlJoin(this._extension, networkId)
}, function (err, body) {
return err
? callback(err)
: callback(null, body.network);
});
... | javascript | function (network, callback) {
var networkId = (typeof network === 'object') ? network.id : network;
return this._request({
path: urlJoin(this._extension, networkId)
}, function (err, body) {
return err
? callback(err)
: callback(null, body.network);
});
... | [
"function",
"(",
"network",
",",
"callback",
")",
"{",
"var",
"networkId",
"=",
"(",
"typeof",
"network",
"===",
"'object'",
")",
"?",
"network",
".",
"id",
":",
"network",
";",
"return",
"this",
".",
"_request",
"(",
"{",
"path",
":",
"urlJoin",
"(",
... | client.getNetwork
@description Get the details for a specific network
@param {String|object} network The network or networkId to get
@param {Function} callback
@returns {*} | [
"client",
".",
"getNetwork"
] | 44e08a0063252829cdb5e9a8b430c2f4c08b91ad | https://github.com/pkgcloud/pkgcloud/blob/44e08a0063252829cdb5e9a8b430c2f4c08b91ad/lib/pkgcloud/openstack/compute/client/extensions/networks-base.js#L45-L55 | |
9,149 | pkgcloud/pkgcloud | lib/pkgcloud/openstack/compute/client/extensions/networks-base.js | function (options, properties, callback) {
return this._request({
method: 'POST',
path: this._extension,
body: {
network: _.pick(options, properties)
}
}, function (err, body) {
return err
? callback(err)
: callback(null, body.network);
... | javascript | function (options, properties, callback) {
return this._request({
method: 'POST',
path: this._extension,
body: {
network: _.pick(options, properties)
}
}, function (err, body) {
return err
? callback(err)
: callback(null, body.network);
... | [
"function",
"(",
"options",
",",
"properties",
",",
"callback",
")",
"{",
"return",
"this",
".",
"_request",
"(",
"{",
"method",
":",
"'POST'",
",",
"path",
":",
"this",
".",
"_extension",
",",
"body",
":",
"{",
"network",
":",
"_",
".",
"pick",
"(",... | client._createNetwork
@description helper function for allowing a different set of options to be passed to the
remote API.
@param options
@param {Array} properties Array of properties to be used when building the payload
@param callback
@returns {*}
@private | [
"client",
".",
"_createNetwork"
] | 44e08a0063252829cdb5e9a8b430c2f4c08b91ad | https://github.com/pkgcloud/pkgcloud/blob/44e08a0063252829cdb5e9a8b430c2f4c08b91ad/lib/pkgcloud/openstack/compute/client/extensions/networks-base.js#L95-L107 | |
9,150 | pkgcloud/pkgcloud | lib/pkgcloud/openstack/compute/client/extensions/networks-base.js | function (network, callback) {
var networkId = (typeof network === 'object') ? network.id : network;
return this._request({
path: urlJoin(this._extension, 'add'),
method: 'POST',
body: {
id: networkId
}
}, function (err) {
return callback(err);
... | javascript | function (network, callback) {
var networkId = (typeof network === 'object') ? network.id : network;
return this._request({
path: urlJoin(this._extension, 'add'),
method: 'POST',
body: {
id: networkId
}
}, function (err) {
return callback(err);
... | [
"function",
"(",
"network",
",",
"callback",
")",
"{",
"var",
"networkId",
"=",
"(",
"typeof",
"network",
"===",
"'object'",
")",
"?",
"network",
".",
"id",
":",
"network",
";",
"return",
"this",
".",
"_request",
"(",
"{",
"path",
":",
"urlJoin",
"(",
... | client.addNetwork
@description Add an existing network to a project
@param {String|object} network The network or networkId to add
@param {Function} callback | [
"client",
".",
"addNetwork"
] | 44e08a0063252829cdb5e9a8b430c2f4c08b91ad | https://github.com/pkgcloud/pkgcloud/blob/44e08a0063252829cdb5e9a8b430c2f4c08b91ad/lib/pkgcloud/openstack/compute/client/extensions/networks-base.js#L117-L129 | |
9,151 | pkgcloud/pkgcloud | examples/compute/oneandone.js | handleServerResponse | function handleServerResponse(err, server) {
if (err) {
console.dir(err);
return;
}
console.log('SERVER CREATED: ' + server.name + ', waiting for active status');
// Wait for status: ACTIVE on our server, and then callback
server.setWait({ status: server.STATUS.running }, 5000, function (er... | javascript | function handleServerResponse(err, server) {
if (err) {
console.dir(err);
return;
}
console.log('SERVER CREATED: ' + server.name + ', waiting for active status');
// Wait for status: ACTIVE on our server, and then callback
server.setWait({ status: server.STATUS.running }, 5000, function (er... | [
"function",
"handleServerResponse",
"(",
"err",
",",
"server",
")",
"{",
"if",
"(",
"err",
")",
"{",
"console",
".",
"dir",
"(",
"err",
")",
";",
"return",
";",
"}",
"console",
".",
"log",
"(",
"'SERVER CREATED: '",
"+",
"server",
".",
"name",
"+",
"... | This function will handle our server creation, as well as waiting for the server to come online after we've created it. | [
"This",
"function",
"will",
"handle",
"our",
"server",
"creation",
"as",
"well",
"as",
"waiting",
"for",
"the",
"server",
"to",
"come",
"online",
"after",
"we",
"ve",
"created",
"it",
"."
] | 44e08a0063252829cdb5e9a8b430c2f4c08b91ad | https://github.com/pkgcloud/pkgcloud/blob/44e08a0063252829cdb5e9a8b430c2f4c08b91ad/examples/compute/oneandone.js#L15-L38 |
9,152 | pkgcloud/pkgcloud | lib/pkgcloud/azure/utils/sharedkeytable.js | SharedKeyTable | function SharedKeyTable(storageAccount, storageAccessKey) {
this.storageAccount = storageAccount;
this.storageAccessKey = storageAccessKey;
this.signer = new HmacSha256Sign(storageAccessKey);
} | javascript | function SharedKeyTable(storageAccount, storageAccessKey) {
this.storageAccount = storageAccount;
this.storageAccessKey = storageAccessKey;
this.signer = new HmacSha256Sign(storageAccessKey);
} | [
"function",
"SharedKeyTable",
"(",
"storageAccount",
",",
"storageAccessKey",
")",
"{",
"this",
".",
"storageAccount",
"=",
"storageAccount",
";",
"this",
".",
"storageAccessKey",
"=",
"storageAccessKey",
";",
"this",
".",
"signer",
"=",
"new",
"HmacSha256Sign",
"... | Creates a new SharedKeyTable object.
@constructor
@param {string} storageAccount The storage account.
@param {string} storageAccessKey The storage account's access key. | [
"Creates",
"a",
"new",
"SharedKeyTable",
"object",
"."
] | 44e08a0063252829cdb5e9a8b430c2f4c08b91ad | https://github.com/pkgcloud/pkgcloud/blob/44e08a0063252829cdb5e9a8b430c2f4c08b91ad/lib/pkgcloud/azure/utils/sharedkeytable.js#L29-L33 |
9,153 | pkgcloud/pkgcloud | lib/pkgcloud/rackspace/loadbalancer/client/loadbalancers.js | function(loadBalancer, callback) {
var self = this,
loadBalancerId =
loadBalancer instanceof lb.LoadBalancer ? loadBalancer.id : loadBalancer;
self._request({
path: urlJoin(_urlPrefix, loadBalancerId)
}, function (err, body) {
if (err) {
return callback(err);
}
... | javascript | function(loadBalancer, callback) {
var self = this,
loadBalancerId =
loadBalancer instanceof lb.LoadBalancer ? loadBalancer.id : loadBalancer;
self._request({
path: urlJoin(_urlPrefix, loadBalancerId)
}, function (err, body) {
if (err) {
return callback(err);
}
... | [
"function",
"(",
"loadBalancer",
",",
"callback",
")",
"{",
"var",
"self",
"=",
"this",
",",
"loadBalancerId",
"=",
"loadBalancer",
"instanceof",
"lb",
".",
"LoadBalancer",
"?",
"loadBalancer",
".",
"id",
":",
"loadBalancer",
";",
"self",
".",
"_request",
"(... | client.getLoadBalancer
@description Get the details for the provided load balancer Id
@param {object|String} loadBalancer The loadBalancer or loadBalancer id for the query
@param {function} callback
@returns {*} | [
"client",
".",
"getLoadBalancer"
] | 44e08a0063252829cdb5e9a8b430c2f4c08b91ad | https://github.com/pkgcloud/pkgcloud/blob/44e08a0063252829cdb5e9a8b430c2f4c08b91ad/lib/pkgcloud/rackspace/loadbalancer/client/loadbalancers.js#L120-L140 | |
9,154 | pkgcloud/pkgcloud | lib/pkgcloud/rackspace/loadbalancer/client/loadbalancers.js | function(details, callback) {
var self = this,
createOptions = {
path: _urlPrefix,
method: 'POST',
body: {
name: details.name,
nodes: details.nodes || [],
protocol: details.protocol ? details.protocol.name : '',
port: details.prot... | javascript | function(details, callback) {
var self = this,
createOptions = {
path: _urlPrefix,
method: 'POST',
body: {
name: details.name,
nodes: details.nodes || [],
protocol: details.protocol ? details.protocol.name : '',
port: details.prot... | [
"function",
"(",
"details",
",",
"callback",
")",
"{",
"var",
"self",
"=",
"this",
",",
"createOptions",
"=",
"{",
"path",
":",
"_urlPrefix",
",",
"method",
":",
"'POST'",
",",
"body",
":",
"{",
"name",
":",
"details",
".",
"name",
",",
"nodes",
":",... | client.createLoadBalancer
@description Create a new cloud LoadBalancer. There are a number of options for
cloud load balancers; please reference the Rackspace API documentation for more
insight into the specific parameter values:
http://docs.rackspace.com/loadbalancers/api/v1.0/clb-devguide/content/Create_Load_Balanc... | [
"client",
".",
"createLoadBalancer"
] | 44e08a0063252829cdb5e9a8b430c2f4c08b91ad | https://github.com/pkgcloud/pkgcloud/blob/44e08a0063252829cdb5e9a8b430c2f4c08b91ad/lib/pkgcloud/rackspace/loadbalancer/client/loadbalancers.js#L164-L194 | |
9,155 | pkgcloud/pkgcloud | lib/pkgcloud/rackspace/loadbalancer/client/loadbalancers.js | function (loadBalancer, callback) {
if (!(loadBalancer instanceof lb.LoadBalancer)) {
throw new Error('Missing required argument: loadBalancer');
}
var self = this,
updateOptions = {
path: urlJoin(_urlPrefix, loadBalancer.id),
method: 'PUT',
body: {}
};
upda... | javascript | function (loadBalancer, callback) {
if (!(loadBalancer instanceof lb.LoadBalancer)) {
throw new Error('Missing required argument: loadBalancer');
}
var self = this,
updateOptions = {
path: urlJoin(_urlPrefix, loadBalancer.id),
method: 'PUT',
body: {}
};
upda... | [
"function",
"(",
"loadBalancer",
",",
"callback",
")",
"{",
"if",
"(",
"!",
"(",
"loadBalancer",
"instanceof",
"lb",
".",
"LoadBalancer",
")",
")",
"{",
"throw",
"new",
"Error",
"(",
"'Missing required argument: loadBalancer'",
")",
";",
"}",
"var",
"self",
... | client.updateLoadBalancer
@description updates specific parameters of the load balancer
Specific properties updated: name, protocol, port, timeout,
algorithm, httpsRedirect and halfClosed
@param {Object} loadBalancer
@param {function} callback | [
"client",
".",
"updateLoadBalancer"
] | 44e08a0063252829cdb5e9a8b430c2f4c08b91ad | https://github.com/pkgcloud/pkgcloud/blob/44e08a0063252829cdb5e9a8b430c2f4c08b91ad/lib/pkgcloud/rackspace/loadbalancer/client/loadbalancers.js#L207-L226 | |
9,156 | pkgcloud/pkgcloud | lib/pkgcloud/rackspace/loadbalancer/client/loadbalancers.js | function(loadBalancer, details, callback) {
var self = this,
loadBalancerId =
loadBalancer instanceof lb.LoadBalancer ? loadBalancer.id : loadBalancer;
if (!details || !details.type) {
throw new Error('Details is a required option for loadBalancer health monitors');
}
var reque... | javascript | function(loadBalancer, details, callback) {
var self = this,
loadBalancerId =
loadBalancer instanceof lb.LoadBalancer ? loadBalancer.id : loadBalancer;
if (!details || !details.type) {
throw new Error('Details is a required option for loadBalancer health monitors');
}
var reque... | [
"function",
"(",
"loadBalancer",
",",
"details",
",",
"callback",
")",
"{",
"var",
"self",
"=",
"this",
",",
"loadBalancerId",
"=",
"loadBalancer",
"instanceof",
"lb",
".",
"LoadBalancer",
"?",
"loadBalancer",
".",
"id",
":",
"loadBalancer",
";",
"if",
"(",
... | client.updateHealthMonitor
@description get the current health monitor configuration for a loadBalancer
@param {Object} loadBalancer the loadBalancer or loadBalancerId
@param {Object} details
@param {function} callback
There are two kinds of connection monitors you can enable, CONNECT a... | [
"client",
".",
"updateHealthMonitor"
] | 44e08a0063252829cdb5e9a8b430c2f4c08b91ad | https://github.com/pkgcloud/pkgcloud/blob/44e08a0063252829cdb5e9a8b430c2f4c08b91ad/lib/pkgcloud/rackspace/loadbalancer/client/loadbalancers.js#L589-L633 | |
9,157 | pkgcloud/pkgcloud | lib/pkgcloud/rackspace/loadbalancer/client/loadbalancers.js | function (loadBalancer, type, callback) {
var self = this,
loadBalancerId =
loadBalancer instanceof lb.LoadBalancer ? loadBalancer.id : loadBalancer;
if (!type || (type !== 'HTTP_COOKIE' && type !== 'SOURCE_IP')) {
throw new Error('Please provide a valid session persistence type');
... | javascript | function (loadBalancer, type, callback) {
var self = this,
loadBalancerId =
loadBalancer instanceof lb.LoadBalancer ? loadBalancer.id : loadBalancer;
if (!type || (type !== 'HTTP_COOKIE' && type !== 'SOURCE_IP')) {
throw new Error('Please provide a valid session persistence type');
... | [
"function",
"(",
"loadBalancer",
",",
"type",
",",
"callback",
")",
"{",
"var",
"self",
"=",
"this",
",",
"loadBalancerId",
"=",
"loadBalancer",
"instanceof",
"lb",
".",
"LoadBalancer",
"?",
"loadBalancer",
".",
"id",
":",
"loadBalancer",
";",
"if",
"(",
"... | client.enableSessionPersistence
@description Enable session persistence of the requested type
@param {Object} loadBalancer the loadBalancer or loadBalancerId
@param {String} type HTTP_COOKIE or SOURCE_IP
@param {function} callback | [
"client",
".",
"enableSessionPersistence"
] | 44e08a0063252829cdb5e9a8b430c2f4c08b91ad | https://github.com/pkgcloud/pkgcloud/blob/44e08a0063252829cdb5e9a8b430c2f4c08b91ad/lib/pkgcloud/rackspace/loadbalancer/client/loadbalancers.js#L687-L707 | |
9,158 | pkgcloud/pkgcloud | lib/pkgcloud/rackspace/loadbalancer/client/loadbalancers.js | function (loadBalancer, details, callback) {
var self = this,
loadBalancerId =
loadBalancer instanceof lb.LoadBalancer ? loadBalancer.id : loadBalancer;
var options = _.pick(details, ['maxConnectionRate', 'maxConnections',
'minConnections', 'rateInterval']);
self._request({
p... | javascript | function (loadBalancer, details, callback) {
var self = this,
loadBalancerId =
loadBalancer instanceof lb.LoadBalancer ? loadBalancer.id : loadBalancer;
var options = _.pick(details, ['maxConnectionRate', 'maxConnections',
'minConnections', 'rateInterval']);
self._request({
p... | [
"function",
"(",
"loadBalancer",
",",
"details",
",",
"callback",
")",
"{",
"var",
"self",
"=",
"this",
",",
"loadBalancerId",
"=",
"loadBalancer",
"instanceof",
"lb",
".",
"LoadBalancer",
"?",
"loadBalancer",
".",
"id",
":",
"loadBalancer",
";",
"var",
"opt... | client.updateConnectionThrottle
@description update or add a connection throttle for the provided load balancer
@param {Object} loadBalancer the loadBalancer or loadBalancerId
@param {Object} details the connection throttle details
@param {function} callback
Sample Access List Entry:
... | [
"client",
".",
"updateConnectionThrottle"
] | 44e08a0063252829cdb5e9a8b430c2f4c08b91ad | https://github.com/pkgcloud/pkgcloud/blob/44e08a0063252829cdb5e9a8b430c2f4c08b91ad/lib/pkgcloud/rackspace/loadbalancer/client/loadbalancers.js#L827-L844 | |
9,159 | pkgcloud/pkgcloud | lib/pkgcloud/rackspace/loadbalancer/client/loadbalancers.js | function (startTime, endTime, options, callback) {
var self = this;
if (typeof options === 'function') {
callback = options;
options = {};
}
var requestOpts = {
path: urlJoin(_urlPrefix, 'billable'),
qs: {
startTime: typeof startTime === 'Date' ? startTime.toISOString()... | javascript | function (startTime, endTime, options, callback) {
var self = this;
if (typeof options === 'function') {
callback = options;
options = {};
}
var requestOpts = {
path: urlJoin(_urlPrefix, 'billable'),
qs: {
startTime: typeof startTime === 'Date' ? startTime.toISOString()... | [
"function",
"(",
"startTime",
",",
"endTime",
",",
"options",
",",
"callback",
")",
"{",
"var",
"self",
"=",
"this",
";",
"if",
"(",
"typeof",
"options",
"===",
"'function'",
")",
"{",
"callback",
"=",
"options",
";",
"options",
"=",
"{",
"}",
";",
"... | client.getBillableLoadBalancers
@description gets the billable load balancer within the query limits provided
@param {Date|String} startTime the start time for the query
@param {Date|String} endTime the end time for the query
@param {object} [options]
@param {object} [options.limit... | [
"client",
".",
"getBillableLoadBalancers"
] | 44e08a0063252829cdb5e9a8b430c2f4c08b91ad | https://github.com/pkgcloud/pkgcloud/blob/44e08a0063252829cdb5e9a8b430c2f4c08b91ad/lib/pkgcloud/rackspace/loadbalancer/client/loadbalancers.js#L1033-L1056 | |
9,160 | pkgcloud/pkgcloud | lib/pkgcloud/rackspace/loadbalancer/client/loadbalancers.js | function (startTime, endTime, callback) {
var self = this;
self._request({
path: urlJoin(_urlPrefix, 'usage'),
qs: {
startTime: typeof startTime === 'Date' ? startTime.toISOString() : startTime,
endTime: typeof endTime === 'Date' ? endTime.toISOString() : endTime
}
}, func... | javascript | function (startTime, endTime, callback) {
var self = this;
self._request({
path: urlJoin(_urlPrefix, 'usage'),
qs: {
startTime: typeof startTime === 'Date' ? startTime.toISOString() : startTime,
endTime: typeof endTime === 'Date' ? endTime.toISOString() : endTime
}
}, func... | [
"function",
"(",
"startTime",
",",
"endTime",
",",
"callback",
")",
"{",
"var",
"self",
"=",
"this",
";",
"self",
".",
"_request",
"(",
"{",
"path",
":",
"urlJoin",
"(",
"_urlPrefix",
",",
"'usage'",
")",
",",
"qs",
":",
"{",
"startTime",
":",
"typeo... | client.getAccountUsage
@description lists account level usage
@param {Date|String} startTime the start time for the query
@param {Date|String} endTime the end time for the query
@param {function} callback | [
"client",
".",
"getAccountUsage"
] | 44e08a0063252829cdb5e9a8b430c2f4c08b91ad | https://github.com/pkgcloud/pkgcloud/blob/44e08a0063252829cdb5e9a8b430c2f4c08b91ad/lib/pkgcloud/rackspace/loadbalancer/client/loadbalancers.js#L1067-L1079 | |
9,161 | pkgcloud/pkgcloud | lib/pkgcloud/rackspace/loadbalancer/client/loadbalancers.js | function (callback) {
var self = this;
self._request({
path: urlJoin(_urlPrefix, 'alloweddomains')
}, function (err, body) {
return callback(err, body.allowedDomains);
});
} | javascript | function (callback) {
var self = this;
self._request({
path: urlJoin(_urlPrefix, 'alloweddomains')
}, function (err, body) {
return callback(err, body.allowedDomains);
});
} | [
"function",
"(",
"callback",
")",
"{",
"var",
"self",
"=",
"this",
";",
"self",
".",
"_request",
"(",
"{",
"path",
":",
"urlJoin",
"(",
"_urlPrefix",
",",
"'alloweddomains'",
")",
"}",
",",
"function",
"(",
"err",
",",
"body",
")",
"{",
"return",
"ca... | client.getAllowedDomains
@description gets a list of domains that are available in lieu of IP addresses
when adding nodes to a load balancer
@param {function} callback | [
"client",
".",
"getAllowedDomains"
] | 44e08a0063252829cdb5e9a8b430c2f4c08b91ad | https://github.com/pkgcloud/pkgcloud/blob/44e08a0063252829cdb5e9a8b430c2f4c08b91ad/lib/pkgcloud/rackspace/loadbalancer/client/loadbalancers.js#L1135-L1143 | |
9,162 | pkgcloud/pkgcloud | lib/pkgcloud/azure/utils/sharedkey.js | SharedKey | function SharedKey(storageAccount, storageAccessKey) {
this.storageAccount = storageAccount;
this.storageAccessKey = storageAccessKey;
this.signer = new HmacSha256Sign(storageAccessKey);
} | javascript | function SharedKey(storageAccount, storageAccessKey) {
this.storageAccount = storageAccount;
this.storageAccessKey = storageAccessKey;
this.signer = new HmacSha256Sign(storageAccessKey);
} | [
"function",
"SharedKey",
"(",
"storageAccount",
",",
"storageAccessKey",
")",
"{",
"this",
".",
"storageAccount",
"=",
"storageAccount",
";",
"this",
".",
"storageAccessKey",
"=",
"storageAccessKey",
";",
"this",
".",
"signer",
"=",
"new",
"HmacSha256Sign",
"(",
... | Creates a new SharedKey object.
@constructor
@param {string} storageAccount The storage account.
@param {string} storageAccessKey The storage account's access key. | [
"Creates",
"a",
"new",
"SharedKey",
"object",
"."
] | 44e08a0063252829cdb5e9a8b430c2f4c08b91ad | https://github.com/pkgcloud/pkgcloud/blob/44e08a0063252829cdb5e9a8b430c2f4c08b91ad/lib/pkgcloud/azure/utils/sharedkey.js#L31-L35 |
9,163 | pkgcloud/pkgcloud | lib/pkgcloud/rackspace/loadbalancer/client/nodes.js | function (loadBalancer, callback) {
var self = this,
loadBalancerId =
loadBalancer instanceof lb.LoadBalancer ? loadBalancer.id : loadBalancer;
self._request({
path: urlJoin(_urlPrefix, loadBalancerId, 'nodes')
}, function (err, body, res) {
if (err) {
return callback(... | javascript | function (loadBalancer, callback) {
var self = this,
loadBalancerId =
loadBalancer instanceof lb.LoadBalancer ? loadBalancer.id : loadBalancer;
self._request({
path: urlJoin(_urlPrefix, loadBalancerId, 'nodes')
}, function (err, body, res) {
if (err) {
return callback(... | [
"function",
"(",
"loadBalancer",
",",
"callback",
")",
"{",
"var",
"self",
"=",
"this",
",",
"loadBalancerId",
"=",
"loadBalancer",
"instanceof",
"lb",
".",
"LoadBalancer",
"?",
"loadBalancer",
".",
"id",
":",
"loadBalancer",
";",
"self",
".",
"_request",
"(... | client.getNodes
@description get an array of nodes for the provided load balancer
@param {Object} loadBalancer the loadBalancer or loadBalancerId
@param {function} callback | [
"client",
".",
"getNodes"
] | 44e08a0063252829cdb5e9a8b430c2f4c08b91ad | https://github.com/pkgcloud/pkgcloud/blob/44e08a0063252829cdb5e9a8b430c2f4c08b91ad/lib/pkgcloud/rackspace/loadbalancer/client/nodes.js#L27-L50 | |
9,164 | pkgcloud/pkgcloud | lib/pkgcloud/rackspace/loadbalancer/client/nodes.js | function(loadBalancer, nodes, callback) {
var self = this,
loadBalancerId =
loadBalancer instanceof lb.LoadBalancer ? loadBalancer.id : loadBalancer;
if (!Array.isArray(nodes)) {
nodes = [ nodes ];
}
var postOptions = {
path: urlJoin(_urlPrefix, loadBalancerId, 'nodes'),
... | javascript | function(loadBalancer, nodes, callback) {
var self = this,
loadBalancerId =
loadBalancer instanceof lb.LoadBalancer ? loadBalancer.id : loadBalancer;
if (!Array.isArray(nodes)) {
nodes = [ nodes ];
}
var postOptions = {
path: urlJoin(_urlPrefix, loadBalancerId, 'nodes'),
... | [
"function",
"(",
"loadBalancer",
",",
"nodes",
",",
"callback",
")",
"{",
"var",
"self",
"=",
"this",
",",
"loadBalancerId",
"=",
"loadBalancer",
"instanceof",
"lb",
".",
"LoadBalancer",
"?",
"loadBalancer",
".",
"id",
":",
"loadBalancer",
";",
"if",
"(",
... | client.addNodes
@description add a node or array of nodes to the provided load balancer. Each of the addresses must be unique to this load balancer.
@param {Object} loadBalancer the loadBalancer or loadBalancerId
@param {Object|Array} nodes list of nodes to add
@param {function} ca... | [
"client",
".",
"addNodes"
] | 44e08a0063252829cdb5e9a8b430c2f4c08b91ad | https://github.com/pkgcloud/pkgcloud/blob/44e08a0063252829cdb5e9a8b430c2f4c08b91ad/lib/pkgcloud/rackspace/loadbalancer/client/nodes.js#L71-L106 | |
9,165 | pkgcloud/pkgcloud | lib/pkgcloud/rackspace/loadbalancer/client/nodes.js | function(loadBalancer, node, callback) {
var self = this,
loadBalancerId =
loadBalancer instanceof lb.LoadBalancer ? loadBalancer.id : loadBalancer;
if (!(node instanceof lb.Node) && (typeof node !== 'object')) {
throw new Error('node is a required argument and must be an object');
... | javascript | function(loadBalancer, node, callback) {
var self = this,
loadBalancerId =
loadBalancer instanceof lb.LoadBalancer ? loadBalancer.id : loadBalancer;
if (!(node instanceof lb.Node) && (typeof node !== 'object')) {
throw new Error('node is a required argument and must be an object');
... | [
"function",
"(",
"loadBalancer",
",",
"node",
",",
"callback",
")",
"{",
"var",
"self",
"=",
"this",
",",
"loadBalancerId",
"=",
"loadBalancer",
"instanceof",
"lb",
".",
"LoadBalancer",
"?",
"loadBalancer",
".",
"id",
":",
"loadBalancer",
";",
"if",
"(",
"... | client.updateNode
@description update a node condition, type, or weight
@param {Object} loadBalancer the loadBalancer or loadBalancerId
@param {Object} node the node to update
@param {function} callback | [
"client",
".",
"updateNode"
] | 44e08a0063252829cdb5e9a8b430c2f4c08b91ad | https://github.com/pkgcloud/pkgcloud/blob/44e08a0063252829cdb5e9a8b430c2f4c08b91ad/lib/pkgcloud/rackspace/loadbalancer/client/nodes.js#L117-L135 | |
9,166 | pkgcloud/pkgcloud | lib/pkgcloud/rackspace/loadbalancer/client/nodes.js | function (loadBalancer, node, callback) {
var self = this,
loadBalancerId =
loadBalancer instanceof lb.LoadBalancer ? loadBalancer.id : loadBalancer,
nodeId =
node instanceof lb.Node ? node.id : node;
self._request({
path: urlJoin(_urlPrefix, loadBalancerId, 'nodes', n... | javascript | function (loadBalancer, node, callback) {
var self = this,
loadBalancerId =
loadBalancer instanceof lb.LoadBalancer ? loadBalancer.id : loadBalancer,
nodeId =
node instanceof lb.Node ? node.id : node;
self._request({
path: urlJoin(_urlPrefix, loadBalancerId, 'nodes', n... | [
"function",
"(",
"loadBalancer",
",",
"node",
",",
"callback",
")",
"{",
"var",
"self",
"=",
"this",
",",
"loadBalancerId",
"=",
"loadBalancer",
"instanceof",
"lb",
".",
"LoadBalancer",
"?",
"loadBalancer",
".",
"id",
":",
"loadBalancer",
",",
"nodeId",
"=",... | client.removeNode
@description remove a node from a load balancer
@param {Object} loadBalancer the loadBalancer or loadBalancerId
@param {Object} node the node or nodeId to remove
@param {function} callback | [
"client",
".",
"removeNode"
] | 44e08a0063252829cdb5e9a8b430c2f4c08b91ad | https://github.com/pkgcloud/pkgcloud/blob/44e08a0063252829cdb5e9a8b430c2f4c08b91ad/lib/pkgcloud/rackspace/loadbalancer/client/nodes.js#L146-L159 | |
9,167 | pkgcloud/pkgcloud | lib/pkgcloud/rackspace/loadbalancer/client/nodes.js | function (loadBalancer, nodes, callback) {
var self = this,
loadBalancerId =
loadBalancer instanceof lb.LoadBalancer ? loadBalancer.id : loadBalancer;
// check for valid inputs
if (!nodes || nodes.length === 0 || !Array.isArray(nodes)) {
throw new Error('nodes must be an array of No... | javascript | function (loadBalancer, nodes, callback) {
var self = this,
loadBalancerId =
loadBalancer instanceof lb.LoadBalancer ? loadBalancer.id : loadBalancer;
// check for valid inputs
if (!nodes || nodes.length === 0 || !Array.isArray(nodes)) {
throw new Error('nodes must be an array of No... | [
"function",
"(",
"loadBalancer",
",",
"nodes",
",",
"callback",
")",
"{",
"var",
"self",
"=",
"this",
",",
"loadBalancerId",
"=",
"loadBalancer",
"instanceof",
"lb",
".",
"LoadBalancer",
"?",
"loadBalancer",
".",
"id",
":",
"loadBalancer",
";",
"// check for v... | client.removeNodes
@description remove an array of nodes or nodeIds from a load balancer
@param {Object} loadBalancer the loadBalancer or loadBalancerId
@param {Array} nodes the nodes or nodeIds to remove
@param {function} callback | [
"client",
".",
"removeNodes"
] | 44e08a0063252829cdb5e9a8b430c2f4c08b91ad | https://github.com/pkgcloud/pkgcloud/blob/44e08a0063252829cdb5e9a8b430c2f4c08b91ad/lib/pkgcloud/rackspace/loadbalancer/client/nodes.js#L170-L191 | |
9,168 | pkgcloud/pkgcloud | lib/pkgcloud/rackspace/loadbalancer/client/nodes.js | function (loadBalancer, callback) {
var self = this,
loadBalancerId =
loadBalancer instanceof lb.LoadBalancer ? loadBalancer.id : loadBalancer;
self._request({
path: urlJoin(_urlPrefix, loadBalancerId, 'nodes', 'events')
}, function (err, body) {
return err
? callback(... | javascript | function (loadBalancer, callback) {
var self = this,
loadBalancerId =
loadBalancer instanceof lb.LoadBalancer ? loadBalancer.id : loadBalancer;
self._request({
path: urlJoin(_urlPrefix, loadBalancerId, 'nodes', 'events')
}, function (err, body) {
return err
? callback(... | [
"function",
"(",
"loadBalancer",
",",
"callback",
")",
"{",
"var",
"self",
"=",
"this",
",",
"loadBalancerId",
"=",
"loadBalancer",
"instanceof",
"lb",
".",
"LoadBalancer",
"?",
"loadBalancer",
".",
"id",
":",
"loadBalancer",
";",
"self",
".",
"_request",
"(... | client.getNodeServiceEvents
@description retrieve a list of events associated with the activity
between the node and the load balancer
@param {Object} loadBalancer the loadBalancer or loadBalancerId
@param {function} callback | [
"client",
".",
"getNodeServiceEvents"
] | 44e08a0063252829cdb5e9a8b430c2f4c08b91ad | https://github.com/pkgcloud/pkgcloud/blob/44e08a0063252829cdb5e9a8b430c2f4c08b91ad/lib/pkgcloud/rackspace/loadbalancer/client/nodes.js#L202-L214 | |
9,169 | emailjs/emailjs-imap-client | dist/command-parser.js | encodeAddressName | function encodeAddressName(name) {
if (!/^[\w ']*$/.test(name)) {
if (/^[\x20-\x7e]*$/.test(name)) {
return JSON.stringify(name);
} else {
return (0, _emailjsMimeCodec.mimeWordEncode)(name, 'Q', 52);
}
}
return name;
} | javascript | function encodeAddressName(name) {
if (!/^[\w ']*$/.test(name)) {
if (/^[\x20-\x7e]*$/.test(name)) {
return JSON.stringify(name);
} else {
return (0, _emailjsMimeCodec.mimeWordEncode)(name, 'Q', 52);
}
}
return name;
} | [
"function",
"encodeAddressName",
"(",
"name",
")",
"{",
"if",
"(",
"!",
"/",
"^[\\w ']*$",
"/",
".",
"test",
"(",
"name",
")",
")",
"{",
"if",
"(",
"/",
"^[\\x20-\\x7e]*$",
"/",
".",
"test",
"(",
"name",
")",
")",
"{",
"return",
"JSON",
".",
"strin... | If needed, encloses with quotes or mime encodes the name part of an e-mail address
@param {String} name Name part of an address
@returns {String} Mime word encoded or quoted string | [
"If",
"needed",
"encloses",
"with",
"quotes",
"or",
"mime",
"encodes",
"the",
"name",
"part",
"of",
"an",
"e",
"-",
"mail",
"address"
] | 32e768c83afe7a75433e1617b16e48eff318a957 | https://github.com/emailjs/emailjs-imap-client/blob/32e768c83afe7a75433e1617b16e48eff318a957/dist/command-parser.js#L201-L210 |
9,170 | emailjs/emailjs-imap-client | src/command-parser.js | parseFetchValue | function parseFetchValue (key, value) {
if (!value) {
return null
}
if (!Array.isArray(value)) {
switch (key) {
case 'uid':
case 'rfc822.size':
return Number(value.value) || 0
case 'modseq': // do not cast 64 bit uint to a number
return value.value || '0'
}
retur... | javascript | function parseFetchValue (key, value) {
if (!value) {
return null
}
if (!Array.isArray(value)) {
switch (key) {
case 'uid':
case 'rfc822.size':
return Number(value.value) || 0
case 'modseq': // do not cast 64 bit uint to a number
return value.value || '0'
}
retur... | [
"function",
"parseFetchValue",
"(",
"key",
",",
"value",
")",
"{",
"if",
"(",
"!",
"value",
")",
"{",
"return",
"null",
"}",
"if",
"(",
"!",
"Array",
".",
"isArray",
"(",
"value",
")",
")",
"{",
"switch",
"(",
"key",
")",
"{",
"case",
"'uid'",
":... | Parses a single value from the FETCH response object
@param {String} key Key name (uppercase)
@param {Mized} value Value for the key
@return {Mixed} Processed value | [
"Parses",
"a",
"single",
"value",
"from",
"the",
"FETCH",
"response",
"object"
] | 32e768c83afe7a75433e1617b16e48eff318a957 | https://github.com/emailjs/emailjs-imap-client/blob/32e768c83afe7a75433e1617b16e48eff318a957/src/command-parser.js#L400-L433 |
9,171 | emailjs/emailjs-imap-client | dist/command-builder.js | buildFETCHCommand | function buildFETCHCommand(sequence, items, options) {
let command = {
command: options.byUid ? 'UID FETCH' : 'FETCH',
attributes: [{
type: 'SEQUENCE',
value: sequence
}]
};
if (options.valueAsString !== undefined) {
command.valueAsString = options.valueAsString;
}
let query = []... | javascript | function buildFETCHCommand(sequence, items, options) {
let command = {
command: options.byUid ? 'UID FETCH' : 'FETCH',
attributes: [{
type: 'SEQUENCE',
value: sequence
}]
};
if (options.valueAsString !== undefined) {
command.valueAsString = options.valueAsString;
}
let query = []... | [
"function",
"buildFETCHCommand",
"(",
"sequence",
",",
"items",
",",
"options",
")",
"{",
"let",
"command",
"=",
"{",
"command",
":",
"options",
".",
"byUid",
"?",
"'UID FETCH'",
":",
"'FETCH'",
",",
"attributes",
":",
"[",
"{",
"type",
":",
"'SEQUENCE'",
... | Builds a FETCH command
@param {String} sequence Message range selector
@param {Array} items List of elements to fetch (eg. `['uid', 'envelope']`).
@param {Object} [options] Optional options object. Use `{byUid:true}` for `UID FETCH`
@returns {Object} Structured IMAP command | [
"Builds",
"a",
"FETCH",
"command"
] | 32e768c83afe7a75433e1617b16e48eff318a957 | https://github.com/emailjs/emailjs-imap-client/blob/32e768c83afe7a75433e1617b16e48eff318a957/dist/command-builder.js#L27-L83 |
9,172 | emailjs/emailjs-imap-client | dist/command-builder.js | buildXOAuth2Token | function buildXOAuth2Token(user = '', token) {
let authData = [`user=${user}`, `auth=Bearer ${token}`, '', ''];
return (0, _emailjsBase.encode)(authData.join('\x01'));
} | javascript | function buildXOAuth2Token(user = '', token) {
let authData = [`user=${user}`, `auth=Bearer ${token}`, '', ''];
return (0, _emailjsBase.encode)(authData.join('\x01'));
} | [
"function",
"buildXOAuth2Token",
"(",
"user",
"=",
"''",
",",
"token",
")",
"{",
"let",
"authData",
"=",
"[",
"`",
"${",
"user",
"}",
"`",
",",
"`",
"${",
"token",
"}",
"`",
",",
"''",
",",
"''",
"]",
";",
"return",
"(",
"0",
",",
"_emailjsBase",... | Builds a login token for XOAUTH2 authentication command
@param {String} user E-mail address of the user
@param {String} token Valid access token for the user
@return {String} Base64 formatted login token | [
"Builds",
"a",
"login",
"token",
"for",
"XOAUTH2",
"authentication",
"command"
] | 32e768c83afe7a75433e1617b16e48eff318a957 | https://github.com/emailjs/emailjs-imap-client/blob/32e768c83afe7a75433e1617b16e48eff318a957/dist/command-builder.js#L92-L95 |
9,173 | emailjs/emailjs-imap-client | dist/command-builder.js | buildSTORECommand | function buildSTORECommand(sequence, action = '', flags = [], options = {}) {
let command = {
command: options.byUid ? 'UID STORE' : 'STORE',
attributes: [{
type: 'sequence',
value: sequence
}]
};
command.attributes.push({
type: 'atom',
value: action.toUpperCase() + (options.silen... | javascript | function buildSTORECommand(sequence, action = '', flags = [], options = {}) {
let command = {
command: options.byUid ? 'UID STORE' : 'STORE',
attributes: [{
type: 'sequence',
value: sequence
}]
};
command.attributes.push({
type: 'atom',
value: action.toUpperCase() + (options.silen... | [
"function",
"buildSTORECommand",
"(",
"sequence",
",",
"action",
"=",
"''",
",",
"flags",
"=",
"[",
"]",
",",
"options",
"=",
"{",
"}",
")",
"{",
"let",
"command",
"=",
"{",
"command",
":",
"options",
".",
"byUid",
"?",
"'UID STORE'",
":",
"'STORE'",
... | Creates an IMAP STORE command from the selected arguments | [
"Creates",
"an",
"IMAP",
"STORE",
"command",
"from",
"the",
"selected",
"arguments"
] | 32e768c83afe7a75433e1617b16e48eff318a957 | https://github.com/emailjs/emailjs-imap-client/blob/32e768c83afe7a75433e1617b16e48eff318a957/dist/command-builder.js#L217-L239 |
9,174 | davidkpiano/react-redux-form | src/utils/shallow-equal.js | shallowEqual | function shallowEqual(objA, objB, options = {}) {
if (is(objA, objB)) {
return true;
}
if ((typeof objA === 'undefined' ? 'undefined' : _typeof(objA)) !== 'object' || objA === null || (typeof objB === 'undefined' ? 'undefined' : _typeof(objB)) !== 'object' || objB === null) {
return false;
}
if(objA... | javascript | function shallowEqual(objA, objB, options = {}) {
if (is(objA, objB)) {
return true;
}
if ((typeof objA === 'undefined' ? 'undefined' : _typeof(objA)) !== 'object' || objA === null || (typeof objB === 'undefined' ? 'undefined' : _typeof(objB)) !== 'object' || objB === null) {
return false;
}
if(objA... | [
"function",
"shallowEqual",
"(",
"objA",
",",
"objB",
",",
"options",
"=",
"{",
"}",
")",
"{",
"if",
"(",
"is",
"(",
"objA",
",",
"objB",
")",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"(",
"typeof",
"objA",
"===",
"'undefined'",
"?",
"'un... | Performs equality by iterating through keys on an object and returning false
when any key has values which are not strictly equal between the arguments.
Returns true when the values of all keys are strictly equal. | [
"Performs",
"equality",
"by",
"iterating",
"through",
"keys",
"on",
"an",
"object",
"and",
"returning",
"false",
"when",
"any",
"key",
"has",
"values",
"which",
"are",
"not",
"strictly",
"equal",
"between",
"the",
"arguments",
".",
"Returns",
"true",
"when",
... | 57028979c87e6f377104bf4069ff951e1a9faa19 | https://github.com/davidkpiano/react-redux-form/blob/57028979c87e6f377104bf4069ff951e1a9faa19/src/utils/shallow-equal.js#L32-L73 |
9,175 | node-influx/node-influx | examples/esdoc-plugin.js | rewriteFonts | function rewriteFonts () {
const style = path.join(target, 'css', 'style.css')
const css = fs.readFileSync(style)
.toString()
.replace(/@import url\(.*?Roboto.*?\);/, `@import url('https://fonts.googleapis.com/css?family=Open+Sans:400,600|Source+Code+Pro:400,600');`)
.replace(/Roboto/g, 'Open Sans')
... | javascript | function rewriteFonts () {
const style = path.join(target, 'css', 'style.css')
const css = fs.readFileSync(style)
.toString()
.replace(/@import url\(.*?Roboto.*?\);/, `@import url('https://fonts.googleapis.com/css?family=Open+Sans:400,600|Source+Code+Pro:400,600');`)
.replace(/Roboto/g, 'Open Sans')
... | [
"function",
"rewriteFonts",
"(",
")",
"{",
"const",
"style",
"=",
"path",
".",
"join",
"(",
"target",
",",
"'css'",
",",
"'style.css'",
")",
"const",
"css",
"=",
"fs",
".",
"readFileSync",
"(",
"style",
")",
".",
"toString",
"(",
")",
".",
"replace",
... | Rewrites the fonts in the output CSS to replace them with our own.
Do this instead of overriding for load times and reduction in hackery. | [
"Rewrites",
"the",
"fonts",
"in",
"the",
"output",
"CSS",
"to",
"replace",
"them",
"with",
"our",
"own",
".",
"Do",
"this",
"instead",
"of",
"overriding",
"for",
"load",
"times",
"and",
"reduction",
"in",
"hackery",
"."
] | 54c6ddf19da033334c526da9416bbc7a0cd71859 | https://github.com/node-influx/node-influx/blob/54c6ddf19da033334c526da9416bbc7a0cd71859/examples/esdoc-plugin.js#L10-L48 |
9,176 | apocas/dockerode | examples/exec_running_container.js | runExec | function runExec(container) {
var options = {
Cmd: ['bash', '-c', 'echo test $VAR'],
Env: ['VAR=ttslkfjsdalkfj'],
AttachStdout: true,
AttachStderr: true
};
container.exec(options, function(err, exec) {
if (err) return;
exec.start(function(err, stream) {
if (err) return;
cont... | javascript | function runExec(container) {
var options = {
Cmd: ['bash', '-c', 'echo test $VAR'],
Env: ['VAR=ttslkfjsdalkfj'],
AttachStdout: true,
AttachStderr: true
};
container.exec(options, function(err, exec) {
if (err) return;
exec.start(function(err, stream) {
if (err) return;
cont... | [
"function",
"runExec",
"(",
"container",
")",
"{",
"var",
"options",
"=",
"{",
"Cmd",
":",
"[",
"'bash'",
",",
"'-c'",
",",
"'echo test $VAR'",
"]",
",",
"Env",
":",
"[",
"'VAR=ttslkfjsdalkfj'",
"]",
",",
"AttachStdout",
":",
"true",
",",
"AttachStderr",
... | Get env list from running container
@param container | [
"Get",
"env",
"list",
"from",
"running",
"container"
] | 5ac15d82be325173c6f42c3e7b1d13a61a6d4bf1 | https://github.com/apocas/dockerode/blob/5ac15d82be325173c6f42c3e7b1d13a61a6d4bf1/examples/exec_running_container.js#L11-L33 |
9,177 | apocas/dockerode | lib/plugin.js | function(modem, name, remote) {
this.modem = modem;
this.name = name;
this.remote = remote || name;
} | javascript | function(modem, name, remote) {
this.modem = modem;
this.name = name;
this.remote = remote || name;
} | [
"function",
"(",
"modem",
",",
"name",
",",
"remote",
")",
"{",
"this",
".",
"modem",
"=",
"modem",
";",
"this",
".",
"name",
"=",
"name",
";",
"this",
".",
"remote",
"=",
"remote",
"||",
"name",
";",
"}"
] | Represents a plugin
@param {Object} modem docker-modem
@param {String} name Plugin's name | [
"Represents",
"a",
"plugin"
] | 5ac15d82be325173c6f42c3e7b1d13a61a6d4bf1 | https://github.com/apocas/dockerode/blob/5ac15d82be325173c6f42c3e7b1d13a61a6d4bf1/lib/plugin.js#L8-L12 | |
9,178 | apocas/dockerode | examples/logs.js | containerLogs | function containerLogs(container) {
// create a single stream for stdin and stdout
var logStream = new stream.PassThrough();
logStream.on('data', function(chunk){
console.log(chunk.toString('utf8'));
});
container.logs({
follow: true,
stdout: true,
stderr: true
}, function(err, stream){
... | javascript | function containerLogs(container) {
// create a single stream for stdin and stdout
var logStream = new stream.PassThrough();
logStream.on('data', function(chunk){
console.log(chunk.toString('utf8'));
});
container.logs({
follow: true,
stdout: true,
stderr: true
}, function(err, stream){
... | [
"function",
"containerLogs",
"(",
"container",
")",
"{",
"// create a single stream for stdin and stdout",
"var",
"logStream",
"=",
"new",
"stream",
".",
"PassThrough",
"(",
")",
";",
"logStream",
".",
"on",
"(",
"'data'",
",",
"function",
"(",
"chunk",
")",
"{"... | Get logs from running container | [
"Get",
"logs",
"from",
"running",
"container"
] | 5ac15d82be325173c6f42c3e7b1d13a61a6d4bf1 | https://github.com/apocas/dockerode/blob/5ac15d82be325173c6f42c3e7b1d13a61a6d4bf1/examples/logs.js#L11-L36 |
9,179 | felixrieseberg/npm-windows-upgrade | src/find-npm.js | _getPathFromPowerShell | function _getPathFromPowerShell () {
return new Promise(resolve => {
const psArgs = 'Get-Command npm | Select-Object -ExpandProperty Definition'
const args = [ '-NoProfile', '-NoLogo', psArgs ]
const child = spawn('powershell.exe', args)
let stdout = []
let stderr = []
child.stdout.on('data'... | javascript | function _getPathFromPowerShell () {
return new Promise(resolve => {
const psArgs = 'Get-Command npm | Select-Object -ExpandProperty Definition'
const args = [ '-NoProfile', '-NoLogo', psArgs ]
const child = spawn('powershell.exe', args)
let stdout = []
let stderr = []
child.stdout.on('data'... | [
"function",
"_getPathFromPowerShell",
"(",
")",
"{",
"return",
"new",
"Promise",
"(",
"resolve",
"=>",
"{",
"const",
"psArgs",
"=",
"'Get-Command npm | Select-Object -ExpandProperty Definition'",
"const",
"args",
"=",
"[",
"'-NoProfile'",
",",
"'-NoLogo'",
",",
"psArg... | Attempts to get npm's path by calling out to "Get-Command npm"
@returns {Promise.<string>} - Promise that resolves with the found path (or null if not found) | [
"Attempts",
"to",
"get",
"npm",
"s",
"path",
"by",
"calling",
"out",
"to",
"Get",
"-",
"Command",
"npm"
] | 763c2ff750f65dfbef5dbc48b131a6af897f1a35 | https://github.com/felixrieseberg/npm-windows-upgrade/blob/763c2ff750f65dfbef5dbc48b131a6af897f1a35/src/find-npm.js#L33-L68 |
9,180 | felixrieseberg/npm-windows-upgrade | src/find-npm.js | _getPath | function _getPath () {
return Promise.all([_getPathFromPowerShell(), _getPathFromNpm()])
.then((results) => {
const fromNpm = results[1] || ''
const fromPowershell = results[0] || ''
// Quickly check if there's an npm folder in there
const fromPowershellPath = path.join(fromPowershell, 'n... | javascript | function _getPath () {
return Promise.all([_getPathFromPowerShell(), _getPathFromNpm()])
.then((results) => {
const fromNpm = results[1] || ''
const fromPowershell = results[0] || ''
// Quickly check if there's an npm folder in there
const fromPowershellPath = path.join(fromPowershell, 'n... | [
"function",
"_getPath",
"(",
")",
"{",
"return",
"Promise",
".",
"all",
"(",
"[",
"_getPathFromPowerShell",
"(",
")",
",",
"_getPathFromNpm",
"(",
")",
"]",
")",
".",
"then",
"(",
"(",
"results",
")",
"=>",
"{",
"const",
"fromNpm",
"=",
"results",
"[",... | Attempts to get the current installation location of npm by looking up the global prefix.
Prefer PowerShell, be falls back to npm's opinion
@return {Promise.<string>} - NodeJS installation path | [
"Attempts",
"to",
"get",
"the",
"current",
"installation",
"location",
"of",
"npm",
"by",
"looking",
"up",
"the",
"global",
"prefix",
".",
"Prefer",
"PowerShell",
"be",
"falls",
"back",
"to",
"npm",
"s",
"opinion"
] | 763c2ff750f65dfbef5dbc48b131a6af897f1a35 | https://github.com/felixrieseberg/npm-windows-upgrade/blob/763c2ff750f65dfbef5dbc48b131a6af897f1a35/src/find-npm.js#L76-L109 |
9,181 | felixrieseberg/npm-windows-upgrade | src/powershell.js | runUpgrade | function runUpgrade (version, npmPath) {
return new Promise((resolve, reject) => {
const scriptPath = path.resolve(__dirname, '../powershell/upgrade-npm.ps1')
const psArgs = npmPath === null
? `& {& '${scriptPath}' -version '${version}' }`
: `& {& '${scriptPath}' -version '${version}' -NodePath '$... | javascript | function runUpgrade (version, npmPath) {
return new Promise((resolve, reject) => {
const scriptPath = path.resolve(__dirname, '../powershell/upgrade-npm.ps1')
const psArgs = npmPath === null
? `& {& '${scriptPath}' -version '${version}' }`
: `& {& '${scriptPath}' -version '${version}' -NodePath '$... | [
"function",
"runUpgrade",
"(",
"version",
",",
"npmPath",
")",
"{",
"return",
"new",
"Promise",
"(",
"(",
"resolve",
",",
"reject",
")",
"=>",
"{",
"const",
"scriptPath",
"=",
"path",
".",
"resolve",
"(",
"__dirname",
",",
"'../powershell/upgrade-npm.ps1'",
... | Executes the PS1 script upgrading npm
@param {string} version - The version to be installed (npm install npm@{version})
@param {string} npmPath - Path to Node installation (optional)
@return {Promise.<stderr[], stdout[]>} - stderr and stdout received from the PS1 process | [
"Executes",
"the",
"PS1",
"script",
"upgrading",
"npm"
] | 763c2ff750f65dfbef5dbc48b131a6af897f1a35 | https://github.com/felixrieseberg/npm-windows-upgrade/blob/763c2ff750f65dfbef5dbc48b131a6af897f1a35/src/powershell.js#L12-L47 |
9,182 | felixrieseberg/npm-windows-upgrade | src/powershell.js | runSimpleUpgrade | function runSimpleUpgrade (version) {
return new Promise((resolve) => {
let npmCommand = (version) ? `npm install -g npm@${version}` : 'npm install -g npm'
let stdout = []
let stderr = []
let child
try {
child = spawn('powershell.exe', [ '-NoProfile', '-NoLogo', npmCommand ])
} catch (e... | javascript | function runSimpleUpgrade (version) {
return new Promise((resolve) => {
let npmCommand = (version) ? `npm install -g npm@${version}` : 'npm install -g npm'
let stdout = []
let stderr = []
let child
try {
child = spawn('powershell.exe', [ '-NoProfile', '-NoLogo', npmCommand ])
} catch (e... | [
"function",
"runSimpleUpgrade",
"(",
"version",
")",
"{",
"return",
"new",
"Promise",
"(",
"(",
"resolve",
")",
"=>",
"{",
"let",
"npmCommand",
"=",
"(",
"version",
")",
"?",
"`",
"${",
"version",
"}",
"`",
":",
"'npm install -g npm'",
"let",
"stdout",
"... | Executes 'npm install -g npm' upgrading npm
@param {string} version - The version to be installed (npm install npm@{version})
@return {Promise.<stderr[], stdout[]>} - stderr and stdout received from the PS1 process | [
"Executes",
"npm",
"install",
"-",
"g",
"npm",
"upgrading",
"npm"
] | 763c2ff750f65dfbef5dbc48b131a6af897f1a35 | https://github.com/felixrieseberg/npm-windows-upgrade/blob/763c2ff750f65dfbef5dbc48b131a6af897f1a35/src/powershell.js#L54-L75 |
9,183 | felixrieseberg/npm-windows-upgrade | src/utils.js | exit | function exit (status, ...messages) {
if (messages) {
messages.forEach(message => console.log(message))
}
process.exit(status)
} | javascript | function exit (status, ...messages) {
if (messages) {
messages.forEach(message => console.log(message))
}
process.exit(status)
} | [
"function",
"exit",
"(",
"status",
",",
"...",
"messages",
")",
"{",
"if",
"(",
"messages",
")",
"{",
"messages",
".",
"forEach",
"(",
"message",
"=>",
"console",
".",
"log",
"(",
"message",
")",
")",
"}",
"process",
".",
"exit",
"(",
"status",
")",
... | Exits the process with a given status,
logging a given message before exiting.
@param {number} status - exit status
@param {string} messages - message to log | [
"Exits",
"the",
"process",
"with",
"a",
"given",
"status",
"logging",
"a",
"given",
"message",
"before",
"exiting",
"."
] | 763c2ff750f65dfbef5dbc48b131a6af897f1a35 | https://github.com/felixrieseberg/npm-windows-upgrade/blob/763c2ff750f65dfbef5dbc48b131a6af897f1a35/src/utils.js#L14-L20 |
9,184 | felixrieseberg/npm-windows-upgrade | src/utils.js | checkExecutionPolicy | function checkExecutionPolicy () {
return new Promise((resolve, reject) => {
let output = []
let child
try {
debug('Powershell: Attempting to spawn PowerShell child')
child = spawn('powershell.exe', ['-NoProfile', '-NoLogo', 'Get-ExecutionPolicy'])
} catch (error) {
debug('Powershel... | javascript | function checkExecutionPolicy () {
return new Promise((resolve, reject) => {
let output = []
let child
try {
debug('Powershell: Attempting to spawn PowerShell child')
child = spawn('powershell.exe', ['-NoProfile', '-NoLogo', 'Get-ExecutionPolicy'])
} catch (error) {
debug('Powershel... | [
"function",
"checkExecutionPolicy",
"(",
")",
"{",
"return",
"new",
"Promise",
"(",
"(",
"resolve",
",",
"reject",
")",
"=>",
"{",
"let",
"output",
"=",
"[",
"]",
"let",
"child",
"try",
"{",
"debug",
"(",
"'Powershell: Attempting to spawn PowerShell child'",
"... | Checks the current Windows PS1 execution policy. The upgrader requires an unrestricted policy.
@return {Promise.<boolean>} - True if unrestricted, false if it isn't | [
"Checks",
"the",
"current",
"Windows",
"PS1",
"execution",
"policy",
".",
"The",
"upgrader",
"requires",
"an",
"unrestricted",
"policy",
"."
] | 763c2ff750f65dfbef5dbc48b131a6af897f1a35 | https://github.com/felixrieseberg/npm-windows-upgrade/blob/763c2ff750f65dfbef5dbc48b131a6af897f1a35/src/utils.js#L44-L82 |
9,185 | felixrieseberg/npm-windows-upgrade | src/utils.js | isPathAccessible | function isPathAccessible (filePath) {
try {
fs.accessSync(filePath)
debug(`Utils: isPathAccessible(): ${filePath} exists`)
return true
} catch (err) {
debug(`Utils: isPathAccessible(): ${filePath} does not exist`)
return false
}
} | javascript | function isPathAccessible (filePath) {
try {
fs.accessSync(filePath)
debug(`Utils: isPathAccessible(): ${filePath} exists`)
return true
} catch (err) {
debug(`Utils: isPathAccessible(): ${filePath} does not exist`)
return false
}
} | [
"function",
"isPathAccessible",
"(",
"filePath",
")",
"{",
"try",
"{",
"fs",
".",
"accessSync",
"(",
"filePath",
")",
"debug",
"(",
"`",
"${",
"filePath",
"}",
"`",
")",
"return",
"true",
"}",
"catch",
"(",
"err",
")",
"{",
"debug",
"(",
"`",
"${",
... | Checks if a path exists
@param filePath - file path to check
@returns {boolean} - does the file path exist? | [
"Checks",
"if",
"a",
"path",
"exists"
] | 763c2ff750f65dfbef5dbc48b131a6af897f1a35 | https://github.com/felixrieseberg/npm-windows-upgrade/blob/763c2ff750f65dfbef5dbc48b131a6af897f1a35/src/utils.js#L90-L99 |
9,186 | felixrieseberg/npm-windows-upgrade | src/versions.js | getAvailableNPMVersions | function getAvailableNPMVersions () {
return new Promise((resolve, reject) => {
exec('npm view npm versions --json', (err, stdout) => {
if (err) {
let error = 'We could not show latest available versions. Try running this script again '
error += 'with the version you want to install (npm-win... | javascript | function getAvailableNPMVersions () {
return new Promise((resolve, reject) => {
exec('npm view npm versions --json', (err, stdout) => {
if (err) {
let error = 'We could not show latest available versions. Try running this script again '
error += 'with the version you want to install (npm-win... | [
"function",
"getAvailableNPMVersions",
"(",
")",
"{",
"return",
"new",
"Promise",
"(",
"(",
"resolve",
",",
"reject",
")",
"=>",
"{",
"exec",
"(",
"'npm view npm versions --json'",
",",
"(",
"err",
",",
"stdout",
")",
"=>",
"{",
"if",
"(",
"err",
")",
"{... | Fetches the published versions of npm from the npm registry
@return {Promise.<versions[]>} - Array of the available versions | [
"Fetches",
"the",
"published",
"versions",
"of",
"npm",
"from",
"the",
"npm",
"registry"
] | 763c2ff750f65dfbef5dbc48b131a6af897f1a35 | https://github.com/felixrieseberg/npm-windows-upgrade/blob/763c2ff750f65dfbef5dbc48b131a6af897f1a35/src/versions.js#L27-L39 |
9,187 | felixrieseberg/npm-windows-upgrade | src/versions.js | _getWindowsVersion | function _getWindowsVersion () {
return new Promise((resolve, reject) => {
const command = 'systeminfo | findstr /B /C:"OS Name" /C:"OS Version"'
exec(command, (error, stdout) => {
if (error) {
reject(error)
} else {
resolve(stdout)
}
})
})
} | javascript | function _getWindowsVersion () {
return new Promise((resolve, reject) => {
const command = 'systeminfo | findstr /B /C:"OS Name" /C:"OS Version"'
exec(command, (error, stdout) => {
if (error) {
reject(error)
} else {
resolve(stdout)
}
})
})
} | [
"function",
"_getWindowsVersion",
"(",
")",
"{",
"return",
"new",
"Promise",
"(",
"(",
"resolve",
",",
"reject",
")",
"=>",
"{",
"const",
"command",
"=",
"'systeminfo | findstr /B /C:\"OS Name\" /C:\"OS Version\"'",
"exec",
"(",
"command",
",",
"(",
"error",
",",
... | Get the current name and version of Windows | [
"Get",
"the",
"current",
"name",
"and",
"version",
"of",
"Windows"
] | 763c2ff750f65dfbef5dbc48b131a6af897f1a35 | https://github.com/felixrieseberg/npm-windows-upgrade/blob/763c2ff750f65dfbef5dbc48b131a6af897f1a35/src/versions.js#L64-L75 |
9,188 | felixrieseberg/npm-windows-upgrade | src/versions.js | getVersions | async function getVersions () {
let versions = process.versions
let prettyVersions = []
versions.os = process.platform + ' ' + process.arch
for (let variable in versions) {
if (versions.hasOwnProperty(variable)) {
prettyVersions.push(`${variable}: ${versions[variable]}`)
}
}
try {
const ... | javascript | async function getVersions () {
let versions = process.versions
let prettyVersions = []
versions.os = process.platform + ' ' + process.arch
for (let variable in versions) {
if (versions.hasOwnProperty(variable)) {
prettyVersions.push(`${variable}: ${versions[variable]}`)
}
}
try {
const ... | [
"async",
"function",
"getVersions",
"(",
")",
"{",
"let",
"versions",
"=",
"process",
".",
"versions",
"let",
"prettyVersions",
"=",
"[",
"]",
"versions",
".",
"os",
"=",
"process",
".",
"platform",
"+",
"' '",
"+",
"process",
".",
"arch",
"for",
"(",
... | Get installed versions of virtually everything important | [
"Get",
"installed",
"versions",
"of",
"virtually",
"everything",
"important"
] | 763c2ff750f65dfbef5dbc48b131a6af897f1a35 | https://github.com/felixrieseberg/npm-windows-upgrade/blob/763c2ff750f65dfbef5dbc48b131a6af897f1a35/src/versions.js#L80-L101 |
9,189 | wix/angular-tree-control | demo/ui-bootstrap-tpls.0.11.2.js | function (hostEl, targetEl, positionStr, appendToBody) {
var positionStrParts = positionStr.split('-');
var pos0 = positionStrParts[0], pos1 = positionStrParts[1] || 'center';
var hostElPos,
targetElWidth,
targetElHeight,
targetElPos;
hostElPos = appendTo... | javascript | function (hostEl, targetEl, positionStr, appendToBody) {
var positionStrParts = positionStr.split('-');
var pos0 = positionStrParts[0], pos1 = positionStrParts[1] || 'center';
var hostElPos,
targetElWidth,
targetElHeight,
targetElPos;
hostElPos = appendTo... | [
"function",
"(",
"hostEl",
",",
"targetEl",
",",
"positionStr",
",",
"appendToBody",
")",
"{",
"var",
"positionStrParts",
"=",
"positionStr",
".",
"split",
"(",
"'-'",
")",
";",
"var",
"pos0",
"=",
"positionStrParts",
"[",
"0",
"]",
",",
"pos1",
"=",
"po... | Provides coordinates for the targetEl in relation to hostEl | [
"Provides",
"coordinates",
"for",
"the",
"targetEl",
"in",
"relation",
"to",
"hostEl"
] | 5bcedace8bcf135ec47d06a6549c802185318196 | https://github.com/wix/angular-tree-control/blob/5bcedace8bcf135ec47d06a6549c802185318196/demo/ui-bootstrap-tpls.0.11.2.js#L908-L975 | |
9,190 | wix/angular-tree-control | demo/ui-bootstrap-tpls.0.11.2.js | snake_case | function snake_case(name){
var regexp = /[A-Z]/g;
var separator = '-';
return name.replace(regexp, function(letter, pos) {
return (pos ? separator : '') + letter.toLowerCase();
});
} | javascript | function snake_case(name){
var regexp = /[A-Z]/g;
var separator = '-';
return name.replace(regexp, function(letter, pos) {
return (pos ? separator : '') + letter.toLowerCase();
});
} | [
"function",
"snake_case",
"(",
"name",
")",
"{",
"var",
"regexp",
"=",
"/",
"[A-Z]",
"/",
"g",
";",
"var",
"separator",
"=",
"'-'",
";",
"return",
"name",
".",
"replace",
"(",
"regexp",
",",
"function",
"(",
"letter",
",",
"pos",
")",
"{",
"return",
... | This is a helper function for translating camel-case to snake-case. | [
"This",
"is",
"a",
"helper",
"function",
"for",
"translating",
"camel",
"-",
"case",
"to",
"snake",
"-",
"case",
"."
] | 5bcedace8bcf135ec47d06a6549c802185318196 | https://github.com/wix/angular-tree-control/blob/5bcedace8bcf135ec47d06a6549c802185318196/demo/ui-bootstrap-tpls.0.11.2.js#L2464-L2470 |
9,191 | csstree/csstree | lib/tokenizer/Tokenizer.js | computeLinesAndColumns | function computeLinesAndColumns(tokenizer, source) {
var sourceLength = source.length;
var start = firstCharOffset(source);
var lines = tokenizer.lines;
var line = tokenizer.startLine;
var columns = tokenizer.columns;
var column = tokenizer.startColumn;
if (lines === null || lines.length < ... | javascript | function computeLinesAndColumns(tokenizer, source) {
var sourceLength = source.length;
var start = firstCharOffset(source);
var lines = tokenizer.lines;
var line = tokenizer.startLine;
var columns = tokenizer.columns;
var column = tokenizer.startColumn;
if (lines === null || lines.length < ... | [
"function",
"computeLinesAndColumns",
"(",
"tokenizer",
",",
"source",
")",
"{",
"var",
"sourceLength",
"=",
"source",
".",
"length",
";",
"var",
"start",
"=",
"firstCharOffset",
"(",
"source",
")",
";",
"var",
"lines",
"=",
"tokenizer",
".",
"lines",
";",
... | fallback on Array when TypedArray is not supported | [
"fallback",
"on",
"Array",
"when",
"TypedArray",
"is",
"not",
"supported"
] | 5835eabde1d789e8a5a030a0946f2b4a1698c350 | https://github.com/csstree/csstree/blob/5835eabde1d789e8a5a030a0946f2b4a1698c350/lib/tokenizer/Tokenizer.js#L60-L97 |
9,192 | apache/cordova-plugin-splashscreen | src/browser/SplashScreenProxy.js | readPreferencesFromCfg | function readPreferencesFromCfg(cfg) {
try {
var value = cfg.getPreferenceValue('ShowSplashScreen');
if(typeof value != 'undefined') {
showSplashScreen = value === 'true';
}
splashScreenDelay = cfg.getPreferenceValue('SplashScreenDelay') || splashScreenDelay;
spl... | javascript | function readPreferencesFromCfg(cfg) {
try {
var value = cfg.getPreferenceValue('ShowSplashScreen');
if(typeof value != 'undefined') {
showSplashScreen = value === 'true';
}
splashScreenDelay = cfg.getPreferenceValue('SplashScreenDelay') || splashScreenDelay;
spl... | [
"function",
"readPreferencesFromCfg",
"(",
"cfg",
")",
"{",
"try",
"{",
"var",
"value",
"=",
"cfg",
".",
"getPreferenceValue",
"(",
"'ShowSplashScreen'",
")",
";",
"if",
"(",
"typeof",
"value",
"!=",
"'undefined'",
")",
"{",
"showSplashScreen",
"=",
"value",
... | Reads preferences via ConfigHelper and substitutes default parameters. | [
"Reads",
"preferences",
"via",
"ConfigHelper",
"and",
"substitutes",
"default",
"parameters",
"."
] | 6800de23b168b3de143ee3f91c1efcaba9309de8 | https://github.com/apache/cordova-plugin-splashscreen/blob/6800de23b168b3de143ee3f91c1efcaba9309de8/src/browser/SplashScreenProxy.js#L115-L135 |
9,193 | samselikoff/ember-cli-mirage | addon/start-mirage.js | resolveRegistration | function resolveRegistration(owner, ...args) {
if (owner.resolveRegistration) {
return owner.resolveRegistration(...args);
} else if (owner.__container__) {
return owner.__container__.lookupFactory(...args);
} else {
return owner.container.lookupFactory(...args);
}
} | javascript | function resolveRegistration(owner, ...args) {
if (owner.resolveRegistration) {
return owner.resolveRegistration(...args);
} else if (owner.__container__) {
return owner.__container__.lookupFactory(...args);
} else {
return owner.container.lookupFactory(...args);
}
} | [
"function",
"resolveRegistration",
"(",
"owner",
",",
"...",
"args",
")",
"{",
"if",
"(",
"owner",
".",
"resolveRegistration",
")",
"{",
"return",
"owner",
".",
"resolveRegistration",
"(",
"...",
"args",
")",
";",
"}",
"else",
"if",
"(",
"owner",
".",
"_... | Support Ember 1.13 | [
"Support",
"Ember",
"1",
".",
"13"
] | 41422055dc884410a0b468ef9e336446d193c8cf | https://github.com/samselikoff/ember-cli-mirage/blob/41422055dc884410a0b468ef9e336446d193c8cf/addon/start-mirage.js#L42-L50 |
9,194 | samselikoff/ember-cli-mirage | addon/server.js | createPretender | function createPretender(server) {
return new Pretender(function() {
this.passthroughRequest = function(verb, path, request) {
if (server.shouldLog()) {
console.log(`Passthrough request: ${verb.toUpperCase()} ${request.url}`);
}
};
this.handledRequest = function(verb, path, request) {... | javascript | function createPretender(server) {
return new Pretender(function() {
this.passthroughRequest = function(verb, path, request) {
if (server.shouldLog()) {
console.log(`Passthrough request: ${verb.toUpperCase()} ${request.url}`);
}
};
this.handledRequest = function(verb, path, request) {... | [
"function",
"createPretender",
"(",
"server",
")",
"{",
"return",
"new",
"Pretender",
"(",
"function",
"(",
")",
"{",
"this",
".",
"passthroughRequest",
"=",
"function",
"(",
"verb",
",",
"path",
",",
"request",
")",
"{",
"if",
"(",
"server",
".",
"shoul... | Creates a new Pretender instance.
@method createPretender
@param {Server} server
@return {Object} A new Pretender instance.
@public | [
"Creates",
"a",
"new",
"Pretender",
"instance",
"."
] | 41422055dc884410a0b468ef9e336446d193c8cf | https://github.com/samselikoff/ember-cli-mirage/blob/41422055dc884410a0b468ef9e336446d193c8cf/addon/server.js#L30-L74 |
9,195 | samselikoff/ember-cli-mirage | addon/server.js | isOption | function isOption(option) {
if (!option || typeof option !== 'object') {
return false;
}
let allOptions = Object.keys(defaultRouteOptions);
let optionKeys = Object.keys(option);
for (let i = 0; i < optionKeys.length; i++) {
let key = optionKeys[i];
if (allOptions.indexOf(key) > -1) {
return... | javascript | function isOption(option) {
if (!option || typeof option !== 'object') {
return false;
}
let allOptions = Object.keys(defaultRouteOptions);
let optionKeys = Object.keys(option);
for (let i = 0; i < optionKeys.length; i++) {
let key = optionKeys[i];
if (allOptions.indexOf(key) > -1) {
return... | [
"function",
"isOption",
"(",
"option",
")",
"{",
"if",
"(",
"!",
"option",
"||",
"typeof",
"option",
"!==",
"'object'",
")",
"{",
"return",
"false",
";",
"}",
"let",
"allOptions",
"=",
"Object",
".",
"keys",
"(",
"defaultRouteOptions",
")",
";",
"let",
... | Determine if the object contains a valid option.
@method isOption
@param {Object} option An object with one option value pair.
@return {Boolean} True if option is a valid option, false otherwise.
@private | [
"Determine",
"if",
"the",
"object",
"contains",
"a",
"valid",
"option",
"."
] | 41422055dc884410a0b468ef9e336446d193c8cf | https://github.com/samselikoff/ember-cli-mirage/blob/41422055dc884410a0b468ef9e336446d193c8cf/addon/server.js#L102-L116 |
9,196 | samselikoff/ember-cli-mirage | addon/server.js | extractRouteArguments | function extractRouteArguments(args) {
let [ lastArg ] = args.splice(-1);
if (isOption(lastArg)) {
lastArg = _assign({}, defaultRouteOptions, lastArg);
} else {
args.push(lastArg);
lastArg = defaultRouteOptions;
}
let t = 2 - args.length;
while (t-- > 0) {
args.push(undefined);
}
args.pu... | javascript | function extractRouteArguments(args) {
let [ lastArg ] = args.splice(-1);
if (isOption(lastArg)) {
lastArg = _assign({}, defaultRouteOptions, lastArg);
} else {
args.push(lastArg);
lastArg = defaultRouteOptions;
}
let t = 2 - args.length;
while (t-- > 0) {
args.push(undefined);
}
args.pu... | [
"function",
"extractRouteArguments",
"(",
"args",
")",
"{",
"let",
"[",
"lastArg",
"]",
"=",
"args",
".",
"splice",
"(",
"-",
"1",
")",
";",
"if",
"(",
"isOption",
"(",
"lastArg",
")",
")",
"{",
"lastArg",
"=",
"_assign",
"(",
"{",
"}",
",",
"defau... | Extract arguments for a route.
@method extractRouteArguments
@param {Array} args Of the form [options], [object, code], [function, code]
[shorthand, options], [shorthand, code, options]
@return {Array} [handler (i.e. the function, object or shorthand), code,
options].
@private | [
"Extract",
"arguments",
"for",
"a",
"route",
"."
] | 41422055dc884410a0b468ef9e336446d193c8cf | https://github.com/samselikoff/ember-cli-mirage/blob/41422055dc884410a0b468ef9e336446d193c8cf/addon/server.js#L128-L142 |
9,197 | ianstormtaylor/superstruct | src/superstruct.js | superstruct | function superstruct(config = {}) {
const types = {
...Types,
...(config.types || {}),
}
/**
* Create a `kind` struct with `schema`, `defaults` and `options`.
*
* @param {Any} schema
* @param {Any} defaults
* @param {Object} options
* @return {Function}
*/
function struct(schema, ... | javascript | function superstruct(config = {}) {
const types = {
...Types,
...(config.types || {}),
}
/**
* Create a `kind` struct with `schema`, `defaults` and `options`.
*
* @param {Any} schema
* @param {Any} defaults
* @param {Object} options
* @return {Function}
*/
function struct(schema, ... | [
"function",
"superstruct",
"(",
"config",
"=",
"{",
"}",
")",
"{",
"const",
"types",
"=",
"{",
"...",
"Types",
",",
"...",
"(",
"config",
".",
"types",
"||",
"{",
"}",
")",
",",
"}",
"/**\n * Create a `kind` struct with `schema`, `defaults` and `options`.\n ... | Create a struct factory with a `config`.
@param {Object} config
@return {Function} | [
"Create",
"a",
"struct",
"factory",
"with",
"a",
"config",
"."
] | 5d72235a1ec84b06315e5c87b63787b9cfa2be4c | https://github.com/ianstormtaylor/superstruct/blob/5d72235a1ec84b06315e5c87b63787b9cfa2be4c/src/superstruct.js#L14-L106 |
9,198 | Microsoft/BotBuilder-CognitiveServices | CSharp/Samples/LuisActions/LuisActions.Samples.Web/Scripts/jquery.validate.js | function( element, method ) {
return $(element).data("msg-" + method.toLowerCase()) || (element.attributes && $(element).attr("data-msg-" + method.toLowerCase()));
} | javascript | function( element, method ) {
return $(element).data("msg-" + method.toLowerCase()) || (element.attributes && $(element).attr("data-msg-" + method.toLowerCase()));
} | [
"function",
"(",
"element",
",",
"method",
")",
"{",
"return",
"$",
"(",
"element",
")",
".",
"data",
"(",
"\"msg-\"",
"+",
"method",
".",
"toLowerCase",
"(",
")",
")",
"||",
"(",
"element",
".",
"attributes",
"&&",
"$",
"(",
"element",
")",
".",
"... | return the custom message for the given element and validation method specified in the element's HTML5 data attribute | [
"return",
"the",
"custom",
"message",
"for",
"the",
"given",
"element",
"and",
"validation",
"method",
"specified",
"in",
"the",
"element",
"s",
"HTML5",
"data",
"attribute"
] | f74a54bd7ccc74ef08a3a1d5682dc0198e8869cd | https://github.com/Microsoft/BotBuilder-CognitiveServices/blob/f74a54bd7ccc74ef08a3a1d5682dc0198e8869cd/CSharp/Samples/LuisActions/LuisActions.Samples.Web/Scripts/jquery.validate.js#L600-L602 | |
9,199 | Microsoft/BotBuilder-CognitiveServices | CSharp/Samples/LuisActions/LuisActions.Samples.Web/Scripts/jquery.validate-vsdoc.js | function(element, method) {
if (!$.metadata)
return;
var meta = this.settings.meta
? $(element).metadata()[this.settings.meta]
: $(element).metadata();
return meta && meta.messages && meta.messages[method];
} | javascript | function(element, method) {
if (!$.metadata)
return;
var meta = this.settings.meta
? $(element).metadata()[this.settings.meta]
: $(element).metadata();
return meta && meta.messages && meta.messages[method];
} | [
"function",
"(",
"element",
",",
"method",
")",
"{",
"if",
"(",
"!",
"$",
".",
"metadata",
")",
"return",
";",
"var",
"meta",
"=",
"this",
".",
"settings",
".",
"meta",
"?",
"$",
"(",
"element",
")",
".",
"metadata",
"(",
")",
"[",
"this",
".",
... | return the custom message for the given element and validation method specified in the element's "messages" metadata | [
"return",
"the",
"custom",
"message",
"for",
"the",
"given",
"element",
"and",
"validation",
"method",
"specified",
"in",
"the",
"element",
"s",
"messages",
"metadata"
] | f74a54bd7ccc74ef08a3a1d5682dc0198e8869cd | https://github.com/Microsoft/BotBuilder-CognitiveServices/blob/f74a54bd7ccc74ef08a3a1d5682dc0198e8869cd/CSharp/Samples/LuisActions/LuisActions.Samples.Web/Scripts/jquery.validate-vsdoc.js#L639-L648 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.