repo stringclasses 195 values | path stringlengths 4 99 | func_name stringlengths 0 41 | original_string stringlengths 72 56.1k | language stringclasses 1 value | code stringlengths 72 56.1k | code_tokens listlengths 25 8.12k | docstring stringlengths 2 12.5k | docstring_tokens listlengths 1 449 | sha stringclasses 197 values | url stringlengths 88 186 | partition stringclasses 1 value | summary stringlengths 8 338 | input_ids listlengths 502 502 | token_type_ids listlengths 502 502 | attention_mask listlengths 502 502 | labels listlengths 502 502 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
jantimon/html-webpack-plugin | lib/compiler.js | addTemplateToCompiler | function addTemplateToCompiler (mainCompiler, templatePath) {
const childCompiler = getChildCompiler(mainCompiler);
const isNew = childCompiler.addTemplate(templatePath);
if (isNew) {
clearCache(mainCompiler);
}
} | javascript | function addTemplateToCompiler (mainCompiler, templatePath) {
const childCompiler = getChildCompiler(mainCompiler);
const isNew = childCompiler.addTemplate(templatePath);
if (isNew) {
clearCache(mainCompiler);
}
} | [
"function",
"addTemplateToCompiler",
"(",
"mainCompiler",
",",
"templatePath",
")",
"{",
"const",
"childCompiler",
"=",
"getChildCompiler",
"(",
"mainCompiler",
")",
";",
"const",
"isNew",
"=",
"childCompiler",
".",
"addTemplate",
"(",
"templatePath",
")",
";",
"i... | Register a template for the current main compiler
@param {WebpackCompiler} mainCompiler
@param {string} templatePath | [
"Register",
"a",
"template",
"for",
"the",
"current",
"main",
"compiler"
] | 38db64ae8805de37d038e0ee0f6dfa2a26e2163a | https://github.com/jantimon/html-webpack-plugin/blob/38db64ae8805de37d038e0ee0f6dfa2a26e2163a/lib/compiler.js#L239-L245 | train | Add a template to the compiler | [
30522,
3853,
5587,
18532,
15725,
3406,
9006,
22090,
2099,
1006,
2364,
9006,
22090,
2099,
1010,
23561,
15069,
1007,
1063,
9530,
3367,
2775,
9006,
22090,
2099,
1027,
2131,
19339,
9006,
22090,
2099,
1006,
2364,
9006,
22090,
2099,
1007,
1025,
9... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/project/FileTreeView.js | function (prevProps, prevState) {
var wasSelected = prevProps.entry.get("selected"),
isSelected = this.props.entry.get("selected");
if (isSelected && !wasSelected) {
// TODO: This shouldn't really know about project-files-container
// directly. It is probably the case that our Preact tree should actually
// start with project-files-container instead of just the interior of
// project-files-container and then the file tree will be one self-contained
// functional unit.
ViewUtils.scrollElementIntoView($("#project-files-container"), $(Preact.findDOMNode(this)), true);
} else if (!isSelected && wasSelected && this.state.clickTimer !== null) {
this.clearTimer();
}
} | javascript | function (prevProps, prevState) {
var wasSelected = prevProps.entry.get("selected"),
isSelected = this.props.entry.get("selected");
if (isSelected && !wasSelected) {
// TODO: This shouldn't really know about project-files-container
// directly. It is probably the case that our Preact tree should actually
// start with project-files-container instead of just the interior of
// project-files-container and then the file tree will be one self-contained
// functional unit.
ViewUtils.scrollElementIntoView($("#project-files-container"), $(Preact.findDOMNode(this)), true);
} else if (!isSelected && wasSelected && this.state.clickTimer !== null) {
this.clearTimer();
}
} | [
"function",
"(",
"prevProps",
",",
"prevState",
")",
"{",
"var",
"wasSelected",
"=",
"prevProps",
".",
"entry",
".",
"get",
"(",
"\"selected\"",
")",
",",
"isSelected",
"=",
"this",
".",
"props",
".",
"entry",
".",
"get",
"(",
"\"selected\"",
")",
";",
... | If this node is newly selected, scroll it into view. Also, move the selection or
context boxes as appropriate. | [
"If",
"this",
"node",
"is",
"newly",
"selected",
"scroll",
"it",
"into",
"view",
".",
"Also",
"move",
"the",
"selection",
"or",
"context",
"boxes",
"as",
"appropriate",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/project/FileTreeView.js#L502-L516 | train | On entry change update the project - files - container | [
30522,
3853,
1006,
3653,
2615,
21572,
4523,
1010,
3653,
15088,
12259,
1007,
1063,
13075,
2001,
11246,
22471,
2098,
1027,
3653,
2615,
21572,
4523,
1012,
4443,
1012,
2131,
1006,
1000,
3479,
1000,
1007,
1010,
26354,
12260,
10985,
1027,
2023,
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 | bits/73_wbbin.js | write_wb_bin | function write_wb_bin(wb, opts) {
var ba = buf_array();
write_record(ba, "BrtBeginBook");
write_record(ba, "BrtFileVersion", write_BrtFileVersion());
/* [[BrtFileSharingIso] BrtFileSharing] */
write_record(ba, "BrtWbProp", write_BrtWbProp(wb.Workbook && wb.Workbook.WBProps || null));
/* [ACABSPATH] */
/* [[BrtBookProtectionIso] BrtBookProtection] */
write_BOOKVIEWS(ba, wb, opts);
write_BUNDLESHS(ba, wb, opts);
/* [FNGROUP] */
/* [EXTERNALS] */
/* *BrtName */
/* write_record(ba, "BrtCalcProp", write_BrtCalcProp()); */
/* [BrtOleSize] */
/* *(BrtUserBookView *FRT) */
/* [PIVOTCACHEIDS] */
/* [BrtWbFactoid] */
/* [SMARTTAGTYPES] */
/* [BrtWebOpt] */
/* write_record(ba, "BrtFileRecover", write_BrtFileRecover()); */
/* [WEBPUBITEMS] */
/* [CRERRS] */
/* FRTWORKBOOK */
write_record(ba, "BrtEndBook");
return ba.end();
} | javascript | function write_wb_bin(wb, opts) {
var ba = buf_array();
write_record(ba, "BrtBeginBook");
write_record(ba, "BrtFileVersion", write_BrtFileVersion());
/* [[BrtFileSharingIso] BrtFileSharing] */
write_record(ba, "BrtWbProp", write_BrtWbProp(wb.Workbook && wb.Workbook.WBProps || null));
/* [ACABSPATH] */
/* [[BrtBookProtectionIso] BrtBookProtection] */
write_BOOKVIEWS(ba, wb, opts);
write_BUNDLESHS(ba, wb, opts);
/* [FNGROUP] */
/* [EXTERNALS] */
/* *BrtName */
/* write_record(ba, "BrtCalcProp", write_BrtCalcProp()); */
/* [BrtOleSize] */
/* *(BrtUserBookView *FRT) */
/* [PIVOTCACHEIDS] */
/* [BrtWbFactoid] */
/* [SMARTTAGTYPES] */
/* [BrtWebOpt] */
/* write_record(ba, "BrtFileRecover", write_BrtFileRecover()); */
/* [WEBPUBITEMS] */
/* [CRERRS] */
/* FRTWORKBOOK */
write_record(ba, "BrtEndBook");
return ba.end();
} | [
"function",
"write_wb_bin",
"(",
"wb",
",",
"opts",
")",
"{",
"var",
"ba",
"=",
"buf_array",
"(",
")",
";",
"write_record",
"(",
"ba",
",",
"\"BrtBeginBook\"",
")",
";",
"write_record",
"(",
"ba",
",",
"\"BrtFileVersion\"",
",",
"write_BrtFileVersion",
"(",
... | /* [MS-XLSB] 2.4.646 BrtFileRecover /*function write_BrtFileRecover(data, o) {
if(!o) o = new_buf(1);
o.write_shift(1,0);
return o;
} /* [MS-XLSB] 2.1.7.61 Workbook | [
"/",
"*",
"[",
"MS",
"-",
"XLSB",
"]",
"2",
".",
"4",
".",
"646",
"BrtFileRecover",
"/",
"*",
"function",
"write_BrtFileRecover",
"(",
"data",
"o",
")",
"{",
"if",
"(",
"!o",
")",
"o",
"=",
"new_buf",
"(",
"1",
")",
";",
"o",
".",
"write_shift",
... | 9a6d8a1d3d80c78dad5201fb389316f935279cdc | https://github.com/SheetJS/js-xlsx/blob/9a6d8a1d3d80c78dad5201fb389316f935279cdc/bits/73_wbbin.js#L265-L292 | train | Writes the contents of a workbook to a buffer. | [
30522,
3853,
4339,
1035,
25610,
1035,
8026,
1006,
25610,
1010,
23569,
2015,
1007,
1063,
13075,
8670,
1027,
20934,
2546,
1035,
9140,
1006,
1007,
1025,
4339,
1035,
2501,
1006,
8670,
1010,
1000,
7987,
2102,
4783,
11528,
8654,
1000,
1007,
1025,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/utils/ExtensionUtils.js | isAbsolutePathOrUrl | function isAbsolutePathOrUrl(pathOrUrl) {
return brackets.platform === "win" ? PathUtils.isAbsoluteUrl(pathOrUrl) : FileSystem.isAbsolutePath(pathOrUrl);
} | javascript | function isAbsolutePathOrUrl(pathOrUrl) {
return brackets.platform === "win" ? PathUtils.isAbsoluteUrl(pathOrUrl) : FileSystem.isAbsolutePath(pathOrUrl);
} | [
"function",
"isAbsolutePathOrUrl",
"(",
"pathOrUrl",
")",
"{",
"return",
"brackets",
".",
"platform",
"===",
"\"win\"",
"?",
"PathUtils",
".",
"isAbsoluteUrl",
"(",
"pathOrUrl",
")",
":",
"FileSystem",
".",
"isAbsolutePath",
"(",
"pathOrUrl",
")",
";",
"}"
] | getModuleUrl returns different urls for win platform
so that's why we need a different check here
@see #getModuleUrl
@param {!string} pathOrUrl that should be checked if it's absolute
@return {!boolean} returns true if pathOrUrl is absolute url on win platform
or when it's absolute path on other platforms | [
"getModuleUrl",
"returns",
"different",
"urls",
"for",
"win",
"platform",
"so",
"that",
"s",
"why",
"we",
"need",
"a",
"different",
"check",
"here"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/utils/ExtensionUtils.js#L81-L83 | train | Check if the given path or url is absolute | [
30522,
3853,
18061,
5910,
4747,
10421,
15069,
2953,
3126,
2140,
1006,
4130,
2953,
3126,
2140,
1007,
1063,
2709,
19719,
1012,
4132,
1027,
1027,
1027,
1000,
2663,
1000,
1029,
4130,
21823,
4877,
1012,
18061,
5910,
4747,
10421,
3126,
2140,
1006... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/core/routing/TargetCache.js | function (oOptions, sType, bGlobalId, oInfo) {
var oObject;
switch (sType) {
case "View":
oObject = this._getView(oOptions, bGlobalId);
break;
case "Component":
oObject = this._getComponent(oOptions, bGlobalId, oInfo);
break;
default:
throw Error("The given sType: " + sType + " isn't supported by TargetCache.getObject");
}
return oObject;
} | javascript | function (oOptions, sType, bGlobalId, oInfo) {
var oObject;
switch (sType) {
case "View":
oObject = this._getView(oOptions, bGlobalId);
break;
case "Component":
oObject = this._getComponent(oOptions, bGlobalId, oInfo);
break;
default:
throw Error("The given sType: " + sType + " isn't supported by TargetCache.getObject");
}
return oObject;
} | [
"function",
"(",
"oOptions",
",",
"sType",
",",
"bGlobalId",
",",
"oInfo",
")",
"{",
"var",
"oObject",
";",
"switch",
"(",
"sType",
")",
"{",
"case",
"\"View\"",
":",
"oObject",
"=",
"this",
".",
"_getView",
"(",
"oOptions",
",",
"bGlobalId",
")",
";",... | /*
Privates | [
"/",
"*",
"Privates"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/routing/TargetCache.js#L248-L261 | train | Returns the object associated with the given type | [
30522,
3853,
1006,
1051,
7361,
9285,
1010,
2358,
18863,
1010,
1038,
23296,
16429,
11475,
2094,
1010,
1051,
2378,
14876,
1007,
1063,
13075,
1051,
16429,
20614,
1025,
6942,
1006,
2358,
18863,
1007,
1063,
2553,
1000,
3193,
1000,
1024,
1051,
16... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
Dogfalo/materialize | dist/js/materialize.js | Chips | function Chips(el, options) {
_classCallCheck(this, Chips);
var _this45 = _possibleConstructorReturn(this, (Chips.__proto__ || Object.getPrototypeOf(Chips)).call(this, Chips, el, options));
_this45.el.M_Chips = _this45;
/**
* Options for the modal
* @member Chips#options
* @prop {Array} data
* @prop {String} placeholder
* @prop {String} secondaryPlaceholder
* @prop {Object} autocompleteOptions
*/
_this45.options = $.extend({}, Chips.defaults, options);
_this45.$el.addClass('chips input-field');
_this45.chipsData = [];
_this45.$chips = $();
_this45._setupInput();
_this45.hasAutocomplete = Object.keys(_this45.options.autocompleteOptions).length > 0;
// Set input id
if (!_this45.$input.attr('id')) {
_this45.$input.attr('id', M.guid());
}
// Render initial chips
if (_this45.options.data.length) {
_this45.chipsData = _this45.options.data;
_this45._renderChips(_this45.chipsData);
}
// Setup autocomplete if needed
if (_this45.hasAutocomplete) {
_this45._setupAutocomplete();
}
_this45._setPlaceholder();
_this45._setupLabel();
_this45._setupEventHandlers();
return _this45;
} | javascript | function Chips(el, options) {
_classCallCheck(this, Chips);
var _this45 = _possibleConstructorReturn(this, (Chips.__proto__ || Object.getPrototypeOf(Chips)).call(this, Chips, el, options));
_this45.el.M_Chips = _this45;
/**
* Options for the modal
* @member Chips#options
* @prop {Array} data
* @prop {String} placeholder
* @prop {String} secondaryPlaceholder
* @prop {Object} autocompleteOptions
*/
_this45.options = $.extend({}, Chips.defaults, options);
_this45.$el.addClass('chips input-field');
_this45.chipsData = [];
_this45.$chips = $();
_this45._setupInput();
_this45.hasAutocomplete = Object.keys(_this45.options.autocompleteOptions).length > 0;
// Set input id
if (!_this45.$input.attr('id')) {
_this45.$input.attr('id', M.guid());
}
// Render initial chips
if (_this45.options.data.length) {
_this45.chipsData = _this45.options.data;
_this45._renderChips(_this45.chipsData);
}
// Setup autocomplete if needed
if (_this45.hasAutocomplete) {
_this45._setupAutocomplete();
}
_this45._setPlaceholder();
_this45._setupLabel();
_this45._setupEventHandlers();
return _this45;
} | [
"function",
"Chips",
"(",
"el",
",",
"options",
")",
"{",
"_classCallCheck",
"(",
"this",
",",
"Chips",
")",
";",
"var",
"_this45",
"=",
"_possibleConstructorReturn",
"(",
"this",
",",
"(",
"Chips",
".",
"__proto__",
"||",
"Object",
".",
"getPrototypeOf",
... | Construct Chips instance and set up overlay
@constructor
@param {Element} el
@param {Object} options | [
"Construct",
"Chips",
"instance",
"and",
"set",
"up",
"overlay"
] | 1122efadad8f1433d404696f7613e3cc13fb83a4 | https://github.com/Dogfalo/materialize/blob/1122efadad8f1433d404696f7613e3cc13fb83a4/dist/js/materialize.js#L7641-L7684 | train | Construct Chips instance | [
30522,
3853,
11772,
1006,
3449,
1010,
7047,
1007,
1063,
1035,
2465,
9289,
29358,
11012,
1006,
2023,
1010,
11772,
1007,
1025,
13075,
1035,
2023,
19961,
1027,
1035,
2825,
8663,
3367,
6820,
16761,
13465,
14287,
1006,
2023,
1010,
1006,
11772,
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... |
heyui/heyui | src/plugins/popper/index.js | findIndex | function findIndex(arr, prop, value) {
// use native findIndex if supported
if (Array.prototype.findIndex) {
return arr.findIndex(function (cur) {
return cur[prop] === value;
});
}
// use `find` + `indexOf` if `findIndex` isn't supported
var match = find(arr, function (obj) {
return obj[prop] === value;
});
return arr.indexOf(match);
} | javascript | function findIndex(arr, prop, value) {
// use native findIndex if supported
if (Array.prototype.findIndex) {
return arr.findIndex(function (cur) {
return cur[prop] === value;
});
}
// use `find` + `indexOf` if `findIndex` isn't supported
var match = find(arr, function (obj) {
return obj[prop] === value;
});
return arr.indexOf(match);
} | [
"function",
"findIndex",
"(",
"arr",
",",
"prop",
",",
"value",
")",
"{",
"// use native findIndex if supported",
"if",
"(",
"Array",
".",
"prototype",
".",
"findIndex",
")",
"{",
"return",
"arr",
".",
"findIndex",
"(",
"function",
"(",
"cur",
")",
"{",
"r... | Return the index of the matching object
@method
@memberof Popper.Utils
@argument {Array} arr
@argument prop
@argument value
@returns index or -1 | [
"Return",
"the",
"index",
"of",
"the",
"matching",
"object"
] | d5405d27d994151b676eb91c12b389316d7f6679 | https://github.com/heyui/heyui/blob/d5405d27d994151b676eb91c12b389316d7f6679/src/plugins/popper/index.js#L857-L870 | train | Find index of property in array | [
30522,
3853,
2424,
22254,
10288,
1006,
12098,
2099,
1010,
17678,
1010,
3643,
1007,
1063,
1013,
1013,
2224,
3128,
2424,
22254,
10288,
2065,
3569,
2065,
1006,
9140,
1012,
8773,
1012,
2424,
22254,
10288,
1007,
1063,
2709,
12098,
2099,
1012,
24... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
wuchangming/spy-debugger | buildin_modules/weinre/web/client/ProfileDataGridTree.js | function()
{
if (!this._savedChildren)
return;
this.selfTime = this._savedSelfTime;
this.totalTime = this._savedTotalTime;
this.numberOfCalls = this._savedNumberOfCalls;
this.removeChildren();
var children = this._savedChildren;
var count = children.length;
for (var index = 0; index < count; ++index) {
children[index]._restore();
this.appendChild(children[index]);
}
} | javascript | function()
{
if (!this._savedChildren)
return;
this.selfTime = this._savedSelfTime;
this.totalTime = this._savedTotalTime;
this.numberOfCalls = this._savedNumberOfCalls;
this.removeChildren();
var children = this._savedChildren;
var count = children.length;
for (var index = 0; index < count; ++index) {
children[index]._restore();
this.appendChild(children[index]);
}
} | [
"function",
"(",
")",
"{",
"if",
"(",
"!",
"this",
".",
"_savedChildren",
")",
"return",
";",
"this",
".",
"selfTime",
"=",
"this",
".",
"_savedSelfTime",
";",
"this",
".",
"totalTime",
"=",
"this",
".",
"_savedTotalTime",
";",
"this",
".",
"numberOfCall... | When focusing and collapsing we modify lots of nodes in the tree. This allows us to restore them all to their original state when we revert. | [
"When",
"focusing",
"and",
"collapsing",
"we",
"modify",
"lots",
"of",
"nodes",
"in",
"the",
"tree",
".",
"This",
"allows",
"us",
"to",
"restore",
"them",
"all",
"to",
"their",
"original",
"state",
"when",
"we",
"revert",
"."
] | 55c1dda0dff0c44920673711656ddfd7ff03c307 | https://github.com/wuchangming/spy-debugger/blob/55c1dda0dff0c44920673711656ddfd7ff03c307/buildin_modules/weinre/web/client/ProfileDataGridTree.js#L241-L259 | train | Restore the parameters of the xsd | [
30522,
3853,
1006,
1007,
1063,
2065,
1006,
999,
2023,
1012,
1035,
5552,
19339,
7389,
1007,
2709,
1025,
2023,
1012,
2969,
7292,
1027,
2023,
1012,
1035,
5552,
11246,
6199,
14428,
1025,
2023,
1012,
2561,
7292,
1027,
2023,
1012,
1035,
5552,
3... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SeleniumHQ/selenium | third_party/js/mozmill/shared-modules/toolbars.js | locationBar_clear | function locationBar_clear() {
this.focus({type: "shortcut"});
this._controller.keypress(this.urlbar, "VK_DELETE", {});
this._controller.waitForEval("subject.value == ''",
TIMEOUT, 100, this.urlbar.getNode());
} | javascript | function locationBar_clear() {
this.focus({type: "shortcut"});
this._controller.keypress(this.urlbar, "VK_DELETE", {});
this._controller.waitForEval("subject.value == ''",
TIMEOUT, 100, this.urlbar.getNode());
} | [
"function",
"locationBar_clear",
"(",
")",
"{",
"this",
".",
"focus",
"(",
"{",
"type",
":",
"\"shortcut\"",
"}",
")",
";",
"this",
".",
"_controller",
".",
"keypress",
"(",
"this",
".",
"urlbar",
",",
"\"VK_DELETE\"",
",",
"{",
"}",
")",
";",
"this",
... | Clear the location bar | [
"Clear",
"the",
"location",
"bar"
] | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/toolbars.js#L301-L306 | train | Clear the location bar | [
30522,
3853,
3295,
8237,
1035,
3154,
1006,
1007,
1063,
2023,
1012,
3579,
1006,
1063,
2828,
1024,
1000,
2460,
12690,
1000,
1065,
1007,
1025,
2023,
1012,
1035,
11486,
1012,
3145,
20110,
1006,
2023,
1012,
24471,
20850,
2906,
1010,
1000,
1058,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | js/mui.class.scroll.slider.js | function(x, y) {
this._super(x, y);
var progressBar = this.progressBar;
if (progressBar) {
this.progressBarStyle.webkitTransform = this._getTranslateStr((-x * (this.progressBarWidth / this.wrapperWidth)), 0);
}
} | javascript | function(x, y) {
this._super(x, y);
var progressBar = this.progressBar;
if (progressBar) {
this.progressBarStyle.webkitTransform = this._getTranslateStr((-x * (this.progressBarWidth / this.wrapperWidth)), 0);
}
} | [
"function",
"(",
"x",
",",
"y",
")",
"{",
"this",
".",
"_super",
"(",
"x",
",",
"y",
")",
";",
"var",
"progressBar",
"=",
"this",
".",
"progressBar",
";",
"if",
"(",
"progressBar",
")",
"{",
"this",
".",
"progressBarStyle",
".",
"webkitTransform",
"=... | API | [
"API"
] | ff74c90a1671a552f3604b1288bf38a4126312d0 | https://github.com/dcloudio/mui/blob/ff74c90a1671a552f3604b1288bf38a4126312d0/js/mui.class.scroll.slider.js#L312-L318 | train | Set the transform to the given x y position | [
30522,
3853,
1006,
1060,
1010,
1061,
1007,
1063,
2023,
1012,
1035,
3565,
1006,
1060,
1010,
1061,
1007,
1025,
13075,
5082,
8237,
1027,
2023,
1012,
5082,
8237,
1025,
2065,
1006,
5082,
8237,
1007,
1063,
2023,
1012,
5082,
8237,
21756,
2571,
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/CustomizingConfiguration.js | function(oComponent) {
var sComponentName = oComponent.getMetadata().getComponentName(),
sKey = sComponentName + "::" + oComponent.getId();
if (mComponentConfigs[sKey]) {
Log.info("CustomizingConfiguration: deactivateForComponent('" + sKey + "')");
delete mComponentConfigs[sKey];
}
} | javascript | function(oComponent) {
var sComponentName = oComponent.getMetadata().getComponentName(),
sKey = sComponentName + "::" + oComponent.getId();
if (mComponentConfigs[sKey]) {
Log.info("CustomizingConfiguration: deactivateForComponent('" + sKey + "')");
delete mComponentConfigs[sKey];
}
} | [
"function",
"(",
"oComponent",
")",
"{",
"var",
"sComponentName",
"=",
"oComponent",
".",
"getMetadata",
"(",
")",
".",
"getComponentName",
"(",
")",
",",
"sKey",
"=",
"sComponentName",
"+",
"\"::\"",
"+",
"oComponent",
".",
"getId",
"(",
")",
";",
"if",
... | Deactivates the Customizing of a component instance by removing the component
configuration in the central Customizing configuration.
@param {sap.ui.core.Component} oComponent the component instance
@private | [
"Deactivates",
"the",
"Customizing",
"of",
"a",
"component",
"instance",
"by",
"removing",
"the",
"component",
"configuration",
"in",
"the",
"central",
"Customizing",
"configuration",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/CustomizingConfiguration.js#L143-L150 | train | Deactivates a component | [
30522,
3853,
1006,
1051,
9006,
29513,
3372,
1007,
1063,
13075,
8040,
25377,
5643,
3372,
18442,
1027,
1051,
9006,
29513,
3372,
1012,
2131,
11368,
8447,
2696,
1006,
1007,
1012,
2131,
9006,
29513,
3372,
18442,
1006,
1007,
1010,
15315,
3240,
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... | |
tensorflow/tfjs-models | posenet/demos/coco.js | decodeMultiplePosesAndDrawResults | async function decodeMultiplePosesAndDrawResults() {
if (!modelOutputs) {
return;
}
const poses = await posenet.decodeMultiplePoses(
modelOutputs.heatmapScores, modelOutputs.offsets,
modelOutputs.displacementFwd, modelOutputs.displacementBwd,
guiState.outputStride, guiState.multiPoseDetection.maxDetections,
guiState.multiPoseDetection);
drawMultiplePosesResults(poses);
} | javascript | async function decodeMultiplePosesAndDrawResults() {
if (!modelOutputs) {
return;
}
const poses = await posenet.decodeMultiplePoses(
modelOutputs.heatmapScores, modelOutputs.offsets,
modelOutputs.displacementFwd, modelOutputs.displacementBwd,
guiState.outputStride, guiState.multiPoseDetection.maxDetections,
guiState.multiPoseDetection);
drawMultiplePosesResults(poses);
} | [
"async",
"function",
"decodeMultiplePosesAndDrawResults",
"(",
")",
"{",
"if",
"(",
"!",
"modelOutputs",
")",
"{",
"return",
";",
"}",
"const",
"poses",
"=",
"await",
"posenet",
".",
"decodeMultiplePoses",
"(",
"modelOutputs",
".",
"heatmapScores",
",",
"modelOu... | Converts the raw model output results into multi-pose estimation results | [
"Converts",
"the",
"raw",
"model",
"output",
"results",
"into",
"multi",
"-",
"pose",
"estimation",
"results"
] | af194797c90cc5bcac1060d3cd41b0258a34c7dc | https://github.com/tensorflow/tfjs-models/blob/af194797c90cc5bcac1060d3cd41b0258a34c7dc/posenet/demos/coco.js#L296-L308 | train | Decode multiple poses and draw the results | [
30522,
2004,
6038,
2278,
3853,
21933,
3207,
12274,
7096,
11514,
2571,
20688,
8791,
14141,
2527,
13088,
2229,
11314,
2015,
1006,
1007,
1063,
2065,
1006,
999,
2944,
5833,
18780,
2015,
1007,
1063,
2709,
1025,
1065,
9530,
3367,
22382,
1027,
267... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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_BrtName | function parse_BrtName(data, length, opts) {
var end = data.l + length;
data.l += 4; //var flags = data.read_shift(4);
data.l += 1; //var chKey = data.read_shift(1);
var itab = data.read_shift(4);
var name = parse_XLNameWideString(data);
var formula = parse_XLSBNameParsedFormula(data, 0, opts);
var comment = parse_XLNullableWideString(data);
//if(0 /* fProc */) {
// unusedstring1: XLNullableWideString
// description: XLNullableWideString
// helpTopic: XLNullableWideString
// unusedstring2: XLNullableWideString
//}
data.l = end;
var out = ({Name:name, Ptg:formula});
if(itab < 0xFFFFFFF) out.Sheet = itab;
if(comment) out.Comment = comment;
return out;
} | javascript | function parse_BrtName(data, length, opts) {
var end = data.l + length;
data.l += 4; //var flags = data.read_shift(4);
data.l += 1; //var chKey = data.read_shift(1);
var itab = data.read_shift(4);
var name = parse_XLNameWideString(data);
var formula = parse_XLSBNameParsedFormula(data, 0, opts);
var comment = parse_XLNullableWideString(data);
//if(0 /* fProc */) {
// unusedstring1: XLNullableWideString
// description: XLNullableWideString
// helpTopic: XLNullableWideString
// unusedstring2: XLNullableWideString
//}
data.l = end;
var out = ({Name:name, Ptg:formula});
if(itab < 0xFFFFFFF) out.Sheet = itab;
if(comment) out.Comment = comment;
return out;
} | [
"function",
"parse_BrtName",
"(",
"data",
",",
"length",
",",
"opts",
")",
"{",
"var",
"end",
"=",
"data",
".",
"l",
"+",
"length",
";",
"data",
".",
"l",
"+=",
"4",
";",
"//var flags = data.read_shift(4);",
"data",
".",
"l",
"+=",
"1",
";",
"//var chK... | /* [MS-XLSB] 2.4.687 BrtName | [
"/",
"*",
"[",
"MS",
"-",
"XLSB",
"]",
"2",
".",
"4",
".",
"687",
"BrtName"
] | 9a6d8a1d3d80c78dad5201fb389316f935279cdc | https://github.com/SheetJS/js-xlsx/blob/9a6d8a1d3d80c78dad5201fb389316f935279cdc/xlsx.js#L14832-L14851 | train | Parse BrtName | [
30522,
3853,
11968,
3366,
1035,
7987,
2102,
18442,
1006,
2951,
1010,
3091,
1010,
23569,
2015,
1007,
1063,
13075,
2203,
1027,
2951,
1012,
1048,
1009,
3091,
1025,
2951,
1012,
1048,
1009,
1027,
1018,
1025,
1013,
1013,
13075,
30524,
1012,
3191,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
ecomfe/zrender | src/Storage.js | function (el) {
if (el == null) {
// 不指定el清空
for (var i = 0; i < this._roots.length; i++) {
var root = this._roots[i];
if (root instanceof Group) {
root.delChildrenFromStorage(this);
}
}
this._roots = [];
this._displayList = [];
this._displayListLen = 0;
return;
}
if (el instanceof Array) {
for (var i = 0, l = el.length; i < l; i++) {
this.delRoot(el[i]);
}
return;
}
var idx = util.indexOf(this._roots, el);
if (idx >= 0) {
this.delFromStorage(el);
this._roots.splice(idx, 1);
if (el instanceof Group) {
el.delChildrenFromStorage(this);
}
}
} | javascript | function (el) {
if (el == null) {
// 不指定el清空
for (var i = 0; i < this._roots.length; i++) {
var root = this._roots[i];
if (root instanceof Group) {
root.delChildrenFromStorage(this);
}
}
this._roots = [];
this._displayList = [];
this._displayListLen = 0;
return;
}
if (el instanceof Array) {
for (var i = 0, l = el.length; i < l; i++) {
this.delRoot(el[i]);
}
return;
}
var idx = util.indexOf(this._roots, el);
if (idx >= 0) {
this.delFromStorage(el);
this._roots.splice(idx, 1);
if (el instanceof Group) {
el.delChildrenFromStorage(this);
}
}
} | [
"function",
"(",
"el",
")",
"{",
"if",
"(",
"el",
"==",
"null",
")",
"{",
"// 不指定el清空",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"_roots",
".",
"length",
";",
"i",
"++",
")",
"{",
"var",
"root",
"=",
"this",
".",
"_roots"... | 删除指定的图形(Shape)或者组(Group)
@param {string|Array.<string>} [el] 如果为空清空整个Storage | [
"删除指定的图形",
"(",
"Shape",
")",
"或者组",
"(",
"Group",
")"
] | 30321b57cba3149c30eacb0c1e18276f0f001b9f | https://github.com/ecomfe/zrender/blob/30321b57cba3149c30eacb0c1e18276f0f001b9f/src/Storage.js#L176-L209 | train | del root | [
30522,
3853,
1006,
3449,
1007,
1063,
2065,
1006,
3449,
1027,
1027,
19701,
1007,
1063,
1013,
1013,
1744,
100,
1822,
3449,
1903,
1930,
2005,
1006,
13075,
1045,
1027,
1014,
1025,
1045,
1026,
2023,
1012,
1035,
6147,
1012,
3091,
1025,
1045,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
ColorlibHQ/AdminLTE | plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js | function() {
var clonedTestElement = testElement.cloneNode(false),
returnValue,
innerHTML;
clonedTestElement.innerHTML = "<p><div></div>";
innerHTML = clonedTestElement.innerHTML.toLowerCase();
returnValue = innerHTML === "<p></p><div></div>" || innerHTML === "<p><div></div></p>";
// Cache result by overwriting current function
this.autoClosesUnclosedTags = function() { return returnValue; };
return returnValue;
} | javascript | function() {
var clonedTestElement = testElement.cloneNode(false),
returnValue,
innerHTML;
clonedTestElement.innerHTML = "<p><div></div>";
innerHTML = clonedTestElement.innerHTML.toLowerCase();
returnValue = innerHTML === "<p></p><div></div>" || innerHTML === "<p><div></div></p>";
// Cache result by overwriting current function
this.autoClosesUnclosedTags = function() { return returnValue; };
return returnValue;
} | [
"function",
"(",
")",
"{",
"var",
"clonedTestElement",
"=",
"testElement",
".",
"cloneNode",
"(",
"false",
")",
",",
"returnValue",
",",
"innerHTML",
";",
"clonedTestElement",
".",
"innerHTML",
"=",
"\"<p><div></div>\"",
";",
"innerHTML",
"=",
"clonedTestElement",... | Check whether the browser automatically closes tags that don't need to be opened | [
"Check",
"whether",
"the",
"browser",
"automatically",
"closes",
"tags",
"that",
"don",
"t",
"need",
"to",
"be",
"opened"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js#L4455-L4468 | train | Returns the result of the test | [
30522,
3853,
1006,
1007,
30524,
11039,
19968,
1027,
1000,
1026,
1052,
1028,
1026,
4487,
2615,
1028,
1026,
1013,
4487,
2615,
1028,
1000,
1025,
5110,
11039,
19968,
1027,
17598,
11927,
4355,
12260,
3672,
1012,
5110,
11039,
19968,
1012,
2000,
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... | |
GoogleChrome/workbox | packages/workbox-build/src/entry-points/generate-sw-string.js | generateSWString | async function generateSWString(config) {
// This check needs to be done before validation, since the deprecated options
// will be renamed.
const deprecationWarnings = checkForDeprecatedOptions(config);
const options = validate(config, generateSWStringSchema);
const {manifestEntries, warnings} = await getFileManifestEntries(options);
const swString = await populateSWTemplate(Object.assign({
manifestEntries,
}, options));
// Add in any deprecation warnings.
warnings.push(...deprecationWarnings);
return {swString, warnings};
} | javascript | async function generateSWString(config) {
// This check needs to be done before validation, since the deprecated options
// will be renamed.
const deprecationWarnings = checkForDeprecatedOptions(config);
const options = validate(config, generateSWStringSchema);
const {manifestEntries, warnings} = await getFileManifestEntries(options);
const swString = await populateSWTemplate(Object.assign({
manifestEntries,
}, options));
// Add in any deprecation warnings.
warnings.push(...deprecationWarnings);
return {swString, warnings};
} | [
"async",
"function",
"generateSWString",
"(",
"config",
")",
"{",
"// This check needs to be done before validation, since the deprecated options",
"// will be renamed.",
"const",
"deprecationWarnings",
"=",
"checkForDeprecatedOptions",
"(",
"config",
")",
";",
"const",
"options"... | This method generates a service worker based on the configuration options
provided.
@param {Object} config Please refer to the
[configuration guide](https://developers.google.com/web/tools/workbox/modules/workbox-build#generateswstring_mode).
@return {Promise<{swString: string, warnings: Array<string>}>} A promise that
resolves once the service worker template is populated. The `swString`
property contains a string representation of the full service worker code.
Any non-fatal warning messages will be returned via `warnings`.
@memberof module:workbox-build | [
"This",
"method",
"generates",
"a",
"service",
"worker",
"based",
"on",
"the",
"configuration",
"options",
"provided",
"."
] | 8379c51b6deaf52faed5879206fe84579cae41f0 | https://github.com/GoogleChrome/workbox/blob/8379c51b6deaf52faed5879206fe84579cae41f0/packages/workbox-build/src/entry-points/generate-sw-string.js#L29-L46 | train | Generates a SW string from the given configuration | [
30522,
2004,
6038,
2278,
3853,
19421,
9333,
18886,
3070,
1006,
9530,
8873,
2290,
1007,
1063,
1013,
1013,
2023,
4638,
3791,
2000,
2022,
2589,
2077,
27354,
1010,
2144,
1996,
2139,
28139,
12921,
7047,
1013,
1013,
2097,
2022,
4096,
1012,
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... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/core/support/techinfo/TechnicalInfo.js | function () {
var oModel = this._oDialog.getModel("view"),
oTreeData = oModel.getProperty("/DebugModules")[0];
this._treeHelper.recursiveSelect(oTreeData, false);
this._updateTreeInfos();
} | javascript | function () {
var oModel = this._oDialog.getModel("view"),
oTreeData = oModel.getProperty("/DebugModules")[0];
this._treeHelper.recursiveSelect(oTreeData, false);
this._updateTreeInfos();
} | [
"function",
"(",
")",
"{",
"var",
"oModel",
"=",
"this",
".",
"_oDialog",
".",
"getModel",
"(",
"\"view\"",
")",
",",
"oTreeData",
"=",
"oModel",
".",
"getProperty",
"(",
"\"/DebugModules\"",
")",
"[",
"0",
"]",
";",
"this",
".",
"_treeHelper",
".",
"r... | Resets the debug module tree | [
"Resets",
"the",
"debug",
"module",
"tree"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/support/techinfo/TechnicalInfo.js#L279-L285 | train | Select the debug module | [
30522,
3853,
1006,
1007,
1063,
13075,
18168,
10244,
2140,
1027,
2023,
1012,
1035,
21045,
23067,
2290,
1012,
2131,
5302,
9247,
1006,
1000,
3193,
1000,
1007,
1010,
27178,
9910,
2850,
2696,
1027,
18168,
10244,
2140,
1012,
2131,
21572,
4842,
37... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/polar/Polar.js | function (data, clamp) {
return this.coordToPoint([
this._radiusAxis.dataToRadius(data[0], clamp),
this._angleAxis.dataToAngle(data[1], clamp)
]);
} | javascript | function (data, clamp) {
return this.coordToPoint([
this._radiusAxis.dataToRadius(data[0], clamp),
this._angleAxis.dataToAngle(data[1], clamp)
]);
} | [
"function",
"(",
"data",
",",
"clamp",
")",
"{",
"return",
"this",
".",
"coordToPoint",
"(",
"[",
"this",
".",
"_radiusAxis",
".",
"dataToRadius",
"(",
"data",
"[",
"0",
"]",
",",
"clamp",
")",
",",
"this",
".",
"_angleAxis",
".",
"dataToAngle",
"(",
... | Convert a single data item to (x, y) point.
Parameter data is an array which the first element is radius and the second is angle
@param {Array.<number>} data
@param {boolean} [clamp=false]
@return {Array.<number>} | [
"Convert",
"a",
"single",
"data",
"item",
"to",
"(",
"x",
"y",
")",
"point",
".",
"Parameter",
"data",
"is",
"an",
"array",
"which",
"the",
"first",
"element",
"is",
"radius",
"and",
"the",
"second",
"is",
"angle"
] | 4d0ea095dc3929cb6de40c45748826e7999c7aa8 | https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/coord/polar/Polar.js#L190-L195 | train | Converts an array of points to a point | [
30522,
3853,
1006,
2951,
1010,
18856,
16613,
1007,
1063,
2709,
2023,
1012,
2522,
8551,
14399,
25785,
1006,
1031,
2023,
1012,
1035,
12177,
8528,
2483,
1012,
2951,
4263,
17190,
2271,
1006,
2951,
1031,
1014,
1033,
1010,
18856,
16613,
1007,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
angular/material | src/components/autocomplete/js/autocompleteParentScopeDirective.js | watchVariable | function watchVariable(variable, alias) {
newScope[alias] = scope[variable];
scope.$watch(variable, function(value) {
$mdUtil.nextTick(function() {
newScope[alias] = value;
});
});
} | javascript | function watchVariable(variable, alias) {
newScope[alias] = scope[variable];
scope.$watch(variable, function(value) {
$mdUtil.nextTick(function() {
newScope[alias] = value;
});
});
} | [
"function",
"watchVariable",
"(",
"variable",
",",
"alias",
")",
"{",
"newScope",
"[",
"alias",
"]",
"=",
"scope",
"[",
"variable",
"]",
";",
"scope",
".",
"$watch",
"(",
"variable",
",",
"function",
"(",
"value",
")",
"{",
"$mdUtil",
".",
"nextTick",
... | Creates a watcher for variables that are copied from the parent scope
@param variable
@param alias | [
"Creates",
"a",
"watcher",
"for",
"variables",
"that",
"are",
"copied",
"from",
"the",
"parent",
"scope"
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/autocomplete/js/autocompleteParentScopeDirective.js#L36-L44 | train | watch variable for changes | [
30522,
3853,
3422,
10755,
19210,
1006,
8023,
1010,
14593,
1007,
1063,
2739,
16186,
1031,
14593,
1033,
1027,
9531,
1031,
8023,
1033,
1025,
9531,
1012,
1002,
3422,
1006,
8023,
1010,
3853,
1006,
3643,
1007,
1063,
1002,
9108,
21823,
2140,
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/thirdparty/blanket.js | parseUnaryExpression | function parseUnaryExpression() {
var token, expr, startToken;
if (lookahead.type !== Token.Punctuator && lookahead.type !== Token.Keyword) {
expr = parsePostfixExpression();
} else if (match('++') || match('--')) {
startToken = lookahead;
token = lex();
expr = parseUnaryExpression();
// 11.4.4, 11.4.5
if (strict && expr.type === Syntax.Identifier && isRestrictedWord(expr.name)) {
throwErrorTolerant({}, Messages.StrictLHSPrefix);
}
if (!isLeftHandSide(expr)) {
throwErrorTolerant({}, Messages.InvalidLHSInAssignment);
}
expr = delegate.createUnaryExpression(token.value, expr);
expr = delegate.markEnd(expr, startToken);
} else if (match('+') || match('-') || match('~') || match('!')) {
startToken = lookahead;
token = lex();
expr = parseUnaryExpression();
expr = delegate.createUnaryExpression(token.value, expr);
expr = delegate.markEnd(expr, startToken);
} else if (matchKeyword('delete') || matchKeyword('void') || matchKeyword('typeof')) {
startToken = lookahead;
token = lex();
expr = parseUnaryExpression();
expr = delegate.createUnaryExpression(token.value, expr);
expr = delegate.markEnd(expr, startToken);
if (strict && expr.operator === 'delete' && expr.argument.type === Syntax.Identifier) {
throwErrorTolerant({}, Messages.StrictDelete);
}
} else {
expr = parsePostfixExpression();
}
return expr;
} | javascript | function parseUnaryExpression() {
var token, expr, startToken;
if (lookahead.type !== Token.Punctuator && lookahead.type !== Token.Keyword) {
expr = parsePostfixExpression();
} else if (match('++') || match('--')) {
startToken = lookahead;
token = lex();
expr = parseUnaryExpression();
// 11.4.4, 11.4.5
if (strict && expr.type === Syntax.Identifier && isRestrictedWord(expr.name)) {
throwErrorTolerant({}, Messages.StrictLHSPrefix);
}
if (!isLeftHandSide(expr)) {
throwErrorTolerant({}, Messages.InvalidLHSInAssignment);
}
expr = delegate.createUnaryExpression(token.value, expr);
expr = delegate.markEnd(expr, startToken);
} else if (match('+') || match('-') || match('~') || match('!')) {
startToken = lookahead;
token = lex();
expr = parseUnaryExpression();
expr = delegate.createUnaryExpression(token.value, expr);
expr = delegate.markEnd(expr, startToken);
} else if (matchKeyword('delete') || matchKeyword('void') || matchKeyword('typeof')) {
startToken = lookahead;
token = lex();
expr = parseUnaryExpression();
expr = delegate.createUnaryExpression(token.value, expr);
expr = delegate.markEnd(expr, startToken);
if (strict && expr.operator === 'delete' && expr.argument.type === Syntax.Identifier) {
throwErrorTolerant({}, Messages.StrictDelete);
}
} else {
expr = parsePostfixExpression();
}
return expr;
} | [
"function",
"parseUnaryExpression",
"(",
")",
"{",
"var",
"token",
",",
"expr",
",",
"startToken",
";",
"if",
"(",
"lookahead",
".",
"type",
"!==",
"Token",
".",
"Punctuator",
"&&",
"lookahead",
".",
"type",
"!==",
"Token",
".",
"Keyword",
")",
"{",
"exp... | 11.4 Unary Operators | [
"11",
".",
"4",
"Unary",
"Operators"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/blanket.js#L2352-L2392 | train | ECMA - 262 12. 2 Unary Operators | [
30522,
3853,
11968,
3366,
9521,
2854,
10288,
20110,
3258,
1006,
1007,
1063,
13075,
19204,
1010,
4654,
18098,
1010,
2707,
18715,
2368,
1025,
2065,
1006,
2298,
4430,
13775,
1012,
2828,
999,
1027,
1027,
19204,
1012,
26136,
6593,
6692,
4263,
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... |
grpc/grpc | examples/node/static_codegen/route_guide/route_guide_client.js | runRecordRoute | function runRecordRoute(callback) {
var argv = parseArgs(process.argv, {
string: 'db_path'
});
fs.readFile(path.resolve(argv.db_path), function(err, data) {
if (err) {
callback(err);
return;
}
// Transform the loaded features to Feature objects
var feature_list = _.map(JSON.parse(data), function(value) {
var feature = new messages.Feature();
feature.setName(value.name);
var location = new messages.Point();
location.setLatitude(value.location.latitude);
location.setLongitude(value.location.longitude);
feature.setLocation(location);
return feature;
});
var num_points = 10;
var call = client.recordRoute(function(error, stats) {
if (error) {
callback(error);
return;
}
console.log('Finished trip with', stats.getPointCount(), 'points');
console.log('Passed', stats.getFeatureCount(), 'features');
console.log('Travelled', stats.getDistance(), 'meters');
console.log('It took', stats.getElapsedTime(), 'seconds');
callback();
});
/**
* Constructs a function that asynchronously sends the given point and then
* delays sending its callback
* @param {messages.Point} location The point to send
* @return {function(function)} The function that sends the point
*/
function pointSender(location) {
/**
* Sends the point, then calls the callback after a delay
* @param {function} callback Called when complete
*/
return function(callback) {
console.log('Visiting point ' + location.getLatitude()/COORD_FACTOR +
', ' + location.getLongitude()/COORD_FACTOR);
call.write(location);
_.delay(callback, _.random(500, 1500));
};
}
var point_senders = [];
for (var i = 0; i < num_points; i++) {
var rand_point = feature_list[_.random(0, feature_list.length - 1)];
point_senders[i] = pointSender(rand_point.getLocation());
}
async.series(point_senders, function() {
call.end();
});
});
} | javascript | function runRecordRoute(callback) {
var argv = parseArgs(process.argv, {
string: 'db_path'
});
fs.readFile(path.resolve(argv.db_path), function(err, data) {
if (err) {
callback(err);
return;
}
// Transform the loaded features to Feature objects
var feature_list = _.map(JSON.parse(data), function(value) {
var feature = new messages.Feature();
feature.setName(value.name);
var location = new messages.Point();
location.setLatitude(value.location.latitude);
location.setLongitude(value.location.longitude);
feature.setLocation(location);
return feature;
});
var num_points = 10;
var call = client.recordRoute(function(error, stats) {
if (error) {
callback(error);
return;
}
console.log('Finished trip with', stats.getPointCount(), 'points');
console.log('Passed', stats.getFeatureCount(), 'features');
console.log('Travelled', stats.getDistance(), 'meters');
console.log('It took', stats.getElapsedTime(), 'seconds');
callback();
});
/**
* Constructs a function that asynchronously sends the given point and then
* delays sending its callback
* @param {messages.Point} location The point to send
* @return {function(function)} The function that sends the point
*/
function pointSender(location) {
/**
* Sends the point, then calls the callback after a delay
* @param {function} callback Called when complete
*/
return function(callback) {
console.log('Visiting point ' + location.getLatitude()/COORD_FACTOR +
', ' + location.getLongitude()/COORD_FACTOR);
call.write(location);
_.delay(callback, _.random(500, 1500));
};
}
var point_senders = [];
for (var i = 0; i < num_points; i++) {
var rand_point = feature_list[_.random(0, feature_list.length - 1)];
point_senders[i] = pointSender(rand_point.getLocation());
}
async.series(point_senders, function() {
call.end();
});
});
} | [
"function",
"runRecordRoute",
"(",
"callback",
")",
"{",
"var",
"argv",
"=",
"parseArgs",
"(",
"process",
".",
"argv",
",",
"{",
"string",
":",
"'db_path'",
"}",
")",
";",
"fs",
".",
"readFile",
"(",
"path",
".",
"resolve",
"(",
"argv",
".",
"db_path",... | Run the recordRoute demo. Sends several randomly chosen points from the
pre-generated feature database with a variable delay in between. Prints the
statistics when they are sent from the server.
@param {function} callback Called when this demo is complete | [
"Run",
"the",
"recordRoute",
"demo",
".",
"Sends",
"several",
"randomly",
"chosen",
"points",
"from",
"the",
"pre",
"-",
"generated",
"feature",
"database",
"with",
"a",
"variable",
"delay",
"in",
"between",
".",
"Prints",
"the",
"statistics",
"when",
"they",
... | cc75d93818410e2b0edd0fa3009a6def9ac403ca | https://github.com/grpc/grpc/blob/cc75d93818410e2b0edd0fa3009a6def9ac403ca/examples/node/static_codegen/route_guide/route_guide_client.js#L99-L158 | train | Runs the record route | [
30522,
3853,
2448,
30524,
1065,
1007,
1025,
1042,
2015,
1012,
3191,
8873,
2571,
1006,
4130,
1012,
10663,
1006,
12098,
2290,
2615,
1012,
16962,
1035,
4130,
1007,
1010,
3853,
1006,
9413,
2099,
1010,
2951,
1007,
1063,
2065,
1006,
9413,
2099,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
angular/protractor | website/docgen/processors/tag-fixer.js | function(doc) {
if (doc.params) {
_.each(doc.params, function(param) {
replaceNewLines(param, 'description');
});
}
// Replace new lines in the return and params descriptions.
var returns = doc.returns;
if (returns) {
replaceNewLines(returns, 'description');
}
} | javascript | function(doc) {
if (doc.params) {
_.each(doc.params, function(param) {
replaceNewLines(param, 'description');
});
}
// Replace new lines in the return and params descriptions.
var returns = doc.returns;
if (returns) {
replaceNewLines(returns, 'description');
}
} | [
"function",
"(",
"doc",
")",
"{",
"if",
"(",
"doc",
".",
"params",
")",
"{",
"_",
".",
"each",
"(",
"doc",
".",
"params",
",",
"function",
"(",
"param",
")",
"{",
"replaceNewLines",
"(",
"param",
",",
"'description'",
")",
";",
"}",
")",
";",
"}"... | Remove the duplicate param annotations. Go through the params and the return
annotations to replace the new lines and escape the types to prepare them
for markdown rendering.
@param {!Object} doc Document representing a function jsdoc. | [
"Remove",
"the",
"duplicate",
"param",
"annotations",
".",
"Go",
"through",
"the",
"params",
"and",
"the",
"return",
"annotations",
"to",
"replace",
"the",
"new",
"lines",
"and",
"escape",
"the",
"types",
"to",
"prepare",
"them",
"for",
"markdown",
"rendering"... | 4f74a4ec753c97adfe955fe468a39286a0a55837 | https://github.com/angular/protractor/blob/4f74a4ec753c97adfe955fe468a39286a0a55837/website/docgen/processors/tag-fixer.js#L80-L92 | train | Replace new lines in the params and returns descriptions. | [
30522,
3853,
1006,
9986,
1007,
1063,
2065,
1006,
9986,
1012,
11498,
5244,
1007,
1063,
1035,
1012,
2169,
1006,
9986,
1012,
11498,
5244,
1010,
3853,
1006,
11498,
2213,
1007,
1063,
5672,
2638,
13668,
10586,
1006,
11498,
2213,
1010,
1005,
6412,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
laurent22/joplin | Clipper/joplin-webclipper/content_scripts/Readability.js | function(e, regex) {
var endOfSearchMarkerNode = this._getNextNode(e, true);
var next = this._getNextNode(e);
while (next && next != endOfSearchMarkerNode) {
if (regex.test(next.className + " " + next.id)) {
next = this._removeAndGetNext(next);
} else {
next = this._getNextNode(next);
}
}
} | javascript | function(e, regex) {
var endOfSearchMarkerNode = this._getNextNode(e, true);
var next = this._getNextNode(e);
while (next && next != endOfSearchMarkerNode) {
if (regex.test(next.className + " " + next.id)) {
next = this._removeAndGetNext(next);
} else {
next = this._getNextNode(next);
}
}
} | [
"function",
"(",
"e",
",",
"regex",
")",
"{",
"var",
"endOfSearchMarkerNode",
"=",
"this",
".",
"_getNextNode",
"(",
"e",
",",
"true",
")",
";",
"var",
"next",
"=",
"this",
".",
"_getNextNode",
"(",
"e",
")",
";",
"while",
"(",
"next",
"&&",
"next",
... | Clean out elements whose id/class combinations match specific string.
@param Element
@param RegExp match id/class combination.
@return void | [
"Clean",
"out",
"elements",
"whose",
"id",
"/",
"class",
"combinations",
"match",
"specific",
"string",
"."
] | beb428b246cecba4630a3ca57b472f43c0933a43 | https://github.com/laurent22/joplin/blob/beb428b246cecba4630a3ca57b472f43c0933a43/Clipper/joplin-webclipper/content_scripts/Readability.js#L1663-L1673 | train | Remove the first node that matches the regex | [
30522,
3853,
1006,
1041,
1010,
19723,
10288,
1007,
1063,
13075,
2203,
11253,
17310,
11140,
10665,
11795,
10244,
1027,
2023,
1012,
1035,
2131,
2638,
18413,
3630,
3207,
1006,
1041,
1010,
2995,
1007,
1025,
13075,
2279,
1027,
2023,
1012,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
eslint/eslint | lib/util/ignored-paths.js | relativize | function relativize(globPattern, relativePathToOldBaseDir) {
if (relativePathToOldBaseDir === "") {
return globPattern;
}
const prefix = globPattern.startsWith("!") ? "!" : "";
const globWithoutPrefix = globPattern.replace(/^!/u, "");
if (globWithoutPrefix.startsWith("/")) {
return `${prefix}/${normalizePathSeps(relativePathToOldBaseDir)}${globWithoutPrefix}`;
}
return globPattern;
} | javascript | function relativize(globPattern, relativePathToOldBaseDir) {
if (relativePathToOldBaseDir === "") {
return globPattern;
}
const prefix = globPattern.startsWith("!") ? "!" : "";
const globWithoutPrefix = globPattern.replace(/^!/u, "");
if (globWithoutPrefix.startsWith("/")) {
return `${prefix}/${normalizePathSeps(relativePathToOldBaseDir)}${globWithoutPrefix}`;
}
return globPattern;
} | [
"function",
"relativize",
"(",
"globPattern",
",",
"relativePathToOldBaseDir",
")",
"{",
"if",
"(",
"relativePathToOldBaseDir",
"===",
"\"\"",
")",
"{",
"return",
"globPattern",
";",
"}",
"const",
"prefix",
"=",
"globPattern",
".",
"startsWith",
"(",
"\"!\"",
")... | /* eslint-enable valid-jsdoc
Converts a glob pattern to a new glob pattern relative to a different directory
@param {string} globPattern The glob pattern, relative the the old base directory
@param {string} relativePathToOldBaseDir A relative path from the new base directory to the old one
@returns {string} A glob pattern relative to the new base directory | [
"/",
"*",
"eslint",
"-",
"enable",
"valid",
"-",
"jsdoc",
"Converts",
"a",
"glob",
"pattern",
"to",
"a",
"new",
"glob",
"pattern",
"relative",
"to",
"a",
"different",
"directory"
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/util/ignored-paths.js#L101-L114 | train | Return the glob pattern relative to the given path | [
30522,
3853,
2128,
20051,
12848,
4697,
1006,
1043,
4135,
2497,
4502,
12079,
2078,
1010,
5816,
15069,
3406,
11614,
15058,
4305,
2099,
1007,
1063,
2065,
1006,
5816,
15069,
3406,
11614,
15058,
4305,
2099,
1027,
1027,
1027,
1000,
1000,
1007,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Helper.js | function (mQueryOptions, aSelectPaths) {
mQueryOptions.$select = mQueryOptions.$select || [];
aSelectPaths.forEach(function (sPath) {
if (mQueryOptions.$select.indexOf(sPath) < 0) {
mQueryOptions.$select.push(sPath);
}
});
} | javascript | function (mQueryOptions, aSelectPaths) {
mQueryOptions.$select = mQueryOptions.$select || [];
aSelectPaths.forEach(function (sPath) {
if (mQueryOptions.$select.indexOf(sPath) < 0) {
mQueryOptions.$select.push(sPath);
}
});
} | [
"function",
"(",
"mQueryOptions",
",",
"aSelectPaths",
")",
"{",
"mQueryOptions",
".",
"$select",
"=",
"mQueryOptions",
".",
"$select",
"||",
"[",
"]",
";",
"aSelectPaths",
".",
"forEach",
"(",
"function",
"(",
"sPath",
")",
"{",
"if",
"(",
"mQueryOptions",
... | Adds the given paths to $select of the given query options.
@param {object} mQueryOptions The query options
@param {string[]} aSelectPaths The paths to add to $select | [
"Adds",
"the",
"given",
"paths",
"to",
"$select",
"of",
"the",
"given",
"query",
"options",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Helper.js#L87-L94 | train | Adds the given array of paths to the select array | [
30522,
3853,
1006,
1049,
4226,
2854,
7361,
9285,
1010,
2004,
12260,
6593,
15069,
2015,
1007,
1063,
1049,
4226,
2854,
7361,
9285,
1012,
1002,
7276,
1027,
1049,
4226,
2854,
7361,
9285,
1012,
1002,
7276,
1064,
1064,
1031,
1033,
1025,
2004,
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.fl/src/sap/ui/fl/support/apps/contentbrowser/controller/ContentDetailsEdit.controller.js | function (oRouteMatch) {
var that = this;
var mRouteArguments = oRouteMatch.getParameter("arguments");
var oModelData = {};
oModelData.layer = mRouteArguments.layer;
oModelData.namespace = decodeURIComponent(mRouteArguments.namespace);
oModelData.fileName = mRouteArguments.fileName;
oModelData.fileType = mRouteArguments.fileType;
// correct namespace
if (oModelData.namespace[oModelData.namespace.length - 1] !== "/") {
oModelData.namespace += "/";
}
var sContentSuffix = oModelData.namespace + oModelData.fileName + "." + oModelData.fileType;
var oPage = that.getView().getContent()[0];
oPage.setBusy(true);
return LRepConnector.getContent(oModelData.layer, sContentSuffix, null, null, true).then(
that._onContentReceived.bind(that, oModelData, oPage, sContentSuffix),
function () {
oPage.setBusy(false);
}
);
} | javascript | function (oRouteMatch) {
var that = this;
var mRouteArguments = oRouteMatch.getParameter("arguments");
var oModelData = {};
oModelData.layer = mRouteArguments.layer;
oModelData.namespace = decodeURIComponent(mRouteArguments.namespace);
oModelData.fileName = mRouteArguments.fileName;
oModelData.fileType = mRouteArguments.fileType;
// correct namespace
if (oModelData.namespace[oModelData.namespace.length - 1] !== "/") {
oModelData.namespace += "/";
}
var sContentSuffix = oModelData.namespace + oModelData.fileName + "." + oModelData.fileType;
var oPage = that.getView().getContent()[0];
oPage.setBusy(true);
return LRepConnector.getContent(oModelData.layer, sContentSuffix, null, null, true).then(
that._onContentReceived.bind(that, oModelData, oPage, sContentSuffix),
function () {
oPage.setBusy(false);
}
);
} | [
"function",
"(",
"oRouteMatch",
")",
"{",
"var",
"that",
"=",
"this",
";",
"var",
"mRouteArguments",
"=",
"oRouteMatch",
".",
"getParameter",
"(",
"\"arguments\"",
")",
";",
"var",
"oModelData",
"=",
"{",
"}",
";",
"oModelData",
".",
"layer",
"=",
"mRouteA... | Handler if a route was matched;
Obtains information about layer, namespace, filename, and file type from the route's arguments, and then requests content from Layered Repository.
@param {Object} oRouteMatch - route object which is specified in the router and matched via regexp
@returns {Promise} - <code>LRepConnector</code> "getContent" promise
@private | [
"Handler",
"if",
"a",
"route",
"was",
"matched",
";",
"Obtains",
"information",
"about",
"layer",
"namespace",
"filename",
"and",
"file",
"type",
"from",
"the",
"route",
"s",
"arguments",
"and",
"then",
"requests",
"content",
"from",
"Layered",
"Repository",
"... | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/support/apps/contentbrowser/controller/ContentDetailsEdit.controller.js#L62-L87 | train | This function is called when a route matches the content of a page | [
30522,
3853,
1006,
20298,
10421,
18900,
2818,
1007,
1063,
13075,
2008,
1027,
2023,
1025,
13075,
2720,
5833,
14644,
22850,
11187,
1027,
20298,
10421,
18900,
2818,
1012,
2131,
28689,
22828,
1006,
1000,
9918,
1000,
1007,
1025,
13075,
18168,
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... | |
shipshapecode/shepherd | src/js/utils/modal.js | _createMaskContainer | function _createMaskContainer() {
const element = document.createElementNS(svgNS, 'mask');
_setAttributes(element, {
height: '100%',
id: elementIds.modalOverlayMask,
width: '100%',
x: '0',
y: '0'
});
return element;
} | javascript | function _createMaskContainer() {
const element = document.createElementNS(svgNS, 'mask');
_setAttributes(element, {
height: '100%',
id: elementIds.modalOverlayMask,
width: '100%',
x: '0',
y: '0'
});
return element;
} | [
"function",
"_createMaskContainer",
"(",
")",
"{",
"const",
"element",
"=",
"document",
".",
"createElementNS",
"(",
"svgNS",
",",
"'mask'",
")",
";",
"_setAttributes",
"(",
"element",
",",
"{",
"height",
":",
"'100%'",
",",
"id",
":",
"elementIds",
".",
"... | <mask id="shepherdModalMask" x="0" y="0" width="100%" height="100%"> | [
"<mask",
"id",
"=",
"shepherdModalMask",
"x",
"=",
"0",
"y",
"=",
"0",
"width",
"=",
"100%",
"height",
"=",
"100%",
">"
] | 0cb1c63fb07b58796358f6d33da5f6405e2b05f4 | https://github.com/shipshapecode/shepherd/blob/0cb1c63fb07b58796358f6d33da5f6405e2b05f4/src/js/utils/modal.js#L29-L41 | train | Create mask container | [
30522,
3853,
1035,
3443,
9335,
2243,
8663,
18249,
2121,
1006,
1007,
1063,
9530,
3367,
5783,
1027,
6254,
1012,
3443,
12260,
3672,
3619,
1006,
17917,
16206,
2015,
1010,
1005,
7308,
1005,
1007,
1025,
1035,
2275,
19321,
3089,
8569,
4570,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
dimsemenov/PhotoSwipe | src/js/gestures.js | function(animData) {
// calculate swipe speed for Y axis (paanning)
animData.calculateSwipeSpeed('y');
_currPanBounds = self.currItem.bounds;
animData.backAnimDestination = {};
animData.backAnimStarted = {};
// Avoid acceleration animation if speed is too low
if(Math.abs(animData.lastFlickSpeed.x) <= 0.05 && Math.abs(animData.lastFlickSpeed.y) <= 0.05 ) {
animData.speedDecelerationRatioAbs.x = animData.speedDecelerationRatioAbs.y = 0;
// Run pan drag release animation. E.g. if you drag image and release finger without momentum.
animData.calculateOverBoundsAnimOffset('x');
animData.calculateOverBoundsAnimOffset('y');
return true;
}
// Animation loop that controls the acceleration after pan gesture ends
_registerStartAnimation('zoomPan');
animData.lastNow = _getCurrentTime();
animData.panAnimLoop();
} | javascript | function(animData) {
// calculate swipe speed for Y axis (paanning)
animData.calculateSwipeSpeed('y');
_currPanBounds = self.currItem.bounds;
animData.backAnimDestination = {};
animData.backAnimStarted = {};
// Avoid acceleration animation if speed is too low
if(Math.abs(animData.lastFlickSpeed.x) <= 0.05 && Math.abs(animData.lastFlickSpeed.y) <= 0.05 ) {
animData.speedDecelerationRatioAbs.x = animData.speedDecelerationRatioAbs.y = 0;
// Run pan drag release animation. E.g. if you drag image and release finger without momentum.
animData.calculateOverBoundsAnimOffset('x');
animData.calculateOverBoundsAnimOffset('y');
return true;
}
// Animation loop that controls the acceleration after pan gesture ends
_registerStartAnimation('zoomPan');
animData.lastNow = _getCurrentTime();
animData.panAnimLoop();
} | [
"function",
"(",
"animData",
")",
"{",
"// calculate swipe speed for Y axis (paanning)",
"animData",
".",
"calculateSwipeSpeed",
"(",
"'y'",
")",
";",
"_currPanBounds",
"=",
"self",
".",
"currItem",
".",
"bounds",
";",
"animData",
".",
"backAnimDestination",
"=",
"{... | amount of pixels to drag to determine direction of swipe | [
"amount",
"of",
"pixels",
"to",
"drag",
"to",
"determine",
"direction",
"of",
"swipe"
] | 80607e12542a1a54ecefa837649e862b35dffd25 | https://github.com/dimsemenov/PhotoSwipe/blob/80607e12542a1a54ecefa837649e862b35dffd25/src/js/gestures.js#L924-L947 | train | Animation loop that will run pan animation | [
30522,
3853,
1006,
2019,
5714,
2850,
2696,
1007,
1063,
1013,
1013,
18422,
25430,
15457,
3177,
2005,
1061,
8123,
1006,
6643,
11639,
2075,
1007,
2019,
5714,
2850,
2696,
1012,
18422,
26760,
28108,
25599,
1006,
1005,
1061,
1005,
1007,
1025,
103... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
adobe/brackets | src/extensions/default/JavaScriptCodeHints/main.js | quickEditHelper | function quickEditHelper() {
var offset = session.getCursor(),
response = ScopeManager.requestJumptoDef(session, session.editor.document, offset);
return response;
} | javascript | function quickEditHelper() {
var offset = session.getCursor(),
response = ScopeManager.requestJumptoDef(session, session.editor.document, offset);
return response;
} | [
"function",
"quickEditHelper",
"(",
")",
"{",
"var",
"offset",
"=",
"session",
".",
"getCursor",
"(",
")",
",",
"response",
"=",
"ScopeManager",
".",
"requestJumptoDef",
"(",
"session",
",",
"session",
".",
"editor",
".",
"document",
",",
"offset",
")",
";... | /*
Helper for QuickEdit jump-to-definition request. | [
"/",
"*",
"Helper",
"for",
"QuickEdit",
"jump",
"-",
"to",
"-",
"definition",
"request",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/JavaScriptCodeHints/main.js#L875-L880 | train | quickEditHelper - helper function to quickEdit the editor | [
30522,
3853,
4248,
2098,
8939,
2884,
4842,
1006,
1007,
1063,
13075,
16396,
1027,
5219,
1012,
2131,
10841,
25301,
2099,
1006,
1007,
1010,
3433,
1027,
9531,
24805,
4590,
1012,
5227,
9103,
27718,
10244,
2546,
1006,
5219,
1010,
5219,
1012,
3559... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
jiahaog/nativefier | src/build/buildMain.js | buildMain | function buildMain(inpOptions, callback) {
const options = Object.assign({}, inpOptions);
// pre process app
const tmpObj = tmp.dirSync({ mode: '0755', unsafeCleanup: true });
const tmpPath = tmpObj.name;
// todo check if this is still needed on later version of packager
const packagerConsole = new PackagerConsole();
const progress = new DishonestProgress(5);
async.waterfall(
[
(cb) => {
progress.tick('inferring');
optionsFactory(options)
.then((result) => {
cb(null, result);
})
.catch((error) => {
cb(error);
});
},
(opts, cb) => {
progress.tick('copying');
buildApp(opts.dir, tmpPath, opts, (error) => {
if (error) {
cb(error);
return;
}
// Change the reference file for the Electron app to be the temporary path
const newOptions = Object.assign({}, opts, {
dir: tmpPath,
});
cb(null, newOptions);
});
},
(opts, cb) => {
progress.tick('icons');
iconBuild(opts, (error, optionsWithIcon) => {
cb(null, optionsWithIcon);
});
},
(opts, cb) => {
progress.tick('packaging');
// maybe skip passing icon parameter to electron packager
let packageOptions = maybeNoIconOption(opts);
// maybe skip passing other parameters to electron packager
packageOptions = maybeNoAppCopyrightOption(packageOptions);
packageOptions = maybeNoAppVersionOption(packageOptions);
packageOptions = maybeNoBuildVersionOption(packageOptions);
packageOptions = maybeNoVersionStringOption(packageOptions);
packageOptions = maybeNoWin32metadataOption(packageOptions);
packagerConsole.override();
packager(packageOptions)
.then((appPathArray) => {
packagerConsole.restore(); // restore console.error
cb(null, opts, appPathArray); // options still contain the icon to waterfall
})
.catch((error) => {
packagerConsole.restore(); // restore console.error
cb(error, opts); // options still contain the icon to waterfall
});
},
(opts, appPathArray, cb) => {
progress.tick('finalizing');
// somehow appPathArray is a 1 element array
const appPath = getAppPath(appPathArray);
if (!appPath) {
cb();
return;
}
maybeCopyIcons(opts, appPath, (error) => {
cb(error, appPath);
});
},
],
(error, appPath) => {
packagerConsole.playback();
callback(error, appPath);
},
);
} | javascript | function buildMain(inpOptions, callback) {
const options = Object.assign({}, inpOptions);
// pre process app
const tmpObj = tmp.dirSync({ mode: '0755', unsafeCleanup: true });
const tmpPath = tmpObj.name;
// todo check if this is still needed on later version of packager
const packagerConsole = new PackagerConsole();
const progress = new DishonestProgress(5);
async.waterfall(
[
(cb) => {
progress.tick('inferring');
optionsFactory(options)
.then((result) => {
cb(null, result);
})
.catch((error) => {
cb(error);
});
},
(opts, cb) => {
progress.tick('copying');
buildApp(opts.dir, tmpPath, opts, (error) => {
if (error) {
cb(error);
return;
}
// Change the reference file for the Electron app to be the temporary path
const newOptions = Object.assign({}, opts, {
dir: tmpPath,
});
cb(null, newOptions);
});
},
(opts, cb) => {
progress.tick('icons');
iconBuild(opts, (error, optionsWithIcon) => {
cb(null, optionsWithIcon);
});
},
(opts, cb) => {
progress.tick('packaging');
// maybe skip passing icon parameter to electron packager
let packageOptions = maybeNoIconOption(opts);
// maybe skip passing other parameters to electron packager
packageOptions = maybeNoAppCopyrightOption(packageOptions);
packageOptions = maybeNoAppVersionOption(packageOptions);
packageOptions = maybeNoBuildVersionOption(packageOptions);
packageOptions = maybeNoVersionStringOption(packageOptions);
packageOptions = maybeNoWin32metadataOption(packageOptions);
packagerConsole.override();
packager(packageOptions)
.then((appPathArray) => {
packagerConsole.restore(); // restore console.error
cb(null, opts, appPathArray); // options still contain the icon to waterfall
})
.catch((error) => {
packagerConsole.restore(); // restore console.error
cb(error, opts); // options still contain the icon to waterfall
});
},
(opts, appPathArray, cb) => {
progress.tick('finalizing');
// somehow appPathArray is a 1 element array
const appPath = getAppPath(appPathArray);
if (!appPath) {
cb();
return;
}
maybeCopyIcons(opts, appPath, (error) => {
cb(error, appPath);
});
},
],
(error, appPath) => {
packagerConsole.playback();
callback(error, appPath);
},
);
} | [
"function",
"buildMain",
"(",
"inpOptions",
",",
"callback",
")",
"{",
"const",
"options",
"=",
"Object",
".",
"assign",
"(",
"{",
"}",
",",
"inpOptions",
")",
";",
"// pre process app",
"const",
"tmpObj",
"=",
"tmp",
".",
"dirSync",
"(",
"{",
"mode",
":... | @callback buildAppCallback
@param error
@param {string} appPath
@param {{}} inpOptions
@param {buildAppCallback} callback | [
"@callback",
"buildAppCallback",
"@param",
"error",
"@param",
"{",
"string",
"}",
"appPath"
] | b959956a38ce51a9dd95d42308f0a6c66489b624 | https://github.com/jiahaog/nativefier/blob/b959956a38ce51a9dd95d42308f0a6c66489b624/src/build/buildMain.js#L159-L245 | train | Main function. | [
30522,
3853,
3857,
24238,
1006,
1999,
16340,
9285,
1010,
2655,
5963,
1007,
1063,
9530,
3367,
7047,
1027,
4874,
1012,
23911,
1006,
1063,
1065,
1010,
1999,
16340,
9285,
1007,
1025,
1013,
1013,
3653,
2832,
10439,
9530,
3367,
30524,
8737,
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... |
jgraph/mxgraph | javascript/mxClient.js | mxPopupMenuHandler | function mxPopupMenuHandler(graph, factoryMethod)
{
if (graph != null)
{
this.graph = graph;
this.factoryMethod = factoryMethod;
this.graph.addMouseListener(this);
// Does not show menu if any touch gestures take place after the trigger
this.gestureHandler = mxUtils.bind(this, function(sender, eo)
{
this.inTolerance = false;
});
this.graph.addListener(mxEvent.GESTURE, this.gestureHandler);
this.init();
}
} | javascript | function mxPopupMenuHandler(graph, factoryMethod)
{
if (graph != null)
{
this.graph = graph;
this.factoryMethod = factoryMethod;
this.graph.addMouseListener(this);
// Does not show menu if any touch gestures take place after the trigger
this.gestureHandler = mxUtils.bind(this, function(sender, eo)
{
this.inTolerance = false;
});
this.graph.addListener(mxEvent.GESTURE, this.gestureHandler);
this.init();
}
} | [
"function",
"mxPopupMenuHandler",
"(",
"graph",
",",
"factoryMethod",
")",
"{",
"if",
"(",
"graph",
"!=",
"null",
")",
"{",
"this",
".",
"graph",
"=",
"graph",
";",
"this",
".",
"factoryMethod",
"=",
"factoryMethod",
";",
"this",
".",
"graph",
".",
"addM... | Copyright (c) 2006-2015, JGraph Ltd
Copyright (c) 2006-2015, Gaudenz Alder
Class: mxPopupMenuHandler
Event handler that creates popupmenus.
Constructor: mxPopupMenuHandler
Constructs an event handler that creates a <mxPopupMenu>. | [
"Copyright",
"(",
"c",
")",
"2006",
"-",
"2015",
"JGraph",
"Ltd",
"Copyright",
"(",
"c",
")",
"2006",
"-",
"2015",
"Gaudenz",
"Alder",
"Class",
":",
"mxPopupMenuHandler"
] | 33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44 | https://github.com/jgraph/mxgraph/blob/33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44/javascript/mxClient.js#L71076-L71094 | train | A function that is called when the popup menu is shown | [
30522,
3853,
25630,
16340,
6279,
3549,
27225,
5685,
3917,
1006,
10629,
1010,
4713,
11368,
6806,
2094,
1007,
1063,
2065,
1006,
10629,
999,
1027,
19701,
1007,
1063,
2023,
1012,
10629,
1027,
10629,
1025,
2023,
1012,
4713,
11368,
6806,
2094,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
eslint/eslint | lib/rules/lines-around-comment.js | getEmptyLineNums | function getEmptyLineNums(lines) {
const emptyLines = lines.map((line, i) => ({
code: line.trim(),
num: i + 1
})).filter(line => !line.code).map(line => line.num);
return emptyLines;
} | javascript | function getEmptyLineNums(lines) {
const emptyLines = lines.map((line, i) => ({
code: line.trim(),
num: i + 1
})).filter(line => !line.code).map(line => line.num);
return emptyLines;
} | [
"function",
"getEmptyLineNums",
"(",
"lines",
")",
"{",
"const",
"emptyLines",
"=",
"lines",
".",
"map",
"(",
"(",
"line",
",",
"i",
")",
"=>",
"(",
"{",
"code",
":",
"line",
".",
"trim",
"(",
")",
",",
"num",
":",
"i",
"+",
"1",
"}",
")",
")",... | ------------------------------------------------------------------------------ Helpers ------------------------------------------------------------------------------
Return an array with with any line numbers that are empty.
@param {Array} lines An array of each line of the file.
@returns {Array} An array of line numbers. | [
"------------------------------------------------------------------------------",
"Helpers",
"------------------------------------------------------------------------------",
"Return",
"an",
"array",
"with",
"with",
"any",
"line",
"numbers",
"that",
"are",
"empty",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/lines-around-comment.js#L23-L30 | train | Returns an array of empty lines | [
30522,
3853,
2131,
6633,
13876,
8516,
21820,
18163,
1006,
3210,
1007,
1063,
9530,
3367,
4064,
12735,
1027,
3210,
1012,
4949,
1006,
1006,
2240,
1010,
1045,
1007,
1027,
1028,
1006,
1063,
3642,
1024,
2240,
1012,
12241,
1006,
1007,
1010,
16371,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
angular/material | src/core/services/gesture/gesture.js | isInputEventFromLabelClick | function isInputEventFromLabelClick(event) {
return lastLabelClickPos
&& lastLabelClickPos.x == event.x
&& lastLabelClickPos.y == event.y;
} | javascript | function isInputEventFromLabelClick(event) {
return lastLabelClickPos
&& lastLabelClickPos.x == event.x
&& lastLabelClickPos.y == event.y;
} | [
"function",
"isInputEventFromLabelClick",
"(",
"event",
")",
"{",
"return",
"lastLabelClickPos",
"&&",
"lastLabelClickPos",
".",
"x",
"==",
"event",
".",
"x",
"&&",
"lastLabelClickPos",
".",
"y",
"==",
"event",
".",
"y",
";",
"}"
] | Gets whether the given event is an input event that was caused by clicking on an
associated label element.
This is necessary because the browser will, upon clicking on a label element, fire an
*extra* click event on its associated input (if any). mdGesture is able to flag the label
click as with `$material` correctly, but not the second input click.
In order to determine whether an input event is from a label click, we compare the (x, y) for
the event to the (x, y) for the most recent label click (which is cleared whenever a non-label
click occurs). Unfortunately, there are no event properties that tie the input and the label
together (such as relatedTarget).
@param {MouseEvent} event
@returns {boolean} | [
"Gets",
"whether",
"the",
"given",
"event",
"is",
"an",
"input",
"event",
"that",
"was",
"caused",
"by",
"clicking",
"on",
"an",
"associated",
"label",
"element",
"."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/services/gesture/gesture.js#L741-L745 | train | Check if the event is an input event from a label click | [
30522,
3853,
2003,
2378,
18780,
18697,
3372,
19699,
5358,
20470,
2884,
20464,
6799,
1006,
2724,
1007,
1063,
2709,
2197,
20470,
2884,
20464,
6799,
6873,
2015,
1004,
1004,
2197,
20470,
2884,
20464,
6799,
6873,
2015,
1012,
1060,
1027,
1027,
27... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/thirdparty/less.js | function () {
var selectors, s, rules, debugInfo;
save();
if (env.dumpLineNumbers) {
debugInfo = getDebugInfo(i, input, env);
}
while (true) {
s = this.lessSelector();
if (!s) {
break;
}
if (selectors) { selectors.push(s); } else { selectors = [ s ]; }
this.comments();
if (s.condition && selectors.length > 1) {
error("Guards are only currently allowed on a single selector.");
}
if (! $char(',')) { break; }
if (s.condition) {
error("Guards are only currently allowed on a single selector.");
}
this.comments();
}
if (selectors && (rules = this.block())) {
var ruleset = new(tree.Ruleset)(selectors, rules, env.strictImports);
if (env.dumpLineNumbers) {
ruleset.debugInfo = debugInfo;
}
return ruleset;
} else {
// Backtrack
furthest = i;
restore();
}
} | javascript | function () {
var selectors, s, rules, debugInfo;
save();
if (env.dumpLineNumbers) {
debugInfo = getDebugInfo(i, input, env);
}
while (true) {
s = this.lessSelector();
if (!s) {
break;
}
if (selectors) { selectors.push(s); } else { selectors = [ s ]; }
this.comments();
if (s.condition && selectors.length > 1) {
error("Guards are only currently allowed on a single selector.");
}
if (! $char(',')) { break; }
if (s.condition) {
error("Guards are only currently allowed on a single selector.");
}
this.comments();
}
if (selectors && (rules = this.block())) {
var ruleset = new(tree.Ruleset)(selectors, rules, env.strictImports);
if (env.dumpLineNumbers) {
ruleset.debugInfo = debugInfo;
}
return ruleset;
} else {
// Backtrack
furthest = i;
restore();
}
} | [
"function",
"(",
")",
"{",
"var",
"selectors",
",",
"s",
",",
"rules",
",",
"debugInfo",
";",
"save",
"(",
")",
";",
"if",
"(",
"env",
".",
"dumpLineNumbers",
")",
"{",
"debugInfo",
"=",
"getDebugInfo",
"(",
"i",
",",
"input",
",",
"env",
")",
";",... | div, .class, body > p {...} | [
"div",
".",
"class",
"body",
">",
"p",
"{",
"...",
"}"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/less.js#L1475-L1512 | train | Parse a rule set | [
30522,
3853,
1006,
1007,
1063,
13075,
27000,
2015,
1010,
1055,
1010,
3513,
1010,
2139,
8569,
11528,
14876,
1025,
3828,
1006,
1007,
1025,
2065,
1006,
4372,
2615,
1012,
15653,
4179,
19172,
17198,
1007,
1063,
2139,
8569,
11528,
14876,
1027,
21... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
ecomfe/zrender | src/Painter.js | function (cb, context) {
var zlevelList = this._zlevelList;
var z;
var i;
for (i = 0; i < zlevelList.length; i++) {
z = zlevelList[i];
cb.call(context, this._layers[z], z);
}
} | javascript | function (cb, context) {
var zlevelList = this._zlevelList;
var z;
var i;
for (i = 0; i < zlevelList.length; i++) {
z = zlevelList[i];
cb.call(context, this._layers[z], z);
}
} | [
"function",
"(",
"cb",
",",
"context",
")",
"{",
"var",
"zlevelList",
"=",
"this",
".",
"_zlevelList",
";",
"var",
"z",
";",
"var",
"i",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"zlevelList",
".",
"length",
";",
"i",
"++",
")",
"{",
"z",
... | Iterate each layer | [
"Iterate",
"each",
"layer"
] | 30321b57cba3149c30eacb0c1e18276f0f001b9f | https://github.com/ecomfe/zrender/blob/30321b57cba3149c30eacb0c1e18276f0f001b9f/src/Painter.js#L634-L642 | train | call the callback for each layer | [
30522,
3853,
1006,
17324,
1010,
6123,
1007,
1063,
13075,
1062,
20414,
13348,
3367,
1027,
2023,
1012,
1035,
1062,
20414,
13348,
3367,
1025,
13075,
1062,
1025,
13075,
1045,
1025,
2005,
1006,
1045,
1027,
1014,
1025,
1045,
1026,
1062,
20414,
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/AnnotationParser.js | function(applyNode) {
var xPath = AnnotationParser._oXPath;
var mApply = {
Name: applyNode.getAttribute('Function'),
Parameters: []
};
var oParameterNodes = xPath.selectNodes("./d:*", applyNode);
for (var i = 0; i < oParameterNodes.length; i += 1) {
var oParameterNode = xPath.nextNode(oParameterNodes, i);
var mParameter = {
Type: oParameterNode.nodeName
};
if (oParameterNode.nodeName === "Apply") {
mParameter.Value = AnnotationParser.getApplyFunctions(oParameterNode);
} else if (oParameterNode.nodeName === "LabeledElement") {
mParameter.Value = AnnotationParser.getPropertyValue(oParameterNode);
// Move the name attribute up one level to keep compatibility with earlier implementation
mParameter.Name = mParameter.Value.Name;
delete mParameter.Value.Name;
} else if (mMultipleArgumentDynamicExpressions[oParameterNode.nodeName]) {
mParameter.Value = AnnotationParser.getPropertyValue(oParameterNode);
} else {
mParameter.Value = xPath.getNodeText(oParameterNode);
}
mApply.Parameters.push(mParameter);
}
return mApply;
} | javascript | function(applyNode) {
var xPath = AnnotationParser._oXPath;
var mApply = {
Name: applyNode.getAttribute('Function'),
Parameters: []
};
var oParameterNodes = xPath.selectNodes("./d:*", applyNode);
for (var i = 0; i < oParameterNodes.length; i += 1) {
var oParameterNode = xPath.nextNode(oParameterNodes, i);
var mParameter = {
Type: oParameterNode.nodeName
};
if (oParameterNode.nodeName === "Apply") {
mParameter.Value = AnnotationParser.getApplyFunctions(oParameterNode);
} else if (oParameterNode.nodeName === "LabeledElement") {
mParameter.Value = AnnotationParser.getPropertyValue(oParameterNode);
// Move the name attribute up one level to keep compatibility with earlier implementation
mParameter.Name = mParameter.Value.Name;
delete mParameter.Value.Name;
} else if (mMultipleArgumentDynamicExpressions[oParameterNode.nodeName]) {
mParameter.Value = AnnotationParser.getPropertyValue(oParameterNode);
} else {
mParameter.Value = xPath.getNodeText(oParameterNode);
}
mApply.Parameters.push(mParameter);
}
return mApply;
} | [
"function",
"(",
"applyNode",
")",
"{",
"var",
"xPath",
"=",
"AnnotationParser",
".",
"_oXPath",
";",
"var",
"mApply",
"=",
"{",
"Name",
":",
"applyNode",
".",
"getAttribute",
"(",
"'Function'",
")",
",",
"Parameters",
":",
"[",
"]",
"}",
";",
"var",
"... | /*
@static
@private | [
"/",
"*"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/AnnotationParser.js#L1112-L1145 | train | Returns the apply function | [
30522,
3853,
1006,
6611,
3630,
3207,
1007,
1063,
13075,
26726,
8988,
1027,
5754,
17287,
3508,
19362,
8043,
1012,
1035,
23060,
15069,
1025,
13075,
4949,
22086,
1027,
1063,
2171,
1024,
6611,
3630,
3207,
1012,
2131,
19321,
3089,
8569,
2618,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | src/sap.ui.fl/src/sap/ui/fl/descriptorRelated/api/DescriptorVariantFactory.js | function(mParameters, mFileContent, bDeletion, oSettings) {
if (mParameters && bDeletion) {
this._id = mParameters.id;
this._mode = 'DELETION';
this._mMap = mFileContent;
} else if (mParameters) {
this._id = mParameters.id;
this._reference = mParameters.reference;
this._layer = mParameters.layer;
if ( typeof mParameters.isAppVariantRoot != "undefined"){
this._isAppVariantRoot = mParameters.isAppVariantRoot;
}
if ( typeof mParameters.referenceVersion != "undefined"){
this._referenceVersion = mParameters.referenceVersion;
}
this._mode = 'NEW';
this._skipIam = mParameters.skipIam;
this._version = mParameters.version;
} else if (mFileContent) {
this._mMap = mFileContent;
this._mode = 'FROM_EXISTING';
}
this._oSettings = oSettings;
this._sTransportRequest = null;
this._content = [];
} | javascript | function(mParameters, mFileContent, bDeletion, oSettings) {
if (mParameters && bDeletion) {
this._id = mParameters.id;
this._mode = 'DELETION';
this._mMap = mFileContent;
} else if (mParameters) {
this._id = mParameters.id;
this._reference = mParameters.reference;
this._layer = mParameters.layer;
if ( typeof mParameters.isAppVariantRoot != "undefined"){
this._isAppVariantRoot = mParameters.isAppVariantRoot;
}
if ( typeof mParameters.referenceVersion != "undefined"){
this._referenceVersion = mParameters.referenceVersion;
}
this._mode = 'NEW';
this._skipIam = mParameters.skipIam;
this._version = mParameters.version;
} else if (mFileContent) {
this._mMap = mFileContent;
this._mode = 'FROM_EXISTING';
}
this._oSettings = oSettings;
this._sTransportRequest = null;
this._content = [];
} | [
"function",
"(",
"mParameters",
",",
"mFileContent",
",",
"bDeletion",
",",
"oSettings",
")",
"{",
"if",
"(",
"mParameters",
"&&",
"bDeletion",
")",
"{",
"this",
".",
"_id",
"=",
"mParameters",
".",
"id",
";",
"this",
".",
"_mode",
"=",
"'DELETION'",
";"... | App variant/CDM app config
@param {object} mParameters parameters
@param {string} mParameters.id the id of the app variant/CDM app config id to be provided for a new app variant/CDM app config and for deleting a app variant/CDM app config
@param {string} mParameters.reference the proposed referenced descriptor or app variant/CDM app config id (might be overwritten by the backend) to be provided when creating a new app variant/CDM app config
@param {string} [mParameters.version] version of the app variant (optional)
@param {string} [mParameters.layer='CUSTOMER] the proposed layer (might be overwritten by the backend) when creating a new app variant/CDM app config
@param {boolean} [mParameters.isAppVariantRoot=true] indicator whether this is an app variant, default is true
@param {object} mFileContent file content of the existing app variant/CDM app config to be provided if app variant/CDM app config shall be created from an existing
@param {boolean} [bDeletion=false] deletion indicator to be provided if app variant/CDM app config shall be deleted
@param {sap.ui.fl.registry.Settings} oSettings settings
@constructor
@alias sap.ui.fl.descriptorRelated.api.DescriptorVariant
@author SAP SE
@version ${version}
@private
@sap-restricted
App variant/CDM app config | [
"App",
"variant",
"/",
"CDM",
"app",
"config"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/descriptorRelated/api/DescriptorVariantFactory.js#L43-L69 | train | This function is called by the constructor to create a new object | [
30522,
3853,
1006,
6131,
5400,
22828,
2015,
1010,
1049,
8873,
2571,
8663,
6528,
2102,
1010,
1038,
9247,
20624,
2239,
1010,
9808,
18319,
3070,
2015,
1007,
1063,
2065,
1006,
6131,
5400,
22828,
2015,
1004,
1004,
1038,
9247,
20624,
2239,
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... | |
jgraph/mxgraph | javascript/mxClient.js | function(str, pattern)
{
// LATER: Check is this can be done with a regular expression
var postfix = '';
while (str.length > 0 && str.charAt(str.length - 1) == '\n')
{
str = str.substring(0, str.length - 1);
postfix += pattern;
}
return str + postfix;
} | javascript | function(str, pattern)
{
// LATER: Check is this can be done with a regular expression
var postfix = '';
while (str.length > 0 && str.charAt(str.length - 1) == '\n')
{
str = str.substring(0, str.length - 1);
postfix += pattern;
}
return str + postfix;
} | [
"function",
"(",
"str",
",",
"pattern",
")",
"{",
"// LATER: Check is this can be done with a regular expression",
"var",
"postfix",
"=",
"''",
";",
"while",
"(",
"str",
".",
"length",
">",
"0",
"&&",
"str",
".",
"charAt",
"(",
"str",
".",
"length",
"-",
"1"... | Function: replaceTrailingNewlines
Replaces each trailing newline with the given pattern. | [
"Function",
":",
"replaceTrailingNewlines"
] | 33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44 | https://github.com/jgraph/mxgraph/blob/33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44/javascript/mxClient.js#L3064-L3076 | train | Returns a string that matches the specified regular expression | [
30522,
3853,
1006,
2358,
2099,
1010,
5418,
1007,
1063,
1013,
1013,
2101,
1024,
4638,
2003,
2023,
2064,
2022,
2589,
2007,
1037,
3180,
3670,
13075,
2695,
8873,
2595,
1027,
1005,
1005,
1025,
2096,
1006,
2358,
2099,
1012,
3091,
1028,
1014,
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... | |
lovell/sharp | lib/colour.js | toColourspace | function toColourspace (colourspace) {
if (!is.string(colourspace)) {
throw new Error('Invalid output colourspace ' + colourspace);
}
this.options.colourspace = colourspace;
return this;
} | javascript | function toColourspace (colourspace) {
if (!is.string(colourspace)) {
throw new Error('Invalid output colourspace ' + colourspace);
}
this.options.colourspace = colourspace;
return this;
} | [
"function",
"toColourspace",
"(",
"colourspace",
")",
"{",
"if",
"(",
"!",
"is",
".",
"string",
"(",
"colourspace",
")",
")",
"{",
"throw",
"new",
"Error",
"(",
"'Invalid output colourspace '",
"+",
"colourspace",
")",
";",
"}",
"this",
".",
"options",
"."... | Set the output colourspace.
By default output image will be web-friendly sRGB, with additional channels interpreted as alpha channels.
@param {String} [colourspace] - output colourspace e.g. `srgb`, `rgb`, `cmyk`, `lab`, `b-w` [...](https://github.com/libvips/libvips/blob/master/libvips/iofuncs/enumtypes.c#L568)
@returns {Sharp}
@throws {Error} Invalid parameters | [
"Set",
"the",
"output",
"colourspace",
".",
"By",
"default",
"output",
"image",
"will",
"be",
"web",
"-",
"friendly",
"sRGB",
"with",
"additional",
"channels",
"interpreted",
"as",
"alpha",
"channels",
"."
] | 05d76eeadfe54713606a615185b2da047923406b | https://github.com/lovell/sharp/blob/05d76eeadfe54713606a615185b2da047923406b/lib/colour.js#L64-L70 | train | Convert the colourspace to a colourspace | [
30522,
3853,
2000,
25778,
22957,
15327,
1006,
8604,
15327,
1007,
1063,
2065,
1006,
999,
2003,
1012,
5164,
1006,
8604,
15327,
1007,
1007,
1063,
5466,
2047,
7561,
1006,
1005,
19528,
6434,
8604,
15327,
1005,
1009,
8604,
15327,
1007,
1025,
1065... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/model/analytics/odata4analytics.js | function() {
if (this._aParameterNames) {
return this._aParameterNames;
}
this._aParameterNames = [];
for ( var sName in this._oParameterSet) {
this._aParameterNames.push(this._oParameterSet[sName].getName());
}
return this._aParameterNames;
} | javascript | function() {
if (this._aParameterNames) {
return this._aParameterNames;
}
this._aParameterNames = [];
for ( var sName in this._oParameterSet) {
this._aParameterNames.push(this._oParameterSet[sName].getName());
}
return this._aParameterNames;
} | [
"function",
"(",
")",
"{",
"if",
"(",
"this",
".",
"_aParameterNames",
")",
"{",
"return",
"this",
".",
"_aParameterNames",
";",
"}",
"this",
".",
"_aParameterNames",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"sName",
"in",
"this",
".",
"_oParameterSet",
... | Get the names of all parameters part of the parameterization
@returns {string[]} List of all parameter names
@public
@function
@name sap.ui.model.analytics.odata4analytics.Parameterization#getAllParameterNames | [
"Get",
"the",
"names",
"of",
"all",
"parameters",
"part",
"of",
"the",
"parameterization"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/analytics/odata4analytics.js#L1337-L1349 | train | Returns an array of parameter names | [
30522,
3853,
1006,
1007,
1063,
2065,
1006,
2023,
1012,
1035,
9706,
5400,
22828,
18442,
2015,
1007,
1063,
2709,
2023,
1012,
1035,
9706,
5400,
22828,
18442,
2015,
1025,
1065,
2023,
1012,
1035,
9706,
5400,
22828,
18442,
2015,
1027,
1031,
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... | |
summernote/summernote | src/js/base/core/dom.js | isEmpty | function isEmpty(node) {
const len = nodeLength(node);
if (len === 0) {
return true;
} else if (!isText(node) && len === 1 && node.innerHTML === blankHTML) {
// ex) <p><br></p>, <span><br></span>
return true;
} else if (lists.all(node.childNodes, isText) && node.innerHTML === '') {
// ex) <p></p>, <span></span>
return true;
}
return false;
} | javascript | function isEmpty(node) {
const len = nodeLength(node);
if (len === 0) {
return true;
} else if (!isText(node) && len === 1 && node.innerHTML === blankHTML) {
// ex) <p><br></p>, <span><br></span>
return true;
} else if (lists.all(node.childNodes, isText) && node.innerHTML === '') {
// ex) <p></p>, <span></span>
return true;
}
return false;
} | [
"function",
"isEmpty",
"(",
"node",
")",
"{",
"const",
"len",
"=",
"nodeLength",
"(",
"node",
")",
";",
"if",
"(",
"len",
"===",
"0",
")",
"{",
"return",
"true",
";",
"}",
"else",
"if",
"(",
"!",
"isText",
"(",
"node",
")",
"&&",
"len",
"===",
... | returns whether node is empty or not.
@param {Node} node
@return {Boolean} | [
"returns",
"whether",
"node",
"is",
"empty",
"or",
"not",
"."
] | 8dcafb8107453006b905ef697a529c42e76beb3f | https://github.com/summernote/summernote/blob/8dcafb8107453006b905ef697a529c42e76beb3f/src/js/base/core/dom.js#L208-L222 | train | returns true if node is empty | [
30522,
3853,
2003,
6633,
13876,
2100,
1006,
13045,
1007,
1063,
9530,
3367,
18798,
1027,
13045,
7770,
13512,
2232,
1006,
13045,
1007,
1025,
2065,
1006,
18798,
1027,
1027,
1027,
1014,
1007,
1063,
2709,
2995,
1025,
1065,
2842,
2065,
1006,
999,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
summernote/summernote | src/js/base/core/lists.js | prev | function prev(array, item) {
if (array && array.length && item) {
const idx = array.indexOf(item);
return idx === -1 ? null : array[idx - 1];
}
return null;
} | javascript | function prev(array, item) {
if (array && array.length && item) {
const idx = array.indexOf(item);
return idx === -1 ? null : array[idx - 1];
}
return null;
} | [
"function",
"prev",
"(",
"array",
",",
"item",
")",
"{",
"if",
"(",
"array",
"&&",
"array",
".",
"length",
"&&",
"item",
")",
"{",
"const",
"idx",
"=",
"array",
".",
"indexOf",
"(",
"item",
")",
";",
"return",
"idx",
"===",
"-",
"1",
"?",
"null",... | returns prev item.
@param {Array} array | [
"returns",
"prev",
"item",
"."
] | 8dcafb8107453006b905ef697a529c42e76beb3f | https://github.com/summernote/summernote/blob/8dcafb8107453006b905ef697a529c42e76beb3f/src/js/base/core/lists.js#L175-L181 | train | Returns the previous item in an array | [
30522,
3853,
3653,
2615,
1006,
9140,
1010,
8875,
1007,
1063,
2065,
1006,
9140,
1004,
1004,
9140,
1012,
3091,
1004,
1004,
8875,
1007,
1063,
9530,
3367,
8909,
2595,
1027,
9140,
1012,
5950,
11253,
1006,
8875,
1007,
1025,
2709,
8909,
2595,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.commons/src/sap/ui/commons/SearchField.js | function(oThis){
var $this = oThis.$(),
$ico = oThis._ctrl.$("searchico");
if ($this.hasClass("sapUiSearchFieldClear") && $this.hasClass("sapUiSearchFieldVal")) {
$ico.attr("title", oThis._clearTooltipText);
} else {
$ico.removeAttr("title");
}
} | javascript | function(oThis){
var $this = oThis.$(),
$ico = oThis._ctrl.$("searchico");
if ($this.hasClass("sapUiSearchFieldClear") && $this.hasClass("sapUiSearchFieldVal")) {
$ico.attr("title", oThis._clearTooltipText);
} else {
$ico.removeAttr("title");
}
} | [
"function",
"(",
"oThis",
")",
"{",
"var",
"$this",
"=",
"oThis",
".",
"$",
"(",
")",
",",
"$ico",
"=",
"oThis",
".",
"_ctrl",
".",
"$",
"(",
"\"searchico\"",
")",
";",
"if",
"(",
"$this",
".",
"hasClass",
"(",
"\"sapUiSearchFieldClear\"",
")",
"&&",... | *********************************************** Private helper functions *********************************************** | [
"***********************************************",
"Private",
"helper",
"functions",
"***********************************************"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.commons/src/sap/ui/commons/SearchField.js#L544-L553 | train | Sets the tooltip text for the clear button | [
30522,
3853,
1006,
27178,
24158,
1007,
1063,
13075,
1002,
2023,
1027,
27178,
24158,
1012,
1002,
1006,
1007,
1010,
30524,
1006,
1000,
3945,
11261,
1000,
1007,
1025,
2065,
1006,
1002,
2023,
1012,
2038,
26266,
1006,
1000,
20066,
27020,
14644,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/ast-utils.js | getOpeningParenOfParams | function getOpeningParenOfParams(node, sourceCode) {
return node.id
? sourceCode.getTokenAfter(node.id, isOpeningParenToken)
: sourceCode.getFirstToken(node, isOpeningParenToken);
} | javascript | function getOpeningParenOfParams(node, sourceCode) {
return node.id
? sourceCode.getTokenAfter(node.id, isOpeningParenToken)
: sourceCode.getFirstToken(node, isOpeningParenToken);
} | [
"function",
"getOpeningParenOfParams",
"(",
"node",
",",
"sourceCode",
")",
"{",
"return",
"node",
".",
"id",
"?",
"sourceCode",
".",
"getTokenAfter",
"(",
"node",
".",
"id",
",",
"isOpeningParenToken",
")",
":",
"sourceCode",
".",
"getFirstToken",
"(",
"node"... | Gets the `(` token of the given function node.
@param {ASTNode} node - The function node to get.
@param {SourceCode} sourceCode - The source code object to get tokens.
@returns {Token} `(` token. | [
"Gets",
"the",
"(",
"token",
"of",
"the",
"given",
"function",
"node",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/util/ast-utils.js#L390-L394 | train | Gets the opening parenthesis of a function call. | [
30522,
3853,
2131,
26915,
2075,
19362,
16515,
22540,
5400,
5244,
1006,
13045,
1010,
3120,
16044,
1007,
1063,
2709,
13045,
1012,
8909,
1029,
3120,
16044,
1012,
2131,
18715,
8189,
6199,
2121,
1006,
13045,
1012,
8909,
1010,
11163,
11837,
2075,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
eslint/eslint | lib/rules/space-before-function-paren.js | getConfigForFunction | function getConfigForFunction(node) {
if (node.type === "ArrowFunctionExpression") {
// Always ignore non-async functions and arrow functions without parens, e.g. async foo => bar
if (node.async && astUtils.isOpeningParenToken(sourceCode.getFirstToken(node, { skip: 1 }))) {
return overrideConfig.asyncArrow || baseConfig;
}
} else if (isNamedFunction(node)) {
return overrideConfig.named || baseConfig;
// `generator-star-spacing` should warn anonymous generators. E.g. `function* () {}`
} else if (!node.generator) {
return overrideConfig.anonymous || baseConfig;
}
return "ignore";
} | javascript | function getConfigForFunction(node) {
if (node.type === "ArrowFunctionExpression") {
// Always ignore non-async functions and arrow functions without parens, e.g. async foo => bar
if (node.async && astUtils.isOpeningParenToken(sourceCode.getFirstToken(node, { skip: 1 }))) {
return overrideConfig.asyncArrow || baseConfig;
}
} else if (isNamedFunction(node)) {
return overrideConfig.named || baseConfig;
// `generator-star-spacing` should warn anonymous generators. E.g. `function* () {}`
} else if (!node.generator) {
return overrideConfig.anonymous || baseConfig;
}
return "ignore";
} | [
"function",
"getConfigForFunction",
"(",
"node",
")",
"{",
"if",
"(",
"node",
".",
"type",
"===",
"\"ArrowFunctionExpression\"",
")",
"{",
"// Always ignore non-async functions and arrow functions without parens, e.g. async foo => bar",
"if",
"(",
"node",
".",
"async",
"&&"... | Gets the config for a given function
@param {ASTNode} node The function node
@returns {string} "always", "never", or "ignore" | [
"Gets",
"the",
"config",
"for",
"a",
"given",
"function"
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/space-before-function-paren.js#L88-L104 | train | Returns the config for a function | [
30522,
3853,
2131,
8663,
8873,
25708,
16347,
4609,
7542,
1006,
13045,
1007,
1063,
2065,
1006,
13045,
1012,
2828,
1027,
1027,
1027,
1000,
8612,
11263,
27989,
10288,
20110,
3258,
1000,
1007,
1063,
1013,
1013,
2467,
8568,
2512,
1011,
2004,
603... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/extensions/default/JavaScriptCodeHints/main.js | getHintResponse | function getHintResponse(hints, query, type) {
var trimmedQuery,
formattedHints;
if (setConfig.config.debug) {
console.debug("Hints", _.pluck(hints, "label"));
}
function formatTypeDataForToken($hintObj, token) {
if (!hintDetailsEnabled) {
return;
}
$hintObj.addClass('brackets-js-hints-with-type-details');
(function _appendLink() {
if (token.url) {
$('<a></a>').appendTo($hintObj).addClass("jshint-link").attr('href', token.url).on("click", function (event) {
event.stopImmediatePropagation();
event.stopPropagation();
});
}
}());
if (token.type) {
if (token.type.trim() !== '?') {
if (token.type.length < 30) {
$('<span>' + token.type.split('->').join(':').toString().trim() + '</span>').appendTo($hintObj).addClass("brackets-js-hints-type-details");
}
$('<span>' + token.type.split('->').join(':').toString().trim() + '</span>').appendTo($hintObj).addClass("jshint-description");
}
} else {
if (token.keyword) {
$('<span>keyword</span>').appendTo($hintObj).addClass("brackets-js-hints-keyword");
}
}
if (token.doc) {
$hintObj.attr('title', token.doc);
$('<span></span>').text(token.doc.trim()).appendTo($hintObj).addClass("jshint-jsdoc");
}
}
/*
* Returns a formatted list of hints with the query substring
* highlighted.
*
* @param {Array.<Object>} hints - the list of hints to format
* @param {string} query - querystring used for highlighting matched
* poritions of each hint
* @return {jQuery.Deferred|{
* hints: Array.<string|jQueryObject>,
* match: string,
* selectInitial: boolean,
* handleWideResults: boolean}}
*/
function formatHints(hints, query) {
return hints.map(function (token) {
var $hintObj = $("<span>").addClass("brackets-js-hints");
// level indicates either variable scope or property confidence
if (!type.property && !token.builtin && token.depth !== undefined) {
switch (token.depth) {
case 0:
$hintObj.addClass("priority-high");
break;
case 1:
$hintObj.addClass("priority-medium");
break;
case 2:
$hintObj.addClass("priority-low");
break;
default:
$hintObj.addClass("priority-lowest");
break;
}
}
if (token.guess) {
$hintObj.addClass("guess-hint");
}
// is the token a keyword?
if (token.keyword) {
$hintObj.addClass("keyword-hint");
}
if (token.literal) {
$hintObj.addClass("literal-hint");
}
// highlight the matched portion of each hint
if (token.stringRanges) {
token.stringRanges.forEach(function (item) {
if (item.matched) {
$hintObj.append($("<span>")
.append(_.escape(item.text))
.addClass("matched-hint"));
} else {
$hintObj.append(_.escape(item.text));
}
});
} else {
$hintObj.text(token.value);
}
$hintObj.data("token", token);
formatTypeDataForToken($hintObj, token);
return $hintObj;
});
}
// trim leading and trailing string literal delimiters from the query
trimmedQuery = _.trim(query, HintUtils.SINGLE_QUOTE + HintUtils.DOUBLE_QUOTE);
if (hints) {
formattedHints = formatHints(hints, trimmedQuery);
} else {
formattedHints = [];
}
return {
hints: formattedHints,
match: null, // the CodeHintManager should not format the results
selectInitial: true,
handleWideResults: hints.handleWideResults
};
} | javascript | function getHintResponse(hints, query, type) {
var trimmedQuery,
formattedHints;
if (setConfig.config.debug) {
console.debug("Hints", _.pluck(hints, "label"));
}
function formatTypeDataForToken($hintObj, token) {
if (!hintDetailsEnabled) {
return;
}
$hintObj.addClass('brackets-js-hints-with-type-details');
(function _appendLink() {
if (token.url) {
$('<a></a>').appendTo($hintObj).addClass("jshint-link").attr('href', token.url).on("click", function (event) {
event.stopImmediatePropagation();
event.stopPropagation();
});
}
}());
if (token.type) {
if (token.type.trim() !== '?') {
if (token.type.length < 30) {
$('<span>' + token.type.split('->').join(':').toString().trim() + '</span>').appendTo($hintObj).addClass("brackets-js-hints-type-details");
}
$('<span>' + token.type.split('->').join(':').toString().trim() + '</span>').appendTo($hintObj).addClass("jshint-description");
}
} else {
if (token.keyword) {
$('<span>keyword</span>').appendTo($hintObj).addClass("brackets-js-hints-keyword");
}
}
if (token.doc) {
$hintObj.attr('title', token.doc);
$('<span></span>').text(token.doc.trim()).appendTo($hintObj).addClass("jshint-jsdoc");
}
}
/*
* Returns a formatted list of hints with the query substring
* highlighted.
*
* @param {Array.<Object>} hints - the list of hints to format
* @param {string} query - querystring used for highlighting matched
* poritions of each hint
* @return {jQuery.Deferred|{
* hints: Array.<string|jQueryObject>,
* match: string,
* selectInitial: boolean,
* handleWideResults: boolean}}
*/
function formatHints(hints, query) {
return hints.map(function (token) {
var $hintObj = $("<span>").addClass("brackets-js-hints");
// level indicates either variable scope or property confidence
if (!type.property && !token.builtin && token.depth !== undefined) {
switch (token.depth) {
case 0:
$hintObj.addClass("priority-high");
break;
case 1:
$hintObj.addClass("priority-medium");
break;
case 2:
$hintObj.addClass("priority-low");
break;
default:
$hintObj.addClass("priority-lowest");
break;
}
}
if (token.guess) {
$hintObj.addClass("guess-hint");
}
// is the token a keyword?
if (token.keyword) {
$hintObj.addClass("keyword-hint");
}
if (token.literal) {
$hintObj.addClass("literal-hint");
}
// highlight the matched portion of each hint
if (token.stringRanges) {
token.stringRanges.forEach(function (item) {
if (item.matched) {
$hintObj.append($("<span>")
.append(_.escape(item.text))
.addClass("matched-hint"));
} else {
$hintObj.append(_.escape(item.text));
}
});
} else {
$hintObj.text(token.value);
}
$hintObj.data("token", token);
formatTypeDataForToken($hintObj, token);
return $hintObj;
});
}
// trim leading and trailing string literal delimiters from the query
trimmedQuery = _.trim(query, HintUtils.SINGLE_QUOTE + HintUtils.DOUBLE_QUOTE);
if (hints) {
formattedHints = formatHints(hints, trimmedQuery);
} else {
formattedHints = [];
}
return {
hints: formattedHints,
match: null, // the CodeHintManager should not format the results
selectInitial: true,
handleWideResults: hints.handleWideResults
};
} | [
"function",
"getHintResponse",
"(",
"hints",
",",
"query",
",",
"type",
")",
"{",
"var",
"trimmedQuery",
",",
"formattedHints",
";",
"if",
"(",
"setConfig",
".",
"config",
".",
"debug",
")",
"{",
"console",
".",
"debug",
"(",
"\"Hints\"",
",",
"_",
".",
... | Creates a hint response object. Filters the hint list using the query
string, formats the hints for display, and returns a hint response
object according to the CodeHintManager's API for code hint providers.
@param {Array.<Object>} hints - hints to be included in the response
@param {string} query - querystring with which to filter the hint list
@param {Object} type - the type of query, property vs. identifier
@return {Object} - hint response as defined by the CodeHintManager API | [
"Creates",
"a",
"hint",
"response",
"object",
".",
"Filters",
"the",
"hint",
"list",
"using",
"the",
"query",
"string",
"formats",
"the",
"hints",
"for",
"display",
"and",
"returns",
"a",
"hint",
"response",
"object",
"according",
"to",
"the",
"CodeHintManager... | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/JavaScriptCodeHints/main.js#L153-L285 | train | Returns the response of a hint | [
30522,
3853,
2131,
10606,
19168,
26029,
3366,
1006,
20385,
1010,
23032,
1010,
2828,
1007,
1063,
13075,
21920,
4226,
2854,
1010,
4289,
3064,
10606,
3215,
1025,
2065,
1006,
2275,
8663,
8873,
2290,
1012,
9530,
8873,
2290,
1012,
2139,
8569,
229... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | lib/jsdoc/transform-apijson-for-sdk.js | function (description, deprecatedText, deprecatedSince) {
if (!description && !deprecatedText && !deprecatedSince) {
return "";
}
var result = description || "";
if (deprecatedSince || deprecatedText) {
// Note: sapUiDocumentationDeprecated - transformed to sapUiDeprecated to keep json file size low
result += "<span class=\"sapUiDeprecated\"><br>";
result += this.formatDeprecated(deprecatedSince, deprecatedText);
result += "</span>";
}
result = this._preProcessLinksInTextBlock(result);
return result;
} | javascript | function (description, deprecatedText, deprecatedSince) {
if (!description && !deprecatedText && !deprecatedSince) {
return "";
}
var result = description || "";
if (deprecatedSince || deprecatedText) {
// Note: sapUiDocumentationDeprecated - transformed to sapUiDeprecated to keep json file size low
result += "<span class=\"sapUiDeprecated\"><br>";
result += this.formatDeprecated(deprecatedSince, deprecatedText);
result += "</span>";
}
result = this._preProcessLinksInTextBlock(result);
return result;
} | [
"function",
"(",
"description",
",",
"deprecatedText",
",",
"deprecatedSince",
")",
"{",
"if",
"(",
"!",
"description",
"&&",
"!",
"deprecatedText",
"&&",
"!",
"deprecatedSince",
")",
"{",
"return",
"\"\"",
";",
"}",
"var",
"result",
"=",
"description",
"||"... | Formats the description of the property
@param description - the description of the property
@param deprecatedText - the text explaining this property is deprecated
@param deprecatedSince - the version when this property was deprecated
@returns string - the formatted description | [
"Formats",
"the",
"description",
"of",
"the",
"property"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/lib/jsdoc/transform-apijson-for-sdk.js#L1643-L1661 | train | Returns a string with the description of the documentation | [
30522,
3853,
1006,
6412,
1010,
2139,
28139,
12921,
18209,
1010,
2139,
28139,
12921,
11493,
3401,
1007,
1063,
2065,
1006,
999,
6412,
1004,
1004,
999,
2139,
28139,
12921,
18209,
1004,
1004,
999,
2139,
28139,
12921,
11493,
3401,
1007,
1063,
27... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | src/sap.ui.core/src/sap/ui/core/support/RuleEngineOpaExtension.js | function (options) {
var oContext,
oHistory,
options = options[0] || {},
ruleDeferred = jQueryDOM.Deferred(),
sHistoryFormat = options["historyFormat"],
sFile = options["fileName"];
switch (sHistoryFormat) {
case library.HistoryFormats.Abap:
if (!sFile) {
sFile = "abap-report.json";
}
oHistory = RuleAnalyzer.getFormattedAnalysisHistory(sHistoryFormat);
break;
case library.HistoryFormats.String:
if (!sFile) {
sFile = "string-report.json";
}
oHistory = RuleAnalyzer.getFormattedAnalysisHistory(sHistoryFormat);
break;
default :
if (!sFile) {
sFile = "report.json";
}
oHistory = RuleAnalyzer.getAnalysisHistory();
}
oContext = getWindow();
// Avoid method calls on _$files as IE11/Edge throws "Can't execute code from a freed script"
// BCP: 1980144925
oContext._$files[oContext._$files.length] = {
name: sFile,
content: JSON.stringify(oHistory)
};
ruleDeferred.resolve({
result: true,
message: "Support Assistant Analysis History was stored in window._$files with following name " + sFile,
actual: true,
expected: true
});
return ruleDeferred.promise();
} | javascript | function (options) {
var oContext,
oHistory,
options = options[0] || {},
ruleDeferred = jQueryDOM.Deferred(),
sHistoryFormat = options["historyFormat"],
sFile = options["fileName"];
switch (sHistoryFormat) {
case library.HistoryFormats.Abap:
if (!sFile) {
sFile = "abap-report.json";
}
oHistory = RuleAnalyzer.getFormattedAnalysisHistory(sHistoryFormat);
break;
case library.HistoryFormats.String:
if (!sFile) {
sFile = "string-report.json";
}
oHistory = RuleAnalyzer.getFormattedAnalysisHistory(sHistoryFormat);
break;
default :
if (!sFile) {
sFile = "report.json";
}
oHistory = RuleAnalyzer.getAnalysisHistory();
}
oContext = getWindow();
// Avoid method calls on _$files as IE11/Edge throws "Can't execute code from a freed script"
// BCP: 1980144925
oContext._$files[oContext._$files.length] = {
name: sFile,
content: JSON.stringify(oHistory)
};
ruleDeferred.resolve({
result: true,
message: "Support Assistant Analysis History was stored in window._$files with following name " + sFile,
actual: true,
expected: true
});
return ruleDeferred.promise();
} | [
"function",
"(",
"options",
")",
"{",
"var",
"oContext",
",",
"oHistory",
",",
"options",
"=",
"options",
"[",
"0",
"]",
"||",
"{",
"}",
",",
"ruleDeferred",
"=",
"jQueryDOM",
".",
"Deferred",
"(",
")",
",",
"sHistoryFormat",
"=",
"options",
"[",
"\"hi... | This stores the passed history format in window._$files array.
Accessing this array give an opportunity to store this history in file
@function
@name sap.ui.core.support.RuleEngineOpaAssertions#getReportAsFileInFormat
@param {Object} [options] The options used for configuration
@param {sap.ui.support.HistoryFormats} [options.historyFormat] The format into which the history object will be converted.
@param {String} [options.fileName] The name of the file. The file name must be in following format:
"name of the file" + . + "file extension"
Example: file.json
@public
@returns {Promise} Promise. | [
"This",
"stores",
"the",
"passed",
"history",
"format",
"in",
"window",
".",
"_$files",
"array",
".",
"Accessing",
"this",
"array",
"give",
"an",
"opportunity",
"to",
"store",
"this",
"history",
"in",
"file"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/support/RuleEngineOpaExtension.js#L215-L260 | train | Returns a promise that resolves with the result of the analysis | [
30522,
3853,
1006,
7047,
1007,
1063,
13075,
1051,
8663,
18209,
1010,
2821,
20483,
2854,
1010,
7047,
1027,
7047,
1031,
1014,
1033,
1064,
1064,
1063,
1065,
1010,
5451,
27235,
20529,
1027,
1046,
4226,
2854,
9527,
1012,
13366,
28849,
2094,
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... | |
angular/material | src/components/input/input-animations.spec.js | injectGlobals | function injectGlobals() {
inject(function($injector) {
$rootScope = $injector.get('$rootScope');
$compile = $injector.get('$compile');
$material = $injector.get('$material');
$$mdInput = $injector.get('$$mdInput');
$window = $injector.get('$window');
$animate = $injector.get('$animate');
$rootElement = $injector.get('$rootElement');
$document = $injector.get('$document');
// Grab our input animations (we MUST use the injector to setup dependencies)
invalidAnimation = $injector.get('mdInputInvalidAnimation');
messagesAnimation = $injector.get('mdInputMessagesAnimation');
messageAnimation = $injector.get('mdInputMessageAnimation');
});
} | javascript | function injectGlobals() {
inject(function($injector) {
$rootScope = $injector.get('$rootScope');
$compile = $injector.get('$compile');
$material = $injector.get('$material');
$$mdInput = $injector.get('$$mdInput');
$window = $injector.get('$window');
$animate = $injector.get('$animate');
$rootElement = $injector.get('$rootElement');
$document = $injector.get('$document');
// Grab our input animations (we MUST use the injector to setup dependencies)
invalidAnimation = $injector.get('mdInputInvalidAnimation');
messagesAnimation = $injector.get('mdInputMessagesAnimation');
messageAnimation = $injector.get('mdInputMessageAnimation');
});
} | [
"function",
"injectGlobals",
"(",
")",
"{",
"inject",
"(",
"function",
"(",
"$injector",
")",
"{",
"$rootScope",
"=",
"$injector",
".",
"get",
"(",
"'$rootScope'",
")",
";",
"$compile",
"=",
"$injector",
".",
"get",
"(",
"'$compile'",
")",
";",
"$material"... | /*
before/afterEach Helper Functions
Setup/grab our variables | [
"/",
"*",
"before",
"/",
"afterEach",
"Helper",
"Functions",
"Setup",
"/",
"grab",
"our",
"variables"
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/input/input-animations.spec.js#L233-L249 | train | Inject global variables | [
30522,
3853,
1999,
20614,
23296,
16429,
9777,
1006,
1007,
1063,
1999,
20614,
1006,
3853,
1006,
1002,
1999,
20614,
2953,
1007,
1063,
1002,
6147,
16186,
1027,
1002,
1999,
20614,
2953,
1012,
2131,
1006,
1005,
1002,
6147,
16186,
1005,
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... |
apache/incubator-echarts | src/model/Model.js | getParent | function getParent(model, path) {
var getParentMethod = inner(model).getParent;
return getParentMethod ? getParentMethod.call(model, path) : model.parentModel;
} | javascript | function getParent(model, path) {
var getParentMethod = inner(model).getParent;
return getParentMethod ? getParentMethod.call(model, path) : model.parentModel;
} | [
"function",
"getParent",
"(",
"model",
",",
"path",
")",
"{",
"var",
"getParentMethod",
"=",
"inner",
"(",
"model",
")",
".",
"getParent",
";",
"return",
"getParentMethod",
"?",
"getParentMethod",
".",
"call",
"(",
"model",
",",
"path",
")",
":",
"model",
... | `path` can be null/undefined | [
"path",
"can",
"be",
"null",
"/",
"undefined"
] | 4d0ea095dc3929cb6de40c45748826e7999c7aa8 | https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/model/Model.js#L211-L214 | train | Returns the parent model for the given path | [
30522,
3853,
2131,
19362,
4765,
1006,
2944,
1010,
4130,
1007,
1063,
13075,
2131,
19362,
4765,
11368,
6806,
2094,
1027,
5110,
1006,
2944,
1007,
1012,
2131,
19362,
4765,
1025,
2709,
2131,
19362,
4765,
11368,
6806,
2094,
1029,
2131,
19362,
476... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | documentation/assets/js/website.js | dragElement | function dragElement(el, events) {
function getPointer(e) {
var x = 'clientX';
var y = 'clientY';
var evt = e.touches ? e.touches[0] : e;
return { x: evt[x], y: evt[y] };
}
var drag = { x: 0, y: 0, deltaX: 0, deltaY: 0, active: true, events: events || {} };
var originalX = 0;
var originalY = 0;
var pointerX = 0;
var pointerY = 0;
function move(e) {
if (drag.active) return;
drag.deltaX = pointerX - getPointer(e).x;
drag.deltaY = pointerY - getPointer(e).y;
drag.x = originalX - drag.deltaX;
drag.y = originalY - drag.deltaY;
if (drag.events.move) drag.events.move(drag);
}
function release(e) {
drag.active = true;
if (drag.events.release) drag.events.release(drag);
document.removeEventListener('mousemove', move, false);
document.removeEventListener('mouseup', release, false);
document.removeEventListener('touchmove', move, false);
document.removeEventListener('touchend', release, false);
}
function start(e) {
if (!drag.active) return;
e.preventDefault();
drag.active = false;
pointerX = getPointer(e).x;
pointerY = getPointer(e).y;
originalX = drag.x;
originalY = drag.y;
if (drag.events.begin) drag.events.begin(drag);
document.addEventListener('mousemove', move, false);
document.addEventListener('mouseup', release, false);
document.addEventListener('touchmove', move, false);
document.addEventListener('touchend', release, false);
}
el.addEventListener('mousedown', start, false);
el.addEventListener('touchstart', start, false);
return drag;
} | javascript | function dragElement(el, events) {
function getPointer(e) {
var x = 'clientX';
var y = 'clientY';
var evt = e.touches ? e.touches[0] : e;
return { x: evt[x], y: evt[y] };
}
var drag = { x: 0, y: 0, deltaX: 0, deltaY: 0, active: true, events: events || {} };
var originalX = 0;
var originalY = 0;
var pointerX = 0;
var pointerY = 0;
function move(e) {
if (drag.active) return;
drag.deltaX = pointerX - getPointer(e).x;
drag.deltaY = pointerY - getPointer(e).y;
drag.x = originalX - drag.deltaX;
drag.y = originalY - drag.deltaY;
if (drag.events.move) drag.events.move(drag);
}
function release(e) {
drag.active = true;
if (drag.events.release) drag.events.release(drag);
document.removeEventListener('mousemove', move, false);
document.removeEventListener('mouseup', release, false);
document.removeEventListener('touchmove', move, false);
document.removeEventListener('touchend', release, false);
}
function start(e) {
if (!drag.active) return;
e.preventDefault();
drag.active = false;
pointerX = getPointer(e).x;
pointerY = getPointer(e).y;
originalX = drag.x;
originalY = drag.y;
if (drag.events.begin) drag.events.begin(drag);
document.addEventListener('mousemove', move, false);
document.addEventListener('mouseup', release, false);
document.addEventListener('touchmove', move, false);
document.addEventListener('touchend', release, false);
}
el.addEventListener('mousedown', start, false);
el.addEventListener('touchstart', start, false);
return drag;
} | [
"function",
"dragElement",
"(",
"el",
",",
"events",
")",
"{",
"function",
"getPointer",
"(",
"e",
")",
"{",
"var",
"x",
"=",
"'clientX'",
";",
"var",
"y",
"=",
"'clientY'",
";",
"var",
"evt",
"=",
"e",
".",
"touches",
"?",
"e",
".",
"touches",
"["... | /* Helpers | [
"/",
"*",
"Helpers"
] | 875a3d6745d4bff2e4c6ffe0e2d24aac3bf8a45a | https://github.com/juliangarnier/anime/blob/875a3d6745d4bff2e4c6ffe0e2d24aac3bf8a45a/documentation/assets/js/website.js#L9-L62 | train | Drag element. | [
30522,
3853,
8011,
12260,
3672,
1006,
3449,
1010,
2824,
1007,
1063,
3853,
2131,
8400,
2121,
1006,
1041,
1007,
1063,
13075,
1060,
1027,
1005,
7396,
2595,
1005,
1025,
13075,
1061,
1027,
1005,
7396,
2100,
1005,
1025,
13075,
23408,
2102,
1027,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/events/jquery/EventSimulation.js | function(oHandle) {
var that = this,
$this = jQuery(this),
oAdditionalConfig = {
domRef: that,
eventName: sSimEventName,
sapEventName: sSapSimEventName,
eventHandle: oHandle
};
var fnHandlerWrapper = function(oEvent) {
fnHandler(oEvent, oAdditionalConfig);
};
oHandle.__sapSimulatedEventHandler = fnHandlerWrapper;
for (var i = 0; i < aOrigEvents.length; i++) {
$this.on(aOrigEvents[i], fnHandlerWrapper);
}
} | javascript | function(oHandle) {
var that = this,
$this = jQuery(this),
oAdditionalConfig = {
domRef: that,
eventName: sSimEventName,
sapEventName: sSapSimEventName,
eventHandle: oHandle
};
var fnHandlerWrapper = function(oEvent) {
fnHandler(oEvent, oAdditionalConfig);
};
oHandle.__sapSimulatedEventHandler = fnHandlerWrapper;
for (var i = 0; i < aOrigEvents.length; i++) {
$this.on(aOrigEvents[i], fnHandlerWrapper);
}
} | [
"function",
"(",
"oHandle",
")",
"{",
"var",
"that",
"=",
"this",
",",
"$this",
"=",
"jQuery",
"(",
"this",
")",
",",
"oAdditionalConfig",
"=",
"{",
"domRef",
":",
"that",
",",
"eventName",
":",
"sSimEventName",
",",
"sapEventName",
":",
"sSapSimEventName"... | When binding to the simulated event with prefix is done through jQuery, this function is called and redirect the registration to the original events. Doing in this way we can simulate the event from listening to the original events. | [
"When",
"binding",
"to",
"the",
"simulated",
"event",
"with",
"prefix",
"is",
"done",
"through",
"jQuery",
"this",
"function",
"is",
"called",
"and",
"redirect",
"the",
"registration",
"to",
"the",
"original",
"events",
".",
"Doing",
"in",
"this",
"way",
"we... | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/events/jquery/EventSimulation.js#L60-L78 | train | Adds a event handler to the event queue | [
30522,
3853,
1006,
2821,
5685,
2571,
1007,
1063,
13075,
2008,
1027,
2023,
1010,
1002,
2023,
1027,
1046,
4226,
2854,
1006,
2023,
1007,
1010,
1051,
4215,
27064,
8663,
8873,
2290,
1027,
1063,
14383,
2890,
2546,
1024,
2008,
1010,
2724,
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... | |
mochajs/mocha | lib/reporters/xunit.js | XUnit | function XUnit(runner, options) {
Base.call(this, runner, options);
var stats = this.stats;
var tests = [];
var self = this;
// the name of the test suite, as it will appear in the resulting XML file
var suiteName;
// the default name of the test suite if none is provided
var DEFAULT_SUITE_NAME = 'Mocha Tests';
if (options && options.reporterOptions) {
if (options.reporterOptions.output) {
if (!fs.createWriteStream) {
throw createUnsupportedError('file output not supported in browser');
}
mkdirp.sync(path.dirname(options.reporterOptions.output));
self.fileStream = fs.createWriteStream(options.reporterOptions.output);
}
// get the suite name from the reporter options (if provided)
suiteName = options.reporterOptions.suiteName;
}
// fall back to the default suite name
suiteName = suiteName || DEFAULT_SUITE_NAME;
runner.on(EVENT_TEST_PENDING, function(test) {
tests.push(test);
});
runner.on(EVENT_TEST_PASS, function(test) {
tests.push(test);
});
runner.on(EVENT_TEST_FAIL, function(test) {
tests.push(test);
});
runner.once(EVENT_RUN_END, function() {
self.write(
tag(
'testsuite',
{
name: suiteName,
tests: stats.tests,
failures: 0,
errors: stats.failures,
skipped: stats.tests - stats.failures - stats.passes,
timestamp: new Date().toUTCString(),
time: stats.duration / 1000 || 0
},
false
)
);
tests.forEach(function(t) {
self.test(t);
});
self.write('</testsuite>');
});
} | javascript | function XUnit(runner, options) {
Base.call(this, runner, options);
var stats = this.stats;
var tests = [];
var self = this;
// the name of the test suite, as it will appear in the resulting XML file
var suiteName;
// the default name of the test suite if none is provided
var DEFAULT_SUITE_NAME = 'Mocha Tests';
if (options && options.reporterOptions) {
if (options.reporterOptions.output) {
if (!fs.createWriteStream) {
throw createUnsupportedError('file output not supported in browser');
}
mkdirp.sync(path.dirname(options.reporterOptions.output));
self.fileStream = fs.createWriteStream(options.reporterOptions.output);
}
// get the suite name from the reporter options (if provided)
suiteName = options.reporterOptions.suiteName;
}
// fall back to the default suite name
suiteName = suiteName || DEFAULT_SUITE_NAME;
runner.on(EVENT_TEST_PENDING, function(test) {
tests.push(test);
});
runner.on(EVENT_TEST_PASS, function(test) {
tests.push(test);
});
runner.on(EVENT_TEST_FAIL, function(test) {
tests.push(test);
});
runner.once(EVENT_RUN_END, function() {
self.write(
tag(
'testsuite',
{
name: suiteName,
tests: stats.tests,
failures: 0,
errors: stats.failures,
skipped: stats.tests - stats.failures - stats.passes,
timestamp: new Date().toUTCString(),
time: stats.duration / 1000 || 0
},
false
)
);
tests.forEach(function(t) {
self.test(t);
});
self.write('</testsuite>');
});
} | [
"function",
"XUnit",
"(",
"runner",
",",
"options",
")",
"{",
"Base",
".",
"call",
"(",
"this",
",",
"runner",
",",
"options",
")",
";",
"var",
"stats",
"=",
"this",
".",
"stats",
";",
"var",
"tests",
"=",
"[",
"]",
";",
"var",
"self",
"=",
"this... | Constructs a new `XUnit` reporter instance.
@public
@class
@memberof Mocha.reporters
@extends Mocha.reporters.Base
@param {Runner} runner - Instance triggers reporter actions.
@param {Object} [options] - runner options | [
"Constructs",
"a",
"new",
"XUnit",
"reporter",
"instance",
"."
] | 9b00fedb610241e33f7592c40164e42a38a793cf | https://github.com/mochajs/mocha/blob/9b00fedb610241e33f7592c40164e42a38a793cf/lib/reporters/xunit.js#L46-L111 | train | The XUnit class | [
30522,
3853,
15990,
3490,
2102,
1006,
5479,
1010,
7047,
1007,
1063,
2918,
1012,
2655,
1006,
2023,
1010,
5479,
1010,
7047,
1007,
1025,
13075,
26319,
1027,
2023,
1012,
26319,
1025,
13075,
5852,
1027,
1031,
1033,
1025,
13075,
2969,
1027,
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... |
parcel-bundler/parcel | packages/core/parcel-bundler/src/transforms/babel/astConverter.js | babel7toBabel6 | function babel7toBabel6(ast) {
const visitor = {
ArrowFunctionExpression: node => {
node.expression = node.body.type !== 'BlockStatement';
},
ExistsTypeAnnotation: node => {
node.type = 'ExistentialTypeParam';
},
NumberLiteralTypeAnnotation: node => {
node.type = 'NumericLiteralTypeAnnotation';
},
ObjectTypeIndexer: node => {
node.end++;
node.loc.end.column++;
},
ForOfStatement: node => {
node.type = 'ForAwaitStatement';
delete node.await;
},
SpreadElement: (node, path) => {
if (
path.parentPath.isObjectExpression() ||
path.parentPath.isArrayExpression()
) {
node.type = 'SpreadProperty';
}
},
RestElement: (node, path) => {
if (
path.parentPath.isObjectPattern() ||
path.parentPath.isArrayPattern()
) {
node.type = 'RestProperty';
}
}
};
traverse(ast, {
enter(path) {
if (path.node.variance && path.node.variance.type === 'Variance') {
path.node.variance = path.node.variance.kind;
}
let visitorFunc = visitor[path.node.type];
if (visitorFunc) {
visitorFunc(path.node, path);
}
}
});
return ast;
} | javascript | function babel7toBabel6(ast) {
const visitor = {
ArrowFunctionExpression: node => {
node.expression = node.body.type !== 'BlockStatement';
},
ExistsTypeAnnotation: node => {
node.type = 'ExistentialTypeParam';
},
NumberLiteralTypeAnnotation: node => {
node.type = 'NumericLiteralTypeAnnotation';
},
ObjectTypeIndexer: node => {
node.end++;
node.loc.end.column++;
},
ForOfStatement: node => {
node.type = 'ForAwaitStatement';
delete node.await;
},
SpreadElement: (node, path) => {
if (
path.parentPath.isObjectExpression() ||
path.parentPath.isArrayExpression()
) {
node.type = 'SpreadProperty';
}
},
RestElement: (node, path) => {
if (
path.parentPath.isObjectPattern() ||
path.parentPath.isArrayPattern()
) {
node.type = 'RestProperty';
}
}
};
traverse(ast, {
enter(path) {
if (path.node.variance && path.node.variance.type === 'Variance') {
path.node.variance = path.node.variance.kind;
}
let visitorFunc = visitor[path.node.type];
if (visitorFunc) {
visitorFunc(path.node, path);
}
}
});
return ast;
} | [
"function",
"babel7toBabel6",
"(",
"ast",
")",
"{",
"const",
"visitor",
"=",
"{",
"ArrowFunctionExpression",
":",
"node",
"=>",
"{",
"node",
".",
"expression",
"=",
"node",
".",
"body",
".",
"type",
"!==",
"'BlockStatement'",
";",
"}",
",",
"ExistsTypeAnnota... | Convert between babel 7 and babel 6 AST More info on the AST Changes: https://babeljs.io/docs/en/v7-migration-api#ast-changes | [
"Convert",
"between",
"babel",
"7",
"and",
"babel",
"6",
"AST",
"More",
"info",
"on",
"the",
"AST",
"Changes",
":",
"https",
":",
"//",
"babeljs",
".",
"io",
"/",
"docs",
"/",
"en",
"/",
"v7",
"-",
"migration",
"-",
"api#ast",
"-",
"changes"
] | 84b308511f87d4b69da62bcd352f0ff2f7bd4f1b | https://github.com/parcel-bundler/parcel/blob/84b308511f87d4b69da62bcd352f0ff2f7bd4f1b/packages/core/parcel-bundler/src/transforms/babel/astConverter.js#L5-L56 | train | Babel 7 to Babel 6 | [
30522,
3853,
11561,
2140,
2581,
3406,
3676,
8671,
2575,
1006,
2004,
2102,
1007,
1063,
9530,
3367,
10367,
1027,
1063,
8612,
11263,
27989,
10288,
20110,
3258,
1024,
13045,
1027,
1028,
1063,
13045,
1012,
3670,
1027,
13045,
1012,
2303,
1012,
28... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
marcuswestin/store.js | plugins/operations.js | _arrayOp | function _arrayOp(arrayFn, opArgs) {
var res
var key = opArgs[1]
var rest = slice(opArgs, 2)
this.update(key, [], function(arrVal) {
res = Array.prototype[arrayFn].apply(arrVal, rest)
})
return res
} | javascript | function _arrayOp(arrayFn, opArgs) {
var res
var key = opArgs[1]
var rest = slice(opArgs, 2)
this.update(key, [], function(arrVal) {
res = Array.prototype[arrayFn].apply(arrVal, rest)
})
return res
} | [
"function",
"_arrayOp",
"(",
"arrayFn",
",",
"opArgs",
")",
"{",
"var",
"res",
"var",
"key",
"=",
"opArgs",
"[",
"1",
"]",
"var",
"rest",
"=",
"slice",
"(",
"opArgs",
",",
"2",
")",
"this",
".",
"update",
"(",
"key",
",",
"[",
"]",
",",
"function... | internal ///////// | [
"internal",
"/////////"
] | b8e22fea8738fc19da4d9e7dbf1cda6e5185c481 | https://github.com/marcuswestin/store.js/blob/b8e22fea8738fc19da4d9e7dbf1cda6e5185c481/plugins/operations.js#L49-L57 | train | arrayOp - array operation | [
30522,
3853,
1035,
9140,
7361,
1006,
9140,
2546,
2078,
1010,
6728,
2906,
5620,
1007,
1063,
13075,
24501,
13075,
3145,
1027,
6728,
2906,
5620,
1031,
1015,
1033,
13075,
2717,
1027,
14704,
1006,
6728,
2906,
5620,
1010,
1016,
1007,
2023,
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... |
angular/material | src/core/services/registry/componentRegistry.js | function(instance, handle) {
if (!handle) return angular.noop;
instance.$$mdHandle = handle;
instances.push(instance);
resolveWhen();
return deregister;
/**
* Remove registration for an instance
*/
function deregister() {
var index = instances.indexOf(instance);
if (index !== -1) {
instances.splice(index, 1);
}
}
/**
* Resolve any pending promises for this instance
*/
function resolveWhen() {
var dfd = pendings[handle];
if (dfd) {
dfd.forEach(function (promise) {
promise.resolve(instance);
});
delete pendings[handle];
}
}
} | javascript | function(instance, handle) {
if (!handle) return angular.noop;
instance.$$mdHandle = handle;
instances.push(instance);
resolveWhen();
return deregister;
/**
* Remove registration for an instance
*/
function deregister() {
var index = instances.indexOf(instance);
if (index !== -1) {
instances.splice(index, 1);
}
}
/**
* Resolve any pending promises for this instance
*/
function resolveWhen() {
var dfd = pendings[handle];
if (dfd) {
dfd.forEach(function (promise) {
promise.resolve(instance);
});
delete pendings[handle];
}
}
} | [
"function",
"(",
"instance",
",",
"handle",
")",
"{",
"if",
"(",
"!",
"handle",
")",
"return",
"angular",
".",
"noop",
";",
"instance",
".",
"$$mdHandle",
"=",
"handle",
";",
"instances",
".",
"push",
"(",
"instance",
")",
";",
"resolveWhen",
"(",
")",... | Register an instance.
@param instance the instance to register
@param handle the handle to identify the instance under. | [
"Register",
"an",
"instance",
"."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/services/registry/componentRegistry.js#L61-L92 | train | Register an instance with the cache | [
30522,
3853,
1006,
6013,
1010,
5047,
1007,
1063,
2065,
1006,
999,
5047,
1007,
2709,
16108,
1012,
2053,
7361,
1025,
6013,
1012,
1002,
1002,
9108,
11774,
2571,
1027,
5047,
1025,
12107,
1012,
5245,
1006,
6013,
1007,
1025,
10663,
2860,
10222,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
summernote/summernote | src/js/base/core/lists.js | sum | function sum(array, fn) {
fn = fn || func.self;
return array.reduce(function(memo, v) {
return memo + fn(v);
}, 0);
} | javascript | function sum(array, fn) {
fn = fn || func.self;
return array.reduce(function(memo, v) {
return memo + fn(v);
}, 0);
} | [
"function",
"sum",
"(",
"array",
",",
"fn",
")",
"{",
"fn",
"=",
"fn",
"||",
"func",
".",
"self",
";",
"return",
"array",
".",
"reduce",
"(",
"function",
"(",
"memo",
",",
"v",
")",
"{",
"return",
"memo",
"+",
"fn",
"(",
"v",
")",
";",
"}",
"... | get sum from a list
@param {Array} array - array
@param {Function} fn - iterator | [
"get",
"sum",
"from",
"a",
"list"
] | 8dcafb8107453006b905ef697a529c42e76beb3f | https://github.com/summernote/summernote/blob/8dcafb8107453006b905ef697a529c42e76beb3f/src/js/base/core/lists.js#L79-L84 | train | Sums the values of an array | [
30522,
3853,
7680,
1006,
9140,
1010,
1042,
2078,
1007,
1063,
1042,
2078,
1027,
1042,
2078,
1064,
1064,
4569,
2278,
1012,
2969,
1025,
2709,
9140,
1012,
5547,
1006,
3853,
1006,
24443,
1010,
1058,
1007,
1063,
2709,
24443,
1009,
1042,
2078,
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... |
cytoscape/cytoscape.js | dist/cytoscape.esm.js | findLCA_aux | function findLCA_aux(node1, node2, graphIx, layoutInfo) {
var graph = layoutInfo.graphSet[graphIx]; // If both nodes belongs to graphIx
if (-1 < graph.indexOf(node1) && -1 < graph.indexOf(node2)) {
return {
count: 2,
graph: graphIx
};
} // Make recursive calls for all subgraphs
var c = 0;
for (var i = 0; i < graph.length; i++) {
var nodeId = graph[i];
var nodeIx = layoutInfo.idToIndex[nodeId];
var children = layoutInfo.layoutNodes[nodeIx].children; // If the node has no child, skip it
if (0 === children.length) {
continue;
}
var childGraphIx = layoutInfo.indexToGraph[layoutInfo.idToIndex[children[0]]];
var result = findLCA_aux(node1, node2, childGraphIx, layoutInfo);
if (0 === result.count) {
// Neither node1 nor node2 are present in this subgraph
continue;
} else if (1 === result.count) {
// One of (node1, node2) is present in this subgraph
c++;
if (2 === c) {
// We've already found both nodes, no need to keep searching
break;
}
} else {
// Both nodes are present in this subgraph
return result;
}
}
return {
count: c,
graph: graphIx
};
} | javascript | function findLCA_aux(node1, node2, graphIx, layoutInfo) {
var graph = layoutInfo.graphSet[graphIx]; // If both nodes belongs to graphIx
if (-1 < graph.indexOf(node1) && -1 < graph.indexOf(node2)) {
return {
count: 2,
graph: graphIx
};
} // Make recursive calls for all subgraphs
var c = 0;
for (var i = 0; i < graph.length; i++) {
var nodeId = graph[i];
var nodeIx = layoutInfo.idToIndex[nodeId];
var children = layoutInfo.layoutNodes[nodeIx].children; // If the node has no child, skip it
if (0 === children.length) {
continue;
}
var childGraphIx = layoutInfo.indexToGraph[layoutInfo.idToIndex[children[0]]];
var result = findLCA_aux(node1, node2, childGraphIx, layoutInfo);
if (0 === result.count) {
// Neither node1 nor node2 are present in this subgraph
continue;
} else if (1 === result.count) {
// One of (node1, node2) is present in this subgraph
c++;
if (2 === c) {
// We've already found both nodes, no need to keep searching
break;
}
} else {
// Both nodes are present in this subgraph
return result;
}
}
return {
count: c,
graph: graphIx
};
} | [
"function",
"findLCA_aux",
"(",
"node1",
",",
"node2",
",",
"graphIx",
",",
"layoutInfo",
")",
"{",
"var",
"graph",
"=",
"layoutInfo",
".",
"graphSet",
"[",
"graphIx",
"]",
";",
"// If both nodes belongs to graphIx",
"if",
"(",
"-",
"1",
"<",
"graph",
".",
... | @brief : Auxiliary function used for LCA computation
@arg node1 : node1's ID
@arg node2 : node2's ID
@arg graphIx : subgraph index
@arg layoutInfo : layoutInfo object
@return : object of the form {count: X, graph: Y}, where:
X is the number of ancesters (max: 2) found in
graphIx (and it's subgraphs),
Y is the graph index of the lowest graph containing
all X nodes | [
"@brief",
":",
"Auxiliary",
"function",
"used",
"for",
"LCA",
"computation"
] | ad2051b65e2243cfd953d8b24a8bf95bfa8559e5 | https://github.com/cytoscape/cytoscape.js/blob/ad2051b65e2243cfd953d8b24a8bf95bfa8559e5/dist/cytoscape.esm.js#L19884-L19930 | train | Finds the LCA of two nodes in the graph | [
30522,
3853,
2424,
15472,
2050,
1035,
19554,
1006,
13045,
2487,
1010,
13045,
2475,
1010,
10629,
7646,
1010,
9621,
2378,
14876,
1007,
1063,
13075,
10629,
1027,
9621,
2378,
14876,
1012,
19287,
3388,
1031,
10629,
7646,
1033,
1025,
1013,
1013,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
shipshapecode/shepherd | src/js/utils/modal.js | _createModalContainer | function _createModalContainer() {
const element = document.createElementNS(svgNS, 'svg');
element.setAttributeNS(null, 'id', elementIds.modalOverlay);
return element;
} | javascript | function _createModalContainer() {
const element = document.createElementNS(svgNS, 'svg');
element.setAttributeNS(null, 'id', elementIds.modalOverlay);
return element;
} | [
"function",
"_createModalContainer",
"(",
")",
"{",
"const",
"element",
"=",
"document",
".",
"createElementNS",
"(",
"svgNS",
",",
"'svg'",
")",
";",
"element",
".",
"setAttributeNS",
"(",
"null",
",",
"'id'",
",",
"elementIds",
".",
"modalOverlay",
")",
";... | <svg id="shepherdModalOverlayContainer" xmlns="http://www.w3.org/2000/svg"> | [
"<svg",
"id",
"=",
"shepherdModalOverlayContainer",
"xmlns",
"=",
"http",
":",
"//",
"www",
".",
"w3",
".",
"org",
"/",
"2000",
"/",
"svg",
">"
] | 0cb1c63fb07b58796358f6d33da5f6405e2b05f4 | https://github.com/shipshapecode/shepherd/blob/0cb1c63fb07b58796358f6d33da5f6405e2b05f4/src/js/utils/modal.js#L18-L24 | train | Create a modal container element | [
30522,
3853,
1035,
3443,
5302,
9305,
8663,
18249,
2121,
1006,
1007,
1063,
9530,
3367,
5783,
1027,
6254,
1012,
3443,
12260,
3672,
3619,
1006,
17917,
16206,
2015,
1010,
1005,
17917,
2290,
1005,
1007,
1025,
5783,
1012,
2275,
19321,
3089,
8569,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/dataProvider.js | converDataValue | function converDataValue(value, dimInfo) {
// Performance sensitive.
var dimType = dimInfo && dimInfo.type;
if (dimType === 'ordinal') {
// If given value is a category string
var ordinalMeta = dimInfo && dimInfo.ordinalMeta;
return ordinalMeta
? ordinalMeta.parseAndCollect(value)
: value;
}
if (dimType === 'time'
// spead up when using timestamp
&& typeof value !== 'number'
&& value != null
&& value !== '-'
) {
value = +parseDate(value);
}
// dimType defaults 'number'.
// If dimType is not ordinal and value is null or undefined or NaN or '-',
// parse to NaN.
return (value == null || value === '')
? NaN
// If string (like '-'), using '+' parse to NaN
// If object, also parse to NaN
: +value;
} | javascript | function converDataValue(value, dimInfo) {
// Performance sensitive.
var dimType = dimInfo && dimInfo.type;
if (dimType === 'ordinal') {
// If given value is a category string
var ordinalMeta = dimInfo && dimInfo.ordinalMeta;
return ordinalMeta
? ordinalMeta.parseAndCollect(value)
: value;
}
if (dimType === 'time'
// spead up when using timestamp
&& typeof value !== 'number'
&& value != null
&& value !== '-'
) {
value = +parseDate(value);
}
// dimType defaults 'number'.
// If dimType is not ordinal and value is null or undefined or NaN or '-',
// parse to NaN.
return (value == null || value === '')
? NaN
// If string (like '-'), using '+' parse to NaN
// If object, also parse to NaN
: +value;
} | [
"function",
"converDataValue",
"(",
"value",
",",
"dimInfo",
")",
"{",
"// Performance sensitive.",
"var",
"dimType",
"=",
"dimInfo",
"&&",
"dimInfo",
".",
"type",
";",
"if",
"(",
"dimType",
"===",
"'ordinal'",
")",
"{",
"// If given value is a category string",
"... | This helper method convert value in data.
@param {string|number|Date} value
@param {Object|string} [dimInfo] If string (like 'x'), dimType defaults 'number'.
If "dimInfo.ordinalParseAndSave", ordinal value can be parsed. | [
"This",
"helper",
"method",
"convert",
"value",
"in",
"data",
"."
] | 4d0ea095dc3929cb6de40c45748826e7999c7aa8 | https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/data/helper/dataProvider.js#L282-L310 | train | Converes given value to a value in the correct format. | [
30522,
3853,
9530,
6299,
2850,
2696,
10175,
5657,
1006,
3643,
1010,
11737,
2378,
14876,
1007,
1063,
1013,
1013,
2836,
7591,
1012,
13075,
11737,
13874,
1027,
11737,
2378,
14876,
1004,
1004,
11737,
2378,
14876,
1012,
2828,
1025,
2065,
1006,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
eslint/eslint | lib/rules/no-empty-function.js | getKind | function getKind(node) {
const parent = node.parent;
let kind = "";
if (node.type === "ArrowFunctionExpression") {
return "arrowFunctions";
}
// Detects main kind.
if (parent.type === "Property") {
if (parent.kind === "get") {
return "getters";
}
if (parent.kind === "set") {
return "setters";
}
kind = parent.method ? "methods" : "functions";
} else if (parent.type === "MethodDefinition") {
if (parent.kind === "get") {
return "getters";
}
if (parent.kind === "set") {
return "setters";
}
if (parent.kind === "constructor") {
return "constructors";
}
kind = "methods";
} else {
kind = "functions";
}
// Detects prefix.
let prefix = "";
if (node.generator) {
prefix = "generator";
} else if (node.async) {
prefix = "async";
} else {
return kind;
}
return prefix + kind[0].toUpperCase() + kind.slice(1);
} | javascript | function getKind(node) {
const parent = node.parent;
let kind = "";
if (node.type === "ArrowFunctionExpression") {
return "arrowFunctions";
}
// Detects main kind.
if (parent.type === "Property") {
if (parent.kind === "get") {
return "getters";
}
if (parent.kind === "set") {
return "setters";
}
kind = parent.method ? "methods" : "functions";
} else if (parent.type === "MethodDefinition") {
if (parent.kind === "get") {
return "getters";
}
if (parent.kind === "set") {
return "setters";
}
if (parent.kind === "constructor") {
return "constructors";
}
kind = "methods";
} else {
kind = "functions";
}
// Detects prefix.
let prefix = "";
if (node.generator) {
prefix = "generator";
} else if (node.async) {
prefix = "async";
} else {
return kind;
}
return prefix + kind[0].toUpperCase() + kind.slice(1);
} | [
"function",
"getKind",
"(",
"node",
")",
"{",
"const",
"parent",
"=",
"node",
".",
"parent",
";",
"let",
"kind",
"=",
"\"\"",
";",
"if",
"(",
"node",
".",
"type",
"===",
"\"ArrowFunctionExpression\"",
")",
"{",
"return",
"\"arrowFunctions\"",
";",
"}",
"... | Gets the kind of a given function node.
@param {ASTNode} node - A function node to get. This is one of
an ArrowFunctionExpression, a FunctionDeclaration, or a
FunctionExpression.
@returns {string} The kind of the function. This is one of "functions",
"arrowFunctions", "generatorFunctions", "asyncFunctions", "methods",
"generatorMethods", "asyncMethods", "getters", "setters", and
"constructors". | [
"Gets",
"the",
"kind",
"of",
"a",
"given",
"function",
"node",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/no-empty-function.js#L40-L85 | train | Returns the kind of a node | [
30522,
3853,
2131,
18824,
1006,
13045,
1007,
1063,
9530,
3367,
6687,
1027,
13045,
1012,
6687,
1025,
2292,
2785,
1027,
1000,
1000,
1025,
2065,
1006,
13045,
1012,
30524,
11263,
27989,
10288,
20110,
3258,
1000,
1007,
1063,
2709,
1000,
8612,
11... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
jgraph/mxgraph | javascript/mxClient.js | function(ctor, superCtor)
{
var f = function() {};
f.prototype = superCtor.prototype;
ctor.prototype = new f();
ctor.prototype.constructor = ctor;
} | javascript | function(ctor, superCtor)
{
var f = function() {};
f.prototype = superCtor.prototype;
ctor.prototype = new f();
ctor.prototype.constructor = ctor;
} | [
"function",
"(",
"ctor",
",",
"superCtor",
")",
"{",
"var",
"f",
"=",
"function",
"(",
")",
"{",
"}",
";",
"f",
".",
"prototype",
"=",
"superCtor",
".",
"prototype",
";",
"ctor",
".",
"prototype",
"=",
"new",
"f",
"(",
")",
";",
"ctor",
".",
"pro... | Function: extend
Assigns a copy of the superclass prototype to the subclass prototype.
Note that this does not call the constructor of the superclass at this
point, the superclass constructor should be called explicitely in the
subclass constructor. Below is an example.
(code)
MyGraph = function(container, model, renderHint, stylesheet)
{
mxGraph.call(this, container, model, renderHint, stylesheet);
}
mxUtils.extend(MyGraph, mxGraph);
(end)
Parameters:
ctor - Constructor of the subclass.
superCtor - Constructor of the superclass. | [
"Function",
":",
"extend"
] | 33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44 | https://github.com/jgraph/mxgraph/blob/33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44/javascript/mxClient.js#L4015-L4022 | train | A function that creates a new object that inherits from another object. | [
30522,
3853,
1006,
14931,
2953,
1010,
3565,
16761,
1007,
1063,
13075,
1042,
1027,
3853,
1006,
1007,
1063,
1065,
1025,
1042,
1012,
8773,
1027,
3565,
16761,
1012,
8773,
1025,
14931,
2953,
1012,
8773,
1027,
2047,
1042,
1006,
1007,
1025,
14931,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
moleculerjs/moleculer | src/middlewares/circuit-breaker.js | getEpState | function getEpState(ep, opts) {
let item = store.get(ep.name);
if (!item) {
item = {
ep,
opts,
count: 0,
failures: 0,
state: C.CIRCUIT_CLOSE,
cbTimer: null
};
store.set(ep.name, item);
}
return item;
} | javascript | function getEpState(ep, opts) {
let item = store.get(ep.name);
if (!item) {
item = {
ep,
opts,
count: 0,
failures: 0,
state: C.CIRCUIT_CLOSE,
cbTimer: null
};
store.set(ep.name, item);
}
return item;
} | [
"function",
"getEpState",
"(",
"ep",
",",
"opts",
")",
"{",
"let",
"item",
"=",
"store",
".",
"get",
"(",
"ep",
".",
"name",
")",
";",
"if",
"(",
"!",
"item",
")",
"{",
"item",
"=",
"{",
"ep",
",",
"opts",
",",
"count",
":",
"0",
",",
"failur... | Get Endpoint state from store. If not exists, create it.
@param {Endpoint} ep
@param {Object} opts
@returns {Object} | [
"Get",
"Endpoint",
"state",
"from",
"store",
".",
"If",
"not",
"exists",
"create",
"it",
"."
] | f95aadc2d61b0d0e3c643a43c3ed28bca6425cde | https://github.com/moleculerjs/moleculer/blob/f95aadc2d61b0d0e3c643a43c3ed28bca6425cde/src/middlewares/circuit-breaker.js#L57-L71 | train | Get the state of an endpoint | [
30522,
3853,
2131,
13699,
9153,
2618,
1006,
4958,
1010,
23569,
2015,
1007,
1063,
2292,
8875,
1027,
3573,
1012,
2131,
1006,
4958,
1012,
2171,
1007,
1025,
2065,
1006,
999,
8875,
1007,
1063,
8875,
1027,
1063,
4958,
1010,
23569,
2015,
1010,
4... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/report-translator.js | compareFixesByRange | function compareFixesByRange(a, b) {
return a.range[0] - b.range[0] || a.range[1] - b.range[1];
} | javascript | function compareFixesByRange(a, b) {
return a.range[0] - b.range[0] || a.range[1] - b.range[1];
} | [
"function",
"compareFixesByRange",
"(",
"a",
",",
"b",
")",
"{",
"return",
"a",
".",
"range",
"[",
"0",
"]",
"-",
"b",
".",
"range",
"[",
"0",
"]",
"||",
"a",
".",
"range",
"[",
"1",
"]",
"-",
"b",
".",
"range",
"[",
"1",
"]",
";",
"}"
] | Compares items in a fixes array by range.
@param {Fix} a The first message.
@param {Fix} b The second message.
@returns {int} -1 if a comes before b, 1 if a comes after b, 0 if equal.
@private | [
"Compares",
"items",
"in",
"a",
"fixes",
"array",
"by",
"range",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/util/report-translator.js#L123-L125 | train | Compare fixes by range | [
30522,
3853,
12826,
8873,
20156,
3762,
24388,
2063,
1006,
1037,
1010,
1038,
1007,
1063,
2709,
1037,
1012,
2846,
1031,
1014,
1033,
1011,
1038,
1012,
2846,
1031,
1014,
1033,
1064,
1064,
1037,
1012,
2846,
1031,
1015,
1033,
1011,
1038,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/extensions/default/InlineColorEditor/InlineColorEditor.js | InlineColorEditor | function InlineColorEditor(color, marker) {
this._color = color;
this._marker = marker;
this._isOwnChange = false;
this._isHostChange = false;
this._origin = "+InlineColorEditor_" + (lastOriginId++);
this._handleColorChange = this._handleColorChange.bind(this);
this._handleHostDocumentChange = this._handleHostDocumentChange.bind(this);
InlineWidget.call(this);
} | javascript | function InlineColorEditor(color, marker) {
this._color = color;
this._marker = marker;
this._isOwnChange = false;
this._isHostChange = false;
this._origin = "+InlineColorEditor_" + (lastOriginId++);
this._handleColorChange = this._handleColorChange.bind(this);
this._handleHostDocumentChange = this._handleHostDocumentChange.bind(this);
InlineWidget.call(this);
} | [
"function",
"InlineColorEditor",
"(",
"color",
",",
"marker",
")",
"{",
"this",
".",
"_color",
"=",
"color",
";",
"this",
".",
"_marker",
"=",
"marker",
";",
"this",
".",
"_isOwnChange",
"=",
"false",
";",
"this",
".",
"_isHostChange",
"=",
"false",
";",... | Inline widget containing a ColorEditor control
@param {!string} color Initially selected color
@param {!CodeMirror.TextMarker} marker | [
"Inline",
"widget",
"containing",
"a",
"ColorEditor",
"control"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/InlineColorEditor/InlineColorEditor.js#L43-L54 | train | InlineColorEditor constructor. | [
30522,
3853,
23881,
18717,
2098,
15660,
1006,
3609,
1010,
12115,
1007,
1063,
2023,
1012,
1035,
3609,
1027,
3609,
1025,
2023,
1012,
1035,
12115,
1027,
12115,
1025,
2023,
1012,
1035,
11163,
7962,
22305,
2063,
1027,
6270,
1025,
2023,
1012,
103... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
airyland/vux | src/components/range/lib/classes.js | ClassList | function ClassList (el) {
if (!el || !el.nodeType) {
throw new Error('A DOM element reference is required')
}
this.el = el
this.list = el.classList
} | javascript | function ClassList (el) {
if (!el || !el.nodeType) {
throw new Error('A DOM element reference is required')
}
this.el = el
this.list = el.classList
} | [
"function",
"ClassList",
"(",
"el",
")",
"{",
"if",
"(",
"!",
"el",
"||",
"!",
"el",
".",
"nodeType",
")",
"{",
"throw",
"new",
"Error",
"(",
"'A DOM element reference is required'",
")",
"}",
"this",
".",
"el",
"=",
"el",
"this",
".",
"list",
"=",
"... | Initialize a new ClassList for `el`.
@param {Element} el
@api private | [
"Initialize",
"a",
"new",
"ClassList",
"for",
"el",
"."
] | 484fc3c18bdca99b0c08efbb678c0ee0f5ceedd6 | https://github.com/airyland/vux/blob/484fc3c18bdca99b0c08efbb678c0ee0f5ceedd6/src/components/range/lib/classes.js#L37-L43 | train | A class list | [
30522,
3853,
2465,
9863,
1006,
3449,
1007,
1063,
2065,
1006,
999,
3449,
1064,
1064,
999,
3449,
1012,
13045,
13874,
1007,
1063,
5466,
2047,
7561,
1006,
1005,
1037,
14383,
5783,
4431,
2003,
3223,
1005,
1007,
1065,
2023,
1012,
3449,
1027,
34... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/incubator-echarts | src/component/axis/AxisView.js | function (axisModel, ecModel, api, payload, force) {
updateAxisPointer(this, axisModel, ecModel, api, payload, false);
} | javascript | function (axisModel, ecModel, api, payload, force) {
updateAxisPointer(this, axisModel, ecModel, api, payload, false);
} | [
"function",
"(",
"axisModel",
",",
"ecModel",
",",
"api",
",",
"payload",
",",
"force",
")",
"{",
"updateAxisPointer",
"(",
"this",
",",
"axisModel",
",",
"ecModel",
",",
"api",
",",
"payload",
",",
"false",
")",
";",
"}"
] | Action handler.
@public
@param {module:echarts/coord/cartesian/AxisModel} axisModel
@param {module:echarts/model/Global} ecModel
@param {module:echarts/ExtensionAPI} api
@param {Object} payload | [
"Action",
"handler",
"."
] | 4d0ea095dc3929cb6de40c45748826e7999c7aa8 | https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/component/axis/AxisView.js#L66-L68 | train | Update the current axis pointer | [
30522,
3853,
1006,
8123,
5302,
9247,
1010,
14925,
5302,
9247,
1010,
17928,
1010,
18093,
1010,
2486,
1007,
1063,
10651,
8528,
2483,
8400,
2121,
1006,
2023,
1010,
8123,
5302,
9247,
1010,
14925,
5302,
9247,
1010,
17928,
1010,
18093,
1010,
6270... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/LanguageManager.js | setLanguageOverrideForPath | function setLanguageOverrideForPath(fullPath, language) {
var oldLang = getLanguageForPath(fullPath);
if (!language) {
delete _filePathToLanguageMap[fullPath];
} else {
_filePathToLanguageMap[fullPath] = language;
}
var newLang = getLanguageForPath(fullPath);
// Old language changed since this path is no longer mapped to it
_triggerLanguageModified(oldLang);
// New language changed since a path is now mapped to it that wasn't before
_triggerLanguageModified(newLang);
} | javascript | function setLanguageOverrideForPath(fullPath, language) {
var oldLang = getLanguageForPath(fullPath);
if (!language) {
delete _filePathToLanguageMap[fullPath];
} else {
_filePathToLanguageMap[fullPath] = language;
}
var newLang = getLanguageForPath(fullPath);
// Old language changed since this path is no longer mapped to it
_triggerLanguageModified(oldLang);
// New language changed since a path is now mapped to it that wasn't before
_triggerLanguageModified(newLang);
} | [
"function",
"setLanguageOverrideForPath",
"(",
"fullPath",
",",
"language",
")",
"{",
"var",
"oldLang",
"=",
"getLanguageForPath",
"(",
"fullPath",
")",
";",
"if",
"(",
"!",
"language",
")",
"{",
"delete",
"_filePathToLanguageMap",
"[",
"fullPath",
"]",
";",
"... | Adds a language mapping for the specified fullPath. If language is falsy (null or undefined), the mapping
is removed. The override is NOT persisted across Brackets sessions.
@param {!fullPath} fullPath absolute path of the file
@param {?object} language language to associate the file with or falsy value to remove any existing override | [
"Adds",
"a",
"language",
"mapping",
"for",
"the",
"specified",
"fullPath",
".",
"If",
"language",
"is",
"falsy",
"(",
"null",
"or",
"undefined",
")",
"the",
"mapping",
"is",
"removed",
".",
"The",
"override",
"is",
"NOT",
"persisted",
"across",
"Brackets",
... | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/language/LanguageManager.js#L378-L391 | train | Sets the language for a file | [
30522,
3853,
2275,
25023,
6692,
3351,
7840,
15637,
29278,
15069,
1006,
2440,
15069,
1010,
2653,
1007,
1063,
13075,
2214,
25023,
1027,
2131,
25023,
6692,
3351,
29278,
15069,
1006,
2440,
15069,
1007,
1025,
2065,
1006,
999,
2653,
1007,
1063,
3... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
eslint/eslint | lib/rules/one-var.js | isRequire | function isRequire(decl) {
return decl.init && decl.init.type === "CallExpression" && decl.init.callee.name === "require";
} | javascript | function isRequire(decl) {
return decl.init && decl.init.type === "CallExpression" && decl.init.callee.name === "require";
} | [
"function",
"isRequire",
"(",
"decl",
")",
"{",
"return",
"decl",
".",
"init",
"&&",
"decl",
".",
"init",
".",
"type",
"===",
"\"CallExpression\"",
"&&",
"decl",
".",
"init",
".",
"callee",
".",
"name",
"===",
"\"require\"",
";",
"}"
] | Check if a variable declaration is a require.
@param {ASTNode} decl variable declaration Node
@returns {bool} if decl is a require, return true; else return false.
@private | [
"Check",
"if",
"a",
"variable",
"declaration",
"is",
"a",
"require",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/one-var.js#L151-L153 | train | Check if the given variable declaration is a require call | [
30522,
3853,
2003,
2890,
15549,
2890,
1006,
11703,
2140,
1007,
1063,
2709,
11703,
2140,
1012,
1999,
4183,
1004,
1004,
11703,
2140,
1012,
1999,
4183,
1012,
2828,
1027,
1027,
1027,
1000,
2655,
10288,
20110,
3258,
1000,
1004,
1004,
11703,
2140... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
jgraph/mxgraph | javascript/examples/grapheditor/www/js/Graph.js | urlX | function urlX(link)
{
if (link != null && link.toString().toLowerCase().substring(0, 11) !== 'javascript:')
{
return link;
}
return null;
} | javascript | function urlX(link)
{
if (link != null && link.toString().toLowerCase().substring(0, 11) !== 'javascript:')
{
return link;
}
return null;
} | [
"function",
"urlX",
"(",
"link",
")",
"{",
"if",
"(",
"link",
"!=",
"null",
"&&",
"link",
".",
"toString",
"(",
")",
".",
"toLowerCase",
"(",
")",
".",
"substring",
"(",
"0",
",",
"11",
")",
"!==",
"'javascript:'",
")",
"{",
"return",
"link",
";",
... | Uses https://code.google.com/p/google-caja/wiki/JsHtmlSanitizer NOTE: Original minimized sanitizer was modified to support data URIs for images, mailto and special data:-links. LATER: Add MathML to whitelisted tags | [
"Uses",
"https",
":",
"//",
"code",
".",
"google",
".",
"com",
"/",
"p",
"/",
"google",
"-",
"caja",
"/",
"wiki",
"/",
"JsHtmlSanitizer",
"NOTE",
":",
"Original",
"minimized",
"sanitizer",
"was",
"modified",
"to",
"support",
"data",
"URIs",
"for",
"image... | 33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44 | https://github.com/jgraph/mxgraph/blob/33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44/javascript/examples/grapheditor/www/js/Graph.js#L1838-L1846 | train | Returns the url of a link | [
30522,
3853,
24471,
2140,
2595,
1006,
4957,
1007,
1063,
2065,
1006,
4957,
999,
1027,
19701,
1004,
1004,
4957,
1012,
2000,
3367,
4892,
1006,
1007,
1012,
2000,
27663,
18992,
3366,
1006,
1007,
1012,
4942,
3367,
4892,
1006,
1014,
1010,
2340,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | commaify | function commaify(s) {
var w = 3;
if(s.length <= w) return s;
var j = (s.length % w), o = s.substr(0,j);
for(; j!=s.length; j+=w) o+=(o.length > 0 ? "," : "") + s.substr(j,w);
return o;
} | javascript | function commaify(s) {
var w = 3;
if(s.length <= w) return s;
var j = (s.length % w), o = s.substr(0,j);
for(; j!=s.length; j+=w) o+=(o.length > 0 ? "," : "") + s.substr(j,w);
return o;
} | [
"function",
"commaify",
"(",
"s",
")",
"{",
"var",
"w",
"=",
"3",
";",
"if",
"(",
"s",
".",
"length",
"<=",
"w",
")",
"return",
"s",
";",
"var",
"j",
"=",
"(",
"s",
".",
"length",
"%",
"w",
")",
",",
"o",
"=",
"s",
".",
"substr",
"(",
"0"... | /*jshint +W086 | [
"/",
"*",
"jshint",
"+",
"W086"
] | 9a6d8a1d3d80c78dad5201fb389316f935279cdc | https://github.com/SheetJS/js-xlsx/blob/9a6d8a1d3d80c78dad5201fb389316f935279cdc/xlsx.js#L430-L436 | train | commaify a string | [
30522,
3853,
4012,
2863,
8757,
1006,
1055,
1007,
1063,
13075,
1059,
1027,
1017,
1025,
2065,
1006,
1055,
1012,
3091,
1026,
1027,
1059,
1007,
2709,
1055,
1025,
13075,
1046,
1027,
1006,
1055,
1012,
3091,
1003,
1059,
1007,
1010,
1051,
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... |
SAP/openui5 | src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/SubApiDetail.controller.js | function(sEntityType, sEntityId, bShouldStoreToHistory) {
this._oRouter.stop();
this._oRouter.navTo("apiId", {
id: encodeURIComponent(this._sTopicId),
entityType: sEntityType,
entityId: encodeURIComponent(sEntityId)
}, !bShouldStoreToHistory);
this._oRouter.initialize(true);
} | javascript | function(sEntityType, sEntityId, bShouldStoreToHistory) {
this._oRouter.stop();
this._oRouter.navTo("apiId", {
id: encodeURIComponent(this._sTopicId),
entityType: sEntityType,
entityId: encodeURIComponent(sEntityId)
}, !bShouldStoreToHistory);
this._oRouter.initialize(true);
} | [
"function",
"(",
"sEntityType",
",",
"sEntityId",
",",
"bShouldStoreToHistory",
")",
"{",
"this",
".",
"_oRouter",
".",
"stop",
"(",
")",
";",
"this",
".",
"_oRouter",
".",
"navTo",
"(",
"\"apiId\"",
",",
"{",
"id",
":",
"encodeURIComponent",
"(",
"this",
... | /* =========================================================== /* begin: internal methods aa /* =========================================================== | [
"/",
"*",
"===========================================================",
"/",
"*",
"begin",
":",
"internal",
"methods",
"aa",
"/",
"*",
"==========================================================="
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/SubApiDetail.controller.js#L186-L194 | train | Navigates to the specified entity type and entity id | [
30522,
3853,
1006,
2741,
3012,
13874,
1010,
2741,
3012,
3593,
1010,
18667,
6806,
21285,
23809,
18903,
24158,
7062,
1007,
1063,
2023,
1012,
1035,
20298,
19901,
1012,
2644,
1006,
1007,
1025,
2023,
1012,
1035,
20298,
19901,
1012,
6583,
2615,
3... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
material-components/material-components-web | scripts/cp-pkgs.js | cleanPkgDistDirs | function cleanPkgDistDirs() {
const statuses = globSync('packages/*/dist').map(
(distPath) => spawnSync('rm', ['-r', distPath], {stdio: 'inherit'}).status);
if (statuses.find((status) => status > 0)) {
console.error('Failed to clean package dist folders prior to copying');
process.exit(1);
}
} | javascript | function cleanPkgDistDirs() {
const statuses = globSync('packages/*/dist').map(
(distPath) => spawnSync('rm', ['-r', distPath], {stdio: 'inherit'}).status);
if (statuses.find((status) => status > 0)) {
console.error('Failed to clean package dist folders prior to copying');
process.exit(1);
}
} | [
"function",
"cleanPkgDistDirs",
"(",
")",
"{",
"const",
"statuses",
"=",
"globSync",
"(",
"'packages/*/dist'",
")",
".",
"map",
"(",
"(",
"distPath",
")",
"=>",
"spawnSync",
"(",
"'rm'",
",",
"[",
"'-r'",
",",
"distPath",
"]",
",",
"{",
"stdio",
":",
"... | Cleans the /dist directory of each package. | [
"Cleans",
"the",
"/",
"dist",
"directory",
"of",
"each",
"package",
"."
] | 9f8b9ae5103ff86de4f6a5cb02e700d6eb851e5f | https://github.com/material-components/material-components-web/blob/9f8b9ae5103ff86de4f6a5cb02e700d6eb851e5f/scripts/cp-pkgs.js#L67-L75 | train | Clean package dist folders | [
30522,
3853,
4550,
2361,
2243,
2290,
10521,
2102,
4305,
2869,
1006,
1007,
1063,
9530,
3367,
3570,
2229,
1027,
1043,
4135,
5910,
6038,
2278,
1006,
1005,
14555,
1013,
1008,
1013,
4487,
3367,
1005,
1007,
1012,
4949,
1006,
1006,
4487,
3367,
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... |
gridsome/gridsome | gridsome/lib/webpack/createBaseConfig.js | createCacheOptions | function createCacheOptions () {
const values = {
'gridsome': require('../../package.json').version,
'cache-loader': require('cache-loader/package.json').version,
'vue-loader': require('vue-loader/package.json').version,
context: app.context,
isProd,
isServer,
config: (
(projectConfig.chainWebpack || '').toString()
)
}
return {
cacheDirectory: app.resolve('node_modules/.cache/gridsome'),
cacheIdentifier: hash(values)
}
} | javascript | function createCacheOptions () {
const values = {
'gridsome': require('../../package.json').version,
'cache-loader': require('cache-loader/package.json').version,
'vue-loader': require('vue-loader/package.json').version,
context: app.context,
isProd,
isServer,
config: (
(projectConfig.chainWebpack || '').toString()
)
}
return {
cacheDirectory: app.resolve('node_modules/.cache/gridsome'),
cacheIdentifier: hash(values)
}
} | [
"function",
"createCacheOptions",
"(",
")",
"{",
"const",
"values",
"=",
"{",
"'gridsome'",
":",
"require",
"(",
"'../../package.json'",
")",
".",
"version",
",",
"'cache-loader'",
":",
"require",
"(",
"'cache-loader/package.json'",
")",
".",
"version",
",",
"'v... | helpes | [
"helpes"
] | 1ef584b6388ef6ee7f8cb2cae78c089fddd9328b | https://github.com/gridsome/gridsome/blob/1ef584b6388ef6ee7f8cb2cae78c089fddd9328b/gridsome/lib/webpack/createBaseConfig.js#L251-L268 | train | Create cache options | [
30522,
3853,
3443,
3540,
5403,
7361,
9285,
1006,
1007,
1063,
9530,
3367,
5300,
1027,
1063,
1005,
8370,
14045,
1005,
1024,
5478,
1006,
1005,
1012,
1012,
1013,
1012,
1012,
1013,
7427,
1012,
1046,
3385,
1005,
1007,
1012,
2544,
1010,
1005,
17... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
google/material-design-lite | docs/_assets/components.js | MaterialComponentsNav | function MaterialComponentsNav() {
'use strict';
this.element_ = document.querySelector('.mdl-js-components');
if (this.element_) {
this.componentLinks = this.element_.querySelectorAll('.mdl-components__link');
this.activeLink = null;
this.activePage = null;
this.init();
}
} | javascript | function MaterialComponentsNav() {
'use strict';
this.element_ = document.querySelector('.mdl-js-components');
if (this.element_) {
this.componentLinks = this.element_.querySelectorAll('.mdl-components__link');
this.activeLink = null;
this.activePage = null;
this.init();
}
} | [
"function",
"MaterialComponentsNav",
"(",
")",
"{",
"'use strict'",
";",
"this",
".",
"element_",
"=",
"document",
".",
"querySelector",
"(",
"'.mdl-js-components'",
")",
";",
"if",
"(",
"this",
".",
"element_",
")",
"{",
"this",
".",
"componentLinks",
"=",
... | Copyright 2015 Google Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. | [
"Copyright",
"2015",
"Google",
"Inc",
".",
"All",
"Rights",
"Reserved",
"."
] | 60f441a22ed98ed2c03f6179adf460d888bf459f | https://github.com/google/material-design-lite/blob/60f441a22ed98ed2c03f6179adf460d888bf459f/docs/_assets/components.js#L17-L28 | train | MaterialComponentsNav constructor. | [
30522,
3853,
3430,
9006,
29513,
7666,
2532,
2615,
1006,
1007,
1063,
1005,
2224,
9384,
30524,
23032,
11246,
22471,
6525,
3363,
1006,
1005,
1012,
9108,
2140,
1011,
6177,
1035,
1035,
4957,
1005,
1007,
1025,
2023,
1012,
3161,
13767,
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... |
SAP/openui5 | src/sap.ui.core/src/sap/base/i18n/ResourceBundle.js | ResourceBundle | function ResourceBundle(sUrl, sLocale, bIncludeInfo, bAsync){
this.sLocale = this._sNextLocale = normalize(sLocale) || defaultLocale();
this.oUrlInfo = splitUrl(sUrl);
this.bIncludeInfo = bIncludeInfo;
// list of custom bundles
this.aCustomBundles = [];
// declare list of property files that are loaded
this.aPropertyFiles = [];
this.aLocales = [];
// load the most specific, existing properties file
if (bAsync) {
var resolveWithThis = function() { return this; }.bind(this);
return loadNextPropertiesAsync(this).then(resolveWithThis, resolveWithThis);
}
loadNextPropertiesSync(this);
} | javascript | function ResourceBundle(sUrl, sLocale, bIncludeInfo, bAsync){
this.sLocale = this._sNextLocale = normalize(sLocale) || defaultLocale();
this.oUrlInfo = splitUrl(sUrl);
this.bIncludeInfo = bIncludeInfo;
// list of custom bundles
this.aCustomBundles = [];
// declare list of property files that are loaded
this.aPropertyFiles = [];
this.aLocales = [];
// load the most specific, existing properties file
if (bAsync) {
var resolveWithThis = function() { return this; }.bind(this);
return loadNextPropertiesAsync(this).then(resolveWithThis, resolveWithThis);
}
loadNextPropertiesSync(this);
} | [
"function",
"ResourceBundle",
"(",
"sUrl",
",",
"sLocale",
",",
"bIncludeInfo",
",",
"bAsync",
")",
"{",
"this",
".",
"sLocale",
"=",
"this",
".",
"_sNextLocale",
"=",
"normalize",
"(",
"sLocale",
")",
"||",
"defaultLocale",
"(",
")",
";",
"this",
".",
"... | @class Contains locale-specific texts.
If you need a locale-specific text within your application, you can use the
resource bundle to load the locale-specific file from the server and access
the texts of it.
Use {@link module:sap/base/i18n/ResourceBundle.create} to create an instance of sap/base/i18n/ResourceBundle
(.properties without any locale information, e.g. "mybundle.properties"), and optionally
a locale. The locale is defined as a string of the language and an optional country code
separated by underscore (e.g. "en_GB" or "fr"). If no locale is passed, the default
locale is "en" if the SAPUI5 framework is not available. Otherwise the default locale is taken from
the SAPUI5 configuration.
With the getText() method of the resource bundle, a locale-specific string value
for a given key will be returned.
With the given locale, the resource bundle requests the locale-specific properties file
(e.g. "mybundle_fr_FR.properties"). If no file is found for the requested locale or if the file
does not contain a text for the given key, a sequence of fall back locales is tried one by one.
First, if the locale contains a region information (fr_FR), then the locale without the region is
tried (fr). If that also can't be found or doesn't contain the requested text, the English file
is used (en - assuming that most development projects contain at least English texts).
If that also fails, the file without locale (base URL of the bundle) is tried.
If none of the requested files can be found or none of them contains a text for the given key,
then the key itself is returned as text.
Exception: Fallback for "zh_HK" is "zh_TW" before zh.
@since 1.58
@alias module:sap/base/i18n/ResourceBundle
@public
@hideconstructor | [
"@class",
"Contains",
"locale",
"-",
"specific",
"texts",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/base/i18n/ResourceBundle.js#L240-L255 | train | Constructor for ResourceBundle | [
30522,
3853,
7692,
27265,
2571,
1006,
7505,
2140,
1010,
22889,
24755,
2571,
1010,
8026,
20464,
12672,
2378,
14876,
1010,
19021,
6038,
2278,
1007,
1063,
2023,
1012,
22889,
24755,
2571,
1027,
2023,
1012,
1035,
1055,
2638,
18413,
4135,
9289,
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... |
fengyuanchen/cropper | dist/cropper.common.js | getCropBoxData | function getCropBoxData() {
var cropBoxData = this.cropBoxData;
var data = void 0;
if (this.ready && this.cropped) {
data = {
left: cropBoxData.left,
top: cropBoxData.top,
width: cropBoxData.width,
height: cropBoxData.height
};
}
return data || {};
} | javascript | function getCropBoxData() {
var cropBoxData = this.cropBoxData;
var data = void 0;
if (this.ready && this.cropped) {
data = {
left: cropBoxData.left,
top: cropBoxData.top,
width: cropBoxData.width,
height: cropBoxData.height
};
}
return data || {};
} | [
"function",
"getCropBoxData",
"(",
")",
"{",
"var",
"cropBoxData",
"=",
"this",
".",
"cropBoxData",
";",
"var",
"data",
"=",
"void",
"0",
";",
"if",
"(",
"this",
".",
"ready",
"&&",
"this",
".",
"cropped",
")",
"{",
"data",
"=",
"{",
"left",
":",
"... | Get the crop box position and size data.
@returns {Object} The result crop box data. | [
"Get",
"the",
"crop",
"box",
"position",
"and",
"size",
"data",
"."
] | 6677332a6a375b647f58808dfc24ea09f5804041 | https://github.com/fengyuanchen/cropper/blob/6677332a6a375b647f58808dfc24ea09f5804041/dist/cropper.common.js#L2988-L3003 | train | Get the data for the crop box | [
30522,
3853,
2131,
26775,
7361,
8758,
2850,
2696,
1006,
1007,
1063,
13075,
10416,
8758,
2850,
2696,
1027,
2023,
1012,
10416,
8758,
2850,
2696,
1025,
13075,
2951,
1027,
11675,
1014,
1025,
2065,
1006,
2023,
1012,
3201,
1004,
1004,
2023,
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... |
aframevr/aframe | src/systems/camera.js | removeDefaultCamera | function removeDefaultCamera (sceneEl) {
var defaultCamera;
var camera = sceneEl.camera;
if (!camera) { return; }
// Remove default camera if present.
defaultCamera = sceneEl.querySelector('[' + DEFAULT_CAMERA_ATTR + ']');
if (!defaultCamera) { return; }
sceneEl.removeChild(defaultCamera);
} | javascript | function removeDefaultCamera (sceneEl) {
var defaultCamera;
var camera = sceneEl.camera;
if (!camera) { return; }
// Remove default camera if present.
defaultCamera = sceneEl.querySelector('[' + DEFAULT_CAMERA_ATTR + ']');
if (!defaultCamera) { return; }
sceneEl.removeChild(defaultCamera);
} | [
"function",
"removeDefaultCamera",
"(",
"sceneEl",
")",
"{",
"var",
"defaultCamera",
";",
"var",
"camera",
"=",
"sceneEl",
".",
"camera",
";",
"if",
"(",
"!",
"camera",
")",
"{",
"return",
";",
"}",
"// Remove default camera if present.",
"defaultCamera",
"=",
... | Remove injected default camera from scene, if present.
@param {Element} sceneEl | [
"Remove",
"injected",
"default",
"camera",
"from",
"scene",
"if",
"present",
"."
] | 24acc78a7299a4cdfe3ef617f4d40ddf6275c992 | https://github.com/aframevr/aframe/blob/24acc78a7299a4cdfe3ef617f4d40ddf6275c992/src/systems/camera.js#L262-L271 | train | Remove default camera if present | [
30522,
3853,
3718,
12879,
23505,
28727,
6906,
1006,
3496,
2884,
1007,
1063,
13075,
12398,
28727,
6906,
1025,
13075,
4950,
1027,
3496,
2884,
1012,
4950,
1025,
2065,
1006,
999,
4950,
1007,
1063,
2709,
1025,
1065,
1013,
1013,
6366,
12398,
4950... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/video/zy.media.js | getTypeFromFileExtension | function getTypeFromFileExtension(url) {
url = url.toLowerCase().split('?')[0];
var _ext = url.substring(url.lastIndexOf('.') + 1);
var _av = /mp4|m4v|ogg|ogv|m3u8|webm|webmv|wmv|mpeg|mov/gi.test(_ext) ? 'video/' : 'audio/';
switch (_ext) {
case 'mp4':
case 'm4v':
case 'm4a':
return _av + 'mp4';
case 'webm':
case 'webma':
case 'webmv':
return _av + 'webm';
case 'ogg':
case 'oga':
case 'ogv':
return _av + 'ogg';
case 'm3u8':
return 'application/x-mpegurl';
case 'ts':
return _av + 'mp2t';
default:
return _av + _ext;
}
} | javascript | function getTypeFromFileExtension(url) {
url = url.toLowerCase().split('?')[0];
var _ext = url.substring(url.lastIndexOf('.') + 1);
var _av = /mp4|m4v|ogg|ogv|m3u8|webm|webmv|wmv|mpeg|mov/gi.test(_ext) ? 'video/' : 'audio/';
switch (_ext) {
case 'mp4':
case 'm4v':
case 'm4a':
return _av + 'mp4';
case 'webm':
case 'webma':
case 'webmv':
return _av + 'webm';
case 'ogg':
case 'oga':
case 'ogv':
return _av + 'ogg';
case 'm3u8':
return 'application/x-mpegurl';
case 'ts':
return _av + 'mp2t';
default:
return _av + _ext;
}
} | [
"function",
"getTypeFromFileExtension",
"(",
"url",
")",
"{",
"url",
"=",
"url",
".",
"toLowerCase",
"(",
")",
".",
"split",
"(",
"'?'",
")",
"[",
"0",
"]",
";",
"var",
"_ext",
"=",
"url",
".",
"substring",
"(",
"url",
".",
"lastIndexOf",
"(",
"'.'",... | Get media type from file extension | [
"Get",
"media",
"type",
"from",
"file",
"extension"
] | 484fc3c18bdca99b0c08efbb678c0ee0f5ceedd6 | https://github.com/airyland/vux/blob/484fc3c18bdca99b0c08efbb678c0ee0f5ceedd6/src/components/video/zy.media.js#L167-L192 | train | Get type from extension | [
30522,
3853,
2131,
13874,
19699,
5358,
8873,
10559,
18413,
6132,
3258,
1006,
24471,
2140,
1007,
1063,
24471,
2140,
1027,
24471,
2140,
1012,
2000,
27663,
18992,
3366,
1006,
1007,
1012,
3975,
1006,
1005,
1029,
1005,
1007,
1031,
1014,
1033,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
facebook/relay | packages/relay-compiler/core/RelayCompilerError.js | createUserError | function createUserError(
message: string,
locations?: ?$ReadOnlyArray<Location>,
nodes?: ?$ReadOnlyArray<ASTNode>,
): UserError {
let messageWithLocations = message;
if (locations != null) {
const printedLocations = printLocations(locations);
messageWithLocations =
printedLocations.length === 0
? message
: [message, ...printedLocations].join('\n\n') + '\n';
}
return new GraphQLError(messageWithLocations, nodes ?? []);
} | javascript | function createUserError(
message: string,
locations?: ?$ReadOnlyArray<Location>,
nodes?: ?$ReadOnlyArray<ASTNode>,
): UserError {
let messageWithLocations = message;
if (locations != null) {
const printedLocations = printLocations(locations);
messageWithLocations =
printedLocations.length === 0
? message
: [message, ...printedLocations].join('\n\n') + '\n';
}
return new GraphQLError(messageWithLocations, nodes ?? []);
} | [
"function",
"createUserError",
"(",
"message",
":",
"string",
",",
"locations",
"?",
":",
"?",
"$ReadOnlyArray",
"<",
"Location",
">",
",",
"nodes",
"?",
":",
"?",
"$ReadOnlyArray",
"<",
"ASTNode",
">",
",",
")",
":",
"UserError",
"{",
"let",
"messageWithL... | Creates an error describing invalid application code (GraphQL/Schema)
that must be fixed by the end developer. This should only be used
for local errors that don't affect processing of other user code. | [
"Creates",
"an",
"error",
"describing",
"invalid",
"application",
"code",
"(",
"GraphQL",
"/",
"Schema",
")",
"that",
"must",
"be",
"fixed",
"by",
"the",
"end",
"developer",
".",
"This",
"should",
"only",
"be",
"used",
"for",
"local",
"errors",
"that",
"do... | 7fb9be5182b9650637d7b92ead9a42713ac30aa4 | https://github.com/facebook/relay/blob/7fb9be5182b9650637d7b92ead9a42713ac30aa4/packages/relay-compiler/core/RelayCompilerError.js#L38-L52 | train | Create a UserError | [
30522,
3853,
3443,
20330,
2121,
29165,
1006,
4471,
1024,
5164,
1010,
5269,
1029,
1024,
1029,
1002,
3191,
2239,
2135,
2906,
9447,
1026,
3295,
1028,
1010,
14164,
1029,
1024,
1029,
1002,
3191,
2239,
2135,
2906,
9447,
1026,
2004,
2102,
3630,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
fullcalendar/fullcalendar | tasks/dts.js | transformDefaultClassExports | function transformDefaultClassExports(content) {
return content.replace(/^(\s*)export default (abstract )?class ([\w]+)/mg, function(m0, m1, m2, m3) {
return m1 + 'export { ' + m3 + ' as default, ' + m3 + ' };\n' +
m1 + (m2 || '') + 'class ' + m3
})
} | javascript | function transformDefaultClassExports(content) {
return content.replace(/^(\s*)export default (abstract )?class ([\w]+)/mg, function(m0, m1, m2, m3) {
return m1 + 'export { ' + m3 + ' as default, ' + m3 + ' };\n' +
m1 + (m2 || '') + 'class ' + m3
})
} | [
"function",
"transformDefaultClassExports",
"(",
"content",
")",
"{",
"return",
"content",
".",
"replace",
"(",
"/",
"^(\\s*)export default (abstract )?class ([\\w]+)",
"/",
"mg",
",",
"function",
"(",
"m0",
",",
"m1",
",",
"m2",
",",
"m3",
")",
"{",
"return",
... | changes the name of the default export to `Default` and exports it as a *named* export. this allows ambient declaration merging to grab onto it. workaround for https://github.com/Microsoft/TypeScript/issues/14080 NEEDED ANYMORE? | [
"changes",
"the",
"name",
"of",
"the",
"default",
"export",
"to",
"Default",
"and",
"exports",
"it",
"as",
"a",
"*",
"named",
"*",
"export",
".",
"this",
"allows",
"ambient",
"declaration",
"merging",
"to",
"grab",
"onto",
"it",
".",
"workaround",
"for",
... | f827f233581338ceb9723eabb7f895731498fd5b | https://github.com/fullcalendar/fullcalendar/blob/f827f233581338ceb9723eabb7f895731498fd5b/tasks/dts.js#L130-L135 | train | Transform default class exports | [
30522,
3853,
10938,
3207,
7011,
11314,
26266,
10288,
25378,
1006,
4180,
1007,
1063,
2709,
4180,
1012,
5672,
1006,
1013,
1034,
1006,
1032,
1055,
1008,
1007,
9167,
12398,
1006,
10061,
1007,
1029,
2465,
1006,
1031,
1032,
1059,
1033,
1009,
1007... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/extensions/default/NavigationAndHistory/main.js | _createMROFDisplayList | function _createMROFDisplayList(refresh) {
var $def = $.Deferred();
var $mrofList, $link, $newItem;
/**
* Clears the MROF list in memory and pop over but retains the working set entries
* @private
*/
function _purgeAllExceptWorkingSet() {
_mrofList = _createMROFList();
$mrofList.empty();
_createMROFDisplayList(true);
$currentContext = null;
PreferencesManager.setViewState(OPEN_FILES_VIEW_STATE, _mrofList, _getPrefsContext(), true);
}
if (!refresh) {
// Call hide first to make sure we are not creating duplicate lists
_hideMROFList();
$mrofContainer = $(Mustache.render(htmlTemplate, {Strings: Strings})).appendTo('body');
$("#mrof-list-close").one("click", _hideMROFList);
// Attach clear list handler to the 'Clear All' button
$("#mrof-container .footer > div#clear-mrof-list").on("click", _purgeAllExceptWorkingSet);
$(window).on("keydown", _handleArrowKeys);
$(window).on("keyup", _hideMROFListOnEscape);
}
$mrofList = $mrofContainer.find("#mrof-list");
/**
* Focus handler for the link in list item
* @private
*/
function _onFocus(event) {
var $scope = $(event.target).parent();
$("#mrof-container #mrof-list > li.highlight").removeClass("highlight");
$(event.target).parent().addClass("highlight");
$mrofContainer.find("#recent-file-path").text($scope.data("path"));
$mrofContainer.find("#recent-file-path").attr('title', ($scope.data("path")));
$currentContext = $scope;
}
/**
* Click handler for the link in list item
* @private
*/
function _onClick(event) {
var $scope = $(event.delegateTarget).parent();
_openEditorForContext({
path: $scope.data("path"),
paneId: $scope.data("paneId"),
cursor: $scope.data("cursor"),
hideOnOpenFile: true
});
}
var data, fileEntry;
_syncWithFileSystem().always(function () {
_mrofList = _mrofList.filter(function (e) {return e; });
_createFileEntries($mrofList);
var $fileLinks = $("#mrof-container #mrof-list > li > a.mroitem");
// Handlers for mouse events on the list items
$fileLinks.on("focus", _onFocus);
$fileLinks.on("click", _onClick);
$fileLinks.on("select", _onClick);
// Put focus on the Most recent file link in the list
$fileLinks.first().trigger("focus");
$def.resolve();
});
return $def.promise();
} | javascript | function _createMROFDisplayList(refresh) {
var $def = $.Deferred();
var $mrofList, $link, $newItem;
/**
* Clears the MROF list in memory and pop over but retains the working set entries
* @private
*/
function _purgeAllExceptWorkingSet() {
_mrofList = _createMROFList();
$mrofList.empty();
_createMROFDisplayList(true);
$currentContext = null;
PreferencesManager.setViewState(OPEN_FILES_VIEW_STATE, _mrofList, _getPrefsContext(), true);
}
if (!refresh) {
// Call hide first to make sure we are not creating duplicate lists
_hideMROFList();
$mrofContainer = $(Mustache.render(htmlTemplate, {Strings: Strings})).appendTo('body');
$("#mrof-list-close").one("click", _hideMROFList);
// Attach clear list handler to the 'Clear All' button
$("#mrof-container .footer > div#clear-mrof-list").on("click", _purgeAllExceptWorkingSet);
$(window).on("keydown", _handleArrowKeys);
$(window).on("keyup", _hideMROFListOnEscape);
}
$mrofList = $mrofContainer.find("#mrof-list");
/**
* Focus handler for the link in list item
* @private
*/
function _onFocus(event) {
var $scope = $(event.target).parent();
$("#mrof-container #mrof-list > li.highlight").removeClass("highlight");
$(event.target).parent().addClass("highlight");
$mrofContainer.find("#recent-file-path").text($scope.data("path"));
$mrofContainer.find("#recent-file-path").attr('title', ($scope.data("path")));
$currentContext = $scope;
}
/**
* Click handler for the link in list item
* @private
*/
function _onClick(event) {
var $scope = $(event.delegateTarget).parent();
_openEditorForContext({
path: $scope.data("path"),
paneId: $scope.data("paneId"),
cursor: $scope.data("cursor"),
hideOnOpenFile: true
});
}
var data, fileEntry;
_syncWithFileSystem().always(function () {
_mrofList = _mrofList.filter(function (e) {return e; });
_createFileEntries($mrofList);
var $fileLinks = $("#mrof-container #mrof-list > li > a.mroitem");
// Handlers for mouse events on the list items
$fileLinks.on("focus", _onFocus);
$fileLinks.on("click", _onClick);
$fileLinks.on("select", _onClick);
// Put focus on the Most recent file link in the list
$fileLinks.first().trigger("focus");
$def.resolve();
});
return $def.promise();
} | [
"function",
"_createMROFDisplayList",
"(",
"refresh",
")",
"{",
"var",
"$def",
"=",
"$",
".",
"Deferred",
"(",
")",
";",
"var",
"$mrofList",
",",
"$link",
",",
"$newItem",
";",
"/**\n * Clears the MROF list in memory and pop over but retains the working set entrie... | Shows the current MROF list
@private | [
"Shows",
"the",
"current",
"MROF",
"list"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/NavigationAndHistory/main.js#L380-L455 | train | Creates the MROF list | [
30522,
3853,
1035,
3443,
2213,
3217,
2546,
10521,
13068,
9863,
1006,
25416,
21898,
1007,
1063,
13075,
1002,
13366,
1027,
1002,
1012,
13366,
28849,
2094,
1006,
1007,
1025,
13075,
1002,
2720,
11253,
9863,
1010,
1002,
4957,
1010,
1002,
2047,
4... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/InPlaceEdit.js | updateControls | function updateControls(oInPlaceEdit){
var oContent = oInPlaceEdit.getContent();
if (!oContent) {
return;
}
var oTooltip = oContent.getTooltip();
switch (oContent.getMetadata().getName()) { // do not check with instanceof because then all classes must be loaded
case "sap.ui.commons.TextField":
case "sap.ui.commons.ComboBox":
case "sap.ui.commons.DropdownBox":
// use TextView for display
if (!oInPlaceEdit._oTextView) {
oInPlaceEdit._oTextView = new TextView(oInPlaceEdit.getId() + "--TV",{
wrapping: false});
oInPlaceEdit._oTextView.setParent(oInPlaceEdit);
// Make sure the delegate is not there twice
oInPlaceEdit._oTextView.removeDelegate(contentDelegate);
oInPlaceEdit._oTextView.addDelegate(contentDelegate, oInPlaceEdit);
oInPlaceEdit._oTextView.getTooltip = function(){
return this.getParent().getTooltip();
};
}
oInPlaceEdit._oTextView.setText(oContent.getValue());
oInPlaceEdit._oTextView.setEnabled(oContent.getEnabled());
oInPlaceEdit._oTextView.setTextDirection(oContent.getTextDirection());
oInPlaceEdit._oTextView.setVisible(oContent.getVisible());
oInPlaceEdit._oTextView.setWidth("100%"); // width is set on the outer DIV
oInPlaceEdit._oTextView.setTextAlign(oContent.getTextAlign());
oInPlaceEdit._oTextView.setDesign(oInPlaceEdit.getDesign());
oInPlaceEdit._oTextView.setHelpId(oContent.getHelpId());
oInPlaceEdit._oTextView.setAccessibleRole(oContent.getAccessibleRole());
if (oInPlaceEdit._oTextView._oTooltip && oInPlaceEdit._oTextView._oTooltip != oTooltip) {
oInPlaceEdit._oTextView.removeDelegate(oInPlaceEdit._oTextView._oTooltip);
oInPlaceEdit._oTextView._oTooltip = undefined;
}
if (oTooltip instanceof sap.ui.core.TooltipBase) {
if (!oInPlaceEdit._oTextView._oTooltip || oInPlaceEdit._oTextView._oTooltip != oTooltip) {
oInPlaceEdit._oTextView.addDelegate(oTooltip);
oInPlaceEdit._oTextView._oTooltip = oTooltip;
}
}
oInPlaceEdit._oDisplayControl = oInPlaceEdit._oTextView;
// use oContent for edit
oInPlaceEdit._oEditControl = oContent;
oInPlaceEdit._bUseEditButton = false;
break;
case "sap.ui.commons.Link":
// use Link for display
oInPlaceEdit._oDisplayControl = oContent;
// Make sure the delegate is not there twice
oInPlaceEdit._oDisplayControl.removeDelegate(contentDelegate);
oInPlaceEdit._oDisplayControl.addDelegate(contentDelegate, oInPlaceEdit);
// use TextField for edit
if (oInPlaceEdit._oTextField) {
oInPlaceEdit._oTextField.setValue(oContent.getText());
oInPlaceEdit._oTextField.setWidth("100%");
oInPlaceEdit._oEditControl = oInPlaceEdit._oTextField;
if (oInPlaceEdit._oTextField._oTooltip && oInPlaceEdit._oTextField._oTooltip != oTooltip) {
oInPlaceEdit._oTextField.removeDelegate(oInPlaceEdit._oTextField._oTooltip);
oInPlaceEdit._oTextField._oTooltip = undefined;
}
if (oTooltip instanceof sap.ui.core.TooltipBase) {
if (!oInPlaceEdit._oTextField._oTooltip || oInPlaceEdit._oTextField._oTooltip != oTooltip) {
oInPlaceEdit._oTextField.addDelegate(oTooltip);
oInPlaceEdit._oTextField._oTooltip = oTooltip;
}
}
}
// for link an edit button is needed to allow the link click
createEditButton(oInPlaceEdit);
oInPlaceEdit._bUseEditButton = true;
break;
default:
throw new Error("Control not supported for InPlaceEdit");
}
} | javascript | function updateControls(oInPlaceEdit){
var oContent = oInPlaceEdit.getContent();
if (!oContent) {
return;
}
var oTooltip = oContent.getTooltip();
switch (oContent.getMetadata().getName()) { // do not check with instanceof because then all classes must be loaded
case "sap.ui.commons.TextField":
case "sap.ui.commons.ComboBox":
case "sap.ui.commons.DropdownBox":
// use TextView for display
if (!oInPlaceEdit._oTextView) {
oInPlaceEdit._oTextView = new TextView(oInPlaceEdit.getId() + "--TV",{
wrapping: false});
oInPlaceEdit._oTextView.setParent(oInPlaceEdit);
// Make sure the delegate is not there twice
oInPlaceEdit._oTextView.removeDelegate(contentDelegate);
oInPlaceEdit._oTextView.addDelegate(contentDelegate, oInPlaceEdit);
oInPlaceEdit._oTextView.getTooltip = function(){
return this.getParent().getTooltip();
};
}
oInPlaceEdit._oTextView.setText(oContent.getValue());
oInPlaceEdit._oTextView.setEnabled(oContent.getEnabled());
oInPlaceEdit._oTextView.setTextDirection(oContent.getTextDirection());
oInPlaceEdit._oTextView.setVisible(oContent.getVisible());
oInPlaceEdit._oTextView.setWidth("100%"); // width is set on the outer DIV
oInPlaceEdit._oTextView.setTextAlign(oContent.getTextAlign());
oInPlaceEdit._oTextView.setDesign(oInPlaceEdit.getDesign());
oInPlaceEdit._oTextView.setHelpId(oContent.getHelpId());
oInPlaceEdit._oTextView.setAccessibleRole(oContent.getAccessibleRole());
if (oInPlaceEdit._oTextView._oTooltip && oInPlaceEdit._oTextView._oTooltip != oTooltip) {
oInPlaceEdit._oTextView.removeDelegate(oInPlaceEdit._oTextView._oTooltip);
oInPlaceEdit._oTextView._oTooltip = undefined;
}
if (oTooltip instanceof sap.ui.core.TooltipBase) {
if (!oInPlaceEdit._oTextView._oTooltip || oInPlaceEdit._oTextView._oTooltip != oTooltip) {
oInPlaceEdit._oTextView.addDelegate(oTooltip);
oInPlaceEdit._oTextView._oTooltip = oTooltip;
}
}
oInPlaceEdit._oDisplayControl = oInPlaceEdit._oTextView;
// use oContent for edit
oInPlaceEdit._oEditControl = oContent;
oInPlaceEdit._bUseEditButton = false;
break;
case "sap.ui.commons.Link":
// use Link for display
oInPlaceEdit._oDisplayControl = oContent;
// Make sure the delegate is not there twice
oInPlaceEdit._oDisplayControl.removeDelegate(contentDelegate);
oInPlaceEdit._oDisplayControl.addDelegate(contentDelegate, oInPlaceEdit);
// use TextField for edit
if (oInPlaceEdit._oTextField) {
oInPlaceEdit._oTextField.setValue(oContent.getText());
oInPlaceEdit._oTextField.setWidth("100%");
oInPlaceEdit._oEditControl = oInPlaceEdit._oTextField;
if (oInPlaceEdit._oTextField._oTooltip && oInPlaceEdit._oTextField._oTooltip != oTooltip) {
oInPlaceEdit._oTextField.removeDelegate(oInPlaceEdit._oTextField._oTooltip);
oInPlaceEdit._oTextField._oTooltip = undefined;
}
if (oTooltip instanceof sap.ui.core.TooltipBase) {
if (!oInPlaceEdit._oTextField._oTooltip || oInPlaceEdit._oTextField._oTooltip != oTooltip) {
oInPlaceEdit._oTextField.addDelegate(oTooltip);
oInPlaceEdit._oTextField._oTooltip = oTooltip;
}
}
}
// for link an edit button is needed to allow the link click
createEditButton(oInPlaceEdit);
oInPlaceEdit._bUseEditButton = true;
break;
default:
throw new Error("Control not supported for InPlaceEdit");
}
} | [
"function",
"updateControls",
"(",
"oInPlaceEdit",
")",
"{",
"var",
"oContent",
"=",
"oInPlaceEdit",
".",
"getContent",
"(",
")",
";",
"if",
"(",
"!",
"oContent",
")",
"{",
"return",
";",
"}",
"var",
"oTooltip",
"=",
"oContent",
".",
"getTooltip",
"(",
"... | Private functions | [
"Private",
"functions"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.commons/src/sap/ui/commons/InPlaceEdit.js#L674-L763 | train | Updates the controls | [
30522,
3853,
10651,
8663,
13181,
4877,
1006,
1051,
2378,
24759,
10732,
2098,
4183,
1007,
1063,
13075,
1051,
8663,
6528,
2102,
1027,
1051,
2378,
24759,
10732,
2098,
4183,
1012,
2131,
8663,
6528,
2102,
1006,
1007,
1025,
2065,
1006,
999,
1051,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
google/code-prettify | js-modules/prettify.js | createSimpleLexer | function createSimpleLexer(shortcutStylePatterns, fallthroughStylePatterns) {
var shortcuts = {};
var tokenizer;
(function () {
var allPatterns = shortcutStylePatterns.concat(fallthroughStylePatterns);
var allRegexs = [];
var regexKeys = {};
for (var i = 0, n = allPatterns.length; i < n; ++i) {
var patternParts = allPatterns[i];
var shortcutChars = patternParts[3];
if (shortcutChars) {
for (var c = shortcutChars.length; --c >= 0;) {
shortcuts[shortcutChars.charAt(c)] = patternParts;
}
}
var regex = patternParts[1];
var k = '' + regex;
if (!regexKeys.hasOwnProperty(k)) {
allRegexs.push(regex);
regexKeys[k] = null;
}
}
allRegexs.push(/[\0-\uffff]/);
tokenizer = combinePrefixPatterns(allRegexs);
})();
var nPatterns = fallthroughStylePatterns.length;
/**
* Lexes job.sourceCode and attaches an output array job.decorations of
* style classes preceded by the position at which they start in
* job.sourceCode in order.
*
* @type{function (JobT)}
*/
var decorate = function (job) {
var sourceCode = job.sourceCode, basePos = job.basePos;
var sourceNode = job.sourceNode;
/** Even entries are positions in source in ascending order. Odd enties
* are style markers (e.g., PR_COMMENT) that run from that position until
* the end.
* @type {DecorationsT}
*/
var decorations = [basePos, PR_PLAIN];
var pos = 0; // index into sourceCode
var tokens = sourceCode.match(tokenizer) || [];
var styleCache = {};
for (var ti = 0, nTokens = tokens.length; ti < nTokens; ++ti) {
var token = tokens[ti];
var style = styleCache[token];
var match = void 0;
var isEmbedded;
if (typeof style === 'string') {
isEmbedded = false;
} else {
var patternParts = shortcuts[token.charAt(0)];
if (patternParts) {
match = token.match(patternParts[1]);
style = patternParts[0];
} else {
for (var i = 0; i < nPatterns; ++i) {
patternParts = fallthroughStylePatterns[i];
match = token.match(patternParts[1]);
if (match) {
style = patternParts[0];
break;
}
}
if (!match) { // make sure that we make progress
style = PR_PLAIN;
}
}
isEmbedded = style.length >= 5 && 'lang-' === style.substring(0, 5);
if (isEmbedded && !(match && typeof match[1] === 'string')) {
isEmbedded = false;
style = PR_SOURCE;
}
if (!isEmbedded) { styleCache[token] = style; }
}
var tokenStart = pos;
pos += token.length;
if (!isEmbedded) {
decorations.push(basePos + tokenStart, style);
} else { // Treat group 1 as an embedded block of source code.
var embeddedSource = match[1];
var embeddedSourceStart = token.indexOf(embeddedSource);
var embeddedSourceEnd = embeddedSourceStart + embeddedSource.length;
if (match[2]) {
// If embeddedSource can be blank, then it would match at the
// beginning which would cause us to infinitely recurse on the
// entire token, so we catch the right context in match[2].
embeddedSourceEnd = token.length - match[2].length;
embeddedSourceStart = embeddedSourceEnd - embeddedSource.length;
}
var lang = style.substring(5);
// Decorate the left of the embedded source
appendDecorations(
sourceNode,
basePos + tokenStart,
token.substring(0, embeddedSourceStart),
decorate, decorations);
// Decorate the embedded source
appendDecorations(
sourceNode,
basePos + tokenStart + embeddedSourceStart,
embeddedSource,
langHandlerForExtension(lang, embeddedSource),
decorations);
// Decorate the right of the embedded section
appendDecorations(
sourceNode,
basePos + tokenStart + embeddedSourceEnd,
token.substring(embeddedSourceEnd),
decorate, decorations);
}
}
job.decorations = decorations;
};
return decorate;
} | javascript | function createSimpleLexer(shortcutStylePatterns, fallthroughStylePatterns) {
var shortcuts = {};
var tokenizer;
(function () {
var allPatterns = shortcutStylePatterns.concat(fallthroughStylePatterns);
var allRegexs = [];
var regexKeys = {};
for (var i = 0, n = allPatterns.length; i < n; ++i) {
var patternParts = allPatterns[i];
var shortcutChars = patternParts[3];
if (shortcutChars) {
for (var c = shortcutChars.length; --c >= 0;) {
shortcuts[shortcutChars.charAt(c)] = patternParts;
}
}
var regex = patternParts[1];
var k = '' + regex;
if (!regexKeys.hasOwnProperty(k)) {
allRegexs.push(regex);
regexKeys[k] = null;
}
}
allRegexs.push(/[\0-\uffff]/);
tokenizer = combinePrefixPatterns(allRegexs);
})();
var nPatterns = fallthroughStylePatterns.length;
/**
* Lexes job.sourceCode and attaches an output array job.decorations of
* style classes preceded by the position at which they start in
* job.sourceCode in order.
*
* @type{function (JobT)}
*/
var decorate = function (job) {
var sourceCode = job.sourceCode, basePos = job.basePos;
var sourceNode = job.sourceNode;
/** Even entries are positions in source in ascending order. Odd enties
* are style markers (e.g., PR_COMMENT) that run from that position until
* the end.
* @type {DecorationsT}
*/
var decorations = [basePos, PR_PLAIN];
var pos = 0; // index into sourceCode
var tokens = sourceCode.match(tokenizer) || [];
var styleCache = {};
for (var ti = 0, nTokens = tokens.length; ti < nTokens; ++ti) {
var token = tokens[ti];
var style = styleCache[token];
var match = void 0;
var isEmbedded;
if (typeof style === 'string') {
isEmbedded = false;
} else {
var patternParts = shortcuts[token.charAt(0)];
if (patternParts) {
match = token.match(patternParts[1]);
style = patternParts[0];
} else {
for (var i = 0; i < nPatterns; ++i) {
patternParts = fallthroughStylePatterns[i];
match = token.match(patternParts[1]);
if (match) {
style = patternParts[0];
break;
}
}
if (!match) { // make sure that we make progress
style = PR_PLAIN;
}
}
isEmbedded = style.length >= 5 && 'lang-' === style.substring(0, 5);
if (isEmbedded && !(match && typeof match[1] === 'string')) {
isEmbedded = false;
style = PR_SOURCE;
}
if (!isEmbedded) { styleCache[token] = style; }
}
var tokenStart = pos;
pos += token.length;
if (!isEmbedded) {
decorations.push(basePos + tokenStart, style);
} else { // Treat group 1 as an embedded block of source code.
var embeddedSource = match[1];
var embeddedSourceStart = token.indexOf(embeddedSource);
var embeddedSourceEnd = embeddedSourceStart + embeddedSource.length;
if (match[2]) {
// If embeddedSource can be blank, then it would match at the
// beginning which would cause us to infinitely recurse on the
// entire token, so we catch the right context in match[2].
embeddedSourceEnd = token.length - match[2].length;
embeddedSourceStart = embeddedSourceEnd - embeddedSource.length;
}
var lang = style.substring(5);
// Decorate the left of the embedded source
appendDecorations(
sourceNode,
basePos + tokenStart,
token.substring(0, embeddedSourceStart),
decorate, decorations);
// Decorate the embedded source
appendDecorations(
sourceNode,
basePos + tokenStart + embeddedSourceStart,
embeddedSource,
langHandlerForExtension(lang, embeddedSource),
decorations);
// Decorate the right of the embedded section
appendDecorations(
sourceNode,
basePos + tokenStart + embeddedSourceEnd,
token.substring(embeddedSourceEnd),
decorate, decorations);
}
}
job.decorations = decorations;
};
return decorate;
} | [
"function",
"createSimpleLexer",
"(",
"shortcutStylePatterns",
",",
"fallthroughStylePatterns",
")",
"{",
"var",
"shortcuts",
"=",
"{",
"}",
";",
"var",
"tokenizer",
";",
"(",
"function",
"(",
")",
"{",
"var",
"allPatterns",
"=",
"shortcutStylePatterns",
".",
"c... | Given triples of [style, pattern, context] returns a lexing function,
The lexing function interprets the patterns to find token boundaries and
returns a decoration list of the form
[index_0, style_0, index_1, style_1, ..., index_n, style_n]
where index_n is an index into the sourceCode, and style_n is a style
constant like PR_PLAIN. index_n-1 <= index_n, and style_n-1 applies to
all characters in sourceCode[index_n-1:index_n].
The stylePatterns is a list whose elements have the form
[style : string, pattern : RegExp, DEPRECATED, shortcut : string].
Style is a style constant like PR_PLAIN, or can be a string of the
form 'lang-FOO', where FOO is a language extension describing the
language of the portion of the token in $1 after pattern executes.
E.g., if style is 'lang-lisp', and group 1 contains the text
'(hello (world))', then that portion of the token will be passed to the
registered lisp handler for formatting.
The text before and after group 1 will be restyled using this decorator
so decorators should take care that this doesn't result in infinite
recursion. For example, the HTML lexer rule for SCRIPT elements looks
something like ['lang-js', /<[s]cript>(.+?)<\/script>/]. This may match
'<script>foo()<\/script>', which would cause the current decorator to
be called with '<script>' which would not match the same rule since
group 1 must not be empty, so it would be instead styled as PR_TAG by
the generic tag rule. The handler registered for the 'js' extension would
then be called with 'foo()', and finally, the current decorator would
be called with '<\/script>' which would not match the original rule and
so the generic tag rule would identify it as a tag.
Pattern must only match prefixes, and if it matches a prefix, then that
match is considered a token with the same style.
Context is applied to the last non-whitespace, non-comment token
recognized.
Shortcut is an optional string of characters, any of which, if the first
character, gurantee that this pattern and only this pattern matches.
@param {Array} shortcutStylePatterns patterns that always start with
a known character. Must have a shortcut string.
@param {Array} fallthroughStylePatterns patterns that will be tried in
order if the shortcut ones fail. May have shortcuts.
@return {function (JobT)} a function that takes an undecorated job and
attaches a list of decorations. | [
"Given",
"triples",
"of",
"[",
"style",
"pattern",
"context",
"]",
"returns",
"a",
"lexing",
"function",
"The",
"lexing",
"function",
"interprets",
"the",
"patterns",
"to",
"find",
"token",
"boundaries",
"and",
"returns",
"a",
"decoration",
"list",
"of",
"the"... | e14ed1c3c40f78fca2a11af4cb0fa251f6f997fc | https://github.com/google/code-prettify/blob/e14ed1c3c40f78fca2a11af4cb0fa251f6f997fc/js-modules/prettify.js#L348-L474 | train | Creates a lexer for a simple job. | [
30522,
3853,
9005,
5714,
10814,
2571,
2595,
2121,
1006,
2460,
12690,
21756,
2571,
4502,
12079,
3619,
1010,
2991,
2705,
22494,
5603,
21756,
2571,
4502,
12079,
3619,
1007,
1063,
13075,
2460,
12690,
2015,
1027,
1063,
1065,
1025,
13075,
19204,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
airyland/vux | src/components/clocker/clocker.js | pluralize | function pluralize (format, count) {
var plural = 's'
var singular = ''
if (format) {
format = format.replace(/(:||\s)/gi, '').split(/,/)
if (format.length === 1) {
plural = format[0]
} else {
singular = format[0]
plural = format[1]
}
}
if (Math.abs(count) === 1) {
return singular
} else {
return plural
}
} | javascript | function pluralize (format, count) {
var plural = 's'
var singular = ''
if (format) {
format = format.replace(/(:||\s)/gi, '').split(/,/)
if (format.length === 1) {
plural = format[0]
} else {
singular = format[0]
plural = format[1]
}
}
if (Math.abs(count) === 1) {
return singular
} else {
return plural
}
} | [
"function",
"pluralize",
"(",
"format",
",",
"count",
")",
"{",
"var",
"plural",
"=",
"'s'",
"var",
"singular",
"=",
"''",
"if",
"(",
"format",
")",
"{",
"format",
"=",
"format",
".",
"replace",
"(",
"/",
"(:||\\s)",
"/",
"gi",
",",
"''",
")",
".",... | Pluralize | [
"Pluralize"
] | 484fc3c18bdca99b0c08efbb678c0ee0f5ceedd6 | https://github.com/airyland/vux/blob/484fc3c18bdca99b0c08efbb678c0ee0f5ceedd6/src/components/clocker/clocker.js#L117-L134 | train | Pluralize the given number of words in a given format | [
30522,
3853,
13994,
4697,
1006,
4289,
1010,
4175,
1007,
1063,
13075,
30524,
1012,
5672,
1006,
1013,
1006,
1024,
1064,
1064,
1032,
1055,
1007,
1013,
21025,
1010,
1005,
1005,
1007,
1012,
3975,
1006,
1013,
1010,
1013,
1007,
2065,
1006,
4289,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/code-path-analysis/code-path-analyzer.js | processCodePathToEnter | function processCodePathToEnter(analyzer, node) {
let codePath = analyzer.codePath;
let state = codePath && CodePath.getState(codePath);
const parent = node.parent;
switch (node.type) {
case "Program":
case "FunctionDeclaration":
case "FunctionExpression":
case "ArrowFunctionExpression":
if (codePath) {
// Emits onCodePathSegmentStart events if updated.
forwardCurrentToHead(analyzer, node);
debug.dumpState(node, state, false);
}
// Create the code path of this scope.
codePath = analyzer.codePath = new CodePath(
analyzer.idGenerator.next(),
codePath,
analyzer.onLooped
);
state = CodePath.getState(codePath);
// Emits onCodePathStart events.
debug.dump(`onCodePathStart ${codePath.id}`);
analyzer.emitter.emit("onCodePathStart", codePath, node);
break;
case "LogicalExpression":
if (isHandledLogicalOperator(node.operator)) {
state.pushChoiceContext(
node.operator,
isForkingByTrueOrFalse(node)
);
}
break;
case "ConditionalExpression":
case "IfStatement":
state.pushChoiceContext("test", false);
break;
case "SwitchStatement":
state.pushSwitchContext(
node.cases.some(isCaseNode),
astUtils.getLabel(node)
);
break;
case "TryStatement":
state.pushTryContext(Boolean(node.finalizer));
break;
case "SwitchCase":
/*
* Fork if this node is after the 2st node in `cases`.
* It's similar to `else` blocks.
* The next `test` node is processed in this path.
*/
if (parent.discriminant !== node && parent.cases[0] !== node) {
state.forkPath();
}
break;
case "WhileStatement":
case "DoWhileStatement":
case "ForStatement":
case "ForInStatement":
case "ForOfStatement":
state.pushLoopContext(node.type, astUtils.getLabel(node));
break;
case "LabeledStatement":
if (!astUtils.isBreakableStatement(node.body)) {
state.pushBreakContext(false, node.label.name);
}
break;
default:
break;
}
// Emits onCodePathSegmentStart events if updated.
forwardCurrentToHead(analyzer, node);
debug.dumpState(node, state, false);
} | javascript | function processCodePathToEnter(analyzer, node) {
let codePath = analyzer.codePath;
let state = codePath && CodePath.getState(codePath);
const parent = node.parent;
switch (node.type) {
case "Program":
case "FunctionDeclaration":
case "FunctionExpression":
case "ArrowFunctionExpression":
if (codePath) {
// Emits onCodePathSegmentStart events if updated.
forwardCurrentToHead(analyzer, node);
debug.dumpState(node, state, false);
}
// Create the code path of this scope.
codePath = analyzer.codePath = new CodePath(
analyzer.idGenerator.next(),
codePath,
analyzer.onLooped
);
state = CodePath.getState(codePath);
// Emits onCodePathStart events.
debug.dump(`onCodePathStart ${codePath.id}`);
analyzer.emitter.emit("onCodePathStart", codePath, node);
break;
case "LogicalExpression":
if (isHandledLogicalOperator(node.operator)) {
state.pushChoiceContext(
node.operator,
isForkingByTrueOrFalse(node)
);
}
break;
case "ConditionalExpression":
case "IfStatement":
state.pushChoiceContext("test", false);
break;
case "SwitchStatement":
state.pushSwitchContext(
node.cases.some(isCaseNode),
astUtils.getLabel(node)
);
break;
case "TryStatement":
state.pushTryContext(Boolean(node.finalizer));
break;
case "SwitchCase":
/*
* Fork if this node is after the 2st node in `cases`.
* It's similar to `else` blocks.
* The next `test` node is processed in this path.
*/
if (parent.discriminant !== node && parent.cases[0] !== node) {
state.forkPath();
}
break;
case "WhileStatement":
case "DoWhileStatement":
case "ForStatement":
case "ForInStatement":
case "ForOfStatement":
state.pushLoopContext(node.type, astUtils.getLabel(node));
break;
case "LabeledStatement":
if (!astUtils.isBreakableStatement(node.body)) {
state.pushBreakContext(false, node.label.name);
}
break;
default:
break;
}
// Emits onCodePathSegmentStart events if updated.
forwardCurrentToHead(analyzer, node);
debug.dumpState(node, state, false);
} | [
"function",
"processCodePathToEnter",
"(",
"analyzer",
",",
"node",
")",
"{",
"let",
"codePath",
"=",
"analyzer",
".",
"codePath",
";",
"let",
"state",
"=",
"codePath",
"&&",
"CodePath",
".",
"getState",
"(",
"codePath",
")",
";",
"const",
"parent",
"=",
"... | Updates the code path due to the type of a given node in entering.
@param {CodePathAnalyzer} analyzer - The instance.
@param {ASTNode} node - The current AST node.
@returns {void} | [
"Updates",
"the",
"code",
"path",
"due",
"to",
"the",
"type",
"of",
"a",
"given",
"node",
"in",
"entering",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/code-path-analysis/code-path-analyzer.js#L347-L435 | train | Process the code path to enter. | [
30522,
3853,
2832,
16044,
15069,
3406,
29110,
1006,
17908,
2099,
1010,
13045,
1007,
1063,
2292,
3642,
15069,
1027,
17908,
2099,
1012,
3642,
15069,
1025,
2292,
2110,
1027,
3642,
15069,
1004,
1004,
3642,
15069,
1012,
4152,
12259,
1006,
3642,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/selectors.js | matchDescendant | function matchDescendant(nodes, predicate) {
return uniqueReduce(
(matches, node) => matches.concat(treeFilter(node, predicate)),
flat(nodes.map(childrenOfNode)),
);
} | javascript | function matchDescendant(nodes, predicate) {
return uniqueReduce(
(matches, node) => matches.concat(treeFilter(node, predicate)),
flat(nodes.map(childrenOfNode)),
);
} | [
"function",
"matchDescendant",
"(",
"nodes",
",",
"predicate",
")",
"{",
"return",
"uniqueReduce",
"(",
"(",
"matches",
",",
"node",
")",
"=>",
"matches",
".",
"concat",
"(",
"treeFilter",
"(",
"node",
",",
"predicate",
")",
")",
",",
"flat",
"(",
"nodes... | Matches all descendant nodes against a predicate,
returning those that match.
@param {Array<Node>} nodes
@param {Function} predicate | [
"Matches",
"all",
"descendant",
"nodes",
"against",
"a",
"predicate",
"returning",
"those",
"that",
"match",
"."
] | cd430eae95eba151f17e970ee77c18f09476de0e | https://github.com/airbnb/enzyme/blob/cd430eae95eba151f17e970ee77c18f09476de0e/packages/enzyme/src/selectors.js#L361-L366 | train | Match a node s descendant nodes with a predicate function | [
30522,
3853,
2674,
6155,
23865,
4630,
1006,
14164,
1010,
3653,
16467,
1007,
1063,
2709,
4310,
5596,
18796,
1006,
1006,
3503,
1010,
13045,
1007,
1027,
1028,
3503,
1012,
9530,
11266,
1006,
3392,
8873,
21928,
1006,
13045,
1010,
3653,
16467,
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 | third_party/js/mozmill/shared-modules/private-browsing.js | privateBrowsing_stop | function privateBrowsing_stop(useShortcut)
{
if (!this.enabled)
return;
if (useShortcut) {
var privateBrowsingCmdKey = utils.getEntity(this.getDtds(), "privateBrowsingCmd.commandkey");
this._controller.keypress(null, privateBrowsingCmdKey, {accelKey: true, shiftKey: true});
} else {
this._controller.click(this._pbMenuItem);
}
this.waitForTransistionComplete(false);
} | javascript | function privateBrowsing_stop(useShortcut)
{
if (!this.enabled)
return;
if (useShortcut) {
var privateBrowsingCmdKey = utils.getEntity(this.getDtds(), "privateBrowsingCmd.commandkey");
this._controller.keypress(null, privateBrowsingCmdKey, {accelKey: true, shiftKey: true});
} else {
this._controller.click(this._pbMenuItem);
}
this.waitForTransistionComplete(false);
} | [
"function",
"privateBrowsing_stop",
"(",
"useShortcut",
")",
"{",
"if",
"(",
"!",
"this",
".",
"enabled",
")",
"return",
";",
"if",
"(",
"useShortcut",
")",
"{",
"var",
"privateBrowsingCmdKey",
"=",
"utils",
".",
"getEntity",
"(",
"this",
".",
"getDtds",
"... | Stop the Private Browsing mode
@param {boolean} useShortcut
Use the keyboard shortcut if true otherwise the menu entry is used | [
"Stop",
"the",
"Private",
"Browsing",
"mode"
] | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/private-browsing.js#L206-L219 | train | Stop the private browsing | [
30522,
3853,
2797,
12618,
9333,
2075,
1035,
2644,
1006,
3594,
27794,
12690,
1007,
1063,
2065,
1006,
999,
2023,
1012,
9124,
1007,
2709,
1025,
2065,
1006,
3594,
27794,
12690,
1007,
1063,
13075,
2797,
12618,
9333,
2075,
27487,
2094,
14839,
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... |
GeekyAnts/vue-native-core | examples/todomvc/app.js | onHashChange | function onHashChange () {
var visibility = window.location.hash.replace(/#\/?/, '')
if (filters[visibility]) {
app.visibility = visibility
} else {
window.location.hash = ''
app.visibility = 'all'
}
} | javascript | function onHashChange () {
var visibility = window.location.hash.replace(/#\/?/, '')
if (filters[visibility]) {
app.visibility = visibility
} else {
window.location.hash = ''
app.visibility = 'all'
}
} | [
"function",
"onHashChange",
"(",
")",
"{",
"var",
"visibility",
"=",
"window",
".",
"location",
".",
"hash",
".",
"replace",
"(",
"/",
"#\\/?",
"/",
",",
"''",
")",
"if",
"(",
"filters",
"[",
"visibility",
"]",
")",
"{",
"app",
".",
"visibility",
"="... | handle routing | [
"handle",
"routing"
] | a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e | https://github.com/GeekyAnts/vue-native-core/blob/a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e/examples/todomvc/app.js#L143-L151 | train | When the hash is changed update the app. visibility | [
30522,
3853,
2006,
14949,
16257,
18003,
2063,
1006,
1007,
1063,
13075,
16476,
1027,
3332,
1012,
3295,
1012,
23325,
1012,
5672,
1006,
1013,
1001,
1032,
1013,
1029,
1013,
1010,
1005,
1005,
1007,
2065,
1006,
17736,
1031,
16476,
1033,
1007,
106... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/core/support/techinfo/TechnicalInfo.js | function(sParameter, vValue) {
// fetch current parameters from URL
var sSearch = window.location.search,
sURLParameter = sParameter + "=" + vValue;
/// replace or append the new URL parameter
if (sSearch && sSearch !== "?") {
var oRegExp = new RegExp("(?:^|\\?|&)" + sParameter + "=[^&]+");
if (sSearch.match(oRegExp)) {
sSearch = sSearch.replace(oRegExp, sURLParameter);
} else {
sSearch += "&" + sURLParameter;
}
} else {
sSearch = "?" + sURLParameter;
}
// reload the page by setting the new parameters
window.location.search = sSearch;
} | javascript | function(sParameter, vValue) {
// fetch current parameters from URL
var sSearch = window.location.search,
sURLParameter = sParameter + "=" + vValue;
/// replace or append the new URL parameter
if (sSearch && sSearch !== "?") {
var oRegExp = new RegExp("(?:^|\\?|&)" + sParameter + "=[^&]+");
if (sSearch.match(oRegExp)) {
sSearch = sSearch.replace(oRegExp, sURLParameter);
} else {
sSearch += "&" + sURLParameter;
}
} else {
sSearch = "?" + sURLParameter;
}
// reload the page by setting the new parameters
window.location.search = sSearch;
} | [
"function",
"(",
"sParameter",
",",
"vValue",
")",
"{",
"// fetch current parameters from URL",
"var",
"sSearch",
"=",
"window",
".",
"location",
".",
"search",
",",
"sURLParameter",
"=",
"sParameter",
"+",
"\"=\"",
"+",
"vValue",
";",
"/// replace or append the new... | Replaces the URL parameter and triggers a reload of the current page
@param {string} sParameter Parameter name
@param {any} vValue Parameter value
@private | [
"Replaces",
"the",
"URL",
"parameter",
"and",
"triggers",
"a",
"reload",
"of",
"the",
"current",
"page"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/support/techinfo/TechnicalInfo.js#L876-L895 | train | replace the current URL parameter with the new value | [
30522,
3853,
1006,
12403,
6444,
15141,
1010,
1058,
10175,
5657,
1007,
1063,
1013,
1013,
18584,
2783,
11709,
2013,
24471,
2140,
13075,
7020,
14644,
2818,
1027,
3332,
1012,
3295,
1012,
3945,
1010,
7505,
14277,
5400,
22828,
1027,
12403,
6444,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
nhn/tui.editor | src/js/extensions/colorSyntax.js | changeDecColorsToHex | function changeDecColorsToHex(color) {
return color.replace(decimalColorRx, (colorValue, r, g, b) => {
const hr = changeDecColorToHex(r);
const hg = changeDecColorToHex(g);
const hb = changeDecColorToHex(b);
return `#${hr}${hg}${hb}`;
});
} | javascript | function changeDecColorsToHex(color) {
return color.replace(decimalColorRx, (colorValue, r, g, b) => {
const hr = changeDecColorToHex(r);
const hg = changeDecColorToHex(g);
const hb = changeDecColorToHex(b);
return `#${hr}${hg}${hb}`;
});
} | [
"function",
"changeDecColorsToHex",
"(",
"color",
")",
"{",
"return",
"color",
".",
"replace",
"(",
"decimalColorRx",
",",
"(",
"colorValue",
",",
"r",
",",
"g",
",",
"b",
")",
"=>",
"{",
"const",
"hr",
"=",
"changeDecColorToHex",
"(",
"r",
")",
";",
"... | Change decimal color values to hexadecimal color value
@param {string} color Color value string
@returns {string}
@ignore | [
"Change",
"decimal",
"color",
"values",
"to",
"hexadecimal",
"color",
"value"
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/extensions/colorSyntax.js#L290-L298 | train | Change decimal colors to hex | [
30522,
3853,
2904,
8586,
18717,
16033,
5369,
2595,
1006,
3609,
1007,
1063,
2709,
3609,
1012,
5672,
1006,
26066,
18717,
2099,
2595,
1010,
1006,
3609,
10175,
5657,
1010,
1054,
1010,
1043,
1010,
1038,
1007,
1027,
1028,
1063,
9530,
3367,
17850,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SeleniumHQ/selenium | third_party/js/mozmill/shared-modules/search.js | engineManager_moveUpEngine | function engineManager_moveUpEngine(name) {
this.selectedEngine = name;
var index = this.selectedIndex;
var button = this.getElement({type: "engine_button", subtype: "up"});
this._controller.click(button);
this._controller.waitForEval("subject.manager.selectedIndex == subject.oldIndex - 1", TIMEOUT, 100,
{manager: this, oldIndex: index});
} | javascript | function engineManager_moveUpEngine(name) {
this.selectedEngine = name;
var index = this.selectedIndex;
var button = this.getElement({type: "engine_button", subtype: "up"});
this._controller.click(button);
this._controller.waitForEval("subject.manager.selectedIndex == subject.oldIndex - 1", TIMEOUT, 100,
{manager: this, oldIndex: index});
} | [
"function",
"engineManager_moveUpEngine",
"(",
"name",
")",
"{",
"this",
".",
"selectedEngine",
"=",
"name",
";",
"var",
"index",
"=",
"this",
".",
"selectedIndex",
";",
"var",
"button",
"=",
"this",
".",
"getElement",
"(",
"{",
"type",
":",
"\"engine_button... | Move up the engine with the given name
@param {string} name
Name of the engine to remove | [
"Move",
"up",
"the",
"engine",
"with",
"the",
"given",
"name"
] | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/search.js#L328-L337 | train | Move engine up | [
30522,
3853,
3194,
24805,
4590,
1035,
2693,
6279,
13159,
3170,
1006,
2171,
1007,
1063,
2023,
1012,
3479,
13159,
3170,
1027,
2171,
1025,
13075,
5950,
1027,
2023,
1012,
3479,
22254,
10288,
1025,
13075,
6462,
1027,
2023,
1012,
2131,
12260,
367... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | tools/internal-rules/consistent-docs-url.js | checkMetaDocsUrl | function checkMetaDocsUrl(context, exportsNode) {
if (exportsNode.type !== "ObjectExpression") {
// if the exported node is not the correct format, "internal-no-invalid-meta" will already report this.
return;
}
const metaProperty = getPropertyFromObject("meta", exportsNode);
const metaDocs = metaProperty && getPropertyFromObject("docs", metaProperty.value);
const metaDocsUrl = metaDocs && getPropertyFromObject("url", metaDocs.value);
if (!metaDocs) {
context.report({
node: metaProperty,
message: "Rule is missing a meta.docs property"
});
return;
}
if (!metaDocsUrl) {
context.report({
node: metaDocs,
message: "Rule is missing a meta.docs.url property"
});
return;
}
const ruleId = path.basename(context.getFilename().replace(/.js$/u, ""));
const expected = `https://eslint.org/docs/rules/${ruleId}`;
const url = metaDocsUrl.value.value;
if (url !== expected) {
context.report({
node: metaDocsUrl.value,
message: `Incorrect url. Expected "${expected}" but got "${url}"`
});
}
} | javascript | function checkMetaDocsUrl(context, exportsNode) {
if (exportsNode.type !== "ObjectExpression") {
// if the exported node is not the correct format, "internal-no-invalid-meta" will already report this.
return;
}
const metaProperty = getPropertyFromObject("meta", exportsNode);
const metaDocs = metaProperty && getPropertyFromObject("docs", metaProperty.value);
const metaDocsUrl = metaDocs && getPropertyFromObject("url", metaDocs.value);
if (!metaDocs) {
context.report({
node: metaProperty,
message: "Rule is missing a meta.docs property"
});
return;
}
if (!metaDocsUrl) {
context.report({
node: metaDocs,
message: "Rule is missing a meta.docs.url property"
});
return;
}
const ruleId = path.basename(context.getFilename().replace(/.js$/u, ""));
const expected = `https://eslint.org/docs/rules/${ruleId}`;
const url = metaDocsUrl.value.value;
if (url !== expected) {
context.report({
node: metaDocsUrl.value,
message: `Incorrect url. Expected "${expected}" but got "${url}"`
});
}
} | [
"function",
"checkMetaDocsUrl",
"(",
"context",
",",
"exportsNode",
")",
"{",
"if",
"(",
"exportsNode",
".",
"type",
"!==",
"\"ObjectExpression\"",
")",
"{",
"// if the exported node is not the correct format, \"internal-no-invalid-meta\" will already report this.",
"return",
"... | Verifies that the meta.docs.url property is present and has the correct value.
@param {RuleContext} context The ESLint rule context.
@param {ASTNode} exportsNode ObjectExpression node that the rule exports.
@returns {void} | [
"Verifies",
"that",
"the",
"meta",
".",
"docs",
".",
"url",
"property",
"is",
"present",
"and",
"has",
"the",
"correct",
"value",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/tools/internal-rules/consistent-docs-url.js#L46-L84 | train | Check if the meta. docs. url property is present in the rule | [
30522,
3853,
4638,
11368,
9365,
6169,
3126,
2140,
1006,
6123,
1010,
14338,
3630,
3207,
1007,
1063,
2065,
1006,
14338,
3630,
3207,
1012,
2828,
999,
1027,
1027,
1000,
4874,
10288,
20110,
3258,
1000,
1007,
1063,
1013,
1013,
2065,
1996,
15612,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/support/apps/contentbrowser/controller/LayerContentMaster.controller.js | function (sQuery) {
// add filter for search
var aFilters = [];
if (sQuery && sQuery.length > 0) {
aFilters = new Filter({
filters: [
new Filter("name", FilterOperator.Contains, sQuery),
new Filter("fileType", FilterOperator.Contains, sQuery)
],
and: false
});
}
// update list binding
var oList = this.byId("masterComponentsList");
var oBinding = oList.getBinding("items");
oBinding.filter(aFilters, "content");
} | javascript | function (sQuery) {
// add filter for search
var aFilters = [];
if (sQuery && sQuery.length > 0) {
aFilters = new Filter({
filters: [
new Filter("name", FilterOperator.Contains, sQuery),
new Filter("fileType", FilterOperator.Contains, sQuery)
],
and: false
});
}
// update list binding
var oList = this.byId("masterComponentsList");
var oBinding = oList.getBinding("items");
oBinding.filter(aFilters, "content");
} | [
"function",
"(",
"sQuery",
")",
"{",
"// add filter for search",
"var",
"aFilters",
"=",
"[",
"]",
";",
"if",
"(",
"sQuery",
"&&",
"sQuery",
".",
"length",
">",
"0",
")",
"{",
"aFilters",
"=",
"new",
"Filter",
"(",
"{",
"filters",
":",
"[",
"new",
"F... | Filters the binding of the master list;
This function is also called once navigation to the page to clear the filters or input search entry.
@param {String} sQuery - entered string within the search field
@public | [
"Filters",
"the",
"binding",
"of",
"the",
"master",
"list",
";",
"This",
"function",
"is",
"also",
"called",
"once",
"navigation",
"to",
"the",
"page",
"to",
"clear",
"the",
"filters",
"or",
"input",
"search",
"entry",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/support/apps/contentbrowser/controller/LayerContentMaster.controller.js#L96-L113 | train | search for all items in the master components list | [
30522,
3853,
1006,
5490,
13094,
2100,
1007,
1063,
1013,
1013,
5587,
11307,
2005,
3945,
13075,
28697,
21928,
2015,
1027,
1031,
1033,
1025,
2065,
1006,
5490,
13094,
2100,
1004,
1004,
5490,
13094,
2100,
1012,
3091,
1028,
1014,
1007,
1063,
2869... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/single/Single.js | function (axisModel, ecModel, api) {
var dim = this.dimension;
var axis = new SingleAxis(
dim,
axisHelper.createScaleByModel(axisModel),
[0, 0],
axisModel.get('type'),
axisModel.get('position')
);
var isCategory = axis.type === 'category';
axis.onBand = isCategory && axisModel.get('boundaryGap');
axis.inverse = axisModel.get('inverse');
axis.orient = axisModel.get('orient');
axisModel.axis = axis;
axis.model = axisModel;
axis.coordinateSystem = this;
this._axis = axis;
} | javascript | function (axisModel, ecModel, api) {
var dim = this.dimension;
var axis = new SingleAxis(
dim,
axisHelper.createScaleByModel(axisModel),
[0, 0],
axisModel.get('type'),
axisModel.get('position')
);
var isCategory = axis.type === 'category';
axis.onBand = isCategory && axisModel.get('boundaryGap');
axis.inverse = axisModel.get('inverse');
axis.orient = axisModel.get('orient');
axisModel.axis = axis;
axis.model = axisModel;
axis.coordinateSystem = this;
this._axis = axis;
} | [
"function",
"(",
"axisModel",
",",
"ecModel",
",",
"api",
")",
"{",
"var",
"dim",
"=",
"this",
".",
"dimension",
";",
"var",
"axis",
"=",
"new",
"SingleAxis",
"(",
"dim",
",",
"axisHelper",
".",
"createScaleByModel",
"(",
"axisModel",
")",
",",
"[",
"0... | Initialize single coordinate system.
@param {module:echarts/coord/single/AxisModel} axisModel
@param {module:echarts/model/Global} ecModel
@param {module:echarts/ExtensionAPI} api
@private | [
"Initialize",
"single",
"coordinate",
"system",
"."
] | 4d0ea095dc3929cb6de40c45748826e7999c7aa8 | https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/coord/single/Single.js#L88-L109 | train | Add a single axis to the coordSystem | [
30522,
3853,
1006,
8123,
5302,
9247,
1010,
14925,
5302,
9247,
1010,
17928,
1007,
1063,
13075,
11737,
1027,
2023,
1012,
9812,
1025,
13075,
8123,
1027,
2047,
2309,
8528,
2483,
1006,
11737,
1010,
8123,
16001,
4842,
1012,
9005,
9289,
15878,
243... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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) {
var oTable = this.getTable(),
oColumn = sap.ui.getCore().byId($Cell.attr("data-sap-ui-colid")),
mAttributes = ExtensionHelper.getAriaAttributesFor(this, TableAccExtension.ELEMENTTYPES.COLUMNHEADER, {
headerId: $Cell.attr("id"),
column: oColumn,
index: $Cell.attr("data-sap-ui-colindex")
}),
sText = ExtensionHelper.getColumnTooltip(oColumn),
aLabels = [oTable.getId() + "-colnumberofcols"].concat(mAttributes["aria-labelledby"]),
oCellInfo = TableUtils.getCellInfo($Cell),
iSpan = oCellInfo.columnSpan;
if (iSpan > 1) {
aLabels.push(oTable.getId() + "-ariacolspan");
// Update Span information
oTable.$("ariacolspan").text(TableUtils.getResourceText("TBL_COL_DESC_SPAN", ["" + iSpan]));
}
if (sText) {
aLabels.push(oTable.getId() + "-cellacc");
}
if (iSpan <= 1 && oColumn && oColumn.getSorted()) {
aLabels.push(oTable.getId() + (oColumn.getSortOrder() === "Ascending" ? "-ariacolsortedasc" : "-ariacolsorteddes"));
}
if (iSpan <= 1 && oColumn && oColumn.getFiltered()) {
aLabels.push(oTable.getId() + "-ariacolfiltered");
}
if (Device.browser.msie) {
if (iSpan <= 1 && $Cell.attr("aria-haspopup") === "true") {
aLabels.push(oTable.getId() + "-ariacolmenu");
}
}
ExtensionHelper.performCellModifications(this, $Cell, mAttributes["aria-labelledby"], mAttributes["aria-describedby"],
aLabels, mAttributes["aria-describedby"], sText
);
} | javascript | function($Cell) {
var oTable = this.getTable(),
oColumn = sap.ui.getCore().byId($Cell.attr("data-sap-ui-colid")),
mAttributes = ExtensionHelper.getAriaAttributesFor(this, TableAccExtension.ELEMENTTYPES.COLUMNHEADER, {
headerId: $Cell.attr("id"),
column: oColumn,
index: $Cell.attr("data-sap-ui-colindex")
}),
sText = ExtensionHelper.getColumnTooltip(oColumn),
aLabels = [oTable.getId() + "-colnumberofcols"].concat(mAttributes["aria-labelledby"]),
oCellInfo = TableUtils.getCellInfo($Cell),
iSpan = oCellInfo.columnSpan;
if (iSpan > 1) {
aLabels.push(oTable.getId() + "-ariacolspan");
// Update Span information
oTable.$("ariacolspan").text(TableUtils.getResourceText("TBL_COL_DESC_SPAN", ["" + iSpan]));
}
if (sText) {
aLabels.push(oTable.getId() + "-cellacc");
}
if (iSpan <= 1 && oColumn && oColumn.getSorted()) {
aLabels.push(oTable.getId() + (oColumn.getSortOrder() === "Ascending" ? "-ariacolsortedasc" : "-ariacolsorteddes"));
}
if (iSpan <= 1 && oColumn && oColumn.getFiltered()) {
aLabels.push(oTable.getId() + "-ariacolfiltered");
}
if (Device.browser.msie) {
if (iSpan <= 1 && $Cell.attr("aria-haspopup") === "true") {
aLabels.push(oTable.getId() + "-ariacolmenu");
}
}
ExtensionHelper.performCellModifications(this, $Cell, mAttributes["aria-labelledby"], mAttributes["aria-describedby"],
aLabels, mAttributes["aria-describedby"], sText
);
} | [
"function",
"(",
"$Cell",
")",
"{",
"var",
"oTable",
"=",
"this",
".",
"getTable",
"(",
")",
",",
"oColumn",
"=",
"sap",
".",
"ui",
".",
"getCore",
"(",
")",
".",
"byId",
"(",
"$Cell",
".",
"attr",
"(",
"\"data-sap-ui-colid\"",
")",
")",
",",
"mAtt... | /*
Modifies the labels and descriptions of a column header cell.
@see ExtensionHelper.performCellModifications | [
"/",
"*",
"Modifies",
"the",
"labels",
"and",
"descriptions",
"of",
"a",
"column",
"header",
"cell",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableAccExtension.js#L471-L510 | train | Updates the aria - labelledby attribute of the given cell | [
30522,
3853,
1006,
1002,
3526,
1007,
1063,
13075,
27178,
3085,
1027,
2023,
1012,
2131,
10880,
1006,
1007,
1010,
1051,
25778,
2819,
2078,
1027,
20066,
1012,
21318,
1012,
2131,
17345,
1006,
1007,
1012,
2011,
3593,
1006,
1002,
3526,
1012,
2012... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/LiveDevServerManager.js | registerServer | function registerServer(provider, priority) {
if (!provider.create) {
console.error("Incompatible live development server provider");
return;
}
var providerObj = {};
providerObj.create = provider.create;
providerObj.priority = priority || 0;
_serverProviders.push(providerObj);
_serverProviders.sort(_providerSort);
return providerObj;
} | javascript | function registerServer(provider, priority) {
if (!provider.create) {
console.error("Incompatible live development server provider");
return;
}
var providerObj = {};
providerObj.create = provider.create;
providerObj.priority = priority || 0;
_serverProviders.push(providerObj);
_serverProviders.sort(_providerSort);
return providerObj;
} | [
"function",
"registerServer",
"(",
"provider",
",",
"priority",
")",
"{",
"if",
"(",
"!",
"provider",
".",
"create",
")",
"{",
"console",
".",
"error",
"(",
"\"Incompatible live development server provider\"",
")",
";",
"return",
";",
"}",
"var",
"providerObj",
... | The method by which a server registers itself. It returns an
object handler that can be used to remove that server from the list.
@param {BaseServer|{create: function():BaseServer}} provider
The provider to be registered, described below.
@param {number} priority
A non-negative number used to break ties among providers for a
particular url. Providers that register with a higher priority will
have the opportunity to provide a given url before those with a
lower priority. The higher the number, the higher the priority.
@return {{object}} | [
"The",
"method",
"by",
"which",
"a",
"server",
"registers",
"itself",
".",
"It",
"returns",
"an",
"object",
"handler",
"that",
"can",
"be",
"used",
"to",
"remove",
"that",
"server",
"from",
"the",
"list",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/LiveDevelopment/LiveDevServerManager.js#L91-L106 | train | Register a live development server provider | [
30522,
3853,
18687,
2121,
6299,
1006,
10802,
1010,
9470,
1007,
1063,
2065,
1006,
999,
10802,
1012,
3443,
1007,
1063,
10122,
1012,
7561,
1006,
1000,
25876,
2444,
2458,
8241,
10802,
1000,
1007,
1025,
2709,
1025,
1065,
13075,
10802,
16429,
350... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SeleniumHQ/selenium | javascript/selenium-core/xpath/util.js | xmlImportNode | function xmlImportNode(doc, node) {
if (node.nodeType == DOM_TEXT_NODE) {
return domCreateTextNode(doc, node.nodeValue);
} else if (node.nodeType == DOM_CDATA_SECTION_NODE) {
return domCreateCDATASection(doc, node.nodeValue);
} else if (node.nodeType == DOM_ELEMENT_NODE) {
var newNode = domCreateElement(doc, node.nodeName);
for (var i = 0; i < node.attributes.length; ++i) {
var an = node.attributes[i];
var name = an.nodeName;
var value = an.nodeValue;
domSetAttribute(newNode, name, value);
}
for (var c = node.firstChild; c; c = c.nextSibling) {
var cn = arguments.callee(doc, c);
domAppendChild(newNode, cn);
}
return newNode;
} else {
return domCreateComment(doc, node.nodeName);
}
} | javascript | function xmlImportNode(doc, node) {
if (node.nodeType == DOM_TEXT_NODE) {
return domCreateTextNode(doc, node.nodeValue);
} else if (node.nodeType == DOM_CDATA_SECTION_NODE) {
return domCreateCDATASection(doc, node.nodeValue);
} else if (node.nodeType == DOM_ELEMENT_NODE) {
var newNode = domCreateElement(doc, node.nodeName);
for (var i = 0; i < node.attributes.length; ++i) {
var an = node.attributes[i];
var name = an.nodeName;
var value = an.nodeValue;
domSetAttribute(newNode, name, value);
}
for (var c = node.firstChild; c; c = c.nextSibling) {
var cn = arguments.callee(doc, c);
domAppendChild(newNode, cn);
}
return newNode;
} else {
return domCreateComment(doc, node.nodeName);
}
} | [
"function",
"xmlImportNode",
"(",
"doc",
",",
"node",
")",
"{",
"if",
"(",
"node",
".",
"nodeType",
"==",
"DOM_TEXT_NODE",
")",
"{",
"return",
"domCreateTextNode",
"(",
"doc",
",",
"node",
".",
"nodeValue",
")",
";",
"}",
"else",
"if",
"(",
"node",
"."... | The following function does what document.importNode(node, true) would do for us here; however that method is broken in Safari/1.3, so we have to emulate it. | [
"The",
"following",
"function",
"does",
"what",
"document",
".",
"importNode",
"(",
"node",
"true",
")",
"would",
"do",
"for",
"us",
"here",
";",
"however",
"that",
"method",
"is",
"broken",
"in",
"Safari",
"/",
"1",
".",
"3",
"so",
"we",
"have",
"to",... | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/selenium-core/xpath/util.js#L47-L73 | train | Import a node into a DOM node | [
30522,
3853,
20950,
5714,
6442,
3630,
3207,
1006,
9986,
1010,
13045,
1007,
1063,
2065,
1006,
13045,
1012,
13045,
13874,
1027,
1027,
14383,
1035,
3793,
1035,
13045,
1007,
1063,
2709,
14383,
16748,
3686,
18209,
3630,
3207,
1006,
30524,
19797,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/extensions/default/NavigationAndHistory/main.js | _onFocus | function _onFocus(event) {
var $scope = $(event.target).parent();
$("#mrof-container #mrof-list > li.highlight").removeClass("highlight");
$(event.target).parent().addClass("highlight");
$mrofContainer.find("#recent-file-path").text($scope.data("path"));
$mrofContainer.find("#recent-file-path").attr('title', ($scope.data("path")));
$currentContext = $scope;
} | javascript | function _onFocus(event) {
var $scope = $(event.target).parent();
$("#mrof-container #mrof-list > li.highlight").removeClass("highlight");
$(event.target).parent().addClass("highlight");
$mrofContainer.find("#recent-file-path").text($scope.data("path"));
$mrofContainer.find("#recent-file-path").attr('title', ($scope.data("path")));
$currentContext = $scope;
} | [
"function",
"_onFocus",
"(",
"event",
")",
"{",
"var",
"$scope",
"=",
"$",
"(",
"event",
".",
"target",
")",
".",
"parent",
"(",
")",
";",
"$",
"(",
"\"#mrof-container #mrof-list > li.highlight\"",
")",
".",
"removeClass",
"(",
"\"highlight\"",
")",
";",
"... | Focus handler for the link in list item
@private | [
"Focus",
"handler",
"for",
"the",
"link",
"in",
"list",
"item"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/NavigationAndHistory/main.js#L414-L421 | train | Focus event handler for the file item | [
30522,
3853,
1035,
2006,
14876,
7874,
1006,
2724,
1007,
1063,
13075,
1002,
9531,
1027,
1002,
1006,
2724,
1012,
4539,
1007,
1012,
6687,
1006,
1007,
1025,
1002,
1006,
1000,
1001,
2720,
11253,
1011,
11661,
1001,
2720,
11253,
1011,
2862,
1028,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SheetJS/js-xlsx | xlsx.js | parse_PtgRef3d | function parse_PtgRef3d(blob, length, opts) {
var type = (blob[blob.l] & 0x60)>>5;
blob.l += 1;
var ixti = blob.read_shift(2); // XtiIndex
if(opts && opts.biff == 5) blob.l += 12;
var loc = parse_RgceLoc(blob, 0, opts); // TODO: or RgceLocRel
return [type, ixti, loc];
} | javascript | function parse_PtgRef3d(blob, length, opts) {
var type = (blob[blob.l] & 0x60)>>5;
blob.l += 1;
var ixti = blob.read_shift(2); // XtiIndex
if(opts && opts.biff == 5) blob.l += 12;
var loc = parse_RgceLoc(blob, 0, opts); // TODO: or RgceLocRel
return [type, ixti, loc];
} | [
"function",
"parse_PtgRef3d",
"(",
"blob",
",",
"length",
",",
"opts",
")",
"{",
"var",
"type",
"=",
"(",
"blob",
"[",
"blob",
".",
"l",
"]",
"&",
"0x60",
")",
">>",
"5",
";",
"blob",
".",
"l",
"+=",
"1",
";",
"var",
"ixti",
"=",
"blob",
".",
... | /* [MS-XLS] 2.5.198.85 ; [MS-XLSB] 2.5.97.69 TODO | [
"/",
"*",
"[",
"MS",
"-",
"XLS",
"]",
"2",
".",
"5",
".",
"198",
".",
"85",
";",
"[",
"MS",
"-",
"XLSB",
"]",
"2",
".",
"5",
".",
"97",
".",
"69",
"TODO"
] | 9a6d8a1d3d80c78dad5201fb389316f935279cdc | https://github.com/SheetJS/js-xlsx/blob/9a6d8a1d3d80c78dad5201fb389316f935279cdc/xlsx.js#L10439-L10446 | train | Parse a PTG Ref3D | [
30522,
3853,
11968,
3366,
1035,
13866,
17603,
2546,
29097,
1006,
1038,
4135,
2497,
1010,
3091,
1010,
23569,
2015,
1007,
1063,
13075,
2828,
1027,
1006,
1038,
4135,
2497,
1031,
1038,
4135,
2497,
1012,
1048,
1033,
1004,
1014,
2595,
16086,
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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.