repo stringclasses 192 values | path stringlengths 4 115 | func_name stringlengths 0 45 | original_string stringlengths 74 24k | language stringclasses 1 value | code stringlengths 74 24k | code_tokens listlengths 23 4.2k | docstring stringlengths 2 23.7k | docstring_tokens listlengths 1 810 | sha stringclasses 192 values | url stringlengths 90 200 | partition stringclasses 1 value | summary stringlengths 6 313 | input_ids listlengths 502 502 | token_type_ids listlengths 502 502 | attention_mask listlengths 502 502 | labels listlengths 502 502 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
electron/electron | lib/browser/chrome-extension.js | function (request, callback) {
const parsed = url.parse(request.url)
if (!parsed.hostname || !parsed.path) return callback()
const manifest = manifestMap[parsed.hostname]
if (!manifest) return callback()
const page = backgroundPages[parsed.hostname]
if (page && parsed.path === `/${page.name}`) {
// Disabled due to false positive in StandardJS
// eslint-disable-next-line standard/no-callback-literal
return callback({
mimeType: 'text/html',
data: page.html
})
}
fs.readFile(path.join(manifest.srcDirectory, parsed.path), function (err, content) {
if (err) {
// Disabled due to false positive in StandardJS
// eslint-disable-next-line standard/no-callback-literal
return callback(-6) // FILE_NOT_FOUND
} else {
return callback(content)
}
})
} | javascript | function (request, callback) {
const parsed = url.parse(request.url)
if (!parsed.hostname || !parsed.path) return callback()
const manifest = manifestMap[parsed.hostname]
if (!manifest) return callback()
const page = backgroundPages[parsed.hostname]
if (page && parsed.path === `/${page.name}`) {
// Disabled due to false positive in StandardJS
// eslint-disable-next-line standard/no-callback-literal
return callback({
mimeType: 'text/html',
data: page.html
})
}
fs.readFile(path.join(manifest.srcDirectory, parsed.path), function (err, content) {
if (err) {
// Disabled due to false positive in StandardJS
// eslint-disable-next-line standard/no-callback-literal
return callback(-6) // FILE_NOT_FOUND
} else {
return callback(content)
}
})
} | [
"function",
"(",
"request",
",",
"callback",
")",
"{",
"const",
"parsed",
"=",
"url",
".",
"parse",
"(",
"request",
".",
"url",
")",
"if",
"(",
"!",
"parsed",
".",
"hostname",
"||",
"!",
"parsed",
".",
"path",
")",
"return",
"callback",
"(",
")",
"... | The chrome-extension: can map a extension URL request to real file path. | [
"The",
"chrome",
"-",
"extension",
":",
"can",
"map",
"a",
"extension",
"URL",
"request",
"to",
"real",
"file",
"path",
"."
] | 6e29611788277729647acf465f10db1ea6f15788 | https://github.com/electron/electron/blob/6e29611788277729647acf465f10db1ea6f15788/lib/browser/chrome-extension.js#L394-L420 | train | Get the content of the specified resource | [
30522,
3853,
1006,
5227,
1010,
2655,
5963,
1007,
1063,
9530,
3367,
11968,
6924,
1027,
24471,
2140,
1012,
11968,
3366,
1006,
5227,
1012,
24471,
2140,
1007,
2065,
1006,
999,
11968,
6924,
1012,
3677,
18442,
1064,
1064,
999,
11968,
6924,
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... | |
eslint/eslint | lib/util/lint-result-cache.js | hashOfConfigFor | function hashOfConfigFor(configHelper, filename) {
const config = configHelper.getConfig(filename);
if (!configHashCache.has(config)) {
configHashCache.set(config, hash(`${pkg.version}_${stringify(config)}`));
}
return configHashCache.get(config);
} | javascript | function hashOfConfigFor(configHelper, filename) {
const config = configHelper.getConfig(filename);
if (!configHashCache.has(config)) {
configHashCache.set(config, hash(`${pkg.version}_${stringify(config)}`));
}
return configHashCache.get(config);
} | [
"function",
"hashOfConfigFor",
"(",
"configHelper",
",",
"filename",
")",
"{",
"const",
"config",
"=",
"configHelper",
".",
"getConfig",
"(",
"filename",
")",
";",
"if",
"(",
"!",
"configHashCache",
".",
"has",
"(",
"config",
")",
")",
"{",
"configHashCache"... | Calculates the hash of the config file used to validate a given file
@param {Object} configHelper The config helper for retrieving configuration information
@param {string} filename The path of the file to retrieve a config object for to calculate the hash
@returns {string} The hash of the config | [
"Calculates",
"the",
"hash",
"of",
"the",
"config",
"file",
"used",
"to",
"validate",
"a",
"given",
"file"
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/util/lint-result-cache.js#L30-L38 | train | Returns the hash of the config for the given filename | [
30522,
3853,
23325,
11253,
8663,
8873,
25708,
2953,
1006,
9530,
8873,
5603,
2884,
4842,
1010,
5371,
18442,
1007,
1063,
9530,
3367,
9530,
8873,
2290,
1027,
9530,
8873,
5603,
2884,
4842,
1012,
2131,
8663,
8873,
2290,
1006,
5371,
18442,
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.table/src/sap/ui/table/TableAccExtension.js | function($Cell, oCell) {
var bGroup = TableUtils.Grouping.isInGroupingRow($Cell);
var bSum = TableUtils.Grouping.isInSumRow($Cell);
var bSupportStyleClass = !!oCell && !!oCell.hasStyleClass;
var bIsRowHidden = $Cell.parent().hasClass("sapUiTableRowHidden");
var bIsCellHidden = $Cell.hasClass("sapUiTableCellHidden");
var bNoMeasureInFirstCellInGroup = bGroup && $Cell.hasClass("sapUiTableCellFirst") && !$Cell.hasClass("sapUiTableMeasureCell");
var bGroupCellHiddenByApp = bGroup && bSupportStyleClass && oCell.hasStyleClass("sapUiAnalyticalTableGroupCellHidden");
var bSumCellHiddenByApp = bSum && bSupportStyleClass && oCell.hasStyleClass("sapUiAnalyticalTableSumCellHidden");
return bIsRowHidden || bIsCellHidden || bNoMeasureInFirstCellInGroup || bGroupCellHiddenByApp || bSumCellHiddenByApp;
} | javascript | function($Cell, oCell) {
var bGroup = TableUtils.Grouping.isInGroupingRow($Cell);
var bSum = TableUtils.Grouping.isInSumRow($Cell);
var bSupportStyleClass = !!oCell && !!oCell.hasStyleClass;
var bIsRowHidden = $Cell.parent().hasClass("sapUiTableRowHidden");
var bIsCellHidden = $Cell.hasClass("sapUiTableCellHidden");
var bNoMeasureInFirstCellInGroup = bGroup && $Cell.hasClass("sapUiTableCellFirst") && !$Cell.hasClass("sapUiTableMeasureCell");
var bGroupCellHiddenByApp = bGroup && bSupportStyleClass && oCell.hasStyleClass("sapUiAnalyticalTableGroupCellHidden");
var bSumCellHiddenByApp = bSum && bSupportStyleClass && oCell.hasStyleClass("sapUiAnalyticalTableSumCellHidden");
return bIsRowHidden || bIsCellHidden || bNoMeasureInFirstCellInGroup || bGroupCellHiddenByApp || bSumCellHiddenByApp;
} | [
"function",
"(",
"$Cell",
",",
"oCell",
")",
"{",
"var",
"bGroup",
"=",
"TableUtils",
".",
"Grouping",
".",
"isInGroupingRow",
"(",
"$Cell",
")",
";",
"var",
"bSum",
"=",
"TableUtils",
".",
"Grouping",
".",
"isInSumRow",
"(",
"$Cell",
")",
";",
"var",
... | /*
Returns whether the given cell is hidden | [
"/",
"*",
"Returns",
"whether",
"the",
"given",
"cell",
"is",
"hidden"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableAccExtension.js#L192-L204 | train | Returns true if the given cell is in the table. | [
30522,
3853,
1006,
1002,
3526,
1010,
1051,
29109,
2140,
1007,
1063,
13075,
1038,
17058,
1027,
2795,
21823,
4877,
1012,
19765,
1012,
2003,
2075,
22107,
2075,
10524,
1006,
1002,
3526,
1007,
1025,
13075,
18667,
2819,
1027,
2795,
21823,
4877,
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... | |
GitbookIO/gitbook | lib/output/callPageHook.js | callPageHook | function callPageHook(name, output, page) {
return callHook(
name,
function(out) {
return Api.encodePage(out, page);
},
function(out, result) {
return Api.decodePage(out, page, result);
},
output
);
} | javascript | function callPageHook(name, output, page) {
return callHook(
name,
function(out) {
return Api.encodePage(out, page);
},
function(out, result) {
return Api.decodePage(out, page, result);
},
output
);
} | [
"function",
"callPageHook",
"(",
"name",
",",
"output",
",",
"page",
")",
"{",
"return",
"callHook",
"(",
"name",
",",
"function",
"(",
"out",
")",
"{",
"return",
"Api",
".",
"encodePage",
"(",
"out",
",",
"page",
")",
";",
"}",
",",
"function",
"(",... | Call a hook for a specific page
@param {String} name
@param {Output} output
@param {Page} page
@return {Promise<Page>} | [
"Call",
"a",
"hook",
"for",
"a",
"specific",
"page"
] | 6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4 | https://github.com/GitbookIO/gitbook/blob/6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4/lib/output/callPageHook.js#L12-L26 | train | Call a page hook | [
30522,
3853,
2655,
13704,
6806,
6559,
1006,
2171,
1010,
6434,
1010,
3931,
1007,
1063,
2709,
2655,
6806,
6559,
1006,
2171,
1010,
3853,
1006,
2041,
1007,
1063,
2709,
17928,
1012,
4372,
16044,
13704,
1006,
2041,
1010,
3931,
1007,
1025,
1065,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
jgraph/mxgraph | javascript/mxClient.js | function(graph, scale, cells, x0, y0)
{
x0 = (x0 != null) ? x0 : 0;
y0 = (y0 != null) ? y0 : 0;
scale = (scale != null) ? scale : 1;
if (cells == null)
{
var model = graph.getModel();
cells = [model.getRoot()];
}
var view = graph.getView();
var result = null;
// Disables events on the view
var eventsEnabled = view.isEventsEnabled();
view.setEventsEnabled(false);
// Workaround for label bounds not taken into account for image export.
// Creates a temporary draw pane which is used for rendering the text.
// Text rendering is required for finding the bounds of the labels.
var drawPane = view.drawPane;
var overlayPane = view.overlayPane;
if (graph.dialect == mxConstants.DIALECT_SVG)
{
view.drawPane = document.createElementNS(mxConstants.NS_SVG, 'g');
view.canvas.appendChild(view.drawPane);
// Redirects cell overlays into temporary container
view.overlayPane = document.createElementNS(mxConstants.NS_SVG, 'g');
view.canvas.appendChild(view.overlayPane);
}
else
{
view.drawPane = view.drawPane.cloneNode(false);
view.canvas.appendChild(view.drawPane);
// Redirects cell overlays into temporary container
view.overlayPane = view.overlayPane.cloneNode(false);
view.canvas.appendChild(view.overlayPane);
}
// Resets the translation
var translate = view.getTranslate();
view.translate = new mxPoint(x0, y0);
// Creates the temporary cell states in the view
var temp = new mxTemporaryCellStates(graph.getView(), scale, cells);
try
{
var enc = new mxCodec();
result = enc.encode(graph.getView());
}
finally
{
temp.destroy();
view.translate = translate;
view.canvas.removeChild(view.drawPane);
view.canvas.removeChild(view.overlayPane);
view.drawPane = drawPane;
view.overlayPane = overlayPane;
view.setEventsEnabled(eventsEnabled);
}
return result;
} | javascript | function(graph, scale, cells, x0, y0)
{
x0 = (x0 != null) ? x0 : 0;
y0 = (y0 != null) ? y0 : 0;
scale = (scale != null) ? scale : 1;
if (cells == null)
{
var model = graph.getModel();
cells = [model.getRoot()];
}
var view = graph.getView();
var result = null;
// Disables events on the view
var eventsEnabled = view.isEventsEnabled();
view.setEventsEnabled(false);
// Workaround for label bounds not taken into account for image export.
// Creates a temporary draw pane which is used for rendering the text.
// Text rendering is required for finding the bounds of the labels.
var drawPane = view.drawPane;
var overlayPane = view.overlayPane;
if (graph.dialect == mxConstants.DIALECT_SVG)
{
view.drawPane = document.createElementNS(mxConstants.NS_SVG, 'g');
view.canvas.appendChild(view.drawPane);
// Redirects cell overlays into temporary container
view.overlayPane = document.createElementNS(mxConstants.NS_SVG, 'g');
view.canvas.appendChild(view.overlayPane);
}
else
{
view.drawPane = view.drawPane.cloneNode(false);
view.canvas.appendChild(view.drawPane);
// Redirects cell overlays into temporary container
view.overlayPane = view.overlayPane.cloneNode(false);
view.canvas.appendChild(view.overlayPane);
}
// Resets the translation
var translate = view.getTranslate();
view.translate = new mxPoint(x0, y0);
// Creates the temporary cell states in the view
var temp = new mxTemporaryCellStates(graph.getView(), scale, cells);
try
{
var enc = new mxCodec();
result = enc.encode(graph.getView());
}
finally
{
temp.destroy();
view.translate = translate;
view.canvas.removeChild(view.drawPane);
view.canvas.removeChild(view.overlayPane);
view.drawPane = drawPane;
view.overlayPane = overlayPane;
view.setEventsEnabled(eventsEnabled);
}
return result;
} | [
"function",
"(",
"graph",
",",
"scale",
",",
"cells",
",",
"x0",
",",
"y0",
")",
"{",
"x0",
"=",
"(",
"x0",
"!=",
"null",
")",
"?",
"x0",
":",
"0",
";",
"y0",
"=",
"(",
"y0",
"!=",
"null",
")",
"?",
"y0",
":",
"0",
";",
"scale",
"=",
"(",... | Function: getViewXml | [
"Function",
":",
"getViewXml"
] | 33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44 | https://github.com/jgraph/mxgraph/blob/33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44/javascript/mxClient.js#L5798-L5866 | train | Creates a temporary view that can be used to draw the graph. | [
30522,
3853,
1006,
10629,
1010,
4094,
1010,
4442,
1010,
1060,
2692,
1010,
1061,
2692,
1007,
1063,
1060,
2692,
1027,
1006,
1060,
2692,
999,
1027,
19701,
1007,
1029,
1060,
2692,
1024,
1014,
1025,
1061,
2692,
1027,
1006,
1061,
2692,
999,
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... | |
jgraph/mxgraph | javascript/examples/grapheditor/www/js/Graph.js | reference | function reference(node, clone)
{
clone.originalNode = node;
node = node.firstChild;
var child = clone.firstChild;
while (node != null && child != null)
{
reference(node, child);
node = node.nextSibling;
child = child.nextSibling;
}
return clone;
} | javascript | function reference(node, clone)
{
clone.originalNode = node;
node = node.firstChild;
var child = clone.firstChild;
while (node != null && child != null)
{
reference(node, child);
node = node.nextSibling;
child = child.nextSibling;
}
return clone;
} | [
"function",
"reference",
"(",
"node",
",",
"clone",
")",
"{",
"clone",
".",
"originalNode",
"=",
"node",
";",
"node",
"=",
"node",
".",
"firstChild",
";",
"var",
"child",
"=",
"clone",
".",
"firstChild",
";",
"while",
"(",
"node",
"!=",
"null",
"&&",
... | Adds a reference from the clone to the original node, recursively | [
"Adds",
"a",
"reference",
"from",
"the",
"clone",
"to",
"the",
"original",
"node",
"recursively"
] | 33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44 | https://github.com/jgraph/mxgraph/blob/33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44/javascript/examples/grapheditor/www/js/Graph.js#L7139-L7154 | train | Reference a node to a clone | [
30522,
3853,
4431,
1006,
13045,
1010,
17598,
1007,
1063,
17598,
1012,
2434,
3630,
3207,
1027,
13045,
1025,
13045,
1027,
13045,
1012,
2034,
19339,
1025,
13075,
2775,
1027,
17598,
1012,
2034,
19339,
1025,
2096,
1006,
13045,
999,
1027,
19701,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | dist/webuploader.withoutimage.js | function( file, remove ) {
var me = this;
file = file.id ? file : me.queue.getFile( file );
this.request( 'cancel-file', file );
if ( remove ) {
this.queue.removeFile( file );
}
} | javascript | function( file, remove ) {
var me = this;
file = file.id ? file : me.queue.getFile( file );
this.request( 'cancel-file', file );
if ( remove ) {
this.queue.removeFile( file );
}
} | [
"function",
"(",
"file",
",",
"remove",
")",
"{",
"var",
"me",
"=",
"this",
";",
"file",
"=",
"file",
".",
"id",
"?",
"file",
":",
"me",
".",
"queue",
".",
"getFile",
"(",
"file",
")",
";",
"this",
".",
"request",
"(",
"'cancel-file'",
",",
"file... | @event fileDequeued
@param {File} file File对象
@description 当文件被移除队列后触发。
@for Uploader
@method removeFile
@grammar removeFile( file ) => undefined
@grammar removeFile( id ) => undefined
@grammar removeFile( file, true ) => undefined
@grammar removeFile( id, true ) => undefined
@param {File|id} file File对象或这File对象的id
@description 移除某一文件, 默认只会标记文件状态为已取消,如果第二个参数为 `true` 则会从 queue 中移除。
@for Uploader
@example
$li.on('click', '.remove-this', function() {
uploader.removeFile( file );
}) | [
"@event",
"fileDequeued",
"@param",
"{",
"File",
"}",
"file",
"File对象",
"@description",
"当文件被移除队列后触发。",
"@for",
"Uploader",
"@method",
"removeFile",
"@grammar",
"removeFile",
"(",
"file",
")",
"=",
">",
"undefined",
"@grammar",
"removeFile",
"(",
"id",
")",
"=",... | 7094e4476c5af3b06993d91dde2d223200b9feb7 | https://github.com/fex-team/webuploader/blob/7094e4476c5af3b06993d91dde2d223200b9feb7/dist/webuploader.withoutimage.js#L2587-L2597 | train | Cancel a file | [
30522,
3853,
1006,
5371,
1010,
6366,
1007,
1063,
13075,
2033,
1027,
2023,
1025,
5371,
1027,
5371,
1012,
8909,
1029,
5371,
1024,
2033,
1012,
24240,
1012,
2131,
8873,
2571,
1006,
5371,
1007,
1025,
2023,
1012,
5227,
1006,
1005,
17542,
1011,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
adobe/brackets | src/LiveDevelopment/Agents/ConsoleAgent.js | _log | function _log(message) {
var level = message.level;
if (level === "warning") {
level = "warn";
}
var text = "ConsoleAgent: " + message.text;
if (message.url) {
text += " (url: " + message.url + ")";
}
if (message.stackTrace) {
var callFrame = message.stackTrace[0];
text += " in " + callFrame.functionName + ":" + callFrame.columnNumber;
}
console[level](text);
} | javascript | function _log(message) {
var level = message.level;
if (level === "warning") {
level = "warn";
}
var text = "ConsoleAgent: " + message.text;
if (message.url) {
text += " (url: " + message.url + ")";
}
if (message.stackTrace) {
var callFrame = message.stackTrace[0];
text += " in " + callFrame.functionName + ":" + callFrame.columnNumber;
}
console[level](text);
} | [
"function",
"_log",
"(",
"message",
")",
"{",
"var",
"level",
"=",
"message",
".",
"level",
";",
"if",
"(",
"level",
"===",
"\"warning\"",
")",
"{",
"level",
"=",
"\"warn\"",
";",
"}",
"var",
"text",
"=",
"\"ConsoleAgent: \"",
"+",
"message",
".",
"tex... | {Console.ConsoleMessage} the last received message Log a remote message to the local console
@param {Console.ConsoleMessage} message | [
"{",
"Console",
".",
"ConsoleMessage",
"}",
"the",
"last",
"received",
"message",
"Log",
"a",
"remote",
"message",
"to",
"the",
"local",
"console"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/LiveDevelopment/Agents/ConsoleAgent.js#L38-L52 | train | Log a message to the console | [
30522,
3853,
1035,
8833,
1006,
4471,
1007,
1063,
13075,
2504,
1027,
4471,
1012,
2504,
1025,
2065,
1006,
2504,
1027,
1027,
1027,
1000,
5432,
1000,
1007,
1063,
2504,
1027,
1000,
11582,
1000,
1025,
1065,
13075,
3793,
1027,
1000,
10122,
4270,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/model/analytics/odata4analytics.js | function(oModel, oEntityType, oEntitySet, oParameterization, oAssocFromParamsToResult) {
this._oModel = oModel;
this._oEntityType = oEntityType;
this._oEntitySet = oEntitySet;
this._oParameterization = oParameterization;
this._oDimensionSet = {};
this._oMeasureSet = {};
// parse entity type for analytic semantics described by annotations
var aProperty = oEntityType.getTypeDescription().property;
var oAttributeForPropertySet = {};
for (var i = -1, oProperty; (oProperty = aProperty[++i]) !== undefined;) {
if (oProperty.extensions == undefined) {
continue;
}
for (var j = -1, oExtension; (oExtension = oProperty.extensions[++j]) !== undefined;) {
if (!oExtension.namespace == odata4analytics.constants.SAP_NAMESPACE) {
continue;
}
switch (oExtension.name) {
case "aggregation-role":
switch (oExtension.value) {
case "dimension": {
var oDimension = new odata4analytics.Dimension(this, oProperty);
this._oDimensionSet[oDimension.getName()] = oDimension;
break;
}
case "measure": {
var oMeasure = new odata4analytics.Measure(this, oProperty);
this._oMeasureSet[oMeasure.getName()] = oMeasure;
break;
}
case "totaled-properties-list":
this._oTotaledPropertyListProperty = oProperty;
break;
default:
}
break;
case "attribute-for": {
var oDimensionAttribute = new odata4analytics.DimensionAttribute(this, oProperty);
var oKeyProperty = oDimensionAttribute.getKeyProperty();
oAttributeForPropertySet[oKeyProperty.name] = oDimensionAttribute;
break;
}
default:
}
}
}
// assign dimension attributes to the respective dimension objects
for ( var sDimensionAttributeName in oAttributeForPropertySet) {
var oDimensionAttribute2 = oAttributeForPropertySet[sDimensionAttributeName];
oDimensionAttribute2.getDimension().addAttribute(oDimensionAttribute2);
}
// apply workaround for missing text properties if requested
if (oModel._oActivatedWorkarounds.IdentifyTextPropertiesByName) {
var aMatchedTextPropertyName = [];
for ( var oDimName in this._oDimensionSet) {
var oDimension2 = this._oDimensionSet[oDimName];
if (!oDimension2.getTextProperty()) {
var oTextProperty = null; // order of matching is
// significant!
oTextProperty = oEntityType.findPropertyByName(oDimName + "Name");
if (!oTextProperty) {
oTextProperty = oEntityType.findPropertyByName(oDimName + "Text");
}
if (!oTextProperty) {
oTextProperty = oEntityType.findPropertyByName(oDimName + "Desc");
}
if (!oTextProperty) {
oTextProperty = oEntityType.findPropertyByName(oDimName + "Description");
}
if (oTextProperty) { // any match?
oDimension2.setTextProperty(oTextProperty); // link
// dimension
// with text
// property
aMatchedTextPropertyName.push(oTextProperty.name);
}
}
}
// make sure that any matched text property is not exposed as
// dimension (according to spec)
for (var t = -1, sPropertyName; (sPropertyName = aMatchedTextPropertyName[++t]) !== undefined;) {
delete this._oDimensionSet[sPropertyName];
}
}
} | javascript | function(oModel, oEntityType, oEntitySet, oParameterization, oAssocFromParamsToResult) {
this._oModel = oModel;
this._oEntityType = oEntityType;
this._oEntitySet = oEntitySet;
this._oParameterization = oParameterization;
this._oDimensionSet = {};
this._oMeasureSet = {};
// parse entity type for analytic semantics described by annotations
var aProperty = oEntityType.getTypeDescription().property;
var oAttributeForPropertySet = {};
for (var i = -1, oProperty; (oProperty = aProperty[++i]) !== undefined;) {
if (oProperty.extensions == undefined) {
continue;
}
for (var j = -1, oExtension; (oExtension = oProperty.extensions[++j]) !== undefined;) {
if (!oExtension.namespace == odata4analytics.constants.SAP_NAMESPACE) {
continue;
}
switch (oExtension.name) {
case "aggregation-role":
switch (oExtension.value) {
case "dimension": {
var oDimension = new odata4analytics.Dimension(this, oProperty);
this._oDimensionSet[oDimension.getName()] = oDimension;
break;
}
case "measure": {
var oMeasure = new odata4analytics.Measure(this, oProperty);
this._oMeasureSet[oMeasure.getName()] = oMeasure;
break;
}
case "totaled-properties-list":
this._oTotaledPropertyListProperty = oProperty;
break;
default:
}
break;
case "attribute-for": {
var oDimensionAttribute = new odata4analytics.DimensionAttribute(this, oProperty);
var oKeyProperty = oDimensionAttribute.getKeyProperty();
oAttributeForPropertySet[oKeyProperty.name] = oDimensionAttribute;
break;
}
default:
}
}
}
// assign dimension attributes to the respective dimension objects
for ( var sDimensionAttributeName in oAttributeForPropertySet) {
var oDimensionAttribute2 = oAttributeForPropertySet[sDimensionAttributeName];
oDimensionAttribute2.getDimension().addAttribute(oDimensionAttribute2);
}
// apply workaround for missing text properties if requested
if (oModel._oActivatedWorkarounds.IdentifyTextPropertiesByName) {
var aMatchedTextPropertyName = [];
for ( var oDimName in this._oDimensionSet) {
var oDimension2 = this._oDimensionSet[oDimName];
if (!oDimension2.getTextProperty()) {
var oTextProperty = null; // order of matching is
// significant!
oTextProperty = oEntityType.findPropertyByName(oDimName + "Name");
if (!oTextProperty) {
oTextProperty = oEntityType.findPropertyByName(oDimName + "Text");
}
if (!oTextProperty) {
oTextProperty = oEntityType.findPropertyByName(oDimName + "Desc");
}
if (!oTextProperty) {
oTextProperty = oEntityType.findPropertyByName(oDimName + "Description");
}
if (oTextProperty) { // any match?
oDimension2.setTextProperty(oTextProperty); // link
// dimension
// with text
// property
aMatchedTextPropertyName.push(oTextProperty.name);
}
}
}
// make sure that any matched text property is not exposed as
// dimension (according to spec)
for (var t = -1, sPropertyName; (sPropertyName = aMatchedTextPropertyName[++t]) !== undefined;) {
delete this._oDimensionSet[sPropertyName];
}
}
} | [
"function",
"(",
"oModel",
",",
"oEntityType",
",",
"oEntitySet",
",",
"oParameterization",
",",
"oAssocFromParamsToResult",
")",
"{",
"this",
".",
"_oModel",
"=",
"oModel",
";",
"this",
".",
"_oEntityType",
"=",
"oEntityType",
";",
"this",
".",
"_oEntitySet",
... | initialize new object
@private | [
"initialize",
"new",
"object"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/analytics/odata4analytics.js#L880-L971 | train | Initializes the parameters for the given entity set. | [
30522,
3853,
1006,
18168,
10244,
2140,
1010,
1051,
4765,
3012,
13874,
1010,
1051,
4765,
3012,
13462,
1010,
6728,
5400,
22828,
3989,
1010,
1051,
12054,
10085,
19699,
25377,
5400,
5244,
19277,
23722,
2102,
1007,
1063,
2023,
1012,
1035,
18168,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/main.js | _handleGoLiveCommand | function _handleGoLiveCommand() {
if (LiveDevImpl.status >= LiveDevImpl.STATUS_ACTIVE) {
LiveDevImpl.close();
} else if (LiveDevImpl.status <= LiveDevImpl.STATUS_INACTIVE) {
if (!params.get("skipLiveDevelopmentInfo") && !PreferencesManager.getViewState("livedev.afterFirstLaunch")) {
PreferencesManager.setViewState("livedev.afterFirstLaunch", "true");
Dialogs.showModalDialog(
DefaultDialogs.DIALOG_ID_INFO,
Strings.LIVE_DEVELOPMENT_INFO_TITLE,
Strings.LIVE_DEVELOPMENT_INFO_MESSAGE
).done(function (id) {
LiveDevImpl.open();
});
} else {
LiveDevImpl.open();
}
}
} | javascript | function _handleGoLiveCommand() {
if (LiveDevImpl.status >= LiveDevImpl.STATUS_ACTIVE) {
LiveDevImpl.close();
} else if (LiveDevImpl.status <= LiveDevImpl.STATUS_INACTIVE) {
if (!params.get("skipLiveDevelopmentInfo") && !PreferencesManager.getViewState("livedev.afterFirstLaunch")) {
PreferencesManager.setViewState("livedev.afterFirstLaunch", "true");
Dialogs.showModalDialog(
DefaultDialogs.DIALOG_ID_INFO,
Strings.LIVE_DEVELOPMENT_INFO_TITLE,
Strings.LIVE_DEVELOPMENT_INFO_MESSAGE
).done(function (id) {
LiveDevImpl.open();
});
} else {
LiveDevImpl.open();
}
}
} | [
"function",
"_handleGoLiveCommand",
"(",
")",
"{",
"if",
"(",
"LiveDevImpl",
".",
"status",
">=",
"LiveDevImpl",
".",
"STATUS_ACTIVE",
")",
"{",
"LiveDevImpl",
".",
"close",
"(",
")",
";",
"}",
"else",
"if",
"(",
"LiveDevImpl",
".",
"status",
"<=",
"LiveDe... | Toggles LiveDevelopment and synchronizes the state of UI elements that reports LiveDevelopment status
Stop Live Dev when in an active state (ACTIVE, OUT_OF_SYNC, SYNC_ERROR).
Start Live Dev when in an inactive state (ERROR, INACTIVE).
Do nothing when in a connecting state (CONNECTING, LOADING_AGENTS). | [
"Toggles",
"LiveDevelopment",
"and",
"synchronizes",
"the",
"state",
"of",
"UI",
"elements",
"that",
"reports",
"LiveDevelopment",
"status"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/LiveDevelopment/main.js#L177-L194 | train | Handle LiveDevelopment Command | [
30522,
3853,
1035,
5047,
24141,
3512,
9006,
2386,
2094,
1006,
1007,
1063,
2065,
1006,
2973,
6777,
5714,
24759,
1012,
3570,
1028,
1027,
2973,
6777,
5714,
24759,
1012,
3570,
1035,
3161,
1007,
1063,
2973,
6777,
5714,
24759,
1012,
2485,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.table/src/sap/ui/table/TableGrouping.js | function(oTable, oRow, oRowBinding, oRowBindingInfo) {
var oRowGroupInfo = {
isHeader: false,
expanded: false,
hidden: false,
title: "",
level: 0
};
if (oTable.getGroupHeaderProperty) { //TreeTable
oRowGroupInfo.isHeader = oRow._bHasChildren;
oRowGroupInfo.expanded = oRow._bIsExpanded;
oRowGroupInfo.hidden = oRowGroupInfo.isHeader;
oRowGroupInfo.level = oRow._iLevel;
var sHeaderProp = oTable.getGroupHeaderProperty();
if (TableGrouping.isGroupMode(oTable) && sHeaderProp) {
var sModelName = oRowBindingInfo && oRowBindingInfo.model;
oRowGroupInfo.title = oTable.getModel(sModelName).getProperty(sHeaderProp, oRow.getBindingContext(sModelName));
}
} else { //Table
var iRowIndex = oRow.getIndex();
oRowGroupInfo.isHeader = !!oRowBinding.isGroupHeader(iRowIndex);
oRowGroupInfo.level = oRowGroupInfo.isHeader ? 0 : 1;
if (oRowGroupInfo.isHeader) {
oRowGroupInfo.expanded = !!oRowBinding.isExpanded(iRowIndex);
oRowGroupInfo.hidden = true;
oRowGroupInfo.title = oRowBinding.getTitle(iRowIndex);
}
}
return oRowGroupInfo;
} | javascript | function(oTable, oRow, oRowBinding, oRowBindingInfo) {
var oRowGroupInfo = {
isHeader: false,
expanded: false,
hidden: false,
title: "",
level: 0
};
if (oTable.getGroupHeaderProperty) { //TreeTable
oRowGroupInfo.isHeader = oRow._bHasChildren;
oRowGroupInfo.expanded = oRow._bIsExpanded;
oRowGroupInfo.hidden = oRowGroupInfo.isHeader;
oRowGroupInfo.level = oRow._iLevel;
var sHeaderProp = oTable.getGroupHeaderProperty();
if (TableGrouping.isGroupMode(oTable) && sHeaderProp) {
var sModelName = oRowBindingInfo && oRowBindingInfo.model;
oRowGroupInfo.title = oTable.getModel(sModelName).getProperty(sHeaderProp, oRow.getBindingContext(sModelName));
}
} else { //Table
var iRowIndex = oRow.getIndex();
oRowGroupInfo.isHeader = !!oRowBinding.isGroupHeader(iRowIndex);
oRowGroupInfo.level = oRowGroupInfo.isHeader ? 0 : 1;
if (oRowGroupInfo.isHeader) {
oRowGroupInfo.expanded = !!oRowBinding.isExpanded(iRowIndex);
oRowGroupInfo.hidden = true;
oRowGroupInfo.title = oRowBinding.getTitle(iRowIndex);
}
}
return oRowGroupInfo;
} | [
"function",
"(",
"oTable",
",",
"oRow",
",",
"oRowBinding",
",",
"oRowBindingInfo",
")",
"{",
"var",
"oRowGroupInfo",
"=",
"{",
"isHeader",
":",
"false",
",",
"expanded",
":",
"false",
",",
"hidden",
":",
"false",
",",
"title",
":",
"\"\"",
",",
"level",... | Updates the dom of the rows of the given table.
@param {sap.ui.table.Table} oTable Instance of the table.
@param {sap.ui.table.Row} oRow Instance of the row.
@param {Object} oRowBinding the Binding object of the rows aggregation.
@param {Object} oRowBindingInfo The binding info object of the rows aggregation.
@returns {Object} The group information for the given row.
@private | [
"Updates",
"the",
"dom",
"of",
"the",
"rows",
"of",
"the",
"given",
"table",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableGrouping.js#L486-L520 | train | Returns the information about the row group. | [
30522,
3853,
1006,
27178,
3085,
1010,
20298,
2860,
1010,
20298,
2860,
8428,
4667,
1010,
20298,
2860,
8428,
4667,
2378,
14876,
1007,
1063,
13075,
20298,
27767,
22107,
2378,
14876,
1027,
1063,
2003,
4974,
2121,
1024,
6270,
1010,
4423,
1024,
6... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
TryGhost/Ghost | core/server/models/post.js | extraFilters | function extraFilters(options) {
if (!options.staticPages && !options.status) {
return null;
}
let filter = null;
// CASE: "staticPages" is passed
if (options.staticPages && options.staticPages !== 'all') {
// CASE: convert string true/false to boolean
if (!_.isBoolean(options.staticPages)) {
options.staticPages = _.includes(['true', '1'], options.staticPages);
}
filter = `page:${options.staticPages}`;
} else if (options.staticPages === 'all') {
filter = 'page:[true, false]';
}
// CASE: "status" is passed, combine filters
if (options.status && options.status !== 'all') {
options.status = _.includes(ALL_STATUSES, options.status) ? options.status : 'published';
if (!filter) {
filter = `status:${options.status}`;
} else {
filter = `${filter}+status:${options.status}`;
}
} else if (options.status === 'all') {
if (!filter) {
filter = `status:[${ALL_STATUSES}]`;
} else {
filter = `${filter}+status:[${ALL_STATUSES}]`;
}
}
delete options.status;
delete options.staticPages;
return filter;
} | javascript | function extraFilters(options) {
if (!options.staticPages && !options.status) {
return null;
}
let filter = null;
// CASE: "staticPages" is passed
if (options.staticPages && options.staticPages !== 'all') {
// CASE: convert string true/false to boolean
if (!_.isBoolean(options.staticPages)) {
options.staticPages = _.includes(['true', '1'], options.staticPages);
}
filter = `page:${options.staticPages}`;
} else if (options.staticPages === 'all') {
filter = 'page:[true, false]';
}
// CASE: "status" is passed, combine filters
if (options.status && options.status !== 'all') {
options.status = _.includes(ALL_STATUSES, options.status) ? options.status : 'published';
if (!filter) {
filter = `status:${options.status}`;
} else {
filter = `${filter}+status:${options.status}`;
}
} else if (options.status === 'all') {
if (!filter) {
filter = `status:[${ALL_STATUSES}]`;
} else {
filter = `${filter}+status:[${ALL_STATUSES}]`;
}
}
delete options.status;
delete options.staticPages;
return filter;
} | [
"function",
"extraFilters",
"(",
"options",
")",
"{",
"if",
"(",
"!",
"options",
".",
"staticPages",
"&&",
"!",
"options",
".",
"status",
")",
"{",
"return",
"null",
";",
"}",
"let",
"filter",
"=",
"null",
";",
"// CASE: \"staticPages\" is passed",
"if",
"... | You can pass an extra `status=VALUES` or "staticPages" field.
Long-Term: We should deprecate these short cuts and force users to use the filter param. | [
"You",
"can",
"pass",
"an",
"extra",
"status",
"=",
"VALUES",
"or",
"staticPages",
"field",
".",
"Long",
"-",
"Term",
":",
"We",
"should",
"deprecate",
"these",
"short",
"cuts",
"and",
"force",
"users",
"to",
"use",
"the",
"filter",
"param",
"."
] | bb7bb55cf3e60af99ebbc56099928827b58461bc | https://github.com/TryGhost/Ghost/blob/bb7bb55cf3e60af99ebbc56099928827b58461bc/core/server/models/post.js#L609-L648 | train | Returns a filter string that can be used to filter the results | [
30522,
3853,
4469,
8873,
21928,
2015,
1006,
7047,
1007,
1063,
2065,
1006,
999,
7047,
1012,
10763,
13704,
2015,
1004,
1004,
999,
7047,
1012,
3570,
1007,
1063,
2709,
19701,
1025,
1065,
2292,
11307,
1027,
19701,
1025,
1013,
1013,
2553,
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... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Helper.js | function (vElement) {
if (vElement === undefined || vElement === null) {
return [];
}
if (Array.isArray(vElement)) {
return vElement;
}
return [vElement];
} | javascript | function (vElement) {
if (vElement === undefined || vElement === null) {
return [];
}
if (Array.isArray(vElement)) {
return vElement;
}
return [vElement];
} | [
"function",
"(",
"vElement",
")",
"{",
"if",
"(",
"vElement",
"===",
"undefined",
"||",
"vElement",
"===",
"null",
")",
"{",
"return",
"[",
"]",
";",
"}",
"if",
"(",
"Array",
".",
"isArray",
"(",
"vElement",
")",
")",
"{",
"return",
"vElement",
";",
... | Converts given value to an array.
<code>null</code> and <code>undefined</code> are converted to the empty array, a
non-array value is wrapped with an array and an array is returned as it is.
@param {any} [vElement]
The element to be converted into an array.
@returns {Array}
The array for the given element. | [
"Converts",
"given",
"value",
"to",
"an",
"array",
".",
"<code",
">",
"null<",
"/",
"code",
">",
"and",
"<code",
">",
"undefined<",
"/",
"code",
">",
"are",
"converted",
"to",
"the",
"empty",
"array",
"a",
"non",
"-",
"array",
"value",
"is",
"wrapped",... | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Helper.js#L1095-L1103 | train | Returns an array of the elements in the array | [
30522,
3853,
1006,
2310,
16930,
4765,
1007,
1063,
2065,
1006,
2310,
16930,
4765,
1027,
1027,
1027,
6151,
28344,
1064,
1064,
2310,
16930,
4765,
1027,
1027,
1027,
19701,
1007,
1063,
2709,
1031,
1033,
1025,
1065,
2065,
1006,
9140,
1012,
18061,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
exceljs/exceljs | lib/xlsx/xform/style/styles-xform.js | function(model, cellType) {
if (!model) {
return 0;
}
// if we have seen this style object before, assume it has the same styleId
if (this.weakMap && this.weakMap.has(model)) {
return this.weakMap.get(model);
}
var style = {};
cellType = cellType || Enums.ValueType.Number;
if (model.numFmt) {
style.numFmtId = this._addNumFmtStr(model.numFmt);
} else {
switch (cellType) {
case Enums.ValueType.Number:
style.numFmtId = this._addNumFmtStr('General');
break;
case Enums.ValueType.Date:
style.numFmtId = this._addNumFmtStr('mm-dd-yy');
break;
default:
break;
}
}
if (model.font) {
style.fontId = this._addFont(model.font);
}
if (model.border) {
style.borderId = this._addBorder(model.border);
}
if (model.fill) {
style.fillId = this._addFill(model.fill);
}
if (model.alignment) {
style.alignment = model.alignment;
}
var styleId = this._addStyle(style);
if (this.weakMap) {
this.weakMap.set(model, styleId);
}
return styleId;
} | javascript | function(model, cellType) {
if (!model) {
return 0;
}
// if we have seen this style object before, assume it has the same styleId
if (this.weakMap && this.weakMap.has(model)) {
return this.weakMap.get(model);
}
var style = {};
cellType = cellType || Enums.ValueType.Number;
if (model.numFmt) {
style.numFmtId = this._addNumFmtStr(model.numFmt);
} else {
switch (cellType) {
case Enums.ValueType.Number:
style.numFmtId = this._addNumFmtStr('General');
break;
case Enums.ValueType.Date:
style.numFmtId = this._addNumFmtStr('mm-dd-yy');
break;
default:
break;
}
}
if (model.font) {
style.fontId = this._addFont(model.font);
}
if (model.border) {
style.borderId = this._addBorder(model.border);
}
if (model.fill) {
style.fillId = this._addFill(model.fill);
}
if (model.alignment) {
style.alignment = model.alignment;
}
var styleId = this._addStyle(style);
if (this.weakMap) {
this.weakMap.set(model, styleId);
}
return styleId;
} | [
"function",
"(",
"model",
",",
"cellType",
")",
"{",
"if",
"(",
"!",
"model",
")",
"{",
"return",
"0",
";",
"}",
"// if we have seen this style object before, assume it has the same styleId",
"if",
"(",
"this",
".",
"weakMap",
"&&",
"this",
".",
"weakMap",
".",
... | add a cell's style model to the collection each style property is processed and cross-referenced, etc. the styleId is returned. Note: cellType is used when numFmt not defined | [
"add",
"a",
"cell",
"s",
"style",
"model",
"to",
"the",
"collection",
"each",
"style",
"property",
"is",
"processed",
"and",
"cross",
"-",
"referenced",
"etc",
".",
"the",
"styleId",
"is",
"returned",
".",
"Note",
":",
"cellType",
"is",
"used",
"when",
"... | c6ee7a14d5e0e5a07bf0e475aa4dd7b9a1e907f2 | https://github.com/exceljs/exceljs/blob/c6ee7a14d5e0e5a07bf0e475aa4dd7b9a1e907f2/lib/xlsx/xform/style/styles-xform.js#L239-L288 | train | Returns the style id for the given cell model | [
30522,
3853,
1006,
2944,
1010,
3526,
13874,
1007,
1063,
2065,
1006,
999,
2944,
1007,
1063,
2709,
1014,
1025,
1065,
1013,
1013,
2065,
2057,
2031,
2464,
2023,
2806,
4874,
2077,
1010,
7868,
2009,
2038,
1996,
2168,
2806,
3593,
2065,
1006,
202... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
adobe/brackets | src/document/DocumentCommandHandlers.js | _saveFileList | function _saveFileList(fileList) {
// Do in serial because doSave shows error UI for each file, and we don't want to stack
// multiple dialogs on top of each other
var userCanceled = false,
filesAfterSave = [];
return Async.doSequentially(
fileList,
function (file) {
// Abort remaining saves if user canceled any Save As dialog
if (userCanceled) {
return (new $.Deferred()).reject().promise();
}
var doc = DocumentManager.getOpenDocumentForPath(file.fullPath);
if (doc) {
var savePromise = handleFileSave({doc: doc});
savePromise
.done(function (newFile) {
filesAfterSave.push(newFile);
})
.fail(function (error) {
if (error === USER_CANCELED) {
userCanceled = true;
}
});
return savePromise;
} else {
// workingset entry that was never actually opened - ignore
filesAfterSave.push(file);
return (new $.Deferred()).resolve().promise();
}
},
false // if any save fails, continue trying to save other files anyway; then reject at end
).then(function () {
return filesAfterSave;
});
} | javascript | function _saveFileList(fileList) {
// Do in serial because doSave shows error UI for each file, and we don't want to stack
// multiple dialogs on top of each other
var userCanceled = false,
filesAfterSave = [];
return Async.doSequentially(
fileList,
function (file) {
// Abort remaining saves if user canceled any Save As dialog
if (userCanceled) {
return (new $.Deferred()).reject().promise();
}
var doc = DocumentManager.getOpenDocumentForPath(file.fullPath);
if (doc) {
var savePromise = handleFileSave({doc: doc});
savePromise
.done(function (newFile) {
filesAfterSave.push(newFile);
})
.fail(function (error) {
if (error === USER_CANCELED) {
userCanceled = true;
}
});
return savePromise;
} else {
// workingset entry that was never actually opened - ignore
filesAfterSave.push(file);
return (new $.Deferred()).resolve().promise();
}
},
false // if any save fails, continue trying to save other files anyway; then reject at end
).then(function () {
return filesAfterSave;
});
} | [
"function",
"_saveFileList",
"(",
"fileList",
")",
"{",
"// Do in serial because doSave shows error UI for each file, and we don't want to stack",
"// multiple dialogs on top of each other",
"var",
"userCanceled",
"=",
"false",
",",
"filesAfterSave",
"=",
"[",
"]",
";",
"return",... | Saves all unsaved documents corresponding to 'fileList'. Returns a Promise that will be resolved
once ALL the save operations have been completed. If ANY save operation fails, an error dialog is
immediately shown but after dismissing we continue saving the other files; after all files have
been processed, the Promise is rejected if any ONE save operation failed (the error given is the
first one encountered). If the user cancels any Save As dialog (for untitled files), the
Promise is immediately rejected.
@param {!Array.<File>} fileList
@return {!$.Promise} Resolved with {!Array.<File>}, which may differ from 'fileList'
if any of the files were Unsaved documents. Or rejected with {?FileSystemError}. | [
"Saves",
"all",
"unsaved",
"documents",
"corresponding",
"to",
"fileList",
".",
"Returns",
"a",
"Promise",
"that",
"will",
"be",
"resolved",
"once",
"ALL",
"the",
"save",
"operations",
"have",
"been",
"completed",
".",
"If",
"ANY",
"save",
"operation",
"fails"... | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/document/DocumentCommandHandlers.js#L1085-L1122 | train | Save a list of files to disk | [
30522,
3853,
1035,
3828,
8873,
2571,
9863,
1006,
5371,
9863,
1007,
1063,
1013,
1013,
2079,
1999,
7642,
2138,
9998,
10696,
3065,
7561,
21318,
2005,
2169,
5371,
1010,
1998,
2057,
2123,
1005,
1056,
2215,
2000,
9991,
1013,
1013,
3674,
13764,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
airyland/vux | src/components/orientation/orientation.js | function () {
// 90度为横屏
return (EVT_ORIENTATION_CHANGE === ORIENTATION_CHANGE) ? {
landscape: (window.orientation === 90 || window.orientation === -90),
portrait: (window.orientation === 0 || window.orientation === -180),
orientation: window.orientation
} : {
landscape: window.screen.width > window.screen.height,
portrait: window.screen.width <= window.screen.height,
orientation: window.screen.width > window.screen.height ? 90 : 0
}
} | javascript | function () {
// 90度为横屏
return (EVT_ORIENTATION_CHANGE === ORIENTATION_CHANGE) ? {
landscape: (window.orientation === 90 || window.orientation === -90),
portrait: (window.orientation === 0 || window.orientation === -180),
orientation: window.orientation
} : {
landscape: window.screen.width > window.screen.height,
portrait: window.screen.width <= window.screen.height,
orientation: window.screen.width > window.screen.height ? 90 : 0
}
} | [
"function",
"(",
")",
"{",
"// 90度为横屏",
"return",
"(",
"EVT_ORIENTATION_CHANGE",
"===",
"ORIENTATION_CHANGE",
")",
"?",
"{",
"landscape",
":",
"(",
"window",
".",
"orientation",
"===",
"90",
"||",
"window",
".",
"orientation",
"===",
"-",
"90",
")",
",",
"... | 获取横竖屏信息
@method getInfo
@return {Object} 横竖屏相关信息
@public | [
"获取横竖屏信息"
] | 484fc3c18bdca99b0c08efbb678c0ee0f5ceedd6 | https://github.com/airyland/vux/blob/484fc3c18bdca99b0c08efbb678c0ee0f5ceedd6/src/components/orientation/orientation.js#L126-L137 | train | Returns an object with the parameters of the event | [
30522,
3853,
1006,
1007,
1063,
1013,
1013,
3938,
100,
100,
100,
100,
2709,
1006,
23408,
2102,
1035,
10296,
1035,
2689,
1027,
1027,
1027,
10296,
1035,
2689,
1007,
1029,
1063,
5957,
1024,
1006,
3332,
1012,
10296,
1027,
1027,
1027,
3938,
106... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
adobe/brackets | src/file/FileUtils.js | getFileExtension | function getFileExtension(fullPath) {
var baseName = getBaseName(fullPath),
idx = baseName.lastIndexOf(".");
if (idx === -1) {
return "";
}
return baseName.substr(idx + 1);
} | javascript | function getFileExtension(fullPath) {
var baseName = getBaseName(fullPath),
idx = baseName.lastIndexOf(".");
if (idx === -1) {
return "";
}
return baseName.substr(idx + 1);
} | [
"function",
"getFileExtension",
"(",
"fullPath",
")",
"{",
"var",
"baseName",
"=",
"getBaseName",
"(",
"fullPath",
")",
",",
"idx",
"=",
"baseName",
".",
"lastIndexOf",
"(",
"\".\"",
")",
";",
"if",
"(",
"idx",
"===",
"-",
"1",
")",
"{",
"return",
"\"\... | Get the file extension (excluding ".") given a path OR a bare filename.
Returns "" for names with no extension. If the name starts with ".", the
full remaining text is considered the extension.
@param {string} fullPath full path to a file or directory
@return {string} Returns the extension of a filename or empty string if
the argument is a directory or a filename with no extension | [
"Get",
"the",
"file",
"extension",
"(",
"excluding",
".",
")",
"given",
"a",
"path",
"OR",
"a",
"bare",
"filename",
".",
"Returns",
"for",
"names",
"with",
"no",
"extension",
".",
"If",
"the",
"name",
"starts",
"with",
".",
"the",
"full",
"remaining",
... | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/file/FileUtils.js#L339-L348 | train | Get the file extension | [
30522,
3853,
2131,
8873,
10559,
18413,
6132,
3258,
1006,
2440,
15069,
1007,
1063,
13075,
2918,
18442,
1027,
2131,
15058,
18442,
1006,
2440,
15069,
1007,
1010,
8909,
2595,
1027,
2918,
18442,
1012,
2197,
22254,
10288,
11253,
1006,
1000,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/core/History.js | function() {
if (!this._aHistory) {
var aHistory = this._oStorage.get(this._sHistoryId);
if (typeof (aHistory) === "string") {
// in case it is a string, convert it to an array
aHistory = aHistory.split(",");
} else if (!aHistory) {
// or create a new one in case of non existence
aHistory = [];
} // else assume that there is the means for serializing JSON used, returning an array directly
//do a final check of the entries
this._aHistory = this._fCheckHistory(aHistory);
}
return this._aHistory;
} | javascript | function() {
if (!this._aHistory) {
var aHistory = this._oStorage.get(this._sHistoryId);
if (typeof (aHistory) === "string") {
// in case it is a string, convert it to an array
aHistory = aHistory.split(",");
} else if (!aHistory) {
// or create a new one in case of non existence
aHistory = [];
} // else assume that there is the means for serializing JSON used, returning an array directly
//do a final check of the entries
this._aHistory = this._fCheckHistory(aHistory);
}
return this._aHistory;
} | [
"function",
"(",
")",
"{",
"if",
"(",
"!",
"this",
".",
"_aHistory",
")",
"{",
"var",
"aHistory",
"=",
"this",
".",
"_oStorage",
".",
"get",
"(",
"this",
".",
"_sHistoryId",
")",
";",
"if",
"(",
"typeof",
"(",
"aHistory",
")",
"===",
"\"string\"",
... | Initializes the history if not already done.
@private | [
"Initializes",
"the",
"history",
"if",
"not",
"already",
"done",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/History.js#L55-L69 | train | Returns the history of the current page | [
30522,
3853,
1006,
1007,
1063,
2065,
1006,
999,
2023,
1012,
1035,
6289,
20483,
2854,
1007,
1063,
13075,
6289,
20483,
2854,
1027,
2023,
1012,
1035,
9808,
4263,
4270,
1012,
2131,
1006,
2023,
1012,
1035,
11895,
23809,
10139,
2094,
1007,
1025,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | src/sap.ui.support/src/sap/ui/support/supportRules/ExecutionScope.js | function () {
var aPublicElements = [];
var mComponents = core.mObjects.component;
var mUIAreas = core.mUIAreas;
for (var i in mComponents) {
aPublicElements = aPublicElements.concat(
getPublicElementsInside(mComponents[i])
);
}
for (var key in mUIAreas) {
aPublicElements = aPublicElements.concat(
getPublicElementsInside(mUIAreas[key])
);
}
return aPublicElements;
} | javascript | function () {
var aPublicElements = [];
var mComponents = core.mObjects.component;
var mUIAreas = core.mUIAreas;
for (var i in mComponents) {
aPublicElements = aPublicElements.concat(
getPublicElementsInside(mComponents[i])
);
}
for (var key in mUIAreas) {
aPublicElements = aPublicElements.concat(
getPublicElementsInside(mUIAreas[key])
);
}
return aPublicElements;
} | [
"function",
"(",
")",
"{",
"var",
"aPublicElements",
"=",
"[",
"]",
";",
"var",
"mComponents",
"=",
"core",
".",
"mObjects",
".",
"component",
";",
"var",
"mUIAreas",
"=",
"core",
".",
"mUIAreas",
";",
"for",
"(",
"var",
"i",
"in",
"mComponents",
")",
... | Returns all public elements, i.e. elements that are part of public API
aggregations
@public
@function
@returns {Array} Array of matched elements
@alias sap.ui.support.ExecutionScope.getPublicElements | [
"Returns",
"all",
"public",
"elements",
"i",
".",
"e",
".",
"elements",
"that",
"are",
"part",
"of",
"public",
"API",
"aggregations"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.support/src/sap/ui/support/supportRules/ExecutionScope.js#L249-L267 | train | Get public elements | [
30522,
3853,
1006,
1007,
1063,
13075,
9706,
12083,
13231,
16930,
11187,
1027,
1031,
1033,
1025,
13075,
11338,
25377,
5643,
7666,
1027,
4563,
1012,
11240,
20614,
2015,
1012,
6922,
1025,
13075,
14163,
2401,
16416,
2015,
1027,
4563,
1012,
14163,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SheetJS/js-xlsx | xlsx.js | parse_FullColorExt | function parse_FullColorExt(blob) {
var o = {};
o.xclrType = blob.read_shift(2);
o.nTintShade = blob.read_shift(2);
switch(o.xclrType) {
case 0: blob.l += 4; break;
case 1: o.xclrValue = parse_IcvXF(blob, 4); break;
case 2: o.xclrValue = parse_LongRGBA(blob, 4); break;
case 3: o.xclrValue = parse_ColorTheme(blob, 4); break;
case 4: blob.l += 4; break;
}
blob.l += 8;
return o;
} | javascript | function parse_FullColorExt(blob) {
var o = {};
o.xclrType = blob.read_shift(2);
o.nTintShade = blob.read_shift(2);
switch(o.xclrType) {
case 0: blob.l += 4; break;
case 1: o.xclrValue = parse_IcvXF(blob, 4); break;
case 2: o.xclrValue = parse_LongRGBA(blob, 4); break;
case 3: o.xclrValue = parse_ColorTheme(blob, 4); break;
case 4: blob.l += 4; break;
}
blob.l += 8;
return o;
} | [
"function",
"parse_FullColorExt",
"(",
"blob",
")",
"{",
"var",
"o",
"=",
"{",
"}",
";",
"o",
".",
"xclrType",
"=",
"blob",
".",
"read_shift",
"(",
"2",
")",
";",
"o",
".",
"nTintShade",
"=",
"blob",
".",
"read_shift",
"(",
"2",
")",
";",
"switch",... | /* 2.5.155 | [
"/",
"*",
"2",
".",
"5",
".",
"155"
] | 9a6d8a1d3d80c78dad5201fb389316f935279cdc | https://github.com/SheetJS/js-xlsx/blob/9a6d8a1d3d80c78dad5201fb389316f935279cdc/xlsx.js#L9698-L9711 | train | Parse full color extension | [
30522,
3853,
11968,
3366,
1035,
2440,
18717,
10288,
2102,
1006,
1038,
4135,
2497,
1007,
1063,
13075,
1051,
1027,
1063,
1065,
1025,
1051,
1012,
1060,
20464,
5339,
18863,
1027,
1038,
4135,
2497,
1012,
3191,
1035,
5670,
1006,
1016,
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... |
SeleniumHQ/selenium | javascript/atoms/events.js | createGenericTouchList | function createGenericTouchList(touchListArgs) {
var touches = goog.array.map(touchListArgs, function(touchArg) {
// The target field is not part of the W3C spec, but both android and iOS
// add the target field to each touch.
return {
identifier: touchArg.identifier,
screenX: touchArg.screenX,
screenY: touchArg.screenY,
clientX: touchArg.clientX,
clientY: touchArg.clientY,
pageX: touchArg.pageX,
pageY: touchArg.pageY,
target: target
};
});
touches.item = function(i) {
return touches[i];
};
return touches;
} | javascript | function createGenericTouchList(touchListArgs) {
var touches = goog.array.map(touchListArgs, function(touchArg) {
// The target field is not part of the W3C spec, but both android and iOS
// add the target field to each touch.
return {
identifier: touchArg.identifier,
screenX: touchArg.screenX,
screenY: touchArg.screenY,
clientX: touchArg.clientX,
clientY: touchArg.clientY,
pageX: touchArg.pageX,
pageY: touchArg.pageY,
target: target
};
});
touches.item = function(i) {
return touches[i];
};
return touches;
} | [
"function",
"createGenericTouchList",
"(",
"touchListArgs",
")",
"{",
"var",
"touches",
"=",
"goog",
".",
"array",
".",
"map",
"(",
"touchListArgs",
",",
"function",
"(",
"touchArg",
")",
"{",
"// The target field is not part of the W3C spec, but both android and iOS",
... | Creates a TouchList, using simulated touch Api, for touch events. | [
"Creates",
"a",
"TouchList",
"using",
"simulated",
"touch",
"Api",
"for",
"touch",
"events",
"."
] | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/atoms/events.js#L503-L522 | train | Creates a generic touch list | [
30522,
3853,
3443,
6914,
22420,
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,
1013,
1013,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/JSUtils/Session.js | isInFunctionalCall | function isInFunctionalCall(lex) {
// in a call, or inside array or object brackets that are inside a function.
return (lex && (lex.info === "call" ||
(lex.info === undefined && (lex.type === "]" || lex.type === "}") &&
lex.prev.info === "call")));
} | javascript | function isInFunctionalCall(lex) {
// in a call, or inside array or object brackets that are inside a function.
return (lex && (lex.info === "call" ||
(lex.info === undefined && (lex.type === "]" || lex.type === "}") &&
lex.prev.info === "call")));
} | [
"function",
"isInFunctionalCall",
"(",
"lex",
")",
"{",
"// in a call, or inside array or object brackets that are inside a function.",
"return",
"(",
"lex",
"&&",
"(",
"lex",
".",
"info",
"===",
"\"call\"",
"||",
"(",
"lex",
".",
"info",
"===",
"undefined",
"&&",
"... | Test is a lexical state is in a function call.
@param {Object} lex - lexical state.
@return {Object | boolean} | [
"Test",
"is",
"a",
"lexical",
"state",
"is",
"in",
"a",
"function",
"call",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/JSUtils/Session.js#L390-L395 | train | Check if the given lex is in a function call | [
30522,
3853,
2003,
2378,
11263,
27989,
2389,
9289,
2140,
1006,
17244,
1007,
1063,
1013,
1013,
1999,
1037,
2655,
1010,
2030,
2503,
9140,
2030,
4874,
19719,
2008,
2024,
2503,
1037,
3853,
1012,
2709,
1006,
17244,
30524,
1012,
18558,
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... |
Tonejs/Tone.js | examples/js/OrbitControls.js | onMouseDown | function onMouseDown( event ) {
if ( scope.enabled === false ) return;
event.preventDefault();
if ( event.button === scope.mouseButtons.ORBIT ) {
if ( scope.enableRotate === false ) return;
handleMouseDownRotate( event );
state = STATE.ROTATE;
} else if ( event.button === scope.mouseButtons.ZOOM ) {
if ( scope.enableZoom === false ) return;
handleMouseDownDolly( event );
state = STATE.DOLLY;
} else if ( event.button === scope.mouseButtons.PAN ) {
if ( scope.enablePan === false ) return;
handleMouseDownPan( event );
state = STATE.PAN;
}
if ( state !== STATE.NONE ) {
document.addEventListener( 'mousemove', onMouseMove, false );
document.addEventListener( 'mouseup', onMouseUp, false );
scope.dispatchEvent( startEvent );
}
} | javascript | function onMouseDown( event ) {
if ( scope.enabled === false ) return;
event.preventDefault();
if ( event.button === scope.mouseButtons.ORBIT ) {
if ( scope.enableRotate === false ) return;
handleMouseDownRotate( event );
state = STATE.ROTATE;
} else if ( event.button === scope.mouseButtons.ZOOM ) {
if ( scope.enableZoom === false ) return;
handleMouseDownDolly( event );
state = STATE.DOLLY;
} else if ( event.button === scope.mouseButtons.PAN ) {
if ( scope.enablePan === false ) return;
handleMouseDownPan( event );
state = STATE.PAN;
}
if ( state !== STATE.NONE ) {
document.addEventListener( 'mousemove', onMouseMove, false );
document.addEventListener( 'mouseup', onMouseUp, false );
scope.dispatchEvent( startEvent );
}
} | [
"function",
"onMouseDown",
"(",
"event",
")",
"{",
"if",
"(",
"scope",
".",
"enabled",
"===",
"false",
")",
"return",
";",
"event",
".",
"preventDefault",
"(",
")",
";",
"if",
"(",
"event",
".",
"button",
"===",
"scope",
".",
"mouseButtons",
".",
"ORBI... | event handlers - FSM: listen for events and reset state | [
"event",
"handlers",
"-",
"FSM",
":",
"listen",
"for",
"events",
"and",
"reset",
"state"
] | bb67e9c83d5553dfaa3c10babc147600aa14c147 | https://github.com/Tonejs/Tone.js/blob/bb67e9c83d5553dfaa3c10babc147600aa14c147/examples/js/OrbitControls.js#L651-L692 | train | Handles mouse down events | [
30522,
3853,
2006,
27711,
26010,
7962,
1006,
2724,
1007,
1063,
2065,
1006,
9531,
1012,
9124,
1027,
1027,
1027,
6270,
1007,
2709,
1025,
2724,
1012,
4652,
3207,
7011,
11314,
1006,
1007,
1025,
2065,
1006,
2724,
1012,
6462,
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... |
adobe/brackets | src/filesystem/WatchedRoot.js | WatchedRoot | function WatchedRoot(entry, filter, filterGlobs) {
this.entry = entry;
this.filter = filter;
this.filterGlobs = filterGlobs;
} | javascript | function WatchedRoot(entry, filter, filterGlobs) {
this.entry = entry;
this.filter = filter;
this.filterGlobs = filterGlobs;
} | [
"function",
"WatchedRoot",
"(",
"entry",
",",
"filter",
",",
"filterGlobs",
")",
"{",
"this",
".",
"entry",
"=",
"entry",
";",
"this",
".",
"filter",
"=",
"filter",
";",
"this",
".",
"filterGlobs",
"=",
"filterGlobs",
";",
"}"
] | /*
Represents file or directory structure watched by the FileSystem. If the
entry is a directory, all children (that pass the supplied filter function)
are also watched. A WatchedRoot object begins and ends its life in the
INACTIVE state. While in the process of starting up watchers, the WatchedRoot
is in the STARTING state. When watchers are ready, the WatchedRoot enters
the ACTIVE state.
See the FileSystem class for more details.
@constructor
@param {File|Directory} entry
@param {function(string, string):boolean} filter
@param {Array<string>} filterGlobs | [
"/",
"*",
"Represents",
"file",
"or",
"directory",
"structure",
"watched",
"by",
"the",
"FileSystem",
".",
"If",
"the",
"entry",
"is",
"a",
"directory",
"all",
"children",
"(",
"that",
"pass",
"the",
"supplied",
"filter",
"function",
")",
"are",
"also",
"w... | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/filesystem/WatchedRoot.js#L42-L46 | train | WatchedRoot is a base class for all the resources | [
30522,
3853,
3427,
3217,
4140,
1006,
4443,
1010,
11307,
1010,
11307,
23296,
16429,
2015,
1007,
1063,
2023,
1012,
4443,
1027,
4443,
1025,
2023,
1012,
11307,
1027,
11307,
1025,
2023,
1012,
11307,
23296,
16429,
2015,
1027,
11307,
23296,
16429,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
juliangarnier/anime | src/index.js | parseTargets | function parseTargets(targets) {
const targetsArray = targets ? (flattenArray(is.arr(targets) ? targets.map(toArray) : toArray(targets))) : [];
return filterArray(targetsArray, (item, pos, self) => self.indexOf(item) === pos);
} | javascript | function parseTargets(targets) {
const targetsArray = targets ? (flattenArray(is.arr(targets) ? targets.map(toArray) : toArray(targets))) : [];
return filterArray(targetsArray, (item, pos, self) => self.indexOf(item) === pos);
} | [
"function",
"parseTargets",
"(",
"targets",
")",
"{",
"const",
"targetsArray",
"=",
"targets",
"?",
"(",
"flattenArray",
"(",
"is",
".",
"arr",
"(",
"targets",
")",
"?",
"targets",
".",
"map",
"(",
"toArray",
")",
":",
"toArray",
"(",
"targets",
")",
"... | Animatables | [
"Animatables"
] | 875a3d6745d4bff2e4c6ffe0e2d24aac3bf8a45a | https://github.com/juliangarnier/anime/blob/875a3d6745d4bff2e4c6ffe0e2d24aac3bf8a45a/src/index.js#L639-L642 | train | Parse targets. | [
30522,
3853,
11968,
13462,
2906,
18150,
2015,
1006,
7889,
1007,
1063,
9530,
3367,
7889,
2906,
9447,
1027,
7889,
1029,
1006,
4257,
6528,
2906,
9447,
1006,
2003,
1012,
12098,
2099,
1006,
7889,
1007,
1029,
7889,
1012,
4949,
1006,
2000,
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... |
GitbookIO/gitbook | lib/plugins/sortDependencies.js | pluginType | function pluginType(plugin) {
var name = plugin.getName();
return (name && name.indexOf(THEME_PREFIX) === 0) ? TYPE_THEME : TYPE_PLUGIN;
} | javascript | function pluginType(plugin) {
var name = plugin.getName();
return (name && name.indexOf(THEME_PREFIX) === 0) ? TYPE_THEME : TYPE_PLUGIN;
} | [
"function",
"pluginType",
"(",
"plugin",
")",
"{",
"var",
"name",
"=",
"plugin",
".",
"getName",
"(",
")",
";",
"return",
"(",
"name",
"&&",
"name",
".",
"indexOf",
"(",
"THEME_PREFIX",
")",
"===",
"0",
")",
"?",
"TYPE_THEME",
":",
"TYPE_PLUGIN",
";",
... | Returns the type of a plugin given its name
@param {Plugin} plugin
@return {String} | [
"Returns",
"the",
"type",
"of",
"a",
"plugin",
"given",
"its",
"name"
] | 6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4 | https://github.com/GitbookIO/gitbook/blob/6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4/lib/plugins/sortDependencies.js#L14-L17 | train | Get the type of plugin | [
30522,
3853,
13354,
18447,
18863,
1006,
13354,
2378,
1007,
1063,
13075,
2171,
1027,
13354,
2378,
1012,
2131,
18442,
1006,
1007,
1025,
2709,
1006,
2171,
1004,
1004,
2171,
1012,
5950,
11253,
1006,
4323,
1035,
17576,
1007,
1027,
1027,
1027,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SeleniumHQ/selenium | javascript/selenium-core/scripts/selenium-commandhandlers.js | ActionHandler | function ActionHandler(actionBlock, wait, dontCheckAlerts) {
this.actionBlock = actionBlock;
CommandHandler.call(this, "action", true);
if (wait) {
this.wait = true;
}
// note that dontCheckAlerts could be undefined!!!
this.checkAlerts = (dontCheckAlerts) ? false : true;
} | javascript | function ActionHandler(actionBlock, wait, dontCheckAlerts) {
this.actionBlock = actionBlock;
CommandHandler.call(this, "action", true);
if (wait) {
this.wait = true;
}
// note that dontCheckAlerts could be undefined!!!
this.checkAlerts = (dontCheckAlerts) ? false : true;
} | [
"function",
"ActionHandler",
"(",
"actionBlock",
",",
"wait",
",",
"dontCheckAlerts",
")",
"{",
"this",
".",
"actionBlock",
"=",
"actionBlock",
";",
"CommandHandler",
".",
"call",
"(",
"this",
",",
"\"action\"",
",",
"true",
")",
";",
"if",
"(",
"wait",
")... | An ActionHandler is a command handler that executes the sepcified action, possibly checking for alerts and confirmations (if checkAlerts is set), and possibly waiting for a page load if wait is set. | [
"An",
"ActionHandler",
"is",
"a",
"command",
"handler",
"that",
"executes",
"the",
"sepcified",
"action",
"possibly",
"checking",
"for",
"alerts",
"and",
"confirmations",
"(",
"if",
"checkAlerts",
"is",
"set",
")",
"and",
"possibly",
"waiting",
"for",
"a",
"pa... | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/selenium-core/scripts/selenium-commandhandlers.js#L299-L307 | train | The action handler is a wrapper around CommandHandler | [
30522,
3853,
2895,
11774,
3917,
1006,
2895,
23467,
1010,
3524,
1010,
2123,
10649,
11012,
9453,
21217,
1007,
1063,
2023,
1012,
2895,
23467,
1027,
2895,
23467,
1025,
3094,
11774,
3917,
1012,
2655,
1006,
2023,
1010,
1000,
2895,
1000,
1010,
299... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SeleniumHQ/selenium | javascript/selenium-core/xpath/javascript-xpath-0.1.12.js | function(source) {
var proto = Lexer.prototype;
var tokens = source.match(proto.regs.token);
for (var i = 0, l = tokens.length; i < l; i ++) {
if (proto.regs.strip.test(tokens[i])) {
tokens.splice(i, 1);
}
}
for (var n in proto) tokens[n] = proto[n];
tokens.index = 0;
return tokens;
} | javascript | function(source) {
var proto = Lexer.prototype;
var tokens = source.match(proto.regs.token);
for (var i = 0, l = tokens.length; i < l; i ++) {
if (proto.regs.strip.test(tokens[i])) {
tokens.splice(i, 1);
}
}
for (var n in proto) tokens[n] = proto[n];
tokens.index = 0;
return tokens;
} | [
"function",
"(",
"source",
")",
"{",
"var",
"proto",
"=",
"Lexer",
".",
"prototype",
";",
"var",
"tokens",
"=",
"source",
".",
"match",
"(",
"proto",
".",
"regs",
".",
"token",
")",
";",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"l",
"=",
"tokens",
... | pseudo class: Lexer | [
"pseudo",
"class",
":",
"Lexer"
] | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/selenium-core/xpath/javascript-xpath-0.1.12.js#L222-L233 | train | Parse the source string into an array of tokens | [
30522,
3853,
1006,
3120,
1007,
1063,
13075,
15053,
1027,
17244,
2121,
1012,
8773,
1025,
13075,
19204,
2015,
1027,
3120,
1012,
2674,
1006,
15053,
1012,
19723,
2015,
1012,
19204,
1007,
1025,
2005,
1006,
13075,
1045,
1027,
1014,
1010,
1048,
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... | |
nhn/tui.editor | src/js/htmlSanitizer.js | htmlSanitizer | function htmlSanitizer(html, needHtmlText) {
const $html = $('<div />');
html = html.replace(/<!--[\s\S]*?-->/g, '');
$html.append(html);
removeUnnecessaryTags($html);
leaveOnlyWhitelistAttribute($html);
return finalizeHtml($html, needHtmlText);
} | javascript | function htmlSanitizer(html, needHtmlText) {
const $html = $('<div />');
html = html.replace(/<!--[\s\S]*?-->/g, '');
$html.append(html);
removeUnnecessaryTags($html);
leaveOnlyWhitelistAttribute($html);
return finalizeHtml($html, needHtmlText);
} | [
"function",
"htmlSanitizer",
"(",
"html",
",",
"needHtmlText",
")",
"{",
"const",
"$html",
"=",
"$",
"(",
"'<div />'",
")",
";",
"html",
"=",
"html",
".",
"replace",
"(",
"/",
"<!--[\\s\\S]*?-->",
"/",
"g",
",",
"''",
")",
";",
"$html",
".",
"append",
... | htmlSanitizer
@param {string|Node} html html or Node
@param {boolean} [needHtmlText] pass true if need html text
@returns {string|DocumentFragment} result
@ignore | [
"htmlSanitizer"
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/htmlSanitizer.js#L38-L49 | train | Sanitizes HTML to be safe | [
30522,
3853,
16129,
8791,
25090,
6290,
1006,
16129,
1010,
2342,
11039,
19968,
18209,
1007,
1063,
9530,
3367,
1002,
16129,
1027,
1002,
1006,
1005,
1026,
4487,
2615,
1013,
1028,
1005,
1007,
1025,
16129,
1027,
16129,
1012,
5672,
1006,
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... |
adobe/brackets | src/language/JSUtils.js | function (node) {
if (node.init && (node.init.type === "FunctionExpression" || node.init.type === "ArrowFunctionExpression")) {
_addResult(node);
}
} | javascript | function (node) {
if (node.init && (node.init.type === "FunctionExpression" || node.init.type === "ArrowFunctionExpression")) {
_addResult(node);
}
} | [
"function",
"(",
"node",
")",
"{",
"if",
"(",
"node",
".",
"init",
"&&",
"(",
"node",
".",
"init",
".",
"type",
"===",
"\"FunctionExpression\"",
"||",
"node",
".",
"init",
".",
"type",
"===",
"\"ArrowFunctionExpression\"",
")",
")",
"{",
"_addResult",
"(... | /*
var <functionName> = function () {}
or
var <functionName> = () => {} | [
"/",
"*",
"var",
"<functionName",
">",
"=",
"function",
"()",
"{}"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/language/JSUtils.js#L127-L131 | train | Add result to the result list | [
30522,
3853,
1006,
13045,
1007,
1063,
2065,
1006,
13045,
1012,
1999,
4183,
1004,
1004,
1006,
13045,
1012,
1999,
4183,
1012,
2828,
1027,
1027,
1027,
1000,
3853,
10288,
20110,
3258,
1000,
1064,
1064,
13045,
1012,
1999,
4183,
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... | |
SAP/openui5 | src/sap.ui.core/src/sap/base/Log.js | getLogEntryListenerInstance | function getLogEntryListenerInstance(){
if (!oListener) {
oListener = {
listeners: [],
onLogEntry: function(oLogEntry){
for (var i = 0; i < oListener.listeners.length; i++) {
if (oListener.listeners[i].onLogEntry) {
oListener.listeners[i].onLogEntry(oLogEntry);
}
}
},
attach: function(oLog, oLstnr){
if (oLstnr) {
oListener.listeners.push(oLstnr);
if (oLstnr.onAttachToLog) {
oLstnr.onAttachToLog(oLog);
}
}
},
detach: function(oLog, oLstnr){
for (var i = 0; i < oListener.listeners.length; i++) {
if (oListener.listeners[i] === oLstnr) {
if (oLstnr.onDetachFromLog) {
oLstnr.onDetachFromLog(oLog);
}
oListener.listeners.splice(i,1);
return;
}
}
}
};
}
return oListener;
} | javascript | function getLogEntryListenerInstance(){
if (!oListener) {
oListener = {
listeners: [],
onLogEntry: function(oLogEntry){
for (var i = 0; i < oListener.listeners.length; i++) {
if (oListener.listeners[i].onLogEntry) {
oListener.listeners[i].onLogEntry(oLogEntry);
}
}
},
attach: function(oLog, oLstnr){
if (oLstnr) {
oListener.listeners.push(oLstnr);
if (oLstnr.onAttachToLog) {
oLstnr.onAttachToLog(oLog);
}
}
},
detach: function(oLog, oLstnr){
for (var i = 0; i < oListener.listeners.length; i++) {
if (oListener.listeners[i] === oLstnr) {
if (oLstnr.onDetachFromLog) {
oLstnr.onDetachFromLog(oLog);
}
oListener.listeners.splice(i,1);
return;
}
}
}
};
}
return oListener;
} | [
"function",
"getLogEntryListenerInstance",
"(",
")",
"{",
"if",
"(",
"!",
"oListener",
")",
"{",
"oListener",
"=",
"{",
"listeners",
":",
"[",
"]",
",",
"onLogEntry",
":",
"function",
"(",
"oLogEntry",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
";",
... | Gets the log entry listener instance, if not present creates a new one
@returns {Object} the singleton log entry listener | [
"Gets",
"the",
"log",
"entry",
"listener",
"instance",
"if",
"not",
"present",
"creates",
"a",
"new",
"one"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/base/Log.js#L132-L165 | train | Returns an instance of the LogEntryListener | [
30522,
3853,
2131,
21197,
4765,
23320,
27870,
3678,
7076,
26897,
1006,
1007,
1063,
2065,
1006,
999,
19330,
27870,
3678,
1007,
1063,
19330,
27870,
3678,
1027,
1063,
13810,
1024,
1031,
1033,
1010,
2006,
21197,
4765,
2854,
1024,
3853,
1006,
19... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spencermountain/compromise | src/index.js | function(str, lex) {
if (lex) {
w2.plugin({
words: lex
});
}
let doc = buildText(str, w2);
doc.tagger();
return doc;
} | javascript | function(str, lex) {
if (lex) {
w2.plugin({
words: lex
});
}
let doc = buildText(str, w2);
doc.tagger();
return doc;
} | [
"function",
"(",
"str",
",",
"lex",
")",
"{",
"if",
"(",
"lex",
")",
"{",
"w2",
".",
"plugin",
"(",
"{",
"words",
":",
"lex",
"}",
")",
";",
"}",
"let",
"doc",
"=",
"buildText",
"(",
"str",
",",
"w2",
")",
";",
"doc",
".",
"tagger",
"(",
")... | this is weird, but it's okay | [
"this",
"is",
"weird",
"but",
"it",
"s",
"okay"
] | 526b1cab28a45ccbb430fbf2824db420acd587cf | https://github.com/spencermountain/compromise/blob/526b1cab28a45ccbb430fbf2824db420acd587cf/src/index.js#L76-L85 | train | Build a text document | [
30522,
3853,
1006,
2358,
2099,
1010,
17244,
1007,
1063,
2065,
1006,
17244,
1007,
1063,
1059,
2475,
1012,
13354,
2378,
1006,
1063,
2616,
1024,
17244,
1065,
1007,
1025,
1065,
2292,
9986,
1027,
3857,
18209,
1006,
2358,
2099,
1010,
1059,
2475,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/request.js | eachPage | function eachPage(callback) {
// Make all callbacks async-ish
callback = AWS.util.fn.makeAsync(callback, 3);
function wrappedCallback(response) {
callback.call(response, response.error, response.data, function (result) {
if (result === false) return;
if (response.hasNextPage()) {
response.nextPage().on('complete', wrappedCallback).send();
} else {
callback.call(response, null, null, AWS.util.fn.noop);
}
});
}
this.on('complete', wrappedCallback).send();
} | javascript | function eachPage(callback) {
// Make all callbacks async-ish
callback = AWS.util.fn.makeAsync(callback, 3);
function wrappedCallback(response) {
callback.call(response, response.error, response.data, function (result) {
if (result === false) return;
if (response.hasNextPage()) {
response.nextPage().on('complete', wrappedCallback).send();
} else {
callback.call(response, null, null, AWS.util.fn.noop);
}
});
}
this.on('complete', wrappedCallback).send();
} | [
"function",
"eachPage",
"(",
"callback",
")",
"{",
"// Make all callbacks async-ish",
"callback",
"=",
"AWS",
".",
"util",
".",
"fn",
".",
"makeAsync",
"(",
"callback",
",",
"3",
")",
";",
"function",
"wrappedCallback",
"(",
"response",
")",
"{",
"callback",
... | Iterates over each page of results given a pageable request, calling
the provided callback with each page of data. After all pages have been
retrieved, the callback is called with `null` data.
@note This operation can generate multiple requests to a service.
@example Iterating over multiple pages of objects in an S3 bucket
var pages = 1;
s3.listObjects().eachPage(function(err, data) {
if (err) return;
console.log("Page", pages++);
console.log(data);
});
@example Iterating over multiple pages with an asynchronous callback
s3.listObjects(params).eachPage(function(err, data, done) {
doSomethingAsyncAndOrExpensive(function() {
// The next page of results isn't fetched until done is called
done();
});
});
@callback callback function(err, data, [doneCallback])
Called with each page of resulting data from the request. If the
optional `doneCallback` is provided in the function, it must be called
when the callback is complete.
@param err [Error] an error object, if an error occurred.
@param data [Object] a single page of response data. If there is no
more data, this object will be `null`.
@param doneCallback [Function] an optional done callback. If this
argument is defined in the function declaration, it should be called
when the next page is ready to be retrieved. This is useful for
controlling serial pagination across asynchronous operations.
@return [Boolean] if the callback returns `false`, pagination will
stop.
@see AWS.Request.eachItem
@see AWS.Response.nextPage
@since v1.4.0 | [
"Iterates",
"over",
"each",
"page",
"of",
"results",
"given",
"a",
"pageable",
"request",
"calling",
"the",
"provided",
"callback",
"with",
"each",
"page",
"of",
"data",
".",
"After",
"all",
"pages",
"have",
"been",
"retrieved",
"the",
"callback",
"is",
"cal... | c23e5f0edd150f8885267e5f7c8a564f8e6e8562 | https://github.com/aws/aws-sdk-js/blob/c23e5f0edd150f8885267e5f7c8a564f8e6e8562/lib/request.js#L489-L506 | train | Iterates over all pages in the resource group and calls the callback | [
30522,
3853,
2169,
13704,
1006,
2655,
5963,
1007,
1063,
1013,
1013,
2191,
2035,
2655,
12221,
2004,
6038,
2278,
1011,
2003,
2232,
2655,
5963,
1027,
22091,
2015,
1012,
21183,
4014,
1012,
1042,
2078,
1012,
2191,
3022,
6038,
2278,
1006,
2655,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SheetJS/js-xlsx | xlsx.js | write_BrtBeginMergeCells | function write_BrtBeginMergeCells(cnt, o) {
if(o == null) o = new_buf(4);
o.write_shift(4, cnt);
return o;
} | javascript | function write_BrtBeginMergeCells(cnt, o) {
if(o == null) o = new_buf(4);
o.write_shift(4, cnt);
return o;
} | [
"function",
"write_BrtBeginMergeCells",
"(",
"cnt",
",",
"o",
")",
"{",
"if",
"(",
"o",
"==",
"null",
")",
"o",
"=",
"new_buf",
"(",
"4",
")",
";",
"o",
".",
"write_shift",
"(",
"4",
",",
"cnt",
")",
";",
"return",
"o",
";",
"}"
] | /* [MS-XLSB] 2.4.107 BrtBeginMergeCells | [
"/",
"*",
"[",
"MS",
"-",
"XLSB",
"]",
"2",
".",
"4",
".",
"107",
"BrtBeginMergeCells"
] | 9a6d8a1d3d80c78dad5201fb389316f935279cdc | https://github.com/SheetJS/js-xlsx/blob/9a6d8a1d3d80c78dad5201fb389316f935279cdc/xlsx.js#L13631-L13635 | train | Helper function to write the begin of merge cells | [
30522,
3853,
4339,
1035,
7987,
2102,
4783,
11528,
5017,
3351,
29109,
4877,
1006,
27166,
2102,
1010,
1051,
1007,
1063,
2065,
1006,
1051,
1027,
1027,
19701,
1007,
1051,
1027,
2047,
1035,
20934,
2546,
1006,
1018,
1007,
1025,
1051,
1012,
4339,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 (x1, y1, x2, y2, x3, y3) {
var dashSum = this._dashSum;
var offset = this._dashOffset;
var lineDash = this._lineDash;
var ctx = this._ctx;
var x0 = this._xi;
var y0 = this._yi;
var t;
var dx;
var dy;
var cubicAt = curve.cubicAt;
var bezierLen = 0;
var idx = this._dashIdx;
var nDash = lineDash.length;
var x;
var y;
var tmpLen = 0;
if (offset < 0) {
// Convert to positive offset
offset = dashSum + offset;
}
offset %= dashSum;
// Bezier approx length
for (t = 0; t < 1; t += 0.1) {
dx = cubicAt(x0, x1, x2, x3, t + 0.1)
- cubicAt(x0, x1, x2, x3, t);
dy = cubicAt(y0, y1, y2, y3, t + 0.1)
- cubicAt(y0, y1, y2, y3, t);
bezierLen += mathSqrt(dx * dx + dy * dy);
}
// Find idx after add offset
for (; idx < nDash; idx++) {
tmpLen += lineDash[idx];
if (tmpLen > offset) {
break;
}
}
t = (tmpLen - offset) / bezierLen;
while (t <= 1) {
x = cubicAt(x0, x1, x2, x3, t);
y = cubicAt(y0, y1, y2, y3, t);
// Use line to approximate dashed bezier
// Bad result if dash is long
idx % 2 ? ctx.moveTo(x, y)
: ctx.lineTo(x, y);
t += lineDash[idx] / bezierLen;
idx = (idx + 1) % nDash;
}
// Finish the last segment and calculate the new offset
(idx % 2 !== 0) && ctx.lineTo(x3, y3);
dx = x3 - x;
dy = y3 - y;
this._dashOffset = -mathSqrt(dx * dx + dy * dy);
} | javascript | function (x1, y1, x2, y2, x3, y3) {
var dashSum = this._dashSum;
var offset = this._dashOffset;
var lineDash = this._lineDash;
var ctx = this._ctx;
var x0 = this._xi;
var y0 = this._yi;
var t;
var dx;
var dy;
var cubicAt = curve.cubicAt;
var bezierLen = 0;
var idx = this._dashIdx;
var nDash = lineDash.length;
var x;
var y;
var tmpLen = 0;
if (offset < 0) {
// Convert to positive offset
offset = dashSum + offset;
}
offset %= dashSum;
// Bezier approx length
for (t = 0; t < 1; t += 0.1) {
dx = cubicAt(x0, x1, x2, x3, t + 0.1)
- cubicAt(x0, x1, x2, x3, t);
dy = cubicAt(y0, y1, y2, y3, t + 0.1)
- cubicAt(y0, y1, y2, y3, t);
bezierLen += mathSqrt(dx * dx + dy * dy);
}
// Find idx after add offset
for (; idx < nDash; idx++) {
tmpLen += lineDash[idx];
if (tmpLen > offset) {
break;
}
}
t = (tmpLen - offset) / bezierLen;
while (t <= 1) {
x = cubicAt(x0, x1, x2, x3, t);
y = cubicAt(y0, y1, y2, y3, t);
// Use line to approximate dashed bezier
// Bad result if dash is long
idx % 2 ? ctx.moveTo(x, y)
: ctx.lineTo(x, y);
t += lineDash[idx] / bezierLen;
idx = (idx + 1) % nDash;
}
// Finish the last segment and calculate the new offset
(idx % 2 !== 0) && ctx.lineTo(x3, y3);
dx = x3 - x;
dy = y3 - y;
this._dashOffset = -mathSqrt(dx * dx + dy * dy);
} | [
"function",
"(",
"x1",
",",
"y1",
",",
"x2",
",",
"y2",
",",
"x3",
",",
"y3",
")",
"{",
"var",
"dashSum",
"=",
"this",
".",
"_dashSum",
";",
"var",
"offset",
"=",
"this",
".",
"_dashOffset",
";",
"var",
"lineDash",
"=",
"this",
".",
"_lineDash",
... | Not accurate dashed line to | [
"Not",
"accurate",
"dashed",
"line",
"to"
] | 30321b57cba3149c30eacb0c1e18276f0f001b9f | https://github.com/ecomfe/zrender/blob/30321b57cba3149c30eacb0c1e18276f0f001b9f/src/core/PathProxy.js#L471-L535 | train | Calculate dashed line | [
30522,
3853,
1006,
1060,
2487,
1010,
1061,
2487,
1010,
1060,
2475,
1010,
1061,
2475,
1010,
1060,
2509,
1010,
1061,
2509,
1007,
1063,
13075,
11454,
17421,
1027,
2023,
1012,
1035,
11454,
17421,
1025,
13075,
16396,
1027,
2023,
1012,
1035,
1145... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/generator-star-spacing.js | optionToDefinition | function optionToDefinition(option, defaults) {
if (!option) {
return defaults;
}
return typeof option === "string"
? optionDefinitions[option]
: Object.assign({}, defaults, option);
} | javascript | function optionToDefinition(option, defaults) {
if (!option) {
return defaults;
}
return typeof option === "string"
? optionDefinitions[option]
: Object.assign({}, defaults, option);
} | [
"function",
"optionToDefinition",
"(",
"option",
",",
"defaults",
")",
"{",
"if",
"(",
"!",
"option",
")",
"{",
"return",
"defaults",
";",
"}",
"return",
"typeof",
"option",
"===",
"\"string\"",
"?",
"optionDefinitions",
"[",
"option",
"]",
":",
"Object",
... | Returns resolved option definitions based on an option and defaults
@param {any} option - The option object or string value
@param {Object} defaults - The defaults to use if options are not present
@returns {Object} the resolved object definition | [
"Returns",
"resolved",
"option",
"definitions",
"based",
"on",
"an",
"option",
"and",
"defaults"
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/generator-star-spacing.js#L86-L94 | train | Return a definition from an option | [
30522,
3853,
5724,
3406,
3207,
16294,
22753,
1006,
5724,
1010,
12398,
2015,
1007,
1063,
2065,
1006,
999,
5724,
1007,
1063,
2709,
12398,
2015,
1025,
1065,
2709,
2828,
11253,
5724,
1027,
1027,
1027,
1000,
5164,
1000,
1029,
5724,
3207,
16294,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/coord/calendar/Calendar.js | function (data, clamp) {
zrUtil.isArray(data) && (data = data[0]);
clamp == null && (clamp = true);
var dayInfo = this.getDateInfo(data);
var range = this._rangeInfo;
var date = dayInfo.formatedDate;
// if not in range return [NaN, NaN]
if (clamp && !(
dayInfo.time >= range.start.time
&& dayInfo.time < range.end.time + PROXIMATE_ONE_DAY
)) {
return [NaN, NaN];
}
var week = dayInfo.day;
var nthWeek = this._getRangeInfo([range.start.time, date]).nthWeek;
if (this._orient === 'vertical') {
return [
this._rect.x + week * this._sw + this._sw / 2,
this._rect.y + nthWeek * this._sh + this._sh / 2
];
}
return [
this._rect.x + nthWeek * this._sw + this._sw / 2,
this._rect.y + week * this._sh + this._sh / 2
];
} | javascript | function (data, clamp) {
zrUtil.isArray(data) && (data = data[0]);
clamp == null && (clamp = true);
var dayInfo = this.getDateInfo(data);
var range = this._rangeInfo;
var date = dayInfo.formatedDate;
// if not in range return [NaN, NaN]
if (clamp && !(
dayInfo.time >= range.start.time
&& dayInfo.time < range.end.time + PROXIMATE_ONE_DAY
)) {
return [NaN, NaN];
}
var week = dayInfo.day;
var nthWeek = this._getRangeInfo([range.start.time, date]).nthWeek;
if (this._orient === 'vertical') {
return [
this._rect.x + week * this._sw + this._sw / 2,
this._rect.y + nthWeek * this._sh + this._sh / 2
];
}
return [
this._rect.x + nthWeek * this._sw + this._sw / 2,
this._rect.y + week * this._sh + this._sh / 2
];
} | [
"function",
"(",
"data",
",",
"clamp",
")",
"{",
"zrUtil",
".",
"isArray",
"(",
"data",
")",
"&&",
"(",
"data",
"=",
"data",
"[",
"0",
"]",
")",
";",
"clamp",
"==",
"null",
"&&",
"(",
"clamp",
"=",
"true",
")",
";",
"var",
"dayInfo",
"=",
"this... | Convert a time data(time, value) item to (x, y) point.
@override
@param {Array|number} data data
@param {boolean} [clamp=true] out of range
@return {Array} point | [
"Convert",
"a",
"time",
"data",
"(",
"time",
"value",
")",
"item",
"to",
"(",
"x",
"y",
")",
"point",
"."
] | 4d0ea095dc3929cb6de40c45748826e7999c7aa8 | https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/coord/calendar/Calendar.js#L194-L226 | train | get the cover cover | [
30522,
3853,
1006,
2951,
1010,
18856,
16613,
1007,
1063,
30524,
16613,
1027,
1027,
19701,
1004,
1004,
1006,
18856,
16613,
1027,
2995,
1007,
1025,
13075,
2154,
2378,
14876,
1027,
2023,
1012,
2131,
13701,
2378,
14876,
1006,
2951,
1007,
1025,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | src/sap.ui.core/src/sap/ui/core/StashedControlSupport.js | mixInto | function mixInto(fnClass, bDefaultValue) {
// add the properties
fnClass.getMetadata().addSpecialSetting("stashed", {type: "boolean", defaultValue: !!bDefaultValue});
// mix the required methods into the target fnClass
fnClass.prototype.setStashed = function(bStashed) {
if (this.stashed === true && !bStashed) {
if (this.sParentId) {
var oControl = unstash(this, sap.ui.getCore().byId(this.sParentId));
// we need to set the property to the stashed control
oControl.stashed = false;
return;
}
} else if (bStashed) {
Log.warning("Cannot re-stash a control", this.getId());
}
};
fnClass.prototype.getStashed = function() {
return this.stashed;
};
var fnDestroy = fnClass.prototype.destroy;
fnClass.prototype.destroy = function() {
delete stashedControls[this.getId()];
fnDestroy.apply(this, arguments);
};
fnClass.prototype._stash = function(sParentId, sParentAggregationName) {
// for later unstash these parent infos have to be kept
this.sParentId = sParentId;
this.sParentAggregationName = sParentAggregationName;
stashedControls[this.getId()] = this;
};
} | javascript | function mixInto(fnClass, bDefaultValue) {
// add the properties
fnClass.getMetadata().addSpecialSetting("stashed", {type: "boolean", defaultValue: !!bDefaultValue});
// mix the required methods into the target fnClass
fnClass.prototype.setStashed = function(bStashed) {
if (this.stashed === true && !bStashed) {
if (this.sParentId) {
var oControl = unstash(this, sap.ui.getCore().byId(this.sParentId));
// we need to set the property to the stashed control
oControl.stashed = false;
return;
}
} else if (bStashed) {
Log.warning("Cannot re-stash a control", this.getId());
}
};
fnClass.prototype.getStashed = function() {
return this.stashed;
};
var fnDestroy = fnClass.prototype.destroy;
fnClass.prototype.destroy = function() {
delete stashedControls[this.getId()];
fnDestroy.apply(this, arguments);
};
fnClass.prototype._stash = function(sParentId, sParentAggregationName) {
// for later unstash these parent infos have to be kept
this.sParentId = sParentId;
this.sParentAggregationName = sParentAggregationName;
stashedControls[this.getId()] = this;
};
} | [
"function",
"mixInto",
"(",
"fnClass",
",",
"bDefaultValue",
")",
"{",
"// add the properties",
"fnClass",
".",
"getMetadata",
"(",
")",
".",
"addSpecialSetting",
"(",
"\"stashed\"",
",",
"{",
"type",
":",
"\"boolean\"",
",",
"defaultValue",
":",
"!",
"!",
"bD... | private function without validity checks | [
"private",
"function",
"without",
"validity",
"checks"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/StashedControlSupport.js#L121-L155 | train | mix into the target class | [
30522,
3853,
4666,
18447,
2080,
1006,
1042,
12273,
27102,
1010,
1038,
3207,
7011,
11314,
10175,
5657,
1007,
1063,
1013,
1013,
5587,
1996,
5144,
1042,
12273,
27102,
1012,
2131,
11368,
8447,
2696,
1006,
1007,
1012,
9909,
5051,
13247,
21678,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/core/util/MockServer.js | function(sRole, aAssociation, aAssociationSet, bFrom) {
var sEntitySet = jQuery(aAssociationSet).find("End[Role='" + sRole + "']").attr("EntitySet");
var sMultiplicity = jQuery(aAssociation).find("End[Role='" + sRole + "']").attr("Multiplicity");
var aPropRef = [];
var aConstraint = jQuery(aAssociation).find("ReferentialConstraint > [Role='" + sRole + "']");
if (aConstraint && aConstraint.length > 0) {
jQuery(aConstraint[0]).children("PropertyRef").each(function(iIndex, oPropRef) {
aPropRef.push(jQuery(oPropRef).attr("Name"));
});
} else {
var oPrinDeps = (bFrom) ? oPrincipals : oDependents;
jQuery(oPrinDeps).each(function(iIndex, oPrinDep) {
if (sRole === (jQuery(oPrinDep).attr("Role"))) {
jQuery(oPrinDep).children("PropertyRef").each(function(iIndex, oPropRef) {
aPropRef.push(jQuery(oPropRef).attr("Name"));
});
return false;
}
});
}
return {
"role": sRole,
"entitySet": sEntitySet,
"propRef": aPropRef,
"multiplicity": sMultiplicity
};
} | javascript | function(sRole, aAssociation, aAssociationSet, bFrom) {
var sEntitySet = jQuery(aAssociationSet).find("End[Role='" + sRole + "']").attr("EntitySet");
var sMultiplicity = jQuery(aAssociation).find("End[Role='" + sRole + "']").attr("Multiplicity");
var aPropRef = [];
var aConstraint = jQuery(aAssociation).find("ReferentialConstraint > [Role='" + sRole + "']");
if (aConstraint && aConstraint.length > 0) {
jQuery(aConstraint[0]).children("PropertyRef").each(function(iIndex, oPropRef) {
aPropRef.push(jQuery(oPropRef).attr("Name"));
});
} else {
var oPrinDeps = (bFrom) ? oPrincipals : oDependents;
jQuery(oPrinDeps).each(function(iIndex, oPrinDep) {
if (sRole === (jQuery(oPrinDep).attr("Role"))) {
jQuery(oPrinDep).children("PropertyRef").each(function(iIndex, oPropRef) {
aPropRef.push(jQuery(oPropRef).attr("Name"));
});
return false;
}
});
}
return {
"role": sRole,
"entitySet": sEntitySet,
"propRef": aPropRef,
"multiplicity": sMultiplicity
};
} | [
"function",
"(",
"sRole",
",",
"aAssociation",
",",
"aAssociationSet",
",",
"bFrom",
")",
"{",
"var",
"sEntitySet",
"=",
"jQuery",
"(",
"aAssociationSet",
")",
".",
"find",
"(",
"\"End[Role='\"",
"+",
"sRole",
"+",
"\"']\"",
")",
".",
"attr",
"(",
"\"Entit... | helper function to find the entity set and property reference for the given role name | [
"helper",
"function",
"to",
"find",
"the",
"entity",
"set",
"and",
"property",
"reference",
"for",
"the",
"given",
"role",
"name"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/util/MockServer.js#L1197-L1225 | train | Returns the propertyRef and multiplicity of the association | [
30522,
3853,
1006,
5034,
9890,
1010,
9779,
24137,
23247,
1010,
9779,
24137,
23247,
13462,
1010,
28939,
21716,
1007,
1063,
13075,
2741,
3012,
13462,
1027,
1046,
4226,
2854,
1006,
9779,
24137,
23247,
13462,
1007,
1012,
2424,
1006,
1000,
2203,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/data/helper/completeDimensions.js | completeDimensions | function completeDimensions(sysDims, source, opt) {
if (!Source.isInstance(source)) {
source = Source.seriesDataToSource(source);
}
opt = opt || {};
sysDims = (sysDims || []).slice();
var dimsDef = (opt.dimsDef || []).slice();
var encodeDef = createHashMap(opt.encodeDef);
var dataDimNameMap = createHashMap();
var coordDimNameMap = createHashMap();
// var valueCandidate;
var result = [];
var dimCount = getDimCount(source, sysDims, dimsDef, opt.dimCount);
// Apply user defined dims (`name` and `type`) and init result.
for (var i = 0; i < dimCount; i++) {
var dimDefItem = dimsDef[i] = extend(
{}, isObject(dimsDef[i]) ? dimsDef[i] : {name: dimsDef[i]}
);
var userDimName = dimDefItem.name;
var resultItem = result[i] = {otherDims: {}};
// Name will be applied later for avoiding duplication.
if (userDimName != null && dataDimNameMap.get(userDimName) == null) {
// Only if `series.dimensions` is defined in option
// displayName, will be set, and dimension will be diplayed vertically in
// tooltip by default.
resultItem.name = resultItem.displayName = userDimName;
dataDimNameMap.set(userDimName, i);
}
dimDefItem.type != null && (resultItem.type = dimDefItem.type);
dimDefItem.displayName != null && (resultItem.displayName = dimDefItem.displayName);
}
// Set `coordDim` and `coordDimIndex` by `encodeDef` and normalize `encodeDef`.
encodeDef.each(function (dataDims, coordDim) {
dataDims = normalizeToArray(dataDims).slice();
// Note: It is allowed that `dataDims.length` is `0`, e.g., options is
// `{encode: {x: -1, y: 1}}`. Should not filter anything in
// this case.
if (dataDims.length === 1 && !isString(dataDims[0]) && dataDims[0] < 0) {
encodeDef.set(coordDim, false);
return;
}
var validDataDims = encodeDef.set(coordDim, []);
each(dataDims, function (resultDimIdx, idx) {
// The input resultDimIdx can be dim name or index.
isString(resultDimIdx) && (resultDimIdx = dataDimNameMap.get(resultDimIdx));
if (resultDimIdx != null && resultDimIdx < dimCount) {
validDataDims[idx] = resultDimIdx;
applyDim(result[resultDimIdx], coordDim, idx);
}
});
});
// Apply templetes and default order from `sysDims`.
var availDimIdx = 0;
each(sysDims, function (sysDimItem, sysDimIndex) {
var coordDim;
var sysDimItem;
var sysDimItemDimsDef;
var sysDimItemOtherDims;
if (isString(sysDimItem)) {
coordDim = sysDimItem;
sysDimItem = {};
}
else {
coordDim = sysDimItem.name;
var ordinalMeta = sysDimItem.ordinalMeta;
sysDimItem.ordinalMeta = null;
sysDimItem = clone(sysDimItem);
sysDimItem.ordinalMeta = ordinalMeta;
// `coordDimIndex` should not be set directly.
sysDimItemDimsDef = sysDimItem.dimsDef;
sysDimItemOtherDims = sysDimItem.otherDims;
sysDimItem.name = sysDimItem.coordDim = sysDimItem.coordDimIndex
= sysDimItem.dimsDef = sysDimItem.otherDims = null;
}
var dataDims = encodeDef.get(coordDim);
// negative resultDimIdx means no need to mapping.
if (dataDims === false) {
return;
}
var dataDims = normalizeToArray(dataDims);
// dimensions provides default dim sequences.
if (!dataDims.length) {
for (var i = 0; i < (sysDimItemDimsDef && sysDimItemDimsDef.length || 1); i++) {
while (availDimIdx < result.length && result[availDimIdx].coordDim != null) {
availDimIdx++;
}
availDimIdx < result.length && dataDims.push(availDimIdx++);
}
}
// Apply templates.
each(dataDims, function (resultDimIdx, coordDimIndex) {
var resultItem = result[resultDimIdx];
applyDim(defaults(resultItem, sysDimItem), coordDim, coordDimIndex);
if (resultItem.name == null && sysDimItemDimsDef) {
var sysDimItemDimsDefItem = sysDimItemDimsDef[coordDimIndex];
!isObject(sysDimItemDimsDefItem) && (sysDimItemDimsDefItem = {name: sysDimItemDimsDefItem});
resultItem.name = resultItem.displayName = sysDimItemDimsDefItem.name;
resultItem.defaultTooltip = sysDimItemDimsDefItem.defaultTooltip;
}
// FIXME refactor, currently only used in case: {otherDims: {tooltip: false}}
sysDimItemOtherDims && defaults(resultItem.otherDims, sysDimItemOtherDims);
});
});
function applyDim(resultItem, coordDim, coordDimIndex) {
if (OTHER_DIMENSIONS.get(coordDim) != null) {
resultItem.otherDims[coordDim] = coordDimIndex;
}
else {
resultItem.coordDim = coordDim;
resultItem.coordDimIndex = coordDimIndex;
coordDimNameMap.set(coordDim, true);
}
}
// Make sure the first extra dim is 'value'.
var generateCoord = opt.generateCoord;
var generateCoordCount = opt.generateCoordCount;
var fromZero = generateCoordCount != null;
generateCoordCount = generateCoord ? (generateCoordCount || 1) : 0;
var extra = generateCoord || 'value';
// Set dim `name` and other `coordDim` and other props.
for (var resultDimIdx = 0; resultDimIdx < dimCount; resultDimIdx++) {
var resultItem = result[resultDimIdx] = result[resultDimIdx] || {};
var coordDim = resultItem.coordDim;
if (coordDim == null) {
resultItem.coordDim = genName(
extra, coordDimNameMap, fromZero
);
resultItem.coordDimIndex = 0;
if (!generateCoord || generateCoordCount <= 0) {
resultItem.isExtraCoord = true;
}
generateCoordCount--;
}
resultItem.name == null && (resultItem.name = genName(
resultItem.coordDim,
dataDimNameMap
));
if (resultItem.type == null && guessOrdinal(source, resultDimIdx, resultItem.name)) {
resultItem.type = 'ordinal';
}
}
return result;
} | javascript | function completeDimensions(sysDims, source, opt) {
if (!Source.isInstance(source)) {
source = Source.seriesDataToSource(source);
}
opt = opt || {};
sysDims = (sysDims || []).slice();
var dimsDef = (opt.dimsDef || []).slice();
var encodeDef = createHashMap(opt.encodeDef);
var dataDimNameMap = createHashMap();
var coordDimNameMap = createHashMap();
// var valueCandidate;
var result = [];
var dimCount = getDimCount(source, sysDims, dimsDef, opt.dimCount);
// Apply user defined dims (`name` and `type`) and init result.
for (var i = 0; i < dimCount; i++) {
var dimDefItem = dimsDef[i] = extend(
{}, isObject(dimsDef[i]) ? dimsDef[i] : {name: dimsDef[i]}
);
var userDimName = dimDefItem.name;
var resultItem = result[i] = {otherDims: {}};
// Name will be applied later for avoiding duplication.
if (userDimName != null && dataDimNameMap.get(userDimName) == null) {
// Only if `series.dimensions` is defined in option
// displayName, will be set, and dimension will be diplayed vertically in
// tooltip by default.
resultItem.name = resultItem.displayName = userDimName;
dataDimNameMap.set(userDimName, i);
}
dimDefItem.type != null && (resultItem.type = dimDefItem.type);
dimDefItem.displayName != null && (resultItem.displayName = dimDefItem.displayName);
}
// Set `coordDim` and `coordDimIndex` by `encodeDef` and normalize `encodeDef`.
encodeDef.each(function (dataDims, coordDim) {
dataDims = normalizeToArray(dataDims).slice();
// Note: It is allowed that `dataDims.length` is `0`, e.g., options is
// `{encode: {x: -1, y: 1}}`. Should not filter anything in
// this case.
if (dataDims.length === 1 && !isString(dataDims[0]) && dataDims[0] < 0) {
encodeDef.set(coordDim, false);
return;
}
var validDataDims = encodeDef.set(coordDim, []);
each(dataDims, function (resultDimIdx, idx) {
// The input resultDimIdx can be dim name or index.
isString(resultDimIdx) && (resultDimIdx = dataDimNameMap.get(resultDimIdx));
if (resultDimIdx != null && resultDimIdx < dimCount) {
validDataDims[idx] = resultDimIdx;
applyDim(result[resultDimIdx], coordDim, idx);
}
});
});
// Apply templetes and default order from `sysDims`.
var availDimIdx = 0;
each(sysDims, function (sysDimItem, sysDimIndex) {
var coordDim;
var sysDimItem;
var sysDimItemDimsDef;
var sysDimItemOtherDims;
if (isString(sysDimItem)) {
coordDim = sysDimItem;
sysDimItem = {};
}
else {
coordDim = sysDimItem.name;
var ordinalMeta = sysDimItem.ordinalMeta;
sysDimItem.ordinalMeta = null;
sysDimItem = clone(sysDimItem);
sysDimItem.ordinalMeta = ordinalMeta;
// `coordDimIndex` should not be set directly.
sysDimItemDimsDef = sysDimItem.dimsDef;
sysDimItemOtherDims = sysDimItem.otherDims;
sysDimItem.name = sysDimItem.coordDim = sysDimItem.coordDimIndex
= sysDimItem.dimsDef = sysDimItem.otherDims = null;
}
var dataDims = encodeDef.get(coordDim);
// negative resultDimIdx means no need to mapping.
if (dataDims === false) {
return;
}
var dataDims = normalizeToArray(dataDims);
// dimensions provides default dim sequences.
if (!dataDims.length) {
for (var i = 0; i < (sysDimItemDimsDef && sysDimItemDimsDef.length || 1); i++) {
while (availDimIdx < result.length && result[availDimIdx].coordDim != null) {
availDimIdx++;
}
availDimIdx < result.length && dataDims.push(availDimIdx++);
}
}
// Apply templates.
each(dataDims, function (resultDimIdx, coordDimIndex) {
var resultItem = result[resultDimIdx];
applyDim(defaults(resultItem, sysDimItem), coordDim, coordDimIndex);
if (resultItem.name == null && sysDimItemDimsDef) {
var sysDimItemDimsDefItem = sysDimItemDimsDef[coordDimIndex];
!isObject(sysDimItemDimsDefItem) && (sysDimItemDimsDefItem = {name: sysDimItemDimsDefItem});
resultItem.name = resultItem.displayName = sysDimItemDimsDefItem.name;
resultItem.defaultTooltip = sysDimItemDimsDefItem.defaultTooltip;
}
// FIXME refactor, currently only used in case: {otherDims: {tooltip: false}}
sysDimItemOtherDims && defaults(resultItem.otherDims, sysDimItemOtherDims);
});
});
function applyDim(resultItem, coordDim, coordDimIndex) {
if (OTHER_DIMENSIONS.get(coordDim) != null) {
resultItem.otherDims[coordDim] = coordDimIndex;
}
else {
resultItem.coordDim = coordDim;
resultItem.coordDimIndex = coordDimIndex;
coordDimNameMap.set(coordDim, true);
}
}
// Make sure the first extra dim is 'value'.
var generateCoord = opt.generateCoord;
var generateCoordCount = opt.generateCoordCount;
var fromZero = generateCoordCount != null;
generateCoordCount = generateCoord ? (generateCoordCount || 1) : 0;
var extra = generateCoord || 'value';
// Set dim `name` and other `coordDim` and other props.
for (var resultDimIdx = 0; resultDimIdx < dimCount; resultDimIdx++) {
var resultItem = result[resultDimIdx] = result[resultDimIdx] || {};
var coordDim = resultItem.coordDim;
if (coordDim == null) {
resultItem.coordDim = genName(
extra, coordDimNameMap, fromZero
);
resultItem.coordDimIndex = 0;
if (!generateCoord || generateCoordCount <= 0) {
resultItem.isExtraCoord = true;
}
generateCoordCount--;
}
resultItem.name == null && (resultItem.name = genName(
resultItem.coordDim,
dataDimNameMap
));
if (resultItem.type == null && guessOrdinal(source, resultDimIdx, resultItem.name)) {
resultItem.type = 'ordinal';
}
}
return result;
} | [
"function",
"completeDimensions",
"(",
"sysDims",
",",
"source",
",",
"opt",
")",
"{",
"if",
"(",
"!",
"Source",
".",
"isInstance",
"(",
"source",
")",
")",
"{",
"source",
"=",
"Source",
".",
"seriesDataToSource",
"(",
"source",
")",
";",
"}",
"opt",
"... | @see {module:echarts/test/ut/spec/data/completeDimensions}
Complete the dimensions array, by user defined `dimension` and `encode`,
and guessing from the data structure.
If no 'value' dimension specified, the first no-named dimension will be
named as 'value'.
@param {Array.<string>} sysDims Necessary dimensions, like ['x', 'y'], which
provides not only dim template, but also default order.
properties: 'name', 'type', 'displayName'.
`name` of each item provides default coord name.
[{dimsDef: [string|Object, ...]}, ...] dimsDef of sysDim item provides default dim name, and
provide dims count that the sysDim required.
[{ordinalMeta}] can be specified.
@param {module:echarts/data/Source|Array|Object} source or data (for compatibal with pervious)
@param {Object} [opt]
@param {Array.<Object|string>} [opt.dimsDef] option.series.dimensions User defined dimensions
For example: ['asdf', {name, type}, ...].
@param {Object|HashMap} [opt.encodeDef] option.series.encode {x: 2, y: [3, 1], tooltip: [1, 2], label: 3}
@param {string} [opt.generateCoord] Generate coord dim with the given name.
If not specified, extra dim names will be:
'value', 'value0', 'value1', ...
@param {number} [opt.generateCoordCount] By default, the generated dim name is `generateCoord`.
If `generateCoordCount` specified, the generated dim names will be:
`generateCoord` + 0, `generateCoord` + 1, ...
can be Infinity, indicate that use all of the remain columns.
@param {number} [opt.dimCount] If not specified, guess by the first data item.
@param {number} [opt.encodeDefaulter] If not specified, auto find the next available data dim.
@return {Array.<Object>} [{
name: string mandatory,
displayName: string, the origin name in dimsDef, see source helper.
If displayName given, the tooltip will displayed vertically.
coordDim: string mandatory,
coordDimIndex: number mandatory,
type: string optional,
otherDims: { never null/undefined
tooltip: number optional,
label: number optional,
itemName: number optional,
seriesName: number optional,
},
isExtraCoord: boolean true if coord is generated
(not specified in encode and not series specified)
other props ...
}] | [
"@see",
"{",
"module",
":",
"echarts",
"/",
"test",
"/",
"ut",
"/",
"spec",
"/",
"data",
"/",
"completeDimensions",
"}"
] | 4d0ea095dc3929cb6de40c45748826e7999c7aa8 | https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/data/helper/completeDimensions.js#L78-L239 | train | Complete dimensions of a series. | [
30522,
3853,
2949,
14428,
3619,
8496,
1006,
25353,
16150,
5714,
2015,
1010,
3120,
1010,
23569,
1007,
1063,
2065,
1006,
999,
3120,
1012,
2003,
7076,
26897,
1006,
3120,
1007,
1007,
1063,
3120,
1027,
3120,
1012,
2186,
2850,
29336,
19137,
3126,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/_AnnotationHelperExpression.js | function (oInterface, oPathValue, sType) {
var sExpectedEdmType = sType === "And" || sType === "Or" ? "Edm.Boolean" : undefined,
oParameter0 = Expression.parameter(oInterface, oPathValue, 0, sExpectedEdmType),
oParameter1 = Expression.parameter(oInterface, oPathValue, 1, sExpectedEdmType),
sTypeInfo,
bNeedsCompare,
sValue0,
sValue1;
if (oParameter0.type !== "edm:Null" && oParameter1.type !== "edm:Null") {
oParameter0.category = mType2Category[oParameter0.type];
oParameter1.category = mType2Category[oParameter1.type];
Expression.adjustOperands(oParameter0, oParameter1);
Expression.adjustOperands(oParameter1, oParameter0);
if (oParameter0.category !== oParameter1.category) {
Basics.error(oPathValue,
"Expected two comparable parameters but instead saw " + oParameter0.type
+ " and " + oParameter1.type);
}
sTypeInfo = oParameter0.category === "decimal" ? ",true" : "";
bNeedsCompare = mTypeCategoryNeedsCompare[oParameter0.category];
}
sValue0 = Expression.formatOperand(oPathValue, 0, oParameter0, !bNeedsCompare);
sValue1 = Expression.formatOperand(oPathValue, 1, oParameter1, !bNeedsCompare);
return {
result : "expression",
value : bNeedsCompare
? "odata.compare(" + sValue0 + "," + sValue1 + sTypeInfo + ")"
+ mOData2JSOperators[sType] + "0"
: sValue0 + mOData2JSOperators[sType] + sValue1,
type : "Edm.Boolean"
};
} | javascript | function (oInterface, oPathValue, sType) {
var sExpectedEdmType = sType === "And" || sType === "Or" ? "Edm.Boolean" : undefined,
oParameter0 = Expression.parameter(oInterface, oPathValue, 0, sExpectedEdmType),
oParameter1 = Expression.parameter(oInterface, oPathValue, 1, sExpectedEdmType),
sTypeInfo,
bNeedsCompare,
sValue0,
sValue1;
if (oParameter0.type !== "edm:Null" && oParameter1.type !== "edm:Null") {
oParameter0.category = mType2Category[oParameter0.type];
oParameter1.category = mType2Category[oParameter1.type];
Expression.adjustOperands(oParameter0, oParameter1);
Expression.adjustOperands(oParameter1, oParameter0);
if (oParameter0.category !== oParameter1.category) {
Basics.error(oPathValue,
"Expected two comparable parameters but instead saw " + oParameter0.type
+ " and " + oParameter1.type);
}
sTypeInfo = oParameter0.category === "decimal" ? ",true" : "";
bNeedsCompare = mTypeCategoryNeedsCompare[oParameter0.category];
}
sValue0 = Expression.formatOperand(oPathValue, 0, oParameter0, !bNeedsCompare);
sValue1 = Expression.formatOperand(oPathValue, 1, oParameter1, !bNeedsCompare);
return {
result : "expression",
value : bNeedsCompare
? "odata.compare(" + sValue0 + "," + sValue1 + sTypeInfo + ")"
+ mOData2JSOperators[sType] + "0"
: sValue0 + mOData2JSOperators[sType] + sValue1,
type : "Edm.Boolean"
};
} | [
"function",
"(",
"oInterface",
",",
"oPathValue",
",",
"sType",
")",
"{",
"var",
"sExpectedEdmType",
"=",
"sType",
"===",
"\"And\"",
"||",
"sType",
"===",
"\"Or\"",
"?",
"\"Edm.Boolean\"",
":",
"undefined",
",",
"oParameter0",
"=",
"Expression",
".",
"paramete... | Handling of "14.5.1 Comparison and Logical Operators" except <code>edm:Not</code>.
@param {sap.ui.core.util.XMLPreprocessor.IContext|sap.ui.model.Context} oInterface
the callback interface related to the current formatter call
@param {object} oPathValue
path and value information pointing to the parameter array (see Expression object)
@param {string} sType
the operator as text (like "And" or "Or")
@returns {object}
the result object | [
"Handling",
"of",
"14",
".",
"5",
".",
"1",
"Comparison",
"and",
"Logical",
"Operators",
"except",
"<code",
">",
"edm",
":",
"Not<",
"/",
"code",
">",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/_AnnotationHelperExpression.js#L571-L604 | train | Returns an object with the parameters of the given type and value | [
30522,
3853,
1006,
1051,
18447,
2121,
12172,
1010,
6728,
8988,
10175,
5657,
1010,
2358,
18863,
1007,
1063,
13075,
3348,
5051,
10985,
2098,
20492,
18863,
1027,
2358,
18863,
1027,
1027,
1027,
1000,
1998,
1000,
1064,
1064,
2358,
18863,
1027,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
ColorlibHQ/AdminLTE | bower_components/select2/src/js/select2/i18n/lv.js | ending | function ending (count, eleven, singular, other) {
if (count === 11) {
return eleven;
}
if (count % 10 === 1) {
return singular;
}
return other;
} | javascript | function ending (count, eleven, singular, other) {
if (count === 11) {
return eleven;
}
if (count % 10 === 1) {
return singular;
}
return other;
} | [
"function",
"ending",
"(",
"count",
",",
"eleven",
",",
"singular",
",",
"other",
")",
"{",
"if",
"(",
"count",
"===",
"11",
")",
"{",
"return",
"eleven",
";",
"}",
"if",
"(",
"count",
"%",
"10",
"===",
"1",
")",
"{",
"return",
"singular",
";",
"... | Latvian | [
"Latvian"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/bower_components/select2/src/js/select2/i18n/lv.js#L3-L13 | train | Returns the ending of the given count | [
30522,
3853,
4566,
1006,
4175,
1010,
5408,
1010,
13048,
1010,
2060,
1007,
1063,
2065,
1006,
4175,
1027,
1027,
1027,
2340,
1007,
1063,
2709,
5408,
1025,
1065,
2065,
1006,
4175,
1003,
2184,
1027,
1027,
1027,
1015,
1007,
1063,
2709,
13048,
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/command/CommandManager.js | registerInternal | function registerInternal(id, commandFn) {
if (_commands[id]) {
console.log("Attempting to register an already-registered command: " + id);
return null;
}
if (!id || !commandFn) {
console.error("Attempting to register an internal command with a missing id, or command function: " + id);
return null;
}
var command = new Command(null, id, commandFn);
_commands[id] = command;
exports.trigger("commandRegistered", command);
return command;
} | javascript | function registerInternal(id, commandFn) {
if (_commands[id]) {
console.log("Attempting to register an already-registered command: " + id);
return null;
}
if (!id || !commandFn) {
console.error("Attempting to register an internal command with a missing id, or command function: " + id);
return null;
}
var command = new Command(null, id, commandFn);
_commands[id] = command;
exports.trigger("commandRegistered", command);
return command;
} | [
"function",
"registerInternal",
"(",
"id",
",",
"commandFn",
")",
"{",
"if",
"(",
"_commands",
"[",
"id",
"]",
")",
"{",
"console",
".",
"log",
"(",
"\"Attempting to register an already-registered command: \"",
"+",
"id",
")",
";",
"return",
"null",
";",
"}",
... | Registers a global internal only command.
@param {string} id - unique identifier for command.
Core commands in Brackets use a simple command title as an id, for example "app.abort_quit".
Extensions should use the following format: "author.myextension.mycommandname".
For example, "lschmitt.csswizard.format.css".
@param {function(...)} commandFn - the function to call when the command is executed. Any arguments passed to
execute() (after the id) are passed as arguments to the function. If the function is asynchronous,
it must return a jQuery promise that is resolved when the command completes. Otherwise, the
CommandManager will assume it is synchronous, and return a promise that is already resolved.
@return {?Command} | [
"Registers",
"a",
"global",
"internal",
"only",
"command",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/command/CommandManager.js#L219-L235 | train | Registers an internal command | [
30522,
3853,
4236,
18447,
11795,
2389,
1006,
8909,
1010,
3094,
2546,
2078,
1007,
1063,
2065,
1006,
1035,
10954,
1031,
8909,
1033,
1007,
1063,
10122,
1012,
8833,
1006,
1000,
7161,
2000,
4236,
2019,
2525,
1011,
5068,
3094,
1024,
1000,
1009,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
airbnb/enzyme | packages/enzyme/src/ShallowWrapper.js | deepRender | function deepRender(wrapper, target, adapter) {
const node = wrapper[NODE];
const element = node && adapter.nodeToElement(node);
if (wrapper.type() === target) {
return wrapper.dive();
}
if (element && isCustomComponentElement(element, adapter)) {
return deepRender(wrapper.dive(), target, adapter);
}
const children = wrapper.children();
for (let i = 0; i < children.length; i += 1) {
const found = deepRender(children.at(i), target, adapter);
if (typeof found !== 'undefined') {
return found;
}
}
return undefined;
} | javascript | function deepRender(wrapper, target, adapter) {
const node = wrapper[NODE];
const element = node && adapter.nodeToElement(node);
if (wrapper.type() === target) {
return wrapper.dive();
}
if (element && isCustomComponentElement(element, adapter)) {
return deepRender(wrapper.dive(), target, adapter);
}
const children = wrapper.children();
for (let i = 0; i < children.length; i += 1) {
const found = deepRender(children.at(i), target, adapter);
if (typeof found !== 'undefined') {
return found;
}
}
return undefined;
} | [
"function",
"deepRender",
"(",
"wrapper",
",",
"target",
",",
"adapter",
")",
"{",
"const",
"node",
"=",
"wrapper",
"[",
"NODE",
"]",
";",
"const",
"element",
"=",
"node",
"&&",
"adapter",
".",
"nodeToElement",
"(",
"node",
")",
";",
"if",
"(",
"wrappe... | Recursively dive()s every custom component in a wrapper until
the target component is found.
@param {ShallowWrapper} wrapper A ShallowWrapper to search
@param {ComponentType} target A react custom component that, when found, will end recursion
@param {Adapter} adapter An Enzyme adapter
@returns {ShallowWrapper|undefined} A ShallowWrapper for the target, or
undefined if it can't be found | [
"Recursively",
"dive",
"()",
"s",
"every",
"custom",
"component",
"in",
"a",
"wrapper",
"until",
"the",
"target",
"component",
"is",
"found",
"."
] | cd430eae95eba151f17e970ee77c18f09476de0e | https://github.com/airbnb/enzyme/blob/cd430eae95eba151f17e970ee77c18f09476de0e/packages/enzyme/src/ShallowWrapper.js#L291-L308 | train | Deep render wrapper to target | [
30522,
3853,
2784,
7389,
4063,
1006,
10236,
4842,
1010,
4539,
1010,
15581,
2121,
1007,
1063,
9530,
3367,
13045,
1027,
10236,
4842,
1031,
13045,
1033,
1025,
9530,
3367,
5783,
1027,
13045,
1004,
1004,
15581,
2121,
1012,
13045,
3406,
12260,
36... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/performance/trace/Interaction.js | function(sType, oSrcElement) {
var iTime = now();
if (oPendingInteraction) {
finalizeInteraction(iTime);
}
// clear request timings for new interaction
if (window.performance.clearResourceTimings) {
window.performance.clearResourceTimings();
}
var oComponentInfo = createOwnerComponentInfo(oSrcElement);
// setup new pending interaction
oPendingInteraction = createMeasurement(iTime);
oPendingInteraction.event = sType;
oPendingInteraction.component = oComponentInfo.id;
oPendingInteraction.appVersion = oComponentInfo.version;
oPendingInteraction.start = iTime;
if (oSrcElement && oSrcElement.getId) {
oPendingInteraction.trigger = oSrcElement.getId();
}
Log.info("Interaction step started: trigger: " + oPendingInteraction.trigger + "; type: " + oPendingInteraction.event, "Interaction.js");
} | javascript | function(sType, oSrcElement) {
var iTime = now();
if (oPendingInteraction) {
finalizeInteraction(iTime);
}
// clear request timings for new interaction
if (window.performance.clearResourceTimings) {
window.performance.clearResourceTimings();
}
var oComponentInfo = createOwnerComponentInfo(oSrcElement);
// setup new pending interaction
oPendingInteraction = createMeasurement(iTime);
oPendingInteraction.event = sType;
oPendingInteraction.component = oComponentInfo.id;
oPendingInteraction.appVersion = oComponentInfo.version;
oPendingInteraction.start = iTime;
if (oSrcElement && oSrcElement.getId) {
oPendingInteraction.trigger = oSrcElement.getId();
}
Log.info("Interaction step started: trigger: " + oPendingInteraction.trigger + "; type: " + oPendingInteraction.event, "Interaction.js");
} | [
"function",
"(",
"sType",
",",
"oSrcElement",
")",
"{",
"var",
"iTime",
"=",
"now",
"(",
")",
";",
"if",
"(",
"oPendingInteraction",
")",
"{",
"finalizeInteraction",
"(",
"iTime",
")",
";",
"}",
"// clear request timings for new interaction",
"if",
"(",
"windo... | Start an interaction measurements.
@param {string} sType type of the event which triggered the interaction
@param {object} oSrcElement the control on which the interaction was triggered
@static
@private | [
"Start",
"an",
"interaction",
"measurements",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/performance/trace/Interaction.js#L352-L376 | train | Initializes a new pending interaction | [
30522,
3853,
1006,
2358,
18863,
1010,
9808,
19170,
16930,
4765,
1007,
1063,
13075,
2009,
14428,
1027,
2085,
1006,
1007,
1025,
2065,
1006,
2330,
4667,
18447,
6906,
7542,
1007,
1063,
2345,
4697,
18447,
6906,
7542,
1006,
2009,
14428,
1007,
102... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
TryGhost/Ghost | core/server/models/base/index.js | filterOptions | function filterOptions(unfilteredOptions, methodName, filterConfig) {
unfilteredOptions = unfilteredOptions || {};
filterConfig = filterConfig || {};
if (unfilteredOptions.hasOwnProperty('include')) {
throw new common.errors.IncorrectUsageError({
message: 'The model layer expects using `withRelated`.'
});
}
var options = _.cloneDeep(unfilteredOptions),
extraAllowedProperties = filterConfig.extraAllowedProperties || [],
permittedOptions;
permittedOptions = this.permittedOptions(methodName, options);
permittedOptions = _.union(permittedOptions, extraAllowedProperties);
options = _.pick(options, permittedOptions);
if (this.defaultRelations) {
options = this.defaultRelations(methodName, options);
}
return options;
} | javascript | function filterOptions(unfilteredOptions, methodName, filterConfig) {
unfilteredOptions = unfilteredOptions || {};
filterConfig = filterConfig || {};
if (unfilteredOptions.hasOwnProperty('include')) {
throw new common.errors.IncorrectUsageError({
message: 'The model layer expects using `withRelated`.'
});
}
var options = _.cloneDeep(unfilteredOptions),
extraAllowedProperties = filterConfig.extraAllowedProperties || [],
permittedOptions;
permittedOptions = this.permittedOptions(methodName, options);
permittedOptions = _.union(permittedOptions, extraAllowedProperties);
options = _.pick(options, permittedOptions);
if (this.defaultRelations) {
options = this.defaultRelations(methodName, options);
}
return options;
} | [
"function",
"filterOptions",
"(",
"unfilteredOptions",
",",
"methodName",
",",
"filterConfig",
")",
"{",
"unfilteredOptions",
"=",
"unfilteredOptions",
"||",
"{",
"}",
";",
"filterConfig",
"=",
"filterConfig",
"||",
"{",
"}",
";",
"if",
"(",
"unfilteredOptions",
... | Filters potentially unsafe `options` in a model method's arguments, so you can pass them to Bookshelf / Knex.
@param {Object} unfilteredOptions Represents options to filter in order to be passed to the Bookshelf query.
@param {String} methodName The name of the method to check valid options for.
@return {Object} The filtered results of `options`. | [
"Filters",
"potentially",
"unsafe",
"options",
"in",
"a",
"model",
"method",
"s",
"arguments",
"so",
"you",
"can",
"pass",
"them",
"to",
"Bookshelf",
"/",
"Knex",
"."
] | bb7bb55cf3e60af99ebbc56099928827b58461bc | https://github.com/TryGhost/Ghost/blob/bb7bb55cf3e60af99ebbc56099928827b58461bc/core/server/models/base/index.js#L791-L814 | train | Returns an object with the options that are not required to be included in the filter. | [
30522,
3853,
11307,
7361,
9285,
1006,
4895,
8873,
21928,
26010,
16790,
2015,
1010,
4118,
18442,
1010,
11307,
8663,
8873,
2290,
1007,
1063,
4895,
8873,
21928,
26010,
16790,
2015,
1027,
4895,
8873,
21928,
26010,
16790,
2015,
1064,
1064,
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... |
ColorlibHQ/AdminLTE | plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js | function(controlRange) {
var selection,
range;
if (controlRange && this.doc.selection && this.doc.selection.type === "Control") {
range = this.doc.selection.createRange();
if (range && range.length) {
return range.item(0);
}
}
selection = this.getSelection(this.doc);
if (selection.focusNode === selection.anchorNode) {
return selection.focusNode;
} else {
range = this.getRange(this.doc);
return range ? range.commonAncestorContainer : this.doc.body;
}
} | javascript | function(controlRange) {
var selection,
range;
if (controlRange && this.doc.selection && this.doc.selection.type === "Control") {
range = this.doc.selection.createRange();
if (range && range.length) {
return range.item(0);
}
}
selection = this.getSelection(this.doc);
if (selection.focusNode === selection.anchorNode) {
return selection.focusNode;
} else {
range = this.getRange(this.doc);
return range ? range.commonAncestorContainer : this.doc.body;
}
} | [
"function",
"(",
"controlRange",
")",
"{",
"var",
"selection",
",",
"range",
";",
"if",
"(",
"controlRange",
"&&",
"this",
".",
"doc",
".",
"selection",
"&&",
"this",
".",
"doc",
".",
"selection",
".",
"type",
"===",
"\"Control\"",
")",
"{",
"range",
"... | Get the node which contains the selection
@param {Boolean} [controlRange] (only IE) Whether it should return the selected ControlRange element when the selection type is a "ControlRange"
@return {Object} The node that contains the caret
@example
var nodeThatContainsCaret = selection.getSelectedNode(); | [
"Get",
"the",
"node",
"which",
"contains",
"the",
"selection"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js#L8863-L8881 | train | Returns the first ancestor of the selection | [
30522,
3853,
1006,
2491,
24388,
2063,
1007,
1063,
13075,
4989,
1010,
2846,
1025,
2065,
1006,
2491,
24388,
2063,
1004,
1004,
2023,
1012,
9986,
1012,
4989,
1004,
1004,
2023,
1012,
9986,
1012,
4989,
1012,
2828,
1027,
1027,
1027,
1000,
2491,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | aio/tools/transforms/angular-base-package/rendering/hasValues.js | readProperty | function readProperty(obj, propertySegments, index) {
const value = obj[propertySegments[index]];
return !!value && (index === propertySegments.length - 1 || readProperty(value, propertySegments, index + 1));
} | javascript | function readProperty(obj, propertySegments, index) {
const value = obj[propertySegments[index]];
return !!value && (index === propertySegments.length - 1 || readProperty(value, propertySegments, index + 1));
} | [
"function",
"readProperty",
"(",
"obj",
",",
"propertySegments",
",",
"index",
")",
"{",
"const",
"value",
"=",
"obj",
"[",
"propertySegments",
"[",
"index",
"]",
"]",
";",
"return",
"!",
"!",
"value",
"&&",
"(",
"index",
"===",
"propertySegments",
".",
... | Search deeply into an object via a collection of property segments, starting at the
indexed segment.
E.g. if `obj = { a: { b: { c: 10 }}}` then
`readProperty(obj, ['a', 'b', 'c'], 0)` will return true;
but
`readProperty(obj, ['a', 'd'], 0)` will return false; | [
"Search",
"deeply",
"into",
"an",
"object",
"via",
"a",
"collection",
"of",
"property",
"segments",
"starting",
"at",
"the",
"indexed",
"segment",
"."
] | c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c | https://github.com/angular/angular/blob/c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c/aio/tools/transforms/angular-base-package/rendering/hasValues.js#L20-L23 | train | Returns true if the value at index is in obj | [
30522,
3853,
3191,
21572,
4842,
3723,
1006,
27885,
3501,
1010,
3200,
3366,
21693,
11187,
1010,
5950,
1007,
1063,
9530,
3367,
3643,
1027,
27885,
3501,
1031,
3200,
3366,
21693,
11187,
1031,
5950,
1033,
1033,
1025,
2709,
999,
999,
3643,
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... |
testing-library/dom-testing-library | src/query-helpers.js | debugDOM | function debugDOM(htmlElement) {
const limit = process.env.DEBUG_PRINT_LIMIT || 7000
const inNode =
typeof process !== 'undefined' &&
process.versions !== undefined &&
process.versions.node !== undefined
/* istanbul ignore next */
const window =
(htmlElement.ownerDocument && htmlElement.ownerDocument.defaultView) ||
undefined
const inCypress =
(typeof global !== 'undefined' && global.Cypress) ||
(typeof window !== 'undefined' && window.Cypress)
/* istanbul ignore else */
if (inCypress) {
return ''
} else if (inNode) {
return prettyDOM(htmlElement, limit)
} else {
return prettyDOM(htmlElement, limit, {highlight: false})
}
} | javascript | function debugDOM(htmlElement) {
const limit = process.env.DEBUG_PRINT_LIMIT || 7000
const inNode =
typeof process !== 'undefined' &&
process.versions !== undefined &&
process.versions.node !== undefined
/* istanbul ignore next */
const window =
(htmlElement.ownerDocument && htmlElement.ownerDocument.defaultView) ||
undefined
const inCypress =
(typeof global !== 'undefined' && global.Cypress) ||
(typeof window !== 'undefined' && window.Cypress)
/* istanbul ignore else */
if (inCypress) {
return ''
} else if (inNode) {
return prettyDOM(htmlElement, limit)
} else {
return prettyDOM(htmlElement, limit, {highlight: false})
}
} | [
"function",
"debugDOM",
"(",
"htmlElement",
")",
"{",
"const",
"limit",
"=",
"process",
".",
"env",
".",
"DEBUG_PRINT_LIMIT",
"||",
"7000",
"const",
"inNode",
"=",
"typeof",
"process",
"!==",
"'undefined'",
"&&",
"process",
".",
"versions",
"!==",
"undefined",... | /* eslint-disable complexity | [
"/",
"*",
"eslint",
"-",
"disable",
"complexity"
] | fcb2cbcffb7aff6ecff3be8731168c86eee82ce1 | https://github.com/testing-library/dom-testing-library/blob/fcb2cbcffb7aff6ecff3be8731168c86eee82ce1/src/query-helpers.js#L6-L27 | train | Returns a string representation of the given HTML element. | [
30522,
3853,
2139,
8569,
2290,
9527,
1006,
16129,
12260,
3672,
1007,
1063,
9530,
3367,
5787,
1027,
2832,
1012,
4372,
2615,
1012,
2139,
8569,
2290,
1035,
6140,
1035,
5787,
1064,
1064,
6352,
2692,
9530,
3367,
7601,
10244,
1027,
2828,
11253,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/radix.js | isParseIntMethod | function isParseIntMethod(node) {
return (
node.type === "MemberExpression" &&
!node.computed &&
node.property.type === "Identifier" &&
node.property.name === "parseInt"
);
} | javascript | function isParseIntMethod(node) {
return (
node.type === "MemberExpression" &&
!node.computed &&
node.property.type === "Identifier" &&
node.property.name === "parseInt"
);
} | [
"function",
"isParseIntMethod",
"(",
"node",
")",
"{",
"return",
"(",
"node",
".",
"type",
"===",
"\"MemberExpression\"",
"&&",
"!",
"node",
".",
"computed",
"&&",
"node",
".",
"property",
".",
"type",
"===",
"\"Identifier\"",
"&&",
"node",
".",
"property",
... | Checks whether a given node is a MemberExpression of `parseInt` method or not.
@param {ASTNode} node - A node to check.
@returns {boolean} `true` if the node is a MemberExpression of `parseInt`
method. | [
"Checks",
"whether",
"a",
"given",
"node",
"is",
"a",
"MemberExpression",
"of",
"parseInt",
"method",
"or",
"not",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/radix.js#L38-L45 | train | Checks whether a MemberExpression is a parseInt method. | [
30522,
3853,
2003,
19362,
20240,
3372,
11368,
6806,
2094,
1006,
13045,
1007,
1063,
2709,
1006,
13045,
1012,
2828,
1027,
1027,
1027,
1000,
2266,
10288,
20110,
3258,
1000,
1004,
1004,
999,
13045,
1012,
24806,
1004,
1004,
13045,
1012,
3200,
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... |
wangfupeng1988/wangEditor | src/js/text/index.js | getChildrenJSON | function getChildrenJSON($elem) {
const result = []
const $children = $elem.childNodes() || [] // 注意 childNodes() 可以获取文本节点
$children.forEach(curElem => {
let elemResult
const nodeType = curElem.nodeType
// 文本节点
if (nodeType === 3) {
elemResult = curElem.textContent
elemResult = replaceHtmlSymbol(elemResult)
}
// 普通 DOM 节点
if (nodeType === 1) {
elemResult = {}
// tag
elemResult.tag = curElem.nodeName.toLowerCase()
// attr
const attrData = []
const attrList = curElem.attributes || {}
const attrListLength = attrList.length || 0
for (let i = 0; i < attrListLength; i++) {
const attr = attrList[i]
attrData.push({
name: attr.name,
value: attr.value
})
}
elemResult.attrs = attrData
// children(递归)
elemResult.children = getChildrenJSON($(curElem))
}
result.push(elemResult)
})
return result
} | javascript | function getChildrenJSON($elem) {
const result = []
const $children = $elem.childNodes() || [] // 注意 childNodes() 可以获取文本节点
$children.forEach(curElem => {
let elemResult
const nodeType = curElem.nodeType
// 文本节点
if (nodeType === 3) {
elemResult = curElem.textContent
elemResult = replaceHtmlSymbol(elemResult)
}
// 普通 DOM 节点
if (nodeType === 1) {
elemResult = {}
// tag
elemResult.tag = curElem.nodeName.toLowerCase()
// attr
const attrData = []
const attrList = curElem.attributes || {}
const attrListLength = attrList.length || 0
for (let i = 0; i < attrListLength; i++) {
const attr = attrList[i]
attrData.push({
name: attr.name,
value: attr.value
})
}
elemResult.attrs = attrData
// children(递归)
elemResult.children = getChildrenJSON($(curElem))
}
result.push(elemResult)
})
return result
} | [
"function",
"getChildrenJSON",
"(",
"$elem",
")",
"{",
"const",
"result",
"=",
"[",
"]",
"const",
"$children",
"=",
"$elem",
".",
"childNodes",
"(",
")",
"||",
"[",
"]",
"// 注意 childNodes() 可以获取文本节点",
"$children",
".",
"forEach",
"(",
"curElem",
"=>",
"{",
... | 获取一个 elem.childNodes 的 JSON 数据 | [
"获取一个",
"elem",
".",
"childNodes",
"的",
"JSON",
"数据"
] | b77696f5e81c8ec13d9d341252d6b9fa8a22db18 | https://github.com/wangfupeng1988/wangEditor/blob/b77696f5e81c8ec13d9d341252d6b9fa8a22db18/src/js/text/index.js#L10-L48 | train | getChildrenJSON - 获取文本节点 | [
30522,
3853,
2131,
19339,
7389,
22578,
2239,
1006,
1002,
3449,
6633,
1007,
1063,
9530,
3367,
2765,
1027,
1031,
1033,
9530,
3367,
1002,
2336,
1027,
1002,
3449,
6633,
1012,
2775,
3630,
6155,
1006,
1007,
1064,
1064,
1031,
1033,
1013,
1013,
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 | bower_components/jvectormap/lib/world-map.js | function() {
var key,
i;
for (key in this.series) {
for (i = 0; i < this.series[key].length; i++) {
this.series[key][i].clear();
}
}
this.scale = this.baseScale;
this.transX = this.baseTransX;
this.transY = this.baseTransY;
this.applyTransform();
} | javascript | function() {
var key,
i;
for (key in this.series) {
for (i = 0; i < this.series[key].length; i++) {
this.series[key][i].clear();
}
}
this.scale = this.baseScale;
this.transX = this.baseTransX;
this.transY = this.baseTransY;
this.applyTransform();
} | [
"function",
"(",
")",
"{",
"var",
"key",
",",
"i",
";",
"for",
"(",
"key",
"in",
"this",
".",
"series",
")",
"{",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"series",
"[",
"key",
"]",
".",
"length",
";",
"i",
"++",
")",
"{",
"... | Reset all the series and show the map with the initial zoom. | [
"Reset",
"all",
"the",
"series",
"and",
"show",
"the",
"map",
"with",
"the",
"initial",
"zoom",
"."
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/bower_components/jvectormap/lib/world-map.js#L201-L214 | train | Clear all the series | [
30522,
3853,
1006,
1007,
1063,
13075,
3145,
1010,
1045,
1025,
2005,
1006,
3145,
1999,
2023,
1012,
2186,
1007,
1063,
2005,
1006,
1045,
1027,
1014,
1025,
1045,
1026,
2023,
1012,
2186,
1031,
3145,
1033,
1012,
3091,
1025,
1045,
1009,
1009,
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... | |
dequelabs/axe-core | lib/core/utils/preload-cssom.js | filterStylesheetsWithSameHref | function filterStylesheetsWithSameHref(sheets) {
let hrefs = [];
return sheets.filter(sheet => {
if (!sheet.href) {
// include sheets without `href`
return true;
}
// if `href` is present, ensure they are not duplicates
if (hrefs.includes(sheet.href)) {
return false;
}
hrefs.push(sheet.href);
return true;
});
} | javascript | function filterStylesheetsWithSameHref(sheets) {
let hrefs = [];
return sheets.filter(sheet => {
if (!sheet.href) {
// include sheets without `href`
return true;
}
// if `href` is present, ensure they are not duplicates
if (hrefs.includes(sheet.href)) {
return false;
}
hrefs.push(sheet.href);
return true;
});
} | [
"function",
"filterStylesheetsWithSameHref",
"(",
"sheets",
")",
"{",
"let",
"hrefs",
"=",
"[",
"]",
";",
"return",
"sheets",
".",
"filter",
"(",
"sheet",
"=>",
"{",
"if",
"(",
"!",
"sheet",
".",
"href",
")",
"{",
"// include sheets without `href`",
"return"... | Exclude any duplicate `stylesheets`, that share the same `href`
@param {Array<Object>} sheets stylesheets
@returns {Array<Object>} | [
"Exclude",
"any",
"duplicate",
"stylesheets",
"that",
"share",
"the",
"same",
"href"
] | 727323c07980e2291575f545444d389fb942906f | https://github.com/dequelabs/axe-core/blob/727323c07980e2291575f545444d389fb942906f/lib/core/utils/preload-cssom.js#L441-L455 | train | filter sheets with same href | [
30522,
3853,
17736,
27983,
4095,
15558,
26760,
8939,
21559,
11106,
2890,
2546,
1006,
8697,
1007,
1063,
2292,
17850,
12879,
2015,
1027,
1031,
1033,
1025,
2709,
8697,
30524,
8697,
2302,
1036,
17850,
12879,
1036,
2709,
2995,
1025,
1065,
1013,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
dcloudio/mui | examples/hello-mui/js/mui.indexedlist.js | function(holder, options) {
var self = this;
self.options = options || {};
self.box = holder;
if (!self.box) {
throw "实例 IndexedList 时需要指定 element";
}
self.createDom();
self.findElements();
self.caleLayout();
self.bindEvent();
} | javascript | function(holder, options) {
var self = this;
self.options = options || {};
self.box = holder;
if (!self.box) {
throw "实例 IndexedList 时需要指定 element";
}
self.createDom();
self.findElements();
self.caleLayout();
self.bindEvent();
} | [
"function",
"(",
"holder",
",",
"options",
")",
"{",
"var",
"self",
"=",
"this",
";",
"self",
".",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"self",
".",
"box",
"=",
"holder",
";",
"if",
"(",
"!",
"self",
".",
"box",
")",
"{",
"throw",
"\... | 通过 element 和 options 构造 IndexedList 实例 | [
"通过",
"element",
"和",
"options",
"构造",
"IndexedList",
"实例"
] | ff74c90a1671a552f3604b1288bf38a4126312d0 | https://github.com/dcloudio/mui/blob/ff74c90a1671a552f3604b1288bf38a4126312d0/examples/hello-mui/js/mui.indexedlist.js#L20-L31 | train | Constructor for the IndexedList class | [
30522,
3853,
1006,
9111,
1010,
7047,
1007,
1063,
13075,
2969,
1027,
2023,
1025,
2969,
1012,
7047,
1027,
7047,
1064,
1064,
1063,
1065,
1025,
2969,
1012,
3482,
1027,
9111,
1025,
2065,
1006,
999,
2969,
1012,
3482,
1007,
1063,
5466,
1000,
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... | |
wendux/fly | _.js | makeRequest | function makeRequest(options) {
data = options.body;
// Normalize the request url
url = utils.trim(options.url);
var baseUrl = utils.trim(options.baseURL || "");
if (!url && isBrowser && !baseUrl) url = location.href;
if (url.indexOf("http") !== 0) {
var isAbsolute = url[0] === "/";
if (!baseUrl && isBrowser) {
var arr = location.pathname.split("/");
arr.pop();
baseUrl = location.protocol + "//" + location.host + (isAbsolute ? "" : arr.join("/"))
}
if (baseUrl[baseUrl.length - 1] !== "/") {
baseUrl += "/"
}
url = baseUrl + (isAbsolute ? url.substr(1) : url)
if (isBrowser) {
// Normalize the url which contains the ".." or ".", such as
// "http://xx.com/aa/bb/../../xx" to "http://xx.com/xx" .
var t = document.createElement("a");
t.href = url;
url = t.href;
}
}
var responseType = utils.trim(options.responseType || "")
engine.withCredentials = !!options.withCredentials;
var isGet = options.method === "GET";
if (isGet) {
if (data) {
if (utils.type(data) !== "string") {
data = utils.formatParams(data);
}
url += (url.indexOf("?") === -1 ? "?" : "&") + data;
}
}
engine.open(options.method, url);
// try catch for ie >=9
try {
engine.timeout = options.timeout || 0;
if (responseType !== "stream") {
engine.responseType = responseType
}
} catch (e) {
}
var customContentType = options.headers[contentType] || options.headers[contentType.toLowerCase()];
// default content type
var _contentType = "application/x-www-form-urlencoded";
// If the request data is json object, transforming it to json string,
// and set request content-type to "json". In browser, the data will
// be sent as RequestBody instead of FormData
if (utils.trim((customContentType || "").toLowerCase()) === _contentType) {
data = utils.formatParams(data);
} else if (!utils.isFormData(data) && ["object", "array"].indexOf(utils.type(data)) !== -1) {
_contentType = 'application/json;charset=utf-8'
data = JSON.stringify(data);
}
//If user doesn't set content-type, set default.
if (!customContentType) {
options.headers[contentType] = _contentType;
}
for (var k in options.headers) {
if (k === contentType && utils.isFormData(data)) {
// Delete the content-type, Let the browser set it
delete options.headers[k];
} else {
try {
// In browser environment, some header fields are readonly,
// write will cause the exception .
engine.setRequestHeader(k, options.headers[k])
} catch (e) {
}
}
}
function onresult(handler, data, type) {
enqueueIfLocked(responseInterceptor.p, function () {
if (handler) {
//如果失败,添加请求信息
if (type) {
data.request = options;
}
var ret = handler.call(responseInterceptor, data, Promise)
data = ret === undefined ? data : ret;
}
if (!isPromise(data)) {
data = Promise[type === 0 ? "resolve" : "reject"](data)
}
data.then(d => {
resolve(d)
}).catch((e) => {
reject(e)
})
})
}
function onerror(e) {
e.engine = engine;
onresult(responseInterceptor.onerror, e, -1)
}
function Err(msg, status) {
this.message = msg
this.status = status;
}
engine.onload = () => {
// The xhr of IE9 has not response filed
var response = engine.response || engine.responseText;
if (response && options.parseJson && (engine.getResponseHeader(contentType) || "").indexOf("json") !== -1
// Some third engine implementation may transform the response text to json object automatically,
// so we should test the type of response before transforming it
&& !utils.isObject(response)) {
response = JSON.parse(response);
}
var headers = {};
var items = (engine.getAllResponseHeaders() || "").split("\r\n");
items.pop();
items.forEach((e) => {
var key = e.split(":")[0]
headers[key] = engine.getResponseHeader(key)
})
var status = engine.status
var statusText = engine.statusText
var data = {data: response, headers, status, statusText};
// The _response filed of engine is set in adapter which be called in engine-wrapper.js
utils.merge(data, engine._response)
if ((status >= 200 && status < 300) || status === 304) {
data.engine = engine;
data.request = options;
onresult(responseInterceptor.handler, data, 0)
} else {
var e = new Err(statusText, status);
e.response = data
onerror(e)
}
}
engine.onerror = (e) => {
onerror(new Err(e.msg || "Network Error", 0))
}
engine.ontimeout = () => {
onerror(new Err(`timeout [ ${engine.timeout}ms ]`, 1))
}
engine._options = options;
setTimeout(() => {
engine.send(isGet ? null : data)
}, 0)
} | javascript | function makeRequest(options) {
data = options.body;
// Normalize the request url
url = utils.trim(options.url);
var baseUrl = utils.trim(options.baseURL || "");
if (!url && isBrowser && !baseUrl) url = location.href;
if (url.indexOf("http") !== 0) {
var isAbsolute = url[0] === "/";
if (!baseUrl && isBrowser) {
var arr = location.pathname.split("/");
arr.pop();
baseUrl = location.protocol + "//" + location.host + (isAbsolute ? "" : arr.join("/"))
}
if (baseUrl[baseUrl.length - 1] !== "/") {
baseUrl += "/"
}
url = baseUrl + (isAbsolute ? url.substr(1) : url)
if (isBrowser) {
// Normalize the url which contains the ".." or ".", such as
// "http://xx.com/aa/bb/../../xx" to "http://xx.com/xx" .
var t = document.createElement("a");
t.href = url;
url = t.href;
}
}
var responseType = utils.trim(options.responseType || "")
engine.withCredentials = !!options.withCredentials;
var isGet = options.method === "GET";
if (isGet) {
if (data) {
if (utils.type(data) !== "string") {
data = utils.formatParams(data);
}
url += (url.indexOf("?") === -1 ? "?" : "&") + data;
}
}
engine.open(options.method, url);
// try catch for ie >=9
try {
engine.timeout = options.timeout || 0;
if (responseType !== "stream") {
engine.responseType = responseType
}
} catch (e) {
}
var customContentType = options.headers[contentType] || options.headers[contentType.toLowerCase()];
// default content type
var _contentType = "application/x-www-form-urlencoded";
// If the request data is json object, transforming it to json string,
// and set request content-type to "json". In browser, the data will
// be sent as RequestBody instead of FormData
if (utils.trim((customContentType || "").toLowerCase()) === _contentType) {
data = utils.formatParams(data);
} else if (!utils.isFormData(data) && ["object", "array"].indexOf(utils.type(data)) !== -1) {
_contentType = 'application/json;charset=utf-8'
data = JSON.stringify(data);
}
//If user doesn't set content-type, set default.
if (!customContentType) {
options.headers[contentType] = _contentType;
}
for (var k in options.headers) {
if (k === contentType && utils.isFormData(data)) {
// Delete the content-type, Let the browser set it
delete options.headers[k];
} else {
try {
// In browser environment, some header fields are readonly,
// write will cause the exception .
engine.setRequestHeader(k, options.headers[k])
} catch (e) {
}
}
}
function onresult(handler, data, type) {
enqueueIfLocked(responseInterceptor.p, function () {
if (handler) {
//如果失败,添加请求信息
if (type) {
data.request = options;
}
var ret = handler.call(responseInterceptor, data, Promise)
data = ret === undefined ? data : ret;
}
if (!isPromise(data)) {
data = Promise[type === 0 ? "resolve" : "reject"](data)
}
data.then(d => {
resolve(d)
}).catch((e) => {
reject(e)
})
})
}
function onerror(e) {
e.engine = engine;
onresult(responseInterceptor.onerror, e, -1)
}
function Err(msg, status) {
this.message = msg
this.status = status;
}
engine.onload = () => {
// The xhr of IE9 has not response filed
var response = engine.response || engine.responseText;
if (response && options.parseJson && (engine.getResponseHeader(contentType) || "").indexOf("json") !== -1
// Some third engine implementation may transform the response text to json object automatically,
// so we should test the type of response before transforming it
&& !utils.isObject(response)) {
response = JSON.parse(response);
}
var headers = {};
var items = (engine.getAllResponseHeaders() || "").split("\r\n");
items.pop();
items.forEach((e) => {
var key = e.split(":")[0]
headers[key] = engine.getResponseHeader(key)
})
var status = engine.status
var statusText = engine.statusText
var data = {data: response, headers, status, statusText};
// The _response filed of engine is set in adapter which be called in engine-wrapper.js
utils.merge(data, engine._response)
if ((status >= 200 && status < 300) || status === 304) {
data.engine = engine;
data.request = options;
onresult(responseInterceptor.handler, data, 0)
} else {
var e = new Err(statusText, status);
e.response = data
onerror(e)
}
}
engine.onerror = (e) => {
onerror(new Err(e.msg || "Network Error", 0))
}
engine.ontimeout = () => {
onerror(new Err(`timeout [ ${engine.timeout}ms ]`, 1))
}
engine._options = options;
setTimeout(() => {
engine.send(isGet ? null : data)
}, 0)
} | [
"function",
"makeRequest",
"(",
"options",
")",
"{",
"data",
"=",
"options",
".",
"body",
";",
"// Normalize the request url",
"url",
"=",
"utils",
".",
"trim",
"(",
"options",
".",
"url",
")",
";",
"var",
"baseUrl",
"=",
"utils",
".",
"trim",
"(",
"opti... | make the http request | [
"make",
"the",
"http",
"request"
] | fced928bfe7449d0fa18d5fea466cce1e3bda465 | https://github.com/wendux/fly/blob/fced928bfe7449d0fa18d5fea466cce1e3bda465/_.js#L118-L274 | train | Make a request to the server | [
30522,
3853,
9338,
2063,
15500,
1006,
7047,
1007,
1063,
2951,
1027,
7047,
1012,
2303,
1025,
1013,
1013,
3671,
4697,
1996,
5227,
24471,
2140,
24471,
2140,
1027,
21183,
12146,
1012,
12241,
1006,
7047,
1012,
24471,
2140,
1007,
1025,
13075,
291... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/preferences/PreferencesDialogs.js | showProjectPreferencesDialog | function showProjectPreferencesDialog(baseUrl, errorMessage) {
var $baseUrlControl,
dialog;
// Title
var projectName = "",
projectRoot = ProjectManager.getProjectRoot(),
title;
if (projectRoot) {
projectName = projectRoot.name;
}
title = StringUtils.format(Strings.PROJECT_SETTINGS_TITLE, projectName);
var templateVars = {
title : title,
baseUrl : baseUrl,
errorMessage : errorMessage,
Strings : Strings
};
dialog = Dialogs.showModalDialogUsingTemplate(Mustache.render(SettingsDialogTemplate, templateVars));
dialog.done(function (id) {
if (id === Dialogs.DIALOG_BTN_OK) {
var baseUrlValue = $baseUrlControl.val();
var result = _validateBaseUrl(baseUrlValue);
if (result === "") {
// Send analytics data when url is set in project settings
HealthLogger.sendAnalyticsData(
"projectSettingsLivepreview",
"usage",
"projectSettings",
"use"
);
ProjectManager.setBaseUrl(baseUrlValue);
} else {
// Re-invoke dialog with result (error message)
showProjectPreferencesDialog(baseUrlValue, result);
}
}
});
// Give focus to first control
$baseUrlControl = dialog.getElement().find(".url");
$baseUrlControl.focus();
return dialog;
} | javascript | function showProjectPreferencesDialog(baseUrl, errorMessage) {
var $baseUrlControl,
dialog;
// Title
var projectName = "",
projectRoot = ProjectManager.getProjectRoot(),
title;
if (projectRoot) {
projectName = projectRoot.name;
}
title = StringUtils.format(Strings.PROJECT_SETTINGS_TITLE, projectName);
var templateVars = {
title : title,
baseUrl : baseUrl,
errorMessage : errorMessage,
Strings : Strings
};
dialog = Dialogs.showModalDialogUsingTemplate(Mustache.render(SettingsDialogTemplate, templateVars));
dialog.done(function (id) {
if (id === Dialogs.DIALOG_BTN_OK) {
var baseUrlValue = $baseUrlControl.val();
var result = _validateBaseUrl(baseUrlValue);
if (result === "") {
// Send analytics data when url is set in project settings
HealthLogger.sendAnalyticsData(
"projectSettingsLivepreview",
"usage",
"projectSettings",
"use"
);
ProjectManager.setBaseUrl(baseUrlValue);
} else {
// Re-invoke dialog with result (error message)
showProjectPreferencesDialog(baseUrlValue, result);
}
}
});
// Give focus to first control
$baseUrlControl = dialog.getElement().find(".url");
$baseUrlControl.focus();
return dialog;
} | [
"function",
"showProjectPreferencesDialog",
"(",
"baseUrl",
",",
"errorMessage",
")",
"{",
"var",
"$baseUrlControl",
",",
"dialog",
";",
"// Title",
"var",
"projectName",
"=",
"\"\"",
",",
"projectRoot",
"=",
"ProjectManager",
".",
"getProjectRoot",
"(",
")",
",",... | Show a dialog that shows the project preferences
@param {string} baseUrl Initial value
@param {string} errorMessage Error to display
@return {Dialog} A Dialog object with an internal promise that will be resolved with the ID
of the clicked button when the dialog is dismissed. Never rejected. | [
"Show",
"a",
"dialog",
"that",
"shows",
"the",
"project",
"preferences"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/preferences/PreferencesDialogs.js#L78-L125 | train | Show project preferences dialog | [
30522,
3853,
2265,
21572,
20614,
28139,
25523,
16150,
4818,
8649,
1006,
2918,
3126,
2140,
1010,
7561,
7834,
3736,
3351,
1007,
1063,
13075,
1002,
2918,
3126,
22499,
3372,
13153,
1010,
13764,
8649,
1025,
1013,
1013,
2516,
13075,
2622,
18442,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/JSUtils/ScopeManager.js | doEditorChange | function doEditorChange(session, document, previousDocument) {
var file = document.file,
path = file.fullPath,
dir = file.parentPath,
pr;
var addFilesDeferred = $.Deferred();
documentChanges = null;
addFilesPromise = addFilesDeferred.promise();
pr = ProjectManager.getProjectRoot() ? ProjectManager.getProjectRoot().fullPath : null;
// avoid re-initializing tern if possible.
if (canSkipTernInitialization(path)) {
// update the previous document in tern to prevent stale files.
if (isDocumentDirty && previousDocument) {
var updateFilePromise = updateTernFile(previousDocument);
updateFilePromise.done(function () {
primePump(path, document.isUntitled());
addFilesDeferred.resolveWith(null, [_ternNodeDomain]);
});
} else {
addFilesDeferred.resolveWith(null, [_ternNodeDomain]);
}
isDocumentDirty = false;
return;
}
if (previousDocument && previousDocument.isDirty) {
updateTernFile(previousDocument);
}
isDocumentDirty = false;
resolvedFiles = {};
projectRoot = pr;
ensurePreferences();
deferredPreferences.done(function () {
if (file instanceof InMemoryFile) {
initTernServer(pr, []);
var hintsPromise = primePump(path, true);
hintsPromise.done(function () {
addFilesDeferred.resolveWith(null, [_ternNodeDomain]);
});
return;
}
FileSystem.resolve(dir, function (err, directory) {
if (err) {
console.error("Error resolving", dir);
addFilesDeferred.resolveWith(null);
return;
}
directory.getContents(function (err, contents) {
if (err) {
console.error("Error getting contents for", directory);
addFilesDeferred.resolveWith(null);
return;
}
var files = contents
.filter(function (entry) {
return entry.isFile && !isFileExcluded(entry);
})
.map(function (entry) {
return entry.fullPath;
});
initTernServer(dir, files);
var hintsPromise = primePump(path, false);
hintsPromise.done(function () {
if (!usingModules()) {
// Read the subdirectories of the new file's directory.
// Read them first in case there are too many files to
// read in the project.
addAllFilesAndSubdirectories(dir, function () {
// If the file is in the project root, then read
// all the files under the project root.
var currentDir = (dir + "/");
if (projectRoot && currentDir !== projectRoot &&
currentDir.indexOf(projectRoot) === 0) {
addAllFilesAndSubdirectories(projectRoot, function () {
// prime the pump again but this time don't wait
// for completion.
primePump(path, false);
addFilesDeferred.resolveWith(null, [_ternNodeDomain]);
});
} else {
addFilesDeferred.resolveWith(null, [_ternNodeDomain]);
}
});
} else {
addFilesDeferred.resolveWith(null, [_ternNodeDomain]);
}
});
});
});
});
} | javascript | function doEditorChange(session, document, previousDocument) {
var file = document.file,
path = file.fullPath,
dir = file.parentPath,
pr;
var addFilesDeferred = $.Deferred();
documentChanges = null;
addFilesPromise = addFilesDeferred.promise();
pr = ProjectManager.getProjectRoot() ? ProjectManager.getProjectRoot().fullPath : null;
// avoid re-initializing tern if possible.
if (canSkipTernInitialization(path)) {
// update the previous document in tern to prevent stale files.
if (isDocumentDirty && previousDocument) {
var updateFilePromise = updateTernFile(previousDocument);
updateFilePromise.done(function () {
primePump(path, document.isUntitled());
addFilesDeferred.resolveWith(null, [_ternNodeDomain]);
});
} else {
addFilesDeferred.resolveWith(null, [_ternNodeDomain]);
}
isDocumentDirty = false;
return;
}
if (previousDocument && previousDocument.isDirty) {
updateTernFile(previousDocument);
}
isDocumentDirty = false;
resolvedFiles = {};
projectRoot = pr;
ensurePreferences();
deferredPreferences.done(function () {
if (file instanceof InMemoryFile) {
initTernServer(pr, []);
var hintsPromise = primePump(path, true);
hintsPromise.done(function () {
addFilesDeferred.resolveWith(null, [_ternNodeDomain]);
});
return;
}
FileSystem.resolve(dir, function (err, directory) {
if (err) {
console.error("Error resolving", dir);
addFilesDeferred.resolveWith(null);
return;
}
directory.getContents(function (err, contents) {
if (err) {
console.error("Error getting contents for", directory);
addFilesDeferred.resolveWith(null);
return;
}
var files = contents
.filter(function (entry) {
return entry.isFile && !isFileExcluded(entry);
})
.map(function (entry) {
return entry.fullPath;
});
initTernServer(dir, files);
var hintsPromise = primePump(path, false);
hintsPromise.done(function () {
if (!usingModules()) {
// Read the subdirectories of the new file's directory.
// Read them first in case there are too many files to
// read in the project.
addAllFilesAndSubdirectories(dir, function () {
// If the file is in the project root, then read
// all the files under the project root.
var currentDir = (dir + "/");
if (projectRoot && currentDir !== projectRoot &&
currentDir.indexOf(projectRoot) === 0) {
addAllFilesAndSubdirectories(projectRoot, function () {
// prime the pump again but this time don't wait
// for completion.
primePump(path, false);
addFilesDeferred.resolveWith(null, [_ternNodeDomain]);
});
} else {
addFilesDeferred.resolveWith(null, [_ternNodeDomain]);
}
});
} else {
addFilesDeferred.resolveWith(null, [_ternNodeDomain]);
}
});
});
});
});
} | [
"function",
"doEditorChange",
"(",
"session",
",",
"document",
",",
"previousDocument",
")",
"{",
"var",
"file",
"=",
"document",
".",
"file",
",",
"path",
"=",
"file",
".",
"fullPath",
",",
"dir",
"=",
"file",
".",
"parentPath",
",",
"pr",
";",
"var",
... | Do the work to initialize a code hinting session.
@param {Session} session - the active hinting session (TODO: currently unused)
@param {!Document} document - the document the editor has changed to
@param {?Document} previousDocument - the document the editor has changed from | [
"Do",
"the",
"work",
"to",
"initialize",
"a",
"code",
"hinting",
"session",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/JSUtils/ScopeManager.js#L1208-L1310 | train | doEditorChange - do editor change | [
30522,
3853,
18629,
23194,
2953,
22305,
2063,
1006,
5219,
1010,
6254,
1010,
3025,
3527,
24894,
4765,
1007,
1063,
13075,
5371,
1027,
6254,
1012,
5371,
1010,
4130,
1027,
5371,
1012,
2440,
15069,
1010,
16101,
1027,
5371,
1012,
6687,
15069,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.fl/src/sap/ui/fl/Utils.js | function (oManifest) {
var sUri = "";
if (oManifest){
var oSapApp = (oManifest.getEntry) ? oManifest.getEntry("sap.app") : oManifest["sap.app"];
if (oSapApp && oSapApp.dataSources && oSapApp.dataSources.mainService && oSapApp.dataSources.mainService.uri){
sUri = oSapApp.dataSources.mainService.uri;
}
} else {
this.log.warning("No Manifest received.");
}
return sUri;
} | javascript | function (oManifest) {
var sUri = "";
if (oManifest){
var oSapApp = (oManifest.getEntry) ? oManifest.getEntry("sap.app") : oManifest["sap.app"];
if (oSapApp && oSapApp.dataSources && oSapApp.dataSources.mainService && oSapApp.dataSources.mainService.uri){
sUri = oSapApp.dataSources.mainService.uri;
}
} else {
this.log.warning("No Manifest received.");
}
return sUri;
} | [
"function",
"(",
"oManifest",
")",
"{",
"var",
"sUri",
"=",
"\"\"",
";",
"if",
"(",
"oManifest",
")",
"{",
"var",
"oSapApp",
"=",
"(",
"oManifest",
".",
"getEntry",
")",
"?",
"oManifest",
".",
"getEntry",
"(",
"\"sap.app\"",
")",
":",
"oManifest",
"[",... | Returns the uri of the main service specified in the app manifest
@param {object} oManifest - Manifest of the component
@returns {string} Returns the uri if the manifest is available, otherwise an empty string
@public | [
"Returns",
"the",
"uri",
"of",
"the",
"main",
"service",
"specified",
"in",
"the",
"app",
"manifest"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/Utils.js#L1172-L1183 | train | Returns the URI of the main service | [
30522,
3853,
1006,
16640,
29323,
3367,
1007,
1063,
13075,
7505,
2072,
1027,
1000,
1000,
1025,
2065,
1006,
16640,
29323,
3367,
1007,
1063,
13075,
9808,
22068,
9397,
1027,
1006,
16640,
29323,
3367,
1012,
2131,
4765,
2854,
1007,
1029,
16640,
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... | |
quasarframework/quasar | ui/src/ie-compat/ie.js | reject$1 | function reject$1(reason) {
/*jshint validthis:true */
var Constructor = this;
var promise = new Constructor(noop);
reject(promise, reason);
return promise;
} | javascript | function reject$1(reason) {
/*jshint validthis:true */
var Constructor = this;
var promise = new Constructor(noop);
reject(promise, reason);
return promise;
} | [
"function",
"reject$1",
"(",
"reason",
")",
"{",
"/*jshint validthis:true */",
"var",
"Constructor",
"=",
"this",
";",
"var",
"promise",
"=",
"new",
"Constructor",
"(",
"noop",
")",
";",
"reject",
"(",
"promise",
",",
"reason",
")",
";",
"return",
"promise",... | `Promise.reject` returns a promise rejected with the passed `reason`.
It is shorthand for the following:
```javascript
let promise = new Promise(function(resolve, reject){
reject(new Error('WHOOPS'));
});
promise.then(function(value){
Code here doesn't run because the promise is rejected!
}, function(reason){
reason.message === 'WHOOPS'
});
```
Instead of writing the above, your code now simply becomes the following:
```javascript
let promise = Promise.reject(new Error('WHOOPS'));
promise.then(function(value){
Code here doesn't run because the promise is rejected!
}, function(reason){
reason.message === 'WHOOPS'
});
```
@method reject
@static
@param {Any} reason value that the returned promise will be rejected with.
Useful for tooling.
@return {Promise} a promise rejected with the given `reason`. | [
"Promise",
".",
"reject",
"returns",
"a",
"promise",
"rejected",
"with",
"the",
"passed",
"reason",
".",
"It",
"is",
"shorthand",
"for",
"the",
"following",
":"
] | 5d2fb6c96bff6095236f8ca6fe07a037e32e06b3 | https://github.com/quasarframework/quasar/blob/5d2fb6c96bff6095236f8ca6fe07a037e32e06b3/ui/src/ie-compat/ie.js#L803-L809 | train | reject a promise | [
30522,
3853,
15454,
1002,
1015,
1006,
3114,
1007,
1063,
1013,
1008,
1046,
17426,
2102,
9398,
15222,
2015,
1024,
2995,
1008,
1013,
13075,
9570,
2953,
1027,
2023,
1025,
13075,
4872,
1027,
2047,
9570,
2953,
1006,
2053,
7361,
1007,
1025,
15454,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/preparePlugins.js | preparePlugins | function preparePlugins(output) {
var book = output.getBook();
return Promise()
// Only load plugins for main book
.then(function() {
if (book.isLanguageBook()) {
return output.getPlugins();
} else {
return Plugins.loadForBook(book);
}
})
// Update book's configuration using the plugins
.then(function(plugins) {
return Plugins.validateConfig(book, plugins)
.then(function(newBook) {
return output.merge({
book: newBook,
plugins: plugins
});
});
});
} | javascript | function preparePlugins(output) {
var book = output.getBook();
return Promise()
// Only load plugins for main book
.then(function() {
if (book.isLanguageBook()) {
return output.getPlugins();
} else {
return Plugins.loadForBook(book);
}
})
// Update book's configuration using the plugins
.then(function(plugins) {
return Plugins.validateConfig(book, plugins)
.then(function(newBook) {
return output.merge({
book: newBook,
plugins: plugins
});
});
});
} | [
"function",
"preparePlugins",
"(",
"output",
")",
"{",
"var",
"book",
"=",
"output",
".",
"getBook",
"(",
")",
";",
"return",
"Promise",
"(",
")",
"// Only load plugins for main book",
".",
"then",
"(",
"function",
"(",
")",
"{",
"if",
"(",
"book",
".",
... | Load and setup plugins
@param {Output}
@return {Promise<Output>} | [
"Load",
"and",
"setup",
"plugins"
] | 6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4 | https://github.com/GitbookIO/gitbook/blob/6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4/lib/output/preparePlugins.js#L10-L34 | train | Prepare plugins for the book | [
30522,
3853,
7374,
24759,
15916,
7076,
1006,
6434,
1007,
1063,
13075,
2338,
1027,
6434,
1012,
2131,
8654,
1006,
1007,
1025,
2709,
4872,
1006,
1007,
1013,
1013,
2069,
7170,
13354,
7076,
2005,
2364,
2338,
1012,
2059,
1006,
3853,
1006,
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/project/FileTreeView.js | function () {
var fullname = this.props.name,
extension = LanguageManager.getCompoundFileExtension(fullname);
var node = this.refs.name;
node.setSelectionRange(0, _getName(fullname, extension).length);
node.focus(); // set focus on the rename input
ViewUtils.scrollElementIntoView($("#project-files-container"), $(node), true);
} | javascript | function () {
var fullname = this.props.name,
extension = LanguageManager.getCompoundFileExtension(fullname);
var node = this.refs.name;
node.setSelectionRange(0, _getName(fullname, extension).length);
node.focus(); // set focus on the rename input
ViewUtils.scrollElementIntoView($("#project-files-container"), $(node), true);
} | [
"function",
"(",
")",
"{",
"var",
"fullname",
"=",
"this",
".",
"props",
".",
"name",
",",
"extension",
"=",
"LanguageManager",
".",
"getCompoundFileExtension",
"(",
"fullname",
")",
";",
"var",
"node",
"=",
"this",
".",
"refs",
".",
"name",
";",
"node",... | When this component is displayed, we scroll it into view and select the portion
of the filename that excludes the extension. | [
"When",
"this",
"component",
"is",
"displayed",
"we",
"scroll",
"it",
"into",
"view",
"and",
"select",
"the",
"portion",
"of",
"the",
"filename",
"that",
"excludes",
"the",
"extension",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/project/FileTreeView.js#L327-L335 | train | renames the file | [
30522,
3853,
1006,
1007,
1063,
13075,
2440,
18442,
1027,
2023,
1012,
24387,
1012,
2171,
1010,
5331,
1027,
2653,
24805,
4590,
1012,
2131,
9006,
6873,
8630,
8873,
10559,
18413,
6132,
3258,
1006,
2440,
18442,
1007,
1025,
13075,
13045,
1027,
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.ux3/src/sap/ui/ux3/ToolPopup.js | function (oEvent) {
if (!this._bPreventRestoreFocus) {
Popup.applyFocusInfo(this._oPreviousFocus);
}
if (this.getDomRef()) {
// Not removing the content DOM leads to the problem that control DOM with the same ID exists in two places if
// the control is added to a different aggregation without the dialog being destroyed. In this special case the
// RichTextEditor (as an example) renders a textarea-element and afterwards tells the TinyMCE component which ID
// to use for rendering; since there are two elements with the same ID at that point, it does not work.
// As the Dialog can only contain other controls, we can safely discard the DOM - we cannot do this inside
// the Popup, since it supports displaying arbitrary HTML content.
RenderManager.preserveContent(this.getDomRef());
this.$().remove();
}
this.fireClosed();
} | javascript | function (oEvent) {
if (!this._bPreventRestoreFocus) {
Popup.applyFocusInfo(this._oPreviousFocus);
}
if (this.getDomRef()) {
// Not removing the content DOM leads to the problem that control DOM with the same ID exists in two places if
// the control is added to a different aggregation without the dialog being destroyed. In this special case the
// RichTextEditor (as an example) renders a textarea-element and afterwards tells the TinyMCE component which ID
// to use for rendering; since there are two elements with the same ID at that point, it does not work.
// As the Dialog can only contain other controls, we can safely discard the DOM - we cannot do this inside
// the Popup, since it supports displaying arbitrary HTML content.
RenderManager.preserveContent(this.getDomRef());
this.$().remove();
}
this.fireClosed();
} | [
"function",
"(",
"oEvent",
")",
"{",
"if",
"(",
"!",
"this",
".",
"_bPreventRestoreFocus",
")",
"{",
"Popup",
".",
"applyFocusInfo",
"(",
"this",
".",
"_oPreviousFocus",
")",
";",
"}",
"if",
"(",
"this",
".",
"getDomRef",
"(",
")",
")",
"{",
"// Not re... | This function is called when the Popup has been closed.
It does not matter if it is closed through the "close"-function or through the autoClose-mechanism.
Additionally it is necessary to restore the focus as if the ToolPopup was closed via "close()".
If the corresponding suppress-parameter was given to "close" no focus will be restored.
@param {jQuery.Event} oEvent
@private | [
"This",
"function",
"is",
"called",
"when",
"the",
"Popup",
"has",
"been",
"closed",
".",
"It",
"does",
"not",
"matter",
"if",
"it",
"is",
"closed",
"through",
"the",
"close",
"-",
"function",
"or",
"through",
"the",
"autoClose",
"-",
"mechanism",
".",
"... | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.ux3/src/sap/ui/ux3/ToolPopup.js#L1010-L1027 | train | Called when the dialog is closed | [
30522,
3853,
1006,
1051,
18697,
3372,
1007,
1063,
2065,
1006,
999,
2023,
1012,
1035,
17531,
2890,
15338,
28533,
5686,
14876,
7874,
1007,
1063,
3769,
6279,
1012,
6611,
14876,
7874,
2378,
14876,
1006,
2023,
1012,
1035,
6728,
2890,
24918,
1487... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
lovell/sharp | lib/output.js | tiff | function tiff (options) {
if (is.object(options)) {
if (is.defined(options.quality)) {
if (is.integer(options.quality) && is.inRange(options.quality, 1, 100)) {
this.options.tiffQuality = options.quality;
} else {
throw new Error('Invalid quality (integer, 1-100) ' + options.quality);
}
}
if (is.defined(options.squash)) {
if (is.bool(options.squash)) {
this.options.tiffSquash = options.squash;
} else {
throw new Error('Invalid Value for squash ' + options.squash + ' Only Boolean Values allowed for options.squash.');
}
}
// tiling
if (is.defined(options.tile)) {
if (is.bool(options.tile)) {
this.options.tiffTile = options.tile;
} else {
throw new Error('Invalid Value for tile ' + options.tile + ' Only Boolean values allowed for options.tile');
}
}
if (is.defined(options.tileWidth)) {
if (is.number(options.tileWidth) && options.tileWidth > 0) {
this.options.tiffTileWidth = options.tileWidth;
} else {
throw new Error('Invalid Value for tileWidth ' + options.tileWidth + ' Only positive numeric values allowed for options.tileWidth');
}
}
if (is.defined(options.tileHeight)) {
if (is.number(options.tileHeight) && options.tileHeight > 0) {
this.options.tiffTileHeight = options.tileHeight;
} else {
throw new Error('Invalid Value for tileHeight ' + options.tileHeight + ' Only positive numeric values allowed for options.tileHeight');
}
}
// pyramid
if (is.defined(options.pyramid)) {
if (is.bool(options.pyramid)) {
this.options.tiffPyramid = options.pyramid;
} else {
throw new Error('Invalid Value for pyramid ' + options.pyramid + ' Only Boolean values allowed for options.pyramid');
}
}
// resolution
if (is.defined(options.xres)) {
if (is.number(options.xres)) {
this.options.tiffXres = options.xres;
} else {
throw new Error('Invalid Value for xres ' + options.xres + ' Only numeric values allowed for options.xres');
}
}
if (is.defined(options.yres)) {
if (is.number(options.yres)) {
this.options.tiffYres = options.yres;
} else {
throw new Error('Invalid Value for yres ' + options.yres + ' Only numeric values allowed for options.yres');
}
}
// compression
if (is.defined(options.compression)) {
if (is.string(options.compression) && is.inArray(options.compression, ['lzw', 'deflate', 'jpeg', 'ccittfax4', 'none'])) {
this.options.tiffCompression = options.compression;
} else {
const message = `Invalid compression option "${options.compression}". Should be one of: lzw, deflate, jpeg, ccittfax4, none`;
throw new Error(message);
}
}
// predictor
if (is.defined(options.predictor)) {
if (is.string(options.predictor) && is.inArray(options.predictor, ['none', 'horizontal', 'float'])) {
this.options.tiffPredictor = options.predictor;
} else {
const message = `Invalid predictor option "${options.predictor}". Should be one of: none, horizontal, float`;
throw new Error(message);
}
}
}
return this._updateFormatOut('tiff', options);
} | javascript | function tiff (options) {
if (is.object(options)) {
if (is.defined(options.quality)) {
if (is.integer(options.quality) && is.inRange(options.quality, 1, 100)) {
this.options.tiffQuality = options.quality;
} else {
throw new Error('Invalid quality (integer, 1-100) ' + options.quality);
}
}
if (is.defined(options.squash)) {
if (is.bool(options.squash)) {
this.options.tiffSquash = options.squash;
} else {
throw new Error('Invalid Value for squash ' + options.squash + ' Only Boolean Values allowed for options.squash.');
}
}
// tiling
if (is.defined(options.tile)) {
if (is.bool(options.tile)) {
this.options.tiffTile = options.tile;
} else {
throw new Error('Invalid Value for tile ' + options.tile + ' Only Boolean values allowed for options.tile');
}
}
if (is.defined(options.tileWidth)) {
if (is.number(options.tileWidth) && options.tileWidth > 0) {
this.options.tiffTileWidth = options.tileWidth;
} else {
throw new Error('Invalid Value for tileWidth ' + options.tileWidth + ' Only positive numeric values allowed for options.tileWidth');
}
}
if (is.defined(options.tileHeight)) {
if (is.number(options.tileHeight) && options.tileHeight > 0) {
this.options.tiffTileHeight = options.tileHeight;
} else {
throw new Error('Invalid Value for tileHeight ' + options.tileHeight + ' Only positive numeric values allowed for options.tileHeight');
}
}
// pyramid
if (is.defined(options.pyramid)) {
if (is.bool(options.pyramid)) {
this.options.tiffPyramid = options.pyramid;
} else {
throw new Error('Invalid Value for pyramid ' + options.pyramid + ' Only Boolean values allowed for options.pyramid');
}
}
// resolution
if (is.defined(options.xres)) {
if (is.number(options.xres)) {
this.options.tiffXres = options.xres;
} else {
throw new Error('Invalid Value for xres ' + options.xres + ' Only numeric values allowed for options.xres');
}
}
if (is.defined(options.yres)) {
if (is.number(options.yres)) {
this.options.tiffYres = options.yres;
} else {
throw new Error('Invalid Value for yres ' + options.yres + ' Only numeric values allowed for options.yres');
}
}
// compression
if (is.defined(options.compression)) {
if (is.string(options.compression) && is.inArray(options.compression, ['lzw', 'deflate', 'jpeg', 'ccittfax4', 'none'])) {
this.options.tiffCompression = options.compression;
} else {
const message = `Invalid compression option "${options.compression}". Should be one of: lzw, deflate, jpeg, ccittfax4, none`;
throw new Error(message);
}
}
// predictor
if (is.defined(options.predictor)) {
if (is.string(options.predictor) && is.inArray(options.predictor, ['none', 'horizontal', 'float'])) {
this.options.tiffPredictor = options.predictor;
} else {
const message = `Invalid predictor option "${options.predictor}". Should be one of: none, horizontal, float`;
throw new Error(message);
}
}
}
return this._updateFormatOut('tiff', options);
} | [
"function",
"tiff",
"(",
"options",
")",
"{",
"if",
"(",
"is",
".",
"object",
"(",
"options",
")",
")",
"{",
"if",
"(",
"is",
".",
"defined",
"(",
"options",
".",
"quality",
")",
")",
"{",
"if",
"(",
"is",
".",
"integer",
"(",
"options",
".",
"... | Use these TIFF options for output image.
@example
// Convert SVG input to LZW-compressed, 1 bit per pixel TIFF output
sharp('input.svg')
.tiff({
compression: 'lzw',
squash: true
})
.toFile('1-bpp-output.tiff')
.then(info => { ... });
@param {Object} [options] - output options
@param {Number} [options.quality=80] - quality, integer 1-100
@param {Boolean} [options.force=true] - force TIFF output, otherwise attempt to use input format
@param {Boolean} [options.compression='jpeg'] - compression options: lzw, deflate, jpeg, ccittfax4
@param {Boolean} [options.predictor='horizontal'] - compression predictor options: none, horizontal, float
@param {Boolean} [options.pyramid=false] - write an image pyramid
@param {Boolean} [options.tile=false] - write a tiled tiff
@param {Boolean} [options.tileWidth=256] - horizontal tile size
@param {Boolean} [options.tileHeight=256] - vertical tile size
@param {Number} [options.xres=1.0] - horizontal resolution in pixels/mm
@param {Number} [options.yres=1.0] - vertical resolution in pixels/mm
@param {Boolean} [options.squash=false] - squash 8-bit images down to 1 bit
@returns {Sharp}
@throws {Error} Invalid options | [
"Use",
"these",
"TIFF",
"options",
"for",
"output",
"image",
"."
] | 05d76eeadfe54713606a615185b2da047923406b | https://github.com/lovell/sharp/blob/05d76eeadfe54713606a615185b2da047923406b/lib/output.js#L349-L430 | train | TIFF Options | [
30522,
3853,
14841,
4246,
1006,
7047,
1007,
1063,
2065,
1006,
2003,
1012,
4874,
1006,
7047,
1007,
1007,
1063,
2065,
1006,
2003,
1012,
4225,
1006,
7047,
1012,
3737,
1007,
1007,
1063,
2065,
1006,
2003,
1012,
16109,
1006,
7047,
1012,
3737,
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/JSUtils/ScopeManager.js | handleTernGetFile | function handleTernGetFile(request) {
function replyWith(name, txt) {
_postMessageByPass({
type: MessageIds.TERN_GET_FILE_MSG,
file: name,
text: txt
});
}
var name = request.file;
/**
* Helper function to get the text of a given document and send it to tern.
* If DocumentManager successfully gets the file's text then we'll send it to the tern node domain.
* The Promise for getDocumentText() is returned so that custom fail functions can be used.
*
* @param {string} filePath - the path of the file to get the text of
* @return {jQuery.Promise} - the Promise returned from DocumentMangaer.getDocumentText()
*/
function getDocText(filePath) {
if (!FileSystem.isAbsolutePath(filePath) || // don't handle URLs
filePath.slice(0, 2) === "//") { // don't handle protocol-relative URLs like //example.com/main.js (see #10566)
return (new $.Deferred()).reject().promise();
}
var file = FileSystem.getFileForPath(filePath),
promise = DocumentManager.getDocumentText(file);
promise.done(function (docText) {
resolvedFiles[name] = filePath;
numResolvedFiles++;
replyWith(name, filterText(docText));
});
return promise;
}
/**
* Helper function to find any files in the project that end with the
* name we are looking for. This is so we can find requirejs modules
* when the baseUrl is unknown, or when the project root is not the same
* as the script root (e.g. if you open the 'brackets' dir instead of 'brackets/src' dir).
*/
function findNameInProject() {
// check for any files in project that end with the right path.
var fileName = name.substring(name.lastIndexOf("/") + 1);
function _fileFilter(entry) {
return entry.name === fileName;
}
ProjectManager.getAllFiles(_fileFilter).done(function (files) {
var file;
files = files.filter(function (file) {
var pos = file.fullPath.length - name.length;
return pos === file.fullPath.lastIndexOf(name);
});
if (files.length === 1) {
file = files[0];
}
if (file) {
getDocText(file.fullPath).fail(function () {
replyWith(name, "");
});
} else {
replyWith(name, "");
}
});
}
if (!isFileExcludedInternal(name)) {
getDocText(name).fail(function () {
getDocText(rootTernDir + name).fail(function () {
// check relative to project root
getDocText(projectRoot + name)
// last look for any files that end with the right path
// in the project
.fail(findNameInProject);
});
});
}
} | javascript | function handleTernGetFile(request) {
function replyWith(name, txt) {
_postMessageByPass({
type: MessageIds.TERN_GET_FILE_MSG,
file: name,
text: txt
});
}
var name = request.file;
/**
* Helper function to get the text of a given document and send it to tern.
* If DocumentManager successfully gets the file's text then we'll send it to the tern node domain.
* The Promise for getDocumentText() is returned so that custom fail functions can be used.
*
* @param {string} filePath - the path of the file to get the text of
* @return {jQuery.Promise} - the Promise returned from DocumentMangaer.getDocumentText()
*/
function getDocText(filePath) {
if (!FileSystem.isAbsolutePath(filePath) || // don't handle URLs
filePath.slice(0, 2) === "//") { // don't handle protocol-relative URLs like //example.com/main.js (see #10566)
return (new $.Deferred()).reject().promise();
}
var file = FileSystem.getFileForPath(filePath),
promise = DocumentManager.getDocumentText(file);
promise.done(function (docText) {
resolvedFiles[name] = filePath;
numResolvedFiles++;
replyWith(name, filterText(docText));
});
return promise;
}
/**
* Helper function to find any files in the project that end with the
* name we are looking for. This is so we can find requirejs modules
* when the baseUrl is unknown, or when the project root is not the same
* as the script root (e.g. if you open the 'brackets' dir instead of 'brackets/src' dir).
*/
function findNameInProject() {
// check for any files in project that end with the right path.
var fileName = name.substring(name.lastIndexOf("/") + 1);
function _fileFilter(entry) {
return entry.name === fileName;
}
ProjectManager.getAllFiles(_fileFilter).done(function (files) {
var file;
files = files.filter(function (file) {
var pos = file.fullPath.length - name.length;
return pos === file.fullPath.lastIndexOf(name);
});
if (files.length === 1) {
file = files[0];
}
if (file) {
getDocText(file.fullPath).fail(function () {
replyWith(name, "");
});
} else {
replyWith(name, "");
}
});
}
if (!isFileExcludedInternal(name)) {
getDocText(name).fail(function () {
getDocText(rootTernDir + name).fail(function () {
// check relative to project root
getDocText(projectRoot + name)
// last look for any files that end with the right path
// in the project
.fail(findNameInProject);
});
});
}
} | [
"function",
"handleTernGetFile",
"(",
"request",
")",
"{",
"function",
"replyWith",
"(",
"name",
",",
"txt",
")",
"{",
"_postMessageByPass",
"(",
"{",
"type",
":",
"MessageIds",
".",
"TERN_GET_FILE_MSG",
",",
"file",
":",
"name",
",",
"text",
":",
"txt",
"... | Handle a request from the tern node domain for text of a file
@param {{file:string}} request - the request from the tern node domain. Should be an Object containing the name
of the file tern wants the contents of | [
"Handle",
"a",
"request",
"from",
"the",
"tern",
"node",
"domain",
"for",
"text",
"of",
"a",
"file"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/JSUtils/ScopeManager.js#L903-L985 | train | Handle a tern get file request. | [
30522,
3853,
5047,
16451,
18150,
8873,
2571,
1006,
5227,
1007,
1063,
3853,
7514,
24415,
1006,
2171,
1010,
19067,
2102,
1007,
1063,
1035,
2695,
7834,
3736,
3351,
3762,
15194,
1006,
1063,
2828,
1024,
4471,
9821,
1012,
28774,
2078,
1035,
2131,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/core/dnd/DragAndDrop.js | addStyleClass | function addStyleClass(oElement, sStyleClass) {
if (!oElement) {
return;
}
if (oElement.addStyleClass) {
oElement.addStyleClass(sStyleClass);
} else {
oElement.$().addClass(sStyleClass);
}
} | javascript | function addStyleClass(oElement, sStyleClass) {
if (!oElement) {
return;
}
if (oElement.addStyleClass) {
oElement.addStyleClass(sStyleClass);
} else {
oElement.$().addClass(sStyleClass);
}
} | [
"function",
"addStyleClass",
"(",
"oElement",
",",
"sStyleClass",
")",
"{",
"if",
"(",
"!",
"oElement",
")",
"{",
"return",
";",
"}",
"if",
"(",
"oElement",
".",
"addStyleClass",
")",
"{",
"oElement",
".",
"addStyleClass",
"(",
"sStyleClass",
")",
";",
"... | timestamp of drag enter | [
"timestamp",
"of",
"drag",
"enter"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/dnd/DragAndDrop.js#L36-L46 | train | Adds a CSS class to an element | [
30522,
3853,
9909,
27983,
26266,
1006,
1051,
12260,
3672,
1010,
7020,
27983,
26266,
1007,
1063,
2065,
1006,
999,
1051,
12260,
3672,
1007,
1063,
2709,
1025,
1065,
2065,
1006,
1051,
12260,
3672,
1012,
9909,
27983,
26266,
1007,
1063,
1051,
122... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SheetJS/js-xlsx | xlsx.js | parse_Obj | function parse_Obj(blob, length, opts) {
if(opts && opts.biff < 8) return parse_BIFF5Obj(blob, length, opts);
var cmo = parse_FtCmo(blob, 22); // id, ot, flags
var fts = parse_FtArray(blob, length-22, cmo[1]);
return { cmo: cmo, ft:fts };
} | javascript | function parse_Obj(blob, length, opts) {
if(opts && opts.biff < 8) return parse_BIFF5Obj(blob, length, opts);
var cmo = parse_FtCmo(blob, 22); // id, ot, flags
var fts = parse_FtArray(blob, length-22, cmo[1]);
return { cmo: cmo, ft:fts };
} | [
"function",
"parse_Obj",
"(",
"blob",
",",
"length",
",",
"opts",
")",
"{",
"if",
"(",
"opts",
"&&",
"opts",
".",
"biff",
"<",
"8",
")",
"return",
"parse_BIFF5Obj",
"(",
"blob",
",",
"length",
",",
"opts",
")",
";",
"var",
"cmo",
"=",
"parse_FtCmo",
... | /* [MS-XLS] 2.4.181 TODO: parse all the things! | [
"/",
"*",
"[",
"MS",
"-",
"XLS",
"]",
"2",
".",
"4",
".",
"181",
"TODO",
":",
"parse",
"all",
"the",
"things!"
] | 9a6d8a1d3d80c78dad5201fb389316f935279cdc | https://github.com/SheetJS/js-xlsx/blob/9a6d8a1d3d80c78dad5201fb389316f935279cdc/xlsx.js#L6344-L6349 | train | Parse an object | [
30522,
3853,
11968,
3366,
1035,
27885,
3501,
1006,
1038,
4135,
30524,
23569,
2015,
1007,
1063,
2065,
1006,
23569,
2015,
1004,
1004,
23569,
2015,
1012,
12170,
4246,
1026,
1022,
1007,
2709,
11968,
3366,
1035,
12170,
4246,
2629,
16429,
3501,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/core/Component.js | mergeDefinitionSource | function mergeDefinitionSource(mDefinitions, mDefinitionSource, mSourceData, oSource) {
if (mSourceData) {
for (var sName in mDefinitions) {
if (!mDefinitionSource[sName] && mSourceData[sName] && mSourceData[sName].uri) {
mDefinitionSource[sName] = oSource;
}
}
}
} | javascript | function mergeDefinitionSource(mDefinitions, mDefinitionSource, mSourceData, oSource) {
if (mSourceData) {
for (var sName in mDefinitions) {
if (!mDefinitionSource[sName] && mSourceData[sName] && mSourceData[sName].uri) {
mDefinitionSource[sName] = oSource;
}
}
}
} | [
"function",
"mergeDefinitionSource",
"(",
"mDefinitions",
",",
"mDefinitionSource",
",",
"mSourceData",
",",
"oSource",
")",
"{",
"if",
"(",
"mSourceData",
")",
"{",
"for",
"(",
"var",
"sName",
"in",
"mDefinitions",
")",
"{",
"if",
"(",
"!",
"mDefinitionSource... | Utility function which merges a map of property definitions to track
from which "source" a property was defined.
This function is used to find out which Component has defined
which "dataSource/model".
@param {object} mDefinitions Map with definitions to check
@param {object} mDefinitionSource Object to extend with definition - source mapping
@param {object} mSourceData Actual map with definitions
@param {object} oSource Corresponding source object which should be assigned to the definitions-source map
@private | [
"Utility",
"function",
"which",
"merges",
"a",
"map",
"of",
"property",
"definitions",
"to",
"track",
"from",
"which",
"source",
"a",
"property",
"was",
"defined",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Component.js#L80-L88 | train | Merge definition source with source | [
30522,
3853,
5314,
12879,
5498,
9285,
8162,
3401,
1006,
9108,
12879,
5498,
9285,
1010,
9108,
12879,
5498,
9285,
8162,
3401,
1010,
5796,
8162,
11788,
6790,
1010,
9808,
8162,
3401,
1007,
1063,
2065,
1006,
5796,
8162,
11788,
6790,
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... |
adobe/brackets | src/extensions/default/AutoUpdate/main.js | function () {
var infoObj = {
installerPath: formattedInstallerPath,
logFilePath: formattedLogFilePath,
installStatusFilePath: installStatusFilePath
};
if (brackets.platform === "mac") {
var additionalParams = getAdditionalParams(),
key;
for (key in additionalParams) {
if (additionalParams.hasOwnProperty(key)) {
infoObj[key] = additionalParams[key];
}
}
}
// Set update parameters for app update
if (brackets.app.setUpdateParams) {
brackets.app.setUpdateParams(JSON.stringify(infoObj), function (err) {
if (err) {
resetStateInFailure("AutoUpdate : Update parameters could not be set for the installer. Error encountered: " + err);
} else {
setAppQuitHandler();
CommandManager.execute(Commands.FILE_QUIT);
}
});
} else {
resetStateInFailure("AutoUpdate : setUpdateParams could not be found in shell");
}
} | javascript | function () {
var infoObj = {
installerPath: formattedInstallerPath,
logFilePath: formattedLogFilePath,
installStatusFilePath: installStatusFilePath
};
if (brackets.platform === "mac") {
var additionalParams = getAdditionalParams(),
key;
for (key in additionalParams) {
if (additionalParams.hasOwnProperty(key)) {
infoObj[key] = additionalParams[key];
}
}
}
// Set update parameters for app update
if (brackets.app.setUpdateParams) {
brackets.app.setUpdateParams(JSON.stringify(infoObj), function (err) {
if (err) {
resetStateInFailure("AutoUpdate : Update parameters could not be set for the installer. Error encountered: " + err);
} else {
setAppQuitHandler();
CommandManager.execute(Commands.FILE_QUIT);
}
});
} else {
resetStateInFailure("AutoUpdate : setUpdateParams could not be found in shell");
}
} | [
"function",
"(",
")",
"{",
"var",
"infoObj",
"=",
"{",
"installerPath",
":",
"formattedInstallerPath",
",",
"logFilePath",
":",
"formattedLogFilePath",
",",
"installStatusFilePath",
":",
"installStatusFilePath",
"}",
";",
"if",
"(",
"brackets",
".",
"platform",
"=... | Update function, to carry out app update | [
"Update",
"function",
"to",
"carry",
"out",
"app",
"update"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/AutoUpdate/main.js#L851-L882 | train | AutoUpdate - Set update parameters for the installer | [
30522,
3853,
1006,
1007,
1063,
13075,
18558,
16429,
3501,
1027,
1063,
16500,
2121,
15069,
1024,
4289,
3064,
7076,
9080,
3917,
15069,
1010,
8833,
8873,
2571,
15069,
1024,
4289,
3064,
21197,
8873,
2571,
15069,
1010,
16500,
9153,
5809,
8873,
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... | |
openlayers/openlayers | tasks/generate-index.js | getImport | function getImport(symbol, member) {
const defaultExport = symbol.name.split('~');
const namedExport = symbol.name.split('.');
if (defaultExport.length > 1) {
const from = defaultExport[0].replace(/^module\:/, './');
const importName = from.replace(/[.\/]+/g, '$');
return `import ${importName} from '${from}';`;
} else if (namedExport.length > 1 && member) {
const from = namedExport[0].replace(/^module\:/, './');
const importName = from.replace(/[.\/]+/g, '_');
return `import {${member} as ${importName}$${member}} from '${from}';`;
}
} | javascript | function getImport(symbol, member) {
const defaultExport = symbol.name.split('~');
const namedExport = symbol.name.split('.');
if (defaultExport.length > 1) {
const from = defaultExport[0].replace(/^module\:/, './');
const importName = from.replace(/[.\/]+/g, '$');
return `import ${importName} from '${from}';`;
} else if (namedExport.length > 1 && member) {
const from = namedExport[0].replace(/^module\:/, './');
const importName = from.replace(/[.\/]+/g, '_');
return `import {${member} as ${importName}$${member}} from '${from}';`;
}
} | [
"function",
"getImport",
"(",
"symbol",
",",
"member",
")",
"{",
"const",
"defaultExport",
"=",
"symbol",
".",
"name",
".",
"split",
"(",
"'~'",
")",
";",
"const",
"namedExport",
"=",
"symbol",
".",
"name",
".",
"split",
"(",
"'.'",
")",
";",
"if",
"... | Generate an import statement.
@param {Object} symbol Symbol.
@param {string} member Member.
@return {string} An import statement. | [
"Generate",
"an",
"import",
"statement",
"."
] | f366eaea522388fb575b11010e69d309164baca7 | https://github.com/openlayers/openlayers/blob/f366eaea522388fb575b11010e69d309164baca7/tasks/generate-index.js#L21-L33 | train | Get import statement for a given symbol | [
30522,
3853,
2131,
5714,
6442,
1006,
6454,
1010,
2266,
1007,
1063,
9530,
3367,
12398,
10288,
6442,
1027,
6454,
1012,
2171,
1012,
3975,
1006,
1005,
1066,
1005,
1007,
1025,
9530,
3367,
2315,
10288,
6442,
1027,
6454,
1012,
2171,
1012,
3975,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/isEmpty/index.js | isEmpty | function isEmpty(obj) {
if (Array.isArray(obj)) {
return obj.length === 0;
} else if (typeof obj === 'object') {
for (var i in obj) {
return false;
}
return true;
} else {
return !obj;
}
} | javascript | function isEmpty(obj) {
if (Array.isArray(obj)) {
return obj.length === 0;
} else if (typeof obj === 'object') {
for (var i in obj) {
return false;
}
return true;
} else {
return !obj;
}
} | [
"function",
"isEmpty",
"(",
"obj",
")",
"{",
"if",
"(",
"Array",
".",
"isArray",
"(",
"obj",
")",
")",
"{",
"return",
"obj",
".",
"length",
"===",
"0",
";",
"}",
"else",
"if",
"(",
"typeof",
"obj",
"===",
"'object'",
")",
"{",
"for",
"(",
"var",
... | Mimics empty from PHP. | [
"Mimics",
"empty",
"from",
"PHP",
"."
] | 801937748b2f3c96284bee1881164ac0c62a9c6d | https://github.com/necolas/react-native-web/blob/801937748b2f3c96284bee1881164ac0c62a9c6d/packages/react-native-web/src/vendor/react-native/isEmpty/index.js#L14-L25 | train | returns true if obj is empty | [
30522,
3853,
2003,
6633,
13876,
2100,
1006,
27885,
3501,
1007,
1063,
2065,
1006,
9140,
1012,
18061,
11335,
2100,
1006,
27885,
3501,
1007,
1007,
1063,
2709,
27885,
3501,
1012,
3091,
1027,
1027,
1027,
1014,
1025,
1065,
2842,
2065,
1006,
2828,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/ControlsMaster.controller.js | function () {
if (!this._oSettingsDialog) {
this._oSettingsDialog = new sap.ui.xmlfragment("sap.ui.documentation.sdk.view.appSettingsDialog", this);
this._oView.addDependent(this._oSettingsDialog);
}
setTimeout(function () {
var oAppSettings = this._oCore.getConfiguration(),
oThemeSelect = this._oCore.byId("ThemeSelect"),
sUriParamTheme = new UriParameters(window.location.href).get("sap-theme"),
bDensityMode = this._oViewSettings.densityMode;
// Theme select
oThemeSelect.setSelectedKey(sUriParamTheme ? sUriParamTheme : oAppSettings.getTheme());
// RTL
this._oCore.byId("RTLSwitch").setState(oAppSettings.getRTL());
// Density mode select
this._oCore.byId("DensityModeSwitch").setSelectedKey(bDensityMode);
this._oSettingsDialog.open();
}.bind(this), 0);
} | javascript | function () {
if (!this._oSettingsDialog) {
this._oSettingsDialog = new sap.ui.xmlfragment("sap.ui.documentation.sdk.view.appSettingsDialog", this);
this._oView.addDependent(this._oSettingsDialog);
}
setTimeout(function () {
var oAppSettings = this._oCore.getConfiguration(),
oThemeSelect = this._oCore.byId("ThemeSelect"),
sUriParamTheme = new UriParameters(window.location.href).get("sap-theme"),
bDensityMode = this._oViewSettings.densityMode;
// Theme select
oThemeSelect.setSelectedKey(sUriParamTheme ? sUriParamTheme : oAppSettings.getTheme());
// RTL
this._oCore.byId("RTLSwitch").setState(oAppSettings.getRTL());
// Density mode select
this._oCore.byId("DensityModeSwitch").setSelectedKey(bDensityMode);
this._oSettingsDialog.open();
}.bind(this), 0);
} | [
"function",
"(",
")",
"{",
"if",
"(",
"!",
"this",
".",
"_oSettingsDialog",
")",
"{",
"this",
".",
"_oSettingsDialog",
"=",
"new",
"sap",
".",
"ui",
".",
"xmlfragment",
"(",
"\"sap.ui.documentation.sdk.view.appSettingsDialog\"",
",",
"this",
")",
";",
"this",
... | Opens the View settings dialog
@public | [
"Opens",
"the",
"View",
"settings",
"dialog"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/ControlsMaster.controller.js#L653-L675 | train | Opens the app settings dialog | [
30522,
3853,
1006,
1007,
1063,
2065,
1006,
999,
2023,
1012,
1035,
9808,
18319,
3070,
16150,
4818,
8649,
1007,
1063,
2023,
1012,
1035,
9808,
18319,
3070,
16150,
4818,
8649,
1027,
2047,
20066,
1012,
21318,
1012,
20950,
27843,
21693,
4765,
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... | |
adobe/brackets | src/project/WorkingSetSort.js | _convertSortPref | function _convertSortPref(sortMethod) {
if (!sortMethod) {
return null;
}
if (_sortPrefConversionMap.hasOwnProperty(sortMethod)) {
sortMethod = _sortPrefConversionMap[sortMethod];
PreferencesManager.setViewState(_WORKING_SET_SORT_PREF, sortMethod);
} else {
sortMethod = null;
}
return sortMethod;
} | javascript | function _convertSortPref(sortMethod) {
if (!sortMethod) {
return null;
}
if (_sortPrefConversionMap.hasOwnProperty(sortMethod)) {
sortMethod = _sortPrefConversionMap[sortMethod];
PreferencesManager.setViewState(_WORKING_SET_SORT_PREF, sortMethod);
} else {
sortMethod = null;
}
return sortMethod;
} | [
"function",
"_convertSortPref",
"(",
"sortMethod",
")",
"{",
"if",
"(",
"!",
"sortMethod",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"_sortPrefConversionMap",
".",
"hasOwnProperty",
"(",
"sortMethod",
")",
")",
"{",
"sortMethod",
"=",
"_sortPrefConversi... | Converts the old brackets working set sort preference into the modern paneview sort preference
@private
@param {!string} sortMethod - sort preference to convert
@return {?string} new sort preference string or undefined if an sortMethod is not found | [
"Converts",
"the",
"old",
"brackets",
"working",
"set",
"sort",
"preference",
"into",
"the",
"modern",
"paneview",
"sort",
"preference"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/project/WorkingSetSort.js#L119-L132 | train | Convert a sort preference to a valid type | [
30522,
3853,
1035,
19884,
11589,
28139,
2546,
1006,
4066,
11368,
6806,
2094,
1007,
1063,
2065,
1006,
999,
4066,
11368,
6806,
2094,
1007,
1063,
2709,
19701,
1025,
1065,
2065,
1006,
1035,
4066,
28139,
11329,
2239,
27774,
2863,
2361,
1012,
203... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | moveHandles | function moveHandles ( upward, proposal, locations, handleNumbers ) {
var proposals = locations.slice();
var b = [!upward, upward];
var f = [upward, !upward];
// Copy handleNumbers so we don't change the dataset
handleNumbers = handleNumbers.slice();
// Check to see which handle is 'leading'.
// If that one can't move the second can't either.
if ( upward ) {
handleNumbers.reverse();
}
// Step 1: get the maximum percentage that any of the handles can move
if ( handleNumbers.length > 1 ) {
handleNumbers.forEach(function(handleNumber, o) {
var to = checkHandlePosition(proposals, handleNumber, proposals[handleNumber] + proposal, b[o], f[o]);
// Stop if one of the handles can't move.
if ( to === false ) {
proposal = 0;
} else {
proposal = to - proposals[handleNumber];
proposals[handleNumber] = to;
}
});
}
// If using one handle, check backward AND forward
else {
b = f = [true];
}
var state = false;
// Step 2: Try to set the handles with the found percentage
handleNumbers.forEach(function(handleNumber, o) {
state = setHandle(handleNumber, locations[handleNumber] + proposal, b[o], f[o]) || state;
});
// Step 3: If a handle moved, fire events
if ( state ) {
handleNumbers.forEach(function(handleNumber){
fireEvent('update', handleNumber);
fireEvent('slide', handleNumber);
});
}
} | javascript | function moveHandles ( upward, proposal, locations, handleNumbers ) {
var proposals = locations.slice();
var b = [!upward, upward];
var f = [upward, !upward];
// Copy handleNumbers so we don't change the dataset
handleNumbers = handleNumbers.slice();
// Check to see which handle is 'leading'.
// If that one can't move the second can't either.
if ( upward ) {
handleNumbers.reverse();
}
// Step 1: get the maximum percentage that any of the handles can move
if ( handleNumbers.length > 1 ) {
handleNumbers.forEach(function(handleNumber, o) {
var to = checkHandlePosition(proposals, handleNumber, proposals[handleNumber] + proposal, b[o], f[o]);
// Stop if one of the handles can't move.
if ( to === false ) {
proposal = 0;
} else {
proposal = to - proposals[handleNumber];
proposals[handleNumber] = to;
}
});
}
// If using one handle, check backward AND forward
else {
b = f = [true];
}
var state = false;
// Step 2: Try to set the handles with the found percentage
handleNumbers.forEach(function(handleNumber, o) {
state = setHandle(handleNumber, locations[handleNumber] + proposal, b[o], f[o]) || state;
});
// Step 3: If a handle moved, fire events
if ( state ) {
handleNumbers.forEach(function(handleNumber){
fireEvent('update', handleNumber);
fireEvent('slide', handleNumber);
});
}
} | [
"function",
"moveHandles",
"(",
"upward",
",",
"proposal",
",",
"locations",
",",
"handleNumbers",
")",
"{",
"var",
"proposals",
"=",
"locations",
".",
"slice",
"(",
")",
";",
"var",
"b",
"=",
"[",
"!",
"upward",
",",
"upward",
"]",
";",
"var",
"f",
... | Moves handle(s) by a percentage (bool, % to move, [% where handle started, ...], [index in scope_Handles, ...]) | [
"Moves",
"handle",
"(",
"s",
")",
"by",
"a",
"percentage",
"(",
"bool",
"%",
"to",
"move",
"[",
"%",
"where",
"handle",
"started",
"...",
"]",
"[",
"index",
"in",
"scope_Handles",
"...",
"]",
")"
] | 1122efadad8f1433d404696f7613e3cc13fb83a4 | https://github.com/Dogfalo/materialize/blob/1122efadad8f1433d404696f7613e3cc13fb83a4/extras/noUiSlider/nouislider.js#L1392-L1444 | train | Move handles in the dataset | [
30522,
3853,
2693,
11774,
4244,
1006,
10745,
1010,
6378,
1010,
5269,
1010,
5047,
19172,
17198,
1007,
1063,
13075,
10340,
1027,
5269,
1012,
14704,
1006,
1007,
1025,
13075,
1038,
1027,
1031,
999,
10745,
1010,
10745,
1033,
1025,
13075,
1042,
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 | parse_PtgAttrGoto | function parse_PtgAttrGoto(blob, length, opts) {
var bitGoto = (blob[blob.l+1] & 0xFF) ? 1 : 0;
blob.l += 2;
return [bitGoto, blob.read_shift(opts && opts.biff == 2 ? 1 : 2)];
} | javascript | function parse_PtgAttrGoto(blob, length, opts) {
var bitGoto = (blob[blob.l+1] & 0xFF) ? 1 : 0;
blob.l += 2;
return [bitGoto, blob.read_shift(opts && opts.biff == 2 ? 1 : 2)];
} | [
"function",
"parse_PtgAttrGoto",
"(",
"blob",
",",
"length",
",",
"opts",
")",
"{",
"var",
"bitGoto",
"=",
"(",
"blob",
"[",
"blob",
".",
"l",
"+",
"1",
"]",
"&",
"0xFF",
")",
"?",
"1",
":",
"0",
";",
"blob",
".",
"l",
"+=",
"2",
";",
"return",... | /* [MS-XLS] 2.5.198.35 ; [MS-XLSB] 2.5.97.26 | [
"/",
"*",
"[",
"MS",
"-",
"XLS",
"]",
"2",
".",
"5",
".",
"198",
".",
"35",
";",
"[",
"MS",
"-",
"XLSB",
"]",
"2",
".",
"5",
".",
"97",
".",
"26"
] | 9a6d8a1d3d80c78dad5201fb389316f935279cdc | https://github.com/SheetJS/js-xlsx/blob/9a6d8a1d3d80c78dad5201fb389316f935279cdc/xlsx.js#L10376-L10380 | train | ECMA - 262 12. 2. 2 PTGoto | [
30522,
3853,
11968,
3366,
1035,
13866,
20697,
16344,
3995,
3406,
1006,
1038,
4135,
2497,
1010,
3091,
1010,
23569,
2015,
1007,
1063,
13075,
2978,
3995,
3406,
1027,
1006,
1038,
4135,
2497,
1031,
1038,
4135,
2497,
1012,
1048,
1009,
1015,
1033,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/ControlsMaster.controller.js | function () {
var BusyDialog,
sDensityMode = this._oCore.byId('DensityModeSwitch').getSelectedKey(),
sTheme = this._oCore.byId('ThemeSelect').getSelectedKey(),
bRTL = this._oCore.byId('RTLSwitch').getState();
this._oSettingsDialog.close();
// Lazy loading of busy dialog
if (!this._oBusyDialog) {
//TODO: global jquery call found
jQuery.sap.require("sap.m.BusyDialog");
BusyDialog = sap.ui.require("sap/m/BusyDialog");
this._oBusyDialog = new BusyDialog();
this.getView().addDependent(this._oBusyDialog);
}
// Handle busy dialog
this._oBusyDialog.open();
setTimeout(function () {
this._oBusyDialog.close();
}.bind(this), 1000);
// handle settings change
this._applyAppConfiguration(sTheme, sDensityMode, bRTL);
// If we are navigating outside the Explored App section: view settings should be reset
this.getRouter().attachBeforeRouteMatched(this._viewSettingsResetOnNavigation, this);
} | javascript | function () {
var BusyDialog,
sDensityMode = this._oCore.byId('DensityModeSwitch').getSelectedKey(),
sTheme = this._oCore.byId('ThemeSelect').getSelectedKey(),
bRTL = this._oCore.byId('RTLSwitch').getState();
this._oSettingsDialog.close();
// Lazy loading of busy dialog
if (!this._oBusyDialog) {
//TODO: global jquery call found
jQuery.sap.require("sap.m.BusyDialog");
BusyDialog = sap.ui.require("sap/m/BusyDialog");
this._oBusyDialog = new BusyDialog();
this.getView().addDependent(this._oBusyDialog);
}
// Handle busy dialog
this._oBusyDialog.open();
setTimeout(function () {
this._oBusyDialog.close();
}.bind(this), 1000);
// handle settings change
this._applyAppConfiguration(sTheme, sDensityMode, bRTL);
// If we are navigating outside the Explored App section: view settings should be reset
this.getRouter().attachBeforeRouteMatched(this._viewSettingsResetOnNavigation, this);
} | [
"function",
"(",
")",
"{",
"var",
"BusyDialog",
",",
"sDensityMode",
"=",
"this",
".",
"_oCore",
".",
"byId",
"(",
"'DensityModeSwitch'",
")",
".",
"getSelectedKey",
"(",
")",
",",
"sTheme",
"=",
"this",
".",
"_oCore",
".",
"byId",
"(",
"'ThemeSelect'",
... | Saves settings from the view settings dialog
@public | [
"Saves",
"settings",
"from",
"the",
"view",
"settings",
"dialog"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/ControlsMaster.controller.js#L689-L717 | train | Handles the settings change | [
30522,
3853,
1006,
1007,
1063,
13075,
5697,
27184,
8649,
1010,
17371,
6132,
3012,
5302,
3207,
1027,
2023,
1012,
1035,
1051,
17345,
1012,
2011,
3593,
1006,
1005,
4304,
5302,
6155,
9148,
10649,
1005,
1007,
1012,
4152,
12260,
10985,
14839,
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 | common/src/web/jquery-1.3.2.js | function( object, callback, args ) {
var name, i = 0, length = object.length;
if ( args ) {
if ( length === undefined ) {
for ( name in object )
if ( callback.apply( object[ name ], args ) === false )
break;
} else
for ( ; i < length; )
if ( callback.apply( object[ i++ ], args ) === false )
break;
// A special, fast, case for the most common use of each
} else {
if ( length === undefined ) {
for ( name in object )
if ( callback.call( object[ name ], name, object[ name ] ) === false )
break;
} else
for ( var value = object[0];
i < length && callback.call( value, i, value ) !== false; value = object[++i] ){}
}
return object;
} | javascript | function( object, callback, args ) {
var name, i = 0, length = object.length;
if ( args ) {
if ( length === undefined ) {
for ( name in object )
if ( callback.apply( object[ name ], args ) === false )
break;
} else
for ( ; i < length; )
if ( callback.apply( object[ i++ ], args ) === false )
break;
// A special, fast, case for the most common use of each
} else {
if ( length === undefined ) {
for ( name in object )
if ( callback.call( object[ name ], name, object[ name ] ) === false )
break;
} else
for ( var value = object[0];
i < length && callback.call( value, i, value ) !== false; value = object[++i] ){}
}
return object;
} | [
"function",
"(",
"object",
",",
"callback",
",",
"args",
")",
"{",
"var",
"name",
",",
"i",
"=",
"0",
",",
"length",
"=",
"object",
".",
"length",
";",
"if",
"(",
"args",
")",
"{",
"if",
"(",
"length",
"===",
"undefined",
")",
"{",
"for",
"(",
... | args is for internal usage only | [
"args",
"is",
"for",
"internal",
"usage",
"only"
] | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/common/src/web/jquery-1.3.2.js#L671-L696 | train | A function that calls the callback for each value in object. | [
30522,
3853,
1006,
4874,
1010,
2655,
5963,
1010,
12098,
5620,
1007,
1063,
13075,
2171,
1010,
1045,
1027,
1014,
1010,
3091,
1027,
4874,
1012,
3091,
1025,
2065,
1006,
12098,
5620,
1007,
1063,
2065,
1006,
3091,
1027,
1027,
1027,
6151,
28344,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | src/sap.ui.table/src/sap/ui/table/TableUtils.js | function(oTable) {
if (!oTable) {
return false;
}
if (TableUtils.canUsePendingRequestsCounter(oTable)) {
return oTable._iPendingRequests > 0;
} else {
return oTable._bPendingRequest;
}
} | javascript | function(oTable) {
if (!oTable) {
return false;
}
if (TableUtils.canUsePendingRequestsCounter(oTable)) {
return oTable._iPendingRequests > 0;
} else {
return oTable._bPendingRequest;
}
} | [
"function",
"(",
"oTable",
")",
"{",
"if",
"(",
"!",
"oTable",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"TableUtils",
".",
"canUsePendingRequestsCounter",
"(",
"oTable",
")",
")",
"{",
"return",
"oTable",
".",
"_iPendingRequests",
">",
"0",
";",... | Returns whether one or more requests are currently in process by the binding.
@param {sap.ui.table.Table} oTable Instance of the table.
@returns {boolean} Whether the binding of the table is currently requesting data. | [
"Returns",
"whether",
"one",
"or",
"more",
"requests",
"are",
"currently",
"in",
"process",
"by",
"the",
"binding",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableUtils.js#L391-L401 | train | Returns true if the table has pending requests | [
30522,
3853,
1006,
27178,
3085,
1007,
1063,
2065,
1006,
999,
27178,
3085,
1007,
1063,
2709,
6270,
1025,
1065,
2065,
1006,
2795,
21823,
4877,
1012,
2064,
8557,
11837,
4667,
2890,
15500,
9363,
16671,
2121,
1006,
27178,
3085,
1007,
1007,
1063,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | src/sap.ui.dt/src/sap/ui/dt/enablement/report/Table.js | function(sFilter) {
var oModel = this._getTable().getModel();
if (oModel) {
if (sFilter.length > 0) {
// As UI5 does not support filtering on first level, we have to do it on our own
var aData = this.getData();
var aFilteredData = aData.children.filter(function(oEntry) {
if (sFilter.indexOf("status=") != -1) {
return oEntry.status.value == sFilter.substring(sFilter.indexOf("=") + 1);
} else {
return oEntry.name.toLowerCase().indexOf(sFilter.toLowerCase()) != -1;
}
});
oModel.setData(aFilteredData);
} else {
oModel.setData(this.getData());
}
}
} | javascript | function(sFilter) {
var oModel = this._getTable().getModel();
if (oModel) {
if (sFilter.length > 0) {
// As UI5 does not support filtering on first level, we have to do it on our own
var aData = this.getData();
var aFilteredData = aData.children.filter(function(oEntry) {
if (sFilter.indexOf("status=") != -1) {
return oEntry.status.value == sFilter.substring(sFilter.indexOf("=") + 1);
} else {
return oEntry.name.toLowerCase().indexOf(sFilter.toLowerCase()) != -1;
}
});
oModel.setData(aFilteredData);
} else {
oModel.setData(this.getData());
}
}
} | [
"function",
"(",
"sFilter",
")",
"{",
"var",
"oModel",
"=",
"this",
".",
"_getTable",
"(",
")",
".",
"getModel",
"(",
")",
";",
"if",
"(",
"oModel",
")",
"{",
"if",
"(",
"sFilter",
".",
"length",
">",
"0",
")",
"{",
"// As UI5 does not support filterin... | Filters the table.
@param {sString} sFilter The filter string.
@public | [
"Filters",
"the",
"table",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.dt/src/sap/ui/dt/enablement/report/Table.js#L124-L143 | train | Filters the data by the given filter | [
30522,
3853,
1006,
16420,
4014,
3334,
1007,
1063,
13075,
18168,
10244,
2140,
1027,
2023,
1012,
1035,
2131,
10880,
1006,
1007,
1012,
2131,
5302,
9247,
1006,
1007,
1025,
2065,
1006,
18168,
10244,
2140,
1007,
1063,
2065,
1006,
16420,
4014,
333... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
Shopify/draggable | src/Draggable/Plugins/Announcement/Announcement.js | announce | function announce(message, {expire}) {
const element = document.createElement('div');
element.textContent = message;
liveRegion.appendChild(element);
return setTimeout(() => {
liveRegion.removeChild(element);
}, expire);
} | javascript | function announce(message, {expire}) {
const element = document.createElement('div');
element.textContent = message;
liveRegion.appendChild(element);
return setTimeout(() => {
liveRegion.removeChild(element);
}, expire);
} | [
"function",
"announce",
"(",
"message",
",",
"{",
"expire",
"}",
")",
"{",
"const",
"element",
"=",
"document",
".",
"createElement",
"(",
"'div'",
")",
";",
"element",
".",
"textContent",
"=",
"message",
";",
"liveRegion",
".",
"appendChild",
"(",
"elemen... | Announces message via live region
@param {String} message
@param {Object} options
@param {Number} options.expire | [
"Announces",
"message",
"via",
"live",
"region"
] | ecc04b2cdb8b5009664862472ff8cb237c38cfeb | https://github.com/Shopify/draggable/blob/ecc04b2cdb8b5009664862472ff8cb237c38cfeb/src/Draggable/Plugins/Announcement/Announcement.js#L142-L151 | train | announce a message to the live region | [
30522,
3853,
14970,
1006,
4471,
1010,
1063,
4654,
20781,
1065,
1007,
1063,
9530,
3367,
5783,
1027,
6254,
1012,
3443,
12260,
3672,
1006,
1005,
4487,
2615,
1005,
1007,
1025,
5783,
1012,
3793,
8663,
6528,
2102,
1027,
4471,
1025,
11290,
13910,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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(state, source, target, points, isSource)
{
var value = mxUtils.getValue(state.style, (isSource) ? mxConstants.STYLE_SOURCE_JETTY_SIZE :
mxConstants.STYLE_TARGET_JETTY_SIZE, mxUtils.getValue(state.style,
mxConstants.STYLE_JETTY_SIZE, mxEdgeStyle.orthBuffer));
if (value == 'auto')
{
// Computes the automatic jetty size
var type = mxUtils.getValue(state.style, (isSource) ? mxConstants.STYLE_STARTARROW : mxConstants.STYLE_ENDARROW, mxConstants.NONE);
if (type != mxConstants.NONE)
{
var size = mxUtils.getNumber(state.style, (isSource) ? mxConstants.STYLE_STARTSIZE : mxConstants.STYLE_ENDSIZE, mxConstants.DEFAULT_MARKERSIZE);
value = Math.max(2, Math.ceil((size + mxEdgeStyle.orthBuffer) / mxEdgeStyle.orthBuffer)) * mxEdgeStyle.orthBuffer;
}
else
{
value = 2 * mxEdgeStyle.orthBuffer;
}
}
return value;
} | javascript | function(state, source, target, points, isSource)
{
var value = mxUtils.getValue(state.style, (isSource) ? mxConstants.STYLE_SOURCE_JETTY_SIZE :
mxConstants.STYLE_TARGET_JETTY_SIZE, mxUtils.getValue(state.style,
mxConstants.STYLE_JETTY_SIZE, mxEdgeStyle.orthBuffer));
if (value == 'auto')
{
// Computes the automatic jetty size
var type = mxUtils.getValue(state.style, (isSource) ? mxConstants.STYLE_STARTARROW : mxConstants.STYLE_ENDARROW, mxConstants.NONE);
if (type != mxConstants.NONE)
{
var size = mxUtils.getNumber(state.style, (isSource) ? mxConstants.STYLE_STARTSIZE : mxConstants.STYLE_ENDSIZE, mxConstants.DEFAULT_MARKERSIZE);
value = Math.max(2, Math.ceil((size + mxEdgeStyle.orthBuffer) / mxEdgeStyle.orthBuffer)) * mxEdgeStyle.orthBuffer;
}
else
{
value = 2 * mxEdgeStyle.orthBuffer;
}
}
return value;
} | [
"function",
"(",
"state",
",",
"source",
",",
"target",
",",
"points",
",",
"isSource",
")",
"{",
"var",
"value",
"=",
"mxUtils",
".",
"getValue",
"(",
"state",
".",
"style",
",",
"(",
"isSource",
")",
"?",
"mxConstants",
".",
"STYLE_SOURCE_JETTY_SIZE",
... | mxEdgeStyle.SOURCE_MASK | mxEdgeStyle.TARGET_MASK, | [
"mxEdgeStyle",
".",
"SOURCE_MASK",
"|",
"mxEdgeStyle",
".",
"TARGET_MASK"
] | 33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44 | https://github.com/jgraph/mxgraph/blob/33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44/javascript/mxClient.js#L50364-L50387 | train | Returns the size of the jetty | [
30522,
3853,
1006,
2110,
1010,
3120,
1010,
4539,
1010,
2685,
1010,
26354,
8162,
3401,
1007,
1063,
13075,
3643,
1027,
25630,
21823,
4877,
1012,
2131,
10175,
5657,
1006,
2110,
1012,
2806,
1010,
1006,
26354,
8162,
3401,
1007,
1029,
25630,
8663... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
eslint/eslint | lib/rules/generator-star-spacing.js | checkSpacing | function checkSpacing(kind, side, leftToken, rightToken) {
if (!!(rightToken.range[0] - leftToken.range[1]) !== modes[kind][side]) {
const after = leftToken.value === "*";
const spaceRequired = modes[kind][side];
const node = after ? leftToken : rightToken;
const messageId = `${spaceRequired ? "missing" : "unexpected"}${capitalize(side)}`;
context.report({
node,
messageId,
fix(fixer) {
if (spaceRequired) {
if (after) {
return fixer.insertTextAfter(node, " ");
}
return fixer.insertTextBefore(node, " ");
}
return fixer.removeRange([leftToken.range[1], rightToken.range[0]]);
}
});
}
} | javascript | function checkSpacing(kind, side, leftToken, rightToken) {
if (!!(rightToken.range[0] - leftToken.range[1]) !== modes[kind][side]) {
const after = leftToken.value === "*";
const spaceRequired = modes[kind][side];
const node = after ? leftToken : rightToken;
const messageId = `${spaceRequired ? "missing" : "unexpected"}${capitalize(side)}`;
context.report({
node,
messageId,
fix(fixer) {
if (spaceRequired) {
if (after) {
return fixer.insertTextAfter(node, " ");
}
return fixer.insertTextBefore(node, " ");
}
return fixer.removeRange([leftToken.range[1], rightToken.range[0]]);
}
});
}
} | [
"function",
"checkSpacing",
"(",
"kind",
",",
"side",
",",
"leftToken",
",",
"rightToken",
")",
"{",
"if",
"(",
"!",
"!",
"(",
"rightToken",
".",
"range",
"[",
"0",
"]",
"-",
"leftToken",
".",
"range",
"[",
"1",
"]",
")",
"!==",
"modes",
"[",
"kind... | Checks the spacing between two tokens before or after the star token.
@param {string} kind Either "named", "anonymous", or "method"
@param {string} side Either "before" or "after".
@param {Token} leftToken `function` keyword token if side is "before", or
star token if side is "after".
@param {Token} rightToken Star token if side is "before", or identifier
token if side is "after".
@returns {void} | [
"Checks",
"the",
"spacing",
"between",
"two",
"tokens",
"before",
"or",
"after",
"the",
"star",
"token",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/generator-star-spacing.js#L151-L172 | train | Check spacing of a token | [
30522,
3853,
14148,
19498,
2075,
1006,
2785,
1010,
2217,
1010,
2187,
18715,
2368,
1010,
2157,
18715,
2368,
1007,
1063,
2065,
1006,
999,
999,
1006,
2157,
18715,
2368,
1012,
2846,
1031,
1014,
1033,
1011,
2187,
18715,
2368,
1012,
2846,
1031,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/model/odata/_AnnotationHelperExpression.js | function (sValue) {
var aMatches = mEdmType2RegExp.DateTimeOffset.exec(sValue);
if (aMatches && aMatches[1] && aMatches[1].length > 4) {
// "round" to millis, BEWARE of the dot!
sValue = sValue.replace(aMatches[1], aMatches[1].slice(0, 4));
}
return DateFormat.getDateTimeInstance({
pattern : "yyyy-MM-dd'T'HH:mm:ss.SSSX",
strictParsing : true
}).parse(sValue.toUpperCase());
} | javascript | function (sValue) {
var aMatches = mEdmType2RegExp.DateTimeOffset.exec(sValue);
if (aMatches && aMatches[1] && aMatches[1].length > 4) {
// "round" to millis, BEWARE of the dot!
sValue = sValue.replace(aMatches[1], aMatches[1].slice(0, 4));
}
return DateFormat.getDateTimeInstance({
pattern : "yyyy-MM-dd'T'HH:mm:ss.SSSX",
strictParsing : true
}).parse(sValue.toUpperCase());
} | [
"function",
"(",
"sValue",
")",
"{",
"var",
"aMatches",
"=",
"mEdmType2RegExp",
".",
"DateTimeOffset",
".",
"exec",
"(",
"sValue",
")",
";",
"if",
"(",
"aMatches",
"&&",
"aMatches",
"[",
"1",
"]",
"&&",
"aMatches",
"[",
"1",
"]",
".",
"length",
">",
... | Parses an Edm.DateTimeOffset value and returns the corresponding JavaScript Date value.
@param {string} sValue
the Edm.DateTimeOffset value to parse
@returns {Date}
the JavaScript Date value or <code>null</code> in case the input could not be parsed | [
"Parses",
"an",
"Edm",
".",
"DateTimeOffset",
"value",
"and",
"returns",
"the",
"corresponding",
"JavaScript",
"Date",
"value",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/_AnnotationHelperExpression.js#L663-L674 | train | Converts an EdmType value to a date time | [
30522,
3853,
1006,
17917,
2389,
5657,
1007,
1063,
13075,
25933,
10649,
2229,
1027,
19960,
20492,
18863,
2475,
2890,
3351,
2595,
2361,
1012,
3058,
7292,
27475,
3388,
1012,
4654,
8586,
1006,
17917,
2389,
5657,
1007,
1025,
2065,
1006,
25933,
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... | |
mui-org/material-ui | packages/material-ui-icons/renameFilters/default.js | defaultDestRewriter | function defaultDestRewriter(svgPathObj, innerPath, options) {
let fileName = svgPathObj.base;
if (options.fileSuffix) {
fileName.replace(options.fileSuffix, '.svg');
} else {
fileName = fileName.replace('.svg', '.js');
}
fileName = fileName.replace(/(^.)|(_)(.)/g, (match, p1, p2, p3) => (p1 || p3).toUpperCase());
return path.join(innerPath, fileName);
} | javascript | function defaultDestRewriter(svgPathObj, innerPath, options) {
let fileName = svgPathObj.base;
if (options.fileSuffix) {
fileName.replace(options.fileSuffix, '.svg');
} else {
fileName = fileName.replace('.svg', '.js');
}
fileName = fileName.replace(/(^.)|(_)(.)/g, (match, p1, p2, p3) => (p1 || p3).toUpperCase());
return path.join(innerPath, fileName);
} | [
"function",
"defaultDestRewriter",
"(",
"svgPathObj",
",",
"innerPath",
",",
"options",
")",
"{",
"let",
"fileName",
"=",
"svgPathObj",
".",
"base",
";",
"if",
"(",
"options",
".",
"fileSuffix",
")",
"{",
"fileName",
".",
"replace",
"(",
"options",
".",
"f... | /*
Return path to write file to inside outputDir.
@param {object} svgPathObj
path objects from path.parse
@param {string} innerPath
Path (relative to options.svgDir) to svg file
e.g. if svgFile was /home/user/icons/path/to/svg/file.svg
options.svgDir is /home/user/icons/
innerPath is path/to/svg
@param {object} options
@return {string} output file dest relative to outputDir | [
"/",
"*",
"Return",
"path",
"to",
"write",
"file",
"to",
"inside",
"outputDir",
"."
] | 1555e52367835946382fbf2a8f681de71318915d | https://github.com/mui-org/material-ui/blob/1555e52367835946382fbf2a8f681de71318915d/packages/material-ui-icons/renameFilters/default.js#L18-L27 | train | Default dest rewrite function | [
30522,
3853,
12398,
6155,
7913,
15994,
1006,
17917,
21600,
8988,
16429,
3501,
1010,
5110,
15069,
1010,
7047,
1007,
1063,
2292,
5371,
18442,
1027,
17917,
21600,
8988,
16429,
3501,
1012,
2918,
1025,
2065,
1006,
7047,
1012,
6764,
16093,
8873,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/extensions/default/InlineTimingFunctionEditor/StepEditor.js | _canvasKeyDown | function _canvasKeyDown(e) {
var code = e.keyCode,
self = e.target,
stepEditor = self.stepEditor;
if (code >= KeyEvent.DOM_VK_LEFT && code <= KeyEvent.DOM_VK_DOWN) {
e.preventDefault();
// Arrow keys pressed
switch (code) {
case KeyEvent.DOM_VK_LEFT:
stepEditor.stepCanvas.stepParams.timing = "start";
break;
case KeyEvent.DOM_VK_UP:
// No upper limit
stepEditor.stepCanvas.stepParams.count++;
break;
case KeyEvent.DOM_VK_RIGHT:
stepEditor.stepCanvas.stepParams.timing = "end";
break;
case KeyEvent.DOM_VK_DOWN:
if (stepEditor.stepCanvas.stepParams.count > 1) {
stepEditor.stepCanvas.stepParams.count--;
}
break;
}
// update step params
stepEditor._stepParams = stepEditor.stepCanvas.stepParams;
stepEditor._commitTimingFunction();
stepEditor._updateCanvas();
return true;
} else if (code === KeyEvent.DOM_VK_ESCAPE) {
return true;
}
return false;
} | javascript | function _canvasKeyDown(e) {
var code = e.keyCode,
self = e.target,
stepEditor = self.stepEditor;
if (code >= KeyEvent.DOM_VK_LEFT && code <= KeyEvent.DOM_VK_DOWN) {
e.preventDefault();
// Arrow keys pressed
switch (code) {
case KeyEvent.DOM_VK_LEFT:
stepEditor.stepCanvas.stepParams.timing = "start";
break;
case KeyEvent.DOM_VK_UP:
// No upper limit
stepEditor.stepCanvas.stepParams.count++;
break;
case KeyEvent.DOM_VK_RIGHT:
stepEditor.stepCanvas.stepParams.timing = "end";
break;
case KeyEvent.DOM_VK_DOWN:
if (stepEditor.stepCanvas.stepParams.count > 1) {
stepEditor.stepCanvas.stepParams.count--;
}
break;
}
// update step params
stepEditor._stepParams = stepEditor.stepCanvas.stepParams;
stepEditor._commitTimingFunction();
stepEditor._updateCanvas();
return true;
} else if (code === KeyEvent.DOM_VK_ESCAPE) {
return true;
}
return false;
} | [
"function",
"_canvasKeyDown",
"(",
"e",
")",
"{",
"var",
"code",
"=",
"e",
".",
"keyCode",
",",
"self",
"=",
"e",
".",
"target",
",",
"stepEditor",
"=",
"self",
".",
"stepEditor",
";",
"if",
"(",
"code",
">=",
"KeyEvent",
".",
"DOM_VK_LEFT",
"&&",
"c... | Event handlers
Handle key down in <canvas> element
@param {Event} e Key down event | [
"Event",
"handlers",
"Handle",
"key",
"down",
"in",
"<canvas",
">",
"element"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/InlineTimingFunctionEditor/StepEditor.js#L245-L284 | train | Acecececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececece e | [
30522,
3853,
1035,
10683,
14839,
7698,
1006,
1041,
1007,
1063,
13075,
3642,
1027,
1041,
1012,
3145,
16044,
1010,
2969,
1027,
1041,
1012,
4539,
1010,
3357,
2098,
15660,
1027,
2969,
1012,
3357,
2098,
15660,
1025,
2065,
1006,
3642,
1028,
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... |
facebook/relay | packages/relay-compiler/transforms/FilterDirectivesTransform.js | visitDirective | function visitDirective(directive: Directive): ?Directive {
if (
this.getContext()
.serverSchema.getDirectives()
.some(schemaDirective => schemaDirective.name === directive.name)
) {
return directive;
}
return null;
} | javascript | function visitDirective(directive: Directive): ?Directive {
if (
this.getContext()
.serverSchema.getDirectives()
.some(schemaDirective => schemaDirective.name === directive.name)
) {
return directive;
}
return null;
} | [
"function",
"visitDirective",
"(",
"directive",
":",
"Directive",
")",
":",
"?",
"Directive",
"{",
"if",
"(",
"this",
".",
"getContext",
"(",
")",
".",
"serverSchema",
".",
"getDirectives",
"(",
")",
".",
"some",
"(",
"schemaDirective",
"=>",
"schemaDirectiv... | @internal
Skip directives not defined in the original schema. | [
"@internal"
] | 7fb9be5182b9650637d7b92ead9a42713ac30aa4 | https://github.com/facebook/relay/blob/7fb9be5182b9650637d7b92ead9a42713ac30aa4/packages/relay-compiler/transforms/FilterDirectivesTransform.js#L35-L44 | train | Visit a directive | [
30522,
3853,
3942,
4305,
2890,
15277,
1006,
16449,
1024,
16449,
1007,
1024,
1029,
16449,
1063,
2065,
1006,
2023,
1012,
2131,
8663,
18209,
1006,
1007,
1012,
14903,
5403,
2863,
1012,
2131,
4305,
2890,
15277,
2015,
1006,
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,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.table/src/sap/ui/table/TablePointerExtension.js | function(oTable, iColIndex) {
var aVisibleColumns = oTable._getVisibleColumns();
var oColumn;
if (iColIndex >= 0 && iColIndex < aVisibleColumns.length) {
oColumn = aVisibleColumns[iColIndex];
if (oColumn._iNewWidth) {
TableUtils.Column.resizeColumn(oTable, oTable.indexOfColumn(oColumn), oColumn._iNewWidth);
delete oColumn._iNewWidth;
}
}
ColumnResizeHelper._cleanupColumResizing(oTable);
oColumn.focus();
} | javascript | function(oTable, iColIndex) {
var aVisibleColumns = oTable._getVisibleColumns();
var oColumn;
if (iColIndex >= 0 && iColIndex < aVisibleColumns.length) {
oColumn = aVisibleColumns[iColIndex];
if (oColumn._iNewWidth) {
TableUtils.Column.resizeColumn(oTable, oTable.indexOfColumn(oColumn), oColumn._iNewWidth);
delete oColumn._iNewWidth;
}
}
ColumnResizeHelper._cleanupColumResizing(oTable);
oColumn.focus();
} | [
"function",
"(",
"oTable",
",",
"iColIndex",
")",
"{",
"var",
"aVisibleColumns",
"=",
"oTable",
".",
"_getVisibleColumns",
"(",
")",
";",
"var",
"oColumn",
";",
"if",
"(",
"iColIndex",
">=",
"0",
"&&",
"iColIndex",
"<",
"aVisibleColumns",
".",
"length",
")... | /*
Cleans up the state which is created while resize a column via drag&drop and recalculates the new column width. | [
"/",
"*",
"Cleans",
"up",
"the",
"state",
"which",
"is",
"created",
"while",
"resize",
"a",
"column",
"via",
"drag&drop",
"and",
"recalculates",
"the",
"new",
"column",
"width",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TablePointerExtension.js#L245-L259 | train | Resizes the column at the given index. | [
30522,
3853,
1006,
27178,
3085,
1010,
24582,
18861,
3207,
2595,
1007,
1063,
13075,
20704,
17417,
3468,
25778,
2819,
3619,
1027,
27178,
3085,
1012,
1035,
2131,
11365,
7028,
25778,
2819,
3619,
1006,
1007,
1025,
13075,
1051,
25778,
2819,
2078,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
fex-team/webuploader | src/widgets/image.js | function( file, cb, width, height ) {
var opts, image;
file = this.request( 'get-file', file );
// 只预览图片格式。
if ( !file.type.match( /^image/ ) ) {
cb( true );
return;
}
opts = $.extend({}, this.options.thumb );
// 如果传入的是object.
if ( $.isPlainObject( width ) ) {
opts = $.extend( opts, width );
width = null;
}
width = width || opts.width;
height = height || opts.height;
image = new Image( opts );
image.once( 'load', function() {
file._info = file._info || image.info();
file._meta = file._meta || image.meta();
// 如果 width 的值介于 0 - 1
// 说明设置的是百分比。
if ( width <= 1 && width > 0 ) {
width = file._info.width * width;
}
// 同样的规则应用于 height
if ( height <= 1 && height > 0 ) {
height = file._info.height * height;
}
image.resize( width, height );
});
// 当 resize 完后
image.once( 'complete', function() {
cb( false, image.getAsDataUrl( opts.type ) );
image.destroy();
});
image.once( 'error', function( reason ) {
cb( reason || true );
image.destroy();
});
throttle( image, file.source.size, function() {
file._info && image.info( file._info );
file._meta && image.meta( file._meta );
image.loadFromBlob( file.source );
});
} | javascript | function( file, cb, width, height ) {
var opts, image;
file = this.request( 'get-file', file );
// 只预览图片格式。
if ( !file.type.match( /^image/ ) ) {
cb( true );
return;
}
opts = $.extend({}, this.options.thumb );
// 如果传入的是object.
if ( $.isPlainObject( width ) ) {
opts = $.extend( opts, width );
width = null;
}
width = width || opts.width;
height = height || opts.height;
image = new Image( opts );
image.once( 'load', function() {
file._info = file._info || image.info();
file._meta = file._meta || image.meta();
// 如果 width 的值介于 0 - 1
// 说明设置的是百分比。
if ( width <= 1 && width > 0 ) {
width = file._info.width * width;
}
// 同样的规则应用于 height
if ( height <= 1 && height > 0 ) {
height = file._info.height * height;
}
image.resize( width, height );
});
// 当 resize 完后
image.once( 'complete', function() {
cb( false, image.getAsDataUrl( opts.type ) );
image.destroy();
});
image.once( 'error', function( reason ) {
cb( reason || true );
image.destroy();
});
throttle( image, file.source.size, function() {
file._info && image.info( file._info );
file._meta && image.meta( file._meta );
image.loadFromBlob( file.source );
});
} | [
"function",
"(",
"file",
",",
"cb",
",",
"width",
",",
"height",
")",
"{",
"var",
"opts",
",",
"image",
";",
"file",
"=",
"this",
".",
"request",
"(",
"'get-file'",
",",
"file",
")",
";",
"// 只预览图片格式。",
"if",
"(",
"!",
"file",
".",
"type",
".",
"... | 生成缩略图,此过程为异步,所以需要传入`callback`。
通常情况在图片加入队里后调用此方法来生成预览图以增强交互效果。
当 width 或者 height 的值介于 0 - 1 时,被当成百分比使用。
`callback`中可以接收到两个参数。
* 第一个为error,如果生成缩略图有错误,此error将为真。
* 第二个为ret, 缩略图的Data URL值。
**注意**
Date URL在IE6/7中不支持,所以不用调用此方法了,直接显示一张暂不支持预览图片好了。
也可以借助服务端,将 base64 数据传给服务端,生成一个临时文件供预览。
@method makeThumb
@grammar makeThumb( file, callback ) => undefined
@grammar makeThumb( file, callback, width, height ) => undefined
@for Uploader
@example
uploader.on( 'fileQueued', function( file ) {
var $li = ...;
uploader.makeThumb( file, function( error, ret ) {
if ( error ) {
$li.text('预览错误');
} else {
$li.append('<img alt="" src="' + ret + '" />');
}
});
}); | [
"生成缩略图,此过程为异步,所以需要传入",
"callback",
"。",
"通常情况在图片加入队里后调用此方法来生成预览图以增强交互效果。"
] | 7094e4476c5af3b06993d91dde2d223200b9feb7 | https://github.com/fex-team/webuploader/blob/7094e4476c5af3b06993d91dde2d223200b9feb7/src/widgets/image.js#L165-L223 | train | get image | [
30522,
3853,
1006,
5371,
1010,
17324,
1010,
9381,
1010,
4578,
1007,
1063,
13075,
23569,
2015,
1010,
3746,
1025,
5371,
1027,
2023,
1012,
5227,
1006,
1005,
2131,
1011,
5371,
1005,
1010,
5371,
1007,
1025,
1013,
1013,
100,
100,
100,
100,
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... | |
dcloudio/mui | examples/login/libs/easymob-webim-sdk/strophe-custom-2.0.0.js | function (elem)
{
var impNode;
var xmlGen = Strophe.xmlGenerator();
try {
impNode = (xmlGen.importNode !== undefined);
}
catch (e) {
impNode = false;
}
var newElem = impNode ?
xmlGen.importNode(elem, true) :
Strophe.copyElement(elem);
this.node.appendChild(newElem);
this.node = newElem;
return this;
} | javascript | function (elem)
{
var impNode;
var xmlGen = Strophe.xmlGenerator();
try {
impNode = (xmlGen.importNode !== undefined);
}
catch (e) {
impNode = false;
}
var newElem = impNode ?
xmlGen.importNode(elem, true) :
Strophe.copyElement(elem);
this.node.appendChild(newElem);
this.node = newElem;
return this;
} | [
"function",
"(",
"elem",
")",
"{",
"var",
"impNode",
";",
"var",
"xmlGen",
"=",
"Strophe",
".",
"xmlGenerator",
"(",
")",
";",
"try",
"{",
"impNode",
"=",
"(",
"xmlGen",
".",
"importNode",
"!==",
"undefined",
")",
";",
"}",
"catch",
"(",
"e",
")",
... | Function: cnode
Add a child to the current element and make it the new current
element.
This function is the same as c() except that instead of using a
name and an attributes object to create the child it uses an
existing DOM element object.
Parameters:
(XMLElement) elem - A DOM element.
Returns:
The Strophe.Builder object. | [
"Function",
":",
"cnode",
"Add",
"a",
"child",
"to",
"the",
"current",
"element",
"and",
"make",
"it",
"the",
"new",
"current",
"element",
"."
] | ff74c90a1671a552f3604b1288bf38a4126312d0 | https://github.com/dcloudio/mui/blob/ff74c90a1671a552f3604b1288bf38a4126312d0/examples/login/libs/easymob-webim-sdk/strophe-custom-2.0.0.js#L1710-L1726 | train | Creates a new tag with the specified element | [
30522,
3853,
1006,
3449,
6633,
1007,
1063,
13075,
17727,
3630,
3207,
1025,
13075,
20950,
6914,
1027,
2358,
18981,
5369,
1012,
20950,
6914,
6906,
4263,
1006,
1007,
1025,
3046,
1063,
17727,
3630,
3207,
1027,
1006,
20950,
6914,
1012,
12324,
36... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | src/sap.ui.core/src/sap/ui/model/odata/ODataTreeBindingFlat.js | function() {
// ensure only TreeBindings are enhanced which have not been enhanced yet
if (!(this instanceof TreeBinding) || this._bIsAdapted) {
return;
}
// apply the methods of the adapters prototype to the TreeBinding instance
for (var fn in ODataTreeBindingFlat.prototype) {
if (ODataTreeBindingFlat.prototype.hasOwnProperty(fn)) {
this[fn] = ODataTreeBindingFlat.prototype[fn];
}
}
// make sure we have a parameter object
this.mParameters = this.mParameters || {};
// keep track of the page-size for expand request
this._iPageSize = 0;
// flat data structure to store the tree nodes depth-first ordered
this._aNodes = this._aNodes || [];
// the node cache for the last requested nodes (via getContexts)
this._aNodeCache = [];
// the tree states
this._aCollapsed = this._aCollapsed || [];
this._aExpanded = this._aExpanded || [];
this._aRemoved = [];
this._aAdded = [];
this._aNodeChanges = [];
this._aAllChangedNodes = [];
// a map of all subtree handles, which are removed from the tree (and may be re-inserted)
this._mSubtreeHandles = {};
// lowest server-index level, will be kept correct when loading new entries
this._iLowestServerLevel = null;
// selection state
this._aExpandedAfterSelectAll = this._aExpandedAfterSelectAll || [];
this._mSelected = this._mSelected || {};
this._mDeselected = this._mDeselected || {};
this._bSelectAll = false;
// the delta variable for calculating the correct binding-length (used e.g. for sizing the scrollbar)
this._iLengthDelta = 0;
//default value for collapse recursive
if (this.mParameters.collapseRecursive === undefined) {
this.bCollapseRecursive = true;
} else {
this.bCollapseRecursive = !!this.mParameters.collapseRecursive;
}
this._bIsAdapted = true;
this._bReadOnly = true;
this._aPendingRequests = [];
this._aPendingChildrenRequests = [];
this._aPendingSubtreeRequests = [];
} | javascript | function() {
// ensure only TreeBindings are enhanced which have not been enhanced yet
if (!(this instanceof TreeBinding) || this._bIsAdapted) {
return;
}
// apply the methods of the adapters prototype to the TreeBinding instance
for (var fn in ODataTreeBindingFlat.prototype) {
if (ODataTreeBindingFlat.prototype.hasOwnProperty(fn)) {
this[fn] = ODataTreeBindingFlat.prototype[fn];
}
}
// make sure we have a parameter object
this.mParameters = this.mParameters || {};
// keep track of the page-size for expand request
this._iPageSize = 0;
// flat data structure to store the tree nodes depth-first ordered
this._aNodes = this._aNodes || [];
// the node cache for the last requested nodes (via getContexts)
this._aNodeCache = [];
// the tree states
this._aCollapsed = this._aCollapsed || [];
this._aExpanded = this._aExpanded || [];
this._aRemoved = [];
this._aAdded = [];
this._aNodeChanges = [];
this._aAllChangedNodes = [];
// a map of all subtree handles, which are removed from the tree (and may be re-inserted)
this._mSubtreeHandles = {};
// lowest server-index level, will be kept correct when loading new entries
this._iLowestServerLevel = null;
// selection state
this._aExpandedAfterSelectAll = this._aExpandedAfterSelectAll || [];
this._mSelected = this._mSelected || {};
this._mDeselected = this._mDeselected || {};
this._bSelectAll = false;
// the delta variable for calculating the correct binding-length (used e.g. for sizing the scrollbar)
this._iLengthDelta = 0;
//default value for collapse recursive
if (this.mParameters.collapseRecursive === undefined) {
this.bCollapseRecursive = true;
} else {
this.bCollapseRecursive = !!this.mParameters.collapseRecursive;
}
this._bIsAdapted = true;
this._bReadOnly = true;
this._aPendingRequests = [];
this._aPendingChildrenRequests = [];
this._aPendingSubtreeRequests = [];
} | [
"function",
"(",
")",
"{",
"// ensure only TreeBindings are enhanced which have not been enhanced yet",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"TreeBinding",
")",
"||",
"this",
".",
"_bIsAdapted",
")",
"{",
"return",
";",
"}",
"// apply the methods of the adapters pro... | Adapter for TreeBindings to add the ListBinding functionality and use the
tree structure in list based controls.
@alias sap.ui.model.odata.ODataTreeBindingFlat
@function
@public | [
"Adapter",
"for",
"TreeBindings",
"to",
"add",
"the",
"ListBinding",
"functionality",
"and",
"use",
"the",
"tree",
"structure",
"in",
"list",
"based",
"controls",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/ODataTreeBindingFlat.js#L38-L101 | train | Creates a new TreeBinding instance. | [
30522,
3853,
1006,
1007,
1063,
1013,
1013,
5676,
2069,
3392,
8428,
4667,
2015,
2024,
9412,
2029,
2031,
2025,
2042,
9412,
2664,
2065,
1006,
999,
1006,
2023,
6013,
11253,
3392,
8428,
4667,
1007,
1064,
1064,
2023,
1012,
1035,
20377,
8447,
13... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | src/sap.ui.core/src/sap/ui/model/odata/v4/ODataModel.js | startsWithQualifiedName | function startsWithQualifiedName(sMetaPath) {
var iDotPos = sMetaPath.indexOf("."),
iSlashPos = sMetaPath.indexOf("/");
return iDotPos > 0 && (iSlashPos < 0 || iDotPos < iSlashPos);
} | javascript | function startsWithQualifiedName(sMetaPath) {
var iDotPos = sMetaPath.indexOf("."),
iSlashPos = sMetaPath.indexOf("/");
return iDotPos > 0 && (iSlashPos < 0 || iDotPos < iSlashPos);
} | [
"function",
"startsWithQualifiedName",
"(",
"sMetaPath",
")",
"{",
"var",
"iDotPos",
"=",
"sMetaPath",
".",
"indexOf",
"(",
"\".\"",
")",
",",
"iSlashPos",
"=",
"sMetaPath",
".",
"indexOf",
"(",
"\"/\"",
")",
";",
"return",
"iDotPos",
">",
"0",
"&&",
"(",
... | Checks if the given meta path contains a dot in its first segment.
@param {string} sMetaPath The meta path
@returns {boolean} Whether the given meta path contains a dot in its first segment | [
"Checks",
"if",
"the",
"given",
"meta",
"path",
"contains",
"a",
"dot",
"in",
"its",
"first",
"segment",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/ODataModel.js#L896-L901 | train | Checks if the given string is a qualified name | [
30522,
3853,
4627,
24415,
26426,
7810,
18442,
1006,
15488,
12928,
15069,
1007,
1063,
13075,
8909,
4140,
6873,
2015,
1027,
15488,
12928,
15069,
1012,
5950,
11253,
1006,
1000,
1012,
1000,
1007,
1010,
25340,
4095,
6873,
2015,
1027,
15488,
12928,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
postcss/autoprefixer | lib/hacks/grid-utils.js | normalizeRowColumn | function normalizeRowColumn (str) {
let normalized = parser(str)
.nodes
.reduce((result, node) => {
if (node.type === 'function' && node.value === 'repeat') {
let key = 'count'
let [count, value] = node.nodes.reduce((acc, n) => {
if (n.type === 'word' && key === 'count') {
acc[0] = Math.abs(parseInt(n.value))
return acc
}
if (n.type === 'div' && n.value === ',') {
key = 'value'
return acc
}
if (key === 'value') {
acc[1] += parser.stringify(n)
}
return acc
}, [0, ''])
if (count) {
for (let i = 0; i < count; i++) {
result.push(value)
}
}
return result
}
if (node.type === 'space') {
return result
}
return result.concat(parser.stringify(node))
}, [])
return normalized
} | javascript | function normalizeRowColumn (str) {
let normalized = parser(str)
.nodes
.reduce((result, node) => {
if (node.type === 'function' && node.value === 'repeat') {
let key = 'count'
let [count, value] = node.nodes.reduce((acc, n) => {
if (n.type === 'word' && key === 'count') {
acc[0] = Math.abs(parseInt(n.value))
return acc
}
if (n.type === 'div' && n.value === ',') {
key = 'value'
return acc
}
if (key === 'value') {
acc[1] += parser.stringify(n)
}
return acc
}, [0, ''])
if (count) {
for (let i = 0; i < count; i++) {
result.push(value)
}
}
return result
}
if (node.type === 'space') {
return result
}
return result.concat(parser.stringify(node))
}, [])
return normalized
} | [
"function",
"normalizeRowColumn",
"(",
"str",
")",
"{",
"let",
"normalized",
"=",
"parser",
"(",
"str",
")",
".",
"nodes",
".",
"reduce",
"(",
"(",
"result",
",",
"node",
")",
"=>",
"{",
"if",
"(",
"node",
".",
"type",
"===",
"'function'",
"&&",
"nod... | normalize the grid-template-rows/columns values
@param {String} str grid-template-rows/columns value
@return {Array} normalized array with values
@example
let normalized = normalizeRowColumn('1fr repeat(2, 20px 50px) 1fr')
normalized // <= ['1fr', '20px', '50px', '20px', '50px', '1fr'] | [
"normalize",
"the",
"grid",
"-",
"template",
"-",
"rows",
"/",
"columns",
"values"
] | 24b28b6dbdc34a5e5800986e76f48cbaf9bbbc32 | https://github.com/postcss/autoprefixer/blob/24b28b6dbdc34a5e5800986e76f48cbaf9bbbc32/lib/hacks/grid-utils.js#L966-L1003 | train | normalize a row column | [
30522,
3853,
3671,
17629,
5004,
25778,
2819,
2078,
1006,
2358,
2099,
1007,
1063,
2292,
3671,
3550,
1027,
11968,
8043,
1006,
2358,
2099,
1007,
1012,
14164,
1012,
5547,
1006,
1006,
2765,
1010,
13045,
1007,
1027,
1028,
1063,
2065,
1006,
13045,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/MenuBar.js | function(oThis){
var iVisibleItems = getVisibleItemCount(oThis);
var _iVisibleItems = iVisibleItems;
var jAreaRef = oThis.$("area");
var jItems = jAreaRef.children();
var jOvrFlwRef = oThis.$("ovrflw");
var bUpdateFocus = false;
if (iVisibleItems < jItems.length - 1) {
jOvrFlwRef.attr("style", "display:block;");
if (!oThis.oOvrFlwMnu) {
oThis.oOvrFlwMnu = new Menu(oThis.getId() + "-ovrflwmnu");
oThis.oOvrFlwMnu.bUseTopStyle = oThis.getDesign() == MenuBarDesign.Header;
oThis.oOvrFlwMnu.attachItemSelect(function(oEvent){
var oItem = oEvent.getParameter("item");
if (!(oItem instanceof _DelegatorMenuItem)) {
var oItemRootMenu = Menu.prototype.getRootMenu.apply(oItem.getParent());
oItemRootMenu.fireItemSelect({item: oItem});
} else if (oItem.bNoSubMenu && oItem instanceof _DelegatorMenuItem) {
oItem.oAlterEgoItm.fireSelect({item: oItem.oAlterEgoItm});
}
});
}
oThis.oOvrFlwMnu.destroyItems();
var aItems = oThis.getItems();
for (var i = 0; i < aItems.length; i++) {
var oItem = aItems[i];
if (iVisibleItems != 0) {
if (oItem.getVisible()) {
iVisibleItems--;
}
if (iVisibleItems == 0) {
oThis.sLastVisibleItemId = oItem.getId();
}
} else {
oThis.oOvrFlwMnu.addItem(new _DelegatorMenuItem(oItem));
if (oItem.getId() == oThis.sCurrentFocusedItemRefId) {
bUpdateFocus = true;
}
}
}
if (sap.ui.getCore().getConfiguration().getAccessibility()) {
jItems.attr("aria-setsize", _iVisibleItems + 1);
jOvrFlwRef.attr("aria-posinset", _iVisibleItems + 1);
}
} else {
jOvrFlwRef.attr("style", "display:none;");
if (oThis.oOvrFlwMnu) {
oThis.oOvrFlwMnu.destroyItems();
}
oThis.sLastVisibleItemId = null;
if (sap.ui.getCore().getConfiguration().getAccessibility()) {
jItems.attr("aria-setsize", _iVisibleItems);
jOvrFlwRef.attr("aria-posinset", 0);
}
}
jAreaRef.scrollTop(0);
if (bUpdateFocus) {
oThis.sCurrentFocusedItemRefId = oThis.sLastVisibleItemId;
document.getElementById(oThis.sLastVisibleItemId).focus();
}
} | javascript | function(oThis){
var iVisibleItems = getVisibleItemCount(oThis);
var _iVisibleItems = iVisibleItems;
var jAreaRef = oThis.$("area");
var jItems = jAreaRef.children();
var jOvrFlwRef = oThis.$("ovrflw");
var bUpdateFocus = false;
if (iVisibleItems < jItems.length - 1) {
jOvrFlwRef.attr("style", "display:block;");
if (!oThis.oOvrFlwMnu) {
oThis.oOvrFlwMnu = new Menu(oThis.getId() + "-ovrflwmnu");
oThis.oOvrFlwMnu.bUseTopStyle = oThis.getDesign() == MenuBarDesign.Header;
oThis.oOvrFlwMnu.attachItemSelect(function(oEvent){
var oItem = oEvent.getParameter("item");
if (!(oItem instanceof _DelegatorMenuItem)) {
var oItemRootMenu = Menu.prototype.getRootMenu.apply(oItem.getParent());
oItemRootMenu.fireItemSelect({item: oItem});
} else if (oItem.bNoSubMenu && oItem instanceof _DelegatorMenuItem) {
oItem.oAlterEgoItm.fireSelect({item: oItem.oAlterEgoItm});
}
});
}
oThis.oOvrFlwMnu.destroyItems();
var aItems = oThis.getItems();
for (var i = 0; i < aItems.length; i++) {
var oItem = aItems[i];
if (iVisibleItems != 0) {
if (oItem.getVisible()) {
iVisibleItems--;
}
if (iVisibleItems == 0) {
oThis.sLastVisibleItemId = oItem.getId();
}
} else {
oThis.oOvrFlwMnu.addItem(new _DelegatorMenuItem(oItem));
if (oItem.getId() == oThis.sCurrentFocusedItemRefId) {
bUpdateFocus = true;
}
}
}
if (sap.ui.getCore().getConfiguration().getAccessibility()) {
jItems.attr("aria-setsize", _iVisibleItems + 1);
jOvrFlwRef.attr("aria-posinset", _iVisibleItems + 1);
}
} else {
jOvrFlwRef.attr("style", "display:none;");
if (oThis.oOvrFlwMnu) {
oThis.oOvrFlwMnu.destroyItems();
}
oThis.sLastVisibleItemId = null;
if (sap.ui.getCore().getConfiguration().getAccessibility()) {
jItems.attr("aria-setsize", _iVisibleItems);
jOvrFlwRef.attr("aria-posinset", 0);
}
}
jAreaRef.scrollTop(0);
if (bUpdateFocus) {
oThis.sCurrentFocusedItemRefId = oThis.sLastVisibleItemId;
document.getElementById(oThis.sLastVisibleItemId).focus();
}
} | [
"function",
"(",
"oThis",
")",
"{",
"var",
"iVisibleItems",
"=",
"getVisibleItemCount",
"(",
"oThis",
")",
";",
"var",
"_iVisibleItems",
"=",
"iVisibleItems",
";",
"var",
"jAreaRef",
"=",
"oThis",
".",
"$",
"(",
"\"area\"",
")",
";",
"var",
"jItems",
"=",
... | Handle the resize of the menubar | [
"Handle",
"the",
"resize",
"of",
"the",
"menubar"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.commons/src/sap/ui/commons/MenuBar.js#L482-L547 | train | Creates the menu for the given item | [
30522,
3853,
1006,
27178,
24158,
1007,
1063,
13075,
4921,
17417,
3468,
4221,
5244,
1027,
2131,
11365,
7028,
4221,
12458,
21723,
1006,
27178,
24158,
1007,
1025,
13075,
1035,
4921,
17417,
3468,
4221,
5244,
1027,
4921,
17417,
3468,
4221,
5244,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | src/sap.ui.commons/src/sap/ui/commons/layout/PositionContainer.js | function(oThis) {
var oControl = oThis.getControl();
if (oControl) {
PositionContainer.cleanUpControl(oControl);
oControl.detachEvent("_change", onPropertyChanges, oThis);
}
} | javascript | function(oThis) {
var oControl = oThis.getControl();
if (oControl) {
PositionContainer.cleanUpControl(oControl);
oControl.detachEvent("_change", onPropertyChanges, oThis);
}
} | [
"function",
"(",
"oThis",
")",
"{",
"var",
"oControl",
"=",
"oThis",
".",
"getControl",
"(",
")",
";",
"if",
"(",
"oControl",
")",
"{",
"PositionContainer",
".",
"cleanUpControl",
"(",
"oControl",
")",
";",
"oControl",
".",
"detachEvent",
"(",
"\"_change\"... | @see sap.ui.commons.layout.AbsoluteLayout#cleanUpControl
@private | [
"@see",
"sap",
".",
"ui",
".",
"commons",
".",
"layout",
".",
"AbsoluteLayout#cleanUpControl"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.commons/src/sap/ui/commons/layout/PositionContainer.js#L362-L368 | train | Removes the control from the control container and removes the event listeners | [
30522,
3853,
1006,
27178,
24158,
1007,
1063,
13075,
1051,
8663,
13181,
2140,
1027,
27178,
24158,
1012,
2131,
8663,
13181,
2140,
1006,
1007,
1025,
2065,
1006,
1051,
8663,
13181,
2140,
1007,
1063,
2597,
8663,
18249,
2121,
1012,
27686,
8663,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
angular/material | src/core/services/aria/aria.js | expect | function expect(element, attrName, defaultValue) {
var node = angular.element(element)[0] || element;
// if node exists and neither it nor its children have the attribute
if (node &&
((!node.hasAttribute(attrName) ||
node.getAttribute(attrName).length === 0) &&
!childHasAttribute(node, attrName))) {
defaultValue = angular.isString(defaultValue) ? defaultValue.trim() : '';
if (defaultValue.length) {
element.attr(attrName, defaultValue);
} else if (showWarnings) {
$log.warn('ARIA: Attribute "', attrName, '", required for accessibility, is missing on node:', node);
}
}
} | javascript | function expect(element, attrName, defaultValue) {
var node = angular.element(element)[0] || element;
// if node exists and neither it nor its children have the attribute
if (node &&
((!node.hasAttribute(attrName) ||
node.getAttribute(attrName).length === 0) &&
!childHasAttribute(node, attrName))) {
defaultValue = angular.isString(defaultValue) ? defaultValue.trim() : '';
if (defaultValue.length) {
element.attr(attrName, defaultValue);
} else if (showWarnings) {
$log.warn('ARIA: Attribute "', attrName, '", required for accessibility, is missing on node:', node);
}
}
} | [
"function",
"expect",
"(",
"element",
",",
"attrName",
",",
"defaultValue",
")",
"{",
"var",
"node",
"=",
"angular",
".",
"element",
"(",
"element",
")",
"[",
"0",
"]",
"||",
"element",
";",
"// if node exists and neither it nor its children have the attribute",
"... | Check if expected attribute has been specified on the target element or child
@param element
@param attrName
@param {optional} defaultValue What to set the attr to if no value is found | [
"Check",
"if",
"expected",
"attribute",
"has",
"been",
"specified",
"on",
"the",
"target",
"element",
"or",
"child"
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/services/aria/aria.js#L80-L98 | train | expects an attribute to be present on the element | [
30522,
3853,
5987,
1006,
5783,
1010,
2012,
16344,
18442,
1010,
12398,
10175,
5657,
1007,
1063,
13075,
13045,
1027,
16108,
1012,
5783,
1006,
5783,
1007,
1031,
1014,
1033,
1064,
1064,
5783,
1025,
1013,
1013,
2065,
13045,
6526,
1998,
4445,
200... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
facebook/relay | packages/relay-runtime/store/RelayModernSelector.js | getPluralSelector | function getPluralSelector(
operationVariables: Variables,
fragment: ReaderFragment,
items: Array<mixed>,
owners?: Array<?OperationDescriptor>,
): ?Array<OwnedReaderSelector> {
let selectors = null;
if (__DEV__) {
if (owners != null) {
warning(
items.length === owners.length,
'RelayModernSelector: Expected number of plural values for fragment ' +
'`%s` to match number of owners. Received %s values and %s owners.',
fragment.name,
items.length,
owners.length,
);
}
}
items.forEach((item, ii) => {
const owner = owners != null ? owners[ii] : null;
const selector =
item != null
? getSingularSelector(operationVariables, fragment, item, owner)
: null;
if (selector != null) {
selectors = selectors || [];
selectors.push(selector);
}
});
return selectors;
} | javascript | function getPluralSelector(
operationVariables: Variables,
fragment: ReaderFragment,
items: Array<mixed>,
owners?: Array<?OperationDescriptor>,
): ?Array<OwnedReaderSelector> {
let selectors = null;
if (__DEV__) {
if (owners != null) {
warning(
items.length === owners.length,
'RelayModernSelector: Expected number of plural values for fragment ' +
'`%s` to match number of owners. Received %s values and %s owners.',
fragment.name,
items.length,
owners.length,
);
}
}
items.forEach((item, ii) => {
const owner = owners != null ? owners[ii] : null;
const selector =
item != null
? getSingularSelector(operationVariables, fragment, item, owner)
: null;
if (selector != null) {
selectors = selectors || [];
selectors.push(selector);
}
});
return selectors;
} | [
"function",
"getPluralSelector",
"(",
"operationVariables",
":",
"Variables",
",",
"fragment",
":",
"ReaderFragment",
",",
"items",
":",
"Array",
"<",
"mixed",
">",
",",
"owners",
"?",
":",
"Array",
"<",
"?",
"OperationDescriptor",
">",
",",
")",
":",
"?",
... | @public
Given the result `items` from a parent that fetched `fragment`, creates a
selector that can be used to read the results of that fragment on those
items. This is similar to `getSingularSelector` but for "plural" fragments that
expect an array of results and therefore return an array of selectors. | [
"@public"
] | 7fb9be5182b9650637d7b92ead9a42713ac30aa4 | https://github.com/facebook/relay/blob/7fb9be5182b9650637d7b92ead9a42713ac30aa4/packages/relay-runtime/store/RelayModernSelector.js#L159-L191 | train | Returns a selector for the given items and owners. | [
30522,
3853,
2131,
24759,
11137,
11246,
22471,
2953,
1006,
3169,
10755,
19210,
2015,
1024,
10857,
1010,
30524,
1028,
1010,
1007,
1024,
1029,
9140,
1026,
3079,
16416,
13375,
12260,
16761,
1028,
1063,
2292,
27000,
2015,
1027,
19701,
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... |
openlayers/openlayers | examples/raster.js | function(pixels, data) {
const pixel = pixels[0];
const value = vgi(pixel);
summarize(value, data.counts);
if (value >= data.threshold) {
pixel[0] = 0;
pixel[1] = 255;
pixel[2] = 0;
pixel[3] = 128;
} else {
pixel[3] = 0;
}
return pixel;
} | javascript | function(pixels, data) {
const pixel = pixels[0];
const value = vgi(pixel);
summarize(value, data.counts);
if (value >= data.threshold) {
pixel[0] = 0;
pixel[1] = 255;
pixel[2] = 0;
pixel[3] = 128;
} else {
pixel[3] = 0;
}
return pixel;
} | [
"function",
"(",
"pixels",
",",
"data",
")",
"{",
"const",
"pixel",
"=",
"pixels",
"[",
"0",
"]",
";",
"const",
"value",
"=",
"vgi",
"(",
"pixel",
")",
";",
"summarize",
"(",
"value",
",",
"data",
".",
"counts",
")",
";",
"if",
"(",
"value",
">="... | Run calculations on pixel data.
@param {Array} pixels List of pixels (one per source).
@param {Object} data User data object.
@return {Array} The output pixel. | [
"Run",
"calculations",
"on",
"pixel",
"data",
"."
] | f366eaea522388fb575b11010e69d309164baca7 | https://github.com/openlayers/openlayers/blob/f366eaea522388fb575b11010e69d309164baca7/examples/raster.js#L67-L80 | train | Compute the maximum value of a pixel | [
30522,
3853,
1006,
27725,
1010,
2951,
1007,
1063,
9530,
3367,
22138,
1027,
27725,
1031,
1014,
1033,
1025,
9530,
3367,
3643,
1027,
1058,
5856,
1006,
22138,
1007,
1025,
7680,
7849,
4697,
1006,
3643,
1010,
2951,
1012,
9294,
1007,
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... | |
nhn/tui.editor | src/js/extensions/table/tableDataHandler.js | createRenderData | function createRenderData(tableData, cellIndexData) {
const headerAligns = _getHeaderAligns(tableData);
const renderData = cellIndexData.map(row => row.map(({rowIndex, colIndex}) => (util.extend({
align: headerAligns[colIndex]
}, tableData[rowIndex][colIndex]))));
if (tableData.className) {
renderData.className = tableData.className;
}
return renderData;
} | javascript | function createRenderData(tableData, cellIndexData) {
const headerAligns = _getHeaderAligns(tableData);
const renderData = cellIndexData.map(row => row.map(({rowIndex, colIndex}) => (util.extend({
align: headerAligns[colIndex]
}, tableData[rowIndex][colIndex]))));
if (tableData.className) {
renderData.className = tableData.className;
}
return renderData;
} | [
"function",
"createRenderData",
"(",
"tableData",
",",
"cellIndexData",
")",
"{",
"const",
"headerAligns",
"=",
"_getHeaderAligns",
"(",
"tableData",
")",
";",
"const",
"renderData",
"=",
"cellIndexData",
".",
"map",
"(",
"row",
"=>",
"row",
".",
"map",
"(",
... | Create render data.
@param {Array.<object>} tableData - table data
@param {Array.<object>} cellIndexData - cell index data
@returns {Array.<Array.<object>>}
@ignore | [
"Create",
"render",
"data",
"."
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/extensions/table/tableDataHandler.js#L193-L204 | train | Create renderData object | [
30522,
3853,
3443,
7389,
4063,
2850,
2696,
1006,
2795,
2850,
2696,
1010,
3526,
22254,
10288,
2850,
2696,
1007,
1063,
9530,
3367,
20346,
11475,
16206,
2015,
1027,
1035,
2131,
4974,
21673,
23773,
2015,
1006,
2795,
2850,
2696,
1007,
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... |
GitbookIO/gitbook | lib/output/helper/resolveFileToURL.js | resolveFileToURL | function resolveFileToURL(output, filePath) {
// Convert /test.png -> test.png
filePath = LocationUtils.toAbsolute(filePath, '', '');
var page = output.getPage(filePath);
// if file is a page, return correct .html url
if (page) {
filePath = fileToURL(output, filePath);
}
return LocationUtils.normalize(filePath);
} | javascript | function resolveFileToURL(output, filePath) {
// Convert /test.png -> test.png
filePath = LocationUtils.toAbsolute(filePath, '', '');
var page = output.getPage(filePath);
// if file is a page, return correct .html url
if (page) {
filePath = fileToURL(output, filePath);
}
return LocationUtils.normalize(filePath);
} | [
"function",
"resolveFileToURL",
"(",
"output",
",",
"filePath",
")",
"{",
"// Convert /test.png -> test.png",
"filePath",
"=",
"LocationUtils",
".",
"toAbsolute",
"(",
"filePath",
",",
"''",
",",
"''",
")",
";",
"var",
"page",
"=",
"output",
".",
"getPage",
"(... | Resolve an absolute path (extracted from a link)
@param {Output} output
@param {String} filePath
@return {String} | [
"Resolve",
"an",
"absolute",
"path",
"(",
"extracted",
"from",
"a",
"link",
")"
] | 6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4 | https://github.com/GitbookIO/gitbook/blob/6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4/lib/output/helper/resolveFileToURL.js#L12-L24 | train | Resolve file path to URL | [
30522,
3853,
10663,
8873,
7485,
8162,
2140,
1006,
6434,
1010,
5371,
15069,
1007,
1063,
1013,
1013,
10463,
1013,
3231,
1012,
1052,
3070,
1011,
1028,
3231,
1012,
1052,
3070,
5371,
15069,
1027,
3295,
21823,
30524,
1007,
1063,
5371,
15069,
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/extensions/samples/BracketsConfigCentral/main.js | ConfigView | function ConfigView(doc, $container) {
this.$container = $container;
this.doc = doc;
this.json = JSON.parse(this.doc.getText());
this.$view = $(Mustache.render(ConfigViewContent, this.json));
this.$view.css({
"background-image": "url(file://" + FileUtils.getNativeModuleDirectoryPath(_module) + "/htmlContent/logo-sm.png)",
"background-position": "bottom right",
"background-repeat": "no-repeat"
});
$container.append(this.$view);
} | javascript | function ConfigView(doc, $container) {
this.$container = $container;
this.doc = doc;
this.json = JSON.parse(this.doc.getText());
this.$view = $(Mustache.render(ConfigViewContent, this.json));
this.$view.css({
"background-image": "url(file://" + FileUtils.getNativeModuleDirectoryPath(_module) + "/htmlContent/logo-sm.png)",
"background-position": "bottom right",
"background-repeat": "no-repeat"
});
$container.append(this.$view);
} | [
"function",
"ConfigView",
"(",
"doc",
",",
"$container",
")",
"{",
"this",
".",
"$container",
"=",
"$container",
";",
"this",
".",
"doc",
"=",
"doc",
";",
"this",
".",
"json",
"=",
"JSON",
".",
"parse",
"(",
"this",
".",
"doc",
".",
"getText",
"(",
... | /* @type {Object.<string, ConfigView>} List of open views | [
"/",
"*"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/samples/BracketsConfigCentral/main.js#L39-L50 | train | A view for the config | [
30522,
3853,
9530,
8873,
2290,
8584,
1006,
9986,
1010,
1002,
11661,
1007,
1063,
2023,
1012,
1002,
11661,
1027,
1002,
11661,
1025,
2023,
1012,
9986,
1027,
9986,
1025,
2023,
1012,
1046,
3385,
1027,
1046,
3385,
1012,
11968,
3366,
1006,
2023,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
aframevr/aframe | src/systems/material.js | calculateVideoCacheHash | function calculateVideoCacheHash (data, videoEl) {
var i;
var id = videoEl.getAttribute('id');
var hash;
var videoAttributes;
if (id) { return id; }
// Calculate hash using sorted video attributes.
hash = '';
videoAttributes = data || {};
for (i = 0; i < videoEl.attributes.length; i++) {
videoAttributes[videoEl.attributes[i].name] = videoEl.attributes[i].value;
}
Object.keys(videoAttributes).sort().forEach(function (name) {
hash += name + ':' + videoAttributes[name] + ';';
});
return hash;
} | javascript | function calculateVideoCacheHash (data, videoEl) {
var i;
var id = videoEl.getAttribute('id');
var hash;
var videoAttributes;
if (id) { return id; }
// Calculate hash using sorted video attributes.
hash = '';
videoAttributes = data || {};
for (i = 0; i < videoEl.attributes.length; i++) {
videoAttributes[videoEl.attributes[i].name] = videoEl.attributes[i].value;
}
Object.keys(videoAttributes).sort().forEach(function (name) {
hash += name + ':' + videoAttributes[name] + ';';
});
return hash;
} | [
"function",
"calculateVideoCacheHash",
"(",
"data",
",",
"videoEl",
")",
"{",
"var",
"i",
";",
"var",
"id",
"=",
"videoEl",
".",
"getAttribute",
"(",
"'id'",
")",
";",
"var",
"hash",
";",
"var",
"videoAttributes",
";",
"if",
"(",
"id",
")",
"{",
"retur... | Calculates consistent hash from a video element using its attributes.
If the video element has an ID, use that.
Else build a hash that looks like `src:myvideo.mp4;height:200;width:400;`.
@param data {object} - Texture data such as repeat.
@param videoEl {Element} - Video element.
@returns {string} | [
"Calculates",
"consistent",
"hash",
"from",
"a",
"video",
"element",
"using",
"its",
"attributes",
".",
"If",
"the",
"video",
"element",
"has",
"an",
"ID",
"use",
"that",
".",
"Else",
"build",
"a",
"hash",
"that",
"looks",
"like",
"src",
":",
"myvideo",
... | 24acc78a7299a4cdfe3ef617f4d40ddf6275c992 | https://github.com/aframevr/aframe/blob/24acc78a7299a4cdfe3ef617f4d40ddf6275c992/src/systems/material.js#L259-L278 | train | Calculate hash of video element | [
30522,
3853,
18422,
17258,
8780,
3540,
5403,
14949,
2232,
1006,
2951,
1010,
2678,
2884,
1007,
1063,
13075,
1045,
1025,
13075,
8909,
1027,
2678,
2884,
1012,
2131,
19321,
3089,
8569,
2618,
1006,
1005,
8909,
1005,
1007,
1025,
13075,
23325,
102... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.