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
sequence | docstring
stringlengths 4
11.8k
| docstring_tokens
sequence | sha
stringlengths 40
40
| url
stringlengths 86
226
|
---|---|---|---|---|---|---|---|---|---|---|---|
51,300 | jakekara/datab.js | src/datab-data.js | function( matrix )
{
// default to empty 2d array
if ( typeof( matrix ) == "undefined" )
var matrix = []; // zero rows
// store rows for O(n) retrieval after initial
// operation. sacrifices memory efficiency
this.__rows = matrix;
this.__cols = d3.transpose(matrix);
// get the default index of an array of rows or cols
var index_arr = function(arr){
// otherwise, return an array of integers (as strings)
return d3.range(arr.length)
.map(function(a){
return String(a);
});
}
// create the default indexes
this.__index = {
"row" : index_arr(this.__rows),
"col" : index_arr(this.__cols)
};
this.rows = function() { return this.__rows; };
this.cols = function() { return this.__cols; };
return this;
} | javascript | function( matrix )
{
// default to empty 2d array
if ( typeof( matrix ) == "undefined" )
var matrix = []; // zero rows
// store rows for O(n) retrieval after initial
// operation. sacrifices memory efficiency
this.__rows = matrix;
this.__cols = d3.transpose(matrix);
// get the default index of an array of rows or cols
var index_arr = function(arr){
// otherwise, return an array of integers (as strings)
return d3.range(arr.length)
.map(function(a){
return String(a);
});
}
// create the default indexes
this.__index = {
"row" : index_arr(this.__rows),
"col" : index_arr(this.__cols)
};
this.rows = function() { return this.__rows; };
this.cols = function() { return this.__cols; };
return this;
} | [
"function",
"(",
"matrix",
")",
"{",
"// default to empty 2d array",
"if",
"(",
"typeof",
"(",
"matrix",
")",
"==",
"\"undefined\"",
")",
"var",
"matrix",
"=",
"[",
"]",
";",
"// zero rows",
"// store rows for O(n) retrieval after initial",
"// operation. sacrifices memory efficiency",
"this",
".",
"__rows",
"=",
"matrix",
";",
"this",
".",
"__cols",
"=",
"d3",
".",
"transpose",
"(",
"matrix",
")",
";",
"// get the default index of an array of rows or cols",
"var",
"index_arr",
"=",
"function",
"(",
"arr",
")",
"{",
"// otherwise, return an array of integers (as strings)",
"return",
"d3",
".",
"range",
"(",
"arr",
".",
"length",
")",
".",
"map",
"(",
"function",
"(",
"a",
")",
"{",
"return",
"String",
"(",
"a",
")",
";",
"}",
")",
";",
"}",
"// create the default indexes",
"this",
".",
"__index",
"=",
"{",
"\"row\"",
":",
"index_arr",
"(",
"this",
".",
"__rows",
")",
",",
"\"col\"",
":",
"index_arr",
"(",
"this",
".",
"__cols",
")",
"}",
";",
"this",
".",
"rows",
"=",
"function",
"(",
")",
"{",
"return",
"this",
".",
"__rows",
";",
"}",
";",
"this",
".",
"cols",
"=",
"function",
"(",
")",
"{",
"return",
"this",
".",
"__cols",
";",
"}",
";",
"return",
"this",
";",
"}"
] | create a data object from a two-dimensional array
@constructor
@arg matrix - a matrix (2d-array) of the table | [
"create",
"a",
"data",
"object",
"from",
"a",
"two",
"-",
"dimensional",
"array"
] | 696246bf461609bf1fd145634307f4c7d3edc82a | https://github.com/jakekara/datab.js/blob/696246bf461609bf1fd145634307f4c7d3edc82a/src/datab-data.js#L41-L73 |
|
51,301 | vkiding/judpack-lib | src/cordova/plugin_parser.js | plugin_parser | function plugin_parser(xmlPath) {
this.path = xmlPath;
this.doc = xml.parseElementtreeSync(xmlPath);
this.platforms = this.doc.findall('platform').map(function(p) {
return p.attrib.name;
});
} | javascript | function plugin_parser(xmlPath) {
this.path = xmlPath;
this.doc = xml.parseElementtreeSync(xmlPath);
this.platforms = this.doc.findall('platform').map(function(p) {
return p.attrib.name;
});
} | [
"function",
"plugin_parser",
"(",
"xmlPath",
")",
"{",
"this",
".",
"path",
"=",
"xmlPath",
";",
"this",
".",
"doc",
"=",
"xml",
".",
"parseElementtreeSync",
"(",
"xmlPath",
")",
";",
"this",
".",
"platforms",
"=",
"this",
".",
"doc",
".",
"findall",
"(",
"'platform'",
")",
".",
"map",
"(",
"function",
"(",
"p",
")",
"{",
"return",
"p",
".",
"attrib",
".",
"name",
";",
"}",
")",
";",
"}"
] | Deprecated. Use PluginInfo instead. | [
"Deprecated",
".",
"Use",
"PluginInfo",
"instead",
"."
] | 8657cecfec68221109279106adca8dbc81f430f4 | https://github.com/vkiding/judpack-lib/blob/8657cecfec68221109279106adca8dbc81f430f4/src/cordova/plugin_parser.js#L23-L29 |
51,302 | tolokoban/ToloFrameWork | ker/mod/tfw.view.icon.js | onContentChanged | function onContentChanged( contentStringOrObject ) {
try {
const
isString = typeof contentStringOrObject === 'string',
content = isString ? Icons.iconsBook[ contentStringOrObject ] : contentStringOrObject;
this._content = createSvgFromDefinition.call( this, content );
if ( !this._content ) return;
$.clear( this, this._content.svgRootGroup );
// Update pens' colors.
for ( const penIndex of [ 0, 1, 2, 3, 4, 5, 6, 7 ] ) {
updatePen.call( this, penIndex, this[ `pen${penIndex}` ] );
}
this.$.style.display = "";
} catch ( ex ) {
this.$.style.display = "none";
if ( this.content !== '' ) this.content = '';
}
} | javascript | function onContentChanged( contentStringOrObject ) {
try {
const
isString = typeof contentStringOrObject === 'string',
content = isString ? Icons.iconsBook[ contentStringOrObject ] : contentStringOrObject;
this._content = createSvgFromDefinition.call( this, content );
if ( !this._content ) return;
$.clear( this, this._content.svgRootGroup );
// Update pens' colors.
for ( const penIndex of [ 0, 1, 2, 3, 4, 5, 6, 7 ] ) {
updatePen.call( this, penIndex, this[ `pen${penIndex}` ] );
}
this.$.style.display = "";
} catch ( ex ) {
this.$.style.display = "none";
if ( this.content !== '' ) this.content = '';
}
} | [
"function",
"onContentChanged",
"(",
"contentStringOrObject",
")",
"{",
"try",
"{",
"const",
"isString",
"=",
"typeof",
"contentStringOrObject",
"===",
"'string'",
",",
"content",
"=",
"isString",
"?",
"Icons",
".",
"iconsBook",
"[",
"contentStringOrObject",
"]",
":",
"contentStringOrObject",
";",
"this",
".",
"_content",
"=",
"createSvgFromDefinition",
".",
"call",
"(",
"this",
",",
"content",
")",
";",
"if",
"(",
"!",
"this",
".",
"_content",
")",
"return",
";",
"$",
".",
"clear",
"(",
"this",
",",
"this",
".",
"_content",
".",
"svgRootGroup",
")",
";",
"// Update pens' colors.",
"for",
"(",
"const",
"penIndex",
"of",
"[",
"0",
",",
"1",
",",
"2",
",",
"3",
",",
"4",
",",
"5",
",",
"6",
",",
"7",
"]",
")",
"{",
"updatePen",
".",
"call",
"(",
"this",
",",
"penIndex",
",",
"this",
"[",
"`",
"${",
"penIndex",
"}",
"`",
"]",
")",
";",
"}",
"this",
".",
"$",
".",
"style",
".",
"display",
"=",
"\"\"",
";",
"}",
"catch",
"(",
"ex",
")",
"{",
"this",
".",
"$",
".",
"style",
".",
"display",
"=",
"\"none\"",
";",
"if",
"(",
"this",
".",
"content",
"!==",
"''",
")",
"this",
".",
"content",
"=",
"''",
";",
"}",
"}"
] | Create SVG icon from `content`
@this ViewXJS
@param {object|string} contentStringOrObject - Can be an icon name or a SVG description.
@returns {undefined} | [
"Create",
"SVG",
"icon",
"from",
"content"
] | 730845a833a9660ebfdb60ad027ebaab5ac871b6 | https://github.com/tolokoban/ToloFrameWork/blob/730845a833a9660ebfdb60ad027ebaab5ac871b6/ker/mod/tfw.view.icon.js#L30-L50 |
51,303 | tolokoban/ToloFrameWork | ker/mod/tfw.view.icon.js | updatePen | function updatePen( penIndex, penColor = "0" ) {
if ( !this._content ) return;
let elementsToFill = this._content.elementsToFillPerColor[ penIndex ];
if ( !Array.isArray( elementsToFill ) ) elementsToFill = [];
let elementsToStroke = this._content.elementsToStrokePerColor[ penIndex ];
if ( !Array.isArray( elementsToStroke ) ) elementsToStroke = [];
updateColor( elementsToFill, elementsToStroke, penColor );
} | javascript | function updatePen( penIndex, penColor = "0" ) {
if ( !this._content ) return;
let elementsToFill = this._content.elementsToFillPerColor[ penIndex ];
if ( !Array.isArray( elementsToFill ) ) elementsToFill = [];
let elementsToStroke = this._content.elementsToStrokePerColor[ penIndex ];
if ( !Array.isArray( elementsToStroke ) ) elementsToStroke = [];
updateColor( elementsToFill, elementsToStroke, penColor );
} | [
"function",
"updatePen",
"(",
"penIndex",
",",
"penColor",
"=",
"\"0\"",
")",
"{",
"if",
"(",
"!",
"this",
".",
"_content",
")",
"return",
";",
"let",
"elementsToFill",
"=",
"this",
".",
"_content",
".",
"elementsToFillPerColor",
"[",
"penIndex",
"]",
";",
"if",
"(",
"!",
"Array",
".",
"isArray",
"(",
"elementsToFill",
")",
")",
"elementsToFill",
"=",
"[",
"]",
";",
"let",
"elementsToStroke",
"=",
"this",
".",
"_content",
".",
"elementsToStrokePerColor",
"[",
"penIndex",
"]",
";",
"if",
"(",
"!",
"Array",
".",
"isArray",
"(",
"elementsToStroke",
")",
")",
"elementsToStroke",
"=",
"[",
"]",
";",
"updateColor",
"(",
"elementsToFill",
",",
"elementsToStroke",
",",
"penColor",
")",
";",
"}"
] | Update the color of a pen.
@this ViewXJS
@param {integer} penIndex - The index of the pen.
@param {string} penColor - The new color of this pen.
@returns {undefined} | [
"Update",
"the",
"color",
"of",
"a",
"pen",
"."
] | 730845a833a9660ebfdb60ad027ebaab5ac871b6 | https://github.com/tolokoban/ToloFrameWork/blob/730845a833a9660ebfdb60ad027ebaab5ac871b6/ker/mod/tfw.view.icon.js#L198-L207 |
51,304 | baaae/charge | lib/index.js | aliasesTaken | function aliasesTaken (arr) {
var taken
for (var ind in arr) {
if (!arr.hasOwnProperty(ind)) continue;
if (aliasTaken(arr[ind]) !== false) return arr[ind];
}
return false;
} | javascript | function aliasesTaken (arr) {
var taken
for (var ind in arr) {
if (!arr.hasOwnProperty(ind)) continue;
if (aliasTaken(arr[ind]) !== false) return arr[ind];
}
return false;
} | [
"function",
"aliasesTaken",
"(",
"arr",
")",
"{",
"var",
"taken",
"for",
"(",
"var",
"ind",
"in",
"arr",
")",
"{",
"if",
"(",
"!",
"arr",
".",
"hasOwnProperty",
"(",
"ind",
")",
")",
"continue",
";",
"if",
"(",
"aliasTaken",
"(",
"arr",
"[",
"ind",
"]",
")",
"!==",
"false",
")",
"return",
"arr",
"[",
"ind",
"]",
";",
"}",
"return",
"false",
";",
"}"
] | return false if _any_ one of them is in use | [
"return",
"false",
"if",
"_any_",
"one",
"of",
"them",
"is",
"in",
"use"
] | af756ab21edc7e96d68e217225f3e386b72f0af1 | https://github.com/baaae/charge/blob/af756ab21edc7e96d68e217225f3e386b72f0af1/lib/index.js#L147-L154 |
51,305 | reptilbud/hapi-swagger | public/swaggerui/swagger-ui.js | simpleChar | function simpleChar(character) {
return CHAR_TAB !== character &&
CHAR_LINE_FEED !== character &&
CHAR_CARRIAGE_RETURN !== character &&
CHAR_COMMA !== character &&
CHAR_LEFT_SQUARE_BRACKET !== character &&
CHAR_RIGHT_SQUARE_BRACKET !== character &&
CHAR_LEFT_CURLY_BRACKET !== character &&
CHAR_RIGHT_CURLY_BRACKET !== character &&
CHAR_SHARP !== character &&
CHAR_AMPERSAND !== character &&
CHAR_ASTERISK !== character &&
CHAR_EXCLAMATION !== character &&
CHAR_VERTICAL_LINE !== character &&
CHAR_GREATER_THAN !== character &&
CHAR_SINGLE_QUOTE !== character &&
CHAR_DOUBLE_QUOTE !== character &&
CHAR_PERCENT !== character &&
CHAR_COLON !== character &&
!ESCAPE_SEQUENCES[character] &&
!needsHexEscape(character);
} | javascript | function simpleChar(character) {
return CHAR_TAB !== character &&
CHAR_LINE_FEED !== character &&
CHAR_CARRIAGE_RETURN !== character &&
CHAR_COMMA !== character &&
CHAR_LEFT_SQUARE_BRACKET !== character &&
CHAR_RIGHT_SQUARE_BRACKET !== character &&
CHAR_LEFT_CURLY_BRACKET !== character &&
CHAR_RIGHT_CURLY_BRACKET !== character &&
CHAR_SHARP !== character &&
CHAR_AMPERSAND !== character &&
CHAR_ASTERISK !== character &&
CHAR_EXCLAMATION !== character &&
CHAR_VERTICAL_LINE !== character &&
CHAR_GREATER_THAN !== character &&
CHAR_SINGLE_QUOTE !== character &&
CHAR_DOUBLE_QUOTE !== character &&
CHAR_PERCENT !== character &&
CHAR_COLON !== character &&
!ESCAPE_SEQUENCES[character] &&
!needsHexEscape(character);
} | [
"function",
"simpleChar",
"(",
"character",
")",
"{",
"return",
"CHAR_TAB",
"!==",
"character",
"&&",
"CHAR_LINE_FEED",
"!==",
"character",
"&&",
"CHAR_CARRIAGE_RETURN",
"!==",
"character",
"&&",
"CHAR_COMMA",
"!==",
"character",
"&&",
"CHAR_LEFT_SQUARE_BRACKET",
"!==",
"character",
"&&",
"CHAR_RIGHT_SQUARE_BRACKET",
"!==",
"character",
"&&",
"CHAR_LEFT_CURLY_BRACKET",
"!==",
"character",
"&&",
"CHAR_RIGHT_CURLY_BRACKET",
"!==",
"character",
"&&",
"CHAR_SHARP",
"!==",
"character",
"&&",
"CHAR_AMPERSAND",
"!==",
"character",
"&&",
"CHAR_ASTERISK",
"!==",
"character",
"&&",
"CHAR_EXCLAMATION",
"!==",
"character",
"&&",
"CHAR_VERTICAL_LINE",
"!==",
"character",
"&&",
"CHAR_GREATER_THAN",
"!==",
"character",
"&&",
"CHAR_SINGLE_QUOTE",
"!==",
"character",
"&&",
"CHAR_DOUBLE_QUOTE",
"!==",
"character",
"&&",
"CHAR_PERCENT",
"!==",
"character",
"&&",
"CHAR_COLON",
"!==",
"character",
"&&",
"!",
"ESCAPE_SEQUENCES",
"[",
"character",
"]",
"&&",
"!",
"needsHexEscape",
"(",
"character",
")",
";",
"}"
] | Returns true if character can be found in a simple scalar | [
"Returns",
"true",
"if",
"character",
"can",
"be",
"found",
"in",
"a",
"simple",
"scalar"
] | 8a4a1059f060a7100270e837d2759c6a2b9c7e74 | https://github.com/reptilbud/hapi-swagger/blob/8a4a1059f060a7100270e837d2759c6a2b9c7e74/public/swaggerui/swagger-ui.js#L7770-L7791 |
51,306 | reptilbud/hapi-swagger | public/swaggerui/swagger-ui.js | needsHexEscape | function needsHexEscape(character) {
return !((0x00020 <= character && character <= 0x00007E) ||
(0x00085 === character) ||
(0x000A0 <= character && character <= 0x00D7FF) ||
(0x0E000 <= character && character <= 0x00FFFD) ||
(0x10000 <= character && character <= 0x10FFFF));
} | javascript | function needsHexEscape(character) {
return !((0x00020 <= character && character <= 0x00007E) ||
(0x00085 === character) ||
(0x000A0 <= character && character <= 0x00D7FF) ||
(0x0E000 <= character && character <= 0x00FFFD) ||
(0x10000 <= character && character <= 0x10FFFF));
} | [
"function",
"needsHexEscape",
"(",
"character",
")",
"{",
"return",
"!",
"(",
"(",
"0x00020",
"<=",
"character",
"&&",
"character",
"<=",
"0x00007E",
")",
"||",
"(",
"0x00085",
"===",
"character",
")",
"||",
"(",
"0x000A0",
"<=",
"character",
"&&",
"character",
"<=",
"0x00D7FF",
")",
"||",
"(",
"0x0E000",
"<=",
"character",
"&&",
"character",
"<=",
"0x00FFFD",
")",
"||",
"(",
"0x10000",
"<=",
"character",
"&&",
"character",
"<=",
"0x10FFFF",
")",
")",
";",
"}"
] | Returns true if the character code needs to be escaped. | [
"Returns",
"true",
"if",
"the",
"character",
"code",
"needs",
"to",
"be",
"escaped",
"."
] | 8a4a1059f060a7100270e837d2759c6a2b9c7e74 | https://github.com/reptilbud/hapi-swagger/blob/8a4a1059f060a7100270e837d2759c6a2b9c7e74/public/swaggerui/swagger-ui.js#L7794-L7800 |
51,307 | reptilbud/hapi-swagger | public/swaggerui/swagger-ui.js | fromCodePoint | function fromCodePoint(cp) {
return (cp < 0x10000) ? String.fromCharCode(cp) :
String.fromCharCode(0xD800 + ((cp - 0x10000) >> 10)) +
String.fromCharCode(0xDC00 + ((cp - 0x10000) & 1023));
} | javascript | function fromCodePoint(cp) {
return (cp < 0x10000) ? String.fromCharCode(cp) :
String.fromCharCode(0xD800 + ((cp - 0x10000) >> 10)) +
String.fromCharCode(0xDC00 + ((cp - 0x10000) & 1023));
} | [
"function",
"fromCodePoint",
"(",
"cp",
")",
"{",
"return",
"(",
"cp",
"<",
"0x10000",
")",
"?",
"String",
".",
"fromCharCode",
"(",
"cp",
")",
":",
"String",
".",
"fromCharCode",
"(",
"0xD800",
"+",
"(",
"(",
"cp",
"-",
"0x10000",
")",
">>",
"10",
")",
")",
"+",
"String",
".",
"fromCharCode",
"(",
"0xDC00",
"+",
"(",
"(",
"cp",
"-",
"0x10000",
")",
"&",
"1023",
")",
")",
";",
"}"
] | ECMA-262 11.6 Identifier Names and Identifiers | [
"ECMA",
"-",
"262",
"11",
".",
"6",
"Identifier",
"Names",
"and",
"Identifiers"
] | 8a4a1059f060a7100270e837d2759c6a2b9c7e74 | https://github.com/reptilbud/hapi-swagger/blob/8a4a1059f060a7100270e837d2759c6a2b9c7e74/public/swaggerui/swagger-ui.js#L11449-L11453 |
51,308 | reptilbud/hapi-swagger | public/swaggerui/swagger-ui.js | isKeyword | function isKeyword(id) {
switch (id.length) {
case 2:
return (id === 'if') || (id === 'in') || (id === 'do');
case 3:
return (id === 'var') || (id === 'for') || (id === 'new') ||
(id === 'try') || (id === 'let');
case 4:
return (id === 'this') || (id === 'else') || (id === 'case') ||
(id === 'void') || (id === 'with') || (id === 'enum');
case 5:
return (id === 'while') || (id === 'break') || (id === 'catch') ||
(id === 'throw') || (id === 'const') || (id === 'yield') ||
(id === 'class') || (id === 'super');
case 6:
return (id === 'return') || (id === 'typeof') || (id === 'delete') ||
(id === 'switch') || (id === 'export') || (id === 'import');
case 7:
return (id === 'default') || (id === 'finally') || (id === 'extends');
case 8:
return (id === 'function') || (id === 'continue') || (id === 'debugger');
case 10:
return (id === 'instanceof');
default:
return false;
}
} | javascript | function isKeyword(id) {
switch (id.length) {
case 2:
return (id === 'if') || (id === 'in') || (id === 'do');
case 3:
return (id === 'var') || (id === 'for') || (id === 'new') ||
(id === 'try') || (id === 'let');
case 4:
return (id === 'this') || (id === 'else') || (id === 'case') ||
(id === 'void') || (id === 'with') || (id === 'enum');
case 5:
return (id === 'while') || (id === 'break') || (id === 'catch') ||
(id === 'throw') || (id === 'const') || (id === 'yield') ||
(id === 'class') || (id === 'super');
case 6:
return (id === 'return') || (id === 'typeof') || (id === 'delete') ||
(id === 'switch') || (id === 'export') || (id === 'import');
case 7:
return (id === 'default') || (id === 'finally') || (id === 'extends');
case 8:
return (id === 'function') || (id === 'continue') || (id === 'debugger');
case 10:
return (id === 'instanceof');
default:
return false;
}
} | [
"function",
"isKeyword",
"(",
"id",
")",
"{",
"switch",
"(",
"id",
".",
"length",
")",
"{",
"case",
"2",
":",
"return",
"(",
"id",
"===",
"'if'",
")",
"||",
"(",
"id",
"===",
"'in'",
")",
"||",
"(",
"id",
"===",
"'do'",
")",
";",
"case",
"3",
":",
"return",
"(",
"id",
"===",
"'var'",
")",
"||",
"(",
"id",
"===",
"'for'",
")",
"||",
"(",
"id",
"===",
"'new'",
")",
"||",
"(",
"id",
"===",
"'try'",
")",
"||",
"(",
"id",
"===",
"'let'",
")",
";",
"case",
"4",
":",
"return",
"(",
"id",
"===",
"'this'",
")",
"||",
"(",
"id",
"===",
"'else'",
")",
"||",
"(",
"id",
"===",
"'case'",
")",
"||",
"(",
"id",
"===",
"'void'",
")",
"||",
"(",
"id",
"===",
"'with'",
")",
"||",
"(",
"id",
"===",
"'enum'",
")",
";",
"case",
"5",
":",
"return",
"(",
"id",
"===",
"'while'",
")",
"||",
"(",
"id",
"===",
"'break'",
")",
"||",
"(",
"id",
"===",
"'catch'",
")",
"||",
"(",
"id",
"===",
"'throw'",
")",
"||",
"(",
"id",
"===",
"'const'",
")",
"||",
"(",
"id",
"===",
"'yield'",
")",
"||",
"(",
"id",
"===",
"'class'",
")",
"||",
"(",
"id",
"===",
"'super'",
")",
";",
"case",
"6",
":",
"return",
"(",
"id",
"===",
"'return'",
")",
"||",
"(",
"id",
"===",
"'typeof'",
")",
"||",
"(",
"id",
"===",
"'delete'",
")",
"||",
"(",
"id",
"===",
"'switch'",
")",
"||",
"(",
"id",
"===",
"'export'",
")",
"||",
"(",
"id",
"===",
"'import'",
")",
";",
"case",
"7",
":",
"return",
"(",
"id",
"===",
"'default'",
")",
"||",
"(",
"id",
"===",
"'finally'",
")",
"||",
"(",
"id",
"===",
"'extends'",
")",
";",
"case",
"8",
":",
"return",
"(",
"id",
"===",
"'function'",
")",
"||",
"(",
"id",
"===",
"'continue'",
")",
"||",
"(",
"id",
"===",
"'debugger'",
")",
";",
"case",
"10",
":",
"return",
"(",
"id",
"===",
"'instanceof'",
")",
";",
"default",
":",
"return",
"false",
";",
"}",
"}"
] | ECMA-262 11.6.2.1 Keywords | [
"ECMA",
"-",
"262",
"11",
".",
"6",
".",
"2",
".",
"1",
"Keywords"
] | 8a4a1059f060a7100270e837d2759c6a2b9c7e74 | https://github.com/reptilbud/hapi-swagger/blob/8a4a1059f060a7100270e837d2759c6a2b9c7e74/public/swaggerui/swagger-ui.js#L11509-L11535 |
51,309 | reptilbud/hapi-swagger | public/swaggerui/swagger-ui.js | scanPunctuator | function scanPunctuator() {
var token, str;
token = {
type: Token.Punctuator,
value: '',
lineNumber: lineNumber,
lineStart: lineStart,
start: index,
end: index
};
// Check for most common single-character punctuators.
str = source[index];
switch (str) {
case '(':
if (extra.tokenize) {
extra.openParenToken = extra.tokenValues.length;
}
++index;
break;
case '{':
if (extra.tokenize) {
extra.openCurlyToken = extra.tokenValues.length;
}
state.curlyStack.push('{');
++index;
break;
case '.':
++index;
if (source[index] === '.' && source[index + 1] === '.') {
// Spread operator: ...
index += 2;
str = '...';
}
break;
case '}':
++index;
state.curlyStack.pop();
break;
case ')':
case ';':
case ',':
case '[':
case ']':
case ':':
case '?':
case '~':
++index;
break;
default:
// 4-character punctuator.
str = source.substr(index, 4);
if (str === '>>>=') {
index += 4;
} else {
// 3-character punctuators.
str = str.substr(0, 3);
if (str === '===' || str === '!==' || str === '>>>' ||
str === '<<=' || str === '>>=') {
index += 3;
} else {
// 2-character punctuators.
str = str.substr(0, 2);
if (str === '&&' || str === '||' || str === '==' || str === '!=' ||
str === '+=' || str === '-=' || str === '*=' || str === '/=' ||
str === '++' || str === '--' || str === '<<' || str === '>>' ||
str === '&=' || str === '|=' || str === '^=' || str === '%=' ||
str === '<=' || str === '>=' || str === '=>') {
index += 2;
} else {
// 1-character punctuators.
str = source[index];
if ('<>=!+-*%&|^/'.indexOf(str) >= 0) {
++index;
}
}
}
}
}
if (index === token.start) {
throwUnexpectedToken();
}
token.end = index;
token.value = str;
return token;
} | javascript | function scanPunctuator() {
var token, str;
token = {
type: Token.Punctuator,
value: '',
lineNumber: lineNumber,
lineStart: lineStart,
start: index,
end: index
};
// Check for most common single-character punctuators.
str = source[index];
switch (str) {
case '(':
if (extra.tokenize) {
extra.openParenToken = extra.tokenValues.length;
}
++index;
break;
case '{':
if (extra.tokenize) {
extra.openCurlyToken = extra.tokenValues.length;
}
state.curlyStack.push('{');
++index;
break;
case '.':
++index;
if (source[index] === '.' && source[index + 1] === '.') {
// Spread operator: ...
index += 2;
str = '...';
}
break;
case '}':
++index;
state.curlyStack.pop();
break;
case ')':
case ';':
case ',':
case '[':
case ']':
case ':':
case '?':
case '~':
++index;
break;
default:
// 4-character punctuator.
str = source.substr(index, 4);
if (str === '>>>=') {
index += 4;
} else {
// 3-character punctuators.
str = str.substr(0, 3);
if (str === '===' || str === '!==' || str === '>>>' ||
str === '<<=' || str === '>>=') {
index += 3;
} else {
// 2-character punctuators.
str = str.substr(0, 2);
if (str === '&&' || str === '||' || str === '==' || str === '!=' ||
str === '+=' || str === '-=' || str === '*=' || str === '/=' ||
str === '++' || str === '--' || str === '<<' || str === '>>' ||
str === '&=' || str === '|=' || str === '^=' || str === '%=' ||
str === '<=' || str === '>=' || str === '=>') {
index += 2;
} else {
// 1-character punctuators.
str = source[index];
if ('<>=!+-*%&|^/'.indexOf(str) >= 0) {
++index;
}
}
}
}
}
if (index === token.start) {
throwUnexpectedToken();
}
token.end = index;
token.value = str;
return token;
} | [
"function",
"scanPunctuator",
"(",
")",
"{",
"var",
"token",
",",
"str",
";",
"token",
"=",
"{",
"type",
":",
"Token",
".",
"Punctuator",
",",
"value",
":",
"''",
",",
"lineNumber",
":",
"lineNumber",
",",
"lineStart",
":",
"lineStart",
",",
"start",
":",
"index",
",",
"end",
":",
"index",
"}",
";",
"// Check for most common single-character punctuators.",
"str",
"=",
"source",
"[",
"index",
"]",
";",
"switch",
"(",
"str",
")",
"{",
"case",
"'('",
":",
"if",
"(",
"extra",
".",
"tokenize",
")",
"{",
"extra",
".",
"openParenToken",
"=",
"extra",
".",
"tokenValues",
".",
"length",
";",
"}",
"++",
"index",
";",
"break",
";",
"case",
"'{'",
":",
"if",
"(",
"extra",
".",
"tokenize",
")",
"{",
"extra",
".",
"openCurlyToken",
"=",
"extra",
".",
"tokenValues",
".",
"length",
";",
"}",
"state",
".",
"curlyStack",
".",
"push",
"(",
"'{'",
")",
";",
"++",
"index",
";",
"break",
";",
"case",
"'.'",
":",
"++",
"index",
";",
"if",
"(",
"source",
"[",
"index",
"]",
"===",
"'.'",
"&&",
"source",
"[",
"index",
"+",
"1",
"]",
"===",
"'.'",
")",
"{",
"// Spread operator: ...",
"index",
"+=",
"2",
";",
"str",
"=",
"'...'",
";",
"}",
"break",
";",
"case",
"'}'",
":",
"++",
"index",
";",
"state",
".",
"curlyStack",
".",
"pop",
"(",
")",
";",
"break",
";",
"case",
"')'",
":",
"case",
"';'",
":",
"case",
"','",
":",
"case",
"'['",
":",
"case",
"']'",
":",
"case",
"':'",
":",
"case",
"'?'",
":",
"case",
"'~'",
":",
"++",
"index",
";",
"break",
";",
"default",
":",
"// 4-character punctuator.",
"str",
"=",
"source",
".",
"substr",
"(",
"index",
",",
"4",
")",
";",
"if",
"(",
"str",
"===",
"'>>>='",
")",
"{",
"index",
"+=",
"4",
";",
"}",
"else",
"{",
"// 3-character punctuators.",
"str",
"=",
"str",
".",
"substr",
"(",
"0",
",",
"3",
")",
";",
"if",
"(",
"str",
"===",
"'==='",
"||",
"str",
"===",
"'!=='",
"||",
"str",
"===",
"'>>>'",
"||",
"str",
"===",
"'<<='",
"||",
"str",
"===",
"'>>='",
")",
"{",
"index",
"+=",
"3",
";",
"}",
"else",
"{",
"// 2-character punctuators.",
"str",
"=",
"str",
".",
"substr",
"(",
"0",
",",
"2",
")",
";",
"if",
"(",
"str",
"===",
"'&&'",
"||",
"str",
"===",
"'||'",
"||",
"str",
"===",
"'=='",
"||",
"str",
"===",
"'!='",
"||",
"str",
"===",
"'+='",
"||",
"str",
"===",
"'-='",
"||",
"str",
"===",
"'*='",
"||",
"str",
"===",
"'/='",
"||",
"str",
"===",
"'++'",
"||",
"str",
"===",
"'--'",
"||",
"str",
"===",
"'<<'",
"||",
"str",
"===",
"'>>'",
"||",
"str",
"===",
"'&='",
"||",
"str",
"===",
"'|='",
"||",
"str",
"===",
"'^='",
"||",
"str",
"===",
"'%='",
"||",
"str",
"===",
"'<='",
"||",
"str",
"===",
"'>='",
"||",
"str",
"===",
"'=>'",
")",
"{",
"index",
"+=",
"2",
";",
"}",
"else",
"{",
"// 1-character punctuators.",
"str",
"=",
"source",
"[",
"index",
"]",
";",
"if",
"(",
"'<>=!+-*%&|^/'",
".",
"indexOf",
"(",
"str",
")",
">=",
"0",
")",
"{",
"++",
"index",
";",
"}",
"}",
"}",
"}",
"}",
"if",
"(",
"index",
"===",
"token",
".",
"start",
")",
"{",
"throwUnexpectedToken",
"(",
")",
";",
"}",
"token",
".",
"end",
"=",
"index",
";",
"token",
".",
"value",
"=",
"str",
";",
"return",
"token",
";",
"}"
] | ECMA-262 11.7 Punctuators | [
"ECMA",
"-",
"262",
"11",
".",
"7",
"Punctuators"
] | 8a4a1059f060a7100270e837d2759c6a2b9c7e74 | https://github.com/reptilbud/hapi-swagger/blob/8a4a1059f060a7100270e837d2759c6a2b9c7e74/public/swaggerui/swagger-ui.js#L11902-L11998 |
51,310 | reptilbud/hapi-swagger | public/swaggerui/swagger-ui.js | scanTemplate | function scanTemplate() {
var cooked = '', ch, start, rawOffset, terminated, head, tail, restore, unescaped;
terminated = false;
tail = false;
start = index;
head = (source[index] === '`');
rawOffset = 2;
++index;
while (index < length) {
ch = source[index++];
if (ch === '`') {
rawOffset = 1;
tail = true;
terminated = true;
break;
} else if (ch === '$') {
if (source[index] === '{') {
state.curlyStack.push('${');
++index;
terminated = true;
break;
}
cooked += ch;
} else if (ch === '\\') {
ch = source[index++];
if (!isLineTerminator(ch.charCodeAt(0))) {
switch (ch) {
case 'n':
cooked += '\n';
break;
case 'r':
cooked += '\r';
break;
case 't':
cooked += '\t';
break;
case 'u':
case 'x':
if (source[index] === '{') {
++index;
cooked += scanUnicodeCodePointEscape();
} else {
restore = index;
unescaped = scanHexEscape(ch);
if (unescaped) {
cooked += unescaped;
} else {
index = restore;
cooked += ch;
}
}
break;
case 'b':
cooked += '\b';
break;
case 'f':
cooked += '\f';
break;
case 'v':
cooked += '\v';
break;
default:
if (ch === '0') {
if (isDecimalDigit(source.charCodeAt(index))) {
// Illegal: \01 \02 and so on
throwError(Messages.TemplateOctalLiteral);
}
cooked += '\0';
} else if (isOctalDigit(ch)) {
// Illegal: \1 \2
throwError(Messages.TemplateOctalLiteral);
} else {
cooked += ch;
}
break;
}
} else {
++lineNumber;
if (ch === '\r' && source[index] === '\n') {
++index;
}
lineStart = index;
}
} else if (isLineTerminator(ch.charCodeAt(0))) {
++lineNumber;
if (ch === '\r' && source[index] === '\n') {
++index;
}
lineStart = index;
cooked += '\n';
} else {
cooked += ch;
}
}
if (!terminated) {
throwUnexpectedToken();
}
if (!head) {
state.curlyStack.pop();
}
return {
type: Token.Template,
value: {
cooked: cooked,
raw: source.slice(start + 1, index - rawOffset)
},
head: head,
tail: tail,
lineNumber: lineNumber,
lineStart: lineStart,
start: start,
end: index
};
} | javascript | function scanTemplate() {
var cooked = '', ch, start, rawOffset, terminated, head, tail, restore, unescaped;
terminated = false;
tail = false;
start = index;
head = (source[index] === '`');
rawOffset = 2;
++index;
while (index < length) {
ch = source[index++];
if (ch === '`') {
rawOffset = 1;
tail = true;
terminated = true;
break;
} else if (ch === '$') {
if (source[index] === '{') {
state.curlyStack.push('${');
++index;
terminated = true;
break;
}
cooked += ch;
} else if (ch === '\\') {
ch = source[index++];
if (!isLineTerminator(ch.charCodeAt(0))) {
switch (ch) {
case 'n':
cooked += '\n';
break;
case 'r':
cooked += '\r';
break;
case 't':
cooked += '\t';
break;
case 'u':
case 'x':
if (source[index] === '{') {
++index;
cooked += scanUnicodeCodePointEscape();
} else {
restore = index;
unescaped = scanHexEscape(ch);
if (unescaped) {
cooked += unescaped;
} else {
index = restore;
cooked += ch;
}
}
break;
case 'b':
cooked += '\b';
break;
case 'f':
cooked += '\f';
break;
case 'v':
cooked += '\v';
break;
default:
if (ch === '0') {
if (isDecimalDigit(source.charCodeAt(index))) {
// Illegal: \01 \02 and so on
throwError(Messages.TemplateOctalLiteral);
}
cooked += '\0';
} else if (isOctalDigit(ch)) {
// Illegal: \1 \2
throwError(Messages.TemplateOctalLiteral);
} else {
cooked += ch;
}
break;
}
} else {
++lineNumber;
if (ch === '\r' && source[index] === '\n') {
++index;
}
lineStart = index;
}
} else if (isLineTerminator(ch.charCodeAt(0))) {
++lineNumber;
if (ch === '\r' && source[index] === '\n') {
++index;
}
lineStart = index;
cooked += '\n';
} else {
cooked += ch;
}
}
if (!terminated) {
throwUnexpectedToken();
}
if (!head) {
state.curlyStack.pop();
}
return {
type: Token.Template,
value: {
cooked: cooked,
raw: source.slice(start + 1, index - rawOffset)
},
head: head,
tail: tail,
lineNumber: lineNumber,
lineStart: lineStart,
start: start,
end: index
};
} | [
"function",
"scanTemplate",
"(",
")",
"{",
"var",
"cooked",
"=",
"''",
",",
"ch",
",",
"start",
",",
"rawOffset",
",",
"terminated",
",",
"head",
",",
"tail",
",",
"restore",
",",
"unescaped",
";",
"terminated",
"=",
"false",
";",
"tail",
"=",
"false",
";",
"start",
"=",
"index",
";",
"head",
"=",
"(",
"source",
"[",
"index",
"]",
"===",
"'`'",
")",
";",
"rawOffset",
"=",
"2",
";",
"++",
"index",
";",
"while",
"(",
"index",
"<",
"length",
")",
"{",
"ch",
"=",
"source",
"[",
"index",
"++",
"]",
";",
"if",
"(",
"ch",
"===",
"'`'",
")",
"{",
"rawOffset",
"=",
"1",
";",
"tail",
"=",
"true",
";",
"terminated",
"=",
"true",
";",
"break",
";",
"}",
"else",
"if",
"(",
"ch",
"===",
"'$'",
")",
"{",
"if",
"(",
"source",
"[",
"index",
"]",
"===",
"'{'",
")",
"{",
"state",
".",
"curlyStack",
".",
"push",
"(",
"'${'",
")",
";",
"++",
"index",
";",
"terminated",
"=",
"true",
";",
"break",
";",
"}",
"cooked",
"+=",
"ch",
";",
"}",
"else",
"if",
"(",
"ch",
"===",
"'\\\\'",
")",
"{",
"ch",
"=",
"source",
"[",
"index",
"++",
"]",
";",
"if",
"(",
"!",
"isLineTerminator",
"(",
"ch",
".",
"charCodeAt",
"(",
"0",
")",
")",
")",
"{",
"switch",
"(",
"ch",
")",
"{",
"case",
"'n'",
":",
"cooked",
"+=",
"'\\n'",
";",
"break",
";",
"case",
"'r'",
":",
"cooked",
"+=",
"'\\r'",
";",
"break",
";",
"case",
"'t'",
":",
"cooked",
"+=",
"'\\t'",
";",
"break",
";",
"case",
"'u'",
":",
"case",
"'x'",
":",
"if",
"(",
"source",
"[",
"index",
"]",
"===",
"'{'",
")",
"{",
"++",
"index",
";",
"cooked",
"+=",
"scanUnicodeCodePointEscape",
"(",
")",
";",
"}",
"else",
"{",
"restore",
"=",
"index",
";",
"unescaped",
"=",
"scanHexEscape",
"(",
"ch",
")",
";",
"if",
"(",
"unescaped",
")",
"{",
"cooked",
"+=",
"unescaped",
";",
"}",
"else",
"{",
"index",
"=",
"restore",
";",
"cooked",
"+=",
"ch",
";",
"}",
"}",
"break",
";",
"case",
"'b'",
":",
"cooked",
"+=",
"'\\b'",
";",
"break",
";",
"case",
"'f'",
":",
"cooked",
"+=",
"'\\f'",
";",
"break",
";",
"case",
"'v'",
":",
"cooked",
"+=",
"'\\v'",
";",
"break",
";",
"default",
":",
"if",
"(",
"ch",
"===",
"'0'",
")",
"{",
"if",
"(",
"isDecimalDigit",
"(",
"source",
".",
"charCodeAt",
"(",
"index",
")",
")",
")",
"{",
"// Illegal: \\01 \\02 and so on",
"throwError",
"(",
"Messages",
".",
"TemplateOctalLiteral",
")",
";",
"}",
"cooked",
"+=",
"'\\0'",
";",
"}",
"else",
"if",
"(",
"isOctalDigit",
"(",
"ch",
")",
")",
"{",
"// Illegal: \\1 \\2",
"throwError",
"(",
"Messages",
".",
"TemplateOctalLiteral",
")",
";",
"}",
"else",
"{",
"cooked",
"+=",
"ch",
";",
"}",
"break",
";",
"}",
"}",
"else",
"{",
"++",
"lineNumber",
";",
"if",
"(",
"ch",
"===",
"'\\r'",
"&&",
"source",
"[",
"index",
"]",
"===",
"'\\n'",
")",
"{",
"++",
"index",
";",
"}",
"lineStart",
"=",
"index",
";",
"}",
"}",
"else",
"if",
"(",
"isLineTerminator",
"(",
"ch",
".",
"charCodeAt",
"(",
"0",
")",
")",
")",
"{",
"++",
"lineNumber",
";",
"if",
"(",
"ch",
"===",
"'\\r'",
"&&",
"source",
"[",
"index",
"]",
"===",
"'\\n'",
")",
"{",
"++",
"index",
";",
"}",
"lineStart",
"=",
"index",
";",
"cooked",
"+=",
"'\\n'",
";",
"}",
"else",
"{",
"cooked",
"+=",
"ch",
";",
"}",
"}",
"if",
"(",
"!",
"terminated",
")",
"{",
"throwUnexpectedToken",
"(",
")",
";",
"}",
"if",
"(",
"!",
"head",
")",
"{",
"state",
".",
"curlyStack",
".",
"pop",
"(",
")",
";",
"}",
"return",
"{",
"type",
":",
"Token",
".",
"Template",
",",
"value",
":",
"{",
"cooked",
":",
"cooked",
",",
"raw",
":",
"source",
".",
"slice",
"(",
"start",
"+",
"1",
",",
"index",
"-",
"rawOffset",
")",
"}",
",",
"head",
":",
"head",
",",
"tail",
":",
"tail",
",",
"lineNumber",
":",
"lineNumber",
",",
"lineStart",
":",
"lineStart",
",",
"start",
":",
"start",
",",
"end",
":",
"index",
"}",
";",
"}"
] | ECMA-262 11.8.6 Template Literal Lexical Components | [
"ECMA",
"-",
"262",
"11",
".",
"8",
".",
"6",
"Template",
"Literal",
"Lexical",
"Components"
] | 8a4a1059f060a7100270e837d2759c6a2b9c7e74 | https://github.com/reptilbud/hapi-swagger/blob/8a4a1059f060a7100270e837d2759c6a2b9c7e74/public/swaggerui/swagger-ui.js#L12305-L12425 |
51,311 | reptilbud/hapi-swagger | public/swaggerui/swagger-ui.js | parseArrayPattern | function parseArrayPattern(params, kind) {
var node = new Node(), elements = [], rest, restNode;
expect('[');
while (!match(']')) {
if (match(',')) {
lex();
elements.push(null);
} else {
if (match('...')) {
restNode = new Node();
lex();
params.push(lookahead);
rest = parseVariableIdentifier(kind);
elements.push(restNode.finishRestElement(rest));
break;
} else {
elements.push(parsePatternWithDefault(params, kind));
}
if (!match(']')) {
expect(',');
}
}
}
expect(']');
return node.finishArrayPattern(elements);
} | javascript | function parseArrayPattern(params, kind) {
var node = new Node(), elements = [], rest, restNode;
expect('[');
while (!match(']')) {
if (match(',')) {
lex();
elements.push(null);
} else {
if (match('...')) {
restNode = new Node();
lex();
params.push(lookahead);
rest = parseVariableIdentifier(kind);
elements.push(restNode.finishRestElement(rest));
break;
} else {
elements.push(parsePatternWithDefault(params, kind));
}
if (!match(']')) {
expect(',');
}
}
}
expect(']');
return node.finishArrayPattern(elements);
} | [
"function",
"parseArrayPattern",
"(",
"params",
",",
"kind",
")",
"{",
"var",
"node",
"=",
"new",
"Node",
"(",
")",
",",
"elements",
"=",
"[",
"]",
",",
"rest",
",",
"restNode",
";",
"expect",
"(",
"'['",
")",
";",
"while",
"(",
"!",
"match",
"(",
"']'",
")",
")",
"{",
"if",
"(",
"match",
"(",
"','",
")",
")",
"{",
"lex",
"(",
")",
";",
"elements",
".",
"push",
"(",
"null",
")",
";",
"}",
"else",
"{",
"if",
"(",
"match",
"(",
"'...'",
")",
")",
"{",
"restNode",
"=",
"new",
"Node",
"(",
")",
";",
"lex",
"(",
")",
";",
"params",
".",
"push",
"(",
"lookahead",
")",
";",
"rest",
"=",
"parseVariableIdentifier",
"(",
"kind",
")",
";",
"elements",
".",
"push",
"(",
"restNode",
".",
"finishRestElement",
"(",
"rest",
")",
")",
";",
"break",
";",
"}",
"else",
"{",
"elements",
".",
"push",
"(",
"parsePatternWithDefault",
"(",
"params",
",",
"kind",
")",
")",
";",
"}",
"if",
"(",
"!",
"match",
"(",
"']'",
")",
")",
"{",
"expect",
"(",
"','",
")",
";",
"}",
"}",
"}",
"expect",
"(",
"']'",
")",
";",
"return",
"node",
".",
"finishArrayPattern",
"(",
"elements",
")",
";",
"}"
] | ECMA-262 13.3.3 Destructuring Binding Patterns | [
"ECMA",
"-",
"262",
"13",
".",
"3",
".",
"3",
"Destructuring",
"Binding",
"Patterns"
] | 8a4a1059f060a7100270e837d2759c6a2b9c7e74 | https://github.com/reptilbud/hapi-swagger/blob/8a4a1059f060a7100270e837d2759c6a2b9c7e74/public/swaggerui/swagger-ui.js#L13838-L13867 |
51,312 | reptilbud/hapi-swagger | public/swaggerui/swagger-ui.js | parsePropertyFunction | function parsePropertyFunction(node, paramInfo, isGenerator) {
var previousStrict, body;
isAssignmentTarget = isBindingElement = false;
previousStrict = strict;
body = isolateCoverGrammar(parseFunctionSourceElements);
if (strict && paramInfo.firstRestricted) {
tolerateUnexpectedToken(paramInfo.firstRestricted, paramInfo.message);
}
if (strict && paramInfo.stricted) {
tolerateUnexpectedToken(paramInfo.stricted, paramInfo.message);
}
strict = previousStrict;
return node.finishFunctionExpression(null, paramInfo.params, paramInfo.defaults, body, isGenerator);
} | javascript | function parsePropertyFunction(node, paramInfo, isGenerator) {
var previousStrict, body;
isAssignmentTarget = isBindingElement = false;
previousStrict = strict;
body = isolateCoverGrammar(parseFunctionSourceElements);
if (strict && paramInfo.firstRestricted) {
tolerateUnexpectedToken(paramInfo.firstRestricted, paramInfo.message);
}
if (strict && paramInfo.stricted) {
tolerateUnexpectedToken(paramInfo.stricted, paramInfo.message);
}
strict = previousStrict;
return node.finishFunctionExpression(null, paramInfo.params, paramInfo.defaults, body, isGenerator);
} | [
"function",
"parsePropertyFunction",
"(",
"node",
",",
"paramInfo",
",",
"isGenerator",
")",
"{",
"var",
"previousStrict",
",",
"body",
";",
"isAssignmentTarget",
"=",
"isBindingElement",
"=",
"false",
";",
"previousStrict",
"=",
"strict",
";",
"body",
"=",
"isolateCoverGrammar",
"(",
"parseFunctionSourceElements",
")",
";",
"if",
"(",
"strict",
"&&",
"paramInfo",
".",
"firstRestricted",
")",
"{",
"tolerateUnexpectedToken",
"(",
"paramInfo",
".",
"firstRestricted",
",",
"paramInfo",
".",
"message",
")",
";",
"}",
"if",
"(",
"strict",
"&&",
"paramInfo",
".",
"stricted",
")",
"{",
"tolerateUnexpectedToken",
"(",
"paramInfo",
".",
"stricted",
",",
"paramInfo",
".",
"message",
")",
";",
"}",
"strict",
"=",
"previousStrict",
";",
"return",
"node",
".",
"finishFunctionExpression",
"(",
"null",
",",
"paramInfo",
".",
"params",
",",
"paramInfo",
".",
"defaults",
",",
"body",
",",
"isGenerator",
")",
";",
"}"
] | ECMA-262 12.2.6 Object Initializer | [
"ECMA",
"-",
"262",
"12",
".",
"2",
".",
"6",
"Object",
"Initializer"
] | 8a4a1059f060a7100270e837d2759c6a2b9c7e74 | https://github.com/reptilbud/hapi-swagger/blob/8a4a1059f060a7100270e837d2759c6a2b9c7e74/public/swaggerui/swagger-ui.js#L13977-L13994 |
51,313 | reptilbud/hapi-swagger | public/swaggerui/swagger-ui.js | parseTemplateElement | function parseTemplateElement(option) {
var node, token;
if (lookahead.type !== Token.Template || (option.head && !lookahead.head)) {
throwUnexpectedToken();
}
node = new Node();
token = lex();
return node.finishTemplateElement({ raw: token.value.raw, cooked: token.value.cooked }, token.tail);
} | javascript | function parseTemplateElement(option) {
var node, token;
if (lookahead.type !== Token.Template || (option.head && !lookahead.head)) {
throwUnexpectedToken();
}
node = new Node();
token = lex();
return node.finishTemplateElement({ raw: token.value.raw, cooked: token.value.cooked }, token.tail);
} | [
"function",
"parseTemplateElement",
"(",
"option",
")",
"{",
"var",
"node",
",",
"token",
";",
"if",
"(",
"lookahead",
".",
"type",
"!==",
"Token",
".",
"Template",
"||",
"(",
"option",
".",
"head",
"&&",
"!",
"lookahead",
".",
"head",
")",
")",
"{",
"throwUnexpectedToken",
"(",
")",
";",
"}",
"node",
"=",
"new",
"Node",
"(",
")",
";",
"token",
"=",
"lex",
"(",
")",
";",
"return",
"node",
".",
"finishTemplateElement",
"(",
"{",
"raw",
":",
"token",
".",
"value",
".",
"raw",
",",
"cooked",
":",
"token",
".",
"value",
".",
"cooked",
"}",
",",
"token",
".",
"tail",
")",
";",
"}"
] | ECMA-262 12.2.9 Template Literals | [
"ECMA",
"-",
"262",
"12",
".",
"2",
".",
"9",
"Template",
"Literals"
] | 8a4a1059f060a7100270e837d2759c6a2b9c7e74 | https://github.com/reptilbud/hapi-swagger/blob/8a4a1059f060a7100270e837d2759c6a2b9c7e74/public/swaggerui/swagger-ui.js#L14248-L14259 |
51,314 | reptilbud/hapi-swagger | public/swaggerui/swagger-ui.js | parseGroupExpression | function parseGroupExpression() {
var expr, expressions, startToken, i, params = [];
expect('(');
if (match(')')) {
lex();
if (!match('=>')) {
expect('=>');
}
return {
type: PlaceHolders.ArrowParameterPlaceHolder,
params: [],
rawParams: []
};
}
startToken = lookahead;
if (match('...')) {
expr = parseRestElement(params);
expect(')');
if (!match('=>')) {
expect('=>');
}
return {
type: PlaceHolders.ArrowParameterPlaceHolder,
params: [expr]
};
}
isBindingElement = true;
expr = inheritCoverGrammar(parseAssignmentExpression);
if (match(',')) {
isAssignmentTarget = false;
expressions = [expr];
while (startIndex < length) {
if (!match(',')) {
break;
}
lex();
if (match('...')) {
if (!isBindingElement) {
throwUnexpectedToken(lookahead);
}
expressions.push(parseRestElement(params));
expect(')');
if (!match('=>')) {
expect('=>');
}
isBindingElement = false;
for (i = 0; i < expressions.length; i++) {
reinterpretExpressionAsPattern(expressions[i]);
}
return {
type: PlaceHolders.ArrowParameterPlaceHolder,
params: expressions
};
}
expressions.push(inheritCoverGrammar(parseAssignmentExpression));
}
expr = new WrappingNode(startToken).finishSequenceExpression(expressions);
}
expect(')');
if (match('=>')) {
if (expr.type === Syntax.Identifier && expr.name === 'yield') {
return {
type: PlaceHolders.ArrowParameterPlaceHolder,
params: [expr]
};
}
if (!isBindingElement) {
throwUnexpectedToken(lookahead);
}
if (expr.type === Syntax.SequenceExpression) {
for (i = 0; i < expr.expressions.length; i++) {
reinterpretExpressionAsPattern(expr.expressions[i]);
}
} else {
reinterpretExpressionAsPattern(expr);
}
expr = {
type: PlaceHolders.ArrowParameterPlaceHolder,
params: expr.type === Syntax.SequenceExpression ? expr.expressions : [expr]
};
}
isBindingElement = false;
return expr;
} | javascript | function parseGroupExpression() {
var expr, expressions, startToken, i, params = [];
expect('(');
if (match(')')) {
lex();
if (!match('=>')) {
expect('=>');
}
return {
type: PlaceHolders.ArrowParameterPlaceHolder,
params: [],
rawParams: []
};
}
startToken = lookahead;
if (match('...')) {
expr = parseRestElement(params);
expect(')');
if (!match('=>')) {
expect('=>');
}
return {
type: PlaceHolders.ArrowParameterPlaceHolder,
params: [expr]
};
}
isBindingElement = true;
expr = inheritCoverGrammar(parseAssignmentExpression);
if (match(',')) {
isAssignmentTarget = false;
expressions = [expr];
while (startIndex < length) {
if (!match(',')) {
break;
}
lex();
if (match('...')) {
if (!isBindingElement) {
throwUnexpectedToken(lookahead);
}
expressions.push(parseRestElement(params));
expect(')');
if (!match('=>')) {
expect('=>');
}
isBindingElement = false;
for (i = 0; i < expressions.length; i++) {
reinterpretExpressionAsPattern(expressions[i]);
}
return {
type: PlaceHolders.ArrowParameterPlaceHolder,
params: expressions
};
}
expressions.push(inheritCoverGrammar(parseAssignmentExpression));
}
expr = new WrappingNode(startToken).finishSequenceExpression(expressions);
}
expect(')');
if (match('=>')) {
if (expr.type === Syntax.Identifier && expr.name === 'yield') {
return {
type: PlaceHolders.ArrowParameterPlaceHolder,
params: [expr]
};
}
if (!isBindingElement) {
throwUnexpectedToken(lookahead);
}
if (expr.type === Syntax.SequenceExpression) {
for (i = 0; i < expr.expressions.length; i++) {
reinterpretExpressionAsPattern(expr.expressions[i]);
}
} else {
reinterpretExpressionAsPattern(expr);
}
expr = {
type: PlaceHolders.ArrowParameterPlaceHolder,
params: expr.type === Syntax.SequenceExpression ? expr.expressions : [expr]
};
}
isBindingElement = false;
return expr;
} | [
"function",
"parseGroupExpression",
"(",
")",
"{",
"var",
"expr",
",",
"expressions",
",",
"startToken",
",",
"i",
",",
"params",
"=",
"[",
"]",
";",
"expect",
"(",
"'('",
")",
";",
"if",
"(",
"match",
"(",
"')'",
")",
")",
"{",
"lex",
"(",
")",
";",
"if",
"(",
"!",
"match",
"(",
"'=>'",
")",
")",
"{",
"expect",
"(",
"'=>'",
")",
";",
"}",
"return",
"{",
"type",
":",
"PlaceHolders",
".",
"ArrowParameterPlaceHolder",
",",
"params",
":",
"[",
"]",
",",
"rawParams",
":",
"[",
"]",
"}",
";",
"}",
"startToken",
"=",
"lookahead",
";",
"if",
"(",
"match",
"(",
"'...'",
")",
")",
"{",
"expr",
"=",
"parseRestElement",
"(",
"params",
")",
";",
"expect",
"(",
"')'",
")",
";",
"if",
"(",
"!",
"match",
"(",
"'=>'",
")",
")",
"{",
"expect",
"(",
"'=>'",
")",
";",
"}",
"return",
"{",
"type",
":",
"PlaceHolders",
".",
"ArrowParameterPlaceHolder",
",",
"params",
":",
"[",
"expr",
"]",
"}",
";",
"}",
"isBindingElement",
"=",
"true",
";",
"expr",
"=",
"inheritCoverGrammar",
"(",
"parseAssignmentExpression",
")",
";",
"if",
"(",
"match",
"(",
"','",
")",
")",
"{",
"isAssignmentTarget",
"=",
"false",
";",
"expressions",
"=",
"[",
"expr",
"]",
";",
"while",
"(",
"startIndex",
"<",
"length",
")",
"{",
"if",
"(",
"!",
"match",
"(",
"','",
")",
")",
"{",
"break",
";",
"}",
"lex",
"(",
")",
";",
"if",
"(",
"match",
"(",
"'...'",
")",
")",
"{",
"if",
"(",
"!",
"isBindingElement",
")",
"{",
"throwUnexpectedToken",
"(",
"lookahead",
")",
";",
"}",
"expressions",
".",
"push",
"(",
"parseRestElement",
"(",
"params",
")",
")",
";",
"expect",
"(",
"')'",
")",
";",
"if",
"(",
"!",
"match",
"(",
"'=>'",
")",
")",
"{",
"expect",
"(",
"'=>'",
")",
";",
"}",
"isBindingElement",
"=",
"false",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"expressions",
".",
"length",
";",
"i",
"++",
")",
"{",
"reinterpretExpressionAsPattern",
"(",
"expressions",
"[",
"i",
"]",
")",
";",
"}",
"return",
"{",
"type",
":",
"PlaceHolders",
".",
"ArrowParameterPlaceHolder",
",",
"params",
":",
"expressions",
"}",
";",
"}",
"expressions",
".",
"push",
"(",
"inheritCoverGrammar",
"(",
"parseAssignmentExpression",
")",
")",
";",
"}",
"expr",
"=",
"new",
"WrappingNode",
"(",
"startToken",
")",
".",
"finishSequenceExpression",
"(",
"expressions",
")",
";",
"}",
"expect",
"(",
"')'",
")",
";",
"if",
"(",
"match",
"(",
"'=>'",
")",
")",
"{",
"if",
"(",
"expr",
".",
"type",
"===",
"Syntax",
".",
"Identifier",
"&&",
"expr",
".",
"name",
"===",
"'yield'",
")",
"{",
"return",
"{",
"type",
":",
"PlaceHolders",
".",
"ArrowParameterPlaceHolder",
",",
"params",
":",
"[",
"expr",
"]",
"}",
";",
"}",
"if",
"(",
"!",
"isBindingElement",
")",
"{",
"throwUnexpectedToken",
"(",
"lookahead",
")",
";",
"}",
"if",
"(",
"expr",
".",
"type",
"===",
"Syntax",
".",
"SequenceExpression",
")",
"{",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"expr",
".",
"expressions",
".",
"length",
";",
"i",
"++",
")",
"{",
"reinterpretExpressionAsPattern",
"(",
"expr",
".",
"expressions",
"[",
"i",
"]",
")",
";",
"}",
"}",
"else",
"{",
"reinterpretExpressionAsPattern",
"(",
"expr",
")",
";",
"}",
"expr",
"=",
"{",
"type",
":",
"PlaceHolders",
".",
"ArrowParameterPlaceHolder",
",",
"params",
":",
"expr",
".",
"type",
"===",
"Syntax",
".",
"SequenceExpression",
"?",
"expr",
".",
"expressions",
":",
"[",
"expr",
"]",
"}",
";",
"}",
"isBindingElement",
"=",
"false",
";",
"return",
"expr",
";",
"}"
] | ECMA-262 12.2.10 The Grouping Operator | [
"ECMA",
"-",
"262",
"12",
".",
"2",
".",
"10",
"The",
"Grouping",
"Operator"
] | 8a4a1059f060a7100270e837d2759c6a2b9c7e74 | https://github.com/reptilbud/hapi-swagger/blob/8a4a1059f060a7100270e837d2759c6a2b9c7e74/public/swaggerui/swagger-ui.js#L14279-L14377 |
51,315 | reptilbud/hapi-swagger | public/swaggerui/swagger-ui.js | parsePrimaryExpression | function parsePrimaryExpression() {
var type, token, expr, node;
if (match('(')) {
isBindingElement = false;
return inheritCoverGrammar(parseGroupExpression);
}
if (match('[')) {
return inheritCoverGrammar(parseArrayInitializer);
}
if (match('{')) {
return inheritCoverGrammar(parseObjectInitializer);
}
type = lookahead.type;
node = new Node();
if (type === Token.Identifier) {
if (state.sourceType === 'module' && lookahead.value === 'await') {
tolerateUnexpectedToken(lookahead);
}
expr = node.finishIdentifier(lex().value);
} else if (type === Token.StringLiteral || type === Token.NumericLiteral) {
isAssignmentTarget = isBindingElement = false;
if (strict && lookahead.octal) {
tolerateUnexpectedToken(lookahead, Messages.StrictOctalLiteral);
}
expr = node.finishLiteral(lex());
} else if (type === Token.Keyword) {
if (!strict && state.allowYield && matchKeyword('yield')) {
return parseNonComputedProperty();
}
if (!strict && matchKeyword('let')) {
return node.finishIdentifier(lex().value);
}
isAssignmentTarget = isBindingElement = false;
if (matchKeyword('function')) {
return parseFunctionExpression();
}
if (matchKeyword('this')) {
lex();
return node.finishThisExpression();
}
if (matchKeyword('class')) {
return parseClassExpression();
}
throwUnexpectedToken(lex());
} else if (type === Token.BooleanLiteral) {
isAssignmentTarget = isBindingElement = false;
token = lex();
token.value = (token.value === 'true');
expr = node.finishLiteral(token);
} else if (type === Token.NullLiteral) {
isAssignmentTarget = isBindingElement = false;
token = lex();
token.value = null;
expr = node.finishLiteral(token);
} else if (match('/') || match('/=')) {
isAssignmentTarget = isBindingElement = false;
index = startIndex;
if (typeof extra.tokens !== 'undefined') {
token = collectRegex();
} else {
token = scanRegExp();
}
lex();
expr = node.finishLiteral(token);
} else if (type === Token.Template) {
expr = parseTemplateLiteral();
} else {
throwUnexpectedToken(lex());
}
return expr;
} | javascript | function parsePrimaryExpression() {
var type, token, expr, node;
if (match('(')) {
isBindingElement = false;
return inheritCoverGrammar(parseGroupExpression);
}
if (match('[')) {
return inheritCoverGrammar(parseArrayInitializer);
}
if (match('{')) {
return inheritCoverGrammar(parseObjectInitializer);
}
type = lookahead.type;
node = new Node();
if (type === Token.Identifier) {
if (state.sourceType === 'module' && lookahead.value === 'await') {
tolerateUnexpectedToken(lookahead);
}
expr = node.finishIdentifier(lex().value);
} else if (type === Token.StringLiteral || type === Token.NumericLiteral) {
isAssignmentTarget = isBindingElement = false;
if (strict && lookahead.octal) {
tolerateUnexpectedToken(lookahead, Messages.StrictOctalLiteral);
}
expr = node.finishLiteral(lex());
} else if (type === Token.Keyword) {
if (!strict && state.allowYield && matchKeyword('yield')) {
return parseNonComputedProperty();
}
if (!strict && matchKeyword('let')) {
return node.finishIdentifier(lex().value);
}
isAssignmentTarget = isBindingElement = false;
if (matchKeyword('function')) {
return parseFunctionExpression();
}
if (matchKeyword('this')) {
lex();
return node.finishThisExpression();
}
if (matchKeyword('class')) {
return parseClassExpression();
}
throwUnexpectedToken(lex());
} else if (type === Token.BooleanLiteral) {
isAssignmentTarget = isBindingElement = false;
token = lex();
token.value = (token.value === 'true');
expr = node.finishLiteral(token);
} else if (type === Token.NullLiteral) {
isAssignmentTarget = isBindingElement = false;
token = lex();
token.value = null;
expr = node.finishLiteral(token);
} else if (match('/') || match('/=')) {
isAssignmentTarget = isBindingElement = false;
index = startIndex;
if (typeof extra.tokens !== 'undefined') {
token = collectRegex();
} else {
token = scanRegExp();
}
lex();
expr = node.finishLiteral(token);
} else if (type === Token.Template) {
expr = parseTemplateLiteral();
} else {
throwUnexpectedToken(lex());
}
return expr;
} | [
"function",
"parsePrimaryExpression",
"(",
")",
"{",
"var",
"type",
",",
"token",
",",
"expr",
",",
"node",
";",
"if",
"(",
"match",
"(",
"'('",
")",
")",
"{",
"isBindingElement",
"=",
"false",
";",
"return",
"inheritCoverGrammar",
"(",
"parseGroupExpression",
")",
";",
"}",
"if",
"(",
"match",
"(",
"'['",
")",
")",
"{",
"return",
"inheritCoverGrammar",
"(",
"parseArrayInitializer",
")",
";",
"}",
"if",
"(",
"match",
"(",
"'{'",
")",
")",
"{",
"return",
"inheritCoverGrammar",
"(",
"parseObjectInitializer",
")",
";",
"}",
"type",
"=",
"lookahead",
".",
"type",
";",
"node",
"=",
"new",
"Node",
"(",
")",
";",
"if",
"(",
"type",
"===",
"Token",
".",
"Identifier",
")",
"{",
"if",
"(",
"state",
".",
"sourceType",
"===",
"'module'",
"&&",
"lookahead",
".",
"value",
"===",
"'await'",
")",
"{",
"tolerateUnexpectedToken",
"(",
"lookahead",
")",
";",
"}",
"expr",
"=",
"node",
".",
"finishIdentifier",
"(",
"lex",
"(",
")",
".",
"value",
")",
";",
"}",
"else",
"if",
"(",
"type",
"===",
"Token",
".",
"StringLiteral",
"||",
"type",
"===",
"Token",
".",
"NumericLiteral",
")",
"{",
"isAssignmentTarget",
"=",
"isBindingElement",
"=",
"false",
";",
"if",
"(",
"strict",
"&&",
"lookahead",
".",
"octal",
")",
"{",
"tolerateUnexpectedToken",
"(",
"lookahead",
",",
"Messages",
".",
"StrictOctalLiteral",
")",
";",
"}",
"expr",
"=",
"node",
".",
"finishLiteral",
"(",
"lex",
"(",
")",
")",
";",
"}",
"else",
"if",
"(",
"type",
"===",
"Token",
".",
"Keyword",
")",
"{",
"if",
"(",
"!",
"strict",
"&&",
"state",
".",
"allowYield",
"&&",
"matchKeyword",
"(",
"'yield'",
")",
")",
"{",
"return",
"parseNonComputedProperty",
"(",
")",
";",
"}",
"if",
"(",
"!",
"strict",
"&&",
"matchKeyword",
"(",
"'let'",
")",
")",
"{",
"return",
"node",
".",
"finishIdentifier",
"(",
"lex",
"(",
")",
".",
"value",
")",
";",
"}",
"isAssignmentTarget",
"=",
"isBindingElement",
"=",
"false",
";",
"if",
"(",
"matchKeyword",
"(",
"'function'",
")",
")",
"{",
"return",
"parseFunctionExpression",
"(",
")",
";",
"}",
"if",
"(",
"matchKeyword",
"(",
"'this'",
")",
")",
"{",
"lex",
"(",
")",
";",
"return",
"node",
".",
"finishThisExpression",
"(",
")",
";",
"}",
"if",
"(",
"matchKeyword",
"(",
"'class'",
")",
")",
"{",
"return",
"parseClassExpression",
"(",
")",
";",
"}",
"throwUnexpectedToken",
"(",
"lex",
"(",
")",
")",
";",
"}",
"else",
"if",
"(",
"type",
"===",
"Token",
".",
"BooleanLiteral",
")",
"{",
"isAssignmentTarget",
"=",
"isBindingElement",
"=",
"false",
";",
"token",
"=",
"lex",
"(",
")",
";",
"token",
".",
"value",
"=",
"(",
"token",
".",
"value",
"===",
"'true'",
")",
";",
"expr",
"=",
"node",
".",
"finishLiteral",
"(",
"token",
")",
";",
"}",
"else",
"if",
"(",
"type",
"===",
"Token",
".",
"NullLiteral",
")",
"{",
"isAssignmentTarget",
"=",
"isBindingElement",
"=",
"false",
";",
"token",
"=",
"lex",
"(",
")",
";",
"token",
".",
"value",
"=",
"null",
";",
"expr",
"=",
"node",
".",
"finishLiteral",
"(",
"token",
")",
";",
"}",
"else",
"if",
"(",
"match",
"(",
"'/'",
")",
"||",
"match",
"(",
"'/='",
")",
")",
"{",
"isAssignmentTarget",
"=",
"isBindingElement",
"=",
"false",
";",
"index",
"=",
"startIndex",
";",
"if",
"(",
"typeof",
"extra",
".",
"tokens",
"!==",
"'undefined'",
")",
"{",
"token",
"=",
"collectRegex",
"(",
")",
";",
"}",
"else",
"{",
"token",
"=",
"scanRegExp",
"(",
")",
";",
"}",
"lex",
"(",
")",
";",
"expr",
"=",
"node",
".",
"finishLiteral",
"(",
"token",
")",
";",
"}",
"else",
"if",
"(",
"type",
"===",
"Token",
".",
"Template",
")",
"{",
"expr",
"=",
"parseTemplateLiteral",
"(",
")",
";",
"}",
"else",
"{",
"throwUnexpectedToken",
"(",
"lex",
"(",
")",
")",
";",
"}",
"return",
"expr",
";",
"}"
] | ECMA-262 12.2 Primary Expressions | [
"ECMA",
"-",
"262",
"12",
".",
"2",
"Primary",
"Expressions"
] | 8a4a1059f060a7100270e837d2759c6a2b9c7e74 | https://github.com/reptilbud/hapi-swagger/blob/8a4a1059f060a7100270e837d2759c6a2b9c7e74/public/swaggerui/swagger-ui.js#L14382-L14459 |
51,316 | reptilbud/hapi-swagger | public/swaggerui/swagger-ui.js | parseArguments | function parseArguments() {
var args = [], expr;
expect('(');
if (!match(')')) {
while (startIndex < length) {
if (match('...')) {
expr = new Node();
lex();
expr.finishSpreadElement(isolateCoverGrammar(parseAssignmentExpression));
} else {
expr = isolateCoverGrammar(parseAssignmentExpression);
}
args.push(expr);
if (match(')')) {
break;
}
expectCommaSeparator();
}
}
expect(')');
return args;
} | javascript | function parseArguments() {
var args = [], expr;
expect('(');
if (!match(')')) {
while (startIndex < length) {
if (match('...')) {
expr = new Node();
lex();
expr.finishSpreadElement(isolateCoverGrammar(parseAssignmentExpression));
} else {
expr = isolateCoverGrammar(parseAssignmentExpression);
}
args.push(expr);
if (match(')')) {
break;
}
expectCommaSeparator();
}
}
expect(')');
return args;
} | [
"function",
"parseArguments",
"(",
")",
"{",
"var",
"args",
"=",
"[",
"]",
",",
"expr",
";",
"expect",
"(",
"'('",
")",
";",
"if",
"(",
"!",
"match",
"(",
"')'",
")",
")",
"{",
"while",
"(",
"startIndex",
"<",
"length",
")",
"{",
"if",
"(",
"match",
"(",
"'...'",
")",
")",
"{",
"expr",
"=",
"new",
"Node",
"(",
")",
";",
"lex",
"(",
")",
";",
"expr",
".",
"finishSpreadElement",
"(",
"isolateCoverGrammar",
"(",
"parseAssignmentExpression",
")",
")",
";",
"}",
"else",
"{",
"expr",
"=",
"isolateCoverGrammar",
"(",
"parseAssignmentExpression",
")",
";",
"}",
"args",
".",
"push",
"(",
"expr",
")",
";",
"if",
"(",
"match",
"(",
"')'",
")",
")",
"{",
"break",
";",
"}",
"expectCommaSeparator",
"(",
")",
";",
"}",
"}",
"expect",
"(",
"')'",
")",
";",
"return",
"args",
";",
"}"
] | ECMA-262 12.3 Left-Hand-Side Expressions | [
"ECMA",
"-",
"262",
"12",
".",
"3",
"Left",
"-",
"Hand",
"-",
"Side",
"Expressions"
] | 8a4a1059f060a7100270e837d2759c6a2b9c7e74 | https://github.com/reptilbud/hapi-swagger/blob/8a4a1059f060a7100270e837d2759c6a2b9c7e74/public/swaggerui/swagger-ui.js#L14463-L14488 |
51,317 | reptilbud/hapi-swagger | public/swaggerui/swagger-ui.js | parseNewExpression | function parseNewExpression() {
var callee, args, node = new Node();
expectKeyword('new');
if (match('.')) {
lex();
if (lookahead.type === Token.Identifier && lookahead.value === 'target') {
if (state.inFunctionBody) {
lex();
return node.finishMetaProperty('new', 'target');
}
}
throwUnexpectedToken(lookahead);
}
callee = isolateCoverGrammar(parseLeftHandSideExpression);
args = match('(') ? parseArguments() : [];
isAssignmentTarget = isBindingElement = false;
return node.finishNewExpression(callee, args);
} | javascript | function parseNewExpression() {
var callee, args, node = new Node();
expectKeyword('new');
if (match('.')) {
lex();
if (lookahead.type === Token.Identifier && lookahead.value === 'target') {
if (state.inFunctionBody) {
lex();
return node.finishMetaProperty('new', 'target');
}
}
throwUnexpectedToken(lookahead);
}
callee = isolateCoverGrammar(parseLeftHandSideExpression);
args = match('(') ? parseArguments() : [];
isAssignmentTarget = isBindingElement = false;
return node.finishNewExpression(callee, args);
} | [
"function",
"parseNewExpression",
"(",
")",
"{",
"var",
"callee",
",",
"args",
",",
"node",
"=",
"new",
"Node",
"(",
")",
";",
"expectKeyword",
"(",
"'new'",
")",
";",
"if",
"(",
"match",
"(",
"'.'",
")",
")",
"{",
"lex",
"(",
")",
";",
"if",
"(",
"lookahead",
".",
"type",
"===",
"Token",
".",
"Identifier",
"&&",
"lookahead",
".",
"value",
"===",
"'target'",
")",
"{",
"if",
"(",
"state",
".",
"inFunctionBody",
")",
"{",
"lex",
"(",
")",
";",
"return",
"node",
".",
"finishMetaProperty",
"(",
"'new'",
",",
"'target'",
")",
";",
"}",
"}",
"throwUnexpectedToken",
"(",
"lookahead",
")",
";",
"}",
"callee",
"=",
"isolateCoverGrammar",
"(",
"parseLeftHandSideExpression",
")",
";",
"args",
"=",
"match",
"(",
"'('",
")",
"?",
"parseArguments",
"(",
")",
":",
"[",
"]",
";",
"isAssignmentTarget",
"=",
"isBindingElement",
"=",
"false",
";",
"return",
"node",
".",
"finishNewExpression",
"(",
"callee",
",",
"args",
")",
";",
"}"
] | ECMA-262 12.3.3 The new Operator | [
"ECMA",
"-",
"262",
"12",
".",
"3",
".",
"3",
"The",
"new",
"Operator"
] | 8a4a1059f060a7100270e837d2759c6a2b9c7e74 | https://github.com/reptilbud/hapi-swagger/blob/8a4a1059f060a7100270e837d2759c6a2b9c7e74/public/swaggerui/swagger-ui.js#L14522-L14544 |
51,318 | reptilbud/hapi-swagger | public/swaggerui/swagger-ui.js | parseLeftHandSideExpressionAllowCall | function parseLeftHandSideExpressionAllowCall() {
var quasi, expr, args, property, startToken, previousAllowIn = state.allowIn;
startToken = lookahead;
state.allowIn = true;
if (matchKeyword('super') && state.inFunctionBody) {
expr = new Node();
lex();
expr = expr.finishSuper();
if (!match('(') && !match('.') && !match('[')) {
throwUnexpectedToken(lookahead);
}
} else {
expr = inheritCoverGrammar(matchKeyword('new') ? parseNewExpression : parsePrimaryExpression);
}
for (;;) {
if (match('.')) {
isBindingElement = false;
isAssignmentTarget = true;
property = parseNonComputedMember();
expr = new WrappingNode(startToken).finishMemberExpression('.', expr, property);
} else if (match('(')) {
isBindingElement = false;
isAssignmentTarget = false;
args = parseArguments();
expr = new WrappingNode(startToken).finishCallExpression(expr, args);
} else if (match('[')) {
isBindingElement = false;
isAssignmentTarget = true;
property = parseComputedMember();
expr = new WrappingNode(startToken).finishMemberExpression('[', expr, property);
} else if (lookahead.type === Token.Template && lookahead.head) {
quasi = parseTemplateLiteral();
expr = new WrappingNode(startToken).finishTaggedTemplateExpression(expr, quasi);
} else {
break;
}
}
state.allowIn = previousAllowIn;
return expr;
} | javascript | function parseLeftHandSideExpressionAllowCall() {
var quasi, expr, args, property, startToken, previousAllowIn = state.allowIn;
startToken = lookahead;
state.allowIn = true;
if (matchKeyword('super') && state.inFunctionBody) {
expr = new Node();
lex();
expr = expr.finishSuper();
if (!match('(') && !match('.') && !match('[')) {
throwUnexpectedToken(lookahead);
}
} else {
expr = inheritCoverGrammar(matchKeyword('new') ? parseNewExpression : parsePrimaryExpression);
}
for (;;) {
if (match('.')) {
isBindingElement = false;
isAssignmentTarget = true;
property = parseNonComputedMember();
expr = new WrappingNode(startToken).finishMemberExpression('.', expr, property);
} else if (match('(')) {
isBindingElement = false;
isAssignmentTarget = false;
args = parseArguments();
expr = new WrappingNode(startToken).finishCallExpression(expr, args);
} else if (match('[')) {
isBindingElement = false;
isAssignmentTarget = true;
property = parseComputedMember();
expr = new WrappingNode(startToken).finishMemberExpression('[', expr, property);
} else if (lookahead.type === Token.Template && lookahead.head) {
quasi = parseTemplateLiteral();
expr = new WrappingNode(startToken).finishTaggedTemplateExpression(expr, quasi);
} else {
break;
}
}
state.allowIn = previousAllowIn;
return expr;
} | [
"function",
"parseLeftHandSideExpressionAllowCall",
"(",
")",
"{",
"var",
"quasi",
",",
"expr",
",",
"args",
",",
"property",
",",
"startToken",
",",
"previousAllowIn",
"=",
"state",
".",
"allowIn",
";",
"startToken",
"=",
"lookahead",
";",
"state",
".",
"allowIn",
"=",
"true",
";",
"if",
"(",
"matchKeyword",
"(",
"'super'",
")",
"&&",
"state",
".",
"inFunctionBody",
")",
"{",
"expr",
"=",
"new",
"Node",
"(",
")",
";",
"lex",
"(",
")",
";",
"expr",
"=",
"expr",
".",
"finishSuper",
"(",
")",
";",
"if",
"(",
"!",
"match",
"(",
"'('",
")",
"&&",
"!",
"match",
"(",
"'.'",
")",
"&&",
"!",
"match",
"(",
"'['",
")",
")",
"{",
"throwUnexpectedToken",
"(",
"lookahead",
")",
";",
"}",
"}",
"else",
"{",
"expr",
"=",
"inheritCoverGrammar",
"(",
"matchKeyword",
"(",
"'new'",
")",
"?",
"parseNewExpression",
":",
"parsePrimaryExpression",
")",
";",
"}",
"for",
"(",
";",
";",
")",
"{",
"if",
"(",
"match",
"(",
"'.'",
")",
")",
"{",
"isBindingElement",
"=",
"false",
";",
"isAssignmentTarget",
"=",
"true",
";",
"property",
"=",
"parseNonComputedMember",
"(",
")",
";",
"expr",
"=",
"new",
"WrappingNode",
"(",
"startToken",
")",
".",
"finishMemberExpression",
"(",
"'.'",
",",
"expr",
",",
"property",
")",
";",
"}",
"else",
"if",
"(",
"match",
"(",
"'('",
")",
")",
"{",
"isBindingElement",
"=",
"false",
";",
"isAssignmentTarget",
"=",
"false",
";",
"args",
"=",
"parseArguments",
"(",
")",
";",
"expr",
"=",
"new",
"WrappingNode",
"(",
"startToken",
")",
".",
"finishCallExpression",
"(",
"expr",
",",
"args",
")",
";",
"}",
"else",
"if",
"(",
"match",
"(",
"'['",
")",
")",
"{",
"isBindingElement",
"=",
"false",
";",
"isAssignmentTarget",
"=",
"true",
";",
"property",
"=",
"parseComputedMember",
"(",
")",
";",
"expr",
"=",
"new",
"WrappingNode",
"(",
"startToken",
")",
".",
"finishMemberExpression",
"(",
"'['",
",",
"expr",
",",
"property",
")",
";",
"}",
"else",
"if",
"(",
"lookahead",
".",
"type",
"===",
"Token",
".",
"Template",
"&&",
"lookahead",
".",
"head",
")",
"{",
"quasi",
"=",
"parseTemplateLiteral",
"(",
")",
";",
"expr",
"=",
"new",
"WrappingNode",
"(",
"startToken",
")",
".",
"finishTaggedTemplateExpression",
"(",
"expr",
",",
"quasi",
")",
";",
"}",
"else",
"{",
"break",
";",
"}",
"}",
"state",
".",
"allowIn",
"=",
"previousAllowIn",
";",
"return",
"expr",
";",
"}"
] | ECMA-262 12.3.4 Function Calls | [
"ECMA",
"-",
"262",
"12",
".",
"3",
".",
"4",
"Function",
"Calls"
] | 8a4a1059f060a7100270e837d2759c6a2b9c7e74 | https://github.com/reptilbud/hapi-swagger/blob/8a4a1059f060a7100270e837d2759c6a2b9c7e74/public/swaggerui/swagger-ui.js#L14548-L14591 |
51,319 | reptilbud/hapi-swagger | public/swaggerui/swagger-ui.js | parsePostfixExpression | function parsePostfixExpression() {
var expr, token, startToken = lookahead;
expr = inheritCoverGrammar(parseLeftHandSideExpressionAllowCall);
if (!hasLineTerminator && lookahead.type === Token.Punctuator) {
if (match('++') || match('--')) {
// ECMA-262 11.3.1, 11.3.2
if (strict && expr.type === Syntax.Identifier && isRestrictedWord(expr.name)) {
tolerateError(Messages.StrictLHSPostfix);
}
if (!isAssignmentTarget) {
tolerateError(Messages.InvalidLHSInAssignment);
}
isAssignmentTarget = isBindingElement = false;
token = lex();
expr = new WrappingNode(startToken).finishPostfixExpression(token.value, expr);
}
}
return expr;
} | javascript | function parsePostfixExpression() {
var expr, token, startToken = lookahead;
expr = inheritCoverGrammar(parseLeftHandSideExpressionAllowCall);
if (!hasLineTerminator && lookahead.type === Token.Punctuator) {
if (match('++') || match('--')) {
// ECMA-262 11.3.1, 11.3.2
if (strict && expr.type === Syntax.Identifier && isRestrictedWord(expr.name)) {
tolerateError(Messages.StrictLHSPostfix);
}
if (!isAssignmentTarget) {
tolerateError(Messages.InvalidLHSInAssignment);
}
isAssignmentTarget = isBindingElement = false;
token = lex();
expr = new WrappingNode(startToken).finishPostfixExpression(token.value, expr);
}
}
return expr;
} | [
"function",
"parsePostfixExpression",
"(",
")",
"{",
"var",
"expr",
",",
"token",
",",
"startToken",
"=",
"lookahead",
";",
"expr",
"=",
"inheritCoverGrammar",
"(",
"parseLeftHandSideExpressionAllowCall",
")",
";",
"if",
"(",
"!",
"hasLineTerminator",
"&&",
"lookahead",
".",
"type",
"===",
"Token",
".",
"Punctuator",
")",
"{",
"if",
"(",
"match",
"(",
"'++'",
")",
"||",
"match",
"(",
"'--'",
")",
")",
"{",
"// ECMA-262 11.3.1, 11.3.2",
"if",
"(",
"strict",
"&&",
"expr",
".",
"type",
"===",
"Syntax",
".",
"Identifier",
"&&",
"isRestrictedWord",
"(",
"expr",
".",
"name",
")",
")",
"{",
"tolerateError",
"(",
"Messages",
".",
"StrictLHSPostfix",
")",
";",
"}",
"if",
"(",
"!",
"isAssignmentTarget",
")",
"{",
"tolerateError",
"(",
"Messages",
".",
"InvalidLHSInAssignment",
")",
";",
"}",
"isAssignmentTarget",
"=",
"isBindingElement",
"=",
"false",
";",
"token",
"=",
"lex",
"(",
")",
";",
"expr",
"=",
"new",
"WrappingNode",
"(",
"startToken",
")",
".",
"finishPostfixExpression",
"(",
"token",
".",
"value",
",",
"expr",
")",
";",
"}",
"}",
"return",
"expr",
";",
"}"
] | ECMA-262 12.4 Postfix Expressions | [
"ECMA",
"-",
"262",
"12",
".",
"4",
"Postfix",
"Expressions"
] | 8a4a1059f060a7100270e837d2759c6a2b9c7e74 | https://github.com/reptilbud/hapi-swagger/blob/8a4a1059f060a7100270e837d2759c6a2b9c7e74/public/swaggerui/swagger-ui.js#L14635-L14659 |
51,320 | reptilbud/hapi-swagger | public/swaggerui/swagger-ui.js | parseUnaryExpression | function parseUnaryExpression() {
var token, expr, startToken;
if (lookahead.type !== Token.Punctuator && lookahead.type !== Token.Keyword) {
expr = parsePostfixExpression();
} else if (match('++') || match('--')) {
startToken = lookahead;
token = lex();
expr = inheritCoverGrammar(parseUnaryExpression);
// ECMA-262 11.4.4, 11.4.5
if (strict && expr.type === Syntax.Identifier && isRestrictedWord(expr.name)) {
tolerateError(Messages.StrictLHSPrefix);
}
if (!isAssignmentTarget) {
tolerateError(Messages.InvalidLHSInAssignment);
}
expr = new WrappingNode(startToken).finishUnaryExpression(token.value, expr);
isAssignmentTarget = isBindingElement = false;
} else if (match('+') || match('-') || match('~') || match('!')) {
startToken = lookahead;
token = lex();
expr = inheritCoverGrammar(parseUnaryExpression);
expr = new WrappingNode(startToken).finishUnaryExpression(token.value, expr);
isAssignmentTarget = isBindingElement = false;
} else if (matchKeyword('delete') || matchKeyword('void') || matchKeyword('typeof')) {
startToken = lookahead;
token = lex();
expr = inheritCoverGrammar(parseUnaryExpression);
expr = new WrappingNode(startToken).finishUnaryExpression(token.value, expr);
if (strict && expr.operator === 'delete' && expr.argument.type === Syntax.Identifier) {
tolerateError(Messages.StrictDelete);
}
isAssignmentTarget = isBindingElement = false;
} else {
expr = parsePostfixExpression();
}
return expr;
} | javascript | function parseUnaryExpression() {
var token, expr, startToken;
if (lookahead.type !== Token.Punctuator && lookahead.type !== Token.Keyword) {
expr = parsePostfixExpression();
} else if (match('++') || match('--')) {
startToken = lookahead;
token = lex();
expr = inheritCoverGrammar(parseUnaryExpression);
// ECMA-262 11.4.4, 11.4.5
if (strict && expr.type === Syntax.Identifier && isRestrictedWord(expr.name)) {
tolerateError(Messages.StrictLHSPrefix);
}
if (!isAssignmentTarget) {
tolerateError(Messages.InvalidLHSInAssignment);
}
expr = new WrappingNode(startToken).finishUnaryExpression(token.value, expr);
isAssignmentTarget = isBindingElement = false;
} else if (match('+') || match('-') || match('~') || match('!')) {
startToken = lookahead;
token = lex();
expr = inheritCoverGrammar(parseUnaryExpression);
expr = new WrappingNode(startToken).finishUnaryExpression(token.value, expr);
isAssignmentTarget = isBindingElement = false;
} else if (matchKeyword('delete') || matchKeyword('void') || matchKeyword('typeof')) {
startToken = lookahead;
token = lex();
expr = inheritCoverGrammar(parseUnaryExpression);
expr = new WrappingNode(startToken).finishUnaryExpression(token.value, expr);
if (strict && expr.operator === 'delete' && expr.argument.type === Syntax.Identifier) {
tolerateError(Messages.StrictDelete);
}
isAssignmentTarget = isBindingElement = false;
} else {
expr = parsePostfixExpression();
}
return expr;
} | [
"function",
"parseUnaryExpression",
"(",
")",
"{",
"var",
"token",
",",
"expr",
",",
"startToken",
";",
"if",
"(",
"lookahead",
".",
"type",
"!==",
"Token",
".",
"Punctuator",
"&&",
"lookahead",
".",
"type",
"!==",
"Token",
".",
"Keyword",
")",
"{",
"expr",
"=",
"parsePostfixExpression",
"(",
")",
";",
"}",
"else",
"if",
"(",
"match",
"(",
"'++'",
")",
"||",
"match",
"(",
"'--'",
")",
")",
"{",
"startToken",
"=",
"lookahead",
";",
"token",
"=",
"lex",
"(",
")",
";",
"expr",
"=",
"inheritCoverGrammar",
"(",
"parseUnaryExpression",
")",
";",
"// ECMA-262 11.4.4, 11.4.5",
"if",
"(",
"strict",
"&&",
"expr",
".",
"type",
"===",
"Syntax",
".",
"Identifier",
"&&",
"isRestrictedWord",
"(",
"expr",
".",
"name",
")",
")",
"{",
"tolerateError",
"(",
"Messages",
".",
"StrictLHSPrefix",
")",
";",
"}",
"if",
"(",
"!",
"isAssignmentTarget",
")",
"{",
"tolerateError",
"(",
"Messages",
".",
"InvalidLHSInAssignment",
")",
";",
"}",
"expr",
"=",
"new",
"WrappingNode",
"(",
"startToken",
")",
".",
"finishUnaryExpression",
"(",
"token",
".",
"value",
",",
"expr",
")",
";",
"isAssignmentTarget",
"=",
"isBindingElement",
"=",
"false",
";",
"}",
"else",
"if",
"(",
"match",
"(",
"'+'",
")",
"||",
"match",
"(",
"'-'",
")",
"||",
"match",
"(",
"'~'",
")",
"||",
"match",
"(",
"'!'",
")",
")",
"{",
"startToken",
"=",
"lookahead",
";",
"token",
"=",
"lex",
"(",
")",
";",
"expr",
"=",
"inheritCoverGrammar",
"(",
"parseUnaryExpression",
")",
";",
"expr",
"=",
"new",
"WrappingNode",
"(",
"startToken",
")",
".",
"finishUnaryExpression",
"(",
"token",
".",
"value",
",",
"expr",
")",
";",
"isAssignmentTarget",
"=",
"isBindingElement",
"=",
"false",
";",
"}",
"else",
"if",
"(",
"matchKeyword",
"(",
"'delete'",
")",
"||",
"matchKeyword",
"(",
"'void'",
")",
"||",
"matchKeyword",
"(",
"'typeof'",
")",
")",
"{",
"startToken",
"=",
"lookahead",
";",
"token",
"=",
"lex",
"(",
")",
";",
"expr",
"=",
"inheritCoverGrammar",
"(",
"parseUnaryExpression",
")",
";",
"expr",
"=",
"new",
"WrappingNode",
"(",
"startToken",
")",
".",
"finishUnaryExpression",
"(",
"token",
".",
"value",
",",
"expr",
")",
";",
"if",
"(",
"strict",
"&&",
"expr",
".",
"operator",
"===",
"'delete'",
"&&",
"expr",
".",
"argument",
".",
"type",
"===",
"Syntax",
".",
"Identifier",
")",
"{",
"tolerateError",
"(",
"Messages",
".",
"StrictDelete",
")",
";",
"}",
"isAssignmentTarget",
"=",
"isBindingElement",
"=",
"false",
";",
"}",
"else",
"{",
"expr",
"=",
"parsePostfixExpression",
"(",
")",
";",
"}",
"return",
"expr",
";",
"}"
] | ECMA-262 12.5 Unary Operators | [
"ECMA",
"-",
"262",
"12",
".",
"5",
"Unary",
"Operators"
] | 8a4a1059f060a7100270e837d2759c6a2b9c7e74 | https://github.com/reptilbud/hapi-swagger/blob/8a4a1059f060a7100270e837d2759c6a2b9c7e74/public/swaggerui/swagger-ui.js#L14663-L14702 |
51,321 | reptilbud/hapi-swagger | public/swaggerui/swagger-ui.js | parseConditionalExpression | function parseConditionalExpression() {
var expr, previousAllowIn, consequent, alternate, startToken;
startToken = lookahead;
expr = inheritCoverGrammar(parseBinaryExpression);
if (match('?')) {
lex();
previousAllowIn = state.allowIn;
state.allowIn = true;
consequent = isolateCoverGrammar(parseAssignmentExpression);
state.allowIn = previousAllowIn;
expect(':');
alternate = isolateCoverGrammar(parseAssignmentExpression);
expr = new WrappingNode(startToken).finishConditionalExpression(expr, consequent, alternate);
isAssignmentTarget = isBindingElement = false;
}
return expr;
} | javascript | function parseConditionalExpression() {
var expr, previousAllowIn, consequent, alternate, startToken;
startToken = lookahead;
expr = inheritCoverGrammar(parseBinaryExpression);
if (match('?')) {
lex();
previousAllowIn = state.allowIn;
state.allowIn = true;
consequent = isolateCoverGrammar(parseAssignmentExpression);
state.allowIn = previousAllowIn;
expect(':');
alternate = isolateCoverGrammar(parseAssignmentExpression);
expr = new WrappingNode(startToken).finishConditionalExpression(expr, consequent, alternate);
isAssignmentTarget = isBindingElement = false;
}
return expr;
} | [
"function",
"parseConditionalExpression",
"(",
")",
"{",
"var",
"expr",
",",
"previousAllowIn",
",",
"consequent",
",",
"alternate",
",",
"startToken",
";",
"startToken",
"=",
"lookahead",
";",
"expr",
"=",
"inheritCoverGrammar",
"(",
"parseBinaryExpression",
")",
";",
"if",
"(",
"match",
"(",
"'?'",
")",
")",
"{",
"lex",
"(",
")",
";",
"previousAllowIn",
"=",
"state",
".",
"allowIn",
";",
"state",
".",
"allowIn",
"=",
"true",
";",
"consequent",
"=",
"isolateCoverGrammar",
"(",
"parseAssignmentExpression",
")",
";",
"state",
".",
"allowIn",
"=",
"previousAllowIn",
";",
"expect",
"(",
"':'",
")",
";",
"alternate",
"=",
"isolateCoverGrammar",
"(",
"parseAssignmentExpression",
")",
";",
"expr",
"=",
"new",
"WrappingNode",
"(",
"startToken",
")",
".",
"finishConditionalExpression",
"(",
"expr",
",",
"consequent",
",",
"alternate",
")",
";",
"isAssignmentTarget",
"=",
"isBindingElement",
"=",
"false",
";",
"}",
"return",
"expr",
";",
"}"
] | ECMA-262 12.13 Conditional Operator | [
"ECMA",
"-",
"262",
"12",
".",
"13",
"Conditional",
"Operator"
] | 8a4a1059f060a7100270e837d2759c6a2b9c7e74 | https://github.com/reptilbud/hapi-swagger/blob/8a4a1059f060a7100270e837d2759c6a2b9c7e74/public/swaggerui/swagger-ui.js#L14839-L14859 |
51,322 | reptilbud/hapi-swagger | public/swaggerui/swagger-ui.js | parseYieldExpression | function parseYieldExpression() {
var argument, expr, delegate, previousAllowYield;
argument = null;
expr = new Node();
delegate = false;
expectKeyword('yield');
if (!hasLineTerminator) {
previousAllowYield = state.allowYield;
state.allowYield = false;
delegate = match('*');
if (delegate) {
lex();
argument = parseAssignmentExpression();
} else {
if (!match(';') && !match('}') && !match(')') && lookahead.type !== Token.EOF) {
argument = parseAssignmentExpression();
}
}
state.allowYield = previousAllowYield;
}
return expr.finishYieldExpression(argument, delegate);
} | javascript | function parseYieldExpression() {
var argument, expr, delegate, previousAllowYield;
argument = null;
expr = new Node();
delegate = false;
expectKeyword('yield');
if (!hasLineTerminator) {
previousAllowYield = state.allowYield;
state.allowYield = false;
delegate = match('*');
if (delegate) {
lex();
argument = parseAssignmentExpression();
} else {
if (!match(';') && !match('}') && !match(')') && lookahead.type !== Token.EOF) {
argument = parseAssignmentExpression();
}
}
state.allowYield = previousAllowYield;
}
return expr.finishYieldExpression(argument, delegate);
} | [
"function",
"parseYieldExpression",
"(",
")",
"{",
"var",
"argument",
",",
"expr",
",",
"delegate",
",",
"previousAllowYield",
";",
"argument",
"=",
"null",
";",
"expr",
"=",
"new",
"Node",
"(",
")",
";",
"delegate",
"=",
"false",
";",
"expectKeyword",
"(",
"'yield'",
")",
";",
"if",
"(",
"!",
"hasLineTerminator",
")",
"{",
"previousAllowYield",
"=",
"state",
".",
"allowYield",
";",
"state",
".",
"allowYield",
"=",
"false",
";",
"delegate",
"=",
"match",
"(",
"'*'",
")",
";",
"if",
"(",
"delegate",
")",
"{",
"lex",
"(",
")",
";",
"argument",
"=",
"parseAssignmentExpression",
"(",
")",
";",
"}",
"else",
"{",
"if",
"(",
"!",
"match",
"(",
"';'",
")",
"&&",
"!",
"match",
"(",
"'}'",
")",
"&&",
"!",
"match",
"(",
"')'",
")",
"&&",
"lookahead",
".",
"type",
"!==",
"Token",
".",
"EOF",
")",
"{",
"argument",
"=",
"parseAssignmentExpression",
"(",
")",
";",
"}",
"}",
"state",
".",
"allowYield",
"=",
"previousAllowYield",
";",
"}",
"return",
"expr",
".",
"finishYieldExpression",
"(",
"argument",
",",
"delegate",
")",
";",
"}"
] | ECMA-262 14.4 Yield expression | [
"ECMA",
"-",
"262",
"14",
".",
"4",
"Yield",
"expression"
] | 8a4a1059f060a7100270e837d2759c6a2b9c7e74 | https://github.com/reptilbud/hapi-swagger/blob/8a4a1059f060a7100270e837d2759c6a2b9c7e74/public/swaggerui/swagger-ui.js#L15002-L15027 |
51,323 | reptilbud/hapi-swagger | public/swaggerui/swagger-ui.js | parseAssignmentExpression | function parseAssignmentExpression() {
var token, expr, right, list, startToken;
startToken = lookahead;
token = lookahead;
if (!state.allowYield && matchKeyword('yield')) {
return parseYieldExpression();
}
expr = parseConditionalExpression();
if (expr.type === PlaceHolders.ArrowParameterPlaceHolder || match('=>')) {
isAssignmentTarget = isBindingElement = false;
list = reinterpretAsCoverFormalsList(expr);
if (list) {
firstCoverInitializedNameError = null;
return parseArrowFunctionExpression(list, new WrappingNode(startToken));
}
return expr;
}
if (matchAssign()) {
if (!isAssignmentTarget) {
tolerateError(Messages.InvalidLHSInAssignment);
}
// ECMA-262 12.1.1
if (strict && expr.type === Syntax.Identifier) {
if (isRestrictedWord(expr.name)) {
tolerateUnexpectedToken(token, Messages.StrictLHSAssignment);
}
if (isStrictModeReservedWord(expr.name)) {
tolerateUnexpectedToken(token, Messages.StrictReservedWord);
}
}
if (!match('=')) {
isAssignmentTarget = isBindingElement = false;
} else {
reinterpretExpressionAsPattern(expr);
}
token = lex();
right = isolateCoverGrammar(parseAssignmentExpression);
expr = new WrappingNode(startToken).finishAssignmentExpression(token.value, expr, right);
firstCoverInitializedNameError = null;
}
return expr;
} | javascript | function parseAssignmentExpression() {
var token, expr, right, list, startToken;
startToken = lookahead;
token = lookahead;
if (!state.allowYield && matchKeyword('yield')) {
return parseYieldExpression();
}
expr = parseConditionalExpression();
if (expr.type === PlaceHolders.ArrowParameterPlaceHolder || match('=>')) {
isAssignmentTarget = isBindingElement = false;
list = reinterpretAsCoverFormalsList(expr);
if (list) {
firstCoverInitializedNameError = null;
return parseArrowFunctionExpression(list, new WrappingNode(startToken));
}
return expr;
}
if (matchAssign()) {
if (!isAssignmentTarget) {
tolerateError(Messages.InvalidLHSInAssignment);
}
// ECMA-262 12.1.1
if (strict && expr.type === Syntax.Identifier) {
if (isRestrictedWord(expr.name)) {
tolerateUnexpectedToken(token, Messages.StrictLHSAssignment);
}
if (isStrictModeReservedWord(expr.name)) {
tolerateUnexpectedToken(token, Messages.StrictReservedWord);
}
}
if (!match('=')) {
isAssignmentTarget = isBindingElement = false;
} else {
reinterpretExpressionAsPattern(expr);
}
token = lex();
right = isolateCoverGrammar(parseAssignmentExpression);
expr = new WrappingNode(startToken).finishAssignmentExpression(token.value, expr, right);
firstCoverInitializedNameError = null;
}
return expr;
} | [
"function",
"parseAssignmentExpression",
"(",
")",
"{",
"var",
"token",
",",
"expr",
",",
"right",
",",
"list",
",",
"startToken",
";",
"startToken",
"=",
"lookahead",
";",
"token",
"=",
"lookahead",
";",
"if",
"(",
"!",
"state",
".",
"allowYield",
"&&",
"matchKeyword",
"(",
"'yield'",
")",
")",
"{",
"return",
"parseYieldExpression",
"(",
")",
";",
"}",
"expr",
"=",
"parseConditionalExpression",
"(",
")",
";",
"if",
"(",
"expr",
".",
"type",
"===",
"PlaceHolders",
".",
"ArrowParameterPlaceHolder",
"||",
"match",
"(",
"'=>'",
")",
")",
"{",
"isAssignmentTarget",
"=",
"isBindingElement",
"=",
"false",
";",
"list",
"=",
"reinterpretAsCoverFormalsList",
"(",
"expr",
")",
";",
"if",
"(",
"list",
")",
"{",
"firstCoverInitializedNameError",
"=",
"null",
";",
"return",
"parseArrowFunctionExpression",
"(",
"list",
",",
"new",
"WrappingNode",
"(",
"startToken",
")",
")",
";",
"}",
"return",
"expr",
";",
"}",
"if",
"(",
"matchAssign",
"(",
")",
")",
"{",
"if",
"(",
"!",
"isAssignmentTarget",
")",
"{",
"tolerateError",
"(",
"Messages",
".",
"InvalidLHSInAssignment",
")",
";",
"}",
"// ECMA-262 12.1.1",
"if",
"(",
"strict",
"&&",
"expr",
".",
"type",
"===",
"Syntax",
".",
"Identifier",
")",
"{",
"if",
"(",
"isRestrictedWord",
"(",
"expr",
".",
"name",
")",
")",
"{",
"tolerateUnexpectedToken",
"(",
"token",
",",
"Messages",
".",
"StrictLHSAssignment",
")",
";",
"}",
"if",
"(",
"isStrictModeReservedWord",
"(",
"expr",
".",
"name",
")",
")",
"{",
"tolerateUnexpectedToken",
"(",
"token",
",",
"Messages",
".",
"StrictReservedWord",
")",
";",
"}",
"}",
"if",
"(",
"!",
"match",
"(",
"'='",
")",
")",
"{",
"isAssignmentTarget",
"=",
"isBindingElement",
"=",
"false",
";",
"}",
"else",
"{",
"reinterpretExpressionAsPattern",
"(",
"expr",
")",
";",
"}",
"token",
"=",
"lex",
"(",
")",
";",
"right",
"=",
"isolateCoverGrammar",
"(",
"parseAssignmentExpression",
")",
";",
"expr",
"=",
"new",
"WrappingNode",
"(",
"startToken",
")",
".",
"finishAssignmentExpression",
"(",
"token",
".",
"value",
",",
"expr",
",",
"right",
")",
";",
"firstCoverInitializedNameError",
"=",
"null",
";",
"}",
"return",
"expr",
";",
"}"
] | ECMA-262 12.14 Assignment Operators | [
"ECMA",
"-",
"262",
"12",
".",
"14",
"Assignment",
"Operators"
] | 8a4a1059f060a7100270e837d2759c6a2b9c7e74 | https://github.com/reptilbud/hapi-swagger/blob/8a4a1059f060a7100270e837d2759c6a2b9c7e74/public/swaggerui/swagger-ui.js#L15031-L15083 |
51,324 | reptilbud/hapi-swagger | public/swaggerui/swagger-ui.js | parseExpression | function parseExpression() {
var expr, startToken = lookahead, expressions;
expr = isolateCoverGrammar(parseAssignmentExpression);
if (match(',')) {
expressions = [expr];
while (startIndex < length) {
if (!match(',')) {
break;
}
lex();
expressions.push(isolateCoverGrammar(parseAssignmentExpression));
}
expr = new WrappingNode(startToken).finishSequenceExpression(expressions);
}
return expr;
} | javascript | function parseExpression() {
var expr, startToken = lookahead, expressions;
expr = isolateCoverGrammar(parseAssignmentExpression);
if (match(',')) {
expressions = [expr];
while (startIndex < length) {
if (!match(',')) {
break;
}
lex();
expressions.push(isolateCoverGrammar(parseAssignmentExpression));
}
expr = new WrappingNode(startToken).finishSequenceExpression(expressions);
}
return expr;
} | [
"function",
"parseExpression",
"(",
")",
"{",
"var",
"expr",
",",
"startToken",
"=",
"lookahead",
",",
"expressions",
";",
"expr",
"=",
"isolateCoverGrammar",
"(",
"parseAssignmentExpression",
")",
";",
"if",
"(",
"match",
"(",
"','",
")",
")",
"{",
"expressions",
"=",
"[",
"expr",
"]",
";",
"while",
"(",
"startIndex",
"<",
"length",
")",
"{",
"if",
"(",
"!",
"match",
"(",
"','",
")",
")",
"{",
"break",
";",
"}",
"lex",
"(",
")",
";",
"expressions",
".",
"push",
"(",
"isolateCoverGrammar",
"(",
"parseAssignmentExpression",
")",
")",
";",
"}",
"expr",
"=",
"new",
"WrappingNode",
"(",
"startToken",
")",
".",
"finishSequenceExpression",
"(",
"expressions",
")",
";",
"}",
"return",
"expr",
";",
"}"
] | ECMA-262 12.15 Comma Operator | [
"ECMA",
"-",
"262",
"12",
".",
"15",
"Comma",
"Operator"
] | 8a4a1059f060a7100270e837d2759c6a2b9c7e74 | https://github.com/reptilbud/hapi-swagger/blob/8a4a1059f060a7100270e837d2759c6a2b9c7e74/public/swaggerui/swagger-ui.js#L15087-L15107 |
51,325 | reptilbud/hapi-swagger | public/swaggerui/swagger-ui.js | parseStatementListItem | function parseStatementListItem() {
if (lookahead.type === Token.Keyword) {
switch (lookahead.value) {
case 'export':
if (state.sourceType !== 'module') {
tolerateUnexpectedToken(lookahead, Messages.IllegalExportDeclaration);
}
return parseExportDeclaration();
case 'import':
if (state.sourceType !== 'module') {
tolerateUnexpectedToken(lookahead, Messages.IllegalImportDeclaration);
}
return parseImportDeclaration();
case 'const':
return parseLexicalDeclaration({inFor: false});
case 'function':
return parseFunctionDeclaration(new Node());
case 'class':
return parseClassDeclaration();
}
}
if (matchKeyword('let') && isLexicalDeclaration()) {
return parseLexicalDeclaration({inFor: false});
}
return parseStatement();
} | javascript | function parseStatementListItem() {
if (lookahead.type === Token.Keyword) {
switch (lookahead.value) {
case 'export':
if (state.sourceType !== 'module') {
tolerateUnexpectedToken(lookahead, Messages.IllegalExportDeclaration);
}
return parseExportDeclaration();
case 'import':
if (state.sourceType !== 'module') {
tolerateUnexpectedToken(lookahead, Messages.IllegalImportDeclaration);
}
return parseImportDeclaration();
case 'const':
return parseLexicalDeclaration({inFor: false});
case 'function':
return parseFunctionDeclaration(new Node());
case 'class':
return parseClassDeclaration();
}
}
if (matchKeyword('let') && isLexicalDeclaration()) {
return parseLexicalDeclaration({inFor: false});
}
return parseStatement();
} | [
"function",
"parseStatementListItem",
"(",
")",
"{",
"if",
"(",
"lookahead",
".",
"type",
"===",
"Token",
".",
"Keyword",
")",
"{",
"switch",
"(",
"lookahead",
".",
"value",
")",
"{",
"case",
"'export'",
":",
"if",
"(",
"state",
".",
"sourceType",
"!==",
"'module'",
")",
"{",
"tolerateUnexpectedToken",
"(",
"lookahead",
",",
"Messages",
".",
"IllegalExportDeclaration",
")",
";",
"}",
"return",
"parseExportDeclaration",
"(",
")",
";",
"case",
"'import'",
":",
"if",
"(",
"state",
".",
"sourceType",
"!==",
"'module'",
")",
"{",
"tolerateUnexpectedToken",
"(",
"lookahead",
",",
"Messages",
".",
"IllegalImportDeclaration",
")",
";",
"}",
"return",
"parseImportDeclaration",
"(",
")",
";",
"case",
"'const'",
":",
"return",
"parseLexicalDeclaration",
"(",
"{",
"inFor",
":",
"false",
"}",
")",
";",
"case",
"'function'",
":",
"return",
"parseFunctionDeclaration",
"(",
"new",
"Node",
"(",
")",
")",
";",
"case",
"'class'",
":",
"return",
"parseClassDeclaration",
"(",
")",
";",
"}",
"}",
"if",
"(",
"matchKeyword",
"(",
"'let'",
")",
"&&",
"isLexicalDeclaration",
"(",
")",
")",
"{",
"return",
"parseLexicalDeclaration",
"(",
"{",
"inFor",
":",
"false",
"}",
")",
";",
"}",
"return",
"parseStatement",
"(",
")",
";",
"}"
] | ECMA-262 13.2 Block | [
"ECMA",
"-",
"262",
"13",
".",
"2",
"Block"
] | 8a4a1059f060a7100270e837d2759c6a2b9c7e74 | https://github.com/reptilbud/hapi-swagger/blob/8a4a1059f060a7100270e837d2759c6a2b9c7e74/public/swaggerui/swagger-ui.js#L15111-L15138 |
51,326 | reptilbud/hapi-swagger | public/swaggerui/swagger-ui.js | parseLexicalBinding | function parseLexicalBinding(kind, options) {
var init = null, id, node = new Node(), params = [];
id = parsePattern(params, kind);
// ECMA-262 12.2.1
if (strict && id.type === Syntax.Identifier && isRestrictedWord(id.name)) {
tolerateError(Messages.StrictVarName);
}
if (kind === 'const') {
if (!matchKeyword('in') && !matchContextualKeyword('of')) {
expect('=');
init = isolateCoverGrammar(parseAssignmentExpression);
}
} else if ((!options.inFor && id.type !== Syntax.Identifier) || match('=')) {
expect('=');
init = isolateCoverGrammar(parseAssignmentExpression);
}
return node.finishVariableDeclarator(id, init);
} | javascript | function parseLexicalBinding(kind, options) {
var init = null, id, node = new Node(), params = [];
id = parsePattern(params, kind);
// ECMA-262 12.2.1
if (strict && id.type === Syntax.Identifier && isRestrictedWord(id.name)) {
tolerateError(Messages.StrictVarName);
}
if (kind === 'const') {
if (!matchKeyword('in') && !matchContextualKeyword('of')) {
expect('=');
init = isolateCoverGrammar(parseAssignmentExpression);
}
} else if ((!options.inFor && id.type !== Syntax.Identifier) || match('=')) {
expect('=');
init = isolateCoverGrammar(parseAssignmentExpression);
}
return node.finishVariableDeclarator(id, init);
} | [
"function",
"parseLexicalBinding",
"(",
"kind",
",",
"options",
")",
"{",
"var",
"init",
"=",
"null",
",",
"id",
",",
"node",
"=",
"new",
"Node",
"(",
")",
",",
"params",
"=",
"[",
"]",
";",
"id",
"=",
"parsePattern",
"(",
"params",
",",
"kind",
")",
";",
"// ECMA-262 12.2.1",
"if",
"(",
"strict",
"&&",
"id",
".",
"type",
"===",
"Syntax",
".",
"Identifier",
"&&",
"isRestrictedWord",
"(",
"id",
".",
"name",
")",
")",
"{",
"tolerateError",
"(",
"Messages",
".",
"StrictVarName",
")",
";",
"}",
"if",
"(",
"kind",
"===",
"'const'",
")",
"{",
"if",
"(",
"!",
"matchKeyword",
"(",
"'in'",
")",
"&&",
"!",
"matchContextualKeyword",
"(",
"'of'",
")",
")",
"{",
"expect",
"(",
"'='",
")",
";",
"init",
"=",
"isolateCoverGrammar",
"(",
"parseAssignmentExpression",
")",
";",
"}",
"}",
"else",
"if",
"(",
"(",
"!",
"options",
".",
"inFor",
"&&",
"id",
".",
"type",
"!==",
"Syntax",
".",
"Identifier",
")",
"||",
"match",
"(",
"'='",
")",
")",
"{",
"expect",
"(",
"'='",
")",
";",
"init",
"=",
"isolateCoverGrammar",
"(",
"parseAssignmentExpression",
")",
";",
"}",
"return",
"node",
".",
"finishVariableDeclarator",
"(",
"id",
",",
"init",
")",
";",
"}"
] | ECMA-262 13.3.1 Let and Const Declarations | [
"ECMA",
"-",
"262",
"13",
".",
"3",
".",
"1",
"Let",
"and",
"Const",
"Declarations"
] | 8a4a1059f060a7100270e837d2759c6a2b9c7e74 | https://github.com/reptilbud/hapi-swagger/blob/8a4a1059f060a7100270e837d2759c6a2b9c7e74/public/swaggerui/swagger-ui.js#L15240-L15261 |
51,327 | reptilbud/hapi-swagger | public/swaggerui/swagger-ui.js | parseIfStatement | function parseIfStatement(node) {
var test, consequent, alternate;
expectKeyword('if');
expect('(');
test = parseExpression();
expect(')');
consequent = parseStatement();
if (matchKeyword('else')) {
lex();
alternate = parseStatement();
} else {
alternate = null;
}
return node.finishIfStatement(test, consequent, alternate);
} | javascript | function parseIfStatement(node) {
var test, consequent, alternate;
expectKeyword('if');
expect('(');
test = parseExpression();
expect(')');
consequent = parseStatement();
if (matchKeyword('else')) {
lex();
alternate = parseStatement();
} else {
alternate = null;
}
return node.finishIfStatement(test, consequent, alternate);
} | [
"function",
"parseIfStatement",
"(",
"node",
")",
"{",
"var",
"test",
",",
"consequent",
",",
"alternate",
";",
"expectKeyword",
"(",
"'if'",
")",
";",
"expect",
"(",
"'('",
")",
";",
"test",
"=",
"parseExpression",
"(",
")",
";",
"expect",
"(",
"')'",
")",
";",
"consequent",
"=",
"parseStatement",
"(",
")",
";",
"if",
"(",
"matchKeyword",
"(",
"'else'",
")",
")",
"{",
"lex",
"(",
")",
";",
"alternate",
"=",
"parseStatement",
"(",
")",
";",
"}",
"else",
"{",
"alternate",
"=",
"null",
";",
"}",
"return",
"node",
".",
"finishIfStatement",
"(",
"test",
",",
"consequent",
",",
"alternate",
")",
";",
"}"
] | ECMA-262 13.6 If statement | [
"ECMA",
"-",
"262",
"13",
".",
"6",
"If",
"statement"
] | 8a4a1059f060a7100270e837d2759c6a2b9c7e74 | https://github.com/reptilbud/hapi-swagger/blob/8a4a1059f060a7100270e837d2759c6a2b9c7e74/public/swaggerui/swagger-ui.js#L15377-L15398 |
51,328 | reptilbud/hapi-swagger | public/swaggerui/swagger-ui.js | parseDoWhileStatement | function parseDoWhileStatement(node) {
var body, test, oldInIteration;
expectKeyword('do');
oldInIteration = state.inIteration;
state.inIteration = true;
body = parseStatement();
state.inIteration = oldInIteration;
expectKeyword('while');
expect('(');
test = parseExpression();
expect(')');
if (match(';')) {
lex();
}
return node.finishDoWhileStatement(body, test);
} | javascript | function parseDoWhileStatement(node) {
var body, test, oldInIteration;
expectKeyword('do');
oldInIteration = state.inIteration;
state.inIteration = true;
body = parseStatement();
state.inIteration = oldInIteration;
expectKeyword('while');
expect('(');
test = parseExpression();
expect(')');
if (match(';')) {
lex();
}
return node.finishDoWhileStatement(body, test);
} | [
"function",
"parseDoWhileStatement",
"(",
"node",
")",
"{",
"var",
"body",
",",
"test",
",",
"oldInIteration",
";",
"expectKeyword",
"(",
"'do'",
")",
";",
"oldInIteration",
"=",
"state",
".",
"inIteration",
";",
"state",
".",
"inIteration",
"=",
"true",
";",
"body",
"=",
"parseStatement",
"(",
")",
";",
"state",
".",
"inIteration",
"=",
"oldInIteration",
";",
"expectKeyword",
"(",
"'while'",
")",
";",
"expect",
"(",
"'('",
")",
";",
"test",
"=",
"parseExpression",
"(",
")",
";",
"expect",
"(",
"')'",
")",
";",
"if",
"(",
"match",
"(",
"';'",
")",
")",
"{",
"lex",
"(",
")",
";",
"}",
"return",
"node",
".",
"finishDoWhileStatement",
"(",
"body",
",",
"test",
")",
";",
"}"
] | ECMA-262 13.7 Iteration Statements | [
"ECMA",
"-",
"262",
"13",
".",
"7",
"Iteration",
"Statements"
] | 8a4a1059f060a7100270e837d2759c6a2b9c7e74 | https://github.com/reptilbud/hapi-swagger/blob/8a4a1059f060a7100270e837d2759c6a2b9c7e74/public/swaggerui/swagger-ui.js#L15402-L15427 |
51,329 | reptilbud/hapi-swagger | public/swaggerui/swagger-ui.js | parseContinueStatement | function parseContinueStatement(node) {
var label = null, key;
expectKeyword('continue');
// Optimize the most common form: 'continue;'.
if (source.charCodeAt(startIndex) === 0x3B) {
lex();
if (!state.inIteration) {
throwError(Messages.IllegalContinue);
}
return node.finishContinueStatement(null);
}
if (hasLineTerminator) {
if (!state.inIteration) {
throwError(Messages.IllegalContinue);
}
return node.finishContinueStatement(null);
}
if (lookahead.type === Token.Identifier) {
label = parseVariableIdentifier();
key = '$' + label.name;
if (!Object.prototype.hasOwnProperty.call(state.labelSet, key)) {
throwError(Messages.UnknownLabel, label.name);
}
}
consumeSemicolon();
if (label === null && !state.inIteration) {
throwError(Messages.IllegalContinue);
}
return node.finishContinueStatement(label);
} | javascript | function parseContinueStatement(node) {
var label = null, key;
expectKeyword('continue');
// Optimize the most common form: 'continue;'.
if (source.charCodeAt(startIndex) === 0x3B) {
lex();
if (!state.inIteration) {
throwError(Messages.IllegalContinue);
}
return node.finishContinueStatement(null);
}
if (hasLineTerminator) {
if (!state.inIteration) {
throwError(Messages.IllegalContinue);
}
return node.finishContinueStatement(null);
}
if (lookahead.type === Token.Identifier) {
label = parseVariableIdentifier();
key = '$' + label.name;
if (!Object.prototype.hasOwnProperty.call(state.labelSet, key)) {
throwError(Messages.UnknownLabel, label.name);
}
}
consumeSemicolon();
if (label === null && !state.inIteration) {
throwError(Messages.IllegalContinue);
}
return node.finishContinueStatement(label);
} | [
"function",
"parseContinueStatement",
"(",
"node",
")",
"{",
"var",
"label",
"=",
"null",
",",
"key",
";",
"expectKeyword",
"(",
"'continue'",
")",
";",
"// Optimize the most common form: 'continue;'.",
"if",
"(",
"source",
".",
"charCodeAt",
"(",
"startIndex",
")",
"===",
"0x3B",
")",
"{",
"lex",
"(",
")",
";",
"if",
"(",
"!",
"state",
".",
"inIteration",
")",
"{",
"throwError",
"(",
"Messages",
".",
"IllegalContinue",
")",
";",
"}",
"return",
"node",
".",
"finishContinueStatement",
"(",
"null",
")",
";",
"}",
"if",
"(",
"hasLineTerminator",
")",
"{",
"if",
"(",
"!",
"state",
".",
"inIteration",
")",
"{",
"throwError",
"(",
"Messages",
".",
"IllegalContinue",
")",
";",
"}",
"return",
"node",
".",
"finishContinueStatement",
"(",
"null",
")",
";",
"}",
"if",
"(",
"lookahead",
".",
"type",
"===",
"Token",
".",
"Identifier",
")",
"{",
"label",
"=",
"parseVariableIdentifier",
"(",
")",
";",
"key",
"=",
"'$'",
"+",
"label",
".",
"name",
";",
"if",
"(",
"!",
"Object",
".",
"prototype",
".",
"hasOwnProperty",
".",
"call",
"(",
"state",
".",
"labelSet",
",",
"key",
")",
")",
"{",
"throwError",
"(",
"Messages",
".",
"UnknownLabel",
",",
"label",
".",
"name",
")",
";",
"}",
"}",
"consumeSemicolon",
"(",
")",
";",
"if",
"(",
"label",
"===",
"null",
"&&",
"!",
"state",
".",
"inIteration",
")",
"{",
"throwError",
"(",
"Messages",
".",
"IllegalContinue",
")",
";",
"}",
"return",
"node",
".",
"finishContinueStatement",
"(",
"label",
")",
";",
"}"
] | ECMA-262 13.8 The continue statement | [
"ECMA",
"-",
"262",
"13",
".",
"8",
"The",
"continue",
"statement"
] | 8a4a1059f060a7100270e837d2759c6a2b9c7e74 | https://github.com/reptilbud/hapi-swagger/blob/8a4a1059f060a7100270e837d2759c6a2b9c7e74/public/swaggerui/swagger-ui.js#L15592-L15632 |
51,330 | reptilbud/hapi-swagger | public/swaggerui/swagger-ui.js | parseReturnStatement | function parseReturnStatement(node) {
var argument = null;
expectKeyword('return');
if (!state.inFunctionBody) {
tolerateError(Messages.IllegalReturn);
}
// 'return' followed by a space and an identifier is very common.
if (source.charCodeAt(lastIndex) === 0x20) {
if (isIdentifierStart(source.charCodeAt(lastIndex + 1))) {
argument = parseExpression();
consumeSemicolon();
return node.finishReturnStatement(argument);
}
}
if (hasLineTerminator) {
// HACK
return node.finishReturnStatement(null);
}
if (!match(';')) {
if (!match('}') && lookahead.type !== Token.EOF) {
argument = parseExpression();
}
}
consumeSemicolon();
return node.finishReturnStatement(argument);
} | javascript | function parseReturnStatement(node) {
var argument = null;
expectKeyword('return');
if (!state.inFunctionBody) {
tolerateError(Messages.IllegalReturn);
}
// 'return' followed by a space and an identifier is very common.
if (source.charCodeAt(lastIndex) === 0x20) {
if (isIdentifierStart(source.charCodeAt(lastIndex + 1))) {
argument = parseExpression();
consumeSemicolon();
return node.finishReturnStatement(argument);
}
}
if (hasLineTerminator) {
// HACK
return node.finishReturnStatement(null);
}
if (!match(';')) {
if (!match('}') && lookahead.type !== Token.EOF) {
argument = parseExpression();
}
}
consumeSemicolon();
return node.finishReturnStatement(argument);
} | [
"function",
"parseReturnStatement",
"(",
"node",
")",
"{",
"var",
"argument",
"=",
"null",
";",
"expectKeyword",
"(",
"'return'",
")",
";",
"if",
"(",
"!",
"state",
".",
"inFunctionBody",
")",
"{",
"tolerateError",
"(",
"Messages",
".",
"IllegalReturn",
")",
";",
"}",
"// 'return' followed by a space and an identifier is very common.",
"if",
"(",
"source",
".",
"charCodeAt",
"(",
"lastIndex",
")",
"===",
"0x20",
")",
"{",
"if",
"(",
"isIdentifierStart",
"(",
"source",
".",
"charCodeAt",
"(",
"lastIndex",
"+",
"1",
")",
")",
")",
"{",
"argument",
"=",
"parseExpression",
"(",
")",
";",
"consumeSemicolon",
"(",
")",
";",
"return",
"node",
".",
"finishReturnStatement",
"(",
"argument",
")",
";",
"}",
"}",
"if",
"(",
"hasLineTerminator",
")",
"{",
"// HACK",
"return",
"node",
".",
"finishReturnStatement",
"(",
"null",
")",
";",
"}",
"if",
"(",
"!",
"match",
"(",
"';'",
")",
")",
"{",
"if",
"(",
"!",
"match",
"(",
"'}'",
")",
"&&",
"lookahead",
".",
"type",
"!==",
"Token",
".",
"EOF",
")",
"{",
"argument",
"=",
"parseExpression",
"(",
")",
";",
"}",
"}",
"consumeSemicolon",
"(",
")",
";",
"return",
"node",
".",
"finishReturnStatement",
"(",
"argument",
")",
";",
"}"
] | ECMA-262 13.10 The return statement | [
"ECMA",
"-",
"262",
"13",
".",
"10",
"The",
"return",
"statement"
] | 8a4a1059f060a7100270e837d2759c6a2b9c7e74 | https://github.com/reptilbud/hapi-swagger/blob/8a4a1059f060a7100270e837d2759c6a2b9c7e74/public/swaggerui/swagger-ui.js#L15676-L15708 |
51,331 | reptilbud/hapi-swagger | public/swaggerui/swagger-ui.js | parseWithStatement | function parseWithStatement(node) {
var object, body;
if (strict) {
tolerateError(Messages.StrictModeWith);
}
expectKeyword('with');
expect('(');
object = parseExpression();
expect(')');
body = parseStatement();
return node.finishWithStatement(object, body);
} | javascript | function parseWithStatement(node) {
var object, body;
if (strict) {
tolerateError(Messages.StrictModeWith);
}
expectKeyword('with');
expect('(');
object = parseExpression();
expect(')');
body = parseStatement();
return node.finishWithStatement(object, body);
} | [
"function",
"parseWithStatement",
"(",
"node",
")",
"{",
"var",
"object",
",",
"body",
";",
"if",
"(",
"strict",
")",
"{",
"tolerateError",
"(",
"Messages",
".",
"StrictModeWith",
")",
";",
"}",
"expectKeyword",
"(",
"'with'",
")",
";",
"expect",
"(",
"'('",
")",
";",
"object",
"=",
"parseExpression",
"(",
")",
";",
"expect",
"(",
"')'",
")",
";",
"body",
"=",
"parseStatement",
"(",
")",
";",
"return",
"node",
".",
"finishWithStatement",
"(",
"object",
",",
"body",
")",
";",
"}"
] | ECMA-262 13.11 The with statement | [
"ECMA",
"-",
"262",
"13",
".",
"11",
"The",
"with",
"statement"
] | 8a4a1059f060a7100270e837d2759c6a2b9c7e74 | https://github.com/reptilbud/hapi-swagger/blob/8a4a1059f060a7100270e837d2759c6a2b9c7e74/public/swaggerui/swagger-ui.js#L15712-L15730 |
51,332 | reptilbud/hapi-swagger | public/swaggerui/swagger-ui.js | parseSwitchCase | function parseSwitchCase() {
var test, consequent = [], statement, node = new Node();
if (matchKeyword('default')) {
lex();
test = null;
} else {
expectKeyword('case');
test = parseExpression();
}
expect(':');
while (startIndex < length) {
if (match('}') || matchKeyword('default') || matchKeyword('case')) {
break;
}
statement = parseStatementListItem();
consequent.push(statement);
}
return node.finishSwitchCase(test, consequent);
} | javascript | function parseSwitchCase() {
var test, consequent = [], statement, node = new Node();
if (matchKeyword('default')) {
lex();
test = null;
} else {
expectKeyword('case');
test = parseExpression();
}
expect(':');
while (startIndex < length) {
if (match('}') || matchKeyword('default') || matchKeyword('case')) {
break;
}
statement = parseStatementListItem();
consequent.push(statement);
}
return node.finishSwitchCase(test, consequent);
} | [
"function",
"parseSwitchCase",
"(",
")",
"{",
"var",
"test",
",",
"consequent",
"=",
"[",
"]",
",",
"statement",
",",
"node",
"=",
"new",
"Node",
"(",
")",
";",
"if",
"(",
"matchKeyword",
"(",
"'default'",
")",
")",
"{",
"lex",
"(",
")",
";",
"test",
"=",
"null",
";",
"}",
"else",
"{",
"expectKeyword",
"(",
"'case'",
")",
";",
"test",
"=",
"parseExpression",
"(",
")",
";",
"}",
"expect",
"(",
"':'",
")",
";",
"while",
"(",
"startIndex",
"<",
"length",
")",
"{",
"if",
"(",
"match",
"(",
"'}'",
")",
"||",
"matchKeyword",
"(",
"'default'",
")",
"||",
"matchKeyword",
"(",
"'case'",
")",
")",
"{",
"break",
";",
"}",
"statement",
"=",
"parseStatementListItem",
"(",
")",
";",
"consequent",
".",
"push",
"(",
"statement",
")",
";",
"}",
"return",
"node",
".",
"finishSwitchCase",
"(",
"test",
",",
"consequent",
")",
";",
"}"
] | ECMA-262 13.12 The switch statement | [
"ECMA",
"-",
"262",
"13",
".",
"12",
"The",
"switch",
"statement"
] | 8a4a1059f060a7100270e837d2759c6a2b9c7e74 | https://github.com/reptilbud/hapi-swagger/blob/8a4a1059f060a7100270e837d2759c6a2b9c7e74/public/swaggerui/swagger-ui.js#L15734-L15755 |
51,333 | reptilbud/hapi-swagger | public/swaggerui/swagger-ui.js | parseThrowStatement | function parseThrowStatement(node) {
var argument;
expectKeyword('throw');
if (hasLineTerminator) {
throwError(Messages.NewlineAfterThrow);
}
argument = parseExpression();
consumeSemicolon();
return node.finishThrowStatement(argument);
} | javascript | function parseThrowStatement(node) {
var argument;
expectKeyword('throw');
if (hasLineTerminator) {
throwError(Messages.NewlineAfterThrow);
}
argument = parseExpression();
consumeSemicolon();
return node.finishThrowStatement(argument);
} | [
"function",
"parseThrowStatement",
"(",
"node",
")",
"{",
"var",
"argument",
";",
"expectKeyword",
"(",
"'throw'",
")",
";",
"if",
"(",
"hasLineTerminator",
")",
"{",
"throwError",
"(",
"Messages",
".",
"NewlineAfterThrow",
")",
";",
"}",
"argument",
"=",
"parseExpression",
"(",
")",
";",
"consumeSemicolon",
"(",
")",
";",
"return",
"node",
".",
"finishThrowStatement",
"(",
"argument",
")",
";",
"}"
] | ECMA-262 13.14 The throw statement | [
"ECMA",
"-",
"262",
"13",
".",
"14",
"The",
"throw",
"statement"
] | 8a4a1059f060a7100270e837d2759c6a2b9c7e74 | https://github.com/reptilbud/hapi-swagger/blob/8a4a1059f060a7100270e837d2759c6a2b9c7e74/public/swaggerui/swagger-ui.js#L15804-L15818 |
51,334 | reptilbud/hapi-swagger | public/swaggerui/swagger-ui.js | parseCatchClause | function parseCatchClause() {
var param, params = [], paramMap = {}, key, i, body, node = new Node();
expectKeyword('catch');
expect('(');
if (match(')')) {
throwUnexpectedToken(lookahead);
}
param = parsePattern(params);
for (i = 0; i < params.length; i++) {
key = '$' + params[i].value;
if (Object.prototype.hasOwnProperty.call(paramMap, key)) {
tolerateError(Messages.DuplicateBinding, params[i].value);
}
paramMap[key] = true;
}
// ECMA-262 12.14.1
if (strict && isRestrictedWord(param.name)) {
tolerateError(Messages.StrictCatchVariable);
}
expect(')');
body = parseBlock();
return node.finishCatchClause(param, body);
} | javascript | function parseCatchClause() {
var param, params = [], paramMap = {}, key, i, body, node = new Node();
expectKeyword('catch');
expect('(');
if (match(')')) {
throwUnexpectedToken(lookahead);
}
param = parsePattern(params);
for (i = 0; i < params.length; i++) {
key = '$' + params[i].value;
if (Object.prototype.hasOwnProperty.call(paramMap, key)) {
tolerateError(Messages.DuplicateBinding, params[i].value);
}
paramMap[key] = true;
}
// ECMA-262 12.14.1
if (strict && isRestrictedWord(param.name)) {
tolerateError(Messages.StrictCatchVariable);
}
expect(')');
body = parseBlock();
return node.finishCatchClause(param, body);
} | [
"function",
"parseCatchClause",
"(",
")",
"{",
"var",
"param",
",",
"params",
"=",
"[",
"]",
",",
"paramMap",
"=",
"{",
"}",
",",
"key",
",",
"i",
",",
"body",
",",
"node",
"=",
"new",
"Node",
"(",
")",
";",
"expectKeyword",
"(",
"'catch'",
")",
";",
"expect",
"(",
"'('",
")",
";",
"if",
"(",
"match",
"(",
"')'",
")",
")",
"{",
"throwUnexpectedToken",
"(",
"lookahead",
")",
";",
"}",
"param",
"=",
"parsePattern",
"(",
"params",
")",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"params",
".",
"length",
";",
"i",
"++",
")",
"{",
"key",
"=",
"'$'",
"+",
"params",
"[",
"i",
"]",
".",
"value",
";",
"if",
"(",
"Object",
".",
"prototype",
".",
"hasOwnProperty",
".",
"call",
"(",
"paramMap",
",",
"key",
")",
")",
"{",
"tolerateError",
"(",
"Messages",
".",
"DuplicateBinding",
",",
"params",
"[",
"i",
"]",
".",
"value",
")",
";",
"}",
"paramMap",
"[",
"key",
"]",
"=",
"true",
";",
"}",
"// ECMA-262 12.14.1",
"if",
"(",
"strict",
"&&",
"isRestrictedWord",
"(",
"param",
".",
"name",
")",
")",
"{",
"tolerateError",
"(",
"Messages",
".",
"StrictCatchVariable",
")",
";",
"}",
"expect",
"(",
"')'",
")",
";",
"body",
"=",
"parseBlock",
"(",
")",
";",
"return",
"node",
".",
"finishCatchClause",
"(",
"param",
",",
"body",
")",
";",
"}"
] | ECMA-262 13.15 The try statement | [
"ECMA",
"-",
"262",
"13",
".",
"15",
"The",
"try",
"statement"
] | 8a4a1059f060a7100270e837d2759c6a2b9c7e74 | https://github.com/reptilbud/hapi-swagger/blob/8a4a1059f060a7100270e837d2759c6a2b9c7e74/public/swaggerui/swagger-ui.js#L15822-L15849 |
51,335 | reptilbud/hapi-swagger | public/swaggerui/swagger-ui.js | parseFunctionSourceElements | function parseFunctionSourceElements() {
var statement, body = [], token, directive, firstRestricted,
oldLabelSet, oldInIteration, oldInSwitch, oldInFunctionBody, oldParenthesisCount,
node = new Node();
expect('{');
while (startIndex < length) {
if (lookahead.type !== Token.StringLiteral) {
break;
}
token = lookahead;
statement = parseStatementListItem();
body.push(statement);
if (statement.expression.type !== Syntax.Literal) {
// this is not directive
break;
}
directive = source.slice(token.start + 1, token.end - 1);
if (directive === 'use strict') {
strict = true;
if (firstRestricted) {
tolerateUnexpectedToken(firstRestricted, Messages.StrictOctalLiteral);
}
} else {
if (!firstRestricted && token.octal) {
firstRestricted = token;
}
}
}
oldLabelSet = state.labelSet;
oldInIteration = state.inIteration;
oldInSwitch = state.inSwitch;
oldInFunctionBody = state.inFunctionBody;
oldParenthesisCount = state.parenthesizedCount;
state.labelSet = {};
state.inIteration = false;
state.inSwitch = false;
state.inFunctionBody = true;
state.parenthesizedCount = 0;
while (startIndex < length) {
if (match('}')) {
break;
}
body.push(parseStatementListItem());
}
expect('}');
state.labelSet = oldLabelSet;
state.inIteration = oldInIteration;
state.inSwitch = oldInSwitch;
state.inFunctionBody = oldInFunctionBody;
state.parenthesizedCount = oldParenthesisCount;
return node.finishBlockStatement(body);
} | javascript | function parseFunctionSourceElements() {
var statement, body = [], token, directive, firstRestricted,
oldLabelSet, oldInIteration, oldInSwitch, oldInFunctionBody, oldParenthesisCount,
node = new Node();
expect('{');
while (startIndex < length) {
if (lookahead.type !== Token.StringLiteral) {
break;
}
token = lookahead;
statement = parseStatementListItem();
body.push(statement);
if (statement.expression.type !== Syntax.Literal) {
// this is not directive
break;
}
directive = source.slice(token.start + 1, token.end - 1);
if (directive === 'use strict') {
strict = true;
if (firstRestricted) {
tolerateUnexpectedToken(firstRestricted, Messages.StrictOctalLiteral);
}
} else {
if (!firstRestricted && token.octal) {
firstRestricted = token;
}
}
}
oldLabelSet = state.labelSet;
oldInIteration = state.inIteration;
oldInSwitch = state.inSwitch;
oldInFunctionBody = state.inFunctionBody;
oldParenthesisCount = state.parenthesizedCount;
state.labelSet = {};
state.inIteration = false;
state.inSwitch = false;
state.inFunctionBody = true;
state.parenthesizedCount = 0;
while (startIndex < length) {
if (match('}')) {
break;
}
body.push(parseStatementListItem());
}
expect('}');
state.labelSet = oldLabelSet;
state.inIteration = oldInIteration;
state.inSwitch = oldInSwitch;
state.inFunctionBody = oldInFunctionBody;
state.parenthesizedCount = oldParenthesisCount;
return node.finishBlockStatement(body);
} | [
"function",
"parseFunctionSourceElements",
"(",
")",
"{",
"var",
"statement",
",",
"body",
"=",
"[",
"]",
",",
"token",
",",
"directive",
",",
"firstRestricted",
",",
"oldLabelSet",
",",
"oldInIteration",
",",
"oldInSwitch",
",",
"oldInFunctionBody",
",",
"oldParenthesisCount",
",",
"node",
"=",
"new",
"Node",
"(",
")",
";",
"expect",
"(",
"'{'",
")",
";",
"while",
"(",
"startIndex",
"<",
"length",
")",
"{",
"if",
"(",
"lookahead",
".",
"type",
"!==",
"Token",
".",
"StringLiteral",
")",
"{",
"break",
";",
"}",
"token",
"=",
"lookahead",
";",
"statement",
"=",
"parseStatementListItem",
"(",
")",
";",
"body",
".",
"push",
"(",
"statement",
")",
";",
"if",
"(",
"statement",
".",
"expression",
".",
"type",
"!==",
"Syntax",
".",
"Literal",
")",
"{",
"// this is not directive",
"break",
";",
"}",
"directive",
"=",
"source",
".",
"slice",
"(",
"token",
".",
"start",
"+",
"1",
",",
"token",
".",
"end",
"-",
"1",
")",
";",
"if",
"(",
"directive",
"===",
"'use strict'",
")",
"{",
"strict",
"=",
"true",
";",
"if",
"(",
"firstRestricted",
")",
"{",
"tolerateUnexpectedToken",
"(",
"firstRestricted",
",",
"Messages",
".",
"StrictOctalLiteral",
")",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"!",
"firstRestricted",
"&&",
"token",
".",
"octal",
")",
"{",
"firstRestricted",
"=",
"token",
";",
"}",
"}",
"}",
"oldLabelSet",
"=",
"state",
".",
"labelSet",
";",
"oldInIteration",
"=",
"state",
".",
"inIteration",
";",
"oldInSwitch",
"=",
"state",
".",
"inSwitch",
";",
"oldInFunctionBody",
"=",
"state",
".",
"inFunctionBody",
";",
"oldParenthesisCount",
"=",
"state",
".",
"parenthesizedCount",
";",
"state",
".",
"labelSet",
"=",
"{",
"}",
";",
"state",
".",
"inIteration",
"=",
"false",
";",
"state",
".",
"inSwitch",
"=",
"false",
";",
"state",
".",
"inFunctionBody",
"=",
"true",
";",
"state",
".",
"parenthesizedCount",
"=",
"0",
";",
"while",
"(",
"startIndex",
"<",
"length",
")",
"{",
"if",
"(",
"match",
"(",
"'}'",
")",
")",
"{",
"break",
";",
"}",
"body",
".",
"push",
"(",
"parseStatementListItem",
"(",
")",
")",
";",
"}",
"expect",
"(",
"'}'",
")",
";",
"state",
".",
"labelSet",
"=",
"oldLabelSet",
";",
"state",
".",
"inIteration",
"=",
"oldInIteration",
";",
"state",
".",
"inSwitch",
"=",
"oldInSwitch",
";",
"state",
".",
"inFunctionBody",
"=",
"oldInFunctionBody",
";",
"state",
".",
"parenthesizedCount",
"=",
"oldParenthesisCount",
";",
"return",
"node",
".",
"finishBlockStatement",
"(",
"body",
")",
";",
"}"
] | ECMA-262 14.1 Function Definition | [
"ECMA",
"-",
"262",
"14",
".",
"1",
"Function",
"Definition"
] | 8a4a1059f060a7100270e837d2759c6a2b9c7e74 | https://github.com/reptilbud/hapi-swagger/blob/8a4a1059f060a7100270e837d2759c6a2b9c7e74/public/swaggerui/swagger-ui.js#L15971-L16031 |
51,336 | reptilbud/hapi-swagger | public/swaggerui/swagger-ui.js | parseModuleSpecifier | function parseModuleSpecifier() {
var node = new Node();
if (lookahead.type !== Token.StringLiteral) {
throwError(Messages.InvalidModuleSpecifier);
}
return node.finishLiteral(lex());
} | javascript | function parseModuleSpecifier() {
var node = new Node();
if (lookahead.type !== Token.StringLiteral) {
throwError(Messages.InvalidModuleSpecifier);
}
return node.finishLiteral(lex());
} | [
"function",
"parseModuleSpecifier",
"(",
")",
"{",
"var",
"node",
"=",
"new",
"Node",
"(",
")",
";",
"if",
"(",
"lookahead",
".",
"type",
"!==",
"Token",
".",
"StringLiteral",
")",
"{",
"throwError",
"(",
"Messages",
".",
"InvalidModuleSpecifier",
")",
";",
"}",
"return",
"node",
".",
"finishLiteral",
"(",
"lex",
"(",
")",
")",
";",
"}"
] | ECMA-262 15.2 Modules | [
"ECMA",
"-",
"262",
"15",
".",
"2",
"Modules"
] | 8a4a1059f060a7100270e837d2759c6a2b9c7e74 | https://github.com/reptilbud/hapi-swagger/blob/8a4a1059f060a7100270e837d2759c6a2b9c7e74/public/swaggerui/swagger-ui.js#L16348-L16355 |
51,337 | reptilbud/hapi-swagger | public/swaggerui/swagger-ui.js | parseScriptBody | function parseScriptBody() {
var statement, body = [], token, directive, firstRestricted;
while (startIndex < length) {
token = lookahead;
if (token.type !== Token.StringLiteral) {
break;
}
statement = parseStatementListItem();
body.push(statement);
if (statement.expression.type !== Syntax.Literal) {
// this is not directive
break;
}
directive = source.slice(token.start + 1, token.end - 1);
if (directive === 'use strict') {
strict = true;
if (firstRestricted) {
tolerateUnexpectedToken(firstRestricted, Messages.StrictOctalLiteral);
}
} else {
if (!firstRestricted && token.octal) {
firstRestricted = token;
}
}
}
while (startIndex < length) {
statement = parseStatementListItem();
/* istanbul ignore if */
if (typeof statement === 'undefined') {
break;
}
body.push(statement);
}
return body;
} | javascript | function parseScriptBody() {
var statement, body = [], token, directive, firstRestricted;
while (startIndex < length) {
token = lookahead;
if (token.type !== Token.StringLiteral) {
break;
}
statement = parseStatementListItem();
body.push(statement);
if (statement.expression.type !== Syntax.Literal) {
// this is not directive
break;
}
directive = source.slice(token.start + 1, token.end - 1);
if (directive === 'use strict') {
strict = true;
if (firstRestricted) {
tolerateUnexpectedToken(firstRestricted, Messages.StrictOctalLiteral);
}
} else {
if (!firstRestricted && token.octal) {
firstRestricted = token;
}
}
}
while (startIndex < length) {
statement = parseStatementListItem();
/* istanbul ignore if */
if (typeof statement === 'undefined') {
break;
}
body.push(statement);
}
return body;
} | [
"function",
"parseScriptBody",
"(",
")",
"{",
"var",
"statement",
",",
"body",
"=",
"[",
"]",
",",
"token",
",",
"directive",
",",
"firstRestricted",
";",
"while",
"(",
"startIndex",
"<",
"length",
")",
"{",
"token",
"=",
"lookahead",
";",
"if",
"(",
"token",
".",
"type",
"!==",
"Token",
".",
"StringLiteral",
")",
"{",
"break",
";",
"}",
"statement",
"=",
"parseStatementListItem",
"(",
")",
";",
"body",
".",
"push",
"(",
"statement",
")",
";",
"if",
"(",
"statement",
".",
"expression",
".",
"type",
"!==",
"Syntax",
".",
"Literal",
")",
"{",
"// this is not directive",
"break",
";",
"}",
"directive",
"=",
"source",
".",
"slice",
"(",
"token",
".",
"start",
"+",
"1",
",",
"token",
".",
"end",
"-",
"1",
")",
";",
"if",
"(",
"directive",
"===",
"'use strict'",
")",
"{",
"strict",
"=",
"true",
";",
"if",
"(",
"firstRestricted",
")",
"{",
"tolerateUnexpectedToken",
"(",
"firstRestricted",
",",
"Messages",
".",
"StrictOctalLiteral",
")",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"!",
"firstRestricted",
"&&",
"token",
".",
"octal",
")",
"{",
"firstRestricted",
"=",
"token",
";",
"}",
"}",
"}",
"while",
"(",
"startIndex",
"<",
"length",
")",
"{",
"statement",
"=",
"parseStatementListItem",
"(",
")",
";",
"/* istanbul ignore if */",
"if",
"(",
"typeof",
"statement",
"===",
"'undefined'",
")",
"{",
"break",
";",
"}",
"body",
".",
"push",
"(",
"statement",
")",
";",
"}",
"return",
"body",
";",
"}"
] | ECMA-262 15.1 Scripts | [
"ECMA",
"-",
"262",
"15",
".",
"1",
"Scripts"
] | 8a4a1059f060a7100270e837d2759c6a2b9c7e74 | https://github.com/reptilbud/hapi-swagger/blob/8a4a1059f060a7100270e837d2759c6a2b9c7e74/public/swaggerui/swagger-ui.js#L16612-L16649 |
51,338 | reptilbud/hapi-swagger | public/swaggerui/swagger-ui.js | function(){
// Initialize the API object
if (this.mainView) {
this.mainView.clear();
}
var url = this.options.url;
if (url && url.indexOf('http') !== 0) {
url = this.buildUrl(window.location.href.toString(), url);
}
if(this.api) {
this.options.authorizations = this.api.clientAuthorizations.authz;
}
this.options.url = url;
this.headerView.update(url);
this.api = new SwaggerClient(this.options);
} | javascript | function(){
// Initialize the API object
if (this.mainView) {
this.mainView.clear();
}
var url = this.options.url;
if (url && url.indexOf('http') !== 0) {
url = this.buildUrl(window.location.href.toString(), url);
}
if(this.api) {
this.options.authorizations = this.api.clientAuthorizations.authz;
}
this.options.url = url;
this.headerView.update(url);
this.api = new SwaggerClient(this.options);
} | [
"function",
"(",
")",
"{",
"// Initialize the API object",
"if",
"(",
"this",
".",
"mainView",
")",
"{",
"this",
".",
"mainView",
".",
"clear",
"(",
")",
";",
"}",
"var",
"url",
"=",
"this",
".",
"options",
".",
"url",
";",
"if",
"(",
"url",
"&&",
"url",
".",
"indexOf",
"(",
"'http'",
")",
"!==",
"0",
")",
"{",
"url",
"=",
"this",
".",
"buildUrl",
"(",
"window",
".",
"location",
".",
"href",
".",
"toString",
"(",
")",
",",
"url",
")",
";",
"}",
"if",
"(",
"this",
".",
"api",
")",
"{",
"this",
".",
"options",
".",
"authorizations",
"=",
"this",
".",
"api",
".",
"clientAuthorizations",
".",
"authz",
";",
"}",
"this",
".",
"options",
".",
"url",
"=",
"url",
";",
"this",
".",
"headerView",
".",
"update",
"(",
"url",
")",
";",
"this",
".",
"api",
"=",
"new",
"SwaggerClient",
"(",
"this",
".",
"options",
")",
";",
"}"
] | Create an api and render | [
"Create",
"an",
"api",
"and",
"render"
] | 8a4a1059f060a7100270e837d2759c6a2b9c7e74 | https://github.com/reptilbud/hapi-swagger/blob/8a4a1059f060a7100270e837d2759c6a2b9c7e74/public/swaggerui/swagger-ui.js#L24808-L24824 |
|
51,339 | tolokoban/ToloFrameWork | ker/com/x-row/x-row.com.js | flushCurrentCell | function flushCurrentCell() {
if (currentCell.children.length > 0) {
cells.push(currentCell);
currentCell = N.tag("div");
cellsWeights.push(1);
totalWeight++;
}
} | javascript | function flushCurrentCell() {
if (currentCell.children.length > 0) {
cells.push(currentCell);
currentCell = N.tag("div");
cellsWeights.push(1);
totalWeight++;
}
} | [
"function",
"flushCurrentCell",
"(",
")",
"{",
"if",
"(",
"currentCell",
".",
"children",
".",
"length",
">",
"0",
")",
"{",
"cells",
".",
"push",
"(",
"currentCell",
")",
";",
"currentCell",
"=",
"N",
".",
"tag",
"(",
"\"div\"",
")",
";",
"cellsWeights",
".",
"push",
"(",
"1",
")",
";",
"totalWeight",
"++",
";",
"}",
"}"
] | Push `currentCell` to `cells` if `currentCell` is not empty. | [
"Push",
"currentCell",
"to",
"cells",
"if",
"currentCell",
"is",
"not",
"empty",
"."
] | 730845a833a9660ebfdb60ad027ebaab5ac871b6 | https://github.com/tolokoban/ToloFrameWork/blob/730845a833a9660ebfdb60ad027ebaab5ac871b6/ker/com/x-row/x-row.com.js#L49-L56 |
51,340 | finvernizzi/mplane_http_transport | ssl_files.js | readFileContent | function readFileContent(fileName){
try{
return(fs.readFileSync(fileName , "utf-8"));
}catch(e){
console.log("---readFileContent-- Error reading file "+fileName);
console.log(e);
return null;
}
} | javascript | function readFileContent(fileName){
try{
return(fs.readFileSync(fileName , "utf-8"));
}catch(e){
console.log("---readFileContent-- Error reading file "+fileName);
console.log(e);
return null;
}
} | [
"function",
"readFileContent",
"(",
"fileName",
")",
"{",
"try",
"{",
"return",
"(",
"fs",
".",
"readFileSync",
"(",
"fileName",
",",
"\"utf-8\"",
")",
")",
";",
"}",
"catch",
"(",
"e",
")",
"{",
"console",
".",
"log",
"(",
"\"---readFileContent-- Error reading file \"",
"+",
"fileName",
")",
";",
"console",
".",
"log",
"(",
"e",
")",
";",
"return",
"null",
";",
"}",
"}"
] | Reads cert and keys
@param fileName (full path)
@returns {*} | [
"Reads",
"cert",
"and",
"keys"
] | 1102d8e1458c3010f3b126b536434114c790b180 | https://github.com/finvernizzi/mplane_http_transport/blob/1102d8e1458c3010f3b126b536434114c790b180/ssl_files.js#L48-L56 |
51,341 | RoboterHund/April1 | modules/output.js | output | function output (consumer, template, params, getDefault) {
return new Output (consumer, template, params, getDefault);
} | javascript | function output (consumer, template, params, getDefault) {
return new Output (consumer, template, params, getDefault);
} | [
"function",
"output",
"(",
"consumer",
",",
"template",
",",
"params",
",",
"getDefault",
")",
"{",
"return",
"new",
"Output",
"(",
"consumer",
",",
"template",
",",
"params",
",",
"getDefault",
")",
";",
"}"
] | output generator constructor wrapper
@param {Consumer} consumer passed to constructor
@param {Array} template passed to constructor
@param {Parameterizer} [params] passed to constructor
@param getDefault
@returns {Output} initialized output generator | [
"output",
"generator",
"constructor",
"wrapper"
] | f4fead4d8190d0b7bdc7b649f4c2c0e9728ef30b | https://github.com/RoboterHund/April1/blob/f4fead4d8190d0b7bdc7b649f4c2c0e9728ef30b/modules/output.js#L44-L46 |
51,342 | itsa/itsa-io | io.js | function (xhr, options, promise) {
console.log(NAME, '_initXHR');
var instance = this,
url = options.url,
method = options.method || GET,
headers = options.headers || {}, // all request will get some headers
async = !options.sync,
data = options.data,
reject = promise.reject,
sendPayload;
// xhr will be null in case of a CORS-request when no CORS is possible
if (!xhr) {
console.error(NAME, '_initXHR fails: '+ERROR_NO_XHR);
reject(new Error(ERROR_NO_XHR));
return;
}
console.log(NAME, '_initXHR succesfully created '+(xhr._isXHR2 ? 'XMLHttpRequest2' : (xhr._isXDR ? 'XDomainRequest' : 'XMLHttpRequest1'))+'-instance');
// method-name should be in uppercase:
method = method.toUpperCase();
// in case of BODY-method: eliminate any data behind querystring:
// else: append data-object behind querystring
if (BODY_METHODS[method]) {
url = url.split('?'); // now url is an array
url = url[0]; // now url is a String again
}
else if (data && (headers[CONTENT_TYPE]!==MIME_BLOB)) {
url += ((url.indexOf('?') > 0) ? '&' : '?') + instance._toQueryString(data);
}
xhr.open(method, url, async);
// xhr.responseType = options.responseType || 'text';
options.withCredentials && (xhr.withCredentials=true);
// more initialisation might be needed by extended modules:
instance._xhrInitList.each(
function(fn) {
fn(xhr, promise, headers, method);
}
);
if (BODY_METHODS[method] && data) {
if (headers[CONTENT_TYPE]===MIME_BLOB) {
if (!xhr._isXDR) {
sendPayload = data;
}
}
else {
sendPayload = ((headers[CONTENT_TYPE]===MIME_JSON) || xhr._isXDR) ? JSON.stringify(data) : instance._toQueryString(data);
}
}
// send the request:
xhr.send(sendPayload);
console.log(NAME, 'xhr send to '+url+' with method '+method);
// now add xhr.abort() to the promise, so we can call from within the returned promise-instance
promise.abort = function() {
console.log(NAME, 'xhr aborted');
reject(new Error(ABORTED));
xhr._aborted = true; // must be set: IE9 won't allow to read anything on xhr after being aborted
xhr.abort();
};
// in case synchronous transfer: force an xhr.onreadystatechange:
async || xhr.onreadystatechange();
} | javascript | function (xhr, options, promise) {
console.log(NAME, '_initXHR');
var instance = this,
url = options.url,
method = options.method || GET,
headers = options.headers || {}, // all request will get some headers
async = !options.sync,
data = options.data,
reject = promise.reject,
sendPayload;
// xhr will be null in case of a CORS-request when no CORS is possible
if (!xhr) {
console.error(NAME, '_initXHR fails: '+ERROR_NO_XHR);
reject(new Error(ERROR_NO_XHR));
return;
}
console.log(NAME, '_initXHR succesfully created '+(xhr._isXHR2 ? 'XMLHttpRequest2' : (xhr._isXDR ? 'XDomainRequest' : 'XMLHttpRequest1'))+'-instance');
// method-name should be in uppercase:
method = method.toUpperCase();
// in case of BODY-method: eliminate any data behind querystring:
// else: append data-object behind querystring
if (BODY_METHODS[method]) {
url = url.split('?'); // now url is an array
url = url[0]; // now url is a String again
}
else if (data && (headers[CONTENT_TYPE]!==MIME_BLOB)) {
url += ((url.indexOf('?') > 0) ? '&' : '?') + instance._toQueryString(data);
}
xhr.open(method, url, async);
// xhr.responseType = options.responseType || 'text';
options.withCredentials && (xhr.withCredentials=true);
// more initialisation might be needed by extended modules:
instance._xhrInitList.each(
function(fn) {
fn(xhr, promise, headers, method);
}
);
if (BODY_METHODS[method] && data) {
if (headers[CONTENT_TYPE]===MIME_BLOB) {
if (!xhr._isXDR) {
sendPayload = data;
}
}
else {
sendPayload = ((headers[CONTENT_TYPE]===MIME_JSON) || xhr._isXDR) ? JSON.stringify(data) : instance._toQueryString(data);
}
}
// send the request:
xhr.send(sendPayload);
console.log(NAME, 'xhr send to '+url+' with method '+method);
// now add xhr.abort() to the promise, so we can call from within the returned promise-instance
promise.abort = function() {
console.log(NAME, 'xhr aborted');
reject(new Error(ABORTED));
xhr._aborted = true; // must be set: IE9 won't allow to read anything on xhr after being aborted
xhr.abort();
};
// in case synchronous transfer: force an xhr.onreadystatechange:
async || xhr.onreadystatechange();
} | [
"function",
"(",
"xhr",
",",
"options",
",",
"promise",
")",
"{",
"console",
".",
"log",
"(",
"NAME",
",",
"'_initXHR'",
")",
";",
"var",
"instance",
"=",
"this",
",",
"url",
"=",
"options",
".",
"url",
",",
"method",
"=",
"options",
".",
"method",
"||",
"GET",
",",
"headers",
"=",
"options",
".",
"headers",
"||",
"{",
"}",
",",
"// all request will get some headers",
"async",
"=",
"!",
"options",
".",
"sync",
",",
"data",
"=",
"options",
".",
"data",
",",
"reject",
"=",
"promise",
".",
"reject",
",",
"sendPayload",
";",
"// xhr will be null in case of a CORS-request when no CORS is possible",
"if",
"(",
"!",
"xhr",
")",
"{",
"console",
".",
"error",
"(",
"NAME",
",",
"'_initXHR fails: '",
"+",
"ERROR_NO_XHR",
")",
";",
"reject",
"(",
"new",
"Error",
"(",
"ERROR_NO_XHR",
")",
")",
";",
"return",
";",
"}",
"console",
".",
"log",
"(",
"NAME",
",",
"'_initXHR succesfully created '",
"+",
"(",
"xhr",
".",
"_isXHR2",
"?",
"'XMLHttpRequest2'",
":",
"(",
"xhr",
".",
"_isXDR",
"?",
"'XDomainRequest'",
":",
"'XMLHttpRequest1'",
")",
")",
"+",
"'-instance'",
")",
";",
"// method-name should be in uppercase:",
"method",
"=",
"method",
".",
"toUpperCase",
"(",
")",
";",
"// in case of BODY-method: eliminate any data behind querystring:",
"// else: append data-object behind querystring",
"if",
"(",
"BODY_METHODS",
"[",
"method",
"]",
")",
"{",
"url",
"=",
"url",
".",
"split",
"(",
"'?'",
")",
";",
"// now url is an array",
"url",
"=",
"url",
"[",
"0",
"]",
";",
"// now url is a String again",
"}",
"else",
"if",
"(",
"data",
"&&",
"(",
"headers",
"[",
"CONTENT_TYPE",
"]",
"!==",
"MIME_BLOB",
")",
")",
"{",
"url",
"+=",
"(",
"(",
"url",
".",
"indexOf",
"(",
"'?'",
")",
">",
"0",
")",
"?",
"'&'",
":",
"'?'",
")",
"+",
"instance",
".",
"_toQueryString",
"(",
"data",
")",
";",
"}",
"xhr",
".",
"open",
"(",
"method",
",",
"url",
",",
"async",
")",
";",
"// xhr.responseType = options.responseType || 'text';",
"options",
".",
"withCredentials",
"&&",
"(",
"xhr",
".",
"withCredentials",
"=",
"true",
")",
";",
"// more initialisation might be needed by extended modules:",
"instance",
".",
"_xhrInitList",
".",
"each",
"(",
"function",
"(",
"fn",
")",
"{",
"fn",
"(",
"xhr",
",",
"promise",
",",
"headers",
",",
"method",
")",
";",
"}",
")",
";",
"if",
"(",
"BODY_METHODS",
"[",
"method",
"]",
"&&",
"data",
")",
"{",
"if",
"(",
"headers",
"[",
"CONTENT_TYPE",
"]",
"===",
"MIME_BLOB",
")",
"{",
"if",
"(",
"!",
"xhr",
".",
"_isXDR",
")",
"{",
"sendPayload",
"=",
"data",
";",
"}",
"}",
"else",
"{",
"sendPayload",
"=",
"(",
"(",
"headers",
"[",
"CONTENT_TYPE",
"]",
"===",
"MIME_JSON",
")",
"||",
"xhr",
".",
"_isXDR",
")",
"?",
"JSON",
".",
"stringify",
"(",
"data",
")",
":",
"instance",
".",
"_toQueryString",
"(",
"data",
")",
";",
"}",
"}",
"// send the request:",
"xhr",
".",
"send",
"(",
"sendPayload",
")",
";",
"console",
".",
"log",
"(",
"NAME",
",",
"'xhr send to '",
"+",
"url",
"+",
"' with method '",
"+",
"method",
")",
";",
"// now add xhr.abort() to the promise, so we can call from within the returned promise-instance",
"promise",
".",
"abort",
"=",
"function",
"(",
")",
"{",
"console",
".",
"log",
"(",
"NAME",
",",
"'xhr aborted'",
")",
";",
"reject",
"(",
"new",
"Error",
"(",
"ABORTED",
")",
")",
";",
"xhr",
".",
"_aborted",
"=",
"true",
";",
"// must be set: IE9 won't allow to read anything on xhr after being aborted",
"xhr",
".",
"abort",
"(",
")",
";",
"}",
";",
"// in case synchronous transfer: force an xhr.onreadystatechange:",
"async",
"||",
"xhr",
".",
"onreadystatechange",
"(",
")",
";",
"}"
] | Initializes the xhr-instance, based on the config-params.
This method is the standard way of doing xhr-requests without processing streams.
@method _initXHR
@param xhr {Object} xhr-instance
@param options {Object}
@param [options.url] {String} The url to which the request is sent.
@param [options.method='GET'] {String} The HTTP method to use.
can be ignored, even if streams are used --> the returned Promise will always hold all data
@param [options.sync=false] {boolean} By default, all requests are sent asynchronously. To send synchronous requests, set to true.
This feature only works in the browser: nodejs will always perform asynchronous requests.
@param [options.data] {Object} Data to be sent to the server, either to be used by `query-params` or `body`.
@param [options.headers] {Object} HTTP request headers.
@param [options.responseType] {String} Force the response type.
@param [options.timeout=3000] {number} to timeout the request, leading into a rejected Promise.
@param [options.withCredentials=false] {boolean} Whether or not to send credentials on the request.
@param fulfill {Function} reference to xhr-promise's fulfill-function
@param reject {Function} reference to xhr-promise's reject-function
@param promise {Promise} the xhr-promise which will be extended with the `abort()`-method
@private | [
"Initializes",
"the",
"xhr",
"-",
"instance",
"based",
"on",
"the",
"config",
"-",
"params",
".",
"This",
"method",
"is",
"the",
"standard",
"way",
"of",
"doing",
"xhr",
"-",
"requests",
"without",
"processing",
"streams",
"."
] | 790c77db5cfd3ee953256bfadd60218fb3a5041e | https://github.com/itsa/itsa-io/blob/790c77db5cfd3ee953256bfadd60218fb3a5041e/io.js#L89-L156 |
|
51,343 | itsa/itsa-io | io.js | function(xhr, promise, headers, method) {
// XDR cannot set requestheaders, only XHR:
if (!xhr._isXDR) {
console.log(NAME, '_setHeaders');
var name;
if ((method!=='POST') && (method!=='PUT')) {
// force GET-request to make a request instead of using cache (like IE does):
headers['If-Modified-Since'] = 'Wed, 15 Nov 1995 01:00:00 GMT';
// header 'Content-Type' should only be set with POST or PUT requests:
delete headers[CONTENT_TYPE];
}
// set all headers
for (name in headers) {
xhr.setRequestHeader(name, headers[name]);
}
// in case of POST or PUT method: always make sure 'Content-Type' is specified
((method!=='POST') && (method!=='PUT')) || (headers && (CONTENT_TYPE in headers)) || xhr.setRequestHeader(CONTENT_TYPE, DEF_CONTENT_TYPE_POST);
}
} | javascript | function(xhr, promise, headers, method) {
// XDR cannot set requestheaders, only XHR:
if (!xhr._isXDR) {
console.log(NAME, '_setHeaders');
var name;
if ((method!=='POST') && (method!=='PUT')) {
// force GET-request to make a request instead of using cache (like IE does):
headers['If-Modified-Since'] = 'Wed, 15 Nov 1995 01:00:00 GMT';
// header 'Content-Type' should only be set with POST or PUT requests:
delete headers[CONTENT_TYPE];
}
// set all headers
for (name in headers) {
xhr.setRequestHeader(name, headers[name]);
}
// in case of POST or PUT method: always make sure 'Content-Type' is specified
((method!=='POST') && (method!=='PUT')) || (headers && (CONTENT_TYPE in headers)) || xhr.setRequestHeader(CONTENT_TYPE, DEF_CONTENT_TYPE_POST);
}
} | [
"function",
"(",
"xhr",
",",
"promise",
",",
"headers",
",",
"method",
")",
"{",
"// XDR cannot set requestheaders, only XHR:",
"if",
"(",
"!",
"xhr",
".",
"_isXDR",
")",
"{",
"console",
".",
"log",
"(",
"NAME",
",",
"'_setHeaders'",
")",
";",
"var",
"name",
";",
"if",
"(",
"(",
"method",
"!==",
"'POST'",
")",
"&&",
"(",
"method",
"!==",
"'PUT'",
")",
")",
"{",
"// force GET-request to make a request instead of using cache (like IE does):",
"headers",
"[",
"'If-Modified-Since'",
"]",
"=",
"'Wed, 15 Nov 1995 01:00:00 GMT'",
";",
"// header 'Content-Type' should only be set with POST or PUT requests:",
"delete",
"headers",
"[",
"CONTENT_TYPE",
"]",
";",
"}",
"// set all headers",
"for",
"(",
"name",
"in",
"headers",
")",
"{",
"xhr",
".",
"setRequestHeader",
"(",
"name",
",",
"headers",
"[",
"name",
"]",
")",
";",
"}",
"// in case of POST or PUT method: always make sure 'Content-Type' is specified",
"(",
"(",
"method",
"!==",
"'POST'",
")",
"&&",
"(",
"method",
"!==",
"'PUT'",
")",
")",
"||",
"(",
"headers",
"&&",
"(",
"CONTENT_TYPE",
"in",
"headers",
")",
")",
"||",
"xhr",
".",
"setRequestHeader",
"(",
"CONTENT_TYPE",
",",
"DEF_CONTENT_TYPE_POST",
")",
";",
"}",
"}"
] | Adds the `headers`-object to `xhr`-headers.
@method _setHeaders
@param xhr {Object} containing the xhr-instance
@param headers {Object} containing all headers
@param method {String} the request-method used
@private | [
"Adds",
"the",
"headers",
"-",
"object",
"to",
"xhr",
"-",
"headers",
"."
] | 790c77db5cfd3ee953256bfadd60218fb3a5041e | https://github.com/itsa/itsa-io/blob/790c77db5cfd3ee953256bfadd60218fb3a5041e/io.js#L167-L186 |
|
51,344 | itsa/itsa-io | io.js | function(data) {
var paramArray = [],
key, value;
// TODO: use `object` module
for (key in data) {
value = data[key];
key = ENCODE_URI_COMPONENT(key);
paramArray.push((value === null) ? key : (key + '=' + ENCODE_URI_COMPONENT(value)));
}
console.log(NAME, '_toQueryString --> '+paramArray.join('&'));
return paramArray.join('&');
} | javascript | function(data) {
var paramArray = [],
key, value;
// TODO: use `object` module
for (key in data) {
value = data[key];
key = ENCODE_URI_COMPONENT(key);
paramArray.push((value === null) ? key : (key + '=' + ENCODE_URI_COMPONENT(value)));
}
console.log(NAME, '_toQueryString --> '+paramArray.join('&'));
return paramArray.join('&');
} | [
"function",
"(",
"data",
")",
"{",
"var",
"paramArray",
"=",
"[",
"]",
",",
"key",
",",
"value",
";",
"// TODO: use `object` module",
"for",
"(",
"key",
"in",
"data",
")",
"{",
"value",
"=",
"data",
"[",
"key",
"]",
";",
"key",
"=",
"ENCODE_URI_COMPONENT",
"(",
"key",
")",
";",
"paramArray",
".",
"push",
"(",
"(",
"value",
"===",
"null",
")",
"?",
"key",
":",
"(",
"key",
"+",
"'='",
"+",
"ENCODE_URI_COMPONENT",
"(",
"value",
")",
")",
")",
";",
"}",
"console",
".",
"log",
"(",
"NAME",
",",
"'_toQueryString --> '",
"+",
"paramArray",
".",
"join",
"(",
"'&'",
")",
")",
";",
"return",
"paramArray",
".",
"join",
"(",
"'&'",
")",
";",
"}"
] | Stringifies an object into one string with every pair separated by `&`
@method _toQueryString
@param data {Object} containing key-value pairs
@return {String} stringified presentation of the object, with every pair separated by `&`
@private | [
"Stringifies",
"an",
"object",
"into",
"one",
"string",
"with",
"every",
"pair",
"separated",
"by",
"&"
] | 790c77db5cfd3ee953256bfadd60218fb3a5041e | https://github.com/itsa/itsa-io/blob/790c77db5cfd3ee953256bfadd60218fb3a5041e/io.js#L247-L258 |
|
51,345 | ibm-bluemix-mobile-services/bms-monitoring-sdk-node | AnalyticsEventEmitter.js | AnalyticsEventEmitter | function AnalyticsEventEmitter(logger, utils, CONSTANT, onErrorCallback, optionalArguments, serviceName) {
'use strict';
this.logger = logger || {};
this.utils = utils || {};
this.CONSTANT = CONSTANT || {};
optionalArguments = optionalArguments || {};
this.settings = optionalArguments.settings;
this.reportEventDelay = optionalArguments.reportEventInterval;
if(serviceName) {
this.networkRequestServiceName = serviceName;
}
// Register onErrorCallback callback
this.on('error', onErrorCallback || function (err) {
this.logger.log('Emitted an error event: ' + err);
});
} | javascript | function AnalyticsEventEmitter(logger, utils, CONSTANT, onErrorCallback, optionalArguments, serviceName) {
'use strict';
this.logger = logger || {};
this.utils = utils || {};
this.CONSTANT = CONSTANT || {};
optionalArguments = optionalArguments || {};
this.settings = optionalArguments.settings;
this.reportEventDelay = optionalArguments.reportEventInterval;
if(serviceName) {
this.networkRequestServiceName = serviceName;
}
// Register onErrorCallback callback
this.on('error', onErrorCallback || function (err) {
this.logger.log('Emitted an error event: ' + err);
});
} | [
"function",
"AnalyticsEventEmitter",
"(",
"logger",
",",
"utils",
",",
"CONSTANT",
",",
"onErrorCallback",
",",
"optionalArguments",
",",
"serviceName",
")",
"{",
"'use strict'",
";",
"this",
".",
"logger",
"=",
"logger",
"||",
"{",
"}",
";",
"this",
".",
"utils",
"=",
"utils",
"||",
"{",
"}",
";",
"this",
".",
"CONSTANT",
"=",
"CONSTANT",
"||",
"{",
"}",
";",
"optionalArguments",
"=",
"optionalArguments",
"||",
"{",
"}",
";",
"this",
".",
"settings",
"=",
"optionalArguments",
".",
"settings",
";",
"this",
".",
"reportEventDelay",
"=",
"optionalArguments",
".",
"reportEventInterval",
";",
"if",
"(",
"serviceName",
")",
"{",
"this",
".",
"networkRequestServiceName",
"=",
"serviceName",
";",
"}",
"// Register onErrorCallback callback",
"this",
".",
"on",
"(",
"'error'",
",",
"onErrorCallback",
"||",
"function",
"(",
"err",
")",
"{",
"this",
".",
"logger",
".",
"log",
"(",
"'Emitted an error event: '",
"+",
"err",
")",
";",
"}",
")",
";",
"}"
] | This is the main class that gets returned by our SDK init method. It contains several public functions intended to be consumed by users of the SDK. Similar to AnalyticsSDK.java for our java SDK. See README.md for detailed documentation. | [
"This",
"is",
"the",
"main",
"class",
"that",
"gets",
"returned",
"by",
"our",
"SDK",
"init",
"method",
".",
"It",
"contains",
"several",
"public",
"functions",
"intended",
"to",
"be",
"consumed",
"by",
"users",
"of",
"the",
"SDK",
".",
"Similar",
"to",
"AnalyticsSDK",
".",
"java",
"for",
"our",
"java",
"SDK",
".",
"See",
"README",
".",
"md",
"for",
"detailed",
"documentation",
"."
] | 5b26fbd3b8adacb3fa9f4a0cbd60c8eae1a44df9 | https://github.com/ibm-bluemix-mobile-services/bms-monitoring-sdk-node/blob/5b26fbd3b8adacb3fa9f4a0cbd60c8eae1a44df9/AnalyticsEventEmitter.js#L16-L36 |
51,346 | ibm-bluemix-mobile-services/bms-monitoring-sdk-node | AnalyticsEventEmitter.js | function (types) {
that.logger.logEnter('callback in loadEventTypes, types:\n' + JSON.stringify(types));
// The "raw" event type data has a deeply-nested structure and it
// contains a bunch of stuff we're not interested in. We'll just
// store the names of each type's properties.
Object.keys(types).forEach(function (typeName) {
if (types[typeName].properties) {
eventTypes[typeName] = Object.keys(types[typeName].properties);
}
});
that.logger.log('eventTypes:\n' + JSON.stringify(eventTypes));
if (process.env.TESTONLY_EMIT_INTERNAL_EVENTS) {
that.emit(that.CONSTANT.internal_event_load_types_done);
}
// Now the event buffer can begin processing events.
eventBuffer.ready();
that.logger.logExit('callback in loadEventTypes');
} | javascript | function (types) {
that.logger.logEnter('callback in loadEventTypes, types:\n' + JSON.stringify(types));
// The "raw" event type data has a deeply-nested structure and it
// contains a bunch of stuff we're not interested in. We'll just
// store the names of each type's properties.
Object.keys(types).forEach(function (typeName) {
if (types[typeName].properties) {
eventTypes[typeName] = Object.keys(types[typeName].properties);
}
});
that.logger.log('eventTypes:\n' + JSON.stringify(eventTypes));
if (process.env.TESTONLY_EMIT_INTERNAL_EVENTS) {
that.emit(that.CONSTANT.internal_event_load_types_done);
}
// Now the event buffer can begin processing events.
eventBuffer.ready();
that.logger.logExit('callback in loadEventTypes');
} | [
"function",
"(",
"types",
")",
"{",
"that",
".",
"logger",
".",
"logEnter",
"(",
"'callback in loadEventTypes, types:\\n'",
"+",
"JSON",
".",
"stringify",
"(",
"types",
")",
")",
";",
"// The \"raw\" event type data has a deeply-nested structure and it",
"// contains a bunch of stuff we're not interested in. We'll just",
"// store the names of each type's properties.",
"Object",
".",
"keys",
"(",
"types",
")",
".",
"forEach",
"(",
"function",
"(",
"typeName",
")",
"{",
"if",
"(",
"types",
"[",
"typeName",
"]",
".",
"properties",
")",
"{",
"eventTypes",
"[",
"typeName",
"]",
"=",
"Object",
".",
"keys",
"(",
"types",
"[",
"typeName",
"]",
".",
"properties",
")",
";",
"}",
"}",
")",
";",
"that",
".",
"logger",
".",
"log",
"(",
"'eventTypes:\\n'",
"+",
"JSON",
".",
"stringify",
"(",
"eventTypes",
")",
")",
";",
"if",
"(",
"process",
".",
"env",
".",
"TESTONLY_EMIT_INTERNAL_EVENTS",
")",
"{",
"that",
".",
"emit",
"(",
"that",
".",
"CONSTANT",
".",
"internal_event_load_types_done",
")",
";",
"}",
"// Now the event buffer can begin processing events.",
"eventBuffer",
".",
"ready",
"(",
")",
";",
"that",
".",
"logger",
".",
"logExit",
"(",
"'callback in loadEventTypes'",
")",
";",
"}"
] | Get the event types from the analytics repository. | [
"Get",
"the",
"event",
"types",
"from",
"the",
"analytics",
"repository",
"."
] | 5b26fbd3b8adacb3fa9f4a0cbd60c8eae1a44df9 | https://github.com/ibm-bluemix-mobile-services/bms-monitoring-sdk-node/blob/5b26fbd3b8adacb3fa9f4a0cbd60c8eae1a44df9/AnalyticsEventEmitter.js#L61-L84 |
|
51,347 | Becklyn/becklyn-gulp | lib/jshint-helper.js | function (filePath, options)
{
gulpUtil.log(gulpUtil.colors.blue("jsHint"), pathHelper.makeRelative(filePath));
var jsHintConfig = jsHintConfigHelper.getRules(xtend({
lookup: false,
esnext: false
}, options));
gulp.src(filePath)
.pipe(plumber())
.pipe(jshint(jsHintConfig))
.pipe(jshint.reporter(jshintStylish));
} | javascript | function (filePath, options)
{
gulpUtil.log(gulpUtil.colors.blue("jsHint"), pathHelper.makeRelative(filePath));
var jsHintConfig = jsHintConfigHelper.getRules(xtend({
lookup: false,
esnext: false
}, options));
gulp.src(filePath)
.pipe(plumber())
.pipe(jshint(jsHintConfig))
.pipe(jshint.reporter(jshintStylish));
} | [
"function",
"(",
"filePath",
",",
"options",
")",
"{",
"gulpUtil",
".",
"log",
"(",
"gulpUtil",
".",
"colors",
".",
"blue",
"(",
"\"jsHint\"",
")",
",",
"pathHelper",
".",
"makeRelative",
"(",
"filePath",
")",
")",
";",
"var",
"jsHintConfig",
"=",
"jsHintConfigHelper",
".",
"getRules",
"(",
"xtend",
"(",
"{",
"lookup",
":",
"false",
",",
"esnext",
":",
"false",
"}",
",",
"options",
")",
")",
";",
"gulp",
".",
"src",
"(",
"filePath",
")",
".",
"pipe",
"(",
"plumber",
"(",
")",
")",
".",
"pipe",
"(",
"jshint",
"(",
"jsHintConfig",
")",
")",
".",
"pipe",
"(",
"jshint",
".",
"reporter",
"(",
"jshintStylish",
")",
")",
";",
"}"
] | Lints a given file
@param {string} filePath
@param {{esnext: boolean}} [options] | [
"Lints",
"a",
"given",
"file"
] | 1c633378d561f07101f9db19ccd153617b8e0252 | https://github.com/Becklyn/becklyn-gulp/blob/1c633378d561f07101f9db19ccd153617b8e0252/lib/jshint-helper.js#L20-L33 |
|
51,348 | draykcirb/brickyard-webpack | index.js | moveETP2End | function moveETP2End(config) {
if (!ExtractTextPlugin) return
const etps = config.plugins.filter(val => val instanceof ExtractTextPlugin)
_.chain(config.plugins)
.pullAll(etps)
.push(...etps)
.value()
} | javascript | function moveETP2End(config) {
if (!ExtractTextPlugin) return
const etps = config.plugins.filter(val => val instanceof ExtractTextPlugin)
_.chain(config.plugins)
.pullAll(etps)
.push(...etps)
.value()
} | [
"function",
"moveETP2End",
"(",
"config",
")",
"{",
"if",
"(",
"!",
"ExtractTextPlugin",
")",
"return",
"const",
"etps",
"=",
"config",
".",
"plugins",
".",
"filter",
"(",
"val",
"=>",
"val",
"instanceof",
"ExtractTextPlugin",
")",
"_",
".",
"chain",
"(",
"config",
".",
"plugins",
")",
".",
"pullAll",
"(",
"etps",
")",
".",
"push",
"(",
"...",
"etps",
")",
".",
"value",
"(",
")",
"}"
] | mutate. The etps should behind CommonsChunkPlugin
@param config | [
"mutate",
".",
"The",
"etps",
"should",
"behind",
"CommonsChunkPlugin"
] | 8b5f3fcc6ca8b8c9fae0c2908b4cc77065155ad6 | https://github.com/draykcirb/brickyard-webpack/blob/8b5f3fcc6ca8b8c9fae0c2908b4cc77065155ad6/index.js#L77-L86 |
51,349 | draykcirb/brickyard-webpack | index.js | defineGlobalVars | function defineGlobalVars(runtimeConfig, isDebug) {
const globals = Object.assign({}, runtimeConfig.globals, {
APP_DEBUG_MODE: isDebug || !!runtimeConfig.debuggable
})
return new webpack.DefinePlugin(globals)
} | javascript | function defineGlobalVars(runtimeConfig, isDebug) {
const globals = Object.assign({}, runtimeConfig.globals, {
APP_DEBUG_MODE: isDebug || !!runtimeConfig.debuggable
})
return new webpack.DefinePlugin(globals)
} | [
"function",
"defineGlobalVars",
"(",
"runtimeConfig",
",",
"isDebug",
")",
"{",
"const",
"globals",
"=",
"Object",
".",
"assign",
"(",
"{",
"}",
",",
"runtimeConfig",
".",
"globals",
",",
"{",
"APP_DEBUG_MODE",
":",
"isDebug",
"||",
"!",
"!",
"runtimeConfig",
".",
"debuggable",
"}",
")",
"return",
"new",
"webpack",
".",
"DefinePlugin",
"(",
"globals",
")",
"}"
] | define globals variables for injecting them into source scope
@param runtimeConfig
@param isDebug
@returns {object} | [
"define",
"globals",
"variables",
"for",
"injecting",
"them",
"into",
"source",
"scope"
] | 8b5f3fcc6ca8b8c9fae0c2908b4cc77065155ad6 | https://github.com/draykcirb/brickyard-webpack/blob/8b5f3fcc6ca8b8c9fae0c2908b4cc77065155ad6/index.js#L134-L140 |
51,350 | launchbadge/node-bardo | src/db/execute.js | assertContext | function assertContext() {
return new Promise(function(resolve, reject) {
// Check if we're in an active session
let d = process.domain
if (d == null ||
d.context == null ||
d.context.bardo == null) {
// Begin the session before proceeding
return begin().then((ctx) => {
resolve(ctx)
}).catch(reject)
}
// Continue onwards with our active domain
return resolve(d.context.bardo)
})
} | javascript | function assertContext() {
return new Promise(function(resolve, reject) {
// Check if we're in an active session
let d = process.domain
if (d == null ||
d.context == null ||
d.context.bardo == null) {
// Begin the session before proceeding
return begin().then((ctx) => {
resolve(ctx)
}).catch(reject)
}
// Continue onwards with our active domain
return resolve(d.context.bardo)
})
} | [
"function",
"assertContext",
"(",
")",
"{",
"return",
"new",
"Promise",
"(",
"function",
"(",
"resolve",
",",
"reject",
")",
"{",
"// Check if we're in an active session",
"let",
"d",
"=",
"process",
".",
"domain",
"if",
"(",
"d",
"==",
"null",
"||",
"d",
".",
"context",
"==",
"null",
"||",
"d",
".",
"context",
".",
"bardo",
"==",
"null",
")",
"{",
"// Begin the session before proceeding",
"return",
"begin",
"(",
")",
".",
"then",
"(",
"(",
"ctx",
")",
"=>",
"{",
"resolve",
"(",
"ctx",
")",
"}",
")",
".",
"catch",
"(",
"reject",
")",
"}",
"// Continue onwards with our active domain",
"return",
"resolve",
"(",
"d",
".",
"context",
".",
"bardo",
")",
"}",
")",
"}"
] | Assert that we have a database context | [
"Assert",
"that",
"we",
"have",
"a",
"database",
"context"
] | fb790c4529410f79c67a5ecbada318f67b4f808b | https://github.com/launchbadge/node-bardo/blob/fb790c4529410f79c67a5ecbada318f67b4f808b/src/db/execute.js#L8-L24 |
51,351 | launchbadge/node-bardo | src/db/execute.js | execute_ | function execute_(ctx, statement, values) {
return new Promise(function(resolve, reject) {
if (/^begin/i.test(statement)) {
// If this is a `BEGIN` statement; put us in a transaction
ctx.inTransaction = true
} else if (/^(commit|rollback)/i.test(statement)) {
// Else if this is a `COMMIT` or `ROLLBACK` statement;
// leave the transaction
ctx.inTransaction = false
}
// Default values to an empty array
values = values || []
// TRACE: Get the current clock time
let now = microtime.now()
// Send the statement
ctx.client.query(statement, values, function(err, result) {
// Handle and reject if an error occurred
if (err) return reject(err)
// TRACE: Calculate the elasped time and log the SQL statement
let elapsed = +((microtime.now() - now) / 1000).toFixed(2)
log.trace({
id: ctx.id,
elapsed: `${elapsed}ms`,
values: (values && values.length) ? values : undefined
}, statement)
// DEBUG: Increment the per-session counters
ctx.elapsed += elapsed
ctx.count += 1
// Parse (and resolve) the result proxy
if (!_.isFinite(result.rowCount)) {
// This doesn't support a sane row count resolve with nothing
resolve()
} else if (result.fields == null) {
// Resolve the row count
resolve(result.rowCount)
} else {
// Resolve the rows
resolve(result.rows)
}
})
})
} | javascript | function execute_(ctx, statement, values) {
return new Promise(function(resolve, reject) {
if (/^begin/i.test(statement)) {
// If this is a `BEGIN` statement; put us in a transaction
ctx.inTransaction = true
} else if (/^(commit|rollback)/i.test(statement)) {
// Else if this is a `COMMIT` or `ROLLBACK` statement;
// leave the transaction
ctx.inTransaction = false
}
// Default values to an empty array
values = values || []
// TRACE: Get the current clock time
let now = microtime.now()
// Send the statement
ctx.client.query(statement, values, function(err, result) {
// Handle and reject if an error occurred
if (err) return reject(err)
// TRACE: Calculate the elasped time and log the SQL statement
let elapsed = +((microtime.now() - now) / 1000).toFixed(2)
log.trace({
id: ctx.id,
elapsed: `${elapsed}ms`,
values: (values && values.length) ? values : undefined
}, statement)
// DEBUG: Increment the per-session counters
ctx.elapsed += elapsed
ctx.count += 1
// Parse (and resolve) the result proxy
if (!_.isFinite(result.rowCount)) {
// This doesn't support a sane row count resolve with nothing
resolve()
} else if (result.fields == null) {
// Resolve the row count
resolve(result.rowCount)
} else {
// Resolve the rows
resolve(result.rows)
}
})
})
} | [
"function",
"execute_",
"(",
"ctx",
",",
"statement",
",",
"values",
")",
"{",
"return",
"new",
"Promise",
"(",
"function",
"(",
"resolve",
",",
"reject",
")",
"{",
"if",
"(",
"/",
"^begin",
"/",
"i",
".",
"test",
"(",
"statement",
")",
")",
"{",
"// If this is a `BEGIN` statement; put us in a transaction",
"ctx",
".",
"inTransaction",
"=",
"true",
"}",
"else",
"if",
"(",
"/",
"^(commit|rollback)",
"/",
"i",
".",
"test",
"(",
"statement",
")",
")",
"{",
"// Else if this is a `COMMIT` or `ROLLBACK` statement;",
"// leave the transaction",
"ctx",
".",
"inTransaction",
"=",
"false",
"}",
"// Default values to an empty array",
"values",
"=",
"values",
"||",
"[",
"]",
"// TRACE: Get the current clock time",
"let",
"now",
"=",
"microtime",
".",
"now",
"(",
")",
"// Send the statement",
"ctx",
".",
"client",
".",
"query",
"(",
"statement",
",",
"values",
",",
"function",
"(",
"err",
",",
"result",
")",
"{",
"// Handle and reject if an error occurred",
"if",
"(",
"err",
")",
"return",
"reject",
"(",
"err",
")",
"// TRACE: Calculate the elasped time and log the SQL statement",
"let",
"elapsed",
"=",
"+",
"(",
"(",
"microtime",
".",
"now",
"(",
")",
"-",
"now",
")",
"/",
"1000",
")",
".",
"toFixed",
"(",
"2",
")",
"log",
".",
"trace",
"(",
"{",
"id",
":",
"ctx",
".",
"id",
",",
"elapsed",
":",
"`",
"${",
"elapsed",
"}",
"`",
",",
"values",
":",
"(",
"values",
"&&",
"values",
".",
"length",
")",
"?",
"values",
":",
"undefined",
"}",
",",
"statement",
")",
"// DEBUG: Increment the per-session counters",
"ctx",
".",
"elapsed",
"+=",
"elapsed",
"ctx",
".",
"count",
"+=",
"1",
"// Parse (and resolve) the result proxy",
"if",
"(",
"!",
"_",
".",
"isFinite",
"(",
"result",
".",
"rowCount",
")",
")",
"{",
"// This doesn't support a sane row count resolve with nothing",
"resolve",
"(",
")",
"}",
"else",
"if",
"(",
"result",
".",
"fields",
"==",
"null",
")",
"{",
"// Resolve the row count",
"resolve",
"(",
"result",
".",
"rowCount",
")",
"}",
"else",
"{",
"// Resolve the rows",
"resolve",
"(",
"result",
".",
"rows",
")",
"}",
"}",
")",
"}",
")",
"}"
] | Actually execute the statement | [
"Actually",
"execute",
"the",
"statement"
] | fb790c4529410f79c67a5ecbada318f67b4f808b | https://github.com/launchbadge/node-bardo/blob/fb790c4529410f79c67a5ecbada318f67b4f808b/src/db/execute.js#L44-L91 |
51,352 | Becklyn/becklyn-gulp | tasks/scss.js | issueCountReporter | function issueCountReporter (file)
{
if (!file.scsslint.success)
{
totalIssues += file.scsslint.issues.length;
}
scssLintReporter.defaultReporter(file);
} | javascript | function issueCountReporter (file)
{
if (!file.scsslint.success)
{
totalIssues += file.scsslint.issues.length;
}
scssLintReporter.defaultReporter(file);
} | [
"function",
"issueCountReporter",
"(",
"file",
")",
"{",
"if",
"(",
"!",
"file",
".",
"scsslint",
".",
"success",
")",
"{",
"totalIssues",
"+=",
"file",
".",
"scsslint",
".",
"issues",
".",
"length",
";",
"}",
"scssLintReporter",
".",
"defaultReporter",
"(",
"file",
")",
";",
"}"
] | Wraps the default SCSS Lint Reporter and
counts the total amount of issues
@param {{
scsslint: {
success: bool,
errors: int,
warnings: int,
issues: Array.<{
line: int,
column: int,
severity: string,
reason: string,
}>
}}} file | [
"Wraps",
"the",
"default",
"SCSS",
"Lint",
"Reporter",
"and",
"counts",
"the",
"total",
"amount",
"of",
"issues"
] | 1c633378d561f07101f9db19ccd153617b8e0252 | https://github.com/Becklyn/becklyn-gulp/blob/1c633378d561f07101f9db19ccd153617b8e0252/tasks/scss.js#L48-L56 |
51,353 | Becklyn/becklyn-gulp | tasks/scss.js | compileSingleFile | function compileSingleFile (filePath, isDebug, options)
{
var outputPath = "./" + path.dirname(filePath).replace("assets/scss", "public/css");
gulpUtil.log(gulpUtil.colors.blue("Sass"), pathHelper.makeRelative(filePath), " -> ", outputPath + "/" + path.basename(filePath).replace(/\.scss$/, ".css"));
var innerPipe = gulp.src(filePath)
.pipe(plumber());
if (isDebug)
{
innerPipe = innerPipe
.pipe(watch(filePath));
}
innerPipe = innerPipe
.pipe(sass({
errLogToConsole: true,
includePaths: [
process.env.PWD
]
}))
.pipe(autoprefixer({
browsers: options.browsers,
cascade: false
}));
// if not in debug mode, minify
if (!isDebug)
{
innerPipe = innerPipe.pipe(cssMin({
processImport: false
}));
}
// write auto prefixer
return innerPipe
.pipe(gulp.dest(outputPath));
} | javascript | function compileSingleFile (filePath, isDebug, options)
{
var outputPath = "./" + path.dirname(filePath).replace("assets/scss", "public/css");
gulpUtil.log(gulpUtil.colors.blue("Sass"), pathHelper.makeRelative(filePath), " -> ", outputPath + "/" + path.basename(filePath).replace(/\.scss$/, ".css"));
var innerPipe = gulp.src(filePath)
.pipe(plumber());
if (isDebug)
{
innerPipe = innerPipe
.pipe(watch(filePath));
}
innerPipe = innerPipe
.pipe(sass({
errLogToConsole: true,
includePaths: [
process.env.PWD
]
}))
.pipe(autoprefixer({
browsers: options.browsers,
cascade: false
}));
// if not in debug mode, minify
if (!isDebug)
{
innerPipe = innerPipe.pipe(cssMin({
processImport: false
}));
}
// write auto prefixer
return innerPipe
.pipe(gulp.dest(outputPath));
} | [
"function",
"compileSingleFile",
"(",
"filePath",
",",
"isDebug",
",",
"options",
")",
"{",
"var",
"outputPath",
"=",
"\"./\"",
"+",
"path",
".",
"dirname",
"(",
"filePath",
")",
".",
"replace",
"(",
"\"assets/scss\"",
",",
"\"public/css\"",
")",
";",
"gulpUtil",
".",
"log",
"(",
"gulpUtil",
".",
"colors",
".",
"blue",
"(",
"\"Sass\"",
")",
",",
"pathHelper",
".",
"makeRelative",
"(",
"filePath",
")",
",",
"\" -> \"",
",",
"outputPath",
"+",
"\"/\"",
"+",
"path",
".",
"basename",
"(",
"filePath",
")",
".",
"replace",
"(",
"/",
"\\.scss$",
"/",
",",
"\".css\"",
")",
")",
";",
"var",
"innerPipe",
"=",
"gulp",
".",
"src",
"(",
"filePath",
")",
".",
"pipe",
"(",
"plumber",
"(",
")",
")",
";",
"if",
"(",
"isDebug",
")",
"{",
"innerPipe",
"=",
"innerPipe",
".",
"pipe",
"(",
"watch",
"(",
"filePath",
")",
")",
";",
"}",
"innerPipe",
"=",
"innerPipe",
".",
"pipe",
"(",
"sass",
"(",
"{",
"errLogToConsole",
":",
"true",
",",
"includePaths",
":",
"[",
"process",
".",
"env",
".",
"PWD",
"]",
"}",
")",
")",
".",
"pipe",
"(",
"autoprefixer",
"(",
"{",
"browsers",
":",
"options",
".",
"browsers",
",",
"cascade",
":",
"false",
"}",
")",
")",
";",
"// if not in debug mode, minify",
"if",
"(",
"!",
"isDebug",
")",
"{",
"innerPipe",
"=",
"innerPipe",
".",
"pipe",
"(",
"cssMin",
"(",
"{",
"processImport",
":",
"false",
"}",
")",
")",
";",
"}",
"// write auto prefixer",
"return",
"innerPipe",
".",
"pipe",
"(",
"gulp",
".",
"dest",
"(",
"outputPath",
")",
")",
";",
"}"
] | Compiles a single Sass file
@param {string} filePath
@param {boolean} isDebug
@param {SassTaskOptions} options
@returns {*} | [
"Compiles",
"a",
"single",
"Sass",
"file"
] | 1c633378d561f07101f9db19ccd153617b8e0252 | https://github.com/Becklyn/becklyn-gulp/blob/1c633378d561f07101f9db19ccd153617b8e0252/tasks/scss.js#L87-L124 |
51,354 | Becklyn/becklyn-gulp | tasks/scss.js | lintFiles | function lintFiles (src)
{
gulp.src(src)
.pipe(scssLint({
config: __dirname + "/../config/scss-lint.yml",
customReport: issueCountReporter
}))
.on('error', function (error)
{
gulpUtil.log(gulpUtil.colors.red('An error has occurred while executing scss-lint: ' + error.message));
})
.on('end', reportTotalIssueCount);
} | javascript | function lintFiles (src)
{
gulp.src(src)
.pipe(scssLint({
config: __dirname + "/../config/scss-lint.yml",
customReport: issueCountReporter
}))
.on('error', function (error)
{
gulpUtil.log(gulpUtil.colors.red('An error has occurred while executing scss-lint: ' + error.message));
})
.on('end', reportTotalIssueCount);
} | [
"function",
"lintFiles",
"(",
"src",
")",
"{",
"gulp",
".",
"src",
"(",
"src",
")",
".",
"pipe",
"(",
"scssLint",
"(",
"{",
"config",
":",
"__dirname",
"+",
"\"/../config/scss-lint.yml\"",
",",
"customReport",
":",
"issueCountReporter",
"}",
")",
")",
".",
"on",
"(",
"'error'",
",",
"function",
"(",
"error",
")",
"{",
"gulpUtil",
".",
"log",
"(",
"gulpUtil",
".",
"colors",
".",
"red",
"(",
"'An error has occurred while executing scss-lint: '",
"+",
"error",
".",
"message",
")",
")",
";",
"}",
")",
".",
"on",
"(",
"'end'",
",",
"reportTotalIssueCount",
")",
";",
"}"
] | Lints the given files
@param {string} src | [
"Lints",
"the",
"given",
"files"
] | 1c633378d561f07101f9db19ccd153617b8e0252 | https://github.com/Becklyn/becklyn-gulp/blob/1c633378d561f07101f9db19ccd153617b8e0252/tasks/scss.js#L133-L145 |
51,355 | Becklyn/becklyn-gulp | tasks/scss.js | startWatcherForLinting | function startWatcherForLinting (src)
{
watch(src,
function (file)
{
if (file.path)
{
lintFiles(file.path);
}
}
);
} | javascript | function startWatcherForLinting (src)
{
watch(src,
function (file)
{
if (file.path)
{
lintFiles(file.path);
}
}
);
} | [
"function",
"startWatcherForLinting",
"(",
"src",
")",
"{",
"watch",
"(",
"src",
",",
"function",
"(",
"file",
")",
"{",
"if",
"(",
"file",
".",
"path",
")",
"{",
"lintFiles",
"(",
"file",
".",
"path",
")",
";",
"}",
"}",
")",
";",
"}"
] | Starts a watcher that lints the changed files
@param {string} src | [
"Starts",
"a",
"watcher",
"that",
"lints",
"the",
"changed",
"files"
] | 1c633378d561f07101f9db19ccd153617b8e0252 | https://github.com/Becklyn/becklyn-gulp/blob/1c633378d561f07101f9db19ccd153617b8e0252/tasks/scss.js#L153-L164 |
51,356 | Becklyn/becklyn-gulp | tasks/scss.js | compileAllFiles | function compileAllFiles (src, isDebug, options)
{
glob(src,
function (err, files)
{
if (err) throw err;
for (var i = 0, l = files.length; i < l; i++)
{
// only start compilation at root files
if (sassHelpers.isRootFile(files[i]))
{
compileSingleFile(files[i], isDebug, options);
}
}
}
);
} | javascript | function compileAllFiles (src, isDebug, options)
{
glob(src,
function (err, files)
{
if (err) throw err;
for (var i = 0, l = files.length; i < l; i++)
{
// only start compilation at root files
if (sassHelpers.isRootFile(files[i]))
{
compileSingleFile(files[i], isDebug, options);
}
}
}
);
} | [
"function",
"compileAllFiles",
"(",
"src",
",",
"isDebug",
",",
"options",
")",
"{",
"glob",
"(",
"src",
",",
"function",
"(",
"err",
",",
"files",
")",
"{",
"if",
"(",
"err",
")",
"throw",
"err",
";",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"l",
"=",
"files",
".",
"length",
";",
"i",
"<",
"l",
";",
"i",
"++",
")",
"{",
"// only start compilation at root files",
"if",
"(",
"sassHelpers",
".",
"isRootFile",
"(",
"files",
"[",
"i",
"]",
")",
")",
"{",
"compileSingleFile",
"(",
"files",
"[",
"i",
"]",
",",
"isDebug",
",",
"options",
")",
";",
"}",
"}",
"}",
")",
";",
"}"
] | Compiles all files in the given selector
@param {string} src all what is accepted by glob
@param {bool} isDebug
@param {SassTaskOptions} options | [
"Compiles",
"all",
"files",
"in",
"the",
"given",
"selector"
] | 1c633378d561f07101f9db19ccd153617b8e0252 | https://github.com/Becklyn/becklyn-gulp/blob/1c633378d561f07101f9db19ccd153617b8e0252/tasks/scss.js#L175-L192 |
51,357 | novadiscovery/nway | lib/parser.js | makeModule | function makeModule(index) {
var stored, src, srcPath, relpath;
// Prepare module
var module = new Module({
uid: index
,req: []
,path: index
,relpath: null
,isNodeModule: false
,isAsyncModule: arequirePath === index
,arequirePath: arequirePath
,index: index
});
if(~module.path.indexOf('/node_modules/')) module.isNodeModule = true;
relpath = path.relative(process.cwd(), module.path);
relpath = !/^\./.test(relpath) ? './' + relpath : relpath;
module.relpath = relpath;
debug('makeModule for %s', relpath);
// Check for stored version of this path
stored = _.find(modules, function(p) {
return module.path === p.path;
});
if(stored) {
debug('allready stored : return (absolute path match)');
return stored;
}
// Read source
src = fs.readFileSync(module.path, 'utf8');
module.mtime = fs.statSync(module.path).mtime;
module.uid = getUID({src: src, path:module.path, options: options});
// Check for stored version with same uid
stored = _.find(modules, function(p) {
return module.uid === p.uid;
});
if(stored) {
debug('allready stored : return (md5 hash match)');
return stored;
}
// Save module
modules.push(module);
// Do not parse ?
module.notparsed = _.find(noparse, function(np) {
if(np instanceof RegExp) {
return np.test(module.path);
} else if ('string' == typeof np) {
return minimatch(module.path, np);
} else if ('function' == typeof np) {
return np(module.path, module);
} else {
return false;
}
});
// Parse
if(module.notparsed) {
debug(' no parse');
} else {
debug(' run parse');
src = parse(src, module, makeModule, options);
}
// Store the module source :
module.source = src;
// Return the module object
debug('end %s', relpath);
return module;
} | javascript | function makeModule(index) {
var stored, src, srcPath, relpath;
// Prepare module
var module = new Module({
uid: index
,req: []
,path: index
,relpath: null
,isNodeModule: false
,isAsyncModule: arequirePath === index
,arequirePath: arequirePath
,index: index
});
if(~module.path.indexOf('/node_modules/')) module.isNodeModule = true;
relpath = path.relative(process.cwd(), module.path);
relpath = !/^\./.test(relpath) ? './' + relpath : relpath;
module.relpath = relpath;
debug('makeModule for %s', relpath);
// Check for stored version of this path
stored = _.find(modules, function(p) {
return module.path === p.path;
});
if(stored) {
debug('allready stored : return (absolute path match)');
return stored;
}
// Read source
src = fs.readFileSync(module.path, 'utf8');
module.mtime = fs.statSync(module.path).mtime;
module.uid = getUID({src: src, path:module.path, options: options});
// Check for stored version with same uid
stored = _.find(modules, function(p) {
return module.uid === p.uid;
});
if(stored) {
debug('allready stored : return (md5 hash match)');
return stored;
}
// Save module
modules.push(module);
// Do not parse ?
module.notparsed = _.find(noparse, function(np) {
if(np instanceof RegExp) {
return np.test(module.path);
} else if ('string' == typeof np) {
return minimatch(module.path, np);
} else if ('function' == typeof np) {
return np(module.path, module);
} else {
return false;
}
});
// Parse
if(module.notparsed) {
debug(' no parse');
} else {
debug(' run parse');
src = parse(src, module, makeModule, options);
}
// Store the module source :
module.source = src;
// Return the module object
debug('end %s', relpath);
return module;
} | [
"function",
"makeModule",
"(",
"index",
")",
"{",
"var",
"stored",
",",
"src",
",",
"srcPath",
",",
"relpath",
";",
"// Prepare module",
"var",
"module",
"=",
"new",
"Module",
"(",
"{",
"uid",
":",
"index",
",",
"req",
":",
"[",
"]",
",",
"path",
":",
"index",
",",
"relpath",
":",
"null",
",",
"isNodeModule",
":",
"false",
",",
"isAsyncModule",
":",
"arequirePath",
"===",
"index",
",",
"arequirePath",
":",
"arequirePath",
",",
"index",
":",
"index",
"}",
")",
";",
"if",
"(",
"~",
"module",
".",
"path",
".",
"indexOf",
"(",
"'/node_modules/'",
")",
")",
"module",
".",
"isNodeModule",
"=",
"true",
";",
"relpath",
"=",
"path",
".",
"relative",
"(",
"process",
".",
"cwd",
"(",
")",
",",
"module",
".",
"path",
")",
";",
"relpath",
"=",
"!",
"/",
"^\\.",
"/",
".",
"test",
"(",
"relpath",
")",
"?",
"'./'",
"+",
"relpath",
":",
"relpath",
";",
"module",
".",
"relpath",
"=",
"relpath",
";",
"debug",
"(",
"'makeModule for %s'",
",",
"relpath",
")",
";",
"// Check for stored version of this path",
"stored",
"=",
"_",
".",
"find",
"(",
"modules",
",",
"function",
"(",
"p",
")",
"{",
"return",
"module",
".",
"path",
"===",
"p",
".",
"path",
";",
"}",
")",
";",
"if",
"(",
"stored",
")",
"{",
"debug",
"(",
"'allready stored : return (absolute path match)'",
")",
";",
"return",
"stored",
";",
"}",
"// Read source",
"src",
"=",
"fs",
".",
"readFileSync",
"(",
"module",
".",
"path",
",",
"'utf8'",
")",
";",
"module",
".",
"mtime",
"=",
"fs",
".",
"statSync",
"(",
"module",
".",
"path",
")",
".",
"mtime",
";",
"module",
".",
"uid",
"=",
"getUID",
"(",
"{",
"src",
":",
"src",
",",
"path",
":",
"module",
".",
"path",
",",
"options",
":",
"options",
"}",
")",
";",
"// Check for stored version with same uid",
"stored",
"=",
"_",
".",
"find",
"(",
"modules",
",",
"function",
"(",
"p",
")",
"{",
"return",
"module",
".",
"uid",
"===",
"p",
".",
"uid",
";",
"}",
")",
";",
"if",
"(",
"stored",
")",
"{",
"debug",
"(",
"'allready stored : return (md5 hash match)'",
")",
";",
"return",
"stored",
";",
"}",
"// Save module",
"modules",
".",
"push",
"(",
"module",
")",
";",
"// Do not parse ?",
"module",
".",
"notparsed",
"=",
"_",
".",
"find",
"(",
"noparse",
",",
"function",
"(",
"np",
")",
"{",
"if",
"(",
"np",
"instanceof",
"RegExp",
")",
"{",
"return",
"np",
".",
"test",
"(",
"module",
".",
"path",
")",
";",
"}",
"else",
"if",
"(",
"'string'",
"==",
"typeof",
"np",
")",
"{",
"return",
"minimatch",
"(",
"module",
".",
"path",
",",
"np",
")",
";",
"}",
"else",
"if",
"(",
"'function'",
"==",
"typeof",
"np",
")",
"{",
"return",
"np",
"(",
"module",
".",
"path",
",",
"module",
")",
";",
"}",
"else",
"{",
"return",
"false",
";",
"}",
"}",
")",
";",
"// Parse",
"if",
"(",
"module",
".",
"notparsed",
")",
"{",
"debug",
"(",
"' no parse'",
")",
";",
"}",
"else",
"{",
"debug",
"(",
"' run parse'",
")",
";",
"src",
"=",
"parse",
"(",
"src",
",",
"module",
",",
"makeModule",
",",
"options",
")",
";",
"}",
"// Store the module source :",
"module",
".",
"source",
"=",
"src",
";",
"// Return the module object",
"debug",
"(",
"'end %s'",
",",
"relpath",
")",
";",
"return",
"module",
";",
"}"
] | Create a module object for the index receives an absolute filepath to parse, and return a new Module object | [
"Create",
"a",
"module",
"object",
"for",
"the",
"index",
"receives",
"an",
"absolute",
"filepath",
"to",
"parse",
"and",
"return",
"a",
"new",
"Module",
"object"
] | fa31c6fe56f2305721e581ac25e8ac9a87e15dda | https://github.com/novadiscovery/nway/blob/fa31c6fe56f2305721e581ac25e8ac9a87e15dda/lib/parser.js#L140-L219 |
51,358 | bucharest-gold/unifiedpush-admin-client | lib/installations.js | update | function update (client) {
return function update (options) {
options = options || {};
const req = {
url: `${client.baseUrl}/rest/applications/${options.variantId}/installations/${options.installation.id}`,
body: options.installation,
method: 'PUT'
};
return request(client, req)
.then((response) => {
if (response.resp.statusCode !== 204) {
return Promise.reject(response.body);
}
return Promise.resolve(response.body);
});
};
} | javascript | function update (client) {
return function update (options) {
options = options || {};
const req = {
url: `${client.baseUrl}/rest/applications/${options.variantId}/installations/${options.installation.id}`,
body: options.installation,
method: 'PUT'
};
return request(client, req)
.then((response) => {
if (response.resp.statusCode !== 204) {
return Promise.reject(response.body);
}
return Promise.resolve(response.body);
});
};
} | [
"function",
"update",
"(",
"client",
")",
"{",
"return",
"function",
"update",
"(",
"options",
")",
"{",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"const",
"req",
"=",
"{",
"url",
":",
"`",
"${",
"client",
".",
"baseUrl",
"}",
"${",
"options",
".",
"variantId",
"}",
"${",
"options",
".",
"installation",
".",
"id",
"}",
"`",
",",
"body",
":",
"options",
".",
"installation",
",",
"method",
":",
"'PUT'",
"}",
";",
"return",
"request",
"(",
"client",
",",
"req",
")",
".",
"then",
"(",
"(",
"response",
")",
"=>",
"{",
"if",
"(",
"response",
".",
"resp",
".",
"statusCode",
"!==",
"204",
")",
"{",
"return",
"Promise",
".",
"reject",
"(",
"response",
".",
"body",
")",
";",
"}",
"return",
"Promise",
".",
"resolve",
"(",
"response",
".",
"body",
")",
";",
"}",
")",
";",
"}",
";",
"}"
] | A function to update an existing installation.
@param {object} options - An options object that is the JSON representation of the Variant to Update
@param {string} options.variantId - The id of the push application
@param {object} options.installation - the installation object
@param {string} options.installation.id - The id of the installation to be updated
@param {string} options.installation.deviceToken - the deviceToken of the installation
@param {string} [options.installation.alias] - string to map the Installation to an actual user.
@param {boolean} [options.installation.enabled] - Flag if the actual client installation is enabled (default) or not.
@param {string} [options.installation.platform] - the name of the platform. FOR ADMIN UI ONLY - Helps with setting up Routes
@param {string} [options.installation.deviceType] - the type of the registered device
@param {string} [options.installation.operatingSystem] - the name of the Operating System.
@param {string} [options.installation.osVersion] - the version string of the mobile OS.
@params {Array} [options.installation.categories] - set of all categories the client is in
@returns {Promise} A promise that resolves with No Content
@example
adminClient(baseUrl, settings)
.then((client) => {
client.installations.update(installationOptions)
.then(() => {
console.log('success')
})
}) | [
"A",
"function",
"to",
"update",
"an",
"existing",
"installation",
"."
] | a39c98c9a383d7f87cb5cbbc25c4371ea1ad049e | https://github.com/bucharest-gold/unifiedpush-admin-client/blob/a39c98c9a383d7f87cb5cbbc25c4371ea1ad049e/lib/installations.js#L73-L91 |
51,359 | Nazariglez/perenquen | lib/pixi/src/core/textures/BaseTexture.js | BaseTexture | function BaseTexture(source, scaleMode, resolution)
{
EventEmitter.call(this);
this.uuid = utils.uuid();
/**
* The Resolution of the texture.
*
* @member {number}
*/
this.resolution = resolution || 1;
/**
* The width of the base texture set when the image has loaded
*
* @member {number}
* @readOnly
*/
this.width = 100;
/**
* The height of the base texture set when the image has loaded
*
* @member {number}
* @readOnly
*/
this.height = 100;
// TODO docs
// used to store the actual dimensions of the source
/**
* Used to store the actual width of the source of this texture
*
* @member {number}
* @readOnly
*/
this.realWidth = 100;
/**
* Used to store the actual height of the source of this texture
*
* @member {number}
* @readOnly
*/
this.realHeight = 100;
/**
* The scale mode to apply when scaling this texture
*
* @member {{number}}
* @default scaleModes.LINEAR
*/
this.scaleMode = scaleMode || CONST.SCALE_MODES.DEFAULT;
/**
* Set to true once the base texture has successfully loaded.
*
* This is never true if the underlying source fails to load or has no texture data.
*
* @member {boolean}
* @readOnly
*/
this.hasLoaded = false;
/**
* Set to true if the source is currently loading.
*
* If an Image source is loading the 'loaded' or 'error' event will be
* dispatched when the operation ends. An underyling source that is
* immediately-available bypasses loading entirely.
*
* @member {boolean}
* @readonly
*/
this.isLoading = false;
/**
* The image source that is used to create the texture.
*
* TODO: Make this a setter that calls loadSource();
*
* @member {Image|Canvas}
* @readonly
*/
this.source = null; // set in loadSource, if at all
/**
* Controls if RGB channels should be pre-multiplied by Alpha (WebGL only)
*
* @member {boolean}
* @default true
*/
this.premultipliedAlpha = true;
/**
* @member {string}
*/
this.imageUrl = null;
/**
* Wether or not the texture is a power of two, try to use power of two textures as much as you can
* @member {boolean}
* @private
*/
this.isPowerOfTwo = false;
// used for webGL
/**
*
* Set this to true if a mipmap of this texture needs to be generated. This value needs to be set before the texture is used
* Also the texture must be a power of two size to work
*
* @member {boolean}
*/
this.mipmap = false;
/**
* A map of renderer IDs to webgl textures
*
* @member {object<number, WebGLTexture>}
* @private
*/
this._glTextures = [];
// if no source passed don't try to load
if (source)
{
this.loadSource(source);
}
/**
* Fired when a not-immediately-available source finishes loading.
*
* @event loaded
* @memberof BaseTexture#
* @protected
*/
/**
* Fired when a not-immediately-available source fails to load.
*
* @event error
* @memberof BaseTexture#
* @protected
*/
} | javascript | function BaseTexture(source, scaleMode, resolution)
{
EventEmitter.call(this);
this.uuid = utils.uuid();
/**
* The Resolution of the texture.
*
* @member {number}
*/
this.resolution = resolution || 1;
/**
* The width of the base texture set when the image has loaded
*
* @member {number}
* @readOnly
*/
this.width = 100;
/**
* The height of the base texture set when the image has loaded
*
* @member {number}
* @readOnly
*/
this.height = 100;
// TODO docs
// used to store the actual dimensions of the source
/**
* Used to store the actual width of the source of this texture
*
* @member {number}
* @readOnly
*/
this.realWidth = 100;
/**
* Used to store the actual height of the source of this texture
*
* @member {number}
* @readOnly
*/
this.realHeight = 100;
/**
* The scale mode to apply when scaling this texture
*
* @member {{number}}
* @default scaleModes.LINEAR
*/
this.scaleMode = scaleMode || CONST.SCALE_MODES.DEFAULT;
/**
* Set to true once the base texture has successfully loaded.
*
* This is never true if the underlying source fails to load or has no texture data.
*
* @member {boolean}
* @readOnly
*/
this.hasLoaded = false;
/**
* Set to true if the source is currently loading.
*
* If an Image source is loading the 'loaded' or 'error' event will be
* dispatched when the operation ends. An underyling source that is
* immediately-available bypasses loading entirely.
*
* @member {boolean}
* @readonly
*/
this.isLoading = false;
/**
* The image source that is used to create the texture.
*
* TODO: Make this a setter that calls loadSource();
*
* @member {Image|Canvas}
* @readonly
*/
this.source = null; // set in loadSource, if at all
/**
* Controls if RGB channels should be pre-multiplied by Alpha (WebGL only)
*
* @member {boolean}
* @default true
*/
this.premultipliedAlpha = true;
/**
* @member {string}
*/
this.imageUrl = null;
/**
* Wether or not the texture is a power of two, try to use power of two textures as much as you can
* @member {boolean}
* @private
*/
this.isPowerOfTwo = false;
// used for webGL
/**
*
* Set this to true if a mipmap of this texture needs to be generated. This value needs to be set before the texture is used
* Also the texture must be a power of two size to work
*
* @member {boolean}
*/
this.mipmap = false;
/**
* A map of renderer IDs to webgl textures
*
* @member {object<number, WebGLTexture>}
* @private
*/
this._glTextures = [];
// if no source passed don't try to load
if (source)
{
this.loadSource(source);
}
/**
* Fired when a not-immediately-available source finishes loading.
*
* @event loaded
* @memberof BaseTexture#
* @protected
*/
/**
* Fired when a not-immediately-available source fails to load.
*
* @event error
* @memberof BaseTexture#
* @protected
*/
} | [
"function",
"BaseTexture",
"(",
"source",
",",
"scaleMode",
",",
"resolution",
")",
"{",
"EventEmitter",
".",
"call",
"(",
"this",
")",
";",
"this",
".",
"uuid",
"=",
"utils",
".",
"uuid",
"(",
")",
";",
"/**\n * The Resolution of the texture.\n *\n * @member {number}\n */",
"this",
".",
"resolution",
"=",
"resolution",
"||",
"1",
";",
"/**\n * The width of the base texture set when the image has loaded\n *\n * @member {number}\n * @readOnly\n */",
"this",
".",
"width",
"=",
"100",
";",
"/**\n * The height of the base texture set when the image has loaded\n *\n * @member {number}\n * @readOnly\n */",
"this",
".",
"height",
"=",
"100",
";",
"// TODO docs",
"// used to store the actual dimensions of the source",
"/**\n * Used to store the actual width of the source of this texture\n *\n * @member {number}\n * @readOnly\n */",
"this",
".",
"realWidth",
"=",
"100",
";",
"/**\n * Used to store the actual height of the source of this texture\n *\n * @member {number}\n * @readOnly\n */",
"this",
".",
"realHeight",
"=",
"100",
";",
"/**\n * The scale mode to apply when scaling this texture\n *\n * @member {{number}}\n * @default scaleModes.LINEAR\n */",
"this",
".",
"scaleMode",
"=",
"scaleMode",
"||",
"CONST",
".",
"SCALE_MODES",
".",
"DEFAULT",
";",
"/**\n * Set to true once the base texture has successfully loaded.\n *\n * This is never true if the underlying source fails to load or has no texture data.\n *\n * @member {boolean}\n * @readOnly\n */",
"this",
".",
"hasLoaded",
"=",
"false",
";",
"/**\n * Set to true if the source is currently loading.\n *\n * If an Image source is loading the 'loaded' or 'error' event will be\n * dispatched when the operation ends. An underyling source that is\n * immediately-available bypasses loading entirely.\n *\n * @member {boolean}\n * @readonly\n */",
"this",
".",
"isLoading",
"=",
"false",
";",
"/**\n * The image source that is used to create the texture.\n *\n * TODO: Make this a setter that calls loadSource();\n *\n * @member {Image|Canvas}\n * @readonly\n */",
"this",
".",
"source",
"=",
"null",
";",
"// set in loadSource, if at all",
"/**\n * Controls if RGB channels should be pre-multiplied by Alpha (WebGL only)\n *\n * @member {boolean}\n * @default true\n */",
"this",
".",
"premultipliedAlpha",
"=",
"true",
";",
"/**\n * @member {string}\n */",
"this",
".",
"imageUrl",
"=",
"null",
";",
"/**\n * Wether or not the texture is a power of two, try to use power of two textures as much as you can\n * @member {boolean}\n * @private\n */",
"this",
".",
"isPowerOfTwo",
"=",
"false",
";",
"// used for webGL",
"/**\n *\n * Set this to true if a mipmap of this texture needs to be generated. This value needs to be set before the texture is used\n * Also the texture must be a power of two size to work\n *\n * @member {boolean}\n */",
"this",
".",
"mipmap",
"=",
"false",
";",
"/**\n * A map of renderer IDs to webgl textures\n *\n * @member {object<number, WebGLTexture>}\n * @private\n */",
"this",
".",
"_glTextures",
"=",
"[",
"]",
";",
"// if no source passed don't try to load",
"if",
"(",
"source",
")",
"{",
"this",
".",
"loadSource",
"(",
"source",
")",
";",
"}",
"/**\n * Fired when a not-immediately-available source finishes loading.\n *\n * @event loaded\n * @memberof BaseTexture#\n * @protected\n */",
"/**\n * Fired when a not-immediately-available source fails to load.\n *\n * @event error\n * @memberof BaseTexture#\n * @protected\n */",
"}"
] | A texture stores the information that represents an image. All textures have a base texture.
@class
@memberof PIXI
@param source {Image|Canvas} the source object of the texture.
@param [scaleMode=scaleModes.DEFAULT] {number} See {@link SCALE_MODES} for possible values
@param resolution {number} the resolution of the texture for devices with different pixel ratios | [
"A",
"texture",
"stores",
"the",
"information",
"that",
"represents",
"an",
"image",
".",
"All",
"textures",
"have",
"a",
"base",
"texture",
"."
] | e023964d05afeefebdcac4e2044819fdfa3899ae | https://github.com/Nazariglez/perenquen/blob/e023964d05afeefebdcac4e2044819fdfa3899ae/lib/pixi/src/core/textures/BaseTexture.js#L14-L160 |
51,360 | epeios-q37/xdhelcq | js/Sortable/Sortable.js | function () {
var order = [],
el,
children = this.el.children,
i = 0,
n = children.length,
options = this.options;
for (; i < n; i++) {
el = children[i];
if (_closest(el, options.draggable, this.el)) {
order.push(el.getAttribute(options.dataIdAttr) || _generateId(el));
}
}
return order;
} | javascript | function () {
var order = [],
el,
children = this.el.children,
i = 0,
n = children.length,
options = this.options;
for (; i < n; i++) {
el = children[i];
if (_closest(el, options.draggable, this.el)) {
order.push(el.getAttribute(options.dataIdAttr) || _generateId(el));
}
}
return order;
} | [
"function",
"(",
")",
"{",
"var",
"order",
"=",
"[",
"]",
",",
"el",
",",
"children",
"=",
"this",
".",
"el",
".",
"children",
",",
"i",
"=",
"0",
",",
"n",
"=",
"children",
".",
"length",
",",
"options",
"=",
"this",
".",
"options",
";",
"for",
"(",
";",
"i",
"<",
"n",
";",
"i",
"++",
")",
"{",
"el",
"=",
"children",
"[",
"i",
"]",
";",
"if",
"(",
"_closest",
"(",
"el",
",",
"options",
".",
"draggable",
",",
"this",
".",
"el",
")",
")",
"{",
"order",
".",
"push",
"(",
"el",
".",
"getAttribute",
"(",
"options",
".",
"dataIdAttr",
")",
"||",
"_generateId",
"(",
"el",
")",
")",
";",
"}",
"}",
"return",
"order",
";",
"}"
] | Serializes the item into an array of string.
@returns {String[]} | [
"Serializes",
"the",
"item",
"into",
"an",
"array",
"of",
"string",
"."
] | 8cffac0650297c313779c9fba545096be24e52a5 | https://github.com/epeios-q37/xdhelcq/blob/8cffac0650297c313779c9fba545096be24e52a5/js/Sortable/Sortable.js#L757-L773 |
|
51,361 | epeios-q37/xdhelcq | js/Sortable/Sortable.js | function (order) {
var items = {}, rootEl = this.el;
this.toArray().forEach(function (id, i) {
var el = rootEl.children[i];
if (_closest(el, this.options.draggable, rootEl)) {
items[id] = el;
}
}, this);
order.forEach(function (id) {
if (items[id]) {
rootEl.removeChild(items[id]);
rootEl.appendChild(items[id]);
}
});
} | javascript | function (order) {
var items = {}, rootEl = this.el;
this.toArray().forEach(function (id, i) {
var el = rootEl.children[i];
if (_closest(el, this.options.draggable, rootEl)) {
items[id] = el;
}
}, this);
order.forEach(function (id) {
if (items[id]) {
rootEl.removeChild(items[id]);
rootEl.appendChild(items[id]);
}
});
} | [
"function",
"(",
"order",
")",
"{",
"var",
"items",
"=",
"{",
"}",
",",
"rootEl",
"=",
"this",
".",
"el",
";",
"this",
".",
"toArray",
"(",
")",
".",
"forEach",
"(",
"function",
"(",
"id",
",",
"i",
")",
"{",
"var",
"el",
"=",
"rootEl",
".",
"children",
"[",
"i",
"]",
";",
"if",
"(",
"_closest",
"(",
"el",
",",
"this",
".",
"options",
".",
"draggable",
",",
"rootEl",
")",
")",
"{",
"items",
"[",
"id",
"]",
"=",
"el",
";",
"}",
"}",
",",
"this",
")",
";",
"order",
".",
"forEach",
"(",
"function",
"(",
"id",
")",
"{",
"if",
"(",
"items",
"[",
"id",
"]",
")",
"{",
"rootEl",
".",
"removeChild",
"(",
"items",
"[",
"id",
"]",
")",
";",
"rootEl",
".",
"appendChild",
"(",
"items",
"[",
"id",
"]",
")",
";",
"}",
"}",
")",
";",
"}"
] | Sorts the elements according to the array.
@param {String[]} order order of the items | [
"Sorts",
"the",
"elements",
"according",
"to",
"the",
"array",
"."
] | 8cffac0650297c313779c9fba545096be24e52a5 | https://github.com/epeios-q37/xdhelcq/blob/8cffac0650297c313779c9fba545096be24e52a5/js/Sortable/Sortable.js#L780-L797 |
|
51,362 | epeios-q37/xdhelcq | js/Sortable/Sortable.js | _index | function _index(/**HTMLElement*/el) {
var index = 0;
while (el && (el = el.previousElementSibling)) {
if (el.nodeName.toUpperCase() !== 'TEMPLATE') {
index++;
}
}
return index;
} | javascript | function _index(/**HTMLElement*/el) {
var index = 0;
while (el && (el = el.previousElementSibling)) {
if (el.nodeName.toUpperCase() !== 'TEMPLATE') {
index++;
}
}
return index;
} | [
"function",
"_index",
"(",
"/**HTMLElement*/",
"el",
")",
"{",
"var",
"index",
"=",
"0",
";",
"while",
"(",
"el",
"&&",
"(",
"el",
"=",
"el",
".",
"previousElementSibling",
")",
")",
"{",
"if",
"(",
"el",
".",
"nodeName",
".",
"toUpperCase",
"(",
")",
"!==",
"'TEMPLATE'",
")",
"{",
"index",
"++",
";",
"}",
"}",
"return",
"index",
";",
"}"
] | Returns the index of an element within its parent
@param el
@returns {number}
@private | [
"Returns",
"the",
"index",
"of",
"an",
"element",
"within",
"its",
"parent"
] | 8cffac0650297c313779c9fba545096be24e52a5 | https://github.com/epeios-q37/xdhelcq/blob/8cffac0650297c313779c9fba545096be24e52a5/js/Sortable/Sortable.js#L1069-L1077 |
51,363 | aureooms/js-grammar | lib/util/setaddall.js | setaddall | function setaddall(set, iterable) {
var changed = false;
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;
try {
for (var _iterator = iterable[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
var element = _step.value;
changed |= (0, _setadd.default)(set, element);
}
} catch (err) {
_didIteratorError = true;
_iteratorError = err;
} finally {
try {
if (!_iteratorNormalCompletion && _iterator.return != null) {
_iterator.return();
}
} finally {
if (_didIteratorError) {
throw _iteratorError;
}
}
}
return changed;
} | javascript | function setaddall(set, iterable) {
var changed = false;
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;
try {
for (var _iterator = iterable[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
var element = _step.value;
changed |= (0, _setadd.default)(set, element);
}
} catch (err) {
_didIteratorError = true;
_iteratorError = err;
} finally {
try {
if (!_iteratorNormalCompletion && _iterator.return != null) {
_iterator.return();
}
} finally {
if (_didIteratorError) {
throw _iteratorError;
}
}
}
return changed;
} | [
"function",
"setaddall",
"(",
"set",
",",
"iterable",
")",
"{",
"var",
"changed",
"=",
"false",
";",
"var",
"_iteratorNormalCompletion",
"=",
"true",
";",
"var",
"_didIteratorError",
"=",
"false",
";",
"var",
"_iteratorError",
"=",
"undefined",
";",
"try",
"{",
"for",
"(",
"var",
"_iterator",
"=",
"iterable",
"[",
"Symbol",
".",
"iterator",
"]",
"(",
")",
",",
"_step",
";",
"!",
"(",
"_iteratorNormalCompletion",
"=",
"(",
"_step",
"=",
"_iterator",
".",
"next",
"(",
")",
")",
".",
"done",
")",
";",
"_iteratorNormalCompletion",
"=",
"true",
")",
"{",
"var",
"element",
"=",
"_step",
".",
"value",
";",
"changed",
"|=",
"(",
"0",
",",
"_setadd",
".",
"default",
")",
"(",
"set",
",",
"element",
")",
";",
"}",
"}",
"catch",
"(",
"err",
")",
"{",
"_didIteratorError",
"=",
"true",
";",
"_iteratorError",
"=",
"err",
";",
"}",
"finally",
"{",
"try",
"{",
"if",
"(",
"!",
"_iteratorNormalCompletion",
"&&",
"_iterator",
".",
"return",
"!=",
"null",
")",
"{",
"_iterator",
".",
"return",
"(",
")",
";",
"}",
"}",
"finally",
"{",
"if",
"(",
"_didIteratorError",
")",
"{",
"throw",
"_iteratorError",
";",
"}",
"}",
"}",
"return",
"changed",
";",
"}"
] | Adds all elements of an iterable to a set and returns true if the set has
changed.
@param {Set} set - The set to add to.
@param {Iterable} iterable - The iterable of elements to add to the set.
@returns {Boolean} Whether <code>set</code> has changed. | [
"Adds",
"all",
"elements",
"of",
"an",
"iterable",
"to",
"a",
"set",
"and",
"returns",
"true",
"if",
"the",
"set",
"has",
"changed",
"."
] | 28c4d1a3175327b33766c34539eab317303e26c5 | https://github.com/aureooms/js-grammar/blob/28c4d1a3175327b33766c34539eab317303e26c5/lib/util/setaddall.js#L20-L47 |
51,364 | coderaiser/node-tomas | lib/tomas.js | getName | function getName(name) {
const ext = path.extname(name);
const nameCrypt = crypto.createHash('sha1')
.update(name)
.digest('hex') + ext;
return getDir() + nameCrypt;
} | javascript | function getName(name) {
const ext = path.extname(name);
const nameCrypt = crypto.createHash('sha1')
.update(name)
.digest('hex') + ext;
return getDir() + nameCrypt;
} | [
"function",
"getName",
"(",
"name",
")",
"{",
"const",
"ext",
"=",
"path",
".",
"extname",
"(",
"name",
")",
";",
"const",
"nameCrypt",
"=",
"crypto",
".",
"createHash",
"(",
"'sha1'",
")",
".",
"update",
"(",
"name",
")",
".",
"digest",
"(",
"'hex'",
")",
"+",
"ext",
";",
"return",
"getDir",
"(",
")",
"+",
"nameCrypt",
";",
"}"
] | function get name of file in min folder
@param name | [
"function",
"get",
"name",
"of",
"file",
"in",
"min",
"folder"
] | 62012fcdd432ccea9214969e8ca678baadbe32a0 | https://github.com/coderaiser/node-tomas/blob/62012fcdd432ccea9214969e8ca678baadbe32a0/lib/tomas.js#L91-L99 |
51,365 | agbowlin/liquicode_membership | Membership.js | function(password, salt) {
var hash = npm_crypto.createHmac('sha512', salt); /** Hashing algorithm sha512 */
hash.update(password);
var value = hash.digest('hex');
return {
salt: salt,
passwordHash: value
};
} | javascript | function(password, salt) {
var hash = npm_crypto.createHmac('sha512', salt); /** Hashing algorithm sha512 */
hash.update(password);
var value = hash.digest('hex');
return {
salt: salt,
passwordHash: value
};
} | [
"function",
"(",
"password",
",",
"salt",
")",
"{",
"var",
"hash",
"=",
"npm_crypto",
".",
"createHmac",
"(",
"'sha512'",
",",
"salt",
")",
";",
"/** Hashing algorithm sha512 */",
"hash",
".",
"update",
"(",
"password",
")",
";",
"var",
"value",
"=",
"hash",
".",
"digest",
"(",
"'hex'",
")",
";",
"return",
"{",
"salt",
":",
"salt",
",",
"passwordHash",
":",
"value",
"}",
";",
"}"
] | hash password with sha512.
@function
@param {string} password - List of required fields.
@param {string} salt - Data to be validated. | [
"hash",
"password",
"with",
"sha512",
"."
] | bf680ce8bf07fd17f6f1670d8c10c9e75757edd5 | https://github.com/agbowlin/liquicode_membership/blob/bf680ce8bf07fd17f6f1670d8c10c9e75757edd5/Membership.js#L128-L136 |
|
51,366 | fibo/write-file-utf8 | write-file-utf8.js | writeFileUtf8 | function writeFileUtf8 (filePath, content, callback) {
// Argument callback defaults to throwError.
if (typeof callback !== 'function') callback = throwError
if (typeof content === 'string') {
fs.writeFile(filePath, content, 'utf8', callback)
} else {
throw TypeError(error.contentIsNotString)
}
} | javascript | function writeFileUtf8 (filePath, content, callback) {
// Argument callback defaults to throwError.
if (typeof callback !== 'function') callback = throwError
if (typeof content === 'string') {
fs.writeFile(filePath, content, 'utf8', callback)
} else {
throw TypeError(error.contentIsNotString)
}
} | [
"function",
"writeFileUtf8",
"(",
"filePath",
",",
"content",
",",
"callback",
")",
"{",
"// Argument callback defaults to throwError.",
"if",
"(",
"typeof",
"callback",
"!==",
"'function'",
")",
"callback",
"=",
"throwError",
"if",
"(",
"typeof",
"content",
"===",
"'string'",
")",
"{",
"fs",
".",
"writeFile",
"(",
"filePath",
",",
"content",
",",
"'utf8'",
",",
"callback",
")",
"}",
"else",
"{",
"throw",
"TypeError",
"(",
"error",
".",
"contentIsNotString",
")",
"}",
"}"
] | Write content to file using utf8 encoding
@param {String} filePath
@param {String} content
@param {Function} [callback] | [
"Write",
"content",
"to",
"file",
"using",
"utf8",
"encoding"
] | 2ae2667b0d3942380708412f7f8a6b4d492d191f | https://github.com/fibo/write-file-utf8/blob/2ae2667b0d3942380708412f7f8a6b4d492d191f/write-file-utf8.js#L22-L31 |
51,367 | atd-schubert/node-stream-lib | lib/unit.js | function (stream) {
var self = this;
stream.on('data', function (chunk) {
self.push(chunk);
});
stream.on('end', function () {
self.push(null);
});
this.readableUnit = stream;
return this;
} | javascript | function (stream) {
var self = this;
stream.on('data', function (chunk) {
self.push(chunk);
});
stream.on('end', function () {
self.push(null);
});
this.readableUnit = stream;
return this;
} | [
"function",
"(",
"stream",
")",
"{",
"var",
"self",
"=",
"this",
";",
"stream",
".",
"on",
"(",
"'data'",
",",
"function",
"(",
"chunk",
")",
"{",
"self",
".",
"push",
"(",
"chunk",
")",
";",
"}",
")",
";",
"stream",
".",
"on",
"(",
"'end'",
",",
"function",
"(",
")",
"{",
"self",
".",
"push",
"(",
"null",
")",
";",
"}",
")",
";",
"this",
".",
"readableUnit",
"=",
"stream",
";",
"return",
"this",
";",
"}"
] | Set a readable stream for this unit
@param {stream.Readable|stream.Duplex|stream.Transform} stream - Use this stream as readable stream
@returns {Unit} | [
"Set",
"a",
"readable",
"stream",
"for",
"this",
"unit"
] | 90f27042fae84d2fbdbf9d28149b0673997f151a | https://github.com/atd-schubert/node-stream-lib/blob/90f27042fae84d2fbdbf9d28149b0673997f151a/lib/unit.js#L56-L66 |
|
51,368 | interlockjs/plugins | packages/h2/src/index.js | buildPushManifest | function buildPushManifest (bundles, manifestFilename) {
const manifestableBundles = filter(bundles, bundle => bundle.module);
const bundlesByModuleId = chain(manifestableBundles)
.map(bundle => [ bundle.module.id, bundle ])
.fromPairs()
.value();
const bundleDepGraph = chain(manifestableBundles)
.map(bundle => {
const deepDependencyFilenames = map(bundle.module.deepDependencies,
dependency => bundlesByModuleId[dependency.id].dest
);
return [ bundle.dest, deepDependencyFilenames ];
})
.fromPairs()
.value();
const output = pushManifestPretty ?
JSON.stringify(bundleDepGraph, null, 2) :
JSON.stringify(bundleDepGraph);
return {
raw: output,
dest: manifestFilename
};
} | javascript | function buildPushManifest (bundles, manifestFilename) {
const manifestableBundles = filter(bundles, bundle => bundle.module);
const bundlesByModuleId = chain(manifestableBundles)
.map(bundle => [ bundle.module.id, bundle ])
.fromPairs()
.value();
const bundleDepGraph = chain(manifestableBundles)
.map(bundle => {
const deepDependencyFilenames = map(bundle.module.deepDependencies,
dependency => bundlesByModuleId[dependency.id].dest
);
return [ bundle.dest, deepDependencyFilenames ];
})
.fromPairs()
.value();
const output = pushManifestPretty ?
JSON.stringify(bundleDepGraph, null, 2) :
JSON.stringify(bundleDepGraph);
return {
raw: output,
dest: manifestFilename
};
} | [
"function",
"buildPushManifest",
"(",
"bundles",
",",
"manifestFilename",
")",
"{",
"const",
"manifestableBundles",
"=",
"filter",
"(",
"bundles",
",",
"bundle",
"=>",
"bundle",
".",
"module",
")",
";",
"const",
"bundlesByModuleId",
"=",
"chain",
"(",
"manifestableBundles",
")",
".",
"map",
"(",
"bundle",
"=>",
"[",
"bundle",
".",
"module",
".",
"id",
",",
"bundle",
"]",
")",
".",
"fromPairs",
"(",
")",
".",
"value",
"(",
")",
";",
"const",
"bundleDepGraph",
"=",
"chain",
"(",
"manifestableBundles",
")",
".",
"map",
"(",
"bundle",
"=>",
"{",
"const",
"deepDependencyFilenames",
"=",
"map",
"(",
"bundle",
".",
"module",
".",
"deepDependencies",
",",
"dependency",
"=>",
"bundlesByModuleId",
"[",
"dependency",
".",
"id",
"]",
".",
"dest",
")",
";",
"return",
"[",
"bundle",
".",
"dest",
",",
"deepDependencyFilenames",
"]",
";",
"}",
")",
".",
"fromPairs",
"(",
")",
".",
"value",
"(",
")",
";",
"const",
"output",
"=",
"pushManifestPretty",
"?",
"JSON",
".",
"stringify",
"(",
"bundleDepGraph",
",",
"null",
",",
"2",
")",
":",
"JSON",
".",
"stringify",
"(",
"bundleDepGraph",
")",
";",
"return",
"{",
"raw",
":",
"output",
",",
"dest",
":",
"manifestFilename",
"}",
";",
"}"
] | Build a bundle dependency graph, such that when a JS bundle is requested, the server can know what other files will be requested once the bundle loads in the client browser. | [
"Build",
"a",
"bundle",
"dependency",
"graph",
"such",
"that",
"when",
"a",
"JS",
"bundle",
"is",
"requested",
"the",
"server",
"can",
"know",
"what",
"other",
"files",
"will",
"be",
"requested",
"once",
"the",
"bundle",
"loads",
"in",
"the",
"client",
"browser",
"."
] | 05197e4511b64d269260fe3c701ceff864897ab3 | https://github.com/interlockjs/plugins/blob/05197e4511b64d269260fe3c701ceff864897ab3/packages/h2/src/index.js#L97-L123 |
51,369 | ohmlang/eslint-plugin-camelcase-ohm | lib/camelcase-ohm.js | checkCamelCase | function checkCamelCase(idNode) {
var reported = false;
var fakeContext = {
report: function() { reported = true; },
options: []
};
camelcase(fakeContext).Identifier(idNode); // eslint-disable-line new-cap
return !reported;
} | javascript | function checkCamelCase(idNode) {
var reported = false;
var fakeContext = {
report: function() { reported = true; },
options: []
};
camelcase(fakeContext).Identifier(idNode); // eslint-disable-line new-cap
return !reported;
} | [
"function",
"checkCamelCase",
"(",
"idNode",
")",
"{",
"var",
"reported",
"=",
"false",
";",
"var",
"fakeContext",
"=",
"{",
"report",
":",
"function",
"(",
")",
"{",
"reported",
"=",
"true",
";",
"}",
",",
"options",
":",
"[",
"]",
"}",
";",
"camelcase",
"(",
"fakeContext",
")",
".",
"Identifier",
"(",
"idNode",
")",
";",
"// eslint-disable-line new-cap",
"return",
"!",
"reported",
";",
"}"
] | Checks whether the given node is considered an error by the camelcase rule. | [
"Checks",
"whether",
"the",
"given",
"node",
"is",
"considered",
"an",
"error",
"by",
"the",
"camelcase",
"rule",
"."
] | 21cdfa68b973eac43d68852ffbc3cb7cf688296f | https://github.com/ohmlang/eslint-plugin-camelcase-ohm/blob/21cdfa68b973eac43d68852ffbc3cb7cf688296f/lib/camelcase-ohm.js#L6-L14 |
51,370 | ohmlang/eslint-plugin-camelcase-ohm | lib/camelcase-ohm.js | checkSemanticActionName | function checkSemanticActionName(node) {
var name = node.name;
var underscoreIdx = name.indexOf('_');
// The underscore should not appear on the ends,
// case names should begin with a lowercase letter,
// and there should be only one underscore in the name.
if ((underscoreIdx > 0 && underscoreIdx < (name.length - 1)) &&
name[underscoreIdx + 1] === name[underscoreIdx + 1].toLowerCase() &&
name.indexOf('_', underscoreIdx + 1) === -1) {
return true;
}
return false;
} | javascript | function checkSemanticActionName(node) {
var name = node.name;
var underscoreIdx = name.indexOf('_');
// The underscore should not appear on the ends,
// case names should begin with a lowercase letter,
// and there should be only one underscore in the name.
if ((underscoreIdx > 0 && underscoreIdx < (name.length - 1)) &&
name[underscoreIdx + 1] === name[underscoreIdx + 1].toLowerCase() &&
name.indexOf('_', underscoreIdx + 1) === -1) {
return true;
}
return false;
} | [
"function",
"checkSemanticActionName",
"(",
"node",
")",
"{",
"var",
"name",
"=",
"node",
".",
"name",
";",
"var",
"underscoreIdx",
"=",
"name",
".",
"indexOf",
"(",
"'_'",
")",
";",
"// The underscore should not appear on the ends,",
"// case names should begin with a lowercase letter,",
"// and there should be only one underscore in the name.",
"if",
"(",
"(",
"underscoreIdx",
">",
"0",
"&&",
"underscoreIdx",
"<",
"(",
"name",
".",
"length",
"-",
"1",
")",
")",
"&&",
"name",
"[",
"underscoreIdx",
"+",
"1",
"]",
"===",
"name",
"[",
"underscoreIdx",
"+",
"1",
"]",
".",
"toLowerCase",
"(",
")",
"&&",
"name",
".",
"indexOf",
"(",
"'_'",
",",
"underscoreIdx",
"+",
"1",
")",
"===",
"-",
"1",
")",
"{",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}"
] | Returns true if `name` appears to be the name of a semantic action. The idiomatic style in Ohm is `RuleName_caseName`. | [
"Returns",
"true",
"if",
"name",
"appears",
"to",
"be",
"the",
"name",
"of",
"a",
"semantic",
"action",
".",
"The",
"idiomatic",
"style",
"in",
"Ohm",
"is",
"RuleName_caseName",
"."
] | 21cdfa68b973eac43d68852ffbc3cb7cf688296f | https://github.com/ohmlang/eslint-plugin-camelcase-ohm/blob/21cdfa68b973eac43d68852ffbc3cb7cf688296f/lib/camelcase-ohm.js#L23-L36 |
51,371 | andrewscwei/requiem | src/dom/setAttribute.js | setAttribute | function setAttribute(element, name, value) {
assertType(element, Node, false, 'Invalid element specified');
if (value === undefined || value === null || value === false)
element.removeAttribute(name);
else if (value === true)
element.setAttribute(name, '');
else
element.setAttribute(name, value);
if (name === 'disabled' && element.setDirty)
element.setDirty(DirtyType.STATE);
} | javascript | function setAttribute(element, name, value) {
assertType(element, Node, false, 'Invalid element specified');
if (value === undefined || value === null || value === false)
element.removeAttribute(name);
else if (value === true)
element.setAttribute(name, '');
else
element.setAttribute(name, value);
if (name === 'disabled' && element.setDirty)
element.setDirty(DirtyType.STATE);
} | [
"function",
"setAttribute",
"(",
"element",
",",
"name",
",",
"value",
")",
"{",
"assertType",
"(",
"element",
",",
"Node",
",",
"false",
",",
"'Invalid element specified'",
")",
";",
"if",
"(",
"value",
"===",
"undefined",
"||",
"value",
"===",
"null",
"||",
"value",
"===",
"false",
")",
"element",
".",
"removeAttribute",
"(",
"name",
")",
";",
"else",
"if",
"(",
"value",
"===",
"true",
")",
"element",
".",
"setAttribute",
"(",
"name",
",",
"''",
")",
";",
"else",
"element",
".",
"setAttribute",
"(",
"name",
",",
"value",
")",
";",
"if",
"(",
"name",
"===",
"'disabled'",
"&&",
"element",
".",
"setDirty",
")",
"element",
".",
"setDirty",
"(",
"DirtyType",
".",
"STATE",
")",
";",
"}"
] | Sets an attribute of an element by the attribute name.
@param {Node} element - Target element.
@param {string} name - Attribute name.
@param {*} value - Attribute value.
@alias module:requiem~dom.setAttribute | [
"Sets",
"an",
"attribute",
"of",
"an",
"element",
"by",
"the",
"attribute",
"name",
"."
] | c4182bfffc9841c6de5718f689ad3c2060511777 | https://github.com/andrewscwei/requiem/blob/c4182bfffc9841c6de5718f689ad3c2060511777/src/dom/setAttribute.js#L17-L27 |
51,372 | Nazariglez/perenquen | lib/pixi/src/core/display/DisplayObject.js | DisplayObject | function DisplayObject()
{
EventEmitter.call(this);
/**
* The coordinate of the object relative to the local coordinates of the parent.
*
* @member {Point}
*/
this.position = new math.Point();
/**
* The scale factor of the object.
*
* @member {Point}
*/
this.scale = new math.Point(1, 1);
/**
* The pivot point of the displayObject that it rotates around
*
* @member {Point}
*/
this.pivot = new math.Point(0, 0);
/**
* The rotation of the object in radians.
*
* @member {number}
*/
this.rotation = 0;
/**
* The opacity of the object.
*
* @member {number}
*/
this.alpha = 1;
/**
* The visibility of the object. If false the object will not be drawn, and
* the updateTransform function will not be called.
*
* @member {boolean}
*/
this.visible = true;
/**
* Can this object be rendered, if false the object will not be drawn but the updateTransform
* methods will still be called.
*
* @member {boolean}
*/
this.renderable = true;
/**
* The display object container that contains this display object.
*
* @member {Container}
* @readOnly
*/
this.parent = null;
/**
* The multiplied alpha of the displayObject
*
* @member {number}
* @readOnly
*/
this.worldAlpha = 1;
/**
* Current transform of the object based on world (parent) factors
*
* @member {Matrix}
* @readOnly
*/
this.worldTransform = new math.Matrix();
/**
* The area the filter is applied to. This is used as more of an optimisation
* rather than figuring out the dimensions of the displayObject each frame you can set this rectangle
*
* @member {Rectangle}
*/
this.filterArea = null;
/**
* cached sin rotation
*
* @member {number}
* @private
*/
this._sr = 0;
/**
* cached cos rotation
*
* @member {number}
* @private
*/
this._cr = 1;
/**
* The original, cached bounds of the object
*
* @member {Rectangle}
* @private
*/
this._bounds = new math.Rectangle(0, 0, 1, 1);
/**
* The most up-to-date bounds of the object
*
* @member {Rectangle}
* @private
*/
this._currentBounds = null;
/**
* The original, cached mask of the object
*
* @member {Rectangle}
* @private
*/
this._mask = null;
//TODO rename to _isMask
// this.isMask = false;
/**
* Cached internal flag.
*
* @member {boolean}
* @private
*/
this._cacheAsBitmap = false;
this._cachedObject = null;
} | javascript | function DisplayObject()
{
EventEmitter.call(this);
/**
* The coordinate of the object relative to the local coordinates of the parent.
*
* @member {Point}
*/
this.position = new math.Point();
/**
* The scale factor of the object.
*
* @member {Point}
*/
this.scale = new math.Point(1, 1);
/**
* The pivot point of the displayObject that it rotates around
*
* @member {Point}
*/
this.pivot = new math.Point(0, 0);
/**
* The rotation of the object in radians.
*
* @member {number}
*/
this.rotation = 0;
/**
* The opacity of the object.
*
* @member {number}
*/
this.alpha = 1;
/**
* The visibility of the object. If false the object will not be drawn, and
* the updateTransform function will not be called.
*
* @member {boolean}
*/
this.visible = true;
/**
* Can this object be rendered, if false the object will not be drawn but the updateTransform
* methods will still be called.
*
* @member {boolean}
*/
this.renderable = true;
/**
* The display object container that contains this display object.
*
* @member {Container}
* @readOnly
*/
this.parent = null;
/**
* The multiplied alpha of the displayObject
*
* @member {number}
* @readOnly
*/
this.worldAlpha = 1;
/**
* Current transform of the object based on world (parent) factors
*
* @member {Matrix}
* @readOnly
*/
this.worldTransform = new math.Matrix();
/**
* The area the filter is applied to. This is used as more of an optimisation
* rather than figuring out the dimensions of the displayObject each frame you can set this rectangle
*
* @member {Rectangle}
*/
this.filterArea = null;
/**
* cached sin rotation
*
* @member {number}
* @private
*/
this._sr = 0;
/**
* cached cos rotation
*
* @member {number}
* @private
*/
this._cr = 1;
/**
* The original, cached bounds of the object
*
* @member {Rectangle}
* @private
*/
this._bounds = new math.Rectangle(0, 0, 1, 1);
/**
* The most up-to-date bounds of the object
*
* @member {Rectangle}
* @private
*/
this._currentBounds = null;
/**
* The original, cached mask of the object
*
* @member {Rectangle}
* @private
*/
this._mask = null;
//TODO rename to _isMask
// this.isMask = false;
/**
* Cached internal flag.
*
* @member {boolean}
* @private
*/
this._cacheAsBitmap = false;
this._cachedObject = null;
} | [
"function",
"DisplayObject",
"(",
")",
"{",
"EventEmitter",
".",
"call",
"(",
"this",
")",
";",
"/**\n * The coordinate of the object relative to the local coordinates of the parent.\n *\n * @member {Point}\n */",
"this",
".",
"position",
"=",
"new",
"math",
".",
"Point",
"(",
")",
";",
"/**\n * The scale factor of the object.\n *\n * @member {Point}\n */",
"this",
".",
"scale",
"=",
"new",
"math",
".",
"Point",
"(",
"1",
",",
"1",
")",
";",
"/**\n * The pivot point of the displayObject that it rotates around\n *\n * @member {Point}\n */",
"this",
".",
"pivot",
"=",
"new",
"math",
".",
"Point",
"(",
"0",
",",
"0",
")",
";",
"/**\n * The rotation of the object in radians.\n *\n * @member {number}\n */",
"this",
".",
"rotation",
"=",
"0",
";",
"/**\n * The opacity of the object.\n *\n * @member {number}\n */",
"this",
".",
"alpha",
"=",
"1",
";",
"/**\n * The visibility of the object. If false the object will not be drawn, and\n * the updateTransform function will not be called.\n *\n * @member {boolean}\n */",
"this",
".",
"visible",
"=",
"true",
";",
"/**\n * Can this object be rendered, if false the object will not be drawn but the updateTransform\n * methods will still be called.\n *\n * @member {boolean}\n */",
"this",
".",
"renderable",
"=",
"true",
";",
"/**\n * The display object container that contains this display object.\n *\n * @member {Container}\n * @readOnly\n */",
"this",
".",
"parent",
"=",
"null",
";",
"/**\n * The multiplied alpha of the displayObject\n *\n * @member {number}\n * @readOnly\n */",
"this",
".",
"worldAlpha",
"=",
"1",
";",
"/**\n * Current transform of the object based on world (parent) factors\n *\n * @member {Matrix}\n * @readOnly\n */",
"this",
".",
"worldTransform",
"=",
"new",
"math",
".",
"Matrix",
"(",
")",
";",
"/**\n * The area the filter is applied to. This is used as more of an optimisation\n * rather than figuring out the dimensions of the displayObject each frame you can set this rectangle\n *\n * @member {Rectangle}\n */",
"this",
".",
"filterArea",
"=",
"null",
";",
"/**\n * cached sin rotation\n *\n * @member {number}\n * @private\n */",
"this",
".",
"_sr",
"=",
"0",
";",
"/**\n * cached cos rotation\n *\n * @member {number}\n * @private\n */",
"this",
".",
"_cr",
"=",
"1",
";",
"/**\n * The original, cached bounds of the object\n *\n * @member {Rectangle}\n * @private\n */",
"this",
".",
"_bounds",
"=",
"new",
"math",
".",
"Rectangle",
"(",
"0",
",",
"0",
",",
"1",
",",
"1",
")",
";",
"/**\n * The most up-to-date bounds of the object\n *\n * @member {Rectangle}\n * @private\n */",
"this",
".",
"_currentBounds",
"=",
"null",
";",
"/**\n * The original, cached mask of the object\n *\n * @member {Rectangle}\n * @private\n */",
"this",
".",
"_mask",
"=",
"null",
";",
"//TODO rename to _isMask",
"// this.isMask = false;",
"/**\n * Cached internal flag.\n *\n * @member {boolean}\n * @private\n */",
"this",
".",
"_cacheAsBitmap",
"=",
"false",
";",
"this",
".",
"_cachedObject",
"=",
"null",
";",
"}"
] | The base class for all objects that are rendered on the screen.
This is an abstract class and should not be used on its own rather it should be extended.
@class
@memberof PIXI | [
"The",
"base",
"class",
"for",
"all",
"objects",
"that",
"are",
"rendered",
"on",
"the",
"screen",
".",
"This",
"is",
"an",
"abstract",
"class",
"and",
"should",
"not",
"be",
"used",
"on",
"its",
"own",
"rather",
"it",
"should",
"be",
"extended",
"."
] | e023964d05afeefebdcac4e2044819fdfa3899ae | https://github.com/Nazariglez/perenquen/blob/e023964d05afeefebdcac4e2044819fdfa3899ae/lib/pixi/src/core/display/DisplayObject.js#L14-L152 |
51,373 | lourenzo/gulp-jscs-custom | index.js | loadReporter | function loadReporter(reporterPath) {
var reporter;
reporterPath = reporterPath || 'checkstyle';
if (!fs.existsSync(path.resolve(reporterPath))) {
try {
reporter = require('./lib/reporters/' + reporterPath);
} catch (e) {
try {
reporter = require('jscs/lib/reporters/' + reporterPath);
}
catch (e) {
reporter = null;
}
}
} else {
try {
reporter = require(path.resolve(reporterPath));
} catch (e) {
reporter = null;
}
}
return reporter;
} | javascript | function loadReporter(reporterPath) {
var reporter;
reporterPath = reporterPath || 'checkstyle';
if (!fs.existsSync(path.resolve(reporterPath))) {
try {
reporter = require('./lib/reporters/' + reporterPath);
} catch (e) {
try {
reporter = require('jscs/lib/reporters/' + reporterPath);
}
catch (e) {
reporter = null;
}
}
} else {
try {
reporter = require(path.resolve(reporterPath));
} catch (e) {
reporter = null;
}
}
return reporter;
} | [
"function",
"loadReporter",
"(",
"reporterPath",
")",
"{",
"var",
"reporter",
";",
"reporterPath",
"=",
"reporterPath",
"||",
"'checkstyle'",
";",
"if",
"(",
"!",
"fs",
".",
"existsSync",
"(",
"path",
".",
"resolve",
"(",
"reporterPath",
")",
")",
")",
"{",
"try",
"{",
"reporter",
"=",
"require",
"(",
"'./lib/reporters/'",
"+",
"reporterPath",
")",
";",
"}",
"catch",
"(",
"e",
")",
"{",
"try",
"{",
"reporter",
"=",
"require",
"(",
"'jscs/lib/reporters/'",
"+",
"reporterPath",
")",
";",
"}",
"catch",
"(",
"e",
")",
"{",
"reporter",
"=",
"null",
";",
"}",
"}",
"}",
"else",
"{",
"try",
"{",
"reporter",
"=",
"require",
"(",
"path",
".",
"resolve",
"(",
"reporterPath",
")",
")",
";",
"}",
"catch",
"(",
"e",
")",
"{",
"reporter",
"=",
"null",
";",
"}",
"}",
"return",
"reporter",
";",
"}"
] | load a proper Reporter
@todo Throw error when no reporter was found
@return {Function} the selected report | [
"load",
"a",
"proper",
"Reporter"
] | 8fe9eb834f407aa0b4368131786704c5bc3bd989 | https://github.com/lourenzo/gulp-jscs-custom/blob/8fe9eb834f407aa0b4368131786704c5bc3bd989/index.js#L16-L38 |
51,374 | SSharyk/encrypted-ticket | index.js | generateRandomString | function generateRandomString(length) {
let s = "";
let i = length;
while (length-- > 0) {
let c = Math.floor(Math.random() * (MAX_HEX_SYMBOL - MIN_HEX_SYMBOL + 1)) + MIN_HEX_SYMBOL;
c = c.toString(16).toLowerCase();
s += c;
}
return s;
} | javascript | function generateRandomString(length) {
let s = "";
let i = length;
while (length-- > 0) {
let c = Math.floor(Math.random() * (MAX_HEX_SYMBOL - MIN_HEX_SYMBOL + 1)) + MIN_HEX_SYMBOL;
c = c.toString(16).toLowerCase();
s += c;
}
return s;
} | [
"function",
"generateRandomString",
"(",
"length",
")",
"{",
"let",
"s",
"=",
"\"\"",
";",
"let",
"i",
"=",
"length",
";",
"while",
"(",
"length",
"--",
">",
"0",
")",
"{",
"let",
"c",
"=",
"Math",
".",
"floor",
"(",
"Math",
".",
"random",
"(",
")",
"*",
"(",
"MAX_HEX_SYMBOL",
"-",
"MIN_HEX_SYMBOL",
"+",
"1",
")",
")",
"+",
"MIN_HEX_SYMBOL",
";",
"c",
"=",
"c",
".",
"toString",
"(",
"16",
")",
".",
"toLowerCase",
"(",
")",
";",
"s",
"+=",
"c",
";",
"}",
"return",
"s",
";",
"}"
] | Generates string, each symbol of that is either number or A..F
@param {number} length - length of string to be generated
@return {string} Random string of the required length | [
"Generates",
"string",
"each",
"symbol",
"of",
"that",
"is",
"either",
"number",
"or",
"A",
"..",
"F"
] | 0597b9680d343fede99d59894fe5ff9da93bdfc2 | https://github.com/SSharyk/encrypted-ticket/blob/0597b9680d343fede99d59894fe5ff9da93bdfc2/index.js#L104-L113 |
51,375 | willscott/grunt-jasmine-chromeapp | tasks/jasmine-chromeapp/relay.js | send | function send() {
'use strict';
var req = new XMLHttpRequest(),
specs = jsApiReporter.specs(),
payload;
if (specs.length) {
specs.push(logs);
}
payload = JSON.stringify(specs);
req.open('post', 'http://localhost:' + port + '/put', true);
req.onload = function () {
if (this.responseText === 'kill') {
chrome.app.window.current().close();
}
};
req.send(payload);
} | javascript | function send() {
'use strict';
var req = new XMLHttpRequest(),
specs = jsApiReporter.specs(),
payload;
if (specs.length) {
specs.push(logs);
}
payload = JSON.stringify(specs);
req.open('post', 'http://localhost:' + port + '/put', true);
req.onload = function () {
if (this.responseText === 'kill') {
chrome.app.window.current().close();
}
};
req.send(payload);
} | [
"function",
"send",
"(",
")",
"{",
"'use strict'",
";",
"var",
"req",
"=",
"new",
"XMLHttpRequest",
"(",
")",
",",
"specs",
"=",
"jsApiReporter",
".",
"specs",
"(",
")",
",",
"payload",
";",
"if",
"(",
"specs",
".",
"length",
")",
"{",
"specs",
".",
"push",
"(",
"logs",
")",
";",
"}",
"payload",
"=",
"JSON",
".",
"stringify",
"(",
"specs",
")",
";",
"req",
".",
"open",
"(",
"'post'",
",",
"'http://localhost:'",
"+",
"port",
"+",
"'/put'",
",",
"true",
")",
";",
"req",
".",
"onload",
"=",
"function",
"(",
")",
"{",
"if",
"(",
"this",
".",
"responseText",
"===",
"'kill'",
")",
"{",
"chrome",
".",
"app",
".",
"window",
".",
"current",
"(",
")",
".",
"close",
"(",
")",
";",
"}",
"}",
";",
"req",
".",
"send",
"(",
"payload",
")",
";",
"}"
] | This code sends the report. | [
"This",
"code",
"sends",
"the",
"report",
"."
] | 8582a56e0fd3c559948656fae157082910c45055 | https://github.com/willscott/grunt-jasmine-chromeapp/blob/8582a56e0fd3c559948656fae157082910c45055/tasks/jasmine-chromeapp/relay.js#L7-L25 |
51,376 | PanthR/panthrMath | panthrMath/rgen/rgen.js | function(name) {
// "name" encapsulates some simple options like precision
rgen.random = rgen.algorithms[name].random;
rgen.setSeed = rgen.algorithms[name].setSeed;
return rgen.setRandomSeed();
} | javascript | function(name) {
// "name" encapsulates some simple options like precision
rgen.random = rgen.algorithms[name].random;
rgen.setSeed = rgen.algorithms[name].setSeed;
return rgen.setRandomSeed();
} | [
"function",
"(",
"name",
")",
"{",
"// \"name\" encapsulates some simple options like precision",
"rgen",
".",
"random",
"=",
"rgen",
".",
"algorithms",
"[",
"name",
"]",
".",
"random",
";",
"rgen",
".",
"setSeed",
"=",
"rgen",
".",
"algorithms",
"[",
"name",
"]",
".",
"setSeed",
";",
"return",
"rgen",
".",
"setRandomSeed",
"(",
")",
";",
"}"
] | Sets the algorithm to be used for random number generation.
Expects `name` to be one of the strings returned by `getAlgorithms`. | [
"Sets",
"the",
"algorithm",
"to",
"be",
"used",
"for",
"random",
"number",
"generation",
".",
"Expects",
"name",
"to",
"be",
"one",
"of",
"the",
"strings",
"returned",
"by",
"getAlgorithms",
"."
] | 54d249ca9903a9535f963da711bd3a87fb229c0b | https://github.com/PanthR/panthrMath/blob/54d249ca9903a9535f963da711bd3a87fb229c0b/panthrMath/rgen/rgen.js#L69-L74 |
|
51,377 | redisjs/jsr-server | lib/command/database/string/setbit.js | validate | function validate(cmd, args, info) {
AbstractCommand.prototype.validate.apply(this, arguments);
var value = parseInt('' + args[2]);
if(value !== 0 && value !== 1) throw InvalidBit;
args[2] = value;
} | javascript | function validate(cmd, args, info) {
AbstractCommand.prototype.validate.apply(this, arguments);
var value = parseInt('' + args[2]);
if(value !== 0 && value !== 1) throw InvalidBit;
args[2] = value;
} | [
"function",
"validate",
"(",
"cmd",
",",
"args",
",",
"info",
")",
"{",
"AbstractCommand",
".",
"prototype",
".",
"validate",
".",
"apply",
"(",
"this",
",",
"arguments",
")",
";",
"var",
"value",
"=",
"parseInt",
"(",
"''",
"+",
"args",
"[",
"2",
"]",
")",
";",
"if",
"(",
"value",
"!==",
"0",
"&&",
"value",
"!==",
"1",
")",
"throw",
"InvalidBit",
";",
"args",
"[",
"2",
"]",
"=",
"value",
";",
"}"
] | Validate the SETBIT command. | [
"Validate",
"the",
"SETBIT",
"command",
"."
] | 49413052d3039524fbdd2ade0ef9bae26cb4d647 | https://github.com/redisjs/jsr-server/blob/49413052d3039524fbdd2ade0ef9bae26cb4d647/lib/command/database/string/setbit.js#L19-L24 |
51,378 | thomasfr/Timeliner.Core | lib/tokenizeText.js | tokenizeText | function tokenizeText(text, callback) {
"use strict";
processTokens(tokenizer.tokenize(text) || [], function (error, tokens) {
process.nextTick(function () {
callback(error, tokens);
});
});
} | javascript | function tokenizeText(text, callback) {
"use strict";
processTokens(tokenizer.tokenize(text) || [], function (error, tokens) {
process.nextTick(function () {
callback(error, tokens);
});
});
} | [
"function",
"tokenizeText",
"(",
"text",
",",
"callback",
")",
"{",
"\"use strict\"",
";",
"processTokens",
"(",
"tokenizer",
".",
"tokenize",
"(",
"text",
")",
"||",
"[",
"]",
",",
"function",
"(",
"error",
",",
"tokens",
")",
"{",
"process",
".",
"nextTick",
"(",
"function",
"(",
")",
"{",
"callback",
"(",
"error",
",",
"tokens",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}"
] | Tokenizes the given text into normalized uppercased tokens
@param String text Text you want to parse and tokenize
@param Function callback Callback gets called with this parameters function(error, String[])
@api public | [
"Tokenizes",
"the",
"given",
"text",
"into",
"normalized",
"uppercased",
"tokens"
] | f776202c22c7ca2ee50deb1bae6130fd3dcfe7fc | https://github.com/thomasfr/Timeliner.Core/blob/f776202c22c7ca2ee50deb1bae6130fd3dcfe7fc/lib/tokenizeText.js#L13-L20 |
51,379 | vesln/refractory | lib/refractory.js | load | function load(mod) {
var base = path.dirname(mod.filename);
var folders = [].slice.call(arguments, 1);
return function refractory() {
var files = [].slice.call(arguments);
var paths = [];
files
.map(function(file) {
return path.basename(file);
})
.forEach(function(file) {
folders.forEach(function(folder) {
folder = parsePaths(folder);
folder = path.resolve(base, folder);
paths.push(path.join(folder, file));
});
paths.push(file);
});
for (var i = 0, len = paths.length; i < len; i++) {
try {
return require(paths[i]);
} catch (err) {
if (err.code != MODULE_NOT_FOUND) throw err;
}
}
var err = new Error("Couldn't load file(s): \"" + files.join(', ') + '"');
err.code = MODULE_NOT_FOUND;
err.paths = paths;
throw err;
};
} | javascript | function load(mod) {
var base = path.dirname(mod.filename);
var folders = [].slice.call(arguments, 1);
return function refractory() {
var files = [].slice.call(arguments);
var paths = [];
files
.map(function(file) {
return path.basename(file);
})
.forEach(function(file) {
folders.forEach(function(folder) {
folder = parsePaths(folder);
folder = path.resolve(base, folder);
paths.push(path.join(folder, file));
});
paths.push(file);
});
for (var i = 0, len = paths.length; i < len; i++) {
try {
return require(paths[i]);
} catch (err) {
if (err.code != MODULE_NOT_FOUND) throw err;
}
}
var err = new Error("Couldn't load file(s): \"" + files.join(', ') + '"');
err.code = MODULE_NOT_FOUND;
err.paths = paths;
throw err;
};
} | [
"function",
"load",
"(",
"mod",
")",
"{",
"var",
"base",
"=",
"path",
".",
"dirname",
"(",
"mod",
".",
"filename",
")",
";",
"var",
"folders",
"=",
"[",
"]",
".",
"slice",
".",
"call",
"(",
"arguments",
",",
"1",
")",
";",
"return",
"function",
"refractory",
"(",
")",
"{",
"var",
"files",
"=",
"[",
"]",
".",
"slice",
".",
"call",
"(",
"arguments",
")",
";",
"var",
"paths",
"=",
"[",
"]",
";",
"files",
".",
"map",
"(",
"function",
"(",
"file",
")",
"{",
"return",
"path",
".",
"basename",
"(",
"file",
")",
";",
"}",
")",
".",
"forEach",
"(",
"function",
"(",
"file",
")",
"{",
"folders",
".",
"forEach",
"(",
"function",
"(",
"folder",
")",
"{",
"folder",
"=",
"parsePaths",
"(",
"folder",
")",
";",
"folder",
"=",
"path",
".",
"resolve",
"(",
"base",
",",
"folder",
")",
";",
"paths",
".",
"push",
"(",
"path",
".",
"join",
"(",
"folder",
",",
"file",
")",
")",
";",
"}",
")",
";",
"paths",
".",
"push",
"(",
"file",
")",
";",
"}",
")",
";",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"len",
"=",
"paths",
".",
"length",
";",
"i",
"<",
"len",
";",
"i",
"++",
")",
"{",
"try",
"{",
"return",
"require",
"(",
"paths",
"[",
"i",
"]",
")",
";",
"}",
"catch",
"(",
"err",
")",
"{",
"if",
"(",
"err",
".",
"code",
"!=",
"MODULE_NOT_FOUND",
")",
"throw",
"err",
";",
"}",
"}",
"var",
"err",
"=",
"new",
"Error",
"(",
"\"Couldn't load file(s): \\\"\"",
"+",
"files",
".",
"join",
"(",
"', '",
")",
"+",
"'\"'",
")",
";",
"err",
".",
"code",
"=",
"MODULE_NOT_FOUND",
";",
"err",
".",
"paths",
"=",
"paths",
";",
"throw",
"err",
";",
"}",
";",
"}"
] | Load a file.
`refractory` will search the paths in the order specified
for each module provided on `load`.
@param {Object} module (contains filename to resolve from)
@param {String} path(s) to search
@param ...
@returns {Function} file loader
@api public | [
"Load",
"a",
"file",
"."
] | 9bc07ad8e7ad5f93201400ad0a15037dfabda207 | https://github.com/vesln/refractory/blob/9bc07ad8e7ad5f93201400ad0a15037dfabda207/lib/refractory.js#L26-L61 |
51,380 | Nazariglez/perenquen | lib/pixi/src/core/renderers/webgl/filters/SpriteMaskFilter.js | SpriteMaskFilter | function SpriteMaskFilter(sprite)
{
var maskMatrix = new math.Matrix();
AbstractFilter.call(this,
fs.readFileSync(__dirname + '/spriteMaskFilter.vert', 'utf8'),
fs.readFileSync(__dirname + '/spriteMaskFilter.frag', 'utf8'),
{
mask: { type: 'sampler2D', value: sprite._texture },
alpha: { type: 'f', value: 1},
otherMatrix: { type: 'mat3', value: maskMatrix.toArray(true) }
}
);
this.maskSprite = sprite;
this.maskMatrix = maskMatrix;
} | javascript | function SpriteMaskFilter(sprite)
{
var maskMatrix = new math.Matrix();
AbstractFilter.call(this,
fs.readFileSync(__dirname + '/spriteMaskFilter.vert', 'utf8'),
fs.readFileSync(__dirname + '/spriteMaskFilter.frag', 'utf8'),
{
mask: { type: 'sampler2D', value: sprite._texture },
alpha: { type: 'f', value: 1},
otherMatrix: { type: 'mat3', value: maskMatrix.toArray(true) }
}
);
this.maskSprite = sprite;
this.maskMatrix = maskMatrix;
} | [
"function",
"SpriteMaskFilter",
"(",
"sprite",
")",
"{",
"var",
"maskMatrix",
"=",
"new",
"math",
".",
"Matrix",
"(",
")",
";",
"AbstractFilter",
".",
"call",
"(",
"this",
",",
"fs",
".",
"readFileSync",
"(",
"__dirname",
"+",
"'/spriteMaskFilter.vert'",
",",
"'utf8'",
")",
",",
"fs",
".",
"readFileSync",
"(",
"__dirname",
"+",
"'/spriteMaskFilter.frag'",
",",
"'utf8'",
")",
",",
"{",
"mask",
":",
"{",
"type",
":",
"'sampler2D'",
",",
"value",
":",
"sprite",
".",
"_texture",
"}",
",",
"alpha",
":",
"{",
"type",
":",
"'f'",
",",
"value",
":",
"1",
"}",
",",
"otherMatrix",
":",
"{",
"type",
":",
"'mat3'",
",",
"value",
":",
"maskMatrix",
".",
"toArray",
"(",
"true",
")",
"}",
"}",
")",
";",
"this",
".",
"maskSprite",
"=",
"sprite",
";",
"this",
".",
"maskMatrix",
"=",
"maskMatrix",
";",
"}"
] | The SpriteMaskFilter class
@class
@extends AbstractFilter
@memberof PIXI
@param sprite {Sprite} the target sprite | [
"The",
"SpriteMaskFilter",
"class"
] | e023964d05afeefebdcac4e2044819fdfa3899ae | https://github.com/Nazariglez/perenquen/blob/e023964d05afeefebdcac4e2044819fdfa3899ae/lib/pixi/src/core/renderers/webgl/filters/SpriteMaskFilter.js#L15-L31 |
51,381 | SalvatorePreviti/tslint-config-quick | hasPrettier.js | hasPrettier | function hasPrettier() {
if (hasPrettierCache === true || hasPrettierCache === false) {
return hasPrettierCache
}
hasPrettierCache = false
try {
const requireOptions = { paths: [getRootPath()] }
const manifestPath = require.resolve('./package.json', requireOptions)
const manifest = JSON.parse(fs.readFileSync(manifestPath).toString())
if ((manifest.devDependencies && manifest.devDependencies.prettier) || (manifest.dependencies && manifest.dependencies.prettier)) {
if (require.resolve('prettier', requireOptions)) {
hasPrettierCache = true
}
}
} catch (e) {
// Ignore error
}
return hasPrettierCache
} | javascript | function hasPrettier() {
if (hasPrettierCache === true || hasPrettierCache === false) {
return hasPrettierCache
}
hasPrettierCache = false
try {
const requireOptions = { paths: [getRootPath()] }
const manifestPath = require.resolve('./package.json', requireOptions)
const manifest = JSON.parse(fs.readFileSync(manifestPath).toString())
if ((manifest.devDependencies && manifest.devDependencies.prettier) || (manifest.dependencies && manifest.dependencies.prettier)) {
if (require.resolve('prettier', requireOptions)) {
hasPrettierCache = true
}
}
} catch (e) {
// Ignore error
}
return hasPrettierCache
} | [
"function",
"hasPrettier",
"(",
")",
"{",
"if",
"(",
"hasPrettierCache",
"===",
"true",
"||",
"hasPrettierCache",
"===",
"false",
")",
"{",
"return",
"hasPrettierCache",
"}",
"hasPrettierCache",
"=",
"false",
"try",
"{",
"const",
"requireOptions",
"=",
"{",
"paths",
":",
"[",
"getRootPath",
"(",
")",
"]",
"}",
"const",
"manifestPath",
"=",
"require",
".",
"resolve",
"(",
"'./package.json'",
",",
"requireOptions",
")",
"const",
"manifest",
"=",
"JSON",
".",
"parse",
"(",
"fs",
".",
"readFileSync",
"(",
"manifestPath",
")",
".",
"toString",
"(",
")",
")",
"if",
"(",
"(",
"manifest",
".",
"devDependencies",
"&&",
"manifest",
".",
"devDependencies",
".",
"prettier",
")",
"||",
"(",
"manifest",
".",
"dependencies",
"&&",
"manifest",
".",
"dependencies",
".",
"prettier",
")",
")",
"{",
"if",
"(",
"require",
".",
"resolve",
"(",
"'prettier'",
",",
"requireOptions",
")",
")",
"{",
"hasPrettierCache",
"=",
"true",
"}",
"}",
"}",
"catch",
"(",
"e",
")",
"{",
"// Ignore error",
"}",
"return",
"hasPrettierCache",
"}"
] | Check wether prettier is present in the main package.json
@returns {boolean} True if prettier is present in the main package.json | [
"Check",
"wether",
"prettier",
"is",
"present",
"in",
"the",
"main",
"package",
".",
"json"
] | 2bc58f6acd86fe112150c8e825f6274f09f2cd52 | https://github.com/SalvatorePreviti/tslint-config-quick/blob/2bc58f6acd86fe112150c8e825f6274f09f2cd52/hasPrettier.js#L12-L30 |
51,382 | creationix/culvert | wrap-web-socket.js | wrapNodeSocket | function wrapNodeSocket(ws, reportError) {
// Data traveling from websocket to consumer
var incoming = makeChannel();
// Data traveling from consumer to websocket
var outgoing = makeChannel();
onTake = wrapHandler(onTake, onError);
outgoing.take(onTake);
ws.onerror = onError;
ws.onmessage = wrap(onMessage, onError);
ws.onclose = wrap(onClose, onError);
function onError(err) {
if (reportError) return reportError(err);
console.error(err.stack);
}
function onMessage(evt) {
if (evt.data instanceof ArrayBuffer) {
incoming.put(new Uint8Array(evt.data));
}
}
function onClose(evt) {
incoming.put();
}
function onTake(data) {
// console.log("TAKE", data);
if (data === undefined) {
ws.close();
return;
}
ws.send(data);
outgoing.take(onTake);
}
return {
put: outgoing.put,
drain: outgoing.drain,
take: incoming.take,
};
} | javascript | function wrapNodeSocket(ws, reportError) {
// Data traveling from websocket to consumer
var incoming = makeChannel();
// Data traveling from consumer to websocket
var outgoing = makeChannel();
onTake = wrapHandler(onTake, onError);
outgoing.take(onTake);
ws.onerror = onError;
ws.onmessage = wrap(onMessage, onError);
ws.onclose = wrap(onClose, onError);
function onError(err) {
if (reportError) return reportError(err);
console.error(err.stack);
}
function onMessage(evt) {
if (evt.data instanceof ArrayBuffer) {
incoming.put(new Uint8Array(evt.data));
}
}
function onClose(evt) {
incoming.put();
}
function onTake(data) {
// console.log("TAKE", data);
if (data === undefined) {
ws.close();
return;
}
ws.send(data);
outgoing.take(onTake);
}
return {
put: outgoing.put,
drain: outgoing.drain,
take: incoming.take,
};
} | [
"function",
"wrapNodeSocket",
"(",
"ws",
",",
"reportError",
")",
"{",
"// Data traveling from websocket to consumer",
"var",
"incoming",
"=",
"makeChannel",
"(",
")",
";",
"// Data traveling from consumer to websocket",
"var",
"outgoing",
"=",
"makeChannel",
"(",
")",
";",
"onTake",
"=",
"wrapHandler",
"(",
"onTake",
",",
"onError",
")",
";",
"outgoing",
".",
"take",
"(",
"onTake",
")",
";",
"ws",
".",
"onerror",
"=",
"onError",
";",
"ws",
".",
"onmessage",
"=",
"wrap",
"(",
"onMessage",
",",
"onError",
")",
";",
"ws",
".",
"onclose",
"=",
"wrap",
"(",
"onClose",
",",
"onError",
")",
";",
"function",
"onError",
"(",
"err",
")",
"{",
"if",
"(",
"reportError",
")",
"return",
"reportError",
"(",
"err",
")",
";",
"console",
".",
"error",
"(",
"err",
".",
"stack",
")",
";",
"}",
"function",
"onMessage",
"(",
"evt",
")",
"{",
"if",
"(",
"evt",
".",
"data",
"instanceof",
"ArrayBuffer",
")",
"{",
"incoming",
".",
"put",
"(",
"new",
"Uint8Array",
"(",
"evt",
".",
"data",
")",
")",
";",
"}",
"}",
"function",
"onClose",
"(",
"evt",
")",
"{",
"incoming",
".",
"put",
"(",
")",
";",
"}",
"function",
"onTake",
"(",
"data",
")",
"{",
"// console.log(\"TAKE\", data);",
"if",
"(",
"data",
"===",
"undefined",
")",
"{",
"ws",
".",
"close",
"(",
")",
";",
"return",
";",
"}",
"ws",
".",
"send",
"(",
"data",
")",
";",
"outgoing",
".",
"take",
"(",
"onTake",
")",
";",
"}",
"return",
"{",
"put",
":",
"outgoing",
".",
"put",
",",
"drain",
":",
"outgoing",
".",
"drain",
",",
"take",
":",
"incoming",
".",
"take",
",",
"}",
";",
"}"
] | Given a browser websocket, return a culvert duplex channel. | [
"Given",
"a",
"browser",
"websocket",
"return",
"a",
"culvert",
"duplex",
"channel",
"."
] | 42b83894041cd7f8ee3993af0df65c1afe17b2c5 | https://github.com/creationix/culvert/blob/42b83894041cd7f8ee3993af0df65c1afe17b2c5/wrap-web-socket.js#L6-L49 |
51,383 | vantagejs/vantage-auth-basic | lib/vantage-auth-basic.js | search | function search(user, pass, userArray) {
return _.findWhere(userArray, { user: user, pass: pass });
} | javascript | function search(user, pass, userArray) {
return _.findWhere(userArray, { user: user, pass: pass });
} | [
"function",
"search",
"(",
"user",
",",
"pass",
",",
"userArray",
")",
"{",
"return",
"_",
".",
"findWhere",
"(",
"userArray",
",",
"{",
"user",
":",
"user",
",",
"pass",
":",
"pass",
"}",
")",
";",
"}"
] | Check if submitted user matches anything. | [
"Check",
"if",
"submitted",
"user",
"matches",
"anything",
"."
] | fb966abb64ab26dfef975bc6b13350e6306169d5 | https://github.com/vantagejs/vantage-auth-basic/blob/fb966abb64ab26dfef975bc6b13350e6306169d5/lib/vantage-auth-basic.js#L85-L87 |
51,384 | vantagejs/vantage-auth-basic | lib/vantage-auth-basic.js | ask | function ask(question, cbk, skip) {
if (skip) {
cbk(skip);
return;
}
self.prompt(question, function(answ) {
if (String(answ.answer).trim() === "") {
return ask(question, cbk);
} else {
cbk(answ.answer);
}
});
} | javascript | function ask(question, cbk, skip) {
if (skip) {
cbk(skip);
return;
}
self.prompt(question, function(answ) {
if (String(answ.answer).trim() === "") {
return ask(question, cbk);
} else {
cbk(answ.answer);
}
});
} | [
"function",
"ask",
"(",
"question",
",",
"cbk",
",",
"skip",
")",
"{",
"if",
"(",
"skip",
")",
"{",
"cbk",
"(",
"skip",
")",
";",
"return",
";",
"}",
"self",
".",
"prompt",
"(",
"question",
",",
"function",
"(",
"answ",
")",
"{",
"if",
"(",
"String",
"(",
"answ",
".",
"answer",
")",
".",
"trim",
"(",
")",
"===",
"\"\"",
")",
"{",
"return",
"ask",
"(",
"question",
",",
"cbk",
")",
";",
"}",
"else",
"{",
"cbk",
"(",
"answ",
".",
"answer",
")",
";",
"}",
"}",
")",
";",
"}"
] | If a value is given, skip, otherwise prompt user for data. | [
"If",
"a",
"value",
"is",
"given",
"skip",
"otherwise",
"prompt",
"user",
"for",
"data",
"."
] | fb966abb64ab26dfef975bc6b13350e6306169d5 | https://github.com/vantagejs/vantage-auth-basic/blob/fb966abb64ab26dfef975bc6b13350e6306169d5/lib/vantage-auth-basic.js#L91-L103 |
51,385 | vantagejs/vantage-auth-basic | lib/vantage-auth-basic.js | gather | function gather(cbk) {
ask(questions[0], function(user) {
state.user = user;
ask(questions[1], function(pass){
state.pass = pass;
cbk(state.user, state.pass);
}, state.pass);
}, state.user);
} | javascript | function gather(cbk) {
ask(questions[0], function(user) {
state.user = user;
ask(questions[1], function(pass){
state.pass = pass;
cbk(state.user, state.pass);
}, state.pass);
}, state.user);
} | [
"function",
"gather",
"(",
"cbk",
")",
"{",
"ask",
"(",
"questions",
"[",
"0",
"]",
",",
"function",
"(",
"user",
")",
"{",
"state",
".",
"user",
"=",
"user",
";",
"ask",
"(",
"questions",
"[",
"1",
"]",
",",
"function",
"(",
"pass",
")",
"{",
"state",
".",
"pass",
"=",
"pass",
";",
"cbk",
"(",
"state",
".",
"user",
",",
"state",
".",
"pass",
")",
";",
"}",
",",
"state",
".",
"pass",
")",
";",
"}",
",",
"state",
".",
"user",
")",
";",
"}"
] | Ask for a user and password. If a user is passed in, just ask for a password and skip the user. | [
"Ask",
"for",
"a",
"user",
"and",
"password",
".",
"If",
"a",
"user",
"is",
"passed",
"in",
"just",
"ask",
"for",
"a",
"password",
"and",
"skip",
"the",
"user",
"."
] | fb966abb64ab26dfef975bc6b13350e6306169d5 | https://github.com/vantagejs/vantage-auth-basic/blob/fb966abb64ab26dfef975bc6b13350e6306169d5/lib/vantage-auth-basic.js#L108-L116 |
51,386 | vantagejs/vantage-auth-basic | lib/vantage-auth-basic.js | attempt | function attempt() {
connections[id].attempts++;
if (connections[id].attempts > retry) {
connections[id].attempts = 0;
connections[id].deny++;
self.log(chalk.yellow("Access denied: too many attempts."));
callback("Access denied: too many attempts.", false);
return;
}
if (connections[id].deny >= deny && unlockTime > 0) {
setTimeout(function(){
connections[id].deny = 0;
}, unlockTime);
connections[id].attempts = 0;
self.log(chalk.yellow("Account locked out: too many login attempts."));
callback("Account locked out: too many login attempts.", false);
return;
}
gather(function(user, pass){
user = search(user, pass, users);
if (user) {
connections[id].attempts = 0;
connections[id].deny = 0;
callback("Successfully Authenticated.", true);
} else {
state.pass = void 0;
setTimeout(function(){
if (connections[id].attempts <= retry) {
self.log("Access denied.");
}
attempt();
}, retryTime);
}
});
} | javascript | function attempt() {
connections[id].attempts++;
if (connections[id].attempts > retry) {
connections[id].attempts = 0;
connections[id].deny++;
self.log(chalk.yellow("Access denied: too many attempts."));
callback("Access denied: too many attempts.", false);
return;
}
if (connections[id].deny >= deny && unlockTime > 0) {
setTimeout(function(){
connections[id].deny = 0;
}, unlockTime);
connections[id].attempts = 0;
self.log(chalk.yellow("Account locked out: too many login attempts."));
callback("Account locked out: too many login attempts.", false);
return;
}
gather(function(user, pass){
user = search(user, pass, users);
if (user) {
connections[id].attempts = 0;
connections[id].deny = 0;
callback("Successfully Authenticated.", true);
} else {
state.pass = void 0;
setTimeout(function(){
if (connections[id].attempts <= retry) {
self.log("Access denied.");
}
attempt();
}, retryTime);
}
});
} | [
"function",
"attempt",
"(",
")",
"{",
"connections",
"[",
"id",
"]",
".",
"attempts",
"++",
";",
"if",
"(",
"connections",
"[",
"id",
"]",
".",
"attempts",
">",
"retry",
")",
"{",
"connections",
"[",
"id",
"]",
".",
"attempts",
"=",
"0",
";",
"connections",
"[",
"id",
"]",
".",
"deny",
"++",
";",
"self",
".",
"log",
"(",
"chalk",
".",
"yellow",
"(",
"\"Access denied: too many attempts.\"",
")",
")",
";",
"callback",
"(",
"\"Access denied: too many attempts.\"",
",",
"false",
")",
";",
"return",
";",
"}",
"if",
"(",
"connections",
"[",
"id",
"]",
".",
"deny",
">=",
"deny",
"&&",
"unlockTime",
">",
"0",
")",
"{",
"setTimeout",
"(",
"function",
"(",
")",
"{",
"connections",
"[",
"id",
"]",
".",
"deny",
"=",
"0",
";",
"}",
",",
"unlockTime",
")",
";",
"connections",
"[",
"id",
"]",
".",
"attempts",
"=",
"0",
";",
"self",
".",
"log",
"(",
"chalk",
".",
"yellow",
"(",
"\"Account locked out: too many login attempts.\"",
")",
")",
";",
"callback",
"(",
"\"Account locked out: too many login attempts.\"",
",",
"false",
")",
";",
"return",
";",
"}",
"gather",
"(",
"function",
"(",
"user",
",",
"pass",
")",
"{",
"user",
"=",
"search",
"(",
"user",
",",
"pass",
",",
"users",
")",
";",
"if",
"(",
"user",
")",
"{",
"connections",
"[",
"id",
"]",
".",
"attempts",
"=",
"0",
";",
"connections",
"[",
"id",
"]",
".",
"deny",
"=",
"0",
";",
"callback",
"(",
"\"Successfully Authenticated.\"",
",",
"true",
")",
";",
"}",
"else",
"{",
"state",
".",
"pass",
"=",
"void",
"0",
";",
"setTimeout",
"(",
"function",
"(",
")",
"{",
"if",
"(",
"connections",
"[",
"id",
"]",
".",
"attempts",
"<=",
"retry",
")",
"{",
"self",
".",
"log",
"(",
"\"Access denied.\"",
")",
";",
"}",
"attempt",
"(",
")",
";",
"}",
",",
"retryTime",
")",
";",
"}",
"}",
")",
";",
"}"
] | Authentication attempt logic, including adding up retry and deny counts, etc. | [
"Authentication",
"attempt",
"logic",
"including",
"adding",
"up",
"retry",
"and",
"deny",
"counts",
"etc",
"."
] | fb966abb64ab26dfef975bc6b13350e6306169d5 | https://github.com/vantagejs/vantage-auth-basic/blob/fb966abb64ab26dfef975bc6b13350e6306169d5/lib/vantage-auth-basic.js#L121-L155 |
51,387 | feedhenry/fh-mbaas-middleware | lib/email/index.js | sendAlertEmail | function sendAlertEmail(alertEmailData, cb) {
var mongoAlert = alertEmailData.alert;
var eventDetails = alertEmailData.eventDetails;
var emailConfig = config.getConfig().email;
var from = emailConfig ? emailConfig.alert_email_from : '[email protected]';
fs.readFile(ALERT_EMAIL_TEMPLATE, function(err, data) {
if (err) {
return cb({
'error': 'Could not load email template from "' + ALERT_EMAIL_TEMPLATE + '": ' + err
});
}
var emailBody = data.toString();
emailBody = emailBody.replace(/%appName%/g, eventDetails.appName || "");
emailBody = emailBody.replace(/%appGuid%/g, eventDetails.uid);
emailBody = emailBody.replace(/%appUrl%/g, ' ');
emailBody = emailBody.replace(/%alertName%/g, mongoAlert.alertName);
emailBody = emailBody.replace(/%eventTimestamp%/g, eventDetails.timestamp);
emailBody = emailBody.replace(/%updatedBy%/g, eventDetails.updatedBy);
emailBody = emailBody.replace(/%eventMessage%/g, eventDetails.details.message);
emailBody = emailBody.replace(/%eventCategory%/g, eventDetails.eventClass);
emailBody = emailBody.replace(/%eventName%/g, eventDetails.eventType);
emailBody = emailBody.replace(/%eventSeverity%/g, eventDetails.eventLevel);
emailBody = emailBody.replace(/%eventDetails%/g, JSON.stringify(eventDetails.details));
emailBody = emailBody.replace(/%providerName%/g, from);
getTransport(emailConfig).sendMail({
from: from,
to: mongoAlert.emails,
subject: 'Alert Name: ' + mongoAlert.alertName + ' - Cloud App (' + mongoAlert.uid + ')',
html: emailBody
}, cb);
});
} | javascript | function sendAlertEmail(alertEmailData, cb) {
var mongoAlert = alertEmailData.alert;
var eventDetails = alertEmailData.eventDetails;
var emailConfig = config.getConfig().email;
var from = emailConfig ? emailConfig.alert_email_from : '[email protected]';
fs.readFile(ALERT_EMAIL_TEMPLATE, function(err, data) {
if (err) {
return cb({
'error': 'Could not load email template from "' + ALERT_EMAIL_TEMPLATE + '": ' + err
});
}
var emailBody = data.toString();
emailBody = emailBody.replace(/%appName%/g, eventDetails.appName || "");
emailBody = emailBody.replace(/%appGuid%/g, eventDetails.uid);
emailBody = emailBody.replace(/%appUrl%/g, ' ');
emailBody = emailBody.replace(/%alertName%/g, mongoAlert.alertName);
emailBody = emailBody.replace(/%eventTimestamp%/g, eventDetails.timestamp);
emailBody = emailBody.replace(/%updatedBy%/g, eventDetails.updatedBy);
emailBody = emailBody.replace(/%eventMessage%/g, eventDetails.details.message);
emailBody = emailBody.replace(/%eventCategory%/g, eventDetails.eventClass);
emailBody = emailBody.replace(/%eventName%/g, eventDetails.eventType);
emailBody = emailBody.replace(/%eventSeverity%/g, eventDetails.eventLevel);
emailBody = emailBody.replace(/%eventDetails%/g, JSON.stringify(eventDetails.details));
emailBody = emailBody.replace(/%providerName%/g, from);
getTransport(emailConfig).sendMail({
from: from,
to: mongoAlert.emails,
subject: 'Alert Name: ' + mongoAlert.alertName + ' - Cloud App (' + mongoAlert.uid + ')',
html: emailBody
}, cb);
});
} | [
"function",
"sendAlertEmail",
"(",
"alertEmailData",
",",
"cb",
")",
"{",
"var",
"mongoAlert",
"=",
"alertEmailData",
".",
"alert",
";",
"var",
"eventDetails",
"=",
"alertEmailData",
".",
"eventDetails",
";",
"var",
"emailConfig",
"=",
"config",
".",
"getConfig",
"(",
")",
".",
"email",
";",
"var",
"from",
"=",
"emailConfig",
"?",
"emailConfig",
".",
"alert_email_from",
":",
"'[email protected]'",
";",
"fs",
".",
"readFile",
"(",
"ALERT_EMAIL_TEMPLATE",
",",
"function",
"(",
"err",
",",
"data",
")",
"{",
"if",
"(",
"err",
")",
"{",
"return",
"cb",
"(",
"{",
"'error'",
":",
"'Could not load email template from \"'",
"+",
"ALERT_EMAIL_TEMPLATE",
"+",
"'\": '",
"+",
"err",
"}",
")",
";",
"}",
"var",
"emailBody",
"=",
"data",
".",
"toString",
"(",
")",
";",
"emailBody",
"=",
"emailBody",
".",
"replace",
"(",
"/",
"%appName%",
"/",
"g",
",",
"eventDetails",
".",
"appName",
"||",
"\"\"",
")",
";",
"emailBody",
"=",
"emailBody",
".",
"replace",
"(",
"/",
"%appGuid%",
"/",
"g",
",",
"eventDetails",
".",
"uid",
")",
";",
"emailBody",
"=",
"emailBody",
".",
"replace",
"(",
"/",
"%appUrl%",
"/",
"g",
",",
"' '",
")",
";",
"emailBody",
"=",
"emailBody",
".",
"replace",
"(",
"/",
"%alertName%",
"/",
"g",
",",
"mongoAlert",
".",
"alertName",
")",
";",
"emailBody",
"=",
"emailBody",
".",
"replace",
"(",
"/",
"%eventTimestamp%",
"/",
"g",
",",
"eventDetails",
".",
"timestamp",
")",
";",
"emailBody",
"=",
"emailBody",
".",
"replace",
"(",
"/",
"%updatedBy%",
"/",
"g",
",",
"eventDetails",
".",
"updatedBy",
")",
";",
"emailBody",
"=",
"emailBody",
".",
"replace",
"(",
"/",
"%eventMessage%",
"/",
"g",
",",
"eventDetails",
".",
"details",
".",
"message",
")",
";",
"emailBody",
"=",
"emailBody",
".",
"replace",
"(",
"/",
"%eventCategory%",
"/",
"g",
",",
"eventDetails",
".",
"eventClass",
")",
";",
"emailBody",
"=",
"emailBody",
".",
"replace",
"(",
"/",
"%eventName%",
"/",
"g",
",",
"eventDetails",
".",
"eventType",
")",
";",
"emailBody",
"=",
"emailBody",
".",
"replace",
"(",
"/",
"%eventSeverity%",
"/",
"g",
",",
"eventDetails",
".",
"eventLevel",
")",
";",
"emailBody",
"=",
"emailBody",
".",
"replace",
"(",
"/",
"%eventDetails%",
"/",
"g",
",",
"JSON",
".",
"stringify",
"(",
"eventDetails",
".",
"details",
")",
")",
";",
"emailBody",
"=",
"emailBody",
".",
"replace",
"(",
"/",
"%providerName%",
"/",
"g",
",",
"from",
")",
";",
"getTransport",
"(",
"emailConfig",
")",
".",
"sendMail",
"(",
"{",
"from",
":",
"from",
",",
"to",
":",
"mongoAlert",
".",
"emails",
",",
"subject",
":",
"'Alert Name: '",
"+",
"mongoAlert",
".",
"alertName",
"+",
"' - Cloud App ('",
"+",
"mongoAlert",
".",
"uid",
"+",
"')'",
",",
"html",
":",
"emailBody",
"}",
",",
"cb",
")",
";",
"}",
")",
";",
"}"
] | Send an Alert email to recipients for given Event
@param alertEmailData
@param cb | [
"Send",
"an",
"Alert",
"email",
"to",
"recipients",
"for",
"given",
"Event"
] | f906e98efbb4b0963bf5137b34b5e0589ba24e69 | https://github.com/feedhenry/fh-mbaas-middleware/blob/f906e98efbb4b0963bf5137b34b5e0589ba24e69/lib/email/index.js#L57-L90 |
51,388 | iwillwen/watchman.js | src/watchman.js | createRule | function createRule(path, handler) {
if ('*' !== path && 0 != path.indexOf(watch.__base)) {
path = watch.__base + (path == '/' ? '' : path)
}
let rule = pathToRegExp(path)
if (handler instanceof String) {
let target = handler
handler = function() {
watch({
url: target
})
}
}
rule.handler = handler
return rule
} | javascript | function createRule(path, handler) {
if ('*' !== path && 0 != path.indexOf(watch.__base)) {
path = watch.__base + (path == '/' ? '' : path)
}
let rule = pathToRegExp(path)
if (handler instanceof String) {
let target = handler
handler = function() {
watch({
url: target
})
}
}
rule.handler = handler
return rule
} | [
"function",
"createRule",
"(",
"path",
",",
"handler",
")",
"{",
"if",
"(",
"'*'",
"!==",
"path",
"&&",
"0",
"!=",
"path",
".",
"indexOf",
"(",
"watch",
".",
"__base",
")",
")",
"{",
"path",
"=",
"watch",
".",
"__base",
"+",
"(",
"path",
"==",
"'/'",
"?",
"''",
":",
"path",
")",
"}",
"let",
"rule",
"=",
"pathToRegExp",
"(",
"path",
")",
"if",
"(",
"handler",
"instanceof",
"String",
")",
"{",
"let",
"target",
"=",
"handler",
"handler",
"=",
"function",
"(",
")",
"{",
"watch",
"(",
"{",
"url",
":",
"target",
"}",
")",
"}",
"}",
"rule",
".",
"handler",
"=",
"handler",
"return",
"rule",
"}"
] | create a rule
@param {String} path path
@param {Funtion} handler handle callback
@return {Object} rule object | [
"create",
"a",
"rule"
] | 54b380f53311aa03422cf7ce4e41a5fb7a2c067a | https://github.com/iwillwen/watchman.js/blob/54b380f53311aa03422cf7ce4e41a5fb7a2c067a/src/watchman.js#L249-L265 |
51,389 | novadiscovery/nway | lib/builders/standard.js | initialize | function initialize(done) {
debug('prepare');
parser(options.index, options, function(err, modules) {
if(err) return done(err)
debug('Parser return, now build the tree...');
tree = buildTree(options, modules, true);
debug('Tree builded');
// Extract from tree as a flatten list of packets to compile
packets = tree.getAllBundles(options);
done(null);
})
} | javascript | function initialize(done) {
debug('prepare');
parser(options.index, options, function(err, modules) {
if(err) return done(err)
debug('Parser return, now build the tree...');
tree = buildTree(options, modules, true);
debug('Tree builded');
// Extract from tree as a flatten list of packets to compile
packets = tree.getAllBundles(options);
done(null);
})
} | [
"function",
"initialize",
"(",
"done",
")",
"{",
"debug",
"(",
"'prepare'",
")",
";",
"parser",
"(",
"options",
".",
"index",
",",
"options",
",",
"function",
"(",
"err",
",",
"modules",
")",
"{",
"if",
"(",
"err",
")",
"return",
"done",
"(",
"err",
")",
"debug",
"(",
"'Parser return, now build the tree...'",
")",
";",
"tree",
"=",
"buildTree",
"(",
"options",
",",
"modules",
",",
"true",
")",
";",
"debug",
"(",
"'Tree builded'",
")",
";",
"// Extract from tree as a flatten list of packets to compile",
"packets",
"=",
"tree",
".",
"getAllBundles",
"(",
"options",
")",
";",
"done",
"(",
"null",
")",
";",
"}",
")",
"}"
] | BUILD FLOW
Step 1
Prepare builder information using nway.prepare() :
modules object, root module, sources, tree and packet list
@api private | [
"BUILD",
"FLOW",
"Step",
"1"
] | fa31c6fe56f2305721e581ac25e8ac9a87e15dda | https://github.com/novadiscovery/nway/blob/fa31c6fe56f2305721e581ac25e8ac9a87e15dda/lib/builders/standard.js#L97-L114 |
51,390 | thomasfr/Timeliner.Core | lib/tokenizeWord.js | tokenizeWord | function tokenizeWord(word, callback) {
"use strict";
var match, parts = [], stemmedPart, singularPart, singularMetaphones, stemmedMetaphones, token;
// TODO: Improve that. Should be in the stemmer actually
//if (-1 === (match = word.match(/^([#"',;:!?(.\[{])*([a-z0-9]+)+([,;:!?)\]}"'.])*$/i))) {
// return callback(null, []);
//}
//if (!match) {
// return callback(null, []);
//}
//word = match[2] || "";
word = word || "";
if (-1 === word.search(/^[a-z]*$/i) || word.length < 3) {
return callback(null, []);
}
token = word.toUpperCase().trim();
// TODO: Decide which stopwords to use depending on the given language
var stopwordsEn = stopwords.en;
// we skip stopwords
if (stopwordsEn.indexOf(token) >= 0) {
return callback(null, []);
}
parts.push(token);
// TODO: Decide which stemmer to use depending on the given language
stemmedPart = stemmer.stem(token) || "";
if (stemmedPart.length > 2) {
// calc double metaphone of the stemmed word
stemmedMetaphones = doubleMetaphone.process(stemmedPart);
//console.log("stemmed Metaphones for " + token + " " + stemmedMetaphones);
if (stemmedMetaphones[0].length > 1) {
parts.push((stemmedMetaphones[0] || "").trim());
}
if (stemmedMetaphones[1].length > 1) {
parts.push((stemmedMetaphones[1] || "").trim());
}
}
// the last element is the original uppercased stemmed token
parts.push(stemmedPart.toUpperCase().trim());
// Singularize word
singularPart = nounInflector.singularize(token) || "";
if (singularPart.length > 2) {
// calc double metaphone of singular
singularMetaphones = doubleMetaphone.process(singularPart);
//console.log("singular Metaphones for " + token + " " + stemmedMetaphones);
if (singularMetaphones[0].length > 1) {
parts.push((singularMetaphones[0] || "").trim());
}
if (singularMetaphones[1].length > 1) {
parts.push((singularMetaphones[1] || "").trim());
}
}
parts.push(singularPart.toUpperCase().trim());
parts.sort();
parts = underscore.uniq(parts, true);
process.nextTick(function () {
callback(null, parts);
});
} | javascript | function tokenizeWord(word, callback) {
"use strict";
var match, parts = [], stemmedPart, singularPart, singularMetaphones, stemmedMetaphones, token;
// TODO: Improve that. Should be in the stemmer actually
//if (-1 === (match = word.match(/^([#"',;:!?(.\[{])*([a-z0-9]+)+([,;:!?)\]}"'.])*$/i))) {
// return callback(null, []);
//}
//if (!match) {
// return callback(null, []);
//}
//word = match[2] || "";
word = word || "";
if (-1 === word.search(/^[a-z]*$/i) || word.length < 3) {
return callback(null, []);
}
token = word.toUpperCase().trim();
// TODO: Decide which stopwords to use depending on the given language
var stopwordsEn = stopwords.en;
// we skip stopwords
if (stopwordsEn.indexOf(token) >= 0) {
return callback(null, []);
}
parts.push(token);
// TODO: Decide which stemmer to use depending on the given language
stemmedPart = stemmer.stem(token) || "";
if (stemmedPart.length > 2) {
// calc double metaphone of the stemmed word
stemmedMetaphones = doubleMetaphone.process(stemmedPart);
//console.log("stemmed Metaphones for " + token + " " + stemmedMetaphones);
if (stemmedMetaphones[0].length > 1) {
parts.push((stemmedMetaphones[0] || "").trim());
}
if (stemmedMetaphones[1].length > 1) {
parts.push((stemmedMetaphones[1] || "").trim());
}
}
// the last element is the original uppercased stemmed token
parts.push(stemmedPart.toUpperCase().trim());
// Singularize word
singularPart = nounInflector.singularize(token) || "";
if (singularPart.length > 2) {
// calc double metaphone of singular
singularMetaphones = doubleMetaphone.process(singularPart);
//console.log("singular Metaphones for " + token + " " + stemmedMetaphones);
if (singularMetaphones[0].length > 1) {
parts.push((singularMetaphones[0] || "").trim());
}
if (singularMetaphones[1].length > 1) {
parts.push((singularMetaphones[1] || "").trim());
}
}
parts.push(singularPart.toUpperCase().trim());
parts.sort();
parts = underscore.uniq(parts, true);
process.nextTick(function () {
callback(null, parts);
});
} | [
"function",
"tokenizeWord",
"(",
"word",
",",
"callback",
")",
"{",
"\"use strict\"",
";",
"var",
"match",
",",
"parts",
"=",
"[",
"]",
",",
"stemmedPart",
",",
"singularPart",
",",
"singularMetaphones",
",",
"stemmedMetaphones",
",",
"token",
";",
"// TODO: Improve that. Should be in the stemmer actually",
"//if (-1 === (match = word.match(/^([#\"',;:!?(.\\[{])*([a-z0-9]+)+([,;:!?)\\]}\"'.])*$/i))) {",
"// return callback(null, []);",
"//}",
"//if (!match) {",
"// return callback(null, []);",
"//}",
"//word = match[2] || \"\";",
"word",
"=",
"word",
"||",
"\"\"",
";",
"if",
"(",
"-",
"1",
"===",
"word",
".",
"search",
"(",
"/",
"^[a-z]*$",
"/",
"i",
")",
"||",
"word",
".",
"length",
"<",
"3",
")",
"{",
"return",
"callback",
"(",
"null",
",",
"[",
"]",
")",
";",
"}",
"token",
"=",
"word",
".",
"toUpperCase",
"(",
")",
".",
"trim",
"(",
")",
";",
"// TODO: Decide which stopwords to use depending on the given language",
"var",
"stopwordsEn",
"=",
"stopwords",
".",
"en",
";",
"// we skip stopwords",
"if",
"(",
"stopwordsEn",
".",
"indexOf",
"(",
"token",
")",
">=",
"0",
")",
"{",
"return",
"callback",
"(",
"null",
",",
"[",
"]",
")",
";",
"}",
"parts",
".",
"push",
"(",
"token",
")",
";",
"// TODO: Decide which stemmer to use depending on the given language",
"stemmedPart",
"=",
"stemmer",
".",
"stem",
"(",
"token",
")",
"||",
"\"\"",
";",
"if",
"(",
"stemmedPart",
".",
"length",
">",
"2",
")",
"{",
"// calc double metaphone of the stemmed word",
"stemmedMetaphones",
"=",
"doubleMetaphone",
".",
"process",
"(",
"stemmedPart",
")",
";",
"//console.log(\"stemmed Metaphones for \" + token + \" \" + stemmedMetaphones);",
"if",
"(",
"stemmedMetaphones",
"[",
"0",
"]",
".",
"length",
">",
"1",
")",
"{",
"parts",
".",
"push",
"(",
"(",
"stemmedMetaphones",
"[",
"0",
"]",
"||",
"\"\"",
")",
".",
"trim",
"(",
")",
")",
";",
"}",
"if",
"(",
"stemmedMetaphones",
"[",
"1",
"]",
".",
"length",
">",
"1",
")",
"{",
"parts",
".",
"push",
"(",
"(",
"stemmedMetaphones",
"[",
"1",
"]",
"||",
"\"\"",
")",
".",
"trim",
"(",
")",
")",
";",
"}",
"}",
"// the last element is the original uppercased stemmed token",
"parts",
".",
"push",
"(",
"stemmedPart",
".",
"toUpperCase",
"(",
")",
".",
"trim",
"(",
")",
")",
";",
"// Singularize word",
"singularPart",
"=",
"nounInflector",
".",
"singularize",
"(",
"token",
")",
"||",
"\"\"",
";",
"if",
"(",
"singularPart",
".",
"length",
">",
"2",
")",
"{",
"// calc double metaphone of singular",
"singularMetaphones",
"=",
"doubleMetaphone",
".",
"process",
"(",
"singularPart",
")",
";",
"//console.log(\"singular Metaphones for \" + token + \" \" + stemmedMetaphones);",
"if",
"(",
"singularMetaphones",
"[",
"0",
"]",
".",
"length",
">",
"1",
")",
"{",
"parts",
".",
"push",
"(",
"(",
"singularMetaphones",
"[",
"0",
"]",
"||",
"\"\"",
")",
".",
"trim",
"(",
")",
")",
";",
"}",
"if",
"(",
"singularMetaphones",
"[",
"1",
"]",
".",
"length",
">",
"1",
")",
"{",
"parts",
".",
"push",
"(",
"(",
"singularMetaphones",
"[",
"1",
"]",
"||",
"\"\"",
")",
".",
"trim",
"(",
")",
")",
";",
"}",
"}",
"parts",
".",
"push",
"(",
"singularPart",
".",
"toUpperCase",
"(",
")",
".",
"trim",
"(",
")",
")",
";",
"parts",
".",
"sort",
"(",
")",
";",
"parts",
"=",
"underscore",
".",
"uniq",
"(",
"parts",
",",
"true",
")",
";",
"process",
".",
"nextTick",
"(",
"function",
"(",
")",
"{",
"callback",
"(",
"null",
",",
"parts",
")",
";",
"}",
")",
";",
"}"
] | Processes a given word.
Will do stemming, singularizing and adds double metaphone of each.
also adds the stemmed and singularized and the word itself.
So at max there are 7 tokens generated for each word.
Tokens gets sorted and duplicates gets removed
@param String word
@param Function callback function(error, String[])
@api public | [
"Processes",
"a",
"given",
"word",
".",
"Will",
"do",
"stemming",
"singularizing",
"and",
"adds",
"double",
"metaphone",
"of",
"each",
".",
"also",
"adds",
"the",
"stemmed",
"and",
"singularized",
"and",
"the",
"word",
"itself",
".",
"So",
"at",
"max",
"there",
"are",
"7",
"tokens",
"generated",
"for",
"each",
"word",
".",
"Tokens",
"gets",
"sorted",
"and",
"duplicates",
"gets",
"removed"
] | f776202c22c7ca2ee50deb1bae6130fd3dcfe7fc | https://github.com/thomasfr/Timeliner.Core/blob/f776202c22c7ca2ee50deb1bae6130fd3dcfe7fc/lib/tokenizeWord.js#L19-L87 |
51,391 | xiamidaxia/xiami | meteor/mongo-livedata/mongo_driver.js | function (ordered) {
var self = this;
if (ordered) {
return self.fetch();
} else {
var results = new LocalCollection._IdMap;
self.forEach(function (doc) {
results.set(doc._id, doc);
});
return results;
}
} | javascript | function (ordered) {
var self = this;
if (ordered) {
return self.fetch();
} else {
var results = new LocalCollection._IdMap;
self.forEach(function (doc) {
results.set(doc._id, doc);
});
return results;
}
} | [
"function",
"(",
"ordered",
")",
"{",
"var",
"self",
"=",
"this",
";",
"if",
"(",
"ordered",
")",
"{",
"return",
"self",
".",
"fetch",
"(",
")",
";",
"}",
"else",
"{",
"var",
"results",
"=",
"new",
"LocalCollection",
".",
"_IdMap",
";",
"self",
".",
"forEach",
"(",
"function",
"(",
"doc",
")",
"{",
"results",
".",
"set",
"(",
"doc",
".",
"_id",
",",
"doc",
")",
";",
"}",
")",
";",
"return",
"results",
";",
"}",
"}"
] | This method is NOT wrapped in Cursor. | [
"This",
"method",
"is",
"NOT",
"wrapped",
"in",
"Cursor",
"."
] | 6fcee92c493c12bf8fd67c7068e67fa6a72a306b | https://github.com/xiamidaxia/xiami/blob/6fcee92c493c12bf8fd67c7068e67fa6a72a306b/meteor/mongo-livedata/mongo_driver.js#L926-L937 |
|
51,392 | tolokoban/ToloFrameWork | ker/mod/tfw.binding.list.js | function(arg) {
readOnly(this, ID, COUNT++);
readOnly(this, "_listeners", new Listeners());
readOnly(this, "_links", []);
// An object with the attribute `isContentChangeAware === true`
// can fire a property value changed when its contant has change.
readOnly(this, "isContentChangeAware", true);
if (Array.isArray(arg)) {
readOnly(this, "_array", arg);
} else if (isList(arg)) {
readOnly(this, "_array", arg._array);
this.link(arg);
} else {
readOnly(this, "_array", [arg]);
}
} | javascript | function(arg) {
readOnly(this, ID, COUNT++);
readOnly(this, "_listeners", new Listeners());
readOnly(this, "_links", []);
// An object with the attribute `isContentChangeAware === true`
// can fire a property value changed when its contant has change.
readOnly(this, "isContentChangeAware", true);
if (Array.isArray(arg)) {
readOnly(this, "_array", arg);
} else if (isList(arg)) {
readOnly(this, "_array", arg._array);
this.link(arg);
} else {
readOnly(this, "_array", [arg]);
}
} | [
"function",
"(",
"arg",
")",
"{",
"readOnly",
"(",
"this",
",",
"ID",
",",
"COUNT",
"++",
")",
";",
"readOnly",
"(",
"this",
",",
"\"_listeners\"",
",",
"new",
"Listeners",
"(",
")",
")",
";",
"readOnly",
"(",
"this",
",",
"\"_links\"",
",",
"[",
"]",
")",
";",
"// An object with the attribute `isContentChangeAware === true`",
"// can fire a property value changed when its contant has change.",
"readOnly",
"(",
"this",
",",
"\"isContentChangeAware\"",
",",
"true",
")",
";",
"if",
"(",
"Array",
".",
"isArray",
"(",
"arg",
")",
")",
"{",
"readOnly",
"(",
"this",
",",
"\"_array\"",
",",
"arg",
")",
";",
"}",
"else",
"if",
"(",
"isList",
"(",
"arg",
")",
")",
"{",
"readOnly",
"(",
"this",
",",
"\"_array\"",
",",
"arg",
".",
"_array",
")",
";",
"this",
".",
"link",
"(",
"arg",
")",
";",
"}",
"else",
"{",
"readOnly",
"(",
"this",
",",
"\"_array\"",
",",
"[",
"arg",
"]",
")",
";",
"}",
"}"
] | A list is an observable array.
Several lists can share the same internal array. In that case, when
one list modifies the array, all lists will emit the same event as
it. Such lists are linked. | [
"A",
"list",
"is",
"an",
"observable",
"array",
"."
] | 730845a833a9660ebfdb60ad027ebaab5ac871b6 | https://github.com/tolokoban/ToloFrameWork/blob/730845a833a9660ebfdb60ad027ebaab5ac871b6/ker/mod/tfw.binding.list.js#L33-L48 |
|
51,393 | redisjs/jsr-server | lib/stats.js | Stats | function Stats(state) {
this.state = state;
this.clear();
this.onConnect = onConnect.bind(this);
this.onDisconnect = onDisconnect.bind(this);
this.onRejected = onRejected.bind(this);
this.onHit = onHit.bind(this);
this.onMiss = onMiss.bind(this);
this.onExpired = onExpired.bind(this);
this.onExpired = onExpired.bind(this);
this.addStateListeners();
} | javascript | function Stats(state) {
this.state = state;
this.clear();
this.onConnect = onConnect.bind(this);
this.onDisconnect = onDisconnect.bind(this);
this.onRejected = onRejected.bind(this);
this.onHit = onHit.bind(this);
this.onMiss = onMiss.bind(this);
this.onExpired = onExpired.bind(this);
this.onExpired = onExpired.bind(this);
this.addStateListeners();
} | [
"function",
"Stats",
"(",
"state",
")",
"{",
"this",
".",
"state",
"=",
"state",
";",
"this",
".",
"clear",
"(",
")",
";",
"this",
".",
"onConnect",
"=",
"onConnect",
".",
"bind",
"(",
"this",
")",
";",
"this",
".",
"onDisconnect",
"=",
"onDisconnect",
".",
"bind",
"(",
"this",
")",
";",
"this",
".",
"onRejected",
"=",
"onRejected",
".",
"bind",
"(",
"this",
")",
";",
"this",
".",
"onHit",
"=",
"onHit",
".",
"bind",
"(",
"this",
")",
";",
"this",
".",
"onMiss",
"=",
"onMiss",
".",
"bind",
"(",
"this",
")",
";",
"this",
".",
"onExpired",
"=",
"onExpired",
".",
"bind",
"(",
"this",
")",
";",
"this",
".",
"onExpired",
"=",
"onExpired",
".",
"bind",
"(",
"this",
")",
";",
"this",
".",
"addStateListeners",
"(",
")",
";",
"}"
] | Encapsulates the server statistics. | [
"Encapsulates",
"the",
"server",
"statistics",
"."
] | 49413052d3039524fbdd2ade0ef9bae26cb4d647 | https://github.com/redisjs/jsr-server/blob/49413052d3039524fbdd2ade0ef9bae26cb4d647/lib/stats.js#L4-L15 |
51,394 | hydrojs/karma-hydro | adapter.js | function(error) {
if (!error.stack) return error.message;
var stack = error.stack;
var firstLine = stack.substring(0, stack.indexOf('\n'));
if (error.message && firstLine.indexOf(error.message) === -1) stack = error.message + '\n' + stack;
return stack.replace(/\n.+\/adapter(\/lib)?\/hydro.js\?\d*\:.+(?=(\n|$))/g, '');
} | javascript | function(error) {
if (!error.stack) return error.message;
var stack = error.stack;
var firstLine = stack.substring(0, stack.indexOf('\n'));
if (error.message && firstLine.indexOf(error.message) === -1) stack = error.message + '\n' + stack;
return stack.replace(/\n.+\/adapter(\/lib)?\/hydro.js\?\d*\:.+(?=(\n|$))/g, '');
} | [
"function",
"(",
"error",
")",
"{",
"if",
"(",
"!",
"error",
".",
"stack",
")",
"return",
"error",
".",
"message",
";",
"var",
"stack",
"=",
"error",
".",
"stack",
";",
"var",
"firstLine",
"=",
"stack",
".",
"substring",
"(",
"0",
",",
"stack",
".",
"indexOf",
"(",
"'\\n'",
")",
")",
";",
"if",
"(",
"error",
".",
"message",
"&&",
"firstLine",
".",
"indexOf",
"(",
"error",
".",
"message",
")",
"===",
"-",
"1",
")",
"stack",
"=",
"error",
".",
"message",
"+",
"'\\n'",
"+",
"stack",
";",
"return",
"stack",
".",
"replace",
"(",
"/",
"\\n.+\\/adapter(\\/lib)?\\/hydro.js\\?\\d*\\:.+(?=(\\n|$))",
"/",
"g",
",",
"''",
")",
";",
"}"
] | Format error.
@param {Error} error
@returns {String}
@api private | [
"Format",
"error",
"."
] | a0d5e083b1ddd1c4fbc7d6fa29ed1b0d9d4a5193 | https://github.com/hydrojs/karma-hydro/blob/a0d5e083b1ddd1c4fbc7d6fa29ed1b0d9d4a5193/adapter.js#L17-L23 |
|
51,395 | awto/mfjs-core | index.js | defaults | function defaults(defs,opts) {
if (!opts)
opts = {}
if (opts.context == null)
opts.context = true;
if (opts.coerce == null)
opts.coerce = true;
completeMonad(defs);
if (opts.control === "token")
defs = M.addControlByToken(defs);
if (opts.wrap)
defs = M.wrap(defs,opts.wrap);
if (opts.coerce)
defs = M.addCoerce(defs);
if (opts.context)
defs = M.addContext(defs, opts.context === "run");
if (opts.wrap)
M.completePrototype(defs,opts.wrap.prototype);
return defs;
} | javascript | function defaults(defs,opts) {
if (!opts)
opts = {}
if (opts.context == null)
opts.context = true;
if (opts.coerce == null)
opts.coerce = true;
completeMonad(defs);
if (opts.control === "token")
defs = M.addControlByToken(defs);
if (opts.wrap)
defs = M.wrap(defs,opts.wrap);
if (opts.coerce)
defs = M.addCoerce(defs);
if (opts.context)
defs = M.addContext(defs, opts.context === "run");
if (opts.wrap)
M.completePrototype(defs,opts.wrap.prototype);
return defs;
} | [
"function",
"defaults",
"(",
"defs",
",",
"opts",
")",
"{",
"if",
"(",
"!",
"opts",
")",
"opts",
"=",
"{",
"}",
"if",
"(",
"opts",
".",
"context",
"==",
"null",
")",
"opts",
".",
"context",
"=",
"true",
";",
"if",
"(",
"opts",
".",
"coerce",
"==",
"null",
")",
"opts",
".",
"coerce",
"=",
"true",
";",
"completeMonad",
"(",
"defs",
")",
";",
"if",
"(",
"opts",
".",
"control",
"===",
"\"token\"",
")",
"defs",
"=",
"M",
".",
"addControlByToken",
"(",
"defs",
")",
";",
"if",
"(",
"opts",
".",
"wrap",
")",
"defs",
"=",
"M",
".",
"wrap",
"(",
"defs",
",",
"opts",
".",
"wrap",
")",
";",
"if",
"(",
"opts",
".",
"coerce",
")",
"defs",
"=",
"M",
".",
"addCoerce",
"(",
"defs",
")",
";",
"if",
"(",
"opts",
".",
"context",
")",
"defs",
"=",
"M",
".",
"addContext",
"(",
"defs",
",",
"opts",
".",
"context",
"===",
"\"run\"",
")",
";",
"if",
"(",
"opts",
".",
"wrap",
")",
"M",
".",
"completePrototype",
"(",
"defs",
",",
"opts",
".",
"wrap",
".",
"prototype",
")",
";",
"return",
"defs",
";",
"}"
] | Runs definitions transformations based on specified set of options.
Options:
* wrap - constructor function used for wrapped value,
it should construct objects with inner field
* context - boolean or "run" string for only wrapping run method,
default is true
* coerce - boolean for adding coercions to functions returning
monadic values, default is true
* control - string "token" for adding control operators implementation
using special token passing
@function M.defaults
@param {MonadDict} inner original monad definition
@param {Object} options
@return {MonadDict} | [
"Runs",
"definitions",
"transformations",
"based",
"on",
"specified",
"set",
"of",
"options",
"."
] | 6138e74c373998592777b8849ec5a22d6b8edd7d | https://github.com/awto/mfjs-core/blob/6138e74c373998592777b8849ec5a22d6b8edd7d/index.js#L1101-L1120 |
51,396 | awto/mfjs-core | index.js | liftContext | function liftContext(ctx, func) {
if (!ctx.pure) {
throw new Error("no monad's definition is provided");
}
return function() {
var saved;
saved = context;
context = ctx;
try {
return func.apply(null, arguments);
} finally {
context = saved;
}
};
} | javascript | function liftContext(ctx, func) {
if (!ctx.pure) {
throw new Error("no monad's definition is provided");
}
return function() {
var saved;
saved = context;
context = ctx;
try {
return func.apply(null, arguments);
} finally {
context = saved;
}
};
} | [
"function",
"liftContext",
"(",
"ctx",
",",
"func",
")",
"{",
"if",
"(",
"!",
"ctx",
".",
"pure",
")",
"{",
"throw",
"new",
"Error",
"(",
"\"no monad's definition is provided\"",
")",
";",
"}",
"return",
"function",
"(",
")",
"{",
"var",
"saved",
";",
"saved",
"=",
"context",
";",
"context",
"=",
"ctx",
";",
"try",
"{",
"return",
"func",
".",
"apply",
"(",
"null",
",",
"arguments",
")",
";",
"}",
"finally",
"{",
"context",
"=",
"saved",
";",
"}",
"}",
";",
"}"
] | Turns a function into a function initializing global context to `ctx`
and reverting it to the old value on exit.
@function M.liftContext
@param {MonadDict} ctx
@param {Function} func
@return {Function} | [
"Turns",
"a",
"function",
"into",
"a",
"function",
"initializing",
"global",
"context",
"to",
"ctx",
"and",
"reverting",
"it",
"to",
"the",
"old",
"value",
"on",
"exit",
"."
] | 6138e74c373998592777b8849ec5a22d6b8edd7d | https://github.com/awto/mfjs-core/blob/6138e74c373998592777b8849ec5a22d6b8edd7d/index.js#L1173-L1187 |
51,397 | awto/mfjs-core | index.js | liftContextG | function liftContextG(ctx, gen) {
return liftContext(ctx, function() {
return liftContextIterator(ctx, gen.apply(null, arguments));
});
} | javascript | function liftContextG(ctx, gen) {
return liftContext(ctx, function() {
return liftContextIterator(ctx, gen.apply(null, arguments));
});
} | [
"function",
"liftContextG",
"(",
"ctx",
",",
"gen",
")",
"{",
"return",
"liftContext",
"(",
"ctx",
",",
"function",
"(",
")",
"{",
"return",
"liftContextIterator",
"(",
"ctx",
",",
"gen",
".",
"apply",
"(",
"null",
",",
"arguments",
")",
")",
";",
"}",
")",
";",
"}"
] | Same as `liftContext` but lifts generator function.
@function M.liftContextG
@param {MonadDict} ctx
@param {GeneratorFunction} gen
@return {Function} | [
"Same",
"as",
"liftContext",
"but",
"lifts",
"generator",
"function",
"."
] | 6138e74c373998592777b8849ec5a22d6b8edd7d | https://github.com/awto/mfjs-core/blob/6138e74c373998592777b8849ec5a22d6b8edd7d/index.js#L1197-L1201 |
51,398 | jonschlinkert/expand-config | index.js | Config | function Config(options) {
if (!(this instanceof Config)) {
return new Config(options);
}
utils.is(this, 'config');
use(this);
define(this, 'count', 0);
this.options = options || {};
this.targets = {};
this.tasks = {};
if (utils.isConfig(options)) {
this.options = {};
this.expand(options);
return this;
}
} | javascript | function Config(options) {
if (!(this instanceof Config)) {
return new Config(options);
}
utils.is(this, 'config');
use(this);
define(this, 'count', 0);
this.options = options || {};
this.targets = {};
this.tasks = {};
if (utils.isConfig(options)) {
this.options = {};
this.expand(options);
return this;
}
} | [
"function",
"Config",
"(",
"options",
")",
"{",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"Config",
")",
")",
"{",
"return",
"new",
"Config",
"(",
"options",
")",
";",
"}",
"utils",
".",
"is",
"(",
"this",
",",
"'config'",
")",
";",
"use",
"(",
"this",
")",
";",
"define",
"(",
"this",
",",
"'count'",
",",
"0",
")",
";",
"this",
".",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"this",
".",
"targets",
"=",
"{",
"}",
";",
"this",
".",
"tasks",
"=",
"{",
"}",
";",
"if",
"(",
"utils",
".",
"isConfig",
"(",
"options",
")",
")",
"{",
"this",
".",
"options",
"=",
"{",
"}",
";",
"this",
".",
"expand",
"(",
"options",
")",
";",
"return",
"this",
";",
"}",
"}"
] | Expand a declarative configuration with tasks and targets.
Create a new Config with the given `options`
```js
var config = new Config();
// example usage
config.expand({
jshint: {
src: ['*.js', 'lib/*.js']
}
});
```
@param {Object} `options`
@api public | [
"Expand",
"a",
"declarative",
"configuration",
"with",
"tasks",
"and",
"targets",
".",
"Create",
"a",
"new",
"Config",
"with",
"the",
"given",
"options"
] | 338fc219577d11318a08fe732410ac57a2d07b74 | https://github.com/jonschlinkert/expand-config/blob/338fc219577d11318a08fe732410ac57a2d07b74/index.js#L27-L45 |
51,399 | cli-kit/cli-mid-version | index.js | handler | function handler(req, next) {
var conf = this.configure();
var pkg = this.package();
var copyright = conf.copyright || (pkg ? pkg.copyright : null);
var opts = [this._version];
var msg = this._name + ' %s';
// NOTE: allows deferring to this handler from a custom handler
if(arguments.length > 1 && typeof(next) !== 'function') {
opts = opts.concat([].slice.call(arguments, 1));
}
opts.unshift(msg);
// respect vanilla help setting
if(conf.help.vanilla) {
opts = [util.format.apply(util, opts)];
}
console.log.apply(console, opts);
if(copyright) {
console.log();
copyright = '' + copyright;
copyright = wrap(copyright, 0, conf.help.maximum);
console.log(copyright);
}
if(conf.exit && req !== true) process.exit();
return false;
} | javascript | function handler(req, next) {
var conf = this.configure();
var pkg = this.package();
var copyright = conf.copyright || (pkg ? pkg.copyright : null);
var opts = [this._version];
var msg = this._name + ' %s';
// NOTE: allows deferring to this handler from a custom handler
if(arguments.length > 1 && typeof(next) !== 'function') {
opts = opts.concat([].slice.call(arguments, 1));
}
opts.unshift(msg);
// respect vanilla help setting
if(conf.help.vanilla) {
opts = [util.format.apply(util, opts)];
}
console.log.apply(console, opts);
if(copyright) {
console.log();
copyright = '' + copyright;
copyright = wrap(copyright, 0, conf.help.maximum);
console.log(copyright);
}
if(conf.exit && req !== true) process.exit();
return false;
} | [
"function",
"handler",
"(",
"req",
",",
"next",
")",
"{",
"var",
"conf",
"=",
"this",
".",
"configure",
"(",
")",
";",
"var",
"pkg",
"=",
"this",
".",
"package",
"(",
")",
";",
"var",
"copyright",
"=",
"conf",
".",
"copyright",
"||",
"(",
"pkg",
"?",
"pkg",
".",
"copyright",
":",
"null",
")",
";",
"var",
"opts",
"=",
"[",
"this",
".",
"_version",
"]",
";",
"var",
"msg",
"=",
"this",
".",
"_name",
"+",
"' %s'",
";",
"// NOTE: allows deferring to this handler from a custom handler",
"if",
"(",
"arguments",
".",
"length",
">",
"1",
"&&",
"typeof",
"(",
"next",
")",
"!==",
"'function'",
")",
"{",
"opts",
"=",
"opts",
".",
"concat",
"(",
"[",
"]",
".",
"slice",
".",
"call",
"(",
"arguments",
",",
"1",
")",
")",
";",
"}",
"opts",
".",
"unshift",
"(",
"msg",
")",
";",
"// respect vanilla help setting",
"if",
"(",
"conf",
".",
"help",
".",
"vanilla",
")",
"{",
"opts",
"=",
"[",
"util",
".",
"format",
".",
"apply",
"(",
"util",
",",
"opts",
")",
"]",
";",
"}",
"console",
".",
"log",
".",
"apply",
"(",
"console",
",",
"opts",
")",
";",
"if",
"(",
"copyright",
")",
"{",
"console",
".",
"log",
"(",
")",
";",
"copyright",
"=",
"''",
"+",
"copyright",
";",
"copyright",
"=",
"wrap",
"(",
"copyright",
",",
"0",
",",
"conf",
".",
"help",
".",
"maximum",
")",
";",
"console",
".",
"log",
"(",
"copyright",
")",
";",
"}",
"if",
"(",
"conf",
".",
"exit",
"&&",
"req",
"!==",
"true",
")",
"process",
".",
"exit",
"(",
")",
";",
"return",
"false",
";",
"}"
] | Default program version action.
@param alive Do not exit the process.
@param ... Message replacement parameters. | [
"Default",
"program",
"version",
"action",
"."
] | 4040eac6ba52af4c4cf540b9cc0c0f6bbdc1d579 | https://github.com/cli-kit/cli-mid-version/blob/4040eac6ba52af4c4cf540b9cc0c0f6bbdc1d579/index.js#L10-L35 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.