repo stringclasses 195 values | path stringlengths 4 99 | func_name stringlengths 0 41 | original_string stringlengths 72 56.1k | language stringclasses 1 value | code stringlengths 72 56.1k | code_tokens listlengths 25 8.12k | docstring stringlengths 2 12.5k | docstring_tokens listlengths 1 449 | sha stringclasses 197 values | url stringlengths 88 186 | partition stringclasses 1 value | summary stringlengths 8 338 | input_ids listlengths 502 502 | token_type_ids listlengths 502 502 | attention_mask listlengths 502 502 | labels listlengths 502 502 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
SAP/openui5 | src/sap.ui.core/src/sap/ui/model/odata/type/UnitMixin.js | formatValue | function formatValue(aValues, sTargetType) {
var oFormatOptions,
that = this;
if (this.mCustomUnits === undefined && aValues && aValues[2] !== undefined) {
if (aValues[2] === null) { // no unit customizing available
this.mCustomUnits = null;
} else {
this.mCustomUnits = mCodeList2CustomUnits.get(aValues[2]);
if (!this.mCustomUnits) {
this.mCustomUnits = {};
Object.keys(aValues[2]).forEach(function (sKey) {
that.mCustomUnits[sKey] = that.getCustomUnitForKey(aValues[2], sKey);
});
mCodeList2CustomUnits.set(aValues[2], this.mCustomUnits);
}
oFormatOptions = {};
oFormatOptions[sFormatOptionName] = this.mCustomUnits;
fnBaseType.prototype.setFormatOptions.call(this,
Object.assign(oFormatOptions, this.oFormatOptions));
}
}
// composite binding calls formatValue several times,
// where some parts are not yet available
if (!aValues || aValues[0] === undefined || aValues[1] === undefined
|| this.mCustomUnits === undefined && aValues[2] === undefined) {
return null;
}
return fnBaseType.prototype.formatValue.call(this, aValues.slice(0, 2), sTargetType);
} | javascript | function formatValue(aValues, sTargetType) {
var oFormatOptions,
that = this;
if (this.mCustomUnits === undefined && aValues && aValues[2] !== undefined) {
if (aValues[2] === null) { // no unit customizing available
this.mCustomUnits = null;
} else {
this.mCustomUnits = mCodeList2CustomUnits.get(aValues[2]);
if (!this.mCustomUnits) {
this.mCustomUnits = {};
Object.keys(aValues[2]).forEach(function (sKey) {
that.mCustomUnits[sKey] = that.getCustomUnitForKey(aValues[2], sKey);
});
mCodeList2CustomUnits.set(aValues[2], this.mCustomUnits);
}
oFormatOptions = {};
oFormatOptions[sFormatOptionName] = this.mCustomUnits;
fnBaseType.prototype.setFormatOptions.call(this,
Object.assign(oFormatOptions, this.oFormatOptions));
}
}
// composite binding calls formatValue several times,
// where some parts are not yet available
if (!aValues || aValues[0] === undefined || aValues[1] === undefined
|| this.mCustomUnits === undefined && aValues[2] === undefined) {
return null;
}
return fnBaseType.prototype.formatValue.call(this, aValues.slice(0, 2), sTargetType);
} | [
"function",
"formatValue",
"(",
"aValues",
",",
"sTargetType",
")",
"{",
"var",
"oFormatOptions",
",",
"that",
"=",
"this",
";",
"if",
"(",
"this",
".",
"mCustomUnits",
"===",
"undefined",
"&&",
"aValues",
"&&",
"aValues",
"[",
"2",
"]",
"!==",
"undefined"... | Formats the given values of the parts of the composite type to the given target type.
@param {any[]} aValues
Array of part values to be formatted; contains in the following order: Measure or
amount, unit or currency, and the corresponding customizing. The first call to this
method where all parts are set determines the customizing; subsequent calls use this
customizing, so that the corresponding part may be omitted. Changes to the customizing
part after this first method call are not considered: The customizing for this instance
remains unchanged.
@param {string} sTargetType
The target type; must be "string" or a type with "string" as its
{@link sap.ui.base.DataType#getPrimitiveType primitive type}.
See {@link sap.ui.model.odata.type} for more information.
@returns {string}
The formatted output value; <code>null</code>, if <code>aValues</code> is
<code>undefined</code> or <code>null</code> or if the measure or amount, the unit or
currency or the corresponding customizing contained therein is <code>undefined</code>.
@throws {sap.ui.model.FormatException}
If <code>sTargetType</code> is unsupported
@function
@name sap.ui.model.odata.type.UnitMixin#formatValue
@public
@since 1.63.0 | [
"Formats",
"the",
"given",
"values",
"of",
"the",
"parts",
"of",
"the",
"composite",
"type",
"to",
"the",
"given",
"target",
"type",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/type/UnitMixin.js#L120-L151 | train | Format the value of the binding | [
30522,
3853,
4289,
10175,
5657,
1006,
10927,
7630,
2229,
1010,
2732,
18150,
13874,
1007,
1063,
13075,
1997,
2953,
18900,
7361,
9285,
1010,
2008,
1027,
2023,
1025,
2065,
1006,
2023,
1012,
11338,
19966,
5358,
19496,
3215,
1027,
1027,
1027,
61... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/node-event-generator.js | getPossibleTypes | function getPossibleTypes(parsedSelector) {
switch (parsedSelector.type) {
case "identifier":
return [parsedSelector.value];
case "matches": {
const typesForComponents = parsedSelector.selectors.map(getPossibleTypes);
if (typesForComponents.every(Boolean)) {
return lodash.union(...typesForComponents);
}
return null;
}
case "compound": {
const typesForComponents = parsedSelector.selectors.map(getPossibleTypes).filter(typesForComponent => typesForComponent);
// If all of the components could match any type, then the compound could also match any type.
if (!typesForComponents.length) {
return null;
}
/*
* If at least one of the components could only match a particular type, the compound could only match
* the intersection of those types.
*/
return lodash.intersection(...typesForComponents);
}
case "child":
case "descendant":
case "sibling":
case "adjacent":
return getPossibleTypes(parsedSelector.right);
default:
return null;
}
} | javascript | function getPossibleTypes(parsedSelector) {
switch (parsedSelector.type) {
case "identifier":
return [parsedSelector.value];
case "matches": {
const typesForComponents = parsedSelector.selectors.map(getPossibleTypes);
if (typesForComponents.every(Boolean)) {
return lodash.union(...typesForComponents);
}
return null;
}
case "compound": {
const typesForComponents = parsedSelector.selectors.map(getPossibleTypes).filter(typesForComponent => typesForComponent);
// If all of the components could match any type, then the compound could also match any type.
if (!typesForComponents.length) {
return null;
}
/*
* If at least one of the components could only match a particular type, the compound could only match
* the intersection of those types.
*/
return lodash.intersection(...typesForComponents);
}
case "child":
case "descendant":
case "sibling":
case "adjacent":
return getPossibleTypes(parsedSelector.right);
default:
return null;
}
} | [
"function",
"getPossibleTypes",
"(",
"parsedSelector",
")",
"{",
"switch",
"(",
"parsedSelector",
".",
"type",
")",
"{",
"case",
"\"identifier\"",
":",
"return",
"[",
"parsedSelector",
".",
"value",
"]",
";",
"case",
"\"matches\"",
":",
"{",
"const",
"typesFor... | ------------------------------------------------------------------------------ Helpers ------------------------------------------------------------------------------
Gets the possible types of a selector
@param {Object} parsedSelector An object (from esquery) describing the matching behavior of the selector
@returns {string[]|null} The node types that could possibly trigger this selector, or `null` if all node types could trigger it | [
"------------------------------------------------------------------------------",
"Helpers",
"------------------------------------------------------------------------------",
"Gets",
"the",
"possible",
"types",
"of",
"a",
"selector"
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/util/node-event-generator.js#L40-L79 | train | Get possible types for a selector | [
30522,
3853,
2131,
6873,
18719,
3468,
13874,
2015,
1006,
11968,
6924,
11246,
22471,
2953,
1007,
1063,
6942,
1006,
11968,
6924,
11246,
22471,
2953,
1012,
2828,
1007,
1063,
2553,
1000,
8909,
4765,
18095,
1000,
1024,
2709,
1031,
11968,
6924,
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... |
jaywcjlove/linux-command | template/js/index.js | function (type) {
var items = this.elm_result.children;
var index = 0;
for (var i = 0; i < items.length; i++) {
if (items[i].className == 'ok') {
items[i].className = '';
if (type == 'up') index = i - 1;
else index = i + 1;
break;
};
};
if (items[index]) items[index].className = 'ok';
} | javascript | function (type) {
var items = this.elm_result.children;
var index = 0;
for (var i = 0; i < items.length; i++) {
if (items[i].className == 'ok') {
items[i].className = '';
if (type == 'up') index = i - 1;
else index = i + 1;
break;
};
};
if (items[index]) items[index].className = 'ok';
} | [
"function",
"(",
"type",
")",
"{",
"var",
"items",
"=",
"this",
".",
"elm_result",
".",
"children",
";",
"var",
"index",
"=",
"0",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"items",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"... | 选中搜索结果效果 | [
"选中搜索结果效果"
] | 7d6c8c6b3468a0dd5311ee68934c9b8db64469f7 | https://github.com/jaywcjlove/linux-command/blob/7d6c8c6b3468a0dd5311ee68934c9b8db64469f7/template/js/index.js#L133-L145 | train | Check if the result is ok | [
30522,
3853,
1006,
2828,
1007,
1063,
13075,
5167,
1027,
2023,
1012,
17709,
1035,
2765,
1012,
2336,
1025,
13075,
5950,
1027,
1014,
1025,
2005,
1006,
13075,
1045,
1027,
1014,
1025,
1045,
1026,
5167,
1012,
3091,
1025,
1045,
1009,
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... | |
SAP/openui5 | src/sap.ui.core/src/sap/ui/core/mvc/ControllerExtension.js | function() {
var mMethods = {};
var oMetadata = this.getMetadata();
var aPublicMethods = oMetadata.getAllPublicMethods();
aPublicMethods.forEach(function(sMethod) {
var fnFunction = this[sMethod];
if (typeof fnFunction === 'function') {
mMethods[sMethod] = function() {
var tmp = fnFunction.apply(this, arguments);
return (tmp instanceof ControllerExtension) ? tmp.getInterface() : tmp;
}.bind(this);
}
//}
}.bind(this));
this.getInterface = function() {
return mMethods;
};
return mMethods;
} | javascript | function() {
var mMethods = {};
var oMetadata = this.getMetadata();
var aPublicMethods = oMetadata.getAllPublicMethods();
aPublicMethods.forEach(function(sMethod) {
var fnFunction = this[sMethod];
if (typeof fnFunction === 'function') {
mMethods[sMethod] = function() {
var tmp = fnFunction.apply(this, arguments);
return (tmp instanceof ControllerExtension) ? tmp.getInterface() : tmp;
}.bind(this);
}
//}
}.bind(this));
this.getInterface = function() {
return mMethods;
};
return mMethods;
} | [
"function",
"(",
")",
"{",
"var",
"mMethods",
"=",
"{",
"}",
";",
"var",
"oMetadata",
"=",
"this",
".",
"getMetadata",
"(",
")",
";",
"var",
"aPublicMethods",
"=",
"oMetadata",
".",
"getAllPublicMethods",
"(",
")",
";",
"aPublicMethods",
".",
"forEach",
... | Returns the public interface for this exetension
@returns {object} oInterface The public interface for this extension
@private | [
"Returns",
"the",
"public",
"interface",
"for",
"this",
"exetension"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/mvc/ControllerExtension.js#L73-L92 | train | Returns the public interface of the controller | [
30522,
3853,
1006,
1007,
1063,
13075,
3461,
11031,
20620,
1027,
1063,
1065,
1025,
13075,
18168,
12928,
2850,
2696,
1027,
2023,
1012,
2131,
11368,
8447,
2696,
1006,
1007,
1025,
13075,
9706,
12083,
10415,
11368,
6806,
5104,
1027,
18168,
12928,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | src/sap.ui.support/src/sap/ui/support/RuleAnalyzer.js | function (oExecutionScope, vPresetOrRules, oMetadata) {
// Temporary fix until the module is fully refactored.
var oLoadingPromise = new Promise(function (resolve) {
Bootstrap.initSupportRules(["true", "silent"], {
onReady: function () {
resolve();
}
});
});
return oLoadingPromise.then(function () {
if (RuleSetLoader._bRulesCreated) {
return Main.analyze(oExecutionScope, vPresetOrRules, oMetadata);
}
return RuleSetLoader._oMainPromise.then(function () {
return Main.analyze(oExecutionScope, vPresetOrRules, oMetadata);
});
});
} | javascript | function (oExecutionScope, vPresetOrRules, oMetadata) {
// Temporary fix until the module is fully refactored.
var oLoadingPromise = new Promise(function (resolve) {
Bootstrap.initSupportRules(["true", "silent"], {
onReady: function () {
resolve();
}
});
});
return oLoadingPromise.then(function () {
if (RuleSetLoader._bRulesCreated) {
return Main.analyze(oExecutionScope, vPresetOrRules, oMetadata);
}
return RuleSetLoader._oMainPromise.then(function () {
return Main.analyze(oExecutionScope, vPresetOrRules, oMetadata);
});
});
} | [
"function",
"(",
"oExecutionScope",
",",
"vPresetOrRules",
",",
"oMetadata",
")",
"{",
"// Temporary fix until the module is fully refactored.",
"var",
"oLoadingPromise",
"=",
"new",
"Promise",
"(",
"function",
"(",
"resolve",
")",
"{",
"Bootstrap",
".",
"initSupportRul... | Main method to perform analysis of a given running application.
Allows to choose a particular execution scope - desired part of the UI
to be checked and a flexible way to specify the list of rules to be used.
@memberof sap.ui.support.RuleAnalyzer
@public
@param {object} [oExecutionScope] The execution scope of the analysis (see {@link topic:e15067d976f24b11907f4c262bd749a0 Execution Scope}).
@param {string} [oExecutionScope.type=global] Possible values are <code>global</code>, <code>subtree</code> or <code>components</code>.
@param {string} [oExecutionScope.parentId] ID of the root element that forms a subtree. Use when the scope type is <code>subtree</code>.
@param {string[]} [oExecutionScope.components] List of IDs of the components to be analyzed. Use only when the scope type is <code>components</code>.
@param {object|string|object[]} [vPresetOrRules=All rules] This optional parameter allows for selection of subset of rules for the analysis.
You can pass:
<ul>
<li>A rule preset object containing the preset ID and the list of rules it contains.</li>
<li>A string that refers to the ID of a system preset.</li>
<li>An object array with a plain list of rules.</li>
</ul>
@param {object} [oMetadata] Metadata in custom format. Its only purpose is to be included in the analysis report.
@returns {Promise} Notifies the finished state by starting the Analyzer | [
"Main",
"method",
"to",
"perform",
"analysis",
"of",
"a",
"given",
"running",
"application",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.support/src/sap/ui/support/RuleAnalyzer.js#L60-L79 | train | Initializes the ruleset loader | [
30522,
3853,
1006,
1051,
10288,
8586,
13700,
26127,
1010,
21210,
6072,
18903,
12171,
16308,
1010,
18168,
12928,
2850,
2696,
1007,
1063,
1013,
1013,
5741,
8081,
2127,
1996,
11336,
2003,
3929,
25416,
18908,
19574,
1012,
13075,
19330,
10441,
466... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | mapExec | function mapExec(array, func) {
for (var i = 0; i < array.length; ++i) {
func.call(this, array[i], i);
}
} | javascript | function mapExec(array, func) {
for (var i = 0; i < array.length; ++i) {
func.call(this, array[i], i);
}
} | [
"function",
"mapExec",
"(",
"array",
",",
"func",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"array",
".",
"length",
";",
"++",
"i",
")",
"{",
"func",
".",
"call",
"(",
"this",
",",
"array",
"[",
"i",
"]",
",",
"i",
")",
";"... | Applies the given function to each element of the array, preserving this, and passing the index. | [
"Applies",
"the",
"given",
"function",
"to",
"each",
"element",
"of",
"the",
"array",
"preserving",
"this",
"and",
"passing",
"the",
"index",
"."
] | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/selenium-core/xpath/util.js#L180-L184 | train | Map an array of items to a function | [
30522,
3853,
4949,
10288,
8586,
1006,
9140,
1010,
4569,
2278,
1007,
1063,
2005,
1006,
13075,
1045,
1027,
1014,
1025,
1045,
1026,
9140,
1012,
3091,
1025,
1009,
1009,
1045,
1007,
1063,
4569,
2278,
1012,
2655,
1006,
2023,
1010,
9140,
1031,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/extensions/default/NoDistractions/main.js | _hidePanelsIfRequired | function _hidePanelsIfRequired() {
var panelIDs = WorkspaceManager.getAllPanelIDs();
_previouslyOpenPanelIDs = [];
panelIDs.forEach(function (panelID) {
var panel = WorkspaceManager.getPanelForID(panelID);
if (panel && panel.isVisible()) {
panel.hide();
_previouslyOpenPanelIDs.push(panelID);
}
});
} | javascript | function _hidePanelsIfRequired() {
var panelIDs = WorkspaceManager.getAllPanelIDs();
_previouslyOpenPanelIDs = [];
panelIDs.forEach(function (panelID) {
var panel = WorkspaceManager.getPanelForID(panelID);
if (panel && panel.isVisible()) {
panel.hide();
_previouslyOpenPanelIDs.push(panelID);
}
});
} | [
"function",
"_hidePanelsIfRequired",
"(",
")",
"{",
"var",
"panelIDs",
"=",
"WorkspaceManager",
".",
"getAllPanelIDs",
"(",
")",
";",
"_previouslyOpenPanelIDs",
"=",
"[",
"]",
";",
"panelIDs",
".",
"forEach",
"(",
"function",
"(",
"panelID",
")",
"{",
"var",
... | hide all open panels | [
"hide",
"all",
"open",
"panels"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/NoDistractions/main.js#L77-L87 | train | hide all panels if required | [
30522,
3853,
1035,
5342,
9739,
9050,
10128,
2890,
15549,
5596,
1006,
1007,
1063,
13075,
5997,
9821,
1027,
2573,
15327,
24805,
4590,
1012,
2131,
8095,
9739,
20806,
5104,
1006,
1007,
1025,
1035,
3130,
26915,
9739,
20806,
5104,
1027,
1031,
103... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
eslint/eslint | lib/rules/new-cap.js | checkArray | function checkArray(obj, key, fallback) {
/* istanbul ignore if */
if (Object.prototype.hasOwnProperty.call(obj, key) && !Array.isArray(obj[key])) {
throw new TypeError(`${key}, if provided, must be an Array`);
}
return obj[key] || fallback;
} | javascript | function checkArray(obj, key, fallback) {
/* istanbul ignore if */
if (Object.prototype.hasOwnProperty.call(obj, key) && !Array.isArray(obj[key])) {
throw new TypeError(`${key}, if provided, must be an Array`);
}
return obj[key] || fallback;
} | [
"function",
"checkArray",
"(",
"obj",
",",
"key",
",",
"fallback",
")",
"{",
"/* istanbul ignore if */",
"if",
"(",
"Object",
".",
"prototype",
".",
"hasOwnProperty",
".",
"call",
"(",
"obj",
",",
"key",
")",
"&&",
"!",
"Array",
".",
"isArray",
"(",
"obj... | Ensure that if the key is provided, it must be an array.
@param {Object} obj Object to check with `key`.
@param {string} key Object key to check on `obj`.
@param {*} fallback If obj[key] is not present, this will be returned.
@returns {string[]} Returns obj[key] if it's an Array, otherwise `fallback` | [
"Ensure",
"that",
"if",
"the",
"key",
"is",
"provided",
"it",
"must",
"be",
"an",
"array",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/new-cap.js#L36-L43 | train | Check if an object is an Array | [
30522,
3853,
4638,
2906,
9447,
1006,
27885,
3501,
1010,
3145,
1010,
2991,
5963,
1007,
1063,
1013,
1008,
9960,
8568,
2065,
1008,
1013,
2065,
1006,
4874,
1012,
8773,
1012,
2038,
12384,
21572,
4842,
3723,
1012,
2655,
1006,
27885,
3501,
1010,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
getsentry/sentry-javascript | packages/raven-js/Gruntfile.js | AddPluginBrowserifyTransformer | function AddPluginBrowserifyTransformer() {
var noop = function(chunk, _, cb) {
cb(null, chunk);
};
var append = function(cb) {
cb(null, "\nrequire('../src/singleton').addPlugin(module.exports);");
};
return function(file) {
return through(noop, /plugins/.test(file) ? append : undefined);
};
} | javascript | function AddPluginBrowserifyTransformer() {
var noop = function(chunk, _, cb) {
cb(null, chunk);
};
var append = function(cb) {
cb(null, "\nrequire('../src/singleton').addPlugin(module.exports);");
};
return function(file) {
return through(noop, /plugins/.test(file) ? append : undefined);
};
} | [
"function",
"AddPluginBrowserifyTransformer",
"(",
")",
"{",
"var",
"noop",
"=",
"function",
"(",
"chunk",
",",
"_",
",",
"cb",
")",
"{",
"cb",
"(",
"null",
",",
"chunk",
")",
";",
"}",
";",
"var",
"append",
"=",
"function",
"(",
"cb",
")",
"{",
"c... | custom browserify transformer to re-write plugins to self-register with Raven via addPlugin | [
"custom",
"browserify",
"transformer",
"to",
"re",
"-",
"write",
"plugins",
"to",
"self",
"-",
"register",
"with",
"Raven",
"via",
"addPlugin"
] | a872223343fecf7364473b78bede937f1eb57bd0 | https://github.com/getsentry/sentry-javascript/blob/a872223343fecf7364473b78bede937f1eb57bd0/packages/raven-js/Gruntfile.js#L26-L36 | train | Add plugin browserify transformer | [
30522,
3853,
5587,
24759,
15916,
2378,
12618,
9333,
11124,
12031,
6494,
3619,
14192,
2121,
1006,
1007,
1063,
13075,
2053,
7361,
1027,
3853,
1006,
20000,
1010,
1035,
1010,
17324,
1007,
1063,
17324,
1006,
19701,
1010,
20000,
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/thirdparty/RequestRecorder.js | function(mHarFileContent) {
var aEntries;
if (!mHarFileContent.log.entries || !mHarFileContent.log.entries.length) {
this.oLog.info(sModuleName + " - Empty entries array or the provided har file is empty.");
aEntries = [];
} else {
// Add start and end timestamps to determine the request and response order.
aEntries = mHarFileContent.log.entries;
for (var i = 0; i < aEntries.length; i++) {
aEntries[i]._timestampStarted = new Date(aEntries[i].startedDateTime).getTime();
aEntries[i]._timestampFinished = aEntries[i]._timestampStarted + aEntries[i].time;
aEntries[i]._initialOrder = i;
}
// Sort by response first, then by request to ensure the correct order.
this.prepareEntriesOrder(aEntries, "_timestampFinished");
this.prepareEntriesOrder(aEntries, "_timestampStarted");
// Build a map with the sorted entries in the correct custom groups and by URL groups.
mHarFileContent._groupedEntries = {};
for (var j = 0; j < aEntries.length; j++) {
this.addEntryToMapping(mHarFileContent, aEntries, j);
}
}
mHarFileContent.log.entries = aEntries;
return mHarFileContent;
} | javascript | function(mHarFileContent) {
var aEntries;
if (!mHarFileContent.log.entries || !mHarFileContent.log.entries.length) {
this.oLog.info(sModuleName + " - Empty entries array or the provided har file is empty.");
aEntries = [];
} else {
// Add start and end timestamps to determine the request and response order.
aEntries = mHarFileContent.log.entries;
for (var i = 0; i < aEntries.length; i++) {
aEntries[i]._timestampStarted = new Date(aEntries[i].startedDateTime).getTime();
aEntries[i]._timestampFinished = aEntries[i]._timestampStarted + aEntries[i].time;
aEntries[i]._initialOrder = i;
}
// Sort by response first, then by request to ensure the correct order.
this.prepareEntriesOrder(aEntries, "_timestampFinished");
this.prepareEntriesOrder(aEntries, "_timestampStarted");
// Build a map with the sorted entries in the correct custom groups and by URL groups.
mHarFileContent._groupedEntries = {};
for (var j = 0; j < aEntries.length; j++) {
this.addEntryToMapping(mHarFileContent, aEntries, j);
}
}
mHarFileContent.log.entries = aEntries;
return mHarFileContent;
} | [
"function",
"(",
"mHarFileContent",
")",
"{",
"var",
"aEntries",
";",
"if",
"(",
"!",
"mHarFileContent",
".",
"log",
".",
"entries",
"||",
"!",
"mHarFileContent",
".",
"log",
".",
"entries",
".",
"length",
")",
"{",
"this",
".",
"oLog",
".",
"info",
"(... | Sorts the entries of a har file by response and request order. After the entries are sorted, the function builds
a map of the entries with the assigned custom groups and url groups.
@param {object} mHarFileContent The loaded map from the har file.
@returns {object} Prepared Har content with sorted entries and all the mappings (URL, Groups). | [
"Sorts",
"the",
"entries",
"of",
"a",
"har",
"file",
"by",
"response",
"and",
"request",
"order",
".",
"After",
"the",
"entries",
"are",
"sorted",
"the",
"function",
"builds",
"a",
"map",
"of",
"the",
"entries",
"with",
"the",
"assigned",
"custom",
"groups... | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/RequestRecorder.js#L118-L145 | train | This function is called to build the map of entries from the provided har file. It will also add the request and response timestamps to the map of entries in the correct order. | [
30522,
3853,
1006,
1049,
8167,
8873,
2571,
8663,
6528,
2102,
1007,
1063,
13075,
29347,
3372,
5134,
1025,
2065,
1006,
999,
1049,
8167,
8873,
2571,
8663,
6528,
2102,
1012,
8833,
1012,
10445,
1064,
1064,
999,
1049,
8167,
8873,
2571,
8663,
65... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/base/ExpressionParser.js | tokenize | function tokenize(fnResolveBinding, sInput, iStart) {
var aParts = [], // the resulting parts (corresponds to aPrimitiveValueBindings)
aPrimitiveValueBindings = [], // the bindings with primitive values only
aTokens = [],
oTokenizer = new JSTokenizer();
/**
* Saves the binding as a part. Reuses an existing part if the binding is identical.
* @param {object} oBinding
* the binding to save
* @param {int} iStart
* the binding's start index in the input string
* @param {boolean} [bTargetTypeAny=false]
* whether the binding's "targetType" should default to "any" (recursively, for all parts)
* @returns {int}
* the index at which it has been saved/found in aParts
*/
function saveBindingAsPart(oBinding, iStart, bTargetTypeAny) {
var bHasNonPrimitiveValue = false,
sKey,
oPrimitiveValueBinding,
i;
/*
* Sets the target type of the given binding to the default "any", if applicable.
*
* @param {object} oBinding
* A binding
*/
function setTargetType(oBinding) {
if (bTargetTypeAny) {
if (oBinding.parts) {
oBinding.parts.forEach(setTargetType);
// Note: targetType not allowed here, see BindingParser.mergeParts
} else {
oBinding.targetType = oBinding.targetType || "any";
}
}
}
for (sKey in oBinding) {
switch (typeof oBinding[sKey]) {
case "boolean":
case "number":
case "string":
case "undefined":
break;
default:
// binding has at least one property of non-primitive value
bHasNonPrimitiveValue = true;
}
}
setTargetType(oBinding);
if (bHasNonPrimitiveValue) {
// the binding must be a complex binding; property "type" (and poss. others) are
// newly created objects and thus incomparable -> parse again to have the names
oPrimitiveValueBinding = JSTokenizer.parseJS(sInput, iStart).result;
setTargetType(oPrimitiveValueBinding);
} else {
// only primitive values; easily comparable
oPrimitiveValueBinding = oBinding;
}
for (i = 0; i < aParts.length; i += 1) {
// Note: order of top-level properties must not matter for equality!
if (deepEqual(aPrimitiveValueBindings[i], oPrimitiveValueBinding)) {
return i;
}
}
aPrimitiveValueBindings[i] = oPrimitiveValueBinding;
aParts[i] = oBinding;
return i;
}
/**
* Consumes the next token in the input string and pushes it to the array of tokens.
*
* @returns {boolean} whether a token is recognized
* @throws {Error|Object|SyntaxError}
* <code>fnResolveBinding</code> may throw <code>SyntaxError</code>;
* <code>oTokenizer.setIndex()</code> may throw <code>Error</code>;
* <code>oTokenizer</code> may also throw <code>{name: 'SyntaxError', ...}</code>
*/
function consumeToken() {
var ch, oBinding, iIndex, aMatches, oToken;
oTokenizer.white();
ch = oTokenizer.getCh();
iIndex = oTokenizer.getIndex();
if ((ch === "$" || ch === "%") && sInput[iIndex + 1] === "{") { //binding
oBinding = fnResolveBinding(sInput, iIndex + 1);
oToken = {
id: "BINDING",
value: saveBindingAsPart(oBinding.result, iIndex + 1, ch === "%")
};
oTokenizer.setIndex(oBinding.at); //go to first character after binding string
} else if (rIdentifierStart.test(ch)) {
aMatches = rIdentifier.exec(sInput.slice(iIndex));
switch (aMatches[0]) {
case "false":
case "null":
case "true":
oToken = {id: "CONSTANT", value: oTokenizer.word()};
break;
case "in":
case "typeof":
oToken = {id: aMatches[0]};
oTokenizer.setIndex(iIndex + aMatches[0].length);
break;
default:
oToken = {id: "IDENTIFIER", value: aMatches[0]};
oTokenizer.setIndex(iIndex + aMatches[0].length);
}
} else if (rDigit.test(ch)
|| ch === "." && rDigit.test(sInput[iIndex + 1])) {
oToken = {id: "CONSTANT", value: oTokenizer.number()};
} else if (ch === "'" || ch === '"') {
oToken = {id: "CONSTANT", value: oTokenizer.string()};
} else {
rTokens.lastIndex = iIndex;
aMatches = rTokens.exec(sInput);
if (!aMatches || aMatches.index !== iIndex) {
return false; // end of input or unrecognized character
}
oToken = {id: aMatches[0]};
oTokenizer.setIndex(iIndex + aMatches[0].length);
}
oToken.input = sInput;
oToken.start = iIndex;
oToken.end = oTokenizer.getIndex();
aTokens.push(oToken);
return true;
}
oTokenizer.init(sInput, iStart);
try {
/* eslint-disable no-empty */
while (consumeToken()) { /* deliberately empty */ }
/* eslint-enable no-empty */
} catch (e) {
// Note: new SyntaxError().name === "SyntaxError"
if (e.name === "SyntaxError") { // remember tokenizer error
aTokens.push({
id: "ERROR",
value: e
});
} else {
throw e;
}
}
return {
at: oTokenizer.getIndex(),
parts: aParts,
tokens: aTokens
};
} | javascript | function tokenize(fnResolveBinding, sInput, iStart) {
var aParts = [], // the resulting parts (corresponds to aPrimitiveValueBindings)
aPrimitiveValueBindings = [], // the bindings with primitive values only
aTokens = [],
oTokenizer = new JSTokenizer();
/**
* Saves the binding as a part. Reuses an existing part if the binding is identical.
* @param {object} oBinding
* the binding to save
* @param {int} iStart
* the binding's start index in the input string
* @param {boolean} [bTargetTypeAny=false]
* whether the binding's "targetType" should default to "any" (recursively, for all parts)
* @returns {int}
* the index at which it has been saved/found in aParts
*/
function saveBindingAsPart(oBinding, iStart, bTargetTypeAny) {
var bHasNonPrimitiveValue = false,
sKey,
oPrimitiveValueBinding,
i;
/*
* Sets the target type of the given binding to the default "any", if applicable.
*
* @param {object} oBinding
* A binding
*/
function setTargetType(oBinding) {
if (bTargetTypeAny) {
if (oBinding.parts) {
oBinding.parts.forEach(setTargetType);
// Note: targetType not allowed here, see BindingParser.mergeParts
} else {
oBinding.targetType = oBinding.targetType || "any";
}
}
}
for (sKey in oBinding) {
switch (typeof oBinding[sKey]) {
case "boolean":
case "number":
case "string":
case "undefined":
break;
default:
// binding has at least one property of non-primitive value
bHasNonPrimitiveValue = true;
}
}
setTargetType(oBinding);
if (bHasNonPrimitiveValue) {
// the binding must be a complex binding; property "type" (and poss. others) are
// newly created objects and thus incomparable -> parse again to have the names
oPrimitiveValueBinding = JSTokenizer.parseJS(sInput, iStart).result;
setTargetType(oPrimitiveValueBinding);
} else {
// only primitive values; easily comparable
oPrimitiveValueBinding = oBinding;
}
for (i = 0; i < aParts.length; i += 1) {
// Note: order of top-level properties must not matter for equality!
if (deepEqual(aPrimitiveValueBindings[i], oPrimitiveValueBinding)) {
return i;
}
}
aPrimitiveValueBindings[i] = oPrimitiveValueBinding;
aParts[i] = oBinding;
return i;
}
/**
* Consumes the next token in the input string and pushes it to the array of tokens.
*
* @returns {boolean} whether a token is recognized
* @throws {Error|Object|SyntaxError}
* <code>fnResolveBinding</code> may throw <code>SyntaxError</code>;
* <code>oTokenizer.setIndex()</code> may throw <code>Error</code>;
* <code>oTokenizer</code> may also throw <code>{name: 'SyntaxError', ...}</code>
*/
function consumeToken() {
var ch, oBinding, iIndex, aMatches, oToken;
oTokenizer.white();
ch = oTokenizer.getCh();
iIndex = oTokenizer.getIndex();
if ((ch === "$" || ch === "%") && sInput[iIndex + 1] === "{") { //binding
oBinding = fnResolveBinding(sInput, iIndex + 1);
oToken = {
id: "BINDING",
value: saveBindingAsPart(oBinding.result, iIndex + 1, ch === "%")
};
oTokenizer.setIndex(oBinding.at); //go to first character after binding string
} else if (rIdentifierStart.test(ch)) {
aMatches = rIdentifier.exec(sInput.slice(iIndex));
switch (aMatches[0]) {
case "false":
case "null":
case "true":
oToken = {id: "CONSTANT", value: oTokenizer.word()};
break;
case "in":
case "typeof":
oToken = {id: aMatches[0]};
oTokenizer.setIndex(iIndex + aMatches[0].length);
break;
default:
oToken = {id: "IDENTIFIER", value: aMatches[0]};
oTokenizer.setIndex(iIndex + aMatches[0].length);
}
} else if (rDigit.test(ch)
|| ch === "." && rDigit.test(sInput[iIndex + 1])) {
oToken = {id: "CONSTANT", value: oTokenizer.number()};
} else if (ch === "'" || ch === '"') {
oToken = {id: "CONSTANT", value: oTokenizer.string()};
} else {
rTokens.lastIndex = iIndex;
aMatches = rTokens.exec(sInput);
if (!aMatches || aMatches.index !== iIndex) {
return false; // end of input or unrecognized character
}
oToken = {id: aMatches[0]};
oTokenizer.setIndex(iIndex + aMatches[0].length);
}
oToken.input = sInput;
oToken.start = iIndex;
oToken.end = oTokenizer.getIndex();
aTokens.push(oToken);
return true;
}
oTokenizer.init(sInput, iStart);
try {
/* eslint-disable no-empty */
while (consumeToken()) { /* deliberately empty */ }
/* eslint-enable no-empty */
} catch (e) {
// Note: new SyntaxError().name === "SyntaxError"
if (e.name === "SyntaxError") { // remember tokenizer error
aTokens.push({
id: "ERROR",
value: e
});
} else {
throw e;
}
}
return {
at: oTokenizer.getIndex(),
parts: aParts,
tokens: aTokens
};
} | [
"function",
"tokenize",
"(",
"fnResolveBinding",
",",
"sInput",
",",
"iStart",
")",
"{",
"var",
"aParts",
"=",
"[",
"]",
",",
"// the resulting parts (corresponds to aPrimitiveValueBindings)",
"aPrimitiveValueBindings",
"=",
"[",
"]",
",",
"// the bindings with primitive ... | Computes the tokens according to the expression grammar in sInput starting at iStart and
uses fnResolveBinding to resolve bindings embedded in the expression.
@param {function} fnResolveBinding - the function to resolve embedded bindings
@param {string} sInput - the string to be parsed
@param {int} [iStart=0] - the index to start parsing
@returns {object} Tokenization result object with the following properties
at: the index after the last character consumed by the tokenizer in the input string
parts: array with parts corresponding to resolved embedded bindings
tokens: the array of tokens where each token is a tuple of ID, optional value, and
optional source text | [
"Computes",
"the",
"tokens",
"according",
"to",
"the",
"expression",
"grammar",
"in",
"sInput",
"starting",
"at",
"iStart",
"and",
"uses",
"fnResolveBinding",
"to",
"resolve",
"bindings",
"embedded",
"in",
"the",
"expression",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/base/ExpressionParser.js#L524-L681 | train | Takes a binding and parses it into an array of tokens. | [
30522,
3853,
19204,
4697,
1006,
1042,
16118,
2229,
4747,
3726,
8428,
4667,
1010,
8254,
18780,
1010,
21541,
8445,
1007,
1063,
13075,
4237,
2015,
1027,
1031,
1033,
1010,
1013,
1013,
1996,
4525,
3033,
1006,
14788,
2000,
19804,
27605,
6024,
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... |
ColorlibHQ/AdminLTE | bower_components/jquery-sparkline/src/vcanvas-base.js | function (width, height, canvas) {
// XXX This should probably be a configurable option
var match;
match = this._pxregex.exec(height);
if (match) {
this.pixelHeight = match[1];
} else {
this.pixelHeight = $(canvas).height();
}
match = this._pxregex.exec(width);
if (match) {
this.pixelWidth = match[1];
} else {
this.pixelWidth = $(canvas).width();
}
} | javascript | function (width, height, canvas) {
// XXX This should probably be a configurable option
var match;
match = this._pxregex.exec(height);
if (match) {
this.pixelHeight = match[1];
} else {
this.pixelHeight = $(canvas).height();
}
match = this._pxregex.exec(width);
if (match) {
this.pixelWidth = match[1];
} else {
this.pixelWidth = $(canvas).width();
}
} | [
"function",
"(",
"width",
",",
"height",
",",
"canvas",
")",
"{",
"// XXX This should probably be a configurable option",
"var",
"match",
";",
"match",
"=",
"this",
".",
"_pxregex",
".",
"exec",
"(",
"height",
")",
";",
"if",
"(",
"match",
")",
"{",
"this",
... | Calculate the pixel dimensions of the canvas | [
"Calculate",
"the",
"pixel",
"dimensions",
"of",
"the",
"canvas"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/bower_components/jquery-sparkline/src/vcanvas-base.js#L79-L94 | train | set pixel dimensions | [
30522,
3853,
1006,
9381,
1010,
4578,
1010,
10683,
1007,
1063,
1013,
1013,
22038,
2595,
2023,
2323,
2763,
2022,
1037,
9530,
8873,
27390,
3085,
5724,
13075,
2674,
1025,
2674,
1027,
2023,
1012,
1035,
1052,
2595,
2890,
3351,
2595,
1012,
4654,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | addChildren | function addChildren(node) {
var children = node._private.children;
for (var i = 0; i < children.length; i++) {
add(children[i]);
}
} | javascript | function addChildren(node) {
var children = node._private.children;
for (var i = 0; i < children.length; i++) {
add(children[i]);
}
} | [
"function",
"addChildren",
"(",
"node",
")",
"{",
"var",
"children",
"=",
"node",
".",
"_private",
".",
"children",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"children",
".",
"length",
";",
"i",
"++",
")",
"{",
"add",
"(",
"children",
... | add descendant nodes | [
"add",
"descendant",
"nodes"
] | ad2051b65e2243cfd953d8b24a8bf95bfa8559e5 | https://github.com/cytoscape/cytoscape.js/blob/ad2051b65e2243cfd953d8b24a8bf95bfa8559e5/dist/cytoscape.esm.js#L12361-L12367 | train | Add all children of node | [
30522,
3853,
5587,
19339,
7389,
1006,
13045,
1007,
1063,
13075,
2336,
1027,
13045,
1012,
1035,
2797,
1012,
2336,
1025,
2005,
1006,
13075,
1045,
1027,
1014,
1025,
1045,
1026,
2336,
1012,
3091,
1025,
1045,
1009,
1009,
1007,
1063,
5587,
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... |
catapult-project/catapult | telemetry/telemetry/internal/actions/gesture_common.js | getBoundingVisibleRect | function getBoundingVisibleRect(el) {
// Get the element bounding rect in the layout viewport.
const rect = getBoundingRect(el);
// Apply the visual viewport transform (i.e. pinch-zoom) to the bounding
// rect. The viewportX|Y values are in CSS pixels so they don't change
// with page scale. We first translate so that the viewport offset is
// at the origin and then we apply the scaling factor.
const scale = getPageScaleFactor();
const visualViewportX = chrome.gpuBenchmarking.visualViewportX();
const visualViewportY = chrome.gpuBenchmarking.visualViewportY();
rect.top = (rect.top - visualViewportY) * scale;
rect.left = (rect.left - visualViewportX) * scale;
rect.width *= scale;
rect.height *= scale;
// Get the window dimensions.
const windowHeight = getWindowHeight();
const windowWidth = getWindowWidth();
// Then clip the rect to the screen size.
rect.top = clamp(0, rect.top, windowHeight);
rect.left = clamp(0, rect.left, windowWidth);
rect.height = clamp(0, rect.height, windowHeight - rect.top);
rect.width = clamp(0, rect.width, windowWidth - rect.left);
return rect;
} | javascript | function getBoundingVisibleRect(el) {
// Get the element bounding rect in the layout viewport.
const rect = getBoundingRect(el);
// Apply the visual viewport transform (i.e. pinch-zoom) to the bounding
// rect. The viewportX|Y values are in CSS pixels so they don't change
// with page scale. We first translate so that the viewport offset is
// at the origin and then we apply the scaling factor.
const scale = getPageScaleFactor();
const visualViewportX = chrome.gpuBenchmarking.visualViewportX();
const visualViewportY = chrome.gpuBenchmarking.visualViewportY();
rect.top = (rect.top - visualViewportY) * scale;
rect.left = (rect.left - visualViewportX) * scale;
rect.width *= scale;
rect.height *= scale;
// Get the window dimensions.
const windowHeight = getWindowHeight();
const windowWidth = getWindowWidth();
// Then clip the rect to the screen size.
rect.top = clamp(0, rect.top, windowHeight);
rect.left = clamp(0, rect.left, windowWidth);
rect.height = clamp(0, rect.height, windowHeight - rect.top);
rect.width = clamp(0, rect.width, windowWidth - rect.left);
return rect;
} | [
"function",
"getBoundingVisibleRect",
"(",
"el",
")",
"{",
"// Get the element bounding rect in the layout viewport.",
"const",
"rect",
"=",
"getBoundingRect",
"(",
"el",
")",
";",
"// Apply the visual viewport transform (i.e. pinch-zoom) to the bounding",
"// rect. The viewportX|Y v... | Returns the bounding rect in the visual viewport's coordinates. | [
"Returns",
"the",
"bounding",
"rect",
"in",
"the",
"visual",
"viewport",
"s",
"coordinates",
"."
] | 992929ffccac68827869a497f01ee4d653ed4f25 | https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/telemetry/telemetry/internal/actions/gesture_common.js#L59-L86 | train | Get the bounding rect of an element in the viewport. | [
30522,
3853,
2131,
15494,
2075,
11365,
7028,
2890,
6593,
1006,
3449,
1007,
1063,
1013,
1013,
2131,
1996,
5783,
5391,
2075,
28667,
2102,
1999,
1996,
9621,
3193,
6442,
1012,
9530,
3367,
28667,
2102,
1027,
2131,
15494,
2075,
2890,
6593,
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... |
creativetimofficial/material-kit | assets/js/plugins/jquery.sharrre.js | Plugin | function Plugin(element, options) {
this.element = element;
this.options = $.extend(true, {}, defaults, options);
this.options.share = options.share; //simple solution to allow order of buttons
this._defaults = defaults;
this._name = pluginName;
this.init();
} | javascript | function Plugin(element, options) {
this.element = element;
this.options = $.extend(true, {}, defaults, options);
this.options.share = options.share; //simple solution to allow order of buttons
this._defaults = defaults;
this._name = pluginName;
this.init();
} | [
"function",
"Plugin",
"(",
"element",
",",
"options",
")",
"{",
"this",
".",
"element",
"=",
"element",
";",
"this",
".",
"options",
"=",
"$",
".",
"extend",
"(",
"true",
",",
"{",
"}",
",",
"defaults",
",",
"options",
")",
";",
"this",
".",
"optio... | /* Plugin constructor
================================================== | [
"/",
"*",
"Plugin",
"constructor",
"=================================================="
] | d7ad92b4f98f341bd9dfa0f3f3f1e163c567a7cc | https://github.com/creativetimofficial/material-kit/blob/d7ad92b4f98f341bd9dfa0f3f3f1e163c567a7cc/assets/js/plugins/jquery.sharrre.js#L364-L374 | train | Plugin constructor. | [
30522,
3853,
13354,
2378,
1006,
5783,
1010,
7047,
1007,
1063,
2023,
1012,
5783,
1027,
5783,
1025,
2023,
1012,
7047,
1027,
1002,
1012,
7949,
1006,
2995,
1010,
1063,
1065,
1010,
12398,
2015,
1010,
7047,
1007,
1025,
2023,
1012,
7047,
1012,
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... |
pixijs/pixi.js | packages/prepare/src/BasePrepare.js | findTextStyle | function findTextStyle(item, queue)
{
if (item instanceof TextStyle)
{
if (queue.indexOf(item) === -1)
{
queue.push(item);
}
return true;
}
return false;
} | javascript | function findTextStyle(item, queue)
{
if (item instanceof TextStyle)
{
if (queue.indexOf(item) === -1)
{
queue.push(item);
}
return true;
}
return false;
} | [
"function",
"findTextStyle",
"(",
"item",
",",
"queue",
")",
"{",
"if",
"(",
"item",
"instanceof",
"TextStyle",
")",
"{",
"if",
"(",
"queue",
".",
"indexOf",
"(",
"item",
")",
"===",
"-",
"1",
")",
"{",
"queue",
".",
"push",
"(",
"item",
")",
";",
... | Built-in hook to find TextStyle objects.
@private
@param {PIXI.TextStyle} item - Display object to check
@param {Array<*>} queue - Collection of items to upload
@return {boolean} if a PIXI.TextStyle object was found. | [
"Built",
"-",
"in",
"hook",
"to",
"find",
"TextStyle",
"objects",
"."
] | 99ae03b7565ae7ca5a6de633b0a277f7128fa4d0 | https://github.com/pixijs/pixi.js/blob/99ae03b7565ae7ca5a6de633b0a277f7128fa4d0/packages/prepare/src/BasePrepare.js#L484-L497 | train | Find TextStyle in the queue | [
30522,
3853,
2424,
18209,
21756,
2571,
1006,
8875,
1010,
24240,
1007,
1063,
2065,
1006,
8875,
6013,
11253,
6981,
27983,
1007,
1063,
2065,
1006,
24240,
1012,
5950,
11253,
1006,
8875,
1007,
1027,
1027,
1027,
1011,
1015,
1007,
1063,
24240,
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... |
eslint/eslint | lib/rules/no-unused-vars.js | isAfterLastUsedArg | function isAfterLastUsedArg(variable) {
const def = variable.defs[0];
const params = context.getDeclaredVariables(def.node);
const posteriorParams = params.slice(params.indexOf(variable) + 1);
// If any used parameters occur after this parameter, do not report.
return !posteriorParams.some(v => v.references.length > 0 || v.eslintUsed);
} | javascript | function isAfterLastUsedArg(variable) {
const def = variable.defs[0];
const params = context.getDeclaredVariables(def.node);
const posteriorParams = params.slice(params.indexOf(variable) + 1);
// If any used parameters occur after this parameter, do not report.
return !posteriorParams.some(v => v.references.length > 0 || v.eslintUsed);
} | [
"function",
"isAfterLastUsedArg",
"(",
"variable",
")",
"{",
"const",
"def",
"=",
"variable",
".",
"defs",
"[",
"0",
"]",
";",
"const",
"params",
"=",
"context",
".",
"getDeclaredVariables",
"(",
"def",
".",
"node",
")",
";",
"const",
"posteriorParams",
"=... | Checks whether the given variable is after the last used parameter.
@param {eslint-scope.Variable} variable - The variable to check.
@returns {boolean} `true` if the variable is defined after the last
used parameter. | [
"Checks",
"whether",
"the",
"given",
"variable",
"is",
"after",
"the",
"last",
"used",
"parameter",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/no-unused-vars.js#L489-L496 | train | Checks if the parameter is after the last used argument | [
30522,
3853,
18061,
6199,
2121,
8523,
5809,
11960,
10623,
1006,
8023,
1007,
1063,
9530,
3367,
13366,
1027,
8023,
1012,
13366,
2015,
1031,
1014,
1033,
1025,
9530,
3367,
11498,
5244,
1027,
6123,
1012,
2131,
3207,
20464,
12069,
2094,
10755,
19... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
vuejs/vue-devtools | src/util.js | basename | function basename (filename, ext) {
return path.basename(
filename.replace(/^[a-zA-Z]:/, '').replace(/\\/g, '/'),
ext
)
} | javascript | function basename (filename, ext) {
return path.basename(
filename.replace(/^[a-zA-Z]:/, '').replace(/\\/g, '/'),
ext
)
} | [
"function",
"basename",
"(",
"filename",
",",
"ext",
")",
"{",
"return",
"path",
".",
"basename",
"(",
"filename",
".",
"replace",
"(",
"/",
"^[a-zA-Z]:",
"/",
",",
"''",
")",
".",
"replace",
"(",
"/",
"\\\\",
"/",
"g",
",",
"'/'",
")",
",",
"ext",... | Use a custom basename functions instead of the shimed version because it doesn't work on Windows | [
"Use",
"a",
"custom",
"basename",
"functions",
"instead",
"of",
"the",
"shimed",
"version",
"because",
"it",
"doesn",
"t",
"work",
"on",
"Windows"
] | 4de4b86388453cd07f0c1bf967d43a4dd4b011c9 | https://github.com/vuejs/vue-devtools/blob/4de4b86388453cd07f0c1bf967d43a4dd4b011c9/src/util.js#L231-L236 | train | Returns basename of filename with extension | [
30522,
3853,
2918,
18442,
1006,
5371,
18442,
1010,
4654,
2102,
1007,
1063,
2709,
4130,
1012,
2918,
18442,
1006,
5371,
18442,
1012,
5672,
1006,
1013,
1034,
1031,
1037,
1011,
23564,
1011,
1062,
1033,
1024,
1013,
1010,
1005,
1005,
1007,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/LiveDevelopment/Inspector/Inspector.js | getDebuggableWindows | function getDebuggableWindows(host, port) {
if (!host) {
host = "127.0.0.1";
}
if (!port) {
port = 9222;
}
var def = new $.Deferred();
var request = new XMLHttpRequest();
request.open("GET", "http://" + host + ":" + port + "/json");
request.onload = function onLoad() {
var sockets = JSON.parse(request.response);
def.resolve(sockets);
};
request.onerror = function onError() {
def.reject(request.response);
};
request.send(null);
return def.promise();
} | javascript | function getDebuggableWindows(host, port) {
if (!host) {
host = "127.0.0.1";
}
if (!port) {
port = 9222;
}
var def = new $.Deferred();
var request = new XMLHttpRequest();
request.open("GET", "http://" + host + ":" + port + "/json");
request.onload = function onLoad() {
var sockets = JSON.parse(request.response);
def.resolve(sockets);
};
request.onerror = function onError() {
def.reject(request.response);
};
request.send(null);
return def.promise();
} | [
"function",
"getDebuggableWindows",
"(",
"host",
",",
"port",
")",
"{",
"if",
"(",
"!",
"host",
")",
"{",
"host",
"=",
"\"127.0.0.1\"",
";",
"}",
"if",
"(",
"!",
"port",
")",
"{",
"port",
"=",
"9222",
";",
"}",
"var",
"def",
"=",
"new",
"$",
".",... | Public Functions **************************************************** Get a list of the available windows/tabs/extensions that are remote-debuggable
@param {string} host IP or name
@param {integer} debugger port | [
"Public",
"Functions",
"****************************************************",
"Get",
"a",
"list",
"of",
"the",
"available",
"windows",
"/",
"tabs",
"/",
"extensions",
"that",
"are",
"remote",
"-",
"debuggable"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/LiveDevelopment/Inspector/Inspector.js#L244-L265 | train | Get debuggable windows | [
30522,
3853,
2131,
3207,
8569,
23033,
3468,
11101,
15568,
1006,
3677,
1010,
3417,
1007,
1063,
2065,
1006,
999,
3677,
1007,
1063,
3677,
1027,
1000,
13029,
1012,
1014,
1012,
1014,
1012,
1015,
1000,
1025,
1065,
2065,
1006,
999,
3417,
1007,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
getinsomnia/insomnia | packages/insomnia-importers/src/importers/swagger2.js | convertParameters | function convertParameters(parameters) {
return parameters.map(parameter => {
const { required, name } = parameter;
return {
name,
disabled: required !== true,
value: `${generateParameterExample(parameter)}`,
};
});
} | javascript | function convertParameters(parameters) {
return parameters.map(parameter => {
const { required, name } = parameter;
return {
name,
disabled: required !== true,
value: `${generateParameterExample(parameter)}`,
};
});
} | [
"function",
"convertParameters",
"(",
"parameters",
")",
"{",
"return",
"parameters",
".",
"map",
"(",
"parameter",
"=>",
"{",
"const",
"{",
"required",
",",
"name",
"}",
"=",
"parameter",
";",
"return",
"{",
"name",
",",
"disabled",
":",
"required",
"!=="... | Converts swagger schema of parametes into insomnia one.
@param {Object[]} parameters - array of swagger schemas of parameters
@returns {Object[]} array of insomnia parameters definitions | [
"Converts",
"swagger",
"schema",
"of",
"parametes",
"into",
"insomnia",
"one",
"."
] | e24ce7f7b41246e700c4b9bdb6b34b6652ad589b | https://github.com/getinsomnia/insomnia/blob/e24ce7f7b41246e700c4b9bdb6b34b6652ad589b/packages/insomnia-importers/src/importers/swagger2.js#L261-L270 | train | Convert an array of parameters to an object | [
30522,
3853,
10463,
28689,
22828,
2015,
1006,
11709,
1007,
1063,
2709,
11709,
1012,
4949,
1006,
16381,
1027,
1028,
1063,
9530,
3367,
1063,
3223,
1010,
2171,
1065,
1027,
16381,
1025,
2709,
1063,
2171,
1010,
9776,
1024,
3223,
999,
1027,
1027,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.table/src/sap/ui/table/TableUtils.js | function(oTable) {
var oNoData = oTable.getNoData();
if (oNoData instanceof Control) {
return null;
} else if (typeof oNoData === "string" || oTable.getNoData() instanceof String) {
return oNoData;
} else {
return TableUtils.getResourceText("TBL_NO_DATA");
}
} | javascript | function(oTable) {
var oNoData = oTable.getNoData();
if (oNoData instanceof Control) {
return null;
} else if (typeof oNoData === "string" || oTable.getNoData() instanceof String) {
return oNoData;
} else {
return TableUtils.getResourceText("TBL_NO_DATA");
}
} | [
"function",
"(",
"oTable",
")",
"{",
"var",
"oNoData",
"=",
"oTable",
".",
"getNoData",
"(",
")",
";",
"if",
"(",
"oNoData",
"instanceof",
"Control",
")",
"{",
"return",
"null",
";",
"}",
"else",
"if",
"(",
"typeof",
"oNoData",
"===",
"\"string\"",
"||... | Returns the text to be displayed as no data message.
If a custom noData control is set null is returned.
@param {sap.ui.table.Table} oTable Instance of the table.
@returns {String | string | null} The no data text. | [
"Returns",
"the",
"text",
"to",
"be",
"displayed",
"as",
"no",
"data",
"message",
".",
"If",
"a",
"custom",
"noData",
"control",
"is",
"set",
"null",
"is",
"returned",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableUtils.js#L531-L540 | train | Returns the no data text for the table. | [
30522,
3853,
1006,
27178,
3085,
1007,
1063,
13075,
21058,
2850,
2696,
1027,
27178,
3085,
1012,
2131,
3630,
2850,
2696,
1006,
1007,
1025,
2065,
1006,
21058,
2850,
2696,
6013,
11253,
2491,
1007,
1063,
2709,
19701,
1025,
1065,
2842,
2065,
1006... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
adobe/brackets | src/JSUtils/ScopeManager.js | handleJumptoDef | function handleJumptoDef(response) {
var file = response.file,
offset = response.offset;
var $deferredJump = getPendingRequest(file, offset, MessageIds.TERN_JUMPTODEF_MSG);
if ($deferredJump) {
response.fullPath = getResolvedPath(response.resultFile);
$deferredJump.resolveWith(null, [response]);
}
} | javascript | function handleJumptoDef(response) {
var file = response.file,
offset = response.offset;
var $deferredJump = getPendingRequest(file, offset, MessageIds.TERN_JUMPTODEF_MSG);
if ($deferredJump) {
response.fullPath = getResolvedPath(response.resultFile);
$deferredJump.resolveWith(null, [response]);
}
} | [
"function",
"handleJumptoDef",
"(",
"response",
")",
"{",
"var",
"file",
"=",
"response",
".",
"file",
",",
"offset",
"=",
"response",
".",
"offset",
";",
"var",
"$deferredJump",
"=",
"getPendingRequest",
"(",
"file",
",",
"offset",
",",
"MessageIds",
".",
... | Handle the response from the tern node domain when
it responds with the definition
@param response - the response from the node domain | [
"Handle",
"the",
"response",
"from",
"the",
"tern",
"node",
"domain",
"when",
"it",
"responds",
"with",
"the",
"definition"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/JSUtils/ScopeManager.js#L432-L443 | train | Handle a Jumpto Definition request | [
30522,
3853,
5047,
9103,
27718,
10244,
2546,
1006,
3433,
1007,
1063,
13075,
5371,
1027,
3433,
1012,
5371,
1010,
16396,
1027,
3433,
1012,
16396,
1025,
13075,
1002,
13366,
28849,
2094,
9103,
8737,
1027,
2131,
11837,
4667,
2890,
15500,
1006,
5... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
goldfire/howler.js | dist/howler.js | function() {
sound._paused = false;
sound._seek = seek;
sound._start = start;
sound._stop = stop;
sound._loop = loop;
} | javascript | function() {
sound._paused = false;
sound._seek = seek;
sound._start = start;
sound._stop = stop;
sound._loop = loop;
} | [
"function",
"(",
")",
"{",
"sound",
".",
"_paused",
"=",
"false",
";",
"sound",
".",
"_seek",
"=",
"seek",
";",
"sound",
".",
"_start",
"=",
"start",
";",
"sound",
".",
"_stop",
"=",
"stop",
";",
"sound",
".",
"_loop",
"=",
"loop",
";",
"}"
] | Update the parameters of the sound. | [
"Update",
"the",
"parameters",
"of",
"the",
"sound",
"."
] | 030db918dd8ce640afd57e172418472497e8f113 | https://github.com/goldfire/howler.js/blob/030db918dd8ce640afd57e172418472497e8f113/dist/howler.js#L807-L813 | train | Stop the sound | [
30522,
3853,
1006,
1007,
1063,
2614,
1012,
1035,
5864,
1027,
6270,
1025,
2614,
1012,
1035,
6148,
1027,
6148,
1025,
2614,
1012,
1035,
2707,
1027,
2707,
1025,
2614,
1012,
1035,
2644,
1027,
2644,
1025,
2614,
1012,
1035,
7077,
1027,
7077,
102... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | src/sap.ui.core/src/sap/ui/core/routing/Targets.js | function (sName, oTargetOptions) {
var oTarget,
oOptions;
oOptions = jQuery.extend(true, { _name: sName }, this._oConfig, oTargetOptions);
oTarget = this._constructTarget(oOptions);
oTarget.attachDisplay(function (oEvent) {
var oParameters = oEvent.getParameters();
this.fireDisplay({
name : sName,
view : oParameters.view,
control : oParameters.control,
config : oParameters.config,
data: oParameters.data
});
}, this);
this._mTargets[sName] = oTarget;
return oTarget;
} | javascript | function (sName, oTargetOptions) {
var oTarget,
oOptions;
oOptions = jQuery.extend(true, { _name: sName }, this._oConfig, oTargetOptions);
oTarget = this._constructTarget(oOptions);
oTarget.attachDisplay(function (oEvent) {
var oParameters = oEvent.getParameters();
this.fireDisplay({
name : sName,
view : oParameters.view,
control : oParameters.control,
config : oParameters.config,
data: oParameters.data
});
}, this);
this._mTargets[sName] = oTarget;
return oTarget;
} | [
"function",
"(",
"sName",
",",
"oTargetOptions",
")",
"{",
"var",
"oTarget",
",",
"oOptions",
";",
"oOptions",
"=",
"jQuery",
".",
"extend",
"(",
"true",
",",
"{",
"_name",
":",
"sName",
"}",
",",
"this",
".",
"_oConfig",
",",
"oTargetOptions",
")",
";... | created all targets
@param {string} sName
@param {object} oTargetOptions
@return {sap.ui.core.routing.Target} The created target object
@private | [
"created",
"all",
"targets"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/routing/Targets.js#L564-L583 | train | Creates a target object and adds it to the map | [
30522,
3853,
1006,
1055,
18442,
1010,
27178,
2906,
18150,
7361,
9285,
1007,
1063,
13075,
27178,
2906,
18150,
1010,
1051,
7361,
9285,
1025,
1051,
7361,
9285,
1027,
1046,
4226,
2854,
1012,
7949,
1006,
2995,
1010,
1063,
1035,
2171,
1024,
1055,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/source-code-fixer.js | attemptFix | function attemptFix(problem) {
const fix = problem.fix;
const start = fix.range[0];
const end = fix.range[1];
// Remain it as a problem if it's overlapped or it's a negative range
if (lastPos >= start || start > end) {
remainingMessages.push(problem);
return false;
}
// Remove BOM.
if ((start < 0 && end >= 0) || (start === 0 && fix.text.startsWith(BOM))) {
output = "";
}
// Make output to this fix.
output += text.slice(Math.max(0, lastPos), Math.max(0, start));
output += fix.text;
lastPos = end;
return true;
} | javascript | function attemptFix(problem) {
const fix = problem.fix;
const start = fix.range[0];
const end = fix.range[1];
// Remain it as a problem if it's overlapped or it's a negative range
if (lastPos >= start || start > end) {
remainingMessages.push(problem);
return false;
}
// Remove BOM.
if ((start < 0 && end >= 0) || (start === 0 && fix.text.startsWith(BOM))) {
output = "";
}
// Make output to this fix.
output += text.slice(Math.max(0, lastPos), Math.max(0, start));
output += fix.text;
lastPos = end;
return true;
} | [
"function",
"attemptFix",
"(",
"problem",
")",
"{",
"const",
"fix",
"=",
"problem",
".",
"fix",
";",
"const",
"start",
"=",
"fix",
".",
"range",
"[",
"0",
"]",
";",
"const",
"end",
"=",
"fix",
".",
"range",
"[",
"1",
"]",
";",
"// Remain it as a prob... | Try to use the 'fix' from a problem.
@param {Message} problem The message object to apply fixes from
@returns {boolean} Whether fix was successfully applied | [
"Try",
"to",
"use",
"the",
"fix",
"from",
"a",
"problem",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/util/source-code-fixer.js#L86-L107 | train | Attempt to fix a problem. | [
30522,
3853,
3535,
8873,
2595,
1006,
3291,
1007,
1063,
9530,
3367,
8081,
1027,
3291,
1012,
8081,
1025,
9530,
3367,
2707,
1027,
8081,
1012,
2846,
1031,
1014,
1033,
1025,
9530,
3367,
2203,
1027,
8081,
1012,
2846,
1031,
1015,
1033,
1025,
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... |
GitbookIO/gitbook | lib/output/website/onAsset.js | onAsset | function onAsset(output, asset) {
var book = output.getBook();
var options = output.getOptions();
var bookFS = book.getContentFS();
var outputFolder = options.get('root');
var outputPath = path.resolve(outputFolder, asset);
return fs.ensureFile(outputPath)
.then(function() {
return bookFS.readAsStream(asset)
.then(function(stream) {
return fs.writeStream(outputPath, stream);
});
})
.thenResolve(output);
} | javascript | function onAsset(output, asset) {
var book = output.getBook();
var options = output.getOptions();
var bookFS = book.getContentFS();
var outputFolder = options.get('root');
var outputPath = path.resolve(outputFolder, asset);
return fs.ensureFile(outputPath)
.then(function() {
return bookFS.readAsStream(asset)
.then(function(stream) {
return fs.writeStream(outputPath, stream);
});
})
.thenResolve(output);
} | [
"function",
"onAsset",
"(",
"output",
",",
"asset",
")",
"{",
"var",
"book",
"=",
"output",
".",
"getBook",
"(",
")",
";",
"var",
"options",
"=",
"output",
".",
"getOptions",
"(",
")",
";",
"var",
"bookFS",
"=",
"book",
".",
"getContentFS",
"(",
")",... | Copy an asset to the output folder
@param {Output} output
@param {Page} page | [
"Copy",
"an",
"asset",
"to",
"the",
"output",
"folder"
] | 6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4 | https://github.com/GitbookIO/gitbook/blob/6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4/lib/output/website/onAsset.js#L10-L26 | train | Create an asset in the current book | [
30522,
3853,
2006,
27241,
2102,
1006,
6434,
1010,
11412,
1007,
1063,
13075,
2338,
1027,
6434,
1012,
2131,
8654,
1006,
1007,
1025,
13075,
7047,
1027,
6434,
1012,
2131,
7361,
9285,
1006,
1007,
1025,
13075,
2338,
10343,
1027,
2338,
1012,
2131,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
eslint/eslint | lib/rules/newline-after-var.js | getLastToken | function getLastToken(node) {
const lastToken = sourceCode.getLastToken(node);
if (lastToken.type === "Punctuator" && lastToken.value === ";") {
const prevToken = sourceCode.getTokenBefore(lastToken);
if (prevToken.loc.end.line !== lastToken.loc.start.line) {
return prevToken;
}
}
return lastToken;
} | javascript | function getLastToken(node) {
const lastToken = sourceCode.getLastToken(node);
if (lastToken.type === "Punctuator" && lastToken.value === ";") {
const prevToken = sourceCode.getTokenBefore(lastToken);
if (prevToken.loc.end.line !== lastToken.loc.start.line) {
return prevToken;
}
}
return lastToken;
} | [
"function",
"getLastToken",
"(",
"node",
")",
"{",
"const",
"lastToken",
"=",
"sourceCode",
".",
"getLastToken",
"(",
"node",
")",
";",
"if",
"(",
"lastToken",
".",
"type",
"===",
"\"Punctuator\"",
"&&",
"lastToken",
".",
"value",
"===",
"\";\"",
")",
"{",... | -------------------------------------------------------------------------- Helpers --------------------------------------------------------------------------
Gets a token from the given node to compare line to the next statement.
In general, the token is the last token of the node. However, the token is the second last token if the following conditions satisfy.
- The last token is semicolon.
- The semicolon is on a different line from the previous token of the semicolon.
This behavior would address semicolon-less style code. e.g.:
var foo = 1
;(a || b).doSomething()
@param {ASTNode} node - The node to get.
@returns {Token} The token to compare line to the next statement. | [
"--------------------------------------------------------------------------",
"Helpers",
"--------------------------------------------------------------------------",
"Gets",
"a",
"token",
"from",
"the",
"given",
"node",
"to",
"compare",
"line",
"to",
"the",
"next",
"statement",
".... | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/newline-after-var.js#L79-L91 | train | Get last token of node | [
30522,
3853,
2131,
8523,
9284,
7520,
1006,
13045,
1007,
1063,
9530,
3367,
2197,
18715,
2368,
1027,
3120,
16044,
1012,
2131,
8523,
9284,
7520,
1006,
13045,
1007,
1025,
2065,
1006,
2197,
18715,
2368,
1012,
2828,
1027,
1027,
1027,
1000,
26136,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/QuickView/main.js | hidePreview | function hidePreview() {
if (!popoverState) {
return;
}
if (popoverState.visible) {
popoverState.marker.clear();
$previewContent.empty();
$previewContainer.hide();
$previewContainer.removeClass("active");
} else {
window.clearTimeout(popoverState.hoverTimer);
}
popoverState = null;
} | javascript | function hidePreview() {
if (!popoverState) {
return;
}
if (popoverState.visible) {
popoverState.marker.clear();
$previewContent.empty();
$previewContainer.hide();
$previewContainer.removeClass("active");
} else {
window.clearTimeout(popoverState.hoverTimer);
}
popoverState = null;
} | [
"function",
"hidePreview",
"(",
")",
"{",
"if",
"(",
"!",
"popoverState",
")",
"{",
"return",
";",
"}",
"if",
"(",
"popoverState",
".",
"visible",
")",
"{",
"popoverState",
".",
"marker",
".",
"clear",
"(",
")",
";",
"$previewContent",
".",
"empty",
"(... | Popover widget management ----------------------------------------------
Cancels whatever popoverState was currently pending and sets it back to null. If the popover was visible,
hides it; if the popover was invisible and still pending, cancels hoverTimer so it will never be shown. | [
"Popover",
"widget",
"management",
"----------------------------------------------",
"Cancels",
"whatever",
"popoverState",
"was",
"currently",
"pending",
"and",
"sets",
"it",
"back",
"to",
"null",
".",
"If",
"the",
"popover",
"was",
"visible",
"hides",
"it",
";",
"... | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/QuickView/main.js#L110-L125 | train | hide preview | [
30522,
3853,
5342,
28139,
8584,
1006,
1007,
1063,
2065,
1006,
999,
3769,
24302,
12259,
1007,
1063,
2709,
1025,
1065,
2065,
1006,
3769,
24302,
12259,
1012,
5710,
1007,
1063,
3769,
24302,
12259,
1012,
12115,
1012,
3154,
1006,
1007,
1025,
1002... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
dequelabs/axe-core | lib/core/utils/scroll-state.js | getElmScrollRecursive | function getElmScrollRecursive(root) {
return Array.from(root.children).reduce((scrolls, elm) => {
const scroll = getScroll(elm);
if (scroll) {
scrolls.push(scroll);
}
return scrolls.concat(getElmScrollRecursive(elm));
}, []);
} | javascript | function getElmScrollRecursive(root) {
return Array.from(root.children).reduce((scrolls, elm) => {
const scroll = getScroll(elm);
if (scroll) {
scrolls.push(scroll);
}
return scrolls.concat(getElmScrollRecursive(elm));
}, []);
} | [
"function",
"getElmScrollRecursive",
"(",
"root",
")",
"{",
"return",
"Array",
".",
"from",
"(",
"root",
".",
"children",
")",
".",
"reduce",
"(",
"(",
"scrolls",
",",
"elm",
")",
"=>",
"{",
"const",
"scroll",
"=",
"getScroll",
"(",
"elm",
")",
";",
... | Create an array scroll positions from descending elements | [
"Create",
"an",
"array",
"scroll",
"positions",
"from",
"descending",
"elements"
] | 727323c07980e2291575f545444d389fb942906f | https://github.com/dequelabs/axe-core/blob/727323c07980e2291575f545444d389fb942906f/lib/core/utils/scroll-state.js#L33-L41 | train | Recursively get all scroll elements recursively | [
30522,
3853,
2131,
2884,
5244,
26775,
14511,
2890,
10841,
2869,
3512,
1006,
7117,
1007,
1063,
2709,
9140,
1012,
2013,
1006,
7117,
1012,
2336,
1007,
1012,
5547,
1006,
1006,
23074,
1010,
17709,
1007,
1027,
1028,
1063,
9530,
3367,
17186,
1027,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/document/DocumentManager.js | closeFullEditor | function closeFullEditor(file) {
DeprecationWarning.deprecationWarning("Use CommandManager.execute(Commands.FILE_CLOSE, {File: file} instead of DocumentManager.closeFullEditor()", true);
CommandManager.execute(Commands.FILE_CLOSE, {File: file});
} | javascript | function closeFullEditor(file) {
DeprecationWarning.deprecationWarning("Use CommandManager.execute(Commands.FILE_CLOSE, {File: file} instead of DocumentManager.closeFullEditor()", true);
CommandManager.execute(Commands.FILE_CLOSE, {File: file});
} | [
"function",
"closeFullEditor",
"(",
"file",
")",
"{",
"DeprecationWarning",
".",
"deprecationWarning",
"(",
"\"Use CommandManager.execute(Commands.FILE_CLOSE, {File: file} instead of DocumentManager.closeFullEditor()\"",
",",
"true",
")",
";",
"CommandManager",
".",
"execute",
"(... | closes the specified file file
@deprecated use CommandManager.execute(Commands.FILE_CLOSE, {File: file}) instead
@param {!File} file - the file to close | [
"closes",
"the",
"specified",
"file",
"file"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/document/DocumentManager.js#L247-L250 | train | Closes the full editor | [
30522,
3853,
2485,
3993,
3709,
15660,
1006,
5371,
1007,
1063,
2139,
28139,
10719,
9028,
5582,
1012,
2139,
28139,
10719,
9028,
5582,
1006,
1000,
2224,
3094,
24805,
4590,
1012,
15389,
1006,
10954,
1012,
5371,
1035,
2485,
1010,
1063,
5371,
102... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SeleniumHQ/selenium | javascript/selenium-core/scripts/htmlutils.js | function( e ) {
var elem = e.target;
if ( elem.nodeName.toLowerCase() === "input" && elem.type === "radio" ) {
jQuery.data( elem, "_change_data", getVal(elem) );
}
} | javascript | function( e ) {
var elem = e.target;
if ( elem.nodeName.toLowerCase() === "input" && elem.type === "radio" ) {
jQuery.data( elem, "_change_data", getVal(elem) );
}
} | [
"function",
"(",
"e",
")",
"{",
"var",
"elem",
"=",
"e",
".",
"target",
";",
"if",
"(",
"elem",
".",
"nodeName",
".",
"toLowerCase",
"(",
")",
"===",
"\"input\"",
"&&",
"elem",
".",
"type",
"===",
"\"radio\"",
")",
"{",
"jQuery",
".",
"data",
"(",
... | Beforeactivate happens also before the previous element is blurred with this event you can't trigger a change event, but you can store information/focus[in] is not needed anymore | [
"Beforeactivate",
"happens",
"also",
"before",
"the",
"previous",
"element",
"is",
"blurred",
"with",
"this",
"event",
"you",
"can",
"t",
"trigger",
"a",
"change",
"event",
"but",
"you",
"can",
"store",
"information",
"/",
"focus",
"[",
"in",
"]",
"is",
"n... | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/selenium-core/scripts/htmlutils.js#L4858-L4864 | train | This function is called when the user clicks on a radio button | [
30522,
3853,
1006,
1041,
1007,
1063,
13075,
3449,
6633,
1027,
1041,
1012,
4539,
1025,
2065,
1006,
3449,
6633,
1012,
13045,
18442,
1012,
2000,
27663,
18992,
3366,
1006,
1007,
1027,
1027,
1027,
1000,
7953,
1000,
1004,
1004,
3449,
6633,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
eslint/eslint | lib/rules/key-spacing.js | verifyAlignment | function verifyAlignment(node) {
createGroups(node).forEach(group => {
verifyGroupAlignment(group.filter(isKeyValueProperty));
});
} | javascript | function verifyAlignment(node) {
createGroups(node).forEach(group => {
verifyGroupAlignment(group.filter(isKeyValueProperty));
});
} | [
"function",
"verifyAlignment",
"(",
"node",
")",
"{",
"createGroups",
"(",
"node",
")",
".",
"forEach",
"(",
"group",
"=>",
"{",
"verifyGroupAlignment",
"(",
"group",
".",
"filter",
"(",
"isKeyValueProperty",
")",
")",
";",
"}",
")",
";",
"}"
] | Verifies vertical alignment, taking into account groups of properties.
@param {ASTNode} node ObjectExpression node being evaluated.
@returns {void} | [
"Verifies",
"vertical",
"alignment",
"taking",
"into",
"account",
"groups",
"of",
"properties",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/key-spacing.js#L591-L595 | train | Verify alignment of a node | [
30522,
3853,
20410,
11475,
16206,
3672,
1006,
13045,
1007,
1063,
3443,
17058,
2015,
1006,
13045,
1007,
1012,
18921,
6776,
1006,
2177,
1027,
1028,
1063,
20410,
17058,
11475,
16206,
3672,
1006,
2177,
1012,
11307,
1006,
2003,
14839,
10175,
5657,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.ux3/src/sap/ui/ux3/DataSetSimpleView.js | function() {
this.calculateItemCounts();
this.getParent().updateItems(sap.ui.model.ChangeReason.Change);
template.removeDelegate(oDelegate);
} | javascript | function() {
this.calculateItemCounts();
this.getParent().updateItems(sap.ui.model.ChangeReason.Change);
template.removeDelegate(oDelegate);
} | [
"function",
"(",
")",
"{",
"this",
".",
"calculateItemCounts",
"(",
")",
";",
"this",
".",
"getParent",
"(",
")",
".",
"updateItems",
"(",
"sap",
".",
"ui",
".",
"model",
".",
"ChangeReason",
".",
"Change",
")",
";",
"template",
".",
"removeDelegate",
... | /*eslint-disable no-loop-func | [
"/",
"*",
"eslint",
"-",
"disable",
"no",
"-",
"loop",
"-",
"func"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.ux3/src/sap/ui/ux3/DataSetSimpleView.js#L257-L261 | train | This method is called when the control is removed from the DOM. It will update the items and the delegate to the parent. | [
30522,
3853,
1006,
1007,
1063,
2023,
1012,
18422,
4221,
12458,
21723,
2015,
1006,
1007,
1025,
2023,
1012,
2131,
19362,
4765,
1006,
1007,
1012,
10651,
4221,
5244,
1006,
20066,
1012,
21318,
1012,
2944,
1012,
2689,
16416,
3385,
1012,
2689,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SheetJS/js-xlsx | xlsx.js | parse_TxO | function parse_TxO(blob, length, opts) {
var s = blob.l;
var texts = "";
try {
blob.l += 4;
var ot = (opts.lastobj||{cmo:[0,0]}).cmo[1];
var controlInfo; // eslint-disable-line no-unused-vars
if([0,5,7,11,12,14].indexOf(ot) == -1) blob.l += 6;
else controlInfo = parse_ControlInfo(blob, 6, opts);
var cchText = blob.read_shift(2);
/*var cbRuns = */blob.read_shift(2);
/*var ifntEmpty = */parseuint16(blob, 2);
var len = blob.read_shift(2);
blob.l += len;
//var fmla = parse_ObjFmla(blob, s + length - blob.l);
for(var i = 1; i < blob.lens.length-1; ++i) {
if(blob.l-s != blob.lens[i]) throw new Error("TxO: bad continue record");
var hdr = blob[blob.l];
var t = parse_XLUnicodeStringNoCch(blob, blob.lens[i+1]-blob.lens[i]-1);
texts += t;
if(texts.length >= (hdr ? cchText : 2*cchText)) break;
}
if(texts.length !== cchText && texts.length !== cchText*2) {
throw new Error("cchText: " + cchText + " != " + texts.length);
}
blob.l = s + length;
/* [MS-XLS] 2.5.272 TxORuns */
// var rgTxoRuns = [];
// for(var j = 0; j != cbRuns/8-1; ++j) blob.l += 8;
// var cchText2 = blob.read_shift(2);
// if(cchText2 !== cchText) throw new Error("TxOLastRun mismatch: " + cchText2 + " " + cchText);
// blob.l += 6;
// if(s + length != blob.l) throw new Error("TxO " + (s + length) + ", at " + blob.l);
return { t: texts };
} catch(e) { blob.l = s + length; return { t: texts }; }
} | javascript | function parse_TxO(blob, length, opts) {
var s = blob.l;
var texts = "";
try {
blob.l += 4;
var ot = (opts.lastobj||{cmo:[0,0]}).cmo[1];
var controlInfo; // eslint-disable-line no-unused-vars
if([0,5,7,11,12,14].indexOf(ot) == -1) blob.l += 6;
else controlInfo = parse_ControlInfo(blob, 6, opts);
var cchText = blob.read_shift(2);
/*var cbRuns = */blob.read_shift(2);
/*var ifntEmpty = */parseuint16(blob, 2);
var len = blob.read_shift(2);
blob.l += len;
//var fmla = parse_ObjFmla(blob, s + length - blob.l);
for(var i = 1; i < blob.lens.length-1; ++i) {
if(blob.l-s != blob.lens[i]) throw new Error("TxO: bad continue record");
var hdr = blob[blob.l];
var t = parse_XLUnicodeStringNoCch(blob, blob.lens[i+1]-blob.lens[i]-1);
texts += t;
if(texts.length >= (hdr ? cchText : 2*cchText)) break;
}
if(texts.length !== cchText && texts.length !== cchText*2) {
throw new Error("cchText: " + cchText + " != " + texts.length);
}
blob.l = s + length;
/* [MS-XLS] 2.5.272 TxORuns */
// var rgTxoRuns = [];
// for(var j = 0; j != cbRuns/8-1; ++j) blob.l += 8;
// var cchText2 = blob.read_shift(2);
// if(cchText2 !== cchText) throw new Error("TxOLastRun mismatch: " + cchText2 + " " + cchText);
// blob.l += 6;
// if(s + length != blob.l) throw new Error("TxO " + (s + length) + ", at " + blob.l);
return { t: texts };
} catch(e) { blob.l = s + length; return { t: texts }; }
} | [
"function",
"parse_TxO",
"(",
"blob",
",",
"length",
",",
"opts",
")",
"{",
"var",
"s",
"=",
"blob",
".",
"l",
";",
"var",
"texts",
"=",
"\"\"",
";",
"try",
"{",
"blob",
".",
"l",
"+=",
"4",
";",
"var",
"ot",
"=",
"(",
"opts",
".",
"lastobj",
... | /* [MS-XLS] 2.4.329 TODO: parse properly | [
"/",
"*",
"[",
"MS",
"-",
"XLS",
"]",
"2",
".",
"4",
".",
"329",
"TODO",
":",
"parse",
"properly"
] | 9a6d8a1d3d80c78dad5201fb389316f935279cdc | https://github.com/SheetJS/js-xlsx/blob/9a6d8a1d3d80c78dad5201fb389316f935279cdc/xlsx.js#L6389-L6426 | train | Parse TxO | [
30522,
3853,
11968,
3366,
1035,
19067,
2080,
1006,
1038,
4135,
2497,
1010,
3091,
1010,
23569,
2015,
1007,
1063,
13075,
1055,
1027,
1038,
4135,
2497,
1012,
1048,
1025,
13075,
6981,
1027,
1000,
1000,
1025,
3046,
1063,
1038,
4135,
2497,
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.m/src/sap/m/DateRangeSelection.js | _trim | function _trim(sValue, aParams) {
var i = 0,
aTrims = aParams;
if (!aTrims) {
aTrims = [" "];
}
while (i < aTrims.length) {
if (_endsWith(sValue, aTrims[i])) {
sValue = sValue.substring(0, sValue.length - aTrims[i].length);
i = 0;
continue;
}
i++;
}
i = 0;
while (i < aTrims.length) {
if (_startsWith(sValue, aTrims[i])) {
sValue = sValue.substring(aTrims[i].length);
i = 0;
continue;
}
i++;
}
return sValue;
} | javascript | function _trim(sValue, aParams) {
var i = 0,
aTrims = aParams;
if (!aTrims) {
aTrims = [" "];
}
while (i < aTrims.length) {
if (_endsWith(sValue, aTrims[i])) {
sValue = sValue.substring(0, sValue.length - aTrims[i].length);
i = 0;
continue;
}
i++;
}
i = 0;
while (i < aTrims.length) {
if (_startsWith(sValue, aTrims[i])) {
sValue = sValue.substring(aTrims[i].length);
i = 0;
continue;
}
i++;
}
return sValue;
} | [
"function",
"_trim",
"(",
"sValue",
",",
"aParams",
")",
"{",
"var",
"i",
"=",
"0",
",",
"aTrims",
"=",
"aParams",
";",
"if",
"(",
"!",
"aTrims",
")",
"{",
"aTrims",
"=",
"[",
"\" \"",
"]",
";",
"}",
"while",
"(",
"i",
"<",
"aTrims",
".",
"leng... | Trims all occurrences of the given string values from both ends of the specified string.
@param {string} sValue The value to be trimmed
@param {string[]} aParams All values to be removed
@returns {string} The trimmed value
@private | [
"Trims",
"all",
"occurrences",
"of",
"the",
"given",
"string",
"values",
"from",
"both",
"ends",
"of",
"the",
"specified",
"string",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/DateRangeSelection.js#L1148-L1176 | train | Trims the given value | [
30522,
3853,
1035,
12241,
1006,
17917,
2389,
5657,
1010,
9706,
5400,
5244,
1007,
1063,
13075,
1045,
1027,
1014,
1010,
2012,
20026,
2015,
1027,
9706,
5400,
5244,
1025,
2065,
1006,
999,
2012,
20026,
2015,
1007,
1063,
2012,
20026,
2015,
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... |
GitbookIO/gitbook | lib/output/website/onInit.js | onInit | function onInit(output) {
return Promise(output)
.then(prepareI18n)
.then(prepareResources)
.then(copyPluginAssets);
} | javascript | function onInit(output) {
return Promise(output)
.then(prepareI18n)
.then(prepareResources)
.then(copyPluginAssets);
} | [
"function",
"onInit",
"(",
"output",
")",
"{",
"return",
"Promise",
"(",
"output",
")",
".",
"then",
"(",
"prepareI18n",
")",
".",
"then",
"(",
"prepareResources",
")",
".",
"then",
"(",
"copyPluginAssets",
")",
";",
"}"
] | Initialize the generator
@param {Output}
@return {Output} | [
"Initialize",
"the",
"generator"
] | 6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4 | https://github.com/GitbookIO/gitbook/blob/6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4/lib/output/website/onInit.js#L13-L18 | train | Called when the module is loaded | [
30522,
3853,
2006,
5498,
2102,
1006,
6434,
1007,
1063,
2709,
4872,
1006,
6434,
1007,
1012,
2059,
1006,
7374,
2072,
15136,
2078,
1007,
1012,
2059,
1006,
7374,
6072,
8162,
9623,
1007,
1012,
2059,
1006,
6100,
30524,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/base/SyncPromise.js | call | function call(fnThen, resolve, reject) {
var bOnce;
/*
* @param {any} [vReason]
* The reason for rejection
*/
function rejectPromise(vReason) {
if (!bOnce) {
bOnce = true;
reject(vReason);
}
}
/*
* @param {any} [vResult]
* The thenable to wrap or the result to synchronously fulfill with
*/
function resolvePromise(vResult) {
if (!bOnce) {
bOnce = true;
resolve(vResult);
}
}
try {
fnThen(resolvePromise, rejectPromise);
} catch (e) {
rejectPromise(e);
}
} | javascript | function call(fnThen, resolve, reject) {
var bOnce;
/*
* @param {any} [vReason]
* The reason for rejection
*/
function rejectPromise(vReason) {
if (!bOnce) {
bOnce = true;
reject(vReason);
}
}
/*
* @param {any} [vResult]
* The thenable to wrap or the result to synchronously fulfill with
*/
function resolvePromise(vResult) {
if (!bOnce) {
bOnce = true;
resolve(vResult);
}
}
try {
fnThen(resolvePromise, rejectPromise);
} catch (e) {
rejectPromise(e);
}
} | [
"function",
"call",
"(",
"fnThen",
",",
"resolve",
",",
"reject",
")",
"{",
"var",
"bOnce",
";",
"/*\n\t\t * @param {any} [vReason]\n\t\t * The reason for rejection\n\t\t */",
"function",
"rejectPromise",
"(",
"vReason",
")",
"{",
"if",
"(",
"!",
"bOnce",
")",
"{"... | a SyncPromise which is resolved w/o arguments /*
@see https://promisesaplus.com
2.3.3.3. If then is a function, call it with x as this, first argument resolvePromise, and
second argument rejectPromise, where:
2.3.3.3.1. If/when resolvePromise is called with a value y, run [[Resolve]](promise, y).
2.3.3.3.2. If/when rejectPromise is called with a reason r, reject promise with r.
2.3.3.3.3. If both resolvePromise and rejectPromise are called, or multiple calls to the same
argument are made, the first call takes precedence, and any further calls are ignored.
2.3.3.3.4. If calling then throws an exception e,
2.3.3.3.4.1. If resolvePromise or rejectPromise have been called, ignore it.
2.3.3.3.4.2. Otherwise, reject promise with e as the reason.
@param {function} fnThen
The "then" function
@param {function} resolve
The [[Resolve]](promise, .) function
@param {function} reject
The "reject" function | [
"a",
"SyncPromise",
"which",
"is",
"resolved",
"w",
"/",
"o",
"arguments",
"/",
"*",
"@see",
"https",
":",
"//",
"promisesaplus",
".",
"com"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/base/SyncPromise.js#L32-L62 | train | Calls the given thenable with the given arguments. | [
30522,
3853,
2655,
1006,
1042,
3372,
10222,
1010,
10663,
1010,
15454,
1007,
1063,
13075,
14753,
3401,
1025,
1013,
1008,
1008,
1030,
11498,
2213,
1063,
2151,
1065,
1031,
27830,
5243,
3385,
1033,
1008,
1996,
3114,
2005,
13893,
1008,
1013,
385... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/yield-star-spacing.js | checkSpacing | function checkSpacing(side, leftToken, rightToken) {
if (sourceCode.isSpaceBetweenTokens(leftToken, rightToken) !== mode[side]) {
const after = leftToken.value === "*";
const spaceRequired = mode[side];
const node = after ? leftToken : rightToken;
let messageId = "";
if (spaceRequired) {
messageId = side === "before" ? "missingBefore" : "missingAfter";
} else {
messageId = side === "before" ? "unexpectedBefore" : "unexpectedAfter";
}
context.report({
node,
messageId,
fix(fixer) {
if (spaceRequired) {
if (after) {
return fixer.insertTextAfter(node, " ");
}
return fixer.insertTextBefore(node, " ");
}
return fixer.removeRange([leftToken.range[1], rightToken.range[0]]);
}
});
}
} | javascript | function checkSpacing(side, leftToken, rightToken) {
if (sourceCode.isSpaceBetweenTokens(leftToken, rightToken) !== mode[side]) {
const after = leftToken.value === "*";
const spaceRequired = mode[side];
const node = after ? leftToken : rightToken;
let messageId = "";
if (spaceRequired) {
messageId = side === "before" ? "missingBefore" : "missingAfter";
} else {
messageId = side === "before" ? "unexpectedBefore" : "unexpectedAfter";
}
context.report({
node,
messageId,
fix(fixer) {
if (spaceRequired) {
if (after) {
return fixer.insertTextAfter(node, " ");
}
return fixer.insertTextBefore(node, " ");
}
return fixer.removeRange([leftToken.range[1], rightToken.range[0]]);
}
});
}
} | [
"function",
"checkSpacing",
"(",
"side",
",",
"leftToken",
",",
"rightToken",
")",
"{",
"if",
"(",
"sourceCode",
".",
"isSpaceBetweenTokens",
"(",
"leftToken",
",",
"rightToken",
")",
"!==",
"mode",
"[",
"side",
"]",
")",
"{",
"const",
"after",
"=",
"leftT... | Checks the spacing between two tokens before or after the star token.
@param {string} side Either "before" or "after".
@param {Token} leftToken `function` keyword token if side is "before", or
star token if side is "after".
@param {Token} rightToken Star token if side is "before", or identifier
token if side is "after".
@returns {void} | [
"Checks",
"the",
"spacing",
"between",
"two",
"tokens",
"before",
"or",
"after",
"the",
"star",
"token",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/yield-star-spacing.js#L74-L101 | train | Check spacing between two tokens | [
30522,
3853,
14148,
19498,
2075,
1006,
2217,
1010,
2187,
18715,
2368,
1010,
2157,
18715,
2368,
1007,
1063,
2065,
1006,
3120,
16044,
1012,
26354,
15327,
20915,
28394,
13663,
7520,
2015,
1006,
2187,
18715,
2368,
1010,
2157,
18715,
2368,
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... |
eslint/eslint | lib/rules/no-extra-parens.js | isParenthesisedTwice | function isParenthesisedTwice(node) {
const previousToken = sourceCode.getTokenBefore(node, 1),
nextToken = sourceCode.getTokenAfter(node, 1);
return isParenthesised(node) && previousToken && nextToken &&
astUtils.isOpeningParenToken(previousToken) && previousToken.range[1] <= node.range[0] &&
astUtils.isClosingParenToken(nextToken) && nextToken.range[0] >= node.range[1];
} | javascript | function isParenthesisedTwice(node) {
const previousToken = sourceCode.getTokenBefore(node, 1),
nextToken = sourceCode.getTokenAfter(node, 1);
return isParenthesised(node) && previousToken && nextToken &&
astUtils.isOpeningParenToken(previousToken) && previousToken.range[1] <= node.range[0] &&
astUtils.isClosingParenToken(nextToken) && nextToken.range[0] >= node.range[1];
} | [
"function",
"isParenthesisedTwice",
"(",
"node",
")",
"{",
"const",
"previousToken",
"=",
"sourceCode",
".",
"getTokenBefore",
"(",
"node",
",",
"1",
")",
",",
"nextToken",
"=",
"sourceCode",
".",
"getTokenAfter",
"(",
"node",
",",
"1",
")",
";",
"return",
... | Determines if a node is surrounded by parentheses twice.
@param {ASTNode} node - The node to be checked.
@returns {boolean} True if the node is doubly parenthesised.
@private | [
"Determines",
"if",
"a",
"node",
"is",
"surrounded",
"by",
"parentheses",
"twice",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/no-extra-parens.js#L125-L132 | train | Check if node is parentheses | [
30522,
3853,
2003,
19362,
4765,
24124,
2098,
2102,
23425,
1006,
13045,
1007,
1063,
9530,
3367,
3025,
18715,
2368,
1027,
3120,
16044,
1012,
2131,
18715,
2368,
4783,
29278,
2063,
1006,
13045,
1010,
1015,
1007,
1010,
2279,
18715,
2368,
1027,
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... |
angular/material | src/components/tabs/js/tabsController.js | shouldPaginate | function shouldPaginate () {
var shouldPaginate;
if (ctrl.noPagination || !loaded) return false;
var canvasWidth = $element.prop('clientWidth');
angular.forEach(getElements().tabs, function (tab) {
canvasWidth -= tab.offsetWidth;
});
shouldPaginate = canvasWidth < 0;
// Work around width calculation issues on IE11 when pagination is enabled.
// Don't do this on other browsers because it breaks scroll to new tab animation.
if ($mdUtil.msie) {
if (shouldPaginate) {
getElements().paging.style.width = '999999px';
} else {
getElements().paging.style.width = undefined;
}
}
return shouldPaginate;
} | javascript | function shouldPaginate () {
var shouldPaginate;
if (ctrl.noPagination || !loaded) return false;
var canvasWidth = $element.prop('clientWidth');
angular.forEach(getElements().tabs, function (tab) {
canvasWidth -= tab.offsetWidth;
});
shouldPaginate = canvasWidth < 0;
// Work around width calculation issues on IE11 when pagination is enabled.
// Don't do this on other browsers because it breaks scroll to new tab animation.
if ($mdUtil.msie) {
if (shouldPaginate) {
getElements().paging.style.width = '999999px';
} else {
getElements().paging.style.width = undefined;
}
}
return shouldPaginate;
} | [
"function",
"shouldPaginate",
"(",
")",
"{",
"var",
"shouldPaginate",
";",
"if",
"(",
"ctrl",
".",
"noPagination",
"||",
"!",
"loaded",
")",
"return",
"false",
";",
"var",
"canvasWidth",
"=",
"$element",
".",
"prop",
"(",
"'clientWidth'",
")",
";",
"angula... | Determines if pagination is necessary to display the tabs within the available space.
@returns {boolean} true if pagination is necessary, false otherwise | [
"Determines",
"if",
"pagination",
"is",
"necessary",
"to",
"display",
"the",
"tabs",
"within",
"the",
"available",
"space",
"."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/tabs/js/tabsController.js#L572-L592 | train | Returns true if the page should be paginated | [
30522,
3853,
2323,
4502,
20876,
2618,
1006,
1007,
1063,
13075,
2323,
4502,
20876,
2618,
1025,
2065,
1006,
14931,
12190,
1012,
2053,
4502,
20876,
3508,
1064,
1064,
999,
8209,
1007,
2709,
6270,
1025,
13075,
10683,
9148,
11927,
2232,
1027,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
storybooks/storybook | lib/core/src/server/utils/load-custom-babel-config.js | loadFromPath | function loadFromPath(babelConfigPath) {
let config;
if (fs.existsSync(babelConfigPath)) {
const content = fs.readFileSync(babelConfigPath, 'utf-8');
try {
config = JSON5.parse(content);
config.babelrc = false;
logger.info('=> Loading custom .babelrc');
} catch (e) {
logger.error(`=> Error parsing .babelrc file: ${e.message}`);
throw e;
}
}
if (!config) return null;
// Remove react-hmre preset.
// It causes issues with react-storybook.
// We don't really need it.
// Earlier, we fix this by running storybook in the production mode.
// But, that hide some useful debug messages.
if (config.presets) {
removeReactHmre(config.presets);
}
if (config.env && config.env.development && config.env.development.presets) {
removeReactHmre(config.env.development.presets);
}
return config;
} | javascript | function loadFromPath(babelConfigPath) {
let config;
if (fs.existsSync(babelConfigPath)) {
const content = fs.readFileSync(babelConfigPath, 'utf-8');
try {
config = JSON5.parse(content);
config.babelrc = false;
logger.info('=> Loading custom .babelrc');
} catch (e) {
logger.error(`=> Error parsing .babelrc file: ${e.message}`);
throw e;
}
}
if (!config) return null;
// Remove react-hmre preset.
// It causes issues with react-storybook.
// We don't really need it.
// Earlier, we fix this by running storybook in the production mode.
// But, that hide some useful debug messages.
if (config.presets) {
removeReactHmre(config.presets);
}
if (config.env && config.env.development && config.env.development.presets) {
removeReactHmre(config.env.development.presets);
}
return config;
} | [
"function",
"loadFromPath",
"(",
"babelConfigPath",
")",
"{",
"let",
"config",
";",
"if",
"(",
"fs",
".",
"existsSync",
"(",
"babelConfigPath",
")",
")",
"{",
"const",
"content",
"=",
"fs",
".",
"readFileSync",
"(",
"babelConfigPath",
",",
"'utf-8'",
")",
... | Tries to load a .babelrc and returns the parsed object if successful | [
"Tries",
"to",
"load",
"a",
".",
"babelrc",
"and",
"returns",
"the",
"parsed",
"object",
"if",
"successful"
] | 9bff9271b7e163fb12b9ee0cf697c56f9d727b7b | https://github.com/storybooks/storybook/blob/9bff9271b7e163fb12b9ee0cf697c56f9d727b7b/lib/core/src/server/utils/load-custom-babel-config.js#L17-L47 | train | Load the config from a. babelrc file | [
30522,
3853,
7170,
19699,
25377,
8988,
1006,
11561,
22499,
2078,
8873,
21600,
8988,
1007,
1063,
2292,
9530,
8873,
2290,
1025,
2065,
1006,
1042,
2015,
1012,
6526,
6508,
12273,
1006,
11561,
22499,
2078,
8873,
21600,
8988,
1007,
1007,
1063,
95... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
graphql/graphql-js | src/validation/rules/ValuesOfCorrectType.js | isValidScalar | function isValidScalar(context: ValidationContext, node: ValueNode): void {
// Report any error at the full type expected by the location.
const locationType = context.getInputType();
if (!locationType) {
return;
}
const type = getNamedType(locationType);
if (!isScalarType(type)) {
context.reportError(
new GraphQLError(
badValueMessage(
inspect(locationType),
print(node),
enumTypeSuggestion(type, node),
),
node,
),
);
return;
}
// Scalars determine if a literal value is valid via parseLiteral() which
// may throw or return an invalid value to indicate failure.
try {
const parseResult = type.parseLiteral(node, undefined /* variables */);
if (isInvalid(parseResult)) {
context.reportError(
new GraphQLError(
badValueMessage(inspect(locationType), print(node)),
node,
),
);
}
} catch (error) {
// Ensure a reference to the original error is maintained.
context.reportError(
new GraphQLError(
badValueMessage(inspect(locationType), print(node), error.message),
node,
undefined,
undefined,
undefined,
error,
),
);
}
} | javascript | function isValidScalar(context: ValidationContext, node: ValueNode): void {
// Report any error at the full type expected by the location.
const locationType = context.getInputType();
if (!locationType) {
return;
}
const type = getNamedType(locationType);
if (!isScalarType(type)) {
context.reportError(
new GraphQLError(
badValueMessage(
inspect(locationType),
print(node),
enumTypeSuggestion(type, node),
),
node,
),
);
return;
}
// Scalars determine if a literal value is valid via parseLiteral() which
// may throw or return an invalid value to indicate failure.
try {
const parseResult = type.parseLiteral(node, undefined /* variables */);
if (isInvalid(parseResult)) {
context.reportError(
new GraphQLError(
badValueMessage(inspect(locationType), print(node)),
node,
),
);
}
} catch (error) {
// Ensure a reference to the original error is maintained.
context.reportError(
new GraphQLError(
badValueMessage(inspect(locationType), print(node), error.message),
node,
undefined,
undefined,
undefined,
error,
),
);
}
} | [
"function",
"isValidScalar",
"(",
"context",
":",
"ValidationContext",
",",
"node",
":",
"ValueNode",
")",
":",
"void",
"{",
"// Report any error at the full type expected by the location.",
"const",
"locationType",
"=",
"context",
".",
"getInputType",
"(",
")",
";",
... | Any value literal may be a valid representation of a Scalar, depending on
that scalar type. | [
"Any",
"value",
"literal",
"may",
"be",
"a",
"valid",
"representation",
"of",
"a",
"Scalar",
"depending",
"on",
"that",
"scalar",
"type",
"."
] | b65ff6db8893c1c68f0f236c4b2d663e6c55f5ef | https://github.com/graphql/graphql-js/blob/b65ff6db8893c1c68f0f236c4b2d663e6c55f5ef/src/validation/rules/ValuesOfCorrectType.js#L160-L208 | train | Validates a scalar value. | [
30522,
3853,
2003,
10175,
9821,
25015,
2099,
1006,
6123,
1024,
27354,
8663,
18209,
1010,
13045,
1024,
3643,
3630,
3207,
1007,
1024,
11675,
1063,
1013,
1013,
3189,
2151,
7561,
2012,
1996,
2440,
2828,
3517,
2011,
1996,
3295,
1012,
9530,
3367,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SeleniumHQ/selenium | javascript/selenium-core/lib/snapsie.js | getCanonicalPath | function getCanonicalPath(path) {
path = path.replace(/\//g, '\\');
path = path.replace(/\\\\/g, '\\');
return path;
} | javascript | function getCanonicalPath(path) {
path = path.replace(/\//g, '\\');
path = path.replace(/\\\\/g, '\\');
return path;
} | [
"function",
"getCanonicalPath",
"(",
"path",
")",
"{",
"path",
"=",
"path",
".",
"replace",
"(",
"/",
"\\/",
"/",
"g",
",",
"'\\\\'",
")",
";",
"path",
"=",
"path",
".",
"replace",
"(",
"/",
"\\\\\\\\",
"/",
"g",
",",
"'\\\\'",
")",
";",
"return",
... | Returns the canonical Windows path for a given path. This means
basically replacing any forwards slashes with backslashes.
@param path the path whose canonical form to return | [
"Returns",
"the",
"canonical",
"Windows",
"path",
"for",
"a",
"given",
"path",
".",
"This",
"means",
"basically",
"replacing",
"any",
"forwards",
"slashes",
"with",
"backslashes",
"."
] | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/selenium-core/lib/snapsie.js#L32-L36 | train | Get canonical path of the file | [
30522,
3853,
2131,
23803,
20913,
15069,
1006,
4130,
1007,
1063,
4130,
1027,
4130,
1012,
5672,
1006,
1013,
1032,
1013,
1013,
1043,
1010,
1005,
1032,
1032,
1005,
1007,
1025,
4130,
1027,
4130,
1012,
5672,
1006,
1013,
1032,
1032,
1032,
1032,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/extensions/default/AutoUpdate/node/AutoUpdateDomain.js | init | function init(domainManager) {
if (!domainManager.hasDomain("AutoUpdate")) {
domainManager.registerDomain("AutoUpdate", {
major: 0,
minor: 1
});
}
_domainManager = domainManager;
domainManager.registerCommand(
"AutoUpdate",
"initNode",
initNode,
true,
"Initializes node for the auto update",
[
{
name: "initObj",
type: "object",
description: "json object containing init information"
}
],
[]
);
domainManager.registerCommand(
"AutoUpdate",
"data",
receiveMessageFromBrackets,
true,
"Receives messages from brackets",
[
{
name: "msgObj",
type: "object",
description: "json object containing message info"
}
],
[]
);
domainManager.registerEvent(
"AutoUpdate",
"data",
[
{
name: "msgObj",
type: "object",
description: "json object containing message info to pass to brackets"
}
]
);
} | javascript | function init(domainManager) {
if (!domainManager.hasDomain("AutoUpdate")) {
domainManager.registerDomain("AutoUpdate", {
major: 0,
minor: 1
});
}
_domainManager = domainManager;
domainManager.registerCommand(
"AutoUpdate",
"initNode",
initNode,
true,
"Initializes node for the auto update",
[
{
name: "initObj",
type: "object",
description: "json object containing init information"
}
],
[]
);
domainManager.registerCommand(
"AutoUpdate",
"data",
receiveMessageFromBrackets,
true,
"Receives messages from brackets",
[
{
name: "msgObj",
type: "object",
description: "json object containing message info"
}
],
[]
);
domainManager.registerEvent(
"AutoUpdate",
"data",
[
{
name: "msgObj",
type: "object",
description: "json object containing message info to pass to brackets"
}
]
);
} | [
"function",
"init",
"(",
"domainManager",
")",
"{",
"if",
"(",
"!",
"domainManager",
".",
"hasDomain",
"(",
"\"AutoUpdate\"",
")",
")",
"{",
"domainManager",
".",
"registerDomain",
"(",
"\"AutoUpdate\"",
",",
"{",
"major",
":",
"0",
",",
"minor",
":",
"1",... | Initialize the domain with commands and events related to AutoUpdate
@param {DomainManager} domainManager - The DomainManager for AutoUpdateDomain | [
"Initialize",
"the",
"domain",
"with",
"commands",
"and",
"events",
"related",
"to",
"AutoUpdate"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/AutoUpdate/node/AutoUpdateDomain.js#L455-L507 | train | Initializes the auto update command | [
30522,
3853,
1999,
4183,
1006,
5884,
24805,
4590,
1007,
1063,
2065,
1006,
999,
5884,
24805,
4590,
1012,
2038,
9527,
8113,
1006,
1000,
8285,
6279,
13701,
1000,
1007,
1007,
1063,
5884,
24805,
4590,
1012,
4236,
9527,
8113,
1006,
1000,
8285,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
swimlane/ngx-datatable | release/utils/elm-from-point.js | elementsFromPoint | function elementsFromPoint(x, y) {
var elements = [];
var previousPointerEvents = [];
var current; // TODO: window.getComputedStyle should be used with inferred type (Element)
var i;
var d;
//if (document === undefined) return elements;
// get all elements via elementFromPoint, and remove them from hit-testing in order
while ((current = document.elementFromPoint(x, y)) && elements.indexOf(current) === -1 && current != null) {
// push the element and its current style
elements.push(current);
previousPointerEvents.push({
value: current.style.getPropertyValue('pointer-events'),
priority: current.style.getPropertyPriority('pointer-events')
});
// add "pointer-events: none", to get to the underlying element
current.style.setProperty('pointer-events', 'none', 'important');
}
// restore the previous pointer-events values
for (i = previousPointerEvents.length; d = previousPointerEvents[--i];) {
elements[i].style.setProperty('pointer-events', d.value ? d.value : '', d.priority);
}
// return our results
return elements;
} | javascript | function elementsFromPoint(x, y) {
var elements = [];
var previousPointerEvents = [];
var current; // TODO: window.getComputedStyle should be used with inferred type (Element)
var i;
var d;
//if (document === undefined) return elements;
// get all elements via elementFromPoint, and remove them from hit-testing in order
while ((current = document.elementFromPoint(x, y)) && elements.indexOf(current) === -1 && current != null) {
// push the element and its current style
elements.push(current);
previousPointerEvents.push({
value: current.style.getPropertyValue('pointer-events'),
priority: current.style.getPropertyPriority('pointer-events')
});
// add "pointer-events: none", to get to the underlying element
current.style.setProperty('pointer-events', 'none', 'important');
}
// restore the previous pointer-events values
for (i = previousPointerEvents.length; d = previousPointerEvents[--i];) {
elements[i].style.setProperty('pointer-events', d.value ? d.value : '', d.priority);
}
// return our results
return elements;
} | [
"function",
"elementsFromPoint",
"(",
"x",
",",
"y",
")",
"{",
"var",
"elements",
"=",
"[",
"]",
";",
"var",
"previousPointerEvents",
"=",
"[",
"]",
";",
"var",
"current",
";",
"// TODO: window.getComputedStyle should be used with inferred type (Element)",
"var",
"i... | /*tslint:disable
Polyfill for `elementsFromPoint`
https://developer.mozilla.org/en-US/docs/Web/API/Document/elementsFromPoint
https://gist.github.com/iddan/54d5d9e58311b0495a91bf06de661380
https://gist.github.com/oslego/7265412 | [
"/",
"*",
"tslint",
":",
"disable",
"Polyfill",
"for",
"elementsFromPoint"
] | d7df15a070282a169524dba51d9572008b74804c | https://github.com/swimlane/ngx-datatable/blob/d7df15a070282a169524dba51d9572008b74804c/release/utils/elm-from-point.js#L14-L38 | train | Get all elements from a point | [
30522,
3853,
3787,
19699,
25377,
25785,
1006,
1060,
1010,
1061,
1007,
1063,
13075,
3787,
1027,
1031,
1033,
1025,
13075,
3025,
8400,
7869,
15338,
2015,
1027,
1031,
1033,
1025,
13075,
2783,
1025,
1013,
1013,
28681,
2080,
1024,
3332,
1012,
213... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
chartjs/Chart.js | src/elements/element.rectangle.js | getBarBounds | function getBarBounds(vm) {
var x1, x2, y1, y2, half;
if (isVertical(vm)) {
half = vm.width / 2;
x1 = vm.x - half;
x2 = vm.x + half;
y1 = Math.min(vm.y, vm.base);
y2 = Math.max(vm.y, vm.base);
} else {
half = vm.height / 2;
x1 = Math.min(vm.x, vm.base);
x2 = Math.max(vm.x, vm.base);
y1 = vm.y - half;
y2 = vm.y + half;
}
return {
left: x1,
top: y1,
right: x2,
bottom: y2
};
} | javascript | function getBarBounds(vm) {
var x1, x2, y1, y2, half;
if (isVertical(vm)) {
half = vm.width / 2;
x1 = vm.x - half;
x2 = vm.x + half;
y1 = Math.min(vm.y, vm.base);
y2 = Math.max(vm.y, vm.base);
} else {
half = vm.height / 2;
x1 = Math.min(vm.x, vm.base);
x2 = Math.max(vm.x, vm.base);
y1 = vm.y - half;
y2 = vm.y + half;
}
return {
left: x1,
top: y1,
right: x2,
bottom: y2
};
} | [
"function",
"getBarBounds",
"(",
"vm",
")",
"{",
"var",
"x1",
",",
"x2",
",",
"y1",
",",
"y2",
",",
"half",
";",
"if",
"(",
"isVertical",
"(",
"vm",
")",
")",
"{",
"half",
"=",
"vm",
".",
"width",
"/",
"2",
";",
"x1",
"=",
"vm",
".",
"x",
"... | Helper function to get the bounds of the bar regardless of the orientation
@param bar {Chart.Element.Rectangle} the bar
@return {Bounds} bounds of the bar
@private | [
"Helper",
"function",
"to",
"get",
"the",
"bounds",
"of",
"the",
"bar",
"regardless",
"of",
"the",
"orientation"
] | f093c36574d290330ed623e60fbd070421c730d5 | https://github.com/chartjs/Chart.js/blob/f093c36574d290330ed623e60fbd070421c730d5/src/elements/element.rectangle.js#L30-L53 | train | Get the bounding box of the given rectangle | [
30522,
3853,
2131,
8237,
15494,
2015,
1006,
1058,
2213,
1007,
1063,
13075,
1060,
2487,
1010,
1060,
2475,
1010,
1061,
2487,
1010,
1061,
2475,
1010,
2431,
1025,
2065,
1006,
2003,
16874,
7476,
1006,
1058,
2213,
1007,
1007,
1063,
2431,
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... |
openlayers/openlayers | src/ol/interaction/Extent.js | function(point) {
let x_ = null;
let y_ = null;
if (point[0] == extent[0]) {
x_ = extent[2];
} else if (point[0] == extent[2]) {
x_ = extent[0];
}
if (point[1] == extent[1]) {
y_ = extent[3];
} else if (point[1] == extent[3]) {
y_ = extent[1];
}
if (x_ !== null && y_ !== null) {
return [x_, y_];
}
return null;
} | javascript | function(point) {
let x_ = null;
let y_ = null;
if (point[0] == extent[0]) {
x_ = extent[2];
} else if (point[0] == extent[2]) {
x_ = extent[0];
}
if (point[1] == extent[1]) {
y_ = extent[3];
} else if (point[1] == extent[3]) {
y_ = extent[1];
}
if (x_ !== null && y_ !== null) {
return [x_, y_];
}
return null;
} | [
"function",
"(",
"point",
")",
"{",
"let",
"x_",
"=",
"null",
";",
"let",
"y_",
"=",
"null",
";",
"if",
"(",
"point",
"[",
"0",
"]",
"==",
"extent",
"[",
"0",
"]",
")",
"{",
"x_",
"=",
"extent",
"[",
"2",
"]",
";",
"}",
"else",
"if",
"(",
... | find the extent corner opposite the passed corner | [
"find",
"the",
"extent",
"corner",
"opposite",
"the",
"passed",
"corner"
] | f366eaea522388fb575b11010e69d309164baca7 | https://github.com/openlayers/openlayers/blob/f366eaea522388fb575b11010e69d309164baca7/src/ol/interaction/Extent.js#L302-L319 | train | Returns the x y coordinates of the given point | [
30522,
3853,
1006,
2391,
1007,
1063,
2292,
1060,
1035,
1027,
19701,
1025,
2292,
1061,
1035,
1027,
19701,
1025,
2065,
1006,
2391,
1031,
1014,
1033,
1027,
1027,
6698,
1031,
1014,
1033,
1007,
1063,
1060,
1035,
1027,
6698,
1031,
1016,
1033,
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-unmodified-loop-condition.js | isWriteReference | function isWriteReference(reference) {
if (reference.init) {
const def = reference.resolved && reference.resolved.defs[0];
if (!def || def.type !== "Variable" || def.parent.kind !== "var") {
return false;
}
}
return reference.isWrite();
} | javascript | function isWriteReference(reference) {
if (reference.init) {
const def = reference.resolved && reference.resolved.defs[0];
if (!def || def.type !== "Variable" || def.parent.kind !== "var") {
return false;
}
}
return reference.isWrite();
} | [
"function",
"isWriteReference",
"(",
"reference",
")",
"{",
"if",
"(",
"reference",
".",
"init",
")",
"{",
"const",
"def",
"=",
"reference",
".",
"resolved",
"&&",
"reference",
".",
"resolved",
".",
"defs",
"[",
"0",
"]",
";",
"if",
"(",
"!",
"def",
... | @typedef {Object} LoopConditionInfo
@property {eslint-scope.Reference} reference - The reference.
@property {ASTNode} group - BinaryExpression or ConditionalExpression nodes
that the reference is belonging to.
@property {Function} isInLoop - The predicate which checks a given reference
is in this loop.
@property {boolean} modified - The flag that the reference is modified in
this loop.
Checks whether or not a given reference is a write reference.
@param {eslint-scope.Reference} reference - A reference to check.
@returns {boolean} `true` if the reference is a write reference. | [
"@typedef",
"{",
"Object",
"}",
"LoopConditionInfo",
"@property",
"{",
"eslint",
"-",
"scope",
".",
"Reference",
"}",
"reference",
"-",
"The",
"reference",
".",
"@property",
"{",
"ASTNode",
"}",
"group",
"-",
"BinaryExpression",
"or",
"ConditionalExpression",
"n... | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/no-unmodified-loop-condition.js#L42-L51 | train | Check if a reference is a write reference | [
30522,
3853,
2003,
15994,
27235,
24413,
30524,
2065,
1006,
999,
13366,
1064,
1064,
13366,
1012,
2828,
999,
1027,
1027,
1000,
8023,
1000,
1064,
1064,
13366,
1012,
6687,
1012,
2785,
999,
1027,
1027,
1000,
13075,
1000,
1007,
1063,
2709,
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... |
vuejs/vue-devtools | src/backend/index.js | processRouteContext | function processRouteContext (instance) {
try {
const route = instance.$route
if (route) {
const { path, query, params } = route
const value = { path, query, params }
if (route.fullPath) value.fullPath = route.fullPath
if (route.hash) value.hash = route.hash
if (route.name) value.name = route.name
if (route.meta) value.meta = route.meta
return [{
key: '$route',
value: {
_custom: {
type: 'router',
abstract: true,
value
}
}
}]
}
} catch (e) {
// Invalid $router
}
return []
} | javascript | function processRouteContext (instance) {
try {
const route = instance.$route
if (route) {
const { path, query, params } = route
const value = { path, query, params }
if (route.fullPath) value.fullPath = route.fullPath
if (route.hash) value.hash = route.hash
if (route.name) value.name = route.name
if (route.meta) value.meta = route.meta
return [{
key: '$route',
value: {
_custom: {
type: 'router',
abstract: true,
value
}
}
}]
}
} catch (e) {
// Invalid $router
}
return []
} | [
"function",
"processRouteContext",
"(",
"instance",
")",
"{",
"try",
"{",
"const",
"route",
"=",
"instance",
".",
"$route",
"if",
"(",
"route",
")",
"{",
"const",
"{",
"path",
",",
"query",
",",
"params",
"}",
"=",
"route",
"const",
"value",
"=",
"{",
... | Process possible vue-router $route context
@param {Vue} instance
@return {Array} | [
"Process",
"possible",
"vue",
"-",
"router",
"$route",
"context"
] | 4de4b86388453cd07f0c1bf967d43a4dd4b011c9 | https://github.com/vuejs/vue-devtools/blob/4de4b86388453cd07f0c1bf967d43a4dd4b011c9/src/backend/index.js#L784-L809 | train | Process the route context | [
30522,
3853,
2832,
22494,
26557,
28040,
18413,
1006,
6013,
1007,
1063,
3046,
1063,
9530,
3367,
2799,
1027,
6013,
1012,
1002,
2799,
2065,
1006,
2799,
1007,
1063,
9530,
3367,
1063,
4130,
1010,
23032,
1010,
11498,
5244,
1065,
1027,
2799,
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... |
zloirock/core-js | packages/core-js/modules/es.string.search.js | search | function search(regexp) {
var O = requireObjectCoercible(this);
var searcher = regexp == undefined ? undefined : regexp[SEARCH];
return searcher !== undefined ? searcher.call(regexp, O) : new RegExp(regexp)[SEARCH](String(O));
} | javascript | function search(regexp) {
var O = requireObjectCoercible(this);
var searcher = regexp == undefined ? undefined : regexp[SEARCH];
return searcher !== undefined ? searcher.call(regexp, O) : new RegExp(regexp)[SEARCH](String(O));
} | [
"function",
"search",
"(",
"regexp",
")",
"{",
"var",
"O",
"=",
"requireObjectCoercible",
"(",
"this",
")",
";",
"var",
"searcher",
"=",
"regexp",
"==",
"undefined",
"?",
"undefined",
":",
"regexp",
"[",
"SEARCH",
"]",
";",
"return",
"searcher",
"!==",
"... | `String.prototype.search` method https://tc39.github.io/ecma262/#sec-string.prototype.search | [
"String",
".",
"prototype",
".",
"search",
"method",
"https",
":",
"//",
"tc39",
".",
"github",
".",
"io",
"/",
"ecma262",
"/",
"#sec",
"-",
"string",
".",
"prototype",
".",
"search"
] | fe7c8511a6d27d03a9b8e075b3351416aae95c58 | https://github.com/zloirock/core-js/blob/fe7c8511a6d27d03a9b8e075b3351416aae95c58/packages/core-js/modules/es.string.search.js#L16-L20 | train | Search for a regexp in the object | [
30522,
3853,
3945,
1006,
19723,
10288,
2361,
1007,
1063,
13075,
1051,
1027,
5478,
16429,
20614,
16288,
11890,
7028,
1006,
2023,
1007,
1025,
13075,
3945,
2121,
1027,
19723,
10288,
2361,
1027,
1027,
6151,
28344,
1029,
6151,
28344,
1024,
19723,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/dom/HandlerProxy.js | setTouchTimer | function setTouchTimer(instance) {
instance._touching = true;
clearTimeout(instance._touchTimer);
instance._touchTimer = setTimeout(function () {
instance._touching = false;
}, 700);
} | javascript | function setTouchTimer(instance) {
instance._touching = true;
clearTimeout(instance._touchTimer);
instance._touchTimer = setTimeout(function () {
instance._touching = false;
}, 700);
} | [
"function",
"setTouchTimer",
"(",
"instance",
")",
"{",
"instance",
".",
"_touching",
"=",
"true",
";",
"clearTimeout",
"(",
"instance",
".",
"_touchTimer",
")",
";",
"instance",
".",
"_touchTimer",
"=",
"setTimeout",
"(",
"function",
"(",
")",
"{",
"instanc... | function onMSGestureChange(proxy, event) { if (event.translationX || event.translationY) { // mousemove is carried by MSGesture to reduce the sensitivity. proxy.handler.dispatchToElement(event.target, 'mousemove', event); } if (event.scale !== 1) { event.pinchX = event.offsetX; event.pinchY = event.offsetY; event.pinchScale = event.scale; proxy.handler.dispatchToElement(event.target, 'pinch', event); } }
Prevent mouse event from being dispatched after Touch Events action
@see <https://github.com/deltakosh/handjs/blob/master/src/hand.base.js>
1. Mobile browsers dispatch mouse events 300ms after touchend.
2. Chrome for Android dispatch mousedown for long-touch about 650ms
Result: Blocking Mouse Events for 700ms. | [
"function",
"onMSGestureChange",
"(",
"proxy",
"event",
")",
"{",
"if",
"(",
"event",
".",
"translationX",
"||",
"event",
".",
"translationY",
")",
"{",
"//",
"mousemove",
"is",
"carried",
"by",
"MSGesture",
"to",
"reduce",
"the",
"sensitivity",
".",
"proxy"... | 30321b57cba3149c30eacb0c1e18276f0f001b9f | https://github.com/ecomfe/zrender/blob/30321b57cba3149c30eacb0c1e18276f0f001b9f/src/dom/HandlerProxy.js#L55-L61 | train | Set the touch timer | [
30522,
3853,
2275,
24826,
10143,
14428,
2099,
1006,
6013,
1007,
1063,
6013,
1012,
1035,
7244,
1027,
2995,
1025,
3154,
7292,
5833,
1006,
6013,
1012,
1035,
3543,
7292,
2099,
1007,
1025,
6013,
1012,
1035,
3543,
7292,
2099,
1027,
2275,
7292,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/js/api-controller.js | function($anchorScroll, $http, $location, $route, $sce, $scope) {
this.$http = $http;
this.$route = $route;
this.$scope = $scope;
this.loadTableOfContents();
$scope.items = [];
$scope.isMenuVisible = false;
$scope.currentItem = null;
// Watch for location changes to show the correct item.
$scope.$on('$locationChangeSuccess', function() {
// Not going to api? ignore event.
if (!$location.url().match(/^\/api/)) {
return;
}
var view = $route.current.params.view,
item = _.findWhere($scope.items, {name: view});
if (view && item) {
$scope.showElement(item);
} else {
// No view? Show default item.
$scope.currentItem = defaultItem;
}
});
$scope.toggleMenuLabel = function() {
return $scope.isMenuVisible ? 'Hide list' : 'Show list';
};
$scope.toggleMenu = function() {
$scope.isMenuVisible = !$scope.isMenuVisible;
};
$scope.showElement = function(item) {
// Update the query string with the view name.
$location.search('view', item.name);
$scope.currentItem = item;
// Scroll to the top.
$anchorScroll();
};
$scope.trust = function(html) {
return trustHTML($sce, html);
};
} | javascript | function($anchorScroll, $http, $location, $route, $sce, $scope) {
this.$http = $http;
this.$route = $route;
this.$scope = $scope;
this.loadTableOfContents();
$scope.items = [];
$scope.isMenuVisible = false;
$scope.currentItem = null;
// Watch for location changes to show the correct item.
$scope.$on('$locationChangeSuccess', function() {
// Not going to api? ignore event.
if (!$location.url().match(/^\/api/)) {
return;
}
var view = $route.current.params.view,
item = _.findWhere($scope.items, {name: view});
if (view && item) {
$scope.showElement(item);
} else {
// No view? Show default item.
$scope.currentItem = defaultItem;
}
});
$scope.toggleMenuLabel = function() {
return $scope.isMenuVisible ? 'Hide list' : 'Show list';
};
$scope.toggleMenu = function() {
$scope.isMenuVisible = !$scope.isMenuVisible;
};
$scope.showElement = function(item) {
// Update the query string with the view name.
$location.search('view', item.name);
$scope.currentItem = item;
// Scroll to the top.
$anchorScroll();
};
$scope.trust = function(html) {
return trustHTML($sce, html);
};
} | [
"function",
"(",
"$anchorScroll",
",",
"$http",
",",
"$location",
",",
"$route",
",",
"$sce",
",",
"$scope",
")",
"{",
"this",
".",
"$http",
"=",
"$http",
";",
"this",
".",
"$route",
"=",
"$route",
";",
"this",
".",
"$scope",
"=",
"$scope",
";",
"thi... | Controller for the protractor api view.
@constructor
@ngInject
@param $anchorScroll anchorScroll service.
@param $http HTTP service.
@param $location Location service.
@param $route Route service.
@param $sce Strict Contextual Escaping service.
@param $scope Angular scope. | [
"Controller",
"for",
"the",
"protractor",
"api",
"view",
"."
] | 4f74a4ec753c97adfe955fe468a39286a0a55837 | https://github.com/angular/protractor/blob/4f74a4ec753c97adfe955fe468a39286a0a55837/website/js/api-controller.js#L14-L63 | train | The controller for the controller | [
30522,
3853,
1006,
1002,
24674,
26775,
14511,
1010,
1002,
8299,
1010,
1002,
3295,
1010,
1002,
2799,
1010,
1002,
8040,
2063,
1010,
1002,
9531,
1007,
1063,
2023,
1012,
1002,
8299,
1027,
1002,
8299,
1025,
2023,
1012,
1002,
2799,
1027,
1002,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
jgraph/mxgraph | javascript/mxClient.js | mxCellHighlight | function mxCellHighlight(graph, highlightColor, strokeWidth, dashed)
{
if (graph != null)
{
this.graph = graph;
this.highlightColor = (highlightColor != null) ? highlightColor : mxConstants.DEFAULT_VALID_COLOR;
this.strokeWidth = (strokeWidth != null) ? strokeWidth : mxConstants.HIGHLIGHT_STROKEWIDTH;
this.dashed = (dashed != null) ? dashed : false;
this.opacity = mxConstants.HIGHLIGHT_OPACITY;
// Updates the marker if the graph changes
this.repaintHandler = mxUtils.bind(this, function()
{
// Updates reference to state
if (this.state != null)
{
var tmp = this.graph.view.getState(this.state.cell);
if (tmp == null)
{
this.hide();
}
else
{
this.state = tmp;
this.repaint();
}
}
});
this.graph.getView().addListener(mxEvent.SCALE, this.repaintHandler);
this.graph.getView().addListener(mxEvent.TRANSLATE, this.repaintHandler);
this.graph.getView().addListener(mxEvent.SCALE_AND_TRANSLATE, this.repaintHandler);
this.graph.getModel().addListener(mxEvent.CHANGE, this.repaintHandler);
// Hides the marker if the current root changes
this.resetHandler = mxUtils.bind(this, function()
{
this.hide();
});
this.graph.getView().addListener(mxEvent.DOWN, this.resetHandler);
this.graph.getView().addListener(mxEvent.UP, this.resetHandler);
}
} | javascript | function mxCellHighlight(graph, highlightColor, strokeWidth, dashed)
{
if (graph != null)
{
this.graph = graph;
this.highlightColor = (highlightColor != null) ? highlightColor : mxConstants.DEFAULT_VALID_COLOR;
this.strokeWidth = (strokeWidth != null) ? strokeWidth : mxConstants.HIGHLIGHT_STROKEWIDTH;
this.dashed = (dashed != null) ? dashed : false;
this.opacity = mxConstants.HIGHLIGHT_OPACITY;
// Updates the marker if the graph changes
this.repaintHandler = mxUtils.bind(this, function()
{
// Updates reference to state
if (this.state != null)
{
var tmp = this.graph.view.getState(this.state.cell);
if (tmp == null)
{
this.hide();
}
else
{
this.state = tmp;
this.repaint();
}
}
});
this.graph.getView().addListener(mxEvent.SCALE, this.repaintHandler);
this.graph.getView().addListener(mxEvent.TRANSLATE, this.repaintHandler);
this.graph.getView().addListener(mxEvent.SCALE_AND_TRANSLATE, this.repaintHandler);
this.graph.getModel().addListener(mxEvent.CHANGE, this.repaintHandler);
// Hides the marker if the current root changes
this.resetHandler = mxUtils.bind(this, function()
{
this.hide();
});
this.graph.getView().addListener(mxEvent.DOWN, this.resetHandler);
this.graph.getView().addListener(mxEvent.UP, this.resetHandler);
}
} | [
"function",
"mxCellHighlight",
"(",
"graph",
",",
"highlightColor",
",",
"strokeWidth",
",",
"dashed",
")",
"{",
"if",
"(",
"graph",
"!=",
"null",
")",
"{",
"this",
".",
"graph",
"=",
"graph",
";",
"this",
".",
"highlightColor",
"=",
"(",
"highlightColor",... | Copyright (c) 2006-2015, JGraph Ltd
Copyright (c) 2006-2015, Gaudenz Alder
Class: mxCellHighlight
A helper class to highlight cells. Here is an example for a given cell.
(code)
var highlight = new mxCellHighlight(graph, '#ff0000', 2);
highlight.highlight(graph.view.getState(cell)));
(end)
Constructor: mxCellHighlight
Constructs a cell highlight. | [
"Copyright",
"(",
"c",
")",
"2006",
"-",
"2015",
"JGraph",
"Ltd",
"Copyright",
"(",
"c",
")",
"2006",
"-",
"2015",
"Gaudenz",
"Alder",
"Class",
":",
"mxCellHighlight"
] | 33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44 | https://github.com/jgraph/mxgraph/blob/33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44/javascript/mxClient.js#L81542-L81586 | train | This method is called when the graph is highlighting a cell | [
30522,
3853,
25630,
29109,
2140,
4048,
5603,
7138,
1006,
10629,
1010,
12944,
18717,
1010,
6909,
9148,
11927,
2232,
1010,
18198,
1007,
1063,
2065,
1006,
10629,
999,
1027,
19701,
1007,
1063,
2023,
1012,
10629,
1027,
10629,
1025,
2023,
1012,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/command/KeyBindingManager.js | _applyUserKeyBindings | function _applyUserKeyBindings() {
var remappedCommands = [],
remappedKeys = [],
restrictedCommands = [],
restrictedKeys = [],
invalidKeys = [],
invalidCommands = [],
multipleKeys = [],
duplicateBindings = [],
errorMessage = "";
_.forEach(_customKeyMap, function (commandID, key) {
var normalizedKey = normalizeKeyDescriptorString(key),
existingBindings = _commandMap[commandID] || [];
// Skip this since we don't allow user to update key binding of a special
// command like cut, copy, paste, undo, redo and select all.
if (_isSpecialCommand(commandID)) {
restrictedCommands.push(commandID);
return;
}
// Skip this since we don't allow user to update a shortcut used in
// a special command or any Mac system command.
if (_isReservedShortcuts(normalizedKey)) {
restrictedKeys.push(key);
return;
}
// Skip this if the key is invalid.
if (!normalizedKey) {
invalidKeys.push(key);
return;
}
if (_isKeyAssigned(normalizedKey)) {
if (remappedKeys.indexOf(normalizedKey) !== -1) {
// JSON parser already removed all the duplicates that have the exact
// same case or order in their keys. So we're only detecting duplicate
// bindings that have different orders or different cases used in the key.
duplicateBindings.push(key);
return;
}
// The same key binding already exists, so skip this.
if (_keyMap[normalizedKey].commandID === commandID) {
// Still need to add it to the remappedCommands so that
// we can detect any duplicate later on.
remappedCommands.push(commandID);
return;
}
removeBinding(normalizedKey);
}
if (remappedKeys.indexOf(normalizedKey) === -1) {
remappedKeys.push(normalizedKey);
}
// Remove another key binding if the new key binding is for a command
// that has a different key binding. e.g. "Ctrl-W": "edit.selectLine"
// requires us to remove "Ctrl-W" from "file.close" command, but we
// also need to remove "Ctrl-L" from "edit.selectLine".
if (existingBindings.length) {
existingBindings.forEach(function (binding) {
removeBinding(binding.key);
});
}
if (commandID) {
if (_allCommands.indexOf(commandID) !== -1) {
if (remappedCommands.indexOf(commandID) === -1) {
var keybinding = { key: normalizedKey };
keybinding.displayKey = _getDisplayKey(normalizedKey);
_addBinding(commandID, keybinding.displayKey ? keybinding : normalizedKey, brackets.platform, true);
remappedCommands.push(commandID);
} else {
multipleKeys.push(commandID);
}
} else {
invalidCommands.push(commandID);
}
}
});
if (restrictedCommands.length) {
errorMessage = StringUtils.format(Strings.ERROR_RESTRICTED_COMMANDS, _getBulletList(restrictedCommands));
}
if (restrictedKeys.length) {
errorMessage += StringUtils.format(Strings.ERROR_RESTRICTED_SHORTCUTS, _getBulletList(restrictedKeys));
}
if (multipleKeys.length) {
errorMessage += StringUtils.format(Strings.ERROR_MULTIPLE_SHORTCUTS, _getBulletList(multipleKeys));
}
if (duplicateBindings.length) {
errorMessage += StringUtils.format(Strings.ERROR_DUPLICATE_SHORTCUTS, _getBulletList(duplicateBindings));
}
if (invalidKeys.length) {
errorMessage += StringUtils.format(Strings.ERROR_INVALID_SHORTCUTS, _getBulletList(invalidKeys));
}
if (invalidCommands.length) {
errorMessage += StringUtils.format(Strings.ERROR_NONEXISTENT_COMMANDS, _getBulletList(invalidCommands));
}
if (_showErrors && errorMessage) {
_showErrorsAndOpenKeyMap("", errorMessage);
}
} | javascript | function _applyUserKeyBindings() {
var remappedCommands = [],
remappedKeys = [],
restrictedCommands = [],
restrictedKeys = [],
invalidKeys = [],
invalidCommands = [],
multipleKeys = [],
duplicateBindings = [],
errorMessage = "";
_.forEach(_customKeyMap, function (commandID, key) {
var normalizedKey = normalizeKeyDescriptorString(key),
existingBindings = _commandMap[commandID] || [];
// Skip this since we don't allow user to update key binding of a special
// command like cut, copy, paste, undo, redo and select all.
if (_isSpecialCommand(commandID)) {
restrictedCommands.push(commandID);
return;
}
// Skip this since we don't allow user to update a shortcut used in
// a special command or any Mac system command.
if (_isReservedShortcuts(normalizedKey)) {
restrictedKeys.push(key);
return;
}
// Skip this if the key is invalid.
if (!normalizedKey) {
invalidKeys.push(key);
return;
}
if (_isKeyAssigned(normalizedKey)) {
if (remappedKeys.indexOf(normalizedKey) !== -1) {
// JSON parser already removed all the duplicates that have the exact
// same case or order in their keys. So we're only detecting duplicate
// bindings that have different orders or different cases used in the key.
duplicateBindings.push(key);
return;
}
// The same key binding already exists, so skip this.
if (_keyMap[normalizedKey].commandID === commandID) {
// Still need to add it to the remappedCommands so that
// we can detect any duplicate later on.
remappedCommands.push(commandID);
return;
}
removeBinding(normalizedKey);
}
if (remappedKeys.indexOf(normalizedKey) === -1) {
remappedKeys.push(normalizedKey);
}
// Remove another key binding if the new key binding is for a command
// that has a different key binding. e.g. "Ctrl-W": "edit.selectLine"
// requires us to remove "Ctrl-W" from "file.close" command, but we
// also need to remove "Ctrl-L" from "edit.selectLine".
if (existingBindings.length) {
existingBindings.forEach(function (binding) {
removeBinding(binding.key);
});
}
if (commandID) {
if (_allCommands.indexOf(commandID) !== -1) {
if (remappedCommands.indexOf(commandID) === -1) {
var keybinding = { key: normalizedKey };
keybinding.displayKey = _getDisplayKey(normalizedKey);
_addBinding(commandID, keybinding.displayKey ? keybinding : normalizedKey, brackets.platform, true);
remappedCommands.push(commandID);
} else {
multipleKeys.push(commandID);
}
} else {
invalidCommands.push(commandID);
}
}
});
if (restrictedCommands.length) {
errorMessage = StringUtils.format(Strings.ERROR_RESTRICTED_COMMANDS, _getBulletList(restrictedCommands));
}
if (restrictedKeys.length) {
errorMessage += StringUtils.format(Strings.ERROR_RESTRICTED_SHORTCUTS, _getBulletList(restrictedKeys));
}
if (multipleKeys.length) {
errorMessage += StringUtils.format(Strings.ERROR_MULTIPLE_SHORTCUTS, _getBulletList(multipleKeys));
}
if (duplicateBindings.length) {
errorMessage += StringUtils.format(Strings.ERROR_DUPLICATE_SHORTCUTS, _getBulletList(duplicateBindings));
}
if (invalidKeys.length) {
errorMessage += StringUtils.format(Strings.ERROR_INVALID_SHORTCUTS, _getBulletList(invalidKeys));
}
if (invalidCommands.length) {
errorMessage += StringUtils.format(Strings.ERROR_NONEXISTENT_COMMANDS, _getBulletList(invalidCommands));
}
if (_showErrors && errorMessage) {
_showErrorsAndOpenKeyMap("", errorMessage);
}
} | [
"function",
"_applyUserKeyBindings",
"(",
")",
"{",
"var",
"remappedCommands",
"=",
"[",
"]",
",",
"remappedKeys",
"=",
"[",
"]",
",",
"restrictedCommands",
"=",
"[",
"]",
",",
"restrictedKeys",
"=",
"[",
"]",
",",
"invalidKeys",
"=",
"[",
"]",
",",
"inv... | @private
Applies each user key binding to all the affected commands and updates _keyMap.
Shows errors in a dialog and then opens the user key map file if any of the following
is detected while applying the user key bindings.
- A key binding is attempting to modify a special command.
- A key binding is attempting to assign a shortcut of a special command to another one.
- Multiple key bindings are specified for the same command ID.
- The same key combination is listed for multiple key bindings.
- A key binding has any invalid key syntax.
- A key binding is referring to a non-existent command ID. | [
"@private"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/command/KeyBindingManager.js#L1123-L1234 | train | Apply user - defined key bindings | [
30522,
3853,
1035,
6611,
20330,
14839,
8428,
4667,
2015,
1006,
1007,
1063,
13075,
2128,
2863,
11469,
9006,
2386,
5104,
1027,
1031,
1033,
1010,
2128,
2863,
11469,
14839,
2015,
1027,
1031,
1033,
1010,
7775,
9006,
2386,
5104,
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... |
ColorlibHQ/AdminLTE | bower_components/jvectormap/lib/world-map.js | function(x, y) {
var proj = jvm.WorldMap.maps[this.params.map].projection,
centralMeridian = proj.centralMeridian,
insets = jvm.WorldMap.maps[this.params.map].insets,
i,
inset,
bbox,
nx,
ny;
for (i = 0; i < insets.length; i++) {
inset = insets[i];
bbox = inset.bbox;
nx = x - (this.transX*this.scale + inset.left*this.scale);
ny = y - (this.transY*this.scale + inset.top*this.scale);
nx = (nx / (inset.width * this.scale)) * (bbox[1].x - bbox[0].x) + bbox[0].x;
ny = (ny / (inset.height * this.scale)) * (bbox[1].y - bbox[0].y) + bbox[0].y;
if (nx > bbox[0].x && nx < bbox[1].x && ny > bbox[0].y && ny < bbox[1].y) {
return jvm.Proj[proj.type + '_inv'](nx, -ny, centralMeridian);
}
}
return false;
} | javascript | function(x, y) {
var proj = jvm.WorldMap.maps[this.params.map].projection,
centralMeridian = proj.centralMeridian,
insets = jvm.WorldMap.maps[this.params.map].insets,
i,
inset,
bbox,
nx,
ny;
for (i = 0; i < insets.length; i++) {
inset = insets[i];
bbox = inset.bbox;
nx = x - (this.transX*this.scale + inset.left*this.scale);
ny = y - (this.transY*this.scale + inset.top*this.scale);
nx = (nx / (inset.width * this.scale)) * (bbox[1].x - bbox[0].x) + bbox[0].x;
ny = (ny / (inset.height * this.scale)) * (bbox[1].y - bbox[0].y) + bbox[0].y;
if (nx > bbox[0].x && nx < bbox[1].x && ny > bbox[0].y && ny < bbox[1].y) {
return jvm.Proj[proj.type + '_inv'](nx, -ny, centralMeridian);
}
}
return false;
} | [
"function",
"(",
"x",
",",
"y",
")",
"{",
"var",
"proj",
"=",
"jvm",
".",
"WorldMap",
".",
"maps",
"[",
"this",
".",
"params",
".",
"map",
"]",
".",
"projection",
",",
"centralMeridian",
"=",
"proj",
".",
"centralMeridian",
",",
"insets",
"=",
"jvm",... | Converts cartesian coordinates into coordinates expressed as latitude and longitude.
@param {Number} x X-axis of point on map in pixels.
@param {Number} y Y-axis of point on map in pixels. | [
"Converts",
"cartesian",
"coordinates",
"into",
"coordinates",
"expressed",
"as",
"latitude",
"and",
"longitude",
"."
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/bower_components/jvectormap/lib/world-map.js#L856-L882 | train | Returns true if the given point is inside the bounds of the map | [
30522,
3853,
1006,
1060,
1010,
1061,
1007,
1063,
13075,
4013,
3501,
1027,
1046,
2615,
2213,
1012,
2088,
2863,
2361,
1012,
7341,
1031,
2023,
1012,
11498,
5244,
1012,
4949,
1033,
1012,
13996,
1010,
2430,
5017,
29342,
2078,
1027,
4013,
3501,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
angular/material | src/components/tabs/js/tabsController.js | incrementIndex | function incrementIndex (inc, focus) {
var newIndex,
key = focus ? 'focusIndex' : 'selectedIndex',
index = ctrl[ key ];
for (newIndex = index + inc;
ctrl.tabs[ newIndex ] && ctrl.tabs[ newIndex ].scope.disabled;
newIndex += inc) { /* do nothing */ }
newIndex = (index + inc + ctrl.tabs.length) % ctrl.tabs.length;
if (ctrl.tabs[ newIndex ]) {
ctrl[ key ] = newIndex;
}
} | javascript | function incrementIndex (inc, focus) {
var newIndex,
key = focus ? 'focusIndex' : 'selectedIndex',
index = ctrl[ key ];
for (newIndex = index + inc;
ctrl.tabs[ newIndex ] && ctrl.tabs[ newIndex ].scope.disabled;
newIndex += inc) { /* do nothing */ }
newIndex = (index + inc + ctrl.tabs.length) % ctrl.tabs.length;
if (ctrl.tabs[ newIndex ]) {
ctrl[ key ] = newIndex;
}
} | [
"function",
"incrementIndex",
"(",
"inc",
",",
"focus",
")",
"{",
"var",
"newIndex",
",",
"key",
"=",
"focus",
"?",
"'focusIndex'",
":",
"'selectedIndex'",
",",
"index",
"=",
"ctrl",
"[",
"key",
"]",
";",
"for",
"(",
"newIndex",
"=",
"index",
"+",
"inc... | This moves the selected or focus index left or right. This is used by the keydown handler.
@param {number} inc amount to increment
@param {boolean} focus true to increment the focus index, false to increment the selected index | [
"This",
"moves",
"the",
"selected",
"or",
"focus",
"index",
"left",
"or",
"right",
".",
"This",
"is",
"used",
"by",
"the",
"keydown",
"handler",
"."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/tabs/js/tabsController.js#L694-L707 | train | Increment the index of the next tab in the list | [
30522,
3853,
4297,
28578,
4765,
22254,
10288,
1006,
4297,
1010,
3579,
1007,
1063,
13075,
2047,
22254,
10288,
1010,
3145,
1027,
3579,
1029,
1005,
3579,
22254,
10288,
1005,
1024,
1005,
3479,
22254,
10288,
1005,
1010,
5950,
1027,
14931,
12190,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/markdownItPlugins/markdownitTaskPlugin.js | isTaskListItemToken | function isTaskListItemToken(tokens, index) {
return tokens[index].type === 'inline'
&& tokens[index - 1].type === 'paragraph_open'
&& tokens[index - 2].type === 'list_item_open'
&& (tokens[index].content.indexOf('[ ]') === 0
|| tokens[index].content.indexOf('[x]') === 0
|| tokens[index].content.indexOf('[X]') === 0);
} | javascript | function isTaskListItemToken(tokens, index) {
return tokens[index].type === 'inline'
&& tokens[index - 1].type === 'paragraph_open'
&& tokens[index - 2].type === 'list_item_open'
&& (tokens[index].content.indexOf('[ ]') === 0
|| tokens[index].content.indexOf('[x]') === 0
|| tokens[index].content.indexOf('[X]') === 0);
} | [
"function",
"isTaskListItemToken",
"(",
"tokens",
",",
"index",
")",
"{",
"return",
"tokens",
"[",
"index",
"]",
".",
"type",
"===",
"'inline'",
"&&",
"tokens",
"[",
"index",
"-",
"1",
"]",
".",
"type",
"===",
"'paragraph_open'",
"&&",
"tokens",
"[",
"in... | Return boolean value whether task list item or not
@param {array} tokens Token object
@param {number} index Number of token index
@returns {boolean}
@ignore | [
"Return",
"boolean",
"value",
"whether",
"task",
"list",
"item",
"or",
"not"
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/markdownItPlugins/markdownitTaskPlugin.js#L95-L102 | train | Check if a token is a task list item token | [
30522,
3853,
21541,
19895,
9863,
4221,
20492,
11045,
2078,
1006,
19204,
2015,
1010,
5950,
1007,
1063,
2709,
19204,
2015,
1031,
5950,
1033,
1012,
2828,
1027,
1027,
1027,
1005,
23881,
1005,
1004,
1004,
19204,
2015,
1031,
5950,
1011,
1015,
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... |
SAP/openui5 | src/sap.m/src/sap/m/MaskInputRule.js | validateRegex | function validateRegex(sRegex) {
if (/.+/i.test(sRegex)) {
return true;
}
Log.error("The regex value '" + sRegex + "' is not valid");
return false;
} | javascript | function validateRegex(sRegex) {
if (/.+/i.test(sRegex)) {
return true;
}
Log.error("The regex value '" + sRegex + "' is not valid");
return false;
} | [
"function",
"validateRegex",
"(",
"sRegex",
")",
"{",
"if",
"(",
"/",
".+",
"/",
"i",
".",
"test",
"(",
"sRegex",
")",
")",
"{",
"return",
"true",
";",
"}",
"Log",
".",
"error",
"(",
"\"The regex value '\"",
"+",
"sRegex",
"+",
"\"' is not valid\"",
")... | Checks if the specified regular expression is valid.
@param {String} sRegex The regular expression string to be validated
@returns {boolean} True of the specified regular expression string is valid, false otherwise
@private | [
"Checks",
"if",
"the",
"specified",
"regular",
"expression",
"is",
"valid",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/MaskInputRule.js#L108-L114 | train | Validates the given regular expression. | [
30522,
3853,
9398,
24932,
24746,
2595,
1006,
5034,
24746,
2595,
1007,
1063,
2065,
1006,
1013,
1012,
1009,
1013,
1045,
1012,
3231,
1006,
5034,
24746,
2595,
1007,
1007,
1063,
2709,
2995,
1025,
1065,
8833,
1012,
7561,
1006,
1000,
1996,
19723,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/language/CSSUtils.js | _addSelectorsToResults | function _addSelectorsToResults(resultSelectors, selectorsToAdd, sourceDoc, lineOffset) {
selectorsToAdd.forEach(function (selectorInfo) {
resultSelectors.push({
name: getCompleteSelectors(selectorInfo),
document: sourceDoc,
lineStart: selectorInfo.ruleStartLine + lineOffset,
lineEnd: selectorInfo.declListEndLine + lineOffset,
selectorGroup: selectorInfo.selectorGroup
});
});
} | javascript | function _addSelectorsToResults(resultSelectors, selectorsToAdd, sourceDoc, lineOffset) {
selectorsToAdd.forEach(function (selectorInfo) {
resultSelectors.push({
name: getCompleteSelectors(selectorInfo),
document: sourceDoc,
lineStart: selectorInfo.ruleStartLine + lineOffset,
lineEnd: selectorInfo.declListEndLine + lineOffset,
selectorGroup: selectorInfo.selectorGroup
});
});
} | [
"function",
"_addSelectorsToResults",
"(",
"resultSelectors",
",",
"selectorsToAdd",
",",
"sourceDoc",
",",
"lineOffset",
")",
"{",
"selectorsToAdd",
".",
"forEach",
"(",
"function",
"(",
"selectorInfo",
")",
"{",
"resultSelectors",
".",
"push",
"(",
"{",
"name",
... | Converts the results of _findAllMatchingSelectorsInText() into a simpler bag of data and
appends those new objects to the given 'resultSelectors' Array.
@param {Array.<{document:Document, lineStart:number, lineEnd:number}>} resultSelectors
@param {Array.<SelectorInfo>} selectorsToAdd
@param {!Document} sourceDoc
@param {!number} lineOffset Amount to offset all line number info by. Used if the first line
of the parsed CSS text is not the first line of the sourceDoc. | [
"Converts",
"the",
"results",
"of",
"_findAllMatchingSelectorsInText",
"()",
"into",
"a",
"simpler",
"bag",
"of",
"data",
"and",
"appends",
"those",
"new",
"objects",
"to",
"the",
"given",
"resultSelectors",
"Array",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/language/CSSUtils.js#L1411-L1421 | train | Add selectors to resultSelectors | [
30522,
3853,
1035,
9909,
12260,
24817,
19277,
23722,
3215,
1006,
3463,
12260,
24817,
1010,
27000,
16033,
4215,
2094,
1010,
23184,
10085,
1010,
2240,
27475,
3388,
1007,
1063,
27000,
16033,
4215,
2094,
1012,
18921,
6776,
1006,
3853,
1006,
27000... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/PerfUtils.js | getHealthReport | function getHealthReport() {
var healthReport = {
projectLoadTimes : "",
fileOpenTimes : ""
};
_.forEach(perfData, function (entry, testName) {
if (StringUtils.startsWith(testName, "Application Startup")) {
healthReport.AppStartupTime = getValueAsString(entry);
} else if (StringUtils.startsWith(testName, "brackets module dependencies resolved")) {
healthReport.ModuleDepsResolved = getValueAsString(entry);
} else if (StringUtils.startsWith(testName, "Load Project")) {
healthReport.projectLoadTimes += ":" + getValueAsString(entry, true);
} else if (StringUtils.startsWith(testName, "Open File")) {
healthReport.fileOpenTimes += ":" + getValueAsString(entry, true);
}
});
return healthReport;
} | javascript | function getHealthReport() {
var healthReport = {
projectLoadTimes : "",
fileOpenTimes : ""
};
_.forEach(perfData, function (entry, testName) {
if (StringUtils.startsWith(testName, "Application Startup")) {
healthReport.AppStartupTime = getValueAsString(entry);
} else if (StringUtils.startsWith(testName, "brackets module dependencies resolved")) {
healthReport.ModuleDepsResolved = getValueAsString(entry);
} else if (StringUtils.startsWith(testName, "Load Project")) {
healthReport.projectLoadTimes += ":" + getValueAsString(entry, true);
} else if (StringUtils.startsWith(testName, "Open File")) {
healthReport.fileOpenTimes += ":" + getValueAsString(entry, true);
}
});
return healthReport;
} | [
"function",
"getHealthReport",
"(",
")",
"{",
"var",
"healthReport",
"=",
"{",
"projectLoadTimes",
":",
"\"\"",
",",
"fileOpenTimes",
":",
"\"\"",
"}",
";",
"_",
".",
"forEach",
"(",
"perfData",
",",
"function",
"(",
"entry",
",",
"testName",
")",
"{",
"... | Returns the Performance metrics to be logged for health report
@return {Object} An object with the health data logs to be sent | [
"Returns",
"the",
"Performance",
"metrics",
"to",
"be",
"logged",
"for",
"health",
"report"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/utils/PerfUtils.js#L368-L387 | train | Get health report | [
30522,
3853,
2131,
20192,
24658,
2890,
6442,
1006,
1007,
1063,
13075,
2740,
2890,
6442,
1027,
1063,
2622,
11066,
7292,
2015,
1024,
1000,
1000,
1010,
5371,
26915,
7292,
2015,
1024,
1000,
1000,
1065,
1025,
1035,
1012,
18921,
6776,
1006,
2566,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.demokit/src/sap/ui/demokit/explored/util/MyRouter.js | function (sRoute, oData) {
var oHistory = History.getInstance();
var oPrevHash = oHistory.getPreviousHash();
if (oPrevHash !== undefined) {
window.history.go(-1);
} else {
var bReplace = true; // otherwise we go backwards with a forward history
this.navTo(sRoute, oData, bReplace);
}
} | javascript | function (sRoute, oData) {
var oHistory = History.getInstance();
var oPrevHash = oHistory.getPreviousHash();
if (oPrevHash !== undefined) {
window.history.go(-1);
} else {
var bReplace = true; // otherwise we go backwards with a forward history
this.navTo(sRoute, oData, bReplace);
}
} | [
"function",
"(",
"sRoute",
",",
"oData",
")",
"{",
"var",
"oHistory",
"=",
"History",
".",
"getInstance",
"(",
")",
";",
"var",
"oPrevHash",
"=",
"oHistory",
".",
"getPreviousHash",
"(",
")",
";",
"if",
"(",
"oPrevHash",
"!==",
"undefined",
")",
"{",
"... | mobile nav back handling | [
"mobile",
"nav",
"back",
"handling"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.demokit/src/sap/ui/demokit/explored/util/MyRouter.js#L17-L26 | train | Navigates to the previous hash in the history | [
30522,
3853,
1006,
5034,
5833,
2063,
1010,
1051,
2850,
2696,
1007,
1063,
13075,
2821,
20483,
2854,
30524,
26897,
1006,
1007,
1025,
13075,
6728,
2890,
2615,
14949,
2232,
1027,
2821,
20483,
2854,
1012,
2131,
28139,
24918,
14949,
2232,
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... | |
fex-team/webuploader | _draft/music/upload.js | addFile | function addFile(file) {
var $li = $('<li id="' + file.id + '">' +
'<p class="title">' + file.name + '</p>' +
'<p class="imgWrap"></p>' +
'<p class="progress"><span></span></p>' +
'</li>'),
$btns = $('<div class="file-panel">' +
'<span class="cancel">删除</span>' + '</div>').appendTo($li),
$prgress = $li.find('p.progress span'),
$wrap = $li.find('p.imgWrap'),
$info = $('<p class="error"></p>'),
showError = function(code) {
switch (code) {
case 'interrupt':
text = '上传暂停';
break;
default:
text = '上传失败,请重试';
break;
}
$info.text(text).appendTo($li);
};
if (file.getStatus() === 'invalid') {
showError(file.statusText);
} else {
$wrap.text('不能预览');
percentages[file.id] = [file.size, 0];
file.rotation = 0;
}
file.on('statuschange', function(cur, prev) {
if (prev === 'progress') {
$prgress.hide().width(0);
} else if (prev === 'queued') {
$li.off('mouseenter mouseleave');
$btns.remove();
}
// 成功
if (cur === 'error' || cur === 'invalid') {
showError(file.statusText);
percentages[file.id][1] = 1;
} else if (cur === 'interrupt') {
showError('interrupt');
} else if (cur === 'queued') {
percentages[file.id][1] = 0;
} else if (cur === 'progress') {
$info.remove();
$prgress.css({
display: 'block',
width: '10%'
});
} else if (cur === 'complete') {
$li.append('<span class="success"></span>');
}
$li.removeClass('state-' + prev).addClass('state-' + cur);
});
$li.on('mouseenter', function() {
$btns.stop().animate({
height: 30
});
});
$li.on('mouseleave', function() {
$btns.stop().animate({
height: 0
});
});
$btns.on('click', 'span', function() {
uploader.removeFile(file);
});
$li.appendTo($queue);
} | javascript | function addFile(file) {
var $li = $('<li id="' + file.id + '">' +
'<p class="title">' + file.name + '</p>' +
'<p class="imgWrap"></p>' +
'<p class="progress"><span></span></p>' +
'</li>'),
$btns = $('<div class="file-panel">' +
'<span class="cancel">删除</span>' + '</div>').appendTo($li),
$prgress = $li.find('p.progress span'),
$wrap = $li.find('p.imgWrap'),
$info = $('<p class="error"></p>'),
showError = function(code) {
switch (code) {
case 'interrupt':
text = '上传暂停';
break;
default:
text = '上传失败,请重试';
break;
}
$info.text(text).appendTo($li);
};
if (file.getStatus() === 'invalid') {
showError(file.statusText);
} else {
$wrap.text('不能预览');
percentages[file.id] = [file.size, 0];
file.rotation = 0;
}
file.on('statuschange', function(cur, prev) {
if (prev === 'progress') {
$prgress.hide().width(0);
} else if (prev === 'queued') {
$li.off('mouseenter mouseleave');
$btns.remove();
}
// 成功
if (cur === 'error' || cur === 'invalid') {
showError(file.statusText);
percentages[file.id][1] = 1;
} else if (cur === 'interrupt') {
showError('interrupt');
} else if (cur === 'queued') {
percentages[file.id][1] = 0;
} else if (cur === 'progress') {
$info.remove();
$prgress.css({
display: 'block',
width: '10%'
});
} else if (cur === 'complete') {
$li.append('<span class="success"></span>');
}
$li.removeClass('state-' + prev).addClass('state-' + cur);
});
$li.on('mouseenter', function() {
$btns.stop().animate({
height: 30
});
});
$li.on('mouseleave', function() {
$btns.stop().animate({
height: 0
});
});
$btns.on('click', 'span', function() {
uploader.removeFile(file);
});
$li.appendTo($queue);
} | [
"function",
"addFile",
"(",
"file",
")",
"{",
"var",
"$li",
"=",
"$",
"(",
"'<li id=\"'",
"+",
"file",
".",
"id",
"+",
"'\">'",
"+",
"'<p class=\"title\">'",
"+",
"file",
".",
"name",
"+",
"'</p>'",
"+",
"'<p class=\"imgWrap\"></p>'",
"+",
"'<p class=\"progr... | 当有文件添加进来时执行,负责view的创建 | [
"当有文件添加进来时执行,负责view的创建"
] | 7094e4476c5af3b06993d91dde2d223200b9feb7 | https://github.com/fex-team/webuploader/blob/7094e4476c5af3b06993d91dde2d223200b9feb7/_draft/music/upload.js#L56-L137 | train | Add a file to the file panel | [
30522,
3853,
5587,
30524,
13075,
1002,
5622,
1027,
1002,
1006,
1005,
1026,
5622,
8909,
1027,
1000,
1005,
1009,
5371,
1012,
8909,
1009,
1005,
1000,
1028,
1005,
1009,
1005,
1026,
1052,
2465,
1027,
1000,
2516,
1000,
1028,
1005,
1009,
5371,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/extensions/default/JavaScriptCodeHints/main.js | requestJumpToDef | function requestJumpToDef(session, offset) {
var response = ScopeManager.requestJumptoDef(session, session.editor.document, offset);
if (response.hasOwnProperty("promise")) {
response.promise.done(handleJumpResponse).fail(function () {
result.reject();
});
}
} | javascript | function requestJumpToDef(session, offset) {
var response = ScopeManager.requestJumptoDef(session, session.editor.document, offset);
if (response.hasOwnProperty("promise")) {
response.promise.done(handleJumpResponse).fail(function () {
result.reject();
});
}
} | [
"function",
"requestJumpToDef",
"(",
"session",
",",
"offset",
")",
"{",
"var",
"response",
"=",
"ScopeManager",
".",
"requestJumptoDef",
"(",
"session",
",",
"session",
".",
"editor",
".",
"document",
",",
"offset",
")",
";",
"if",
"(",
"response",
".",
"... | Make a jump-to-def request based on the session and offset passed in.
@param {Session} session - the session
@param {number} offset - the offset of where to jump from | [
"Make",
"a",
"jump",
"-",
"to",
"-",
"def",
"request",
"based",
"on",
"the",
"session",
"and",
"offset",
"passed",
"in",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/JavaScriptCodeHints/main.js#L753-L761 | train | Request a jump to definition | [
30522,
3853,
5227,
9103,
27718,
10244,
2546,
1006,
5219,
1010,
16396,
1007,
1063,
13075,
3433,
1027,
9531,
24805,
4590,
1012,
5227,
9103,
27718,
10244,
2546,
1006,
5219,
1010,
5219,
1012,
3559,
1012,
6254,
1010,
16396,
1007,
1025,
2065,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
jgraph/mxgraph | javascript/mxClient.js | mxImageShape | function mxImageShape(bounds, image, fill, stroke, strokewidth)
{
mxShape.call(this);
this.bounds = bounds;
this.image = image;
this.fill = fill;
this.stroke = stroke;
this.strokewidth = (strokewidth != null) ? strokewidth : 1;
this.shadow = false;
} | javascript | function mxImageShape(bounds, image, fill, stroke, strokewidth)
{
mxShape.call(this);
this.bounds = bounds;
this.image = image;
this.fill = fill;
this.stroke = stroke;
this.strokewidth = (strokewidth != null) ? strokewidth : 1;
this.shadow = false;
} | [
"function",
"mxImageShape",
"(",
"bounds",
",",
"image",
",",
"fill",
",",
"stroke",
",",
"strokewidth",
")",
"{",
"mxShape",
".",
"call",
"(",
"this",
")",
";",
"this",
".",
"bounds",
"=",
"bounds",
";",
"this",
".",
"image",
"=",
"image",
";",
"thi... | Copyright (c) 2006-2015, JGraph Ltd
Copyright (c) 2006-2015, Gaudenz Alder
Class: mxImageShape
Extends <mxShape> to implement an image shape. This shape is registered
under <mxConstants.SHAPE_IMAGE> in <mxCellRenderer>.
Constructor: mxImageShape
Constructs a new image shape.
Parameters:
bounds - <mxRectangle> that defines the bounds. This is stored in
<mxShape.bounds>.
image - String that specifies the URL of the image. This is stored in
<image>.
fill - String that defines the fill color. This is stored in <fill>.
stroke - String that defines the stroke color. This is stored in <stroke>.
strokewidth - Optional integer that defines the stroke width. Default is
0. This is stored in <strokewidth>. | [
"Copyright",
"(",
"c",
")",
"2006",
"-",
"2015",
"JGraph",
"Ltd",
"Copyright",
"(",
"c",
")",
"2006",
"-",
"2015",
"Gaudenz",
"Alder",
"Class",
":",
"mxImageShape"
] | 33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44 | https://github.com/jgraph/mxgraph/blob/33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44/javascript/mxClient.js#L27454-L27463 | train | A shape that can be used to draw an image | [
30522,
3853,
25630,
9581,
8449,
3270,
5051,
1006,
19202,
1010,
3746,
1010,
6039,
1010,
6909,
1010,
6909,
9148,
11927,
2232,
1007,
1063,
25630,
7377,
5051,
1012,
2655,
1006,
2023,
1007,
1025,
2023,
1012,
19202,
1027,
19202,
1025,
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... |
SeleniumHQ/selenium | javascript/selenium-core/scripts/htmlutils.js | MirroredDocument | function MirroredDocument() {
// private
var originalDoc;
var reflectionDoc;
var namespaceResolver;
var finderBuilder = new FinderBuilder();
var pastReflections = new BoundedCache(50);
var jQuery = new JQueryWrapper();
/**
* Appends elements represented by the given HTML to the given parent
* element. All <script> elements are omitted.
*/
function appendHTML(html, parentNode) {
var scripts = jQuery.clean([ html ], null, parentNode);
}
function getHeadHtml(doc) {
return doc.getElementsByTagName('head')[0].innerHTML;
}
function getBodyHtml(doc) {
return doc.body.innerHTML;
}
/**
* Copies the given HTML as the content of the current document's <head>
* element. If the current document's head already contains identical
* markup, copying is skipped. <script> elements are omitted.
*/
function copyHead(headHtml, doc) {
var head = doc.getElementsByTagName('head')[0];
if (head.innerHTML == headHtml) {
// the content is already correct
return;
}
jQuery.init(head).empty();
appendHTML(headHtml, head);
}
/**
* Copies the given HTML as the content of the current document's <body>
* element. If the current document's body already contains identical
* markup, copying is skipped. <script> elements are omitted.
*/
function copyBody(bodyHtml, doc) {
if (doc.body.innerHTML == bodyHtml) {
return;
}
jQuery.init(doc.body).empty();
appendHTML(bodyHtml, doc.body);
}
// public
this.setOriginal = function(newOriginalDoc) {
originalDoc = newOriginalDoc;
return this;
};
this.getOriginal = function() {
return originalDoc;
};
this.setReflection = function(newReflectionDoc) {
reflectionDoc = newReflectionDoc;
return this;
}
this.getReflection = function() {
return reflectionDoc;
};
this.setNamespaceResolver = function(newNamespaceResolver) {
namespaceResolver = newNamespaceResolver;
return this;
};
/**
* Makes sure the reflected document reflects the original. Returns this
* object.
*/
this.reflect = function() {
if (reflectionDoc == originalDoc) {
// the reflection and the original are one and the same
return this;
}
var originalHtml = originalDoc.documentElement.innerHTML;
var pastReflectionHtml = pastReflections.get(originalHtml);
if (pastReflectionHtml != null &&
pastReflectionHtml == reflectionDoc.documentElement.innerHTML) {
// the reflection is already accurate
return this;
}
var headHtml = getHeadHtml(originalDoc);
var bodyHtml = getBodyHtml(originalDoc);
try {
copyHead(headHtml, reflectionDoc);
copyBody(bodyHtml, reflectionDoc);
pastReflections.put(originalHtml,
reflectionDoc.documentElement.innerHTML);
}
catch (e) {
safe_log('warn', 'Document reflection failed: ' + e.message);
}
return this;
};
/**
* Returns the node in the reflection that corresponds to node in the
* original document. Returns null if the reflected node can't be found.
*/
this.getReflectedNode = function(originalNode) {
if (reflectionDoc == originalDoc) {
// the reflection and the original are one and the same
return originalNode;
}
if (originalNode == originalDoc) {
return reflectionDoc;
}
var finder = finderBuilder.setDocument(originalDoc).build(originalNode);
return finder(reflectionDoc) || null;
};
} | javascript | function MirroredDocument() {
// private
var originalDoc;
var reflectionDoc;
var namespaceResolver;
var finderBuilder = new FinderBuilder();
var pastReflections = new BoundedCache(50);
var jQuery = new JQueryWrapper();
/**
* Appends elements represented by the given HTML to the given parent
* element. All <script> elements are omitted.
*/
function appendHTML(html, parentNode) {
var scripts = jQuery.clean([ html ], null, parentNode);
}
function getHeadHtml(doc) {
return doc.getElementsByTagName('head')[0].innerHTML;
}
function getBodyHtml(doc) {
return doc.body.innerHTML;
}
/**
* Copies the given HTML as the content of the current document's <head>
* element. If the current document's head already contains identical
* markup, copying is skipped. <script> elements are omitted.
*/
function copyHead(headHtml, doc) {
var head = doc.getElementsByTagName('head')[0];
if (head.innerHTML == headHtml) {
// the content is already correct
return;
}
jQuery.init(head).empty();
appendHTML(headHtml, head);
}
/**
* Copies the given HTML as the content of the current document's <body>
* element. If the current document's body already contains identical
* markup, copying is skipped. <script> elements are omitted.
*/
function copyBody(bodyHtml, doc) {
if (doc.body.innerHTML == bodyHtml) {
return;
}
jQuery.init(doc.body).empty();
appendHTML(bodyHtml, doc.body);
}
// public
this.setOriginal = function(newOriginalDoc) {
originalDoc = newOriginalDoc;
return this;
};
this.getOriginal = function() {
return originalDoc;
};
this.setReflection = function(newReflectionDoc) {
reflectionDoc = newReflectionDoc;
return this;
}
this.getReflection = function() {
return reflectionDoc;
};
this.setNamespaceResolver = function(newNamespaceResolver) {
namespaceResolver = newNamespaceResolver;
return this;
};
/**
* Makes sure the reflected document reflects the original. Returns this
* object.
*/
this.reflect = function() {
if (reflectionDoc == originalDoc) {
// the reflection and the original are one and the same
return this;
}
var originalHtml = originalDoc.documentElement.innerHTML;
var pastReflectionHtml = pastReflections.get(originalHtml);
if (pastReflectionHtml != null &&
pastReflectionHtml == reflectionDoc.documentElement.innerHTML) {
// the reflection is already accurate
return this;
}
var headHtml = getHeadHtml(originalDoc);
var bodyHtml = getBodyHtml(originalDoc);
try {
copyHead(headHtml, reflectionDoc);
copyBody(bodyHtml, reflectionDoc);
pastReflections.put(originalHtml,
reflectionDoc.documentElement.innerHTML);
}
catch (e) {
safe_log('warn', 'Document reflection failed: ' + e.message);
}
return this;
};
/**
* Returns the node in the reflection that corresponds to node in the
* original document. Returns null if the reflected node can't be found.
*/
this.getReflectedNode = function(originalNode) {
if (reflectionDoc == originalDoc) {
// the reflection and the original are one and the same
return originalNode;
}
if (originalNode == originalDoc) {
return reflectionDoc;
}
var finder = finderBuilder.setDocument(originalDoc).build(originalNode);
return finder(reflectionDoc) || null;
};
} | [
"function",
"MirroredDocument",
"(",
")",
"{",
"// private",
"var",
"originalDoc",
";",
"var",
"reflectionDoc",
";",
"var",
"namespaceResolver",
";",
"var",
"finderBuilder",
"=",
"new",
"FinderBuilder",
"(",
")",
";",
"var",
"pastReflections",
"=",
"new",
"Bound... | /////////////////////////////////////////////////////////////////////////////
@param newEngine the XPath engine used to navigate this document | [
"/////////////////////////////////////////////////////////////////////////////"
] | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/selenium-core/scripts/htmlutils.js#L1422-L1558 | train | MirroredDocument constructor. | [
30522,
3853,
22243,
3527,
24894,
4765,
1006,
1007,
1063,
1013,
1013,
2797,
13075,
2434,
3527,
2278,
1025,
13075,
9185,
3527,
2278,
1025,
13075,
3415,
15327,
6072,
4747,
6299,
1025,
13075,
2424,
2121,
8569,
23891,
2099,
1027,
2047,
2424,
212... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
angular/angular | tools/gulp-tasks/cldr/closure.js | generateAllLocalesFile | function generateAllLocalesFile(LOCALES, ALIASES) {
const existingLocalesAliases = {};
const existingLocalesData = {};
// for each locale, get the data and the list of equivalent locales
LOCALES.forEach(locale => {
const eqLocales = new Set();
eqLocales.add(locale);
if (locale.match(/-/)) {
eqLocales.add(locale.replace(/-/g, '_'));
}
// check for aliases
const alias = ALIASES[locale];
if (alias) {
eqLocales.add(alias);
if (alias.match(/-/)) {
eqLocales.add(alias.replace(/-/g, '_'));
}
// to avoid duplicated "case" we regroup all locales in the same "case"
// the simplest way to do that is to have alias aliases
// e.g. 'no' --> 'nb', 'nb' --> 'no-NO'
// which means that we'll have 'no', 'nb' and 'no-NO' in the same "case"
const aliasKeys = Object.keys(ALIASES);
for (let i = 0; i < aliasKeys.length; i++) {
const aliasValue = ALIASES[alias];
if (aliasKeys.indexOf(alias) !== -1 && !eqLocales.has(aliasValue)) {
eqLocales.add(aliasValue);
if (aliasValue.match(/-/)) {
eqLocales.add(aliasValue.replace(/-/g, '_'));
}
}
}
}
for (let l of eqLocales) {
// find the existing content file
const path = `${RELATIVE_I18N_DATA_FOLDER}/${l}.ts`;
if (fs.existsSync(`${RELATIVE_I18N_DATA_FOLDER}/${l}.ts`)) {
const localeName = formatLocale(locale);
existingLocalesData[locale] =
fs.readFileSync(path, 'utf8')
.replace(`${HEADER}\n`, '')
.replace('export default ', `export const locale_${localeName} = `)
.replace('function plural', `function plural_${localeName}`)
.replace(/,(\n | )plural/, `, plural_${localeName}`)
.replace('const u = undefined;\n\n', '');
}
}
existingLocalesAliases[locale] = eqLocales;
});
function generateCases(locale) {
let str = '';
let locales = [];
const eqLocales = existingLocalesAliases[locale];
for (let l of eqLocales) {
str += `case '${l}':\n`;
locales.push(`'${l}'`);
}
let localesStr = '[' + locales.join(',') + ']';
str += ` l = locale_${formatLocale(locale)};
locales = ${localesStr};
break;\n`;
return str;
}
function formatLocale(locale) { return locale.replace(/-/g, '_'); }
// clang-format off
return `${HEADER}
import {registerLocaleData} from '../src/i18n/locale_data';
const u = undefined;
${LOCALES.map(locale => `${existingLocalesData[locale]}`).join('\n')}
let l: any;
let locales: string[] = [];
switch (goog.LOCALE) {
${LOCALES.map(locale => generateCases(locale)).join('')}}
if(l) {
locales.forEach(locale => registerLocaleData(l, locale));
}
`;
// clang-format on
} | javascript | function generateAllLocalesFile(LOCALES, ALIASES) {
const existingLocalesAliases = {};
const existingLocalesData = {};
// for each locale, get the data and the list of equivalent locales
LOCALES.forEach(locale => {
const eqLocales = new Set();
eqLocales.add(locale);
if (locale.match(/-/)) {
eqLocales.add(locale.replace(/-/g, '_'));
}
// check for aliases
const alias = ALIASES[locale];
if (alias) {
eqLocales.add(alias);
if (alias.match(/-/)) {
eqLocales.add(alias.replace(/-/g, '_'));
}
// to avoid duplicated "case" we regroup all locales in the same "case"
// the simplest way to do that is to have alias aliases
// e.g. 'no' --> 'nb', 'nb' --> 'no-NO'
// which means that we'll have 'no', 'nb' and 'no-NO' in the same "case"
const aliasKeys = Object.keys(ALIASES);
for (let i = 0; i < aliasKeys.length; i++) {
const aliasValue = ALIASES[alias];
if (aliasKeys.indexOf(alias) !== -1 && !eqLocales.has(aliasValue)) {
eqLocales.add(aliasValue);
if (aliasValue.match(/-/)) {
eqLocales.add(aliasValue.replace(/-/g, '_'));
}
}
}
}
for (let l of eqLocales) {
// find the existing content file
const path = `${RELATIVE_I18N_DATA_FOLDER}/${l}.ts`;
if (fs.existsSync(`${RELATIVE_I18N_DATA_FOLDER}/${l}.ts`)) {
const localeName = formatLocale(locale);
existingLocalesData[locale] =
fs.readFileSync(path, 'utf8')
.replace(`${HEADER}\n`, '')
.replace('export default ', `export const locale_${localeName} = `)
.replace('function plural', `function plural_${localeName}`)
.replace(/,(\n | )plural/, `, plural_${localeName}`)
.replace('const u = undefined;\n\n', '');
}
}
existingLocalesAliases[locale] = eqLocales;
});
function generateCases(locale) {
let str = '';
let locales = [];
const eqLocales = existingLocalesAliases[locale];
for (let l of eqLocales) {
str += `case '${l}':\n`;
locales.push(`'${l}'`);
}
let localesStr = '[' + locales.join(',') + ']';
str += ` l = locale_${formatLocale(locale)};
locales = ${localesStr};
break;\n`;
return str;
}
function formatLocale(locale) { return locale.replace(/-/g, '_'); }
// clang-format off
return `${HEADER}
import {registerLocaleData} from '../src/i18n/locale_data';
const u = undefined;
${LOCALES.map(locale => `${existingLocalesData[locale]}`).join('\n')}
let l: any;
let locales: string[] = [];
switch (goog.LOCALE) {
${LOCALES.map(locale => generateCases(locale)).join('')}}
if(l) {
locales.forEach(locale => registerLocaleData(l, locale));
}
`;
// clang-format on
} | [
"function",
"generateAllLocalesFile",
"(",
"LOCALES",
",",
"ALIASES",
")",
"{",
"const",
"existingLocalesAliases",
"=",
"{",
"}",
";",
"const",
"existingLocalesData",
"=",
"{",
"}",
";",
"// for each locale, get the data and the list of equivalent locales",
"LOCALES",
"."... | Generate a file that contains all locale to import for closure.
Tree shaking will only keep the data for the `goog.LOCALE` locale. | [
"Generate",
"a",
"file",
"that",
"contains",
"all",
"locale",
"to",
"import",
"for",
"closure",
".",
"Tree",
"shaking",
"will",
"only",
"keep",
"the",
"data",
"for",
"the",
"goog",
".",
"LOCALE",
"locale",
"."
] | c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c | https://github.com/angular/angular/blob/c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c/tools/gulp-tasks/cldr/closure.js#L71-L163 | train | Generate all locales file | [
30522,
3853,
9699,
8095,
4135,
9289,
2229,
8873,
2571,
1006,
2334,
2229,
1010,
14593,
2229,
1007,
1063,
9530,
3367,
4493,
4135,
9289,
22447,
6632,
8583,
1027,
1063,
1065,
1025,
9530,
3367,
4493,
4135,
9289,
2229,
2850,
2696,
1027,
1063,
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... |
apache/incubator-echarts | src/chart/line/lineAnimationDiff.js | diffData | function diffData(oldData, newData) {
var diffResult = [];
newData.diff(oldData)
.add(function (idx) {
diffResult.push({cmd: '+', idx: idx});
})
.update(function (newIdx, oldIdx) {
diffResult.push({cmd: '=', idx: oldIdx, idx1: newIdx});
})
.remove(function (idx) {
diffResult.push({cmd: '-', idx: idx});
})
.execute();
return diffResult;
} | javascript | function diffData(oldData, newData) {
var diffResult = [];
newData.diff(oldData)
.add(function (idx) {
diffResult.push({cmd: '+', idx: idx});
})
.update(function (newIdx, oldIdx) {
diffResult.push({cmd: '=', idx: oldIdx, idx1: newIdx});
})
.remove(function (idx) {
diffResult.push({cmd: '-', idx: idx});
})
.execute();
return diffResult;
} | [
"function",
"diffData",
"(",
"oldData",
",",
"newData",
")",
"{",
"var",
"diffResult",
"=",
"[",
"]",
";",
"newData",
".",
"diff",
"(",
"oldData",
")",
".",
"add",
"(",
"function",
"(",
"idx",
")",
"{",
"diffResult",
".",
"push",
"(",
"{",
"cmd",
"... | // Assume id in idList are all unique var idIndicesMap = {}; var idx = 0; for (var i = 0; i < newIdList.length; i++) { idIndicesMap[newIdList[i]] = idx; newIdList[i] = idx++; } for (var i = 0; i < oldIdList.length; i++) { var oldId = oldIdList[i]; // Same with newIdList if (idIndicesMap[oldId]) { oldIdList[i] = idIndicesMap[oldId]; } else { oldIdList[i] = idx++; } } } | [
"//",
"Assume",
"id",
"in",
"idList",
"are",
"all",
"unique",
"var",
"idIndicesMap",
"=",
"{}",
";",
"var",
"idx",
"=",
"0",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"newIdList",
".",
"length",
";",
"i",
"++",
")",
"{",
"idIndicesMap... | 4d0ea095dc3929cb6de40c45748826e7999c7aa8 | https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/chart/line/lineAnimationDiff.js#L49-L65 | train | diffData - diff data | [
30522,
3853,
4487,
4246,
2850,
2696,
1006,
2214,
2850,
2696,
1010,
2047,
2850,
2696,
1007,
1063,
13075,
4487,
4246,
6072,
11314,
1027,
1031,
1033,
1025,
2047,
2850,
2696,
1012,
4487,
4246,
1006,
2214,
2850,
2696,
1007,
1012,
5587,
1006,
3... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/extensions/default/JavaScriptRefactoring/ExtractToVariable.js | getExpressions | function getExpressions(ast, start, end) {
var expns = [],
s = start,
e = end,
expn;
while (true) {
expn = RefactoringUtils.findSurroundExpression(ast, {start: s, end: e});
if (!expn) {
break;
}
expns.push(expn);
s = expn.start - 1;
}
s = start;
e = end;
function checkExpnEquality(e) {
return e.start === expn.start && e.end === expn.end;
}
while (true) {
expn = RefactoringUtils.findSurroundExpression(ast, {start: s, end: e});
if (!expn) {
break;
}
e = expn.end + 1;
// if expn already added, continue
if (expns.find(checkExpnEquality)) {
continue;
}
expns.push(expn);
}
return expns;
} | javascript | function getExpressions(ast, start, end) {
var expns = [],
s = start,
e = end,
expn;
while (true) {
expn = RefactoringUtils.findSurroundExpression(ast, {start: s, end: e});
if (!expn) {
break;
}
expns.push(expn);
s = expn.start - 1;
}
s = start;
e = end;
function checkExpnEquality(e) {
return e.start === expn.start && e.end === expn.end;
}
while (true) {
expn = RefactoringUtils.findSurroundExpression(ast, {start: s, end: e});
if (!expn) {
break;
}
e = expn.end + 1;
// if expn already added, continue
if (expns.find(checkExpnEquality)) {
continue;
}
expns.push(expn);
}
return expns;
} | [
"function",
"getExpressions",
"(",
"ast",
",",
"start",
",",
"end",
")",
"{",
"var",
"expns",
"=",
"[",
"]",
",",
"s",
"=",
"start",
",",
"e",
"=",
"end",
",",
"expn",
";",
"while",
"(",
"true",
")",
"{",
"expn",
"=",
"RefactoringUtils",
".",
"fi... | Gets the surrounding expressions of start and end offset
@param {!ASTNode} ast - the ast of the complete file
@param {!number} start - the start offset
@param {!number} end - the end offset
@return {!Array.<ASTNode>} | [
"Gets",
"the",
"surrounding",
"expressions",
"of",
"start",
"and",
"end",
"offset"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/JavaScriptRefactoring/ExtractToVariable.js#L129-L167 | train | Get an array of expressions from the AST | [
30522,
3853,
2131,
10288,
20110,
8496,
1006,
2004,
2102,
1010,
2707,
1010,
2203,
1007,
1063,
13075,
4654,
2361,
3619,
1027,
1031,
1033,
1010,
1055,
1027,
2707,
1010,
1041,
1027,
2203,
1010,
4654,
2361,
2078,
1025,
2096,
1006,
2995,
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... |
angular/protractor | website/docgen/processors/add-links.js | function(param) {
var str = param.typeExpression;
var type = param.type;
if (!type) {
return escape(str);
}
var replaceWithLinkIfPresent = function(type) {
if (type.name) {
str = str.replace(type.name, toMarkdownLinkFormat(type.name));
}
};
if (type.type === 'FunctionType') {
_.each(type.params, replaceWithLinkIfPresent);
} else if (type.type === 'TypeApplication') {
// Is this an Array.<type>?
var match = str.match(/Array\.<(.*)>/);
if (match) {
var typeInsideArray = match[1];
str = str.replace(typeInsideArray, toMarkdownLinkFormat(typeInsideArray));
}
} else if (type.type === 'NameExpression') {
replaceWithLinkIfPresent(type);
}
return escape(str);
} | javascript | function(param) {
var str = param.typeExpression;
var type = param.type;
if (!type) {
return escape(str);
}
var replaceWithLinkIfPresent = function(type) {
if (type.name) {
str = str.replace(type.name, toMarkdownLinkFormat(type.name));
}
};
if (type.type === 'FunctionType') {
_.each(type.params, replaceWithLinkIfPresent);
} else if (type.type === 'TypeApplication') {
// Is this an Array.<type>?
var match = str.match(/Array\.<(.*)>/);
if (match) {
var typeInsideArray = match[1];
str = str.replace(typeInsideArray, toMarkdownLinkFormat(typeInsideArray));
}
} else if (type.type === 'NameExpression') {
replaceWithLinkIfPresent(type);
}
return escape(str);
} | [
"function",
"(",
"param",
")",
"{",
"var",
"str",
"=",
"param",
".",
"typeExpression",
";",
"var",
"type",
"=",
"param",
".",
"type",
";",
"if",
"(",
"!",
"type",
")",
"{",
"return",
"escape",
"(",
"str",
")",
";",
"}",
"var",
"replaceWithLinkIfPrese... | Create the param or return type.
@param {!Object} param Parameter.
@return {string} Escaped param string with links to the types. | [
"Create",
"the",
"param",
"or",
"return",
"type",
"."
] | 4f74a4ec753c97adfe955fe468a39286a0a55837 | https://github.com/angular/protractor/blob/4f74a4ec753c97adfe955fe468a39286a0a55837/website/docgen/processors/add-links.js#L128-L155 | train | Returns the type of the param | [
30522,
3853,
1006,
11498,
2213,
1007,
1063,
13075,
2358,
2099,
1027,
11498,
2213,
1012,
2828,
10288,
20110,
3258,
1025,
13075,
2828,
1027,
11498,
2213,
1012,
2828,
1025,
2065,
1006,
999,
2828,
1007,
1063,
2709,
4019,
1006,
2358,
2099,
1007,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
apache/incubator-echarts | src/chart/line/poly.js | drawMono | function drawMono(
ctx, points, start, segLen, allLen,
dir, smoothMin, smoothMax, smooth, smoothMonotone, connectNulls
) {
var prevIdx = 0;
var idx = start;
for (var k = 0; k < segLen; k++) {
var p = points[idx];
if (idx >= allLen || idx < 0) {
break;
}
if (isPointNull(p)) {
if (connectNulls) {
idx += dir;
continue;
}
break;
}
if (idx === start) {
ctx[dir > 0 ? 'moveTo' : 'lineTo'](p[0], p[1]);
}
else {
if (smooth > 0) {
var prevP = points[prevIdx];
var dim = smoothMonotone === 'y' ? 1 : 0;
// Length of control point to p, either in x or y, but not both
var ctrlLen = (p[dim] - prevP[dim]) * smooth;
v2Copy(cp0, prevP);
cp0[dim] = prevP[dim] + ctrlLen;
v2Copy(cp1, p);
cp1[dim] = p[dim] - ctrlLen;
ctx.bezierCurveTo(
cp0[0], cp0[1],
cp1[0], cp1[1],
p[0], p[1]
);
}
else {
ctx.lineTo(p[0], p[1]);
}
}
prevIdx = idx;
idx += dir;
}
return k;
} | javascript | function drawMono(
ctx, points, start, segLen, allLen,
dir, smoothMin, smoothMax, smooth, smoothMonotone, connectNulls
) {
var prevIdx = 0;
var idx = start;
for (var k = 0; k < segLen; k++) {
var p = points[idx];
if (idx >= allLen || idx < 0) {
break;
}
if (isPointNull(p)) {
if (connectNulls) {
idx += dir;
continue;
}
break;
}
if (idx === start) {
ctx[dir > 0 ? 'moveTo' : 'lineTo'](p[0], p[1]);
}
else {
if (smooth > 0) {
var prevP = points[prevIdx];
var dim = smoothMonotone === 'y' ? 1 : 0;
// Length of control point to p, either in x or y, but not both
var ctrlLen = (p[dim] - prevP[dim]) * smooth;
v2Copy(cp0, prevP);
cp0[dim] = prevP[dim] + ctrlLen;
v2Copy(cp1, p);
cp1[dim] = p[dim] - ctrlLen;
ctx.bezierCurveTo(
cp0[0], cp0[1],
cp1[0], cp1[1],
p[0], p[1]
);
}
else {
ctx.lineTo(p[0], p[1]);
}
}
prevIdx = idx;
idx += dir;
}
return k;
} | [
"function",
"drawMono",
"(",
"ctx",
",",
"points",
",",
"start",
",",
"segLen",
",",
"allLen",
",",
"dir",
",",
"smoothMin",
",",
"smoothMax",
",",
"smooth",
",",
"smoothMonotone",
",",
"connectNulls",
")",
"{",
"var",
"prevIdx",
"=",
"0",
";",
"var",
... | var dim = smoothMonotone === 'x' ? 0 : 1; var last = points[0][dim]; var lastDiff = 0; for (var i = 1; i < points.length; ++i) { var diff = points[i][dim] - last; if (!isNaN(diff) && !isNaN(lastDiff) && diff !== 0 && lastDiff !== 0 && ((diff >= 0) !== (lastDiff >= 0)) ) { return false; } if (!isNaN(diff) && diff !== 0) { lastDiff = diff; last = points[i][dim]; } } return true; }
Draw smoothed line in monotone, in which only vertical or horizontal bezier
control points will be used. This should be used when points are monotone
either in x or y dimension. | [
"var",
"dim",
"=",
"smoothMonotone",
"===",
"x",
"?",
"0",
":",
"1",
";",
"var",
"last",
"=",
"points",
"[",
"0",
"]",
"[",
"dim",
"]",
";",
"var",
"lastDiff",
"=",
"0",
";",
"for",
"(",
"var",
"i",
"=",
"1",
";",
"i",
"<",
"points",
".",
"... | 4d0ea095dc3929cb6de40c45748826e7999c7aa8 | https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/chart/line/poly.js#L112-L164 | train | Draws a monotone line | [
30522,
3853,
4009,
8202,
2080,
1006,
14931,
2595,
1010,
2685,
1010,
2707,
1010,
7367,
9354,
2078,
1010,
2035,
7770,
1010,
16101,
1010,
5744,
10020,
1010,
5744,
17848,
1010,
5744,
1010,
5744,
8202,
25862,
2063,
1010,
7532,
11231,
12718,
1007... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.table/src/sap/ui/table/TableAccRenderExtension.js | function(oRm, oTable, oRow, iRowIndex) {
if (!oTable._getAccExtension().getAccMode()) {
return;
}
var bIsSelected = oTable.isIndexSelected(iRowIndex);
var mTooltipTexts = oTable._getAccExtension().getAriaTextsForSelectionMode(true);
var sText = mTooltipTexts.keyboard[bIsSelected ? "rowDeselect" : "rowSelect"];
_writeAccText(oRm, oRow.getId(), "rowselecttext", oRow._bHidden ? "" : sText, ["sapUiTableAriaRowSel"]);
} | javascript | function(oRm, oTable, oRow, iRowIndex) {
if (!oTable._getAccExtension().getAccMode()) {
return;
}
var bIsSelected = oTable.isIndexSelected(iRowIndex);
var mTooltipTexts = oTable._getAccExtension().getAriaTextsForSelectionMode(true);
var sText = mTooltipTexts.keyboard[bIsSelected ? "rowDeselect" : "rowSelect"];
_writeAccText(oRm, oRow.getId(), "rowselecttext", oRow._bHidden ? "" : sText, ["sapUiTableAriaRowSel"]);
} | [
"function",
"(",
"oRm",
",",
"oTable",
",",
"oRow",
",",
"iRowIndex",
")",
"{",
"if",
"(",
"!",
"oTable",
".",
"_getAccExtension",
"(",
")",
".",
"getAccMode",
"(",
")",
")",
"{",
"return",
";",
"}",
"var",
"bIsSelected",
"=",
"oTable",
".",
"isIndex... | Renders the default row selector content.
@param {sap.ui.core.RenderManager} oRm The RenderManager that can be used for writing to the Render-Output-Buffer.
@param {sap.ui.table.Table} oTable Instance of the table.
@param {sap.ui.table.Row} oRow Instance of the row.
@param {int} iRowIndex The index of the row.
@see sap.ui.table.TableRenderer.writeRowSelectorContent
@public | [
"Renders",
"the",
"default",
"row",
"selector",
"content",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableAccRenderExtension.js#L181-L191 | train | Renders the row select text. | [
30522,
3853,
1006,
2030,
2213,
1010,
27178,
3085,
1010,
20298,
2860,
1010,
20868,
5004,
22254,
10288,
1007,
1063,
2065,
1006,
999,
27178,
3085,
1012,
1035,
2131,
6305,
3401,
18413,
6132,
3258,
1006,
1007,
1012,
2131,
6305,
27487,
10244,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | src/sap.ui.core/src/sap/ui/model/odata/AnnotationHelper.js | function (oInterface, vRawValue) {
if (arguments.length === 1) {
vRawValue = oInterface.getObject("");
}
return Expression.getExpression(oInterface, vRawValue, false);
} | javascript | function (oInterface, vRawValue) {
if (arguments.length === 1) {
vRawValue = oInterface.getObject("");
}
return Expression.getExpression(oInterface, vRawValue, false);
} | [
"function",
"(",
"oInterface",
",",
"vRawValue",
")",
"{",
"if",
"(",
"arguments",
".",
"length",
"===",
"1",
")",
"{",
"vRawValue",
"=",
"oInterface",
".",
"getObject",
"(",
"\"\"",
")",
";",
"}",
"return",
"Expression",
".",
"getExpression",
"(",
"oInt... | Formatter function that is used in a complex binding inside an XML template view.
The function is used to interpret OData V4 annotations, supporting the same
annotations as {@link #.format format} but with a simplified output aimed at
design-time templating with smart controls.
In contrast to <code>format</code>, "14.5.12 Expression edm:Path" or
"14.5.13 Expression edm:PropertyPath" is turned into a simple binding path without
type or constraint information. In certain cases, a complex binding is required to
allow for proper escaping of the path.
Example:
<pre>
<sfi:SmartField value="{path: 'meta>Value', formatter: 'sap.ui.model.odata.AnnotationHelper.simplePath'}"/>
</pre>
@param {sap.ui.core.util.XMLPreprocessor.IContext|sap.ui.model.Context} oInterface
the callback interface related to the current formatter call
@param {any} [vRawValue]
the raw value from the meta model, which is embedded within an entity set or
entity type:
<ul>
<li>if this function is used as formatter the value
is provided by the framework</li>
<li>if this function is called directly, provide the parameter only if it is
already calculated</li>
<li>if the parameter is omitted, it is calculated automatically through
<code>oInterface.getObject("")</code></li>
</ul>
@returns {string}
the resulting string value to write into the processed XML
@public | [
"Formatter",
"function",
"that",
"is",
"used",
"in",
"a",
"complex",
"binding",
"inside",
"an",
"XML",
"template",
"view",
".",
"The",
"function",
"is",
"used",
"to",
"interpret",
"OData",
"V4",
"annotations",
"supporting",
"the",
"same",
"annotations",
"as",
... | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/AnnotationHelper.js#L601-L606 | train | Returns the expression for the given interface. | [
30522,
3853,
1006,
1051,
18447,
2121,
12172,
1010,
27830,
10376,
10175,
5657,
1007,
1063,
2065,
1006,
9918,
1012,
3091,
1027,
1027,
1027,
1015,
1007,
1063,
27830,
10376,
10175,
5657,
1027,
1051,
18447,
2121,
12172,
1012,
2131,
16429,
20614,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
eslint/eslint | lib/rules/space-infix-ops.js | report | function report(mainNode, culpritToken) {
context.report({
node: mainNode,
loc: culpritToken.loc.start,
message: "Operator '{{operator}}' must be spaced.",
data: {
operator: culpritToken.value
},
fix(fixer) {
const previousToken = sourceCode.getTokenBefore(culpritToken);
const afterToken = sourceCode.getTokenAfter(culpritToken);
let fixString = "";
if (culpritToken.range[0] - previousToken.range[1] === 0) {
fixString = " ";
}
fixString += culpritToken.value;
if (afterToken.range[0] - culpritToken.range[1] === 0) {
fixString += " ";
}
return fixer.replaceText(culpritToken, fixString);
}
});
} | javascript | function report(mainNode, culpritToken) {
context.report({
node: mainNode,
loc: culpritToken.loc.start,
message: "Operator '{{operator}}' must be spaced.",
data: {
operator: culpritToken.value
},
fix(fixer) {
const previousToken = sourceCode.getTokenBefore(culpritToken);
const afterToken = sourceCode.getTokenAfter(culpritToken);
let fixString = "";
if (culpritToken.range[0] - previousToken.range[1] === 0) {
fixString = " ";
}
fixString += culpritToken.value;
if (afterToken.range[0] - culpritToken.range[1] === 0) {
fixString += " ";
}
return fixer.replaceText(culpritToken, fixString);
}
});
} | [
"function",
"report",
"(",
"mainNode",
",",
"culpritToken",
")",
"{",
"context",
".",
"report",
"(",
"{",
"node",
":",
"mainNode",
",",
"loc",
":",
"culpritToken",
".",
"loc",
".",
"start",
",",
"message",
":",
"\"Operator '{{operator}}' must be spaced.\"",
",... | Reports an AST node as a rule violation
@param {ASTNode} mainNode - The node to report
@param {Object} culpritToken - The token which has a problem
@returns {void}
@private | [
"Reports",
"an",
"AST",
"node",
"as",
"a",
"rule",
"violation"
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/space-infix-ops.js#L69-L95 | train | Reports a given culprit token. | [
30522,
3853,
3189,
1006,
2364,
3630,
3207,
1010,
12731,
14277,
14778,
18715,
2368,
1007,
1063,
6123,
1012,
3189,
1006,
1063,
13045,
1024,
2364,
3630,
3207,
1010,
8840,
2278,
1024,
12731,
14277,
14778,
18715,
2368,
1012,
8840,
2278,
1012,
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/model/odata/v4/lib/_Helper.js | function (sPrefix, aPaths) {
var sPathPrefix = sPrefix + "/";
if (sPrefix === "") {
return aPaths;
}
return aPaths.filter(function (sPath) {
return sPath === sPrefix || sPath.startsWith(sPathPrefix);
}).map(function (sPath) {
return sPath.slice(sPathPrefix.length);
});
} | javascript | function (sPrefix, aPaths) {
var sPathPrefix = sPrefix + "/";
if (sPrefix === "") {
return aPaths;
}
return aPaths.filter(function (sPath) {
return sPath === sPrefix || sPath.startsWith(sPathPrefix);
}).map(function (sPath) {
return sPath.slice(sPathPrefix.length);
});
} | [
"function",
"(",
"sPrefix",
",",
"aPaths",
")",
"{",
"var",
"sPathPrefix",
"=",
"sPrefix",
"+",
"\"/\"",
";",
"if",
"(",
"sPrefix",
"===",
"\"\"",
")",
"{",
"return",
"aPaths",
";",
"}",
"return",
"aPaths",
".",
"filter",
"(",
"function",
"(",
"sPath",... | Strips the given prefix from all given paths. If a path does not start with the prefix,
it is ignored (note that "A" is not a path prefix of "AA", but of "A/A").
A remainder never starts with a slash and may well be empty.
@param {string} sPrefix
A prefix (which must not end with a slash); "" is a path prefix of each path
@param {string[]} aPaths
A list of paths
@returns {string[]}
The list of remainders for all paths which start with the given prefix | [
"Strips",
"the",
"given",
"prefix",
"from",
"all",
"given",
"paths",
".",
"If",
"a",
"path",
"does",
"not",
"start",
"with",
"the",
"prefix",
"it",
"is",
"ignored",
"(",
"note",
"that",
"A",
"is",
"not",
"a",
"path",
"prefix",
"of",
"AA",
"but",
"of"... | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Helper.js#L1071-L1083 | train | Returns an array of paths that are not prefixed with the given prefix | [
30522,
3853,
1006,
11867,
2890,
8873,
2595,
1010,
9706,
8988,
2015,
1007,
1063,
13075,
14690,
22269,
2890,
8873,
2595,
1027,
11867,
2890,
8873,
2595,
1009,
1000,
1013,
1000,
1025,
2065,
1006,
11867,
2890,
8873,
2595,
1027,
1027,
1027,
1000,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | src/sap.ui.table/src/sap/ui/table/TableMenuUtils.js | function(oTable, oCellInfo, bHoverFirstMenuItem, oEvent) {
if (!oTable ||
!oCellInfo ||
!oCellInfo.isOfType(MenuUtils.TableUtils.CELLTYPE.ANYCONTENTCELL) ||
oCellInfo.rowIndex >= MenuUtils.TableUtils.getNonEmptyVisibleRowCount(oTable)) {
return;
}
bHoverFirstMenuItem = bHoverFirstMenuItem === true;
// Custom Context Menu
if (MenuUtils.hasContextMenu(oTable)) {
if (!MenuUtils.TableUtils.Grouping.isInSumRow(oCellInfo.cell)
&& !MenuUtils.TableUtils.Grouping.isInGroupingRow(oCellInfo.cell)) {
oTable.getContextMenu().openAsContextMenu(oEvent, oCellInfo.cell);
}
return;
}
var iRowIndex = oCellInfo.rowIndex;
var oRow = oTable.getRows()[iRowIndex];
var iColumnIndex = oCellInfo.columnIndex;
var aColumns = oTable.getColumns();
var oColumn = aColumns[iColumnIndex];
if (!oColumn || !oColumn.getVisible()) {
return;
}
// Cell Filter Menu
if (oTable.getEnableCellFilter() && oColumn && oColumn.isFilterableByMenu()) {
// Create the menu instance the first time it is needed.
if (!oTable._oCellContextMenu) {
oTable._oCellContextMenu = new Menu(oTable.getId() + "-cellcontextmenu");
var oCellContextMenuItem = new MenuItem({
text: MenuUtils.TableUtils.getResourceText("TBL_FILTER")
});
oCellContextMenuItem._onSelect = function(oColumn, iRowIndex) {
// "this" is the table instance.
var oRowContext = this.getContextByIndex(iRowIndex);
var sFilterProperty = oColumn.getFilterProperty();
var sFilterValue = oRowContext.getProperty(sFilterProperty);
if (this.getEnableCustomFilter()) {
this.fireCustomFilter({
column: oColumn,
value: sFilterValue
});
} else {
this.filter(oColumn, sFilterValue);
}
};
oCellContextMenuItem.attachSelect(oCellContextMenuItem._onSelect.bind(oTable, oColumn, oRow.getIndex()));
oTable._oCellContextMenu.addItem(oCellContextMenuItem);
oTable.addDependent(oTable._oCellContextMenu);
// If the menu already was created, only update the menu item.
} else {
var oMenuItem = oTable._oCellContextMenu.getItems()[0];
oMenuItem.mEventRegistry.select[0].fFunction = oMenuItem._onSelect.bind(oTable, oColumn, oRow.getIndex());
}
// Open the menu below the cell if is is not already open.
if (!MenuUtils.TableUtils.Grouping.isInGroupingRow(oCellInfo.cell)) {
var oCell = oCellInfo.cell[0];
var bMenuOpenAtAnotherDataCell = oTable._oCellContextMenu.bOpen && oTable._oCellContextMenu.oOpenerRef !== oCell;
if (bMenuOpenAtAnotherDataCell) {
MenuUtils.closeDataCellContextMenu(oTable);
}
for (var i = 0; i < aColumns.length; i++) {
MenuUtils.closeColumnContextMenu(oTable, i);
}
oTable._oCellContextMenu.open(bHoverFirstMenuItem, oCell, Popup.Dock.BeginTop, Popup.Dock.BeginBottom, oCell);
}
}
} | javascript | function(oTable, oCellInfo, bHoverFirstMenuItem, oEvent) {
if (!oTable ||
!oCellInfo ||
!oCellInfo.isOfType(MenuUtils.TableUtils.CELLTYPE.ANYCONTENTCELL) ||
oCellInfo.rowIndex >= MenuUtils.TableUtils.getNonEmptyVisibleRowCount(oTable)) {
return;
}
bHoverFirstMenuItem = bHoverFirstMenuItem === true;
// Custom Context Menu
if (MenuUtils.hasContextMenu(oTable)) {
if (!MenuUtils.TableUtils.Grouping.isInSumRow(oCellInfo.cell)
&& !MenuUtils.TableUtils.Grouping.isInGroupingRow(oCellInfo.cell)) {
oTable.getContextMenu().openAsContextMenu(oEvent, oCellInfo.cell);
}
return;
}
var iRowIndex = oCellInfo.rowIndex;
var oRow = oTable.getRows()[iRowIndex];
var iColumnIndex = oCellInfo.columnIndex;
var aColumns = oTable.getColumns();
var oColumn = aColumns[iColumnIndex];
if (!oColumn || !oColumn.getVisible()) {
return;
}
// Cell Filter Menu
if (oTable.getEnableCellFilter() && oColumn && oColumn.isFilterableByMenu()) {
// Create the menu instance the first time it is needed.
if (!oTable._oCellContextMenu) {
oTable._oCellContextMenu = new Menu(oTable.getId() + "-cellcontextmenu");
var oCellContextMenuItem = new MenuItem({
text: MenuUtils.TableUtils.getResourceText("TBL_FILTER")
});
oCellContextMenuItem._onSelect = function(oColumn, iRowIndex) {
// "this" is the table instance.
var oRowContext = this.getContextByIndex(iRowIndex);
var sFilterProperty = oColumn.getFilterProperty();
var sFilterValue = oRowContext.getProperty(sFilterProperty);
if (this.getEnableCustomFilter()) {
this.fireCustomFilter({
column: oColumn,
value: sFilterValue
});
} else {
this.filter(oColumn, sFilterValue);
}
};
oCellContextMenuItem.attachSelect(oCellContextMenuItem._onSelect.bind(oTable, oColumn, oRow.getIndex()));
oTable._oCellContextMenu.addItem(oCellContextMenuItem);
oTable.addDependent(oTable._oCellContextMenu);
// If the menu already was created, only update the menu item.
} else {
var oMenuItem = oTable._oCellContextMenu.getItems()[0];
oMenuItem.mEventRegistry.select[0].fFunction = oMenuItem._onSelect.bind(oTable, oColumn, oRow.getIndex());
}
// Open the menu below the cell if is is not already open.
if (!MenuUtils.TableUtils.Grouping.isInGroupingRow(oCellInfo.cell)) {
var oCell = oCellInfo.cell[0];
var bMenuOpenAtAnotherDataCell = oTable._oCellContextMenu.bOpen && oTable._oCellContextMenu.oOpenerRef !== oCell;
if (bMenuOpenAtAnotherDataCell) {
MenuUtils.closeDataCellContextMenu(oTable);
}
for (var i = 0; i < aColumns.length; i++) {
MenuUtils.closeColumnContextMenu(oTable, i);
}
oTable._oCellContextMenu.open(bHoverFirstMenuItem, oCell, Popup.Dock.BeginTop, Popup.Dock.BeginBottom, oCell);
}
}
} | [
"function",
"(",
"oTable",
",",
"oCellInfo",
",",
"bHoverFirstMenuItem",
",",
"oEvent",
")",
"{",
"if",
"(",
"!",
"oTable",
"||",
"!",
"oCellInfo",
"||",
"!",
"oCellInfo",
".",
"isOfType",
"(",
"MenuUtils",
".",
"TableUtils",
".",
"CELLTYPE",
".",
"ANYCONT... | Opens the context menu of a content cell.
If a context menu of another cell is open, it will be closed.
@param {sap.ui.table.Table} oTable Instance of the table.
@param {sap.ui.table.TableUtils.CellInfo} oCellInfo An object containing information about the cell.
@param {boolean} [bHoverFirstMenuItem=false] If <code>true</code>, the first item in the opened menu will be hovered.
@param {jQuery.Event} oEvent event object
@see openContextMenu
@see closeDataCellContextMenu
@private | [
"Opens",
"the",
"context",
"menu",
"of",
"a",
"content",
"cell",
".",
"If",
"a",
"context",
"menu",
"of",
"another",
"cell",
"is",
"open",
"it",
"will",
"be",
"closed",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableMenuUtils.js#L221-L302 | train | Creates a cell context menu. | [
30522,
3853,
1006,
27178,
3085,
1010,
1051,
29109,
4115,
14876,
1010,
1038,
6806,
6299,
8873,
12096,
3549,
14663,
6633,
1010,
1051,
18697,
3372,
1007,
1063,
2065,
1006,
999,
27178,
3085,
1064,
1064,
999,
1051,
29109,
4115,
14876,
1064,
1064... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
adobe/brackets | src/document/DocumentCommandHandlers.js | createWithSuggestedName | function createWithSuggestedName(suggestedName) {
return ProjectManager.createNewItem(baseDirEntry, suggestedName, false, isFolder)
.always(function () { fileNewInProgress = false; });
} | javascript | function createWithSuggestedName(suggestedName) {
return ProjectManager.createNewItem(baseDirEntry, suggestedName, false, isFolder)
.always(function () { fileNewInProgress = false; });
} | [
"function",
"createWithSuggestedName",
"(",
"suggestedName",
")",
"{",
"return",
"ProjectManager",
".",
"createNewItem",
"(",
"baseDirEntry",
",",
"suggestedName",
",",
"false",
",",
"isFolder",
")",
".",
"always",
"(",
"function",
"(",
")",
"{",
"fileNewInProgres... | Create the new node. The createNewItem function does all the heavy work of validating file name, creating the new file and selecting. | [
"Create",
"the",
"new",
"node",
".",
"The",
"createNewItem",
"function",
"does",
"all",
"the",
"heavy",
"work",
"of",
"validating",
"file",
"name",
"creating",
"the",
"new",
"file",
"and",
"selecting",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/document/DocumentCommandHandlers.js#L669-L672 | train | Creates a new file with the given suggested name | [
30522,
3853,
3443,
24415,
6342,
13871,
17944,
18442,
1006,
4081,
18442,
1007,
1063,
2709,
2622,
24805,
4590,
1012,
3443,
2638,
9148,
18532,
1006,
2241,
7442,
3372,
2854,
1010,
4081,
18442,
1010,
6270,
1010,
2003,
10371,
2121,
1007,
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... |
SAP/openui5 | src/sap.ui.unified/src/sap/ui/unified/CalendarTimeInterval.js | _handleSelectMonth | function _handleSelectMonth(oEvent){
var oFocusedDate = new UniversalDate(this._getFocusedDate().getTime());
var oMonthPicker = this.getAggregation("monthPicker");
var iMonth = oMonthPicker.getMonth();
oFocusedDate.setUTCMonth(iMonth);
if (iMonth != oFocusedDate.getUTCMonth() ) {
// day did not exist in this month (e.g. 31) -> go to last day of month
oFocusedDate.setUTCDate(0);
}
_focusDate.call(this, oFocusedDate, true);
_hideMonthPicker.call(this);
} | javascript | function _handleSelectMonth(oEvent){
var oFocusedDate = new UniversalDate(this._getFocusedDate().getTime());
var oMonthPicker = this.getAggregation("monthPicker");
var iMonth = oMonthPicker.getMonth();
oFocusedDate.setUTCMonth(iMonth);
if (iMonth != oFocusedDate.getUTCMonth() ) {
// day did not exist in this month (e.g. 31) -> go to last day of month
oFocusedDate.setUTCDate(0);
}
_focusDate.call(this, oFocusedDate, true);
_hideMonthPicker.call(this);
} | [
"function",
"_handleSelectMonth",
"(",
"oEvent",
")",
"{",
"var",
"oFocusedDate",
"=",
"new",
"UniversalDate",
"(",
"this",
".",
"_getFocusedDate",
"(",
")",
".",
"getTime",
"(",
")",
")",
";",
"var",
"oMonthPicker",
"=",
"this",
".",
"getAggregation",
"(",
... | Handles user selection of a month from the Month Picker.
This function assumes there is a "monthPicker" aggregation.
So callers must take care.
@return {void}
@private | [
"Handles",
"user",
"selection",
"of",
"a",
"month",
"from",
"the",
"Month",
"Picker",
".",
"This",
"function",
"assumes",
"there",
"is",
"a",
"monthPicker",
"aggregation",
".",
"So",
"callers",
"must",
"take",
"care",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.unified/src/sap/ui/unified/CalendarTimeInterval.js#L1927-L1944 | train | Handles the select month event | [
30522,
3853,
1035,
16024,
12260,
6593,
9629,
2232,
1006,
1051,
18697,
3372,
1007,
1063,
13075,
1997,
10085,
13901,
13701,
1027,
2047,
5415,
13701,
1006,
2023,
1012,
1035,
2131,
14876,
7874,
22367,
3686,
1006,
1007,
1012,
2131,
7292,
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... |
heyui/heyui | src/plugins/popper/index.js | updateModifiers | function updateModifiers() {
if (this.state.isDestroyed) {
return;
}
// Deep merge modifiers options
let options = this.defaultOptions;
this.options.modifiers = {};
const _this = this;
Object.keys(_extends({}, Popper.Defaults.modifiers, options.modifiers)).forEach(function (name) {
_this.options.modifiers[name] = _extends({}, Popper.Defaults.modifiers[name] || {}, options.modifiers ? options.modifiers[name] : {});
});
// Refactoring modifiers' list (Object => Array)
this.modifiers = Object.keys(this.options.modifiers).map(function (name) {
return _extends({
name: name
}, _this.options.modifiers[name]);
})
// sort the modifiers by order
.sort(function (a, b) {
return a.order - b.order;
});
// modifiers have the ability to execute arbitrary code when Popper.js get inited
// such code is executed in the same order of its modifier
// they could add new properties to their options configuration
// BE AWARE: don't add options to `options.modifiers.name` but to `modifierOptions`!
this.modifiers.forEach(function (modifierOptions) {
if (modifierOptions.enabled && isFunction(modifierOptions.onLoad)) {
modifierOptions.onLoad(_this.reference, _this.popper, _this.options, modifierOptions, _this.state);
}
});
} | javascript | function updateModifiers() {
if (this.state.isDestroyed) {
return;
}
// Deep merge modifiers options
let options = this.defaultOptions;
this.options.modifiers = {};
const _this = this;
Object.keys(_extends({}, Popper.Defaults.modifiers, options.modifiers)).forEach(function (name) {
_this.options.modifiers[name] = _extends({}, Popper.Defaults.modifiers[name] || {}, options.modifiers ? options.modifiers[name] : {});
});
// Refactoring modifiers' list (Object => Array)
this.modifiers = Object.keys(this.options.modifiers).map(function (name) {
return _extends({
name: name
}, _this.options.modifiers[name]);
})
// sort the modifiers by order
.sort(function (a, b) {
return a.order - b.order;
});
// modifiers have the ability to execute arbitrary code when Popper.js get inited
// such code is executed in the same order of its modifier
// they could add new properties to their options configuration
// BE AWARE: don't add options to `options.modifiers.name` but to `modifierOptions`!
this.modifiers.forEach(function (modifierOptions) {
if (modifierOptions.enabled && isFunction(modifierOptions.onLoad)) {
modifierOptions.onLoad(_this.reference, _this.popper, _this.options, modifierOptions, _this.state);
}
});
} | [
"function",
"updateModifiers",
"(",
")",
"{",
"if",
"(",
"this",
".",
"state",
".",
"isDestroyed",
")",
"{",
"return",
";",
"}",
"// Deep merge modifiers options",
"let",
"options",
"=",
"this",
".",
"defaultOptions",
";",
"this",
".",
"options",
".",
"modif... | Updates the options of Popper
@method
@memberof Popper | [
"Updates",
"the",
"options",
"of",
"Popper"
] | d5405d27d994151b676eb91c12b389316d7f6679 | https://github.com/heyui/heyui/blob/d5405d27d994151b676eb91c12b389316d7f6679/src/plugins/popper/index.js#L910-L942 | train | Updates the modifiers of the current container | [
30522,
3853,
10651,
5302,
4305,
8873,
2545,
1006,
1007,
1063,
2065,
1006,
2023,
1012,
2110,
1012,
2003,
6155,
13181,
20821,
1007,
1063,
2709,
1025,
1065,
1013,
1013,
2784,
13590,
16913,
28295,
7047,
2292,
7047,
1027,
2023,
1012,
12398,
7361... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/_Requestor.js | rejectAll | function rejectAll(aRequests) {
aRequests.forEach(function (vRequest) {
if (Array.isArray(vRequest)) {
rejectAll(vRequest);
} else {
vRequest.$reject(oRequestError);
}
});
} | javascript | function rejectAll(aRequests) {
aRequests.forEach(function (vRequest) {
if (Array.isArray(vRequest)) {
rejectAll(vRequest);
} else {
vRequest.$reject(oRequestError);
}
});
} | [
"function",
"rejectAll",
"(",
"aRequests",
")",
"{",
"aRequests",
".",
"forEach",
"(",
"function",
"(",
"vRequest",
")",
"{",
"if",
"(",
"Array",
".",
"isArray",
"(",
"vRequest",
")",
")",
"{",
"rejectAll",
"(",
"vRequest",
")",
";",
"}",
"else",
"{",
... | /*
Rejects all given requests (recursively) with <code>oRequestError</code>.
@param {object[]} aRequests | [
"/",
"*",
"Rejects",
"all",
"given",
"requests",
"(",
"recursively",
")",
"with",
"<code",
">",
"oRequestError<",
"/",
"code",
">",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Requestor.js#L1414-L1422 | train | reject all requests | [
30522,
3853,
15454,
8095,
1006,
2024,
15500,
2015,
1007,
1063,
2024,
15500,
2015,
1012,
18921,
6776,
1006,
3853,
1006,
27830,
2063,
15500,
1007,
1063,
2065,
1006,
9140,
1012,
18061,
11335,
2100,
1006,
27830,
2063,
15500,
1007,
1007,
1063,
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... |
apache/incubator-echarts | src/component/helper/BrushController.js | getPanelByCover | function getPanelByCover(controller, cover) {
var panels = controller._panels;
if (!panels) {
return true; // Global panel
}
var panelId = cover.__brushOption.panelId;
// User may give cover without coord sys info,
// which is then treated as global panel.
return panelId != null ? panels[panelId] : true;
} | javascript | function getPanelByCover(controller, cover) {
var panels = controller._panels;
if (!panels) {
return true; // Global panel
}
var panelId = cover.__brushOption.panelId;
// User may give cover without coord sys info,
// which is then treated as global panel.
return panelId != null ? panels[panelId] : true;
} | [
"function",
"getPanelByCover",
"(",
"controller",
",",
"cover",
")",
"{",
"var",
"panels",
"=",
"controller",
".",
"_panels",
";",
"if",
"(",
"!",
"panels",
")",
"{",
"return",
"true",
";",
"// Global panel",
"}",
"var",
"panelId",
"=",
"cover",
".",
"__... | Return a panel or true | [
"Return",
"a",
"panel",
"or",
"true"
] | 4d0ea095dc3929cb6de40c45748826e7999c7aa8 | https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/component/helper/BrushController.js#L456-L465 | train | Get the panel object from the controller | [
30522,
3853,
2131,
9739,
2884,
3762,
3597,
6299,
1006,
11486,
1010,
3104,
1007,
1063,
13075,
9320,
1027,
11486,
1012,
1035,
9320,
1025,
2065,
1006,
999,
9320,
1007,
1063,
2709,
2995,
1025,
1013,
1013,
3795,
5997,
1065,
13075,
5997,
3593,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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-restricted-properties.js | checkDestructuringAssignment | function checkDestructuringAssignment(node) {
if (node.right.type === "Identifier") {
const objectName = node.right.name;
if (node.left.type === "ObjectPattern") {
node.left.properties.forEach(property => {
checkPropertyAccess(node.left, objectName, astUtils.getStaticPropertyName(property));
});
}
}
} | javascript | function checkDestructuringAssignment(node) {
if (node.right.type === "Identifier") {
const objectName = node.right.name;
if (node.left.type === "ObjectPattern") {
node.left.properties.forEach(property => {
checkPropertyAccess(node.left, objectName, astUtils.getStaticPropertyName(property));
});
}
}
} | [
"function",
"checkDestructuringAssignment",
"(",
"node",
")",
"{",
"if",
"(",
"node",
".",
"right",
".",
"type",
"===",
"\"Identifier\"",
")",
"{",
"const",
"objectName",
"=",
"node",
".",
"right",
".",
"name",
";",
"if",
"(",
"node",
".",
"left",
".",
... | Checks property accesses in a destructuring assignment expression, e.g. `var foo; ({foo} = bar);`
@param {ASTNode} node An AssignmentExpression or AssignmentPattern node
@returns {undefined} | [
"Checks",
"property",
"accesses",
"in",
"a",
"destructuring",
"assignment",
"expression",
"e",
".",
"g",
".",
"var",
"foo",
";",
"(",
"{",
"foo",
"}",
"=",
"bar",
")",
";"
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/no-restricted-properties.js#L145-L155 | train | Check destructuring assignment | [
30522,
3853,
4638,
6155,
18300,
12228,
12054,
24838,
1006,
13045,
1007,
1063,
2065,
1006,
13045,
1012,
2157,
1012,
2828,
1027,
1027,
1027,
1000,
8909,
4765,
18095,
1000,
1007,
1063,
9530,
3367,
4874,
18442,
1027,
13045,
1012,
2157,
1012,
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... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/core/format/DateFormat.js | function(oDateValue, sCalendarType, bUTC, bStrict) {
var oDate,
iYear = typeof oDateValue.year === "number" ? oDateValue.year : 1970;
if (oDateValue.valid) {
if (bUTC || oDateValue.tzDiff !== undefined) {
oDate = UniversalDate.getInstance(new Date(0), sCalendarType);
oDate.setUTCEra(oDateValue.era || UniversalDate.getCurrentEra(sCalendarType));
oDate.setUTCFullYear(iYear);
oDate.setUTCMonth(oDateValue.month || 0);
oDate.setUTCDate(oDateValue.day || 1);
oDate.setUTCHours(oDateValue.hour || 0);
oDate.setUTCMinutes(oDateValue.minute || 0);
oDate.setUTCSeconds(oDateValue.second || 0);
oDate.setUTCMilliseconds(oDateValue.millisecond || 0);
if (bStrict && (oDateValue.day || 1) !== oDate.getUTCDate()) {
// check if valid date given - if invalid, day is not the same (31.Apr -> 1.May)
oDateValue.valid = false;
oDate = undefined;
} else {
if (oDateValue.tzDiff) {
// Set TZDiff after checking for valid day, as it may switch the day as well
oDate.setUTCMinutes((oDateValue.minute || 0) + oDateValue.tzDiff);
}
if (oDateValue.week !== undefined && (oDateValue.month === undefined || oDateValue.day === undefined)) {
//check that the week is only set if the day/month has not been set, because day/month have higher precedence than week
oDate.setUTCWeek({
year: oDateValue.weekYear || oDateValue.year,
week: oDateValue.week
});
//add the dayNumberOfWeek to the current day
if (oDateValue.dayNumberOfWeek !== undefined) {
oDate.setUTCDate(oDate.getUTCDate() + oDateValue.dayNumberOfWeek - 1);
}
}
}
} else {
oDate = UniversalDate.getInstance(new Date(1970, 0, 1, 0, 0, 0), sCalendarType);
oDate.setEra(oDateValue.era || UniversalDate.getCurrentEra(sCalendarType));
oDate.setFullYear(iYear);
oDate.setMonth(oDateValue.month || 0);
oDate.setDate(oDateValue.day || 1);
oDate.setHours(oDateValue.hour || 0);
oDate.setMinutes(oDateValue.minute || 0);
oDate.setSeconds(oDateValue.second || 0);
oDate.setMilliseconds(oDateValue.millisecond || 0);
if (bStrict && (oDateValue.day || 1) !== oDate.getDate()) {
// check if valid date given - if invalid, day is not the same (31.Apr -> 1.May)
oDateValue.valid = false;
oDate = undefined;
} else if (oDateValue.week !== undefined && (oDateValue.month === undefined || oDateValue.day === undefined)) {
//check that the week is only set if the day/month has not been set, because day/month have higher precedence than week
oDate.setWeek({
year: oDateValue.weekYear || oDateValue.year,
week: oDateValue.week
});
//add the dayNumberOfWeek to the current day
if (oDateValue.dayNumberOfWeek !== undefined) {
oDate.setDate(oDate.getDate() + oDateValue.dayNumberOfWeek - 1);
}
}
}
if (oDateValue.valid) {
oDate = oDate.getJSDate();
return oDate;
}
}
return null;
} | javascript | function(oDateValue, sCalendarType, bUTC, bStrict) {
var oDate,
iYear = typeof oDateValue.year === "number" ? oDateValue.year : 1970;
if (oDateValue.valid) {
if (bUTC || oDateValue.tzDiff !== undefined) {
oDate = UniversalDate.getInstance(new Date(0), sCalendarType);
oDate.setUTCEra(oDateValue.era || UniversalDate.getCurrentEra(sCalendarType));
oDate.setUTCFullYear(iYear);
oDate.setUTCMonth(oDateValue.month || 0);
oDate.setUTCDate(oDateValue.day || 1);
oDate.setUTCHours(oDateValue.hour || 0);
oDate.setUTCMinutes(oDateValue.minute || 0);
oDate.setUTCSeconds(oDateValue.second || 0);
oDate.setUTCMilliseconds(oDateValue.millisecond || 0);
if (bStrict && (oDateValue.day || 1) !== oDate.getUTCDate()) {
// check if valid date given - if invalid, day is not the same (31.Apr -> 1.May)
oDateValue.valid = false;
oDate = undefined;
} else {
if (oDateValue.tzDiff) {
// Set TZDiff after checking for valid day, as it may switch the day as well
oDate.setUTCMinutes((oDateValue.minute || 0) + oDateValue.tzDiff);
}
if (oDateValue.week !== undefined && (oDateValue.month === undefined || oDateValue.day === undefined)) {
//check that the week is only set if the day/month has not been set, because day/month have higher precedence than week
oDate.setUTCWeek({
year: oDateValue.weekYear || oDateValue.year,
week: oDateValue.week
});
//add the dayNumberOfWeek to the current day
if (oDateValue.dayNumberOfWeek !== undefined) {
oDate.setUTCDate(oDate.getUTCDate() + oDateValue.dayNumberOfWeek - 1);
}
}
}
} else {
oDate = UniversalDate.getInstance(new Date(1970, 0, 1, 0, 0, 0), sCalendarType);
oDate.setEra(oDateValue.era || UniversalDate.getCurrentEra(sCalendarType));
oDate.setFullYear(iYear);
oDate.setMonth(oDateValue.month || 0);
oDate.setDate(oDateValue.day || 1);
oDate.setHours(oDateValue.hour || 0);
oDate.setMinutes(oDateValue.minute || 0);
oDate.setSeconds(oDateValue.second || 0);
oDate.setMilliseconds(oDateValue.millisecond || 0);
if (bStrict && (oDateValue.day || 1) !== oDate.getDate()) {
// check if valid date given - if invalid, day is not the same (31.Apr -> 1.May)
oDateValue.valid = false;
oDate = undefined;
} else if (oDateValue.week !== undefined && (oDateValue.month === undefined || oDateValue.day === undefined)) {
//check that the week is only set if the day/month has not been set, because day/month have higher precedence than week
oDate.setWeek({
year: oDateValue.weekYear || oDateValue.year,
week: oDateValue.week
});
//add the dayNumberOfWeek to the current day
if (oDateValue.dayNumberOfWeek !== undefined) {
oDate.setDate(oDate.getDate() + oDateValue.dayNumberOfWeek - 1);
}
}
}
if (oDateValue.valid) {
oDate = oDate.getJSDate();
return oDate;
}
}
return null;
} | [
"function",
"(",
"oDateValue",
",",
"sCalendarType",
",",
"bUTC",
",",
"bStrict",
")",
"{",
"var",
"oDate",
",",
"iYear",
"=",
"typeof",
"oDateValue",
".",
"year",
"===",
"\"number\"",
"?",
"oDateValue",
".",
"year",
":",
"1970",
";",
"if",
"(",
"oDateVa... | recreate javascript date object from the given oDateValues. In case of oDateValue.valid == false, null value will be returned | [
"recreate",
"javascript",
"date",
"object",
"from",
"the",
"given",
"oDateValues",
".",
"In",
"case",
"of",
"oDateValue",
".",
"valid",
"==",
"false",
"null",
"value",
"will",
"be",
"returned"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/format/DateFormat.js#L1718-L1790 | train | Sets the given date value to the given calendar type. | [
30522,
3853,
1006,
1051,
13701,
10175,
5657,
1010,
4094,
8943,
5339,
18863,
1010,
2021,
2278,
1010,
18667,
12412,
2102,
1007,
1063,
13075,
1051,
13701,
1010,
1045,
29100,
1027,
2828,
11253,
1051,
13701,
10175,
5657,
1012,
2095,
1027,
1027,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
apache/incubator-echarts | src/chart/bar/PictorialBarView.js | createOrUpdateBarRect | function createOrUpdateBarRect(bar, symbolMeta, isUpdate) {
var rectShape = zrUtil.extend({}, symbolMeta.barRectShape);
var barRect = bar.__pictorialBarRect;
if (!barRect) {
barRect = bar.__pictorialBarRect = new graphic.Rect({
z2: 2,
shape: rectShape,
silent: true,
style: {
stroke: 'transparent',
fill: 'transparent',
lineWidth: 0
}
});
bar.add(barRect);
}
else {
updateAttr(barRect, null, {shape: rectShape}, symbolMeta, isUpdate);
}
} | javascript | function createOrUpdateBarRect(bar, symbolMeta, isUpdate) {
var rectShape = zrUtil.extend({}, symbolMeta.barRectShape);
var barRect = bar.__pictorialBarRect;
if (!barRect) {
barRect = bar.__pictorialBarRect = new graphic.Rect({
z2: 2,
shape: rectShape,
silent: true,
style: {
stroke: 'transparent',
fill: 'transparent',
lineWidth: 0
}
});
bar.add(barRect);
}
else {
updateAttr(barRect, null, {shape: rectShape}, symbolMeta, isUpdate);
}
} | [
"function",
"createOrUpdateBarRect",
"(",
"bar",
",",
"symbolMeta",
",",
"isUpdate",
")",
"{",
"var",
"rectShape",
"=",
"zrUtil",
".",
"extend",
"(",
"{",
"}",
",",
"symbolMeta",
".",
"barRectShape",
")",
";",
"var",
"barRect",
"=",
"bar",
".",
"__pictoria... | bar rect is used for label. | [
"bar",
"rect",
"is",
"used",
"for",
"label",
"."
] | 4d0ea095dc3929cb6de40c45748826e7999c7aa8 | https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/chart/bar/PictorialBarView.js#L553-L574 | train | Creates or updates the bar rect | [
30522,
3853,
3443,
2953,
6279,
13701,
8237,
2890,
6593,
1006,
3347,
1010,
6454,
11368,
2050,
1010,
2003,
6279,
13701,
1007,
1063,
13075,
28667,
3215,
3270,
5051,
1027,
1062,
22134,
4014,
1012,
7949,
1006,
1063,
1065,
1010,
6454,
11368,
2050... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/ToolsAPI.js | _getFrameworkName | function _getFrameworkName() {
var versionInfo;
var frameworkInfo;
try {
versionInfo = sap.ui.getVersionInfo();
} catch (e) {
versionInfo = undefined;
}
if (versionInfo) {
// Use group artifact version for maven builds or name for other builds (like SAPUI5-on-ABAP)
frameworkInfo = versionInfo.gav ? versionInfo.gav : versionInfo.name;
return frameworkInfo.indexOf('openui5') !== -1 ? 'OpenUI5' : 'SAPUI5';
} else {
return '';
}
} | javascript | function _getFrameworkName() {
var versionInfo;
var frameworkInfo;
try {
versionInfo = sap.ui.getVersionInfo();
} catch (e) {
versionInfo = undefined;
}
if (versionInfo) {
// Use group artifact version for maven builds or name for other builds (like SAPUI5-on-ABAP)
frameworkInfo = versionInfo.gav ? versionInfo.gav : versionInfo.name;
return frameworkInfo.indexOf('openui5') !== -1 ? 'OpenUI5' : 'SAPUI5';
} else {
return '';
}
} | [
"function",
"_getFrameworkName",
"(",
")",
"{",
"var",
"versionInfo",
";",
"var",
"frameworkInfo",
";",
"try",
"{",
"versionInfo",
"=",
"sap",
".",
"ui",
".",
"getVersionInfo",
"(",
")",
";",
"}",
"catch",
"(",
"e",
")",
"{",
"versionInfo",
"=",
"undefin... | ================================================================================ Technical Information ================================================================================
Returns the framework name.
@returns {string}
@private | [
"================================================================================",
"Technical",
"Information",
"================================================================================",
"Returns",
"the",
"framework",
"name",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/support/ToolsAPI.js#L34-L52 | train | Returns the framework name | [
30522,
3853,
1035,
2131,
15643,
6198,
18442,
1006,
1007,
1063,
13075,
2544,
2378,
14876,
1025,
13075,
7705,
2378,
14876,
1025,
3046,
1063,
2544,
2378,
14876,
1027,
20066,
1012,
21318,
1012,
2131,
27774,
2378,
14876,
1006,
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.unified/src/sap/ui/unified/CalendarTimeInterval.js | _handleDateFocus | function _handleDateFocus(oEvent){
var oFocusedDate = new UniversalDate(this._getFocusedDate().getTime());
var oDate = CalendarUtils._createUniversalUTCDate(oEvent.getParameter("date"), undefined, true);
var bNotVisible = oEvent.getParameter("otherMonth");
if (bNotVisible &&
oDate.getUTCMonth() == oFocusedDate.getUTCMonth() &&
oDate.getUTCFullYear() == oFocusedDate.getUTCFullYear()) {
// only show days in the same month
// set start date and focus date
_setDateInDatesRow.call(this, oDate);
}
} | javascript | function _handleDateFocus(oEvent){
var oFocusedDate = new UniversalDate(this._getFocusedDate().getTime());
var oDate = CalendarUtils._createUniversalUTCDate(oEvent.getParameter("date"), undefined, true);
var bNotVisible = oEvent.getParameter("otherMonth");
if (bNotVisible &&
oDate.getUTCMonth() == oFocusedDate.getUTCMonth() &&
oDate.getUTCFullYear() == oFocusedDate.getUTCFullYear()) {
// only show days in the same month
// set start date and focus date
_setDateInDatesRow.call(this, oDate);
}
} | [
"function",
"_handleDateFocus",
"(",
"oEvent",
")",
"{",
"var",
"oFocusedDate",
"=",
"new",
"UniversalDate",
"(",
"this",
".",
"_getFocusedDate",
"(",
")",
".",
"getTime",
"(",
")",
")",
";",
"var",
"oDate",
"=",
"CalendarUtils",
".",
"_createUniversalUTCDate"... | Handles day focus from the embedded day Picker.
This function assumes there is a "datesRow" aggregation.
So callers must take care.
@return {void}
@private | [
"Handles",
"day",
"focus",
"from",
"the",
"embedded",
"day",
"Picker",
".",
"This",
"function",
"assumes",
"there",
"is",
"a",
"datesRow",
"aggregation",
".",
"So",
"callers",
"must",
"take",
"care",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.unified/src/sap/ui/unified/CalendarTimeInterval.js#L1904-L1918 | train | Handles date focus event | [
30522,
3853,
1035,
8971,
30524,
1006,
2023,
1012,
1035,
2131,
14876,
7874,
22367,
3686,
1006,
1007,
1012,
2131,
7292,
1006,
1007,
1007,
1025,
13075,
1051,
13701,
1027,
8094,
21823,
4877,
1012,
1035,
3443,
19496,
14028,
2389,
4904,
19797,
36... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/thirdparty/zyngascroll.js | function() {
var self = this;
return {
left: self.__scrollLeft,
top: self.__scrollTop,
zoom: self.__zoomLevel
};
} | javascript | function() {
var self = this;
return {
left: self.__scrollLeft,
top: self.__scrollTop,
zoom: self.__zoomLevel
};
} | [
"function",
"(",
")",
"{",
"var",
"self",
"=",
"this",
";",
"return",
"{",
"left",
":",
"self",
".",
"__scrollLeft",
",",
"top",
":",
"self",
".",
"__scrollTop",
",",
"zoom",
":",
"self",
".",
"__zoomLevel",
"}",
";",
"}"
] | Returns the scroll position and zooming values
@return {Map} `left` and `top` scroll position and `zoom` level | [
"Returns",
"the",
"scroll",
"position",
"and",
"zooming",
"values"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/zyngascroll.js#L672-L682 | train | Returns the object that contains the current state of the page. | [
30522,
3853,
1006,
1007,
1063,
13075,
2969,
1027,
2023,
1025,
2709,
1063,
2187,
1024,
2969,
1012,
1035,
1035,
17186,
2571,
6199,
1010,
2327,
1024,
2969,
1012,
1035,
1035,
17186,
14399,
1010,
24095,
1024,
2969,
1012,
1035,
1035,
24095,
20414... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | src/sap.ui.core/src/sap/ui/base/ManagedObject.js | update | function update(oControl, aContexts, fnBefore, fnAfter) {
var aChildren = oControl[oAggregationInfo._sGetter]() || [],
oContext,
oClone;
if (aChildren.length > aContexts.length) {
for (var i = aContexts.length; i < aChildren.length; i++) {
oClone = aChildren[i];
oControl[oAggregationInfo._sRemoveMutator](oClone);
oClone.destroy("KeepDom");
}
}
for (var i = 0; i < aContexts.length; i++) {
oContext = aContexts[i];
oClone = aChildren[i];
if (fnBefore) {
fnBefore(oContext);
}
if (oClone) {
oClone.setBindingContext(oContext, oBindingInfo.model);
} else {
oClone = fnFactory(getIdSuffix(oControl, i), oContext);
oClone.setBindingContext(oContext, oBindingInfo.model);
oControl[oAggregationInfo._sMutator](oClone);
}
if (fnAfter) {
fnAfter(oContext, oClone);
}
}
} | javascript | function update(oControl, aContexts, fnBefore, fnAfter) {
var aChildren = oControl[oAggregationInfo._sGetter]() || [],
oContext,
oClone;
if (aChildren.length > aContexts.length) {
for (var i = aContexts.length; i < aChildren.length; i++) {
oClone = aChildren[i];
oControl[oAggregationInfo._sRemoveMutator](oClone);
oClone.destroy("KeepDom");
}
}
for (var i = 0; i < aContexts.length; i++) {
oContext = aContexts[i];
oClone = aChildren[i];
if (fnBefore) {
fnBefore(oContext);
}
if (oClone) {
oClone.setBindingContext(oContext, oBindingInfo.model);
} else {
oClone = fnFactory(getIdSuffix(oControl, i), oContext);
oClone.setBindingContext(oContext, oBindingInfo.model);
oControl[oAggregationInfo._sMutator](oClone);
}
if (fnAfter) {
fnAfter(oContext, oClone);
}
}
} | [
"function",
"update",
"(",
"oControl",
",",
"aContexts",
",",
"fnBefore",
",",
"fnAfter",
")",
"{",
"var",
"aChildren",
"=",
"oControl",
"[",
"oAggregationInfo",
".",
"_sGetter",
"]",
"(",
")",
"||",
"[",
"]",
",",
"oContext",
",",
"oClone",
";",
"if",
... | Update a single aggregation with the array of contexts. Reuse existing children and just append or remove at the end, if some are missing or too many. | [
"Update",
"a",
"single",
"aggregation",
"with",
"the",
"array",
"of",
"contexts",
".",
"Reuse",
"existing",
"children",
"and",
"just",
"append",
"or",
"remove",
"at",
"the",
"end",
"if",
"some",
"are",
"missing",
"or",
"too",
"many",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/base/ManagedObject.js#L3970-L3998 | train | Updates the binding context of the control | [
30522,
3853,
10651,
1006,
1051,
8663,
13181,
2140,
1010,
9353,
28040,
18413,
2015,
1010,
1042,
27698,
12879,
5686,
1010,
1042,
2532,
6199,
2121,
1007,
1063,
13075,
9353,
19466,
16200,
2078,
1027,
1051,
8663,
13181,
2140,
1031,
1051,
8490,
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... |
dcloudio/mui | examples/login/libs/easymob-webim-sdk/strophe-custom-2.0.0.js | function (elem)
{
if (elem.getAttribute("type") == "result") {
this.authenticated = true;
this._changeConnectStatus(Strophe.Status.CONNECTED, null);
} else if (elem.getAttribute("type") == "error") {
Strophe.info("Session creation failed.");
this._changeConnectStatus(Strophe.Status.AUTHFAIL, null);
return false;
}
return false;
} | javascript | function (elem)
{
if (elem.getAttribute("type") == "result") {
this.authenticated = true;
this._changeConnectStatus(Strophe.Status.CONNECTED, null);
} else if (elem.getAttribute("type") == "error") {
Strophe.info("Session creation failed.");
this._changeConnectStatus(Strophe.Status.AUTHFAIL, null);
return false;
}
return false;
} | [
"function",
"(",
"elem",
")",
"{",
"if",
"(",
"elem",
".",
"getAttribute",
"(",
"\"type\"",
")",
"==",
"\"result\"",
")",
"{",
"this",
".",
"authenticated",
"=",
"true",
";",
"this",
".",
"_changeConnectStatus",
"(",
"Strophe",
".",
"Status",
".",
"CONNE... | PrivateFunction: _sasl_session_cb
_Private_ handler to finish successful SASL connection.
This sets Connection.authenticated to true on success, which
starts the processing of user handlers.
Parameters:
(XMLElement) elem - The matching stanza.
Returns:
false to remove the handler. | [
"PrivateFunction",
":",
"_sasl_session_cb",
"_Private_",
"handler",
"to",
"finish",
"successful",
"SASL",
"connection",
"."
] | ff74c90a1671a552f3604b1288bf38a4126312d0 | https://github.com/dcloudio/mui/blob/ff74c90a1671a552f3604b1288bf38a4126312d0/examples/login/libs/easymob-webim-sdk/strophe-custom-2.0.0.js#L3304-L3316 | train | Returns true if session was successfully created | [
30522,
3853,
1006,
3449,
6633,
1007,
1063,
2065,
1006,
3449,
6633,
1012,
2131,
19321,
3089,
8569,
2618,
1006,
1000,
2828,
1000,
1007,
1027,
1027,
1000,
2765,
1000,
1007,
1063,
2023,
1012,
14469,
4383,
1027,
2995,
1025,
2023,
1012,
1035,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
GitbookIO/gitbook | lib/utils/location.js | isExternal | function isExternal(href) {
try {
return Boolean(url.parse(href).protocol) && !isDataURI(href);
} catch(err) {
return false;
}
} | javascript | function isExternal(href) {
try {
return Boolean(url.parse(href).protocol) && !isDataURI(href);
} catch(err) {
return false;
}
} | [
"function",
"isExternal",
"(",
"href",
")",
"{",
"try",
"{",
"return",
"Boolean",
"(",
"url",
".",
"parse",
"(",
"href",
")",
".",
"protocol",
")",
"&&",
"!",
"isDataURI",
"(",
"href",
")",
";",
"}",
"catch",
"(",
"err",
")",
"{",
"return",
"false"... | Is the url an external url | [
"Is",
"the",
"url",
"an",
"external",
"url"
] | 6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4 | https://github.com/GitbookIO/gitbook/blob/6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4/lib/utils/location.js#L5-L11 | train | Check if the href is external | [
30522,
3853,
2003,
10288,
16451,
2389,
1006,
17850,
12879,
1007,
1063,
3046,
1063,
2709,
22017,
20898,
1006,
24471,
2140,
1012,
11968,
3366,
1006,
17850,
12879,
1007,
1012,
8778,
1007,
1004,
1004,
999,
2003,
2850,
2696,
9496,
1006,
17850,
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.support/src/sap/ui/support/supportRules/ui/models/PresetsUtils.js | function (aSelectedRulesPlain) {
var oPreset = this.model.getProperty("/selectionPresetsCurrent");
oPreset.selections = aSelectedRulesPlain;
if (!(oPreset.isModified || oPreset.isMySelection)) {
oPreset.isModified = true;
oPreset.title = oPreset.title + " *";
}
this.model.setProperty("/selectionPresetsCurrent", oPreset);
if (PresetsUtils.isPersistingAllowed()) {
PresetsUtils.persistSelectionPresets();
}
} | javascript | function (aSelectedRulesPlain) {
var oPreset = this.model.getProperty("/selectionPresetsCurrent");
oPreset.selections = aSelectedRulesPlain;
if (!(oPreset.isModified || oPreset.isMySelection)) {
oPreset.isModified = true;
oPreset.title = oPreset.title + " *";
}
this.model.setProperty("/selectionPresetsCurrent", oPreset);
if (PresetsUtils.isPersistingAllowed()) {
PresetsUtils.persistSelectionPresets();
}
} | [
"function",
"(",
"aSelectedRulesPlain",
")",
"{",
"var",
"oPreset",
"=",
"this",
".",
"model",
".",
"getProperty",
"(",
"\"/selectionPresetsCurrent\"",
")",
";",
"oPreset",
".",
"selections",
"=",
"aSelectedRulesPlain",
";",
"if",
"(",
"!",
"(",
"oPreset",
"."... | Synchronizes the current rules selection with the current selection preset
@param {Array} aSelectedRulesPlain The plain list of selected rules (same format as in the presets json file) | [
"Synchronizes",
"the",
"current",
"rules",
"selection",
"with",
"the",
"current",
"selection",
"preset"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.support/src/sap/ui/support/supportRules/ui/models/PresetsUtils.js#L95-L110 | train | Updates the selection presets of the current selection preset | [
30522,
3853,
1006,
2004,
12260,
10985,
6820,
4244,
24759,
8113,
1007,
1063,
13075,
6728,
6072,
3388,
1027,
2023,
1012,
2944,
1012,
2131,
21572,
4842,
3723,
1006,
1000,
1013,
4989,
28994,
8454,
10841,
14343,
3372,
1000,
1007,
1025,
6728,
607... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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_RkRec | function parse_RkRec(blob) {
var ixfe = blob.read_shift(2);
var RK = parse_RkNumber(blob);
return [ixfe, RK];
} | javascript | function parse_RkRec(blob) {
var ixfe = blob.read_shift(2);
var RK = parse_RkNumber(blob);
return [ixfe, RK];
} | [
"function",
"parse_RkRec",
"(",
"blob",
")",
"{",
"var",
"ixfe",
"=",
"blob",
".",
"read_shift",
"(",
"2",
")",
";",
"var",
"RK",
"=",
"parse_RkNumber",
"(",
"blob",
")",
";",
"return",
"[",
"ixfe",
",",
"RK",
"]",
";",
"}"
] | /* [MS-XLS] 2.5.218 | [
"/",
"*",
"[",
"MS",
"-",
"XLS",
"]",
"2",
".",
"5",
".",
"218"
] | 9a6d8a1d3d80c78dad5201fb389316f935279cdc | https://github.com/SheetJS/js-xlsx/blob/9a6d8a1d3d80c78dad5201fb389316f935279cdc/xlsx.js#L5606-L5610 | train | Parse RkRec | [
30522,
3853,
11968,
3366,
1035,
1054,
21638,
8586,
1006,
1038,
4135,
2497,
1007,
1063,
13075,
11814,
7959,
1027,
1038,
4135,
2497,
1012,
3191,
1035,
5670,
1006,
1016,
1007,
1025,
13075,
1054,
2243,
1027,
11968,
3366,
1035,
1054,
2243,
19172... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
kriasoft/react-starter-kit | tools/deploy.js | deploy | async function deploy() {
// Initialize a new repository
await makeDir('build');
await spawn('git', ['init', '--quiet'], options);
// Changing a remote's URL
let isRemoteExists = false;
try {
await spawn(
'git',
['config', '--get', `remote.${remote.name}.url`],
options,
);
isRemoteExists = true;
} catch (error) {
/* skip */
}
await spawn(
'git',
['remote', isRemoteExists ? 'set-url' : 'add', remote.name, remote.url],
options,
);
// Fetch the remote repository if it exists
let isRefExists = false;
try {
await spawn(
'git',
['ls-remote', '--quiet', '--exit-code', remote.url, remote.branch],
options,
);
isRefExists = true;
} catch (error) {
await spawn('git', ['update-ref', '-d', 'HEAD'], options);
}
if (isRefExists) {
await spawn('git', ['fetch', remote.name], options);
await spawn(
'git',
['reset', `${remote.name}/${remote.branch}`, '--hard'],
options,
);
await spawn('git', ['clean', '--force'], options);
}
// Build the project in RELEASE mode which
// generates optimized and minimized bundles
process.argv.push('--release');
if (remote.static) process.argv.push('--static');
await run(require('./build').default); // eslint-disable-line global-require
if (process.argv.includes('--static')) {
await cleanDir('build/*', {
nosort: true,
dot: true,
ignore: ['build/.git', 'build/public'],
});
await moveDir('build/public', 'build');
}
// Push the contents of the build folder to the remote server via Git
await spawn('git', ['add', '.', '--all'], options);
try {
await spawn('git', ['diff', '--cached', '--exit-code', '--quiet'], options);
} catch (error) {
await spawn(
'git',
['commit', '--message', `Update ${new Date().toISOString()}`],
options,
);
}
await spawn(
'git',
['push', remote.name, `master:${remote.branch}`, '--set-upstream'],
options,
);
// Check if the site was successfully deployed
const response = await fetch(remote.website);
console.info(
`${remote.website} => ${response.status} ${response.statusText}`,
);
} | javascript | async function deploy() {
// Initialize a new repository
await makeDir('build');
await spawn('git', ['init', '--quiet'], options);
// Changing a remote's URL
let isRemoteExists = false;
try {
await spawn(
'git',
['config', '--get', `remote.${remote.name}.url`],
options,
);
isRemoteExists = true;
} catch (error) {
/* skip */
}
await spawn(
'git',
['remote', isRemoteExists ? 'set-url' : 'add', remote.name, remote.url],
options,
);
// Fetch the remote repository if it exists
let isRefExists = false;
try {
await spawn(
'git',
['ls-remote', '--quiet', '--exit-code', remote.url, remote.branch],
options,
);
isRefExists = true;
} catch (error) {
await spawn('git', ['update-ref', '-d', 'HEAD'], options);
}
if (isRefExists) {
await spawn('git', ['fetch', remote.name], options);
await spawn(
'git',
['reset', `${remote.name}/${remote.branch}`, '--hard'],
options,
);
await spawn('git', ['clean', '--force'], options);
}
// Build the project in RELEASE mode which
// generates optimized and minimized bundles
process.argv.push('--release');
if (remote.static) process.argv.push('--static');
await run(require('./build').default); // eslint-disable-line global-require
if (process.argv.includes('--static')) {
await cleanDir('build/*', {
nosort: true,
dot: true,
ignore: ['build/.git', 'build/public'],
});
await moveDir('build/public', 'build');
}
// Push the contents of the build folder to the remote server via Git
await spawn('git', ['add', '.', '--all'], options);
try {
await spawn('git', ['diff', '--cached', '--exit-code', '--quiet'], options);
} catch (error) {
await spawn(
'git',
['commit', '--message', `Update ${new Date().toISOString()}`],
options,
);
}
await spawn(
'git',
['push', remote.name, `master:${remote.branch}`, '--set-upstream'],
options,
);
// Check if the site was successfully deployed
const response = await fetch(remote.website);
console.info(
`${remote.website} => ${response.status} ${response.statusText}`,
);
} | [
"async",
"function",
"deploy",
"(",
")",
"{",
"// Initialize a new repository",
"await",
"makeDir",
"(",
"'build'",
")",
";",
"await",
"spawn",
"(",
"'git'",
",",
"[",
"'init'",
",",
"'--quiet'",
"]",
",",
"options",
")",
";",
"// Changing a remote's URL",
"le... | Deploy the contents of the `/build` folder to a remote server via Git. | [
"Deploy",
"the",
"contents",
"of",
"the",
"/",
"build",
"folder",
"to",
"a",
"remote",
"server",
"via",
"Git",
"."
] | 8d6c018f3198dec2a580ecafb011a32f06e38dbf | https://github.com/kriasoft/react-starter-kit/blob/8d6c018f3198dec2a580ecafb011a32f06e38dbf/tools/deploy.js#L49-L130 | train | Deploy the project to the remote server | [
30522,
2004,
6038,
2278,
3853,
21296,
1006,
1007,
1063,
1013,
1013,
3988,
4697,
1037,
2047,
22409,
26751,
2191,
4305,
2099,
1006,
1005,
3857,
1005,
1007,
1025,
26751,
25645,
1006,
1005,
21025,
2102,
1005,
1010,
1031,
1005,
1999,
4183,
1005,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
catapult-project/catapult | netlog_viewer/netlog_viewer/ui_webui_resources_js_util.js | preventDefaultOnPoundLinkClicks | function preventDefaultOnPoundLinkClicks() {
document.addEventListener('click', function(e) {
var anchor = findAncestor(/** @type {Node} */(e.target), function(el) {
return el.tagName == 'A';
});
// Use getAttribute() to prevent URL normalization.
if (anchor && anchor.getAttribute('href') == '#')
e.preventDefault();
});
} | javascript | function preventDefaultOnPoundLinkClicks() {
document.addEventListener('click', function(e) {
var anchor = findAncestor(/** @type {Node} */(e.target), function(el) {
return el.tagName == 'A';
});
// Use getAttribute() to prevent URL normalization.
if (anchor && anchor.getAttribute('href') == '#')
e.preventDefault();
});
} | [
"function",
"preventDefaultOnPoundLinkClicks",
"(",
")",
"{",
"document",
".",
"addEventListener",
"(",
"'click'",
",",
"function",
"(",
"e",
")",
"{",
"var",
"anchor",
"=",
"findAncestor",
"(",
"/** @type {Node} */",
"(",
"e",
".",
"target",
")",
",",
"functi... | TODO(dbeam): DO NOT USE. THIS IS DEPRECATED. Use an action-link instead.
Call this to stop clicks on <a href="#"> links from scrolling to the top of
the page (and possibly showing a # in the link). | [
"TODO",
"(",
"dbeam",
")",
":",
"DO",
"NOT",
"USE",
".",
"THIS",
"IS",
"DEPRECATED",
".",
"Use",
"an",
"action",
"-",
"link",
"instead",
".",
"Call",
"this",
"to",
"stop",
"clicks",
"on",
"<a",
"href",
"=",
"#",
">",
"links",
"from",
"scrolling",
"... | 992929ffccac68827869a497f01ee4d653ed4f25 | https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/netlog_viewer/netlog_viewer/ui_webui_resources_js_util.js#L167-L176 | train | Prevents the default behavior of a link | [
30522,
3853,
4652,
3207,
7011,
22145,
6873,
8630,
13767,
20464,
6799,
2015,
1006,
1007,
1063,
6254,
1012,
5587,
18697,
3372,
9863,
24454,
1006,
1005,
11562,
1005,
1010,
3853,
1006,
1041,
1007,
1063,
13075,
8133,
1027,
2424,
26755,
4263,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.m/src/sap/m/Support.js | getDialog | function getDialog() {
if (dialog) {
return dialog;
}
var Dialog = sap.ui.requireSync("sap/m/Dialog");
var Button = sap.ui.requireSync("sap/m/Button");
sap.ui.requireSync("sap/ui/core/HTML");
sap.ui.requireSync("sap/m/MessageToast");
sap.ui.requireSync("sap/ui/core/support/trace/E2eTraceLib");
dialog = new Dialog({
title: "Technical Information",
horizontalScrolling: true,
verticalScrolling: true,
stretch: Device.system.phone,
buttons: [
new Button({
text: "Close",
press: function () {
dialog.close();
}
})
],
afterOpen: function () {
Support.off();
},
afterClose: function () {
Support.on();
}
}).addStyleClass("sapMSupport");
return dialog;
} | javascript | function getDialog() {
if (dialog) {
return dialog;
}
var Dialog = sap.ui.requireSync("sap/m/Dialog");
var Button = sap.ui.requireSync("sap/m/Button");
sap.ui.requireSync("sap/ui/core/HTML");
sap.ui.requireSync("sap/m/MessageToast");
sap.ui.requireSync("sap/ui/core/support/trace/E2eTraceLib");
dialog = new Dialog({
title: "Technical Information",
horizontalScrolling: true,
verticalScrolling: true,
stretch: Device.system.phone,
buttons: [
new Button({
text: "Close",
press: function () {
dialog.close();
}
})
],
afterOpen: function () {
Support.off();
},
afterClose: function () {
Support.on();
}
}).addStyleClass("sapMSupport");
return dialog;
} | [
"function",
"getDialog",
"(",
")",
"{",
"if",
"(",
"dialog",
")",
"{",
"return",
"dialog",
";",
"}",
"var",
"Dialog",
"=",
"sap",
".",
"ui",
".",
"requireSync",
"(",
"\"sap/m/Dialog\"",
")",
";",
"var",
"Button",
"=",
"sap",
".",
"ui",
".",
"requireS... | get or create dialog instance and return | [
"get",
"or",
"create",
"dialog",
"instance",
"and",
"return"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/Support.js#L241-L274 | train | Returns the dialog | [
30522,
3853,
2131,
27184,
8649,
1006,
1007,
1063,
2065,
1006,
13764,
8649,
1007,
1063,
2709,
13764,
8649,
1025,
1065,
13075,
13764,
8649,
1027,
20066,
1012,
21318,
1012,
5942,
6038,
2278,
1006,
1000,
20066,
1013,
1049,
1013,
13764,
8649,
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... |
summernote/summernote | src/js/base/core/dom.js | isSamePoint | function isSamePoint(pointA, pointB) {
return pointA.node === pointB.node && pointA.offset === pointB.offset;
} | javascript | function isSamePoint(pointA, pointB) {
return pointA.node === pointB.node && pointA.offset === pointB.offset;
} | [
"function",
"isSamePoint",
"(",
"pointA",
",",
"pointB",
")",
"{",
"return",
"pointA",
".",
"node",
"===",
"pointB",
".",
"node",
"&&",
"pointA",
".",
"offset",
"===",
"pointB",
".",
"offset",
";",
"}"
] | returns whether pointA and pointB is same or not.
@param {BoundaryPoint} pointA
@param {BoundaryPoint} pointB
@return {Boolean} | [
"returns",
"whether",
"pointA",
"and",
"pointB",
"is",
"same",
"or",
"not",
"."
] | 8dcafb8107453006b905ef697a529c42e76beb3f | https://github.com/summernote/summernote/blob/8dcafb8107453006b905ef697a529c42e76beb3f/src/js/base/core/dom.js#L592-L594 | train | Returns true if pointA is the same point as pointB | [
30522,
3853,
26354,
14074,
8400,
1006,
2391,
2050,
1010,
30524,
1004,
1004,
2391,
2050,
1012,
16396,
1027,
1027,
1027,
2391,
2497,
1012,
16396,
1025,
1065,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
codemirror/CodeMirror | src/edit/key_events.js | handleKeyBinding | function handleKeyBinding(cm, e) {
let name = keyName(e, true)
if (!name) return false
if (e.shiftKey && !cm.state.keySeq) {
// First try to resolve full name (including 'Shift-'). Failing
// that, see if there is a cursor-motion command (starting with
// 'go') bound to the keyname without 'Shift-'.
return dispatchKey(cm, "Shift-" + name, e, b => doHandleBinding(cm, b, true))
|| dispatchKey(cm, name, e, b => {
if (typeof b == "string" ? /^go[A-Z]/.test(b) : b.motion)
return doHandleBinding(cm, b)
})
} else {
return dispatchKey(cm, name, e, b => doHandleBinding(cm, b))
}
} | javascript | function handleKeyBinding(cm, e) {
let name = keyName(e, true)
if (!name) return false
if (e.shiftKey && !cm.state.keySeq) {
// First try to resolve full name (including 'Shift-'). Failing
// that, see if there is a cursor-motion command (starting with
// 'go') bound to the keyname without 'Shift-'.
return dispatchKey(cm, "Shift-" + name, e, b => doHandleBinding(cm, b, true))
|| dispatchKey(cm, name, e, b => {
if (typeof b == "string" ? /^go[A-Z]/.test(b) : b.motion)
return doHandleBinding(cm, b)
})
} else {
return dispatchKey(cm, name, e, b => doHandleBinding(cm, b))
}
} | [
"function",
"handleKeyBinding",
"(",
"cm",
",",
"e",
")",
"{",
"let",
"name",
"=",
"keyName",
"(",
"e",
",",
"true",
")",
"if",
"(",
"!",
"name",
")",
"return",
"false",
"if",
"(",
"e",
".",
"shiftKey",
"&&",
"!",
"cm",
".",
"state",
".",
"keySeq... | Handle a key from the keydown event. | [
"Handle",
"a",
"key",
"from",
"the",
"keydown",
"event",
"."
] | dab6f676107c10ba8d16c654a42f66cae3f27db1 | https://github.com/codemirror/CodeMirror/blob/dab6f676107c10ba8d16c654a42f66cae3f27db1/src/edit/key_events.js#L83-L99 | train | Handle key binding | [
30522,
3853,
5047,
14839,
8428,
4667,
1006,
4642,
1010,
1041,
1007,
1063,
2292,
2171,
1027,
3145,
18442,
1006,
1041,
1010,
2995,
1007,
2065,
1006,
999,
2171,
1007,
2709,
6270,
2065,
1006,
1041,
1012,
5670,
14839,
1004,
1004,
999,
4642,
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... |
pixijs/pixi.js | packages/graphics/src/utils/buildRoundedRectangle.js | getPt | function getPt(n1, n2, perc)
{
const diff = n2 - n1;
return n1 + (diff * perc);
} | javascript | function getPt(n1, n2, perc)
{
const diff = n2 - n1;
return n1 + (diff * perc);
} | [
"function",
"getPt",
"(",
"n1",
",",
"n2",
",",
"perc",
")",
"{",
"const",
"diff",
"=",
"n2",
"-",
"n1",
";",
"return",
"n1",
"+",
"(",
"diff",
"*",
"perc",
")",
";",
"}"
] | Calculate a single point for a quadratic bezier curve.
Utility function used by quadraticBezierCurve.
Ignored from docs since it is not directly exposed.
@ignore
@private
@param {number} n1 - first number
@param {number} n2 - second number
@param {number} perc - percentage
@return {number} the result | [
"Calculate",
"a",
"single",
"point",
"for",
"a",
"quadratic",
"bezier",
"curve",
".",
"Utility",
"function",
"used",
"by",
"quadraticBezierCurve",
".",
"Ignored",
"from",
"docs",
"since",
"it",
"is",
"not",
"directly",
"exposed",
"."
] | 99ae03b7565ae7ca5a6de633b0a277f7128fa4d0 | https://github.com/pixijs/pixi.js/blob/99ae03b7565ae7ca5a6de633b0a277f7128fa4d0/packages/graphics/src/utils/buildRoundedRectangle.js#L90-L95 | train | Returns the point at which the given polynomial is located in the specified polynomial. | [
30522,
3853,
2131,
13876,
1006,
1050,
2487,
1010,
1050,
2475,
1010,
2566,
2278,
1007,
1063,
9530,
3367,
4487,
4246,
1027,
1050,
2475,
1011,
1050,
2487,
1025,
2709,
1050,
2487,
1009,
1006,
4487,
4246,
1008,
2566,
2278,
1007,
1025,
1065,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/project/ProjectModel.js | _getWelcomeProjectPath | function _getWelcomeProjectPath(sampleUrl, initialPath) {
if (sampleUrl) {
// Back up one more folder. The samples folder is assumed to be at the same level as
// the src folder, and the sampleUrl is relative to the samples folder.
initialPath = initialPath.substr(0, initialPath.lastIndexOf("/")) + "/samples/" + sampleUrl;
}
return _ensureTrailingSlash(initialPath); // paths above weren't canonical
} | javascript | function _getWelcomeProjectPath(sampleUrl, initialPath) {
if (sampleUrl) {
// Back up one more folder. The samples folder is assumed to be at the same level as
// the src folder, and the sampleUrl is relative to the samples folder.
initialPath = initialPath.substr(0, initialPath.lastIndexOf("/")) + "/samples/" + sampleUrl;
}
return _ensureTrailingSlash(initialPath); // paths above weren't canonical
} | [
"function",
"_getWelcomeProjectPath",
"(",
"sampleUrl",
",",
"initialPath",
")",
"{",
"if",
"(",
"sampleUrl",
")",
"{",
"// Back up one more folder. The samples folder is assumed to be at the same level as",
"// the src folder, and the sampleUrl is relative to the samples folder.",
"in... | @private
Returns the full path to the welcome project, which we open on first launch.
@param {string} sampleUrl URL for getting started project
@param {string} initialPath Path to Brackets directory (see {@link FileUtils::#getNativeBracketsDirectoryPath})
@return {!string} fullPath reference | [
"@private"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/project/ProjectModel.js#L1307-L1315 | train | Get the path to the welcome project | [
30522,
3853,
1035,
2131,
8545,
22499,
4168,
21572,
20614,
15069,
1006,
7099,
3126,
2140,
1010,
3988,
15069,
1007,
1063,
2065,
1006,
7099,
3126,
2140,
1007,
1063,
1013,
1013,
2067,
2039,
2028,
2062,
19622,
1012,
1996,
8168,
19622,
2003,
5071... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/base/ExpressionParser.js | PROPERTY_ACCESS | function PROPERTY_ACCESS(fnLeft, fnName, aParts, oReference) {
var oParent = fnLeft(aParts),
sIdentifier = fnName(aParts), // BEWARE: evaluate propertyNameValue AFTER baseValue!
vChild = oParent[sIdentifier];
if (oReference) {
oReference.base = oParent;
}
return vChild;
} | javascript | function PROPERTY_ACCESS(fnLeft, fnName, aParts, oReference) {
var oParent = fnLeft(aParts),
sIdentifier = fnName(aParts), // BEWARE: evaluate propertyNameValue AFTER baseValue!
vChild = oParent[sIdentifier];
if (oReference) {
oReference.base = oParent;
}
return vChild;
} | [
"function",
"PROPERTY_ACCESS",
"(",
"fnLeft",
",",
"fnName",
",",
"aParts",
",",
"oReference",
")",
"{",
"var",
"oParent",
"=",
"fnLeft",
"(",
"aParts",
")",
",",
"sIdentifier",
"=",
"fnName",
"(",
"aParts",
")",
",",
"// BEWARE: evaluate propertyNameValue AFTER... | Formatter function for a property access.
@param {function} fnLeft - formatter function for the left operand: the array or object to
access
@param {function} fnName - formatter function for the property name
@param {any[]} aParts - the array of binding values
@param {object} [oReference]
optional side channel to return the base value (left operand) of the reference
@return {any} - the array element or object property | [
"Formatter",
"function",
"for",
"a",
"property",
"access",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/base/ExpressionParser.js#L429-L438 | train | This function is called by the property accessor function to determine the value of the property. | [
30522,
3853,
3200,
1035,
3229,
1006,
1042,
20554,
29218,
1010,
1042,
9516,
4168,
1010,
4237,
2015,
1010,
10848,
25523,
1007,
1063,
13075,
6728,
12069,
3372,
30524,
3372,
1031,
2217,
16778,
8873,
2121,
1033,
1025,
2065,
1006,
10848,
25523,
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.support/src/sap/ui/support/supportRules/util/Utils.js | function (oVersionInfo) {
var bResult = false,
sFrameworkInfo = "";
try {
sFrameworkInfo = oVersionInfo.gav ? oVersionInfo.gav : oVersionInfo.name;
bResult = sFrameworkInfo.indexOf('openui5') !== -1 ? true : false;
} catch (e) {
return bResult;
}
return bResult;
} | javascript | function (oVersionInfo) {
var bResult = false,
sFrameworkInfo = "";
try {
sFrameworkInfo = oVersionInfo.gav ? oVersionInfo.gav : oVersionInfo.name;
bResult = sFrameworkInfo.indexOf('openui5') !== -1 ? true : false;
} catch (e) {
return bResult;
}
return bResult;
} | [
"function",
"(",
"oVersionInfo",
")",
"{",
"var",
"bResult",
"=",
"false",
",",
"sFrameworkInfo",
"=",
"\"\"",
";",
"try",
"{",
"sFrameworkInfo",
"=",
"oVersionInfo",
".",
"gav",
"?",
"oVersionInfo",
".",
"gav",
":",
"oVersionInfo",
".",
"name",
";",
"bRes... | Checks the distribution of UI5 that the Application is using
@public
@param {object} oVersionInfo information about the UI5 freawork used by the Application
@returns {boolean} result true if the distribution of application is OPENUI5 | [
"Checks",
"the",
"distribution",
"of",
"UI5",
"that",
"the",
"Application",
"is",
"using"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.support/src/sap/ui/support/supportRules/util/Utils.js#L23-L35 | train | Checks if the version of the platform is compatible with the OpenUI5 version | [
30522,
3853,
1006,
15849,
3258,
2378,
14876,
1007,
1063,
13075,
7987,
2229,
11314,
1027,
6270,
1010,
16420,
6444,
7974,
2953,
4939,
14876,
1027,
1000,
1000,
1025,
3046,
1063,
16420,
6444,
7974,
2953,
4939,
14876,
1027,
15849,
3258,
2378,
14... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.