repo stringclasses 195 values | path stringlengths 4 99 | func_name stringlengths 0 41 | original_string stringlengths 72 56.1k | language stringclasses 1 value | code stringlengths 72 56.1k | code_tokens listlengths 25 8.12k | docstring stringlengths 2 12.5k | docstring_tokens listlengths 1 449 | sha stringclasses 197 values | url stringlengths 88 186 | partition stringclasses 1 value | summary stringlengths 8 338 | input_ids listlengths 502 502 | token_type_ids listlengths 502 502 | attention_mask listlengths 502 502 | labels listlengths 502 502 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
SAP/openui5 | src/sap.ui.unified/src/sap/ui/unified/calendar/Month.js | _updateSelection | function _updateSelection(aStartDate, oEndDate){
if (!Array.isArray(aStartDate)) {
aStartDate = [aStartDate];
}
var aDomRefs = this._oItemNavigation.getItemDomRefs();
var $DomRef;
var i = 0;
var bStart = false;
var bEnd = false;
if (!oEndDate) {
// start of interval, single date or multiple dates
var aCalFormattedStartDates = aStartDate.map(function(oSD) {
return this._oFormatYyyymmdd.format(oSD.toUTCJSDate(), true);
}, this);
for ( i = 0; i < aDomRefs.length; i++) {
$DomRef = jQuery(aDomRefs[i]);
bStart = false;
bEnd = false;
if (aCalFormattedStartDates.indexOf($DomRef.attr("data-sap-day")) > -1) {
$DomRef.addClass("sapUiCalItemSel");
$DomRef.attr("aria-selected", "true");
bStart = true;
} else if ($DomRef.hasClass("sapUiCalItemSel")) {
$DomRef.removeClass("sapUiCalItemSel");
$DomRef.attr("aria-selected", "false");
}
if ($DomRef.hasClass("sapUiCalItemSelStart")) {
$DomRef.removeClass("sapUiCalItemSelStart");
} else if ($DomRef.hasClass("sapUiCalItemSelBetween")) {
$DomRef.removeClass("sapUiCalItemSelBetween");
} else if ($DomRef.hasClass("sapUiCalItemSelEnd")) {
$DomRef.removeClass("sapUiCalItemSelEnd");
}
_updateARIADesrcibedby.call(this, $DomRef, bStart, bEnd);
}
} else {
var oDay;
for ( i = 0; i < aDomRefs.length; i++) {
$DomRef = jQuery(aDomRefs[i]);
bStart = false;
bEnd = false;
oDay = CalendarDate.fromLocalJSDate(this._oFormatYyyymmdd.parse($DomRef.attr("data-sap-day")), CalendarType.Gregorian);
if (oDay.isSame(aStartDate[0])) {
$DomRef.addClass("sapUiCalItemSelStart");
bStart = true;
$DomRef.addClass("sapUiCalItemSel");
$DomRef.attr("aria-selected", "true");
if (oEndDate && oDay.isSame(oEndDate)) {
// start day and end day are the same
$DomRef.addClass("sapUiCalItemSelEnd");
bEnd = true;
}
$DomRef.removeClass("sapUiCalItemSelBetween");
} else if (oEndDate && CalendarUtils._isBetween(oDay, aStartDate[0], oEndDate)) {
$DomRef.addClass("sapUiCalItemSel");
$DomRef.attr("aria-selected", "true");
$DomRef.addClass("sapUiCalItemSelBetween");
$DomRef.removeClass("sapUiCalItemSelStart");
$DomRef.removeClass("sapUiCalItemSelEnd");
} else if (oEndDate && oDay.isSame(oEndDate)) {
$DomRef.addClass("sapUiCalItemSelEnd");
bEnd = true;
$DomRef.addClass("sapUiCalItemSel");
$DomRef.attr("aria-selected", "true");
$DomRef.removeClass("sapUiCalItemSelStart");
$DomRef.removeClass("sapUiCalItemSelBetween");
} else {
if ($DomRef.hasClass("sapUiCalItemSel")) {
$DomRef.removeClass("sapUiCalItemSel");
$DomRef.attr("aria-selected", "false");
}
if ($DomRef.hasClass("sapUiCalItemSelStart")) {
$DomRef.removeClass("sapUiCalItemSelStart");
} else if ($DomRef.hasClass("sapUiCalItemSelBetween")) {
$DomRef.removeClass("sapUiCalItemSelBetween");
} else if ($DomRef.hasClass("sapUiCalItemSelEnd")) {
$DomRef.removeClass("sapUiCalItemSelEnd");
}
}
_updateARIADesrcibedby.call(this, $DomRef, bStart, bEnd);
}
}
} | javascript | function _updateSelection(aStartDate, oEndDate){
if (!Array.isArray(aStartDate)) {
aStartDate = [aStartDate];
}
var aDomRefs = this._oItemNavigation.getItemDomRefs();
var $DomRef;
var i = 0;
var bStart = false;
var bEnd = false;
if (!oEndDate) {
// start of interval, single date or multiple dates
var aCalFormattedStartDates = aStartDate.map(function(oSD) {
return this._oFormatYyyymmdd.format(oSD.toUTCJSDate(), true);
}, this);
for ( i = 0; i < aDomRefs.length; i++) {
$DomRef = jQuery(aDomRefs[i]);
bStart = false;
bEnd = false;
if (aCalFormattedStartDates.indexOf($DomRef.attr("data-sap-day")) > -1) {
$DomRef.addClass("sapUiCalItemSel");
$DomRef.attr("aria-selected", "true");
bStart = true;
} else if ($DomRef.hasClass("sapUiCalItemSel")) {
$DomRef.removeClass("sapUiCalItemSel");
$DomRef.attr("aria-selected", "false");
}
if ($DomRef.hasClass("sapUiCalItemSelStart")) {
$DomRef.removeClass("sapUiCalItemSelStart");
} else if ($DomRef.hasClass("sapUiCalItemSelBetween")) {
$DomRef.removeClass("sapUiCalItemSelBetween");
} else if ($DomRef.hasClass("sapUiCalItemSelEnd")) {
$DomRef.removeClass("sapUiCalItemSelEnd");
}
_updateARIADesrcibedby.call(this, $DomRef, bStart, bEnd);
}
} else {
var oDay;
for ( i = 0; i < aDomRefs.length; i++) {
$DomRef = jQuery(aDomRefs[i]);
bStart = false;
bEnd = false;
oDay = CalendarDate.fromLocalJSDate(this._oFormatYyyymmdd.parse($DomRef.attr("data-sap-day")), CalendarType.Gregorian);
if (oDay.isSame(aStartDate[0])) {
$DomRef.addClass("sapUiCalItemSelStart");
bStart = true;
$DomRef.addClass("sapUiCalItemSel");
$DomRef.attr("aria-selected", "true");
if (oEndDate && oDay.isSame(oEndDate)) {
// start day and end day are the same
$DomRef.addClass("sapUiCalItemSelEnd");
bEnd = true;
}
$DomRef.removeClass("sapUiCalItemSelBetween");
} else if (oEndDate && CalendarUtils._isBetween(oDay, aStartDate[0], oEndDate)) {
$DomRef.addClass("sapUiCalItemSel");
$DomRef.attr("aria-selected", "true");
$DomRef.addClass("sapUiCalItemSelBetween");
$DomRef.removeClass("sapUiCalItemSelStart");
$DomRef.removeClass("sapUiCalItemSelEnd");
} else if (oEndDate && oDay.isSame(oEndDate)) {
$DomRef.addClass("sapUiCalItemSelEnd");
bEnd = true;
$DomRef.addClass("sapUiCalItemSel");
$DomRef.attr("aria-selected", "true");
$DomRef.removeClass("sapUiCalItemSelStart");
$DomRef.removeClass("sapUiCalItemSelBetween");
} else {
if ($DomRef.hasClass("sapUiCalItemSel")) {
$DomRef.removeClass("sapUiCalItemSel");
$DomRef.attr("aria-selected", "false");
}
if ($DomRef.hasClass("sapUiCalItemSelStart")) {
$DomRef.removeClass("sapUiCalItemSelStart");
} else if ($DomRef.hasClass("sapUiCalItemSelBetween")) {
$DomRef.removeClass("sapUiCalItemSelBetween");
} else if ($DomRef.hasClass("sapUiCalItemSelEnd")) {
$DomRef.removeClass("sapUiCalItemSelEnd");
}
}
_updateARIADesrcibedby.call(this, $DomRef, bStart, bEnd);
}
}
} | [
"function",
"_updateSelection",
"(",
"aStartDate",
",",
"oEndDate",
")",
"{",
"if",
"(",
"!",
"Array",
".",
"isArray",
"(",
"aStartDate",
")",
")",
"{",
"aStartDate",
"=",
"[",
"aStartDate",
"]",
";",
"}",
"var",
"aDomRefs",
"=",
"this",
".",
"_oItemNavi... | /*
Toggles the selected class for the currently selected date.
@param {sap.ui.unified.calendar.CalendarDate[]} aStartDate multiple selected dates or a single start date of a range
@param {sap.ui.unified.calendar.CalendarDate} oEndDate end of a range
@private | [
"/",
"*",
"Toggles",
"the",
"selected",
"class",
"for",
"the",
"currently",
"selected",
"date",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.unified/src/sap/ui/unified/calendar/Month.js#L2180-L2265 | train | Updates the aria - selected class of the selected item | [
30522,
3853,
1035,
14409,
12260,
7542,
1006,
2004,
7559,
2102,
13701,
1010,
1051,
10497,
13701,
1007,
1063,
2065,
1006,
999,
9140,
1012,
18061,
11335,
2100,
1006,
2004,
7559,
2102,
13701,
1007,
1007,
1063,
2004,
7559,
2102,
13701,
1027,
103... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/spaced-comment.js | reportEnd | function reportEnd(node, message, match) {
context.report({
node,
fix(fixer) {
if (requireSpace) {
return fixer.insertTextAfterRange([node.range[0], node.range[1] - 2], " ");
}
const end = node.range[1] - 2,
start = end - match[0].length;
return fixer.replaceTextRange([start, end], "");
},
message
});
} | javascript | function reportEnd(node, message, match) {
context.report({
node,
fix(fixer) {
if (requireSpace) {
return fixer.insertTextAfterRange([node.range[0], node.range[1] - 2], " ");
}
const end = node.range[1] - 2,
start = end - match[0].length;
return fixer.replaceTextRange([start, end], "");
},
message
});
} | [
"function",
"reportEnd",
"(",
"node",
",",
"message",
",",
"match",
")",
"{",
"context",
".",
"report",
"(",
"{",
"node",
",",
"fix",
"(",
"fixer",
")",
"{",
"if",
"(",
"requireSpace",
")",
"{",
"return",
"fixer",
".",
"insertTextAfterRange",
"(",
"[",... | Reports an ending spacing error with an appropriate message.
@param {ASTNode} node - A comment node to check.
@param {string} message - An error message to report.
@param {string} match - An array of the matched whitespace characters.
@returns {void} | [
"Reports",
"an",
"ending",
"spacing",
"error",
"with",
"an",
"appropriate",
"message",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/spaced-comment.js#L301-L316 | train | Reports the end of a match | [
30522,
3853,
3189,
10497,
1006,
13045,
1010,
4471,
1010,
2674,
1007,
1063,
6123,
1012,
3189,
1006,
1063,
13045,
1010,
8081,
1006,
30524,
1012,
2846,
1031,
1015,
1033,
1011,
1016,
1010,
2707,
1027,
2203,
1011,
2674,
1031,
1014,
1033,
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... |
openlayers/openlayers | src/ol/format/TopoJSON.js | transformArcs | function transformArcs(arcs, scale, translate) {
for (let i = 0, ii = arcs.length; i < ii; ++i) {
transformArc(arcs[i], scale, translate);
}
} | javascript | function transformArcs(arcs, scale, translate) {
for (let i = 0, ii = arcs.length; i < ii; ++i) {
transformArc(arcs[i], scale, translate);
}
} | [
"function",
"transformArcs",
"(",
"arcs",
",",
"scale",
",",
"translate",
")",
"{",
"for",
"(",
"let",
"i",
"=",
"0",
",",
"ii",
"=",
"arcs",
".",
"length",
";",
"i",
"<",
"ii",
";",
"++",
"i",
")",
"{",
"transformArc",
"(",
"arcs",
"[",
"i",
"... | Apply a linear transform to array of arcs. The provided array of arcs is
modified in place.
@param {Array<Array<import("../coordinate.js").Coordinate>>} arcs Array of arcs.
@param {Array<number>} scale Scale for each dimension.
@param {Array<number>} translate Translation for each dimension. | [
"Apply",
"a",
"linear",
"transform",
"to",
"array",
"of",
"arcs",
".",
"The",
"provided",
"array",
"of",
"arcs",
"is",
"modified",
"in",
"place",
"."
] | f366eaea522388fb575b11010e69d309164baca7 | https://github.com/openlayers/openlayers/blob/f366eaea522388fb575b11010e69d309164baca7/src/ol/format/TopoJSON.js#L367-L371 | train | Transform an array of arcs | [
30522,
3853,
10938,
2906,
6169,
1006,
29137,
1010,
4094,
1010,
17637,
1007,
1063,
2005,
1006,
2292,
1045,
1027,
1014,
1010,
2462,
1027,
29137,
1012,
3091,
1025,
1045,
1026,
2462,
1025,
1009,
1009,
1045,
1007,
1063,
10938,
2906,
2278,
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... |
adobe/brackets | src/search/FindInFilesUI.js | searchAndShowResults | function searchAndShowResults(queryInfo, scope, filter, replaceText, candidateFilesPromise) {
return FindInFiles.doSearchInScope(queryInfo, scope, filter, replaceText, candidateFilesPromise)
.done(function (zeroFilesToken) {
// Done searching all files: show results
if (FindInFiles.searchModel.hasResults()) {
_resultsView.open();
if (_findBar) {
_findBar.enable(true);
_findBar.focus();
}
} else {
_resultsView.close();
if (_findBar) {
var showMessage = false;
_findBar.enable(true);
if (zeroFilesToken === FindInFiles.ZERO_FILES_TO_SEARCH) {
_findBar.showError(StringUtils.format(Strings.FIND_IN_FILES_ZERO_FILES,
FindUtils.labelForScope(FindInFiles.searchModel.scope)), true);
} else {
showMessage = true;
}
_findBar.showNoResults(true, showMessage);
}
}
StatusBar.hideBusyIndicator();
})
.fail(function (err) {
console.log("find in files failed: ", err);
StatusBar.hideBusyIndicator();
});
} | javascript | function searchAndShowResults(queryInfo, scope, filter, replaceText, candidateFilesPromise) {
return FindInFiles.doSearchInScope(queryInfo, scope, filter, replaceText, candidateFilesPromise)
.done(function (zeroFilesToken) {
// Done searching all files: show results
if (FindInFiles.searchModel.hasResults()) {
_resultsView.open();
if (_findBar) {
_findBar.enable(true);
_findBar.focus();
}
} else {
_resultsView.close();
if (_findBar) {
var showMessage = false;
_findBar.enable(true);
if (zeroFilesToken === FindInFiles.ZERO_FILES_TO_SEARCH) {
_findBar.showError(StringUtils.format(Strings.FIND_IN_FILES_ZERO_FILES,
FindUtils.labelForScope(FindInFiles.searchModel.scope)), true);
} else {
showMessage = true;
}
_findBar.showNoResults(true, showMessage);
}
}
StatusBar.hideBusyIndicator();
})
.fail(function (err) {
console.log("find in files failed: ", err);
StatusBar.hideBusyIndicator();
});
} | [
"function",
"searchAndShowResults",
"(",
"queryInfo",
",",
"scope",
",",
"filter",
",",
"replaceText",
",",
"candidateFilesPromise",
")",
"{",
"return",
"FindInFiles",
".",
"doSearchInScope",
"(",
"queryInfo",
",",
"scope",
",",
"filter",
",",
"replaceText",
",",
... | Does a search in the given scope with the given filter. Shows the result list once the search is complete.
@param {{query: string, caseSensitive: boolean, isRegexp: boolean}} queryInfo Query info object
@param {?Entry} scope Project file/subfolder to search within; else searches whole project.
@param {?string} filter A "compiled" filter as returned by FileFilters.compile(), or null for no filter
@param {?string} replaceText If this is a replacement, the text to replace matches with.
@param {?$.Promise} candidateFilesPromise If specified, a promise that should resolve with the same set of files that
getCandidateFiles(scope) would return.
@return {$.Promise} A promise that's resolved with the search results or rejected when the find competes. | [
"Does",
"a",
"search",
"in",
"the",
"given",
"scope",
"with",
"the",
"given",
"filter",
".",
"Shows",
"the",
"result",
"list",
"once",
"the",
"search",
"is",
"complete",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/search/FindInFilesUI.js#L81-L115 | train | Search and show results | [
30522,
3853,
3945,
29560,
14406,
6072,
11314,
2015,
1006,
23032,
2378,
14876,
1010,
9531,
1010,
11307,
1010,
5672,
18209,
1010,
4018,
8873,
4244,
21572,
28732,
1007,
1063,
2709,
2424,
2378,
8873,
4244,
1012,
13004,
2906,
17231,
26127,
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.table/src/sap/ui/table/CreationRow.js | createDefaultToolbar | function createDefaultToolbar(oCreationRow) {
return new OverflowToolbar({
content: [
new ToolbarSpacer(),
new Button({
text: TableUtils.getResourceText("TBL_CREATIONROW_APPLY"),
type: MLibrary.ButtonType.Emphasized,
enabled: oCreationRow.getApplyEnabled(),
press: function() {
oCreationRow._fireApply();
}
})
],
style: MLibrary.ToolbarStyle.Clear,
ariaLabelledBy: [oCreationRow.getId() + "-label"]
});
} | javascript | function createDefaultToolbar(oCreationRow) {
return new OverflowToolbar({
content: [
new ToolbarSpacer(),
new Button({
text: TableUtils.getResourceText("TBL_CREATIONROW_APPLY"),
type: MLibrary.ButtonType.Emphasized,
enabled: oCreationRow.getApplyEnabled(),
press: function() {
oCreationRow._fireApply();
}
})
],
style: MLibrary.ToolbarStyle.Clear,
ariaLabelledBy: [oCreationRow.getId() + "-label"]
});
} | [
"function",
"createDefaultToolbar",
"(",
"oCreationRow",
")",
"{",
"return",
"new",
"OverflowToolbar",
"(",
"{",
"content",
":",
"[",
"new",
"ToolbarSpacer",
"(",
")",
",",
"new",
"Button",
"(",
"{",
"text",
":",
"TableUtils",
".",
"getResourceText",
"(",
"\... | Creates a default toolbar providing basic buttons and functionality.
@param {sap.ui.table.CreationRow} oCreationRow The creation row to get the settings for the toolbar creation from.
@returns {sap.m.OverflowToolbar} The default toolbar. | [
"Creates",
"a",
"default",
"toolbar",
"providing",
"basic",
"buttons",
"and",
"functionality",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/CreationRow.js#L165-L181 | train | Creates a toolbar for the given creation row. | [
30522,
3853,
2580,
12879,
23505,
3406,
4747,
8237,
1006,
1051,
16748,
3370,
10524,
1007,
1063,
2709,
2047,
2058,
12314,
3406,
4747,
8237,
1006,
1063,
4180,
1024,
1031,
2047,
6994,
8237,
23058,
2099,
1006,
1007,
1010,
2047,
6462,
1006,
1063,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/extensions/default/CodeFolding/main.js | onGutterClick | function onGutterClick(cm, line, gutter, event) {
var opts = cm.state.foldGutter.options, pos = CodeMirror.Pos(line);
if (gutter !== opts.gutter) { return; }
var range;
var _lineFolds = cm._lineFolds;
if (cm.isFolded(line)) {
if (event.altKey) { // unfold code including children
range = _lineFolds[line];
CodeMirror.commands.unfoldAll(cm, range.from.line, range.to.line);
} else {
cm.unfoldCode(line, {range: _lineFolds[line]});
}
} else {
if (event.altKey) {
range = CodeMirror.fold.auto(cm, pos);
if (range) {
CodeMirror.commands.foldToLevel(cm, range.from.line, range.to.line);
}
} else {
cm.foldCode(line);
}
}
} | javascript | function onGutterClick(cm, line, gutter, event) {
var opts = cm.state.foldGutter.options, pos = CodeMirror.Pos(line);
if (gutter !== opts.gutter) { return; }
var range;
var _lineFolds = cm._lineFolds;
if (cm.isFolded(line)) {
if (event.altKey) { // unfold code including children
range = _lineFolds[line];
CodeMirror.commands.unfoldAll(cm, range.from.line, range.to.line);
} else {
cm.unfoldCode(line, {range: _lineFolds[line]});
}
} else {
if (event.altKey) {
range = CodeMirror.fold.auto(cm, pos);
if (range) {
CodeMirror.commands.foldToLevel(cm, range.from.line, range.to.line);
}
} else {
cm.foldCode(line);
}
}
} | [
"function",
"onGutterClick",
"(",
"cm",
",",
"line",
",",
"gutter",
",",
"event",
")",
"{",
"var",
"opts",
"=",
"cm",
".",
"state",
".",
"foldGutter",
".",
"options",
",",
"pos",
"=",
"CodeMirror",
".",
"Pos",
"(",
"line",
")",
";",
"if",
"(",
"gut... | Event handler for gutter click. Manages folding and unfolding code regions. If the Alt key
is pressed while clicking the fold gutter, child code fragments are also folded/unfolded
up to a level defined in the `maxFoldLevel' preference.
@param {!CodeMirror} cm the CodeMirror object
@param {number} line the line number for the clicked gutter
@param {string} gutter the name of the gutter element clicked
@param {!KeyboardEvent} event the underlying dom event triggered for the gutter click | [
"Event",
"handler",
"for",
"gutter",
"click",
".",
"Manages",
"folding",
"and",
"unfolding",
"code",
"regions",
".",
"If",
"the",
"Alt",
"key",
"is",
"pressed",
"while",
"clicking",
"the",
"fold",
"gutter",
"child",
"code",
"fragments",
"are",
"also",
"folde... | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/CodeFolding/main.js#L182-L204 | train | On gutter click | [
30522,
3853,
2006,
27920,
3334,
20464,
6799,
1006,
4642,
1010,
2240,
1010,
9535,
3334,
1010,
2724,
1007,
1063,
13075,
23569,
2015,
1027,
4642,
1012,
2110,
1012,
10671,
27920,
3334,
1012,
7047,
1010,
13433,
2015,
1027,
3642,
14503,
29165,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/core/LocaleData.js | function(sPattern, sCalendarType) {
var oIntervalFormats = this._get(getCLDRCalendarName(sCalendarType), "dateTimeFormats", "intervalFormats"),
sFallbackPattern = oIntervalFormats.intervalFormatFallback;
return sFallbackPattern.replace(/\{(0|1)\}/g, sPattern);
} | javascript | function(sPattern, sCalendarType) {
var oIntervalFormats = this._get(getCLDRCalendarName(sCalendarType), "dateTimeFormats", "intervalFormats"),
sFallbackPattern = oIntervalFormats.intervalFormatFallback;
return sFallbackPattern.replace(/\{(0|1)\}/g, sPattern);
} | [
"function",
"(",
"sPattern",
",",
"sCalendarType",
")",
"{",
"var",
"oIntervalFormats",
"=",
"this",
".",
"_get",
"(",
"getCLDRCalendarName",
"(",
"sCalendarType",
")",
",",
"\"dateTimeFormats\"",
",",
"\"intervalFormats\"",
")",
",",
"sFallbackPattern",
"=",
"oIn... | Get combined interval pattern using a given pattern and the fallback interval pattern.
If a skeleton based pattern is not available or not wanted, this method can be used to create an interval
pattern based on a given pattern, using the fallback interval pattern.
@param {string} sPattern the single date pattern to use within the interval pattern
@param {sap.ui.core.CalendarType} [sCalendarType] the type of calendar. If it's not set, it falls back to the calendar type either set in configuration or calculated from locale.
@returns {string} the calculated interval pattern
@since 1.46
@public | [
"Get",
"combined",
"interval",
"pattern",
"using",
"a",
"given",
"pattern",
"and",
"the",
"fallback",
"interval",
"pattern",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/LocaleData.js#L319-L323 | train | Returns the pattern to be used for the interval format | [
30522,
3853,
1006,
14690,
16451,
1010,
4094,
8943,
5339,
18863,
1007,
1063,
13075,
1051,
18447,
2121,
10175,
14192,
11149,
1027,
2023,
1012,
1035,
2131,
1006,
2131,
20464,
13626,
9289,
10497,
2906,
18442,
1006,
4094,
8943,
5339,
18863,
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... | |
apache/incubator-echarts | src/chart/helper/Symbol.js | getLabelDefaultText | function getLabelDefaultText(idx, opt) {
return useNameLabel ? data.getName(idx) : getDefaultLabel(data, idx);
} | javascript | function getLabelDefaultText(idx, opt) {
return useNameLabel ? data.getName(idx) : getDefaultLabel(data, idx);
} | [
"function",
"getLabelDefaultText",
"(",
"idx",
",",
"opt",
")",
"{",
"return",
"useNameLabel",
"?",
"data",
".",
"getName",
"(",
"idx",
")",
":",
"getDefaultLabel",
"(",
"data",
",",
"idx",
")",
";",
"}"
] | Do not execute util needed. | [
"Do",
"not",
"execute",
"util",
"needed",
"."
] | 4d0ea095dc3929cb6de40c45748826e7999c7aa8 | https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/chart/helper/Symbol.js#L320-L322 | train | Get the default text for a given index | [
30522,
3853,
2131,
20470,
14273,
12879,
23505,
18209,
1006,
8909,
2595,
1010,
23569,
1007,
1063,
2709,
2224,
18442,
20470,
2884,
1029,
2951,
1012,
2131,
18442,
1006,
8909,
2595,
1007,
1024,
2131,
3207,
7011,
11314,
20470,
2884,
1006,
2951,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
eslint/eslint | lib/rules/require-atomic-updates.js | isLocalVariableWithoutEscape | function isLocalVariableWithoutEscape(expression, surroundingFunction) {
if (expression.type !== "Identifier") {
return false;
}
const variable = resolveVariable(expression);
if (!variable) {
return false;
}
return variable.references.every(reference => identifierToSurroundingFunctionMap.get(reference.identifier) === surroundingFunction) &&
variable.defs.every(def => identifierToSurroundingFunctionMap.get(def.name) === surroundingFunction);
} | javascript | function isLocalVariableWithoutEscape(expression, surroundingFunction) {
if (expression.type !== "Identifier") {
return false;
}
const variable = resolveVariable(expression);
if (!variable) {
return false;
}
return variable.references.every(reference => identifierToSurroundingFunctionMap.get(reference.identifier) === surroundingFunction) &&
variable.defs.every(def => identifierToSurroundingFunctionMap.get(def.name) === surroundingFunction);
} | [
"function",
"isLocalVariableWithoutEscape",
"(",
"expression",
",",
"surroundingFunction",
")",
"{",
"if",
"(",
"expression",
".",
"type",
"!==",
"\"Identifier\"",
")",
"{",
"return",
"false",
";",
"}",
"const",
"variable",
"=",
"resolveVariable",
"(",
"expression... | Checks if an expression is a variable that can only be observed within the given function.
@param {ASTNode} expression The expression to check
@param {ASTNode} surroundingFunction The function node
@returns {boolean} `true` if the expression is a variable which is local to the given function, and is never
referenced in a closure. | [
"Checks",
"if",
"an",
"expression",
"is",
"a",
"variable",
"that",
"can",
"only",
"be",
"observed",
"within",
"the",
"given",
"function",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/require-atomic-updates.js#L96-L109 | train | Check if expression is local variable without escaping | [
30522,
3853,
2003,
4135,
9289,
10755,
19210,
24415,
5833,
2229,
19464,
1006,
3670,
1010,
4193,
11263,
27989,
1007,
1063,
2065,
1006,
3670,
1012,
2828,
999,
1027,
1027,
1000,
8909,
4765,
18095,
1000,
1007,
1063,
2709,
6270,
1025,
1065,
9530,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/LiveDevelopment/Inspector/Inspector.js | connectToURL | function connectToURL(url) {
if (_connectDeferred) {
// reject an existing connection attempt
_connectDeferred.reject("CANCEL");
}
var deferred = new $.Deferred();
_connectDeferred = deferred;
var promise = getDebuggableWindows();
promise.done(function onGetAvailableSockets(response) {
var i, page;
for (i in response) {
page = response[i];
if (page.webSocketDebuggerUrl && page.url.indexOf(url) === 0) {
connect(page.webSocketDebuggerUrl);
// _connectDeferred may be resolved by onConnect or rejected by onError
return;
}
}
deferred.reject(FileError.ERR_NOT_FOUND); // Reject with a "not found" error
});
promise.fail(function onFail(err) {
deferred.reject(err);
});
return deferred.promise();
} | javascript | function connectToURL(url) {
if (_connectDeferred) {
// reject an existing connection attempt
_connectDeferred.reject("CANCEL");
}
var deferred = new $.Deferred();
_connectDeferred = deferred;
var promise = getDebuggableWindows();
promise.done(function onGetAvailableSockets(response) {
var i, page;
for (i in response) {
page = response[i];
if (page.webSocketDebuggerUrl && page.url.indexOf(url) === 0) {
connect(page.webSocketDebuggerUrl);
// _connectDeferred may be resolved by onConnect or rejected by onError
return;
}
}
deferred.reject(FileError.ERR_NOT_FOUND); // Reject with a "not found" error
});
promise.fail(function onFail(err) {
deferred.reject(err);
});
return deferred.promise();
} | [
"function",
"connectToURL",
"(",
"url",
")",
"{",
"if",
"(",
"_connectDeferred",
")",
"{",
"// reject an existing connection attempt",
"_connectDeferred",
".",
"reject",
"(",
"\"CANCEL\"",
")",
";",
"}",
"var",
"deferred",
"=",
"new",
"$",
".",
"Deferred",
"(",
... | Connect to the remote debugger of the page that is at the given URL
@param {string} url | [
"Connect",
"to",
"the",
"remote",
"debugger",
"of",
"the",
"page",
"that",
"is",
"at",
"the",
"given",
"URL"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/LiveDevelopment/Inspector/Inspector.js#L321-L345 | train | Connect to a remote URL | [
30522,
3853,
7532,
21163,
2140,
1006,
24471,
2140,
1007,
1063,
2065,
1006,
1035,
7532,
3207,
7512,
5596,
1007,
1063,
1013,
1013,
15454,
2019,
4493,
4434,
3535,
1035,
7532,
3207,
7512,
5596,
1012,
15454,
1006,
1000,
17542,
1000,
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... |
aws-amplify/amplify-js | packages/amazon-cognito-identity-js/src/BigInteger.js | montMulTo | function montMulTo(x, y, r) {
x.multiplyTo(y, r);
this.reduce(r);
} | javascript | function montMulTo(x, y, r) {
x.multiplyTo(y, r);
this.reduce(r);
} | [
"function",
"montMulTo",
"(",
"x",
",",
"y",
",",
"r",
")",
"{",
"x",
".",
"multiplyTo",
"(",
"y",
",",
"r",
")",
";",
"this",
".",
"reduce",
"(",
"r",
")",
";",
"}"
] | r = "xy/R mod m"; x,y != r | [
"r",
"=",
"xy",
"/",
"R",
"mod",
"m",
";",
"x",
"y",
"!",
"=",
"r"
] | db55ff3dff31c64a246180f39eb0a04a89fd16e1 | https://github.com/aws-amplify/amplify-js/blob/db55ff3dff31c64a246180f39eb0a04a89fd16e1/packages/amazon-cognito-identity-js/src/BigInteger.js#L672-L676 | train | multiply x by y and return the result | [
30522,
3853,
18318,
12274,
23223,
1006,
1060,
1010,
1061,
1010,
1054,
1007,
1063,
1060,
1012,
4800,
22086,
3406,
1006,
1061,
1010,
1054,
1007,
1025,
2023,
1012,
5547,
1006,
1054,
1007,
1025,
1065,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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-var.js | hasSelfReferenceInTDZ | function hasSelfReferenceInTDZ(declarator) {
if (!declarator.init) {
return false;
}
const variables = context.getDeclaredVariables(declarator);
return variables.some(hasReferenceInTDZ(declarator.init));
} | javascript | function hasSelfReferenceInTDZ(declarator) {
if (!declarator.init) {
return false;
}
const variables = context.getDeclaredVariables(declarator);
return variables.some(hasReferenceInTDZ(declarator.init));
} | [
"function",
"hasSelfReferenceInTDZ",
"(",
"declarator",
")",
"{",
"if",
"(",
"!",
"declarator",
".",
"init",
")",
"{",
"return",
"false",
";",
"}",
"const",
"variables",
"=",
"context",
".",
"getDeclaredVariables",
"(",
"declarator",
")",
";",
"return",
"var... | Checks whether the variables which are defined by the given declarator node have their references in TDZ.
@param {ASTNode} declarator - The VariableDeclarator node to check.
@returns {boolean} `true` if one of the variables which are defined by the given declarator node have their references in TDZ. | [
"Checks",
"whether",
"the",
"variables",
"which",
"are",
"defined",
"by",
"the",
"given",
"declarator",
"node",
"have",
"their",
"references",
"in",
"TDZ",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/no-var.js#L205-L212 | train | hasSelfReferenceInTDZ - Check if self reference in TDZ | [
30522,
3853,
2038,
11246,
19699,
27235,
24413,
18447,
2094,
2480,
1006,
11703,
8017,
8844,
1007,
1063,
2065,
1006,
999,
11703,
8017,
8844,
1012,
1999,
4183,
1007,
1063,
2709,
6270,
1025,
1065,
9530,
3367,
10857,
1027,
6123,
1012,
2131,
3207... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
ecomfe/zrender | src/graphic/IncrementalDisplayable.js | IncrementalDisplayble | function IncrementalDisplayble(opts) {
Displayble.call(this, opts);
this._displayables = [];
this._temporaryDisplayables = [];
this._cursor = 0;
this.notClear = true;
} | javascript | function IncrementalDisplayble(opts) {
Displayble.call(this, opts);
this._displayables = [];
this._temporaryDisplayables = [];
this._cursor = 0;
this.notClear = true;
} | [
"function",
"IncrementalDisplayble",
"(",
"opts",
")",
"{",
"Displayble",
".",
"call",
"(",
"this",
",",
"opts",
")",
";",
"this",
".",
"_displayables",
"=",
"[",
"]",
";",
"this",
".",
"_temporaryDisplayables",
"=",
"[",
"]",
";",
"this",
".",
"_cursor"... | TODO Style override ? | [
"TODO",
"Style",
"override",
"?"
] | 30321b57cba3149c30eacb0c1e18276f0f001b9f | https://github.com/ecomfe/zrender/blob/30321b57cba3149c30eacb0c1e18276f0f001b9f/src/graphic/IncrementalDisplayable.js#L13-L24 | train | A displayble that is a temporary displayble. | [
30522,
3853,
4297,
28578,
21050,
10521,
13068,
3468,
1006,
23569,
2015,
1007,
1063,
4653,
3468,
1012,
2655,
1006,
2023,
1010,
23569,
2015,
1007,
1025,
2023,
1012,
1035,
4653,
3085,
2015,
1027,
1031,
1033,
1025,
2023,
1012,
1035,
5741,
10521... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/dom/jquery/selectText.js | selectText | function selectText(iStart, iEnd) {
var oDomRef = this.get(0);
try {
// In Chrome 58 and above selection start is set to selection end when the first parameter of a setSelectionRange call is negative.
if (typeof (oDomRef.selectionStart) === "number") {
oDomRef.setSelectionRange(iStart > 0 ? iStart : 0, iEnd);
}
} catch (e) {
// note: some browsers fail to read the "selectionStart" and "selectionEnd" properties from HTMLInputElement, e.g.: The input element's type "number" does not support selection.
}
return this;
} | javascript | function selectText(iStart, iEnd) {
var oDomRef = this.get(0);
try {
// In Chrome 58 and above selection start is set to selection end when the first parameter of a setSelectionRange call is negative.
if (typeof (oDomRef.selectionStart) === "number") {
oDomRef.setSelectionRange(iStart > 0 ? iStart : 0, iEnd);
}
} catch (e) {
// note: some browsers fail to read the "selectionStart" and "selectionEnd" properties from HTMLInputElement, e.g.: The input element's type "number" does not support selection.
}
return this;
} | [
"function",
"selectText",
"(",
"iStart",
",",
"iEnd",
")",
"{",
"var",
"oDomRef",
"=",
"this",
".",
"get",
"(",
"0",
")",
";",
"try",
"{",
"// In Chrome 58 and above selection start is set to selection end when the first parameter of a setSelectionRange call is negative.",
... | This module provides the {@link jQuery#selectText} API.
@namespace
@name module:sap/ui/dom/jquery/selectText
@public
@since 1.58
Sets the text selection in the first element of the collection.
<b>Note</b>: This feature is only supported for input element’s type of text, search, url, tel and password.
@param {int} iStart Start position of the selection (inclusive)
@param {int} iEnd End position of the selection (exclusive)
@return {jQuery} The jQuery collection
@public
@name jQuery#selectText
@author SAP SE
@since 0.9.0
@function
@requires module:sap/ui/dom/jquery/selectText | [
"This",
"module",
"provides",
"the",
"{",
"@link",
"jQuery#selectText",
"}",
"API",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/dom/jquery/selectText.js#L31-L44 | train | Selects the text in the current selection range. | [
30522,
3853,
7276,
18209,
1006,
21541,
8445,
1010,
29464,
4859,
1007,
1063,
13075,
1051,
9527,
2890,
2546,
1027,
2023,
1012,
2131,
1006,
1014,
1007,
1025,
3046,
1063,
1013,
1013,
1999,
18546,
5388,
1998,
2682,
4989,
2707,
2003,
2275,
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... |
ColorlibHQ/AdminLTE | plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js | updateCollapsedAndCommonAncestor | function updateCollapsedAndCommonAncestor(range) {
range.collapsed = (range.startContainer === range.endContainer && range.startOffset === range.endOffset);
range.commonAncestorContainer = range.collapsed ?
range.startContainer : dom.getCommonAncestor(range.startContainer, range.endContainer);
} | javascript | function updateCollapsedAndCommonAncestor(range) {
range.collapsed = (range.startContainer === range.endContainer && range.startOffset === range.endOffset);
range.commonAncestorContainer = range.collapsed ?
range.startContainer : dom.getCommonAncestor(range.startContainer, range.endContainer);
} | [
"function",
"updateCollapsedAndCommonAncestor",
"(",
"range",
")",
"{",
"range",
".",
"collapsed",
"=",
"(",
"range",
".",
"startContainer",
"===",
"range",
".",
"endContainer",
"&&",
"range",
".",
"startOffset",
"===",
"range",
".",
"endOffset",
")",
";",
"ra... | /*---------------------------------------------------------------------------------------------------------------- Updates commonAncestorContainer and collapsed after boundary change | [
"/",
"*",
"----------------------------------------------------------------------------------------------------------------",
"Updates",
"commonAncestorContainer",
"and",
"collapsed",
"after",
"boundary",
"change"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js#L2131-L2135 | train | Update collapsed and common ancestor | [
30522,
3853,
10651,
26895,
9331,
6924,
5685,
9006,
21781,
5897,
23809,
1006,
2846,
1007,
1063,
2846,
1012,
7798,
1027,
1006,
2846,
1012,
2707,
8663,
18249,
2121,
1027,
1027,
1027,
2846,
1012,
2203,
8663,
18249,
2121,
1004,
1004,
2846,
1012,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
aws/aws-sdk-js | lib/discover_endpoint.js | marshallCustomIdentifiers | function marshallCustomIdentifiers(request, shape) {
var identifiers = {};
marshallCustomIdentifiersHelper(identifiers, request.params, shape);
return identifiers;
} | javascript | function marshallCustomIdentifiers(request, shape) {
var identifiers = {};
marshallCustomIdentifiersHelper(identifiers, request.params, shape);
return identifiers;
} | [
"function",
"marshallCustomIdentifiers",
"(",
"request",
",",
"shape",
")",
"{",
"var",
"identifiers",
"=",
"{",
"}",
";",
"marshallCustomIdentifiersHelper",
"(",
"identifiers",
",",
"request",
".",
"params",
",",
"shape",
")",
";",
"return",
"identifiers",
";",... | Get custom identifiers for cache key.
Identifies custom identifiers by checking each shape's `endpointDiscoveryId` trait.
@param [object] request object
@param [object] input shape of the given operation's api
@api private | [
"Get",
"custom",
"identifiers",
"for",
"cache",
"key",
".",
"Identifies",
"custom",
"identifiers",
"by",
"checking",
"each",
"shape",
"s",
"endpointDiscoveryId",
"trait",
"."
] | c23e5f0edd150f8885267e5f7c8a564f8e6e8562 | https://github.com/aws/aws-sdk-js/blob/c23e5f0edd150f8885267e5f7c8a564f8e6e8562/lib/discover_endpoint.js#L58-L62 | train | Marshalls custom identifiers from the request. params object. | [
30522,
3853,
5832,
7874,
20389,
5178,
16778,
8873,
2545,
1006,
5227,
1010,
4338,
1007,
1063,
13075,
8909,
4765,
28295,
1027,
1063,
1065,
1025,
5832,
7874,
20389,
5178,
16778,
8873,
2545,
16001,
4842,
1006,
8909,
4765,
28295,
1010,
5227,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
google/closure-library | protractor_spec.js | function(testPath) {
return browser.navigate()
.to(TEST_SERVER + '/' + testPath)
.then(function() {
return waitForTestSuiteCompletion(testPath);
})
.then(function(status) {
if (!status.isSuccess) {
failureReports.push(status.report);
}
return status;
});
} | javascript | function(testPath) {
return browser.navigate()
.to(TEST_SERVER + '/' + testPath)
.then(function() {
return waitForTestSuiteCompletion(testPath);
})
.then(function(status) {
if (!status.isSuccess) {
failureReports.push(status.report);
}
return status;
});
} | [
"function",
"(",
"testPath",
")",
"{",
"return",
"browser",
".",
"navigate",
"(",
")",
".",
"to",
"(",
"TEST_SERVER",
"+",
"'/'",
"+",
"testPath",
")",
".",
"then",
"(",
"function",
"(",
")",
"{",
"return",
"waitForTestSuiteCompletion",
"(",
"testPath",
... | Navigates to testPath to invoke tests. Upon completion inspects returned test status and keeps track of the total number failed tests. | [
"Navigates",
"to",
"testPath",
"to",
"invoke",
"tests",
".",
"Upon",
"completion",
"inspects",
"returned",
"test",
"status",
"and",
"keeps",
"track",
"of",
"the",
"total",
"number",
"failed",
"tests",
"."
] | 97390e9ca4483cebb9628e06026139fbb3023d65 | https://github.com/google/closure-library/blob/97390e9ca4483cebb9628e06026139fbb3023d65/protractor_spec.js#L119-L132 | train | Aliquivo test | [
30522,
3853,
1006,
3231,
15069,
1007,
1063,
2709,
16602,
1012,
22149,
1006,
1007,
1012,
2000,
1006,
3231,
1035,
8241,
1009,
1005,
1013,
1005,
1009,
3231,
15069,
1007,
1012,
2059,
1006,
3853,
1006,
1007,
1063,
2709,
3524,
13028,
4355,
28880,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SeleniumHQ/selenium | javascript/node/selenium-webdriver/lib/http.js | parseHttpResponse | function parseHttpResponse(command, httpResponse) {
if (httpResponse.status < 200) {
// This should never happen, but throw the raw response so users report it.
throw new error.WebDriverError(
`Unexpected HTTP response:\n${httpResponse}`);
}
let parsed = tryParse(httpResponse.body);
if (parsed && typeof parsed === 'object') {
let value = parsed.value;
let isW3C =
value !== null && typeof value === 'object'
&& typeof parsed.status === 'undefined';
if (!isW3C) {
error.checkLegacyResponse(parsed);
// Adjust legacy new session responses to look like W3C to simplify
// later processing.
if (command.getName() === cmd.Name.NEW_SESSION) {
value = parsed;
}
} else if (httpResponse.status > 399) {
error.throwDecodedError(value);
}
return {isW3C, value};
}
if (parsed !== undefined) {
return {isW3C: false, value: parsed};
}
let value = httpResponse.body.replace(/\r\n/g, '\n');
// 404 represents an unknown command; anything else > 399 is a generic unknown
// error.
if (httpResponse.status == 404) {
throw new error.UnsupportedOperationError(command.getName() + ': ' + value);
} else if (httpResponse.status >= 400) {
throw new error.WebDriverError(value);
}
return {isW3C: false, value: value || null};
} | javascript | function parseHttpResponse(command, httpResponse) {
if (httpResponse.status < 200) {
// This should never happen, but throw the raw response so users report it.
throw new error.WebDriverError(
`Unexpected HTTP response:\n${httpResponse}`);
}
let parsed = tryParse(httpResponse.body);
if (parsed && typeof parsed === 'object') {
let value = parsed.value;
let isW3C =
value !== null && typeof value === 'object'
&& typeof parsed.status === 'undefined';
if (!isW3C) {
error.checkLegacyResponse(parsed);
// Adjust legacy new session responses to look like W3C to simplify
// later processing.
if (command.getName() === cmd.Name.NEW_SESSION) {
value = parsed;
}
} else if (httpResponse.status > 399) {
error.throwDecodedError(value);
}
return {isW3C, value};
}
if (parsed !== undefined) {
return {isW3C: false, value: parsed};
}
let value = httpResponse.body.replace(/\r\n/g, '\n');
// 404 represents an unknown command; anything else > 399 is a generic unknown
// error.
if (httpResponse.status == 404) {
throw new error.UnsupportedOperationError(command.getName() + ': ' + value);
} else if (httpResponse.status >= 400) {
throw new error.WebDriverError(value);
}
return {isW3C: false, value: value || null};
} | [
"function",
"parseHttpResponse",
"(",
"command",
",",
"httpResponse",
")",
"{",
"if",
"(",
"httpResponse",
".",
"status",
"<",
"200",
")",
"{",
"// This should never happen, but throw the raw response so users report it.",
"throw",
"new",
"error",
".",
"WebDriverError",
... | Callback used to parse {@link Response} objects from a
{@link HttpClient}.
@param {!cmd.Command} command The command the response is for.
@param {!Response} httpResponse The HTTP response to parse.
@return {{isW3C: boolean, value: ?}} An object describing the parsed
response. This object will have two fields: `isW3C` indicates whether
the response looks like it came from a remote end that conforms with the
W3C WebDriver spec, and `value`, the actual response value.
@throws {WebDriverError} If the HTTP response is an error. | [
"Callback",
"used",
"to",
"parse",
"{",
"@link",
"Response",
"}",
"objects",
"from",
"a",
"{",
"@link",
"HttpClient",
"}",
"."
] | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/node/selenium-webdriver/lib/http.js#L536-L581 | train | Parses the HTTP response from the specified command. | [
30522,
3853,
11968,
3366,
11039,
25856,
6072,
26029,
3366,
1006,
3094,
1010,
8299,
6072,
26029,
3366,
1007,
1063,
2065,
1006,
8299,
6072,
26029,
3366,
1012,
3570,
1026,
3263,
1007,
1063,
1013,
1013,
2023,
2323,
2196,
4148,
1010,
2021,
5466,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
firebase/firebase-js-sdk | packages/auth/demo/public/script.js | onChangePassword | function onChangePassword() {
var password = $('#changed-password').val();
activeUser().updatePassword(password).then(function() {
refreshUserData();
alertSuccess('Password changed!');
}, onAuthError);
} | javascript | function onChangePassword() {
var password = $('#changed-password').val();
activeUser().updatePassword(password).then(function() {
refreshUserData();
alertSuccess('Password changed!');
}, onAuthError);
} | [
"function",
"onChangePassword",
"(",
")",
"{",
"var",
"password",
"=",
"$",
"(",
"'#changed-password'",
")",
".",
"val",
"(",
")",
";",
"activeUser",
"(",
")",
".",
"updatePassword",
"(",
"password",
")",
".",
"then",
"(",
"function",
"(",
")",
"{",
"r... | Changes the user's password. | [
"Changes",
"the",
"user",
"s",
"password",
"."
] | 491598a499813dacc23724de5e237ec220cc560e | https://github.com/firebase/firebase-js-sdk/blob/491598a499813dacc23724de5e237ec220cc560e/packages/auth/demo/public/script.js#L613-L619 | train | Change the password of the user | [
30522,
3853,
2006,
22305,
13699,
12054,
18351,
1006,
1007,
1063,
13075,
20786,
1027,
1002,
1006,
1005,
1001,
2904,
1011,
20786,
1005,
1007,
1012,
11748,
1006,
1007,
1025,
3161,
20330,
1006,
1007,
1012,
10651,
15194,
18351,
1006,
20786,
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... |
fex-team/webuploader | src/uploader.js | function() {
// return this._mgr.getStats.apply( this._mgr, arguments );
var stats = this.request('get-stats');
return stats ? {
successNum: stats.numOfSuccess,
progressNum: stats.numOfProgress,
// who care?
// queueFailNum: 0,
cancelNum: stats.numOfCancel,
invalidNum: stats.numOfInvalid,
uploadFailNum: stats.numOfUploadFailed,
queueNum: stats.numOfQueue,
interruptNum: stats.numOfInterrupt
} : {};
} | javascript | function() {
// return this._mgr.getStats.apply( this._mgr, arguments );
var stats = this.request('get-stats');
return stats ? {
successNum: stats.numOfSuccess,
progressNum: stats.numOfProgress,
// who care?
// queueFailNum: 0,
cancelNum: stats.numOfCancel,
invalidNum: stats.numOfInvalid,
uploadFailNum: stats.numOfUploadFailed,
queueNum: stats.numOfQueue,
interruptNum: stats.numOfInterrupt
} : {};
} | [
"function",
"(",
")",
"{",
"// return this._mgr.getStats.apply( this._mgr, arguments );",
"var",
"stats",
"=",
"this",
".",
"request",
"(",
"'get-stats'",
")",
";",
"return",
"stats",
"?",
"{",
"successNum",
":",
"stats",
".",
"numOfSuccess",
",",
"progressNum",
"... | 获取文件统计信息。返回一个包含一下信息的对象。
* `successNum` 上传成功的文件数
* `progressNum` 上传中的文件数
* `cancelNum` 被删除的文件数
* `invalidNum` 无效的文件数
* `uploadFailNum` 上传失败的文件数
* `queueNum` 还在队列中的文件数
* `interruptNum` 被暂停的文件数
@method getStats
@grammar getStats() => Object | [
"获取文件统计信息。返回一个包含一下信息的对象。",
"*",
"successNum",
"上传成功的文件数",
"*",
"progressNum",
"上传中的文件数",
"*",
"cancelNum",
"被删除的文件数",
"*",
"invalidNum",
"无效的文件数",
"*",
"uploadFailNum",
"上传失败的文件数",
"*",
"queueNum",
"还在队列中的文件数",
"*",
"interruptNum",
"被暂停的文件数"
] | 7094e4476c5af3b06993d91dde2d223200b9feb7 | https://github.com/fex-team/webuploader/blob/7094e4476c5af3b06993d91dde2d223200b9feb7/src/uploader.js#L123-L139 | train | Get stats from the cisco | [
30522,
3853,
1006,
1007,
1063,
1013,
1013,
2709,
2023,
1012,
1035,
11460,
2099,
1012,
4152,
29336,
2015,
1012,
6611,
1006,
2023,
1012,
1035,
11460,
2099,
1010,
9918,
1007,
1025,
13075,
26319,
1027,
2023,
1012,
5227,
1006,
1005,
2131,
1011,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/util/IndexWorker.js | preprocessQuery | function preprocessQuery(sQuery) {
var base;
for (var i = 0; i < AUTO_GENERATED_METHOD_PREFIXES.length; i++) {
var sPrefix = AUTO_GENERATED_METHOD_PREFIXES[i];
if (sQuery.indexOf(sPrefix) === 0) {
base = sQuery.substring(sPrefix.length);
}
}
if (base && WORD_REGEX.test(base)) {
sQuery += OR_separator + base; // adds one more *optional* keyword to the search string
}
return sQuery;
} | javascript | function preprocessQuery(sQuery) {
var base;
for (var i = 0; i < AUTO_GENERATED_METHOD_PREFIXES.length; i++) {
var sPrefix = AUTO_GENERATED_METHOD_PREFIXES[i];
if (sQuery.indexOf(sPrefix) === 0) {
base = sQuery.substring(sPrefix.length);
}
}
if (base && WORD_REGEX.test(base)) {
sQuery += OR_separator + base; // adds one more *optional* keyword to the search string
}
return sQuery;
} | [
"function",
"preprocessQuery",
"(",
"sQuery",
")",
"{",
"var",
"base",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"AUTO_GENERATED_METHOD_PREFIXES",
".",
"length",
";",
"i",
"++",
")",
"{",
"var",
"sPrefix",
"=",
"AUTO_GENERATED_METHOD_PREFIXES",
... | Extends the search string to increase the chance to find *metadata*-specific terms
e.g. when user searched for 'attachPress'
=> modify into 'attachPress OR press'
@param sQuery
@returns {*} | [
"Extends",
"the",
"search",
"string",
"to",
"increase",
"the",
"chance",
"to",
"find",
"*",
"metadata",
"*",
"-",
"specific",
"terms"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/util/IndexWorker.js#L211-L225 | train | Pre - processes a query string to be used in the search string | [
30522,
3853,
17463,
3217,
9623,
17729,
2854,
1006,
5490,
13094,
2100,
1007,
1063,
13075,
2918,
1025,
2005,
1006,
13075,
1045,
1027,
1014,
1025,
1045,
1026,
8285,
1035,
7013,
1035,
4118,
1035,
17576,
2229,
1012,
3091,
1025,
1045,
1009,
1009,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/LiveDevelopment/MultiBrowserImpl/language/HTMLSimpleDOM.js | function () {
var attributeString = JSON.stringify(this.attributes);
this.attributeSignature = MurmurHash3.hashString(attributeString, attributeString.length, seed);
} | javascript | function () {
var attributeString = JSON.stringify(this.attributes);
this.attributeSignature = MurmurHash3.hashString(attributeString, attributeString.length, seed);
} | [
"function",
"(",
")",
"{",
"var",
"attributeString",
"=",
"JSON",
".",
"stringify",
"(",
"this",
".",
"attributes",
")",
";",
"this",
".",
"attributeSignature",
"=",
"MurmurHash3",
".",
"hashString",
"(",
"attributeString",
",",
"attributeString",
".",
"length... | Updates the signature of this node's attributes. Call this after making attribute changes. | [
"Updates",
"the",
"signature",
"of",
"this",
"node",
"s",
"attributes",
".",
"Call",
"this",
"after",
"making",
"attribute",
"changes",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/LiveDevelopment/MultiBrowserImpl/language/HTMLSimpleDOM.js#L165-L168 | train | Generate signature for the attribute | [
30522,
3853,
1006,
1007,
1063,
13075,
12332,
18886,
3070,
1027,
1046,
3385,
1012,
5164,
8757,
1006,
2023,
1012,
12332,
1007,
1025,
2023,
1012,
12332,
23773,
4017,
5397,
1027,
20227,
14949,
2232,
2509,
1012,
23325,
3367,
4892,
1006,
12332,
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.commons/src/sap/ui/commons/layout/PositionContainer.js | function(oControl, sDim){
var oProp = getPropertyInfo(oControl, sDim);
if (oProp) {
var val = oControl[oProp._sGetter]();
if (val && val.endsWith("%")) {
return val;
}
}
return null;
} | javascript | function(oControl, sDim){
var oProp = getPropertyInfo(oControl, sDim);
if (oProp) {
var val = oControl[oProp._sGetter]();
if (val && val.endsWith("%")) {
return val;
}
}
return null;
} | [
"function",
"(",
"oControl",
",",
"sDim",
")",
"{",
"var",
"oProp",
"=",
"getPropertyInfo",
"(",
"oControl",
",",
"sDim",
")",
";",
"if",
"(",
"oProp",
")",
"{",
"var",
"val",
"=",
"oControl",
"[",
"oProp",
".",
"_sGetter",
"]",
"(",
")",
";",
"if"... | Returns the value width or height property (depending of <code>sDim</code>) of the given
control if the width or height is specified in %.
@private | [
"Returns",
"the",
"value",
"width",
"or",
"height",
"property",
"(",
"depending",
"of",
"<code",
">",
"sDim<",
"/",
"code",
">",
")",
"of",
"the",
"given",
"control",
"if",
"the",
"width",
"or",
"height",
"is",
"specified",
"in",
"%",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.commons/src/sap/ui/commons/layout/PositionContainer.js#L420-L429 | train | Returns the value of the property of the given control. | [
30522,
3853,
1006,
1051,
8663,
13181,
2140,
1010,
17371,
5714,
1007,
1063,
13075,
6728,
18981,
1027,
2131,
21572,
4842,
3723,
2378,
14876,
1006,
1051,
8663,
13181,
2140,
1010,
17371,
5714,
1007,
1025,
2065,
1006,
6728,
18981,
1007,
1063,
13... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/extras/primitives/primitives.js | definePrimitive | function definePrimitive (tagName, defaultComponents, mappings) {
// If no initial mappings provided, start from empty map.
mappings = mappings || {};
// From the default components, add mapping automagically.
Object.keys(defaultComponents).map(function buildMappings (componentName) {
addComponentMapping(componentName, mappings);
});
// Register the primitive.
module.exports.registerPrimitive(tagName, utils.extendDeep({}, null, {
defaultComponents: defaultComponents,
mappings: mappings
}));
} | javascript | function definePrimitive (tagName, defaultComponents, mappings) {
// If no initial mappings provided, start from empty map.
mappings = mappings || {};
// From the default components, add mapping automagically.
Object.keys(defaultComponents).map(function buildMappings (componentName) {
addComponentMapping(componentName, mappings);
});
// Register the primitive.
module.exports.registerPrimitive(tagName, utils.extendDeep({}, null, {
defaultComponents: defaultComponents,
mappings: mappings
}));
} | [
"function",
"definePrimitive",
"(",
"tagName",
",",
"defaultComponents",
",",
"mappings",
")",
"{",
"// If no initial mappings provided, start from empty map.",
"mappings",
"=",
"mappings",
"||",
"{",
"}",
";",
"// From the default components, add mapping automagically.",
"Obje... | Helper to define a primitive, building mappings using a component schema. | [
"Helper",
"to",
"define",
"a",
"primitive",
"building",
"mappings",
"using",
"a",
"component",
"schema",
"."
] | 24acc78a7299a4cdfe3ef617f4d40ddf6275c992 | https://github.com/aframevr/aframe/blob/24acc78a7299a4cdfe3ef617f4d40ddf6275c992/src/extras/primitives/primitives.js#L182-L196 | train | Define a primitive. | [
30522,
3853,
9375,
18098,
27605,
6024,
1006,
6415,
18442,
1010,
12398,
9006,
29513,
7666,
1010,
12375,
2015,
1007,
1063,
1013,
1013,
2065,
2053,
3988,
12375,
2015,
3024,
1010,
2707,
2013,
4064,
4949,
1012,
12375,
2015,
1027,
12375,
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... |
mattdesl/canvas-sketch | examples/shader.js | createDrawQuad | function createDrawQuad () {
return regl({
// Pass down props from javascript
uniforms: uniforms,
// Fall back to a simple fragment shader
frag: opt.frag || [
'precision highp float;',
'',
'void main () {',
' gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);',
'}'
].join('\n'),
// Fall back to a simple vertex shader
vert: opt.vert || [
'precision highp float;',
'attribute vec3 position;',
'varying vec2 vUv;',
'',
'void main () {',
' gl_Position = vec4(position.xyz, 1.0);',
' vUv = gl_Position.xy * 0.5 + 0.5;',
'}'
].join('\n'),
// Setup transparency blending
blend: {
enable: true,
func: {
srcRGB: 'src alpha',
srcAlpha: 1,
dstRGB: 'one minus src alpha',
dstAlpha: 1
}
},
// Send mesh vertex attributes to shader
attributes: {
position: quad.positions
},
// The indices for the quad mesh
elements: quad.cells
});
} | javascript | function createDrawQuad () {
return regl({
// Pass down props from javascript
uniforms: uniforms,
// Fall back to a simple fragment shader
frag: opt.frag || [
'precision highp float;',
'',
'void main () {',
' gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);',
'}'
].join('\n'),
// Fall back to a simple vertex shader
vert: opt.vert || [
'precision highp float;',
'attribute vec3 position;',
'varying vec2 vUv;',
'',
'void main () {',
' gl_Position = vec4(position.xyz, 1.0);',
' vUv = gl_Position.xy * 0.5 + 0.5;',
'}'
].join('\n'),
// Setup transparency blending
blend: {
enable: true,
func: {
srcRGB: 'src alpha',
srcAlpha: 1,
dstRGB: 'one minus src alpha',
dstAlpha: 1
}
},
// Send mesh vertex attributes to shader
attributes: {
position: quad.positions
},
// The indices for the quad mesh
elements: quad.cells
});
} | [
"function",
"createDrawQuad",
"(",
")",
"{",
"return",
"regl",
"(",
"{",
"// Pass down props from javascript",
"uniforms",
":",
"uniforms",
",",
"// Fall back to a simple fragment shader",
"frag",
":",
"opt",
".",
"frag",
"||",
"[",
"'precision highp float;'",
",",
"'... | Draw command | [
"Draw",
"command"
] | 4addd0fe3fc053065ca8597ab204e43587c52879 | https://github.com/mattdesl/canvas-sketch/blob/4addd0fe3fc053065ca8597ab204e43587c52879/examples/shader.js#L102-L142 | train | Create a draw quad shader | [
30522,
3853,
2580,
2527,
2860,
16211,
2094,
1006,
1007,
1063,
2709,
19723,
2140,
1006,
1063,
1013,
1013,
3413,
2091,
24387,
2013,
9262,
22483,
11408,
1024,
11408,
1010,
1013,
1013,
2991,
2067,
2000,
1037,
3722,
15778,
8703,
2099,
25312,
229... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Microsoft/vscode | build/gulpfile.vscode.js | computeChecksums | function computeChecksums(out, filenames) {
var result = {};
filenames.forEach(function (filename) {
var fullPath = path.join(process.cwd(), out, filename);
result[filename] = computeChecksum(fullPath);
});
return result;
} | javascript | function computeChecksums(out, filenames) {
var result = {};
filenames.forEach(function (filename) {
var fullPath = path.join(process.cwd(), out, filename);
result[filename] = computeChecksum(fullPath);
});
return result;
} | [
"function",
"computeChecksums",
"(",
"out",
",",
"filenames",
")",
"{",
"var",
"result",
"=",
"{",
"}",
";",
"filenames",
".",
"forEach",
"(",
"function",
"(",
"filename",
")",
"{",
"var",
"fullPath",
"=",
"path",
".",
"join",
"(",
"process",
".",
"cwd... | Compute checksums for some files.
@param {string} out The out folder to read the file from.
@param {string[]} filenames The paths to compute a checksum for.
@return {Object} A map of paths to checksums. | [
"Compute",
"checksums",
"for",
"some",
"files",
"."
] | 693a13cd32c5be798051edc0cb43e1e39fc456d9 | https://github.com/Microsoft/vscode/blob/693a13cd32c5be798051edc0cb43e1e39fc456d9/build/gulpfile.vscode.js#L230-L237 | train | Compute checksums for a list of filenames | [
30522,
3853,
24134,
5403,
10603,
18163,
1006,
2041,
1010,
5371,
18442,
2015,
1007,
1063,
13075,
2765,
1027,
1063,
1065,
1025,
5371,
18442,
2015,
1012,
18921,
6776,
1006,
3853,
1006,
5371,
18442,
1007,
1063,
13075,
2440,
15069,
1027,
4130,
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... |
angular/material | src/components/toast/toast.js | toastDefaultOptions | function toastDefaultOptions($animate, $mdToast, $mdUtil, $mdMedia, $document) {
var SWIPE_EVENTS = '$md.swipeleft $md.swiperight $md.swipeup $md.swipedown';
return {
onShow: onShow,
onRemove: onRemove,
toastClass: '',
position: 'bottom left',
themable: true,
hideDelay: 3000,
autoWrap: true,
transformTemplate: function(template, options) {
var shouldAddWrapper = options.autoWrap && template && !/md-toast-content/g.test(template);
if (shouldAddWrapper) {
// Root element of template will be <md-toast>. We need to wrap all of its content inside
// of <div class="md-toast-content">. All templates provided here should be static,
// developer-controlled content (meaning we're not attempting to guard against XSS).
var templateRoot = document.createElement('md-template');
templateRoot.innerHTML = template;
// Iterate through all root children, to detect possible md-toast directives.
for (var i = 0; i < templateRoot.children.length; i++) {
if (templateRoot.children[i].nodeName === 'MD-TOAST') {
var wrapper = angular.element('<div class="md-toast-content">');
// Wrap the children of the `md-toast` directive in jqLite, to be able to append
// multiple nodes with the same execution.
wrapper.append(angular.element(templateRoot.children[i].childNodes));
// Append the new wrapped element to the `md-toast` directive.
templateRoot.children[i].appendChild(wrapper[0]);
}
}
// We have to return the innerHTMl, because we do not want to have the `md-template`
// element to be the root element of our interimElement.
return templateRoot.innerHTML;
}
return template || '';
}
};
function onShow(scope, element, options) {
// support deprecated #content method
// TODO remove support for content in 1.2.
activeToastContent = options.textContent || options.content;
var isSmScreen = !$mdMedia('gt-sm');
element = $mdUtil.extractElementByName(element, 'md-toast', true);
options.element = element;
options.onSwipe = function(ev, gesture) {
// Add the relevant swipe class to the element so it can animate correctly
var swipe = ev.type.replace('$md.','');
var direction = swipe.replace('swipe', '');
// If the swipe direction is down/up but the toast came from top/bottom don't fade away
// Unless the screen is small, then the toast always on bottom
if ((direction === 'down' && options.position.indexOf('top') !== -1 && !isSmScreen) ||
(direction === 'up' && (options.position.indexOf('bottom') !== -1 || isSmScreen))) {
return;
}
if ((direction === 'left' || direction === 'right') && isSmScreen) {
return;
}
element.addClass('md-' + swipe);
$mdUtil.nextTick($mdToast.cancel);
};
options.openClass = toastOpenClass(options.position);
element.addClass(options.toastClass);
// 'top left' -> 'md-top md-left'
options.parent.addClass(options.openClass);
// static is the default position
if ($mdUtil.hasComputedStyle(options.parent, 'position', 'static')) {
options.parent.css('position', 'relative');
}
setupActionKeyListener(scope.toast && scope.toast.actionKey ?
scope.toast.actionKey : undefined);
element.on(SWIPE_EVENTS, options.onSwipe);
element.addClass(isSmScreen ? 'md-bottom' : options.position.split(' ').map(function(pos) {
return 'md-' + pos;
}).join(' '));
if (options.parent) {
options.parent.addClass('md-toast-animating');
}
return $animate.enter(element, options.parent).then(function() {
if (options.parent) {
options.parent.removeClass('md-toast-animating');
}
});
}
function onRemove(scope, element, options) {
if (scope.toast && scope.toast.actionKey) {
removeActionKeyListener();
}
element.off(SWIPE_EVENTS, options.onSwipe);
if (options.parent) options.parent.addClass('md-toast-animating');
if (options.openClass) options.parent.removeClass(options.openClass);
return ((options.$destroy === true) ? element.remove() : $animate.leave(element))
.then(function () {
if (options.parent) options.parent.removeClass('md-toast-animating');
if ($mdUtil.hasComputedStyle(options.parent, 'position', 'static')) {
options.parent.css('position', '');
}
});
}
function toastOpenClass(position) {
// For mobile, always open full-width on bottom
if (!$mdMedia('gt-xs')) {
return 'md-toast-open-bottom';
}
return 'md-toast-open-' + (position.indexOf('top') > -1 ? 'top' : 'bottom');
}
function setupActionKeyListener(actionKey) {
/**
* @param {KeyboardEvent} event
*/
var handleKeyDown = function(event) {
if (event.key === 'Escape') {
$mdToast.hide(false);
}
if (actionKey && event.key === actionKey && event.ctrlKey) {
$mdToast.hide(ACTION_RESOLVE);
}
};
$document.on('keydown', handleKeyDown);
}
function removeActionKeyListener() {
$document.off('keydown');
}
} | javascript | function toastDefaultOptions($animate, $mdToast, $mdUtil, $mdMedia, $document) {
var SWIPE_EVENTS = '$md.swipeleft $md.swiperight $md.swipeup $md.swipedown';
return {
onShow: onShow,
onRemove: onRemove,
toastClass: '',
position: 'bottom left',
themable: true,
hideDelay: 3000,
autoWrap: true,
transformTemplate: function(template, options) {
var shouldAddWrapper = options.autoWrap && template && !/md-toast-content/g.test(template);
if (shouldAddWrapper) {
// Root element of template will be <md-toast>. We need to wrap all of its content inside
// of <div class="md-toast-content">. All templates provided here should be static,
// developer-controlled content (meaning we're not attempting to guard against XSS).
var templateRoot = document.createElement('md-template');
templateRoot.innerHTML = template;
// Iterate through all root children, to detect possible md-toast directives.
for (var i = 0; i < templateRoot.children.length; i++) {
if (templateRoot.children[i].nodeName === 'MD-TOAST') {
var wrapper = angular.element('<div class="md-toast-content">');
// Wrap the children of the `md-toast` directive in jqLite, to be able to append
// multiple nodes with the same execution.
wrapper.append(angular.element(templateRoot.children[i].childNodes));
// Append the new wrapped element to the `md-toast` directive.
templateRoot.children[i].appendChild(wrapper[0]);
}
}
// We have to return the innerHTMl, because we do not want to have the `md-template`
// element to be the root element of our interimElement.
return templateRoot.innerHTML;
}
return template || '';
}
};
function onShow(scope, element, options) {
// support deprecated #content method
// TODO remove support for content in 1.2.
activeToastContent = options.textContent || options.content;
var isSmScreen = !$mdMedia('gt-sm');
element = $mdUtil.extractElementByName(element, 'md-toast', true);
options.element = element;
options.onSwipe = function(ev, gesture) {
// Add the relevant swipe class to the element so it can animate correctly
var swipe = ev.type.replace('$md.','');
var direction = swipe.replace('swipe', '');
// If the swipe direction is down/up but the toast came from top/bottom don't fade away
// Unless the screen is small, then the toast always on bottom
if ((direction === 'down' && options.position.indexOf('top') !== -1 && !isSmScreen) ||
(direction === 'up' && (options.position.indexOf('bottom') !== -1 || isSmScreen))) {
return;
}
if ((direction === 'left' || direction === 'right') && isSmScreen) {
return;
}
element.addClass('md-' + swipe);
$mdUtil.nextTick($mdToast.cancel);
};
options.openClass = toastOpenClass(options.position);
element.addClass(options.toastClass);
// 'top left' -> 'md-top md-left'
options.parent.addClass(options.openClass);
// static is the default position
if ($mdUtil.hasComputedStyle(options.parent, 'position', 'static')) {
options.parent.css('position', 'relative');
}
setupActionKeyListener(scope.toast && scope.toast.actionKey ?
scope.toast.actionKey : undefined);
element.on(SWIPE_EVENTS, options.onSwipe);
element.addClass(isSmScreen ? 'md-bottom' : options.position.split(' ').map(function(pos) {
return 'md-' + pos;
}).join(' '));
if (options.parent) {
options.parent.addClass('md-toast-animating');
}
return $animate.enter(element, options.parent).then(function() {
if (options.parent) {
options.parent.removeClass('md-toast-animating');
}
});
}
function onRemove(scope, element, options) {
if (scope.toast && scope.toast.actionKey) {
removeActionKeyListener();
}
element.off(SWIPE_EVENTS, options.onSwipe);
if (options.parent) options.parent.addClass('md-toast-animating');
if (options.openClass) options.parent.removeClass(options.openClass);
return ((options.$destroy === true) ? element.remove() : $animate.leave(element))
.then(function () {
if (options.parent) options.parent.removeClass('md-toast-animating');
if ($mdUtil.hasComputedStyle(options.parent, 'position', 'static')) {
options.parent.css('position', '');
}
});
}
function toastOpenClass(position) {
// For mobile, always open full-width on bottom
if (!$mdMedia('gt-xs')) {
return 'md-toast-open-bottom';
}
return 'md-toast-open-' + (position.indexOf('top') > -1 ? 'top' : 'bottom');
}
function setupActionKeyListener(actionKey) {
/**
* @param {KeyboardEvent} event
*/
var handleKeyDown = function(event) {
if (event.key === 'Escape') {
$mdToast.hide(false);
}
if (actionKey && event.key === actionKey && event.ctrlKey) {
$mdToast.hide(ACTION_RESOLVE);
}
};
$document.on('keydown', handleKeyDown);
}
function removeActionKeyListener() {
$document.off('keydown');
}
} | [
"function",
"toastDefaultOptions",
"(",
"$animate",
",",
"$mdToast",
",",
"$mdUtil",
",",
"$mdMedia",
",",
"$document",
")",
"{",
"var",
"SWIPE_EVENTS",
"=",
"'$md.swipeleft $md.swiperight $md.swipeup $md.swipedown'",
";",
"return",
"{",
"onShow",
":",
"onShow",
",",
... | /* @ngInject | [
"/",
"*"
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/toast/toast.js#L419-L565 | train | The default options for the toast | [
30522,
3853,
15174,
3207,
7011,
11314,
7361,
9285,
1006,
1002,
2019,
21499,
1010,
1002,
9108,
3406,
14083,
1010,
1002,
9108,
21823,
2140,
1010,
1002,
9108,
16969,
1010,
1002,
6254,
1007,
1063,
13075,
25430,
15457,
1035,
2824,
1027,
1005,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/core/XMLTemplateProcessor.js | createControlOrExtension | function createControlOrExtension(node) { // this will also be extended for Fragments with multiple roots
if (localName(node) === "ExtensionPoint" && node.namespaceURI === "sap.ui.core" ) {
if (bEnrichFullIds) {
// Processing the different types of ExtensionPoints (XML, JS...) is not possible, hence
// they are skipped as well as their potentially overwritten default content.
return SyncPromise.resolve([]);
} else {
// for Views the containing View's name is required to retrieve the according extension configuration,
// whereas for Fragments the actual Fragment's name is required - oView can be either View or Fragment
var oContainer = oView instanceof View ? oView._oContainingView : oView;
// @evo-todo: The factory call needs to be refactored into a proper async/sync switch.
// @evo-todo: The ExtensionPoint module is actually the sap.ui.extensionpoint function.
// We still call _factory for skipping the deprecation warning for now.
var fnExtensionPointFactory = ExtensionPoint._factory.bind(null, oContainer, node.getAttribute("name"), function() {
// create extensionpoint with callback function for defaultContent - will only be executed if there is no customizing configured or if customizing is disabled
var pChild = SyncPromise.resolve();
var aChildControlPromises = [];
var children = node.childNodes;
// for some reasons phantomjs does not work with an Array#forEach here
for (var i = 0; i < children.length; i++) {
var oChildNode = children[i];
if (oChildNode.nodeType === 1 /* ELEMENT_NODE */) { // text nodes are ignored - plaintext inside extension points is not supported; no warning log because even whitespace is a text node
// chain the child node creation for sequential processing
pChild = pChild.then(createControls.bind(null, oChildNode));
aChildControlPromises.push(pChild);
}
}
return SyncPromise.all(aChildControlPromises).then(function(aChildControl){
var aDefaultContent = [];
aChildControl.forEach(function(aControls) {
aDefaultContent = aDefaultContent.concat(aControls);
});
return aDefaultContent;
});
});
return SyncPromise.resolve(oView.fnScopedRunWithOwner ? oView.fnScopedRunWithOwner(fnExtensionPointFactory) : fnExtensionPointFactory());
}
} else {
// a plain and simple regular UI5 control
var vClass = findControlClass(node.namespaceURI, localName(node));
if (vClass && typeof vClass.then === 'function') {
return vClass.then(function (fnClass) {
return createRegularControls(node, fnClass);
});
} else {
// class has already been loaded
return createRegularControls(node, vClass);
}
}
} | javascript | function createControlOrExtension(node) { // this will also be extended for Fragments with multiple roots
if (localName(node) === "ExtensionPoint" && node.namespaceURI === "sap.ui.core" ) {
if (bEnrichFullIds) {
// Processing the different types of ExtensionPoints (XML, JS...) is not possible, hence
// they are skipped as well as their potentially overwritten default content.
return SyncPromise.resolve([]);
} else {
// for Views the containing View's name is required to retrieve the according extension configuration,
// whereas for Fragments the actual Fragment's name is required - oView can be either View or Fragment
var oContainer = oView instanceof View ? oView._oContainingView : oView;
// @evo-todo: The factory call needs to be refactored into a proper async/sync switch.
// @evo-todo: The ExtensionPoint module is actually the sap.ui.extensionpoint function.
// We still call _factory for skipping the deprecation warning for now.
var fnExtensionPointFactory = ExtensionPoint._factory.bind(null, oContainer, node.getAttribute("name"), function() {
// create extensionpoint with callback function for defaultContent - will only be executed if there is no customizing configured or if customizing is disabled
var pChild = SyncPromise.resolve();
var aChildControlPromises = [];
var children = node.childNodes;
// for some reasons phantomjs does not work with an Array#forEach here
for (var i = 0; i < children.length; i++) {
var oChildNode = children[i];
if (oChildNode.nodeType === 1 /* ELEMENT_NODE */) { // text nodes are ignored - plaintext inside extension points is not supported; no warning log because even whitespace is a text node
// chain the child node creation for sequential processing
pChild = pChild.then(createControls.bind(null, oChildNode));
aChildControlPromises.push(pChild);
}
}
return SyncPromise.all(aChildControlPromises).then(function(aChildControl){
var aDefaultContent = [];
aChildControl.forEach(function(aControls) {
aDefaultContent = aDefaultContent.concat(aControls);
});
return aDefaultContent;
});
});
return SyncPromise.resolve(oView.fnScopedRunWithOwner ? oView.fnScopedRunWithOwner(fnExtensionPointFactory) : fnExtensionPointFactory());
}
} else {
// a plain and simple regular UI5 control
var vClass = findControlClass(node.namespaceURI, localName(node));
if (vClass && typeof vClass.then === 'function') {
return vClass.then(function (fnClass) {
return createRegularControls(node, fnClass);
});
} else {
// class has already been loaded
return createRegularControls(node, vClass);
}
}
} | [
"function",
"createControlOrExtension",
"(",
"node",
")",
"{",
"// this will also be extended for Fragments with multiple roots",
"if",
"(",
"localName",
"(",
"node",
")",
"===",
"\"ExtensionPoint\"",
"&&",
"node",
".",
"namespaceURI",
"===",
"\"sap.ui.core\"",
")",
"{",
... | Creates 0..n UI5 controls from an XML node which is not plain HTML, but a UI5 node (either control or
ExtensionPoint). One control for regular controls, zero for ExtensionPoints without configured extension
and n controls for multi-root Fragments.
@return {Promise} resolving to an array with 0..n controls created from a node
@private | [
"Creates",
"0",
"..",
"n",
"UI5",
"controls",
"from",
"an",
"XML",
"node",
"which",
"is",
"not",
"plain",
"HTML",
"but",
"a",
"UI5",
"node",
"(",
"either",
"control",
"or",
"ExtensionPoint",
")",
".",
"One",
"control",
"for",
"regular",
"controls",
"zero... | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/XMLTemplateProcessor.js#L576-L631 | train | Creates a control or extension point | [
30522,
3853,
3443,
8663,
13181,
20186,
18413,
6132,
3258,
1006,
13045,
1007,
1063,
1013,
1013,
2023,
2097,
2036,
2022,
3668,
2005,
10341,
2007,
3674,
6147,
2065,
1006,
2334,
18442,
1006,
13045,
1007,
1027,
1027,
1027,
1000,
5331,
8400,
1000... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
eslint/eslint | lib/rules/no-useless-concat.js | getLeft | function getLeft(node) {
let left = node.left;
while (isConcatenation(left)) {
left = left.right;
}
return left;
} | javascript | function getLeft(node) {
let left = node.left;
while (isConcatenation(left)) {
left = left.right;
}
return left;
} | [
"function",
"getLeft",
"(",
"node",
")",
"{",
"let",
"left",
"=",
"node",
".",
"left",
";",
"while",
"(",
"isConcatenation",
"(",
"left",
")",
")",
"{",
"left",
"=",
"left",
".",
"right",
";",
"}",
"return",
"left",
";",
"}"
] | Get's the right most node on the left side of a BinaryExpression with + operator.
@param {ASTNode} node - A BinaryExpression node to check.
@returns {ASTNode} node | [
"Get",
"s",
"the",
"right",
"most",
"node",
"on",
"the",
"left",
"side",
"of",
"a",
"BinaryExpression",
"with",
"+",
"operator",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/no-useless-concat.js#L40-L47 | train | Returns the left node of a node | [
30522,
3853,
2131,
2571,
6199,
1006,
13045,
1007,
1063,
2292,
2187,
1027,
13045,
1012,
2187,
1025,
2096,
1006,
2003,
8663,
16280,
9323,
1006,
2187,
1007,
1007,
1063,
2187,
1027,
2187,
1012,
2157,
1025,
1065,
2709,
2187,
1025,
1065,
102,
0... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
eslint/eslint | lib/rules/space-infix-ops.js | checkBinary | function checkBinary(node) {
const leftNode = (node.left.typeAnnotation) ? node.left.typeAnnotation : node.left;
const rightNode = node.right;
// search for = in AssignmentPattern nodes
const operator = node.operator || "=";
const nonSpacedNode = getFirstNonSpacedToken(leftNode, rightNode, operator);
if (nonSpacedNode) {
if (!(int32Hint && sourceCode.getText(node).endsWith("|0"))) {
report(node, nonSpacedNode);
}
}
} | javascript | function checkBinary(node) {
const leftNode = (node.left.typeAnnotation) ? node.left.typeAnnotation : node.left;
const rightNode = node.right;
// search for = in AssignmentPattern nodes
const operator = node.operator || "=";
const nonSpacedNode = getFirstNonSpacedToken(leftNode, rightNode, operator);
if (nonSpacedNode) {
if (!(int32Hint && sourceCode.getText(node).endsWith("|0"))) {
report(node, nonSpacedNode);
}
}
} | [
"function",
"checkBinary",
"(",
"node",
")",
"{",
"const",
"leftNode",
"=",
"(",
"node",
".",
"left",
".",
"typeAnnotation",
")",
"?",
"node",
".",
"left",
".",
"typeAnnotation",
":",
"node",
".",
"left",
";",
"const",
"rightNode",
"=",
"node",
".",
"r... | Check if the node is binary then report
@param {ASTNode} node node to evaluate
@returns {void}
@private | [
"Check",
"if",
"the",
"node",
"is",
"binary",
"then",
"report"
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/space-infix-ops.js#L103-L117 | train | Check if BinaryExpression is valid | [
30522,
3853,
4638,
21114,
2854,
1006,
13045,
1007,
1063,
9530,
3367,
2187,
3630,
3207,
1027,
1006,
13045,
1012,
2187,
1012,
2828,
11639,
17287,
3508,
1007,
1029,
13045,
1012,
2187,
1012,
2828,
11639,
17287,
3508,
1024,
13045,
1012,
2187,
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... |
angular/material | src/components/datepicker/js/calendarMonthBody.js | CalendarMonthBodyCtrl | function CalendarMonthBodyCtrl($element, $$mdDateUtil, $mdDateLocale) {
/** @final {!angular.JQLite} */
this.$element = $element;
/** @final */
this.dateUtil = $$mdDateUtil;
/** @final */
this.dateLocale = $mdDateLocale;
/** @type {Object} Reference to the month view. */
this.monthCtrl = null;
/** @type {Object} Reference to the calendar. */
this.calendarCtrl = null;
/**
* Number of months from the start of the month "items" that the currently rendered month
* occurs. Set via angular data binding.
* @type {number}
*/
this.offset = null;
/**
* Date cell to focus after appending the month to the document.
* @type {HTMLElement}
*/
this.focusAfterAppend = null;
} | javascript | function CalendarMonthBodyCtrl($element, $$mdDateUtil, $mdDateLocale) {
/** @final {!angular.JQLite} */
this.$element = $element;
/** @final */
this.dateUtil = $$mdDateUtil;
/** @final */
this.dateLocale = $mdDateLocale;
/** @type {Object} Reference to the month view. */
this.monthCtrl = null;
/** @type {Object} Reference to the calendar. */
this.calendarCtrl = null;
/**
* Number of months from the start of the month "items" that the currently rendered month
* occurs. Set via angular data binding.
* @type {number}
*/
this.offset = null;
/**
* Date cell to focus after appending the month to the document.
* @type {HTMLElement}
*/
this.focusAfterAppend = null;
} | [
"function",
"CalendarMonthBodyCtrl",
"(",
"$element",
",",
"$$mdDateUtil",
",",
"$mdDateLocale",
")",
"{",
"/** @final {!angular.JQLite} */",
"this",
".",
"$element",
"=",
"$element",
";",
"/** @final */",
"this",
".",
"dateUtil",
"=",
"$$mdDateUtil",
";",
"/** @final... | Controller for a single calendar month.
@ngInject @constructor | [
"Controller",
"for",
"a",
"single",
"calendar",
"month",
"."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/datepicker/js/calendarMonthBody.js#L49-L77 | train | The CalendarMonthBodyCtrl constructor. | [
30522,
3853,
8094,
9629,
2232,
23684,
6593,
12190,
1006,
1002,
5783,
1010,
1002,
1002,
9108,
13701,
21823,
2140,
1010,
1002,
9108,
13701,
4135,
9289,
2063,
1007,
1063,
1013,
1008,
1008,
1030,
2345,
1063,
999,
16108,
1012,
1046,
4160,
22779,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
jhipster/generator-jhipster | generators/utils.js | buildEnumInfo | function buildEnumInfo(field, angularAppName, packageName, clientRootFolder) {
const fieldType = field.fieldType;
field.enumInstance = _.lowerFirst(fieldType);
const enumInfo = {
enumName: fieldType,
enumValues: field.fieldValues.split(',').join(', '),
enumInstance: field.enumInstance,
enums: field.fieldValues.replace(/\s/g, '').split(','),
angularAppName,
packageName,
clientRootFolder: clientRootFolder ? `${clientRootFolder}-` : ''
};
return enumInfo;
} | javascript | function buildEnumInfo(field, angularAppName, packageName, clientRootFolder) {
const fieldType = field.fieldType;
field.enumInstance = _.lowerFirst(fieldType);
const enumInfo = {
enumName: fieldType,
enumValues: field.fieldValues.split(',').join(', '),
enumInstance: field.enumInstance,
enums: field.fieldValues.replace(/\s/g, '').split(','),
angularAppName,
packageName,
clientRootFolder: clientRootFolder ? `${clientRootFolder}-` : ''
};
return enumInfo;
} | [
"function",
"buildEnumInfo",
"(",
"field",
",",
"angularAppName",
",",
"packageName",
",",
"clientRootFolder",
")",
"{",
"const",
"fieldType",
"=",
"field",
".",
"fieldType",
";",
"field",
".",
"enumInstance",
"=",
"_",
".",
"lowerFirst",
"(",
"fieldType",
")"... | Build an enum object
@param {any} field : entity field
@param {string} angularAppName
@param {string} packageName | [
"Build",
"an",
"enum",
"object"
] | f76fa8de0818ce6bda6c7b1455942e2a9b0ae3ff | https://github.com/jhipster/generator-jhipster/blob/f76fa8de0818ce6bda6c7b1455942e2a9b0ae3ff/generators/utils.js#L378-L391 | train | Build an enum info object | [
30522,
3853,
3857,
2368,
12717,
2078,
14876,
1006,
2492,
1010,
16108,
29098,
18442,
1010,
7427,
18442,
1010,
7396,
3217,
4140,
10371,
2121,
1007,
1063,
9530,
3367,
2492,
13874,
1027,
2492,
1012,
2492,
13874,
1025,
2492,
1012,
4372,
12717,
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/JSUtils/ScopeManager.js | addPendingRequest | function addPendingRequest(file, offset, type) {
var requests,
key = file + "@" + offset.line + "@" + offset.ch,
$deferredRequest;
// Reject detected exclusions
if (isFileExcludedInternal(file)) {
return (new $.Deferred()).reject().promise();
}
if (_.has(pendingTernRequests, key)) {
requests = pendingTernRequests[key];
} else {
requests = {};
pendingTernRequests[key] = requests;
}
if (_.has(requests, type)) {
$deferredRequest = requests[type];
} else {
requests[type] = $deferredRequest = new $.Deferred();
}
return $deferredRequest.promise();
} | javascript | function addPendingRequest(file, offset, type) {
var requests,
key = file + "@" + offset.line + "@" + offset.ch,
$deferredRequest;
// Reject detected exclusions
if (isFileExcludedInternal(file)) {
return (new $.Deferred()).reject().promise();
}
if (_.has(pendingTernRequests, key)) {
requests = pendingTernRequests[key];
} else {
requests = {};
pendingTernRequests[key] = requests;
}
if (_.has(requests, type)) {
$deferredRequest = requests[type];
} else {
requests[type] = $deferredRequest = new $.Deferred();
}
return $deferredRequest.promise();
} | [
"function",
"addPendingRequest",
"(",
"file",
",",
"offset",
",",
"type",
")",
"{",
"var",
"requests",
",",
"key",
"=",
"file",
"+",
"\"@\"",
"+",
"offset",
".",
"line",
"+",
"\"@\"",
"+",
"offset",
".",
"ch",
",",
"$deferredRequest",
";",
"// Reject det... | Add a pending request waiting for the tern-module to complete.
If file is a detected exclusion, then reject request.
@param {string} file - the name of the file
@param {{line: number, ch: number}} offset - the offset into the file the request is for
@param {string} type - the type of request
@return {jQuery.Promise} - the promise for the request | [
"Add",
"a",
"pending",
"request",
"waiting",
"for",
"the",
"tern",
"-",
"module",
"to",
"complete",
".",
"If",
"file",
"is",
"a",
"detected",
"exclusion",
"then",
"reject",
"request",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/JSUtils/ScopeManager.js#L278-L301 | train | Add a pending request to the tern process | [
30522,
3853,
5587,
11837,
4667,
2890,
15500,
1006,
5371,
1010,
16396,
1010,
2828,
1007,
1063,
13075,
11186,
1010,
3145,
1027,
5371,
1009,
1000,
1030,
1000,
1009,
16396,
1012,
2240,
1009,
1000,
1030,
1000,
1009,
16396,
1012,
10381,
1010,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.rta/src/sap/ui/rta/appVariant/Feature.js | processArray | function processArray(aPromises) {
return aPromises.reduce(function(pacc, fn) {
return pacc.then(fn);
}, Promise.resolve())
.catch(function() {
return Promise.resolve(false);
});
} | javascript | function processArray(aPromises) {
return aPromises.reduce(function(pacc, fn) {
return pacc.then(fn);
}, Promise.resolve())
.catch(function() {
return Promise.resolve(false);
});
} | [
"function",
"processArray",
"(",
"aPromises",
")",
"{",
"return",
"aPromises",
".",
"reduce",
"(",
"function",
"(",
"pacc",
",",
"fn",
")",
"{",
"return",
"pacc",
".",
"then",
"(",
"fn",
")",
";",
"}",
",",
"Promise",
".",
"resolve",
"(",
")",
")",
... | Execute a list of Promises | [
"Execute",
"a",
"list",
"of",
"Promises"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.rta/src/sap/ui/rta/appVariant/Feature.js#L263-L270 | train | Process an array of promises | [
30522,
3853,
2832,
2906,
9447,
1006,
19804,
20936,
8583,
1007,
1063,
2709,
19804,
20936,
8583,
1012,
5547,
1006,
3853,
1006,
14397,
2278,
1010,
1042,
2078,
1007,
1063,
2709,
14397,
2278,
1012,
2059,
1006,
1042,
2078,
1007,
1025,
1065,
1010,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/qunit/QUnitUtils.js | mapKeyCodeToKey | function mapKeyCodeToKey(sKeyCode) {
// look up number in KeyCodes enum to get the string
if (!isNaN(sKeyCode)) {
sKeyCode = getKeyCodeStringFromNumber(sKeyCode);
}
if (!sKeyCode) {
return undefined;
}
sKeyCode = sKeyCode.toLowerCase();
// replace underscores with dash character such as 'ARROW_LEFT' --> 'ARROW-LEFT' and then camelize it --> 'ArrowLeft'
sKeyCode = camelize(sKeyCode.replace(/_/g, "-"));
// capitalize key
var sKey = capitalize(sKeyCode);
// remove "Digit" and "Numpad" from the resulting string as this info is present within the Location property and not the key property
// e.g. "Digit9" --> "9"
if (sKey.startsWith("Digit")) {
return sKey.substring("Digit".length);
} else if (sKey.startsWith("Numpad")) {
sKey = sKey.substring("Numpad".length);
}
// special handling where KeyCodes[sKeyCode] does not match
// e.g. KeyCodes.BREAK --> 'Pause' instead of 'Break'
switch (sKey) {
case "Break": return "Pause";
case "Space": return " ";
case "Print": return "PrintScreen";
case "Windows": return "Meta";
case "Sleep": return "Standby";
case "TurnOff": return "PowerOff";
case "Asterisk": return "*";
case "Plus": return "+";
case "Minus": return "-";
case "Comma": return ",";
case "Slash": return "/";
case "OpenBracket": return ";";
case "Dot": return ".";
case "Pipe": return "|";
case "Semicolon": return ";";
case "Equals": return "=";
case "SingleQUote": return "=";
case "Backslash": return "\\";
case "GreatAccent": return "`";
default: return sKey;
}
} | javascript | function mapKeyCodeToKey(sKeyCode) {
// look up number in KeyCodes enum to get the string
if (!isNaN(sKeyCode)) {
sKeyCode = getKeyCodeStringFromNumber(sKeyCode);
}
if (!sKeyCode) {
return undefined;
}
sKeyCode = sKeyCode.toLowerCase();
// replace underscores with dash character such as 'ARROW_LEFT' --> 'ARROW-LEFT' and then camelize it --> 'ArrowLeft'
sKeyCode = camelize(sKeyCode.replace(/_/g, "-"));
// capitalize key
var sKey = capitalize(sKeyCode);
// remove "Digit" and "Numpad" from the resulting string as this info is present within the Location property and not the key property
// e.g. "Digit9" --> "9"
if (sKey.startsWith("Digit")) {
return sKey.substring("Digit".length);
} else if (sKey.startsWith("Numpad")) {
sKey = sKey.substring("Numpad".length);
}
// special handling where KeyCodes[sKeyCode] does not match
// e.g. KeyCodes.BREAK --> 'Pause' instead of 'Break'
switch (sKey) {
case "Break": return "Pause";
case "Space": return " ";
case "Print": return "PrintScreen";
case "Windows": return "Meta";
case "Sleep": return "Standby";
case "TurnOff": return "PowerOff";
case "Asterisk": return "*";
case "Plus": return "+";
case "Minus": return "-";
case "Comma": return ",";
case "Slash": return "/";
case "OpenBracket": return ";";
case "Dot": return ".";
case "Pipe": return "|";
case "Semicolon": return ";";
case "Equals": return "=";
case "SingleQUote": return "=";
case "Backslash": return "\\";
case "GreatAccent": return "`";
default: return sKey;
}
} | [
"function",
"mapKeyCodeToKey",
"(",
"sKeyCode",
")",
"{",
"// look up number in KeyCodes enum to get the string",
"if",
"(",
"!",
"isNaN",
"(",
"sKeyCode",
")",
")",
"{",
"sKeyCode",
"=",
"getKeyCodeStringFromNumber",
"(",
"sKeyCode",
")",
";",
"}",
"if",
"(",
"!"... | Maps the input keyCode to key property
@param sKeyCode {string|Integer} keyCode number or string, e.g. 27 or ESCAPE
@returns {*} the key property of KeyBoardEvent, e.g. Escape | [
"Maps",
"the",
"input",
"keyCode",
"to",
"key",
"property"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/qunit/QUnitUtils.js#L356-L404 | train | Converts a key code to a key string | [
30522,
3853,
4949,
14839,
16044,
18715,
3240,
1006,
15315,
3240,
16044,
1007,
1063,
1013,
1013,
2298,
2039,
2193,
1999,
3145,
23237,
4372,
2819,
2000,
2131,
1996,
5164,
2065,
1006,
999,
3475,
2319,
1006,
15315,
3240,
16044,
1007,
1007,
1063... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
aws/aws-sdk-js | lib/service.js | addDefaultMonitoringListeners | function addDefaultMonitoringListeners(attachOn) {
attachOn.addNamedListener('MONITOR_EVENTS_BUBBLE', 'apiCallAttempt', function EVENTS_BUBBLE(event) {
var baseClass = Object.getPrototypeOf(attachOn);
if (baseClass._events) baseClass.emit('apiCallAttempt', [event]);
});
attachOn.addNamedListener('CALL_EVENTS_BUBBLE', 'apiCall', function CALL_EVENTS_BUBBLE(event) {
var baseClass = Object.getPrototypeOf(attachOn);
if (baseClass._events) baseClass.emit('apiCall', [event]);
});
} | javascript | function addDefaultMonitoringListeners(attachOn) {
attachOn.addNamedListener('MONITOR_EVENTS_BUBBLE', 'apiCallAttempt', function EVENTS_BUBBLE(event) {
var baseClass = Object.getPrototypeOf(attachOn);
if (baseClass._events) baseClass.emit('apiCallAttempt', [event]);
});
attachOn.addNamedListener('CALL_EVENTS_BUBBLE', 'apiCall', function CALL_EVENTS_BUBBLE(event) {
var baseClass = Object.getPrototypeOf(attachOn);
if (baseClass._events) baseClass.emit('apiCall', [event]);
});
} | [
"function",
"addDefaultMonitoringListeners",
"(",
"attachOn",
")",
"{",
"attachOn",
".",
"addNamedListener",
"(",
"'MONITOR_EVENTS_BUBBLE'",
",",
"'apiCallAttempt'",
",",
"function",
"EVENTS_BUBBLE",
"(",
"event",
")",
"{",
"var",
"baseClass",
"=",
"Object",
".",
"g... | @param attachOn attach default monitoring listeners to object
Each monitoring event should be emitted from service client to service constructor prototype and then
to global service prototype like bubbling up. These default monitoring events listener will transfer
the monitoring events to the upper layer.
@api private | [
"@param",
"attachOn",
"attach",
"default",
"monitoring",
"listeners",
"to",
"object"
] | c23e5f0edd150f8885267e5f7c8a564f8e6e8562 | https://github.com/aws/aws-sdk-js/blob/c23e5f0edd150f8885267e5f7c8a564f8e6e8562/lib/service.js#L797-L806 | train | Add default listeners to the attachOn object | [
30522,
3853,
5587,
3207,
7011,
11314,
8202,
15660,
2075,
9863,
24454,
2015,
1006,
22476,
2239,
1007,
1063,
22476,
2239,
1012,
5587,
18442,
19422,
27870,
3678,
1006,
1005,
8080,
1035,
2824,
1035,
11957,
1005,
1010,
1005,
29197,
20051,
18532,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/editor/EditorCommandHandlers.js | _isPrevTokenABlockComment | function _isPrevTokenABlockComment(ctx, prefix, suffix, prefixExp, suffixExp, lineExp) {
// Start searching from the previous token
var result = TokenUtils.moveSkippingWhitespace(TokenUtils.movePrevToken, ctx);
// Look backwards until we find a none line comment token
while (result && _matchExpressions(ctx.token.string, lineExp)) {
result = TokenUtils.moveSkippingWhitespace(TokenUtils.movePrevToken, ctx);
}
// If we are now in a block comment token
if (result && ctx.token.type === "comment") {
// If it doesnt matches either prefix or suffix, we know is a block comment
if (!ctx.token.string.match(prefixExp) && !ctx.token.string.match(suffixExp)) {
return true;
// We found a line with just a block comment delimiter, but we can't tell which one it is, so we will
// keep searching recursively and return the opposite value
} else if (prefix === suffix && ctx.token.string.length === prefix.length) {
return !_isPrevTokenABlockComment(ctx, prefix, suffix, prefixExp, suffixExp, lineExp);
// We can just now the result by checking if the string matches the prefix
} else {
return ctx.token.string.match(prefixExp);
}
}
return false;
} | javascript | function _isPrevTokenABlockComment(ctx, prefix, suffix, prefixExp, suffixExp, lineExp) {
// Start searching from the previous token
var result = TokenUtils.moveSkippingWhitespace(TokenUtils.movePrevToken, ctx);
// Look backwards until we find a none line comment token
while (result && _matchExpressions(ctx.token.string, lineExp)) {
result = TokenUtils.moveSkippingWhitespace(TokenUtils.movePrevToken, ctx);
}
// If we are now in a block comment token
if (result && ctx.token.type === "comment") {
// If it doesnt matches either prefix or suffix, we know is a block comment
if (!ctx.token.string.match(prefixExp) && !ctx.token.string.match(suffixExp)) {
return true;
// We found a line with just a block comment delimiter, but we can't tell which one it is, so we will
// keep searching recursively and return the opposite value
} else if (prefix === suffix && ctx.token.string.length === prefix.length) {
return !_isPrevTokenABlockComment(ctx, prefix, suffix, prefixExp, suffixExp, lineExp);
// We can just now the result by checking if the string matches the prefix
} else {
return ctx.token.string.match(prefixExp);
}
}
return false;
} | [
"function",
"_isPrevTokenABlockComment",
"(",
"ctx",
",",
"prefix",
",",
"suffix",
",",
"prefixExp",
",",
"suffixExp",
",",
"lineExp",
")",
"{",
"// Start searching from the previous token",
"var",
"result",
"=",
"TokenUtils",
".",
"moveSkippingWhitespace",
"(",
"Toke... | @private
Given a token context it will search backwards to determine if the given token is part of a block comment
that doesn't start at the initial token. This is used to know if a line comment is part of a block comment
or if a block delimiter is the prefix or suffix, by passing a token context at that position. Since the
token context will be moved backwards a lot, it is better to pass a new context.
@param {!{editor:{CodeMirror}, pos:{ch:{number}, line:{number}}, token:{object}}} ctx token context
@param {!string} prefix the block comment prefix
@param {!string} suffix the block comment suffix
@param {!RegExp} prefixExp a block comment prefix regular expression
@param {!RegExp} suffixExp a block comment suffix regular expression
@param {!Array.<RegExp>} lineExp an array of line comment prefixes regular expressions
@return {boolean} | [
"@private",
"Given",
"a",
"token",
"context",
"it",
"will",
"search",
"backwards",
"to",
"determine",
"if",
"the",
"given",
"token",
"is",
"part",
"of",
"a",
"block",
"comment",
"that",
"doesn",
"t",
"start",
"at",
"the",
"initial",
"token",
".",
"This",
... | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/editor/EditorCommandHandlers.js#L274-L298 | train | Check if the previous token is a block comment | [
30522,
3853,
1035,
2003,
30524,
23467,
9006,
3672,
1006,
14931,
2595,
1010,
17576,
1010,
16809,
1010,
17576,
10288,
2361,
1010,
16809,
10288,
2361,
1010,
2240,
10288,
2361,
1007,
1063,
1013,
1013,
2707,
6575,
2013,
1996,
3025,
19204,
13075,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Dogfalo/materialize | extras/noUiSlider/nouislider.js | bindSliderEvents | function bindSliderEvents ( behaviour ) {
// Attach the standard drag event to the handles.
if ( !behaviour.fixed ) {
scope_Handles.forEach(function( handle, index ){
// These events are only bound to the visual handle
// element, not the 'real' origin element.
attachEvent ( actions.start, handle.children[0], eventStart, {
handleNumbers: [index]
});
});
}
// Attach the tap event to the slider base.
if ( behaviour.tap ) {
attachEvent (actions.start, scope_Base, eventTap, {});
}
// Fire hover events
if ( behaviour.hover ) {
attachEvent (actions.move, scope_Base, eventHover, { hover: true });
}
// Make the range draggable.
if ( behaviour.drag ){
scope_Connects.forEach(function( connect, index ){
if ( connect === false || index === 0 || index === scope_Connects.length - 1 ) {
return;
}
var handleBefore = scope_Handles[index - 1];
var handleAfter = scope_Handles[index];
var eventHolders = [connect];
addClass(connect, options.cssClasses.draggable);
// When the range is fixed, the entire range can
// be dragged by the handles. The handle in the first
// origin will propagate the start event upward,
// but it needs to be bound manually on the other.
if ( behaviour.fixed ) {
eventHolders.push(handleBefore.children[0]);
eventHolders.push(handleAfter.children[0]);
}
eventHolders.forEach(function( eventHolder ) {
attachEvent ( actions.start, eventHolder, eventStart, {
handles: [handleBefore, handleAfter],
handleNumbers: [index - 1, index]
});
});
});
}
} | javascript | function bindSliderEvents ( behaviour ) {
// Attach the standard drag event to the handles.
if ( !behaviour.fixed ) {
scope_Handles.forEach(function( handle, index ){
// These events are only bound to the visual handle
// element, not the 'real' origin element.
attachEvent ( actions.start, handle.children[0], eventStart, {
handleNumbers: [index]
});
});
}
// Attach the tap event to the slider base.
if ( behaviour.tap ) {
attachEvent (actions.start, scope_Base, eventTap, {});
}
// Fire hover events
if ( behaviour.hover ) {
attachEvent (actions.move, scope_Base, eventHover, { hover: true });
}
// Make the range draggable.
if ( behaviour.drag ){
scope_Connects.forEach(function( connect, index ){
if ( connect === false || index === 0 || index === scope_Connects.length - 1 ) {
return;
}
var handleBefore = scope_Handles[index - 1];
var handleAfter = scope_Handles[index];
var eventHolders = [connect];
addClass(connect, options.cssClasses.draggable);
// When the range is fixed, the entire range can
// be dragged by the handles. The handle in the first
// origin will propagate the start event upward,
// but it needs to be bound manually on the other.
if ( behaviour.fixed ) {
eventHolders.push(handleBefore.children[0]);
eventHolders.push(handleAfter.children[0]);
}
eventHolders.forEach(function( eventHolder ) {
attachEvent ( actions.start, eventHolder, eventStart, {
handles: [handleBefore, handleAfter],
handleNumbers: [index - 1, index]
});
});
});
}
} | [
"function",
"bindSliderEvents",
"(",
"behaviour",
")",
"{",
"// Attach the standard drag event to the handles.",
"if",
"(",
"!",
"behaviour",
".",
"fixed",
")",
"{",
"scope_Handles",
".",
"forEach",
"(",
"function",
"(",
"handle",
",",
"index",
")",
"{",
"// These... | Attach events to several slider parts. | [
"Attach",
"events",
"to",
"several",
"slider",
"parts",
"."
] | 1122efadad8f1433d404696f7613e3cc13fb83a4 | https://github.com/Dogfalo/materialize/blob/1122efadad8f1433d404696f7613e3cc13fb83a4/extras/noUiSlider/nouislider.js#L1658-L1715 | train | Binds the events to the slider base. | [
30522,
3853,
20817,
24198,
2890,
15338,
2015,
1006,
9164,
1007,
1063,
1013,
1013,
22476,
1996,
3115,
8011,
2724,
2000,
1996,
16024,
1012,
2065,
1006,
999,
9164,
1012,
4964,
1007,
1063,
9531,
1035,
16024,
1012,
18921,
6776,
1006,
3853,
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... |
aframevr/aframe | examples/showcase/link-traversal/js/components/aframe-tooltip-component.js | function () {
var el = this.el;
var data = this.data;
var quad = this.quad = document.createElement('a-entity');
var self = this;
quad.setAttribute('rotation', data.rotation);
quad.setAttribute('text', {width: .25, color: '#fff', value: data.text, align: 'center'});
el.appendChild(quad);
// Line
var material = this.material = new THREE.LineBasicMaterial({color: data.lineColor, opacity: data.opacity, transparent: data.opacity < 1});
var geometry = this.geometry = new THREE.BufferGeometry();
geometry.addAttribute('position', new THREE.BufferAttribute(new Float32Array(2 * 3), 3));
this.line = new THREE.Line(geometry, material);
this.el.setObject3D('tooltip-line', this.line);
} | javascript | function () {
var el = this.el;
var data = this.data;
var quad = this.quad = document.createElement('a-entity');
var self = this;
quad.setAttribute('rotation', data.rotation);
quad.setAttribute('text', {width: .25, color: '#fff', value: data.text, align: 'center'});
el.appendChild(quad);
// Line
var material = this.material = new THREE.LineBasicMaterial({color: data.lineColor, opacity: data.opacity, transparent: data.opacity < 1});
var geometry = this.geometry = new THREE.BufferGeometry();
geometry.addAttribute('position', new THREE.BufferAttribute(new Float32Array(2 * 3), 3));
this.line = new THREE.Line(geometry, material);
this.el.setObject3D('tooltip-line', this.line);
} | [
"function",
"(",
")",
"{",
"var",
"el",
"=",
"this",
".",
"el",
";",
"var",
"data",
"=",
"this",
".",
"data",
";",
"var",
"quad",
"=",
"this",
".",
"quad",
"=",
"document",
".",
"createElement",
"(",
"'a-entity'",
")",
";",
"var",
"self",
"=",
"t... | Called once when component is attached. Generally for initial setup. | [
"Called",
"once",
"when",
"component",
"is",
"attached",
".",
"Generally",
"for",
"initial",
"setup",
"."
] | 24acc78a7299a4cdfe3ef617f4d40ddf6275c992 | https://github.com/aframevr/aframe/blob/24acc78a7299a4cdfe3ef617f4d40ddf6275c992/examples/showcase/link-traversal/js/components/aframe-tooltip-component.js#L80-L99 | train | Create the tooltip | [
30522,
3853,
1006,
1007,
1063,
13075,
3449,
1027,
2023,
1012,
3449,
1025,
13075,
2951,
1027,
2023,
1012,
2951,
1025,
13075,
17718,
1027,
2023,
1012,
17718,
1027,
6254,
1012,
3443,
12260,
3672,
1006,
1005,
1037,
1011,
9178,
1005,
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... | |
swimlane/ngx-datatable | release/utils/column.js | columnTotalWidth | function columnTotalWidth(columns, prop) {
var totalWidth = 0;
if (columns) {
for (var _i = 0, columns_1 = columns; _i < columns_1.length; _i++) {
var c = columns_1[_i];
var has = prop && c[prop];
var width = has ? c[prop] : c.width;
totalWidth = totalWidth + parseFloat(width);
}
}
return totalWidth;
} | javascript | function columnTotalWidth(columns, prop) {
var totalWidth = 0;
if (columns) {
for (var _i = 0, columns_1 = columns; _i < columns_1.length; _i++) {
var c = columns_1[_i];
var has = prop && c[prop];
var width = has ? c[prop] : c.width;
totalWidth = totalWidth + parseFloat(width);
}
}
return totalWidth;
} | [
"function",
"columnTotalWidth",
"(",
"columns",
",",
"prop",
")",
"{",
"var",
"totalWidth",
"=",
"0",
";",
"if",
"(",
"columns",
")",
"{",
"for",
"(",
"var",
"_i",
"=",
"0",
",",
"columns_1",
"=",
"columns",
";",
"_i",
"<",
"columns_1",
".",
"length"... | Calculates the total width of all columns and their groups | [
"Calculates",
"the",
"total",
"width",
"of",
"all",
"columns",
"and",
"their",
"groups"
] | d7df15a070282a169524dba51d9572008b74804c | https://github.com/swimlane/ngx-datatable/blob/d7df15a070282a169524dba51d9572008b74804c/release/utils/column.js#L44-L55 | train | Get total width of a column | [
30522,
3853,
5930,
3406,
9080,
9148,
11927,
2232,
1006,
7753,
1010,
17678,
1007,
1063,
13075,
2561,
9148,
11927,
2232,
1027,
1014,
1025,
2065,
1006,
7753,
1007,
1063,
2005,
1006,
13075,
1035,
1045,
1027,
1014,
1010,
7753,
1035,
1015,
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... |
tensorflow/tfjs-models | posenet/demos/camera.js | setupGui | function setupGui(cameras, net) {
guiState.net = net;
if (cameras.length > 0) {
guiState.camera = cameras[0].deviceId;
}
const gui = new dat.GUI({width: 300});
// The single-pose algorithm is faster and simpler but requires only one
// person to be in the frame or results will be innaccurate. Multi-pose works
// for more than 1 person
const algorithmController =
gui.add(guiState, 'algorithm', ['single-pose', 'multi-pose']);
// The input parameters have the most effect on accuracy and speed of the
// network
let input = gui.addFolder('Input');
// Architecture: there are a few PoseNet models varying in size and
// accuracy. 1.01 is the largest, but will be the slowest. 0.50 is the
// fastest, but least accurate.
const architectureController = input.add(
guiState.input, 'mobileNetArchitecture',
['1.01', '1.00', '0.75', '0.50']);
// Output stride: Internally, this parameter affects the height and width of
// the layers in the neural network. The lower the value of the output stride
// the higher the accuracy but slower the speed, the higher the value the
// faster the speed but lower the accuracy.
input.add(guiState.input, 'outputStride', [8, 16, 32]);
// Image scale factor: What to scale the image by before feeding it through
// the network.
input.add(guiState.input, 'imageScaleFactor').min(0.2).max(1.0);
input.open();
// Pose confidence: the overall confidence in the estimation of a person's
// pose (i.e. a person detected in a frame)
// Min part confidence: the confidence that a particular estimated keypoint
// position is accurate (i.e. the elbow's position)
let single = gui.addFolder('Single Pose Detection');
single.add(guiState.singlePoseDetection, 'minPoseConfidence', 0.0, 1.0);
single.add(guiState.singlePoseDetection, 'minPartConfidence', 0.0, 1.0);
let multi = gui.addFolder('Multi Pose Detection');
multi.add(guiState.multiPoseDetection, 'maxPoseDetections')
.min(1)
.max(20)
.step(1);
multi.add(guiState.multiPoseDetection, 'minPoseConfidence', 0.0, 1.0);
multi.add(guiState.multiPoseDetection, 'minPartConfidence', 0.0, 1.0);
// nms Radius: controls the minimum distance between poses that are returned
// defaults to 20, which is probably fine for most use cases
multi.add(guiState.multiPoseDetection, 'nmsRadius').min(0.0).max(40.0);
multi.open();
let output = gui.addFolder('Output');
output.add(guiState.output, 'showVideo');
output.add(guiState.output, 'showSkeleton');
output.add(guiState.output, 'showPoints');
output.add(guiState.output, 'showBoundingBox');
output.open();
architectureController.onChange(function(architecture) {
guiState.changeToArchitecture = architecture;
});
algorithmController.onChange(function(value) {
switch (guiState.algorithm) {
case 'single-pose':
multi.close();
single.open();
break;
case 'multi-pose':
single.close();
multi.open();
break;
}
});
} | javascript | function setupGui(cameras, net) {
guiState.net = net;
if (cameras.length > 0) {
guiState.camera = cameras[0].deviceId;
}
const gui = new dat.GUI({width: 300});
// The single-pose algorithm is faster and simpler but requires only one
// person to be in the frame or results will be innaccurate. Multi-pose works
// for more than 1 person
const algorithmController =
gui.add(guiState, 'algorithm', ['single-pose', 'multi-pose']);
// The input parameters have the most effect on accuracy and speed of the
// network
let input = gui.addFolder('Input');
// Architecture: there are a few PoseNet models varying in size and
// accuracy. 1.01 is the largest, but will be the slowest. 0.50 is the
// fastest, but least accurate.
const architectureController = input.add(
guiState.input, 'mobileNetArchitecture',
['1.01', '1.00', '0.75', '0.50']);
// Output stride: Internally, this parameter affects the height and width of
// the layers in the neural network. The lower the value of the output stride
// the higher the accuracy but slower the speed, the higher the value the
// faster the speed but lower the accuracy.
input.add(guiState.input, 'outputStride', [8, 16, 32]);
// Image scale factor: What to scale the image by before feeding it through
// the network.
input.add(guiState.input, 'imageScaleFactor').min(0.2).max(1.0);
input.open();
// Pose confidence: the overall confidence in the estimation of a person's
// pose (i.e. a person detected in a frame)
// Min part confidence: the confidence that a particular estimated keypoint
// position is accurate (i.e. the elbow's position)
let single = gui.addFolder('Single Pose Detection');
single.add(guiState.singlePoseDetection, 'minPoseConfidence', 0.0, 1.0);
single.add(guiState.singlePoseDetection, 'minPartConfidence', 0.0, 1.0);
let multi = gui.addFolder('Multi Pose Detection');
multi.add(guiState.multiPoseDetection, 'maxPoseDetections')
.min(1)
.max(20)
.step(1);
multi.add(guiState.multiPoseDetection, 'minPoseConfidence', 0.0, 1.0);
multi.add(guiState.multiPoseDetection, 'minPartConfidence', 0.0, 1.0);
// nms Radius: controls the minimum distance between poses that are returned
// defaults to 20, which is probably fine for most use cases
multi.add(guiState.multiPoseDetection, 'nmsRadius').min(0.0).max(40.0);
multi.open();
let output = gui.addFolder('Output');
output.add(guiState.output, 'showVideo');
output.add(guiState.output, 'showSkeleton');
output.add(guiState.output, 'showPoints');
output.add(guiState.output, 'showBoundingBox');
output.open();
architectureController.onChange(function(architecture) {
guiState.changeToArchitecture = architecture;
});
algorithmController.onChange(function(value) {
switch (guiState.algorithm) {
case 'single-pose':
multi.close();
single.open();
break;
case 'multi-pose':
single.close();
multi.open();
break;
}
});
} | [
"function",
"setupGui",
"(",
"cameras",
",",
"net",
")",
"{",
"guiState",
".",
"net",
"=",
"net",
";",
"if",
"(",
"cameras",
".",
"length",
">",
"0",
")",
"{",
"guiState",
".",
"camera",
"=",
"cameras",
"[",
"0",
"]",
".",
"deviceId",
";",
"}",
"... | Sets up dat.gui controller on the top-right of the window | [
"Sets",
"up",
"dat",
".",
"gui",
"controller",
"on",
"the",
"top",
"-",
"right",
"of",
"the",
"window"
] | af194797c90cc5bcac1060d3cd41b0258a34c7dc | https://github.com/tensorflow/tfjs-models/blob/af194797c90cc5bcac1060d3cd41b0258a34c7dc/posenet/demos/camera.js#L107-L185 | train | Setup the GUI for the neural network | [
30522,
3853,
16437,
25698,
1006,
8629,
1010,
5658,
1007,
1063,
26458,
9153,
2618,
1012,
5658,
1027,
5658,
1025,
2065,
1006,
8629,
1012,
3091,
1028,
1014,
1007,
1063,
26458,
9153,
2618,
1012,
4950,
1027,
8629,
1031,
1014,
1033,
1012,
5080,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | lineStyleFunction | function lineStyleFunction(feature, resolution) {
return new Style({
stroke: new Stroke({
color: 'green',
width: 2
}),
text: createTextStyle(feature, resolution, myDom.lines)
});
} | javascript | function lineStyleFunction(feature, resolution) {
return new Style({
stroke: new Stroke({
color: 'green',
width: 2
}),
text: createTextStyle(feature, resolution, myDom.lines)
});
} | [
"function",
"lineStyleFunction",
"(",
"feature",
",",
"resolution",
")",
"{",
"return",
"new",
"Style",
"(",
"{",
"stroke",
":",
"new",
"Stroke",
"(",
"{",
"color",
":",
"'green'",
",",
"width",
":",
"2",
"}",
")",
",",
"text",
":",
"createTextStyle",
... | Lines | [
"Lines"
] | f366eaea522388fb575b11010e69d309164baca7 | https://github.com/openlayers/openlayers/blob/f366eaea522388fb575b11010e69d309164baca7/examples/vector-labels.js#L151-L159 | train | Creates a style object for a line | [
30522,
3853,
3210,
27983,
11263,
27989,
1006,
3444,
1010,
5813,
1007,
1063,
2709,
2047,
2806,
1006,
1063,
6909,
1024,
2047,
6909,
1006,
1063,
3609,
1024,
1005,
2665,
1005,
1010,
9381,
1024,
1016,
1065,
1007,
1010,
3793,
1024,
3443,
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.core/src/sap/ui/thirdparty/RequestRecorder.js | function(mOptions) {
mOptions = mOptions || {};
if (typeof mOptions !== "object") {
throw new Error("Parameter object isn't a valid object");
}
// Reset all parameters to default
this.mHarFileContent = null;
this.aRequests = [];
this.sFilename = "";
this.bIsRecording = false;
this.bIsPaused = false;
this.bIsDownloadDisabled = false;
if (this.oSinonXhr) {
this.oSinonXhr.filters = this.aSinonFilters;
this.aSinonFilters = [];
this.oSinonXhr.restore();
this.oSinonXhr = null;
}
// Restore native XHR functions if they were overwritten.
for (var sFunctionName in this.mXhrNativeFunctions) {
if (this.mXhrNativeFunctions.hasOwnProperty(sFunctionName)) {
window.XMLHttpRequest.prototype[sFunctionName] = this.mXhrNativeFunctions[sFunctionName];
}
}
this.mXhrNativeFunctions = {};
// Set options to provided values or to default
this.bIsDownloadDisabled = mOptions.disableDownload === true;
this.bPromptForDownloadFilename = mOptions.promptForDownloadFilename === true;
if (mOptions.delay) {
if (mOptions.delay === true) {
this.mDelaySettings = {}; // Use delay of recording
} else {
this.mDelaySettings = mOptions.delay;
}
} else {
this.mDelaySettings = { max: 0 }; // default: no delay
}
if (mOptions.entriesUrlFilter) {
if (Array.isArray(mOptions.entriesUrlFilter)) {
this.aEntriesUrlFilter = mOptions.entriesUrlFilter;
} else {
this.aEntriesUrlFilter = [mOptions.entriesUrlFilter];
}
} else {
this.aEntriesUrlFilter = [new RegExp(".*")]; // default: no filtering
}
if (mOptions.entriesUrlReplace) {
if (Array.isArray(mOptions.entriesUrlReplace)) {
this.aEntriesUrlReplace = mOptions.entriesUrlReplace;
} else {
this.aEntriesUrlReplace = [mOptions.entriesUrlReplace];
}
} else {
this.aEntriesUrlReplace = [];
}
if (mOptions.customGroupNameCallback && typeof mOptions.customGroupNameCallback === "function") {
this.fnCustomGroupNameCallback = mOptions.customGroupNameCallback;
} else {
this.fnCustomGroupNameCallback = function() { return false; }; // default: Empty Callback function used
}
} | javascript | function(mOptions) {
mOptions = mOptions || {};
if (typeof mOptions !== "object") {
throw new Error("Parameter object isn't a valid object");
}
// Reset all parameters to default
this.mHarFileContent = null;
this.aRequests = [];
this.sFilename = "";
this.bIsRecording = false;
this.bIsPaused = false;
this.bIsDownloadDisabled = false;
if (this.oSinonXhr) {
this.oSinonXhr.filters = this.aSinonFilters;
this.aSinonFilters = [];
this.oSinonXhr.restore();
this.oSinonXhr = null;
}
// Restore native XHR functions if they were overwritten.
for (var sFunctionName in this.mXhrNativeFunctions) {
if (this.mXhrNativeFunctions.hasOwnProperty(sFunctionName)) {
window.XMLHttpRequest.prototype[sFunctionName] = this.mXhrNativeFunctions[sFunctionName];
}
}
this.mXhrNativeFunctions = {};
// Set options to provided values or to default
this.bIsDownloadDisabled = mOptions.disableDownload === true;
this.bPromptForDownloadFilename = mOptions.promptForDownloadFilename === true;
if (mOptions.delay) {
if (mOptions.delay === true) {
this.mDelaySettings = {}; // Use delay of recording
} else {
this.mDelaySettings = mOptions.delay;
}
} else {
this.mDelaySettings = { max: 0 }; // default: no delay
}
if (mOptions.entriesUrlFilter) {
if (Array.isArray(mOptions.entriesUrlFilter)) {
this.aEntriesUrlFilter = mOptions.entriesUrlFilter;
} else {
this.aEntriesUrlFilter = [mOptions.entriesUrlFilter];
}
} else {
this.aEntriesUrlFilter = [new RegExp(".*")]; // default: no filtering
}
if (mOptions.entriesUrlReplace) {
if (Array.isArray(mOptions.entriesUrlReplace)) {
this.aEntriesUrlReplace = mOptions.entriesUrlReplace;
} else {
this.aEntriesUrlReplace = [mOptions.entriesUrlReplace];
}
} else {
this.aEntriesUrlReplace = [];
}
if (mOptions.customGroupNameCallback && typeof mOptions.customGroupNameCallback === "function") {
this.fnCustomGroupNameCallback = mOptions.customGroupNameCallback;
} else {
this.fnCustomGroupNameCallback = function() { return false; }; // default: Empty Callback function used
}
} | [
"function",
"(",
"mOptions",
")",
"{",
"mOptions",
"=",
"mOptions",
"||",
"{",
"}",
";",
"if",
"(",
"typeof",
"mOptions",
"!==",
"\"object\"",
")",
"{",
"throw",
"new",
"Error",
"(",
"\"Parameter object isn't a valid object\"",
")",
";",
"}",
"// Reset all par... | Initilizes the RequestRecorder with the provided options, otherwise all default options will be set.
This method is used to init and also to RESET the needed paramters before replay and recording.
It restores sinon and the native XHR functions which are overwritten during the recording.
@param {object} mOptions The options parameter from the public API (start, play, record). | [
"Initilizes",
"the",
"RequestRecorder",
"with",
"the",
"provided",
"options",
"otherwise",
"all",
"default",
"options",
"will",
"be",
"set",
".",
"This",
"method",
"is",
"used",
"to",
"init",
"and",
"also",
"to",
"RESET",
"the",
"needed",
"paramters",
"before"... | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/RequestRecorder.js#L429-L494 | train | Resets all parameters to default values | [
30522,
3853,
1006,
9587,
16790,
2015,
1007,
1063,
9587,
16790,
2015,
1027,
9587,
16790,
2015,
1064,
1064,
1063,
1065,
1025,
2065,
1006,
2828,
11253,
9587,
16790,
2015,
999,
1027,
1027,
1000,
4874,
1000,
1007,
1063,
5466,
2047,
7561,
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.table/src/sap/ui/table/Table.js | setMinColWidths | function setMinColWidths(oTable) {
var oTableRef = oTable.getDomRef();
var iAbsoluteMinWidth = TableUtils.Column.getMinColumnWidth();
var aNotFixedVariableColumns = [];
var bColumnHeaderVisible = oTable.getColumnHeaderVisible();
function calcNewWidth(iDomWidth, iMinWidth) {
if (iDomWidth <= iMinWidth) {
// tolerance of -5px to make the resizing smooother
return Math.max(iDomWidth, iMinWidth - 5, iAbsoluteMinWidth) + "px";
}
return -1;
}
function isFixNeeded(col) {
var minWidth = Math.max(col._minWidth || 0, iAbsoluteMinWidth, col.getMinWidth());
var colWidth = col.getWidth();
var aColHeaders;
var colHeader;
var domWidth;
// if a column has variable width, check if its current width of the
// first corresponding <th> element in less than minimum and store it;
// do not change freezed columns
if (TableUtils.isVariableWidth(colWidth) && !TableUtils.isFixedColumn(oTable, col.getIndex())) {
aColHeaders = oTableRef.querySelectorAll('th[data-sap-ui-colid="' + col.getId() + '"]');
colHeader = aColHeaders[bColumnHeaderVisible ? 0 : 1]; // if column headers have display:none, use data table
domWidth = colHeader ? colHeader.offsetWidth : null;
if (domWidth !== null) {
if (domWidth <= minWidth) {
return {headers : aColHeaders, newWidth: calcNewWidth(domWidth, minWidth)};
} else if (colHeader && colHeader.style.width != colWidth) {
aNotFixedVariableColumns.push({col: col, header: colHeader, minWidth: minWidth, headers: aColHeaders});
// reset the minimum style width that was set previously
return {headers : aColHeaders, newWidth: colWidth};
}
aNotFixedVariableColumns.push({col: col, header: colHeader, minWidth: minWidth, headers: aColHeaders});
}
}
return null;
}
function adaptColWidth(oColInfo) {
if (oColInfo) {
Array.prototype.forEach.call(oColInfo.headers, function(header) {
header.style.width = oColInfo.newWidth;
});
}
}
// adjust widths of all found column headers
oTable._getVisibleColumns().map(isFixNeeded).forEach(adaptColWidth);
//Check the rest of the flexible non-adapted columns
//Due to adaptations they could be smaller now.
if (aNotFixedVariableColumns.length) {
var iDomWidth;
for (var i = 0; i < aNotFixedVariableColumns.length; i++) {
iDomWidth = aNotFixedVariableColumns[i].header && aNotFixedVariableColumns[i].header.offsetWidth;
aNotFixedVariableColumns[i].newWidth = calcNewWidth(iDomWidth, aNotFixedVariableColumns[i].minWidth);
if (parseInt(aNotFixedVariableColumns[i].newWidth) >= 0) {
adaptColWidth(aNotFixedVariableColumns[i]);
}
}
}
} | javascript | function setMinColWidths(oTable) {
var oTableRef = oTable.getDomRef();
var iAbsoluteMinWidth = TableUtils.Column.getMinColumnWidth();
var aNotFixedVariableColumns = [];
var bColumnHeaderVisible = oTable.getColumnHeaderVisible();
function calcNewWidth(iDomWidth, iMinWidth) {
if (iDomWidth <= iMinWidth) {
// tolerance of -5px to make the resizing smooother
return Math.max(iDomWidth, iMinWidth - 5, iAbsoluteMinWidth) + "px";
}
return -1;
}
function isFixNeeded(col) {
var minWidth = Math.max(col._minWidth || 0, iAbsoluteMinWidth, col.getMinWidth());
var colWidth = col.getWidth();
var aColHeaders;
var colHeader;
var domWidth;
// if a column has variable width, check if its current width of the
// first corresponding <th> element in less than minimum and store it;
// do not change freezed columns
if (TableUtils.isVariableWidth(colWidth) && !TableUtils.isFixedColumn(oTable, col.getIndex())) {
aColHeaders = oTableRef.querySelectorAll('th[data-sap-ui-colid="' + col.getId() + '"]');
colHeader = aColHeaders[bColumnHeaderVisible ? 0 : 1]; // if column headers have display:none, use data table
domWidth = colHeader ? colHeader.offsetWidth : null;
if (domWidth !== null) {
if (domWidth <= minWidth) {
return {headers : aColHeaders, newWidth: calcNewWidth(domWidth, minWidth)};
} else if (colHeader && colHeader.style.width != colWidth) {
aNotFixedVariableColumns.push({col: col, header: colHeader, minWidth: minWidth, headers: aColHeaders});
// reset the minimum style width that was set previously
return {headers : aColHeaders, newWidth: colWidth};
}
aNotFixedVariableColumns.push({col: col, header: colHeader, minWidth: minWidth, headers: aColHeaders});
}
}
return null;
}
function adaptColWidth(oColInfo) {
if (oColInfo) {
Array.prototype.forEach.call(oColInfo.headers, function(header) {
header.style.width = oColInfo.newWidth;
});
}
}
// adjust widths of all found column headers
oTable._getVisibleColumns().map(isFixNeeded).forEach(adaptColWidth);
//Check the rest of the flexible non-adapted columns
//Due to adaptations they could be smaller now.
if (aNotFixedVariableColumns.length) {
var iDomWidth;
for (var i = 0; i < aNotFixedVariableColumns.length; i++) {
iDomWidth = aNotFixedVariableColumns[i].header && aNotFixedVariableColumns[i].header.offsetWidth;
aNotFixedVariableColumns[i].newWidth = calcNewWidth(iDomWidth, aNotFixedVariableColumns[i].minWidth);
if (parseInt(aNotFixedVariableColumns[i].newWidth) >= 0) {
adaptColWidth(aNotFixedVariableColumns[i]);
}
}
}
} | [
"function",
"setMinColWidths",
"(",
"oTable",
")",
"{",
"var",
"oTableRef",
"=",
"oTable",
".",
"getDomRef",
"(",
")",
";",
"var",
"iAbsoluteMinWidth",
"=",
"TableUtils",
".",
"Column",
".",
"getMinColumnWidth",
"(",
")",
";",
"var",
"aNotFixedVariableColumns",
... | the only place to fix the minimum column width | [
"the",
"only",
"place",
"to",
"fix",
"the",
"minimum",
"column",
"width"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/Table.js#L1564-L1628 | train | Sets the minimum width of the columns | [
30522,
3853,
2275,
10020,
25778,
9148,
11927,
7898,
1006,
27178,
3085,
1007,
1063,
13075,
27178,
3085,
2890,
2546,
1027,
27178,
3085,
1012,
2131,
9527,
2890,
2546,
1006,
1007,
1025,
13075,
24264,
5910,
4747,
10421,
10020,
9148,
11927,
2232,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Component.js | function() {
// Prerequisite: sap-context-token must not be set in the model URI
if (oUri.hasQuery("sap-context-token")) {
Log.warning("Component Manifest: Ignoring provided \"sap-context-token=" + sCacheToken + "\" for model \"" + sModelName + "\" (" + oUri.toString() + "). " +
"Model URI already contains parameter \"sap-context-token=" + oUri.query(true)["sap-context-token"] + "\"",
"[\"sap.ui5\"][\"models\"][\"" + sModelName + "\"]", sLogComponentName);
return;
}
// 1. "sap-language" must be set in "oModelConfig.settings.metadataUrlParams"
// or part of the model URI
if ((!mMetadataUrlParams || typeof mMetadataUrlParams["sap-language"] === "undefined")
&& !oUri.hasQuery("sap-language")
) {
Log.warning("Component Manifest: Ignoring provided \"sap-context-token=" + sCacheToken + "\" for model \"" + sModelName + "\" (" + oUri.toString() + "). " +
"Missing \"sap-language\" parameter",
"[\"sap.ui5\"][\"models\"][\"" + sModelName + "\"]", sLogComponentName);
return;
}
// 2. "sap-client" must be set as URI param in "oModelConfig.uri"
if (!oUri.hasQuery("sap-client")) {
Log.warning("Component Manifest: Ignoring provided \"sap-context-token=" + sCacheToken + "\" for model \"" + sModelName + "\" (" + oUri.toString() + "). " +
"Missing \"sap-client\" parameter",
"[\"sap.ui5\"][\"models\"][\"" + sModelName + "\"]", sLogComponentName);
return;
}
// 3. "sap-client" must equal to the value of "sap.ui.getCore().getConfiguration().getSAPParam('sap-client')"
if (!oUri.hasQuery("sap-client", oConfig.getSAPParam("sap-client"))) {
Log.warning("Component Manifest: Ignoring provided \"sap-context-token=" + sCacheToken + "\" for model \"" + sModelName + "\" (" + oUri.toString() + "). " +
"URI parameter \"sap-client=" + oUri.query(true)["sap-client"] + "\" must be identical with configuration \"sap-client=" + oConfig.getSAPParam("sap-client") + "\"",
"[\"sap.ui5\"][\"models\"][\"" + sModelName + "\"]", sLogComponentName);
return;
}
// 4. If "mMetadataUrlParams["sap-client"]" is set (which should not be done!), it must also equal to the value of the config
if (mMetadataUrlParams && typeof mMetadataUrlParams["sap-client"] !== "undefined") {
if (mMetadataUrlParams["sap-client"] !== oConfig.getSAPParam("sap-client")) {
Log.warning("Component Manifest: Ignoring provided \"sap-context-token=" + sCacheToken + "\" for model \"" + sModelName + "\" (" + oUri.toString() + "). " +
"Parameter metadataUrlParams[\"sap-client\"] = \"" + mMetadataUrlParams["sap-client"] + "\" must be identical with configuration \"sap-client=" + oConfig.getSAPParam("sap-client") + "\"",
"[\"sap.ui5\"][\"models\"][\"" + sModelName + "\"]", sLogComponentName);
return;
}
}
// Overriding the parameter is fine as the given one should be the most up-to-date
if (mMetadataUrlParams && mMetadataUrlParams["sap-context-token"] && mMetadataUrlParams["sap-context-token"] !== sCacheToken) {
Log.warning("Component Manifest: Overriding existing \"sap-context-token=" + mMetadataUrlParams["sap-context-token"] + "\" with provided value \"" + sCacheToken + "\" for model \"" + sModelName + "\" (" + oUri.toString() + ").",
"[\"sap.ui5\"][\"models\"][\"" + sModelName + "\"]", sLogComponentName);
}
// Lazy initialize settings and metadataUrlParams objects
if (!mMetadataUrlParams) {
oModelConfig.settings = oModelConfig.settings || {};
mMetadataUrlParams = oModelConfig.settings.metadataUrlParams = oModelConfig.settings.metadataUrlParams || {};
}
// Finally, set the sap-context-token
mMetadataUrlParams["sap-context-token"] = sCacheToken;
} | javascript | function() {
// Prerequisite: sap-context-token must not be set in the model URI
if (oUri.hasQuery("sap-context-token")) {
Log.warning("Component Manifest: Ignoring provided \"sap-context-token=" + sCacheToken + "\" for model \"" + sModelName + "\" (" + oUri.toString() + "). " +
"Model URI already contains parameter \"sap-context-token=" + oUri.query(true)["sap-context-token"] + "\"",
"[\"sap.ui5\"][\"models\"][\"" + sModelName + "\"]", sLogComponentName);
return;
}
// 1. "sap-language" must be set in "oModelConfig.settings.metadataUrlParams"
// or part of the model URI
if ((!mMetadataUrlParams || typeof mMetadataUrlParams["sap-language"] === "undefined")
&& !oUri.hasQuery("sap-language")
) {
Log.warning("Component Manifest: Ignoring provided \"sap-context-token=" + sCacheToken + "\" for model \"" + sModelName + "\" (" + oUri.toString() + "). " +
"Missing \"sap-language\" parameter",
"[\"sap.ui5\"][\"models\"][\"" + sModelName + "\"]", sLogComponentName);
return;
}
// 2. "sap-client" must be set as URI param in "oModelConfig.uri"
if (!oUri.hasQuery("sap-client")) {
Log.warning("Component Manifest: Ignoring provided \"sap-context-token=" + sCacheToken + "\" for model \"" + sModelName + "\" (" + oUri.toString() + "). " +
"Missing \"sap-client\" parameter",
"[\"sap.ui5\"][\"models\"][\"" + sModelName + "\"]", sLogComponentName);
return;
}
// 3. "sap-client" must equal to the value of "sap.ui.getCore().getConfiguration().getSAPParam('sap-client')"
if (!oUri.hasQuery("sap-client", oConfig.getSAPParam("sap-client"))) {
Log.warning("Component Manifest: Ignoring provided \"sap-context-token=" + sCacheToken + "\" for model \"" + sModelName + "\" (" + oUri.toString() + "). " +
"URI parameter \"sap-client=" + oUri.query(true)["sap-client"] + "\" must be identical with configuration \"sap-client=" + oConfig.getSAPParam("sap-client") + "\"",
"[\"sap.ui5\"][\"models\"][\"" + sModelName + "\"]", sLogComponentName);
return;
}
// 4. If "mMetadataUrlParams["sap-client"]" is set (which should not be done!), it must also equal to the value of the config
if (mMetadataUrlParams && typeof mMetadataUrlParams["sap-client"] !== "undefined") {
if (mMetadataUrlParams["sap-client"] !== oConfig.getSAPParam("sap-client")) {
Log.warning("Component Manifest: Ignoring provided \"sap-context-token=" + sCacheToken + "\" for model \"" + sModelName + "\" (" + oUri.toString() + "). " +
"Parameter metadataUrlParams[\"sap-client\"] = \"" + mMetadataUrlParams["sap-client"] + "\" must be identical with configuration \"sap-client=" + oConfig.getSAPParam("sap-client") + "\"",
"[\"sap.ui5\"][\"models\"][\"" + sModelName + "\"]", sLogComponentName);
return;
}
}
// Overriding the parameter is fine as the given one should be the most up-to-date
if (mMetadataUrlParams && mMetadataUrlParams["sap-context-token"] && mMetadataUrlParams["sap-context-token"] !== sCacheToken) {
Log.warning("Component Manifest: Overriding existing \"sap-context-token=" + mMetadataUrlParams["sap-context-token"] + "\" with provided value \"" + sCacheToken + "\" for model \"" + sModelName + "\" (" + oUri.toString() + ").",
"[\"sap.ui5\"][\"models\"][\"" + sModelName + "\"]", sLogComponentName);
}
// Lazy initialize settings and metadataUrlParams objects
if (!mMetadataUrlParams) {
oModelConfig.settings = oModelConfig.settings || {};
mMetadataUrlParams = oModelConfig.settings.metadataUrlParams = oModelConfig.settings.metadataUrlParams || {};
}
// Finally, set the sap-context-token
mMetadataUrlParams["sap-context-token"] = sCacheToken;
} | [
"function",
"(",
")",
"{",
"// Prerequisite: sap-context-token must not be set in the model URI",
"if",
"(",
"oUri",
".",
"hasQuery",
"(",
"\"sap-context-token\"",
")",
")",
"{",
"Log",
".",
"warning",
"(",
"\"Component Manifest: Ignoring provided \\\"sap-context-token=\"",
"... | /* eslint-disable no-loop-func | [
"/",
"*",
"eslint",
"-",
"disable",
"no",
"-",
"loop",
"-",
"func"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Component.js#L1465-L1527 | train | Checks if the model URI has already been set | [
30522,
3853,
1006,
1007,
1063,
1013,
1013,
3653,
2890,
24871,
1024,
20066,
1011,
6123,
1011,
19204,
2442,
2025,
2022,
2275,
1999,
1996,
2944,
24471,
2072,
2065,
1006,
2256,
2072,
1012,
2038,
4226,
2854,
1006,
1000,
20066,
1011,
6123,
1011,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/Entity.controller.js | function (oData) {
var FIRST_COLUMN = 0,
SECOND_COLUMN = 1,
THIRD_COLUMN = 2,
ENTITIES_PER_COLUMN = 3,
aHeaderControls = [[], [], []],
oHeaderLayoutUtil = this._getHeaderLayoutUtil(),
aHeaderBlocksInfo = [
{creator: "_getApiReferenceBlock", exists: oData.bHasAPIReference},
{creator: "_getDocumentationBlock", exists: oData.show.introLink},
{creator: "_getUXGuidelinesBlock", exists: !!oData.uxGuidelinesLink},
{creator: "_getExtendsBlock", exists: true},
{creator: "_getApplicationComponentBlock", exists: true},
{creator: "_getAvailableSinceBlock", exists: true},
{creator: "_getCategoryBlock", exists: true},
{creator: "_getContentDensityBlock", exists: true}
],
fnFillHeaderControlsStructure = function () {
var iControlsAdded = 0,
iIndexToAdd,
fnGetIndexToAdd = function (iControlsAdded) {
// determines the column(1st, 2nd or 3rd), the next entity data key-value should be added to.
if (iControlsAdded <= ENTITIES_PER_COLUMN) {
return FIRST_COLUMN;
} else if (iControlsAdded <= ENTITIES_PER_COLUMN * 2) {
return SECOND_COLUMN;
}
return THIRD_COLUMN;
};
aHeaderBlocksInfo.forEach(function (oHeaderBlockInfo) {
var oControlBlock;
if (oHeaderBlockInfo.exists) {
oControlBlock = oHeaderLayoutUtil[oHeaderBlockInfo.creator].call(this, oData);
iIndexToAdd = fnGetIndexToAdd(++iControlsAdded);
aHeaderControls[iIndexToAdd].push(oControlBlock);
}
}, this);
}.bind(this);
// Creates the entity key-value controls
// based on the existing entity key-value data,
fnFillHeaderControlsStructure();
// Wraps each column in a <code>sap.ui.layout.VerticalLayout</code>.
aHeaderControls.forEach(function (aHeaderColumn, iIndex) {
var oVL = this.byId("headerColumn" + iIndex);
oVL.removeAllContent();
if (aHeaderColumn.length > 0) {
oVL.setVisible(true);
aHeaderColumn.forEach(oVL.addContent, oVL);
}
}, this);
} | javascript | function (oData) {
var FIRST_COLUMN = 0,
SECOND_COLUMN = 1,
THIRD_COLUMN = 2,
ENTITIES_PER_COLUMN = 3,
aHeaderControls = [[], [], []],
oHeaderLayoutUtil = this._getHeaderLayoutUtil(),
aHeaderBlocksInfo = [
{creator: "_getApiReferenceBlock", exists: oData.bHasAPIReference},
{creator: "_getDocumentationBlock", exists: oData.show.introLink},
{creator: "_getUXGuidelinesBlock", exists: !!oData.uxGuidelinesLink},
{creator: "_getExtendsBlock", exists: true},
{creator: "_getApplicationComponentBlock", exists: true},
{creator: "_getAvailableSinceBlock", exists: true},
{creator: "_getCategoryBlock", exists: true},
{creator: "_getContentDensityBlock", exists: true}
],
fnFillHeaderControlsStructure = function () {
var iControlsAdded = 0,
iIndexToAdd,
fnGetIndexToAdd = function (iControlsAdded) {
// determines the column(1st, 2nd or 3rd), the next entity data key-value should be added to.
if (iControlsAdded <= ENTITIES_PER_COLUMN) {
return FIRST_COLUMN;
} else if (iControlsAdded <= ENTITIES_PER_COLUMN * 2) {
return SECOND_COLUMN;
}
return THIRD_COLUMN;
};
aHeaderBlocksInfo.forEach(function (oHeaderBlockInfo) {
var oControlBlock;
if (oHeaderBlockInfo.exists) {
oControlBlock = oHeaderLayoutUtil[oHeaderBlockInfo.creator].call(this, oData);
iIndexToAdd = fnGetIndexToAdd(++iControlsAdded);
aHeaderControls[iIndexToAdd].push(oControlBlock);
}
}, this);
}.bind(this);
// Creates the entity key-value controls
// based on the existing entity key-value data,
fnFillHeaderControlsStructure();
// Wraps each column in a <code>sap.ui.layout.VerticalLayout</code>.
aHeaderControls.forEach(function (aHeaderColumn, iIndex) {
var oVL = this.byId("headerColumn" + iIndex);
oVL.removeAllContent();
if (aHeaderColumn.length > 0) {
oVL.setVisible(true);
aHeaderColumn.forEach(oVL.addContent, oVL);
}
}, this);
} | [
"function",
"(",
"oData",
")",
"{",
"var",
"FIRST_COLUMN",
"=",
"0",
",",
"SECOND_COLUMN",
"=",
"1",
",",
"THIRD_COLUMN",
"=",
"2",
",",
"ENTITIES_PER_COLUMN",
"=",
"3",
",",
"aHeaderControls",
"=",
"[",
"[",
"]",
",",
"[",
"]",
",",
"[",
"]",
"]",
... | Builds the header layout structure.
The header displays the entity data in 3 columns
and each column can consist of 3 key-value pairs at most.
@param {object} oData main control data object source | [
"Builds",
"the",
"header",
"layout",
"structure",
".",
"The",
"header",
"displays",
"the",
"entity",
"data",
"in",
"3",
"columns",
"and",
"each",
"column",
"can",
"consist",
"of",
"3",
"key",
"-",
"value",
"pairs",
"at",
"most",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/Entity.controller.js#L477-L531 | train | Creates a structure of the header controls. | [
30522,
3853,
1006,
1051,
2850,
2696,
1007,
1063,
13075,
2034,
1035,
5930,
1027,
1014,
1010,
2117,
1035,
5930,
1027,
1015,
1010,
2353,
1035,
5930,
1027,
1016,
1010,
11422,
1035,
2566,
1035,
5930,
1027,
1017,
1010,
3805,
2121,
8663,
13181,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/reflection/BaseTreeModifier.js | function (oSelector, oAppComponent) {
if (!oSelector){
return undefined;
}
if (typeof oSelector === "string") {
oSelector = {
id: oSelector
};
}
var sControlId = oSelector.id;
if (oSelector.idIsLocal) {
if (oAppComponent) {
sControlId = oAppComponent.createId(sControlId);
} else {
throw new Error("App Component instance needed to get a control's ID from selector");
}
} else {
// does nothing except in the case of a FLP prefix
var pattern = /^application-[^-]*-[^-]*-component---/igm;
var bHasFlpPrefix = !!pattern.exec(oSelector.id);
if (bHasFlpPrefix) {
sControlId = sControlId.replace(/^application-[^-]*-[^-]*-component---/g, "");
if (oAppComponent) {
sControlId = oAppComponent.createId(sControlId);
} else {
throw new Error("App Component instance needed to get a control's ID from selector");
}
}
}
return sControlId;
} | javascript | function (oSelector, oAppComponent) {
if (!oSelector){
return undefined;
}
if (typeof oSelector === "string") {
oSelector = {
id: oSelector
};
}
var sControlId = oSelector.id;
if (oSelector.idIsLocal) {
if (oAppComponent) {
sControlId = oAppComponent.createId(sControlId);
} else {
throw new Error("App Component instance needed to get a control's ID from selector");
}
} else {
// does nothing except in the case of a FLP prefix
var pattern = /^application-[^-]*-[^-]*-component---/igm;
var bHasFlpPrefix = !!pattern.exec(oSelector.id);
if (bHasFlpPrefix) {
sControlId = sControlId.replace(/^application-[^-]*-[^-]*-component---/g, "");
if (oAppComponent) {
sControlId = oAppComponent.createId(sControlId);
} else {
throw new Error("App Component instance needed to get a control's ID from selector");
}
}
}
return sControlId;
} | [
"function",
"(",
"oSelector",
",",
"oAppComponent",
")",
"{",
"if",
"(",
"!",
"oSelector",
")",
"{",
"return",
"undefined",
";",
"}",
"if",
"(",
"typeof",
"oSelector",
"===",
"\"string\"",
")",
"{",
"oSelector",
"=",
"{",
"id",
":",
"oSelector",
"}",
"... | Function determining the control ID from the selector.
The function distinguishes between local IDs generated starting with 1.40 and the global IDs generated in previous versions.
@param {object} oSelector - Target of a flexiblity change
@param {string} oSelector.id - ID of the control targeted by the change
@param {boolean} oSelector.isLocalId - <code>true</code> if the ID within the selector is a local ID or a global ID
@param {sap.ui.core.UIComponent} oAppComponent - Application component
@returns {string} ID of the control
@throws {Error} In case no control could be determined an error is thrown
@protected | [
"Function",
"determining",
"the",
"control",
"ID",
"from",
"the",
"selector",
".",
"The",
"function",
"distinguishes",
"between",
"local",
"IDs",
"generated",
"starting",
"with",
"1",
".",
"40",
"and",
"the",
"global",
"IDs",
"generated",
"in",
"previous",
"ve... | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/util/reflection/BaseTreeModifier.js#L65-L99 | train | Returns the control ID of the control | [
30522,
3853,
1006,
9808,
12260,
16761,
1010,
1051,
29098,
9006,
29513,
3372,
1007,
1063,
2065,
1006,
999,
9808,
12260,
16761,
1007,
1063,
2709,
6151,
28344,
1025,
1065,
2065,
1006,
2828,
11253,
9808,
12260,
16761,
1027,
1027,
1027,
1000,
51... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
socketio/socket.io | lib/socket.js | Socket | function Socket(nsp, client, query){
this.nsp = nsp;
this.server = nsp.server;
this.adapter = this.nsp.adapter;
this.id = nsp.name !== '/' ? nsp.name + '#' + client.id : client.id;
this.client = client;
this.conn = client.conn;
this.rooms = {};
this.acks = {};
this.connected = true;
this.disconnected = false;
this.handshake = this.buildHandshake(query);
this.fns = [];
this.flags = {};
this._rooms = [];
} | javascript | function Socket(nsp, client, query){
this.nsp = nsp;
this.server = nsp.server;
this.adapter = this.nsp.adapter;
this.id = nsp.name !== '/' ? nsp.name + '#' + client.id : client.id;
this.client = client;
this.conn = client.conn;
this.rooms = {};
this.acks = {};
this.connected = true;
this.disconnected = false;
this.handshake = this.buildHandshake(query);
this.fns = [];
this.flags = {};
this._rooms = [];
} | [
"function",
"Socket",
"(",
"nsp",
",",
"client",
",",
"query",
")",
"{",
"this",
".",
"nsp",
"=",
"nsp",
";",
"this",
".",
"server",
"=",
"nsp",
".",
"server",
";",
"this",
".",
"adapter",
"=",
"this",
".",
"nsp",
".",
"adapter",
";",
"this",
"."... | Interface to a `Client` for a given `Namespace`.
@param {Namespace} nsp
@param {Client} client
@api public | [
"Interface",
"to",
"a",
"Client",
"for",
"a",
"given",
"Namespace",
"."
] | 9c1e73c752aec63f48b511330a506d037783d897 | https://github.com/socketio/socket.io/blob/9c1e73c752aec63f48b511330a506d037783d897/lib/socket.js#L60-L75 | train | Socket constructor. | [
30522,
3853,
22278,
1006,
24978,
2361,
1010,
7396,
1010,
23032,
1007,
1063,
2023,
1012,
24978,
2361,
1027,
24978,
2361,
1025,
2023,
1012,
8241,
1027,
24978,
2361,
1012,
8241,
1025,
2023,
1012,
15581,
2121,
1027,
2023,
1012,
24978,
2361,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/LiveDevelopment/LiveDevMultiBrowser.js | getCurrentProjectServerConfig | function getCurrentProjectServerConfig() {
return {
baseUrl: ProjectManager.getBaseUrl(),
pathResolver: ProjectManager.makeProjectRelativeIfPossible,
root: ProjectManager.getProjectRoot().fullPath
};
} | javascript | function getCurrentProjectServerConfig() {
return {
baseUrl: ProjectManager.getBaseUrl(),
pathResolver: ProjectManager.makeProjectRelativeIfPossible,
root: ProjectManager.getProjectRoot().fullPath
};
} | [
"function",
"getCurrentProjectServerConfig",
"(",
")",
"{",
"return",
"{",
"baseUrl",
":",
"ProjectManager",
".",
"getBaseUrl",
"(",
")",
",",
"pathResolver",
":",
"ProjectManager",
".",
"makeProjectRelativeIfPossible",
",",
"root",
":",
"ProjectManager",
".",
"getP... | Returns current project server config. Copied from original LiveDevelopment. | [
"Returns",
"current",
"project",
"server",
"config",
".",
"Copied",
"from",
"original",
"LiveDevelopment",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/LiveDevelopment/LiveDevMultiBrowser.js#L894-L900 | train | Get current project server config | [
30522,
3853,
2131,
10841,
14343,
3372,
21572,
20614,
8043,
6299,
8663,
8873,
2290,
1006,
1007,
1063,
2709,
1063,
2918,
3126,
2140,
1024,
2622,
24805,
4590,
1012,
2131,
15058,
3126,
2140,
1006,
1007,
1010,
4130,
6072,
4747,
6299,
1024,
2622,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/base/strings/NormalizePolyfill.js | nfcQuickCheck | function nfcQuickCheck(s) {
// check for only ascii characters first to avoid unnecessary processing
if (!/^[\u0001-\u00ff]*$/.test(s)) {
var lastCanonicalClass = 0;
for (var i = 0; i < s.length; ++i) {
var cp = s.charCodeAt(i);
// check for supplementary characters, complex, as charCodeAt returns only charcodes smaller than 0xFFFF,
// which is the Basic Multilingual Plane (BMP), but for normalizations also characters of the Supplementary
// Multilingual Plane (SMP) have to be considered
if (isHighSurrogate(cp)) {
// check the next character
var ncp = s.charCodeAt(i + 1);
if (isLowSurrogate(ncp)) {
// calculate the according char code in SMP and skip further tests for the next character (ncp)
cp = (cp - 0xD800) * 0x400 + (ncp - 0xDC00) + 0x10000;
++i;
}
}
var canonicalClass = getCanonicalClass(cp);
// check canonical class or reference list
if (lastCanonicalClass > canonicalClass && canonicalClass !== 0 || isNotAllowed(cp)) {
return false;
}
lastCanonicalClass = canonicalClass;
}
}
// nothing has been found
return true;
} | javascript | function nfcQuickCheck(s) {
// check for only ascii characters first to avoid unnecessary processing
if (!/^[\u0001-\u00ff]*$/.test(s)) {
var lastCanonicalClass = 0;
for (var i = 0; i < s.length; ++i) {
var cp = s.charCodeAt(i);
// check for supplementary characters, complex, as charCodeAt returns only charcodes smaller than 0xFFFF,
// which is the Basic Multilingual Plane (BMP), but for normalizations also characters of the Supplementary
// Multilingual Plane (SMP) have to be considered
if (isHighSurrogate(cp)) {
// check the next character
var ncp = s.charCodeAt(i + 1);
if (isLowSurrogate(ncp)) {
// calculate the according char code in SMP and skip further tests for the next character (ncp)
cp = (cp - 0xD800) * 0x400 + (ncp - 0xDC00) + 0x10000;
++i;
}
}
var canonicalClass = getCanonicalClass(cp);
// check canonical class or reference list
if (lastCanonicalClass > canonicalClass && canonicalClass !== 0 || isNotAllowed(cp)) {
return false;
}
lastCanonicalClass = canonicalClass;
}
}
// nothing has been found
return true;
} | [
"function",
"nfcQuickCheck",
"(",
"s",
")",
"{",
"// check for only ascii characters first to avoid unnecessary processing",
"if",
"(",
"!",
"/",
"^[\\u0001-\\u00ff]*$",
"/",
".",
"test",
"(",
"s",
")",
")",
"{",
"var",
"lastCanonicalClass",
"=",
"0",
";",
"for",
... | quickcheck implementations | [
"quickcheck",
"implementations"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/base/strings/NormalizePolyfill.js#L96-L124 | train | Quick check for a string | [
30522,
3853,
22309,
15549,
3600,
5403,
3600,
1006,
1055,
1007,
1063,
1013,
1013,
4638,
2005,
2069,
2004,
6895,
2072,
3494,
2034,
2000,
4468,
14203,
6364,
2065,
1006,
999,
1013,
1034,
1031,
1032,
1057,
8889,
24096,
1011,
1032,
1057,
8889,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/interimElement/interimElement.js | findParent | function findParent(element, options) {
var parent = options.parent;
// Search for parent at insertion time, if not specified
if (angular.isFunction(parent)) {
parent = parent(options.scope, element, options);
} else if (angular.isString(parent)) {
parent = angular.element($document[0].querySelector(parent));
} else {
parent = angular.element(parent);
}
// If parent querySelector/getter function fails, or it's just null,
// find a default.
if (!(parent || {}).length) {
var el;
if ($rootElement[0] && $rootElement[0].querySelector) {
el = $rootElement[0].querySelector(':not(svg) > body');
}
if (!el) el = $rootElement[0];
if (el.nodeName == '#comment') {
el = $document[0].body;
}
return angular.element(el);
}
return parent;
} | javascript | function findParent(element, options) {
var parent = options.parent;
// Search for parent at insertion time, if not specified
if (angular.isFunction(parent)) {
parent = parent(options.scope, element, options);
} else if (angular.isString(parent)) {
parent = angular.element($document[0].querySelector(parent));
} else {
parent = angular.element(parent);
}
// If parent querySelector/getter function fails, or it's just null,
// find a default.
if (!(parent || {}).length) {
var el;
if ($rootElement[0] && $rootElement[0].querySelector) {
el = $rootElement[0].querySelector(':not(svg) > body');
}
if (!el) el = $rootElement[0];
if (el.nodeName == '#comment') {
el = $document[0].body;
}
return angular.element(el);
}
return parent;
} | [
"function",
"findParent",
"(",
"element",
",",
"options",
")",
"{",
"var",
"parent",
"=",
"options",
".",
"parent",
";",
"// Search for parent at insertion time, if not specified",
"if",
"(",
"angular",
".",
"isFunction",
"(",
"parent",
")",
")",
"{",
"parent",
... | Search for parent at insertion time, if not specified | [
"Search",
"for",
"parent",
"at",
"insertion",
"time",
"if",
"not",
"specified"
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/services/interimElement/interimElement.js#L638-L665 | train | Find parent element | [
30522,
3853,
2424,
19362,
4765,
1006,
5783,
1010,
7047,
1007,
1063,
13075,
6687,
1027,
7047,
1012,
6687,
1025,
1013,
1013,
3945,
2005,
6687,
2012,
23851,
2051,
1010,
2065,
2025,
9675,
2065,
1006,
16108,
1012,
2003,
11263,
27989,
1006,
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... |
GeekyAnts/vue-native-core | packages/vue-native-core/build.js | initRender | function initRender (vm) {
vm._vnode = null; // the root of the child tree
vm._staticTrees = null;
var parentVnode = vm.$vnode = vm.$options._parentVnode; // the placeholder node in parent tree
var renderContext = parentVnode && parentVnode.context;
/**
* react-vue change
*/
// vm.$slots = resolveSlots(vm.$options._renderChildren, renderContext)
vm.$scopedSlots = emptyObject;
// bind the createElement fn to this instance
// so that we get proper render context inside it.
// args order: tag, data, children, normalizationType, alwaysNormalize
// internal version is used by render functions compiled from templates
vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
// normalization is always applied for the public version, used in
// user-written render functions.
vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
} | javascript | function initRender (vm) {
vm._vnode = null; // the root of the child tree
vm._staticTrees = null;
var parentVnode = vm.$vnode = vm.$options._parentVnode; // the placeholder node in parent tree
var renderContext = parentVnode && parentVnode.context;
/**
* react-vue change
*/
// vm.$slots = resolveSlots(vm.$options._renderChildren, renderContext)
vm.$scopedSlots = emptyObject;
// bind the createElement fn to this instance
// so that we get proper render context inside it.
// args order: tag, data, children, normalizationType, alwaysNormalize
// internal version is used by render functions compiled from templates
vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
// normalization is always applied for the public version, used in
// user-written render functions.
vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
} | [
"function",
"initRender",
"(",
"vm",
")",
"{",
"vm",
".",
"_vnode",
"=",
"null",
";",
"// the root of the child tree",
"vm",
".",
"_staticTrees",
"=",
"null",
";",
"var",
"parentVnode",
"=",
"vm",
".",
"$vnode",
"=",
"vm",
".",
"$options",
".",
"_parentVno... | Runtime helper for v-once.
Effectively it means marking the node as static with a unique key.
/* | [
"Runtime",
"helper",
"for",
"v",
"-",
"once",
".",
"Effectively",
"it",
"means",
"marking",
"the",
"node",
"as",
"static",
"with",
"a",
"unique",
"key",
".",
"/",
"*"
] | a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e | https://github.com/GeekyAnts/vue-native-core/blob/a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e/packages/vue-native-core/build.js#L3430-L3448 | train | Initialize the render function | [
30522,
3853,
1999,
4183,
7389,
4063,
1006,
1058,
2213,
1007,
1063,
1058,
2213,
1012,
1035,
1058,
3630,
3207,
1027,
19701,
1025,
1013,
1013,
1996,
7117,
1997,
1996,
2775,
3392,
1058,
2213,
1012,
1035,
10763,
13334,
2015,
1027,
19701,
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... |
adobe/brackets | src/preferences/PreferencesDialogs.js | _validateBaseUrl | function _validateBaseUrl(url) {
var result = "";
// Empty url means "no server mapping; use file directly"
if (url === "") {
return result;
}
var obj = PathUtils.parseUrl(url);
if (!obj) {
result = Strings.BASEURL_ERROR_UNKNOWN_ERROR;
} else if (obj.href.search(/^(http|https):\/\//i) !== 0) {
result = StringUtils.format(Strings.BASEURL_ERROR_INVALID_PROTOCOL, obj.href.substring(0, obj.href.indexOf("//")));
} else if (obj.search !== "") {
result = StringUtils.format(Strings.BASEURL_ERROR_SEARCH_DISALLOWED, obj.search);
} else if (obj.hash !== "") {
result = StringUtils.format(Strings.BASEURL_ERROR_HASH_DISALLOWED, obj.hash);
} else {
var index = url.search(/[ \^\[\]\{\}<>\\"\?]+/);
if (index !== -1) {
result = StringUtils.format(Strings.BASEURL_ERROR_INVALID_CHAR, url[index]);
}
}
return result;
} | javascript | function _validateBaseUrl(url) {
var result = "";
// Empty url means "no server mapping; use file directly"
if (url === "") {
return result;
}
var obj = PathUtils.parseUrl(url);
if (!obj) {
result = Strings.BASEURL_ERROR_UNKNOWN_ERROR;
} else if (obj.href.search(/^(http|https):\/\//i) !== 0) {
result = StringUtils.format(Strings.BASEURL_ERROR_INVALID_PROTOCOL, obj.href.substring(0, obj.href.indexOf("//")));
} else if (obj.search !== "") {
result = StringUtils.format(Strings.BASEURL_ERROR_SEARCH_DISALLOWED, obj.search);
} else if (obj.hash !== "") {
result = StringUtils.format(Strings.BASEURL_ERROR_HASH_DISALLOWED, obj.hash);
} else {
var index = url.search(/[ \^\[\]\{\}<>\\"\?]+/);
if (index !== -1) {
result = StringUtils.format(Strings.BASEURL_ERROR_INVALID_CHAR, url[index]);
}
}
return result;
} | [
"function",
"_validateBaseUrl",
"(",
"url",
")",
"{",
"var",
"result",
"=",
"\"\"",
";",
"// Empty url means \"no server mapping; use file directly\"",
"if",
"(",
"url",
"===",
"\"\"",
")",
"{",
"return",
"result",
";",
"}",
"var",
"obj",
"=",
"PathUtils",
".",
... | Validate that text string is a valid base url which should map to a server folder
@param {string} url
@return {string} Empty string if valid, otherwise error string | [
"Validate",
"that",
"text",
"string",
"is",
"a",
"valid",
"base",
"url",
"which",
"should",
"map",
"to",
"a",
"server",
"folder"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/preferences/PreferencesDialogs.js#L45-L69 | train | Validate a base url | [
30522,
3853,
1035,
9398,
3686,
15058,
3126,
2140,
1006,
24471,
2140,
1007,
1063,
13075,
2765,
1027,
1000,
1000,
1025,
1013,
1013,
4064,
24471,
2140,
2965,
1000,
2053,
8241,
12375,
1025,
2224,
5371,
3495,
1000,
2065,
1006,
24471,
2140,
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.m/src/sap/m/NotificationListBase.js | isIcon | function isIcon(source) {
if (!source) {
return false;
}
var result = window.URI.parse(source);
return (result.protocol && result.protocol == 'sap-icon');
} | javascript | function isIcon(source) {
if (!source) {
return false;
}
var result = window.URI.parse(source);
return (result.protocol && result.protocol == 'sap-icon');
} | [
"function",
"isIcon",
"(",
"source",
")",
"{",
"if",
"(",
"!",
"source",
")",
"{",
"return",
"false",
";",
"}",
"var",
"result",
"=",
"window",
".",
"URI",
".",
"parse",
"(",
"source",
")",
";",
"return",
"(",
"result",
".",
"protocol",
"&&",
"resu... | ================================================================================ Helper methods ================================================================================
Checks if an sap.ui.core.URI parameter is an icon src or not.
@protected
@param {string} source The source to be checked.
@returns {boolean} The result of the check. | [
"================================================================================",
"Helper",
"methods",
"================================================================================",
"Checks",
"if",
"an",
"sap",
".",
"ui",
".",
"core",
".",
"URI",
"parameter",
"is",
"an",
"ic... | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/NotificationListBase.js#L396-L403 | train | Check if source is an icon | [
30522,
3853,
2003,
28524,
1006,
3120,
1007,
1063,
2065,
1006,
999,
3120,
1007,
1063,
2709,
6270,
1025,
1065,
13075,
2765,
1027,
3332,
1012,
24471,
2072,
1012,
11968,
3366,
1006,
3120,
1007,
1025,
2709,
1006,
2765,
1012,
8778,
1004,
1004,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
wuchangming/spy-debugger | buildin_modules/weinre/web/interfaces/interfaces.js | el_showCheckBoxClicked | function el_showCheckBoxClicked(event) {
var element = event.target
localStorage.setItem(element.storageKey, element.checked)
reapplyDisplayStyle("." + element.storageKey, element.checked)
} | javascript | function el_showCheckBoxClicked(event) {
var element = event.target
localStorage.setItem(element.storageKey, element.checked)
reapplyDisplayStyle("." + element.storageKey, element.checked)
} | [
"function",
"el_showCheckBoxClicked",
"(",
"event",
")",
"{",
"var",
"element",
"=",
"event",
".",
"target",
"localStorage",
".",
"setItem",
"(",
"element",
".",
"storageKey",
",",
"element",
".",
"checked",
")",
"reapplyDisplayStyle",
"(",
"\".\"",
"+",
"elem... | ----------------------------------------------------------------------------- | [
"-----------------------------------------------------------------------------"
] | 55c1dda0dff0c44920673711656ddfd7ff03c307 | https://github.com/wuchangming/spy-debugger/blob/55c1dda0dff0c44920673711656ddfd7ff03c307/buildin_modules/weinre/web/interfaces/interfaces.js#L81-L87 | train | Show the checkbox | [
30522,
3853,
3449,
1035,
2265,
5403,
3600,
8758,
20464,
6799,
2098,
1006,
2724,
1007,
1063,
13075,
5783,
1027,
2724,
1012,
4539,
10575,
4263,
4270,
1012,
2275,
4221,
2213,
1006,
5783,
1012,
5527,
14839,
1010,
5783,
1012,
7039,
1007,
2128,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
ramda/ramda | source/applySpec.js | mapValues | function mapValues(fn, obj) {
return keys(obj).reduce(function(acc, key) {
acc[key] = fn(obj[key]);
return acc;
}, {});
} | javascript | function mapValues(fn, obj) {
return keys(obj).reduce(function(acc, key) {
acc[key] = fn(obj[key]);
return acc;
}, {});
} | [
"function",
"mapValues",
"(",
"fn",
",",
"obj",
")",
"{",
"return",
"keys",
"(",
"obj",
")",
".",
"reduce",
"(",
"function",
"(",
"acc",
",",
"key",
")",
"{",
"acc",
"[",
"key",
"]",
"=",
"fn",
"(",
"obj",
"[",
"key",
"]",
")",
";",
"return",
... | Use custom mapValues function to avoid issues with specs that include a "map" key and R.map delegating calls to .map | [
"Use",
"custom",
"mapValues",
"function",
"to",
"avoid",
"issues",
"with",
"specs",
"that",
"include",
"a",
"map",
"key",
"and",
"R",
".",
"map",
"delegating",
"calls",
"to",
".",
"map"
] | 072d417a345e7087a95466a9825d43b6ca3a4941 | https://github.com/ramda/ramda/blob/072d417a345e7087a95466a9825d43b6ca3a4941/source/applySpec.js#L12-L17 | train | Map values from obj to fn | [
30522,
3853,
4949,
10175,
15808,
1006,
1042,
2078,
1010,
27885,
3501,
1007,
1063,
2709,
6309,
1006,
27885,
3501,
1007,
1012,
5547,
1006,
3853,
1006,
16222,
1010,
3145,
1007,
1063,
16222,
1031,
3145,
1033,
1027,
1042,
2078,
1006,
27885,
3501... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/view/ThemeView.js | updateScrollbars | function updateScrollbars(theme) {
theme = theme || {};
if (prefs.get("themeScrollbars")) {
var scrollbar = (theme.scrollbar || []).join(" ");
$scrollbars.text(scrollbar || "");
} else {
$scrollbars.text("");
}
} | javascript | function updateScrollbars(theme) {
theme = theme || {};
if (prefs.get("themeScrollbars")) {
var scrollbar = (theme.scrollbar || []).join(" ");
$scrollbars.text(scrollbar || "");
} else {
$scrollbars.text("");
}
} | [
"function",
"updateScrollbars",
"(",
"theme",
")",
"{",
"theme",
"=",
"theme",
"||",
"{",
"}",
";",
"if",
"(",
"prefs",
".",
"get",
"(",
"\"themeScrollbars\"",
")",
")",
"{",
"var",
"scrollbar",
"=",
"(",
"theme",
".",
"scrollbar",
"||",
"[",
"]",
")... | Load scrollbar styling based on whether or not theme scrollbars are enabled.
@param {ThemeManager.Theme} theme Is the theme object with the corresponding scrollbar style
to be updated | [
"Load",
"scrollbar",
"styling",
"based",
"on",
"whether",
"or",
"not",
"theme",
"scrollbars",
"are",
"enabled",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/view/ThemeView.js#L40-L48 | train | Update scrollbar text | [
30522,
3853,
14409,
26775,
14511,
8237,
2015,
1006,
4323,
1007,
1063,
4323,
1027,
4323,
1064,
1064,
1063,
1065,
1025,
2065,
1006,
3653,
10343,
1012,
2131,
1006,
1000,
6991,
26775,
14511,
8237,
2015,
1000,
1007,
1007,
1063,
13075,
17186,
823... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.ux3/src/sap/ui/ux3/NotificationBarRenderer.js | function(oRm, oNotifier, oNotiBar) {
fnRenderNotifier(oRm, oNotifier, true);
fnRenderMessageNotifierMessageArea(oRm, oNotifier, oNotiBar);
} | javascript | function(oRm, oNotifier, oNotiBar) {
fnRenderNotifier(oRm, oNotifier, true);
fnRenderMessageNotifierMessageArea(oRm, oNotifier, oNotiBar);
} | [
"function",
"(",
"oRm",
",",
"oNotifier",
",",
"oNotiBar",
")",
"{",
"fnRenderNotifier",
"(",
"oRm",
",",
"oNotifier",
",",
"true",
")",
";",
"fnRenderMessageNotifierMessageArea",
"(",
"oRm",
",",
"oNotifier",
",",
"oNotiBar",
")",
";",
"}"
] | This renders a given message notifier and its message area next to the
notifier icon | [
"This",
"renders",
"a",
"given",
"message",
"notifier",
"and",
"its",
"message",
"area",
"next",
"to",
"the",
"notifier",
"icon"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.ux3/src/sap/ui/ux3/NotificationBarRenderer.js#L458-L461 | train | Renders a message notifier | [
30522,
3853,
1006,
2030,
2213,
1010,
21058,
3775,
8873,
2121,
1010,
21058,
3775,
8237,
1007,
1063,
1042,
16118,
10497,
11795,
4140,
18095,
1006,
2030,
2213,
1010,
21058,
3775,
8873,
2121,
1010,
2995,
1007,
1025,
1042,
16118,
10497,
2121,
78... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/runnable.js | multiple | function multiple(err) {
if (emitted) {
return;
}
emitted = true;
var msg = 'done() called multiple times';
if (err && err.message) {
err.message += " (and Mocha's " + msg + ')';
self.emit('error', err);
} else {
self.emit('error', new Error(msg));
}
} | javascript | function multiple(err) {
if (emitted) {
return;
}
emitted = true;
var msg = 'done() called multiple times';
if (err && err.message) {
err.message += " (and Mocha's " + msg + ')';
self.emit('error', err);
} else {
self.emit('error', new Error(msg));
}
} | [
"function",
"multiple",
"(",
"err",
")",
"{",
"if",
"(",
"emitted",
")",
"{",
"return",
";",
"}",
"emitted",
"=",
"true",
";",
"var",
"msg",
"=",
"'done() called multiple times'",
";",
"if",
"(",
"err",
"&&",
"err",
".",
"message",
")",
"{",
"err",
"... | called multiple times | [
"called",
"multiple",
"times"
] | 9b00fedb610241e33f7592c40164e42a38a793cf | https://github.com/mochajs/mocha/blob/9b00fedb610241e33f7592c40164e42a38a793cf/lib/runnable.js#L303-L315 | train | Called when a single task is called | [
30522,
3853,
3674,
1006,
9413,
2099,
1007,
1063,
2065,
1006,
22627,
1007,
1063,
2709,
1025,
1065,
22627,
1027,
2995,
1025,
13075,
5796,
2290,
1027,
1005,
2589,
1006,
1007,
2170,
3674,
2335,
1005,
1025,
2065,
1006,
9413,
2099,
1004,
1004,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
askmike/gekko | plugins/postgresql/util.js | function (name) {
if (useSingleDatabase()) {
name = watch.exchange.replace(/\-/g,'') + '_' + name;
}
var fullName = [name, settings.pair.join('_')].join('_');
return useLowerCaseTableNames() ? fullName.toLowerCase() : fullName;
} | javascript | function (name) {
if (useSingleDatabase()) {
name = watch.exchange.replace(/\-/g,'') + '_' + name;
}
var fullName = [name, settings.pair.join('_')].join('_');
return useLowerCaseTableNames() ? fullName.toLowerCase() : fullName;
} | [
"function",
"(",
"name",
")",
"{",
"if",
"(",
"useSingleDatabase",
"(",
")",
")",
"{",
"name",
"=",
"watch",
".",
"exchange",
".",
"replace",
"(",
"/",
"\\-",
"/",
"g",
",",
"''",
")",
"+",
"'_'",
"+",
"name",
";",
"}",
"var",
"fullName",
"=",
... | returns table name which can be different if we use single or multiple db setup. | [
"returns",
"table",
"name",
"which",
"can",
"be",
"different",
"if",
"we",
"use",
"single",
"or",
"multiple",
"db",
"setup",
"."
] | 0ce9ddd577fa8a22812c02331a494086758dfadf | https://github.com/askmike/gekko/blob/0ce9ddd577fa8a22812c02331a494086758dfadf/plugins/postgresql/util.js#L46-L52 | train | Returns the full name of the table | [
30522,
3853,
1006,
2171,
1007,
1063,
2065,
1006,
3594,
2075,
3709,
6790,
15058,
1006,
1007,
1007,
1063,
2171,
1027,
3422,
1012,
3863,
1012,
5672,
1006,
1013,
1032,
1011,
1013,
1043,
1010,
1005,
1005,
1007,
1009,
1005,
1035,
1005,
1009,
21... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
GeekyAnts/vue-native-core | packages/vue-server-renderer/build.js | normalizeStyleBinding | function normalizeStyleBinding (bindingStyle) {
if (Array.isArray(bindingStyle)) {
return toObject(bindingStyle)
}
if (typeof bindingStyle === 'string') {
return parseStyleText(bindingStyle)
}
return bindingStyle
} | javascript | function normalizeStyleBinding (bindingStyle) {
if (Array.isArray(bindingStyle)) {
return toObject(bindingStyle)
}
if (typeof bindingStyle === 'string') {
return parseStyleText(bindingStyle)
}
return bindingStyle
} | [
"function",
"normalizeStyleBinding",
"(",
"bindingStyle",
")",
"{",
"if",
"(",
"Array",
".",
"isArray",
"(",
"bindingStyle",
")",
")",
"{",
"return",
"toObject",
"(",
"bindingStyle",
")",
"}",
"if",
"(",
"typeof",
"bindingStyle",
"===",
"'string'",
")",
"{",... | normalize possible array / string values into Object | [
"normalize",
"possible",
"array",
"/",
"string",
"values",
"into",
"Object"
] | a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e | https://github.com/GeekyAnts/vue-native-core/blob/a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e/packages/vue-server-renderer/build.js#L1505-L1513 | train | Normalize binding style | [
30522,
3853,
3671,
10057,
27983,
8428,
4667,
1006,
8031,
21756,
2571,
1007,
1063,
2065,
1006,
9140,
1012,
18061,
11335,
2100,
1006,
8031,
21756,
2571,
1007,
1007,
1063,
2709,
2205,
2497,
20614,
1006,
8031,
21756,
2571,
1007,
1065,
2065,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
uber/deck.gl | modules/core/src/utils/flatten.js | flattenArray | function flattenArray(array, filter, map, result) {
let index = -1;
while (++index < array.length) {
const value = array[index];
if (Array.isArray(value)) {
flattenArray(value, filter, map, result);
} else if (filter(value)) {
result.push(map(value));
}
}
return result;
} | javascript | function flattenArray(array, filter, map, result) {
let index = -1;
while (++index < array.length) {
const value = array[index];
if (Array.isArray(value)) {
flattenArray(value, filter, map, result);
} else if (filter(value)) {
result.push(map(value));
}
}
return result;
} | [
"function",
"flattenArray",
"(",
"array",
",",
"filter",
",",
"map",
",",
"result",
")",
"{",
"let",
"index",
"=",
"-",
"1",
";",
"while",
"(",
"++",
"index",
"<",
"array",
".",
"length",
")",
"{",
"const",
"value",
"=",
"array",
"[",
"index",
"]",... | Deep flattens an array. Helper to `flatten`, see its parameters | [
"Deep",
"flattens",
"an",
"array",
".",
"Helper",
"to",
"flatten",
"see",
"its",
"parameters"
] | a2010448b7f268bbd03617b812334c68a6b9e5b2 | https://github.com/uber/deck.gl/blob/a2010448b7f268bbd03617b812334c68a6b9e5b2/modules/core/src/utils/flatten.js#L43-L54 | train | flatten array | [
30522,
3853,
4257,
6528,
2906,
9447,
1006,
9140,
1010,
11307,
1010,
4949,
1010,
2765,
1007,
1063,
2292,
5950,
1027,
1011,
1015,
1025,
2096,
1006,
1009,
1009,
5950,
1026,
9140,
1012,
3091,
1007,
1063,
9530,
3367,
3643,
1027,
9140,
1031,
59... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Component.js | collectLoadManifestPromises | function collectLoadManifestPromises(oMetadata, oManifest) {
// ComponentMetadata classes with a static manifest or with legacy metadata
// do already have a manifest, so no action required
if (!oMetadata._oManifest) {
// TODO: If the "manifest" property is set, the code to load the manifest.json could be moved up to run in
// parallel with the ResourceModels that are created (after the Component-preload has finished) to trigger
// a potential request a bit earlier. Right now the whole component loading would be delayed by the async request.
var sName = oMetadata.getComponentName();
var sDefaultManifestUrl = getManifestUrl(sName);
var pLoadManifest;
if (oManifest) {
// Apply a copy of the already loaded manifest to be used by the static metadata class
pLoadManifest = Promise.resolve(JSON.parse(JSON.stringify(oManifest.getRawJson())));
} else {
// We need to load the manifest.json for the metadata class as
// it might differ from the one already loaded
// If the manifest.json is part of the Component-preload it will be taken from there
pLoadManifest = LoaderExtensions.loadResource({
url: sDefaultManifestUrl,
dataType: "json",
async: true
}).catch(function(oError) {
Log.error(
"Failed to load component manifest from \"" + sDefaultManifestUrl + "\" (component " + sName
+ ")! Reason: " + oError
);
// If the request fails, ignoring the error would end up in a sync call, which would fail, too.
return {};
});
}
aManifestsToLoad.push(pLoadManifest);
aMetadataObjects.push(oMetadata);
}
var oParentMetadata = oMetadata.getParent();
if (oParentMetadata && (oParentMetadata instanceof ComponentMetadata) && !oParentMetadata.isBaseClass()) {
collectLoadManifestPromises(oParentMetadata);
}
} | javascript | function collectLoadManifestPromises(oMetadata, oManifest) {
// ComponentMetadata classes with a static manifest or with legacy metadata
// do already have a manifest, so no action required
if (!oMetadata._oManifest) {
// TODO: If the "manifest" property is set, the code to load the manifest.json could be moved up to run in
// parallel with the ResourceModels that are created (after the Component-preload has finished) to trigger
// a potential request a bit earlier. Right now the whole component loading would be delayed by the async request.
var sName = oMetadata.getComponentName();
var sDefaultManifestUrl = getManifestUrl(sName);
var pLoadManifest;
if (oManifest) {
// Apply a copy of the already loaded manifest to be used by the static metadata class
pLoadManifest = Promise.resolve(JSON.parse(JSON.stringify(oManifest.getRawJson())));
} else {
// We need to load the manifest.json for the metadata class as
// it might differ from the one already loaded
// If the manifest.json is part of the Component-preload it will be taken from there
pLoadManifest = LoaderExtensions.loadResource({
url: sDefaultManifestUrl,
dataType: "json",
async: true
}).catch(function(oError) {
Log.error(
"Failed to load component manifest from \"" + sDefaultManifestUrl + "\" (component " + sName
+ ")! Reason: " + oError
);
// If the request fails, ignoring the error would end up in a sync call, which would fail, too.
return {};
});
}
aManifestsToLoad.push(pLoadManifest);
aMetadataObjects.push(oMetadata);
}
var oParentMetadata = oMetadata.getParent();
if (oParentMetadata && (oParentMetadata instanceof ComponentMetadata) && !oParentMetadata.isBaseClass()) {
collectLoadManifestPromises(oParentMetadata);
}
} | [
"function",
"collectLoadManifestPromises",
"(",
"oMetadata",
",",
"oManifest",
")",
"{",
"// ComponentMetadata classes with a static manifest or with legacy metadata",
"// do already have a manifest, so no action required",
"if",
"(",
"!",
"oMetadata",
".",
"_oManifest",
")",
"{",
... | Collects the promises to load the manifest content and all of its parents manifest files.
Gathers promises within aManifestsToLoad.
Gathers associates meta data objects within aMetadataObjects.
@param {object} oMetadata The metadata object
@param {sap.ui.core.Manifest} [oManifest] root manifest, which is possibly already loaded | [
"Collects",
"the",
"promises",
"to",
"load",
"the",
"manifest",
"content",
"and",
"all",
"of",
"its",
"parents",
"manifest",
"files",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Component.js#L1821-L1862 | train | Loads the manifest. json from the component s manifest. json file. | [
30522,
3853,
8145,
11066,
20799,
14081,
21572,
28732,
2015,
1006,
18168,
12928,
2850,
2696,
1010,
16640,
29323,
3367,
1007,
1063,
1013,
1013,
6922,
11368,
8447,
2696,
4280,
2007,
1037,
10763,
19676,
2030,
2007,
8027,
27425,
1013,
1013,
2079,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
mattdesl/canvas-sketch | examples/experimental/webgl-2d.js | getNormalizedPrimitive2D | function getNormalizedPrimitive2D ({ positions, cells, normals, uvs }, opt = {}) {
// Default to assuming the positions are a unit circle/box/etc
normals = normals ? expandVectorList(normals) : positions.map(p => vec3.normalize([], expandVector(p)));
// Planar UV across bounding box of mesh
uvs = uvs || get2DUV(positions);
// Assume 2D primitives are centered in -1..1 space, recenter to 0..1
positions = opt.center ? recenter(positions) : positions;
// Expand to 3D
positions = expandVectorList(positions);
return {
positions,
uvs,
normals,
cells
};
} | javascript | function getNormalizedPrimitive2D ({ positions, cells, normals, uvs }, opt = {}) {
// Default to assuming the positions are a unit circle/box/etc
normals = normals ? expandVectorList(normals) : positions.map(p => vec3.normalize([], expandVector(p)));
// Planar UV across bounding box of mesh
uvs = uvs || get2DUV(positions);
// Assume 2D primitives are centered in -1..1 space, recenter to 0..1
positions = opt.center ? recenter(positions) : positions;
// Expand to 3D
positions = expandVectorList(positions);
return {
positions,
uvs,
normals,
cells
};
} | [
"function",
"getNormalizedPrimitive2D",
"(",
"{",
"positions",
",",
"cells",
",",
"normals",
",",
"uvs",
"}",
",",
"opt",
"=",
"{",
"}",
")",
"{",
"// Default to assuming the positions are a unit circle/box/etc",
"normals",
"=",
"normals",
"?",
"expandVectorList",
"... | A unit 2D rectangle, circle, etc | [
"A",
"unit",
"2D",
"rectangle",
"circle",
"etc"
] | 4addd0fe3fc053065ca8597ab204e43587c52879 | https://github.com/mattdesl/canvas-sketch/blob/4addd0fe3fc053065ca8597ab204e43587c52879/examples/experimental/webgl-2d.js#L177-L192 | train | Returns a 2D array of normals and uvs | [
30522,
3853,
2131,
12131,
9067,
3550,
18098,
27605,
6024,
2475,
2094,
1006,
1063,
4460,
1010,
4442,
1010,
3671,
2015,
1010,
23068,
2015,
1065,
1010,
23569,
1027,
1063,
1065,
1007,
1063,
1013,
1013,
12398,
2000,
10262,
1996,
4460,
2024,
1037... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/RenameIdentifier.js | requestFindReferences | function requestFindReferences(session, offset) {
var response = requestFindRefs(session, session.editor.document, offset);
if (response && response.hasOwnProperty("promise")) {
response.promise.done(handleFindRefs).fail(function () {
result.reject();
});
}
} | javascript | function requestFindReferences(session, offset) {
var response = requestFindRefs(session, session.editor.document, offset);
if (response && response.hasOwnProperty("promise")) {
response.promise.done(handleFindRefs).fail(function () {
result.reject();
});
}
} | [
"function",
"requestFindReferences",
"(",
"session",
",",
"offset",
")",
"{",
"var",
"response",
"=",
"requestFindRefs",
"(",
"session",
",",
"session",
".",
"editor",
".",
"document",
",",
"offset",
")",
";",
"if",
"(",
"response",
"&&",
"response",
".",
... | Make a find ref request.
@param {Session} session - the session
@param {number} offset - the offset of where to jump from | [
"Make",
"a",
"find",
"ref",
"request",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/JavaScriptRefactoring/RenameIdentifier.js#L169-L177 | train | Request find references | [
30522,
3853,
5227,
16294,
16200,
25523,
2015,
1006,
5219,
1010,
16396,
1007,
1063,
13075,
3433,
1027,
5227,
16294,
16200,
10343,
1006,
5219,
1010,
5219,
1012,
3559,
1012,
6254,
1010,
16396,
1007,
1025,
2065,
1006,
3433,
1004,
1004,
3433,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SeleniumHQ/selenium | javascript/selenium-core/lib/prototype.js | function(event, tagName) {
var element = Event.element(event);
while (element.parentNode && (!element.tagName ||
(element.tagName.toUpperCase() != tagName.toUpperCase())))
element = element.parentNode;
return element;
} | javascript | function(event, tagName) {
var element = Event.element(event);
while (element.parentNode && (!element.tagName ||
(element.tagName.toUpperCase() != tagName.toUpperCase())))
element = element.parentNode;
return element;
} | [
"function",
"(",
"event",
",",
"tagName",
")",
"{",
"var",
"element",
"=",
"Event",
".",
"element",
"(",
"event",
")",
";",
"while",
"(",
"element",
".",
"parentNode",
"&&",
"(",
"!",
"element",
".",
"tagName",
"||",
"(",
"element",
".",
"tagName",
"... | find the first node with the given tagName, starting from the node the event was triggered on; traverses the DOM upwards | [
"find",
"the",
"first",
"node",
"with",
"the",
"given",
"tagName",
"starting",
"from",
"the",
"node",
"the",
"event",
"was",
"triggered",
"on",
";",
"traverses",
"the",
"DOM",
"upwards"
] | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/selenium-core/lib/prototype.js#L1714-L1720 | train | Returns the parent element of the given event | [
30522,
3853,
1006,
2724,
1010,
6415,
18442,
1007,
1063,
13075,
5783,
1027,
2724,
1012,
5783,
1006,
2724,
1007,
1025,
2096,
1006,
5783,
1012,
6687,
3630,
3207,
1004,
1004,
1006,
999,
5783,
1012,
6415,
18442,
1064,
1064,
1006,
5783,
1012,
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... | |
Dogfalo/materialize | extras/noUiSlider/nouislider.js | updateOptions | function updateOptions ( optionsToUpdate, fireSetEvent ) {
// Spectrum is created using the range, snap, direction and step options.
// 'snap' and 'step' can be updated, 'direction' cannot, due to event binding.
// If 'snap' and 'step' are not passed, they should remain unchanged.
var v = valueGet();
var updateAble = ['margin', 'limit', 'padding', 'range', 'animate', 'snap', 'step', 'format'];
// Only change options that we're actually passed to update.
updateAble.forEach(function(name){
if ( optionsToUpdate[name] !== undefined ) {
originalOptions[name] = optionsToUpdate[name];
}
});
var newOptions = testOptions(originalOptions);
// Load new options into the slider state
updateAble.forEach(function(name){
if ( optionsToUpdate[name] !== undefined ) {
options[name] = newOptions[name];
}
});
// Save current spectrum direction as testOptions in testRange call
// doesn't rely on current direction
newOptions.spectrum.direction = scope_Spectrum.direction;
scope_Spectrum = newOptions.spectrum;
// Limit, margin and padding depend on the spectrum but are stored outside of it. (#677)
options.margin = newOptions.margin;
options.limit = newOptions.limit;
options.padding = newOptions.padding;
// Invalidate the current positioning so valueSet forces an update.
scope_Locations = [];
valueSet(optionsToUpdate.start || v, fireSetEvent);
} | javascript | function updateOptions ( optionsToUpdate, fireSetEvent ) {
// Spectrum is created using the range, snap, direction and step options.
// 'snap' and 'step' can be updated, 'direction' cannot, due to event binding.
// If 'snap' and 'step' are not passed, they should remain unchanged.
var v = valueGet();
var updateAble = ['margin', 'limit', 'padding', 'range', 'animate', 'snap', 'step', 'format'];
// Only change options that we're actually passed to update.
updateAble.forEach(function(name){
if ( optionsToUpdate[name] !== undefined ) {
originalOptions[name] = optionsToUpdate[name];
}
});
var newOptions = testOptions(originalOptions);
// Load new options into the slider state
updateAble.forEach(function(name){
if ( optionsToUpdate[name] !== undefined ) {
options[name] = newOptions[name];
}
});
// Save current spectrum direction as testOptions in testRange call
// doesn't rely on current direction
newOptions.spectrum.direction = scope_Spectrum.direction;
scope_Spectrum = newOptions.spectrum;
// Limit, margin and padding depend on the spectrum but are stored outside of it. (#677)
options.margin = newOptions.margin;
options.limit = newOptions.limit;
options.padding = newOptions.padding;
// Invalidate the current positioning so valueSet forces an update.
scope_Locations = [];
valueSet(optionsToUpdate.start || v, fireSetEvent);
} | [
"function",
"updateOptions",
"(",
"optionsToUpdate",
",",
"fireSetEvent",
")",
"{",
"// Spectrum is created using the range, snap, direction and step options.",
"// 'snap' and 'step' can be updated, 'direction' cannot, due to event binding.",
"// If 'snap' and 'step' are not passed, they should ... | Updateable: margin, limit, padding, step, range, animate, snap | [
"Updateable",
":",
"margin",
"limit",
"padding",
"step",
"range",
"animate",
"snap"
] | 1122efadad8f1433d404696f7613e3cc13fb83a4 | https://github.com/Dogfalo/materialize/blob/1122efadad8f1433d404696f7613e3cc13fb83a4/extras/noUiSlider/nouislider.js#L2037-L2075 | train | Updates the options of the slider. | [
30522,
3853,
10651,
7361,
9285,
1006,
7047,
24826,
17299,
3686,
1010,
8769,
12870,
15338,
1007,
1063,
1013,
1013,
8674,
2003,
2580,
2478,
1996,
2846,
1010,
10245,
1010,
3257,
1998,
3357,
7047,
1012,
1013,
1013,
1005,
10245,
1005,
1998,
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... |
babel/babel | packages/babel-traverse/src/path/conversion.js | hoistFunctionEnvironment | function hoistFunctionEnvironment(
fnPath,
specCompliant = false,
allowInsertArrow = true,
) {
const thisEnvFn = fnPath.findParent(p => {
return (
(p.isFunction() && !p.isArrowFunctionExpression()) ||
p.isProgram() ||
p.isClassProperty({ static: false })
);
});
const inConstructor = thisEnvFn && thisEnvFn.node.kind === "constructor";
if (thisEnvFn.isClassProperty()) {
throw fnPath.buildCodeFrameError(
"Unable to transform arrow inside class property",
);
}
const {
thisPaths,
argumentsPaths,
newTargetPaths,
superProps,
superCalls,
} = getScopeInformation(fnPath);
// Convert all super() calls in the constructor, if super is used in an arrow.
if (inConstructor && superCalls.length > 0) {
if (!allowInsertArrow) {
throw superCalls[0].buildCodeFrameError(
"Unable to handle nested super() usage in arrow",
);
}
const allSuperCalls = [];
thisEnvFn.traverse({
Function(child) {
if (child.isArrowFunctionExpression()) return;
child.skip();
},
ClassProperty(child) {
child.skip();
},
CallExpression(child) {
if (!child.get("callee").isSuper()) return;
allSuperCalls.push(child);
},
});
const superBinding = getSuperBinding(thisEnvFn);
allSuperCalls.forEach(superCall => {
const callee = t.identifier(superBinding);
callee.loc = superCall.node.callee.loc;
superCall.get("callee").replaceWith(callee);
});
}
// Convert all "this" references in the arrow to point at the alias.
let thisBinding;
if (thisPaths.length > 0 || specCompliant) {
thisBinding = getThisBinding(thisEnvFn, inConstructor);
if (
!specCompliant ||
// In subclass constructors, still need to rewrite because "this" can't be bound in spec mode
// because it might not have been initialized yet.
(inConstructor && hasSuperClass(thisEnvFn))
) {
thisPaths.forEach(thisChild => {
const thisRef = thisChild.isJSX()
? t.jsxIdentifier(thisBinding)
: t.identifier(thisBinding);
thisRef.loc = thisChild.node.loc;
thisChild.replaceWith(thisRef);
});
if (specCompliant) thisBinding = null;
}
}
// Convert all "arguments" references in the arrow to point at the alias.
if (argumentsPaths.length > 0) {
const argumentsBinding = getBinding(thisEnvFn, "arguments", () =>
t.identifier("arguments"),
);
argumentsPaths.forEach(argumentsChild => {
const argsRef = t.identifier(argumentsBinding);
argsRef.loc = argumentsChild.node.loc;
argumentsChild.replaceWith(argsRef);
});
}
// Convert all "new.target" references in the arrow to point at the alias.
if (newTargetPaths.length > 0) {
const newTargetBinding = getBinding(thisEnvFn, "newtarget", () =>
t.metaProperty(t.identifier("new"), t.identifier("target")),
);
newTargetPaths.forEach(targetChild => {
const targetRef = t.identifier(newTargetBinding);
targetRef.loc = targetChild.node.loc;
targetChild.replaceWith(targetRef);
});
}
// Convert all "super.prop" references to point at aliases.
if (superProps.length > 0) {
if (!allowInsertArrow) {
throw superProps[0].buildCodeFrameError(
"Unable to handle nested super.prop usage",
);
}
const flatSuperProps = superProps.reduce(
(acc, superProp) => acc.concat(standardizeSuperProperty(superProp)),
[],
);
flatSuperProps.forEach(superProp => {
const key = superProp.node.computed
? ""
: superProp.get("property").node.name;
if (superProp.parentPath.isCallExpression({ callee: superProp.node })) {
const superBinding = getSuperPropCallBinding(thisEnvFn, key);
if (superProp.node.computed) {
const prop = superProp.get("property").node;
superProp.replaceWith(t.identifier(superBinding));
superProp.parentPath.node.arguments.unshift(prop);
} else {
superProp.replaceWith(t.identifier(superBinding));
}
} else {
const isAssignment = superProp.parentPath.isAssignmentExpression({
left: superProp.node,
});
const superBinding = getSuperPropBinding(thisEnvFn, isAssignment, key);
const args = [];
if (superProp.node.computed) {
args.push(superProp.get("property").node);
}
if (isAssignment) {
const value = superProp.parentPath.node.right;
args.push(value);
superProp.parentPath.replaceWith(
t.callExpression(t.identifier(superBinding), args),
);
} else {
superProp.replaceWith(
t.callExpression(t.identifier(superBinding), args),
);
}
}
});
}
return thisBinding;
} | javascript | function hoistFunctionEnvironment(
fnPath,
specCompliant = false,
allowInsertArrow = true,
) {
const thisEnvFn = fnPath.findParent(p => {
return (
(p.isFunction() && !p.isArrowFunctionExpression()) ||
p.isProgram() ||
p.isClassProperty({ static: false })
);
});
const inConstructor = thisEnvFn && thisEnvFn.node.kind === "constructor";
if (thisEnvFn.isClassProperty()) {
throw fnPath.buildCodeFrameError(
"Unable to transform arrow inside class property",
);
}
const {
thisPaths,
argumentsPaths,
newTargetPaths,
superProps,
superCalls,
} = getScopeInformation(fnPath);
// Convert all super() calls in the constructor, if super is used in an arrow.
if (inConstructor && superCalls.length > 0) {
if (!allowInsertArrow) {
throw superCalls[0].buildCodeFrameError(
"Unable to handle nested super() usage in arrow",
);
}
const allSuperCalls = [];
thisEnvFn.traverse({
Function(child) {
if (child.isArrowFunctionExpression()) return;
child.skip();
},
ClassProperty(child) {
child.skip();
},
CallExpression(child) {
if (!child.get("callee").isSuper()) return;
allSuperCalls.push(child);
},
});
const superBinding = getSuperBinding(thisEnvFn);
allSuperCalls.forEach(superCall => {
const callee = t.identifier(superBinding);
callee.loc = superCall.node.callee.loc;
superCall.get("callee").replaceWith(callee);
});
}
// Convert all "this" references in the arrow to point at the alias.
let thisBinding;
if (thisPaths.length > 0 || specCompliant) {
thisBinding = getThisBinding(thisEnvFn, inConstructor);
if (
!specCompliant ||
// In subclass constructors, still need to rewrite because "this" can't be bound in spec mode
// because it might not have been initialized yet.
(inConstructor && hasSuperClass(thisEnvFn))
) {
thisPaths.forEach(thisChild => {
const thisRef = thisChild.isJSX()
? t.jsxIdentifier(thisBinding)
: t.identifier(thisBinding);
thisRef.loc = thisChild.node.loc;
thisChild.replaceWith(thisRef);
});
if (specCompliant) thisBinding = null;
}
}
// Convert all "arguments" references in the arrow to point at the alias.
if (argumentsPaths.length > 0) {
const argumentsBinding = getBinding(thisEnvFn, "arguments", () =>
t.identifier("arguments"),
);
argumentsPaths.forEach(argumentsChild => {
const argsRef = t.identifier(argumentsBinding);
argsRef.loc = argumentsChild.node.loc;
argumentsChild.replaceWith(argsRef);
});
}
// Convert all "new.target" references in the arrow to point at the alias.
if (newTargetPaths.length > 0) {
const newTargetBinding = getBinding(thisEnvFn, "newtarget", () =>
t.metaProperty(t.identifier("new"), t.identifier("target")),
);
newTargetPaths.forEach(targetChild => {
const targetRef = t.identifier(newTargetBinding);
targetRef.loc = targetChild.node.loc;
targetChild.replaceWith(targetRef);
});
}
// Convert all "super.prop" references to point at aliases.
if (superProps.length > 0) {
if (!allowInsertArrow) {
throw superProps[0].buildCodeFrameError(
"Unable to handle nested super.prop usage",
);
}
const flatSuperProps = superProps.reduce(
(acc, superProp) => acc.concat(standardizeSuperProperty(superProp)),
[],
);
flatSuperProps.forEach(superProp => {
const key = superProp.node.computed
? ""
: superProp.get("property").node.name;
if (superProp.parentPath.isCallExpression({ callee: superProp.node })) {
const superBinding = getSuperPropCallBinding(thisEnvFn, key);
if (superProp.node.computed) {
const prop = superProp.get("property").node;
superProp.replaceWith(t.identifier(superBinding));
superProp.parentPath.node.arguments.unshift(prop);
} else {
superProp.replaceWith(t.identifier(superBinding));
}
} else {
const isAssignment = superProp.parentPath.isAssignmentExpression({
left: superProp.node,
});
const superBinding = getSuperPropBinding(thisEnvFn, isAssignment, key);
const args = [];
if (superProp.node.computed) {
args.push(superProp.get("property").node);
}
if (isAssignment) {
const value = superProp.parentPath.node.right;
args.push(value);
superProp.parentPath.replaceWith(
t.callExpression(t.identifier(superBinding), args),
);
} else {
superProp.replaceWith(
t.callExpression(t.identifier(superBinding), args),
);
}
}
});
}
return thisBinding;
} | [
"function",
"hoistFunctionEnvironment",
"(",
"fnPath",
",",
"specCompliant",
"=",
"false",
",",
"allowInsertArrow",
"=",
"true",
",",
")",
"{",
"const",
"thisEnvFn",
"=",
"fnPath",
".",
"findParent",
"(",
"p",
"=>",
"{",
"return",
"(",
"(",
"p",
".",
"isFu... | Given a function, traverse its contents, and if there are references to "this", "arguments", "super",
or "new.target", ensure that these references reference the parent environment around this function. | [
"Given",
"a",
"function",
"traverse",
"its",
"contents",
"and",
"if",
"there",
"are",
"references",
"to",
"this",
"arguments",
"super",
"or",
"new",
".",
"target",
"ensure",
"that",
"these",
"references",
"reference",
"the",
"parent",
"environment",
"around",
... | 1969e6b6aa7d90be3fbb3aca98ea96849656a55a | https://github.com/babel/babel/blob/1969e6b6aa7d90be3fbb3aca98ea96849656a55a/packages/babel-traverse/src/path/conversion.js#L161-L326 | train | Hoist function environment | [
30522,
3853,
7570,
2923,
11263,
27989,
2368,
21663,
2239,
3672,
1006,
1042,
16275,
8988,
1010,
28699,
9006,
24759,
2937,
2102,
1027,
6270,
1010,
3499,
7076,
8743,
2906,
10524,
1027,
2995,
1010,
1007,
1063,
9530,
3367,
2023,
2368,
2615,
2546... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | concatenateArcs | function concatenateArcs(indices, arcs) {
/** @type {Array<import("../coordinate.js").Coordinate>} */
const coordinates = [];
let index, arc;
for (let i = 0, ii = indices.length; i < ii; ++i) {
index = indices[i];
if (i > 0) {
// splicing together arcs, discard last point
coordinates.pop();
}
if (index >= 0) {
// forward arc
arc = arcs[index];
} else {
// reverse arc
arc = arcs[~index].slice().reverse();
}
coordinates.push.apply(coordinates, arc);
}
// provide fresh copies of coordinate arrays
for (let j = 0, jj = coordinates.length; j < jj; ++j) {
coordinates[j] = coordinates[j].slice();
}
return coordinates;
} | javascript | function concatenateArcs(indices, arcs) {
/** @type {Array<import("../coordinate.js").Coordinate>} */
const coordinates = [];
let index, arc;
for (let i = 0, ii = indices.length; i < ii; ++i) {
index = indices[i];
if (i > 0) {
// splicing together arcs, discard last point
coordinates.pop();
}
if (index >= 0) {
// forward arc
arc = arcs[index];
} else {
// reverse arc
arc = arcs[~index].slice().reverse();
}
coordinates.push.apply(coordinates, arc);
}
// provide fresh copies of coordinate arrays
for (let j = 0, jj = coordinates.length; j < jj; ++j) {
coordinates[j] = coordinates[j].slice();
}
return coordinates;
} | [
"function",
"concatenateArcs",
"(",
"indices",
",",
"arcs",
")",
"{",
"/** @type {Array<import(\"../coordinate.js\").Coordinate>} */",
"const",
"coordinates",
"=",
"[",
"]",
";",
"let",
"index",
",",
"arc",
";",
"for",
"(",
"let",
"i",
"=",
"0",
",",
"ii",
"="... | Concatenate arcs into a coordinate array.
@param {Array<number>} indices Indices of arcs to concatenate. Negative
values indicate arcs need to be reversed.
@param {Array<Array<import("../coordinate.js").Coordinate>>} arcs Array of arcs (already
transformed).
@return {Array<import("../coordinate.js").Coordinate>} Coordinates array. | [
"Concatenate",
"arcs",
"into",
"a",
"coordinate",
"array",
"."
] | f366eaea522388fb575b11010e69d309164baca7 | https://github.com/openlayers/openlayers/blob/f366eaea522388fb575b11010e69d309164baca7/src/ol/format/TopoJSON.js#L162-L186 | train | Concatenates the arcs at the given indices. | [
30522,
3853,
9530,
16280,
12556,
2906,
6169,
1006,
29299,
1010,
29137,
1007,
1063,
1013,
1008,
1008,
1030,
2828,
1063,
9140,
1026,
12324,
1006,
1000,
1012,
1012,
1013,
13530,
1012,
1046,
2015,
1000,
1007,
1012,
13530,
1028,
1065,
1008,
1013... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/core/util/reflection/BaseTreeModifier.js | function (vControl, oAppComponent) {
var sControlId = (vControl instanceof ManagedObject) ? vControl.getId() : vControl;
if (!oAppComponent) {
Log.error("Determination of a local ID suffix failed due to missing app component for " + sControlId);
return false;
}
return !!oAppComponent.getLocalId(sControlId);
} | javascript | function (vControl, oAppComponent) {
var sControlId = (vControl instanceof ManagedObject) ? vControl.getId() : vControl;
if (!oAppComponent) {
Log.error("Determination of a local ID suffix failed due to missing app component for " + sControlId);
return false;
}
return !!oAppComponent.getLocalId(sControlId);
} | [
"function",
"(",
"vControl",
",",
"oAppComponent",
")",
"{",
"var",
"sControlId",
"=",
"(",
"vControl",
"instanceof",
"ManagedObject",
")",
"?",
"vControl",
".",
"getId",
"(",
")",
":",
"vControl",
";",
"if",
"(",
"!",
"oAppComponent",
")",
"{",
"Log",
"... | Checks if a control ID has a prefix matching the application component.
If this prefix exists, the suffix after the component ID is called the local ID.
@param {sap.ui.core.Control|string} vControl - Control or ID to be checked if it is within the generic application
@param {sap.ui.core.UIComponent} oAppComponent - Application component, needed only if vControl is string (ID)
@returns {boolean} Whether control has a local ID
@protected | [
"Checks",
"if",
"a",
"control",
"ID",
"has",
"a",
"prefix",
"matching",
"the",
"application",
"component",
".",
"If",
"this",
"prefix",
"exists",
"the",
"suffix",
"after",
"the",
"component",
"ID",
"is",
"called",
"the",
"local",
"ID",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/util/reflection/BaseTreeModifier.js#L184-L193 | train | Returns true if the control has a local ID suffix | [
30522,
3853,
1006,
18315,
12162,
13153,
1010,
1051,
29098,
9006,
29513,
3372,
1007,
1063,
13075,
8040,
12162,
13153,
3593,
1027,
1006,
18315,
12162,
13153,
6013,
11253,
3266,
16429,
20614,
1007,
1029,
18315,
12162,
13153,
1012,
2131,
3593,
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.integration/src/sap/ui/integration/library.js | function (DataType) {
"use strict";
// delegate further initialization of this library to the Core
sap.ui.getCore().initLibrary({
name: "sap.ui.integration",
version: "${version}",
dependencies: ["sap.ui.core", "sap.f"],
types: [
"sap.ui.integration.CardActionType",
"sap.ui.integration.CardDataMode"
],
controls: [
"sap.ui.integration.widgets.Card",
"sap.ui.integration.host.HostConfiguration"
],
elements: [],
noLibraryCSS: true,
//define the custom tags that can be used in this library
customTags: {
"card": "sap/ui/integration/widgets/Card",
"host-configuration": "sap/ui/integration/host/HostConfiguration"
},
defaultTagPrefix: "ui"
});
/**
* SAPUI5 library with controls specialized for SAP Fiori apps.
*
* @namespace
* @alias sap.ui.integration
* @author SAP SE
* @version ${version}
* @public
*/
var thisLib = sap.ui.integration;
/**
* Enumeration of possible card action types.
*
* @enum {string}
* @experimental since 1.64
* Disclaimer: this property is in a beta state - incompatible API changes may be done before its official public release. Use at your own discretion.
*/
thisLib.CardActionType = {
/**
* Used for navigation actions
* @public
*/
Navigation : "Navigation"
};
/**
* Possible data modes for <code>{@link sap.ui.integration.widgets.Card}</code>.
*
* @enum {string}
* @experimental since 1.65
* @public
* @since 1.65
*/
thisLib.CardDataMode = {
/**
* When in this mode, the card can make requests.
* @public
*/
Active: "Active",
/**
* When in this mode, the card cannot make requests.
* @public
*/
Inactive: "Inactive"
};
return thisLib;
} | javascript | function (DataType) {
"use strict";
// delegate further initialization of this library to the Core
sap.ui.getCore().initLibrary({
name: "sap.ui.integration",
version: "${version}",
dependencies: ["sap.ui.core", "sap.f"],
types: [
"sap.ui.integration.CardActionType",
"sap.ui.integration.CardDataMode"
],
controls: [
"sap.ui.integration.widgets.Card",
"sap.ui.integration.host.HostConfiguration"
],
elements: [],
noLibraryCSS: true,
//define the custom tags that can be used in this library
customTags: {
"card": "sap/ui/integration/widgets/Card",
"host-configuration": "sap/ui/integration/host/HostConfiguration"
},
defaultTagPrefix: "ui"
});
/**
* SAPUI5 library with controls specialized for SAP Fiori apps.
*
* @namespace
* @alias sap.ui.integration
* @author SAP SE
* @version ${version}
* @public
*/
var thisLib = sap.ui.integration;
/**
* Enumeration of possible card action types.
*
* @enum {string}
* @experimental since 1.64
* Disclaimer: this property is in a beta state - incompatible API changes may be done before its official public release. Use at your own discretion.
*/
thisLib.CardActionType = {
/**
* Used for navigation actions
* @public
*/
Navigation : "Navigation"
};
/**
* Possible data modes for <code>{@link sap.ui.integration.widgets.Card}</code>.
*
* @enum {string}
* @experimental since 1.65
* @public
* @since 1.65
*/
thisLib.CardDataMode = {
/**
* When in this mode, the card can make requests.
* @public
*/
Active: "Active",
/**
* When in this mode, the card cannot make requests.
* @public
*/
Inactive: "Inactive"
};
return thisLib;
} | [
"function",
"(",
"DataType",
")",
"{",
"\"use strict\"",
";",
"// delegate further initialization of this library to the Core",
"sap",
".",
"ui",
".",
"getCore",
"(",
")",
".",
"initLibrary",
"(",
"{",
"name",
":",
"\"sap.ui.integration\"",
",",
"version",
":",
"\"$... | library dependency | [
"library",
"dependency"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.integration/src/sap/ui/integration/library.js#L13-L93 | train | The sap. ui. integration. Core Core | [
30522,
3853,
1006,
2951,
13874,
1007,
1063,
1000,
2224,
9384,
1000,
1025,
1013,
1013,
11849,
2582,
3988,
3989,
1997,
2023,
3075,
2000,
1996,
4563,
20066,
1012,
21318,
1012,
2131,
17345,
1006,
1007,
1012,
1999,
4183,
29521,
19848,
2100,
1006... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
goldfire/howler.js | dist/howler.js | function() {
var self = this || Howler;
// Only run this if Web Audio is supported and it hasn't already been unlocked.
if (self._audioUnlocked || !self.ctx) {
return;
}
self._audioUnlocked = false;
self.autoUnlock = false;
// Some mobile devices/platforms have distortion issues when opening/closing tabs and/or web views.
// Bugs in the browser (especially Mobile Safari) can cause the sampleRate to change from 44100 to 48000.
// By calling Howler.unload(), we create a new AudioContext with the correct sampleRate.
if (!self._mobileUnloaded && self.ctx.sampleRate !== 44100) {
self._mobileUnloaded = true;
self.unload();
}
// Scratch buffer for enabling iOS to dispose of web audio buffers correctly, as per:
// http://stackoverflow.com/questions/24119684
self._scratchBuffer = self.ctx.createBuffer(1, 1, 22050);
// Call this method on touch start to create and play a buffer,
// then check if the audio actually played to determine if
// audio has now been unlocked on iOS, Android, etc.
var unlock = function(e) {
// Create a pool of unlocked HTML5 Audio objects that can
// be used for playing sounds without user interaction. HTML5
// Audio objects must be individually unlocked, as opposed
// to the WebAudio API which only needs a single activation.
// This must occur before WebAudio setup or the source.onended
// event will not fire.
for (var i=0; i<self.html5PoolSize; i++) {
try {
var audioNode = new Audio();
// Mark this Audio object as unlocked to ensure it can get returned
// to the unlocked pool when released.
audioNode._unlocked = true;
// Add the audio node to the pool.
self._releaseHtml5Audio(audioNode);
} catch (e) {
self.noAudio = true;
}
}
// Loop through any assigned audio nodes and unlock them.
for (var i=0; i<self._howls.length; i++) {
if (!self._howls[i]._webAudio) {
// Get all of the sounds in this Howl group.
var ids = self._howls[i]._getSoundIds();
// Loop through all sounds and unlock the audio nodes.
for (var j=0; j<ids.length; j++) {
var sound = self._howls[i]._soundById(ids[j]);
if (sound && sound._node && !sound._node._unlocked) {
sound._node._unlocked = true;
sound._node.load();
}
}
}
}
// Fix Android can not play in suspend state.
self._autoResume();
// Create an empty buffer.
var source = self.ctx.createBufferSource();
source.buffer = self._scratchBuffer;
source.connect(self.ctx.destination);
// Play the empty buffer.
if (typeof source.start === 'undefined') {
source.noteOn(0);
} else {
source.start(0);
}
// Calling resume() on a stack initiated by user gesture is what actually unlocks the audio on Android Chrome >= 55.
if (typeof self.ctx.resume === 'function') {
self.ctx.resume();
}
// Setup a timeout to check that we are unlocked on the next event loop.
source.onended = function() {
source.disconnect(0);
// Update the unlocked state and prevent this check from happening again.
self._audioUnlocked = true;
// Remove the touch start listener.
document.removeEventListener('touchstart', unlock, true);
document.removeEventListener('touchend', unlock, true);
document.removeEventListener('click', unlock, true);
// Let all sounds know that audio has been unlocked.
for (var i=0; i<self._howls.length; i++) {
self._howls[i]._emit('unlock');
}
};
};
// Setup a touch start listener to attempt an unlock in.
document.addEventListener('touchstart', unlock, true);
document.addEventListener('touchend', unlock, true);
document.addEventListener('click', unlock, true);
return self;
} | javascript | function() {
var self = this || Howler;
// Only run this if Web Audio is supported and it hasn't already been unlocked.
if (self._audioUnlocked || !self.ctx) {
return;
}
self._audioUnlocked = false;
self.autoUnlock = false;
// Some mobile devices/platforms have distortion issues when opening/closing tabs and/or web views.
// Bugs in the browser (especially Mobile Safari) can cause the sampleRate to change from 44100 to 48000.
// By calling Howler.unload(), we create a new AudioContext with the correct sampleRate.
if (!self._mobileUnloaded && self.ctx.sampleRate !== 44100) {
self._mobileUnloaded = true;
self.unload();
}
// Scratch buffer for enabling iOS to dispose of web audio buffers correctly, as per:
// http://stackoverflow.com/questions/24119684
self._scratchBuffer = self.ctx.createBuffer(1, 1, 22050);
// Call this method on touch start to create and play a buffer,
// then check if the audio actually played to determine if
// audio has now been unlocked on iOS, Android, etc.
var unlock = function(e) {
// Create a pool of unlocked HTML5 Audio objects that can
// be used for playing sounds without user interaction. HTML5
// Audio objects must be individually unlocked, as opposed
// to the WebAudio API which only needs a single activation.
// This must occur before WebAudio setup or the source.onended
// event will not fire.
for (var i=0; i<self.html5PoolSize; i++) {
try {
var audioNode = new Audio();
// Mark this Audio object as unlocked to ensure it can get returned
// to the unlocked pool when released.
audioNode._unlocked = true;
// Add the audio node to the pool.
self._releaseHtml5Audio(audioNode);
} catch (e) {
self.noAudio = true;
}
}
// Loop through any assigned audio nodes and unlock them.
for (var i=0; i<self._howls.length; i++) {
if (!self._howls[i]._webAudio) {
// Get all of the sounds in this Howl group.
var ids = self._howls[i]._getSoundIds();
// Loop through all sounds and unlock the audio nodes.
for (var j=0; j<ids.length; j++) {
var sound = self._howls[i]._soundById(ids[j]);
if (sound && sound._node && !sound._node._unlocked) {
sound._node._unlocked = true;
sound._node.load();
}
}
}
}
// Fix Android can not play in suspend state.
self._autoResume();
// Create an empty buffer.
var source = self.ctx.createBufferSource();
source.buffer = self._scratchBuffer;
source.connect(self.ctx.destination);
// Play the empty buffer.
if (typeof source.start === 'undefined') {
source.noteOn(0);
} else {
source.start(0);
}
// Calling resume() on a stack initiated by user gesture is what actually unlocks the audio on Android Chrome >= 55.
if (typeof self.ctx.resume === 'function') {
self.ctx.resume();
}
// Setup a timeout to check that we are unlocked on the next event loop.
source.onended = function() {
source.disconnect(0);
// Update the unlocked state and prevent this check from happening again.
self._audioUnlocked = true;
// Remove the touch start listener.
document.removeEventListener('touchstart', unlock, true);
document.removeEventListener('touchend', unlock, true);
document.removeEventListener('click', unlock, true);
// Let all sounds know that audio has been unlocked.
for (var i=0; i<self._howls.length; i++) {
self._howls[i]._emit('unlock');
}
};
};
// Setup a touch start listener to attempt an unlock in.
document.addEventListener('touchstart', unlock, true);
document.addEventListener('touchend', unlock, true);
document.addEventListener('click', unlock, true);
return self;
} | [
"function",
"(",
")",
"{",
"var",
"self",
"=",
"this",
"||",
"Howler",
";",
"// Only run this if Web Audio is supported and it hasn't already been unlocked.",
"if",
"(",
"self",
".",
"_audioUnlocked",
"||",
"!",
"self",
".",
"ctx",
")",
"{",
"return",
";",
"}",
... | Some browsers/devices will only allow audio to be played after a user interaction.
Attempt to automatically unlock audio on the first user interaction.
Concept from: http://paulbakaus.com/tutorials/html5/web-audio-on-ios/
@return {Howler} | [
"Some",
"browsers",
"/",
"devices",
"will",
"only",
"allow",
"audio",
"to",
"be",
"played",
"after",
"a",
"user",
"interaction",
".",
"Attempt",
"to",
"automatically",
"unlock",
"audio",
"on",
"the",
"first",
"user",
"interaction",
".",
"Concept",
"from",
":... | 030db918dd8ce640afd57e172418472497e8f113 | https://github.com/goldfire/howler.js/blob/030db918dd8ce640afd57e172418472497e8f113/dist/howler.js#L282-L393 | train | The main method of the AudioSource class. | [
30522,
3853,
1006,
1007,
1063,
13075,
2969,
1027,
2023,
1064,
1064,
22912,
2121,
1025,
1013,
1013,
2069,
2448,
2023,
2065,
4773,
5746,
2003,
3569,
1998,
2009,
8440,
1005,
1056,
2525,
2042,
14058,
1012,
2065,
1006,
2969,
1012,
1035,
5746,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
zloirock/core-js | packages/core-js/modules/web.url-search-params.js | URLSearchParams | function URLSearchParams(/* init */) {
anInstance(this, URLSearchParamsConstructor, URL_SEARCH_PARAMS);
var init = arguments.length > 0 ? arguments[0] : undefined;
var that = this;
var entries = [];
var iteratorMethod, iterator, step, entryIterator, first, second, key;
setInternalState(that, {
type: URL_SEARCH_PARAMS,
entries: entries,
updateURL: null,
updateSearchParams: updateSearchParams
});
if (init !== undefined) {
if (isObject(init)) {
iteratorMethod = getIteratorMethod(init);
if (typeof iteratorMethod === 'function') {
iterator = iteratorMethod.call(init);
while (!(step = iterator.next()).done) {
entryIterator = getIterator(anObject(step.value));
if (
(first = entryIterator.next()).done ||
(second = entryIterator.next()).done ||
!entryIterator.next().done
) throw TypeError('Expected sequence with length 2');
entries.push({ key: first.value + '', value: second.value + '' });
}
} else for (key in init) if (hasOwn(init, key)) entries.push({ key: key, value: init[key] + '' });
} else {
parseSearchParams(entries, typeof init === 'string' ? init.charAt(0) === '?' ? init.slice(1) : init : init + '');
}
}
} | javascript | function URLSearchParams(/* init */) {
anInstance(this, URLSearchParamsConstructor, URL_SEARCH_PARAMS);
var init = arguments.length > 0 ? arguments[0] : undefined;
var that = this;
var entries = [];
var iteratorMethod, iterator, step, entryIterator, first, second, key;
setInternalState(that, {
type: URL_SEARCH_PARAMS,
entries: entries,
updateURL: null,
updateSearchParams: updateSearchParams
});
if (init !== undefined) {
if (isObject(init)) {
iteratorMethod = getIteratorMethod(init);
if (typeof iteratorMethod === 'function') {
iterator = iteratorMethod.call(init);
while (!(step = iterator.next()).done) {
entryIterator = getIterator(anObject(step.value));
if (
(first = entryIterator.next()).done ||
(second = entryIterator.next()).done ||
!entryIterator.next().done
) throw TypeError('Expected sequence with length 2');
entries.push({ key: first.value + '', value: second.value + '' });
}
} else for (key in init) if (hasOwn(init, key)) entries.push({ key: key, value: init[key] + '' });
} else {
parseSearchParams(entries, typeof init === 'string' ? init.charAt(0) === '?' ? init.slice(1) : init : init + '');
}
}
} | [
"function",
"URLSearchParams",
"(",
"/* init */",
")",
"{",
"anInstance",
"(",
"this",
",",
"URLSearchParamsConstructor",
",",
"URL_SEARCH_PARAMS",
")",
";",
"var",
"init",
"=",
"arguments",
".",
"length",
">",
"0",
"?",
"arguments",
"[",
"0",
"]",
":",
"und... | `URLSearchParams` constructor https://url.spec.whatwg.org/#interface-urlsearchparams | [
"URLSearchParams",
"constructor",
"https",
":",
"//",
"url",
".",
"spec",
".",
"whatwg",
".",
"org",
"/",
"#interface",
"-",
"urlsearchparams"
] | fe7c8511a6d27d03a9b8e075b3351416aae95c58 | https://github.com/zloirock/core-js/blob/fe7c8511a6d27d03a9b8e075b3351416aae95c58/packages/core-js/modules/web.url-search-params.js#L110-L143 | train | The URLSearchParams constructor. | [
30522,
3853,
24471,
4877,
14644,
2818,
28689,
5244,
1006,
1013,
1008,
1999,
4183,
1008,
1013,
1007,
1063,
2019,
7076,
26897,
1006,
2023,
1010,
24471,
4877,
14644,
2818,
28689,
5244,
8663,
3367,
6820,
16761,
1010,
24471,
2140,
1035,
3945,
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... |
ColorlibHQ/AdminLTE | bower_components/raphael/dev/raphael.core.js | R | function R(first) {
if (R.is(first, "function")) {
return loaded ? first() : eve.on("raphael.DOMload", first);
} else if (R.is(first, array)) {
return R._engine.create[apply](R, first.splice(0, 3 + R.is(first[0], nu))).add(first);
} else {
var args = Array.prototype.slice.call(arguments, 0);
if (R.is(args[args.length - 1], "function")) {
var f = args.pop();
return loaded ? f.call(R._engine.create[apply](R, args)) : eve.on("raphael.DOMload", function () {
f.call(R._engine.create[apply](R, args));
});
} else {
return R._engine.create[apply](R, arguments);
}
}
} | javascript | function R(first) {
if (R.is(first, "function")) {
return loaded ? first() : eve.on("raphael.DOMload", first);
} else if (R.is(first, array)) {
return R._engine.create[apply](R, first.splice(0, 3 + R.is(first[0], nu))).add(first);
} else {
var args = Array.prototype.slice.call(arguments, 0);
if (R.is(args[args.length - 1], "function")) {
var f = args.pop();
return loaded ? f.call(R._engine.create[apply](R, args)) : eve.on("raphael.DOMload", function () {
f.call(R._engine.create[apply](R, args));
});
} else {
return R._engine.create[apply](R, arguments);
}
}
} | [
"function",
"R",
"(",
"first",
")",
"{",
"if",
"(",
"R",
".",
"is",
"(",
"first",
",",
"\"function\"",
")",
")",
"{",
"return",
"loaded",
"?",
"first",
"(",
")",
":",
"eve",
".",
"on",
"(",
"\"raphael.DOMload\"",
",",
"first",
")",
";",
"}",
"els... | /*\
Raphael
[ method ]
*
Creates a canvas object on which to draw.
You must do this first, as all future calls to drawing methods
from this instance will be bound to this canvas.
> Parameters
*
- container (HTMLElement|string) DOM element or its ID which is going to be a parent for drawing surface
- width (number)
- height (number)
- callback (function) #optional callback function which is going to be executed in the context of newly created paper
or
- x (number)
- y (number)
- width (number)
- height (number)
- callback (function) #optional callback function which is going to be executed in the context of newly created paper
or
- all (array) (first 3 or 4 elements in the array are equal to [containerID, width, height] or [x, y, width, height]. The rest are element descriptions in format {type: type, <attributes>}). See @Paper.add.
- callback (function) #optional callback function which is going to be executed in the context of newly created paper
or
- onReadyCallback (function) function that is going to be called on DOM ready event. You can also subscribe to this event via Eve’s “DOMLoad” event. In this case method returns `undefined`.
= (object) @Paper
> Usage
| // Each of the following examples create a canvas
| // that is 320px wide by 200px high.
| // Canvas is created at the viewport’s 10,50 coordinate.
| var paper = Raphael(10, 50, 320, 200);
| // Canvas is created at the top left corner of the #notepad element
| // (or its top right corner in dir="rtl" elements)
| var paper = Raphael(document.getElementById("notepad"), 320, 200);
| // Same as above
| var paper = Raphael("notepad", 320, 200);
| // Image dump
| var set = Raphael(["notepad", 320, 200, {
| type: "rect",
| x: 10,
| y: 10,
| width: 25,
| height: 25,
| stroke: "#f00"
| }, {
| type: "text",
| x: 30,
| y: 40,
| text: "Dump"
| }]);
\ | [
"/",
"*",
"\\",
"Raphael",
"[",
"method",
"]",
"*",
"Creates",
"a",
"canvas",
"object",
"on",
"which",
"to",
"draw",
".",
"You",
"must",
"do",
"this",
"first",
"as",
"all",
"future",
"calls",
"to",
"drawing",
"methods",
"from",
"this",
"instance",
"wil... | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/bower_components/raphael/dev/raphael.core.js#L53-L69 | train | R. create | [
30522,
3853,
1054,
1006,
2034,
1007,
1063,
2065,
1006,
1054,
1012,
2003,
30524,
1025,
1065,
2842,
2065,
1006,
1054,
1012,
2003,
1006,
2034,
1010,
9140,
1007,
1007,
1063,
2709,
1054,
1012,
1035,
3194,
1012,
3443,
1031,
6611,
1033,
1006,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/core/Component.js | function() {
// create a copy of arguments for local modification
// and later handover to Component constructor
var args = Array.prototype.slice.call(arguments);
// inject the manifest to the settings object
var mSettings;
if (args.length === 0 || typeof args[0] === "object") {
mSettings = args[0] = args[0] || {};
} else if (typeof args[0] === "string") {
mSettings = args[1] = args[1] || {};
}
mSettings._metadataProxy = oMetadataProxy;
// mixin created "models" into "mSettings"
if (mModels) {
mSettings._manifestModels = mModels;
}
// call the original constructor of the component class
var oInstance = Object.create(oClass.prototype);
oClass.apply(oInstance, args);
return oInstance;
} | javascript | function() {
// create a copy of arguments for local modification
// and later handover to Component constructor
var args = Array.prototype.slice.call(arguments);
// inject the manifest to the settings object
var mSettings;
if (args.length === 0 || typeof args[0] === "object") {
mSettings = args[0] = args[0] || {};
} else if (typeof args[0] === "string") {
mSettings = args[1] = args[1] || {};
}
mSettings._metadataProxy = oMetadataProxy;
// mixin created "models" into "mSettings"
if (mModels) {
mSettings._manifestModels = mModels;
}
// call the original constructor of the component class
var oInstance = Object.create(oClass.prototype);
oClass.apply(oInstance, args);
return oInstance;
} | [
"function",
"(",
")",
"{",
"// create a copy of arguments for local modification",
"// and later handover to Component constructor",
"var",
"args",
"=",
"Array",
".",
"prototype",
".",
"slice",
".",
"call",
"(",
"arguments",
")",
";",
"// inject the manifest to the settings o... | create the proxy class for passing the manifest | [
"create",
"the",
"proxy",
"class",
"for",
"passing",
"the",
"manifest"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Component.js#L2496-L2521 | train | This function is called by the constructor of the component class. It is called by the constructor to create a new instance of the component class. | [
30522,
3853,
1006,
1007,
1063,
1013,
1013,
3443,
1037,
6100,
1997,
9918,
2005,
2334,
14080,
1013,
1013,
1998,
2101,
2192,
7840,
2000,
6922,
9570,
2953,
13075,
12098,
5620,
1027,
9140,
1012,
8773,
1012,
14704,
1012,
2655,
1006,
9918,
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... | |
aws/aws-sdk-js | lib/publisher/string-to-buffer.js | stringToBuffer | function stringToBuffer(data) {
return (typeof Buffer.from === 'function' && Buffer.from !== Uint8Array.from) ?
Buffer.from(data) : new Buffer(data);
} | javascript | function stringToBuffer(data) {
return (typeof Buffer.from === 'function' && Buffer.from !== Uint8Array.from) ?
Buffer.from(data) : new Buffer(data);
} | [
"function",
"stringToBuffer",
"(",
"data",
")",
"{",
"return",
"(",
"typeof",
"Buffer",
".",
"from",
"===",
"'function'",
"&&",
"Buffer",
".",
"from",
"!==",
"Uint8Array",
".",
"from",
")",
"?",
"Buffer",
".",
"from",
"(",
"data",
")",
":",
"new",
"Buf... | Converts a UTF8 string into a Buffer.
@param {string} data Some string to convert to a Buffer
@returns {Buffer} | [
"Converts",
"a",
"UTF8",
"string",
"into",
"a",
"Buffer",
"."
] | c23e5f0edd150f8885267e5f7c8a564f8e6e8562 | https://github.com/aws/aws-sdk-js/blob/c23e5f0edd150f8885267e5f7c8a564f8e6e8562/lib/publisher/string-to-buffer.js#L6-L9 | train | Converts a string to a Buffer | [
30522,
3853,
5164,
3406,
8569,
12494,
1006,
2951,
1007,
1063,
2709,
1006,
2828,
11253,
17698,
1012,
2013,
1027,
1027,
1027,
1005,
3853,
1005,
1004,
1004,
17698,
1012,
2013,
999,
1027,
1027,
21318,
3372,
2620,
2906,
9447,
1012,
2013,
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... |
radare/radare2 | shlr/www/graph/js-graph-it.js | getStyle | function getStyle(node, styleProp) {
// if not an element
if( node.nodeType != 1)
return;
var value;
if (node.currentStyle) {
// ie case
styleProp = replaceDashWithCamelNotation(styleProp);
value = node.currentStyle[styleProp];
} else if (window.getComputedStyle) {
// mozilla case
value = document.defaultView.getComputedStyle(node, null).getPropertyValue(styleProp);
}
return value;
} | javascript | function getStyle(node, styleProp) {
// if not an element
if( node.nodeType != 1)
return;
var value;
if (node.currentStyle) {
// ie case
styleProp = replaceDashWithCamelNotation(styleProp);
value = node.currentStyle[styleProp];
} else if (window.getComputedStyle) {
// mozilla case
value = document.defaultView.getComputedStyle(node, null).getPropertyValue(styleProp);
}
return value;
} | [
"function",
"getStyle",
"(",
"node",
",",
"styleProp",
")",
"{",
"// if not an element",
"if",
"(",
"node",
".",
"nodeType",
"!=",
"1",
")",
"return",
";",
"var",
"value",
";",
"if",
"(",
"node",
".",
"currentStyle",
")",
"{",
"// ie case",
"styleProp",
... | This function retrieves the actual value of a style property even if it is set via css. | [
"This",
"function",
"retrieves",
"the",
"actual",
"value",
"of",
"a",
"style",
"property",
"even",
"if",
"it",
"is",
"set",
"via",
"css",
"."
] | bf5e3028810a0ec7c267c6fe4bfad639b4819e35 | https://github.com/radare/radare2/blob/bf5e3028810a0ec7c267c6fe4bfad639b4819e35/shlr/www/graph/js-graph-it.js#L1262-L1278 | train | Get the value of a style property of a node | [
30522,
3853,
4152,
27983,
1006,
13045,
1010,
2806,
21572,
2361,
1007,
1063,
1013,
1013,
2065,
2025,
2019,
5783,
2065,
1006,
13045,
1012,
13045,
13874,
999,
1027,
1015,
1007,
2709,
1025,
13075,
3643,
1025,
2065,
1006,
13045,
1012,
14731,
279... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
LLK/scratch-blocks | blocks_vertical/sensing.js | function() {
this.jsonInit({
"message0": Blockly.Msg.SENSING_OF,
"args0": [
{
"type": "field_dropdown",
"name": "PROPERTY",
"options": [
[Blockly.Msg.SENSING_OF_XPOSITION, 'x position'],
[Blockly.Msg.SENSING_OF_YPOSITION, 'y position'],
[Blockly.Msg.SENSING_OF_DIRECTION, 'direction'],
[Blockly.Msg.SENSING_OF_COSTUMENUMBER, 'costume #'],
[Blockly.Msg.SENSING_OF_COSTUMENAME, 'costume name'],
[Blockly.Msg.SENSING_OF_SIZE, 'size'],
[Blockly.Msg.SENSING_OF_VOLUME, 'volume'],
[Blockly.Msg.SENSING_OF_BACKDROPNUMBER, 'backdrop #'],
[Blockly.Msg.SENSING_OF_BACKDROPNAME, 'backdrop name']
]
},
{
"type": "input_value",
"name": "OBJECT"
}
],
"output": true,
"category": Blockly.Categories.sensing,
"outputShape": Blockly.OUTPUT_SHAPE_ROUND,
"extensions": ["colours_sensing"]
});
} | javascript | function() {
this.jsonInit({
"message0": Blockly.Msg.SENSING_OF,
"args0": [
{
"type": "field_dropdown",
"name": "PROPERTY",
"options": [
[Blockly.Msg.SENSING_OF_XPOSITION, 'x position'],
[Blockly.Msg.SENSING_OF_YPOSITION, 'y position'],
[Blockly.Msg.SENSING_OF_DIRECTION, 'direction'],
[Blockly.Msg.SENSING_OF_COSTUMENUMBER, 'costume #'],
[Blockly.Msg.SENSING_OF_COSTUMENAME, 'costume name'],
[Blockly.Msg.SENSING_OF_SIZE, 'size'],
[Blockly.Msg.SENSING_OF_VOLUME, 'volume'],
[Blockly.Msg.SENSING_OF_BACKDROPNUMBER, 'backdrop #'],
[Blockly.Msg.SENSING_OF_BACKDROPNAME, 'backdrop name']
]
},
{
"type": "input_value",
"name": "OBJECT"
}
],
"output": true,
"category": Blockly.Categories.sensing,
"outputShape": Blockly.OUTPUT_SHAPE_ROUND,
"extensions": ["colours_sensing"]
});
} | [
"function",
"(",
")",
"{",
"this",
".",
"jsonInit",
"(",
"{",
"\"message0\"",
":",
"Blockly",
".",
"Msg",
".",
"SENSING_OF",
",",
"\"args0\"",
":",
"[",
"{",
"\"type\"",
":",
"\"field_dropdown\"",
",",
"\"name\"",
":",
"\"PROPERTY\"",
",",
"\"options\"",
"... | Block to report properties of sprites.
@this Blockly.Block | [
"Block",
"to",
"report",
"properties",
"of",
"sprites",
"."
] | 455b2a854435c0a67da1da92320ddc3ec3e2b799 | https://github.com/LLK/scratch-blocks/blob/455b2a854435c0a67da1da92320ddc3ec3e2b799/blocks_vertical/sensing.js#L434-L463 | train | Block for the ambient object. | [
30522,
3853,
1006,
1007,
1063,
2023,
1012,
1046,
3385,
5498,
2102,
1006,
1063,
1000,
4471,
2692,
1000,
1024,
3796,
2135,
1012,
5796,
2290,
1012,
13851,
1035,
1997,
1010,
1000,
12098,
5620,
2692,
1000,
1024,
1031,
1063,
1000,
2828,
1000,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
showdownjs/showdown | dist/showdown.js | _constructor | function _constructor () {
converterOptions = converterOptions || {};
for (var gOpt in globalOptions) {
if (globalOptions.hasOwnProperty(gOpt)) {
options[gOpt] = globalOptions[gOpt];
}
}
// Merge options
if (typeof converterOptions === 'object') {
for (var opt in converterOptions) {
if (converterOptions.hasOwnProperty(opt)) {
options[opt] = converterOptions[opt];
}
}
} else {
throw Error('Converter expects the passed parameter to be an object, but ' + typeof converterOptions +
' was passed instead.');
}
if (options.extensions) {
showdown.helper.forEach(options.extensions, _parseExtension);
}
} | javascript | function _constructor () {
converterOptions = converterOptions || {};
for (var gOpt in globalOptions) {
if (globalOptions.hasOwnProperty(gOpt)) {
options[gOpt] = globalOptions[gOpt];
}
}
// Merge options
if (typeof converterOptions === 'object') {
for (var opt in converterOptions) {
if (converterOptions.hasOwnProperty(opt)) {
options[opt] = converterOptions[opt];
}
}
} else {
throw Error('Converter expects the passed parameter to be an object, but ' + typeof converterOptions +
' was passed instead.');
}
if (options.extensions) {
showdown.helper.forEach(options.extensions, _parseExtension);
}
} | [
"function",
"_constructor",
"(",
")",
"{",
"converterOptions",
"=",
"converterOptions",
"||",
"{",
"}",
";",
"for",
"(",
"var",
"gOpt",
"in",
"globalOptions",
")",
"{",
"if",
"(",
"globalOptions",
".",
"hasOwnProperty",
"(",
"gOpt",
")",
")",
"{",
"options... | Converter constructor
@private | [
"Converter",
"constructor"
] | 33bba54535d6fcdde5c82d2ec4d7a3bd951b5bb9 | https://github.com/showdownjs/showdown/blob/33bba54535d6fcdde5c82d2ec4d7a3bd951b5bb9/dist/showdown.js#L4901-L4925 | train | Constructor for the class | [
30522,
3853,
1035,
9570,
2953,
1006,
1007,
1063,
10463,
10624,
16790,
2015,
1027,
10463,
10624,
16790,
2015,
1064,
1064,
1063,
1065,
1025,
2005,
1006,
13075,
2175,
13876,
1999,
3795,
7361,
9285,
1007,
1063,
2065,
1006,
3795,
7361,
9285,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
nhn/tui.editor | src/js/extensions/colorSyntax.js | wrapTextAndGetRange | function wrapTextAndGetRange(pre, text, post) {
return {
result: `${pre}${text}${post}`,
from: pre.length,
to: pre.length + text.length
};
} | javascript | function wrapTextAndGetRange(pre, text, post) {
return {
result: `${pre}${text}${post}`,
from: pre.length,
to: pre.length + text.length
};
} | [
"function",
"wrapTextAndGetRange",
"(",
"pre",
",",
"text",
",",
"post",
")",
"{",
"return",
"{",
"result",
":",
"`",
"${",
"pre",
"}",
"${",
"text",
"}",
"${",
"post",
"}",
"`",
",",
"from",
":",
"pre",
".",
"length",
",",
"to",
":",
"pre",
".",... | wrap text with pre & post and return with text range
@param {string} pre - text pre
@param {string} text - text
@param {string} post - text post
@returns {object} - wrapped text and range(from, to)
@ignore | [
"wrap",
"text",
"with",
"pre",
"&",
"post",
"and",
"return",
"with",
"text",
"range"
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/extensions/colorSyntax.js#L276-L282 | train | Wrap text with a range of words | [
30522,
3853,
10236,
18209,
5685,
18150,
24388,
2063,
1006,
3653,
1010,
3793,
1010,
2695,
1007,
1063,
2709,
1063,
2765,
1024,
1036,
1002,
1063,
3653,
1065,
1002,
1063,
3793,
1065,
1002,
1063,
2695,
1065,
1036,
1010,
2013,
1024,
3653,
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... |
muaz-khan/RecordRTC | WebGL-Recording/vendor/glge-compiled.js | getChildElementById | function getChildElementById( dNode, id ) {
var dResult = null;
if ( dNode.getAttribute('id') == id )
return dNode;
for ( var i = 0; i < dNode.childNodes.length; i++ ) {
if ( dNode.childNodes[i].nodeType == 1 ) {
dResult = getChildElementById( dNode.childNodes[i], id ); //note: 1-level deep would suffice here, doesn't need to recurse into further childs. but this works.
if ( dResult != null )
break;
}
}
return dResult;
} | javascript | function getChildElementById( dNode, id ) {
var dResult = null;
if ( dNode.getAttribute('id') == id )
return dNode;
for ( var i = 0; i < dNode.childNodes.length; i++ ) {
if ( dNode.childNodes[i].nodeType == 1 ) {
dResult = getChildElementById( dNode.childNodes[i], id ); //note: 1-level deep would suffice here, doesn't need to recurse into further childs. but this works.
if ( dResult != null )
break;
}
}
return dResult;
} | [
"function",
"getChildElementById",
"(",
"dNode",
",",
"id",
")",
"{",
"var",
"dResult",
"=",
"null",
";",
"if",
"(",
"dNode",
".",
"getAttribute",
"(",
"'id'",
")",
"==",
"id",
")",
"return",
"dNode",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i"... | Function will get element by id starting from specified node.
Author: Renato Bebić <renato.bebic@gmail.com>
The material getter below borked if there is e.g. a scene node with the same name as the material.
This is used to fix that by only looking for materials in the library_materials element. | [
"Function",
"will",
"get",
"element",
"by",
"id",
"starting",
"from",
"specified",
"node",
".",
"Author",
":",
"Renato",
"Bebić",
"<renato",
".",
"bebic@gmail",
".",
"com",
">"
] | 3c6bad427b9da35c1cf617199ed13dda056c38ba | https://github.com/muaz-khan/RecordRTC/blob/3c6bad427b9da35c1cf617199ed13dda056c38ba/WebGL-Recording/vendor/glge-compiled.js#L17785-L17801 | train | Returns the child element of the specified node by its id | [
30522,
3853,
2131,
19339,
12260,
3672,
3762,
3593,
1006,
1040,
3630,
3207,
1010,
8909,
1007,
1063,
13075,
2852,
2229,
11314,
1027,
19701,
1025,
2065,
1006,
1040,
3630,
3207,
1012,
2131,
19321,
3089,
8569,
2618,
1006,
1005,
8909,
1005,
1007,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
uber/deck.gl | examples/website/plot/plot-layer/utils.js | setTextStyle | function setTextStyle(ctx, fontSize) {
ctx.font = `${fontSize}px Helvetica,Arial,sans-serif`;
ctx.fillStyle = '#000';
ctx.textBaseline = 'top';
ctx.textAlign = 'center';
} | javascript | function setTextStyle(ctx, fontSize) {
ctx.font = `${fontSize}px Helvetica,Arial,sans-serif`;
ctx.fillStyle = '#000';
ctx.textBaseline = 'top';
ctx.textAlign = 'center';
} | [
"function",
"setTextStyle",
"(",
"ctx",
",",
"fontSize",
")",
"{",
"ctx",
".",
"font",
"=",
"`",
"${",
"fontSize",
"}",
"`",
";",
"ctx",
".",
"fillStyle",
"=",
"'#000'",
";",
"ctx",
".",
"textBaseline",
"=",
"'top'",
";",
"ctx",
".",
"textAlign",
"="... | helper for textMatrixToTexture | [
"helper",
"for",
"textMatrixToTexture"
] | a2010448b7f268bbd03617b812334c68a6b9e5b2 | https://github.com/uber/deck.gl/blob/a2010448b7f268bbd03617b812334c68a6b9e5b2/examples/website/plot/plot-layer/utils.js#L6-L11 | train | Set text style | [
30522,
30524,
15489,
5332,
4371,
1065,
1052,
2595,
2002,
2140,
19510,
5555,
1010,
9342,
2140,
1010,
20344,
1011,
14262,
10128,
1036,
1025,
14931,
2595,
1012,
17469,
27983,
1027,
1005,
1001,
2199,
1005,
1025,
14931,
2595,
1012,
3793,
15058,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/extensions/default/AutoUpdate/node/AutoUpdateDomain.js | parseInstallerLog | function parseInstallerLog(filepath, searchstring, encoding, callback) {
var line = "";
var searchFn = function searchFn(str) {
var arr = str.split('\n'),
lineNum,
pos;
for (lineNum = arr.length - 1; lineNum >= 0; lineNum--) {
var searchStrNum;
for (searchStrNum = 0; searchStrNum < searchstring.length; searchStrNum++) {
pos = arr[lineNum].search(searchstring[searchStrNum]);
if (pos !== -1) {
line = arr[lineNum];
break;
}
}
if (pos !== -1) {
break;
}
}
callback(line);
};
fs.readFile(filepath, {"encoding": encoding})
.then(function (str) {
return searchFn(str);
}).catch(function () {
callback("");
});
} | javascript | function parseInstallerLog(filepath, searchstring, encoding, callback) {
var line = "";
var searchFn = function searchFn(str) {
var arr = str.split('\n'),
lineNum,
pos;
for (lineNum = arr.length - 1; lineNum >= 0; lineNum--) {
var searchStrNum;
for (searchStrNum = 0; searchStrNum < searchstring.length; searchStrNum++) {
pos = arr[lineNum].search(searchstring[searchStrNum]);
if (pos !== -1) {
line = arr[lineNum];
break;
}
}
if (pos !== -1) {
break;
}
}
callback(line);
};
fs.readFile(filepath, {"encoding": encoding})
.then(function (str) {
return searchFn(str);
}).catch(function () {
callback("");
});
} | [
"function",
"parseInstallerLog",
"(",
"filepath",
",",
"searchstring",
",",
"encoding",
",",
"callback",
")",
"{",
"var",
"line",
"=",
"\"\"",
";",
"var",
"searchFn",
"=",
"function",
"searchFn",
"(",
"str",
")",
"{",
"var",
"arr",
"=",
"str",
".",
"spli... | Parse the Installer log and search for a error strings
one it finds the line which has any of error String
it return that line and exit | [
"Parse",
"the",
"Installer",
"log",
"and",
"search",
"for",
"a",
"error",
"strings",
"one",
"it",
"finds",
"the",
"line",
"which",
"has",
"any",
"of",
"error",
"String",
"it",
"return",
"that",
"line",
"and",
"exit"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/AutoUpdate/node/AutoUpdateDomain.js#L187-L215 | train | Parses installer log | [
30522,
3853,
11968,
20240,
23808,
24164,
12190,
8649,
1006,
5371,
15069,
1010,
3945,
3367,
4892,
1010,
17181,
1010,
2655,
5963,
1007,
1063,
13075,
2240,
1027,
1000,
1000,
1025,
13075,
3945,
2546,
2078,
1027,
3853,
3945,
2546,
2078,
1006,
23... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | _moveNext | function _moveNext() {
var $context, $next;
$context = $currentContext || $("#mrof-container #mrof-list > li.highlight");
if ($context.length > 0) {
$next = $context.next();
if ($next.length === 0) {
$next = $("#mrof-container #mrof-list > li").first();
}
if ($next.length > 0) {
$currentContext = $next;
$next.find("a.mroitem").trigger("focus");
}
} else {
//WTF! (Worse than failure). We should not get here.
$("#mrof-container #mrof-list > li > a.mroitem:visited").last().trigger("focus");
}
} | javascript | function _moveNext() {
var $context, $next;
$context = $currentContext || $("#mrof-container #mrof-list > li.highlight");
if ($context.length > 0) {
$next = $context.next();
if ($next.length === 0) {
$next = $("#mrof-container #mrof-list > li").first();
}
if ($next.length > 0) {
$currentContext = $next;
$next.find("a.mroitem").trigger("focus");
}
} else {
//WTF! (Worse than failure). We should not get here.
$("#mrof-container #mrof-list > li > a.mroitem:visited").last().trigger("focus");
}
} | [
"function",
"_moveNext",
"(",
")",
"{",
"var",
"$context",
",",
"$next",
";",
"$context",
"=",
"$currentContext",
"||",
"$",
"(",
"\"#mrof-container #mrof-list > li.highlight\"",
")",
";",
"if",
"(",
"$context",
".",
"length",
">",
"0",
")",
"{",
"$next",
"=... | Opens the next item in MROF list if pop over is visible else displays the pop over
@private | [
"Opens",
"the",
"next",
"item",
"in",
"MROF",
"list",
"if",
"pop",
"over",
"is",
"visible",
"else",
"displays",
"the",
"pop",
"over"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/NavigationAndHistory/main.js#L479-L496 | train | Move the next item in the list | [
30522,
3853,
1035,
2693,
2638,
18413,
1006,
1007,
1063,
13075,
1002,
6123,
1010,
1002,
2279,
1025,
1002,
6123,
1027,
1002,
2783,
8663,
18209,
1064,
1064,
1002,
1006,
1000,
1001,
2720,
11253,
1011,
11661,
1001,
2720,
11253,
1011,
2862,
1028,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Helper.js | function (sBaseMetaPath, sChildMetaPath, mChildQueryOptions,
fnFetchMetadata) {
var sExpandSelectPath = "",
i,
aMetaPathSegments = sChildMetaPath.split("/"),
oProperty,
sPropertyMetaPath = sBaseMetaPath,
mQueryOptions = {},
mQueryOptionsForPathPrefix = mQueryOptions;
if (sChildMetaPath === "") {
return mChildQueryOptions;
}
for (i = 0; i < aMetaPathSegments.length; i += 1) {
sPropertyMetaPath = _Helper.buildPath(sPropertyMetaPath, aMetaPathSegments[i]);
sExpandSelectPath = _Helper.buildPath(sExpandSelectPath, aMetaPathSegments[i]);
oProperty = fnFetchMetadata(sPropertyMetaPath).getResult();
if (oProperty.$kind === "NavigationProperty") {
mQueryOptionsForPathPrefix.$expand = {};
mQueryOptionsForPathPrefix
= mQueryOptionsForPathPrefix.$expand[sExpandSelectPath]
= (i === aMetaPathSegments.length - 1) // last segment in path
? mChildQueryOptions
: {};
_Helper.selectKeyProperties(mQueryOptionsForPathPrefix,
fnFetchMetadata(sPropertyMetaPath + "/").getResult());
sExpandSelectPath = "";
} else if (oProperty.$kind !== "Property") {
return undefined;
}
}
if (oProperty.$kind === "Property") {
if (Object.keys(mChildQueryOptions).length > 0) {
Log.error("Failed to enhance query options for auto-$expand/$select as the"
+ " child binding has query options, but its path '" + sChildMetaPath
+ "' points to a structural property",
JSON.stringify(mChildQueryOptions), sClassName);
return undefined;
}
_Helper.addToSelect(mQueryOptionsForPathPrefix, [sExpandSelectPath]);
}
if ("$apply" in mChildQueryOptions) {
Log.debug("Cannot wrap $apply into $expand: " + sChildMetaPath,
JSON.stringify(mChildQueryOptions), sClassName);
return undefined;
}
return mQueryOptions;
} | javascript | function (sBaseMetaPath, sChildMetaPath, mChildQueryOptions,
fnFetchMetadata) {
var sExpandSelectPath = "",
i,
aMetaPathSegments = sChildMetaPath.split("/"),
oProperty,
sPropertyMetaPath = sBaseMetaPath,
mQueryOptions = {},
mQueryOptionsForPathPrefix = mQueryOptions;
if (sChildMetaPath === "") {
return mChildQueryOptions;
}
for (i = 0; i < aMetaPathSegments.length; i += 1) {
sPropertyMetaPath = _Helper.buildPath(sPropertyMetaPath, aMetaPathSegments[i]);
sExpandSelectPath = _Helper.buildPath(sExpandSelectPath, aMetaPathSegments[i]);
oProperty = fnFetchMetadata(sPropertyMetaPath).getResult();
if (oProperty.$kind === "NavigationProperty") {
mQueryOptionsForPathPrefix.$expand = {};
mQueryOptionsForPathPrefix
= mQueryOptionsForPathPrefix.$expand[sExpandSelectPath]
= (i === aMetaPathSegments.length - 1) // last segment in path
? mChildQueryOptions
: {};
_Helper.selectKeyProperties(mQueryOptionsForPathPrefix,
fnFetchMetadata(sPropertyMetaPath + "/").getResult());
sExpandSelectPath = "";
} else if (oProperty.$kind !== "Property") {
return undefined;
}
}
if (oProperty.$kind === "Property") {
if (Object.keys(mChildQueryOptions).length > 0) {
Log.error("Failed to enhance query options for auto-$expand/$select as the"
+ " child binding has query options, but its path '" + sChildMetaPath
+ "' points to a structural property",
JSON.stringify(mChildQueryOptions), sClassName);
return undefined;
}
_Helper.addToSelect(mQueryOptionsForPathPrefix, [sExpandSelectPath]);
}
if ("$apply" in mChildQueryOptions) {
Log.debug("Cannot wrap $apply into $expand: " + sChildMetaPath,
JSON.stringify(mChildQueryOptions), sClassName);
return undefined;
}
return mQueryOptions;
} | [
"function",
"(",
"sBaseMetaPath",
",",
"sChildMetaPath",
",",
"mChildQueryOptions",
",",
"fnFetchMetadata",
")",
"{",
"var",
"sExpandSelectPath",
"=",
"\"\"",
",",
"i",
",",
"aMetaPathSegments",
"=",
"sChildMetaPath",
".",
"split",
"(",
"\"/\"",
")",
",",
"oProp... | Creates the query options for a child binding with the meta path given by its base
meta path and relative meta path. Adds the key properties to $select of all expanded
navigation properties. Requires that meta data for the meta path is already loaded so
that synchronous access to all prefixes of the relative meta path is possible.
If the relative meta path contains segments which are not a structural property or a
navigation property, the child query options cannot be created and the method returns
undefined.
@param {string} sBaseMetaPath
The meta path which is the starting point for the relative meta path
@param {string} sChildMetaPath
The relative meta path
@param {object} mChildQueryOptions
The child binding's query options
@param {function} fnFetchMetadata
Function which fetches metadata for a given meta path
@returns {object} The query options for the child binding or <code>undefined</code> in
case the query options cannot be created, e.g. because $apply cannot be wrapped into
$expand | [
"Creates",
"the",
"query",
"options",
"for",
"a",
"child",
"binding",
"with",
"the",
"meta",
"path",
"given",
"by",
"its",
"base",
"meta",
"path",
"and",
"relative",
"meta",
"path",
".",
"Adds",
"the",
"key",
"properties",
"to",
"$select",
"of",
"all",
"... | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Helper.js#L1329-L1377 | train | Creates an object that can be used to select the child bindings | [
30522,
3853,
1006,
24829,
11022,
11368,
22068,
2705,
1010,
8040,
19466,
22117,
12928,
15069,
1010,
11338,
19466,
2094,
4226,
2854,
7361,
9285,
1010,
1042,
2078,
7959,
10649,
11368,
8447,
2696,
1007,
1063,
13075,
3348,
9739,
5104,
12260,
6593,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | showDropDown | function showDropDown(scope, element, opts) {
if (opts.parent !== element.parent()) {
element.parent().attr('aria-owns', element.attr('id'));
}
element.parent().find('md-select-value').attr('aria-hidden', 'true');
opts.parent.append(element);
return $q(function(resolve, reject) {
try {
$animateCss(element, {removeClass: 'md-leave', duration: 0})
.start()
.then(positionAndFocusMenu)
.then(resolve);
} catch (e) {
reject(e);
}
});
} | javascript | function showDropDown(scope, element, opts) {
if (opts.parent !== element.parent()) {
element.parent().attr('aria-owns', element.attr('id'));
}
element.parent().find('md-select-value').attr('aria-hidden', 'true');
opts.parent.append(element);
return $q(function(resolve, reject) {
try {
$animateCss(element, {removeClass: 'md-leave', duration: 0})
.start()
.then(positionAndFocusMenu)
.then(resolve);
} catch (e) {
reject(e);
}
});
} | [
"function",
"showDropDown",
"(",
"scope",
",",
"element",
",",
"opts",
")",
"{",
"if",
"(",
"opts",
".",
"parent",
"!==",
"element",
".",
"parent",
"(",
")",
")",
"{",
"element",
".",
"parent",
"(",
")",
".",
"attr",
"(",
"'aria-owns'",
",",
"element... | ************************************ Closure Functions ************************************
Attach the select DOM element(s) and animate to the correct positions
and scalings... | [
"************************************",
"Closure",
"Functions",
"************************************",
"Attach",
"the",
"select",
"DOM",
"element",
"(",
"s",
")",
"and",
"animate",
"to",
"the",
"correct",
"positions",
"and",
"scalings",
"..."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/select/select.js#L1309-L1331 | train | show drop down | [
30522,
3853,
2265,
25711,
7698,
1006,
9531,
1010,
5783,
1010,
23569,
2015,
1007,
1063,
2065,
1006,
23569,
2015,
1012,
6687,
999,
1027,
1027,
5783,
1012,
6687,
1006,
1007,
1007,
1063,
5783,
1012,
6687,
1006,
1007,
1012,
2012,
16344,
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/core/support/plugins/Performance.js | _applyFilters | function _applyFilters(rawdata, filterOptions) {
var dataToWorkOn = (JSON.parse(JSON.stringify(rawdata)));
var containerWidth = document.querySelector('#sapUiSupportPerfHeaderTimeline').offsetWidth - document.querySelector('#sapUiSupportPerfHeaderTimelineBarInfoWrapper').offsetWidth;
var scrollWidth = 20;
var filteredTime = 1;
dataToWorkOn = _filterByTime(filterOptions.filterByTime, dataToWorkOn);
dataToWorkOn = _sortBy(filterOptions.orderByValue, dataToWorkOn);
dataToWorkOn = _filterMinValue(filterOptions.minValue, dataToWorkOn);
if (dataToWorkOn.length) {
filteredTime = filterOptions.filterByTime.end - filterOptions.filterByTime.start;
}
_widthSingleUnit = ((containerWidth - scrollWidth) / filteredTime); //ms in px
return dataToWorkOn;
} | javascript | function _applyFilters(rawdata, filterOptions) {
var dataToWorkOn = (JSON.parse(JSON.stringify(rawdata)));
var containerWidth = document.querySelector('#sapUiSupportPerfHeaderTimeline').offsetWidth - document.querySelector('#sapUiSupportPerfHeaderTimelineBarInfoWrapper').offsetWidth;
var scrollWidth = 20;
var filteredTime = 1;
dataToWorkOn = _filterByTime(filterOptions.filterByTime, dataToWorkOn);
dataToWorkOn = _sortBy(filterOptions.orderByValue, dataToWorkOn);
dataToWorkOn = _filterMinValue(filterOptions.minValue, dataToWorkOn);
if (dataToWorkOn.length) {
filteredTime = filterOptions.filterByTime.end - filterOptions.filterByTime.start;
}
_widthSingleUnit = ((containerWidth - scrollWidth) / filteredTime); //ms in px
return dataToWorkOn;
} | [
"function",
"_applyFilters",
"(",
"rawdata",
",",
"filterOptions",
")",
"{",
"var",
"dataToWorkOn",
"=",
"(",
"JSON",
".",
"parse",
"(",
"JSON",
".",
"stringify",
"(",
"rawdata",
")",
")",
")",
";",
"var",
"containerWidth",
"=",
"document",
".",
"querySele... | /* =============================================================================================================
Filters
============================================================================================================= | [
"/",
"*",
"=============================================================================================================",
"Filters",
"============================================================================================================="
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/support/plugins/Performance.js#L690-L707 | train | Apply filters to the given data | [
30522,
3853,
1035,
6611,
8873,
21928,
2015,
1006,
6315,
2850,
2696,
1010,
11307,
7361,
9285,
1007,
1063,
13075,
2951,
18790,
2953,
19648,
1027,
1006,
1046,
3385,
1012,
11968,
3366,
1006,
1046,
3385,
1012,
5164,
8757,
1006,
6315,
2850,
2696,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
keplergl/kepler.gl | src/utils/filter-utils.js | getHistogram | function getHistogram(domain, mappedValue) {
const histogram = histogramConstruct(domain, mappedValue, histogramBins);
const enlargedHistogram = histogramConstruct(
domain,
mappedValue,
enlargedHistogramBins
);
return {histogram, enlargedHistogram};
} | javascript | function getHistogram(domain, mappedValue) {
const histogram = histogramConstruct(domain, mappedValue, histogramBins);
const enlargedHistogram = histogramConstruct(
domain,
mappedValue,
enlargedHistogramBins
);
return {histogram, enlargedHistogram};
} | [
"function",
"getHistogram",
"(",
"domain",
",",
"mappedValue",
")",
"{",
"const",
"histogram",
"=",
"histogramConstruct",
"(",
"domain",
",",
"mappedValue",
",",
"histogramBins",
")",
";",
"const",
"enlargedHistogram",
"=",
"histogramConstruct",
"(",
"domain",
","... | Calculate histogram from domain and array of values
@param {number[]} domain
@param {Object[]} mappedValue
@returns {Array[]} histogram | [
"Calculate",
"histogram",
"from",
"domain",
"and",
"array",
"of",
"values"
] | 779238435707cc54335c2d00001e4b9334b314aa | https://github.com/keplergl/kepler.gl/blob/779238435707cc54335c2d00001e4b9334b314aa/src/utils/filter-utils.js#L457-L466 | train | Get the histogram and enlarged histogram | [
30522,
3853,
2131,
24158,
3406,
13113,
1006,
5884,
1010,
17715,
10175,
5657,
1007,
30524,
1027,
2010,
3406,
13113,
8663,
3367,
6820,
6593,
1006,
5884,
1010,
17715,
10175,
5657,
1010,
11792,
24158,
3406,
13113,
8428,
2015,
1007,
1025,
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... |
nhn/tui.editor | src/js/extensions/uml.js | plantUMLReplacer | function plantUMLReplacer(umlCode) {
let renderedHTML;
try {
if (!plantumlEncoder) {
throw new Error('plantuml-encoder dependency required');
}
renderedHTML = `<img src="${rendererURL}${plantumlEncoder.encode(umlCode)}" />`;
} catch (err) {
renderedHTML = `Error occurred on encoding uml: ${err.message}`;
}
return renderedHTML;
} | javascript | function plantUMLReplacer(umlCode) {
let renderedHTML;
try {
if (!plantumlEncoder) {
throw new Error('plantuml-encoder dependency required');
}
renderedHTML = `<img src="${rendererURL}${plantumlEncoder.encode(umlCode)}" />`;
} catch (err) {
renderedHTML = `Error occurred on encoding uml: ${err.message}`;
}
return renderedHTML;
} | [
"function",
"plantUMLReplacer",
"(",
"umlCode",
")",
"{",
"let",
"renderedHTML",
";",
"try",
"{",
"if",
"(",
"!",
"plantumlEncoder",
")",
"{",
"throw",
"new",
"Error",
"(",
"'plantuml-encoder dependency required'",
")",
";",
"}",
"renderedHTML",
"=",
"`",
"${"... | render html from uml
@param {string} umlCode - plant uml code text
@returns {string} - rendered html | [
"render",
"html",
"from",
"uml"
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/extensions/uml.js#L30-L43 | train | plantUMLReplacer - Placeholder for HTML | [
30522,
3853,
3269,
2819,
20974,
13699,
19217,
2099,
1006,
8529,
22499,
3207,
1007,
1063,
2292,
10155,
11039,
19968,
1025,
3046,
1063,
2065,
1006,
999,
3269,
2819,
7770,
16044,
2099,
1007,
1063,
5466,
2047,
7561,
1006,
1005,
3269,
2819,
2140... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
codemirror/CodeMirror | src/model/Doc.js | function(from, to, op) {
if (op) this.iterN(from - this.first, to - from, op)
else this.iterN(this.first, this.first + this.size, from)
} | javascript | function(from, to, op) {
if (op) this.iterN(from - this.first, to - from, op)
else this.iterN(this.first, this.first + this.size, from)
} | [
"function",
"(",
"from",
",",
"to",
",",
"op",
")",
"{",
"if",
"(",
"op",
")",
"this",
".",
"iterN",
"(",
"from",
"-",
"this",
".",
"first",
",",
"to",
"-",
"from",
",",
"op",
")",
"else",
"this",
".",
"iterN",
"(",
"this",
".",
"first",
",",... | Iterate over the document. Supports two forms -- with only one argument, it calls that for each line in the document. With three, it iterates over the range given by the first two (with the second being non-inclusive). | [
"Iterate",
"over",
"the",
"document",
".",
"Supports",
"two",
"forms",
"--",
"with",
"only",
"one",
"argument",
"it",
"calls",
"that",
"for",
"each",
"line",
"in",
"the",
"document",
".",
"With",
"three",
"it",
"iterates",
"over",
"the",
"range",
"given",
... | dab6f676107c10ba8d16c654a42f66cae3f27db1 | https://github.com/codemirror/CodeMirror/blob/dab6f676107c10ba8d16c654a42f66cae3f27db1/src/model/Doc.js#L53-L56 | train | Iterates over the sequence | [
30522,
3853,
1006,
2013,
1010,
2000,
1010,
6728,
1007,
1063,
2065,
1006,
6728,
1007,
2023,
1012,
2009,
11795,
1006,
2013,
1011,
2023,
1012,
2034,
1010,
2000,
1011,
2013,
1010,
6728,
1007,
2842,
2023,
1012,
2009,
11795,
1006,
2023,
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/LiveDevelopment/MultiBrowserImpl/launchers/node/LauncherDomain.js | init | function init(domainManager) {
_domainManager = domainManager;
if (!domainManager.hasDomain("launcher")) {
domainManager.registerDomain("launcher", {major: 0, minor: 1});
}
domainManager.registerCommand(
"launcher", // domain name
"launch", // command name
_cmdLaunch, // command handler function
false, // this command is synchronous in Node
"Launches a given HTML file in the browser for live development",
[
{ name: "url", type: "string", description: "file:// url to the HTML file" },
{ name: "browser", type: "string", description: "browser name"}
],
[]
);
} | javascript | function init(domainManager) {
_domainManager = domainManager;
if (!domainManager.hasDomain("launcher")) {
domainManager.registerDomain("launcher", {major: 0, minor: 1});
}
domainManager.registerCommand(
"launcher", // domain name
"launch", // command name
_cmdLaunch, // command handler function
false, // this command is synchronous in Node
"Launches a given HTML file in the browser for live development",
[
{ name: "url", type: "string", description: "file:// url to the HTML file" },
{ name: "browser", type: "string", description: "browser name"}
],
[]
);
} | [
"function",
"init",
"(",
"domainManager",
")",
"{",
"_domainManager",
"=",
"domainManager",
";",
"if",
"(",
"!",
"domainManager",
".",
"hasDomain",
"(",
"\"launcher\"",
")",
")",
"{",
"domainManager",
".",
"registerDomain",
"(",
"\"launcher\"",
",",
"{",
"majo... | Initializes the domain and registers commands.
@param {DomainManager} domainManager The DomainManager for the server | [
"Initializes",
"the",
"domain",
"and",
"registers",
"commands",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/LiveDevelopment/MultiBrowserImpl/launchers/node/LauncherDomain.js#L51-L68 | train | Initializes the node domain manager | [
30522,
3853,
1999,
4183,
1006,
5884,
24805,
4590,
1007,
1063,
1035,
5884,
24805,
4590,
1027,
5884,
24805,
4590,
1025,
2065,
1006,
999,
5884,
24805,
4590,
1012,
2038,
9527,
8113,
1006,
1000,
22742,
1000,
1007,
1007,
1063,
5884,
24805,
4590,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.dt/src/sap/ui/dt/util/ZIndexManager.js | function () {
var aOpenPopups = fnGetPopups();
var iLowestPopupZIndex;
if (aOpenPopups.length > 0) {
iLowestPopupZIndex = Math.min.apply(null, fnGetZIndexFromPopups(aOpenPopups));
}
// if no open popups
if (!Util.isInteger(iLowestPopupZIndex)) {
return Popup.getNextZIndex();
}
// get the minimum possible z-index
return this._getNextMinZIndex(iLowestPopupZIndex);
} | javascript | function () {
var aOpenPopups = fnGetPopups();
var iLowestPopupZIndex;
if (aOpenPopups.length > 0) {
iLowestPopupZIndex = Math.min.apply(null, fnGetZIndexFromPopups(aOpenPopups));
}
// if no open popups
if (!Util.isInteger(iLowestPopupZIndex)) {
return Popup.getNextZIndex();
}
// get the minimum possible z-index
return this._getNextMinZIndex(iLowestPopupZIndex);
} | [
"function",
"(",
")",
"{",
"var",
"aOpenPopups",
"=",
"fnGetPopups",
"(",
")",
";",
"var",
"iLowestPopupZIndex",
";",
"if",
"(",
"aOpenPopups",
".",
"length",
">",
"0",
")",
"{",
"iLowestPopupZIndex",
"=",
"Math",
".",
"min",
".",
"apply",
"(",
"null",
... | Calculates the z-index value below open popups.
If there are no open popups it returns the value from sap.ui.core.Popup.getNextZIndex()
@returns {int} z-index below open popups
@public | [
"Calculates",
"the",
"z",
"-",
"index",
"value",
"below",
"open",
"popups",
".",
"If",
"there",
"are",
"no",
"open",
"popups",
"it",
"returns",
"the",
"value",
"from",
"sap",
".",
"ui",
".",
"core",
".",
"Popup",
".",
"getNextZIndex",
"()"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.dt/src/sap/ui/dt/util/ZIndexManager.js#L137-L152 | train | Returns the z - index of the first popup that is not open | [
30522,
3853,
1006,
1007,
1063,
13075,
20118,
11837,
16340,
22264,
1027,
1042,
15465,
25856,
7361,
22264,
1006,
1007,
1025,
13075,
6335,
29385,
3367,
16340,
6279,
17168,
3207,
2595,
1025,
2065,
1006,
20118,
11837,
16340,
22264,
1012,
3091,
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/view/MainViewManager.js | _findFileInMRUList | function _findFileInMRUList(paneId, file) {
return _.findIndex(_mruList, function (record) {
return (record.file.fullPath === file.fullPath && record.paneId === paneId);
});
} | javascript | function _findFileInMRUList(paneId, file) {
return _.findIndex(_mruList, function (record) {
return (record.file.fullPath === file.fullPath && record.paneId === paneId);
});
} | [
"function",
"_findFileInMRUList",
"(",
"paneId",
",",
"file",
")",
"{",
"return",
"_",
".",
"findIndex",
"(",
"_mruList",
",",
"function",
"(",
"record",
")",
"{",
"return",
"(",
"record",
".",
"file",
".",
"fullPath",
"===",
"file",
".",
"fullPath",
"&&... | Locates the first MRU entry of a file for the requested pane
@param {!string} paneId - the paneId
@param {!File} File - the file
@return {{file:File, paneId:string}}
@private | [
"Locates",
"the",
"first",
"MRU",
"entry",
"of",
"a",
"file",
"for",
"the",
"requested",
"pane"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/view/MainViewManager.js#L260-L264 | train | Find the file in the MRU list | [
30522,
3853,
1035,
2424,
8873,
19856,
2213,
6820,
9863,
1006,
6090,
7416,
2094,
1010,
5371,
1007,
1063,
2709,
1035,
1012,
2424,
22254,
10288,
1006,
1035,
2720,
15859,
3367,
1010,
3853,
1006,
2501,
30524,
2094,
1027,
1027,
1027,
6090,
7416,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/BezierCurveEditor.js | mouseMoveRedraw | function mouseMoveRedraw() {
if (!bezierEditor.dragElement) {
animationRequest = null;
return;
}
// Update code
bezierEditor._commitTimingFunction();
bezierEditor._updateCanvas();
animationRequest = window.requestAnimationFrame(mouseMoveRedraw);
} | javascript | function mouseMoveRedraw() {
if (!bezierEditor.dragElement) {
animationRequest = null;
return;
}
// Update code
bezierEditor._commitTimingFunction();
bezierEditor._updateCanvas();
animationRequest = window.requestAnimationFrame(mouseMoveRedraw);
} | [
"function",
"mouseMoveRedraw",
"(",
")",
"{",
"if",
"(",
"!",
"bezierEditor",
".",
"dragElement",
")",
"{",
"animationRequest",
"=",
"null",
";",
"return",
";",
"}",
"// Update code",
"bezierEditor",
".",
"_commitTimingFunction",
"(",
")",
";",
"bezierEditor",
... | Helper function to redraw curve | [
"Helper",
"function",
"to",
"redraw",
"curve"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/InlineTimingFunctionEditor/BezierCurveEditor.js#L291-L302 | train | Redraws the mouse to the right | [
30522,
3853,
8000,
5302,
25896,
2527,
2860,
1006,
1007,
1063,
2065,
1006,
999,
2022,
21548,
2098,
15660,
1012,
8011,
12260,
3672,
1007,
1063,
7284,
2890,
15500,
1027,
19701,
1025,
2709,
1025,
1065,
1013,
1013,
10651,
3642,
2022,
21548,
2098... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.m/src/sap/m/HyphenationSupport.js | shouldUseThirdParty | function shouldUseThirdParty() {
var sHyphenationConfig = Core.getConfiguration().getHyphenation(),
oHyphenationInstance = Hyphenation.getInstance();
if (sHyphenationConfig === "native" || sHyphenationConfig === "disable") {
return false;
}
if (sHyphenationConfig === "thirdparty") {
return true;
}
return oHyphenationInstance.isLanguageSupported()
&& !oHyphenationInstance.canUseNativeHyphenation()
&& oHyphenationInstance.canUseThirdPartyHyphenation();
} | javascript | function shouldUseThirdParty() {
var sHyphenationConfig = Core.getConfiguration().getHyphenation(),
oHyphenationInstance = Hyphenation.getInstance();
if (sHyphenationConfig === "native" || sHyphenationConfig === "disable") {
return false;
}
if (sHyphenationConfig === "thirdparty") {
return true;
}
return oHyphenationInstance.isLanguageSupported()
&& !oHyphenationInstance.canUseNativeHyphenation()
&& oHyphenationInstance.canUseThirdPartyHyphenation();
} | [
"function",
"shouldUseThirdParty",
"(",
")",
"{",
"var",
"sHyphenationConfig",
"=",
"Core",
".",
"getConfiguration",
"(",
")",
".",
"getHyphenation",
"(",
")",
",",
"oHyphenationInstance",
"=",
"Hyphenation",
".",
"getInstance",
"(",
")",
";",
"if",
"(",
"sHyp... | Checks if the third-party hyphenation is required.
@returns {boolean} True if third-party hyphenation is required. False if native hyphenation is available or required
@private | [
"Checks",
"if",
"the",
"third",
"-",
"party",
"hyphenation",
"is",
"required",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/HyphenationSupport.js#L105-L120 | train | Returns true if the hyphenation is supported. | [
30522,
3853,
2323,
8557,
15222,
4103,
19362,
3723,
1006,
1007,
1063,
13075,
11004,
8458,
8189,
3508,
8663,
8873,
2290,
1027,
4563,
1012,
2131,
8663,
8873,
27390,
3370,
1006,
1007,
1012,
2131,
10536,
8458,
8189,
3508,
1006,
1007,
1010,
2821,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/config.js | getCredentials | function getCredentials(callback) {
var self = this;
function finish(err) {
callback(err, err ? null : self.credentials);
}
function credError(msg, err) {
return new AWS.util.error(err || new Error(), {
code: 'CredentialsError',
message: msg,
name: 'CredentialsError'
});
}
function getAsyncCredentials() {
self.credentials.get(function(err) {
if (err) {
var msg = 'Could not load credentials from ' +
self.credentials.constructor.name;
err = credError(msg, err);
}
finish(err);
});
}
function getStaticCredentials() {
var err = null;
if (!self.credentials.accessKeyId || !self.credentials.secretAccessKey) {
err = credError('Missing credentials');
}
finish(err);
}
if (self.credentials) {
if (typeof self.credentials.get === 'function') {
getAsyncCredentials();
} else { // static credentials
getStaticCredentials();
}
} else if (self.credentialProvider) {
self.credentialProvider.resolve(function(err, creds) {
if (err) {
err = credError('Could not load credentials from any providers', err);
}
self.credentials = creds;
finish(err);
});
} else {
finish(credError('No credentials to load'));
}
} | javascript | function getCredentials(callback) {
var self = this;
function finish(err) {
callback(err, err ? null : self.credentials);
}
function credError(msg, err) {
return new AWS.util.error(err || new Error(), {
code: 'CredentialsError',
message: msg,
name: 'CredentialsError'
});
}
function getAsyncCredentials() {
self.credentials.get(function(err) {
if (err) {
var msg = 'Could not load credentials from ' +
self.credentials.constructor.name;
err = credError(msg, err);
}
finish(err);
});
}
function getStaticCredentials() {
var err = null;
if (!self.credentials.accessKeyId || !self.credentials.secretAccessKey) {
err = credError('Missing credentials');
}
finish(err);
}
if (self.credentials) {
if (typeof self.credentials.get === 'function') {
getAsyncCredentials();
} else { // static credentials
getStaticCredentials();
}
} else if (self.credentialProvider) {
self.credentialProvider.resolve(function(err, creds) {
if (err) {
err = credError('Could not load credentials from any providers', err);
}
self.credentials = creds;
finish(err);
});
} else {
finish(credError('No credentials to load'));
}
} | [
"function",
"getCredentials",
"(",
"callback",
")",
"{",
"var",
"self",
"=",
"this",
";",
"function",
"finish",
"(",
"err",
")",
"{",
"callback",
"(",
"err",
",",
"err",
"?",
"null",
":",
"self",
".",
"credentials",
")",
";",
"}",
"function",
"credErro... | @!group Managing Credentials
Loads credentials from the configuration object. This is used internally
by the SDK to ensure that refreshable {Credentials} objects are properly
refreshed and loaded when sending a request. If you want to ensure that
your credentials are loaded prior to a request, you can use this method
directly to provide accurate credential data stored in the object.
@note If you configure the SDK with static or environment credentials,
the credential data should already be present in {credentials} attribute.
This method is primarily necessary to load credentials from asynchronous
sources, or sources that can refresh credentials periodically.
@example Getting your access key
AWS.config.getCredentials(function(err) {
if (err) console.log(err.stack); // credentials not loaded
else console.log("Access Key:", AWS.config.credentials.accessKeyId);
})
@callback callback function(err)
Called when the {credentials} have been properly set on the configuration
object.
@param err [Error] if this is set, credentials were not successfully
loaded and this error provides information why.
@see credentials
@see Credentials | [
"@!group",
"Managing",
"Credentials",
"Loads",
"credentials",
"from",
"the",
"configuration",
"object",
".",
"This",
"is",
"used",
"internally",
"by",
"the",
"SDK",
"to",
"ensure",
"that",
"refreshable",
"{",
"Credentials",
"}",
"objects",
"are",
"properly",
"re... | c23e5f0edd150f8885267e5f7c8a564f8e6e8562 | https://github.com/aws/aws-sdk-js/blob/c23e5f0edd150f8885267e5f7c8a564f8e6e8562/lib/config.js#L346-L397 | train | Get the credentials from the service | [
30522,
3853,
2131,
16748,
16454,
26340,
1006,
2655,
5963,
1007,
1063,
13075,
2969,
1027,
2023,
1025,
3853,
3926,
1006,
9413,
2099,
1007,
1063,
2655,
5963,
1006,
9413,
2099,
1010,
9413,
2099,
1029,
19701,
1024,
2969,
1012,
22496,
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... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/core/Configuration.js | function(sFormatId) {
check(!sFormatId || M_ABAP_TIME_FORMAT_PATTERN.hasOwnProperty(sFormatId), "sFormatId must be one of ['0','1','2','3','4'] or empty");
var mChanges = this.oConfiguration._collect();
this.sLegacyTimeFormat = mChanges.legacyTimeFormat = sFormatId = sFormatId || "";
this.setTimePattern("short", M_ABAP_TIME_FORMAT_PATTERN[sFormatId]["short"]);
this.setTimePattern("medium", M_ABAP_TIME_FORMAT_PATTERN[sFormatId]["medium"]);
this._setDayPeriods("abbreviated", M_ABAP_TIME_FORMAT_PATTERN[sFormatId].dayPeriods);
this.oConfiguration._endCollect();
return this;
} | javascript | function(sFormatId) {
check(!sFormatId || M_ABAP_TIME_FORMAT_PATTERN.hasOwnProperty(sFormatId), "sFormatId must be one of ['0','1','2','3','4'] or empty");
var mChanges = this.oConfiguration._collect();
this.sLegacyTimeFormat = mChanges.legacyTimeFormat = sFormatId = sFormatId || "";
this.setTimePattern("short", M_ABAP_TIME_FORMAT_PATTERN[sFormatId]["short"]);
this.setTimePattern("medium", M_ABAP_TIME_FORMAT_PATTERN[sFormatId]["medium"]);
this._setDayPeriods("abbreviated", M_ABAP_TIME_FORMAT_PATTERN[sFormatId].dayPeriods);
this.oConfiguration._endCollect();
return this;
} | [
"function",
"(",
"sFormatId",
")",
"{",
"check",
"(",
"!",
"sFormatId",
"||",
"M_ABAP_TIME_FORMAT_PATTERN",
".",
"hasOwnProperty",
"(",
"sFormatId",
")",
",",
"\"sFormatId must be one of ['0','1','2','3','4'] or empty\"",
")",
";",
"var",
"mChanges",
"=",
"this",
".",... | Allows to specify one of the legacy ABAP time formats.
This method sets the time patterns for 'short' and 'medium' style to the corresponding ABAP
formats and sets the day period texts to "AM"/"PM" or "am"/"pm" respectively. When called
with a null or undefined format id, any previously applied format will be removed.
After changing the legacy time format, the framework tries to update localization
specific parts of the UI. See the documentation of {@link sap.ui.core.Configuration#setLanguage}
for details and restrictions.
@param {string} sFormatId id of the ABAP time format (one of '0','1','2','3','4')
@return {sap.ui.core.Configuration.FormatSettings} Returns <code>this</code> to allow method chaining
@public | [
"Allows",
"to",
"specify",
"one",
"of",
"the",
"legacy",
"ABAP",
"time",
"formats",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Configuration.js#L2092-L2101 | train | Sets the legacy time format | [
30522,
3853,
1006,
16420,
2953,
18900,
3593,
1007,
1063,
4638,
1006,
999,
16420,
2953,
18900,
3593,
1064,
1064,
1049,
1035,
19557,
2361,
1035,
2051,
1035,
4289,
1035,
5418,
1012,
2038,
12384,
21572,
4842,
3723,
1006,
16420,
2953,
18900,
359... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
adobe/brackets | src/search/FindInFiles.js | _addListeners | function _addListeners() {
// Avoid adding duplicate listeners - e.g. if a 2nd search is run without closing the old results panel first
_removeListeners();
DocumentModule.on("documentChange", _documentChangeHandler);
FileSystem.on("change", _debouncedFileSystemChangeHandler);
DocumentManager.on("fileNameChange", _fileNameChangeHandler);
} | javascript | function _addListeners() {
// Avoid adding duplicate listeners - e.g. if a 2nd search is run without closing the old results panel first
_removeListeners();
DocumentModule.on("documentChange", _documentChangeHandler);
FileSystem.on("change", _debouncedFileSystemChangeHandler);
DocumentManager.on("fileNameChange", _fileNameChangeHandler);
} | [
"function",
"_addListeners",
"(",
")",
"{",
"// Avoid adding duplicate listeners - e.g. if a 2nd search is run without closing the old results panel first",
"_removeListeners",
"(",
")",
";",
"DocumentModule",
".",
"on",
"(",
"\"documentChange\"",
",",
"_documentChangeHandler",
")"... | Add listeners to track events that might change the search result set | [
"Add",
"listeners",
"to",
"track",
"events",
"that",
"might",
"change",
"the",
"search",
"result",
"set"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/search/FindInFiles.js#L98-L105 | train | Add listeners to the results panel | [
30522,
3853,
1035,
5587,
9863,
24454,
2015,
1006,
1007,
1063,
1013,
1013,
4468,
5815,
24473,
13810,
1011,
1041,
1012,
1043,
1012,
2065,
1037,
3416,
3945,
2003,
2448,
2302,
5494,
1996,
2214,
3463,
5997,
2034,
1035,
6366,
9863,
24454,
2015,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
google/closure-library | closure/goog/html/sanitizer/noclobber.js | elementMatches | function elementMatches(element, selector) {
return genericMethodCall(
Methods.MATCHES, element,
element.matches ? 'matches' : 'msMatchesSelector', [selector]);
} | javascript | function elementMatches(element, selector) {
return genericMethodCall(
Methods.MATCHES, element,
element.matches ? 'matches' : 'msMatchesSelector', [selector]);
} | [
"function",
"elementMatches",
"(",
"element",
",",
"selector",
")",
"{",
"return",
"genericMethodCall",
"(",
"Methods",
".",
"MATCHES",
",",
"element",
",",
"element",
".",
"matches",
"?",
"'matches'",
":",
"'msMatchesSelector'",
",",
"[",
"selector",
"]",
")"... | Returns true if the element would be selected by the provided selector,
without falling prey to things like <form><input name="setAttribute"></form>.
Equivalent to {@code element.matches("foo")}.
@param {!Element} element
@param {string} selector
@return {boolean} | [
"Returns",
"true",
"if",
"the",
"element",
"would",
"be",
"selected",
"by",
"the",
"provided",
"selector",
"without",
"falling",
"prey",
"to",
"things",
"like",
"<form",
">",
"<input",
"name",
"=",
"setAttribute",
">",
"<",
"/",
"form",
">",
".",
"Equivale... | 97390e9ca4483cebb9628e06026139fbb3023d65 | https://github.com/google/closure-library/blob/97390e9ca4483cebb9628e06026139fbb3023d65/closure/goog/html/sanitizer/noclobber.js#L312-L316 | train | Matches an element with a selector | [
30522,
3853,
5783,
18900,
8376,
1006,
5783,
1010,
27000,
1007,
1063,
2709,
12391,
11368,
6806,
16409,
8095,
1006,
4725,
1012,
3503,
1010,
5783,
1010,
5783,
1012,
3503,
1029,
1005,
3503,
1005,
1024,
1005,
5796,
18900,
8376,
11246,
22471,
295... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
TryGhost/Ghost | core/server/api/v0.1/users.js | handlePermissions | function handlePermissions(options) {
return models.Role.findOne({name: 'Owner'}).then((ownerRole) => {
return canThis(options.context).assign.role(ownerRole);
}).then(() => {
return options;
});
} | javascript | function handlePermissions(options) {
return models.Role.findOne({name: 'Owner'}).then((ownerRole) => {
return canThis(options.context).assign.role(ownerRole);
}).then(() => {
return options;
});
} | [
"function",
"handlePermissions",
"(",
"options",
")",
"{",
"return",
"models",
".",
"Role",
".",
"findOne",
"(",
"{",
"name",
":",
"'Owner'",
"}",
")",
".",
"then",
"(",
"(",
"ownerRole",
")",
"=>",
"{",
"return",
"canThis",
"(",
"options",
".",
"conte... | ### Handle Permissions
We need to be an authorised user to perform this action
@param {Object} options
@returns {Object} options | [
"###",
"Handle",
"Permissions",
"We",
"need",
"to",
"be",
"an",
"authorised",
"user",
"to",
"perform",
"this",
"action"
] | bb7bb55cf3e60af99ebbc56099928827b58461bc | https://github.com/TryGhost/Ghost/blob/bb7bb55cf3e60af99ebbc56099928827b58461bc/core/server/api/v0.1/users.js#L316-L322 | train | Check if user has the right permissions | [
30522,
3853,
5047,
4842,
25481,
2015,
1006,
7047,
1007,
1063,
2709,
4275,
1012,
2535,
1012,
2424,
5643,
1006,
1063,
2171,
1024,
1005,
3954,
1005,
1065,
1007,
1012,
2059,
1006,
1006,
3954,
13153,
2063,
1007,
1027,
1028,
1063,
2709,
2064,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.