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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ColorlibHQ/AdminLTE | plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js | _convertUrlsToLinks | function _convertUrlsToLinks(str) {
return str.replace(URL_REG_EXP, function(match, url) {
var punctuation = (url.match(TRAILING_CHAR_REG_EXP) || [])[1] || "",
opening = BRACKETS[punctuation];
url = url.replace(TRAILING_CHAR_REG_EXP, "");
if (url.split(opening).length > url.split(punctuation).length) {
url = url + punctuation;
punctuation = "";
}
var realUrl = url,
displayUrl = url;
if (url.length > MAX_DISPLAY_LENGTH) {
displayUrl = displayUrl.substr(0, MAX_DISPLAY_LENGTH) + "...";
}
// Add http prefix if necessary
if (realUrl.substr(0, 4) === "www.") {
realUrl = "http://" + realUrl;
}
return '<a href="' + realUrl + '">' + displayUrl + '</a>' + punctuation;
});
} | javascript | function _convertUrlsToLinks(str) {
return str.replace(URL_REG_EXP, function(match, url) {
var punctuation = (url.match(TRAILING_CHAR_REG_EXP) || [])[1] || "",
opening = BRACKETS[punctuation];
url = url.replace(TRAILING_CHAR_REG_EXP, "");
if (url.split(opening).length > url.split(punctuation).length) {
url = url + punctuation;
punctuation = "";
}
var realUrl = url,
displayUrl = url;
if (url.length > MAX_DISPLAY_LENGTH) {
displayUrl = displayUrl.substr(0, MAX_DISPLAY_LENGTH) + "...";
}
// Add http prefix if necessary
if (realUrl.substr(0, 4) === "www.") {
realUrl = "http://" + realUrl;
}
return '<a href="' + realUrl + '">' + displayUrl + '</a>' + punctuation;
});
} | [
"function",
"_convertUrlsToLinks",
"(",
"str",
")",
"{",
"return",
"str",
".",
"replace",
"(",
"URL_REG_EXP",
",",
"function",
"(",
"match",
",",
"url",
")",
"{",
"var",
"punctuation",
"=",
"(",
"url",
".",
"match",
"(",
"TRAILING_CHAR_REG_EXP",
")",
"||",... | This is basically a rebuild of
the rails auto_link_urls text helper | [
"This",
"is",
"basically",
"a",
"rebuild",
"of",
"the",
"rails",
"auto_link_urls",
"text",
"helper"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js#L4933-L4955 | train | Convert a string of urls to links | [
30522,
3853,
1035,
10463,
3126,
4877,
3406,
13767,
2015,
1006,
2358,
2099,
1007,
1063,
2709,
2358,
2099,
1012,
5672,
1006,
24471,
2140,
1035,
19723,
1035,
4654,
2361,
1010,
3853,
1006,
2674,
1010,
24471,
2140,
1007,
1063,
13075,
26136,
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... |
aframevr/aframe | src/core/component.js | function (isDefault) {
var attrValue = isDefault ? this.data : this.attrValue;
if (attrValue === null || attrValue === undefined) { return; }
window.HTMLElement.prototype.setAttribute.call(this.el, this.attrName,
this.stringify(attrValue));
} | javascript | function (isDefault) {
var attrValue = isDefault ? this.data : this.attrValue;
if (attrValue === null || attrValue === undefined) { return; }
window.HTMLElement.prototype.setAttribute.call(this.el, this.attrName,
this.stringify(attrValue));
} | [
"function",
"(",
"isDefault",
")",
"{",
"var",
"attrValue",
"=",
"isDefault",
"?",
"this",
".",
"data",
":",
"this",
".",
"attrValue",
";",
"if",
"(",
"attrValue",
"===",
"null",
"||",
"attrValue",
"===",
"undefined",
")",
"{",
"return",
";",
"}",
"win... | Write cached attribute data to the entity DOM element.
@param {boolean} isDefault - Whether component is a default component. Always flush for
default components. | [
"Write",
"cached",
"attribute",
"data",
"to",
"the",
"entity",
"DOM",
"element",
"."
] | 24acc78a7299a4cdfe3ef617f4d40ddf6275c992 | https://github.com/aframevr/aframe/blob/24acc78a7299a4cdfe3ef617f4d40ddf6275c992/src/core/component.js#L262-L267 | train | Set the value of the attribute | [
30522,
3853,
1006,
2003,
3207,
7011,
11314,
1007,
1063,
13075,
2012,
16344,
10175,
5657,
1027,
2003,
3207,
7011,
11314,
1029,
2023,
1012,
2951,
1024,
2023,
1012,
2012,
16344,
10175,
5657,
1025,
2065,
1006,
2012,
16344,
10175,
5657,
1027,
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.f/src/sap/f/cards/ActionEnablement.js | _setItemTypeFormatter | function _setItemTypeFormatter(oAction) {
var that = this;
var oBindingInfo = ManagedObject.bindingParser("{path:''}");
// Async formatter to set ListItem type depending if the list item context is a correct navigation target (decided by the navigation service).
oBindingInfo.formatter = function (vValue) {
var oBindingContext = this.getBindingContext(),
oModel = this.getModel(),
sPath;
if (oBindingContext) {
sPath = oBindingContext.getPath();
}
var mParameters = BindingResolver.resolveValue(oAction.parameters, oModel, sPath);
if (vValue.__resolved) {
if (vValue.__enabled) {
return "Navigation";
} else {
return "Inactive";
}
}
if (!vValue.__promise) {
vValue.__promise = true;
that._oServiceManager.getService(_getServiceName(oAction.service)).then(function (oNavigationService) {
if (oNavigationService) {
oNavigationService
.enabled({
parameters: mParameters
})
.then(function (bEnabled) {
vValue.__resolved = true;
vValue.__enabled = bEnabled;
that.getModel().checkUpdate(true);
})
.catch(function () {
vValue.__resolved = true;
vValue.__enabled = false;
});
} else {
vValue.__resolved = true;
vValue.__enabled = false;
}
});
}
return "Inactive";
};
this._oItemTemplate.bindProperty("type", oBindingInfo);
} | javascript | function _setItemTypeFormatter(oAction) {
var that = this;
var oBindingInfo = ManagedObject.bindingParser("{path:''}");
// Async formatter to set ListItem type depending if the list item context is a correct navigation target (decided by the navigation service).
oBindingInfo.formatter = function (vValue) {
var oBindingContext = this.getBindingContext(),
oModel = this.getModel(),
sPath;
if (oBindingContext) {
sPath = oBindingContext.getPath();
}
var mParameters = BindingResolver.resolveValue(oAction.parameters, oModel, sPath);
if (vValue.__resolved) {
if (vValue.__enabled) {
return "Navigation";
} else {
return "Inactive";
}
}
if (!vValue.__promise) {
vValue.__promise = true;
that._oServiceManager.getService(_getServiceName(oAction.service)).then(function (oNavigationService) {
if (oNavigationService) {
oNavigationService
.enabled({
parameters: mParameters
})
.then(function (bEnabled) {
vValue.__resolved = true;
vValue.__enabled = bEnabled;
that.getModel().checkUpdate(true);
})
.catch(function () {
vValue.__resolved = true;
vValue.__enabled = false;
});
} else {
vValue.__resolved = true;
vValue.__enabled = false;
}
});
}
return "Inactive";
};
this._oItemTemplate.bindProperty("type", oBindingInfo);
} | [
"function",
"_setItemTypeFormatter",
"(",
"oAction",
")",
"{",
"var",
"that",
"=",
"this",
";",
"var",
"oBindingInfo",
"=",
"ManagedObject",
".",
"bindingParser",
"(",
"\"{path:''}\"",
")",
";",
"// Async formatter to set ListItem type depending if the list item context is ... | List card specific | [
"List",
"card",
"specific"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.f/src/sap/f/cards/ActionEnablement.js#L35-L86 | train | Sets the formatter for the list item. | [
30522,
3853,
1035,
2275,
4221,
20492,
18863,
14192,
20097,
1006,
1051,
18908,
3258,
1007,
1063,
13075,
2008,
1027,
2023,
1025,
13075,
27885,
22254,
2075,
2378,
30524,
2326,
1007,
1012,
27885,
22254,
2075,
2378,
14876,
1012,
4289,
3334,
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... |
angular/material | src/core/services/interimElement/interimElement.js | showElement | function showElement(element, options, controller) {
// Trigger onShowing callback before the `show()` starts
var notifyShowing = options.onShowing || angular.noop;
// Trigger onComplete callback when the `show()` finishes
var notifyComplete = options.onComplete || angular.noop;
// Necessary for consistency between AngularJS 1.5 and 1.6.
try {
notifyShowing(options.scope, element, options, controller);
} catch (e) {
return $q.reject(e);
}
return $q(function (resolve, reject) {
try {
// Start transitionIn
$q.when(options.onShow(options.scope, element, options, controller))
.then(function () {
notifyComplete(options.scope, element, options);
startAutoHide();
resolve(element);
}, reject);
} catch (e) {
reject(e.message);
}
});
} | javascript | function showElement(element, options, controller) {
// Trigger onShowing callback before the `show()` starts
var notifyShowing = options.onShowing || angular.noop;
// Trigger onComplete callback when the `show()` finishes
var notifyComplete = options.onComplete || angular.noop;
// Necessary for consistency between AngularJS 1.5 and 1.6.
try {
notifyShowing(options.scope, element, options, controller);
} catch (e) {
return $q.reject(e);
}
return $q(function (resolve, reject) {
try {
// Start transitionIn
$q.when(options.onShow(options.scope, element, options, controller))
.then(function () {
notifyComplete(options.scope, element, options);
startAutoHide();
resolve(element);
}, reject);
} catch (e) {
reject(e.message);
}
});
} | [
"function",
"showElement",
"(",
"element",
",",
"options",
",",
"controller",
")",
"{",
"// Trigger onShowing callback before the `show()` starts",
"var",
"notifyShowing",
"=",
"options",
".",
"onShowing",
"||",
"angular",
".",
"noop",
";",
"// Trigger onComplete callback... | Show the element ( with transitions), notify complete and start
optional auto-Hide | [
"Show",
"the",
"element",
"(",
"with",
"transitions",
")",
"notify",
"complete",
"and",
"start",
"optional",
"auto",
"-",
"Hide"
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/services/interimElement/interimElement.js#L691-L719 | train | Show an element | [
30522,
3853,
2265,
12260,
3672,
1006,
5783,
1010,
7047,
1010,
11486,
1007,
1063,
1013,
1013,
9495,
2006,
22231,
9328,
2655,
5963,
2077,
1996,
1036,
2265,
1006,
1007,
1036,
4627,
13075,
2025,
8757,
22231,
9328,
1027,
7047,
1012,
2006,
22231,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
GitbookIO/gitbook | lib/output/ebook/onFinish.js | writeSummary | function writeSummary(output) {
var options = output.getOptions();
var prefix = options.get('prefix');
var filePath = SUMMARY_FILE;
var engine = WebsiteGenerator.createTemplateEngine(output, filePath);
var context = JSONUtils.encodeOutput(output);
// Render the theme
return Templating.renderFile(engine, prefix + '/summary.html', context)
// Write it to the disk
.then(function(tplOut) {
return writeFile(output, filePath, tplOut.getContent());
});
} | javascript | function writeSummary(output) {
var options = output.getOptions();
var prefix = options.get('prefix');
var filePath = SUMMARY_FILE;
var engine = WebsiteGenerator.createTemplateEngine(output, filePath);
var context = JSONUtils.encodeOutput(output);
// Render the theme
return Templating.renderFile(engine, prefix + '/summary.html', context)
// Write it to the disk
.then(function(tplOut) {
return writeFile(output, filePath, tplOut.getContent());
});
} | [
"function",
"writeSummary",
"(",
"output",
")",
"{",
"var",
"options",
"=",
"output",
".",
"getOptions",
"(",
")",
";",
"var",
"prefix",
"=",
"options",
".",
"get",
"(",
"'prefix'",
")",
";",
"var",
"filePath",
"=",
"SUMMARY_FILE",
";",
"var",
"engine",
... | Write the SUMMARY.html
@param {Output}
@return {Output} | [
"Write",
"the",
"SUMMARY",
".",
"html"
] | 6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4 | https://github.com/GitbookIO/gitbook/blob/6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4/lib/output/ebook/onFinish.js#L20-L35 | train | Write the summary to disk | [
30522,
3853,
7009,
2819,
7849,
2100,
1006,
6434,
1007,
1063,
13075,
7047,
1027,
6434,
1012,
2131,
7361,
9285,
1006,
1007,
1025,
13075,
17576,
1027,
7047,
1012,
2131,
1006,
1005,
17576,
1005,
1007,
1025,
13075,
5371,
15069,
1027,
12654,
1035... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
firebase/firebase-js-sdk | packages/auth/src/cordovahandler.js | function() {
// Remove current resume listener.
if (onResume) {
doc.removeEventListener('resume', onResume, false);
}
// Remove visibility change listener.
if (onVisibilityChange) {
doc.removeEventListener('visibilitychange', onVisibilityChange, false);
}
// Cancel onClose promise if not already cancelled.
if (onClose) {
onClose.cancel();
}
// Remove Auth event callback.
if (authEventCallback) {
self.removeAuthEventListener(authEventCallback);
}
// Clear any pending redirect now that it is completed.
self.pendingRedirect_ = null;
} | javascript | function() {
// Remove current resume listener.
if (onResume) {
doc.removeEventListener('resume', onResume, false);
}
// Remove visibility change listener.
if (onVisibilityChange) {
doc.removeEventListener('visibilitychange', onVisibilityChange, false);
}
// Cancel onClose promise if not already cancelled.
if (onClose) {
onClose.cancel();
}
// Remove Auth event callback.
if (authEventCallback) {
self.removeAuthEventListener(authEventCallback);
}
// Clear any pending redirect now that it is completed.
self.pendingRedirect_ = null;
} | [
"function",
"(",
")",
"{",
"// Remove current resume listener.",
"if",
"(",
"onResume",
")",
"{",
"doc",
".",
"removeEventListener",
"(",
"'resume'",
",",
"onResume",
",",
"false",
")",
";",
"}",
"// Remove visibility change listener.",
"if",
"(",
"onVisibilityChang... | When the processRedirect promise completes, clean up any remaining temporary listeners and timers. | [
"When",
"the",
"processRedirect",
"promise",
"completes",
"clean",
"up",
"any",
"remaining",
"temporary",
"listeners",
"and",
"timers",
"."
] | 491598a499813dacc23724de5e237ec220cc560e | https://github.com/firebase/firebase-js-sdk/blob/491598a499813dacc23724de5e237ec220cc560e/packages/auth/src/cordovahandler.js#L359-L378 | train | Cancels the current resume listener and removes the current visibility change listener. | [
30522,
3853,
1006,
1007,
1063,
1013,
1013,
6366,
2783,
13746,
19373,
1012,
2065,
1006,
2006,
6072,
17897,
1007,
1063,
9986,
1012,
6366,
18697,
3372,
9863,
24454,
1006,
1005,
13746,
1005,
1010,
2006,
6072,
17897,
30524,
1006,
2006,
11365,
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... | |
adobe/brackets | src/xorigin.js | handleError | function handleError(message, url, line) {
// Ignore this error if it does not look like the rather vague cross origin error in Chrome
// Chrome will print it to the console anyway
if (!testCrossOriginError(message, url, line)) {
if (previousErrorHandler) {
return previousErrorHandler(message, url, line);
}
return;
}
// Show an error message
window.alert("Oops! This application doesn't run in browsers yet.\n\nIt is built in HTML, but right now it runs as a desktop app so you can use it to edit local files. Please use the application shell in the following repo to run this application:\n\ngithub.com/adobe/brackets-shell");
// Restore the original handler for later errors
window.onerror = previousErrorHandler;
} | javascript | function handleError(message, url, line) {
// Ignore this error if it does not look like the rather vague cross origin error in Chrome
// Chrome will print it to the console anyway
if (!testCrossOriginError(message, url, line)) {
if (previousErrorHandler) {
return previousErrorHandler(message, url, line);
}
return;
}
// Show an error message
window.alert("Oops! This application doesn't run in browsers yet.\n\nIt is built in HTML, but right now it runs as a desktop app so you can use it to edit local files. Please use the application shell in the following repo to run this application:\n\ngithub.com/adobe/brackets-shell");
// Restore the original handler for later errors
window.onerror = previousErrorHandler;
} | [
"function",
"handleError",
"(",
"message",
",",
"url",
",",
"line",
")",
"{",
"// Ignore this error if it does not look like the rather vague cross origin error in Chrome",
"// Chrome will print it to the console anyway",
"if",
"(",
"!",
"testCrossOriginError",
"(",
"message",
",... | Our error handler | [
"Our",
"error",
"handler"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/xorigin.js#L55-L70 | train | Handle an error | [
30522,
3853,
5047,
2121,
29165,
1006,
4471,
1010,
24471,
2140,
1010,
2240,
1007,
1063,
1013,
1013,
8568,
2023,
7561,
2065,
2009,
2515,
2025,
2298,
2066,
1996,
2738,
13727,
2892,
4761,
7561,
1999,
18546,
1013,
1013,
18546,
2097,
6140,
2009,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/language/HTMLDOMDiff.js | function (oldParent, oldNodeMap, newParent, newNodeMap) {
/*jslint continue: true */
var newIndex = 0,
oldIndex = 0,
newChildren = newParent.children,
oldChildren = oldParent ? oldParent.children : [],
newChild,
oldChild,
newEdits = [],
newEdit,
textAfterID,
edits = [],
moves = [],
newElements = [];
/**
* We initially put new edit objects into the `newEdits` array so that we
* can fix them up with proper positioning information. This function is
* responsible for doing that fixup.
*
* The `beforeID` that appears in many edits tells the browser to make the
* change before the element with the given ID. In other words, an
* elementInsert with a `beforeID` of 32 would result in something like
* `parentElement.insertBefore(newChildElement, _queryBracketsID(32))`
*
* Many new edits are captured in the `newEdits` array so that a suitable
* `beforeID` can be added to them before they are added to the main edits
* list. This function sets the `beforeID` on any pending edits and adds
* them to the main list.
*
* If this item is not being deleted, then it will be used as the `afterID`
* for text edits that follow.
*
* @param {int} beforeID ID to set on the pending edits
* @param {boolean} isBeingDeleted true if the given item is being deleted. If so,
* we can't use it as the `afterID` for future edits--whatever previous item
* was set as the `textAfterID` is still okay.
*/
var finalizeNewEdits = function (beforeID, isBeingDeleted) {
newEdits.forEach(function (edit) {
// elementDeletes don't need any positioning information
if (edit.type !== "elementDelete") {
edit.beforeID = beforeID;
}
});
edits.push.apply(edits, newEdits);
newEdits = [];
// If the item we made this set of edits relative to
// is being deleted, we can't use it as the afterID for future
// edits. It's okay to just keep the previous afterID, since
// this node will no longer be in the tree by the time we get
// to any future edit that needs an afterID.
if (!isBeingDeleted) {
textAfterID = beforeID;
}
};
/**
* If the current element was not in the old DOM, then we will create
* an elementInsert edit for it.
*
* If the element was in the old DOM, this will return false and the
* main loop will either spot this element later in the child list
* or the element has been moved.
*
* @return {boolean} true if an elementInsert was created
*/
var addElementInsert = function () {
if (!oldNodeMap[newChild.tagID]) {
newEdit = {
type: "elementInsert",
tag: newChild.tag,
tagID: newChild.tagID,
parentID: newChild.parent.tagID,
attributes: newChild.attributes
};
newEdits.push(newEdit);
// This newly inserted node needs to have edits generated for its
// children, so we add it to the queue.
newElements.push(newChild);
// A textInsert edit that follows this elementInsert should use
// this element's ID.
textAfterID = newChild.tagID;
// new element means we need to move on to compare the next
// of the current tree with the one from the old tree that we
// just compared
newIndex++;
return true;
}
return false;
};
/**
* If the old element that we're looking at does not appear in the new
* DOM, that means it was deleted and we'll create an elementDelete edit.
*
* If the element is in the new DOM, then this will return false and
* the main loop with either spot this node later on or the element
* has been moved.
*
* @return {boolean} true if elementDelete was generated
*/
var addElementDelete = function () {
if (!newNodeMap[oldChild.tagID]) {
// We can finalize existing edits relative to this node *before* it's
// deleted.
finalizeNewEdits(oldChild.tagID, true);
newEdit = {
type: "elementDelete",
tagID: oldChild.tagID
};
newEdits.push(newEdit);
// deleted element means we need to move on to compare the next
// of the old tree with the one from the current tree that we
// just compared
oldIndex++;
return true;
}
return false;
};
/**
* Adds a textInsert edit for a newly created text node.
*/
var addTextInsert = function () {
newEdit = {
type: "textInsert",
content: newChild.content,
parentID: newChild.parent.tagID
};
// text changes will generally have afterID and beforeID, but we make
// special note if it's the first child.
if (textAfterID) {
newEdit.afterID = textAfterID;
} else {
newEdit.firstChild = true;
}
newEdits.push(newEdit);
// The text node is in the new tree, so we move to the next new tree item
newIndex++;
};
/**
* Finds the previous child of the new tree.
*
* @return {?Object} previous child or null if there wasn't one
*/
var prevNode = function () {
if (newIndex > 0) {
return newParent.children[newIndex - 1];
}
return null;
};
/**
* Adds a textDelete edit for text node that is not in the new tree.
* Note that we actually create a textReplace rather than a textDelete
* if the previous node in current tree was a text node. We do this because
* text nodes are not individually addressable and a delete event would
* end up clearing out both that previous text node that we want to keep
* and this text node that we want to eliminate. Instead, we just log
* a textReplace which will result in the deletion of this node and
* the maintaining of the old content.
*/
var addTextDelete = function () {
var prev = prevNode();
if (prev && !prev.children) {
newEdit = {
type: "textReplace",
content: prev.content
};
} else {
newEdit = {
type: "textDelete"
};
}
// When elements are deleted or moved from the old set of children, you
// can end up with multiple text nodes in a row. A single textReplace edit
// will take care of those (and will contain all of the right content since
// the text nodes between elements in the new DOM are merged together).
// The check below looks to see if we're already in the process of adding
// a textReplace edit following the same element.
var previousEdit = newEdits.length > 0 && newEdits[newEdits.length - 1];
if (previousEdit && previousEdit.type === "textReplace" &&
previousEdit.afterID === textAfterID) {
oldIndex++;
return;
}
newEdit.parentID = oldChild.parent.tagID;
// If there was only one child previously, we just pass along
// textDelete/textReplace with the parentID and the browser will
// clear all of the children
if (oldChild.parent.children.length === 1) {
newEdits.push(newEdit);
} else {
if (textAfterID) {
newEdit.afterID = textAfterID;
}
newEdits.push(newEdit);
}
// This text appeared in the old tree but not the new one, so we
// increment the old children counter.
oldIndex++;
};
/**
* Adds an elementMove edit if the parent has changed between the old and new trees.
* These are fairly infrequent and generally occur if you make a change across
* tag boundaries.
*
* @return {boolean} true if an elementMove was generated
*/
var addElementMove = function () {
// This check looks a little strange, but it suits what we're trying
// to do: as we're walking through the children, a child node that has moved
// from one parent to another will be found but would look like some kind
// of insert. The check that we're doing here is looking up the current
// child's ID in the *old* map and seeing if this child used to have a
// different parent.
var possiblyMovedElement = oldNodeMap[newChild.tagID];
if (possiblyMovedElement &&
newParent.tagID !== getParentID(possiblyMovedElement)) {
newEdit = {
type: "elementMove",
tagID: newChild.tagID,
parentID: newChild.parent.tagID
};
moves.push(newEdit.tagID);
newEdits.push(newEdit);
// this element in the new tree was a move to this spot, so we can move
// on to the next child in the new tree.
newIndex++;
return true;
}
return false;
};
/**
* Looks to see if the element in the old tree has moved by checking its
* current and former parents.
*
* @return {boolean} true if the element has moved
*/
var hasMoved = function (oldChild) {
var oldChildInNewTree = newNodeMap[oldChild.tagID];
return oldChild.children && oldChildInNewTree && getParentID(oldChild) !== getParentID(oldChildInNewTree);
};
// Loop through the current and old children, comparing them one by one.
while (newIndex < newChildren.length && oldIndex < oldChildren.length) {
newChild = newChildren[newIndex];
// Check to see if the currentChild has been reparented from somewhere
// else in the old tree
if (newChild.children && addElementMove()) {
continue;
}
oldChild = oldChildren[oldIndex];
// Check to see if the oldChild has been moved to another parent.
// If it has, we deal with it on the other side (see above)
if (hasMoved(oldChild)) {
oldIndex++;
continue;
}
if (newChild.isElement() || oldChild.isElement()) {
if (newChild.isElement() && oldChild.isText()) {
addTextDelete();
// If this element is new, add it and move to the next child
// in the current tree. Otherwise, we'll compare this same
// current element with the next old element on the next pass
// through the loop.
addElementInsert();
} else if (oldChild.isElement() && newChild.isText()) {
// If the old child has *not* been deleted, we assume that we've
// inserted some text and will still encounter the old node
if (!addElementDelete()) {
addTextInsert();
}
// both children are elements
} else {
if (newChild.tagID !== oldChild.tagID) {
// First, check to see if we're deleting an element.
// If we are, get rid of that element and restart our comparison
// logic with the same element from the new tree and the next one
// from the old tree.
if (!addElementDelete()) {
// Since we're not deleting and these elements don't match up, we
// must have a new element. Add an elementInsert (and log a problem
// if no insert works.)
if (!addElementInsert()) {
console.error("HTML Instrumentation: This should not happen. Two elements have different tag IDs and there was no insert/delete. This generally means there was a reordering of elements.");
newIndex++;
oldIndex++;
}
}
// There has been no change in the tag we're looking at.
} else {
// Since this element hasn't moved, it is a suitable "beforeID"
// for the edits we've logged.
finalizeNewEdits(oldChild.tagID, false);
newIndex++;
oldIndex++;
}
}
// We know we're comparing two texts. Just match up their signatures.
} else {
if (newChild.textSignature !== oldChild.textSignature) {
newEdit = {
type: "textReplace",
content: newChild.content,
parentID: newChild.parent.tagID
};
if (textAfterID) {
newEdit.afterID = textAfterID;
}
newEdits.push(newEdit);
}
// Either we've done a text replace or both sides matched. In either
// case we're ready to move forward among both the old and new children.
newIndex++;
oldIndex++;
}
}
// At this point, we've used up all of the children in at least one of the
// two sets of children.
/**
* Take care of any remaining children in the old tree.
*/
while (oldIndex < oldChildren.length) {
oldChild = oldChildren[oldIndex];
// Check for an element that has moved
if (hasMoved(oldChild)) {
// This element has moved, so we skip it on this side (the move
// is handled on the new tree side).
oldIndex++;
// is this an element? if so, delete it
} else if (oldChild.isElement()) {
if (!addElementDelete()) {
console.error("HTML Instrumentation: failed to add elementDelete for remaining element in the original DOM. This should not happen.", oldChild);
oldIndex++;
}
// must be text. delete that.
} else {
addTextDelete();
}
}
/**
* Take care of the remaining children in the new tree.
*/
while (newIndex < newChildren.length) {
newChild = newChildren[newIndex];
// Is this an element?
if (newChild.isElement()) {
// Look to see if the element has moved here.
if (!addElementMove()) {
// Not a move, so we insert this element.
if (!addElementInsert()) {
console.error("HTML Instrumentation: failed to add elementInsert for remaining element in the updated DOM. This should not happen.");
newIndex++;
}
}
// not a new element, so it must be new text.
} else {
addTextInsert();
}
}
/**
* Finalize remaining edits. For inserts and moves, we can set the `lastChild`
* flag and the browser can simply use `appendChild` to add these items.
*/
newEdits.forEach(function (edit) {
if (edit.type === "textInsert" || edit.type === "elementInsert" || edit.type === "elementMove") {
edit.lastChild = true;
delete edit.firstChild;
delete edit.afterID;
}
});
edits.push.apply(edits, newEdits);
return {
edits: edits,
moves: moves,
newElements: newElements
};
} | javascript | function (oldParent, oldNodeMap, newParent, newNodeMap) {
/*jslint continue: true */
var newIndex = 0,
oldIndex = 0,
newChildren = newParent.children,
oldChildren = oldParent ? oldParent.children : [],
newChild,
oldChild,
newEdits = [],
newEdit,
textAfterID,
edits = [],
moves = [],
newElements = [];
/**
* We initially put new edit objects into the `newEdits` array so that we
* can fix them up with proper positioning information. This function is
* responsible for doing that fixup.
*
* The `beforeID` that appears in many edits tells the browser to make the
* change before the element with the given ID. In other words, an
* elementInsert with a `beforeID` of 32 would result in something like
* `parentElement.insertBefore(newChildElement, _queryBracketsID(32))`
*
* Many new edits are captured in the `newEdits` array so that a suitable
* `beforeID` can be added to them before they are added to the main edits
* list. This function sets the `beforeID` on any pending edits and adds
* them to the main list.
*
* If this item is not being deleted, then it will be used as the `afterID`
* for text edits that follow.
*
* @param {int} beforeID ID to set on the pending edits
* @param {boolean} isBeingDeleted true if the given item is being deleted. If so,
* we can't use it as the `afterID` for future edits--whatever previous item
* was set as the `textAfterID` is still okay.
*/
var finalizeNewEdits = function (beforeID, isBeingDeleted) {
newEdits.forEach(function (edit) {
// elementDeletes don't need any positioning information
if (edit.type !== "elementDelete") {
edit.beforeID = beforeID;
}
});
edits.push.apply(edits, newEdits);
newEdits = [];
// If the item we made this set of edits relative to
// is being deleted, we can't use it as the afterID for future
// edits. It's okay to just keep the previous afterID, since
// this node will no longer be in the tree by the time we get
// to any future edit that needs an afterID.
if (!isBeingDeleted) {
textAfterID = beforeID;
}
};
/**
* If the current element was not in the old DOM, then we will create
* an elementInsert edit for it.
*
* If the element was in the old DOM, this will return false and the
* main loop will either spot this element later in the child list
* or the element has been moved.
*
* @return {boolean} true if an elementInsert was created
*/
var addElementInsert = function () {
if (!oldNodeMap[newChild.tagID]) {
newEdit = {
type: "elementInsert",
tag: newChild.tag,
tagID: newChild.tagID,
parentID: newChild.parent.tagID,
attributes: newChild.attributes
};
newEdits.push(newEdit);
// This newly inserted node needs to have edits generated for its
// children, so we add it to the queue.
newElements.push(newChild);
// A textInsert edit that follows this elementInsert should use
// this element's ID.
textAfterID = newChild.tagID;
// new element means we need to move on to compare the next
// of the current tree with the one from the old tree that we
// just compared
newIndex++;
return true;
}
return false;
};
/**
* If the old element that we're looking at does not appear in the new
* DOM, that means it was deleted and we'll create an elementDelete edit.
*
* If the element is in the new DOM, then this will return false and
* the main loop with either spot this node later on or the element
* has been moved.
*
* @return {boolean} true if elementDelete was generated
*/
var addElementDelete = function () {
if (!newNodeMap[oldChild.tagID]) {
// We can finalize existing edits relative to this node *before* it's
// deleted.
finalizeNewEdits(oldChild.tagID, true);
newEdit = {
type: "elementDelete",
tagID: oldChild.tagID
};
newEdits.push(newEdit);
// deleted element means we need to move on to compare the next
// of the old tree with the one from the current tree that we
// just compared
oldIndex++;
return true;
}
return false;
};
/**
* Adds a textInsert edit for a newly created text node.
*/
var addTextInsert = function () {
newEdit = {
type: "textInsert",
content: newChild.content,
parentID: newChild.parent.tagID
};
// text changes will generally have afterID and beforeID, but we make
// special note if it's the first child.
if (textAfterID) {
newEdit.afterID = textAfterID;
} else {
newEdit.firstChild = true;
}
newEdits.push(newEdit);
// The text node is in the new tree, so we move to the next new tree item
newIndex++;
};
/**
* Finds the previous child of the new tree.
*
* @return {?Object} previous child or null if there wasn't one
*/
var prevNode = function () {
if (newIndex > 0) {
return newParent.children[newIndex - 1];
}
return null;
};
/**
* Adds a textDelete edit for text node that is not in the new tree.
* Note that we actually create a textReplace rather than a textDelete
* if the previous node in current tree was a text node. We do this because
* text nodes are not individually addressable and a delete event would
* end up clearing out both that previous text node that we want to keep
* and this text node that we want to eliminate. Instead, we just log
* a textReplace which will result in the deletion of this node and
* the maintaining of the old content.
*/
var addTextDelete = function () {
var prev = prevNode();
if (prev && !prev.children) {
newEdit = {
type: "textReplace",
content: prev.content
};
} else {
newEdit = {
type: "textDelete"
};
}
// When elements are deleted or moved from the old set of children, you
// can end up with multiple text nodes in a row. A single textReplace edit
// will take care of those (and will contain all of the right content since
// the text nodes between elements in the new DOM are merged together).
// The check below looks to see if we're already in the process of adding
// a textReplace edit following the same element.
var previousEdit = newEdits.length > 0 && newEdits[newEdits.length - 1];
if (previousEdit && previousEdit.type === "textReplace" &&
previousEdit.afterID === textAfterID) {
oldIndex++;
return;
}
newEdit.parentID = oldChild.parent.tagID;
// If there was only one child previously, we just pass along
// textDelete/textReplace with the parentID and the browser will
// clear all of the children
if (oldChild.parent.children.length === 1) {
newEdits.push(newEdit);
} else {
if (textAfterID) {
newEdit.afterID = textAfterID;
}
newEdits.push(newEdit);
}
// This text appeared in the old tree but not the new one, so we
// increment the old children counter.
oldIndex++;
};
/**
* Adds an elementMove edit if the parent has changed between the old and new trees.
* These are fairly infrequent and generally occur if you make a change across
* tag boundaries.
*
* @return {boolean} true if an elementMove was generated
*/
var addElementMove = function () {
// This check looks a little strange, but it suits what we're trying
// to do: as we're walking through the children, a child node that has moved
// from one parent to another will be found but would look like some kind
// of insert. The check that we're doing here is looking up the current
// child's ID in the *old* map and seeing if this child used to have a
// different parent.
var possiblyMovedElement = oldNodeMap[newChild.tagID];
if (possiblyMovedElement &&
newParent.tagID !== getParentID(possiblyMovedElement)) {
newEdit = {
type: "elementMove",
tagID: newChild.tagID,
parentID: newChild.parent.tagID
};
moves.push(newEdit.tagID);
newEdits.push(newEdit);
// this element in the new tree was a move to this spot, so we can move
// on to the next child in the new tree.
newIndex++;
return true;
}
return false;
};
/**
* Looks to see if the element in the old tree has moved by checking its
* current and former parents.
*
* @return {boolean} true if the element has moved
*/
var hasMoved = function (oldChild) {
var oldChildInNewTree = newNodeMap[oldChild.tagID];
return oldChild.children && oldChildInNewTree && getParentID(oldChild) !== getParentID(oldChildInNewTree);
};
// Loop through the current and old children, comparing them one by one.
while (newIndex < newChildren.length && oldIndex < oldChildren.length) {
newChild = newChildren[newIndex];
// Check to see if the currentChild has been reparented from somewhere
// else in the old tree
if (newChild.children && addElementMove()) {
continue;
}
oldChild = oldChildren[oldIndex];
// Check to see if the oldChild has been moved to another parent.
// If it has, we deal with it on the other side (see above)
if (hasMoved(oldChild)) {
oldIndex++;
continue;
}
if (newChild.isElement() || oldChild.isElement()) {
if (newChild.isElement() && oldChild.isText()) {
addTextDelete();
// If this element is new, add it and move to the next child
// in the current tree. Otherwise, we'll compare this same
// current element with the next old element on the next pass
// through the loop.
addElementInsert();
} else if (oldChild.isElement() && newChild.isText()) {
// If the old child has *not* been deleted, we assume that we've
// inserted some text and will still encounter the old node
if (!addElementDelete()) {
addTextInsert();
}
// both children are elements
} else {
if (newChild.tagID !== oldChild.tagID) {
// First, check to see if we're deleting an element.
// If we are, get rid of that element and restart our comparison
// logic with the same element from the new tree and the next one
// from the old tree.
if (!addElementDelete()) {
// Since we're not deleting and these elements don't match up, we
// must have a new element. Add an elementInsert (and log a problem
// if no insert works.)
if (!addElementInsert()) {
console.error("HTML Instrumentation: This should not happen. Two elements have different tag IDs and there was no insert/delete. This generally means there was a reordering of elements.");
newIndex++;
oldIndex++;
}
}
// There has been no change in the tag we're looking at.
} else {
// Since this element hasn't moved, it is a suitable "beforeID"
// for the edits we've logged.
finalizeNewEdits(oldChild.tagID, false);
newIndex++;
oldIndex++;
}
}
// We know we're comparing two texts. Just match up their signatures.
} else {
if (newChild.textSignature !== oldChild.textSignature) {
newEdit = {
type: "textReplace",
content: newChild.content,
parentID: newChild.parent.tagID
};
if (textAfterID) {
newEdit.afterID = textAfterID;
}
newEdits.push(newEdit);
}
// Either we've done a text replace or both sides matched. In either
// case we're ready to move forward among both the old and new children.
newIndex++;
oldIndex++;
}
}
// At this point, we've used up all of the children in at least one of the
// two sets of children.
/**
* Take care of any remaining children in the old tree.
*/
while (oldIndex < oldChildren.length) {
oldChild = oldChildren[oldIndex];
// Check for an element that has moved
if (hasMoved(oldChild)) {
// This element has moved, so we skip it on this side (the move
// is handled on the new tree side).
oldIndex++;
// is this an element? if so, delete it
} else if (oldChild.isElement()) {
if (!addElementDelete()) {
console.error("HTML Instrumentation: failed to add elementDelete for remaining element in the original DOM. This should not happen.", oldChild);
oldIndex++;
}
// must be text. delete that.
} else {
addTextDelete();
}
}
/**
* Take care of the remaining children in the new tree.
*/
while (newIndex < newChildren.length) {
newChild = newChildren[newIndex];
// Is this an element?
if (newChild.isElement()) {
// Look to see if the element has moved here.
if (!addElementMove()) {
// Not a move, so we insert this element.
if (!addElementInsert()) {
console.error("HTML Instrumentation: failed to add elementInsert for remaining element in the updated DOM. This should not happen.");
newIndex++;
}
}
// not a new element, so it must be new text.
} else {
addTextInsert();
}
}
/**
* Finalize remaining edits. For inserts and moves, we can set the `lastChild`
* flag and the browser can simply use `appendChild` to add these items.
*/
newEdits.forEach(function (edit) {
if (edit.type === "textInsert" || edit.type === "elementInsert" || edit.type === "elementMove") {
edit.lastChild = true;
delete edit.firstChild;
delete edit.afterID;
}
});
edits.push.apply(edits, newEdits);
return {
edits: edits,
moves: moves,
newElements: newElements
};
} | [
"function",
"(",
"oldParent",
",",
"oldNodeMap",
",",
"newParent",
",",
"newNodeMap",
")",
"{",
"/*jslint continue: true */",
"var",
"newIndex",
"=",
"0",
",",
"oldIndex",
"=",
"0",
",",
"newChildren",
"=",
"newParent",
".",
"children",
",",
"oldChildren",
"="... | @private
When the main loop (see below) determines that something has changed with
an element's immediate children, it calls this function to create edit
operations for those changes.
This adds to the edit list in place and does not return anything.
@param {?Object} oldParent SimpleDOM node for the previous state of this element, null/undefined if the element is new
@param {Object} newParent SimpleDOM node for the current state of the element | [
"@private"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/language/HTMLDOMDiff.js#L92-L514 | train | This function is called by the editManager when an item is being deleted. It is called after the item is deleted. | [
30522,
3853,
1006,
2214,
19362,
4765,
1010,
2214,
3630,
3207,
2863,
2361,
1010,
2047,
19362,
4765,
1010,
2047,
3630,
3207,
30524,
1012,
2336,
1010,
2214,
19339,
7389,
1027,
2214,
19362,
4765,
1029,
2214,
19362,
4765,
1012,
2336,
1024,
1031,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
adobe/brackets | src/widgets/PopUpManager.js | removePopUp | function removePopUp($popUp) {
// check visible first to help protect against recursive calls
// via removeHandler
if ($popUp.find(":visible").length > 0) {
var removeHandler = $popUp.data("PopUpManager-removeHandler");
if (removeHandler) {
removeHandler();
}
}
// check index after removeHandler is done processing to protect
// against recursive calls
var index = _popUps.indexOf($popUp[0]);
if (index >= 0) {
var autoRemove = $popUp.data("PopUpManager-autoRemove");
if (autoRemove) {
$popUp.remove();
_popUps.splice(index, 1);
}
}
} | javascript | function removePopUp($popUp) {
// check visible first to help protect against recursive calls
// via removeHandler
if ($popUp.find(":visible").length > 0) {
var removeHandler = $popUp.data("PopUpManager-removeHandler");
if (removeHandler) {
removeHandler();
}
}
// check index after removeHandler is done processing to protect
// against recursive calls
var index = _popUps.indexOf($popUp[0]);
if (index >= 0) {
var autoRemove = $popUp.data("PopUpManager-autoRemove");
if (autoRemove) {
$popUp.remove();
_popUps.splice(index, 1);
}
}
} | [
"function",
"removePopUp",
"(",
"$popUp",
")",
"{",
"// check visible first to help protect against recursive calls",
"// via removeHandler",
"if",
"(",
"$popUp",
".",
"find",
"(",
"\":visible\"",
")",
".",
"length",
">",
"0",
")",
"{",
"var",
"removeHandler",
"=",
... | Remove Esc key handling for a pop-up. Removes the pop-up from the DOM
if the pop-up is currently visible and was not originally attached.
@param {!jQuery} $popUp | [
"Remove",
"Esc",
"key",
"handling",
"for",
"a",
"pop",
"-",
"up",
".",
"Removes",
"the",
"pop",
"-",
"up",
"from",
"the",
"DOM",
"if",
"the",
"pop",
"-",
"up",
"is",
"currently",
"visible",
"and",
"was",
"not",
"originally",
"attached",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/widgets/PopUpManager.js#L61-L81 | train | removePopUp - removes the popup from the list | [
30522,
3853,
6366,
16340,
6279,
1006,
1002,
3769,
6279,
1007,
1063,
1013,
1013,
4638,
5710,
2034,
2000,
2393,
4047,
2114,
28667,
9236,
3512,
4455,
1013,
1013,
3081,
6366,
11774,
3917,
2065,
1006,
1002,
3769,
6279,
1012,
2424,
1006,
1000,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SeleniumHQ/selenium | third_party/js/mozmill/shared-modules/addons.js | addonsManager_waitForSearchFinished | function addonsManager_waitForSearchFinished(aSpec) {
var spec = aSpec || { };
var timeout = (spec.timeout == undefined) ? TIMEOUT_SEARCH : spec.timeout;
// TODO: restore after 1.5.1 has landed
// var self = this;
//
// mozmill.utils.waitFor(function () {
// return self.isSearching == false;
// }, timeout, 100, "Search has been finished");
mozmill.utils.waitForEval("subject.isSearching == false",
timeout, 100, this);
} | javascript | function addonsManager_waitForSearchFinished(aSpec) {
var spec = aSpec || { };
var timeout = (spec.timeout == undefined) ? TIMEOUT_SEARCH : spec.timeout;
// TODO: restore after 1.5.1 has landed
// var self = this;
//
// mozmill.utils.waitFor(function () {
// return self.isSearching == false;
// }, timeout, 100, "Search has been finished");
mozmill.utils.waitForEval("subject.isSearching == false",
timeout, 100, this);
} | [
"function",
"addonsManager_waitForSearchFinished",
"(",
"aSpec",
")",
"{",
"var",
"spec",
"=",
"aSpec",
"||",
"{",
"}",
";",
"var",
"timeout",
"=",
"(",
"spec",
".",
"timeout",
"==",
"undefined",
")",
"?",
"TIMEOUT_SEARCH",
":",
"spec",
".",
"timeout",
";"... | Waits until the active search has been finished
@param {object} aSpec
Object with parameters for customization
Elements: timeout - Duration to wait for the target state | [
"Waits",
"until",
"the",
"active",
"search",
"has",
"been",
"finished"
] | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/addons.js#L975-L988 | train | Wait until the search has been finished | [
30522,
3853,
5587,
5644,
24805,
4590,
1035,
3524,
29278,
17310,
11140,
16294,
13295,
1006,
2004,
5051,
2278,
1007,
1063,
13075,
28699,
1027,
2004,
5051,
2278,
1064,
1064,
1063,
1065,
1025,
13075,
2051,
5833,
1027,
1006,
28699,
1012,
2051,
5... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/extensions/default/HealthData/HealthDataPreview.js | previewHealthData | function previewHealthData() {
var result = new $.Deferred();
HealthDataManager.getHealthData().done(function (healthDataObject) {
var combinedHealthAnalyticsData = HealthDataManager.getAnalyticsData(),
content;
combinedHealthAnalyticsData = [healthDataObject, combinedHealthAnalyticsData ];
content = JSON.stringify(combinedHealthAnalyticsData, null, 4);
content = _.escape(content);
content = content.replace(/ /g, " ");
content = content.replace(/(?:\r\n|\r|\n)/g, "<br />");
var hdPref = prefs.get("healthDataTracking"),
template = Mustache.render(HealthDataPreviewDialog, {Strings: Strings, content: content, hdPref: hdPref}),
$template = $(template);
Dialogs.addLinkTooltips($template);
Dialogs.showModalDialogUsingTemplate($template).done(function (id) {
if (id === "save") {
var newHDPref = $template.find("[data-target]:checkbox").is(":checked");
if (hdPref !== newHDPref) {
prefs.set("healthDataTracking", newHDPref);
}
}
});
return result.resolve();
});
return result.promise();
} | javascript | function previewHealthData() {
var result = new $.Deferred();
HealthDataManager.getHealthData().done(function (healthDataObject) {
var combinedHealthAnalyticsData = HealthDataManager.getAnalyticsData(),
content;
combinedHealthAnalyticsData = [healthDataObject, combinedHealthAnalyticsData ];
content = JSON.stringify(combinedHealthAnalyticsData, null, 4);
content = _.escape(content);
content = content.replace(/ /g, " ");
content = content.replace(/(?:\r\n|\r|\n)/g, "<br />");
var hdPref = prefs.get("healthDataTracking"),
template = Mustache.render(HealthDataPreviewDialog, {Strings: Strings, content: content, hdPref: hdPref}),
$template = $(template);
Dialogs.addLinkTooltips($template);
Dialogs.showModalDialogUsingTemplate($template).done(function (id) {
if (id === "save") {
var newHDPref = $template.find("[data-target]:checkbox").is(":checked");
if (hdPref !== newHDPref) {
prefs.set("healthDataTracking", newHDPref);
}
}
});
return result.resolve();
});
return result.promise();
} | [
"function",
"previewHealthData",
"(",
")",
"{",
"var",
"result",
"=",
"new",
"$",
".",
"Deferred",
"(",
")",
";",
"HealthDataManager",
".",
"getHealthData",
"(",
")",
".",
"done",
"(",
"function",
"(",
"healthDataObject",
")",
"{",
"var",
"combinedHealthAnal... | Show the dialog for previewing the Health Data that will be sent. | [
"Show",
"the",
"dialog",
"for",
"previewing",
"the",
"Health",
"Data",
"that",
"will",
"be",
"sent",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/HealthData/HealthDataPreview.js#L44-L76 | train | Preview health data | [
30522,
3853,
19236,
20192,
24658,
2850,
2696,
1006,
1007,
1063,
13075,
2765,
1027,
2047,
1002,
1012,
13366,
28849,
2094,
1006,
1007,
1025,
2740,
2850,
28282,
27031,
2099,
1012,
2131,
20192,
24658,
2850,
2696,
1006,
1007,
1012,
2589,
1006,
3... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
chriso/validator.js | lib/isMimeType.js | isMimeType | function isMimeType(str) {
(0, _assertString.default)(str);
return mimeTypeSimple.test(str) || mimeTypeText.test(str) || mimeTypeMultipart.test(str);
} | javascript | function isMimeType(str) {
(0, _assertString.default)(str);
return mimeTypeSimple.test(str) || mimeTypeText.test(str) || mimeTypeMultipart.test(str);
} | [
"function",
"isMimeType",
"(",
"str",
")",
"{",
"(",
"0",
",",
"_assertString",
".",
"default",
")",
"(",
"str",
")",
";",
"return",
"mimeTypeSimple",
".",
"test",
"(",
"str",
")",
"||",
"mimeTypeText",
".",
"test",
"(",
"str",
")",
"||",
"mimeTypeMult... | eslint-disable-line max-len | [
"eslint",
"-",
"disable",
"-",
"line",
"max",
"-",
"len"
] | 63e4c78f07d08543af4be7b6c2c9cf24df009003 | https://github.com/chriso/validator.js/blob/63e4c78f07d08543af4be7b6c2c9cf24df009003/lib/isMimeType.js#L45-L48 | train | Check if the string is a mime type | [
30522,
3853,
2003,
4328,
11368,
18863,
1006,
2358,
2099,
1007,
1063,
1006,
1014,
1010,
1035,
19514,
18886,
3070,
1012,
12398,
1007,
1006,
2358,
2099,
1007,
1025,
2709,
2771,
11368,
18863,
5332,
23344,
1012,
3231,
1006,
2358,
2099,
1007,
106... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
GeekyAnts/vue-native-core | dist/vue.runtime.common.js | createFunctionalComponent | function createFunctionalComponent (
Ctor,
propsData,
data,
context,
children
) {
var props = {};
var propOptions = Ctor.options.props;
if (isDef(propOptions)) {
for (var key in propOptions) {
props[key] = validateProp(key, propOptions, propsData);
}
} else {
if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
if (isDef(data.props)) { mergeProps(props, data.props); }
}
// ensure the createElement function in functional components
// gets a unique context - this is necessary for correct named slot check
var _context = Object.create(context);
var h = function (a, b, c, d) { return createElement(_context, a, b, c, d, true); };
var vnode = Ctor.options.render.call(null, h, {
data: data,
props: props,
children: children,
parent: context,
listeners: data.on || {},
injections: resolveInject(Ctor.options.inject, context),
slots: function () { return resolveSlots(children, context); }
});
if (vnode instanceof VNode) {
vnode.functionalContext = context;
if (data.slot) {
(vnode.data || (vnode.data = {})).slot = data.slot;
}
}
return vnode
} | javascript | function createFunctionalComponent (
Ctor,
propsData,
data,
context,
children
) {
var props = {};
var propOptions = Ctor.options.props;
if (isDef(propOptions)) {
for (var key in propOptions) {
props[key] = validateProp(key, propOptions, propsData);
}
} else {
if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
if (isDef(data.props)) { mergeProps(props, data.props); }
}
// ensure the createElement function in functional components
// gets a unique context - this is necessary for correct named slot check
var _context = Object.create(context);
var h = function (a, b, c, d) { return createElement(_context, a, b, c, d, true); };
var vnode = Ctor.options.render.call(null, h, {
data: data,
props: props,
children: children,
parent: context,
listeners: data.on || {},
injections: resolveInject(Ctor.options.inject, context),
slots: function () { return resolveSlots(children, context); }
});
if (vnode instanceof VNode) {
vnode.functionalContext = context;
if (data.slot) {
(vnode.data || (vnode.data = {})).slot = data.slot;
}
}
return vnode
} | [
"function",
"createFunctionalComponent",
"(",
"Ctor",
",",
"propsData",
",",
"data",
",",
"context",
",",
"children",
")",
"{",
"var",
"props",
"=",
"{",
"}",
";",
"var",
"propOptions",
"=",
"Ctor",
".",
"options",
".",
"props",
";",
"if",
"(",
"isDef",
... | /* | [
"/",
"*"
] | a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e | https://github.com/GeekyAnts/vue-native-core/blob/a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e/dist/vue.runtime.common.js#L3057-L3094 | train | Creates a functional component | [
30522,
3853,
3443,
11263,
27989,
2389,
9006,
29513,
3372,
1006,
14931,
2953,
1010,
24387,
2850,
2696,
1010,
2951,
1010,
6123,
1010,
2336,
1007,
1063,
13075,
24387,
1027,
1063,
1065,
1025,
13075,
17678,
7361,
9285,
1027,
14931,
2953,
1012,
7... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.m/src/sap/m/IconTabBarDragAndDropUtil.js | function (oDraggedControl, iKeyCode) {
var $DraggedControl = oDraggedControl.$(),
aItems = this.getItems(),
iBeginDragIndex = this.indexOfItem(oDraggedControl),
bRtl = sap.ui.getCore().getConfiguration().getRTL(),
iNewDropIndex,
$DroppedControl,
oKeyCodes = KeyCodes;
switch (iKeyCode) {
//Handles Ctrl + Home
case oKeyCodes.HOME:
iNewDropIndex = 0;
sInsertAfterBeforePosition = INSERT_BEFORE;
break;
//Handles Ctrl + End
case oKeyCodes.END:
iNewDropIndex = aItems.length - 1;
sInsertAfterBeforePosition = INSERT_AFTER;
break;
// Handles Ctrl + Left Arrow
case oKeyCodes.ARROW_LEFT:
if (bRtl) {
iNewDropIndex = IconTabBarDragAndDropUtil._increaseDropIndex(iBeginDragIndex, aItems.length);
} else {
iNewDropIndex = IconTabBarDragAndDropUtil._decreaseDropIndex(iBeginDragIndex);
}
break;
// Handles Ctrl + Right Arrow
case oKeyCodes.ARROW_RIGHT:
if (bRtl) {
iNewDropIndex = IconTabBarDragAndDropUtil._decreaseDropIndex(iBeginDragIndex);
} else {
iNewDropIndex = IconTabBarDragAndDropUtil._increaseDropIndex(iBeginDragIndex, aItems.length);
}
break;
// Handles Ctrl + Arrow Down
case oKeyCodes.ARROW_DOWN:
iNewDropIndex = IconTabBarDragAndDropUtil._increaseDropIndex(iBeginDragIndex, aItems.length);
break;
// Handles Ctrl + Arrow Up
case oKeyCodes.ARROW_UP:
iNewDropIndex = IconTabBarDragAndDropUtil._decreaseDropIndex(iBeginDragIndex);
break;
default:
return;
}
$DroppedControl = aItems[iNewDropIndex].$();
IconTabBarDragAndDropUtil._insertControl(sInsertAfterBeforePosition, $DraggedControl, $DroppedControl);
IconTabBarDragAndDropUtil._handleConfigurationAfterDragAndDrop.call(this, oDraggedControl, iNewDropIndex);
return true;
} | javascript | function (oDraggedControl, iKeyCode) {
var $DraggedControl = oDraggedControl.$(),
aItems = this.getItems(),
iBeginDragIndex = this.indexOfItem(oDraggedControl),
bRtl = sap.ui.getCore().getConfiguration().getRTL(),
iNewDropIndex,
$DroppedControl,
oKeyCodes = KeyCodes;
switch (iKeyCode) {
//Handles Ctrl + Home
case oKeyCodes.HOME:
iNewDropIndex = 0;
sInsertAfterBeforePosition = INSERT_BEFORE;
break;
//Handles Ctrl + End
case oKeyCodes.END:
iNewDropIndex = aItems.length - 1;
sInsertAfterBeforePosition = INSERT_AFTER;
break;
// Handles Ctrl + Left Arrow
case oKeyCodes.ARROW_LEFT:
if (bRtl) {
iNewDropIndex = IconTabBarDragAndDropUtil._increaseDropIndex(iBeginDragIndex, aItems.length);
} else {
iNewDropIndex = IconTabBarDragAndDropUtil._decreaseDropIndex(iBeginDragIndex);
}
break;
// Handles Ctrl + Right Arrow
case oKeyCodes.ARROW_RIGHT:
if (bRtl) {
iNewDropIndex = IconTabBarDragAndDropUtil._decreaseDropIndex(iBeginDragIndex);
} else {
iNewDropIndex = IconTabBarDragAndDropUtil._increaseDropIndex(iBeginDragIndex, aItems.length);
}
break;
// Handles Ctrl + Arrow Down
case oKeyCodes.ARROW_DOWN:
iNewDropIndex = IconTabBarDragAndDropUtil._increaseDropIndex(iBeginDragIndex, aItems.length);
break;
// Handles Ctrl + Arrow Up
case oKeyCodes.ARROW_UP:
iNewDropIndex = IconTabBarDragAndDropUtil._decreaseDropIndex(iBeginDragIndex);
break;
default:
return;
}
$DroppedControl = aItems[iNewDropIndex].$();
IconTabBarDragAndDropUtil._insertControl(sInsertAfterBeforePosition, $DraggedControl, $DroppedControl);
IconTabBarDragAndDropUtil._handleConfigurationAfterDragAndDrop.call(this, oDraggedControl, iNewDropIndex);
return true;
} | [
"function",
"(",
"oDraggedControl",
",",
"iKeyCode",
")",
"{",
"var",
"$DraggedControl",
"=",
"oDraggedControl",
".",
"$",
"(",
")",
",",
"aItems",
"=",
"this",
".",
"getItems",
"(",
")",
",",
"iBeginDragIndex",
"=",
"this",
".",
"indexOfItem",
"(",
"oDrag... | Moves focused control depending on the combinations of pressed keys.
@param {object} oDraggedControl Control that is going to be moved
@param {number} iKeyCode Key code
@returns {boolean} returns true is scrolling will be needed | [
"Moves",
"focused",
"control",
"depending",
"on",
"the",
"combinations",
"of",
"pressed",
"keys",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/IconTabBarDragAndDropUtil.js#L143-L196 | train | Handles the key event on the drop control | [
30522,
3853,
1006,
1051,
7265,
15567,
8663,
13181,
2140,
1010,
25209,
2100,
16044,
1007,
1063,
13075,
1002,
7944,
8663,
13181,
2140,
1027,
1051,
7265,
15567,
8663,
13181,
2140,
1012,
1002,
1006,
1007,
1010,
9932,
18532,
2015,
1027,
2023,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | src/sap.ui.core/src/sap/ui/core/util/XMLPreprocessor.js | function (sPath) {
var oBindingInfo,
oModel,
sResolvedPath;
sPath = sPath || "";
if (sPath[0] === "{") {
throw new Error("Must be a simple path, not a binding: " + sPath);
}
oBindingInfo = BindingParser.simpleParser("{" + sPath + "}");
oModel = oWithControl.getModel(oBindingInfo.model);
if (!oModel) {
throw new Error("Unknown model '" + oBindingInfo.model + "': " + sPath);
}
sResolvedPath = oModel.resolve(oBindingInfo.path,
oWithControl.getBindingContext(oBindingInfo.model));
if (!sResolvedPath) {
throw new Error("Cannot resolve path: " + sPath);
}
return oModel.createBindingContext(sResolvedPath);
} | javascript | function (sPath) {
var oBindingInfo,
oModel,
sResolvedPath;
sPath = sPath || "";
if (sPath[0] === "{") {
throw new Error("Must be a simple path, not a binding: " + sPath);
}
oBindingInfo = BindingParser.simpleParser("{" + sPath + "}");
oModel = oWithControl.getModel(oBindingInfo.model);
if (!oModel) {
throw new Error("Unknown model '" + oBindingInfo.model + "': " + sPath);
}
sResolvedPath = oModel.resolve(oBindingInfo.path,
oWithControl.getBindingContext(oBindingInfo.model));
if (!sResolvedPath) {
throw new Error("Cannot resolve path: " + sPath);
}
return oModel.createBindingContext(sResolvedPath);
} | [
"function",
"(",
"sPath",
")",
"{",
"var",
"oBindingInfo",
",",
"oModel",
",",
"sResolvedPath",
";",
"sPath",
"=",
"sPath",
"||",
"\"\"",
";",
"if",
"(",
"sPath",
"[",
"0",
"]",
"===",
"\"{\"",
")",
"{",
"throw",
"new",
"Error",
"(",
"\"Must be a simpl... | Returns the model's context which corresponds to the given simple binding
path. Uses the map of currently known variables.
@param {string} [sPath=""]
A simple binding path which may include a model name ("a variable"), for
example "var>some/relative/path", but not a binding ("{...}")
@returns {sap.ui.model.Context}
The corresponding context which holds the model and the resolved, absolute
path
@throws {Error}
If a binding is given, if the path refers to an unknown model, or if the
path cannot be resolved (typically because a relative path was given for a
model without a binding context) | [
"Returns",
"the",
"model",
"s",
"context",
"which",
"corresponds",
"to",
"the",
"given",
"simple",
"binding",
"path",
".",
"Uses",
"the",
"map",
"of",
"currently",
"known",
"variables",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/util/XMLPreprocessor.js#L667-L687 | train | Returns a binding context for the given path. | [
30522,
3853,
1006,
14690,
2232,
1007,
1063,
13075,
27885,
22254,
2075,
2378,
14876,
1010,
18168,
10244,
2140,
1010,
5034,
2229,
16116,
15069,
1025,
14690,
2232,
1027,
14690,
2232,
1064,
1064,
1000,
1000,
1025,
2065,
1006,
14690,
2232,
1031,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
Shopify/draggable | src/Sortable/Sortable.js | onSortableSortedDefaultAnnouncement | function onSortableSortedDefaultAnnouncement({dragEvent}) {
const sourceText = dragEvent.source.textContent.trim() || dragEvent.source.id || 'sortable element';
if (dragEvent.over) {
const overText = dragEvent.over.textContent.trim() || dragEvent.over.id || 'sortable element';
const isFollowing = dragEvent.source.compareDocumentPosition(dragEvent.over) & Node.DOCUMENT_POSITION_FOLLOWING;
if (isFollowing) {
return `Placed ${sourceText} after ${overText}`;
} else {
return `Placed ${sourceText} before ${overText}`;
}
} else {
// need to figure out how to compute container name
return `Placed ${sourceText} into a different container`;
}
} | javascript | function onSortableSortedDefaultAnnouncement({dragEvent}) {
const sourceText = dragEvent.source.textContent.trim() || dragEvent.source.id || 'sortable element';
if (dragEvent.over) {
const overText = dragEvent.over.textContent.trim() || dragEvent.over.id || 'sortable element';
const isFollowing = dragEvent.source.compareDocumentPosition(dragEvent.over) & Node.DOCUMENT_POSITION_FOLLOWING;
if (isFollowing) {
return `Placed ${sourceText} after ${overText}`;
} else {
return `Placed ${sourceText} before ${overText}`;
}
} else {
// need to figure out how to compute container name
return `Placed ${sourceText} into a different container`;
}
} | [
"function",
"onSortableSortedDefaultAnnouncement",
"(",
"{",
"dragEvent",
"}",
")",
"{",
"const",
"sourceText",
"=",
"dragEvent",
".",
"source",
".",
"textContent",
".",
"trim",
"(",
")",
"||",
"dragEvent",
".",
"source",
".",
"id",
"||",
"'sortable element'",
... | Returns announcement message when a Draggable element has been sorted with another Draggable element
or moved into a new container
@param {SortableSortedEvent} sortableEvent
@return {String} | [
"Returns",
"announcement",
"message",
"when",
"a",
"Draggable",
"element",
"has",
"been",
"sorted",
"with",
"another",
"Draggable",
"element",
"or",
"moved",
"into",
"a",
"new",
"container"
] | ecc04b2cdb8b5009664862472ff8cb237c38cfeb | https://github.com/Shopify/draggable/blob/ecc04b2cdb8b5009664862472ff8cb237c38cfeb/src/Sortable/Sortable.js#L15-L31 | train | This function is called when the element is sorted in the sortable order | [
30522,
3853,
2006,
21748,
10880,
21748,
3064,
3207,
7011,
11314,
11639,
23709,
3401,
3672,
1006,
1063,
8011,
18697,
3372,
1065,
1007,
1063,
9530,
3367,
3120,
18209,
1027,
8011,
18697,
3372,
1012,
3120,
1012,
3793,
8663,
6528,
2102,
1012,
12... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/ui5loader.js | normalize | function normalize(sResourceName, sBaseName) {
var p = sResourceName.search(rDotSegmentAnywhere),
aSegments,
sSegment,
i,j,l;
// check whether the name needs to be resolved at all - if not, just return the sModuleName as it is.
if ( p < 0 ) {
return sResourceName;
}
// if the name starts with a relative segment then there must be a base name (a global sap.ui.require doesn't support relative names)
if ( p === 0 ) {
if ( sBaseName == null ) {
throw new Error("relative name not supported ('" + sResourceName + "'");
}
// prefix module name with the parent package
sResourceName = sBaseName.slice(0, sBaseName.lastIndexOf('/') + 1) + sResourceName;
}
aSegments = sResourceName.split('/');
// process path segments
for (i = 0, j = 0, l = aSegments.length; i < l; i++) {
sSegment = aSegments[i];
if ( rDotSegment.test(sSegment) ) {
if (sSegment === '.' || sSegment === '') {
// ignore '.' as it's just a pointer to current package. ignore '' as it results from double slashes (ignored by browsers as well)
continue;
} else if (sSegment === '..') {
// move to parent directory
if ( j === 0 ) {
throw new Error("Can't navigate to parent of root ('" + sResourceName + "')");
}
j--;
} else {
throw new Error("Illegal path segment '" + sSegment + "' ('" + sResourceName + "')");
}
} else {
aSegments[j++] = sSegment;
}
}
aSegments.length = j;
return aSegments.join('/');
} | javascript | function normalize(sResourceName, sBaseName) {
var p = sResourceName.search(rDotSegmentAnywhere),
aSegments,
sSegment,
i,j,l;
// check whether the name needs to be resolved at all - if not, just return the sModuleName as it is.
if ( p < 0 ) {
return sResourceName;
}
// if the name starts with a relative segment then there must be a base name (a global sap.ui.require doesn't support relative names)
if ( p === 0 ) {
if ( sBaseName == null ) {
throw new Error("relative name not supported ('" + sResourceName + "'");
}
// prefix module name with the parent package
sResourceName = sBaseName.slice(0, sBaseName.lastIndexOf('/') + 1) + sResourceName;
}
aSegments = sResourceName.split('/');
// process path segments
for (i = 0, j = 0, l = aSegments.length; i < l; i++) {
sSegment = aSegments[i];
if ( rDotSegment.test(sSegment) ) {
if (sSegment === '.' || sSegment === '') {
// ignore '.' as it's just a pointer to current package. ignore '' as it results from double slashes (ignored by browsers as well)
continue;
} else if (sSegment === '..') {
// move to parent directory
if ( j === 0 ) {
throw new Error("Can't navigate to parent of root ('" + sResourceName + "')");
}
j--;
} else {
throw new Error("Illegal path segment '" + sSegment + "' ('" + sResourceName + "')");
}
} else {
aSegments[j++] = sSegment;
}
}
aSegments.length = j;
return aSegments.join('/');
} | [
"function",
"normalize",
"(",
"sResourceName",
",",
"sBaseName",
")",
"{",
"var",
"p",
"=",
"sResourceName",
".",
"search",
"(",
"rDotSegmentAnywhere",
")",
",",
"aSegments",
",",
"sSegment",
",",
"i",
",",
"j",
",",
"l",
";",
"// check whether the name needs ... | Normalizes a resource name by resolving any relative name segments.
A segment consisting of a single dot <code>./</code>, when used at the beginning of a name refers
to the containing package of the <code>sBaseName</code>. When used inside a name, it is ignored.
A segment consisting of two dots <code>../</code> refers to the parent package. It can be used
anywhere in a name, but the resolved name prefix up to that point must not be empty.
Example: A name <code>../common/validation.js</code> defined in <code>sap/myapp/controller/mycontroller.controller.js</code>
will resolve to <code>sap/myapp/common/validation.js</code>.
When <code>sBaseName</code> is <code>null</code> (e.g. for a <code>sap.ui.require</code> call),
the resource name must not start with a relative name segment or an error will be thrown.
@param {string} sResourceName Name to resolve
@param {string|null} sBaseName Name of a reference module relative to which the name will be resolved
@returns {string} Resolved name
@throws {Error} When a relative name should be resolved but not basename is given;
or when upward navigation (../) is requested on the root level
or when a name segment consists of 3 or more dots only
@private | [
"Normalizes",
"a",
"resource",
"name",
"by",
"resolving",
"any",
"relative",
"name",
"segments",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/ui5loader.js#L431-L481 | train | Normalizes the given resource name to a relative name. | [
30522,
3853,
3671,
4697,
1006,
5034,
2229,
8162,
27524,
14074,
1010,
24829,
11022,
18442,
1007,
1063,
13075,
1052,
1027,
5034,
2229,
8162,
27524,
14074,
1012,
3945,
1006,
16428,
12868,
13910,
3672,
19092,
2860,
5886,
2063,
1007,
1010,
2004,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
reasonml/reason-react | migrate/from02xTo024.js | migrate | function migrate(files) {
files.forEach((file) => {
let content;
try {
content = fs.readFileSync(file, {encoding: 'utf-8'});
} catch (e) {
console.error(`\u{1b}[31mProblem reading ${file}: ${e.message}\u{1b}[39m`);
process.exit(1);
}
const result = transform(content);
const hasSilentUpdate = result[0];
const hasSelfUpdate = result[1];
const hasSelfEnqueue = result[2];
const newContent = result[3];
if (newContent !== content) {
console.log('Found a file that has things to migrate: ' + file);
fs.writeFileSync(file, newContent, {encoding: 'utf-8'});
}
if (hasSilentUpdate) {
filesWithSilentUpdate.push(file);
}
if (hasSelfUpdate) {
filesWithSelfUpdate.push(file);
}
if (hasSelfEnqueue) {
filesWithSelfEnqueue.push(file);
}
});
if (filesWithSilentUpdate.length !== 0) {
console.log(`\u{1b}[36m
The follow files have \`SilentUpdate\`:
\u{1b}[39m`);
console.log(filesWithSilentUpdate.map(f => '- ' + f).join('\n'));
console.log(`\u{1b}[36m
In most cases this isn\'t what you want. Please change it to ref cells on state: https://reasonml.github.io/reason-react/docs/en/instance-variables.html
\u{1b}[39m`);
}
if (filesWithSelfUpdate.length !== 0) {
console.log(`\u{1b}[36m
The follow files mention \`update\`. We aren't sure whether they refer to \`self.update\`, so we didn't touch them. If they are, please replace them with \`reduce\`:
\u{1b}[39m`);
console.log(filesWithSelfUpdate.map(f => '- ' + f).join('\n'));
}
if (filesWithSelfEnqueue.length !== 0) {
console.log(`\u{1b}[36m
The follow files mention \`enqueue\`. We aren't sure whether they refer to \`self.enqueue\`, so we didn't touch them. If they are, please replace them with \`reduce\`:
\u{1b}[39m`);
console.log(filesWithSelfEnqueue.map(f => '- ' + f).join('\n'));
}
} | javascript | function migrate(files) {
files.forEach((file) => {
let content;
try {
content = fs.readFileSync(file, {encoding: 'utf-8'});
} catch (e) {
console.error(`\u{1b}[31mProblem reading ${file}: ${e.message}\u{1b}[39m`);
process.exit(1);
}
const result = transform(content);
const hasSilentUpdate = result[0];
const hasSelfUpdate = result[1];
const hasSelfEnqueue = result[2];
const newContent = result[3];
if (newContent !== content) {
console.log('Found a file that has things to migrate: ' + file);
fs.writeFileSync(file, newContent, {encoding: 'utf-8'});
}
if (hasSilentUpdate) {
filesWithSilentUpdate.push(file);
}
if (hasSelfUpdate) {
filesWithSelfUpdate.push(file);
}
if (hasSelfEnqueue) {
filesWithSelfEnqueue.push(file);
}
});
if (filesWithSilentUpdate.length !== 0) {
console.log(`\u{1b}[36m
The follow files have \`SilentUpdate\`:
\u{1b}[39m`);
console.log(filesWithSilentUpdate.map(f => '- ' + f).join('\n'));
console.log(`\u{1b}[36m
In most cases this isn\'t what you want. Please change it to ref cells on state: https://reasonml.github.io/reason-react/docs/en/instance-variables.html
\u{1b}[39m`);
}
if (filesWithSelfUpdate.length !== 0) {
console.log(`\u{1b}[36m
The follow files mention \`update\`. We aren't sure whether they refer to \`self.update\`, so we didn't touch them. If they are, please replace them with \`reduce\`:
\u{1b}[39m`);
console.log(filesWithSelfUpdate.map(f => '- ' + f).join('\n'));
}
if (filesWithSelfEnqueue.length !== 0) {
console.log(`\u{1b}[36m
The follow files mention \`enqueue\`. We aren't sure whether they refer to \`self.enqueue\`, so we didn't touch them. If they are, please replace them with \`reduce\`:
\u{1b}[39m`);
console.log(filesWithSelfEnqueue.map(f => '- ' + f).join('\n'));
}
} | [
"function",
"migrate",
"(",
"files",
")",
"{",
"files",
".",
"forEach",
"(",
"(",
"file",
")",
"=>",
"{",
"let",
"content",
";",
"try",
"{",
"content",
"=",
"fs",
".",
"readFileSync",
"(",
"file",
",",
"{",
"encoding",
":",
"'utf-8'",
"}",
")",
";"... | entry point | [
"entry",
"point"
] | 17e4568aaa5a6d03e3f3381a60c2073dc7ac50e2 | https://github.com/reasonml/reason-react/blob/17e4568aaa5a6d03e3f3381a60c2073dc7ac50e2/migrate/from02xTo024.js#L76-L129 | train | Migrate the specified files | [
30522,
3853,
22806,
1006,
6764,
1007,
1063,
30524,
1063,
2292,
4180,
1025,
3046,
1063,
4180,
1027,
1042,
2015,
1012,
3191,
8873,
4244,
6038,
2278,
1006,
5371,
1010,
1063,
17181,
1024,
1005,
21183,
2546,
1011,
1022,
1005,
1065,
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... |
angular/material | docs/app/js/codepen.js | editOnCodepen | function editOnCodepen(demo) {
var externalScripts = $demoAngularScripts.all();
externalScripts.push('https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.22.1/moment.js');
var data = codepenDataAdapter.translate(demo, externalScripts);
var form = buildForm(data);
$document.find('body').append(form);
form[0].submit();
form.remove();
} | javascript | function editOnCodepen(demo) {
var externalScripts = $demoAngularScripts.all();
externalScripts.push('https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.22.1/moment.js');
var data = codepenDataAdapter.translate(demo, externalScripts);
var form = buildForm(data);
$document.find('body').append(form);
form[0].submit();
form.remove();
} | [
"function",
"editOnCodepen",
"(",
"demo",
")",
"{",
"var",
"externalScripts",
"=",
"$demoAngularScripts",
".",
"all",
"(",
")",
";",
"externalScripts",
".",
"push",
"(",
"'https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.22.1/moment.js'",
")",
";",
"var",
"data",
"=... | Creates a codepen from the given demo model by posting to Codepen's API using a hidden form. The hidden form is necessary to avoid a CORS issue. See http://blog.codepen.io/documentation/api/prefill | [
"Creates",
"a",
"codepen",
"from",
"the",
"given",
"demo",
"model",
"by",
"posting",
"to",
"Codepen",
"s",
"API",
"using",
"a",
"hidden",
"form",
".",
"The",
"hidden",
"form",
"is",
"necessary",
"to",
"avoid",
"a",
"CORS",
"issue",
".",
"See",
"http",
... | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/docs/app/js/codepen.js#L21-L29 | train | edit on codepen | [
30522,
3853,
10086,
2239,
16044,
11837,
1006,
9703,
1007,
1063,
13075,
6327,
22483,
2015,
1027,
1002,
9703,
5654,
7934,
22483,
2015,
1012,
2035,
1006,
1007,
1025,
6327,
22483,
2015,
1012,
5245,
1006,
1005,
16770,
1024,
1013,
1013,
3729,
207... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
ColorlibHQ/AdminLTE | plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js | function(context) {
if (context._wysihtml5_supportsHTML5Tags) {
return;
}
for (var i=0, length=HTML5_ELEMENTS.length; i<length; i++) {
context.createElement(HTML5_ELEMENTS[i]);
}
context._wysihtml5_supportsHTML5Tags = true;
} | javascript | function(context) {
if (context._wysihtml5_supportsHTML5Tags) {
return;
}
for (var i=0, length=HTML5_ELEMENTS.length; i<length; i++) {
context.createElement(HTML5_ELEMENTS[i]);
}
context._wysihtml5_supportsHTML5Tags = true;
} | [
"function",
"(",
"context",
")",
"{",
"if",
"(",
"context",
".",
"_wysihtml5_supportsHTML5Tags",
")",
"{",
"return",
";",
"}",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"length",
"=",
"HTML5_ELEMENTS",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"... | Make sure IE supports HTML5 tags, which is accomplished by simply creating one instance of each element | [
"Make",
"sure",
"IE",
"supports",
"HTML5",
"tags",
"which",
"is",
"accomplished",
"by",
"simply",
"creating",
"one",
"instance",
"of",
"each",
"element"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js#L5405-L5413 | train | Create an element array | [
30522,
3853,
1006,
6123,
1007,
1063,
2065,
1006,
6123,
1012,
1035,
1059,
7274,
19190,
21246,
2140,
2629,
1035,
6753,
11039,
19968,
2629,
15900,
2015,
1007,
1063,
2709,
1025,
1065,
2005,
1006,
13075,
1045,
1027,
1014,
1010,
3091,
1027,
16129... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/fabSpeedDial/fabSpeedDial.js | MdFabSpeedDialDirective | function MdFabSpeedDialDirective() {
return {
restrict: 'E',
scope: {
direction: '@?mdDirection',
isOpen: '=?mdOpen'
},
bindToController: true,
controller: 'MdFabController',
controllerAs: 'vm',
link: FabSpeedDialLink
};
function FabSpeedDialLink(scope, element) {
// Prepend an element to hold our CSS variables so we can use them in the animations below
element.prepend('<div class="_md-css-variables"></div>');
}
} | javascript | function MdFabSpeedDialDirective() {
return {
restrict: 'E',
scope: {
direction: '@?mdDirection',
isOpen: '=?mdOpen'
},
bindToController: true,
controller: 'MdFabController',
controllerAs: 'vm',
link: FabSpeedDialLink
};
function FabSpeedDialLink(scope, element) {
// Prepend an element to hold our CSS variables so we can use them in the animations below
element.prepend('<div class="_md-css-variables"></div>');
}
} | [
"function",
"MdFabSpeedDialDirective",
"(",
")",
"{",
"return",
"{",
"restrict",
":",
"'E'",
",",
"scope",
":",
"{",
"direction",
":",
"'@?mdDirection'",
",",
"isOpen",
":",
"'=?mdOpen'",
"}",
",",
"bindToController",
":",
"true",
",",
"controller",
":",
"'M... | @ngdoc directive
@name mdFabSpeedDial
@module material.components.fabSpeedDial
@restrict E
@description
The `<md-fab-speed-dial>` directive is used to present a series of popup elements (usually
`<md-button>`s) for quick access to common actions.
There are currently two animations available by applying one of the following classes to
the component:
- `md-fling` - The speed dial items appear from underneath the trigger and move into their
appropriate positions.
- `md-scale` - The speed dial items appear in their proper places by scaling from 0% to 100%.
You may also easily position the trigger by applying one one of the following classes to the
`<md-fab-speed-dial>` element:
- `md-fab-top-left`
- `md-fab-top-right`
- `md-fab-bottom-left`
- `md-fab-bottom-right`
These CSS classes use `position: absolute`, so you need to ensure that the container element
also uses `position: absolute` or `position: relative` in order for them to work.
Additionally, you may use the standard `ng-mouseenter` and `ng-mouseleave` directives to
open or close the speed dial. However, if you wish to allow users to hover over the empty
space where the actions will appear, you must also add the `md-hover-full` class to the speed
dial element. Without this, the hover effect will only occur on top of the trigger.
See the demos for more information.
## Troubleshooting
If your speed dial shows the closing animation upon launch, you may need to use `ng-cloak` on
the parent container to ensure that it is only visible once ready. We have plans to remove this
necessity in the future.
@usage
<hljs lang="html">
<md-fab-speed-dial md-direction="up" class="md-fling">
<md-fab-trigger>
<md-button aria-label="Add..."><md-icon md-svg-src="/img/icons/plus.svg"></md-icon></md-button>
</md-fab-trigger>
<md-fab-actions>
<md-button aria-label="Add User">
<md-icon md-svg-src="/img/icons/user.svg"></md-icon>
</md-button>
<md-button aria-label="Add Group">
<md-icon md-svg-src="/img/icons/group.svg"></md-icon>
</md-button>
</md-fab-actions>
</md-fab-speed-dial>
</hljs>
@param {string} md-direction From which direction you would like the speed dial to appear
relative to the trigger element.
@param {expression=} md-open Programmatically control whether or not the speed-dial is visible. | [
"@ngdoc",
"directive",
"@name",
"mdFabSpeedDial",
"@module",
"material",
".",
"components",
".",
"fabSpeedDial"
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/fabSpeedDial/fabSpeedDial.js#L98-L118 | train | The md - fab - speed - dial directive | [
30522,
3853,
9108,
7011,
5910,
25599,
27184,
4305,
2890,
15277,
1006,
1007,
1063,
2709,
1063,
21573,
1024,
1005,
1041,
1005,
1010,
9531,
1024,
1063,
3257,
1024,
1005,
1030,
1029,
9108,
4305,
2890,
7542,
1005,
1010,
11163,
11837,
1024,
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... |
Dogfalo/materialize | dist/js/materialize.js | Tooltip | function Tooltip(el, options) {
_classCallCheck(this, Tooltip);
var _this26 = _possibleConstructorReturn(this, (Tooltip.__proto__ || Object.getPrototypeOf(Tooltip)).call(this, Tooltip, el, options));
_this26.el.M_Tooltip = _this26;
_this26.options = $.extend({}, Tooltip.defaults, options);
_this26.isOpen = false;
_this26.isHovered = false;
_this26.isFocused = false;
_this26._appendTooltipEl();
_this26._setupEventHandlers();
return _this26;
} | javascript | function Tooltip(el, options) {
_classCallCheck(this, Tooltip);
var _this26 = _possibleConstructorReturn(this, (Tooltip.__proto__ || Object.getPrototypeOf(Tooltip)).call(this, Tooltip, el, options));
_this26.el.M_Tooltip = _this26;
_this26.options = $.extend({}, Tooltip.defaults, options);
_this26.isOpen = false;
_this26.isHovered = false;
_this26.isFocused = false;
_this26._appendTooltipEl();
_this26._setupEventHandlers();
return _this26;
} | [
"function",
"Tooltip",
"(",
"el",
",",
"options",
")",
"{",
"_classCallCheck",
"(",
"this",
",",
"Tooltip",
")",
";",
"var",
"_this26",
"=",
"_possibleConstructorReturn",
"(",
"this",
",",
"(",
"Tooltip",
".",
"__proto__",
"||",
"Object",
".",
"getPrototypeO... | Construct Tooltip instance
@constructor
@param {Element} el
@param {Object} options | [
"Construct",
"Tooltip",
"instance"
] | 1122efadad8f1433d404696f7613e3cc13fb83a4 | https://github.com/Dogfalo/materialize/blob/1122efadad8f1433d404696f7613e3cc13fb83a4/dist/js/materialize.js#L4461-L4475 | train | Construct Tooltip instance | [
30522,
3853,
6994,
25101,
1006,
3449,
1010,
7047,
1007,
1063,
1035,
2465,
9289,
29358,
11012,
1006,
2023,
1010,
6994,
25101,
1007,
1025,
13075,
1035,
2023,
23833,
1027,
1035,
2825,
8663,
3367,
6820,
16761,
13465,
14287,
1006,
2023,
1010,
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... |
moleculerjs/moleculer | benchmark/suites/transporters.js | createBrokers | function createBrokers(transporter) {
let b1 = new ServiceBroker({
transporter,
//requestTimeout: 0,
logger: false,
//logLevel: "debug",
nodeID: "node-1"
});
let b2 = new ServiceBroker({
transporter,
//requestTimeout: 0,
logger: false,
//logLevel: "debug",
nodeID: "node-2"
});
b2.createService({
name: "echo",
actions: {
reply(ctx) {
return ctx.params;
}
}
});
return Promise.all([
b1.start(),
b2.start()
]).then(() => [b1, b2]);
} | javascript | function createBrokers(transporter) {
let b1 = new ServiceBroker({
transporter,
//requestTimeout: 0,
logger: false,
//logLevel: "debug",
nodeID: "node-1"
});
let b2 = new ServiceBroker({
transporter,
//requestTimeout: 0,
logger: false,
//logLevel: "debug",
nodeID: "node-2"
});
b2.createService({
name: "echo",
actions: {
reply(ctx) {
return ctx.params;
}
}
});
return Promise.all([
b1.start(),
b2.start()
]).then(() => [b1, b2]);
} | [
"function",
"createBrokers",
"(",
"transporter",
")",
"{",
"let",
"b1",
"=",
"new",
"ServiceBroker",
"(",
"{",
"transporter",
",",
"//requestTimeout: 0,",
"logger",
":",
"false",
",",
"//logLevel: \"debug\",",
"nodeID",
":",
"\"node-1\"",
"}",
")",
";",
"let",
... | , "150", "1k", "10k", "50k", "100k", "1M"]; | [
"150",
"1k",
"10k",
"50k",
"100k",
"1M",
"]",
";"
] | f95aadc2d61b0d0e3c643a43c3ed28bca6425cde | https://github.com/moleculerjs/moleculer/blob/f95aadc2d61b0d0e3c643a43c3ed28bca6425cde/benchmark/suites/transporters.js#L14-L44 | train | Creates a broker | [
30522,
3853,
3443,
12618,
11451,
1006,
3665,
2121,
1007,
1063,
2292,
29491,
1027,
2047,
2326,
12618,
5484,
1006,
1063,
3665,
2121,
1010,
1013,
1013,
5227,
7292,
5833,
1024,
1014,
1010,
8833,
4590,
1024,
6270,
1010,
1013,
1013,
8833,
20414,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/TableScrollExtension.js | function(mOptions, oEvent) {
var oScrollExtension = this._getScrollExtension();
var bVerticalDelta = Math.abs(oEvent.deltaY) > Math.abs(oEvent.deltaX);
var iScrollDelta = bVerticalDelta ? oEvent.deltaY : oEvent.deltaX;
var bHorizontalScrolling = bVerticalDelta && oEvent.shiftKey || !bVerticalDelta;
var bScrollingForward = iScrollDelta > 0;
var bScrolledToEnd = false;
if (iScrollDelta === 0) {
return;
}
if (bHorizontalScrolling && (mOptions.scrollDirection === ScrollDirection.HORIZONAL
|| mOptions.scrollDirection === ScrollDirection.BOTH)) {
var oHSb = oScrollExtension.getHorizontalScrollbar();
if (oEvent.deltaMode > 0 /* Not DOM_DELTA_PIXEL */) {
// For simplicity and performance reasons horizontal line and page scrolling is always performed by the distance of one minimum
// column width. To determine the real scroll distance reading from the DOM is necessary, but this should be avoided in an
// event handler.
var iMinColumnWidth = TableUtils.Column.getMinColumnWidth();
iScrollDelta = bScrollingForward ? iMinColumnWidth : -iMinColumnWidth;
}
if (bScrollingForward) {
bScrolledToEnd = oHSb.scrollLeft === oHSb.scrollWidth - oHSb.offsetWidth;
} else {
bScrolledToEnd = oHSb.scrollLeft === 0;
}
if (oScrollExtension.isHorizontalScrollbarVisible() && !bScrolledToEnd) {
oEvent.preventDefault();
oEvent.stopPropagation();
this._getKeyboardExtension().setActionMode(false);
oHSb.scrollLeft = oHSb.scrollLeft + iScrollDelta;
}
} else if (!bHorizontalScrolling && (mOptions.scrollDirection === ScrollDirection.VERTICAL
|| mOptions.scrollDirection === ScrollDirection.BOTH)) {
var oVSb = oScrollExtension.getVerticalScrollbar();
var iMaxFirstRenderedRowIndex = this._getMaxFirstRenderedRowIndex();
var bIsScrollPositionInBuffer = TableUtils.isVariableRowHeightEnabled(this)
&& this._getFirstRenderedRowIndex() === iMaxFirstRenderedRowIndex;
var nScrollRangeRowFraction = VerticalScrollingHelper.getScrollRangeRowFraction(this);
var nScrollDeltaFactor = bIsScrollPositionInBuffer ? this._getDefaultRowHeight() : nScrollRangeRowFraction;
if (oEvent.deltaMode === 1 /* DOM_DELTA_LINE */) {
iScrollDelta *= nScrollDeltaFactor;
} else if (oEvent.deltaMode === 2 /* DOM_DELTA_PAGE */) {
iScrollDelta *= nScrollDeltaFactor * this.getVisibleRowCount();
}
if (bScrollingForward) {
bScrolledToEnd = oVSb.scrollTop === oVSb.scrollHeight - oVSb.offsetHeight;
} else {
bScrolledToEnd = oVSb.scrollTop === 0;
}
if (oScrollExtension.isVerticalScrollbarVisible() && !bScrolledToEnd) {
oEvent.preventDefault();
oEvent.stopPropagation();
var nScrollPosition = VerticalScrollingHelper.getScrollPosition(this);
var nVirtualScrollPosition = nScrollPosition - (iMaxFirstRenderedRowIndex * nScrollRangeRowFraction);
var nPixelsToScroll = iScrollDelta;
if (!bIsScrollPositionInBuffer || (bIsScrollPositionInBuffer && nVirtualScrollPosition === 0 && !bScrollingForward)) {
var nRowsToScroll = iScrollDelta / (oEvent.deltaMode === 0 ? this._getDefaultRowHeight() : nScrollRangeRowFraction);
// If at least one row is scrolled, floor to full rows. Below one row, we scroll pixels.
if (nRowsToScroll > 1) {
nRowsToScroll = Math.floor(nRowsToScroll);
} else if (nRowsToScroll < -1) {
nRowsToScroll = Math.ceil(nRowsToScroll);
}
nPixelsToScroll = nRowsToScroll * nScrollRangeRowFraction;
} else if (!bScrollingForward) { // Vertical scroll position is in buffer.
if (nVirtualScrollPosition + nPixelsToScroll < 0) {
nPixelsToScroll = -nVirtualScrollPosition;
}
}
internal(this).bIsScrolledVerticallyByWheel = true;
internal(this).bIsScrolledVerticallyByKeyboard = false;
this._getKeyboardExtension().setActionMode(false);
VerticalScrollingHelper.updateScrollPosition(this, nScrollPosition + nPixelsToScroll, ScrollTrigger.MOUSEWHEEL);
}
}
} | javascript | function(mOptions, oEvent) {
var oScrollExtension = this._getScrollExtension();
var bVerticalDelta = Math.abs(oEvent.deltaY) > Math.abs(oEvent.deltaX);
var iScrollDelta = bVerticalDelta ? oEvent.deltaY : oEvent.deltaX;
var bHorizontalScrolling = bVerticalDelta && oEvent.shiftKey || !bVerticalDelta;
var bScrollingForward = iScrollDelta > 0;
var bScrolledToEnd = false;
if (iScrollDelta === 0) {
return;
}
if (bHorizontalScrolling && (mOptions.scrollDirection === ScrollDirection.HORIZONAL
|| mOptions.scrollDirection === ScrollDirection.BOTH)) {
var oHSb = oScrollExtension.getHorizontalScrollbar();
if (oEvent.deltaMode > 0 /* Not DOM_DELTA_PIXEL */) {
// For simplicity and performance reasons horizontal line and page scrolling is always performed by the distance of one minimum
// column width. To determine the real scroll distance reading from the DOM is necessary, but this should be avoided in an
// event handler.
var iMinColumnWidth = TableUtils.Column.getMinColumnWidth();
iScrollDelta = bScrollingForward ? iMinColumnWidth : -iMinColumnWidth;
}
if (bScrollingForward) {
bScrolledToEnd = oHSb.scrollLeft === oHSb.scrollWidth - oHSb.offsetWidth;
} else {
bScrolledToEnd = oHSb.scrollLeft === 0;
}
if (oScrollExtension.isHorizontalScrollbarVisible() && !bScrolledToEnd) {
oEvent.preventDefault();
oEvent.stopPropagation();
this._getKeyboardExtension().setActionMode(false);
oHSb.scrollLeft = oHSb.scrollLeft + iScrollDelta;
}
} else if (!bHorizontalScrolling && (mOptions.scrollDirection === ScrollDirection.VERTICAL
|| mOptions.scrollDirection === ScrollDirection.BOTH)) {
var oVSb = oScrollExtension.getVerticalScrollbar();
var iMaxFirstRenderedRowIndex = this._getMaxFirstRenderedRowIndex();
var bIsScrollPositionInBuffer = TableUtils.isVariableRowHeightEnabled(this)
&& this._getFirstRenderedRowIndex() === iMaxFirstRenderedRowIndex;
var nScrollRangeRowFraction = VerticalScrollingHelper.getScrollRangeRowFraction(this);
var nScrollDeltaFactor = bIsScrollPositionInBuffer ? this._getDefaultRowHeight() : nScrollRangeRowFraction;
if (oEvent.deltaMode === 1 /* DOM_DELTA_LINE */) {
iScrollDelta *= nScrollDeltaFactor;
} else if (oEvent.deltaMode === 2 /* DOM_DELTA_PAGE */) {
iScrollDelta *= nScrollDeltaFactor * this.getVisibleRowCount();
}
if (bScrollingForward) {
bScrolledToEnd = oVSb.scrollTop === oVSb.scrollHeight - oVSb.offsetHeight;
} else {
bScrolledToEnd = oVSb.scrollTop === 0;
}
if (oScrollExtension.isVerticalScrollbarVisible() && !bScrolledToEnd) {
oEvent.preventDefault();
oEvent.stopPropagation();
var nScrollPosition = VerticalScrollingHelper.getScrollPosition(this);
var nVirtualScrollPosition = nScrollPosition - (iMaxFirstRenderedRowIndex * nScrollRangeRowFraction);
var nPixelsToScroll = iScrollDelta;
if (!bIsScrollPositionInBuffer || (bIsScrollPositionInBuffer && nVirtualScrollPosition === 0 && !bScrollingForward)) {
var nRowsToScroll = iScrollDelta / (oEvent.deltaMode === 0 ? this._getDefaultRowHeight() : nScrollRangeRowFraction);
// If at least one row is scrolled, floor to full rows. Below one row, we scroll pixels.
if (nRowsToScroll > 1) {
nRowsToScroll = Math.floor(nRowsToScroll);
} else if (nRowsToScroll < -1) {
nRowsToScroll = Math.ceil(nRowsToScroll);
}
nPixelsToScroll = nRowsToScroll * nScrollRangeRowFraction;
} else if (!bScrollingForward) { // Vertical scroll position is in buffer.
if (nVirtualScrollPosition + nPixelsToScroll < 0) {
nPixelsToScroll = -nVirtualScrollPosition;
}
}
internal(this).bIsScrolledVerticallyByWheel = true;
internal(this).bIsScrolledVerticallyByKeyboard = false;
this._getKeyboardExtension().setActionMode(false);
VerticalScrollingHelper.updateScrollPosition(this, nScrollPosition + nPixelsToScroll, ScrollTrigger.MOUSEWHEEL);
}
}
} | [
"function",
"(",
"mOptions",
",",
"oEvent",
")",
"{",
"var",
"oScrollExtension",
"=",
"this",
".",
"_getScrollExtension",
"(",
")",
";",
"var",
"bVerticalDelta",
"=",
"Math",
".",
"abs",
"(",
"oEvent",
".",
"deltaY",
")",
">",
"Math",
".",
"abs",
"(",
... | Handles mouse wheel events.
@param {TableScrollExtension.EventListenerOptions} mOptions The options.
@param {WheelEvent} oEvent The wheel event object. | [
"Handles",
"mouse",
"wheel",
"events",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableScrollExtension.js#L852-L945 | train | Handles scrolling of the table. | [
30522,
3853,
1006,
9587,
16790,
2015,
1010,
1051,
18697,
3372,
1007,
1063,
13075,
9808,
26775,
14511,
10288,
29048,
1027,
2023,
1012,
1035,
4152,
26775,
14511,
10288,
29048,
1006,
1007,
1025,
13075,
1038,
16874,
7476,
9247,
2696,
1027,
8785,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
jhipster/generator-jhipster | generators/docker-prompts.js | askForPath | function askForPath() {
if (this.regenerate) return;
const done = this.async();
const deploymentApplicationType = this.deploymentApplicationType;
let messageAskForPath;
if (deploymentApplicationType === 'monolith') {
messageAskForPath = 'Enter the root directory where your applications are located';
} else {
messageAskForPath = 'Enter the root directory where your gateway(s) and microservices are located';
}
const prompts = [
{
type: 'input',
name: 'directoryPath',
message: messageAskForPath,
default: this.directoryPath || '../',
validate: input => {
const path = this.destinationPath(input);
if (shelljs.test('-d', path)) {
const appsFolders = getAppFolders.call(this, input, deploymentApplicationType);
if (appsFolders.length === 0) {
return deploymentApplicationType === 'monolith'
? `No monolith found in ${path}`
: `No microservice or gateway found in ${path}`;
}
return true;
}
return `${path} is not a directory or doesn't exist`;
}
}
];
this.prompt(prompts).then(props => {
this.directoryPath = props.directoryPath;
// Patch the path if there is no trailing "/"
if (!this.directoryPath.endsWith('/')) {
this.log(chalk.yellow(`The path "${this.directoryPath}" does not end with a trailing "/", adding it anyway.`));
this.directoryPath += '/';
}
this.appsFolders = getAppFolders.call(this, this.directoryPath, deploymentApplicationType);
// Removing registry from appsFolders, using reverse for loop
for (let i = this.appsFolders.length - 1; i >= 0; i--) {
if (this.appsFolders[i] === 'jhipster-registry' || this.appsFolders[i] === 'registry') {
this.appsFolders.splice(i, 1);
}
}
this.log(chalk.green(`${this.appsFolders.length} applications found at ${this.destinationPath(this.directoryPath)}\n`));
done();
});
} | javascript | function askForPath() {
if (this.regenerate) return;
const done = this.async();
const deploymentApplicationType = this.deploymentApplicationType;
let messageAskForPath;
if (deploymentApplicationType === 'monolith') {
messageAskForPath = 'Enter the root directory where your applications are located';
} else {
messageAskForPath = 'Enter the root directory where your gateway(s) and microservices are located';
}
const prompts = [
{
type: 'input',
name: 'directoryPath',
message: messageAskForPath,
default: this.directoryPath || '../',
validate: input => {
const path = this.destinationPath(input);
if (shelljs.test('-d', path)) {
const appsFolders = getAppFolders.call(this, input, deploymentApplicationType);
if (appsFolders.length === 0) {
return deploymentApplicationType === 'monolith'
? `No monolith found in ${path}`
: `No microservice or gateway found in ${path}`;
}
return true;
}
return `${path} is not a directory or doesn't exist`;
}
}
];
this.prompt(prompts).then(props => {
this.directoryPath = props.directoryPath;
// Patch the path if there is no trailing "/"
if (!this.directoryPath.endsWith('/')) {
this.log(chalk.yellow(`The path "${this.directoryPath}" does not end with a trailing "/", adding it anyway.`));
this.directoryPath += '/';
}
this.appsFolders = getAppFolders.call(this, this.directoryPath, deploymentApplicationType);
// Removing registry from appsFolders, using reverse for loop
for (let i = this.appsFolders.length - 1; i >= 0; i--) {
if (this.appsFolders[i] === 'jhipster-registry' || this.appsFolders[i] === 'registry') {
this.appsFolders.splice(i, 1);
}
}
this.log(chalk.green(`${this.appsFolders.length} applications found at ${this.destinationPath(this.directoryPath)}\n`));
done();
});
} | [
"function",
"askForPath",
"(",
")",
"{",
"if",
"(",
"this",
".",
"regenerate",
")",
"return",
";",
"const",
"done",
"=",
"this",
".",
"async",
"(",
")",
";",
"const",
"deploymentApplicationType",
"=",
"this",
".",
"deploymentApplicationType",
";",
"let",
"... | Ask For Path | [
"Ask",
"For",
"Path"
] | f76fa8de0818ce6bda6c7b1455942e2a9b0ae3ff | https://github.com/jhipster/generator-jhipster/blob/f76fa8de0818ce6bda6c7b1455942e2a9b0ae3ff/generators/docker-prompts.js#L108-L163 | train | Ask For Path | [
30522,
3853,
3198,
29278,
15069,
1006,
1007,
1063,
2065,
1006,
2023,
1012,
19723,
24454,
3686,
1007,
2709,
1025,
9530,
3367,
2589,
1027,
2023,
1012,
2004,
6038,
2278,
1006,
1007,
1025,
9530,
3367,
10813,
29098,
19341,
3508,
13874,
1027,
202... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/project/WorkingSetView.js | scroll | function scroll($container, $el, dir, callback) {
var container = $container[0],
maxScroll = container.scrollHeight - container.clientHeight;
if (maxScroll && dir && !interval) {
// Scroll view if the mouse is over the first or last pixels of the container
interval = window.setInterval(function () {
var scrollTop = $container.scrollTop();
if ((dir === -1 && scrollTop <= 0) || (dir === 1 && scrollTop >= maxScroll)) {
endScroll($el);
} else {
$container.scrollTop(scrollTop + 7 * dir);
callback($el);
}
}, 50);
}
} | javascript | function scroll($container, $el, dir, callback) {
var container = $container[0],
maxScroll = container.scrollHeight - container.clientHeight;
if (maxScroll && dir && !interval) {
// Scroll view if the mouse is over the first or last pixels of the container
interval = window.setInterval(function () {
var scrollTop = $container.scrollTop();
if ((dir === -1 && scrollTop <= 0) || (dir === 1 && scrollTop >= maxScroll)) {
endScroll($el);
} else {
$container.scrollTop(scrollTop + 7 * dir);
callback($el);
}
}, 50);
}
} | [
"function",
"scroll",
"(",
"$container",
",",
"$el",
",",
"dir",
",",
"callback",
")",
"{",
"var",
"container",
"=",
"$container",
"[",
"0",
"]",
",",
"maxScroll",
"=",
"container",
".",
"scrollHeight",
"-",
"container",
".",
"clientHeight",
";",
"if",
"... | We scroll the list while hovering over the first or last visible list element in the working set, so that positioning a working set item before or after one that has been scrolled out of view can be performed. This function will call the drag interface repeatedly on an interval to allow the item to be dragged while scrolling the list until the mouse is moved off the first or last item or endScroll is called | [
"We",
"scroll",
"the",
"list",
"while",
"hovering",
"over",
"the",
"first",
"or",
"last",
"visible",
"list",
"element",
"in",
"the",
"working",
"set",
"so",
"that",
"positioning",
"a",
"working",
"set",
"item",
"before",
"or",
"after",
"one",
"that",
"has"... | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/project/WorkingSetView.js#L259-L274 | train | Scrolls the container to the specified direction | [
30522,
3853,
17186,
1006,
1002,
11661,
1010,
1002,
3449,
1010,
16101,
1010,
2655,
5963,
1007,
1063,
13075,
11661,
1027,
1002,
11661,
1031,
1014,
1033,
1010,
4098,
11020,
28402,
1027,
11661,
1012,
17186,
26036,
13900,
1011,
11661,
1012,
7396,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
getinsomnia/insomnia | packages/insomnia-app/app/sync-legacy/index.js | _getResourceGroupSymmetricKey | async function _getResourceGroupSymmetricKey(resourceGroupId) {
let key = resourceGroupSymmetricKeysCache[resourceGroupId];
if (!key) {
const resourceGroup = await fetchResourceGroup(resourceGroupId);
const accountPrivateKey = await session.getPrivateKey();
const symmetricKeyStr = crypt.decryptRSAWithJWK(
accountPrivateKey,
resourceGroup.encSymmetricKey,
);
key = JSON.parse(symmetricKeyStr);
// Update cache
resourceGroupSymmetricKeysCache[resourceGroupId] = key;
}
return key;
} | javascript | async function _getResourceGroupSymmetricKey(resourceGroupId) {
let key = resourceGroupSymmetricKeysCache[resourceGroupId];
if (!key) {
const resourceGroup = await fetchResourceGroup(resourceGroupId);
const accountPrivateKey = await session.getPrivateKey();
const symmetricKeyStr = crypt.decryptRSAWithJWK(
accountPrivateKey,
resourceGroup.encSymmetricKey,
);
key = JSON.parse(symmetricKeyStr);
// Update cache
resourceGroupSymmetricKeysCache[resourceGroupId] = key;
}
return key;
} | [
"async",
"function",
"_getResourceGroupSymmetricKey",
"(",
"resourceGroupId",
")",
"{",
"let",
"key",
"=",
"resourceGroupSymmetricKeysCache",
"[",
"resourceGroupId",
"]",
";",
"if",
"(",
"!",
"key",
")",
"{",
"const",
"resourceGroup",
"=",
"await",
"fetchResourceGro... | Get a ResourceGroup's symmetric encryption key
@param resourceGroupId
@private | [
"Get",
"a",
"ResourceGroup",
"s",
"symmetric",
"encryption",
"key"
] | e24ce7f7b41246e700c4b9bdb6b34b6652ad589b | https://github.com/getinsomnia/insomnia/blob/e24ce7f7b41246e700c4b9bdb6b34b6652ad589b/packages/insomnia-app/app/sync-legacy/index.js#L669-L688 | train | Get the symmetric key for a resource group | [
30522,
2004,
6038,
2278,
3853,
1035,
2131,
6072,
30524,
1007,
1063,
9530,
3367,
7692,
17058,
1027,
26751,
18584,
6072,
8162,
3401,
17058,
1006,
7692,
17058,
3593,
1007,
1025,
9530,
3367,
4070,
18098,
21466,
14839,
1027,
26751,
5219,
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... |
angular/material | src/components/list/list.js | MdListController | function MdListController($scope, $element, $mdListInkRipple) {
var ctrl = this;
ctrl.attachRipple = attachRipple;
function attachRipple (scope, element) {
var options = {};
$mdListInkRipple.attach(scope, element, options);
}
} | javascript | function MdListController($scope, $element, $mdListInkRipple) {
var ctrl = this;
ctrl.attachRipple = attachRipple;
function attachRipple (scope, element) {
var options = {};
$mdListInkRipple.attach(scope, element, options);
}
} | [
"function",
"MdListController",
"(",
"$scope",
",",
"$element",
",",
"$mdListInkRipple",
")",
"{",
"var",
"ctrl",
"=",
"this",
";",
"ctrl",
".",
"attachRipple",
"=",
"attachRipple",
";",
"function",
"attachRipple",
"(",
"scope",
",",
"element",
")",
"{",
"va... | /*
@private
@ngdoc controller
@name MdListController
@module material.components.list | [
"/",
"*",
"@private",
"@ngdoc",
"controller",
"@name",
"MdListController",
"@module",
"material",
".",
"components",
".",
"list"
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/list/list.js#L579-L587 | train | Controller for the scaffolding | [
30522,
3853,
9108,
9863,
8663,
13181,
30524,
10814,
1025,
3853,
22476,
29443,
10814,
1006,
9531,
1010,
5783,
1007,
1063,
13075,
7047,
1027,
1063,
1065,
1025,
1002,
9108,
9863,
19839,
29443,
10814,
1012,
22476,
1006,
9531,
1010,
5783,
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.support/src/sap/ui/support/supportRules/Storage.js | function(sCookieName) {
var name = sCookieName + "=",
decodedCookie = decodeURIComponent(document.cookie),
ca = decodedCookie.split(';'),
sOutput = "";
for (var i = 0; i < ca.length; i++) {
var c = ca[i];
while (c.charAt(0) == ' ') {
c = c.substring(1);
}
if (c.indexOf(name) == 0) {
sOutput = c.substring(name.length, c.length);
return sOutput;
}
}
return sOutput;
} | javascript | function(sCookieName) {
var name = sCookieName + "=",
decodedCookie = decodeURIComponent(document.cookie),
ca = decodedCookie.split(';'),
sOutput = "";
for (var i = 0; i < ca.length; i++) {
var c = ca[i];
while (c.charAt(0) == ' ') {
c = c.substring(1);
}
if (c.indexOf(name) == 0) {
sOutput = c.substring(name.length, c.length);
return sOutput;
}
}
return sOutput;
} | [
"function",
"(",
"sCookieName",
")",
"{",
"var",
"name",
"=",
"sCookieName",
"+",
"\"=\"",
",",
"decodedCookie",
"=",
"decodeURIComponent",
"(",
"document",
".",
"cookie",
")",
",",
"ca",
"=",
"decodedCookie",
".",
"split",
"(",
"';'",
")",
",",
"sOutput",... | Retrieves the persistence options of the user in the LocalStorage layer.
@private
@method
@name sap.ui.support.Storage.readPersistenceCookie
@alias readPersistenceCookie
@param {string} sCookieName Name of the cookie.
@returns {string} sOutput The persistence options of the user. | [
"Retrieves",
"the",
"persistence",
"options",
"of",
"the",
"user",
"in",
"the",
"LocalStorage",
"layer",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.support/src/sap/ui/support/supportRules/Storage.js#L290-L309 | train | Get the cookie value from the cookie | [
30522,
3853,
1006,
8040,
14659,
9013,
14074,
1007,
1063,
13075,
2171,
1027,
8040,
14659,
9013,
14074,
1009,
1000,
1027,
1000,
1010,
21933,
5732,
3597,
23212,
2063,
1027,
21933,
3207,
9496,
9006,
29513,
3372,
1006,
6254,
1012,
17387,
1007,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
eslint/eslint | lib/rules/space-before-function-paren.js | checkFunction | function checkFunction(node) {
const functionConfig = getConfigForFunction(node);
if (functionConfig === "ignore") {
return;
}
const rightToken = sourceCode.getFirstToken(node, astUtils.isOpeningParenToken);
const leftToken = sourceCode.getTokenBefore(rightToken);
const hasSpacing = sourceCode.isSpaceBetweenTokens(leftToken, rightToken);
if (hasSpacing && functionConfig === "never") {
context.report({
node,
loc: leftToken.loc.end,
message: "Unexpected space before function parentheses.",
fix: fixer => fixer.removeRange([leftToken.range[1], rightToken.range[0]])
});
} else if (!hasSpacing && functionConfig === "always") {
context.report({
node,
loc: leftToken.loc.end,
message: "Missing space before function parentheses.",
fix: fixer => fixer.insertTextAfter(leftToken, " ")
});
}
} | javascript | function checkFunction(node) {
const functionConfig = getConfigForFunction(node);
if (functionConfig === "ignore") {
return;
}
const rightToken = sourceCode.getFirstToken(node, astUtils.isOpeningParenToken);
const leftToken = sourceCode.getTokenBefore(rightToken);
const hasSpacing = sourceCode.isSpaceBetweenTokens(leftToken, rightToken);
if (hasSpacing && functionConfig === "never") {
context.report({
node,
loc: leftToken.loc.end,
message: "Unexpected space before function parentheses.",
fix: fixer => fixer.removeRange([leftToken.range[1], rightToken.range[0]])
});
} else if (!hasSpacing && functionConfig === "always") {
context.report({
node,
loc: leftToken.loc.end,
message: "Missing space before function parentheses.",
fix: fixer => fixer.insertTextAfter(leftToken, " ")
});
}
} | [
"function",
"checkFunction",
"(",
"node",
")",
"{",
"const",
"functionConfig",
"=",
"getConfigForFunction",
"(",
"node",
")",
";",
"if",
"(",
"functionConfig",
"===",
"\"ignore\"",
")",
"{",
"return",
";",
"}",
"const",
"rightToken",
"=",
"sourceCode",
".",
... | Checks the parens of a function node
@param {ASTNode} node A function node
@returns {void} | [
"Checks",
"the",
"parens",
"of",
"a",
"function",
"node"
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/space-before-function-paren.js#L111-L137 | train | Check if a function is valid | [
30522,
3853,
4638,
11263,
27989,
1006,
13045,
1007,
1063,
9530,
3367,
3853,
8663,
8873,
2290,
1027,
2131,
8663,
8873,
25708,
16347,
4609,
7542,
1006,
13045,
1007,
1025,
2065,
1006,
3853,
8663,
8873,
2290,
1027,
1027,
1027,
1000,
8568,
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... |
SeleniumHQ/selenium | javascript/node/selenium-webdriver/lib/promise.js | checkedNodeCall | function checkedNodeCall(fn, ...args) {
return new Promise(function(fulfill, reject) {
try {
fn(...args, function(error, value) {
error ? reject(error) : fulfill(value);
});
} catch (ex) {
reject(ex);
}
});
} | javascript | function checkedNodeCall(fn, ...args) {
return new Promise(function(fulfill, reject) {
try {
fn(...args, function(error, value) {
error ? reject(error) : fulfill(value);
});
} catch (ex) {
reject(ex);
}
});
} | [
"function",
"checkedNodeCall",
"(",
"fn",
",",
"...",
"args",
")",
"{",
"return",
"new",
"Promise",
"(",
"function",
"(",
"fulfill",
",",
"reject",
")",
"{",
"try",
"{",
"fn",
"(",
"...",
"args",
",",
"function",
"(",
"error",
",",
"value",
")",
"{",... | Wraps a function that expects a node-style callback as its final
argument. This callback expects two arguments: an error value (which will be
null if the call succeeded), and the success value as the second argument.
The callback will the resolve or reject the returned promise, based on its
arguments.
@param {!Function} fn The function to wrap.
@param {...?} args The arguments to apply to the function, excluding the
final callback.
@return {!Thenable} A promise that will be resolved with the
result of the provided function's callback. | [
"Wraps",
"a",
"function",
"that",
"expects",
"a",
"node",
"-",
"style",
"callback",
"as",
"its",
"final",
"argument",
".",
"This",
"callback",
"expects",
"two",
"arguments",
":",
"an",
"error",
"value",
"(",
"which",
"will",
"be",
"null",
"if",
"the",
"c... | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/node/selenium-webdriver/lib/promise.js#L72-L82 | train | Returns a promise that resolves to the result of the node call | [
30522,
3853,
7039,
3630,
3207,
9289,
2140,
1006,
1042,
2078,
1010,
1012,
1012,
1012,
12098,
5620,
1007,
1063,
2709,
2047,
4872,
1006,
3853,
1006,
13883,
1010,
15454,
1007,
1063,
3046,
1063,
1042,
2078,
1006,
1012,
1012,
1012,
12098,
30524,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
electron/electron | lib/browser/rpc-server.js | function (object) {
const proto = Object.getPrototypeOf(object)
if (proto === null || proto === Object.prototype) return null
return {
members: getObjectMembers(proto),
proto: getObjectPrototype(proto)
}
} | javascript | function (object) {
const proto = Object.getPrototypeOf(object)
if (proto === null || proto === Object.prototype) return null
return {
members: getObjectMembers(proto),
proto: getObjectPrototype(proto)
}
} | [
"function",
"(",
"object",
")",
"{",
"const",
"proto",
"=",
"Object",
".",
"getPrototypeOf",
"(",
"object",
")",
"if",
"(",
"proto",
"===",
"null",
"||",
"proto",
"===",
"Object",
".",
"prototype",
")",
"return",
"null",
"return",
"{",
"members",
":",
... | Return the description of object's prototype. | [
"Return",
"the",
"description",
"of",
"object",
"s",
"prototype",
"."
] | 6e29611788277729647acf465f10db1ea6f15788 | https://github.com/electron/electron/blob/6e29611788277729647acf465f10db1ea6f15788/lib/browser/rpc-server.js#L61-L68 | train | Returns an object with the members and prototype of the object | [
30522,
3853,
1006,
4874,
1007,
1063,
9530,
3367,
15053,
1027,
4874,
1012,
2131,
21572,
3406,
13874,
11253,
1006,
4874,
30524,
15053,
1007,
1010,
15053,
1024,
2131,
16429,
20614,
21572,
3406,
13874,
1006,
15053,
1007,
1065,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/edit/global_events.js | onResize | function onResize(cm) {
let d = cm.display
// Might be a text scaling operation, clear size caches.
d.cachedCharWidth = d.cachedTextHeight = d.cachedPaddingH = null
d.scrollbarsClipped = false
cm.setSize()
} | javascript | function onResize(cm) {
let d = cm.display
// Might be a text scaling operation, clear size caches.
d.cachedCharWidth = d.cachedTextHeight = d.cachedPaddingH = null
d.scrollbarsClipped = false
cm.setSize()
} | [
"function",
"onResize",
"(",
"cm",
")",
"{",
"let",
"d",
"=",
"cm",
".",
"display",
"// Might be a text scaling operation, clear size caches.",
"d",
".",
"cachedCharWidth",
"=",
"d",
".",
"cachedTextHeight",
"=",
"d",
".",
"cachedPaddingH",
"=",
"null",
"d",
"."... | Called when the window resizes | [
"Called",
"when",
"the",
"window",
"resizes"
] | dab6f676107c10ba8d16c654a42f66cae3f27db1 | https://github.com/codemirror/CodeMirror/blob/dab6f676107c10ba8d16c654a42f66cae3f27db1/src/edit/global_events.js#L39-L45 | train | Called when the display is resized | [
30522,
3853,
2006,
6072,
4697,
1006,
4642,
1007,
1063,
2292,
1040,
1027,
4642,
1012,
4653,
1013,
1013,
2453,
2022,
1037,
3793,
25169,
3169,
30524,
17186,
8237,
11020,
15000,
5669,
1027,
6270,
4642,
1012,
4520,
4697,
1006,
1007,
1065,
102,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.support/src/sap/ui/support/supportRules/History.js | function (oRun, sLibraryName, sRuleName) {
var aIssues = [];
if (oRun.issues[sLibraryName] && oRun.issues[sLibraryName][sRuleName]) {
oRun.issues[sLibraryName][sRuleName].forEach(function (oIssue) {
var oMinimizedIssue = {
"context": oIssue.context,
"details": oIssue.details,
"name": oIssue.name,
"severity": oIssue.severity
};
aIssues.push(oMinimizedIssue);
});
}
return aIssues;
} | javascript | function (oRun, sLibraryName, sRuleName) {
var aIssues = [];
if (oRun.issues[sLibraryName] && oRun.issues[sLibraryName][sRuleName]) {
oRun.issues[sLibraryName][sRuleName].forEach(function (oIssue) {
var oMinimizedIssue = {
"context": oIssue.context,
"details": oIssue.details,
"name": oIssue.name,
"severity": oIssue.severity
};
aIssues.push(oMinimizedIssue);
});
}
return aIssues;
} | [
"function",
"(",
"oRun",
",",
"sLibraryName",
",",
"sRuleName",
")",
"{",
"var",
"aIssues",
"=",
"[",
"]",
";",
"if",
"(",
"oRun",
".",
"issues",
"[",
"sLibraryName",
"]",
"&&",
"oRun",
".",
"issues",
"[",
"sLibraryName",
"]",
"[",
"sRuleName",
"]",
... | Gets all issues reported from a specific rule in shortened format - containing
only the necessary details of the issue.
@param {Object} oRun The analysis run
@param {string} sLibraryName The name of the library
@param {string} sRuleName The name of the rule
@returns {Array} All issues from a rule
@private
@method | [
"Gets",
"all",
"issues",
"reported",
"from",
"a",
"specific",
"rule",
"in",
"shortened",
"format",
"-",
"containing",
"only",
"the",
"necessary",
"details",
"of",
"the",
"issue",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.support/src/sap/ui/support/supportRules/History.js#L109-L125 | train | Returns an array of issues that are not part of a specific rule. | [
30522,
3853,
1006,
2030,
4609,
1010,
22889,
12322,
19848,
18279,
4168,
1010,
5034,
9307,
18442,
1007,
1063,
13075,
9932,
4757,
15808,
1027,
1031,
1033,
1025,
2065,
1006,
2030,
4609,
1012,
3314,
1031,
22889,
12322,
19848,
18279,
4168,
1033,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | src/sap.ui.core/src/sap/ui/thirdparty/jquery-mobile-custom.js | function( prop ) {
if ( !prop ) {
return;
}
return nsNormalizeDict[ prop ] || ( nsNormalizeDict[ prop ] = $.camelCase( $.mobile.ns + prop ) );
} | javascript | function( prop ) {
if ( !prop ) {
return;
}
return nsNormalizeDict[ prop ] || ( nsNormalizeDict[ prop ] = $.camelCase( $.mobile.ns + prop ) );
} | [
"function",
"(",
"prop",
")",
"{",
"if",
"(",
"!",
"prop",
")",
"{",
"return",
";",
"}",
"return",
"nsNormalizeDict",
"[",
"prop",
"]",
"||",
"(",
"nsNormalizeDict",
"[",
"prop",
"]",
"=",
"$",
".",
"camelCase",
"(",
"$",
".",
"mobile",
".",
"ns",
... | Take a data attribute property, prepend the namespace and then camel case the attribute string. Add the result to our nsNormalizeDict so we don't have to do this again. | [
"Take",
"a",
"data",
"attribute",
"property",
"prepend",
"the",
"namespace",
"and",
"then",
"camel",
"case",
"the",
"attribute",
"string",
".",
"Add",
"the",
"result",
"to",
"our",
"nsNormalizeDict",
"so",
"we",
"don",
"t",
"have",
"to",
"do",
"this",
"aga... | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/jquery-mobile-custom.js#L462-L468 | train | Get the namespace name for a property | [
30522,
3853,
1006,
17678,
1007,
1063,
2065,
1006,
999,
17678,
1007,
1063,
2709,
1025,
1065,
2709,
24978,
12131,
9067,
3550,
2594,
2102,
1031,
17678,
1033,
1064,
1064,
1006,
24978,
12131,
9067,
3550,
2594,
2102,
1031,
17678,
1033,
1027,
1002... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | isReferencedInClosure | function isReferencedInClosure(variable) {
const enclosingFunctionScope = getEnclosingFunctionScope(variable.scope);
return variable.references.some(reference =>
getEnclosingFunctionScope(reference.from) !== enclosingFunctionScope);
} | javascript | function isReferencedInClosure(variable) {
const enclosingFunctionScope = getEnclosingFunctionScope(variable.scope);
return variable.references.some(reference =>
getEnclosingFunctionScope(reference.from) !== enclosingFunctionScope);
} | [
"function",
"isReferencedInClosure",
"(",
"variable",
")",
"{",
"const",
"enclosingFunctionScope",
"=",
"getEnclosingFunctionScope",
"(",
"variable",
".",
"scope",
")",
";",
"return",
"variable",
".",
"references",
".",
"some",
"(",
"reference",
"=>",
"getEnclosingF... | Checks whether the given variable has any references from a more specific
function expression (i.e. a closure).
@param {eslint-scope.Variable} variable - A variable to check.
@returns {boolean} `true` if the variable is used from a closure. | [
"Checks",
"whether",
"the",
"given",
"variable",
"has",
"any",
"references",
"from",
"a",
"more",
"specific",
"function",
"expression",
"(",
"i",
".",
"e",
".",
"a",
"closure",
")",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/no-var.js#L51-L56 | train | Checks if a variable is referenced in a closure | [
30522,
3853,
2003,
2890,
25523,
8718,
20464,
2891,
5397,
1006,
8023,
1007,
1063,
9530,
3367,
4372,
20464,
18606,
11263,
27989,
26127,
1027,
2131,
2368,
20464,
18606,
11263,
27989,
26127,
1006,
8023,
1012,
9531,
1007,
1025,
2709,
8023,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SeleniumHQ/selenium | third_party/js/mozmill/shared-modules/prefs.js | preferences_setPref | function preferences_setPref(prefName, value, interfaceType) {
try {
switch (typeof value) {
case ('boolean'):
this.prefBranch.setBoolPref(prefName, value);
break;
case ('string'):
this.prefBranch.setCharPref(prefName, value);
break;
case ('number'):
this.prefBranch.setIntPref(prefName, value);
break;
default:
this.prefBranch.setComplexValue(prefName, interfaceType, value);
}
} catch(e) {
return false;
}
return true;
} | javascript | function preferences_setPref(prefName, value, interfaceType) {
try {
switch (typeof value) {
case ('boolean'):
this.prefBranch.setBoolPref(prefName, value);
break;
case ('string'):
this.prefBranch.setCharPref(prefName, value);
break;
case ('number'):
this.prefBranch.setIntPref(prefName, value);
break;
default:
this.prefBranch.setComplexValue(prefName, interfaceType, value);
}
} catch(e) {
return false;
}
return true;
} | [
"function",
"preferences_setPref",
"(",
"prefName",
",",
"value",
",",
"interfaceType",
")",
"{",
"try",
"{",
"switch",
"(",
"typeof",
"value",
")",
"{",
"case",
"(",
"'boolean'",
")",
":",
"this",
".",
"prefBranch",
".",
"setBoolPref",
"(",
"prefName",
",... | Set the value of an individual preference.
@param {string} prefName
The preference to set the value of.
@param {boolean/number/string/complex} value
The value to set the preference to.
@param {string} interfaceType
Interface to use for the complex value
(nsILocalFile, nsISupportsString, nsIPrefLocalizedString)
@return Returns if the value was successfully set.
@type boolean | [
"Set",
"the",
"value",
"of",
"an",
"individual",
"preference",
"."
] | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/prefs.js#L308-L328 | train | Set a preference | [
30522,
3853,
18394,
1035,
2275,
28139,
2546,
1006,
3653,
2546,
18442,
1010,
3643,
1010,
8278,
13874,
1007,
1063,
3046,
1063,
6942,
1006,
2828,
11253,
3643,
1007,
1063,
2553,
1006,
1005,
22017,
20898,
1005,
1007,
1024,
2023,
1012,
3653,
2633... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
mochajs/mocha | lib/reporters/doc.js | Doc | function Doc(runner, options) {
Base.call(this, runner, options);
var indents = 2;
function indent() {
return Array(indents).join(' ');
}
runner.on(EVENT_SUITE_BEGIN, function(suite) {
if (suite.root) {
return;
}
++indents;
console.log('%s<section class="suite">', indent());
++indents;
console.log('%s<h1>%s</h1>', indent(), utils.escape(suite.title));
console.log('%s<dl>', indent());
});
runner.on(EVENT_SUITE_END, function(suite) {
if (suite.root) {
return;
}
console.log('%s</dl>', indent());
--indents;
console.log('%s</section>', indent());
--indents;
});
runner.on(EVENT_TEST_PASS, function(test) {
console.log('%s <dt>%s</dt>', indent(), utils.escape(test.title));
var code = utils.escape(utils.clean(test.body));
console.log('%s <dd><pre><code>%s</code></pre></dd>', indent(), code);
});
runner.on(EVENT_TEST_FAIL, function(test, err) {
console.log(
'%s <dt class="error">%s</dt>',
indent(),
utils.escape(test.title)
);
var code = utils.escape(utils.clean(test.body));
console.log(
'%s <dd class="error"><pre><code>%s</code></pre></dd>',
indent(),
code
);
console.log('%s <dd class="error">%s</dd>', indent(), utils.escape(err));
});
} | javascript | function Doc(runner, options) {
Base.call(this, runner, options);
var indents = 2;
function indent() {
return Array(indents).join(' ');
}
runner.on(EVENT_SUITE_BEGIN, function(suite) {
if (suite.root) {
return;
}
++indents;
console.log('%s<section class="suite">', indent());
++indents;
console.log('%s<h1>%s</h1>', indent(), utils.escape(suite.title));
console.log('%s<dl>', indent());
});
runner.on(EVENT_SUITE_END, function(suite) {
if (suite.root) {
return;
}
console.log('%s</dl>', indent());
--indents;
console.log('%s</section>', indent());
--indents;
});
runner.on(EVENT_TEST_PASS, function(test) {
console.log('%s <dt>%s</dt>', indent(), utils.escape(test.title));
var code = utils.escape(utils.clean(test.body));
console.log('%s <dd><pre><code>%s</code></pre></dd>', indent(), code);
});
runner.on(EVENT_TEST_FAIL, function(test, err) {
console.log(
'%s <dt class="error">%s</dt>',
indent(),
utils.escape(test.title)
);
var code = utils.escape(utils.clean(test.body));
console.log(
'%s <dd class="error"><pre><code>%s</code></pre></dd>',
indent(),
code
);
console.log('%s <dd class="error">%s</dd>', indent(), utils.escape(err));
});
} | [
"function",
"Doc",
"(",
"runner",
",",
"options",
")",
"{",
"Base",
".",
"call",
"(",
"this",
",",
"runner",
",",
"options",
")",
";",
"var",
"indents",
"=",
"2",
";",
"function",
"indent",
"(",
")",
"{",
"return",
"Array",
"(",
"indents",
")",
"."... | Constructs a new `Doc` reporter instance.
@public
@class
@memberof Mocha.reporters
@extends Mocha.reporters.Base
@param {Runner} runner - Instance triggers reporter actions.
@param {Object} [options] - runner options | [
"Constructs",
"a",
"new",
"Doc",
"reporter",
"instance",
"."
] | 9b00fedb610241e33f7592c40164e42a38a793cf | https://github.com/mochajs/mocha/blob/9b00fedb610241e33f7592c40164e42a38a793cf/lib/reporters/doc.js#L33-L83 | train | Constructor for Doc | [
30522,
3853,
9986,
1006,
5479,
1010,
7047,
1007,
1063,
2918,
1012,
2655,
1006,
2023,
1010,
5479,
1010,
7047,
1007,
1025,
13075,
27427,
11187,
1027,
1016,
1025,
3853,
27427,
4765,
1006,
1007,
1063,
2709,
9140,
1006,
27427,
11187,
1007,
1012,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/extensibility/node/npm-installer.js | _performNpmInstall | function _performNpmInstall(installDirectory, npmOptions, callback) {
var npmPath = path.resolve(path.dirname(require.resolve("npm")), "..", "bin", "npm-cli.js");
var args = [npmPath, "install"].concat(npmOptions);
console.log("running npm " + args.slice(1).join(" ") + " in " + installDirectory);
var child = spawn(process.execPath, args, { cwd: installDirectory });
child.on("error", function (err) {
return callback(err);
});
var stdout = [];
child.stdout.addListener("data", function (buffer) {
stdout.push(buffer);
});
var stderr = [];
child.stderr.addListener("data", function (buffer) {
stderr.push(buffer);
});
var exitCode = 0;
child.addListener("exit", function (code) {
exitCode = code;
});
child.addListener("close", function () {
stderr = Buffer.concat(stderr).toString();
stdout = Buffer.concat(stdout).toString();
if (exitCode > 0) {
console.error("npm-stderr: " + stderr);
return callback(new Error(stderr));
}
if (stderr) {
console.warn("npm-stderr: " + stderr);
}
console.log("npm-stdout: " + stdout);
return callback();
});
child.stdin.end();
} | javascript | function _performNpmInstall(installDirectory, npmOptions, callback) {
var npmPath = path.resolve(path.dirname(require.resolve("npm")), "..", "bin", "npm-cli.js");
var args = [npmPath, "install"].concat(npmOptions);
console.log("running npm " + args.slice(1).join(" ") + " in " + installDirectory);
var child = spawn(process.execPath, args, { cwd: installDirectory });
child.on("error", function (err) {
return callback(err);
});
var stdout = [];
child.stdout.addListener("data", function (buffer) {
stdout.push(buffer);
});
var stderr = [];
child.stderr.addListener("data", function (buffer) {
stderr.push(buffer);
});
var exitCode = 0;
child.addListener("exit", function (code) {
exitCode = code;
});
child.addListener("close", function () {
stderr = Buffer.concat(stderr).toString();
stdout = Buffer.concat(stdout).toString();
if (exitCode > 0) {
console.error("npm-stderr: " + stderr);
return callback(new Error(stderr));
}
if (stderr) {
console.warn("npm-stderr: " + stderr);
}
console.log("npm-stdout: " + stdout);
return callback();
});
child.stdin.end();
} | [
"function",
"_performNpmInstall",
"(",
"installDirectory",
",",
"npmOptions",
",",
"callback",
")",
"{",
"var",
"npmPath",
"=",
"path",
".",
"resolve",
"(",
"path",
".",
"dirname",
"(",
"require",
".",
"resolve",
"(",
"\"npm\"",
")",
")",
",",
"\"..\"",
",... | Private function to run "npm install --production" command in the extension directory.
@param {string} installDirectory Directory to remove
@param {array} npmOptions can contain additional options like `--production` or `--proxy http://127.0.0.1:8888`
@param {function} callback NodeJS style callback to call after finish | [
"Private",
"function",
"to",
"run",
"npm",
"install",
"--",
"production",
"command",
"in",
"the",
"extension",
"directory",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensibility/node/npm-installer.js#L43-L85 | train | Runs npm install | [
30522,
3853,
1035,
4685,
16275,
21266,
9080,
2140,
1006,
16500,
4305,
2890,
16761,
2100,
1010,
27937,
5302,
16790,
2015,
1010,
2655,
5963,
1007,
1063,
13075,
27937,
8737,
8988,
1027,
4130,
1012,
10663,
1006,
4130,
1012,
16101,
18442,
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/document/DocumentCommandHandlers.js | handleDirtyChange | function handleDirtyChange(event, changedDoc) {
var currentDoc = DocumentManager.getCurrentDocument();
if (currentDoc && changedDoc.file.fullPath === currentDoc.file.fullPath) {
_updateTitle();
}
} | javascript | function handleDirtyChange(event, changedDoc) {
var currentDoc = DocumentManager.getCurrentDocument();
if (currentDoc && changedDoc.file.fullPath === currentDoc.file.fullPath) {
_updateTitle();
}
} | [
"function",
"handleDirtyChange",
"(",
"event",
",",
"changedDoc",
")",
"{",
"var",
"currentDoc",
"=",
"DocumentManager",
".",
"getCurrentDocument",
"(",
")",
";",
"if",
"(",
"currentDoc",
"&&",
"changedDoc",
".",
"file",
".",
"fullPath",
"===",
"currentDoc",
"... | Handles dirtyFlagChange event and updates the title bar if necessary | [
"Handles",
"dirtyFlagChange",
"event",
"and",
"updates",
"the",
"title",
"bar",
"if",
"necessary"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/document/DocumentCommandHandlers.js#L259-L265 | train | Handle a dirty change event | [
30522,
3853,
8971,
4313,
3723,
22305,
2063,
1006,
2724,
1010,
2904,
3527,
2278,
1007,
1063,
13075,
2783,
3527,
2278,
1027,
6254,
24805,
4590,
1012,
2131,
10841,
14343,
3372,
3527,
24894,
4765,
1006,
1007,
1025,
2065,
1006,
2783,
3527,
2278,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
MithrilJS/mithril.js | render/render.js | removeNodes | function removeNodes(vnodes, start, end) {
for (var i = start; i < end; i++) {
var vnode = vnodes[i]
if (vnode != null) removeNode(vnode)
}
} | javascript | function removeNodes(vnodes, start, end) {
for (var i = start; i < end; i++) {
var vnode = vnodes[i]
if (vnode != null) removeNode(vnode)
}
} | [
"function",
"removeNodes",
"(",
"vnodes",
",",
"start",
",",
"end",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"start",
";",
"i",
"<",
"end",
";",
"i",
"++",
")",
"{",
"var",
"vnode",
"=",
"vnodes",
"[",
"i",
"]",
"if",
"(",
"vnode",
"!=",
"null",
... | remove | [
"remove"
] | 6d36fe09d129928c6b460720e08d9ed321fcd62b | https://github.com/MithrilJS/mithril.js/blob/6d36fe09d129928c6b460720e08d9ed321fcd62b/render/render.js#L626-L631 | train | Remove a range of nodes | [
30522,
3853,
6366,
3630,
6155,
1006,
1058,
3630,
6155,
1010,
2707,
1010,
2203,
1007,
1063,
2005,
1006,
13075,
1045,
1027,
2707,
1025,
1045,
1026,
2203,
1025,
1045,
1009,
1009,
1007,
1063,
13075,
1058,
3630,
3207,
1027,
1058,
3630,
6155,
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... |
zloirock/core-js | packages/core-js/modules/web.url-search-params.js | getAll | function getAll(name) {
validateArgumentsLength(arguments.length, 1);
var entries = getInternalParamsState(this).entries;
var key = name + '';
var result = [];
var i = 0;
for (; i < entries.length; i++) if (entries[i].key === key) result.push(entries[i].value);
return result;
} | javascript | function getAll(name) {
validateArgumentsLength(arguments.length, 1);
var entries = getInternalParamsState(this).entries;
var key = name + '';
var result = [];
var i = 0;
for (; i < entries.length; i++) if (entries[i].key === key) result.push(entries[i].value);
return result;
} | [
"function",
"getAll",
"(",
"name",
")",
"{",
"validateArgumentsLength",
"(",
"arguments",
".",
"length",
",",
"1",
")",
";",
"var",
"entries",
"=",
"getInternalParamsState",
"(",
"this",
")",
".",
"entries",
";",
"var",
"key",
"=",
"name",
"+",
"''",
";"... | `URLSearchParams.prototype.getAll` method https://url.spec.whatwg.org/#dom-urlsearchparams-getall | [
"URLSearchParams",
".",
"prototype",
".",
"getAll",
"method",
"https",
":",
"//",
"url",
".",
"spec",
".",
"whatwg",
".",
"org",
"/",
"#dom",
"-",
"urlsearchparams",
"-",
"getall"
] | fe7c8511a6d27d03a9b8e075b3351416aae95c58 | https://github.com/zloirock/core-js/blob/fe7c8511a6d27d03a9b8e075b3351416aae95c58/packages/core-js/modules/web.url-search-params.js#L182-L190 | train | Returns all the parameters of the specified parameter | [
30522,
3853,
2131,
8095,
1006,
2171,
1007,
1063,
9398,
3686,
2906,
22850,
11187,
7770,
13512,
2232,
1006,
9918,
1012,
3091,
1010,
1015,
1007,
1025,
13075,
10445,
1027,
2131,
18447,
11795,
2389,
28689,
5244,
9153,
2618,
1006,
2023,
1007,
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... |
parcel-bundler/parcel | packages/core/parcel-bundler/src/scope-hoisting/shake.js | getUnusedBinding | function getUnusedBinding(path, name) {
let binding = path.scope.getBinding(name);
if (!binding) {
return null;
}
let pure = isPure(binding);
if (!binding.referenced && pure) {
return binding;
}
// Is there any references which aren't simple assignments?
let bailout = binding.referencePaths.some(
path => !isExportAssignment(path) && !isUnusedWildcard(path)
);
if (!bailout && pure) {
return binding;
}
return null;
} | javascript | function getUnusedBinding(path, name) {
let binding = path.scope.getBinding(name);
if (!binding) {
return null;
}
let pure = isPure(binding);
if (!binding.referenced && pure) {
return binding;
}
// Is there any references which aren't simple assignments?
let bailout = binding.referencePaths.some(
path => !isExportAssignment(path) && !isUnusedWildcard(path)
);
if (!bailout && pure) {
return binding;
}
return null;
} | [
"function",
"getUnusedBinding",
"(",
"path",
",",
"name",
")",
"{",
"let",
"binding",
"=",
"path",
".",
"scope",
".",
"getBinding",
"(",
"name",
")",
";",
"if",
"(",
"!",
"binding",
")",
"{",
"return",
"null",
";",
"}",
"let",
"pure",
"=",
"isPure",
... | Check if a binding is safe to remove and returns it if it is. | [
"Check",
"if",
"a",
"binding",
"is",
"safe",
"to",
"remove",
"and",
"returns",
"it",
"if",
"it",
"is",
"."
] | 84b308511f87d4b69da62bcd352f0ff2f7bd4f1b | https://github.com/parcel-bundler/parcel/blob/84b308511f87d4b69da62bcd352f0ff2f7bd4f1b/packages/core/parcel-bundler/src/scope-hoisting/shake.js#L39-L60 | train | Returns the binding that is not used by the given name. | [
30522,
3853,
2131,
4609,
13901,
8428,
4667,
1006,
4130,
1010,
2171,
1007,
1063,
2292,
8031,
1027,
4130,
1012,
9531,
1012,
2131,
8428,
4667,
1006,
2171,
1007,
1025,
2065,
1006,
999,
8031,
1007,
1063,
2709,
19701,
1025,
1065,
2292,
5760,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/preferences/PreferencesBase.js | function (context) {
context = context || {};
var layerCounter,
layers = this._layers,
layer,
data = this.data;
var keySets = [_.difference(_.keys(data), this._exclusions)];
for (layerCounter = 0; layerCounter < layers.length; layerCounter++) {
layer = layers[layerCounter];
keySets.push(layer.getKeys(data[layer.key], context));
}
return _.union.apply(null, keySets);
} | javascript | function (context) {
context = context || {};
var layerCounter,
layers = this._layers,
layer,
data = this.data;
var keySets = [_.difference(_.keys(data), this._exclusions)];
for (layerCounter = 0; layerCounter < layers.length; layerCounter++) {
layer = layers[layerCounter];
keySets.push(layer.getKeys(data[layer.key], context));
}
return _.union.apply(null, keySets);
} | [
"function",
"(",
"context",
")",
"{",
"context",
"=",
"context",
"||",
"{",
"}",
";",
"var",
"layerCounter",
",",
"layers",
"=",
"this",
".",
"_layers",
",",
"layer",
",",
"data",
"=",
"this",
".",
"data",
";",
"var",
"keySets",
"=",
"[",
"_",
".",... | Get the preference IDs that are set in this Scope. All layers are added
in. If context is not provided, the set of all keys in the Scope including
all keys in each layer will be returned.
@param {?Object} context Optional additional information for looking up the keys
@return {Array.<string>} Set of preferences set by this Scope | [
"Get",
"the",
"preference",
"IDs",
"that",
"are",
"set",
"in",
"this",
"Scope",
".",
"All",
"layers",
"are",
"added",
"in",
".",
"If",
"context",
"is",
"not",
"provided",
"the",
"set",
"of",
"all",
"keys",
"in",
"the",
"Scope",
"including",
"all",
"key... | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/preferences/PreferencesBase.js#L486-L501 | train | Returns the keys of all the keysets in this data object. | [
30522,
3853,
1006,
6123,
1007,
1063,
6123,
1027,
6123,
1064,
1064,
1063,
1065,
1025,
13075,
6741,
3597,
16671,
2121,
1010,
9014,
1027,
2023,
1012,
1035,
9014,
1010,
6741,
1010,
2951,
1027,
2023,
1012,
2951,
1025,
13075,
6309,
8454,
1027,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
adobe/brackets | src/project/ProjectManager.js | getAllFiles | function getAllFiles(filter, includeWorkingSet, sort) {
var viewFiles, deferred;
// The filter and includeWorkingSet params are both optional.
// Handle the case where filter is omitted but includeWorkingSet is
// specified.
if (includeWorkingSet === undefined && typeof (filter) !== "function") {
includeWorkingSet = filter;
filter = null;
}
if (includeWorkingSet) {
viewFiles = MainViewManager.getWorkingSet(MainViewManager.ALL_PANES);
}
deferred = new $.Deferred();
model.getAllFiles(filter, viewFiles, sort)
.done(function (fileList) {
deferred.resolve(fileList);
})
.fail(function (err) {
if (err === FileSystemError.TOO_MANY_ENTRIES && !_projectWarnedForTooManyFiles) {
_showErrorDialog(ERR_TYPE_MAX_FILES);
_projectWarnedForTooManyFiles = true;
}
// resolve with empty list
deferred.resolve([]);
});
return deferred.promise();
} | javascript | function getAllFiles(filter, includeWorkingSet, sort) {
var viewFiles, deferred;
// The filter and includeWorkingSet params are both optional.
// Handle the case where filter is omitted but includeWorkingSet is
// specified.
if (includeWorkingSet === undefined && typeof (filter) !== "function") {
includeWorkingSet = filter;
filter = null;
}
if (includeWorkingSet) {
viewFiles = MainViewManager.getWorkingSet(MainViewManager.ALL_PANES);
}
deferred = new $.Deferred();
model.getAllFiles(filter, viewFiles, sort)
.done(function (fileList) {
deferred.resolve(fileList);
})
.fail(function (err) {
if (err === FileSystemError.TOO_MANY_ENTRIES && !_projectWarnedForTooManyFiles) {
_showErrorDialog(ERR_TYPE_MAX_FILES);
_projectWarnedForTooManyFiles = true;
}
// resolve with empty list
deferred.resolve([]);
});
return deferred.promise();
} | [
"function",
"getAllFiles",
"(",
"filter",
",",
"includeWorkingSet",
",",
"sort",
")",
"{",
"var",
"viewFiles",
",",
"deferred",
";",
"// The filter and includeWorkingSet params are both optional.",
"// Handle the case where filter is omitted but includeWorkingSet is",
"// specified... | Returns an Array of all files for this project, optionally including
files in the working set that are *not* under the project root. Files are
filtered first by ProjectModel.shouldShow(), then by the custom filter
argument (if one was provided).
@param {function (File, number):boolean=} filter Optional function to filter
the file list (does not filter directory traversal). API matches Array.filter().
@param {boolean=} includeWorkingSet If true, include files in the working set
that are not under the project root (*except* for untitled documents).
@param {boolean=} sort If true, The files will be sorted by their paths
@return {$.Promise} Promise that is resolved with an Array of File objects. | [
"Returns",
"an",
"Array",
"of",
"all",
"files",
"for",
"this",
"project",
"optionally",
"including",
"files",
"in",
"the",
"working",
"set",
"that",
"are",
"*",
"not",
"*",
"under",
"the",
"project",
"root",
".",
"Files",
"are",
"filtered",
"first",
"by",
... | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/project/ProjectManager.js#L1394-L1423 | train | Get all files in the project | [
30522,
3853,
2131,
8095,
8873,
4244,
1006,
11307,
1010,
2421,
21398,
13462,
1010,
4066,
1007,
1063,
13075,
3193,
8873,
4244,
1010,
13366,
28849,
2094,
1025,
1013,
1013,
1996,
11307,
1998,
2421,
21398,
13462,
11498,
5244,
2024,
2119,
11887,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/routing/Target.js | checkUrl | function checkUrl() {
if (new UriParameters(window.location.href).get("sap-ui-xx-asyncRouting") === "true") {
Log.warning("Activation of async view loading in routing via url parameter is only temporarily supported and may be removed soon", "MobileTarget");
return true;
}
return false;
} | javascript | function checkUrl() {
if (new UriParameters(window.location.href).get("sap-ui-xx-asyncRouting") === "true") {
Log.warning("Activation of async view loading in routing via url parameter is only temporarily supported and may be removed soon", "MobileTarget");
return true;
}
return false;
} | [
"function",
"checkUrl",
"(",
")",
"{",
"if",
"(",
"new",
"UriParameters",
"(",
"window",
".",
"location",
".",
"href",
")",
".",
"get",
"(",
"\"sap-ui-xx-asyncRouting\"",
")",
"===",
"\"true\"",
")",
"{",
"Log",
".",
"warning",
"(",
"\"Activation of async vi... | temporarily: for checking the url param | [
"temporarily",
":",
"for",
"checking",
"the",
"url",
"param"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/routing/Target.js#L25-L31 | train | Checks if the url is valid | [
30522,
3853,
4638,
3126,
2140,
1006,
1007,
1063,
2065,
1006,
2047,
24471,
11514,
5400,
22828,
2015,
1006,
3332,
1012,
3295,
1012,
17850,
12879,
1007,
1012,
2131,
1006,
1000,
20066,
1011,
21318,
1011,
22038,
1011,
2004,
6038,
26775,
5833,
20... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.fl/src/sap/ui/fl/Utils.js | function (oComponent) {
var oSapApp = null;
// special case for Fiori Elements to reach the real appComponent
if (oComponent && oComponent.getAppComponent) {
return oComponent.getAppComponent();
}
// special case for OVP
if (oComponent && oComponent.oComponentData && oComponent.oComponentData.appComponent) {
return oComponent.oComponentData.appComponent;
}
if (oComponent && oComponent.getManifestEntry) {
oSapApp = oComponent.getManifestEntry("sap.app");
} else {
// if no manifest entry
return oComponent;
}
if (oSapApp && oSapApp.type && oSapApp.type !== "application") {
if (oComponent instanceof Component) {
// we need to call this method only when the component is an instance of Component in order to walk up the tree
// returns owner app component
oComponent = this._getComponentForControl(oComponent);
}
return this.getAppComponentForControl(oComponent);
}
return oComponent;
} | javascript | function (oComponent) {
var oSapApp = null;
// special case for Fiori Elements to reach the real appComponent
if (oComponent && oComponent.getAppComponent) {
return oComponent.getAppComponent();
}
// special case for OVP
if (oComponent && oComponent.oComponentData && oComponent.oComponentData.appComponent) {
return oComponent.oComponentData.appComponent;
}
if (oComponent && oComponent.getManifestEntry) {
oSapApp = oComponent.getManifestEntry("sap.app");
} else {
// if no manifest entry
return oComponent;
}
if (oSapApp && oSapApp.type && oSapApp.type !== "application") {
if (oComponent instanceof Component) {
// we need to call this method only when the component is an instance of Component in order to walk up the tree
// returns owner app component
oComponent = this._getComponentForControl(oComponent);
}
return this.getAppComponentForControl(oComponent);
}
return oComponent;
} | [
"function",
"(",
"oComponent",
")",
"{",
"var",
"oSapApp",
"=",
"null",
";",
"// special case for Fiori Elements to reach the real appComponent",
"if",
"(",
"oComponent",
"&&",
"oComponent",
".",
"getAppComponent",
")",
"{",
"return",
"oComponent",
".",
"getAppComponent... | Returns the Component that belongs to given component whose type is "application".
@param {sap.ui.core.Component} oComponent - SAPUI5 component
@returns {sap.ui.core.Component|null} component instance if found or null
@private | [
"Returns",
"the",
"Component",
"that",
"belongs",
"to",
"given",
"component",
"whose",
"type",
"is",
"application",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/Utils.js#L580-L609 | train | Returns the component that is the owner of the component | [
30522,
3853,
1006,
1051,
9006,
29513,
3372,
1007,
1063,
13075,
9808,
22068,
9397,
1027,
19701,
1025,
1013,
1013,
2569,
2553,
2005,
10882,
10050,
3787,
2000,
3362,
1996,
2613,
10439,
9006,
29513,
3372,
2065,
1006,
1051,
9006,
29513,
3372,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
adobe/brackets | src/extensions/default/CodeFolding/foldhelpers/foldgutter.js | init | function init() {
CodeMirror.defineOption("foldGutter", false, function (cm, val, old) {
if (old && old !== CodeMirror.Init) {
cm.clearGutter(cm.state.foldGutter.options.gutter);
cm.state.foldGutter = null;
cm.off("gutterClick", old.onGutterClick);
cm.off("change", onChange);
cm.off("viewportChange", onViewportChange);
cm.off("cursorActivity", onCursorActivity);
cm.off("fold", onFold);
cm.off("unfold", onUnFold);
cm.off("swapDoc", updateInViewport);
}
if (val) {
cm.state.foldGutter = new State(parseOptions(val));
updateInViewport(cm);
cm.on("gutterClick", val.onGutterClick);
cm.on("change", onChange);
cm.on("viewportChange", onViewportChange);
cm.on("cursorActivity", onCursorActivity);
cm.on("fold", onFold);
cm.on("unfold", onUnFold);
cm.on("swapDoc", updateInViewport);
}
});
} | javascript | function init() {
CodeMirror.defineOption("foldGutter", false, function (cm, val, old) {
if (old && old !== CodeMirror.Init) {
cm.clearGutter(cm.state.foldGutter.options.gutter);
cm.state.foldGutter = null;
cm.off("gutterClick", old.onGutterClick);
cm.off("change", onChange);
cm.off("viewportChange", onViewportChange);
cm.off("cursorActivity", onCursorActivity);
cm.off("fold", onFold);
cm.off("unfold", onUnFold);
cm.off("swapDoc", updateInViewport);
}
if (val) {
cm.state.foldGutter = new State(parseOptions(val));
updateInViewport(cm);
cm.on("gutterClick", val.onGutterClick);
cm.on("change", onChange);
cm.on("viewportChange", onViewportChange);
cm.on("cursorActivity", onCursorActivity);
cm.on("fold", onFold);
cm.on("unfold", onUnFold);
cm.on("swapDoc", updateInViewport);
}
});
} | [
"function",
"init",
"(",
")",
"{",
"CodeMirror",
".",
"defineOption",
"(",
"\"foldGutter\"",
",",
"false",
",",
"function",
"(",
"cm",
",",
"val",
",",
"old",
")",
"{",
"if",
"(",
"old",
"&&",
"old",
"!==",
"CodeMirror",
".",
"Init",
")",
"{",
"cm",
... | Initialises the fold gutter and registers event handlers for changes to document, viewport
and user interactions. | [
"Initialises",
"the",
"fold",
"gutter",
"and",
"registers",
"event",
"handlers",
"for",
"changes",
"to",
"document",
"viewport",
"and",
"user",
"interactions",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/CodeFolding/foldhelpers/foldgutter.js#L365-L391 | train | Initialize the fold gutter | [
30522,
3853,
1999,
4183,
1006,
1007,
1063,
3642,
14503,
29165,
1012,
9375,
7361,
3508,
1006,
1000,
10671,
27920,
3334,
1000,
1010,
6270,
1010,
3853,
1006,
4642,
1010,
11748,
1010,
2214,
1007,
1063,
2065,
1006,
2214,
1004,
1004,
2214,
999,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.m/src/sap/m/DateTimeInput.js | buildPickerByType | function buildPickerByType(type){
var oPicker;
switch (type) {
case DateTimeInputType.DateTime:
oPicker = new DateTimePicker(this.getId() + "-Picker");
break;
case DateTimeInputType.Time:
oPicker = new TimePicker(this.getId() + "-Picker",
{localeId: sap.ui.getCore().getConfiguration().getFormatSettings().getFormatLocale().toString()});
break;
default: // default is date
oPicker = new DatePicker(this.getId() + "-Picker");
break;
}
// forward properties (also set default, may be different)
oPicker.setDisplayFormat(this.getDisplayFormat() || this._types[type].displayFormat);
oPicker.setValueFormat(this.getValueFormat() || this._types[type].valueFormat);
if (this.getDateValue()) {
oPicker.setDateValue(this.getDateValue()); // don't set Value -> as by switching type information can be lost
}
oPicker.setEnabled(this.getEnabled());
oPicker.setEditable(this.getEditable());
oPicker.setValueState(this.getValueState());
oPicker.setValueStateText(this.getValueStateText());
oPicker.setShowValueStateMessage(this.getShowValueStateMessage());
oPicker.setName(this.getName());
oPicker.setPlaceholder(this.getPlaceholder());
oPicker.setTextAlign(this.getTextAlign());
oPicker.setTextDirection(this.getTextDirection());
oPicker.setWidth("100%");
oPicker.attachChange(_handleChange, this);
var aAriaLabelledBy = this.getAriaLabelledBy();
for (var i = 0; i < aAriaLabelledBy.length; i++) {
oPicker.addAriaLabelledBy(aAriaLabelledBy[i]);
}
return oPicker;
} | javascript | function buildPickerByType(type){
var oPicker;
switch (type) {
case DateTimeInputType.DateTime:
oPicker = new DateTimePicker(this.getId() + "-Picker");
break;
case DateTimeInputType.Time:
oPicker = new TimePicker(this.getId() + "-Picker",
{localeId: sap.ui.getCore().getConfiguration().getFormatSettings().getFormatLocale().toString()});
break;
default: // default is date
oPicker = new DatePicker(this.getId() + "-Picker");
break;
}
// forward properties (also set default, may be different)
oPicker.setDisplayFormat(this.getDisplayFormat() || this._types[type].displayFormat);
oPicker.setValueFormat(this.getValueFormat() || this._types[type].valueFormat);
if (this.getDateValue()) {
oPicker.setDateValue(this.getDateValue()); // don't set Value -> as by switching type information can be lost
}
oPicker.setEnabled(this.getEnabled());
oPicker.setEditable(this.getEditable());
oPicker.setValueState(this.getValueState());
oPicker.setValueStateText(this.getValueStateText());
oPicker.setShowValueStateMessage(this.getShowValueStateMessage());
oPicker.setName(this.getName());
oPicker.setPlaceholder(this.getPlaceholder());
oPicker.setTextAlign(this.getTextAlign());
oPicker.setTextDirection(this.getTextDirection());
oPicker.setWidth("100%");
oPicker.attachChange(_handleChange, this);
var aAriaLabelledBy = this.getAriaLabelledBy();
for (var i = 0; i < aAriaLabelledBy.length; i++) {
oPicker.addAriaLabelledBy(aAriaLabelledBy[i]);
}
return oPicker;
} | [
"function",
"buildPickerByType",
"(",
"type",
")",
"{",
"var",
"oPicker",
";",
"switch",
"(",
"type",
")",
"{",
"case",
"DateTimeInputType",
".",
"DateTime",
":",
"oPicker",
"=",
"new",
"DateTimePicker",
"(",
"this",
".",
"getId",
"(",
")",
"+",
"\"-Picker... | Creates an instance of picker depending of the given property type
@param {sap.m.DateTimeInputType} type the type
@returns {sap.ui.core.Control} picker implementation, that may be one of <code>sap.m.DatePicker</code>,
<code>sap.m.TimePicker</code> or <code>sap.m.DateTimePicker</code>. | [
"Creates",
"an",
"instance",
"of",
"picker",
"depending",
"of",
"the",
"given",
"property",
"type"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/DateTimeInput.js#L276-L317 | train | Creates a new instance of the picker based on the type of the input. | [
30522,
3853,
3857,
24330,
5484,
3762,
13874,
1006,
2828,
1007,
1063,
13075,
6728,
6799,
2121,
1025,
6942,
1006,
2828,
1007,
1063,
2553,
3058,
7292,
2378,
18780,
13874,
1012,
3058,
7292,
1024,
6728,
6799,
2121,
1027,
2047,
3058,
7292,
24330,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.fl/src/sap/ui/fl/registry/ChangeTypeMetadata.js | function(mParam) {
if (!mParam.name) {
Utils.log.error("sap.ui.fl.registry.ChangeType: Name required");
}
if (!mParam.changeHandler) {
Utils.log.error("sap.ui.fl.registry.ChangeType: ChangeHandler required");
}
this._name = mParam.name;
this._changeHandler = mParam.changeHandler;
this._layers = mParam.layers;
if (mParam.labelKey) {
this._labelKey = mParam.labelKey;
}
if (mParam.tooltipKey) {
this._tooltipKey = mParam.tooltipKey;
}
if (mParam.iconKey) {
this._iconKey = mParam.iconKey;
}
if (mParam.sortIndex) {
this._sortIndex = mParam.sortIndex;
}
} | javascript | function(mParam) {
if (!mParam.name) {
Utils.log.error("sap.ui.fl.registry.ChangeType: Name required");
}
if (!mParam.changeHandler) {
Utils.log.error("sap.ui.fl.registry.ChangeType: ChangeHandler required");
}
this._name = mParam.name;
this._changeHandler = mParam.changeHandler;
this._layers = mParam.layers;
if (mParam.labelKey) {
this._labelKey = mParam.labelKey;
}
if (mParam.tooltipKey) {
this._tooltipKey = mParam.tooltipKey;
}
if (mParam.iconKey) {
this._iconKey = mParam.iconKey;
}
if (mParam.sortIndex) {
this._sortIndex = mParam.sortIndex;
}
} | [
"function",
"(",
"mParam",
")",
"{",
"if",
"(",
"!",
"mParam",
".",
"name",
")",
"{",
"Utils",
".",
"log",
".",
"error",
"(",
"\"sap.ui.fl.registry.ChangeType: Name required\"",
")",
";",
"}",
"if",
"(",
"!",
"mParam",
".",
"changeHandler",
")",
"{",
"Ut... | Object to define a change type with it's handlers and visual appearance options
@constructor
@param {Object} mParam Parameter description below
@param {String} mParam.name Semantic name to identify the change type
@param {String} mParam.changeHandler Full qualified name of the function which is executed when a change for this change type is merged or applied
@param {String} [mParam.labelKey] Key of the translatable label
@param {String} [mParam.tooltipKey] Key of the translatable tooltip
@param {String} [mParam.iconKey] Key of the icon which should be displayed
@param {Object} [mParam.sortIndex] Index to sort the change type on the visualization. (0 = default, lowest priority)
@alias sap.ui.fl.registry.ChangeTypeMetadata
@author SAP SE
@version ${version}
@experimental Since 1.27.0 | [
"Object",
"to",
"define",
"a",
"change",
"type",
"with",
"it",
"s",
"handlers",
"and",
"visual",
"appearance",
"options",
"@constructor",
"@param",
"{",
"Object",
"}",
"mParam",
"Parameter",
"description",
"below",
"@param",
"{",
"String",
"}",
"mParam",
".",
... | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/registry/ChangeTypeMetadata.js#L25-L49 | train | Sets the parameters of the ChangeType | [
30522,
3853,
1006,
6131,
5400,
2213,
1007,
1063,
2065,
1006,
999,
6131,
5400,
2213,
1012,
2171,
1007,
1063,
21183,
12146,
1012,
8833,
1012,
7561,
1006,
1000,
20066,
1012,
21318,
1012,
13109,
1012,
15584,
1012,
2689,
13874,
1024,
2171,
3223,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
GitbookIO/gitbook | lib/parse/parseStructureFile.js | parseFile | function parseFile(fs, file, type) {
var filepath = file.getPath();
var parser = file.getParser();
if (!parser) {
return Promise.reject(
error.FileNotParsableError({
filename: filepath
})
);
}
return fs.readAsString(filepath)
.then(function(content) {
if (type === 'readme') {
return parser.parseReadme(content);
} else if (type === 'glossary') {
return parser.parseGlossary(content);
} else if (type === 'summary') {
return parser.parseSummary(content);
} else if (type === 'langs') {
return parser.parseLanguages(content);
} else {
throw new Error('Parsing invalid type "' + type + '"');
}
})
.then(function(result) {
return [
file,
result
];
});
} | javascript | function parseFile(fs, file, type) {
var filepath = file.getPath();
var parser = file.getParser();
if (!parser) {
return Promise.reject(
error.FileNotParsableError({
filename: filepath
})
);
}
return fs.readAsString(filepath)
.then(function(content) {
if (type === 'readme') {
return parser.parseReadme(content);
} else if (type === 'glossary') {
return parser.parseGlossary(content);
} else if (type === 'summary') {
return parser.parseSummary(content);
} else if (type === 'langs') {
return parser.parseLanguages(content);
} else {
throw new Error('Parsing invalid type "' + type + '"');
}
})
.then(function(result) {
return [
file,
result
];
});
} | [
"function",
"parseFile",
"(",
"fs",
",",
"file",
",",
"type",
")",
"{",
"var",
"filepath",
"=",
"file",
".",
"getPath",
"(",
")",
";",
"var",
"parser",
"=",
"file",
".",
"getParser",
"(",
")",
";",
"if",
"(",
"!",
"parser",
")",
"{",
"return",
"P... | Parse a ParsableFile using a specific method
@param {FS} fs
@param {ParsableFile} file
@param {String} type
@return {Promise<Array<String, List|Map>>} | [
"Parse",
"a",
"ParsableFile",
"using",
"a",
"specific",
"method"
] | 6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4 | https://github.com/GitbookIO/gitbook/blob/6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4/lib/parse/parseStructureFile.js#L13-L45 | train | Parse a file | [
30522,
3853,
11968,
20106,
9463,
1006,
1042,
2015,
1010,
5371,
1010,
2828,
1007,
1063,
13075,
5371,
15069,
1027,
5371,
1012,
2131,
15069,
1006,
1007,
1025,
13075,
11968,
8043,
1027,
5371,
1012,
2131,
19362,
8043,
1006,
1007,
1025,
30524,
12... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/base/util/deepEqual.js | function(a, b, maxDepth, contains, depth) {
// Optional parameter normalization
if (typeof maxDepth == "boolean") {
contains = maxDepth;
maxDepth = undefined;
}
if (!depth) {
depth = 0;
}
if (!maxDepth) {
maxDepth = 10;
}
if (depth > maxDepth) {
Log.warning("deepEqual comparison exceeded maximum recursion depth of " + maxDepth + ". Treating values as unequal");
return false;
}
if (a === b) {
return true;
}
// Number.isNaN is not supported by IE11, so we need to fall back on the verbose implementation
var bIsReallyNaN = (typeof a === "number" && typeof b === "number" && isNaN(a) && isNaN(b));
if (bIsReallyNaN) {
return true;
}
if (Array.isArray(a) && Array.isArray(b)) {
if (!contains && a.length !== b.length) {
return false;
}
if (a.length > b.length) {
return false;
}
for (var i = 0; i < a.length; i++) {
if (!fnEqual(a[i], b[i], maxDepth, contains, depth + 1)) {
return false;
}
}
return true;
}
if (typeof a == "object" && typeof b == "object") {
if (!a || !b) {
return false;
}
if (a.constructor !== b.constructor) {
return false;
}
if (!contains && Object.keys(a).length !== Object.keys(b).length) {
return false;
}
if (a instanceof Node) {
return a.isEqualNode(b);
}
if (a instanceof Date) {
return a.valueOf() === b.valueOf();
}
for (var i in a) {
if (!fnEqual(a[i], b[i], maxDepth, contains, depth + 1)) {
return false;
}
}
return true;
}
return false;
} | javascript | function(a, b, maxDepth, contains, depth) {
// Optional parameter normalization
if (typeof maxDepth == "boolean") {
contains = maxDepth;
maxDepth = undefined;
}
if (!depth) {
depth = 0;
}
if (!maxDepth) {
maxDepth = 10;
}
if (depth > maxDepth) {
Log.warning("deepEqual comparison exceeded maximum recursion depth of " + maxDepth + ". Treating values as unequal");
return false;
}
if (a === b) {
return true;
}
// Number.isNaN is not supported by IE11, so we need to fall back on the verbose implementation
var bIsReallyNaN = (typeof a === "number" && typeof b === "number" && isNaN(a) && isNaN(b));
if (bIsReallyNaN) {
return true;
}
if (Array.isArray(a) && Array.isArray(b)) {
if (!contains && a.length !== b.length) {
return false;
}
if (a.length > b.length) {
return false;
}
for (var i = 0; i < a.length; i++) {
if (!fnEqual(a[i], b[i], maxDepth, contains, depth + 1)) {
return false;
}
}
return true;
}
if (typeof a == "object" && typeof b == "object") {
if (!a || !b) {
return false;
}
if (a.constructor !== b.constructor) {
return false;
}
if (!contains && Object.keys(a).length !== Object.keys(b).length) {
return false;
}
if (a instanceof Node) {
return a.isEqualNode(b);
}
if (a instanceof Date) {
return a.valueOf() === b.valueOf();
}
for (var i in a) {
if (!fnEqual(a[i], b[i], maxDepth, contains, depth + 1)) {
return false;
}
}
return true;
}
return false;
} | [
"function",
"(",
"a",
",",
"b",
",",
"maxDepth",
",",
"contains",
",",
"depth",
")",
"{",
"// Optional parameter normalization",
"if",
"(",
"typeof",
"maxDepth",
"==",
"\"boolean\"",
")",
"{",
"contains",
"=",
"maxDepth",
";",
"maxDepth",
"=",
"undefined",
"... | Compares the two given values for equality, especially by comparing the content.
Note: function does not work with comparing XML objects
@function
@since 1.58
@param {any} a A value of any type
@param {any} b A value of any type
@param {int} [maxDepth=10] Maximum recursion depth
@param {boolean} [contains] Whether all existing properties in a are equal as in b
@alias module:sap/base/util/deepEqual
@return {boolean} Whether a and b are equal
@public | [
"Compares",
"the",
"two",
"given",
"values",
"for",
"equality",
"especially",
"by",
"comparing",
"the",
"content",
".",
"Note",
":",
"function",
"does",
"not",
"work",
"with",
"comparing",
"XML",
"objects"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/base/util/deepEqual.js#L26-L90 | train | Returns true if a is deep equal to b | [
30522,
3853,
1006,
1037,
1010,
1038,
1010,
4098,
3207,
13876,
2232,
1010,
3397,
1010,
5995,
1007,
1063,
1013,
1013,
11887,
16381,
3671,
3989,
2065,
1006,
2828,
11253,
4098,
3207,
13876,
2232,
1027,
1027,
1000,
22017,
20898,
1000,
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... | |
jhipster/generator-jhipster | generators/docker-prompts.js | askForConsoleOptions | function askForConsoleOptions() {
if (this.regenerate) return;
if (this.monitoring !== 'elk') return;
const done = this.async();
const prompts = [
{
type: 'checkbox',
name: 'consoleOptions',
message:
'You have selected the JHipster Console which is based on the ELK stack and additional technologies, which one do you want to use ?',
choices: [
{
value: 'curator',
name: 'Curator, to help you curate and manage your Elasticsearch indices'
}
],
default: this.monitoring
}
];
if (this.deploymentApplicationType === 'microservice') {
prompts[0].choices.push({
value: 'zipkin',
name: 'Zipkin, for distributed tracing (only compatible with JHipster >= v4.2.0)'
});
}
this.prompt(prompts).then(props => {
this.consoleOptions = props.consoleOptions;
done();
});
} | javascript | function askForConsoleOptions() {
if (this.regenerate) return;
if (this.monitoring !== 'elk') return;
const done = this.async();
const prompts = [
{
type: 'checkbox',
name: 'consoleOptions',
message:
'You have selected the JHipster Console which is based on the ELK stack and additional technologies, which one do you want to use ?',
choices: [
{
value: 'curator',
name: 'Curator, to help you curate and manage your Elasticsearch indices'
}
],
default: this.monitoring
}
];
if (this.deploymentApplicationType === 'microservice') {
prompts[0].choices.push({
value: 'zipkin',
name: 'Zipkin, for distributed tracing (only compatible with JHipster >= v4.2.0)'
});
}
this.prompt(prompts).then(props => {
this.consoleOptions = props.consoleOptions;
done();
});
} | [
"function",
"askForConsoleOptions",
"(",
")",
"{",
"if",
"(",
"this",
".",
"regenerate",
")",
"return",
";",
"if",
"(",
"this",
".",
"monitoring",
"!==",
"'elk'",
")",
"return",
";",
"const",
"done",
"=",
"this",
".",
"async",
"(",
")",
";",
"const",
... | Ask For Console Options | [
"Ask",
"For",
"Console",
"Options"
] | f76fa8de0818ce6bda6c7b1455942e2a9b0ae3ff | https://github.com/jhipster/generator-jhipster/blob/f76fa8de0818ce6bda6c7b1455942e2a9b0ae3ff/generators/docker-prompts.js#L270-L302 | train | Ask For Console Options | [
30522,
3853,
3198,
29278,
8663,
19454,
8780,
16790,
2015,
1006,
1007,
1063,
2065,
1006,
2023,
1012,
19723,
24454,
3686,
1007,
2709,
1025,
2065,
1006,
2023,
1012,
8822,
999,
1027,
1027,
1005,
18995,
1005,
1007,
2709,
1025,
9530,
3367,
2589,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
eslint/eslint | lib/config/config-validator.js | validateRules | function validateRules(rulesConfig, ruleMapper, source = null) {
if (!rulesConfig) {
return;
}
Object.keys(rulesConfig).forEach(id => {
validateRuleOptions(ruleMapper(id), id, rulesConfig[id], source);
});
} | javascript | function validateRules(rulesConfig, ruleMapper, source = null) {
if (!rulesConfig) {
return;
}
Object.keys(rulesConfig).forEach(id => {
validateRuleOptions(ruleMapper(id), id, rulesConfig[id], source);
});
} | [
"function",
"validateRules",
"(",
"rulesConfig",
",",
"ruleMapper",
",",
"source",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"rulesConfig",
")",
"{",
"return",
";",
"}",
"Object",
".",
"keys",
"(",
"rulesConfig",
")",
".",
"forEach",
"(",
"id",
"=>",
"{",... | Validates a rules config object
@param {Object} rulesConfig The rules config object to validate.
@param {function(string): {create: Function}} ruleMapper A mapper function from strings to loaded rules
@param {string} source The name of the configuration source to report in any errors.
@returns {void} | [
"Validates",
"a",
"rules",
"config",
"object"
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/config/config-validator.js#L171-L179 | train | Validate rules config | [
30522,
3853,
9398,
24932,
16308,
1006,
3513,
8663,
8873,
2290,
1010,
3627,
2863,
18620,
1010,
3120,
1027,
19701,
1007,
1063,
2065,
1006,
999,
3513,
8663,
8873,
2290,
1007,
1063,
2709,
1025,
1065,
4874,
1012,
6309,
1006,
3513,
8663,
8873,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/core/RenderManager.js | reset | function reset() {
aBuffer = that.aBuffer = [];
aRenderedControls = that.aRenderedControls = [];
aStyleStack = that.aStyleStack = [{}];
} | javascript | function reset() {
aBuffer = that.aBuffer = [];
aRenderedControls = that.aRenderedControls = [];
aStyleStack = that.aStyleStack = [{}];
} | [
"function",
"reset",
"(",
")",
"{",
"aBuffer",
"=",
"that",
".",
"aBuffer",
"=",
"[",
"]",
";",
"aRenderedControls",
"=",
"that",
".",
"aRenderedControls",
"=",
"[",
"]",
";",
"aStyleStack",
"=",
"that",
".",
"aStyleStack",
"=",
"[",
"{",
"}",
"]",
"... | Reset all rendering related buffers. | [
"Reset",
"all",
"rendering",
"related",
"buffers",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/RenderManager.js#L114-L118 | train | Reset the internal state | [
30522,
3853,
25141,
1006,
1007,
1063,
8273,
12494,
1027,
2008,
1012,
8273,
12494,
1027,
1031,
1033,
1025,
4995,
4063,
2098,
8663,
13181,
4877,
1027,
2008,
1012,
4995,
4063,
2098,
8663,
13181,
4877,
1027,
1031,
1033,
1025,
2004,
27983,
9153,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
webdriverio/webdriverio | packages/wdio-sync/src/index.js | function (hookFn, origFn, before, after, repeatTest = 0) {
const hookError = (hookName) => (e) => log.error(`Error in ${hookName}: ${e.stack}`)
return origFn(function (...hookArgs) {
// Print errors encountered in beforeHook and afterHook to console, but
// don't propagate them to avoid failing the test. However, errors in
// framework hook functions should fail the test, so propagate those.
return executeHooksWithArgs(before).catch(hookError('beforeHook')).then(() => {
/**
* user wants handle async command using promises, no need to wrap in fiber context
*/
if (hookFn.name === 'async') {
return executeAsync.call(this, hookFn, repeatTest, filterSpecArgs(hookArgs))
}
return new Promise(runSync.call(this, hookFn, repeatTest, filterSpecArgs(hookArgs)))
}).then(() => {
return executeHooksWithArgs(after).catch(hookError('afterHook'))
})
})
} | javascript | function (hookFn, origFn, before, after, repeatTest = 0) {
const hookError = (hookName) => (e) => log.error(`Error in ${hookName}: ${e.stack}`)
return origFn(function (...hookArgs) {
// Print errors encountered in beforeHook and afterHook to console, but
// don't propagate them to avoid failing the test. However, errors in
// framework hook functions should fail the test, so propagate those.
return executeHooksWithArgs(before).catch(hookError('beforeHook')).then(() => {
/**
* user wants handle async command using promises, no need to wrap in fiber context
*/
if (hookFn.name === 'async') {
return executeAsync.call(this, hookFn, repeatTest, filterSpecArgs(hookArgs))
}
return new Promise(runSync.call(this, hookFn, repeatTest, filterSpecArgs(hookArgs)))
}).then(() => {
return executeHooksWithArgs(after).catch(hookError('afterHook'))
})
})
} | [
"function",
"(",
"hookFn",
",",
"origFn",
",",
"before",
",",
"after",
",",
"repeatTest",
"=",
"0",
")",
"{",
"const",
"hookError",
"=",
"(",
"hookName",
")",
"=>",
"(",
"e",
")",
"=>",
"log",
".",
"error",
"(",
"`",
"${",
"hookName",
"}",
"${",
... | runs a hook within fibers context (if function name is not async)
it also executes before/after hook hook
@param {Function} hookFn function that was passed to the framework hook
@param {Function} origFn original framework hook function
@param {Function} before before hook hook
@param {Function} after after hook hook
@param {Number} repeatTest number of retries if hook fails
@return {Function} wrapped framework hook function | [
"runs",
"a",
"hook",
"within",
"fibers",
"context",
"(",
"if",
"function",
"name",
"is",
"not",
"async",
")",
"it",
"also",
"executes",
"before",
"/",
"after",
"hook",
"hook"
] | 8de7f1a3b12d97282ed4ee2e25e4c3c9a8940ac1 | https://github.com/webdriverio/webdriverio/blob/8de7f1a3b12d97282ed4ee2e25e4c3c9a8940ac1/packages/wdio-sync/src/index.js#L111-L131 | train | Executes a function in sequence | [
30522,
3853,
1006,
8103,
2546,
2078,
1010,
2030,
8004,
2546,
2078,
1010,
2077,
1010,
2044,
1010,
9377,
22199,
1027,
1014,
1007,
1063,
9530,
3367,
17074,
29165,
1027,
1006,
8103,
18442,
1007,
1027,
1028,
1006,
1041,
1007,
1027,
1028,
8833,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/menu/js/menuServiceProvider.js | activateInteraction | function activateInteraction() {
if (!opts.menuContentEl[0]) return angular.noop;
// Wire up keyboard listeners.
// - Close on escape,
// - focus next item on down arrow,
// - focus prev item on up
opts.menuContentEl.on('keydown', onMenuKeyDown);
opts.menuContentEl[0].addEventListener('click', captureClickListener, true);
// kick off initial focus in the menu on the first enabled element
var focusTarget = opts.menuContentEl[0]
.querySelector(prefixer.buildSelector(['md-menu-focus-target', 'md-autofocus']));
if (!focusTarget) {
var childrenLen = opts.menuContentEl[0].children.length;
for (var childIndex = 0; childIndex < childrenLen; childIndex++) {
var child = opts.menuContentEl[0].children[childIndex];
focusTarget = child.querySelector('.md-button:not([disabled])');
if (focusTarget) {
break;
}
if (child.firstElementChild && !child.firstElementChild.disabled) {
focusTarget = child.firstElementChild;
break;
}
}
}
focusTarget && focusTarget.focus();
return function cleanupInteraction() {
opts.menuContentEl.off('keydown', onMenuKeyDown);
opts.menuContentEl[0].removeEventListener('click', captureClickListener, true);
};
// ************************************
// internal functions
// ************************************
function onMenuKeyDown(ev) {
var handled;
switch (ev.keyCode) {
case $mdConstant.KEY_CODE.ESCAPE:
opts.mdMenuCtrl.close(false, { closeAll: true });
handled = true;
break;
case $mdConstant.KEY_CODE.TAB:
opts.mdMenuCtrl.close(false, { closeAll: true });
// Don't prevent default or stop propagation on this event as we want tab
// to move the focus to the next focusable element on the page.
handled = false;
break;
case $mdConstant.KEY_CODE.UP_ARROW:
if (!focusMenuItem(ev, opts.menuContentEl, opts, -1) && !opts.nestLevel) {
opts.mdMenuCtrl.triggerContainerProxy(ev);
}
handled = true;
break;
case $mdConstant.KEY_CODE.DOWN_ARROW:
if (!focusMenuItem(ev, opts.menuContentEl, opts, 1) && !opts.nestLevel) {
opts.mdMenuCtrl.triggerContainerProxy(ev);
}
handled = true;
break;
case $mdConstant.KEY_CODE.LEFT_ARROW:
if (opts.nestLevel) {
opts.mdMenuCtrl.close();
} else {
opts.mdMenuCtrl.triggerContainerProxy(ev);
}
handled = true;
break;
case $mdConstant.KEY_CODE.RIGHT_ARROW:
var parentMenu = $mdUtil.getClosest(ev.target, 'MD-MENU');
if (parentMenu && parentMenu != opts.parent[0]) {
ev.target.click();
} else {
opts.mdMenuCtrl.triggerContainerProxy(ev);
}
handled = true;
break;
}
if (handled) {
ev.preventDefault();
ev.stopImmediatePropagation();
}
}
function onBackdropClick(e) {
e.preventDefault();
e.stopPropagation();
scope.$apply(function() {
opts.mdMenuCtrl.close(true, { closeAll: true });
});
}
// Close menu on menu item click, if said menu-item is not disabled
function captureClickListener(e) {
var target = e.target;
// Traverse up the event until we get to the menuContentEl to see if
// there is an ng-click and that the ng-click is not disabled
do {
if (target == opts.menuContentEl[0]) return;
if ((hasAnyAttribute(target, ['ng-click', 'ng-href', 'ui-sref']) ||
target.nodeName == 'BUTTON' || target.nodeName == 'MD-BUTTON') && !hasAnyAttribute(target, ['md-prevent-menu-close'])) {
var closestMenu = $mdUtil.getClosest(target, 'MD-MENU');
if (!target.hasAttribute('disabled') && (!closestMenu || closestMenu == opts.parent[0])) {
close();
}
break;
}
} while (target = target.parentNode);
function close() {
scope.$apply(function() {
opts.mdMenuCtrl.close(true, { closeAll: true });
});
}
function hasAnyAttribute(target, attrs) {
if (!target) return false;
for (var i = 0, attr; attr = attrs[i]; ++i) {
if (prefixer.hasAttribute(target, attr)) {
return true;
}
}
return false;
}
}
} | javascript | function activateInteraction() {
if (!opts.menuContentEl[0]) return angular.noop;
// Wire up keyboard listeners.
// - Close on escape,
// - focus next item on down arrow,
// - focus prev item on up
opts.menuContentEl.on('keydown', onMenuKeyDown);
opts.menuContentEl[0].addEventListener('click', captureClickListener, true);
// kick off initial focus in the menu on the first enabled element
var focusTarget = opts.menuContentEl[0]
.querySelector(prefixer.buildSelector(['md-menu-focus-target', 'md-autofocus']));
if (!focusTarget) {
var childrenLen = opts.menuContentEl[0].children.length;
for (var childIndex = 0; childIndex < childrenLen; childIndex++) {
var child = opts.menuContentEl[0].children[childIndex];
focusTarget = child.querySelector('.md-button:not([disabled])');
if (focusTarget) {
break;
}
if (child.firstElementChild && !child.firstElementChild.disabled) {
focusTarget = child.firstElementChild;
break;
}
}
}
focusTarget && focusTarget.focus();
return function cleanupInteraction() {
opts.menuContentEl.off('keydown', onMenuKeyDown);
opts.menuContentEl[0].removeEventListener('click', captureClickListener, true);
};
// ************************************
// internal functions
// ************************************
function onMenuKeyDown(ev) {
var handled;
switch (ev.keyCode) {
case $mdConstant.KEY_CODE.ESCAPE:
opts.mdMenuCtrl.close(false, { closeAll: true });
handled = true;
break;
case $mdConstant.KEY_CODE.TAB:
opts.mdMenuCtrl.close(false, { closeAll: true });
// Don't prevent default or stop propagation on this event as we want tab
// to move the focus to the next focusable element on the page.
handled = false;
break;
case $mdConstant.KEY_CODE.UP_ARROW:
if (!focusMenuItem(ev, opts.menuContentEl, opts, -1) && !opts.nestLevel) {
opts.mdMenuCtrl.triggerContainerProxy(ev);
}
handled = true;
break;
case $mdConstant.KEY_CODE.DOWN_ARROW:
if (!focusMenuItem(ev, opts.menuContentEl, opts, 1) && !opts.nestLevel) {
opts.mdMenuCtrl.triggerContainerProxy(ev);
}
handled = true;
break;
case $mdConstant.KEY_CODE.LEFT_ARROW:
if (opts.nestLevel) {
opts.mdMenuCtrl.close();
} else {
opts.mdMenuCtrl.triggerContainerProxy(ev);
}
handled = true;
break;
case $mdConstant.KEY_CODE.RIGHT_ARROW:
var parentMenu = $mdUtil.getClosest(ev.target, 'MD-MENU');
if (parentMenu && parentMenu != opts.parent[0]) {
ev.target.click();
} else {
opts.mdMenuCtrl.triggerContainerProxy(ev);
}
handled = true;
break;
}
if (handled) {
ev.preventDefault();
ev.stopImmediatePropagation();
}
}
function onBackdropClick(e) {
e.preventDefault();
e.stopPropagation();
scope.$apply(function() {
opts.mdMenuCtrl.close(true, { closeAll: true });
});
}
// Close menu on menu item click, if said menu-item is not disabled
function captureClickListener(e) {
var target = e.target;
// Traverse up the event until we get to the menuContentEl to see if
// there is an ng-click and that the ng-click is not disabled
do {
if (target == opts.menuContentEl[0]) return;
if ((hasAnyAttribute(target, ['ng-click', 'ng-href', 'ui-sref']) ||
target.nodeName == 'BUTTON' || target.nodeName == 'MD-BUTTON') && !hasAnyAttribute(target, ['md-prevent-menu-close'])) {
var closestMenu = $mdUtil.getClosest(target, 'MD-MENU');
if (!target.hasAttribute('disabled') && (!closestMenu || closestMenu == opts.parent[0])) {
close();
}
break;
}
} while (target = target.parentNode);
function close() {
scope.$apply(function() {
opts.mdMenuCtrl.close(true, { closeAll: true });
});
}
function hasAnyAttribute(target, attrs) {
if (!target) return false;
for (var i = 0, attr; attr = attrs[i]; ++i) {
if (prefixer.hasAttribute(target, attr)) {
return true;
}
}
return false;
}
}
} | [
"function",
"activateInteraction",
"(",
")",
"{",
"if",
"(",
"!",
"opts",
".",
"menuContentEl",
"[",
"0",
"]",
")",
"return",
"angular",
".",
"noop",
";",
"// Wire up keyboard listeners.",
"// - Close on escape,",
"// - focus next item on down arrow,",
"// - focus prev ... | Activate interaction on the menu. Resolves the focus target and closes the menu on
escape or option click.
@returns {!Function} Function to deactivate the interaction listeners. | [
"Activate",
"interaction",
"on",
"the",
"menu",
".",
"Resolves",
"the",
"focus",
"target",
"and",
"closes",
"the",
"menu",
"on",
"escape",
"or",
"option",
"click",
"."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/menu/js/menuServiceProvider.js#L248-L381 | train | Activates the interaction. | [
30522,
3853,
20544,
18447,
6906,
7542,
1006,
1007,
1063,
2065,
1006,
999,
23569,
2015,
1012,
12183,
8663,
6528,
9834,
1031,
1014,
1033,
1007,
2709,
16108,
1012,
2053,
7361,
1025,
1013,
1013,
7318,
2039,
9019,
13810,
1012,
1013,
1013,
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... |
GitbookIO/gitbook | lib/utils/promise.js | some | function some(arr, iter) {
arr = Immutable.List(arr);
return arr.reduce(function(prev, elem, i) {
return prev.then(function(val) {
if (val) return val;
return iter(elem, i);
});
}, Q());
} | javascript | function some(arr, iter) {
arr = Immutable.List(arr);
return arr.reduce(function(prev, elem, i) {
return prev.then(function(val) {
if (val) return val;
return iter(elem, i);
});
}, Q());
} | [
"function",
"some",
"(",
"arr",
",",
"iter",
")",
"{",
"arr",
"=",
"Immutable",
".",
"List",
"(",
"arr",
")",
";",
"return",
"arr",
".",
"reduce",
"(",
"function",
"(",
"prev",
",",
"elem",
",",
"i",
")",
"{",
"return",
"prev",
".",
"then",
"(",
... | Iter over an array and return first result (not null)
@param {Array|List} arr
@param {Function(element, index)}
@return {Promise<Mixed>} | [
"Iter",
"over",
"an",
"array",
"and",
"return",
"first",
"result",
"(",
"not",
"null",
")"
] | 6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4 | https://github.com/GitbookIO/gitbook/blob/6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4/lib/utils/promise.js#L64-L74 | train | returns a promise that resolves to a promise | [
30522,
3853,
2070,
1006,
12098,
2099,
1010,
2009,
2121,
1007,
1063,
12098,
2099,
1027,
10047,
28120,
3085,
1012,
2862,
1006,
12098,
2099,
1007,
1025,
2709,
12098,
2099,
1012,
5547,
1006,
3853,
1006,
3653,
2615,
1010,
3449,
6633,
1010,
1045,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
vuejs/vuex | src/helpers.js | getModuleByNamespace | function getModuleByNamespace (store, helper, namespace) {
const module = store._modulesNamespaceMap[namespace]
if (process.env.NODE_ENV !== 'production' && !module) {
console.error(`[vuex] module namespace not found in ${helper}(): ${namespace}`)
}
return module
} | javascript | function getModuleByNamespace (store, helper, namespace) {
const module = store._modulesNamespaceMap[namespace]
if (process.env.NODE_ENV !== 'production' && !module) {
console.error(`[vuex] module namespace not found in ${helper}(): ${namespace}`)
}
return module
} | [
"function",
"getModuleByNamespace",
"(",
"store",
",",
"helper",
",",
"namespace",
")",
"{",
"const",
"module",
"=",
"store",
".",
"_modulesNamespaceMap",
"[",
"namespace",
"]",
"if",
"(",
"process",
".",
"env",
".",
"NODE_ENV",
"!==",
"'production'",
"&&",
... | Search a special module from store by namespace. if module not exist, print error message.
@param {Object} store
@param {String} helper
@param {String} namespace
@return {Object} | [
"Search",
"a",
"special",
"module",
"from",
"store",
"by",
"namespace",
".",
"if",
"module",
"not",
"exist",
"print",
"error",
"message",
"."
] | d7c7f9844831f98c5c9aaca213746c4ccc5d6929 | https://github.com/vuejs/vuex/blob/d7c7f9844831f98c5c9aaca213746c4ccc5d6929/src/helpers.js#L161-L167 | train | Get module by namespace | [
30522,
3853,
2131,
5302,
8566,
2571,
3762,
18442,
23058,
1006,
3573,
1010,
2393,
2121,
1010,
3415,
15327,
1007,
1063,
9530,
3367,
11336,
1027,
3573,
1012,
1035,
14184,
18442,
23058,
2863,
2361,
1031,
3415,
15327,
1033,
2065,
1006,
2832,
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... |
GeekyAnts/vue-native-core | packages/vue-server-renderer/build.js | renderDOMProps | function renderDOMProps (node) {
var props = node.data.domProps;
var res = '';
var parent = node.parent;
while (isDef(parent)) {
if (parent.data && parent.data.domProps) {
props = Object.assign({}, props, parent.data.domProps);
}
parent = parent.parent;
}
if (isUndef(props)) {
return res
}
var attrs = node.data.attrs;
for (var key in props) {
if (key === 'innerHTML') {
setText(node, props[key], true);
} else if (key === 'textContent') {
setText(node, props[key], false);
} else {
var attr = propsToAttrMap[key] || key.toLowerCase();
if (isRenderableAttr(attr) &&
// avoid rendering double-bound props/attrs twice
!(isDef(attrs) && isDef(attrs[attr]))) {
res += renderAttr(attr, props[key]);
}
}
}
return res
} | javascript | function renderDOMProps (node) {
var props = node.data.domProps;
var res = '';
var parent = node.parent;
while (isDef(parent)) {
if (parent.data && parent.data.domProps) {
props = Object.assign({}, props, parent.data.domProps);
}
parent = parent.parent;
}
if (isUndef(props)) {
return res
}
var attrs = node.data.attrs;
for (var key in props) {
if (key === 'innerHTML') {
setText(node, props[key], true);
} else if (key === 'textContent') {
setText(node, props[key], false);
} else {
var attr = propsToAttrMap[key] || key.toLowerCase();
if (isRenderableAttr(attr) &&
// avoid rendering double-bound props/attrs twice
!(isDef(attrs) && isDef(attrs[attr]))) {
res += renderAttr(attr, props[key]);
}
}
}
return res
} | [
"function",
"renderDOMProps",
"(",
"node",
")",
"{",
"var",
"props",
"=",
"node",
".",
"data",
".",
"domProps",
";",
"var",
"res",
"=",
"''",
";",
"var",
"parent",
"=",
"node",
".",
"parent",
";",
"while",
"(",
"isDef",
"(",
"parent",
")",
")",
"{"... | /* | [
"/",
"*"
] | a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e | https://github.com/GeekyAnts/vue-native-core/blob/a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e/packages/vue-server-renderer/build.js#L369-L401 | train | render DOM props | [
30522,
3853,
17552,
9527,
21572,
4523,
1006,
13045,
1007,
1063,
13075,
24387,
1027,
13045,
1012,
2951,
1012,
14383,
21572,
4523,
1025,
13075,
24501,
1027,
1005,
1005,
1025,
13075,
6687,
1027,
13045,
1012,
6687,
1025,
2096,
1006,
2003,
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... |
adobe/brackets | src/file/FileUtils.js | getBaseName | function getBaseName(fullPath) {
var lastSlash = fullPath.lastIndexOf("/");
if (lastSlash === fullPath.length - 1) { // directory: exclude trailing "/" too
return fullPath.slice(fullPath.lastIndexOf("/", fullPath.length - 2) + 1, -1);
} else {
return fullPath.slice(lastSlash + 1);
}
} | javascript | function getBaseName(fullPath) {
var lastSlash = fullPath.lastIndexOf("/");
if (lastSlash === fullPath.length - 1) { // directory: exclude trailing "/" too
return fullPath.slice(fullPath.lastIndexOf("/", fullPath.length - 2) + 1, -1);
} else {
return fullPath.slice(lastSlash + 1);
}
} | [
"function",
"getBaseName",
"(",
"fullPath",
")",
"{",
"var",
"lastSlash",
"=",
"fullPath",
".",
"lastIndexOf",
"(",
"\"/\"",
")",
";",
"if",
"(",
"lastSlash",
"===",
"fullPath",
".",
"length",
"-",
"1",
")",
"{",
"// directory: exclude trailing \"/\" too",
"re... | Get the name of a file or a directory, removing any preceding path.
@param {string} fullPath full path to a file or directory
@return {string} Returns the base name of a file or the name of a
directory | [
"Get",
"the",
"name",
"of",
"a",
"file",
"or",
"a",
"directory",
"removing",
"any",
"preceding",
"path",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/file/FileUtils.js#L287-L294 | train | Get the base name of the file | [
30522,
3853,
2131,
15058,
18442,
1006,
2440,
15069,
1007,
1063,
13075,
16180,
27067,
1027,
2440,
15069,
1012,
2197,
22254,
10288,
11253,
1006,
1000,
30524,
1027,
2440,
15069,
1012,
3091,
1011,
1015,
1007,
1063,
1013,
1013,
14176,
1024,
23329,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | makeApplicationVerifier | function makeApplicationVerifier(submitButtonId) {
var container = recaptchaSize === 'invisible' ?
submitButtonId :
'recaptcha-container';
applicationVerifier = new firebase.auth.RecaptchaVerifier(container,
{'size': recaptchaSize});
} | javascript | function makeApplicationVerifier(submitButtonId) {
var container = recaptchaSize === 'invisible' ?
submitButtonId :
'recaptcha-container';
applicationVerifier = new firebase.auth.RecaptchaVerifier(container,
{'size': recaptchaSize});
} | [
"function",
"makeApplicationVerifier",
"(",
"submitButtonId",
")",
"{",
"var",
"container",
"=",
"recaptchaSize",
"===",
"'invisible'",
"?",
"submitButtonId",
":",
"'recaptcha-container'",
";",
"applicationVerifier",
"=",
"new",
"firebase",
".",
"auth",
".",
"Recaptch... | Initializes the ApplicationVerifier.
@param {string} submitButtonId The ID of the DOM element of the button to
which we attach the invisible reCAPTCHA. This is required even in visible
mode. | [
"Initializes",
"the",
"ApplicationVerifier",
"."
] | 491598a499813dacc23724de5e237ec220cc560e | https://github.com/firebase/firebase-js-sdk/blob/491598a499813dacc23724de5e237ec220cc560e/packages/auth/demo/public/script.js#L411-L417 | train | Creates an application verifier. | [
30522,
3853,
2191,
29098,
19341,
3508,
6299,
18095,
1006,
12040,
8569,
15474,
3593,
1007,
1063,
13075,
11661,
1027,
28667,
9331,
10649,
21369,
4371,
1027,
1027,
1027,
1005,
8841,
1005,
1029,
12040,
8569,
15474,
3593,
1024,
1005,
28667,
9331,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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(o) {
var self = this;
// If we don't have an AudioContext created yet, run the setup.
if (!Howler.ctx) {
setupAudioContext();
}
// Setup user-defined default properties.
self._autoplay = o.autoplay || false;
self._format = (typeof o.format !== 'string') ? o.format : [o.format];
self._html5 = o.html5 || false;
self._muted = o.mute || false;
self._loop = o.loop || false;
self._pool = o.pool || 5;
self._preload = (typeof o.preload === 'boolean') ? o.preload : true;
self._rate = o.rate || 1;
self._sprite = o.sprite || {};
self._src = (typeof o.src !== 'string') ? o.src : [o.src];
self._volume = o.volume !== undefined ? o.volume : 1;
self._xhrWithCredentials = o.xhrWithCredentials || false;
// Setup all other default properties.
self._duration = 0;
self._state = 'unloaded';
self._sounds = [];
self._endTimers = {};
self._queue = [];
self._playLock = false;
// Setup event listeners.
self._onend = o.onend ? [{fn: o.onend}] : [];
self._onfade = o.onfade ? [{fn: o.onfade}] : [];
self._onload = o.onload ? [{fn: o.onload}] : [];
self._onloaderror = o.onloaderror ? [{fn: o.onloaderror}] : [];
self._onplayerror = o.onplayerror ? [{fn: o.onplayerror}] : [];
self._onpause = o.onpause ? [{fn: o.onpause}] : [];
self._onplay = o.onplay ? [{fn: o.onplay}] : [];
self._onstop = o.onstop ? [{fn: o.onstop}] : [];
self._onmute = o.onmute ? [{fn: o.onmute}] : [];
self._onvolume = o.onvolume ? [{fn: o.onvolume}] : [];
self._onrate = o.onrate ? [{fn: o.onrate}] : [];
self._onseek = o.onseek ? [{fn: o.onseek}] : [];
self._onunlock = o.onunlock ? [{fn: o.onunlock}] : [];
self._onresume = [];
// Web Audio or HTML5 Audio?
self._webAudio = Howler.usingWebAudio && !self._html5;
// Automatically try to enable audio.
if (typeof Howler.ctx !== 'undefined' && Howler.ctx && Howler.autoUnlock) {
Howler._unlockAudio();
}
// Keep track of this Howl group in the global controller.
Howler._howls.push(self);
// If they selected autoplay, add a play event to the load queue.
if (self._autoplay) {
self._queue.push({
event: 'play',
action: function() {
self.play();
}
});
}
// Load the source file unless otherwise specified.
if (self._preload) {
self.load();
}
return self;
} | javascript | function(o) {
var self = this;
// If we don't have an AudioContext created yet, run the setup.
if (!Howler.ctx) {
setupAudioContext();
}
// Setup user-defined default properties.
self._autoplay = o.autoplay || false;
self._format = (typeof o.format !== 'string') ? o.format : [o.format];
self._html5 = o.html5 || false;
self._muted = o.mute || false;
self._loop = o.loop || false;
self._pool = o.pool || 5;
self._preload = (typeof o.preload === 'boolean') ? o.preload : true;
self._rate = o.rate || 1;
self._sprite = o.sprite || {};
self._src = (typeof o.src !== 'string') ? o.src : [o.src];
self._volume = o.volume !== undefined ? o.volume : 1;
self._xhrWithCredentials = o.xhrWithCredentials || false;
// Setup all other default properties.
self._duration = 0;
self._state = 'unloaded';
self._sounds = [];
self._endTimers = {};
self._queue = [];
self._playLock = false;
// Setup event listeners.
self._onend = o.onend ? [{fn: o.onend}] : [];
self._onfade = o.onfade ? [{fn: o.onfade}] : [];
self._onload = o.onload ? [{fn: o.onload}] : [];
self._onloaderror = o.onloaderror ? [{fn: o.onloaderror}] : [];
self._onplayerror = o.onplayerror ? [{fn: o.onplayerror}] : [];
self._onpause = o.onpause ? [{fn: o.onpause}] : [];
self._onplay = o.onplay ? [{fn: o.onplay}] : [];
self._onstop = o.onstop ? [{fn: o.onstop}] : [];
self._onmute = o.onmute ? [{fn: o.onmute}] : [];
self._onvolume = o.onvolume ? [{fn: o.onvolume}] : [];
self._onrate = o.onrate ? [{fn: o.onrate}] : [];
self._onseek = o.onseek ? [{fn: o.onseek}] : [];
self._onunlock = o.onunlock ? [{fn: o.onunlock}] : [];
self._onresume = [];
// Web Audio or HTML5 Audio?
self._webAudio = Howler.usingWebAudio && !self._html5;
// Automatically try to enable audio.
if (typeof Howler.ctx !== 'undefined' && Howler.ctx && Howler.autoUnlock) {
Howler._unlockAudio();
}
// Keep track of this Howl group in the global controller.
Howler._howls.push(self);
// If they selected autoplay, add a play event to the load queue.
if (self._autoplay) {
self._queue.push({
event: 'play',
action: function() {
self.play();
}
});
}
// Load the source file unless otherwise specified.
if (self._preload) {
self.load();
}
return self;
} | [
"function",
"(",
"o",
")",
"{",
"var",
"self",
"=",
"this",
";",
"// If we don't have an AudioContext created yet, run the setup.",
"if",
"(",
"!",
"Howler",
".",
"ctx",
")",
"{",
"setupAudioContext",
"(",
")",
";",
"}",
"// Setup user-defined default properties.",
... | Initialize a new Howl group object.
@param {Object} o Passed in properties for this group.
@return {Howl} | [
"Initialize",
"a",
"new",
"Howl",
"group",
"object",
"."
] | 030db918dd8ce640afd57e172418472497e8f113 | https://github.com/goldfire/howler.js/blob/030db918dd8ce640afd57e172418472497e8f113/dist/howler.js#L545-L618 | train | Initialize the AudioContext object. | [
30522,
3853,
1006,
1051,
1007,
1063,
13075,
2969,
1027,
2023,
1025,
1013,
1013,
2065,
2057,
2123,
1005,
1056,
2031,
2019,
5746,
8663,
18209,
2580,
2664,
1010,
2448,
1996,
16437,
1012,
2065,
1006,
999,
22912,
2121,
1012,
14931,
2595,
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... | |
SheetJS/js-xlsx | xlsx.js | parse_DataSpaceVersionInfo | function parse_DataSpaceVersionInfo(blob) {
var o = {};
o.id = blob.read_shift(0, 'lpp4');
o.R = parse_CRYPTOVersion(blob, 4);
o.U = parse_CRYPTOVersion(blob, 4);
o.W = parse_CRYPTOVersion(blob, 4);
return o;
} | javascript | function parse_DataSpaceVersionInfo(blob) {
var o = {};
o.id = blob.read_shift(0, 'lpp4');
o.R = parse_CRYPTOVersion(blob, 4);
o.U = parse_CRYPTOVersion(blob, 4);
o.W = parse_CRYPTOVersion(blob, 4);
return o;
} | [
"function",
"parse_DataSpaceVersionInfo",
"(",
"blob",
")",
"{",
"var",
"o",
"=",
"{",
"}",
";",
"o",
".",
"id",
"=",
"blob",
".",
"read_shift",
"(",
"0",
",",
"'lpp4'",
")",
";",
"o",
".",
"R",
"=",
"parse_CRYPTOVersion",
"(",
"blob",
",",
"4",
")... | /* [MS-OFFCRYPTO] 2.1.5 DataSpaceVersionInfo | [
"/",
"*",
"[",
"MS",
"-",
"OFFCRYPTO",
"]",
"2",
".",
"1",
".",
"5",
"DataSpaceVersionInfo"
] | 9a6d8a1d3d80c78dad5201fb389316f935279cdc | https://github.com/SheetJS/js-xlsx/blob/9a6d8a1d3d80c78dad5201fb389316f935279cdc/xlsx.js#L8131-L8138 | train | Parse the data space version information | [
30522,
3853,
11968,
3366,
1035,
2951,
23058,
27774,
2378,
14876,
1006,
1038,
4135,
2497,
1007,
1063,
13075,
1051,
1027,
1063,
1065,
1025,
1051,
1012,
8909,
1027,
1038,
4135,
2497,
1012,
3191,
1035,
5670,
1006,
1014,
1010,
1005,
6948,
2361,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
facebook/relay | packages/relay-runtime/network/RelayNetwork.js | create | function create(
fetchFn: FetchFunction,
subscribeFn?: SubscribeFunction,
): Network {
// Convert to functions that returns RelayObservable.
const observeFetch = convertFetch(fetchFn);
const observeSubscribe = subscribeFn
? convertSubscribe(subscribeFn)
: undefined;
function execute(
request: RequestParameters,
variables: Variables,
cacheConfig: CacheConfig,
uploadables?: ?UploadableMap,
): RelayObservable<GraphQLResponse> {
if (request.operationKind === 'subscription') {
invariant(
observeSubscribe,
'RelayNetwork: This network layer does not support Subscriptions. ' +
'To use Subscriptions, provide a custom network layer.',
);
invariant(
!uploadables,
'RelayNetwork: Cannot provide uploadables while subscribing.',
);
return observeSubscribe(request, variables, cacheConfig);
}
const pollInterval = cacheConfig.poll;
if (pollInterval != null) {
invariant(
!uploadables,
'RelayNetwork: Cannot provide uploadables while polling.',
);
return observeFetch(request, variables, {force: true}).poll(pollInterval);
}
return observeFetch(request, variables, cacheConfig, uploadables);
}
return {execute};
} | javascript | function create(
fetchFn: FetchFunction,
subscribeFn?: SubscribeFunction,
): Network {
// Convert to functions that returns RelayObservable.
const observeFetch = convertFetch(fetchFn);
const observeSubscribe = subscribeFn
? convertSubscribe(subscribeFn)
: undefined;
function execute(
request: RequestParameters,
variables: Variables,
cacheConfig: CacheConfig,
uploadables?: ?UploadableMap,
): RelayObservable<GraphQLResponse> {
if (request.operationKind === 'subscription') {
invariant(
observeSubscribe,
'RelayNetwork: This network layer does not support Subscriptions. ' +
'To use Subscriptions, provide a custom network layer.',
);
invariant(
!uploadables,
'RelayNetwork: Cannot provide uploadables while subscribing.',
);
return observeSubscribe(request, variables, cacheConfig);
}
const pollInterval = cacheConfig.poll;
if (pollInterval != null) {
invariant(
!uploadables,
'RelayNetwork: Cannot provide uploadables while polling.',
);
return observeFetch(request, variables, {force: true}).poll(pollInterval);
}
return observeFetch(request, variables, cacheConfig, uploadables);
}
return {execute};
} | [
"function",
"create",
"(",
"fetchFn",
":",
"FetchFunction",
",",
"subscribeFn",
"?",
":",
"SubscribeFunction",
",",
")",
":",
"Network",
"{",
"// Convert to functions that returns RelayObservable.",
"const",
"observeFetch",
"=",
"convertFetch",
"(",
"fetchFn",
")",
";... | Creates an implementation of the `Network` interface defined in
`RelayNetworkTypes` given `fetch` and `subscribe` functions. | [
"Creates",
"an",
"implementation",
"of",
"the",
"Network",
"interface",
"defined",
"in",
"RelayNetworkTypes",
"given",
"fetch",
"and",
"subscribe",
"functions",
"."
] | 7fb9be5182b9650637d7b92ead9a42713ac30aa4 | https://github.com/facebook/relay/blob/7fb9be5182b9650637d7b92ead9a42713ac30aa4/packages/relay-runtime/network/RelayNetwork.js#L33-L76 | train | Creates a network layer that can be used to execute a query. | [
30522,
3853,
3443,
1006,
18584,
2546,
2078,
1024,
18584,
11263,
27989,
1010,
4942,
29234,
2546,
2078,
1029,
1024,
4942,
29234,
11263,
27989,
1010,
1007,
1024,
2897,
1063,
1013,
1013,
10463,
2000,
4972,
2008,
5651,
8846,
16429,
8043,
12423,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/rules/CoreHelper.support.js | function () {
return Array.from(document.styleSheets).filter(function (styleSheet) {
var themeName = sap.ui.getCore().getConfiguration().getTheme(),
styleSheetEnding = "/themes/" + themeName + "/library.css",
hasHref = !styleSheet.href || !(styleSheet.href.indexOf(styleSheetEnding) !== -1),
hasRules = !!styleSheet.rules;
return hasHref && hasRules;
});
} | javascript | function () {
return Array.from(document.styleSheets).filter(function (styleSheet) {
var themeName = sap.ui.getCore().getConfiguration().getTheme(),
styleSheetEnding = "/themes/" + themeName + "/library.css",
hasHref = !styleSheet.href || !(styleSheet.href.indexOf(styleSheetEnding) !== -1),
hasRules = !!styleSheet.rules;
return hasHref && hasRules;
});
} | [
"function",
"(",
")",
"{",
"return",
"Array",
".",
"from",
"(",
"document",
".",
"styleSheets",
")",
".",
"filter",
"(",
"function",
"(",
"styleSheet",
")",
"{",
"var",
"themeName",
"=",
"sap",
".",
"ui",
".",
"getCore",
"(",
")",
".",
"getConfiguratio... | *
Search and filter all style sheets that are not loaded by the default theme and controls.
@returns {array} List of all custom CSS files paths. | [
"*",
"Search",
"and",
"filter",
"all",
"style",
"sheets",
"that",
"are",
"not",
"loaded",
"by",
"the",
"default",
"theme",
"and",
"controls",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/rules/CoreHelper.support.js#L41-L50 | train | Returns an array of all stylesheets that have a href attribute and has rules attribute | [
30522,
3853,
1006,
1007,
1063,
2709,
9140,
1012,
2013,
1006,
6254,
1012,
6782,
21030,
3215,
1007,
1012,
11307,
1006,
3853,
1006,
6782,
21030,
2102,
1007,
1063,
13075,
4323,
18442,
1027,
20066,
1012,
21318,
1012,
2131,
17345,
1006,
1007,
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... | |
BlackrockDigital/startbootstrap-sb-admin-2 | vendor/chart.js/Chart.js | function(ctx, x, y, width, height, radius) {
if (radius) {
var r = Math.min(radius, height / 2, width / 2);
var left = x + r;
var top = y + r;
var right = x + width - r;
var bottom = y + height - r;
ctx.moveTo(x, top);
if (left < right && top < bottom) {
ctx.arc(left, top, r, -PI, -HALF_PI);
ctx.arc(right, top, r, -HALF_PI, 0);
ctx.arc(right, bottom, r, 0, HALF_PI);
ctx.arc(left, bottom, r, HALF_PI, PI);
} else if (left < right) {
ctx.moveTo(left, y);
ctx.arc(right, top, r, -HALF_PI, HALF_PI);
ctx.arc(left, top, r, HALF_PI, PI + HALF_PI);
} else if (top < bottom) {
ctx.arc(left, top, r, -PI, 0);
ctx.arc(left, bottom, r, 0, PI);
} else {
ctx.arc(left, top, r, -PI, PI);
}
ctx.closePath();
ctx.moveTo(x, y);
} else {
ctx.rect(x, y, width, height);
}
} | javascript | function(ctx, x, y, width, height, radius) {
if (radius) {
var r = Math.min(radius, height / 2, width / 2);
var left = x + r;
var top = y + r;
var right = x + width - r;
var bottom = y + height - r;
ctx.moveTo(x, top);
if (left < right && top < bottom) {
ctx.arc(left, top, r, -PI, -HALF_PI);
ctx.arc(right, top, r, -HALF_PI, 0);
ctx.arc(right, bottom, r, 0, HALF_PI);
ctx.arc(left, bottom, r, HALF_PI, PI);
} else if (left < right) {
ctx.moveTo(left, y);
ctx.arc(right, top, r, -HALF_PI, HALF_PI);
ctx.arc(left, top, r, HALF_PI, PI + HALF_PI);
} else if (top < bottom) {
ctx.arc(left, top, r, -PI, 0);
ctx.arc(left, bottom, r, 0, PI);
} else {
ctx.arc(left, top, r, -PI, PI);
}
ctx.closePath();
ctx.moveTo(x, y);
} else {
ctx.rect(x, y, width, height);
}
} | [
"function",
"(",
"ctx",
",",
"x",
",",
"y",
",",
"width",
",",
"height",
",",
"radius",
")",
"{",
"if",
"(",
"radius",
")",
"{",
"var",
"r",
"=",
"Math",
".",
"min",
"(",
"radius",
",",
"height",
"/",
"2",
",",
"width",
"/",
"2",
")",
";",
... | Creates a "path" for a rectangle with rounded corners at position (x, y) with a
given size (width, height) and the same `radius` for all corners.
@param {CanvasRenderingContext2D} ctx - The canvas 2D Context.
@param {number} x - The x axis of the coordinate for the rectangle starting point.
@param {number} y - The y axis of the coordinate for the rectangle starting point.
@param {number} width - The rectangle's width.
@param {number} height - The rectangle's height.
@param {number} radius - The rounded amount (in pixels) for the four corners.
@todo handle `radius` as top-left, top-right, bottom-right, bottom-left array/object? | [
"Creates",
"a",
"path",
"for",
"a",
"rectangle",
"with",
"rounded",
"corners",
"at",
"position",
"(",
"x",
"y",
")",
"with",
"a",
"given",
"size",
"(",
"width",
"height",
")",
"and",
"the",
"same",
"radius",
"for",
"all",
"corners",
"."
] | ddfaceb4a8e65a41f163e2fdc4eab49384b810a1 | https://github.com/BlackrockDigital/startbootstrap-sb-admin-2/blob/ddfaceb4a8e65a41f163e2fdc4eab49384b810a1/vendor/chart.js/Chart.js#L2311-L2340 | train | Draw the specified rectangle | [
30522,
3853,
1006,
14931,
2595,
1010,
1060,
1010,
1061,
1010,
9381,
1010,
4578,
1010,
12177,
1007,
1063,
2065,
1006,
12177,
1007,
1063,
13075,
1054,
1027,
8785,
1012,
8117,
1006,
12177,
1010,
4578,
1013,
1016,
1010,
9381,
1013,
1016,
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... | |
SeleniumHQ/selenium | javascript/selenium-core/xpath/util.js | predicateExprHasPositionalSelector | function predicateExprHasPositionalSelector(expr, isRecursiveCall) {
if (!expr) {
return false;
}
if (!isRecursiveCall && exprReturnsNumberValue(expr)) {
// this is a "proximity position"-based predicate
return true;
}
if (expr instanceof FunctionCallExpr) {
var value = expr.name.value;
return (value == 'last' || value == 'position');
}
if (expr instanceof BinaryExpr) {
return (
predicateExprHasPositionalSelector(expr.expr1, true) ||
predicateExprHasPositionalSelector(expr.expr2, true));
}
return false;
} | javascript | function predicateExprHasPositionalSelector(expr, isRecursiveCall) {
if (!expr) {
return false;
}
if (!isRecursiveCall && exprReturnsNumberValue(expr)) {
// this is a "proximity position"-based predicate
return true;
}
if (expr instanceof FunctionCallExpr) {
var value = expr.name.value;
return (value == 'last' || value == 'position');
}
if (expr instanceof BinaryExpr) {
return (
predicateExprHasPositionalSelector(expr.expr1, true) ||
predicateExprHasPositionalSelector(expr.expr2, true));
}
return false;
} | [
"function",
"predicateExprHasPositionalSelector",
"(",
"expr",
",",
"isRecursiveCall",
")",
"{",
"if",
"(",
"!",
"expr",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"!",
"isRecursiveCall",
"&&",
"exprReturnsNumberValue",
"(",
"expr",
")",
")",
"{",
"//... | Determines whether a predicate expression contains a "positional selector".
A positional selector filters nodes from the nodelist input based on their
position within that list. When such selectors are encountered, the
evaluation of the predicate cannot be depth-first, because the positional
selector may be based on the result of evaluating predicates that precede
it. | [
"Determines",
"whether",
"a",
"predicate",
"expression",
"contains",
"a",
"positional",
"selector",
".",
"A",
"positional",
"selector",
"filters",
"nodes",
"from",
"the",
"nodelist",
"input",
"based",
"on",
"their",
"position",
"within",
"that",
"list",
".",
"Wh... | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/selenium-core/xpath/util.js#L495-L513 | train | Returns true if the predicate expression has a positional selector | [
30522,
3853,
3653,
16467,
10288,
18098,
14949,
26994,
9777,
12260,
16761,
1006,
4654,
18098,
1010,
2003,
2890,
10841,
2869,
3512,
9289,
2140,
1007,
1063,
2065,
1006,
999,
4654,
18098,
1007,
1063,
2709,
6270,
1025,
1065,
2065,
1006,
999,
200... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/DropdownBox.js | remove | function remove(id) {
var oItem = sap.ui.getCore().byId(id);
if (oItem) {
oItem.destroy();
}
} | javascript | function remove(id) {
var oItem = sap.ui.getCore().byId(id);
if (oItem) {
oItem.destroy();
}
} | [
"function",
"remove",
"(",
"id",
")",
"{",
"var",
"oItem",
"=",
"sap",
".",
"ui",
".",
"getCore",
"(",
")",
".",
"byId",
"(",
"id",
")",
";",
"if",
"(",
"oItem",
")",
"{",
"oItem",
".",
"destroy",
"(",
")",
";",
"}",
"}"
] | check for and remaining history items and destroy them | [
"check",
"for",
"and",
"remaining",
"history",
"items",
"and",
"destroy",
"them"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.commons/src/sap/ui/commons/DropdownBox.js#L131-L136 | train | Removes an item from the collection | [
30522,
3853,
6366,
1006,
8909,
1007,
1063,
13075,
1051,
4221,
2213,
1027,
20066,
1012,
21318,
1012,
2131,
17345,
1006,
1007,
1012,
2011,
3593,
1006,
8909,
1007,
1025,
2065,
1006,
1051,
4221,
2213,
1007,
1063,
1051,
4221,
2213,
1012,
6033,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/chart.js/Chart.js | function(element,dimension)
{
if (element['offset'+dimension])
{
return element['offset'+dimension];
}
else
{
return document.defaultView.getComputedStyle(element).getPropertyValue(dimension);
}
} | javascript | function(element,dimension)
{
if (element['offset'+dimension])
{
return element['offset'+dimension];
}
else
{
return document.defaultView.getComputedStyle(element).getPropertyValue(dimension);
}
} | [
"function",
"(",
"element",
",",
"dimension",
")",
"{",
"if",
"(",
"element",
"[",
"'offset'",
"+",
"dimension",
"]",
")",
"{",
"return",
"element",
"[",
"'offset'",
"+",
"dimension",
"]",
";",
"}",
"else",
"{",
"return",
"document",
".",
"defaultView",
... | Variables global to the chart | [
"Variables",
"global",
"to",
"the",
"chart"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/bower_components/chart.js/Chart.js#L28-L38 | train | Returns the value of the element at the specified dimension. | [
30522,
3853,
1006,
5783,
1010,
9812,
1007,
1063,
2065,
1006,
5783,
1031,
1005,
16396,
1005,
1009,
9812,
1033,
1007,
1063,
2709,
5783,
1031,
1005,
16396,
1005,
1009,
9812,
1033,
1025,
1065,
2842,
1063,
2709,
6254,
1012,
12398,
8584,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_AggregationCache.js | _AggregationCache | function _AggregationCache(oRequestor, sResourcePath, oAggregation, mQueryOptions) {
var mAlias2MeasureAndMethod = {},
oFirstLevelAggregation,
mFirstQueryOptions,
fnMeasureRangeResolve;
_Cache.call(this, oRequestor, sResourcePath, mQueryOptions, true);
this.oAggregation = oAggregation;
if (_AggregationHelper.hasMinOrMax(oAggregation.aggregate)) {
// Note: ignore existing mQueryOptions.$apply, e.g. from ODLB#updateAnalyticalInfo
if (oAggregation.groupLevels.length) {
throw new Error("Unsupported group levels together with min/max");
}
this.oMeasureRangePromise = new Promise(function (resolve, reject) {
fnMeasureRangeResolve = resolve;
});
mFirstQueryOptions = _AggregationHelper.buildApply(oAggregation, mQueryOptions,
mAlias2MeasureAndMethod); // 1st request only
this.oFirstLevel = _Cache.create(oRequestor, sResourcePath, mFirstQueryOptions, true);
this.oFirstLevel.getResourcePath = _AggregationCache.getResourcePath.bind(
this.oFirstLevel, oAggregation, mQueryOptions);
this.oFirstLevel.handleResponse = _AggregationCache.handleResponse
.bind(this.oFirstLevel, null, mAlias2MeasureAndMethod, fnMeasureRangeResolve,
this.oFirstLevel.handleResponse);
} else if (oAggregation.groupLevels.length) {
if (mQueryOptions.$count) {
throw new Error("Unsupported system query option: $count");
}
if (mQueryOptions.$filter) {
throw new Error("Unsupported system query option: $filter");
}
oFirstLevelAggregation = _AggregationCache.filterAggregationForFirstLevel(oAggregation);
mFirstQueryOptions = jQuery.extend({}, mQueryOptions, {
$orderby : _AggregationCache.filterOrderby(mQueryOptions.$orderby,
oFirstLevelAggregation)
}); // 1st level only
delete mFirstQueryOptions.$count;
mFirstQueryOptions
= _AggregationHelper.buildApply(oFirstLevelAggregation, mFirstQueryOptions);
mFirstQueryOptions.$count = true;
this.oFirstLevel = _Cache.create(oRequestor, sResourcePath, mFirstQueryOptions, true);
this.oFirstLevel.calculateKeyPredicate = _AggregationCache.calculateKeyPredicate
.bind(null, oFirstLevelAggregation, this.oFirstLevel.aElements.$byPredicate);
} else { // grand total w/o visual grouping
this.oFirstLevel = _Cache.create(oRequestor, sResourcePath, mQueryOptions, true);
this.oFirstLevel.getResourcePath = _AggregationCache.getResourcePath.bind(
this.oFirstLevel, oAggregation, mQueryOptions);
this.oFirstLevel.handleResponse = _AggregationCache.handleResponse
.bind(this.oFirstLevel, oAggregation, null, null, this.oFirstLevel.handleResponse);
}
} | javascript | function _AggregationCache(oRequestor, sResourcePath, oAggregation, mQueryOptions) {
var mAlias2MeasureAndMethod = {},
oFirstLevelAggregation,
mFirstQueryOptions,
fnMeasureRangeResolve;
_Cache.call(this, oRequestor, sResourcePath, mQueryOptions, true);
this.oAggregation = oAggregation;
if (_AggregationHelper.hasMinOrMax(oAggregation.aggregate)) {
// Note: ignore existing mQueryOptions.$apply, e.g. from ODLB#updateAnalyticalInfo
if (oAggregation.groupLevels.length) {
throw new Error("Unsupported group levels together with min/max");
}
this.oMeasureRangePromise = new Promise(function (resolve, reject) {
fnMeasureRangeResolve = resolve;
});
mFirstQueryOptions = _AggregationHelper.buildApply(oAggregation, mQueryOptions,
mAlias2MeasureAndMethod); // 1st request only
this.oFirstLevel = _Cache.create(oRequestor, sResourcePath, mFirstQueryOptions, true);
this.oFirstLevel.getResourcePath = _AggregationCache.getResourcePath.bind(
this.oFirstLevel, oAggregation, mQueryOptions);
this.oFirstLevel.handleResponse = _AggregationCache.handleResponse
.bind(this.oFirstLevel, null, mAlias2MeasureAndMethod, fnMeasureRangeResolve,
this.oFirstLevel.handleResponse);
} else if (oAggregation.groupLevels.length) {
if (mQueryOptions.$count) {
throw new Error("Unsupported system query option: $count");
}
if (mQueryOptions.$filter) {
throw new Error("Unsupported system query option: $filter");
}
oFirstLevelAggregation = _AggregationCache.filterAggregationForFirstLevel(oAggregation);
mFirstQueryOptions = jQuery.extend({}, mQueryOptions, {
$orderby : _AggregationCache.filterOrderby(mQueryOptions.$orderby,
oFirstLevelAggregation)
}); // 1st level only
delete mFirstQueryOptions.$count;
mFirstQueryOptions
= _AggregationHelper.buildApply(oFirstLevelAggregation, mFirstQueryOptions);
mFirstQueryOptions.$count = true;
this.oFirstLevel = _Cache.create(oRequestor, sResourcePath, mFirstQueryOptions, true);
this.oFirstLevel.calculateKeyPredicate = _AggregationCache.calculateKeyPredicate
.bind(null, oFirstLevelAggregation, this.oFirstLevel.aElements.$byPredicate);
} else { // grand total w/o visual grouping
this.oFirstLevel = _Cache.create(oRequestor, sResourcePath, mQueryOptions, true);
this.oFirstLevel.getResourcePath = _AggregationCache.getResourcePath.bind(
this.oFirstLevel, oAggregation, mQueryOptions);
this.oFirstLevel.handleResponse = _AggregationCache.handleResponse
.bind(this.oFirstLevel, oAggregation, null, null, this.oFirstLevel.handleResponse);
}
} | [
"function",
"_AggregationCache",
"(",
"oRequestor",
",",
"sResourcePath",
",",
"oAggregation",
",",
"mQueryOptions",
")",
"{",
"var",
"mAlias2MeasureAndMethod",
"=",
"{",
"}",
",",
"oFirstLevelAggregation",
",",
"mFirstQueryOptions",
",",
"fnMeasureRangeResolve",
";",
... | ********************************************************************************************* _AggregationCache *********************************************************************************************
Creates a cache for data aggregation that performs requests using the given requestor.
Note: The paths in $expand and $select will always be sorted in the cache's query string.
@param {sap.ui.model.odata.v4.lib._Requestor} oRequestor
The requestor
@param {string} sResourcePath
A resource path relative to the service URL
@param {object} oAggregation
An object holding the information needed for data aggregation; see also
<a href="http://docs.oasis-open.org/odata/odata-data-aggregation-ext/v4.0/">OData
Extension for Data Aggregation Version 4.0</a>; must be a clone that contains
<code>aggregate</code>, <code>group</code>, <code>groupLevels</code>
@param {object} mQueryOptions
A map of key-value pairs representing the query string
@throws {Error}
If the system query options "$count" or "$filter" are used together with group levels, or
if group levels are combined with min/max
@private | [
"*********************************************************************************************",
"_AggregationCache",
"*********************************************************************************************",
"Creates",
"a",
"cache",
"for",
"data",
"aggregation",
"that",
"performs",
"req... | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_AggregationCache.js#L48-L99 | train | Creates a new aggregation cache. | [
30522,
3853,
1035,
28041,
3540,
5403,
1006,
10848,
15500,
2953,
1010,
5034,
2229,
8162,
3401,
15069,
1010,
1051,
8490,
17603,
12540,
1010,
1049,
4226,
2854,
7361,
9285,
1007,
1063,
13075,
16007,
3022,
2475,
4168,
3022,
5397,
5685,
11368,
68... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | _execCommand | function _execCommand(doc, composer, command, nodeName, className) {
var ranges = composer.selection.getOwnRanges();
for (var i = ranges.length; i--;){
composer.selection.getSelection().removeAllRanges();
composer.selection.setSelection(ranges[i]);
if (className) {
var eventListener = dom.observe(doc, "DOMNodeInserted", function(event) {
var target = event.target,
displayStyle;
if (target.nodeType !== wysihtml5.ELEMENT_NODE) {
return;
}
displayStyle = dom.getStyle("display").from(target);
if (displayStyle.substr(0, 6) !== "inline") {
// Make sure that only block elements receive the given class
target.className += " " + className;
}
});
}
doc.execCommand(command, false, nodeName);
if (eventListener) {
eventListener.stop();
}
}
} | javascript | function _execCommand(doc, composer, command, nodeName, className) {
var ranges = composer.selection.getOwnRanges();
for (var i = ranges.length; i--;){
composer.selection.getSelection().removeAllRanges();
composer.selection.setSelection(ranges[i]);
if (className) {
var eventListener = dom.observe(doc, "DOMNodeInserted", function(event) {
var target = event.target,
displayStyle;
if (target.nodeType !== wysihtml5.ELEMENT_NODE) {
return;
}
displayStyle = dom.getStyle("display").from(target);
if (displayStyle.substr(0, 6) !== "inline") {
// Make sure that only block elements receive the given class
target.className += " " + className;
}
});
}
doc.execCommand(command, false, nodeName);
if (eventListener) {
eventListener.stop();
}
}
} | [
"function",
"_execCommand",
"(",
"doc",
",",
"composer",
",",
"command",
",",
"nodeName",
",",
"className",
")",
"{",
"var",
"ranges",
"=",
"composer",
".",
"selection",
".",
"getOwnRanges",
"(",
")",
";",
"for",
"(",
"var",
"i",
"=",
"ranges",
".",
"l... | Execute native query command
and if necessary modify the inserted node's className | [
"Execute",
"native",
"query",
"command",
"and",
"if",
"necessary",
"modify",
"the",
"inserted",
"node",
"s",
"className"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js#L10674-L10699 | train | execCommand - Executes a command on a document | [
30522,
3853,
1035,
4654,
8586,
9006,
2386,
2094,
1006,
9986,
1010,
4543,
1010,
3094,
1010,
13045,
18442,
1010,
2465,
18442,
1007,
1063,
13075,
8483,
1027,
4543,
1012,
4989,
1012,
2131,
12384,
24388,
2229,
1006,
1007,
1025,
2005,
1006,
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... |
firebase/firebase-js-sdk | packages/auth/src/authuser.js | function() {
// Get time until expiration minus the refresh offset.
var waitInterval =
self.stsTokenManager_.getExpirationTime() - goog.now() -
fireauth.TokenRefreshTime.OFFSET_DURATION;
// Set to zero if wait interval is negative.
return waitInterval > 0 ? waitInterval : 0;
} | javascript | function() {
// Get time until expiration minus the refresh offset.
var waitInterval =
self.stsTokenManager_.getExpirationTime() - goog.now() -
fireauth.TokenRefreshTime.OFFSET_DURATION;
// Set to zero if wait interval is negative.
return waitInterval > 0 ? waitInterval : 0;
} | [
"function",
"(",
")",
"{",
"// Get time until expiration minus the refresh offset.",
"var",
"waitInterval",
"=",
"self",
".",
"stsTokenManager_",
".",
"getExpirationTime",
"(",
")",
"-",
"goog",
".",
"now",
"(",
")",
"-",
"fireauth",
".",
"TokenRefreshTime",
".",
... | Return next time to run with offset applied. | [
"Return",
"next",
"time",
"to",
"run",
"with",
"offset",
"applied",
"."
] | 491598a499813dacc23724de5e237ec220cc560e | https://github.com/firebase/firebase-js-sdk/blob/491598a499813dacc23724de5e237ec220cc560e/packages/auth/src/authuser.js#L474-L481 | train | Returns the wait interval in milliseconds. | [
30522,
3853,
1006,
1007,
1063,
1013,
1013,
2131,
2051,
2127,
4654,
16781,
15718,
1996,
25416,
21898,
16396,
1012,
13075,
3524,
18447,
2121,
10175,
1027,
2969,
1012,
8541,
18715,
2368,
24805,
4590,
1035,
1012,
2131,
10288,
16781,
7292,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Batch.js | function (aRequests) {
var oBatchRequest = _serializeBatchRequest(aRequests);
return {
body : oBatchRequest.body.join(""),
headers : {
"Content-Type" : "multipart/mixed; boundary=" + oBatchRequest.batchBoundary,
"MIME-Version" : "1.0"
}
};
} | javascript | function (aRequests) {
var oBatchRequest = _serializeBatchRequest(aRequests);
return {
body : oBatchRequest.body.join(""),
headers : {
"Content-Type" : "multipart/mixed; boundary=" + oBatchRequest.batchBoundary,
"MIME-Version" : "1.0"
}
};
} | [
"function",
"(",
"aRequests",
")",
"{",
"var",
"oBatchRequest",
"=",
"_serializeBatchRequest",
"(",
"aRequests",
")",
";",
"return",
"{",
"body",
":",
"oBatchRequest",
".",
"body",
".",
"join",
"(",
"\"\"",
")",
",",
"headers",
":",
"{",
"\"Content-Type\"",
... | Serializes an array of requests to an object containing the batch request body and
mandatory headers for the batch request.
@param {object[]} aRequests
An array consisting of request objects <code>oRequest</code> or out of array(s)
of request objects <code>oRequest</code>, in case requests need to be sent in scope of
a change set. See example below.
@param {string} oRequest.method
HTTP method, e.g. "GET"
@param {string} oRequest.url
Absolute or relative URL. If the URL contains Content-ID reference then the reference
has to be specified as zero-based index of the referred request inside the change set.
See example below.
@param {object} oRequest.headers
Map of request headers. RFC-2047 encoding rules are not supported. Nevertheless non
US-ASCII values can be used. If the value of an "If-Match" header is an object, that
object's ETag is used instead.
@param {object} oRequest.body
Request body. If specified, oRequest.headers map must contain "Content-Type" header
either without "charset" parameter or with "charset" parameter having value "UTF-8".
@returns {object} Object containing the following properties:
<ul>
<li><code>body</code>: Batch request body
<li><code>headers</code>: Batch-specific request headers
<ul>
<li><code>Content-Type</code>: Value for the 'Content-Type' header
<li><code>MIME-Version</code>: Value for the 'MIME-Version' header
</ul>
</ul>
@example
var oBatchRequest = Batch.serializeBatchRequest([
{
method : "GET",
url : "/sap/opu/odata4/IWBEP/TEA/default/IWBEP/TEA_BUSI/0001/Employees('1')",
headers : {
Accept : "application/json"
}
},
[{
method : "POST",
url : "TEAMS",
headers : {
"Content-Type" : "application/json"
},
body : {"TEAM_ID" : "TEAM_03"}
}, {
method : "POST",
url : "$0/TEAM_2_Employees",
headers : {
"Content-Type" : "application/json",
"If-Match" : "etag0"
},
body : {"Name" : "John Smith"}
}],
{
method : "PATCH",
url : "/sap/opu/odata4/IWBEP/TEA/default/IWBEP/TEA_BUSI/0001/Employees('3')",
headers : {
"Content-Type" : "application/json",
"If-Match" : {
"@odata.etag" : "etag1"
}
},
body : {"TEAM_ID" : "TEAM_01"}
}
]); | [
"Serializes",
"an",
"array",
"of",
"requests",
"to",
"an",
"object",
"containing",
"the",
"batch",
"request",
"body",
"and",
"mandatory",
"headers",
"for",
"the",
"batch",
"request",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Batch.js#L395-L405 | train | Serialize a batch request | [
30522,
3853,
1006,
2024,
15500,
2015,
1007,
1063,
13075,
27885,
4017,
2818,
2890,
15500,
1027,
1035,
7642,
4697,
14479,
2818,
2890,
15500,
1006,
2024,
15500,
2015,
1007,
1025,
2709,
1063,
2303,
1024,
27885,
4017,
2818,
2890,
15500,
1012,
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/view/MainViewManager.js | isExclusiveToPane | function isExclusiveToPane(file, paneId) {
paneId = paneId === ACTIVE_PANE && _activePaneId ? _activePaneId : paneId;
var index = _.findIndex(_mruList, function (record) {
return (record.file.fullPath === file.fullPath && record.paneId !== paneId);
});
return index === -1;
} | javascript | function isExclusiveToPane(file, paneId) {
paneId = paneId === ACTIVE_PANE && _activePaneId ? _activePaneId : paneId;
var index = _.findIndex(_mruList, function (record) {
return (record.file.fullPath === file.fullPath && record.paneId !== paneId);
});
return index === -1;
} | [
"function",
"isExclusiveToPane",
"(",
"file",
",",
"paneId",
")",
"{",
"paneId",
"=",
"paneId",
"===",
"ACTIVE_PANE",
"&&",
"_activePaneId",
"?",
"_activePaneId",
":",
"paneId",
";",
"var",
"index",
"=",
"_",
".",
"findIndex",
"(",
"_mruList",
",",
"function... | Checks whether a file is listed exclusively in the provided pane
@param {!File} File - the file
@return {{file:File, paneId:string}} | [
"Checks",
"whether",
"a",
"file",
"is",
"listed",
"exclusively",
"in",
"the",
"provided",
"pane"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/view/MainViewManager.js#L271-L277 | train | Returns true if the given file is exclusive to the specified pane | [
30522,
3853,
2003,
10288,
23633,
14399,
7231,
1006,
5371,
1010,
6090,
7416,
2094,
1007,
1063,
6090,
7416,
2094,
30524,
1035,
2720,
15859,
3367,
1010,
3853,
1006,
2501,
1007,
1063,
2709,
1006,
2501,
1012,
5371,
1012,
2440,
15069,
1027,
1027,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/extensibility/ExtensionManager.js | downloadRegistry | function downloadRegistry() {
if (pendingDownloadRegistry) {
return pendingDownloadRegistry.promise();
}
pendingDownloadRegistry = new $.Deferred();
$.ajax({
url: brackets.config.extension_registry,
dataType: "json",
cache: false
})
.done(function (data) {
exports.hasDownloadedRegistry = true;
Object.keys(data).forEach(function (id) {
if (!extensions[id]) {
extensions[id] = {};
}
extensions[id].registryInfo = data[id];
synchronizeEntry(id);
});
exports.trigger("registryDownload");
pendingDownloadRegistry.resolve();
})
.fail(function () {
pendingDownloadRegistry.reject();
})
.always(function () {
// Make sure to clean up the pending registry so that new requests can be made.
pendingDownloadRegistry = null;
});
return pendingDownloadRegistry.promise();
} | javascript | function downloadRegistry() {
if (pendingDownloadRegistry) {
return pendingDownloadRegistry.promise();
}
pendingDownloadRegistry = new $.Deferred();
$.ajax({
url: brackets.config.extension_registry,
dataType: "json",
cache: false
})
.done(function (data) {
exports.hasDownloadedRegistry = true;
Object.keys(data).forEach(function (id) {
if (!extensions[id]) {
extensions[id] = {};
}
extensions[id].registryInfo = data[id];
synchronizeEntry(id);
});
exports.trigger("registryDownload");
pendingDownloadRegistry.resolve();
})
.fail(function () {
pendingDownloadRegistry.reject();
})
.always(function () {
// Make sure to clean up the pending registry so that new requests can be made.
pendingDownloadRegistry = null;
});
return pendingDownloadRegistry.promise();
} | [
"function",
"downloadRegistry",
"(",
")",
"{",
"if",
"(",
"pendingDownloadRegistry",
")",
"{",
"return",
"pendingDownloadRegistry",
".",
"promise",
"(",
")",
";",
"}",
"pendingDownloadRegistry",
"=",
"new",
"$",
".",
"Deferred",
"(",
")",
";",
"$",
".",
"aja... | Downloads the registry of Brackets extensions and stores the information in our
extension info.
@return {$.Promise} a promise that's resolved with the registry JSON data
or rejected if the server can't be reached. | [
"Downloads",
"the",
"registry",
"of",
"Brackets",
"extensions",
"and",
"stores",
"the",
"information",
"in",
"our",
"extension",
"info",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensibility/ExtensionManager.js#L205-L238 | train | Downloads the registry from the server | [
30522,
3853,
8816,
2890,
24063,
2854,
1006,
1007,
1063,
2065,
1006,
14223,
7698,
11066,
2890,
24063,
2854,
1007,
1063,
2709,
14223,
7698,
11066,
2890,
24063,
2854,
1012,
4872,
1006,
1007,
1025,
1065,
14223,
7698,
11066,
2890,
24063,
2854,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/model/odata/v4/ODataMetaModel.js | getKeyPath | function getKeyPath(aKeys) {
var vKey;
if (aKeys && aKeys.length === 1) {
vKey = aKeys[0];
} else {
throw new Error("Single key expected: " + sTypePath);
}
return typeof vKey === "string" ? vKey : vKey[Object.keys(vKey)[0]];
} | javascript | function getKeyPath(aKeys) {
var vKey;
if (aKeys && aKeys.length === 1) {
vKey = aKeys[0];
} else {
throw new Error("Single key expected: " + sTypePath);
}
return typeof vKey === "string" ? vKey : vKey[Object.keys(vKey)[0]];
} | [
"function",
"getKeyPath",
"(",
"aKeys",
")",
"{",
"var",
"vKey",
";",
"if",
"(",
"aKeys",
"&&",
"aKeys",
".",
"length",
"===",
"1",
")",
"{",
"vKey",
"=",
"aKeys",
"[",
"0",
"]",
";",
"}",
"else",
"{",
"throw",
"new",
"Error",
"(",
"\"Single key ex... | /*
@param {object[]} aKeys
The type's keys
@returns {string}
The property path to the type's single key
@throws {Error}
If the type does not have a single key | [
"/",
"*"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/ODataMetaModel.js#L2243-L2253 | train | Get the key path for the given keys | [
30522,
3853,
2131,
14839,
15069,
1006,
17712,
3240,
2015,
1007,
1063,
13075,
1058,
14839,
1025,
2065,
1006,
17712,
3240,
2015,
1004,
1004,
17712,
3240,
2015,
1012,
3091,
1027,
1027,
1027,
1015,
1007,
1063,
1058,
14839,
1027,
17712,
3240,
20... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/extensions/default/NavigationAndHistory/main.js | _makeMROFListEntry | function _makeMROFListEntry(path, pane, cursorPos) {
return {
file: path,
paneId: pane,
cursor: cursorPos
};
} | javascript | function _makeMROFListEntry(path, pane, cursorPos) {
return {
file: path,
paneId: pane,
cursor: cursorPos
};
} | [
"function",
"_makeMROFListEntry",
"(",
"path",
",",
"pane",
",",
"cursorPos",
")",
"{",
"return",
"{",
"file",
":",
"path",
",",
"paneId",
":",
"pane",
",",
"cursor",
":",
"cursorPos",
"}",
";",
"}"
] | Creates an entry for MROF list
@private
@param {String} path - full path of a doc
@param {String} pane - the pane holding the editor for the doc
@param {Object} cursorPos - current cursor position
@return {Object} a frame containing file path, pane and last known cursor | [
"Creates",
"an",
"entry",
"for",
"MROF",
"list"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/NavigationAndHistory/main.js#L139-L145 | train | make MROFListEntry - make an entry for a MROF | [
30522,
3853,
1035,
2191,
2213,
3217,
10258,
27870,
3372,
2854,
1006,
4130,
1010,
6090,
2063,
1010,
12731,
25301,
14536,
2891,
1007,
1063,
2709,
1063,
5371,
1024,
4130,
1010,
6090,
7416,
2094,
1024,
6090,
2063,
1010,
12731,
25301,
2099,
1024... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
angular/material | src/components/autocomplete/js/autocompleteController.js | reportMessages | function reportMessages(isPolite, types) {
var politeness = isPolite ? 'polite' : 'assertive';
var messages = [];
if (types & ReportType.Selected && ctrl.index !== -1) {
messages.push(getCurrentDisplayValue());
}
if (types & ReportType.Count) {
messages.push($q.resolve(getCountMessage()));
}
$q.all(messages).then(function(data) {
$mdLiveAnnouncer.announce(data.join(' '), politeness);
});
} | javascript | function reportMessages(isPolite, types) {
var politeness = isPolite ? 'polite' : 'assertive';
var messages = [];
if (types & ReportType.Selected && ctrl.index !== -1) {
messages.push(getCurrentDisplayValue());
}
if (types & ReportType.Count) {
messages.push($q.resolve(getCountMessage()));
}
$q.all(messages).then(function(data) {
$mdLiveAnnouncer.announce(data.join(' '), politeness);
});
} | [
"function",
"reportMessages",
"(",
"isPolite",
",",
"types",
")",
"{",
"var",
"politeness",
"=",
"isPolite",
"?",
"'polite'",
":",
"'assertive'",
";",
"var",
"messages",
"=",
"[",
"]",
";",
"if",
"(",
"types",
"&",
"ReportType",
".",
"Selected",
"&&",
"c... | Reports given message types to supported screen readers.
@param {boolean} isPolite Whether the announcement should be polite.
@param {!number} types Message flags to be reported to the screen reader. | [
"Reports",
"given",
"message",
"types",
"to",
"supported",
"screen",
"readers",
"."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/autocomplete/js/autocompleteController.js#L928-L943 | train | Report messages | [
30522,
3853,
3189,
7834,
3736,
8449,
1006,
2003,
18155,
4221,
1010,
4127,
1007,
1063,
13075,
13205,
2791,
1027,
2003,
18155,
4221,
1029,
1005,
13205,
1005,
1024,
1005,
20865,
3512,
1005,
1025,
13075,
7696,
1027,
1031,
1033,
1025,
2065,
1006... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
nhn/tui.editor | src/js/extensions/table/mergedTableAddRow.js | _findFocusTd | function _findFocusTd($newTable, rowIndex, colIndex) {
const tableData = dataHandler.createTableData($newTable);
const newRowIndex = dataHandler.findRowMergedLastIndex(tableData, rowIndex, colIndex) + 1;
const cellElementIndex = dataHandler.findElementIndex(tableData, newRowIndex, colIndex);
return $newTable.find('tr').eq(cellElementIndex.rowIndex).find('td')[cellElementIndex.colIndex];
} | javascript | function _findFocusTd($newTable, rowIndex, colIndex) {
const tableData = dataHandler.createTableData($newTable);
const newRowIndex = dataHandler.findRowMergedLastIndex(tableData, rowIndex, colIndex) + 1;
const cellElementIndex = dataHandler.findElementIndex(tableData, newRowIndex, colIndex);
return $newTable.find('tr').eq(cellElementIndex.rowIndex).find('td')[cellElementIndex.colIndex];
} | [
"function",
"_findFocusTd",
"(",
"$newTable",
",",
"rowIndex",
",",
"colIndex",
")",
"{",
"const",
"tableData",
"=",
"dataHandler",
".",
"createTableData",
"(",
"$newTable",
")",
";",
"const",
"newRowIndex",
"=",
"dataHandler",
".",
"findRowMergedLastIndex",
"(",
... | Find focus td element.
@param {jQuery} $newTable - changed table jQuery element
@param {number} rowIndex - row index of table data
@param {number} colIndex - column index of tabld data
@returns {HTMLElement}
@private | [
"Find",
"focus",
"td",
"element",
"."
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/extensions/table/mergedTableAddRow.js#L133-L139 | train | Find focus td element | [
30522,
3853,
1035,
2424,
14876,
7874,
2102,
2094,
1006,
1002,
25597,
3085,
1010,
5216,
22254,
10288,
1010,
6972,
3207,
2595,
1007,
1063,
9530,
3367,
2795,
2850,
2696,
1027,
2951,
11774,
3917,
1012,
3443,
10880,
2850,
2696,
1006,
1002,
25597... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
aframevr/aframe | src/core/scene/a-scene.js | getCanvasSize | function getCanvasSize (canvasEl, embedded, maxSize, isVR) {
if (embedded) {
return {
height: canvasEl.parentElement.offsetHeight,
width: canvasEl.parentElement.offsetWidth
};
}
return getMaxSize(maxSize, isVR);
} | javascript | function getCanvasSize (canvasEl, embedded, maxSize, isVR) {
if (embedded) {
return {
height: canvasEl.parentElement.offsetHeight,
width: canvasEl.parentElement.offsetWidth
};
}
return getMaxSize(maxSize, isVR);
} | [
"function",
"getCanvasSize",
"(",
"canvasEl",
",",
"embedded",
",",
"maxSize",
",",
"isVR",
")",
"{",
"if",
"(",
"embedded",
")",
"{",
"return",
"{",
"height",
":",
"canvasEl",
".",
"parentElement",
".",
"offsetHeight",
",",
"width",
":",
"canvasEl",
".",
... | Return the canvas size where the scene will be rendered.
Will be always the window size except when the scene is embedded.
The parent size (less than max size) will be returned in that case.
@param {object} canvasEl - the canvas element
@param {boolean} embedded - Is the scene embedded?
@param {object} max - Max size parameters
@param {boolean} isVR - If in VR | [
"Return",
"the",
"canvas",
"size",
"where",
"the",
"scene",
"will",
"be",
"rendered",
".",
"Will",
"be",
"always",
"the",
"window",
"size",
"except",
"when",
"the",
"scene",
"is",
"embedded",
".",
"The",
"parent",
"size",
"(",
"less",
"than",
"max",
"siz... | 24acc78a7299a4cdfe3ef617f4d40ddf6275c992 | https://github.com/aframevr/aframe/blob/24acc78a7299a4cdfe3ef617f4d40ddf6275c992/src/core/scene/a-scene.js#L751-L759 | train | Get the size of the canvas element | [
30522,
3853,
2131,
9336,
12044,
5332,
4371,
1006,
10683,
2884,
1010,
11157,
1010,
4098,
5332,
4371,
1010,
2003,
19716,
1007,
1063,
2065,
1006,
11157,
1007,
1063,
2709,
1063,
4578,
1024,
10683,
2884,
1012,
6687,
12260,
3672,
1012,
16396,
260... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | onSendSignInLinkToEmail | function onSendSignInLinkToEmail() {
var email = $('#sign-in-with-email-link-email').val();
auth.sendSignInLinkToEmail(email, getActionCodeSettings()).then(function() {
alertSuccess('Email sent!');
}, onAuthError);
} | javascript | function onSendSignInLinkToEmail() {
var email = $('#sign-in-with-email-link-email').val();
auth.sendSignInLinkToEmail(email, getActionCodeSettings()).then(function() {
alertSuccess('Email sent!');
}, onAuthError);
} | [
"function",
"onSendSignInLinkToEmail",
"(",
")",
"{",
"var",
"email",
"=",
"$",
"(",
"'#sign-in-with-email-link-email'",
")",
".",
"val",
"(",
")",
";",
"auth",
".",
"sendSignInLinkToEmail",
"(",
"email",
",",
"getActionCodeSettings",
"(",
")",
")",
".",
"then... | Sends sign in with email link to the user. | [
"Sends",
"sign",
"in",
"with",
"email",
"link",
"to",
"the",
"user",
"."
] | 491598a499813dacc23724de5e237ec220cc560e | https://github.com/firebase/firebase-js-sdk/blob/491598a499813dacc23724de5e237ec220cc560e/packages/auth/demo/public/script.js#L641-L646 | train | Send sign in link to email | [
30522,
3853,
2006,
5054,
5104,
23773,
2378,
13767,
3406,
14545,
4014,
1006,
1007,
1063,
13075,
10373,
1027,
1002,
1006,
1005,
1001,
3696,
1011,
1999,
1011,
2007,
1011,
10373,
1011,
4957,
1011,
10373,
1005,
1007,
1012,
11748,
1006,
1007,
102... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SeleniumHQ/selenium | third_party/js/mozmill/shared-modules/private-browsing.js | privateBrowsing_start | function privateBrowsing_start(useShortcut) {
var dialog = null;
if (this.enabled)
return;
if (this.showPrompt) {
dialog = new modalDialog.modalDialog(this._controller.window);
dialog.start(this._handler);
}
if (useShortcut) {
var cmdKey = utils.getEntity(this.getDtds(), "privateBrowsingCmd.commandkey");
this._controller.keypress(null, cmdKey, {accelKey: true, shiftKey: true});
} else {
this._controller.click(this._pbMenuItem);
}
if (dialog) {
dialog.waitForDialog();
}
this.waitForTransistionComplete(true);
} | javascript | function privateBrowsing_start(useShortcut) {
var dialog = null;
if (this.enabled)
return;
if (this.showPrompt) {
dialog = new modalDialog.modalDialog(this._controller.window);
dialog.start(this._handler);
}
if (useShortcut) {
var cmdKey = utils.getEntity(this.getDtds(), "privateBrowsingCmd.commandkey");
this._controller.keypress(null, cmdKey, {accelKey: true, shiftKey: true});
} else {
this._controller.click(this._pbMenuItem);
}
if (dialog) {
dialog.waitForDialog();
}
this.waitForTransistionComplete(true);
} | [
"function",
"privateBrowsing_start",
"(",
"useShortcut",
")",
"{",
"var",
"dialog",
"=",
"null",
";",
"if",
"(",
"this",
".",
"enabled",
")",
"return",
";",
"if",
"(",
"this",
".",
"showPrompt",
")",
"{",
"dialog",
"=",
"new",
"modalDialog",
".",
"modalD... | Start the Private Browsing mode
@param {boolean} useShortcut
Use the keyboard shortcut if true otherwise the menu entry is used | [
"Start",
"the",
"Private",
"Browsing",
"mode"
] | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/private-browsing.js#L176-L198 | train | privateBrowsing_start - Start private browsing | [
30522,
3853,
2797,
12618,
9333,
2075,
1035,
2707,
1006,
3594,
27794,
12690,
1007,
1063,
13075,
13764,
8649,
1027,
19701,
1025,
2065,
1006,
2023,
1012,
9124,
1007,
2709,
1025,
2065,
1006,
2023,
1012,
2265,
21572,
27718,
1007,
1063,
13764,
86... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netlify/netlify-cms | packages/netlify-cms-media-library-uploadcare/src/index.js | init | async function init({ options = { config: {} }, handleInsert } = {}) {
const { publicKey, ...globalConfig } = options.config;
const baseConfig = { ...defaultConfig, ...globalConfig };
window.UPLOADCARE_PUBLIC_KEY = publicKey;
/**
* Register the effects tab by default because the effects tab is awesome. Can
* be disabled via config.
*/
uploadcare.registerTab('preview', uploadcareTabEffects);
return {
/**
* On show, create a new widget, cache it in the widgets object, and open.
* No hide method is provided because the widget doesn't provide it.
*/
show: ({ value, config: instanceConfig = {}, allowMultiple, imagesOnly = false } = {}) => {
const config = { ...baseConfig, imagesOnly, ...instanceConfig };
const multiple = allowMultiple === false ? false : !!config.multiple;
const resolvedConfig = { ...config, multiple };
const files = getFiles(value);
/**
* Resolve the promise only if it's ours. Only the jQuery promise objects
* from the Uploadcare library will have a `state` method.
*/
if (files && !files.state) {
return files.then(result => openDialog(result, resolvedConfig, handleInsert));
} else {
return openDialog(files, resolvedConfig, handleInsert);
}
},
/**
* Uploadcare doesn't provide a "media library" widget for viewing and
* selecting existing files, so we return `false` here so Netlify CMS only
* opens the Uploadcare widget when called from an editor control. This
* results in the "Media" button in the global nav being hidden.
*/
enableStandalone: () => false,
};
} | javascript | async function init({ options = { config: {} }, handleInsert } = {}) {
const { publicKey, ...globalConfig } = options.config;
const baseConfig = { ...defaultConfig, ...globalConfig };
window.UPLOADCARE_PUBLIC_KEY = publicKey;
/**
* Register the effects tab by default because the effects tab is awesome. Can
* be disabled via config.
*/
uploadcare.registerTab('preview', uploadcareTabEffects);
return {
/**
* On show, create a new widget, cache it in the widgets object, and open.
* No hide method is provided because the widget doesn't provide it.
*/
show: ({ value, config: instanceConfig = {}, allowMultiple, imagesOnly = false } = {}) => {
const config = { ...baseConfig, imagesOnly, ...instanceConfig };
const multiple = allowMultiple === false ? false : !!config.multiple;
const resolvedConfig = { ...config, multiple };
const files = getFiles(value);
/**
* Resolve the promise only if it's ours. Only the jQuery promise objects
* from the Uploadcare library will have a `state` method.
*/
if (files && !files.state) {
return files.then(result => openDialog(result, resolvedConfig, handleInsert));
} else {
return openDialog(files, resolvedConfig, handleInsert);
}
},
/**
* Uploadcare doesn't provide a "media library" widget for viewing and
* selecting existing files, so we return `false` here so Netlify CMS only
* opens the Uploadcare widget when called from an editor control. This
* results in the "Media" button in the global nav being hidden.
*/
enableStandalone: () => false,
};
} | [
"async",
"function",
"init",
"(",
"{",
"options",
"=",
"{",
"config",
":",
"{",
"}",
"}",
",",
"handleInsert",
"}",
"=",
"{",
"}",
")",
"{",
"const",
"{",
"publicKey",
",",
"...",
"globalConfig",
"}",
"=",
"options",
".",
"config",
";",
"const",
"b... | Initialization function will only run once, returns an API object for Netlify
CMS to call methods on. | [
"Initialization",
"function",
"will",
"only",
"run",
"once",
"returns",
"an",
"API",
"object",
"for",
"Netlify",
"CMS",
"to",
"call",
"methods",
"on",
"."
] | 2488556590cbfdcefa626f2f2de01e7a160cf6ee | https://github.com/netlify/netlify-cms/blob/2488556590cbfdcefa626f2f2de01e7a160cf6ee/packages/netlify-cms-media-library-uploadcare/src/index.js#L93-L135 | train | Initialize the uploadcare widget. | [
30522,
2004,
6038,
2278,
3853,
1999,
4183,
1006,
1063,
7047,
1027,
1063,
9530,
8873,
2290,
1024,
1063,
1065,
1065,
1010,
5047,
7076,
8743,
1065,
1027,
1063,
1065,
1007,
1063,
9530,
3367,
1063,
2270,
14839,
1010,
1012,
1012,
1012,
3795,
86... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
goldfire/howler.js | examples/3d/js/game.js | function(time) {
var ms = time - this.lastTime;
this.lastTime = time;
// Update the different components of the scene.
this.map.update(ms / 1000);
this.player.update(ms / 1000);
this.camera.render(this.player, this.map);
// Continue the game loop.
requestAnimationFrame(this.tick.bind(this));
} | javascript | function(time) {
var ms = time - this.lastTime;
this.lastTime = time;
// Update the different components of the scene.
this.map.update(ms / 1000);
this.player.update(ms / 1000);
this.camera.render(this.player, this.map);
// Continue the game loop.
requestAnimationFrame(this.tick.bind(this));
} | [
"function",
"(",
"time",
")",
"{",
"var",
"ms",
"=",
"time",
"-",
"this",
".",
"lastTime",
";",
"this",
".",
"lastTime",
"=",
"time",
";",
"// Update the different components of the scene.",
"this",
".",
"map",
".",
"update",
"(",
"ms",
"/",
"1000",
")",
... | Main game loop that renders the full scene on each screen refresh.
@param {Number} time | [
"Main",
"game",
"loop",
"that",
"renders",
"the",
"full",
"scene",
"on",
"each",
"screen",
"refresh",
"."
] | 030db918dd8ce640afd57e172418472497e8f113 | https://github.com/goldfire/howler.js/blob/030db918dd8ce640afd57e172418472497e8f113/examples/3d/js/game.js#L39-L50 | train | Update the scene. | [
30522,
3853,
1006,
2051,
1007,
1063,
13075,
5796,
1027,
2051,
1011,
2023,
1012,
2197,
7292,
1025,
2023,
1012,
2197,
7292,
1027,
2051,
1025,
1013,
1013,
10651,
1996,
2367,
6177,
1997,
1996,
3496,
1012,
2023,
1012,
4949,
1012,
10651,
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/TableMenuUtils.js | function(oTable) {
if (!oTable || !oTable._oCellContextMenu) {
return;
}
oTable._oCellContextMenu.destroy();
oTable._oCellContextMenu = null;
} | javascript | function(oTable) {
if (!oTable || !oTable._oCellContextMenu) {
return;
}
oTable._oCellContextMenu.destroy();
oTable._oCellContextMenu = null;
} | [
"function",
"(",
"oTable",
")",
"{",
"if",
"(",
"!",
"oTable",
"||",
"!",
"oTable",
".",
"_oCellContextMenu",
")",
"{",
"return",
";",
"}",
"oTable",
".",
"_oCellContextMenu",
".",
"destroy",
"(",
")",
";",
"oTable",
".",
"_oCellContextMenu",
"=",
"null"... | Destroys the cell context menu.
@param {sap.ui.table.Table} oTable Instance of the table. | [
"Destroys",
"the",
"cell",
"context",
"menu",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableMenuUtils.js#L331-L338 | train | Destroys the cell context menu for the given table. | [
30522,
3853,
1006,
27178,
3085,
1007,
1063,
2065,
1006,
999,
27178,
3085,
1064,
1064,
999,
27178,
3085,
1012,
1035,
1051,
29109,
22499,
10111,
18413,
3549,
2226,
1007,
1063,
2709,
1025,
1065,
27178,
3085,
1012,
1035,
1051,
29109,
22499,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | src/sap.ui.fl/src/sap/ui/fl/Utils.js | function (oControl) {
var oManifest = null, oComponent = null, oComponentMetaData = null;
// determine UI5 component out of given control
if (oControl) {
oComponent = this.getAppComponentForControl(oControl);
// determine manifest out of found component
if (oComponent && oComponent.getMetadata) {
oComponentMetaData = oComponent.getMetadata();
if (oComponentMetaData && oComponentMetaData.getManifest) {
oManifest = oComponentMetaData.getManifest();
}
}
}
return oManifest;
} | javascript | function (oControl) {
var oManifest = null, oComponent = null, oComponentMetaData = null;
// determine UI5 component out of given control
if (oControl) {
oComponent = this.getAppComponentForControl(oControl);
// determine manifest out of found component
if (oComponent && oComponent.getMetadata) {
oComponentMetaData = oComponent.getMetadata();
if (oComponentMetaData && oComponentMetaData.getManifest) {
oManifest = oComponentMetaData.getManifest();
}
}
}
return oManifest;
} | [
"function",
"(",
"oControl",
")",
"{",
"var",
"oManifest",
"=",
"null",
",",
"oComponent",
"=",
"null",
",",
"oComponentMetaData",
"=",
"null",
";",
"// determine UI5 component out of given control",
"if",
"(",
"oControl",
")",
"{",
"oComponent",
"=",
"this",
".... | Returns the appDescriptor of the component for the given control
@param {sap.ui.core.Control} oControl - SAPUI5 control
@returns {object} that represent the appDescriptor
@public
@function
@name sap.ui.fl.Utils.getAppDescriptor | [
"Returns",
"the",
"appDescriptor",
"of",
"the",
"component",
"for",
"the",
"given",
"control"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/Utils.js#L226-L243 | train | Returns manifest of UI5 component for given control | [
30522,
3853,
1006,
1051,
8663,
13181,
2140,
1007,
1063,
13075,
16640,
29323,
3367,
1027,
19701,
1010,
1051,
9006,
29513,
3372,
1027,
19701,
1010,
1051,
9006,
29513,
3372,
11368,
8447,
2696,
1027,
19701,
1025,
1013,
1013,
5646,
21318,
2629,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/firebaseui-web | javascript/widgets/handler/common.js | function() {
// Sets pending redirect status before redirect to
// accountchooser.com.
firebaseui.auth.storage.setPendingRedirectStatus(app.getAppId());
firebaseui.auth.acClient.trySelectAccount(
function(isAvailable) {
// Removes the pending redirect status if does not get
// redirected to accountchooser.com.
firebaseui.auth.storage.removePendingRedirectStatus(app.getAppId());
// On empty response, post accountchooser.com result (either empty
// or unavailable).
firebaseui.auth.widget.handler.common.accountChooserResult(
app,
isAvailable ?
firebaseui.auth.widget.Config.AccountChooserResult.EMPTY :
firebaseui.auth.widget.Config.AccountChooserResult
.UNAVAILABLE,
function() {
firebaseui.auth.widget.handler.handle(
firebaseui.auth.widget.HandlerName.SIGN_IN, app,
container);
// If accountchooser.com is available or uiShown callback is
// forced, run uiShown callback.
if (isAvailable ||
firebaseui.auth.widget.handler.common.acForceUiShown_) {
uiShownCallback();
}
});
},
firebaseui.auth.storage.getRememberedAccounts(app.getAppId()),
opt_callbackUrl);
} | javascript | function() {
// Sets pending redirect status before redirect to
// accountchooser.com.
firebaseui.auth.storage.setPendingRedirectStatus(app.getAppId());
firebaseui.auth.acClient.trySelectAccount(
function(isAvailable) {
// Removes the pending redirect status if does not get
// redirected to accountchooser.com.
firebaseui.auth.storage.removePendingRedirectStatus(app.getAppId());
// On empty response, post accountchooser.com result (either empty
// or unavailable).
firebaseui.auth.widget.handler.common.accountChooserResult(
app,
isAvailable ?
firebaseui.auth.widget.Config.AccountChooserResult.EMPTY :
firebaseui.auth.widget.Config.AccountChooserResult
.UNAVAILABLE,
function() {
firebaseui.auth.widget.handler.handle(
firebaseui.auth.widget.HandlerName.SIGN_IN, app,
container);
// If accountchooser.com is available or uiShown callback is
// forced, run uiShown callback.
if (isAvailable ||
firebaseui.auth.widget.handler.common.acForceUiShown_) {
uiShownCallback();
}
});
},
firebaseui.auth.storage.getRememberedAccounts(app.getAppId()),
opt_callbackUrl);
} | [
"function",
"(",
")",
"{",
"// Sets pending redirect status before redirect to",
"// accountchooser.com.",
"firebaseui",
".",
"auth",
".",
"storage",
".",
"setPendingRedirectStatus",
"(",
"app",
".",
"getAppId",
"(",
")",
")",
";",
"firebaseui",
".",
"auth",
".",
"a... | If there is no pending accountchooser.com response and provider sign in is not to be rendered, try to select account from accountchooser.com. Do not redirect to accountchooser.com directly, instead package routine in continue callback function to be passed to accountchooser.com invoked handler. | [
"If",
"there",
"is",
"no",
"pending",
"accountchooser",
".",
"com",
"response",
"and",
"provider",
"sign",
"in",
"is",
"not",
"to",
"be",
"rendered",
"try",
"to",
"select",
"account",
"from",
"accountchooser",
".",
"com",
".",
"Do",
"not",
"redirect",
"to"... | c10aa51e38aeb38dc63baa22b48cd6690c2be087 | https://github.com/firebase/firebaseui-web/blob/c10aa51e38aeb38dc63baa22b48cd6690c2be087/javascript/widgets/handler/common.js#L213-L244 | train | Try to select account and post accountchooser. com result | [
30522,
3853,
1006,
1007,
1063,
1013,
1013,
4520,
14223,
2417,
7442,
6593,
3570,
2077,
2417,
7442,
6593,
2000,
1013,
1013,
4070,
9905,
9232,
2099,
1012,
4012,
1012,
2543,
15058,
10179,
1012,
8740,
2705,
1012,
5527,
1012,
2275,
11837,
4667,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
ccxt/ccxt | build/update-badges.js | updateExchangeCount | function updateExchangeCount (fileName) {
log.bright.cyan ('Updating exchange count →', fileName.yellow)
let oldContent = fs.readFileSync (fileName, 'utf8')
let newContent =
oldContent.replace (/shields\.io\/badge\/exchanges\-[0-9a-z]+\-blue/g, 'shields.io/badge/exchanges-' + ccxt.exchanges.length + '-blue')
fs.truncateSync (fileName)
fs.writeFileSync (fileName, newContent)
} | javascript | function updateExchangeCount (fileName) {
log.bright.cyan ('Updating exchange count →', fileName.yellow)
let oldContent = fs.readFileSync (fileName, 'utf8')
let newContent =
oldContent.replace (/shields\.io\/badge\/exchanges\-[0-9a-z]+\-blue/g, 'shields.io/badge/exchanges-' + ccxt.exchanges.length + '-blue')
fs.truncateSync (fileName)
fs.writeFileSync (fileName, newContent)
} | [
"function",
"updateExchangeCount",
"(",
"fileName",
")",
"{",
"log",
".",
"bright",
".",
"cyan",
"(",
"'Updating exchange count →', ",
"f",
"leName.y",
"e",
"llow)",
"",
"let",
"oldContent",
"=",
"fs",
".",
"readFileSync",
"(",
"fileName",
",",
"'utf8'",
")",
... | ----------------------------------------------------------------------------- | [
"-----------------------------------------------------------------------------"
] | 8168069b9180a465532905e225586215e115a565 | https://github.com/ccxt/ccxt/blob/8168069b9180a465532905e225586215e115a565/build/update-badges.js#L63-L75 | train | Update the exchange count of the resource | [
30522,
3853,
10651,
10288,
22305,
8586,
21723,
1006,
5371,
18442,
1007,
1063,
8833,
1012,
4408,
1012,
22330,
2319,
1006,
1005,
2039,
16616,
3863,
4175,
1585,
1005,
1010,
5371,
18442,
1012,
3756,
1007,
2292,
2214,
8663,
6528,
2102,
1027,
104... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.rta/src/sap/ui/rta/util/BindingsExtractor.js | collectBindingPaths | function collectBindingPaths(oElement, oModel){
var mBindingsCollection = {
bindingPaths: [],
bindingContextPaths: []
};
var sAggregationName = oElement.sParentAggregationName;
var oParent = oElement.getParent();
var aBindings = getBindings(oElement, oModel);
if (oParent) {
var oDefaultAggregation = oParent.getMetadata().getAggregation();
if (oDefaultAggregation) {
var iPositionOfInvisibleElement = ElementUtil.getAggregation(oParent, sAggregationName).indexOf(oElement);
var sParentDefaultAggregationName = oDefaultAggregation.name;
var oBinding = oParent.getBindingInfo(sParentDefaultAggregationName);
var oTemplate = oBinding && oBinding.template;
if (oTemplate) {
var oTemplateDefaultAggregation = oTemplate.getMetadata().getAggregation();
if (oTemplateDefaultAggregation) {
var sTemplateDefaultAggregationName = oTemplateDefaultAggregation.name;
var oTemplateElement = ElementUtil.getAggregation(oTemplate, sTemplateDefaultAggregationName)[iPositionOfInvisibleElement];
aBindings = aBindings.concat(getBindings(oTemplateElement, null, true));
}
}
}
}
for (var i = 0, l = aBindings.length; i < l; i++) {
if (aBindings[i].getPath) {
var sBindingPath = aBindings[i].getPath();
if (sBindingPath && mBindingsCollection.bindingPaths.indexOf(sBindingPath) === -1){
mBindingsCollection.bindingPaths.push(sBindingPath);
}
}
if (aBindings[i].getContext && aBindings[i].getContext() && aBindings[i].getContext().getPath) {
var sBindingContextPath = aBindings[i].getContext().getPath();
if (sBindingContextPath && mBindingsCollection.bindingContextPaths.indexOf(sBindingContextPath) === -1){
mBindingsCollection.bindingContextPaths.push(sBindingContextPath);
}
}
if (isPlainObject(aBindings[i])){
if (mBindingsCollection.bindingPaths.indexOf(aBindings[i].parts[0].path) === -1){
mBindingsCollection.bindingPaths.push(aBindings[i].parts[0].path);
}
}
}
return mBindingsCollection;
} | javascript | function collectBindingPaths(oElement, oModel){
var mBindingsCollection = {
bindingPaths: [],
bindingContextPaths: []
};
var sAggregationName = oElement.sParentAggregationName;
var oParent = oElement.getParent();
var aBindings = getBindings(oElement, oModel);
if (oParent) {
var oDefaultAggregation = oParent.getMetadata().getAggregation();
if (oDefaultAggregation) {
var iPositionOfInvisibleElement = ElementUtil.getAggregation(oParent, sAggregationName).indexOf(oElement);
var sParentDefaultAggregationName = oDefaultAggregation.name;
var oBinding = oParent.getBindingInfo(sParentDefaultAggregationName);
var oTemplate = oBinding && oBinding.template;
if (oTemplate) {
var oTemplateDefaultAggregation = oTemplate.getMetadata().getAggregation();
if (oTemplateDefaultAggregation) {
var sTemplateDefaultAggregationName = oTemplateDefaultAggregation.name;
var oTemplateElement = ElementUtil.getAggregation(oTemplate, sTemplateDefaultAggregationName)[iPositionOfInvisibleElement];
aBindings = aBindings.concat(getBindings(oTemplateElement, null, true));
}
}
}
}
for (var i = 0, l = aBindings.length; i < l; i++) {
if (aBindings[i].getPath) {
var sBindingPath = aBindings[i].getPath();
if (sBindingPath && mBindingsCollection.bindingPaths.indexOf(sBindingPath) === -1){
mBindingsCollection.bindingPaths.push(sBindingPath);
}
}
if (aBindings[i].getContext && aBindings[i].getContext() && aBindings[i].getContext().getPath) {
var sBindingContextPath = aBindings[i].getContext().getPath();
if (sBindingContextPath && mBindingsCollection.bindingContextPaths.indexOf(sBindingContextPath) === -1){
mBindingsCollection.bindingContextPaths.push(sBindingContextPath);
}
}
if (isPlainObject(aBindings[i])){
if (mBindingsCollection.bindingPaths.indexOf(aBindings[i].parts[0].path) === -1){
mBindingsCollection.bindingPaths.push(aBindings[i].parts[0].path);
}
}
}
return mBindingsCollection;
} | [
"function",
"collectBindingPaths",
"(",
"oElement",
",",
"oModel",
")",
"{",
"var",
"mBindingsCollection",
"=",
"{",
"bindingPaths",
":",
"[",
"]",
",",
"bindingContextPaths",
":",
"[",
"]",
"}",
";",
"var",
"sAggregationName",
"=",
"oElement",
".",
"sParentAg... | Get all relevant binding paths and binding context paths for the element (from all properties)
@param {sap.ui.core.Control} oElement - Starting point of the search
@param {sap.ui.model.Model} oModel - Model for filtering irrelevant binding paths
@returns {{bindingPaths: Array, bindingContextPaths: Array}}} - returns with all relevant bindingPaths and all bindingContextPaths for all properties of the element
@private | [
"Get",
"all",
"relevant",
"binding",
"paths",
"and",
"binding",
"context",
"paths",
"for",
"the",
"element",
"(",
"from",
"all",
"properties",
")"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.rta/src/sap/ui/rta/util/BindingsExtractor.js#L26-L76 | train | Collect all binding paths for the given element | [
30522,
3853,
8145,
8428,
4667,
15069,
2015,
1006,
1051,
12260,
3672,
1010,
18168,
10244,
2140,
1007,
1063,
13075,
16914,
22254,
8613,
26895,
18491,
1027,
1063,
8031,
15069,
2015,
1024,
1031,
1033,
1010,
8031,
8663,
18209,
15069,
2015,
1024,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
caolan/async | lib/each.js | eachLimit | function eachLimit(coll, iteratee, callback) {
return eachOf(coll, withoutIndex(wrapAsync(iteratee)), callback);
} | javascript | function eachLimit(coll, iteratee, callback) {
return eachOf(coll, withoutIndex(wrapAsync(iteratee)), callback);
} | [
"function",
"eachLimit",
"(",
"coll",
",",
"iteratee",
",",
"callback",
")",
"{",
"return",
"eachOf",
"(",
"coll",
",",
"withoutIndex",
"(",
"wrapAsync",
"(",
"iteratee",
")",
")",
",",
"callback",
")",
";",
"}"
] | Applies the function `iteratee` to each item in `coll`, in parallel.
The `iteratee` is called with an item from the list, and a callback for when
it has finished. If the `iteratee` passes an error to its `callback`, the
main `callback` (for the `each` function) is immediately called with the
error.
Note, that since this function applies `iteratee` to each item in parallel,
there is no guarantee that the iteratee functions will complete in order.
@name each
@static
@memberOf module:Collections
@method
@alias forEach
@category Collection
@param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
@param {AsyncFunction} iteratee - An async function to apply to
each item in `coll`. Invoked with (item, callback).
The array index is not passed to the iteratee.
If you need the index, use `eachOf`.
@param {Function} [callback] - A callback which is called when all
`iteratee` functions have finished, or an error occurs. Invoked with (err).
@returns {Promise} a promise, if a callback is omitted
@example
// assuming openFiles is an array of file names and saveFile is a function
// to save the modified contents of that file:
async.each(openFiles, saveFile, function(err){
// if any of the saves produced an error, err would equal that error
});
// assuming openFiles is an array of file names
async.each(openFiles, function(file, callback) {
// Perform operation on file here.
console.log('Processing file ' + file);
if( file.length > 32 ) {
console.log('This file name is too long');
callback('File name too long');
} else {
// Do work to process file here
console.log('File processed');
callback();
}
}, function(err) {
// if any of the file processing produced an error, err would equal that error
if( err ) {
// One of the iterations produced an error.
// All processing will now stop.
console.log('A file failed to process');
} else {
console.log('All files have been processed successfully');
}
}); | [
"Applies",
"the",
"function",
"iteratee",
"to",
"each",
"item",
"in",
"coll",
"in",
"parallel",
".",
"The",
"iteratee",
"is",
"called",
"with",
"an",
"item",
"from",
"the",
"list",
"and",
"a",
"callback",
"for",
"when",
"it",
"has",
"finished",
".",
"If"... | 4330d536c106592139fa82062494c9dba0da1fdb | https://github.com/caolan/async/blob/4330d536c106592139fa82062494c9dba0da1fdb/lib/each.js#L64-L66 | train | Iterates over collection and returns an array of items. | [
30522,
3853,
2169,
17960,
4183,
1006,
8902,
2140,
1010,
2009,
22139,
2063,
1010,
2655,
5963,
1007,
1063,
2709,
2169,
11253,
1006,
8902,
2140,
1010,
2302,
22254,
10288,
1006,
10236,
3022,
6038,
2278,
1006,
2009,
22139,
2063,
1007,
1007,
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... |
aframevr/aframe | src/core/a-entity.js | mergeComponentData | function mergeComponentData (attrValue, extraData) {
// Extra data not defined, just return attrValue.
if (!extraData) { return attrValue; }
// Merge multi-property data.
if (extraData.constructor === Object) {
return utils.extend(extraData, utils.styleParser.parse(attrValue || {}));
}
// Return data, precendence to the defined value.
return attrValue || extraData;
} | javascript | function mergeComponentData (attrValue, extraData) {
// Extra data not defined, just return attrValue.
if (!extraData) { return attrValue; }
// Merge multi-property data.
if (extraData.constructor === Object) {
return utils.extend(extraData, utils.styleParser.parse(attrValue || {}));
}
// Return data, precendence to the defined value.
return attrValue || extraData;
} | [
"function",
"mergeComponentData",
"(",
"attrValue",
",",
"extraData",
")",
"{",
"// Extra data not defined, just return attrValue.",
"if",
"(",
"!",
"extraData",
")",
"{",
"return",
"attrValue",
";",
"}",
"// Merge multi-property data.",
"if",
"(",
"extraData",
".",
"... | Given entity defined value, merge in extra data if necessary.
Handle both single and multi-property components.
@param {string} attrValue - Entity data.
@param extraData - Entity data from another source to merge in. | [
"Given",
"entity",
"defined",
"value",
"merge",
"in",
"extra",
"data",
"if",
"necessary",
".",
"Handle",
"both",
"single",
"and",
"multi",
"-",
"property",
"components",
"."
] | 24acc78a7299a4cdfe3ef617f4d40ddf6275c992 | https://github.com/aframevr/aframe/blob/24acc78a7299a4cdfe3ef617f4d40ddf6275c992/src/core/a-entity.js#L900-L911 | train | Merge component data with extra data | [
30522,
3853,
13590,
9006,
29513,
3372,
2850,
2696,
1006,
2012,
16344,
10175,
5657,
1010,
4469,
2850,
2696,
1007,
1063,
1013,
1013,
4469,
2951,
2025,
4225,
1010,
2074,
2709,
2012,
16344,
10175,
5657,
1012,
2065,
1006,
999,
4469,
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... |
goldfire/howler.js | dist/howler.js | function(id) {
var self = this;
if (typeof id === 'undefined') {
var ids = [];
for (var i=0; i<self._sounds.length; i++) {
ids.push(self._sounds[i]._id);
}
return ids;
} else {
return [id];
}
} | javascript | function(id) {
var self = this;
if (typeof id === 'undefined') {
var ids = [];
for (var i=0; i<self._sounds.length; i++) {
ids.push(self._sounds[i]._id);
}
return ids;
} else {
return [id];
}
} | [
"function",
"(",
"id",
")",
"{",
"var",
"self",
"=",
"this",
";",
"if",
"(",
"typeof",
"id",
"===",
"'undefined'",
")",
"{",
"var",
"ids",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"self",
".",
"_sounds",
".",
"leng... | Get all ID's from the sounds pool.
@param {Number} id Only return one ID if one is passed.
@return {Array} Array of IDs. | [
"Get",
"all",
"ID",
"s",
"from",
"the",
"sounds",
"pool",
"."
] | 030db918dd8ce640afd57e172418472497e8f113 | https://github.com/goldfire/howler.js/blob/030db918dd8ce640afd57e172418472497e8f113/dist/howler.js#L2070-L2083 | train | Returns an array of unique ID s for the current sound | [
30522,
3853,
1006,
8909,
1007,
1063,
13075,
2969,
1027,
2023,
1025,
2065,
1006,
2828,
11253,
8909,
1027,
1027,
1027,
1005,
6151,
28344,
1005,
1007,
1063,
13075,
8909,
2015,
1027,
1031,
1033,
1025,
2005,
1006,
13075,
1045,
1027,
1014,
1025,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | src/sap.ui.core/src/sap/ui/core/dnd/DragAndDrop.js | function(sData) {
sData = "" + sData;
mData["text/plain"] = sData;
mData["text"] = sData;
setTransferData("text/plain", sData);
setTransferData("text", sData);
} | javascript | function(sData) {
sData = "" + sData;
mData["text/plain"] = sData;
mData["text"] = sData;
setTransferData("text/plain", sData);
setTransferData("text", sData);
} | [
"function",
"(",
"sData",
")",
"{",
"sData",
"=",
"\"\"",
"+",
"sData",
";",
"mData",
"[",
"\"text/plain\"",
"]",
"=",
"sData",
";",
"mData",
"[",
"\"text\"",
"]",
"=",
"sData",
";",
"setTransferData",
"(",
"\"text/plain\"",
",",
"sData",
")",
";",
"se... | Sets string data with plain text MIME type.
<b>Note:</b> This works in all browsers, including Internet Explorer and Microsoft Edge. It also works if you navigate between
different windows.
@param {string} sData Data
@public | [
"Sets",
"string",
"data",
"with",
"plain",
"text",
"MIME",
"type",
".",
"<b",
">",
"Note",
":",
"<",
"/",
"b",
">",
"This",
"works",
"in",
"all",
"browsers",
"including",
"Internet",
"Explorer",
"and",
"Microsoft",
"Edge",
".",
"It",
"also",
"works",
"... | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/dnd/DragAndDrop.js#L152-L158 | train | Sets the data to be sent to the remote server | [
30522,
3853,
1006,
17371,
6790,
1007,
1063,
17371,
6790,
1027,
1000,
1000,
1009,
17371,
6790,
1025,
9108,
6790,
1031,
1000,
3793,
1013,
5810,
1000,
1033,
1027,
17371,
6790,
1025,
9108,
6790,
1031,
1000,
3793,
1000,
1033,
1027,
17371,
6790,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
eslint/eslint | lib/rules/no-extra-parens.js | requiresLeadingSpace | function requiresLeadingSpace(node) {
const leftParenToken = sourceCode.getTokenBefore(node);
const tokenBeforeLeftParen = sourceCode.getTokenBefore(node, 1);
const firstToken = sourceCode.getFirstToken(node);
return tokenBeforeLeftParen &&
tokenBeforeLeftParen.range[1] === leftParenToken.range[0] &&
leftParenToken.range[1] === firstToken.range[0] &&
!astUtils.canTokensBeAdjacent(tokenBeforeLeftParen, firstToken);
} | javascript | function requiresLeadingSpace(node) {
const leftParenToken = sourceCode.getTokenBefore(node);
const tokenBeforeLeftParen = sourceCode.getTokenBefore(node, 1);
const firstToken = sourceCode.getFirstToken(node);
return tokenBeforeLeftParen &&
tokenBeforeLeftParen.range[1] === leftParenToken.range[0] &&
leftParenToken.range[1] === firstToken.range[0] &&
!astUtils.canTokensBeAdjacent(tokenBeforeLeftParen, firstToken);
} | [
"function",
"requiresLeadingSpace",
"(",
"node",
")",
"{",
"const",
"leftParenToken",
"=",
"sourceCode",
".",
"getTokenBefore",
"(",
"node",
")",
";",
"const",
"tokenBeforeLeftParen",
"=",
"sourceCode",
".",
"getTokenBefore",
"(",
"node",
",",
"1",
")",
";",
"... | Determines whether a node should be preceded by an additional space when removing parens
@param {ASTNode} node node to evaluate; must be surrounded by parentheses
@returns {boolean} `true` if a space should be inserted before the node
@private | [
"Determines",
"whether",
"a",
"node",
"should",
"be",
"preceded",
"by",
"an",
"additional",
"space",
"when",
"removing",
"parens"
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/no-extra-parens.js#L262-L271 | train | Checks whether a node requires leading space. | [
30522,
3853,
5942,
19738,
4667,
23058,
1006,
13045,
1007,
1063,
9530,
3367,
2187,
19362,
4765,
11045,
2078,
1027,
3120,
16044,
1012,
2131,
18715,
2368,
4783,
29278,
2063,
1006,
13045,
1007,
1025,
9530,
3367,
19204,
4783,
29278,
12260,
6199,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
dcloudio/mui | examples/login/js/mui.locker.js | function() {
var self = this;
//self.pointLocationArr = [];
if (self.cxt) {
self.cxt.clearRect(0, 0, self.CW, self.CH);
self.draw(self.cxt, self.pointLocationArr, [], {
X: 0,
Y: 0
});
}
} | javascript | function() {
var self = this;
//self.pointLocationArr = [];
if (self.cxt) {
self.cxt.clearRect(0, 0, self.CW, self.CH);
self.draw(self.cxt, self.pointLocationArr, [], {
X: 0,
Y: 0
});
}
} | [
"function",
"(",
")",
"{",
"var",
"self",
"=",
"this",
";",
"//self.pointLocationArr = [];",
"if",
"(",
"self",
".",
"cxt",
")",
"{",
"self",
".",
"cxt",
".",
"clearRect",
"(",
"0",
",",
"0",
",",
"self",
".",
"CW",
",",
"self",
".",
"CH",
")",
"... | 清除图形 | [
"清除图形"
] | ff74c90a1671a552f3604b1288bf38a4126312d0 | https://github.com/dcloudio/mui/blob/ff74c90a1671a552f3604b1288bf38a4126312d0/examples/login/js/mui.locker.js#L249-L259 | train | Draws the region region | [
30522,
3853,
1006,
1007,
1063,
13075,
2969,
1027,
2023,
1025,
1013,
1013,
2969,
1012,
2391,
4135,
10719,
2906,
2099,
1027,
1031,
1033,
1025,
2065,
1006,
2969,
1012,
1039,
18413,
1007,
1063,
2969,
1012,
1039,
18413,
1012,
3154,
2890,
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... | |
facebook/create-react-app | packages/react-dev-utils/openBrowser.js | openBrowser | function openBrowser(url) {
const { action, value } = getBrowserEnv();
switch (action) {
case Actions.NONE:
// Special case: BROWSER="none" will prevent opening completely.
return false;
case Actions.SCRIPT:
return executeNodeScript(value, url);
case Actions.BROWSER:
return startBrowserProcess(value, url);
default:
throw new Error('Not implemented.');
}
} | javascript | function openBrowser(url) {
const { action, value } = getBrowserEnv();
switch (action) {
case Actions.NONE:
// Special case: BROWSER="none" will prevent opening completely.
return false;
case Actions.SCRIPT:
return executeNodeScript(value, url);
case Actions.BROWSER:
return startBrowserProcess(value, url);
default:
throw new Error('Not implemented.');
}
} | [
"function",
"openBrowser",
"(",
"url",
")",
"{",
"const",
"{",
"action",
",",
"value",
"}",
"=",
"getBrowserEnv",
"(",
")",
";",
"switch",
"(",
"action",
")",
"{",
"case",
"Actions",
".",
"NONE",
":",
"// Special case: BROWSER=\"none\" will prevent opening compl... | Reads the BROWSER environment variable and decides what to do with it. Returns
true if it opened a browser or ran a node.js script, otherwise false. | [
"Reads",
"the",
"BROWSER",
"environment",
"variable",
"and",
"decides",
"what",
"to",
"do",
"with",
"it",
".",
"Returns",
"true",
"if",
"it",
"opened",
"a",
"browser",
"or",
"ran",
"a",
"node",
".",
"js",
"script",
"otherwise",
"false",
"."
] | 57ef103440c24e41b0d7dc82b7ad7fc1dc817eca | https://github.com/facebook/create-react-app/blob/57ef103440c24e41b0d7dc82b7ad7fc1dc817eca/packages/react-dev-utils/openBrowser.js#L111-L124 | train | Open a browser | [
30522,
3853,
2330,
12618,
9333,
2121,
1006,
24471,
2140,
1007,
1063,
9530,
3367,
1063,
2895,
1010,
3643,
1065,
1027,
2131,
12618,
9333,
7869,
2078,
2615,
1006,
1007,
1025,
6942,
1006,
2895,
1007,
1063,
2553,
4506,
1012,
3904,
1024,
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.table/src/sap/ui/table/TableSyncExtension.js | function(iIndex, bHovered) {
var oTable = this.getTable();
var oRow = oTable.getRows()[iIndex];
if (oRow && bHovered != null) {
oRow._setHovered(bHovered);
}
} | javascript | function(iIndex, bHovered) {
var oTable = this.getTable();
var oRow = oTable.getRows()[iIndex];
if (oRow && bHovered != null) {
oRow._setHovered(bHovered);
}
} | [
"function",
"(",
"iIndex",
",",
"bHovered",
")",
"{",
"var",
"oTable",
"=",
"this",
".",
"getTable",
"(",
")",
";",
"var",
"oRow",
"=",
"oTable",
".",
"getRows",
"(",
")",
"[",
"iIndex",
"]",
";",
"if",
"(",
"oRow",
"&&",
"bHovered",
"!=",
"null",
... | Sets the hover state of a row.
@param {int} iIndex The index of the row in the aggregation.
@param {boolean} bHovered Whether the row should be hovered. | [
"Sets",
"the",
"hover",
"state",
"of",
"a",
"row",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableSyncExtension.js#L35-L42 | train | Sets the hover state of a row. | [
30522,
3853,
1006,
2462,
13629,
2595,
1010,
1038,
6806,
25896,
1007,
1063,
13075,
27178,
3085,
1027,
2023,
1012,
2131,
10880,
1006,
1007,
1025,
13075,
20298,
2860,
1027,
27178,
3085,
1012,
2131,
10524,
2015,
1006,
1007,
1031,
2462,
13629,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | lib/jsdoc/transform-apijson-for-sdk.js | function (aParameters) {
// New array to hold modified parameters
var aNodes = [],
processNode = function (oNode, sPhoneName, iDepth, aNodes) {
// Handle phone name
oNode.phoneName = sPhoneName ? [sPhoneName, oNode.name].join(".") : oNode.name;
// Depth
oNode.depth = iDepth;
// Add to array
aNodes.push(oNode);
// Handle nesting
if (oNode.parameterProperties) {
Object.keys(oNode.parameterProperties).forEach(function (sNode) {
processNode(oNode.parameterProperties[sNode], oNode.phoneName, (iDepth + 1), aNodes);
});
}
delete oNode.parameterProperties;
};
aParameters.forEach(function (oParameter) {
// Handle Parameter Properties
// Note: We flatten the structure
processNode(oParameter, undefined, 0, aNodes);
});
return aNodes;
} | javascript | function (aParameters) {
// New array to hold modified parameters
var aNodes = [],
processNode = function (oNode, sPhoneName, iDepth, aNodes) {
// Handle phone name
oNode.phoneName = sPhoneName ? [sPhoneName, oNode.name].join(".") : oNode.name;
// Depth
oNode.depth = iDepth;
// Add to array
aNodes.push(oNode);
// Handle nesting
if (oNode.parameterProperties) {
Object.keys(oNode.parameterProperties).forEach(function (sNode) {
processNode(oNode.parameterProperties[sNode], oNode.phoneName, (iDepth + 1), aNodes);
});
}
delete oNode.parameterProperties;
};
aParameters.forEach(function (oParameter) {
// Handle Parameter Properties
// Note: We flatten the structure
processNode(oParameter, undefined, 0, aNodes);
});
return aNodes;
} | [
"function",
"(",
"aParameters",
")",
"{",
"// New array to hold modified parameters",
"var",
"aNodes",
"=",
"[",
"]",
",",
"processNode",
"=",
"function",
"(",
"oNode",
",",
"sPhoneName",
",",
"iDepth",
",",
"aNodes",
")",
"{",
"// Handle phone name",
"oNode",
"... | Adjusts constructor parameters info so that it can be easily displayed in a table
@param {Array} aParameters - the events array initially coming from the server | [
"Adjusts",
"constructor",
"parameters",
"info",
"so",
"that",
"it",
"can",
"be",
"easily",
"displayed",
"in",
"a",
"table"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/lib/jsdoc/transform-apijson-for-sdk.js#L1921-L1951 | train | This function is called to process parameters in the parameters array | [
30522,
3853,
1006,
9706,
5400,
22828,
2015,
1007,
1063,
1013,
1013,
2047,
9140,
2000,
2907,
6310,
11709,
13075,
2019,
19847,
1027,
1031,
1033,
1010,
2832,
3630,
3207,
1027,
3853,
1006,
21058,
3207,
1010,
11867,
27406,
18442,
1010,
8909,
236... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Component.js | function () {
this._oErrorHandler.destroy();
this._oConfigUtil.destroy();
this._oConfigUtil = null;
// call the base component's destroy function
UIComponent.prototype.destroy.apply(this, arguments);
} | javascript | function () {
this._oErrorHandler.destroy();
this._oConfigUtil.destroy();
this._oConfigUtil = null;
// call the base component's destroy function
UIComponent.prototype.destroy.apply(this, arguments);
} | [
"function",
"(",
")",
"{",
"this",
".",
"_oErrorHandler",
".",
"destroy",
"(",
")",
";",
"this",
".",
"_oConfigUtil",
".",
"destroy",
"(",
")",
";",
"this",
".",
"_oConfigUtil",
"=",
"null",
";",
"// call the base component's destroy function",
"UIComponent",
... | The component is destroyed by UI5 automatically.
In this method, the ListSelector and ErrorHandler are destroyed.
@public
@override | [
"The",
"component",
"is",
"destroyed",
"by",
"UI5",
"automatically",
".",
"In",
"this",
"method",
"the",
"ListSelector",
"and",
"ErrorHandler",
"are",
"destroyed",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.documentation/src/sap/ui/documentation/sdk/Component.js#L76-L82 | train | Destroys the component | [
30522,
3853,
1006,
1007,
1063,
2023,
1012,
1035,
1051,
2121,
29165,
11774,
3917,
1012,
6033,
1006,
1007,
1025,
2023,
1012,
1035,
1051,
8663,
8873,
27920,
4014,
1012,
6033,
1006,
1007,
1025,
2023,
1012,
1035,
1051,
8663,
8873,
27920,
4014,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.