repo stringclasses 192 values | path stringlengths 4 115 | func_name stringlengths 0 45 | original_string stringlengths 74 24k | language stringclasses 1 value | code stringlengths 74 24k | code_tokens listlengths 23 4.2k | docstring stringlengths 2 23.7k | docstring_tokens listlengths 1 810 | sha stringclasses 192 values | url stringlengths 90 200 | partition stringclasses 1 value | summary stringlengths 6 313 | input_ids listlengths 502 502 | token_type_ids listlengths 502 502 | attention_mask listlengths 502 502 | labels listlengths 502 502 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
eslint/eslint | lib/rules/no-use-before-define.js | isOuterClass | function isOuterClass(variable, reference) {
return (
variable.defs[0].type === "ClassName" &&
variable.scope.variableScope !== reference.from.variableScope
);
} | javascript | function isOuterClass(variable, reference) {
return (
variable.defs[0].type === "ClassName" &&
variable.scope.variableScope !== reference.from.variableScope
);
} | [
"function",
"isOuterClass",
"(",
"variable",
",",
"reference",
")",
"{",
"return",
"(",
"variable",
".",
"defs",
"[",
"0",
"]",
".",
"type",
"===",
"\"ClassName\"",
"&&",
"variable",
".",
"scope",
".",
"variableScope",
"!==",
"reference",
".",
"from",
".",... | Checks whether or not a given variable is a class declaration in an upper function scope.
@param {eslint-scope.Variable} variable - A variable to check.
@param {eslint-scope.Reference} reference - A reference to check.
@returns {boolean} `true` if the variable is a class declaration. | [
"Checks",
"whether",
"or",
"not",
"a",
"given",
"variable",
"is",
"a",
"class",
"declaration",
"in",
"an",
"upper",
"function",
"scope",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/no-use-before-define.js#L54-L59 | train | Returns true if the variable is an outer class of the given reference | [
30522,
3853,
11163,
19901,
26266,
1006,
8023,
1010,
4431,
1007,
1063,
2709,
1006,
8023,
1012,
13366,
2015,
1031,
1014,
1033,
1012,
2828,
1027,
1027,
1027,
1000,
2465,
18442,
1000,
1004,
1004,
8023,
1012,
9531,
1012,
10857,
16186,
999,
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... |
ColorlibHQ/AdminLTE | plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js | updateCollapsedAndCommonAncestor | function updateCollapsedAndCommonAncestor(range) {
range.collapsed = (range.startContainer === range.endContainer && range.startOffset === range.endOffset);
range.commonAncestorContainer = range.collapsed ?
range.startContainer : dom.getCommonAncestor(range.startContainer, range.endContainer);
} | javascript | function updateCollapsedAndCommonAncestor(range) {
range.collapsed = (range.startContainer === range.endContainer && range.startOffset === range.endOffset);
range.commonAncestorContainer = range.collapsed ?
range.startContainer : dom.getCommonAncestor(range.startContainer, range.endContainer);
} | [
"function",
"updateCollapsedAndCommonAncestor",
"(",
"range",
")",
"{",
"range",
".",
"collapsed",
"=",
"(",
"range",
".",
"startContainer",
"===",
"range",
".",
"endContainer",
"&&",
"range",
".",
"startOffset",
"===",
"range",
".",
"endOffset",
")",
";",
"ra... | /*---------------------------------------------------------------------------------------------------------------- Updates commonAncestorContainer and collapsed after boundary change | [
"/",
"*",
"----------------------------------------------------------------------------------------------------------------",
"Updates",
"commonAncestorContainer",
"and",
"collapsed",
"after",
"boundary",
"change"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js#L2131-L2135 | train | Update collapsed and common ancestor | [
30522,
3853,
10651,
26895,
9331,
6924,
5685,
9006,
21781,
5897,
23809,
1006,
2846,
1007,
1063,
2846,
1012,
7798,
1027,
1006,
2846,
1012,
2707,
8663,
18249,
2121,
1027,
1027,
1027,
2846,
1012,
2203,
8663,
18249,
2121,
1004,
1004,
2846,
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.core/src/sap/ui/model/odata/ODataUtils.js | parseDecimal | function parseDecimal(sValue) {
var aMatches;
if (typeof sValue !== "string") {
return undefined;
}
aMatches = rDecimal.exec(sValue);
if (!aMatches) {
return undefined;
}
return {
sign: aMatches[1] === "-" ? -1 : 1,
integerLength: aMatches[2].length,
// remove trailing decimal zeroes and poss. the point afterwards
abs: aMatches[2] + aMatches[3].replace(rTrailingZeroes, "")
.replace(rTrailingDecimal, "")
};
} | javascript | function parseDecimal(sValue) {
var aMatches;
if (typeof sValue !== "string") {
return undefined;
}
aMatches = rDecimal.exec(sValue);
if (!aMatches) {
return undefined;
}
return {
sign: aMatches[1] === "-" ? -1 : 1,
integerLength: aMatches[2].length,
// remove trailing decimal zeroes and poss. the point afterwards
abs: aMatches[2] + aMatches[3].replace(rTrailingZeroes, "")
.replace(rTrailingDecimal, "")
};
} | [
"function",
"parseDecimal",
"(",
"sValue",
")",
"{",
"var",
"aMatches",
";",
"if",
"(",
"typeof",
"sValue",
"!==",
"\"string\"",
")",
"{",
"return",
"undefined",
";",
"}",
"aMatches",
"=",
"rDecimal",
".",
"exec",
"(",
"sValue",
")",
";",
"if",
"(",
"!... | Parses a decimal given in a string.
@param {string} sValue
the value
@returns {object}
the result with the sign in <code>sign</code>, the number of integer digits in
<code>integerLength</code> and the trimmed absolute value in <code>abs</code> | [
"Parses",
"a",
"decimal",
"given",
"in",
"a",
"string",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/ODataUtils.js#L571-L588 | train | Parses a decimal value. | [
30522,
3853,
11968,
6924,
8586,
9581,
2140,
1006,
17917,
2389,
5657,
1007,
1063,
13075,
25933,
10649,
2229,
1025,
2065,
1006,
2828,
11253,
17917,
2389,
5657,
999,
1027,
1027,
1000,
5164,
1000,
1007,
1063,
2709,
6151,
28344,
1025,
1065,
2593... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/space-infix-ops.js | checkConditional | function checkConditional(node) {
const nonSpacedConsequesntNode = getFirstNonSpacedToken(node.test, node.consequent, "?");
const nonSpacedAlternateNode = getFirstNonSpacedToken(node.consequent, node.alternate, ":");
if (nonSpacedConsequesntNode) {
report(node, nonSpacedConsequesntNode);
} else if (nonSpacedAlternateNode) {
report(node, nonSpacedAlternateNode);
}
} | javascript | function checkConditional(node) {
const nonSpacedConsequesntNode = getFirstNonSpacedToken(node.test, node.consequent, "?");
const nonSpacedAlternateNode = getFirstNonSpacedToken(node.consequent, node.alternate, ":");
if (nonSpacedConsequesntNode) {
report(node, nonSpacedConsequesntNode);
} else if (nonSpacedAlternateNode) {
report(node, nonSpacedAlternateNode);
}
} | [
"function",
"checkConditional",
"(",
"node",
")",
"{",
"const",
"nonSpacedConsequesntNode",
"=",
"getFirstNonSpacedToken",
"(",
"node",
".",
"test",
",",
"node",
".",
"consequent",
",",
"\"?\"",
")",
";",
"const",
"nonSpacedAlternateNode",
"=",
"getFirstNonSpacedTok... | Check if the node is conditional
@param {ASTNode} node node to evaluate
@returns {void}
@private | [
"Check",
"if",
"the",
"node",
"is",
"conditional"
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/space-infix-ops.js#L125-L134 | train | Check if a conditional node is valid | [
30522,
3853,
4638,
8663,
27064,
1006,
13045,
1007,
1063,
9530,
3367,
2512,
23058,
16409,
5644,
2063,
10997,
3372,
3630,
3207,
1027,
2131,
8873,
12096,
8540,
23058,
11927,
11045,
2078,
1006,
13045,
1012,
3231,
1010,
13045,
1012,
9530,
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... |
jhipster/generator-jhipster | generators/docker-cli.js | pushImage | function pushImage(repository) {
const commandLine = `docker push ${repository}`;
return new Promise((resolve, reject) =>
command(commandLine, (err, stdout) => {
if (err) {
reject(err);
}
resolve(stdout);
})
);
} | javascript | function pushImage(repository) {
const commandLine = `docker push ${repository}`;
return new Promise((resolve, reject) =>
command(commandLine, (err, stdout) => {
if (err) {
reject(err);
}
resolve(stdout);
})
);
} | [
"function",
"pushImage",
"(",
"repository",
")",
"{",
"const",
"commandLine",
"=",
"`",
"${",
"repository",
"}",
"`",
";",
"return",
"new",
"Promise",
"(",
"(",
"resolve",
",",
"reject",
")",
"=>",
"command",
"(",
"commandLine",
",",
"(",
"err",
",",
"... | Pushes the locally constructed Docker image to the supplied respository
@param repository tag, for example: 111111111.dkr.ecr.us-east-1.amazonaws.com/sample
@returns {Promise<any>} | [
"Pushes",
"the",
"locally",
"constructed",
"Docker",
"image",
"to",
"the",
"supplied",
"respository"
] | f76fa8de0818ce6bda6c7b1455942e2a9b0ae3ff | https://github.com/jhipster/generator-jhipster/blob/f76fa8de0818ce6bda6c7b1455942e2a9b0ae3ff/generators/docker-cli.js#L138-L148 | train | Pushes an image to the specified repository | [
30522,
3853,
5245,
9581,
3351,
1006,
22409,
1007,
1063,
9530,
3367,
3094,
4179,
1027,
1036,
8946,
2121,
5245,
1002,
1063,
22409,
1065,
1036,
1025,
2709,
2047,
4872,
1006,
1006,
10663,
1010,
15454,
1007,
1027,
1028,
3094,
1006,
3094,
4179,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 | packages/@uppy/webcam/src/index.js | getMediaDevices | function getMediaDevices () {
if (navigator.mediaDevices && navigator.mediaDevices.getUserMedia) {
return navigator.mediaDevices
}
const getUserMedia = navigator.mozGetUserMedia || navigator.webkitGetUserMedia
if (!getUserMedia) {
return null
}
return {
getUserMedia (opts) {
return new Promise((resolve, reject) => {
getUserMedia.call(navigator, opts, resolve, reject)
})
}
}
} | javascript | function getMediaDevices () {
if (navigator.mediaDevices && navigator.mediaDevices.getUserMedia) {
return navigator.mediaDevices
}
const getUserMedia = navigator.mozGetUserMedia || navigator.webkitGetUserMedia
if (!getUserMedia) {
return null
}
return {
getUserMedia (opts) {
return new Promise((resolve, reject) => {
getUserMedia.call(navigator, opts, resolve, reject)
})
}
}
} | [
"function",
"getMediaDevices",
"(",
")",
"{",
"if",
"(",
"navigator",
".",
"mediaDevices",
"&&",
"navigator",
".",
"mediaDevices",
".",
"getUserMedia",
")",
"{",
"return",
"navigator",
".",
"mediaDevices",
"}",
"const",
"getUserMedia",
"=",
"navigator",
".",
"... | Setup getUserMedia, with polyfill for older browsers Adapted from: https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia | [
"Setup",
"getUserMedia",
"with",
"polyfill",
"for",
"older",
"browsers",
"Adapted",
"from",
":",
"https",
":",
"//",
"developer",
".",
"mozilla",
".",
"org",
"/",
"en",
"-",
"US",
"/",
"docs",
"/",
"Web",
"/",
"API",
"/",
"MediaDevices",
"/",
"getUserMed... | 7ae18bf992d544a64da998f033258ec09a3de275 | https://github.com/transloadit/uppy/blob/7ae18bf992d544a64da998f033258ec09a3de275/packages/@uppy/webcam/src/index.js#L13-L30 | train | getMediaDevices - returns a Promise | [
30522,
3853,
2131,
16969,
24844,
23522,
1006,
1007,
1063,
2065,
1006,
20532,
1012,
2865,
24844,
23522,
1004,
1004,
20532,
1012,
2865,
24844,
23522,
1012,
2131,
20330,
16969,
1007,
1063,
2709,
20532,
1012,
2865,
24844,
23522,
1065,
9530,
3367,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
radare/radare2 | shlr/www/graph/index.js | setMenu | function setMenu() {
var url = document.location.href;
// strip extension
url = stripExtension(url);
var ulElement = document.getElementById("menu");
var links = ulElement.getElementsByTagName("A");
var i;
for(i = 0; i < links.length; i++) {
if(url.indexOf(stripExtension(links[i].href)) == 0) {
links[i].className = "active_menu";
return;
}
}
} | javascript | function setMenu() {
var url = document.location.href;
// strip extension
url = stripExtension(url);
var ulElement = document.getElementById("menu");
var links = ulElement.getElementsByTagName("A");
var i;
for(i = 0; i < links.length; i++) {
if(url.indexOf(stripExtension(links[i].href)) == 0) {
links[i].className = "active_menu";
return;
}
}
} | [
"function",
"setMenu",
"(",
")",
"{",
"var",
"url",
"=",
"document",
".",
"location",
".",
"href",
";",
"// strip extension",
"url",
"=",
"stripExtension",
"(",
"url",
")",
";",
"var",
"ulElement",
"=",
"document",
".",
"getElementById",
"(",
"\"menu\"",
"... | sets the active menu scanning for a menu item which url is a prefix
of the one of the current page ignoring file extension.
Nice trick! | [
"sets",
"the",
"active",
"menu",
"scanning",
"for",
"a",
"menu",
"item",
"which",
"url",
"is",
"a",
"prefix",
"of",
"the",
"one",
"of",
"the",
"current",
"page",
"ignoring",
"file",
"extension",
".",
"Nice",
"trick!"
] | bf5e3028810a0ec7c267c6fe4bfad639b4819e35 | https://github.com/radare/radare2/blob/bf5e3028810a0ec7c267c6fe4bfad639b4819e35/shlr/www/graph/index.js#L47-L61 | train | set menu | [
30522,
3853,
2275,
3549,
2226,
1006,
1007,
1063,
13075,
24471,
2140,
1027,
6254,
1012,
3295,
1012,
17850,
12879,
1025,
1013,
1013,
6167,
5331,
24471,
2140,
1027,
18247,
18413,
6132,
3258,
1006,
24471,
2140,
1007,
1025,
13075,
17359,
12260,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/base/util/array/uniqueSort.js | function(aArray) {
assert(aArray instanceof Array, "uniqueSort: input parameter must be an Array");
var l = aArray.length;
if ( l > 1 ) {
aArray.sort();
var j = 0;
for (var i = 1; i < l; i++) {
// invariant: i is the entry to check, j is the last unique entry known so far
if ( aArray[i] !== aArray[j] ) {
aArray[++j] = aArray[i];
}
}
// cut off the rest - if any
if ( ++j < l ) {
aArray.splice(j, l - j);
}
}
return aArray;
} | javascript | function(aArray) {
assert(aArray instanceof Array, "uniqueSort: input parameter must be an Array");
var l = aArray.length;
if ( l > 1 ) {
aArray.sort();
var j = 0;
for (var i = 1; i < l; i++) {
// invariant: i is the entry to check, j is the last unique entry known so far
if ( aArray[i] !== aArray[j] ) {
aArray[++j] = aArray[i];
}
}
// cut off the rest - if any
if ( ++j < l ) {
aArray.splice(j, l - j);
}
}
return aArray;
} | [
"function",
"(",
"aArray",
")",
"{",
"assert",
"(",
"aArray",
"instanceof",
"Array",
",",
"\"uniqueSort: input parameter must be an Array\"",
")",
";",
"var",
"l",
"=",
"aArray",
".",
"length",
";",
"if",
"(",
"l",
">",
"1",
")",
"{",
"aArray",
".",
"sort"... | Sorts the given array in-place and removes any duplicates (identified by "===").
Use <code>jQuery.unique()</code> for arrays of DOMElements.
@function
@since 1.58
@param {any[]} aArray An Array of any type
@alias module:sap/base/util/array/uniqueSort
@return {any[]} Same array as given (for chaining)
@public | [
"Sorts",
"the",
"given",
"array",
"in",
"-",
"place",
"and",
"removes",
"any",
"duplicates",
"(",
"identified",
"by",
"===",
")",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/base/util/array/uniqueSort.js#L19-L37 | train | uniqueSort - Sorts an array of unique entries | [
30522,
3853,
1006,
9779,
11335,
2100,
1007,
1063,
20865,
1006,
9779,
11335,
2100,
6013,
11253,
9140,
1010,
1000,
4310,
21748,
2102,
1024,
7953,
16381,
2442,
2022,
2019,
9140,
1000,
1007,
1025,
13075,
1048,
1027,
9779,
11335,
2100,
1012,
309... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/Animatable.js | function (target, time, delay, easing, callback, forceAnimate) {
animateTo(this, target, time, delay, easing, callback, forceAnimate);
} | javascript | function (target, time, delay, easing, callback, forceAnimate) {
animateTo(this, target, time, delay, easing, callback, forceAnimate);
} | [
"function",
"(",
"target",
",",
"time",
",",
"delay",
",",
"easing",
",",
"callback",
",",
"forceAnimate",
")",
"{",
"animateTo",
"(",
"this",
",",
"target",
",",
"time",
",",
"delay",
",",
"easing",
",",
"callback",
",",
"forceAnimate",
")",
";",
"}"
... | Caution: this method will stop previous animation.
So do not use this method to one element twice before
animation starts, unless you know what you are doing.
@param {Object} target
@param {number} [time=500] Time in ms
@param {string} [easing='linear']
@param {number} [delay=0]
@param {Function} [callback]
@param {Function} [forceAnimate] Prevent stop animation and callback
immediently when target values are the same as current values.
@example
// Animate position
el.animateTo({
position: [10, 10]
}, function () { // done })
// Animate shape, style and position in 100ms, delayed 100ms, with cubicOut easing
el.animateTo({
shape: {
width: 500
},
style: {
fill: 'red'
}
position: [10, 10]
}, 100, 100, 'cubicOut', function () { // done })
TODO Return animation key | [
"Caution",
":",
"this",
"method",
"will",
"stop",
"previous",
"animation",
".",
"So",
"do",
"not",
"use",
"this",
"method",
"to",
"one",
"element",
"twice",
"before",
"animation",
"starts",
"unless",
"you",
"know",
"what",
"you",
"are",
"doing",
".",
"@par... | 30321b57cba3149c30eacb0c1e18276f0f001b9f | https://github.com/ecomfe/zrender/blob/30321b57cba3149c30eacb0c1e18276f0f001b9f/src/mixin/Animatable.js#L141-L143 | train | Animate the current page to another page | [
30522,
3853,
1006,
4539,
1010,
2051,
1010,
8536,
1010,
24070,
1010,
2655,
5963,
1010,
2486,
7088,
8585,
1007,
1063,
2019,
21499,
3406,
1006,
2023,
1010,
4539,
1010,
2051,
1010,
8536,
1010,
24070,
1010,
2655,
5963,
1010,
2486,
7088,
8585,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... | |
airyland/vux | src/components/blur/blur.js | function (element, options) {
this.internalID = randomID()
this.element = element
this.width = element.offsetWidth
this.height = element.offsetHeight
this.element = element
this.parent = this.element.parentNode
this.options = Object.assign({}, Blur.DEFAULTS, options)
this.overlayEl = this.createOverlay()
this.blurredImage = null
this.attachListeners()
this.generateBlurredImage(this.options.url)
} | javascript | function (element, options) {
this.internalID = randomID()
this.element = element
this.width = element.offsetWidth
this.height = element.offsetHeight
this.element = element
this.parent = this.element.parentNode
this.options = Object.assign({}, Blur.DEFAULTS, options)
this.overlayEl = this.createOverlay()
this.blurredImage = null
this.attachListeners()
this.generateBlurredImage(this.options.url)
} | [
"function",
"(",
"element",
",",
"options",
")",
"{",
"this",
".",
"internalID",
"=",
"randomID",
"(",
")",
"this",
".",
"element",
"=",
"element",
"this",
".",
"width",
"=",
"element",
".",
"offsetWidth",
"this",
".",
"height",
"=",
"element",
".",
"o... | backgroundBlur PUBLIC CLASS DEFINITION ================================ | [
"backgroundBlur",
"PUBLIC",
"CLASS",
"DEFINITION",
"================================"
] | 484fc3c18bdca99b0c08efbb678c0ee0f5ceedd6 | https://github.com/airyland/vux/blob/484fc3c18bdca99b0c08efbb678c0ee0f5ceedd6/src/components/blur/blur.js#L92-L104 | train | Creates a new Blur instance | [
30522,
3853,
1006,
5783,
1010,
7047,
1007,
1063,
2023,
1012,
4722,
3593,
1027,
6721,
3593,
1006,
1007,
2023,
1012,
5783,
1027,
5783,
2023,
1012,
9381,
1027,
5783,
1012,
16396,
9148,
11927,
2232,
2023,
1012,
4578,
1027,
5783,
1012,
16396,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/v4/ODataMetaModel.js | setConstraint | function setConstraint(sKey, vValue) {
if (vValue !== undefined) {
mConstraints = mConstraints || {};
mConstraints[sKey] = vValue;
}
} | javascript | function setConstraint(sKey, vValue) {
if (vValue !== undefined) {
mConstraints = mConstraints || {};
mConstraints[sKey] = vValue;
}
} | [
"function",
"setConstraint",
"(",
"sKey",
",",
"vValue",
")",
"{",
"if",
"(",
"vValue",
"!==",
"undefined",
")",
"{",
"mConstraints",
"=",
"mConstraints",
"||",
"{",
"}",
";",
"mConstraints",
"[",
"sKey",
"]",
"=",
"vValue",
";",
"}",
"}"
] | /*
Adds a constraint to the map of constraints if a value is given. Does not create the map
or a constraint if not needed.
@param {string} sKey The constraint's name
@param {any} vValue The contraint's value | [
"/",
"*",
"Adds",
"a",
"constraint",
"to",
"the",
"map",
"of",
"constraints",
"if",
"a",
"value",
"is",
"given",
".",
"Does",
"not",
"create",
"the",
"map",
"or",
"a",
"constraint",
"if",
"not",
"needed",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/ODataMetaModel.js#L1854-L1859 | train | Sets constraint for the given key. | [
30522,
3853,
2275,
8663,
20528,
18447,
1006,
15315,
3240,
1010,
1058,
10175,
5657,
1007,
1063,
2065,
1006,
1058,
10175,
5657,
999,
1027,
1027,
6151,
28344,
1007,
1063,
11338,
5644,
23654,
3215,
1027,
11338,
5644,
23654,
3215,
1064,
1064,
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... |
NetEase/pomelo | lib/connectors/mqttsocket.js | function(id, socket, adaptor) {
EventEmitter.call(this);
this.id = id;
this.socket = socket;
this.remoteAddress = {
ip: socket.stream.remoteAddress,
port: socket.stream.remotePort
};
this.adaptor = adaptor;
var self = this;
socket.on('close', this.emit.bind(this, 'disconnect'));
socket.on('error', this.emit.bind(this, 'disconnect'));
socket.on('disconnect', this.emit.bind(this, 'disconnect'));
socket.on('pingreq', function(packet) {
socket.pingresp();
});
socket.on('subscribe', this.adaptor.onSubscribe.bind(this.adaptor, this));
socket.on('publish', this.adaptor.onPublish.bind(this.adaptor, this));
this.state = ST_INITED;
// TODO: any other events?
} | javascript | function(id, socket, adaptor) {
EventEmitter.call(this);
this.id = id;
this.socket = socket;
this.remoteAddress = {
ip: socket.stream.remoteAddress,
port: socket.stream.remotePort
};
this.adaptor = adaptor;
var self = this;
socket.on('close', this.emit.bind(this, 'disconnect'));
socket.on('error', this.emit.bind(this, 'disconnect'));
socket.on('disconnect', this.emit.bind(this, 'disconnect'));
socket.on('pingreq', function(packet) {
socket.pingresp();
});
socket.on('subscribe', this.adaptor.onSubscribe.bind(this.adaptor, this));
socket.on('publish', this.adaptor.onPublish.bind(this.adaptor, this));
this.state = ST_INITED;
// TODO: any other events?
} | [
"function",
"(",
"id",
",",
"socket",
",",
"adaptor",
")",
"{",
"EventEmitter",
".",
"call",
"(",
"this",
")",
";",
"this",
".",
"id",
"=",
"id",
";",
"this",
".",
"socket",
"=",
"socket",
";",
"this",
".",
"remoteAddress",
"=",
"{",
"ip",
":",
"... | Socket class that wraps socket and websocket to provide unified interface for up level. | [
"Socket",
"class",
"that",
"wraps",
"socket",
"and",
"websocket",
"to",
"provide",
"unified",
"interface",
"for",
"up",
"level",
"."
] | defcf019631ed399cc4dad932d3b028a04a039a4 | https://github.com/NetEase/pomelo/blob/defcf019631ed399cc4dad932d3b028a04a039a4/lib/connectors/mqttsocket.js#L10-L37 | train | A Knockout connection | [
30522,
3853,
1006,
8909,
1010,
22278,
1010,
15581,
2953,
1007,
1063,
2724,
23238,
12079,
1012,
2655,
1006,
2023,
1007,
1025,
2023,
1012,
8909,
1027,
8909,
1025,
2023,
1012,
22278,
1027,
22278,
1025,
2023,
1012,
6556,
4215,
16200,
4757,
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... | |
apache/incubator-echarts | src/chart/boxplot/boxplotLayout.js | layoutSingleSeries | function layoutSingleSeries(seriesModel, offset, boxWidth) {
var coordSys = seriesModel.coordinateSystem;
var data = seriesModel.getData();
var halfWidth = boxWidth / 2;
var cDimIdx = seriesModel.get('layout') === 'horizontal' ? 0 : 1;
var vDimIdx = 1 - cDimIdx;
var coordDims = ['x', 'y'];
var cDim = data.mapDimension(coordDims[cDimIdx]);
var vDims = data.mapDimension(coordDims[vDimIdx], true);
if (cDim == null || vDims.length < 5) {
return;
}
for (var dataIndex = 0; dataIndex < data.count(); dataIndex++) {
var axisDimVal = data.get(cDim, dataIndex);
var median = getPoint(axisDimVal, vDims[2], dataIndex);
var end1 = getPoint(axisDimVal, vDims[0], dataIndex);
var end2 = getPoint(axisDimVal, vDims[1], dataIndex);
var end4 = getPoint(axisDimVal, vDims[3], dataIndex);
var end5 = getPoint(axisDimVal, vDims[4], dataIndex);
var ends = [];
addBodyEnd(ends, end2, 0);
addBodyEnd(ends, end4, 1);
ends.push(end1, end2, end5, end4);
layEndLine(ends, end1);
layEndLine(ends, end5);
layEndLine(ends, median);
data.setItemLayout(dataIndex, {
initBaseline: median[vDimIdx],
ends: ends
});
}
function getPoint(axisDimVal, dimIdx, dataIndex) {
var val = data.get(dimIdx, dataIndex);
var p = [];
p[cDimIdx] = axisDimVal;
p[vDimIdx] = val;
var point;
if (isNaN(axisDimVal) || isNaN(val)) {
point = [NaN, NaN];
}
else {
point = coordSys.dataToPoint(p);
point[cDimIdx] += offset;
}
return point;
}
function addBodyEnd(ends, point, start) {
var point1 = point.slice();
var point2 = point.slice();
point1[cDimIdx] += halfWidth;
point2[cDimIdx] -= halfWidth;
start
? ends.push(point1, point2)
: ends.push(point2, point1);
}
function layEndLine(ends, endCenter) {
var from = endCenter.slice();
var to = endCenter.slice();
from[cDimIdx] -= halfWidth;
to[cDimIdx] += halfWidth;
ends.push(from, to);
}
} | javascript | function layoutSingleSeries(seriesModel, offset, boxWidth) {
var coordSys = seriesModel.coordinateSystem;
var data = seriesModel.getData();
var halfWidth = boxWidth / 2;
var cDimIdx = seriesModel.get('layout') === 'horizontal' ? 0 : 1;
var vDimIdx = 1 - cDimIdx;
var coordDims = ['x', 'y'];
var cDim = data.mapDimension(coordDims[cDimIdx]);
var vDims = data.mapDimension(coordDims[vDimIdx], true);
if (cDim == null || vDims.length < 5) {
return;
}
for (var dataIndex = 0; dataIndex < data.count(); dataIndex++) {
var axisDimVal = data.get(cDim, dataIndex);
var median = getPoint(axisDimVal, vDims[2], dataIndex);
var end1 = getPoint(axisDimVal, vDims[0], dataIndex);
var end2 = getPoint(axisDimVal, vDims[1], dataIndex);
var end4 = getPoint(axisDimVal, vDims[3], dataIndex);
var end5 = getPoint(axisDimVal, vDims[4], dataIndex);
var ends = [];
addBodyEnd(ends, end2, 0);
addBodyEnd(ends, end4, 1);
ends.push(end1, end2, end5, end4);
layEndLine(ends, end1);
layEndLine(ends, end5);
layEndLine(ends, median);
data.setItemLayout(dataIndex, {
initBaseline: median[vDimIdx],
ends: ends
});
}
function getPoint(axisDimVal, dimIdx, dataIndex) {
var val = data.get(dimIdx, dataIndex);
var p = [];
p[cDimIdx] = axisDimVal;
p[vDimIdx] = val;
var point;
if (isNaN(axisDimVal) || isNaN(val)) {
point = [NaN, NaN];
}
else {
point = coordSys.dataToPoint(p);
point[cDimIdx] += offset;
}
return point;
}
function addBodyEnd(ends, point, start) {
var point1 = point.slice();
var point2 = point.slice();
point1[cDimIdx] += halfWidth;
point2[cDimIdx] -= halfWidth;
start
? ends.push(point1, point2)
: ends.push(point2, point1);
}
function layEndLine(ends, endCenter) {
var from = endCenter.slice();
var to = endCenter.slice();
from[cDimIdx] -= halfWidth;
to[cDimIdx] += halfWidth;
ends.push(from, to);
}
} | [
"function",
"layoutSingleSeries",
"(",
"seriesModel",
",",
"offset",
",",
"boxWidth",
")",
"{",
"var",
"coordSys",
"=",
"seriesModel",
".",
"coordinateSystem",
";",
"var",
"data",
"=",
"seriesModel",
".",
"getData",
"(",
")",
";",
"var",
"halfWidth",
"=",
"b... | Calculate points location for each series. | [
"Calculate",
"points",
"location",
"for",
"each",
"series",
"."
] | 4d0ea095dc3929cb6de40c45748826e7999c7aa8 | https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/chart/boxplot/boxplotLayout.js#L126-L197 | train | Layouts a single series | [
30522,
3853,
9621,
7741,
24527,
5134,
1006,
2186,
5302,
9247,
1010,
16396,
1010,
3482,
9148,
11927,
2232,
1007,
1063,
13075,
2522,
8551,
6508,
2015,
1027,
2186,
5302,
9247,
1012,
12093,
27268,
6633,
1025,
13075,
2951,
1027,
2186,
5302,
9247... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/prompts.js | askForSubnets | function askForSubnets() {
if (this.abort) return null;
const done = this.async();
const subnetList = _.map(this.awsFacts.availableSubnets, sn => {
const friendlyName = _getFriendlyNameFromTag(sn);
const formattedFriendlyName = friendlyName ? `name: '${friendlyName}', ` : '';
return {
name: `${sn.SubnetId} (${formattedFriendlyName}Availability Zone: ${sn.AvailabilityZone}, Public IP On Launch: ${
sn.MapPublicIpOnLaunch ? 'yes' : 'no'
})`,
value: sn.SubnetId,
short: sn.SubnetId
};
});
const defaultSubnetValue = storedSubnetValue =>
storedSubnetValue || [_.get(this.awsFacts.availableSubnets, '[0].SubnetId'), _.get(this.awsFacts.availableSubnets, '[1].SubnetId')];
const validateSubnet = input =>
_.isEmpty(input) || (_.isArray(input) && input.length < 2) ? 'You must select two or more subnets' : true;
const prompts = [
{
type: 'checkbox',
name: 'elbSubnets',
message: `Which subnets should we deploy the ${chalk.yellow('Network Load Balancer (ELB)')} to?`,
choices: subnetList,
default: defaultSubnetValue(this.aws.vpc.elbSubnets),
validate: validateSubnet
},
{
type: 'checkbox',
name: 'appSubnets',
message: `Which subnets should we deploy the ${chalk.yellow('Application & Database')} to?`,
choices: subnetList,
default: defaultSubnetValue(this.aws.vpc.appSubnets),
validate: validateSubnet
}
];
return this.prompt(prompts).then(props => {
const publicIpOnLaunchArray = appSubnets =>
_.chain(this.awsFacts.availableSubnets)
.filter(availableSubnet => _.includes(appSubnets, availableSubnet.SubnetId))
.map('MapPublicIpOnLaunch')
.uniq()
.value();
const uniqueIPLaunch = publicIpOnLaunchArray(props.appSubnets);
const shouldAppHavePublicIP = _.head(uniqueIPLaunch);
if (uniqueIPLaunch.length !== 1) {
this.log.ok(
`⚠️ Mix of Application Subnets containing contradictory 'MapPublic Ip On Launch' values. Defaulting to '${
shouldAppHavePublicIP ? 'yes' : 'no'
}'`
);
}
this.aws.vpc.elbSubnets = props.elbSubnets;
this.aws.vpc.appSubnets = props.appSubnets;
this.aws.vpc.appSubnetsLaunchWithPublicIP = shouldAppHavePublicIP;
done();
});
} | javascript | function askForSubnets() {
if (this.abort) return null;
const done = this.async();
const subnetList = _.map(this.awsFacts.availableSubnets, sn => {
const friendlyName = _getFriendlyNameFromTag(sn);
const formattedFriendlyName = friendlyName ? `name: '${friendlyName}', ` : '';
return {
name: `${sn.SubnetId} (${formattedFriendlyName}Availability Zone: ${sn.AvailabilityZone}, Public IP On Launch: ${
sn.MapPublicIpOnLaunch ? 'yes' : 'no'
})`,
value: sn.SubnetId,
short: sn.SubnetId
};
});
const defaultSubnetValue = storedSubnetValue =>
storedSubnetValue || [_.get(this.awsFacts.availableSubnets, '[0].SubnetId'), _.get(this.awsFacts.availableSubnets, '[1].SubnetId')];
const validateSubnet = input =>
_.isEmpty(input) || (_.isArray(input) && input.length < 2) ? 'You must select two or more subnets' : true;
const prompts = [
{
type: 'checkbox',
name: 'elbSubnets',
message: `Which subnets should we deploy the ${chalk.yellow('Network Load Balancer (ELB)')} to?`,
choices: subnetList,
default: defaultSubnetValue(this.aws.vpc.elbSubnets),
validate: validateSubnet
},
{
type: 'checkbox',
name: 'appSubnets',
message: `Which subnets should we deploy the ${chalk.yellow('Application & Database')} to?`,
choices: subnetList,
default: defaultSubnetValue(this.aws.vpc.appSubnets),
validate: validateSubnet
}
];
return this.prompt(prompts).then(props => {
const publicIpOnLaunchArray = appSubnets =>
_.chain(this.awsFacts.availableSubnets)
.filter(availableSubnet => _.includes(appSubnets, availableSubnet.SubnetId))
.map('MapPublicIpOnLaunch')
.uniq()
.value();
const uniqueIPLaunch = publicIpOnLaunchArray(props.appSubnets);
const shouldAppHavePublicIP = _.head(uniqueIPLaunch);
if (uniqueIPLaunch.length !== 1) {
this.log.ok(
`⚠️ Mix of Application Subnets containing contradictory 'MapPublic Ip On Launch' values. Defaulting to '${
shouldAppHavePublicIP ? 'yes' : 'no'
}'`
);
}
this.aws.vpc.elbSubnets = props.elbSubnets;
this.aws.vpc.appSubnets = props.appSubnets;
this.aws.vpc.appSubnetsLaunchWithPublicIP = shouldAppHavePublicIP;
done();
});
} | [
"function",
"askForSubnets",
"(",
")",
"{",
"if",
"(",
"this",
".",
"abort",
")",
"return",
"null",
";",
"const",
"done",
"=",
"this",
".",
"async",
"(",
")",
";",
"const",
"subnetList",
"=",
"_",
".",
"map",
"(",
"this",
".",
"awsFacts",
".",
"ava... | Ask user to select availability information (availability, zones)/ | [
"Ask",
"user",
"to",
"select",
"availability",
"information",
"(",
"availability",
"zones",
")",
"/"
] | f76fa8de0818ce6bda6c7b1455942e2a9b0ae3ff | https://github.com/jhipster/generator-jhipster/blob/f76fa8de0818ce6bda6c7b1455942e2a9b0ae3ff/generators/aws-containers/prompts.js#L386-L449 | train | Ask For Subnets | [
30522,
3853,
3198,
29278,
6342,
24700,
8454,
1006,
1007,
1063,
2065,
1006,
2023,
1012,
11113,
11589,
1007,
2709,
19701,
1025,
9530,
3367,
2589,
1027,
2023,
1012,
2004,
6038,
2278,
1006,
1007,
1025,
9530,
3367,
4942,
7159,
9863,
1027,
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... |
SeleniumHQ/selenium | third_party/js/mozmill/shared-modules/toolbars.js | locationBar_getElement | function locationBar_getElement(spec) {
var elem = null;
switch(spec.type) {
/**
* subtype: subtype to match
* value: value to match
*/
case "contextMenu":
elem = new elementslib.Lookup(this._controller.window.document, CONTEXT_MENU);
break;
case "contextMenu_entry":
elem = new elementslib.Lookup(this._controller.window.document, CONTEXT_MENU +
'/{"cmd":"cmd_' + spec.subtype + '"}');
break;
case "favicon":
elem = new elementslib.ID(this._controller.window.document, "page-proxy-favicon");
break;
case "feedButton":
elem = new elementslib.ID(this._controller.window.document, "feed-button");
break;
case "goButton":
elem = new elementslib.ID(this._controller.window.document, "urlbar-go-button");
break;
case "historyDropMarker":
elem = new elementslib.Lookup(this._controller.window.document,
URLBAR_CONTAINER + '/id("urlbar")/anon({"anonid":"historydropmarker"})');
break;
case "identityBox":
elem = new elementslib.ID(this._controller.window.document, "identity-box");
break;
case "notification_element":
elem = new elementslib.Lookup(this._controller.window.document, NOTIFICATION_POPUP +
spec.subtype);
break;
case "notification_popup":
elem = new elementslib.Lookup(this._controller.window.document, NOTIFICATION_POPUP);
break;
case "starButton":
elem = new elementslib.ID(this._controller.window.document, "star-button");
break;
case "urlbar":
elem = new elementslib.ID(this._controller.window.document, "urlbar");
break;
case "urlbar_input":
elem = new elementslib.Lookup(this._controller.window.document, URLBAR_INPUTBOX +
'/anon({"anonid":"input"})');
break;
default:
throw new Error(arguments.callee.name + ": Unknown element type - " + spec.type);
}
return elem;
} | javascript | function locationBar_getElement(spec) {
var elem = null;
switch(spec.type) {
/**
* subtype: subtype to match
* value: value to match
*/
case "contextMenu":
elem = new elementslib.Lookup(this._controller.window.document, CONTEXT_MENU);
break;
case "contextMenu_entry":
elem = new elementslib.Lookup(this._controller.window.document, CONTEXT_MENU +
'/{"cmd":"cmd_' + spec.subtype + '"}');
break;
case "favicon":
elem = new elementslib.ID(this._controller.window.document, "page-proxy-favicon");
break;
case "feedButton":
elem = new elementslib.ID(this._controller.window.document, "feed-button");
break;
case "goButton":
elem = new elementslib.ID(this._controller.window.document, "urlbar-go-button");
break;
case "historyDropMarker":
elem = new elementslib.Lookup(this._controller.window.document,
URLBAR_CONTAINER + '/id("urlbar")/anon({"anonid":"historydropmarker"})');
break;
case "identityBox":
elem = new elementslib.ID(this._controller.window.document, "identity-box");
break;
case "notification_element":
elem = new elementslib.Lookup(this._controller.window.document, NOTIFICATION_POPUP +
spec.subtype);
break;
case "notification_popup":
elem = new elementslib.Lookup(this._controller.window.document, NOTIFICATION_POPUP);
break;
case "starButton":
elem = new elementslib.ID(this._controller.window.document, "star-button");
break;
case "urlbar":
elem = new elementslib.ID(this._controller.window.document, "urlbar");
break;
case "urlbar_input":
elem = new elementslib.Lookup(this._controller.window.document, URLBAR_INPUTBOX +
'/anon({"anonid":"input"})');
break;
default:
throw new Error(arguments.callee.name + ": Unknown element type - " + spec.type);
}
return elem;
} | [
"function",
"locationBar_getElement",
"(",
"spec",
")",
"{",
"var",
"elem",
"=",
"null",
";",
"switch",
"(",
"spec",
".",
"type",
")",
"{",
"/**\n * subtype: subtype to match\n * value: value to match\n */",
"case",
"\"contextMenu\"",
":",
"elem",
"=",... | Retrieve an UI element based on the given spec
@param {object} spec
Information of the UI element which should be retrieved
type: General type information
subtype: Specific element or property
value: Value of the element or property
@returns Element which has been created
@type ElemBase | [
"Retrieve",
"an",
"UI",
"element",
"based",
"on",
"the",
"given",
"spec"
] | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/toolbars.js#L373-L426 | train | Returns the element that matches the spec | [
30522,
3853,
3295,
8237,
1035,
2131,
12260,
3672,
1006,
28699,
1007,
1063,
13075,
3449,
6633,
1027,
19701,
1025,
6942,
1006,
28699,
1012,
2828,
1007,
1063,
1013,
1008,
1008,
1008,
4942,
13874,
1024,
4942,
13874,
2000,
2674,
1008,
3643,
1024... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 | debug | function debug(oElement) {
if (bDebug) {
Log.debug(
getNestingLevel() + Array.prototype.slice.call(arguments, 1).join(" "),
oElement && serializeSingleElement(oElement), sXMLPreprocessor);
}
} | javascript | function debug(oElement) {
if (bDebug) {
Log.debug(
getNestingLevel() + Array.prototype.slice.call(arguments, 1).join(" "),
oElement && serializeSingleElement(oElement), sXMLPreprocessor);
}
} | [
"function",
"debug",
"(",
"oElement",
")",
"{",
"if",
"(",
"bDebug",
")",
"{",
"Log",
".",
"debug",
"(",
"getNestingLevel",
"(",
")",
"+",
"Array",
".",
"prototype",
".",
"slice",
".",
"call",
"(",
"arguments",
",",
"1",
")",
".",
"join",
"(",
"\" ... | /*
Outputs a debug message with the current nesting level; takes care not to construct
the message or serialize XML in vain.
@param {Element} [oElement]
any XML DOM element which is serialized to the details
@param {...string} aTexts
the main text of the message is constructed from the rest of the arguments by
joining them separated by single spaces | [
"/",
"*",
"Outputs",
"a",
"debug",
"message",
"with",
"the",
"current",
"nesting",
"level",
";",
"takes",
"care",
"not",
"to",
"construct",
"the",
"message",
"or",
"serialize",
"XML",
"in",
"vain",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/util/XMLPreprocessor.js#L935-L941 | train | Log debug information | [
30522,
3853,
2139,
8569,
2290,
1006,
1051,
12260,
3672,
1007,
1063,
2065,
1006,
1038,
3207,
8569,
2290,
1007,
1063,
8833,
1012,
2139,
8569,
2290,
1006,
2131,
5267,
3436,
20414,
2884,
1006,
1007,
1009,
9140,
1012,
8773,
1012,
14704,
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... |
tgriesser/knex | src/migrate/MigrationGenerator.js | yyyymmddhhmmss | function yyyymmddhhmmss() {
const d = new Date();
return (
d.getFullYear().toString() +
padDate(d.getMonth() + 1) +
padDate(d.getDate()) +
padDate(d.getHours()) +
padDate(d.getMinutes()) +
padDate(d.getSeconds())
);
} | javascript | function yyyymmddhhmmss() {
const d = new Date();
return (
d.getFullYear().toString() +
padDate(d.getMonth() + 1) +
padDate(d.getDate()) +
padDate(d.getHours()) +
padDate(d.getMinutes()) +
padDate(d.getSeconds())
);
} | [
"function",
"yyyymmddhhmmss",
"(",
")",
"{",
"const",
"d",
"=",
"new",
"Date",
"(",
")",
";",
"return",
"(",
"d",
".",
"getFullYear",
"(",
")",
".",
"toString",
"(",
")",
"+",
"padDate",
"(",
"d",
".",
"getMonth",
"(",
")",
"+",
"1",
")",
"+",
... | Get a date object in the correct format, without requiring a full out library like "moment.js". | [
"Get",
"a",
"date",
"object",
"in",
"the",
"correct",
"format",
"without",
"requiring",
"a",
"full",
"out",
"library",
"like",
"moment",
".",
"js",
"."
] | 6a4fecfe7822442ee5c43d924958eadfe6e17a93 | https://github.com/tgriesser/knex/blob/6a4fecfe7822442ee5c43d924958eadfe6e17a93/src/migrate/MigrationGenerator.js#L87-L97 | train | Returns the date string | [
30522,
3853,
1061,
2100,
2100,
24335,
26876,
16425,
14227,
5244,
2015,
1006,
1007,
1063,
9530,
3367,
1040,
1027,
2047,
3058,
1006,
1007,
1025,
2709,
1006,
1040,
1012,
2131,
7699,
14644,
1006,
1007,
1012,
2000,
3367,
4892,
1006,
1007,
1009,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
caolan/async | lib/race.js | race | function race(tasks, callback) {
callback = once(callback);
if (!Array.isArray(tasks)) return callback(new TypeError('First argument to race must be an array of functions'));
if (!tasks.length) return callback();
for (var i = 0, l = tasks.length; i < l; i++) {
wrapAsync(tasks[i])(callback);
}
} | javascript | function race(tasks, callback) {
callback = once(callback);
if (!Array.isArray(tasks)) return callback(new TypeError('First argument to race must be an array of functions'));
if (!tasks.length) return callback();
for (var i = 0, l = tasks.length; i < l; i++) {
wrapAsync(tasks[i])(callback);
}
} | [
"function",
"race",
"(",
"tasks",
",",
"callback",
")",
"{",
"callback",
"=",
"once",
"(",
"callback",
")",
";",
"if",
"(",
"!",
"Array",
".",
"isArray",
"(",
"tasks",
")",
")",
"return",
"callback",
"(",
"new",
"TypeError",
"(",
"'First argument to race... | Runs the `tasks` array of functions in parallel, without waiting until the
previous function has completed. Once any of the `tasks` complete or pass an
error to its callback, the main `callback` is immediately called. It's
equivalent to `Promise.race()`.
@name race
@static
@memberOf module:ControlFlow
@method
@category Control Flow
@param {Array} tasks - An array containing [async functions]{@link AsyncFunction}
to run. Each function can complete with an optional `result` value.
@param {Function} callback - A callback to run once any of the functions have
completed. This function gets an error or result from the first function that
completed. Invoked with (err, result).
@returns undefined
@example
async.race([
function(callback) {
setTimeout(function() {
callback(null, 'one');
}, 200);
},
function(callback) {
setTimeout(function() {
callback(null, 'two');
}, 100);
}
],
// main callback
function(err, result) {
// the result will be equal to 'two' as it finishes earlier
}); | [
"Runs",
"the",
"tasks",
"array",
"of",
"functions",
"in",
"parallel",
"without",
"waiting",
"until",
"the",
"previous",
"function",
"has",
"completed",
".",
"Once",
"any",
"of",
"the",
"tasks",
"complete",
"or",
"pass",
"an",
"error",
"to",
"its",
"callback"... | 4330d536c106592139fa82062494c9dba0da1fdb | https://github.com/caolan/async/blob/4330d536c106592139fa82062494c9dba0da1fdb/lib/race.js#L41-L48 | train | Race the tasks | [
30522,
3853,
2679,
1006,
8518,
1010,
2655,
5963,
1007,
1063,
2655,
5963,
1027,
2320,
1006,
2655,
5963,
1007,
1025,
2065,
1006,
999,
9140,
1012,
18061,
11335,
2100,
1006,
8518,
1007,
1007,
2709,
2655,
5963,
1006,
2047,
2828,
2121,
29165,
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... |
benweet/stackedit | src/libs/htmlSanitizer.js | htmlParser | function htmlParser(html, handler) {
if (typeof html !== 'string') {
if (html === null || typeof html === 'undefined') {
html = '';
} else {
html = '' + html;
}
}
var index, chars, match, stack = [],
last = html,
text;
stack.last = function () {
return stack[stack.length - 1];
};
while (html) {
text = '';
chars = true;
// Make sure we're not in a script or style element
if (!stack.last() || !specialElements[stack.last()]) {
// Comment
if (html.indexOf("<!--") === 0) {
// comments containing -- are not allowed unless they terminate the comment
index = html.indexOf("--", 4);
if (index >= 0 && html.lastIndexOf("-->", index) === index) {
if (handler.comment) handler.comment(html.substring(4, index));
html = html.substring(index + 3);
chars = false;
}
// DOCTYPE
} else if (DOCTYPE_REGEXP.test(html)) {
match = html.match(DOCTYPE_REGEXP);
if (match) {
html = html.replace(match[0], '');
chars = false;
}
// end tag
} else if (BEGING_END_TAGE_REGEXP.test(html)) {
match = html.match(END_TAG_REGEXP);
if (match) {
html = html.substring(match[0].length);
match[0].replace(END_TAG_REGEXP, parseEndTag);
chars = false;
}
// start tag
} else if (BEGIN_TAG_REGEXP.test(html)) {
match = html.match(START_TAG_REGEXP);
if (match) {
// We only have a valid start-tag if there is a '>'.
if (match[4]) {
html = html.substring(match[0].length);
match[0].replace(START_TAG_REGEXP, parseStartTag);
}
chars = false;
} else {
// no ending tag found --- this piece should be encoded as an entity.
text += '<';
html = html.substring(1);
}
}
if (chars) {
index = html.indexOf("<");
text += index < 0 ? html : html.substring(0, index);
html = index < 0 ? "" : html.substring(index);
if (handler.chars) handler.chars(decodeEntities(text));
}
} else {
// IE versions 9 and 10 do not understand the regex '[^]', so using a workaround with [\W\w].
html = html.replace(new RegExp("([\\W\\w]*)<\\s*\\/\\s*" + stack.last() + "[^>]*>", 'i'),
function (all, text) {
text = text.replace(COMMENT_REGEXP, "$1").replace(CDATA_REGEXP, "$1");
if (handler.chars) handler.chars(decodeEntities(text));
return "";
});
parseEndTag("", stack.last());
}
if (html == last) {
// benweet
// throw $sanitizeMinErr('badparse', "The sanitizer was unable to parse the following block " +
// "of html: {0}", html);
stack.reverse();
return stack.cl_each(function (tag) {
buf.push('</');
buf.push(tag);
buf.push('>');
});
}
last = html;
}
// Clean up any remaining tags
parseEndTag();
function parseStartTag(tag, tagName, rest, unary) {
tagName = tagName && tagName.toLowerCase();
if (blockElements[tagName]) {
while (stack.last() && inlineElements[stack.last()]) {
parseEndTag("", stack.last());
}
}
if (optionalEndTagElements[tagName] && stack.last() == tagName) {
parseEndTag("", tagName);
}
unary = voidElements[tagName] || !!unary;
if (!unary) {
stack.push(tagName);
}
var attrs = {};
rest.replace(ATTR_REGEXP,
function (match, name, doubleQuotedValue, singleQuotedValue, unquotedValue) {
var value = doubleQuotedValue || singleQuotedValue || unquotedValue || '';
attrs[name] = decodeEntities(value);
});
if (handler.start) handler.start(tagName, attrs, unary);
}
function parseEndTag(tag, tagName) {
var pos = 0,
i;
tagName = tagName && tagName.toLowerCase();
if (tagName) {
// Find the closest opened tag of the same type
for (pos = stack.length - 1; pos >= 0; pos--) {
if (stack[pos] == tagName) break;
}
}
if (pos >= 0) {
// Close all the open elements, up the stack
for (i = stack.length - 1; i >= pos; i--)
if (handler.end) handler.end(stack[i]);
// Remove the open elements from the stack
stack.length = pos;
}
}
} | javascript | function htmlParser(html, handler) {
if (typeof html !== 'string') {
if (html === null || typeof html === 'undefined') {
html = '';
} else {
html = '' + html;
}
}
var index, chars, match, stack = [],
last = html,
text;
stack.last = function () {
return stack[stack.length - 1];
};
while (html) {
text = '';
chars = true;
// Make sure we're not in a script or style element
if (!stack.last() || !specialElements[stack.last()]) {
// Comment
if (html.indexOf("<!--") === 0) {
// comments containing -- are not allowed unless they terminate the comment
index = html.indexOf("--", 4);
if (index >= 0 && html.lastIndexOf("-->", index) === index) {
if (handler.comment) handler.comment(html.substring(4, index));
html = html.substring(index + 3);
chars = false;
}
// DOCTYPE
} else if (DOCTYPE_REGEXP.test(html)) {
match = html.match(DOCTYPE_REGEXP);
if (match) {
html = html.replace(match[0], '');
chars = false;
}
// end tag
} else if (BEGING_END_TAGE_REGEXP.test(html)) {
match = html.match(END_TAG_REGEXP);
if (match) {
html = html.substring(match[0].length);
match[0].replace(END_TAG_REGEXP, parseEndTag);
chars = false;
}
// start tag
} else if (BEGIN_TAG_REGEXP.test(html)) {
match = html.match(START_TAG_REGEXP);
if (match) {
// We only have a valid start-tag if there is a '>'.
if (match[4]) {
html = html.substring(match[0].length);
match[0].replace(START_TAG_REGEXP, parseStartTag);
}
chars = false;
} else {
// no ending tag found --- this piece should be encoded as an entity.
text += '<';
html = html.substring(1);
}
}
if (chars) {
index = html.indexOf("<");
text += index < 0 ? html : html.substring(0, index);
html = index < 0 ? "" : html.substring(index);
if (handler.chars) handler.chars(decodeEntities(text));
}
} else {
// IE versions 9 and 10 do not understand the regex '[^]', so using a workaround with [\W\w].
html = html.replace(new RegExp("([\\W\\w]*)<\\s*\\/\\s*" + stack.last() + "[^>]*>", 'i'),
function (all, text) {
text = text.replace(COMMENT_REGEXP, "$1").replace(CDATA_REGEXP, "$1");
if (handler.chars) handler.chars(decodeEntities(text));
return "";
});
parseEndTag("", stack.last());
}
if (html == last) {
// benweet
// throw $sanitizeMinErr('badparse', "The sanitizer was unable to parse the following block " +
// "of html: {0}", html);
stack.reverse();
return stack.cl_each(function (tag) {
buf.push('</');
buf.push(tag);
buf.push('>');
});
}
last = html;
}
// Clean up any remaining tags
parseEndTag();
function parseStartTag(tag, tagName, rest, unary) {
tagName = tagName && tagName.toLowerCase();
if (blockElements[tagName]) {
while (stack.last() && inlineElements[stack.last()]) {
parseEndTag("", stack.last());
}
}
if (optionalEndTagElements[tagName] && stack.last() == tagName) {
parseEndTag("", tagName);
}
unary = voidElements[tagName] || !!unary;
if (!unary) {
stack.push(tagName);
}
var attrs = {};
rest.replace(ATTR_REGEXP,
function (match, name, doubleQuotedValue, singleQuotedValue, unquotedValue) {
var value = doubleQuotedValue || singleQuotedValue || unquotedValue || '';
attrs[name] = decodeEntities(value);
});
if (handler.start) handler.start(tagName, attrs, unary);
}
function parseEndTag(tag, tagName) {
var pos = 0,
i;
tagName = tagName && tagName.toLowerCase();
if (tagName) {
// Find the closest opened tag of the same type
for (pos = stack.length - 1; pos >= 0; pos--) {
if (stack[pos] == tagName) break;
}
}
if (pos >= 0) {
// Close all the open elements, up the stack
for (i = stack.length - 1; i >= pos; i--)
if (handler.end) handler.end(stack[i]);
// Remove the open elements from the stack
stack.length = pos;
}
}
} | [
"function",
"htmlParser",
"(",
"html",
",",
"handler",
")",
"{",
"if",
"(",
"typeof",
"html",
"!==",
"'string'",
")",
"{",
"if",
"(",
"html",
"===",
"null",
"||",
"typeof",
"html",
"===",
"'undefined'",
")",
"{",
"html",
"=",
"''",
";",
"}",
"else",
... | @example
htmlParser(htmlString, {
start: function(tag, attrs, unary) {},
end: function(tag) {},
chars: function(text) {},
comment: function(text) {}
});
@param {string} html string
@param {object} handler | [
"@example",
"htmlParser",
"(",
"htmlString",
"{",
"start",
":",
"function",
"(",
"tag",
"attrs",
"unary",
")",
"{}",
"end",
":",
"function",
"(",
"tag",
")",
"{}",
"chars",
":",
"function",
"(",
"text",
")",
"{}",
"comment",
":",
"function",
"(",
"text... | 91f8cf3c10b75df65b69f9181cee8151d65a788d | https://github.com/benweet/stackedit/blob/91f8cf3c10b75df65b69f9181cee8151d65a788d/src/libs/htmlSanitizer.js#L150-L307 | train | Parses the given HTML string. | [
30522,
3853,
16129,
19362,
8043,
1006,
16129,
1010,
28213,
1007,
1063,
2065,
1006,
2828,
11253,
16129,
999,
1027,
1027,
1005,
5164,
1005,
1007,
1063,
2065,
1006,
16129,
1027,
1027,
1027,
19701,
1064,
1064,
2828,
11253,
16129,
30524,
1033,
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... |
chartjs/Chart.js | src/core/core.tooltip.js | getBackgroundPoint | function getBackgroundPoint(vm, size, alignment, chart) {
// Background Position
var x = vm.x;
var y = vm.y;
var caretSize = vm.caretSize;
var caretPadding = vm.caretPadding;
var cornerRadius = vm.cornerRadius;
var xAlign = alignment.xAlign;
var yAlign = alignment.yAlign;
var paddingAndSize = caretSize + caretPadding;
var radiusAndPadding = cornerRadius + caretPadding;
if (xAlign === 'right') {
x -= size.width;
} else if (xAlign === 'center') {
x -= (size.width / 2);
if (x + size.width > chart.width) {
x = chart.width - size.width;
}
if (x < 0) {
x = 0;
}
}
if (yAlign === 'top') {
y += paddingAndSize;
} else if (yAlign === 'bottom') {
y -= size.height + paddingAndSize;
} else {
y -= (size.height / 2);
}
if (yAlign === 'center') {
if (xAlign === 'left') {
x += paddingAndSize;
} else if (xAlign === 'right') {
x -= paddingAndSize;
}
} else if (xAlign === 'left') {
x -= radiusAndPadding;
} else if (xAlign === 'right') {
x += radiusAndPadding;
}
return {
x: x,
y: y
};
} | javascript | function getBackgroundPoint(vm, size, alignment, chart) {
// Background Position
var x = vm.x;
var y = vm.y;
var caretSize = vm.caretSize;
var caretPadding = vm.caretPadding;
var cornerRadius = vm.cornerRadius;
var xAlign = alignment.xAlign;
var yAlign = alignment.yAlign;
var paddingAndSize = caretSize + caretPadding;
var radiusAndPadding = cornerRadius + caretPadding;
if (xAlign === 'right') {
x -= size.width;
} else if (xAlign === 'center') {
x -= (size.width / 2);
if (x + size.width > chart.width) {
x = chart.width - size.width;
}
if (x < 0) {
x = 0;
}
}
if (yAlign === 'top') {
y += paddingAndSize;
} else if (yAlign === 'bottom') {
y -= size.height + paddingAndSize;
} else {
y -= (size.height / 2);
}
if (yAlign === 'center') {
if (xAlign === 'left') {
x += paddingAndSize;
} else if (xAlign === 'right') {
x -= paddingAndSize;
}
} else if (xAlign === 'left') {
x -= radiusAndPadding;
} else if (xAlign === 'right') {
x += radiusAndPadding;
}
return {
x: x,
y: y
};
} | [
"function",
"getBackgroundPoint",
"(",
"vm",
",",
"size",
",",
"alignment",
",",
"chart",
")",
"{",
"// Background Position",
"var",
"x",
"=",
"vm",
".",
"x",
";",
"var",
"y",
"=",
"vm",
".",
"y",
";",
"var",
"caretSize",
"=",
"vm",
".",
"caretSize",
... | Helper to get the location a tooltip needs to be placed at given the initial position (via the vm) and the size and alignment | [
"Helper",
"to",
"get",
"the",
"location",
"a",
"tooltip",
"needs",
"to",
"be",
"placed",
"at",
"given",
"the",
"initial",
"position",
"(",
"via",
"the",
"vm",
")",
"and",
"the",
"size",
"and",
"alignment"
] | f093c36574d290330ed623e60fbd070421c730d5 | https://github.com/chartjs/Chart.js/blob/f093c36574d290330ed623e60fbd070421c730d5/src/core/core.tooltip.js#L427-L476 | train | Get background position | [
30522,
3853,
2131,
5963,
16365,
8400,
1006,
1058,
2213,
1010,
2946,
1010,
12139,
1010,
3673,
1007,
1063,
1013,
1013,
4281,
2597,
13075,
1060,
1027,
1058,
2213,
1012,
1060,
1025,
13075,
1061,
1027,
1058,
2213,
1012,
1061,
1025,
13075,
2729,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
juliangarnier/anime | lib/anime.js | steps | function steps(steps) {
if ( steps === void 0 ) steps = 10;
return function (t) { return Math.round(t * steps) * (1 / steps); };
} | javascript | function steps(steps) {
if ( steps === void 0 ) steps = 10;
return function (t) { return Math.round(t * steps) * (1 / steps); };
} | [
"function",
"steps",
"(",
"steps",
")",
"{",
"if",
"(",
"steps",
"===",
"void",
"0",
")",
"steps",
"=",
"10",
";",
"return",
"function",
"(",
"t",
")",
"{",
"return",
"Math",
".",
"round",
"(",
"t",
"*",
"steps",
")",
"*",
"(",
"1",
"/",
"steps... | Basic steps easing implementation https://developer.mozilla.org/fr/docs/Web/CSS/transition-timing-function | [
"Basic",
"steps",
"easing",
"implementation",
"https",
":",
"//",
"developer",
".",
"mozilla",
".",
"org",
"/",
"fr",
"/",
"docs",
"/",
"Web",
"/",
"CSS",
"/",
"transition",
"-",
"timing",
"-",
"function"
] | 875a3d6745d4bff2e4c6ffe0e2d24aac3bf8a45a | https://github.com/juliangarnier/anime/blob/875a3d6745d4bff2e4c6ffe0e2d24aac3bf8a45a/lib/anime.js#L148-L152 | train | Returns a function that will return a function that will return a number of steps | [
30522,
3853,
4084,
1006,
4084,
1007,
1063,
2065,
1006,
4084,
1027,
1027,
1027,
11675,
1014,
1007,
4084,
1027,
2184,
1025,
2709,
3853,
1006,
1056,
1007,
1063,
2709,
8785,
1012,
2461,
1006,
1056,
1008,
4084,
1007,
1008,
1006,
1015,
1013,
40... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
wuchangming/spy-debugger | buildin_modules/weinre/web/interfaces/interfaces.js | showInterfaceJavaScriptMethod | function showInterfaceJavaScriptMethod(intf, method, html) {
var line = ""
line += "\n//-----------------------------------------------------------------------------"
line += "\n<span class='methodName'>method " + method.name + "</span>(" + getJavaScriptParameterListSimple(method.parameters, method.returns) + ")"
line += "\n // callback: function(" + getJavaScriptCallbackParameterListSimple(method.callbackParameters) + ")"
line += "\n Weinre.notImplemented(arguments.callee.signature)"
line += "\n"
html.push(line)
} | javascript | function showInterfaceJavaScriptMethod(intf, method, html) {
var line = ""
line += "\n//-----------------------------------------------------------------------------"
line += "\n<span class='methodName'>method " + method.name + "</span>(" + getJavaScriptParameterListSimple(method.parameters, method.returns) + ")"
line += "\n // callback: function(" + getJavaScriptCallbackParameterListSimple(method.callbackParameters) + ")"
line += "\n Weinre.notImplemented(arguments.callee.signature)"
line += "\n"
html.push(line)
} | [
"function",
"showInterfaceJavaScriptMethod",
"(",
"intf",
",",
"method",
",",
"html",
")",
"{",
"var",
"line",
"=",
"\"\"",
"line",
"+=",
"\"\\n//-----------------------------------------------------------------------------\"",
"line",
"+=",
"\"\\n<span class='methodName'>metho... | ----------------------------------------------------------------------------- | [
"-----------------------------------------------------------------------------"
] | 55c1dda0dff0c44920673711656ddfd7ff03c307 | https://github.com/wuchangming/spy-debugger/blob/55c1dda0dff0c44920673711656ddfd7ff03c307/buildin_modules/weinre/web/interfaces/interfaces.js#L288-L297 | train | showInterfaceJavaScriptMethod - Show a method in the given interface | [
30522,
3853,
2265,
18447,
2121,
12172,
3900,
12044,
23235,
11368,
6806,
2094,
1006,
20014,
2546,
1010,
4118,
1010,
16129,
1007,
1063,
13075,
2240,
1027,
1000,
1000,
2240,
1009,
1027,
1000,
1032,
1050,
1013,
1013,
1011,
1011,
1011,
1011,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
wangfupeng1988/wangEditor | src/js/menus/panel.js | function () {
if (!_isCreatedPanelMenus.length) {
return
}
_isCreatedPanelMenus.forEach(menu => {
const panel = menu.panel || {}
if (panel.hide) {
panel.hide()
}
})
} | javascript | function () {
if (!_isCreatedPanelMenus.length) {
return
}
_isCreatedPanelMenus.forEach(menu => {
const panel = menu.panel || {}
if (panel.hide) {
panel.hide()
}
})
} | [
"function",
"(",
")",
"{",
"if",
"(",
"!",
"_isCreatedPanelMenus",
".",
"length",
")",
"{",
"return",
"}",
"_isCreatedPanelMenus",
".",
"forEach",
"(",
"menu",
"=>",
"{",
"const",
"panel",
"=",
"menu",
".",
"panel",
"||",
"{",
"}",
"if",
"(",
"panel",
... | 一个 panel 展示时,隐藏其他 panel | [
"一个",
"panel",
"展示时,隐藏其他",
"panel"
] | b77696f5e81c8ec13d9d341252d6b9fa8a22db18 | https://github.com/wangfupeng1988/wangEditor/blob/b77696f5e81c8ec13d9d341252d6b9fa8a22db18/src/js/menus/panel.js#L182-L192 | train | hide all the pages | [
30522,
3853,
1006,
1007,
1063,
2065,
1006,
999,
1035,
2003,
16748,
4383,
9739,
2884,
3549,
2271,
1012,
3091,
1007,
1063,
2709,
1065,
1035,
2003,
16748,
4383,
9739,
2884,
3549,
2271,
1012,
18921,
6776,
1006,
12183,
1027,
1028,
1063,
9530,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/v4/_AnnotationHelperExpression.js | function (oPathValue) {
var oRawValue = oPathValue.value,
oSubPathValue = oPathValue,
sType;
if (oRawValue === null) {
sType = "Null";
} else if (typeof oRawValue === "boolean") {
sType = "Bool";
} else if (typeof oRawValue === "number") {
sType = isFinite(oRawValue) && Math.floor(oRawValue) === oRawValue
? "Int32"
: "Float";
} else if (typeof oRawValue === "string") {
sType = "String";
} else {
Basics.expectType(oPathValue, "object");
["$And", "$Apply", "$Date", "$DateTimeOffset", "$Decimal", "$Float", "$Eq",
"$Ge", "$Gt", "$Guid", "$If", "$Int", "$Le", "$Lt", "$Ne", "$Not", "$Null",
"$Or", "$Path", "$PropertyPath", "$TimeOfDay"
].forEach(function (sProperty) {
if (oRawValue.hasOwnProperty(sProperty)) {
sType = sProperty.slice(1);
oSubPathValue = Basics.descend(oPathValue, sProperty);
}
});
}
switch (sType) {
case "Apply": // 14.5.3 Expression edm:Apply
return Expression.apply(oPathValue, oSubPathValue);
case "If": // 14.5.6 Expression edm:If
return Expression.conditional(oSubPathValue);
case "Path": // 14.5.12 Expression edm:Path
case "PropertyPath": // 14.5.13 Expression edm:PropertyPath
return Expression.path(oSubPathValue);
case "Date": // 14.4.3 Expression edm:Date
case "DateTimeOffset": // 14.4.4 Expression edm:DateTimeOffset
case "Decimal": // 14.4.5 Expression edm:Decimal
case "Guid": // 14.4.9 Expression edm:Guid
case "Int": // 14.4.10 Expression edm:Int
case "String": // 14.4.11 Expression edm:String
case "TimeOfDay": // 14.4.12 Expression edm:TimeOfDay
Basics.expectType(oSubPathValue, "string");
// fall through
case "Bool": // 14.4.2 Expression edm:Bool
case "Float": // 14.4.8 Expression edm:Float
case "Int32": // 14.4.10 Expression edm:Int
return SyncPromise.resolve(Expression.constant(oSubPathValue, sType));
case "And":
case "Eq":
case "Ge":
case "Gt":
case "Le":
case "Lt":
case "Ne":
case "Or":
// 14.5.1 Comparison and Logical Operators
return Expression.operator(oSubPathValue, sType);
case "Not": // 14.5.1 Comparison and Logical Operators
return Expression.not(oSubPathValue);
case "Null": // 14.5.10 Expression edm:Null
return SyncPromise.resolve({
result : "constant",
type : "edm:Null",
value : null
});
default:
return asyncError(oPathValue, "Unsupported OData expression");
}
} | javascript | function (oPathValue) {
var oRawValue = oPathValue.value,
oSubPathValue = oPathValue,
sType;
if (oRawValue === null) {
sType = "Null";
} else if (typeof oRawValue === "boolean") {
sType = "Bool";
} else if (typeof oRawValue === "number") {
sType = isFinite(oRawValue) && Math.floor(oRawValue) === oRawValue
? "Int32"
: "Float";
} else if (typeof oRawValue === "string") {
sType = "String";
} else {
Basics.expectType(oPathValue, "object");
["$And", "$Apply", "$Date", "$DateTimeOffset", "$Decimal", "$Float", "$Eq",
"$Ge", "$Gt", "$Guid", "$If", "$Int", "$Le", "$Lt", "$Ne", "$Not", "$Null",
"$Or", "$Path", "$PropertyPath", "$TimeOfDay"
].forEach(function (sProperty) {
if (oRawValue.hasOwnProperty(sProperty)) {
sType = sProperty.slice(1);
oSubPathValue = Basics.descend(oPathValue, sProperty);
}
});
}
switch (sType) {
case "Apply": // 14.5.3 Expression edm:Apply
return Expression.apply(oPathValue, oSubPathValue);
case "If": // 14.5.6 Expression edm:If
return Expression.conditional(oSubPathValue);
case "Path": // 14.5.12 Expression edm:Path
case "PropertyPath": // 14.5.13 Expression edm:PropertyPath
return Expression.path(oSubPathValue);
case "Date": // 14.4.3 Expression edm:Date
case "DateTimeOffset": // 14.4.4 Expression edm:DateTimeOffset
case "Decimal": // 14.4.5 Expression edm:Decimal
case "Guid": // 14.4.9 Expression edm:Guid
case "Int": // 14.4.10 Expression edm:Int
case "String": // 14.4.11 Expression edm:String
case "TimeOfDay": // 14.4.12 Expression edm:TimeOfDay
Basics.expectType(oSubPathValue, "string");
// fall through
case "Bool": // 14.4.2 Expression edm:Bool
case "Float": // 14.4.8 Expression edm:Float
case "Int32": // 14.4.10 Expression edm:Int
return SyncPromise.resolve(Expression.constant(oSubPathValue, sType));
case "And":
case "Eq":
case "Ge":
case "Gt":
case "Le":
case "Lt":
case "Ne":
case "Or":
// 14.5.1 Comparison and Logical Operators
return Expression.operator(oSubPathValue, sType);
case "Not": // 14.5.1 Comparison and Logical Operators
return Expression.not(oSubPathValue);
case "Null": // 14.5.10 Expression edm:Null
return SyncPromise.resolve({
result : "constant",
type : "edm:Null",
value : null
});
default:
return asyncError(oPathValue, "Unsupported OData expression");
}
} | [
"function",
"(",
"oPathValue",
")",
"{",
"var",
"oRawValue",
"=",
"oPathValue",
".",
"value",
",",
"oSubPathValue",
"=",
"oPathValue",
",",
"sType",
";",
"if",
"(",
"oRawValue",
"===",
"null",
")",
"{",
"sType",
"=",
"\"Null\"",
";",
"}",
"else",
"if",
... | Calculates an expression.
@param {object} oPathValue
path and value information pointing to the expression (see Expression object)
@returns {sap.ui.base.SyncPromise}
a sync promise which resolves with the result object or is rejected with an error | [
"Calculates",
"an",
"expression",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/_AnnotationHelperExpression.js#L336-L414 | train | Returns an object literal that represents the value of the node in the path. | [
30522,
3853,
1006,
6728,
8988,
10175,
5657,
1007,
1063,
13075,
2030,
10376,
10175,
5657,
1027,
6728,
8988,
10175,
5657,
1012,
3643,
1010,
9808,
12083,
15069,
10175,
5657,
1027,
6728,
8988,
10175,
5657,
1010,
2358,
18863,
1025,
2065,
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... | |
SeleniumHQ/selenium | javascript/node/selenium-webdriver/http/util.js | getStatus | function getStatus(url) {
var client = new HttpClient(url);
var executor = new Executor(client);
var command = new Command(CommandName.GET_SERVER_STATUS);
return executor.execute(command);
} | javascript | function getStatus(url) {
var client = new HttpClient(url);
var executor = new Executor(client);
var command = new Command(CommandName.GET_SERVER_STATUS);
return executor.execute(command);
} | [
"function",
"getStatus",
"(",
"url",
")",
"{",
"var",
"client",
"=",
"new",
"HttpClient",
"(",
"url",
")",
";",
"var",
"executor",
"=",
"new",
"Executor",
"(",
"client",
")",
";",
"var",
"command",
"=",
"new",
"Command",
"(",
"CommandName",
".",
"GET_S... | Queries a WebDriver server for its current status.
@param {string} url Base URL of the server to query.
@return {!Promise<!Object>} A promise that resolves with
a hash of the server status. | [
"Queries",
"a",
"WebDriver",
"server",
"for",
"its",
"current",
"status",
"."
] | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/node/selenium-webdriver/http/util.js#L39-L44 | train | Get server status | [
30522,
3853,
4152,
29336,
2271,
1006,
24471,
2140,
1007,
1063,
13075,
7396,
30524,
18442,
1012,
2131,
1035,
8241,
1035,
3570,
1007,
1025,
2709,
4654,
8586,
16161,
2099,
1012,
15389,
1006,
3094,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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-initializer.js | getLocalESLintVersion | function getLocalESLintVersion() {
try {
const eslintPath = relativeModuleResolver("eslint", path.join(process.cwd(), "__placeholder__.js"));
const eslint = require(eslintPath);
return eslint.linter.version || null;
} catch (_err) {
return null;
}
} | javascript | function getLocalESLintVersion() {
try {
const eslintPath = relativeModuleResolver("eslint", path.join(process.cwd(), "__placeholder__.js"));
const eslint = require(eslintPath);
return eslint.linter.version || null;
} catch (_err) {
return null;
}
} | [
"function",
"getLocalESLintVersion",
"(",
")",
"{",
"try",
"{",
"const",
"eslintPath",
"=",
"relativeModuleResolver",
"(",
"\"eslint\"",
",",
"path",
".",
"join",
"(",
"process",
".",
"cwd",
"(",
")",
",",
"\"__placeholder__.js\"",
")",
")",
";",
"const",
"e... | Get the version of the local ESLint.
@returns {string|null} The version. If the local ESLint was not found, returns null. | [
"Get",
"the",
"version",
"of",
"the",
"local",
"ESLint",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/config/config-initializer.js#L335-L344 | train | Get the local version of the eslint module | [
30522,
3853,
2131,
4135,
9289,
2229,
4115,
9189,
2545,
3258,
1006,
1007,
1063,
3046,
1063,
9530,
3367,
9686,
4115,
25856,
8988,
1027,
5816,
5302,
8566,
3917,
2229,
4747,
6299,
1006,
1000,
9686,
4115,
2102,
1000,
1010,
4130,
1012,
3693,
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... |
elastic/elasticsearch-js | api/api/tasks.list.js | buildTasksList | function buildTasksList (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
/**
* Perform a [tasks.list](http://www.elastic.co/guide/en/elasticsearch/reference/master/tasks.html) request
*
* @param {list} nodes - A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes
* @param {list} actions - A comma-separated list of actions that should be returned. Leave empty to return all.
* @param {boolean} detailed - Return detailed task information (default: false)
* @param {string} parent_task_id - Return tasks with specified parent task id (node_id:task_number). Set to -1 to return all.
* @param {boolean} wait_for_completion - Wait for the matching tasks to complete (default: false)
* @param {enum} group_by - Group tasks by nodes or parent/child relationships
* @param {time} timeout - Explicit operation timeout
*/
const acceptedQuerystring = [
'nodes',
'actions',
'detailed',
'parent_task_id',
'wait_for_completion',
'group_by',
'timeout',
'pretty',
'human',
'error_trace',
'source',
'filter_path'
]
const snakeCase = {
parentTaskId: 'parent_task_id',
waitForCompletion: 'wait_for_completion',
groupBy: 'group_by',
errorTrace: 'error_trace',
filterPath: 'filter_path'
}
return function tasksList (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)
}
// 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, ...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 = ''
path = '/' + '_tasks'
// build request object
const request = {
method,
path,
body: null,
querystring
}
options.warnings = warnings.length === 0 ? null : warnings
return makeRequest(request, options, callback)
}
} | javascript | function buildTasksList (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
/**
* Perform a [tasks.list](http://www.elastic.co/guide/en/elasticsearch/reference/master/tasks.html) request
*
* @param {list} nodes - A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes
* @param {list} actions - A comma-separated list of actions that should be returned. Leave empty to return all.
* @param {boolean} detailed - Return detailed task information (default: false)
* @param {string} parent_task_id - Return tasks with specified parent task id (node_id:task_number). Set to -1 to return all.
* @param {boolean} wait_for_completion - Wait for the matching tasks to complete (default: false)
* @param {enum} group_by - Group tasks by nodes or parent/child relationships
* @param {time} timeout - Explicit operation timeout
*/
const acceptedQuerystring = [
'nodes',
'actions',
'detailed',
'parent_task_id',
'wait_for_completion',
'group_by',
'timeout',
'pretty',
'human',
'error_trace',
'source',
'filter_path'
]
const snakeCase = {
parentTaskId: 'parent_task_id',
waitForCompletion: 'wait_for_completion',
groupBy: 'group_by',
errorTrace: 'error_trace',
filterPath: 'filter_path'
}
return function tasksList (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)
}
// 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, ...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 = ''
path = '/' + '_tasks'
// build request object
const request = {
method,
path,
body: null,
querystring
}
options.warnings = warnings.length === 0 ? null : warnings
return makeRequest(request, options, callback)
}
} | [
"function",
"buildTasksList",
"(",
"opts",
")",
"{",
"// eslint-disable-next-line no-unused-vars",
"const",
"{",
"makeRequest",
",",
"ConfigurationError",
",",
"handleError",
",",
"snakeCaseKeys",
"}",
"=",
"opts",
"/**\n * Perform a [tasks.list](http://www.elastic.co/guide/e... | /* 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/tasks.list.js#L25-L115 | train | Build a task list | [
30522,
3853,
3857,
10230,
5705,
9863,
1006,
23569,
2015,
1007,
1063,
1013,
1013,
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... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
hakimel/reveal.js | plugin/notes-server/client.js | post | function post() {
var slideElement = Reveal.getCurrentSlide(),
notesElement = slideElement.querySelector( 'aside.notes' );
var messageData = {
notes: '',
markdown: false,
socketId: socketId,
state: Reveal.getState()
};
// Look for notes defined in a slide attribute
if( slideElement.hasAttribute( 'data-notes' ) ) {
messageData.notes = slideElement.getAttribute( 'data-notes' );
}
// Look for notes defined in an aside element
if( notesElement ) {
messageData.notes = notesElement.innerHTML;
messageData.markdown = typeof notesElement.getAttribute( 'data-markdown' ) === 'string';
}
socket.emit( 'statechanged', messageData );
} | javascript | function post() {
var slideElement = Reveal.getCurrentSlide(),
notesElement = slideElement.querySelector( 'aside.notes' );
var messageData = {
notes: '',
markdown: false,
socketId: socketId,
state: Reveal.getState()
};
// Look for notes defined in a slide attribute
if( slideElement.hasAttribute( 'data-notes' ) ) {
messageData.notes = slideElement.getAttribute( 'data-notes' );
}
// Look for notes defined in an aside element
if( notesElement ) {
messageData.notes = notesElement.innerHTML;
messageData.markdown = typeof notesElement.getAttribute( 'data-markdown' ) === 'string';
}
socket.emit( 'statechanged', messageData );
} | [
"function",
"post",
"(",
")",
"{",
"var",
"slideElement",
"=",
"Reveal",
".",
"getCurrentSlide",
"(",
")",
",",
"notesElement",
"=",
"slideElement",
".",
"querySelector",
"(",
"'aside.notes'",
")",
";",
"var",
"messageData",
"=",
"{",
"notes",
":",
"''",
"... | Posts the current slide data to the notes window | [
"Posts",
"the",
"current",
"slide",
"data",
"to",
"the",
"notes",
"window"
] | 33bed47daca3f08c396215415e6ece005970734a | https://github.com/hakimel/reveal.js/blob/33bed47daca3f08c396215415e6ece005970734a/plugin/notes-server/client.js#L16-L41 | train | Post the notes to the server | [
30522,
3853,
2695,
1006,
1007,
1063,
13075,
7358,
12260,
3672,
1027,
30524,
4998,
1012,
3964,
1005,
1007,
1025,
13075,
4471,
2850,
2696,
1027,
1063,
3964,
1024,
1005,
1005,
1010,
2928,
7698,
1024,
6270,
1010,
22278,
3593,
1024,
22278,
3593,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/search/FindUtils.js | parseDollars | function parseDollars(replaceWith, match) {
replaceWith = replaceWith.replace(/(\$+)(\d{1,2}|&)/g, function (whole, dollars, index) {
if (dollars.length % 2 === 1) { // make sure dollar signs don't escape themselves (like $$1, $$$$&)
if (index === "&") { // handle $&
// slice the first dollar (but leave any others to get unescaped below) and return the
// whole match
return dollars.substr(1) + (match[0] || "");
} else {
// now we're sure index is an integer, so we can parse it
var parsedIndex = parseInt(index, 10);
if (parsedIndex !== 0) { // handle $n or $nn, but don't handle $0 or $00
// slice the first dollar (but leave any others to get unescaped below) and return the
// the corresponding match
return dollars.substr(1) + (match[parsedIndex] || "");
}
}
}
// this code gets called if the dollar signs escape themselves or if $0/$00 (not handled) was present
return whole; // return everything to get handled below
});
// replace escaped dollar signs (i.e. $$, $$$$, ...) with single ones (unescaping)
replaceWith = replaceWith.replace(/\$\$/g, "$");
return replaceWith;
} | javascript | function parseDollars(replaceWith, match) {
replaceWith = replaceWith.replace(/(\$+)(\d{1,2}|&)/g, function (whole, dollars, index) {
if (dollars.length % 2 === 1) { // make sure dollar signs don't escape themselves (like $$1, $$$$&)
if (index === "&") { // handle $&
// slice the first dollar (but leave any others to get unescaped below) and return the
// whole match
return dollars.substr(1) + (match[0] || "");
} else {
// now we're sure index is an integer, so we can parse it
var parsedIndex = parseInt(index, 10);
if (parsedIndex !== 0) { // handle $n or $nn, but don't handle $0 or $00
// slice the first dollar (but leave any others to get unescaped below) and return the
// the corresponding match
return dollars.substr(1) + (match[parsedIndex] || "");
}
}
}
// this code gets called if the dollar signs escape themselves or if $0/$00 (not handled) was present
return whole; // return everything to get handled below
});
// replace escaped dollar signs (i.e. $$, $$$$, ...) with single ones (unescaping)
replaceWith = replaceWith.replace(/\$\$/g, "$");
return replaceWith;
} | [
"function",
"parseDollars",
"(",
"replaceWith",
",",
"match",
")",
"{",
"replaceWith",
"=",
"replaceWith",
".",
"replace",
"(",
"/",
"(\\$+)(\\d{1,2}|&)",
"/",
"g",
",",
"function",
"(",
"whole",
",",
"dollars",
",",
"index",
")",
"{",
"if",
"(",
"dollars"... | Given a replace string that contains $-expressions, replace them with data from the given
regexp match info.
NOTE: we can't just use the ordinary replace() function here because the string has been
extracted from the original text and so might be missing some context that the regexp matched.
@param {string} replaceWith The string containing the $-expressions.
@param {Object} match The match data from the regexp.
@return {string} The replace text with the $-expressions substituted. | [
"Given",
"a",
"replace",
"string",
"that",
"contains",
"$",
"-",
"expressions",
"replace",
"them",
"with",
"data",
"from",
"the",
"given",
"regexp",
"match",
"info",
".",
"NOTE",
":",
"we",
"can",
"t",
"just",
"use",
"the",
"ordinary",
"replace",
"()",
"... | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/search/FindUtils.js#L80-L103 | train | parse the dollars | [
30522,
3853,
11968,
6924,
14511,
11650,
1006,
5672,
24415,
1010,
2674,
1007,
1063,
5672,
24415,
1027,
5672,
24415,
1012,
5672,
1006,
1013,
1006,
1032,
1002,
1009,
1007,
1006,
1032,
1040,
1063,
1015,
1010,
1016,
1065,
1064,
1004,
1007,
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... |
aws/aws-sdk-js | doc-src/templates/flasky_sphinx_guide/fulldoc/html/js/sphinx/doctools.js | function(string) {
var translated = Documentation.TRANSLATIONS[string];
if (typeof translated == 'undefined')
return string;
return (typeof translated == 'string') ? translated : translated[0];
} | javascript | function(string) {
var translated = Documentation.TRANSLATIONS[string];
if (typeof translated == 'undefined')
return string;
return (typeof translated == 'string') ? translated : translated[0];
} | [
"function",
"(",
"string",
")",
"{",
"var",
"translated",
"=",
"Documentation",
".",
"TRANSLATIONS",
"[",
"string",
"]",
";",
"if",
"(",
"typeof",
"translated",
"==",
"'undefined'",
")",
"return",
"string",
";",
"return",
"(",
"typeof",
"translated",
"==",
... | gettext and ngettext don't access this so that the functions can safely bound to a different name (_ = Documentation.gettext) | [
"gettext",
"and",
"ngettext",
"don",
"t",
"access",
"this",
"so",
"that",
"the",
"functions",
"can",
"safely",
"bound",
"to",
"a",
"different",
"name",
"(",
"_",
"=",
"Documentation",
".",
"gettext",
")"
] | c23e5f0edd150f8885267e5f7c8a564f8e6e8562 | https://github.com/aws/aws-sdk-js/blob/c23e5f0edd150f8885267e5f7c8a564f8e6e8562/doc-src/templates/flasky_sphinx_guide/fulldoc/html/js/sphinx/doctools.js#L126-L131 | train | Returns the first non - empty string in the sequence of words | [
30522,
3853,
1006,
5164,
1007,
1063,
13075,
5421,
1027,
12653,
1012,
11913,
1031,
5164,
1033,
1025,
2065,
1006,
2828,
11253,
5421,
1027,
1027,
1005,
6151,
28344,
1005,
1007,
2709,
5164,
1025,
2709,
1006,
2828,
11253,
5421,
1027,
1027,
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... | |
ColorlibHQ/AdminLTE | bower_components/ion.rangeSlider/js/ion.rangeSlider.js | function (right) {
var p = this.coords.p_pointer;
var p_step = (this.options.max - this.options.min) / 100;
p_step = this.options.step / p_step;
if (right) {
p += p_step;
} else {
p -= p_step;
}
this.coords.x_pointer = this.toFixed(this.coords.w_rs / 100 * p);
this.is_key = true;
this.calc();
} | javascript | function (right) {
var p = this.coords.p_pointer;
var p_step = (this.options.max - this.options.min) / 100;
p_step = this.options.step / p_step;
if (right) {
p += p_step;
} else {
p -= p_step;
}
this.coords.x_pointer = this.toFixed(this.coords.w_rs / 100 * p);
this.is_key = true;
this.calc();
} | [
"function",
"(",
"right",
")",
"{",
"var",
"p",
"=",
"this",
".",
"coords",
".",
"p_pointer",
";",
"var",
"p_step",
"=",
"(",
"this",
".",
"options",
".",
"max",
"-",
"this",
".",
"options",
".",
"min",
")",
"/",
"100",
";",
"p_step",
"=",
"this"... | Move by key
@param right {boolean} direction to move | [
"Move",
"by",
"key"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/bower_components/ion.rangeSlider/js/ion.rangeSlider.js#L921-L935 | train | set right | [
30522,
3853,
1006,
2157,
1007,
1063,
13075,
1052,
1027,
2023,
1012,
2522,
8551,
2015,
1012,
1052,
1035,
20884,
1025,
13075,
1052,
1035,
3357,
1027,
1006,
2023,
1012,
7047,
1012,
4098,
1011,
2023,
1012,
7047,
1012,
8117,
1007,
1013,
2531,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... | |
tgriesser/knex | src/query/joinclause.js | JoinClause | function JoinClause(table, type, schema) {
this.schema = schema;
this.table = table;
this.joinType = type;
this.and = this;
this.clauses = [];
} | javascript | function JoinClause(table, type, schema) {
this.schema = schema;
this.table = table;
this.joinType = type;
this.and = this;
this.clauses = [];
} | [
"function",
"JoinClause",
"(",
"table",
",",
"type",
",",
"schema",
")",
"{",
"this",
".",
"schema",
"=",
"schema",
";",
"this",
".",
"table",
"=",
"table",
";",
"this",
".",
"joinType",
"=",
"type",
";",
"this",
".",
"and",
"=",
"this",
";",
"this... | The "JoinClause" is an object holding any necessary info about a join, including the type, and any associated tables & columns being joined. | [
"The",
"JoinClause",
"is",
"an",
"object",
"holding",
"any",
"necessary",
"info",
"about",
"a",
"join",
"including",
"the",
"type",
"and",
"any",
"associated",
"tables",
"&",
"columns",
"being",
"joined",
"."
] | 6a4fecfe7822442ee5c43d924958eadfe6e17a93 | https://github.com/tgriesser/knex/blob/6a4fecfe7822442ee5c43d924958eadfe6e17a93/src/query/joinclause.js#L9-L15 | train | A join clause | [
30522,
3853,
3693,
20464,
20559,
2063,
1006,
2795,
1010,
2828,
1010,
8040,
28433,
1007,
1063,
2023,
1012,
8040,
28433,
1027,
8040,
28433,
1025,
2023,
1012,
2795,
1027,
2795,
1025,
2023,
1012,
4101,
18863,
1027,
2828,
1025,
2023,
1012,
1998,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 | _buildChain | function _buildChain(interceptors, options) {
var next = function(interceptors) {
if (interceptors.length === 0) {
return function (options) {};
}
var head_interceptor = interceptors[0];
var rest_interceptors = interceptors.slice(1);
return function (options) {
return head_interceptor(options, next(rest_interceptors));
};
};
var chain = next(interceptors)(options);
return new InterceptingCall(chain);
} | javascript | function _buildChain(interceptors, options) {
var next = function(interceptors) {
if (interceptors.length === 0) {
return function (options) {};
}
var head_interceptor = interceptors[0];
var rest_interceptors = interceptors.slice(1);
return function (options) {
return head_interceptor(options, next(rest_interceptors));
};
};
var chain = next(interceptors)(options);
return new InterceptingCall(chain);
} | [
"function",
"_buildChain",
"(",
"interceptors",
",",
"options",
")",
"{",
"var",
"next",
"=",
"function",
"(",
"interceptors",
")",
"{",
"if",
"(",
"interceptors",
".",
"length",
"===",
"0",
")",
"{",
"return",
"function",
"(",
"options",
")",
"{",
"}",
... | Chain a list of interceptors together and return the first InterceptingCall.
@private
@param {Interceptor[]} interceptors An interceptor stack.
@param {grpc.Client~CallOptions} options Call options.
@return {InterceptingCall} | [
"Chain",
"a",
"list",
"of",
"interceptors",
"together",
"and",
"return",
"the",
"first",
"InterceptingCall",
"."
] | b36b285f4cdb334bbd48f74c12c13bec69961488 | https://github.com/grpc/grpc-node/blob/b36b285f4cdb334bbd48f74c12c13bec69961488/packages/grpc-native-core/src/client_interceptors.js#L1389-L1402 | train | Build a chain of interceptors | [
30522,
3853,
1035,
3857,
24925,
2078,
1006,
24727,
2015,
1010,
7047,
1007,
1063,
13075,
2279,
1027,
3853,
1006,
24727,
2015,
1007,
1063,
2065,
1006,
24727,
2015,
1012,
3091,
1027,
1027,
1027,
1014,
1007,
1063,
2709,
3853,
1006,
7047,
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... |
jgraph/mxgraph | javascript/mxClient.js | function(element)
{
mxEvent.addListener(element, 'contextmenu', function(evt)
{
if (evt.preventDefault)
{
evt.preventDefault();
}
return false;
});
} | javascript | function(element)
{
mxEvent.addListener(element, 'contextmenu', function(evt)
{
if (evt.preventDefault)
{
evt.preventDefault();
}
return false;
});
} | [
"function",
"(",
"element",
")",
"{",
"mxEvent",
".",
"addListener",
"(",
"element",
",",
"'contextmenu'",
",",
"function",
"(",
"evt",
")",
"{",
"if",
"(",
"evt",
".",
"preventDefault",
")",
"{",
"evt",
".",
"preventDefault",
"(",
")",
";",
"}",
"retu... | Function: disableContextMenu
Disables the context menu for the given element. | [
"Function",
":",
"disableContextMenu"
] | 33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44 | https://github.com/jgraph/mxgraph/blob/33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44/javascript/mxClient.js#L9785-L9796 | train | Add a contextmenu listener to the element | [
30522,
3853,
1006,
5783,
1007,
1063,
25630,
18697,
3372,
1012,
5587,
9863,
24454,
1006,
5783,
1010,
1005,
6123,
3549,
2226,
1005,
1010,
3853,
1006,
23408,
2102,
1007,
30524,
1065,
2709,
6270,
1025,
1065,
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... | |
facebook/relay | packages/relay-compiler/util/areEqualOSS.js | areEqual | function areEqual(a: any, b: any): boolean {
const aStack = aStackPool.length ? aStackPool.pop() : [];
const bStack = bStackPool.length ? bStackPool.pop() : [];
const result = eq(a, b, aStack, bStack);
aStack.length = 0;
bStack.length = 0;
aStackPool.push(aStack);
bStackPool.push(bStack);
return result;
} | javascript | function areEqual(a: any, b: any): boolean {
const aStack = aStackPool.length ? aStackPool.pop() : [];
const bStack = bStackPool.length ? bStackPool.pop() : [];
const result = eq(a, b, aStack, bStack);
aStack.length = 0;
bStack.length = 0;
aStackPool.push(aStack);
bStackPool.push(bStack);
return result;
} | [
"function",
"areEqual",
"(",
"a",
":",
"any",
",",
"b",
":",
"any",
")",
":",
"boolean",
"{",
"const",
"aStack",
"=",
"aStackPool",
".",
"length",
"?",
"aStackPool",
".",
"pop",
"(",
")",
":",
"[",
"]",
";",
"const",
"bStack",
"=",
"bStackPool",
".... | Checks if two values are equal. Values may be primitives, arrays, or objects.
Returns true if both arguments have the same keys and values.
@see http://underscorejs.org
@copyright 2009-2013 Jeremy Ashkenas, DocumentCloud Inc.
@license MIT | [
"Checks",
"if",
"two",
"values",
"are",
"equal",
".",
"Values",
"may",
"be",
"primitives",
"arrays",
"or",
"objects",
".",
"Returns",
"true",
"if",
"both",
"arguments",
"have",
"the",
"same",
"keys",
"and",
"values",
"."
] | 7fb9be5182b9650637d7b92ead9a42713ac30aa4 | https://github.com/facebook/relay/blob/7fb9be5182b9650637d7b92ead9a42713ac30aa4/packages/relay-compiler/util/areEqualOSS.js#L23-L32 | train | A is equal to b | [
30522,
3853,
2024,
2063,
26426,
1006,
1037,
1024,
2151,
1010,
1038,
1024,
2151,
1007,
1024,
22017,
20898,
1063,
9530,
3367,
2004,
2696,
3600,
1027,
2004,
2696,
3600,
16869,
1012,
3091,
1029,
2004,
2696,
3600,
16869,
1012,
3769,
1006,
30524,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
google/closure-library | closure/goog/html/sanitizer/noclobber.js | genericMethodCall | function genericMethodCall(fn, object, fallbackMethodName, args) {
if (fn) {
return fn.apply(object, args);
}
// IE8 and IE9 will return 'object' for
// CSSStyleDeclaration.(get|set)Attribute, so we can't use typeof.
if (userAgentProduct.IE && document.documentMode < 10) {
if (!object[fallbackMethodName].call) {
throw new Error('IE Clobbering detected');
}
} else if (typeof object[fallbackMethodName] != 'function') {
throw new Error('Clobbering detected');
}
return object[fallbackMethodName].apply(object, args);
} | javascript | function genericMethodCall(fn, object, fallbackMethodName, args) {
if (fn) {
return fn.apply(object, args);
}
// IE8 and IE9 will return 'object' for
// CSSStyleDeclaration.(get|set)Attribute, so we can't use typeof.
if (userAgentProduct.IE && document.documentMode < 10) {
if (!object[fallbackMethodName].call) {
throw new Error('IE Clobbering detected');
}
} else if (typeof object[fallbackMethodName] != 'function') {
throw new Error('Clobbering detected');
}
return object[fallbackMethodName].apply(object, args);
} | [
"function",
"genericMethodCall",
"(",
"fn",
",",
"object",
",",
"fallbackMethodName",
",",
"args",
")",
"{",
"if",
"(",
"fn",
")",
"{",
"return",
"fn",
".",
"apply",
"(",
"object",
",",
"args",
")",
";",
"}",
"// IE8 and IE9 will return 'object' for",
"// CS... | Calls the provided DOM prototype method and returns its result. If the
method is not available, use fallbackMethodName to call the method in a
clobber-vulnerable way, and use fallbackTest to check if the
method was clobbered, throwing an exception if so.
@param {?Function} fn
@param {*} object
@param {string} fallbackMethodName
@param {!Array<*>} args
@return {?} | [
"Calls",
"the",
"provided",
"DOM",
"prototype",
"method",
"and",
"returns",
"its",
"result",
".",
"If",
"the",
"method",
"is",
"not",
"available",
"use",
"fallbackMethodName",
"to",
"call",
"the",
"method",
"in",
"a",
"clobber",
"-",
"vulnerable",
"way",
"an... | 97390e9ca4483cebb9628e06026139fbb3023d65 | https://github.com/google/closure-library/blob/97390e9ca4483cebb9628e06026139fbb3023d65/closure/goog/html/sanitizer/noclobber.js#L145-L159 | train | Generic method call | [
30522,
3853,
12391,
11368,
6806,
16409,
8095,
1006,
1042,
2078,
1010,
4874,
1010,
2991,
5963,
11368,
6806,
28911,
4168,
1010,
12098,
5620,
1007,
1063,
2065,
1006,
1042,
2078,
1007,
1063,
2709,
1042,
2078,
1012,
6611,
1006,
4874,
1010,
12098... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/delegate/ScrollEnablement.js | initDelegateMembers | function initDelegateMembers(oScrollerInstance) {
var oDelegateMembers = {
_init : function(oControl, sScrollContentDom, oConfig) {
// default scroll supression threshold of jQuery mobile is too small and prevent native scrolling
if (jQuery.event && jQuery.event.special && jQuery.event.special.swipe && jQuery.event.special.swipe.scrollSupressionThreshold < 120) {
jQuery.event.special.swipe.scrollSupressionThreshold = 120;
}
jQuery.extend(this, oNativeScrollDelegate);
if (oConfig.nonTouchScrolling === true) {
this._bDragScroll = true; // optional drag instead of native scrolling
}
if (sap.ui.getCore().getConfiguration().getRTL()) {
this._scrollX = 9999; // in RTL case initially scroll to the very right
if (Device.browser.msie || Device.browser.edge) {
this._bFlipX = true; // in IE and Edge RTL, scrollLeft goes opposite direction
}
}
},
_exit : function() {
if (this._cleanup) {
this._cleanup();
}
}
};
// Copy over members to prototype
jQuery.extend(oScrollerInstance, oDelegateMembers);
} | javascript | function initDelegateMembers(oScrollerInstance) {
var oDelegateMembers = {
_init : function(oControl, sScrollContentDom, oConfig) {
// default scroll supression threshold of jQuery mobile is too small and prevent native scrolling
if (jQuery.event && jQuery.event.special && jQuery.event.special.swipe && jQuery.event.special.swipe.scrollSupressionThreshold < 120) {
jQuery.event.special.swipe.scrollSupressionThreshold = 120;
}
jQuery.extend(this, oNativeScrollDelegate);
if (oConfig.nonTouchScrolling === true) {
this._bDragScroll = true; // optional drag instead of native scrolling
}
if (sap.ui.getCore().getConfiguration().getRTL()) {
this._scrollX = 9999; // in RTL case initially scroll to the very right
if (Device.browser.msie || Device.browser.edge) {
this._bFlipX = true; // in IE and Edge RTL, scrollLeft goes opposite direction
}
}
},
_exit : function() {
if (this._cleanup) {
this._cleanup();
}
}
};
// Copy over members to prototype
jQuery.extend(oScrollerInstance, oDelegateMembers);
} | [
"function",
"initDelegateMembers",
"(",
"oScrollerInstance",
")",
"{",
"var",
"oDelegateMembers",
"=",
"{",
"_init",
":",
"function",
"(",
"oControl",
",",
"sScrollContentDom",
",",
"oConfig",
")",
"{",
"// default scroll supression threshold of jQuery mobile is too small a... | /*
Init delegator prototype according to various conditions. | [
"/",
"*",
"Init",
"delegator",
"prototype",
"according",
"to",
"various",
"conditions",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/delegate/ScrollEnablement.js#L718-L746 | train | Initializes the delegate members | [
30522,
3853,
1999,
4183,
9247,
29107,
18532,
6633,
17198,
1006,
9808,
26775,
14511,
23282,
12693,
3401,
1007,
1063,
13075,
24040,
23115,
3686,
4168,
21784,
2015,
1027,
1063,
1035,
1999,
4183,
1024,
3853,
1006,
1051,
8663,
13181,
2140,
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/progressLinear/progress-linear.js | mode | function mode() {
var value = (attr.mdMode || "").trim();
if (value) {
switch (value) {
case MODE_DETERMINATE:
case MODE_INDETERMINATE:
case MODE_BUFFER:
case MODE_QUERY:
break;
default:
value = MODE_INDETERMINATE;
break;
}
}
return value;
} | javascript | function mode() {
var value = (attr.mdMode || "").trim();
if (value) {
switch (value) {
case MODE_DETERMINATE:
case MODE_INDETERMINATE:
case MODE_BUFFER:
case MODE_QUERY:
break;
default:
value = MODE_INDETERMINATE;
break;
}
}
return value;
} | [
"function",
"mode",
"(",
")",
"{",
"var",
"value",
"=",
"(",
"attr",
".",
"mdMode",
"||",
"\"\"",
")",
".",
"trim",
"(",
")",
";",
"if",
"(",
"value",
")",
"{",
"switch",
"(",
"value",
")",
"{",
"case",
"MODE_DETERMINATE",
":",
"case",
"MODE_INDETE... | Is the md-mode a valid option? | [
"Is",
"the",
"md",
"-",
"mode",
"a",
"valid",
"option?"
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/progressLinear/progress-linear.js#L160-L175 | train | Get the mode of the resource | [
30522,
3853,
5549,
1006,
1007,
1063,
13075,
3643,
1027,
1006,
2012,
16344,
1012,
9108,
5302,
3207,
1064,
1064,
1000,
1000,
1007,
1012,
12241,
1006,
1007,
1025,
2065,
1006,
3643,
1007,
1063,
6942,
1006,
3643,
1007,
1063,
2553,
5549,
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-dangle.js | getLastItem | function getLastItem(node) {
switch (node.type) {
case "ObjectExpression":
case "ObjectPattern":
return lodash.last(node.properties);
case "ArrayExpression":
case "ArrayPattern":
return lodash.last(node.elements);
case "ImportDeclaration":
case "ExportNamedDeclaration":
return lodash.last(node.specifiers);
case "FunctionDeclaration":
case "FunctionExpression":
case "ArrowFunctionExpression":
return lodash.last(node.params);
case "CallExpression":
case "NewExpression":
return lodash.last(node.arguments);
default:
return null;
}
} | javascript | function getLastItem(node) {
switch (node.type) {
case "ObjectExpression":
case "ObjectPattern":
return lodash.last(node.properties);
case "ArrayExpression":
case "ArrayPattern":
return lodash.last(node.elements);
case "ImportDeclaration":
case "ExportNamedDeclaration":
return lodash.last(node.specifiers);
case "FunctionDeclaration":
case "FunctionExpression":
case "ArrowFunctionExpression":
return lodash.last(node.params);
case "CallExpression":
case "NewExpression":
return lodash.last(node.arguments);
default:
return null;
}
} | [
"function",
"getLastItem",
"(",
"node",
")",
"{",
"switch",
"(",
"node",
".",
"type",
")",
"{",
"case",
"\"ObjectExpression\"",
":",
"case",
"\"ObjectPattern\"",
":",
"return",
"lodash",
".",
"last",
"(",
"node",
".",
"properties",
")",
";",
"case",
"\"Arr... | Gets the last item of the given node.
@param {ASTNode} node - The node to get.
@returns {ASTNode|null} The last node or null. | [
"Gets",
"the",
"last",
"item",
"of",
"the",
"given",
"node",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/comma-dangle.js#L148-L169 | train | Returns the last item in the tree | [
30522,
3853,
2131,
8523,
23096,
2213,
1006,
13045,
1007,
1063,
6942,
1006,
13045,
1012,
2828,
1007,
1063,
2553,
1000,
4874,
10288,
20110,
3258,
1000,
1024,
2553,
1000,
4874,
4502,
12079,
2078,
1000,
1024,
2709,
8840,
8883,
2232,
1012,
2197,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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.m/src/sap/m/Select.js | fnHandleKeyboardNavigation | function fnHandleKeyboardNavigation(oItem) {
if (oItem) {
this.setSelection(oItem);
this.setValue(oItem.getText());
this.scrollToItem(oItem);
}
} | javascript | function fnHandleKeyboardNavigation(oItem) {
if (oItem) {
this.setSelection(oItem);
this.setValue(oItem.getText());
this.scrollToItem(oItem);
}
} | [
"function",
"fnHandleKeyboardNavigation",
"(",
"oItem",
")",
"{",
"if",
"(",
"oItem",
")",
"{",
"this",
".",
"setSelection",
"(",
"oItem",
")",
";",
"this",
".",
"setValue",
"(",
"oItem",
".",
"getText",
"(",
")",
")",
";",
"this",
".",
"scrollToItem",
... | /* ----------------------------------------------------------- /* Private methods /* ----------------------------------------------------------- | [
"/",
"*",
"-----------------------------------------------------------",
"/",
"*",
"Private",
"methods",
"/",
"*",
"-----------------------------------------------------------"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/Select.js#L422-L428 | train | Handles the keyboard navigation of an item. | [
30522,
3853,
1042,
25311,
5685,
2571,
14839,
6277,
2532,
5737,
12540,
1006,
1051,
4221,
2213,
1007,
1063,
2065,
1006,
1051,
4221,
2213,
1007,
1063,
2023,
1012,
4520,
12260,
7542,
1006,
1051,
4221,
2213,
1007,
1025,
2023,
1012,
2275,
10175,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/util/ast-utils.js | isMethodWhichHasThisArg | function isMethodWhichHasThisArg(node) {
for (
let currentNode = node;
currentNode.type === "MemberExpression" && !currentNode.computed;
currentNode = currentNode.property
) {
if (currentNode.property.type === "Identifier") {
return arrayMethodPattern.test(currentNode.property.name);
}
}
return false;
} | javascript | function isMethodWhichHasThisArg(node) {
for (
let currentNode = node;
currentNode.type === "MemberExpression" && !currentNode.computed;
currentNode = currentNode.property
) {
if (currentNode.property.type === "Identifier") {
return arrayMethodPattern.test(currentNode.property.name);
}
}
return false;
} | [
"function",
"isMethodWhichHasThisArg",
"(",
"node",
")",
"{",
"for",
"(",
"let",
"currentNode",
"=",
"node",
";",
"currentNode",
".",
"type",
"===",
"\"MemberExpression\"",
"&&",
"!",
"currentNode",
".",
"computed",
";",
"currentNode",
"=",
"currentNode",
".",
... | Checks whether or not a node is a method which has `thisArg`.
@param {ASTNode} node - A node to check.
@returns {boolean} Whether or not the node is a method which has `thisArg`. | [
"Checks",
"whether",
"or",
"not",
"a",
"node",
"is",
"a",
"method",
"which",
"has",
"thisArg",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/util/ast-utils.js#L204-L216 | train | Check if the node has a this arg | [
30522,
3853,
2003,
11368,
6806,
2094,
2860,
16066,
23644,
14083,
24158,
2906,
2290,
1006,
13045,
1007,
1063,
2005,
1006,
2292,
2783,
30524,
2783,
3630,
3207,
1012,
3200,
1007,
1063,
2065,
1006,
2783,
3630,
3207,
1012,
3200,
1012,
2828,
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 | function() {
scope_Handles[handleNumber].style[options.style] = toPct(to);
updateConnect(handleNumber);
updateConnect(handleNumber + 1);
} | javascript | function() {
scope_Handles[handleNumber].style[options.style] = toPct(to);
updateConnect(handleNumber);
updateConnect(handleNumber + 1);
} | [
"function",
"(",
")",
"{",
"scope_Handles",
"[",
"handleNumber",
"]",
".",
"style",
"[",
"options",
".",
"style",
"]",
"=",
"toPct",
"(",
"to",
")",
";",
"updateConnect",
"(",
"handleNumber",
")",
";",
"updateConnect",
"(",
"handleNumber",
"+",
"1",
")",... | Called synchronously or on the next animationFrame | [
"Called",
"synchronously",
"or",
"on",
"the",
"next",
"animationFrame"
] | 1122efadad8f1433d404696f7613e3cc13fb83a4 | https://github.com/Dogfalo/materialize/blob/1122efadad8f1433d404696f7613e3cc13fb83a4/extras/noUiSlider/nouislider.js#L1788-L1792 | train | update style of handle | [
30522,
3853,
1006,
1007,
1063,
9531,
1035,
16024,
1031,
5047,
30524,
2638,
6593,
1006,
5047,
19172,
5677,
1009,
1015,
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,
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 | getFunctionName | function getFunctionName(aFunction) {
var regexpResult = aFunction.toString().match(/function (\w*)/);
if (regexpResult && regexpResult[1]) {
return regexpResult[1];
}
return 'anonymous';
} | javascript | function getFunctionName(aFunction) {
var regexpResult = aFunction.toString().match(/function (\w*)/);
if (regexpResult && regexpResult[1]) {
return regexpResult[1];
}
return 'anonymous';
} | [
"function",
"getFunctionName",
"(",
"aFunction",
")",
"{",
"var",
"regexpResult",
"=",
"aFunction",
".",
"toString",
"(",
")",
".",
"match",
"(",
"/",
"function (\\w*)",
"/",
")",
";",
"if",
"(",
"regexpResult",
"&&",
"regexpResult",
"[",
"1",
"]",
")",
... | Override the broken getFunctionName() method from JsUnit
This file must be loaded _after_ the jsunitCore.js | [
"Override",
"the",
"broken",
"getFunctionName",
"()",
"method",
"from",
"JsUnit",
"This",
"file",
"must",
"be",
"loaded",
"_after_",
"the",
"jsunitCore",
".",
"js"
] | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/selenium-core/scripts/htmlutils.js#L365-L371 | train | Get the name of a function | [
30522,
3853,
2131,
11263,
27989,
18442,
1006,
21358,
4609,
7542,
1007,
1063,
13075,
19723,
10288,
28994,
11314,
1027,
21358,
4609,
7542,
1012,
2000,
3367,
4892,
1006,
1007,
1012,
2674,
1006,
1013,
3853,
1006,
1032,
1059,
1008,
1007,
1013,
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... |
adobe/brackets | src/extensions/default/CodeFolding/foldhelpers/foldgutter.js | onViewportChange | function onViewportChange(cm) {
var state = cm.state.foldGutter;
window.clearTimeout(state.changeUpdate);
state.changeUpdate = window.setTimeout(function () {
var vp = cm.getViewport();
if (state.from === state.to || vp.from - state.to > 20 || state.from - vp.to > 20) {
updateInViewport(cm);
} else {
cm.operation(function () {
if (vp.from < state.from) {
updateFoldInfo(cm, vp.from, state.from);
state.from = vp.from;
}
if (vp.to > state.to) {
updateFoldInfo(cm, state.to, vp.to);
state.to = vp.to;
} else {
updateFoldInfo(cm, vp.from, vp.to);
state.to = vp.to;
state.from = vp.from;
}
});
}
}, 400);
} | javascript | function onViewportChange(cm) {
var state = cm.state.foldGutter;
window.clearTimeout(state.changeUpdate);
state.changeUpdate = window.setTimeout(function () {
var vp = cm.getViewport();
if (state.from === state.to || vp.from - state.to > 20 || state.from - vp.to > 20) {
updateInViewport(cm);
} else {
cm.operation(function () {
if (vp.from < state.from) {
updateFoldInfo(cm, vp.from, state.from);
state.from = vp.from;
}
if (vp.to > state.to) {
updateFoldInfo(cm, state.to, vp.to);
state.to = vp.to;
} else {
updateFoldInfo(cm, vp.from, vp.to);
state.to = vp.to;
state.from = vp.from;
}
});
}
}, 400);
} | [
"function",
"onViewportChange",
"(",
"cm",
")",
"{",
"var",
"state",
"=",
"cm",
".",
"state",
".",
"foldGutter",
";",
"window",
".",
"clearTimeout",
"(",
"state",
".",
"changeUpdate",
")",
";",
"state",
".",
"changeUpdate",
"=",
"window",
".",
"setTimeout"... | Triggered on viewport changes e.g., user scrolls or resizes the viewport.
@param {!CodeMirror} cm the CodeMirror instance for the active editor | [
"Triggered",
"on",
"viewport",
"changes",
"e",
".",
"g",
".",
"user",
"scrolls",
"or",
"resizes",
"the",
"viewport",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/CodeFolding/foldhelpers/foldgutter.js#L296-L320 | train | onViewportChange - Update fold gutter | [
30522,
3853,
2006,
8584,
6442,
22305,
2063,
1006,
4642,
1007,
1063,
13075,
2110,
1027,
4642,
1012,
2110,
1012,
10671,
27920,
3334,
1025,
3332,
1012,
3154,
7292,
5833,
1006,
2110,
1012,
2689,
6279,
13701,
1007,
1025,
2110,
1012,
2689,
6279,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
wangfupeng1988/wangEditor | src/js/menus/fontName/index.js | FontName | function FontName(editor) {
this.editor = editor
this.$elem = $('<div class="w-e-menu"><i class="w-e-icon-font"></i></div>')
this.type = 'droplist'
// 当前是否 active 状态
this._active = false
// 获取配置的字体
const config = editor.config
const fontNames = config.fontNames || []
// 初始化 droplist
this.droplist = new DropList(this, {
width: 100,
$title: $('<p>字体</p>'),
type: 'list', // droplist 以列表形式展示
list: fontNames.map(fontName => {
return { $elem: $(`<span style="font-family: ${fontName};">${fontName}</span>`), value: fontName }
}),
onClick: (value) => {
// 注意 this 是指向当前的 FontName 对象
this._command(value)
}
})
} | javascript | function FontName(editor) {
this.editor = editor
this.$elem = $('<div class="w-e-menu"><i class="w-e-icon-font"></i></div>')
this.type = 'droplist'
// 当前是否 active 状态
this._active = false
// 获取配置的字体
const config = editor.config
const fontNames = config.fontNames || []
// 初始化 droplist
this.droplist = new DropList(this, {
width: 100,
$title: $('<p>字体</p>'),
type: 'list', // droplist 以列表形式展示
list: fontNames.map(fontName => {
return { $elem: $(`<span style="font-family: ${fontName};">${fontName}</span>`), value: fontName }
}),
onClick: (value) => {
// 注意 this 是指向当前的 FontName 对象
this._command(value)
}
})
} | [
"function",
"FontName",
"(",
"editor",
")",
"{",
"this",
".",
"editor",
"=",
"editor",
"this",
".",
"$elem",
"=",
"$",
"(",
"'<div class=\"w-e-menu\"><i class=\"w-e-icon-font\"></i></div>'",
")",
"this",
".",
"type",
"=",
"'droplist'",
"// 当前是否 active 状态",
"this",
... | 构造函数 | [
"构造函数"
] | b77696f5e81c8ec13d9d341252d6b9fa8a22db18 | https://github.com/wangfupeng1988/wangEditor/blob/b77696f5e81c8ec13d9d341252d6b9fa8a22db18/src/js/menus/fontName/index.js#L9-L34 | train | FontName 字体前的字体前的字体前的字体前的字体前的字体前的字体前的字体前� | [
30522,
3853,
15489,
18442,
1006,
3559,
1007,
1063,
2023,
1012,
3559,
1027,
3559,
2023,
1012,
1002,
3449,
6633,
1027,
1002,
1006,
1005,
1026,
4487,
2615,
2465,
1027,
1000,
1059,
1011,
1041,
1011,
12183,
1000,
1028,
1026,
1045,
2465,
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... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/thirdparty/RequestRecorder.js | function(sUrl, aEntriesUrlFilter) {
if (this.bIsPaused) {
return true;
}
var that = this;
return aEntriesUrlFilter.every(function(regex) {
if (regex instanceof RegExp) {
return !regex.test(sUrl);
} else {
that.oLog.error(sModuleName + " - Invalid regular expression for filter.");
return true;
}
});
} | javascript | function(sUrl, aEntriesUrlFilter) {
if (this.bIsPaused) {
return true;
}
var that = this;
return aEntriesUrlFilter.every(function(regex) {
if (regex instanceof RegExp) {
return !regex.test(sUrl);
} else {
that.oLog.error(sModuleName + " - Invalid regular expression for filter.");
return true;
}
});
} | [
"function",
"(",
"sUrl",
",",
"aEntriesUrlFilter",
")",
"{",
"if",
"(",
"this",
".",
"bIsPaused",
")",
"{",
"return",
"true",
";",
"}",
"var",
"that",
"=",
"this",
";",
"return",
"aEntriesUrlFilter",
".",
"every",
"(",
"function",
"(",
"regex",
")",
"{... | Checks a URL against an array of regex if its filtered.
If the RequestRecorder is paused, the URL is filtered, too.
@param {string} sUrl URL to check.
@param {RegExp[]} aEntriesUrlFilter Array of regex filters.
@returns {boolean} If the URL is filterd true is returned. | [
"Checks",
"a",
"URL",
"against",
"an",
"array",
"of",
"regex",
"if",
"its",
"filtered",
".",
"If",
"the",
"RequestRecorder",
"is",
"paused",
"the",
"URL",
"is",
"filtered",
"too",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/RequestRecorder.js#L406-L419 | train | Checks if the given URL matches the filter | [
30522,
3853,
1006,
7505,
2140,
1010,
29347,
3372,
5134,
3126,
10270,
4014,
3334,
1007,
1063,
2065,
1006,
2023,
1012,
20377,
4502,
13901,
1007,
1063,
2709,
2995,
1025,
1065,
13075,
2008,
1027,
2023,
1025,
2709,
29347,
3372,
5134,
3126,
10270... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... | |
testing-library/dom-testing-library | src/query-helpers.js | getElementError | function getElementError(message, container) {
return new Error([message, debugDOM(container)].filter(Boolean).join('\n\n'))
} | javascript | function getElementError(message, container) {
return new Error([message, debugDOM(container)].filter(Boolean).join('\n\n'))
} | [
"function",
"getElementError",
"(",
"message",
",",
"container",
")",
"{",
"return",
"new",
"Error",
"(",
"[",
"message",
",",
"debugDOM",
"(",
"container",
")",
"]",
".",
"filter",
"(",
"Boolean",
")",
".",
"join",
"(",
"'\\n\\n'",
")",
")",
"}"
] | /* eslint-enable complexity | [
"/",
"*",
"eslint",
"-",
"enable",
"complexity"
] | fcb2cbcffb7aff6ecff3be8731168c86eee82ce1 | https://github.com/testing-library/dom-testing-library/blob/fcb2cbcffb7aff6ecff3be8731168c86eee82ce1/src/query-helpers.js#L30-L32 | train | Returns an error object for the given element | [
30522,
3853,
2131,
12260,
3672,
2121,
29165,
1006,
4471,
1010,
11661,
1007,
1063,
2709,
2047,
7561,
1006,
1031,
4471,
1010,
2139,
8569,
2290,
9527,
1006,
11661,
1007,
1033,
1012,
11307,
1006,
22017,
20898,
1007,
1012,
3693,
1006,
1005,
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... |
firebase/firebase-js-sdk | packages/auth/demo/public/script.js | logAtLevel_ | function logAtLevel_(message, level) {
if (message != null) {
var messageDiv = $('<div></div>');
messageDiv.addClass(level);
if (typeof message === 'object') {
messageDiv.text(JSON.stringify(message, null, ' '));
} else {
messageDiv.text(message);
}
$('.logs').append(messageDiv);
}
console[level](message);
} | javascript | function logAtLevel_(message, level) {
if (message != null) {
var messageDiv = $('<div></div>');
messageDiv.addClass(level);
if (typeof message === 'object') {
messageDiv.text(JSON.stringify(message, null, ' '));
} else {
messageDiv.text(message);
}
$('.logs').append(messageDiv);
}
console[level](message);
} | [
"function",
"logAtLevel_",
"(",
"message",
",",
"level",
")",
"{",
"if",
"(",
"message",
"!=",
"null",
")",
"{",
"var",
"messageDiv",
"=",
"$",
"(",
"'<div></div>'",
")",
";",
"messageDiv",
".",
"addClass",
"(",
"level",
")",
";",
"if",
"(",
"typeof",
... | Logs the message in the console and on the log window in the app
using the level given.
@param {?Object} message Object or message to log.
@param {string} level The level of log (log, error, debug).
@private | [
"Logs",
"the",
"message",
"in",
"the",
"console",
"and",
"on",
"the",
"log",
"window",
"in",
"the",
"app",
"using",
"the",
"level",
"given",
"."
] | 491598a499813dacc23724de5e237ec220cc560e | https://github.com/firebase/firebase-js-sdk/blob/491598a499813dacc23724de5e237ec220cc560e/packages/auth/demo/public/script.js#L56-L68 | train | Log at level | [
30522,
3853,
8833,
4017,
20414,
2884,
1035,
1006,
4471,
1010,
2504,
1007,
1063,
2065,
1006,
4471,
999,
1027,
19701,
1007,
1063,
13075,
4471,
4305,
2615,
1027,
1002,
1006,
1005,
1026,
4487,
2615,
1028,
1026,
1013,
4487,
2615,
1028,
1005,
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.layout/src/sap/ui/layout/Splitter.js | _sizeArraysDiffer | function _sizeArraysDiffer(aSizes1, aSizes2) {
if (aSizes1 === aSizes2) {
// The same thing. No difference.
return false;
}
if (!aSizes1 || !aSizes2 || aSizes1.length === undefined || aSizes2.length === undefined) {
// At lease one of the two is not an array
return true;
}
if (aSizes1.length != aSizes2.length) {
return true;
}
for (var i = 0; i < aSizes1.length; ++i) {
if (aSizes1[i] !== aSizes2[i]) {
return true;
}
}
return false;
} | javascript | function _sizeArraysDiffer(aSizes1, aSizes2) {
if (aSizes1 === aSizes2) {
// The same thing. No difference.
return false;
}
if (!aSizes1 || !aSizes2 || aSizes1.length === undefined || aSizes2.length === undefined) {
// At lease one of the two is not an array
return true;
}
if (aSizes1.length != aSizes2.length) {
return true;
}
for (var i = 0; i < aSizes1.length; ++i) {
if (aSizes1[i] !== aSizes2[i]) {
return true;
}
}
return false;
} | [
"function",
"_sizeArraysDiffer",
"(",
"aSizes1",
",",
"aSizes2",
")",
"{",
"if",
"(",
"aSizes1",
"===",
"aSizes2",
")",
"{",
"// The same thing. No difference.",
"return",
"false",
";",
"}",
"if",
"(",
"!",
"aSizes1",
"||",
"!",
"aSizes2",
"||",
"aSizes1",
"... | /////////////////////////////////////// Hidden Functions /////////////////////////////////////////
Compares two (simple, one-dimensional) arrays. If all values are the same, false is returned -
If values differ or at least one of the values is no array, true is returned.
@param {Number[]} [aSizes1] The array of numbers to compare against
@param {Number[]} [aSizes2] The array of numbers that is compared to the first one
@returns {boolean} True if the size-arrays differ, false otherwise
@private | [
"///////////////////////////////////////",
"Hidden",
"Functions",
"/////////////////////////////////////////",
"Compares",
"two",
"(",
"simple",
"one",
"-",
"dimensional",
")",
"arrays",
".",
"If",
"all",
"values",
"are",
"the",
"same",
"false",
"is",
"returned",
"-",
... | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.layout/src/sap/ui/layout/Splitter.js#L1047-L1069 | train | Returns true if the sizes of two arrays are different. | [
30522,
3853,
1035,
2946,
2906,
9447,
16150,
13355,
2121,
1006,
2004,
10057,
2487,
1010,
2004,
10057,
2475,
1007,
1063,
2065,
1006,
2004,
10057,
2487,
1027,
1027,
1027,
2004,
10057,
2475,
1007,
1063,
1013,
1013,
1996,
2168,
2518,
1012,
2053,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 | setCurrentDocument | function setCurrentDocument(doc) {
DeprecationWarning.deprecationWarning("Use CommandManager.execute(Commands.CMD_OPEN) instead of DocumentManager.setCurrentDocument()", true);
CommandManager.execute(Commands.CMD_OPEN, {fullPath: doc.file.fullPath});
} | javascript | function setCurrentDocument(doc) {
DeprecationWarning.deprecationWarning("Use CommandManager.execute(Commands.CMD_OPEN) instead of DocumentManager.setCurrentDocument()", true);
CommandManager.execute(Commands.CMD_OPEN, {fullPath: doc.file.fullPath});
} | [
"function",
"setCurrentDocument",
"(",
"doc",
")",
"{",
"DeprecationWarning",
".",
"deprecationWarning",
"(",
"\"Use CommandManager.execute(Commands.CMD_OPEN) instead of DocumentManager.setCurrentDocument()\"",
",",
"true",
")",
";",
"CommandManager",
".",
"execute",
"(",
"Comm... | opens the specified document for editing in the currently active pane
@deprecated use CommandManager.execute(Commands.CMD_OPEN, {fullPath: doc.file.fullPath}) instead
@param {!Document} document The Document to make current. | [
"opens",
"the",
"specified",
"document",
"for",
"editing",
"in",
"the",
"currently",
"active",
"pane"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/document/DocumentManager.js#L257-L260 | train | Sets the current document | [
30522,
3853,
2275,
10841,
14343,
3372,
3527,
24894,
4765,
1006,
9986,
1007,
1063,
2139,
28139,
10719,
9028,
5582,
1012,
2139,
28139,
10719,
9028,
5582,
1006,
1000,
2224,
3094,
24805,
4590,
1012,
15389,
1006,
10954,
1012,
4642,
2094,
1035,
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... |
dequelabs/axe-core | lib/commons/text/native-text-methods.js | descendantText | function descendantText(nodeName, { actualNode }, context) {
nodeName = nodeName.toLowerCase();
// Prevent accidently getting the nested element, like:
// fieldset > fielset > legend (1st fieldset has no legend)
const nodeNames = [nodeName, actualNode.nodeName.toLowerCase()].join(',');
const candidate = actualNode.querySelector(nodeNames);
if (!candidate || candidate.nodeName.toLowerCase() !== nodeName) {
return '';
}
return text.accessibleText(candidate, context);
} | javascript | function descendantText(nodeName, { actualNode }, context) {
nodeName = nodeName.toLowerCase();
// Prevent accidently getting the nested element, like:
// fieldset > fielset > legend (1st fieldset has no legend)
const nodeNames = [nodeName, actualNode.nodeName.toLowerCase()].join(',');
const candidate = actualNode.querySelector(nodeNames);
if (!candidate || candidate.nodeName.toLowerCase() !== nodeName) {
return '';
}
return text.accessibleText(candidate, context);
} | [
"function",
"descendantText",
"(",
"nodeName",
",",
"{",
"actualNode",
"}",
",",
"context",
")",
"{",
"nodeName",
"=",
"nodeName",
".",
"toLowerCase",
"(",
")",
";",
"// Prevent accidently getting the nested element, like:",
"// fieldset > fielset > legend (1st fieldset has... | Get the accessible text of first matching node
IMPORTANT: This method does not look at the composed tree
@private | [
"Get",
"the",
"accessible",
"text",
"of",
"first",
"matching",
"node",
"IMPORTANT",
":",
"This",
"method",
"does",
"not",
"look",
"at",
"the",
"composed",
"tree"
] | 727323c07980e2291575f545444d389fb942906f | https://github.com/dequelabs/axe-core/blob/727323c07980e2291575f545444d389fb942906f/lib/commons/text/native-text-methods.js#L111-L122 | train | Returns the text of a descendant node | [
30522,
3853,
12608,
18209,
1006,
13045,
18442,
1010,
1063,
5025,
3630,
3207,
1065,
1010,
6123,
1007,
1063,
13045,
18442,
1027,
13045,
18442,
1012,
2000,
27663,
18992,
3366,
1006,
1007,
1025,
1013,
1013,
4652,
4926,
2135,
2893,
1996,
9089,
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... |
TryGhost/Ghost | core/server/data/importer/index.js | function (importData, importOptions) {
importOptions = importOptions || {};
var ops = [];
_.each(this.importers, function (importer) {
if (importData.hasOwnProperty(importer.type)) {
ops.push(function () {
return importer.doImport(importData[importer.type], importOptions);
});
}
});
return sequence(ops).then(function (importResult) {
return importResult;
});
} | javascript | function (importData, importOptions) {
importOptions = importOptions || {};
var ops = [];
_.each(this.importers, function (importer) {
if (importData.hasOwnProperty(importer.type)) {
ops.push(function () {
return importer.doImport(importData[importer.type], importOptions);
});
}
});
return sequence(ops).then(function (importResult) {
return importResult;
});
} | [
"function",
"(",
"importData",
",",
"importOptions",
")",
"{",
"importOptions",
"=",
"importOptions",
"||",
"{",
"}",
";",
"var",
"ops",
"=",
"[",
"]",
";",
"_",
".",
"each",
"(",
"this",
".",
"importers",
",",
"function",
"(",
"importer",
")",
"{",
... | Import Step 3:
Each importer gets passed the data from importData which has the key matching its type - i.e. it only gets the
data that it should import. Each importer then handles actually importing that data into Ghost
@param {ImportData} importData
@param {importOptions} importOptions to allow override of certain import features such as locking a user
@returns {Promise(ImportData)} | [
"Import",
"Step",
"3",
":",
"Each",
"importer",
"gets",
"passed",
"the",
"data",
"from",
"importData",
"which",
"has",
"the",
"key",
"matching",
"its",
"type",
"-",
"i",
".",
"e",
".",
"it",
"only",
"gets",
"the",
"data",
"that",
"it",
"should",
"impor... | bb7bb55cf3e60af99ebbc56099928827b58461bc | https://github.com/TryGhost/Ghost/blob/bb7bb55cf3e60af99ebbc56099928827b58461bc/core/server/data/importer/index.js#L325-L339 | train | Import the given data into the database | [
30522,
3853,
1006,
12324,
2850,
2696,
1010,
12324,
7361,
9285,
1007,
1063,
12324,
7361,
9285,
1027,
12324,
7361,
9285,
1064,
1064,
1063,
1065,
1025,
13075,
23092,
1027,
1031,
1033,
1025,
1035,
1012,
2169,
1006,
2023,
1012,
12324,
2545,
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... | |
adobe/brackets | src/project/FileTreeViewModel.js | _setDirectoryOpen | function _setDirectoryOpen(treeData, path, open) {
var objectPath = _filePathToObjectPath(treeData, path),
directory = treeData.getIn(objectPath);
if (!objectPath) {
return {
needsLoading: true,
treeData: treeData
};
}
if (isFile(directory)) {
return;
}
var alreadyOpen = directory.get("open") === true;
if ((alreadyOpen && open) || (!alreadyOpen && !open)) {
return;
}
treeData = treeData.updateIn(objectPath, function (directory) {
if (open) {
return directory.set("open", true);
} else {
return directory.delete("open");
}
});
if (open && (directory.get("children") === null || directory.get("notFullyLoaded"))) {
return {
needsLoading: true,
treeData: treeData
};
}
return {
needsLoading: false,
treeData: treeData
};
} | javascript | function _setDirectoryOpen(treeData, path, open) {
var objectPath = _filePathToObjectPath(treeData, path),
directory = treeData.getIn(objectPath);
if (!objectPath) {
return {
needsLoading: true,
treeData: treeData
};
}
if (isFile(directory)) {
return;
}
var alreadyOpen = directory.get("open") === true;
if ((alreadyOpen && open) || (!alreadyOpen && !open)) {
return;
}
treeData = treeData.updateIn(objectPath, function (directory) {
if (open) {
return directory.set("open", true);
} else {
return directory.delete("open");
}
});
if (open && (directory.get("children") === null || directory.get("notFullyLoaded"))) {
return {
needsLoading: true,
treeData: treeData
};
}
return {
needsLoading: false,
treeData: treeData
};
} | [
"function",
"_setDirectoryOpen",
"(",
"treeData",
",",
"path",
",",
"open",
")",
"{",
"var",
"objectPath",
"=",
"_filePathToObjectPath",
"(",
"treeData",
",",
"path",
")",
",",
"directory",
"=",
"treeData",
".",
"getIn",
"(",
"objectPath",
")",
";",
"if",
... | @private
See `FileTreeViewModel.setDirectoryOpen` | [
"@private"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/project/FileTreeViewModel.js#L520-L559 | train | Set directory open | [
30522,
3853,
1035,
2275,
4305,
2890,
16761,
7677,
11837,
1006,
3392,
2850,
2696,
1010,
4130,
1010,
2330,
1007,
1063,
13075,
4874,
15069,
1027,
1035,
5371,
15069,
3406,
16429,
20614,
15069,
1006,
3392,
2850,
2696,
1010,
4130,
1007,
1010,
141... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/data/helper/sourceHelper.js | doGuessOrdinal | function doGuessOrdinal(
data, sourceFormat, seriesLayoutBy, dimensionsDefine, startIndex, dimIndex
) {
var result;
// Experience value.
var maxLoop = 5;
if (isTypedArray(data)) {
return false;
}
// When sourceType is 'objectRows' or 'keyedColumns', dimensionsDefine
// always exists in source.
var dimName;
if (dimensionsDefine) {
dimName = dimensionsDefine[dimIndex];
dimName = isObject(dimName) ? dimName.name : dimName;
}
if (sourceFormat === SOURCE_FORMAT_ARRAY_ROWS) {
if (seriesLayoutBy === SERIES_LAYOUT_BY_ROW) {
var sample = data[dimIndex];
for (var i = 0; i < (sample || []).length && i < maxLoop; i++) {
if ((result = detectValue(sample[startIndex + i])) != null) {
return result;
}
}
}
else {
for (var i = 0; i < data.length && i < maxLoop; i++) {
var row = data[startIndex + i];
if (row && (result = detectValue(row[dimIndex])) != null) {
return result;
}
}
}
}
else if (sourceFormat === SOURCE_FORMAT_OBJECT_ROWS) {
if (!dimName) {
return;
}
for (var i = 0; i < data.length && i < maxLoop; i++) {
var item = data[i];
if (item && (result = detectValue(item[dimName])) != null) {
return result;
}
}
}
else if (sourceFormat === SOURCE_FORMAT_KEYED_COLUMNS) {
if (!dimName) {
return;
}
var sample = data[dimName];
if (!sample || isTypedArray(sample)) {
return false;
}
for (var i = 0; i < sample.length && i < maxLoop; i++) {
if ((result = detectValue(sample[i])) != null) {
return result;
}
}
}
else if (sourceFormat === SOURCE_FORMAT_ORIGINAL) {
for (var i = 0; i < data.length && i < maxLoop; i++) {
var item = data[i];
var val = getDataItemValue(item);
if (!isArray(val)) {
return false;
}
if ((result = detectValue(val[dimIndex])) != null) {
return result;
}
}
}
function detectValue(val) {
// Consider usage convenience, '1', '2' will be treated as "number".
// `isFinit('')` get `true`.
if (val != null && isFinite(val) && val !== '') {
return false;
}
else if (isString(val) && val !== '-') {
return true;
}
}
return false;
} | javascript | function doGuessOrdinal(
data, sourceFormat, seriesLayoutBy, dimensionsDefine, startIndex, dimIndex
) {
var result;
// Experience value.
var maxLoop = 5;
if (isTypedArray(data)) {
return false;
}
// When sourceType is 'objectRows' or 'keyedColumns', dimensionsDefine
// always exists in source.
var dimName;
if (dimensionsDefine) {
dimName = dimensionsDefine[dimIndex];
dimName = isObject(dimName) ? dimName.name : dimName;
}
if (sourceFormat === SOURCE_FORMAT_ARRAY_ROWS) {
if (seriesLayoutBy === SERIES_LAYOUT_BY_ROW) {
var sample = data[dimIndex];
for (var i = 0; i < (sample || []).length && i < maxLoop; i++) {
if ((result = detectValue(sample[startIndex + i])) != null) {
return result;
}
}
}
else {
for (var i = 0; i < data.length && i < maxLoop; i++) {
var row = data[startIndex + i];
if (row && (result = detectValue(row[dimIndex])) != null) {
return result;
}
}
}
}
else if (sourceFormat === SOURCE_FORMAT_OBJECT_ROWS) {
if (!dimName) {
return;
}
for (var i = 0; i < data.length && i < maxLoop; i++) {
var item = data[i];
if (item && (result = detectValue(item[dimName])) != null) {
return result;
}
}
}
else if (sourceFormat === SOURCE_FORMAT_KEYED_COLUMNS) {
if (!dimName) {
return;
}
var sample = data[dimName];
if (!sample || isTypedArray(sample)) {
return false;
}
for (var i = 0; i < sample.length && i < maxLoop; i++) {
if ((result = detectValue(sample[i])) != null) {
return result;
}
}
}
else if (sourceFormat === SOURCE_FORMAT_ORIGINAL) {
for (var i = 0; i < data.length && i < maxLoop; i++) {
var item = data[i];
var val = getDataItemValue(item);
if (!isArray(val)) {
return false;
}
if ((result = detectValue(val[dimIndex])) != null) {
return result;
}
}
}
function detectValue(val) {
// Consider usage convenience, '1', '2' will be treated as "number".
// `isFinit('')` get `true`.
if (val != null && isFinite(val) && val !== '') {
return false;
}
else if (isString(val) && val !== '-') {
return true;
}
}
return false;
} | [
"function",
"doGuessOrdinal",
"(",
"data",
",",
"sourceFormat",
",",
"seriesLayoutBy",
",",
"dimensionsDefine",
",",
"startIndex",
",",
"dimIndex",
")",
"{",
"var",
"result",
";",
"// Experience value.",
"var",
"maxLoop",
"=",
"5",
";",
"if",
"(",
"isTypedArray"... | dimIndex may be overflow source data. | [
"dimIndex",
"may",
"be",
"overflow",
"source",
"data",
"."
] | 4d0ea095dc3929cb6de40c45748826e7999c7aa8 | https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/data/helper/sourceHelper.js#L500-L587 | train | Guess ordinal value from data | [
30522,
3853,
3899,
15808,
21748,
18979,
2140,
1006,
2951,
1010,
3120,
14192,
4017,
1010,
2186,
8485,
5833,
3762,
1010,
9646,
3207,
23460,
1010,
2707,
22254,
10288,
1010,
11737,
22254,
10288,
1007,
1063,
13075,
2765,
1025,
1013,
1013,
3325,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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-arrow-callback.js | getCallbackInfo | function getCallbackInfo(node) {
const retv = { isCallback: false, isLexicalThis: false };
let currentNode = node;
let parent = node.parent;
while (currentNode) {
switch (parent.type) {
// Checks parents recursively.
case "LogicalExpression":
case "ConditionalExpression":
break;
// Checks whether the parent node is `.bind(this)` call.
case "MemberExpression":
if (parent.object === currentNode &&
!parent.property.computed &&
parent.property.type === "Identifier" &&
parent.property.name === "bind" &&
parent.parent.type === "CallExpression" &&
parent.parent.callee === parent
) {
retv.isLexicalThis = (
parent.parent.arguments.length === 1 &&
parent.parent.arguments[0].type === "ThisExpression"
);
parent = parent.parent;
} else {
return retv;
}
break;
// Checks whether the node is a callback.
case "CallExpression":
case "NewExpression":
if (parent.callee !== currentNode) {
retv.isCallback = true;
}
return retv;
default:
return retv;
}
currentNode = parent;
parent = parent.parent;
}
/* istanbul ignore next */
throw new Error("unreachable");
} | javascript | function getCallbackInfo(node) {
const retv = { isCallback: false, isLexicalThis: false };
let currentNode = node;
let parent = node.parent;
while (currentNode) {
switch (parent.type) {
// Checks parents recursively.
case "LogicalExpression":
case "ConditionalExpression":
break;
// Checks whether the parent node is `.bind(this)` call.
case "MemberExpression":
if (parent.object === currentNode &&
!parent.property.computed &&
parent.property.type === "Identifier" &&
parent.property.name === "bind" &&
parent.parent.type === "CallExpression" &&
parent.parent.callee === parent
) {
retv.isLexicalThis = (
parent.parent.arguments.length === 1 &&
parent.parent.arguments[0].type === "ThisExpression"
);
parent = parent.parent;
} else {
return retv;
}
break;
// Checks whether the node is a callback.
case "CallExpression":
case "NewExpression":
if (parent.callee !== currentNode) {
retv.isCallback = true;
}
return retv;
default:
return retv;
}
currentNode = parent;
parent = parent.parent;
}
/* istanbul ignore next */
throw new Error("unreachable");
} | [
"function",
"getCallbackInfo",
"(",
"node",
")",
"{",
"const",
"retv",
"=",
"{",
"isCallback",
":",
"false",
",",
"isLexicalThis",
":",
"false",
"}",
";",
"let",
"currentNode",
"=",
"node",
";",
"let",
"parent",
"=",
"node",
".",
"parent",
";",
"while",
... | Checkes whether or not a given node is a callback.
@param {ASTNode} node - A node to check.
@returns {Object}
{boolean} retv.isCallback - `true` if the node is a callback.
{boolean} retv.isLexicalThis - `true` if the node is with `.bind(this)`. | [
"Checkes",
"whether",
"or",
"not",
"a",
"given",
"node",
"is",
"a",
"callback",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/prefer-arrow-callback.js#L65-L116 | train | Returns the callback info for a node | [
30522,
3853,
2131,
9289,
20850,
8684,
2378,
14876,
1006,
13045,
1007,
1063,
9530,
3367,
2128,
9189,
1027,
1063,
2003,
9289,
20850,
8684,
1024,
6270,
1010,
8842,
9048,
9289,
15222,
2015,
1024,
6270,
1065,
1025,
2292,
2783,
3630,
3207,
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... |
GitbookIO/gitbook | lib/cli/server.js | redirect | function redirect() {
var resultURL = urlTransform(req.url, function(parsed) {
parsed.pathname += '/';
return parsed;
});
res.statusCode = 301;
res.setHeader('Location', resultURL);
res.end('Redirecting to ' + resultURL);
} | javascript | function redirect() {
var resultURL = urlTransform(req.url, function(parsed) {
parsed.pathname += '/';
return parsed;
});
res.statusCode = 301;
res.setHeader('Location', resultURL);
res.end('Redirecting to ' + resultURL);
} | [
"function",
"redirect",
"(",
")",
"{",
"var",
"resultURL",
"=",
"urlTransform",
"(",
"req",
".",
"url",
",",
"function",
"(",
"parsed",
")",
"{",
"parsed",
".",
"pathname",
"+=",
"'/'",
";",
"return",
"parsed",
";",
"}",
")",
";",
"res",
".",
"status... | Redirect to directory's index.html | [
"Redirect",
"to",
"directory",
"s",
"index",
".",
"html"
] | 6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4 | https://github.com/GitbookIO/gitbook/blob/6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4/lib/cli/server.js#L73-L82 | train | Redirect to the next page | [
30522,
3853,
2417,
7442,
6593,
1006,
1007,
1063,
13075,
2765,
3126,
2140,
1027,
24471,
7096,
5521,
22747,
2953,
2213,
1006,
2128,
4160,
1012,
24471,
2140,
1010,
3853,
1006,
11968,
6924,
1007,
1063,
11968,
6924,
1012,
4130,
18442,
1009,
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... |
adobe/brackets | src/project/FileTreeView.js | function (e) {
e.stopPropagation();
if (e.button === RIGHT_MOUSE_BUTTON ||
(this.props.platform === "mac" && e.button === LEFT_MOUSE_BUTTON && e.ctrlKey)) {
this.props.actions.setContext(this.myPath());
e.preventDefault();
return;
}
// Return true only for mouse down in rename mode.
if (this.props.entry.get("rename")) {
return;
}
} | javascript | function (e) {
e.stopPropagation();
if (e.button === RIGHT_MOUSE_BUTTON ||
(this.props.platform === "mac" && e.button === LEFT_MOUSE_BUTTON && e.ctrlKey)) {
this.props.actions.setContext(this.myPath());
e.preventDefault();
return;
}
// Return true only for mouse down in rename mode.
if (this.props.entry.get("rename")) {
return;
}
} | [
"function",
"(",
"e",
")",
"{",
"e",
".",
"stopPropagation",
"(",
")",
";",
"if",
"(",
"e",
".",
"button",
"===",
"RIGHT_MOUSE_BUTTON",
"||",
"(",
"this",
".",
"props",
".",
"platform",
"===",
"\"mac\"",
"&&",
"e",
".",
"button",
"===",
"LEFT_MOUSE_BUT... | Send matching mouseDown events to the action creator as a setContext action. | [
"Send",
"matching",
"mouseDown",
"events",
"to",
"the",
"action",
"creator",
"as",
"a",
"setContext",
"action",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/project/FileTreeView.js#L368-L380 | train | on mouse down | [
30522,
3853,
1006,
1041,
1007,
1063,
1041,
1012,
2644,
21572,
4502,
12540,
1006,
1007,
1025,
2065,
1006,
1041,
1012,
6462,
1027,
1027,
1027,
2157,
1035,
8000,
1035,
6462,
1064,
1064,
1006,
2023,
1012,
24387,
1012,
4132,
1027,
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... | |
dcloudio/mui | examples/login/libs/easymob-webim-sdk/strophe-custom-2.0.0.js | function (elem, elemName, func)
{
var i, childNode;
for (i = 0; i < elem.childNodes.length; i++) {
childNode = elem.childNodes[i];
if (childNode.nodeType == Strophe.ElementType.NORMAL &&
(!elemName || this.isTagEqual(childNode, elemName))) {
func(childNode);
}
}
} | javascript | function (elem, elemName, func)
{
var i, childNode;
for (i = 0; i < elem.childNodes.length; i++) {
childNode = elem.childNodes[i];
if (childNode.nodeType == Strophe.ElementType.NORMAL &&
(!elemName || this.isTagEqual(childNode, elemName))) {
func(childNode);
}
}
} | [
"function",
"(",
"elem",
",",
"elemName",
",",
"func",
")",
"{",
"var",
"i",
",",
"childNode",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"elem",
".",
"childNodes",
".",
"length",
";",
"i",
"++",
")",
"{",
"childNode",
"=",
"elem",
".",
"ch... | Function: forEachChild
Map a function over some or all child elements of a given element.
This is a small convenience function for mapping a function over
some or all of the children of an element. If elemName is null, all
children will be passed to the function, otherwise only children
whose tag names match elemName will be passed.
Parameters:
(XMLElement) elem - The element to operate on.
(String) elemName - The child element tag name filter.
(Function) func - The function to apply to each child. This
function should take a single argument, a DOM element. | [
"Function",
":",
"forEachChild",
"Map",
"a",
"function",
"over",
"some",
"or",
"all",
"child",
"elements",
"of",
"a",
"given",
"element",
"."
] | ff74c90a1671a552f3604b1288bf38a4126312d0 | https://github.com/dcloudio/mui/blob/ff74c90a1671a552f3604b1288bf38a4126312d0/examples/login/libs/easymob-webim-sdk/strophe-custom-2.0.0.js#L871-L882 | train | Private function to call func for each node in the tree | [
30522,
3853,
1006,
3449,
6633,
1010,
3449,
6633,
18442,
1010,
4569,
2278,
1007,
1063,
13075,
1045,
1010,
2775,
3630,
3207,
1025,
2005,
1006,
1045,
1027,
1014,
1025,
1045,
1026,
3449,
6633,
1012,
2775,
3630,
6155,
1012,
3091,
1025,
1045,
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... | |
pagekit/vue-resource | dist/vue-resource.esm.js | Headers | function Headers(headers) {
var this$1 = this;
this.map = {};
each(headers, function (value, name) { return this$1.append(name, value); });
} | javascript | function Headers(headers) {
var this$1 = this;
this.map = {};
each(headers, function (value, name) { return this$1.append(name, value); });
} | [
"function",
"Headers",
"(",
"headers",
")",
"{",
"var",
"this$1",
"=",
"this",
";",
"this",
".",
"map",
"=",
"{",
"}",
";",
"each",
"(",
"headers",
",",
"function",
"(",
"value",
",",
"name",
")",
"{",
"return",
"this$1",
".",
"append",
"(",
"name"... | HTTP Headers. | [
"HTTP",
"Headers",
"."
] | fe268fa1d6053ede5f34aef9a11e1a424a70446c | https://github.com/pagekit/vue-resource/blob/fe268fa1d6053ede5f34aef9a11e1a424a70446c/dist/vue-resource.esm.js#L1187-L1194 | train | Headers object | [
30522,
3853,
20346,
2015,
1006,
20346,
2015,
1007,
1063,
13075,
2023,
1002,
1015,
1027,
2023,
1025,
2023,
1012,
4949,
1027,
1063,
1065,
1025,
2169,
1006,
20346,
2015,
1010,
3853,
1006,
3643,
1010,
2171,
1007,
1063,
2709,
2023,
1002,
1015,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/JSUtils/ScopeManager.js | initTernServer | function initTernServer(dir, files) {
initTernModule();
numResolvedFiles = 0;
numAddedFiles = 0;
stopAddingFiles = false;
numInitialFiles = files.length;
ternPromise.done(function (ternModule) {
var msg = {
type : MessageIds.TERN_INIT_MSG,
dir : dir,
files : files,
env : ternEnvironment,
timeout : PreferencesManager.get("jscodehints.inferenceTimeout")
};
_ternNodeDomain.exec("invokeTernCommand", msg);
});
rootTernDir = dir + "/";
} | javascript | function initTernServer(dir, files) {
initTernModule();
numResolvedFiles = 0;
numAddedFiles = 0;
stopAddingFiles = false;
numInitialFiles = files.length;
ternPromise.done(function (ternModule) {
var msg = {
type : MessageIds.TERN_INIT_MSG,
dir : dir,
files : files,
env : ternEnvironment,
timeout : PreferencesManager.get("jscodehints.inferenceTimeout")
};
_ternNodeDomain.exec("invokeTernCommand", msg);
});
rootTernDir = dir + "/";
} | [
"function",
"initTernServer",
"(",
"dir",
",",
"files",
")",
"{",
"initTernModule",
"(",
")",
";",
"numResolvedFiles",
"=",
"0",
";",
"numAddedFiles",
"=",
"0",
";",
"stopAddingFiles",
"=",
"false",
";",
"numInitialFiles",
"=",
"files",
".",
"length",
";",
... | Create a new tern server. | [
"Create",
"a",
"new",
"tern",
"server",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/JSUtils/ScopeManager.js#L1168-L1186 | train | initTernServer - init Tern server | [
30522,
3853,
1999,
27100,
6826,
8043,
6299,
1006,
16101,
1010,
6764,
1007,
1063,
1999,
27100,
6826,
5302,
8566,
2571,
1006,
1007,
1025,
16371,
2213,
6072,
16116,
8873,
4244,
1027,
1014,
1025,
16371,
25666,
5732,
8873,
4244,
1027,
1014,
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... |
ksky521/nodeppt | packages/nodeppt-parser/lib/markdown/attrs/index.js | get | function get(arr, n) {
return n >= 0 ? arr[n] : arr[arr.length + n];
} | javascript | function get(arr, n) {
return n >= 0 ? arr[n] : arr[arr.length + n];
} | [
"function",
"get",
"(",
"arr",
",",
"n",
")",
"{",
"return",
"n",
">=",
"0",
"?",
"arr",
"[",
"n",
"]",
":",
"arr",
"[",
"arr",
".",
"length",
"+",
"n",
"]",
";",
"}"
] | Get n item of array. Supports negative n, where -1 is last
element in array.
@param {array} arr
@param {number} n | [
"Get",
"n",
"item",
"of",
"array",
".",
"Supports",
"negative",
"n",
"where",
"-",
"1",
"is",
"last",
"element",
"in",
"array",
"."
] | ca77e29ef818c08b0522b31e3925b073cf159b9c | https://github.com/ksky521/nodeppt/blob/ca77e29ef818c08b0522b31e3925b073cf159b9c/packages/nodeppt-parser/lib/markdown/attrs/index.js#L158-L160 | train | Get the n - th item from an array of words | [
30522,
3853,
2131,
1006,
12098,
2099,
1010,
1050,
1007,
1063,
2709,
1050,
1028,
1027,
1014,
1029,
12098,
2099,
1031,
1050,
1033,
1024,
12098,
2099,
1031,
12098,
2099,
1012,
3091,
1009,
1050,
1033,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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/extensibility/node/package-validator.js | parsePersonString | function parsePersonString(obj) {
if (typeof (obj) === "string") {
var parts = _personRegex.exec(obj);
// No regex match, so we just synthesize an object with an opaque name string
if (!parts) {
return {
name: obj
};
} else {
var result = {
name: parts[1]
};
if (parts[2]) {
result.email = parts[2];
}
if (parts[3]) {
result.url = parts[3];
}
return result;
}
} else {
// obj is not a string, so return as is
return obj;
}
} | javascript | function parsePersonString(obj) {
if (typeof (obj) === "string") {
var parts = _personRegex.exec(obj);
// No regex match, so we just synthesize an object with an opaque name string
if (!parts) {
return {
name: obj
};
} else {
var result = {
name: parts[1]
};
if (parts[2]) {
result.email = parts[2];
}
if (parts[3]) {
result.url = parts[3];
}
return result;
}
} else {
// obj is not a string, so return as is
return obj;
}
} | [
"function",
"parsePersonString",
"(",
"obj",
")",
"{",
"if",
"(",
"typeof",
"(",
"obj",
")",
"===",
"\"string\"",
")",
"{",
"var",
"parts",
"=",
"_personRegex",
".",
"exec",
"(",
"obj",
")",
";",
"// No regex match, so we just synthesize an object with an opaque n... | Normalizes person fields from package.json.
These fields can be an object with name, email and url properties or a
string of the form "name <email> <url>". This does a tolerant parsing of
the data to try to return an object with name and optional email and url.
If the string does not match the format, the string is returned as the
name on the resulting object.
If an object other than a string is passed in, it's returned as is.
@param <String|Object> obj to normalize
@return {Object} person object with name and optional email and url | [
"Normalizes",
"person",
"fields",
"from",
"package",
".",
"json",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensibility/node/package-validator.js#L97-L122 | train | Parse a person string into an object with name email and url properties | [
30522,
3853,
11968,
3366,
27576,
3367,
4892,
1006,
27885,
3501,
1007,
1063,
2065,
1006,
2828,
11253,
1006,
27885,
3501,
1007,
1027,
1027,
1027,
1000,
5164,
1000,
1007,
1063,
13075,
3033,
1027,
1035,
2711,
2890,
3351,
2595,
1012,
4654,
8586,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/yoda.js | getNormalizedLiteral | function getNormalizedLiteral(node, defaultValue) {
if (node.type === "Literal") {
return node;
}
if (looksLikeLiteral(node)) {
return {
type: "Literal",
value: -node.argument.value,
raw: `-${node.argument.value}`
};
}
if (defaultValue) {
return {
type: "Literal",
value: defaultValue,
raw: String(defaultValue)
};
}
return null;
} | javascript | function getNormalizedLiteral(node, defaultValue) {
if (node.type === "Literal") {
return node;
}
if (looksLikeLiteral(node)) {
return {
type: "Literal",
value: -node.argument.value,
raw: `-${node.argument.value}`
};
}
if (defaultValue) {
return {
type: "Literal",
value: defaultValue,
raw: String(defaultValue)
};
}
return null;
} | [
"function",
"getNormalizedLiteral",
"(",
"node",
",",
"defaultValue",
")",
"{",
"if",
"(",
"node",
".",
"type",
"===",
"\"Literal\"",
")",
"{",
"return",
"node",
";",
"}",
"if",
"(",
"looksLikeLiteral",
"(",
"node",
")",
")",
"{",
"return",
"{",
"type",
... | Attempts to derive a Literal node from nodes that are treated like literals.
@param {ASTNode} node Node to normalize.
@param {number} [defaultValue] The default value to be returned if the node
is not a Literal.
@returns {ASTNode} One of the following options.
1. The original node if the node is already a Literal
2. A normalized Literal node with the negative number as the value if the
node represents a negative number literal.
3. The Literal node which has the `defaultValue` argument if it exists.
4. Otherwise `null`. | [
"Attempts",
"to",
"derive",
"a",
"Literal",
"node",
"from",
"nodes",
"that",
"are",
"treated",
"like",
"literals",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/yoda.js#L72-L94 | train | Get normalized literal | [
30522,
3853,
2131,
12131,
9067,
3550,
22779,
7941,
1006,
13045,
1010,
12398,
10175,
5657,
1007,
1063,
2065,
1006,
13045,
1012,
2828,
1027,
1027,
1027,
1000,
18204,
1000,
1007,
1063,
2709,
13045,
1025,
1065,
2065,
1006,
3504,
10359,
22779,
7... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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() {
var self = this;
var args = arguments;
var vol, id;
// Determine the values based on arguments.
if (args.length === 0) {
// Return the value of the groups' volume.
return self._volume;
} else if (args.length === 1 || args.length === 2 && typeof args[1] === 'undefined') {
// First check if this is an ID, and if not, assume it is a new volume.
var ids = self._getSoundIds();
var index = ids.indexOf(args[0]);
if (index >= 0) {
id = parseInt(args[0], 10);
} else {
vol = parseFloat(args[0]);
}
} else if (args.length >= 2) {
vol = parseFloat(args[0]);
id = parseInt(args[1], 10);
}
// Update the volume or return the current volume.
var sound;
if (typeof vol !== 'undefined' && vol >= 0 && vol <= 1) {
// If the sound hasn't loaded, add it to the load queue to change volume when capable.
if (self._state !== 'loaded'|| self._playLock) {
self._queue.push({
event: 'volume',
action: function() {
self.volume.apply(self, args);
}
});
return self;
}
// Set the group volume.
if (typeof id === 'undefined') {
self._volume = vol;
}
// Update one or all volumes.
id = self._getSoundIds(id);
for (var i=0; i<id.length; i++) {
// Get the sound.
sound = self._soundById(id[i]);
if (sound) {
sound._volume = vol;
// Stop currently running fades.
if (!args[2]) {
self._stopFade(id[i]);
}
if (self._webAudio && sound._node && !sound._muted) {
sound._node.gain.setValueAtTime(vol, Howler.ctx.currentTime);
} else if (sound._node && !sound._muted) {
sound._node.volume = vol * Howler.volume();
}
self._emit('volume', sound._id);
}
}
} else {
sound = id ? self._soundById(id) : self._sounds[0];
return sound ? sound._volume : 0;
}
return self;
} | javascript | function() {
var self = this;
var args = arguments;
var vol, id;
// Determine the values based on arguments.
if (args.length === 0) {
// Return the value of the groups' volume.
return self._volume;
} else if (args.length === 1 || args.length === 2 && typeof args[1] === 'undefined') {
// First check if this is an ID, and if not, assume it is a new volume.
var ids = self._getSoundIds();
var index = ids.indexOf(args[0]);
if (index >= 0) {
id = parseInt(args[0], 10);
} else {
vol = parseFloat(args[0]);
}
} else if (args.length >= 2) {
vol = parseFloat(args[0]);
id = parseInt(args[1], 10);
}
// Update the volume or return the current volume.
var sound;
if (typeof vol !== 'undefined' && vol >= 0 && vol <= 1) {
// If the sound hasn't loaded, add it to the load queue to change volume when capable.
if (self._state !== 'loaded'|| self._playLock) {
self._queue.push({
event: 'volume',
action: function() {
self.volume.apply(self, args);
}
});
return self;
}
// Set the group volume.
if (typeof id === 'undefined') {
self._volume = vol;
}
// Update one or all volumes.
id = self._getSoundIds(id);
for (var i=0; i<id.length; i++) {
// Get the sound.
sound = self._soundById(id[i]);
if (sound) {
sound._volume = vol;
// Stop currently running fades.
if (!args[2]) {
self._stopFade(id[i]);
}
if (self._webAudio && sound._node && !sound._muted) {
sound._node.gain.setValueAtTime(vol, Howler.ctx.currentTime);
} else if (sound._node && !sound._muted) {
sound._node.volume = vol * Howler.volume();
}
self._emit('volume', sound._id);
}
}
} else {
sound = id ? self._soundById(id) : self._sounds[0];
return sound ? sound._volume : 0;
}
return self;
} | [
"function",
"(",
")",
"{",
"var",
"self",
"=",
"this",
";",
"var",
"args",
"=",
"arguments",
";",
"var",
"vol",
",",
"id",
";",
"// Determine the values based on arguments.",
"if",
"(",
"args",
".",
"length",
"===",
"0",
")",
"{",
"// Return the value of the... | Get/set the volume of this sound or of the Howl group. This method can optionally take 0, 1 or 2 arguments.
volume() -> Returns the group's volume value.
volume(id) -> Returns the sound id's current volume.
volume(vol) -> Sets the volume of all sounds in this Howl group.
volume(vol, id) -> Sets the volume of passed sound id.
@return {Howl/Number} Returns self or current volume. | [
"Get",
"/",
"set",
"the",
"volume",
"of",
"this",
"sound",
"or",
"of",
"the",
"Howl",
"group",
".",
"This",
"method",
"can",
"optionally",
"take",
"0",
"1",
"or",
"2",
"arguments",
".",
"volume",
"()",
"-",
">",
"Returns",
"the",
"group",
"s",
"volum... | 030db918dd8ce640afd57e172418472497e8f113 | https://github.com/goldfire/howler.js/blob/030db918dd8ce640afd57e172418472497e8f113/dist/howler.js#L1179-L1251 | train | Update the volume of the group. | [
30522,
3853,
1006,
1007,
1063,
13075,
2969,
1027,
2023,
1025,
13075,
12098,
5620,
1027,
9918,
1025,
13075,
5285,
1010,
8909,
1025,
1013,
1013,
5646,
1996,
5300,
2241,
2006,
9918,
1012,
2065,
1006,
12098,
5620,
1012,
3091,
1027,
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... | |
adobe/brackets | src/features/ParameterHintsManager.js | popUpHint | function popUpHint(editor, explicit, onCursorActivity) {
var request = null;
var $deferredPopUp = $.Deferred();
var sessionProvider = null;
dismissHint(editor);
// Find a suitable provider, if any
var language = editor.getLanguageForSelection(),
enabledProviders = _providerRegistrationHandler.getProvidersForLanguageId(language.getId());
enabledProviders.some(function (item, index) {
if (item.provider.hasParameterHints(editor, lastChar)) {
sessionProvider = item.provider;
return true;
}
});
if (sessionProvider) {
request = sessionProvider.getParameterHints(explicit, onCursorActivity);
}
if (request) {
request.done(function (parameterHint) {
var cm = editor._codeMirror,
pos = parameterHint.functionCallPos || editor.getCursorPos();
pos = cm.charCoords(pos);
formatHint(parameterHint);
$hintContainer.show();
positionHint(pos.left, pos.top, pos.bottom);
hintState.visible = true;
sessionEditor = editor;
editor.on("cursorActivity.ParameterHinting", handleCursorActivity);
$deferredPopUp.resolveWith(null);
}).fail(function () {
hintState = {};
});
}
return $deferredPopUp;
} | javascript | function popUpHint(editor, explicit, onCursorActivity) {
var request = null;
var $deferredPopUp = $.Deferred();
var sessionProvider = null;
dismissHint(editor);
// Find a suitable provider, if any
var language = editor.getLanguageForSelection(),
enabledProviders = _providerRegistrationHandler.getProvidersForLanguageId(language.getId());
enabledProviders.some(function (item, index) {
if (item.provider.hasParameterHints(editor, lastChar)) {
sessionProvider = item.provider;
return true;
}
});
if (sessionProvider) {
request = sessionProvider.getParameterHints(explicit, onCursorActivity);
}
if (request) {
request.done(function (parameterHint) {
var cm = editor._codeMirror,
pos = parameterHint.functionCallPos || editor.getCursorPos();
pos = cm.charCoords(pos);
formatHint(parameterHint);
$hintContainer.show();
positionHint(pos.left, pos.top, pos.bottom);
hintState.visible = true;
sessionEditor = editor;
editor.on("cursorActivity.ParameterHinting", handleCursorActivity);
$deferredPopUp.resolveWith(null);
}).fail(function () {
hintState = {};
});
}
return $deferredPopUp;
} | [
"function",
"popUpHint",
"(",
"editor",
",",
"explicit",
",",
"onCursorActivity",
")",
"{",
"var",
"request",
"=",
"null",
";",
"var",
"$deferredPopUp",
"=",
"$",
".",
"Deferred",
"(",
")",
";",
"var",
"sessionProvider",
"=",
"null",
";",
"dismissHint",
"(... | Pop up a function hint on the line above the caret position.
@param {object=} editor - current Active Editor
@param {boolean} True if hints are invoked through cursor activity.
@return {jQuery.Promise} - The promise will not complete until the
hint has completed. Returns null, if the function hint is already
displayed or there is no function hint at the cursor. | [
"Pop",
"up",
"a",
"function",
"hint",
"on",
"the",
"line",
"above",
"the",
"caret",
"position",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/features/ParameterHintsManager.js#L256-L298 | train | Pop up a hint | [
30522,
3853,
3769,
6279,
10606,
2102,
1006,
3559,
1010,
13216,
1010,
2006,
10841,
25301,
22648,
29068,
3012,
1007,
1063,
13075,
5227,
1027,
19701,
1025,
13075,
1002,
13366,
28849,
18927,
7361,
6279,
1027,
1002,
1012,
13366,
28849,
2094,
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... |
NetEase/pomelo | lib/connectors/mqttconnector.js | function(port, host, opts) {
if (!(this instanceof Connector)) {
return new Connector(port, host, opts);
}
EventEmitter.call(this);
this.port = port;
this.host = host;
this.opts = opts || {};
this.adaptor = new Adaptor(this.opts);
} | javascript | function(port, host, opts) {
if (!(this instanceof Connector)) {
return new Connector(port, host, opts);
}
EventEmitter.call(this);
this.port = port;
this.host = host;
this.opts = opts || {};
this.adaptor = new Adaptor(this.opts);
} | [
"function",
"(",
"port",
",",
"host",
",",
"opts",
")",
"{",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"Connector",
")",
")",
"{",
"return",
"new",
"Connector",
"(",
"port",
",",
"host",
",",
"opts",
")",
";",
"}",
"EventEmitter",
".",
"call",
"("... | Connector that manager low level connection and protocol bewteen server and client.
Develper can provide their own connector to switch the low level prototol, such as tcp or probuf. | [
"Connector",
"that",
"manager",
"low",
"level",
"connection",
"and",
"protocol",
"bewteen",
"server",
"and",
"client",
".",
"Develper",
"can",
"provide",
"their",
"own",
"connector",
"to",
"switch",
"the",
"low",
"level",
"prototol",
"such",
"as",
"tcp",
"or",... | defcf019631ed399cc4dad932d3b028a04a039a4 | https://github.com/NetEase/pomelo/blob/defcf019631ed399cc4dad932d3b028a04a039a4/lib/connectors/mqttconnector.js#L15-L26 | train | Encapsulates a connection to the
server. | [
30522,
3853,
1006,
3417,
1010,
3677,
1010,
23569,
2015,
1007,
1063,
2065,
1006,
999,
1006,
2023,
6013,
11253,
19400,
1007,
1007,
1063,
2709,
2047,
19400,
1006,
3417,
1010,
3677,
1010,
23569,
2015,
1007,
1025,
1065,
2724,
23238,
12079,
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.core/src/sap/ui/model/odata/v4/lib/_Cache.js | Cache | function Cache(oRequestor, sResourcePath, mQueryOptions, bSortExpandSelect,
fnGetOriginalResourcePath) {
this.bActive = true;
this.mChangeListeners = {}; // map from path to an array of change listeners
this.fnGetOriginalResourcePath = fnGetOriginalResourcePath;
this.sMetaPath = _Helper.getMetaPath("/" + sResourcePath);
this.mPatchRequests = {}; // map from path to an array of (PATCH) promises
// a promise with attached properties $count, $resolve existing while deletes are pending
this.oPendingDeletePromise = null;
this.mPostRequests = {}; // map from path to an array of entity data (POST bodies)
this.oRequestor = oRequestor;
this.sResourcePath = sResourcePath;
this.bSortExpandSelect = bSortExpandSelect;
this.bSentReadRequest = false;
this.oTypePromise = undefined;
this.setQueryOptions(mQueryOptions);
} | javascript | function Cache(oRequestor, sResourcePath, mQueryOptions, bSortExpandSelect,
fnGetOriginalResourcePath) {
this.bActive = true;
this.mChangeListeners = {}; // map from path to an array of change listeners
this.fnGetOriginalResourcePath = fnGetOriginalResourcePath;
this.sMetaPath = _Helper.getMetaPath("/" + sResourcePath);
this.mPatchRequests = {}; // map from path to an array of (PATCH) promises
// a promise with attached properties $count, $resolve existing while deletes are pending
this.oPendingDeletePromise = null;
this.mPostRequests = {}; // map from path to an array of entity data (POST bodies)
this.oRequestor = oRequestor;
this.sResourcePath = sResourcePath;
this.bSortExpandSelect = bSortExpandSelect;
this.bSentReadRequest = false;
this.oTypePromise = undefined;
this.setQueryOptions(mQueryOptions);
} | [
"function",
"Cache",
"(",
"oRequestor",
",",
"sResourcePath",
",",
"mQueryOptions",
",",
"bSortExpandSelect",
",",
"fnGetOriginalResourcePath",
")",
"{",
"this",
".",
"bActive",
"=",
"true",
";",
"this",
".",
"mChangeListeners",
"=",
"{",
"}",
";",
"// map from ... | ********************************************************************************************* Cache *********************************************************************************************
Base class for the various caches.
@param {sap.ui.model.odata.v4.lib._Requestor} oRequestor
The requestor
@param {string} sResourcePath
A resource path relative to the service URL
@param {object} [mQueryOptions]
A map of key-value pairs representing the query string
@param {boolean} [bSortExpandSelect=false]
Whether the paths in $expand and $select shall be sorted in the cache's query string;
note that this flag can safely be ignored for all "new" features (after 1.47) which
should just sort always
@param {function} [fnGetOriginalResourcePath]
A function that returns the cache's original resource path to be used to build the target
path for bound messages; if it is not given or returns nothing, <code>sResourcePath</code>
is used instead. See {@link #getOriginalResourcePath}.
@private | [
"*********************************************************************************************",
"Cache",
"*********************************************************************************************",
"Base",
"class",
"for",
"the",
"various",
"caches",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Cache.js#L96-L112 | train | Creates a new cache instance. | [
30522,
3853,
17053,
1006,
10848,
15500,
2953,
1010,
5034,
2229,
8162,
3401,
15069,
1010,
1049,
4226,
2854,
7361,
9285,
1010,
18667,
11589,
10288,
9739,
5104,
12260,
6593,
1010,
1042,
15465,
29469,
24965,
6072,
8162,
3401,
15069,
1007,
1063,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/StringMatch.js | closeRangeGap | function closeRangeGap(c) {
// Close the current range
if (currentRange) {
currentRange.includesLastSegment = lastMatchIndex >= lastSegmentStart;
if (currentRange.matched && currentRange.includesLastSegment) {
if (DEBUG_SCORES) {
scoreDebug.lastSegment += lastSegmentScore * LAST_SEGMENT_BOOST;
}
score += lastSegmentScore * LAST_SEGMENT_BOOST;
}
if (currentRange.matched && !currentRangeStartedOnSpecial) {
if (DEBUG_SCORES) {
scoreDebug.notStartingOnSpecial -= NOT_STARTING_ON_SPECIAL_PENALTY;
}
score -= NOT_STARTING_ON_SPECIAL_PENALTY;
}
ranges.push(currentRange);
}
// If there was space between the new range and the last,
// add a new unmatched range before the new range can be added.
if (lastMatchIndex + 1 < c) {
ranges.push({
text: str.substring(lastMatchIndex + 1, c),
matched: false,
includesLastSegment: c > lastSegmentStart
});
}
currentRange = null;
lastSegmentScore = 0;
} | javascript | function closeRangeGap(c) {
// Close the current range
if (currentRange) {
currentRange.includesLastSegment = lastMatchIndex >= lastSegmentStart;
if (currentRange.matched && currentRange.includesLastSegment) {
if (DEBUG_SCORES) {
scoreDebug.lastSegment += lastSegmentScore * LAST_SEGMENT_BOOST;
}
score += lastSegmentScore * LAST_SEGMENT_BOOST;
}
if (currentRange.matched && !currentRangeStartedOnSpecial) {
if (DEBUG_SCORES) {
scoreDebug.notStartingOnSpecial -= NOT_STARTING_ON_SPECIAL_PENALTY;
}
score -= NOT_STARTING_ON_SPECIAL_PENALTY;
}
ranges.push(currentRange);
}
// If there was space between the new range and the last,
// add a new unmatched range before the new range can be added.
if (lastMatchIndex + 1 < c) {
ranges.push({
text: str.substring(lastMatchIndex + 1, c),
matched: false,
includesLastSegment: c > lastSegmentStart
});
}
currentRange = null;
lastSegmentScore = 0;
} | [
"function",
"closeRangeGap",
"(",
"c",
")",
"{",
"// Close the current range",
"if",
"(",
"currentRange",
")",
"{",
"currentRange",
".",
"includesLastSegment",
"=",
"lastMatchIndex",
">=",
"lastSegmentStart",
";",
"if",
"(",
"currentRange",
".",
"matched",
"&&",
"... | Records the current range and adds any additional ranges required to get to character index c. This function is called before starting a new range or returning from the function. | [
"Records",
"the",
"current",
"range",
"and",
"adds",
"any",
"additional",
"ranges",
"required",
"to",
"get",
"to",
"character",
"index",
"c",
".",
"This",
"function",
"is",
"called",
"before",
"starting",
"a",
"new",
"range",
"or",
"returning",
"from",
"the"... | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/utils/StringMatch.js#L534-L565 | train | Close the gap between the current range and the new range | [
30522,
3853,
3553,
22043,
3654,
2361,
1006,
1039,
1007,
1063,
1013,
1013,
2485,
1996,
2783,
2846,
2065,
1006,
2783,
24388,
2063,
1007,
1063,
2783,
24388,
2063,
1012,
2950,
8523,
3215,
13910,
3672,
1027,
2197,
18900,
17231,
3207,
2595,
1028,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/subscribers.js | exportSubscribers | function exportSubscribers() {
return models.Subscriber.findAll(options).then((data) => {
return formatCSV(data.toJSON(options));
}).catch((err) => {
return Promise.reject(new common.errors.GhostError({err: err}));
});
} | javascript | function exportSubscribers() {
return models.Subscriber.findAll(options).then((data) => {
return formatCSV(data.toJSON(options));
}).catch((err) => {
return Promise.reject(new common.errors.GhostError({err: err}));
});
} | [
"function",
"exportSubscribers",
"(",
")",
"{",
"return",
"models",
".",
"Subscriber",
".",
"findAll",
"(",
"options",
")",
".",
"then",
"(",
"(",
"data",
")",
"=>",
"{",
"return",
"formatCSV",
"(",
"data",
".",
"toJSON",
"(",
"options",
")",
")",
";",... | Export data, otherwise send error 500 | [
"Export",
"data",
"otherwise",
"send",
"error",
"500"
] | bb7bb55cf3e60af99ebbc56099928827b58461bc | https://github.com/TryGhost/Ghost/blob/bb7bb55cf3e60af99ebbc56099928827b58461bc/core/server/api/v0.1/subscribers.js#L285-L291 | train | export all the subscribers | [
30522,
3853,
14338,
12083,
29234,
2869,
1006,
1007,
1063,
2709,
4275,
1012,
4942,
29234,
2099,
1012,
2424,
8095,
1006,
7047,
1007,
1012,
2059,
1006,
1006,
2951,
1007,
1027,
1028,
1063,
2709,
4289,
6169,
2615,
1006,
2951,
1012,
2000,
22578,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/util/BindingsExtractor.js | collectBindingPaths | function collectBindingPaths(oElement, oModel){
var mBindingsCollection = {
bindingPaths: [],
bindingContextPaths: []
};
var sAggregationName = oElement.sParentAggregationName;
var oParent = oElement.getParent();
var aBindings = getBindings(oElement, oModel);
if (oParent) {
var oDefaultAggregation = oParent.getMetadata().getAggregation();
if (oDefaultAggregation) {
var iPositionOfInvisibleElement = ElementUtil.getAggregation(oParent, sAggregationName).indexOf(oElement);
var sParentDefaultAggregationName = oDefaultAggregation.name;
var oBinding = oParent.getBindingInfo(sParentDefaultAggregationName);
var oTemplate = oBinding && oBinding.template;
if (oTemplate) {
var oTemplateDefaultAggregation = oTemplate.getMetadata().getAggregation();
if (oTemplateDefaultAggregation) {
var sTemplateDefaultAggregationName = oTemplateDefaultAggregation.name;
var oTemplateElement = ElementUtil.getAggregation(oTemplate, sTemplateDefaultAggregationName)[iPositionOfInvisibleElement];
aBindings = aBindings.concat(getBindings(oTemplateElement, null, true));
}
}
}
}
for (var i = 0, l = aBindings.length; i < l; i++) {
if (aBindings[i].getPath) {
var sBindingPath = aBindings[i].getPath();
if (sBindingPath && mBindingsCollection.bindingPaths.indexOf(sBindingPath) === -1){
mBindingsCollection.bindingPaths.push(sBindingPath);
}
}
if (aBindings[i].getContext && aBindings[i].getContext() && aBindings[i].getContext().getPath) {
var sBindingContextPath = aBindings[i].getContext().getPath();
if (sBindingContextPath && mBindingsCollection.bindingContextPaths.indexOf(sBindingContextPath) === -1){
mBindingsCollection.bindingContextPaths.push(sBindingContextPath);
}
}
if (isPlainObject(aBindings[i])){
if (mBindingsCollection.bindingPaths.indexOf(aBindings[i].parts[0].path) === -1){
mBindingsCollection.bindingPaths.push(aBindings[i].parts[0].path);
}
}
}
return mBindingsCollection;
} | javascript | function collectBindingPaths(oElement, oModel){
var mBindingsCollection = {
bindingPaths: [],
bindingContextPaths: []
};
var sAggregationName = oElement.sParentAggregationName;
var oParent = oElement.getParent();
var aBindings = getBindings(oElement, oModel);
if (oParent) {
var oDefaultAggregation = oParent.getMetadata().getAggregation();
if (oDefaultAggregation) {
var iPositionOfInvisibleElement = ElementUtil.getAggregation(oParent, sAggregationName).indexOf(oElement);
var sParentDefaultAggregationName = oDefaultAggregation.name;
var oBinding = oParent.getBindingInfo(sParentDefaultAggregationName);
var oTemplate = oBinding && oBinding.template;
if (oTemplate) {
var oTemplateDefaultAggregation = oTemplate.getMetadata().getAggregation();
if (oTemplateDefaultAggregation) {
var sTemplateDefaultAggregationName = oTemplateDefaultAggregation.name;
var oTemplateElement = ElementUtil.getAggregation(oTemplate, sTemplateDefaultAggregationName)[iPositionOfInvisibleElement];
aBindings = aBindings.concat(getBindings(oTemplateElement, null, true));
}
}
}
}
for (var i = 0, l = aBindings.length; i < l; i++) {
if (aBindings[i].getPath) {
var sBindingPath = aBindings[i].getPath();
if (sBindingPath && mBindingsCollection.bindingPaths.indexOf(sBindingPath) === -1){
mBindingsCollection.bindingPaths.push(sBindingPath);
}
}
if (aBindings[i].getContext && aBindings[i].getContext() && aBindings[i].getContext().getPath) {
var sBindingContextPath = aBindings[i].getContext().getPath();
if (sBindingContextPath && mBindingsCollection.bindingContextPaths.indexOf(sBindingContextPath) === -1){
mBindingsCollection.bindingContextPaths.push(sBindingContextPath);
}
}
if (isPlainObject(aBindings[i])){
if (mBindingsCollection.bindingPaths.indexOf(aBindings[i].parts[0].path) === -1){
mBindingsCollection.bindingPaths.push(aBindings[i].parts[0].path);
}
}
}
return mBindingsCollection;
} | [
"function",
"collectBindingPaths",
"(",
"oElement",
",",
"oModel",
")",
"{",
"var",
"mBindingsCollection",
"=",
"{",
"bindingPaths",
":",
"[",
"]",
",",
"bindingContextPaths",
":",
"[",
"]",
"}",
";",
"var",
"sAggregationName",
"=",
"oElement",
".",
"sParentAg... | Get all relevant binding paths and binding context paths for the element (from all properties)
@param {sap.ui.core.Control} oElement - Starting point of the search
@param {sap.ui.model.Model} oModel - Model for filtering irrelevant binding paths
@returns {{bindingPaths: Array, bindingContextPaths: Array}}} - returns with all relevant bindingPaths and all bindingContextPaths for all properties of the element
@private | [
"Get",
"all",
"relevant",
"binding",
"paths",
"and",
"binding",
"context",
"paths",
"for",
"the",
"element",
"(",
"from",
"all",
"properties",
")"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.rta/src/sap/ui/rta/util/BindingsExtractor.js#L26-L76 | train | Collect all binding paths for the given element | [
30522,
3853,
8145,
8428,
4667,
15069,
2015,
1006,
1051,
12260,
3672,
1010,
18168,
10244,
2140,
1007,
1063,
13075,
16914,
22254,
8613,
26895,
18491,
1027,
1063,
8031,
15069,
2015,
1024,
1031,
1033,
1010,
8031,
8663,
18209,
15069,
2015,
1024,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/JSUtils/ScopeManager.js | handleScopeData | function handleScopeData(response) {
var file = response.file,
offset = response.offset;
var $deferredJump = getPendingRequest(file, offset, MessageIds.TERN_SCOPEDATA_MSG);
if ($deferredJump) {
$deferredJump.resolveWith(null, [response]);
}
} | javascript | function handleScopeData(response) {
var file = response.file,
offset = response.offset;
var $deferredJump = getPendingRequest(file, offset, MessageIds.TERN_SCOPEDATA_MSG);
if ($deferredJump) {
$deferredJump.resolveWith(null, [response]);
}
} | [
"function",
"handleScopeData",
"(",
"response",
")",
"{",
"var",
"file",
"=",
"response",
".",
"file",
",",
"offset",
"=",
"response",
".",
"offset",
";",
"var",
"$deferredJump",
"=",
"getPendingRequest",
"(",
"file",
",",
"offset",
",",
"MessageIds",
".",
... | Handle the response from the tern node domain when
it responds with the scope data
@param response - the response from the node domain | [
"Handle",
"the",
"response",
"from",
"the",
"tern",
"node",
"domain",
"when",
"it",
"responds",
"with",
"the",
"scope",
"data"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/JSUtils/ScopeManager.js#L451-L460 | train | Handle scope data | [
30522,
3853,
16024,
16186,
2850,
2696,
1006,
3433,
1007,
1063,
13075,
5371,
1027,
3433,
1012,
5371,
1010,
16396,
1027,
3433,
1012,
16396,
1025,
13075,
1002,
13366,
28849,
2094,
9103,
8737,
1027,
2131,
11837,
4667,
2890,
15500,
1006,
5371,
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... |
adobe/brackets | src/language/CodeInspection.js | updatePanelTitleAndStatusBar | function updatePanelTitleAndStatusBar(numProblems, providersReportingProblems, aborted) {
var message, tooltip;
if (providersReportingProblems.length === 1) {
// don't show a header if there is only one provider available for this file type
$problemsPanelTable.find(".inspector-section").hide();
$problemsPanelTable.find("tr").removeClass("forced-hidden");
if (numProblems === 1 && !aborted) {
message = StringUtils.format(Strings.SINGLE_ERROR, providersReportingProblems[0].name);
} else {
if (aborted) {
numProblems += "+";
}
message = StringUtils.format(Strings.MULTIPLE_ERRORS, providersReportingProblems[0].name, numProblems);
}
} else if (providersReportingProblems.length > 1) {
$problemsPanelTable.find(".inspector-section").show();
if (aborted) {
numProblems += "+";
}
message = StringUtils.format(Strings.ERRORS_PANEL_TITLE_MULTIPLE, numProblems);
} else {
return;
}
$problemsPanel.find(".title").text(message);
tooltip = StringUtils.format(Strings.STATUSBAR_CODE_INSPECTION_TOOLTIP, message);
StatusBar.updateIndicator(INDICATOR_ID, true, "inspection-errors", tooltip);
} | javascript | function updatePanelTitleAndStatusBar(numProblems, providersReportingProblems, aborted) {
var message, tooltip;
if (providersReportingProblems.length === 1) {
// don't show a header if there is only one provider available for this file type
$problemsPanelTable.find(".inspector-section").hide();
$problemsPanelTable.find("tr").removeClass("forced-hidden");
if (numProblems === 1 && !aborted) {
message = StringUtils.format(Strings.SINGLE_ERROR, providersReportingProblems[0].name);
} else {
if (aborted) {
numProblems += "+";
}
message = StringUtils.format(Strings.MULTIPLE_ERRORS, providersReportingProblems[0].name, numProblems);
}
} else if (providersReportingProblems.length > 1) {
$problemsPanelTable.find(".inspector-section").show();
if (aborted) {
numProblems += "+";
}
message = StringUtils.format(Strings.ERRORS_PANEL_TITLE_MULTIPLE, numProblems);
} else {
return;
}
$problemsPanel.find(".title").text(message);
tooltip = StringUtils.format(Strings.STATUSBAR_CODE_INSPECTION_TOOLTIP, message);
StatusBar.updateIndicator(INDICATOR_ID, true, "inspection-errors", tooltip);
} | [
"function",
"updatePanelTitleAndStatusBar",
"(",
"numProblems",
",",
"providersReportingProblems",
",",
"aborted",
")",
"{",
"var",
"message",
",",
"tooltip",
";",
"if",
"(",
"providersReportingProblems",
".",
"length",
"===",
"1",
")",
"{",
"// don't show a header if... | Update the title of the problem panel and the tooltip of the status bar icon. The title and the tooltip will
change based on the number of problems reported and how many provider reported problems.
@param {Number} numProblems - total number of problems across all providers
@param {Array.<{name:string, scanFileAsync:?function(string, string):!{$.Promise}, scanFile:?function(string, string):Object}>} providersReportingProblems - providers that reported problems
@param {boolean} aborted - true if any provider returned a result with the 'aborted' flag set | [
"Update",
"the",
"title",
"of",
"the",
"problem",
"panel",
"and",
"the",
"tooltip",
"of",
"the",
"status",
"bar",
"icon",
".",
"The",
"title",
"and",
"the",
"tooltip",
"will",
"change",
"based",
"on",
"the",
"number",
"of",
"problems",
"reported",
"and",
... | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/language/CodeInspection.js#L315-L347 | train | update panel title and status bar | [
30522,
3853,
10651,
9739,
20042,
4183,
20898,
5104,
29336,
2271,
8237,
1006,
16371,
8737,
3217,
3468,
5244,
1010,
11670,
2890,
6442,
2075,
21572,
3468,
5244,
1010,
11113,
15613,
1007,
1063,
13075,
4471,
1010,
6994,
25101,
1025,
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... |
angular/material | src/components/tooltip/tooltip.js | deregister | function deregister(type, handler, useCapture) {
var handlers = listeners[type];
var index = handlers ? handlers.indexOf(handler) : -1;
if (index > -1) {
handlers.splice(index, 1);
if (handlers.length === 0) {
useCapture ? window.removeEventListener(type, globalEventHandler, true) :
ngWindow.off(type, globalEventHandler);
}
}
} | javascript | function deregister(type, handler, useCapture) {
var handlers = listeners[type];
var index = handlers ? handlers.indexOf(handler) : -1;
if (index > -1) {
handlers.splice(index, 1);
if (handlers.length === 0) {
useCapture ? window.removeEventListener(type, globalEventHandler, true) :
ngWindow.off(type, globalEventHandler);
}
}
} | [
"function",
"deregister",
"(",
"type",
",",
"handler",
",",
"useCapture",
")",
"{",
"var",
"handlers",
"=",
"listeners",
"[",
"type",
"]",
";",
"var",
"index",
"=",
"handlers",
"?",
"handlers",
".",
"indexOf",
"(",
"handler",
")",
":",
"-",
"1",
";",
... | Removes an event handler from the service.
@param {string} type Type of event handler.
@param {!Function} handler The event handler itself.
@param {boolean} useCapture Whether the event handler used event capturing. | [
"Removes",
"an",
"event",
"handler",
"from",
"the",
"service",
"."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/tooltip/tooltip.js#L470-L482 | train | Deregisters a listener for a specific event type | [
30522,
3853,
4315,
13910,
12911,
1006,
2828,
1010,
28213,
1010,
2224,
17695,
11244,
1007,
1063,
13075,
28213,
2015,
1027,
13810,
1031,
2828,
1033,
1025,
13075,
5950,
1027,
28213,
2015,
1029,
28213,
2015,
1012,
5950,
11253,
1006,
28213,
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... |
grpc/grpc | examples/node/static_codegen/route_guide/route_guide_server.js | checkFeature | function checkFeature(point) {
var feature;
// Check if there is already a feature object for the given point
for (var i = 0; i < feature_list.length; i++) {
feature = feature_list[i];
if (feature.getLocation().getLatitude() === point.getLatitude() &&
feature.getLocation().getLongitude() === point.getLongitude()) {
return feature;
}
}
var name = '';
feature = new messages.Feature();
feature.setName(name);
feature.setLocation(point);
return feature;
} | javascript | function checkFeature(point) {
var feature;
// Check if there is already a feature object for the given point
for (var i = 0; i < feature_list.length; i++) {
feature = feature_list[i];
if (feature.getLocation().getLatitude() === point.getLatitude() &&
feature.getLocation().getLongitude() === point.getLongitude()) {
return feature;
}
}
var name = '';
feature = new messages.Feature();
feature.setName(name);
feature.setLocation(point);
return feature;
} | [
"function",
"checkFeature",
"(",
"point",
")",
"{",
"var",
"feature",
";",
"// Check if there is already a feature object for the given point",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"feature_list",
".",
"length",
";",
"i",
"++",
")",
"{",
"feature",
... | Get a feature object at the given point, or creates one if it does not exist.
@param {point} point The point to check
@return {feature} The feature object at the point. Note that an empty name
indicates no feature | [
"Get",
"a",
"feature",
"object",
"at",
"the",
"given",
"point",
"or",
"creates",
"one",
"if",
"it",
"does",
"not",
"exist",
"."
] | cc75d93818410e2b0edd0fa3009a6def9ac403ca | https://github.com/grpc/grpc/blob/cc75d93818410e2b0edd0fa3009a6def9ac403ca/examples/node/static_codegen/route_guide/route_guide_server.js#L48-L63 | train | Check if a feature object exists for the given point | [
30522,
3853,
4638,
7959,
4017,
5397,
1006,
2391,
1007,
1063,
13075,
3444,
1025,
1013,
1013,
4638,
2065,
2045,
2003,
2525,
1037,
3444,
4874,
2005,
1996,
2445,
2391,
2005,
1006,
13075,
1045,
1027,
1014,
1025,
1045,
1026,
3444,
1035,
2862,
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... |
vuejs/vue-cli | packages/@vue/cli-service-global/lib/util.js | fileExistsWithCaseSync | function fileExistsWithCaseSync (filepath) {
const { base, dir, root } = path.parse(filepath)
if (dir === root || dir === '.') {
return true
}
try {
const filenames = fs.readdirSync(dir)
if (!filenames.includes(base)) {
return false
}
} catch (e) {
// dir does not exist
return false
}
return fileExistsWithCaseSync(dir)
} | javascript | function fileExistsWithCaseSync (filepath) {
const { base, dir, root } = path.parse(filepath)
if (dir === root || dir === '.') {
return true
}
try {
const filenames = fs.readdirSync(dir)
if (!filenames.includes(base)) {
return false
}
} catch (e) {
// dir does not exist
return false
}
return fileExistsWithCaseSync(dir)
} | [
"function",
"fileExistsWithCaseSync",
"(",
"filepath",
")",
"{",
"const",
"{",
"base",
",",
"dir",
",",
"root",
"}",
"=",
"path",
".",
"parse",
"(",
"filepath",
")",
"if",
"(",
"dir",
"===",
"root",
"||",
"dir",
"===",
"'.'",
")",
"{",
"return",
"tru... | Based on https://stackoverflow.com/questions/27367261/check-if-file-exists-case-sensitive Case checking is required, to avoid errors raised by case-sensitive-paths-webpack-plugin | [
"Based",
"on",
"https",
":",
"//",
"stackoverflow",
".",
"com",
"/",
"questions",
"/",
"27367261",
"/",
"check",
"-",
"if",
"-",
"file",
"-",
"exists",
"-",
"case",
"-",
"sensitive",
"Case",
"checking",
"is",
"required",
"to",
"avoid",
"errors",
"raised"... | 206803cbefefdfbc7d8ed12440b0b751688b77b2 | https://github.com/vuejs/vue-cli/blob/206803cbefefdfbc7d8ed12440b0b751688b77b2/packages/@vue/cli-service-global/lib/util.js#L8-L26 | train | Check if filepath exists in the current directory | [
30522,
3853,
5371,
10288,
5130,
24415,
18382,
6508,
12273,
1006,
5371,
15069,
1007,
1063,
9530,
3367,
1063,
2918,
1010,
16101,
1010,
7117,
1065,
1027,
4130,
1012,
11968,
3366,
1006,
5371,
15069,
1007,
2065,
1006,
16101,
1027,
1027,
1027,
71... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/scales/scale.time.js | function(rawValue) {
if (rawValue && rawValue.t !== undefined) {
rawValue = rawValue.t;
}
return Scale.prototype.getRightValue.call(this, rawValue);
} | javascript | function(rawValue) {
if (rawValue && rawValue.t !== undefined) {
rawValue = rawValue.t;
}
return Scale.prototype.getRightValue.call(this, rawValue);
} | [
"function",
"(",
"rawValue",
")",
"{",
"if",
"(",
"rawValue",
"&&",
"rawValue",
".",
"t",
"!==",
"undefined",
")",
"{",
"rawValue",
"=",
"rawValue",
".",
"t",
";",
"}",
"return",
"Scale",
".",
"prototype",
".",
"getRightValue",
".",
"call",
"(",
"this"... | Allows data to be referenced via 't' attribute | [
"Allows",
"data",
"to",
"be",
"referenced",
"via",
"t",
"attribute"
] | f093c36574d290330ed623e60fbd070421c730d5 | https://github.com/chartjs/Chart.js/blob/f093c36574d290330ed623e60fbd070421c730d5/src/scales/scale.time.js#L507-L512 | train | Get the right value of the scale | [
30522,
3853,
1006,
6315,
10175,
5657,
1007,
1063,
2065,
1006,
6315,
10175,
5657,
1004,
1004,
6315,
10175,
5657,
1012,
1056,
999,
1027,
1027,
6151,
28344,
1007,
1063,
6315,
10175,
5657,
1027,
6315,
10175,
5657,
1012,
1056,
1025,
1065,
2709,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 | detachAndClean | 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 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",
"detachAndClean",
"(",
")",
"{",
"angular",
".",
"element",
"(",
"$document",
"[",
"0",
"]",
".",
"body",
")",
".",
"removeClass",
"(",
"'md-dialog-is-showing'",
")",
";",
"// Reverse the container stretch if using a content element.",
"if",
"(",
"option... | Detach the element | [
"Detach",
"the",
"element"
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/dialog/dialog.js#L835-L850 | train | Detaches the dialog element and cleans up the element | [
30522,
3853,
20010,
6776,
5685,
14321,
2319,
1006,
1007,
1063,
16108,
1012,
5783,
1006,
1002,
6254,
1031,
1014,
1033,
1012,
2303,
1007,
1012,
6366,
26266,
1006,
1005,
9108,
1011,
13764,
8649,
1011,
2003,
1011,
4760,
1005,
1007,
30524,
7047,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/api/deprecate.js | deprecateMethod | function deprecateMethod(book, key, fn, msg) {
return function() {
logNotice(book, key, msg);
return fn.apply(this, arguments);
};
} | javascript | function deprecateMethod(book, key, fn, msg) {
return function() {
logNotice(book, key, msg);
return fn.apply(this, arguments);
};
} | [
"function",
"deprecateMethod",
"(",
"book",
",",
"key",
",",
"fn",
",",
"msg",
")",
"{",
"return",
"function",
"(",
")",
"{",
"logNotice",
"(",
"book",
",",
"key",
",",
"msg",
")",
";",
"return",
"fn",
".",
"apply",
"(",
"this",
",",
"arguments",
"... | Deprecate a function
@param {Book|Output} book
@param {String} key: unique identitifer for the deprecated
@param {Function} fn
@param {String} msg: message to print when called
@return {Function} | [
"Deprecate",
"a",
"function"
] | 6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4 | https://github.com/GitbookIO/gitbook/blob/6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4/lib/api/deprecate.js#L32-L38 | train | Deprecate a method | [
30522,
3853,
2139,
28139,
16280,
11368,
6806,
2094,
1006,
2338,
1010,
3145,
1010,
1042,
2078,
1010,
5796,
2290,
1007,
1063,
2709,
3853,
1006,
1007,
1063,
8833,
17048,
6610,
1006,
2338,
1010,
3145,
1010,
5796,
2290,
1007,
1025,
2709,
1042,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
chriso/validator.js | lib/isCreditCard.js | isCreditCard | function isCreditCard(str) {
(0, _assertString.default)(str);
var sanitized = str.replace(/[- ]+/g, '');
if (!creditCard.test(sanitized)) {
return false;
}
var sum = 0;
var digit;
var tmpNum;
var shouldDouble;
for (var i = sanitized.length - 1; i >= 0; i--) {
digit = sanitized.substring(i, i + 1);
tmpNum = parseInt(digit, 10);
if (shouldDouble) {
tmpNum *= 2;
if (tmpNum >= 10) {
sum += tmpNum % 10 + 1;
} else {
sum += tmpNum;
}
} else {
sum += tmpNum;
}
shouldDouble = !shouldDouble;
}
return !!(sum % 10 === 0 ? sanitized : false);
} | javascript | function isCreditCard(str) {
(0, _assertString.default)(str);
var sanitized = str.replace(/[- ]+/g, '');
if (!creditCard.test(sanitized)) {
return false;
}
var sum = 0;
var digit;
var tmpNum;
var shouldDouble;
for (var i = sanitized.length - 1; i >= 0; i--) {
digit = sanitized.substring(i, i + 1);
tmpNum = parseInt(digit, 10);
if (shouldDouble) {
tmpNum *= 2;
if (tmpNum >= 10) {
sum += tmpNum % 10 + 1;
} else {
sum += tmpNum;
}
} else {
sum += tmpNum;
}
shouldDouble = !shouldDouble;
}
return !!(sum % 10 === 0 ? sanitized : false);
} | [
"function",
"isCreditCard",
"(",
"str",
")",
"{",
"(",
"0",
",",
"_assertString",
".",
"default",
")",
"(",
"str",
")",
";",
"var",
"sanitized",
"=",
"str",
".",
"replace",
"(",
"/",
"[- ]+",
"/",
"g",
",",
"''",
")",
";",
"if",
"(",
"!",
"credit... | /* eslint-enable max-len | [
"/",
"*",
"eslint",
"-",
"enable",
"max",
"-",
"len"
] | 63e4c78f07d08543af4be7b6c2c9cf24df009003 | https://github.com/chriso/validator.js/blob/63e4c78f07d08543af4be7b6c2c9cf24df009003/lib/isCreditCard.js#L16-L49 | train | Check if a string is a credit card | [
30522,
3853,
2003,
16748,
23194,
11522,
1006,
2358,
2099,
30524,
1005,
1005,
1007,
1025,
2065,
1006,
999,
4923,
11522,
1012,
3231,
1006,
2624,
25090,
5422,
1007,
1007,
1063,
2709,
6270,
1025,
1065,
13075,
7680,
1027,
1014,
1025,
13075,
1534... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
nhn/tui.editor | src/js/extensions/table/mergeCell.js | _updateRowMergeWith | function _updateRowMergeWith(targetRows, startColIndex, endColIndex, rowMergeWith) {
const limitColIndex = endColIndex + 1;
targetRows.forEach(rowData => {
rowData.slice(startColIndex, limitColIndex).forEach(cellData => {
cellData.rowMergeWith = rowMergeWith;
});
});
} | javascript | function _updateRowMergeWith(targetRows, startColIndex, endColIndex, rowMergeWith) {
const limitColIndex = endColIndex + 1;
targetRows.forEach(rowData => {
rowData.slice(startColIndex, limitColIndex).forEach(cellData => {
cellData.rowMergeWith = rowMergeWith;
});
});
} | [
"function",
"_updateRowMergeWith",
"(",
"targetRows",
",",
"startColIndex",
",",
"endColIndex",
",",
"rowMergeWith",
")",
"{",
"const",
"limitColIndex",
"=",
"endColIndex",
"+",
"1",
";",
"targetRows",
".",
"forEach",
"(",
"rowData",
"=>",
"{",
"rowData",
".",
... | Update rowMergeWith property of target rows for row merge.
@param {Array.<Array.<object>>} targetRows - target rows
@param {number} startColIndex - start column index
@param {number} endColIndex - end column index
@param {number} rowMergeWith - index of row merger
@private | [
"Update",
"rowMergeWith",
"property",
"of",
"target",
"rows",
"for",
"row",
"merge",
"."
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/extensions/table/mergeCell.js#L99-L107 | train | Update the rowMergeWith property of the target rows | [
30522,
3853,
1035,
10651,
10524,
5017,
3351,
24415,
1006,
4539,
10524,
2015,
1010,
2707,
25778,
22254,
10288,
1010,
2203,
25778,
22254,
10288,
1010,
5216,
5017,
3351,
24415,
1007,
1063,
9530,
3367,
5787,
25778,
22254,
10288,
1027,
2203,
25778... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
pixijs/pixi.js | packages/prepare/src/BasePrepare.js | findTexture | function findTexture(item, queue)
{
if (item._texture && item._texture instanceof Texture)
{
const texture = item._texture.baseTexture;
if (queue.indexOf(texture) === -1)
{
queue.push(texture);
}
return true;
}
return false;
} | javascript | function findTexture(item, queue)
{
if (item._texture && item._texture instanceof Texture)
{
const texture = item._texture.baseTexture;
if (queue.indexOf(texture) === -1)
{
queue.push(texture);
}
return true;
}
return false;
} | [
"function",
"findTexture",
"(",
"item",
",",
"queue",
")",
"{",
"if",
"(",
"item",
".",
"_texture",
"&&",
"item",
".",
"_texture",
"instanceof",
"Texture",
")",
"{",
"const",
"texture",
"=",
"item",
".",
"_texture",
".",
"baseTexture",
";",
"if",
"(",
... | Built-in hook to find textures from objects.
@private
@param {PIXI.DisplayObject} item - Display object to check
@param {Array<*>} queue - Collection of items to upload
@return {boolean} if a PIXI.Texture object was found. | [
"Built",
"-",
"in",
"hook",
"to",
"find",
"textures",
"from",
"objects",
"."
] | 99ae03b7565ae7ca5a6de633b0a277f7128fa4d0 | https://github.com/pixijs/pixi.js/blob/99ae03b7565ae7ca5a6de633b0a277f7128fa4d0/packages/prepare/src/BasePrepare.js#L380-L395 | train | Find a texture in the queue | [
30522,
3853,
2424,
18209,
5397,
1006,
8875,
1010,
24240,
1007,
1063,
2065,
1006,
8875,
1012,
1035,
14902,
1004,
1004,
8875,
1012,
1035,
14902,
6013,
11253,
14902,
1007,
1063,
9530,
3367,
14902,
1027,
8875,
1012,
1035,
14902,
1012,
2918,
182... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
GeekyAnts/vue-native-core | packages/vue-server-renderer/build.js | set | function set (target, key, val) {
if (Array.isArray(target) && typeof key === 'number') {
target.length = Math.max(target.length, key);
target.splice(key, 1, val);
return val
}
if (hasOwn(target, key)) {
target[key] = val;
return val
}
var ob = (target ).__ob__;
if (target._isVue || (ob && ob.vmCount)) {
process.env.NODE_ENV !== 'production' && warn(
'Avoid adding reactive properties to a Vue instance or its root $data ' +
'at runtime - declare it upfront in the data option.'
);
return val
}
if (!ob) {
target[key] = val;
return val
}
defineReactive$$1(ob.value, key, val);
ob.dep.notify();
return val
} | javascript | function set (target, key, val) {
if (Array.isArray(target) && typeof key === 'number') {
target.length = Math.max(target.length, key);
target.splice(key, 1, val);
return val
}
if (hasOwn(target, key)) {
target[key] = val;
return val
}
var ob = (target ).__ob__;
if (target._isVue || (ob && ob.vmCount)) {
process.env.NODE_ENV !== 'production' && warn(
'Avoid adding reactive properties to a Vue instance or its root $data ' +
'at runtime - declare it upfront in the data option.'
);
return val
}
if (!ob) {
target[key] = val;
return val
}
defineReactive$$1(ob.value, key, val);
ob.dep.notify();
return val
} | [
"function",
"set",
"(",
"target",
",",
"key",
",",
"val",
")",
"{",
"if",
"(",
"Array",
".",
"isArray",
"(",
"target",
")",
"&&",
"typeof",
"key",
"===",
"'number'",
")",
"{",
"target",
".",
"length",
"=",
"Math",
".",
"max",
"(",
"target",
".",
... | Set a property on an object. Adds the new property and
triggers change notification if the property doesn't
already exist. | [
"Set",
"a",
"property",
"on",
"an",
"object",
".",
"Adds",
"the",
"new",
"property",
"and",
"triggers",
"change",
"notification",
"if",
"the",
"property",
"doesn",
"t",
"already",
"exist",
"."
] | a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e | https://github.com/GeekyAnts/vue-native-core/blob/a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e/packages/vue-server-renderer/build.js#L1104-L1129 | train | Set a value to a property in a target object. | [
30522,
3853,
2275,
1006,
4539,
1010,
3145,
1010,
11748,
1007,
1063,
2065,
1006,
9140,
1012,
18061,
11335,
2100,
1006,
4539,
1007,
1004,
1004,
2828,
11253,
3145,
1027,
1027,
1027,
1005,
2193,
1005,
1007,
1063,
4539,
1012,
3091,
1027,
8785,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/array-callback-return.js | checkLastSegment | function checkLastSegment(node) {
if (funcInfo.shouldCheck &&
funcInfo.codePath.currentSegments.some(isReachable)
) {
context.report({
node,
loc: getLocation(node, context.getSourceCode()).loc.start,
messageId: funcInfo.hasReturn
? "expectedAtEnd"
: "expectedInside",
data: {
name: astUtils.getFunctionNameWithKind(funcInfo.node)
}
});
}
} | javascript | function checkLastSegment(node) {
if (funcInfo.shouldCheck &&
funcInfo.codePath.currentSegments.some(isReachable)
) {
context.report({
node,
loc: getLocation(node, context.getSourceCode()).loc.start,
messageId: funcInfo.hasReturn
? "expectedAtEnd"
: "expectedInside",
data: {
name: astUtils.getFunctionNameWithKind(funcInfo.node)
}
});
}
} | [
"function",
"checkLastSegment",
"(",
"node",
")",
"{",
"if",
"(",
"funcInfo",
".",
"shouldCheck",
"&&",
"funcInfo",
".",
"codePath",
".",
"currentSegments",
".",
"some",
"(",
"isReachable",
")",
")",
"{",
"context",
".",
"report",
"(",
"{",
"node",
",",
... | Checks whether or not the last code path segment is reachable.
Then reports this function if the segment is reachable.
If the last code path segment is reachable, there are paths which are not
returned or thrown.
@param {ASTNode} node - A node to check.
@returns {void} | [
"Checks",
"whether",
"or",
"not",
"the",
"last",
"code",
"path",
"segment",
"is",
"reachable",
".",
"Then",
"reports",
"this",
"function",
"if",
"the",
"segment",
"is",
"reachable",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/array-callback-return.js#L195-L210 | train | Check last segment of function node | [
30522,
3853,
4638,
8523,
3215,
13910,
3672,
1006,
13045,
1007,
1063,
2065,
1006,
4569,
15459,
14876,
1012,
2323,
5403,
3600,
1004,
1004,
4569,
15459,
14876,
1012,
3642,
15069,
1012,
14731,
13910,
8163,
1012,
2070,
1006,
2003,
16416,
7507,
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... |
SeleniumHQ/selenium | javascript/atoms/events.js | createNativeTouchList | function createNativeTouchList(touchListArgs) {
var touches = goog.array.map(touchListArgs, function(touchArg) {
return doc.createTouch(view, target, touchArg.identifier,
touchArg.pageX, touchArg.pageY, touchArg.screenX, touchArg.screenY);
});
return doc.createTouchList.apply(doc, touches);
} | javascript | function createNativeTouchList(touchListArgs) {
var touches = goog.array.map(touchListArgs, function(touchArg) {
return doc.createTouch(view, target, touchArg.identifier,
touchArg.pageX, touchArg.pageY, touchArg.screenX, touchArg.screenY);
});
return doc.createTouchList.apply(doc, touches);
} | [
"function",
"createNativeTouchList",
"(",
"touchListArgs",
")",
"{",
"var",
"touches",
"=",
"goog",
".",
"array",
".",
"map",
"(",
"touchListArgs",
",",
"function",
"(",
"touchArg",
")",
"{",
"return",
"doc",
".",
"createTouch",
"(",
"view",
",",
"target",
... | Creates a TouchList, using native touch Api, for touch events. | [
"Creates",
"a",
"TouchList",
"using",
"native",
"touch",
"Api",
"for",
"touch",
"events",
"."
] | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/atoms/events.js#L493-L500 | train | Creates a native touch list. | [
30522,
3853,
3443,
19833,
3512,
24826,
2818,
9863,
1006,
3543,
9863,
2906,
5620,
1007,
1063,
13075,
12817,
1027,
27571,
2290,
1012,
9140,
1012,
4949,
1006,
3543,
9863,
2906,
5620,
1010,
3853,
1006,
3543,
2906,
2290,
1007,
1063,
2709,
9986,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
exceljs/exceljs | lib/utils/stream-buf.js | function(target, targetOffset, offset, length) {
return this.toBuffer().copy(target, targetOffset, offset, length);
} | javascript | function(target, targetOffset, offset, length) {
return this.toBuffer().copy(target, targetOffset, offset, length);
} | [
"function",
"(",
"target",
",",
"targetOffset",
",",
"offset",
",",
"length",
")",
"{",
"return",
"this",
".",
"toBuffer",
"(",
")",
".",
"copy",
"(",
"target",
",",
"targetOffset",
",",
"offset",
",",
"length",
")",
";",
"}"
] | copy to target buffer | [
"copy",
"to",
"target",
"buffer"
] | c6ee7a14d5e0e5a07bf0e475aa4dd7b9a1e907f2 | https://github.com/exceljs/exceljs/blob/c6ee7a14d5e0e5a07bf0e475aa4dd7b9a1e907f2/lib/utils/stream-buf.js#L21-L23 | train | Copy the contents of the sequence to a buffer. | [
30522,
3853,
1006,
4539,
1010,
4539,
27475,
3388,
1010,
16396,
1010,
3091,
1007,
1063,
2709,
2023,
1012,
2000,
8569,
12494,
1006,
1007,
1012,
6100,
1006,
4539,
1010,
4539,
27475,
3388,
1010,
16396,
1010,
3091,
1007,
1025,
1065,
102,
30524,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... | |
zeit/now-cli | src/commands/certs/ls.js | sortByCn | function sortByCn(certsList) {
return certsList.concat().sort((a, b) => {
const domainA = psl.get(a.cns[0].replace('*', 'wildcard'));
const domainB = psl.get(b.cns[0].replace('*', 'wildcard'));
if (!domainA || !domainB) return 0;
return domainA.localeCompare(domainB);
});
} | javascript | function sortByCn(certsList) {
return certsList.concat().sort((a, b) => {
const domainA = psl.get(a.cns[0].replace('*', 'wildcard'));
const domainB = psl.get(b.cns[0].replace('*', 'wildcard'));
if (!domainA || !domainB) return 0;
return domainA.localeCompare(domainB);
});
} | [
"function",
"sortByCn",
"(",
"certsList",
")",
"{",
"return",
"certsList",
".",
"concat",
"(",
")",
".",
"sort",
"(",
"(",
"a",
",",
"b",
")",
"=>",
"{",
"const",
"domainA",
"=",
"psl",
".",
"get",
"(",
"a",
".",
"cns",
"[",
"0",
"]",
".",
"rep... | This function sorts the list of certs by root domain changing *
to 'wildcard' since that will allow psl get the root domain
properly to make the comparison. | [
"This",
"function",
"sorts",
"the",
"list",
"of",
"certs",
"by",
"root",
"domain",
"changing",
"*",
"to",
"wildcard",
"since",
"that",
"will",
"allow",
"psl",
"get",
"the",
"root",
"domain",
"properly",
"to",
"make",
"the",
"comparison",
"."
] | b53d907b745126113bc3e251ac2451088026a363 | https://github.com/zeit/now-cli/blob/b53d907b745126113bc3e251ac2451088026a363/src/commands/certs/ls.js#L125-L132 | train | Sort by CN | [
30522,
3853,
4066,
3762,
2278,
2078,
1006,
8292,
21217,
9863,
1007,
1063,
2709,
8292,
21217,
9863,
1012,
9530,
11266,
1006,
1007,
1012,
4066,
1006,
1006,
1037,
1010,
1038,
1007,
1027,
1028,
1063,
9530,
3367,
5884,
2050,
1027,
8827,
2140,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/radioButton/radio-button.js | mdRadioGroupDirective | function mdRadioGroupDirective($mdUtil, $mdConstant, $mdTheming, $timeout) {
RadioGroupController.prototype = createRadioGroupControllerProto();
return {
restrict: 'E',
controller: ['$element', RadioGroupController],
require: ['mdRadioGroup', '?ngModel'],
link: { pre: linkRadioGroup }
};
function linkRadioGroup(scope, element, attr, ctrls) {
element.addClass('_md'); // private md component indicator for styling
$mdTheming(element);
var rgCtrl = ctrls[0];
var ngModelCtrl = ctrls[1] || $mdUtil.fakeNgModel();
rgCtrl.init(ngModelCtrl);
scope.mouseActive = false;
element
.attr({
'role': 'radiogroup',
'tabIndex': element.attr('tabindex') || '0'
})
.on('keydown', keydownListener)
.on('mousedown', function(event) {
scope.mouseActive = true;
$timeout(function() {
scope.mouseActive = false;
}, 100);
})
.on('focus', function() {
if (scope.mouseActive === false) {
rgCtrl.$element.addClass('md-focused');
}
})
.on('blur', function() {
rgCtrl.$element.removeClass('md-focused');
});
/**
*
*/
function setFocus() {
if (!element.hasClass('md-focused')) { element.addClass('md-focused'); }
}
/**
*
*/
function keydownListener(ev) {
var keyCode = ev.which || ev.keyCode;
// Only listen to events that we originated ourselves
// so that we don't trigger on things like arrow keys in
// inputs.
if (keyCode != $mdConstant.KEY_CODE.ENTER &&
ev.currentTarget != ev.target) {
return;
}
switch (keyCode) {
case $mdConstant.KEY_CODE.LEFT_ARROW:
case $mdConstant.KEY_CODE.UP_ARROW:
ev.preventDefault();
rgCtrl.selectPrevious();
setFocus();
break;
case $mdConstant.KEY_CODE.RIGHT_ARROW:
case $mdConstant.KEY_CODE.DOWN_ARROW:
ev.preventDefault();
rgCtrl.selectNext();
setFocus();
break;
case $mdConstant.KEY_CODE.ENTER:
var form = angular.element($mdUtil.getClosest(element[0], 'form'));
if (form.length > 0) {
form.triggerHandler('submit');
}
break;
}
}
}
function RadioGroupController($element) {
this._radioButtonRenderFns = [];
this.$element = $element;
}
function createRadioGroupControllerProto() {
return {
init: function(ngModelCtrl) {
this._ngModelCtrl = ngModelCtrl;
this._ngModelCtrl.$render = angular.bind(this, this.render);
},
add: function(rbRender) {
this._radioButtonRenderFns.push(rbRender);
},
remove: function(rbRender) {
var index = this._radioButtonRenderFns.indexOf(rbRender);
if (index !== -1) {
this._radioButtonRenderFns.splice(index, 1);
}
},
render: function() {
this._radioButtonRenderFns.forEach(function(rbRender) {
rbRender();
});
},
setViewValue: function(value, eventType) {
this._ngModelCtrl.$setViewValue(value, eventType);
// update the other radio buttons as well
this.render();
},
getViewValue: function() {
return this._ngModelCtrl.$viewValue;
},
selectNext: function() {
return changeSelectedButton(this.$element, 1);
},
selectPrevious: function() {
return changeSelectedButton(this.$element, -1);
},
setActiveDescendant: function (radioId) {
this.$element.attr('aria-activedescendant', radioId);
},
isDisabled: function() {
return this.$element[0].hasAttribute('disabled');
}
};
}
/**
* Change the radio group's selected button by a given increment.
* If no button is selected, select the first button.
*/
function changeSelectedButton(parent, increment) {
// Coerce all child radio buttons into an array, then wrap then in an iterator
var buttons = $mdUtil.iterator(parent[0].querySelectorAll('md-radio-button'), true);
if (buttons.count()) {
var validate = function (button) {
// If disabled, then NOT valid
return !angular.element(button).attr("disabled");
};
var selected = parent[0].querySelector('md-radio-button.md-checked');
var target = buttons[increment < 0 ? 'previous' : 'next'](selected, validate) || buttons.first();
// Activate radioButton's click listener (triggerHandler won't create a real click event)
angular.element(target).triggerHandler('click');
}
}
} | javascript | function mdRadioGroupDirective($mdUtil, $mdConstant, $mdTheming, $timeout) {
RadioGroupController.prototype = createRadioGroupControllerProto();
return {
restrict: 'E',
controller: ['$element', RadioGroupController],
require: ['mdRadioGroup', '?ngModel'],
link: { pre: linkRadioGroup }
};
function linkRadioGroup(scope, element, attr, ctrls) {
element.addClass('_md'); // private md component indicator for styling
$mdTheming(element);
var rgCtrl = ctrls[0];
var ngModelCtrl = ctrls[1] || $mdUtil.fakeNgModel();
rgCtrl.init(ngModelCtrl);
scope.mouseActive = false;
element
.attr({
'role': 'radiogroup',
'tabIndex': element.attr('tabindex') || '0'
})
.on('keydown', keydownListener)
.on('mousedown', function(event) {
scope.mouseActive = true;
$timeout(function() {
scope.mouseActive = false;
}, 100);
})
.on('focus', function() {
if (scope.mouseActive === false) {
rgCtrl.$element.addClass('md-focused');
}
})
.on('blur', function() {
rgCtrl.$element.removeClass('md-focused');
});
/**
*
*/
function setFocus() {
if (!element.hasClass('md-focused')) { element.addClass('md-focused'); }
}
/**
*
*/
function keydownListener(ev) {
var keyCode = ev.which || ev.keyCode;
// Only listen to events that we originated ourselves
// so that we don't trigger on things like arrow keys in
// inputs.
if (keyCode != $mdConstant.KEY_CODE.ENTER &&
ev.currentTarget != ev.target) {
return;
}
switch (keyCode) {
case $mdConstant.KEY_CODE.LEFT_ARROW:
case $mdConstant.KEY_CODE.UP_ARROW:
ev.preventDefault();
rgCtrl.selectPrevious();
setFocus();
break;
case $mdConstant.KEY_CODE.RIGHT_ARROW:
case $mdConstant.KEY_CODE.DOWN_ARROW:
ev.preventDefault();
rgCtrl.selectNext();
setFocus();
break;
case $mdConstant.KEY_CODE.ENTER:
var form = angular.element($mdUtil.getClosest(element[0], 'form'));
if (form.length > 0) {
form.triggerHandler('submit');
}
break;
}
}
}
function RadioGroupController($element) {
this._radioButtonRenderFns = [];
this.$element = $element;
}
function createRadioGroupControllerProto() {
return {
init: function(ngModelCtrl) {
this._ngModelCtrl = ngModelCtrl;
this._ngModelCtrl.$render = angular.bind(this, this.render);
},
add: function(rbRender) {
this._radioButtonRenderFns.push(rbRender);
},
remove: function(rbRender) {
var index = this._radioButtonRenderFns.indexOf(rbRender);
if (index !== -1) {
this._radioButtonRenderFns.splice(index, 1);
}
},
render: function() {
this._radioButtonRenderFns.forEach(function(rbRender) {
rbRender();
});
},
setViewValue: function(value, eventType) {
this._ngModelCtrl.$setViewValue(value, eventType);
// update the other radio buttons as well
this.render();
},
getViewValue: function() {
return this._ngModelCtrl.$viewValue;
},
selectNext: function() {
return changeSelectedButton(this.$element, 1);
},
selectPrevious: function() {
return changeSelectedButton(this.$element, -1);
},
setActiveDescendant: function (radioId) {
this.$element.attr('aria-activedescendant', radioId);
},
isDisabled: function() {
return this.$element[0].hasAttribute('disabled');
}
};
}
/**
* Change the radio group's selected button by a given increment.
* If no button is selected, select the first button.
*/
function changeSelectedButton(parent, increment) {
// Coerce all child radio buttons into an array, then wrap then in an iterator
var buttons = $mdUtil.iterator(parent[0].querySelectorAll('md-radio-button'), true);
if (buttons.count()) {
var validate = function (button) {
// If disabled, then NOT valid
return !angular.element(button).attr("disabled");
};
var selected = parent[0].querySelector('md-radio-button.md-checked');
var target = buttons[increment < 0 ? 'previous' : 'next'](selected, validate) || buttons.first();
// Activate radioButton's click listener (triggerHandler won't create a real click event)
angular.element(target).triggerHandler('click');
}
}
} | [
"function",
"mdRadioGroupDirective",
"(",
"$mdUtil",
",",
"$mdConstant",
",",
"$mdTheming",
",",
"$timeout",
")",
"{",
"RadioGroupController",
".",
"prototype",
"=",
"createRadioGroupControllerProto",
"(",
")",
";",
"return",
"{",
"restrict",
":",
"'E'",
",",
"con... | @ngdoc directive
@module material.components.radioButton
@name mdRadioGroup
@restrict E
@description
The `<md-radio-group>` directive identifies a grouping
container for the 1..n grouped radio buttons; specified using nested
`<md-radio-button>` elements.
The radio button uses the accent color by default. The primary color palette may be used with
the `md-primary` class.
Note: `<md-radio-group>` and `<md-radio-button>` handle `tabindex` differently
than the native `<input type="radio">` controls. Whereas the native controls
force the user to tab through all the radio buttons, `<md-radio-group>`
is focusable and by default the `<md-radio-button>`s are not.
@param {string} ng-model Assignable angular expression to data-bind to.
@param {string=} ng-change AngularJS expression to be executed when input changes due to user
interaction.
@param {boolean=} md-no-ink If present, disables ink ripple effects.
@usage
<hljs lang="html">
<md-radio-group ng-model="selected">
<md-radio-button ng-repeat="item in items"
ng-value="item.value" aria-label="{{item.label}}">
{{ item.label }}
</md-radio-button>
</md-radio-group>
</hljs> | [
"@ngdoc",
"directive",
"@module",
"material",
".",
"components",
".",
"radioButton",
"@name",
"mdRadioGroup"
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/radioButton/radio-button.js#L47-L206 | train | Directive for RadioGroup | [
30522,
3853,
9108,
12173,
3695,
17058,
4305,
2890,
15277,
1006,
1002,
9108,
21823,
2140,
1010,
1002,
9108,
8663,
12693,
2102,
1010,
1002,
9108,
10760,
6562,
1010,
1002,
2051,
5833,
1007,
1063,
2557,
17058,
8663,
13181,
10820,
1012,
8773,
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/model/odata/v4/lib/_Helper.js | function (oInstance, sMetaPath, mTypeForMetaPath) {
var aFilters = [],
sKey,
mKey2Value = _Helper.getKeyProperties(oInstance, sMetaPath, mTypeForMetaPath);
if (!mKey2Value) {
return undefined;
}
for (sKey in mKey2Value) {
aFilters.push(sKey + " eq " + mKey2Value[sKey]);
}
return aFilters.join(" and ");
} | javascript | function (oInstance, sMetaPath, mTypeForMetaPath) {
var aFilters = [],
sKey,
mKey2Value = _Helper.getKeyProperties(oInstance, sMetaPath, mTypeForMetaPath);
if (!mKey2Value) {
return undefined;
}
for (sKey in mKey2Value) {
aFilters.push(sKey + " eq " + mKey2Value[sKey]);
}
return aFilters.join(" and ");
} | [
"function",
"(",
"oInstance",
",",
"sMetaPath",
",",
"mTypeForMetaPath",
")",
"{",
"var",
"aFilters",
"=",
"[",
"]",
",",
"sKey",
",",
"mKey2Value",
"=",
"_Helper",
".",
"getKeyProperties",
"(",
"oInstance",
",",
"sMetaPath",
",",
"mTypeForMetaPath",
")",
";... | Returns a filter identifying the given instance via its key properties.
@param {object} oInstance
Entity instance runtime data
@param {string} sMetaPath
The absolute meta path of the given instance
@param {object} mTypeForMetaPath
Maps meta paths to the corresponding entity or complex types
@returns {string}
A filter using key properties, e.g. "Sector eq 'DevOps' and ID eq 42)", or undefined,
if at least one key property is undefined
@throws {Error}
In case the entity type has no key properties according to metadata | [
"Returns",
"a",
"filter",
"identifying",
"the",
"given",
"instance",
"via",
"its",
"key",
"properties",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Helper.js#L501-L514 | train | Returns the filter string for the given key | [
30522,
3853,
1006,
1051,
7076,
26897,
1010,
15488,
12928,
15069,
1010,
11047,
18863,
14192,
12928,
15069,
1007,
1063,
13075,
28697,
21928,
2015,
1027,
1031,
1033,
1010,
15315,
3240,
1010,
12395,
3240,
2475,
10175,
5657,
1027,
1035,
2393,
2121... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/TableUtils.js | function(oTable, iRowIdx, iColIdx, bIdxInColumnAgg) {
var oRow = iRowIdx >= 0 && iRowIdx < oTable.getRows().length ? oTable.getRows()[iRowIdx] : null;
var aColumns = bIdxInColumnAgg ? oTable.getColumns() : oTable._getVisibleColumns();
var oColumn = iColIdx >= 0 && iColIdx < aColumns.length ? aColumns[iColIdx] : null;
var oCell = null;
if (oRow && oColumn) {
if (bIdxInColumnAgg) {
if (oColumn.shouldRender()) {
var aVisibleColumns = oTable._getVisibleColumns();
for (var i = 0; i < aVisibleColumns.length; i++) {
if (aVisibleColumns[i] === oColumn) {
oCell = oRow.getCells()[i];
break;
}
}
}
} else {
oCell = oRow.getCells()[iColIdx];
}
}
return {row: oRow, column: oColumn, cell: oCell};
} | javascript | function(oTable, iRowIdx, iColIdx, bIdxInColumnAgg) {
var oRow = iRowIdx >= 0 && iRowIdx < oTable.getRows().length ? oTable.getRows()[iRowIdx] : null;
var aColumns = bIdxInColumnAgg ? oTable.getColumns() : oTable._getVisibleColumns();
var oColumn = iColIdx >= 0 && iColIdx < aColumns.length ? aColumns[iColIdx] : null;
var oCell = null;
if (oRow && oColumn) {
if (bIdxInColumnAgg) {
if (oColumn.shouldRender()) {
var aVisibleColumns = oTable._getVisibleColumns();
for (var i = 0; i < aVisibleColumns.length; i++) {
if (aVisibleColumns[i] === oColumn) {
oCell = oRow.getCells()[i];
break;
}
}
}
} else {
oCell = oRow.getCells()[iColIdx];
}
}
return {row: oRow, column: oColumn, cell: oCell};
} | [
"function",
"(",
"oTable",
",",
"iRowIdx",
",",
"iColIdx",
",",
"bIdxInColumnAgg",
")",
"{",
"var",
"oRow",
"=",
"iRowIdx",
">=",
"0",
"&&",
"iRowIdx",
"<",
"oTable",
".",
"getRows",
"(",
")",
".",
"length",
"?",
"oTable",
".",
"getRows",
"(",
")",
"... | Returns the Row, Column and Cell instances for the given row index (in the rows aggregation)
and column index (in the array of visible columns (see Table._getVisibleColumns()).
@param {sap.ui.table.Table} oTable Instance of the table.
@param {int} iRowIdx Index of row in the tables rows aggregation.
@param {int} iColIdx Index of column in the list of visible columns.
@param {boolean} bIdxInColumnAgg Whether the given column index is the index in the columns (<code>true</code>)
aggregation or in the list of visible columns (<code>false</code>).
@returns {Object} An object containing references to the row, column and cell.
@type {Object}
@property {sap.ui.table.Row} row Row of the table.
@property {sap.ui.table.Column} column Column of the table.
@property {sap.ui.core.Control} cell Cell control of row/column. | [
"Returns",
"the",
"Row",
"Column",
"and",
"Cell",
"instances",
"for",
"the",
"given",
"row",
"index",
"(",
"in",
"the",
"rows",
"aggregation",
")",
"and",
"column",
"index",
"(",
"in",
"the",
"array",
"of",
"visible",
"columns",
"(",
"see",
"Table",
".",... | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableUtils.js#L828-L851 | train | Returns the cell for the given row and column. | [
30522,
3853,
1006,
27178,
3085,
1010,
20868,
5004,
3593,
2595,
1010,
24582,
10893,
2094,
2595,
30524,
3085,
1012,
2131,
10524,
2015,
1006,
1007,
1012,
3091,
1029,
27178,
3085,
1012,
2131,
10524,
2015,
1006,
1007,
1031,
20868,
5004,
3593,
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/extensions/default/QuickOpenJavaScript/main.js | createFunctionList | function createFunctionList() {
var doc = DocumentManager.getCurrentDocument();
if (!doc) {
return;
}
var functionList = [];
var docText = doc.getText();
var lines = docText.split("\n");
var functions = JSUtils.findAllMatchingFunctionsInText(docText, "*");
functions.forEach(function (funcEntry) {
functionList.push(new FileLocation(null, funcEntry.nameLineStart, funcEntry.columnStart, funcEntry.columnEnd, funcEntry.label || funcEntry.name));
});
return functionList;
} | javascript | function createFunctionList() {
var doc = DocumentManager.getCurrentDocument();
if (!doc) {
return;
}
var functionList = [];
var docText = doc.getText();
var lines = docText.split("\n");
var functions = JSUtils.findAllMatchingFunctionsInText(docText, "*");
functions.forEach(function (funcEntry) {
functionList.push(new FileLocation(null, funcEntry.nameLineStart, funcEntry.columnStart, funcEntry.columnEnd, funcEntry.label || funcEntry.name));
});
return functionList;
} | [
"function",
"createFunctionList",
"(",
")",
"{",
"var",
"doc",
"=",
"DocumentManager",
".",
"getCurrentDocument",
"(",
")",
";",
"if",
"(",
"!",
"doc",
")",
"{",
"return",
";",
"}",
"var",
"functionList",
"=",
"[",
"]",
";",
"var",
"docText",
"=",
"doc... | Contains a list of information about functions for a single document.
@return {?Array.<FileLocation>} | [
"Contains",
"a",
"list",
"of",
"information",
"about",
"functions",
"for",
"a",
"single",
"document",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/QuickOpenJavaScript/main.js#L57-L71 | train | Create a list of file locations for functions | [
30522,
3853,
3443,
11263,
27989,
9863,
1006,
1007,
1063,
13075,
9986,
1027,
6254,
24805,
4590,
1012,
2131,
10841,
14343,
3372,
3527,
24894,
4765,
1006,
1007,
1025,
2065,
1006,
999,
9986,
1007,
1063,
2709,
1025,
1065,
13075,
3853,
9863,
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... |
SAP/openui5 | src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/SubApiDetail.controller.js | function (oControlData, oEntityData) {
var FIRST_COLUMN = 0,
SECOND_COLUMN = 1,
THIRD_COLUMN = 2,
ENTITIES_PER_COLUMN = 3,
aHeaderControls = [[], [], []],
oHeaderLayoutUtil = this._getHeaderLayoutUtil(),
aSubClasses = oEntityData.extendedBy || oEntityData.implementedBy || [],
aHeaderBlocksInfo = [
{creator: "_getControlSampleBlock", exists: oControlData.isClass || oControlData.isNamespace},
{creator: "_getDocumentationBlock", exists: oControlData.docuLink !== undefined},
{creator: "_getUXGuidelinesBlock", exists: oControlData.uxGuidelinesLink !== undefined},
{creator: "_getExtendsBlock", exists: oControlData.isClass},
{creator: "_getSubclassesBlock", exists: aSubClasses.length > 0},
{creator: "_getImplementsBlock", exists: oControlData.hasImplementsData},
{creator: "_getModuleBlock", exists: true},
{creator: "_getLibraryBlock", exists: oControlData.kind === "namespace" && oEntityData.lib},
{creator: "_getVisibilityBlock", exists: oControlData.visibility},
{creator: "_getAvailableSinceBlock", exists: true},
{creator: "_getApplicationComponentBlock", exists: true}
],
fnFillHeaderControlsStructure = function () {
var iControlsAdded = 0,
iIndexToAdd,
fnGetIndexToAdd = function (iControlsAdded) {
// determines the column(1st, 2nd or 3rd), the next entity data key-value should be added to.
if (iControlsAdded <= ENTITIES_PER_COLUMN) {
return FIRST_COLUMN;
} else if (iControlsAdded <= ENTITIES_PER_COLUMN * 2) {
return SECOND_COLUMN;
}
return THIRD_COLUMN;
};
aHeaderBlocksInfo.forEach(function (oHeaderBlockInfo) {
var oControlBlock;
if (oHeaderBlockInfo.exists) {
oControlBlock = oHeaderLayoutUtil[oHeaderBlockInfo.creator].call(this, oControlData, oEntityData);
iIndexToAdd = fnGetIndexToAdd(++iControlsAdded);
aHeaderControls[iIndexToAdd].push(oControlBlock);
}
}, this);
}.bind(this);
// Creates the entity key-value controls
// based on the existing entity key-value data,
fnFillHeaderControlsStructure();
// Wraps each column in a <code>sap.ui.layout.VerticalLayout</code>.
aHeaderControls.forEach(function (aHeaderColumn, iIndex) {
var oVL = this.byId("headerColumn" + iIndex);
oVL.removeAllContent();
if (aHeaderColumn.length > 0) {
oVL.setVisible(true);
aHeaderColumn.forEach(oVL.addContent, oVL);
}
}, this);
} | javascript | function (oControlData, oEntityData) {
var FIRST_COLUMN = 0,
SECOND_COLUMN = 1,
THIRD_COLUMN = 2,
ENTITIES_PER_COLUMN = 3,
aHeaderControls = [[], [], []],
oHeaderLayoutUtil = this._getHeaderLayoutUtil(),
aSubClasses = oEntityData.extendedBy || oEntityData.implementedBy || [],
aHeaderBlocksInfo = [
{creator: "_getControlSampleBlock", exists: oControlData.isClass || oControlData.isNamespace},
{creator: "_getDocumentationBlock", exists: oControlData.docuLink !== undefined},
{creator: "_getUXGuidelinesBlock", exists: oControlData.uxGuidelinesLink !== undefined},
{creator: "_getExtendsBlock", exists: oControlData.isClass},
{creator: "_getSubclassesBlock", exists: aSubClasses.length > 0},
{creator: "_getImplementsBlock", exists: oControlData.hasImplementsData},
{creator: "_getModuleBlock", exists: true},
{creator: "_getLibraryBlock", exists: oControlData.kind === "namespace" && oEntityData.lib},
{creator: "_getVisibilityBlock", exists: oControlData.visibility},
{creator: "_getAvailableSinceBlock", exists: true},
{creator: "_getApplicationComponentBlock", exists: true}
],
fnFillHeaderControlsStructure = function () {
var iControlsAdded = 0,
iIndexToAdd,
fnGetIndexToAdd = function (iControlsAdded) {
// determines the column(1st, 2nd or 3rd), the next entity data key-value should be added to.
if (iControlsAdded <= ENTITIES_PER_COLUMN) {
return FIRST_COLUMN;
} else if (iControlsAdded <= ENTITIES_PER_COLUMN * 2) {
return SECOND_COLUMN;
}
return THIRD_COLUMN;
};
aHeaderBlocksInfo.forEach(function (oHeaderBlockInfo) {
var oControlBlock;
if (oHeaderBlockInfo.exists) {
oControlBlock = oHeaderLayoutUtil[oHeaderBlockInfo.creator].call(this, oControlData, oEntityData);
iIndexToAdd = fnGetIndexToAdd(++iControlsAdded);
aHeaderControls[iIndexToAdd].push(oControlBlock);
}
}, this);
}.bind(this);
// Creates the entity key-value controls
// based on the existing entity key-value data,
fnFillHeaderControlsStructure();
// Wraps each column in a <code>sap.ui.layout.VerticalLayout</code>.
aHeaderControls.forEach(function (aHeaderColumn, iIndex) {
var oVL = this.byId("headerColumn" + iIndex);
oVL.removeAllContent();
if (aHeaderColumn.length > 0) {
oVL.setVisible(true);
aHeaderColumn.forEach(oVL.addContent, oVL);
}
}, this);
} | [
"function",
"(",
"oControlData",
",",
"oEntityData",
")",
"{",
"var",
"FIRST_COLUMN",
"=",
"0",
",",
"SECOND_COLUMN",
"=",
"1",
",",
"THIRD_COLUMN",
"=",
"2",
",",
"ENTITIES_PER_COLUMN",
"=",
"3",
",",
"aHeaderControls",
"=",
"[",
"[",
"]",
",",
"[",
"]"... | Builds the header layout structure.
The header displays the entity data in 3 columns
and each column can consist of 3 key-value pairs at most.
@param {object} oControlData main control data object source
@param {object} oEntityData additional data object source | [
"Builds",
"the",
"header",
"layout",
"structure",
".",
"The",
"header",
"displays",
"the",
"entity",
"data",
"in",
"3",
"columns",
"and",
"each",
"column",
"can",
"consist",
"of",
"3",
"key",
"-",
"value",
"pairs",
"at",
"most",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/SubApiDetail.controller.js#L468-L526 | train | Creates a header control structure for the given control and entity data. | [
30522,
3853,
1006,
1051,
8663,
13181,
15150,
2696,
1010,
1051,
4765,
3012,
2850,
2696,
1007,
1063,
13075,
2034,
1035,
5930,
1027,
1014,
1010,
2117,
1035,
5930,
1027,
1015,
1010,
2353,
1035,
5930,
1027,
1016,
1010,
11422,
1035,
2566,
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... | |
NetEase/pomelo | lib/common/service/channelService.js | function(app, opts) {
opts = opts || {};
this.app = app;
this.channels = {};
this.prefix = opts.prefix;
this.store = opts.store;
this.broadcastFilter = opts.broadcastFilter;
this.channelRemote = new ChannelRemote(app);
} | javascript | function(app, opts) {
opts = opts || {};
this.app = app;
this.channels = {};
this.prefix = opts.prefix;
this.store = opts.store;
this.broadcastFilter = opts.broadcastFilter;
this.channelRemote = new ChannelRemote(app);
} | [
"function",
"(",
"app",
",",
"opts",
")",
"{",
"opts",
"=",
"opts",
"||",
"{",
"}",
";",
"this",
".",
"app",
"=",
"app",
";",
"this",
".",
"channels",
"=",
"{",
"}",
";",
"this",
".",
"prefix",
"=",
"opts",
".",
"prefix",
";",
"this",
".",
"s... | Create and maintain channels for server local.
ChannelService is created by channel component which is a default loaded
component of pomelo and channel service would be accessed by `app.get('channelService')`.
@class
@constructor | [
"Create",
"and",
"maintain",
"channels",
"for",
"server",
"local",
"."
] | defcf019631ed399cc4dad932d3b028a04a039a4 | https://github.com/NetEase/pomelo/blob/defcf019631ed399cc4dad932d3b028a04a039a4/lib/common/service/channelService.js#L21-L29 | train | A class that represents a cluster of channels. | [
30522,
3853,
1006,
10439,
1010,
23569,
2015,
1007,
1063,
23569,
2015,
1027,
23569,
2015,
1064,
1064,
1063,
1065,
1025,
2023,
1012,
10439,
1027,
10439,
1025,
2023,
1012,
6833,
1027,
1063,
1065,
1025,
2023,
1012,
17576,
1027,
23569,
2015,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/qunit.js | function( name, testEnvironment ) {
var currentModule = {
name: name,
testEnvironment: testEnvironment,
tests: []
};
// DEPRECATED: handles setup/teardown functions,
// beforeEach and afterEach should be used instead
if ( testEnvironment && testEnvironment.setup ) {
testEnvironment.beforeEach = testEnvironment.setup;
delete testEnvironment.setup;
}
if ( testEnvironment && testEnvironment.teardown ) {
testEnvironment.afterEach = testEnvironment.teardown;
delete testEnvironment.teardown;
}
config.modules.push( currentModule );
config.currentModule = currentModule;
} | javascript | function( name, testEnvironment ) {
var currentModule = {
name: name,
testEnvironment: testEnvironment,
tests: []
};
// DEPRECATED: handles setup/teardown functions,
// beforeEach and afterEach should be used instead
if ( testEnvironment && testEnvironment.setup ) {
testEnvironment.beforeEach = testEnvironment.setup;
delete testEnvironment.setup;
}
if ( testEnvironment && testEnvironment.teardown ) {
testEnvironment.afterEach = testEnvironment.teardown;
delete testEnvironment.teardown;
}
config.modules.push( currentModule );
config.currentModule = currentModule;
} | [
"function",
"(",
"name",
",",
"testEnvironment",
")",
"{",
"var",
"currentModule",
"=",
"{",
"name",
":",
"name",
",",
"testEnvironment",
":",
"testEnvironment",
",",
"tests",
":",
"[",
"]",
"}",
";",
"// DEPRECATED: handles setup/teardown functions,",
"// beforeE... | call on start of module test to prepend name to all tests | [
"call",
"on",
"start",
"of",
"module",
"test",
"to",
"prepend",
"name",
"to",
"all",
"tests"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/qunit.js#L230-L250 | train | Adds a module to the configuration | [
30522,
3853,
1006,
2171,
1010,
3231,
2368,
21663,
2239,
3672,
1007,
1063,
13075,
2783,
5302,
8566,
2571,
1027,
1063,
2171,
1024,
2171,
1010,
3231,
2368,
21663,
2239,
3672,
1024,
3231,
2368,
21663,
2239,
3672,
1010,
5852,
1024,
1031,
1033,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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.ux3/src/sap/ui/ux3/ExactList.js | function(oList){
var oAtt = oList._getAtt();
if (oAtt && !oList._isTop()) {
oList.$("head-txt").html(encodeXML(oAtt.getText())
+ "<span class=\"sapUiUx3ExactLstHeadInfo\"> (" + oList._lb.getSelectedIndices().length + "/" + oList._lb.getItems().length + ")</span>");
}
} | javascript | function(oList){
var oAtt = oList._getAtt();
if (oAtt && !oList._isTop()) {
oList.$("head-txt").html(encodeXML(oAtt.getText())
+ "<span class=\"sapUiUx3ExactLstHeadInfo\"> (" + oList._lb.getSelectedIndices().length + "/" + oList._lb.getItems().length + ")</span>");
}
} | [
"function",
"(",
"oList",
")",
"{",
"var",
"oAtt",
"=",
"oList",
".",
"_getAtt",
"(",
")",
";",
"if",
"(",
"oAtt",
"&&",
"!",
"oList",
".",
"_isTop",
"(",
")",
")",
"{",
"oList",
".",
"$",
"(",
"\"head-txt\"",
")",
".",
"html",
"(",
"encodeXML",
... | Refresh the header text of the list | [
"Refresh",
"the",
"header",
"text",
"of",
"the",
"list"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.ux3/src/sap/ui/ux3/ExactList.js#L1213-L1219 | train | Sets the head text of the list | [
30522,
3853,
1006,
19330,
2923,
1007,
1063,
13075,
1051,
19321,
1027,
19330,
2923,
1012,
1035,
2131,
19321,
1006,
1007,
1025,
2065,
1006,
1051,
19321,
1004,
1004,
999,
19330,
2923,
1012,
1035,
21541,
7361,
1006,
1007,
1007,
1063,
19330,
292... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 | closeFullEditor | function closeFullEditor(file) {
DeprecationWarning.deprecationWarning("Use CommandManager.execute(Commands.FILE_CLOSE, {File: file} instead of DocumentManager.closeFullEditor()", true);
CommandManager.execute(Commands.FILE_CLOSE, {File: file});
} | javascript | function closeFullEditor(file) {
DeprecationWarning.deprecationWarning("Use CommandManager.execute(Commands.FILE_CLOSE, {File: file} instead of DocumentManager.closeFullEditor()", true);
CommandManager.execute(Commands.FILE_CLOSE, {File: file});
} | [
"function",
"closeFullEditor",
"(",
"file",
")",
"{",
"DeprecationWarning",
".",
"deprecationWarning",
"(",
"\"Use CommandManager.execute(Commands.FILE_CLOSE, {File: file} instead of DocumentManager.closeFullEditor()\"",
",",
"true",
")",
";",
"CommandManager",
".",
"execute",
"(... | closes the specified file file
@deprecated use CommandManager.execute(Commands.FILE_CLOSE, {File: file}) instead
@param {!File} file - the file to close | [
"closes",
"the",
"specified",
"file",
"file"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/document/DocumentManager.js#L247-L250 | train | Closes the full editor | [
30522,
3853,
2485,
3993,
3709,
15660,
1006,
5371,
1007,
1063,
2139,
28139,
10719,
9028,
5582,
1012,
2139,
28139,
10719,
9028,
5582,
1006,
1000,
2224,
3094,
24805,
4590,
1012,
15389,
1006,
10954,
1012,
5371,
1035,
2485,
1010,
1063,
5371,
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... |
angular/material | src/core/util/util.js | getClosest | function getClosest(el, validateWith, onlyParent) {
if (angular.isString(validateWith)) {
var tagName = validateWith.toUpperCase();
validateWith = function(el) {
return el.nodeName.toUpperCase() === tagName;
};
}
if (el instanceof angular.element) el = el[0];
if (onlyParent) el = el.parentNode;
if (!el) return null;
do {
if (validateWith(el)) {
return el;
}
} while (el = el.parentNode);
return null;
} | javascript | function getClosest(el, validateWith, onlyParent) {
if (angular.isString(validateWith)) {
var tagName = validateWith.toUpperCase();
validateWith = function(el) {
return el.nodeName.toUpperCase() === tagName;
};
}
if (el instanceof angular.element) el = el[0];
if (onlyParent) el = el.parentNode;
if (!el) return null;
do {
if (validateWith(el)) {
return el;
}
} while (el = el.parentNode);
return null;
} | [
"function",
"getClosest",
"(",
"el",
",",
"validateWith",
",",
"onlyParent",
")",
"{",
"if",
"(",
"angular",
".",
"isString",
"(",
"validateWith",
")",
")",
"{",
"var",
"tagName",
"=",
"validateWith",
".",
"toUpperCase",
"(",
")",
";",
"validateWith",
"=",... | getClosest replicates jQuery.closest() to walk up the DOM tree until it finds a matching
nodeName.
@param {Node} el Element to start walking the DOM from
@param {string|function} validateWith If a string is passed, it will be evaluated against
each of the parent nodes' tag name. If a function is passed, the loop will call it with each
of the parents and will use the return value to determine whether the node is a match.
@param {boolean=} onlyParent Only start checking from the parent element, not `el`.
@returns {Node|null} closest matching parent Node or null if not found | [
"getClosest",
"replicates",
"jQuery",
".",
"closest",
"()",
"to",
"walk",
"up",
"the",
"DOM",
"tree",
"until",
"it",
"finds",
"a",
"matching",
"nodeName",
"."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/util/util.js#L551-L570 | train | Returns closest ancestor element | [
30522,
3853,
2131,
20464,
27465,
2102,
1006,
3449,
1010,
9398,
3686,
24415,
1010,
2069,
19362,
4765,
1007,
1063,
2065,
1006,
16108,
1012,
26354,
18886,
3070,
1006,
9398,
3686,
24415,
1007,
1007,
1063,
13075,
6415,
18442,
1027,
9398,
3686,
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... |
swimlane/ngx-datatable | release/utils/math.js | getTotalFlexGrow | function getTotalFlexGrow(columns) {
var totalFlexGrow = 0;
for (var _i = 0, columns_1 = columns; _i < columns_1.length; _i++) {
var c = columns_1[_i];
totalFlexGrow += c.flexGrow || 0;
}
return totalFlexGrow;
} | javascript | function getTotalFlexGrow(columns) {
var totalFlexGrow = 0;
for (var _i = 0, columns_1 = columns; _i < columns_1.length; _i++) {
var c = columns_1[_i];
totalFlexGrow += c.flexGrow || 0;
}
return totalFlexGrow;
} | [
"function",
"getTotalFlexGrow",
"(",
"columns",
")",
"{",
"var",
"totalFlexGrow",
"=",
"0",
";",
"for",
"(",
"var",
"_i",
"=",
"0",
",",
"columns_1",
"=",
"columns",
";",
"_i",
"<",
"columns_1",
".",
"length",
";",
"_i",
"++",
")",
"{",
"var",
"c",
... | Calculates the Total Flex Grow | [
"Calculates",
"the",
"Total",
"Flex",
"Grow"
] | d7df15a070282a169524dba51d9572008b74804c | https://github.com/swimlane/ngx-datatable/blob/d7df15a070282a169524dba51d9572008b74804c/release/utils/math.js#L7-L14 | train | Get total flex grow | [
30522,
3853,
2131,
3406,
9080,
21031,
2595,
16523,
5004,
1006,
7753,
1007,
1063,
13075,
2561,
21031,
2595,
16523,
5004,
1027,
1014,
1025,
2005,
1006,
13075,
1035,
1045,
1027,
1014,
1010,
7753,
1035,
1015,
1027,
7753,
1025,
1035,
1045,
1026,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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-await-in-loop.js | isBoundary | function isBoundary(node) {
const t = node.type;
return (
t === "FunctionDeclaration" ||
t === "FunctionExpression" ||
t === "ArrowFunctionExpression" ||
/*
* Don't report the await expressions on for-await-of loop since it's
* asynchronous iteration intentionally.
*/
(t === "ForOfStatement" && node.await === true)
);
} | javascript | function isBoundary(node) {
const t = node.type;
return (
t === "FunctionDeclaration" ||
t === "FunctionExpression" ||
t === "ArrowFunctionExpression" ||
/*
* Don't report the await expressions on for-await-of loop since it's
* asynchronous iteration intentionally.
*/
(t === "ForOfStatement" && node.await === true)
);
} | [
"function",
"isBoundary",
"(",
"node",
")",
"{",
"const",
"t",
"=",
"node",
".",
"type",
";",
"return",
"(",
"t",
"===",
"\"FunctionDeclaration\"",
"||",
"t",
"===",
"\"FunctionExpression\"",
"||",
"t",
"===",
"\"ArrowFunctionExpression\"",
"||",
"/*\n *... | Check whether it should stop traversing ancestors at the given node.
@param {ASTNode} node A node to check.
@returns {boolean} `true` if it should stop traversing. | [
"Check",
"whether",
"it",
"should",
"stop",
"traversing",
"ancestors",
"at",
"the",
"given",
"node",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/no-await-in-loop.js#L12-L26 | train | Check if a node is a boundary | [
30522,
3853,
2003,
15494,
5649,
1006,
13045,
1007,
1063,
9530,
3367,
1056,
1027,
13045,
1012,
2828,
1025,
2709,
1006,
1056,
1027,
1027,
1027,
1000,
3853,
3207,
20464,
25879,
3258,
1000,
1064,
1064,
1056,
1027,
1027,
1027,
1000,
3853,
10288,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 | _hideYearPicker | function _hideYearPicker(bSkipFocus){
this._iMode = 0;
var oYearPicker = this.getAggregation("yearPicker");
oYearPicker.$().css("display", "none");
this._hideOverlay();
if (!bSkipFocus) {
_renderTimesRow.call(this); // to focus date
// restore tabindex because if date not changed in _renderTimesRow only the focused date is updated
var oTimesRow = this.getAggregation("timesRow");
jQuery(oTimesRow._oItemNavigation.getItemDomRefs()[oTimesRow._oItemNavigation.getFocusedIndex()]).attr("tabindex", "0");
}
} | javascript | function _hideYearPicker(bSkipFocus){
this._iMode = 0;
var oYearPicker = this.getAggregation("yearPicker");
oYearPicker.$().css("display", "none");
this._hideOverlay();
if (!bSkipFocus) {
_renderTimesRow.call(this); // to focus date
// restore tabindex because if date not changed in _renderTimesRow only the focused date is updated
var oTimesRow = this.getAggregation("timesRow");
jQuery(oTimesRow._oItemNavigation.getItemDomRefs()[oTimesRow._oItemNavigation.getFocusedIndex()]).attr("tabindex", "0");
}
} | [
"function",
"_hideYearPicker",
"(",
"bSkipFocus",
")",
"{",
"this",
".",
"_iMode",
"=",
"0",
";",
"var",
"oYearPicker",
"=",
"this",
".",
"getAggregation",
"(",
"\"yearPicker\"",
")",
";",
"oYearPicker",
".",
"$",
"(",
")",
".",
"css",
"(",
"\"display\"",
... | Hides an embedded year Picker.
This function assumes there is a "yearPicker" aggregation.
So callers must take care.
@return {void}
@private | [
"Hides",
"an",
"embedded",
"year",
"Picker",
".",
"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#L1573-L1590 | train | Hides the year picker | [
30522,
3853,
1035,
5342,
29100,
24330,
5484,
1006,
18667,
3211,
14376,
10085,
2271,
1007,
1063,
2023,
1012,
1035,
10047,
10244,
1027,
1014,
1025,
13075,
1051,
29100,
24330,
5484,
1027,
2023,
1012,
2131,
8490,
17603,
12540,
1006,
1000,
2095,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/XMLTemplateProcessor.js | createControls | function createControls(node) {
// differentiate between SAPUI5 and plain-HTML children
if (node.namespaceURI === "http://www.w3.org/1999/xhtml" || node.namespaceURI === "http://www.w3.org/2000/svg" ) {
var id = node.attributes['id'] ? node.attributes['id'].textContent || node.attributes['id'].text : null;
if (bEnrichFullIds) {
return XMLTemplateProcessor.enrichTemplateIdsPromise(node, oView, bAsync).then(function(){
// do not create controls
return [];
});
} else {
// plain HTML node - create a new View control
// creates a view instance, but makes sure the new view receives the correct owner component
var fnCreateView = function (oViewClass) {
var mViewParameters = {
id: id ? getId(oView, node, id) : undefined,
xmlNode: node,
containingView: oView._oContainingView,
processingMode: oView._sProcessingMode // add processing mode, so it can be propagated to subviews inside the HTML block
};
// running with owner component
if (oView.fnScopedRunWithOwner) {
return oView.fnScopedRunWithOwner(function () {
return new oViewClass(mViewParameters);
});
}
// no owner component
// (or fully sync path, which handles the owner propagation on a higher level)
return new oViewClass(mViewParameters);
};
if (bAsync) {
return new Promise(function (resolve, reject) {
sap.ui.require(["sap/ui/core/mvc/XMLView"], function(XMLView) {
resolve([fnCreateView(XMLView)]);
});
});
} else {
var XMLView = sap.ui.requireSync("sap/ui/core/mvc/XMLView");
return SyncPromise.resolve([fnCreateView(XMLView)]);
}
}
} else {
// non-HTML (SAPUI5) control
return createControlOrExtension(node);
}
} | javascript | function createControls(node) {
// differentiate between SAPUI5 and plain-HTML children
if (node.namespaceURI === "http://www.w3.org/1999/xhtml" || node.namespaceURI === "http://www.w3.org/2000/svg" ) {
var id = node.attributes['id'] ? node.attributes['id'].textContent || node.attributes['id'].text : null;
if (bEnrichFullIds) {
return XMLTemplateProcessor.enrichTemplateIdsPromise(node, oView, bAsync).then(function(){
// do not create controls
return [];
});
} else {
// plain HTML node - create a new View control
// creates a view instance, but makes sure the new view receives the correct owner component
var fnCreateView = function (oViewClass) {
var mViewParameters = {
id: id ? getId(oView, node, id) : undefined,
xmlNode: node,
containingView: oView._oContainingView,
processingMode: oView._sProcessingMode // add processing mode, so it can be propagated to subviews inside the HTML block
};
// running with owner component
if (oView.fnScopedRunWithOwner) {
return oView.fnScopedRunWithOwner(function () {
return new oViewClass(mViewParameters);
});
}
// no owner component
// (or fully sync path, which handles the owner propagation on a higher level)
return new oViewClass(mViewParameters);
};
if (bAsync) {
return new Promise(function (resolve, reject) {
sap.ui.require(["sap/ui/core/mvc/XMLView"], function(XMLView) {
resolve([fnCreateView(XMLView)]);
});
});
} else {
var XMLView = sap.ui.requireSync("sap/ui/core/mvc/XMLView");
return SyncPromise.resolve([fnCreateView(XMLView)]);
}
}
} else {
// non-HTML (SAPUI5) control
return createControlOrExtension(node);
}
} | [
"function",
"createControls",
"(",
"node",
")",
"{",
"// differentiate between SAPUI5 and plain-HTML children",
"if",
"(",
"node",
".",
"namespaceURI",
"===",
"\"http://www.w3.org/1999/xhtml\"",
"||",
"node",
".",
"namespaceURI",
"===",
"\"http://www.w3.org/2000/svg\"",
")",
... | Takes an arbitrary node (control or plain HTML) and creates zero or one or more SAPUI5 controls from it,
iterating over the attributes and child nodes.
@return {Promise} resolving to an array with 0..n controls
@private | [
"Takes",
"an",
"arbitrary",
"node",
"(",
"control",
"or",
"plain",
"HTML",
")",
"and",
"creates",
"zero",
"or",
"one",
"or",
"more",
"SAPUI5",
"controls",
"from",
"it",
"iterating",
"over",
"the",
"attributes",
"and",
"child",
"nodes",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/XMLTemplateProcessor.js#L519-L566 | train | Creates controls from the DOM node | [
30522,
3853,
3443,
8663,
13181,
4877,
1006,
13045,
1007,
1063,
1013,
1013,
21032,
2090,
20066,
10179,
2629,
1998,
5810,
1011,
16129,
2336,
2065,
1006,
13045,
1012,
3415,
15327,
9496,
1027,
1027,
1027,
1000,
8299,
1024,
1013,
1013,
7479,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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.