repo stringclasses 195 values | path stringlengths 4 99 | func_name stringlengths 0 41 | original_string stringlengths 72 56.1k | language stringclasses 1 value | code stringlengths 72 56.1k | code_tokens listlengths 25 8.12k | docstring stringlengths 2 12.5k | docstring_tokens listlengths 1 449 | sha stringclasses 197 values | url stringlengths 88 186 | partition stringclasses 1 value | summary stringlengths 8 338 | input_ids listlengths 502 502 | token_type_ids listlengths 502 502 | attention_mask listlengths 502 502 | labels listlengths 502 502 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
PrismJS/prism | plugins/previewers/prism-previewers.js | function(prefix, func, values) {
// Default value for angle
var angle = '180deg';
if (/^(?:-?\d*\.?\d+(?:deg|rad)|to\b|top|right|bottom|left)/.test(values[0])) {
angle = values.shift();
if (angle.indexOf('to ') < 0) {
// Angle uses old keywords
// W3C syntax uses "to" + opposite keywords
if (angle.indexOf('top') >= 0) {
if (angle.indexOf('left') >= 0) {
angle = 'to bottom right';
} else if (angle.indexOf('right') >= 0) {
angle = 'to bottom left';
} else {
angle = 'to bottom';
}
} else if (angle.indexOf('bottom') >= 0) {
if (angle.indexOf('left') >= 0) {
angle = 'to top right';
} else if (angle.indexOf('right') >= 0) {
angle = 'to top left';
} else {
angle = 'to top';
}
} else if (angle.indexOf('left') >= 0) {
angle = 'to right';
} else if (angle.indexOf('right') >= 0) {
angle = 'to left';
} else if (prefix) {
// Angle is shifted by 90deg in prefixed gradients
if (angle.indexOf('deg') >= 0) {
angle = (90 - parseFloat(angle)) + 'deg';
} else if (angle.indexOf('rad') >= 0) {
angle = (Math.PI / 2 - parseFloat(angle)) + 'rad';
}
}
}
}
return func + '(' + angle + ',' + values.join(',') + ')';
} | javascript | function(prefix, func, values) {
// Default value for angle
var angle = '180deg';
if (/^(?:-?\d*\.?\d+(?:deg|rad)|to\b|top|right|bottom|left)/.test(values[0])) {
angle = values.shift();
if (angle.indexOf('to ') < 0) {
// Angle uses old keywords
// W3C syntax uses "to" + opposite keywords
if (angle.indexOf('top') >= 0) {
if (angle.indexOf('left') >= 0) {
angle = 'to bottom right';
} else if (angle.indexOf('right') >= 0) {
angle = 'to bottom left';
} else {
angle = 'to bottom';
}
} else if (angle.indexOf('bottom') >= 0) {
if (angle.indexOf('left') >= 0) {
angle = 'to top right';
} else if (angle.indexOf('right') >= 0) {
angle = 'to top left';
} else {
angle = 'to top';
}
} else if (angle.indexOf('left') >= 0) {
angle = 'to right';
} else if (angle.indexOf('right') >= 0) {
angle = 'to left';
} else if (prefix) {
// Angle is shifted by 90deg in prefixed gradients
if (angle.indexOf('deg') >= 0) {
angle = (90 - parseFloat(angle)) + 'deg';
} else if (angle.indexOf('rad') >= 0) {
angle = (Math.PI / 2 - parseFloat(angle)) + 'rad';
}
}
}
}
return func + '(' + angle + ',' + values.join(',') + ')';
} | [
"function",
"(",
"prefix",
",",
"func",
",",
"values",
")",
"{",
"// Default value for angle",
"var",
"angle",
"=",
"'180deg'",
";",
"if",
"(",
"/",
"^(?:-?\\d*\\.?\\d+(?:deg|rad)|to\\b|top|right|bottom|left)",
"/",
".",
"test",
"(",
"values",
"[",
"0",
"]",
")"... | Returns a W3C-valid linear gradient
@param {string} prefix Vendor prefix if any ("-moz-", "-webkit-", etc.)
@param {string} func Gradient function name ("linear-gradient")
@param {string[]} values Array of the gradient function parameters (["0deg", "red 0%", "blue 100%"]) | [
"Returns",
"a",
"W3C",
"-",
"valid",
"linear",
"gradient"
] | acceb3b56f0e8362a7ef274dbd85b17611df2ec4 | https://github.com/PrismJS/prism/blob/acceb3b56f0e8362a7ef274dbd85b17611df2ec4/plugins/previewers/prism-previewers.js#L25-L66 | train | Returns a function that takes an array of values and returns the result | [
30522,
3853,
1006,
17576,
1010,
4569,
2278,
1010,
5300,
1007,
1063,
1013,
1013,
12398,
3643,
2005,
6466,
13075,
6466,
1027,
1005,
8380,
3207,
2290,
1005,
1025,
2065,
1006,
1013,
1034,
1006,
1029,
1024,
1011,
1029,
1032,
1040,
1008,
1032,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
dcloudio/mui | examples/login/libs/easymob-webim-sdk/strophe-custom-2.0.0.js | function (str) {
var bin = [];
for(var i = 0; i < str.length * 8; i += 8)
{
bin[i>>5] |= (str.charCodeAt(i / 8) & 255) << (i%32);
}
return bin;
} | javascript | function (str) {
var bin = [];
for(var i = 0; i < str.length * 8; i += 8)
{
bin[i>>5] |= (str.charCodeAt(i / 8) & 255) << (i%32);
}
return bin;
} | [
"function",
"(",
"str",
")",
"{",
"var",
"bin",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"str",
".",
"length",
"*",
"8",
";",
"i",
"+=",
"8",
")",
"{",
"bin",
"[",
"i",
">>",
"5",
"]",
"|=",
"(",
"str",
".",
... | /*
Convert a string to an array of little-endian words | [
"/",
"*",
"Convert",
"a",
"string",
"to",
"an",
"array",
"of",
"little",
"-",
"endian",
"words"
] | ff74c90a1671a552f3604b1288bf38a4126312d0 | https://github.com/dcloudio/mui/blob/ff74c90a1671a552f3604b1288bf38a4126312d0/examples/login/libs/easymob-webim-sdk/strophe-custom-2.0.0.js#L304-L311 | train | Returns an array of the words of the specified string | [
30522,
3853,
1006,
2358,
2099,
1007,
1063,
13075,
8026,
1027,
1031,
1033,
1025,
2005,
1006,
13075,
1045,
1027,
1014,
1025,
1045,
1026,
2358,
2099,
1012,
3091,
1008,
1022,
1025,
1045,
1009,
1027,
1022,
1007,
1063,
8026,
1031,
1045,
1028,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | grunt/config/aliases.js | function(library, glob) {
var aTasks = [];
if (arguments.length > 0) {
Array.prototype.forEach.call(arguments, function(path) {
grunt.config(['eslint', path], path);
aTasks.push('eslint:' + path);
});
} else {
aTasks.push('eslint');
}
grunt.task.run(aTasks);
} | javascript | function(library, glob) {
var aTasks = [];
if (arguments.length > 0) {
Array.prototype.forEach.call(arguments, function(path) {
grunt.config(['eslint', path], path);
aTasks.push('eslint:' + path);
});
} else {
aTasks.push('eslint');
}
grunt.task.run(aTasks);
} | [
"function",
"(",
"library",
",",
"glob",
")",
"{",
"var",
"aTasks",
"=",
"[",
"]",
";",
"if",
"(",
"arguments",
".",
"length",
">",
"0",
")",
"{",
"Array",
".",
"prototype",
".",
"forEach",
".",
"call",
"(",
"arguments",
",",
"function",
"(",
"path... | Lint task | [
"Lint",
"task"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/grunt/config/aliases.js#L27-L38 | train | Run the linters | [
30522,
3853,
1006,
3075,
1010,
1043,
4135,
2497,
1007,
1063,
13075,
29533,
6711,
2015,
1027,
1031,
1033,
1025,
2065,
1006,
9918,
1012,
3091,
1028,
1014,
1007,
1063,
9140,
1012,
8773,
1012,
18921,
6776,
1012,
2655,
1006,
9918,
1010,
3853,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | src/sap.ui.core/src/sap/ui/core/mvc/View.js | initPreprocessor | function initPreprocessor(oPreprocessor, bAsync) {
var oPreprocessorImpl;
if (typeof oPreprocessor.preprocessor === "string") {
var sPreprocessorName = oPreprocessor.preprocessor.replace(/\./g, "/");
// module string given, resolve and retrieve object
if (bAsync) {
return new Promise(function(resolve, reject) {
sap.ui.require([sPreprocessorName], function(oPreprocessorImpl) {
resolve(oPreprocessorImpl);
});
});
} else {
return sap.ui.requireSync(sPreprocessorName);
}
} else if (typeof oPreprocessor.preprocessor === "function" && !oPreprocessor.preprocessor.process) {
oPreprocessorImpl = {
process: oPreprocessor.preprocessor
};
} else {
oPreprocessorImpl = oPreprocessor.preprocessor;
}
if (bAsync) {
return Promise.resolve(oPreprocessorImpl);
} else {
return oPreprocessorImpl;
}
} | javascript | function initPreprocessor(oPreprocessor, bAsync) {
var oPreprocessorImpl;
if (typeof oPreprocessor.preprocessor === "string") {
var sPreprocessorName = oPreprocessor.preprocessor.replace(/\./g, "/");
// module string given, resolve and retrieve object
if (bAsync) {
return new Promise(function(resolve, reject) {
sap.ui.require([sPreprocessorName], function(oPreprocessorImpl) {
resolve(oPreprocessorImpl);
});
});
} else {
return sap.ui.requireSync(sPreprocessorName);
}
} else if (typeof oPreprocessor.preprocessor === "function" && !oPreprocessor.preprocessor.process) {
oPreprocessorImpl = {
process: oPreprocessor.preprocessor
};
} else {
oPreprocessorImpl = oPreprocessor.preprocessor;
}
if (bAsync) {
return Promise.resolve(oPreprocessorImpl);
} else {
return oPreprocessorImpl;
}
} | [
"function",
"initPreprocessor",
"(",
"oPreprocessor",
",",
"bAsync",
")",
"{",
"var",
"oPreprocessorImpl",
";",
"if",
"(",
"typeof",
"oPreprocessor",
".",
"preprocessor",
"===",
"\"string\"",
")",
"{",
"var",
"sPreprocessorName",
"=",
"oPreprocessor",
".",
"prepro... | resolves either the module dependency or the function which was passed to settings to the internal
preprocessor config object
@param {object} oPreprocessor Preprocessor config object
@param {boolean} bAsync Whether processing is async or not
@return {object} oPreprocessorImpl
@private | [
"resolves",
"either",
"the",
"module",
"dependency",
"or",
"the",
"function",
"which",
"was",
"passed",
"to",
"settings",
"to",
"the",
"internal",
"preprocessor",
"config",
"object"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/mvc/View.js#L231-L259 | train | Initializes the preprocessor | [
30522,
3853,
1999,
4183,
28139,
21572,
9623,
21748,
1006,
6728,
2890,
21572,
9623,
21748,
30524,
1006,
2828,
11253,
6728,
2890,
21572,
9623,
21748,
1012,
17463,
3217,
9623,
21748,
1027,
1027,
1027,
1000,
5164,
1000,
1007,
1063,
13075,
11867,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
eslint/eslint | lib/rules/no-useless-escape.js | check | function check(node) {
const isTemplateElement = node.type === "TemplateElement";
if (
isTemplateElement &&
node.parent &&
node.parent.parent &&
node.parent.parent.type === "TaggedTemplateExpression" &&
node.parent === node.parent.parent.quasi
) {
// Don't report tagged template literals, because the backslash character is accessible to the tag function.
return;
}
if (typeof node.value === "string" || isTemplateElement) {
/*
* JSXAttribute doesn't have any escape sequence: https://facebook.github.io/jsx/.
* In addition, backticks are not supported by JSX yet: https://github.com/facebook/jsx/issues/25.
*/
if (node.parent.type === "JSXAttribute" || node.parent.type === "JSXElement" || node.parent.type === "JSXFragment") {
return;
}
const value = isTemplateElement ? node.value.raw : node.raw.slice(1, -1);
const pattern = /\\[^\d]/gu;
let match;
while ((match = pattern.exec(value))) {
validateString(node, match);
}
} else if (node.regex) {
parseRegExp(node.regex.pattern)
/*
* The '-' character is a special case, because it's only valid to escape it if it's in a character
* class, and is not at either edge of the character class. To account for this, don't consider '-'
* characters to be valid in general, and filter out '-' characters that appear in the middle of a
* character class.
*/
.filter(charInfo => !(charInfo.text === "-" && charInfo.inCharClass && !charInfo.startsCharClass && !charInfo.endsCharClass))
/*
* The '^' character is also a special case; it must always be escaped outside of character classes, but
* it only needs to be escaped in character classes if it's at the beginning of the character class. To
* account for this, consider it to be a valid escape character outside of character classes, and filter
* out '^' characters that appear at the start of a character class.
*/
.filter(charInfo => !(charInfo.text === "^" && charInfo.startsCharClass))
// Filter out characters that aren't escaped.
.filter(charInfo => charInfo.escaped)
// Filter out characters that are valid to escape, based on their position in the regular expression.
.filter(charInfo => !(charInfo.inCharClass ? REGEX_GENERAL_ESCAPES : REGEX_NON_CHARCLASS_ESCAPES).has(charInfo.text))
// Report all the remaining characters.
.forEach(charInfo => report(node, charInfo.index, charInfo.text));
}
} | javascript | function check(node) {
const isTemplateElement = node.type === "TemplateElement";
if (
isTemplateElement &&
node.parent &&
node.parent.parent &&
node.parent.parent.type === "TaggedTemplateExpression" &&
node.parent === node.parent.parent.quasi
) {
// Don't report tagged template literals, because the backslash character is accessible to the tag function.
return;
}
if (typeof node.value === "string" || isTemplateElement) {
/*
* JSXAttribute doesn't have any escape sequence: https://facebook.github.io/jsx/.
* In addition, backticks are not supported by JSX yet: https://github.com/facebook/jsx/issues/25.
*/
if (node.parent.type === "JSXAttribute" || node.parent.type === "JSXElement" || node.parent.type === "JSXFragment") {
return;
}
const value = isTemplateElement ? node.value.raw : node.raw.slice(1, -1);
const pattern = /\\[^\d]/gu;
let match;
while ((match = pattern.exec(value))) {
validateString(node, match);
}
} else if (node.regex) {
parseRegExp(node.regex.pattern)
/*
* The '-' character is a special case, because it's only valid to escape it if it's in a character
* class, and is not at either edge of the character class. To account for this, don't consider '-'
* characters to be valid in general, and filter out '-' characters that appear in the middle of a
* character class.
*/
.filter(charInfo => !(charInfo.text === "-" && charInfo.inCharClass && !charInfo.startsCharClass && !charInfo.endsCharClass))
/*
* The '^' character is also a special case; it must always be escaped outside of character classes, but
* it only needs to be escaped in character classes if it's at the beginning of the character class. To
* account for this, consider it to be a valid escape character outside of character classes, and filter
* out '^' characters that appear at the start of a character class.
*/
.filter(charInfo => !(charInfo.text === "^" && charInfo.startsCharClass))
// Filter out characters that aren't escaped.
.filter(charInfo => charInfo.escaped)
// Filter out characters that are valid to escape, based on their position in the regular expression.
.filter(charInfo => !(charInfo.inCharClass ? REGEX_GENERAL_ESCAPES : REGEX_NON_CHARCLASS_ESCAPES).has(charInfo.text))
// Report all the remaining characters.
.forEach(charInfo => report(node, charInfo.index, charInfo.text));
}
} | [
"function",
"check",
"(",
"node",
")",
"{",
"const",
"isTemplateElement",
"=",
"node",
".",
"type",
"===",
"\"TemplateElement\"",
";",
"if",
"(",
"isTemplateElement",
"&&",
"node",
".",
"parent",
"&&",
"node",
".",
"parent",
".",
"parent",
"&&",
"node",
".... | Checks if a node has an escape.
@param {ASTNode} node - node to check.
@returns {void} | [
"Checks",
"if",
"a",
"node",
"has",
"an",
"escape",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/no-useless-escape.js#L158-L219 | train | Check if node is valid | [
30522,
3853,
4638,
1006,
13045,
1007,
1063,
9530,
3367,
21541,
6633,
15725,
12260,
3672,
1027,
13045,
1012,
2828,
1027,
1027,
1027,
1000,
23561,
12260,
3672,
1000,
1025,
2065,
1006,
21541,
6633,
15725,
12260,
3672,
1004,
1004,
13045,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
eslint/eslint | lib/rules/require-atomic-updates.js | resolveVariableInScope | function resolveVariableInScope(identifier, scope) {
return scope.variables.find(variable => variable.name === identifier.name) ||
(scope.upper ? resolveVariableInScope(identifier, scope.upper) : null);
} | javascript | function resolveVariableInScope(identifier, scope) {
return scope.variables.find(variable => variable.name === identifier.name) ||
(scope.upper ? resolveVariableInScope(identifier, scope.upper) : null);
} | [
"function",
"resolveVariableInScope",
"(",
"identifier",
",",
"scope",
")",
"{",
"return",
"scope",
".",
"variables",
".",
"find",
"(",
"variable",
"=>",
"variable",
".",
"name",
"===",
"identifier",
".",
"name",
")",
"||",
"(",
"scope",
".",
"upper",
"?",... | Resolves a given identifier to a given scope
@param {ASTNode} identifier An `Identifier` AST node
@param {Scope} scope An escope Scope
@returns {Variable|null} An escope Variable corresponding to the given identifier | [
"Resolves",
"a",
"given",
"identifier",
"to",
"a",
"given",
"scope"
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/require-atomic-updates.js#L65-L68 | train | Resolves a variable in a given scope | [
30522,
3853,
10663,
10755,
19210,
7076,
16186,
1006,
8909,
4765,
18095,
1010,
9531,
1007,
1063,
2709,
9531,
1012,
10857,
1012,
2424,
1006,
8023,
1027,
1028,
8023,
1012,
2171,
1027,
1027,
1027,
8909,
4765,
18095,
1012,
2171,
1007,
1064,
1064... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SeleniumHQ/selenium | third_party/js/mozmill/shared-modules/modal-dialog.js | mdObserver_observe | function mdObserver_observe(aSubject, aTopic, aData) {
// Once the window has been found and loaded we can execute the callback
var window = this.findWindow();
if (window && ("documentLoaded" in window)) {
try {
this._callback(new mozmill.controller.MozMillController(window));
}
catch (ex) {
// Store the exception, so it can be forwarded if a modal dialog has
// been opened by another modal dialog
this.exception = ex;
}
if (window) {
window.close();
}
this.finished = true;
this.stop();
}
else {
// otherwise try again in a bit
this._timer.init(this, DELAY_CHECK, Ci.nsITimer.TYPE_ONE_SHOT);
}
} | javascript | function mdObserver_observe(aSubject, aTopic, aData) {
// Once the window has been found and loaded we can execute the callback
var window = this.findWindow();
if (window && ("documentLoaded" in window)) {
try {
this._callback(new mozmill.controller.MozMillController(window));
}
catch (ex) {
// Store the exception, so it can be forwarded if a modal dialog has
// been opened by another modal dialog
this.exception = ex;
}
if (window) {
window.close();
}
this.finished = true;
this.stop();
}
else {
// otherwise try again in a bit
this._timer.init(this, DELAY_CHECK, Ci.nsITimer.TYPE_ONE_SHOT);
}
} | [
"function",
"mdObserver_observe",
"(",
"aSubject",
",",
"aTopic",
",",
"aData",
")",
"{",
"// Once the window has been found and loaded we can execute the callback",
"var",
"window",
"=",
"this",
".",
"findWindow",
"(",
")",
";",
"if",
"(",
"window",
"&&",
"(",
"\"d... | Called by the timer in the given interval to check if the modal dialog has
been opened. Once it has been found the callback gets executed
@param {object} aSubject Not used.
@param {string} aTopic Not used.
@param {string} aData Not used. | [
"Called",
"by",
"the",
"timer",
"in",
"the",
"given",
"interval",
"to",
"check",
"if",
"the",
"modal",
"dialog",
"has",
"been",
"opened",
".",
"Once",
"it",
"has",
"been",
"found",
"the",
"callback",
"gets",
"executed"
] | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/modal-dialog.js#L112-L136 | train | This function is called by the MIDI controller when the MIDI controller is ready | [
30522,
3853,
9108,
16429,
8043,
6299,
1035,
11949,
1006,
2004,
12083,
20614,
1010,
10234,
2594,
1010,
15262,
2696,
1007,
1063,
1013,
1013,
2320,
1996,
3332,
2038,
2042,
2179,
1998,
8209,
2057,
2064,
15389,
1996,
2655,
5963,
13075,
3332,
102... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
GitbookIO/gitbook | lib/plugins/validatePlugin.js | validatePlugin | function validatePlugin(plugin) {
var packageInfos = plugin.getPackage();
var isValid = (
plugin.isLoaded() &&
packageInfos &&
packageInfos.get('name') &&
packageInfos.get('engines') &&
packageInfos.get('engines').get('gitbook')
);
if (!isValid) {
return Promise.reject(new Error('Error loading plugin "' + plugin.getName() + '" at "' + plugin.getPath() + '"'));
}
var engine = packageInfos.get('engines').get('gitbook');
if (!gitbook.satisfies(engine)) {
return Promise.reject(new Error('GitBook doesn\'t satisfy the requirements of this plugin: ' + engine));
}
return Promise(plugin);
} | javascript | function validatePlugin(plugin) {
var packageInfos = plugin.getPackage();
var isValid = (
plugin.isLoaded() &&
packageInfos &&
packageInfos.get('name') &&
packageInfos.get('engines') &&
packageInfos.get('engines').get('gitbook')
);
if (!isValid) {
return Promise.reject(new Error('Error loading plugin "' + plugin.getName() + '" at "' + plugin.getPath() + '"'));
}
var engine = packageInfos.get('engines').get('gitbook');
if (!gitbook.satisfies(engine)) {
return Promise.reject(new Error('GitBook doesn\'t satisfy the requirements of this plugin: ' + engine));
}
return Promise(plugin);
} | [
"function",
"validatePlugin",
"(",
"plugin",
")",
"{",
"var",
"packageInfos",
"=",
"plugin",
".",
"getPackage",
"(",
")",
";",
"var",
"isValid",
"=",
"(",
"plugin",
".",
"isLoaded",
"(",
")",
"&&",
"packageInfos",
"&&",
"packageInfos",
".",
"get",
"(",
"... | Validate a plugin
@param {Plugin}
@return {Promise<Plugin>} | [
"Validate",
"a",
"plugin"
] | 6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4 | https://github.com/GitbookIO/gitbook/blob/6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4/lib/plugins/validatePlugin.js#L11-L32 | train | Validate a plugin | [
30522,
3853,
9398,
3686,
24759,
15916,
2378,
1006,
13354,
2378,
1007,
1063,
13075,
7427,
2378,
14876,
2015,
1027,
13354,
2378,
1012,
2131,
23947,
4270,
1006,
1007,
1025,
13075,
2003,
10175,
3593,
1027,
1006,
13354,
2378,
1012,
2003,
17468,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Freeboard/freeboard | js/freeboard.thirdparty.js | bindHover | function bindHover(dpDiv) {
var selector = "button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";
return dpDiv.delegate(selector, "mouseout", function() {
$(this).removeClass("ui-state-hover");
if (this.className.indexOf("ui-datepicker-prev") !== -1) {
$(this).removeClass("ui-datepicker-prev-hover");
}
if (this.className.indexOf("ui-datepicker-next") !== -1) {
$(this).removeClass("ui-datepicker-next-hover");
}
})
.delegate(selector, "mouseover", function(){
if (!$.datepicker._isDisabledDatepicker( instActive.inline ? dpDiv.parent()[0] : instActive.input[0])) {
$(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover");
$(this).addClass("ui-state-hover");
if (this.className.indexOf("ui-datepicker-prev") !== -1) {
$(this).addClass("ui-datepicker-prev-hover");
}
if (this.className.indexOf("ui-datepicker-next") !== -1) {
$(this).addClass("ui-datepicker-next-hover");
}
}
});
} | javascript | function bindHover(dpDiv) {
var selector = "button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";
return dpDiv.delegate(selector, "mouseout", function() {
$(this).removeClass("ui-state-hover");
if (this.className.indexOf("ui-datepicker-prev") !== -1) {
$(this).removeClass("ui-datepicker-prev-hover");
}
if (this.className.indexOf("ui-datepicker-next") !== -1) {
$(this).removeClass("ui-datepicker-next-hover");
}
})
.delegate(selector, "mouseover", function(){
if (!$.datepicker._isDisabledDatepicker( instActive.inline ? dpDiv.parent()[0] : instActive.input[0])) {
$(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover");
$(this).addClass("ui-state-hover");
if (this.className.indexOf("ui-datepicker-prev") !== -1) {
$(this).addClass("ui-datepicker-prev-hover");
}
if (this.className.indexOf("ui-datepicker-next") !== -1) {
$(this).addClass("ui-datepicker-next-hover");
}
}
});
} | [
"function",
"bindHover",
"(",
"dpDiv",
")",
"{",
"var",
"selector",
"=",
"\"button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a\"",
";",
"return",
"dpDiv",
".",
"delegate",
"(",
"selector",
",",
"\"mouseout\"",
",",
"function",
"(",
")",
"{",
... | /*
Bind hover events for datepicker elements.
Done via delegate so the binding only occurs once in the lifetime of the parent div.
Global instActive, set by _updateDatepicker allows the handlers to find their way back to the active picker. | [
"/",
"*",
"Bind",
"hover",
"events",
"for",
"datepicker",
"elements",
".",
"Done",
"via",
"delegate",
"so",
"the",
"binding",
"only",
"occurs",
"once",
"in",
"the",
"lifetime",
"of",
"the",
"parent",
"div",
".",
"Global",
"instActive",
"set",
"by",
"_updat... | 38789f6e8bd3d04f7d3b2c3427e509d00f2610fc | https://github.com/Freeboard/freeboard/blob/38789f6e8bd3d04f7d3b2c3427e509d00f2610fc/js/freeboard.thirdparty.js#L9573-L9596 | train | binds mouseover mouseout mouseover mouseout mouseover mouseout mouseover mouseout mouseover mouseout mouseover mouseout | [
30522,
3853,
14187,
6806,
6299,
1006,
1040,
17299,
12848,
1007,
1063,
13075,
27000,
1027,
1000,
6462,
1010,
1012,
21318,
1011,
3058,
24330,
5484,
1011,
3653,
2615,
1010,
1012,
21318,
1011,
3058,
24330,
5484,
1011,
2279,
1010,
1012,
21318,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SheetJS/js-xlsx | xlsx.js | parse_xlsxcfb | function parse_xlsxcfb(cfb, _opts) {
var opts = _opts || {};
var f = 'Workbook', data = CFB.find(cfb, f);
try {
f = '/!DataSpaces/Version';
data = CFB.find(cfb, f); if(!data || !data.content) throw new Error("ECMA-376 Encrypted file missing " + f);
/*var version = */parse_DataSpaceVersionInfo(data.content);
/* 2.3.4.1 */
f = '/!DataSpaces/DataSpaceMap';
data = CFB.find(cfb, f); if(!data || !data.content) throw new Error("ECMA-376 Encrypted file missing " + f);
var dsm = parse_DataSpaceMap(data.content);
if(dsm.length !== 1 || dsm[0].comps.length !== 1 || dsm[0].comps[0].t !== 0 || dsm[0].name !== "StrongEncryptionDataSpace" || dsm[0].comps[0].v !== "EncryptedPackage")
throw new Error("ECMA-376 Encrypted file bad " + f);
/* 2.3.4.2 */
f = '/!DataSpaces/DataSpaceInfo/StrongEncryptionDataSpace';
data = CFB.find(cfb, f); if(!data || !data.content) throw new Error("ECMA-376 Encrypted file missing " + f);
var seds = parse_DataSpaceDefinition(data.content);
if(seds.length != 1 || seds[0] != "StrongEncryptionTransform")
throw new Error("ECMA-376 Encrypted file bad " + f);
/* 2.3.4.3 */
f = '/!DataSpaces/TransformInfo/StrongEncryptionTransform/!Primary';
data = CFB.find(cfb, f); if(!data || !data.content) throw new Error("ECMA-376 Encrypted file missing " + f);
/*var hdr = */parse_Primary(data.content);
} catch(e) {}
f = '/EncryptionInfo';
data = CFB.find(cfb, f); if(!data || !data.content) throw new Error("ECMA-376 Encrypted file missing " + f);
var einfo = parse_EncryptionInfo(data.content);
/* 2.3.4.4 */
f = '/EncryptedPackage';
data = CFB.find(cfb, f); if(!data || !data.content) throw new Error("ECMA-376 Encrypted file missing " + f);
/*global decrypt_agile */
if(einfo[0] == 0x04 && typeof decrypt_agile !== 'undefined') return decrypt_agile(einfo[1], data.content, opts.password || "", opts);
/*global decrypt_std76 */
if(einfo[0] == 0x02 && typeof decrypt_std76 !== 'undefined') return decrypt_std76(einfo[1], data.content, opts.password || "", opts);
throw new Error("File is password-protected");
} | javascript | function parse_xlsxcfb(cfb, _opts) {
var opts = _opts || {};
var f = 'Workbook', data = CFB.find(cfb, f);
try {
f = '/!DataSpaces/Version';
data = CFB.find(cfb, f); if(!data || !data.content) throw new Error("ECMA-376 Encrypted file missing " + f);
/*var version = */parse_DataSpaceVersionInfo(data.content);
/* 2.3.4.1 */
f = '/!DataSpaces/DataSpaceMap';
data = CFB.find(cfb, f); if(!data || !data.content) throw new Error("ECMA-376 Encrypted file missing " + f);
var dsm = parse_DataSpaceMap(data.content);
if(dsm.length !== 1 || dsm[0].comps.length !== 1 || dsm[0].comps[0].t !== 0 || dsm[0].name !== "StrongEncryptionDataSpace" || dsm[0].comps[0].v !== "EncryptedPackage")
throw new Error("ECMA-376 Encrypted file bad " + f);
/* 2.3.4.2 */
f = '/!DataSpaces/DataSpaceInfo/StrongEncryptionDataSpace';
data = CFB.find(cfb, f); if(!data || !data.content) throw new Error("ECMA-376 Encrypted file missing " + f);
var seds = parse_DataSpaceDefinition(data.content);
if(seds.length != 1 || seds[0] != "StrongEncryptionTransform")
throw new Error("ECMA-376 Encrypted file bad " + f);
/* 2.3.4.3 */
f = '/!DataSpaces/TransformInfo/StrongEncryptionTransform/!Primary';
data = CFB.find(cfb, f); if(!data || !data.content) throw new Error("ECMA-376 Encrypted file missing " + f);
/*var hdr = */parse_Primary(data.content);
} catch(e) {}
f = '/EncryptionInfo';
data = CFB.find(cfb, f); if(!data || !data.content) throw new Error("ECMA-376 Encrypted file missing " + f);
var einfo = parse_EncryptionInfo(data.content);
/* 2.3.4.4 */
f = '/EncryptedPackage';
data = CFB.find(cfb, f); if(!data || !data.content) throw new Error("ECMA-376 Encrypted file missing " + f);
/*global decrypt_agile */
if(einfo[0] == 0x04 && typeof decrypt_agile !== 'undefined') return decrypt_agile(einfo[1], data.content, opts.password || "", opts);
/*global decrypt_std76 */
if(einfo[0] == 0x02 && typeof decrypt_std76 !== 'undefined') return decrypt_std76(einfo[1], data.content, opts.password || "", opts);
throw new Error("File is password-protected");
} | [
"function",
"parse_xlsxcfb",
"(",
"cfb",
",",
"_opts",
")",
"{",
"var",
"opts",
"=",
"_opts",
"||",
"{",
"}",
";",
"var",
"f",
"=",
"'Workbook'",
",",
"data",
"=",
"CFB",
".",
"find",
"(",
"cfb",
",",
"f",
")",
";",
"try",
"{",
"f",
"=",
"'/!Da... | /* [MS-OFFCRYPTO] 2.1.1 | [
"/",
"*",
"[",
"MS",
"-",
"OFFCRYPTO",
"]",
"2",
".",
"1",
".",
"1"
] | 9a6d8a1d3d80c78dad5201fb389316f935279cdc | https://github.com/SheetJS/js-xlsx/blob/9a6d8a1d3d80c78dad5201fb389316f935279cdc/xlsx.js#L20067-L20108 | train | Parse a CFB containing a single encrypted package | [
30522,
3853,
11968,
3366,
1035,
28712,
2015,
2595,
2278,
26337,
1006,
12935,
2497,
1010,
1035,
23569,
2015,
1007,
1063,
13075,
23569,
2015,
1027,
1035,
23569,
2015,
1064,
1064,
1063,
1065,
1025,
13075,
1042,
1027,
1005,
2147,
8654,
1005,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.commons/src/sap/ui/commons/RoadMap.js | function(oThis, sDir){
if (!oThis.sCurrentFocusedStepRefId) {
return;
}
if (sDir && !RoadMapRenderer.isVisibleRef(oThis, oThis.sCurrentFocusedStepRefId)) {
focusStep(null, oThis, sDir);
} else {
document.getElementById(oThis.sCurrentFocusedStepRefId + "-box").focus();
}
} | javascript | function(oThis, sDir){
if (!oThis.sCurrentFocusedStepRefId) {
return;
}
if (sDir && !RoadMapRenderer.isVisibleRef(oThis, oThis.sCurrentFocusedStepRefId)) {
focusStep(null, oThis, sDir);
} else {
document.getElementById(oThis.sCurrentFocusedStepRefId + "-box").focus();
}
} | [
"function",
"(",
"oThis",
",",
"sDir",
")",
"{",
"if",
"(",
"!",
"oThis",
".",
"sCurrentFocusedStepRefId",
")",
"{",
"return",
";",
"}",
"if",
"(",
"sDir",
"&&",
"!",
"RoadMapRenderer",
".",
"isVisibleRef",
"(",
"oThis",
",",
"oThis",
".",
"sCurrentFocus... | Sets the focus on the current focused step again. If the current focused step is not visible anymore the following step in the given direction is focused. Allowed directions are: next, prev, first, last | [
"Sets",
"the",
"focus",
"on",
"the",
"current",
"focused",
"step",
"again",
".",
"If",
"the",
"current",
"focused",
"step",
"is",
"not",
"visible",
"anymore",
"the",
"following",
"step",
"in",
"the",
"given",
"direction",
"is",
"focused",
".",
"Allowed",
"... | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.commons/src/sap/ui/commons/RoadMap.js#L518-L528 | train | Focuses the currently focused step | [
30522,
3853,
1006,
27178,
24158,
1010,
17371,
4313,
1007,
1063,
2065,
1006,
999,
27178,
24158,
1012,
8040,
29264,
14876,
7874,
2098,
13473,
28139,
8873,
2094,
1007,
1063,
2709,
1025,
1065,
2065,
1006,
17371,
4313,
1004,
30524,
24158,
1010,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
angular/material | src/components/dialog/dialog.js | function(ev) {
if (sourceElem === target[0] && ev.target === target[0]) {
ev.stopPropagation();
ev.preventDefault();
smartClose();
}
} | javascript | function(ev) {
if (sourceElem === target[0] && ev.target === target[0]) {
ev.stopPropagation();
ev.preventDefault();
smartClose();
}
} | [
"function",
"(",
"ev",
")",
"{",
"if",
"(",
"sourceElem",
"===",
"target",
"[",
"0",
"]",
"&&",
"ev",
".",
"target",
"===",
"target",
"[",
"0",
"]",
")",
"{",
"ev",
".",
"stopPropagation",
"(",
")",
";",
"ev",
".",
"preventDefault",
"(",
")",
";"... | We check if our original element and the target is the backdrop because if the original was the backdrop and the target was inside the dialog we don't want to dialog to close. | [
"We",
"check",
"if",
"our",
"original",
"element",
"and",
"the",
"target",
"is",
"the",
"backdrop",
"because",
"if",
"the",
"original",
"was",
"the",
"backdrop",
"and",
"the",
"target",
"was",
"inside",
"the",
"dialog",
"we",
"don",
"t",
"want",
"to",
"d... | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/dialog/dialog.js#L1009-L1016 | train | onmouseover event | [
30522,
3853,
1006,
23408,
1007,
1063,
2065,
1006,
3120,
12260,
2213,
1027,
1027,
1027,
4539,
1031,
1014,
1033,
1004,
1004,
23408,
1012,
4539,
1027,
1027,
1027,
4539,
1031,
1014,
1033,
1007,
1063,
23408,
1012,
2644,
21572,
4502,
12540,
1006,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
jgraph/mxgraph | javascript/mxClient.js | function(x0, y0, r1, r2, angle, largeArcFlag, sweepFlag, x, y)
{
x -= x0;
y -= y0;
if (r1 === 0 || r2 === 0)
{
return result;
}
var fS = sweepFlag;
var psai = angle;
r1 = Math.abs(r1);
r2 = Math.abs(r2);
var ctx = -x / 2;
var cty = -y / 2;
var cpsi = Math.cos(psai * Math.PI / 180);
var spsi = Math.sin(psai * Math.PI / 180);
var rxd = cpsi * ctx + spsi * cty;
var ryd = -1 * spsi * ctx + cpsi * cty;
var rxdd = rxd * rxd;
var rydd = ryd * ryd;
var r1x = r1 * r1;
var r2y = r2 * r2;
var lamda = rxdd / r1x + rydd / r2y;
var sds;
if (lamda > 1)
{
r1 = Math.sqrt(lamda) * r1;
r2 = Math.sqrt(lamda) * r2;
sds = 0;
}
else
{
var seif = 1;
if (largeArcFlag === fS)
{
seif = -1;
}
sds = seif * Math.sqrt((r1x * r2y - r1x * rydd - r2y * rxdd) / (r1x * rydd + r2y * rxdd));
}
var txd = sds * r1 * ryd / r2;
var tyd = -1 * sds * r2 * rxd / r1;
var tx = cpsi * txd - spsi * tyd + x / 2;
var ty = spsi * txd + cpsi * tyd + y / 2;
var rad = Math.atan2((ryd - tyd) / r2, (rxd - txd) / r1) - Math.atan2(0, 1);
var s1 = (rad >= 0) ? rad : 2 * Math.PI + rad;
rad = Math.atan2((-ryd - tyd) / r2, (-rxd - txd) / r1) - Math.atan2((ryd - tyd) / r2, (rxd - txd) / r1);
var dr = (rad >= 0) ? rad : 2 * Math.PI + rad;
if (fS == 0 && dr > 0)
{
dr -= 2 * Math.PI;
}
else if (fS != 0 && dr < 0)
{
dr += 2 * Math.PI;
}
var sse = dr * 2 / Math.PI;
var seg = Math.ceil(sse < 0 ? -1 * sse : sse);
var segr = dr / seg;
var t = 8/3 * Math.sin(segr / 4) * Math.sin(segr / 4) / Math.sin(segr / 2);
var cpsir1 = cpsi * r1;
var cpsir2 = cpsi * r2;
var spsir1 = spsi * r1;
var spsir2 = spsi * r2;
var mc = Math.cos(s1);
var ms = Math.sin(s1);
var x2 = -t * (cpsir1 * ms + spsir2 * mc);
var y2 = -t * (spsir1 * ms - cpsir2 * mc);
var x3 = 0;
var y3 = 0;
var result = [];
for (var n = 0; n < seg; ++n)
{
s1 += segr;
mc = Math.cos(s1);
ms = Math.sin(s1);
x3 = cpsir1 * mc - spsir2 * ms + tx;
y3 = spsir1 * mc + cpsir2 * ms + ty;
var dx = -t * (cpsir1 * ms + spsir2 * mc);
var dy = -t * (spsir1 * ms - cpsir2 * mc);
// CurveTo updates x0, y0 so need to restore it
var index = n * 6;
result[index] = Number(x2 + x0);
result[index + 1] = Number(y2 + y0);
result[index + 2] = Number(x3 - dx + x0);
result[index + 3] = Number(y3 - dy + y0);
result[index + 4] = Number(x3 + x0);
result[index + 5] = Number(y3 + y0);
x2 = x3 + dx;
y2 = y3 + dy;
}
return result;
} | javascript | function(x0, y0, r1, r2, angle, largeArcFlag, sweepFlag, x, y)
{
x -= x0;
y -= y0;
if (r1 === 0 || r2 === 0)
{
return result;
}
var fS = sweepFlag;
var psai = angle;
r1 = Math.abs(r1);
r2 = Math.abs(r2);
var ctx = -x / 2;
var cty = -y / 2;
var cpsi = Math.cos(psai * Math.PI / 180);
var spsi = Math.sin(psai * Math.PI / 180);
var rxd = cpsi * ctx + spsi * cty;
var ryd = -1 * spsi * ctx + cpsi * cty;
var rxdd = rxd * rxd;
var rydd = ryd * ryd;
var r1x = r1 * r1;
var r2y = r2 * r2;
var lamda = rxdd / r1x + rydd / r2y;
var sds;
if (lamda > 1)
{
r1 = Math.sqrt(lamda) * r1;
r2 = Math.sqrt(lamda) * r2;
sds = 0;
}
else
{
var seif = 1;
if (largeArcFlag === fS)
{
seif = -1;
}
sds = seif * Math.sqrt((r1x * r2y - r1x * rydd - r2y * rxdd) / (r1x * rydd + r2y * rxdd));
}
var txd = sds * r1 * ryd / r2;
var tyd = -1 * sds * r2 * rxd / r1;
var tx = cpsi * txd - spsi * tyd + x / 2;
var ty = spsi * txd + cpsi * tyd + y / 2;
var rad = Math.atan2((ryd - tyd) / r2, (rxd - txd) / r1) - Math.atan2(0, 1);
var s1 = (rad >= 0) ? rad : 2 * Math.PI + rad;
rad = Math.atan2((-ryd - tyd) / r2, (-rxd - txd) / r1) - Math.atan2((ryd - tyd) / r2, (rxd - txd) / r1);
var dr = (rad >= 0) ? rad : 2 * Math.PI + rad;
if (fS == 0 && dr > 0)
{
dr -= 2 * Math.PI;
}
else if (fS != 0 && dr < 0)
{
dr += 2 * Math.PI;
}
var sse = dr * 2 / Math.PI;
var seg = Math.ceil(sse < 0 ? -1 * sse : sse);
var segr = dr / seg;
var t = 8/3 * Math.sin(segr / 4) * Math.sin(segr / 4) / Math.sin(segr / 2);
var cpsir1 = cpsi * r1;
var cpsir2 = cpsi * r2;
var spsir1 = spsi * r1;
var spsir2 = spsi * r2;
var mc = Math.cos(s1);
var ms = Math.sin(s1);
var x2 = -t * (cpsir1 * ms + spsir2 * mc);
var y2 = -t * (spsir1 * ms - cpsir2 * mc);
var x3 = 0;
var y3 = 0;
var result = [];
for (var n = 0; n < seg; ++n)
{
s1 += segr;
mc = Math.cos(s1);
ms = Math.sin(s1);
x3 = cpsir1 * mc - spsir2 * ms + tx;
y3 = spsir1 * mc + cpsir2 * ms + ty;
var dx = -t * (cpsir1 * ms + spsir2 * mc);
var dy = -t * (spsir1 * ms - cpsir2 * mc);
// CurveTo updates x0, y0 so need to restore it
var index = n * 6;
result[index] = Number(x2 + x0);
result[index + 1] = Number(y2 + y0);
result[index + 2] = Number(x3 - dx + x0);
result[index + 3] = Number(y3 - dy + y0);
result[index + 4] = Number(x3 + x0);
result[index + 5] = Number(y3 + y0);
x2 = x3 + dx;
y2 = y3 + dy;
}
return result;
} | [
"function",
"(",
"x0",
",",
"y0",
",",
"r1",
",",
"r2",
",",
"angle",
",",
"largeArcFlag",
",",
"sweepFlag",
",",
"x",
",",
"y",
")",
"{",
"x",
"-=",
"x0",
";",
"y",
"-=",
"y0",
";",
"if",
"(",
"r1",
"===",
"0",
"||",
"r2",
"===",
"0",
")",... | Function: arcToCurves
Converts the given arc to a series of curves. | [
"Function",
":",
"arcToCurves"
] | 33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44 | https://github.com/jgraph/mxgraph/blob/33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44/javascript/mxClient.js#L4093-L4198 | train | Calculate the arc angle | [
30522,
3853,
1006,
1060,
2692,
1010,
1061,
2692,
1010,
1054,
2487,
1010,
1054,
2475,
1010,
6466,
1010,
2312,
2906,
2278,
10258,
8490,
1010,
11740,
10258,
8490,
1010,
1060,
1010,
1061,
1007,
1063,
1060,
1011,
1027,
1060,
2692,
1025,
1061,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | src/sap.ui.dt/src/sap/ui/dt/ContextMenuControl.js | function (oSource, bContextMenu, oContextMenuPosition) {
if (this._bUseExpPop === undefined) {
this._bUseExpPop = !!bContextMenu;
}
this._bCompactMode = jQuery(oSource.getDomRef()).closest(".sapUiSizeCompact").length > 0;
this._bOpenAsContextMenu = bContextMenu;
this._oContextMenuPosition = oContextMenuPosition;
this.getPopover(true).addStyleClass(this.getStyleClass());
this.getPopover(false).addStyleClass(this.getStyleClass());
// creates buttons specified in objects in property buttons
var aButtons = this.getButtons();
this._oTarget = oSource;
if (!this._bOpenAsContextMenu) {
this._setButtonsForContextMenu(aButtons, oSource);
} else {
this._makeAllButtonsVisible(aButtons);
}
if (this.bOnInit || !this.getPopover().isOpen()) { // if there was no other ContextMenu open before
this.finalizeOpening();
this.bOnInit = false;
}
} | javascript | function (oSource, bContextMenu, oContextMenuPosition) {
if (this._bUseExpPop === undefined) {
this._bUseExpPop = !!bContextMenu;
}
this._bCompactMode = jQuery(oSource.getDomRef()).closest(".sapUiSizeCompact").length > 0;
this._bOpenAsContextMenu = bContextMenu;
this._oContextMenuPosition = oContextMenuPosition;
this.getPopover(true).addStyleClass(this.getStyleClass());
this.getPopover(false).addStyleClass(this.getStyleClass());
// creates buttons specified in objects in property buttons
var aButtons = this.getButtons();
this._oTarget = oSource;
if (!this._bOpenAsContextMenu) {
this._setButtonsForContextMenu(aButtons, oSource);
} else {
this._makeAllButtonsVisible(aButtons);
}
if (this.bOnInit || !this.getPopover().isOpen()) { // if there was no other ContextMenu open before
this.finalizeOpening();
this.bOnInit = false;
}
} | [
"function",
"(",
"oSource",
",",
"bContextMenu",
",",
"oContextMenuPosition",
")",
"{",
"if",
"(",
"this",
".",
"_bUseExpPop",
"===",
"undefined",
")",
"{",
"this",
".",
"_bUseExpPop",
"=",
"!",
"!",
"bContextMenu",
";",
"}",
"this",
".",
"_bCompactMode",
... | Opens the ContextMenu and sets the ContextMenu position by the oSource parameter.
Note: this gets called before the old Menu is closed because of asynchronus animations.
@param {sap.ui.core.Control} oSource - The control by which the Popover will be placed.
@param {boolean} bContextMenu - If the ContextMenu should appear as Context Menu
@param {Object} oContextMenuPosition - The position of the ContextMenu if it should be opened as Context Menu (only needed if bContextMenu)
@public | [
"Opens",
"the",
"ContextMenu",
"and",
"sets",
"the",
"ContextMenu",
"position",
"by",
"the",
"oSource",
"parameter",
".",
"Note",
":",
"this",
"gets",
"called",
"before",
"the",
"old",
"Menu",
"is",
"closed",
"because",
"of",
"asynchronus",
"animations",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.dt/src/sap/ui/dt/ContextMenuControl.js#L160-L186 | train | Sets the context menu to the given source object. | [
30522,
3853,
1006,
9808,
8162,
3401,
1010,
4647,
28040,
18413,
3549,
2226,
1010,
1051,
8663,
18209,
3549,
6279,
19234,
1007,
1063,
2065,
1006,
2023,
1012,
1035,
3902,
4402,
2595,
9397,
7361,
1027,
1027,
1027,
6151,
28344,
1007,
1063,
2023,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
BlackrockDigital/startbootstrap-sb-admin-2 | vendor/chart.js/Chart.js | generateTicks$1 | function generateTicks$1(generationOptions, dataRange) {
var ticks = [];
var tickVal = valueOrDefault$a(generationOptions.min, Math.pow(10, Math.floor(helpers$1.log10(dataRange.min))));
var endExp = Math.floor(helpers$1.log10(dataRange.max));
var endSignificand = Math.ceil(dataRange.max / Math.pow(10, endExp));
var exp, significand;
if (tickVal === 0) {
exp = Math.floor(helpers$1.log10(dataRange.minNotZero));
significand = Math.floor(dataRange.minNotZero / Math.pow(10, exp));
ticks.push(tickVal);
tickVal = significand * Math.pow(10, exp);
} else {
exp = Math.floor(helpers$1.log10(tickVal));
significand = Math.floor(tickVal / Math.pow(10, exp));
}
var precision = exp < 0 ? Math.pow(10, Math.abs(exp)) : 1;
do {
ticks.push(tickVal);
++significand;
if (significand === 10) {
significand = 1;
++exp;
precision = exp >= 0 ? 1 : precision;
}
tickVal = Math.round(significand * Math.pow(10, exp) * precision) / precision;
} while (exp < endExp || (exp === endExp && significand < endSignificand));
var lastTick = valueOrDefault$a(generationOptions.max, tickVal);
ticks.push(lastTick);
return ticks;
} | javascript | function generateTicks$1(generationOptions, dataRange) {
var ticks = [];
var tickVal = valueOrDefault$a(generationOptions.min, Math.pow(10, Math.floor(helpers$1.log10(dataRange.min))));
var endExp = Math.floor(helpers$1.log10(dataRange.max));
var endSignificand = Math.ceil(dataRange.max / Math.pow(10, endExp));
var exp, significand;
if (tickVal === 0) {
exp = Math.floor(helpers$1.log10(dataRange.minNotZero));
significand = Math.floor(dataRange.minNotZero / Math.pow(10, exp));
ticks.push(tickVal);
tickVal = significand * Math.pow(10, exp);
} else {
exp = Math.floor(helpers$1.log10(tickVal));
significand = Math.floor(tickVal / Math.pow(10, exp));
}
var precision = exp < 0 ? Math.pow(10, Math.abs(exp)) : 1;
do {
ticks.push(tickVal);
++significand;
if (significand === 10) {
significand = 1;
++exp;
precision = exp >= 0 ? 1 : precision;
}
tickVal = Math.round(significand * Math.pow(10, exp) * precision) / precision;
} while (exp < endExp || (exp === endExp && significand < endSignificand));
var lastTick = valueOrDefault$a(generationOptions.max, tickVal);
ticks.push(lastTick);
return ticks;
} | [
"function",
"generateTicks$1",
"(",
"generationOptions",
",",
"dataRange",
")",
"{",
"var",
"ticks",
"=",
"[",
"]",
";",
"var",
"tickVal",
"=",
"valueOrDefault$a",
"(",
"generationOptions",
".",
"min",
",",
"Math",
".",
"pow",
"(",
"10",
",",
"Math",
".",
... | Generate a set of logarithmic ticks
@param generationOptions the options used to generate the ticks
@param dataRange the range of the data
@returns {number[]} array of tick values | [
"Generate",
"a",
"set",
"of",
"logarithmic",
"ticks"
] | ddfaceb4a8e65a41f163e2fdc4eab49384b810a1 | https://github.com/BlackrockDigital/startbootstrap-sb-admin-2/blob/ddfaceb4a8e65a41f163e2fdc4eab49384b810a1/vendor/chart.js/Chart.js#L11684-L11722 | train | Generate ticks from the given data range | [
30522,
3853,
9699,
26348,
2015,
1002,
1015,
1006,
4245,
7361,
9285,
1010,
2951,
24388,
2063,
1007,
1063,
13075,
16356,
2015,
1027,
1031,
1033,
1025,
13075,
16356,
10175,
1027,
3643,
8551,
12879,
23505,
1002,
1037,
1006,
4245,
7361,
9285,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SheetJS/js-xlsx | xlsx.js | parse_BrtHLink | function parse_BrtHLink(data, length) {
var end = data.l + length;
var rfx = parse_UncheckedRfX(data, 16);
var relId = parse_XLNullableWideString(data);
var loc = parse_XLWideString(data);
var tooltip = parse_XLWideString(data);
var display = parse_XLWideString(data);
data.l = end;
var o = ({rfx:rfx, relId:relId, loc:loc, display:display});
if(tooltip) o.Tooltip = tooltip;
return o;
} | javascript | function parse_BrtHLink(data, length) {
var end = data.l + length;
var rfx = parse_UncheckedRfX(data, 16);
var relId = parse_XLNullableWideString(data);
var loc = parse_XLWideString(data);
var tooltip = parse_XLWideString(data);
var display = parse_XLWideString(data);
data.l = end;
var o = ({rfx:rfx, relId:relId, loc:loc, display:display});
if(tooltip) o.Tooltip = tooltip;
return o;
} | [
"function",
"parse_BrtHLink",
"(",
"data",
",",
"length",
")",
"{",
"var",
"end",
"=",
"data",
".",
"l",
"+",
"length",
";",
"var",
"rfx",
"=",
"parse_UncheckedRfX",
"(",
"data",
",",
"16",
")",
";",
"var",
"relId",
"=",
"parse_XLNullableWideString",
"("... | /* [MS-XLSB] 2.4.662 BrtHLink | [
"/",
"*",
"[",
"MS",
"-",
"XLSB",
"]",
"2",
".",
"4",
".",
"662",
"BrtHLink"
] | 9a6d8a1d3d80c78dad5201fb389316f935279cdc | https://github.com/SheetJS/js-xlsx/blob/9a6d8a1d3d80c78dad5201fb389316f935279cdc/xlsx.js#L13638-L13649 | train | Parse a BrtHLink | [
30522,
3853,
11968,
30524,
4895,
5403,
18141,
12881,
2595,
1006,
2951,
1010,
2385,
1007,
1025,
13075,
2128,
21273,
1027,
11968,
3366,
1035,
28712,
11231,
4571,
3468,
22517,
3367,
4892,
1006,
2951,
1007,
1025,
13075,
8840,
2278,
1027,
11968,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
jhipster/generator-jhipster | generators/aws-containers/lib/cloudFormation.js | _doesEventContainsNestedStackId | function _doesEventContainsNestedStackId(stack) {
if (stack.ResourceType !== 'AWS::CloudFormation::Stack') {
return false;
}
if (stack.ResourceStatusReason !== 'Resource creation Initiated') {
return false;
}
if (stack.ResourceStatus !== 'CREATE_IN_PROGRESS') {
return false;
}
if (_.isNil(stack.PhysicalResourceId)) {
return false;
}
return _hasLabelNestedStackName(stack.PhysicalResourceId);
} | javascript | function _doesEventContainsNestedStackId(stack) {
if (stack.ResourceType !== 'AWS::CloudFormation::Stack') {
return false;
}
if (stack.ResourceStatusReason !== 'Resource creation Initiated') {
return false;
}
if (stack.ResourceStatus !== 'CREATE_IN_PROGRESS') {
return false;
}
if (_.isNil(stack.PhysicalResourceId)) {
return false;
}
return _hasLabelNestedStackName(stack.PhysicalResourceId);
} | [
"function",
"_doesEventContainsNestedStackId",
"(",
"stack",
")",
"{",
"if",
"(",
"stack",
".",
"ResourceType",
"!==",
"'AWS::CloudFormation::Stack'",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"stack",
".",
"ResourceStatusReason",
"!==",
"'Resource creation ... | Check if the stack event contains the name a Nested Stack name.
@param stack The StackEvent object.
@returns {boolean} true if the object contain a Nested Stack name, false otherwise.
@private | [
"Check",
"if",
"the",
"stack",
"event",
"contains",
"the",
"name",
"a",
"Nested",
"Stack",
"name",
"."
] | f76fa8de0818ce6bda6c7b1455942e2a9b0ae3ff | https://github.com/jhipster/generator-jhipster/blob/f76fa8de0818ce6bda6c7b1455942e2a9b0ae3ff/generators/aws-containers/lib/cloudFormation.js#L266-L281 | train | Returns true if the event contains a nested stack ID | [
30522,
3853,
1035,
2515,
18697,
3372,
8663,
18249,
2015,
5267,
3064,
9153,
18009,
2094,
1006,
9991,
1007,
1063,
2065,
1006,
9991,
1012,
7692,
13874,
999,
1027,
1027,
1005,
22091,
2015,
1024,
1024,
6112,
14192,
3370,
1024,
1024,
9991,
1005,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
dcloudio/mui | examples/login/libs/easymob-webim-sdk/strophe-custom-2.0.0.js | function (bodyWrap, connectstatus) {
var errors = bodyWrap.getElementsByTagNameNS(Strophe.NS.STREAM, "error");
if (errors.length === 0) {
return false;
}
var error = errors[0];
var condition = "";
var text = "";
var ns = "urn:ietf:params:xml:ns:xmpp-streams";
for (var i = 0; i < error.childNodes.length; i++) {
var e = error.childNodes[i];
if (e.getAttribute("xmlns") !== ns) {
break;
} if (e.nodeName === "text") {
text = e.textContent;
} else {
condition = e.nodeName;
}
}
var errorString = "WebSocket stream error: ";
if (condition) {
errorString += condition;
} else {
errorString += "unknown";
}
if (text) {
errorString += " - " + condition;
}
Strophe.error(errorString);
// close the connection on stream_error
this._conn._changeConnectStatus(connectstatus, condition);
this._conn._doDisconnect();
return true;
} | javascript | function (bodyWrap, connectstatus) {
var errors = bodyWrap.getElementsByTagNameNS(Strophe.NS.STREAM, "error");
if (errors.length === 0) {
return false;
}
var error = errors[0];
var condition = "";
var text = "";
var ns = "urn:ietf:params:xml:ns:xmpp-streams";
for (var i = 0; i < error.childNodes.length; i++) {
var e = error.childNodes[i];
if (e.getAttribute("xmlns") !== ns) {
break;
} if (e.nodeName === "text") {
text = e.textContent;
} else {
condition = e.nodeName;
}
}
var errorString = "WebSocket stream error: ";
if (condition) {
errorString += condition;
} else {
errorString += "unknown";
}
if (text) {
errorString += " - " + condition;
}
Strophe.error(errorString);
// close the connection on stream_error
this._conn._changeConnectStatus(connectstatus, condition);
this._conn._doDisconnect();
return true;
} | [
"function",
"(",
"bodyWrap",
",",
"connectstatus",
")",
"{",
"var",
"errors",
"=",
"bodyWrap",
".",
"getElementsByTagNameNS",
"(",
"Strophe",
".",
"NS",
".",
"STREAM",
",",
"\"error\"",
")",
";",
"if",
"(",
"errors",
".",
"length",
"===",
"0",
")",
"{",
... | PrivateFunction: _check_streamerror
_Private_ checks a message for stream:error
Parameters:
(Strophe.Request) bodyWrap - The received stanza.
connectstatus - The ConnectStatus that will be set on error.
Returns:
true if there was a streamerror, false otherwise. | [
"PrivateFunction",
":",
"_check_streamerror",
"_Private_",
"checks",
"a",
"message",
"for",
"stream",
":",
"error"
] | ff74c90a1671a552f3604b1288bf38a4126312d0 | https://github.com/dcloudio/mui/blob/ff74c90a1671a552f3604b1288bf38a4126312d0/examples/login/libs/easymob-webim-sdk/strophe-custom-2.0.0.js#L4803-L4843 | train | An error message from the server | [
30522,
3853,
1006,
2303,
13088,
9331,
1010,
8539,
29336,
2271,
1007,
1063,
13075,
10697,
1027,
2303,
13088,
9331,
1012,
2131,
12260,
8163,
3762,
15900,
18442,
3619,
1006,
2358,
18981,
5369,
1012,
24978,
1012,
5460,
1010,
1000,
7561,
1000,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
swimlane/ngx-datatable | release/utils/sort.js | sortRows | function sortRows(rows, columns, dirs) {
if (!rows)
return [];
if (!dirs || !dirs.length || !columns)
return rows.slice();
/**
* record the row ordering of results from prior sort operations (if applicable)
* this is necessary to guarantee stable sorting behavior
*/
var rowToIndexMap = new Map();
rows.forEach(function (row, index) { return rowToIndexMap.set(row, index); });
var temp = rows.slice();
var cols = columns.reduce(function (obj, col) {
if (col.comparator && typeof col.comparator === 'function') {
obj[col.prop] = col.comparator;
}
return obj;
}, {});
// cache valueGetter and compareFn so that they
// do not need to be looked-up in the sort function body
var cachedDirs = dirs.map(function (dir) {
var prop = dir.prop;
return {
prop: prop,
dir: dir.dir,
valueGetter: column_prop_getters_1.getterForProp(prop),
compareFn: cols[prop] || orderByComparator
};
});
return temp.sort(function (rowA, rowB) {
for (var _i = 0, cachedDirs_1 = cachedDirs; _i < cachedDirs_1.length; _i++) {
var cachedDir = cachedDirs_1[_i];
// Get property and valuegetters for column to be sorted
var prop = cachedDir.prop, valueGetter = cachedDir.valueGetter;
// Get A and B cell values from rows based on properties of the columns
var propA = valueGetter(rowA, prop);
var propB = valueGetter(rowB, prop);
// Compare function gets five parameters:
// Two cell values to be compared as propA and propB
// Two rows corresponding to the cells as rowA and rowB
// Direction of the sort for this column as SortDirection
// Compare can be a standard JS comparison function (a,b) => -1|0|1
// as additional parameters are silently ignored. The whole row and sort
// direction enable more complex sort logic.
var comparison = cachedDir.dir !== types_1.SortDirection.desc ?
cachedDir.compareFn(propA, propB, rowA, rowB, cachedDir.dir) :
-cachedDir.compareFn(propA, propB, rowA, rowB, cachedDir.dir);
// Don't return 0 yet in case of needing to sort by next property
if (comparison !== 0)
return comparison;
}
if (!(rowToIndexMap.has(rowA) && rowToIndexMap.has(rowB)))
return 0;
/**
* all else being equal, preserve original order of the rows (stable sort)
*/
return rowToIndexMap.get(rowA) < rowToIndexMap.get(rowB) ? -1 : 1;
});
} | javascript | function sortRows(rows, columns, dirs) {
if (!rows)
return [];
if (!dirs || !dirs.length || !columns)
return rows.slice();
/**
* record the row ordering of results from prior sort operations (if applicable)
* this is necessary to guarantee stable sorting behavior
*/
var rowToIndexMap = new Map();
rows.forEach(function (row, index) { return rowToIndexMap.set(row, index); });
var temp = rows.slice();
var cols = columns.reduce(function (obj, col) {
if (col.comparator && typeof col.comparator === 'function') {
obj[col.prop] = col.comparator;
}
return obj;
}, {});
// cache valueGetter and compareFn so that they
// do not need to be looked-up in the sort function body
var cachedDirs = dirs.map(function (dir) {
var prop = dir.prop;
return {
prop: prop,
dir: dir.dir,
valueGetter: column_prop_getters_1.getterForProp(prop),
compareFn: cols[prop] || orderByComparator
};
});
return temp.sort(function (rowA, rowB) {
for (var _i = 0, cachedDirs_1 = cachedDirs; _i < cachedDirs_1.length; _i++) {
var cachedDir = cachedDirs_1[_i];
// Get property and valuegetters for column to be sorted
var prop = cachedDir.prop, valueGetter = cachedDir.valueGetter;
// Get A and B cell values from rows based on properties of the columns
var propA = valueGetter(rowA, prop);
var propB = valueGetter(rowB, prop);
// Compare function gets five parameters:
// Two cell values to be compared as propA and propB
// Two rows corresponding to the cells as rowA and rowB
// Direction of the sort for this column as SortDirection
// Compare can be a standard JS comparison function (a,b) => -1|0|1
// as additional parameters are silently ignored. The whole row and sort
// direction enable more complex sort logic.
var comparison = cachedDir.dir !== types_1.SortDirection.desc ?
cachedDir.compareFn(propA, propB, rowA, rowB, cachedDir.dir) :
-cachedDir.compareFn(propA, propB, rowA, rowB, cachedDir.dir);
// Don't return 0 yet in case of needing to sort by next property
if (comparison !== 0)
return comparison;
}
if (!(rowToIndexMap.has(rowA) && rowToIndexMap.has(rowB)))
return 0;
/**
* all else being equal, preserve original order of the rows (stable sort)
*/
return rowToIndexMap.get(rowA) < rowToIndexMap.get(rowB) ? -1 : 1;
});
} | [
"function",
"sortRows",
"(",
"rows",
",",
"columns",
",",
"dirs",
")",
"{",
"if",
"(",
"!",
"rows",
")",
"return",
"[",
"]",
";",
"if",
"(",
"!",
"dirs",
"||",
"!",
"dirs",
".",
"length",
"||",
"!",
"columns",
")",
"return",
"rows",
".",
"slice",... | creates a shallow copy of the `rows` input and returns the sorted copy. this function
does not sort the `rows` argument in place | [
"creates",
"a",
"shallow",
"copy",
"of",
"the",
"rows",
"input",
"and",
"returns",
"the",
"sorted",
"copy",
".",
"this",
"function",
"does",
"not",
"sort",
"the",
"rows",
"argument",
"in",
"place"
] | d7df15a070282a169524dba51d9572008b74804c | https://github.com/swimlane/ngx-datatable/blob/d7df15a070282a169524dba51d9572008b74804c/release/utils/sort.js#L72-L130 | train | Sort rows according to the columns and dirs | [
30522,
3853,
4066,
10524,
2015,
1006,
10281,
1010,
7753,
1010,
16101,
2015,
1007,
1063,
2065,
1006,
999,
10281,
1007,
2709,
1031,
1033,
1025,
2065,
1006,
999,
16101,
2015,
1064,
1064,
999,
16101,
2015,
1012,
3091,
1064,
1064,
999,
7753,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.fl/src/sap/ui/fl/Utils.js | function(){
var oUshellContainer = Utils.getUshellContainer();
if (oUshellContainer) {
var oURLParser = oUshellContainer.getService("URLParsing");
var oParsedHash = oURLParser.parseShellHash(hasher.getHash());
return oParsedHash ? oParsedHash : { };
}
return { };
} | javascript | function(){
var oUshellContainer = Utils.getUshellContainer();
if (oUshellContainer) {
var oURLParser = oUshellContainer.getService("URLParsing");
var oParsedHash = oURLParser.parseShellHash(hasher.getHash());
return oParsedHash ? oParsedHash : { };
}
return { };
} | [
"function",
"(",
")",
"{",
"var",
"oUshellContainer",
"=",
"Utils",
".",
"getUshellContainer",
"(",
")",
";",
"if",
"(",
"oUshellContainer",
")",
"{",
"var",
"oURLParser",
"=",
"oUshellContainer",
".",
"getService",
"(",
"\"URLParsing\"",
")",
";",
"var",
"o... | Returns URL hash when ushell container is available
@returns {object} Returns the parsed URL hash object or an empty object if ushell container is not available | [
"Returns",
"URL",
"hash",
"when",
"ushell",
"container",
"is",
"available"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/Utils.js#L891-L899 | train | Returns the hash of the current shell. | [
30522,
3853,
1006,
1007,
1063,
13075,
15068,
4095,
5349,
8663,
18249,
2121,
1027,
21183,
12146,
1012,
2131,
20668,
5349,
8663,
18249,
2121,
1006,
1007,
1025,
2065,
1006,
15068,
4095,
5349,
8663,
18249,
2121,
1007,
1063,
13075,
2256,
14277,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
eslint/eslint | lib/rules/prefer-rest-params.js | report | function report(reference) {
context.report({
node: reference.identifier,
loc: reference.identifier.loc,
message: "Use the rest parameters instead of 'arguments'."
});
} | javascript | function report(reference) {
context.report({
node: reference.identifier,
loc: reference.identifier.loc,
message: "Use the rest parameters instead of 'arguments'."
});
} | [
"function",
"report",
"(",
"reference",
")",
"{",
"context",
".",
"report",
"(",
"{",
"node",
":",
"reference",
".",
"identifier",
",",
"loc",
":",
"reference",
".",
"identifier",
".",
"loc",
",",
"message",
":",
"\"Use the rest parameters instead of 'arguments'... | Reports a given reference.
@param {eslint-scope.Reference} reference - A reference to report.
@returns {void} | [
"Reports",
"a",
"given",
"reference",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/prefer-rest-params.js#L85-L91 | train | Report an error for a given reference. | [
30522,
3853,
3189,
1006,
4431,
1007,
1063,
6123,
1012,
3189,
1006,
1063,
13045,
1024,
4431,
1012,
8909,
4765,
18095,
1010,
8840,
2278,
1024,
4431,
1012,
8909,
4765,
18095,
1012,
8840,
2278,
1010,
4471,
1024,
1000,
2224,
1996,
2717,
11709,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
chartjs/Chart.js | src/helpers/helpers.core.js | function(value) {
if (Array.isArray && Array.isArray(value)) {
return true;
}
var type = Object.prototype.toString.call(value);
if (type.substr(0, 7) === '[object' && type.substr(-6) === 'Array]') {
return true;
}
return false;
} | javascript | function(value) {
if (Array.isArray && Array.isArray(value)) {
return true;
}
var type = Object.prototype.toString.call(value);
if (type.substr(0, 7) === '[object' && type.substr(-6) === 'Array]') {
return true;
}
return false;
} | [
"function",
"(",
"value",
")",
"{",
"if",
"(",
"Array",
".",
"isArray",
"&&",
"Array",
".",
"isArray",
"(",
"value",
")",
")",
"{",
"return",
"true",
";",
"}",
"var",
"type",
"=",
"Object",
".",
"prototype",
".",
"toString",
".",
"call",
"(",
"valu... | Returns true if `value` is an array (including typed arrays), else returns false.
@param {*} value - The value to test.
@returns {boolean}
@function | [
"Returns",
"true",
"if",
"value",
"is",
"an",
"array",
"(",
"including",
"typed",
"arrays",
")",
"else",
"returns",
"false",
"."
] | f093c36574d290330ed623e60fbd070421c730d5 | https://github.com/chartjs/Chart.js/blob/f093c36574d290330ed623e60fbd070421c730d5/src/helpers/helpers.core.js#L40-L49 | train | Check if value is an array | [
30522,
3853,
1006,
3643,
1007,
1063,
2065,
1006,
9140,
1012,
18061,
11335,
2100,
1004,
1004,
9140,
1012,
18061,
11335,
2100,
1006,
3643,
1007,
1007,
1063,
2709,
2995,
1025,
1065,
13075,
2828,
1027,
4874,
1012,
8773,
1012,
2000,
3367,
4892,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | src/sap.ui.core/src/sap/ui/core/BlockLayerUtils.js | suppressDefaultAndStopPropagation | function suppressDefaultAndStopPropagation(oEvent) {
var bTargetIsBlockLayer = oEvent.target === this.$blockLayer.get(0),
oTabbable;
if (bTargetIsBlockLayer && oEvent.type === 'keydown' && oEvent.keyCode === 9) {
// Special handling for "tab" keydown: redirect to next element before or after busy section
Log.debug("Local Busy Indicator Event keydown handled: " + oEvent.type);
oTabbable = oEvent.shiftKey ? this.oTabbableBefore : this.oTabbableAfter;
oTabbable.setAttribute("tabindex", -1);
// ignore execution of focus handler
this.bIgnoreFocus = true;
oTabbable.focus();
this.bIgnoreFocus = false;
oTabbable.setAttribute("tabindex", 0);
oEvent.stopImmediatePropagation();
} else if (bTargetIsBlockLayer && (oEvent.type === 'mousedown' || oEvent.type === 'touchstart')) {
// Do not "preventDefault" to allow to focus busy indicator
Log.debug("Local Busy Indicator click handled on busy area: " + oEvent.target.id);
oEvent.stopImmediatePropagation();
} else {
Log.debug("Local Busy Indicator Event Suppressed: " + oEvent.type);
oEvent.preventDefault();
oEvent.stopImmediatePropagation();
}
} | javascript | function suppressDefaultAndStopPropagation(oEvent) {
var bTargetIsBlockLayer = oEvent.target === this.$blockLayer.get(0),
oTabbable;
if (bTargetIsBlockLayer && oEvent.type === 'keydown' && oEvent.keyCode === 9) {
// Special handling for "tab" keydown: redirect to next element before or after busy section
Log.debug("Local Busy Indicator Event keydown handled: " + oEvent.type);
oTabbable = oEvent.shiftKey ? this.oTabbableBefore : this.oTabbableAfter;
oTabbable.setAttribute("tabindex", -1);
// ignore execution of focus handler
this.bIgnoreFocus = true;
oTabbable.focus();
this.bIgnoreFocus = false;
oTabbable.setAttribute("tabindex", 0);
oEvent.stopImmediatePropagation();
} else if (bTargetIsBlockLayer && (oEvent.type === 'mousedown' || oEvent.type === 'touchstart')) {
// Do not "preventDefault" to allow to focus busy indicator
Log.debug("Local Busy Indicator click handled on busy area: " + oEvent.target.id);
oEvent.stopImmediatePropagation();
} else {
Log.debug("Local Busy Indicator Event Suppressed: " + oEvent.type);
oEvent.preventDefault();
oEvent.stopImmediatePropagation();
}
} | [
"function",
"suppressDefaultAndStopPropagation",
"(",
"oEvent",
")",
"{",
"var",
"bTargetIsBlockLayer",
"=",
"oEvent",
".",
"target",
"===",
"this",
".",
"$blockLayer",
".",
"get",
"(",
"0",
")",
",",
"oTabbable",
";",
"if",
"(",
"bTargetIsBlockLayer",
"&&",
"... | Handler which suppresses event bubbling for blocked section
@param {object} oEvent The event on the suppressed DOM
@private | [
"Handler",
"which",
"suppresses",
"event",
"bubbling",
"for",
"blocked",
"section"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/BlockLayerUtils.js#L215-L241 | train | This function is called by the event handler when the event is handled by the Local Busy Indicator. | [
30522,
3853,
16081,
3207,
7011,
11314,
29560,
14399,
21572,
4502,
12540,
1006,
1051,
18697,
3372,
1007,
1063,
13075,
18411,
2906,
18150,
2483,
23467,
24314,
1027,
1051,
18697,
3372,
1012,
4539,
1027,
1027,
1027,
2023,
1012,
1002,
3796,
24314,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/core/Configuration.js | function(bRTL) {
check(bRTL === null || typeof bRTL === "boolean", "bRTL must be null or a boolean");
var oldRTL = this.getRTL(),
mChanges;
this.rtl = bRTL;
if ( oldRTL != this.getRTL() ) { // also take the derived RTL flag into account for the before/after comparison!
mChanges = this._collect();
mChanges.rtl = this.getRTL();
this._endCollect();
}
return this;
} | javascript | function(bRTL) {
check(bRTL === null || typeof bRTL === "boolean", "bRTL must be null or a boolean");
var oldRTL = this.getRTL(),
mChanges;
this.rtl = bRTL;
if ( oldRTL != this.getRTL() ) { // also take the derived RTL flag into account for the before/after comparison!
mChanges = this._collect();
mChanges.rtl = this.getRTL();
this._endCollect();
}
return this;
} | [
"function",
"(",
"bRTL",
")",
"{",
"check",
"(",
"bRTL",
"===",
"null",
"||",
"typeof",
"bRTL",
"===",
"\"boolean\"",
",",
"\"bRTL must be null or a boolean\"",
")",
";",
"var",
"oldRTL",
"=",
"this",
".",
"getRTL",
"(",
")",
",",
"mChanges",
";",
"this",
... | Sets the character orientation mode to be used from now on.
Can either be set to a concrete value (true meaning right-to-left,
false meaning left-to-right) or to <code>null</code> which means that
the character orientation mode should be derived from the current
language (incl. region) setting.
After changing the character orientation mode, the framework tries
to update localization specific parts of the UI. See the documentation of
{@link #setLanguage} for details and restrictions.
<b>Note</b>: See documentation of {@link #setLanguage} for restrictions.
@param {boolean|null} bRTL new character orientation mode or <code>null</code>
@return {sap.ui.core.Configuration} <code>this</code> to allow method chaining
@public | [
"Sets",
"the",
"character",
"orientation",
"mode",
"to",
"be",
"used",
"from",
"now",
"on",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Configuration.js#L1071-L1083 | train | Sets the RTL flag of the node. | [
30522,
3853,
1006,
7987,
19646,
1007,
1063,
4638,
1006,
7987,
19646,
1027,
1027,
1027,
19701,
1064,
1064,
30524,
1010,
1000,
7987,
19646,
2442,
2022,
19701,
2030,
1037,
22017,
20898,
1000,
1007,
1025,
13075,
2214,
5339,
2140,
1027,
2023,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | src/sap.ui.core/src/sap/ui/core/routing/Router.js | function () {
if (this.bIsDestroyed) {
return this;
}
EventProvider.prototype.destroy.apply(this);
// destroy the view cache
if (this._oViews) {
this._oViews.destroy();
this._oViews = null;
}
if (!this._bIsInitialized) {
Log.info("Router is not initialized, but got destroyed.", this);
}
if (this.fnHashChanged) {
this.oHashChanger.detachEvent("hashChanged", this.fnHashChanged);
}
if (this.fnHashReplaced) {
this.oHashChanger.detachEvent("hashReplaced", this.fnHashReplaced);
}
//will remove all the signals attached to the routes - all the routes will not be useable anymore
this._oRouter.removeAllRoutes();
this._oRouter = null;
jQuery.each(this._oRoutes, function(iRouteIndex, oRoute) {
oRoute.destroy();
});
this._oRoutes = null;
this._oConfig = null;
if (this._oTargets) {
this._oTargets.destroy();
this._oTargets = null;
}
delete this._bIsInitialized;
this.bIsDestroyed = true;
return this;
} | javascript | function () {
if (this.bIsDestroyed) {
return this;
}
EventProvider.prototype.destroy.apply(this);
// destroy the view cache
if (this._oViews) {
this._oViews.destroy();
this._oViews = null;
}
if (!this._bIsInitialized) {
Log.info("Router is not initialized, but got destroyed.", this);
}
if (this.fnHashChanged) {
this.oHashChanger.detachEvent("hashChanged", this.fnHashChanged);
}
if (this.fnHashReplaced) {
this.oHashChanger.detachEvent("hashReplaced", this.fnHashReplaced);
}
//will remove all the signals attached to the routes - all the routes will not be useable anymore
this._oRouter.removeAllRoutes();
this._oRouter = null;
jQuery.each(this._oRoutes, function(iRouteIndex, oRoute) {
oRoute.destroy();
});
this._oRoutes = null;
this._oConfig = null;
if (this._oTargets) {
this._oTargets.destroy();
this._oTargets = null;
}
delete this._bIsInitialized;
this.bIsDestroyed = true;
return this;
} | [
"function",
"(",
")",
"{",
"if",
"(",
"this",
".",
"bIsDestroyed",
")",
"{",
"return",
"this",
";",
"}",
"EventProvider",
".",
"prototype",
".",
"destroy",
".",
"apply",
"(",
"this",
")",
";",
"// destroy the view cache",
"if",
"(",
"this",
".",
"_oViews... | Removes the router from the hash changer @see sap.ui.core.routing.HashChanger
@public
@returns { sap.ui.core.routing.Router } this for chaining. | [
"Removes",
"the",
"router",
"from",
"the",
"hash",
"changer",
"@see",
"sap",
".",
"ui",
".",
"core",
".",
"routing",
".",
"HashChanger"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/routing/Router.js#L459-L503 | train | Destroys the event provider | [
30522,
3853,
1006,
1007,
1063,
2065,
1006,
2023,
1012,
20377,
6155,
13181,
20821,
1007,
1063,
2709,
2023,
1025,
1065,
2724,
21572,
17258,
2121,
1012,
8773,
1012,
6033,
1012,
6611,
1006,
2023,
1007,
1025,
1013,
1013,
6033,
1996,
3193,
17053,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | lib/jsdoc/ui5/plugin.js | resolveModuleName | function resolveModuleName(base, name) {
var stack = base.split('/');
stack.pop();
name.split('/').forEach(function(segment, i) {
if ( segment == '..' ) {
stack.pop();
} else if ( segment === '.' ) {
// ignore
} else {
if ( i === 0 ) {
stack = [];
}
stack.push(segment);
}
});
return stack.join('/');
} | javascript | function resolveModuleName(base, name) {
var stack = base.split('/');
stack.pop();
name.split('/').forEach(function(segment, i) {
if ( segment == '..' ) {
stack.pop();
} else if ( segment === '.' ) {
// ignore
} else {
if ( i === 0 ) {
stack = [];
}
stack.push(segment);
}
});
return stack.join('/');
} | [
"function",
"resolveModuleName",
"(",
"base",
",",
"name",
")",
"{",
"var",
"stack",
"=",
"base",
".",
"split",
"(",
"'/'",
")",
";",
"stack",
".",
"pop",
"(",
")",
";",
"name",
".",
"split",
"(",
"'/'",
")",
".",
"forEach",
"(",
"function",
"(",
... | /*
resolves relative AMD module identifiers relative to a given base name | [
"/",
"*",
"resolves",
"relative",
"AMD",
"module",
"identifiers",
"relative",
"to",
"a",
"given",
"base",
"name"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/lib/jsdoc/ui5/plugin.js#L229-L245 | train | Resolve a module name | [
30522,
3853,
10663,
5302,
8566,
20844,
4168,
1006,
2918,
1010,
2171,
1007,
1063,
13075,
9991,
1027,
2918,
30524,
1005,
1007,
1063,
9991,
1012,
3769,
1006,
1007,
1025,
1065,
2842,
2065,
1006,
6903,
1027,
1027,
1027,
1005,
1012,
1005,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/core/util/XMLPreprocessor.js | visitNode | function visitNode(oNode, oWithControl) {
var fnVisitor;
function visitAttributesAndChildren() {
return visitAttributes(oNode, oWithControl).then(function () {
return visitChildNodes(oNode, oWithControl);
}).then(function () {
if (fnSupportInfo) {
fnSupportInfo({context:oNode, env:{caller:"visitNode", after: {name: oNode.tagName}}});
}
});
}
// process only ELEMENT_NODEs
if (oNode.nodeType !== 1 /* Node.ELEMENT_NODE */) {
return oSyncPromiseResolved;
}
if (fnSupportInfo) {
fnSupportInfo({context:oNode, env:{caller:"visitNode", before: {name: oNode.tagName}}});
}
if (oNode.namespaceURI === sNAMESPACE) {
switch (oNode.localName) {
case "alias":
return templateAlias(oNode, oWithControl);
case "if":
return templateIf(oNode, oWithControl);
case "repeat":
return templateRepeat(oNode, oWithControl);
case "with":
return templateWith(oNode, oWithControl);
default:
error("Unexpected tag ", oNode);
}
} else if (oNode.namespaceURI === "sap.ui.core") {
switch (oNode.localName) {
case "ExtensionPoint":
return templateExtensionPoint(oNode, oWithControl).then(function (bResult) {
if (bResult) {
return visitAttributesAndChildren();
}
});
case "Fragment":
if (oNode.getAttribute("type") === "XML") {
return templateFragment(oNode, oWithControl);
}
break;
// no default
}
} else {
fnVisitor = mVisitors[oNode.namespaceURI + " " + oNode.localName]
|| mVisitors[oNode.namespaceURI];
if (fnVisitor) {
iNestingLevel++;
debug(oNode, "Calling visitor");
return fnVisitor(oNode, createCallbackInterface(oWithControl))
.then(function (vVisitorResult) {
if (vVisitorResult !== undefined) {
// prepare for later enhancements using return value
error("Unexpected return value from visitor for ", oNode);
}
debugFinished(oNode);
iNestingLevel -= 1;
});
}
}
return visitAttributesAndChildren();
} | javascript | function visitNode(oNode, oWithControl) {
var fnVisitor;
function visitAttributesAndChildren() {
return visitAttributes(oNode, oWithControl).then(function () {
return visitChildNodes(oNode, oWithControl);
}).then(function () {
if (fnSupportInfo) {
fnSupportInfo({context:oNode, env:{caller:"visitNode", after: {name: oNode.tagName}}});
}
});
}
// process only ELEMENT_NODEs
if (oNode.nodeType !== 1 /* Node.ELEMENT_NODE */) {
return oSyncPromiseResolved;
}
if (fnSupportInfo) {
fnSupportInfo({context:oNode, env:{caller:"visitNode", before: {name: oNode.tagName}}});
}
if (oNode.namespaceURI === sNAMESPACE) {
switch (oNode.localName) {
case "alias":
return templateAlias(oNode, oWithControl);
case "if":
return templateIf(oNode, oWithControl);
case "repeat":
return templateRepeat(oNode, oWithControl);
case "with":
return templateWith(oNode, oWithControl);
default:
error("Unexpected tag ", oNode);
}
} else if (oNode.namespaceURI === "sap.ui.core") {
switch (oNode.localName) {
case "ExtensionPoint":
return templateExtensionPoint(oNode, oWithControl).then(function (bResult) {
if (bResult) {
return visitAttributesAndChildren();
}
});
case "Fragment":
if (oNode.getAttribute("type") === "XML") {
return templateFragment(oNode, oWithControl);
}
break;
// no default
}
} else {
fnVisitor = mVisitors[oNode.namespaceURI + " " + oNode.localName]
|| mVisitors[oNode.namespaceURI];
if (fnVisitor) {
iNestingLevel++;
debug(oNode, "Calling visitor");
return fnVisitor(oNode, createCallbackInterface(oWithControl))
.then(function (vVisitorResult) {
if (vVisitorResult !== undefined) {
// prepare for later enhancements using return value
error("Unexpected return value from visitor for ", oNode);
}
debugFinished(oNode);
iNestingLevel -= 1;
});
}
}
return visitAttributesAndChildren();
} | [
"function",
"visitNode",
"(",
"oNode",
",",
"oWithControl",
")",
"{",
"var",
"fnVisitor",
";",
"function",
"visitAttributesAndChildren",
"(",
")",
"{",
"return",
"visitAttributes",
"(",
"oNode",
",",
"oWithControl",
")",
".",
"then",
"(",
"function",
"(",
")",... | Visits the given node.
@param {Node} oNode the XML DOM node
@param {sap.ui.core.template._with} oWithControl the "with" control
@returns {sap.ui.base.SyncPromise}
A sync promise which resolves with <code>undefined</code> as soon as visiting is
done, or is rejected with a corresponding error if visiting fails.
@throws {Error}
If an unexpected tag in the template namespace is encountered | [
"Visits",
"the",
"given",
"node",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/util/XMLPreprocessor.js#L1799-L1873 | train | Visit a node | [
30522,
3853,
3942,
3630,
3207,
1006,
21058,
3207,
1010,
27593,
8939,
8663,
13181,
2140,
1007,
1063,
13075,
1042,
2078,
11365,
15660,
1025,
3853,
3942,
19321,
3089,
8569,
4570,
5685,
19339,
7389,
1006,
1007,
1063,
2709,
3942,
19321,
3089,
85... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
lovell/sharp | lib/resize.js | trim | function trim (threshold) {
if (!is.defined(threshold)) {
this.options.trimThreshold = 10;
} else if (is.number(threshold) && threshold > 0) {
this.options.trimThreshold = threshold;
} else {
throw is.invalidParameterError('threshold', 'number greater than zero', threshold);
}
return this;
} | javascript | function trim (threshold) {
if (!is.defined(threshold)) {
this.options.trimThreshold = 10;
} else if (is.number(threshold) && threshold > 0) {
this.options.trimThreshold = threshold;
} else {
throw is.invalidParameterError('threshold', 'number greater than zero', threshold);
}
return this;
} | [
"function",
"trim",
"(",
"threshold",
")",
"{",
"if",
"(",
"!",
"is",
".",
"defined",
"(",
"threshold",
")",
")",
"{",
"this",
".",
"options",
".",
"trimThreshold",
"=",
"10",
";",
"}",
"else",
"if",
"(",
"is",
".",
"number",
"(",
"threshold",
")",... | Trim "boring" pixels from all edges that contain values similar to the top-left pixel.
The `info` response Object will contain `trimOffsetLeft` and `trimOffsetTop` properties.
@param {Number} [threshold=10] the allowed difference from the top-left pixel, a number greater than zero.
@returns {Sharp}
@throws {Error} Invalid parameters | [
"Trim",
"boring",
"pixels",
"from",
"all",
"edges",
"that",
"contain",
"values",
"similar",
"to",
"the",
"top",
"-",
"left",
"pixel",
".",
"The",
"info",
"response",
"Object",
"will",
"contain",
"trimOffsetLeft",
"and",
"trimOffsetTop",
"properties",
"."
] | 05d76eeadfe54713606a615185b2da047923406b | https://github.com/lovell/sharp/blob/05d76eeadfe54713606a615185b2da047923406b/lib/resize.js#L369-L378 | train | Trim the from the specified threshold | [
30522,
3853,
12241,
1006,
11207,
1007,
1063,
2065,
1006,
999,
2003,
1012,
4225,
1006,
11207,
1007,
1007,
1063,
2023,
1012,
7047,
1012,
12241,
2705,
21898,
11614,
1027,
2184,
1025,
1065,
2842,
2065,
1006,
2003,
1012,
2193,
1006,
11207,
1007,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/extensions/default/InlineTimingFunctionEditor/TimingFunctionUtils.js | _convertToNumber | function _convertToNumber(str) {
if (typeof str !== "string") {
return { isNumber: false, value: null };
}
var val = parseFloat(+str, 10),
isNum = (typeof val === "number") && !isNaN(val) &&
(val !== Infinity) && (val !== -Infinity);
return {
isNumber: isNum,
value: val
};
} | javascript | function _convertToNumber(str) {
if (typeof str !== "string") {
return { isNumber: false, value: null };
}
var val = parseFloat(+str, 10),
isNum = (typeof val === "number") && !isNaN(val) &&
(val !== Infinity) && (val !== -Infinity);
return {
isNumber: isNum,
value: val
};
} | [
"function",
"_convertToNumber",
"(",
"str",
")",
"{",
"if",
"(",
"typeof",
"str",
"!==",
"\"string\"",
")",
"{",
"return",
"{",
"isNumber",
":",
"false",
",",
"value",
":",
"null",
"}",
";",
"}",
"var",
"val",
"=",
"parseFloat",
"(",
"+",
"str",
",",... | If string is a number, then convert it.
@param {string} str value parsed from page.
@return { isNumber: boolean, value: ?number } | [
"If",
"string",
"is",
"a",
"number",
"then",
"convert",
"it",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/InlineTimingFunctionEditor/TimingFunctionUtils.js#L64-L77 | train | Convert string to number | [
30522,
3853,
1035,
10463,
2669,
29440,
1006,
2358,
2099,
1007,
1063,
2065,
1006,
2828,
11253,
2358,
2099,
999,
1027,
1027,
1000,
5164,
1000,
1007,
1063,
2709,
1063,
3475,
29440,
1024,
6270,
1010,
3643,
1024,
19701,
1065,
1025,
1065,
13075,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/model/odata/_ODataMetaModelUtils.js | function (aArray, vExpectedPropertyValue, sPropertyName) {
var iIndex = Utils.findIndex(aArray, vExpectedPropertyValue, sPropertyName);
return iIndex < 0 ? null : aArray[iIndex];
} | javascript | function (aArray, vExpectedPropertyValue, sPropertyName) {
var iIndex = Utils.findIndex(aArray, vExpectedPropertyValue, sPropertyName);
return iIndex < 0 ? null : aArray[iIndex];
} | [
"function",
"(",
"aArray",
",",
"vExpectedPropertyValue",
",",
"sPropertyName",
")",
"{",
"var",
"iIndex",
"=",
"Utils",
".",
"findIndex",
"(",
"aArray",
",",
"vExpectedPropertyValue",
",",
"sPropertyName",
")",
";",
"return",
"iIndex",
"<",
"0",
"?",
"null",
... | Returns the object inside the given array, where the property with the given name has
the given expected value.
@param {object[]} aArray
some array
@param {any} vExpectedPropertyValue
expected value of the property with given name
@param {string} [sPropertyName="name"]
some property name
@returns {object}
the object found or <code>null</code> if no such object is found | [
"Returns",
"the",
"object",
"inside",
"the",
"given",
"array",
"where",
"the",
"property",
"with",
"the",
"given",
"name",
"has",
"the",
"given",
"expected",
"value",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/_ODataMetaModelUtils.js#L613-L617 | train | Returns the value of the given property in the given array | [
30522,
3853,
1006,
9779,
11335,
2100,
1010,
2310,
2595,
5051,
10985,
21572,
4842,
3723,
10175,
5657,
1010,
11867,
18981,
15010,
18442,
1007,
1063,
13075,
2462,
13629,
2595,
1027,
21183,
12146,
1012,
2424,
22254,
10288,
1006,
9779,
11335,
2100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
eslint/eslint | tools/internal-rules/no-invalid-meta.js | hasMetaDocsCategory | function hasMetaDocsCategory(metaPropertyNode) {
const metaDocs = getPropertyFromObject("docs", metaPropertyNode.value);
return metaDocs && getPropertyFromObject("category", metaDocs.value);
} | javascript | function hasMetaDocsCategory(metaPropertyNode) {
const metaDocs = getPropertyFromObject("docs", metaPropertyNode.value);
return metaDocs && getPropertyFromObject("category", metaDocs.value);
} | [
"function",
"hasMetaDocsCategory",
"(",
"metaPropertyNode",
")",
"{",
"const",
"metaDocs",
"=",
"getPropertyFromObject",
"(",
"\"docs\"",
",",
"metaPropertyNode",
".",
"value",
")",
";",
"return",
"metaDocs",
"&&",
"getPropertyFromObject",
"(",
"\"category\"",
",",
... | Whether this `meta` ObjectExpression has a `docs.category` property defined or not.
@param {ASTNode} metaPropertyNode The `meta` ObjectExpression for this rule.
@returns {boolean} `true` if a `docs.category` property exists. | [
"Whether",
"this",
"meta",
"ObjectExpression",
"has",
"a",
"docs",
".",
"category",
"property",
"defined",
"or",
"not",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/tools/internal-rules/no-invalid-meta.js#L74-L78 | train | Checks if the metaDocs property has a category property | [
30522,
3853,
2038,
11368,
9365,
6169,
16280,
20255,
2100,
1006,
18804,
21572,
4842,
25680,
10244,
1007,
1063,
9530,
3367,
18804,
3527,
6169,
1027,
2131,
21572,
4842,
3723,
19699,
19506,
2497,
20614,
1006,
1000,
9986,
2015,
1000,
1010,
18804,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
TryGhost/Ghost | core/server/api/v0.1/users.js | deleteUser | function deleteUser(options) {
return models.Base.transaction((t) => {
options.transacting = t;
return Promise.all([
models.Accesstoken.destroyByUser(options),
models.Refreshtoken.destroyByUser(options),
models.Post.destroyByAuthor(options)
]).then(() => {
return models.User.destroy(options);
}).return(null);
}).catch((err) => {
return Promise.reject(new common.errors.NoPermissionError({
err: err
}));
});
} | javascript | function deleteUser(options) {
return models.Base.transaction((t) => {
options.transacting = t;
return Promise.all([
models.Accesstoken.destroyByUser(options),
models.Refreshtoken.destroyByUser(options),
models.Post.destroyByAuthor(options)
]).then(() => {
return models.User.destroy(options);
}).return(null);
}).catch((err) => {
return Promise.reject(new common.errors.NoPermissionError({
err: err
}));
});
} | [
"function",
"deleteUser",
"(",
"options",
")",
"{",
"return",
"models",
".",
"Base",
".",
"transaction",
"(",
"(",
"t",
")",
"=>",
"{",
"options",
".",
"transacting",
"=",
"t",
";",
"return",
"Promise",
".",
"all",
"(",
"[",
"models",
".",
"Accesstoken... | ### Delete User
Make the call to the Model layer
@param {Object} options | [
"###",
"Delete",
"User",
"Make",
"the",
"call",
"to",
"the",
"Model",
"layer"
] | bb7bb55cf3e60af99ebbc56099928827b58461bc | https://github.com/TryGhost/Ghost/blob/bb7bb55cf3e60af99ebbc56099928827b58461bc/core/server/api/v0.1/users.js#L201-L217 | train | Delete user | [
30522,
3853,
3972,
12870,
20330,
1006,
7047,
1007,
1063,
2709,
4275,
1012,
2918,
1012,
12598,
1006,
1006,
1056,
1007,
1027,
1028,
1063,
7047,
1012,
9099,
18908,
2075,
1027,
1056,
1025,
2709,
4872,
1012,
2035,
1006,
1031,
4275,
1012,
3229,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SheetJS/js-xlsx | bits/28_binstructs.js | parse_ClipboardFormatOrString | function parse_ClipboardFormatOrString(o, w/*:number*/)/*:string*/ {
// $FlowIgnore
var ClipFmt = {2:"BITMAP",3:"METAFILEPICT",8:"DIB",14:"ENHMETAFILE"};
var m/*:number*/ = o.read_shift(4);
switch(m) {
case 0x00000000: return "";
case 0xffffffff: case 0xfffffffe: return ClipFmt[o.read_shift(4)]||"";
}
if(m > 0x190) throw new Error("Unsupported Clipboard: " + m.toString(16));
o.l -= 4;
return o.read_shift(0, w == 1 ? "lpstr" : "lpwstr");
} | javascript | function parse_ClipboardFormatOrString(o, w/*:number*/)/*:string*/ {
// $FlowIgnore
var ClipFmt = {2:"BITMAP",3:"METAFILEPICT",8:"DIB",14:"ENHMETAFILE"};
var m/*:number*/ = o.read_shift(4);
switch(m) {
case 0x00000000: return "";
case 0xffffffff: case 0xfffffffe: return ClipFmt[o.read_shift(4)]||"";
}
if(m > 0x190) throw new Error("Unsupported Clipboard: " + m.toString(16));
o.l -= 4;
return o.read_shift(0, w == 1 ? "lpstr" : "lpwstr");
} | [
"function",
"parse_ClipboardFormatOrString",
"(",
"o",
",",
"w",
"/*:number*/",
")",
"/*:string*/",
"{",
"// $FlowIgnore",
"var",
"ClipFmt",
"=",
"{",
"2",
":",
"\"BITMAP\"",
",",
"3",
":",
"\"METAFILEPICT\"",
",",
"8",
":",
"\"DIB\"",
",",
"14",
":",
"\"ENH... | /* [MS-OLEDS] 2.3.1 and 2.3.2 | [
"/",
"*",
"[",
"MS",
"-",
"OLEDS",
"]",
"2",
".",
"3",
".",
"1",
"and",
"2",
".",
"3",
".",
"2"
] | 9a6d8a1d3d80c78dad5201fb389316f935279cdc | https://github.com/SheetJS/js-xlsx/blob/9a6d8a1d3d80c78dad5201fb389316f935279cdc/bits/28_binstructs.js#L266-L277 | train | Parse a Clipboard format or string | [
30522,
3853,
11968,
3366,
1035,
12528,
6277,
14192,
18926,
18886,
3070,
1006,
1051,
1010,
1059,
1013,
1008,
1024,
2193,
1008,
1013,
1007,
1013,
1008,
1024,
5164,
1008,
1013,
1063,
1013,
1013,
1002,
4834,
23773,
5686,
13075,
12528,
16715,
21... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | lib/jsdoc/transform-apijson-for-sdk.js | extractSamplesFromDocuIndex | function extractSamplesFromDocuIndex(oChainObject) {
// If we have not extracted docuPath we return early
if (!oChainObject.docuPath) {
return oChainObject;
}
return new Promise(function(oResolve) {
// Join .library path with relative docuindex.json path
let sPath = path.join(path.dirname(oChainObject.libraryFile), oChainObject.docuPath);
// Normalize path to resolve relative path
sPath = path.normalize(sPath);
fs.readFile(sPath, 'utf8', (oError, oFileData) => {
if (!oError) {
oFileData = JSON.parse(oFileData);
if (oFileData.explored && oFileData.explored.entities && oFileData.explored.entities.length > 0) {
oChainObject.entitiesWithSamples = [];
oFileData.explored.entities.forEach(oEntity => {
oChainObject.entitiesWithSamples.push(oEntity.id);
});
}
}
// We aways resolve as this data is not mandatory
oResolve(oChainObject);
});
});
} | javascript | function extractSamplesFromDocuIndex(oChainObject) {
// If we have not extracted docuPath we return early
if (!oChainObject.docuPath) {
return oChainObject;
}
return new Promise(function(oResolve) {
// Join .library path with relative docuindex.json path
let sPath = path.join(path.dirname(oChainObject.libraryFile), oChainObject.docuPath);
// Normalize path to resolve relative path
sPath = path.normalize(sPath);
fs.readFile(sPath, 'utf8', (oError, oFileData) => {
if (!oError) {
oFileData = JSON.parse(oFileData);
if (oFileData.explored && oFileData.explored.entities && oFileData.explored.entities.length > 0) {
oChainObject.entitiesWithSamples = [];
oFileData.explored.entities.forEach(oEntity => {
oChainObject.entitiesWithSamples.push(oEntity.id);
});
}
}
// We aways resolve as this data is not mandatory
oResolve(oChainObject);
});
});
} | [
"function",
"extractSamplesFromDocuIndex",
"(",
"oChainObject",
")",
"{",
"// If we have not extracted docuPath we return early",
"if",
"(",
"!",
"oChainObject",
".",
"docuPath",
")",
"{",
"return",
"oChainObject",
";",
"}",
"return",
"new",
"Promise",
"(",
"function",
... | Adds to the passed object array with entities which have explored samples
@param {object} oChainObject chain object
@returns {object} chain object | [
"Adds",
"to",
"the",
"passed",
"object",
"array",
"with",
"entities",
"which",
"have",
"explored",
"samples"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/lib/jsdoc/transform-apijson-for-sdk.js#L847-L873 | train | Extract samples from docuindex. json | [
30522,
3853,
27059,
16613,
4244,
19699,
5358,
3527,
10841,
22254,
10288,
1006,
28166,
8113,
16429,
20614,
1007,
1063,
1013,
1013,
2065,
2057,
2031,
2025,
15901,
9986,
6279,
8988,
2057,
2709,
2220,
2065,
1006,
999,
28166,
8113,
16429,
20614,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
eslint/eslint | lib/config/config-file.js | applyExtends | function applyExtends(config, configContext, filePath) {
const extendsList = Array.isArray(config.extends) ? config.extends : [config.extends];
// Make the last element in an array take the highest precedence
const flattenedConfig = extendsList.reduceRight((previousValue, extendedConfigReference) => {
try {
debug(`Loading ${extendedConfigReference}`);
// eslint-disable-next-line no-use-before-define
return ConfigOps.merge(load(extendedConfigReference, configContext, filePath), previousValue);
} catch (err) {
/*
* If the file referenced by `extends` failed to load, add the path
* to the configuration file that referenced it to the error
* message so the user is able to see where it was referenced from,
* then re-throw.
*/
err.message += `\nReferenced from: ${filePath}`;
if (err.messageTemplate === "plugin-missing") {
err.messageData.configStack.push(filePath);
}
throw err;
}
}, Object.assign({}, config));
delete flattenedConfig.extends;
return flattenedConfig;
} | javascript | function applyExtends(config, configContext, filePath) {
const extendsList = Array.isArray(config.extends) ? config.extends : [config.extends];
// Make the last element in an array take the highest precedence
const flattenedConfig = extendsList.reduceRight((previousValue, extendedConfigReference) => {
try {
debug(`Loading ${extendedConfigReference}`);
// eslint-disable-next-line no-use-before-define
return ConfigOps.merge(load(extendedConfigReference, configContext, filePath), previousValue);
} catch (err) {
/*
* If the file referenced by `extends` failed to load, add the path
* to the configuration file that referenced it to the error
* message so the user is able to see where it was referenced from,
* then re-throw.
*/
err.message += `\nReferenced from: ${filePath}`;
if (err.messageTemplate === "plugin-missing") {
err.messageData.configStack.push(filePath);
}
throw err;
}
}, Object.assign({}, config));
delete flattenedConfig.extends;
return flattenedConfig;
} | [
"function",
"applyExtends",
"(",
"config",
",",
"configContext",
",",
"filePath",
")",
"{",
"const",
"extendsList",
"=",
"Array",
".",
"isArray",
"(",
"config",
".",
"extends",
")",
"?",
"config",
".",
"extends",
":",
"[",
"config",
".",
"extends",
"]",
... | Applies values from the "extends" field in a configuration file.
@param {Object} config The configuration information.
@param {Config} configContext Plugin context for the config instance
@param {string} filePath The file path from which the configuration information
was loaded.
@returns {Object} A new configuration object with all of the "extends" fields
loaded and merged.
@private | [
"Applies",
"values",
"from",
"the",
"extends",
"field",
"in",
"a",
"configuration",
"file",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/config/config-file.js#L380-L411 | train | Apply an extended config to the given config | [
30522,
3853,
6611,
10288,
6528,
5104,
1006,
9530,
8873,
2290,
1010,
9530,
8873,
18195,
28040,
18413,
1010,
5371,
15069,
1007,
1063,
9530,
3367,
8908,
9863,
1027,
9140,
1012,
18061,
11335,
2100,
1006,
9530,
8873,
2290,
1012,
8908,
1007,
1029... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/core/ComponentContainer.js | setContainerComponent | function setContainerComponent(oComponentContainer, vComponent, bSuppressInvalidate, bDestroyOldComponent) {
// find the reference to the current component and to the old component
var oComponent = typeof vComponent === "string" ? Core.getComponent(vComponent) : vComponent;
var oOldComponent = oComponentContainer.getComponentInstance();
// if there is no difference between the old and the new component just skip this setter
if (oOldComponent !== oComponent) {
// unlink the old component from the container
if (oOldComponent) {
oOldComponent.setContainer(undefined);
if (bDestroyOldComponent) {
oOldComponent.destroy();
} else {
// cleanup the propagated properties in case of not destroying the component
oComponentContainer._propagateProperties(true, oOldComponent, ManagedObject._oEmptyPropagatedProperties, true);
}
}
// set the new component
oComponentContainer.setAssociation("component", oComponent, bSuppressInvalidate);
// cross link the new component and propagate the properties (models)
oComponent = oComponentContainer.getComponentInstance();
if (oComponent) {
oComponent.setContainer(oComponentContainer);
oComponentContainer.propagateProperties(true); //propagate all
}
}
} | javascript | function setContainerComponent(oComponentContainer, vComponent, bSuppressInvalidate, bDestroyOldComponent) {
// find the reference to the current component and to the old component
var oComponent = typeof vComponent === "string" ? Core.getComponent(vComponent) : vComponent;
var oOldComponent = oComponentContainer.getComponentInstance();
// if there is no difference between the old and the new component just skip this setter
if (oOldComponent !== oComponent) {
// unlink the old component from the container
if (oOldComponent) {
oOldComponent.setContainer(undefined);
if (bDestroyOldComponent) {
oOldComponent.destroy();
} else {
// cleanup the propagated properties in case of not destroying the component
oComponentContainer._propagateProperties(true, oOldComponent, ManagedObject._oEmptyPropagatedProperties, true);
}
}
// set the new component
oComponentContainer.setAssociation("component", oComponent, bSuppressInvalidate);
// cross link the new component and propagate the properties (models)
oComponent = oComponentContainer.getComponentInstance();
if (oComponent) {
oComponent.setContainer(oComponentContainer);
oComponentContainer.propagateProperties(true); //propagate all
}
}
} | [
"function",
"setContainerComponent",
"(",
"oComponentContainer",
",",
"vComponent",
",",
"bSuppressInvalidate",
",",
"bDestroyOldComponent",
")",
"{",
"// find the reference to the current component and to the old component",
"var",
"oComponent",
"=",
"typeof",
"vComponent",
"===... | /*
Helper function to set the new Component of the container. | [
"/",
"*",
"Helper",
"function",
"to",
"set",
"the",
"new",
"Component",
"of",
"the",
"container",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/ComponentContainer.js#L178-L203 | train | Sets the component to the container | [
30522,
3853,
2275,
8663,
18249,
2121,
9006,
29513,
3372,
1006,
1051,
9006,
29513,
3372,
8663,
18249,
2121,
1010,
18315,
25377,
5643,
3372,
1010,
18667,
6279,
20110,
2378,
10175,
8524,
2618,
1010,
1038,
6155,
13181,
7677,
6392,
9006,
29513,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SeleniumHQ/selenium | third_party/closure/goog/ui/charpicker.js | onBeforeShow | function onBeforeShow() {
var trigger = self.hc_.getAnchorElement();
var ch = self.getChar_(trigger);
if (ch) {
goog.dom.setTextContent(self.zoomEl_, self.displayChar_(ch));
goog.dom.setTextContent(self.unicodeEl_, goog.i18n.uChar.toHexString(ch));
// Clear the character name since we don't want to show old data because
// it is retrieved asynchronously and the DOM object is re-used
goog.dom.setTextContent(self.charNameEl_, '');
self.charNameFetcher_.getName(ch, function(charName) {
if (charName) {
goog.dom.setTextContent(self.charNameEl_, charName);
}
});
}
} | javascript | function onBeforeShow() {
var trigger = self.hc_.getAnchorElement();
var ch = self.getChar_(trigger);
if (ch) {
goog.dom.setTextContent(self.zoomEl_, self.displayChar_(ch));
goog.dom.setTextContent(self.unicodeEl_, goog.i18n.uChar.toHexString(ch));
// Clear the character name since we don't want to show old data because
// it is retrieved asynchronously and the DOM object is re-used
goog.dom.setTextContent(self.charNameEl_, '');
self.charNameFetcher_.getName(ch, function(charName) {
if (charName) {
goog.dom.setTextContent(self.charNameEl_, charName);
}
});
}
} | [
"function",
"onBeforeShow",
"(",
")",
"{",
"var",
"trigger",
"=",
"self",
".",
"hc_",
".",
"getAnchorElement",
"(",
")",
";",
"var",
"ch",
"=",
"self",
".",
"getChar_",
"(",
"trigger",
")",
";",
"if",
"(",
"ch",
")",
"{",
"goog",
".",
"dom",
".",
... | Function called by hover card just before it is visible to collect data. | [
"Function",
"called",
"by",
"hover",
"card",
"just",
"before",
"it",
"is",
"visible",
"to",
"collect",
"data",
"."
] | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/closure/goog/ui/charpicker.js#L454-L469 | train | Called before the character is displayed | [
30522,
3853,
2006,
4783,
29278,
9953,
5004,
1006,
1007,
1063,
13075,
9495,
1027,
2969,
1012,
16731,
1035,
1012,
2131,
2319,
9905,
16570,
13665,
1006,
1007,
1025,
13075,
10381,
1027,
2969,
1012,
2131,
7507,
2099,
1035,
1006,
9495,
1007,
1025... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
eslint/eslint | lib/rules/no-unmodified-loop-condition.js | registerConditionsToGroup | function registerConditionsToGroup(conditions) {
for (let i = 0; i < conditions.length; ++i) {
const condition = conditions[i];
if (condition.group) {
let group = groupMap.get(condition.group);
if (!group) {
group = [];
groupMap.set(condition.group, group);
}
group.push(condition);
}
}
} | javascript | function registerConditionsToGroup(conditions) {
for (let i = 0; i < conditions.length; ++i) {
const condition = conditions[i];
if (condition.group) {
let group = groupMap.get(condition.group);
if (!group) {
group = [];
groupMap.set(condition.group, group);
}
group.push(condition);
}
}
} | [
"function",
"registerConditionsToGroup",
"(",
"conditions",
")",
"{",
"for",
"(",
"let",
"i",
"=",
"0",
";",
"i",
"<",
"conditions",
".",
"length",
";",
"++",
"i",
")",
"{",
"const",
"condition",
"=",
"conditions",
"[",
"i",
"]",
";",
"if",
"(",
"con... | Registers given conditions to the group the condition belongs to.
@param {LoopConditionInfo[]} conditions - A loop condition info to
register.
@returns {void} | [
"Registers",
"given",
"conditions",
"to",
"the",
"group",
"the",
"condition",
"belongs",
"to",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/no-unmodified-loop-condition.js#L207-L221 | train | Register conditions to group | [
30522,
3853,
4236,
8663,
20562,
16033,
17058,
1006,
3785,
1007,
1063,
2005,
1006,
2292,
1045,
1027,
1014,
1025,
1045,
1026,
3785,
1012,
3091,
1025,
1009,
1009,
1045,
1007,
1063,
9530,
3367,
4650,
1027,
3785,
1031,
1045,
1033,
1025,
2065,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
jgraph/mxgraph | javascript/mxClient.js | function(label, funct, doc)
{
doc = (doc != null) ? doc : document;
var button = doc.createElement('button');
mxUtils.write(button, label);
mxEvent.addListener(button, 'click', function(evt)
{
funct(evt);
});
return button;
} | javascript | function(label, funct, doc)
{
doc = (doc != null) ? doc : document;
var button = doc.createElement('button');
mxUtils.write(button, label);
mxEvent.addListener(button, 'click', function(evt)
{
funct(evt);
});
return button;
} | [
"function",
"(",
"label",
",",
"funct",
",",
"doc",
")",
"{",
"doc",
"=",
"(",
"doc",
"!=",
"null",
")",
"?",
"doc",
":",
"document",
";",
"var",
"button",
"=",
"doc",
".",
"createElement",
"(",
"'button'",
")",
";",
"mxUtils",
".",
"write",
"(",
... | Function: button
Returns a new button with the given level and function as an onclick
event handler.
(code)
document.body.appendChild(mxUtils.button('Test', function(evt)
{
alert('Hello, World!');
}));
(end)
Parameters:
label - String that represents the label of the button.
funct - Function to be called if the button is pressed.
doc - Optional document to be used for creating the button. Default is the
current document. | [
"Function",
":",
"button"
] | 33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44 | https://github.com/jgraph/mxgraph/blob/33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44/javascript/mxClient.js#L3337-L3350 | train | Creates a button element | [
30522,
3853,
1006,
3830,
1010,
4569,
6593,
1010,
9986,
1007,
1063,
9986,
1027,
1006,
9986,
999,
1027,
19701,
1007,
1029,
9986,
1024,
6254,
1025,
13075,
6462,
1027,
9986,
1012,
3443,
12260,
3672,
1006,
1005,
6462,
1005,
1007,
1025,
25630,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | src/sap.ui.core/src/sap/ui/core/Manifest.js | function(oInstance) {
// activate the customizing configuration
var oUI5Manifest = this.getEntry("sap.ui5", true),
mExtensions = oUI5Manifest && oUI5Manifest["extends"] && oUI5Manifest["extends"].extensions;
if (!jQuery.isEmptyObject(mExtensions)) {
var CustomizingConfiguration = sap.ui.requireSync('sap/ui/core/CustomizingConfiguration');
if (!oInstance) {
CustomizingConfiguration.activateForComponent(this.getComponentName());
} else {
CustomizingConfiguration.activateForComponentInstance(oInstance);
}
}
} | javascript | function(oInstance) {
// activate the customizing configuration
var oUI5Manifest = this.getEntry("sap.ui5", true),
mExtensions = oUI5Manifest && oUI5Manifest["extends"] && oUI5Manifest["extends"].extensions;
if (!jQuery.isEmptyObject(mExtensions)) {
var CustomizingConfiguration = sap.ui.requireSync('sap/ui/core/CustomizingConfiguration');
if (!oInstance) {
CustomizingConfiguration.activateForComponent(this.getComponentName());
} else {
CustomizingConfiguration.activateForComponentInstance(oInstance);
}
}
} | [
"function",
"(",
"oInstance",
")",
"{",
"// activate the customizing configuration",
"var",
"oUI5Manifest",
"=",
"this",
".",
"getEntry",
"(",
"\"sap.ui5\"",
",",
"true",
")",
",",
"mExtensions",
"=",
"oUI5Manifest",
"&&",
"oUI5Manifest",
"[",
"\"extends\"",
"]",
... | Activates the customizing for the component or a dedicated component
instance when providing the component instance as parameter.
@param {sap.ui.core.Component} [oInstance] Reference to the Component instance
@private | [
"Activates",
"the",
"customizing",
"for",
"the",
"component",
"or",
"a",
"dedicated",
"component",
"instance",
"when",
"providing",
"the",
"component",
"instance",
"as",
"parameter",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Manifest.js#L694-L706 | train | Activates the customizing configuration for the component. | [
30522,
3853,
1006,
1051,
7076,
26897,
1007,
1063,
1013,
1013,
20544,
1996,
7661,
6026,
9563,
13075,
15068,
2072,
2629,
20799,
14081,
1027,
2023,
1012,
2131,
4765,
2854,
1006,
1000,
20066,
1012,
21318,
2629,
1000,
1010,
2995,
1007,
1010,
203... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
jhipster/generator-jhipster | generators/cleanup.js | cleanupOldFiles | function cleanupOldFiles(generator) {
if (generator.isJhipsterVersionLessThan('3.2.0')) {
// removeFile and removeFolder methods should be called here for files and folders to cleanup
generator.removeFile(`${ANGULAR_DIR}components/form/uib-pager.config.js`);
generator.removeFile(`${ANGULAR_DIR}components/form/uib-pagination.config.js`);
}
if (generator.isJhipsterVersionLessThan('5.0.0')) {
generator.removeFile(`${ANGULAR_DIR}/app.route.ts`);
generator.removeFile(`${ANGULAR_DIR}shared/auth/account.service.ts`);
generator.removeFile(`${ANGULAR_DIR}shared/auth/auth-jwt.service.ts`);
generator.removeFile(`${ANGULAR_DIR}shared/auth/auth-session.service.ts`);
generator.removeFile(`${ANGULAR_DIR}shared/auth/csrf.service.ts`);
generator.removeFile(`${ANGULAR_DIR}shared/auth/state-storage.service.ts`);
generator.removeFile(`${ANGULAR_DIR}shared/auth/user-route-access-service.ts`);
generator.removeFile(`${ANGULAR_DIR}shared/language/language.constants.ts`);
generator.removeFile(`${ANGULAR_DIR}shared/language/language.helper.ts`);
generator.removeFile(`${ANGULAR_DIR}shared/login/login-modal.service.ts`);
generator.removeFile(`${ANGULAR_DIR}shared/login/login.service.ts`);
generator.removeFile(`${ANGULAR_DIR}shared/model/base-entity.ts`);
generator.removeFile(`${ANGULAR_DIR}shared/model/request-util.ts`);
generator.removeFile(`${ANGULAR_DIR}shared/user/account.model.ts`);
generator.removeFile(`${ANGULAR_DIR}shared/user/user.model.ts`);
generator.removeFile(`${ANGULAR_DIR}shared/user/user.service.ts`);
generator.removeFile(`${ANGULAR_DIR}admin/user-management/user-management-dialog.component.ts`);
generator.removeFile(`${ANGULAR_DIR}admin/user-management/user-modal.service.ts`);
generator.removeFile(`${ANGULAR_DIR}admin/user-management/user-modal.service.ts`);
generator.removeFile(`${CLIENT_TEST_SRC_DIR}spec/app/shared/user/user.service.spec.ts`);
generator.removeFile(`${CLIENT_TEST_SRC_DIR}spec/app/admin/user-management/user-management-dialog.component.spec.ts`);
generator.removeFile(`${CLIENT_TEST_SRC_DIR}spec/entry.ts`);
generator.removeFile(`${CLIENT_TEST_SRC_DIR}karma.conf.js`);
}
if (generator.isJhipsterVersionLessThan('5.8.0')) {
generator.removeFile(`${ANGULAR_DIR}admin/metrics/metrics-modal.component.html`);
generator.removeFile(`${ANGULAR_DIR}admin/metrics/metrics-modal.component.ts`);
generator.removeFile(`${CLIENT_TEST_SRC_DIR}spec/app/admin/metrics/metrics-modal.component.spec.ts`);
}
} | javascript | function cleanupOldFiles(generator) {
if (generator.isJhipsterVersionLessThan('3.2.0')) {
// removeFile and removeFolder methods should be called here for files and folders to cleanup
generator.removeFile(`${ANGULAR_DIR}components/form/uib-pager.config.js`);
generator.removeFile(`${ANGULAR_DIR}components/form/uib-pagination.config.js`);
}
if (generator.isJhipsterVersionLessThan('5.0.0')) {
generator.removeFile(`${ANGULAR_DIR}/app.route.ts`);
generator.removeFile(`${ANGULAR_DIR}shared/auth/account.service.ts`);
generator.removeFile(`${ANGULAR_DIR}shared/auth/auth-jwt.service.ts`);
generator.removeFile(`${ANGULAR_DIR}shared/auth/auth-session.service.ts`);
generator.removeFile(`${ANGULAR_DIR}shared/auth/csrf.service.ts`);
generator.removeFile(`${ANGULAR_DIR}shared/auth/state-storage.service.ts`);
generator.removeFile(`${ANGULAR_DIR}shared/auth/user-route-access-service.ts`);
generator.removeFile(`${ANGULAR_DIR}shared/language/language.constants.ts`);
generator.removeFile(`${ANGULAR_DIR}shared/language/language.helper.ts`);
generator.removeFile(`${ANGULAR_DIR}shared/login/login-modal.service.ts`);
generator.removeFile(`${ANGULAR_DIR}shared/login/login.service.ts`);
generator.removeFile(`${ANGULAR_DIR}shared/model/base-entity.ts`);
generator.removeFile(`${ANGULAR_DIR}shared/model/request-util.ts`);
generator.removeFile(`${ANGULAR_DIR}shared/user/account.model.ts`);
generator.removeFile(`${ANGULAR_DIR}shared/user/user.model.ts`);
generator.removeFile(`${ANGULAR_DIR}shared/user/user.service.ts`);
generator.removeFile(`${ANGULAR_DIR}admin/user-management/user-management-dialog.component.ts`);
generator.removeFile(`${ANGULAR_DIR}admin/user-management/user-modal.service.ts`);
generator.removeFile(`${ANGULAR_DIR}admin/user-management/user-modal.service.ts`);
generator.removeFile(`${CLIENT_TEST_SRC_DIR}spec/app/shared/user/user.service.spec.ts`);
generator.removeFile(`${CLIENT_TEST_SRC_DIR}spec/app/admin/user-management/user-management-dialog.component.spec.ts`);
generator.removeFile(`${CLIENT_TEST_SRC_DIR}spec/entry.ts`);
generator.removeFile(`${CLIENT_TEST_SRC_DIR}karma.conf.js`);
}
if (generator.isJhipsterVersionLessThan('5.8.0')) {
generator.removeFile(`${ANGULAR_DIR}admin/metrics/metrics-modal.component.html`);
generator.removeFile(`${ANGULAR_DIR}admin/metrics/metrics-modal.component.ts`);
generator.removeFile(`${CLIENT_TEST_SRC_DIR}spec/app/admin/metrics/metrics-modal.component.spec.ts`);
}
} | [
"function",
"cleanupOldFiles",
"(",
"generator",
")",
"{",
"if",
"(",
"generator",
".",
"isJhipsterVersionLessThan",
"(",
"'3.2.0'",
")",
")",
"{",
"// removeFile and removeFolder methods should be called here for files and folders to cleanup",
"generator",
".",
"removeFile",
... | Removes files that where generated in previous JHipster versions and therefore
need to be removed.
WARNING this only removes files created by the main generator. Each sub-generator
should clean-up its own files: see the `cleanup` method in entity/index.js for cleaning
up entities.
@param {any} generator - reference to generator | [
"Removes",
"files",
"that",
"where",
"generated",
"in",
"previous",
"JHipster",
"versions",
"and",
"therefore",
"need",
"to",
"be",
"removed",
"."
] | f76fa8de0818ce6bda6c7b1455942e2a9b0ae3ff | https://github.com/jhipster/generator-jhipster/blob/f76fa8de0818ce6bda6c7b1455942e2a9b0ae3ff/generators/cleanup.js#L41-L78 | train | Removes old files | [
30522,
3853,
27686,
11614,
8873,
4244,
1006,
13103,
1007,
1063,
2065,
1006,
13103,
1012,
2003,
3501,
19801,
3334,
27774,
3238,
21604,
1006,
1005,
1017,
1012,
1016,
1012,
1014,
1005,
1007,
1007,
1063,
1013,
1013,
6366,
8873,
2571,
1998,
6366... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/model/odata/_ODataMetaModelUtils.js | function (oAnnotations, oSchema, oEntityContainer, oFunctionImport) {
var mAnnotations;
if (!oFunctionImport.parameter) {
return;
}
mAnnotations = Utils.getChildAnnotations(oAnnotations,
oSchema.namespace + "." + oEntityContainer.name, true);
oFunctionImport.parameter.forEach(
function (oParam) {
Utils.liftSAPData(oParam);
jQuery.extend(oParam,
mAnnotations[oFunctionImport.name + "/" + oParam.name]);
}
);
} | javascript | function (oAnnotations, oSchema, oEntityContainer, oFunctionImport) {
var mAnnotations;
if (!oFunctionImport.parameter) {
return;
}
mAnnotations = Utils.getChildAnnotations(oAnnotations,
oSchema.namespace + "." + oEntityContainer.name, true);
oFunctionImport.parameter.forEach(
function (oParam) {
Utils.liftSAPData(oParam);
jQuery.extend(oParam,
mAnnotations[oFunctionImport.name + "/" + oParam.name]);
}
);
} | [
"function",
"(",
"oAnnotations",
",",
"oSchema",
",",
"oEntityContainer",
",",
"oFunctionImport",
")",
"{",
"var",
"mAnnotations",
";",
"if",
"(",
"!",
"oFunctionImport",
".",
"parameter",
")",
"{",
"return",
";",
"}",
"mAnnotations",
"=",
"Utils",
".",
"get... | Visits all parameters of the given function import.
@param {object} oAnnotations
annotations "JSON"
@param {object} oSchema
OData data service schema
@param {object} oEntityContainer
the entity container
@param {object} oFunctionImport
a function import's V2 metadata object | [
"Visits",
"all",
"parameters",
"of",
"the",
"given",
"function",
"import",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/_ODataMetaModelUtils.js#L1079-L1094 | train | Adds the parameters of the function import | [
30522,
3853,
1006,
1051,
11639,
17287,
9285,
1010,
9808,
5403,
2863,
1010,
1051,
4765,
3012,
8663,
18249,
2121,
1010,
1997,
4609,
7542,
5714,
6442,
1007,
1063,
13075,
10856,
17287,
9285,
1025,
2065,
1006,
999,
1997,
4609,
7542,
5714,
6442,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
dequelabs/axe-core | lib/commons/color/get-background-color.js | elmPartiallyObscured | function elmPartiallyObscured(elm, bgElm, bgColor) {
var obscured =
elm !== bgElm && !dom.visuallyContains(elm, bgElm) && bgColor.alpha !== 0;
if (obscured) {
axe.commons.color.incompleteData.set('bgColor', 'elmPartiallyObscured');
}
return obscured;
} | javascript | function elmPartiallyObscured(elm, bgElm, bgColor) {
var obscured =
elm !== bgElm && !dom.visuallyContains(elm, bgElm) && bgColor.alpha !== 0;
if (obscured) {
axe.commons.color.incompleteData.set('bgColor', 'elmPartiallyObscured');
}
return obscured;
} | [
"function",
"elmPartiallyObscured",
"(",
"elm",
",",
"bgElm",
",",
"bgColor",
")",
"{",
"var",
"obscured",
"=",
"elm",
"!==",
"bgElm",
"&&",
"!",
"dom",
".",
"visuallyContains",
"(",
"elm",
",",
"bgElm",
")",
"&&",
"bgColor",
".",
"alpha",
"!==",
"0",
... | Determine if element is partially overlapped, triggering a Can't Tell result
@private
@param {Element} elm
@param {Element} bgElm
@param {Object} bgColor
@return {Boolean} | [
"Determine",
"if",
"element",
"is",
"partially",
"overlapped",
"triggering",
"a",
"Can",
"t",
"Tell",
"result"
] | 727323c07980e2291575f545444d389fb942906f | https://github.com/dequelabs/axe-core/blob/727323c07980e2291575f545444d389fb942906f/lib/commons/color/get-background-color.js#L294-L301 | train | Check if an element is partially obscured | [
30522,
3853,
17709,
19362,
20925,
2135,
16429,
28817,
5596,
1006,
17709,
1010,
1038,
12439,
2213,
1010,
1038,
18195,
12898,
2099,
1007,
1063,
13075,
23649,
1027,
17709,
999,
1027,
1027,
1038,
12439,
2213,
1004,
1004,
999,
14383,
1012,
17453,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
ksky521/nodeppt | packages/nodeppt-parser/lib/markdown/prism.js | checkLanguageOption | function checkLanguageOption(options, optionName) {
const language = options[optionName];
if (language !== undefined && loadPrismLang(language) === undefined) {
throw new Error(`Bad option ${optionName}: There is no Prism language '${language}'.`);
}
} | javascript | function checkLanguageOption(options, optionName) {
const language = options[optionName];
if (language !== undefined && loadPrismLang(language) === undefined) {
throw new Error(`Bad option ${optionName}: There is no Prism language '${language}'.`);
}
} | [
"function",
"checkLanguageOption",
"(",
"options",
",",
"optionName",
")",
"{",
"const",
"language",
"=",
"options",
"[",
"optionName",
"]",
";",
"if",
"(",
"language",
"!==",
"undefined",
"&&",
"loadPrismLang",
"(",
"language",
")",
"===",
"undefined",
")",
... | Checks whether an option represents a valid Prism language
@param {MarkdownItPrismOptions} options
The options that have been used to initialise the plugin.
@param optionName
The key of the option insides {@code options} that shall be checked.
@throws {Error} If the option is not set to a valid Prism language. | [
"Checks",
"whether",
"an",
"option",
"represents",
"a",
"valid",
"Prism",
"language"
] | ca77e29ef818c08b0522b31e3925b073cf159b9c | https://github.com/ksky521/nodeppt/blob/ca77e29ef818c08b0522b31e3925b073cf159b9c/packages/nodeppt-parser/lib/markdown/prism.js#L152-L157 | train | Check if the language option is valid | [
30522,
3853,
4638,
25023,
6692,
3351,
7361,
3508,
1006,
7047,
1010,
5724,
18442,
1007,
1063,
9530,
3367,
2653,
1027,
7047,
1031,
5724,
18442,
1033,
1025,
2065,
1006,
2653,
999,
1027,
1027,
6151,
28344,
1004,
1004,
7170,
18098,
2964,
25023,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/core/message/MessageMixin.js | refreshDataState | function refreshDataState (sName, oDataState) {
if (oDataState.getChanges().messages) {
var aMessages = oDataState.getMessages();
var aLabels = sap.ui.core.LabelEnablement.getReferencingLabels(this);
var sLabelId = aLabels[0];
var bForceUpdate = false;
aMessages.forEach(function(oMessage) {
if (aLabels && aLabels.length > 0) {
// we simply take the first label text and ignore all others
var oLabel = sap.ui.getCore().byId(sLabelId);
if (oLabel.getMetadata().isInstanceOf("sap.ui.core.Label") && oLabel.getText && oMessage.getAdditionalText() !== oLabel.getText()) {
oMessage.setAdditionalText(oLabel.getText());
bForceUpdate = true;
} else {
Log.warning(
"sap.ui.core.message.Message: Can't create labelText." +
"Label with id " + sLabelId + " is no valid sap.ui.core.Label.",
this
);
}
}
if (oMessage.getControlId() !== this.getId()){
oMessage.addControlId(this.getId());
bForceUpdate = true;
}
}.bind(this));
// Update the model to apply the changes
var oMessageModel = sap.ui.getCore().getMessageManager().getMessageModel();
oMessageModel.checkUpdate(bForceUpdate, true);
// propagate messages
if (aMessages && aMessages.length > 0) {
var oMessage = aMessages[0];
// check if the message type is a valid sap.ui.core.ValueState
if (ValueState[oMessage.type]) {
this.setValueState(oMessage.type);
this.setValueStateText(oMessage.message);
}
} else {
this.setValueState(ValueState.None);
this.setValueStateText('');
}
}
} | javascript | function refreshDataState (sName, oDataState) {
if (oDataState.getChanges().messages) {
var aMessages = oDataState.getMessages();
var aLabels = sap.ui.core.LabelEnablement.getReferencingLabels(this);
var sLabelId = aLabels[0];
var bForceUpdate = false;
aMessages.forEach(function(oMessage) {
if (aLabels && aLabels.length > 0) {
// we simply take the first label text and ignore all others
var oLabel = sap.ui.getCore().byId(sLabelId);
if (oLabel.getMetadata().isInstanceOf("sap.ui.core.Label") && oLabel.getText && oMessage.getAdditionalText() !== oLabel.getText()) {
oMessage.setAdditionalText(oLabel.getText());
bForceUpdate = true;
} else {
Log.warning(
"sap.ui.core.message.Message: Can't create labelText." +
"Label with id " + sLabelId + " is no valid sap.ui.core.Label.",
this
);
}
}
if (oMessage.getControlId() !== this.getId()){
oMessage.addControlId(this.getId());
bForceUpdate = true;
}
}.bind(this));
// Update the model to apply the changes
var oMessageModel = sap.ui.getCore().getMessageManager().getMessageModel();
oMessageModel.checkUpdate(bForceUpdate, true);
// propagate messages
if (aMessages && aMessages.length > 0) {
var oMessage = aMessages[0];
// check if the message type is a valid sap.ui.core.ValueState
if (ValueState[oMessage.type]) {
this.setValueState(oMessage.type);
this.setValueStateText(oMessage.message);
}
} else {
this.setValueState(ValueState.None);
this.setValueStateText('');
}
}
} | [
"function",
"refreshDataState",
"(",
"sName",
",",
"oDataState",
")",
"{",
"if",
"(",
"oDataState",
".",
"getChanges",
"(",
")",
".",
"messages",
")",
"{",
"var",
"aMessages",
"=",
"oDataState",
".",
"getMessages",
"(",
")",
";",
"var",
"aLabels",
"=",
"... | If messages are present:
- Adds an additional text to the message from the label(s) of the corresponding control instance
- Adds the control ID to the messages
- Propagates the value state | [
"If",
"messages",
"are",
"present",
":",
"-",
"Adds",
"an",
"additional",
"text",
"to",
"the",
"message",
"from",
"the",
"label",
"(",
"s",
")",
"of",
"the",
"corresponding",
"control",
"instance",
"-",
"Adds",
"the",
"control",
"ID",
"to",
"the",
"messa... | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/message/MessageMixin.js#L35-L80 | train | Refreshes the data state of the control | [
30522,
3853,
25416,
21898,
2850,
10230,
12259,
1006,
1055,
18442,
1010,
1051,
2850,
10230,
12259,
1007,
1063,
2065,
1006,
1051,
2850,
10230,
12259,
1012,
2131,
22305,
2229,
1006,
1007,
1012,
7696,
1007,
1063,
13075,
19900,
3736,
8449,
1027,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
fex-team/webuploader | dist/webuploader.withoutimage.js | function( Super, protos, staticProtos ) {
var child;
if ( typeof protos === 'function' ) {
child = protos;
protos = null;
} else if ( protos && protos.hasOwnProperty('constructor') ) {
child = protos.constructor;
} else {
child = function() {
return Super.apply( this, arguments );
};
}
// 复制静态方法
$.extend( true, child, Super, staticProtos || {} );
/* jshint camelcase: false */
// 让子类的__super__属性指向父类。
child.__super__ = Super.prototype;
// 构建原型,添加原型方法或属性。
// 暂时用Object.create实现。
child.prototype = createObject( Super.prototype );
protos && $.extend( true, child.prototype, protos );
return child;
} | javascript | function( Super, protos, staticProtos ) {
var child;
if ( typeof protos === 'function' ) {
child = protos;
protos = null;
} else if ( protos && protos.hasOwnProperty('constructor') ) {
child = protos.constructor;
} else {
child = function() {
return Super.apply( this, arguments );
};
}
// 复制静态方法
$.extend( true, child, Super, staticProtos || {} );
/* jshint camelcase: false */
// 让子类的__super__属性指向父类。
child.__super__ = Super.prototype;
// 构建原型,添加原型方法或属性。
// 暂时用Object.create实现。
child.prototype = createObject( Super.prototype );
protos && $.extend( true, child.prototype, protos );
return child;
} | [
"function",
"(",
"Super",
",",
"protos",
",",
"staticProtos",
")",
"{",
"var",
"child",
";",
"if",
"(",
"typeof",
"protos",
"===",
"'function'",
")",
"{",
"child",
"=",
"protos",
";",
"protos",
"=",
"null",
";",
"}",
"else",
"if",
"(",
"protos",
"&&"... | 实现类与类之间的继承。
@method inherits
@grammar Base.inherits( super ) => child
@grammar Base.inherits( super, protos ) => child
@grammar Base.inherits( super, protos, statics ) => child
@param {Class} super 父类
@param {Object | Function} [protos] 子类或者对象。如果对象中包含constructor,子类将是用此属性值。
@param {Function} [protos.constructor] 子类构造器,不指定的话将创建个临时的直接执行父类构造器的方法。
@param {Object} [statics] 静态属性或方法。
@return {Class} 返回子类。
@example
function Person() {
console.log( 'Super' );
}
Person.prototype.hello = function() {
console.log( 'hello' );
};
var Manager = Base.inherits( Person, {
world: function() {
console.log( 'World' );
}
});
// 因为没有指定构造器,父类的构造器将会执行。
var instance = new Manager(); // => Super
// 继承子父类的方法
instance.hello(); // => hello
instance.world(); // => World
// 子类的__super__属性指向父类
console.log( Manager.__super__ === Person ); // => true | [
"实现类与类之间的继承。",
"@method",
"inherits",
"@grammar",
"Base",
".",
"inherits",
"(",
"super",
")",
"=",
">",
"child",
"@grammar",
"Base",
".",
"inherits",
"(",
"super",
"protos",
")",
"=",
">",
"child",
"@grammar",
"Base",
".",
"inherits",
"(",
"super",
"protos... | 7094e4476c5af3b06993d91dde2d223200b9feb7 | https://github.com/fex-team/webuploader/blob/7094e4476c5af3b06993d91dde2d223200b9feb7/dist/webuploader.withoutimage.js#L342-L370 | train | create a new instance of a class | [
30522,
3853,
1006,
3565,
1010,
30524,
2775,
1025,
2065,
1006,
2828,
11253,
15053,
2015,
1027,
1027,
1027,
1005,
3853,
1005,
1007,
1063,
2775,
1027,
15053,
2015,
1025,
15053,
2015,
1027,
19701,
1025,
1065,
2842,
2065,
1006,
15053,
2015,
1004... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
TryGhost/Ghost | core/server/api/v0.1/users.js | handlePermissions | function handlePermissions(options) {
return canThis(options.context).edit.user(options.data.password[0].user_id).then(() => {
return options;
}).catch((err) => {
return Promise.reject(new common.errors.NoPermissionError({
err: err,
context: common.i18n.t('errors.api.users.noPermissionToChangeUsersPwd')
}));
});
} | javascript | function handlePermissions(options) {
return canThis(options.context).edit.user(options.data.password[0].user_id).then(() => {
return options;
}).catch((err) => {
return Promise.reject(new common.errors.NoPermissionError({
err: err,
context: common.i18n.t('errors.api.users.noPermissionToChangeUsersPwd')
}));
});
} | [
"function",
"handlePermissions",
"(",
"options",
")",
"{",
"return",
"canThis",
"(",
"options",
".",
"context",
")",
".",
"edit",
".",
"user",
"(",
"options",
".",
"data",
".",
"password",
"[",
"0",
"]",
".",
"user_id",
")",
".",
"then",
"(",
"(",
")... | ### Handle Permissions
We need to be an authorised user to perform this action
@param {Object} options
@returns {Object} options | [
"###",
"Handle",
"Permissions",
"We",
"need",
"to",
"be",
"an",
"authorised",
"user",
"to",
"perform",
"this",
"action"
] | bb7bb55cf3e60af99ebbc56099928827b58461bc | https://github.com/TryGhost/Ghost/blob/bb7bb55cf3e60af99ebbc56099928827b58461bc/core/server/api/v0.1/users.js#L261-L270 | train | Check if user has permissions to change users password | [
30522,
3853,
5047,
30524,
8909,
1007,
1012,
2059,
1006,
1006,
1007,
1027,
1028,
1063,
2709,
7047,
1025,
1065,
1007,
1012,
4608,
1006,
1006,
9413,
2099,
1007,
1027,
1028,
1063,
2709,
4872,
1012,
15454,
1006,
2047,
2691,
1012,
10697,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.rta/src/sap/ui/rta/ControlTreeModifier.js | function (oControl, sPropertyName, oPropertyBinding) {
var oOldValue;
var oMetadata = oControl.getMetadata().getPropertyLikeSetting(sPropertyName);
if (oMetadata) {
var sPropertyGetter = oMetadata._sGetter;
oOldValue = oControl[sPropertyGetter]();
}
JsControlTreeModifier.setPropertyBinding.apply(this, arguments);
/* If the value changed, record the reversal as undo operation */
if (oOldValue !== oPropertyBinding) {
this._saveUndoOperation("setPropertyBinding", [oControl, sPropertyName, oOldValue]);
}
} | javascript | function (oControl, sPropertyName, oPropertyBinding) {
var oOldValue;
var oMetadata = oControl.getMetadata().getPropertyLikeSetting(sPropertyName);
if (oMetadata) {
var sPropertyGetter = oMetadata._sGetter;
oOldValue = oControl[sPropertyGetter]();
}
JsControlTreeModifier.setPropertyBinding.apply(this, arguments);
/* If the value changed, record the reversal as undo operation */
if (oOldValue !== oPropertyBinding) {
this._saveUndoOperation("setPropertyBinding", [oControl, sPropertyName, oOldValue]);
}
} | [
"function",
"(",
"oControl",
",",
"sPropertyName",
",",
"oPropertyBinding",
")",
"{",
"var",
"oOldValue",
";",
"var",
"oMetadata",
"=",
"oControl",
".",
"getMetadata",
"(",
")",
".",
"getPropertyLikeSetting",
"(",
"sPropertyName",
")",
";",
"if",
"(",
"oMetada... | Record the previous value of the property binding in the undo operation
@override | [
"Record",
"the",
"previous",
"value",
"of",
"the",
"property",
"binding",
"in",
"the",
"undo",
"operation"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.rta/src/sap/ui/rta/ControlTreeModifier.js#L187-L202 | train | Sets the value of a property in the control tree. | [
30522,
3853,
1006,
1051,
8663,
13181,
2140,
1010,
11867,
18981,
15010,
18442,
1010,
6728,
18981,
15010,
8428,
4667,
1007,
1063,
13075,
1051,
11614,
10175,
5657,
1025,
13075,
18168,
12928,
2850,
2696,
1027,
1051,
8663,
13181,
2140,
1012,
2131,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
dcloudio/mui | examples/hello-mui/js/mui.picker.all.js | function() {
var self = this;
if (self.disposed) return;
self.panel.classList.remove($.className('active'));
self.mask.close();
document.body.classList.remove($.className('poppicker-active-for-page'));
//处理物理返回键
$.back=self.__back;
} | javascript | function() {
var self = this;
if (self.disposed) return;
self.panel.classList.remove($.className('active'));
self.mask.close();
document.body.classList.remove($.className('poppicker-active-for-page'));
//处理物理返回键
$.back=self.__back;
} | [
"function",
"(",
")",
"{",
"var",
"self",
"=",
"this",
";",
"if",
"(",
"self",
".",
"disposed",
")",
"return",
";",
"self",
".",
"panel",
".",
"classList",
".",
"remove",
"(",
"$",
".",
"className",
"(",
"'active'",
")",
")",
";",
"self",
".",
"m... | 隐藏 | [
"隐藏"
] | ff74c90a1671a552f3604b1288bf38a4126312d0 | https://github.com/dcloudio/mui/blob/ff74c90a1671a552f3604b1288bf38a4126312d0/examples/hello-mui/js/mui.picker.all.js#L524-L532 | train | Close the popup | [
30522,
3853,
1006,
1007,
1063,
13075,
2969,
1027,
2023,
1025,
2065,
1006,
2969,
1012,
21866,
1007,
2709,
1025,
2969,
1012,
5997,
1012,
2465,
9863,
1012,
6366,
1006,
1002,
1012,
2465,
18442,
1006,
1005,
3161,
1005,
1007,
1007,
1025,
2969,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
ecomfe/zrender | src/contain/path.js | windingArc | function windingArc(
cx, cy, r, startAngle, endAngle, anticlockwise, x, y
) {
y -= cy;
if (y > r || y < -r) {
return 0;
}
var tmp = Math.sqrt(r * r - y * y);
roots[0] = -tmp;
roots[1] = tmp;
var diff = Math.abs(startAngle - endAngle);
if (diff < 1e-4) {
return 0;
}
if (diff % PI2 < 1e-4) {
// Is a circle
startAngle = 0;
endAngle = PI2;
var dir = anticlockwise ? 1 : -1;
if (x >= roots[0] + cx && x <= roots[1] + cx) {
return dir;
}
else {
return 0;
}
}
if (anticlockwise) {
var tmp = startAngle;
startAngle = normalizeRadian(endAngle);
endAngle = normalizeRadian(tmp);
}
else {
startAngle = normalizeRadian(startAngle);
endAngle = normalizeRadian(endAngle);
}
if (startAngle > endAngle) {
endAngle += PI2;
}
var w = 0;
for (var i = 0; i < 2; i++) {
var x_ = roots[i];
if (x_ + cx > x) {
var angle = Math.atan2(y, x_);
var dir = anticlockwise ? 1 : -1;
if (angle < 0) {
angle = PI2 + angle;
}
if (
(angle >= startAngle && angle <= endAngle)
|| (angle + PI2 >= startAngle && angle + PI2 <= endAngle)
) {
if (angle > Math.PI / 2 && angle < Math.PI * 1.5) {
dir = -dir;
}
w += dir;
}
}
}
return w;
} | javascript | function windingArc(
cx, cy, r, startAngle, endAngle, anticlockwise, x, y
) {
y -= cy;
if (y > r || y < -r) {
return 0;
}
var tmp = Math.sqrt(r * r - y * y);
roots[0] = -tmp;
roots[1] = tmp;
var diff = Math.abs(startAngle - endAngle);
if (diff < 1e-4) {
return 0;
}
if (diff % PI2 < 1e-4) {
// Is a circle
startAngle = 0;
endAngle = PI2;
var dir = anticlockwise ? 1 : -1;
if (x >= roots[0] + cx && x <= roots[1] + cx) {
return dir;
}
else {
return 0;
}
}
if (anticlockwise) {
var tmp = startAngle;
startAngle = normalizeRadian(endAngle);
endAngle = normalizeRadian(tmp);
}
else {
startAngle = normalizeRadian(startAngle);
endAngle = normalizeRadian(endAngle);
}
if (startAngle > endAngle) {
endAngle += PI2;
}
var w = 0;
for (var i = 0; i < 2; i++) {
var x_ = roots[i];
if (x_ + cx > x) {
var angle = Math.atan2(y, x_);
var dir = anticlockwise ? 1 : -1;
if (angle < 0) {
angle = PI2 + angle;
}
if (
(angle >= startAngle && angle <= endAngle)
|| (angle + PI2 >= startAngle && angle + PI2 <= endAngle)
) {
if (angle > Math.PI / 2 && angle < Math.PI * 1.5) {
dir = -dir;
}
w += dir;
}
}
}
return w;
} | [
"function",
"windingArc",
"(",
"cx",
",",
"cy",
",",
"r",
",",
"startAngle",
",",
"endAngle",
",",
"anticlockwise",
",",
"x",
",",
"y",
")",
"{",
"y",
"-=",
"cy",
";",
"if",
"(",
"y",
">",
"r",
"||",
"y",
"<",
"-",
"r",
")",
"{",
"return",
"0... | TODO Arc 旋转 | [
"TODO",
"Arc",
"旋转"
] | 30321b57cba3149c30eacb0c1e18276f0f001b9f | https://github.com/ecomfe/zrender/blob/30321b57cba3149c30eacb0c1e18276f0f001b9f/src/contain/path.js#L141-L203 | train | returns the winding arc of the given arc | [
30522,
3853,
12788,
2906,
2278,
1006,
1039,
2595,
1010,
22330,
1010,
1054,
1010,
2707,
5654,
2571,
1010,
2203,
5654,
2571,
1010,
3424,
20464,
7432,
14244,
1010,
1060,
1010,
1061,
1007,
1063,
1061,
1011,
1027,
22330,
1025,
2065,
1006,
1061,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
angular/material | src/components/chips/js/chipsDirective.js | compile | function compile(element, attr) {
// Grab the user template from attr and reset the attribute to null.
var userTemplate = attr['$mdUserTemplate'];
attr['$mdUserTemplate'] = null;
var chipTemplate = getTemplateByQuery('md-chips>md-chip-template');
var chipRemoveSelector = $mdUtil
.prefixer()
.buildList('md-chip-remove')
.map(function(attr) {
return 'md-chips>*[' + attr + ']';
})
.join(',');
// Set the chip remove, chip contents and chip input templates. The link function will put
// them on the scope for transclusion later.
var chipRemoveTemplate = getTemplateByQuery(chipRemoveSelector) || templates.remove,
chipContentsTemplate = chipTemplate || templates.default,
chipInputTemplate = getTemplateByQuery('md-chips>md-autocomplete')
|| getTemplateByQuery('md-chips>input')
|| templates.input,
staticChips = userTemplate.find('md-chip');
// Warn of malformed template. See #2545
if (userTemplate[0].querySelector('md-chip-template>*[md-chip-remove]')) {
$log.warn('invalid placement of md-chip-remove within md-chip-template.');
}
function getTemplateByQuery (query) {
if (!attr.ngModel) return;
var element = userTemplate[0].querySelector(query);
return element && element.outerHTML;
}
/**
* Configures controller and transcludes.
*/
return function postLink(scope, element, attrs, controllers) {
$mdUtil.initOptionalProperties(scope, attr);
$mdTheming(element);
var mdChipsCtrl = controllers[0];
if (chipTemplate) {
// Chip editing functionality assumes we are using the default chip template.
mdChipsCtrl.enableChipEdit = false;
}
mdChipsCtrl.chipContentsTemplate = chipContentsTemplate;
mdChipsCtrl.chipRemoveTemplate = chipRemoveTemplate;
mdChipsCtrl.chipInputTemplate = chipInputTemplate;
mdChipsCtrl.mdCloseIcon = $$mdSvgRegistry.mdClose;
element
.attr({ tabindex: -1 })
.on('focus', function () { mdChipsCtrl.onFocus(); })
.on('click', function () {
if (!mdChipsCtrl.readonly && mdChipsCtrl.selectedChip === -1) {
mdChipsCtrl.onFocus();
}
});
if (attr.ngModel) {
mdChipsCtrl.configureNgModel(element.controller('ngModel'));
// If an `md-transform-chip` attribute was set, tell the controller to use the expression
// before appending chips.
if (attrs.mdTransformChip) mdChipsCtrl.useTransformChipExpression();
// If an `md-on-append` attribute was set, tell the controller to use the expression
// when appending chips.
//
// TODO: Remove this now that 1.0 is long since released
// DEPRECATED: Will remove in official 1.0 release
if (attrs.mdOnAppend) mdChipsCtrl.useOnAppendExpression();
// If an `md-on-add` attribute was set, tell the controller to use the expression
// when adding chips.
if (attrs.mdOnAdd) mdChipsCtrl.useOnAddExpression();
// If an `md-on-remove` attribute was set, tell the controller to use the expression
// when removing chips.
if (attrs.mdOnRemove) mdChipsCtrl.useOnRemoveExpression();
// If an `md-on-select` attribute was set, tell the controller to use the expression
// when selecting chips.
if (attrs.mdOnSelect) mdChipsCtrl.useOnSelectExpression();
// The md-autocomplete and input elements won't be compiled until after this directive
// is complete (due to their nested nature). Wait a tick before looking for them to
// configure the controller.
if (chipInputTemplate !== templates.input) {
// The autocomplete will not appear until the readonly attribute is not true (i.e.
// false or undefined), so we have to watch the readonly and then on the next tick
// after the chip transclusion has run, we can configure the autocomplete and user
// input.
scope.$watch('$mdChipsCtrl.readonly', function(readonly) {
if (!readonly) {
$mdUtil.nextTick(function(){
if (chipInputTemplate.indexOf('<md-autocomplete') === 0) {
var autocompleteEl = element.find('md-autocomplete');
mdChipsCtrl.configureAutocomplete(autocompleteEl.controller('mdAutocomplete'));
}
mdChipsCtrl.configureUserInput(element.find('input'));
});
}
});
}
// At the next tick, if we find an input, make sure it has the md-input class
$mdUtil.nextTick(function() {
var input = element.find('input');
if (input) {
mdChipsCtrl.configureInput(input);
input.toggleClass('md-input', true);
}
});
}
// Compile with the parent's scope and prepend any static chips to the wrapper.
if (staticChips.length > 0) {
var compiledStaticChips = $compile(staticChips.clone())(scope.$parent);
$timeout(function() { element.find('md-chips-wrap').prepend(compiledStaticChips); });
}
};
} | javascript | function compile(element, attr) {
// Grab the user template from attr and reset the attribute to null.
var userTemplate = attr['$mdUserTemplate'];
attr['$mdUserTemplate'] = null;
var chipTemplate = getTemplateByQuery('md-chips>md-chip-template');
var chipRemoveSelector = $mdUtil
.prefixer()
.buildList('md-chip-remove')
.map(function(attr) {
return 'md-chips>*[' + attr + ']';
})
.join(',');
// Set the chip remove, chip contents and chip input templates. The link function will put
// them on the scope for transclusion later.
var chipRemoveTemplate = getTemplateByQuery(chipRemoveSelector) || templates.remove,
chipContentsTemplate = chipTemplate || templates.default,
chipInputTemplate = getTemplateByQuery('md-chips>md-autocomplete')
|| getTemplateByQuery('md-chips>input')
|| templates.input,
staticChips = userTemplate.find('md-chip');
// Warn of malformed template. See #2545
if (userTemplate[0].querySelector('md-chip-template>*[md-chip-remove]')) {
$log.warn('invalid placement of md-chip-remove within md-chip-template.');
}
function getTemplateByQuery (query) {
if (!attr.ngModel) return;
var element = userTemplate[0].querySelector(query);
return element && element.outerHTML;
}
/**
* Configures controller and transcludes.
*/
return function postLink(scope, element, attrs, controllers) {
$mdUtil.initOptionalProperties(scope, attr);
$mdTheming(element);
var mdChipsCtrl = controllers[0];
if (chipTemplate) {
// Chip editing functionality assumes we are using the default chip template.
mdChipsCtrl.enableChipEdit = false;
}
mdChipsCtrl.chipContentsTemplate = chipContentsTemplate;
mdChipsCtrl.chipRemoveTemplate = chipRemoveTemplate;
mdChipsCtrl.chipInputTemplate = chipInputTemplate;
mdChipsCtrl.mdCloseIcon = $$mdSvgRegistry.mdClose;
element
.attr({ tabindex: -1 })
.on('focus', function () { mdChipsCtrl.onFocus(); })
.on('click', function () {
if (!mdChipsCtrl.readonly && mdChipsCtrl.selectedChip === -1) {
mdChipsCtrl.onFocus();
}
});
if (attr.ngModel) {
mdChipsCtrl.configureNgModel(element.controller('ngModel'));
// If an `md-transform-chip` attribute was set, tell the controller to use the expression
// before appending chips.
if (attrs.mdTransformChip) mdChipsCtrl.useTransformChipExpression();
// If an `md-on-append` attribute was set, tell the controller to use the expression
// when appending chips.
//
// TODO: Remove this now that 1.0 is long since released
// DEPRECATED: Will remove in official 1.0 release
if (attrs.mdOnAppend) mdChipsCtrl.useOnAppendExpression();
// If an `md-on-add` attribute was set, tell the controller to use the expression
// when adding chips.
if (attrs.mdOnAdd) mdChipsCtrl.useOnAddExpression();
// If an `md-on-remove` attribute was set, tell the controller to use the expression
// when removing chips.
if (attrs.mdOnRemove) mdChipsCtrl.useOnRemoveExpression();
// If an `md-on-select` attribute was set, tell the controller to use the expression
// when selecting chips.
if (attrs.mdOnSelect) mdChipsCtrl.useOnSelectExpression();
// The md-autocomplete and input elements won't be compiled until after this directive
// is complete (due to their nested nature). Wait a tick before looking for them to
// configure the controller.
if (chipInputTemplate !== templates.input) {
// The autocomplete will not appear until the readonly attribute is not true (i.e.
// false or undefined), so we have to watch the readonly and then on the next tick
// after the chip transclusion has run, we can configure the autocomplete and user
// input.
scope.$watch('$mdChipsCtrl.readonly', function(readonly) {
if (!readonly) {
$mdUtil.nextTick(function(){
if (chipInputTemplate.indexOf('<md-autocomplete') === 0) {
var autocompleteEl = element.find('md-autocomplete');
mdChipsCtrl.configureAutocomplete(autocompleteEl.controller('mdAutocomplete'));
}
mdChipsCtrl.configureUserInput(element.find('input'));
});
}
});
}
// At the next tick, if we find an input, make sure it has the md-input class
$mdUtil.nextTick(function() {
var input = element.find('input');
if (input) {
mdChipsCtrl.configureInput(input);
input.toggleClass('md-input', true);
}
});
}
// Compile with the parent's scope and prepend any static chips to the wrapper.
if (staticChips.length > 0) {
var compiledStaticChips = $compile(staticChips.clone())(scope.$parent);
$timeout(function() { element.find('md-chips-wrap').prepend(compiledStaticChips); });
}
};
} | [
"function",
"compile",
"(",
"element",
",",
"attr",
")",
"{",
"// Grab the user template from attr and reset the attribute to null.",
"var",
"userTemplate",
"=",
"attr",
"[",
"'$mdUserTemplate'",
"]",
";",
"attr",
"[",
"'$mdUserTemplate'",
"]",
"=",
"null",
";",
"var"... | Builds the final template for `md-chips` and returns the postLink function.
Building the template involves 3 key components:
static chips
chip template
input control
If no `ng-model` is provided, only the static chip work needs to be done.
If no user-passed `md-chip-template` exists, the default template is used. This resulting
template is appended to the chip content element.
The remove button may be overridden by passing an element with an md-chip-remove attribute.
If an `input` or `md-autocomplete` element is provided by the caller, it is set aside for
transclusion later. The transclusion happens in `postLink` as the parent scope is required.
If no user input is provided, a default one is appended to the input container node in the
template.
Static Chips (i.e. `md-chip` elements passed from the caller) are gathered and set aside for
transclusion in the `postLink` function.
@param element
@param attr
@returns {Function} | [
"Builds",
"the",
"final",
"template",
"for",
"md",
"-",
"chips",
"and",
"returns",
"the",
"postLink",
"function",
"."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/chips/js/chipsDirective.js#L349-L479 | train | Compile the md - chips directive. | [
30522,
3853,
4012,
22090,
1006,
5783,
1010,
2012,
16344,
1007,
1063,
1013,
1013,
6723,
1996,
5310,
23561,
2013,
2012,
16344,
1998,
25141,
1996,
17961,
2000,
19701,
1012,
13075,
5310,
18532,
15725,
1027,
2012,
16344,
1031,
1005,
1002,
9108,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
transloadit/uppy | website/build-examples.js | onError | function onError (err) {
console.error(chalk.red('✗ error:'), chalk.red(err.message))
notifier.notify({
title: 'Build failed:',
message: err.message
})
this.emit('end')
// When running without watch, process.exit(1) on error
if (!watchifyEnabled) {
process.exit(1)
}
} | javascript | function onError (err) {
console.error(chalk.red('✗ error:'), chalk.red(err.message))
notifier.notify({
title: 'Build failed:',
message: err.message
})
this.emit('end')
// When running without watch, process.exit(1) on error
if (!watchifyEnabled) {
process.exit(1)
}
} | [
"function",
"onError",
"(",
"err",
")",
"{",
"console",
".",
"error",
"(",
"chalk",
".",
"red",
"(",
"'✗ error:'),",
" ",
"c",
"alk.r",
"e",
"d(e",
"r",
"r.m",
"e",
"ssage))",
"",
"",
"notifier",
".",
"notify",
"(",
"{",
"title",
":",
"'Build failed:... | Logs to console and shows desktop notification on error.
Calls `this.emit(end)` to stop bundling.
@param {object} err Error object | [
"Logs",
"to",
"console",
"and",
"shows",
"desktop",
"notification",
"on",
"error",
".",
"Calls",
"this",
".",
"emit",
"(",
"end",
")",
"to",
"stop",
"bundling",
"."
] | 7ae18bf992d544a64da998f033258ec09a3de275 | https://github.com/transloadit/uppy/blob/7ae18bf992d544a64da998f033258ec09a3de275/website/build-examples.js#L147-L159 | train | Handle error | [
30522,
3853,
2028,
18933,
2099,
1006,
9413,
2099,
1007,
1063,
10122,
1012,
7561,
1006,
16833,
1012,
2417,
1006,
1005,
100,
7561,
1024,
1005,
1007,
1010,
16833,
1012,
2417,
1006,
9413,
2099,
1012,
4471,
1007,
1007,
2025,
18095,
1012,
2025,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
sparksuite/simplemde-markdown-editor | src/js/simplemde.js | _mergeProperties | function _mergeProperties(target, source) {
for(var property in source) {
if(source.hasOwnProperty(property)) {
if(source[property] instanceof Array) {
target[property] = source[property].concat(target[property] instanceof Array ? target[property] : []);
} else if(
source[property] !== null &&
typeof source[property] === "object" &&
source[property].constructor === Object
) {
target[property] = _mergeProperties(target[property] || {}, source[property]);
} else {
target[property] = source[property];
}
}
}
return target;
} | javascript | function _mergeProperties(target, source) {
for(var property in source) {
if(source.hasOwnProperty(property)) {
if(source[property] instanceof Array) {
target[property] = source[property].concat(target[property] instanceof Array ? target[property] : []);
} else if(
source[property] !== null &&
typeof source[property] === "object" &&
source[property].constructor === Object
) {
target[property] = _mergeProperties(target[property] || {}, source[property]);
} else {
target[property] = source[property];
}
}
}
return target;
} | [
"function",
"_mergeProperties",
"(",
"target",
",",
"source",
")",
"{",
"for",
"(",
"var",
"property",
"in",
"source",
")",
"{",
"if",
"(",
"source",
".",
"hasOwnProperty",
"(",
"property",
")",
")",
"{",
"if",
"(",
"source",
"[",
"property",
"]",
"ins... | Merge the properties of one object into another. | [
"Merge",
"the",
"properties",
"of",
"one",
"object",
"into",
"another",
"."
] | 6abda7ab68cc20f4aca870eb243747951b90ab04 | https://github.com/sparksuite/simplemde-markdown-editor/blob/6abda7ab68cc20f4aca870eb243747951b90ab04/src/js/simplemde.js#L1024-L1042 | train | Merges properties from source into target | [
30522,
3853,
1035,
13590,
21572,
4842,
7368,
1006,
4539,
1010,
3120,
1007,
1063,
2005,
1006,
13075,
3200,
1999,
3120,
1007,
1063,
2065,
1006,
3120,
1012,
2038,
12384,
21572,
4842,
3723,
1006,
3200,
1007,
1007,
1063,
2065,
1006,
3120,
1031,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
postmanlabs/newman | examples/parallel-collection-runs.js | function (err, results) {
err && console.error(err);
results.forEach(function (result) {
var failures = result.run.failures;
console.info(failures.length ? JSON.stringify(failures.failures, null, 2) :
`${result.collection.name} ran successfully.`);
});
} | javascript | function (err, results) {
err && console.error(err);
results.forEach(function (result) {
var failures = result.run.failures;
console.info(failures.length ? JSON.stringify(failures.failures, null, 2) :
`${result.collection.name} ran successfully.`);
});
} | [
"function",
"(",
"err",
",",
"results",
")",
"{",
"err",
"&&",
"console",
".",
"error",
"(",
"err",
")",
";",
"results",
".",
"forEach",
"(",
"function",
"(",
"result",
")",
"{",
"var",
"failures",
"=",
"result",
".",
"run",
".",
"failures",
";",
"... | The
@param {?Error} err - An Error instance / null that determines whether or not the parallel collection run
succeeded.
@param {Array} results - An array of collection run summary objects. | [
"The"
] | c05a5a1e82aa3c2021e94ba09e627ba4718af69e | https://github.com/postmanlabs/newman/blob/c05a5a1e82aa3c2021e94ba09e627ba4718af69e/examples/parallel-collection-runs.js#L43-L52 | train | print results | [
30522,
3853,
1006,
9413,
2099,
1010,
3463,
1007,
1063,
9413,
2099,
1004,
1004,
10122,
1012,
7561,
1006,
9413,
2099,
1007,
1025,
3463,
1012,
18921,
6776,
1006,
3853,
1006,
2765,
1007,
1063,
13075,
15428,
1027,
2765,
1012,
2448,
1012,
15428,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
goldfire/howler.js | dist/howler.js | function(event, fn, id, once) {
var self = this;
var events = self['_on' + event];
if (typeof fn === 'function') {
events.push(once ? {id: id, fn: fn, once: once} : {id: id, fn: fn});
}
return self;
} | javascript | function(event, fn, id, once) {
var self = this;
var events = self['_on' + event];
if (typeof fn === 'function') {
events.push(once ? {id: id, fn: fn, once: once} : {id: id, fn: fn});
}
return self;
} | [
"function",
"(",
"event",
",",
"fn",
",",
"id",
",",
"once",
")",
"{",
"var",
"self",
"=",
"this",
";",
"var",
"events",
"=",
"self",
"[",
"'_on'",
"+",
"event",
"]",
";",
"if",
"(",
"typeof",
"fn",
"===",
"'function'",
")",
"{",
"events",
".",
... | Listen to a custom event.
@param {String} event Event name.
@param {Function} fn Listener to call.
@param {Number} id (optional) Only listen to events for this sound.
@param {Number} once (INTERNAL) Marks event to fire only once.
@return {Howl} | [
"Listen",
"to",
"a",
"custom",
"event",
"."
] | 030db918dd8ce640afd57e172418472497e8f113 | https://github.com/goldfire/howler.js/blob/030db918dd8ce640afd57e172418472497e8f113/dist/howler.js#L1771-L1780 | train | Add an event listener | [
30522,
3853,
1006,
2724,
1010,
1042,
2078,
1010,
8909,
1010,
2320,
1007,
1063,
13075,
2969,
1027,
2023,
1025,
13075,
2824,
1027,
2969,
1031,
1005,
1035,
2006,
1005,
1009,
2724,
1033,
1025,
2065,
1006,
2828,
11253,
1042,
2078,
1027,
1027,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
Dogfalo/materialize | extras/noUiSlider/nouislider.js | destroy | function destroy ( ) {
for ( var key in options.cssClasses ) {
if ( !options.cssClasses.hasOwnProperty(key) ) { continue; }
removeClass(scope_Target, options.cssClasses[key]);
}
while (scope_Target.firstChild) {
scope_Target.removeChild(scope_Target.firstChild);
}
delete scope_Target.noUiSlider;
} | javascript | function destroy ( ) {
for ( var key in options.cssClasses ) {
if ( !options.cssClasses.hasOwnProperty(key) ) { continue; }
removeClass(scope_Target, options.cssClasses[key]);
}
while (scope_Target.firstChild) {
scope_Target.removeChild(scope_Target.firstChild);
}
delete scope_Target.noUiSlider;
} | [
"function",
"destroy",
"(",
")",
"{",
"for",
"(",
"var",
"key",
"in",
"options",
".",
"cssClasses",
")",
"{",
"if",
"(",
"!",
"options",
".",
"cssClasses",
".",
"hasOwnProperty",
"(",
"key",
")",
")",
"{",
"continue",
";",
"}",
"removeClass",
"(",
"s... | Removes classes from the root and empties it. | [
"Removes",
"classes",
"from",
"the",
"root",
"and",
"empties",
"it",
"."
] | 1122efadad8f1433d404696f7613e3cc13fb83a4 | https://github.com/Dogfalo/materialize/blob/1122efadad8f1433d404696f7613e3cc13fb83a4/extras/noUiSlider/nouislider.js#L1931-L1943 | train | Destroys the page | [
30522,
3853,
6033,
1006,
1007,
1063,
2005,
1006,
13075,
3145,
1999,
7047,
1012,
20116,
11020,
27102,
2229,
1007,
1063,
2065,
1006,
999,
7047,
1012,
20116,
11020,
27102,
2229,
1012,
2038,
12384,
21572,
4842,
3723,
1006,
3145,
1007,
1007,
106... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/model/odata/AnnotationParser.js | function (oElement, mAnnotations) {
var sQualifier,
aSegments = [];
// returns the current oElement's index in its parentElement's "children" collection
// (but works in IE as well)
function index() {
return Array.prototype.filter.call(oElement.parentNode.childNodes, function (oNode) {
return oNode.nodeType === 1;
}).indexOf(oElement);
}
while (oElement.nodeName !== "Annotations") {
switch (oElement.nodeName) {
case "Annotation":
sQualifier = getQualifier(oElement);
aSegments.unshift(oElement.getAttribute("Term")
+ (sQualifier ? "#" + sQualifier : ""));
break;
case "Collection":
break;
case "PropertyValue":
aSegments.unshift(oElement.getAttribute("Property"));
break;
case "Record":
if (oElement.parentNode.nodeName === "Collection") {
aSegments.unshift(index());
}
break;
default:
if (oElement.parentNode.nodeName === "Apply") {
aSegments.unshift("Value");
aSegments.unshift(index());
aSegments.unshift("Parameters");
} else {
aSegments.unshift(oElement.nodeName);
}
break;
}
oElement = oElement.parentNode;
}
aSegments.unshift(oElement.getAttribute("Target"));
aSegments = aSegments.map(function (vSegment) {
return typeof vSegment === "string"
? AnnotationParser.replaceWithAlias(vSegment)
: vSegment;
});
AnnotationParser.syncAnnotationsAtArrays(mAnnotations, aSegments, true);
return aSegments;
} | javascript | function (oElement, mAnnotations) {
var sQualifier,
aSegments = [];
// returns the current oElement's index in its parentElement's "children" collection
// (but works in IE as well)
function index() {
return Array.prototype.filter.call(oElement.parentNode.childNodes, function (oNode) {
return oNode.nodeType === 1;
}).indexOf(oElement);
}
while (oElement.nodeName !== "Annotations") {
switch (oElement.nodeName) {
case "Annotation":
sQualifier = getQualifier(oElement);
aSegments.unshift(oElement.getAttribute("Term")
+ (sQualifier ? "#" + sQualifier : ""));
break;
case "Collection":
break;
case "PropertyValue":
aSegments.unshift(oElement.getAttribute("Property"));
break;
case "Record":
if (oElement.parentNode.nodeName === "Collection") {
aSegments.unshift(index());
}
break;
default:
if (oElement.parentNode.nodeName === "Apply") {
aSegments.unshift("Value");
aSegments.unshift(index());
aSegments.unshift("Parameters");
} else {
aSegments.unshift(oElement.nodeName);
}
break;
}
oElement = oElement.parentNode;
}
aSegments.unshift(oElement.getAttribute("Target"));
aSegments = aSegments.map(function (vSegment) {
return typeof vSegment === "string"
? AnnotationParser.replaceWithAlias(vSegment)
: vSegment;
});
AnnotationParser.syncAnnotationsAtArrays(mAnnotations, aSegments, true);
return aSegments;
} | [
"function",
"(",
"oElement",
",",
"mAnnotations",
")",
"{",
"var",
"sQualifier",
",",
"aSegments",
"=",
"[",
"]",
";",
"// returns the current oElement's index in its parentElement's \"children\" collection",
"// (but works in IE as well)",
"function",
"index",
"(",
")",
"{... | /*
Backs up the annotation corresponding to the given element by adding it also as a sibling of
the array under the name of "Property@Term#Qualifier". This way, it will survive
(de-)serialization via JSON.stringify and JSON.parse. Returns a path which points to it.
@param {Element} oElement
The <Annotation> element of an annotation inside an array
@param {object} mAnnotations
The annotation map
@returns {string[]}
Path of string or number segments pointing to annotation at array
@private
@see AnnotationParser.restoreAnnotationsAtArrays
@see AnnotationParser.syncAnnotationsAtArrays
@static | [
"/",
"*",
"Backs",
"up",
"the",
"annotation",
"corresponding",
"to",
"the",
"given",
"element",
"by",
"adding",
"it",
"also",
"as",
"a",
"sibling",
"of",
"the",
"array",
"under",
"the",
"name",
"of",
"Property@Term#Qualifier",
".",
"This",
"way",
"it",
"wi... | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/AnnotationParser.js#L436-L492 | train | Syncs the annotations at the current index of the given element. | [
30522,
3853,
1006,
1051,
12260,
3672,
1010,
10856,
17287,
9285,
1007,
1063,
13075,
5490,
8787,
18095,
1010,
2004,
13910,
8163,
1027,
1031,
1033,
1025,
1013,
1013,
5651,
1996,
2783,
1051,
12260,
3672,
1005,
1055,
5950,
1999,
2049,
6687,
1226... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
angular/material | src/components/panel/panel.js | MdPanelRef | function MdPanelRef(config, $injector) {
// Injected variables.
/** @private @const {!angular.$q} */
this._$q = $injector.get('$q');
/** @private @const {!angular.$mdCompiler} */
this._$mdCompiler = $injector.get('$mdCompiler');
/** @private @const {!angular.$mdConstant} */
this._$mdConstant = $injector.get('$mdConstant');
/** @private @const {!angular.$mdUtil} */
this._$mdUtil = $injector.get('$mdUtil');
/** @private @const {!angular.$mdTheming} */
this._$mdTheming = $injector.get('$mdTheming');
/** @private @const {!angular.Scope} */
this._$rootScope = $injector.get('$rootScope');
/** @private @const {!angular.$animate} */
this._$animate = $injector.get('$animate');
/** @private @const {!MdPanelRef} */
this._$mdPanel = $injector.get('$mdPanel');
/** @private @const {!angular.$log} */
this._$log = $injector.get('$log');
/** @private @const {!angular.$window} */
this._$window = $injector.get('$window');
/** @private @const {!Function} */
this._$$rAF = $injector.get('$$rAF');
// Public variables.
/**
* Unique id for the panelRef.
* @type {string}
*/
this.id = config.id;
/** @type {!Object} */
this.config = config;
/** @type {!angular.JQLite|undefined} */
this.panelContainer;
/** @type {!angular.JQLite|undefined} */
this.panelEl;
/**
* Whether the panel is attached. This is synchronous. When attach is called,
* isAttached is set to true. When detach is called, isAttached is set to
* false.
* @type {boolean}
*/
this.isAttached = false;
// Private variables.
/** @private {Array<function()>} */
this._removeListeners = [];
/** @private {!angular.JQLite|undefined} */
this._topFocusTrap;
/** @private {!angular.JQLite|undefined} */
this._bottomFocusTrap;
/** @private {!$mdPanel|undefined} */
this._backdropRef;
/** @private {Function?} */
this._restoreScroll = null;
/**
* Keeps track of all the panel interceptors.
* @private {!Object}
*/
this._interceptors = Object.create(null);
/**
* Cleanup function, provided by `$mdCompiler` and assigned after the element
* has been compiled. When `contentElement` is used, the function is used to
* restore the element to it's proper place in the DOM.
* @private {!Function}
*/
this._compilerCleanup = null;
/**
* Cache for saving and restoring element inline styles, CSS classes etc.
* @type {{styles: string, classes: string}}
*/
this._restoreCache = {
styles: '',
classes: ''
};
} | javascript | function MdPanelRef(config, $injector) {
// Injected variables.
/** @private @const {!angular.$q} */
this._$q = $injector.get('$q');
/** @private @const {!angular.$mdCompiler} */
this._$mdCompiler = $injector.get('$mdCompiler');
/** @private @const {!angular.$mdConstant} */
this._$mdConstant = $injector.get('$mdConstant');
/** @private @const {!angular.$mdUtil} */
this._$mdUtil = $injector.get('$mdUtil');
/** @private @const {!angular.$mdTheming} */
this._$mdTheming = $injector.get('$mdTheming');
/** @private @const {!angular.Scope} */
this._$rootScope = $injector.get('$rootScope');
/** @private @const {!angular.$animate} */
this._$animate = $injector.get('$animate');
/** @private @const {!MdPanelRef} */
this._$mdPanel = $injector.get('$mdPanel');
/** @private @const {!angular.$log} */
this._$log = $injector.get('$log');
/** @private @const {!angular.$window} */
this._$window = $injector.get('$window');
/** @private @const {!Function} */
this._$$rAF = $injector.get('$$rAF');
// Public variables.
/**
* Unique id for the panelRef.
* @type {string}
*/
this.id = config.id;
/** @type {!Object} */
this.config = config;
/** @type {!angular.JQLite|undefined} */
this.panelContainer;
/** @type {!angular.JQLite|undefined} */
this.panelEl;
/**
* Whether the panel is attached. This is synchronous. When attach is called,
* isAttached is set to true. When detach is called, isAttached is set to
* false.
* @type {boolean}
*/
this.isAttached = false;
// Private variables.
/** @private {Array<function()>} */
this._removeListeners = [];
/** @private {!angular.JQLite|undefined} */
this._topFocusTrap;
/** @private {!angular.JQLite|undefined} */
this._bottomFocusTrap;
/** @private {!$mdPanel|undefined} */
this._backdropRef;
/** @private {Function?} */
this._restoreScroll = null;
/**
* Keeps track of all the panel interceptors.
* @private {!Object}
*/
this._interceptors = Object.create(null);
/**
* Cleanup function, provided by `$mdCompiler` and assigned after the element
* has been compiled. When `contentElement` is used, the function is used to
* restore the element to it's proper place in the DOM.
* @private {!Function}
*/
this._compilerCleanup = null;
/**
* Cache for saving and restoring element inline styles, CSS classes etc.
* @type {{styles: string, classes: string}}
*/
this._restoreCache = {
styles: '',
classes: ''
};
} | [
"function",
"MdPanelRef",
"(",
"config",
",",
"$injector",
")",
"{",
"// Injected variables.",
"/** @private @const {!angular.$q} */",
"this",
".",
"_$q",
"=",
"$injector",
".",
"get",
"(",
"'$q'",
")",
";",
"/** @private @const {!angular.$mdCompiler} */",
"this",
".",
... | ***************************************************************************
MdPanelRef *
***************************************************************************
A reference to a created panel. This reference contains a unique id for the
panel, along with properties/functions used to control the panel.
@param {!Object} config
@param {!angular.$injector} $injector
@final @constructor | [
"***************************************************************************",
"MdPanelRef",
"*",
"***************************************************************************",
"A",
"reference",
"to",
"a",
"created",
"panel",
".",
"This",
"reference",
"contains",
"a",
"unique",
"id",... | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/panel/panel.js#L1359-L1456 | train | The MdPanelRef constructor. | [
30522,
3853,
9108,
9739,
2884,
2890,
2546,
1006,
9530,
8873,
2290,
1010,
1002,
1999,
20614,
2953,
1007,
1063,
1013,
1013,
19737,
10857,
1012,
1013,
1008,
1008,
1030,
2797,
1030,
9530,
3367,
1063,
999,
30524,
1006,
1005,
1002,
1053,
1005,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/project/ProjectModel.js | _isWelcomeProjectPath | function _isWelcomeProjectPath(path, welcomeProjectPath, welcomeProjects) {
if (path === welcomeProjectPath) {
return true;
}
// No match on the current path, and it's not a match if there are no previously known projects
if (!welcomeProjects) {
return false;
}
var pathNoSlash = FileUtils.stripTrailingSlash(path); // "welcomeProjects" pref has standardized on no trailing "/"
return welcomeProjects.indexOf(pathNoSlash) !== -1;
} | javascript | function _isWelcomeProjectPath(path, welcomeProjectPath, welcomeProjects) {
if (path === welcomeProjectPath) {
return true;
}
// No match on the current path, and it's not a match if there are no previously known projects
if (!welcomeProjects) {
return false;
}
var pathNoSlash = FileUtils.stripTrailingSlash(path); // "welcomeProjects" pref has standardized on no trailing "/"
return welcomeProjects.indexOf(pathNoSlash) !== -1;
} | [
"function",
"_isWelcomeProjectPath",
"(",
"path",
",",
"welcomeProjectPath",
",",
"welcomeProjects",
")",
"{",
"if",
"(",
"path",
"===",
"welcomeProjectPath",
")",
"{",
"return",
"true",
";",
"}",
"// No match on the current path, and it's not a match if there are no previo... | Returns true if the given path is the same as one of the welcome projects we've previously opened,
or the one for the current build.
@param {string} path Path to check to see if it's a welcome project
@param {string} welcomeProjectPath Current welcome project path
@param {Array.<string>=} welcomeProjects All known welcome projects | [
"Returns",
"true",
"if",
"the",
"given",
"path",
"is",
"the",
"same",
"as",
"one",
"of",
"the",
"welcome",
"projects",
"we",
"ve",
"previously",
"opened",
"or",
"the",
"one",
"for",
"the",
"current",
"build",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/project/ProjectModel.js#L1351-L1363 | train | Returns true if the path is a match on the current path | [
30522,
3853,
1035,
2003,
8545,
22499,
4168,
21572,
20614,
15069,
1006,
4130,
1010,
6160,
21572,
20614,
15069,
1010,
6160,
21572,
20614,
2015,
1007,
1063,
2065,
1006,
4130,
1027,
1027,
1027,
6160,
21572,
20614,
15069,
1007,
1063,
2709,
2995,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SeleniumHQ/selenium | javascript/atoms/dom.js | getScroll | function getScroll(e) {
if (e == htmlElem) {
return new goog.dom.DomHelper(ownerDoc).getDocumentScroll();
} else {
return new goog.math.Coordinate(e.scrollLeft, e.scrollTop);
}
} | javascript | function getScroll(e) {
if (e == htmlElem) {
return new goog.dom.DomHelper(ownerDoc).getDocumentScroll();
} else {
return new goog.math.Coordinate(e.scrollLeft, e.scrollTop);
}
} | [
"function",
"getScroll",
"(",
"e",
")",
"{",
"if",
"(",
"e",
"==",
"htmlElem",
")",
"{",
"return",
"new",
"goog",
".",
"dom",
".",
"DomHelper",
"(",
"ownerDoc",
")",
".",
"getDocumentScroll",
"(",
")",
";",
"}",
"else",
"{",
"return",
"new",
"goog",
... | Returns the scroll offset of the given element. | [
"Returns",
"the",
"scroll",
"offset",
"of",
"the",
"given",
"element",
"."
] | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/atoms/dom.js#L717-L723 | train | Get the scroll position of an element. | [
30522,
3853,
4152,
26775,
14511,
1006,
1041,
1007,
1063,
2065,
1006,
1041,
1027,
1027,
16129,
12260,
2213,
1007,
1063,
2709,
2047,
27571,
2290,
1012,
14383,
1012,
14383,
16001,
4842,
1006,
3954,
3527,
2278,
1007,
1012,
2131,
3527,
24894,
11... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
ecomfe/zrender | src/mixin/Eventful.js | function (event, query, handler, context) {
return on(this, event, query, handler, context, false);
} | javascript | function (event, query, handler, context) {
return on(this, event, query, handler, context, false);
} | [
"function",
"(",
"event",
",",
"query",
",",
"handler",
",",
"context",
")",
"{",
"return",
"on",
"(",
"this",
",",
"event",
",",
"query",
",",
"handler",
",",
"context",
",",
"false",
")",
";",
"}"
] | Bind a handler.
@param {string} event The event name.
@param {string|Object} [query] Condition used on event filter.
@param {Function} handler The event handler.
@param {Object} [context] | [
"Bind",
"a",
"handler",
"."
] | 30321b57cba3149c30eacb0c1e18276f0f001b9f | https://github.com/ecomfe/zrender/blob/30321b57cba3149c30eacb0c1e18276f0f001b9f/src/mixin/Eventful.js#L57-L59 | train | Add an event listener to the current context | [
30522,
3853,
1006,
2724,
1010,
23032,
1010,
28213,
1010,
6123,
1007,
1063,
2709,
2006,
1006,
2023,
1010,
2724,
1010,
23032,
1010,
28213,
1010,
6123,
1010,
6270,
1007,
1025,
1065,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
fex-team/webuploader | src/dollar-builtin.js | function( type, fn ) {
if ( elem.removeEventListener ) {
elem.removeEventListener( type, fn, false );
} else if ( elem.attachEvent ) {
elem.detachEvent( 'on' + type, fn );
}
return this;
} | javascript | function( type, fn ) {
if ( elem.removeEventListener ) {
elem.removeEventListener( type, fn, false );
} else if ( elem.attachEvent ) {
elem.detachEvent( 'on' + type, fn );
}
return this;
} | [
"function",
"(",
"type",
",",
"fn",
")",
"{",
"if",
"(",
"elem",
".",
"removeEventListener",
")",
"{",
"elem",
".",
"removeEventListener",
"(",
"type",
",",
"fn",
",",
"false",
")",
";",
"}",
"else",
"if",
"(",
"elem",
".",
"attachEvent",
")",
"{",
... | off | [
"off"
] | 7094e4476c5af3b06993d91dde2d223200b9feb7 | https://github.com/fex-team/webuploader/blob/7094e4476c5af3b06993d91dde2d223200b9feb7/src/dollar-builtin.js#L156-L163 | train | Remove event listener | [
30522,
3853,
1006,
2828,
1010,
1042,
2078,
1007,
1063,
2065,
1006,
3449,
6633,
1012,
6366,
18697,
3372,
9863,
24454,
1007,
1063,
3449,
6633,
1012,
6366,
18697,
3372,
9863,
24454,
1006,
2828,
1010,
1042,
2078,
1010,
6270,
1007,
1025,
1065,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | src/sap.ui.unified/src/sap/ui/unified/CalendarTimeInterval.js | _togglePrevNexYearPicker | function _togglePrevNexYearPicker(){
var oYearPicker = this.getAggregation("yearPicker");
var iYears = oYearPicker.getYears();
var oDate = CalendarUtils._createUniversalUTCDate(oYearPicker.getFirstRenderedDate());
oDate.setUTCFullYear(oDate.getUTCFullYear() + Math.floor(iYears / 2));
var oHeader = this.getAggregation("header");
var oMaxDate = new UniversalDate(this._oMaxDate);
oMaxDate.setUTCFullYear(oMaxDate.getUTCFullYear() - Math.ceil(iYears / 2));
oMaxDate.setUTCMonth(11, 31);
var oMinDate = new UniversalDate(this._oMinDate);
oMinDate.setUTCFullYear(oMinDate.getUTCFullYear() + Math.floor(iYears / 2) + 1);
oMinDate.setUTCMonth(0, 1);
if (oDate.getTime() > oMaxDate.getTime()) {
oHeader.setEnabledNext(false);
} else {
oHeader.setEnabledNext(true);
}
if (oDate.getTime() < oMinDate.getTime()) {
oHeader.setEnabledPrevious(false);
} else {
oHeader.setEnabledPrevious(true);
}
} | javascript | function _togglePrevNexYearPicker(){
var oYearPicker = this.getAggregation("yearPicker");
var iYears = oYearPicker.getYears();
var oDate = CalendarUtils._createUniversalUTCDate(oYearPicker.getFirstRenderedDate());
oDate.setUTCFullYear(oDate.getUTCFullYear() + Math.floor(iYears / 2));
var oHeader = this.getAggregation("header");
var oMaxDate = new UniversalDate(this._oMaxDate);
oMaxDate.setUTCFullYear(oMaxDate.getUTCFullYear() - Math.ceil(iYears / 2));
oMaxDate.setUTCMonth(11, 31);
var oMinDate = new UniversalDate(this._oMinDate);
oMinDate.setUTCFullYear(oMinDate.getUTCFullYear() + Math.floor(iYears / 2) + 1);
oMinDate.setUTCMonth(0, 1);
if (oDate.getTime() > oMaxDate.getTime()) {
oHeader.setEnabledNext(false);
} else {
oHeader.setEnabledNext(true);
}
if (oDate.getTime() < oMinDate.getTime()) {
oHeader.setEnabledPrevious(false);
} else {
oHeader.setEnabledPrevious(true);
}
} | [
"function",
"_togglePrevNexYearPicker",
"(",
")",
"{",
"var",
"oYearPicker",
"=",
"this",
".",
"getAggregation",
"(",
"\"yearPicker\"",
")",
";",
"var",
"iYears",
"=",
"oYearPicker",
".",
"getYears",
"(",
")",
";",
"var",
"oDate",
"=",
"CalendarUtils",
".",
... | Disable / Enable the next and previous button in the Header.
This function assumes there is a "yearPicker" aggregation.
So callers must take care.
@return {void}
@private | [
"Disable",
"/",
"Enable",
"the",
"next",
"and",
"previous",
"button",
"in",
"the",
"Header",
".",
"This",
"function",
"assumes",
"there",
"is",
"a",
"yearPicker",
"aggregation",
".",
"So",
"callers",
"must",
"take",
"care",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.unified/src/sap/ui/unified/CalendarTimeInterval.js#L1686-L1711 | train | Toggles the previous year of the year picker | [
30522,
3853,
1035,
2000,
24679,
28139,
16022,
10288,
29100,
24330,
5484,
1006,
1007,
1063,
13075,
1051,
29100,
24330,
5484,
1027,
2023,
1012,
2131,
8490,
17603,
12540,
1006,
1000,
2095,
24330,
5484,
1000,
1007,
1025,
13075,
1045,
29100,
2015,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SheetJS/js-xlsx | xlsx.js | parse_ExternSheet | function parse_ExternSheet(blob, length, opts) {
if(opts.biff < 8) return parse_BIFF5ExternSheet(blob, length, opts);
var o = [], target = blob.l + length, len = blob.read_shift(opts.biff > 8 ? 4 : 2);
while(len-- !== 0) o.push(parse_XTI(blob, opts.biff > 8 ? 12 : 6, opts));
// [iSupBook, itabFirst, itabLast];
if(blob.l != target) throw new Error("Bad ExternSheet: " + blob.l + " != " + target);
return o;
} | javascript | function parse_ExternSheet(blob, length, opts) {
if(opts.biff < 8) return parse_BIFF5ExternSheet(blob, length, opts);
var o = [], target = blob.l + length, len = blob.read_shift(opts.biff > 8 ? 4 : 2);
while(len-- !== 0) o.push(parse_XTI(blob, opts.biff > 8 ? 12 : 6, opts));
// [iSupBook, itabFirst, itabLast];
if(blob.l != target) throw new Error("Bad ExternSheet: " + blob.l + " != " + target);
return o;
} | [
"function",
"parse_ExternSheet",
"(",
"blob",
",",
"length",
",",
"opts",
")",
"{",
"if",
"(",
"opts",
".",
"biff",
"<",
"8",
")",
"return",
"parse_BIFF5ExternSheet",
"(",
"blob",
",",
"length",
",",
"opts",
")",
";",
"var",
"o",
"=",
"[",
"]",
",",
... | /* [MS-XLS] 2.4.106 TODO: verify filename encoding | [
"/",
"*",
"[",
"MS",
"-",
"XLS",
"]",
"2",
".",
"4",
".",
"106",
"TODO",
":",
"verify",
"filename",
"encoding"
] | 9a6d8a1d3d80c78dad5201fb389316f935279cdc | https://github.com/SheetJS/js-xlsx/blob/9a6d8a1d3d80c78dad5201fb389316f935279cdc/xlsx.js#L6260-L6267 | train | ECMA - 262 15. 2 Extern Sheet | [
30522,
3853,
11968,
3366,
1035,
4654,
16451,
4095,
15558,
1006,
1038,
4135,
2497,
1010,
3091,
1010,
23569,
2015,
1007,
1063,
2065,
1006,
23569,
2015,
1012,
12170,
4246,
1026,
1022,
1007,
2709,
11968,
3366,
1035,
12170,
4246,
2629,
10288,
16... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
googleapis/google-api-nodejs-client | samples/mirror/mirror.js | runSample | async function runSample() {
const res = await mirror.locations.list({});
console.log(res.data);
} | javascript | async function runSample() {
const res = await mirror.locations.list({});
console.log(res.data);
} | [
"async",
"function",
"runSample",
"(",
")",
"{",
"const",
"res",
"=",
"await",
"mirror",
".",
"locations",
".",
"list",
"(",
"{",
"}",
")",
";",
"console",
".",
"log",
"(",
"res",
".",
"data",
")",
";",
"}"
] | a very simple example of listing locations from the mirror API | [
"a",
"very",
"simple",
"example",
"of",
"listing",
"locations",
"from",
"the",
"mirror",
"API"
] | e6e632a29d0b246d058e3067de3a5c3827e2b54e | https://github.com/googleapis/google-api-nodejs-client/blob/e6e632a29d0b246d058e3067de3a5c3827e2b54e/samples/mirror/mirror.js#L26-L29 | train | A sample of the sample | [
30522,
2004,
6038,
2278,
3853,
3216,
16613,
2571,
1006,
1007,
1063,
9530,
3367,
24501,
1027,
26751,
5259,
1012,
5269,
1012,
2862,
1006,
1063,
1065,
1007,
1025,
10122,
1012,
8833,
1006,
24501,
1012,
2951,
1007,
1025,
1065,
102,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
angular/material | release.js | updateBowerVersion | function updateBowerVersion () {
start('Updating bower version...');
const options = { cwd: './bower-material' };
const bower = require(options.cwd + '/bower.json'),
pkg = require(options.cwd + '/package.json');
// update versions in config files
bower.version = pkg.version = newVersion;
fs.writeFileSync(options.cwd + '/package.json', JSON.stringify(pkg, null, 2));
fs.writeFileSync(options.cwd + '/bower.json', JSON.stringify(bower, null, 2));
done();
start('Building bower files...');
// build files for bower
exec([
'rm -rf dist',
'gulp build',
'gulp build-all-modules --mode=default',
'gulp build-all-modules --mode=closure',
'rm -rf dist/demos'
]);
done();
start('Copy files into bower repo...');
// copy files over to bower repo
exec([
'cp -Rf ../dist/* ./',
'git add -A',
`git commit -m "release: version ${newVersion}"`,
'rm -rf ../dist'
], options);
done();
// add steps to push script
pushCmds.push(
comment('push to bower (master and tag) and publish to npm'),
'cd ' + options.cwd,
'cp ../CHANGELOG.md .',
'git add CHANGELOG.md',
'git commit --amend --no-edit',
`git tag -f v${newVersion}`,
'git pull --rebase --strategy=ours',
'git push',
'git push --tags',
'rm -rf .git/',
'npm publish',
'cd ..'
);
} | javascript | function updateBowerVersion () {
start('Updating bower version...');
const options = { cwd: './bower-material' };
const bower = require(options.cwd + '/bower.json'),
pkg = require(options.cwd + '/package.json');
// update versions in config files
bower.version = pkg.version = newVersion;
fs.writeFileSync(options.cwd + '/package.json', JSON.stringify(pkg, null, 2));
fs.writeFileSync(options.cwd + '/bower.json', JSON.stringify(bower, null, 2));
done();
start('Building bower files...');
// build files for bower
exec([
'rm -rf dist',
'gulp build',
'gulp build-all-modules --mode=default',
'gulp build-all-modules --mode=closure',
'rm -rf dist/demos'
]);
done();
start('Copy files into bower repo...');
// copy files over to bower repo
exec([
'cp -Rf ../dist/* ./',
'git add -A',
`git commit -m "release: version ${newVersion}"`,
'rm -rf ../dist'
], options);
done();
// add steps to push script
pushCmds.push(
comment('push to bower (master and tag) and publish to npm'),
'cd ' + options.cwd,
'cp ../CHANGELOG.md .',
'git add CHANGELOG.md',
'git commit --amend --no-edit',
`git tag -f v${newVersion}`,
'git pull --rebase --strategy=ours',
'git push',
'git push --tags',
'rm -rf .git/',
'npm publish',
'cd ..'
);
} | [
"function",
"updateBowerVersion",
"(",
")",
"{",
"start",
"(",
"'Updating bower version...'",
")",
";",
"const",
"options",
"=",
"{",
"cwd",
":",
"'./bower-material'",
"}",
";",
"const",
"bower",
"=",
"require",
"(",
"options",
".",
"cwd",
"+",
"'/bower.json'"... | updates the version for bower-material in package.json and bower.json | [
"updates",
"the",
"version",
"for",
"bower",
"-",
"material",
"in",
"package",
".",
"json",
"and",
"bower",
".",
"json"
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/release.js#L214-L258 | train | Update bower version | [
30522,
3853,
10651,
18912,
2121,
27774,
1006,
1007,
1063,
2707,
1006,
1005,
2039,
16616,
6812,
2121,
2544,
1012,
1012,
1012,
1005,
1007,
1025,
9530,
3367,
7047,
1027,
1063,
19296,
2094,
1024,
1005,
1012,
1013,
6812,
2121,
1011,
3430,
1005,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/base/ExpressionParser.js | INFIX | function INFIX(fnLeft, fnRight, fnOperator, bLazy, aParts) {
return fnOperator(fnLeft(aParts),
bLazy ? fnRight.bind(null, aParts) : fnRight(aParts));
} | javascript | function INFIX(fnLeft, fnRight, fnOperator, bLazy, aParts) {
return fnOperator(fnLeft(aParts),
bLazy ? fnRight.bind(null, aParts) : fnRight(aParts));
} | [
"function",
"INFIX",
"(",
"fnLeft",
",",
"fnRight",
",",
"fnOperator",
",",
"bLazy",
",",
"aParts",
")",
"{",
"return",
"fnOperator",
"(",
"fnLeft",
"(",
"aParts",
")",
",",
"bLazy",
"?",
"fnRight",
".",
"bind",
"(",
"null",
",",
"aParts",
")",
":",
... | Formatter function for an infix operator.
@param {function} fnLeft - formatter function for the left operand
@param {function} fnRight - formatter function for the right operand
@param {function} fnOperator
function taking two arguments which evaluates the infix operator
@param {boolean} bLazy - whether the right operand is e
@param {any[]} aParts - the array of binding values
@return {any} - the result of the operator function applied to the two operands | [
"Formatter",
"function",
"for",
"an",
"infix",
"operator",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/base/ExpressionParser.js#L399-L402 | train | Infix operator. | [
30522,
3853,
1999,
8873,
2595,
1006,
1042,
20554,
29218,
1010,
1042,
16118,
18743,
1010,
1042,
3630,
4842,
8844,
1010,
1038,
2721,
9096,
1010,
4237,
2015,
1007,
1063,
2709,
1042,
3630,
4842,
8844,
1006,
1042,
20554,
29218,
1006,
4237,
2015,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
catapult-project/catapult | third_party/polymer2/bower_components/web-animations-js/src/handler-utils.js | consumeParenthesised | function consumeParenthesised(parser, string) {
var nesting = 0;
for (var n = 0; n < string.length; n++) {
if (/\s|,/.test(string[n]) && nesting == 0) {
break;
} else if (string[n] == '(') {
nesting++;
} else if (string[n] == ')') {
nesting--;
if (nesting == 0)
n++;
if (nesting <= 0)
break;
}
}
var parsed = parser(string.substr(0, n));
return parsed == undefined ? undefined : [parsed, string.substr(n)];
} | javascript | function consumeParenthesised(parser, string) {
var nesting = 0;
for (var n = 0; n < string.length; n++) {
if (/\s|,/.test(string[n]) && nesting == 0) {
break;
} else if (string[n] == '(') {
nesting++;
} else if (string[n] == ')') {
nesting--;
if (nesting == 0)
n++;
if (nesting <= 0)
break;
}
}
var parsed = parser(string.substr(0, n));
return parsed == undefined ? undefined : [parsed, string.substr(n)];
} | [
"function",
"consumeParenthesised",
"(",
"parser",
",",
"string",
")",
"{",
"var",
"nesting",
"=",
"0",
";",
"for",
"(",
"var",
"n",
"=",
"0",
";",
"n",
"<",
"string",
".",
"length",
";",
"n",
"++",
")",
"{",
"if",
"(",
"/",
"\\s|,",
"/",
".",
... | Consumes a token or expression with balanced parentheses | [
"Consumes",
"a",
"token",
"or",
"expression",
"with",
"balanced",
"parentheses"
] | 992929ffccac68827869a497f01ee4d653ed4f25 | https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/third_party/polymer2/bower_components/web-animations-js/src/handler-utils.js#L55-L72 | train | Consumes a string of parentheses | [
30522,
3853,
16678,
19362,
4765,
24124,
2098,
1006,
11968,
8043,
1010,
5164,
1007,
1063,
13075,
21016,
1027,
1014,
1025,
2005,
1006,
13075,
1050,
1027,
1014,
1025,
1050,
1026,
5164,
1012,
3091,
1025,
1050,
1009,
1009,
1007,
1063,
2065,
1006... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
elastic/elasticsearch-js | api/api/cluster.state.js | buildClusterState | function buildClusterState (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
/**
* Perform a [cluster.state](http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-state.html) request
*
* @param {list} index - A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices
* @param {list} metric - Limit the information returned to the specified metrics
* @param {boolean} local - Return local information, do not retrieve the state from master node (default: false)
* @param {time} master_timeout - Specify timeout for connection to master
* @param {boolean} flat_settings - Return settings in flat format (default: false)
* @param {number} wait_for_metadata_version - Wait for the metadata version to be equal or greater than the specified metadata version
* @param {time} wait_for_timeout - The maximum time to wait for wait_for_metadata_version before timing out
* @param {boolean} ignore_unavailable - Whether specified concrete indices should be ignored when unavailable (missing or closed)
* @param {boolean} allow_no_indices - Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)
* @param {enum} expand_wildcards - Whether to expand wildcard expression to concrete indices that are open, closed or both.
*/
const acceptedQuerystring = [
'local',
'master_timeout',
'flat_settings',
'wait_for_metadata_version',
'wait_for_timeout',
'ignore_unavailable',
'allow_no_indices',
'expand_wildcards',
'pretty',
'human',
'error_trace',
'source',
'filter_path'
]
const snakeCase = {
masterTimeout: 'master_timeout',
flatSettings: 'flat_settings',
waitForMetadataVersion: 'wait_for_metadata_version',
waitForTimeout: 'wait_for_timeout',
ignoreUnavailable: 'ignore_unavailable',
allowNoIndices: 'allow_no_indices',
expandWildcards: 'expand_wildcards',
errorTrace: 'error_trace',
filterPath: 'filter_path'
}
return function clusterState (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// check required parameters
if (params.body != null) {
const err = new ConfigurationError('This API does not require a body')
return handleError(err, callback)
}
// check required url components
if (params['index'] != null && (params['metric'] == null)) {
const err = new ConfigurationError('Missing required parameter of the url: metric')
return handleError(err, callback)
}
// validate headers object
if (options.headers != null && typeof options.headers !== 'object') {
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
return handleError(err, callback)
}
var warnings = []
var { method, body, index, metric, ...querystring } = params
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings)
if (method == null) {
method = 'GET'
}
var ignore = options.ignore
if (typeof ignore === 'number') {
options.ignore = [ignore]
}
var path = ''
if ((metric) != null && (index) != null) {
path = '/' + '_cluster' + '/' + 'state' + '/' + encodeURIComponent(metric) + '/' + encodeURIComponent(index)
} else if ((metric) != null) {
path = '/' + '_cluster' + '/' + 'state' + '/' + encodeURIComponent(metric)
} else {
path = '/' + '_cluster' + '/' + 'state'
}
// build request object
const request = {
method,
path,
body: null,
querystring
}
options.warnings = warnings.length === 0 ? null : warnings
return makeRequest(request, options, callback)
}
} | javascript | function buildClusterState (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
/**
* Perform a [cluster.state](http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-state.html) request
*
* @param {list} index - A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices
* @param {list} metric - Limit the information returned to the specified metrics
* @param {boolean} local - Return local information, do not retrieve the state from master node (default: false)
* @param {time} master_timeout - Specify timeout for connection to master
* @param {boolean} flat_settings - Return settings in flat format (default: false)
* @param {number} wait_for_metadata_version - Wait for the metadata version to be equal or greater than the specified metadata version
* @param {time} wait_for_timeout - The maximum time to wait for wait_for_metadata_version before timing out
* @param {boolean} ignore_unavailable - Whether specified concrete indices should be ignored when unavailable (missing or closed)
* @param {boolean} allow_no_indices - Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)
* @param {enum} expand_wildcards - Whether to expand wildcard expression to concrete indices that are open, closed or both.
*/
const acceptedQuerystring = [
'local',
'master_timeout',
'flat_settings',
'wait_for_metadata_version',
'wait_for_timeout',
'ignore_unavailable',
'allow_no_indices',
'expand_wildcards',
'pretty',
'human',
'error_trace',
'source',
'filter_path'
]
const snakeCase = {
masterTimeout: 'master_timeout',
flatSettings: 'flat_settings',
waitForMetadataVersion: 'wait_for_metadata_version',
waitForTimeout: 'wait_for_timeout',
ignoreUnavailable: 'ignore_unavailable',
allowNoIndices: 'allow_no_indices',
expandWildcards: 'expand_wildcards',
errorTrace: 'error_trace',
filterPath: 'filter_path'
}
return function clusterState (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// check required parameters
if (params.body != null) {
const err = new ConfigurationError('This API does not require a body')
return handleError(err, callback)
}
// check required url components
if (params['index'] != null && (params['metric'] == null)) {
const err = new ConfigurationError('Missing required parameter of the url: metric')
return handleError(err, callback)
}
// validate headers object
if (options.headers != null && typeof options.headers !== 'object') {
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
return handleError(err, callback)
}
var warnings = []
var { method, body, index, metric, ...querystring } = params
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings)
if (method == null) {
method = 'GET'
}
var ignore = options.ignore
if (typeof ignore === 'number') {
options.ignore = [ignore]
}
var path = ''
if ((metric) != null && (index) != null) {
path = '/' + '_cluster' + '/' + 'state' + '/' + encodeURIComponent(metric) + '/' + encodeURIComponent(index)
} else if ((metric) != null) {
path = '/' + '_cluster' + '/' + 'state' + '/' + encodeURIComponent(metric)
} else {
path = '/' + '_cluster' + '/' + 'state'
}
// build request object
const request = {
method,
path,
body: null,
querystring
}
options.warnings = warnings.length === 0 ? null : warnings
return makeRequest(request, options, callback)
}
} | [
"function",
"buildClusterState",
"(",
"opts",
")",
"{",
"// eslint-disable-next-line no-unused-vars",
"const",
"{",
"makeRequest",
",",
"ConfigurationError",
",",
"handleError",
",",
"snakeCaseKeys",
"}",
"=",
"opts",
"/**\n * Perform a [cluster.state](http://www.elastic.co/g... | /* eslint camelcase: 0 /* eslint no-unused-vars: 0 | [
"/",
"*",
"eslint",
"camelcase",
":",
"0",
"/",
"*",
"eslint",
"no",
"-",
"unused",
"-",
"vars",
":",
"0"
] | 4fc4699a4d4474d7887bc7757e0269218a859294 | https://github.com/elastic/elasticsearch-js/blob/4fc4699a4d4474d7887bc7757e0269218a859294/api/api/cluster.state.js#L25-L135 | train | Build cluster state | [
30522,
3853,
3857,
20464,
19966,
30524,
9686,
4115,
2102,
1011,
4487,
19150,
1011,
2279,
1011,
2240,
2053,
1011,
15171,
1011,
13075,
2015,
9530,
3367,
1063,
9338,
2063,
15500,
1010,
9563,
2121,
29165,
1010,
5047,
2121,
29165,
1010,
7488,
18... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
ColorlibHQ/AdminLTE | plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js | function() {
clearInterval(this.interval);
this.elementToChange = null;
dom.removeClass(this.link, CLASS_NAME_OPENED);
this.container.style.display = "none";
this.fire("hide");
} | javascript | function() {
clearInterval(this.interval);
this.elementToChange = null;
dom.removeClass(this.link, CLASS_NAME_OPENED);
this.container.style.display = "none";
this.fire("hide");
} | [
"function",
"(",
")",
"{",
"clearInterval",
"(",
"this",
".",
"interval",
")",
";",
"this",
".",
"elementToChange",
"=",
"null",
";",
"dom",
".",
"removeClass",
"(",
"this",
".",
"link",
",",
"CLASS_NAME_OPENED",
")",
";",
"this",
".",
"container",
".",
... | Hide the dialog element | [
"Hide",
"the",
"dialog",
"element"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js#L13624-L13630 | train | Hide the container | [
30522,
3853,
1006,
1007,
1063,
3154,
18447,
2121,
10175,
1006,
2023,
1012,
13483,
1007,
1025,
2023,
1012,
5783,
3406,
22305,
2063,
1027,
19701,
1025,
14383,
1012,
6366,
26266,
1006,
2023,
1012,
4957,
1010,
2465,
1035,
2171,
1035,
2441,
3052... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SheetJS/js-xlsx | xlsx.js | write_biff8_buf | function write_biff8_buf(wb, opts) {
var o = opts || {};
var bufs = [];
if(wb && !wb.SSF) {
wb.SSF = SSF.get_table();
}
if(wb && wb.SSF) {
make_ssf(SSF); SSF.load_table(wb.SSF);
// $FlowIgnore
o.revssf = evert_num(wb.SSF); o.revssf[wb.SSF[65535]] = 0;
o.ssf = wb.SSF;
}
o.cellXfs = [];
o.Strings = []; o.Strings.Count = 0; o.Strings.Unique = 0;
get_cell_style(o.cellXfs, {}, {revssf:{"General":0}});
for(var i = 0; i < wb.SheetNames.length; ++i) bufs[bufs.length] = write_ws_biff8(i, o, wb);
bufs.unshift(write_biff8_global(wb, bufs, o));
return __toBuffer([bufs]);
} | javascript | function write_biff8_buf(wb, opts) {
var o = opts || {};
var bufs = [];
if(wb && !wb.SSF) {
wb.SSF = SSF.get_table();
}
if(wb && wb.SSF) {
make_ssf(SSF); SSF.load_table(wb.SSF);
// $FlowIgnore
o.revssf = evert_num(wb.SSF); o.revssf[wb.SSF[65535]] = 0;
o.ssf = wb.SSF;
}
o.cellXfs = [];
o.Strings = []; o.Strings.Count = 0; o.Strings.Unique = 0;
get_cell_style(o.cellXfs, {}, {revssf:{"General":0}});
for(var i = 0; i < wb.SheetNames.length; ++i) bufs[bufs.length] = write_ws_biff8(i, o, wb);
bufs.unshift(write_biff8_global(wb, bufs, o));
return __toBuffer([bufs]);
} | [
"function",
"write_biff8_buf",
"(",
"wb",
",",
"opts",
")",
"{",
"var",
"o",
"=",
"opts",
"||",
"{",
"}",
";",
"var",
"bufs",
"=",
"[",
"]",
";",
"if",
"(",
"wb",
"&&",
"!",
"wb",
".",
"SSF",
")",
"{",
"wb",
".",
"SSF",
"=",
"SSF",
".",
"ge... | /* [MS-XLS] 2.1.7.20 Workbook Stream | [
"/",
"*",
"[",
"MS",
"-",
"XLS",
"]",
"2",
".",
"1",
".",
"7",
".",
"20",
"Workbook",
"Stream"
] | 9a6d8a1d3d80c78dad5201fb389316f935279cdc | https://github.com/SheetJS/js-xlsx/blob/9a6d8a1d3d80c78dad5201fb389316f935279cdc/xlsx.js#L18810-L18830 | train | Write a BIFF8 buffer | [
30522,
3853,
4339,
1035,
12170,
4246,
2620,
1035,
20934,
2546,
1006,
25610,
1010,
23569,
2015,
1007,
1063,
13075,
1051,
1027,
23569,
2015,
1064,
1064,
1063,
1065,
1025,
13075,
20934,
10343,
1027,
1031,
1033,
1025,
2065,
1006,
25610,
1004,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
grpc/grpc-node | packages/grpc-native-core/src/client_interceptors.js | _startBatchIfReady | function _startBatchIfReady(call, batch, batch_state, callback) {
var completed_ops = batch_state.completed_ops;
var deferred_batches = batch_state.deferred_batches;
var batch_ops = Object.keys(batch).map(Number);
if (_areBatchRequirementsMet(batch_ops, completed_ops)) {
// Dependencies are met, start the batch and any deferred batches whose
// dependencies are met as a result.
call.startBatch(batch, callback);
completed_ops = Array.from(new Set(completed_ops.concat(batch_ops)));
deferred_batches = common.flatMap(deferred_batches, function(deferred_batch) {
var deferred_batch_ops = Object.keys(deferred_batch).map(Number);
if (_areBatchRequirementsMet(deferred_batch_ops, completed_ops)) {
call.startBatch(deferred_batch.batch, deferred_batch.callback);
return [];
}
return [deferred_batch];
});
} else {
// Dependencies are not met, defer the batch
deferred_batches = deferred_batches.concat({
batch: batch,
callback: callback
});
}
return {
completed_ops: completed_ops,
deferred_batches: deferred_batches
};
} | javascript | function _startBatchIfReady(call, batch, batch_state, callback) {
var completed_ops = batch_state.completed_ops;
var deferred_batches = batch_state.deferred_batches;
var batch_ops = Object.keys(batch).map(Number);
if (_areBatchRequirementsMet(batch_ops, completed_ops)) {
// Dependencies are met, start the batch and any deferred batches whose
// dependencies are met as a result.
call.startBatch(batch, callback);
completed_ops = Array.from(new Set(completed_ops.concat(batch_ops)));
deferred_batches = common.flatMap(deferred_batches, function(deferred_batch) {
var deferred_batch_ops = Object.keys(deferred_batch).map(Number);
if (_areBatchRequirementsMet(deferred_batch_ops, completed_ops)) {
call.startBatch(deferred_batch.batch, deferred_batch.callback);
return [];
}
return [deferred_batch];
});
} else {
// Dependencies are not met, defer the batch
deferred_batches = deferred_batches.concat({
batch: batch,
callback: callback
});
}
return {
completed_ops: completed_ops,
deferred_batches: deferred_batches
};
} | [
"function",
"_startBatchIfReady",
"(",
"call",
",",
"batch",
",",
"batch_state",
",",
"callback",
")",
"{",
"var",
"completed_ops",
"=",
"batch_state",
".",
"completed_ops",
";",
"var",
"deferred_batches",
"=",
"batch_state",
".",
"deferred_batches",
";",
"var",
... | Enforces the order of operations for synchronous requests. If a batch's
operations cannot be started because required operations have not started
yet, the batch is deferred until requirements are met.
@private
@param {grpc.Client~Call} call
@param {object} batch
@param {object} batch_state
@param {number[]} [batch_state.completed_ops] The ops already sent.
@param {object} [batch_state.deferred_batches] Batches to be sent after
their dependencies are fulfilled.
@param {function} callback
@return {object} | [
"Enforces",
"the",
"order",
"of",
"operations",
"for",
"synchronous",
"requests",
".",
"If",
"a",
"batch",
"s",
"operations",
"cannot",
"be",
"started",
"because",
"required",
"operations",
"have",
"not",
"started",
"yet",
"the",
"batch",
"is",
"deferred",
"un... | b36b285f4cdb334bbd48f74c12c13bec69961488 | https://github.com/grpc/grpc-node/blob/b36b285f4cdb334bbd48f74c12c13bec69961488/packages/grpc-native-core/src/client_interceptors.js#L745-L773 | train | Starts the batch if the batch requirements are met | [
30522,
3853,
1035,
2707,
14479,
5428,
19699,
13775,
2100,
1006,
2655,
1010,
14108,
1010,
14108,
1035,
2110,
1010,
2655,
5963,
1007,
1063,
13075,
2949,
1035,
23092,
1027,
14108,
1035,
2110,
1012,
2949,
1035,
23092,
1025,
13075,
13366,
28849,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
ecomfe/zrender | src/dom/HandlerProxy.js | function (event) {
// Default mouse behaviour should not be disabled here.
// For example, page may needs to be slided.
event = normalizeEvent(this.dom, event);
// Mark touch, which is useful in distinguish touch and
// mouse event in upper applicatoin.
event.zrByTouch = true;
this._lastTouchMoment = new Date();
this.handler.processGesture(this, event, 'start');
// In touch device, trigger `mousemove`(`mouseover`) should
// be triggered, and must before `mousedown` triggered.
domHandlers.mousemove.call(this, event);
domHandlers.mousedown.call(this, event);
setTouchTimer(this);
} | javascript | function (event) {
// Default mouse behaviour should not be disabled here.
// For example, page may needs to be slided.
event = normalizeEvent(this.dom, event);
// Mark touch, which is useful in distinguish touch and
// mouse event in upper applicatoin.
event.zrByTouch = true;
this._lastTouchMoment = new Date();
this.handler.processGesture(this, event, 'start');
// In touch device, trigger `mousemove`(`mouseover`) should
// be triggered, and must before `mousedown` triggered.
domHandlers.mousemove.call(this, event);
domHandlers.mousedown.call(this, event);
setTouchTimer(this);
} | [
"function",
"(",
"event",
")",
"{",
"// Default mouse behaviour should not be disabled here.",
"// For example, page may needs to be slided.",
"event",
"=",
"normalizeEvent",
"(",
"this",
".",
"dom",
",",
"event",
")",
";",
"// Mark touch, which is useful in distinguish touch and... | Touch开始响应函数
@inner
@param {Event} event | [
"Touch开始响应函数"
] | 30321b57cba3149c30eacb0c1e18276f0f001b9f | https://github.com/ecomfe/zrender/blob/30321b57cba3149c30eacb0c1e18276f0f001b9f/src/dom/HandlerProxy.js#L104-L124 | train | Handle mouse events | [
30522,
3853,
1006,
2724,
1007,
1063,
1013,
1013,
12398,
8000,
9164,
2323,
2025,
2022,
9776,
2182,
1012,
1013,
1013,
2005,
2742,
1010,
3931,
2089,
3791,
2000,
2022,
7358,
2094,
1012,
2724,
1027,
3671,
4697,
18697,
3372,
1006,
2023,
1012,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | src/sap.ui.core/src/sap/ui/model/base/ManagedObjectModel.js | _stringify | function _stringify(vObject) {
var sData = "", sProp;
var type = typeof vObject;
if (vObject == null || (type != "object" && type != "function")) {
sData = vObject;
} else if (isPlainObject(vObject)) {
sData = JSON.stringify(vObject);
} else if (vObject instanceof ManagedObject) {
sData = vObject.getId();//add the id
for (sProp in vObject.mProperties) {
sData = sData + "$" + _stringify(vObject.mProperties[sProp]);
}
} else if (Array.isArray(vObject)) {
for (var i = 0; vObject.length; i++) {
sData = sData + "$" + _stringify(vObject);
}
} else {
Log.warning("Could not stringify object " + vObject);
sData = "$";
}
return sData;
} | javascript | function _stringify(vObject) {
var sData = "", sProp;
var type = typeof vObject;
if (vObject == null || (type != "object" && type != "function")) {
sData = vObject;
} else if (isPlainObject(vObject)) {
sData = JSON.stringify(vObject);
} else if (vObject instanceof ManagedObject) {
sData = vObject.getId();//add the id
for (sProp in vObject.mProperties) {
sData = sData + "$" + _stringify(vObject.mProperties[sProp]);
}
} else if (Array.isArray(vObject)) {
for (var i = 0; vObject.length; i++) {
sData = sData + "$" + _stringify(vObject);
}
} else {
Log.warning("Could not stringify object " + vObject);
sData = "$";
}
return sData;
} | [
"function",
"_stringify",
"(",
"vObject",
")",
"{",
"var",
"sData",
"=",
"\"\"",
",",
"sProp",
";",
"var",
"type",
"=",
"typeof",
"vObject",
";",
"if",
"(",
"vObject",
"==",
"null",
"||",
"(",
"type",
"!=",
"\"object\"",
"&&",
"type",
"!=",
"\"function... | Serialize the object to a string to support change detection
@param vObject
@returns {string} a serialization of the object to a string
@private | [
"Serialize",
"the",
"object",
"to",
"a",
"string",
"to",
"support",
"change",
"detection"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/base/ManagedObjectModel.js#L98-L121 | train | Stringifies the given object | [
30522,
3853,
1035,
5164,
8757,
1006,
29536,
2497,
20614,
1007,
1063,
13075,
17371,
6790,
1027,
1000,
1000,
1010,
11867,
18981,
1025,
13075,
2828,
1027,
2828,
11253,
29536,
2497,
20614,
1025,
2065,
1006,
29536,
2497,
20614,
1027,
1027,
19701,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/core/Manifest.js | function() {
// skip removing includes when not loaded yet
if (!this._bIncludesLoaded) {
return;
}
var mResources = this.getEntry("/sap.ui5/resources");
if (!mResources) {
return;
}
var sComponentName = this.getComponentName();
// remove CSS files
var aCSSResources = mResources["css"];
if (aCSSResources) {
// As all <link> tags have been marked with the manifest's unique id (via data-sap-ui-manifest-uid)
// it is not needed to check for all individual CSS files defined in the manifest.
// Checking for all "href"s again might also cause issues when they have been adopted (e.g. to add cachebuster url params).
var aLinks = document.querySelectorAll("link[data-sap-ui-manifest-uid='" + this._uid + "']");
for (var i = 0; i < aLinks.length; i++) {
var oLink = aLinks[i];
Log.info("Component \"" + sComponentName + "\" is removing CSS: \"" + oLink.href + "\"");
oLink.parentNode.removeChild(oLink);
}
}
this._bIncludesLoaded = false;
} | javascript | function() {
// skip removing includes when not loaded yet
if (!this._bIncludesLoaded) {
return;
}
var mResources = this.getEntry("/sap.ui5/resources");
if (!mResources) {
return;
}
var sComponentName = this.getComponentName();
// remove CSS files
var aCSSResources = mResources["css"];
if (aCSSResources) {
// As all <link> tags have been marked with the manifest's unique id (via data-sap-ui-manifest-uid)
// it is not needed to check for all individual CSS files defined in the manifest.
// Checking for all "href"s again might also cause issues when they have been adopted (e.g. to add cachebuster url params).
var aLinks = document.querySelectorAll("link[data-sap-ui-manifest-uid='" + this._uid + "']");
for (var i = 0; i < aLinks.length; i++) {
var oLink = aLinks[i];
Log.info("Component \"" + sComponentName + "\" is removing CSS: \"" + oLink.href + "\"");
oLink.parentNode.removeChild(oLink);
}
}
this._bIncludesLoaded = false;
} | [
"function",
"(",
")",
"{",
"// skip removing includes when not loaded yet",
"if",
"(",
"!",
"this",
".",
"_bIncludesLoaded",
")",
"{",
"return",
";",
"}",
"var",
"mResources",
"=",
"this",
".",
"getEntry",
"(",
"\"/sap.ui5/resources\"",
")",
";",
"if",
"(",
"!... | Removes the included CSS resources.
@private | [
"Removes",
"the",
"included",
"CSS",
"resources",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Manifest.js#L457-L489 | train | Removes all CSS files defined in the manifest | [
30522,
3853,
1006,
1007,
1063,
1013,
1013,
30524,
9623,
1027,
2023,
1012,
2131,
4765,
2854,
1006,
1000,
1013,
20066,
1012,
21318,
2629,
1013,
4219,
1000,
1007,
1025,
2065,
1006,
999,
2720,
2229,
8162,
9623,
1007,
1063,
2709,
1025,
1065,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SeleniumHQ/selenium | third_party/js/mozmill/shared-modules/private-browsing.js | privateBrowsing | function privateBrowsing(controller) {
this._controller = controller;
this._handler = null;
/**
* Menu item in the main menu to enter/leave Private Browsing mode
* @private
*/
this._pbMenuItem = new elementslib.Elem(this._controller.menus['tools-menu'].privateBrowsingItem);
this._pbTransitionItem = new elementslib.ID(this._controller.window.document, "Tools:PrivateBrowsing");
this.__defineGetter__('_pbs', function() {
delete this._pbs;
return this._pbs = Cc["@mozilla.org/privatebrowsing;1"].
getService(Ci.nsIPrivateBrowsingService);
});
} | javascript | function privateBrowsing(controller) {
this._controller = controller;
this._handler = null;
/**
* Menu item in the main menu to enter/leave Private Browsing mode
* @private
*/
this._pbMenuItem = new elementslib.Elem(this._controller.menus['tools-menu'].privateBrowsingItem);
this._pbTransitionItem = new elementslib.ID(this._controller.window.document, "Tools:PrivateBrowsing");
this.__defineGetter__('_pbs', function() {
delete this._pbs;
return this._pbs = Cc["@mozilla.org/privatebrowsing;1"].
getService(Ci.nsIPrivateBrowsingService);
});
} | [
"function",
"privateBrowsing",
"(",
"controller",
")",
"{",
"this",
".",
"_controller",
"=",
"controller",
";",
"this",
".",
"_handler",
"=",
"null",
";",
"/**\n * Menu item in the main menu to enter/leave Private Browsing mode\n * @private\n */",
"this",
".",
"_pbMen... | Create a new privateBrowsing instance.
@class This class adds support for the Private Browsing mode
@param {MozMillController} controller
MozMillController to use for the modal entry dialog | [
"Create",
"a",
"new",
"privateBrowsing",
"instance",
"."
] | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/private-browsing.js#L61-L77 | train | Constructor for Private Browsing mode | [
30522,
3853,
2797,
12618,
9333,
2075,
1006,
11486,
1007,
1063,
2023,
1012,
1035,
11486,
1027,
11486,
1025,
2023,
1012,
1035,
28213,
1027,
19701,
1025,
1013,
1008,
1008,
1008,
12183,
8875,
1999,
1996,
2364,
12183,
2000,
4607,
1013,
2681,
279... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
dequelabs/axe-core | lib/commons/text/form-control-value.js | ariaListboxValue | function ariaListboxValue(virtualNode, context) {
const { actualNode } = virtualNode;
const role = aria.getRole(actualNode);
if (role !== 'listbox') {
return '';
}
const selected = aria
.getOwnedVirtual(virtualNode)
.filter(
owned =>
aria.getRole(owned) === 'option' &&
owned.actualNode.getAttribute('aria-selected') === 'true'
);
if (selected.length === 0) {
return '';
}
// Note: Even with aria-multiselectable, only the first value will be used
// in the accessible name. This isn't spec'ed out, but seems to be how all
// browser behave.
return axe.commons.text.accessibleTextVirtual(selected[0], context);
} | javascript | function ariaListboxValue(virtualNode, context) {
const { actualNode } = virtualNode;
const role = aria.getRole(actualNode);
if (role !== 'listbox') {
return '';
}
const selected = aria
.getOwnedVirtual(virtualNode)
.filter(
owned =>
aria.getRole(owned) === 'option' &&
owned.actualNode.getAttribute('aria-selected') === 'true'
);
if (selected.length === 0) {
return '';
}
// Note: Even with aria-multiselectable, only the first value will be used
// in the accessible name. This isn't spec'ed out, but seems to be how all
// browser behave.
return axe.commons.text.accessibleTextVirtual(selected[0], context);
} | [
"function",
"ariaListboxValue",
"(",
"virtualNode",
",",
"context",
")",
"{",
"const",
"{",
"actualNode",
"}",
"=",
"virtualNode",
";",
"const",
"role",
"=",
"aria",
".",
"getRole",
"(",
"actualNode",
")",
";",
"if",
"(",
"role",
"!==",
"'listbox'",
")",
... | Calculate value of an element with role=combobox or role=listbox
@param {VirtualNode} element The VirtualNode instance whose value we want
@param {Object} context The VirtualNode instance whose value we want
@property {Element} startNode First node in accessible name computation
@property {String[]} unsupported List of roles where value computation is unsupported
@property {Bool} debug Enable logging for formControlValue
@return {string} The calculated value | [
"Calculate",
"value",
"of",
"an",
"element",
"with",
"role",
"=",
"combobox",
"or",
"role",
"=",
"listbox"
] | 727323c07980e2291575f545444d389fb942906f | https://github.com/dequelabs/axe-core/blob/727323c07980e2291575f545444d389fb942906f/lib/commons/text/form-control-value.js#L136-L158 | train | Get the value of the selected option | [
30522,
3853,
9342,
9863,
8758,
10175,
5657,
1006,
7484,
3630,
3207,
1010,
6123,
1007,
1063,
9530,
3367,
1063,
5025,
3630,
3207,
1065,
1027,
7484,
3630,
3207,
1025,
9530,
3367,
2535,
1027,
9342,
1012,
2131,
13153,
2063,
1006,
5025,
3630,
3... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.table/src/sap/ui/table/TableAccExtension.js | function(oExtension, $Cell, aDefaultLabels, aDefaultDescriptions) {
oExtension._cleanupInfo = {
cell: $Cell,
attr: {
"aria-labelledby": aDefaultLabels && aDefaultLabels.length ? aDefaultLabels.join(" ") : null,
"aria-describedby": aDefaultDescriptions && aDefaultDescriptions.length ? aDefaultDescriptions.join(" ") : null
}
};
} | javascript | function(oExtension, $Cell, aDefaultLabels, aDefaultDescriptions) {
oExtension._cleanupInfo = {
cell: $Cell,
attr: {
"aria-labelledby": aDefaultLabels && aDefaultLabels.length ? aDefaultLabels.join(" ") : null,
"aria-describedby": aDefaultDescriptions && aDefaultDescriptions.length ? aDefaultDescriptions.join(" ") : null
}
};
} | [
"function",
"(",
"oExtension",
",",
"$Cell",
",",
"aDefaultLabels",
",",
"aDefaultDescriptions",
")",
"{",
"oExtension",
".",
"_cleanupInfo",
"=",
"{",
"cell",
":",
"$Cell",
",",
"attr",
":",
"{",
"\"aria-labelledby\"",
":",
"aDefaultLabels",
"&&",
"aDefaultLabe... | /*
Stores the defaults before modifications of a cell for later cleanup
@see ExtensionHelper.cleanupCellModifications | [
"/",
"*",
"Stores",
"the",
"defaults",
"before",
"modifications",
"of",
"a",
"cell",
"for",
"later",
"cleanup"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableAccExtension.js#L291-L299 | train | This function is called by the cleanup function when the cell is not found. | [
30522,
3853,
1006,
1051,
10288,
29048,
1010,
1002,
3526,
1010,
4748,
12879,
23505,
20470,
9050,
1010,
4748,
12879,
23505,
6155,
23235,
8496,
1007,
1063,
1051,
10288,
29048,
1012,
1035,
27686,
2378,
14876,
1027,
1063,
3526,
1024,
1002,
3526,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
apache/incubator-echarts | src/view/Chart.js | elSetState | function elSetState(el, state, highlightDigit) {
if (el) {
el.trigger(state, highlightDigit);
if (el.isGroup
// Simple optimize.
&& !graphicUtil.isHighDownDispatcher(el)
) {
for (var i = 0, len = el.childCount(); i < len; i++) {
elSetState(el.childAt(i), state, highlightDigit);
}
}
}
} | javascript | function elSetState(el, state, highlightDigit) {
if (el) {
el.trigger(state, highlightDigit);
if (el.isGroup
// Simple optimize.
&& !graphicUtil.isHighDownDispatcher(el)
) {
for (var i = 0, len = el.childCount(); i < len; i++) {
elSetState(el.childAt(i), state, highlightDigit);
}
}
}
} | [
"function",
"elSetState",
"(",
"el",
",",
"state",
",",
"highlightDigit",
")",
"{",
"if",
"(",
"el",
")",
"{",
"el",
".",
"trigger",
"(",
"state",
",",
"highlightDigit",
")",
";",
"if",
"(",
"el",
".",
"isGroup",
"// Simple optimize.",
"&&",
"!",
"grap... | Set state of single element
@param {module:zrender/Element} el
@param {string} state 'normal'|'emphasis'
@param {number} highlightDigit | [
"Set",
"state",
"of",
"single",
"element"
] | 4d0ea095dc3929cb6de40c45748826e7999c7aa8 | https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/view/Chart.js#L173-L185 | train | Set the state of an element | [
30522,
3853,
2842,
3215,
12259,
1006,
3449,
1010,
2110,
1010,
12944,
4305,
23806,
1007,
1063,
2065,
1006,
3449,
1007,
1063,
3449,
1012,
9495,
1006,
2110,
1010,
12944,
4305,
23806,
1007,
1025,
2065,
1006,
3449,
1012,
2003,
17058,
1013,
1013,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | lib/jsdoc/ui5/template/publish.js | publish | function publish(symbolSet) {
info("entering sapui5 template");
// create output dir
fs.mkPath(env.opts.destination);
// if ( symbolSet().count() < 20000 ) {
// info("writing raw symbols to " + path.join(env.opts.destination, "symbols-unpruned-ui5.json"));
// fs.writeFileSync(path.join(env.opts.destination, "symbols-unpruned-ui5.json"), JSON.stringify(symbolSet().get(), filter, "\t"), 'utf8');
// }
info("before prune: " + symbolSet().count() + " symbols.");
symbolSet = helper.prune(symbolSet);
info("after prune: " + symbolSet().count() + " symbols.");
__db = symbolSet;
__longnames = {};
__db().each(function($) {
__longnames[$.longname] = $;
});
if ( templateConf.apiJsonFolder ) {
info("loading external apis from folder '" + templateConf.apiJsonFolder + "'");
loadExternalSymbols(templateConf.apiJsonFolder);
}
var templatePath = path.join(env.opts.template, 'tmpl/');
info("using templates from '" + templatePath + "'");
view = new template.Template(templatePath);
function filter(key,value) {
if ( key === 'meta' ) {
//return;
}
if ( key === '__ui5' && value ) {
var v = {
resource: value.resource,
module: value.module,
stakeholders: value.stakeholders
};
if ( value.derived ) {
v.derived = value.derived.map(function($) { return $.longname; });
}
if ( value.base ) {
v.base = value.base.longname;
}
if ( value.implementations ) {
v.base = value.implementations.map(function($) { return $.longname; });
}
if ( value.parent ) {
v.parent = value.parent.longname;
}
if ( value.children ) {
v.children = value.children.map(function($) { return $.longname; });
}
return v;
}
return value;
}
// now resolve relationships
var aRootNamespaces = createNamespaceTree();
var hierarchyRoots = createInheritanceTree();
collectMembers();
mergeEventDocumentation();
if ( symbolSet().count() < 20000 ) {
info("writing raw symbols to " + path.join(env.opts.destination, "symbols-pruned-ui5.json"));
fs.writeFileSync(path.join(env.opts.destination, "symbols-pruned-ui5.json"), JSON.stringify(symbolSet().get(), filter, "\t"), 'utf8');
}
// used to allow Link to check the details of things being linked to
Link.symbolSet = symbolSet;
// get an array version of the symbol set, useful for filtering
var symbols = symbolSet().get();
// -----
var PUBLISHING_VARIANTS = {
"apixml" : {
defaults : {
apiXmlFile: path.join(env.opts.destination, "jsapi.xml")
},
processor : function(conf) {
createAPIXML(symbols, conf.apiXmlFile, {
legacyContent: true
});
}
},
"apijson" : {
defaults : {
apiJsonFile: path.join(env.opts.destination, "api.json")
},
processor : function(conf) {
createAPIJSON(symbols, conf.apiJsonFile);
}
},
"fullapixml" : {
defaults : {
fullXmlFile: path.join(env.opts.destination, "fulljsapi.xml")
},
processor : function(conf) {
createAPIXML(symbols, conf.fullXmlFile, {
roots: aRootNamespaces,
omitDefaults : conf.omitDefaultsInFullXml,
resolveInheritance: true
});
}
},
"apijs" : {
defaults: {
jsapiFile: path.join(env.opts.destination, "api.js")
},
processor: function(conf) {
createAPIJS(symbols, conf.jsapiFile);
}
},
"full" : {
defaults : {
outdir: path.join(env.opts.destination, "full/"),
contentOnly: false,
hierarchyIndex: true
},
processor: function() {
publishClasses(symbolSet, aRootNamespaces, hierarchyRoots);
}
},
"public" : {
defaults: {
outdir: path.join(env.opts.destination, "public/"),
filter: function($) { return $.access === 'public' || $.access === 'protected' || $.access == null; },
contentOnly: false,
hierarchyIndex: true
},
processor: function(conf) {
publishClasses(symbolSet, aRootNamespaces, hierarchyRoots);
}
},
"demokit" : {
defaults: {
outdir: path.join(env.opts.destination, "demokit/"),
filter: function($) { return $.access === 'public' || $.access === 'protected' || $.access == null; },
contentOnly: true,
modulePages: true,
hierarchyIndex: false,
securityIndex: true,
sinceIndex: true,
deprecationIndex: true,
experimentalIndex: true,
suppressAuthor: true,
suppressVersion: true
},
processor: function(conf) {
publishClasses(symbolSet, aRootNamespaces, hierarchyRoots);
}
},
"demokit-internal" : {
defaults: {
outdir: path.join(env.opts.destination, "demokit-internal/"),
// filter: function($) { return $.access === 'public' || $.access === 'protected' || $.access === 'restricted' || $.access == null; },
contentOnly: true,
modulePages: true,
hierarchyIndex: false,
securityIndex: true,
sinceIndex: true,
deprecationIndex: true,
experimentalIndex: true,
suppressAuthor: true,
suppressVersion: true
},
processor: function(conf) {
publishClasses(symbolSet, aRootNamespaces, hierarchyRoots);
}
}
};
var now = new Date();
info("start publishing");
for (var i = 0; i < templateConf.variants.length; i++) {
var vVariant = templateConf.variants[i];
if ( typeof vVariant === "string" ) {
vVariant = { variant : vVariant };
}
info("");
if ( PUBLISHING_VARIANTS[vVariant.variant] ) {
// Merge different sources of configuration (listed in increasing priority order - last one wins)
// and expose the result in the global 'conf' variable
// - global defaults
// - defaults for current variant
// - user configuration for sapui5 template
// - user configuration for current variant
//
// Note: trailing slash expected for dirs
conf = merge({
ext: ".html",
filter: function($) { return true; },
templatesDir: "/templates/sapui5/",
symbolsDir: "symbols/",
modulesDir: "modules/",
topicUrlPattern: "../../guide/{{topic}}.html",
srcDir: "symbols/src/",
creationDate : now.getFullYear() + "-" + (now.getMonth() + 1) + "-" + now.getDay() + " " + now.getHours() + ":" + now.getMinutes(),
outdir: env.opts.destination
}, PUBLISHING_VARIANTS[vVariant.variant].defaults, templateConf, vVariant);
info("publishing as variant '" + vVariant.variant + "'");
debug("final configuration:");
debug(conf);
PUBLISHING_VARIANTS[vVariant.variant].processor(conf);
info("done with variant " + vVariant.variant);
} else {
info("cannot publish unknown variant '" + vVariant.variant + "' (ignored)");
}
}
var builtinSymbols = templateConf.builtinSymbols;
if ( builtinSymbols ) {
Link.getMissingTypes().filter(function($) {
return builtinSymbols.indexOf($) < 0;
}).sort().forEach(function($) {
// TODO instead of filtering topic: and fiori: links out here, they should be correctly linked in the template
if ( !/\{@link (?:topic:|fiori:)/.test($) ) {
error(" unresolved reference: " + $);
}
});
}
info("publishing done.");
} | javascript | function publish(symbolSet) {
info("entering sapui5 template");
// create output dir
fs.mkPath(env.opts.destination);
// if ( symbolSet().count() < 20000 ) {
// info("writing raw symbols to " + path.join(env.opts.destination, "symbols-unpruned-ui5.json"));
// fs.writeFileSync(path.join(env.opts.destination, "symbols-unpruned-ui5.json"), JSON.stringify(symbolSet().get(), filter, "\t"), 'utf8');
// }
info("before prune: " + symbolSet().count() + " symbols.");
symbolSet = helper.prune(symbolSet);
info("after prune: " + symbolSet().count() + " symbols.");
__db = symbolSet;
__longnames = {};
__db().each(function($) {
__longnames[$.longname] = $;
});
if ( templateConf.apiJsonFolder ) {
info("loading external apis from folder '" + templateConf.apiJsonFolder + "'");
loadExternalSymbols(templateConf.apiJsonFolder);
}
var templatePath = path.join(env.opts.template, 'tmpl/');
info("using templates from '" + templatePath + "'");
view = new template.Template(templatePath);
function filter(key,value) {
if ( key === 'meta' ) {
//return;
}
if ( key === '__ui5' && value ) {
var v = {
resource: value.resource,
module: value.module,
stakeholders: value.stakeholders
};
if ( value.derived ) {
v.derived = value.derived.map(function($) { return $.longname; });
}
if ( value.base ) {
v.base = value.base.longname;
}
if ( value.implementations ) {
v.base = value.implementations.map(function($) { return $.longname; });
}
if ( value.parent ) {
v.parent = value.parent.longname;
}
if ( value.children ) {
v.children = value.children.map(function($) { return $.longname; });
}
return v;
}
return value;
}
// now resolve relationships
var aRootNamespaces = createNamespaceTree();
var hierarchyRoots = createInheritanceTree();
collectMembers();
mergeEventDocumentation();
if ( symbolSet().count() < 20000 ) {
info("writing raw symbols to " + path.join(env.opts.destination, "symbols-pruned-ui5.json"));
fs.writeFileSync(path.join(env.opts.destination, "symbols-pruned-ui5.json"), JSON.stringify(symbolSet().get(), filter, "\t"), 'utf8');
}
// used to allow Link to check the details of things being linked to
Link.symbolSet = symbolSet;
// get an array version of the symbol set, useful for filtering
var symbols = symbolSet().get();
// -----
var PUBLISHING_VARIANTS = {
"apixml" : {
defaults : {
apiXmlFile: path.join(env.opts.destination, "jsapi.xml")
},
processor : function(conf) {
createAPIXML(symbols, conf.apiXmlFile, {
legacyContent: true
});
}
},
"apijson" : {
defaults : {
apiJsonFile: path.join(env.opts.destination, "api.json")
},
processor : function(conf) {
createAPIJSON(symbols, conf.apiJsonFile);
}
},
"fullapixml" : {
defaults : {
fullXmlFile: path.join(env.opts.destination, "fulljsapi.xml")
},
processor : function(conf) {
createAPIXML(symbols, conf.fullXmlFile, {
roots: aRootNamespaces,
omitDefaults : conf.omitDefaultsInFullXml,
resolveInheritance: true
});
}
},
"apijs" : {
defaults: {
jsapiFile: path.join(env.opts.destination, "api.js")
},
processor: function(conf) {
createAPIJS(symbols, conf.jsapiFile);
}
},
"full" : {
defaults : {
outdir: path.join(env.opts.destination, "full/"),
contentOnly: false,
hierarchyIndex: true
},
processor: function() {
publishClasses(symbolSet, aRootNamespaces, hierarchyRoots);
}
},
"public" : {
defaults: {
outdir: path.join(env.opts.destination, "public/"),
filter: function($) { return $.access === 'public' || $.access === 'protected' || $.access == null; },
contentOnly: false,
hierarchyIndex: true
},
processor: function(conf) {
publishClasses(symbolSet, aRootNamespaces, hierarchyRoots);
}
},
"demokit" : {
defaults: {
outdir: path.join(env.opts.destination, "demokit/"),
filter: function($) { return $.access === 'public' || $.access === 'protected' || $.access == null; },
contentOnly: true,
modulePages: true,
hierarchyIndex: false,
securityIndex: true,
sinceIndex: true,
deprecationIndex: true,
experimentalIndex: true,
suppressAuthor: true,
suppressVersion: true
},
processor: function(conf) {
publishClasses(symbolSet, aRootNamespaces, hierarchyRoots);
}
},
"demokit-internal" : {
defaults: {
outdir: path.join(env.opts.destination, "demokit-internal/"),
// filter: function($) { return $.access === 'public' || $.access === 'protected' || $.access === 'restricted' || $.access == null; },
contentOnly: true,
modulePages: true,
hierarchyIndex: false,
securityIndex: true,
sinceIndex: true,
deprecationIndex: true,
experimentalIndex: true,
suppressAuthor: true,
suppressVersion: true
},
processor: function(conf) {
publishClasses(symbolSet, aRootNamespaces, hierarchyRoots);
}
}
};
var now = new Date();
info("start publishing");
for (var i = 0; i < templateConf.variants.length; i++) {
var vVariant = templateConf.variants[i];
if ( typeof vVariant === "string" ) {
vVariant = { variant : vVariant };
}
info("");
if ( PUBLISHING_VARIANTS[vVariant.variant] ) {
// Merge different sources of configuration (listed in increasing priority order - last one wins)
// and expose the result in the global 'conf' variable
// - global defaults
// - defaults for current variant
// - user configuration for sapui5 template
// - user configuration for current variant
//
// Note: trailing slash expected for dirs
conf = merge({
ext: ".html",
filter: function($) { return true; },
templatesDir: "/templates/sapui5/",
symbolsDir: "symbols/",
modulesDir: "modules/",
topicUrlPattern: "../../guide/{{topic}}.html",
srcDir: "symbols/src/",
creationDate : now.getFullYear() + "-" + (now.getMonth() + 1) + "-" + now.getDay() + " " + now.getHours() + ":" + now.getMinutes(),
outdir: env.opts.destination
}, PUBLISHING_VARIANTS[vVariant.variant].defaults, templateConf, vVariant);
info("publishing as variant '" + vVariant.variant + "'");
debug("final configuration:");
debug(conf);
PUBLISHING_VARIANTS[vVariant.variant].processor(conf);
info("done with variant " + vVariant.variant);
} else {
info("cannot publish unknown variant '" + vVariant.variant + "' (ignored)");
}
}
var builtinSymbols = templateConf.builtinSymbols;
if ( builtinSymbols ) {
Link.getMissingTypes().filter(function($) {
return builtinSymbols.indexOf($) < 0;
}).sort().forEach(function($) {
// TODO instead of filtering topic: and fiori: links out here, they should be correctly linked in the template
if ( !/\{@link (?:topic:|fiori:)/.test($) ) {
error(" unresolved reference: " + $);
}
});
}
info("publishing done.");
} | [
"function",
"publish",
"(",
"symbolSet",
")",
"{",
"info",
"(",
"\"entering sapui5 template\"",
")",
";",
"// create output dir",
"fs",
".",
"mkPath",
"(",
"env",
".",
"opts",
".",
"destination",
")",
";",
"//\tif ( symbolSet().count() < 20000 ) {",
"//\t\tinfo(\"writ... | ---- publish() - main entry point for JSDoc templates ------------------------------------------------------------------------------------------------------- /* Called automatically by JsDoc Toolkit. | [
"----",
"publish",
"()",
"-",
"main",
"entry",
"point",
"for",
"JSDoc",
"templates",
"-------------------------------------------------------------------------------------------------------",
"/",
"*",
"Called",
"automatically",
"by",
"JsDoc",
"Toolkit",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/lib/jsdoc/ui5/template/publish.js#L393-L642 | train | publishes a set of symbols to the output directory | [
30522,
3853,
10172,
1006,
9255,
3388,
1007,
1063,
18558,
1006,
1000,
5738,
20066,
10179,
2629,
23561,
1000,
1007,
1025,
1013,
1013,
3443,
6434,
16101,
1042,
2015,
1012,
12395,
15069,
1006,
4372,
2615,
1012,
23569,
2015,
1012,
7688,
1007,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
catapult-project/catapult | netlog_viewer/netlog_viewer/ui_webui_resources_js_util.js | ensureTransitionEndEvent | function ensureTransitionEndEvent(el, opt_timeOut) {
if (opt_timeOut === undefined) {
var style = getComputedStyle(el);
opt_timeOut = parseFloat(style.transitionDuration) * 1000;
// Give an additional 50ms buffer for the animation to complete.
opt_timeOut += 50;
}
var fired = false;
el.addEventListener('webkitTransitionEnd', function f(e) {
el.removeEventListener('webkitTransitionEnd', f);
fired = true;
});
window.setTimeout(function() {
if (!fired)
cr.dispatchSimpleEvent(el, 'webkitTransitionEnd', true);
}, opt_timeOut);
} | javascript | function ensureTransitionEndEvent(el, opt_timeOut) {
if (opt_timeOut === undefined) {
var style = getComputedStyle(el);
opt_timeOut = parseFloat(style.transitionDuration) * 1000;
// Give an additional 50ms buffer for the animation to complete.
opt_timeOut += 50;
}
var fired = false;
el.addEventListener('webkitTransitionEnd', function f(e) {
el.removeEventListener('webkitTransitionEnd', f);
fired = true;
});
window.setTimeout(function() {
if (!fired)
cr.dispatchSimpleEvent(el, 'webkitTransitionEnd', true);
}, opt_timeOut);
} | [
"function",
"ensureTransitionEndEvent",
"(",
"el",
",",
"opt_timeOut",
")",
"{",
"if",
"(",
"opt_timeOut",
"===",
"undefined",
")",
"{",
"var",
"style",
"=",
"getComputedStyle",
"(",
"el",
")",
";",
"opt_timeOut",
"=",
"parseFloat",
"(",
"style",
".",
"trans... | webkitTransitionEnd does not always fire (e.g. when animation is aborted
or when no paint happens during the animation). This function sets up
a timer and emulate the event if it is not fired when the timer expires.
@param {!HTMLElement} el The element to watch for webkitTransitionEnd.
@param {number=} opt_timeOut The maximum wait time in milliseconds for the
webkitTransitionEnd to happen. If not specified, it is fetched from |el|
using the transitionDuration style value. | [
"webkitTransitionEnd",
"does",
"not",
"always",
"fire",
"(",
"e",
".",
"g",
".",
"when",
"animation",
"is",
"aborted",
"or",
"when",
"no",
"paint",
"happens",
"during",
"the",
"animation",
")",
".",
"This",
"function",
"sets",
"up",
"a",
"timer",
"and",
... | 992929ffccac68827869a497f01ee4d653ed4f25 | https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/netlog_viewer/netlog_viewer/ui_webui_resources_js_util.js#L279-L297 | train | Ensure transition end event is fired | [
30522,
3853,
5676,
6494,
3619,
22753,
10497,
18697,
3372,
1006,
3449,
1010,
23569,
1035,
2051,
5833,
1007,
1063,
2065,
1006,
23569,
1035,
2051,
5833,
1027,
1027,
1027,
6151,
28344,
1007,
1063,
13075,
2806,
1027,
2131,
9006,
29462,
21756,
25... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/utils/EventDispatcher.js | makeEventDispatcher | function makeEventDispatcher(obj) {
$.extend(obj, {
on: on,
off: off,
one: one,
trigger: trigger,
_EventDispatcher: true
});
// Later, on() may add _eventHandlers: Object.<string, Array.<{event:string, namespace:?string,
// handler:!function(!{type:string, target:!Object}, ...)}>> - map from eventName to an array
// of handler records
// Later, markDeprecated() may add _deprecatedEvents: Object.<string, string|boolean> - map from
// eventName to deprecation warning info
} | javascript | function makeEventDispatcher(obj) {
$.extend(obj, {
on: on,
off: off,
one: one,
trigger: trigger,
_EventDispatcher: true
});
// Later, on() may add _eventHandlers: Object.<string, Array.<{event:string, namespace:?string,
// handler:!function(!{type:string, target:!Object}, ...)}>> - map from eventName to an array
// of handler records
// Later, markDeprecated() may add _deprecatedEvents: Object.<string, string|boolean> - map from
// eventName to deprecation warning info
} | [
"function",
"makeEventDispatcher",
"(",
"obj",
")",
"{",
"$",
".",
"extend",
"(",
"obj",
",",
"{",
"on",
":",
"on",
",",
"off",
":",
"off",
",",
"one",
":",
"one",
",",
"trigger",
":",
"trigger",
",",
"_EventDispatcher",
":",
"true",
"}",
")",
";",... | Adds the EventDispatcher APIs to the given object: on(), one(), off(), and trigger(). May also be
called on a prototype object - each instance will still behave independently.
@param {!Object} obj Object to add event-dispatch methods to | [
"Adds",
"the",
"EventDispatcher",
"APIs",
"to",
"the",
"given",
"object",
":",
"on",
"()",
"one",
"()",
"off",
"()",
"and",
"trigger",
"()",
".",
"May",
"also",
"be",
"called",
"on",
"a",
"prototype",
"object",
"-",
"each",
"instance",
"will",
"still",
... | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/utils/EventDispatcher.js#L243-L256 | train | makeEventDispatcher - Creates an event dispatcher object | [
30522,
3853,
2191,
18697,
3372,
10521,
4502,
10649,
2121,
1006,
27885,
3501,
1007,
1063,
1002,
1012,
7949,
1006,
27885,
3501,
1010,
1063,
2006,
1024,
2006,
1010,
2125,
1024,
2125,
1010,
2028,
1024,
2028,
1010,
9495,
1024,
9495,
1010,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
eslint/eslint | lib/rules/comma-style.js | validateComma | function validateComma(node, property) {
const items = node[property],
arrayLiteral = (node.type === "ArrayExpression" || node.type === "ArrayPattern");
if (items.length > 1 || arrayLiteral) {
// seed as opening [
let previousItemToken = sourceCode.getFirstToken(node);
items.forEach(item => {
const commaToken = item ? sourceCode.getTokenBefore(item) : previousItemToken,
currentItemToken = item ? sourceCode.getFirstToken(item) : sourceCode.getTokenAfter(commaToken),
reportItem = item || currentItemToken;
/*
* This works by comparing three token locations:
* - previousItemToken is the last token of the previous item
* - commaToken is the location of the comma before the current item
* - currentItemToken is the first token of the current item
*
* These values get switched around if item is undefined.
* previousItemToken will refer to the last token not belonging
* to the current item, which could be a comma or an opening
* square bracket. currentItemToken could be a comma.
*
* All comparisons are done based on these tokens directly, so
* they are always valid regardless of an undefined item.
*/
if (astUtils.isCommaToken(commaToken)) {
validateCommaItemSpacing(previousItemToken, commaToken,
currentItemToken, reportItem);
}
if (item) {
const tokenAfterItem = sourceCode.getTokenAfter(item, astUtils.isNotClosingParenToken);
previousItemToken = tokenAfterItem
? sourceCode.getTokenBefore(tokenAfterItem)
: sourceCode.ast.tokens[sourceCode.ast.tokens.length - 1];
}
});
/*
* Special case for array literals that have empty last items, such
* as [ 1, 2, ]. These arrays only have two items show up in the
* AST, so we need to look at the token to verify that there's no
* dangling comma.
*/
if (arrayLiteral) {
const lastToken = sourceCode.getLastToken(node),
nextToLastToken = sourceCode.getTokenBefore(lastToken);
if (astUtils.isCommaToken(nextToLastToken)) {
validateCommaItemSpacing(
sourceCode.getTokenBefore(nextToLastToken),
nextToLastToken,
lastToken,
lastToken
);
}
}
}
} | javascript | function validateComma(node, property) {
const items = node[property],
arrayLiteral = (node.type === "ArrayExpression" || node.type === "ArrayPattern");
if (items.length > 1 || arrayLiteral) {
// seed as opening [
let previousItemToken = sourceCode.getFirstToken(node);
items.forEach(item => {
const commaToken = item ? sourceCode.getTokenBefore(item) : previousItemToken,
currentItemToken = item ? sourceCode.getFirstToken(item) : sourceCode.getTokenAfter(commaToken),
reportItem = item || currentItemToken;
/*
* This works by comparing three token locations:
* - previousItemToken is the last token of the previous item
* - commaToken is the location of the comma before the current item
* - currentItemToken is the first token of the current item
*
* These values get switched around if item is undefined.
* previousItemToken will refer to the last token not belonging
* to the current item, which could be a comma or an opening
* square bracket. currentItemToken could be a comma.
*
* All comparisons are done based on these tokens directly, so
* they are always valid regardless of an undefined item.
*/
if (astUtils.isCommaToken(commaToken)) {
validateCommaItemSpacing(previousItemToken, commaToken,
currentItemToken, reportItem);
}
if (item) {
const tokenAfterItem = sourceCode.getTokenAfter(item, astUtils.isNotClosingParenToken);
previousItemToken = tokenAfterItem
? sourceCode.getTokenBefore(tokenAfterItem)
: sourceCode.ast.tokens[sourceCode.ast.tokens.length - 1];
}
});
/*
* Special case for array literals that have empty last items, such
* as [ 1, 2, ]. These arrays only have two items show up in the
* AST, so we need to look at the token to verify that there's no
* dangling comma.
*/
if (arrayLiteral) {
const lastToken = sourceCode.getLastToken(node),
nextToLastToken = sourceCode.getTokenBefore(lastToken);
if (astUtils.isCommaToken(nextToLastToken)) {
validateCommaItemSpacing(
sourceCode.getTokenBefore(nextToLastToken),
nextToLastToken,
lastToken,
lastToken
);
}
}
}
} | [
"function",
"validateComma",
"(",
"node",
",",
"property",
")",
"{",
"const",
"items",
"=",
"node",
"[",
"property",
"]",
",",
"arrayLiteral",
"=",
"(",
"node",
".",
"type",
"===",
"\"ArrayExpression\"",
"||",
"node",
".",
"type",
"===",
"\"ArrayPattern\"",
... | Checks the comma placement with regards to a declaration/property/element
@param {ASTNode} node The binary expression node to check
@param {string} property The property of the node containing child nodes.
@private
@returns {void} | [
"Checks",
"the",
"comma",
"placement",
"with",
"regards",
"to",
"a",
"declaration",
"/",
"property",
"/",
"element"
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/comma-style.js#L186-L249 | train | Validate comma between two items | [
30522,
3853,
9398,
3686,
9006,
2863,
1006,
13045,
1010,
3200,
1007,
1063,
9530,
3367,
5167,
1027,
13045,
1031,
3200,
1033,
1010,
9140,
22779,
7941,
1027,
1006,
13045,
1012,
2828,
1027,
1027,
1027,
1000,
9140,
10288,
20110,
3258,
1000,
1064,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
catapult-project/catapult | third_party/coverage/coverage/htmlfiles/coverage_html.js | function (table) {
if (table.config.sortList.length === 0 && sort_list.length > 0) {
// This table hasn't been sorted before - we'll use
// our stored settings:
$(table).trigger('sorton', [sort_list]);
}
else {
// This is not the first load - something has
// already defined sorting so we'll just update
// our stored value to match:
sort_list = table.config.sortList;
}
} | javascript | function (table) {
if (table.config.sortList.length === 0 && sort_list.length > 0) {
// This table hasn't been sorted before - we'll use
// our stored settings:
$(table).trigger('sorton', [sort_list]);
}
else {
// This is not the first load - something has
// already defined sorting so we'll just update
// our stored value to match:
sort_list = table.config.sortList;
}
} | [
"function",
"(",
"table",
")",
"{",
"if",
"(",
"table",
".",
"config",
".",
"sortList",
".",
"length",
"===",
"0",
"&&",
"sort_list",
".",
"length",
">",
"0",
")",
"{",
"// This table hasn't been sorted before - we'll use",
"// our stored settings:",
"$",
"(",
... | Format is called by the widget before displaying: | [
"Format",
"is",
"called",
"by",
"the",
"widget",
"before",
"displaying",
":"
] | 992929ffccac68827869a497f01ee4d653ed4f25 | https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/third_party/coverage/coverage/htmlfiles/coverage_html.js#L198-L210 | train | If the table has already been sorted before we can t do anything | [
30522,
3853,
1006,
2795,
1007,
1063,
2065,
1006,
2795,
1012,
9530,
8873,
2290,
1012,
4066,
9863,
1012,
3091,
1027,
1027,
1027,
1014,
1004,
1004,
4066,
1035,
2862,
1012,
3091,
1028,
1014,
1007,
1063,
1013,
1013,
2023,
2795,
8440,
1005,
105... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
angular/material | src/components/dialog/dialog.js | onRemove | function onRemove(scope, element, options) {
options.deactivateListeners();
options.unlockScreenReader();
options.hideBackdrop(options.$destroy);
// Remove the focus traps that we added earlier for keeping focus within the dialog.
if (topFocusTrap && topFocusTrap.parentNode) {
topFocusTrap.parentNode.removeChild(topFocusTrap);
}
if (bottomFocusTrap && bottomFocusTrap.parentNode) {
bottomFocusTrap.parentNode.removeChild(bottomFocusTrap);
}
// For navigation $destroy events, do a quick, non-animated removal,
// but for normal closes (from clicks, etc) animate the removal
return options.$destroy ? detachAndClean() : animateRemoval().then(detachAndClean);
/**
* For normal closes, animate the removal.
* For forced closes (like $destroy events), skip the animations
*/
function animateRemoval() {
return dialogPopOut(element, options);
}
/**
* Detach the element
*/
function detachAndClean() {
angular.element($document[0].body).removeClass('md-dialog-is-showing');
// Reverse the container stretch if using a content element.
if (options.contentElement) {
options.reverseContainerStretch();
}
// Exposed cleanup function from the $mdCompiler.
options.cleanupElement();
// Restores the focus to the origin element if the last interaction upon opening was a keyboard.
if (!options.$destroy && options.originInteraction === 'keyboard') {
options.origin.focus();
}
}
} | javascript | function onRemove(scope, element, options) {
options.deactivateListeners();
options.unlockScreenReader();
options.hideBackdrop(options.$destroy);
// Remove the focus traps that we added earlier for keeping focus within the dialog.
if (topFocusTrap && topFocusTrap.parentNode) {
topFocusTrap.parentNode.removeChild(topFocusTrap);
}
if (bottomFocusTrap && bottomFocusTrap.parentNode) {
bottomFocusTrap.parentNode.removeChild(bottomFocusTrap);
}
// For navigation $destroy events, do a quick, non-animated removal,
// but for normal closes (from clicks, etc) animate the removal
return options.$destroy ? detachAndClean() : animateRemoval().then(detachAndClean);
/**
* For normal closes, animate the removal.
* For forced closes (like $destroy events), skip the animations
*/
function animateRemoval() {
return dialogPopOut(element, options);
}
/**
* Detach the element
*/
function detachAndClean() {
angular.element($document[0].body).removeClass('md-dialog-is-showing');
// Reverse the container stretch if using a content element.
if (options.contentElement) {
options.reverseContainerStretch();
}
// Exposed cleanup function from the $mdCompiler.
options.cleanupElement();
// Restores the focus to the origin element if the last interaction upon opening was a keyboard.
if (!options.$destroy && options.originInteraction === 'keyboard') {
options.origin.focus();
}
}
} | [
"function",
"onRemove",
"(",
"scope",
",",
"element",
",",
"options",
")",
"{",
"options",
".",
"deactivateListeners",
"(",
")",
";",
"options",
".",
"unlockScreenReader",
"(",
")",
";",
"options",
".",
"hideBackdrop",
"(",
"options",
".",
"$destroy",
")",
... | Remove function for all dialogs | [
"Remove",
"function",
"for",
"all",
"dialogs"
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/dialog/dialog.js#L806-L851 | train | Remove the dialog element | [
30522,
3853,
2006,
28578,
21818,
1006,
9531,
1010,
5783,
1010,
7047,
1007,
1063,
7047,
1012,
26709,
6593,
21466,
9863,
24454,
2015,
1006,
1007,
1025,
7047,
1012,
19829,
18182,
16416,
4063,
1006,
1007,
1025,
7047,
1012,
5342,
5963,
25711,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/document/DocumentManager.js | getDocumentText | function getDocumentText(file, checkLineEndings) {
var result = new $.Deferred(),
doc = getOpenDocumentForPath(file.fullPath);
if (doc) {
result.resolve(doc.getText(), doc.diskTimestamp, checkLineEndings ? doc._lineEndings : null);
} else {
file.read(function (err, contents, encoding, stat) {
if (err) {
result.reject(err);
} else {
// Normalize line endings the same way Document would, but don't actually
// new up a Document (which entails a bunch of object churn).
var originalLineEndings = checkLineEndings ? FileUtils.sniffLineEndings(contents) : null;
contents = DocumentModule.Document.normalizeText(contents);
result.resolve(contents, stat.mtime, originalLineEndings);
}
});
}
return result.promise();
} | javascript | function getDocumentText(file, checkLineEndings) {
var result = new $.Deferred(),
doc = getOpenDocumentForPath(file.fullPath);
if (doc) {
result.resolve(doc.getText(), doc.diskTimestamp, checkLineEndings ? doc._lineEndings : null);
} else {
file.read(function (err, contents, encoding, stat) {
if (err) {
result.reject(err);
} else {
// Normalize line endings the same way Document would, but don't actually
// new up a Document (which entails a bunch of object churn).
var originalLineEndings = checkLineEndings ? FileUtils.sniffLineEndings(contents) : null;
contents = DocumentModule.Document.normalizeText(contents);
result.resolve(contents, stat.mtime, originalLineEndings);
}
});
}
return result.promise();
} | [
"function",
"getDocumentText",
"(",
"file",
",",
"checkLineEndings",
")",
"{",
"var",
"result",
"=",
"new",
"$",
".",
"Deferred",
"(",
")",
",",
"doc",
"=",
"getOpenDocumentForPath",
"(",
"file",
".",
"fullPath",
")",
";",
"if",
"(",
"doc",
")",
"{",
"... | Gets the text of a Document (including any unsaved changes), or would-be Document if the
file is not actually open. More efficient than getDocumentForPath(). Use when you're reading
document(s) but don't need to hang onto a Document object.
If the file is open this is equivalent to calling getOpenDocumentForPath().getText(). If the
file is NOT open, this is like calling getDocumentForPath()...getText() but more efficient.
Differs from plain FileUtils.readAsText() in two ways: (a) line endings are still normalized
as in Document.getText(); (b) unsaved changes are returned if there are any.
@param {!File} file The file to get the text for.
@param {boolean=} checkLineEndings Whether to return line ending information. Default false (slightly more efficient).
@return {$.Promise}
A promise that is resolved with three parameters:
contents - string: the document's text
timestamp - Date: the last time the document was changed on disk (might not be the same as the last time it was changed in memory)
lineEndings - string: the original line endings of the file, one of the FileUtils.LINE_ENDINGS_* constants;
will be null if checkLineEndings was false.
or rejected with a filesystem error. | [
"Gets",
"the",
"text",
"of",
"a",
"Document",
"(",
"including",
"any",
"unsaved",
"changes",
")",
"or",
"would",
"-",
"be",
"Document",
"if",
"the",
"file",
"is",
"not",
"actually",
"open",
".",
"More",
"efficient",
"than",
"getDocumentForPath",
"()",
".",... | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/document/DocumentManager.js#L418-L437 | train | Get the text of a file | [
30522,
3853,
2131,
3527,
24894,
4765,
18209,
1006,
5371,
1010,
4638,
4179,
18537,
2015,
1007,
1063,
13075,
2765,
1027,
2047,
1002,
1012,
13366,
28849,
2094,
1006,
1007,
1010,
9986,
1027,
2131,
26915,
3527,
24894,
4765,
29278,
15069,
1006,
5... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SheetJS/js-xlsx | xlsx.js | parse_BoundSheet8 | function parse_BoundSheet8(blob, length, opts) {
var pos = blob.read_shift(4);
var hidden = blob.read_shift(1) & 0x03;
var dt = blob.read_shift(1);
switch(dt) {
case 0: dt = 'Worksheet'; break;
case 1: dt = 'Macrosheet'; break;
case 2: dt = 'Chartsheet'; break;
case 6: dt = 'VBAModule'; break;
}
var name = parse_ShortXLUnicodeString(blob, 0, opts);
if(name.length === 0) name = "Sheet1";
return { pos:pos, hs:hidden, dt:dt, name:name };
} | javascript | function parse_BoundSheet8(blob, length, opts) {
var pos = blob.read_shift(4);
var hidden = blob.read_shift(1) & 0x03;
var dt = blob.read_shift(1);
switch(dt) {
case 0: dt = 'Worksheet'; break;
case 1: dt = 'Macrosheet'; break;
case 2: dt = 'Chartsheet'; break;
case 6: dt = 'VBAModule'; break;
}
var name = parse_ShortXLUnicodeString(blob, 0, opts);
if(name.length === 0) name = "Sheet1";
return { pos:pos, hs:hidden, dt:dt, name:name };
} | [
"function",
"parse_BoundSheet8",
"(",
"blob",
",",
"length",
",",
"opts",
")",
"{",
"var",
"pos",
"=",
"blob",
".",
"read_shift",
"(",
"4",
")",
";",
"var",
"hidden",
"=",
"blob",
".",
"read_shift",
"(",
"1",
")",
"&",
"0x03",
";",
"var",
"dt",
"="... | /* [MS-XLS] 2.4.28 | [
"/",
"*",
"[",
"MS",
"-",
"XLS",
"]",
"2",
".",
"4",
".",
"28"
] | 9a6d8a1d3d80c78dad5201fb389316f935279cdc | https://github.com/SheetJS/js-xlsx/blob/9a6d8a1d3d80c78dad5201fb389316f935279cdc/xlsx.js#L5800-L5813 | train | Parse BoundSheet8 | [
30522,
3853,
11968,
3366,
1035,
19202,
21030,
2102,
2620,
1006,
1038,
4135,
2497,
1010,
3091,
1010,
23569,
2015,
1007,
1063,
13075,
13433,
2015,
1027,
1038,
4135,
2497,
1012,
3191,
1035,
5670,
1006,
1018,
1007,
1025,
13075,
5023,
1027,
1038... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/thirdparty/jszip.js | JSZip | function JSZip(data, options) {
// if this constructor is used without `new`, it adds `new` before itself:
if(!(this instanceof JSZip)) return new JSZip(data, options);
// object containing the files :
// {
// "folder/" : {...},
// "folder/data.txt" : {...}
// }
this.files = {};
// Where we are in the hierarchy
this.root = "";
if (data) {
this.load(data, options);
}
this.clone = function() {
var newObj = new JSZip();
for (var i in this) {
if (typeof this[i] !== "function") {
newObj[i] = this[i];
}
}
return newObj;
};
} | javascript | function JSZip(data, options) {
// if this constructor is used without `new`, it adds `new` before itself:
if(!(this instanceof JSZip)) return new JSZip(data, options);
// object containing the files :
// {
// "folder/" : {...},
// "folder/data.txt" : {...}
// }
this.files = {};
// Where we are in the hierarchy
this.root = "";
if (data) {
this.load(data, options);
}
this.clone = function() {
var newObj = new JSZip();
for (var i in this) {
if (typeof this[i] !== "function") {
newObj[i] = this[i];
}
}
return newObj;
};
} | [
"function",
"JSZip",
"(",
"data",
",",
"options",
")",
"{",
"// if this constructor is used without `new`, it adds `new` before itself:",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"JSZip",
")",
")",
"return",
"new",
"JSZip",
"(",
"data",
",",
"options",
")",
... | Usage:
zip = new JSZip();
zip.file("hello.txt", "Hello, World!").file("tempfile", "nothing");
zip.folder("images").file("smile.gif", base64Data, {base64: true});
zip.file("Xmas.txt", "Ho ho ho !", {date : new Date("December 25, 2007 00:00:01")});
zip.remove("tempfile");
base64zip = zip.generate();
Representation a of zip file in js
@constructor
@param {String=|ArrayBuffer=|Uint8Array=} data the data to load, if any (optional).
@param {Object=} options the options for creating this objects (optional). | [
"Usage",
":",
"zip",
"=",
"new",
"JSZip",
"()",
";",
"zip",
".",
"file",
"(",
"hello",
".",
"txt",
"Hello",
"World!",
")",
".",
"file",
"(",
"tempfile",
"nothing",
")",
";",
"zip",
".",
"folder",
"(",
"images",
")",
".",
"file",
"(",
"smile",
"."... | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/jszip.js#L286-L311 | train | JSZip constructor. | [
30522,
3853,
1046,
17112,
11514,
1006,
2951,
1010,
7047,
1007,
1063,
1013,
1013,
2065,
2023,
9570,
2953,
18061,
2109,
2302,
2050,
1036,
2047,
1036,
1010,
2009,
2050,
9909,
1036,
2047,
1036,
2077,
2050,
2993,
1024,
2065,
1006,
999,
1006,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/widgets/PopUpManager.js | addPopUp | function addPopUp($popUp, removeHandler, autoRemove) {
autoRemove = autoRemove || false;
_popUps.push($popUp[0]);
$popUp.data("PopUpManager-autoRemove", autoRemove);
$popUp.data("PopUpManager-removeHandler", removeHandler);
} | javascript | function addPopUp($popUp, removeHandler, autoRemove) {
autoRemove = autoRemove || false;
_popUps.push($popUp[0]);
$popUp.data("PopUpManager-autoRemove", autoRemove);
$popUp.data("PopUpManager-removeHandler", removeHandler);
} | [
"function",
"addPopUp",
"(",
"$popUp",
",",
"removeHandler",
",",
"autoRemove",
")",
"{",
"autoRemove",
"=",
"autoRemove",
"||",
"false",
";",
"_popUps",
".",
"push",
"(",
"$popUp",
"[",
"0",
"]",
")",
";",
"$popUp",
".",
"data",
"(",
"\"PopUpManager-autoR... | Add Esc key handling for a popup DOM element.
@param {!jQuery} $popUp jQuery object for the DOM element pop-up
@param {function} removeHandler Pop-up specific remove (e.g. display:none or DOM removal)
@param {?Boolean} autoRemove - Specify true to indicate the PopUpManager should
remove the popup from the _popUps array when the popup is closed. Specify false
when the popup is always persistant in the _popUps array. | [
"Add",
"Esc",
"key",
"handling",
"for",
"a",
"popup",
"DOM",
"element",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/widgets/PopUpManager.js#L47-L53 | train | Add a popup to the list of available languages | [
30522,
3853,
5587,
16340,
6279,
1006,
1002,
3769,
6279,
1010,
6366,
11774,
3917,
1010,
8285,
28578,
21818,
1007,
1063,
8285,
28578,
21818,
1027,
8285,
28578,
21818,
1064,
1064,
6270,
1025,
1035,
3769,
22264,
1012,
5245,
1006,
1002,
3769,
62... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
eslint/eslint | lib/rules/new-cap.js | getCap | function getCap(str) {
const firstChar = str.charAt(0);
const firstCharLower = firstChar.toLowerCase();
const firstCharUpper = firstChar.toUpperCase();
if (firstCharLower === firstCharUpper) {
// char has no uppercase variant, so it's non-alphabetic
return "non-alpha";
}
if (firstChar === firstCharLower) {
return "lower";
}
return "upper";
} | javascript | function getCap(str) {
const firstChar = str.charAt(0);
const firstCharLower = firstChar.toLowerCase();
const firstCharUpper = firstChar.toUpperCase();
if (firstCharLower === firstCharUpper) {
// char has no uppercase variant, so it's non-alphabetic
return "non-alpha";
}
if (firstChar === firstCharLower) {
return "lower";
}
return "upper";
} | [
"function",
"getCap",
"(",
"str",
")",
"{",
"const",
"firstChar",
"=",
"str",
".",
"charAt",
"(",
"0",
")",
";",
"const",
"firstCharLower",
"=",
"firstChar",
".",
"toLowerCase",
"(",
")",
";",
"const",
"firstCharUpper",
"=",
"firstChar",
".",
"toUpperCase"... | Returns the capitalization state of the string -
Whether the first character is uppercase, lowercase, or non-alphabetic
@param {string} str String
@returns {string} capitalization state: "non-alpha", "lower", or "upper" | [
"Returns",
"the",
"capitalization",
"state",
"of",
"the",
"string",
"-",
"Whether",
"the",
"first",
"character",
"is",
"uppercase",
"lowercase",
"or",
"non",
"-",
"alphabetic"
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/new-cap.js#L181-L197 | train | getCap - getCap - getCap - getCap - getCap - getCap - getCap - getCap - getCap - getCap - getCap - getCap - getCap - getCap - getCap - getCap - getCap - getCap - getCap - getCap - getCap - getCap - getCap - getCap - getCap - getCap - getCap - getCap - getCap - getCap - getCap - getCap - getCap | [
30522,
3853,
2131,
17695,
1006,
2358,
2099,
1007,
1063,
9530,
3367,
2034,
7507,
2099,
1027,
2358,
2099,
1012,
25869,
4017,
1006,
1014,
1007,
1025,
9530,
3367,
2034,
7507,
12190,
25114,
1027,
2034,
7507,
2099,
1012,
2000,
27663,
18992,
3366,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
BlackrockDigital/startbootstrap-sb-admin-2 | vendor/chart.js/Chart.js | function(inputs, context, index) {
var i, ilen, value;
for (i = 0, ilen = inputs.length; i < ilen; ++i) {
value = inputs[i];
if (value === undefined) {
continue;
}
if (context !== undefined && typeof value === 'function') {
value = value(context);
}
if (index !== undefined && helpers_core.isArray(value)) {
value = value[index];
}
if (value !== undefined) {
return value;
}
}
} | javascript | function(inputs, context, index) {
var i, ilen, value;
for (i = 0, ilen = inputs.length; i < ilen; ++i) {
value = inputs[i];
if (value === undefined) {
continue;
}
if (context !== undefined && typeof value === 'function') {
value = value(context);
}
if (index !== undefined && helpers_core.isArray(value)) {
value = value[index];
}
if (value !== undefined) {
return value;
}
}
} | [
"function",
"(",
"inputs",
",",
"context",
",",
"index",
")",
"{",
"var",
"i",
",",
"ilen",
",",
"value",
";",
"for",
"(",
"i",
"=",
"0",
",",
"ilen",
"=",
"inputs",
".",
"length",
";",
"i",
"<",
"ilen",
";",
"++",
"i",
")",
"{",
"value",
"="... | Evaluates the given `inputs` sequentially and returns the first defined value.
@param {Array} inputs - An array of values, falling back to the last value.
@param {object} [context] - If defined and the current value is a function, the value
is called with `context` as first argument and the result becomes the new input.
@param {number} [index] - If defined and the current value is an array, the value
at `index` become the new input.
@since 2.7.0 | [
"Evaluates",
"the",
"given",
"inputs",
"sequentially",
"and",
"returns",
"the",
"first",
"defined",
"value",
"."
] | ddfaceb4a8e65a41f163e2fdc4eab49384b810a1 | https://github.com/BlackrockDigital/startbootstrap-sb-admin-2/blob/ddfaceb4a8e65a41f163e2fdc4eab49384b810a1/vendor/chart.js/Chart.js#L2667-L2685 | train | Returns the value of the specified parameter in the specified context. | [
30522,
3853,
1006,
20407,
1010,
6123,
1010,
5950,
1007,
1063,
13075,
1045,
1010,
17869,
2078,
1010,
3643,
1025,
2005,
1006,
1045,
1027,
1014,
1010,
17869,
2078,
1027,
20407,
1012,
3091,
1025,
1045,
1026,
17869,
2078,
1025,
1009,
1009,
1045,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
MithrilJS/mithril.js | mithril.js | callHook | function callHook(vnode3) {
var original = vnode3.state
try {
return this.apply(original, arguments)
} finally {
checkState(vnode3, original)
}
} | javascript | function callHook(vnode3) {
var original = vnode3.state
try {
return this.apply(original, arguments)
} finally {
checkState(vnode3, original)
}
} | [
"function",
"callHook",
"(",
"vnode3",
")",
"{",
"var",
"original",
"=",
"vnode3",
".",
"state",
"try",
"{",
"return",
"this",
".",
"apply",
"(",
"original",
",",
"arguments",
")",
"}",
"finally",
"{",
"checkState",
"(",
"vnode3",
",",
"original",
")",
... | Note: the hook is passed as the `this` argument to allow proxying the arguments without requiring a full array allocation to do so. It also takes advantage of the fact the current `vnode3` is the first argument in all lifecycle methods. | [
"Note",
":",
"the",
"hook",
"is",
"passed",
"as",
"the",
"this",
"argument",
"to",
"allow",
"proxying",
"the",
"arguments",
"without",
"requiring",
"a",
"full",
"array",
"allocation",
"to",
"do",
"so",
".",
"It",
"also",
"takes",
"advantage",
"of",
"the",
... | 6d36fe09d129928c6b460720e08d9ed321fcd62b | https://github.com/MithrilJS/mithril.js/blob/6d36fe09d129928c6b460720e08d9ed321fcd62b/mithril.js#L469-L476 | train | Call the hook with the given vnode3 | [
30522,
3853,
2655,
6806,
6559,
1006,
1058,
3630,
3207,
2509,
1007,
1063,
13075,
2434,
1027,
1058,
3630,
3207,
2509,
1012,
2110,
3046,
1063,
2709,
2023,
1012,
6611,
1006,
2434,
1010,
9918,
1007,
1065,
2633,
1063,
14148,
12259,
1006,
1058,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
aws/aws-sdk-js | features/extra/helpers.js | eventually | function eventually(callback, block, options) {
if (!options) options = {};
if (!options.delay) options.delay = 0;
if (!options.backoff) options.backoff = 500;
if (!options.maxTime) options.maxTime = 5;
var delay = options.delay;
var started = this.AWS.util.date.getDate();
var self = this;
var retry = function() { callback(); };
retry.fail = function(err) {
var now = self.AWS.util.date.getDate();
if (now - started < options.maxTime * 1000) {
setTimeout(function () {
delay += options.backoff;
block.call(self, retry);
}, delay);
} else {
callback.fail(err || new Error('Eventually block timed out'));
}
};
block.call(this, retry);
} | javascript | function eventually(callback, block, options) {
if (!options) options = {};
if (!options.delay) options.delay = 0;
if (!options.backoff) options.backoff = 500;
if (!options.maxTime) options.maxTime = 5;
var delay = options.delay;
var started = this.AWS.util.date.getDate();
var self = this;
var retry = function() { callback(); };
retry.fail = function(err) {
var now = self.AWS.util.date.getDate();
if (now - started < options.maxTime * 1000) {
setTimeout(function () {
delay += options.backoff;
block.call(self, retry);
}, delay);
} else {
callback.fail(err || new Error('Eventually block timed out'));
}
};
block.call(this, retry);
} | [
"function",
"eventually",
"(",
"callback",
",",
"block",
",",
"options",
")",
"{",
"if",
"(",
"!",
"options",
")",
"options",
"=",
"{",
"}",
";",
"if",
"(",
"!",
"options",
".",
"delay",
")",
"options",
".",
"delay",
"=",
"0",
";",
"if",
"(",
"!"... | Call this function with a block that will be executed multiple times
to deal with eventually consistent conditions.
this.When(/^I something is eventually consistent$/, function(callback) {
this.eventually(callback, function(next) {
doSomething(function(response) {
if (response != notWhatIExpect) {
next.fail();
} else {
next();
}
});
});
});
You can pass in a few options after the function:
delay: The number of milliseconds to delay before retrying.
backoff: Add this number of milliseconds to the delay between each attempt.
maxTime: Maximum duration of milliseconds to wait for success. | [
"Call",
"this",
"function",
"with",
"a",
"block",
"that",
"will",
"be",
"executed",
"multiple",
"times",
"to",
"deal",
"with",
"eventually",
"consistent",
"conditions",
"."
] | c23e5f0edd150f8885267e5f7c8a564f8e6e8562 | https://github.com/aws/aws-sdk-js/blob/c23e5f0edd150f8885267e5f7c8a564f8e6e8562/features/extra/helpers.js#L33-L59 | train | Called when the service is eventually created | [
30522,
3853,
2776,
1006,
2655,
5963,
1010,
3796,
1010,
7047,
1007,
1063,
2065,
1006,
999,
7047,
1007,
7047,
1027,
1063,
1065,
1025,
2065,
1006,
999,
7047,
1012,
8536,
1007,
7047,
1012,
8536,
1027,
1014,
1025,
2065,
1006,
999,
7047,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/preferences/PreferencesBase.js | function (id) {
var scope = this._scopes[id];
if (scope) {
_.pull(this._defaults.scopeOrder, id);
scope.off(".prefsys");
this.trigger(SCOPEORDER_CHANGE, {
id: id,
action: "removed"
});
this._triggerChange({
ids: scope.getKeys()
});
}
} | javascript | function (id) {
var scope = this._scopes[id];
if (scope) {
_.pull(this._defaults.scopeOrder, id);
scope.off(".prefsys");
this.trigger(SCOPEORDER_CHANGE, {
id: id,
action: "removed"
});
this._triggerChange({
ids: scope.getKeys()
});
}
} | [
"function",
"(",
"id",
")",
"{",
"var",
"scope",
"=",
"this",
".",
"_scopes",
"[",
"id",
"]",
";",
"if",
"(",
"scope",
")",
"{",
"_",
".",
"pull",
"(",
"this",
".",
"_defaults",
".",
"scopeOrder",
",",
"id",
")",
";",
"scope",
".",
"off",
"(",
... | Removes a scope from the default scope order.
@param {string} id Name of the Scope to remove from the default scope order. | [
"Removes",
"a",
"scope",
"from",
"the",
"default",
"scope",
"order",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/preferences/PreferencesBase.js#L1533-L1546 | train | Remove a node from the scope order | [
30522,
3853,
1006,
8909,
1007,
1063,
13075,
9531,
1027,
2023,
1012,
1035,
9531,
2015,
1031,
8909,
1033,
1025,
2065,
1006,
9531,
1007,
1063,
1035,
1012,
4139,
1006,
2023,
1012,
1035,
12398,
2015,
1012,
9531,
8551,
2121,
1010,
8909,
1007,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
aframevr/aframe | src/systems/camera.js | function (newCameraEl) {
var cameraEl;
var cameraEls;
var i;
var newCamera;
var previousCamera = this.activeCameraEl;
var sceneEl = this.sceneEl;
// Same camera.
newCamera = newCameraEl.getObject3D('camera');
if (!newCamera || newCameraEl === this.activeCameraEl) { return; }
// Grab the default camera.
var defaultCameraWrapper = sceneEl.querySelector('[' + DEFAULT_CAMERA_ATTR + ']');
var defaultCameraEl = defaultCameraWrapper &&
defaultCameraWrapper.querySelector('[camera]');
// Remove default camera if new camera is not the default camera.
if (newCameraEl !== defaultCameraEl) { removeDefaultCamera(sceneEl); }
// Make new camera active.
this.activeCameraEl = newCameraEl;
this.activeCameraEl.play();
sceneEl.camera = newCamera;
// Disable current camera
if (previousCamera) {
previousCamera.setAttribute('camera', 'active', false);
}
// Disable other cameras in the scene
cameraEls = sceneEl.querySelectorAll('[camera]');
for (i = 0; i < cameraEls.length; i++) {
cameraEl = cameraEls[i];
if (!cameraEl.isEntity || newCameraEl === cameraEl) { continue; }
cameraEl.setAttribute('camera', 'active', false);
cameraEl.pause();
}
sceneEl.emit('camera-set-active', {cameraEl: newCameraEl});
} | javascript | function (newCameraEl) {
var cameraEl;
var cameraEls;
var i;
var newCamera;
var previousCamera = this.activeCameraEl;
var sceneEl = this.sceneEl;
// Same camera.
newCamera = newCameraEl.getObject3D('camera');
if (!newCamera || newCameraEl === this.activeCameraEl) { return; }
// Grab the default camera.
var defaultCameraWrapper = sceneEl.querySelector('[' + DEFAULT_CAMERA_ATTR + ']');
var defaultCameraEl = defaultCameraWrapper &&
defaultCameraWrapper.querySelector('[camera]');
// Remove default camera if new camera is not the default camera.
if (newCameraEl !== defaultCameraEl) { removeDefaultCamera(sceneEl); }
// Make new camera active.
this.activeCameraEl = newCameraEl;
this.activeCameraEl.play();
sceneEl.camera = newCamera;
// Disable current camera
if (previousCamera) {
previousCamera.setAttribute('camera', 'active', false);
}
// Disable other cameras in the scene
cameraEls = sceneEl.querySelectorAll('[camera]');
for (i = 0; i < cameraEls.length; i++) {
cameraEl = cameraEls[i];
if (!cameraEl.isEntity || newCameraEl === cameraEl) { continue; }
cameraEl.setAttribute('camera', 'active', false);
cameraEl.pause();
}
sceneEl.emit('camera-set-active', {cameraEl: newCameraEl});
} | [
"function",
"(",
"newCameraEl",
")",
"{",
"var",
"cameraEl",
";",
"var",
"cameraEls",
";",
"var",
"i",
";",
"var",
"newCamera",
";",
"var",
"previousCamera",
"=",
"this",
".",
"activeCameraEl",
";",
"var",
"sceneEl",
"=",
"this",
".",
"sceneEl",
";",
"//... | Set active camera to be used by renderer.
Removes the default camera (if present).
Disables all other cameras in the scene.
@param {Element} newCameraEl - Entity with camera component. | [
"Set",
"active",
"camera",
"to",
"be",
"used",
"by",
"renderer",
".",
"Removes",
"the",
"default",
"camera",
"(",
"if",
"present",
")",
".",
"Disables",
"all",
"other",
"cameras",
"in",
"the",
"scene",
"."
] | 24acc78a7299a4cdfe3ef617f4d40ddf6275c992 | https://github.com/aframevr/aframe/blob/24acc78a7299a4cdfe3ef617f4d40ddf6275c992/src/systems/camera.js#L147-L186 | train | Sets the active camera of the scene. | [
30522,
3853,
1006,
2047,
28727,
6906,
2884,
1007,
1063,
13075,
4950,
2884,
1025,
13075,
4950,
9050,
1025,
13075,
1045,
1025,
13075,
2047,
28727,
6906,
1025,
13075,
3025,
28727,
6906,
1027,
2023,
1012,
3161,
28727,
6906,
2884,
1025,
13075,
3... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | src/sap.ui.core/src/sap/ui/core/routing/Targets.js | function () {
var sTargetName;
EventProvider.prototype.destroy.apply(this);
for (sTargetName in this._mTargets) {
if (this._mTargets.hasOwnProperty(sTargetName)) {
this._mTargets[sTargetName].destroy();
}
}
this._mTargets = null;
this._oCache = null;
this._oConfig = null;
this.bIsDestroyed = true;
return this;
} | javascript | function () {
var sTargetName;
EventProvider.prototype.destroy.apply(this);
for (sTargetName in this._mTargets) {
if (this._mTargets.hasOwnProperty(sTargetName)) {
this._mTargets[sTargetName].destroy();
}
}
this._mTargets = null;
this._oCache = null;
this._oConfig = null;
this.bIsDestroyed = true;
return this;
} | [
"function",
"(",
")",
"{",
"var",
"sTargetName",
";",
"EventProvider",
".",
"prototype",
".",
"destroy",
".",
"apply",
"(",
"this",
")",
";",
"for",
"(",
"sTargetName",
"in",
"this",
".",
"_mTargets",
")",
"{",
"if",
"(",
"this",
".",
"_mTargets",
".",... | Destroys the targets instance and all created targets. Does not destroy the views instance passed to the constructor. It has to be destroyed separately.
@public
@returns { sap.ui.core.routing.Targets } this for chaining. | [
"Destroys",
"the",
"targets",
"instance",
"and",
"all",
"created",
"targets",
".",
"Does",
"not",
"destroy",
"the",
"views",
"instance",
"passed",
"to",
"the",
"constructor",
".",
"It",
"has",
"to",
"be",
"destroyed",
"separately",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/routing/Targets.js#L347-L363 | train | Destroys all related objects. | [
30522,
3853,
1006,
1007,
1063,
13075,
2732,
18150,
18442,
1025,
2724,
21572,
17258,
2121,
1012,
8773,
1012,
6033,
1012,
6611,
1006,
2023,
1007,
1025,
2005,
1006,
2732,
18150,
18442,
1999,
2023,
1012,
1035,
11047,
2906,
18150,
2015,
1007,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SeleniumHQ/selenium | javascript/selenium-core/scripts/htmlutils.js | function( xhr, url ) {
var lastModified = xhr.getResponseHeader("Last-Modified"),
etag = xhr.getResponseHeader("Etag");
if ( lastModified ) {
jQuery.lastModified[url] = lastModified;
}
if ( etag ) {
jQuery.etag[url] = etag;
}
// Opera returns 0 when status is 304
return xhr.status === 304 || xhr.status === 0;
} | javascript | function( xhr, url ) {
var lastModified = xhr.getResponseHeader("Last-Modified"),
etag = xhr.getResponseHeader("Etag");
if ( lastModified ) {
jQuery.lastModified[url] = lastModified;
}
if ( etag ) {
jQuery.etag[url] = etag;
}
// Opera returns 0 when status is 304
return xhr.status === 304 || xhr.status === 0;
} | [
"function",
"(",
"xhr",
",",
"url",
")",
"{",
"var",
"lastModified",
"=",
"xhr",
".",
"getResponseHeader",
"(",
"\"Last-Modified\"",
")",
",",
"etag",
"=",
"xhr",
".",
"getResponseHeader",
"(",
"\"Etag\"",
")",
";",
"if",
"(",
"lastModified",
")",
"{",
"... | Determines if an XMLHttpRequest returns NotModified | [
"Determines",
"if",
"an",
"XMLHttpRequest",
"returns",
"NotModified"
] | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/selenium-core/scripts/htmlutils.js#L7769-L7783 | train | Cache the response headers | [
30522,
3853,
1006,
1060,
8093,
1010,
24471,
2140,
1007,
1063,
13075,
30524,
2121,
1006,
1000,
2197,
1011,
6310,
1000,
1007,
1010,
27859,
2290,
1027,
1060,
8093,
1012,
2131,
6072,
26029,
3366,
4974,
2121,
1006,
1000,
27859,
2290,
1000,
1007,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
dcloudio/mui | examples/login/libs/easymob-webim-sdk/strophe-custom-2.0.0.js | function (bin) {
var str = "";
for(var i = 0; i < bin.length * 32; i += 8)
{
str += String.fromCharCode((bin[i>>5] >>> (i % 32)) & 255);
}
return str;
} | javascript | function (bin) {
var str = "";
for(var i = 0; i < bin.length * 32; i += 8)
{
str += String.fromCharCode((bin[i>>5] >>> (i % 32)) & 255);
}
return str;
} | [
"function",
"(",
"bin",
")",
"{",
"var",
"str",
"=",
"\"\"",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"bin",
".",
"length",
"*",
"32",
";",
"i",
"+=",
"8",
")",
"{",
"str",
"+=",
"String",
".",
"fromCharCode",
"(",
"(",
"bin",
... | /*
Convert an array of little-endian words to a string | [
"/",
"*",
"Convert",
"an",
"array",
"of",
"little",
"-",
"endian",
"words",
"to",
"a",
"string"
] | ff74c90a1671a552f3604b1288bf38a4126312d0 | https://github.com/dcloudio/mui/blob/ff74c90a1671a552f3604b1288bf38a4126312d0/examples/login/libs/easymob-webim-sdk/strophe-custom-2.0.0.js#L316-L323 | train | Returns a string of the contents of a binary array of words | [
30522,
3853,
1006,
8026,
1007,
1063,
13075,
2358,
2099,
1027,
1000,
1000,
1025,
2005,
1006,
13075,
1045,
1027,
1014,
1025,
1045,
1026,
8026,
1012,
3091,
1008,
3590,
1025,
1045,
1009,
1027,
1022,
1007,
1063,
2358,
2099,
1009,
1027,
5164,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
apache/incubator-echarts | src/chart/treemap/Breadcrumb.js | packEventData | function packEventData(el, seriesModel, itemNode) {
el.eventData = {
componentType: 'series',
componentSubType: 'treemap',
componentIndex: seriesModel.componentIndex,
seriesIndex: seriesModel.componentIndex,
seriesName: seriesModel.name,
seriesType: 'treemap',
selfType: 'breadcrumb', // Distinguish with click event on treemap node.
nodeData: {
dataIndex: itemNode && itemNode.dataIndex,
name: itemNode && itemNode.name
},
treePathInfo: itemNode && wrapTreePathInfo(itemNode, seriesModel)
};
} | javascript | function packEventData(el, seriesModel, itemNode) {
el.eventData = {
componentType: 'series',
componentSubType: 'treemap',
componentIndex: seriesModel.componentIndex,
seriesIndex: seriesModel.componentIndex,
seriesName: seriesModel.name,
seriesType: 'treemap',
selfType: 'breadcrumb', // Distinguish with click event on treemap node.
nodeData: {
dataIndex: itemNode && itemNode.dataIndex,
name: itemNode && itemNode.name
},
treePathInfo: itemNode && wrapTreePathInfo(itemNode, seriesModel)
};
} | [
"function",
"packEventData",
"(",
"el",
",",
"seriesModel",
",",
"itemNode",
")",
"{",
"el",
".",
"eventData",
"=",
"{",
"componentType",
":",
"'series'",
",",
"componentSubType",
":",
"'treemap'",
",",
"componentIndex",
":",
"seriesModel",
".",
"componentIndex"... | Package custom mouse event. | [
"Package",
"custom",
"mouse",
"event",
"."
] | 4d0ea095dc3929cb6de40c45748826e7999c7aa8 | https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/chart/treemap/Breadcrumb.js#L171-L186 | train | Pack event data into an event object | [
30522,
3853,
5308,
18697,
3372,
2850,
2696,
1006,
3449,
1010,
2186,
5302,
9247,
1010,
8875,
3630,
3207,
1007,
1063,
3449,
1012,
2724,
2850,
2696,
1027,
1063,
6922,
13874,
1024,
1005,
2186,
1005,
1010,
6177,
12083,
13874,
1024,
1005,
3392,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
jgraph/mxgraph | javascript/mxClient.js | mxUndoableEdit | function mxUndoableEdit(source, significant)
{
this.source = source;
this.changes = [];
this.significant = (significant != null) ? significant : true;
} | javascript | function mxUndoableEdit(source, significant)
{
this.source = source;
this.changes = [];
this.significant = (significant != null) ? significant : true;
} | [
"function",
"mxUndoableEdit",
"(",
"source",
",",
"significant",
")",
"{",
"this",
".",
"source",
"=",
"source",
";",
"this",
".",
"changes",
"=",
"[",
"]",
";",
"this",
".",
"significant",
"=",
"(",
"significant",
"!=",
"null",
")",
"?",
"significant",
... | Copyright (c) 2006-2015, JGraph Ltd
Copyright (c) 2006-2015, Gaudenz Alder
Class: mxUndoableEdit
Implements a composite undoable edit. Here is an example for a custom change
which gets executed via the model:
(code)
function CustomChange(model, name)
{
this.model = model;
this.name = name;
this.previous = name;
};
CustomChange.prototype.execute = function()
{
var tmp = this.model.name;
this.model.name = this.previous;
this.previous = tmp;
};
var name = prompt('Enter name');
graph.model.execute(new CustomChange(graph.model, name));
(end)
Event: mxEvent.EXECUTED
Fires between START_EDIT and END_EDIT after an atomic change was executed.
The <code>change</code> property contains the change that was executed.
Event: mxEvent.START_EDIT
Fires before a set of changes will be executed in <undo> or <redo>.
This event contains no properties.
Event: mxEvent.END_EDIT
Fires after a set of changeswas executed in <undo> or <redo>.
This event contains no properties.
Constructor: mxUndoableEdit
Constructs a new undoable edit for the given source. | [
"Copyright",
"(",
"c",
")",
"2006",
"-",
"2015",
"JGraph",
"Ltd",
"Copyright",
"(",
"c",
")",
"2006",
"-",
"2015",
"Gaudenz",
"Alder",
"Class",
":",
"mxUndoableEdit"
] | 33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44 | https://github.com/jgraph/mxgraph/blob/33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44/javascript/mxClient.js#L14287-L14292 | train | A wrapper around the mxUndoableEdit class | [
30522,
3853,
25630,
8630,
10441,
3468,
2098,
4183,
1006,
3120,
1010,
3278,
1007,
1063,
2023,
1012,
3120,
1027,
3120,
1025,
2023,
1012,
3431,
1027,
1031,
1033,
1025,
2023,
1012,
3278,
1027,
1006,
3278,
999,
1027,
19701,
1007,
1029,
3278,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.