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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
cytoscape/cytoscape.js | dist/cytoscape.esm.js | degreeCentrality | function degreeCentrality(options) {
options = defaults$1(options);
var cy = this.cy();
var callingEles = this;
var _options = options,
root = _options.root,
weight = _options.weight,
directed = _options.directed,
alpha = _options.alpha;
root = cy.collection(root)[0];
if (!directed) {
var connEdges = root.connectedEdges().intersection(callingEles);
var k = connEdges.length;
var s = 0; // Now, sum edge weights
for (var i = 0; i < connEdges.length; i++) {
s += weight(connEdges[i]);
}
return {
degree: Math.pow(k, 1 - alpha) * Math.pow(s, alpha)
};
} else {
var edges = root.connectedEdges();
var incoming = edges.filter(function (edge) {
return edge.target().same(root) && callingEles.has(edge);
});
var outgoing = edges.filter(function (edge) {
return edge.source().same(root) && callingEles.has(edge);
});
var k_in = incoming.length;
var k_out = outgoing.length;
var s_in = 0;
var s_out = 0; // Now, sum incoming edge weights
for (var _i2 = 0; _i2 < incoming.length; _i2++) {
s_in += weight(incoming[_i2]);
} // Now, sum outgoing edge weights
for (var _i3 = 0; _i3 < outgoing.length; _i3++) {
s_out += weight(outgoing[_i3]);
}
return {
indegree: Math.pow(k_in, 1 - alpha) * Math.pow(s_in, alpha),
outdegree: Math.pow(k_out, 1 - alpha) * Math.pow(s_out, alpha)
};
}
} | javascript | function degreeCentrality(options) {
options = defaults$1(options);
var cy = this.cy();
var callingEles = this;
var _options = options,
root = _options.root,
weight = _options.weight,
directed = _options.directed,
alpha = _options.alpha;
root = cy.collection(root)[0];
if (!directed) {
var connEdges = root.connectedEdges().intersection(callingEles);
var k = connEdges.length;
var s = 0; // Now, sum edge weights
for (var i = 0; i < connEdges.length; i++) {
s += weight(connEdges[i]);
}
return {
degree: Math.pow(k, 1 - alpha) * Math.pow(s, alpha)
};
} else {
var edges = root.connectedEdges();
var incoming = edges.filter(function (edge) {
return edge.target().same(root) && callingEles.has(edge);
});
var outgoing = edges.filter(function (edge) {
return edge.source().same(root) && callingEles.has(edge);
});
var k_in = incoming.length;
var k_out = outgoing.length;
var s_in = 0;
var s_out = 0; // Now, sum incoming edge weights
for (var _i2 = 0; _i2 < incoming.length; _i2++) {
s_in += weight(incoming[_i2]);
} // Now, sum outgoing edge weights
for (var _i3 = 0; _i3 < outgoing.length; _i3++) {
s_out += weight(outgoing[_i3]);
}
return {
indegree: Math.pow(k_in, 1 - alpha) * Math.pow(s_in, alpha),
outdegree: Math.pow(k_out, 1 - alpha) * Math.pow(s_out, alpha)
};
}
} | [
"function",
"degreeCentrality",
"(",
"options",
")",
"{",
"options",
"=",
"defaults$1",
"(",
"options",
")",
";",
"var",
"cy",
"=",
"this",
".",
"cy",
"(",
")",
";",
"var",
"callingEles",
"=",
"this",
";",
"var",
"_options",
"=",
"options",
",",
"root"... | degreeCentralityNormalized Implemented from the algorithm in Opsahl's paper "Node centrality in weighted networks: Generalizing degree and shortest paths" check the heading 2 "Degree" | [
"degreeCentralityNormalized",
"Implemented",
"from",
"the",
"algorithm",
"in",
"Opsahl",
"s",
"paper",
"Node",
"centrality",
"in",
"weighted",
"networks",
":",
"Generalizing",
"degree",
"and",
"shortest",
"paths",
"check",
"the",
"heading",
"2",
"Degree"
] | ad2051b65e2243cfd953d8b24a8bf95bfa8559e5 | https://github.com/cytoscape/cytoscape.js/blob/ad2051b65e2243cfd953d8b24a8bf95bfa8559e5/dist/cytoscape.esm.js#L3440-L3490 | train | Returns degree of centrality of the current project. | [
30522,
3853,
3014,
13013,
7941,
3012,
1006,
7047,
1007,
1063,
7047,
1027,
12398,
2015,
1002,
1015,
1006,
7047,
1007,
1025,
13075,
22330,
1027,
2023,
1012,
22330,
1006,
1007,
1025,
13075,
4214,
26741,
1027,
2023,
1025,
13075,
1035,
7047,
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... |
wuchangming/spy-debugger | buildin_modules/weinre/web/client/treeoutline.js | TreeOutline | function TreeOutline(listNode)
{
this.children = [];
this.selectedTreeElement = null;
this._childrenListNode = listNode;
this._childrenListNode.removeChildren();
this._knownTreeElements = [];
this._treeElementsExpandedState = [];
this.expandTreeElementsWhenArrowing = false;
this.root = true;
this.hasChildren = false;
this.expanded = true;
this.selected = false;
this.treeOutline = this;
this._childrenListNode.tabIndex = 0;
this._childrenListNode.addEventListener("keydown", this._treeKeyDown.bind(this), true);
} | javascript | function TreeOutline(listNode)
{
this.children = [];
this.selectedTreeElement = null;
this._childrenListNode = listNode;
this._childrenListNode.removeChildren();
this._knownTreeElements = [];
this._treeElementsExpandedState = [];
this.expandTreeElementsWhenArrowing = false;
this.root = true;
this.hasChildren = false;
this.expanded = true;
this.selected = false;
this.treeOutline = this;
this._childrenListNode.tabIndex = 0;
this._childrenListNode.addEventListener("keydown", this._treeKeyDown.bind(this), true);
} | [
"function",
"TreeOutline",
"(",
"listNode",
")",
"{",
"this",
".",
"children",
"=",
"[",
"]",
";",
"this",
".",
"selectedTreeElement",
"=",
"null",
";",
"this",
".",
"_childrenListNode",
"=",
"listNode",
";",
"this",
".",
"_childrenListNode",
".",
"removeChi... | /*
Copyright (C) 2007 Apple Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
its contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | [
"/",
"*",
"Copyright",
"(",
"C",
")",
"2007",
"Apple",
"Inc",
".",
"All",
"rights",
"reserved",
"."
] | 55c1dda0dff0c44920673711656ddfd7ff03c307 | https://github.com/wuchangming/spy-debugger/blob/55c1dda0dff0c44920673711656ddfd7ff03c307/buildin_modules/weinre/web/client/treeoutline.js#L29-L46 | train | A TreeOutline represents a tree of children. | [
30522,
3853,
3392,
5833,
4179,
1006,
2862,
3630,
3207,
1007,
1063,
2023,
1012,
2336,
1027,
1031,
1033,
1025,
2023,
1012,
3479,
13334,
12260,
3672,
1027,
19701,
1025,
2023,
1012,
1035,
2336,
9863,
3630,
3207,
1027,
2862,
3630,
3207,
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/base/Log.js | log | function log(iLevel, sMessage, sDetails, sComponent, fnSupportInfo) {
if (!fnSupportInfo && !sComponent && typeof sDetails === "function") {
fnSupportInfo = sDetails;
sDetails = "";
}
if (!fnSupportInfo && typeof sComponent === "function") {
fnSupportInfo = sComponent;
sComponent = "";
}
sComponent = sComponent || sDefaultComponent;
if (iLevel <= level(sComponent) ) {
var fNow = now(),
oNow = new Date(fNow),
iMicroSeconds = Math.floor((fNow - Math.floor(fNow)) * 1000),
oLogEntry = {
time : pad0(oNow.getHours(),2) + ":" + pad0(oNow.getMinutes(),2) + ":" + pad0(oNow.getSeconds(),2) + "." + pad0(oNow.getMilliseconds(),3) + pad0(iMicroSeconds,3),
date : pad0(oNow.getFullYear(),4) + "-" + pad0(oNow.getMonth() + 1,2) + "-" + pad0(oNow.getDate(),2),
timestamp: fNow,
level : iLevel,
message : String(sMessage || ""),
details : String(sDetails || ""),
component: String(sComponent || "")
};
if (bLogSupportInfo && typeof fnSupportInfo === "function") {
oLogEntry.supportInfo = fnSupportInfo();
}
aLog.push( oLogEntry );
if (oListener) {
oListener.onLogEntry(oLogEntry);
}
/*
* Console Log, also tries to log to the console, if available.
*
* Unfortunately, the support for console is quite different between the UI5 browsers. The most important differences are:
* - in IE (checked until IE9), the console object does not exist in a window, until the developer tools are opened for that window.
* After opening the dev tools, the console remains available even when the tools are closed again. Only using a new window (or tab)
* restores the old state without console.
* When the console is available, it provides most standard methods, but not debug and trace
* - in FF3.6 the console is not available, until FireBug is opened. It disappears again, when fire bug is closed.
* But when the settings for a web site are stored (convenience), the console remains open
* When the console is available, it supports all relevant methods
* - in FF9.0, the console is always available, but method assert is only available when firebug is open
* - in Webkit browsers, the console object is always available and has all required methods
* - Exception: in the iOS Simulator, console.info() does not exist
*/
/*eslint-disable no-console */
if (console) { // in IE and FF, console might not exist; in FF it might even disappear
var isDetailsError = sDetails instanceof Error,
logText = oLogEntry.date + " " + oLogEntry.time + " " + oLogEntry.message + " - " + oLogEntry.details + " " + oLogEntry.component;
switch (iLevel) {
case Log.Level.FATAL:
case Log.Level.ERROR: isDetailsError ? console.error(logText, "\n", sDetails) : console.error(logText); break;
case Log.Level.WARNING: isDetailsError ? console.warn(logText, "\n", sDetails) : console.warn(logText); break;
case Log.Level.INFO:
if (console.info) { // info not available in iOS simulator
isDetailsError ? console.info(logText, "\n", sDetails) : console.info(logText);
} else {
isDetailsError ? console.log(logText, "\n", sDetails) : console.log(logText);
}
break;
case Log.Level.DEBUG:
if (console.debug) { // debug not available in IE, fallback to log
isDetailsError ? console.debug(logText, "\n", sDetails) : console.debug(logText);
} else {
isDetailsError ? console.log(logText, "\n", sDetails) : console.log(logText);
}
break;
case Log.Level.TRACE:
if (console.trace) { // trace not available in IE, fallback to log (no trace)
isDetailsError ? console.trace(logText, "\n", sDetails) : console.trace(logText);
} else {
isDetailsError ? console.log(logText, "\n", sDetails) : console.log(logText);
}
break;
}
if (console.info && oLogEntry.supportInfo) {
console.info(oLogEntry.supportInfo);
}
}
/*eslint-enable no-console */
return oLogEntry;
}
} | javascript | function log(iLevel, sMessage, sDetails, sComponent, fnSupportInfo) {
if (!fnSupportInfo && !sComponent && typeof sDetails === "function") {
fnSupportInfo = sDetails;
sDetails = "";
}
if (!fnSupportInfo && typeof sComponent === "function") {
fnSupportInfo = sComponent;
sComponent = "";
}
sComponent = sComponent || sDefaultComponent;
if (iLevel <= level(sComponent) ) {
var fNow = now(),
oNow = new Date(fNow),
iMicroSeconds = Math.floor((fNow - Math.floor(fNow)) * 1000),
oLogEntry = {
time : pad0(oNow.getHours(),2) + ":" + pad0(oNow.getMinutes(),2) + ":" + pad0(oNow.getSeconds(),2) + "." + pad0(oNow.getMilliseconds(),3) + pad0(iMicroSeconds,3),
date : pad0(oNow.getFullYear(),4) + "-" + pad0(oNow.getMonth() + 1,2) + "-" + pad0(oNow.getDate(),2),
timestamp: fNow,
level : iLevel,
message : String(sMessage || ""),
details : String(sDetails || ""),
component: String(sComponent || "")
};
if (bLogSupportInfo && typeof fnSupportInfo === "function") {
oLogEntry.supportInfo = fnSupportInfo();
}
aLog.push( oLogEntry );
if (oListener) {
oListener.onLogEntry(oLogEntry);
}
/*
* Console Log, also tries to log to the console, if available.
*
* Unfortunately, the support for console is quite different between the UI5 browsers. The most important differences are:
* - in IE (checked until IE9), the console object does not exist in a window, until the developer tools are opened for that window.
* After opening the dev tools, the console remains available even when the tools are closed again. Only using a new window (or tab)
* restores the old state without console.
* When the console is available, it provides most standard methods, but not debug and trace
* - in FF3.6 the console is not available, until FireBug is opened. It disappears again, when fire bug is closed.
* But when the settings for a web site are stored (convenience), the console remains open
* When the console is available, it supports all relevant methods
* - in FF9.0, the console is always available, but method assert is only available when firebug is open
* - in Webkit browsers, the console object is always available and has all required methods
* - Exception: in the iOS Simulator, console.info() does not exist
*/
/*eslint-disable no-console */
if (console) { // in IE and FF, console might not exist; in FF it might even disappear
var isDetailsError = sDetails instanceof Error,
logText = oLogEntry.date + " " + oLogEntry.time + " " + oLogEntry.message + " - " + oLogEntry.details + " " + oLogEntry.component;
switch (iLevel) {
case Log.Level.FATAL:
case Log.Level.ERROR: isDetailsError ? console.error(logText, "\n", sDetails) : console.error(logText); break;
case Log.Level.WARNING: isDetailsError ? console.warn(logText, "\n", sDetails) : console.warn(logText); break;
case Log.Level.INFO:
if (console.info) { // info not available in iOS simulator
isDetailsError ? console.info(logText, "\n", sDetails) : console.info(logText);
} else {
isDetailsError ? console.log(logText, "\n", sDetails) : console.log(logText);
}
break;
case Log.Level.DEBUG:
if (console.debug) { // debug not available in IE, fallback to log
isDetailsError ? console.debug(logText, "\n", sDetails) : console.debug(logText);
} else {
isDetailsError ? console.log(logText, "\n", sDetails) : console.log(logText);
}
break;
case Log.Level.TRACE:
if (console.trace) { // trace not available in IE, fallback to log (no trace)
isDetailsError ? console.trace(logText, "\n", sDetails) : console.trace(logText);
} else {
isDetailsError ? console.log(logText, "\n", sDetails) : console.log(logText);
}
break;
}
if (console.info && oLogEntry.supportInfo) {
console.info(oLogEntry.supportInfo);
}
}
/*eslint-enable no-console */
return oLogEntry;
}
} | [
"function",
"log",
"(",
"iLevel",
",",
"sMessage",
",",
"sDetails",
",",
"sComponent",
",",
"fnSupportInfo",
")",
"{",
"if",
"(",
"!",
"fnSupportInfo",
"&&",
"!",
"sComponent",
"&&",
"typeof",
"sDetails",
"===",
"\"function\"",
")",
"{",
"fnSupportInfo",
"="... | Creates a new log entry depending on its level and component.
If the given level is higher than the max level for the given component
(or higher than the global level, if no component is given),
then no entry is created and <code>undefined</code> is returned.
If an <code>Error</code> is passed via <code>sDetails</code> the stack
of the <code>Error</code> will be logged as a separate parameter in
the proper <code>console</code> function for the matching log level.
@param {module:sap/base/Log.Level} iLevel One of the log levels FATAL, ERROR, WARNING, INFO, DEBUG, TRACE
@param {string} sMessage The message to be logged
@param {string|Error} [sDetails] The optional details for the message; could be an Error which will be logged with the stack to easily find the root cause of the Error
@param {string} [sComponent] The log component under which the message should be logged
@param {function} [fnSupportInfo] Callback that returns an additional support object to be logged in support mode.
This function is only called if support info mode is turned on with <code>logSupportInfo(true)</code>.
To avoid negative effects regarding execution times and memory consumption, the returned object should be a simple
immutable JSON object with mostly static and stable content.
@returns {object} The log entry as an object or <code>undefined</code> if no entry was created
@private | [
"Creates",
"a",
"new",
"log",
"entry",
"depending",
"on",
"its",
"level",
"and",
"component",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/base/Log.js#L359-L443 | train | Logs to the console. | [
30522,
3853,
8833,
1006,
17869,
15985,
1010,
15488,
7971,
4270,
1010,
17371,
12928,
12146,
1010,
8040,
25377,
5643,
3372,
1010,
1042,
3619,
6279,
6442,
2378,
14876,
1007,
1063,
2065,
1006,
999,
1042,
3619,
6279,
6442,
2378,
14876,
1004,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
nhn/tui.editor | src/js/extensions/table/mergedTableUI.js | _changeContent | function _changeContent(popupTableUtils) {
const POPUP_CONTENT = [
`<button type="button" class="te-table-add-row">${i18n.get('Add row')}</button>`,
`<button type="button" class="te-table-add-col">${i18n.get('Add col')}</button>`,
`<button type="button" class="te-table-remove-row">${i18n.get('Remove row')}</button>`,
`<button type="button" class="te-table-remove-col">${i18n.get('Remove col')}</button>`,
'<hr/>',
`<button type="button" class="te-table-merge">${i18n.get('Merge cells')}</button>`,
`<button type="button" class="te-table-unmerge">${i18n.get('Unmerge cells')}</button>`,
'<hr/>',
`<button type="button" class="te-table-col-align-left">${i18n.get('Align left')}</button>`,
`<button type="button" class="te-table-col-align-center">${i18n.get('Align center')}</button>`,
`<button type="button" class="te-table-col-align-right">${i18n.get('Align right')}</button>`,
'<hr/>',
`<button type="button" class="te-table-remove">${i18n.get('Remove table')}</button>`
].join('');
const $popupContent = $(POPUP_CONTENT);
popupTableUtils.setContent($popupContent);
} | javascript | function _changeContent(popupTableUtils) {
const POPUP_CONTENT = [
`<button type="button" class="te-table-add-row">${i18n.get('Add row')}</button>`,
`<button type="button" class="te-table-add-col">${i18n.get('Add col')}</button>`,
`<button type="button" class="te-table-remove-row">${i18n.get('Remove row')}</button>`,
`<button type="button" class="te-table-remove-col">${i18n.get('Remove col')}</button>`,
'<hr/>',
`<button type="button" class="te-table-merge">${i18n.get('Merge cells')}</button>`,
`<button type="button" class="te-table-unmerge">${i18n.get('Unmerge cells')}</button>`,
'<hr/>',
`<button type="button" class="te-table-col-align-left">${i18n.get('Align left')}</button>`,
`<button type="button" class="te-table-col-align-center">${i18n.get('Align center')}</button>`,
`<button type="button" class="te-table-col-align-right">${i18n.get('Align right')}</button>`,
'<hr/>',
`<button type="button" class="te-table-remove">${i18n.get('Remove table')}</button>`
].join('');
const $popupContent = $(POPUP_CONTENT);
popupTableUtils.setContent($popupContent);
} | [
"function",
"_changeContent",
"(",
"popupTableUtils",
")",
"{",
"const",
"POPUP_CONTENT",
"=",
"[",
"`",
"${",
"i18n",
".",
"get",
"(",
"'Add row'",
")",
"}",
"`",
",",
"`",
"${",
"i18n",
".",
"get",
"(",
"'Add col'",
")",
"}",
"`",
",",
"`",
"${",
... | Change contextmenu content.
@param {object} popupTableUtils - PopupTableUtils instance for managing contextmenu of table
@private | [
"Change",
"contextmenu",
"content",
"."
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/extensions/table/mergedTableUI.js#L15-L34 | train | Change the content of the popup table | [
30522,
3853,
1035,
2689,
8663,
6528,
2102,
1006,
3769,
29441,
3085,
21823,
4877,
1007,
1063,
9530,
3367,
3769,
6279,
1035,
4180,
1027,
1031,
1036,
1026,
6462,
2828,
1027,
1000,
6462,
1000,
2465,
1027,
1000,
8915,
1011,
2795,
1011,
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... |
adobe/brackets | src/LiveDevelopment/Agents/DOMHelpers.js | _find | function _find(src, match, skip, quotes, comments) {
if (typeof match === "string") {
match = [match, match.length];
}
if (skip === undefined) {
skip = 0;
}
var i, activeQuote, isComment = false;
for (i = skip; i < src.length; i++) {
if (quotes && _isQuote(src[i], src[i - 1], activeQuote)) {
// starting quote
activeQuote = activeQuote ? undefined : src[i];
} else if (!activeQuote) {
if (comments && !isComment && src.substr(i, comments[0].length) === comments[0]) {
// opening comment
isComment = true;
i += comments[0].length - 1;
} else if (isComment) {
// we are commented
if (src.substr(i, comments[1].length) === comments[1]) {
isComment = false;
i += comments[1].length - 1;
}
} else if (src.substr(i, match[1]).search(match[0]) === 0) {
// match
return i;
}
}
}
return -1;
} | javascript | function _find(src, match, skip, quotes, comments) {
if (typeof match === "string") {
match = [match, match.length];
}
if (skip === undefined) {
skip = 0;
}
var i, activeQuote, isComment = false;
for (i = skip; i < src.length; i++) {
if (quotes && _isQuote(src[i], src[i - 1], activeQuote)) {
// starting quote
activeQuote = activeQuote ? undefined : src[i];
} else if (!activeQuote) {
if (comments && !isComment && src.substr(i, comments[0].length) === comments[0]) {
// opening comment
isComment = true;
i += comments[0].length - 1;
} else if (isComment) {
// we are commented
if (src.substr(i, comments[1].length) === comments[1]) {
isComment = false;
i += comments[1].length - 1;
}
} else if (src.substr(i, match[1]).search(match[0]) === 0) {
// match
return i;
}
}
}
return -1;
} | [
"function",
"_find",
"(",
"src",
",",
"match",
",",
"skip",
",",
"quotes",
",",
"comments",
")",
"{",
"if",
"(",
"typeof",
"match",
"===",
"\"string\"",
")",
"{",
"match",
"=",
"[",
"match",
",",
"match",
".",
"length",
"]",
";",
"}",
"if",
"(",
... | Find the next match using several constraints
@param {string} source string
@param {string} or [{regex}, {length}] the match definition
@param {integer} ignore characters before this offset
@param {boolean} watch for quotes
@param [{string},{string}] watch for comments | [
"Find",
"the",
"next",
"match",
"using",
"several",
"constraints"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/LiveDevelopment/Agents/DOMHelpers.js#L66-L96 | train | Find the first match in the source string | [
30522,
3853,
1035,
2424,
1006,
5034,
2278,
1010,
2674,
1010,
13558,
1010,
16614,
1010,
7928,
1007,
1063,
2065,
1006,
2828,
11253,
2674,
1027,
1027,
1027,
1000,
5164,
1000,
1007,
1063,
2674,
1027,
1031,
2674,
1010,
2674,
1012,
3091,
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... |
GitbookIO/gitbook | lib/templating/postRender.js | postRender | function postRender(engine, output) {
var content = output.getContent();
var blocks = output.getBlocks();
var result = replaceBlocks(content, blocks);
return Promise.forEach(blocks, function(block) {
var post = block.get('post');
if (!post) {
return;
}
return post();
})
.thenResolve(result);
} | javascript | function postRender(engine, output) {
var content = output.getContent();
var blocks = output.getBlocks();
var result = replaceBlocks(content, blocks);
return Promise.forEach(blocks, function(block) {
var post = block.get('post');
if (!post) {
return;
}
return post();
})
.thenResolve(result);
} | [
"function",
"postRender",
"(",
"engine",
",",
"output",
")",
"{",
"var",
"content",
"=",
"output",
".",
"getContent",
"(",
")",
";",
"var",
"blocks",
"=",
"output",
".",
"getBlocks",
"(",
")",
";",
"var",
"result",
"=",
"replaceBlocks",
"(",
"content",
... | Post render a template:
- Execute "post" for blocks
- Replace block content
@param {TemplateEngine} engine
@param {TemplateOutput} content
@return {Promise<String>} | [
"Post",
"render",
"a",
"template",
":",
"-",
"Execute",
"post",
"for",
"blocks",
"-",
"Replace",
"block",
"content"
] | 6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4 | https://github.com/GitbookIO/gitbook/blob/6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4/lib/templating/postRender.js#L35-L51 | train | Post render the content of the output | [
30522,
3853,
2695,
7389,
4063,
1006,
3194,
1010,
6434,
1007,
1063,
13075,
4180,
1027,
6434,
1012,
2131,
8663,
6528,
2102,
1006,
1007,
1025,
13075,
5991,
1027,
6434,
1012,
2131,
23467,
2015,
1006,
1007,
1025,
13075,
2765,
1027,
5672,
23467,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
fex-team/webuploader | build/tasks/concat.js | filesFilter | function filesFilter( f, files ) {
var cwd = f.cwd || '',
ret = [],
process = function( file ) {
var fileinfo = path.join( cwd, file ),
dirpath = path.dirname( fileinfo ),
depends = [],
str, matches, idx;
if ( !grunt.file.exists( fileinfo ) ) {
return;
}
ret.push( file );
str = grunt.file.read( fileinfo );
// 从require( dps )中找
// 从defind( id?, dps, factory )中找
str = str.replace( /(?:define|require)\s*\(\s*\[([^\]]+?)\],/g, function( _, m1 ) {
m1 = m1.replace(/\s/g, '').split(',');
depends = depends.concat( m1.map(function( item ) {
item = item.substring( 1, item.length - 1 );
item = item.substring(0, 1) === '.' ?
path.join( dirpath, item ):
path.join( cwd, item );
return path.relative( cwd, item ) + '.js';
}) );
return _;
});
str = str.replace( /require\s*\(\s*('|")(.+?)\1/g, function( _, m1, item ) {
item = item.substring(0, 1) === '.' ?
path.join( dirpath, item ):
path.join( cwd, item );
depends.push( path.relative( cwd, item ) + '.js' );
return _;
});
if ( depends.length ) {
depends = depends.filter(function( item, idx, array ) {
return array.indexOf( item ) === idx && grunt.file.exists( path.join( cwd, item ) );
});
idx = ret.indexOf( file );
[].splice.apply( ret, [ idx, 0 ].concat( depends ) );
depends.forEach( process );
}
};
// console.log( files );
files.forEach( process );
ret = ret.filter(function( item, idx, arr ){
return idx === arr.indexOf( item );
});
ret.unshift( path.relative( cwd, intro ) );
ret.push( path.relative( cwd, outro ) );
return ret;
} | javascript | function filesFilter( f, files ) {
var cwd = f.cwd || '',
ret = [],
process = function( file ) {
var fileinfo = path.join( cwd, file ),
dirpath = path.dirname( fileinfo ),
depends = [],
str, matches, idx;
if ( !grunt.file.exists( fileinfo ) ) {
return;
}
ret.push( file );
str = grunt.file.read( fileinfo );
// 从require( dps )中找
// 从defind( id?, dps, factory )中找
str = str.replace( /(?:define|require)\s*\(\s*\[([^\]]+?)\],/g, function( _, m1 ) {
m1 = m1.replace(/\s/g, '').split(',');
depends = depends.concat( m1.map(function( item ) {
item = item.substring( 1, item.length - 1 );
item = item.substring(0, 1) === '.' ?
path.join( dirpath, item ):
path.join( cwd, item );
return path.relative( cwd, item ) + '.js';
}) );
return _;
});
str = str.replace( /require\s*\(\s*('|")(.+?)\1/g, function( _, m1, item ) {
item = item.substring(0, 1) === '.' ?
path.join( dirpath, item ):
path.join( cwd, item );
depends.push( path.relative( cwd, item ) + '.js' );
return _;
});
if ( depends.length ) {
depends = depends.filter(function( item, idx, array ) {
return array.indexOf( item ) === idx && grunt.file.exists( path.join( cwd, item ) );
});
idx = ret.indexOf( file );
[].splice.apply( ret, [ idx, 0 ].concat( depends ) );
depends.forEach( process );
}
};
// console.log( files );
files.forEach( process );
ret = ret.filter(function( item, idx, arr ){
return idx === arr.indexOf( item );
});
ret.unshift( path.relative( cwd, intro ) );
ret.push( path.relative( cwd, outro ) );
return ret;
} | [
"function",
"filesFilter",
"(",
"f",
",",
"files",
")",
"{",
"var",
"cwd",
"=",
"f",
".",
"cwd",
"||",
"''",
",",
"ret",
"=",
"[",
"]",
",",
"process",
"=",
"function",
"(",
"file",
")",
"{",
"var",
"fileinfo",
"=",
"path",
".",
"join",
"(",
"c... | 排序,把依赖的文件移动到最上面。 | [
"排序,把依赖的文件移动到最上面。"
] | 7094e4476c5af3b06993d91dde2d223200b9feb7 | https://github.com/fex-team/webuploader/blob/7094e4476c5af3b06993d91dde2d223200b9feb7/build/tasks/concat.js#L38-L103 | train | filter files | [
30522,
3853,
6764,
8873,
21928,
1006,
1042,
1010,
6764,
1007,
1063,
13075,
19296,
2094,
1027,
1042,
1012,
19296,
2094,
1064,
1064,
1005,
1005,
1010,
2128,
2102,
1027,
1031,
1033,
1010,
2832,
1027,
3853,
1006,
5371,
1007,
1063,
13075,
5371,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
goldfire/howler.js | dist/howler.js | function() {
var self = this;
var limit = self._pool;
var cnt = 0;
var i = 0;
// If there are less sounds than the max pool size, we are done.
if (self._sounds.length < limit) {
return;
}
// Count the number of inactive sounds.
for (i=0; i<self._sounds.length; i++) {
if (self._sounds[i]._ended) {
cnt++;
}
}
// Remove excess inactive sounds, going in reverse order.
for (i=self._sounds.length - 1; i>=0; i--) {
if (cnt <= limit) {
return;
}
if (self._sounds[i]._ended) {
// Disconnect the audio source when using Web Audio.
if (self._webAudio && self._sounds[i]._node) {
self._sounds[i]._node.disconnect(0);
}
// Remove sounds until we have the pool size.
self._sounds.splice(i, 1);
cnt--;
}
}
} | javascript | function() {
var self = this;
var limit = self._pool;
var cnt = 0;
var i = 0;
// If there are less sounds than the max pool size, we are done.
if (self._sounds.length < limit) {
return;
}
// Count the number of inactive sounds.
for (i=0; i<self._sounds.length; i++) {
if (self._sounds[i]._ended) {
cnt++;
}
}
// Remove excess inactive sounds, going in reverse order.
for (i=self._sounds.length - 1; i>=0; i--) {
if (cnt <= limit) {
return;
}
if (self._sounds[i]._ended) {
// Disconnect the audio source when using Web Audio.
if (self._webAudio && self._sounds[i]._node) {
self._sounds[i]._node.disconnect(0);
}
// Remove sounds until we have the pool size.
self._sounds.splice(i, 1);
cnt--;
}
}
} | [
"function",
"(",
")",
"{",
"var",
"self",
"=",
"this",
";",
"var",
"limit",
"=",
"self",
".",
"_pool",
";",
"var",
"cnt",
"=",
"0",
";",
"var",
"i",
"=",
"0",
";",
"// If there are less sounds than the max pool size, we are done.",
"if",
"(",
"self",
".",
... | Drain excess inactive sounds from the pool. | [
"Drain",
"excess",
"inactive",
"sounds",
"from",
"the",
"pool",
"."
] | 030db918dd8ce640afd57e172418472497e8f113 | https://github.com/goldfire/howler.js/blob/030db918dd8ce640afd57e172418472497e8f113/dist/howler.js#L2028-L2063 | train | Remove all inactive sounds from the pool. | [
30522,
3853,
1006,
1007,
1063,
13075,
2969,
1027,
2023,
1025,
13075,
5787,
1027,
2969,
1012,
1035,
4770,
1025,
13075,
27166,
2102,
1027,
1014,
1025,
13075,
1045,
1027,
1014,
1025,
1013,
1013,
2065,
2045,
2024,
2625,
4165,
2084,
1996,
4098,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
adobe/brackets | src/search/ScrollTrackMarkers.js | setVisible | function setVisible(curEditor, visible) {
// short-circuit no-ops
if ((visible && curEditor === editor) || (!visible && !editor)) {
return;
}
if (visible) {
console.assert(!editor);
editor = curEditor;
// Don't support inline editors yet - search inside them is pretty screwy anyway (#2110)
if (editor.isTextSubset()) {
return;
}
var $sb = _getScrollbar(editor),
$overlay = $("<div class='tickmark-track'></div>");
$sb.parent().append($overlay);
_calcScaling();
// Update tickmarks during editor resize (whenever resizing has paused/stopped for > 1/3 sec)
WorkspaceManager.on("workspaceUpdateLayout.ScrollTrackMarkers", _.debounce(function () {
if (marks.length) {
_calcScaling();
$(".tickmark-track", editor.getRootElement()).empty();
_renderMarks(marks);
}
}, 300));
} else {
console.assert(editor === curEditor);
$(".tickmark-track", curEditor.getRootElement()).remove();
editor = null;
marks = [];
WorkspaceManager.off("workspaceUpdateLayout.ScrollTrackMarkers");
}
} | javascript | function setVisible(curEditor, visible) {
// short-circuit no-ops
if ((visible && curEditor === editor) || (!visible && !editor)) {
return;
}
if (visible) {
console.assert(!editor);
editor = curEditor;
// Don't support inline editors yet - search inside them is pretty screwy anyway (#2110)
if (editor.isTextSubset()) {
return;
}
var $sb = _getScrollbar(editor),
$overlay = $("<div class='tickmark-track'></div>");
$sb.parent().append($overlay);
_calcScaling();
// Update tickmarks during editor resize (whenever resizing has paused/stopped for > 1/3 sec)
WorkspaceManager.on("workspaceUpdateLayout.ScrollTrackMarkers", _.debounce(function () {
if (marks.length) {
_calcScaling();
$(".tickmark-track", editor.getRootElement()).empty();
_renderMarks(marks);
}
}, 300));
} else {
console.assert(editor === curEditor);
$(".tickmark-track", curEditor.getRootElement()).remove();
editor = null;
marks = [];
WorkspaceManager.off("workspaceUpdateLayout.ScrollTrackMarkers");
}
} | [
"function",
"setVisible",
"(",
"curEditor",
",",
"visible",
")",
"{",
"// short-circuit no-ops",
"if",
"(",
"(",
"visible",
"&&",
"curEditor",
"===",
"editor",
")",
"||",
"(",
"!",
"visible",
"&&",
"!",
"editor",
")",
")",
"{",
"return",
";",
"}",
"if",
... | Add or remove the tickmark track from the editor's UI | [
"Add",
"or",
"remove",
"the",
"tickmark",
"track",
"from",
"the",
"editor",
"s",
"UI"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/search/ScrollTrackMarkers.js#L173-L210 | train | set visible flag | [
30522,
3853,
2275,
11365,
7028,
1006,
21391,
15660,
1010,
5710,
1007,
1063,
1013,
1013,
2460,
1011,
4984,
2053,
1011,
23092,
2065,
1006,
1006,
5710,
1004,
1004,
21391,
15660,
1027,
1027,
1027,
3559,
1007,
1064,
1064,
1006,
999,
5710,
1004,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/JSUtils/ScopeManager.js | getJumptoDef | function getJumptoDef(fileInfo, offset) {
postMessage({
type: MessageIds.TERN_JUMPTODEF_MSG,
fileInfo: fileInfo,
offset: offset
});
return addPendingRequest(fileInfo.name, offset, MessageIds.TERN_JUMPTODEF_MSG);
} | javascript | function getJumptoDef(fileInfo, offset) {
postMessage({
type: MessageIds.TERN_JUMPTODEF_MSG,
fileInfo: fileInfo,
offset: offset
});
return addPendingRequest(fileInfo.name, offset, MessageIds.TERN_JUMPTODEF_MSG);
} | [
"function",
"getJumptoDef",
"(",
"fileInfo",
",",
"offset",
")",
"{",
"postMessage",
"(",
"{",
"type",
":",
"MessageIds",
".",
"TERN_JUMPTODEF_MSG",
",",
"fileInfo",
":",
"fileInfo",
",",
"offset",
":",
"offset",
"}",
")",
";",
"return",
"addPendingRequest",
... | Get a Promise for the definition from TernJS, for the file & offset passed in.
@param {{type: string, name: string, offsetLines: number, text: string}} fileInfo
- type of update, name of file, and the text of the update.
For "full" updates, the whole text of the file is present. For "part" updates,
the changed portion of the text. For "empty" updates, the file has not been modified
and the text is empty.
@param {{line: number, ch: number}} offset - the offset in the file the hints should be calculate at
@return {jQuery.Promise} - a promise that will resolve to definition when
it is done | [
"Get",
"a",
"Promise",
"for",
"the",
"definition",
"from",
"TernJS",
"for",
"the",
"file",
"&",
"offset",
"passed",
"in",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/JSUtils/ScopeManager.js#L345-L353 | train | Get the jumpto definition | [
30522,
3853,
2131,
9103,
27718,
10244,
2546,
1006,
5371,
2378,
14876,
1010,
16396,
1007,
1063,
2695,
7834,
3736,
3351,
1006,
1063,
2828,
1024,
4471,
9821,
1012,
28774,
2078,
1035,
5376,
3406,
3207,
2546,
1035,
5796,
2290,
1010,
5371,
2378,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | script/bump-version.js | commitVersionBump | async function commitVersionBump (version) {
const gitDir = path.resolve(__dirname, '..')
const gitArgs = ['commit', '-a', '-m', `Bump v${version}`, '-n']
await GitProcess.exec(gitArgs, gitDir)
} | javascript | async function commitVersionBump (version) {
const gitDir = path.resolve(__dirname, '..')
const gitArgs = ['commit', '-a', '-m', `Bump v${version}`, '-n']
await GitProcess.exec(gitArgs, gitDir)
} | [
"async",
"function",
"commitVersionBump",
"(",
"version",
")",
"{",
"const",
"gitDir",
"=",
"path",
".",
"resolve",
"(",
"__dirname",
",",
"'..'",
")",
"const",
"gitArgs",
"=",
"[",
"'commit'",
",",
"'-a'",
",",
"'-m'",
",",
"`",
"${",
"version",
"}",
... | push bump commit to release branch | [
"push",
"bump",
"commit",
"to",
"release",
"branch"
] | 6e29611788277729647acf465f10db1ea6f15788 | https://github.com/electron/electron/blob/6e29611788277729647acf465f10db1ea6f15788/script/bump-version.js#L135-L139 | train | Commit a version bump | [
30522,
2004,
6038,
2278,
3853,
10797,
27774,
8569,
8737,
1006,
2544,
1007,
1063,
9530,
3367,
21025,
2102,
4305,
2099,
1027,
4130,
1012,
10663,
1006,
1035,
1035,
16101,
18442,
1010,
1005,
1012,
1012,
1005,
1007,
9530,
3367,
21025,
7559,
5620... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/incubator-echarts | src/chart/treemap/TreemapView.js | renderBackground | function renderBackground(group, bg, useUpperLabel) {
// For tooltip.
bg.dataIndex = thisNode.dataIndex;
bg.seriesIndex = seriesModel.seriesIndex;
bg.setShape({x: 0, y: 0, width: thisWidth, height: thisHeight});
var visualBorderColor = thisNode.getVisual('borderColor', true);
var emphasisBorderColor = itemStyleEmphasisModel.get('borderColor');
updateStyle(bg, function () {
var normalStyle = getItemStyleNormal(itemStyleNormalModel);
normalStyle.fill = visualBorderColor;
var emphasisStyle = getItemStyleEmphasis(itemStyleEmphasisModel);
emphasisStyle.fill = emphasisBorderColor;
if (useUpperLabel) {
var upperLabelWidth = thisWidth - 2 * borderWidth;
prepareText(
normalStyle, emphasisStyle, visualBorderColor, upperLabelWidth, upperHeight,
{x: borderWidth, y: 0, width: upperLabelWidth, height: upperHeight}
);
}
// For old bg.
else {
normalStyle.text = emphasisStyle.text = null;
}
bg.setStyle(normalStyle);
graphic.setHoverStyle(bg, emphasisStyle);
});
group.add(bg);
} | javascript | function renderBackground(group, bg, useUpperLabel) {
// For tooltip.
bg.dataIndex = thisNode.dataIndex;
bg.seriesIndex = seriesModel.seriesIndex;
bg.setShape({x: 0, y: 0, width: thisWidth, height: thisHeight});
var visualBorderColor = thisNode.getVisual('borderColor', true);
var emphasisBorderColor = itemStyleEmphasisModel.get('borderColor');
updateStyle(bg, function () {
var normalStyle = getItemStyleNormal(itemStyleNormalModel);
normalStyle.fill = visualBorderColor;
var emphasisStyle = getItemStyleEmphasis(itemStyleEmphasisModel);
emphasisStyle.fill = emphasisBorderColor;
if (useUpperLabel) {
var upperLabelWidth = thisWidth - 2 * borderWidth;
prepareText(
normalStyle, emphasisStyle, visualBorderColor, upperLabelWidth, upperHeight,
{x: borderWidth, y: 0, width: upperLabelWidth, height: upperHeight}
);
}
// For old bg.
else {
normalStyle.text = emphasisStyle.text = null;
}
bg.setStyle(normalStyle);
graphic.setHoverStyle(bg, emphasisStyle);
});
group.add(bg);
} | [
"function",
"renderBackground",
"(",
"group",
",",
"bg",
",",
"useUpperLabel",
")",
"{",
"// For tooltip.",
"bg",
".",
"dataIndex",
"=",
"thisNode",
".",
"dataIndex",
";",
"bg",
".",
"seriesIndex",
"=",
"seriesModel",
".",
"seriesIndex",
";",
"bg",
".",
"set... | ---------------------------- | Procedures in renderNode | ---------------------------- | [
"----------------------------",
"|",
"Procedures",
"in",
"renderNode",
"|",
"----------------------------"
] | 4d0ea095dc3929cb6de40c45748826e7999c7aa8 | https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/chart/treemap/TreemapView.js#L743-L776 | train | Render background | [
30522,
3853,
17552,
5963,
16365,
1006,
2177,
1010,
1038,
2290,
1010,
2224,
29547,
12190,
16336,
2140,
1007,
1063,
1013,
1013,
2005,
6994,
25101,
1012,
1038,
2290,
1012,
2951,
22254,
10288,
1027,
2023,
3630,
3207,
1012,
2951,
22254,
10288,
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... |
catapult-project/catapult | tracing/third_party/oboe/src/lists.js | reverseInner | function reverseInner( list, reversedAlready ) {
if( !list ) {
return reversedAlready;
}
return reverseInner(tail(list), cons(head(list), reversedAlready))
} | javascript | function reverseInner( list, reversedAlready ) {
if( !list ) {
return reversedAlready;
}
return reverseInner(tail(list), cons(head(list), reversedAlready))
} | [
"function",
"reverseInner",
"(",
"list",
",",
"reversedAlready",
")",
"{",
"if",
"(",
"!",
"list",
")",
"{",
"return",
"reversedAlready",
";",
"}",
"return",
"reverseInner",
"(",
"tail",
"(",
"list",
")",
",",
"cons",
"(",
"head",
"(",
"list",
")",
","... | js re-implementation of 3rd solution from: http://www.haskell.org/haskellwiki/99_questions/Solutions/5 | [
"js",
"re",
"-",
"implementation",
"of",
"3rd",
"solution",
"from",
":",
"http",
":",
"//",
"www",
".",
"haskell",
".",
"org",
"/",
"haskellwiki",
"/",
"99_questions",
"/",
"Solutions",
"/",
"5"
] | 992929ffccac68827869a497f01ee4d653ed4f25 | https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/tracing/third_party/oboe/src/lists.js#L176-L182 | train | reverseInner - reverse the list | [
30522,
3853,
7901,
23111,
2121,
1006,
2862,
1010,
11674,
2389,
16416,
5149,
1007,
1063,
2065,
1006,
999,
2862,
1007,
1063,
2709,
11674,
2389,
16416,
5149,
1025,
1065,
2709,
7901,
23111,
2121,
1006,
5725,
1006,
2862,
1007,
1010,
9530,
2015,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
websockets/ws | lib/buffer-util.js | toArrayBuffer | function toArrayBuffer(buf) {
if (buf.byteLength === buf.buffer.byteLength) {
return buf.buffer;
}
return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength);
} | javascript | function toArrayBuffer(buf) {
if (buf.byteLength === buf.buffer.byteLength) {
return buf.buffer;
}
return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength);
} | [
"function",
"toArrayBuffer",
"(",
"buf",
")",
"{",
"if",
"(",
"buf",
".",
"byteLength",
"===",
"buf",
".",
"buffer",
".",
"byteLength",
")",
"{",
"return",
"buf",
".",
"buffer",
";",
"}",
"return",
"buf",
".",
"buffer",
".",
"slice",
"(",
"buf",
".",... | Converts a buffer to an `ArrayBuffer`.
@param {Buffer} buf The buffer to convert
@return {ArrayBuffer} Converted buffer
@public | [
"Converts",
"a",
"buffer",
"to",
"an",
"ArrayBuffer",
"."
] | 995c527c87d0d4833d8093c18dcfa2e4a41d9582 | https://github.com/websockets/ws/blob/995c527c87d0d4833d8093c18dcfa2e4a41d9582/lib/buffer-util.js#L67-L73 | train | Converts a buffer to an array of bytes | [
30522,
3853,
2000,
2906,
9447,
8569,
12494,
1006,
20934,
2546,
1007,
1063,
2065,
1006,
20934,
2546,
1012,
24880,
7770,
13512,
2232,
1027,
1027,
1027,
20934,
2546,
1012,
17698,
1012,
24880,
7770,
13512,
2232,
1007,
1063,
2709,
20934,
2546,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/project/WorkingSetSort.js | _setCurrentSort | function _setCurrentSort(newSort) {
if (_currentSort !== newSort) {
if (_currentSort !== null) {
_currentSort.setChecked(false);
}
if (_automaticSort) {
newSort.setChecked(true);
}
CommandManager.get(Commands.CMD_WORKING_SORT_TOGGLE_AUTO).setEnabled(!!newSort.getEvents());
PreferencesManager.setViewState(_WORKING_SET_SORT_PREF, newSort.getCommandID());
_currentSort = newSort;
}
} | javascript | function _setCurrentSort(newSort) {
if (_currentSort !== newSort) {
if (_currentSort !== null) {
_currentSort.setChecked(false);
}
if (_automaticSort) {
newSort.setChecked(true);
}
CommandManager.get(Commands.CMD_WORKING_SORT_TOGGLE_AUTO).setEnabled(!!newSort.getEvents());
PreferencesManager.setViewState(_WORKING_SET_SORT_PREF, newSort.getCommandID());
_currentSort = newSort;
}
} | [
"function",
"_setCurrentSort",
"(",
"newSort",
")",
"{",
"if",
"(",
"_currentSort",
"!==",
"newSort",
")",
"{",
"if",
"(",
"_currentSort",
"!==",
"null",
")",
"{",
"_currentSort",
".",
"setChecked",
"(",
"false",
")",
";",
"}",
"if",
"(",
"_automaticSort",... | Sets the current sort method and checks it on the context menu.
@private
@param {Sort} newSort | [
"Sets",
"the",
"current",
"sort",
"method",
"and",
"checks",
"it",
"on",
"the",
"context",
"menu",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/project/WorkingSetSort.js#L188-L201 | train | set current sort | [
30522,
3853,
1035,
2275,
10841,
14343,
7666,
11589,
1006,
2739,
11589,
1007,
1063,
2065,
1006,
1035,
14731,
11589,
999,
1027,
1027,
2739,
11589,
1007,
1063,
2065,
1006,
1035,
14731,
11589,
999,
1027,
1027,
19701,
1007,
1063,
1035,
14731,
11... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/extensions/default/InlineTimingFunctionEditor/BezierCurveEditor.js | BezierCurveEditor | function BezierCurveEditor($parent, bezierCurve, callback) {
// Create the DOM structure, filling in localized strings via Mustache
this.$element = $(Mustache.render(BezierCurveEditorTemplate, Strings));
$parent.append(this.$element);
this._callback = callback;
this.dragElement = null;
// current cubic-bezier() function params
this._cubicBezierCoords = this._getCubicBezierCoords(bezierCurve);
this.hint = {};
this.hint.elem = $(".hint", this.$element);
// If function was auto-corrected, then originalString holds the original function,
// and an informational message needs to be shown
if (bezierCurve.originalString) {
TimingFunctionUtils.showHideHint(this.hint, true, bezierCurve.originalString, "cubic-bezier(" + this._cubicBezierCoords.join(", ") + ")");
} else {
TimingFunctionUtils.showHideHint(this.hint, false);
}
this.P1 = this.$element.find(".P1")[0];
this.P2 = this.$element.find(".P2")[0];
this.curve = this.$element.find(".curve")[0];
this.P1.bezierEditor = this.P2.bezierEditor = this.curve.bezierEditor = this;
this.bezierCanvas = new BezierCanvas(this.curve, null, [0, 0]);
// redraw canvas
this._updateCanvas();
$(this.curve)
.on("click", _curveClick)
.on("mousemove", _curveMouseMove);
$(this.P1)
.on("mousemove", _pointMouseMove)
.on("mousedown", _pointMouseDown)
.on("mouseup", _pointMouseUp)
.on("keydown", _pointKeyDown);
$(this.P2)
.on("mousemove", _pointMouseMove)
.on("mousedown", _pointMouseDown)
.on("mouseup", _pointMouseUp)
.on("keydown", _pointKeyDown);
} | javascript | function BezierCurveEditor($parent, bezierCurve, callback) {
// Create the DOM structure, filling in localized strings via Mustache
this.$element = $(Mustache.render(BezierCurveEditorTemplate, Strings));
$parent.append(this.$element);
this._callback = callback;
this.dragElement = null;
// current cubic-bezier() function params
this._cubicBezierCoords = this._getCubicBezierCoords(bezierCurve);
this.hint = {};
this.hint.elem = $(".hint", this.$element);
// If function was auto-corrected, then originalString holds the original function,
// and an informational message needs to be shown
if (bezierCurve.originalString) {
TimingFunctionUtils.showHideHint(this.hint, true, bezierCurve.originalString, "cubic-bezier(" + this._cubicBezierCoords.join(", ") + ")");
} else {
TimingFunctionUtils.showHideHint(this.hint, false);
}
this.P1 = this.$element.find(".P1")[0];
this.P2 = this.$element.find(".P2")[0];
this.curve = this.$element.find(".curve")[0];
this.P1.bezierEditor = this.P2.bezierEditor = this.curve.bezierEditor = this;
this.bezierCanvas = new BezierCanvas(this.curve, null, [0, 0]);
// redraw canvas
this._updateCanvas();
$(this.curve)
.on("click", _curveClick)
.on("mousemove", _curveMouseMove);
$(this.P1)
.on("mousemove", _pointMouseMove)
.on("mousedown", _pointMouseDown)
.on("mouseup", _pointMouseUp)
.on("keydown", _pointKeyDown);
$(this.P2)
.on("mousemove", _pointMouseMove)
.on("mousedown", _pointMouseDown)
.on("mouseup", _pointMouseUp)
.on("keydown", _pointKeyDown);
} | [
"function",
"BezierCurveEditor",
"(",
"$parent",
",",
"bezierCurve",
",",
"callback",
")",
"{",
"// Create the DOM structure, filling in localized strings via Mustache",
"this",
".",
"$element",
"=",
"$",
"(",
"Mustache",
".",
"render",
"(",
"BezierCurveEditorTemplate",
"... | Constructor for BezierCurveEditor Object. This control may be used standalone
or within an InlineTimingFunctionEditor inline widget.
@param {!jQuery} $parent DOM node into which to append the root of the bezier curve editor UI
@param {!RegExpMatch} bezierCurve RegExp match object of initially selected bezierCurve
@param {!function(string)} callback Called whenever selected bezierCurve changes | [
"Constructor",
"for",
"BezierCurveEditor",
"Object",
".",
"This",
"control",
"may",
"be",
"used",
"standalone",
"or",
"within",
"an",
"InlineTimingFunctionEditor",
"inline",
"widget",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/InlineTimingFunctionEditor/BezierCurveEditor.js#L515-L560 | train | BezierCurveEditor constructor. | [
30522,
3853,
2022,
21548,
10841,
2099,
3726,
2098,
15660,
1006,
1002,
6687,
1010,
2022,
21548,
10841,
2099,
3726,
1010,
2655,
5963,
1007,
1063,
1013,
1013,
3443,
1996,
14383,
3252,
1010,
8110,
1999,
22574,
7817,
3081,
28786,
2023,
1012,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/model/odata/v4/ODataBinding.js | ODataBinding | function ODataBinding() {
// maps a canonical path of a quasi-absolute or relative binding to a cache object that may
// be reused
this.mCacheByResourcePath = undefined;
this.oCachePromise = SyncPromise.resolve();
this.mCacheQueryOptions = undefined;
// used to create cache only for the latest call to #fetchCache
this.oFetchCacheCallToken = undefined;
// change reason to be used when the binding is resumed
this.sResumeChangeReason = ChangeReason.Change;
} | javascript | function ODataBinding() {
// maps a canonical path of a quasi-absolute or relative binding to a cache object that may
// be reused
this.mCacheByResourcePath = undefined;
this.oCachePromise = SyncPromise.resolve();
this.mCacheQueryOptions = undefined;
// used to create cache only for the latest call to #fetchCache
this.oFetchCacheCallToken = undefined;
// change reason to be used when the binding is resumed
this.sResumeChangeReason = ChangeReason.Change;
} | [
"function",
"ODataBinding",
"(",
")",
"{",
"// maps a canonical path of a quasi-absolute or relative binding to a cache object that may",
"// be reused",
"this",
".",
"mCacheByResourcePath",
"=",
"undefined",
";",
"this",
".",
"oCachePromise",
"=",
"SyncPromise",
".",
"resolve"... | A mixin for all OData V4 bindings.
@alias sap.ui.model.odata.v4.ODataBinding
@mixin | [
"A",
"mixin",
"for",
"all",
"OData",
"V4",
"bindings",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/ODataBinding.js#L27-L37 | train | OData Binding constructor | [
30522,
3853,
1051,
2850,
2696,
8428,
4667,
1006,
1007,
1063,
1013,
1013,
7341,
1037,
18562,
4130,
1997,
1037,
17982,
1011,
7619,
2030,
5816,
8031,
2000,
1037,
17053,
4874,
2008,
2089,
30524,
2023,
1012,
22432,
5403,
3762,
6072,
8162,
3401,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
aws/aws-sdk-js | lib/credentials.js | get | function get(callback) {
var self = this;
if (this.needsRefresh()) {
this.refresh(function(err) {
if (!err) self.expired = false; // reset expired flag
if (callback) callback(err);
});
} else if (callback) {
callback();
}
} | javascript | function get(callback) {
var self = this;
if (this.needsRefresh()) {
this.refresh(function(err) {
if (!err) self.expired = false; // reset expired flag
if (callback) callback(err);
});
} else if (callback) {
callback();
}
} | [
"function",
"get",
"(",
"callback",
")",
"{",
"var",
"self",
"=",
"this",
";",
"if",
"(",
"this",
".",
"needsRefresh",
"(",
")",
")",
"{",
"this",
".",
"refresh",
"(",
"function",
"(",
"err",
")",
"{",
"if",
"(",
"!",
"err",
")",
"self",
".",
"... | Gets the existing credentials, refreshing them if they are not yet loaded
or have expired. Users should call this method before using {refresh},
as this will not attempt to reload credentials when they are already
loaded into the object.
@callback callback function(err)
When this callback is called with no error, it means either credentials
do not need to be refreshed or refreshed credentials information has
been loaded into the object (as the `accessKeyId`, `secretAccessKey`,
and `sessionToken` properties).
@param err [Error] if an error occurred, this value will be filled | [
"Gets",
"the",
"existing",
"credentials",
"refreshing",
"them",
"if",
"they",
"are",
"not",
"yet",
"loaded",
"or",
"have",
"expired",
".",
"Users",
"should",
"call",
"this",
"method",
"before",
"using",
"{",
"refresh",
"}",
"as",
"this",
"will",
"not",
"at... | c23e5f0edd150f8885267e5f7c8a564f8e6e8562 | https://github.com/aws/aws-sdk-js/blob/c23e5f0edd150f8885267e5f7c8a564f8e6e8562/lib/credentials.js#L119-L129 | train | Get the next resource in the cache | [
30522,
3853,
2131,
1006,
2655,
5963,
1007,
1063,
13075,
2969,
1027,
2023,
1025,
2065,
1006,
2023,
1012,
3791,
2890,
19699,
9953,
1006,
1007,
1007,
1063,
2023,
1012,
25416,
21898,
1006,
3853,
1006,
9413,
2099,
1007,
1063,
2065,
1006,
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... |
aws/aws-sdk-js | lib/service.js | attemptFailEvent | function attemptFailEvent(request) {
var monitoringEvent = this.apiAttemptEvent(request);
var response = request.response;
var error = response.error;
if (response.httpResponse.statusCode > 299 ) {
if (error.code) monitoringEvent.AwsException = error.code;
if (error.message) monitoringEvent.AwsExceptionMessage = error.message;
} else {
if (error.code || error.name) monitoringEvent.SdkException = error.code || error.name;
if (error.message) monitoringEvent.SdkExceptionMessage = error.message;
}
return monitoringEvent;
} | javascript | function attemptFailEvent(request) {
var monitoringEvent = this.apiAttemptEvent(request);
var response = request.response;
var error = response.error;
if (response.httpResponse.statusCode > 299 ) {
if (error.code) monitoringEvent.AwsException = error.code;
if (error.message) monitoringEvent.AwsExceptionMessage = error.message;
} else {
if (error.code || error.name) monitoringEvent.SdkException = error.code || error.name;
if (error.message) monitoringEvent.SdkExceptionMessage = error.message;
}
return monitoringEvent;
} | [
"function",
"attemptFailEvent",
"(",
"request",
")",
"{",
"var",
"monitoringEvent",
"=",
"this",
".",
"apiAttemptEvent",
"(",
"request",
")",
";",
"var",
"response",
"=",
"request",
".",
"response",
";",
"var",
"error",
"=",
"response",
".",
"error",
";",
... | Add metrics of failed request.
@api private | [
"Add",
"metrics",
"of",
"failed",
"request",
"."
] | c23e5f0edd150f8885267e5f7c8a564f8e6e8562 | https://github.com/aws/aws-sdk-js/blob/c23e5f0edd150f8885267e5f7c8a564f8e6e8562/lib/service.js#L367-L379 | train | Attempt to send an error to the service | [
30522,
3853,
3535,
7011,
9463,
15338,
1006,
5227,
1007,
1063,
13075,
8822,
18697,
3372,
1027,
2023,
1012,
17928,
19321,
6633,
13876,
18697,
3372,
1006,
5227,
1007,
1025,
13075,
3433,
1027,
5227,
1012,
3433,
1025,
13075,
7561,
1027,
3433,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/extensions/default/RemoteFileAdapter/RemoteFile.js | RemoteFile | function RemoteFile(protocol, fullPath, fileSystem) {
this._isFile = true;
this._isDirectory = false;
this.readOnly = true;
this._path = fullPath;
this._stat = _getStats(fullPath);
this._id = fullPath;
this._name = _getFileName(fullPath);
this._fileSystem = fileSystem;
this.donotWatch = true;
this.protocol = protocol;
this.encodedPath = fullPath;
} | javascript | function RemoteFile(protocol, fullPath, fileSystem) {
this._isFile = true;
this._isDirectory = false;
this.readOnly = true;
this._path = fullPath;
this._stat = _getStats(fullPath);
this._id = fullPath;
this._name = _getFileName(fullPath);
this._fileSystem = fileSystem;
this.donotWatch = true;
this.protocol = protocol;
this.encodedPath = fullPath;
} | [
"function",
"RemoteFile",
"(",
"protocol",
",",
"fullPath",
",",
"fileSystem",
")",
"{",
"this",
".",
"_isFile",
"=",
"true",
";",
"this",
".",
"_isDirectory",
"=",
"false",
";",
"this",
".",
"readOnly",
"=",
"true",
";",
"this",
".",
"_path",
"=",
"fu... | Model for a RemoteFile.
This class should *not* be instantiated directly. Use FileSystem.getFileForPath
See the FileSystem class for more details.
@constructor
@param {!string} fullPath The full path for this File.
@param {!FileSystem} fileSystem The file system associated with this File. | [
"Model",
"for",
"a",
"RemoteFile",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/RemoteFileAdapter/RemoteFile.js#L70-L82 | train | RemoteFile constructor. | [
30522,
3853,
6556,
8873,
2571,
1006,
8778,
1010,
2440,
15069,
1010,
6764,
27268,
6633,
1007,
1063,
2023,
1012,
1035,
2003,
8873,
2571,
1027,
2995,
1025,
2023,
1012,
1035,
2003,
4305,
2890,
16761,
2100,
1027,
6270,
1025,
2023,
1012,
3191,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/widgets/Dialogs.js | showModalDialogUsingTemplate | function showModalDialogUsingTemplate(template, autoDismiss) {
if (autoDismiss === undefined) {
autoDismiss = true;
}
$("body").append("<div class='modal-wrapper'><div class='modal-inner-wrapper'></div></div>");
var result = new $.Deferred(),
promise = result.promise(),
$dlg = $(template)
.addClass("instance")
.appendTo(".modal-inner-wrapper:last");
// Don't allow dialog to exceed viewport size
setDialogMaxSize();
// Save the dialog promise for unit tests
$dlg.data("promise", promise);
var keydownHook = function (e) {
return _keydownHook.call($dlg, e, autoDismiss);
};
// Store current focus
var lastFocus = window.document.activeElement;
// Pipe dialog-closing notification back to client code
$dlg.one("hidden", function () {
var buttonId = $dlg.data("buttonId");
if (!buttonId) { // buttonId will be undefined if closed via Bootstrap's "x" button
buttonId = DIALOG_BTN_CANCEL;
}
// Let call stack return before notifying that dialog has closed; this avoids issue #191
// if the handler we're triggering might show another dialog (as long as there's no
// fade-out animation)
window.setTimeout(function () {
result.resolve(buttonId);
}, 0);
// Remove the dialog instance from the DOM.
$dlg.remove();
// Remove our global keydown handler.
KeyBindingManager.removeGlobalKeydownHook(keydownHook);
// Restore previous focus
if (lastFocus) {
lastFocus.focus();
}
//Remove wrapper
$(".modal-wrapper:last").remove();
}).one("shown", function () {
var $primaryBtn = $dlg.find(".primary:enabled"),
$otherBtn = $dlg.find(".modal-footer .dialog-button:enabled:eq(0)");
// Set focus to the primary button, to any other button, or to the dialog depending
// if there are buttons
if ($primaryBtn.length) {
$primaryBtn.focus();
} else if ($otherBtn.length) {
$otherBtn.focus();
} else {
window.document.activeElement.blur();
}
// Push our global keydown handler onto the global stack of handlers.
KeyBindingManager.addGlobalKeydownHook(keydownHook);
});
// Click handler for buttons
$dlg.one("click", ".dialog-button", function (e) {
_processButton($dlg, $(this).attr("data-button-id"), autoDismiss);
});
// Run the dialog
$dlg
.modal({
backdrop: "static",
show: true,
selector: ".modal-inner-wrapper:last",
keyboard: false // handle the ESC key ourselves so we can deal with nested dialogs
})
// Updates the z-index of the modal dialog and the backdrop
.css("z-index", zIndex + 1)
.next()
.css("z-index", zIndex);
zIndex += 2;
return (new Dialog($dlg, promise));
} | javascript | function showModalDialogUsingTemplate(template, autoDismiss) {
if (autoDismiss === undefined) {
autoDismiss = true;
}
$("body").append("<div class='modal-wrapper'><div class='modal-inner-wrapper'></div></div>");
var result = new $.Deferred(),
promise = result.promise(),
$dlg = $(template)
.addClass("instance")
.appendTo(".modal-inner-wrapper:last");
// Don't allow dialog to exceed viewport size
setDialogMaxSize();
// Save the dialog promise for unit tests
$dlg.data("promise", promise);
var keydownHook = function (e) {
return _keydownHook.call($dlg, e, autoDismiss);
};
// Store current focus
var lastFocus = window.document.activeElement;
// Pipe dialog-closing notification back to client code
$dlg.one("hidden", function () {
var buttonId = $dlg.data("buttonId");
if (!buttonId) { // buttonId will be undefined if closed via Bootstrap's "x" button
buttonId = DIALOG_BTN_CANCEL;
}
// Let call stack return before notifying that dialog has closed; this avoids issue #191
// if the handler we're triggering might show another dialog (as long as there's no
// fade-out animation)
window.setTimeout(function () {
result.resolve(buttonId);
}, 0);
// Remove the dialog instance from the DOM.
$dlg.remove();
// Remove our global keydown handler.
KeyBindingManager.removeGlobalKeydownHook(keydownHook);
// Restore previous focus
if (lastFocus) {
lastFocus.focus();
}
//Remove wrapper
$(".modal-wrapper:last").remove();
}).one("shown", function () {
var $primaryBtn = $dlg.find(".primary:enabled"),
$otherBtn = $dlg.find(".modal-footer .dialog-button:enabled:eq(0)");
// Set focus to the primary button, to any other button, or to the dialog depending
// if there are buttons
if ($primaryBtn.length) {
$primaryBtn.focus();
} else if ($otherBtn.length) {
$otherBtn.focus();
} else {
window.document.activeElement.blur();
}
// Push our global keydown handler onto the global stack of handlers.
KeyBindingManager.addGlobalKeydownHook(keydownHook);
});
// Click handler for buttons
$dlg.one("click", ".dialog-button", function (e) {
_processButton($dlg, $(this).attr("data-button-id"), autoDismiss);
});
// Run the dialog
$dlg
.modal({
backdrop: "static",
show: true,
selector: ".modal-inner-wrapper:last",
keyboard: false // handle the ESC key ourselves so we can deal with nested dialogs
})
// Updates the z-index of the modal dialog and the backdrop
.css("z-index", zIndex + 1)
.next()
.css("z-index", zIndex);
zIndex += 2;
return (new Dialog($dlg, promise));
} | [
"function",
"showModalDialogUsingTemplate",
"(",
"template",
",",
"autoDismiss",
")",
"{",
"if",
"(",
"autoDismiss",
"===",
"undefined",
")",
"{",
"autoDismiss",
"=",
"true",
";",
"}",
"$",
"(",
"\"body\"",
")",
".",
"append",
"(",
"\"<div class='modal-wrapper'>... | Creates a new modal dialog from a given template.
The template can either be a string or a jQuery object representing a DOM node that is *not* in the current DOM.
@param {string} template A string template or jQuery object to use as the dialog HTML.
@param {boolean=} autoDismiss Whether to automatically dismiss the dialog when one of the buttons
is clicked. Default true. If false, you'll need to manually handle button clicks and the Esc
key, and dismiss the dialog yourself when ready by calling `close()` on the returned dialog.
@return {Dialog} | [
"Creates",
"a",
"new",
"modal",
"dialog",
"from",
"a",
"given",
"template",
".",
"The",
"template",
"can",
"either",
"be",
"a",
"string",
"or",
"a",
"jQuery",
"object",
"representing",
"a",
"DOM",
"node",
"that",
"is",
"*",
"not",
"*",
"in",
"the",
"cu... | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/widgets/Dialogs.js#L287-L379 | train | Show a modal dialog using a template | [
30522,
3853,
2265,
5302,
9305,
27184,
8649,
18161,
18532,
15725,
1006,
23561,
1010,
8285,
10521,
15630,
2015,
1007,
1063,
2065,
1006,
8285,
10521,
15630,
2015,
1027,
1027,
1027,
6151,
28344,
1007,
1063,
8285,
10521,
15630,
2015,
1027,
2995,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
angular/material | src/core/util/util.js | scanForFocusable | function scanForFocusable(target, selector) {
var elFound, items = target[0].querySelectorAll(selector);
// Find the last child element with the focus attribute
if (items && items.length){
items.length && angular.forEach(items, function(it) {
it = angular.element(it);
// Check the element for the md-autofocus class to ensure any associated expression
// evaluated to true.
var isFocusable = it.hasClass('md-autofocus');
if (isFocusable) elFound = it;
});
}
return elFound;
} | javascript | function scanForFocusable(target, selector) {
var elFound, items = target[0].querySelectorAll(selector);
// Find the last child element with the focus attribute
if (items && items.length){
items.length && angular.forEach(items, function(it) {
it = angular.element(it);
// Check the element for the md-autofocus class to ensure any associated expression
// evaluated to true.
var isFocusable = it.hasClass('md-autofocus');
if (isFocusable) elFound = it;
});
}
return elFound;
} | [
"function",
"scanForFocusable",
"(",
"target",
",",
"selector",
")",
"{",
"var",
"elFound",
",",
"items",
"=",
"target",
"[",
"0",
"]",
".",
"querySelectorAll",
"(",
"selector",
")",
";",
"// Find the last child element with the focus attribute",
"if",
"(",
"items... | Can target and nested children for specified Selector (attribute)
whose value may be an expression that evaluates to True/False. | [
"Can",
"target",
"and",
"nested",
"children",
"for",
"specified",
"Selector",
"(",
"attribute",
")",
"whose",
"value",
"may",
"be",
"an",
"expression",
"that",
"evaluates",
"to",
"True",
"/",
"False",
"."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/util/util.js#L198-L213 | train | Scan for focusable elements | [
30522,
3853,
13594,
29278,
14876,
7874,
3085,
1006,
4539,
1010,
27000,
1007,
1063,
13075,
17163,
28819,
1010,
5167,
1027,
4539,
1031,
1014,
1033,
1012,
23032,
11246,
22471,
6525,
3363,
1006,
27000,
1007,
1025,
1013,
1013,
2424,
1996,
2197,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
react-bootstrap/react-bootstrap | src/ProgressBar.js | onlyProgressBar | function onlyProgressBar(props, propName, componentName) {
const children = props[propName];
if (!children) {
return null;
}
let error = null;
React.Children.forEach(children, child => {
if (error) {
return;
}
/**
* Compare types in a way that works with libraries that patch and proxy
* components like react-hot-loader.
*
* see https://github.com/gaearon/react-hot-loader#checking-element-types
*/
const element = <DecoratedProgressBar />;
if (child.type === element.type) return;
const childIdentifier = React.isValidElement(child)
? child.type.displayName || child.type.name || child.type
: child;
error = new Error(
`Children of ${componentName} can contain only ProgressBar ` +
`components. Found ${childIdentifier}.`,
);
});
return error;
} | javascript | function onlyProgressBar(props, propName, componentName) {
const children = props[propName];
if (!children) {
return null;
}
let error = null;
React.Children.forEach(children, child => {
if (error) {
return;
}
/**
* Compare types in a way that works with libraries that patch and proxy
* components like react-hot-loader.
*
* see https://github.com/gaearon/react-hot-loader#checking-element-types
*/
const element = <DecoratedProgressBar />;
if (child.type === element.type) return;
const childIdentifier = React.isValidElement(child)
? child.type.displayName || child.type.name || child.type
: child;
error = new Error(
`Children of ${componentName} can contain only ProgressBar ` +
`components. Found ${childIdentifier}.`,
);
});
return error;
} | [
"function",
"onlyProgressBar",
"(",
"props",
",",
"propName",
",",
"componentName",
")",
"{",
"const",
"children",
"=",
"props",
"[",
"propName",
"]",
";",
"if",
"(",
"!",
"children",
")",
"{",
"return",
"null",
";",
"}",
"let",
"error",
"=",
"null",
"... | Validate that children, if any, are instances of `<ProgressBar>`. | [
"Validate",
"that",
"children",
"if",
"any",
"are",
"instances",
"of",
"<ProgressBar",
">",
"."
] | f0dc81f91ae90eb54bd1e4c04fa9419872d347dc | https://github.com/react-bootstrap/react-bootstrap/blob/f0dc81f91ae90eb54bd1e4c04fa9419872d347dc/src/ProgressBar.js#L14-L46 | train | Only ProgressBar component can contain only ProgressBar elements | [
30522,
3853,
2069,
21572,
17603,
4757,
8237,
1006,
24387,
1010,
17678,
18442,
1010,
6922,
18442,
1007,
1063,
9530,
3367,
2336,
1027,
24387,
1031,
17678,
18442,
1033,
1025,
2065,
1006,
999,
2336,
1007,
1063,
2709,
19701,
1025,
1065,
2292,
75... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
elastic/elasticsearch-js | api/api/ml.get_overall_buckets.js | buildMlGetOverallBuckets | function buildMlGetOverallBuckets (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
/**
* Perform a [ml.get_overall_buckets](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-overall-buckets.html) request
*
* @param {string} job_id - The job IDs for which to calculate overall bucket results
* @param {int} top_n - The number of top job bucket scores to be used in the overall_score calculation
* @param {string} bucket_span - The span of the overall buckets. Defaults to the longest job bucket_span
* @param {double} overall_score - Returns overall buckets with overall scores higher than this value
* @param {boolean} exclude_interim - If true overall buckets that include interim buckets will be excluded
* @param {string} start - Returns overall buckets with timestamps after this time
* @param {string} end - Returns overall buckets with timestamps earlier than this time
* @param {boolean} allow_no_jobs - Whether to ignore if a wildcard expression matches no jobs. (This includes `_all` string or when no jobs have been specified)
* @param {object} body - Overall bucket selection details if not provided in URI
*/
const acceptedQuerystring = [
'top_n',
'bucket_span',
'overall_score',
'exclude_interim',
'start',
'end',
'allow_no_jobs'
]
const snakeCase = {
topN: 'top_n',
bucketSpan: 'bucket_span',
overallScore: 'overall_score',
excludeInterim: 'exclude_interim',
allowNoJobs: 'allow_no_jobs'
}
return function mlGetOverallBuckets (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// check required parameters
if (params['job_id'] == null && params['jobId'] == null) {
const err = new ConfigurationError('Missing required parameter: job_id or jobId')
return handleError(err, callback)
}
// validate headers object
if (options.headers != null && typeof options.headers !== 'object') {
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
return handleError(err, callback)
}
var warnings = []
var { method, body, jobId, job_id, ...querystring } = params
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings)
if (method == null) {
method = body == null ? 'GET' : 'POST'
}
var ignore = options.ignore
if (typeof ignore === 'number') {
options.ignore = [ignore]
}
var path = ''
path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + 'results' + '/' + 'overall_buckets'
// build request object
const request = {
method,
path,
body: body || '',
querystring
}
options.warnings = warnings.length === 0 ? null : warnings
return makeRequest(request, options, callback)
}
} | javascript | function buildMlGetOverallBuckets (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
/**
* Perform a [ml.get_overall_buckets](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-overall-buckets.html) request
*
* @param {string} job_id - The job IDs for which to calculate overall bucket results
* @param {int} top_n - The number of top job bucket scores to be used in the overall_score calculation
* @param {string} bucket_span - The span of the overall buckets. Defaults to the longest job bucket_span
* @param {double} overall_score - Returns overall buckets with overall scores higher than this value
* @param {boolean} exclude_interim - If true overall buckets that include interim buckets will be excluded
* @param {string} start - Returns overall buckets with timestamps after this time
* @param {string} end - Returns overall buckets with timestamps earlier than this time
* @param {boolean} allow_no_jobs - Whether to ignore if a wildcard expression matches no jobs. (This includes `_all` string or when no jobs have been specified)
* @param {object} body - Overall bucket selection details if not provided in URI
*/
const acceptedQuerystring = [
'top_n',
'bucket_span',
'overall_score',
'exclude_interim',
'start',
'end',
'allow_no_jobs'
]
const snakeCase = {
topN: 'top_n',
bucketSpan: 'bucket_span',
overallScore: 'overall_score',
excludeInterim: 'exclude_interim',
allowNoJobs: 'allow_no_jobs'
}
return function mlGetOverallBuckets (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// check required parameters
if (params['job_id'] == null && params['jobId'] == null) {
const err = new ConfigurationError('Missing required parameter: job_id or jobId')
return handleError(err, callback)
}
// validate headers object
if (options.headers != null && typeof options.headers !== 'object') {
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
return handleError(err, callback)
}
var warnings = []
var { method, body, jobId, job_id, ...querystring } = params
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings)
if (method == null) {
method = body == null ? 'GET' : 'POST'
}
var ignore = options.ignore
if (typeof ignore === 'number') {
options.ignore = [ignore]
}
var path = ''
path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + 'results' + '/' + 'overall_buckets'
// build request object
const request = {
method,
path,
body: body || '',
querystring
}
options.warnings = warnings.length === 0 ? null : warnings
return makeRequest(request, options, callback)
}
} | [
"function",
"buildMlGetOverallBuckets",
"(",
"opts",
")",
"{",
"// eslint-disable-next-line no-unused-vars",
"const",
"{",
"makeRequest",
",",
"ConfigurationError",
",",
"handleError",
",",
"snakeCaseKeys",
"}",
"=",
"opts",
"/**\n * Perform a [ml.get_overall_buckets](http://... | /* eslint camelcase: 0 /* eslint no-unused-vars: 0 | [
"/",
"*",
"eslint",
"camelcase",
":",
"0",
"/",
"*",
"eslint",
"no",
"-",
"unused",
"-",
"vars",
":",
"0"
] | 4fc4699a4d4474d7887bc7757e0269218a859294 | https://github.com/elastic/elasticsearch-js/blob/4fc4699a4d4474d7887bc7757e0269218a859294/api/api/ml.get_overall_buckets.js#L25-L112 | train | Build an ML Get Overall Buckets | [
30522,
3853,
3857,
19968,
18150,
7840,
8095,
24204,
8454,
1006,
23569,
2015,
1007,
1063,
1013,
1013,
9686,
4115,
2102,
1011,
4487,
19150,
1011,
2279,
1011,
2240,
2053,
1011,
15171,
1011,
13075,
2015,
9530,
3367,
1063,
9338,
2063,
15500,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
nhn/tui.editor | src/js/extensions/colorSyntax.js | styleColor | function styleColor(sq, color) {
if (!sq.hasFormat('PRE')) {
if (color === RESET_COLOR) {
sq.changeFormat(null, {
class: 'colour',
tag: 'span'
});
} else {
sq.setTextColour(color);
}
}
} | javascript | function styleColor(sq, color) {
if (!sq.hasFormat('PRE')) {
if (color === RESET_COLOR) {
sq.changeFormat(null, {
class: 'colour',
tag: 'span'
});
} else {
sq.setTextColour(color);
}
}
} | [
"function",
"styleColor",
"(",
"sq",
",",
"color",
")",
"{",
"if",
"(",
"!",
"sq",
".",
"hasFormat",
"(",
"'PRE'",
")",
")",
"{",
"if",
"(",
"color",
"===",
"RESET_COLOR",
")",
"{",
"sq",
".",
"changeFormat",
"(",
"null",
",",
"{",
"class",
":",
... | style color
@param {SquireExt} sq - squire ext instance
@param {string} color - color sting value
@ignore | [
"style",
"color"
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/extensions/colorSyntax.js#L126-L137 | train | Style the color of the specified SQ object | [
30522,
3853,
2806,
18717,
1006,
5490,
1010,
3609,
1007,
1063,
2065,
1006,
999,
5490,
1012,
2038,
14192,
4017,
1006,
1005,
3653,
1005,
1007,
1007,
1063,
2065,
1006,
3609,
1027,
1027,
1027,
25141,
1035,
3609,
1007,
1063,
5490,
1012,
2689,
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... |
SheetJS/js-xlsx | xlsx.js | inflate | function inflate(data, usz) {
/* shortcircuit for empty buffer [0x03, 0x00] */
if(data[0] == 3 && !(data[1] & 0x3)) { return [new_raw_buf(usz), 2]; }
/* bit offset */
var boff = 0;
/* header includes final bit and type bits */
var header = 0;
var outbuf = new_unsafe_buf(usz ? usz : (1<<18));
var woff = 0;
var OL = outbuf.length>>>0;
var max_len_1 = 0, max_len_2 = 0;
while((header&1) == 0) {
header = read_bits_3(data, boff); boff += 3;
if((header >>> 1) == 0) {
/* Stored block */
if(boff & 7) boff += 8 - (boff&7);
/* 2 bytes sz, 2 bytes bit inverse */
var sz = data[boff>>>3] | data[(boff>>>3)+1]<<8;
boff += 32;
/* push sz bytes */
if(!usz && OL < woff + sz) { outbuf = realloc(outbuf, woff + sz); OL = outbuf.length; }
if(typeof data.copy === 'function') {
// $FlowIgnore
data.copy(outbuf, woff, boff>>>3, (boff>>>3)+sz);
woff += sz; boff += 8*sz;
} else while(sz-- > 0) { outbuf[woff++] = data[boff>>>3]; boff += 8; }
continue;
} else if((header >>> 1) == 1) {
/* Fixed Huffman */
max_len_1 = 9; max_len_2 = 5;
} else {
/* Dynamic Huffman */
boff = dyn(data, boff);
max_len_1 = dyn_len_1; max_len_2 = dyn_len_2;
}
if(!usz && (OL < woff + 32767)) { outbuf = realloc(outbuf, woff + 32767); OL = outbuf.length; }
for(;;) { // while(true) is apparently out of vogue in modern JS circles
/* ingest code and move read head */
var bits = read_bits_n(data, boff, max_len_1);
var code = (header>>>1) == 1 ? fix_lmap[bits] : dyn_lmap[bits];
boff += code & 15; code >>>= 4;
/* 0-255 are literals, 256 is end of block token, 257+ are copy tokens */
if(((code>>>8)&0xFF) === 0) outbuf[woff++] = code;
else if(code == 256) break;
else {
code -= 257;
var len_eb = (code < 8) ? 0 : ((code-4)>>2); if(len_eb > 5) len_eb = 0;
var tgt = woff + LEN_LN[code];
/* length extra bits */
if(len_eb > 0) {
tgt += read_bits_n(data, boff, len_eb);
boff += len_eb;
}
/* dist code */
bits = read_bits_n(data, boff, max_len_2);
code = (header>>>1) == 1 ? fix_dmap[bits] : dyn_dmap[bits];
boff += code & 15; code >>>= 4;
var dst_eb = (code < 4 ? 0 : (code-2)>>1);
var dst = DST_LN[code];
/* dist extra bits */
if(dst_eb > 0) {
dst += read_bits_n(data, boff, dst_eb);
boff += dst_eb;
}
/* in the common case, manual byte copy is faster than TA set / Buffer copy */
if(!usz && OL < tgt) { outbuf = realloc(outbuf, tgt); OL = outbuf.length; }
while(woff < tgt) { outbuf[woff] = outbuf[woff - dst]; ++woff; }
}
}
}
return [usz ? outbuf : outbuf.slice(0, woff), (boff+7)>>>3];
} | javascript | function inflate(data, usz) {
/* shortcircuit for empty buffer [0x03, 0x00] */
if(data[0] == 3 && !(data[1] & 0x3)) { return [new_raw_buf(usz), 2]; }
/* bit offset */
var boff = 0;
/* header includes final bit and type bits */
var header = 0;
var outbuf = new_unsafe_buf(usz ? usz : (1<<18));
var woff = 0;
var OL = outbuf.length>>>0;
var max_len_1 = 0, max_len_2 = 0;
while((header&1) == 0) {
header = read_bits_3(data, boff); boff += 3;
if((header >>> 1) == 0) {
/* Stored block */
if(boff & 7) boff += 8 - (boff&7);
/* 2 bytes sz, 2 bytes bit inverse */
var sz = data[boff>>>3] | data[(boff>>>3)+1]<<8;
boff += 32;
/* push sz bytes */
if(!usz && OL < woff + sz) { outbuf = realloc(outbuf, woff + sz); OL = outbuf.length; }
if(typeof data.copy === 'function') {
// $FlowIgnore
data.copy(outbuf, woff, boff>>>3, (boff>>>3)+sz);
woff += sz; boff += 8*sz;
} else while(sz-- > 0) { outbuf[woff++] = data[boff>>>3]; boff += 8; }
continue;
} else if((header >>> 1) == 1) {
/* Fixed Huffman */
max_len_1 = 9; max_len_2 = 5;
} else {
/* Dynamic Huffman */
boff = dyn(data, boff);
max_len_1 = dyn_len_1; max_len_2 = dyn_len_2;
}
if(!usz && (OL < woff + 32767)) { outbuf = realloc(outbuf, woff + 32767); OL = outbuf.length; }
for(;;) { // while(true) is apparently out of vogue in modern JS circles
/* ingest code and move read head */
var bits = read_bits_n(data, boff, max_len_1);
var code = (header>>>1) == 1 ? fix_lmap[bits] : dyn_lmap[bits];
boff += code & 15; code >>>= 4;
/* 0-255 are literals, 256 is end of block token, 257+ are copy tokens */
if(((code>>>8)&0xFF) === 0) outbuf[woff++] = code;
else if(code == 256) break;
else {
code -= 257;
var len_eb = (code < 8) ? 0 : ((code-4)>>2); if(len_eb > 5) len_eb = 0;
var tgt = woff + LEN_LN[code];
/* length extra bits */
if(len_eb > 0) {
tgt += read_bits_n(data, boff, len_eb);
boff += len_eb;
}
/* dist code */
bits = read_bits_n(data, boff, max_len_2);
code = (header>>>1) == 1 ? fix_dmap[bits] : dyn_dmap[bits];
boff += code & 15; code >>>= 4;
var dst_eb = (code < 4 ? 0 : (code-2)>>1);
var dst = DST_LN[code];
/* dist extra bits */
if(dst_eb > 0) {
dst += read_bits_n(data, boff, dst_eb);
boff += dst_eb;
}
/* in the common case, manual byte copy is faster than TA set / Buffer copy */
if(!usz && OL < tgt) { outbuf = realloc(outbuf, tgt); OL = outbuf.length; }
while(woff < tgt) { outbuf[woff] = outbuf[woff - dst]; ++woff; }
}
}
}
return [usz ? outbuf : outbuf.slice(0, woff), (boff+7)>>>3];
} | [
"function",
"inflate",
"(",
"data",
",",
"usz",
")",
"{",
"/* shortcircuit for empty buffer [0x03, 0x00] */",
"if",
"(",
"data",
"[",
"0",
"]",
"==",
"3",
"&&",
"!",
"(",
"data",
"[",
"1",
"]",
"&",
"0x3",
")",
")",
"{",
"return",
"[",
"new_raw_buf",
"... | /* return [ data, bytesRead ] | [
"/",
"*",
"return",
"[",
"data",
"bytesRead",
"]"
] | 9a6d8a1d3d80c78dad5201fb389316f935279cdc | https://github.com/SheetJS/js-xlsx/blob/9a6d8a1d3d80c78dad5201fb389316f935279cdc/xlsx.js#L2206-L2283 | train | Inflate a block of data into a raw buffer | [
30522,
3853,
1999,
10258,
3686,
1006,
2951,
1010,
2149,
2480,
1007,
1063,
1013,
1008,
2460,
6895,
11890,
14663,
2005,
4064,
17698,
1031,
1014,
2595,
2692,
2509,
1010,
1014,
2595,
8889,
1033,
1008,
1013,
2065,
1006,
2951,
1031,
1014,
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... |
firebase/firebase-js-sdk | packages/auth/demo/public/script.js | onSignInConfirmPhoneVerification | function onSignInConfirmPhoneVerification() {
var verificationId = $('#signin-phone-verification-id').val();
var verificationCode = $('#signin-phone-verification-code').val();
var credential = firebase.auth.PhoneAuthProvider.credential(
verificationId, verificationCode);
signInOrLinkCredential(credential);
} | javascript | function onSignInConfirmPhoneVerification() {
var verificationId = $('#signin-phone-verification-id').val();
var verificationCode = $('#signin-phone-verification-code').val();
var credential = firebase.auth.PhoneAuthProvider.credential(
verificationId, verificationCode);
signInOrLinkCredential(credential);
} | [
"function",
"onSignInConfirmPhoneVerification",
"(",
")",
"{",
"var",
"verificationId",
"=",
"$",
"(",
"'#signin-phone-verification-id'",
")",
".",
"val",
"(",
")",
";",
"var",
"verificationCode",
"=",
"$",
"(",
"'#signin-phone-verification-code'",
")",
".",
"val",
... | Confirms a phone number verification for sign-in. | [
"Confirms",
"a",
"phone",
"number",
"verification",
"for",
"sign",
"-",
"in",
"."
] | 491598a499813dacc23724de5e237ec220cc560e | https://github.com/firebase/firebase-js-sdk/blob/491598a499813dacc23724de5e237ec220cc560e/packages/auth/demo/public/script.js#L457-L463 | train | Sign in or link phone verification | [
30522,
3853,
2006,
5332,
29076,
15305,
2078,
27972,
9864,
6299,
9031,
1006,
1007,
1063,
13075,
22616,
3593,
1027,
1002,
1006,
1005,
1001,
3696,
2378,
1011,
3042,
1011,
22616,
1011,
8909,
1005,
1007,
1012,
11748,
1006,
1007,
1025,
13075,
226... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/guest-view-manager.js | function (visibilityState) {
for (const guestInstanceId in guestInstances) {
const guestInstance = guestInstances[guestInstanceId]
guestInstance.visibilityState = visibilityState
if (guestInstance.embedder === embedder) {
guestInstance.guest._sendInternal('ELECTRON_GUEST_INSTANCE_VISIBILITY_CHANGE', visibilityState)
}
}
} | javascript | function (visibilityState) {
for (const guestInstanceId in guestInstances) {
const guestInstance = guestInstances[guestInstanceId]
guestInstance.visibilityState = visibilityState
if (guestInstance.embedder === embedder) {
guestInstance.guest._sendInternal('ELECTRON_GUEST_INSTANCE_VISIBILITY_CHANGE', visibilityState)
}
}
} | [
"function",
"(",
"visibilityState",
")",
"{",
"for",
"(",
"const",
"guestInstanceId",
"in",
"guestInstances",
")",
"{",
"const",
"guestInstance",
"=",
"guestInstances",
"[",
"guestInstanceId",
"]",
"guestInstance",
".",
"visibilityState",
"=",
"visibilityState",
"if... | Forward embedder window visiblity change events to guest | [
"Forward",
"embedder",
"window",
"visiblity",
"change",
"events",
"to",
"guest"
] | 6e29611788277729647acf465f10db1ea6f15788 | https://github.com/electron/electron/blob/6e29611788277729647acf465f10db1ea6f15788/lib/browser/guest-view-manager.js#L299-L307 | train | set visibility state of guest instances | [
30522,
3853,
1006,
16476,
9153,
2618,
1007,
1063,
2005,
1006,
9530,
3367,
4113,
7076,
26897,
3593,
1999,
4113,
7076,
26897,
2015,
1007,
1063,
9530,
3367,
4113,
7076,
26897,
1027,
4113,
7076,
26897,
2015,
1031,
4113,
7076,
26897,
3593,
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... | |
graphql/graphql-js | src/validation/rules/FieldsOnCorrectType.js | getSuggestedFieldNames | function getSuggestedFieldNames(
schema: GraphQLSchema,
type: GraphQLOutputType,
fieldName: string,
): Array<string> {
if (isObjectType(type) || isInterfaceType(type)) {
const possibleFieldNames = Object.keys(type.getFields());
return suggestionList(fieldName, possibleFieldNames);
}
// Otherwise, must be a Union type, which does not define fields.
return [];
} | javascript | function getSuggestedFieldNames(
schema: GraphQLSchema,
type: GraphQLOutputType,
fieldName: string,
): Array<string> {
if (isObjectType(type) || isInterfaceType(type)) {
const possibleFieldNames = Object.keys(type.getFields());
return suggestionList(fieldName, possibleFieldNames);
}
// Otherwise, must be a Union type, which does not define fields.
return [];
} | [
"function",
"getSuggestedFieldNames",
"(",
"schema",
":",
"GraphQLSchema",
",",
"type",
":",
"GraphQLOutputType",
",",
"fieldName",
":",
"string",
",",
")",
":",
"Array",
"<",
"string",
">",
"{",
"if",
"(",
"isObjectType",
"(",
"type",
")",
"||",
"isInterfac... | For the field name provided, determine if there are any similar field names
that may be the result of a typo. | [
"For",
"the",
"field",
"name",
"provided",
"determine",
"if",
"there",
"are",
"any",
"similar",
"field",
"names",
"that",
"may",
"be",
"the",
"result",
"of",
"a",
"typo",
"."
] | b65ff6db8893c1c68f0f236c4b2d663e6c55f5ef | https://github.com/graphql/graphql-js/blob/b65ff6db8893c1c68f0f236c4b2d663e6c55f5ef/src/validation/rules/FieldsOnCorrectType.js#L132-L143 | train | Returns an array of field names that are not part of the union type. | [
30522,
3853,
4152,
15916,
8449,
3064,
3790,
18442,
2015,
1006,
8040,
28433,
1024,
10629,
4160,
4877,
5403,
2863,
1010,
2828,
1024,
10629,
4160,
23743,
25856,
4904,
13874,
1010,
2492,
18442,
1024,
30524,
4874,
1012,
6309,
1006,
2828,
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/angular | shims_for_IE.js | makeTypedArray | function makeTypedArray(elementSize, pack, unpack) {
// Each TypedArray type requires a distinct constructor instance with
// identical logic, which this produces.
var TypedArray = function() {
Object.defineProperty(this, 'constructor', {value: TypedArray});
$TypedArray$.apply(this, arguments);
makeArrayAccessors(this);
};
if ('__proto__' in TypedArray) {
TypedArray.__proto__ = $TypedArray$;
} else {
TypedArray.from = $TypedArray$.from;
TypedArray.of = $TypedArray$.of;
}
TypedArray.BYTES_PER_ELEMENT = elementSize;
var TypedArrayPrototype = function() {};
TypedArrayPrototype.prototype = $TypedArrayPrototype$;
TypedArray.prototype = new TypedArrayPrototype();
Object.defineProperty(TypedArray.prototype, 'BYTES_PER_ELEMENT', {value: elementSize});
Object.defineProperty(TypedArray.prototype, '_pack', {value: pack});
Object.defineProperty(TypedArray.prototype, '_unpack', {value: unpack});
return TypedArray;
} | javascript | function makeTypedArray(elementSize, pack, unpack) {
// Each TypedArray type requires a distinct constructor instance with
// identical logic, which this produces.
var TypedArray = function() {
Object.defineProperty(this, 'constructor', {value: TypedArray});
$TypedArray$.apply(this, arguments);
makeArrayAccessors(this);
};
if ('__proto__' in TypedArray) {
TypedArray.__proto__ = $TypedArray$;
} else {
TypedArray.from = $TypedArray$.from;
TypedArray.of = $TypedArray$.of;
}
TypedArray.BYTES_PER_ELEMENT = elementSize;
var TypedArrayPrototype = function() {};
TypedArrayPrototype.prototype = $TypedArrayPrototype$;
TypedArray.prototype = new TypedArrayPrototype();
Object.defineProperty(TypedArray.prototype, 'BYTES_PER_ELEMENT', {value: elementSize});
Object.defineProperty(TypedArray.prototype, '_pack', {value: pack});
Object.defineProperty(TypedArray.prototype, '_unpack', {value: unpack});
return TypedArray;
} | [
"function",
"makeTypedArray",
"(",
"elementSize",
",",
"pack",
",",
"unpack",
")",
"{",
"// Each TypedArray type requires a distinct constructor instance with",
"// identical logic, which this produces.",
"var",
"TypedArray",
"=",
"function",
"(",
")",
"{",
"Object",
".",
"... | %TypedArray%.prototype.toLocaleString ( ) %TypedArray%.prototype.toString ( ) %TypedArray%.prototype.values ( ) %TypedArray%.prototype [ @@iterator ] ( ) get %TypedArray%.prototype [ @@toStringTag ] -- defined in es6.js to shim browsers w/ native TypedArrays | [
"%TypedArray%",
".",
"prototype",
".",
"toLocaleString",
"(",
")",
"%TypedArray%",
".",
"prototype",
".",
"toString",
"(",
")",
"%TypedArray%",
".",
"prototype",
".",
"values",
"(",
")",
"%TypedArray%",
".",
"prototype",
"["
] | c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c | https://github.com/angular/angular/blob/c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c/shims_for_IE.js#L993-L1020 | train | Creates a TypedArray instance | [
30522,
3853,
2191,
13874,
7662,
9447,
1006,
3787,
4697,
1010,
5308,
1010,
4895,
23947,
1007,
1063,
1013,
1013,
2169,
21189,
2906,
30524,
9375,
21572,
4842,
3723,
1006,
2023,
1010,
1005,
9570,
2953,
1005,
1010,
1063,
3643,
1024,
21189,
2906,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
mui-org/material-ui | packages/material-ui-system/src/merge.js | merge | function merge(acc, item) {
if (!item) {
return acc;
}
return deepmerge(acc, item, {
clone: false, // No need to clone deep, it's way faster.
});
} | javascript | function merge(acc, item) {
if (!item) {
return acc;
}
return deepmerge(acc, item, {
clone: false, // No need to clone deep, it's way faster.
});
} | [
"function",
"merge",
"(",
"acc",
",",
"item",
")",
"{",
"if",
"(",
"!",
"item",
")",
"{",
"return",
"acc",
";",
"}",
"return",
"deepmerge",
"(",
"acc",
",",
"item",
",",
"{",
"clone",
":",
"false",
",",
"// No need to clone deep, it's way faster.",
"}",
... | < 1kb payload overhead when lodash/merge is > 3kb. | [
"<",
"1kb",
"payload",
"overhead",
"when",
"lodash",
"/",
"merge",
"is",
">",
"3kb",
"."
] | 1555e52367835946382fbf2a8f681de71318915d | https://github.com/mui-org/material-ui/blob/1555e52367835946382fbf2a8f681de71318915d/packages/material-ui-system/src/merge.js#L3-L11 | train | Merge the items into the first item | [
30522,
3853,
13590,
1006,
16222,
1010,
8875,
1007,
1063,
2065,
1006,
999,
8875,
1007,
1063,
2709,
16222,
1025,
1065,
2709,
2784,
5017,
3351,
1006,
16222,
1010,
8875,
1010,
1063,
17598,
1024,
6270,
1010,
1013,
1013,
2053,
2342,
2000,
17598,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
dequelabs/axe-core | lib/core/utils/get-selector.js | uncommonClasses | function uncommonClasses(node, selectorData) {
// eslint no-loop-func:false
let retVal = [];
let classData = selectorData.classes;
let tagData = selectorData.tags;
if (node.classList) {
Array.from(node.classList).forEach(cl => {
let ind = escapeSelector(cl);
if (classData[ind] < tagData[node.nodeName]) {
retVal.push({
name: ind,
count: classData[ind],
species: 'class'
});
}
});
}
return retVal.sort(countSort);
} | javascript | function uncommonClasses(node, selectorData) {
// eslint no-loop-func:false
let retVal = [];
let classData = selectorData.classes;
let tagData = selectorData.tags;
if (node.classList) {
Array.from(node.classList).forEach(cl => {
let ind = escapeSelector(cl);
if (classData[ind] < tagData[node.nodeName]) {
retVal.push({
name: ind,
count: classData[ind],
species: 'class'
});
}
});
}
return retVal.sort(countSort);
} | [
"function",
"uncommonClasses",
"(",
"node",
",",
"selectorData",
")",
"{",
"// eslint no-loop-func:false",
"let",
"retVal",
"=",
"[",
"]",
";",
"let",
"classData",
"=",
"selectorData",
".",
"classes",
";",
"let",
"tagData",
"=",
"selectorData",
".",
"tags",
";... | Given a node and the statistics on class frequency on the page,
return all its uncommon class data sorted in order of decreasing uniqueness
@param {Element} node The node
@param {Object} classData The map of classes to counts
@return {Array} The sorted array of uncommon class data | [
"Given",
"a",
"node",
"and",
"the",
"statistics",
"on",
"class",
"frequency",
"on",
"the",
"page",
"return",
"all",
"its",
"uncommon",
"class",
"data",
"sorted",
"in",
"order",
"of",
"decreasing",
"uniqueness"
] | 727323c07980e2291575f545444d389fb942906f | https://github.com/dequelabs/axe-core/blob/727323c07980e2291575f545444d389fb942906f/lib/core/utils/get-selector.js#L156-L175 | train | Returns an array of uncommon classes | [
30522,
3853,
13191,
26266,
2229,
1006,
13045,
1010,
27000,
2850,
2696,
1007,
1063,
1013,
1013,
9686,
4115,
2102,
30524,
13045,
1012,
2465,
9863,
1007,
1063,
9140,
1012,
2013,
1006,
13045,
1012,
2465,
9863,
1007,
1012,
18921,
6776,
1006,
188... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
wuchangming/spy-debugger | buildin_modules/weinre/web/interfaces/interfaces.js | reapplyDisplayStyles | function reapplyDisplayStyles() {
reapplyDisplayStyle(".show-Idl", e_showIdl.checked)
reapplyDisplayStyle(".show-JavaScript", e_showJavaScript.checked)
reapplyDisplayStyle(".show-Java", e_showJava.checked)
} | javascript | function reapplyDisplayStyles() {
reapplyDisplayStyle(".show-Idl", e_showIdl.checked)
reapplyDisplayStyle(".show-JavaScript", e_showJavaScript.checked)
reapplyDisplayStyle(".show-Java", e_showJava.checked)
} | [
"function",
"reapplyDisplayStyles",
"(",
")",
"{",
"reapplyDisplayStyle",
"(",
"\".show-Idl\"",
",",
"e_showIdl",
".",
"checked",
")",
"reapplyDisplayStyle",
"(",
"\".show-JavaScript\"",
",",
"e_showJavaScript",
".",
"checked",
")",
"reapplyDisplayStyle",
"(",
"\".show-... | ----------------------------------------------------------------------------- | [
"-----------------------------------------------------------------------------"
] | 55c1dda0dff0c44920673711656ddfd7ff03c307 | https://github.com/wuchangming/spy-debugger/blob/55c1dda0dff0c44920673711656ddfd7ff03c307/buildin_modules/weinre/web/interfaces/interfaces.js#L90-L94 | train | reapply display styles | [
30522,
3853,
2128,
29098,
2135,
10521,
13068,
21756,
4244,
1006,
1007,
1063,
2128,
29098,
2135,
10521,
13068,
21756,
2571,
1006,
1000,
1012,
2265,
1011,
8909,
2140,
1000,
1010,
1041,
1035,
2265,
3593,
2140,
1012,
7039,
1007,
2128,
29098,
21... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/utils/StringMatch.js | multiFieldSort | function multiFieldSort(searchResults, fieldSpec) {
// Move field names into an array, with primary field first
var comparisons;
if (Array.isArray(fieldSpec)) {
comparisons = fieldSpec;
} else {
// TODO Deprecate this form of calling this function
comparisons = [];
_.forEach(fieldSpec, function (priority, key) {
comparisons[priority] = key;
});
}
searchResults.sort(function (a, b) {
var priority;
for (priority = 0; priority < comparisons.length; priority++) {
var comparison = comparisons[priority];
if (typeof comparison === "function") {
var result = comparison(a, b);
if (result) {
return result;
}
} else {
var valueA = a[comparison];
var valueB = b[comparison];
if (typeof valueA === "string") {
valueA = valueA.toLowerCase();
valueB = valueB.toLowerCase();
}
if (valueA < valueB) {
return -1;
} else if (valueA > valueB) {
return 1;
}
}
// otherwise, move on to next sort priority
}
return 0; // all sort fields are equal
});
} | javascript | function multiFieldSort(searchResults, fieldSpec) {
// Move field names into an array, with primary field first
var comparisons;
if (Array.isArray(fieldSpec)) {
comparisons = fieldSpec;
} else {
// TODO Deprecate this form of calling this function
comparisons = [];
_.forEach(fieldSpec, function (priority, key) {
comparisons[priority] = key;
});
}
searchResults.sort(function (a, b) {
var priority;
for (priority = 0; priority < comparisons.length; priority++) {
var comparison = comparisons[priority];
if (typeof comparison === "function") {
var result = comparison(a, b);
if (result) {
return result;
}
} else {
var valueA = a[comparison];
var valueB = b[comparison];
if (typeof valueA === "string") {
valueA = valueA.toLowerCase();
valueB = valueB.toLowerCase();
}
if (valueA < valueB) {
return -1;
} else if (valueA > valueB) {
return 1;
}
}
// otherwise, move on to next sort priority
}
return 0; // all sort fields are equal
});
} | [
"function",
"multiFieldSort",
"(",
"searchResults",
",",
"fieldSpec",
")",
"{",
"// Move field names into an array, with primary field first",
"var",
"comparisons",
";",
"if",
"(",
"Array",
".",
"isArray",
"(",
"fieldSpec",
")",
")",
"{",
"comparisons",
"=",
"fieldSpe... | Sorts an array of SearchResult objects on a primary field, followed by secondary fields
in case of ties. 'fieldSpec' provides the priority order for fields, where the first entry is the primary field, for example:
multiFieldSort(bugList, [ "milestone", "severity" ]);
Would sort a bug list by milestone, and within each milestone sort bugs by severity.
fieldSpec can also include comparator functions of the form normally used by the sort()
function.
Any fields that have a string value are compared case-insensitively. Fields used should be
present on all SearchResult objects (no optional/undefined fields).
@param {!Array.<SearchResult>} searchResults
@param {!Array.<string, function>} fieldSpec | [
"Sorts",
"an",
"array",
"of",
"SearchResult",
"objects",
"on",
"a",
"primary",
"field",
"followed",
"by",
"secondary",
"fields",
"in",
"case",
"of",
"ties",
".",
"fieldSpec",
"provides",
"the",
"priority",
"order",
"for",
"fields",
"where",
"the",
"first",
"... | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/utils/StringMatch.js#L850-L890 | train | Sort the search results by the field spec | [
30522,
3853,
4800,
15155,
11589,
1006,
3945,
6072,
11314,
2015,
1010,
4249,
5051,
2278,
1007,
1063,
1013,
1013,
2693,
2492,
3415,
2046,
2019,
9140,
1010,
2007,
3078,
2492,
2034,
13075,
18539,
1025,
2065,
1006,
9140,
1012,
18061,
11335,
2100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
react-bootstrap/react-bootstrap | src/utils/ElementChildren.js | map | function map(children, func) {
let index = 0;
return React.Children.map(children, child =>
React.isValidElement(child) ? func(child, index++) : child,
);
} | javascript | function map(children, func) {
let index = 0;
return React.Children.map(children, child =>
React.isValidElement(child) ? func(child, index++) : child,
);
} | [
"function",
"map",
"(",
"children",
",",
"func",
")",
"{",
"let",
"index",
"=",
"0",
";",
"return",
"React",
".",
"Children",
".",
"map",
"(",
"children",
",",
"child",
"=>",
"React",
".",
"isValidElement",
"(",
"child",
")",
"?",
"func",
"(",
"child... | Iterates through children that are typically specified as `props.children`,
but only maps over children that are "valid elements".
The mapFunction provided index will be normalised to the components mapped,
so an invalid component would not increase the index. | [
"Iterates",
"through",
"children",
"that",
"are",
"typically",
"specified",
"as",
"props",
".",
"children",
"but",
"only",
"maps",
"over",
"children",
"that",
"are",
"valid",
"elements",
"."
] | f0dc81f91ae90eb54bd1e4c04fa9419872d347dc | https://github.com/react-bootstrap/react-bootstrap/blob/f0dc81f91ae90eb54bd1e4c04fa9419872d347dc/src/utils/ElementChildren.js#L11-L17 | train | Map a list of children to a function. | [
30522,
3853,
4949,
1006,
2336,
1010,
4569,
2278,
1007,
1063,
2292,
5950,
1027,
1014,
1025,
2709,
10509,
1012,
2336,
1012,
4949,
1006,
2336,
1010,
2775,
1027,
1028,
10509,
1012,
2003,
10175,
5178,
16930,
4765,
1006,
2775,
1007,
1029,
4569,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Microsoft/vscode | build/lib/treeshaking.js | createTypeScriptLanguageService | function createTypeScriptLanguageService(options) {
// Discover referenced files
const FILES = discoverAndReadFiles(options);
// Add fake usage files
options.inlineEntryPoints.forEach((inlineEntryPoint, index) => {
FILES[`inlineEntryPoint.${index}.ts`] = inlineEntryPoint;
});
// Add additional typings
options.typings.forEach((typing) => {
const filePath = path.join(options.sourcesRoot, typing);
FILES[typing] = fs.readFileSync(filePath).toString();
});
// Resolve libs
const RESOLVED_LIBS = {};
options.libs.forEach((filename) => {
const filepath = path.join(TYPESCRIPT_LIB_FOLDER, filename);
RESOLVED_LIBS[`defaultLib:${filename}`] = fs.readFileSync(filepath).toString();
});
const compilerOptions = ts.convertCompilerOptionsFromJson(options.compilerOptions, options.sourcesRoot).options;
const host = new TypeScriptLanguageServiceHost(RESOLVED_LIBS, FILES, compilerOptions);
return ts.createLanguageService(host);
} | javascript | function createTypeScriptLanguageService(options) {
// Discover referenced files
const FILES = discoverAndReadFiles(options);
// Add fake usage files
options.inlineEntryPoints.forEach((inlineEntryPoint, index) => {
FILES[`inlineEntryPoint.${index}.ts`] = inlineEntryPoint;
});
// Add additional typings
options.typings.forEach((typing) => {
const filePath = path.join(options.sourcesRoot, typing);
FILES[typing] = fs.readFileSync(filePath).toString();
});
// Resolve libs
const RESOLVED_LIBS = {};
options.libs.forEach((filename) => {
const filepath = path.join(TYPESCRIPT_LIB_FOLDER, filename);
RESOLVED_LIBS[`defaultLib:${filename}`] = fs.readFileSync(filepath).toString();
});
const compilerOptions = ts.convertCompilerOptionsFromJson(options.compilerOptions, options.sourcesRoot).options;
const host = new TypeScriptLanguageServiceHost(RESOLVED_LIBS, FILES, compilerOptions);
return ts.createLanguageService(host);
} | [
"function",
"createTypeScriptLanguageService",
"(",
"options",
")",
"{",
"// Discover referenced files",
"const",
"FILES",
"=",
"discoverAndReadFiles",
"(",
"options",
")",
";",
"// Add fake usage files",
"options",
".",
"inlineEntryPoints",
".",
"forEach",
"(",
"(",
"i... | #region Discovery, LanguageService & Setup | [
"#region",
"Discovery",
"LanguageService",
"&",
"Setup"
] | 693a13cd32c5be798051edc0cb43e1e39fc456d9 | https://github.com/Microsoft/vscode/blob/693a13cd32c5be798051edc0cb43e1e39fc456d9/build/lib/treeshaking.js#L54-L75 | train | Creates a TypeScript language service | [
30522,
3853,
3443,
13874,
22483,
25023,
6692,
8449,
2121,
7903,
2063,
1006,
7047,
1007,
1063,
1013,
1013,
7523,
14964,
6764,
9530,
3367,
6764,
1027,
7523,
5685,
16416,
20952,
9463,
2015,
1006,
7047,
1007,
1025,
1013,
1013,
5587,
8275,
8192,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/CSSUtils.js | findMatchingRules | function findMatchingRules(selector, htmlDocument) {
var result = new $.Deferred(),
resultSelectors = [];
// Synchronously search for matches in <style> blocks
if (htmlDocument) {
_findMatchingRulesInStyleBlocks(htmlDocument, selector, resultSelectors);
}
// Asynchronously search for matches in all the project's CSS files
// (results are appended together in same 'resultSelectors' array)
_findMatchingRulesInCSSFiles(selector, resultSelectors)
.done(function () {
result.resolve(resultSelectors);
})
.fail(function (error) {
result.reject(error);
});
return result.promise();
} | javascript | function findMatchingRules(selector, htmlDocument) {
var result = new $.Deferred(),
resultSelectors = [];
// Synchronously search for matches in <style> blocks
if (htmlDocument) {
_findMatchingRulesInStyleBlocks(htmlDocument, selector, resultSelectors);
}
// Asynchronously search for matches in all the project's CSS files
// (results are appended together in same 'resultSelectors' array)
_findMatchingRulesInCSSFiles(selector, resultSelectors)
.done(function () {
result.resolve(resultSelectors);
})
.fail(function (error) {
result.reject(error);
});
return result.promise();
} | [
"function",
"findMatchingRules",
"(",
"selector",
",",
"htmlDocument",
")",
"{",
"var",
"result",
"=",
"new",
"$",
".",
"Deferred",
"(",
")",
",",
"resultSelectors",
"=",
"[",
"]",
";",
"// Synchronously search for matches in <style> blocks",
"if",
"(",
"htmlDocum... | Return all rules matching the specified selector.
For now, we only look at the rightmost simple selector. For example, searching for ".foo" will
match these rules:
.foo {}
div .foo {}
div.foo {}
div .foo[bar="42"] {}
div .foo:hovered {}
div .foo::first-child
but will *not* match these rules:
.foobar {}
.foo .bar {}
div .foo .bar {}
.foo.bar {}
@param {!string} selector The selector to match. This can be a tag selector, class selector or id selector
@param {?Document} htmlDocument An HTML file for context (so we can search <style> blocks)
@return {$.Promise} that will be resolved with an Array of objects containing the
source document, start line, and end line (0-based, inclusive range) for each matching declaration list.
Does not addRef() the documents returned in the array. | [
"Return",
"all",
"rules",
"matching",
"the",
"specified",
"selector",
".",
"For",
"now",
"we",
"only",
"look",
"at",
"the",
"rightmost",
"simple",
"selector",
".",
"For",
"example",
"searching",
"for",
".",
"foo",
"will",
"match",
"these",
"rules",
":",
".... | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/language/CSSUtils.js#L1501-L1521 | train | Find matching rules in the specified selector | [
30522,
3853,
2424,
18900,
8450,
6820,
4244,
1006,
27000,
1010,
16129,
3527,
24894,
4765,
1007,
1063,
13075,
2765,
1027,
2047,
1002,
1012,
13366,
28849,
2094,
1006,
1007,
1010,
3463,
12260,
24817,
1027,
1031,
1033,
1025,
1013,
1013,
26351,
8... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
ecomfe/zrender | src/core/PathProxy.js | function (data) {
var len = data.length;
if (!(this.data && this.data.length === len) && hasTypedArray) {
this.data = new Float32Array(len);
}
for (var i = 0; i < len; i++) {
this.data[i] = data[i];
}
this._len = len;
} | javascript | function (data) {
var len = data.length;
if (!(this.data && this.data.length === len) && hasTypedArray) {
this.data = new Float32Array(len);
}
for (var i = 0; i < len; i++) {
this.data[i] = data[i];
}
this._len = len;
} | [
"function",
"(",
"data",
")",
"{",
"var",
"len",
"=",
"data",
".",
"length",
";",
"if",
"(",
"!",
"(",
"this",
".",
"data",
"&&",
"this",
".",
"data",
".",
"length",
"===",
"len",
")",
"&&",
"hasTypedArray",
")",
"{",
"this",
".",
"data",
"=",
... | 直接设置 Path 数据 | [
"直接设置",
"Path",
"数据"
] | 30321b57cba3149c30eacb0c1e18276f0f001b9f | https://github.com/ecomfe/zrender/blob/30321b57cba3149c30eacb0c1e18276f0f001b9f/src/core/PathProxy.js#L337-L350 | train | Encapsulates the data of a log record | [
30522,
3853,
1006,
2951,
1007,
1063,
13075,
18798,
1027,
2951,
1012,
3091,
1025,
2065,
1006,
999,
1006,
2023,
1012,
2951,
1004,
1004,
2023,
1012,
2951,
1012,
3091,
1027,
1027,
1027,
18798,
1007,
1004,
1004,
27151,
5669,
2906,
9447,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | src/sap.ui.ux3/src/sap/ui/ux3/ToolPopup.js | function () {
this._proxyFixSize();
if (!this._sInitialFocusId) {
var sInitFocusId = _fnGetInitialFocus(this);
// Compare the initial focus id with the current focus that is
// stored in the FocusHandler in the core.
// If the initial focus was set properly already by the Popup
// don't focus twice. Because Internet Explorer will be confused with// TODO remove after 1.62 version
// two focusin and focusout events
if (sInitFocusId !== sap.ui.getCore().getCurrentFocusedControlId()) {
var oControl = jQuery(document.getElementById(sInitFocusId));
oControl.focus();
}
}
if (!this._sResizeID) {
// register the ResizeHandler for the content of the toolPopup and not the whole toolPopup itself.
// In this way when resized the toolPopup does not change its height indefinitely.
this._sResizeID = ResizeHandler.register(this.$('content')[0], this._proxyOnResize);
}
// forward the Popup's opened event accordingly
// was added in "1.19.0" as a fix for a CSN and was downported to "1.18.2" and "1.16.6"
this.fireOpened();
} | javascript | function () {
this._proxyFixSize();
if (!this._sInitialFocusId) {
var sInitFocusId = _fnGetInitialFocus(this);
// Compare the initial focus id with the current focus that is
// stored in the FocusHandler in the core.
// If the initial focus was set properly already by the Popup
// don't focus twice. Because Internet Explorer will be confused with// TODO remove after 1.62 version
// two focusin and focusout events
if (sInitFocusId !== sap.ui.getCore().getCurrentFocusedControlId()) {
var oControl = jQuery(document.getElementById(sInitFocusId));
oControl.focus();
}
}
if (!this._sResizeID) {
// register the ResizeHandler for the content of the toolPopup and not the whole toolPopup itself.
// In this way when resized the toolPopup does not change its height indefinitely.
this._sResizeID = ResizeHandler.register(this.$('content')[0], this._proxyOnResize);
}
// forward the Popup's opened event accordingly
// was added in "1.19.0" as a fix for a CSN and was downported to "1.18.2" and "1.16.6"
this.fireOpened();
} | [
"function",
"(",
")",
"{",
"this",
".",
"_proxyFixSize",
"(",
")",
";",
"if",
"(",
"!",
"this",
".",
"_sInitialFocusId",
")",
"{",
"var",
"sInitFocusId",
"=",
"_fnGetInitialFocus",
"(",
"this",
")",
";",
"// Compare the initial focus id with the current focus that... | Function is called via 'jQuery.proxy()' when the ToolPopup has been opened
including the fade-in-animation of the Popup
@private | [
"Function",
"is",
"called",
"via",
"jQuery",
".",
"proxy",
"()",
"when",
"the",
"ToolPopup",
"has",
"been",
"opened",
"including",
"the",
"fade",
"-",
"in",
"-",
"animation",
"of",
"the",
"Popup"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.ux3/src/sap/ui/ux3/ToolPopup.js#L568-L594 | train | This method is called when the toolPopup is opened. | [
30522,
3853,
1006,
1007,
1063,
2023,
1012,
1035,
24540,
8873,
2595,
5332,
4371,
1006,
1007,
1025,
2065,
1006,
999,
2023,
1012,
1035,
8254,
29050,
10270,
10085,
2271,
3593,
1007,
1063,
13075,
8254,
4183,
14876,
7874,
3593,
1027,
1035,
1042,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
angular/material | src/core/services/interimElement/interimElement.js | addPreset | function addPreset(name, definition) {
definition = definition || {};
definition.methods = definition.methods || [];
definition.options = definition.options || function() { return {}; };
if (/^cancel|hide|show$/.test(name)) {
throw new Error("Preset '" + name + "' in " + interimFactoryName + " is reserved!");
}
if (definition.methods.indexOf('_options') > -1) {
throw new Error("Method '_options' in " + interimFactoryName + " is reserved!");
}
providerConfig.presets[name] = {
methods: definition.methods.concat(EXPOSED_METHODS),
optionsFactory: definition.options,
argOption: definition.argOption
};
return provider;
} | javascript | function addPreset(name, definition) {
definition = definition || {};
definition.methods = definition.methods || [];
definition.options = definition.options || function() { return {}; };
if (/^cancel|hide|show$/.test(name)) {
throw new Error("Preset '" + name + "' in " + interimFactoryName + " is reserved!");
}
if (definition.methods.indexOf('_options') > -1) {
throw new Error("Method '_options' in " + interimFactoryName + " is reserved!");
}
providerConfig.presets[name] = {
methods: definition.methods.concat(EXPOSED_METHODS),
optionsFactory: definition.options,
argOption: definition.argOption
};
return provider;
} | [
"function",
"addPreset",
"(",
"name",
",",
"definition",
")",
"{",
"definition",
"=",
"definition",
"||",
"{",
"}",
";",
"definition",
".",
"methods",
"=",
"definition",
".",
"methods",
"||",
"[",
"]",
";",
"definition",
".",
"options",
"=",
"definition",
... | Save the configured preset to be used when the factory is instantiated | [
"Save",
"the",
"configured",
"preset",
"to",
"be",
"used",
"when",
"the",
"factory",
"is",
"instantiated"
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/services/interimElement/interimElement.js#L83-L100 | train | Add a preset to the provider config | [
30522,
3853,
5587,
28994,
3388,
1006,
2171,
1010,
6210,
1007,
1063,
6210,
1027,
6210,
1064,
1064,
1063,
1065,
1025,
6210,
1012,
4725,
1027,
6210,
1012,
4725,
1064,
1064,
1031,
1033,
1025,
6210,
1012,
7047,
1027,
6210,
1012,
7047,
1064,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
emberjs/ember.js | packages/@ember/engine/index.js | resolverFor | function resolverFor(namespace) {
let ResolverClass = get(namespace, 'Resolver') || DefaultResolver;
let props = { namespace };
return ResolverClass.create(props);
} | javascript | function resolverFor(namespace) {
let ResolverClass = get(namespace, 'Resolver') || DefaultResolver;
let props = { namespace };
return ResolverClass.create(props);
} | [
"function",
"resolverFor",
"(",
"namespace",
")",
"{",
"let",
"ResolverClass",
"=",
"get",
"(",
"namespace",
",",
"'Resolver'",
")",
"||",
"DefaultResolver",
";",
"let",
"props",
"=",
"{",
"namespace",
"}",
";",
"return",
"ResolverClass",
".",
"create",
"(",... | This function defines the default lookup rules for container lookups:
templates are looked up on `Ember.TEMPLATES`
other names are looked up on the application after classifying the name.
For example, `controller:post` looks up `App.PostController` by default.
if the default lookup fails, look for registered classes on the container
This allows the application to register default injections in the container
that could be overridden by the normal naming convention.
@private
@method resolverFor
@param {Ember.Namespace} namespace the namespace to look for classes
@return {*} the resolved value for a given lookup | [
"This",
"function",
"defines",
"the",
"default",
"lookup",
"rules",
"for",
"container",
"lookups",
":"
] | 7ef1d08b7fe44000cf97b3c43566d20337b0683d | https://github.com/emberjs/ember.js/blob/7ef1d08b7fe44000cf97b3c43566d20337b0683d/packages/@ember/engine/index.js#L454-L458 | train | Creates a new Resolver instance for the given namespace. | [
30522,
3853,
10663,
12881,
2953,
1006,
3415,
15327,
1007,
1063,
2292,
10663,
11890,
27102,
1027,
2131,
1006,
3415,
15327,
1010,
1005,
10663,
2099,
1005,
1007,
1064,
1064,
12398,
6072,
4747,
6299,
1025,
2292,
24387,
1027,
1063,
3415,
15327,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SeleniumHQ/selenium | javascript/selenium-core/scripts/htmlutils.js | MultiWindowRPCOptimizingEngine | function MultiWindowRPCOptimizingEngine(newFrameName, newDelegateEngine) {
// private
var NO_RESULT = '__NO_NODE_RESULT';
var frameName = newFrameName;
var engine = newDelegateEngine || new JavascriptXPathEngine();
var optimizer = new XPathOptimizer(engine);
function createTestDocument() {
if (! window.frames[frameName]) {
var iframe = document.createElement('iframe');
iframe.id = frameName;
iframe.name = frameName;
iframe.width = 0;
iframe.height = 0;
document.body.appendChild(iframe);
}
}
function isMultiWindowMode() {
return (typeof(runOptions) != 'undefined' &&
runOptions &&
runOptions.isMultiWindowMode());
};
/**
* Returns whether a node is detached from any live documents. Detached
* nodes should be considered invalidated and evicted from any caches.
*/
function isDetached(node) {
while (node = node.parentNode) {
if (node.nodeType == 11) {
// it's a document fragment; we're detached (IE)
return true;
}
else if (node.nodeType == 9) {
// it's a normal document; we're attached
return false;
}
}
// we didn't find a document; we're detached (most other browsers)
return true;
}
// public
// Override
this.isAvailable = function() {
// though currently it only makes sense to use this engine for IE, we
// do not impose that restriction here.
return engine.isAvailable();
};
// Override
this.setDocument = function(newDocument) {
this.doc = newDocument;
engine.setDocument(newDocument);
optimizer.setDocument(newDocument);
return this;
};
/**
* No optimization performed for multi-node selections. This is because the
* optimizer only works for single node results.
*/
// Override
this.selectNodes = function(xpath, contextNode, namespaceResolver) {
return engine.selectNodes(xpath, contextNode, namespaceResolver);
};
// Override
this.selectSingleNode = function(xpath, contextNode, namespaceResolver) {
var html = this.doc.documentElement.innerHTML;
var knownOptimizations = optimizer.getKnownOptimizations();
var optimization = knownOptimizations.get(html, xpath);
if (optimization) {
var node = optimization.node;
var sourceIndex = optimization.sourceIndex;
if (node == NO_RESULT) {
return null;
}
// node is still valid? (test ok even if sourceIndex is null)
if (! isDetached(node) && node.sourceIndex == sourceIndex) {
safe_log('info', 'Found cached node for ' + xpath);
return node;
}
}
var node;
var finder = optimizer.setNamespaceResolver(namespaceResolver)
.setTestDocument(this.getTestDocument())
.getOptimizedFinder(xpath, contextNode);
if (finder) {
node = finder(this.doc);
}
else {
node = engine.selectSingleNode(xpath, contextNode,
namespaceResolver);
}
if (! optimization) {
optimization = knownOptimizations.getOrCreate(html, xpath);
}
if (node) {
optimization.node = node;
optimization.sourceIndex = node.sourceIndex;
}
else {
optimization.node = NO_RESULT;
}
return node;
};
// Override
this.countNodes = function(xpath, contextNode, namespaceResolver) {
return optimizer.setNamespaceResolver(namespaceResolver)
.setTestDocument(this.getTestDocument())
.countNodes(xpath, contextNode);
};
// Override
this.setIgnoreAttributesWithoutValue = function(ignore) {
engine.setIgnoreAttributesWithoutValue(ignore);
return this;
};
/**
* Returns the "local" document as a frame in the Selenium runner document.
*/
this.getTestDocument = function() {
// made this a public method, because apparently private methods can't
// access "this" of the instance.
return (isMultiWindowMode()
? window.frames[frameName].document
: this.doc);
};
// initialization
// creating the frame and the document it contains is not a synchronous
// operation (at least not for IE), so we should create it eagerly
if (isMultiWindowMode()) {
createTestDocument();
}
} | javascript | function MultiWindowRPCOptimizingEngine(newFrameName, newDelegateEngine) {
// private
var NO_RESULT = '__NO_NODE_RESULT';
var frameName = newFrameName;
var engine = newDelegateEngine || new JavascriptXPathEngine();
var optimizer = new XPathOptimizer(engine);
function createTestDocument() {
if (! window.frames[frameName]) {
var iframe = document.createElement('iframe');
iframe.id = frameName;
iframe.name = frameName;
iframe.width = 0;
iframe.height = 0;
document.body.appendChild(iframe);
}
}
function isMultiWindowMode() {
return (typeof(runOptions) != 'undefined' &&
runOptions &&
runOptions.isMultiWindowMode());
};
/**
* Returns whether a node is detached from any live documents. Detached
* nodes should be considered invalidated and evicted from any caches.
*/
function isDetached(node) {
while (node = node.parentNode) {
if (node.nodeType == 11) {
// it's a document fragment; we're detached (IE)
return true;
}
else if (node.nodeType == 9) {
// it's a normal document; we're attached
return false;
}
}
// we didn't find a document; we're detached (most other browsers)
return true;
}
// public
// Override
this.isAvailable = function() {
// though currently it only makes sense to use this engine for IE, we
// do not impose that restriction here.
return engine.isAvailable();
};
// Override
this.setDocument = function(newDocument) {
this.doc = newDocument;
engine.setDocument(newDocument);
optimizer.setDocument(newDocument);
return this;
};
/**
* No optimization performed for multi-node selections. This is because the
* optimizer only works for single node results.
*/
// Override
this.selectNodes = function(xpath, contextNode, namespaceResolver) {
return engine.selectNodes(xpath, contextNode, namespaceResolver);
};
// Override
this.selectSingleNode = function(xpath, contextNode, namespaceResolver) {
var html = this.doc.documentElement.innerHTML;
var knownOptimizations = optimizer.getKnownOptimizations();
var optimization = knownOptimizations.get(html, xpath);
if (optimization) {
var node = optimization.node;
var sourceIndex = optimization.sourceIndex;
if (node == NO_RESULT) {
return null;
}
// node is still valid? (test ok even if sourceIndex is null)
if (! isDetached(node) && node.sourceIndex == sourceIndex) {
safe_log('info', 'Found cached node for ' + xpath);
return node;
}
}
var node;
var finder = optimizer.setNamespaceResolver(namespaceResolver)
.setTestDocument(this.getTestDocument())
.getOptimizedFinder(xpath, contextNode);
if (finder) {
node = finder(this.doc);
}
else {
node = engine.selectSingleNode(xpath, contextNode,
namespaceResolver);
}
if (! optimization) {
optimization = knownOptimizations.getOrCreate(html, xpath);
}
if (node) {
optimization.node = node;
optimization.sourceIndex = node.sourceIndex;
}
else {
optimization.node = NO_RESULT;
}
return node;
};
// Override
this.countNodes = function(xpath, contextNode, namespaceResolver) {
return optimizer.setNamespaceResolver(namespaceResolver)
.setTestDocument(this.getTestDocument())
.countNodes(xpath, contextNode);
};
// Override
this.setIgnoreAttributesWithoutValue = function(ignore) {
engine.setIgnoreAttributesWithoutValue(ignore);
return this;
};
/**
* Returns the "local" document as a frame in the Selenium runner document.
*/
this.getTestDocument = function() {
// made this a public method, because apparently private methods can't
// access "this" of the instance.
return (isMultiWindowMode()
? window.frames[frameName].document
: this.doc);
};
// initialization
// creating the frame and the document it contains is not a synchronous
// operation (at least not for IE), so we should create it eagerly
if (isMultiWindowMode()) {
createTestDocument();
}
} | [
"function",
"MultiWindowRPCOptimizingEngine",
"(",
"newFrameName",
",",
"newDelegateEngine",
")",
"{",
"// private",
"var",
"NO_RESULT",
"=",
"'__NO_NODE_RESULT'",
";",
"var",
"frameName",
"=",
"newFrameName",
";",
"var",
"engine",
"=",
"newDelegateEngine",
"||",
"new... | /////////////////////////////////////////////////////////////////////////////
Implements XPathEngine.
A non-native XPathEngine that tries to avoid inter-window RPC calls, which
are very expensive for IE. It does this by cloning the document from a
"remote" window to a "local" window, and performing operations on the local
clone where possible. The selectSingleNode() and countNodes() methods may
benefit from optimization, while selectNodes() currently will not.
@param newFrameName the name of the DOM window frame whose document
to use exclusively for XPath optimization
@param newDelegateEngine the underlying engine delegate used to evaluate
XPath's. Defaults to a JavascriptXPathEngine
instance. | [
"/////////////////////////////////////////////////////////////////////////////",
"Implements",
"XPathEngine",
"."
] | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/selenium-core/scripts/htmlutils.js#L1783-L1935 | train | A multi - window - RPC optimization engine. | [
30522,
3853,
4800,
11101,
5004,
14536,
3597,
13876,
27605,
6774,
13159,
3170,
1006,
2047,
15643,
18442,
1010,
2047,
9247,
29107,
17389,
3070,
3170,
1007,
1063,
1013,
1013,
2797,
13075,
2053,
1035,
2765,
1027,
1005,
1035,
1035,
2053,
1035,
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... |
SeleniumHQ/selenium | javascript/selenium-core/scripts/htmlutils.js | FinderBuilder | function FinderBuilder(newDocument) {
// private
var doc = newDocument;
function buildIdFinder(e) {
if (e.id) {
var id = e.id;
return (function(targetDoc) {
return targetDoc.getElementById(id);
});
}
return null;
}
function buildTagNameFinder(e) {
var elements = doc.getElementsByTagName(e.tagName);
for (var i = 0, n = elements.length; i < n; ++i) {
if (elements[i] === e) {
// both the descendant axis and getElementsByTagName() should
// return elements in document order; hence the following index
// operation is possible
return (function(targetDoc) {
return targetDoc.getElementsByTagName(e.tagName)[i];
});
}
}
return null;
}
// public
this.setDocument = function(newDocument) {
doc = newDocument;
return this;
};
this.build = function(e) {
return (
buildIdFinder(e) ||
buildTagNameFinder(e)
);
};
} | javascript | function FinderBuilder(newDocument) {
// private
var doc = newDocument;
function buildIdFinder(e) {
if (e.id) {
var id = e.id;
return (function(targetDoc) {
return targetDoc.getElementById(id);
});
}
return null;
}
function buildTagNameFinder(e) {
var elements = doc.getElementsByTagName(e.tagName);
for (var i = 0, n = elements.length; i < n; ++i) {
if (elements[i] === e) {
// both the descendant axis and getElementsByTagName() should
// return elements in document order; hence the following index
// operation is possible
return (function(targetDoc) {
return targetDoc.getElementsByTagName(e.tagName)[i];
});
}
}
return null;
}
// public
this.setDocument = function(newDocument) {
doc = newDocument;
return this;
};
this.build = function(e) {
return (
buildIdFinder(e) ||
buildTagNameFinder(e)
);
};
} | [
"function",
"FinderBuilder",
"(",
"newDocument",
")",
"{",
"// private",
"var",
"doc",
"=",
"newDocument",
";",
"function",
"buildIdFinder",
"(",
"e",
")",
"{",
"if",
"(",
"e",
".",
"id",
")",
"{",
"var",
"id",
"=",
"e",
".",
"id",
";",
"return",
"("... | /////////////////////////////////////////////////////////////////////////////
Builds and returns closures that take a document and return a node. | [
"/////////////////////////////////////////////////////////////////////////////",
"Builds",
"and",
"returns",
"closures",
"that",
"take",
"a",
"document",
"and",
"return",
"a",
"node",
"."
] | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/selenium-core/scripts/htmlutils.js#L1369-L1414 | train | Constructor for FinderBuilder | [
30522,
3853,
2424,
2121,
8569,
23891,
2099,
1006,
2047,
3527,
24894,
4765,
1007,
1063,
1013,
1013,
2797,
13075,
9986,
1027,
2047,
3527,
24894,
4765,
1025,
3853,
3857,
3593,
23695,
1006,
1041,
1007,
1063,
2065,
1006,
1041,
1012,
8909,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/editor/EditorManager.js | registerInlineEditProvider | function registerInlineEditProvider(provider, priority) {
if (priority === undefined) {
priority = 0;
}
_insertProviderSorted(_inlineEditProviders, provider, priority);
} | javascript | function registerInlineEditProvider(provider, priority) {
if (priority === undefined) {
priority = 0;
}
_insertProviderSorted(_inlineEditProviders, provider, priority);
} | [
"function",
"registerInlineEditProvider",
"(",
"provider",
",",
"priority",
")",
"{",
"if",
"(",
"priority",
"===",
"undefined",
")",
"{",
"priority",
"=",
"0",
";",
"}",
"_insertProviderSorted",
"(",
"_inlineEditProviders",
",",
"provider",
",",
"priority",
")"... | Registers a new inline editor provider. When Quick Edit is invoked each registered provider is
asked if it wants to provide an inline editor given the current editor and cursor location.
An optional priority parameter is used to give providers with higher priority an opportunity
to provide an inline editor before providers with lower priority.
@param {function(!Editor, !{line:number, ch:number}):?($.Promise|string)} provider
@param {number=} priority
The provider returns a promise that will be resolved with an InlineWidget, or returns a string
indicating why the provider cannot respond to this case (or returns null to indicate no reason). | [
"Registers",
"a",
"new",
"inline",
"editor",
"provider",
".",
"When",
"Quick",
"Edit",
"is",
"invoked",
"each",
"registered",
"provider",
"is",
"asked",
"if",
"it",
"wants",
"to",
"provide",
"an",
"inline",
"editor",
"given",
"the",
"current",
"editor",
"and... | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/editor/EditorManager.js#L392-L397 | train | Register an inline edit provider. | [
30522,
3853,
4236,
2378,
4179,
2098,
4183,
21572,
17258,
2121,
1006,
10802,
1010,
9470,
1007,
1063,
2065,
1006,
9470,
1027,
1027,
1027,
6151,
28344,
1007,
1063,
9470,
1027,
1014,
1025,
1065,
1035,
19274,
21572,
17258,
2545,
15613,
1006,
103... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
uber/deck.gl | modules/core/src/lifecycle/create-props.js | addAsyncPropsToPropPrototype | function addAsyncPropsToPropPrototype(defaultProps, propTypes) {
const defaultValues = {};
const descriptors = {
// Default "resolved" values for async props, returned if value not yet resolved/set.
_asyncPropDefaultValues: {
enumerable: false,
value: defaultValues
},
// Shadowed object, just to make sure "early indexing" into the instance does not fail
_asyncPropOriginalValues: {
enumerable: false,
value: {}
}
};
// Move async props into shadow values
for (const propName in propTypes) {
const propType = propTypes[propName];
const {name, value} = propType;
// Note: async is ES7 keyword, can't destructure
if (propType.async) {
defaultValues[name] = value;
descriptors[name] = getDescriptorForAsyncProp(name, value);
}
}
Object.defineProperties(defaultProps, descriptors);
} | javascript | function addAsyncPropsToPropPrototype(defaultProps, propTypes) {
const defaultValues = {};
const descriptors = {
// Default "resolved" values for async props, returned if value not yet resolved/set.
_asyncPropDefaultValues: {
enumerable: false,
value: defaultValues
},
// Shadowed object, just to make sure "early indexing" into the instance does not fail
_asyncPropOriginalValues: {
enumerable: false,
value: {}
}
};
// Move async props into shadow values
for (const propName in propTypes) {
const propType = propTypes[propName];
const {name, value} = propType;
// Note: async is ES7 keyword, can't destructure
if (propType.async) {
defaultValues[name] = value;
descriptors[name] = getDescriptorForAsyncProp(name, value);
}
}
Object.defineProperties(defaultProps, descriptors);
} | [
"function",
"addAsyncPropsToPropPrototype",
"(",
"defaultProps",
",",
"propTypes",
")",
"{",
"const",
"defaultValues",
"=",
"{",
"}",
";",
"const",
"descriptors",
"=",
"{",
"// Default \"resolved\" values for async props, returned if value not yet resolved/set.",
"_asyncPropDef... | Create descriptors for overridable props | [
"Create",
"descriptors",
"for",
"overridable",
"props"
] | a2010448b7f268bbd03617b812334c68a6b9e5b2 | https://github.com/uber/deck.gl/blob/a2010448b7f268bbd03617b812334c68a6b9e5b2/modules/core/src/lifecycle/create-props.js#L165-L194 | train | Add async props to the prototype | [
30522,
3853,
5587,
3022,
6038,
21906,
18981,
16033,
21572,
9397,
21709,
26305,
1006,
12398,
21572,
4523,
1010,
17678,
13874,
2015,
1007,
1063,
9530,
3367,
12398,
10175,
15808,
1027,
1063,
1065,
1025,
9530,
3367,
4078,
23235,
5668,
1027,
1063,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/LiveDevelopment/MultiBrowserImpl/protocol/remote/DocumentObserver.js | _onNodesAdded | function _onNodesAdded(nodes) {
var i;
for (i = 0; i < nodes.length; i++) {
//check for Javascript files
if (Utils.isExternalScript(nodes[i])) {
_transport.send(JSON.stringify({
method: 'ScriptAdded',
src: nodes[i].src
}));
}
//check for stylesheets
if (Utils.isExternalStylesheet(nodes[i])) {
CSS.checkForStylesheetLoaded(nodes[i].href);
}
}
} | javascript | function _onNodesAdded(nodes) {
var i;
for (i = 0; i < nodes.length; i++) {
//check for Javascript files
if (Utils.isExternalScript(nodes[i])) {
_transport.send(JSON.stringify({
method: 'ScriptAdded',
src: nodes[i].src
}));
}
//check for stylesheets
if (Utils.isExternalStylesheet(nodes[i])) {
CSS.checkForStylesheetLoaded(nodes[i].href);
}
}
} | [
"function",
"_onNodesAdded",
"(",
"nodes",
")",
"{",
"var",
"i",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"nodes",
".",
"length",
";",
"i",
"++",
")",
"{",
"//check for Javascript files",
"if",
"(",
"Utils",
".",
"isExternalScript",
"(",
"nodes",... | /* process related docs added | [
"/",
"*",
"process",
"related",
"docs",
"added"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/LiveDevelopment/MultiBrowserImpl/protocol/remote/DocumentObserver.js#L231-L246 | train | on nodes added | [
30522,
3853,
1035,
2006,
3630,
6155,
4215,
5732,
1006,
14164,
1007,
1063,
13075,
1045,
1025,
2005,
1006,
1045,
1027,
1014,
1025,
1045,
1026,
14164,
1012,
3091,
1025,
1045,
1009,
1009,
1007,
1063,
1013,
1013,
4638,
2005,
9262,
22483,
6764,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/aria/aria.js | MdAriaProvider | function MdAriaProvider() {
var config = {
/** Whether we should show ARIA warnings in the console if labels are missing on the element */
showWarnings: true
};
return {
disableWarnings: disableWarnings,
$get: function($$rAF, $log, $window, $interpolate) {
return MdAriaService.apply(config, arguments);
}
};
/**
* @ngdoc method
* @name $mdAriaProvider#disableWarnings
* @description Disables all ARIA warnings generated by AngularJS Material.
*/
function disableWarnings() {
config.showWarnings = false;
}
} | javascript | function MdAriaProvider() {
var config = {
/** Whether we should show ARIA warnings in the console if labels are missing on the element */
showWarnings: true
};
return {
disableWarnings: disableWarnings,
$get: function($$rAF, $log, $window, $interpolate) {
return MdAriaService.apply(config, arguments);
}
};
/**
* @ngdoc method
* @name $mdAriaProvider#disableWarnings
* @description Disables all ARIA warnings generated by AngularJS Material.
*/
function disableWarnings() {
config.showWarnings = false;
}
} | [
"function",
"MdAriaProvider",
"(",
")",
"{",
"var",
"config",
"=",
"{",
"/** Whether we should show ARIA warnings in the console if labels are missing on the element */",
"showWarnings",
":",
"true",
"}",
";",
"return",
"{",
"disableWarnings",
":",
"disableWarnings",
",",
"... | @ngdoc service
@name $mdAriaProvider
@module material.core.aria
@description
Modify options of the `$mdAria` service, which will be used by most of the AngularJS Material
components.
You are able to disable `$mdAria` warnings, by using the following markup.
<hljs lang="js">
app.config(function($mdAriaProvider) {
// Globally disables all ARIA warnings.
$mdAriaProvider.disableWarnings();
});
</hljs> | [
"@ngdoc",
"service",
"@name",
"$mdAriaProvider",
"@module",
"material",
".",
"core",
".",
"aria"
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/services/aria/aria.js#L31-L53 | train | AriaProvider provides a provider to use the ARIA warnings. | [
30522,
3853,
9108,
10980,
21572,
17258,
2121,
1006,
1007,
1063,
13075,
9530,
8873,
2290,
1027,
1063,
1013,
1008,
1008,
3251,
2057,
2323,
2265,
9342,
16234,
1999,
1996,
10122,
2065,
10873,
2024,
4394,
2006,
1996,
5783,
1008,
1013,
2265,
9028... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
NetEase/pomelo | lib/components/proxy.js | function(app, opts) {
this.app = app;
this.opts = opts;
this.client = genRpcClient(this.app, opts);
this.app.event.on(events.ADD_SERVERS, this.addServers.bind(this));
this.app.event.on(events.REMOVE_SERVERS, this.removeServers.bind(this));
this.app.event.on(events.REPLACE_SERVERS, this.replaceServers.bind(this));
} | javascript | function(app, opts) {
this.app = app;
this.opts = opts;
this.client = genRpcClient(this.app, opts);
this.app.event.on(events.ADD_SERVERS, this.addServers.bind(this));
this.app.event.on(events.REMOVE_SERVERS, this.removeServers.bind(this));
this.app.event.on(events.REPLACE_SERVERS, this.replaceServers.bind(this));
} | [
"function",
"(",
"app",
",",
"opts",
")",
"{",
"this",
".",
"app",
"=",
"app",
";",
"this",
".",
"opts",
"=",
"opts",
";",
"this",
".",
"client",
"=",
"genRpcClient",
"(",
"this",
".",
"app",
",",
"opts",
")",
";",
"this",
".",
"app",
".",
"eve... | Proxy component class
@param {Object} app current application context
@param {Object} opts construct parameters | [
"Proxy",
"component",
"class"
] | defcf019631ed399cc4dad932d3b028a04a039a4 | https://github.com/NetEase/pomelo/blob/defcf019631ed399cc4dad932d3b028a04a039a4/lib/components/proxy.js#L45-L52 | train | Constructor for the Cluster | [
30522,
3853,
1006,
10439,
1010,
23569,
2015,
1007,
1063,
2023,
1012,
10439,
1027,
10439,
1025,
2023,
1012,
23569,
2015,
1027,
23569,
2015,
1025,
2023,
1012,
7396,
1027,
8991,
14536,
9468,
8751,
3372,
1006,
2023,
1012,
10439,
1010,
23569,
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.commons/src/sap/ui/commons/RoadMapRenderer.js | function(rm, oRoadMap, bStart){
var sType = bStart ? "Start" : "End";
rm.write("<div");
rm.writeAttribute("id", oRoadMap.getId() + "-" + sType);
rm.writeAttribute("tabindex", "-1");
var hasHiddenSteps = true; //Simply assume that there are hidden steps -> updated later (see function updateScrollState)
rm.addClass(hasHiddenSteps ? "sapUiRoadMap" + sType + "Scroll" : "sapUiRoadMap" + sType + "Fixed");
rm.addClass("sapUiRoadMapDelim");
rm.addClass("sapUiRoadMapContent");
rm.writeClasses();
rm.write("></div>");
} | javascript | function(rm, oRoadMap, bStart){
var sType = bStart ? "Start" : "End";
rm.write("<div");
rm.writeAttribute("id", oRoadMap.getId() + "-" + sType);
rm.writeAttribute("tabindex", "-1");
var hasHiddenSteps = true; //Simply assume that there are hidden steps -> updated later (see function updateScrollState)
rm.addClass(hasHiddenSteps ? "sapUiRoadMap" + sType + "Scroll" : "sapUiRoadMap" + sType + "Fixed");
rm.addClass("sapUiRoadMapDelim");
rm.addClass("sapUiRoadMapContent");
rm.writeClasses();
rm.write("></div>");
} | [
"function",
"(",
"rm",
",",
"oRoadMap",
",",
"bStart",
")",
"{",
"var",
"sType",
"=",
"bStart",
"?",
"\"Start\"",
":",
"\"End\"",
";",
"rm",
".",
"write",
"(",
"\"<div\"",
")",
";",
"rm",
".",
"writeAttribute",
"(",
"\"id\"",
",",
"oRoadMap",
".",
"g... | Writes the delimiter HTML into the rendermanger | [
"Writes",
"the",
"delimiter",
"HTML",
"into",
"the",
"rendermanger"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.commons/src/sap/ui/commons/RoadMapRenderer.js#L540-L551 | train | Writes the control to the rendermanger | [
30522,
3853,
1006,
28549,
1010,
20298,
4215,
2863,
2361,
1010,
18667,
7559,
2102,
1007,
1063,
13075,
2358,
18863,
1027,
18667,
7559,
2102,
1029,
1000,
2707,
1000,
1024,
1000,
2203,
1000,
1025,
28549,
1012,
4339,
1006,
1000,
1026,
4487,
2615... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
testing-library/dom-testing-library | src/query-helpers.js | getElementError | function getElementError(message, container) {
return new Error([message, debugDOM(container)].filter(Boolean).join('\n\n'))
} | javascript | function getElementError(message, container) {
return new Error([message, debugDOM(container)].filter(Boolean).join('\n\n'))
} | [
"function",
"getElementError",
"(",
"message",
",",
"container",
")",
"{",
"return",
"new",
"Error",
"(",
"[",
"message",
",",
"debugDOM",
"(",
"container",
")",
"]",
".",
"filter",
"(",
"Boolean",
")",
".",
"join",
"(",
"'\\n\\n'",
")",
")",
"}"
] | /* eslint-enable complexity | [
"/",
"*",
"eslint",
"-",
"enable",
"complexity"
] | fcb2cbcffb7aff6ecff3be8731168c86eee82ce1 | https://github.com/testing-library/dom-testing-library/blob/fcb2cbcffb7aff6ecff3be8731168c86eee82ce1/src/query-helpers.js#L30-L32 | train | Returns an error object for the given element | [
30522,
3853,
2131,
12260,
3672,
2121,
29165,
1006,
4471,
1010,
11661,
1007,
1063,
2709,
2047,
7561,
1006,
1031,
4471,
1010,
2139,
8569,
2290,
9527,
1006,
11661,
1007,
1033,
1012,
11307,
1006,
22017,
20898,
1007,
1012,
3693,
1006,
1005,
1032... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
eslint/eslint | lib/rules/padding-line-between-statements.js | isIIFEStatement | function isIIFEStatement(node) {
if (node.type === "ExpressionStatement") {
let call = node.expression;
if (call.type === "UnaryExpression") {
call = call.argument;
}
return call.type === "CallExpression" && astUtils.isFunction(call.callee);
}
return false;
} | javascript | function isIIFEStatement(node) {
if (node.type === "ExpressionStatement") {
let call = node.expression;
if (call.type === "UnaryExpression") {
call = call.argument;
}
return call.type === "CallExpression" && astUtils.isFunction(call.callee);
}
return false;
} | [
"function",
"isIIFEStatement",
"(",
"node",
")",
"{",
"if",
"(",
"node",
".",
"type",
"===",
"\"ExpressionStatement\"",
")",
"{",
"let",
"call",
"=",
"node",
".",
"expression",
";",
"if",
"(",
"call",
".",
"type",
"===",
"\"UnaryExpression\"",
")",
"{",
... | Checks the given node is an expression statement of IIFE.
@param {ASTNode} node The node to check.
@returns {boolean} `true` if the node is an expression statement of IIFE.
@private | [
"Checks",
"the",
"given",
"node",
"is",
"an",
"expression",
"statement",
"of",
"IIFE",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/padding-line-between-statements.js#L91-L101 | train | Checks whether a given node is an IIFE statement. | [
30522,
3853,
2003,
6137,
14081,
3686,
3672,
1006,
13045,
1007,
1063,
2065,
1006,
13045,
1012,
2828,
1027,
1027,
1027,
1000,
11423,
12259,
3672,
1000,
1007,
1063,
2292,
2655,
1027,
13045,
1012,
3670,
1025,
2065,
1006,
2655,
1012,
2828,
1027,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
getsentry/sentry-javascript | packages/raven-js/src/raven.js | function() {
TraceKit.report.uninstall();
this._detachPromiseRejectionHandler();
this._unpatchFunctionToString();
this._restoreBuiltIns();
this._restoreConsole();
Error.stackTraceLimit = this._originalErrorStackTraceLimit;
this._isRavenInstalled = false;
return this;
} | javascript | function() {
TraceKit.report.uninstall();
this._detachPromiseRejectionHandler();
this._unpatchFunctionToString();
this._restoreBuiltIns();
this._restoreConsole();
Error.stackTraceLimit = this._originalErrorStackTraceLimit;
this._isRavenInstalled = false;
return this;
} | [
"function",
"(",
")",
"{",
"TraceKit",
".",
"report",
".",
"uninstall",
"(",
")",
";",
"this",
".",
"_detachPromiseRejectionHandler",
"(",
")",
";",
"this",
".",
"_unpatchFunctionToString",
"(",
")",
";",
"this",
".",
"_restoreBuiltIns",
"(",
")",
";",
"th... | Uninstalls the global error handler.
@return {Raven} | [
"Uninstalls",
"the",
"global",
"error",
"handler",
"."
] | a872223343fecf7364473b78bede937f1eb57bd0 | https://github.com/getsentry/sentry-javascript/blob/a872223343fecf7364473b78bede937f1eb57bd0/packages/raven-js/src/raven.js#L406-L418 | train | uninstalls the raven package | [
30522,
3853,
1006,
1007,
1063,
7637,
23615,
1012,
3189,
1012,
4895,
7076,
9080,
2140,
1006,
1007,
1025,
2023,
1012,
1035,
20010,
6776,
21572,
28732,
2890,
20614,
3258,
11774,
3917,
1006,
1007,
1025,
2023,
1012,
1035,
4895,
4502,
10649,
1126... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/layout/layout.js | function(element) {
if (!config.enabled) return angular.noop;
// Re-add the cloak
element.addClass(className);
return function(scope, element) {
// Wait while layout injectors configure, then uncloak
// NOTE: $rAF does not delay enough... and this is a 1x-only event,
// $timeout is acceptable.
$timeout(function(){
element.removeClass(className);
}, 10, false);
};
} | javascript | function(element) {
if (!config.enabled) return angular.noop;
// Re-add the cloak
element.addClass(className);
return function(scope, element) {
// Wait while layout injectors configure, then uncloak
// NOTE: $rAF does not delay enough... and this is a 1x-only event,
// $timeout is acceptable.
$timeout(function(){
element.removeClass(className);
}, 10, false);
};
} | [
"function",
"(",
"element",
")",
"{",
"if",
"(",
"!",
"config",
".",
"enabled",
")",
"return",
"angular",
".",
"noop",
";",
"// Re-add the cloak",
"element",
".",
"addClass",
"(",
"className",
")",
";",
"return",
"function",
"(",
"scope",
",",
"element",
... | run after normal ng-cloak | [
"run",
"after",
"normal",
"ng",
"-",
"cloak"
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/services/layout/layout.js#L220-L234 | train | Returns a function that will add the cloak
ether class to the element | [
30522,
3853,
1006,
5783,
1007,
1063,
2065,
1006,
999,
9530,
8873,
2290,
1012,
9124,
1007,
2709,
16108,
1012,
2053,
7361,
1025,
1013,
1013,
2128,
1011,
5587,
1996,
11965,
5783,
1012,
5587,
26266,
1006,
2465,
18442,
1007,
1025,
2709,
3853,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | src/sap.ui.core/src/sap/ui/dom/jquery/Selectors.js | visible | function visible( element ) {
// check if one of the parents (until it's position parent) is invisible
// prevent that elements in static area are always checked as invisible
// list all items until the offsetParent item (with jQuery >1.6 you can use parentsUntil)
var oOffsetParent = jQuery(element).offsetParent();
var bOffsetParentFound = false;
var $refs = jQuery(element).parents().filter(function() {
if (this === oOffsetParent) {
bOffsetParentFound = true;
}
return bOffsetParentFound;
});
// check for at least one item to be visible
return !jQuery(element).add($refs).filter(function() {
return jQuery.css( this, "visibility" ) === "hidden" || jQuery.expr.filters.hidden( this );
}).length;
} | javascript | function visible( element ) {
// check if one of the parents (until it's position parent) is invisible
// prevent that elements in static area are always checked as invisible
// list all items until the offsetParent item (with jQuery >1.6 you can use parentsUntil)
var oOffsetParent = jQuery(element).offsetParent();
var bOffsetParentFound = false;
var $refs = jQuery(element).parents().filter(function() {
if (this === oOffsetParent) {
bOffsetParentFound = true;
}
return bOffsetParentFound;
});
// check for at least one item to be visible
return !jQuery(element).add($refs).filter(function() {
return jQuery.css( this, "visibility" ) === "hidden" || jQuery.expr.filters.hidden( this );
}).length;
} | [
"function",
"visible",
"(",
"element",
")",
"{",
"// check if one of the parents (until it's position parent) is invisible",
"// prevent that elements in static area are always checked as invisible",
"// list all items until the offsetParent item (with jQuery >1.6 you can use parentsUntil)",
"var"... | /*!
The following functions are taken from jQuery UI 1.8.17 but modified
Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
Dual licensed under the MIT or GPL Version 2 licenses.
http://jquery.org/license
http://docs.jquery.com/UI | [
"/",
"*",
"!",
"The",
"following",
"functions",
"are",
"taken",
"from",
"jQuery",
"UI",
"1",
".",
"8",
".",
"17",
"but",
"modified"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/dom/jquery/Selectors.js#L39-L57 | train | Checks if an element is visible | [
30522,
3853,
5710,
1006,
5783,
1007,
1063,
1013,
1013,
4638,
2065,
2028,
1997,
1996,
3008,
1006,
2127,
2009,
1005,
1055,
2597,
6687,
1007,
2003,
8841,
1013,
1013,
4652,
2008,
3787,
1999,
10763,
2181,
2024,
2467,
7039,
2004,
8841,
1013,
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.ux3/src/sap/ui/ux3/NotificationBar.js | function(oEvent) {
var oMN = this.getMessageNotifier();
if (oMN && oMN.getId() === oEvent.getParameter("notifier").getId()) {
oMN.invalidate();
}
} | javascript | function(oEvent) {
var oMN = this.getMessageNotifier();
if (oMN && oMN.getId() === oEvent.getParameter("notifier").getId()) {
oMN.invalidate();
}
} | [
"function",
"(",
"oEvent",
")",
"{",
"var",
"oMN",
"=",
"this",
".",
"getMessageNotifier",
"(",
")",
";",
"if",
"(",
"oMN",
"&&",
"oMN",
".",
"getId",
"(",
")",
"===",
"oEvent",
".",
"getParameter",
"(",
"\"notifier\"",
")",
".",
"getId",
"(",
")",
... | This function is called when the 'messageSelected' event listener was
attached/detached to the MessageNotifier. If the MessageNotifier is
affected it is invalidated accordingly so the inplace message of the
MessageNotifier is clickable or not and has visual features as if it were
clickable. | [
"This",
"function",
"is",
"called",
"when",
"the",
"messageSelected",
"event",
"listener",
"was",
"attached",
"/",
"detached",
"to",
"the",
"MessageNotifier",
".",
"If",
"the",
"MessageNotifier",
"is",
"affected",
"it",
"is",
"invalidated",
"accordingly",
"so",
... | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.ux3/src/sap/ui/ux3/NotificationBar.js#L718-L724 | train | Handles the event from the notifier | [
30522,
3853,
1006,
1051,
18697,
3372,
1007,
1063,
13075,
18168,
2078,
1027,
2023,
1012,
2131,
7834,
3736,
6914,
4140,
18095,
1006,
1007,
1025,
2065,
1006,
18168,
2078,
1004,
1004,
18168,
2078,
1012,
2131,
3593,
1006,
1007,
1027,
1027,
1027,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
zloirock/core-js | packages/core-js/modules/es.reflect.set.js | set | function set(target, propertyKey, V /* , receiver */) {
var receiver = arguments.length < 4 ? target : arguments[3];
var ownDescriptor = getOwnPropertyDescriptorModule.f(anObject(target), propertyKey);
var existingDescriptor, prototype;
if (!ownDescriptor) {
if (isObject(prototype = getPrototypeOf(target))) {
return set(prototype, propertyKey, V, receiver);
}
ownDescriptor = createPropertyDescriptor(0);
}
if (has(ownDescriptor, 'value')) {
if (ownDescriptor.writable === false || !isObject(receiver)) return false;
if (existingDescriptor = getOwnPropertyDescriptorModule.f(receiver, propertyKey)) {
if (existingDescriptor.get || existingDescriptor.set || existingDescriptor.writable === false) return false;
existingDescriptor.value = V;
definePropertyModule.f(receiver, propertyKey, existingDescriptor);
} else definePropertyModule.f(receiver, propertyKey, createPropertyDescriptor(0, V));
return true;
}
return ownDescriptor.set === undefined ? false : (ownDescriptor.set.call(receiver, V), true);
} | javascript | function set(target, propertyKey, V /* , receiver */) {
var receiver = arguments.length < 4 ? target : arguments[3];
var ownDescriptor = getOwnPropertyDescriptorModule.f(anObject(target), propertyKey);
var existingDescriptor, prototype;
if (!ownDescriptor) {
if (isObject(prototype = getPrototypeOf(target))) {
return set(prototype, propertyKey, V, receiver);
}
ownDescriptor = createPropertyDescriptor(0);
}
if (has(ownDescriptor, 'value')) {
if (ownDescriptor.writable === false || !isObject(receiver)) return false;
if (existingDescriptor = getOwnPropertyDescriptorModule.f(receiver, propertyKey)) {
if (existingDescriptor.get || existingDescriptor.set || existingDescriptor.writable === false) return false;
existingDescriptor.value = V;
definePropertyModule.f(receiver, propertyKey, existingDescriptor);
} else definePropertyModule.f(receiver, propertyKey, createPropertyDescriptor(0, V));
return true;
}
return ownDescriptor.set === undefined ? false : (ownDescriptor.set.call(receiver, V), true);
} | [
"function",
"set",
"(",
"target",
",",
"propertyKey",
",",
"V",
"/* , receiver */",
")",
"{",
"var",
"receiver",
"=",
"arguments",
".",
"length",
"<",
"4",
"?",
"target",
":",
"arguments",
"[",
"3",
"]",
";",
"var",
"ownDescriptor",
"=",
"getOwnPropertyDes... | `Reflect.set` method https://tc39.github.io/ecma262/#sec-reflect.set | [
"Reflect",
".",
"set",
"method",
"https",
":",
"//",
"tc39",
".",
"github",
".",
"io",
"/",
"ecma262",
"/",
"#sec",
"-",
"reflect",
".",
"set"
] | fe7c8511a6d27d03a9b8e075b3351416aae95c58 | https://github.com/zloirock/core-js/blob/fe7c8511a6d27d03a9b8e075b3351416aae95c58/packages/core-js/modules/es.reflect.set.js#L11-L31 | train | Sets a property on an object. | [
30522,
3853,
2275,
1006,
4539,
1010,
3200,
14839,
1010,
1058,
1013,
1008,
1010,
8393,
1008,
1013,
1007,
1063,
13075,
8393,
1027,
9918,
1012,
3091,
1026,
1018,
1029,
4539,
1024,
9918,
1031,
1017,
1033,
1025,
13075,
2219,
6155,
23235,
2953,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
mochajs/mocha | lib/reporters/tap.js | TAP | function TAP(runner, options) {
Base.call(this, runner, options);
var self = this;
var n = 1;
var tapVersion = '12';
if (options && options.reporterOptions) {
if (options.reporterOptions.tapVersion) {
tapVersion = options.reporterOptions.tapVersion.toString();
}
}
this._producer = createProducer(tapVersion);
runner.once(EVENT_RUN_BEGIN, function() {
var ntests = runner.grepTotal(runner.suite);
self._producer.writeVersion();
self._producer.writePlan(ntests);
});
runner.on(EVENT_TEST_END, function() {
++n;
});
runner.on(EVENT_TEST_PENDING, function(test) {
self._producer.writePending(n, test);
});
runner.on(EVENT_TEST_PASS, function(test) {
self._producer.writePass(n, test);
});
runner.on(EVENT_TEST_FAIL, function(test, err) {
self._producer.writeFail(n, test, err);
});
runner.once(EVENT_RUN_END, function() {
self._producer.writeEpilogue(runner.stats);
});
} | javascript | function TAP(runner, options) {
Base.call(this, runner, options);
var self = this;
var n = 1;
var tapVersion = '12';
if (options && options.reporterOptions) {
if (options.reporterOptions.tapVersion) {
tapVersion = options.reporterOptions.tapVersion.toString();
}
}
this._producer = createProducer(tapVersion);
runner.once(EVENT_RUN_BEGIN, function() {
var ntests = runner.grepTotal(runner.suite);
self._producer.writeVersion();
self._producer.writePlan(ntests);
});
runner.on(EVENT_TEST_END, function() {
++n;
});
runner.on(EVENT_TEST_PENDING, function(test) {
self._producer.writePending(n, test);
});
runner.on(EVENT_TEST_PASS, function(test) {
self._producer.writePass(n, test);
});
runner.on(EVENT_TEST_FAIL, function(test, err) {
self._producer.writeFail(n, test, err);
});
runner.once(EVENT_RUN_END, function() {
self._producer.writeEpilogue(runner.stats);
});
} | [
"function",
"TAP",
"(",
"runner",
",",
"options",
")",
"{",
"Base",
".",
"call",
"(",
"this",
",",
"runner",
",",
"options",
")",
";",
"var",
"self",
"=",
"this",
";",
"var",
"n",
"=",
"1",
";",
"var",
"tapVersion",
"=",
"'12'",
";",
"if",
"(",
... | Constructs a new `TAP` 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",
"TAP",
"reporter",
"instance",
"."
] | 9b00fedb610241e33f7592c40164e42a38a793cf | https://github.com/mochajs/mocha/blob/9b00fedb610241e33f7592c40164e42a38a793cf/lib/reporters/tap.js#L37-L77 | train | A TAP reporter. | [
30522,
3853,
11112,
1006,
5479,
1010,
7047,
1007,
1063,
2918,
1012,
2655,
1006,
2023,
1010,
5479,
1010,
7047,
1007,
1025,
13075,
2969,
1027,
2023,
1025,
13075,
1050,
1027,
1015,
1025,
13075,
11112,
27774,
1027,
1005,
2260,
1005,
1025,
2065,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Dogfalo/materialize | extras/noUiSlider/nouislider.js | handleEntryPoint | function handleEntryPoint ( index, value, that ) {
var percentage;
// Wrap numerical input in an array.
if ( typeof value === "number" ) {
value = [value];
}
// Reject any invalid input, by testing whether value is an array.
if ( Object.prototype.toString.call( value ) !== '[object Array]' ){
throw new Error("noUiSlider: 'range' contains invalid value.");
}
// Covert min/max syntax to 0 and 100.
if ( index === 'min' ) {
percentage = 0;
} else if ( index === 'max' ) {
percentage = 100;
} else {
percentage = parseFloat( index );
}
// Check for correct input.
if ( !isNumeric( percentage ) || !isNumeric( value[0] ) ) {
throw new Error("noUiSlider: 'range' value isn't numeric.");
}
// Store values.
that.xPct.push( percentage );
that.xVal.push( value[0] );
// NaN will evaluate to false too, but to keep
// logging clear, set step explicitly. Make sure
// not to override the 'step' setting with false.
if ( !percentage ) {
if ( !isNaN( value[1] ) ) {
that.xSteps[0] = value[1];
}
} else {
that.xSteps.push( isNaN(value[1]) ? false : value[1] );
}
that.xHighestCompleteStep.push(0);
} | javascript | function handleEntryPoint ( index, value, that ) {
var percentage;
// Wrap numerical input in an array.
if ( typeof value === "number" ) {
value = [value];
}
// Reject any invalid input, by testing whether value is an array.
if ( Object.prototype.toString.call( value ) !== '[object Array]' ){
throw new Error("noUiSlider: 'range' contains invalid value.");
}
// Covert min/max syntax to 0 and 100.
if ( index === 'min' ) {
percentage = 0;
} else if ( index === 'max' ) {
percentage = 100;
} else {
percentage = parseFloat( index );
}
// Check for correct input.
if ( !isNumeric( percentage ) || !isNumeric( value[0] ) ) {
throw new Error("noUiSlider: 'range' value isn't numeric.");
}
// Store values.
that.xPct.push( percentage );
that.xVal.push( value[0] );
// NaN will evaluate to false too, but to keep
// logging clear, set step explicitly. Make sure
// not to override the 'step' setting with false.
if ( !percentage ) {
if ( !isNaN( value[1] ) ) {
that.xSteps[0] = value[1];
}
} else {
that.xSteps.push( isNaN(value[1]) ? false : value[1] );
}
that.xHighestCompleteStep.push(0);
} | [
"function",
"handleEntryPoint",
"(",
"index",
",",
"value",
",",
"that",
")",
"{",
"var",
"percentage",
";",
"// Wrap numerical input in an array.",
"if",
"(",
"typeof",
"value",
"===",
"\"number\"",
")",
"{",
"value",
"=",
"[",
"value",
"]",
";",
"}",
"// R... | Entry parsing | [
"Entry",
"parsing"
] | 1122efadad8f1433d404696f7613e3cc13fb83a4 | https://github.com/Dogfalo/materialize/blob/1122efadad8f1433d404696f7613e3cc13fb83a4/extras/noUiSlider/nouislider.js#L278-L322 | train | Handle an entry point. | [
30522,
3853,
5047,
4765,
2854,
8400,
1006,
5950,
1010,
3643,
1010,
2008,
1007,
1063,
13075,
7017,
1025,
1013,
1013,
10236,
15973,
7953,
1999,
2019,
9140,
1012,
2065,
1006,
2828,
11253,
3643,
1027,
1027,
1027,
1000,
2193,
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... |
Microsoft/BotFramework-WebChat | packages/component/src/Attachment/VideoContent.js | parseURL | function parseURL(url) {
let urlLike;
if (typeof URL === 'function') {
urlLike = new URL(url);
} else {
urlLike = document.createElement('a');
urlLike.setAttribute('href', url);
}
const { hostname, pathname, search } = urlLike;
return { hostname, pathname, search };
} | javascript | function parseURL(url) {
let urlLike;
if (typeof URL === 'function') {
urlLike = new URL(url);
} else {
urlLike = document.createElement('a');
urlLike.setAttribute('href', url);
}
const { hostname, pathname, search } = urlLike;
return { hostname, pathname, search };
} | [
"function",
"parseURL",
"(",
"url",
")",
"{",
"let",
"urlLike",
";",
"if",
"(",
"typeof",
"URL",
"===",
"'function'",
")",
"{",
"urlLike",
"=",
"new",
"URL",
"(",
"url",
")",
";",
"}",
"else",
"{",
"urlLike",
"=",
"document",
".",
"createElement",
"(... | This is a workaround - Today, there is no good URL polyfill for older browser - Instead of writing a URL parser, for older browser, we will use this <a href> trick to parse the URL | [
"This",
"is",
"a",
"workaround",
"-",
"Today",
"there",
"is",
"no",
"good",
"URL",
"polyfill",
"for",
"older",
"browser",
"-",
"Instead",
"of",
"writing",
"a",
"URL",
"parser",
"for",
"older",
"browser",
"we",
"will",
"use",
"this",
"<a",
"href",
">",
... | 8bc934d3d07d1ca901d52b5e3a9481fddcdbd91e | https://github.com/Microsoft/BotFramework-WebChat/blob/8bc934d3d07d1ca901d52b5e3a9481fddcdbd91e/packages/component/src/Attachment/VideoContent.js#L17-L30 | train | Parse a URL | [
30522,
3853,
11968,
3366,
3126,
2140,
1006,
24471,
2140,
1007,
1063,
2292,
24471,
6894,
3489,
1025,
2065,
1006,
2828,
11253,
24471,
2140,
1027,
1027,
1027,
1005,
3853,
1005,
1007,
1063,
24471,
6894,
3489,
1027,
2047,
24471,
2140,
1006,
2447... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
facebook/relay | packages/relay-compiler/transforms/RelayRelayDirectiveTransform.js | relayRelayDirectiveTransform | function relayRelayDirectiveTransform(
context: CompilerContext,
): CompilerContext {
return IRTransformer.transform(context, {
Fragment: visitRelayMetadata(fragmentMetadata),
FragmentSpread: visitRelayMetadata(fragmentSpreadMetadata),
});
} | javascript | function relayRelayDirectiveTransform(
context: CompilerContext,
): CompilerContext {
return IRTransformer.transform(context, {
Fragment: visitRelayMetadata(fragmentMetadata),
FragmentSpread: visitRelayMetadata(fragmentSpreadMetadata),
});
} | [
"function",
"relayRelayDirectiveTransform",
"(",
"context",
":",
"CompilerContext",
",",
")",
":",
"CompilerContext",
"{",
"return",
"IRTransformer",
".",
"transform",
"(",
"context",
",",
"{",
"Fragment",
":",
"visitRelayMetadata",
"(",
"fragmentMetadata",
")",
","... | A transform that extracts `@relay(plural: Boolean)` directives and converts
them to metadata that can be accessed at runtime. | [
"A",
"transform",
"that",
"extracts"
] | 7fb9be5182b9650637d7b92ead9a42713ac30aa4 | https://github.com/facebook/relay/blob/7fb9be5182b9650637d7b92ead9a42713ac30aa4/packages/relay-compiler/transforms/RelayRelayDirectiveTransform.js#L47-L54 | train | Transform a relay directive | [
30522,
3853,
8846,
16570,
4710,
4305,
2890,
15277,
6494,
3619,
14192,
1006,
6123,
1024,
21624,
8663,
18209,
1010,
1007,
1024,
21624,
8663,
18209,
1063,
2709,
20868,
6494,
3619,
14192,
2121,
1012,
10938,
1006,
6123,
1010,
1063,
15778,
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... |
moment/luxon | src/datetime.js | adjustTime | function adjustTime(inst, dur) {
const oPre = inst.o,
year = inst.c.year + dur.years,
month = inst.c.month + dur.months + dur.quarters * 3,
c = Object.assign({}, inst.c, {
year,
month,
day: Math.min(inst.c.day, daysInMonth(year, month)) + dur.days + dur.weeks * 7
}),
millisToAdd = Duration.fromObject({
hours: dur.hours,
minutes: dur.minutes,
seconds: dur.seconds,
milliseconds: dur.milliseconds
}).as("milliseconds"),
localTS = objToLocalTS(c);
let [ts, o] = fixOffset(localTS, oPre, inst.zone);
if (millisToAdd !== 0) {
ts += millisToAdd;
// that could have changed the offset by going over a DST, but we want to keep the ts the same
o = inst.zone.offset(ts);
}
return { ts, o };
} | javascript | function adjustTime(inst, dur) {
const oPre = inst.o,
year = inst.c.year + dur.years,
month = inst.c.month + dur.months + dur.quarters * 3,
c = Object.assign({}, inst.c, {
year,
month,
day: Math.min(inst.c.day, daysInMonth(year, month)) + dur.days + dur.weeks * 7
}),
millisToAdd = Duration.fromObject({
hours: dur.hours,
minutes: dur.minutes,
seconds: dur.seconds,
milliseconds: dur.milliseconds
}).as("milliseconds"),
localTS = objToLocalTS(c);
let [ts, o] = fixOffset(localTS, oPre, inst.zone);
if (millisToAdd !== 0) {
ts += millisToAdd;
// that could have changed the offset by going over a DST, but we want to keep the ts the same
o = inst.zone.offset(ts);
}
return { ts, o };
} | [
"function",
"adjustTime",
"(",
"inst",
",",
"dur",
")",
"{",
"const",
"oPre",
"=",
"inst",
".",
"o",
",",
"year",
"=",
"inst",
".",
"c",
".",
"year",
"+",
"dur",
".",
"years",
",",
"month",
"=",
"inst",
".",
"c",
".",
"month",
"+",
"dur",
".",
... | create a new DT instance by adding a duration, adjusting for DSTs | [
"create",
"a",
"new",
"DT",
"instance",
"by",
"adding",
"a",
"duration",
"adjusting",
"for",
"DSTs"
] | 236f2badea297ee73421aa39a83e06177c1be6d0 | https://github.com/moment/luxon/blob/236f2badea297ee73421aa39a83e06177c1be6d0/src/datetime.js#L123-L149 | train | Adjusts the time of an instance to match the given time duration | [
30522,
3853,
14171,
7292,
1006,
16021,
2102,
1010,
4241,
2099,
1007,
1063,
9530,
3367,
6728,
2890,
1027,
16021,
2102,
1012,
1051,
1010,
2095,
1027,
16021,
2102,
1012,
1039,
1012,
2095,
1009,
4241,
2099,
1012,
2086,
1010,
3204,
1027,
16021,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
fex-team/webuploader | src/widgets/md5.js | function( file, start, end ) {
var md5 = new Md5(),
deferred = Base.Deferred(),
blob = (file instanceof Blob) ? file :
this.request( 'get-file', file ).source;
md5.on( 'progress load', function( e ) {
e = e || {};
deferred.notify( e.total ? e.loaded / e.total : 1 );
});
md5.on( 'complete', function() {
deferred.resolve( md5.getResult() );
});
md5.on( 'error', function( reason ) {
deferred.reject( reason );
});
if ( arguments.length > 1 ) {
start = start || 0;
end = end || 0;
start < 0 && (start = blob.size + start);
end < 0 && (end = blob.size + end);
end = Math.min( end, blob.size );
blob = blob.slice( start, end );
}
md5.loadFromBlob( blob );
return deferred.promise();
} | javascript | function( file, start, end ) {
var md5 = new Md5(),
deferred = Base.Deferred(),
blob = (file instanceof Blob) ? file :
this.request( 'get-file', file ).source;
md5.on( 'progress load', function( e ) {
e = e || {};
deferred.notify( e.total ? e.loaded / e.total : 1 );
});
md5.on( 'complete', function() {
deferred.resolve( md5.getResult() );
});
md5.on( 'error', function( reason ) {
deferred.reject( reason );
});
if ( arguments.length > 1 ) {
start = start || 0;
end = end || 0;
start < 0 && (start = blob.size + start);
end < 0 && (end = blob.size + end);
end = Math.min( end, blob.size );
blob = blob.slice( start, end );
}
md5.loadFromBlob( blob );
return deferred.promise();
} | [
"function",
"(",
"file",
",",
"start",
",",
"end",
")",
"{",
"var",
"md5",
"=",
"new",
"Md5",
"(",
")",
",",
"deferred",
"=",
"Base",
".",
"Deferred",
"(",
")",
",",
"blob",
"=",
"(",
"file",
"instanceof",
"Blob",
")",
"?",
"file",
":",
"this",
... | 计算文件 md5 值,返回一个 promise 对象,可以监听 progress 进度。
@method md5File
@grammar md5File( file[, start[, end]] ) => promise
@for Uploader
@example
uploader.on( 'fileQueued', function( file ) {
var $li = ...;
uploader.md5File( file )
// 及时显示进度
.progress(function(percentage) {
console.log('Percentage:', percentage);
})
// 完成
.then(function(val) {
console.log('md5 result:', val);
});
}); | [
"计算文件",
"md5",
"值,返回一个",
"promise",
"对象,可以监听",
"progress",
"进度。"
] | 7094e4476c5af3b06993d91dde2d223200b9feb7 | https://github.com/fex-team/webuploader/blob/7094e4476c5af3b06993d91dde2d223200b9feb7/src/widgets/md5.js#L42-L73 | train | Get the content of a file | [
30522,
3853,
1006,
5371,
1010,
2707,
1010,
2203,
1007,
1063,
13075,
9108,
2629,
1027,
2047,
9108,
2629,
1006,
1007,
1010,
13366,
28849,
2094,
1027,
2918,
1012,
13366,
28849,
2094,
1006,
1007,
1010,
1038,
4135,
2497,
1027,
1006,
5371,
6013,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/tap.js | println | function println(format, varArgs) {
var vargs = Array.from(arguments);
vargs[0] += '\n';
process.stdout.write(sprintf.apply(null, vargs));
} | javascript | function println(format, varArgs) {
var vargs = Array.from(arguments);
vargs[0] += '\n';
process.stdout.write(sprintf.apply(null, vargs));
} | [
"function",
"println",
"(",
"format",
",",
"varArgs",
")",
"{",
"var",
"vargs",
"=",
"Array",
".",
"from",
"(",
"arguments",
")",
";",
"vargs",
"[",
"0",
"]",
"+=",
"'\\n'",
";",
"process",
".",
"stdout",
".",
"write",
"(",
"sprintf",
".",
"apply",
... | Writes newline-terminated formatted string to reporter output stream.
@private
@param {string} format - `printf`-like format string
@param {...*} [varArgs] - Format string arguments | [
"Writes",
"newline",
"-",
"terminated",
"formatted",
"string",
"to",
"reporter",
"output",
"stream",
"."
] | 9b00fedb610241e33f7592c40164e42a38a793cf | https://github.com/mochajs/mocha/blob/9b00fedb610241e33f7592c40164e42a38a793cf/lib/reporters/tap.js#L102-L106 | train | Print a string to the console. | [
30522,
3853,
6140,
19666,
1006,
4289,
1010,
13075,
2906,
5620,
1007,
1063,
13075,
13075,
5620,
1027,
9140,
1012,
2013,
1006,
9918,
1007,
1025,
13075,
5620,
1031,
1014,
1033,
1009,
1027,
1005,
1032,
1050,
1005,
1025,
2832,
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,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/icon/js/iconService.js | function(err) {
var msg = angular.isString(err) ? err : (err.message || err.data || err.statusText);
$log.warn(msg);
reject(err);
} | javascript | function(err) {
var msg = angular.isString(err) ? err : (err.message || err.data || err.statusText);
$log.warn(msg);
reject(err);
} | [
"function",
"(",
"err",
")",
"{",
"var",
"msg",
"=",
"angular",
".",
"isString",
"(",
"err",
")",
"?",
"err",
":",
"(",
"err",
".",
"message",
"||",
"err",
".",
"data",
"||",
"err",
".",
"statusText",
")",
";",
"$log",
".",
"warn",
"(",
"msg",
... | Catch HTTP or generic errors not related to incorrect icon IDs. | [
"Catch",
"HTTP",
"or",
"generic",
"errors",
"not",
"related",
"to",
"incorrect",
"icon",
"IDs",
"."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/icon/js/iconService.js#L642-L646 | train | reject the promise | [
30522,
3853,
1006,
9413,
2099,
1007,
1063,
13075,
5796,
2290,
1027,
16108,
1012,
26354,
18886,
3070,
1006,
9413,
2099,
1007,
1029,
9413,
2099,
1024,
1006,
9413,
2099,
1012,
4471,
1064,
1064,
9413,
2099,
1012,
2951,
1064,
1064,
9413,
2099,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/max-lines-per-function.js | isEmbedded | function isEmbedded(node) {
if (!node.parent) {
return false;
}
if (node !== node.parent.value) {
return false;
}
if (node.parent.type === "MethodDefinition") {
return true;
}
if (node.parent.type === "Property") {
return node.parent.method === true || node.parent.kind === "get" || node.parent.kind === "set";
}
return false;
} | javascript | function isEmbedded(node) {
if (!node.parent) {
return false;
}
if (node !== node.parent.value) {
return false;
}
if (node.parent.type === "MethodDefinition") {
return true;
}
if (node.parent.type === "Property") {
return node.parent.method === true || node.parent.kind === "get" || node.parent.kind === "set";
}
return false;
} | [
"function",
"isEmbedded",
"(",
"node",
")",
"{",
"if",
"(",
"!",
"node",
".",
"parent",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"node",
"!==",
"node",
".",
"parent",
".",
"value",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"node"... | Identifies is a node is a FunctionExpression which is embedded within a MethodDefinition or Property
@param {ASTNode} node Node to test
@returns {boolean} True if it's a FunctionExpression embedded within a MethodDefinition or Property | [
"Identifies",
"is",
"a",
"node",
"is",
"a",
"FunctionExpression",
"which",
"is",
"embedded",
"within",
"a",
"MethodDefinition",
"or",
"Property"
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/max-lines-per-function.js#L146-L160 | train | returns true if node is embedded | [
30522,
3853,
2003,
6633,
8270,
5732,
1006,
13045,
1007,
1063,
2065,
1006,
999,
13045,
1012,
6687,
1007,
1063,
2709,
6270,
1025,
1065,
2065,
1006,
13045,
999,
1027,
1027,
13045,
1012,
6687,
1012,
3643,
1007,
1063,
2709,
6270,
1025,
1065,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.m/src/sap/m/GrowingEnablement.js | function(aContexts, oModel) {
if (!aContexts.length) {
return;
}
var aItems = this._oControl.getItems(true);
for (var i = 0, c = 0, oItem; i < aItems.length; i++) {
oItem = aItems[i];
// group headers are not in binding context
if (!oItem.isGroupHeader()) {
oItem.setBindingContext(aContexts[c++], oModel);
}
}
} | javascript | function(aContexts, oModel) {
if (!aContexts.length) {
return;
}
var aItems = this._oControl.getItems(true);
for (var i = 0, c = 0, oItem; i < aItems.length; i++) {
oItem = aItems[i];
// group headers are not in binding context
if (!oItem.isGroupHeader()) {
oItem.setBindingContext(aContexts[c++], oModel);
}
}
} | [
"function",
"(",
"aContexts",
",",
"oModel",
")",
"{",
"if",
"(",
"!",
"aContexts",
".",
"length",
")",
"{",
"return",
";",
"}",
"var",
"aItems",
"=",
"this",
".",
"_oControl",
".",
"getItems",
"(",
"true",
")",
";",
"for",
"(",
"var",
"i",
"=",
... | update context on all items except group headers | [
"update",
"context",
"on",
"all",
"items",
"except",
"group",
"headers"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/GrowingEnablement.js#L368-L382 | train | Sets the binding context of the items in the control | [
30522,
3853,
1006,
9353,
28040,
18413,
2015,
1010,
18168,
10244,
2140,
1007,
1063,
2065,
1006,
999,
9353,
28040,
18413,
2015,
1012,
3091,
1007,
1063,
2709,
1025,
1065,
13075,
9932,
18532,
2015,
1027,
2023,
1012,
1035,
1051,
8663,
13181,
214... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/blanket.js | function(numSt, numCov, numBranch, numCovBr, moduleName) {
var totalPercent = percentage(numCov, numSt);
var statusClass = totalPercent < successRate ? "bl-error" : "bl-success";
var rowTitle = ( moduleName ? "Total for module: " + moduleName : "Global total" );
var totalsOutput = grandTotalTemplate.replace("{{rowTitle}}", rowTitle)
.replace("{{percentage}}", totalPercent)
.replace("{{numberCovered}}", numCov)
.replace("{{totalSmts}}", numSt)
.replace("{{passedBranches}}", numCovBr)
.replace("{{totalBranches}}", numBranch)
.replace("{{statusclass}}", statusClass);
bodyContent += totalsOutput;
} | javascript | function(numSt, numCov, numBranch, numCovBr, moduleName) {
var totalPercent = percentage(numCov, numSt);
var statusClass = totalPercent < successRate ? "bl-error" : "bl-success";
var rowTitle = ( moduleName ? "Total for module: " + moduleName : "Global total" );
var totalsOutput = grandTotalTemplate.replace("{{rowTitle}}", rowTitle)
.replace("{{percentage}}", totalPercent)
.replace("{{numberCovered}}", numCov)
.replace("{{totalSmts}}", numSt)
.replace("{{passedBranches}}", numCovBr)
.replace("{{totalBranches}}", numBranch)
.replace("{{statusclass}}", statusClass);
bodyContent += totalsOutput;
} | [
"function",
"(",
"numSt",
",",
"numCov",
",",
"numBranch",
",",
"numCovBr",
",",
"moduleName",
")",
"{",
"var",
"totalPercent",
"=",
"percentage",
"(",
"numCov",
",",
"numSt",
")",
";",
"var",
"statusClass",
"=",
"totalPercent",
"<",
"successRate",
"?",
"\... | create temporary function for use by the global totals reporter, as well as the per-module totals reporter | [
"create",
"temporary",
"function",
"for",
"use",
"by",
"the",
"global",
"totals",
"reporter",
"as",
"well",
"as",
"the",
"per",
"-",
"module",
"totals",
"reporter"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/blanket.js#L4765-L4779 | train | Add totals to the body | [
30522,
3853,
1006,
16371,
5244,
2102,
1010,
16371,
12458,
4492,
1010,
15903,
5521,
2818,
1010,
16371,
12458,
4492,
19892,
1010,
11336,
18442,
1007,
1063,
13075,
2561,
4842,
13013,
1027,
7017,
1006,
16371,
12458,
4492,
1010,
16371,
5244,
2102,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
adobe/brackets | src/editor/MultiRangeInlineEditor.js | SearchResultItem | function SearchResultItem(rangeResult) {
this.name = rangeResult.name;
this.textRange = new TextRange(rangeResult.document, rangeResult.lineStart, rangeResult.lineEnd);
// this.$listItem is assigned in load()
} | javascript | function SearchResultItem(rangeResult) {
this.name = rangeResult.name;
this.textRange = new TextRange(rangeResult.document, rangeResult.lineStart, rangeResult.lineEnd);
// this.$listItem is assigned in load()
} | [
"function",
"SearchResultItem",
"(",
"rangeResult",
")",
"{",
"this",
".",
"name",
"=",
"rangeResult",
".",
"name",
";",
"this",
".",
"textRange",
"=",
"new",
"TextRange",
"(",
"rangeResult",
".",
"document",
",",
"rangeResult",
".",
"lineStart",
",",
"range... | Stores one search result: its source file, line range, etc. plus the DOM node representing it
in the results list.
@constructor | [
"Stores",
"one",
"search",
"result",
":",
"its",
"source",
"file",
"line",
"range",
"etc",
".",
"plus",
"the",
"DOM",
"node",
"representing",
"it",
"in",
"the",
"results",
"list",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/editor/MultiRangeInlineEditor.js#L75-L79 | train | The SearchResultItem class | [
30522,
3853,
3945,
6072,
11314,
4221,
2213,
1006,
11505,
2229,
11314,
1007,
1063,
2023,
1012,
2171,
1027,
11505,
2229,
11314,
1012,
2171,
1025,
2023,
1012,
3793,
24388,
2063,
1027,
2047,
3793,
24388,
2063,
1006,
11505,
2229,
11314,
1012,
62... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
eslint/eslint | lib/rules/prefer-const.js | getDestructuringHost | function getDestructuringHost(reference) {
if (!reference.isWrite()) {
return null;
}
let node = reference.identifier.parent;
while (PATTERN_TYPE.test(node.type)) {
node = node.parent;
}
if (!DESTRUCTURING_HOST_TYPE.test(node.type)) {
return null;
}
return node;
} | javascript | function getDestructuringHost(reference) {
if (!reference.isWrite()) {
return null;
}
let node = reference.identifier.parent;
while (PATTERN_TYPE.test(node.type)) {
node = node.parent;
}
if (!DESTRUCTURING_HOST_TYPE.test(node.type)) {
return null;
}
return node;
} | [
"function",
"getDestructuringHost",
"(",
"reference",
")",
"{",
"if",
"(",
"!",
"reference",
".",
"isWrite",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"let",
"node",
"=",
"reference",
".",
"identifier",
".",
"parent",
";",
"while",
"(",
"PATTERN_TY... | Gets the VariableDeclarator/AssignmentExpression node that a given reference
belongs to.
This is used to detect a mix of reassigned and never reassigned in a
destructuring.
@param {eslint-scope.Reference} reference - A reference to get.
@returns {ASTNode|null} A VariableDeclarator/AssignmentExpression node or
null. | [
"Gets",
"the",
"VariableDeclarator",
"/",
"AssignmentExpression",
"node",
"that",
"a",
"given",
"reference",
"belongs",
"to",
".",
"This",
"is",
"used",
"to",
"detect",
"a",
"mix",
"of",
"reassigned",
"and",
"never",
"reassigned",
"in",
"a",
"destructuring",
"... | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/prefer-const.js#L84-L98 | train | Returns the declaration host node of the given reference | [
30522,
3853,
2131,
6155,
18300,
12228,
15006,
2102,
1006,
4431,
1007,
1063,
2065,
1006,
999,
4431,
1012,
2003,
26373,
1006,
1007,
1007,
1063,
2709,
19701,
1025,
1065,
2292,
13045,
1027,
4431,
1012,
8909,
4765,
18095,
1012,
6687,
1025,
2096,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
vuejs/vue-devtools | src/backend/index.js | bindToConsole | function bindToConsole (instance) {
if (!instance) return
if (!isBrowser) return
const id = instance.__VUE_DEVTOOLS_UID__
const index = consoleBoundInstances.indexOf(id)
if (index > -1) {
consoleBoundInstances.splice(index, 1)
} else {
consoleBoundInstances.pop()
}
consoleBoundInstances.unshift(id)
for (var i = 0; i < 5; i++) {
window['$vm' + i] = instanceMap.get(consoleBoundInstances[i])
}
window.$vm = instance
} | javascript | function bindToConsole (instance) {
if (!instance) return
if (!isBrowser) return
const id = instance.__VUE_DEVTOOLS_UID__
const index = consoleBoundInstances.indexOf(id)
if (index > -1) {
consoleBoundInstances.splice(index, 1)
} else {
consoleBoundInstances.pop()
}
consoleBoundInstances.unshift(id)
for (var i = 0; i < 5; i++) {
window['$vm' + i] = instanceMap.get(consoleBoundInstances[i])
}
window.$vm = instance
} | [
"function",
"bindToConsole",
"(",
"instance",
")",
"{",
"if",
"(",
"!",
"instance",
")",
"return",
"if",
"(",
"!",
"isBrowser",
")",
"return",
"const",
"id",
"=",
"instance",
".",
"__VUE_DEVTOOLS_UID__",
"const",
"index",
"=",
"consoleBoundInstances",
".",
"... | Binds given instance in console as $vm0.
For compatibility reasons it also binds it as $vm.
@param {Vue} instance | [
"Binds",
"given",
"instance",
"in",
"console",
"as",
"$vm0",
".",
"For",
"compatibility",
"reasons",
"it",
"also",
"binds",
"it",
"as",
"$vm",
"."
] | 4de4b86388453cd07f0c1bf967d43a4dd4b011c9 | https://github.com/vuejs/vue-devtools/blob/4de4b86388453cd07f0c1bf967d43a4dd4b011c9/src/backend/index.js#L900-L917 | train | Bind to console | [
30522,
3853,
14187,
3406,
8663,
19454,
2063,
1006,
6013,
1007,
1063,
2065,
1006,
999,
6013,
1007,
2709,
2065,
1006,
999,
2003,
12618,
9333,
2121,
1007,
2709,
9530,
3367,
8909,
1027,
6013,
1012,
1035,
1035,
24728,
2063,
1035,
16475,
3406,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/ui5/template/publish.js | summarize | function summarize(desc) {
if ( desc != null ) {
desc = String(desc).replace(/\s+/g, ' ').
replace(/"'/g, '"').
replace(/^(<\/?p>|<br\/?>|\s)+/, '');
var match = /([\w\W]+?\.)[^a-z0-9_$]/i.exec(desc);
return match ? match[1] : desc;
}
} | javascript | function summarize(desc) {
if ( desc != null ) {
desc = String(desc).replace(/\s+/g, ' ').
replace(/"'/g, '"').
replace(/^(<\/?p>|<br\/?>|\s)+/, '');
var match = /([\w\W]+?\.)[^a-z0-9_$]/i.exec(desc);
return match ? match[1] : desc;
}
} | [
"function",
"summarize",
"(",
"desc",
")",
"{",
"if",
"(",
"desc",
"!=",
"null",
")",
"{",
"desc",
"=",
"String",
"(",
"desc",
")",
".",
"replace",
"(",
"/",
"\\s+",
"/",
"g",
",",
"' '",
")",
".",
"replace",
"(",
"/",
"\"'",
"/",
"g",
",",
"... | /*
function isNonEmptyNamespace($) {
return $.isNamespace && (
($.properties && $.properties.length > 0) ||
($.methods && $.methods.length > 0) ||
($.augments && $.augments.length > 0) ||
($.children && $.children.length > 0));
}; /* Just the first sentence (up to a full stop). Should not break on dotted variable names. | [
"/",
"*",
"function",
"isNonEmptyNamespace",
"(",
"$",
")",
"{",
"return",
"$",
".",
"isNamespace",
"&&",
"(",
"(",
"$",
".",
"properties",
"&&",
"$",
".",
"properties",
".",
"length",
">",
"0",
")",
"||",
"(",
"$",
".",
"methods",
"&&",
"$",
".",
... | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/lib/jsdoc/ui5/template/publish.js#L1185-L1194 | train | summarize the description of a node | [
30522,
3853,
7680,
7849,
4697,
1006,
4078,
2278,
1007,
1063,
2065,
1006,
4078,
2278,
999,
1027,
19701,
1007,
1063,
4078,
2278,
1027,
5164,
1006,
4078,
2278,
1007,
1012,
5672,
1006,
1013,
1032,
1055,
1009,
1013,
1043,
1010,
1005,
1005,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
eslint/eslint | lib/rules/new-cap.js | extractNameFromExpression | function extractNameFromExpression(node) {
let name = "";
if (node.callee.type === "MemberExpression") {
const property = node.callee.property;
if (property.type === "Literal" && (typeof property.value === "string")) {
name = property.value;
} else if (property.type === "Identifier" && !node.callee.computed) {
name = property.name;
}
} else {
name = node.callee.name;
}
return name;
} | javascript | function extractNameFromExpression(node) {
let name = "";
if (node.callee.type === "MemberExpression") {
const property = node.callee.property;
if (property.type === "Literal" && (typeof property.value === "string")) {
name = property.value;
} else if (property.type === "Identifier" && !node.callee.computed) {
name = property.name;
}
} else {
name = node.callee.name;
}
return name;
} | [
"function",
"extractNameFromExpression",
"(",
"node",
")",
"{",
"let",
"name",
"=",
"\"\"",
";",
"if",
"(",
"node",
".",
"callee",
".",
"type",
"===",
"\"MemberExpression\"",
")",
"{",
"const",
"property",
"=",
"node",
".",
"callee",
".",
"property",
";",
... | -------------------------------------------------------------------------- Helpers --------------------------------------------------------------------------
Get exact callee name from expression
@param {ASTNode} node CallExpression or NewExpression node
@returns {string} name | [
"--------------------------------------------------------------------------",
"Helpers",
"--------------------------------------------------------------------------",
"Get",
"exact",
"callee",
"name",
"from",
"expression"
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/new-cap.js#L157-L173 | train | Extract the name from a MemberExpression | [
30522,
3853,
14817,
18442,
19699,
8462,
2595,
20110,
3258,
1006,
13045,
1007,
1063,
2292,
2171,
1027,
1000,
1000,
1025,
2065,
1006,
13045,
1012,
2655,
4402,
1012,
2828,
1027,
1027,
1027,
1000,
2266,
10288,
20110,
3258,
1000,
1007,
1063,
953... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
ColorlibHQ/AdminLTE | bower_components/ion.rangeSlider/js/ion.rangeSlider.js | function (target, e) {
e.preventDefault();
var x = e.pageX || e.originalEvent.touches && e.originalEvent.touches[0].pageX;
if (e.button === 2) {
return;
}
this.current_plugin = this.plugin_count;
this.target = target;
this.is_click = true;
this.coords.x_gap = this.$cache.rs.offset().left;
this.coords.x_pointer = +(x - this.coords.x_gap).toFixed();
this.force_redraw = true;
this.calc();
this.$cache.line.trigger("focus");
} | javascript | function (target, e) {
e.preventDefault();
var x = e.pageX || e.originalEvent.touches && e.originalEvent.touches[0].pageX;
if (e.button === 2) {
return;
}
this.current_plugin = this.plugin_count;
this.target = target;
this.is_click = true;
this.coords.x_gap = this.$cache.rs.offset().left;
this.coords.x_pointer = +(x - this.coords.x_gap).toFixed();
this.force_redraw = true;
this.calc();
this.$cache.line.trigger("focus");
} | [
"function",
"(",
"target",
",",
"e",
")",
"{",
"e",
".",
"preventDefault",
"(",
")",
";",
"var",
"x",
"=",
"e",
".",
"pageX",
"||",
"e",
".",
"originalEvent",
".",
"touches",
"&&",
"e",
".",
"originalEvent",
".",
"touches",
"[",
"0",
"]",
".",
"p... | Mousedown or touchstart
for other slider elements, like diapason line
@param target {String}
@param e {Object} event object | [
"Mousedown",
"or",
"touchstart",
"for",
"other",
"slider",
"elements",
"like",
"diapason",
"line"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/bower_components/ion.rangeSlider/js/ion.rangeSlider.js#L863-L881 | train | ontouchstart event | [
30522,
3853,
1006,
4539,
1010,
1041,
1007,
1063,
1041,
1012,
4652,
3207,
7011,
11314,
1006,
1007,
1025,
13075,
1060,
1027,
1041,
1012,
3931,
2595,
1064,
1064,
1041,
1012,
2434,
18697,
3372,
1012,
12817,
1004,
1004,
1041,
1012,
2434,
18697,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/api/menu-utils.js | sortTopologically | function sortTopologically (originalOrder, edgesById) {
const sorted = []
const marked = new Set()
const visit = (mark) => {
if (marked.has(mark)) return
marked.add(mark)
const edges = edgesById.get(mark)
if (edges != null) {
edges.forEach(visit)
}
sorted.push(mark)
}
originalOrder.forEach(visit)
return sorted
} | javascript | function sortTopologically (originalOrder, edgesById) {
const sorted = []
const marked = new Set()
const visit = (mark) => {
if (marked.has(mark)) return
marked.add(mark)
const edges = edgesById.get(mark)
if (edges != null) {
edges.forEach(visit)
}
sorted.push(mark)
}
originalOrder.forEach(visit)
return sorted
} | [
"function",
"sortTopologically",
"(",
"originalOrder",
",",
"edgesById",
")",
"{",
"const",
"sorted",
"=",
"[",
"]",
"const",
"marked",
"=",
"new",
"Set",
"(",
")",
"const",
"visit",
"=",
"(",
"mark",
")",
"=>",
"{",
"if",
"(",
"marked",
".",
"has",
... | Sort nodes topologically using a depth-first approach. Encountered cycles are broken. | [
"Sort",
"nodes",
"topologically",
"using",
"a",
"depth",
"-",
"first",
"approach",
".",
"Encountered",
"cycles",
"are",
"broken",
"."
] | 6e29611788277729647acf465f10db1ea6f15788 | https://github.com/electron/electron/blob/6e29611788277729647acf465f10db1ea6f15788/lib/browser/api/menu-utils.js#L53-L69 | train | Sort the topologically sorted list of nodes in the order given by originalOrder. | [
30522,
3853,
4066,
14399,
10091,
2135,
1006,
2434,
8551,
2121,
1010,
7926,
3762,
3593,
1007,
1063,
9530,
3367,
19616,
1027,
1031,
1033,
9530,
3367,
4417,
1027,
2047,
2275,
1006,
1007,
9530,
3367,
3942,
1027,
1006,
2928,
1007,
1027,
1028,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
quasarframework/quasar | ui/src/components/datetime/persian.js | jalCal | function jalCal (jy, withoutLeap) {
let bl = breaks.length,
gy = jy + 621,
leapJ = -14,
jp = breaks[0],
jm,
jump,
leap,
leapG,
march,
n,
i
if (jy < jp || jy >= breaks[bl - 1]) { throw new Error('Invalid Jalaali year ' + jy) }
// Find the limiting years for the Jalaali year jy.
for (i = 1; i < bl; i += 1) {
jm = breaks[i]
jump = jm - jp
if (jy < jm) { break }
leapJ = leapJ + div(jump, 33) * 8 + div(mod(jump, 33), 4)
jp = jm
}
n = jy - jp
// Find the number of leap years from AD 621 to the beginning
// of the current Jalaali year in the Persian calendar.
leapJ = leapJ + div(n, 33) * 8 + div(mod(n, 33) + 3, 4)
if (mod(jump, 33) === 4 && jump - n === 4) { leapJ += 1 }
// And the same in the Gregorian calendar (until the year gy).
leapG = div(gy, 4) - div((div(gy, 100) + 1) * 3, 4) - 150
// Determine the Gregorian date of Farvardin the 1st.
march = 20 + leapJ - leapG
// Find how many years have passed since the last leap year.
if (!withoutLeap) {
if (jump - n < 6) { n = n - jump + div(jump + 4, 33) * 33 }
leap = mod(mod(n + 1, 33) - 1, 4)
if (leap === -1) {
leap = 4
}
}
return {
leap: leap,
gy: gy,
march: march
}
} | javascript | function jalCal (jy, withoutLeap) {
let bl = breaks.length,
gy = jy + 621,
leapJ = -14,
jp = breaks[0],
jm,
jump,
leap,
leapG,
march,
n,
i
if (jy < jp || jy >= breaks[bl - 1]) { throw new Error('Invalid Jalaali year ' + jy) }
// Find the limiting years for the Jalaali year jy.
for (i = 1; i < bl; i += 1) {
jm = breaks[i]
jump = jm - jp
if (jy < jm) { break }
leapJ = leapJ + div(jump, 33) * 8 + div(mod(jump, 33), 4)
jp = jm
}
n = jy - jp
// Find the number of leap years from AD 621 to the beginning
// of the current Jalaali year in the Persian calendar.
leapJ = leapJ + div(n, 33) * 8 + div(mod(n, 33) + 3, 4)
if (mod(jump, 33) === 4 && jump - n === 4) { leapJ += 1 }
// And the same in the Gregorian calendar (until the year gy).
leapG = div(gy, 4) - div((div(gy, 100) + 1) * 3, 4) - 150
// Determine the Gregorian date of Farvardin the 1st.
march = 20 + leapJ - leapG
// Find how many years have passed since the last leap year.
if (!withoutLeap) {
if (jump - n < 6) { n = n - jump + div(jump + 4, 33) * 33 }
leap = mod(mod(n + 1, 33) - 1, 4)
if (leap === -1) {
leap = 4
}
}
return {
leap: leap,
gy: gy,
march: march
}
} | [
"function",
"jalCal",
"(",
"jy",
",",
"withoutLeap",
")",
"{",
"let",
"bl",
"=",
"breaks",
".",
"length",
",",
"gy",
"=",
"jy",
"+",
"621",
",",
"leapJ",
"=",
"-",
"14",
",",
"jp",
"=",
"breaks",
"[",
"0",
"]",
",",
"jm",
",",
"jump",
",",
"l... | /*
This function determines if the Jalaali (Persian) year is
leap (366-day long) or is the common year (365 days), and
finds the day in March (Gregorian calendar) of the first
day of the Jalaali year (jy).
@param jy Jalaali calendar year (-61 to 3177)
@param withoutLeap when don't need leap (true or false) default is false
@return
leap: number of years since the last leap year (0 to 4)
gy: Gregorian year of the beginning of Jalaali year
march: the March day of Farvardin the 1st (1st day of jy)
@see: http://www.astro.uni.torun.pl/~kb/Papers/EMP/PersianC-EMP.htm
@see: http://www.fourmilab.ch/documents/calendar/ | [
"/",
"*",
"This",
"function",
"determines",
"if",
"the",
"Jalaali",
"(",
"Persian",
")",
"year",
"is",
"leap",
"(",
"366",
"-",
"day",
"long",
")",
"or",
"is",
"the",
"common",
"year",
"(",
"365",
"days",
")",
"and",
"finds",
"the",
"day",
"in",
"M... | 5d2fb6c96bff6095236f8ca6fe07a037e32e06b3 | https://github.com/quasarframework/quasar/blob/5d2fb6c96bff6095236f8ca6fe07a037e32e06b3/ui/src/components/datetime/persian.js#L105-L155 | train | Returns the Jalaali calendar for the given Jalaali year. | [
30522,
3853,
14855,
15472,
2389,
1006,
1046,
2100,
1010,
2302,
19738,
2361,
1007,
1063,
2292,
1038,
2140,
1027,
7807,
1012,
3091,
1010,
1043,
2100,
1027,
1046,
2100,
1009,
5786,
2487,
1010,
11679,
3501,
1027,
1011,
2403,
1010,
16545,
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/LiveDevelopment/LiveDevMultiBrowser.js | setLauncher | function setLauncher(launcher) {
if (!(launcher && launcher.launch)) {
console.log("Invalid launcher object: ", launcher, new Error("LiveDevMultiBrowser.setLauncher()"));
return;
}
_launcher = launcher;
} | javascript | function setLauncher(launcher) {
if (!(launcher && launcher.launch)) {
console.log("Invalid launcher object: ", launcher, new Error("LiveDevMultiBrowser.setLauncher()"));
return;
}
_launcher = launcher;
} | [
"function",
"setLauncher",
"(",
"launcher",
")",
"{",
"if",
"(",
"!",
"(",
"launcher",
"&&",
"launcher",
".",
"launch",
")",
")",
"{",
"console",
".",
"log",
"(",
"\"Invalid launcher object: \"",
",",
"launcher",
",",
"new",
"Error",
"(",
"\"LiveDevMultiBrow... | Sets the current browser launcher mechanism to be used by live development
(e.g., default browser, iframe-based browser, etc.)
The launcher must provide the following method:
- launch(url): Launch the given URL in the appropriate browser.
@param {{launch: function(string)}} launcher | [
"Sets",
"the",
"current",
"browser",
"launcher",
"mechanism",
"to",
"be",
"used",
"by",
"live",
"development",
"(",
"e",
".",
"g",
".",
"default",
"browser",
"iframe",
"-",
"based",
"browser",
"etc",
".",
")",
"The",
"launcher",
"must",
"provide",
"the",
... | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/LiveDevelopment/LiveDevMultiBrowser.js#L807-L813 | train | Set the launcher object | [
30522,
3853,
2275,
17298,
26091,
2099,
1006,
22742,
1007,
1063,
2065,
1006,
999,
1006,
22742,
1004,
1004,
22742,
1012,
4888,
1007,
1007,
1063,
10122,
1012,
8833,
1006,
1000,
19528,
22742,
4874,
1024,
1000,
1010,
22742,
1010,
2047,
7561,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SeleniumHQ/selenium | javascript/atoms/events.js | createNativeTouchList | function createNativeTouchList(touchListArgs) {
var touches = goog.array.map(touchListArgs, function(touchArg) {
return doc.createTouch(view, target, touchArg.identifier,
touchArg.pageX, touchArg.pageY, touchArg.screenX, touchArg.screenY);
});
return doc.createTouchList.apply(doc, touches);
} | javascript | function createNativeTouchList(touchListArgs) {
var touches = goog.array.map(touchListArgs, function(touchArg) {
return doc.createTouch(view, target, touchArg.identifier,
touchArg.pageX, touchArg.pageY, touchArg.screenX, touchArg.screenY);
});
return doc.createTouchList.apply(doc, touches);
} | [
"function",
"createNativeTouchList",
"(",
"touchListArgs",
")",
"{",
"var",
"touches",
"=",
"goog",
".",
"array",
".",
"map",
"(",
"touchListArgs",
",",
"function",
"(",
"touchArg",
")",
"{",
"return",
"doc",
".",
"createTouch",
"(",
"view",
",",
"target",
... | Creates a TouchList, using native touch Api, for touch events. | [
"Creates",
"a",
"TouchList",
"using",
"native",
"touch",
"Api",
"for",
"touch",
"events",
"."
] | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/atoms/events.js#L493-L500 | train | Creates a native touch list. | [
30522,
3853,
3443,
19833,
3512,
24826,
2818,
9863,
1006,
3543,
9863,
2906,
5620,
1007,
1063,
13075,
12817,
1027,
27571,
2290,
1012,
9140,
1012,
4949,
1006,
3543,
9863,
2906,
5620,
1010,
3853,
1006,
3543,
2906,
2290,
1007,
1063,
2709,
9986,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
eslint/eslint | lib/util/npm-utils.js | fetchPeerDependencies | function fetchPeerDependencies(packageName) {
const npmProcess = spawn.sync(
"npm",
["show", "--json", packageName, "peerDependencies"],
{ encoding: "utf8" }
);
const error = npmProcess.error;
if (error && error.code === "ENOENT") {
return null;
}
const fetchedText = npmProcess.stdout.trim();
return JSON.parse(fetchedText || "{}");
} | javascript | function fetchPeerDependencies(packageName) {
const npmProcess = spawn.sync(
"npm",
["show", "--json", packageName, "peerDependencies"],
{ encoding: "utf8" }
);
const error = npmProcess.error;
if (error && error.code === "ENOENT") {
return null;
}
const fetchedText = npmProcess.stdout.trim();
return JSON.parse(fetchedText || "{}");
} | [
"function",
"fetchPeerDependencies",
"(",
"packageName",
")",
"{",
"const",
"npmProcess",
"=",
"spawn",
".",
"sync",
"(",
"\"npm\"",
",",
"[",
"\"show\"",
",",
"\"--json\"",
",",
"packageName",
",",
"\"peerDependencies\"",
"]",
",",
"{",
"encoding",
":",
"\"ut... | Fetch `peerDependencies` of the given package by `npm show` command.
@param {string} packageName The package name to fetch peerDependencies.
@returns {Object} Gotten peerDependencies. Returns null if npm was not found. | [
"Fetch",
"peerDependencies",
"of",
"the",
"given",
"package",
"by",
"npm",
"show",
"command",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/util/npm-utils.js#L70-L87 | train | Fetch peerDependencies from the specified package | [
30522,
3853,
18584,
28084,
25547,
11837,
4181,
9243,
1006,
7427,
18442,
1007,
1063,
9530,
3367,
27937,
8737,
3217,
9623,
2015,
1027,
25645,
1012,
26351,
1006,
1000,
27937,
2213,
1000,
1010,
1031,
1000,
2265,
1000,
1010,
1000,
1011,
1011,
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... |
TryGhost/Ghost | core/server/api/v0.1/users.js | doQuery | function doQuery(options) {
return models.User.findOne(options.data, _.omit(options, ['data']))
.then((model) => {
if (!model) {
return Promise.reject(new common.errors.NotFoundError({
message: common.i18n.t('errors.api.users.userNotFound')
}));
}
return {
users: [urlsForUser(model.id, model.toJSON(options), options)]
};
});
} | javascript | function doQuery(options) {
return models.User.findOne(options.data, _.omit(options, ['data']))
.then((model) => {
if (!model) {
return Promise.reject(new common.errors.NotFoundError({
message: common.i18n.t('errors.api.users.userNotFound')
}));
}
return {
users: [urlsForUser(model.id, model.toJSON(options), options)]
};
});
} | [
"function",
"doQuery",
"(",
"options",
")",
"{",
"return",
"models",
".",
"User",
".",
"findOne",
"(",
"options",
".",
"data",
",",
"_",
".",
"omit",
"(",
"options",
",",
"[",
"'data'",
"]",
")",
")",
".",
"then",
"(",
"(",
"model",
")",
"=>",
"{... | ### Model Query
Make the call to the Model layer
@param {Object} options
@returns {Object} options | [
"###",
"Model",
"Query",
"Make",
"the",
"call",
"to",
"the",
"Model",
"layer"
] | bb7bb55cf3e60af99ebbc56099928827b58461bc | https://github.com/TryGhost/Ghost/blob/bb7bb55cf3e60af99ebbc56099928827b58461bc/core/server/api/v0.1/users.js#L82-L95 | train | Query for a user | [
30522,
3853,
2079,
4226,
2854,
1006,
30524,
1033,
1007,
1007,
1012,
2059,
1006,
1006,
2944,
1007,
1027,
1028,
1063,
2065,
1006,
999,
2944,
1007,
1063,
2709,
4872,
1012,
15454,
1006,
2047,
2691,
1012,
10697,
1012,
2025,
14876,
20824,
29165,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/LiveDevelopment/LiveDevelopmentUtils.js | isServerHtmlFileExt | function isServerHtmlFileExt(filePath) {
if (!filePath) {
return false;
}
return (_serverHtmlFileExts.indexOf(LanguageManager.getLanguageForPath(filePath).getId()) !== -1);
} | javascript | function isServerHtmlFileExt(filePath) {
if (!filePath) {
return false;
}
return (_serverHtmlFileExts.indexOf(LanguageManager.getLanguageForPath(filePath).getId()) !== -1);
} | [
"function",
"isServerHtmlFileExt",
"(",
"filePath",
")",
"{",
"if",
"(",
"!",
"filePath",
")",
"{",
"return",
"false",
";",
"}",
"return",
"(",
"_serverHtmlFileExts",
".",
"indexOf",
"(",
"LanguageManager",
".",
"getLanguageForPath",
"(",
"filePath",
")",
".",... | Determine if file extension is a server html file extension.
@param {string} filePath could be a path, a file name or just a file extension
@return {boolean} Returns true if fileExt is in the list | [
"Determine",
"if",
"file",
"extension",
"is",
"a",
"server",
"html",
"file",
"extension",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/LiveDevelopment/LiveDevelopmentUtils.js#L58-L64 | train | Check if a file is a server html file extension | [
30522,
3853,
26354,
2121,
6299,
11039,
19968,
8873,
10559,
18413,
1006,
5371,
15069,
1007,
1063,
2065,
1006,
999,
5371,
15069,
1007,
1063,
2709,
6270,
1025,
1065,
2709,
1006,
1035,
8241,
11039,
19968,
8873,
10559,
18413,
2015,
1012,
5950,
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... |
ColorlibHQ/AdminLTE | plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js | function() {
var i = 0,
length = arr.length,
newArray = [];
for (; i<length; i++) {
newArray.push(arr[i]);
}
return newArray;
} | javascript | function() {
var i = 0,
length = arr.length,
newArray = [];
for (; i<length; i++) {
newArray.push(arr[i]);
}
return newArray;
} | [
"function",
"(",
")",
"{",
"var",
"i",
"=",
"0",
",",
"length",
"=",
"arr",
".",
"length",
",",
"newArray",
"=",
"[",
"]",
";",
"for",
"(",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"newArray",
".",
"push",
"(",
"arr",
"[",
"i",
"]... | Return a clean native array
Following will convert a Live NodeList to a proper Array
@example
var childNodes = wysihtml5.lang.array(document.body.childNodes).get(); | [
"Return",
"a",
"clean",
"native",
"array"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js#L4647-L4655 | train | returns an array of the array of the terms | [
30522,
3853,
1006,
1007,
1063,
13075,
1045,
1027,
1014,
1010,
3091,
1027,
12098,
2099,
1012,
3091,
1010,
2047,
2906,
9447,
1027,
1031,
1033,
1025,
2005,
1006,
1025,
1045,
1026,
3091,
1025,
1045,
1009,
1009,
1007,
1063,
2047,
2906,
9447,
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... | |
jiahaog/nativefier | app/src/helpers/inferFlash.js | findSync | function findSync(pattern, basePath, findDir) {
const matches = [];
(function findSyncRecurse(base) {
let children;
try {
children = fs.readdirSync(base);
} catch (exception) {
if (exception.code === 'ENOENT') {
return;
}
throw exception;
}
children.forEach((child) => {
const childPath = path.join(base, child);
const childIsDirectory = fs.lstatSync(childPath).isDirectory();
const patternMatches = pattern.test(childPath);
if (!patternMatches) {
if (!childIsDirectory) {
return;
}
findSyncRecurse(childPath);
return;
}
if (!findDir) {
matches.push(childPath);
return;
}
if (childIsDirectory) {
matches.push(childPath);
}
});
})(basePath);
return matches;
} | javascript | function findSync(pattern, basePath, findDir) {
const matches = [];
(function findSyncRecurse(base) {
let children;
try {
children = fs.readdirSync(base);
} catch (exception) {
if (exception.code === 'ENOENT') {
return;
}
throw exception;
}
children.forEach((child) => {
const childPath = path.join(base, child);
const childIsDirectory = fs.lstatSync(childPath).isDirectory();
const patternMatches = pattern.test(childPath);
if (!patternMatches) {
if (!childIsDirectory) {
return;
}
findSyncRecurse(childPath);
return;
}
if (!findDir) {
matches.push(childPath);
return;
}
if (childIsDirectory) {
matches.push(childPath);
}
});
})(basePath);
return matches;
} | [
"function",
"findSync",
"(",
"pattern",
",",
"basePath",
",",
"findDir",
")",
"{",
"const",
"matches",
"=",
"[",
"]",
";",
"(",
"function",
"findSyncRecurse",
"(",
"base",
")",
"{",
"let",
"children",
";",
"try",
"{",
"children",
"=",
"fs",
".",
"readd... | Synchronously find a file or directory
@param {RegExp} pattern regex
@param {string} base path
@param {boolean} [findDir] if true, search results will be limited to only directories
@returns {Array} | [
"Synchronously",
"find",
"a",
"file",
"or",
"directory"
] | b959956a38ce51a9dd95d42308f0a6c66489b624 | https://github.com/jiahaog/nativefier/blob/b959956a38ce51a9dd95d42308f0a6c66489b624/app/src/helpers/inferFlash.js#L14-L52 | train | Find all files in a directory that match the given pattern | [
30522,
3853,
4858,
6038,
2278,
1006,
5418,
1010,
2918,
15069,
1010,
2424,
4305,
2099,
1007,
1063,
9530,
3367,
3503,
1027,
1031,
1033,
1025,
1006,
3853,
4858,
6038,
16748,
10841,
22573,
1006,
2918,
1007,
1063,
2292,
2336,
1025,
3046,
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... |
catapult-project/catapult | third_party/polymer3/bower_components/polymer/lib/utils/gestures.js | _add | function _add(node, evType, handler) {
let recognizer = gestures[evType];
let deps = recognizer.deps;
let name = recognizer.name;
let gobj = node[GESTURE_KEY];
if (!gobj) {
node[GESTURE_KEY] = gobj = {};
}
for (let i = 0, dep, gd; i < deps.length; i++) {
dep = deps[i];
// don't add mouse handlers on iOS because they cause gray selection overlays
if (IS_TOUCH_ONLY && isMouseEvent(dep) && dep !== 'click') {
continue;
}
gd = gobj[dep];
if (!gd) {
gobj[dep] = gd = {_count: 0};
}
if (gd._count === 0) {
node.addEventListener(dep, _handleNative, PASSIVE_TOUCH(dep));
}
gd[name] = (gd[name] || 0) + 1;
gd._count = (gd._count || 0) + 1;
}
node.addEventListener(evType, handler);
if (recognizer.touchAction) {
setTouchAction(node, recognizer.touchAction);
}
} | javascript | function _add(node, evType, handler) {
let recognizer = gestures[evType];
let deps = recognizer.deps;
let name = recognizer.name;
let gobj = node[GESTURE_KEY];
if (!gobj) {
node[GESTURE_KEY] = gobj = {};
}
for (let i = 0, dep, gd; i < deps.length; i++) {
dep = deps[i];
// don't add mouse handlers on iOS because they cause gray selection overlays
if (IS_TOUCH_ONLY && isMouseEvent(dep) && dep !== 'click') {
continue;
}
gd = gobj[dep];
if (!gd) {
gobj[dep] = gd = {_count: 0};
}
if (gd._count === 0) {
node.addEventListener(dep, _handleNative, PASSIVE_TOUCH(dep));
}
gd[name] = (gd[name] || 0) + 1;
gd._count = (gd._count || 0) + 1;
}
node.addEventListener(evType, handler);
if (recognizer.touchAction) {
setTouchAction(node, recognizer.touchAction);
}
} | [
"function",
"_add",
"(",
"node",
",",
"evType",
",",
"handler",
")",
"{",
"let",
"recognizer",
"=",
"gestures",
"[",
"evType",
"]",
";",
"let",
"deps",
"=",
"recognizer",
".",
"deps",
";",
"let",
"name",
"=",
"recognizer",
".",
"name",
";",
"let",
"g... | automate the event listeners for the native events
@private
@param {!HTMLElement} node Node on which to add the event.
@param {string} evType Event type to add.
@param {function(!Event)} handler Event handler function.
@return {void}
@this {Gestures} | [
"automate",
"the",
"event",
"listeners",
"for",
"the",
"native",
"events"
] | 992929ffccac68827869a497f01ee4d653ed4f25 | https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/third_party/polymer3/bower_components/polymer/lib/utils/gestures.js#L539-L567 | train | Add event handler to a node | [
30522,
3853,
1035,
5587,
1006,
13045,
1010,
23408,
13874,
1010,
28213,
1007,
1063,
2292,
6807,
2099,
1027,
18327,
1031,
23408,
13874,
1033,
1025,
2292,
2139,
4523,
1027,
6807,
2099,
1012,
2139,
4523,
1025,
2292,
2171,
1027,
6807,
2099,
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... |
webdriverio/webdriverio | packages/wdio-sync/src/index.js | function (fn, repeatTest = 0, args = []) {
let result, error
/**
* if a new hook gets executed we can assume that all commands should have finised
* with exception of timeouts where `commandIsRunning` will never be reset but here
*/
// commandIsRunning = false
try {
result = fn.apply(this, args)
} catch (e) {
error = e
}
/**
* handle errors that get thrown directly and are not cause by
* rejected promises
*/
if (error) {
if (repeatTest) {
return executeAsync(fn, --repeatTest, args)
}
return new Promise((resolve, reject) => reject(error))
}
/**
* if we don't retry just return result
*/
if (repeatTest === 0 || !result || typeof result.catch !== 'function') {
return new Promise(resolve => resolve(result))
}
/**
* handle promise response
*/
return result.catch((e) => {
if (repeatTest) {
return executeAsync(fn, --repeatTest, args)
}
e.stack = e.stack.split('\n').filter(STACKTRACE_FILTER_FN).join('\n')
return Promise.reject(e)
})
} | javascript | function (fn, repeatTest = 0, args = []) {
let result, error
/**
* if a new hook gets executed we can assume that all commands should have finised
* with exception of timeouts where `commandIsRunning` will never be reset but here
*/
// commandIsRunning = false
try {
result = fn.apply(this, args)
} catch (e) {
error = e
}
/**
* handle errors that get thrown directly and are not cause by
* rejected promises
*/
if (error) {
if (repeatTest) {
return executeAsync(fn, --repeatTest, args)
}
return new Promise((resolve, reject) => reject(error))
}
/**
* if we don't retry just return result
*/
if (repeatTest === 0 || !result || typeof result.catch !== 'function') {
return new Promise(resolve => resolve(result))
}
/**
* handle promise response
*/
return result.catch((e) => {
if (repeatTest) {
return executeAsync(fn, --repeatTest, args)
}
e.stack = e.stack.split('\n').filter(STACKTRACE_FILTER_FN).join('\n')
return Promise.reject(e)
})
} | [
"function",
"(",
"fn",
",",
"repeatTest",
"=",
"0",
",",
"args",
"=",
"[",
"]",
")",
"{",
"let",
"result",
",",
"error",
"/**\n * if a new hook gets executed we can assume that all commands should have finised\n * with exception of timeouts where `commandIsRunning` will n... | execute test or hook asynchronously
@param {Function} fn spec or hook method
@param {Number} repeatTest number of retries
@return {Promise} that gets resolved once test/hook is done or was retried enough | [
"execute",
"test",
"or",
"hook",
"asynchronously"
] | 8de7f1a3b12d97282ed4ee2e25e4c3c9a8940ac1 | https://github.com/webdriverio/webdriverio/blob/8de7f1a3b12d97282ed4ee2e25e4c3c9a8940ac1/packages/wdio-sync/src/index.js#L54-L98 | train | Execute a function in a new context | [
30522,
3853,
1006,
1042,
2078,
1010,
9377,
22199,
1027,
30524,
2064,
7868,
2008,
2035,
10954,
2323,
2031,
10346,
5084,
1008,
2007,
6453,
1997,
2051,
12166,
2073,
1036,
3094,
2483,
15532,
5582,
1036,
2097,
2196,
2022,
25141,
2021,
2182,
1008... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
grpc/grpc-node | packages/grpc-native-core/src/client.js | ClientDuplexStream | function ClientDuplexStream(call) {
Duplex.call(this, {objectMode: true});
this.call = call;
/* Status generated from reading messages from the server. Overrides the
* status from the server if not OK */
this.read_status = null;
/* Status received from the server. */
this.received_status = null;
var self = this;
this.on('finish', function() {
self.call.halfClose();
});
} | javascript | function ClientDuplexStream(call) {
Duplex.call(this, {objectMode: true});
this.call = call;
/* Status generated from reading messages from the server. Overrides the
* status from the server if not OK */
this.read_status = null;
/* Status received from the server. */
this.received_status = null;
var self = this;
this.on('finish', function() {
self.call.halfClose();
});
} | [
"function",
"ClientDuplexStream",
"(",
"call",
")",
"{",
"Duplex",
".",
"call",
"(",
"this",
",",
"{",
"objectMode",
":",
"true",
"}",
")",
";",
"this",
".",
"call",
"=",
"call",
";",
"/* Status generated from reading messages from the server. Overrides the\n * st... | A stream that the client can read from or write to. Used for calls with
duplex streaming.
@constructor grpc~ClientDuplexStream
@extends external:Duplex
@borrows grpc~ClientUnaryCall#cancel as grpc~ClientDuplexStream#cancel
@borrows grpc~ClientUnaryCall#getPeer as grpc~ClientDuplexStream#getPeer
@borrows grpc~ClientWritableStream#write as grpc~ClientDuplexStream#write
@borrows grpc~ClientUnaryCall#event:metadata as
grpc~ClientDuplexStream#metadata
@borrows grpc~ClientUnaryCall#event:status as
grpc~ClientDuplexStream#status
@param {InterceptingCall} call Exposes gRPC request operations, processed by
an interceptor stack. | [
"A",
"stream",
"that",
"the",
"client",
"can",
"read",
"from",
"or",
"write",
"to",
".",
"Used",
"for",
"calls",
"with",
"duplex",
"streaming",
"."
] | b36b285f4cdb334bbd48f74c12c13bec69961488 | https://github.com/grpc/grpc-node/blob/b36b285f4cdb334bbd48f74c12c13bec69961488/packages/grpc-native-core/src/client.js#L281-L293 | train | A stream that can be used to read messages from the server. | [
30522,
3853,
7396,
8566,
19386,
21422,
1006,
2655,
1007,
1063,
4241,
19386,
1012,
2655,
1006,
2023,
1010,
1063,
4874,
5302,
3207,
1024,
2995,
1065,
1007,
1025,
2023,
1012,
2655,
1027,
2655,
1025,
1013,
1008,
3570,
7013,
2013,
3752,
7696,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
jgraph/mxgraph | javascript/mxClient.js | function(array, key, defaultValue)
{
var value = (array != null) ? array[key] : null;
if (value == null)
{
value = defaultValue;
}
return value;
} | javascript | function(array, key, defaultValue)
{
var value = (array != null) ? array[key] : null;
if (value == null)
{
value = defaultValue;
}
return value;
} | [
"function",
"(",
"array",
",",
"key",
",",
"defaultValue",
")",
"{",
"var",
"value",
"=",
"(",
"array",
"!=",
"null",
")",
"?",
"array",
"[",
"key",
"]",
":",
"null",
";",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"value",
"=",
"defaultValue",
... | Function: getValue
Returns the value for the given key in the given associative array or
the given default value if the value is null.
Parameters:
array - Associative array that contains the value for the key.
key - Key whose value should be returned.
defaultValue - Value to be returned if the value for the given
key is null. | [
"Function",
":",
"getValue"
] | 33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44 | https://github.com/jgraph/mxgraph/blob/33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44/javascript/mxClient.js#L3774-L3784 | train | Get the value of a key in an array | [
30522,
3853,
1006,
9140,
1010,
3145,
1010,
12398,
10175,
5657,
1007,
1063,
13075,
3643,
1027,
1006,
9140,
999,
1027,
19701,
1007,
1029,
9140,
1031,
3145,
1033,
1024,
19701,
1025,
2065,
1006,
3643,
1027,
1027,
19701,
1007,
1063,
3643,
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/util/animation/animate.js | reverseTranslate | function reverseTranslate (newFrom) {
return $animateCss(target, {
to: newFrom || from,
addClass: options.transitionOutClass,
removeClass: options.transitionInClass,
duration: options.duration
}).start();
} | javascript | function reverseTranslate (newFrom) {
return $animateCss(target, {
to: newFrom || from,
addClass: options.transitionOutClass,
removeClass: options.transitionInClass,
duration: options.duration
}).start();
} | [
"function",
"reverseTranslate",
"(",
"newFrom",
")",
"{",
"return",
"$animateCss",
"(",
"target",
",",
"{",
"to",
":",
"newFrom",
"||",
"from",
",",
"addClass",
":",
"options",
".",
"transitionOutClass",
",",
"removeClass",
":",
"options",
".",
"transitionInCl... | Specific reversal of the request translate animation above... | [
"Specific",
"reversal",
"of",
"the",
"request",
"translate",
"animation",
"above",
"..."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/util/animation/animate.js#L40-L48 | train | reverseTranslate - reverse the translation | [
30522,
3853,
7901,
6494,
3619,
13806,
1006,
2047,
19699,
5358,
1007,
1063,
2709,
1002,
2019,
21499,
6169,
2015,
1006,
4539,
1010,
1063,
2000,
1024,
2047,
19699,
5358,
1064,
1064,
2013,
1010,
5587,
26266,
1024,
7047,
1012,
6653,
5833,
26266,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/website/createTemplateEngine.js | fileExists | function fileExists(fileName) {
if (!fileName) {
return false;
}
var filePath = PathUtils.resolveInRoot(outputFolder, fileName);
return fs.existsSync(filePath);
} | javascript | function fileExists(fileName) {
if (!fileName) {
return false;
}
var filePath = PathUtils.resolveInRoot(outputFolder, fileName);
return fs.existsSync(filePath);
} | [
"function",
"fileExists",
"(",
"fileName",
")",
"{",
"if",
"(",
"!",
"fileName",
")",
"{",
"return",
"false",
";",
"}",
"var",
"filePath",
"=",
"PathUtils",
".",
"resolveInRoot",
"(",
"outputFolder",
",",
"fileName",
")",
";",
"return",
"fs",
".",
"exist... | Check if a file exists
@param {String} fileName
@return {Boolean} | [
"Check",
"if",
"a",
"file",
"exists"
] | 6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4 | https://github.com/GitbookIO/gitbook/blob/6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4/lib/output/website/createTemplateEngine.js#L61-L68 | train | Check if the file exists in the output folder | [
30522,
3853,
5371,
10288,
5130,
1006,
5371,
18442,
1007,
1063,
2065,
1006,
999,
5371,
18442,
1007,
1063,
2709,
6270,
1025,
1065,
13075,
5371,
15069,
1027,
4130,
21823,
4877,
1012,
10663,
2378,
3217,
4140,
1006,
6434,
10371,
2121,
1010,
5371... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
uber/deck.gl | modules/layers/src/solid-polygon-layer/polygon.js | isNestedRingClosed | function isNestedRingClosed(simplePolygon) {
// check if first and last vertex are the same
const p0 = simplePolygon[0];
const p1 = simplePolygon[simplePolygon.length - 1];
return p0[0] === p1[0] && p0[1] === p1[1] && p0[2] === p1[2];
} | javascript | function isNestedRingClosed(simplePolygon) {
// check if first and last vertex are the same
const p0 = simplePolygon[0];
const p1 = simplePolygon[simplePolygon.length - 1];
return p0[0] === p1[0] && p0[1] === p1[1] && p0[2] === p1[2];
} | [
"function",
"isNestedRingClosed",
"(",
"simplePolygon",
")",
"{",
"// check if first and last vertex are the same",
"const",
"p0",
"=",
"simplePolygon",
"[",
"0",
"]",
";",
"const",
"p1",
"=",
"simplePolygon",
"[",
"simplePolygon",
".",
"length",
"-",
"1",
"]",
";... | Check if a simple polygon is a closed ring
@param {Array} simplePolygon - array of points
@return {Boolean} - true if the simple polygon is a closed ring | [
"Check",
"if",
"a",
"simple",
"polygon",
"is",
"a",
"closed",
"ring"
] | a2010448b7f268bbd03617b812334c68a6b9e5b2 | https://github.com/uber/deck.gl/blob/a2010448b7f268bbd03617b812334c68a6b9e5b2/modules/layers/src/solid-polygon-layer/polygon.js#L57-L63 | train | Check if simple polygon is closed | [
30522,
3853,
3475,
17944,
4892,
20464,
24768,
1006,
3722,
18155,
2100,
7446,
1007,
1063,
1013,
1013,
4638,
2065,
2034,
1998,
2197,
19449,
2024,
1996,
2168,
9530,
3367,
1052,
2692,
1027,
3722,
18155,
2100,
7446,
1031,
1014,
1033,
1025,
9530,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/extensions/default/RemoteFileAdapter/main.js | _setMenuItemsVisible | function _setMenuItemsVisible() {
var file = MainViewManager.getCurrentlyViewedFile(MainViewManager.ACTIVE_PANE),
cMenuItems = [Commands.FILE_SAVE, Commands.FILE_RENAME, Commands.NAVIGATE_SHOW_IN_FILE_TREE, Commands.NAVIGATE_SHOW_IN_OS],
// Enable menu options when no file is present in active pane
enable = !file || (file.constructor.name !== "RemoteFile");
// Enable or disable commands based on whether the file is a remoteFile or not.
cMenuItems.forEach(function (item) {
CommandManager.get(item).setEnabled(enable);
});
} | javascript | function _setMenuItemsVisible() {
var file = MainViewManager.getCurrentlyViewedFile(MainViewManager.ACTIVE_PANE),
cMenuItems = [Commands.FILE_SAVE, Commands.FILE_RENAME, Commands.NAVIGATE_SHOW_IN_FILE_TREE, Commands.NAVIGATE_SHOW_IN_OS],
// Enable menu options when no file is present in active pane
enable = !file || (file.constructor.name !== "RemoteFile");
// Enable or disable commands based on whether the file is a remoteFile or not.
cMenuItems.forEach(function (item) {
CommandManager.get(item).setEnabled(enable);
});
} | [
"function",
"_setMenuItemsVisible",
"(",
")",
"{",
"var",
"file",
"=",
"MainViewManager",
".",
"getCurrentlyViewedFile",
"(",
"MainViewManager",
".",
"ACTIVE_PANE",
")",
",",
"cMenuItems",
"=",
"[",
"Commands",
".",
"FILE_SAVE",
",",
"Commands",
".",
"FILE_RENAME"... | Disable context menus which are not useful for remote file | [
"Disable",
"context",
"menus",
"which",
"are",
"not",
"useful",
"for",
"remote",
"file"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/RemoteFileAdapter/main.js#L59-L69 | train | Set menu items visible | [
30522,
3853,
1035,
2275,
3549,
14663,
6633,
2015,
11365,
7028,
1006,
1007,
1063,
13075,
5371,
1027,
2364,
8584,
24805,
4590,
1012,
2131,
10841,
14343,
20630,
8584,
2098,
8873,
2571,
1006,
2364,
8584,
24805,
4590,
1012,
3161,
1035,
6090,
206... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
tensorflow/tfjs-models | posenet/demos/coco.js | decodeSinglePoseAndDrawResults | async function decodeSinglePoseAndDrawResults() {
if (!modelOutputs) {
return;
}
const pose = await posenet.decodeSinglePose(
modelOutputs.heatmapScores, modelOutputs.offsets, guiState.outputStride);
drawSinglePoseResults(pose);
} | javascript | async function decodeSinglePoseAndDrawResults() {
if (!modelOutputs) {
return;
}
const pose = await posenet.decodeSinglePose(
modelOutputs.heatmapScores, modelOutputs.offsets, guiState.outputStride);
drawSinglePoseResults(pose);
} | [
"async",
"function",
"decodeSinglePoseAndDrawResults",
"(",
")",
"{",
"if",
"(",
"!",
"modelOutputs",
")",
"{",
"return",
";",
"}",
"const",
"pose",
"=",
"await",
"posenet",
".",
"decodeSinglePose",
"(",
"modelOutputs",
".",
"heatmapScores",
",",
"modelOutputs",... | Converts the raw model output results into single-pose estimation results | [
"Converts",
"the",
"raw",
"model",
"output",
"results",
"into",
"single",
"-",
"pose",
"estimation",
"results"
] | af194797c90cc5bcac1060d3cd41b0258a34c7dc | https://github.com/tensorflow/tfjs-models/blob/af194797c90cc5bcac1060d3cd41b0258a34c7dc/posenet/demos/coco.js#L282-L291 | train | Decode single pose and draw results | [
30522,
2004,
6038,
2278,
3853,
21933,
6155,
2075,
2571,
20688,
5685,
7265,
13088,
2229,
11314,
2015,
1006,
1007,
1063,
2065,
1006,
999,
2944,
5833,
18780,
2015,
1007,
1063,
2709,
1025,
1065,
9530,
3367,
13382,
1027,
26751,
13382,
7159,
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... |
SheetJS/js-xlsx | bits/78_writebiff.js | write_biff2_buf | function write_biff2_buf(wb/*:Workbook*/, opts/*:WriteOpts*/) {
var o = opts || {};
if(DENSE != null && o.dense == null) o.dense = DENSE;
var ba = buf_array();
var idx = 0;
for(var i=0;i<wb.SheetNames.length;++i) if(wb.SheetNames[i] == o.sheet) idx=i;
if(idx == 0 && !!o.sheet && wb.SheetNames[0] != o.sheet) throw new Error("Sheet not found: " + o.sheet);
write_biff_rec(ba, 0x0009, write_BOF(wb, 0x10, o));
/* ... */
write_ws_biff2(ba, wb.Sheets[wb.SheetNames[idx]], idx, o, wb);
/* ... */
write_biff_rec(ba, 0x000A);
return ba.end();
} | javascript | function write_biff2_buf(wb/*:Workbook*/, opts/*:WriteOpts*/) {
var o = opts || {};
if(DENSE != null && o.dense == null) o.dense = DENSE;
var ba = buf_array();
var idx = 0;
for(var i=0;i<wb.SheetNames.length;++i) if(wb.SheetNames[i] == o.sheet) idx=i;
if(idx == 0 && !!o.sheet && wb.SheetNames[0] != o.sheet) throw new Error("Sheet not found: " + o.sheet);
write_biff_rec(ba, 0x0009, write_BOF(wb, 0x10, o));
/* ... */
write_ws_biff2(ba, wb.Sheets[wb.SheetNames[idx]], idx, o, wb);
/* ... */
write_biff_rec(ba, 0x000A);
return ba.end();
} | [
"function",
"write_biff2_buf",
"(",
"wb",
"/*:Workbook*/",
",",
"opts",
"/*:WriteOpts*/",
")",
"{",
"var",
"o",
"=",
"opts",
"||",
"{",
"}",
";",
"if",
"(",
"DENSE",
"!=",
"null",
"&&",
"o",
".",
"dense",
"==",
"null",
")",
"o",
".",
"dense",
"=",
... | /* Based on test files | [
"/",
"*",
"Based",
"on",
"test",
"files"
] | 9a6d8a1d3d80c78dad5201fb389316f935279cdc | https://github.com/SheetJS/js-xlsx/blob/9a6d8a1d3d80c78dad5201fb389316f935279cdc/bits/78_writebiff.js#L78-L91 | train | Writes a BIFF2 record to a workbook | [
30522,
3853,
4339,
1035,
12170,
4246,
2475,
1035,
20934,
2546,
1006,
25610,
1013,
1008,
1024,
2147,
8654,
1008,
1013,
1010,
23569,
2015,
1013,
1008,
1024,
4339,
7361,
3215,
1008,
1013,
1007,
1063,
13075,
1051,
1027,
23569,
2015,
1064,
1064,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/model/odata/v4/ODataMetaModel.js | annotationAtParameter | function annotationAtParameter(sSegment, sWholeSegment) {
var mAnnotationsXAllOverloads,
sIndividualOverloadTarget,
aOverloads,
sSignature = "",
sTerm = sWholeSegment.slice(sSegment.length);
if (sTerm && maybeParameter(sSegment, vResult)) {
// not looking for parameter itself, but for an annotation
sName = sSegment;
if (vBindingParameterType) {
aOverloads = vResult.filter(isRightOverload);
if (aOverloads.length !== 1) {
return log(WARNING, "Expected a single overload, but found "
+ aOverloads.length);
}
if (vBindingParameterType !== UNBOUND) {
sSignature = aOverloads[0].$Parameter[0].$isCollection
? "Collection(" + vBindingParameterType + ")"
: vBindingParameterType;
}
sIndividualOverloadTarget = sTarget + "(" + sSignature + ")/" + sSegment;
if (mScope.$Annotations[sIndividualOverloadTarget]) {
if (sTerm === "@") {
vResult = mScope.$Annotations[sIndividualOverloadTarget];
mAnnotationsXAllOverloads
= mScope.$Annotations[sTarget + "/" + sSegment];
if (mAnnotationsXAllOverloads) {
vResult = Object.assign({}, mAnnotationsXAllOverloads, vResult);
}
// sTarget does not matter because no further steps follow
return false; // no further steps must happen
}
if (mScope.$Annotations[sIndividualOverloadTarget][sTerm]) {
// "external targeting of individual action/function overload"
sTarget = sIndividualOverloadTarget;
return true;
}
}
}
// "the annotation applies to [...] all parameters of that name across all
// overloads"
sTarget += "/" + sSegment;
return true;
}
} | javascript | function annotationAtParameter(sSegment, sWholeSegment) {
var mAnnotationsXAllOverloads,
sIndividualOverloadTarget,
aOverloads,
sSignature = "",
sTerm = sWholeSegment.slice(sSegment.length);
if (sTerm && maybeParameter(sSegment, vResult)) {
// not looking for parameter itself, but for an annotation
sName = sSegment;
if (vBindingParameterType) {
aOverloads = vResult.filter(isRightOverload);
if (aOverloads.length !== 1) {
return log(WARNING, "Expected a single overload, but found "
+ aOverloads.length);
}
if (vBindingParameterType !== UNBOUND) {
sSignature = aOverloads[0].$Parameter[0].$isCollection
? "Collection(" + vBindingParameterType + ")"
: vBindingParameterType;
}
sIndividualOverloadTarget = sTarget + "(" + sSignature + ")/" + sSegment;
if (mScope.$Annotations[sIndividualOverloadTarget]) {
if (sTerm === "@") {
vResult = mScope.$Annotations[sIndividualOverloadTarget];
mAnnotationsXAllOverloads
= mScope.$Annotations[sTarget + "/" + sSegment];
if (mAnnotationsXAllOverloads) {
vResult = Object.assign({}, mAnnotationsXAllOverloads, vResult);
}
// sTarget does not matter because no further steps follow
return false; // no further steps must happen
}
if (mScope.$Annotations[sIndividualOverloadTarget][sTerm]) {
// "external targeting of individual action/function overload"
sTarget = sIndividualOverloadTarget;
return true;
}
}
}
// "the annotation applies to [...] all parameters of that name across all
// overloads"
sTarget += "/" + sSegment;
return true;
}
} | [
"function",
"annotationAtParameter",
"(",
"sSegment",
",",
"sWholeSegment",
")",
"{",
"var",
"mAnnotationsXAllOverloads",
",",
"sIndividualOverloadTarget",
",",
"aOverloads",
",",
"sSignature",
"=",
"\"\"",
",",
"sTerm",
"=",
"sWholeSegment",
".",
"slice",
"(",
"sSe... | current object /*
Handles annotation at action/function parameter, taking care of individual versus all
overloads.
@param {string} sSegment
The current <code>sSegment</code> of <code>step</code>
@param {string} sWholeSegment
The current <code>aSegments[i]</code> of <code>step</code>
@returns {boolean}
<code>undefined</code> if no annotation at action/function parameter was
recognized, <code>true</code> if further steps are needed, else <code>false</code>. | [
"current",
"object",
"/",
"*",
"Handles",
"annotation",
"at",
"action",
"/",
"function",
"parameter",
"taking",
"care",
"of",
"individual",
"versus",
"all",
"overloads",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/ODataMetaModel.js#L977-L1023 | train | This function is called when a parameter is found in the scope. | [
30522,
3853,
5754,
17287,
3508,
4017,
28689,
22828,
1006,
7020,
13910,
3672,
1010,
25430,
19990,
13910,
3672,
1007,
1063,
13075,
10856,
17287,
9285,
18684,
7174,
6299,
11066,
2015,
1010,
8254,
4305,
17258,
8787,
7840,
11066,
7559,
18150,
1010... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/thirdparty/RequestRecorder.js | resolveURL | function resolveURL(url) {
return new URI(url).absoluteTo(new URI(document.baseURI).search("")).toString();
} | javascript | function resolveURL(url) {
return new URI(url).absoluteTo(new URI(document.baseURI).search("")).toString();
} | [
"function",
"resolveURL",
"(",
"url",
")",
"{",
"return",
"new",
"URI",
"(",
"url",
")",
".",
"absoluteTo",
"(",
"new",
"URI",
"(",
"document",
".",
"baseURI",
")",
".",
"search",
"(",
"\"\"",
")",
")",
".",
"toString",
"(",
")",
";",
"}"
] | resolves the given (potentially relative) URL in the same way as the browser would resolve it | [
"resolves",
"the",
"given",
"(",
"potentially",
"relative",
")",
"URL",
"in",
"the",
"same",
"way",
"as",
"the",
"browser",
"would",
"resolve",
"it"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/RequestRecorder.js#L21-L23 | train | Resolve a URL to a base URI | [
30522,
3853,
10663,
3126,
2140,
1006,
24471,
2140,
1007,
1063,
2709,
2047,
24471,
2072,
1006,
24471,
2140,
1007,
1012,
7619,
3406,
1006,
2047,
24471,
2072,
1006,
6254,
1012,
2918,
9496,
1007,
1012,
3945,
1006,
1000,
1000,
1007,
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... |
TryGhost/Ghost | core/server/update-check.js | createCustomNotification | function createCustomNotification(notification) {
if (!notification) {
return Promise.resolve();
}
return Promise.each(notification.messages, function (message) {
let toAdd = {
// @NOTE: the update check service returns "0" or "1" (https://github.com/TryGhost/UpdateCheck/issues/43)
custom: !!notification.custom,
createdAt: moment(notification.created_at).toDate(),
status: message.status || 'alert',
type: message.type || 'info',
id: message.id,
dismissible: message.hasOwnProperty('dismissible') ? message.dismissible : true,
top: !!message.top,
message: message.content
};
debug('Add Custom Notification', toAdd);
return api.notifications.add({notifications: [toAdd]}, {context: {internal: true}});
});
} | javascript | function createCustomNotification(notification) {
if (!notification) {
return Promise.resolve();
}
return Promise.each(notification.messages, function (message) {
let toAdd = {
// @NOTE: the update check service returns "0" or "1" (https://github.com/TryGhost/UpdateCheck/issues/43)
custom: !!notification.custom,
createdAt: moment(notification.created_at).toDate(),
status: message.status || 'alert',
type: message.type || 'info',
id: message.id,
dismissible: message.hasOwnProperty('dismissible') ? message.dismissible : true,
top: !!message.top,
message: message.content
};
debug('Add Custom Notification', toAdd);
return api.notifications.add({notifications: [toAdd]}, {context: {internal: true}});
});
} | [
"function",
"createCustomNotification",
"(",
"notification",
")",
"{",
"if",
"(",
"!",
"notification",
")",
"{",
"return",
"Promise",
".",
"resolve",
"(",
")",
";",
"}",
"return",
"Promise",
".",
"each",
"(",
"notification",
".",
"messages",
",",
"function",... | @description Create a Ghost notification and call the API controller.
@param {Object} notification
@return {Promise} | [
"@description",
"Create",
"a",
"Ghost",
"notification",
"and",
"call",
"the",
"API",
"controller",
"."
] | bb7bb55cf3e60af99ebbc56099928827b58461bc | https://github.com/TryGhost/Ghost/blob/bb7bb55cf3e60af99ebbc56099928827b58461bc/core/server/update-check.js#L62-L83 | train | Create Custom Notification | [
30522,
3853,
3443,
7874,
20389,
17048,
9031,
1006,
26828,
1007,
1063,
2065,
1006,
999,
26828,
1007,
1063,
2709,
4872,
1012,
10663,
1006,
1007,
1025,
1065,
2709,
4872,
1012,
2169,
1006,
26828,
1012,
7696,
1010,
3853,
1006,
4471,
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... |
firebase/firebase-js-sdk | packages/auth/demo/public/script.js | onReauthConfirmPhoneVerification | function onReauthConfirmPhoneVerification() {
var verificationId = $('#link-reauth-phone-verification-id').val();
var verificationCode = $('#link-reauth-phone-verification-code').val();
var credential = firebase.auth.PhoneAuthProvider.credential(
verificationId, verificationCode);
activeUser().reauthenticateWithCredential(credential)
.then(function(result) {
logAdditionalUserInfo(result);
refreshUserData();
alertSuccess('User reauthenticated!');
}, onAuthError);
} | javascript | function onReauthConfirmPhoneVerification() {
var verificationId = $('#link-reauth-phone-verification-id').val();
var verificationCode = $('#link-reauth-phone-verification-code').val();
var credential = firebase.auth.PhoneAuthProvider.credential(
verificationId, verificationCode);
activeUser().reauthenticateWithCredential(credential)
.then(function(result) {
logAdditionalUserInfo(result);
refreshUserData();
alertSuccess('User reauthenticated!');
}, onAuthError);
} | [
"function",
"onReauthConfirmPhoneVerification",
"(",
")",
"{",
"var",
"verificationId",
"=",
"$",
"(",
"'#link-reauth-phone-verification-id'",
")",
".",
"val",
"(",
")",
";",
"var",
"verificationCode",
"=",
"$",
"(",
"'#link-reauth-phone-verification-code'",
")",
".",... | Confirms a phone number verification for reauthentication. | [
"Confirms",
"a",
"phone",
"number",
"verification",
"for",
"reauthentication",
"."
] | 491598a499813dacc23724de5e237ec220cc560e | https://github.com/firebase/firebase-js-sdk/blob/491598a499813dacc23724de5e237ec220cc560e/packages/auth/demo/public/script.js#L523-L534 | train | Confirm user s phone verification | [
30522,
3853,
2006,
16416,
14317,
8663,
27972,
9864,
6299,
9031,
1006,
1007,
1063,
13075,
22616,
3593,
1027,
1002,
1006,
1005,
1001,
4957,
1011,
2128,
4887,
2705,
1011,
3042,
1011,
22616,
1011,
8909,
1005,
1007,
1012,
11748,
1006,
1007,
1025... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/view/MainViewManager.js | _forEachPaneOrPanes | function _forEachPaneOrPanes(paneId, callback) {
if (paneId === ALL_PANES) {
_.forEach(_panes, callback);
} else {
callback(_getPane(paneId));
}
} | javascript | function _forEachPaneOrPanes(paneId, callback) {
if (paneId === ALL_PANES) {
_.forEach(_panes, callback);
} else {
callback(_getPane(paneId));
}
} | [
"function",
"_forEachPaneOrPanes",
"(",
"paneId",
",",
"callback",
")",
"{",
"if",
"(",
"paneId",
"===",
"ALL_PANES",
")",
"{",
"_",
".",
"forEach",
"(",
"_panes",
",",
"callback",
")",
";",
"}",
"else",
"{",
"callback",
"(",
"_getPane",
"(",
"paneId",
... | Iterates over the pane or ALL_PANES and calls the callback function for each.
@param {!string} paneId - id of the pane in which to adjust the scroll state, ALL_PANES or ACTIVE_PANE
@param {!function(!pane:Pane):boolean} callback - function to callback on to perform work.
The callback will receive a Pane and should return false to stop iterating.
@private | [
"Iterates",
"over",
"the",
"pane",
"or",
"ALL_PANES",
"and",
"calls",
"the",
"callback",
"function",
"for",
"each",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/view/MainViewManager.js#L486-L492 | train | For each pane or panes | [
30522,
3853,
1035,
18921,
6776,
9739,
8780,
14536,
7231,
2015,
1006,
6090,
7416,
2094,
1010,
2655,
5963,
1007,
1063,
2065,
1006,
6090,
7416,
2094,
1027,
1027,
1027,
2035,
1035,
6090,
2229,
1007,
1063,
1035,
1012,
18921,
6776,
1006,
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... |
adobe/brackets | src/document/DocumentManager.js | removeListFromWorkingSet | function removeListFromWorkingSet(list) {
DeprecationWarning.deprecationWarning("Use CommandManager.execute(Commands.FILE_CLOSE_LIST, {PaneId: MainViewManager.ALL_PANES, fileList: list}) instead of DocumentManager.removeListFromWorkingSet()", true);
CommandManager.execute(Commands.FILE_CLOSE_LIST, {PaneId: MainViewManager.ALL_PANES, fileList: list});
} | javascript | function removeListFromWorkingSet(list) {
DeprecationWarning.deprecationWarning("Use CommandManager.execute(Commands.FILE_CLOSE_LIST, {PaneId: MainViewManager.ALL_PANES, fileList: list}) instead of DocumentManager.removeListFromWorkingSet()", true);
CommandManager.execute(Commands.FILE_CLOSE_LIST, {PaneId: MainViewManager.ALL_PANES, fileList: list});
} | [
"function",
"removeListFromWorkingSet",
"(",
"list",
")",
"{",
"DeprecationWarning",
".",
"deprecationWarning",
"(",
"\"Use CommandManager.execute(Commands.FILE_CLOSE_LIST, {PaneId: MainViewManager.ALL_PANES, fileList: list}) instead of DocumentManager.removeListFromWorkingSet()\"",
",",
"tr... | closes a list of files
@deprecated Use CommandManager.execute(Commands.FILE_CLOSE_LIST) instead
@param {!Array.<File>} list - list of File objectgs to close | [
"closes",
"a",
"list",
"of",
"files"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/document/DocumentManager.js#L228-L231 | train | Removes a list of files from the working set | [
30522,
3853,
6366,
9863,
19699,
5358,
21398,
13462,
1006,
2862,
1007,
1063,
2139,
28139,
10719,
9028,
5582,
1012,
2139,
28139,
10719,
9028,
5582,
1006,
1000,
2224,
3094,
24805,
4590,
1012,
15389,
1006,
10954,
1012,
5371,
1035,
2485,
1035,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
eslint/eslint | lib/linter.js | markVariableAsUsed | function markVariableAsUsed(scopeManager, currentNode, parserOptions, name) {
const hasGlobalReturn = parserOptions.ecmaFeatures && parserOptions.ecmaFeatures.globalReturn;
const specialScope = hasGlobalReturn || parserOptions.sourceType === "module";
const currentScope = getScope(scopeManager, currentNode);
// Special Node.js scope means we need to start one level deeper
const initialScope = currentScope.type === "global" && specialScope ? currentScope.childScopes[0] : currentScope;
for (let scope = initialScope; scope; scope = scope.upper) {
const variable = scope.variables.find(scopeVar => scopeVar.name === name);
if (variable) {
variable.eslintUsed = true;
return true;
}
}
return false;
} | javascript | function markVariableAsUsed(scopeManager, currentNode, parserOptions, name) {
const hasGlobalReturn = parserOptions.ecmaFeatures && parserOptions.ecmaFeatures.globalReturn;
const specialScope = hasGlobalReturn || parserOptions.sourceType === "module";
const currentScope = getScope(scopeManager, currentNode);
// Special Node.js scope means we need to start one level deeper
const initialScope = currentScope.type === "global" && specialScope ? currentScope.childScopes[0] : currentScope;
for (let scope = initialScope; scope; scope = scope.upper) {
const variable = scope.variables.find(scopeVar => scopeVar.name === name);
if (variable) {
variable.eslintUsed = true;
return true;
}
}
return false;
} | [
"function",
"markVariableAsUsed",
"(",
"scopeManager",
",",
"currentNode",
",",
"parserOptions",
",",
"name",
")",
"{",
"const",
"hasGlobalReturn",
"=",
"parserOptions",
".",
"ecmaFeatures",
"&&",
"parserOptions",
".",
"ecmaFeatures",
".",
"globalReturn",
";",
"cons... | Marks a variable as used in the current scope
@param {ScopeManager} scopeManager The scope manager for this AST. The scope may be mutated by this function.
@param {ASTNode} currentNode The node currently being traversed
@param {Object} parserOptions The options used to parse this text
@param {string} name The name of the variable that should be marked as used.
@returns {boolean} True if the variable was found and marked as used, false if not. | [
"Marks",
"a",
"variable",
"as",
"used",
"in",
"the",
"current",
"scope"
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/linter.js#L573-L591 | train | Mark a variable as used | [
30522,
3853,
2928,
10755,
19210,
3022,
13901,
1006,
9531,
24805,
4590,
1010,
2783,
3630,
3207,
1010,
11968,
8043,
7361,
9285,
1010,
2171,
1007,
1063,
9530,
3367,
2038,
23296,
16429,
2389,
13465,
14287,
1027,
11968,
8043,
7361,
9285,
1012,
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... |
necolas/react-native-web | packages/react-native-web/src/vendor/react-native/PanResponder/index.js | function (config) {
const interactionState = {
handle: (null: ?number),
};
const gestureState = {
// Useful for debugging
stateID: Math.random(),
};
PanResponder._initializeGestureState(gestureState);
const panHandlers = {
onStartShouldSetResponder: function (e) {
return config.onStartShouldSetPanResponder === undefined ?
false :
config.onStartShouldSetPanResponder(e, gestureState);
},
onMoveShouldSetResponder: function (e) {
return config.onMoveShouldSetPanResponder === undefined ?
false :
config.onMoveShouldSetPanResponder(e, gestureState);
},
onStartShouldSetResponderCapture: function (e) {
// TODO: Actually, we should reinitialize the state any time
// touches.length increases from 0 active to > 0 active.
if (e.nativeEvent.touches.length === 1) {
PanResponder._initializeGestureState(gestureState);
}
gestureState.numberActiveTouches = e.touchHistory.numberActiveTouches;
return config.onStartShouldSetPanResponderCapture !== undefined ?
config.onStartShouldSetPanResponderCapture(e, gestureState) :
false;
},
onMoveShouldSetResponderCapture: function (e) {
const touchHistory = e.touchHistory;
// Responder system incorrectly dispatches should* to current responder
// Filter out any touch moves past the first one - we would have
// already processed multi-touch geometry during the first event.
if (gestureState._accountsForMovesUpTo === touchHistory.mostRecentTimeStamp) {
return false;
}
PanResponder._updateGestureStateOnMove(gestureState, touchHistory);
return config.onMoveShouldSetPanResponderCapture ?
config.onMoveShouldSetPanResponderCapture(e, gestureState) :
false;
},
onResponderGrant: function (e) {
if (!interactionState.handle) {
interactionState.handle = InteractionManager.createInteractionHandle();
}
gestureState.x0 = currentCentroidX(e.touchHistory);
gestureState.y0 = currentCentroidY(e.touchHistory);
gestureState.dx = 0;
gestureState.dy = 0;
if (config.onPanResponderGrant) {
config.onPanResponderGrant(e, gestureState);
}
// TODO: t7467124 investigate if this can be removed
return config.onShouldBlockNativeResponder === undefined ?
true :
config.onShouldBlockNativeResponder();
},
onResponderReject: function (e) {
clearInteractionHandle(interactionState, config.onPanResponderReject, e, gestureState);
},
onResponderRelease: function (e) {
clearInteractionHandle(interactionState, config.onPanResponderRelease, e, gestureState);
PanResponder._initializeGestureState(gestureState);
},
onResponderStart: function (e) {
const touchHistory = e.touchHistory;
gestureState.numberActiveTouches = touchHistory.numberActiveTouches;
if (config.onPanResponderStart) {
config.onPanResponderStart(e, gestureState);
}
},
onResponderMove: function (e) {
const touchHistory = e.touchHistory;
// Guard against the dispatch of two touch moves when there are two
// simultaneously changed touches.
if (gestureState._accountsForMovesUpTo === touchHistory.mostRecentTimeStamp) {
return;
}
// Filter out any touch moves past the first one - we would have
// already processed multi-touch geometry during the first event.
PanResponder._updateGestureStateOnMove(gestureState, touchHistory);
if (config.onPanResponderMove) {
config.onPanResponderMove(e, gestureState);
}
},
onResponderEnd: function (e) {
const touchHistory = e.touchHistory;
gestureState.numberActiveTouches = touchHistory.numberActiveTouches;
clearInteractionHandle(interactionState, config.onPanResponderEnd, e, gestureState);
},
onResponderTerminate: function (e) {
clearInteractionHandle(interactionState, config.onPanResponderTerminate, e, gestureState);
PanResponder._initializeGestureState(gestureState);
},
onResponderTerminationRequest: function (e) {
return config.onPanResponderTerminationRequest === undefined ?
true :
config.onPanResponderTerminationRequest(e, gestureState);
}
};
return {
panHandlers,
getInteractionHandle(): ?number {
return interactionState.handle;
},
};
} | javascript | function (config) {
const interactionState = {
handle: (null: ?number),
};
const gestureState = {
// Useful for debugging
stateID: Math.random(),
};
PanResponder._initializeGestureState(gestureState);
const panHandlers = {
onStartShouldSetResponder: function (e) {
return config.onStartShouldSetPanResponder === undefined ?
false :
config.onStartShouldSetPanResponder(e, gestureState);
},
onMoveShouldSetResponder: function (e) {
return config.onMoveShouldSetPanResponder === undefined ?
false :
config.onMoveShouldSetPanResponder(e, gestureState);
},
onStartShouldSetResponderCapture: function (e) {
// TODO: Actually, we should reinitialize the state any time
// touches.length increases from 0 active to > 0 active.
if (e.nativeEvent.touches.length === 1) {
PanResponder._initializeGestureState(gestureState);
}
gestureState.numberActiveTouches = e.touchHistory.numberActiveTouches;
return config.onStartShouldSetPanResponderCapture !== undefined ?
config.onStartShouldSetPanResponderCapture(e, gestureState) :
false;
},
onMoveShouldSetResponderCapture: function (e) {
const touchHistory = e.touchHistory;
// Responder system incorrectly dispatches should* to current responder
// Filter out any touch moves past the first one - we would have
// already processed multi-touch geometry during the first event.
if (gestureState._accountsForMovesUpTo === touchHistory.mostRecentTimeStamp) {
return false;
}
PanResponder._updateGestureStateOnMove(gestureState, touchHistory);
return config.onMoveShouldSetPanResponderCapture ?
config.onMoveShouldSetPanResponderCapture(e, gestureState) :
false;
},
onResponderGrant: function (e) {
if (!interactionState.handle) {
interactionState.handle = InteractionManager.createInteractionHandle();
}
gestureState.x0 = currentCentroidX(e.touchHistory);
gestureState.y0 = currentCentroidY(e.touchHistory);
gestureState.dx = 0;
gestureState.dy = 0;
if (config.onPanResponderGrant) {
config.onPanResponderGrant(e, gestureState);
}
// TODO: t7467124 investigate if this can be removed
return config.onShouldBlockNativeResponder === undefined ?
true :
config.onShouldBlockNativeResponder();
},
onResponderReject: function (e) {
clearInteractionHandle(interactionState, config.onPanResponderReject, e, gestureState);
},
onResponderRelease: function (e) {
clearInteractionHandle(interactionState, config.onPanResponderRelease, e, gestureState);
PanResponder._initializeGestureState(gestureState);
},
onResponderStart: function (e) {
const touchHistory = e.touchHistory;
gestureState.numberActiveTouches = touchHistory.numberActiveTouches;
if (config.onPanResponderStart) {
config.onPanResponderStart(e, gestureState);
}
},
onResponderMove: function (e) {
const touchHistory = e.touchHistory;
// Guard against the dispatch of two touch moves when there are two
// simultaneously changed touches.
if (gestureState._accountsForMovesUpTo === touchHistory.mostRecentTimeStamp) {
return;
}
// Filter out any touch moves past the first one - we would have
// already processed multi-touch geometry during the first event.
PanResponder._updateGestureStateOnMove(gestureState, touchHistory);
if (config.onPanResponderMove) {
config.onPanResponderMove(e, gestureState);
}
},
onResponderEnd: function (e) {
const touchHistory = e.touchHistory;
gestureState.numberActiveTouches = touchHistory.numberActiveTouches;
clearInteractionHandle(interactionState, config.onPanResponderEnd, e, gestureState);
},
onResponderTerminate: function (e) {
clearInteractionHandle(interactionState, config.onPanResponderTerminate, e, gestureState);
PanResponder._initializeGestureState(gestureState);
},
onResponderTerminationRequest: function (e) {
return config.onPanResponderTerminationRequest === undefined ?
true :
config.onPanResponderTerminationRequest(e, gestureState);
}
};
return {
panHandlers,
getInteractionHandle(): ?number {
return interactionState.handle;
},
};
} | [
"function",
"(",
"config",
")",
"{",
"const",
"interactionState",
"=",
"{",
"handle",
":",
"(",
"null",
":",
"?",
"number",
")",
",",
"}",
";",
"const",
"gestureState",
"=",
"{",
"// Useful for debugging",
"stateID",
":",
"Math",
".",
"random",
"(",
")",... | @param {object} config Enhanced versions of all of the responder callbacks
that provide not only the typical `ResponderSyntheticEvent`, but also the
`PanResponder` gesture state. Simply replace the word `Responder` with
`PanResponder` in each of the typical `onResponder*` callbacks. For
example, the `config` object would look like:
- `onMoveShouldSetPanResponder: (e, gestureState) => {...}`
- `onMoveShouldSetPanResponderCapture: (e, gestureState) => {...}`
- `onStartShouldSetPanResponder: (e, gestureState) => {...}`
- `onStartShouldSetPanResponderCapture: (e, gestureState) => {...}`
- `onPanResponderReject: (e, gestureState) => {...}`
- `onPanResponderGrant: (e, gestureState) => {...}`
- `onPanResponderStart: (e, gestureState) => {...}`
- `onPanResponderEnd: (e, gestureState) => {...}`
- `onPanResponderRelease: (e, gestureState) => {...}`
- `onPanResponderMove: (e, gestureState) => {...}`
- `onPanResponderTerminate: (e, gestureState) => {...}`
- `onPanResponderTerminationRequest: (e, gestureState) => {...}`
- `onShouldBlockNativeResponder: (e, gestureState) => {...}`
In general, for events that have capture equivalents, we update the
gestureState once in the capture phase and can use it in the bubble phase
as well.
Be careful with onStartShould* callbacks. They only reflect updated
`gestureState` for start/end events that bubble/capture to the Node.
Once the node is the responder, you can rely on every start/end event
being processed by the gesture and `gestureState` being updated
accordingly. (numberActiveTouches) may not be totally accurate unless you
are the responder. | [
"@param",
"{",
"object",
"}",
"config",
"Enhanced",
"versions",
"of",
"all",
"of",
"the",
"responder",
"callbacks",
"that",
"provide",
"not",
"only",
"the",
"typical",
"ResponderSyntheticEvent",
"but",
"also",
"the",
"PanResponder",
"gesture",
"state",
".",
"Sim... | 801937748b2f3c96284bee1881164ac0c62a9c6d | https://github.com/necolas/react-native-web/blob/801937748b2f3c96284bee1881164ac0c62a9c6d/packages/react-native-web/src/vendor/react-native/PanResponder/index.js#L273-L391 | train | Creates a new state object for the pan responder system | [
30522,
3853,
1006,
9530,
8873,
2290,
1007,
1063,
9530,
3367,
10266,
12259,
1027,
1063,
5047,
1024,
1006,
19701,
1024,
1029,
2193,
1007,
1010,
1065,
1025,
9530,
3367,
18327,
12259,
1027,
1063,
1013,
1013,
6179,
2005,
2139,
8569,
12588,
2110,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.