repo stringclasses 192 values | path stringlengths 4 115 | func_name stringlengths 0 45 | original_string stringlengths 74 24k | language stringclasses 1 value | code stringlengths 74 24k | code_tokens listlengths 23 4.2k | docstring stringlengths 2 23.7k | docstring_tokens listlengths 1 810 | sha stringclasses 192 values | url stringlengths 90 200 | partition stringclasses 1 value | summary stringlengths 6 313 | input_ids listlengths 502 502 | token_type_ids listlengths 502 502 | attention_mask listlengths 502 502 | labels listlengths 502 502 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
adobe/brackets | src/widgets/PopUpManager.js | addPopUp | function addPopUp($popUp, removeHandler, autoRemove) {
autoRemove = autoRemove || false;
_popUps.push($popUp[0]);
$popUp.data("PopUpManager-autoRemove", autoRemove);
$popUp.data("PopUpManager-removeHandler", removeHandler);
} | javascript | function addPopUp($popUp, removeHandler, autoRemove) {
autoRemove = autoRemove || false;
_popUps.push($popUp[0]);
$popUp.data("PopUpManager-autoRemove", autoRemove);
$popUp.data("PopUpManager-removeHandler", removeHandler);
} | [
"function",
"addPopUp",
"(",
"$popUp",
",",
"removeHandler",
",",
"autoRemove",
")",
"{",
"autoRemove",
"=",
"autoRemove",
"||",
"false",
";",
"_popUps",
".",
"push",
"(",
"$popUp",
"[",
"0",
"]",
")",
";",
"$popUp",
".",
"data",
"(",
"\"PopUpManager-autoR... | Add Esc key handling for a popup DOM element.
@param {!jQuery} $popUp jQuery object for the DOM element pop-up
@param {function} removeHandler Pop-up specific remove (e.g. display:none or DOM removal)
@param {?Boolean} autoRemove - Specify true to indicate the PopUpManager should
remove the popup from the _popUps array when the popup is closed. Specify false
when the popup is always persistant in the _popUps array. | [
"Add",
"Esc",
"key",
"handling",
"for",
"a",
"popup",
"DOM",
"element",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/widgets/PopUpManager.js#L47-L53 | train | Add a popup to the list of available languages | [
30522,
3853,
5587,
16340,
6279,
1006,
1002,
3769,
6279,
1010,
6366,
11774,
3917,
1010,
8285,
28578,
21818,
1007,
1063,
8285,
28578,
21818,
1027,
8285,
28578,
21818,
1064,
1064,
6270,
1025,
1035,
3769,
22264,
1012,
5245,
1006,
1002,
3769,
62... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
ccxt/ccxt | examples/js/search-all-exchanges.js | function () {
log (' Non-strict search: node', process.argv[1], 'symbol'.green)
log (' Non-strict search: node', process.argv[1], 'currency'.green)
log (' Strict search: node', process.argv[1], '--strict', 'argument'.green)
log (' Search markets only: node', process.argv[1], '--markets', 'argument'.green)
log ('Search currencies only: node', process.argv[1], '--currencies', 'argument'.green)
} | javascript | function () {
log (' Non-strict search: node', process.argv[1], 'symbol'.green)
log (' Non-strict search: node', process.argv[1], 'currency'.green)
log (' Strict search: node', process.argv[1], '--strict', 'argument'.green)
log (' Search markets only: node', process.argv[1], '--markets', 'argument'.green)
log ('Search currencies only: node', process.argv[1], '--currencies', 'argument'.green)
} | [
"function",
"(",
")",
"{",
"log",
"(",
"' Non-strict search: node'",
",",
"process",
".",
"argv",
"[",
"1",
"]",
",",
"'symbol'",
".",
"green",
")",
"log",
"(",
"' Non-strict search: node'",
",",
"process",
".",
"argv",
"[",
"1",
"]",
",",
"'curren... | /* ------------------------------------------------------------------------ | [
"/",
"*",
"------------------------------------------------------------------------"
] | 8168069b9180a465532905e225586215e115a565 | https://github.com/ccxt/ccxt/blob/8168069b9180a465532905e225586215e115a565/examples/js/search-all-exchanges.js#L34-L41 | train | This function is called when the node is not in a node | [
30522,
3853,
1006,
1007,
1063,
8833,
1006,
1005,
2512,
1011,
9384,
3945,
1024,
13045,
1005,
1010,
2832,
1012,
12098,
2290,
2615,
1031,
1015,
1033,
1010,
1005,
6454,
1005,
1012,
2665,
1007,
8833,
1006,
1005,
2512,
1011,
9384,
3945,
1024,
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/support/techinfo/TechnicalInfo.js | function() {
this._oDialog.close();
this._oDialog.destroy();
this._oDialog = null;
if (this._oAssistantPopover) {
this._oAssistantPopover.destroy();
this._oAssistantPopover = null;
}
if (this._oDebugPopover) {
this._oDebugPopover.destroy();
this._oDebugPopover = null;
}
} | javascript | function() {
this._oDialog.close();
this._oDialog.destroy();
this._oDialog = null;
if (this._oAssistantPopover) {
this._oAssistantPopover.destroy();
this._oAssistantPopover = null;
}
if (this._oDebugPopover) {
this._oDebugPopover.destroy();
this._oDebugPopover = null;
}
} | [
"function",
"(",
")",
"{",
"this",
".",
"_oDialog",
".",
"close",
"(",
")",
";",
"this",
".",
"_oDialog",
".",
"destroy",
"(",
")",
";",
"this",
".",
"_oDialog",
"=",
"null",
";",
"if",
"(",
"this",
".",
"_oAssistantPopover",
")",
"{",
"this",
".",... | Closes the technical information dialog | [
"Closes",
"the",
"technical",
"information",
"dialog"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/support/techinfo/TechnicalInfo.js#L90-L104 | train | Destroys the dialog and the assistant and debug popover | [
30522,
3853,
1006,
1007,
1063,
2023,
1012,
1035,
21045,
23067,
2290,
1012,
2485,
1006,
1007,
1025,
2023,
1012,
1035,
21045,
23067,
2290,
1012,
6033,
1006,
1007,
1025,
2023,
1012,
1035,
21045,
23067,
2290,
1027,
19701,
1025,
2065,
1006,
2023... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SheetJS/js-xlsx | xlsx.js | parse_SupBook | function parse_SupBook(blob, length, opts) {
var end = blob.l + length;
var ctab = blob.read_shift(2);
var cch = blob.read_shift(2);
opts.sbcch = cch;
if(cch == 0x0401 || cch == 0x3A01) return [cch, ctab];
if(cch < 0x01 || cch >0xff) throw new Error("Unexpected SupBook type: "+cch);
var virtPath = parse_XLUnicodeStringNoCch(blob, cch);
/* TODO: 2.5.277 Virtual Path */
var rgst = [];
while(end > blob.l) rgst.push(parse_XLUnicodeString(blob));
return [cch, ctab, virtPath, rgst];
} | javascript | function parse_SupBook(blob, length, opts) {
var end = blob.l + length;
var ctab = blob.read_shift(2);
var cch = blob.read_shift(2);
opts.sbcch = cch;
if(cch == 0x0401 || cch == 0x3A01) return [cch, ctab];
if(cch < 0x01 || cch >0xff) throw new Error("Unexpected SupBook type: "+cch);
var virtPath = parse_XLUnicodeStringNoCch(blob, cch);
/* TODO: 2.5.277 Virtual Path */
var rgst = [];
while(end > blob.l) rgst.push(parse_XLUnicodeString(blob));
return [cch, ctab, virtPath, rgst];
} | [
"function",
"parse_SupBook",
"(",
"blob",
",",
"length",
",",
"opts",
")",
"{",
"var",
"end",
"=",
"blob",
".",
"l",
"+",
"length",
";",
"var",
"ctab",
"=",
"blob",
".",
"read_shift",
"(",
"2",
")",
";",
"var",
"cch",
"=",
"blob",
".",
"read_shift"... | TODO: parse 2.4.136 /* [MS-XLS] 2.4.271 | [
"TODO",
":",
"parse",
"2",
".",
"4",
".",
"136",
"/",
"*",
"[",
"MS",
"-",
"XLS",
"]",
"2",
".",
"4",
".",
"271"
] | 9a6d8a1d3d80c78dad5201fb389316f935279cdc | https://github.com/SheetJS/js-xlsx/blob/9a6d8a1d3d80c78dad5201fb389316f935279cdc/xlsx.js#L6183-L6195 | train | Parse SupBook | [
30522,
3853,
11968,
3366,
1035,
10514,
2361,
8654,
1006,
1038,
4135,
2497,
1010,
3091,
1010,
23569,
2015,
1007,
1063,
13075,
2203,
1027,
1038,
4135,
2497,
1012,
1048,
1009,
3091,
1025,
13075,
14931,
7875,
1027,
1038,
4135,
2497,
1012,
3191,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
angular/material | src/components/datepicker/js/dateUtil.js | getWeekOfMonth | function getWeekOfMonth(date) {
var firstDayOfMonth = getFirstDateOfMonth(date);
return Math.floor((firstDayOfMonth.getDay() + date.getDate() - 1) / 7);
} | javascript | function getWeekOfMonth(date) {
var firstDayOfMonth = getFirstDateOfMonth(date);
return Math.floor((firstDayOfMonth.getDay() + date.getDate() - 1) / 7);
} | [
"function",
"getWeekOfMonth",
"(",
"date",
")",
"{",
"var",
"firstDayOfMonth",
"=",
"getFirstDateOfMonth",
"(",
"date",
")",
";",
"return",
"Math",
".",
"floor",
"(",
"(",
"firstDayOfMonth",
".",
"getDay",
"(",
")",
"+",
"date",
".",
"getDate",
"(",
")",
... | Gets the week of the month that a given date occurs in.
@param {Date} date
@returns {number} Index of the week of the month (zero-based). | [
"Gets",
"the",
"week",
"of",
"the",
"month",
"that",
"a",
"given",
"date",
"occurs",
"in",
"."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/datepicker/js/dateUtil.js#L128-L131 | train | Get week of the month | [
30522,
3853,
2131,
28075,
11253,
9629,
2232,
1006,
3058,
1007,
1063,
13075,
2034,
10259,
11253,
9629,
2232,
1027,
2131,
8873,
12096,
13701,
11253,
9629,
2232,
1006,
3058,
1007,
1025,
2709,
8785,
1012,
2723,
1006,
1006,
2034,
10259,
11253,
9... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.table/src/sap/ui/table/TableUtils.js | _invoke | function _invoke(bFinal) {
bFinal = bFinal !== false;
if (bFinal) {
cancel();
}
if (mOptions.trailing) {
invoke(vContext, vArguments, null, bFinal);
}
} | javascript | function _invoke(bFinal) {
bFinal = bFinal !== false;
if (bFinal) {
cancel();
}
if (mOptions.trailing) {
invoke(vContext, vArguments, null, bFinal);
}
} | [
"function",
"_invoke",
"(",
"bFinal",
")",
"{",
"bFinal",
"=",
"bFinal",
"!==",
"false",
";",
"if",
"(",
"bFinal",
")",
"{",
"cancel",
"(",
")",
";",
"}",
"if",
"(",
"mOptions",
".",
"trailing",
")",
"{",
"invoke",
"(",
"vContext",
",",
"vArguments",... | Executes a trailing invocation if it is enabled in the options.
@param {boolean} [bFinal=true] Whether this is the final invocation. | [
"Executes",
"a",
"trailing",
"invocation",
"if",
"it",
"is",
"enabled",
"in",
"the",
"options",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableUtils.js#L1336-L1344 | train | Invoke the function | [
30522,
3853,
1035,
1999,
6767,
3489,
1006,
28939,
13290,
1007,
1063,
28939,
13290,
1027,
28939,
13290,
999,
1027,
1027,
6270,
1025,
2065,
1006,
28939,
13290,
1007,
1063,
17542,
1006,
1007,
1025,
1065,
2065,
1006,
9587,
16790,
2015,
1012,
12... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/75_xlml.js | parse_xlml_data | function parse_xlml_data(xml, ss, data, cell/*:any*/, base, styles, csty, row, arrayf, o) {
var nf = "General", sid = cell.StyleID, S = {}; o = o || {};
var interiors = [];
var i = 0;
if(sid === undefined && row) sid = row.StyleID;
if(sid === undefined && csty) sid = csty.StyleID;
while(styles[sid] !== undefined) {
if(styles[sid].nf) nf = styles[sid].nf;
if(styles[sid].Interior) interiors.push(styles[sid].Interior);
if(!styles[sid].Parent) break;
sid = styles[sid].Parent;
}
switch(data.Type) {
case 'Boolean':
cell.t = 'b';
cell.v = parsexmlbool(xml);
break;
case 'String':
cell.t = 's'; cell.r = xlml_fixstr(unescapexml(xml));
cell.v = xml.indexOf("<") > -1 ? unescapexml(ss) : cell.r;
break;
case 'DateTime':
if(xml.slice(-1) != "Z") xml += "Z";
cell.v = (parseDate(xml) - new Date(Date.UTC(1899, 11, 30))) / (24 * 60 * 60 * 1000);
if(cell.v !== cell.v) cell.v = unescapexml(xml);
else if(cell.v<60) cell.v = cell.v -1;
if(!nf || nf == "General") nf = "yyyy-mm-dd";
/* falls through */
case 'Number':
if(cell.v === undefined) cell.v=+xml;
if(!cell.t) cell.t = 'n';
break;
case 'Error': cell.t = 'e'; cell.v = RBErr[xml]; if(o.cellText !== false) cell.w = xml; break;
default: cell.t = 's'; cell.v = xlml_fixstr(ss||xml); break;
}
safe_format_xlml(cell, nf, o);
if(o.cellFormula !== false) {
if(cell.Formula) {
var fstr = unescapexml(cell.Formula);
/* strictly speaking, the leading = is required but some writers omit */
if(fstr.charCodeAt(0) == 61 /* = */) fstr = fstr.slice(1);
cell.f = rc_to_a1(fstr, base);
delete cell.Formula;
if(cell.ArrayRange == "RC") cell.F = rc_to_a1("RC:RC", base);
else if(cell.ArrayRange) {
cell.F = rc_to_a1(cell.ArrayRange, base);
arrayf.push([safe_decode_range(cell.F), cell.F]);
}
} else {
for(i = 0; i < arrayf.length; ++i)
if(base.r >= arrayf[i][0].s.r && base.r <= arrayf[i][0].e.r)
if(base.c >= arrayf[i][0].s.c && base.c <= arrayf[i][0].e.c)
cell.F = arrayf[i][1];
}
}
if(o.cellStyles) {
interiors.forEach(function(x) {
if(!S.patternType && x.patternType) S.patternType = x.patternType;
});
cell.s = S;
}
if(cell.StyleID !== undefined) cell.ixfe = cell.StyleID;
} | javascript | function parse_xlml_data(xml, ss, data, cell/*:any*/, base, styles, csty, row, arrayf, o) {
var nf = "General", sid = cell.StyleID, S = {}; o = o || {};
var interiors = [];
var i = 0;
if(sid === undefined && row) sid = row.StyleID;
if(sid === undefined && csty) sid = csty.StyleID;
while(styles[sid] !== undefined) {
if(styles[sid].nf) nf = styles[sid].nf;
if(styles[sid].Interior) interiors.push(styles[sid].Interior);
if(!styles[sid].Parent) break;
sid = styles[sid].Parent;
}
switch(data.Type) {
case 'Boolean':
cell.t = 'b';
cell.v = parsexmlbool(xml);
break;
case 'String':
cell.t = 's'; cell.r = xlml_fixstr(unescapexml(xml));
cell.v = xml.indexOf("<") > -1 ? unescapexml(ss) : cell.r;
break;
case 'DateTime':
if(xml.slice(-1) != "Z") xml += "Z";
cell.v = (parseDate(xml) - new Date(Date.UTC(1899, 11, 30))) / (24 * 60 * 60 * 1000);
if(cell.v !== cell.v) cell.v = unescapexml(xml);
else if(cell.v<60) cell.v = cell.v -1;
if(!nf || nf == "General") nf = "yyyy-mm-dd";
/* falls through */
case 'Number':
if(cell.v === undefined) cell.v=+xml;
if(!cell.t) cell.t = 'n';
break;
case 'Error': cell.t = 'e'; cell.v = RBErr[xml]; if(o.cellText !== false) cell.w = xml; break;
default: cell.t = 's'; cell.v = xlml_fixstr(ss||xml); break;
}
safe_format_xlml(cell, nf, o);
if(o.cellFormula !== false) {
if(cell.Formula) {
var fstr = unescapexml(cell.Formula);
/* strictly speaking, the leading = is required but some writers omit */
if(fstr.charCodeAt(0) == 61 /* = */) fstr = fstr.slice(1);
cell.f = rc_to_a1(fstr, base);
delete cell.Formula;
if(cell.ArrayRange == "RC") cell.F = rc_to_a1("RC:RC", base);
else if(cell.ArrayRange) {
cell.F = rc_to_a1(cell.ArrayRange, base);
arrayf.push([safe_decode_range(cell.F), cell.F]);
}
} else {
for(i = 0; i < arrayf.length; ++i)
if(base.r >= arrayf[i][0].s.r && base.r <= arrayf[i][0].e.r)
if(base.c >= arrayf[i][0].s.c && base.c <= arrayf[i][0].e.c)
cell.F = arrayf[i][1];
}
}
if(o.cellStyles) {
interiors.forEach(function(x) {
if(!S.patternType && x.patternType) S.patternType = x.patternType;
});
cell.s = S;
}
if(cell.StyleID !== undefined) cell.ixfe = cell.StyleID;
} | [
"function",
"parse_xlml_data",
"(",
"xml",
",",
"ss",
",",
"data",
",",
"cell",
"/*:any*/",
",",
"base",
",",
"styles",
",",
"csty",
",",
"row",
",",
"arrayf",
",",
"o",
")",
"{",
"var",
"nf",
"=",
"\"General\"",
",",
"sid",
"=",
"cell",
".",
"Styl... | /* TODO: there must exist some form of OSP-blessed spec | [
"/",
"*",
"TODO",
":",
"there",
"must",
"exist",
"some",
"form",
"of",
"OSP",
"-",
"blessed",
"spec"
] | 9a6d8a1d3d80c78dad5201fb389316f935279cdc | https://github.com/SheetJS/js-xlsx/blob/9a6d8a1d3d80c78dad5201fb389316f935279cdc/bits/75_xlml.js#L93-L155 | train | Parse an XLML data | [
30522,
3853,
11968,
3366,
1035,
28712,
19968,
1035,
2951,
1006,
20950,
1010,
7020,
1010,
2951,
1010,
3526,
1013,
1008,
1024,
2151,
1008,
1013,
1010,
2918,
1010,
6782,
1010,
20116,
3723,
1010,
5216,
1010,
9140,
2546,
1010,
1051,
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... |
TryGhost/Ghost | core/server/services/settings/index.js | getAll | function getAll() {
const knownSettings = this.knownSettings(),
settingsToReturn = {};
_.each(knownSettings, function (setting) {
settingsToReturn[setting] = SettingsLoader(setting);
});
return settingsToReturn;
} | javascript | function getAll() {
const knownSettings = this.knownSettings(),
settingsToReturn = {};
_.each(knownSettings, function (setting) {
settingsToReturn[setting] = SettingsLoader(setting);
});
return settingsToReturn;
} | [
"function",
"getAll",
"(",
")",
"{",
"const",
"knownSettings",
"=",
"this",
".",
"knownSettings",
"(",
")",
",",
"settingsToReturn",
"=",
"{",
"}",
";",
"_",
".",
"each",
"(",
"knownSettings",
",",
"function",
"(",
"setting",
")",
"{",
"settingsToReturn",
... | Getter for all YAML settings.
Example: `settings.getAll().then(...)`
will return an Object like this (assuming we're supporting `routes`
and `globals`):
{
routes: {
routes: null,
collections: { '/': [Object] },
resources: { tag: '/tag/{slug}/', author: '/author/{slug}/' }
},
globals: {
config: { url: 'testblog.com' }
}
}
@returns {Object} settingsObject
@description Returns all settings object as defined per YAML files in
`/content/settings` directory. | [
"Getter",
"for",
"all",
"YAML",
"settings",
".",
"Example",
":",
"settings",
".",
"getAll",
"()",
".",
"then",
"(",
"...",
")",
"will",
"return",
"an",
"Object",
"like",
"this",
"(",
"assuming",
"we",
"re",
"supporting",
"routes",
"and",
"globals",
")",
... | bb7bb55cf3e60af99ebbc56099928827b58461bc | https://github.com/TryGhost/Ghost/blob/bb7bb55cf3e60af99ebbc56099928827b58461bc/core/server/services/settings/index.js#L84-L93 | train | Get all the settings | [
30522,
3853,
2131,
8095,
1006,
1007,
1063,
9530,
3367,
2124,
21678,
8613,
1027,
2023,
1012,
2124,
21678,
8613,
1006,
1007,
1010,
10906,
19277,
22299,
1027,
1063,
1065,
1025,
1035,
1012,
2169,
1006,
2124,
21678,
8613,
1010,
3853,
1006,
4292,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
immerjs/immer | src/proxy.js | getOwnPropertyDescriptor | function getOwnPropertyDescriptor(state, prop) {
const owner = source(state)
const desc = Reflect.getOwnPropertyDescriptor(owner, prop)
if (desc) {
desc.writable = true
desc.configurable = !Array.isArray(owner) || prop !== "length"
}
return desc
} | javascript | function getOwnPropertyDescriptor(state, prop) {
const owner = source(state)
const desc = Reflect.getOwnPropertyDescriptor(owner, prop)
if (desc) {
desc.writable = true
desc.configurable = !Array.isArray(owner) || prop !== "length"
}
return desc
} | [
"function",
"getOwnPropertyDescriptor",
"(",
"state",
",",
"prop",
")",
"{",
"const",
"owner",
"=",
"source",
"(",
"state",
")",
"const",
"desc",
"=",
"Reflect",
".",
"getOwnPropertyDescriptor",
"(",
"owner",
",",
"prop",
")",
"if",
"(",
"desc",
")",
"{",
... | Note: We never coerce `desc.value` into an Immer draft, because we can't make the same guarantee in ES5 mode. | [
"Note",
":",
"We",
"never",
"coerce",
"desc",
".",
"value",
"into",
"an",
"Immer",
"draft",
"because",
"we",
"can",
"t",
"make",
"the",
"same",
"guarantee",
"in",
"ES5",
"mode",
"."
] | 4443cace6c23d14536955ce5b2aec92c8c76cacc | https://github.com/immerjs/immer/blob/4443cace6c23d14536955ce5b2aec92c8c76cacc/src/proxy.js#L166-L174 | train | Get the descriptor for a property | [
30522,
3853,
2131,
12384,
21572,
4842,
3723,
6155,
23235,
2953,
1006,
2110,
1010,
17678,
1007,
1063,
9530,
3367,
3954,
1027,
3120,
1006,
2110,
1007,
9530,
3367,
4078,
2278,
1027,
8339,
1012,
2131,
12384,
21572,
4842,
3723,
6155,
23235,
2953... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/jQuery.sap.support.js | function (oExecutionScope, vPresetOrRules) {
if (RuleSetLoader._bRulesCreated) {
return Main.analyze(oExecutionScope, vPresetOrRules);
}
return RuleSetLoader._oMainPromise.then(function () {
return Main.analyze(oExecutionScope, vPresetOrRules);
});
} | javascript | function (oExecutionScope, vPresetOrRules) {
if (RuleSetLoader._bRulesCreated) {
return Main.analyze(oExecutionScope, vPresetOrRules);
}
return RuleSetLoader._oMainPromise.then(function () {
return Main.analyze(oExecutionScope, vPresetOrRules);
});
} | [
"function",
"(",
"oExecutionScope",
",",
"vPresetOrRules",
")",
"{",
"if",
"(",
"RuleSetLoader",
".",
"_bRulesCreated",
")",
"{",
"return",
"Main",
".",
"analyze",
"(",
"oExecutionScope",
",",
"vPresetOrRules",
")",
";",
"}",
"return",
"RuleSetLoader",
".",
"_... | Main method to perform analysis of a given running application.
Allows to choose a particular execution scope - desired part of the UI
to be checked and a flexible way to specify the list of rules to be used.
@memberof jQuery.sap.support
@deprecated Since version 1.60.0. Please use sap/ui/support/RuleAnalyzer instead.
@public
@param {object} [oExecutionScope] The execution scope of the analysis (see {@link topic:e15067d976f24b11907f4c262bd749a0 Execution Scopes}).
@param {string} [oExecutionScope.type = "global"] Possible values are <code>global</code>, <code>subtree</code> or <code>component</code>.
@param {string} [oExecutionScope.parentId] ID of the root element that forms a subtree. Use when the scope is not <code>global</code>.
@param {object|string|object[]} [vPresetOrRules=All rules] This optional parameter allows for selection of subset of rules for the analysis.
You can pass:
<ul>
<li>A rule preset object containing the preset ID and the list of rules it contains.</li>
<li>A string that refers to the ID of a system preset.</li>
<li>An object array with a plain list of rules.</li>
</ul>
@returns {Promise} Notifies the finished state by starting the Analyzer | [
"Main",
"method",
"to",
"perform",
"analysis",
"of",
"a",
"given",
"running",
"application",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.support/src/sap/ui/support/jQuery.sap.support.js#L59-L68 | train | Analyze the given rules | [
30522,
3853,
1006,
1051,
10288,
8586,
13700,
26127,
1010,
21210,
6072,
18903,
12171,
16308,
1007,
1063,
2065,
1006,
3513,
3388,
11066,
2121,
1012,
1035,
7987,
16308,
16748,
4383,
1007,
1063,
2709,
2364,
1012,
17908,
1006,
1051,
30524,
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... | |
openlayers/openlayers | src/ol/format/TopoJSON.js | readPolygonGeometry | function readPolygonGeometry(object, arcs) {
const coordinates = [];
for (let i = 0, ii = object['arcs'].length; i < ii; ++i) {
coordinates[i] = concatenateArcs(object['arcs'][i], arcs);
}
return new Polygon(coordinates);
} | javascript | function readPolygonGeometry(object, arcs) {
const coordinates = [];
for (let i = 0, ii = object['arcs'].length; i < ii; ++i) {
coordinates[i] = concatenateArcs(object['arcs'][i], arcs);
}
return new Polygon(coordinates);
} | [
"function",
"readPolygonGeometry",
"(",
"object",
",",
"arcs",
")",
"{",
"const",
"coordinates",
"=",
"[",
"]",
";",
"for",
"(",
"let",
"i",
"=",
"0",
",",
"ii",
"=",
"object",
"[",
"'arcs'",
"]",
".",
"length",
";",
"i",
"<",
"ii",
";",
"++",
"i... | Create a polygon from a TopoJSON geometry object.
@param {TopoJSONPolygon} object TopoJSON object.
@param {Array<Array<import("../coordinate.js").Coordinate>>} arcs Array of arcs.
@return {Polygon} Geometry. | [
"Create",
"a",
"polygon",
"from",
"a",
"TopoJSON",
"geometry",
"object",
"."
] | f366eaea522388fb575b11010e69d309164baca7 | https://github.com/openlayers/openlayers/blob/f366eaea522388fb575b11010e69d309164baca7/src/ol/format/TopoJSON.js#L261-L267 | train | Read polygon geometry from object | [
30522,
3853,
3191,
18155,
2100,
17036,
8780,
24327,
1006,
4874,
1010,
29137,
1007,
1063,
9530,
3367,
12093,
1027,
1031,
1033,
1025,
2005,
1006,
2292,
1045,
1027,
1014,
1010,
2462,
1027,
4874,
1031,
1005,
29137,
1005,
1033,
1012,
3091,
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... |
angular/material | src/components/autocomplete/demoCustomTemplate/script.js | loadAll | function loadAll() {
var repos = [
{
'name' : 'AngularJS',
'url' : 'https://github.com/angular/angular.js',
'watchers' : '3,623',
'forks' : '16,175',
},
{
'name' : 'Angular',
'url' : 'https://github.com/angular/angular',
'watchers' : '469',
'forks' : '760',
},
{
'name' : 'AngularJS Material',
'url' : 'https://github.com/angular/material',
'watchers' : '727',
'forks' : '1,241',
},
{
'name' : 'Angular Material',
'url' : 'https://github.com/angular/material2',
'watchers' : '727',
'forks' : '1,241',
},
{
'name' : 'Bower Material',
'url' : 'https://github.com/angular/bower-material',
'watchers' : '42',
'forks' : '84',
},
{
'name' : 'Material Start',
'url' : 'https://github.com/angular/material-start',
'watchers' : '81',
'forks' : '303',
}
];
return repos.map(function (repo) {
repo.value = repo.name.toLowerCase();
return repo;
});
} | javascript | function loadAll() {
var repos = [
{
'name' : 'AngularJS',
'url' : 'https://github.com/angular/angular.js',
'watchers' : '3,623',
'forks' : '16,175',
},
{
'name' : 'Angular',
'url' : 'https://github.com/angular/angular',
'watchers' : '469',
'forks' : '760',
},
{
'name' : 'AngularJS Material',
'url' : 'https://github.com/angular/material',
'watchers' : '727',
'forks' : '1,241',
},
{
'name' : 'Angular Material',
'url' : 'https://github.com/angular/material2',
'watchers' : '727',
'forks' : '1,241',
},
{
'name' : 'Bower Material',
'url' : 'https://github.com/angular/bower-material',
'watchers' : '42',
'forks' : '84',
},
{
'name' : 'Material Start',
'url' : 'https://github.com/angular/material-start',
'watchers' : '81',
'forks' : '303',
}
];
return repos.map(function (repo) {
repo.value = repo.name.toLowerCase();
return repo;
});
} | [
"function",
"loadAll",
"(",
")",
"{",
"var",
"repos",
"=",
"[",
"{",
"'name'",
":",
"'AngularJS'",
",",
"'url'",
":",
"'https://github.com/angular/angular.js'",
",",
"'watchers'",
":",
"'3,623'",
",",
"'forks'",
":",
"'16,175'",
",",
"}",
",",
"{",
"'name'",... | Build `components` list of key/value pairs | [
"Build",
"components",
"list",
"of",
"key",
"/",
"value",
"pairs"
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/autocomplete/demoCustomTemplate/script.js#L49-L92 | train | Load all the repos | [
30522,
3853,
7170,
8095,
1006,
1007,
1063,
13075,
16360,
2891,
1027,
1031,
1063,
1005,
2171,
1005,
1024,
1005,
16108,
22578,
1005,
1010,
1005,
24471,
2140,
1005,
1024,
1005,
16770,
1024,
1013,
1013,
21025,
2705,
12083,
1012,
4012,
1013,
161... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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()
{
var b = document.body;
var d = document.documentElement;
try
{
return new mxRectangle(0, 0, b.clientWidth || d.clientWidth, Math.max(b.clientHeight || 0, d.clientHeight));
}
catch (e)
{
return new mxRectangle();
}
} | javascript | function()
{
var b = document.body;
var d = document.documentElement;
try
{
return new mxRectangle(0, 0, b.clientWidth || d.clientWidth, Math.max(b.clientHeight || 0, d.clientHeight));
}
catch (e)
{
return new mxRectangle();
}
} | [
"function",
"(",
")",
"{",
"var",
"b",
"=",
"document",
".",
"body",
";",
"var",
"d",
"=",
"document",
".",
"documentElement",
";",
"try",
"{",
"return",
"new",
"mxRectangle",
"(",
"0",
",",
"0",
",",
"b",
".",
"clientWidth",
"||",
"d",
".",
"clien... | Function: getDocumentSize
Returns the client size for the current document as an <mxRectangle>. | [
"Function",
":",
"getDocumentSize"
] | 33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44 | https://github.com/jgraph/mxgraph/blob/33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44/javascript/mxClient.js#L3478-L3491 | train | Returns the bounds of the document | [
30522,
3853,
1006,
1007,
1063,
13075,
1038,
1027,
6254,
1012,
2303,
1025,
13075,
1040,
1027,
6254,
1012,
6254,
12260,
3672,
1025,
3046,
1063,
2709,
2047,
25630,
2890,
25572,
3070,
2571,
1006,
1014,
1010,
1014,
1010,
1038,
1012,
7396,
9148,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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() {
// Make sure that the DOM is not already loaded
if ( !jQuery.isReady ) {
// Remember that the DOM is ready
jQuery.isReady = true;
// If there are functions bound, to execute
if ( jQuery.readyList ) {
// Execute all of them
jQuery.each( jQuery.readyList, function(){
this.call( document, jQuery );
});
// Reset the list of functions
jQuery.readyList = null;
}
// Trigger any bound ready events
jQuery(document).triggerHandler("ready");
}
} | javascript | function() {
// Make sure that the DOM is not already loaded
if ( !jQuery.isReady ) {
// Remember that the DOM is ready
jQuery.isReady = true;
// If there are functions bound, to execute
if ( jQuery.readyList ) {
// Execute all of them
jQuery.each( jQuery.readyList, function(){
this.call( document, jQuery );
});
// Reset the list of functions
jQuery.readyList = null;
}
// Trigger any bound ready events
jQuery(document).triggerHandler("ready");
}
} | [
"function",
"(",
")",
"{",
"// Make sure that the DOM is not already loaded",
"if",
"(",
"!",
"jQuery",
".",
"isReady",
")",
"{",
"// Remember that the DOM is ready",
"jQuery",
".",
"isReady",
"=",
"true",
";",
"// If there are functions bound, to execute",
"if",
"(",
"... | Handle when the DOM is ready | [
"Handle",
"when",
"the",
"DOM",
"is",
"ready"
] | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/common/src/web/jquery-1.3.2.js#L3022-L3042 | train | This function is called when the DOM is ready | [
30522,
3853,
1006,
1007,
1063,
1013,
1013,
2191,
2469,
2008,
1996,
14383,
2003,
2025,
2525,
8209,
2065,
1006,
999,
1046,
4226,
2854,
1012,
2003,
16416,
5149,
1007,
1063,
1013,
1013,
3342,
2008,
1996,
14383,
2003,
3201,
1046,
4226,
2854,
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... | |
wuchangming/spy-debugger | buildin_modules/weinre/web/demo/weinre-demo.js | openTheOtherDatabase | function openTheOtherDatabase() {
if (otherDB) return
if (window.openDatabase) {
otherDB = window.openDatabase("clicks_other_db", "1.0", "clicks_other_db", 8192)
otherDB.transaction(createDatabase_other)
}
} | javascript | function openTheOtherDatabase() {
if (otherDB) return
if (window.openDatabase) {
otherDB = window.openDatabase("clicks_other_db", "1.0", "clicks_other_db", 8192)
otherDB.transaction(createDatabase_other)
}
} | [
"function",
"openTheOtherDatabase",
"(",
")",
"{",
"if",
"(",
"otherDB",
")",
"return",
"if",
"(",
"window",
".",
"openDatabase",
")",
"{",
"otherDB",
"=",
"window",
".",
"openDatabase",
"(",
"\"clicks_other_db\"",
",",
"\"1.0\"",
",",
"\"clicks_other_db\"",
"... | ------------------------------------------------------------------------------ | [
"------------------------------------------------------------------------------"
] | 55c1dda0dff0c44920673711656ddfd7ff03c307 | https://github.com/wuchangming/spy-debugger/blob/55c1dda0dff0c44920673711656ddfd7ff03c307/buildin_modules/weinre/web/demo/weinre-demo.js#L170-L177 | train | Open the other database | [
30522,
3853,
2330,
10760,
14573,
2121,
2850,
2696,
15058,
1006,
1007,
1063,
2065,
1006,
2060,
18939,
1007,
2709,
2065,
1006,
3332,
1012,
2330,
2850,
2696,
15058,
1007,
1063,
2060,
18939,
1027,
3332,
1012,
2330,
2850,
2696,
15058,
1006,
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... |
LLK/scratch-blocks | blocks_vertical/data.js | function() {
this.jsonInit({
"message0": Blockly.Msg.DATA_SHOWVARIABLE,
"args0": [
{
"type": "field_variable",
"name": "VARIABLE"
}
],
"previousStatement": null,
"nextStatement": null,
"category": Blockly.Categories.data,
"colour": Blockly.Colours.data.primary,
"colourSecondary": Blockly.Colours.data.secondary,
"colourTertiary": Blockly.Colours.data.tertiary
});
} | javascript | function() {
this.jsonInit({
"message0": Blockly.Msg.DATA_SHOWVARIABLE,
"args0": [
{
"type": "field_variable",
"name": "VARIABLE"
}
],
"previousStatement": null,
"nextStatement": null,
"category": Blockly.Categories.data,
"colour": Blockly.Colours.data.primary,
"colourSecondary": Blockly.Colours.data.secondary,
"colourTertiary": Blockly.Colours.data.tertiary
});
} | [
"function",
"(",
")",
"{",
"this",
".",
"jsonInit",
"(",
"{",
"\"message0\"",
":",
"Blockly",
".",
"Msg",
".",
"DATA_SHOWVARIABLE",
",",
"\"args0\"",
":",
"[",
"{",
"\"type\"",
":",
"\"field_variable\"",
",",
"\"name\"",
":",
"\"VARIABLE\"",
"}",
"]",
",",... | Block to show a variable
@this Blockly.Block | [
"Block",
"to",
"show",
"a",
"variable"
] | 455b2a854435c0a67da1da92320ddc3ec3e2b799 | https://github.com/LLK/scratch-blocks/blob/455b2a854435c0a67da1da92320ddc3ec3e2b799/blocks_vertical/data.js#L109-L125 | train | Block for variable list. | [
30522,
3853,
1006,
1007,
1063,
2023,
1012,
1046,
3385,
5498,
2102,
1006,
1063,
1000,
4471,
2692,
1000,
1024,
3796,
2135,
1012,
5796,
2290,
1012,
2951,
1035,
2265,
10755,
19210,
1010,
1000,
12098,
5620,
2692,
1000,
1024,
1031,
1063,
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... | |
SAP/openui5 | src/sap.ui.core/src/sap/ui/model/odata/v4/ODataMetaModel.js | isParameter | function isParameter(sSegment, oOverload) {
var aMatches;
if (sSegment && oOverload.$Parameter) {
aMatches = oOverload.$Parameter.filter(function (oParameter) {
return oParameter.$Name === sSegment;
});
if (aMatches.length) { // there can be at most one match
// Note: annotations at parameter are handled before this method is called
// @see annotationAtParameter
vResult = aMatches[0];
return true;
}
}
return false;
} | javascript | function isParameter(sSegment, oOverload) {
var aMatches;
if (sSegment && oOverload.$Parameter) {
aMatches = oOverload.$Parameter.filter(function (oParameter) {
return oParameter.$Name === sSegment;
});
if (aMatches.length) { // there can be at most one match
// Note: annotations at parameter are handled before this method is called
// @see annotationAtParameter
vResult = aMatches[0];
return true;
}
}
return false;
} | [
"function",
"isParameter",
"(",
"sSegment",
",",
"oOverload",
")",
"{",
"var",
"aMatches",
";",
"if",
"(",
"sSegment",
"&&",
"oOverload",
".",
"$Parameter",
")",
"{",
"aMatches",
"=",
"oOverload",
".",
"$Parameter",
".",
"filter",
"(",
"function",
"(",
"oP... | /*
Tells whether the given segment matches a parameter of the given overload; changes
<code>vResult</code> etc. accordingly.
@param {string} sSegment
A segment
@param {object} oOverload
A single operation overload
@returns {boolean}
<code>true</code> iff the given overload has a parameter with the given name. | [
"/",
"*",
"Tells",
"whether",
"the",
"given",
"segment",
"matches",
"a",
"parameter",
"of",
"the",
"given",
"overload",
";",
"changes",
"<code",
">",
"vResult<",
"/",
"code",
">",
"etc",
".",
"accordingly",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/ODataMetaModel.js#L1081-L1098 | train | Checks if the given segment is a parameter of an overload | [
30522,
3853,
2003,
28689,
22828,
1006,
7020,
13910,
3672,
1010,
1051,
7840,
11066,
1007,
1063,
13075,
25933,
10649,
2229,
1025,
2065,
1006,
7020,
13910,
3672,
1004,
1004,
1051,
7840,
11066,
1012,
1002,
16381,
1007,
1063,
25933,
10649,
2229,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
chartjs/Chart.js | src/scales/scale.time.js | determineUnitForFormatting | function determineUnitForFormatting(scale, ticks, minUnit, min, max) {
var ilen = UNITS.length;
var i, unit;
for (i = ilen - 1; i >= UNITS.indexOf(minUnit); i--) {
unit = UNITS[i];
if (INTERVALS[unit].common && scale._adapter.diff(max, min, unit) >= ticks.length) {
return unit;
}
}
return UNITS[minUnit ? UNITS.indexOf(minUnit) : 0];
} | javascript | function determineUnitForFormatting(scale, ticks, minUnit, min, max) {
var ilen = UNITS.length;
var i, unit;
for (i = ilen - 1; i >= UNITS.indexOf(minUnit); i--) {
unit = UNITS[i];
if (INTERVALS[unit].common && scale._adapter.diff(max, min, unit) >= ticks.length) {
return unit;
}
}
return UNITS[minUnit ? UNITS.indexOf(minUnit) : 0];
} | [
"function",
"determineUnitForFormatting",
"(",
"scale",
",",
"ticks",
",",
"minUnit",
",",
"min",
",",
"max",
")",
"{",
"var",
"ilen",
"=",
"UNITS",
".",
"length",
";",
"var",
"i",
",",
"unit",
";",
"for",
"(",
"i",
"=",
"ilen",
"-",
"1",
";",
"i",... | Figures out what unit to format a set of ticks with | [
"Figures",
"out",
"what",
"unit",
"to",
"format",
"a",
"set",
"of",
"ticks",
"with"
] | f093c36574d290330ed623e60fbd070421c730d5 | https://github.com/chartjs/Chart.js/blob/f093c36574d290330ed623e60fbd070421c730d5/src/scales/scale.time.js#L297-L309 | train | Determine the unit to use for formatting | [
30522,
3853,
5646,
19496,
24475,
16347,
2953,
18900,
3436,
1006,
4094,
1010,
16356,
2015,
1010,
8117,
19496,
2102,
1010,
8117,
1010,
4098,
1007,
1063,
13075,
17869,
2078,
1027,
3197,
1012,
3091,
1025,
13075,
1045,
1010,
3131,
1025,
2005,
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.rta/src/sap/ui/rta/plugin/additionalElements/AdditionalElementsPlugin.js | function(bSibling, oOverlay) {
var mCustomAddActions = this._getCustomAddActions(bSibling, oOverlay);
var mRevealActions = this._getRevealActions(bSibling, oOverlay);
var mAddODataPropertyActions = this._getAddODataPropertyActions(bSibling, oOverlay);
//join and condense both action data
var mOverall = jQuery.extend(true, mRevealActions, mAddODataPropertyActions, mCustomAddActions);
var aAggregationNames = Object.keys(mOverall);
if (aAggregationNames.length === 0){
return {};
} else if (aAggregationNames.length > 1){
Log.error("reveal or addODataProperty action defined for more than 1 aggregation, that is not yet possible");
}
var sAggregationName = aAggregationNames[0];
mOverall[sAggregationName].aggregation = sAggregationName;
return mOverall[sAggregationName];
} | javascript | function(bSibling, oOverlay) {
var mCustomAddActions = this._getCustomAddActions(bSibling, oOverlay);
var mRevealActions = this._getRevealActions(bSibling, oOverlay);
var mAddODataPropertyActions = this._getAddODataPropertyActions(bSibling, oOverlay);
//join and condense both action data
var mOverall = jQuery.extend(true, mRevealActions, mAddODataPropertyActions, mCustomAddActions);
var aAggregationNames = Object.keys(mOverall);
if (aAggregationNames.length === 0){
return {};
} else if (aAggregationNames.length > 1){
Log.error("reveal or addODataProperty action defined for more than 1 aggregation, that is not yet possible");
}
var sAggregationName = aAggregationNames[0];
mOverall[sAggregationName].aggregation = sAggregationName;
return mOverall[sAggregationName];
} | [
"function",
"(",
"bSibling",
",",
"oOverlay",
")",
"{",
"var",
"mCustomAddActions",
"=",
"this",
".",
"_getCustomAddActions",
"(",
"bSibling",
",",
"oOverlay",
")",
";",
"var",
"mRevealActions",
"=",
"this",
".",
"_getRevealActions",
"(",
"bSibling",
",",
"oOv... | Calculate a map with all "add/reveal" action relevant data collected:
<pre>
{
<aggregationName> : {
addODataProperty : {
designTimeMetadata : <sap.ui.dt.ElementDesignTimeMetadata of parent>,
action : <addODataProperty action section from designTimeMetadata>
},
reveal : {
elements : [{
element : <invisible element>,
designTimeMetadata : <sap.ui.dt.ElementDesignTimeMetadata of invisible element>,
action : <reveal action section from designTimeMetadata>
}],
controlTypeNames : string[] <all controlTypeNames collected via designTimeMetadata>
}
custom : {
designTimeMetadata : <sap.ui.dt.ElementDesignTimeMetadata of parent>,
action : <customAdd action section from designTimeMetadata>
items : <customAdd action's array of items from the getItems() function>
}
}
}
</pre>
@param {boolean} bSibling - indicates if the elements should be added as sibling (true) or child (false) to the overlay
@param {sap.ui.dt.ElementOverlay} oOverlay - Elements will be added in relation (sibling/parent) to this overlay
@return {Map} - returns a map with all "add/reveal" action relevant data collected
@private | [
"Calculate",
"a",
"map",
"with",
"all",
"add",
"/",
"reveal",
"action",
"relevant",
"data",
"collected",
":",
"<pre",
">",
"{",
"<aggregationName",
">",
":",
"{",
"addODataProperty",
":",
"{",
"designTimeMetadata",
":",
"<sap",
".",
"ui",
".",
"dt",
".",
... | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.rta/src/sap/ui/rta/plugin/additionalElements/AdditionalElementsPlugin.js#L470-L486 | train | Returns an object with all the actions defined for the given element | [
30522,
3853,
1006,
18667,
12322,
2989,
1010,
1051,
7840,
8485,
1007,
1063,
13075,
11338,
19966,
9626,
25062,
22014,
1027,
2023,
1012,
1035,
2131,
7874,
20389,
4215,
2850,
22014,
1006,
18667,
12322,
2989,
1010,
1051,
7840,
8485,
1007,
1025,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
eslint/eslint | lib/rules/no-regex-spaces.js | checkLiteral | function checkLiteral(node) {
const token = sourceCode.getFirstToken(node),
nodeType = token.type,
nodeValue = token.value;
if (nodeType === "RegularExpression") {
checkRegex(node, nodeValue, token.range[0]);
}
} | javascript | function checkLiteral(node) {
const token = sourceCode.getFirstToken(node),
nodeType = token.type,
nodeValue = token.value;
if (nodeType === "RegularExpression") {
checkRegex(node, nodeValue, token.range[0]);
}
} | [
"function",
"checkLiteral",
"(",
"node",
")",
"{",
"const",
"token",
"=",
"sourceCode",
".",
"getFirstToken",
"(",
"node",
")",
",",
"nodeType",
"=",
"token",
".",
"type",
",",
"nodeValue",
"=",
"token",
".",
"value",
";",
"if",
"(",
"nodeType",
"===",
... | Validate regular expression literals
@param {ASTNode} node node to validate
@returns {void}
@private | [
"Validate",
"regular",
"expression",
"literals"
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/no-regex-spaces.js#L73-L81 | train | Check if a literal is valid | [
30522,
3853,
4638,
22779,
7941,
1006,
13045,
1007,
1063,
9530,
3367,
19204,
1027,
3120,
16044,
1012,
2131,
8873,
12096,
18715,
2368,
1006,
13045,
1007,
1010,
13045,
13874,
1027,
19204,
1012,
2828,
1010,
13045,
10175,
5657,
1027,
19204,
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... |
airyland/vux | src/components/clocker/clocker.js | strftime | function strftime (offsetObject) {
return function (format) {
var directives = format.match(/%(-|!)?[A-Z]{1}(:[^]+)?/gi)
var d2h = false
if (directives.indexOf('%D') < 0 && directives.indexOf('%H') >= 0) {
d2h = true
}
if (directives) {
for (var i = 0, len = directives.length; i < len; ++i) {
var directive = directives[i].match(/%(-|!)?([a-zA-Z]{1})(:[^]+)?/)
var regexp = escapedRegExp(directive[0])
var modifier = directive[1] || ''
var plural = directive[3] || ''
var value = null
var key = null
// Get the key
directive = directive[2]
// Swap shot-versions directives
if (DIRECTIVE_KEY_MAP.hasOwnProperty(directive)) {
key = DIRECTIVE_KEY_MAP[directive]
value = Number(offsetObject[key])
if (key === 'hours' && d2h) {
value += Number(offsetObject['days']) * 24
}
}
if (value !== null) {
// Pluralize
if (modifier === '!') {
value = pluralize(plural, value)
}
// Add zero-padding
if (modifier === '') {
if (value < 10) {
value = '0' + value.toString()
}
}
// Replace the directive
format = format.replace(regexp, value.toString())
}
}
}
format = format.replace('%_M1', offsetObject.minutes_1)
.replace('%_M2', offsetObject.minutes_2)
.replace('%_S1', offsetObject.seconds_1)
.replace('%_S2', offsetObject.seconds_2)
.replace('%_S3', offsetObject.seconds_3)
.replace('%_H1', offsetObject.hours_1)
.replace('%_H2', offsetObject.hours_2)
.replace('%_H3', offsetObject.hours_3)
.replace('%_D1', offsetObject.days_1)
.replace('%_D2', offsetObject.days_2)
.replace('%_D3', offsetObject.days_3)
format = format.replace(/%%/, '%')
return format
}
} | javascript | function strftime (offsetObject) {
return function (format) {
var directives = format.match(/%(-|!)?[A-Z]{1}(:[^]+)?/gi)
var d2h = false
if (directives.indexOf('%D') < 0 && directives.indexOf('%H') >= 0) {
d2h = true
}
if (directives) {
for (var i = 0, len = directives.length; i < len; ++i) {
var directive = directives[i].match(/%(-|!)?([a-zA-Z]{1})(:[^]+)?/)
var regexp = escapedRegExp(directive[0])
var modifier = directive[1] || ''
var plural = directive[3] || ''
var value = null
var key = null
// Get the key
directive = directive[2]
// Swap shot-versions directives
if (DIRECTIVE_KEY_MAP.hasOwnProperty(directive)) {
key = DIRECTIVE_KEY_MAP[directive]
value = Number(offsetObject[key])
if (key === 'hours' && d2h) {
value += Number(offsetObject['days']) * 24
}
}
if (value !== null) {
// Pluralize
if (modifier === '!') {
value = pluralize(plural, value)
}
// Add zero-padding
if (modifier === '') {
if (value < 10) {
value = '0' + value.toString()
}
}
// Replace the directive
format = format.replace(regexp, value.toString())
}
}
}
format = format.replace('%_M1', offsetObject.minutes_1)
.replace('%_M2', offsetObject.minutes_2)
.replace('%_S1', offsetObject.seconds_1)
.replace('%_S2', offsetObject.seconds_2)
.replace('%_S3', offsetObject.seconds_3)
.replace('%_H1', offsetObject.hours_1)
.replace('%_H2', offsetObject.hours_2)
.replace('%_H3', offsetObject.hours_3)
.replace('%_D1', offsetObject.days_1)
.replace('%_D2', offsetObject.days_2)
.replace('%_D3', offsetObject.days_3)
format = format.replace(/%%/, '%')
return format
}
} | [
"function",
"strftime",
"(",
"offsetObject",
")",
"{",
"return",
"function",
"(",
"format",
")",
"{",
"var",
"directives",
"=",
"format",
".",
"match",
"(",
"/",
"%(-|!)?[A-Z]{1}(:[^]+)?",
"/",
"gi",
")",
"var",
"d2h",
"=",
"false",
"if",
"(",
"directives"... | Time string formatter | [
"Time",
"string",
"formatter"
] | 484fc3c18bdca99b0c08efbb678c0ee0f5ceedd6 | https://github.com/airyland/vux/blob/484fc3c18bdca99b0c08efbb678c0ee0f5ceedd6/src/components/clocker/clocker.js#L59-L114 | train | Format the time in the specified format | [
30522,
3853,
2358,
12881,
7292,
1006,
16396,
16429,
20614,
1007,
1063,
2709,
3853,
1006,
4289,
1007,
1063,
13075,
16449,
2015,
1027,
4289,
1012,
2674,
1006,
1013,
1003,
1006,
1011,
1064,
999,
1007,
1029,
1031,
1037,
1011,
1062,
1033,
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... |
eslint/eslint | lib/rules/no-useless-constructor.js | isSpreadArguments | function isSpreadArguments(superArgs) {
return (
superArgs.length === 1 &&
superArgs[0].type === "SpreadElement" &&
superArgs[0].argument.type === "Identifier" &&
superArgs[0].argument.name === "arguments"
);
} | javascript | function isSpreadArguments(superArgs) {
return (
superArgs.length === 1 &&
superArgs[0].type === "SpreadElement" &&
superArgs[0].argument.type === "Identifier" &&
superArgs[0].argument.name === "arguments"
);
} | [
"function",
"isSpreadArguments",
"(",
"superArgs",
")",
"{",
"return",
"(",
"superArgs",
".",
"length",
"===",
"1",
"&&",
"superArgs",
"[",
"0",
"]",
".",
"type",
"===",
"\"SpreadElement\"",
"&&",
"superArgs",
"[",
"0",
"]",
".",
"argument",
".",
"type",
... | Checks whether a given array of expressions is `...arguments` or not.
`super(...arguments)` passes all arguments through.
@param {ASTNode[]} superArgs - An array of expressions to check.
@returns {boolean} `true` if the superArgs is `...arguments`. | [
"Checks",
"whether",
"a",
"given",
"array",
"of",
"expressions",
"is",
"...",
"arguments",
"or",
"not",
".",
"super",
"(",
"...",
"arguments",
")",
"passes",
"all",
"arguments",
"through",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/no-useless-constructor.js#L44-L51 | train | Returns true if the super arguments are spread arguments | [
30522,
3853,
26354,
28139,
8447,
10623,
27417,
3215,
1006,
3565,
2906,
5620,
1007,
1063,
2709,
1006,
3565,
2906,
5620,
1012,
3091,
1027,
1027,
1027,
1015,
1004,
1004,
3565,
2906,
5620,
1031,
1014,
1033,
1012,
2828,
1027,
1027,
1027,
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... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/core/util/MockServer.js | function(sEntitySetName, sKeys) {
sKeys = decodeURIComponent(sKeys);
var oFoundEntry;
var oEntitySet = that._mEntitySets[sEntitySetName];
var aKeys = oEntitySet.keys;
// split keys
var aRequestedKeys = sKeys.split(',');
// check number of keys to be equal to the entity keys and validates keys type for quotations
if (aRequestedKeys.length !== aKeys.length) {
that._logAndThrowMockServerCustomError(400, that._oErrorMessages.INVALID_KEY_PREDICATE_QUANTITY);
}
that._isRequestedKeysValid(oEntitySet, aRequestedKeys);
if (aRequestedKeys.length === 1 && !aRequestedKeys[0].split('=')[1]) {
aRequestedKeys = [aKeys[0] + "=" + aRequestedKeys[0]];
}
jQuery.each(that._oMockdata[sEntitySetName], function(iIndex, oEntry) {
// check each key for existence and value
for (var i = 0; i < aRequestedKeys.length; i++) {
var aKeyVal = aRequestedKeys[i].split('=');
var sKey = that._trim(aKeyVal[0]);
//key doesn't match, continue to next entry
if (!aKeys || aKeys.indexOf(sKey) === -1) {
return true; // = continue
}
var sNewValue = that._trim(aKeyVal[1]);
var sOrigiValue = oEntry[sKey];
switch (oEntitySet.keysType[sKey]) {
case "Edm.String":
sNewValue = sNewValue.replace(/^\'|\'$/g, '');
break;
case "Edm.Time":
case "Edm.DateTime":
sOrigiValue = that._getDateTime(sOrigiValue);
break;
case "Edm.Int16":
case "Edm.Int32":
//case "Edm.Int64": In ODataModel this type is represented as a string. (https://openui5.hana.ondemand.com/docs/api/symbols/sap.ui.model.odata.type.Int64.html)
case "Edm.Decimal":
case "Edm.Byte":
case "Edm.Double":
case "Edm.Single":
case "Edm.SByte":
if (!that._isValidNumber(sNewValue)) {
//TODO check better handling
return false; // = break
}
sNewValue = parseFloat(sNewValue);
break;
case "Edm.Guid":
sNewValue = sNewValue.replace(/^guid\'|\'$/g, '');
break;
case "Edm.Boolean":
if (["true", "false"].indexOf(sNewValue) === -1) {
that._logAndThrowMockServerCustomError(400, that._oErrorMessages.INVALID_KEY_TYPE, sKey);
}
sNewValue = sNewValue === "true";
break;
case "Edm.Binary":
case "Edm.DateTimeOffset":
default:
sNewValue = sNewValue;
}
//value doesn't match, continue to next entry
if (sOrigiValue !== sNewValue) {
return true; // = continue
}
}
oFoundEntry = {
index: iIndex,
entry: oEntry
};
return false; // = break
});
return oFoundEntry;
} | javascript | function(sEntitySetName, sKeys) {
sKeys = decodeURIComponent(sKeys);
var oFoundEntry;
var oEntitySet = that._mEntitySets[sEntitySetName];
var aKeys = oEntitySet.keys;
// split keys
var aRequestedKeys = sKeys.split(',');
// check number of keys to be equal to the entity keys and validates keys type for quotations
if (aRequestedKeys.length !== aKeys.length) {
that._logAndThrowMockServerCustomError(400, that._oErrorMessages.INVALID_KEY_PREDICATE_QUANTITY);
}
that._isRequestedKeysValid(oEntitySet, aRequestedKeys);
if (aRequestedKeys.length === 1 && !aRequestedKeys[0].split('=')[1]) {
aRequestedKeys = [aKeys[0] + "=" + aRequestedKeys[0]];
}
jQuery.each(that._oMockdata[sEntitySetName], function(iIndex, oEntry) {
// check each key for existence and value
for (var i = 0; i < aRequestedKeys.length; i++) {
var aKeyVal = aRequestedKeys[i].split('=');
var sKey = that._trim(aKeyVal[0]);
//key doesn't match, continue to next entry
if (!aKeys || aKeys.indexOf(sKey) === -1) {
return true; // = continue
}
var sNewValue = that._trim(aKeyVal[1]);
var sOrigiValue = oEntry[sKey];
switch (oEntitySet.keysType[sKey]) {
case "Edm.String":
sNewValue = sNewValue.replace(/^\'|\'$/g, '');
break;
case "Edm.Time":
case "Edm.DateTime":
sOrigiValue = that._getDateTime(sOrigiValue);
break;
case "Edm.Int16":
case "Edm.Int32":
//case "Edm.Int64": In ODataModel this type is represented as a string. (https://openui5.hana.ondemand.com/docs/api/symbols/sap.ui.model.odata.type.Int64.html)
case "Edm.Decimal":
case "Edm.Byte":
case "Edm.Double":
case "Edm.Single":
case "Edm.SByte":
if (!that._isValidNumber(sNewValue)) {
//TODO check better handling
return false; // = break
}
sNewValue = parseFloat(sNewValue);
break;
case "Edm.Guid":
sNewValue = sNewValue.replace(/^guid\'|\'$/g, '');
break;
case "Edm.Boolean":
if (["true", "false"].indexOf(sNewValue) === -1) {
that._logAndThrowMockServerCustomError(400, that._oErrorMessages.INVALID_KEY_TYPE, sKey);
}
sNewValue = sNewValue === "true";
break;
case "Edm.Binary":
case "Edm.DateTimeOffset":
default:
sNewValue = sNewValue;
}
//value doesn't match, continue to next entry
if (sOrigiValue !== sNewValue) {
return true; // = continue
}
}
oFoundEntry = {
index: iIndex,
entry: oEntry
};
return false; // = break
});
return oFoundEntry;
} | [
"function",
"(",
"sEntitySetName",
",",
"sKeys",
")",
"{",
"sKeys",
"=",
"decodeURIComponent",
"(",
"sKeys",
")",
";",
"var",
"oFoundEntry",
";",
"var",
"oEntitySet",
"=",
"that",
".",
"_mEntitySets",
"[",
"sEntitySetName",
"]",
";",
"var",
"aKeys",
"=",
"... | helper to find the entity set entry for a given entity set name and the keys of the entry | [
"helper",
"to",
"find",
"the",
"entity",
"set",
"entry",
"for",
"a",
"given",
"entity",
"set",
"name",
"and",
"the",
"keys",
"of",
"the",
"entry"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/util/MockServer.js#L1985-L2063 | train | Checks if the given keys are valid and if so checks the keys type of the entry are valid. | [
30522,
3853,
1006,
2741,
3012,
13462,
18442,
1010,
15315,
3240,
2015,
1007,
1063,
15315,
3240,
2015,
1027,
21933,
3207,
9496,
9006,
29513,
3372,
1006,
15315,
3240,
2015,
1007,
1025,
13075,
1997,
28819,
4765,
2854,
1025,
13075,
1051,
4765,
3... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
TryGhost/Ghost | core/server/api/v0.1/mail.js | sendMail | function sendMail(object) {
if (!(mailer instanceof mail.GhostMailer)) {
mailer = new mail.GhostMailer();
}
return mailer.send(object.mail[0].message).catch((err) => {
if (mailer.state.usingDirect) {
notificationsAPI.add(
{
notifications: [{
type: 'warn',
message: [
common.i18n.t('warnings.index.unableToSendEmail'),
common.i18n.t('common.seeLinkForInstructions', {link: 'https://docs.ghost.org/mail/'})
].join(' ')
}]
},
{context: {internal: true}}
);
}
return Promise.reject(err);
});
} | javascript | function sendMail(object) {
if (!(mailer instanceof mail.GhostMailer)) {
mailer = new mail.GhostMailer();
}
return mailer.send(object.mail[0].message).catch((err) => {
if (mailer.state.usingDirect) {
notificationsAPI.add(
{
notifications: [{
type: 'warn',
message: [
common.i18n.t('warnings.index.unableToSendEmail'),
common.i18n.t('common.seeLinkForInstructions', {link: 'https://docs.ghost.org/mail/'})
].join(' ')
}]
},
{context: {internal: true}}
);
}
return Promise.reject(err);
});
} | [
"function",
"sendMail",
"(",
"object",
")",
"{",
"if",
"(",
"!",
"(",
"mailer",
"instanceof",
"mail",
".",
"GhostMailer",
")",
")",
"{",
"mailer",
"=",
"new",
"mail",
".",
"GhostMailer",
"(",
")",
";",
"}",
"return",
"mailer",
".",
"send",
"(",
"obje... | Send mail helper | [
"Send",
"mail",
"helper"
] | bb7bb55cf3e60af99ebbc56099928827b58461bc | https://github.com/TryGhost/Ghost/blob/bb7bb55cf3e60af99ebbc56099928827b58461bc/core/server/api/v0.1/mail.js#L18-L41 | train | Send an email to the specified site | [
30522,
3853,
4604,
21397,
1006,
4874,
1007,
1063,
2065,
1006,
999,
1006,
5653,
2121,
6013,
11253,
5653,
1012,
5745,
21397,
2121,
1007,
1007,
1063,
5653,
2121,
1027,
2047,
5653,
1012,
5745,
21397,
2121,
1006,
1007,
1025,
1065,
2709,
5653,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SheetJS/js-xlsx | xlsx.js | parse_Setup | function parse_Setup(blob, length) {
var o = {};
if(length < 32) return o;
blob.l += 16;
o.header = parse_Xnum(blob, 8);
o.footer = parse_Xnum(blob, 8);
blob.l += 2;
return o;
} | javascript | function parse_Setup(blob, length) {
var o = {};
if(length < 32) return o;
blob.l += 16;
o.header = parse_Xnum(blob, 8);
o.footer = parse_Xnum(blob, 8);
blob.l += 2;
return o;
} | [
"function",
"parse_Setup",
"(",
"blob",
",",
"length",
")",
"{",
"var",
"o",
"=",
"{",
"}",
";",
"if",
"(",
"length",
"<",
"32",
")",
"return",
"o",
";",
"blob",
".",
"l",
"+=",
"16",
";",
"o",
".",
"header",
"=",
"parse_Xnum",
"(",
"blob",
","... | /* [MS-XLS] 2.4.257 | [
"/",
"*",
"[",
"MS",
"-",
"XLS",
"]",
"2",
".",
"4",
".",
"257"
] | 9a6d8a1d3d80c78dad5201fb389316f935279cdc | https://github.com/SheetJS/js-xlsx/blob/9a6d8a1d3d80c78dad5201fb389316f935279cdc/xlsx.js#L6520-L6528 | train | Parse a setup block | [
30522,
3853,
11968,
3366,
1035,
16437,
1006,
1038,
4135,
2497,
1010,
3091,
1007,
1063,
13075,
1051,
1027,
1063,
1065,
1025,
2065,
1006,
3091,
1026,
3590,
1007,
2709,
1051,
1025,
1038,
4135,
2497,
1012,
1048,
1009,
1027,
2385,
1025,
1051,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.table/src/sap/ui/table/TableColumnUtils.js | function(oColumn, iLevel) {
var vHeaderSpans = oColumn.getHeaderSpan();
var iHeaderSpan;
if (!vHeaderSpans) {
return 1;
}
if (!Array.isArray(vHeaderSpans)) {
vHeaderSpans = (vHeaderSpans + "").split(",");
}
function getSpan(sSpan) {
var result = parseInt(sSpan);
return isNaN(result) ? 1 : result;
}
if (isNaN(iLevel)) { // find max value of all spans in the header
iHeaderSpan = Math.max.apply(null, vHeaderSpans.map(getSpan));
} else {
iHeaderSpan = getSpan(vHeaderSpans[iLevel]);
}
return Math.max(iHeaderSpan, 1);
} | javascript | function(oColumn, iLevel) {
var vHeaderSpans = oColumn.getHeaderSpan();
var iHeaderSpan;
if (!vHeaderSpans) {
return 1;
}
if (!Array.isArray(vHeaderSpans)) {
vHeaderSpans = (vHeaderSpans + "").split(",");
}
function getSpan(sSpan) {
var result = parseInt(sSpan);
return isNaN(result) ? 1 : result;
}
if (isNaN(iLevel)) { // find max value of all spans in the header
iHeaderSpan = Math.max.apply(null, vHeaderSpans.map(getSpan));
} else {
iHeaderSpan = getSpan(vHeaderSpans[iLevel]);
}
return Math.max(iHeaderSpan, 1);
} | [
"function",
"(",
"oColumn",
",",
"iLevel",
")",
"{",
"var",
"vHeaderSpans",
"=",
"oColumn",
".",
"getHeaderSpan",
"(",
")",
";",
"var",
"iHeaderSpan",
";",
"if",
"(",
"!",
"vHeaderSpans",
")",
"{",
"return",
"1",
";",
"}",
"if",
"(",
"!",
"Array",
".... | Returns the header span of a given column. If <code>iLevel</code> is provided, the header span of that
header row is returned if there is any defined, otherwise the maximum header span is returned.
If there is no header span for the level, 1 is returned as a default value.
@param {sap.ui.table.Column} oColumn Column of which the header span shall be returned.
@param {int} [iLevel=0] Zero-based index of the header span for multi-labels.
@returns {int} Header span. | [
"Returns",
"the",
"header",
"span",
"of",
"a",
"given",
"column",
".",
"If",
"<code",
">",
"iLevel<",
"/",
"code",
">",
"is",
"provided",
"the",
"header",
"span",
"of",
"that",
"header",
"row",
"is",
"returned",
"if",
"there",
"is",
"any",
"defined",
"... | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableColumnUtils.js#L243-L267 | train | Returns the max value of the column s header span | [
30522,
3853,
1006,
1051,
25778,
2819,
2078,
1010,
17869,
15985,
1007,
1063,
13075,
1058,
4974,
2545,
9739,
2015,
1027,
1051,
25778,
2819,
2078,
1012,
2131,
4974,
2545,
9739,
1006,
1007,
1025,
13075,
1045,
4974,
2545,
9739,
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... | |
SAP/openui5 | src/sap.ui.core/src/sap/ui/model/odata/v4/ODataMetaModel.js | function () {
var aContexts = [],
oPromise = this.fetchContexts(),
that = this;
if (oPromise.isFulfilled()) {
aContexts = oPromise.getResult();
} else {
oPromise.then(function (aContexts) {
that.setContexts(aContexts);
that._fireChange({reason: ChangeReason.Change});
});
aContexts.dataRequested = true;
}
this.setContexts(aContexts);
} | javascript | function () {
var aContexts = [],
oPromise = this.fetchContexts(),
that = this;
if (oPromise.isFulfilled()) {
aContexts = oPromise.getResult();
} else {
oPromise.then(function (aContexts) {
that.setContexts(aContexts);
that._fireChange({reason: ChangeReason.Change});
});
aContexts.dataRequested = true;
}
this.setContexts(aContexts);
} | [
"function",
"(",
")",
"{",
"var",
"aContexts",
"=",
"[",
"]",
",",
"oPromise",
"=",
"this",
".",
"fetchContexts",
"(",
")",
",",
"that",
"=",
"this",
";",
"if",
"(",
"oPromise",
".",
"isFulfilled",
"(",
")",
")",
"{",
"aContexts",
"=",
"oPromise",
... | Updates the list and indices array. Fires a change event if the data was retrieved
asynchronously.
@private | [
"Updates",
"the",
"list",
"and",
"indices",
"array",
".",
"Fires",
"a",
"change",
"event",
"if",
"the",
"data",
"was",
"retrieved",
"asynchronously",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/ODataMetaModel.js#L499-L514 | train | Fetch all contexts from the database | [
30522,
3853,
1006,
1007,
1063,
13075,
9353,
28040,
18413,
2015,
1027,
1031,
1033,
1010,
6728,
21716,
5562,
1027,
2023,
1012,
18584,
8663,
18209,
2015,
1006,
1007,
1010,
2008,
1027,
2023,
1025,
2065,
1006,
6728,
21716,
5562,
1012,
2003,
3993... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | reqRegionForNetworkingError | function reqRegionForNetworkingError(resp, done) {
if (!AWS.util.isBrowser()) {
return done();
}
var error = resp.error;
var request = resp.request;
var bucket = request.params.Bucket;
if (!error || error.code !== 'NetworkingError' || !bucket ||
request.httpRequest.region === 'us-east-1') {
return done();
}
var service = request.service;
var bucketRegionCache = service.bucketRegionCache;
var cachedRegion = bucketRegionCache[bucket] || null;
if (cachedRegion && cachedRegion !== request.httpRequest.region) {
service.updateReqBucketRegion(request, cachedRegion);
done();
} else if (!service.dnsCompatibleBucketName(bucket)) {
service.updateReqBucketRegion(request, 'us-east-1');
if (bucketRegionCache[bucket] !== 'us-east-1') {
bucketRegionCache[bucket] = 'us-east-1';
}
done();
} else if (request.httpRequest.virtualHostedBucket) {
var getRegionReq = service.listObjects({Bucket: bucket, MaxKeys: 0});
service.updateReqBucketRegion(getRegionReq, 'us-east-1');
getRegionReq._requestRegionForBucket = bucket;
getRegionReq.send(function() {
var region = service.bucketRegionCache[bucket] || null;
if (region && region !== request.httpRequest.region) {
service.updateReqBucketRegion(request, region);
}
done();
});
} else {
// DNS-compatible path-style
// (s3ForcePathStyle or bucket name with dot over https)
// Cannot obtain region information for this case
done();
}
} | javascript | function reqRegionForNetworkingError(resp, done) {
if (!AWS.util.isBrowser()) {
return done();
}
var error = resp.error;
var request = resp.request;
var bucket = request.params.Bucket;
if (!error || error.code !== 'NetworkingError' || !bucket ||
request.httpRequest.region === 'us-east-1') {
return done();
}
var service = request.service;
var bucketRegionCache = service.bucketRegionCache;
var cachedRegion = bucketRegionCache[bucket] || null;
if (cachedRegion && cachedRegion !== request.httpRequest.region) {
service.updateReqBucketRegion(request, cachedRegion);
done();
} else if (!service.dnsCompatibleBucketName(bucket)) {
service.updateReqBucketRegion(request, 'us-east-1');
if (bucketRegionCache[bucket] !== 'us-east-1') {
bucketRegionCache[bucket] = 'us-east-1';
}
done();
} else if (request.httpRequest.virtualHostedBucket) {
var getRegionReq = service.listObjects({Bucket: bucket, MaxKeys: 0});
service.updateReqBucketRegion(getRegionReq, 'us-east-1');
getRegionReq._requestRegionForBucket = bucket;
getRegionReq.send(function() {
var region = service.bucketRegionCache[bucket] || null;
if (region && region !== request.httpRequest.region) {
service.updateReqBucketRegion(request, region);
}
done();
});
} else {
// DNS-compatible path-style
// (s3ForcePathStyle or bucket name with dot over https)
// Cannot obtain region information for this case
done();
}
} | [
"function",
"reqRegionForNetworkingError",
"(",
"resp",
",",
"done",
")",
"{",
"if",
"(",
"!",
"AWS",
".",
"util",
".",
"isBrowser",
"(",
")",
")",
"{",
"return",
"done",
"(",
")",
";",
"}",
"var",
"error",
"=",
"resp",
".",
"error",
";",
"var",
"r... | For browser only. If NetworkingError received, will attempt to obtain
the bucket region.
@api private | [
"For",
"browser",
"only",
".",
"If",
"NetworkingError",
"received",
"will",
"attempt",
"to",
"obtain",
"the",
"bucket",
"region",
"."
] | c23e5f0edd150f8885267e5f7c8a564f8e6e8562 | https://github.com/aws/aws-sdk-js/blob/c23e5f0edd150f8885267e5f7c8a564f8e6e8562/lib/services/s3.js#L629-L671 | train | If the error is not a NetworkingError then we need to get the region information from the bucket. | [
30522,
3853,
2128,
4160,
23784,
29278,
7159,
21398,
2121,
29165,
1006,
24501,
2361,
1010,
2589,
1007,
1063,
2065,
1006,
999,
22091,
2015,
1012,
21183,
4014,
1012,
2003,
12618,
9333,
2121,
1006,
1007,
1007,
1063,
2709,
2589,
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... |
openlayers/openlayers | src/ol/reproj.js | enlargeClipPoint | function enlargeClipPoint(centroidX, centroidY, x, y) {
const dX = x - centroidX;
const dY = y - centroidY;
const distance = Math.sqrt(dX * dX + dY * dY);
return [Math.round(x + dX / distance), Math.round(y + dY / distance)];
} | javascript | function enlargeClipPoint(centroidX, centroidY, x, y) {
const dX = x - centroidX;
const dY = y - centroidY;
const distance = Math.sqrt(dX * dX + dY * dY);
return [Math.round(x + dX / distance), Math.round(y + dY / distance)];
} | [
"function",
"enlargeClipPoint",
"(",
"centroidX",
",",
"centroidY",
",",
"x",
",",
"y",
")",
"{",
"const",
"dX",
"=",
"x",
"-",
"centroidX",
";",
"const",
"dY",
"=",
"y",
"-",
"centroidY",
";",
"const",
"distance",
"=",
"Math",
".",
"sqrt",
"(",
"dX"... | Enlarge the clipping triangle point by 1 pixel to ensure the edges overlap
in order to mask gaps caused by antialiasing.
@param {number} centroidX Centroid of the triangle (x coordinate in pixels).
@param {number} centroidY Centroid of the triangle (y coordinate in pixels).
@param {number} x X coordinate of the point (in pixels).
@param {number} y Y coordinate of the point (in pixels).
@return {import("./coordinate.js").Coordinate} New point 1 px farther from the centroid. | [
"Enlarge",
"the",
"clipping",
"triangle",
"point",
"by",
"1",
"pixel",
"to",
"ensure",
"the",
"edges",
"overlap",
"in",
"order",
"to",
"mask",
"gaps",
"caused",
"by",
"antialiasing",
"."
] | f366eaea522388fb575b11010e69d309164baca7 | https://github.com/openlayers/openlayers/blob/f366eaea522388fb575b11010e69d309164baca7/src/ol/reproj.js#L66-L71 | train | Enlarge a point in the clipping area | [
30522,
3853,
4372,
8017,
3351,
20464,
11514,
8400,
1006,
18120,
3593,
2595,
1010,
18120,
3593,
2100,
1010,
1060,
1010,
1061,
1007,
1063,
9530,
3367,
1040,
2595,
1027,
1060,
1011,
18120,
3593,
2595,
1025,
9530,
3367,
1040,
2100,
1027,
1061,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.unified/src/sap/ui/unified/CalendarTimeInterval.js | _handleDateFocus | function _handleDateFocus(oEvent){
var oFocusedDate = new UniversalDate(this._getFocusedDate().getTime());
var oDate = CalendarUtils._createUniversalUTCDate(oEvent.getParameter("date"), undefined, true);
var bNotVisible = oEvent.getParameter("otherMonth");
if (bNotVisible &&
oDate.getUTCMonth() == oFocusedDate.getUTCMonth() &&
oDate.getUTCFullYear() == oFocusedDate.getUTCFullYear()) {
// only show days in the same month
// set start date and focus date
_setDateInDatesRow.call(this, oDate);
}
} | javascript | function _handleDateFocus(oEvent){
var oFocusedDate = new UniversalDate(this._getFocusedDate().getTime());
var oDate = CalendarUtils._createUniversalUTCDate(oEvent.getParameter("date"), undefined, true);
var bNotVisible = oEvent.getParameter("otherMonth");
if (bNotVisible &&
oDate.getUTCMonth() == oFocusedDate.getUTCMonth() &&
oDate.getUTCFullYear() == oFocusedDate.getUTCFullYear()) {
// only show days in the same month
// set start date and focus date
_setDateInDatesRow.call(this, oDate);
}
} | [
"function",
"_handleDateFocus",
"(",
"oEvent",
")",
"{",
"var",
"oFocusedDate",
"=",
"new",
"UniversalDate",
"(",
"this",
".",
"_getFocusedDate",
"(",
")",
".",
"getTime",
"(",
")",
")",
";",
"var",
"oDate",
"=",
"CalendarUtils",
".",
"_createUniversalUTCDate"... | Handles day focus from the embedded day Picker.
This function assumes there is a "datesRow" aggregation.
So callers must take care.
@return {void}
@private | [
"Handles",
"day",
"focus",
"from",
"the",
"embedded",
"day",
"Picker",
".",
"This",
"function",
"assumes",
"there",
"is",
"a",
"datesRow",
"aggregation",
".",
"So",
"callers",
"must",
"take",
"care",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.unified/src/sap/ui/unified/CalendarTimeInterval.js#L1904-L1918 | train | Handles date focus event | [
30522,
3853,
1035,
8971,
30524,
1006,
2023,
1012,
1035,
2131,
14876,
7874,
22367,
3686,
1006,
1007,
1012,
2131,
7292,
1006,
1007,
1007,
1025,
13075,
1051,
13701,
1027,
8094,
21823,
4877,
1012,
1035,
3443,
19496,
14028,
2389,
4904,
19797,
36... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
mui-org/material-ui | docs/src/pages/components/grid-list/SingleLineGridList.js | SingleLineGridList | function SingleLineGridList() {
const classes = useStyles();
return (
<div className={classes.root}>
<GridList className={classes.gridList} cols={2.5}>
{tileData.map(tile => (
<GridListTile key={tile.img}>
<img src={tile.img} alt={tile.title} />
<GridListTileBar
title={tile.title}
classes={{
root: classes.titleBar,
title: classes.title,
}}
actionIcon={
<IconButton>
<StarBorderIcon className={classes.title} />
</IconButton>
}
/>
</GridListTile>
))}
</GridList>
</div>
);
} | javascript | function SingleLineGridList() {
const classes = useStyles();
return (
<div className={classes.root}>
<GridList className={classes.gridList} cols={2.5}>
{tileData.map(tile => (
<GridListTile key={tile.img}>
<img src={tile.img} alt={tile.title} />
<GridListTileBar
title={tile.title}
classes={{
root: classes.titleBar,
title: classes.title,
}}
actionIcon={
<IconButton>
<StarBorderIcon className={classes.title} />
</IconButton>
}
/>
</GridListTile>
))}
</GridList>
</div>
);
} | [
"function",
"SingleLineGridList",
"(",
")",
"{",
"const",
"classes",
"=",
"useStyles",
"(",
")",
";",
"return",
"(",
"<",
"div",
"className",
"=",
"{",
"classes",
".",
"root",
"}",
">",
"\n ",
"<",
"GridList",
"className",
"=",
"{",
"classes",
".",
... | The example data is structured as follows:
import image from 'path/to/image.jpg';
[etc...]
const tileData = [
{
img: image,
title: 'Image',
author: 'author',
},
{
[etc...]
},
]; | [
"The",
"example",
"data",
"is",
"structured",
"as",
"follows",
":"
] | 1555e52367835946382fbf2a8f681de71318915d | https://github.com/mui-org/material-ui/blob/1555e52367835946382fbf2a8f681de71318915d/docs/src/pages/components/grid-list/SingleLineGridList.js#L49-L75 | train | SingleLineGridList - GridList | [
30522,
3853,
2309,
4179,
16523,
3593,
9863,
1006,
1007,
1063,
9530,
3367,
4280,
1027,
3594,
27983,
2015,
1006,
1007,
1025,
2709,
1006,
1026,
4487,
2615,
2465,
18442,
1027,
1063,
4280,
1012,
7117,
1065,
1028,
1026,
8370,
9863,
2465,
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... |
angular/angular | tools/gulp-tasks/format.js | gulpStatus | function gulpStatus() {
const Vinyl = require('vinyl');
const path = require('path');
const gulpGit = require('gulp-git');
const through = require('through2');
const srcStream = through.obj();
const opt = {cwd: process.cwd()};
// https://git-scm.com/docs/git-status#_short_format
const RE_STATUS = /((\s\w)|(\w+)|\?{0,2})\s([\w\+\-\/\\\.]+)(\s->\s)?([\w\+\-\/\\\.]+)*\n{0,1}/gm;
gulpGit.status({args: '--porcelain', quiet: true}, function(err, stdout) {
if (err) return srcStream.emit('error', err);
const data = stdout.toString();
let currentMatch;
while ((currentMatch = RE_STATUS.exec(data)) !== null) {
// status
const status = currentMatch[1].trim().toLowerCase();
// We only care about untracked files and renamed files
if (!new RegExp(/r|\?/i).test(status)) {
continue;
}
// file path
const currentFilePath = currentMatch[4];
// new file path in case its been moved
const newFilePath = currentMatch[6];
const filePath = newFilePath || currentFilePath;
srcStream.write(new Vinyl({
path: path.resolve(opt.cwd, filePath),
cwd: opt.cwd,
}));
RE_STATUS.lastIndex++;
}
srcStream.end();
});
return srcStream;
} | javascript | function gulpStatus() {
const Vinyl = require('vinyl');
const path = require('path');
const gulpGit = require('gulp-git');
const through = require('through2');
const srcStream = through.obj();
const opt = {cwd: process.cwd()};
// https://git-scm.com/docs/git-status#_short_format
const RE_STATUS = /((\s\w)|(\w+)|\?{0,2})\s([\w\+\-\/\\\.]+)(\s->\s)?([\w\+\-\/\\\.]+)*\n{0,1}/gm;
gulpGit.status({args: '--porcelain', quiet: true}, function(err, stdout) {
if (err) return srcStream.emit('error', err);
const data = stdout.toString();
let currentMatch;
while ((currentMatch = RE_STATUS.exec(data)) !== null) {
// status
const status = currentMatch[1].trim().toLowerCase();
// We only care about untracked files and renamed files
if (!new RegExp(/r|\?/i).test(status)) {
continue;
}
// file path
const currentFilePath = currentMatch[4];
// new file path in case its been moved
const newFilePath = currentMatch[6];
const filePath = newFilePath || currentFilePath;
srcStream.write(new Vinyl({
path: path.resolve(opt.cwd, filePath),
cwd: opt.cwd,
}));
RE_STATUS.lastIndex++;
}
srcStream.end();
});
return srcStream;
} | [
"function",
"gulpStatus",
"(",
")",
"{",
"const",
"Vinyl",
"=",
"require",
"(",
"'vinyl'",
")",
";",
"const",
"path",
"=",
"require",
"(",
"'path'",
")",
";",
"const",
"gulpGit",
"=",
"require",
"(",
"'gulp-git'",
")",
";",
"const",
"through",
"=",
"re... | Gulp stream that wraps the gulp-git status,
only returns untracked files, and converts
the stdout into a stream of files. | [
"Gulp",
"stream",
"that",
"wraps",
"the",
"gulp",
"-",
"git",
"status",
"only",
"returns",
"untracked",
"files",
"and",
"converts",
"the",
"stdout",
"into",
"a",
"stream",
"of",
"files",
"."
] | c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c | https://github.com/angular/angular/blob/c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c/tools/gulp-tasks/format.js#L37-L83 | train | Gulp status function | [
30522,
3853,
26546,
9153,
5809,
1006,
1007,
1063,
9530,
3367,
8877,
1027,
5478,
1006,
1005,
8877,
30524,
5034,
6169,
25379,
1027,
2083,
1012,
27885,
3501,
1006,
1007,
1025,
9530,
3367,
23569,
1027,
1063,
19296,
2094,
1024,
2832,
1012,
19296... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
nhn/tui.editor | src/js/wysiwygCommands/tableAddCol.js | getNumberOfCols | function getNumberOfCols(wwe) {
const selectionMgr = wwe.componentManager.getManager('tableSelection');
const $selectedCells = selectionMgr.getSelectedCells();
let length = 1;
if ($selectedCells.length > 0) {
const maxLength = $selectedCells.get(0).parentNode.querySelectorAll('td, th').length;
length = Math.min(maxLength, $selectedCells.length);
}
return length;
} | javascript | function getNumberOfCols(wwe) {
const selectionMgr = wwe.componentManager.getManager('tableSelection');
const $selectedCells = selectionMgr.getSelectedCells();
let length = 1;
if ($selectedCells.length > 0) {
const maxLength = $selectedCells.get(0).parentNode.querySelectorAll('td, th').length;
length = Math.min(maxLength, $selectedCells.length);
}
return length;
} | [
"function",
"getNumberOfCols",
"(",
"wwe",
")",
"{",
"const",
"selectionMgr",
"=",
"wwe",
".",
"componentManager",
".",
"getManager",
"(",
"'tableSelection'",
")",
";",
"const",
"$selectedCells",
"=",
"selectionMgr",
".",
"getSelectedCells",
"(",
")",
";",
"let"... | get number of selected cols
@param {WysiwygEditor} wwe - wysiwyg editor instance
@returns {number} - number of selected cols
@ignore | [
"get",
"number",
"of",
"selected",
"cols"
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/wysiwygCommands/tableAddCol.js#L49-L60 | train | Get number of cols | [
30522,
3853,
2131,
19172,
5677,
11253,
25778,
2015,
1006,
11700,
1007,
1063,
9530,
3367,
4989,
24798,
2099,
1027,
11700,
1012,
6922,
24805,
4590,
1012,
2131,
24805,
4590,
1006,
1005,
7251,
12260,
7542,
1005,
1007,
1025,
9530,
3367,
1002,
34... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | getTextBetween | function getTextBetween(node1, node2) {
const allTokens = [node1].concat(sourceCode.getTokensBetween(node1, node2)).concat(node2);
const sourceText = sourceCode.getText();
return allTokens.slice(0, -1).reduce((accumulator, token, index) => accumulator + sourceText.slice(token.range[1], allTokens[index + 1].range[0]), "");
} | javascript | function getTextBetween(node1, node2) {
const allTokens = [node1].concat(sourceCode.getTokensBetween(node1, node2)).concat(node2);
const sourceText = sourceCode.getText();
return allTokens.slice(0, -1).reduce((accumulator, token, index) => accumulator + sourceText.slice(token.range[1], allTokens[index + 1].range[0]), "");
} | [
"function",
"getTextBetween",
"(",
"node1",
",",
"node2",
")",
"{",
"const",
"allTokens",
"=",
"[",
"node1",
"]",
".",
"concat",
"(",
"sourceCode",
".",
"getTokensBetween",
"(",
"node1",
",",
"node2",
")",
")",
".",
"concat",
"(",
"node2",
")",
";",
"c... | Gets the non-token text between two nodes, ignoring any other tokens that appear between the two tokens.
@param {ASTNode} node1 The first node
@param {ASTNode} node2 The second node
@returns {string} The text between the nodes, excluding other tokens | [
"Gets",
"the",
"non",
"-",
"token",
"text",
"between",
"two",
"nodes",
"ignoring",
"any",
"other",
"tokens",
"that",
"appear",
"between",
"the",
"two",
"tokens",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/prefer-template.js#L167-L172 | train | Get the text between node1 and node2 | [
30522,
3853,
2131,
18209,
20915,
28394,
2078,
1006,
13045,
2487,
1010,
13045,
2475,
1007,
1063,
9530,
3367,
2035,
18715,
6132,
1027,
1031,
13045,
2487,
1033,
1012,
9530,
11266,
1006,
3120,
16044,
1012,
2131,
18715,
6132,
20915,
28394,
2078,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
uber/deck.gl | modules/mesh-layers/src/simple-mesh-layer/simple-mesh-layer.js | getTexture | function getTexture(gl, src, opts) {
if (typeof src === 'string') {
// Url, load the image
return loadImage(src)
.then(data => getTextureFromData(gl, data, opts))
.catch(error => {
throw new Error(`Could not load texture from ${src}: ${error}`);
});
}
return new Promise(resolve => resolve(getTextureFromData(gl, src, opts)));
} | javascript | function getTexture(gl, src, opts) {
if (typeof src === 'string') {
// Url, load the image
return loadImage(src)
.then(data => getTextureFromData(gl, data, opts))
.catch(error => {
throw new Error(`Could not load texture from ${src}: ${error}`);
});
}
return new Promise(resolve => resolve(getTextureFromData(gl, src, opts)));
} | [
"function",
"getTexture",
"(",
"gl",
",",
"src",
",",
"opts",
")",
"{",
"if",
"(",
"typeof",
"src",
"===",
"'string'",
")",
"{",
"// Url, load the image",
"return",
"loadImage",
"(",
"src",
")",
".",
"then",
"(",
"data",
"=>",
"getTextureFromData",
"(",
... | /*
Load image data into luma.gl Texture2D objects
@param {WebGLContext} gl
@param {String|Texture2D|HTMLImageElement|Uint8ClampedArray} src - source of image data
can be url string, Texture2D object, HTMLImageElement or pixel array
@returns {Promise} resolves to an object with name -> texture mapping | [
"/",
"*",
"Load",
"image",
"data",
"into",
"luma",
".",
"gl",
"Texture2D",
"objects"
] | a2010448b7f268bbd03617b812334c68a6b9e5b2 | https://github.com/uber/deck.gl/blob/a2010448b7f268bbd03617b812334c68a6b9e5b2/modules/mesh-layers/src/simple-mesh-layer/simple-mesh-layer.js#L54-L64 | train | Get texture from image or url | [
30522,
3853,
2131,
18209,
5397,
1006,
1043,
2140,
1010,
5034,
2278,
1010,
23569,
2015,
1007,
1063,
2065,
1006,
2828,
11253,
5034,
2278,
1027,
1027,
1027,
1005,
5164,
1005,
1007,
1063,
1013,
1013,
24471,
2140,
1010,
7170,
1996,
3746,
2709,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
TryGhost/Ghost | core/server/data/importer/index.js | function (importData) {
var ops = [];
_.each(this.importers, function (importer) {
ops.push(function () {
return importer.preProcess(importData);
});
});
return pipeline(ops);
} | javascript | function (importData) {
var ops = [];
_.each(this.importers, function (importer) {
ops.push(function () {
return importer.preProcess(importData);
});
});
return pipeline(ops);
} | [
"function",
"(",
"importData",
")",
"{",
"var",
"ops",
"=",
"[",
"]",
";",
"_",
".",
"each",
"(",
"this",
".",
"importers",
",",
"function",
"(",
"importer",
")",
"{",
"ops",
".",
"push",
"(",
"function",
"(",
")",
"{",
"return",
"importer",
".",
... | Import Step 2:
Pass the prepared importData through the preProcess function of the various importers, so that the importers can
make any adjustments to the data based on relationships between it
@param {ImportData} importData
@returns {Promise(ImportData)} | [
"Import",
"Step",
"2",
":",
"Pass",
"the",
"prepared",
"importData",
"through",
"the",
"preProcess",
"function",
"of",
"the",
"various",
"importers",
"so",
"that",
"the",
"importers",
"can",
"make",
"any",
"adjustments",
"to",
"the",
"data",
"based",
"on",
"... | bb7bb55cf3e60af99ebbc56099928827b58461bc | https://github.com/TryGhost/Ghost/blob/bb7bb55cf3e60af99ebbc56099928827b58461bc/core/server/data/importer/index.js#L307-L316 | train | Pre - process the given data | [
30522,
3853,
1006,
12324,
2850,
2696,
1007,
1063,
13075,
23092,
1027,
1031,
1033,
1025,
1035,
1012,
2169,
1006,
2023,
1012,
12324,
2545,
1010,
3853,
1006,
12324,
2121,
1007,
1063,
23092,
1012,
5245,
1006,
3853,
1006,
1007,
1063,
2709,
12324... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
dcloudio/mui | examples/login/libs/easymob-webim-sdk/strophe-custom-2.0.0.js | function (bin) {
var str = "";
for(var i = 0; i < bin.length * 32; i += 8)
{
str += String.fromCharCode((bin[i>>5] >>> (i % 32)) & 255);
}
return str;
} | javascript | function (bin) {
var str = "";
for(var i = 0; i < bin.length * 32; i += 8)
{
str += String.fromCharCode((bin[i>>5] >>> (i % 32)) & 255);
}
return str;
} | [
"function",
"(",
"bin",
")",
"{",
"var",
"str",
"=",
"\"\"",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"bin",
".",
"length",
"*",
"32",
";",
"i",
"+=",
"8",
")",
"{",
"str",
"+=",
"String",
".",
"fromCharCode",
"(",
"(",
"bin",
... | /*
Convert an array of little-endian words to a string | [
"/",
"*",
"Convert",
"an",
"array",
"of",
"little",
"-",
"endian",
"words",
"to",
"a",
"string"
] | ff74c90a1671a552f3604b1288bf38a4126312d0 | https://github.com/dcloudio/mui/blob/ff74c90a1671a552f3604b1288bf38a4126312d0/examples/login/libs/easymob-webim-sdk/strophe-custom-2.0.0.js#L316-L323 | train | Returns a string of the contents of a binary array of words | [
30522,
3853,
1006,
8026,
1007,
1063,
13075,
2358,
2099,
1027,
1000,
1000,
1025,
2005,
1006,
13075,
1045,
1027,
1014,
1025,
1045,
1026,
8026,
1012,
3091,
1008,
3590,
1025,
1045,
1009,
1027,
1022,
1007,
1063,
2358,
2099,
1009,
1027,
5164,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
exceljs/exceljs | lib/xlsx/xform/style/styles-xform.js | function(formatCode) {
// check if default format
var index = NumFmtXform.getDefaultFmtId(formatCode);
if (index !== undefined) return index;
// check if already in
index = this.index.numFmt[formatCode];
if (index !== undefined) return index;
index = this.index.numFmt[formatCode] = NUMFMT_BASE + this.model.numFmts.length;
var xml = this.map.numFmt.toXml({id: index, formatCode: formatCode});
this.model.numFmts.push(xml);
return index;
} | javascript | function(formatCode) {
// check if default format
var index = NumFmtXform.getDefaultFmtId(formatCode);
if (index !== undefined) return index;
// check if already in
index = this.index.numFmt[formatCode];
if (index !== undefined) return index;
index = this.index.numFmt[formatCode] = NUMFMT_BASE + this.model.numFmts.length;
var xml = this.map.numFmt.toXml({id: index, formatCode: formatCode});
this.model.numFmts.push(xml);
return index;
} | [
"function",
"(",
"formatCode",
")",
"{",
"// check if default format",
"var",
"index",
"=",
"NumFmtXform",
".",
"getDefaultFmtId",
"(",
"formatCode",
")",
";",
"if",
"(",
"index",
"!==",
"undefined",
")",
"return",
"index",
";",
"// check if already in",
"index",
... | ========================================================================= Number Formats | [
"=========================================================================",
"Number",
"Formats"
] | c6ee7a14d5e0e5a07bf0e475aa4dd7b9a1e907f2 | https://github.com/exceljs/exceljs/blob/c6ee7a14d5e0e5a07bf0e475aa4dd7b9a1e907f2/lib/xlsx/xform/style/styles-xform.js#L349-L363 | train | returns the index of the format code in the model | [
30522,
3853,
1006,
4289,
16044,
1007,
1063,
1013,
1013,
4638,
2065,
12398,
4289,
13075,
5950,
1027,
16371,
2213,
16715,
2102,
2595,
14192,
1012,
2131,
3207,
7011,
11314,
16715,
3775,
2094,
1006,
4289,
16044,
1007,
1025,
2065,
1006,
5950,
99... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/filesystem/impls/appshell/AppshellFileSystem.js | readFile | function readFile(path, options, callback) {
var encoding = options.encoding || "utf8";
// callback to be executed when the call to stat completes
// or immediately if a stat object was passed as an argument
function doReadFile(stat) {
if (stat.size > (FileUtils.MAX_FILE_SIZE)) {
callback(FileSystemError.EXCEEDS_MAX_FILE_SIZE);
} else {
appshell.fs.readFile(path, encoding, function (_err, _data, encoding, preserveBOM) {
if (_err) {
callback(_mapError(_err));
} else {
callback(null, _data, encoding, preserveBOM, stat);
}
});
}
}
if (options.stat) {
doReadFile(options.stat);
} else {
exports.stat(path, function (_err, _stat) {
if (_err) {
callback(_err);
} else {
doReadFile(_stat);
}
});
}
} | javascript | function readFile(path, options, callback) {
var encoding = options.encoding || "utf8";
// callback to be executed when the call to stat completes
// or immediately if a stat object was passed as an argument
function doReadFile(stat) {
if (stat.size > (FileUtils.MAX_FILE_SIZE)) {
callback(FileSystemError.EXCEEDS_MAX_FILE_SIZE);
} else {
appshell.fs.readFile(path, encoding, function (_err, _data, encoding, preserveBOM) {
if (_err) {
callback(_mapError(_err));
} else {
callback(null, _data, encoding, preserveBOM, stat);
}
});
}
}
if (options.stat) {
doReadFile(options.stat);
} else {
exports.stat(path, function (_err, _stat) {
if (_err) {
callback(_err);
} else {
doReadFile(_stat);
}
});
}
} | [
"function",
"readFile",
"(",
"path",
",",
"options",
",",
"callback",
")",
"{",
"var",
"encoding",
"=",
"options",
".",
"encoding",
"||",
"\"utf8\"",
";",
"// callback to be executed when the call to stat completes",
"// or immediately if a stat object was passed as an argum... | Read the contents of the file at the given path, calling back
asynchronously with either a FileSystemError string, or with the data and
the FileSystemStats object associated with the read file. The options
parameter can be used to specify an encoding (default "utf8"), and also
a cached stats object that the implementation is free to use in order
to avoid an additional stat call.
Note: if either the read or the stat call fails then neither the read data
nor stat will be passed back, and the call should be considered to have failed.
If both calls fail, the error from the read call is passed back.
@param {string} path
@param {{encoding: string=, stat: FileSystemStats=}} options
@param {function(?string, string=, FileSystemStats=)} callback | [
"Read",
"the",
"contents",
"of",
"the",
"file",
"at",
"the",
"given",
"path",
"calling",
"back",
"asynchronously",
"with",
"either",
"a",
"FileSystemError",
"string",
"or",
"with",
"the",
"data",
"and",
"the",
"FileSystemStats",
"object",
"associated",
"with",
... | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/filesystem/impls/appshell/AppshellFileSystem.js#L363-L393 | train | readFile - Reads a file | [
30522,
3853,
3191,
8873,
2571,
1006,
4130,
1010,
7047,
1010,
2655,
5963,
1007,
1063,
13075,
17181,
1027,
7047,
1012,
17181,
1064,
1064,
1000,
21183,
2546,
2620,
1000,
1025,
1013,
1013,
2655,
5963,
2000,
2022,
6472,
2043,
1996,
2655,
2000,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/FlexControllerFactory.js | _propagateChangesForAppComponent | function _propagateChangesForAppComponent (oAppComponent, vConfig) {
// only manifest with type = "application" will fetch changes
var oManifest = oAppComponent.getManifestObject();
var oFlexController;
oFlexController = FlexControllerFactory.createForControl(oAppComponent, oManifest);
return ChangePersistenceFactory._getChangesForComponentAfterInstantiation(vConfig, oManifest, oAppComponent)
.then(function (fnGetChangesMap) {
oAppComponent.addPropagationListener(oFlexController.getBoundApplyChangesOnControl(fnGetChangesMap, oAppComponent));
var oData = oFlexController.getVariantModelData() || {};
var oVariantModel = new VariantModel(oData, oFlexController, oAppComponent);
oAppComponent.setModel(oVariantModel, sVariantModelName);
return oVariantModel;
});
} | javascript | function _propagateChangesForAppComponent (oAppComponent, vConfig) {
// only manifest with type = "application" will fetch changes
var oManifest = oAppComponent.getManifestObject();
var oFlexController;
oFlexController = FlexControllerFactory.createForControl(oAppComponent, oManifest);
return ChangePersistenceFactory._getChangesForComponentAfterInstantiation(vConfig, oManifest, oAppComponent)
.then(function (fnGetChangesMap) {
oAppComponent.addPropagationListener(oFlexController.getBoundApplyChangesOnControl(fnGetChangesMap, oAppComponent));
var oData = oFlexController.getVariantModelData() || {};
var oVariantModel = new VariantModel(oData, oFlexController, oAppComponent);
oAppComponent.setModel(oVariantModel, sVariantModelName);
return oVariantModel;
});
} | [
"function",
"_propagateChangesForAppComponent",
"(",
"oAppComponent",
",",
"vConfig",
")",
"{",
"// only manifest with type = \"application\" will fetch changes",
"var",
"oManifest",
"=",
"oAppComponent",
".",
"getManifestObject",
"(",
")",
";",
"var",
"oFlexController",
";",... | Sets propagation changes and listeners on the passed app component.
Also creates a variant model on this app component.
@see sap.ui.fl.variant.VariantModel
@param {sap.ui.core.Component} oAppComponent - App component instance
@param {object} vConfig - Configuration of app component
@return {Promise} Promise which resolves to the created variant model,
after all propagation changes and listeners have been set.
@private | [
"Sets",
"propagation",
"changes",
"and",
"listeners",
"on",
"the",
"passed",
"app",
"component",
".",
"Also",
"creates",
"a",
"variant",
"model",
"on",
"this",
"app",
"component",
".",
"@see",
"sap",
".",
"ui",
".",
"fl",
".",
"variant",
".",
"VariantModel... | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/FlexControllerFactory.js#L120-L133 | train | propagates changes to the variant model | [
30522,
3853,
1035,
17678,
16098,
15007,
22043,
22747,
6525,
9397,
9006,
29513,
3372,
1006,
1051,
29098,
9006,
29513,
3372,
1010,
18315,
2239,
8873,
2290,
1007,
1063,
1013,
1013,
2069,
19676,
2007,
2828,
1027,
1000,
4646,
1000,
2097,
18584,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
NetEase/pomelo | lib/util/appUtil.js | function(app) {
var filePath = path.join(app.getBase(), Constants.FILEPATH.SERVER_DIR, app.serverType, Constants.FILEPATH.LIFECYCLE);
if(!fs.existsSync(filePath)) {
return;
}
var lifecycle = require(filePath);
for(var key in lifecycle) {
if(typeof lifecycle[key] === 'function') {
app.lifecycleCbs[key] = lifecycle[key];
} else {
logger.warn('lifecycle.js in %s is error format.', filePath);
}
}
} | javascript | function(app) {
var filePath = path.join(app.getBase(), Constants.FILEPATH.SERVER_DIR, app.serverType, Constants.FILEPATH.LIFECYCLE);
if(!fs.existsSync(filePath)) {
return;
}
var lifecycle = require(filePath);
for(var key in lifecycle) {
if(typeof lifecycle[key] === 'function') {
app.lifecycleCbs[key] = lifecycle[key];
} else {
logger.warn('lifecycle.js in %s is error format.', filePath);
}
}
} | [
"function",
"(",
"app",
")",
"{",
"var",
"filePath",
"=",
"path",
".",
"join",
"(",
"app",
".",
"getBase",
"(",
")",
",",
"Constants",
".",
"FILEPATH",
".",
"SERVER_DIR",
",",
"app",
".",
"serverType",
",",
"Constants",
".",
"FILEPATH",
".",
"LIFECYCLE... | Load lifecycle file. | [
"Load",
"lifecycle",
"file",
"."
] | defcf019631ed399cc4dad932d3b028a04a039a4 | https://github.com/NetEase/pomelo/blob/defcf019631ed399cc4dad932d3b028a04a039a4/lib/util/appUtil.js#L249-L262 | train | Load lifecycle. js | [
30522,
3853,
1006,
10439,
1007,
1063,
13075,
5371,
15069,
1027,
4130,
1012,
3693,
1006,
10439,
1012,
2131,
15058,
1006,
1007,
1010,
5377,
2015,
1012,
5371,
15069,
1012,
8241,
1035,
16101,
1010,
10439,
1012,
8241,
13874,
1010,
5377,
2015,
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... | |
chartjs/Chart.js | src/core/core.tooltip.js | determineAlignment | function determineAlignment(tooltip, size) {
var model = tooltip._model;
var chart = tooltip._chart;
var chartArea = tooltip._chart.chartArea;
var xAlign = 'center';
var yAlign = 'center';
if (model.y < size.height) {
yAlign = 'top';
} else if (model.y > (chart.height - size.height)) {
yAlign = 'bottom';
}
var lf, rf; // functions to determine left, right alignment
var olf, orf; // functions to determine if left/right alignment causes tooltip to go outside chart
var yf; // function to get the y alignment if the tooltip goes outside of the left or right edges
var midX = (chartArea.left + chartArea.right) / 2;
var midY = (chartArea.top + chartArea.bottom) / 2;
if (yAlign === 'center') {
lf = function(x) {
return x <= midX;
};
rf = function(x) {
return x > midX;
};
} else {
lf = function(x) {
return x <= (size.width / 2);
};
rf = function(x) {
return x >= (chart.width - (size.width / 2));
};
}
olf = function(x) {
return x + size.width + model.caretSize + model.caretPadding > chart.width;
};
orf = function(x) {
return x - size.width - model.caretSize - model.caretPadding < 0;
};
yf = function(y) {
return y <= midY ? 'top' : 'bottom';
};
if (lf(model.x)) {
xAlign = 'left';
// Is tooltip too wide and goes over the right side of the chart.?
if (olf(model.x)) {
xAlign = 'center';
yAlign = yf(model.y);
}
} else if (rf(model.x)) {
xAlign = 'right';
// Is tooltip too wide and goes outside left edge of canvas?
if (orf(model.x)) {
xAlign = 'center';
yAlign = yf(model.y);
}
}
var opts = tooltip._options;
return {
xAlign: opts.xAlign ? opts.xAlign : xAlign,
yAlign: opts.yAlign ? opts.yAlign : yAlign
};
} | javascript | function determineAlignment(tooltip, size) {
var model = tooltip._model;
var chart = tooltip._chart;
var chartArea = tooltip._chart.chartArea;
var xAlign = 'center';
var yAlign = 'center';
if (model.y < size.height) {
yAlign = 'top';
} else if (model.y > (chart.height - size.height)) {
yAlign = 'bottom';
}
var lf, rf; // functions to determine left, right alignment
var olf, orf; // functions to determine if left/right alignment causes tooltip to go outside chart
var yf; // function to get the y alignment if the tooltip goes outside of the left or right edges
var midX = (chartArea.left + chartArea.right) / 2;
var midY = (chartArea.top + chartArea.bottom) / 2;
if (yAlign === 'center') {
lf = function(x) {
return x <= midX;
};
rf = function(x) {
return x > midX;
};
} else {
lf = function(x) {
return x <= (size.width / 2);
};
rf = function(x) {
return x >= (chart.width - (size.width / 2));
};
}
olf = function(x) {
return x + size.width + model.caretSize + model.caretPadding > chart.width;
};
orf = function(x) {
return x - size.width - model.caretSize - model.caretPadding < 0;
};
yf = function(y) {
return y <= midY ? 'top' : 'bottom';
};
if (lf(model.x)) {
xAlign = 'left';
// Is tooltip too wide and goes over the right side of the chart.?
if (olf(model.x)) {
xAlign = 'center';
yAlign = yf(model.y);
}
} else if (rf(model.x)) {
xAlign = 'right';
// Is tooltip too wide and goes outside left edge of canvas?
if (orf(model.x)) {
xAlign = 'center';
yAlign = yf(model.y);
}
}
var opts = tooltip._options;
return {
xAlign: opts.xAlign ? opts.xAlign : xAlign,
yAlign: opts.yAlign ? opts.yAlign : yAlign
};
} | [
"function",
"determineAlignment",
"(",
"tooltip",
",",
"size",
")",
"{",
"var",
"model",
"=",
"tooltip",
".",
"_model",
";",
"var",
"chart",
"=",
"tooltip",
".",
"_chart",
";",
"var",
"chartArea",
"=",
"tooltip",
".",
"_chart",
".",
"chartArea",
";",
"va... | Helper to get the alignment of a tooltip given the size | [
"Helper",
"to",
"get",
"the",
"alignment",
"of",
"a",
"tooltip",
"given",
"the",
"size"
] | f093c36574d290330ed623e60fbd070421c730d5 | https://github.com/chartjs/Chart.js/blob/f093c36574d290330ed623e60fbd070421c730d5/src/core/core.tooltip.js#L354-L422 | train | Determines the alignment of the tooltip. | [
30522,
3853,
5646,
11475,
16206,
3672,
1006,
6994,
25101,
1010,
2946,
1007,
1063,
13075,
2944,
1027,
6994,
25101,
1012,
1035,
2944,
1025,
13075,
3673,
1027,
6994,
25101,
1012,
1035,
3673,
1025,
13075,
3673,
12069,
2050,
1027,
6994,
25101,
3... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/model/odata/v4/ODataMetaModel.js | addMapping | function addMapping(mValueListMapping, sQualifier, sMappingUrl, oModel) {
if (bFixedValues !== undefined && "SearchSupported" in mValueListMapping) {
throw new Error("Must not set 'SearchSupported' in annotation "
+ "'com.sap.vocabularies.Common.v1.ValueList' and annotation "
+ "'com.sap.vocabularies.Common.v1.ValueListWithFixedValues'");
}
if ("CollectionRoot" in mValueListMapping) {
oModel = that.getOrCreateSharedModel(mValueListMapping.CollectionRoot);
if (oValueListInfo[sQualifier]
&& oValueListInfo[sQualifier].$model === oModel) {
// same model -> allow overriding the qualifier
mMappingUrlByQualifier[sQualifier] = undefined;
}
}
if (mMappingUrlByQualifier[sQualifier]) {
throw new Error("Annotations '" + sValueList.slice(1)
+ "' with identical qualifier '" + sQualifier
+ "' for property " + sPropertyPath + " in "
+ mMappingUrlByQualifier[sQualifier] + " and " + sMappingUrl);
}
mMappingUrlByQualifier[sQualifier] = sMappingUrl;
mValueListMapping = jQuery.extend(true, {
$model : oModel
}, mValueListMapping);
delete mValueListMapping.CollectionRoot;
delete mValueListMapping.SearchSupported;
oValueListInfo[sQualifier] = mValueListMapping;
} | javascript | function addMapping(mValueListMapping, sQualifier, sMappingUrl, oModel) {
if (bFixedValues !== undefined && "SearchSupported" in mValueListMapping) {
throw new Error("Must not set 'SearchSupported' in annotation "
+ "'com.sap.vocabularies.Common.v1.ValueList' and annotation "
+ "'com.sap.vocabularies.Common.v1.ValueListWithFixedValues'");
}
if ("CollectionRoot" in mValueListMapping) {
oModel = that.getOrCreateSharedModel(mValueListMapping.CollectionRoot);
if (oValueListInfo[sQualifier]
&& oValueListInfo[sQualifier].$model === oModel) {
// same model -> allow overriding the qualifier
mMappingUrlByQualifier[sQualifier] = undefined;
}
}
if (mMappingUrlByQualifier[sQualifier]) {
throw new Error("Annotations '" + sValueList.slice(1)
+ "' with identical qualifier '" + sQualifier
+ "' for property " + sPropertyPath + " in "
+ mMappingUrlByQualifier[sQualifier] + " and " + sMappingUrl);
}
mMappingUrlByQualifier[sQualifier] = sMappingUrl;
mValueListMapping = jQuery.extend(true, {
$model : oModel
}, mValueListMapping);
delete mValueListMapping.CollectionRoot;
delete mValueListMapping.SearchSupported;
oValueListInfo[sQualifier] = mValueListMapping;
} | [
"function",
"addMapping",
"(",
"mValueListMapping",
",",
"sQualifier",
",",
"sMappingUrl",
",",
"oModel",
")",
"{",
"if",
"(",
"bFixedValues",
"!==",
"undefined",
"&&",
"\"SearchSupported\"",
"in",
"mValueListMapping",
")",
"{",
"throw",
"new",
"Error",
"(",
"\"... | /*
Adds the given mapping to oValueListInfo.
@param {object} mValueListMapping The mapping
@param {string} sQualifier The mapping qualifier
@param {string} sMappingUrl The mapping URL (for error messages)
@param {sap.ui.model.odata.v4.ODataModel} oModel The value list model
@throws {Error} If there is already a mapping for the given qualifier | [
"/",
"*",
"Adds",
"the",
"given",
"mapping",
"to",
"oValueListInfo",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/ODataMetaModel.js#L2729-L2756 | train | Adds a mapping to the value list | [
30522,
3853,
5587,
2863,
14853,
1006,
19842,
2389,
16284,
2923,
2863,
14853,
1010,
5490,
8787,
18095,
1010,
15488,
29098,
2075,
3126,
2140,
1010,
18168,
10244,
2140,
1007,
1063,
2065,
1006,
28939,
7646,
2098,
10175,
15808,
999,
1027,
1027,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
dcloudio/mui | examples/login/libs/easymob-webim-sdk/strophe-custom-2.0.0.js | function (html)
{
var fragment = document.createElement('body');
// force the browser to try and fix any invalid HTML tags
fragment.innerHTML = html;
// copy cleaned html into an xml dom
var xhtml = Strophe.createHtml(fragment);
while(xhtml.childNodes.length > 0) {
this.node.appendChild(xhtml.childNodes[0]);
}
return this;
} | javascript | function (html)
{
var fragment = document.createElement('body');
// force the browser to try and fix any invalid HTML tags
fragment.innerHTML = html;
// copy cleaned html into an xml dom
var xhtml = Strophe.createHtml(fragment);
while(xhtml.childNodes.length > 0) {
this.node.appendChild(xhtml.childNodes[0]);
}
return this;
} | [
"function",
"(",
"html",
")",
"{",
"var",
"fragment",
"=",
"document",
".",
"createElement",
"(",
"'body'",
")",
";",
"// force the browser to try and fix any invalid HTML tags\r",
"fragment",
".",
"innerHTML",
"=",
"html",
";",
"// copy cleaned html into an xml dom\r",
... | Function: h
Replace current element contents with the HTML passed in.
This *does not* make the child the new current element
Parameters:
(String) html - The html to insert as contents of current element.
Returns:
The Strophe.Builder object. | [
"Function",
":",
"h",
"Replace",
"current",
"element",
"contents",
"with",
"the",
"HTML",
"passed",
"in",
"."
] | ff74c90a1671a552f3604b1288bf38a4126312d0 | https://github.com/dcloudio/mui/blob/ff74c90a1671a552f3604b1288bf38a4126312d0/examples/login/libs/easymob-webim-sdk/strophe-custom-2.0.0.js#L1758-L1772 | train | Creates a new dom object from the given html string | [
30522,
3853,
1006,
16129,
1007,
1063,
13075,
15778,
1027,
6254,
1012,
3443,
12260,
3672,
1006,
1005,
2303,
1005,
1007,
1025,
1013,
1013,
2486,
1996,
16602,
2000,
3046,
1998,
8081,
2151,
19528,
16129,
22073,
15778,
1012,
5110,
11039,
19968,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/JavaScriptRefactoring/ExtractToFunction.js | handleExtractToFunction | function handleExtractToFunction() {
var editor = EditorManager.getActiveEditor();
var result = new $.Deferred(); // used only for testing purpose
if (editor.getSelections().length > 1) {
editor.displayErrorMessageAtCursor(Strings.ERROR_EXTRACTTO_FUNCTION_MULTICURSORS);
result.resolve(Strings.ERROR_EXTRACTTO_FUNCTION_MULTICURSORS);
return;
}
initializeSession(editor);
var selection = editor.getSelection(),
doc = editor.document,
retObj = RefactoringUtils.normalizeText(editor.getSelectedText(), editor.indexFromPos(selection.start), editor.indexFromPos(selection.end)),
text = retObj.text,
start = retObj.start,
end = retObj.end,
ast,
scopes,
expns,
inlineMenu;
RefactoringUtils.getScopeData(session, editor.posFromIndex(start)).done(function(scope) {
ast = RefactoringUtils.getAST(doc.getText());
var isExpression = false;
if (!RefactoringUtils.checkStatement(ast, start, end, doc.getText())) {
isExpression = RefactoringUtils.getExpression(ast, start, end, doc.getText());
if (!isExpression) {
editor.displayErrorMessageAtCursor(Strings.ERROR_EXTRACTTO_FUNCTION_NOT_VALID);
result.resolve(Strings.ERROR_EXTRACTTO_FUNCTION_NOT_VALID);
return;
}
}
scopes = RefactoringUtils.getAllScopes(ast, scope, doc.getText());
// if only one scope, extract without menu
if (scopes.length === 1) {
extract(ast, text, scopes, scopes[0], scopes[0], start, end, isExpression);
result.resolve();
return;
}
inlineMenu = new InlineMenu(editor, Strings.EXTRACTTO_FUNCTION_SELECT_SCOPE);
inlineMenu.open(scopes.filter(RefactoringUtils.isFnScope));
result.resolve(inlineMenu);
inlineMenu.onSelect(function (scopeId) {
extract(ast, text, scopes, scopes[0], scopes[scopeId], start, end, isExpression);
inlineMenu.close();
});
inlineMenu.onClose(function(){
inlineMenu.close();
});
}).fail(function() {
editor.displayErrorMessageAtCursor(Strings.ERROR_TERN_FAILED);
result.resolve(Strings.ERROR_TERN_FAILED);
});
return result.promise();
} | javascript | function handleExtractToFunction() {
var editor = EditorManager.getActiveEditor();
var result = new $.Deferred(); // used only for testing purpose
if (editor.getSelections().length > 1) {
editor.displayErrorMessageAtCursor(Strings.ERROR_EXTRACTTO_FUNCTION_MULTICURSORS);
result.resolve(Strings.ERROR_EXTRACTTO_FUNCTION_MULTICURSORS);
return;
}
initializeSession(editor);
var selection = editor.getSelection(),
doc = editor.document,
retObj = RefactoringUtils.normalizeText(editor.getSelectedText(), editor.indexFromPos(selection.start), editor.indexFromPos(selection.end)),
text = retObj.text,
start = retObj.start,
end = retObj.end,
ast,
scopes,
expns,
inlineMenu;
RefactoringUtils.getScopeData(session, editor.posFromIndex(start)).done(function(scope) {
ast = RefactoringUtils.getAST(doc.getText());
var isExpression = false;
if (!RefactoringUtils.checkStatement(ast, start, end, doc.getText())) {
isExpression = RefactoringUtils.getExpression(ast, start, end, doc.getText());
if (!isExpression) {
editor.displayErrorMessageAtCursor(Strings.ERROR_EXTRACTTO_FUNCTION_NOT_VALID);
result.resolve(Strings.ERROR_EXTRACTTO_FUNCTION_NOT_VALID);
return;
}
}
scopes = RefactoringUtils.getAllScopes(ast, scope, doc.getText());
// if only one scope, extract without menu
if (scopes.length === 1) {
extract(ast, text, scopes, scopes[0], scopes[0], start, end, isExpression);
result.resolve();
return;
}
inlineMenu = new InlineMenu(editor, Strings.EXTRACTTO_FUNCTION_SELECT_SCOPE);
inlineMenu.open(scopes.filter(RefactoringUtils.isFnScope));
result.resolve(inlineMenu);
inlineMenu.onSelect(function (scopeId) {
extract(ast, text, scopes, scopes[0], scopes[scopeId], start, end, isExpression);
inlineMenu.close();
});
inlineMenu.onClose(function(){
inlineMenu.close();
});
}).fail(function() {
editor.displayErrorMessageAtCursor(Strings.ERROR_TERN_FAILED);
result.resolve(Strings.ERROR_TERN_FAILED);
});
return result.promise();
} | [
"function",
"handleExtractToFunction",
"(",
")",
"{",
"var",
"editor",
"=",
"EditorManager",
".",
"getActiveEditor",
"(",
")",
";",
"var",
"result",
"=",
"new",
"$",
".",
"Deferred",
"(",
")",
";",
"// used only for testing purpose",
"if",
"(",
"editor",
".",
... | Main function that handles extract to function | [
"Main",
"function",
"that",
"handles",
"extract",
"to",
"function"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/JavaScriptRefactoring/ExtractToFunction.js#L265-L328 | train | handleExtractToFunction - Extracts to function | [
30522,
3853,
5047,
10288,
6494,
6593,
3406,
11263,
27989,
1006,
1007,
1063,
13075,
3559,
1027,
3559,
24805,
4590,
1012,
2131,
19620,
2098,
15660,
1006,
1007,
1025,
13075,
2765,
1027,
2047,
1002,
1012,
13366,
28849,
2094,
1006,
1007,
1025,
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... |
postcss/autoprefixer | lib/hacks/grid-utils.js | getGridGap | function getGridGap (decl) {
let gap = {}
// try to find gap
let testGap = /^(grid-)?((row|column)-)?gap$/
decl.parent.walkDecls(testGap, ({ prop, value }) => {
if (/^(grid-)?gap$/.test(prop)) {
let [row,, column] = parser(value).nodes
gap.row = row && parser.stringify(row)
gap.column = column ? parser.stringify(column) : gap.row
}
if (/^(grid-)?row-gap$/.test(prop)) gap.row = value
if (/^(grid-)?column-gap$/.test(prop)) gap.column = value
})
return gap
} | javascript | function getGridGap (decl) {
let gap = {}
// try to find gap
let testGap = /^(grid-)?((row|column)-)?gap$/
decl.parent.walkDecls(testGap, ({ prop, value }) => {
if (/^(grid-)?gap$/.test(prop)) {
let [row,, column] = parser(value).nodes
gap.row = row && parser.stringify(row)
gap.column = column ? parser.stringify(column) : gap.row
}
if (/^(grid-)?row-gap$/.test(prop)) gap.row = value
if (/^(grid-)?column-gap$/.test(prop)) gap.column = value
})
return gap
} | [
"function",
"getGridGap",
"(",
"decl",
")",
"{",
"let",
"gap",
"=",
"{",
"}",
"// try to find gap",
"let",
"testGap",
"=",
"/",
"^(grid-)?((row|column)-)?gap$",
"/",
"decl",
".",
"parent",
".",
"walkDecls",
"(",
"testGap",
",",
"(",
"{",
"prop",
",",
"valu... | Gap utils | [
"Gap",
"utils"
] | 24b28b6dbdc34a5e5800986e76f48cbaf9bbbc32 | https://github.com/postcss/autoprefixer/blob/24b28b6dbdc34a5e5800986e76f48cbaf9bbbc32/lib/hacks/grid-utils.js#L769-L786 | train | Get grid gap | [
30522,
3853,
2131,
16523,
3593,
3654,
2361,
1006,
11703,
2140,
1007,
1063,
2292,
6578,
1027,
1063,
1065,
1013,
1013,
3046,
2000,
2424,
6578,
2292,
3231,
3654,
2361,
1027,
1013,
1034,
1006,
8370,
1011,
1007,
1029,
1006,
1006,
5216,
1064,
5... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/thirdparty/jquery-mobile-custom.js | stopHandler | function stopHandler( event ) {
$this.unbind( touchMoveEvent, moveHandler )
.unbind( touchStopEvent, stopHandler );
if ( start && stop ) {
$.event.special.swipe.handleSwipe( start, stop );
}
start = stop = undefined;
} | javascript | function stopHandler( event ) {
$this.unbind( touchMoveEvent, moveHandler )
.unbind( touchStopEvent, stopHandler );
if ( start && stop ) {
$.event.special.swipe.handleSwipe( start, stop );
}
start = stop = undefined;
} | [
"function",
"stopHandler",
"(",
"event",
")",
"{",
"$this",
".",
"unbind",
"(",
"touchMoveEvent",
",",
"moveHandler",
")",
".",
"unbind",
"(",
"touchStopEvent",
",",
"stopHandler",
")",
";",
"if",
"(",
"start",
"&&",
"stop",
")",
"{",
"$",
".",
"event",
... | SAP MODIFICATION Because touchcancel is used together with touchend, jQuery.fn.bind is used to replace jQuery.fn.one due to the fact that jQuery.fn.one doesn't work for multiple events. | [
"SAP",
"MODIFICATION",
"Because",
"touchcancel",
"is",
"used",
"together",
"with",
"touchend",
"jQuery",
".",
"fn",
".",
"bind",
"is",
"used",
"to",
"replace",
"jQuery",
".",
"fn",
".",
"one",
"due",
"to",
"the",
"fact",
"that",
"jQuery",
".",
"fn",
".",... | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/jquery-mobile-custom.js#L2096-L2104 | train | stop event handler | [
30522,
3853,
2644,
11774,
3917,
1006,
2724,
1007,
1063,
1002,
2023,
1012,
4895,
8428,
2094,
1006,
3543,
5302,
3726,
18697,
3372,
1010,
2693,
11774,
3917,
1007,
1012,
4895,
8428,
2094,
1006,
3543,
16033,
5051,
15338,
1010,
2644,
11774,
3917,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/extensions/default/InlineTimingFunctionEditor/TimingFunctionUtils.js | stepsMatch | function stepsMatch(str, lax) {
var match;
// First look for any steps().
match = str.match(STEPS_VALID_REGEX);
if (match && _validateStepsParams(match)) { // cubic-bezier() with valid params
return _tagMatch(match, STEP);
}
match = str.match(STEPS_GENERAL_REGEX);
if (match) {
match = _getValidStepsParams(match);
if (match && _validateStepsParams(match)) {
return _tagMatch(match, STEP);
} else { // this should not happen!
window.console.log("brackets-steps: TimingFunctionUtils._getValidStepsParams created invalid code");
}
}
// Next look for the step functions (which are special cases of steps())
if (lax) {
// For lax parsing, just look for the keywords
match = str.match(STEP_LAX_REGEX);
if (match) {
return _tagMatch(match, STEP);
}
} else {
// For strict parsing, start with a syntax verifying search
match = str.match(STEP_STRICT_REGEX);
if (match) {
// return exact match to keyword that we need for later replacement
return _tagMatch(str.match(STEP_LAX_REGEX), STEP);
}
}
return null;
} | javascript | function stepsMatch(str, lax) {
var match;
// First look for any steps().
match = str.match(STEPS_VALID_REGEX);
if (match && _validateStepsParams(match)) { // cubic-bezier() with valid params
return _tagMatch(match, STEP);
}
match = str.match(STEPS_GENERAL_REGEX);
if (match) {
match = _getValidStepsParams(match);
if (match && _validateStepsParams(match)) {
return _tagMatch(match, STEP);
} else { // this should not happen!
window.console.log("brackets-steps: TimingFunctionUtils._getValidStepsParams created invalid code");
}
}
// Next look for the step functions (which are special cases of steps())
if (lax) {
// For lax parsing, just look for the keywords
match = str.match(STEP_LAX_REGEX);
if (match) {
return _tagMatch(match, STEP);
}
} else {
// For strict parsing, start with a syntax verifying search
match = str.match(STEP_STRICT_REGEX);
if (match) {
// return exact match to keyword that we need for later replacement
return _tagMatch(str.match(STEP_LAX_REGEX), STEP);
}
}
return null;
} | [
"function",
"stepsMatch",
"(",
"str",
",",
"lax",
")",
"{",
"var",
"match",
";",
"// First look for any steps().",
"match",
"=",
"str",
".",
"match",
"(",
"STEPS_VALID_REGEX",
")",
";",
"if",
"(",
"match",
"&&",
"_validateStepsParams",
"(",
"match",
")",
")"... | Match a steps function value from a CSS Declaration or Value.
Matches returned from this function must be handled in
BezierCurveEditor._getCubicBezierCoords().
@param {string} str Input string.
@param {!boolean} lax Parsing mode where:
lax=false Input is a Full or partial line containing CSS Declaration.
This is the more strict search used for initial detection.
lax=true Input is a previously parsed value. This is the less strict search
used to convert previously parsed values to RegExp match format.
@return {!RegExpMatch} | [
"Match",
"a",
"steps",
"function",
"value",
"from",
"a",
"CSS",
"Declaration",
"or",
"Value",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/InlineTimingFunctionEditor/TimingFunctionUtils.js#L384-L420 | train | Match a string to a step function | [
30522,
3853,
4084,
18900,
2818,
1006,
2358,
2099,
1010,
27327,
1007,
1063,
13075,
2674,
1025,
1013,
1013,
2034,
2298,
2005,
2151,
4084,
1006,
1007,
1012,
2674,
1027,
2358,
2099,
1012,
2674,
1006,
4084,
1035,
9398,
1035,
19723,
10288,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/base/ManagedObject.js | canCreate | function canCreate(oBindingInfo) {
var aParts = oBindingInfo.parts,
i;
if (aParts) {
for (i = 0; i < aParts.length; i++) {
if ( !that.getModel(aParts[i].model) ) {
return false;
}
}
return true;
} else { // List or object binding
return !!that.getModel(oBindingInfo.model);
}
} | javascript | function canCreate(oBindingInfo) {
var aParts = oBindingInfo.parts,
i;
if (aParts) {
for (i = 0; i < aParts.length; i++) {
if ( !that.getModel(aParts[i].model) ) {
return false;
}
}
return true;
} else { // List or object binding
return !!that.getModel(oBindingInfo.model);
}
} | [
"function",
"canCreate",
"(",
"oBindingInfo",
")",
"{",
"var",
"aParts",
"=",
"oBindingInfo",
".",
"parts",
",",
"i",
";",
"if",
"(",
"aParts",
")",
"{",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"aParts",
".",
"length",
";",
"i",
"++",
")",
"{",... | /*
Checks whether a binding can be created for the given oBindingInfo
@param oBindingInfo
@returns {boolean} | [
"/",
"*",
"Checks",
"whether",
"a",
"binding",
"can",
"be",
"created",
"for",
"the",
"given",
"oBindingInfo"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/base/ManagedObject.js#L4188-L4202 | train | Determines whether the binding can be created. | [
30522,
3853,
2064,
16748,
3686,
1006,
27885,
22254,
2075,
2378,
14876,
1007,
1063,
13075,
4237,
2015,
1027,
27885,
22254,
2075,
2378,
14876,
1012,
3033,
1010,
1045,
1025,
2065,
1006,
4237,
2015,
1007,
1063,
2005,
1006,
1045,
1027,
1014,
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... |
eslint/eslint | lib/rules/array-callback-return.js | isCallbackOfArrayMethod | function isCallbackOfArrayMethod(node) {
let currentNode = node;
while (currentNode) {
const parent = currentNode.parent;
switch (parent.type) {
/*
* Looks up the destination. e.g.,
* foo.every(nativeFoo || function foo() { ... });
*/
case "LogicalExpression":
case "ConditionalExpression":
currentNode = parent;
break;
/*
* If the upper function is IIFE, checks the destination of the return value.
* e.g.
* foo.every((function() {
* // setup...
* return function callback() { ... };
* })());
*/
case "ReturnStatement": {
const func = astUtils.getUpperFunction(parent);
if (func === null || !astUtils.isCallee(func)) {
return false;
}
currentNode = func.parent;
break;
}
/*
* e.g.
* Array.from([], function() {});
* list.every(function() {});
*/
case "CallExpression":
if (astUtils.isArrayFromMethod(parent.callee)) {
return (
parent.arguments.length >= 2 &&
parent.arguments[1] === currentNode
);
}
if (isTargetMethod(parent.callee)) {
return (
parent.arguments.length >= 1 &&
parent.arguments[0] === currentNode
);
}
return false;
// Otherwise this node is not target.
default:
return false;
}
}
/* istanbul ignore next: unreachable */
return false;
} | javascript | function isCallbackOfArrayMethod(node) {
let currentNode = node;
while (currentNode) {
const parent = currentNode.parent;
switch (parent.type) {
/*
* Looks up the destination. e.g.,
* foo.every(nativeFoo || function foo() { ... });
*/
case "LogicalExpression":
case "ConditionalExpression":
currentNode = parent;
break;
/*
* If the upper function is IIFE, checks the destination of the return value.
* e.g.
* foo.every((function() {
* // setup...
* return function callback() { ... };
* })());
*/
case "ReturnStatement": {
const func = astUtils.getUpperFunction(parent);
if (func === null || !astUtils.isCallee(func)) {
return false;
}
currentNode = func.parent;
break;
}
/*
* e.g.
* Array.from([], function() {});
* list.every(function() {});
*/
case "CallExpression":
if (astUtils.isArrayFromMethod(parent.callee)) {
return (
parent.arguments.length >= 2 &&
parent.arguments[1] === currentNode
);
}
if (isTargetMethod(parent.callee)) {
return (
parent.arguments.length >= 1 &&
parent.arguments[0] === currentNode
);
}
return false;
// Otherwise this node is not target.
default:
return false;
}
}
/* istanbul ignore next: unreachable */
return false;
} | [
"function",
"isCallbackOfArrayMethod",
"(",
"node",
")",
"{",
"let",
"currentNode",
"=",
"node",
";",
"while",
"(",
"currentNode",
")",
"{",
"const",
"parent",
"=",
"currentNode",
".",
"parent",
";",
"switch",
"(",
"parent",
".",
"type",
")",
"{",
"/*\n ... | Checks whether or not a given node is a function expression which is the
callback of an array method.
@param {ASTNode} node - A node to check. This is one of
FunctionExpression or ArrowFunctionExpression.
@returns {boolean} `true` if the node is the callback of an array method. | [
"Checks",
"whether",
"or",
"not",
"a",
"given",
"node",
"is",
"a",
"function",
"expression",
"which",
"is",
"the",
"callback",
"of",
"an",
"array",
"method",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/array-callback-return.js#L73-L136 | train | Checks if the node is a callback of an array method | [
30522,
3853,
2003,
9289,
20850,
8684,
11253,
2906,
9447,
11368,
6806,
2094,
1006,
13045,
1007,
1063,
2292,
2783,
3630,
3207,
1027,
13045,
1025,
2096,
1006,
2783,
3630,
3207,
1007,
1063,
9530,
3367,
6687,
1027,
2783,
3630,
3207,
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... |
mui-org/material-ui | packages/material-ui-codemod/src/v1.0.0/color-imports.js | transformMemberImports | function transformMemberImports(j, root, importPath, targetPath) {
// find member imports
root.find(j.ImportDeclaration, { source: { value: importPath } }).forEach(importDeclaration => {
const memberImportSpecifiers = importDeclaration.node.specifiers.filter(
specifier => specifier.type === 'ImportSpecifier',
);
if (memberImportSpecifiers.length) {
j(importDeclaration).replaceWith(() => {
const importDeclarations = [];
const assignmentExpressions = [];
memberImportSpecifiers.forEach(memberSpecifier => {
const { palette, hue } = colorAccent(memberSpecifier.imported.name);
const colorModuleName = colorImportPath(palette);
const modulePath = `${targetPath}/${colorModuleName}`;
const colorIdentifier = j.identifier(colorModuleName);
// import color module (if not already imported)
if (importDeclarations.map(p => p.source.value).indexOf(modulePath) === -1) {
importDeclarations.push(
j.importDeclaration(
[j.importDefaultSpecifier(colorIdentifier)],
j.literal(modulePath),
),
);
}
// conditional assignment expression
if (hue || colorModuleName === 'common') {
const property = hue || palette;
assignmentExpressions.push(
j.variableDeclaration('const', [
j.variableDeclarator(
j.identifier(memberSpecifier.local.name),
j.memberExpression(
colorIdentifier,
/^[_|a-z]/i.test(property) ? j.identifier(property) : j.literal(property),
),
),
]),
);
}
});
return importDeclarations.concat(assignmentExpressions);
});
}
});
} | javascript | function transformMemberImports(j, root, importPath, targetPath) {
// find member imports
root.find(j.ImportDeclaration, { source: { value: importPath } }).forEach(importDeclaration => {
const memberImportSpecifiers = importDeclaration.node.specifiers.filter(
specifier => specifier.type === 'ImportSpecifier',
);
if (memberImportSpecifiers.length) {
j(importDeclaration).replaceWith(() => {
const importDeclarations = [];
const assignmentExpressions = [];
memberImportSpecifiers.forEach(memberSpecifier => {
const { palette, hue } = colorAccent(memberSpecifier.imported.name);
const colorModuleName = colorImportPath(palette);
const modulePath = `${targetPath}/${colorModuleName}`;
const colorIdentifier = j.identifier(colorModuleName);
// import color module (if not already imported)
if (importDeclarations.map(p => p.source.value).indexOf(modulePath) === -1) {
importDeclarations.push(
j.importDeclaration(
[j.importDefaultSpecifier(colorIdentifier)],
j.literal(modulePath),
),
);
}
// conditional assignment expression
if (hue || colorModuleName === 'common') {
const property = hue || palette;
assignmentExpressions.push(
j.variableDeclaration('const', [
j.variableDeclarator(
j.identifier(memberSpecifier.local.name),
j.memberExpression(
colorIdentifier,
/^[_|a-z]/i.test(property) ? j.identifier(property) : j.literal(property),
),
),
]),
);
}
});
return importDeclarations.concat(assignmentExpressions);
});
}
});
} | [
"function",
"transformMemberImports",
"(",
"j",
",",
"root",
",",
"importPath",
",",
"targetPath",
")",
"{",
"// find member imports",
"root",
".",
"find",
"(",
"j",
".",
"ImportDeclaration",
",",
"{",
"source",
":",
"{",
"value",
":",
"importPath",
"}",
"}"... | Replace all member imports.
e.g. import { red, blue } from 'material-ui/styles/colors'
@param {jscodeshift_api_object} j
@param {jscodeshift_ast_object} root
@param {string} importPath
@param {string} targetPath | [
"Replace",
"all",
"member",
"imports",
".",
"e",
".",
"g",
".",
"import",
"{",
"red",
"blue",
"}",
"from",
"material",
"-",
"ui",
"/",
"styles",
"/",
"colors"
] | 1555e52367835946382fbf2a8f681de71318915d | https://github.com/mui-org/material-ui/blob/1555e52367835946382fbf2a8f681de71318915d/packages/material-ui-codemod/src/v1.0.0/color-imports.js#L74-L122 | train | transform member imports | [
30522,
3853,
10938,
4168,
21784,
5714,
25378,
1006,
1046,
1010,
7117,
1010,
12324,
15069,
1010,
4539,
15069,
1007,
1063,
1013,
1013,
2424,
2266,
17589,
7117,
1012,
2424,
1006,
1046,
1012,
12324,
3207,
20464,
25879,
3258,
1010,
1063,
3120,
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... |
getinsomnia/insomnia | packages/insomnia-importers/src/importers/swagger2.js | parseDocument | async function parseDocument(rawData) {
try {
return utils.unthrowableParseJson(rawData) || SwaggerParser.YAML.parse(rawData);
} catch (err) {
return null;
}
} | javascript | async function parseDocument(rawData) {
try {
return utils.unthrowableParseJson(rawData) || SwaggerParser.YAML.parse(rawData);
} catch (err) {
return null;
}
} | [
"async",
"function",
"parseDocument",
"(",
"rawData",
")",
"{",
"try",
"{",
"return",
"utils",
".",
"unthrowableParseJson",
"(",
"rawData",
")",
"||",
"SwaggerParser",
".",
"YAML",
".",
"parse",
"(",
"rawData",
")",
";",
"}",
"catch",
"(",
"err",
")",
"{... | Parse string data into swagger 2.0 object (https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#swagger-object)
@param {string} rawData
@returns {Object|null} Swagger 2.0 object | [
"Parse",
"string",
"data",
"into",
"swagger",
"2",
".",
"0",
"object",
"(",
"https",
":",
"//",
"github",
".",
"com",
"/",
"OAI",
"/",
"OpenAPI",
"-",
"Specification",
"/",
"blob",
"/",
"master",
"/",
"versions",
"/",
"2",
".",
"0",
".",
"md#swagger"... | e24ce7f7b41246e700c4b9bdb6b34b6652ad589b | https://github.com/getinsomnia/insomnia/blob/e24ce7f7b41246e700c4b9bdb6b34b6652ad589b/packages/insomnia-importers/src/importers/swagger2.js#L78-L84 | train | Parses a Swagger document | [
30522,
2004,
6038,
2278,
3853,
11968,
6924,
10085,
27417,
2102,
1006,
6315,
2850,
2696,
1007,
1063,
3046,
1063,
2709,
21183,
12146,
1012,
4895,
2705,
10524,
3085,
19362,
3366,
22578,
2239,
1006,
6315,
2850,
2696,
1007,
1064,
1064,
25430,
27... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/tmpl/HandlebarsTemplate.js | function(rm, oControl) {
// execute the template with the above options
var sHTML = fnTemplate(oControl.getContext() || {}, {
data: {
renderManager: rm,
rootControl: oControl,
view: oView
},
helpers: HandlebarsTemplate.RENDER_HELPERS
});
// write the markup
rm.write(sHTML);
} | javascript | function(rm, oControl) {
// execute the template with the above options
var sHTML = fnTemplate(oControl.getContext() || {}, {
data: {
renderManager: rm,
rootControl: oControl,
view: oView
},
helpers: HandlebarsTemplate.RENDER_HELPERS
});
// write the markup
rm.write(sHTML);
} | [
"function",
"(",
"rm",
",",
"oControl",
")",
"{",
"// execute the template with the above options",
"var",
"sHTML",
"=",
"fnTemplate",
"(",
"oControl",
".",
"getContext",
"(",
")",
"||",
"{",
"}",
",",
"{",
"data",
":",
"{",
"renderManager",
":",
"rm",
",",
... | create the renderer for the control | [
"create",
"the",
"renderer",
"for",
"the",
"control"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/tmpl/HandlebarsTemplate.js#L606-L621 | train | Renders the template with the given context | [
30522,
3853,
1006,
28549,
1010,
1051,
8663,
13181,
2140,
1007,
1063,
1013,
1013,
15389,
1996,
23561,
2007,
1996,
2682,
7047,
13075,
14021,
21246,
2140,
1027,
1042,
10111,
8737,
13806,
1006,
1051,
8663,
13181,
2140,
1012,
2131,
8663,
18209,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Persistence.js | function(oControl, sStableIdPropertyName) {
this._oControl = oControl;
this._sStableIdPropertyName = sStableIdPropertyName || 'id';
this._sStableId = this._getStableId();
this._sComponentName = Utils.getComponentClassName(oControl);
if (!this._sComponentName) {
Utils.log.error("The Control does not belong to an SAPUI5 component. Variants and Changes for this control might not work as expected.");
}
this._oAppDescriptor = Utils.getAppDescriptor(oControl);
this._sSiteId = Utils.getSiteId(oControl);
this._oChangePersistence = ChangePersistenceFactory.getChangePersistenceForControl(this._oControl);
this._oChanges = {};
} | javascript | function(oControl, sStableIdPropertyName) {
this._oControl = oControl;
this._sStableIdPropertyName = sStableIdPropertyName || 'id';
this._sStableId = this._getStableId();
this._sComponentName = Utils.getComponentClassName(oControl);
if (!this._sComponentName) {
Utils.log.error("The Control does not belong to an SAPUI5 component. Variants and Changes for this control might not work as expected.");
}
this._oAppDescriptor = Utils.getAppDescriptor(oControl);
this._sSiteId = Utils.getSiteId(oControl);
this._oChangePersistence = ChangePersistenceFactory.getChangePersistenceForControl(this._oControl);
this._oChanges = {};
} | [
"function",
"(",
"oControl",
",",
"sStableIdPropertyName",
")",
"{",
"this",
".",
"_oControl",
"=",
"oControl",
";",
"this",
".",
"_sStableIdPropertyName",
"=",
"sStableIdPropertyName",
"||",
"'id'",
";",
"this",
".",
"_sStableId",
"=",
"this",
".",
"_getStableI... | Helper object to access a change from the back end. Access helper object for each change (and variant) which was fetched from the back end
@constructor
@param {sap.ui.core.Control} oControl - the control for which the changes should be fetched
@param {string} [sStableIdPropertyName='id'] the stable id
@alias sap.ui.fl.Persistence
@author SAP SE
@version ${version}
@experimental Since 1.25.0 | [
"Helper",
"object",
"to",
"access",
"a",
"change",
"from",
"the",
"back",
"end",
".",
"Access",
"helper",
"object",
"for",
"each",
"change",
"(",
"and",
"variant",
")",
"which",
"was",
"fetched",
"from",
"the",
"back",
"end"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/Persistence.js#L25-L40 | train | Initializes the control instance | [
30522,
3853,
1006,
1051,
8663,
13181,
2140,
1010,
7020,
10880,
3593,
21572,
4842,
25680,
14074,
1007,
1063,
2023,
1012,
1035,
1051,
8663,
13181,
2140,
1027,
1051,
8663,
13181,
2140,
1025,
2023,
1012,
1035,
7020,
10880,
3593,
21572,
4842,
25... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | src/sap.ui.table/src/sap/ui/table/TableColumnUtils.js | function(oColumn, iNewIndex) {
if (!TableColumnUtils.isColumnMovableTo(oColumn, iNewIndex)) {
return false;
}
var oTable = oColumn.getParent(),
iCurrentIndex = oTable.indexOfColumn(oColumn);
if (iNewIndex === iCurrentIndex) {
return false;
}
iNewIndex = TableColumnUtils.normalizeColumnMoveTargetIndex(oColumn, iNewIndex);
var bExecuteDefault = oTable.fireColumnMove({
column: oColumn,
newPos: iNewIndex
});
if (!bExecuteDefault) {
// No execution of the movement when event default is prevented
return false;
}
oTable._bReorderInProcess = true;
/* The AnalyticalBinding does not support calls like:
* oBinding.updateAnalyticalInfo(...);
* oBinding.getContexts(...);
* oBinding.updateAnalyticalInfo(...);
* oBinding.getContexts(...);
* A call chain like above can lead to some problems:
* - A request according to the analytical info passed in line 1 would be sent, but not for the info in line 3.
* - After the change event (updateRows) the binding returns an incorrect length of 0.
* The solution is to only trigger a request at the end of a process.
*/
oTable.removeColumn(oColumn, true);
oTable.insertColumn(oColumn, iNewIndex);
oTable._bReorderInProcess = false;
return true;
} | javascript | function(oColumn, iNewIndex) {
if (!TableColumnUtils.isColumnMovableTo(oColumn, iNewIndex)) {
return false;
}
var oTable = oColumn.getParent(),
iCurrentIndex = oTable.indexOfColumn(oColumn);
if (iNewIndex === iCurrentIndex) {
return false;
}
iNewIndex = TableColumnUtils.normalizeColumnMoveTargetIndex(oColumn, iNewIndex);
var bExecuteDefault = oTable.fireColumnMove({
column: oColumn,
newPos: iNewIndex
});
if (!bExecuteDefault) {
// No execution of the movement when event default is prevented
return false;
}
oTable._bReorderInProcess = true;
/* The AnalyticalBinding does not support calls like:
* oBinding.updateAnalyticalInfo(...);
* oBinding.getContexts(...);
* oBinding.updateAnalyticalInfo(...);
* oBinding.getContexts(...);
* A call chain like above can lead to some problems:
* - A request according to the analytical info passed in line 1 would be sent, but not for the info in line 3.
* - After the change event (updateRows) the binding returns an incorrect length of 0.
* The solution is to only trigger a request at the end of a process.
*/
oTable.removeColumn(oColumn, true);
oTable.insertColumn(oColumn, iNewIndex);
oTable._bReorderInProcess = false;
return true;
} | [
"function",
"(",
"oColumn",
",",
"iNewIndex",
")",
"{",
"if",
"(",
"!",
"TableColumnUtils",
".",
"isColumnMovableTo",
"(",
"oColumn",
",",
"iNewIndex",
")",
")",
"{",
"return",
"false",
";",
"}",
"var",
"oTable",
"=",
"oColumn",
".",
"getParent",
"(",
")... | Moves the column to the desired position.
Note: The index must be given for the current table setup (which includes the column itself).
@param {sap.ui.table.Column} oColumn Column of the table.
@param {sap.ui.table.Column} iNewIndex the desired new index of the column in the current table setup.
@returns {boolean} Whether the column was moved to the desired position. | [
"Moves",
"the",
"column",
"to",
"the",
"desired",
"position",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableColumnUtils.js#L490-L532 | train | Moves the specified column to the specified index. | [
30522,
3853,
1006,
1051,
25778,
2819,
2078,
1010,
1999,
7974,
22254,
10288,
1007,
1063,
2065,
1006,
999,
2795,
25778,
2819,
24072,
12146,
1012,
2003,
25778,
2819,
2078,
25661,
3406,
1006,
1051,
25778,
2819,
2078,
1010,
1999,
7974,
22254,
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... | |
pixijs/pixi.js | packages/graphics/src/utils/buildLine.js | buildNativeLine | function buildNativeLine(graphicsData, graphicsGeometry)
{
let i = 0;
const points = graphicsData.points || graphicsData.shape.points;
if (points.length === 0) return;
const verts = graphicsGeometry.points;
const indices = graphicsGeometry.indices;
const length = points.length / 2;
let indexStart = verts.length / 2;
// sort color
for (i = 1; i < length; i++)
{
const p1x = points[(i - 1) * 2];
const p1y = points[((i - 1) * 2) + 1];
const p2x = points[i * 2];
const p2y = points[(i * 2) + 1];
verts.push(p1x, p1y);
verts.push(p2x, p2y);
indices.push(indexStart++, indexStart++);
}
} | javascript | function buildNativeLine(graphicsData, graphicsGeometry)
{
let i = 0;
const points = graphicsData.points || graphicsData.shape.points;
if (points.length === 0) return;
const verts = graphicsGeometry.points;
const indices = graphicsGeometry.indices;
const length = points.length / 2;
let indexStart = verts.length / 2;
// sort color
for (i = 1; i < length; i++)
{
const p1x = points[(i - 1) * 2];
const p1y = points[((i - 1) * 2) + 1];
const p2x = points[i * 2];
const p2y = points[(i * 2) + 1];
verts.push(p1x, p1y);
verts.push(p2x, p2y);
indices.push(indexStart++, indexStart++);
}
} | [
"function",
"buildNativeLine",
"(",
"graphicsData",
",",
"graphicsGeometry",
")",
"{",
"let",
"i",
"=",
"0",
";",
"const",
"points",
"=",
"graphicsData",
".",
"points",
"||",
"graphicsData",
".",
"shape",
".",
"points",
";",
"if",
"(",
"points",
".",
"leng... | Builds a line to draw using the gl.drawArrays(gl.LINES) method
Ignored from docs since it is not directly exposed.
@ignore
@private
@param {PIXI.GraphicsData} graphicsData - The graphics object containing all the necessary properties
@param {PIXI.GraphicsGeometry} graphicsGeometry - Geometry where to append output | [
"Builds",
"a",
"line",
"to",
"draw",
"using",
"the",
"gl",
".",
"drawArrays",
"(",
"gl",
".",
"LINES",
")",
"method"
] | 99ae03b7565ae7ca5a6de633b0a277f7128fa4d0 | https://github.com/pixijs/pixi.js/blob/99ae03b7565ae7ca5a6de633b0a277f7128fa4d0/packages/graphics/src/utils/buildLine.js#L249-L278 | train | Build a native line | [
30522,
3853,
3857,
19833,
3512,
4179,
1006,
8389,
2850,
2696,
1010,
8389,
3351,
8462,
11129,
1007,
1063,
2292,
1045,
1027,
1014,
1025,
9530,
3367,
2685,
1027,
8389,
2850,
2696,
1012,
2685,
1064,
1064,
8389,
2850,
2696,
1012,
4338,
1012,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/filesystem/impls/appshell/AppshellFileSystem.js | watchPath | function watchPath(path, ignored, callback) {
if (_isRunningOnWindowsXP) {
callback(FileSystemError.NOT_SUPPORTED);
return;
}
appshell.fs.isNetworkDrive(path, function (err, isNetworkDrive) {
if (err || isNetworkDrive) {
if (isNetworkDrive) {
callback(FileSystemError.NETWORK_DRIVE_NOT_SUPPORTED);
} else {
callback(FileSystemError.UNKNOWN);
}
return;
}
_nodeDomain.exec("watchPath", path, ignored)
.then(callback, callback);
});
} | javascript | function watchPath(path, ignored, callback) {
if (_isRunningOnWindowsXP) {
callback(FileSystemError.NOT_SUPPORTED);
return;
}
appshell.fs.isNetworkDrive(path, function (err, isNetworkDrive) {
if (err || isNetworkDrive) {
if (isNetworkDrive) {
callback(FileSystemError.NETWORK_DRIVE_NOT_SUPPORTED);
} else {
callback(FileSystemError.UNKNOWN);
}
return;
}
_nodeDomain.exec("watchPath", path, ignored)
.then(callback, callback);
});
} | [
"function",
"watchPath",
"(",
"path",
",",
"ignored",
",",
"callback",
")",
"{",
"if",
"(",
"_isRunningOnWindowsXP",
")",
"{",
"callback",
"(",
"FileSystemError",
".",
"NOT_SUPPORTED",
")",
";",
"return",
";",
"}",
"appshell",
".",
"fs",
".",
"isNetworkDrive... | Start providing change notifications for the file or directory at the
given path, calling back asynchronously with a possibly null FileSystemError
string when the initialization is complete. Notifications are provided
using the changeCallback function provided by the initWatchers method.
Note that change notifications are only provided recursively for directories
when the recursiveWatch property of this module is true.
@param {string} path
@param {Array<string>} ignored
@param {function(?string)=} callback | [
"Start",
"providing",
"change",
"notifications",
"for",
"the",
"file",
"or",
"directory",
"at",
"the",
"given",
"path",
"calling",
"back",
"asynchronously",
"with",
"a",
"possibly",
"null",
"FileSystemError",
"string",
"when",
"the",
"initialization",
"is",
"compl... | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/filesystem/impls/appshell/AppshellFileSystem.js#L527-L544 | train | watchPath - watch a path | [
30522,
3853,
3422,
15069,
1006,
4130,
1010,
6439,
1010,
2655,
5963,
1007,
1063,
2065,
1006,
1035,
2003,
15532,
5582,
2239,
11101,
15568,
2595,
2361,
1007,
1063,
2655,
5963,
1006,
6764,
27268,
21382,
18933,
2099,
1012,
2025,
1035,
3569,
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... |
ColorlibHQ/AdminLTE | bower_components/moment/src/locale/lb.js | eifelerRegelAppliesToNumber | function eifelerRegelAppliesToNumber(number) {
number = parseInt(number, 10);
if (isNaN(number)) {
return false;
}
if (number < 0) {
// Negative Number --> always true
return true;
} else if (number < 10) {
// Only 1 digit
if (4 <= number && number <= 7) {
return true;
}
return false;
} else if (number < 100) {
// 2 digits
var lastDigit = number % 10, firstDigit = number / 10;
if (lastDigit === 0) {
return eifelerRegelAppliesToNumber(firstDigit);
}
return eifelerRegelAppliesToNumber(lastDigit);
} else if (number < 10000) {
// 3 or 4 digits --> recursively check first digit
while (number >= 10) {
number = number / 10;
}
return eifelerRegelAppliesToNumber(number);
} else {
// Anything larger than 4 digits: recursively check first n-3 digits
number = number / 1000;
return eifelerRegelAppliesToNumber(number);
}
} | javascript | function eifelerRegelAppliesToNumber(number) {
number = parseInt(number, 10);
if (isNaN(number)) {
return false;
}
if (number < 0) {
// Negative Number --> always true
return true;
} else if (number < 10) {
// Only 1 digit
if (4 <= number && number <= 7) {
return true;
}
return false;
} else if (number < 100) {
// 2 digits
var lastDigit = number % 10, firstDigit = number / 10;
if (lastDigit === 0) {
return eifelerRegelAppliesToNumber(firstDigit);
}
return eifelerRegelAppliesToNumber(lastDigit);
} else if (number < 10000) {
// 3 or 4 digits --> recursively check first digit
while (number >= 10) {
number = number / 10;
}
return eifelerRegelAppliesToNumber(number);
} else {
// Anything larger than 4 digits: recursively check first n-3 digits
number = number / 1000;
return eifelerRegelAppliesToNumber(number);
}
} | [
"function",
"eifelerRegelAppliesToNumber",
"(",
"number",
")",
"{",
"number",
"=",
"parseInt",
"(",
"number",
",",
"10",
")",
";",
"if",
"(",
"isNaN",
"(",
"number",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"number",
"<",
"0",
")",
"{",... | Returns true if the word before the given number loses the '-n' ending.
e.g. 'an 10 Deeg' but 'a 5 Deeg'
@param number {integer}
@returns {boolean} | [
"Returns",
"true",
"if",
"the",
"word",
"before",
"the",
"given",
"number",
"loses",
"the",
"-",
"n",
"ending",
".",
"e",
".",
"g",
".",
"an",
"10",
"Deeg",
"but",
"a",
"5",
"Deeg"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/bower_components/moment/src/locale/lb.js#L39-L71 | train | Check if a number is a valid eifeler regression formula | [
30522,
3853,
1041,
29323,
3917,
2890,
12439,
29098,
21292,
2239,
29440,
1006,
2193,
1007,
1063,
2193,
1027,
11968,
20240,
3372,
1006,
2193,
1010,
2184,
1007,
1025,
2065,
1006,
3475,
2319,
1006,
2193,
1007,
1007,
1063,
2709,
6270,
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... |
lovell/sharp | lib/output.js | toFormat | function toFormat (format, options) {
if (is.object(format) && is.string(format.id)) {
format = format.id;
}
if (format === 'jpg') format = 'jpeg';
if (!is.inArray(format, ['jpeg', 'png', 'webp', 'tiff', 'raw'])) {
throw new Error('Unsupported output format ' + format);
}
return this[format](options);
} | javascript | function toFormat (format, options) {
if (is.object(format) && is.string(format.id)) {
format = format.id;
}
if (format === 'jpg') format = 'jpeg';
if (!is.inArray(format, ['jpeg', 'png', 'webp', 'tiff', 'raw'])) {
throw new Error('Unsupported output format ' + format);
}
return this[format](options);
} | [
"function",
"toFormat",
"(",
"format",
",",
"options",
")",
"{",
"if",
"(",
"is",
".",
"object",
"(",
"format",
")",
"&&",
"is",
".",
"string",
"(",
"format",
".",
"id",
")",
")",
"{",
"format",
"=",
"format",
".",
"id",
";",
"}",
"if",
"(",
"f... | Force output to a given format.
@example
// Convert any input to PNG output
const data = await sharp(input)
.toFormat('png')
.toBuffer();
@param {(String|Object)} format - as a String or an Object with an 'id' attribute
@param {Object} options - output options
@returns {Sharp}
@throws {Error} unsupported format or options | [
"Force",
"output",
"to",
"a",
"given",
"format",
"."
] | 05d76eeadfe54713606a615185b2da047923406b | https://github.com/lovell/sharp/blob/05d76eeadfe54713606a615185b2da047923406b/lib/output.js#L461-L470 | train | Convert image to specified format | [
30522,
3853,
2000,
14192,
4017,
1006,
4289,
1010,
7047,
1007,
1063,
2065,
1006,
2003,
1012,
4874,
1006,
4289,
1007,
1004,
1004,
2003,
1012,
5164,
1006,
4289,
1012,
8909,
1007,
1007,
1063,
4289,
1027,
4289,
1012,
8909,
1025,
1065,
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... |
facebook/create-react-app | packages/react-dev-utils/FileSizeReporter.js | printFileSizesAfterBuild | function printFileSizesAfterBuild(
webpackStats,
previousSizeMap,
buildFolder,
maxBundleGzipSize,
maxChunkGzipSize
) {
var root = previousSizeMap.root;
var sizes = previousSizeMap.sizes;
var assets = (webpackStats.stats || [webpackStats])
.map(stats =>
stats
.toJson({ all: false, assets: true })
.assets.filter(asset => canReadAsset(asset.name))
.map(asset => {
var fileContents = fs.readFileSync(path.join(root, asset.name));
var size = gzipSize(fileContents);
var previousSize = sizes[removeFileNameHash(root, asset.name)];
var difference = getDifferenceLabel(size, previousSize);
return {
folder: path.join(
path.basename(buildFolder),
path.dirname(asset.name)
),
name: path.basename(asset.name),
size: size,
sizeLabel:
filesize(size) + (difference ? ' (' + difference + ')' : ''),
};
})
)
.reduce((single, all) => all.concat(single), []);
assets.sort((a, b) => b.size - a.size);
var longestSizeLabelLength = Math.max.apply(
null,
assets.map(a => stripAnsi(a.sizeLabel).length)
);
var suggestBundleSplitting = false;
assets.forEach(asset => {
var sizeLabel = asset.sizeLabel;
var sizeLength = stripAnsi(sizeLabel).length;
if (sizeLength < longestSizeLabelLength) {
var rightPadding = ' '.repeat(longestSizeLabelLength - sizeLength);
sizeLabel += rightPadding;
}
var isMainBundle = asset.name.indexOf('main.') === 0;
var maxRecommendedSize = isMainBundle
? maxBundleGzipSize
: maxChunkGzipSize;
var isLarge = maxRecommendedSize && asset.size > maxRecommendedSize;
if (isLarge && path.extname(asset.name) === '.js') {
suggestBundleSplitting = true;
}
console.log(
' ' +
(isLarge ? chalk.yellow(sizeLabel) : sizeLabel) +
' ' +
chalk.dim(asset.folder + path.sep) +
chalk.cyan(asset.name)
);
});
if (suggestBundleSplitting) {
console.log();
console.log(
chalk.yellow('The bundle size is significantly larger than recommended.')
);
console.log(
chalk.yellow(
'Consider reducing it with code splitting: https://goo.gl/9VhYWB'
)
);
console.log(
chalk.yellow(
'You can also analyze the project dependencies: https://goo.gl/LeUzfb'
)
);
}
} | javascript | function printFileSizesAfterBuild(
webpackStats,
previousSizeMap,
buildFolder,
maxBundleGzipSize,
maxChunkGzipSize
) {
var root = previousSizeMap.root;
var sizes = previousSizeMap.sizes;
var assets = (webpackStats.stats || [webpackStats])
.map(stats =>
stats
.toJson({ all: false, assets: true })
.assets.filter(asset => canReadAsset(asset.name))
.map(asset => {
var fileContents = fs.readFileSync(path.join(root, asset.name));
var size = gzipSize(fileContents);
var previousSize = sizes[removeFileNameHash(root, asset.name)];
var difference = getDifferenceLabel(size, previousSize);
return {
folder: path.join(
path.basename(buildFolder),
path.dirname(asset.name)
),
name: path.basename(asset.name),
size: size,
sizeLabel:
filesize(size) + (difference ? ' (' + difference + ')' : ''),
};
})
)
.reduce((single, all) => all.concat(single), []);
assets.sort((a, b) => b.size - a.size);
var longestSizeLabelLength = Math.max.apply(
null,
assets.map(a => stripAnsi(a.sizeLabel).length)
);
var suggestBundleSplitting = false;
assets.forEach(asset => {
var sizeLabel = asset.sizeLabel;
var sizeLength = stripAnsi(sizeLabel).length;
if (sizeLength < longestSizeLabelLength) {
var rightPadding = ' '.repeat(longestSizeLabelLength - sizeLength);
sizeLabel += rightPadding;
}
var isMainBundle = asset.name.indexOf('main.') === 0;
var maxRecommendedSize = isMainBundle
? maxBundleGzipSize
: maxChunkGzipSize;
var isLarge = maxRecommendedSize && asset.size > maxRecommendedSize;
if (isLarge && path.extname(asset.name) === '.js') {
suggestBundleSplitting = true;
}
console.log(
' ' +
(isLarge ? chalk.yellow(sizeLabel) : sizeLabel) +
' ' +
chalk.dim(asset.folder + path.sep) +
chalk.cyan(asset.name)
);
});
if (suggestBundleSplitting) {
console.log();
console.log(
chalk.yellow('The bundle size is significantly larger than recommended.')
);
console.log(
chalk.yellow(
'Consider reducing it with code splitting: https://goo.gl/9VhYWB'
)
);
console.log(
chalk.yellow(
'You can also analyze the project dependencies: https://goo.gl/LeUzfb'
)
);
}
} | [
"function",
"printFileSizesAfterBuild",
"(",
"webpackStats",
",",
"previousSizeMap",
",",
"buildFolder",
",",
"maxBundleGzipSize",
",",
"maxChunkGzipSize",
")",
"{",
"var",
"root",
"=",
"previousSizeMap",
".",
"root",
";",
"var",
"sizes",
"=",
"previousSizeMap",
"."... | Prints a detailed summary of build files. | [
"Prints",
"a",
"detailed",
"summary",
"of",
"build",
"files",
"."
] | 57ef103440c24e41b0d7dc82b7ad7fc1dc817eca | https://github.com/facebook/create-react-app/blob/57ef103440c24e41b0d7dc82b7ad7fc1dc817eca/packages/react-dev-utils/FileSizeReporter.js#L27-L104 | train | Print file sizes after build | [
30522,
3853,
6140,
8873,
4244,
10057,
10354,
3334,
8569,
4014,
2094,
1006,
4773,
23947,
9153,
3215,
1010,
3025,
5332,
4371,
2863,
2361,
1010,
3857,
10371,
2121,
1010,
4098,
27265,
23115,
5831,
4523,
4697,
1010,
4098,
20760,
8950,
2290,
5831... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
openlayers/openlayers | examples/vector-labels.js | pointStyleFunction | function pointStyleFunction(feature, resolution) {
return new Style({
image: new CircleStyle({
radius: 10,
fill: new Fill({color: 'rgba(255, 0, 0, 0.1)'}),
stroke: new Stroke({color: 'red', width: 1})
}),
text: createTextStyle(feature, resolution, myDom.points)
});
} | javascript | function pointStyleFunction(feature, resolution) {
return new Style({
image: new CircleStyle({
radius: 10,
fill: new Fill({color: 'rgba(255, 0, 0, 0.1)'}),
stroke: new Stroke({color: 'red', width: 1})
}),
text: createTextStyle(feature, resolution, myDom.points)
});
} | [
"function",
"pointStyleFunction",
"(",
"feature",
",",
"resolution",
")",
"{",
"return",
"new",
"Style",
"(",
"{",
"image",
":",
"new",
"CircleStyle",
"(",
"{",
"radius",
":",
"10",
",",
"fill",
":",
"new",
"Fill",
"(",
"{",
"color",
":",
"'rgba(255, 0, ... | Points | [
"Points"
] | f366eaea522388fb575b11010e69d309164baca7 | https://github.com/openlayers/openlayers/blob/f366eaea522388fb575b11010e69d309164baca7/examples/vector-labels.js#L171-L180 | train | Creates a style object for a point feature | [
30522,
3853,
2685,
27983,
11263,
27989,
1006,
3444,
1010,
5813,
1007,
1063,
2709,
2047,
2806,
1006,
1063,
3746,
1024,
2047,
7925,
27983,
1006,
1063,
12177,
1024,
2184,
1010,
6039,
1024,
2047,
6039,
1006,
1063,
3609,
1024,
1005,
1054,
18259,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/support/controls/InteractionTree.js | initializePopOverSapStatisticsData | function initializePopOverSapStatisticsData() {
var $element = jQuery(this);
var $requestLi = $element.parents('li[data-request-index]');
var $interactionLi = $element.parents('li[data-interaction-index]');
var interactionIndex = parseInt($interactionLi.attr('data-interaction-index'));
var requestIndex = parseInt($requestLi.attr('data-request-index'));
var interaction = that.interactions[interactionIndex];
var request = interaction.requests[requestIndex];
if (!interaction || !request) {
return;
}
var sapStatistic = that.getRequestSapStatistics(interaction, request);
if (sapStatistic) {
if (!statisticsTitle.getParent()) {
simpleForm.addContent(statisticsTitle);
simpleForm.addContent(totalLabel);
simpleForm.addContent(totalText);
simpleForm.addContent(fwLabel);
simpleForm.addContent(fwText);
simpleForm.addContent(appLabel);
simpleForm.addContent(appText);
}
var statistics = sapStatistic.statistics;
totalText.setText(that.formatDuration(parseFloat(statistics.substring(statistics.indexOf("total=") + "total=".length, statistics.indexOf(",")))));
statistics = statistics.substring(statistics.indexOf(",") + 1);
fwText.setText(that.formatDuration(parseFloat(statistics.substring(statistics.indexOf("fw=") + "fw=".length, statistics.indexOf(",")))));
statistics = statistics.substring(statistics.indexOf(",") + 1);
appText.setText(that.formatDuration(parseFloat(statistics.substring(statistics.indexOf("app=") + "app=".length, statistics.indexOf(",")))));
} else if (statisticsTitle.getParent()) {
simpleForm.removeContent(statisticsTitle);
simpleForm.removeContent(totalLabel);
simpleForm.removeContent(totalText);
simpleForm.removeContent(fwLabel);
simpleForm.removeContent(fwText);
simpleForm.removeContent(appLabel);
simpleForm.removeContent(appText);
}
} | javascript | function initializePopOverSapStatisticsData() {
var $element = jQuery(this);
var $requestLi = $element.parents('li[data-request-index]');
var $interactionLi = $element.parents('li[data-interaction-index]');
var interactionIndex = parseInt($interactionLi.attr('data-interaction-index'));
var requestIndex = parseInt($requestLi.attr('data-request-index'));
var interaction = that.interactions[interactionIndex];
var request = interaction.requests[requestIndex];
if (!interaction || !request) {
return;
}
var sapStatistic = that.getRequestSapStatistics(interaction, request);
if (sapStatistic) {
if (!statisticsTitle.getParent()) {
simpleForm.addContent(statisticsTitle);
simpleForm.addContent(totalLabel);
simpleForm.addContent(totalText);
simpleForm.addContent(fwLabel);
simpleForm.addContent(fwText);
simpleForm.addContent(appLabel);
simpleForm.addContent(appText);
}
var statistics = sapStatistic.statistics;
totalText.setText(that.formatDuration(parseFloat(statistics.substring(statistics.indexOf("total=") + "total=".length, statistics.indexOf(",")))));
statistics = statistics.substring(statistics.indexOf(",") + 1);
fwText.setText(that.formatDuration(parseFloat(statistics.substring(statistics.indexOf("fw=") + "fw=".length, statistics.indexOf(",")))));
statistics = statistics.substring(statistics.indexOf(",") + 1);
appText.setText(that.formatDuration(parseFloat(statistics.substring(statistics.indexOf("app=") + "app=".length, statistics.indexOf(",")))));
} else if (statisticsTitle.getParent()) {
simpleForm.removeContent(statisticsTitle);
simpleForm.removeContent(totalLabel);
simpleForm.removeContent(totalText);
simpleForm.removeContent(fwLabel);
simpleForm.removeContent(fwText);
simpleForm.removeContent(appLabel);
simpleForm.removeContent(appText);
}
} | [
"function",
"initializePopOverSapStatisticsData",
"(",
")",
"{",
"var",
"$element",
"=",
"jQuery",
"(",
"this",
")",
";",
"var",
"$requestLi",
"=",
"$element",
".",
"parents",
"(",
"'li[data-request-index]'",
")",
";",
"var",
"$interactionLi",
"=",
"$element",
"... | /* eslint-enable no-loop-func | [
"/",
"*",
"eslint",
"-",
"enable",
"no",
"-",
"loop",
"-",
"func"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/support/controls/InteractionTree.js#L554-L600 | train | Initializes the statistics data for the popover | [
30522,
3853,
3988,
4697,
16340,
24302,
9331,
9153,
16774,
6558,
2850,
2696,
1006,
1007,
1063,
13075,
1002,
5783,
1027,
1046,
4226,
2854,
1006,
2023,
1007,
1025,
13075,
1002,
5227,
3669,
1027,
1002,
5783,
1012,
3008,
1006,
1005,
5622,
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... |
SheetJS/js-xlsx | xlsx.js | parse_Font | function parse_Font(blob, length, opts) {
var o = {
dyHeight: blob.read_shift(2),
fl: blob.read_shift(2)
};
switch((opts && opts.biff) || 8) {
case 2: break;
case 3: case 4: blob.l += 2; break;
default: blob.l += 10; break;
}
o.name = parse_ShortXLUnicodeString(blob, 0, opts);
return o;
} | javascript | function parse_Font(blob, length, opts) {
var o = {
dyHeight: blob.read_shift(2),
fl: blob.read_shift(2)
};
switch((opts && opts.biff) || 8) {
case 2: break;
case 3: case 4: blob.l += 2; break;
default: blob.l += 10; break;
}
o.name = parse_ShortXLUnicodeString(blob, 0, opts);
return o;
} | [
"function",
"parse_Font",
"(",
"blob",
",",
"length",
",",
"opts",
")",
"{",
"var",
"o",
"=",
"{",
"dyHeight",
":",
"blob",
".",
"read_shift",
"(",
"2",
")",
",",
"fl",
":",
"blob",
".",
"read_shift",
"(",
"2",
")",
"}",
";",
"switch",
"(",
"(",
... | /* [MS-XLS] 2.4.122 TODO | [
"/",
"*",
"[",
"MS",
"-",
"XLS",
"]",
"2",
".",
"4",
".",
"122",
"TODO"
] | 9a6d8a1d3d80c78dad5201fb389316f935279cdc | https://github.com/SheetJS/js-xlsx/blob/9a6d8a1d3d80c78dad5201fb389316f935279cdc/xlsx.js#L5938-L5950 | train | Parse a font | [
30522,
3853,
11968,
3366,
1035,
15489,
1006,
1038,
4135,
2497,
1010,
3091,
1010,
23569,
2015,
1007,
1063,
13075,
1051,
1027,
1063,
1040,
2100,
26036,
13900,
1024,
1038,
4135,
2497,
1012,
3191,
1035,
5670,
1006,
1016,
1007,
1010,
13109,
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... |
ccxt/ccxt | build/transpile.js | overwriteFile | function overwriteFile (filename, contents) {
// log.cyan ('Overwriting → ' + filename.yellow)
fs.closeSync (fs.openSync (filename, 'a'));
fs.truncateSync (filename)
fs.writeFileSync (filename, contents)
} | javascript | function overwriteFile (filename, contents) {
// log.cyan ('Overwriting → ' + filename.yellow)
fs.closeSync (fs.openSync (filename, 'a'));
fs.truncateSync (filename)
fs.writeFileSync (filename, contents)
} | [
"function",
"overwriteFile",
"(",
"filename",
",",
"contents",
")",
"{",
"// log.cyan ('Overwriting → ' + filename.yellow)",
"fs",
".",
"closeSync",
"(",
"fs",
".",
"openSync",
"(",
"filename",
",",
"'a'",
")",
")",
";",
"fs",
".",
"truncateSync",
"(",
"filename... | ----------------------------------------------------------------------------- | [
"-----------------------------------------------------------------------------"
] | 8168069b9180a465532905e225586215e115a565 | https://github.com/ccxt/ccxt/blob/8168069b9180a465532905e225586215e115a565/build/transpile.js#L758-L763 | train | overwrite file with contents | [
30522,
3853,
2058,
26373,
8873,
2571,
1006,
5371,
18442,
1010,
8417,
1007,
1063,
1013,
1013,
8833,
1012,
22330,
2319,
1006,
1005,
2058,
18560,
1585,
1005,
1009,
5371,
18442,
1012,
3756,
30524,
1037,
1005,
1007,
1007,
1025,
1042,
2015,
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... |
grpc/grpc-node | packages/grpc-native-core/src/client_interceptors.js | _startBatchIfReady | function _startBatchIfReady(call, batch, batch_state, callback) {
var completed_ops = batch_state.completed_ops;
var deferred_batches = batch_state.deferred_batches;
var batch_ops = Object.keys(batch).map(Number);
if (_areBatchRequirementsMet(batch_ops, completed_ops)) {
// Dependencies are met, start the batch and any deferred batches whose
// dependencies are met as a result.
call.startBatch(batch, callback);
completed_ops = Array.from(new Set(completed_ops.concat(batch_ops)));
deferred_batches = common.flatMap(deferred_batches, function(deferred_batch) {
var deferred_batch_ops = Object.keys(deferred_batch).map(Number);
if (_areBatchRequirementsMet(deferred_batch_ops, completed_ops)) {
call.startBatch(deferred_batch.batch, deferred_batch.callback);
return [];
}
return [deferred_batch];
});
} else {
// Dependencies are not met, defer the batch
deferred_batches = deferred_batches.concat({
batch: batch,
callback: callback
});
}
return {
completed_ops: completed_ops,
deferred_batches: deferred_batches
};
} | javascript | function _startBatchIfReady(call, batch, batch_state, callback) {
var completed_ops = batch_state.completed_ops;
var deferred_batches = batch_state.deferred_batches;
var batch_ops = Object.keys(batch).map(Number);
if (_areBatchRequirementsMet(batch_ops, completed_ops)) {
// Dependencies are met, start the batch and any deferred batches whose
// dependencies are met as a result.
call.startBatch(batch, callback);
completed_ops = Array.from(new Set(completed_ops.concat(batch_ops)));
deferred_batches = common.flatMap(deferred_batches, function(deferred_batch) {
var deferred_batch_ops = Object.keys(deferred_batch).map(Number);
if (_areBatchRequirementsMet(deferred_batch_ops, completed_ops)) {
call.startBatch(deferred_batch.batch, deferred_batch.callback);
return [];
}
return [deferred_batch];
});
} else {
// Dependencies are not met, defer the batch
deferred_batches = deferred_batches.concat({
batch: batch,
callback: callback
});
}
return {
completed_ops: completed_ops,
deferred_batches: deferred_batches
};
} | [
"function",
"_startBatchIfReady",
"(",
"call",
",",
"batch",
",",
"batch_state",
",",
"callback",
")",
"{",
"var",
"completed_ops",
"=",
"batch_state",
".",
"completed_ops",
";",
"var",
"deferred_batches",
"=",
"batch_state",
".",
"deferred_batches",
";",
"var",
... | Enforces the order of operations for synchronous requests. If a batch's
operations cannot be started because required operations have not started
yet, the batch is deferred until requirements are met.
@private
@param {grpc.Client~Call} call
@param {object} batch
@param {object} batch_state
@param {number[]} [batch_state.completed_ops] The ops already sent.
@param {object} [batch_state.deferred_batches] Batches to be sent after
their dependencies are fulfilled.
@param {function} callback
@return {object} | [
"Enforces",
"the",
"order",
"of",
"operations",
"for",
"synchronous",
"requests",
".",
"If",
"a",
"batch",
"s",
"operations",
"cannot",
"be",
"started",
"because",
"required",
"operations",
"have",
"not",
"started",
"yet",
"the",
"batch",
"is",
"deferred",
"un... | b36b285f4cdb334bbd48f74c12c13bec69961488 | https://github.com/grpc/grpc-node/blob/b36b285f4cdb334bbd48f74c12c13bec69961488/packages/grpc-native-core/src/client_interceptors.js#L745-L773 | train | Starts the batch if the batch requirements are met | [
30522,
3853,
1035,
2707,
14479,
5428,
19699,
13775,
2100,
1006,
2655,
1010,
14108,
1010,
14108,
1035,
2110,
1010,
2655,
5963,
1007,
1063,
13075,
2949,
1035,
23092,
1027,
14108,
1035,
2110,
1012,
2949,
1035,
23092,
1025,
13075,
13366,
28849,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
angular/material | src/components/select/select.js | showBackdrop | function showBackdrop(scope, element, options) {
// If we are not within a dialog...
if (options.disableParentScroll && !$mdUtil.getClosest(options.target, 'MD-DIALOG')) {
// !! DO this before creating the backdrop; since disableScrollAround()
// configures the scroll offset; which is used by mdBackDrop postLink()
options.restoreScroll = $mdUtil.disableScrollAround(options.element, options.parent);
} else {
options.disableParentScroll = false;
}
if (options.hasBackdrop) {
// Override duration to immediately show invisible backdrop
options.backdrop = $mdUtil.createBackdrop(scope, "md-select-backdrop md-click-catcher");
$animate.enter(options.backdrop, $document[0].body, null, {duration: 0});
}
/**
* Hide modal backdrop element...
*/
return function hideBackdrop() {
if (options.backdrop) options.backdrop.remove();
if (options.disableParentScroll) options.restoreScroll();
delete options.restoreScroll;
};
} | javascript | function showBackdrop(scope, element, options) {
// If we are not within a dialog...
if (options.disableParentScroll && !$mdUtil.getClosest(options.target, 'MD-DIALOG')) {
// !! DO this before creating the backdrop; since disableScrollAround()
// configures the scroll offset; which is used by mdBackDrop postLink()
options.restoreScroll = $mdUtil.disableScrollAround(options.element, options.parent);
} else {
options.disableParentScroll = false;
}
if (options.hasBackdrop) {
// Override duration to immediately show invisible backdrop
options.backdrop = $mdUtil.createBackdrop(scope, "md-select-backdrop md-click-catcher");
$animate.enter(options.backdrop, $document[0].body, null, {duration: 0});
}
/**
* Hide modal backdrop element...
*/
return function hideBackdrop() {
if (options.backdrop) options.backdrop.remove();
if (options.disableParentScroll) options.restoreScroll();
delete options.restoreScroll;
};
} | [
"function",
"showBackdrop",
"(",
"scope",
",",
"element",
",",
"options",
")",
"{",
"// If we are not within a dialog...",
"if",
"(",
"options",
".",
"disableParentScroll",
"&&",
"!",
"$mdUtil",
".",
"getClosest",
"(",
"options",
".",
"target",
",",
"'MD-DIALOG'",... | Show modal backdrop element... | [
"Show",
"modal",
"backdrop",
"element",
"..."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/select/select.js#L1360-L1386 | train | Show the modal backdrop | [
30522,
3853,
2265,
5963,
25711,
1006,
9531,
1010,
5783,
1010,
7047,
1007,
1063,
1013,
1013,
2065,
2057,
2024,
2025,
2306,
1037,
13764,
8649,
1012,
1012,
1012,
2065,
1006,
7047,
1012,
4487,
19150,
19362,
11187,
26775,
14511,
1004,
1004,
999,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
google/draco | docs/assets/js/ASCIIMathML.js | initSymbols | function initSymbols() {
var i;
var symlen = AMsymbols.length;
for (i=0; i<symlen; i++) {
if (AMsymbols[i].tex) {
AMsymbols.push({input:AMsymbols[i].tex,
tag:AMsymbols[i].tag, output:AMsymbols[i].output, ttype:AMsymbols[i].ttype,
acc:(AMsymbols[i].acc||false)});
}
}
refreshSymbols();
} | javascript | function initSymbols() {
var i;
var symlen = AMsymbols.length;
for (i=0; i<symlen; i++) {
if (AMsymbols[i].tex) {
AMsymbols.push({input:AMsymbols[i].tex,
tag:AMsymbols[i].tag, output:AMsymbols[i].output, ttype:AMsymbols[i].ttype,
acc:(AMsymbols[i].acc||false)});
}
}
refreshSymbols();
} | [
"function",
"initSymbols",
"(",
")",
"{",
"var",
"i",
";",
"var",
"symlen",
"=",
"AMsymbols",
".",
"length",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"symlen",
";",
"i",
"++",
")",
"{",
"if",
"(",
"AMsymbols",
"[",
"i",
"]",
".",
"tex",
... | list of input symbols | [
"list",
"of",
"input",
"symbols"
] | 785c9c4aa2b952236c29ad639901dbbaf216da38 | https://github.com/google/draco/blob/785c9c4aa2b952236c29ad639901dbbaf216da38/docs/assets/js/ASCIIMathML.js#L475-L486 | train | init AMsymbols | [
30522,
3853,
1999,
12762,
24335,
14956,
2015,
1006,
1007,
1063,
13075,
1045,
1025,
13075,
25353,
19968,
2368,
1027,
2572,
6508,
13344,
4877,
1012,
3091,
1025,
2005,
1006,
1045,
1027,
1014,
1025,
1045,
1026,
25353,
19968,
2368,
1025,
1045,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
BlackrockDigital/startbootstrap-sb-admin-2 | vendor/chart.js/Chart.js | function(tickValue, index, ticks) {
// If we have lots of ticks, don't use the ones
var delta = ticks.length > 3 ? ticks[2] - ticks[1] : ticks[1] - ticks[0];
// If we have a number like 2.5 as the delta, figure out how many decimal places we need
if (Math.abs(delta) > 1) {
if (tickValue !== Math.floor(tickValue)) {
// not an integer
delta = tickValue - Math.floor(tickValue);
}
}
var logDelta = helpers$1.log10(Math.abs(delta));
var tickString = '';
if (tickValue !== 0) {
var maxTick = Math.max(Math.abs(ticks[0]), Math.abs(ticks[ticks.length - 1]));
if (maxTick < 1e-4) { // all ticks are small numbers; use scientific notation
var logTick = helpers$1.log10(Math.abs(tickValue));
tickString = tickValue.toExponential(Math.floor(logTick) - Math.floor(logDelta));
} else {
var numDecimal = -1 * Math.floor(logDelta);
numDecimal = Math.max(Math.min(numDecimal, 20), 0); // toFixed has a max of 20 decimal places
tickString = tickValue.toFixed(numDecimal);
}
} else {
tickString = '0'; // never show decimal places for 0
}
return tickString;
} | javascript | function(tickValue, index, ticks) {
// If we have lots of ticks, don't use the ones
var delta = ticks.length > 3 ? ticks[2] - ticks[1] : ticks[1] - ticks[0];
// If we have a number like 2.5 as the delta, figure out how many decimal places we need
if (Math.abs(delta) > 1) {
if (tickValue !== Math.floor(tickValue)) {
// not an integer
delta = tickValue - Math.floor(tickValue);
}
}
var logDelta = helpers$1.log10(Math.abs(delta));
var tickString = '';
if (tickValue !== 0) {
var maxTick = Math.max(Math.abs(ticks[0]), Math.abs(ticks[ticks.length - 1]));
if (maxTick < 1e-4) { // all ticks are small numbers; use scientific notation
var logTick = helpers$1.log10(Math.abs(tickValue));
tickString = tickValue.toExponential(Math.floor(logTick) - Math.floor(logDelta));
} else {
var numDecimal = -1 * Math.floor(logDelta);
numDecimal = Math.max(Math.min(numDecimal, 20), 0); // toFixed has a max of 20 decimal places
tickString = tickValue.toFixed(numDecimal);
}
} else {
tickString = '0'; // never show decimal places for 0
}
return tickString;
} | [
"function",
"(",
"tickValue",
",",
"index",
",",
"ticks",
")",
"{",
"// If we have lots of ticks, don't use the ones",
"var",
"delta",
"=",
"ticks",
".",
"length",
">",
"3",
"?",
"ticks",
"[",
"2",
"]",
"-",
"ticks",
"[",
"1",
"]",
":",
"ticks",
"[",
"1"... | Formatter for linear numeric ticks
@method Chart.Ticks.formatters.linear
@param tickValue {number} the value to be formatted
@param index {number} the position of the tickValue parameter in the ticks array
@param ticks {number[]} the list of ticks being converted
@return {string} string representation of the tickValue parameter | [
"Formatter",
"for",
"linear",
"numeric",
"ticks"
] | ddfaceb4a8e65a41f163e2fdc4eab49384b810a1 | https://github.com/BlackrockDigital/startbootstrap-sb-admin-2/blob/ddfaceb4a8e65a41f163e2fdc4eab49384b810a1/vendor/chart.js/Chart.js#L10087-L10117 | train | Calculate the string representation of a tick | [
30522,
3853,
1006,
16356,
10175,
5657,
1010,
5950,
1010,
16356,
2015,
1007,
1063,
1013,
1013,
2065,
2057,
2031,
7167,
1997,
16356,
2015,
1010,
2123,
1005,
1056,
2224,
1996,
3924,
13075,
7160,
1027,
16356,
2015,
1012,
3091,
1028,
1017,
1029,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | src/sap.ui.layout/src/sap/ui/layout/form/FormElement.js | _updateLabelFor | function _updateLabelFor(){
var aFields = this.getFields();
var oField = aFields.length > 0 ? aFields[0] : null;
var oLabel = this._oLabel;
if (oLabel) {
oLabel.setLabelFor(oField); // as Label is internal of FormElement, we can use original labelFor
} else {
oLabel = this.getLabel();
if (oLabel instanceof Control /*might also be a string*/) {
oLabel.setAlternativeLabelFor(oField);
}
}
} | javascript | function _updateLabelFor(){
var aFields = this.getFields();
var oField = aFields.length > 0 ? aFields[0] : null;
var oLabel = this._oLabel;
if (oLabel) {
oLabel.setLabelFor(oField); // as Label is internal of FormElement, we can use original labelFor
} else {
oLabel = this.getLabel();
if (oLabel instanceof Control /*might also be a string*/) {
oLabel.setAlternativeLabelFor(oField);
}
}
} | [
"function",
"_updateLabelFor",
"(",
")",
"{",
"var",
"aFields",
"=",
"this",
".",
"getFields",
"(",
")",
";",
"var",
"oField",
"=",
"aFields",
".",
"length",
">",
"0",
"?",
"aFields",
"[",
"0",
"]",
":",
"null",
";",
"var",
"oLabel",
"=",
"this",
"... | /*
Update the for association of the related label | [
"/",
"*",
"Update",
"the",
"for",
"association",
"of",
"the",
"related",
"label"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.layout/src/sap/ui/layout/form/FormElement.js#L449-L462 | train | Updates the label for the given field | [
30522,
3853,
1035,
10651,
20470,
2884,
29278,
1006,
30524,
1012,
2131,
15155,
1006,
1007,
1025,
13075,
1997,
12891,
1027,
28697,
14273,
2015,
1012,
3091,
1028,
1014,
1029,
28697,
14273,
2015,
1031,
1014,
1033,
1024,
19701,
1025,
13075,
19330,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | examples/radio/radio.js | function() {
var self = this;
// Get the Howl we want to manipulate.
var sound = self.stations[self.index].howl;
// Toggle the display.
self.toggleStationDisplay(self.index, false);
// Stop the sound.
if (sound) {
sound.unload();
}
} | javascript | function() {
var self = this;
// Get the Howl we want to manipulate.
var sound = self.stations[self.index].howl;
// Toggle the display.
self.toggleStationDisplay(self.index, false);
// Stop the sound.
if (sound) {
sound.unload();
}
} | [
"function",
"(",
")",
"{",
"var",
"self",
"=",
"this",
";",
"// Get the Howl we want to manipulate.",
"var",
"sound",
"=",
"self",
".",
"stations",
"[",
"self",
".",
"index",
"]",
".",
"howl",
";",
"// Toggle the display.",
"self",
".",
"toggleStationDisplay",
... | Stop a station's live stream. | [
"Stop",
"a",
"station",
"s",
"live",
"stream",
"."
] | 030db918dd8ce640afd57e172418472497e8f113 | https://github.com/goldfire/howler.js/blob/030db918dd8ce640afd57e172418472497e8f113/examples/radio/radio.js#L81-L94 | train | Unload the station sound | [
30522,
3853,
1006,
1007,
1063,
13075,
2969,
1027,
2023,
1025,
1013,
1013,
2131,
1996,
22912,
2057,
2215,
2000,
17708,
1012,
13075,
2614,
1027,
2969,
1012,
3703,
1031,
2969,
1012,
5950,
1033,
1012,
22912,
1025,
1013,
1013,
2000,
24679,
1996,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/downloads.js | downloadManager_waitForDownloadState | function downloadManager_waitForDownloadState(download, state, timeout) {
this._controller.waitForEval("subject.manager.getDownloadState(subject.download) == subject.state", timeout, 100,
{manager: this, download: download, state: state});
} | javascript | function downloadManager_waitForDownloadState(download, state, timeout) {
this._controller.waitForEval("subject.manager.getDownloadState(subject.download) == subject.state", timeout, 100,
{manager: this, download: download, state: state});
} | [
"function",
"downloadManager_waitForDownloadState",
"(",
"download",
",",
"state",
",",
"timeout",
")",
"{",
"this",
".",
"_controller",
".",
"waitForEval",
"(",
"\"subject.manager.getDownloadState(subject.download) == subject.state\"",
",",
"timeout",
",",
"100",
",",
"{... | Wait for the given download state
@param {MozMillController} controller
MozMillController of the window to operate on
@param {downloadState} state
Expected state of the download
@param {number} timeout
Timeout for waiting for the download state (optional) | [
"Wait",
"for",
"the",
"given",
"download",
"state"
] | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/downloads.js#L329-L332 | train | Wait until the download state is in the given state | [
30522,
3853,
8816,
24805,
4590,
1035,
3524,
3877,
12384,
11066,
9153,
2618,
1006,
8816,
1010,
2110,
1010,
2051,
5833,
1007,
1063,
2023,
1012,
1035,
11486,
1012,
3524,
29278,
13331,
2140,
1006,
1000,
3395,
1012,
3208,
1012,
2131,
7698,
11066... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/LiveDevelopment.js | open | function open(restart) {
// If close() is still pending, wait for close to finish before opening
if (_isPromisePending(_closeDeferred)) {
return _closeDeferred.then(function () {
return open(restart);
});
}
if (!restart) {
// Return existing promise if it is still pending
if (_isPromisePending(_openDeferred)) {
return _openDeferred;
} else {
_openDeferred = new $.Deferred();
_openDeferred.always(function () {
_openDeferred = null;
});
}
}
// Send analytics data when Live Preview is opened
HealthLogger.sendAnalyticsData(
"livePreviewOpen",
"usage",
"livePreview",
"open"
);
// Register user defined server provider and keep handlers for further clean-up
_regServers.push(LiveDevServerManager.registerServer({ create: _createUserServer }, 99));
_regServers.push(LiveDevServerManager.registerServer({ create: _createFileServer }, 0));
// TODO: need to run _onFileChanged() after load if doc != currentDocument here? Maybe not, since activeEditorChange
// doesn't trigger it, while inline editors can still cause edits in doc other than currentDoc...
_getInitialDocFromCurrent().done(function (doc) {
var prepareServerPromise = (doc && _prepareServer(doc)) || new $.Deferred().reject(),
otherDocumentsInWorkingFiles;
if (doc && !doc._masterEditor) {
otherDocumentsInWorkingFiles = MainViewManager.getWorkingSet(MainViewManager.ALL_PANES).length;
MainViewManager.addToWorkingSet(MainViewManager.ACTIVE_PANE, doc.file);
if (!otherDocumentsInWorkingFiles) {
MainViewManager._edit(MainViewManager.ACTIVE_PANE, doc);
}
}
// wait for server (StaticServer, Base URL or file:)
prepareServerPromise
.done(function () {
var reverseInspectPref = PreferencesManager.get("livedev.enableReverseInspect"),
wsPort = PreferencesManager.get("livedev.wsPort");
if (wsPort && reverseInspectPref) {
WebSocketTransport.createWebSocketServer(wsPort);
}
_doLaunchAfterServerReady(doc);
})
.fail(function () {
_showWrongDocError();
});
});
return _openDeferred.promise();
} | javascript | function open(restart) {
// If close() is still pending, wait for close to finish before opening
if (_isPromisePending(_closeDeferred)) {
return _closeDeferred.then(function () {
return open(restart);
});
}
if (!restart) {
// Return existing promise if it is still pending
if (_isPromisePending(_openDeferred)) {
return _openDeferred;
} else {
_openDeferred = new $.Deferred();
_openDeferred.always(function () {
_openDeferred = null;
});
}
}
// Send analytics data when Live Preview is opened
HealthLogger.sendAnalyticsData(
"livePreviewOpen",
"usage",
"livePreview",
"open"
);
// Register user defined server provider and keep handlers for further clean-up
_regServers.push(LiveDevServerManager.registerServer({ create: _createUserServer }, 99));
_regServers.push(LiveDevServerManager.registerServer({ create: _createFileServer }, 0));
// TODO: need to run _onFileChanged() after load if doc != currentDocument here? Maybe not, since activeEditorChange
// doesn't trigger it, while inline editors can still cause edits in doc other than currentDoc...
_getInitialDocFromCurrent().done(function (doc) {
var prepareServerPromise = (doc && _prepareServer(doc)) || new $.Deferred().reject(),
otherDocumentsInWorkingFiles;
if (doc && !doc._masterEditor) {
otherDocumentsInWorkingFiles = MainViewManager.getWorkingSet(MainViewManager.ALL_PANES).length;
MainViewManager.addToWorkingSet(MainViewManager.ACTIVE_PANE, doc.file);
if (!otherDocumentsInWorkingFiles) {
MainViewManager._edit(MainViewManager.ACTIVE_PANE, doc);
}
}
// wait for server (StaticServer, Base URL or file:)
prepareServerPromise
.done(function () {
var reverseInspectPref = PreferencesManager.get("livedev.enableReverseInspect"),
wsPort = PreferencesManager.get("livedev.wsPort");
if (wsPort && reverseInspectPref) {
WebSocketTransport.createWebSocketServer(wsPort);
}
_doLaunchAfterServerReady(doc);
})
.fail(function () {
_showWrongDocError();
});
});
return _openDeferred.promise();
} | [
"function",
"open",
"(",
"restart",
")",
"{",
"// If close() is still pending, wait for close to finish before opening",
"if",
"(",
"_isPromisePending",
"(",
"_closeDeferred",
")",
")",
"{",
"return",
"_closeDeferred",
".",
"then",
"(",
"function",
"(",
")",
"{",
"ret... | Open the Connection and go live
@param {!boolean} restart true if relaunching and _openDeferred already exists
@return {jQuery.Promise} Resolves once live preview is open | [
"Open",
"the",
"Connection",
"and",
"go",
"live"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/LiveDevelopment/LiveDevelopment.js#L1335-L1398 | train | Open Live Preview | [
30522,
3853,
2330,
1006,
23818,
1007,
1063,
1013,
1013,
2065,
2485,
1006,
1007,
2003,
2145,
14223,
1010,
3524,
2005,
2485,
2000,
3926,
2077,
3098,
2065,
1006,
1035,
2003,
21572,
28732,
11837,
4667,
1006,
1035,
2701,
27235,
20529,
1007,
1007... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/base/ManagedObject.js | update | function update(oControl, aContexts, fnBefore, fnAfter) {
var aChildren = oControl[oAggregationInfo._sGetter]() || [],
oContext,
oClone;
if (aChildren.length > aContexts.length) {
for (var i = aContexts.length; i < aChildren.length; i++) {
oClone = aChildren[i];
oControl[oAggregationInfo._sRemoveMutator](oClone);
oClone.destroy("KeepDom");
}
}
for (var i = 0; i < aContexts.length; i++) {
oContext = aContexts[i];
oClone = aChildren[i];
if (fnBefore) {
fnBefore(oContext);
}
if (oClone) {
oClone.setBindingContext(oContext, oBindingInfo.model);
} else {
oClone = fnFactory(getIdSuffix(oControl, i), oContext);
oClone.setBindingContext(oContext, oBindingInfo.model);
oControl[oAggregationInfo._sMutator](oClone);
}
if (fnAfter) {
fnAfter(oContext, oClone);
}
}
} | javascript | function update(oControl, aContexts, fnBefore, fnAfter) {
var aChildren = oControl[oAggregationInfo._sGetter]() || [],
oContext,
oClone;
if (aChildren.length > aContexts.length) {
for (var i = aContexts.length; i < aChildren.length; i++) {
oClone = aChildren[i];
oControl[oAggregationInfo._sRemoveMutator](oClone);
oClone.destroy("KeepDom");
}
}
for (var i = 0; i < aContexts.length; i++) {
oContext = aContexts[i];
oClone = aChildren[i];
if (fnBefore) {
fnBefore(oContext);
}
if (oClone) {
oClone.setBindingContext(oContext, oBindingInfo.model);
} else {
oClone = fnFactory(getIdSuffix(oControl, i), oContext);
oClone.setBindingContext(oContext, oBindingInfo.model);
oControl[oAggregationInfo._sMutator](oClone);
}
if (fnAfter) {
fnAfter(oContext, oClone);
}
}
} | [
"function",
"update",
"(",
"oControl",
",",
"aContexts",
",",
"fnBefore",
",",
"fnAfter",
")",
"{",
"var",
"aChildren",
"=",
"oControl",
"[",
"oAggregationInfo",
".",
"_sGetter",
"]",
"(",
")",
"||",
"[",
"]",
",",
"oContext",
",",
"oClone",
";",
"if",
... | Update a single aggregation with the array of contexts. Reuse existing children and just append or remove at the end, if some are missing or too many. | [
"Update",
"a",
"single",
"aggregation",
"with",
"the",
"array",
"of",
"contexts",
".",
"Reuse",
"existing",
"children",
"and",
"just",
"append",
"or",
"remove",
"at",
"the",
"end",
"if",
"some",
"are",
"missing",
"or",
"too",
"many",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/base/ManagedObject.js#L3970-L3998 | train | Updates the binding context of the control | [
30522,
3853,
10651,
1006,
1051,
8663,
13181,
2140,
1010,
9353,
28040,
18413,
2015,
1010,
1042,
27698,
12879,
5686,
1010,
1042,
2532,
6199,
2121,
1007,
1063,
13075,
9353,
19466,
16200,
2078,
1027,
1051,
8663,
13181,
2140,
1031,
1051,
8490,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/extensions/default/NavigationAndHistory/main.js | _makeMROFListEntry | function _makeMROFListEntry(path, pane, cursorPos) {
return {
file: path,
paneId: pane,
cursor: cursorPos
};
} | javascript | function _makeMROFListEntry(path, pane, cursorPos) {
return {
file: path,
paneId: pane,
cursor: cursorPos
};
} | [
"function",
"_makeMROFListEntry",
"(",
"path",
",",
"pane",
",",
"cursorPos",
")",
"{",
"return",
"{",
"file",
":",
"path",
",",
"paneId",
":",
"pane",
",",
"cursor",
":",
"cursorPos",
"}",
";",
"}"
] | Creates an entry for MROF list
@private
@param {String} path - full path of a doc
@param {String} pane - the pane holding the editor for the doc
@param {Object} cursorPos - current cursor position
@return {Object} a frame containing file path, pane and last known cursor | [
"Creates",
"an",
"entry",
"for",
"MROF",
"list"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/NavigationAndHistory/main.js#L139-L145 | train | make MROFListEntry - make an entry for a MROF | [
30522,
3853,
1035,
2191,
2213,
3217,
10258,
27870,
3372,
2854,
1006,
4130,
1010,
6090,
2063,
1010,
12731,
25301,
14536,
2891,
1007,
1063,
2709,
1063,
5371,
1024,
4130,
1010,
6090,
7416,
2094,
1024,
6090,
2063,
1010,
12731,
25301,
2099,
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... |
aws/aws-sdk-js | lib/resource_waiter.js | loadWaiterConfig | function loadWaiterConfig(state) {
if (!this.service.api.waiters[state]) {
throw new AWS.util.error(new Error(), {
code: 'StateNotFoundError',
message: 'State ' + state + ' not found.'
});
}
this.config = AWS.util.copy(this.service.api.waiters[state]);
} | javascript | function loadWaiterConfig(state) {
if (!this.service.api.waiters[state]) {
throw new AWS.util.error(new Error(), {
code: 'StateNotFoundError',
message: 'State ' + state + ' not found.'
});
}
this.config = AWS.util.copy(this.service.api.waiters[state]);
} | [
"function",
"loadWaiterConfig",
"(",
"state",
")",
"{",
"if",
"(",
"!",
"this",
".",
"service",
".",
"api",
".",
"waiters",
"[",
"state",
"]",
")",
"{",
"throw",
"new",
"AWS",
".",
"util",
".",
"error",
"(",
"new",
"Error",
"(",
")",
",",
"{",
"c... | Loads waiter configuration from API configuration
@api private | [
"Loads",
"waiter",
"configuration",
"from",
"API",
"configuration"
] | c23e5f0edd150f8885267e5f7c8a564f8e6e8562 | https://github.com/aws/aws-sdk-js/blob/c23e5f0edd150f8885267e5f7c8a564f8e6e8562/lib/resource_waiter.js#L194-L203 | train | Load the waiter config for a given state | [
30522,
3853,
7170,
29601,
29566,
2078,
8873,
2290,
1006,
2110,
1007,
1063,
2065,
1006,
999,
2023,
1012,
2326,
1012,
17928,
1012,
15610,
2015,
1031,
2110,
1033,
1007,
1063,
5466,
2047,
22091,
2015,
1012,
21183,
4014,
1012,
7561,
1006,
2047,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | toColourspace | function toColourspace (colourspace) {
if (!is.string(colourspace)) {
throw new Error('Invalid output colourspace ' + colourspace);
}
this.options.colourspace = colourspace;
return this;
} | javascript | function toColourspace (colourspace) {
if (!is.string(colourspace)) {
throw new Error('Invalid output colourspace ' + colourspace);
}
this.options.colourspace = colourspace;
return this;
} | [
"function",
"toColourspace",
"(",
"colourspace",
")",
"{",
"if",
"(",
"!",
"is",
".",
"string",
"(",
"colourspace",
")",
")",
"{",
"throw",
"new",
"Error",
"(",
"'Invalid output colourspace '",
"+",
"colourspace",
")",
";",
"}",
"this",
".",
"options",
"."... | Set the output colourspace.
By default output image will be web-friendly sRGB, with additional channels interpreted as alpha channels.
@param {String} [colourspace] - output colourspace e.g. `srgb`, `rgb`, `cmyk`, `lab`, `b-w` [...](https://github.com/libvips/libvips/blob/master/libvips/iofuncs/enumtypes.c#L568)
@returns {Sharp}
@throws {Error} Invalid parameters | [
"Set",
"the",
"output",
"colourspace",
".",
"By",
"default",
"output",
"image",
"will",
"be",
"web",
"-",
"friendly",
"sRGB",
"with",
"additional",
"channels",
"interpreted",
"as",
"alpha",
"channels",
"."
] | 05d76eeadfe54713606a615185b2da047923406b | https://github.com/lovell/sharp/blob/05d76eeadfe54713606a615185b2da047923406b/lib/colour.js#L64-L70 | train | Convert the colourspace to a colourspace | [
30522,
3853,
2000,
25778,
22957,
15327,
1006,
8604,
15327,
1007,
1063,
2065,
1006,
999,
2003,
1012,
5164,
1006,
8604,
15327,
1007,
1007,
1063,
5466,
2047,
7561,
1006,
1005,
19528,
6434,
8604,
15327,
1005,
1009,
8604,
15327,
1007,
1025,
1065... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/utils/DragAndDrop.js | stopURIListPropagation | function stopURIListPropagation(files, event) {
var types = event.dataTransfer.types;
if ((!files || !files.length) && types) { // We only want to check if a string of text was dragged into the editor
types.forEach(function (value) {
//Dragging text externally (dragging text from another file): types has "text/plain" and "text/html"
//Dragging text internally (dragging text to another line): types has just "text/plain"
//Dragging a file: types has "Files"
//Dragging a url: types has "text/plain" and "text/uri-list" <-what we are interested in
if (value === "text/uri-list") {
event.stopPropagation();
event.preventDefault();
return;
}
});
}
} | javascript | function stopURIListPropagation(files, event) {
var types = event.dataTransfer.types;
if ((!files || !files.length) && types) { // We only want to check if a string of text was dragged into the editor
types.forEach(function (value) {
//Dragging text externally (dragging text from another file): types has "text/plain" and "text/html"
//Dragging text internally (dragging text to another line): types has just "text/plain"
//Dragging a file: types has "Files"
//Dragging a url: types has "text/plain" and "text/uri-list" <-what we are interested in
if (value === "text/uri-list") {
event.stopPropagation();
event.preventDefault();
return;
}
});
}
} | [
"function",
"stopURIListPropagation",
"(",
"files",
",",
"event",
")",
"{",
"var",
"types",
"=",
"event",
".",
"dataTransfer",
".",
"types",
";",
"if",
"(",
"(",
"!",
"files",
"||",
"!",
"files",
".",
"length",
")",
"&&",
"types",
")",
"{",
"// We only... | Determines if the event contains a type list that has a URI-list.
If it does and contains an empty file list, then what is being dropped is a URL.
If that is true then we stop the event propagation and default behavior to save Brackets editor from the browser taking over.
@param {Array.<File>} files Array of File objects from the event datastructure. URLs are the only drop item that would contain a URI-list.
@param {event} event The event datastucture containing datatransfer information about the drag/drop event. Contains a type list which may or may not hold a URI-list depending on what was dragged/dropped. Interested if it does. | [
"Determines",
"if",
"the",
"event",
"contains",
"a",
"type",
"list",
"that",
"has",
"a",
"URI",
"-",
"list",
".",
"If",
"it",
"does",
"and",
"contains",
"an",
"empty",
"file",
"list",
"then",
"what",
"is",
"being",
"dropped",
"is",
"a",
"URL",
".",
"... | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/utils/DragAndDrop.js#L72-L88 | train | Stop propagation of URI list | [
30522,
3853,
2644,
9496,
9863,
21572,
4502,
12540,
1006,
6764,
1010,
2724,
1007,
1063,
13075,
4127,
1027,
2724,
1012,
2951,
6494,
3619,
7512,
1012,
4127,
1025,
2065,
1006,
1006,
999,
6764,
1064,
1064,
999,
6764,
1012,
3091,
1007,
1004,
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/base/ManagedObjectObserver.js | remove | function remove(oTarget, oListener, oConfiguration) {
oConfiguration = oConfiguration || getConfiguration(oTarget, oListener);
updateConfiguration(oTarget, oListener, oConfiguration, true);
} | javascript | function remove(oTarget, oListener, oConfiguration) {
oConfiguration = oConfiguration || getConfiguration(oTarget, oListener);
updateConfiguration(oTarget, oListener, oConfiguration, true);
} | [
"function",
"remove",
"(",
"oTarget",
",",
"oListener",
",",
"oConfiguration",
")",
"{",
"oConfiguration",
"=",
"oConfiguration",
"||",
"getConfiguration",
"(",
"oTarget",
",",
"oListener",
")",
";",
"updateConfiguration",
"(",
"oTarget",
",",
"oListener",
",",
... | removes the given configuration for the given listener from the internal list of observed targets mTargets. removes the observer from the target managed object if the target hasn't to be observed any longer | [
"removes",
"the",
"given",
"configuration",
"for",
"the",
"given",
"listener",
"from",
"the",
"internal",
"list",
"of",
"observed",
"targets",
"mTargets",
".",
"removes",
"the",
"observer",
"from",
"the",
"target",
"managed",
"object",
"if",
"the",
"target",
"... | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/base/ManagedObjectObserver.js#L481-L484 | train | Removes the specified event listener from the target. | [
30522,
3853,
6366,
1006,
27178,
2906,
18150,
1010,
19330,
27870,
3678,
1010,
1051,
8663,
8873,
27390,
3370,
1007,
1063,
1051,
8663,
8873,
27390,
3370,
1027,
1051,
8663,
8873,
27390,
3370,
1064,
1064,
2131,
8663,
8873,
27390,
3370,
1006,
271... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/model/Series.js | function (dataType) {
var task = getCurrentTask(this);
if (task) {
var data = task.context.data;
return dataType == null ? data : data.getLinkedData(dataType);
}
else {
// When series is not alive (that may happen when click toolbox
// restore or setOption with not merge mode), series data may
// be still need to judge animation or something when graphic
// elements want to know whether fade out.
return inner(this).data;
}
} | javascript | function (dataType) {
var task = getCurrentTask(this);
if (task) {
var data = task.context.data;
return dataType == null ? data : data.getLinkedData(dataType);
}
else {
// When series is not alive (that may happen when click toolbox
// restore or setOption with not merge mode), series data may
// be still need to judge animation or something when graphic
// elements want to know whether fade out.
return inner(this).data;
}
} | [
"function",
"(",
"dataType",
")",
"{",
"var",
"task",
"=",
"getCurrentTask",
"(",
"this",
")",
";",
"if",
"(",
"task",
")",
"{",
"var",
"data",
"=",
"task",
".",
"context",
".",
"data",
";",
"return",
"dataType",
"==",
"null",
"?",
"data",
":",
"da... | Consider some method like `filter`, `map` need make new data,
We should make sure that `seriesModel.getData()` get correct
data in the stream procedure. So we fetch data from upstream
each time `task.perform` called.
@param {string} [dataType]
@return {module:echarts/data/List} | [
"Consider",
"some",
"method",
"like",
"filter",
"map",
"need",
"make",
"new",
"data",
"We",
"should",
"make",
"sure",
"that",
"seriesModel",
".",
"getData",
"()",
"get",
"correct",
"data",
"in",
"the",
"stream",
"procedure",
".",
"So",
"we",
"fetch",
"data... | 4d0ea095dc3929cb6de40c45748826e7999c7aa8 | https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/model/Series.js#L230-L243 | train | Get the data for the current series | [
30522,
3853,
1006,
2951,
13874,
1007,
1063,
13075,
4708,
1027,
2131,
10841,
14343,
3372,
10230,
2243,
1006,
2023,
1007,
1025,
2065,
1006,
4708,
1007,
1063,
13075,
2951,
1027,
4708,
1012,
6123,
1012,
2951,
1025,
2709,
2951,
13874,
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... | |
SAP/openui5 | src/sap.ui.core/src/sap/ui/model/analytics/AnalyticalBinding.js | getAdditionalSelects | function getAdditionalSelects(oBinding) {
var oAnalyticalQueryRequest
= new odata4analytics.QueryResultRequest(oBinding.oAnalyticalQueryResult),
aComputedSelect,
sComputedSelect,
oDimension,
i,
j,
oMeasure,
n,
sPropertyName,
aSelect = oBinding.mParameters.select.split(","),
bError = trimAndCheckForDuplicates(aSelect, oBinding.sPath);
// prepare oAnalyticalQueryRequest to be able to call getURIQueryOptionValue("$select")
oAnalyticalQueryRequest.setAggregationLevel(oBinding.aMaxAggregationLevel);
oAnalyticalQueryRequest.setMeasures(oBinding.aMeasureName);
// update dimension's key, text and attributes as done in relevant _prepare... functions
Object.keys(oBinding.oDimensionDetailsSet).forEach(function (sDimensionKey) {
oDimension = oBinding.oDimensionDetailsSet[sDimensionKey];
oAnalyticalQueryRequest.includeDimensionKeyTextAttributes(sDimensionKey,
true, oDimension.textPropertyName !== undefined, oDimension.aAttributeName);
});
// update measure's raw value, formatted value and unit property as done in relevant
// _prepare... functions
Object.keys(oBinding.oMeasureDetailsSet).forEach(function (sMeasureKey) {
oMeasure = oBinding.oMeasureDetailsSet[sMeasureKey];
oAnalyticalQueryRequest.includeMeasureRawFormattedValueUnit(sMeasureKey,
oMeasure.rawValuePropertyName !== undefined,
oMeasure.formattedValuePropertyName !== undefined,
oMeasure.unitPropertyName !== undefined);
});
// at least all selected properties, computed by the binding, are contained in select
// binding parameter
sComputedSelect = oAnalyticalQueryRequest.getURIQueryOptionValue("$select");
if (sComputedSelect) {
aComputedSelect = sComputedSelect.split(",");
for (i = 0, n = aComputedSelect.length; i < n; i++) {
sPropertyName = aComputedSelect[i];
j = aSelect.indexOf(sPropertyName);
if (j < 0) {
oLogger.warning("Ignored the 'select' binding parameter, because"
+ " it does not contain the property '" + sPropertyName + "'",
oBinding.sPath);
bError = true;
} else {
aSelect.splice(j, 1);
}
}
}
// check additionally selected properties, no new dimensions and new measures or
// associated properties for new dimensions or measures are allowed
for (i = 0, n = aSelect.length; i < n; i++) {
sPropertyName = aSelect[i];
oDimension = oBinding.oAnalyticalQueryResult.findDimensionByPropertyName(sPropertyName);
if (oDimension && oBinding.oDimensionDetailsSet[oDimension.getName()] === undefined) {
logUnsupportedPropertyInSelect(oBinding.sPath, sPropertyName, oDimension);
bError = true;
}
oMeasure = oBinding.oAnalyticalQueryResult.findMeasureByPropertyName(sPropertyName);
if (oMeasure && oBinding.oMeasureDetailsSet[oMeasure.getName()] === undefined) {
logUnsupportedPropertyInSelect(oBinding.sPath, sPropertyName, oMeasure);
bError = true;
}
}
return bError ? [] : aSelect;
} | javascript | function getAdditionalSelects(oBinding) {
var oAnalyticalQueryRequest
= new odata4analytics.QueryResultRequest(oBinding.oAnalyticalQueryResult),
aComputedSelect,
sComputedSelect,
oDimension,
i,
j,
oMeasure,
n,
sPropertyName,
aSelect = oBinding.mParameters.select.split(","),
bError = trimAndCheckForDuplicates(aSelect, oBinding.sPath);
// prepare oAnalyticalQueryRequest to be able to call getURIQueryOptionValue("$select")
oAnalyticalQueryRequest.setAggregationLevel(oBinding.aMaxAggregationLevel);
oAnalyticalQueryRequest.setMeasures(oBinding.aMeasureName);
// update dimension's key, text and attributes as done in relevant _prepare... functions
Object.keys(oBinding.oDimensionDetailsSet).forEach(function (sDimensionKey) {
oDimension = oBinding.oDimensionDetailsSet[sDimensionKey];
oAnalyticalQueryRequest.includeDimensionKeyTextAttributes(sDimensionKey,
true, oDimension.textPropertyName !== undefined, oDimension.aAttributeName);
});
// update measure's raw value, formatted value and unit property as done in relevant
// _prepare... functions
Object.keys(oBinding.oMeasureDetailsSet).forEach(function (sMeasureKey) {
oMeasure = oBinding.oMeasureDetailsSet[sMeasureKey];
oAnalyticalQueryRequest.includeMeasureRawFormattedValueUnit(sMeasureKey,
oMeasure.rawValuePropertyName !== undefined,
oMeasure.formattedValuePropertyName !== undefined,
oMeasure.unitPropertyName !== undefined);
});
// at least all selected properties, computed by the binding, are contained in select
// binding parameter
sComputedSelect = oAnalyticalQueryRequest.getURIQueryOptionValue("$select");
if (sComputedSelect) {
aComputedSelect = sComputedSelect.split(",");
for (i = 0, n = aComputedSelect.length; i < n; i++) {
sPropertyName = aComputedSelect[i];
j = aSelect.indexOf(sPropertyName);
if (j < 0) {
oLogger.warning("Ignored the 'select' binding parameter, because"
+ " it does not contain the property '" + sPropertyName + "'",
oBinding.sPath);
bError = true;
} else {
aSelect.splice(j, 1);
}
}
}
// check additionally selected properties, no new dimensions and new measures or
// associated properties for new dimensions or measures are allowed
for (i = 0, n = aSelect.length; i < n; i++) {
sPropertyName = aSelect[i];
oDimension = oBinding.oAnalyticalQueryResult.findDimensionByPropertyName(sPropertyName);
if (oDimension && oBinding.oDimensionDetailsSet[oDimension.getName()] === undefined) {
logUnsupportedPropertyInSelect(oBinding.sPath, sPropertyName, oDimension);
bError = true;
}
oMeasure = oBinding.oAnalyticalQueryResult.findMeasureByPropertyName(sPropertyName);
if (oMeasure && oBinding.oMeasureDetailsSet[oMeasure.getName()] === undefined) {
logUnsupportedPropertyInSelect(oBinding.sPath, sPropertyName, oMeasure);
bError = true;
}
}
return bError ? [] : aSelect;
} | [
"function",
"getAdditionalSelects",
"(",
"oBinding",
")",
"{",
"var",
"oAnalyticalQueryRequest",
"=",
"new",
"odata4analytics",
".",
"QueryResultRequest",
"(",
"oBinding",
".",
"oAnalyticalQueryResult",
")",
",",
"aComputedSelect",
",",
"sComputedSelect",
",",
"oDimensi... | Checks whether the select binding parameter fits to the current analytical info and returns
an array of properties that need to be added to leaf requests. If the select binding
parameter does not fit to the current analytical info a warning is logged and the select
binding parameter is ignored.
Select binding parameter does not fit to the analytical info,
<ul>
<li>if an additional dimension is contained in the select binding parameter
<li>if an associated property (e.g. text property or attribute) of an additional dimension
is contained in the select binding parameter
<li>if an additional measure is contained in the select binding parameter
<li>if an associated property (e.g. text property) of an additional measure is contained in
the select binding parameter
<li>if a dimension or a measure of the current analytical info is not contained in the select
binding parameter
</ul>
@param {sap.ui.model.analytics.AnalyticalBinding} oBinding
The analytical binding instance
@returns {string[]} An array of additional properties that need to be selected or an empty
array if there are no additional select properties needed | [
"Checks",
"whether",
"the",
"select",
"binding",
"parameter",
"fits",
"to",
"the",
"current",
"analytical",
"info",
"and",
"returns",
"an",
"array",
"of",
"properties",
"that",
"need",
"to",
"be",
"added",
"to",
"leaf",
"requests",
".",
"If",
"the",
"select"... | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/analytics/AnalyticalBinding.js#L70-L144 | train | This function is called to add additional select parameters to the query request | [
30522,
3853,
2131,
4215,
27064,
11246,
22471,
2015,
1006,
27885,
22254,
2075,
1007,
1063,
13075,
1051,
27953,
21252,
2389,
4226,
2854,
2890,
15500,
1027,
2047,
1051,
2850,
2696,
2549,
27953,
21252,
2015,
1012,
23032,
6072,
11314,
2890,
15500,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
statsd/statsd | stats.js | loadBackend | function loadBackend(config, name) {
var backendmod = require(name);
if (config.debug) {
l.log("Loading backend: " + name, 'DEBUG');
}
var ret = backendmod.init(startup_time, config, backendEvents, l);
if (!ret) {
l.log("Failed to load backend: " + name, "ERROR");
process.exit(1);
}
} | javascript | function loadBackend(config, name) {
var backendmod = require(name);
if (config.debug) {
l.log("Loading backend: " + name, 'DEBUG');
}
var ret = backendmod.init(startup_time, config, backendEvents, l);
if (!ret) {
l.log("Failed to load backend: " + name, "ERROR");
process.exit(1);
}
} | [
"function",
"loadBackend",
"(",
"config",
",",
"name",
")",
"{",
"var",
"backendmod",
"=",
"require",
"(",
"name",
")",
";",
"if",
"(",
"config",
".",
"debug",
")",
"{",
"l",
".",
"log",
"(",
"\"Loading backend: \"",
"+",
"name",
",",
"'DEBUG'",
")",
... | Load and init the backend from the backends/ directory. | [
"Load",
"and",
"init",
"the",
"backend",
"from",
"the",
"backends",
"/",
"directory",
"."
] | ef8e4d76d76c3a0cf771e3724cf79ea22f3c50d9 | https://github.com/statsd/statsd/blob/ef8e4d76d76c3a0cf771e3724cf79ea22f3c50d9/stats.js#L35-L47 | train | Load a backend | [
30522,
3853,
7170,
5963,
10497,
1006,
9530,
8873,
2290,
1010,
2171,
1007,
1063,
13075,
2067,
10497,
5302,
2094,
1027,
5478,
1006,
2171,
1007,
1025,
2065,
1006,
9530,
8873,
2290,
1012,
2139,
8569,
2290,
1007,
1063,
1048,
1012,
8833,
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... |
dimsemenov/PhotoSwipe | src/js/gestures.js | function(p1, p2) {
_tempPoint.x = Math.abs( p1.x - p2.x );
_tempPoint.y = Math.abs( p1.y - p2.y );
return Math.sqrt(_tempPoint.x * _tempPoint.x + _tempPoint.y * _tempPoint.y);
} | javascript | function(p1, p2) {
_tempPoint.x = Math.abs( p1.x - p2.x );
_tempPoint.y = Math.abs( p1.y - p2.y );
return Math.sqrt(_tempPoint.x * _tempPoint.x + _tempPoint.y * _tempPoint.y);
} | [
"function",
"(",
"p1",
",",
"p2",
")",
"{",
"_tempPoint",
".",
"x",
"=",
"Math",
".",
"abs",
"(",
"p1",
".",
"x",
"-",
"p2",
".",
"x",
")",
";",
"_tempPoint",
".",
"y",
"=",
"Math",
".",
"abs",
"(",
"p1",
".",
"y",
"-",
"p2",
".",
"y",
")... | amount of pixels to drag to determine direction of swipe | [
"amount",
"of",
"pixels",
"to",
"drag",
"to",
"determine",
"direction",
"of",
"swipe"
] | 80607e12542a1a54ecefa837649e862b35dffd25 | https://github.com/dimsemenov/PhotoSwipe/blob/80607e12542a1a54ecefa837649e862b35dffd25/src/js/gestures.js#L59-L63 | train | Returns the distance between two points | [
30522,
3853,
1006,
1052,
2487,
1010,
1052,
2475,
1007,
1063,
1035,
8915,
8737,
8400,
1012,
1060,
1027,
8785,
1012,
14689,
1006,
1052,
2487,
1012,
1060,
1011,
1052,
2475,
1012,
1060,
1007,
1025,
1035,
8915,
8737,
8400,
1012,
1061,
1027,
87... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
grpc/grpc-node | packages/grpc-native-core/src/client_interceptors.js | _getBidiStreamingListener | function _getBidiStreamingListener(method_definition, emitter) {
var deserialize = common.wrapIgnoreNull(
method_definition.responseDeserialize);
return {
onReceiveMetadata: function (metadata) {
emitter.emit('metadata', metadata);
},
onReceiveMessage: function(message, next, context) {
if (emitter.push(message) && message !== null) {
var call = context.call;
var get_listener = function() {
return context.listener;
};
var read_batch = {};
read_batch[grpc.opType.RECV_MESSAGE] = true;
call.startBatch(read_batch, _getStreamReadCallback(emitter, call,
get_listener, deserialize));
} else {
emitter.reading = false;
}
},
onReceiveStatus: function (status) {
emitter._receiveStatus(status);
}
};
} | javascript | function _getBidiStreamingListener(method_definition, emitter) {
var deserialize = common.wrapIgnoreNull(
method_definition.responseDeserialize);
return {
onReceiveMetadata: function (metadata) {
emitter.emit('metadata', metadata);
},
onReceiveMessage: function(message, next, context) {
if (emitter.push(message) && message !== null) {
var call = context.call;
var get_listener = function() {
return context.listener;
};
var read_batch = {};
read_batch[grpc.opType.RECV_MESSAGE] = true;
call.startBatch(read_batch, _getStreamReadCallback(emitter, call,
get_listener, deserialize));
} else {
emitter.reading = false;
}
},
onReceiveStatus: function (status) {
emitter._receiveStatus(status);
}
};
} | [
"function",
"_getBidiStreamingListener",
"(",
"method_definition",
",",
"emitter",
")",
"{",
"var",
"deserialize",
"=",
"common",
".",
"wrapIgnoreNull",
"(",
"method_definition",
".",
"responseDeserialize",
")",
";",
"return",
"{",
"onReceiveMetadata",
":",
"function"... | Produces a listener for responding to callers of bi-directional RPCs.
@private
@param {grpc~MethodDefinition} method_definition
@param {EventEmitter} emitter
@return {grpc~Listener} | [
"Produces",
"a",
"listener",
"for",
"responding",
"to",
"callers",
"of",
"bi",
"-",
"directional",
"RPCs",
"."
] | b36b285f4cdb334bbd48f74c12c13bec69961488 | https://github.com/grpc/grpc-node/blob/b36b285f4cdb334bbd48f74c12c13bec69961488/packages/grpc-native-core/src/client_interceptors.js#L1284-L1309 | train | Returns a listener that will be used to listen for messages from the server | [
30522,
3853,
1035,
2131,
17062,
2923,
16416,
6562,
9863,
24454,
1006,
4118,
1035,
6210,
1010,
12495,
12079,
1007,
1063,
13075,
4078,
11610,
3669,
4371,
1027,
2691,
1012,
10236,
23773,
5686,
11231,
3363,
1006,
4118,
1035,
6210,
1012,
3433,
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... |
SeleniumHQ/selenium | javascript/selenium-core/scripts/ui-element.js | UISpecifier | function UISpecifier(uiSpecifierStringOrPagesetName, elementName, args)
{
/**
* Initializes this object from a UI specifier string of the form:
*
* pagesetName::elementName(arg1=value1, arg2=value2, ...)
*
* into its component parts, and returns them as an object.
*
* @return an object containing the components of the UI specifier
* @throws UISpecifierException
*/
this._initFromUISpecifierString = function(uiSpecifierString) {
var matches = /^(.*)::([^\(]+)\((.*)\)$/.exec(uiSpecifierString);
if (matches == null) {
throw new UISpecifierException('Error in '
+ 'UISpecifier._initFromUISpecifierString(): "'
+ this.string + '" is not a valid UI specifier string');
}
this.pagesetName = matches[1];
this.elementName = matches[2];
this.args = (matches[3]) ? parse_kwargs(matches[3]) : {};
};
/**
* Override the toString() method to return the UI specifier string when
* evaluated in a string context. Combines the UI specifier components into
* a canonical UI specifier string and returns it.
*
* @return a UI specifier string
*/
this.toString = function() {
// empty string is acceptable for the path, but it must be defined
if (this.pagesetName == undefined) {
throw new UISpecifierException('Error in UISpecifier.toString(): "'
+ this.pagesetName + '" is not a valid UI specifier pageset '
+ 'name');
}
if (!this.elementName) {
throw new UISpecifierException('Error in UISpecifier.unparse(): "'
+ this.elementName + '" is not a valid UI specifier element '
+ 'name');
}
if (!this.args) {
throw new UISpecifierException('Error in UISpecifier.unparse(): "'
+ this.args + '" are not valid UI specifier args');
}
uiElement = UIMap.getInstance()
.getUIElement(this.pagesetName, this.elementName);
if (uiElement != null) {
var kwargs = to_kwargs(this.args, uiElement.argsOrder);
}
else {
// probably under unit test
var kwargs = to_kwargs(this.args);
}
return this.pagesetName + '::' + this.elementName + '(' + kwargs + ')';
};
// construct the object
if (arguments.length < 2) {
this._initFromUISpecifierString(uiSpecifierStringOrPagesetName);
}
else {
this.pagesetName = uiSpecifierStringOrPagesetName;
this.elementName = elementName;
this.args = (args) ? clone(args) : {};
}
} | javascript | function UISpecifier(uiSpecifierStringOrPagesetName, elementName, args)
{
/**
* Initializes this object from a UI specifier string of the form:
*
* pagesetName::elementName(arg1=value1, arg2=value2, ...)
*
* into its component parts, and returns them as an object.
*
* @return an object containing the components of the UI specifier
* @throws UISpecifierException
*/
this._initFromUISpecifierString = function(uiSpecifierString) {
var matches = /^(.*)::([^\(]+)\((.*)\)$/.exec(uiSpecifierString);
if (matches == null) {
throw new UISpecifierException('Error in '
+ 'UISpecifier._initFromUISpecifierString(): "'
+ this.string + '" is not a valid UI specifier string');
}
this.pagesetName = matches[1];
this.elementName = matches[2];
this.args = (matches[3]) ? parse_kwargs(matches[3]) : {};
};
/**
* Override the toString() method to return the UI specifier string when
* evaluated in a string context. Combines the UI specifier components into
* a canonical UI specifier string and returns it.
*
* @return a UI specifier string
*/
this.toString = function() {
// empty string is acceptable for the path, but it must be defined
if (this.pagesetName == undefined) {
throw new UISpecifierException('Error in UISpecifier.toString(): "'
+ this.pagesetName + '" is not a valid UI specifier pageset '
+ 'name');
}
if (!this.elementName) {
throw new UISpecifierException('Error in UISpecifier.unparse(): "'
+ this.elementName + '" is not a valid UI specifier element '
+ 'name');
}
if (!this.args) {
throw new UISpecifierException('Error in UISpecifier.unparse(): "'
+ this.args + '" are not valid UI specifier args');
}
uiElement = UIMap.getInstance()
.getUIElement(this.pagesetName, this.elementName);
if (uiElement != null) {
var kwargs = to_kwargs(this.args, uiElement.argsOrder);
}
else {
// probably under unit test
var kwargs = to_kwargs(this.args);
}
return this.pagesetName + '::' + this.elementName + '(' + kwargs + ')';
};
// construct the object
if (arguments.length < 2) {
this._initFromUISpecifierString(uiSpecifierStringOrPagesetName);
}
else {
this.pagesetName = uiSpecifierStringOrPagesetName;
this.elementName = elementName;
this.args = (args) ? clone(args) : {};
}
} | [
"function",
"UISpecifier",
"(",
"uiSpecifierStringOrPagesetName",
",",
"elementName",
",",
"args",
")",
"{",
"/**\n * Initializes this object from a UI specifier string of the form:\n *\n * pagesetName::elementName(arg1=value1, arg2=value2, ...)\n *\n * into its component... | The UISpecifier constructor is overloaded. If less than three arguments are
provided, the first argument will be considered a UI specifier string, and
will be split out accordingly. Otherwise, the first argument will be
considered the path.
@param uiSpecifierStringOrPagesetName a UI specifier string, or the pageset
name of the UI specifier
@param elementName the name of the element
@param args an object associating keys to values
@return new UISpecifier object | [
"The",
"UISpecifier",
"constructor",
"is",
"overloaded",
".",
"If",
"less",
"than",
"three",
"arguments",
"are",
"provided",
"the",
"first",
"argument",
"will",
"be",
"considered",
"a",
"UI",
"specifier",
"string",
"and",
"will",
"be",
"split",
"out",
"accordi... | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/selenium-core/scripts/ui-element.js#L603-L675 | train | A UI specifier object | [
30522,
3853,
21318,
13102,
8586,
18095,
1006,
21318,
13102,
8586,
28295,
18886,
16656,
14536,
13923,
3388,
18442,
1010,
5783,
18442,
1010,
12098,
5620,
1007,
1063,
1013,
1008,
1008,
1008,
3988,
10057,
2023,
4874,
2013,
1037,
21318,
28699,
180... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | build/babel-plugin-transform-modules-commonjs-ec.js | normalizeModuleAndLoadMetadata | function normalizeModuleAndLoadMetadata(programPath) {
nameAnonymousExports(programPath);
const {local, source} = getModuleMetadata(programPath);
removeModuleDeclarations(programPath);
// Reuse the imported namespace name if there is one.
for (const [, metadata] of source) {
if (metadata.importsNamespace.size > 0) {
// This is kind of gross. If we stop using `loose: true` we should
// just make this destructuring assignment.
metadata.name = metadata.importsNamespace.values().next().value;
}
}
return {
exportName: 'exports',
exportNameListName: null,
local,
source
};
} | javascript | function normalizeModuleAndLoadMetadata(programPath) {
nameAnonymousExports(programPath);
const {local, source} = getModuleMetadata(programPath);
removeModuleDeclarations(programPath);
// Reuse the imported namespace name if there is one.
for (const [, metadata] of source) {
if (metadata.importsNamespace.size > 0) {
// This is kind of gross. If we stop using `loose: true` we should
// just make this destructuring assignment.
metadata.name = metadata.importsNamespace.values().next().value;
}
}
return {
exportName: 'exports',
exportNameListName: null,
local,
source
};
} | [
"function",
"normalizeModuleAndLoadMetadata",
"(",
"programPath",
")",
"{",
"nameAnonymousExports",
"(",
"programPath",
")",
";",
"const",
"{",
"local",
",",
"source",
"}",
"=",
"getModuleMetadata",
"(",
"programPath",
")",
";",
"removeModuleDeclarations",
"(",
"pro... | Remove all imports and exports from the file, and return all metadata
needed to reconstruct the module's behavior.
@return {ModuleMetadata} | [
"Remove",
"all",
"imports",
"and",
"exports",
"from",
"the",
"file",
"and",
"return",
"all",
"metadata",
"needed",
"to",
"reconstruct",
"the",
"module",
"s",
"behavior",
"."
] | 30321b57cba3149c30eacb0c1e18276f0f001b9f | https://github.com/ecomfe/zrender/blob/30321b57cba3149c30eacb0c1e18276f0f001b9f/build/babel-plugin-transform-modules-commonjs-ec.js#L70-L93 | train | Normalize the module and load the metadata | [
30522,
3853,
3671,
4697,
5302,
8566,
20898,
19422,
10441,
22117,
12928,
2850,
2696,
1006,
2565,
15069,
1007,
1063,
2171,
6761,
4890,
27711,
10288,
25378,
1006,
2565,
15069,
1007,
1025,
9530,
3367,
1063,
2334,
1010,
3120,
1065,
1027,
2131,
5... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
GeekyAnts/vue-native-core | packages/vue-native-helper/build.js | handleComponents | function handleComponents(components) {
for (var k in components) {
if (hasOwn$1(components, k)) {
components[pascalCaseTag(k)] = components[k];
var c = components[k];
if (c.name) {
components[pascalCaseTag(c.name)] = components[k];
}
}
}
return components
} | javascript | function handleComponents(components) {
for (var k in components) {
if (hasOwn$1(components, k)) {
components[pascalCaseTag(k)] = components[k];
var c = components[k];
if (c.name) {
components[pascalCaseTag(c.name)] = components[k];
}
}
}
return components
} | [
"function",
"handleComponents",
"(",
"components",
")",
"{",
"for",
"(",
"var",
"k",
"in",
"components",
")",
"{",
"if",
"(",
"hasOwn$1",
"(",
"components",
",",
"k",
")",
")",
"{",
"components",
"[",
"pascalCaseTag",
"(",
"k",
")",
"]",
"=",
"componen... | for options {components}
@param {Object} components | [
"for",
"options",
"{",
"components",
"}"
] | a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e | https://github.com/GeekyAnts/vue-native-core/blob/a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e/packages/vue-native-helper/build.js#L1716-L1727 | train | Handle the components object | [
30522,
3853,
5047,
9006,
29513,
7666,
1006,
6177,
1007,
1063,
2005,
1006,
13075,
1047,
1999,
6177,
1007,
1063,
2065,
1006,
2038,
12384,
1002,
1015,
1006,
6177,
1010,
1047,
1007,
1007,
1063,
6177,
1031,
17878,
18382,
15900,
1006,
1047,
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... |
ngrx/platform | projects/ngrx.io/tools/examples/run-example-e2e.js | getE2eSpecsFor | function getE2eSpecsFor(basePath, specFile, filter) {
// Only get spec file at the example root.
const e2eSpecGlob = `${filter ? `*${filter}*` : '*'}/${specFile}`;
return globby(e2eSpecGlob, { cwd: basePath, nodir: true })
.then(paths => paths
.filter(file => !IGNORED_EXAMPLES.some(ignored => file.startsWith(ignored)))
.map(file => path.join(basePath, file))
);
} | javascript | function getE2eSpecsFor(basePath, specFile, filter) {
// Only get spec file at the example root.
const e2eSpecGlob = `${filter ? `*${filter}*` : '*'}/${specFile}`;
return globby(e2eSpecGlob, { cwd: basePath, nodir: true })
.then(paths => paths
.filter(file => !IGNORED_EXAMPLES.some(ignored => file.startsWith(ignored)))
.map(file => path.join(basePath, file))
);
} | [
"function",
"getE2eSpecsFor",
"(",
"basePath",
",",
"specFile",
",",
"filter",
")",
"{",
"// Only get spec file at the example root.",
"const",
"e2eSpecGlob",
"=",
"`",
"${",
"filter",
"?",
"`",
"${",
"filter",
"}",
"`",
":",
"'*'",
"}",
"${",
"specFile",
"}",... | Find all e2e specs in a given example folder. | [
"Find",
"all",
"e2e",
"specs",
"in",
"a",
"given",
"example",
"folder",
"."
] | eec9cc615440526ddedac04ae0082bfecef13d50 | https://github.com/ngrx/platform/blob/eec9cc615440526ddedac04ae0082bfecef13d50/projects/ngrx.io/tools/examples/run-example-e2e.js#L296-L304 | train | Get all the spec files that are in the example root | [
30522,
3853,
2131,
2063,
2475,
2229,
5051,
6169,
29278,
1006,
2918,
15069,
1010,
28699,
8873,
2571,
1010,
11307,
1007,
1063,
1013,
1013,
2069,
2131,
28699,
5371,
2012,
1996,
30524,
2475,
2229,
5051,
2278,
23296,
16429,
1010,
1063,
19296,
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... |
angular/material | src/core/util/util.js | function(element, property, lValue, rValue) {
var ltr = !($document[0].dir == 'rtl' || $document[0].body.dir == 'rtl');
// If accessor
if (arguments.length == 0) return ltr ? 'ltr' : 'rtl';
// If mutator
var elem = angular.element(element);
if (ltr && angular.isDefined(lValue)) {
elem.css(property, validateCssValue(lValue));
}
else if (!ltr && angular.isDefined(rValue)) {
elem.css(property, validateCssValue(rValue));
}
} | javascript | function(element, property, lValue, rValue) {
var ltr = !($document[0].dir == 'rtl' || $document[0].body.dir == 'rtl');
// If accessor
if (arguments.length == 0) return ltr ? 'ltr' : 'rtl';
// If mutator
var elem = angular.element(element);
if (ltr && angular.isDefined(lValue)) {
elem.css(property, validateCssValue(lValue));
}
else if (!ltr && angular.isDefined(rValue)) {
elem.css(property, validateCssValue(rValue));
}
} | [
"function",
"(",
"element",
",",
"property",
",",
"lValue",
",",
"rValue",
")",
"{",
"var",
"ltr",
"=",
"!",
"(",
"$document",
"[",
"0",
"]",
".",
"dir",
"==",
"'rtl'",
"||",
"$document",
"[",
"0",
"]",
".",
"body",
".",
"dir",
"==",
"'rtl'",
")"... | Bi-directional accessor/mutator used to easily update an element's
property based on the current 'dir'ectional value. | [
"Bi",
"-",
"directional",
"accessor",
"/",
"mutator",
"used",
"to",
"easily",
"update",
"an",
"element",
"s",
"property",
"based",
"on",
"the",
"current",
"dir",
"ectional",
"value",
"."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/util/util.js#L90-L105 | train | Returns the value of the specified CSS property. | [
30522,
3853,
1006,
5783,
1010,
3200,
1010,
1048,
10175,
5657,
1010,
27634,
2389,
5657,
1007,
1063,
13075,
8318,
2099,
1027,
999,
1006,
1002,
6254,
1031,
1014,
1033,
1012,
16101,
1027,
1027,
1005,
19387,
2140,
1005,
1064,
1064,
1002,
6254,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | gestureStart | function gestureStart(ev) {
// If we're already touched down, abort
if (pointer) return;
var now = +Date.now();
// iOS & old android bug: after a touch event, a click event is sent 350 ms later.
// If <400ms have passed, don't allow an event of a different type than the previous event
if (lastPointer && !typesMatch(ev, lastPointer) && (now - lastPointer.endTime < 1500)) {
return;
}
pointer = makeStartPointer(ev);
runHandlers('start', ev);
} | javascript | function gestureStart(ev) {
// If we're already touched down, abort
if (pointer) return;
var now = +Date.now();
// iOS & old android bug: after a touch event, a click event is sent 350 ms later.
// If <400ms have passed, don't allow an event of a different type than the previous event
if (lastPointer && !typesMatch(ev, lastPointer) && (now - lastPointer.endTime < 1500)) {
return;
}
pointer = makeStartPointer(ev);
runHandlers('start', ev);
} | [
"function",
"gestureStart",
"(",
"ev",
")",
"{",
"// If we're already touched down, abort",
"if",
"(",
"pointer",
")",
"return",
";",
"var",
"now",
"=",
"+",
"Date",
".",
"now",
"(",
")",
";",
"// iOS & old android bug: after a touch event, a click event is sent 350 ms ... | /*
gestureStart vets if a start event is legitimate (and not part of a 'ghost click' from iOS/Android)
If it is legitimate, we initiate the pointer state and mark the current pointer's type
For example, for a touchstart event, mark the current pointer as a 'touch' pointer, so mouse events
won't effect it. | [
"/",
"*",
"gestureStart",
"vets",
"if",
"a",
"start",
"event",
"is",
"legitimate",
"(",
"and",
"not",
"part",
"of",
"a",
"ghost",
"click",
"from",
"iOS",
"/",
"Android",
")",
"If",
"it",
"is",
"legitimate",
"we",
"initiate",
"the",
"pointer",
"state",
... | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/services/gesture/gesture.js#L652-L667 | train | This function is called when a touch event is triggered. | [
30522,
3853,
18327,
7559,
2102,
1006,
23408,
1007,
1063,
1013,
1013,
2065,
2057,
1005,
2128,
2525,
5028,
2091,
1010,
11113,
11589,
2065,
1006,
20884,
1007,
2709,
1025,
13075,
2085,
1027,
1009,
3058,
1012,
2085,
1006,
1007,
1025,
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... |
LLK/scratch-blocks | i18n/create_scratch_msgs.js | function (entry) {
const re = /(%\d)/g;
const [key, translation] = entry;
const enMatch = en[key].match(re);
const tMatch = translation.match(re);
const enCount = enMatch ? enMatch.length : 0;
const tCount = tMatch ? tMatch.length : 0;
assert.strictEqual(tCount, enCount, `${key}:${en[key]} - "${translation}" placeholder mismatch`);
if (enCount > 0) {
assert.notStrictEqual(tMatch, null, `${key} is missing a placeholder: ${translation}`);
assert.strictEqual(
tMatch.sort().toString(),
enMatch.sort().toString(),
`${key} is missing or has duplicate placeholders: ${translation}`
);
}
assert.strictEqual(translation.match(/[\n]/), null, `${key} contains a newline character ${translation}`);
} | javascript | function (entry) {
const re = /(%\d)/g;
const [key, translation] = entry;
const enMatch = en[key].match(re);
const tMatch = translation.match(re);
const enCount = enMatch ? enMatch.length : 0;
const tCount = tMatch ? tMatch.length : 0;
assert.strictEqual(tCount, enCount, `${key}:${en[key]} - "${translation}" placeholder mismatch`);
if (enCount > 0) {
assert.notStrictEqual(tMatch, null, `${key} is missing a placeholder: ${translation}`);
assert.strictEqual(
tMatch.sort().toString(),
enMatch.sort().toString(),
`${key} is missing or has duplicate placeholders: ${translation}`
);
}
assert.strictEqual(translation.match(/[\n]/), null, `${key} contains a newline character ${translation}`);
} | [
"function",
"(",
"entry",
")",
"{",
"const",
"re",
"=",
"/",
"(%\\d)",
"/",
"g",
";",
"const",
"[",
"key",
",",
"translation",
"]",
"=",
"entry",
";",
"const",
"enMatch",
"=",
"en",
"[",
"key",
"]",
".",
"match",
"(",
"re",
")",
";",
"const",
"... | Check that translation is valid: entry: array [key, translation] corresponding to a single string from <locale>.json - messages with placeholders have the same number of placeholders - messages must not have newlines embedded | [
"Check",
"that",
"translation",
"is",
"valid",
":",
"entry",
":",
"array",
"[",
"key",
"translation",
"]",
"corresponding",
"to",
"a",
"single",
"string",
"from",
"<locale",
">",
".",
"json",
"-",
"messages",
"with",
"placeholders",
"have",
"the",
"same",
... | 455b2a854435c0a67da1da92320ddc3ec3e2b799 | https://github.com/LLK/scratch-blocks/blob/455b2a854435c0a67da1da92320ddc3ec3e2b799/i18n/create_scratch_msgs.js#L18-L36 | train | Check if entry is a valid key - value pair | [
30522,
3853,
1006,
4443,
1007,
1063,
9530,
3367,
2128,
1027,
1013,
1006,
1003,
1032,
1040,
1007,
1013,
1043,
1025,
9530,
3367,
1031,
3145,
1010,
5449,
1033,
1027,
4443,
1025,
9530,
3367,
4372,
18900,
2818,
1027,
4372,
1031,
3145,
1033,
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/rules/no-func-assign.js | checkReference | function checkReference(references) {
astUtils.getModifyingReferences(references).forEach(reference => {
context.report({ node: reference.identifier, message: "'{{name}}' is a function.", data: { name: reference.identifier.name } });
});
} | javascript | function checkReference(references) {
astUtils.getModifyingReferences(references).forEach(reference => {
context.report({ node: reference.identifier, message: "'{{name}}' is a function.", data: { name: reference.identifier.name } });
});
} | [
"function",
"checkReference",
"(",
"references",
")",
"{",
"astUtils",
".",
"getModifyingReferences",
"(",
"references",
")",
".",
"forEach",
"(",
"reference",
"=>",
"{",
"context",
".",
"report",
"(",
"{",
"node",
":",
"reference",
".",
"identifier",
",",
"... | Reports a reference if is non initializer and writable.
@param {References} references - Collection of reference to check.
@returns {void} | [
"Reports",
"a",
"reference",
"if",
"is",
"non",
"initializer",
"and",
"writable",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/no-func-assign.js#L35-L39 | train | Check that the reference is a function | [
30522,
3853,
4638,
2890,
25523,
1006,
7604,
1007,
1063,
2004,
8525,
3775,
4877,
1012,
2131,
5302,
4305,
14116,
2890,
25523,
2015,
1006,
7604,
1007,
1012,
18921,
6776,
1006,
4431,
1027,
1028,
1063,
6123,
1012,
3189,
1006,
1063,
13045,
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... |
SeleniumHQ/selenium | javascript/selenium-core/scripts/htmlutils.js | getInputValue | function getInputValue(inputElement) {
if (inputElement.type) {
if (inputElement.type.toUpperCase() == 'CHECKBOX' ||
inputElement.type.toUpperCase() == 'RADIO')
{
return (inputElement.checked ? 'on' : 'off');
}
}
if (inputElement.value == null) {
throw new SeleniumError("This element has no value; is it really a form field?");
}
return inputElement.value;
} | javascript | function getInputValue(inputElement) {
if (inputElement.type) {
if (inputElement.type.toUpperCase() == 'CHECKBOX' ||
inputElement.type.toUpperCase() == 'RADIO')
{
return (inputElement.checked ? 'on' : 'off');
}
}
if (inputElement.value == null) {
throw new SeleniumError("This element has no value; is it really a form field?");
}
return inputElement.value;
} | [
"function",
"getInputValue",
"(",
"inputElement",
")",
"{",
"if",
"(",
"inputElement",
".",
"type",
")",
"{",
"if",
"(",
"inputElement",
".",
"type",
".",
"toUpperCase",
"(",
")",
"==",
"'CHECKBOX'",
"||",
"inputElement",
".",
"type",
".",
"toUpperCase",
"... | Get the value of an <input> element | [
"Get",
"the",
"value",
"of",
"an",
"<input",
">",
"element"
] | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/selenium-core/scripts/htmlutils.js#L269-L281 | train | Get the value of an input element | [
30522,
3853,
2131,
2378,
18780,
10175,
5657,
1006,
7953,
12260,
3672,
1007,
1063,
2065,
1006,
7953,
12260,
3672,
1012,
2828,
1007,
1063,
2065,
1006,
7953,
12260,
3672,
1012,
2828,
1012,
2000,
29547,
18992,
3366,
1006,
1007,
1027,
1027,
1005... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/extensibility/node/ExtensionManagerDomain.js | _removeFailedInstallation | function _removeFailedInstallation(installDirectory) {
fs.remove(installDirectory, function (err) {
if (err) {
console.error("Error while removing directory after failed installation", installDirectory, err);
}
});
} | javascript | function _removeFailedInstallation(installDirectory) {
fs.remove(installDirectory, function (err) {
if (err) {
console.error("Error while removing directory after failed installation", installDirectory, err);
}
});
} | [
"function",
"_removeFailedInstallation",
"(",
"installDirectory",
")",
"{",
"fs",
".",
"remove",
"(",
"installDirectory",
",",
"function",
"(",
"err",
")",
"{",
"if",
"(",
"err",
")",
"{",
"console",
".",
"error",
"(",
"\"Error while removing directory after faile... | Private function to remove the installation directory if the installation fails.
This does not call any callbacks. It's assumed that the callback has already been called
and this cleanup routine will do its best to complete in the background. If there's
a problem here, it is simply logged with console.error.
@param {string} installDirectory Directory to remove | [
"Private",
"function",
"to",
"remove",
"the",
"installation",
"directory",
"if",
"the",
"installation",
"fails",
".",
"This",
"does",
"not",
"call",
"any",
"callbacks",
".",
"It",
"s",
"assumed",
"that",
"the",
"callback",
"has",
"already",
"been",
"called",
... | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensibility/node/ExtensionManagerDomain.js#L74-L80 | train | Remove the directory after failed installation | [
30522,
3853,
1035,
6366,
7011,
18450,
7076,
9080,
13490,
1006,
16500,
4305,
2890,
16761,
2100,
1007,
1063,
1042,
2015,
1012,
6366,
1006,
16500,
4305,
2890,
16761,
2100,
1010,
3853,
1006,
9413,
2099,
1007,
1063,
2065,
1006,
9413,
2099,
1007,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/extensions/default/JavaScriptCodeHints/main.js | validIdOrProp | function validIdOrProp(token) {
if (!token) {
return false;
}
if (token.string === ".") {
return true;
}
var type = token.type;
if (type === "variable-2" || type === "variable" || type === "property") {
return true;
}
return false;
} | javascript | function validIdOrProp(token) {
if (!token) {
return false;
}
if (token.string === ".") {
return true;
}
var type = token.type;
if (type === "variable-2" || type === "variable" || type === "property") {
return true;
}
return false;
} | [
"function",
"validIdOrProp",
"(",
"token",
")",
"{",
"if",
"(",
"!",
"token",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"token",
".",
"string",
"===",
"\".\"",
")",
"{",
"return",
"true",
";",
"}",
"var",
"type",
"=",
"token",
".",
"type",
... | helper function to decide if the tokens on the RHS of an assignment
look like an identifier, or member expr. | [
"helper",
"function",
"to",
"decide",
"if",
"the",
"tokens",
"on",
"the",
"RHS",
"of",
"an",
"assignment",
"look",
"like",
"an",
"identifier",
"or",
"member",
"expr",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/JavaScriptCodeHints/main.js#L787-L800 | train | Check if token is valid ID or Prop | [
30522,
3853,
9398,
13820,
14536,
18981,
1006,
19204,
1007,
1063,
2065,
1006,
999,
19204,
1007,
1063,
2709,
6270,
1025,
1065,
2065,
1006,
19204,
1012,
5164,
1027,
1027,
1027,
1000,
1012,
30524,
1000,
1064,
1064,
2828,
1027,
1027,
1027,
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... |
aframevr/aframe | src/core/a-entity.js | checkComponentDefined | function checkComponentDefined (el, name) {
// Check if element contains the component.
if (el.components[name] && el.components[name].attrValue) { return true; }
return isComponentMixedIn(name, el.mixinEls);
} | javascript | function checkComponentDefined (el, name) {
// Check if element contains the component.
if (el.components[name] && el.components[name].attrValue) { return true; }
return isComponentMixedIn(name, el.mixinEls);
} | [
"function",
"checkComponentDefined",
"(",
"el",
",",
"name",
")",
"{",
"// Check if element contains the component.",
"if",
"(",
"el",
".",
"components",
"[",
"name",
"]",
"&&",
"el",
".",
"components",
"[",
"name",
"]",
".",
"attrValue",
")",
"{",
"return",
... | Check if a component is *defined* for an entity, including defaults and mixins.
Does not check whether the component has been *initialized* for an entity.
@param {string} el - Entity.
@param {string} name - Component name.
@returns {boolean} | [
"Check",
"if",
"a",
"component",
"is",
"*",
"defined",
"*",
"for",
"an",
"entity",
"including",
"defaults",
"and",
"mixins",
".",
"Does",
"not",
"check",
"whether",
"the",
"component",
"has",
"been",
"*",
"initialized",
"*",
"for",
"an",
"entity",
"."
] | 24acc78a7299a4cdfe3ef617f4d40ddf6275c992 | https://github.com/aframevr/aframe/blob/24acc78a7299a4cdfe3ef617f4d40ddf6275c992/src/core/a-entity.js#L870-L875 | train | Check if component defined | [
30522,
3853,
4638,
9006,
29513,
3372,
3207,
23460,
2094,
1006,
3449,
1010,
2171,
1007,
1063,
1013,
1013,
4638,
2065,
5783,
3397,
1996,
6922,
1012,
2065,
1006,
3449,
1012,
6177,
1031,
2171,
1033,
1004,
1004,
3449,
1012,
6177,
1031,
2171,
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... |
nhn/tui.editor | src/js/extensions/table/table.js | tableExtension | function tableExtension(editor) {
const {eventManager} = editor;
editor.toMarkOptions = editor.toMarkOptions || {};
editor.toMarkOptions.renderer = toMarkRenderer;
_bindEvents(eventManager);
if (editor.isViewer()) {
return;
}
const wwComponentManager = editor.wwEditor.componentManager;
const popupTableUtils = editor.getUI().getPopupTableUtils();
_addCommands(editor);
_changeWysiwygManagers(wwComponentManager);
if (popupTableUtils) {
mergedTableUI.updateContextMenu(popupTableUtils, eventManager, wwComponentManager.getManager('tableSelection'));
}
} | javascript | function tableExtension(editor) {
const {eventManager} = editor;
editor.toMarkOptions = editor.toMarkOptions || {};
editor.toMarkOptions.renderer = toMarkRenderer;
_bindEvents(eventManager);
if (editor.isViewer()) {
return;
}
const wwComponentManager = editor.wwEditor.componentManager;
const popupTableUtils = editor.getUI().getPopupTableUtils();
_addCommands(editor);
_changeWysiwygManagers(wwComponentManager);
if (popupTableUtils) {
mergedTableUI.updateContextMenu(popupTableUtils, eventManager, wwComponentManager.getManager('tableSelection'));
}
} | [
"function",
"tableExtension",
"(",
"editor",
")",
"{",
"const",
"{",
"eventManager",
"}",
"=",
"editor",
";",
"editor",
".",
"toMarkOptions",
"=",
"editor",
".",
"toMarkOptions",
"||",
"{",
"}",
";",
"editor",
".",
"toMarkOptions",
".",
"renderer",
"=",
"t... | table extension
@param {Editor} editor - editor instance
@ignore | [
"table",
"extension"
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/extensions/table/table.js#L28-L48 | train | Table Extension. | [
30522,
3853,
2795,
10288,
29048,
1006,
3559,
1007,
1063,
9530,
3367,
1063,
2724,
24805,
4590,
1065,
1027,
3559,
1025,
3559,
1012,
3419,
17007,
7361,
9285,
1027,
3559,
1012,
3419,
17007,
7361,
9285,
1064,
1064,
1063,
1065,
1025,
3559,
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/toolbars.js | autoCompleteResults | function autoCompleteResults(controller) {
this._controller = controller;
this._popup = this.getElement({type: "popup"});
this._results = this.getElement({type: "results"});
} | javascript | function autoCompleteResults(controller) {
this._controller = controller;
this._popup = this.getElement({type: "popup"});
this._results = this.getElement({type: "results"});
} | [
"function",
"autoCompleteResults",
"(",
"controller",
")",
"{",
"this",
".",
"_controller",
"=",
"controller",
";",
"this",
".",
"_popup",
"=",
"this",
".",
"getElement",
"(",
"{",
"type",
":",
"\"popup\"",
"}",
")",
";",
"this",
".",
"_results",
"=",
"t... | Constructor
@param {MozmillController} controller
MozMillController of the window to operate on | [
"Constructor"
] | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/toolbars.js#L64-L68 | train | Auto complete results | [
30522,
3853,
8285,
9006,
10814,
3334,
2229,
11314,
2015,
1006,
11486,
1007,
1063,
2023,
1012,
1035,
11486,
1027,
11486,
1025,
2023,
1012,
1035,
3769,
6279,
1027,
30524,
1006,
1063,
2828,
1024,
1000,
3463,
1000,
1065,
1007,
1025,
1065,
102,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/preferences/PreferencesManager.js | _toggleProjectScope | function _toggleProjectScope() {
if (_includeProjectScope() === projectScopeIsIncluded) {
return;
}
if (projectScopeIsIncluded) {
PreferencesImpl.manager.removeFromScopeOrder("project");
} else {
PreferencesImpl.manager.addToScopeOrder("project", "user");
}
projectScopeIsIncluded = !projectScopeIsIncluded;
} | javascript | function _toggleProjectScope() {
if (_includeProjectScope() === projectScopeIsIncluded) {
return;
}
if (projectScopeIsIncluded) {
PreferencesImpl.manager.removeFromScopeOrder("project");
} else {
PreferencesImpl.manager.addToScopeOrder("project", "user");
}
projectScopeIsIncluded = !projectScopeIsIncluded;
} | [
"function",
"_toggleProjectScope",
"(",
")",
"{",
"if",
"(",
"_includeProjectScope",
"(",
")",
"===",
"projectScopeIsIncluded",
")",
"{",
"return",
";",
"}",
"if",
"(",
"projectScopeIsIncluded",
")",
"{",
"PreferencesImpl",
".",
"manager",
".",
"removeFromScopeOrd... | @private
Adds or removes the project Scope as needed based on whether the currently
edited file is within the project. | [
"@private"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/preferences/PreferencesManager.js#L81-L91 | train | Toggles project scope | [
30522,
3853,
1035,
2000,
24679,
21572,
20614,
26127,
1006,
1007,
1063,
2065,
1006,
1035,
2421,
21572,
20614,
26127,
1006,
1007,
1027,
1027,
1027,
3934,
16186,
17417,
12273,
7630,
5732,
1007,
1063,
2709,
1025,
1065,
2065,
1006,
3934,
16186,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
thomaspark/bootswatch | docs/3/bower_components/html5shiv/dist/html5shiv-printshiv.js | addWrappers | function addWrappers(ownerDocument) {
var node,
nodes = ownerDocument.getElementsByTagName('*'),
index = nodes.length,
reElements = RegExp('^(?:' + getElements().join('|') + ')$', 'i'),
result = [];
while (index--) {
node = nodes[index];
if (reElements.test(node.nodeName)) {
result.push(node.applyElement(createWrapper(node)));
}
}
return result;
} | javascript | function addWrappers(ownerDocument) {
var node,
nodes = ownerDocument.getElementsByTagName('*'),
index = nodes.length,
reElements = RegExp('^(?:' + getElements().join('|') + ')$', 'i'),
result = [];
while (index--) {
node = nodes[index];
if (reElements.test(node.nodeName)) {
result.push(node.applyElement(createWrapper(node)));
}
}
return result;
} | [
"function",
"addWrappers",
"(",
"ownerDocument",
")",
"{",
"var",
"node",
",",
"nodes",
"=",
"ownerDocument",
".",
"getElementsByTagName",
"(",
"'*'",
")",
",",
"index",
"=",
"nodes",
".",
"length",
",",
"reElements",
"=",
"RegExp",
"(",
"'^(?:'",
"+",
"ge... | /*--------------------------------------------------------------------------
Wraps all HTML5 elements in the given document with printable elements.
(eg. the "header" element is wrapped with the "html5shiv:header" element)
@private
@param {Document} ownerDocument The document.
@returns {Array} An array wrappers added. | [
"/",
"*",
"--------------------------------------------------------------------------",
"Wraps",
"all",
"HTML5",
"elements",
"in",
"the",
"given",
"document",
"with",
"printable",
"elements",
".",
"(",
"eg",
".",
"the",
"header",
"element",
"is",
"wrapped",
"with",
"t... | a913e4992dad8f7bf38df2e1d3f4cc6bfe5f26dd | https://github.com/thomaspark/bootswatch/blob/a913e4992dad8f7bf38df2e1d3f4cc6bfe5f26dd/docs/3/bower_components/html5shiv/dist/html5shiv-printshiv.js#L352-L366 | train | Adds all the wrapper elements to the document | [
30522,
3853,
5587,
13088,
29098,
2545,
1006,
3954,
3527,
24894,
4765,
1007,
1063,
13075,
13045,
1010,
14164,
1027,
3954,
3527,
24894,
4765,
1012,
2131,
12260,
8163,
3762,
15900,
18442,
1006,
1005,
1008,
1005,
1007,
1010,
5950,
1027,
14164,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
mochajs/mocha | lib/reporters/html.js | fragment | function fragment(html) {
var args = arguments;
var div = document.createElement('div');
var i = 1;
div.innerHTML = html.replace(/%([se])/g, function(_, type) {
switch (type) {
case 's':
return String(args[i++]);
case 'e':
return escape(args[i++]);
// no default
}
});
return div.firstChild;
} | javascript | function fragment(html) {
var args = arguments;
var div = document.createElement('div');
var i = 1;
div.innerHTML = html.replace(/%([se])/g, function(_, type) {
switch (type) {
case 's':
return String(args[i++]);
case 'e':
return escape(args[i++]);
// no default
}
});
return div.firstChild;
} | [
"function",
"fragment",
"(",
"html",
")",
"{",
"var",
"args",
"=",
"arguments",
";",
"var",
"div",
"=",
"document",
".",
"createElement",
"(",
"'div'",
")",
";",
"var",
"i",
"=",
"1",
";",
"div",
".",
"innerHTML",
"=",
"html",
".",
"replace",
"(",
... | Return a DOM fragment from `html`.
@param {string} html | [
"Return",
"a",
"DOM",
"fragment",
"from",
"html",
"."
] | 9b00fedb610241e33f7592c40164e42a38a793cf | https://github.com/mochajs/mocha/blob/9b00fedb610241e33f7592c40164e42a38a793cf/lib/reporters/html.js#L321-L337 | train | fragment - fragment | [
30522,
3853,
15778,
1006,
16129,
1007,
1063,
13075,
12098,
5620,
1027,
9918,
1025,
13075,
4487,
2615,
1027,
6254,
1012,
3443,
12260,
3672,
1006,
1005,
4487,
2615,
1005,
1007,
1025,
13075,
1045,
1027,
1015,
1025,
4487,
2615,
1012,
5110,
1103... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.