repo stringclasses 195 values | path stringlengths 4 99 | func_name stringlengths 0 41 | original_string stringlengths 72 56.1k | language stringclasses 1 value | code stringlengths 72 56.1k | code_tokens listlengths 25 8.12k | docstring stringlengths 2 12.5k | docstring_tokens listlengths 1 449 | sha stringclasses 197 values | url stringlengths 88 186 | partition stringclasses 1 value | summary stringlengths 8 338 | input_ids listlengths 502 502 | token_type_ids listlengths 502 502 | attention_mask listlengths 502 502 | labels listlengths 502 502 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
jaywcjlove/linux-command | build/build.js | createStylToCss | function createStylToCss(stylPath) {
return new Promise((resolve, reject) => {
try {
const stylStr = FS.readFileSync(stylPath, 'utf8');
stylus(stylStr.toString())
.set('filename', stylPath)
.set('compress', true)
.render((err, css) => {
if (err) throw err;
resolve(css);
});
} catch (err) {
reject(err);
}
});
} | javascript | function createStylToCss(stylPath) {
return new Promise((resolve, reject) => {
try {
const stylStr = FS.readFileSync(stylPath, 'utf8');
stylus(stylStr.toString())
.set('filename', stylPath)
.set('compress', true)
.render((err, css) => {
if (err) throw err;
resolve(css);
});
} catch (err) {
reject(err);
}
});
} | [
"function",
"createStylToCss",
"(",
"stylPath",
")",
"{",
"return",
"new",
"Promise",
"(",
"(",
"resolve",
",",
"reject",
")",
"=>",
"{",
"try",
"{",
"const",
"stylStr",
"=",
"FS",
".",
"readFileSync",
"(",
"stylPath",
",",
"'utf8'",
")",
";",
"stylus",
... | [createStylToCss 生成CSS]
@param {[type]} stylPath stylus path
@param {[type]} cssPath css path | [
"[",
"createStylToCss",
"生成CSS",
"]"
] | 7d6c8c6b3468a0dd5311ee68934c9b8db64469f7 | https://github.com/jaywcjlove/linux-command/blob/7d6c8c6b3468a0dd5311ee68934c9b8db64469f7/build/build.js#L186-L201 | train | Create a stylus file and return it as a css string | [
30522,
3853,
9005,
3723,
23223,
6169,
2015,
1006,
2358,
8516,
15069,
1007,
1063,
2709,
2047,
4872,
1006,
1006,
10663,
1010,
15454,
1007,
1027,
1028,
1063,
3046,
1063,
9530,
3367,
2358,
8516,
3367,
2099,
1027,
1042,
2015,
1012,
3191,
8873,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/PerfUtils.js | getDelimitedPerfData | function getDelimitedPerfData() {
var result = "";
_.forEach(perfData, function (entry, testName) {
result += getValueAsString(entry) + "\t" + testName + "\n";
});
return result;
} | javascript | function getDelimitedPerfData() {
var result = "";
_.forEach(perfData, function (entry, testName) {
result += getValueAsString(entry) + "\t" + testName + "\n";
});
return result;
} | [
"function",
"getDelimitedPerfData",
"(",
")",
"{",
"var",
"result",
"=",
"\"\"",
";",
"_",
".",
"forEach",
"(",
"perfData",
",",
"function",
"(",
"entry",
",",
"testName",
")",
"{",
"result",
"+=",
"getValueAsString",
"(",
"entry",
")",
"+",
"\"\\t\"",
"... | Returns the performance data as a tab delimited string
@return {string} | [
"Returns",
"the",
"performance",
"data",
"as",
"a",
"tab",
"delimited",
"string"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/utils/PerfUtils.js#L343-L350 | train | Returns a string with the data in the delimiter | [
30522,
3853,
2131,
9247,
27605,
3064,
4842,
2546,
2850,
2696,
1006,
1007,
1063,
13075,
2765,
1027,
1000,
1000,
1025,
1035,
1012,
18921,
6776,
1006,
2566,
2546,
2850,
2696,
1010,
3853,
1006,
4443,
1010,
3231,
18442,
1007,
1063,
2765,
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... |
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... |
caolan/async | lib/groupByLimit.js | groupByLimit | function groupByLimit(coll, limit, iteratee, callback) {
var _iteratee = wrapAsync(iteratee);
return mapLimit(coll, limit, (val, iterCb) => {
_iteratee(val, (err, key) => {
if (err) return iterCb(err);
return iterCb(err, {key, val});
});
}, (err, mapResults) => {
var result = {};
// from MDN, handle object having an `hasOwnProperty` prop
var {hasOwnProperty} = Object.prototype;
for (var i = 0; i < mapResults.length; i++) {
if (mapResults[i]) {
var {key} = mapResults[i];
var {val} = mapResults[i];
if (hasOwnProperty.call(result, key)) {
result[key].push(val);
} else {
result[key] = [val];
}
}
}
return callback(err, result);
});
} | javascript | function groupByLimit(coll, limit, iteratee, callback) {
var _iteratee = wrapAsync(iteratee);
return mapLimit(coll, limit, (val, iterCb) => {
_iteratee(val, (err, key) => {
if (err) return iterCb(err);
return iterCb(err, {key, val});
});
}, (err, mapResults) => {
var result = {};
// from MDN, handle object having an `hasOwnProperty` prop
var {hasOwnProperty} = Object.prototype;
for (var i = 0; i < mapResults.length; i++) {
if (mapResults[i]) {
var {key} = mapResults[i];
var {val} = mapResults[i];
if (hasOwnProperty.call(result, key)) {
result[key].push(val);
} else {
result[key] = [val];
}
}
}
return callback(err, result);
});
} | [
"function",
"groupByLimit",
"(",
"coll",
",",
"limit",
",",
"iteratee",
",",
"callback",
")",
"{",
"var",
"_iteratee",
"=",
"wrapAsync",
"(",
"iteratee",
")",
";",
"return",
"mapLimit",
"(",
"coll",
",",
"limit",
",",
"(",
"val",
",",
"iterCb",
")",
"=... | The same as [`groupBy`]{@link module:Collections.groupBy} but runs a maximum of `limit` async operations at a time.
@name groupByLimit
@static
@memberOf module:Collections
@method
@see [async.groupBy]{@link module:Collections.groupBy}
@category Collection
@param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
@param {number} limit - The maximum number of async operations at a time.
@param {AsyncFunction} iteratee - An async function to apply to each item in
`coll`.
The iteratee should complete with a `key` to group the value under.
Invoked with (value, callback).
@param {Function} [callback] - A callback which is called when all `iteratee`
functions have finished, or an error occurs. Result is an `Object` whoses
properties are arrays of values which returned the corresponding key.
@returns {Promise} a promise, if no callback is passed | [
"The",
"same",
"as",
"[",
"groupBy",
"]",
"{",
"@link",
"module",
":",
"Collections",
".",
"groupBy",
"}",
"but",
"runs",
"a",
"maximum",
"of",
"limit",
"async",
"operations",
"at",
"a",
"time",
"."
] | 4330d536c106592139fa82062494c9dba0da1fdb | https://github.com/caolan/async/blob/4330d536c106592139fa82062494c9dba0da1fdb/lib/groupByLimit.js#L25-L52 | train | Aliquirer ausímero de código | [
30522,
3853,
2177,
3762,
17960,
4183,
1006,
8902,
2140,
1010,
5787,
1010,
2009,
22139,
2063,
1010,
2655,
5963,
1007,
1063,
13075,
1035,
2009,
22139,
2063,
1027,
10236,
3022,
6038,
2278,
1006,
2009,
22139,
2063,
1007,
1025,
2709,
4949,
17960... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 | getConfigForStyleGuide | function getConfigForStyleGuide(guide) {
const guides = {
google: { extends: "google" },
airbnb: { extends: "airbnb" },
"airbnb-base": { extends: "airbnb-base" },
standard: { extends: "standard" }
};
if (!guides[guide]) {
throw new Error("You referenced an unsupported guide.");
}
return guides[guide];
} | javascript | function getConfigForStyleGuide(guide) {
const guides = {
google: { extends: "google" },
airbnb: { extends: "airbnb" },
"airbnb-base": { extends: "airbnb-base" },
standard: { extends: "standard" }
};
if (!guides[guide]) {
throw new Error("You referenced an unsupported guide.");
}
return guides[guide];
} | [
"function",
"getConfigForStyleGuide",
"(",
"guide",
")",
"{",
"const",
"guides",
"=",
"{",
"google",
":",
"{",
"extends",
":",
"\"google\"",
"}",
",",
"airbnb",
":",
"{",
"extends",
":",
"\"airbnb\"",
"}",
",",
"\"airbnb-base\"",
":",
"{",
"extends",
":",
... | process user's style guide of choice and return an appropriate config object.
@param {string} guide name of the chosen style guide
@returns {Object} config object | [
"process",
"user",
"s",
"style",
"guide",
"of",
"choice",
"and",
"return",
"an",
"appropriate",
"config",
"object",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/config/config-initializer.js#L316-L329 | train | Get the config for a style guide | [
30522,
3853,
2131,
8663,
8873,
25708,
5668,
27983,
28582,
1006,
5009,
1007,
1063,
9530,
3367,
12468,
1027,
1063,
8224,
1024,
1063,
8908,
1024,
1000,
8224,
1000,
1065,
1010,
2250,
24700,
2497,
1024,
1063,
8908,
1024,
1000,
2250,
24700,
2497,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
ColorlibHQ/AdminLTE | plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js | function(element) {
var textContent = wysihtml5.lang.string(dom.getTextContent(element)).trim();
if (textContent.substr(0, 4) === "www.") {
textContent = "http://" + textContent;
}
return textContent;
} | javascript | function(element) {
var textContent = wysihtml5.lang.string(dom.getTextContent(element)).trim();
if (textContent.substr(0, 4) === "www.") {
textContent = "http://" + textContent;
}
return textContent;
} | [
"function",
"(",
"element",
")",
"{",
"var",
"textContent",
"=",
"wysihtml5",
".",
"lang",
".",
"string",
"(",
"dom",
".",
"getTextContent",
"(",
"element",
")",
")",
".",
"trim",
"(",
")",
";",
"if",
"(",
"textContent",
".",
"substr",
"(",
"0",
",",... | Assuming we have the following: <a href="http://www.google.de">http://www.google.de</a> If a user now changes the url in the innerHTML we want to make sure that it's synchronized with the href attribute (as long as the innerHTML is still a url) | [
"Assuming",
"we",
"have",
"the",
"following",
":",
"<a",
"href",
"=",
"http",
":",
"//",
"www",
".",
"google",
".",
"de",
">",
"http",
":",
"//",
"www",
".",
"google",
".",
"de<",
"/",
"a",
">",
"If",
"a",
"user",
"now",
"changes",
"the",
"url",
... | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js#L12316-L12322 | train | get the text content of an element | [
30522,
3853,
1006,
5783,
1007,
1063,
13075,
3793,
8663,
6528,
2102,
1027,
1059,
7274,
19190,
21246,
2140,
2629,
1012,
11374,
1012,
5164,
1006,
14383,
1012,
2131,
18209,
8663,
6528,
2102,
1006,
5783,
1007,
1007,
1012,
12241,
1006,
1007,
1025... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SheetJS/js-xlsx | bits/48_stybin.js | parse_BrtFmt | function parse_BrtFmt(data, length/*:number*/) {
var numFmtId = data.read_shift(2);
var stFmtCode = parse_XLWideString(data,length-2);
return [numFmtId, stFmtCode];
} | javascript | function parse_BrtFmt(data, length/*:number*/) {
var numFmtId = data.read_shift(2);
var stFmtCode = parse_XLWideString(data,length-2);
return [numFmtId, stFmtCode];
} | [
"function",
"parse_BrtFmt",
"(",
"data",
",",
"length",
"/*:number*/",
")",
"{",
"var",
"numFmtId",
"=",
"data",
".",
"read_shift",
"(",
"2",
")",
";",
"var",
"stFmtCode",
"=",
"parse_XLWideString",
"(",
"data",
",",
"length",
"-",
"2",
")",
";",
"return... | /* [MS-XLSB] 2.4.657 BrtFmt | [
"/",
"*",
"[",
"MS",
"-",
"XLSB",
"]",
"2",
".",
"4",
".",
"657",
"BrtFmt"
] | 9a6d8a1d3d80c78dad5201fb389316f935279cdc | https://github.com/SheetJS/js-xlsx/blob/9a6d8a1d3d80c78dad5201fb389316f935279cdc/bits/48_stybin.js#L2-L6 | train | Parse BrtFmt | [
30522,
3853,
11968,
3366,
1035,
7987,
24475,
20492,
1006,
2951,
1010,
3091,
1013,
1008,
1024,
2193,
1008,
1013,
1007,
1063,
13075,
16371,
2213,
16715,
3775,
2094,
1027,
2951,
1012,
3191,
1035,
5670,
1006,
1016,
1007,
1025,
13075,
2358,
1671... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/keyword-spacing.js | checkSpacingBeforeFirstToken | function checkSpacingBeforeFirstToken(node) {
const firstToken = node && sourceCode.getFirstToken(node);
if (firstToken && firstToken.type === "Keyword") {
checkSpacingBefore(firstToken);
}
} | javascript | function checkSpacingBeforeFirstToken(node) {
const firstToken = node && sourceCode.getFirstToken(node);
if (firstToken && firstToken.type === "Keyword") {
checkSpacingBefore(firstToken);
}
} | [
"function",
"checkSpacingBeforeFirstToken",
"(",
"node",
")",
"{",
"const",
"firstToken",
"=",
"node",
"&&",
"sourceCode",
".",
"getFirstToken",
"(",
"node",
")",
";",
"if",
"(",
"firstToken",
"&&",
"firstToken",
".",
"type",
"===",
"\"Keyword\"",
")",
"{",
... | Reports the first token of a given node if the first token is a keyword
and usage of spacing followed by the token is invalid.
This is used for unary operators (e.g. `typeof`), `function`, and `super`.
Other rules are handling usage of spacing preceded by those keywords.
@param {ASTNode|null} node - A node to report.
@returns {void} | [
"Reports",
"the",
"first",
"token",
"of",
"a",
"given",
"node",
"if",
"the",
"first",
"token",
"is",
"a",
"keyword",
"and",
"usage",
"of",
"spacing",
"followed",
"by",
"the",
"token",
"is",
"invalid",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/keyword-spacing.js#L325-L331 | train | Check spacing before first token | [
30522,
3853,
14148,
19498,
2075,
4783,
29278,
12879,
18894,
9284,
7520,
1006,
13045,
1007,
1063,
9530,
3367,
2034,
18715,
2368,
1027,
13045,
1004,
1004,
3120,
16044,
1012,
2131,
8873,
12096,
18715,
2368,
1006,
13045,
1007,
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... |
lovell/sharp | lib/colour.js | tint | function tint (rgb) {
const colour = color(rgb);
this.options.tintA = colour.a();
this.options.tintB = colour.b();
return this;
} | javascript | function tint (rgb) {
const colour = color(rgb);
this.options.tintA = colour.a();
this.options.tintB = colour.b();
return this;
} | [
"function",
"tint",
"(",
"rgb",
")",
"{",
"const",
"colour",
"=",
"color",
"(",
"rgb",
")",
";",
"this",
".",
"options",
".",
"tintA",
"=",
"colour",
".",
"a",
"(",
")",
";",
"this",
".",
"options",
".",
"tintB",
"=",
"colour",
".",
"b",
"(",
"... | Tint the image using the provided chroma while preserving the image luminance.
An alpha channel may be present and will be unchanged by the operation.
@param {String|Object} rgb - parsed by the [color](https://www.npmjs.org/package/color) module to extract chroma values.
@returns {Sharp}
@throws {Error} Invalid parameter | [
"Tint",
"the",
"image",
"using",
"the",
"provided",
"chroma",
"while",
"preserving",
"the",
"image",
"luminance",
".",
"An",
"alpha",
"channel",
"may",
"be",
"present",
"and",
"will",
"be",
"unchanged",
"by",
"the",
"operation",
"."
] | 05d76eeadfe54713606a615185b2da047923406b | https://github.com/lovell/sharp/blob/05d76eeadfe54713606a615185b2da047923406b/lib/colour.js#L26-L31 | train | tint color | [
30522,
3853,
9543,
2102,
1006,
1054,
18259,
1007,
1063,
9530,
3367,
6120,
1027,
3609,
1006,
1054,
18259,
1007,
1025,
2023,
1012,
7047,
1012,
9543,
2696,
1027,
6120,
1012,
1037,
1006,
1007,
1025,
2023,
1012,
7047,
1012,
9543,
2102,
2497,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/core/routing/Router.js | function(mArguments) {
var sDirection = History.getInstance().getDirection(),
sHash = this.oHashChanger.getHash(),
HistoryDirection = library.routing.HistoryDirection,
oLastHistoryEntry = this._aHistory[this._aHistory.length - 1],
oNewHistoryEntry;
// when back navigation, the last history state should be removed - except home route
if (sDirection === HistoryDirection.Backwards && oLastHistoryEntry && !oLastHistoryEntry.isHome) {
// but only if the last history entrie´s title is not the same as the current one
if (oLastHistoryEntry && oLastHistoryEntry.title !== mArguments.title) {
this._aHistory.pop();
}
} else if (oLastHistoryEntry && oLastHistoryEntry.hash == sHash) {
// if no actual navigation took place, we only need to update the title
oLastHistoryEntry.title = mArguments.title;
// check whether there's a duplicate history entry with the last history entry and remove it if there is
this._aHistory.some(function(oEntry, i, aHistory) {
if (i < aHistory.length - 1 && deepEqual(oEntry, oLastHistoryEntry)) {
return aHistory.splice(i, 1);
}
});
} else {
if (this._bLastHashReplaced) {
// if the current hash change is done via replacement, the last history entry should be removed
this._aHistory.pop();
}
oNewHistoryEntry = {
hash: sHash,
title: mArguments.title
};
// Array.some is sufficient here, as we ensure there is only one occurence
this._aHistory.some(function(oEntry, i, aHistory) {
if (deepEqual(oEntry, oNewHistoryEntry)) {
return aHistory.splice(i, 1);
}
});
// push new history state into the stack
this._aHistory.push(oNewHistoryEntry);
}
mArguments.history = this._aHistory.slice(0, -1);
this.fireEvent(Router.M_EVENTS.TITLE_CHANGED, mArguments);
this._bLastHashReplaced = false;
return this;
} | javascript | function(mArguments) {
var sDirection = History.getInstance().getDirection(),
sHash = this.oHashChanger.getHash(),
HistoryDirection = library.routing.HistoryDirection,
oLastHistoryEntry = this._aHistory[this._aHistory.length - 1],
oNewHistoryEntry;
// when back navigation, the last history state should be removed - except home route
if (sDirection === HistoryDirection.Backwards && oLastHistoryEntry && !oLastHistoryEntry.isHome) {
// but only if the last history entrie´s title is not the same as the current one
if (oLastHistoryEntry && oLastHistoryEntry.title !== mArguments.title) {
this._aHistory.pop();
}
} else if (oLastHistoryEntry && oLastHistoryEntry.hash == sHash) {
// if no actual navigation took place, we only need to update the title
oLastHistoryEntry.title = mArguments.title;
// check whether there's a duplicate history entry with the last history entry and remove it if there is
this._aHistory.some(function(oEntry, i, aHistory) {
if (i < aHistory.length - 1 && deepEqual(oEntry, oLastHistoryEntry)) {
return aHistory.splice(i, 1);
}
});
} else {
if (this._bLastHashReplaced) {
// if the current hash change is done via replacement, the last history entry should be removed
this._aHistory.pop();
}
oNewHistoryEntry = {
hash: sHash,
title: mArguments.title
};
// Array.some is sufficient here, as we ensure there is only one occurence
this._aHistory.some(function(oEntry, i, aHistory) {
if (deepEqual(oEntry, oNewHistoryEntry)) {
return aHistory.splice(i, 1);
}
});
// push new history state into the stack
this._aHistory.push(oNewHistoryEntry);
}
mArguments.history = this._aHistory.slice(0, -1);
this.fireEvent(Router.M_EVENTS.TITLE_CHANGED, mArguments);
this._bLastHashReplaced = false;
return this;
} | [
"function",
"(",
"mArguments",
")",
"{",
"var",
"sDirection",
"=",
"History",
".",
"getInstance",
"(",
")",
".",
"getDirection",
"(",
")",
",",
"sHash",
"=",
"this",
".",
"oHashChanger",
".",
"getHash",
"(",
")",
",",
"HistoryDirection",
"=",
"library",
... | private | [
"private"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/routing/Router.js#L1034-L1086 | train | Updates the history state of the current route | [
30522,
3853,
1006,
9388,
22850,
11187,
1007,
1063,
13075,
17371,
7442,
7542,
1027,
2381,
1012,
2131,
7076,
26897,
1006,
1007,
1012,
2131,
4305,
2890,
7542,
1006,
1007,
1010,
21146,
4095,
1027,
2023,
1012,
2821,
11823,
22305,
2121,
1012,
213... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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(evt)
{
var result = state;
if ((graph.dialect != mxConstants.DIALECT_SVG && mxEvent.getSource(evt).nodeName == 'IMG') || mxClient.IS_TOUCH)
{
var x = mxEvent.getClientX(evt);
var y = mxEvent.getClientY(evt);
// Dispatches the drop event to the graph which
// consumes and executes the source function
var pt = mxUtils.convertPoint(graph.container, x, y);
result = graph.view.getState(graph.getCellAt(pt.x, pt.y));
}
return result;
} | javascript | function(evt)
{
var result = state;
if ((graph.dialect != mxConstants.DIALECT_SVG && mxEvent.getSource(evt).nodeName == 'IMG') || mxClient.IS_TOUCH)
{
var x = mxEvent.getClientX(evt);
var y = mxEvent.getClientY(evt);
// Dispatches the drop event to the graph which
// consumes and executes the source function
var pt = mxUtils.convertPoint(graph.container, x, y);
result = graph.view.getState(graph.getCellAt(pt.x, pt.y));
}
return result;
} | [
"function",
"(",
"evt",
")",
"{",
"var",
"result",
"=",
"state",
";",
"if",
"(",
"(",
"graph",
".",
"dialect",
"!=",
"mxConstants",
".",
"DIALECT_SVG",
"&&",
"mxEvent",
".",
"getSource",
"(",
"evt",
")",
".",
"nodeName",
"==",
"'IMG'",
")",
"||",
"mx... | Workaround for touch devices routing all events for a mouse gesture (down, move, up) via the initial DOM node. Same for HTML images in all IE versions (VML images are working). | [
"Workaround",
"for",
"touch",
"devices",
"routing",
"all",
"events",
"for",
"a",
"mouse",
"gesture",
"(",
"down",
"move",
"up",
")",
"via",
"the",
"initial",
"DOM",
"node",
".",
"Same",
"for",
"HTML",
"images",
"in",
"all",
"IE",
"versions",
"(",
"VML",
... | 33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44 | https://github.com/jgraph/mxgraph/blob/33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44/javascript/mxClient.js#L48631-L48647 | train | Returns the state of the cell which contains the event | [
30522,
3853,
1006,
23408,
2102,
1007,
1063,
13075,
2765,
1027,
2110,
1025,
2065,
1006,
1006,
10629,
1012,
9329,
999,
1027,
25630,
8663,
12693,
3215,
1012,
9329,
1035,
17917,
2290,
1004,
1004,
25630,
18697,
3372,
1012,
4152,
8162,
3401,
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... | |
ColorlibHQ/AdminLTE | bower_components/Flot/examples/axes-time-zones/date.js | function (opts) {
if ((!fleegix || typeof fleegix.xhr === 'undefined') && (!$ || typeof $.ajax === 'undefined')) {
throw new Error('Please use the Fleegix.js XHR module, jQuery ajax, Zepto ajax, or define your own transport mechanism for downloading zone files.');
}
if (!opts) return;
if (!opts.url) throw new Error ('URL must be specified');
if (!('async' in opts)) opts.async = true;
if (!opts.async) {
return fleegix && fleegix.xhr
? fleegix.xhr.doReq({ url: opts.url, async: false })
: $.ajax({ url : opts.url, async : false }).responseText;
}
return fleegix && fleegix.xhr
? fleegix.xhr.send({
url : opts.url,
method : 'get',
handleSuccess : opts.success,
handleErr : opts.error
})
: $.ajax({
url : opts.url,
dataType: 'text',
method : 'GET',
error : opts.error,
success : opts.success
});
} | javascript | function (opts) {
if ((!fleegix || typeof fleegix.xhr === 'undefined') && (!$ || typeof $.ajax === 'undefined')) {
throw new Error('Please use the Fleegix.js XHR module, jQuery ajax, Zepto ajax, or define your own transport mechanism for downloading zone files.');
}
if (!opts) return;
if (!opts.url) throw new Error ('URL must be specified');
if (!('async' in opts)) opts.async = true;
if (!opts.async) {
return fleegix && fleegix.xhr
? fleegix.xhr.doReq({ url: opts.url, async: false })
: $.ajax({ url : opts.url, async : false }).responseText;
}
return fleegix && fleegix.xhr
? fleegix.xhr.send({
url : opts.url,
method : 'get',
handleSuccess : opts.success,
handleErr : opts.error
})
: $.ajax({
url : opts.url,
dataType: 'text',
method : 'GET',
error : opts.error,
success : opts.success
});
} | [
"function",
"(",
"opts",
")",
"{",
"if",
"(",
"(",
"!",
"fleegix",
"||",
"typeof",
"fleegix",
".",
"xhr",
"===",
"'undefined'",
")",
"&&",
"(",
"!",
"$",
"||",
"typeof",
"$",
".",
"ajax",
"===",
"'undefined'",
")",
")",
"{",
"throw",
"new",
"Error"... | Abstraction layer for different transport layers, including fleegix/jQuery/Zepto Object `opts` include - `url`: url to ajax query - `async`: true for asynchronous, false otherwise. If false, return value will be response from URL. This is true by default - `success`: success callback function - `error`: error callback function Returns response from URL if async is false, otherwise the AJAX request object itself | [
"Abstraction",
"layer",
"for",
"different",
"transport",
"layers",
"including",
"fleegix",
"/",
"jQuery",
"/",
"Zepto",
"Object",
"opts",
"include",
"-",
"url",
":",
"url",
"to",
"ajax",
"query",
"-",
"async",
":",
"true",
"for",
"asynchronous",
"false",
"ot... | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/bower_components/Flot/examples/axes-time-zones/date.js#L116-L142 | train | Download a zone file from a specified URL | [
30522,
3853,
1006,
23569,
2015,
1007,
1063,
2065,
1006,
1006,
999,
10574,
5856,
2595,
1064,
1064,
2828,
11253,
10574,
5856,
2595,
1012,
1060,
8093,
1027,
1027,
1027,
1005,
6151,
28344,
1005,
1007,
1004,
1004,
1006,
999,
1002,
1064,
1064,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
aframevr/aframe | src/core/a-register-element.js | wrapMethods | function wrapMethods (targetObj, methodList, derivedObj, baseObj) {
methodList.forEach(function (methodName) {
wrapMethod(targetObj, methodName, derivedObj, baseObj);
});
} | javascript | function wrapMethods (targetObj, methodList, derivedObj, baseObj) {
methodList.forEach(function (methodName) {
wrapMethod(targetObj, methodName, derivedObj, baseObj);
});
} | [
"function",
"wrapMethods",
"(",
"targetObj",
",",
"methodList",
",",
"derivedObj",
",",
"baseObj",
")",
"{",
"methodList",
".",
"forEach",
"(",
"function",
"(",
"methodName",
")",
"{",
"wrapMethod",
"(",
"targetObj",
",",
"methodName",
",",
"derivedObj",
",",
... | Wrap a list a methods to ensure that those in the base prototype are called
before the derived one.
@param {object} targetObj - Object that will contain the wrapped methods.
@param {array} methodList - List of methods from the derivedObj that will be wrapped.
@param {object} derivedObject - Object that inherits from the baseObj.
@param {object} baseObj - Object that derivedObj inherits from. | [
"Wrap",
"a",
"list",
"a",
"methods",
"to",
"ensure",
"that",
"those",
"in",
"the",
"base",
"prototype",
"are",
"called",
"before",
"the",
"derived",
"one",
"."
] | 24acc78a7299a4cdfe3ef617f4d40ddf6275c992 | https://github.com/aframevr/aframe/blob/24acc78a7299a4cdfe3ef617f4d40ddf6275c992/src/core/a-register-element.js#L130-L134 | train | Wrap methods in the base object | [
30522,
3853,
10236,
11368,
6806,
5104,
1006,
4539,
16429,
3501,
1010,
4118,
9863,
1010,
5173,
16429,
3501,
1010,
2918,
16429,
3501,
1007,
1063,
4118,
9863,
1012,
18921,
6776,
1006,
3853,
1006,
4118,
18442,
1007,
1063,
10236,
11368,
6806,
20... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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-implicit-coercion.js | isNumeric | function isNumeric(node) {
return (
node.type === "Literal" && typeof node.value === "number" ||
node.type === "CallExpression" && (
node.callee.name === "Number" ||
node.callee.name === "parseInt" ||
node.callee.name === "parseFloat"
)
);
} | javascript | function isNumeric(node) {
return (
node.type === "Literal" && typeof node.value === "number" ||
node.type === "CallExpression" && (
node.callee.name === "Number" ||
node.callee.name === "parseInt" ||
node.callee.name === "parseFloat"
)
);
} | [
"function",
"isNumeric",
"(",
"node",
")",
"{",
"return",
"(",
"node",
".",
"type",
"===",
"\"Literal\"",
"&&",
"typeof",
"node",
".",
"value",
"===",
"\"number\"",
"||",
"node",
".",
"type",
"===",
"\"CallExpression\"",
"&&",
"(",
"node",
".",
"callee",
... | Checks whether the result of a node is numeric or not
@param {ASTNode} node The node to test
@returns {boolean} true if the node is a number literal or a `Number()`, `parseInt` or `parseFloat` call | [
"Checks",
"whether",
"the",
"result",
"of",
"a",
"node",
"is",
"numeric",
"or",
"not"
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/no-implicit-coercion.js#L76-L85 | train | Check if a node is a number | [
30522,
3853,
3475,
17897,
7277,
1006,
13045,
1007,
1063,
2709,
1006,
13045,
1012,
2828,
1027,
1027,
1027,
1000,
18204,
1000,
1004,
1004,
2828,
11253,
13045,
1012,
3643,
1027,
1027,
1027,
1000,
2193,
1000,
1064,
1064,
13045,
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... |
jgraph/mxgraph | javascript/mxClient.js | mxEllipse | function mxEllipse(bounds, fill, stroke, strokewidth)
{
mxShape.call(this);
this.bounds = bounds;
this.fill = fill;
this.stroke = stroke;
this.strokewidth = (strokewidth != null) ? strokewidth : 1;
} | javascript | function mxEllipse(bounds, fill, stroke, strokewidth)
{
mxShape.call(this);
this.bounds = bounds;
this.fill = fill;
this.stroke = stroke;
this.strokewidth = (strokewidth != null) ? strokewidth : 1;
} | [
"function",
"mxEllipse",
"(",
"bounds",
",",
"fill",
",",
"stroke",
",",
"strokewidth",
")",
"{",
"mxShape",
".",
"call",
"(",
"this",
")",
";",
"this",
".",
"bounds",
"=",
"bounds",
";",
"this",
".",
"fill",
"=",
"fill",
";",
"this",
".",
"stroke",
... | Copyright (c) 2006-2015, JGraph Ltd
Copyright (c) 2006-2015, Gaudenz Alder
Class: mxEllipse
Extends <mxShape> to implement an ellipse shape.
This shape is registered under <mxConstants.SHAPE_ELLIPSE>
in <mxCellRenderer>.
Constructor: mxEllipse
Constructs a new ellipse shape.
Parameters:
bounds - <mxRectangle> that defines the bounds. This is stored in
<mxShape.bounds>.
fill - String that defines the fill color. This is stored in <fill>.
stroke - String that defines the stroke color. This is stored in <stroke>.
strokewidth - Optional integer that defines the stroke width. Default is
1. This is stored in <strokewidth>. | [
"Copyright",
"(",
"c",
")",
"2006",
"-",
"2015",
"JGraph",
"Ltd",
"Copyright",
"(",
"c",
")",
"2006",
"-",
"2015",
"Gaudenz",
"Alder",
"Class",
":",
"mxEllipse"
] | 33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44 | https://github.com/jgraph/mxgraph/blob/33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44/javascript/mxClient.js#L25104-L25111 | train | A wrapper around mxShape to create an ellipse | [
30522,
3853,
25630,
13348,
29251,
1006,
19202,
1010,
6039,
1010,
6909,
1010,
6909,
9148,
11927,
2232,
1007,
1063,
25630,
7377,
5051,
1012,
2655,
1006,
2023,
1007,
1025,
2023,
1012,
19202,
1027,
19202,
1025,
2023,
1012,
6039,
1027,
6039,
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... |
SeleniumHQ/selenium | third_party/js/mozmill/shared-modules/dom-utils.js | DOMWalker_walk | function DOMWalker_walk(ids, root, waitFunction) {
if (typeof waitFunction == 'function')
this._controller.waitFor(waitFunction());
if (!root)
root = this._controller.window.document.documentElement;
var resultsArray = this._walk(root);
if (typeof this._callbackResults == 'function')
this._callbackResults(this._controller, resultsArray);
if (ids)
this._prepareTargetWindows(ids);
} | javascript | function DOMWalker_walk(ids, root, waitFunction) {
if (typeof waitFunction == 'function')
this._controller.waitFor(waitFunction());
if (!root)
root = this._controller.window.document.documentElement;
var resultsArray = this._walk(root);
if (typeof this._callbackResults == 'function')
this._callbackResults(this._controller, resultsArray);
if (ids)
this._prepareTargetWindows(ids);
} | [
"function",
"DOMWalker_walk",
"(",
"ids",
",",
"root",
",",
"waitFunction",
")",
"{",
"if",
"(",
"typeof",
"waitFunction",
"==",
"'function'",
")",
"this",
".",
"_controller",
".",
"waitFor",
"(",
"waitFunction",
"(",
")",
")",
";",
"if",
"(",
"!",
"root... | The main DOMWalker function.
It start's the _walk-method for a given window or other dialog, runs
a callback to process the results for that window/dialog.
After that switches to provided new windows/dialogs.
@param {array of objects} ids
Contains informations on the elements to open while
Object-elements: getBy - attribute-name of the attribute
containing the identification
information for the opener-element
subContent - array of ids of the opener-elements
in the window with the value of
the above getBy-attribute
target - information, where the new
elements will be opened
[1|2|4]
title - title of the opened dialog/window
waitFunction - The function used as an argument
for MozmillController.waitFor to
wait before starting the walk.
[optional - default: no waiting]
windowHandler - Window instance
[only needed for some tests]
@param {Node} root
Node to start testing from
[optional - default: this._controller.window.document.documentElement]
@param {Function} waitFunction
The function used as an argument for MozmillController.waitFor to
wait before starting the walk.
[optional - default: no waiting] | [
"The",
"main",
"DOMWalker",
"function",
"."
] | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/dom-utils.js#L171-L185 | train | walks the DOM tree | [
30522,
3853,
14383,
26965,
1035,
3328,
1006,
8909,
2015,
1010,
7117,
1010,
3524,
11263,
27989,
1007,
1063,
2065,
1006,
2828,
11253,
3524,
11263,
27989,
1027,
1027,
1005,
3853,
1005,
1007,
2023,
1012,
1035,
11486,
1012,
3524,
29278,
1006,
35... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/core/Manifest.js | function(oInstance) {
// ensure that the instance count is never negative
var iInstanceCount = Math.max(this._iInstanceCount - 1, 0);
// deactivate the instance customizing
if (oInstance) {
this.deactivateCustomizing(oInstance);
}
if (iInstanceCount === 0) {
// deactivcate the customizing
this.deactivateCustomizing();
// remove the custom scripts and CSS files
this.removeIncludes();
}
this._iInstanceCount = iInstanceCount;
} | javascript | function(oInstance) {
// ensure that the instance count is never negative
var iInstanceCount = Math.max(this._iInstanceCount - 1, 0);
// deactivate the instance customizing
if (oInstance) {
this.deactivateCustomizing(oInstance);
}
if (iInstanceCount === 0) {
// deactivcate the customizing
this.deactivateCustomizing();
// remove the custom scripts and CSS files
this.removeIncludes();
}
this._iInstanceCount = iInstanceCount;
} | [
"function",
"(",
"oInstance",
")",
"{",
"// ensure that the instance count is never negative",
"var",
"iInstanceCount",
"=",
"Math",
".",
"max",
"(",
"this",
".",
"_iInstanceCount",
"-",
"1",
",",
"0",
")",
";",
"// deactivate the instance customizing",
"if",
"(",
"... | Terminates the manifest and does some final clean-up.
@private | [
"Terminates",
"the",
"manifest",
"and",
"does",
"some",
"final",
"clean",
"-",
"up",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Manifest.js#L664-L686 | train | deactivates the customizing of the given instance | [
30522,
3853,
1006,
1051,
7076,
26897,
1007,
1063,
1013,
1013,
5676,
2008,
1996,
6013,
4175,
2003,
2196,
4997,
13075,
2462,
23808,
6651,
3597,
16671,
1027,
8785,
1012,
4098,
1006,
2023,
1012,
1035,
2462,
23808,
6651,
3597,
16671,
1011,
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... | |
juliangarnier/anime | lib/anime.js | stagger | function stagger(val, params) {
if ( params === void 0 ) params = {};
var direction = params.direction || 'normal';
var easing = params.easing ? parseEasings(params.easing) : null;
var grid = params.grid;
var axis = params.axis;
var fromIndex = params.from || 0;
var fromFirst = fromIndex === 'first';
var fromCenter = fromIndex === 'center';
var fromLast = fromIndex === 'last';
var isRange = is.arr(val);
var val1 = isRange ? parseFloat(val[0]) : parseFloat(val);
var val2 = isRange ? parseFloat(val[1]) : 0;
var unit = getUnit(isRange ? val[1] : val) || 0;
var start = params.start || 0 + (isRange ? val1 : 0);
var values = [];
var maxValue = 0;
return function (el, i, t) {
if (fromFirst) { fromIndex = 0; }
if (fromCenter) { fromIndex = (t - 1) / 2; }
if (fromLast) { fromIndex = t - 1; }
if (!values.length) {
for (var index = 0; index < t; index++) {
if (!grid) {
values.push(Math.abs(fromIndex - index));
} else {
var fromX = !fromCenter ? fromIndex%grid[0] : (grid[0]-1)/2;
var fromY = !fromCenter ? Math.floor(fromIndex/grid[0]) : (grid[1]-1)/2;
var toX = index%grid[0];
var toY = Math.floor(index/grid[0]);
var distanceX = fromX - toX;
var distanceY = fromY - toY;
var value = Math.sqrt(distanceX * distanceX + distanceY * distanceY);
if (axis === 'x') { value = -distanceX; }
if (axis === 'y') { value = -distanceY; }
values.push(value);
}
maxValue = Math.max.apply(Math, values);
}
if (easing) { values = values.map(function (val) { return easing(val / maxValue) * maxValue; }); }
if (direction === 'reverse') { values = values.map(function (val) { return axis ? (val < 0) ? val * -1 : -val : Math.abs(maxValue - val); }); }
}
var spacing = isRange ? (val2 - val1) / maxValue : val1;
return start + (spacing * (Math.round(values[i] * 100) / 100)) + unit;
}
} | javascript | function stagger(val, params) {
if ( params === void 0 ) params = {};
var direction = params.direction || 'normal';
var easing = params.easing ? parseEasings(params.easing) : null;
var grid = params.grid;
var axis = params.axis;
var fromIndex = params.from || 0;
var fromFirst = fromIndex === 'first';
var fromCenter = fromIndex === 'center';
var fromLast = fromIndex === 'last';
var isRange = is.arr(val);
var val1 = isRange ? parseFloat(val[0]) : parseFloat(val);
var val2 = isRange ? parseFloat(val[1]) : 0;
var unit = getUnit(isRange ? val[1] : val) || 0;
var start = params.start || 0 + (isRange ? val1 : 0);
var values = [];
var maxValue = 0;
return function (el, i, t) {
if (fromFirst) { fromIndex = 0; }
if (fromCenter) { fromIndex = (t - 1) / 2; }
if (fromLast) { fromIndex = t - 1; }
if (!values.length) {
for (var index = 0; index < t; index++) {
if (!grid) {
values.push(Math.abs(fromIndex - index));
} else {
var fromX = !fromCenter ? fromIndex%grid[0] : (grid[0]-1)/2;
var fromY = !fromCenter ? Math.floor(fromIndex/grid[0]) : (grid[1]-1)/2;
var toX = index%grid[0];
var toY = Math.floor(index/grid[0]);
var distanceX = fromX - toX;
var distanceY = fromY - toY;
var value = Math.sqrt(distanceX * distanceX + distanceY * distanceY);
if (axis === 'x') { value = -distanceX; }
if (axis === 'y') { value = -distanceY; }
values.push(value);
}
maxValue = Math.max.apply(Math, values);
}
if (easing) { values = values.map(function (val) { return easing(val / maxValue) * maxValue; }); }
if (direction === 'reverse') { values = values.map(function (val) { return axis ? (val < 0) ? val * -1 : -val : Math.abs(maxValue - val); }); }
}
var spacing = isRange ? (val2 - val1) / maxValue : val1;
return start + (spacing * (Math.round(values[i] * 100) / 100)) + unit;
}
} | [
"function",
"stagger",
"(",
"val",
",",
"params",
")",
"{",
"if",
"(",
"params",
"===",
"void",
"0",
")",
"params",
"=",
"{",
"}",
";",
"var",
"direction",
"=",
"params",
".",
"direction",
"||",
"'normal'",
";",
"var",
"easing",
"=",
"params",
".",
... | Stagger helpers | [
"Stagger",
"helpers"
] | 875a3d6745d4bff2e4c6ffe0e2d24aac3bf8a45a | https://github.com/juliangarnier/anime/blob/875a3d6745d4bff2e4c6ffe0e2d24aac3bf8a45a/lib/anime.js#L1199-L1245 | train | Returns a function that takes an array of values and returns a function that takes an array of values and returns an array of values. | [
30522,
3853,
2358,
27609,
1006,
11748,
1010,
11498,
5244,
1007,
1063,
2065,
1006,
11498,
5244,
1027,
1027,
1027,
11675,
1014,
1007,
11498,
5244,
1027,
1063,
1065,
1025,
13075,
3257,
1027,
11498,
5244,
1012,
3257,
1064,
1064,
1005,
3671,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
heyui/heyui | src/plugins/popper/index.js | getReferenceOffsets | function getReferenceOffsets(state, popper, reference) {
var fixedPosition = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
var commonOffsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, reference);
return getOffsetRectRelativeToArbitraryNode(reference, commonOffsetParent, fixedPosition);
} | javascript | function getReferenceOffsets(state, popper, reference) {
var fixedPosition = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
var commonOffsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, reference);
return getOffsetRectRelativeToArbitraryNode(reference, commonOffsetParent, fixedPosition);
} | [
"function",
"getReferenceOffsets",
"(",
"state",
",",
"popper",
",",
"reference",
")",
"{",
"var",
"fixedPosition",
"=",
"arguments",
".",
"length",
">",
"3",
"&&",
"arguments",
"[",
"3",
"]",
"!==",
"undefined",
"?",
"arguments",
"[",
"3",
"]",
":",
"nu... | Get offsets to the reference element
@method
@memberof Popper.Utils
@param {Object} state
@param {Element} popper - the popper element
@param {Element} reference - the reference element (the popper will be relative to this)
@param {Element} fixedPosition - is in fixed position mode
@returns {Object} An object containing the offsets which will be applied to the popper | [
"Get",
"offsets",
"to",
"the",
"reference",
"element"
] | d5405d27d994151b676eb91c12b389316d7f6679 | https://github.com/heyui/heyui/blob/d5405d27d994151b676eb91c12b389316d7f6679/src/plugins/popper/index.js#L751-L756 | train | Get reference offsets relative to the popper | [
30522,
3853,
2131,
2890,
25523,
27475,
8454,
1006,
2110,
1010,
3769,
4842,
1010,
4431,
1007,
1063,
13075,
4964,
26994,
1027,
9918,
1012,
3091,
1028,
1017,
1004,
1004,
9918,
1031,
1017,
1033,
999,
1027,
1027,
6151,
28344,
1029,
9918,
1031,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
mozilla-services/react-jsonschema-form | src/components/widgets/SelectWidget.js | processValue | function processValue(schema, value) {
// "enum" is a reserved word, so only "type" and "items" can be destructured
const { type, items } = schema;
if (value === "") {
return undefined;
} else if (type === "array" && items && nums.has(items.type)) {
return value.map(asNumber);
} else if (type === "boolean") {
return value === "true";
} else if (type === "number") {
return asNumber(value);
}
// If type is undefined, but an enum is present, try and infer the type from
// the enum values
if (schema.enum) {
if (schema.enum.every(x => guessType(x) === "number")) {
return asNumber(value);
} else if (schema.enum.every(x => guessType(x) === "boolean")) {
return value === "true";
}
}
return value;
} | javascript | function processValue(schema, value) {
// "enum" is a reserved word, so only "type" and "items" can be destructured
const { type, items } = schema;
if (value === "") {
return undefined;
} else if (type === "array" && items && nums.has(items.type)) {
return value.map(asNumber);
} else if (type === "boolean") {
return value === "true";
} else if (type === "number") {
return asNumber(value);
}
// If type is undefined, but an enum is present, try and infer the type from
// the enum values
if (schema.enum) {
if (schema.enum.every(x => guessType(x) === "number")) {
return asNumber(value);
} else if (schema.enum.every(x => guessType(x) === "boolean")) {
return value === "true";
}
}
return value;
} | [
"function",
"processValue",
"(",
"schema",
",",
"value",
")",
"{",
"// \"enum\" is a reserved word, so only \"type\" and \"items\" can be destructured",
"const",
"{",
"type",
",",
"items",
"}",
"=",
"schema",
";",
"if",
"(",
"value",
"===",
"\"\"",
")",
"{",
"return... | This is a silly limitation in the DOM where option change event values are
always retrieved as strings. | [
"This",
"is",
"a",
"silly",
"limitation",
"in",
"the",
"DOM",
"where",
"option",
"change",
"event",
"values",
"are",
"always",
"retrieved",
"as",
"strings",
"."
] | 1ee343d4654a6d98ac08ece97330ce2a3f9f1de3 | https://github.com/mozilla-services/react-jsonschema-form/blob/1ee343d4654a6d98ac08ece97330ce2a3f9f1de3/src/components/widgets/SelectWidget.js#L12-L36 | train | Process a value | [
30522,
3853,
2832,
10175,
5657,
1006,
8040,
28433,
1010,
3643,
1007,
1063,
1013,
1013,
1000,
4372,
2819,
1000,
2003,
1037,
9235,
2773,
1010,
2061,
2069,
1000,
2828,
1000,
1998,
1000,
5167,
1000,
2064,
2022,
4078,
18300,
12165,
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... |
ColorlibHQ/AdminLTE | bower_components/jvectormap/lib/data-series.js | function(values) {
var max = Number.MIN_VALUE,
min = Number.MAX_VALUE,
val,
cc,
attrs = {};
if (!(this.scale instanceof jvm.OrdinalScale) && !(this.scale instanceof jvm.SimpleScale)) {
if (!this.params.min || !this.params.max) {
for (cc in values) {
val = parseFloat(values[cc]);
if (val > max) max = values[cc];
if (val < min) min = val;
}
if (!this.params.min) {
this.scale.setMin(min);
}
if (!this.params.max) {
this.scale.setMax(max);
}
this.params.min = min;
this.params.max = max;
}
for (cc in values) {
val = parseFloat(values[cc]);
if (!isNaN(val)) {
attrs[cc] = this.scale.getValue(val);
} else {
attrs[cc] = this.elements[cc].element.style.initial[this.params.attribute];
}
}
} else {
for (cc in values) {
if (values[cc]) {
attrs[cc] = this.scale.getValue(values[cc]);
} else {
attrs[cc] = this.elements[cc].element.style.initial[this.params.attribute];
}
}
}
this.setAttributes(attrs);
jvm.$.extend(this.values, values);
} | javascript | function(values) {
var max = Number.MIN_VALUE,
min = Number.MAX_VALUE,
val,
cc,
attrs = {};
if (!(this.scale instanceof jvm.OrdinalScale) && !(this.scale instanceof jvm.SimpleScale)) {
if (!this.params.min || !this.params.max) {
for (cc in values) {
val = parseFloat(values[cc]);
if (val > max) max = values[cc];
if (val < min) min = val;
}
if (!this.params.min) {
this.scale.setMin(min);
}
if (!this.params.max) {
this.scale.setMax(max);
}
this.params.min = min;
this.params.max = max;
}
for (cc in values) {
val = parseFloat(values[cc]);
if (!isNaN(val)) {
attrs[cc] = this.scale.getValue(val);
} else {
attrs[cc] = this.elements[cc].element.style.initial[this.params.attribute];
}
}
} else {
for (cc in values) {
if (values[cc]) {
attrs[cc] = this.scale.getValue(values[cc]);
} else {
attrs[cc] = this.elements[cc].element.style.initial[this.params.attribute];
}
}
}
this.setAttributes(attrs);
jvm.$.extend(this.values, values);
} | [
"function",
"(",
"values",
")",
"{",
"var",
"max",
"=",
"Number",
".",
"MIN_VALUE",
",",
"min",
"=",
"Number",
".",
"MAX_VALUE",
",",
"val",
",",
"cc",
",",
"attrs",
"=",
"{",
"}",
";",
"if",
"(",
"!",
"(",
"this",
".",
"scale",
"instanceof",
"jv... | Set values for the data set.
@param {Object} values Object which maps codes of regions or markers to values. | [
"Set",
"values",
"for",
"the",
"data",
"set",
"."
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/bower_components/jvectormap/lib/data-series.js#L60-L103 | train | Sets the values of the parameters | [
30522,
3853,
1006,
5300,
1007,
1063,
13075,
4098,
1027,
2193,
1012,
8117,
1035,
3643,
1010,
8117,
1027,
2193,
1012,
4098,
1035,
3643,
1010,
11748,
1010,
10507,
1010,
2012,
16344,
2015,
1027,
1063,
1065,
1025,
2065,
1006,
30524,
15782,
2571,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/view/WorkspaceManager.js | getAllPanelIDs | function getAllPanelIDs() {
var property, panelIDs = [];
for (property in panelIDMap) {
if (panelIDMap.hasOwnProperty(property)) {
panelIDs.push(property);
}
}
return panelIDs;
} | javascript | function getAllPanelIDs() {
var property, panelIDs = [];
for (property in panelIDMap) {
if (panelIDMap.hasOwnProperty(property)) {
panelIDs.push(property);
}
}
return panelIDs;
} | [
"function",
"getAllPanelIDs",
"(",
")",
"{",
"var",
"property",
",",
"panelIDs",
"=",
"[",
"]",
";",
"for",
"(",
"property",
"in",
"panelIDMap",
")",
"{",
"if",
"(",
"panelIDMap",
".",
"hasOwnProperty",
"(",
"property",
")",
")",
"{",
"panelIDs",
".",
... | Returns an array of all panel ID's
@returns {Array} List of ID's of all bottom panels | [
"Returns",
"an",
"array",
"of",
"all",
"panel",
"ID",
"s"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/view/WorkspaceManager.js#L242-L250 | train | Get all panelIDs | [
30522,
3853,
2131,
8095,
9739,
20806,
5104,
1006,
1007,
1063,
13075,
3200,
1010,
5997,
9821,
1027,
1031,
1033,
1025,
2005,
1006,
3200,
1999,
5997,
3593,
2863,
2361,
1007,
1063,
2065,
1006,
5997,
3593,
2863,
2361,
1012,
2038,
12384,
21572,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/editor/EditorManager.js | _createEditorForDocument | function _createEditorForDocument(doc, makeMasterEditor, container, range, editorOptions) {
var editor = new Editor(doc, makeMasterEditor, container, range, editorOptions);
editor.on("focus", function () {
_notifyActiveEditorChanged(editor);
});
editor.on("beforeDestroy", function () {
if (editor.$el.is(":visible")) {
_saveEditorViewState(editor);
}
});
return editor;
} | javascript | function _createEditorForDocument(doc, makeMasterEditor, container, range, editorOptions) {
var editor = new Editor(doc, makeMasterEditor, container, range, editorOptions);
editor.on("focus", function () {
_notifyActiveEditorChanged(editor);
});
editor.on("beforeDestroy", function () {
if (editor.$el.is(":visible")) {
_saveEditorViewState(editor);
}
});
return editor;
} | [
"function",
"_createEditorForDocument",
"(",
"doc",
",",
"makeMasterEditor",
",",
"container",
",",
"range",
",",
"editorOptions",
")",
"{",
"var",
"editor",
"=",
"new",
"Editor",
"(",
"doc",
",",
"makeMasterEditor",
",",
"container",
",",
"range",
",",
"edito... | Creates a new Editor bound to the given Document.
The editor is appended to the given container as a visible child.
@private
@param {!Document} doc Document for the Editor's content
@param {!boolean} makeMasterEditor If true, the Editor will set itself as the private "master"
Editor for the Document. If false, the Editor will attach to the Document as a "slave."
@param {!jQueryObject} container Container to add the editor to.
@param {{startLine: number, endLine: number}=} range If specified, range of lines within the document
to display in this editor. Inclusive.
@param {!Object} editorOptions If specified, contains editor options that can be passed to CodeMirror
@return {Editor} the newly created editor. | [
"Creates",
"a",
"new",
"Editor",
"bound",
"to",
"the",
"given",
"Document",
".",
"The",
"editor",
"is",
"appended",
"to",
"the",
"given",
"container",
"as",
"a",
"visible",
"child",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/editor/EditorManager.js#L185-L199 | train | Creates an editor for a document | [
30522,
3853,
1035,
3443,
2098,
15660,
3877,
10085,
27417,
2102,
1006,
9986,
1010,
2191,
8706,
2098,
15660,
1010,
11661,
1010,
2846,
1010,
3559,
7361,
9285,
1007,
1063,
13075,
3559,
1027,
2047,
3559,
1006,
9986,
1010,
2191,
8706,
2098,
15660... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/flow | packages/flow-remove-types/index.js | space | function space(size) {
var sp = ' ';
var result = '';
for (;;) {
if ((size & 1) === 1) {
result += sp;
}
size >>>= 1;
if (size === 0) {
break;
}
sp += sp;
}
return result;
} | javascript | function space(size) {
var sp = ' ';
var result = '';
for (;;) {
if ((size & 1) === 1) {
result += sp;
}
size >>>= 1;
if (size === 0) {
break;
}
sp += sp;
}
return result;
} | [
"function",
"space",
"(",
"size",
")",
"{",
"var",
"sp",
"=",
"' '",
";",
"var",
"result",
"=",
"''",
";",
"for",
"(",
";",
";",
")",
"{",
"if",
"(",
"(",
"size",
"&",
"1",
")",
"===",
"1",
")",
"{",
"result",
"+=",
"sp",
";",
"}",
"size",
... | Produce a string full of space characters of a given size. | [
"Produce",
"a",
"string",
"full",
"of",
"space",
"characters",
"of",
"a",
"given",
"size",
"."
] | 25bc6aba258658eaf21ccc4722ef7124724a1d2b | https://github.com/facebook/flow/blob/25bc6aba258658eaf21ccc4722ef7124724a1d2b/packages/flow-remove-types/index.js#L519-L534 | train | Returns a space for the specified size | [
30522,
3853,
2686,
1006,
2946,
1007,
1063,
13075,
11867,
1027,
1005,
1005,
1025,
13075,
2765,
1027,
1005,
1005,
1025,
2005,
1006,
1025,
1025,
1007,
1063,
2065,
1006,
1006,
2946,
1004,
1015,
1007,
1027,
1027,
1027,
1015,
1007,
1063,
2765,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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-element-newline.js | normalizeOptionValue | function normalizeOptionValue(providedOption) {
let consistent = false;
let multiline = false;
let minItems;
const option = providedOption || "always";
if (!option || option === "always" || option.minItems === 0) {
minItems = 0;
} else if (option === "never") {
minItems = Number.POSITIVE_INFINITY;
} else if (option === "consistent") {
consistent = true;
minItems = Number.POSITIVE_INFINITY;
} else {
multiline = Boolean(option.multiline);
minItems = option.minItems || Number.POSITIVE_INFINITY;
}
return { consistent, multiline, minItems };
} | javascript | function normalizeOptionValue(providedOption) {
let consistent = false;
let multiline = false;
let minItems;
const option = providedOption || "always";
if (!option || option === "always" || option.minItems === 0) {
minItems = 0;
} else if (option === "never") {
minItems = Number.POSITIVE_INFINITY;
} else if (option === "consistent") {
consistent = true;
minItems = Number.POSITIVE_INFINITY;
} else {
multiline = Boolean(option.multiline);
minItems = option.minItems || Number.POSITIVE_INFINITY;
}
return { consistent, multiline, minItems };
} | [
"function",
"normalizeOptionValue",
"(",
"providedOption",
")",
"{",
"let",
"consistent",
"=",
"false",
";",
"let",
"multiline",
"=",
"false",
";",
"let",
"minItems",
";",
"const",
"option",
"=",
"providedOption",
"||",
"\"always\"",
";",
"if",
"(",
"!",
"op... | ---------------------------------------------------------------------- Helpers ----------------------------------------------------------------------
Normalizes a given option value.
@param {string|Object|undefined} providedOption - An option value to parse.
@returns {{multiline: boolean, minItems: number}} Normalized option object. | [
"----------------------------------------------------------------------",
"Helpers",
"----------------------------------------------------------------------",
"Normalizes",
"a",
"given",
"option",
"value",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/array-element-newline.js#L69-L89 | train | Normalizes the provided option value. | [
30522,
3853,
3671,
4697,
7361,
3508,
10175,
5657,
1006,
3024,
7361,
3508,
1007,
1063,
2292,
8335,
1027,
6270,
1025,
2292,
4800,
4179,
1027,
6270,
1025,
2292,
7163,
18532,
2015,
1025,
9530,
3367,
5724,
1027,
3024,
7361,
3508,
1064,
1064,
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... |
tgriesser/knex | src/query/builder.js | Builder | function Builder(client) {
this.client = client;
this.and = this;
this._single = {};
this._statements = [];
this._method = 'select';
if (client.config) {
saveAsyncStack(this, 5);
this._debug = client.config.debug;
}
// Internal flags used in the builder.
this._joinFlag = 'inner';
this._boolFlag = 'and';
this._notFlag = false;
this._asColumnFlag = false;
} | javascript | function Builder(client) {
this.client = client;
this.and = this;
this._single = {};
this._statements = [];
this._method = 'select';
if (client.config) {
saveAsyncStack(this, 5);
this._debug = client.config.debug;
}
// Internal flags used in the builder.
this._joinFlag = 'inner';
this._boolFlag = 'and';
this._notFlag = false;
this._asColumnFlag = false;
} | [
"function",
"Builder",
"(",
"client",
")",
"{",
"this",
".",
"client",
"=",
"client",
";",
"this",
".",
"and",
"=",
"this",
";",
"this",
".",
"_single",
"=",
"{",
"}",
";",
"this",
".",
"_statements",
"=",
"[",
"]",
";",
"this",
".",
"_method",
"... | Typically called from `knex.builder`, start a new query building chain. | [
"Typically",
"called",
"from",
"knex",
".",
"builder",
"start",
"a",
"new",
"query",
"building",
"chain",
"."
] | 6a4fecfe7822442ee5c43d924958eadfe6e17a93 | https://github.com/tgriesser/knex/blob/6a4fecfe7822442ee5c43d924958eadfe6e17a93/src/query/builder.js#L30-L45 | train | A builder for a query. | [
30522,
3853,
12508,
1006,
7396,
1007,
1063,
2023,
1012,
7396,
1027,
7396,
1025,
2023,
1012,
1998,
1027,
2023,
1025,
2023,
1012,
1035,
2309,
1027,
1063,
1065,
1025,
2023,
1012,
1035,
8635,
1027,
1031,
1033,
1025,
2023,
1012,
1035,
4118,
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... |
jgraph/mxgraph | javascript/mxClient.js | function(doc, node, allChildren)
{
if (mxClient.IS_IE && (document.documentMode == null || document.documentMode < 10))
{
switch (node.nodeType)
{
case 1: /* element */
{
var newNode = doc.createElement(node.nodeName);
if (node.attributes && node.attributes.length > 0)
{
for (var i = 0; i < node.attributes.length; i++)
{
newNode.setAttribute(node.attributes[i].nodeName,
node.getAttribute(node.attributes[i].nodeName));
}
if (allChildren && node.childNodes && node.childNodes.length > 0)
{
for (var i = 0; i < node.childNodes.length; i++)
{
newNode.appendChild(mxUtils.importNode(doc, node.childNodes[i], allChildren));
}
}
}
return newNode;
break;
}
case 3: /* text */
case 4: /* cdata-section */
case 8: /* comment */
{
return doc.createTextNode(node.value);
break;
}
};
}
else
{
return doc.importNode(node, allChildren);
}
} | javascript | function(doc, node, allChildren)
{
if (mxClient.IS_IE && (document.documentMode == null || document.documentMode < 10))
{
switch (node.nodeType)
{
case 1: /* element */
{
var newNode = doc.createElement(node.nodeName);
if (node.attributes && node.attributes.length > 0)
{
for (var i = 0; i < node.attributes.length; i++)
{
newNode.setAttribute(node.attributes[i].nodeName,
node.getAttribute(node.attributes[i].nodeName));
}
if (allChildren && node.childNodes && node.childNodes.length > 0)
{
for (var i = 0; i < node.childNodes.length; i++)
{
newNode.appendChild(mxUtils.importNode(doc, node.childNodes[i], allChildren));
}
}
}
return newNode;
break;
}
case 3: /* text */
case 4: /* cdata-section */
case 8: /* comment */
{
return doc.createTextNode(node.value);
break;
}
};
}
else
{
return doc.importNode(node, allChildren);
}
} | [
"function",
"(",
"doc",
",",
"node",
",",
"allChildren",
")",
"{",
"if",
"(",
"mxClient",
".",
"IS_IE",
"&&",
"(",
"document",
".",
"documentMode",
"==",
"null",
"||",
"document",
".",
"documentMode",
"<",
"10",
")",
")",
"{",
"switch",
"(",
"node",
... | Function: importNode
Cross browser implementation for document.importNode. Uses document.importNode
in all browsers but IE, where the node is cloned by creating a new node and
copying all attributes and children into it using importNode, recursively.
Parameters:
doc - Document to import the node into.
node - Node to be imported.
allChildren - If all children should be imported. | [
"Function",
":",
"importNode"
] | 33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44 | https://github.com/jgraph/mxgraph/blob/33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44/javascript/mxClient.js#L2663-L2706 | train | Imports a node | [
30522,
3853,
1006,
9986,
1010,
13045,
1010,
2035,
19339,
7389,
1007,
1063,
2065,
1006,
25630,
20464,
11638,
1012,
2003,
1035,
29464,
1004,
1004,
1006,
6254,
1012,
6254,
5302,
3207,
1027,
1027,
19701,
1064,
1064,
6254,
1012,
6254,
5302,
3207... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 | lib/services/s3.js | function(buckets) {
var bucketRegionCache = this.bucketRegionCache;
if (!buckets) {
buckets = Object.keys(bucketRegionCache);
} else if (typeof buckets === 'string') {
buckets = [buckets];
}
for (var i = 0; i < buckets.length; i++) {
delete bucketRegionCache[buckets[i]];
}
return bucketRegionCache;
} | javascript | function(buckets) {
var bucketRegionCache = this.bucketRegionCache;
if (!buckets) {
buckets = Object.keys(bucketRegionCache);
} else if (typeof buckets === 'string') {
buckets = [buckets];
}
for (var i = 0; i < buckets.length; i++) {
delete bucketRegionCache[buckets[i]];
}
return bucketRegionCache;
} | [
"function",
"(",
"buckets",
")",
"{",
"var",
"bucketRegionCache",
"=",
"this",
".",
"bucketRegionCache",
";",
"if",
"(",
"!",
"buckets",
")",
"{",
"buckets",
"=",
"Object",
".",
"keys",
"(",
"bucketRegionCache",
")",
";",
"}",
"else",
"if",
"(",
"typeof"... | Clears bucket region cache.
@api private | [
"Clears",
"bucket",
"region",
"cache",
"."
] | c23e5f0edd150f8885267e5f7c8a564f8e6e8562 | https://github.com/aws/aws-sdk-js/blob/c23e5f0edd150f8885267e5f7c8a564f8e6e8562/lib/services/s3.js#L685-L696 | train | Returns region cache for the given buckets | [
30522,
3853,
1006,
13610,
2015,
1007,
1063,
13075,
13610,
23784,
3540,
5403,
1027,
2023,
1012,
13610,
23784,
3540,
5403,
1025,
2065,
1006,
999,
13610,
2015,
1007,
1063,
13610,
2015,
1027,
4874,
1012,
6309,
1006,
13610,
23784,
3540,
5403,
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.codeeditor/src/sap/ui/codeeditor/js/ace/worker-javascript.js | each | function each(obj, cb) {
if (!obj)
return;
if (!Array.isArray(obj) && typeof obj === "object")
obj = Object.keys(obj);
obj.forEach(cb);
} | javascript | function each(obj, cb) {
if (!obj)
return;
if (!Array.isArray(obj) && typeof obj === "object")
obj = Object.keys(obj);
obj.forEach(cb);
} | [
"function",
"each",
"(",
"obj",
",",
"cb",
")",
"{",
"if",
"(",
"!",
"obj",
")",
"return",
";",
"if",
"(",
"!",
"Array",
".",
"isArray",
"(",
"obj",
")",
"&&",
"typeof",
"obj",
"===",
"\"object\"",
")",
"obj",
"=",
"Object",
".",
"keys",
"(",
"... | Variables that live outside the current file | [
"Variables",
"that",
"live",
"outside",
"the",
"current",
"file"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.codeeditor/src/sap/ui/codeeditor/js/ace/worker-javascript.js#L7837-L7845 | train | Iterate over the objects in the cache | [
30522,
3853,
2169,
1006,
27885,
3501,
1010,
17324,
1007,
1063,
2065,
1006,
999,
27885,
3501,
1007,
2709,
1025,
2065,
1006,
999,
9140,
1012,
18061,
11335,
2100,
1006,
27885,
3501,
1007,
1004,
1004,
2828,
11253,
27885,
3501,
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... |
goldfire/howler.js | dist/howler.js | function() {
var self = this;
var parent = self._parent;
var volume = (Howler._muted || self._muted || self._parent._muted) ? 0 : self._volume;
if (parent._webAudio) {
// Create the gain node for controlling volume (the source will connect to this).
self._node = (typeof Howler.ctx.createGain === 'undefined') ? Howler.ctx.createGainNode() : Howler.ctx.createGain();
self._node.gain.setValueAtTime(volume, Howler.ctx.currentTime);
self._node.paused = true;
self._node.connect(Howler.masterGain);
} else {
// Get an unlocked Audio object from the pool.
self._node = Howler._obtainHtml5Audio();
// Listen for errors (http://dev.w3.org/html5/spec-author-view/spec.html#mediaerror).
self._errorFn = self._errorListener.bind(self);
self._node.addEventListener('error', self._errorFn, false);
// Listen for 'canplaythrough' event to let us know the sound is ready.
self._loadFn = self._loadListener.bind(self);
self._node.addEventListener(Howler._canPlayEvent, self._loadFn, false);
// Setup the new audio node.
self._node.src = parent._src;
self._node.preload = 'auto';
self._node.volume = volume * Howler.volume();
// Begin loading the source.
self._node.load();
}
return self;
} | javascript | function() {
var self = this;
var parent = self._parent;
var volume = (Howler._muted || self._muted || self._parent._muted) ? 0 : self._volume;
if (parent._webAudio) {
// Create the gain node for controlling volume (the source will connect to this).
self._node = (typeof Howler.ctx.createGain === 'undefined') ? Howler.ctx.createGainNode() : Howler.ctx.createGain();
self._node.gain.setValueAtTime(volume, Howler.ctx.currentTime);
self._node.paused = true;
self._node.connect(Howler.masterGain);
} else {
// Get an unlocked Audio object from the pool.
self._node = Howler._obtainHtml5Audio();
// Listen for errors (http://dev.w3.org/html5/spec-author-view/spec.html#mediaerror).
self._errorFn = self._errorListener.bind(self);
self._node.addEventListener('error', self._errorFn, false);
// Listen for 'canplaythrough' event to let us know the sound is ready.
self._loadFn = self._loadListener.bind(self);
self._node.addEventListener(Howler._canPlayEvent, self._loadFn, false);
// Setup the new audio node.
self._node.src = parent._src;
self._node.preload = 'auto';
self._node.volume = volume * Howler.volume();
// Begin loading the source.
self._node.load();
}
return self;
} | [
"function",
"(",
")",
"{",
"var",
"self",
"=",
"this",
";",
"var",
"parent",
"=",
"self",
".",
"_parent",
";",
"var",
"volume",
"=",
"(",
"Howler",
".",
"_muted",
"||",
"self",
".",
"_muted",
"||",
"self",
".",
"_parent",
".",
"_muted",
")",
"?",
... | Create and setup a new sound object, whether HTML5 Audio or Web Audio.
@return {Sound} | [
"Create",
"and",
"setup",
"a",
"new",
"sound",
"object",
"whether",
"HTML5",
"Audio",
"or",
"Web",
"Audio",
"."
] | 030db918dd8ce640afd57e172418472497e8f113 | https://github.com/goldfire/howler.js/blob/030db918dd8ce640afd57e172418472497e8f113/dist/howler.js#L2194-L2227 | train | Sets the volume of the sound. | [
30522,
3853,
1006,
1007,
1063,
13075,
2969,
1027,
2023,
1025,
13075,
6687,
1027,
2969,
1012,
1035,
6687,
1025,
13075,
3872,
1027,
1006,
22912,
2121,
1012,
1035,
22124,
1064,
1064,
2969,
1012,
1035,
22124,
1064,
1064,
2969,
1012,
1035,
6687,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 | mxSvgCanvas2D | function mxSvgCanvas2D(root, styleEnabled)
{
mxAbstractCanvas2D.call(this);
/**
* Variable: root
*
* Reference to the container for the SVG content.
*/
this.root = root;
/**
* Variable: gradients
*
* Local cache of gradients for quick lookups.
*/
this.gradients = [];
/**
* Variable: defs
*
* Reference to the defs section of the SVG document. Only for export.
*/
this.defs = null;
/**
* Variable: styleEnabled
*
* Stores the value of styleEnabled passed to the constructor.
*/
this.styleEnabled = (styleEnabled != null) ? styleEnabled : false;
var svg = null;
// Adds optional defs section for export
if (root.ownerDocument != document)
{
var node = root;
// Finds owner SVG element in XML DOM
while (node != null && node.nodeName != 'svg')
{
node = node.parentNode;
}
svg = node;
}
if (svg != null)
{
// Tries to get existing defs section
var tmp = svg.getElementsByTagName('defs');
if (tmp.length > 0)
{
this.defs = svg.getElementsByTagName('defs')[0];
}
// Adds defs section if none exists
if (this.defs == null)
{
this.defs = this.createElement('defs');
if (svg.firstChild != null)
{
svg.insertBefore(this.defs, svg.firstChild);
}
else
{
svg.appendChild(this.defs);
}
}
// Adds stylesheet
if (this.styleEnabled)
{
this.defs.appendChild(this.createStyle());
}
}
} | javascript | function mxSvgCanvas2D(root, styleEnabled)
{
mxAbstractCanvas2D.call(this);
/**
* Variable: root
*
* Reference to the container for the SVG content.
*/
this.root = root;
/**
* Variable: gradients
*
* Local cache of gradients for quick lookups.
*/
this.gradients = [];
/**
* Variable: defs
*
* Reference to the defs section of the SVG document. Only for export.
*/
this.defs = null;
/**
* Variable: styleEnabled
*
* Stores the value of styleEnabled passed to the constructor.
*/
this.styleEnabled = (styleEnabled != null) ? styleEnabled : false;
var svg = null;
// Adds optional defs section for export
if (root.ownerDocument != document)
{
var node = root;
// Finds owner SVG element in XML DOM
while (node != null && node.nodeName != 'svg')
{
node = node.parentNode;
}
svg = node;
}
if (svg != null)
{
// Tries to get existing defs section
var tmp = svg.getElementsByTagName('defs');
if (tmp.length > 0)
{
this.defs = svg.getElementsByTagName('defs')[0];
}
// Adds defs section if none exists
if (this.defs == null)
{
this.defs = this.createElement('defs');
if (svg.firstChild != null)
{
svg.insertBefore(this.defs, svg.firstChild);
}
else
{
svg.appendChild(this.defs);
}
}
// Adds stylesheet
if (this.styleEnabled)
{
this.defs.appendChild(this.createStyle());
}
}
} | [
"function",
"mxSvgCanvas2D",
"(",
"root",
",",
"styleEnabled",
")",
"{",
"mxAbstractCanvas2D",
".",
"call",
"(",
"this",
")",
";",
"/**\n\t * Variable: root\n\t * \n\t * Reference to the container for the SVG content.\n\t */",
"this",
".",
"root",
"=",
"root",
";",
"/**\n... | Copyright (c) 2006-2015, JGraph Ltd
Copyright (c) 2006-2015, Gaudenz Alder
Class: mxSvgCanvas2D
Extends <mxAbstractCanvas2D> to implement a canvas for SVG. This canvas writes all
calls as SVG output to the given SVG root node.
(code)
var svgDoc = mxUtils.createXmlDocument();
var root = (svgDoc.createElementNS != null) ?
svgDoc.createElementNS(mxConstants.NS_SVG, 'svg') : svgDoc.createElement('svg');
if (svgDoc.createElementNS == null)
{
root.setAttribute('xmlns', mxConstants.NS_SVG);
root.setAttribute('xmlns:xlink', mxConstants.NS_XLINK);
}
else
{
root.setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:xlink', mxConstants.NS_XLINK);
}
var bounds = graph.getGraphBounds();
root.setAttribute('width', (bounds.x + bounds.width + 4) + 'px');
root.setAttribute('height', (bounds.y + bounds.height + 4) + 'px');
root.setAttribute('version', '1.1');
svgDoc.appendChild(root);
var svgCanvas = new mxSvgCanvas2D(root);
(end)
A description of the public API is available in <mxXmlCanvas2D>.
To disable anti-aliasing in the output, use the following code.
(code)
graph.view.canvas.ownerSVGElement.setAttribute('shape-rendering', 'crispEdges');
(end)
Or set the respective attribute in the SVG element directly.
Constructor: mxSvgCanvas2D
Constructs a new SVG canvas.
Parameters:
root - SVG container for the output.
styleEnabled - Optional boolean that specifies if a style section should be
added. The style section sets the default font-size, font-family and
stroke-miterlimit globally. Default is false. | [
"Copyright",
"(",
"c",
")",
"2006",
"-",
"2015",
"JGraph",
"Ltd",
"Copyright",
"(",
"c",
")",
"2006",
"-",
"2015",
"Gaudenz",
"Alder",
"Class",
":",
"mxSvgCanvas2D"
] | 33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44 | https://github.com/jgraph/mxgraph/blob/33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44/javascript/mxClient.js#L18459-L18538 | train | The SVG Canvas2D constructor. | [
30522,
3853,
25630,
2015,
2615,
18195,
2319,
12044,
2475,
2094,
1006,
7117,
1010,
2806,
8189,
23242,
1007,
1063,
25630,
30524,
2023,
1012,
7117,
1027,
7117,
1025,
1013,
1008,
1008,
1008,
8023,
1024,
17978,
2015,
1008,
1008,
2334,
17053,
199... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/map/mapDataStatistic.js | dataStatistics | function dataStatistics(datas, statisticType) {
var dataNameMap = {};
zrUtil.each(datas, function (data) {
data.each(data.mapDimension('value'), function (value, idx) {
// Add prefix to avoid conflict with Object.prototype.
var mapKey = 'ec-' + data.getName(idx);
dataNameMap[mapKey] = dataNameMap[mapKey] || [];
if (!isNaN(value)) {
dataNameMap[mapKey].push(value);
}
});
});
return datas[0].map(datas[0].mapDimension('value'), function (value, idx) {
var mapKey = 'ec-' + datas[0].getName(idx);
var sum = 0;
var min = Infinity;
var max = -Infinity;
var len = dataNameMap[mapKey].length;
for (var i = 0; i < len; i++) {
min = Math.min(min, dataNameMap[mapKey][i]);
max = Math.max(max, dataNameMap[mapKey][i]);
sum += dataNameMap[mapKey][i];
}
var result;
if (statisticType === 'min') {
result = min;
}
else if (statisticType === 'max') {
result = max;
}
else if (statisticType === 'average') {
result = sum / len;
}
else {
result = sum;
}
return len === 0 ? NaN : result;
});
} | javascript | function dataStatistics(datas, statisticType) {
var dataNameMap = {};
zrUtil.each(datas, function (data) {
data.each(data.mapDimension('value'), function (value, idx) {
// Add prefix to avoid conflict with Object.prototype.
var mapKey = 'ec-' + data.getName(idx);
dataNameMap[mapKey] = dataNameMap[mapKey] || [];
if (!isNaN(value)) {
dataNameMap[mapKey].push(value);
}
});
});
return datas[0].map(datas[0].mapDimension('value'), function (value, idx) {
var mapKey = 'ec-' + datas[0].getName(idx);
var sum = 0;
var min = Infinity;
var max = -Infinity;
var len = dataNameMap[mapKey].length;
for (var i = 0; i < len; i++) {
min = Math.min(min, dataNameMap[mapKey][i]);
max = Math.max(max, dataNameMap[mapKey][i]);
sum += dataNameMap[mapKey][i];
}
var result;
if (statisticType === 'min') {
result = min;
}
else if (statisticType === 'max') {
result = max;
}
else if (statisticType === 'average') {
result = sum / len;
}
else {
result = sum;
}
return len === 0 ? NaN : result;
});
} | [
"function",
"dataStatistics",
"(",
"datas",
",",
"statisticType",
")",
"{",
"var",
"dataNameMap",
"=",
"{",
"}",
";",
"zrUtil",
".",
"each",
"(",
"datas",
",",
"function",
"(",
"data",
")",
"{",
"data",
".",
"each",
"(",
"data",
".",
"mapDimension",
"(... | FIXME 公用?
@param {Array.<module:echarts/data/List>} datas
@param {string} statisticType 'average' 'sum'
@inner | [
"FIXME",
"公用?"
] | 4d0ea095dc3929cb6de40c45748826e7999c7aa8 | https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/chart/map/mapDataStatistic.js#L28-L68 | train | Get statistics for data | [
30522,
3853,
2951,
9153,
16774,
6558,
1006,
2951,
2015,
1010,
28093,
6553,
13874,
1007,
1063,
13075,
2951,
18442,
2863,
2361,
1027,
1063,
1065,
1025,
1062,
22134,
4014,
1012,
2169,
1006,
2951,
2015,
1010,
3853,
1006,
2951,
1007,
1063,
2951,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/hyphenation/Hyphenation.js | checkCSSHyphensSupport | function checkCSSHyphensSupport(oElement) {
return (
oElement.style.hyphens === "auto" ||
oElement.style.webkitHyphens === "auto" ||
oElement.style.msHyphens === "auto" ||
oElement.style["-moz-hyphens"] === "auto"
);
} | javascript | function checkCSSHyphensSupport(oElement) {
return (
oElement.style.hyphens === "auto" ||
oElement.style.webkitHyphens === "auto" ||
oElement.style.msHyphens === "auto" ||
oElement.style["-moz-hyphens"] === "auto"
);
} | [
"function",
"checkCSSHyphensSupport",
"(",
"oElement",
")",
"{",
"return",
"(",
"oElement",
".",
"style",
".",
"hyphens",
"===",
"\"auto\"",
"||",
"oElement",
".",
"style",
".",
"webkitHyphens",
"===",
"\"auto\"",
"||",
"oElement",
".",
"style",
".",
"msHyphen... | Checks if hyphens (ev.prefixed) is set to auto for the element.
@param {Element} oElement The element with applied <code>hyphens=auto</code> styles
@returns {boolean} The result of the check
@private | [
"Checks",
"if",
"hyphens",
"(",
"ev",
".",
"prefixed",
")",
"is",
"set",
"to",
"auto",
"for",
"the",
"element",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/hyphenation/Hyphenation.js#L332-L339 | train | Checks if the element has a CSS hyphens property | [
30522,
3853,
4638,
6169,
4095,
22571,
10222,
4757,
6279,
6442,
1006,
1051,
12260,
3672,
1007,
1063,
2709,
1006,
1051,
12260,
3672,
1012,
2806,
1012,
1044,
22571,
10222,
2015,
1027,
1027,
1027,
1000,
8285,
1000,
1064,
1064,
1051,
12260,
3672... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/view/MainViewManager.js | _updateLayout | function _updateLayout(event, viewAreaHeight, forceRefresh) {
var available;
if (_orientation === VERTICAL) {
available = _$el.innerWidth();
} else {
available = _$el.innerHeight();
}
_.forEach(_panes, function (pane) {
// For VERTICAL orientation, we set the second pane to be width: auto
// so that it resizes to fill the available space in the containing div
// unfortunately, that doesn't work in the HORIZONTAL orientation so we
// must update the height and convert it into a percentage
if (pane.id === SECOND_PANE && _orientation === HORIZONTAL) {
var percentage = ((_panes[FIRST_PANE].$el.height() + 1) / available);
pane.$el.css("height", 100 - (percentage * 100) + "%");
}
_synchronizePaneSize(pane, forceRefresh);
});
} | javascript | function _updateLayout(event, viewAreaHeight, forceRefresh) {
var available;
if (_orientation === VERTICAL) {
available = _$el.innerWidth();
} else {
available = _$el.innerHeight();
}
_.forEach(_panes, function (pane) {
// For VERTICAL orientation, we set the second pane to be width: auto
// so that it resizes to fill the available space in the containing div
// unfortunately, that doesn't work in the HORIZONTAL orientation so we
// must update the height and convert it into a percentage
if (pane.id === SECOND_PANE && _orientation === HORIZONTAL) {
var percentage = ((_panes[FIRST_PANE].$el.height() + 1) / available);
pane.$el.css("height", 100 - (percentage * 100) + "%");
}
_synchronizePaneSize(pane, forceRefresh);
});
} | [
"function",
"_updateLayout",
"(",
"event",
",",
"viewAreaHeight",
",",
"forceRefresh",
")",
"{",
"var",
"available",
";",
"if",
"(",
"_orientation",
"===",
"VERTICAL",
")",
"{",
"available",
"=",
"_$el",
".",
"innerWidth",
"(",
")",
";",
"}",
"else",
"{",
... | Event handler for "workspaceUpdateLayout" to update the layout
@param {jQuery.Event} event - jQuery event object
@param {number} viewAreaHeight - unused
@param {boolean} forceRefresh - true to force a resize and refresh of the entire view
@private | [
"Event",
"handler",
"for",
"workspaceUpdateLayout",
"to",
"update",
"the",
"layout"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/view/MainViewManager.js#L1020-L1041 | train | Update the layout of the pane | [
30522,
3853,
1035,
10651,
8485,
5833,
1006,
2724,
1010,
3193,
12069,
4430,
7416,
13900,
1010,
2486,
2890,
19699,
9953,
1007,
1063,
13075,
2800,
1025,
2065,
1006,
1035,
10296,
1027,
1027,
1027,
7471,
1007,
1063,
2800,
1027,
1035,
1002,
3449,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 | src/index.js | removeTargetsFromAnimations | function removeTargetsFromAnimations(targetsArray, animations) {
for (let a = animations.length; a--;) {
if (arrayContains(targetsArray, animations[a].animatable.target)) {
animations.splice(a, 1);
}
}
} | javascript | function removeTargetsFromAnimations(targetsArray, animations) {
for (let a = animations.length; a--;) {
if (arrayContains(targetsArray, animations[a].animatable.target)) {
animations.splice(a, 1);
}
}
} | [
"function",
"removeTargetsFromAnimations",
"(",
"targetsArray",
",",
"animations",
")",
"{",
"for",
"(",
"let",
"a",
"=",
"animations",
".",
"length",
";",
"a",
"--",
";",
")",
"{",
"if",
"(",
"arrayContains",
"(",
"targetsArray",
",",
"animations",
"[",
"... | Remove targets from animation | [
"Remove",
"targets",
"from",
"animation"
] | 875a3d6745d4bff2e4c6ffe0e2d24aac3bf8a45a | https://github.com/juliangarnier/anime/blob/875a3d6745d4bff2e4c6ffe0e2d24aac3bf8a45a/src/index.js#L1150-L1156 | train | Remove targets from an array of animations | [
30522,
3853,
6366,
7559,
18150,
22747,
21716,
7088,
28649,
2015,
1006,
7889,
2906,
9447,
1010,
7284,
2015,
1007,
1063,
2005,
1006,
2292,
1037,
1027,
7284,
2015,
1012,
3091,
1025,
1037,
1011,
1011,
1025,
1007,
1063,
2065,
1006,
9140,
8663,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/clients.js | doQuery | function doQuery(options) {
// only User Agent (type = `ua`) clients are available at the moment.
options.data = extend(options.data, {type: 'ua'});
return models.Client.findOne(options.data, omit(options, ['data']))
.then((model) => {
if (!model) {
return Promise.reject(new common.errors.NotFoundError({
message: common.i18n.t('common.api.clients.clientNotFound')
}));
}
return {
clients: [model.toJSON(options)]
};
});
} | javascript | function doQuery(options) {
// only User Agent (type = `ua`) clients are available at the moment.
options.data = extend(options.data, {type: 'ua'});
return models.Client.findOne(options.data, omit(options, ['data']))
.then((model) => {
if (!model) {
return Promise.reject(new common.errors.NotFoundError({
message: common.i18n.t('common.api.clients.clientNotFound')
}));
}
return {
clients: [model.toJSON(options)]
};
});
} | [
"function",
"doQuery",
"(",
"options",
")",
"{",
"// only User Agent (type = `ua`) clients are available at the moment.",
"options",
".",
"data",
"=",
"extend",
"(",
"options",
".",
"data",
",",
"{",
"type",
":",
"'ua'",
"}",
")",
";",
"return",
"models",
".",
"... | ### Model Query
Make the call to the Model layer
@param {Object} options
@returns {Object} options | [
"###",
"Model",
"Query",
"Make",
"the",
"call",
"to",
"the",
"Model",
"layer"
] | bb7bb55cf3e60af99ebbc56099928827b58461bc | https://github.com/TryGhost/Ghost/blob/bb7bb55cf3e60af99ebbc56099928827b58461bc/core/server/api/v0.1/clients.js#L35-L51 | train | Query for a client | [
30522,
3853,
2079,
4226,
2854,
1006,
7047,
1007,
1063,
1013,
1013,
2069,
5310,
4005,
1006,
2828,
1027,
1036,
25423,
1036,
1007,
7846,
2024,
2800,
2012,
1996,
2617,
1012,
7047,
1012,
2951,
1027,
7949,
1006,
7047,
1012,
2951,
1010,
1063,
28... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 | XPathEngine | function XPathEngine() {
// public
this.doc = null;
/**
* Returns whether the current runtime environment supports the use of this
* engine. Needs override.
*/
this.isAvailable = function() { return false; };
/**
* Sets the document to be used for evaluation. Always returns the current
* engine object so as to be chainable.
*/
this.setDocument = function(newDocument) {
this.doc = newDocument;
return this;
};
/**
* Returns a possibly-empty list of nodes. Needs override.
*/
this.selectNodes = function(xpath, contextNode, namespaceResolver) {
return [];
};
/**
* Returns a single node, or null if no nodes were selected. This default
* implementation simply returns the first result of selectNodes(), or
* null.
*/
this.selectSingleNode = function(xpath, contextNode, namespaceResolver) {
var nodes = this.selectNodes(xpath, contextNode, namespaceResolver);
return (nodes.length > 0 ? nodes[0] : null);
};
/**
* Returns the number of matching nodes. This default implementation simply
* returns the length of the result of selectNodes(), which should be
* adequate for most sub-implementations.
*/
this.countNodes = function(xpath, contextNode, namespaceResolver) {
return this.selectNodes(xpath, contextNode, namespaceResolver).length;
};
/**
* An optimization; likely to be a no-op for many implementations. Always
* returns the current engine object so as to be chainable.
*/
this.setIgnoreAttributesWithoutValue = function(ignore) { return this; };
} | javascript | function XPathEngine() {
// public
this.doc = null;
/**
* Returns whether the current runtime environment supports the use of this
* engine. Needs override.
*/
this.isAvailable = function() { return false; };
/**
* Sets the document to be used for evaluation. Always returns the current
* engine object so as to be chainable.
*/
this.setDocument = function(newDocument) {
this.doc = newDocument;
return this;
};
/**
* Returns a possibly-empty list of nodes. Needs override.
*/
this.selectNodes = function(xpath, contextNode, namespaceResolver) {
return [];
};
/**
* Returns a single node, or null if no nodes were selected. This default
* implementation simply returns the first result of selectNodes(), or
* null.
*/
this.selectSingleNode = function(xpath, contextNode, namespaceResolver) {
var nodes = this.selectNodes(xpath, contextNode, namespaceResolver);
return (nodes.length > 0 ? nodes[0] : null);
};
/**
* Returns the number of matching nodes. This default implementation simply
* returns the length of the result of selectNodes(), which should be
* adequate for most sub-implementations.
*/
this.countNodes = function(xpath, contextNode, namespaceResolver) {
return this.selectNodes(xpath, contextNode, namespaceResolver).length;
};
/**
* An optimization; likely to be a no-op for many implementations. Always
* returns the current engine object so as to be chainable.
*/
this.setIgnoreAttributesWithoutValue = function(ignore) { return this; };
} | [
"function",
"XPathEngine",
"(",
")",
"{",
"// public",
"this",
".",
"doc",
"=",
"null",
";",
"/**\n * Returns whether the current runtime environment supports the use of this\n * engine. Needs override.\n */",
"this",
".",
"isAvailable",
"=",
"function",
"(",
")",
... | An interface definition for XPath engine implementations; an instance of
XPathEngine should be their prototype. Sub-implementations need only define
overrides of the methods provided here. | [
"An",
"interface",
"definition",
"for",
"XPath",
"engine",
"implementations",
";",
"an",
"instance",
"of",
"XPathEngine",
"should",
"be",
"their",
"prototype",
".",
"Sub",
"-",
"implementations",
"need",
"only",
"define",
"overrides",
"of",
"the",
"methods",
"pr... | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/selenium-core/scripts/htmlutils.js#L1061-L1111 | train | The XPathEngine class | [
30522,
3853,
26726,
8988,
13159,
3170,
1006,
1007,
1063,
1013,
1013,
2270,
2023,
1012,
9986,
1027,
19701,
1025,
1013,
1008,
1008,
1008,
5651,
3251,
1996,
2783,
2448,
7292,
4044,
6753,
1996,
2224,
1997,
2023,
1008,
3194,
1012,
3791,
2058,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 | updateVersionPicker.js | exec | function exec (cmd, userOptions) {
if (cmd instanceof Array) {
return cmd.map(function (cmd) { return exec(cmd, userOptions); });
}
try {
const options = Object.create(defaultOptions);
for (const key in userOptions) options[key] = userOptions[key];
console.log(`\n--------\n ${cmd}`);
return console.log(child_process.execSync(cmd, options).trim());
} catch (err) {
return err;
}
} | javascript | function exec (cmd, userOptions) {
if (cmd instanceof Array) {
return cmd.map(function (cmd) { return exec(cmd, userOptions); });
}
try {
const options = Object.create(defaultOptions);
for (const key in userOptions) options[key] = userOptions[key];
console.log(`\n--------\n ${cmd}`);
return console.log(child_process.execSync(cmd, options).trim());
} catch (err) {
return err;
}
} | [
"function",
"exec",
"(",
"cmd",
",",
"userOptions",
")",
"{",
"if",
"(",
"cmd",
"instanceof",
"Array",
")",
"{",
"return",
"cmd",
".",
"map",
"(",
"function",
"(",
"cmd",
")",
"{",
"return",
"exec",
"(",
"cmd",
",",
"userOptions",
")",
";",
"}",
")... | utility methods | [
"utility",
"methods"
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/updateVersionPicker.js#L47-L59 | train | execs a command | [
30522,
3853,
4654,
8586,
1006,
4642,
2094,
1010,
5310,
7361,
9285,
1007,
1063,
2065,
1006,
4642,
2094,
6013,
11253,
9140,
1007,
1063,
2709,
4642,
2094,
1012,
4949,
1006,
3853,
1006,
4642,
2094,
1007,
1063,
2709,
4654,
8586,
1006,
4642,
20... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/core/PathProxy.js | function (ctx) {
var d = this.data;
var x0, y0;
var xi, yi;
var x, y;
var ux = this._ux;
var uy = this._uy;
var len = this._len;
for (var i = 0; i < len;) {
var cmd = d[i++];
if (i === 1) {
// 如果第一个命令是 L, C, Q
// 则 previous point 同绘制命令的第一个 point
//
// 第一个命令为 Arc 的情况下会在后面特殊处理
xi = d[i];
yi = d[i + 1];
x0 = xi;
y0 = yi;
}
switch (cmd) {
case CMD.M:
x0 = xi = d[i++];
y0 = yi = d[i++];
ctx.moveTo(xi, yi);
break;
case CMD.L:
x = d[i++];
y = d[i++];
// Not draw too small seg between
if (mathAbs(x - xi) > ux || mathAbs(y - yi) > uy || i === len - 1) {
ctx.lineTo(x, y);
xi = x;
yi = y;
}
break;
case CMD.C:
ctx.bezierCurveTo(
d[i++], d[i++], d[i++], d[i++], d[i++], d[i++]
);
xi = d[i - 2];
yi = d[i - 1];
break;
case CMD.Q:
ctx.quadraticCurveTo(d[i++], d[i++], d[i++], d[i++]);
xi = d[i - 2];
yi = d[i - 1];
break;
case CMD.A:
var cx = d[i++];
var cy = d[i++];
var rx = d[i++];
var ry = d[i++];
var theta = d[i++];
var dTheta = d[i++];
var psi = d[i++];
var fs = d[i++];
var r = (rx > ry) ? rx : ry;
var scaleX = (rx > ry) ? 1 : rx / ry;
var scaleY = (rx > ry) ? ry / rx : 1;
var isEllipse = Math.abs(rx - ry) > 1e-3;
var endAngle = theta + dTheta;
if (isEllipse) {
ctx.translate(cx, cy);
ctx.rotate(psi);
ctx.scale(scaleX, scaleY);
ctx.arc(0, 0, r, theta, endAngle, 1 - fs);
ctx.scale(1 / scaleX, 1 / scaleY);
ctx.rotate(-psi);
ctx.translate(-cx, -cy);
}
else {
ctx.arc(cx, cy, r, theta, endAngle, 1 - fs);
}
if (i === 1) {
// 直接使用 arc 命令
// 第一个命令起点还未定义
x0 = mathCos(theta) * rx + cx;
y0 = mathSin(theta) * ry + cy;
}
xi = mathCos(endAngle) * rx + cx;
yi = mathSin(endAngle) * ry + cy;
break;
case CMD.R:
x0 = xi = d[i];
y0 = yi = d[i + 1];
ctx.rect(d[i++], d[i++], d[i++], d[i++]);
break;
case CMD.Z:
ctx.closePath();
xi = x0;
yi = y0;
}
}
} | javascript | function (ctx) {
var d = this.data;
var x0, y0;
var xi, yi;
var x, y;
var ux = this._ux;
var uy = this._uy;
var len = this._len;
for (var i = 0; i < len;) {
var cmd = d[i++];
if (i === 1) {
// 如果第一个命令是 L, C, Q
// 则 previous point 同绘制命令的第一个 point
//
// 第一个命令为 Arc 的情况下会在后面特殊处理
xi = d[i];
yi = d[i + 1];
x0 = xi;
y0 = yi;
}
switch (cmd) {
case CMD.M:
x0 = xi = d[i++];
y0 = yi = d[i++];
ctx.moveTo(xi, yi);
break;
case CMD.L:
x = d[i++];
y = d[i++];
// Not draw too small seg between
if (mathAbs(x - xi) > ux || mathAbs(y - yi) > uy || i === len - 1) {
ctx.lineTo(x, y);
xi = x;
yi = y;
}
break;
case CMD.C:
ctx.bezierCurveTo(
d[i++], d[i++], d[i++], d[i++], d[i++], d[i++]
);
xi = d[i - 2];
yi = d[i - 1];
break;
case CMD.Q:
ctx.quadraticCurveTo(d[i++], d[i++], d[i++], d[i++]);
xi = d[i - 2];
yi = d[i - 1];
break;
case CMD.A:
var cx = d[i++];
var cy = d[i++];
var rx = d[i++];
var ry = d[i++];
var theta = d[i++];
var dTheta = d[i++];
var psi = d[i++];
var fs = d[i++];
var r = (rx > ry) ? rx : ry;
var scaleX = (rx > ry) ? 1 : rx / ry;
var scaleY = (rx > ry) ? ry / rx : 1;
var isEllipse = Math.abs(rx - ry) > 1e-3;
var endAngle = theta + dTheta;
if (isEllipse) {
ctx.translate(cx, cy);
ctx.rotate(psi);
ctx.scale(scaleX, scaleY);
ctx.arc(0, 0, r, theta, endAngle, 1 - fs);
ctx.scale(1 / scaleX, 1 / scaleY);
ctx.rotate(-psi);
ctx.translate(-cx, -cy);
}
else {
ctx.arc(cx, cy, r, theta, endAngle, 1 - fs);
}
if (i === 1) {
// 直接使用 arc 命令
// 第一个命令起点还未定义
x0 = mathCos(theta) * rx + cx;
y0 = mathSin(theta) * ry + cy;
}
xi = mathCos(endAngle) * rx + cx;
yi = mathSin(endAngle) * ry + cy;
break;
case CMD.R:
x0 = xi = d[i];
y0 = yi = d[i + 1];
ctx.rect(d[i++], d[i++], d[i++], d[i++]);
break;
case CMD.Z:
ctx.closePath();
xi = x0;
yi = y0;
}
}
} | [
"function",
"(",
"ctx",
")",
"{",
"var",
"d",
"=",
"this",
".",
"data",
";",
"var",
"x0",
",",
"y0",
";",
"var",
"xi",
",",
"yi",
";",
"var",
"x",
",",
"y",
";",
"var",
"ux",
"=",
"this",
".",
"_ux",
";",
"var",
"uy",
"=",
"this",
".",
"_... | Rebuild path from current data
Rebuild path will not consider javascript implemented line dash.
@param {CanvasRenderingContext2D} ctx | [
"Rebuild",
"path",
"from",
"current",
"data",
"Rebuild",
"path",
"will",
"not",
"consider",
"javascript",
"implemented",
"line",
"dash",
"."
] | 30321b57cba3149c30eacb0c1e18276f0f001b9f | https://github.com/ecomfe/zrender/blob/30321b57cba3149c30eacb0c1e18276f0f001b9f/src/core/PathProxy.js#L686-L783 | train | Draw the region region | [
30522,
3853,
1006,
14931,
2595,
1007,
1063,
13075,
1040,
1027,
2023,
1012,
2951,
1025,
13075,
1060,
2692,
1010,
1061,
2692,
1025,
13075,
8418,
1010,
12316,
1025,
13075,
1060,
1010,
1061,
1025,
13075,
1057,
2595,
1027,
2023,
1012,
1035,
1057... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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.support/src/sap/ui/support/supportRules/Storage.js | function (rules) {
var stringifyRules = encode(JSON.stringify(rules));
localStorage.setItem(constants.LOCAL_STORAGE_TEMP_RULES_KEY, stringifyRules);
} | javascript | function (rules) {
var stringifyRules = encode(JSON.stringify(rules));
localStorage.setItem(constants.LOCAL_STORAGE_TEMP_RULES_KEY, stringifyRules);
} | [
"function",
"(",
"rules",
")",
"{",
"var",
"stringifyRules",
"=",
"encode",
"(",
"JSON",
".",
"stringify",
"(",
"rules",
")",
")",
";",
"localStorage",
".",
"setItem",
"(",
"constants",
".",
"LOCAL_STORAGE_TEMP_RULES_KEY",
",",
"stringifyRules",
")",
";",
"}... | Saves the temporary rules into the LocalStorage persistence layer.
@private
@name sap.ui.support.Storage.setRules
@method
@param {object[]} rules The temporary rules from the shared model. | [
"Saves",
"the",
"temporary",
"rules",
"into",
"the",
"LocalStorage",
"persistence",
"layer",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.support/src/sap/ui/support/supportRules/Storage.js#L99-L102 | train | Save temporary rules to local storage | [
30522,
3853,
1006,
3513,
1007,
1063,
13075,
5164,
8757,
6820,
4244,
1027,
4372,
16044,
1006,
1046,
3385,
1012,
5164,
8757,
1006,
3513,
1007,
1007,
1025,
10575,
4263,
4270,
1012,
2275,
4221,
2213,
1006,
5377,
2015,
1012,
2334,
1035,
5527,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 | common/src/web/jquery-1.3.2.js | function(){
// Remember where we started, so that we can go back to it later
this.options.orig[this.prop] = jQuery.attr( this.elem.style, this.prop );
this.options.show = true;
// Begin the animation
// Make sure that we start at a small width/height to avoid any
// flash of content
this.custom(this.prop == "width" || this.prop == "height" ? 1 : 0, this.cur());
// Start by showing the element
jQuery(this.elem).show();
} | javascript | function(){
// Remember where we started, so that we can go back to it later
this.options.orig[this.prop] = jQuery.attr( this.elem.style, this.prop );
this.options.show = true;
// Begin the animation
// Make sure that we start at a small width/height to avoid any
// flash of content
this.custom(this.prop == "width" || this.prop == "height" ? 1 : 0, this.cur());
// Start by showing the element
jQuery(this.elem).show();
} | [
"function",
"(",
")",
"{",
"// Remember where we started, so that we can go back to it later",
"this",
".",
"options",
".",
"orig",
"[",
"this",
".",
"prop",
"]",
"=",
"jQuery",
".",
"attr",
"(",
"this",
".",
"elem",
".",
"style",
",",
"this",
".",
"prop",
"... | Simple 'show' function | [
"Simple",
"show",
"function"
] | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/common/src/web/jquery-1.3.2.js#L4069-L4081 | train | Show the element | [
30522,
3853,
1006,
1007,
1063,
1013,
1013,
3342,
2073,
2057,
2318,
1010,
2061,
2008,
2057,
2064,
2175,
2067,
2000,
2009,
2101,
2023,
1012,
7047,
1012,
2030,
8004,
1031,
2023,
1012,
17678,
1033,
1027,
1046,
4226,
2854,
1012,
2012,
16344,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | src/sap.ui.fl/src/sap/ui/fl/Utils.js | function (oComponent, sParameterName) {
var startUpParameterContent = null;
if (sParameterName) {
if (oComponent && oComponent.getComponentData) {
startUpParameterContent = this._getStartUpParameter(oComponent.getComponentData(), sParameterName);
}
}
return startUpParameterContent;
} | javascript | function (oComponent, sParameterName) {
var startUpParameterContent = null;
if (sParameterName) {
if (oComponent && oComponent.getComponentData) {
startUpParameterContent = this._getStartUpParameter(oComponent.getComponentData(), sParameterName);
}
}
return startUpParameterContent;
} | [
"function",
"(",
"oComponent",
",",
"sParameterName",
")",
"{",
"var",
"startUpParameterContent",
"=",
"null",
";",
"if",
"(",
"sParameterName",
")",
"{",
"if",
"(",
"oComponent",
"&&",
"oComponent",
".",
"getComponentData",
")",
"{",
"startUpParameterContent",
... | Determines the content for a given startUpParameter name
@param {sap.ui.core.Component} oComponent - component instance
@param {String} sParameterName - startUpParameterName that shall be determined
@returns {String} content of found startUpParameter
@private | [
"Determines",
"the",
"content",
"for",
"a",
"given",
"startUpParameter",
"name"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/Utils.js#L451-L461 | train | Returns the content of the start up parameter of the given component. | [
30522,
3853,
1006,
1051,
9006,
29513,
3372,
1010,
12403,
6444,
15141,
18442,
1007,
1063,
13075,
22752,
28689,
22828,
8663,
6528,
2102,
1027,
19701,
1025,
2065,
1006,
12403,
6444,
15141,
18442,
1007,
1063,
2065,
1006,
1051,
9006,
29513,
3372,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | src/sap.ui.core/src/sap/ui/base/BindingParser.js | resolveFilters | function resolveFilters(o, sProp) {
var v = o[sProp];
if ( Array.isArray(v) ) {
v.forEach(function(oObject, iIndex) {
resolveFilters(v, iIndex);
});
return;
}
if ( v && typeof v === 'object' ) {
resolveRef(v, 'test');
resolveFilters(v, 'filters');
resolveFilters(v, 'condition');
o[sProp] = new Filter(v);
}
} | javascript | function resolveFilters(o, sProp) {
var v = o[sProp];
if ( Array.isArray(v) ) {
v.forEach(function(oObject, iIndex) {
resolveFilters(v, iIndex);
});
return;
}
if ( v && typeof v === 'object' ) {
resolveRef(v, 'test');
resolveFilters(v, 'filters');
resolveFilters(v, 'condition');
o[sProp] = new Filter(v);
}
} | [
"function",
"resolveFilters",
"(",
"o",
",",
"sProp",
")",
"{",
"var",
"v",
"=",
"o",
"[",
"sProp",
"]",
";",
"if",
"(",
"Array",
".",
"isArray",
"(",
"v",
")",
")",
"{",
"v",
".",
"forEach",
"(",
"function",
"(",
"oObject",
",",
"iIndex",
")",
... | /*
Converts filter definitions to sap.ui.model.Filter instances.
The value of the given property can either be a single filter definition object
which will be fed into the constructor of sap.ui.model.Filter.
Or it can be an array of such objects.
If any of the filter definition objects contains a property named 'filters',
that property will be resolved as filters recursively.
A property 'test' will be resolved as function in the given context. | [
"/",
"*",
"Converts",
"filter",
"definitions",
"to",
"sap",
".",
"ui",
".",
"model",
".",
"Filter",
"instances",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/base/BindingParser.js#L252-L268 | train | Resolves filters in the object | [
30522,
3853,
10663,
8873,
21928,
2015,
1006,
1051,
1010,
11867,
18981,
1007,
1063,
13075,
1058,
1027,
1051,
1031,
11867,
18981,
1033,
1025,
2065,
1006,
9140,
1012,
18061,
11335,
2100,
1006,
1058,
1007,
1007,
1063,
1058,
1012,
18921,
6776,
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/LiveDevelopment/MultiBrowserImpl/language/HTMLSimpleDOM.js | _offsetPos | function _offsetPos(pos, offset) {
return {line: pos.line, ch: pos.ch + offset};
} | javascript | function _offsetPos(pos, offset) {
return {line: pos.line, ch: pos.ch + offset};
} | [
"function",
"_offsetPos",
"(",
"pos",
",",
"offset",
")",
"{",
"return",
"{",
"line",
":",
"pos",
".",
"line",
",",
"ch",
":",
"pos",
".",
"ch",
"+",
"offset",
"}",
";",
"}"
] | @private
Offsets the character offset of the given {line, ch} pos by the given amount and returns a new
pos. Not for general purpose use as it does not account for line boundaries. | [
"@private"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/LiveDevelopment/MultiBrowserImpl/language/HTMLSimpleDOM.js#L221-L223 | train | offset the offset to the next line | [
30522,
3853,
1035,
16396,
6873,
2015,
1006,
13433,
2015,
1010,
16396,
1007,
1063,
2709,
1063,
2240,
1024,
13433,
2015,
1012,
2240,
1010,
10381,
1024,
13433,
2015,
1012,
10381,
1009,
16396,
1065,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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... |
summernote/summernote | src/js/base/core/dom.js | listDescendant | function listDescendant(node, pred) {
const descendants = [];
pred = pred || func.ok;
// start DFS(depth first search) with node
(function fnWalk(current) {
if (node !== current && pred(current)) {
descendants.push(current);
}
for (let idx = 0, len = current.childNodes.length; idx < len; idx++) {
fnWalk(current.childNodes[idx]);
}
})(node);
return descendants;
} | javascript | function listDescendant(node, pred) {
const descendants = [];
pred = pred || func.ok;
// start DFS(depth first search) with node
(function fnWalk(current) {
if (node !== current && pred(current)) {
descendants.push(current);
}
for (let idx = 0, len = current.childNodes.length; idx < len; idx++) {
fnWalk(current.childNodes[idx]);
}
})(node);
return descendants;
} | [
"function",
"listDescendant",
"(",
"node",
",",
"pred",
")",
"{",
"const",
"descendants",
"=",
"[",
"]",
";",
"pred",
"=",
"pred",
"||",
"func",
".",
"ok",
";",
"// start DFS(depth first search) with node",
"(",
"function",
"fnWalk",
"(",
"current",
")",
"{"... | listing descendant nodes
@param {Node} node
@param {Function} [pred] - predicate function | [
"listing",
"descendant",
"nodes"
] | 8dcafb8107453006b905ef697a529c42e76beb3f | https://github.com/summernote/summernote/blob/8dcafb8107453006b905ef697a529c42e76beb3f/src/js/base/core/dom.js#L352-L367 | train | List descendant nodes of node | [
30522,
3853,
2862,
6155,
23865,
4630,
1006,
13045,
1010,
3653,
2094,
1007,
1063,
9530,
3367,
8481,
1027,
1031,
1033,
1025,
3653,
2094,
1027,
3653,
2094,
1064,
1064,
4569,
2278,
1012,
7929,
1025,
1013,
1013,
2707,
1040,
10343,
1006,
5995,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
nodejs/node-gyp | lib/build.js | findMsbuild | function findMsbuild () {
log.verbose('could not find "msbuild.exe" in PATH - finding location in registry')
var notfoundErr = 'Can\'t find "msbuild.exe". Do you have Microsoft Visual Studio C++ 2008+ installed?'
var cmd = 'reg query "HKLM\\Software\\Microsoft\\MSBuild\\ToolsVersions" /s'
if (process.arch !== 'ia32')
cmd += ' /reg:32'
exec(cmd, function (err, stdout) {
if (err) {
return callback(new Error(err.message + '\n' + notfoundErr))
}
var reVers = /ToolsVersions\\([^\\]+)$/i
, rePath = /\r\n[ \t]+MSBuildToolsPath[ \t]+REG_SZ[ \t]+([^\r]+)/i
, msbuilds = []
, r
, msbuildPath
stdout.split('\r\n\r\n').forEach(function(l) {
if (!l) return
l = l.trim()
if (r = reVers.exec(l.substring(0, l.indexOf('\r\n')))) {
var ver = parseFloat(r[1], 10)
if (ver >= 3.5) {
if (r = rePath.exec(l)) {
msbuilds.push({
version: ver,
path: r[1]
})
}
}
}
})
msbuilds.sort(function (x, y) {
return (x.version < y.version ? -1 : 1)
})
;(function verifyMsbuild () {
if (!msbuilds.length) return callback(new Error(notfoundErr))
msbuildPath = path.resolve(msbuilds.pop().path, 'msbuild.exe')
fs.stat(msbuildPath, function (err) {
if (err) {
if (err.code == 'ENOENT') {
if (msbuilds.length) {
return verifyMsbuild()
} else {
callback(new Error(notfoundErr))
}
} else {
callback(err)
}
return
}
command = msbuildPath
doBuild()
})
})()
})
} | javascript | function findMsbuild () {
log.verbose('could not find "msbuild.exe" in PATH - finding location in registry')
var notfoundErr = 'Can\'t find "msbuild.exe". Do you have Microsoft Visual Studio C++ 2008+ installed?'
var cmd = 'reg query "HKLM\\Software\\Microsoft\\MSBuild\\ToolsVersions" /s'
if (process.arch !== 'ia32')
cmd += ' /reg:32'
exec(cmd, function (err, stdout) {
if (err) {
return callback(new Error(err.message + '\n' + notfoundErr))
}
var reVers = /ToolsVersions\\([^\\]+)$/i
, rePath = /\r\n[ \t]+MSBuildToolsPath[ \t]+REG_SZ[ \t]+([^\r]+)/i
, msbuilds = []
, r
, msbuildPath
stdout.split('\r\n\r\n').forEach(function(l) {
if (!l) return
l = l.trim()
if (r = reVers.exec(l.substring(0, l.indexOf('\r\n')))) {
var ver = parseFloat(r[1], 10)
if (ver >= 3.5) {
if (r = rePath.exec(l)) {
msbuilds.push({
version: ver,
path: r[1]
})
}
}
}
})
msbuilds.sort(function (x, y) {
return (x.version < y.version ? -1 : 1)
})
;(function verifyMsbuild () {
if (!msbuilds.length) return callback(new Error(notfoundErr))
msbuildPath = path.resolve(msbuilds.pop().path, 'msbuild.exe')
fs.stat(msbuildPath, function (err) {
if (err) {
if (err.code == 'ENOENT') {
if (msbuilds.length) {
return verifyMsbuild()
} else {
callback(new Error(notfoundErr))
}
} else {
callback(err)
}
return
}
command = msbuildPath
doBuild()
})
})()
})
} | [
"function",
"findMsbuild",
"(",
")",
"{",
"log",
".",
"verbose",
"(",
"'could not find \"msbuild.exe\" in PATH - finding location in registry'",
")",
"var",
"notfoundErr",
"=",
"'Can\\'t find \"msbuild.exe\". Do you have Microsoft Visual Studio C++ 2008+ installed?'",
"var",
"cmd",
... | Search for the location of "msbuild.exe" file on Windows. | [
"Search",
"for",
"the",
"location",
"of",
"msbuild",
".",
"exe",
"file",
"on",
"Windows",
"."
] | 721eb691cf15556cc2700eda0558d5bad5f84232 | https://github.com/nodejs/node-gyp/blob/721eb691cf15556cc2700eda0558d5bad5f84232/lib/build.js#L126-L180 | train | find msbuild. exe | [
30522,
3853,
2424,
5244,
8569,
4014,
2094,
1006,
1007,
1063,
8833,
1012,
12034,
9232,
1006,
1005,
2071,
2025,
2424,
1000,
5796,
8569,
4014,
2094,
1012,
4654,
2063,
1000,
1999,
4130,
1011,
4531,
3295,
1999,
15584,
1005,
1007,
13075,
2025,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/extensions/default/AutoUpdate/main.js | initiateUpdateProcess | function initiateUpdateProcess(formattedInstallerPath, formattedLogFilePath, installStatusFilePath) {
// Get additional update parameters on Mac : installDir, appName, and updateDir
function getAdditionalParams() {
var retval = {};
var installDir = FileUtils.getNativeBracketsDirectoryPath();
if (installDir) {
var appPath = installDir.split("/Contents/www")[0];
installDir = appPath.substr(0, appPath.lastIndexOf('/'));
var appName = appPath.substr(appPath.lastIndexOf('/') + 1);
retval = {
installDir: installDir,
appName: appName,
updateDir: updateDir
};
}
return retval;
}
// Update function, to carry out app update
var updateFn = function () {
var infoObj = {
installerPath: formattedInstallerPath,
logFilePath: formattedLogFilePath,
installStatusFilePath: installStatusFilePath
};
if (brackets.platform === "mac") {
var additionalParams = getAdditionalParams(),
key;
for (key in additionalParams) {
if (additionalParams.hasOwnProperty(key)) {
infoObj[key] = additionalParams[key];
}
}
}
// Set update parameters for app update
if (brackets.app.setUpdateParams) {
brackets.app.setUpdateParams(JSON.stringify(infoObj), function (err) {
if (err) {
resetStateInFailure("AutoUpdate : Update parameters could not be set for the installer. Error encountered: " + err);
} else {
setAppQuitHandler();
CommandManager.execute(Commands.FILE_QUIT);
}
});
} else {
resetStateInFailure("AutoUpdate : setUpdateParams could not be found in shell");
}
};
setUpdateStateInJSON('updateInitiatedInPrevSession', true)
.done(updateFn);
} | javascript | function initiateUpdateProcess(formattedInstallerPath, formattedLogFilePath, installStatusFilePath) {
// Get additional update parameters on Mac : installDir, appName, and updateDir
function getAdditionalParams() {
var retval = {};
var installDir = FileUtils.getNativeBracketsDirectoryPath();
if (installDir) {
var appPath = installDir.split("/Contents/www")[0];
installDir = appPath.substr(0, appPath.lastIndexOf('/'));
var appName = appPath.substr(appPath.lastIndexOf('/') + 1);
retval = {
installDir: installDir,
appName: appName,
updateDir: updateDir
};
}
return retval;
}
// Update function, to carry out app update
var updateFn = function () {
var infoObj = {
installerPath: formattedInstallerPath,
logFilePath: formattedLogFilePath,
installStatusFilePath: installStatusFilePath
};
if (brackets.platform === "mac") {
var additionalParams = getAdditionalParams(),
key;
for (key in additionalParams) {
if (additionalParams.hasOwnProperty(key)) {
infoObj[key] = additionalParams[key];
}
}
}
// Set update parameters for app update
if (brackets.app.setUpdateParams) {
brackets.app.setUpdateParams(JSON.stringify(infoObj), function (err) {
if (err) {
resetStateInFailure("AutoUpdate : Update parameters could not be set for the installer. Error encountered: " + err);
} else {
setAppQuitHandler();
CommandManager.execute(Commands.FILE_QUIT);
}
});
} else {
resetStateInFailure("AutoUpdate : setUpdateParams could not be found in shell");
}
};
setUpdateStateInJSON('updateInitiatedInPrevSession', true)
.done(updateFn);
} | [
"function",
"initiateUpdateProcess",
"(",
"formattedInstallerPath",
",",
"formattedLogFilePath",
",",
"installStatusFilePath",
")",
"{",
"// Get additional update parameters on Mac : installDir, appName, and updateDir",
"function",
"getAdditionalParams",
"(",
")",
"{",
"var",
"retv... | Initiates the update process, when user clicks UpdateNow in the update popup
@param {string} formattedInstallerPath - formatted path to the latest installer
@param {string} formattedLogFilePath - formatted path to the installer log file
@param {string} installStatusFilePath - path to the install status log file | [
"Initiates",
"the",
"update",
"process",
"when",
"user",
"clicks",
"UpdateNow",
"in",
"the",
"update",
"popup"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/AutoUpdate/main.js#L829-L885 | train | Initiates the update process | [
30522,
3853,
17820,
6279,
13701,
21572,
9623,
2015,
1006,
4289,
3064,
30524,
6097,
1024,
16500,
4305,
2099,
1010,
10439,
18442,
1010,
1998,
7172,
4313,
3853,
2131,
4215,
27064,
28689,
5244,
1006,
1007,
1063,
13075,
2128,
9189,
2389,
1027,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/thirdparty/less.js | colorBlend | function colorBlend(mode, color1, color2) {
var ab = color1.alpha, cb, // backdrop
as = color2.alpha, cs, // source
ar, cr, r = []; // result
ar = as + ab * (1 - as);
for (var i = 0; i < 3; i++) {
cb = color1.rgb[i] / 255;
cs = color2.rgb[i] / 255;
cr = mode(cb, cs);
if (ar) {
cr = (as * cs + ab * (cb
- as * (cb + cs - cr))) / ar;
}
r[i] = cr * 255;
}
return new(tree.Color)(r, ar);
} | javascript | function colorBlend(mode, color1, color2) {
var ab = color1.alpha, cb, // backdrop
as = color2.alpha, cs, // source
ar, cr, r = []; // result
ar = as + ab * (1 - as);
for (var i = 0; i < 3; i++) {
cb = color1.rgb[i] / 255;
cs = color2.rgb[i] / 255;
cr = mode(cb, cs);
if (ar) {
cr = (as * cs + ab * (cb
- as * (cb + cs - cr))) / ar;
}
r[i] = cr * 255;
}
return new(tree.Color)(r, ar);
} | [
"function",
"colorBlend",
"(",
"mode",
",",
"color1",
",",
"color2",
")",
"{",
"var",
"ab",
"=",
"color1",
".",
"alpha",
",",
"cb",
",",
"// backdrop",
"as",
"=",
"color2",
".",
"alpha",
",",
"cs",
",",
"// source",
"ar",
",",
"cr",
",",
"r",
"=",
... | Color Blending ref: http://www.w3.org/TR/compositing-1 | [
"Color",
"Blending",
"ref",
":",
"http",
":",
"//",
"www",
".",
"w3",
".",
"org",
"/",
"TR",
"/",
"compositing",
"-",
"1"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/less.js#L2593-L2611 | train | Blends two colors | [
30522,
3853,
3609,
3468,
4859,
1006,
5549,
1010,
3609,
2487,
1010,
3609,
2475,
1007,
1063,
13075,
11113,
1027,
3609,
2487,
1012,
6541,
1010,
17324,
1010,
1013,
1013,
18876,
2004,
1027,
3609,
2475,
1012,
6541,
1010,
20116,
1010,
1013,
1013,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
eslint/eslint | lib/rules/no-extra-parens.js | checkUnaryUpdate | function checkUnaryUpdate(node) {
if (node.type === "UnaryExpression" && node.argument.type === "BinaryExpression" && node.argument.operator === "**") {
return;
}
if (hasExcessParens(node.argument) && precedence(node.argument) >= precedence(node)) {
report(node.argument);
}
} | javascript | function checkUnaryUpdate(node) {
if (node.type === "UnaryExpression" && node.argument.type === "BinaryExpression" && node.argument.operator === "**") {
return;
}
if (hasExcessParens(node.argument) && precedence(node.argument) >= precedence(node)) {
report(node.argument);
}
} | [
"function",
"checkUnaryUpdate",
"(",
"node",
")",
"{",
"if",
"(",
"node",
".",
"type",
"===",
"\"UnaryExpression\"",
"&&",
"node",
".",
"argument",
".",
"type",
"===",
"\"BinaryExpression\"",
"&&",
"node",
".",
"argument",
".",
"operator",
"===",
"\"**\"",
"... | Evaluate Unary update
@param {ASTNode} node node to evaluate
@returns {void}
@private | [
"Evaluate",
"Unary",
"update"
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/no-extra-parens.js#L340-L348 | train | Check if Unary Update | [
30522,
3853,
4638,
9521,
2854,
6279,
13701,
1006,
13045,
1007,
1063,
2065,
1006,
13045,
1012,
2828,
1027,
1027,
1027,
1000,
14477,
2854,
10288,
20110,
3258,
1000,
1004,
1004,
13045,
1012,
6685,
1012,
2828,
1027,
1027,
1027,
1000,
12441,
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... |
facebook/relay | packages/relay-compiler/core/getIdentifierForArgumentValue.js | getIdentifierForArgumentValue | function getIdentifierForArgumentValue(value: ArgumentValue): mixed {
switch (value.kind) {
case 'Variable':
return {variable: value.variableName};
case 'Literal':
return {value: value.value};
case 'ListValue':
return {
list: value.items.map(item => getIdentifierForArgumentValue(item)),
};
case 'ObjectValue':
return {
object: value.fields.map(field => ({
name: field.name,
value: getIdentifierForArgumentValue(field.value),
})),
};
default:
invariant(
false,
'getIdentifierForArgumentValue(): Unsupported AST kind `%s`.',
value.kind,
);
}
} | javascript | function getIdentifierForArgumentValue(value: ArgumentValue): mixed {
switch (value.kind) {
case 'Variable':
return {variable: value.variableName};
case 'Literal':
return {value: value.value};
case 'ListValue':
return {
list: value.items.map(item => getIdentifierForArgumentValue(item)),
};
case 'ObjectValue':
return {
object: value.fields.map(field => ({
name: field.name,
value: getIdentifierForArgumentValue(field.value),
})),
};
default:
invariant(
false,
'getIdentifierForArgumentValue(): Unsupported AST kind `%s`.',
value.kind,
);
}
} | [
"function",
"getIdentifierForArgumentValue",
"(",
"value",
":",
"ArgumentValue",
")",
":",
"mixed",
"{",
"switch",
"(",
"value",
".",
"kind",
")",
"{",
"case",
"'Variable'",
":",
"return",
"{",
"variable",
":",
"value",
".",
"variableName",
"}",
";",
"case",... | Generates an identifier for an argument value. The identifier is based on the
structure/order of items and keys in the value. | [
"Generates",
"an",
"identifier",
"for",
"an",
"argument",
"value",
".",
"The",
"identifier",
"is",
"based",
"on",
"the",
"structure",
"/",
"order",
"of",
"items",
"and",
"keys",
"in",
"the",
"value",
"."
] | 7fb9be5182b9650637d7b92ead9a42713ac30aa4 | https://github.com/facebook/relay/blob/7fb9be5182b9650637d7b92ead9a42713ac30aa4/packages/relay-compiler/core/getIdentifierForArgumentValue.js#L21-L45 | train | Get identifier for an argument value | [
30522,
3853,
2131,
5178,
16778,
8873,
2121,
29278,
2906,
22850,
4765,
10175,
5657,
1006,
3643,
1024,
6685,
10175,
5657,
1007,
1024,
3816,
1063,
6942,
1006,
3643,
1012,
2785,
1007,
1063,
2553,
1005,
8023,
1005,
1024,
2709,
1063,
8023,
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... |
jgraph/mxgraph | javascript/mxClient.js | function(style)
{
if (style != null)
{
var pairs = style.split(';');
var stylename = pairs[0];
if (stylename.indexOf('=') < 0)
{
return stylename;
}
}
return '';
} | javascript | function(style)
{
if (style != null)
{
var pairs = style.split(';');
var stylename = pairs[0];
if (stylename.indexOf('=') < 0)
{
return stylename;
}
}
return '';
} | [
"function",
"(",
"style",
")",
"{",
"if",
"(",
"style",
"!=",
"null",
")",
"{",
"var",
"pairs",
"=",
"style",
".",
"split",
"(",
"';'",
")",
";",
"var",
"stylename",
"=",
"pairs",
"[",
"0",
"]",
";",
"if",
"(",
"stylename",
".",
"indexOf",
"(",
... | Function: getStylename
Returns the stylename in a style of the form [(stylename|key=value);] or
an empty string if the given style does not contain a stylename.
Parameters:
style - String of the form [(stylename|key=value);]. | [
"Function",
":",
"getStylename"
] | 33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44 | https://github.com/jgraph/mxgraph/blob/33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44/javascript/mxClient.js#L5310-L5324 | train | Get the style name of the node | [
30522,
3853,
1006,
2806,
1007,
1063,
2065,
1006,
2806,
999,
1027,
19701,
1007,
1063,
13075,
7689,
1027,
2806,
1012,
3975,
1006,
1005,
1025,
1005,
1007,
1025,
13075,
2806,
18442,
1027,
7689,
1031,
1014,
1033,
1025,
2065,
1006,
2806,
18442,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... | |
infinitered/ignite | src/cli/enforce-global.js | getVersion | function getVersion() {
// parse the version number
try {
// find the executable
var resolvedPath = which.sync(whichExec)
// grab the raw output
var result = shell.exec(`"${resolvedPath}" ${versionCommand}`, { silent: true })
var rawOut = ramda.trim(result.stdout || '')
var rawErr = ramda.trim(result.stderr || '') // java -version does this... grr
// assign the "right" one to raw
var raw = rawOut
if (ramda.isEmpty(raw)) {
raw = rawErr
}
if (ramda.isEmpty(raw)) {
raw = null
}
// and run it by the version matcher
return versionMatcher(raw)
} catch (err) {
return null
}
} | javascript | function getVersion() {
// parse the version number
try {
// find the executable
var resolvedPath = which.sync(whichExec)
// grab the raw output
var result = shell.exec(`"${resolvedPath}" ${versionCommand}`, { silent: true })
var rawOut = ramda.trim(result.stdout || '')
var rawErr = ramda.trim(result.stderr || '') // java -version does this... grr
// assign the "right" one to raw
var raw = rawOut
if (ramda.isEmpty(raw)) {
raw = rawErr
}
if (ramda.isEmpty(raw)) {
raw = null
}
// and run it by the version matcher
return versionMatcher(raw)
} catch (err) {
return null
}
} | [
"function",
"getVersion",
"(",
")",
"{",
"// parse the version number",
"try",
"{",
"// find the executable",
"var",
"resolvedPath",
"=",
"which",
".",
"sync",
"(",
"whichExec",
")",
"// grab the raw output",
"var",
"result",
"=",
"shell",
".",
"exec",
"(",
"`",
... | Gets the version from the global dependency.
@return {string} The version number or null. | [
"Gets",
"the",
"version",
"from",
"the",
"global",
"dependency",
"."
] | dca91da22f9ad9bab1eb9f43565689d563bd111d | https://github.com/infinitered/ignite/blob/dca91da22f9ad9bab1eb9f43565689d563bd111d/src/cli/enforce-global.js#L77-L102 | train | Get the version number from the executable | [
30522,
3853,
2131,
27774,
1006,
1007,
1063,
1013,
1013,
11968,
3366,
1996,
2544,
2193,
3046,
1063,
1013,
1013,
2424,
1996,
4654,
8586,
23056,
13075,
10395,
15069,
1027,
2029,
1012,
26351,
1006,
2029,
10288,
8586,
1007,
1013,
1013,
6723,
199... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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.helpers.js | parseMaxStyle | function parseMaxStyle(styleValue, node, parentProperty) {
var valueInPixels;
if (typeof styleValue === 'string') {
valueInPixels = parseInt(styleValue, 10);
if (styleValue.indexOf('%') !== -1) {
// percentage * size in dimension
valueInPixels = valueInPixels / 100 * node.parentNode[parentProperty];
}
} else {
valueInPixels = styleValue;
}
return valueInPixels;
} | javascript | function parseMaxStyle(styleValue, node, parentProperty) {
var valueInPixels;
if (typeof styleValue === 'string') {
valueInPixels = parseInt(styleValue, 10);
if (styleValue.indexOf('%') !== -1) {
// percentage * size in dimension
valueInPixels = valueInPixels / 100 * node.parentNode[parentProperty];
}
} else {
valueInPixels = styleValue;
}
return valueInPixels;
} | [
"function",
"parseMaxStyle",
"(",
"styleValue",
",",
"node",
",",
"parentProperty",
")",
"{",
"var",
"valueInPixels",
";",
"if",
"(",
"typeof",
"styleValue",
"===",
"'string'",
")",
"{",
"valueInPixels",
"=",
"parseInt",
"(",
"styleValue",
",",
"10",
")",
";... | Private helper function to convert max-width/max-height values that may be percentages into a number | [
"Private",
"helper",
"function",
"to",
"convert",
"max",
"-",
"width",
"/",
"max",
"-",
"height",
"values",
"that",
"may",
"be",
"percentages",
"into",
"a",
"number"
] | f093c36574d290330ed623e60fbd070421c730d5 | https://github.com/chartjs/Chart.js/blob/f093c36574d290330ed623e60fbd070421c730d5/src/core/core.helpers.js#L410-L424 | train | Parse max style value | [
30522,
3853,
11968,
3366,
17848,
21756,
2571,
1006,
2806,
10175,
5657,
1010,
13045,
1010,
6687,
21572,
4842,
3723,
1007,
1063,
13075,
3643,
2378,
8197,
2595,
9050,
1025,
2065,
1006,
2828,
11253,
2806,
10175,
5657,
1027,
1027,
1027,
1005,
51... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/react-relay/isRelayEnvironment.js | isRelayEnvironment | function isRelayEnvironment(environment: mixed): boolean {
return (
typeof environment === 'object' &&
environment !== null &&
// TODO: add applyMutation/sendMutation once ready in both cores
typeof environment.check === 'function' &&
typeof environment.lookup === 'function' &&
typeof environment.retain === 'function' &&
typeof environment.sendQuery === 'function' &&
typeof environment.execute === 'function' &&
typeof environment.subscribe === 'function'
);
} | javascript | function isRelayEnvironment(environment: mixed): boolean {
return (
typeof environment === 'object' &&
environment !== null &&
// TODO: add applyMutation/sendMutation once ready in both cores
typeof environment.check === 'function' &&
typeof environment.lookup === 'function' &&
typeof environment.retain === 'function' &&
typeof environment.sendQuery === 'function' &&
typeof environment.execute === 'function' &&
typeof environment.subscribe === 'function'
);
} | [
"function",
"isRelayEnvironment",
"(",
"environment",
":",
"mixed",
")",
":",
"boolean",
"{",
"return",
"(",
"typeof",
"environment",
"===",
"'object'",
"&&",
"environment",
"!==",
"null",
"&&",
"// TODO: add applyMutation/sendMutation once ready in both cores",
"typeof",... | Determine if a given value is an object that implements the `Environment`
interface defined in `RelayEnvironmentTypes`. | [
"Determine",
"if",
"a",
"given",
"value",
"is",
"an",
"object",
"that",
"implements",
"the",
"Environment",
"interface",
"defined",
"in",
"RelayEnvironmentTypes",
"."
] | 7fb9be5182b9650637d7b92ead9a42713ac30aa4 | https://github.com/facebook/relay/blob/7fb9be5182b9650637d7b92ead9a42713ac30aa4/packages/react-relay/isRelayEnvironment.js#L17-L29 | train | Check if the environment is a relay environment | [
30522,
3853,
2003,
16570,
4710,
2368,
21663,
2239,
3672,
1006,
4044,
1024,
3816,
1007,
1024,
22017,
20898,
1063,
2709,
1006,
2828,
11253,
4044,
1027,
1027,
1027,
1005,
4874,
1005,
1004,
1004,
4044,
999,
1027,
1027,
19701,
1004,
1004,
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... |
moleculerjs/moleculer | src/middlewares/metrics.js | metricFinish | function metricFinish(ctx, error) {
if (ctx.startHrTime) {
let diff = process.hrtime(ctx.startHrTime);
ctx.duration = (diff[0] * 1e3) + (diff[1] / 1e6); // milliseconds
}
ctx.stopTime = ctx.startTime + ctx.duration;
if (ctx.metrics) {
const payload = generateMetricPayload(ctx);
payload.endTime = ctx.stopTime;
payload.duration = ctx.duration;
payload.fromCache = ctx.cachedResult;
if (error) {
payload.error = {
name: error.name,
code: error.code,
type: error.type,
message: error.message
};
}
ctx.broker.emit("metrics.trace.span.finish", payload);
}
} | javascript | function metricFinish(ctx, error) {
if (ctx.startHrTime) {
let diff = process.hrtime(ctx.startHrTime);
ctx.duration = (diff[0] * 1e3) + (diff[1] / 1e6); // milliseconds
}
ctx.stopTime = ctx.startTime + ctx.duration;
if (ctx.metrics) {
const payload = generateMetricPayload(ctx);
payload.endTime = ctx.stopTime;
payload.duration = ctx.duration;
payload.fromCache = ctx.cachedResult;
if (error) {
payload.error = {
name: error.name,
code: error.code,
type: error.type,
message: error.message
};
}
ctx.broker.emit("metrics.trace.span.finish", payload);
}
} | [
"function",
"metricFinish",
"(",
"ctx",
",",
"error",
")",
"{",
"if",
"(",
"ctx",
".",
"startHrTime",
")",
"{",
"let",
"diff",
"=",
"process",
".",
"hrtime",
"(",
"ctx",
".",
"startHrTime",
")",
";",
"ctx",
".",
"duration",
"=",
"(",
"diff",
"[",
"... | Stop metrics & send finish metric event.
@param {Context} ctx
@param {Error} error
@private | [
"Stop",
"metrics",
"&",
"send",
"finish",
"metric",
"event",
"."
] | f95aadc2d61b0d0e3c643a43c3ed28bca6425cde | https://github.com/moleculerjs/moleculer/blob/f95aadc2d61b0d0e3c643a43c3ed28bca6425cde/src/middlewares/metrics.js#L99-L123 | train | Finishes the metric execution | [
30522,
3853,
12046,
16294,
4509,
1006,
14931,
2595,
1010,
7561,
1007,
1063,
2065,
1006,
14931,
2595,
1012,
2707,
8093,
7292,
1007,
1063,
2292,
4487,
4246,
1027,
2832,
1012,
17850,
7292,
1006,
14931,
2595,
1012,
2707,
8093,
7292,
1007,
1025,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
moleculerjs/moleculer | bin/moleculer-runner.js | startBroker | function startBroker() {
let worker = cluster.worker;
if (worker) {
Object.assign(config, {
nodeID: (config.nodeID || utils.getNodeID()) + "-" + worker.id
});
}
// Create service broker
broker = new Moleculer.ServiceBroker(Object.assign({}, config));
loadServices();
return broker.start()
.then(() => {
if (flags.repl && (!worker || worker.id === 1))
broker.repl();
});
} | javascript | function startBroker() {
let worker = cluster.worker;
if (worker) {
Object.assign(config, {
nodeID: (config.nodeID || utils.getNodeID()) + "-" + worker.id
});
}
// Create service broker
broker = new Moleculer.ServiceBroker(Object.assign({}, config));
loadServices();
return broker.start()
.then(() => {
if (flags.repl && (!worker || worker.id === 1))
broker.repl();
});
} | [
"function",
"startBroker",
"(",
")",
"{",
"let",
"worker",
"=",
"cluster",
".",
"worker",
";",
"if",
"(",
"worker",
")",
"{",
"Object",
".",
"assign",
"(",
"config",
",",
"{",
"nodeID",
":",
"(",
"config",
".",
"nodeID",
"||",
"utils",
".",
"getNodeI... | Start Moleculer broker | [
"Start",
"Moleculer",
"broker"
] | f95aadc2d61b0d0e3c643a43c3ed28bca6425cde | https://github.com/moleculerjs/moleculer/blob/f95aadc2d61b0d0e3c643a43c3ed28bca6425cde/bin/moleculer-runner.js#L410-L429 | train | Starts the broker | [
30522,
3853,
2707,
12618,
5484,
1006,
1007,
1063,
2292,
7309,
1027,
9324,
1012,
7309,
1025,
2065,
1006,
7309,
1007,
1063,
4874,
1012,
23911,
1006,
9530,
8873,
2290,
1010,
1063,
13045,
3593,
1024,
1006,
9530,
8873,
2290,
1012,
13045,
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... |
Microsoft/vscode | build/lib/treeshaking.js | shouldSkipAlias | function shouldSkipAlias(node, declaration) {
if (node.kind !== ts.SyntaxKind.Identifier) {
return false;
}
if (node.parent === declaration) {
return true;
}
switch (declaration.kind) {
case ts.SyntaxKind.ImportClause:
case ts.SyntaxKind.ImportEqualsDeclaration:
return true;
case ts.SyntaxKind.ImportSpecifier:
return declaration.parent.kind === ts.SyntaxKind.NamedImports;
default:
return false;
}
} | javascript | function shouldSkipAlias(node, declaration) {
if (node.kind !== ts.SyntaxKind.Identifier) {
return false;
}
if (node.parent === declaration) {
return true;
}
switch (declaration.kind) {
case ts.SyntaxKind.ImportClause:
case ts.SyntaxKind.ImportEqualsDeclaration:
return true;
case ts.SyntaxKind.ImportSpecifier:
return declaration.parent.kind === ts.SyntaxKind.NamedImports;
default:
return false;
}
} | [
"function",
"shouldSkipAlias",
"(",
"node",
",",
"declaration",
")",
"{",
"if",
"(",
"node",
".",
"kind",
"!==",
"ts",
".",
"SyntaxKind",
".",
"Identifier",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"node",
".",
"parent",
"===",
"declaration",
... | Go to the original declaration for cases: (1) when the aliased symbol was declared in the location(parent). (2) when the aliased symbol is originating from an import. | [
"Go",
"to",
"the",
"original",
"declaration",
"for",
"cases",
":",
"(",
"1",
")",
"when",
"the",
"aliased",
"symbol",
"was",
"declared",
"in",
"the",
"location",
"(",
"parent",
")",
".",
"(",
"2",
")",
"when",
"the",
"aliased",
"symbol",
"is",
"origina... | 693a13cd32c5be798051edc0cb43e1e39fc456d9 | https://github.com/Microsoft/vscode/blob/693a13cd32c5be798051edc0cb43e1e39fc456d9/build/lib/treeshaking.js#L561-L577 | train | Check whether a node should be skipped by aliasing | [
30522,
3853,
2323,
5488,
12952,
7951,
1006,
13045,
1010,
8170,
1007,
1063,
2065,
1006,
13045,
1012,
2785,
999,
1027,
1027,
24529,
1012,
20231,
18824,
1012,
8909,
4765,
18095,
1007,
1063,
2709,
6270,
1025,
1065,
2065,
1006,
13045,
1012,
6687... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/services/url/utils.js | replacePermalink | function replacePermalink(permalink, resource) {
let output = permalink,
primaryTagFallback = 'all',
publishedAtMoment = moment.tz(resource.published_at || Date.now(), settingsCache.get('active_timezone')),
permalinkLookUp = {
year: function () {
return publishedAtMoment.format('YYYY');
},
month: function () {
return publishedAtMoment.format('MM');
},
day: function () {
return publishedAtMoment.format('DD');
},
author: function () {
return resource.primary_author.slug;
},
primary_author: function () {
return resource.primary_author ? resource.primary_author.slug : primaryTagFallback;
},
primary_tag: function () {
return resource.primary_tag ? resource.primary_tag.slug : primaryTagFallback;
},
slug: function () {
return resource.slug;
},
id: function () {
return resource.id;
}
};
// replace tags like :slug or :year with actual values
output = output.replace(/(:[a-z_]+)/g, function (match) {
if (_.has(permalinkLookUp, match.substr(1))) {
return permalinkLookUp[match.substr(1)]();
}
});
return output;
} | javascript | function replacePermalink(permalink, resource) {
let output = permalink,
primaryTagFallback = 'all',
publishedAtMoment = moment.tz(resource.published_at || Date.now(), settingsCache.get('active_timezone')),
permalinkLookUp = {
year: function () {
return publishedAtMoment.format('YYYY');
},
month: function () {
return publishedAtMoment.format('MM');
},
day: function () {
return publishedAtMoment.format('DD');
},
author: function () {
return resource.primary_author.slug;
},
primary_author: function () {
return resource.primary_author ? resource.primary_author.slug : primaryTagFallback;
},
primary_tag: function () {
return resource.primary_tag ? resource.primary_tag.slug : primaryTagFallback;
},
slug: function () {
return resource.slug;
},
id: function () {
return resource.id;
}
};
// replace tags like :slug or :year with actual values
output = output.replace(/(:[a-z_]+)/g, function (match) {
if (_.has(permalinkLookUp, match.substr(1))) {
return permalinkLookUp[match.substr(1)]();
}
});
return output;
} | [
"function",
"replacePermalink",
"(",
"permalink",
",",
"resource",
")",
"{",
"let",
"output",
"=",
"permalink",
",",
"primaryTagFallback",
"=",
"'all'",
",",
"publishedAtMoment",
"=",
"moment",
".",
"tz",
"(",
"resource",
".",
"published_at",
"||",
"Date",
"."... | creates the url path for a post based on blog timezone and permalink pattern | [
"creates",
"the",
"url",
"path",
"for",
"a",
"post",
"based",
"on",
"blog",
"timezone",
"and",
"permalink",
"pattern"
] | bb7bb55cf3e60af99ebbc56099928827b58461bc | https://github.com/TryGhost/Ghost/blob/bb7bb55cf3e60af99ebbc56099928827b58461bc/core/server/services/url/utils.js#L204-L243 | train | replace permalink with the correct values | [
30522,
3853,
5672,
4842,
9067,
19839,
1006,
2566,
9067,
19839,
1010,
7692,
1007,
1063,
2292,
6434,
1027,
2566,
9067,
19839,
1010,
3078,
15900,
13976,
5963,
1027,
1005,
2035,
1005,
1010,
2405,
4017,
5302,
3672,
1027,
2617,
1012,
1056,
2480,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/lib/by.js | check | function check(locator) {
if (locator instanceof By || typeof locator === 'function') {
return locator;
}
if (locator
&& typeof locator === 'object'
&& typeof locator.using === 'string'
&& typeof locator.value === 'string') {
return new By(locator.using, locator.value);
}
for (let key in locator) {
if (locator.hasOwnProperty(key) && By.hasOwnProperty(key)) {
return By[key](locator[key]);
}
}
throw new TypeError('Invalid locator');
} | javascript | function check(locator) {
if (locator instanceof By || typeof locator === 'function') {
return locator;
}
if (locator
&& typeof locator === 'object'
&& typeof locator.using === 'string'
&& typeof locator.value === 'string') {
return new By(locator.using, locator.value);
}
for (let key in locator) {
if (locator.hasOwnProperty(key) && By.hasOwnProperty(key)) {
return By[key](locator[key]);
}
}
throw new TypeError('Invalid locator');
} | [
"function",
"check",
"(",
"locator",
")",
"{",
"if",
"(",
"locator",
"instanceof",
"By",
"||",
"typeof",
"locator",
"===",
"'function'",
")",
"{",
"return",
"locator",
";",
"}",
"if",
"(",
"locator",
"&&",
"typeof",
"locator",
"===",
"'object'",
"&&",
"t... | Checks if a value is a valid locator.
@param {!(By|Function|ByHash)} locator The value to check.
@return {!(By|Function)} The valid locator.
@throws {TypeError} If the given value does not define a valid locator
strategy. | [
"Checks",
"if",
"a",
"value",
"is",
"a",
"valid",
"locator",
"."
] | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/node/selenium-webdriver/lib/by.js#L258-L276 | train | Check if a locator is valid | [
30522,
3853,
4638,
1006,
8840,
11266,
2953,
1007,
1063,
2065,
1006,
8840,
11266,
2953,
6013,
11253,
2011,
1064,
1064,
2828,
11253,
8840,
11266,
2953,
1027,
1027,
1027,
1005,
3853,
1005,
1007,
1063,
2709,
8840,
11266,
2953,
1025,
1065,
2065,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
expressjs/express | lib/router/index.js | wrap | function wrap(old, fn) {
return function proxy() {
var args = new Array(arguments.length + 1);
args[0] = old;
for (var i = 0, len = arguments.length; i < len; i++) {
args[i + 1] = arguments[i];
}
fn.apply(this, args);
};
} | javascript | function wrap(old, fn) {
return function proxy() {
var args = new Array(arguments.length + 1);
args[0] = old;
for (var i = 0, len = arguments.length; i < len; i++) {
args[i + 1] = arguments[i];
}
fn.apply(this, args);
};
} | [
"function",
"wrap",
"(",
"old",
",",
"fn",
")",
"{",
"return",
"function",
"proxy",
"(",
")",
"{",
"var",
"args",
"=",
"new",
"Array",
"(",
"arguments",
".",
"length",
"+",
"1",
")",
";",
"args",
"[",
"0",
"]",
"=",
"old",
";",
"for",
"(",
"var... | wrap a function | [
"wrap",
"a",
"function"
] | dc538f6e810bd462c98ee7e6aae24c64d4b1da93 | https://github.com/expressjs/express/blob/dc538f6e810bd462c98ee7e6aae24c64d4b1da93/lib/router/index.js#L651-L662 | train | wrap a function | [
30522,
3853,
10236,
1006,
2214,
1010,
1042,
2078,
1007,
1063,
2709,
3853,
24540,
1006,
1007,
1063,
13075,
12098,
5620,
1027,
2047,
9140,
1006,
9918,
1012,
3091,
1009,
1015,
1007,
1025,
12098,
5620,
1031,
1014,
1033,
1027,
2214,
1025,
2005,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/rejectLimit.js | rejectLimit | function rejectLimit (coll, limit, iteratee, callback) {
return _reject(eachOfLimit(limit), coll, iteratee, callback)
} | javascript | function rejectLimit (coll, limit, iteratee, callback) {
return _reject(eachOfLimit(limit), coll, iteratee, callback)
} | [
"function",
"rejectLimit",
"(",
"coll",
",",
"limit",
",",
"iteratee",
",",
"callback",
")",
"{",
"return",
"_reject",
"(",
"eachOfLimit",
"(",
"limit",
")",
",",
"coll",
",",
"iteratee",
",",
"callback",
")",
"}"
] | The same as [`reject`]{@link module:Collections.reject} but runs a maximum of `limit` async operations at a
time.
@name rejectLimit
@static
@memberOf module:Collections
@method
@see [async.reject]{@link module:Collections.reject}
@category Collection
@param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
@param {number} limit - The maximum number of async operations at a time.
@param {Function} iteratee - An async truth test to apply to each item in
`coll`.
The should complete with a boolean value as its `result`.
Invoked with (item, callback).
@param {Function} [callback] - A callback which is called after all the
`iteratee` functions have finished. Invoked with (err, results).
@returns {Promise} a promise, if no callback is passed | [
"The",
"same",
"as",
"[",
"reject",
"]",
"{",
"@link",
"module",
":",
"Collections",
".",
"reject",
"}",
"but",
"runs",
"a",
"maximum",
"of",
"limit",
"async",
"operations",
"at",
"a",
"time",
"."
] | 4330d536c106592139fa82062494c9dba0da1fdb | https://github.com/caolan/async/blob/4330d536c106592139fa82062494c9dba0da1fdb/lib/rejectLimit.js#L24-L26 | train | rejects a collection of items up to a given limit | [
30522,
3853,
15454,
17960,
4183,
1006,
8902,
2140,
1010,
5787,
1010,
2009,
22139,
2063,
1010,
2655,
5963,
1007,
1063,
2709,
1035,
15454,
1006,
2169,
11253,
17960,
4183,
1006,
5787,
1007,
1010,
8902,
2140,
1010,
2009,
22139,
2063,
1010,
2655... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
styled-components/styled-components | packages/styled-components/src/vendor/postcss/postcss.js | postcss | function postcss(...plugins) {
if (plugins.length === 1 && Array.isArray(plugins[0])) {
plugins = plugins[0];
}
return new Processor(plugins);
} | javascript | function postcss(...plugins) {
if (plugins.length === 1 && Array.isArray(plugins[0])) {
plugins = plugins[0];
}
return new Processor(plugins);
} | [
"function",
"postcss",
"(",
"...",
"plugins",
")",
"{",
"if",
"(",
"plugins",
".",
"length",
"===",
"1",
"&&",
"Array",
".",
"isArray",
"(",
"plugins",
"[",
"0",
"]",
")",
")",
"{",
"plugins",
"=",
"plugins",
"[",
"0",
"]",
";",
"}",
"return",
"n... | Create a new {@link Processor} instance that will apply `plugins`
as CSS processors.
@param {Array.<Plugin|pluginFunction>|Processor} plugins - PostCSS
plugins. See {@link Processor#use} for plugin format.
@return {Processor} Processor to process multiple CSS
@example
import postcss from 'postcss';
postcss(plugins).process(css, { from, to }).then(result => {
console.log(result.css);
});
@namespace postcss | [
"Create",
"a",
"new",
"{",
"@link",
"Processor",
"}",
"instance",
"that",
"will",
"apply",
"plugins",
"as",
"CSS",
"processors",
"."
] | 4115a1f8e4814b3843d781ce84d686c998ddfd3e | https://github.com/styled-components/styled-components/blob/4115a1f8e4814b3843d781ce84d686c998ddfd3e/packages/styled-components/src/vendor/postcss/postcss.js#L31-L36 | train | PostCSS Processor | [
30522,
3853,
2695,
6169,
2015,
1006,
1012,
1012,
1012,
13354,
7076,
1007,
1063,
2065,
1006,
13354,
7076,
1012,
3091,
1027,
1027,
1027,
1015,
1004,
1004,
9140,
1012,
18061,
11335,
2100,
1006,
13354,
7076,
1031,
1014,
1033,
1007,
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... |
fex-team/webuploader | src/widgets/widget.js | function( apiName, args ) {
/*
{
'make-thumb': 'makeThumb'
}
*/
var map = this.responseMap;
// 如果无API响应声明则忽略
if ( !map || !(apiName in map) || !(map[ apiName ] in this) ||
!$.isFunction( this[ map[ apiName ] ] ) ) {
return IGNORE;
}
return this[ map[ apiName ] ].apply( this, args );
} | javascript | function( apiName, args ) {
/*
{
'make-thumb': 'makeThumb'
}
*/
var map = this.responseMap;
// 如果无API响应声明则忽略
if ( !map || !(apiName in map) || !(map[ apiName ] in this) ||
!$.isFunction( this[ map[ apiName ] ] ) ) {
return IGNORE;
}
return this[ map[ apiName ] ].apply( this, args );
} | [
"function",
"(",
"apiName",
",",
"args",
")",
"{",
"/*\n {\n 'make-thumb': 'makeThumb'\n }\n */",
"var",
"map",
"=",
"this",
".",
"responseMap",
";",
"// 如果无API响应声明则忽略",
"if",
"(",
"!",
"map",
"||",
"!",
"(",
... | 类Backbone的事件监听声明,监听uploader实例上的事件 widget直接无法监听事件,事件只能通过uploader来传递 | [
"类Backbone的事件监听声明,监听uploader实例上的事件",
"widget直接无法监听事件,事件只能通过uploader来传递"
] | 7094e4476c5af3b06993d91dde2d223200b9feb7 | https://github.com/fex-team/webuploader/blob/7094e4476c5af3b06993d91dde2d223200b9feb7/src/widgets/widget.js#L43-L61 | train | call api function | [
30522,
3853,
1006,
17928,
18442,
1010,
12098,
5620,
1007,
1063,
1013,
1008,
1063,
1005,
2191,
1011,
7639,
1005,
1024,
1005,
2191,
2705,
25438,
1005,
1065,
1008,
1013,
13075,
4949,
1027,
2023,
1012,
3433,
2863,
2361,
1025,
1013,
1013,
100,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... | |
ant-design/ant-design | webpack.config.js | ignoreMomentLocale | function ignoreMomentLocale(webpackConfig) {
delete webpackConfig.module.noParse;
webpackConfig.plugins.push(new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/));
} | javascript | function ignoreMomentLocale(webpackConfig) {
delete webpackConfig.module.noParse;
webpackConfig.plugins.push(new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/));
} | [
"function",
"ignoreMomentLocale",
"(",
"webpackConfig",
")",
"{",
"delete",
"webpackConfig",
".",
"module",
".",
"noParse",
";",
"webpackConfig",
".",
"plugins",
".",
"push",
"(",
"new",
"webpack",
".",
"IgnorePlugin",
"(",
"/",
"^\\.\\/locale$",
"/",
",",
"/"... | noParse still leave `require('./locale' + name)` in dist files ignore is better: http://stackoverflow.com/q/25384360 | [
"noParse",
"still",
"leave",
"require",
"(",
".",
"/",
"locale",
"+",
"name",
")",
"in",
"dist",
"files",
"ignore",
"is",
"better",
":",
"http",
":",
"//",
"stackoverflow",
".",
"com",
"/",
"q",
"/",
"25384360"
] | 6d845f60efe9bd50a25c0ce29eb1fee895b9c7b7 | https://github.com/ant-design/ant-design/blob/6d845f60efe9bd50a25c0ce29eb1fee895b9c7b7/webpack.config.js#L9-L12 | train | Ignore moment locale | [
30522,
3853,
8568,
5302,
3672,
4135,
9289,
2063,
1006,
4773,
23947,
8663,
8873,
2290,
1007,
1063,
3972,
12870,
4773,
23947,
8663,
8873,
2290,
1012,
11336,
1012,
2053,
19362,
3366,
1025,
4773,
23947,
8663,
8873,
2290,
1012,
13354,
7076,
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... |
SeleniumHQ/selenium | third_party/js/mozmill/shared-modules/prefs.js | preferences_getPref | function preferences_getPref(prefName, defaultValue, defaultBranch,
interfaceType) {
try {
branch = defaultBranch ? this.defaultPrefBranch : this.prefBranch;
// If interfaceType has been set, handle it differently
if (interfaceType != undefined) {
return branch.getComplexValue(prefName, interfaceType);
}
switch (typeof defaultValue) {
case ('boolean'):
return branch.getBoolPref(prefName);
case ('string'):
return branch.getCharPref(prefName);
case ('number'):
return branch.getIntPref(prefName);
default:
return undefined;
}
} catch(e) {
return defaultValue;
}
} | javascript | function preferences_getPref(prefName, defaultValue, defaultBranch,
interfaceType) {
try {
branch = defaultBranch ? this.defaultPrefBranch : this.prefBranch;
// If interfaceType has been set, handle it differently
if (interfaceType != undefined) {
return branch.getComplexValue(prefName, interfaceType);
}
switch (typeof defaultValue) {
case ('boolean'):
return branch.getBoolPref(prefName);
case ('string'):
return branch.getCharPref(prefName);
case ('number'):
return branch.getIntPref(prefName);
default:
return undefined;
}
} catch(e) {
return defaultValue;
}
} | [
"function",
"preferences_getPref",
"(",
"prefName",
",",
"defaultValue",
",",
"defaultBranch",
",",
"interfaceType",
")",
"{",
"try",
"{",
"branch",
"=",
"defaultBranch",
"?",
"this",
".",
"defaultPrefBranch",
":",
"this",
".",
"prefBranch",
";",
"// If interfaceT... | Retrieve the value of an individual preference.
@param {string} prefName
The preference to get the value of.
@param {boolean/number/string} defaultValue
The default value if preference cannot be found.
@param {boolean/number/string} defaultBranch
If true the value will be read from the default branch (optional)
@param {string} interfaceType
Interface to use for the complex value (optional)
(nsILocalFile, nsISupportsString, nsIPrefLocalizedString)
@return The value of the requested preference
@type boolean/int/string/complex | [
"Retrieve",
"the",
"value",
"of",
"an",
"individual",
"preference",
"."
] | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/prefs.js#L269-L292 | train | Get the value of a preference | [
30522,
3853,
18394,
1035,
2131,
28139,
2546,
1006,
3653,
2546,
18442,
1010,
12398,
10175,
5657,
1010,
12398,
10024,
12680,
1010,
8278,
13874,
1007,
1063,
3046,
1063,
3589,
1027,
12398,
10024,
12680,
1029,
2023,
1012,
12398,
28139,
26337,
5521... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/function-paren-newline.js | validateArguments | function validateArguments(parens, elements) {
const leftParen = parens.leftParen;
const tokenAfterLeftParen = sourceCode.getTokenAfter(leftParen);
const hasLeftNewline = !astUtils.isTokenOnSameLine(leftParen, tokenAfterLeftParen);
const needsNewlines = shouldHaveNewlines(elements, hasLeftNewline);
for (let i = 0; i <= elements.length - 2; i++) {
const currentElement = elements[i];
const nextElement = elements[i + 1];
const hasNewLine = currentElement.loc.end.line !== nextElement.loc.start.line;
if (!hasNewLine && needsNewlines) {
context.report({
node: currentElement,
messageId: "expectedBetween",
fix: fixer => fixer.insertTextBefore(nextElement, "\n")
});
}
}
} | javascript | function validateArguments(parens, elements) {
const leftParen = parens.leftParen;
const tokenAfterLeftParen = sourceCode.getTokenAfter(leftParen);
const hasLeftNewline = !astUtils.isTokenOnSameLine(leftParen, tokenAfterLeftParen);
const needsNewlines = shouldHaveNewlines(elements, hasLeftNewline);
for (let i = 0; i <= elements.length - 2; i++) {
const currentElement = elements[i];
const nextElement = elements[i + 1];
const hasNewLine = currentElement.loc.end.line !== nextElement.loc.start.line;
if (!hasNewLine && needsNewlines) {
context.report({
node: currentElement,
messageId: "expectedBetween",
fix: fixer => fixer.insertTextBefore(nextElement, "\n")
});
}
}
} | [
"function",
"validateArguments",
"(",
"parens",
",",
"elements",
")",
"{",
"const",
"leftParen",
"=",
"parens",
".",
"leftParen",
";",
"const",
"tokenAfterLeftParen",
"=",
"sourceCode",
".",
"getTokenAfter",
"(",
"leftParen",
")",
";",
"const",
"hasLeftNewline",
... | Validates a list of arguments or parameters
@param {Object} parens An object with keys `leftParen` for the left paren token, and `rightParen` for the right paren token
@param {ASTNode[]} elements The arguments or parameters in the list
@returns {void} | [
"Validates",
"a",
"list",
"of",
"arguments",
"or",
"parameters"
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/function-paren-newline.js#L162-L181 | train | Validate arguments | [
30522,
3853,
9398,
3686,
2906,
22850,
11187,
1006,
11968,
6132,
1010,
3787,
1007,
1063,
9530,
3367,
2187,
19362,
2368,
1027,
11968,
6132,
1012,
2187,
19362,
2368,
1025,
9530,
3367,
19204,
10354,
3334,
2571,
6199,
19362,
2368,
1027,
3120,
16... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
wuchangming/spy-debugger | buildin_modules/weinre/web/interfaces/interfaces.js | getIdlType | function getIdlType(type) {
var result
if (-1 == NativeTypes.indexOf(type.name)) {
result = "<a href='javascript:showInterface(\"" + type.name + "\"); void(0);'>" + type.name + "</a>"
}
else {
result = type.name
}
for (var i=0; i<type.rank; i++) {
result += "[]"
}
return "<span class='type'>" + result + "</span>"
} | javascript | function getIdlType(type) {
var result
if (-1 == NativeTypes.indexOf(type.name)) {
result = "<a href='javascript:showInterface(\"" + type.name + "\"); void(0);'>" + type.name + "</a>"
}
else {
result = type.name
}
for (var i=0; i<type.rank; i++) {
result += "[]"
}
return "<span class='type'>" + result + "</span>"
} | [
"function",
"getIdlType",
"(",
"type",
")",
"{",
"var",
"result",
"if",
"(",
"-",
"1",
"==",
"NativeTypes",
".",
"indexOf",
"(",
"type",
".",
"name",
")",
")",
"{",
"result",
"=",
"\"<a href='javascript:showInterface(\\\"\"",
"+",
"type",
".",
"name",
"+",... | ----------------------------------------------------------------------------- | [
"-----------------------------------------------------------------------------"
] | 55c1dda0dff0c44920673711656ddfd7ff03c307 | https://github.com/wuchangming/spy-debugger/blob/55c1dda0dff0c44920673711656ddfd7ff03c307/buildin_modules/weinre/web/interfaces/interfaces.js#L209-L225 | train | Get IDL type | [
30522,
3853,
2131,
3593,
24228,
5051,
1006,
2828,
1007,
1063,
13075,
2765,
2065,
1006,
1011,
1015,
1027,
1027,
3128,
13874,
2015,
1012,
5950,
11253,
1006,
2828,
1012,
2171,
1007,
1007,
1063,
2765,
1027,
1000,
1026,
1037,
17850,
12879,
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... |
nodejs/node-gyp | lib/build.js | loadConfigGypi | function loadConfigGypi () {
var configPath = path.resolve('build', 'config.gypi')
fs.readFile(configPath, 'utf8', function (err, data) {
if (err) {
if (err.code == 'ENOENT') {
callback(new Error('You must run `node-gyp configure` first!'))
} else {
callback(err)
}
return
}
config = JSON.parse(data.replace(/\#.+\n/, ''))
// get the 'arch', 'buildType', and 'nodeDir' vars from the config
buildType = config.target_defaults.default_configuration
arch = config.variables.target_arch
nodeDir = config.variables.nodedir
if ('debug' in gyp.opts) {
buildType = gyp.opts.debug ? 'Debug' : 'Release'
}
if (!buildType) {
buildType = 'Release'
}
log.verbose('build type', buildType)
log.verbose('architecture', arch)
log.verbose('node dev dir', nodeDir)
if (win) {
findSolutionFile()
} else {
doWhich()
}
})
} | javascript | function loadConfigGypi () {
var configPath = path.resolve('build', 'config.gypi')
fs.readFile(configPath, 'utf8', function (err, data) {
if (err) {
if (err.code == 'ENOENT') {
callback(new Error('You must run `node-gyp configure` first!'))
} else {
callback(err)
}
return
}
config = JSON.parse(data.replace(/\#.+\n/, ''))
// get the 'arch', 'buildType', and 'nodeDir' vars from the config
buildType = config.target_defaults.default_configuration
arch = config.variables.target_arch
nodeDir = config.variables.nodedir
if ('debug' in gyp.opts) {
buildType = gyp.opts.debug ? 'Debug' : 'Release'
}
if (!buildType) {
buildType = 'Release'
}
log.verbose('build type', buildType)
log.verbose('architecture', arch)
log.verbose('node dev dir', nodeDir)
if (win) {
findSolutionFile()
} else {
doWhich()
}
})
} | [
"function",
"loadConfigGypi",
"(",
")",
"{",
"var",
"configPath",
"=",
"path",
".",
"resolve",
"(",
"'build'",
",",
"'config.gypi'",
")",
"fs",
".",
"readFile",
"(",
"configPath",
",",
"'utf8'",
",",
"function",
"(",
"err",
",",
"data",
")",
"{",
"if",
... | Load the "config.gypi" file that was generated during "configure". | [
"Load",
"the",
"config",
".",
"gypi",
"file",
"that",
"was",
"generated",
"during",
"configure",
"."
] | 721eb691cf15556cc2700eda0558d5bad5f84232 | https://github.com/nodejs/node-gyp/blob/721eb691cf15556cc2700eda0558d5bad5f84232/lib/build.js#L40-L75 | train | Load the gypi config file | [
30522,
3853,
7170,
8663,
8873,
22772,
8197,
1006,
1007,
1063,
13075,
9530,
8873,
21600,
8988,
1027,
4130,
1012,
10663,
1006,
1005,
3857,
1005,
1010,
1005,
9530,
8873,
2290,
1012,
1043,
22571,
2072,
1005,
1007,
1042,
2015,
1012,
3191,
8873,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/events/TouchToMouseMapping.js | function(sType, oEvent) {
if (!bHandleEvent) {
return;
}
// we need mapping of the different event types to get the correct target
var oMappedEvent = oEvent.type == "touchend" ? oEvent.changedTouches[0] : oEvent.touches[0];
// create the synthetic event
var newEvent = oDocument.createEvent('MouseEvent'); // trying to create an actual TouchEvent will create an error
newEvent.initMouseEvent(sType, true, true, window, oEvent.detail,
oMappedEvent.screenX, oMappedEvent.screenY, oMappedEvent.clientX, oMappedEvent.clientY,
oEvent.ctrlKey, oEvent.shiftKey, oEvent.altKey, oEvent.metaKey,
oEvent.button, oEvent.relatedTarget);
newEvent.isSynthetic = true;
// Timeout needed. Do not interrupt the native event handling.
window.setTimeout(function() {
oTarget.dispatchEvent(newEvent);
}, 0);
} | javascript | function(sType, oEvent) {
if (!bHandleEvent) {
return;
}
// we need mapping of the different event types to get the correct target
var oMappedEvent = oEvent.type == "touchend" ? oEvent.changedTouches[0] : oEvent.touches[0];
// create the synthetic event
var newEvent = oDocument.createEvent('MouseEvent'); // trying to create an actual TouchEvent will create an error
newEvent.initMouseEvent(sType, true, true, window, oEvent.detail,
oMappedEvent.screenX, oMappedEvent.screenY, oMappedEvent.clientX, oMappedEvent.clientY,
oEvent.ctrlKey, oEvent.shiftKey, oEvent.altKey, oEvent.metaKey,
oEvent.button, oEvent.relatedTarget);
newEvent.isSynthetic = true;
// Timeout needed. Do not interrupt the native event handling.
window.setTimeout(function() {
oTarget.dispatchEvent(newEvent);
}, 0);
} | [
"function",
"(",
"sType",
",",
"oEvent",
")",
"{",
"if",
"(",
"!",
"bHandleEvent",
")",
"{",
"return",
";",
"}",
"// we need mapping of the different event types to get the correct target",
"var",
"oMappedEvent",
"=",
"oEvent",
".",
"type",
"==",
"\"touchend\"",
"?"... | Fires a synthetic mouse event for a given type and native touch event.
@param {string} sType the type of the synthetic event to fire, e.g. "mousedown"
@param {jQuery.Event} oEvent the event object
@private | [
"Fires",
"a",
"synthetic",
"mouse",
"event",
"for",
"a",
"given",
"type",
"and",
"native",
"touch",
"event",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/events/TouchToMouseMapping.js#L36-L58 | train | This function is called by the event handler when the event is handled by the native event handler. | [
30522,
3853,
1006,
2358,
18863,
1010,
1051,
18697,
3372,
1007,
1063,
2065,
1006,
999,
1038,
11774,
10559,
15338,
1007,
1063,
2709,
1025,
1065,
1013,
1013,
2057,
2342,
12375,
1997,
1996,
2367,
2724,
4127,
2000,
2131,
1996,
6149,
4539,
13075,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
necolas/react-native-web | packages/react-native-web/src/modules/normalizeNativeEvent/index.js | normalizeNativeEvent | function normalizeNativeEvent(nativeEvent: Object) {
if (!nativeEvent || nativeEvent._normalized) {
return nativeEvent;
}
const eventType = nativeEvent.type || '';
const mouse = eventType.indexOf('mouse') >= 0;
if (mouse) {
return normalizeMouseEvent(nativeEvent);
} else {
return normalizeTouchEvent(nativeEvent);
}
} | javascript | function normalizeNativeEvent(nativeEvent: Object) {
if (!nativeEvent || nativeEvent._normalized) {
return nativeEvent;
}
const eventType = nativeEvent.type || '';
const mouse = eventType.indexOf('mouse') >= 0;
if (mouse) {
return normalizeMouseEvent(nativeEvent);
} else {
return normalizeTouchEvent(nativeEvent);
}
} | [
"function",
"normalizeNativeEvent",
"(",
"nativeEvent",
":",
"Object",
")",
"{",
"if",
"(",
"!",
"nativeEvent",
"||",
"nativeEvent",
".",
"_normalized",
")",
"{",
"return",
"nativeEvent",
";",
"}",
"const",
"eventType",
"=",
"nativeEvent",
".",
"type",
"||",
... | TODO: how to best handle keyboard events? | [
"TODO",
":",
"how",
"to",
"best",
"handle",
"keyboard",
"events?"
] | 801937748b2f3c96284bee1881164ac0c62a9c6d | https://github.com/necolas/react-native-web/blob/801937748b2f3c96284bee1881164ac0c62a9c6d/packages/react-native-web/src/modules/normalizeNativeEvent/index.js#L177-L188 | train | Normalize a native event | [
30522,
3853,
3671,
4697,
19833,
3512,
18697,
3372,
1006,
3128,
18697,
3372,
1024,
4874,
1007,
1063,
2065,
1006,
999,
3128,
18697,
3372,
1064,
1064,
3128,
18697,
3372,
1012,
1035,
3671,
3550,
1007,
1063,
2709,
3128,
18697,
3372,
1025,
1065,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
eslint/eslint | lib/rules/space-unary-ops.js | verifyWordDoesntHaveSpaces | function verifyWordDoesntHaveSpaces(node, firstToken, secondToken, word) {
if (astUtils.canTokensBeAdjacent(firstToken, secondToken)) {
if (secondToken.range[0] > firstToken.range[1]) {
context.report({
node,
messageId: "unexpectedAfterWord",
data: {
word
},
fix(fixer) {
return fixer.removeRange([firstToken.range[1], secondToken.range[0]]);
}
});
}
}
} | javascript | function verifyWordDoesntHaveSpaces(node, firstToken, secondToken, word) {
if (astUtils.canTokensBeAdjacent(firstToken, secondToken)) {
if (secondToken.range[0] > firstToken.range[1]) {
context.report({
node,
messageId: "unexpectedAfterWord",
data: {
word
},
fix(fixer) {
return fixer.removeRange([firstToken.range[1], secondToken.range[0]]);
}
});
}
}
} | [
"function",
"verifyWordDoesntHaveSpaces",
"(",
"node",
",",
"firstToken",
",",
"secondToken",
",",
"word",
")",
"{",
"if",
"(",
"astUtils",
".",
"canTokensBeAdjacent",
"(",
"firstToken",
",",
"secondToken",
")",
")",
"{",
"if",
"(",
"secondToken",
".",
"range"... | Verify Unary Word Operator doesn't have spaces after the word operator
@param {ASTnode} node AST node
@param {Object} firstToken first token from the AST node
@param {Object} secondToken second token from the AST node
@param {string} word The word to be used for reporting
@returns {void} | [
"Verify",
"Unary",
"Word",
"Operator",
"doesn",
"t",
"have",
"spaces",
"after",
"the",
"word",
"operator"
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/space-unary-ops.js#L130-L145 | train | Verify that word does not have spaces | [
30522,
3853,
20410,
18351,
3527,
2229,
3372,
3270,
6961,
15327,
2015,
1006,
13045,
1010,
2034,
18715,
2368,
1010,
2117,
18715,
2368,
1010,
2773,
1007,
1063,
2065,
1006,
2004,
8525,
3775,
4877,
1012,
2064,
18715,
6132,
4783,
4215,
3900,
1301... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/weex-vue-framework/index.js | init | function init (cfg) {
renderer.Document = cfg.Document;
renderer.Element = cfg.Element;
renderer.Comment = cfg.Comment;
renderer.sendTasks = cfg.sendTasks;
} | javascript | function init (cfg) {
renderer.Document = cfg.Document;
renderer.Element = cfg.Element;
renderer.Comment = cfg.Comment;
renderer.sendTasks = cfg.sendTasks;
} | [
"function",
"init",
"(",
"cfg",
")",
"{",
"renderer",
".",
"Document",
"=",
"cfg",
".",
"Document",
";",
"renderer",
".",
"Element",
"=",
"cfg",
".",
"Element",
";",
"renderer",
".",
"Comment",
"=",
"cfg",
".",
"Comment",
";",
"renderer",
".",
"sendTas... | Prepare framework config, basically about the virtual-DOM and JS bridge.
@param {object} cfg | [
"Prepare",
"framework",
"config",
"basically",
"about",
"the",
"virtual",
"-",
"DOM",
"and",
"JS",
"bridge",
"."
] | a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e | https://github.com/GeekyAnts/vue-native-core/blob/a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e/packages/weex-vue-framework/index.js#L33-L38 | train | Initialize the ckey renderer | [
30522,
3853,
1999,
4183,
1006,
12935,
2290,
1007,
1063,
17552,
2121,
1012,
6254,
1027,
12935,
2290,
1012,
6254,
1025,
17552,
2121,
1012,
5783,
1027,
12935,
2290,
1012,
5783,
1025,
17552,
2121,
1012,
7615,
1027,
12935,
2290,
1012,
7615,
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... |
SeleniumHQ/selenium | javascript/selenium-core/scripts/htmlutils.js | dispatch | function dispatch(methodName, inDocument, xpath, contextNode, namespaceResolver) {
xpath = preprocess(xpath);
if (! contextNode) {
contextNode = inDocument;
}
var result = getEngineFor(inDocument)
.setIgnoreAttributesWithoutValue(ignoreAttributesWithoutValue)
[methodName](xpath, contextNode, namespaceResolver);
return result;
} | javascript | function dispatch(methodName, inDocument, xpath, contextNode, namespaceResolver) {
xpath = preprocess(xpath);
if (! contextNode) {
contextNode = inDocument;
}
var result = getEngineFor(inDocument)
.setIgnoreAttributesWithoutValue(ignoreAttributesWithoutValue)
[methodName](xpath, contextNode, namespaceResolver);
return result;
} | [
"function",
"dispatch",
"(",
"methodName",
",",
"inDocument",
",",
"xpath",
",",
"contextNode",
",",
"namespaceResolver",
")",
"{",
"xpath",
"=",
"preprocess",
"(",
"xpath",
")",
";",
"if",
"(",
"!",
"contextNode",
")",
"{",
"contextNode",
"=",
"inDocument",... | Dispatches an XPath evaluation method on the relevant engine for the
given document, and returns the result | [
"Dispatches",
"an",
"XPath",
"evaluation",
"method",
"on",
"the",
"relevant",
"engine",
"for",
"the",
"given",
"document",
"and",
"returns",
"the",
"result"
] | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/selenium-core/scripts/htmlutils.js#L2001-L2013 | train | Dispatches a method to the engine for the given xpath. | [
30522,
3853,
18365,
1006,
4118,
18442,
1010,
11424,
24894,
4765,
1010,
26726,
8988,
1010,
6123,
3630,
3207,
1010,
3415,
15327,
6072,
4747,
6299,
1007,
1063,
26726,
8988,
1027,
17463,
3217,
9623,
2015,
1006,
26726,
8988,
1007,
1025,
2065,
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... |
GitbookIO/gitbook | lib/output/generateBook.js | generateBook | function generateBook(generator, book, options) {
options = generator.Options(options);
var state = generator.State? generator.State({}) : Immutable.Map();
var start = Date.now();
return Promise(
new Output({
book: book,
options: options,
state: state,
generator: generator.name
})
)
// Cleanup output folder
.then(function(output) {
var logger = output.getLogger();
var rootFolder = output.getRoot();
logger.debug.ln('cleanup folder "' + rootFolder + '"');
return fs.ensureFolder(rootFolder)
.thenResolve(output);
})
.then(processOutput.bind(null, generator))
// Log duration and end message
.then(function(output) {
var logger = output.getLogger();
var end = Date.now();
var duration = (end - start)/1000;
logger.info.ok('generation finished with success in ' + duration.toFixed(1) + 's !');
return output;
});
} | javascript | function generateBook(generator, book, options) {
options = generator.Options(options);
var state = generator.State? generator.State({}) : Immutable.Map();
var start = Date.now();
return Promise(
new Output({
book: book,
options: options,
state: state,
generator: generator.name
})
)
// Cleanup output folder
.then(function(output) {
var logger = output.getLogger();
var rootFolder = output.getRoot();
logger.debug.ln('cleanup folder "' + rootFolder + '"');
return fs.ensureFolder(rootFolder)
.thenResolve(output);
})
.then(processOutput.bind(null, generator))
// Log duration and end message
.then(function(output) {
var logger = output.getLogger();
var end = Date.now();
var duration = (end - start)/1000;
logger.info.ok('generation finished with success in ' + duration.toFixed(1) + 's !');
return output;
});
} | [
"function",
"generateBook",
"(",
"generator",
",",
"book",
",",
"options",
")",
"{",
"options",
"=",
"generator",
".",
"Options",
"(",
"options",
")",
";",
"var",
"state",
"=",
"generator",
".",
"State",
"?",
"generator",
".",
"State",
"(",
"{",
"}",
"... | Generate a book using a generator.
The overall process is:
1. List and load plugins for this book
2. Call hook "config"
3. Call hook "init"
4. Initialize generator
5. List all assets and pages
6. Copy all assets to output
7. Generate all pages
8. Call hook "finish:before"
9. Finish generation
10. Call hook "finish"
@param {Generator} generator
@param {Book} book
@param {Object} options
@return {Promise<Output>} | [
"Generate",
"a",
"book",
"using",
"a",
"generator",
"."
] | 6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4 | https://github.com/GitbookIO/gitbook/blob/6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4/lib/output/generateBook.js#L155-L191 | train | Generate a book | [
30522,
3853,
9699,
8654,
1006,
13103,
1010,
2338,
1010,
7047,
1007,
1063,
7047,
1027,
13103,
1012,
7047,
1006,
7047,
1007,
1025,
13075,
2110,
1027,
13103,
1012,
2110,
1029,
13103,
1012,
2110,
1006,
1063,
1065,
1007,
1024,
10047,
28120,
3085... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/FindReplace.js | clearCurrentMatchHighlight | function clearCurrentMatchHighlight(cm, state) {
if (state.markedCurrent) {
state.markedCurrent.clear();
ScrollTrackMarkers.markCurrent(-1);
}
} | javascript | function clearCurrentMatchHighlight(cm, state) {
if (state.markedCurrent) {
state.markedCurrent.clear();
ScrollTrackMarkers.markCurrent(-1);
}
} | [
"function",
"clearCurrentMatchHighlight",
"(",
"cm",
",",
"state",
")",
"{",
"if",
"(",
"state",
".",
"markedCurrent",
")",
"{",
"state",
".",
"markedCurrent",
".",
"clear",
"(",
")",
";",
"ScrollTrackMarkers",
".",
"markCurrent",
"(",
"-",
"1",
")",
";",
... | Removes the current-match highlight, leaving all matches marked in the generic highlight style | [
"Removes",
"the",
"current",
"-",
"match",
"highlight",
"leaving",
"all",
"matches",
"marked",
"in",
"the",
"generic",
"highlight",
"style"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/search/FindReplace.js#L398-L403 | train | clear current match highlight | [
30522,
3853,
3154,
10841,
14343,
3372,
18900,
2818,
4048,
5603,
7138,
1006,
4642,
1010,
2110,
1007,
1063,
2065,
1006,
2110,
1012,
4417,
10841,
14343,
3372,
1007,
1063,
2110,
1012,
4417,
10841,
14343,
3372,
1012,
3154,
1006,
1007,
1025,
1718... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/table-resolver.js | getTable | function getTable(trxOrKnex, tableName, schemaName) {
return schemaName
? trxOrKnex(tableName).withSchema(schemaName)
: trxOrKnex(tableName);
} | javascript | function getTable(trxOrKnex, tableName, schemaName) {
return schemaName
? trxOrKnex(tableName).withSchema(schemaName)
: trxOrKnex(tableName);
} | [
"function",
"getTable",
"(",
"trxOrKnex",
",",
"tableName",
",",
"schemaName",
")",
"{",
"return",
"schemaName",
"?",
"trxOrKnex",
"(",
"tableName",
")",
".",
"withSchema",
"(",
"schemaName",
")",
":",
"trxOrKnex",
"(",
"tableName",
")",
";",
"}"
] | Get schema-aware query builder for a given table and schema name | [
"Get",
"schema",
"-",
"aware",
"query",
"builder",
"for",
"a",
"given",
"table",
"and",
"schema",
"name"
] | 6a4fecfe7822442ee5c43d924958eadfe6e17a93 | https://github.com/tgriesser/knex/blob/6a4fecfe7822442ee5c43d924958eadfe6e17a93/src/migrate/table-resolver.js#L7-L11 | train | Returns the table name | [
30522,
3853,
2131,
10880,
1006,
19817,
2595,
2953,
2243,
2638,
2595,
1010,
2795,
18442,
1010,
8040,
28433,
18442,
1007,
1063,
2709,
8040,
28433,
18442,
1029,
19817,
2595,
2953,
2243,
2638,
2595,
1006,
2795,
18442,
1007,
1012,
2007,
22842,
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... |
graphql/graphql-js | src/jsutils/suggestionList.js | lexicalDistance | function lexicalDistance(aStr, bStr) {
if (aStr === bStr) {
return 0;
}
let i;
let j;
const d = [];
const a = aStr.toLowerCase();
const b = bStr.toLowerCase();
const aLength = a.length;
const bLength = b.length;
// Any case change counts as a single edit
if (a === b) {
return 1;
}
for (i = 0; i <= aLength; i++) {
d[i] = [i];
}
for (j = 1; j <= bLength; j++) {
d[0][j] = j;
}
for (i = 1; i <= aLength; i++) {
for (j = 1; j <= bLength; j++) {
const cost = a[i - 1] === b[j - 1] ? 0 : 1;
d[i][j] = Math.min(
d[i - 1][j] + 1,
d[i][j - 1] + 1,
d[i - 1][j - 1] + cost,
);
if (i > 1 && j > 1 && a[i - 1] === b[j - 2] && a[i - 2] === b[j - 1]) {
d[i][j] = Math.min(d[i][j], d[i - 2][j - 2] + cost);
}
}
}
return d[aLength][bLength];
} | javascript | function lexicalDistance(aStr, bStr) {
if (aStr === bStr) {
return 0;
}
let i;
let j;
const d = [];
const a = aStr.toLowerCase();
const b = bStr.toLowerCase();
const aLength = a.length;
const bLength = b.length;
// Any case change counts as a single edit
if (a === b) {
return 1;
}
for (i = 0; i <= aLength; i++) {
d[i] = [i];
}
for (j = 1; j <= bLength; j++) {
d[0][j] = j;
}
for (i = 1; i <= aLength; i++) {
for (j = 1; j <= bLength; j++) {
const cost = a[i - 1] === b[j - 1] ? 0 : 1;
d[i][j] = Math.min(
d[i - 1][j] + 1,
d[i][j - 1] + 1,
d[i - 1][j - 1] + cost,
);
if (i > 1 && j > 1 && a[i - 1] === b[j - 2] && a[i - 2] === b[j - 1]) {
d[i][j] = Math.min(d[i][j], d[i - 2][j - 2] + cost);
}
}
}
return d[aLength][bLength];
} | [
"function",
"lexicalDistance",
"(",
"aStr",
",",
"bStr",
")",
"{",
"if",
"(",
"aStr",
"===",
"bStr",
")",
"{",
"return",
"0",
";",
"}",
"let",
"i",
";",
"let",
"j",
";",
"const",
"d",
"=",
"[",
"]",
";",
"const",
"a",
"=",
"aStr",
".",
"toLower... | Computes the lexical distance between strings A and B.
The "distance" between two strings is given by counting the minimum number
of edits needed to transform string A into string B. An edit can be an
insertion, deletion, or substitution of a single character, or a swap of two
adjacent characters.
Includes a custom alteration from Damerau-Levenshtein to treat case changes
as a single edit which helps identify mis-cased values with an edit distance
of 1.
This distance can be useful for detecting typos in input or sorting
@param {string} a
@param {string} b
@return {int} distance in number of edits | [
"Computes",
"the",
"lexical",
"distance",
"between",
"strings",
"A",
"and",
"B",
"."
] | b65ff6db8893c1c68f0f236c4b2d663e6c55f5ef | https://github.com/graphql/graphql-js/blob/b65ff6db8893c1c68f0f236c4b2d663e6c55f5ef/src/jsutils/suggestionList.js#L51-L94 | train | Returns the lexical distance between two strings | [
30522,
3853,
16105,
9289,
10521,
26897,
1006,
2004,
16344,
1010,
18667,
16344,
1007,
1063,
2065,
1006,
2004,
16344,
1027,
1027,
1027,
18667,
16344,
1007,
1063,
2709,
1014,
1025,
1065,
2292,
1045,
1025,
2292,
1046,
1025,
9530,
3367,
1040,
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... |
eslint/eslint | lib/util/report-translator.js | normalizeReportLoc | function normalizeReportLoc(descriptor) {
if (descriptor.loc) {
if (descriptor.loc.start) {
return descriptor.loc;
}
return { start: descriptor.loc, end: null };
}
return descriptor.node.loc;
} | javascript | function normalizeReportLoc(descriptor) {
if (descriptor.loc) {
if (descriptor.loc.start) {
return descriptor.loc;
}
return { start: descriptor.loc, end: null };
}
return descriptor.node.loc;
} | [
"function",
"normalizeReportLoc",
"(",
"descriptor",
")",
"{",
"if",
"(",
"descriptor",
".",
"loc",
")",
"{",
"if",
"(",
"descriptor",
".",
"loc",
".",
"start",
")",
"{",
"return",
"descriptor",
".",
"loc",
";",
"}",
"return",
"{",
"start",
":",
"descr... | Normalizes a MessageDescriptor to always have a `loc` with `start` and `end` properties
@param {MessageDescriptor} descriptor A descriptor for the report from a rule.
@returns {{start: Location, end: (Location|null)}} An updated location that infers the `start` and `end` properties
from the `node` of the original descriptor, or infers the `start` from the `loc` of the original descriptor. | [
"Normalizes",
"a",
"MessageDescriptor",
"to",
"always",
"have",
"a",
"loc",
"with",
"start",
"and",
"end",
"properties"
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/util/report-translator.js#L106-L114 | train | Normalize the loc of a report | [
30522,
3853,
3671,
17629,
13699,
11589,
4135,
2278,
1006,
4078,
23235,
2953,
1007,
1063,
2065,
1006,
4078,
23235,
2953,
1012,
8840,
2278,
1007,
1063,
2065,
1006,
4078,
23235,
2953,
1012,
8840,
2278,
1012,
2707,
1007,
1063,
2709,
4078,
23235... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 | templateRepeat | function templateRepeat(oElement, oWithControl) {
var sList = oElement.getAttribute("list") || "",
oBindingInfo
= BindingParser.complexParser(sList, oScope, false, true, true, true),
aContexts,
oListBinding,
sModelName,
oNewWithControl,
oPromise,
sVar = oElement.getAttribute("var");
if (sVar === "") {
error("Missing variable name for ", oElement);
}
if (!oBindingInfo) {
error("Missing binding for ", oElement);
}
if (oBindingInfo.functionsNotFound) {
warn(oElement, 'Function name(s)', oBindingInfo.functionsNotFound.join(", "),
'not found');
}
// set up a scope for the loop variable, so to say
oNewWithControl = new Repeat();
oWithControl.setChild(oNewWithControl);
// use a list binding to get an array of contexts
oBindingInfo.mode = BindingMode.OneTime;
oNewWithControl.bindAggregation("list", oBindingInfo);
oListBinding = oNewWithControl.getBinding("list");
oNewWithControl.unbindAggregation("list", true);
sModelName = oBindingInfo.model; // added by bindAggregation
if (!oListBinding) {
error("Missing model '" + sModelName + "' in ", oElement);
}
oListBinding.enableExtendedChangeDetection();
aContexts = oListBinding.getContexts(oBindingInfo.startIndex, oBindingInfo.length);
if (!oViewInfo.sync && aContexts.dataRequested) {
oPromise = new SyncPromise(function (resolve) {
oListBinding.attachEventOnce("change", resolve);
}).then(function () {
return oListBinding.getContexts(oBindingInfo.startIndex,
oBindingInfo.length);
});
} else {
oPromise = SyncPromise.resolve(aContexts);
}
// set up the model for the loop variable
sVar = sVar || sModelName; // default loop variable is to keep the same model
oNewWithControl.setModel(oListBinding.getModel(), sVar);
// the actual loop
iNestingLevel++;
debug(oElement, "Starting");
return oPromise.then(function (aContexts) {
return stopAndGo(aContexts, function (oContext, i) {
var oSourceNode = (i === aContexts.length - 1)
? oElement
: oElement.cloneNode(true);
// Note: because sVar and sModelName refer to the same model instance, it
// is OK to use sModelName's context for sVar as well (the name is not part
// of the context!)
oNewWithControl.setBindingContext(oContext, sVar);
debug(oElement, sVar, "=", oContext.getPath());
return liftChildNodes(oSourceNode, oNewWithControl, oElement);
}).then(function () {
debugFinished(oElement);
iNestingLevel -= 1;
oElement.parentNode.removeChild(oElement);
});
});
} | javascript | function templateRepeat(oElement, oWithControl) {
var sList = oElement.getAttribute("list") || "",
oBindingInfo
= BindingParser.complexParser(sList, oScope, false, true, true, true),
aContexts,
oListBinding,
sModelName,
oNewWithControl,
oPromise,
sVar = oElement.getAttribute("var");
if (sVar === "") {
error("Missing variable name for ", oElement);
}
if (!oBindingInfo) {
error("Missing binding for ", oElement);
}
if (oBindingInfo.functionsNotFound) {
warn(oElement, 'Function name(s)', oBindingInfo.functionsNotFound.join(", "),
'not found');
}
// set up a scope for the loop variable, so to say
oNewWithControl = new Repeat();
oWithControl.setChild(oNewWithControl);
// use a list binding to get an array of contexts
oBindingInfo.mode = BindingMode.OneTime;
oNewWithControl.bindAggregation("list", oBindingInfo);
oListBinding = oNewWithControl.getBinding("list");
oNewWithControl.unbindAggregation("list", true);
sModelName = oBindingInfo.model; // added by bindAggregation
if (!oListBinding) {
error("Missing model '" + sModelName + "' in ", oElement);
}
oListBinding.enableExtendedChangeDetection();
aContexts = oListBinding.getContexts(oBindingInfo.startIndex, oBindingInfo.length);
if (!oViewInfo.sync && aContexts.dataRequested) {
oPromise = new SyncPromise(function (resolve) {
oListBinding.attachEventOnce("change", resolve);
}).then(function () {
return oListBinding.getContexts(oBindingInfo.startIndex,
oBindingInfo.length);
});
} else {
oPromise = SyncPromise.resolve(aContexts);
}
// set up the model for the loop variable
sVar = sVar || sModelName; // default loop variable is to keep the same model
oNewWithControl.setModel(oListBinding.getModel(), sVar);
// the actual loop
iNestingLevel++;
debug(oElement, "Starting");
return oPromise.then(function (aContexts) {
return stopAndGo(aContexts, function (oContext, i) {
var oSourceNode = (i === aContexts.length - 1)
? oElement
: oElement.cloneNode(true);
// Note: because sVar and sModelName refer to the same model instance, it
// is OK to use sModelName's context for sVar as well (the name is not part
// of the context!)
oNewWithControl.setBindingContext(oContext, sVar);
debug(oElement, sVar, "=", oContext.getPath());
return liftChildNodes(oSourceNode, oNewWithControl, oElement);
}).then(function () {
debugFinished(oElement);
iNestingLevel -= 1;
oElement.parentNode.removeChild(oElement);
});
});
} | [
"function",
"templateRepeat",
"(",
"oElement",
",",
"oWithControl",
")",
"{",
"var",
"sList",
"=",
"oElement",
".",
"getAttribute",
"(",
"\"list\"",
")",
"||",
"\"\"",
",",
"oBindingInfo",
"=",
"BindingParser",
".",
"complexParser",
"(",
"sList",
",",
"oScope"... | Processes a <template:repeat> instruction.
@param {Element} oElement
the <template:repeat> XML DOM element
@param {sap.ui.core.template._with} oWithControl
the parent's "with" control
@returns {sap.ui.base.SyncPromise}
A sync promise which resolves with <code>undefined</code> as soon as the loop is
done, or is rejected with a corresponding error if visiting child nodes fails.
@throws {Error}
If the "name" attribute has an empty value, if the "list" attribute cannot be
parsed as a binding, or if that binding uses a model which is missing. | [
"Processes",
"a",
"<template",
":",
"repeat",
">",
"instruction",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/util/XMLPreprocessor.js#L1536-L1609 | train | This function is called when the template is being repeated. It will create a new instance of the Repeat class. | [
30522,
3853,
23561,
2890,
5051,
4017,
1006,
1051,
12260,
3672,
1010,
27593,
8939,
8663,
13181,
2140,
1007,
1063,
13075,
22889,
2923,
1027,
1051,
12260,
3672,
1012,
2131,
19321,
3089,
8569,
2618,
1006,
1000,
2862,
1000,
1007,
1064,
1064,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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(locationUrlOrEntriesArray, options) {
_private.oLog.info(sModuleName + " - Play");
if (_private.isPlayStarted()) {
_private.oLog.error(sModuleName + " - RequestRecorder is already playing, please stop first...");
return;
}
_private.init(options);
var sLocationUrl;
// Check if locationUrl parameter is entries array
// Decide if entries are provided or if a file needs to be loaded.
if (locationUrlOrEntriesArray && Array.isArray(locationUrlOrEntriesArray)) {
_private.mHarFileContent = {};
_private.mHarFileContent.log = { "entries": locationUrlOrEntriesArray.slice(0) };
sLocationUrl = "";
} else {
sLocationUrl = locationUrlOrEntriesArray;
_private.mHarFileContent = _private.loadFile(sLocationUrl);
}
// Provided entries or har file entries must be prepared for usage with the RequestRecorder.
if (_private.mHarFileContent) {
_private.mHarFileContent = _private.prepareEntries(_private.mHarFileContent);
_private.oLog.info(sModuleName + " - Har file found, replay started (" + sLocationUrl + ")");
// If entries are found, start the player
_private.oSinonXhr = sinon.useFakeXMLHttpRequest();
_private.oSinonXhr.useFilters = true;
// Wrapping of Sinon filters, because also sap.ui.core.util.MockServer also use the same sinon instance
_private.aSinonFilters = _private.oSinonXhr.filters;
_private.oSinonXhr.filters = [];
_private.oSinonXhr.addFilter(function(sMethod, sUrl, bAsync, sUsername, sPassword) {
if (!_private.isUrlFiltered(sUrl, _private.aEntriesUrlFilter)) {
return false;
}
for (var i = 0; i < _private.aSinonFilters.length; i++) {
if (_private.aSinonFilters[i](sMethod, sUrl, bAsync, sUsername, sPassword) === false) {
_private.oLog.debug(sModuleName + " - Foreign URL filter from sinon filters are applied.");
return false;
}
}
return true;
});
var fnOnCreate = _private.oSinonXhr.onCreate;
_private.oSinonXhr.onCreate = function(oXhr) {
var fnXhrSend = oXhr.send;
oXhr.send = function() {
if (!_private.isUrlFiltered(oXhr.url, _private.aEntriesUrlFilter)) {
var oEntry;
var mCustomGroup;
// Get next entry
var sUrl = resolveURL(oXhr.url);
sUrl = new URI(sUrl).resource();
sUrl = _private.replaceEntriesUrlByRegex(sUrl);
var sUrlGroup = oXhr.method + sUrl;
var customGroupName = _private.fnCustomGroupNameCallback();
if (!customGroupName) {
customGroupName = _private.sDefaultCustomGroup;
}
if (!_private.mHarFileContent._groupedEntries[customGroupName]) {
throw new Error("Custom group name does not exist: " + customGroupName);
}
mCustomGroup = _private.mHarFileContent._groupedEntries[customGroupName];
if (!mCustomGroup[sUrlGroup]) {
throw new Error("URL does not exist: " + sUrlGroup);
}
if (!mCustomGroup[sUrlGroup].length) {
throw new Error("No more entries left for: " + sUrlGroup);
}
oEntry = _private.mHarFileContent.log.entries[mCustomGroup[sUrlGroup].shift()];
_private.oLog.info(sModuleName + " - Respond XMLHttpRequest. Method: " + oXhr.method + ", URL: " + sUrl);
_private.respond(oXhr, oEntry);
} else {
fnXhrSend.apply(this, arguments);
}
};
// sinon onCreate call. MockServer use the onCreate hook to the onSend to the xhr.
if (fnOnCreate) {
fnOnCreate.apply(this, arguments);
}
};
}
} | javascript | function(locationUrlOrEntriesArray, options) {
_private.oLog.info(sModuleName + " - Play");
if (_private.isPlayStarted()) {
_private.oLog.error(sModuleName + " - RequestRecorder is already playing, please stop first...");
return;
}
_private.init(options);
var sLocationUrl;
// Check if locationUrl parameter is entries array
// Decide if entries are provided or if a file needs to be loaded.
if (locationUrlOrEntriesArray && Array.isArray(locationUrlOrEntriesArray)) {
_private.mHarFileContent = {};
_private.mHarFileContent.log = { "entries": locationUrlOrEntriesArray.slice(0) };
sLocationUrl = "";
} else {
sLocationUrl = locationUrlOrEntriesArray;
_private.mHarFileContent = _private.loadFile(sLocationUrl);
}
// Provided entries or har file entries must be prepared for usage with the RequestRecorder.
if (_private.mHarFileContent) {
_private.mHarFileContent = _private.prepareEntries(_private.mHarFileContent);
_private.oLog.info(sModuleName + " - Har file found, replay started (" + sLocationUrl + ")");
// If entries are found, start the player
_private.oSinonXhr = sinon.useFakeXMLHttpRequest();
_private.oSinonXhr.useFilters = true;
// Wrapping of Sinon filters, because also sap.ui.core.util.MockServer also use the same sinon instance
_private.aSinonFilters = _private.oSinonXhr.filters;
_private.oSinonXhr.filters = [];
_private.oSinonXhr.addFilter(function(sMethod, sUrl, bAsync, sUsername, sPassword) {
if (!_private.isUrlFiltered(sUrl, _private.aEntriesUrlFilter)) {
return false;
}
for (var i = 0; i < _private.aSinonFilters.length; i++) {
if (_private.aSinonFilters[i](sMethod, sUrl, bAsync, sUsername, sPassword) === false) {
_private.oLog.debug(sModuleName + " - Foreign URL filter from sinon filters are applied.");
return false;
}
}
return true;
});
var fnOnCreate = _private.oSinonXhr.onCreate;
_private.oSinonXhr.onCreate = function(oXhr) {
var fnXhrSend = oXhr.send;
oXhr.send = function() {
if (!_private.isUrlFiltered(oXhr.url, _private.aEntriesUrlFilter)) {
var oEntry;
var mCustomGroup;
// Get next entry
var sUrl = resolveURL(oXhr.url);
sUrl = new URI(sUrl).resource();
sUrl = _private.replaceEntriesUrlByRegex(sUrl);
var sUrlGroup = oXhr.method + sUrl;
var customGroupName = _private.fnCustomGroupNameCallback();
if (!customGroupName) {
customGroupName = _private.sDefaultCustomGroup;
}
if (!_private.mHarFileContent._groupedEntries[customGroupName]) {
throw new Error("Custom group name does not exist: " + customGroupName);
}
mCustomGroup = _private.mHarFileContent._groupedEntries[customGroupName];
if (!mCustomGroup[sUrlGroup]) {
throw new Error("URL does not exist: " + sUrlGroup);
}
if (!mCustomGroup[sUrlGroup].length) {
throw new Error("No more entries left for: " + sUrlGroup);
}
oEntry = _private.mHarFileContent.log.entries[mCustomGroup[sUrlGroup].shift()];
_private.oLog.info(sModuleName + " - Respond XMLHttpRequest. Method: " + oXhr.method + ", URL: " + sUrl);
_private.respond(oXhr, oEntry);
} else {
fnXhrSend.apply(this, arguments);
}
};
// sinon onCreate call. MockServer use the onCreate hook to the onSend to the xhr.
if (fnOnCreate) {
fnOnCreate.apply(this, arguments);
}
};
}
} | [
"function",
"(",
"locationUrlOrEntriesArray",
",",
"options",
")",
"{",
"_private",
".",
"oLog",
".",
"info",
"(",
"sModuleName",
"+",
"\" - Play\"",
")",
";",
"if",
"(",
"_private",
".",
"isPlayStarted",
"(",
")",
")",
"{",
"_private",
".",
"oLog",
".",
... | Start replay with a complete URL to the har file or with an entries array and the required options.
@param {string|Array} locationUrlOrEntriesArray Specifies from which location the file is loaded. This parameter is overloaded and can also be an entries array.
@param {object} [options] Contains optional parameters to config the RequestRecorder:
{boolean|object} [options.delay] If a the parameter is equals true, the recorded delay timings are used, instead of the default delay equals zero. If a map as parameter is used, the delay is calculated with the delaysettings in the object. Possible settings are max, min, offset, factor.
{function} [options.customGroupNameCallback] A callback is used to determine the custom group name of the current XMLHttpRequest. If the callback returns a falsy value, the default group name is used.
{array|RegExp} [options.entriesUrlFilter] A list of regular expressions, if it matches the URL the request-entry is filtered.
{array|object} [options.entriesUrlReplace] A list of objects with regex and value to replace. E.g.: "{ regex: new RegExp("RegexToSearchForInUrl"), "value": "newValueString" }" | [
"Start",
"replay",
"with",
"a",
"complete",
"URL",
"to",
"the",
"har",
"file",
"or",
"with",
"an",
"entries",
"array",
"and",
"the",
"required",
"options",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/RequestRecorder.js#L640-L728 | train | Play the request recorder | [
30522,
3853,
1006,
3295,
3126,
20186,
3372,
5134,
2906,
9447,
1010,
7047,
1007,
1063,
1035,
2797,
1012,
19330,
8649,
1012,
18558,
1006,
15488,
7716,
9307,
18442,
1009,
1000,
1011,
2377,
1000,
1007,
1025,
2065,
1006,
1035,
2797,
1012,
2003,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | src/sap.ui.core/src/sap/ui/core/Configuration.js | function (mCurrencies) {
// add custom units, or remove the existing ones if none are given
var mExistingCurrencies = this.getCustomCurrencies();
if (mExistingCurrencies){
mCurrencies = jQuery.extend({}, mExistingCurrencies, mCurrencies);
}
this.setCustomCurrencies(mCurrencies);
return this;
} | javascript | function (mCurrencies) {
// add custom units, or remove the existing ones if none are given
var mExistingCurrencies = this.getCustomCurrencies();
if (mExistingCurrencies){
mCurrencies = jQuery.extend({}, mExistingCurrencies, mCurrencies);
}
this.setCustomCurrencies(mCurrencies);
return this;
} | [
"function",
"(",
"mCurrencies",
")",
"{",
"// add custom units, or remove the existing ones if none are given",
"var",
"mExistingCurrencies",
"=",
"this",
".",
"getCustomCurrencies",
"(",
")",
";",
"if",
"(",
"mExistingCurrencies",
")",
"{",
"mCurrencies",
"=",
"jQuery",
... | Adds custom currencies to the existing entries.
E.g.
<code>
{
"KWD": {"digits": 3},
"TND" : {"digits": 3}
}
</code>
@public
@param {object} mCurrencies adds to the currency map
@returns {sap.ui.core.Configuration.FormatSettings}
@see sap.ui.core.Configuration.FormatSettings#setCustomCurrencies | [
"Adds",
"custom",
"currencies",
"to",
"the",
"existing",
"entries",
".",
"E",
".",
"g",
".",
"<code",
">",
"{",
"KWD",
":",
"{",
"digits",
":",
"3",
"}",
"TND",
":",
"{",
"digits",
":",
"3",
"}",
"}",
"<",
"/",
"code",
">"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Configuration.js#L1992-L2000 | train | Adds custom currencies to the currency list | [
30522,
3853,
1006,
11338,
3126,
7389,
9243,
1007,
1063,
1013,
1013,
5587,
7661,
3197,
1010,
2030,
6366,
1996,
4493,
3924,
2065,
3904,
2024,
2445,
13075,
2033,
9048,
16643,
3070,
10841,
14343,
14767,
1027,
2023,
1012,
2131,
7874,
20389,
1084... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | src/sap.ui.fl/src/sap/ui/fl/registry/Settings.js | function(oSettings) {
EventProvider.apply(this);
if (!oSettings) {
throw new Error("no flex settings provided");
}
// Defaults layers used for standard changes, such as 'move' or 'add'
if (!oSettings.defaultLayerPermissions) {
oSettings.defaultLayerPermissions = {
"VENDOR": true,
"CUSTOMER_BASE": true,
"CUSTOMER": true,
"USER": false
};
}
// These are the permissions for the Developer Mode Changes, e.g. 'propertyChange', 'propertyBindingChange'
if (!oSettings.developerModeLayerPermissions) {
oSettings.developerModeLayerPermissions = {
"VENDOR": true,
"CUSTOMER_BASE": true,
"CUSTOMER": false,
"USER": false
};
}
// By default, variant sharing is enabled
if (!(Settings._IS_VARIANT_SHARING_ENABLED in oSettings)) {
oSettings.isVariantSharingEnabled = true;
}
this._oSettings = oSettings;
this._hasMergeErrorOccured = false;
} | javascript | function(oSettings) {
EventProvider.apply(this);
if (!oSettings) {
throw new Error("no flex settings provided");
}
// Defaults layers used for standard changes, such as 'move' or 'add'
if (!oSettings.defaultLayerPermissions) {
oSettings.defaultLayerPermissions = {
"VENDOR": true,
"CUSTOMER_BASE": true,
"CUSTOMER": true,
"USER": false
};
}
// These are the permissions for the Developer Mode Changes, e.g. 'propertyChange', 'propertyBindingChange'
if (!oSettings.developerModeLayerPermissions) {
oSettings.developerModeLayerPermissions = {
"VENDOR": true,
"CUSTOMER_BASE": true,
"CUSTOMER": false,
"USER": false
};
}
// By default, variant sharing is enabled
if (!(Settings._IS_VARIANT_SHARING_ENABLED in oSettings)) {
oSettings.isVariantSharingEnabled = true;
}
this._oSettings = oSettings;
this._hasMergeErrorOccured = false;
} | [
"function",
"(",
"oSettings",
")",
"{",
"EventProvider",
".",
"apply",
"(",
"this",
")",
";",
"if",
"(",
"!",
"oSettings",
")",
"{",
"throw",
"new",
"Error",
"(",
"\"no flex settings provided\"",
")",
";",
"}",
"// Defaults layers used for standard changes, such a... | FlexSettings access
@param {object} oSettings settings as JSON object
@constructor
@alias sap.ui.fl.registry.Settings
@author SAP SE
@experimental Since 1.27.0
@private | [
"FlexSettings",
"access"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/registry/Settings.js#L21-L53 | train | Creates a new instance of the FlexChange event provider. | [
30522,
3853,
1006,
9808,
18319,
3070,
2015,
1007,
1063,
2724,
21572,
17258,
2121,
1012,
6611,
1006,
2023,
1007,
1025,
2065,
1006,
999,
9808,
18319,
3070,
2015,
1007,
1063,
5466,
2047,
7561,
1006,
1000,
2053,
23951,
10906,
3024,
1000,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
adobe/brackets | src/file/FileUtils.js | translateLineEndings | function translateLineEndings(text, lineEndings) {
if (lineEndings !== LINE_ENDINGS_CRLF && lineEndings !== LINE_ENDINGS_LF) {
lineEndings = getPlatformLineEndings();
}
var eolStr = (lineEndings === LINE_ENDINGS_CRLF ? "\r\n" : "\n");
var findAnyEol = /\r\n|\r|\n/g;
return text.replace(findAnyEol, eolStr);
} | javascript | function translateLineEndings(text, lineEndings) {
if (lineEndings !== LINE_ENDINGS_CRLF && lineEndings !== LINE_ENDINGS_LF) {
lineEndings = getPlatformLineEndings();
}
var eolStr = (lineEndings === LINE_ENDINGS_CRLF ? "\r\n" : "\n");
var findAnyEol = /\r\n|\r|\n/g;
return text.replace(findAnyEol, eolStr);
} | [
"function",
"translateLineEndings",
"(",
"text",
",",
"lineEndings",
")",
"{",
"if",
"(",
"lineEndings",
"!==",
"LINE_ENDINGS_CRLF",
"&&",
"lineEndings",
"!==",
"LINE_ENDINGS_LF",
")",
"{",
"lineEndings",
"=",
"getPlatformLineEndings",
"(",
")",
";",
"}",
"var",
... | Translates any line ending types in the given text to the be the single form specified
@param {!string} text
@param {null|LINE_ENDINGS_CRLF|LINE_ENDINGS_LF} lineEndings
@return {string} | [
"Translates",
"any",
"line",
"ending",
"types",
"in",
"the",
"given",
"text",
"to",
"the",
"be",
"the",
"single",
"form",
"specified"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/file/FileUtils.js#L159-L168 | train | Translate the line endings of a string to the correct format | [
30522,
3853,
17637,
4179,
18537,
2015,
1006,
3793,
1010,
2240,
18537,
2015,
1007,
1063,
2065,
1006,
2240,
18537,
2015,
999,
1027,
1027,
2240,
1035,
21306,
1035,
13675,
10270,
1004,
1004,
2240,
18537,
2015,
999,
1027,
1027,
2240,
1035,
21306... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/services/gesture/gesture.js | getEventPoint | function getEventPoint(ev) {
ev = ev.originalEvent || ev; // support jQuery events
return (ev.touches && ev.touches[0]) ||
(ev.changedTouches && ev.changedTouches[0]) ||
ev;
} | javascript | function getEventPoint(ev) {
ev = ev.originalEvent || ev; // support jQuery events
return (ev.touches && ev.touches[0]) ||
(ev.changedTouches && ev.changedTouches[0]) ||
ev;
} | [
"function",
"getEventPoint",
"(",
"ev",
")",
"{",
"ev",
"=",
"ev",
".",
"originalEvent",
"||",
"ev",
";",
"// support jQuery events",
"return",
"(",
"ev",
".",
"touches",
"&&",
"ev",
".",
"touches",
"[",
"0",
"]",
")",
"||",
"(",
"ev",
".",
"changedTou... | Normalize the point where the DOM event happened whether it's touch or mouse.
@returns point event obj with pageX and pageY on it. | [
"Normalize",
"the",
"point",
"where",
"the",
"DOM",
"event",
"happened",
"whether",
"it",
"s",
"touch",
"or",
"mouse",
"."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/services/gesture/gesture.js#L774-L779 | train | get event point | [
30522,
3853,
2131,
18697,
3372,
8400,
1006,
23408,
1007,
1063,
23408,
1027,
23408,
1012,
2434,
18697,
3372,
1064,
1064,
23408,
1025,
1013,
1013,
2490,
1046,
4226,
2854,
2824,
2709,
1006,
23408,
1012,
12817,
1004,
1004,
23408,
1012,
12817,
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/LiveDevelopment/MultiBrowserImpl/protocol/LiveDevProtocol.js | _receive | function _receive(clientId, msgStr) {
var msg = JSON.parse(msgStr),
event = msg.method || "event",
deferred;
if (msg.id) {
deferred = _responseDeferreds[msg.id];
if (deferred) {
delete _responseDeferreds[msg.id];
if (msg.error) {
deferred.reject(msg);
} else {
deferred.resolve(msg);
}
}
} else if (msg.tagId) {
var editor = EditorManager.getActiveEditor(),
position = HTMLInstrumentation.getPositionFromTagId(editor, parseInt(msg.tagId, 10));
if (position) {
editor.setCursorPos(position.line, position.ch, true);
}
} else {
// enrich received message with clientId
msg.clientId = clientId;
exports.trigger(event, msg);
}
} | javascript | function _receive(clientId, msgStr) {
var msg = JSON.parse(msgStr),
event = msg.method || "event",
deferred;
if (msg.id) {
deferred = _responseDeferreds[msg.id];
if (deferred) {
delete _responseDeferreds[msg.id];
if (msg.error) {
deferred.reject(msg);
} else {
deferred.resolve(msg);
}
}
} else if (msg.tagId) {
var editor = EditorManager.getActiveEditor(),
position = HTMLInstrumentation.getPositionFromTagId(editor, parseInt(msg.tagId, 10));
if (position) {
editor.setCursorPos(position.line, position.ch, true);
}
} else {
// enrich received message with clientId
msg.clientId = clientId;
exports.trigger(event, msg);
}
} | [
"function",
"_receive",
"(",
"clientId",
",",
"msgStr",
")",
"{",
"var",
"msg",
"=",
"JSON",
".",
"parse",
"(",
"msgStr",
")",
",",
"event",
"=",
"msg",
".",
"method",
"||",
"\"event\"",
",",
"deferred",
";",
"if",
"(",
"msg",
".",
"id",
")",
"{",
... | @private
Handles a message received from the remote protocol handler via the transport.
If the message has an `id` field, it's assumed to be a response to a previous
request, and will be passed along to the original promise returned by `_send()`.
Otherwise, it's treated as an event and dispatched.
TODO: we should probably have a way of returning the results from all clients, not just the first?
@param {number} clientId ID of the client that sent the message
@param {string} msg The message that was sent, in JSON string format | [
"@private",
"Handles",
"a",
"message",
"received",
"from",
"the",
"remote",
"protocol",
"handler",
"via",
"the",
"transport",
".",
"If",
"the",
"message",
"has",
"an",
"id",
"field",
"it",
"s",
"assumed",
"to",
"be",
"a",
"response",
"to",
"a",
"previous",... | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/LiveDevelopment/MultiBrowserImpl/protocol/LiveDevProtocol.js#L101-L126 | train | receive a message from the client | [
30522,
3853,
1035,
4374,
1006,
7396,
3593,
1010,
5796,
5620,
16344,
1007,
1063,
13075,
5796,
2290,
1027,
1046,
3385,
1012,
11968,
3366,
1006,
5796,
5620,
16344,
1007,
1010,
2724,
1027,
5796,
2290,
1012,
4118,
1064,
1064,
1000,
2724,
1000,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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-template.js | getTemplateLiteral | function getTemplateLiteral(currentNode, textBeforeNode, textAfterNode) {
if (currentNode.type === "Literal" && typeof currentNode.value === "string") {
/*
* If the current node is a string literal, escape any instances of ${ or ` to prevent them from being interpreted
* as a template placeholder. However, if the code already contains a backslash before the ${ or `
* for some reason, don't add another backslash, because that would change the meaning of the code (it would cause
* an actual backslash character to appear before the dollar sign).
*/
return `\`${currentNode.raw.slice(1, -1).replace(/\\*(\$\{|`)/gu, matched => {
if (matched.lastIndexOf("\\") % 2) {
return `\\${matched}`;
}
return matched;
// Unescape any quotes that appear in the original Literal that no longer need to be escaped.
}).replace(new RegExp(`\\\\${currentNode.raw[0]}`, "gu"), currentNode.raw[0])}\``;
}
if (currentNode.type === "TemplateLiteral") {
return sourceCode.getText(currentNode);
}
if (isConcatenation(currentNode) && hasStringLiteral(currentNode) && hasNonStringLiteral(currentNode)) {
const plusSign = sourceCode.getFirstTokenBetween(currentNode.left, currentNode.right, token => token.value === "+");
const textBeforePlus = getTextBetween(currentNode.left, plusSign);
const textAfterPlus = getTextBetween(plusSign, currentNode.right);
const leftEndsWithCurly = endsWithTemplateCurly(currentNode.left);
const rightStartsWithCurly = startsWithTemplateCurly(currentNode.right);
if (leftEndsWithCurly) {
// If the left side of the expression ends with a template curly, add the extra text to the end of the curly bracket.
// `foo${bar}` /* comment */ + 'baz' --> `foo${bar /* comment */ }${baz}`
return getTemplateLiteral(currentNode.left, textBeforeNode, textBeforePlus + textAfterPlus).slice(0, -1) +
getTemplateLiteral(currentNode.right, null, textAfterNode).slice(1);
}
if (rightStartsWithCurly) {
// Otherwise, if the right side of the expression starts with a template curly, add the text there.
// 'foo' /* comment */ + `${bar}baz` --> `foo${ /* comment */ bar}baz`
return getTemplateLiteral(currentNode.left, textBeforeNode, null).slice(0, -1) +
getTemplateLiteral(currentNode.right, textBeforePlus + textAfterPlus, textAfterNode).slice(1);
}
/*
* Otherwise, these nodes should not be combined into a template curly, since there is nowhere to put
* the text between them.
*/
return `${getTemplateLiteral(currentNode.left, textBeforeNode, null)}${textBeforePlus}+${textAfterPlus}${getTemplateLiteral(currentNode.right, textAfterNode, null)}`;
}
return `\`\${${textBeforeNode || ""}${sourceCode.getText(currentNode)}${textAfterNode || ""}}\``;
} | javascript | function getTemplateLiteral(currentNode, textBeforeNode, textAfterNode) {
if (currentNode.type === "Literal" && typeof currentNode.value === "string") {
/*
* If the current node is a string literal, escape any instances of ${ or ` to prevent them from being interpreted
* as a template placeholder. However, if the code already contains a backslash before the ${ or `
* for some reason, don't add another backslash, because that would change the meaning of the code (it would cause
* an actual backslash character to appear before the dollar sign).
*/
return `\`${currentNode.raw.slice(1, -1).replace(/\\*(\$\{|`)/gu, matched => {
if (matched.lastIndexOf("\\") % 2) {
return `\\${matched}`;
}
return matched;
// Unescape any quotes that appear in the original Literal that no longer need to be escaped.
}).replace(new RegExp(`\\\\${currentNode.raw[0]}`, "gu"), currentNode.raw[0])}\``;
}
if (currentNode.type === "TemplateLiteral") {
return sourceCode.getText(currentNode);
}
if (isConcatenation(currentNode) && hasStringLiteral(currentNode) && hasNonStringLiteral(currentNode)) {
const plusSign = sourceCode.getFirstTokenBetween(currentNode.left, currentNode.right, token => token.value === "+");
const textBeforePlus = getTextBetween(currentNode.left, plusSign);
const textAfterPlus = getTextBetween(plusSign, currentNode.right);
const leftEndsWithCurly = endsWithTemplateCurly(currentNode.left);
const rightStartsWithCurly = startsWithTemplateCurly(currentNode.right);
if (leftEndsWithCurly) {
// If the left side of the expression ends with a template curly, add the extra text to the end of the curly bracket.
// `foo${bar}` /* comment */ + 'baz' --> `foo${bar /* comment */ }${baz}`
return getTemplateLiteral(currentNode.left, textBeforeNode, textBeforePlus + textAfterPlus).slice(0, -1) +
getTemplateLiteral(currentNode.right, null, textAfterNode).slice(1);
}
if (rightStartsWithCurly) {
// Otherwise, if the right side of the expression starts with a template curly, add the text there.
// 'foo' /* comment */ + `${bar}baz` --> `foo${ /* comment */ bar}baz`
return getTemplateLiteral(currentNode.left, textBeforeNode, null).slice(0, -1) +
getTemplateLiteral(currentNode.right, textBeforePlus + textAfterPlus, textAfterNode).slice(1);
}
/*
* Otherwise, these nodes should not be combined into a template curly, since there is nowhere to put
* the text between them.
*/
return `${getTemplateLiteral(currentNode.left, textBeforeNode, null)}${textBeforePlus}+${textAfterPlus}${getTemplateLiteral(currentNode.right, textAfterNode, null)}`;
}
return `\`\${${textBeforeNode || ""}${sourceCode.getText(currentNode)}${textAfterNode || ""}}\``;
} | [
"function",
"getTemplateLiteral",
"(",
"currentNode",
",",
"textBeforeNode",
",",
"textAfterNode",
")",
"{",
"if",
"(",
"currentNode",
".",
"type",
"===",
"\"Literal\"",
"&&",
"typeof",
"currentNode",
".",
"value",
"===",
"\"string\"",
")",
"{",
"/*\n ... | Returns a template literal form of the given node.
@param {ASTNode} currentNode A node that should be converted to a template literal
@param {string} textBeforeNode Text that should appear before the node
@param {string} textAfterNode Text that should appear after the node
@returns {string} A string form of this node, represented as a template literal | [
"Returns",
"a",
"template",
"literal",
"form",
"of",
"the",
"given",
"node",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/prefer-template.js#L181-L234 | train | Get the template literal | [
30522,
30524,
3793,
4783,
29278,
16515,
3207,
1010,
3793,
10354,
16451,
10244,
1007,
1063,
2065,
1006,
2783,
3630,
3207,
1012,
2828,
1027,
1027,
1027,
1000,
18204,
1000,
1004,
1004,
2828,
11253,
2783,
3630,
3207,
1012,
3643,
1027,
1027,
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... |
Dogfalo/materialize | dist/js/materialize.js | Component | function Component(classDef, el, options) {
_classCallCheck(this, Component);
// Display error if el is valid HTML Element
if (!(el instanceof Element)) {
console.error(Error(el + ' is not an HTML Element'));
}
// If exists, destroy and reinitialize in child
var ins = classDef.getInstance(el);
if (!!ins) {
ins.destroy();
}
this.el = el;
this.$el = cash(el);
} | javascript | function Component(classDef, el, options) {
_classCallCheck(this, Component);
// Display error if el is valid HTML Element
if (!(el instanceof Element)) {
console.error(Error(el + ' is not an HTML Element'));
}
// If exists, destroy and reinitialize in child
var ins = classDef.getInstance(el);
if (!!ins) {
ins.destroy();
}
this.el = el;
this.$el = cash(el);
} | [
"function",
"Component",
"(",
"classDef",
",",
"el",
",",
"options",
")",
"{",
"_classCallCheck",
"(",
"this",
",",
"Component",
")",
";",
"// Display error if el is valid HTML Element",
"if",
"(",
"!",
"(",
"el",
"instanceof",
"Element",
")",
")",
"{",
"conso... | Generic constructor for all components
@constructor
@param {Element} el
@param {Object} options | [
"Generic",
"constructor",
"for",
"all",
"components"
] | 1122efadad8f1433d404696f7613e3cc13fb83a4 | https://github.com/Dogfalo/materialize/blob/1122efadad8f1433d404696f7613e3cc13fb83a4/dist/js/materialize.js#L1014-L1030 | train | A component class that can be used to create a new node | [
30522,
3853,
6922,
1006,
2465,
3207,
2546,
1010,
3449,
1010,
7047,
1007,
1063,
1035,
2465,
9289,
29358,
11012,
1006,
2023,
1010,
6922,
1007,
1025,
1013,
1013,
4653,
7561,
2065,
3449,
2003,
9398,
16129,
5783,
2065,
1006,
999,
1006,
3449,
6... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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.f/src/sap/f/library.js | function(DataType) {
"use strict";
// delegate further initialization of this library to the Core
sap.ui.getCore().initLibrary({
name : "sap.f",
version: "${version}",
dependencies : ["sap.ui.core", "sap.m", "sap.ui.layout"],
designtime: "sap/f/designtime/library.designtime",
interfaces: [
"sap.f.cards.IHeader",
"sap.f.ICard",
"sap.f.IShellBar",
"sap.f.IDynamicPageStickyContent"
],
types: [
"sap.f.cards.HeaderPosition",
"sap.f.LayoutType",
"sap.f.DynamicPageTitleArea",
"sap.f.DynamicPageTitleShrinkRatio"
],
controls: [
"sap.f.Avatar",
"sap.f.cards.Header",
"sap.f.cards.NumericHeader",
"sap.f.cards.NumericSideIndicator",
"sap.f.Card",
"sap.f.GridContainer",
"sap.f.DynamicPage",
"sap.f.DynamicPageHeader",
"sap.f.DynamicPageTitle",
"sap.f.FlexibleColumnLayout",
"sap.f.semantic.SemanticPage",
"sap.f.GridList",
"sap.f.ShellBar"
],
elements: [
"sap.f.GridContainerItemLayoutData",
"sap.f.semantic.AddAction",
"sap.f.semantic.CloseAction",
"sap.f.semantic.CopyAction",
"sap.f.semantic.DeleteAction",
"sap.f.semantic.DiscussInJamAction",
"sap.f.semantic.EditAction",
"sap.f.semantic.ExitFullScreenAction",
"sap.f.semantic.FavoriteAction",
"sap.f.semantic.FlagAction",
"sap.f.semantic.FooterMainAction",
"sap.f.semantic.FullScreenAction",
"sap.f.semantic.MessagesIndicator",
"sap.f.semantic.NegativeAction",
"sap.f.semantic.PositiveAction",
"sap.f.semantic.PrintAction",
"sap.f.semantic.SemanticButton",
"sap.f.semantic.SemanticControl",
"sap.f.semantic.SemanticToggleButton",
"sap.f.semantic.SendEmailAction",
"sap.f.semantic.SendMessageAction",
"sap.f.semantic.ShareInJamAction",
"sap.f.semantic.TitleMainAction"
],
extensions: {
flChangeHandlers: {
"sap.f.DynamicPageHeader" : {
"hideControl": "default",
"unhideControl": "default",
"moveControls": "default"
},
"sap.f.DynamicPageTitle" : "sap/f/flexibility/DynamicPageTitle",
"sap.f.semantic.SemanticPage" : {
"moveControls": "default"
}
},
//Configuration used for rule loading of Support Assistant
"sap.ui.support": {
publicRules: true,
internalRules:true
}
}
});
/**
* SAPUI5 library with controls specialized for SAP Fiori apps.
*
* @namespace
* @alias sap.f
* @author SAP SE
* @version ${version}
* @public
*/
var thisLib = sap.f;
/**
* Defines the areas within the <code>sap.f.DynamicPageTitle</code>.
*
* @enum {string}
* @public
* @since 1.50
* @deprecated Since version 1.54
* @ui5-metamodel This enumeration also will be described in the UI5 (legacy) designtime metamodel
*/
thisLib.DynamicPageTitleArea = {
/**
* The area includes the <code>heading</code>, <code>expandedContent</code> and <code>snappedContent</code> aggregations,
* positioned in the beginning area of the {@link sap.f.DynamicPageTitle}.
*
* @public
*/
Begin: "Begin",
/**
* The area includes the <code>content</code> aggregation,
* positioned in the middle part of the {@link sap.f.DynamicPageTitle}.
*
* @public
*/
Middle: "Middle"
};
/**
* @classdesc A string type that represents the shrink ratios of the areas within the <code>sap.f.DynamicPageTitle</code>.
*
* @namespace
* @public
* @since 1.54
* @ui5-metamodel This simple type also will be described in the UI5 (legacy) designtime metamodel
*/
thisLib.DynamicPageTitleShrinkRatio = DataType.createType('sap.f.DynamicPageTitleShrinkRatio', {
isValid : function(vValue) {
return /^(([0-9]\d*)(\.\d)?:([0-9]\d*)(\.\d)?:([0-9]\d*)(\.\d)?)$/.test(vValue);
}
}, DataType.getType('string'));
/**
* Layouts, representing the number of columns to be displayed and their relative widths for a {@link sap.f.FlexibleColumnLayout} control.
*
* Each layout has a predefined ratio for the three columns, depending on device size. Based on the device and layout, some columns are hidden.
* For more information, refer to the ratios (in %) for each value, listed below: (dash "-" means non-accessible columns).
*
* <b>Note:</b> Please note that on a phone device, due to the limited screen size, only one column can be displayed at a time.
* For all two-column layouts, this column is the <code>Mid</code> column, and for all three-column layouts - the <code>End</code> column,
* even though the respective column may be hidden on desktop and tablet for that particular layout. Therefore some of the names
* (such as <code>ThreeColumnsMidExpandedEndHidden</code> for example) are representative of the desktop scenario only.
*
* For more information, see {@link topic:3b9f760da5b64adf8db7f95247879086 Types of Layout} in the documentation.
*
* @enum {string}
* @public
* @since 1.46
* @ui5-metamodel This enumeration also will be described in the UI5 (legacy) designtime metamodel
*/
thisLib.LayoutType = {
/**
* Desktop: 100/-/- only the Begin column is displayed
*
* Tablet: 100/-/- only the Begin column is displayed
*
* Phone: 100/-/- only the Begin column is displayed
*
* Use to start with a master page.
*
* @public
*/
OneColumn: "OneColumn",
/**
* Desktop: 67/33/- Begin (expanded) and Mid columns are displayed
*
* Tablet: 67/33/- Begin (expanded) and Mid columns are displayed
*
* Phone: -/100/- only the Mid column is displayed
*
* Use to display both a master and a detail page when the user should focus on the master page.
*
* @public
*/
TwoColumnsBeginExpanded: "TwoColumnsBeginExpanded",
/**
* Desktop: 33/67/- Begin and Mid (expanded) columns are displayed
*
* Tablet: 33/67/- Begin and Mid (expanded) columns are displayed
*
* Phone: -/100/- only the Mid column is displayed
*
* Use to display both a master and a detail page when the user should focus on the detail page.
*
* @public
*/
TwoColumnsMidExpanded: "TwoColumnsMidExpanded",
/**
* Desktop: -/100/- only the Mid column is displayed
*
* Tablet: -/100/- only the Mid column is displayed
*
* Phone: -/100/- only the Mid column is displayed
*
* Use to display a detail page only, when the user should focus entirely on it.
*
* @public
*/
MidColumnFullScreen: "MidColumnFullScreen",
/**
* Desktop: 25/50/25 Begin, Mid (expanded) and End columns are displayed
*
* Tablet: 0/67/33 Mid (expanded) and End columns are displayed, Begin is accessible by a layout arrow
*
* Phone: -/-/100 only the End column is displayed
*
* Use to display all three pages (master, detail, detail-detail) when the user should focus on the detail.
*
* @public
*/
ThreeColumnsMidExpanded: "ThreeColumnsMidExpanded",
/**
* Desktop: 25/25/50 Begin, Mid and End (expanded) columns are displayed
*
* Tablet: 0/33/67 Mid and End (expanded) columns are displayed, Begin is accessible by layout arrows
*
* Phone: -/-/100 (only the End column is displayed)
*
* Use to display all three pages (master, detail, detail-detail) when the user should focus on the detail-detail.
*
* @public
*/
ThreeColumnsEndExpanded: "ThreeColumnsEndExpanded",
/**
* Desktop: 33/67/0 Begin and Mid (expanded) columns are displayed, End is accessible by a layout arrow
*
* Tablet: 33/67/0 Begin and Mid (expanded) columns are displayed, End is accessible by a layout arrow
*
* Phone: -/-/100 only the End column is displayed
*
* Use to display the master and detail pages when the user should focus on the detail.
* The detail-detail is still loaded and easily accessible with a layout arrow.
*
* @public
*/
ThreeColumnsMidExpandedEndHidden: "ThreeColumnsMidExpandedEndHidden",
/**
* Desktop: 67/33/0 Begin (expanded) and Mid columns are displayed, End is accessible by layout arrows
*
* Tablet: 67/33/0 Begin (expanded) and Mid columns are displayed, End is accessible by layout arrows
*
* Phone: -/-/100 only the End column is displayed
*
* Use to display the master and detail pages when the user should focus on the master.
* The detail-detail is still loaded and easily accessible with layout arrows.
*
* @public
*/
ThreeColumnsBeginExpandedEndHidden: "ThreeColumnsBeginExpandedEndHidden",
/**
* Desktop: -/-/100 only the End column is displayed
*
* Tablet: -/-/100 only the End column is displayed
*
* Phone: -/-/100 only the End column is displayed
*
* Use to display a detail-detail page only, when the user should focus entirely on it.
*
* @public
*/
EndColumnFullScreen: "EndColumnFullScreen"
};
sap.ui.lazyRequire("sap.f.routing.Router");
sap.ui.lazyRequire("sap.f.routing.Target");
sap.ui.lazyRequire("sap.f.routing.TargetHandler");
sap.ui.lazyRequire("sap.f.routing.Targets");
/**
* Types of shape for the {@link sap.f.Avatar} control.
*
* @enum {string}
* @public
* @since 1.46
* @ui5-metamodel This enumeration also will be described in the UI5 (legacy) designtime metamodel
*/
thisLib.AvatarShape = {
/**
* Circular shape.
* @public
*/
Circle: "Circle",
/**
* Square shape.
* @public
*/
Square: "Square"
};
/**
* Predefined sizes for the {@link sap.f.Avatar} control.
*
* @enum {string}
* @public
* @since 1.46
* @ui5-metamodel This enumeration also will be described in the UI5 (legacy) designtime metamodel
*/
thisLib.AvatarSize = {
/**
* Control size - 2rem
* Font size - 0.75rem
* @public
*/
XS: "XS",
/**
* Control size - 3rem
* Font size - 1.125rem
* @public
*/
S: "S",
/**
* Control size - 4rem
* Font size - 1.625rem
* @public
*/
M: "M",
/**
* Control size - 5rem
* Font size - 2rem
* @public
*/
L: "L",
/**
* Control size - 7rem
* Font size - 2.75rem
* @public
*/
XL: "XL",
/**
* Custom size
* @public
*/
Custom: "Custom"
};
/**
* Interface for controls suitable for the <code>stickySubheaderProvider</code>
* association of <code>{@link sap.f.DynamicPage}</code>.
*
* Controls that implemenet this interface should have the following methods:
* <ul>
* <li><code>_getStickyContent</code> - returns the content (control) used in the
* subheader</li>
* <li><code>_returnStickyContent</code> - accepts control as argument and ensures
* that the control is placed back in its place in the provider</li>
* <li><code>_getStickySubHeaderSticked</code> - returns boolean value that shows
* where the sticky content is placed (in its provider or in the
* <code>DynamicPage</code>)</li>
* <li><code>_setStickySubHeaderSticked</code> - accepts a boolean argument to notify
* the provider where its sticky content is placed</li>
* </ul>
*
* @since 1.65
* @name sap.f.IDynamicPageStickyContent
* @interface
* @public
* @ui5-metamodel This interface also will be described in the UI5 (legacy) designtime metamodel
*/
/**
* Types of {@link sap.f.Avatar} based on the displayed content.
*
* @enum {string}
* @public
* @since 1.46
* @ui5-metamodel This enumeration also will be described in the UI5 (legacy) designtime metamodel
*/
thisLib.AvatarType = {
/**
* The displayed content is an icon.
* @public
*/
Icon: "Icon",
/**
* The displayed content is an image.
* @public
*/
Image: "Image",
/**
* The displayed content is initials.
* @public
*/
Initials: "Initials"
};
/**
* Types of image size and position that determine how an image fits in the {@link sap.f.Avatar} control area.
*
* @enum {string}
* @public
* @since 1.46
* @ui5-metamodel This enumeration also will be described in the UI5 (legacy) designtime metamodel
*/
thisLib.AvatarImageFitType = {
/**
* The image is scaled to be large enough so that the control area is completely covered.
* @public
*/
Cover: "Cover",
/**
* The image is scaled to the largest size so that both its width and height can fit in the control area.
* @public
*/
Contain: "Contain"
};
/**
* Interface for card controls
*
* @since 1.62
* @public
* @interface
* @name sap.f.ICard
*/
/**
* The function is used to allow for a common header renderer between different card implementations
*
* @returns {sap.f.cards.IHeader} The header of the card
* @since 1.62
* @public
* @function
* @name sap.f.ICard.getCardHeader
*/
/**
* The function is used to allow for a common content renderer between different card implementations
*
* @returns {sap.ui.core.Control} The content of the card
* @since 1.62
* @public
* @function
* @name sap.f.ICard.getCardContent
*/
/**
* Allows for a common header renderer between different card implementations.
*
* @returns {sap.f.cards.HeaderPosition} The position of the header of the card
* @since 1.65
* @public
* @function
* @name sap.f.ICard.getCardHeaderPosition
*/
/**
* Marker interface for card headers
*
* @since 1.62
* @public
* @interface
* @name sap.f.cards.IHeader
* @ui5-metamodel This interface also will be described in the UI5 (legacy) designtime metamodel
*/
/**
* Interface for controls suitable for the <code>additionalContent</code> aggregation of <code>{@link sap.f.ShellBar}</code>.
*
* @since 1.63
* @name sap.f.IShellBar
* @experimental Since 1.63, that provides only limited functionality. Also, it can be removed in future versions.
* @public
* @interface
* @ui5-metamodel This interface also will be described in the UI5 (legacy) designtime metamodel
*/
/**
* Different options for the position of the <code>Card</code> header.
*
* @enum {string}
* @public
* @since 1.65
* @ui5-metamodel This interface also will be described in the UI5 (legacy) designtime metamodel
*/
thisLib.cards.HeaderPosition = {
/**
* The Header is over the content.
*
* @public
*/
Top: "Top",
/**
* The Header is under the content.
*
* @public
*/
Bottom: "Bottom"
};
return thisLib;
} | javascript | function(DataType) {
"use strict";
// delegate further initialization of this library to the Core
sap.ui.getCore().initLibrary({
name : "sap.f",
version: "${version}",
dependencies : ["sap.ui.core", "sap.m", "sap.ui.layout"],
designtime: "sap/f/designtime/library.designtime",
interfaces: [
"sap.f.cards.IHeader",
"sap.f.ICard",
"sap.f.IShellBar",
"sap.f.IDynamicPageStickyContent"
],
types: [
"sap.f.cards.HeaderPosition",
"sap.f.LayoutType",
"sap.f.DynamicPageTitleArea",
"sap.f.DynamicPageTitleShrinkRatio"
],
controls: [
"sap.f.Avatar",
"sap.f.cards.Header",
"sap.f.cards.NumericHeader",
"sap.f.cards.NumericSideIndicator",
"sap.f.Card",
"sap.f.GridContainer",
"sap.f.DynamicPage",
"sap.f.DynamicPageHeader",
"sap.f.DynamicPageTitle",
"sap.f.FlexibleColumnLayout",
"sap.f.semantic.SemanticPage",
"sap.f.GridList",
"sap.f.ShellBar"
],
elements: [
"sap.f.GridContainerItemLayoutData",
"sap.f.semantic.AddAction",
"sap.f.semantic.CloseAction",
"sap.f.semantic.CopyAction",
"sap.f.semantic.DeleteAction",
"sap.f.semantic.DiscussInJamAction",
"sap.f.semantic.EditAction",
"sap.f.semantic.ExitFullScreenAction",
"sap.f.semantic.FavoriteAction",
"sap.f.semantic.FlagAction",
"sap.f.semantic.FooterMainAction",
"sap.f.semantic.FullScreenAction",
"sap.f.semantic.MessagesIndicator",
"sap.f.semantic.NegativeAction",
"sap.f.semantic.PositiveAction",
"sap.f.semantic.PrintAction",
"sap.f.semantic.SemanticButton",
"sap.f.semantic.SemanticControl",
"sap.f.semantic.SemanticToggleButton",
"sap.f.semantic.SendEmailAction",
"sap.f.semantic.SendMessageAction",
"sap.f.semantic.ShareInJamAction",
"sap.f.semantic.TitleMainAction"
],
extensions: {
flChangeHandlers: {
"sap.f.DynamicPageHeader" : {
"hideControl": "default",
"unhideControl": "default",
"moveControls": "default"
},
"sap.f.DynamicPageTitle" : "sap/f/flexibility/DynamicPageTitle",
"sap.f.semantic.SemanticPage" : {
"moveControls": "default"
}
},
//Configuration used for rule loading of Support Assistant
"sap.ui.support": {
publicRules: true,
internalRules:true
}
}
});
/**
* SAPUI5 library with controls specialized for SAP Fiori apps.
*
* @namespace
* @alias sap.f
* @author SAP SE
* @version ${version}
* @public
*/
var thisLib = sap.f;
/**
* Defines the areas within the <code>sap.f.DynamicPageTitle</code>.
*
* @enum {string}
* @public
* @since 1.50
* @deprecated Since version 1.54
* @ui5-metamodel This enumeration also will be described in the UI5 (legacy) designtime metamodel
*/
thisLib.DynamicPageTitleArea = {
/**
* The area includes the <code>heading</code>, <code>expandedContent</code> and <code>snappedContent</code> aggregations,
* positioned in the beginning area of the {@link sap.f.DynamicPageTitle}.
*
* @public
*/
Begin: "Begin",
/**
* The area includes the <code>content</code> aggregation,
* positioned in the middle part of the {@link sap.f.DynamicPageTitle}.
*
* @public
*/
Middle: "Middle"
};
/**
* @classdesc A string type that represents the shrink ratios of the areas within the <code>sap.f.DynamicPageTitle</code>.
*
* @namespace
* @public
* @since 1.54
* @ui5-metamodel This simple type also will be described in the UI5 (legacy) designtime metamodel
*/
thisLib.DynamicPageTitleShrinkRatio = DataType.createType('sap.f.DynamicPageTitleShrinkRatio', {
isValid : function(vValue) {
return /^(([0-9]\d*)(\.\d)?:([0-9]\d*)(\.\d)?:([0-9]\d*)(\.\d)?)$/.test(vValue);
}
}, DataType.getType('string'));
/**
* Layouts, representing the number of columns to be displayed and their relative widths for a {@link sap.f.FlexibleColumnLayout} control.
*
* Each layout has a predefined ratio for the three columns, depending on device size. Based on the device and layout, some columns are hidden.
* For more information, refer to the ratios (in %) for each value, listed below: (dash "-" means non-accessible columns).
*
* <b>Note:</b> Please note that on a phone device, due to the limited screen size, only one column can be displayed at a time.
* For all two-column layouts, this column is the <code>Mid</code> column, and for all three-column layouts - the <code>End</code> column,
* even though the respective column may be hidden on desktop and tablet for that particular layout. Therefore some of the names
* (such as <code>ThreeColumnsMidExpandedEndHidden</code> for example) are representative of the desktop scenario only.
*
* For more information, see {@link topic:3b9f760da5b64adf8db7f95247879086 Types of Layout} in the documentation.
*
* @enum {string}
* @public
* @since 1.46
* @ui5-metamodel This enumeration also will be described in the UI5 (legacy) designtime metamodel
*/
thisLib.LayoutType = {
/**
* Desktop: 100/-/- only the Begin column is displayed
*
* Tablet: 100/-/- only the Begin column is displayed
*
* Phone: 100/-/- only the Begin column is displayed
*
* Use to start with a master page.
*
* @public
*/
OneColumn: "OneColumn",
/**
* Desktop: 67/33/- Begin (expanded) and Mid columns are displayed
*
* Tablet: 67/33/- Begin (expanded) and Mid columns are displayed
*
* Phone: -/100/- only the Mid column is displayed
*
* Use to display both a master and a detail page when the user should focus on the master page.
*
* @public
*/
TwoColumnsBeginExpanded: "TwoColumnsBeginExpanded",
/**
* Desktop: 33/67/- Begin and Mid (expanded) columns are displayed
*
* Tablet: 33/67/- Begin and Mid (expanded) columns are displayed
*
* Phone: -/100/- only the Mid column is displayed
*
* Use to display both a master and a detail page when the user should focus on the detail page.
*
* @public
*/
TwoColumnsMidExpanded: "TwoColumnsMidExpanded",
/**
* Desktop: -/100/- only the Mid column is displayed
*
* Tablet: -/100/- only the Mid column is displayed
*
* Phone: -/100/- only the Mid column is displayed
*
* Use to display a detail page only, when the user should focus entirely on it.
*
* @public
*/
MidColumnFullScreen: "MidColumnFullScreen",
/**
* Desktop: 25/50/25 Begin, Mid (expanded) and End columns are displayed
*
* Tablet: 0/67/33 Mid (expanded) and End columns are displayed, Begin is accessible by a layout arrow
*
* Phone: -/-/100 only the End column is displayed
*
* Use to display all three pages (master, detail, detail-detail) when the user should focus on the detail.
*
* @public
*/
ThreeColumnsMidExpanded: "ThreeColumnsMidExpanded",
/**
* Desktop: 25/25/50 Begin, Mid and End (expanded) columns are displayed
*
* Tablet: 0/33/67 Mid and End (expanded) columns are displayed, Begin is accessible by layout arrows
*
* Phone: -/-/100 (only the End column is displayed)
*
* Use to display all three pages (master, detail, detail-detail) when the user should focus on the detail-detail.
*
* @public
*/
ThreeColumnsEndExpanded: "ThreeColumnsEndExpanded",
/**
* Desktop: 33/67/0 Begin and Mid (expanded) columns are displayed, End is accessible by a layout arrow
*
* Tablet: 33/67/0 Begin and Mid (expanded) columns are displayed, End is accessible by a layout arrow
*
* Phone: -/-/100 only the End column is displayed
*
* Use to display the master and detail pages when the user should focus on the detail.
* The detail-detail is still loaded and easily accessible with a layout arrow.
*
* @public
*/
ThreeColumnsMidExpandedEndHidden: "ThreeColumnsMidExpandedEndHidden",
/**
* Desktop: 67/33/0 Begin (expanded) and Mid columns are displayed, End is accessible by layout arrows
*
* Tablet: 67/33/0 Begin (expanded) and Mid columns are displayed, End is accessible by layout arrows
*
* Phone: -/-/100 only the End column is displayed
*
* Use to display the master and detail pages when the user should focus on the master.
* The detail-detail is still loaded and easily accessible with layout arrows.
*
* @public
*/
ThreeColumnsBeginExpandedEndHidden: "ThreeColumnsBeginExpandedEndHidden",
/**
* Desktop: -/-/100 only the End column is displayed
*
* Tablet: -/-/100 only the End column is displayed
*
* Phone: -/-/100 only the End column is displayed
*
* Use to display a detail-detail page only, when the user should focus entirely on it.
*
* @public
*/
EndColumnFullScreen: "EndColumnFullScreen"
};
sap.ui.lazyRequire("sap.f.routing.Router");
sap.ui.lazyRequire("sap.f.routing.Target");
sap.ui.lazyRequire("sap.f.routing.TargetHandler");
sap.ui.lazyRequire("sap.f.routing.Targets");
/**
* Types of shape for the {@link sap.f.Avatar} control.
*
* @enum {string}
* @public
* @since 1.46
* @ui5-metamodel This enumeration also will be described in the UI5 (legacy) designtime metamodel
*/
thisLib.AvatarShape = {
/**
* Circular shape.
* @public
*/
Circle: "Circle",
/**
* Square shape.
* @public
*/
Square: "Square"
};
/**
* Predefined sizes for the {@link sap.f.Avatar} control.
*
* @enum {string}
* @public
* @since 1.46
* @ui5-metamodel This enumeration also will be described in the UI5 (legacy) designtime metamodel
*/
thisLib.AvatarSize = {
/**
* Control size - 2rem
* Font size - 0.75rem
* @public
*/
XS: "XS",
/**
* Control size - 3rem
* Font size - 1.125rem
* @public
*/
S: "S",
/**
* Control size - 4rem
* Font size - 1.625rem
* @public
*/
M: "M",
/**
* Control size - 5rem
* Font size - 2rem
* @public
*/
L: "L",
/**
* Control size - 7rem
* Font size - 2.75rem
* @public
*/
XL: "XL",
/**
* Custom size
* @public
*/
Custom: "Custom"
};
/**
* Interface for controls suitable for the <code>stickySubheaderProvider</code>
* association of <code>{@link sap.f.DynamicPage}</code>.
*
* Controls that implemenet this interface should have the following methods:
* <ul>
* <li><code>_getStickyContent</code> - returns the content (control) used in the
* subheader</li>
* <li><code>_returnStickyContent</code> - accepts control as argument and ensures
* that the control is placed back in its place in the provider</li>
* <li><code>_getStickySubHeaderSticked</code> - returns boolean value that shows
* where the sticky content is placed (in its provider or in the
* <code>DynamicPage</code>)</li>
* <li><code>_setStickySubHeaderSticked</code> - accepts a boolean argument to notify
* the provider where its sticky content is placed</li>
* </ul>
*
* @since 1.65
* @name sap.f.IDynamicPageStickyContent
* @interface
* @public
* @ui5-metamodel This interface also will be described in the UI5 (legacy) designtime metamodel
*/
/**
* Types of {@link sap.f.Avatar} based on the displayed content.
*
* @enum {string}
* @public
* @since 1.46
* @ui5-metamodel This enumeration also will be described in the UI5 (legacy) designtime metamodel
*/
thisLib.AvatarType = {
/**
* The displayed content is an icon.
* @public
*/
Icon: "Icon",
/**
* The displayed content is an image.
* @public
*/
Image: "Image",
/**
* The displayed content is initials.
* @public
*/
Initials: "Initials"
};
/**
* Types of image size and position that determine how an image fits in the {@link sap.f.Avatar} control area.
*
* @enum {string}
* @public
* @since 1.46
* @ui5-metamodel This enumeration also will be described in the UI5 (legacy) designtime metamodel
*/
thisLib.AvatarImageFitType = {
/**
* The image is scaled to be large enough so that the control area is completely covered.
* @public
*/
Cover: "Cover",
/**
* The image is scaled to the largest size so that both its width and height can fit in the control area.
* @public
*/
Contain: "Contain"
};
/**
* Interface for card controls
*
* @since 1.62
* @public
* @interface
* @name sap.f.ICard
*/
/**
* The function is used to allow for a common header renderer between different card implementations
*
* @returns {sap.f.cards.IHeader} The header of the card
* @since 1.62
* @public
* @function
* @name sap.f.ICard.getCardHeader
*/
/**
* The function is used to allow for a common content renderer between different card implementations
*
* @returns {sap.ui.core.Control} The content of the card
* @since 1.62
* @public
* @function
* @name sap.f.ICard.getCardContent
*/
/**
* Allows for a common header renderer between different card implementations.
*
* @returns {sap.f.cards.HeaderPosition} The position of the header of the card
* @since 1.65
* @public
* @function
* @name sap.f.ICard.getCardHeaderPosition
*/
/**
* Marker interface for card headers
*
* @since 1.62
* @public
* @interface
* @name sap.f.cards.IHeader
* @ui5-metamodel This interface also will be described in the UI5 (legacy) designtime metamodel
*/
/**
* Interface for controls suitable for the <code>additionalContent</code> aggregation of <code>{@link sap.f.ShellBar}</code>.
*
* @since 1.63
* @name sap.f.IShellBar
* @experimental Since 1.63, that provides only limited functionality. Also, it can be removed in future versions.
* @public
* @interface
* @ui5-metamodel This interface also will be described in the UI5 (legacy) designtime metamodel
*/
/**
* Different options for the position of the <code>Card</code> header.
*
* @enum {string}
* @public
* @since 1.65
* @ui5-metamodel This interface also will be described in the UI5 (legacy) designtime metamodel
*/
thisLib.cards.HeaderPosition = {
/**
* The Header is over the content.
*
* @public
*/
Top: "Top",
/**
* The Header is under the content.
*
* @public
*/
Bottom: "Bottom"
};
return thisLib;
} | [
"function",
"(",
"DataType",
")",
"{",
"\"use strict\"",
";",
"// delegate further initialization of this library to the Core",
"sap",
".",
"ui",
".",
"getCore",
"(",
")",
".",
"initLibrary",
"(",
"{",
"name",
":",
"\"sap.f\"",
",",
"version",
":",
"\"${version}\"",... | library dependency | [
"library",
"dependency"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.f/src/sap/f/library.js#L13-L522 | train | The sap. f. sap. layout library | [
30522,
3853,
1006,
2951,
13874,
1007,
1063,
1000,
2224,
9384,
1000,
1025,
1013,
1013,
11849,
2582,
3988,
3989,
1997,
2023,
3075,
2000,
1996,
4563,
20066,
1012,
21318,
1012,
2131,
17345,
1006,
1007,
1012,
1999,
4183,
29521,
19848,
2100,
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... | |
SAP/openui5 | src/sap.ui.core/src/sap/ui/model/odata/v4/Context.js | function (oModel, oBinding, sPath) {
iReturnValueContextCount += 1;
return new Context(oModel, oBinding, sPath, undefined, undefined,
iReturnValueContextCount);
} | javascript | function (oModel, oBinding, sPath) {
iReturnValueContextCount += 1;
return new Context(oModel, oBinding, sPath, undefined, undefined,
iReturnValueContextCount);
} | [
"function",
"(",
"oModel",
",",
"oBinding",
",",
"sPath",
")",
"{",
"iReturnValueContextCount",
"+=",
"1",
";",
"return",
"new",
"Context",
"(",
"oModel",
",",
"oBinding",
",",
"sPath",
",",
"undefined",
",",
"undefined",
",",
"iReturnValueContextCount",
")",
... | Creates a return value context for an OData V4 model. A unique ID for this context is
generated and can be retrieved via {@link #getReturnValueContextId}.
@param {sap.ui.model.odata.v4.ODataModel} oModel
The model
@param {sap.ui.model.odata.v4.ODataContextBinding} oBinding
A binding that belongs to the model
@param {string} sPath
An absolute path without trailing slash
@returns {sap.ui.model.odata.v4.Context}
A return value context for an OData V4 model
@throws {Error}
If an invalid path is given
@private | [
"Creates",
"a",
"return",
"value",
"context",
"for",
"an",
"OData",
"V4",
"model",
".",
"A",
"unique",
"ID",
"for",
"this",
"context",
"is",
"generated",
"and",
"can",
"be",
"retrieved",
"via",
"{",
"@link",
"#getReturnValueContextId",
"}",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/Context.js#L889-L894 | train | Creates a context object that can be used to return a value to the next function call. | [
30522,
3853,
1006,
18168,
10244,
2140,
1010,
27885,
22254,
2075,
1010,
14690,
2232,
1007,
1063,
20868,
3388,
14287,
10175,
5657,
8663,
18209,
3597,
16671,
1009,
1027,
1015,
1025,
2709,
2047,
6123,
1006,
18168,
10244,
2140,
1010,
27885,
22254,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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(node, nodeType)
{
nodeType = nodeType || mxConstants.NODETYPE_ELEMENT;
var children = [];
var tmp = node.firstChild;
while (tmp != null)
{
if (tmp.nodeType == nodeType)
{
children.push(tmp);
}
tmp = tmp.nextSibling;
}
return children;
} | javascript | function(node, nodeType)
{
nodeType = nodeType || mxConstants.NODETYPE_ELEMENT;
var children = [];
var tmp = node.firstChild;
while (tmp != null)
{
if (tmp.nodeType == nodeType)
{
children.push(tmp);
}
tmp = tmp.nextSibling;
}
return children;
} | [
"function",
"(",
"node",
",",
"nodeType",
")",
"{",
"nodeType",
"=",
"nodeType",
"||",
"mxConstants",
".",
"NODETYPE_ELEMENT",
";",
"var",
"children",
"=",
"[",
"]",
";",
"var",
"tmp",
"=",
"node",
".",
"firstChild",
";",
"while",
"(",
"tmp",
"!=",
"nu... | Function: getChildNodes
Returns an array of child nodes that are of the given node type.
Parameters:
node - Parent DOM node to return the children from.
nodeType - Optional node type to return. Default is
<mxConstants.NODETYPE_ELEMENT>. | [
"Function",
":",
"getChildNodes"
] | 33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44 | https://github.com/jgraph/mxgraph/blob/33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44/javascript/mxClient.js#L2630-L2648 | train | Returns the children of node | [
30522,
3853,
1006,
13045,
1010,
13045,
13874,
1007,
1063,
13045,
13874,
1027,
13045,
13874,
1064,
1064,
25630,
8663,
12693,
3215,
1012,
13045,
13874,
1035,
5783,
1025,
13075,
2336,
1027,
1031,
1033,
1025,
13075,
1056,
8737,
1027,
13045,
1012,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | src/sap.ui.core/src/sap/ui/model/odata/v4/ODataMetaModel.js | stripPredicate | function stripPredicate(sSegment) {
var i = sSegment.indexOf("(");
return i >= 0 ? sSegment.slice(0, i) : sSegment;
} | javascript | function stripPredicate(sSegment) {
var i = sSegment.indexOf("(");
return i >= 0 ? sSegment.slice(0, i) : sSegment;
} | [
"function",
"stripPredicate",
"(",
"sSegment",
")",
"{",
"var",
"i",
"=",
"sSegment",
".",
"indexOf",
"(",
"\"(\"",
")",
";",
"return",
"i",
">=",
"0",
"?",
"sSegment",
".",
"slice",
"(",
"0",
",",
"i",
")",
":",
"sSegment",
";",
"}"
] | Strips off the predicate from a segment | [
"Strips",
"off",
"the",
"predicate",
"from",
"a",
"segment"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/ODataMetaModel.js#L1562-L1565 | train | Removes predicate from segment | [
30522,
3853,
6167,
28139,
16467,
1006,
7020,
13910,
3672,
1007,
1063,
13075,
1045,
1027,
7020,
13910,
3672,
1012,
5950,
11253,
1006,
1000,
1006,
1000,
1007,
1025,
2709,
1045,
1028,
1027,
1014,
1029,
7020,
13910,
3672,
1012,
14704,
1006,
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... |
grpc/grpc-node | packages/grpc-native-core/src/server.js | handleServerStreaming | function handleServerStreaming(call, handler, metadata) {
var stream = new ServerWritableStream(call, metadata, handler.serialize);
stream.waitForCancel();
var batch = {};
batch[grpc.opType.RECV_MESSAGE] = true;
call.startBatch(batch, function(err, result) {
if (err) {
stream.emit('error', err);
return;
}
try {
stream.request = handler.deserialize(result.read);
} catch (e) {
e.code = constants.status.INTERNAL;
stream.emit('error', e);
return;
}
handler.func(stream);
});
} | javascript | function handleServerStreaming(call, handler, metadata) {
var stream = new ServerWritableStream(call, metadata, handler.serialize);
stream.waitForCancel();
var batch = {};
batch[grpc.opType.RECV_MESSAGE] = true;
call.startBatch(batch, function(err, result) {
if (err) {
stream.emit('error', err);
return;
}
try {
stream.request = handler.deserialize(result.read);
} catch (e) {
e.code = constants.status.INTERNAL;
stream.emit('error', e);
return;
}
handler.func(stream);
});
} | [
"function",
"handleServerStreaming",
"(",
"call",
",",
"handler",
",",
"metadata",
")",
"{",
"var",
"stream",
"=",
"new",
"ServerWritableStream",
"(",
"call",
",",
"metadata",
",",
"handler",
".",
"serialize",
")",
";",
"stream",
".",
"waitForCancel",
"(",
"... | User provided method to handle server streaming methods on the server.
@callback grpc.Server~handleServerStreamingCall
@param {grpc~ServerWritableStream} call The call object
Fully handle a server streaming call
@private
@param {grpc.internal~Call} call The call to handle
@param {Object} handler Request handler object for the method that was called
@param {grpc~Server.handleServerStreamingCall} handler.func The handler
function
@param {grpc~deserialize} handler.deserialize The deserialization function
for request data
@param {grpc~serialize} handler.serialize The serialization function for
response data
@param {grpc.Metadata} metadata Metadata from the client | [
"User",
"provided",
"method",
"to",
"handle",
"server",
"streaming",
"methods",
"on",
"the",
"server",
"."
] | b36b285f4cdb334bbd48f74c12c13bec69961488 | https://github.com/grpc/grpc-node/blob/b36b285f4cdb334bbd48f74c12c13bec69961488/packages/grpc-native-core/src/server.js#L622-L641 | train | Handle server streaming | [
30522,
3853,
16024,
2121,
14028,
25379,
2075,
1006,
2655,
1010,
28213,
1010,
27425,
1007,
1063,
13075,
5460,
1027,
2047,
8241,
13088,
6590,
13510,
25379,
1006,
2655,
1010,
27425,
1010,
28213,
1012,
7642,
4697,
1007,
1025,
5460,
1012,
3524,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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-whitespace-before-property.js | reportError | function reportError(node, leftToken, rightToken) {
const replacementText = node.computed ? "" : ".";
context.report({
node,
message: "Unexpected whitespace before property {{propName}}.",
data: {
propName: sourceCode.getText(node.property)
},
fix(fixer) {
if (!node.computed && astUtils.isDecimalInteger(node.object)) {
/*
* If the object is a number literal, fixing it to something like 5.toString() would cause a SyntaxError.
* Don't fix this case.
*/
return null;
}
return fixer.replaceTextRange([leftToken.range[1], rightToken.range[0]], replacementText);
}
});
} | javascript | function reportError(node, leftToken, rightToken) {
const replacementText = node.computed ? "" : ".";
context.report({
node,
message: "Unexpected whitespace before property {{propName}}.",
data: {
propName: sourceCode.getText(node.property)
},
fix(fixer) {
if (!node.computed && astUtils.isDecimalInteger(node.object)) {
/*
* If the object is a number literal, fixing it to something like 5.toString() would cause a SyntaxError.
* Don't fix this case.
*/
return null;
}
return fixer.replaceTextRange([leftToken.range[1], rightToken.range[0]], replacementText);
}
});
} | [
"function",
"reportError",
"(",
"node",
",",
"leftToken",
",",
"rightToken",
")",
"{",
"const",
"replacementText",
"=",
"node",
".",
"computed",
"?",
"\"\"",
":",
"\".\"",
";",
"context",
".",
"report",
"(",
"{",
"node",
",",
"message",
":",
"\"Unexpected ... | -------------------------------------------------------------------------- Helpers --------------------------------------------------------------------------
Reports whitespace before property token
@param {ASTNode} node - the node to report in the event of an error
@param {Token} leftToken - the left token
@param {Token} rightToken - the right token
@returns {void}
@private | [
"--------------------------------------------------------------------------",
"Helpers",
"--------------------------------------------------------------------------",
"Reports",
"whitespace",
"before",
"property",
"token"
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/no-whitespace-before-property.js#L47-L68 | train | Reports an error with a given node. | [
30522,
3853,
6398,
29165,
1006,
13045,
1010,
2187,
18715,
2368,
1010,
2157,
18715,
2368,
1007,
1063,
9530,
3367,
6110,
18209,
1027,
13045,
1012,
24806,
1029,
1000,
1000,
1024,
1000,
1012,
1000,
1025,
6123,
1012,
3189,
1006,
1063,
13045,
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... |
fex-team/webuploader | _draft/music/webuploader.js | function( file, status ) {
file = this.request( 'get-file', file );
file.setStatus( status || Status.COMPLETE );
file.skipped = true;
// 如果正在上传。
file.blocks && $.each( file.blocks, function( _, v ) {
var _tr = v.transport;
if ( _tr ) {
_tr.abort();
_tr.destroy();
delete v.transport;
}
});
this.owner.trigger( 'uploadSkip', file );
} | javascript | function( file, status ) {
file = this.request( 'get-file', file );
file.setStatus( status || Status.COMPLETE );
file.skipped = true;
// 如果正在上传。
file.blocks && $.each( file.blocks, function( _, v ) {
var _tr = v.transport;
if ( _tr ) {
_tr.abort();
_tr.destroy();
delete v.transport;
}
});
this.owner.trigger( 'uploadSkip', file );
} | [
"function",
"(",
"file",
",",
"status",
")",
"{",
"file",
"=",
"this",
".",
"request",
"(",
"'get-file'",
",",
"file",
")",
";",
"file",
".",
"setStatus",
"(",
"status",
"||",
"Status",
".",
"COMPLETE",
")",
";",
"file",
".",
"skipped",
"=",
"true",
... | 掉过一个文件上传,直接标记指定文件为已上传状态。
@grammar skipFile( file ) => undefined
@method skipFile
@for Uploader | [
"掉过一个文件上传,直接标记指定文件为已上传状态。"
] | 7094e4476c5af3b06993d91dde2d223200b9feb7 | https://github.com/fex-team/webuploader/blob/7094e4476c5af3b06993d91dde2d223200b9feb7/_draft/music/webuploader.js#L4851-L4869 | train | Upload file to the server | [
30522,
3853,
1006,
5371,
1010,
3570,
1007,
1063,
5371,
1027,
2023,
1012,
5227,
1006,
1005,
2131,
1011,
5371,
1005,
1010,
5371,
1007,
1025,
5371,
1012,
4520,
29336,
2271,
1006,
3570,
1064,
1064,
3570,
1012,
3143,
1007,
1025,
5371,
1012,
16... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
eslint/eslint | lib/rules/no-extra-parens.js | doesMemberExpressionContainCallExpression | function doesMemberExpressionContainCallExpression(node) {
let currentNode = node.object;
let currentNodeType = node.object.type;
while (currentNodeType === "MemberExpression") {
currentNode = currentNode.object;
currentNodeType = currentNode.type;
}
return currentNodeType === "CallExpression";
} | javascript | function doesMemberExpressionContainCallExpression(node) {
let currentNode = node.object;
let currentNodeType = node.object.type;
while (currentNodeType === "MemberExpression") {
currentNode = currentNode.object;
currentNodeType = currentNode.type;
}
return currentNodeType === "CallExpression";
} | [
"function",
"doesMemberExpressionContainCallExpression",
"(",
"node",
")",
"{",
"let",
"currentNode",
"=",
"node",
".",
"object",
";",
"let",
"currentNodeType",
"=",
"node",
".",
"object",
".",
"type",
";",
"while",
"(",
"currentNodeType",
"===",
"\"MemberExpressi... | Check if a member expression contains a call expression
@param {ASTNode} node MemberExpression node to evaluate
@returns {boolean} true if found, false if not | [
"Check",
"if",
"a",
"member",
"expression",
"contains",
"a",
"call",
"expression"
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/no-extra-parens.js#L355-L365 | train | Check if a MemberExpression contains a CallExpression | [
30522,
3853,
2515,
4168,
21784,
10288,
20110,
3258,
8663,
18249,
9289,
2571,
2595,
20110,
3258,
1006,
13045,
1007,
1063,
2292,
2783,
3630,
3207,
1027,
13045,
1012,
4874,
1025,
2292,
2783,
3630,
3207,
13874,
1027,
13045,
1012,
4874,
1012,
28... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/TokenUtils.js | offsetInToken | function offsetInToken(ctx) {
var offset = ctx.pos.ch - ctx.token.start;
if (offset < 0) {
console.log("CodeHintUtils: _offsetInToken - Invalid context: pos not in the current token!");
}
return offset;
} | javascript | function offsetInToken(ctx) {
var offset = ctx.pos.ch - ctx.token.start;
if (offset < 0) {
console.log("CodeHintUtils: _offsetInToken - Invalid context: pos not in the current token!");
}
return offset;
} | [
"function",
"offsetInToken",
"(",
"ctx",
")",
"{",
"var",
"offset",
"=",
"ctx",
".",
"pos",
".",
"ch",
"-",
"ctx",
".",
"token",
".",
"start",
";",
"if",
"(",
"offset",
"<",
"0",
")",
"{",
"console",
".",
"log",
"(",
"\"CodeHintUtils: _offsetInToken - ... | In the given context, get the character offset of pos from the start of the token.
@param {!{editor:!CodeMirror, pos:!{ch:number, line:number}, token:Object}} context
@return {number} | [
"In",
"the",
"given",
"context",
"get",
"the",
"character",
"offset",
"of",
"pos",
"from",
"the",
"start",
"of",
"the",
"token",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/utils/TokenUtils.js#L195-L201 | train | Get the offset in the token | [
30522,
3853,
16396,
18447,
11045,
2078,
1006,
14931,
2595,
1007,
1063,
13075,
16396,
1027,
14931,
2595,
1012,
13433,
2015,
1012,
10381,
1011,
14931,
2595,
1012,
19204,
1012,
2707,
1025,
2065,
1006,
16396,
1026,
1014,
1007,
1063,
10122,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/extensions/default/RecentProjects/main.js | handleKeyEvent | function handleKeyEvent() {
if (!$dropdown) {
if (!SidebarView.isVisible()) {
SidebarView.show();
}
$("#project-dropdown-toggle").trigger("click");
$dropdown.focus();
$links = $dropdown.find("a");
// By default, select the most recent project (which is at the top of the list underneath Open Folder),
// but if there are none, select Open Folder instead.
$dropdownItem = $links.eq($links.length > 1 ? 1 : 0);
$dropdownItem.addClass("selected");
// If focusing the dropdown caused a modal bar to close, we need to refocus the dropdown
window.setTimeout(function () {
$dropdown.focus();
}, 0);
}
} | javascript | function handleKeyEvent() {
if (!$dropdown) {
if (!SidebarView.isVisible()) {
SidebarView.show();
}
$("#project-dropdown-toggle").trigger("click");
$dropdown.focus();
$links = $dropdown.find("a");
// By default, select the most recent project (which is at the top of the list underneath Open Folder),
// but if there are none, select Open Folder instead.
$dropdownItem = $links.eq($links.length > 1 ? 1 : 0);
$dropdownItem.addClass("selected");
// If focusing the dropdown caused a modal bar to close, we need to refocus the dropdown
window.setTimeout(function () {
$dropdown.focus();
}, 0);
}
} | [
"function",
"handleKeyEvent",
"(",
")",
"{",
"if",
"(",
"!",
"$dropdown",
")",
"{",
"if",
"(",
"!",
"SidebarView",
".",
"isVisible",
"(",
")",
")",
"{",
"SidebarView",
".",
"show",
"(",
")",
";",
"}",
"$",
"(",
"\"#project-dropdown-toggle\"",
")",
".",... | Show or hide the recent projects dropdown from the toogle command. | [
"Show",
"or",
"hide",
"the",
"recent",
"projects",
"dropdown",
"from",
"the",
"toogle",
"command",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/RecentProjects/main.js#L420-L440 | train | Handle key events | [
30522,
3853,
5047,
14839,
18697,
3372,
1006,
1007,
1063,
2065,
1006,
999,
1002,
4530,
7698,
1007,
1063,
2065,
1006,
999,
2217,
8237,
8584,
1012,
2003,
11365,
7028,
1006,
1007,
1007,
1063,
2217,
8237,
8584,
1012,
2265,
1006,
1007,
1025,
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/_AggregationHelper.js | processMinOrMax | function processMinOrMax(sName, sMinOrMax) {
var sAlias = "UI5" + sMinOrMax + "__" + sName;
aConcatAggregate.push(sName + " with " + sMinOrMax + " as " + sAlias);
if (mAlias2MeasureAndMethod) {
mAlias2MeasureAndMethod[sAlias] = {
measure : sName,
method : sMinOrMax
};
}
} | javascript | function processMinOrMax(sName, sMinOrMax) {
var sAlias = "UI5" + sMinOrMax + "__" + sName;
aConcatAggregate.push(sName + " with " + sMinOrMax + " as " + sAlias);
if (mAlias2MeasureAndMethod) {
mAlias2MeasureAndMethod[sAlias] = {
measure : sName,
method : sMinOrMax
};
}
} | [
"function",
"processMinOrMax",
"(",
"sName",
",",
"sMinOrMax",
")",
"{",
"var",
"sAlias",
"=",
"\"UI5\"",
"+",
"sMinOrMax",
"+",
"\"__\"",
"+",
"sName",
";",
"aConcatAggregate",
".",
"push",
"(",
"sName",
"+",
"\" with \"",
"+",
"sMinOrMax",
"+",
"\" as \"",... | /*
Builds the min/max expression for the "concat" term (for example
"AggregatableProperty with min as UI5min__AggregatableProperty") and adds a
corresponding entry to the optional alias map.
@param {string} sName - An aggregatable property name
@param {string} sMinOrMax - Either "min" or "max" | [
"/",
"*",
"Builds",
"the",
"min",
"/",
"max",
"expression",
"for",
"the",
"concat",
"term",
"(",
"for",
"example",
"AggregatableProperty",
"with",
"min",
"as",
"UI5min__AggregatableProperty",
")",
"and",
"adds",
"a",
"corresponding",
"entry",
"to",
"the",
"opt... | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_AggregationHelper.js#L245-L255 | train | Adds a new aggregate with the given name and a minimum or maximum value. | [
30522,
3853,
2832,
10020,
2953,
17848,
1006,
1055,
18442,
1010,
15488,
5740,
17830,
2595,
1007,
1063,
13075,
16183,
7951,
1027,
1000,
21318,
2629,
1000,
1009,
15488,
5740,
17830,
2595,
1009,
1000,
1035,
1035,
1000,
1009,
1055,
18442,
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... |
babel/babel | packages/babel-parser/src/plugins/jsx/index.js | getQualifiedJSXName | function getQualifiedJSXName(
object: N.JSXIdentifier | N.JSXNamespacedName | N.JSXMemberExpression,
): string {
if (object.type === "JSXIdentifier") {
return object.name;
}
if (object.type === "JSXNamespacedName") {
return object.namespace.name + ":" + object.name.name;
}
if (object.type === "JSXMemberExpression") {
return (
getQualifiedJSXName(object.object) +
"." +
getQualifiedJSXName(object.property)
);
}
// istanbul ignore next
throw new Error("Node had unexpected type: " + object.type);
} | javascript | function getQualifiedJSXName(
object: N.JSXIdentifier | N.JSXNamespacedName | N.JSXMemberExpression,
): string {
if (object.type === "JSXIdentifier") {
return object.name;
}
if (object.type === "JSXNamespacedName") {
return object.namespace.name + ":" + object.name.name;
}
if (object.type === "JSXMemberExpression") {
return (
getQualifiedJSXName(object.object) +
"." +
getQualifiedJSXName(object.property)
);
}
// istanbul ignore next
throw new Error("Node had unexpected type: " + object.type);
} | [
"function",
"getQualifiedJSXName",
"(",
"object",
":",
"N",
".",
"JSXIdentifier",
"|",
"N",
".",
"JSXNamespacedName",
"|",
"N",
".",
"JSXMemberExpression",
",",
")",
":",
"string",
"{",
"if",
"(",
"object",
".",
"type",
"===",
"\"JSXIdentifier\"",
")",
"{",
... | Transforms JSX element name to string. | [
"Transforms",
"JSX",
"element",
"name",
"to",
"string",
"."
] | 1969e6b6aa7d90be3fbb3aca98ea96849656a55a | https://github.com/babel/babel/blob/1969e6b6aa7d90be3fbb3aca98ea96849656a55a/packages/babel-parser/src/plugins/jsx/index.js#L53-L74 | train | Get the qualified name of a JSX identifier or member expression | [
30522,
3853,
2131,
26426,
7810,
22578,
2595,
18442,
1006,
4874,
1024,
1050,
1012,
1046,
2015,
19491,
16778,
8873,
2121,
1064,
1050,
1012,
1046,
2015,
2595,
18442,
23058,
28911,
4168,
1064,
1050,
1012,
1046,
2015,
2595,
4168,
21784,
10288,
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... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/core/format/DateFormat.js | function(oField, oDate, bUTC, oFormat) {
var iDay = bUTC ? oDate.getUTCDay() : oDate.getDay();
if (oField.digits < 4) {
return oFormat.aDaysAbbrev[iDay];
} else if (oField.digits == 4) {
return oFormat.aDaysWide[iDay];
} else if (oField.digits == 5) {
return oFormat.aDaysNarrow[iDay];
} else {
return oFormat.aDaysShort[iDay];
}
} | javascript | function(oField, oDate, bUTC, oFormat) {
var iDay = bUTC ? oDate.getUTCDay() : oDate.getDay();
if (oField.digits < 4) {
return oFormat.aDaysAbbrev[iDay];
} else if (oField.digits == 4) {
return oFormat.aDaysWide[iDay];
} else if (oField.digits == 5) {
return oFormat.aDaysNarrow[iDay];
} else {
return oFormat.aDaysShort[iDay];
}
} | [
"function",
"(",
"oField",
",",
"oDate",
",",
"bUTC",
",",
"oFormat",
")",
"{",
"var",
"iDay",
"=",
"bUTC",
"?",
"oDate",
".",
"getUTCDay",
"(",
")",
":",
"oDate",
".",
"getDay",
"(",
")",
";",
"if",
"(",
"oField",
".",
"digits",
"<",
"4",
")",
... | Day of week name, format style. | [
"Day",
"of",
"week",
"name",
"format",
"style",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/format/DateFormat.js#L996-L1007 | train | Returns the date format for a given field | [
30522,
3853,
1006,
1997,
12891,
1010,
1051,
13701,
1010,
2021,
2278,
1010,
1997,
2953,
18900,
1007,
1063,
13075,
16096,
2100,
1027,
2021,
2278,
1029,
1051,
13701,
1012,
2131,
4904,
19797,
4710,
1006,
1007,
1024,
1051,
13701,
1012,
2131,
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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.