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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
jhipster/generator-jhipster | generators/docker-prompts.js | askForServiceDiscovery | function askForServiceDiscovery() {
if (this.regenerate) return;
const done = this.async();
const serviceDiscoveryEnabledApps = [];
this.appConfigs.forEach((appConfig, index) => {
if (appConfig.serviceDiscoveryType) {
serviceDiscoveryEnabledApps.push({
baseName: appConfig.baseName,
serviceDiscoveryType: appConfig.serviceDiscoveryType
});
}
});
if (serviceDiscoveryEnabledApps.length === 0) {
this.serviceDiscoveryType = false;
done();
return;
}
if (serviceDiscoveryEnabledApps.every(app => app.serviceDiscoveryType === 'consul')) {
this.serviceDiscoveryType = 'consul';
this.log(chalk.green('Consul detected as the service discovery and configuration provider used by your apps'));
done();
} else if (serviceDiscoveryEnabledApps.every(app => app.serviceDiscoveryType === 'eureka')) {
this.serviceDiscoveryType = 'eureka';
this.log(chalk.green('JHipster registry detected as the service discovery and configuration provider used by your apps'));
done();
} else {
this.log(chalk.yellow('Unable to determine the service discovery and configuration provider to use from your apps configuration.'));
this.log('Your service discovery enabled apps:');
serviceDiscoveryEnabledApps.forEach(app => {
this.log(` -${app.baseName} (${app.serviceDiscoveryType})`);
});
const prompts = [
{
type: 'list',
name: 'serviceDiscoveryType',
message: 'Which Service Discovery registry and Configuration server would you like to use ?',
choices: [
{
value: 'eureka',
name: 'JHipster Registry'
},
{
value: 'consul',
name: 'Consul'
},
{
value: false,
name: 'No Service Discovery and Configuration'
}
],
default: 'eureka'
}
];
this.prompt(prompts).then(props => {
this.serviceDiscoveryType = props.serviceDiscoveryType;
done();
});
}
} | javascript | function askForServiceDiscovery() {
if (this.regenerate) return;
const done = this.async();
const serviceDiscoveryEnabledApps = [];
this.appConfigs.forEach((appConfig, index) => {
if (appConfig.serviceDiscoveryType) {
serviceDiscoveryEnabledApps.push({
baseName: appConfig.baseName,
serviceDiscoveryType: appConfig.serviceDiscoveryType
});
}
});
if (serviceDiscoveryEnabledApps.length === 0) {
this.serviceDiscoveryType = false;
done();
return;
}
if (serviceDiscoveryEnabledApps.every(app => app.serviceDiscoveryType === 'consul')) {
this.serviceDiscoveryType = 'consul';
this.log(chalk.green('Consul detected as the service discovery and configuration provider used by your apps'));
done();
} else if (serviceDiscoveryEnabledApps.every(app => app.serviceDiscoveryType === 'eureka')) {
this.serviceDiscoveryType = 'eureka';
this.log(chalk.green('JHipster registry detected as the service discovery and configuration provider used by your apps'));
done();
} else {
this.log(chalk.yellow('Unable to determine the service discovery and configuration provider to use from your apps configuration.'));
this.log('Your service discovery enabled apps:');
serviceDiscoveryEnabledApps.forEach(app => {
this.log(` -${app.baseName} (${app.serviceDiscoveryType})`);
});
const prompts = [
{
type: 'list',
name: 'serviceDiscoveryType',
message: 'Which Service Discovery registry and Configuration server would you like to use ?',
choices: [
{
value: 'eureka',
name: 'JHipster Registry'
},
{
value: 'consul',
name: 'Consul'
},
{
value: false,
name: 'No Service Discovery and Configuration'
}
],
default: 'eureka'
}
];
this.prompt(prompts).then(props => {
this.serviceDiscoveryType = props.serviceDiscoveryType;
done();
});
}
} | [
"function",
"askForServiceDiscovery",
"(",
")",
"{",
"if",
"(",
"this",
".",
"regenerate",
")",
"return",
";",
"const",
"done",
"=",
"this",
".",
"async",
"(",
")",
";",
"const",
"serviceDiscoveryEnabledApps",
"=",
"[",
"]",
";",
"this",
".",
"appConfigs",... | Ask For Service Discovery | [
"Ask",
"For",
"Service",
"Discovery"
] | f76fa8de0818ce6bda6c7b1455942e2a9b0ae3ff | https://github.com/jhipster/generator-jhipster/blob/f76fa8de0818ce6bda6c7b1455942e2a9b0ae3ff/generators/docker-prompts.js#L307-L371 | train | Ask For Service Discovery | [
30522,
3853,
3198,
29278,
8043,
7903,
2098,
2483,
3597,
27900,
1006,
1007,
1063,
2065,
1006,
2023,
1012,
19723,
24454,
3686,
1007,
2709,
1025,
9530,
3367,
2589,
1027,
2023,
1012,
2004,
6038,
2278,
1006,
1007,
1025,
9530,
3367,
22858,
2483,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/webuploader.js | function() {
// return this._mgr.getStats.apply( this._mgr, arguments );
var stats = this.request('get-stats');
return {
successNum: stats.numOfSuccess,
// who care?
// queueFailNum: 0,
cancelNum: stats.numOfCancel,
invalidNum: stats.numOfInvalid,
uploadFailNum: stats.numOfUploadFailed,
queueNum: stats.numOfQueue
};
} | javascript | function() {
// return this._mgr.getStats.apply( this._mgr, arguments );
var stats = this.request('get-stats');
return {
successNum: stats.numOfSuccess,
// who care?
// queueFailNum: 0,
cancelNum: stats.numOfCancel,
invalidNum: stats.numOfInvalid,
uploadFailNum: stats.numOfUploadFailed,
queueNum: stats.numOfQueue
};
} | [
"function",
"(",
")",
"{",
"// return this._mgr.getStats.apply( this._mgr, arguments );",
"var",
"stats",
"=",
"this",
".",
"request",
"(",
"'get-stats'",
")",
";",
"return",
"{",
"successNum",
":",
"stats",
".",
"numOfSuccess",
",",
"// who care?",
"// queueFailNum: ... | 获取文件统计信息。返回一个包含一下信息的对象。
* `successNum` 上传成功的文件数
* `uploadFailNum` 上传失败的文件数
* `cancelNum` 被删除的文件数
* `invalidNum` 无效的文件数
* `queueNum` 还在队列中的文件数
@method getStats
@grammar getStats() => Object | [
"获取文件统计信息。返回一个包含一下信息的对象。",
"*",
"successNum",
"上传成功的文件数",
"*",
"uploadFailNum",
"上传失败的文件数",
"*",
"cancelNum",
"被删除的文件数",
"*",
"invalidNum",
"无效的文件数",
"*",
"queueNum",
"还在队列中的文件数"
] | 7094e4476c5af3b06993d91dde2d223200b9feb7 | https://github.com/fex-team/webuploader/blob/7094e4476c5af3b06993d91dde2d223200b9feb7/_draft/music/webuploader.js#L762-L776 | train | Get stats from the cluster | [
30522,
3853,
1006,
1007,
1063,
1013,
1013,
2709,
2023,
1012,
1035,
11460,
2099,
1012,
4152,
29336,
2015,
1012,
6611,
1006,
2023,
1012,
1035,
11460,
2099,
1010,
9918,
1007,
1025,
13075,
26319,
1027,
2023,
1012,
5227,
1006,
1005,
2131,
1011,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
eslint/eslint | lib/rules/comma-style.js | getReplacedText | function getReplacedText(styleType, text) {
switch (styleType) {
case "between":
return `,${text.replace(astUtils.LINEBREAK_MATCHER, "")}`;
case "first":
return `${text},`;
case "last":
return `,${text}`;
default:
return "";
}
} | javascript | function getReplacedText(styleType, text) {
switch (styleType) {
case "between":
return `,${text.replace(astUtils.LINEBREAK_MATCHER, "")}`;
case "first":
return `${text},`;
case "last":
return `,${text}`;
default:
return "";
}
} | [
"function",
"getReplacedText",
"(",
"styleType",
",",
"text",
")",
"{",
"switch",
"(",
"styleType",
")",
"{",
"case",
"\"between\"",
":",
"return",
"`",
"${",
"text",
".",
"replace",
"(",
"astUtils",
".",
"LINEBREAK_MATCHER",
",",
"\"\"",
")",
"}",
"`",
... | -------------------------------------------------------------------------- Helpers --------------------------------------------------------------------------
Modified text based on the style
@param {string} styleType Style type
@param {string} text Source code text
@returns {string} modified text
@private | [
"--------------------------------------------------------------------------",
"Helpers",
"--------------------------------------------------------------------------",
"Modified",
"text",
"based",
"on",
"the",
"style"
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/comma-style.js#L85-L99 | train | Returns a string with the replaced text | [
30522,
3853,
2131,
2890,
22829,
18209,
1006,
2806,
13874,
1010,
3793,
1007,
1063,
6942,
1006,
2806,
13874,
1007,
1063,
2553,
1000,
2090,
1000,
1024,
2709,
1036,
1010,
1002,
1063,
3793,
1012,
5672,
1006,
2004,
8525,
3775,
4877,
1012,
2240,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SeleniumHQ/selenium | javascript/node/selenium-webdriver/lib/webdriver.js | toWireValue | async function toWireValue(obj) {
let value = await Promise.resolve(obj);
if (value === void 0 || value === null) {
return value;
}
if (typeof value === 'boolean'
|| typeof value === 'number'
|| typeof value === 'string') {
return value;
}
if (Array.isArray(value)) {
return convertKeys(value);
}
if (typeof value === 'function') {
return '' + value;
}
if (typeof value[Symbols.serialize] === 'function') {
return toWireValue(value[Symbols.serialize]());
} else if (typeof value.toJSON === 'function') {
return toWireValue(value.toJSON());
}
return convertKeys(value);
} | javascript | async function toWireValue(obj) {
let value = await Promise.resolve(obj);
if (value === void 0 || value === null) {
return value;
}
if (typeof value === 'boolean'
|| typeof value === 'number'
|| typeof value === 'string') {
return value;
}
if (Array.isArray(value)) {
return convertKeys(value);
}
if (typeof value === 'function') {
return '' + value;
}
if (typeof value[Symbols.serialize] === 'function') {
return toWireValue(value[Symbols.serialize]());
} else if (typeof value.toJSON === 'function') {
return toWireValue(value.toJSON());
}
return convertKeys(value);
} | [
"async",
"function",
"toWireValue",
"(",
"obj",
")",
"{",
"let",
"value",
"=",
"await",
"Promise",
".",
"resolve",
"(",
"obj",
")",
";",
"if",
"(",
"value",
"===",
"void",
"0",
"||",
"value",
"===",
"null",
")",
"{",
"return",
"value",
";",
"}",
"i... | Converts an object to its JSON representation in the WebDriver wire protocol.
When converting values of type object, the following steps will be taken:
<ol>
<li>if the object is a WebElement, the return value will be the element's
server ID
<li>if the object defines a {@link Symbols.serialize} method, this algorithm
will be recursively applied to the object's serialized representation
<li>if the object provides a "toJSON" function, this algorithm will
recursively be applied to the result of that function
<li>otherwise, the value of each key will be recursively converted according
to the rules above.
</ol>
@param {*} obj The object to convert.
@return {!Promise<?>} A promise that will resolve to the input value's JSON
representation. | [
"Converts",
"an",
"object",
"to",
"its",
"JSON",
"representation",
"in",
"the",
"WebDriver",
"wire",
"protocol",
".",
"When",
"converting",
"values",
"of",
"type",
"object",
"the",
"following",
"steps",
"will",
"be",
"taken",
":",
"<ol",
">",
"<li",
">",
"... | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/node/selenium-webdriver/lib/webdriver.js#L137-L163 | train | Convert object to wire value | [
30522,
2004,
6038,
2278,
3853,
15805,
7442,
10175,
5657,
1006,
27885,
3501,
1007,
1063,
2292,
3643,
1027,
26751,
4872,
1012,
10663,
1006,
27885,
3501,
1007,
1025,
2065,
1006,
3643,
1027,
1027,
1027,
11675,
1014,
1064,
1064,
3643,
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... |
eslint/eslint | lib/rules/accessor-pairs.js | isArgumentOfMethodCall | function isArgumentOfMethodCall(node, index, object, property) {
const parent = node.parent;
return (
parent.type === "CallExpression" &&
parent.callee.type === "MemberExpression" &&
parent.callee.computed === false &&
isIdentifier(parent.callee.object, object) &&
isIdentifier(parent.callee.property, property) &&
parent.arguments[index] === node
);
} | javascript | function isArgumentOfMethodCall(node, index, object, property) {
const parent = node.parent;
return (
parent.type === "CallExpression" &&
parent.callee.type === "MemberExpression" &&
parent.callee.computed === false &&
isIdentifier(parent.callee.object, object) &&
isIdentifier(parent.callee.property, property) &&
parent.arguments[index] === node
);
} | [
"function",
"isArgumentOfMethodCall",
"(",
"node",
",",
"index",
",",
"object",
",",
"property",
")",
"{",
"const",
"parent",
"=",
"node",
".",
"parent",
";",
"return",
"(",
"parent",
".",
"type",
"===",
"\"CallExpression\"",
"&&",
"parent",
".",
"callee",
... | Checks whether or not a given node is an argument of a specified method call.
@param {ASTNode} node - A node to check.
@param {number} index - An expected index of the node in arguments.
@param {string} object - An expected name of the object of the method.
@param {string} property - An expected name of the method.
@returns {boolean} `true` if the node is an argument of the specified method call. | [
"Checks",
"whether",
"or",
"not",
"a",
"given",
"node",
"is",
"an",
"argument",
"of",
"a",
"specified",
"method",
"call",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/accessor-pairs.js#L30-L41 | train | Checks whether the argument of a call expression is an argument of a method call. | [
30522,
3853,
18061,
10623,
27417,
3406,
16715,
11031,
7716,
9289,
2140,
1006,
13045,
1010,
5950,
1010,
4874,
1010,
3200,
1007,
1063,
9530,
3367,
6687,
1027,
13045,
1012,
6687,
1025,
2709,
1006,
6687,
1012,
2828,
1027,
1027,
1027,
1000,
2655... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
firebase/firebase-js-sdk | packages/auth/gulpfile.js | createBuildTask | function createBuildTask(filename, prefix, suffix) {
return () =>
gulp
.src([
`${closureLibRoot}/closure/goog/**/*.js`,
`${closureLibRoot}/third_party/closure/goog/**/*.js`,
'src/**/*.js'
], { base: '.' })
.pipe(sourcemaps.init())
.pipe(
closureCompiler({
js_output_file: filename,
output_wrapper: `${prefix}%output%${suffix}`,
entry_point: 'fireauth.exports',
compilation_level: OPTIMIZATION_LEVEL,
externs: [
'externs/externs.js',
'externs/grecaptcha.js',
'externs/gapi.iframes.js',
path.resolve(
__dirname,
'../firebase/externs/firebase-app-externs.js'
),
path.resolve(
__dirname,
'../firebase/externs/firebase-error-externs.js'
),
path.resolve(
__dirname,
'../firebase/externs/firebase-app-internal-externs.js'
)
],
language_out: 'ES5',
only_closure_dependencies: true
})
)
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('dist'));
} | javascript | function createBuildTask(filename, prefix, suffix) {
return () =>
gulp
.src([
`${closureLibRoot}/closure/goog/**/*.js`,
`${closureLibRoot}/third_party/closure/goog/**/*.js`,
'src/**/*.js'
], { base: '.' })
.pipe(sourcemaps.init())
.pipe(
closureCompiler({
js_output_file: filename,
output_wrapper: `${prefix}%output%${suffix}`,
entry_point: 'fireauth.exports',
compilation_level: OPTIMIZATION_LEVEL,
externs: [
'externs/externs.js',
'externs/grecaptcha.js',
'externs/gapi.iframes.js',
path.resolve(
__dirname,
'../firebase/externs/firebase-app-externs.js'
),
path.resolve(
__dirname,
'../firebase/externs/firebase-error-externs.js'
),
path.resolve(
__dirname,
'../firebase/externs/firebase-app-internal-externs.js'
)
],
language_out: 'ES5',
only_closure_dependencies: true
})
)
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('dist'));
} | [
"function",
"createBuildTask",
"(",
"filename",
",",
"prefix",
",",
"suffix",
")",
"{",
"return",
"(",
")",
"=>",
"gulp",
".",
"src",
"(",
"[",
"`",
"${",
"closureLibRoot",
"}",
"`",
",",
"`",
"${",
"closureLibRoot",
"}",
"`",
",",
"'src/**/*.js'",
"]"... | Builds the core Firebase-auth JS.
@param {string} filename name of the generated file
@param {string} prefix prefix to the compiled code
@param {string} suffix suffix to the compiled code | [
"Builds",
"the",
"core",
"Firebase",
"-",
"auth",
"JS",
"."
] | 491598a499813dacc23724de5e237ec220cc560e | https://github.com/firebase/firebase-js-sdk/blob/491598a499813dacc23724de5e237ec220cc560e/packages/auth/gulpfile.js#L49-L87 | train | Create a build task | [
30522,
3853,
3443,
8569,
4014,
11927,
19895,
1006,
5371,
18442,
1010,
17576,
1010,
16809,
1007,
1063,
2709,
1006,
1007,
1027,
1028,
26546,
1012,
5034,
2278,
1006,
1031,
1036,
1002,
1063,
8503,
29521,
3217,
4140,
1065,
1013,
8503,
1013,
2757... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | isLeftEdgeOf | function isLeftEdgeOf(node, ancestor) {
while (node && node !== ancestor) {
if (position(node) !== 0) {
return false;
}
node = node.parentNode;
}
return true;
} | javascript | function isLeftEdgeOf(node, ancestor) {
while (node && node !== ancestor) {
if (position(node) !== 0) {
return false;
}
node = node.parentNode;
}
return true;
} | [
"function",
"isLeftEdgeOf",
"(",
"node",
",",
"ancestor",
")",
"{",
"while",
"(",
"node",
"&&",
"node",
"!==",
"ancestor",
")",
"{",
"if",
"(",
"position",
"(",
"node",
")",
"!==",
"0",
")",
"{",
"return",
"false",
";",
"}",
"node",
"=",
"node",
".... | returns whether node is left edge of ancestor or not.
@param {Node} node
@param {Node} ancestor
@return {Boolean} | [
"returns",
"whether",
"node",
"is",
"left",
"edge",
"of",
"ancestor",
"or",
"not",
"."
] | 8dcafb8107453006b905ef697a529c42e76beb3f | https://github.com/summernote/summernote/blob/8dcafb8107453006b905ef697a529c42e76beb3f/src/js/base/core/dom.js#L453-L462 | train | Returns true if node is the left edge of ancestor | [
30522,
3853,
8842,
18915,
3351,
11253,
1006,
13045,
1010,
13032,
1007,
1063,
2096,
1006,
13045,
1004,
1004,
13045,
999,
1027,
1027,
13032,
1007,
1063,
2065,
1006,
2597,
1006,
13045,
1007,
999,
1027,
1027,
1014,
1007,
1063,
2709,
6270,
1025,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/project/ProjectManager.js | processItem | function processItem(path) {
var deferred = new $.Deferred(),
fileEntry = FileSystem.getDirectoryForPath(path);
fileEntry.exists(function (err, exists) {
if (!err && exists) {
deferred.resolve();
} else {
deferred.reject();
}
});
return deferred.promise();
} | javascript | function processItem(path) {
var deferred = new $.Deferred(),
fileEntry = FileSystem.getDirectoryForPath(path);
fileEntry.exists(function (err, exists) {
if (!err && exists) {
deferred.resolve();
} else {
deferred.reject();
}
});
return deferred.promise();
} | [
"function",
"processItem",
"(",
"path",
")",
"{",
"var",
"deferred",
"=",
"new",
"$",
".",
"Deferred",
"(",
")",
",",
"fileEntry",
"=",
"FileSystem",
".",
"getDirectoryForPath",
"(",
"path",
")",
";",
"fileEntry",
".",
"exists",
"(",
"function",
"(",
"er... | Helper func for Async.firstSequentially() | [
"Helper",
"func",
"for",
"Async",
".",
"firstSequentially",
"()"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/project/ProjectManager.js#L748-L761 | train | processItem - process item | [
30522,
3853,
2832,
4221,
2213,
1006,
4130,
1007,
1063,
13075,
13366,
28849,
2094,
1027,
2047,
1002,
1012,
13366,
28849,
2094,
1006,
1007,
1010,
5371,
4765,
2854,
1027,
6764,
27268,
6633,
1012,
2131,
4305,
2890,
16761,
2100,
29278,
15069,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.commons/src/sap/ui/commons/RoadMapRenderer.js | function(rm, oRoadMap, oStep, aAdditionalClasses, fAddAdditionalBoxContent, sId){
rm.write("<li");
if (sId) { //Write the given Id if available, otherwise use writeControlData
rm.writeAttribute("id", sId);
} else {
rm.writeElementData(oStep);
}
var sStepName = getStepName(oRoadMap, oStep);
oStep.__stepName = sStepName;
var sTooltip = getStepTooltip(oStep);
rm.addClass("sapUiRoadMapContent");
rm.addClass("sapUiRoadMapStep");
if (!oStep.getVisible()) {
rm.addClass("sapUiRoadMapHidden");
}
if (oStep.getEnabled()) {
if (oRoadMap.getSelectedStep() == oStep.getId()) {
rm.addClass("sapUiRoadMapSelected");
}
} else {
rm.addClass("sapUiRoadMapDisabled");
}
if (aAdditionalClasses) { //Write additional CSS classes if available
for (var i = 0; i < aAdditionalClasses.length; i++) {
rm.addClass(aAdditionalClasses[i]);
}
}
rm.writeClasses();
rm.write(">");
renderAdditionalStyleElem(rm, sId ? sId : oStep.getId(), 1);
rm.write("<div");
rm.writeAttribute("id", (sId ? sId : oStep.getId()) + "-box");
rm.writeAttribute("tabindex", "-1");
rm.addClass("sapUiRoadMapStepBox");
rm.writeClasses();
rm.writeAttributeEscaped("title", sTooltip);
writeStepAria(rm, oRoadMap, oStep, fAddAdditionalBoxContent ? true : false);
rm.write("><span>");
rm.write(sStepName);
rm.write("</span>");
//Call callback function to render additional content
if (fAddAdditionalBoxContent) {
fAddAdditionalBoxContent(rm, oRoadMap, oStep);
}
rm.write("</div>");
rm.write("<label");
rm.writeAttribute("id", (sId ? sId : oStep.getId()) + "-label");
rm.addClass("sapUiRoadMapTitle");
rm.writeAttributeEscaped("title", sTooltip);
rm.writeClasses();
rm.write(">");
var sLabel = oStep.getLabel();
if (sLabel) {
rm.writeEscaped(sLabel);
}
rm.write("</label>");
renderAdditionalStyleElem(rm, sId ? sId : oStep.getId(), 2);
rm.write("</li>");
} | javascript | function(rm, oRoadMap, oStep, aAdditionalClasses, fAddAdditionalBoxContent, sId){
rm.write("<li");
if (sId) { //Write the given Id if available, otherwise use writeControlData
rm.writeAttribute("id", sId);
} else {
rm.writeElementData(oStep);
}
var sStepName = getStepName(oRoadMap, oStep);
oStep.__stepName = sStepName;
var sTooltip = getStepTooltip(oStep);
rm.addClass("sapUiRoadMapContent");
rm.addClass("sapUiRoadMapStep");
if (!oStep.getVisible()) {
rm.addClass("sapUiRoadMapHidden");
}
if (oStep.getEnabled()) {
if (oRoadMap.getSelectedStep() == oStep.getId()) {
rm.addClass("sapUiRoadMapSelected");
}
} else {
rm.addClass("sapUiRoadMapDisabled");
}
if (aAdditionalClasses) { //Write additional CSS classes if available
for (var i = 0; i < aAdditionalClasses.length; i++) {
rm.addClass(aAdditionalClasses[i]);
}
}
rm.writeClasses();
rm.write(">");
renderAdditionalStyleElem(rm, sId ? sId : oStep.getId(), 1);
rm.write("<div");
rm.writeAttribute("id", (sId ? sId : oStep.getId()) + "-box");
rm.writeAttribute("tabindex", "-1");
rm.addClass("sapUiRoadMapStepBox");
rm.writeClasses();
rm.writeAttributeEscaped("title", sTooltip);
writeStepAria(rm, oRoadMap, oStep, fAddAdditionalBoxContent ? true : false);
rm.write("><span>");
rm.write(sStepName);
rm.write("</span>");
//Call callback function to render additional content
if (fAddAdditionalBoxContent) {
fAddAdditionalBoxContent(rm, oRoadMap, oStep);
}
rm.write("</div>");
rm.write("<label");
rm.writeAttribute("id", (sId ? sId : oStep.getId()) + "-label");
rm.addClass("sapUiRoadMapTitle");
rm.writeAttributeEscaped("title", sTooltip);
rm.writeClasses();
rm.write(">");
var sLabel = oStep.getLabel();
if (sLabel) {
rm.writeEscaped(sLabel);
}
rm.write("</label>");
renderAdditionalStyleElem(rm, sId ? sId : oStep.getId(), 2);
rm.write("</li>");
} | [
"function",
"(",
"rm",
",",
"oRoadMap",
",",
"oStep",
",",
"aAdditionalClasses",
",",
"fAddAdditionalBoxContent",
",",
"sId",
")",
"{",
"rm",
".",
"write",
"(",
"\"<li\"",
")",
";",
"if",
"(",
"sId",
")",
"{",
"//Write the given Id if available, otherwise use wr... | Writes the step HTML into the rendermanger | [
"Writes",
"the",
"step",
"HTML",
"into",
"the",
"rendermanger"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.commons/src/sap/ui/commons/RoadMapRenderer.js#L555-L624 | train | Writes the given control to the rendermanger | [
30522,
3853,
1006,
28549,
1010,
20298,
4215,
2863,
2361,
1010,
9808,
2618,
2361,
1010,
9779,
14141,
22753,
2389,
26266,
2229,
1010,
6904,
25062,
14141,
22753,
2389,
8758,
8663,
6528,
2102,
1010,
15765,
1007,
1063,
28549,
1012,
4339,
1006,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
eslint/eslint | lib/rules/comma-style.js | validateCommaItemSpacing | function validateCommaItemSpacing(previousItemToken, commaToken, currentItemToken, reportItem) {
// if single line
if (astUtils.isTokenOnSameLine(commaToken, currentItemToken) &&
astUtils.isTokenOnSameLine(previousItemToken, commaToken)) {
// do nothing.
} else if (!astUtils.isTokenOnSameLine(commaToken, currentItemToken) &&
!astUtils.isTokenOnSameLine(previousItemToken, commaToken)) {
const comment = sourceCode.getCommentsAfter(commaToken)[0];
const styleType = comment && comment.type === "Block" && astUtils.isTokenOnSameLine(commaToken, comment)
? style
: "between";
// lone comma
context.report({
node: reportItem,
loc: {
line: commaToken.loc.end.line,
column: commaToken.loc.start.column
},
messageId: "unexpectedLineBeforeAndAfterComma",
fix: getFixerFunction(styleType, previousItemToken, commaToken, currentItemToken)
});
} else if (style === "first" && !astUtils.isTokenOnSameLine(commaToken, currentItemToken)) {
context.report({
node: reportItem,
messageId: "expectedCommaFirst",
fix: getFixerFunction(style, previousItemToken, commaToken, currentItemToken)
});
} else if (style === "last" && astUtils.isTokenOnSameLine(commaToken, currentItemToken)) {
context.report({
node: reportItem,
loc: {
line: commaToken.loc.end.line,
column: commaToken.loc.end.column
},
messageId: "expectedCommaLast",
fix: getFixerFunction(style, previousItemToken, commaToken, currentItemToken)
});
}
} | javascript | function validateCommaItemSpacing(previousItemToken, commaToken, currentItemToken, reportItem) {
// if single line
if (astUtils.isTokenOnSameLine(commaToken, currentItemToken) &&
astUtils.isTokenOnSameLine(previousItemToken, commaToken)) {
// do nothing.
} else if (!astUtils.isTokenOnSameLine(commaToken, currentItemToken) &&
!astUtils.isTokenOnSameLine(previousItemToken, commaToken)) {
const comment = sourceCode.getCommentsAfter(commaToken)[0];
const styleType = comment && comment.type === "Block" && astUtils.isTokenOnSameLine(commaToken, comment)
? style
: "between";
// lone comma
context.report({
node: reportItem,
loc: {
line: commaToken.loc.end.line,
column: commaToken.loc.start.column
},
messageId: "unexpectedLineBeforeAndAfterComma",
fix: getFixerFunction(styleType, previousItemToken, commaToken, currentItemToken)
});
} else if (style === "first" && !astUtils.isTokenOnSameLine(commaToken, currentItemToken)) {
context.report({
node: reportItem,
messageId: "expectedCommaFirst",
fix: getFixerFunction(style, previousItemToken, commaToken, currentItemToken)
});
} else if (style === "last" && astUtils.isTokenOnSameLine(commaToken, currentItemToken)) {
context.report({
node: reportItem,
loc: {
line: commaToken.loc.end.line,
column: commaToken.loc.end.column
},
messageId: "expectedCommaLast",
fix: getFixerFunction(style, previousItemToken, commaToken, currentItemToken)
});
}
} | [
"function",
"validateCommaItemSpacing",
"(",
"previousItemToken",
",",
"commaToken",
",",
"currentItemToken",
",",
"reportItem",
")",
"{",
"// if single line",
"if",
"(",
"astUtils",
".",
"isTokenOnSameLine",
"(",
"commaToken",
",",
"currentItemToken",
")",
"&&",
"ast... | Validates the spacing around single items in lists.
@param {Token} previousItemToken The last token from the previous item.
@param {Token} commaToken The token representing the comma.
@param {Token} currentItemToken The first token of the current item.
@param {Token} reportItem The item to use when reporting an error.
@returns {void}
@private | [
"Validates",
"the",
"spacing",
"around",
"single",
"items",
"in",
"lists",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/comma-style.js#L130-L177 | train | Validate spacing between comma and current item | [
30522,
3853,
9398,
3686,
9006,
2863,
4221,
5244,
19498,
2075,
1006,
3025,
4221,
20492,
11045,
2078,
1010,
4012,
18900,
11045,
2078,
1010,
2783,
4221,
20492,
11045,
2078,
1010,
3189,
4221,
2213,
1007,
1063,
1013,
1013,
2065,
2309,
2240,
2065... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.commons/src/sap/ui/commons/layout/AbsoluteLayout.js | function(aPositions) {
for (var index = 0; index < aPositions.length; index++) {
var oPosition = aPositions[index];
var oChildControl = oPosition.getControl();
if (oChildControl) {
AbsoluteLayout.cleanUpControl(oChildControl);
}
}
} | javascript | function(aPositions) {
for (var index = 0; index < aPositions.length; index++) {
var oPosition = aPositions[index];
var oChildControl = oPosition.getControl();
if (oChildControl) {
AbsoluteLayout.cleanUpControl(oChildControl);
}
}
} | [
"function",
"(",
"aPositions",
")",
"{",
"for",
"(",
"var",
"index",
"=",
"0",
";",
"index",
"<",
"aPositions",
".",
"length",
";",
"index",
"++",
")",
"{",
"var",
"oPosition",
"=",
"aPositions",
"[",
"index",
"]",
";",
"var",
"oChildControl",
"=",
"... | Cleanup modifications of all child controls of the given positions.
@private | [
"Cleanup",
"modifications",
"of",
"all",
"child",
"controls",
"of",
"the",
"given",
"positions",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.commons/src/sap/ui/commons/layout/AbsoluteLayout.js#L520-L528 | train | clean up the control that is not part of the layout | [
30522,
3853,
1006,
9706,
19234,
2015,
1007,
1063,
2005,
1006,
13075,
5950,
1027,
1014,
1025,
5950,
1026,
9706,
19234,
2015,
1012,
3091,
1025,
5950,
1009,
1009,
1007,
1063,
13075,
6728,
19234,
1027,
9706,
19234,
2015,
1031,
5950,
1033,
1025,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SeleniumHQ/selenium | javascript/selenium-core/scripts/htmlutils.js | function( time, type ) {
time = jQuery.fx ? jQuery.fx.speeds[time] || time : time;
type = type || "fx";
return this.queue( type, function() {
var elem = this;
setTimeout(function() {
jQuery.dequeue( elem, type );
}, time );
});
} | javascript | function( time, type ) {
time = jQuery.fx ? jQuery.fx.speeds[time] || time : time;
type = type || "fx";
return this.queue( type, function() {
var elem = this;
setTimeout(function() {
jQuery.dequeue( elem, type );
}, time );
});
} | [
"function",
"(",
"time",
",",
"type",
")",
"{",
"time",
"=",
"jQuery",
".",
"fx",
"?",
"jQuery",
".",
"fx",
".",
"speeds",
"[",
"time",
"]",
"||",
"time",
":",
"time",
";",
"type",
"=",
"type",
"||",
"\"fx\"",
";",
"return",
"this",
".",
"queue",... | Based off of the plugin by Clint Helfers, with permission. http://blindsignals.com/index.php/2009/07/jquery-delay/ | [
"Based",
"off",
"of",
"the",
"plugin",
"by",
"Clint",
"Helfers",
"with",
"permission",
".",
"http",
":",
"//",
"blindsignals",
".",
"com",
"/",
"index",
".",
"php",
"/",
"2009",
"/",
"07",
"/",
"jquery",
"-",
"delay",
"/"
] | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/selenium-core/scripts/htmlutils.js#L3778-L3788 | train | set timeout | [
30522,
3853,
1006,
2051,
1010,
2828,
1007,
1063,
2051,
1027,
1046,
4226,
2854,
1012,
23292,
1029,
1046,
4226,
2854,
1012,
23292,
1012,
10898,
1031,
2051,
1033,
1064,
1064,
2051,
1024,
2051,
1025,
2828,
1027,
2828,
1064,
1064,
1000,
23292,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
adobe/brackets | src/LiveDevelopment/MultiBrowserImpl/protocol/remote/LiveDevProtocolRemote.js | function (msg) {
var i,
sheet,
text = "";
for (i = 0; i < window.document.styleSheets.length; i++) {
sheet = window.document.styleSheets[i];
// if it was already 'reloaded'
if (sheet.ownerNode.id === msg.params.url) {
text = sheet.ownerNode.textContent;
} else if (sheet.href === msg.params.url && !sheet.disabled) {
var j,
rules;
// Deal with Firefox's SecurityError when accessing sheets
// from other domains, and Chrome returning `undefined`.
try {
rules = window.document.styleSheets[i].cssRules;
} catch (e) {
if (e.name !== "SecurityError") {
throw e;
}
}
if (!rules) {
return;
}
for (j = 0; j < rules.length; j++) {
text += rules[j].cssText + '\n';
}
}
}
MessageBroker.respond(msg, {
text: text
});
} | javascript | function (msg) {
var i,
sheet,
text = "";
for (i = 0; i < window.document.styleSheets.length; i++) {
sheet = window.document.styleSheets[i];
// if it was already 'reloaded'
if (sheet.ownerNode.id === msg.params.url) {
text = sheet.ownerNode.textContent;
} else if (sheet.href === msg.params.url && !sheet.disabled) {
var j,
rules;
// Deal with Firefox's SecurityError when accessing sheets
// from other domains, and Chrome returning `undefined`.
try {
rules = window.document.styleSheets[i].cssRules;
} catch (e) {
if (e.name !== "SecurityError") {
throw e;
}
}
if (!rules) {
return;
}
for (j = 0; j < rules.length; j++) {
text += rules[j].cssText + '\n';
}
}
}
MessageBroker.respond(msg, {
text: text
});
} | [
"function",
"(",
"msg",
")",
"{",
"var",
"i",
",",
"sheet",
",",
"text",
"=",
"\"\"",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"window",
".",
"document",
".",
"styleSheets",
".",
"length",
";",
"i",
"++",
")",
"{",
"sheet",
"=",
"window",... | retrieves the content of the stylesheet
TODO: it now depends on reloadCSS implementation | [
"retrieves",
"the",
"content",
"of",
"the",
"stylesheet",
"TODO",
":",
"it",
"now",
"depends",
"on",
"reloadCSS",
"implementation"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/LiveDevelopment/MultiBrowserImpl/protocol/remote/LiveDevProtocolRemote.js#L193-L228 | train | Aliquivo a un url | [
30522,
3853,
1006,
5796,
2290,
1007,
1063,
13075,
1045,
1010,
7123,
1010,
3793,
1027,
1000,
1000,
1025,
2005,
1006,
1045,
1027,
1014,
1025,
1045,
1026,
3332,
1012,
6254,
1012,
6782,
21030,
3215,
1012,
3091,
1025,
1045,
1009,
1009,
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... | |
adobe/brackets | src/extensions/default/InlineTimingFunctionEditor/BezierCurveEditor.js | _pointMouseMove | function _pointMouseMove(e) {
var self = e.target,
bezierEditor = self.bezierEditor,
curveBoundingBox = bezierEditor._getCurveBoundingBox(),
left = curveBoundingBox.left,
top = curveBoundingBox.top,
x = e.pageX - left,
y = e.pageY - top - HEIGHT_ABOVE;
updateTimeProgression(bezierEditor.curve, x, y);
if (e.pageX === 0 && e.pageY === 0) {
return;
}
handlePointMove(e, x, y);
} | javascript | function _pointMouseMove(e) {
var self = e.target,
bezierEditor = self.bezierEditor,
curveBoundingBox = bezierEditor._getCurveBoundingBox(),
left = curveBoundingBox.left,
top = curveBoundingBox.top,
x = e.pageX - left,
y = e.pageY - top - HEIGHT_ABOVE;
updateTimeProgression(bezierEditor.curve, x, y);
if (e.pageX === 0 && e.pageY === 0) {
return;
}
handlePointMove(e, x, y);
} | [
"function",
"_pointMouseMove",
"(",
"e",
")",
"{",
"var",
"self",
"=",
"e",
".",
"target",
",",
"bezierEditor",
"=",
"self",
".",
"bezierEditor",
",",
"curveBoundingBox",
"=",
"bezierEditor",
".",
"_getCurveBoundingBox",
"(",
")",
",",
"left",
"=",
"curveBou... | Handle mouse move in <button> element
@param {Event} e Mouse move event | [
"Handle",
"mouse",
"move",
"in",
"<button",
">",
"element"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/InlineTimingFunctionEditor/BezierCurveEditor.js#L384-L400 | train | handle point mouse move | [
30522,
3853,
1035,
2391,
27711,
6633,
21818,
1006,
1041,
1007,
1063,
13075,
2969,
1027,
1041,
1012,
4539,
1010,
2022,
21548,
2098,
15660,
1027,
2969,
1012,
2022,
21548,
2098,
15660,
1010,
7774,
15494,
2075,
8758,
1027,
2022,
21548,
2098,
15... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/controllers/controller.doughnut.js | function(arcs) {
var me = this;
var max = 0;
var chart = me.chart;
var i, ilen, meta, arc, controller, options, borderWidth, hoverWidth;
if (!arcs) {
// Find the outmost visible dataset
for (i = 0, ilen = chart.data.datasets.length; i < ilen; ++i) {
if (chart.isDatasetVisible(i)) {
meta = chart.getDatasetMeta(i);
arcs = meta.data;
if (i !== me.index) {
controller = meta.controller;
}
break;
}
}
}
if (!arcs) {
return 0;
}
for (i = 0, ilen = arcs.length; i < ilen; ++i) {
arc = arcs[i];
if (controller) {
controller._configure();
options = controller._resolveElementOptions(arc, i);
} else {
options = arc._options;
}
if (options.borderAlign !== 'inner') {
borderWidth = options.borderWidth;
hoverWidth = options.hoverBorderWidth;
max = borderWidth > max ? borderWidth : max;
max = hoverWidth > max ? hoverWidth : max;
}
}
return max;
} | javascript | function(arcs) {
var me = this;
var max = 0;
var chart = me.chart;
var i, ilen, meta, arc, controller, options, borderWidth, hoverWidth;
if (!arcs) {
// Find the outmost visible dataset
for (i = 0, ilen = chart.data.datasets.length; i < ilen; ++i) {
if (chart.isDatasetVisible(i)) {
meta = chart.getDatasetMeta(i);
arcs = meta.data;
if (i !== me.index) {
controller = meta.controller;
}
break;
}
}
}
if (!arcs) {
return 0;
}
for (i = 0, ilen = arcs.length; i < ilen; ++i) {
arc = arcs[i];
if (controller) {
controller._configure();
options = controller._resolveElementOptions(arc, i);
} else {
options = arc._options;
}
if (options.borderAlign !== 'inner') {
borderWidth = options.borderWidth;
hoverWidth = options.hoverBorderWidth;
max = borderWidth > max ? borderWidth : max;
max = hoverWidth > max ? hoverWidth : max;
}
}
return max;
} | [
"function",
"(",
"arcs",
")",
"{",
"var",
"me",
"=",
"this",
";",
"var",
"max",
"=",
"0",
";",
"var",
"chart",
"=",
"me",
".",
"chart",
";",
"var",
"i",
",",
"ilen",
",",
"meta",
",",
"arc",
",",
"controller",
",",
"options",
",",
"borderWidth",
... | gets the max border or hover width to properly scale pie charts | [
"gets",
"the",
"max",
"border",
"or",
"hover",
"width",
"to",
"properly",
"scale",
"pie",
"charts"
] | f093c36574d290330ed623e60fbd070421c730d5 | https://github.com/chartjs/Chart.js/blob/f093c36574d290330ed623e60fbd070421c730d5/src/controllers/controller.doughnut.js#L292-L333 | train | Find the max visible dataset | [
30522,
30524,
3675,
9148,
11927,
2232,
1010,
25215,
2099,
9148,
11927,
2232,
1025,
2065,
1006,
999,
29137,
1007,
1063,
1013,
1013,
2424,
1996,
2041,
11800,
5710,
2951,
13462,
2005,
1006,
1045,
1027,
1014,
1010,
17869,
2078,
1027,
3673,
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/editor/MultiRangeInlineEditor.js | _getPrefsContext | function _getPrefsContext() {
var projectRoot = ProjectManager.getProjectRoot(); // note: null during unit tests!
return { location : { scope: "user", layer: "project", layerID: projectRoot && projectRoot.fullPath } };
} | javascript | function _getPrefsContext() {
var projectRoot = ProjectManager.getProjectRoot(); // note: null during unit tests!
return { location : { scope: "user", layer: "project", layerID: projectRoot && projectRoot.fullPath } };
} | [
"function",
"_getPrefsContext",
"(",
")",
"{",
"var",
"projectRoot",
"=",
"ProjectManager",
".",
"getProjectRoot",
"(",
")",
";",
"// note: null during unit tests!",
"return",
"{",
"location",
":",
"{",
"scope",
":",
"\"user\"",
",",
"layer",
":",
"\"project\"",
... | Returns a 'context' object for getting/setting project-specific preferences | [
"Returns",
"a",
"context",
"object",
"for",
"getting",
"/",
"setting",
"project",
"-",
"specific",
"preferences"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/editor/MultiRangeInlineEditor.js#L64-L67 | train | Get the context for the preferences file | [
30522,
3853,
1035,
2131,
28139,
10343,
8663,
18209,
1006,
1007,
1063,
13075,
2622,
3217,
4140,
1027,
2622,
24805,
4590,
1012,
2131,
21572,
20614,
3217,
4140,
1006,
1007,
1025,
1013,
1013,
3602,
1024,
19701,
2076,
3131,
5852,
999,
2709,
1063... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
airbnb/enzyme | packages/enzyme-adapter-react-16/src/findCurrentFiberUsingSlowPath.js | findCurrentFiberUsingSlowPath | function findCurrentFiberUsingSlowPath(fiber) {
const { alternate } = fiber;
if (!alternate) {
return fiber;
}
// If we have two possible branches, we'll walk backwards up to the root
// to see what path the root points to. On the way we may hit one of the
// special cases and we'll deal with them.
let a = fiber;
let b = alternate;
while (true) { // eslint-disable-line
const parentA = a.return;
const parentB = parentA ? parentA.alternate : null;
if (!parentA || !parentB) {
// We're at the root.
break;
}
// If both copies of the parent fiber point to the same child, we can
// assume that the child is current. This happens when we bailout on low
// priority: the bailed out fiber's child reuses the current child.
if (parentA.child === parentB.child) {
let { child } = parentA;
while (child) {
if (child === a) {
// We've determined that A is the current branch.
return fiber;
}
if (child === b) {
// We've determined that B is the current branch.
return alternate;
}
child = child.sibling;
}
// We should never have an alternate for any mounting node. So the only
// way this could possibly happen is if this was unmounted, if at all.
throw new Error('Unable to find node on an unmounted component.');
}
if (a.return !== b.return) {
// The return pointer of A and the return pointer of B point to different
// fibers. We assume that return pointers never criss-cross, so A must
// belong to the child set of A.return, and B must belong to the child
// set of B.return.
a = parentA;
b = parentB;
} else {
// The return pointers point to the same fiber. We'll have to use the
// default, slow path: scan the child sets of each parent alternate to see
// which child belongs to which set.
//
// Search parent A's child set
let didFindChild = false;
let { child } = parentA;
while (child) {
if (child === a) {
didFindChild = true;
a = parentA;
b = parentB;
break;
}
if (child === b) {
didFindChild = true;
b = parentA;
a = parentB;
break;
}
child = child.sibling;
}
if (!didFindChild) {
// Search parent B's child set
({ child } = parentB);
while (child) {
if (child === a) {
didFindChild = true;
a = parentB;
b = parentA;
break;
}
if (child === b) {
didFindChild = true;
b = parentB;
a = parentA;
break;
}
child = child.sibling;
}
if (!didFindChild) {
throw new Error('Child was not found in either parent set. This indicates a bug '
+ 'in React related to the return pointer. Please file an issue.');
}
}
}
}
if (a.stateNode.current === a) {
// We've determined that A is the current branch.
return fiber;
}
// Otherwise B has to be current branch.
return alternate;
} | javascript | function findCurrentFiberUsingSlowPath(fiber) {
const { alternate } = fiber;
if (!alternate) {
return fiber;
}
// If we have two possible branches, we'll walk backwards up to the root
// to see what path the root points to. On the way we may hit one of the
// special cases and we'll deal with them.
let a = fiber;
let b = alternate;
while (true) { // eslint-disable-line
const parentA = a.return;
const parentB = parentA ? parentA.alternate : null;
if (!parentA || !parentB) {
// We're at the root.
break;
}
// If both copies of the parent fiber point to the same child, we can
// assume that the child is current. This happens when we bailout on low
// priority: the bailed out fiber's child reuses the current child.
if (parentA.child === parentB.child) {
let { child } = parentA;
while (child) {
if (child === a) {
// We've determined that A is the current branch.
return fiber;
}
if (child === b) {
// We've determined that B is the current branch.
return alternate;
}
child = child.sibling;
}
// We should never have an alternate for any mounting node. So the only
// way this could possibly happen is if this was unmounted, if at all.
throw new Error('Unable to find node on an unmounted component.');
}
if (a.return !== b.return) {
// The return pointer of A and the return pointer of B point to different
// fibers. We assume that return pointers never criss-cross, so A must
// belong to the child set of A.return, and B must belong to the child
// set of B.return.
a = parentA;
b = parentB;
} else {
// The return pointers point to the same fiber. We'll have to use the
// default, slow path: scan the child sets of each parent alternate to see
// which child belongs to which set.
//
// Search parent A's child set
let didFindChild = false;
let { child } = parentA;
while (child) {
if (child === a) {
didFindChild = true;
a = parentA;
b = parentB;
break;
}
if (child === b) {
didFindChild = true;
b = parentA;
a = parentB;
break;
}
child = child.sibling;
}
if (!didFindChild) {
// Search parent B's child set
({ child } = parentB);
while (child) {
if (child === a) {
didFindChild = true;
a = parentB;
b = parentA;
break;
}
if (child === b) {
didFindChild = true;
b = parentB;
a = parentA;
break;
}
child = child.sibling;
}
if (!didFindChild) {
throw new Error('Child was not found in either parent set. This indicates a bug '
+ 'in React related to the return pointer. Please file an issue.');
}
}
}
}
if (a.stateNode.current === a) {
// We've determined that A is the current branch.
return fiber;
}
// Otherwise B has to be current branch.
return alternate;
} | [
"function",
"findCurrentFiberUsingSlowPath",
"(",
"fiber",
")",
"{",
"const",
"{",
"alternate",
"}",
"=",
"fiber",
";",
"if",
"(",
"!",
"alternate",
")",
"{",
"return",
"fiber",
";",
"}",
"// If we have two possible branches, we'll walk backwards up to the root",
"// ... | Extracted from https://github.com/facebook/react/blob/7bdf93b17a35a5d8fcf0ceae0bf48ed5e6b16688/src/renderers/shared/fiber/ReactFiberTreeReflection.js#L104-L228 | [
"Extracted",
"from",
"https",
":",
"//",
"github",
".",
"com",
"/",
"facebook",
"/",
"react",
"/",
"blob",
"/",
"7bdf93b17a35a5d8fcf0ceae0bf48ed5e6b16688",
"/",
"src",
"/",
"renderers",
"/",
"shared",
"/",
"fiber",
"/",
"ReactFiberTreeReflection",
".",
"js#L104"... | cd430eae95eba151f17e970ee77c18f09476de0e | https://github.com/airbnb/enzyme/blob/cd430eae95eba151f17e970ee77c18f09476de0e/packages/enzyme-adapter-react-16/src/findCurrentFiberUsingSlowPath.js#L2-L102 | train | Finds the current fiber using a slow path. | [
30522,
3853,
2424,
10841,
14343,
3372,
8873,
5677,
18161,
26338,
15069,
1006,
11917,
1007,
1063,
9530,
3367,
1063,
6585,
1065,
1027,
11917,
1025,
2065,
1006,
999,
6585,
1007,
1063,
2709,
11917,
1025,
1065,
1013,
1013,
2065,
2057,
2031,
2048... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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( elem ) {
if ( !elem || typeof elem === "string" ) {
return jQuery.inArray( this[0],
// If it receives a string, the selector is used
// If it receives nothing, the siblings are used
elem ? jQuery( elem ) : this.parent().children() );
}
// Locate the position of the desired element
return jQuery.inArray(
// If it receives a jQuery object, the first element is used
elem.jquery ? elem[0] : elem, this );
} | javascript | function( elem ) {
if ( !elem || typeof elem === "string" ) {
return jQuery.inArray( this[0],
// If it receives a string, the selector is used
// If it receives nothing, the siblings are used
elem ? jQuery( elem ) : this.parent().children() );
}
// Locate the position of the desired element
return jQuery.inArray(
// If it receives a jQuery object, the first element is used
elem.jquery ? elem[0] : elem, this );
} | [
"function",
"(",
"elem",
")",
"{",
"if",
"(",
"!",
"elem",
"||",
"typeof",
"elem",
"===",
"\"string\"",
")",
"{",
"return",
"jQuery",
".",
"inArray",
"(",
"this",
"[",
"0",
"]",
",",
"// If it receives a string, the selector is used",
"// If it receives nothing,... | Determine the position of an element within the matched set of elements | [
"Determine",
"the",
"position",
"of",
"an",
"element",
"within",
"the",
"matched",
"set",
"of",
"elements"
] | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/selenium-core/scripts/htmlutils.js#L6312-L6323 | train | Locate the position of the element in the DOM | [
30522,
3853,
1006,
3449,
6633,
1007,
1063,
2065,
1006,
999,
3449,
6633,
1064,
1064,
2828,
11253,
3449,
6633,
1027,
1027,
1027,
1000,
5164,
1000,
1007,
1063,
2709,
1046,
4226,
2854,
1012,
27118,
11335,
2100,
1006,
2023,
1031,
1014,
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... | |
adobe/brackets | src/extensions/default/AutoUpdate/main.js | function () {
// Restart button click handler
var restartBtnClicked = function () {
HealthLogger.sendAnalyticsData(
autoUpdateEventNames.AUTOUPDATE_DOWNLOAD_COMPLETE_USER_CLICK_RESTART,
"autoUpdate",
"installNotification",
"installNow ",
"click"
);
detachUpdateBarBtnHandlers();
initiateUpdateProcess(statusObj.installerPath, statusObj.logFilePath, statusObj.installStatusFilePath);
};
// Later button click handler
var laterBtnClicked = function () {
HealthLogger.sendAnalyticsData(
autoUpdateEventNames.AUTOUPDATE_DOWNLOAD_COMPLETE_USER_CLICK_LATER,
"autoUpdate",
"installNotification",
"cancel",
"click"
);
detachUpdateBarBtnHandlers();
setUpdateStateInJSON('updateInitiatedInPrevSession', false);
};
//attaching UpdateBar handlers
UpdateInfoBar.on(UpdateInfoBar.RESTART_BTN_CLICKED, restartBtnClicked);
UpdateInfoBar.on(UpdateInfoBar.LATER_BTN_CLICKED, laterBtnClicked);
UpdateInfoBar.showUpdateBar({
title: Strings.DOWNLOAD_COMPLETE,
description: Strings.CLICK_RESTART_TO_UPDATE,
needButtons: true
});
setUpdateStateInJSON("autoUpdateInProgress", false);
HealthLogger.sendAnalyticsData(
autoUpdateEventNames.AUTOUPDATE_DOWNLOADCOMPLETE_UPDATE_BAR_RENDERED,
"autoUpdate",
"installNotification",
"render",
""
);
} | javascript | function () {
// Restart button click handler
var restartBtnClicked = function () {
HealthLogger.sendAnalyticsData(
autoUpdateEventNames.AUTOUPDATE_DOWNLOAD_COMPLETE_USER_CLICK_RESTART,
"autoUpdate",
"installNotification",
"installNow ",
"click"
);
detachUpdateBarBtnHandlers();
initiateUpdateProcess(statusObj.installerPath, statusObj.logFilePath, statusObj.installStatusFilePath);
};
// Later button click handler
var laterBtnClicked = function () {
HealthLogger.sendAnalyticsData(
autoUpdateEventNames.AUTOUPDATE_DOWNLOAD_COMPLETE_USER_CLICK_LATER,
"autoUpdate",
"installNotification",
"cancel",
"click"
);
detachUpdateBarBtnHandlers();
setUpdateStateInJSON('updateInitiatedInPrevSession', false);
};
//attaching UpdateBar handlers
UpdateInfoBar.on(UpdateInfoBar.RESTART_BTN_CLICKED, restartBtnClicked);
UpdateInfoBar.on(UpdateInfoBar.LATER_BTN_CLICKED, laterBtnClicked);
UpdateInfoBar.showUpdateBar({
title: Strings.DOWNLOAD_COMPLETE,
description: Strings.CLICK_RESTART_TO_UPDATE,
needButtons: true
});
setUpdateStateInJSON("autoUpdateInProgress", false);
HealthLogger.sendAnalyticsData(
autoUpdateEventNames.AUTOUPDATE_DOWNLOADCOMPLETE_UPDATE_BAR_RENDERED,
"autoUpdate",
"installNotification",
"render",
""
);
} | [
"function",
"(",
")",
"{",
"// Restart button click handler",
"var",
"restartBtnClicked",
"=",
"function",
"(",
")",
"{",
"HealthLogger",
".",
"sendAnalyticsData",
"(",
"autoUpdateEventNames",
".",
"AUTOUPDATE_DOWNLOAD_COMPLETE_USER_CLICK_RESTART",
",",
"\"autoUpdate\"",
",... | Installer is validated successfully | [
"Installer",
"is",
"validated",
"successfully"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/AutoUpdate/main.js#L911-L957 | train | This function is called when the user clicks the restart button and the user clicks the later button | [
30522,
3853,
1006,
1007,
1063,
1013,
1013,
23818,
6462,
11562,
28213,
13075,
23818,
19279,
12273,
25230,
2098,
1027,
3853,
1006,
1007,
1063,
2740,
21197,
4590,
1012,
4604,
27953,
21252,
16150,
6790,
1006,
8285,
6279,
13701,
18697,
3372,
18442... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
nodejs/node-gyp | lib/configure.js | findAccessibleSync | function findAccessibleSync (logprefix, dir, candidates) {
for (var next = 0; next < candidates.length; next++) {
var candidate = path.resolve(dir, candidates[next])
try {
var fd = fs.openSync(candidate, 'r')
} catch (e) {
// this candidate was not found or not readable, do nothing
log.silly(logprefix, 'Could not open %s: %s', candidate, e.message)
continue
}
fs.closeSync(fd)
log.silly(logprefix, 'Found readable %s', candidate)
return candidate
}
return undefined
} | javascript | function findAccessibleSync (logprefix, dir, candidates) {
for (var next = 0; next < candidates.length; next++) {
var candidate = path.resolve(dir, candidates[next])
try {
var fd = fs.openSync(candidate, 'r')
} catch (e) {
// this candidate was not found or not readable, do nothing
log.silly(logprefix, 'Could not open %s: %s', candidate, e.message)
continue
}
fs.closeSync(fd)
log.silly(logprefix, 'Found readable %s', candidate)
return candidate
}
return undefined
} | [
"function",
"findAccessibleSync",
"(",
"logprefix",
",",
"dir",
",",
"candidates",
")",
"{",
"for",
"(",
"var",
"next",
"=",
"0",
";",
"next",
"<",
"candidates",
".",
"length",
";",
"next",
"++",
")",
"{",
"var",
"candidate",
"=",
"path",
".",
"resolve... | Returns the first file or directory from an array of candidates that is
readable by the current user, or undefined if none of the candidates are
readable. | [
"Returns",
"the",
"first",
"file",
"or",
"directory",
"from",
"an",
"array",
"of",
"candidates",
"that",
"is",
"readable",
"by",
"the",
"current",
"user",
"or",
"undefined",
"if",
"none",
"of",
"the",
"candidates",
"are",
"readable",
"."
] | 721eb691cf15556cc2700eda0558d5bad5f84232 | https://github.com/nodejs/node-gyp/blob/721eb691cf15556cc2700eda0558d5bad5f84232/lib/configure.js#L350-L366 | train | Find a readable file in a directory | [
30522,
3853,
2424,
6305,
9623,
19307,
6508,
12273,
1006,
8833,
28139,
8873,
2595,
1010,
16101,
1010,
5347,
1007,
1063,
2005,
1006,
13075,
2279,
1027,
1014,
1025,
2279,
1026,
5347,
1012,
3091,
1025,
2279,
1009,
1009,
1007,
1063,
13075,
4018,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
angular/material | src/components/autocomplete/js/autocompleteController.js | getItemAsNameVal | function getItemAsNameVal (item) {
if (!item) {
return undefined;
}
var locals = {};
if (ctrl.itemName) {
locals[ ctrl.itemName ] = item;
}
return locals;
} | javascript | function getItemAsNameVal (item) {
if (!item) {
return undefined;
}
var locals = {};
if (ctrl.itemName) {
locals[ ctrl.itemName ] = item;
}
return locals;
} | [
"function",
"getItemAsNameVal",
"(",
"item",
")",
"{",
"if",
"(",
"!",
"item",
")",
"{",
"return",
"undefined",
";",
"}",
"var",
"locals",
"=",
"{",
"}",
";",
"if",
"(",
"ctrl",
".",
"itemName",
")",
"{",
"locals",
"[",
"ctrl",
".",
"itemName",
"]"... | Returns the locals object for compiling item templates.
@param item
@returns {Object|undefined} | [
"Returns",
"the",
"locals",
"object",
"for",
"compiling",
"item",
"templates",
"."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/autocomplete/js/autocompleteController.js#L667-L678 | train | Returns the locals object for the given item | [
30522,
3853,
2131,
4221,
9335,
18442,
10175,
1006,
8875,
1007,
1063,
2065,
1006,
999,
8875,
1007,
1063,
2709,
6151,
28344,
1025,
1065,
13075,
10575,
1027,
1063,
1065,
1025,
2065,
1006,
14931,
12190,
1012,
8875,
18442,
1007,
1063,
10575,
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... |
aws/aws-sdk-js | lib/cloudfront/signer.js | Signer | function Signer(keyPairId, privateKey) {
if (keyPairId === void 0 || privateKey === void 0) {
throw new Error('A key pair ID and private key are required');
}
this.keyPairId = keyPairId;
this.privateKey = privateKey;
} | javascript | function Signer(keyPairId, privateKey) {
if (keyPairId === void 0 || privateKey === void 0) {
throw new Error('A key pair ID and private key are required');
}
this.keyPairId = keyPairId;
this.privateKey = privateKey;
} | [
"function",
"Signer",
"(",
"keyPairId",
",",
"privateKey",
")",
"{",
"if",
"(",
"keyPairId",
"===",
"void",
"0",
"||",
"privateKey",
"===",
"void",
"0",
")",
"{",
"throw",
"new",
"Error",
"(",
"'A key pair ID and private key are required'",
")",
";",
"}",
"t... | A signer object can be used to generate signed URLs and cookies for granting
access to content on restricted CloudFront distributions.
@see http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/PrivateContent.html
@param keyPairId [String] (Required) The ID of the CloudFront key pair
being used.
@param privateKey [String] (Required) A private key in RSA format. | [
"A",
"signer",
"object",
"can",
"be",
"used",
"to",
"generate",
"signed",
"URLs",
"and",
"cookies",
"for",
"granting",
"access",
"to",
"content",
"on",
"restricted",
"CloudFront",
"distributions",
"."
] | c23e5f0edd150f8885267e5f7c8a564f8e6e8562 | https://github.com/aws/aws-sdk-js/blob/c23e5f0edd150f8885267e5f7c8a564f8e6e8562/lib/cloudfront/signer.js#L105-L112 | train | A signer is a function that can be used to sign a message | [
30522,
3853,
3696,
2121,
1006,
3145,
4502,
15735,
2094,
1010,
2797,
14839,
1007,
1063,
2065,
1006,
3145,
4502,
15735,
2094,
1027,
1027,
1027,
11675,
1014,
1064,
1064,
2797,
14839,
1027,
1027,
1027,
11675,
1014,
1007,
1063,
5466,
2047,
7561,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | copyArrayIgnoringAttributesWithoutValue | function copyArrayIgnoringAttributesWithoutValue(dst, src)
{
if (!src) return;
for (var i = src.length - 1; i >= 0; --i) {
// this test will pass so long as the attribute has a non-empty string
// value, even if that value is "false", "0", "undefined", etc.
if (src[i].nodeValue) {
dst.push(src[i]);
}
}
} | javascript | function copyArrayIgnoringAttributesWithoutValue(dst, src)
{
if (!src) return;
for (var i = src.length - 1; i >= 0; --i) {
// this test will pass so long as the attribute has a non-empty string
// value, even if that value is "false", "0", "undefined", etc.
if (src[i].nodeValue) {
dst.push(src[i]);
}
}
} | [
"function",
"copyArrayIgnoringAttributesWithoutValue",
"(",
"dst",
",",
"src",
")",
"{",
"if",
"(",
"!",
"src",
")",
"return",
";",
"for",
"(",
"var",
"i",
"=",
"src",
".",
"length",
"-",
"1",
";",
"i",
">=",
"0",
";",
"--",
"i",
")",
"{",
"// this... | This is an optimization for copying attribute lists in IE. IE includes many
extraneous properties in its DOM attribute lists, which take require
significant extra processing when evaluating attribute steps. With this
function, we ignore any such attributes that has an empty string value. | [
"This",
"is",
"an",
"optimization",
"for",
"copying",
"attribute",
"lists",
"in",
"IE",
".",
"IE",
"includes",
"many",
"extraneous",
"properties",
"in",
"its",
"DOM",
"attribute",
"lists",
"which",
"take",
"require",
"significant",
"extra",
"processing",
"when",... | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/selenium-core/xpath/util.js#L235-L245 | train | copy array without value | [
30522,
3853,
6100,
2906,
9447,
23773,
28741,
20697,
18886,
8569,
4570,
24415,
5833,
10175,
5657,
1006,
16233,
2102,
1010,
5034,
2278,
1007,
1063,
2065,
1006,
999,
5034,
2278,
1007,
2709,
1025,
2005,
1006,
13075,
1045,
1027,
5034,
2278,
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/operator-linebreak.js | getFixer | function getFixer(operatorToken, desiredStyle) {
return fixer => {
const tokenBefore = sourceCode.getTokenBefore(operatorToken);
const tokenAfter = sourceCode.getTokenAfter(operatorToken);
const textBefore = sourceCode.text.slice(tokenBefore.range[1], operatorToken.range[0]);
const textAfter = sourceCode.text.slice(operatorToken.range[1], tokenAfter.range[0]);
const hasLinebreakBefore = !astUtils.isTokenOnSameLine(tokenBefore, operatorToken);
const hasLinebreakAfter = !astUtils.isTokenOnSameLine(operatorToken, tokenAfter);
let newTextBefore, newTextAfter;
if (hasLinebreakBefore !== hasLinebreakAfter && desiredStyle !== "none") {
// If there is a comment before and after the operator, don't do a fix.
if (sourceCode.getTokenBefore(operatorToken, { includeComments: true }) !== tokenBefore &&
sourceCode.getTokenAfter(operatorToken, { includeComments: true }) !== tokenAfter) {
return null;
}
/*
* If there is only one linebreak and it's on the wrong side of the operator, swap the text before and after the operator.
* foo &&
* bar
* would get fixed to
* foo
* && bar
*/
newTextBefore = textAfter;
newTextAfter = textBefore;
} else {
const LINEBREAK_REGEX = astUtils.createGlobalLinebreakMatcher();
// Otherwise, if no linebreak is desired and no comments interfere, replace the linebreaks with empty strings.
newTextBefore = desiredStyle === "before" || textBefore.trim() ? textBefore : textBefore.replace(LINEBREAK_REGEX, "");
newTextAfter = desiredStyle === "after" || textAfter.trim() ? textAfter : textAfter.replace(LINEBREAK_REGEX, "");
// If there was no change (due to interfering comments), don't output a fix.
if (newTextBefore === textBefore && newTextAfter === textAfter) {
return null;
}
}
if (newTextAfter === "" && tokenAfter.type === "Punctuator" && "+-".includes(operatorToken.value) && tokenAfter.value === operatorToken.value) {
// To avoid accidentally creating a ++ or -- operator, insert a space if the operator is a +/- and the following token is a unary +/-.
newTextAfter += " ";
}
return fixer.replaceTextRange([tokenBefore.range[1], tokenAfter.range[0]], newTextBefore + operatorToken.value + newTextAfter);
};
} | javascript | function getFixer(operatorToken, desiredStyle) {
return fixer => {
const tokenBefore = sourceCode.getTokenBefore(operatorToken);
const tokenAfter = sourceCode.getTokenAfter(operatorToken);
const textBefore = sourceCode.text.slice(tokenBefore.range[1], operatorToken.range[0]);
const textAfter = sourceCode.text.slice(operatorToken.range[1], tokenAfter.range[0]);
const hasLinebreakBefore = !astUtils.isTokenOnSameLine(tokenBefore, operatorToken);
const hasLinebreakAfter = !astUtils.isTokenOnSameLine(operatorToken, tokenAfter);
let newTextBefore, newTextAfter;
if (hasLinebreakBefore !== hasLinebreakAfter && desiredStyle !== "none") {
// If there is a comment before and after the operator, don't do a fix.
if (sourceCode.getTokenBefore(operatorToken, { includeComments: true }) !== tokenBefore &&
sourceCode.getTokenAfter(operatorToken, { includeComments: true }) !== tokenAfter) {
return null;
}
/*
* If there is only one linebreak and it's on the wrong side of the operator, swap the text before and after the operator.
* foo &&
* bar
* would get fixed to
* foo
* && bar
*/
newTextBefore = textAfter;
newTextAfter = textBefore;
} else {
const LINEBREAK_REGEX = astUtils.createGlobalLinebreakMatcher();
// Otherwise, if no linebreak is desired and no comments interfere, replace the linebreaks with empty strings.
newTextBefore = desiredStyle === "before" || textBefore.trim() ? textBefore : textBefore.replace(LINEBREAK_REGEX, "");
newTextAfter = desiredStyle === "after" || textAfter.trim() ? textAfter : textAfter.replace(LINEBREAK_REGEX, "");
// If there was no change (due to interfering comments), don't output a fix.
if (newTextBefore === textBefore && newTextAfter === textAfter) {
return null;
}
}
if (newTextAfter === "" && tokenAfter.type === "Punctuator" && "+-".includes(operatorToken.value) && tokenAfter.value === operatorToken.value) {
// To avoid accidentally creating a ++ or -- operator, insert a space if the operator is a +/- and the following token is a unary +/-.
newTextAfter += " ";
}
return fixer.replaceTextRange([tokenBefore.range[1], tokenAfter.range[0]], newTextBefore + operatorToken.value + newTextAfter);
};
} | [
"function",
"getFixer",
"(",
"operatorToken",
",",
"desiredStyle",
")",
"{",
"return",
"fixer",
"=>",
"{",
"const",
"tokenBefore",
"=",
"sourceCode",
".",
"getTokenBefore",
"(",
"operatorToken",
")",
";",
"const",
"tokenAfter",
"=",
"sourceCode",
".",
"getTokenA... | -------------------------------------------------------------------------- Helpers --------------------------------------------------------------------------
Gets a fixer function to fix rule issues
@param {Token} operatorToken The operator token of an expression
@param {string} desiredStyle The style for the rule. One of 'before', 'after', 'none'
@returns {Function} A fixer function | [
"--------------------------------------------------------------------------",
"Helpers",
"--------------------------------------------------------------------------",
"Gets",
"a",
"fixer",
"function",
"to",
"fix",
"rule",
"issues"
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/operator-linebreak.js#L80-L130 | train | Returns a fixer function that fixes an operator token if it has linebreaks. | [
30522,
3853,
2131,
8873,
2595,
2121,
1006,
6872,
18715,
2368,
1010,
9059,
21756,
2571,
1007,
1063,
2709,
8081,
2121,
1027,
1028,
1063,
9530,
3367,
19204,
4783,
29278,
2063,
1027,
3120,
16044,
1012,
2131,
18715,
2368,
4783,
29278,
2063,
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... |
eslint/eslint | lib/linter.js | getScope | function getScope(scopeManager, currentNode) {
// On Program node, get the outermost scope to avoid return Node.js special function scope or ES modules scope.
const inner = currentNode.type !== "Program";
for (let node = currentNode; node; node = node.parent) {
const scope = scopeManager.acquire(node, inner);
if (scope) {
if (scope.type === "function-expression-name") {
return scope.childScopes[0];
}
return scope;
}
}
return scopeManager.scopes[0];
} | javascript | function getScope(scopeManager, currentNode) {
// On Program node, get the outermost scope to avoid return Node.js special function scope or ES modules scope.
const inner = currentNode.type !== "Program";
for (let node = currentNode; node; node = node.parent) {
const scope = scopeManager.acquire(node, inner);
if (scope) {
if (scope.type === "function-expression-name") {
return scope.childScopes[0];
}
return scope;
}
}
return scopeManager.scopes[0];
} | [
"function",
"getScope",
"(",
"scopeManager",
",",
"currentNode",
")",
"{",
"// On Program node, get the outermost scope to avoid return Node.js special function scope or ES modules scope.",
"const",
"inner",
"=",
"currentNode",
".",
"type",
"!==",
"\"Program\"",
";",
"for",
"("... | Gets the scope for the current node
@param {ScopeManager} scopeManager The scope manager for this AST
@param {ASTNode} currentNode The node to get the scope of
@returns {eslint-scope.Scope} The scope information for this node | [
"Gets",
"the",
"scope",
"for",
"the",
"current",
"node"
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/linter.js#L546-L563 | train | Get the scope of the current node | [
30522,
3853,
4152,
16186,
1006,
9531,
24805,
4590,
1010,
2783,
3630,
3207,
1007,
1063,
1013,
1013,
2006,
2565,
13045,
1010,
2131,
1996,
6058,
11800,
9531,
2000,
4468,
2709,
13045,
1012,
1046,
2015,
2569,
3853,
9531,
2030,
9686,
14184,
9531,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
mui-org/material-ui | docs/src/pages/getting-started/page-layout-examples/dashboard/Orders.js | createData | function createData(id, date, name, shipTo, paymentMethod, amount) {
return { id, date, name, shipTo, paymentMethod, amount };
} | javascript | function createData(id, date, name, shipTo, paymentMethod, amount) {
return { id, date, name, shipTo, paymentMethod, amount };
} | [
"function",
"createData",
"(",
"id",
",",
"date",
",",
"name",
",",
"shipTo",
",",
"paymentMethod",
",",
"amount",
")",
"{",
"return",
"{",
"id",
",",
"date",
",",
"name",
",",
"shipTo",
",",
"paymentMethod",
",",
"amount",
"}",
";",
"}"
] | Generate Order Data | [
"Generate",
"Order",
"Data"
] | 1555e52367835946382fbf2a8f681de71318915d | https://github.com/mui-org/material-ui/blob/1555e52367835946382fbf2a8f681de71318915d/docs/src/pages/getting-started/page-layout-examples/dashboard/Orders.js#L14-L16 | train | Create data object | [
30522,
3853,
2580,
6790,
1006,
8909,
1010,
3058,
1010,
2171,
1010,
2911,
3406,
1010,
7909,
11368,
6806,
2094,
1010,
3815,
1007,
1063,
2709,
1063,
8909,
1010,
3058,
1010,
2171,
1010,
2911,
3406,
1010,
7909,
11368,
6806,
2094,
1010,
3815,
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/hello-mui/js/mui.js | function(starts, moves) {
if(starts.length >= 2 && moves.length >= 2) {
var props = ['pageX', 'pageY'];
return getDistance(moves[1], moves[0], props) / getDistance(starts[1], starts[0], props);
}
return 1;
} | javascript | function(starts, moves) {
if(starts.length >= 2 && moves.length >= 2) {
var props = ['pageX', 'pageY'];
return getDistance(moves[1], moves[0], props) / getDistance(starts[1], starts[0], props);
}
return 1;
} | [
"function",
"(",
"starts",
",",
"moves",
")",
"{",
"if",
"(",
"starts",
".",
"length",
">=",
"2",
"&&",
"moves",
".",
"length",
">=",
"2",
")",
"{",
"var",
"props",
"=",
"[",
"'pageX'",
",",
"'pageY'",
"]",
";",
"return",
"getDistance",
"(",
"moves... | scale
@param {Object} starts
@param {Object} moves | [
"scale"
] | ff74c90a1671a552f3604b1288bf38a4126312d0 | https://github.com/dcloudio/mui/blob/ff74c90a1671a552f3604b1288bf38a4126312d0/examples/hello-mui/js/mui.js#L1194-L1200 | train | Calculate the distance between two points | [
30522,
3853,
1006,
4627,
1010,
5829,
1007,
1063,
2065,
1006,
4627,
1012,
3091,
1028,
1027,
1016,
1004,
1004,
5829,
1012,
3091,
1028,
1027,
1016,
1007,
1063,
13075,
24387,
1027,
1031,
1005,
3931,
2595,
1005,
1010,
1005,
3931,
2100,
1005,
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/LiveDevelopment/Agents/RemoteFunctions.js | isInViewport | function isInViewport(element) {
var rect = element.getBoundingClientRect();
var html = window.document.documentElement;
return (
rect.top >= 0 &&
rect.left >= 0 &&
rect.bottom <= (window.innerHeight || html.clientHeight) &&
rect.right <= (window.innerWidth || html.clientWidth)
);
} | javascript | function isInViewport(element) {
var rect = element.getBoundingClientRect();
var html = window.document.documentElement;
return (
rect.top >= 0 &&
rect.left >= 0 &&
rect.bottom <= (window.innerHeight || html.clientHeight) &&
rect.right <= (window.innerWidth || html.clientWidth)
);
} | [
"function",
"isInViewport",
"(",
"element",
")",
"{",
"var",
"rect",
"=",
"element",
".",
"getBoundingClientRect",
"(",
")",
";",
"var",
"html",
"=",
"window",
".",
"document",
".",
"documentElement",
";",
"return",
"(",
"rect",
".",
"top",
">=",
"0",
"&... | Checks if the element is in Viewport in the client browser | [
"Checks",
"if",
"the",
"element",
"is",
"in",
"Viewport",
"in",
"the",
"client",
"browser"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/LiveDevelopment/Agents/RemoteFunctions.js#L122-L131 | train | Check if an element is in viewport | [
30522,
3853,
2003,
2378,
8584,
6442,
1006,
5783,
1007,
1063,
13075,
28667,
2102,
1027,
5783,
1012,
2131,
15494,
2075,
20464,
11638,
2890,
6593,
1006,
1007,
1025,
13075,
16129,
1027,
3332,
1012,
6254,
1012,
6254,
12260,
3672,
1025,
2709,
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.rta/src/sap/ui/rta/plugin/additionalElements/AdditionalElementsAnalyzer.js | _getODataPropertiesOfModel | function _getODataPropertiesOfModel(oElement, sAggregationName) {
var oModel = oElement.getModel();
var mData = {
property: [],
navigationProperty: [],
navigationEntityNames: []
};
if (oModel) {
var sModelName = oModel.getMetadata().getName();
if (sModelName === "sap.ui.model.odata.ODataModel" || sModelName === "sap.ui.model.odata.v2.ODataModel") {
var oMetaModel = oModel.getMetaModel();
return oMetaModel.loaded().then(function(){
var sBindingContextPath = _getBindingPath(oElement, sAggregationName);
if (sBindingContextPath) {
var oMetaModelContext = oMetaModel.getMetaContext(sBindingContextPath);
var mODataEntity = oMetaModelContext.getObject();
var oDefaultAggregation = oElement.getMetadata().getAggregation();
if (oDefaultAggregation) {
var oBinding = oElement.getBindingInfo(oDefaultAggregation.name);
var oTemplate = oBinding && oBinding.template;
if (oTemplate) {
var sPath = oElement.getBindingPath(oDefaultAggregation.name);
var oODataAssociationEnd = oMetaModel.getODataAssociationEnd(mODataEntity, sPath);
var sFullyQualifiedEntityName = oODataAssociationEnd && oODataAssociationEnd.type;
if (sFullyQualifiedEntityName) {
var oEntityType = oMetaModel.getODataEntityType(sFullyQualifiedEntityName);
mODataEntity = oEntityType;
}
}
}
mData.property = mODataEntity.property || [];
mData.property = _expandComplexProperties(mData.property, oMetaModel, mODataEntity);
mData.property = _filterInvisibleProperties(mData.property, oElement, sAggregationName);
if (mODataEntity.navigationProperty){
mData.navigationProperty = mODataEntity.navigationProperty;
mODataEntity.navigationProperty.forEach(function(oNavProp){
var sFullyQualifiedEntityName = (
oMetaModel.getODataAssociationEnd(mODataEntity, oNavProp.name)
&& oMetaModel.getODataAssociationEnd(mODataEntity, oNavProp.name).type
);
var oEntityType = oMetaModel.getODataEntityType(sFullyQualifiedEntityName);
if (oEntityType && oEntityType.name){
if (mData.navigationEntityNames.indexOf(oEntityType.name) === -1){
mData.navigationEntityNames.push(oEntityType.name);
}
}
});
}
}
return mData;
});
}
}
return Promise.resolve(mData);
} | javascript | function _getODataPropertiesOfModel(oElement, sAggregationName) {
var oModel = oElement.getModel();
var mData = {
property: [],
navigationProperty: [],
navigationEntityNames: []
};
if (oModel) {
var sModelName = oModel.getMetadata().getName();
if (sModelName === "sap.ui.model.odata.ODataModel" || sModelName === "sap.ui.model.odata.v2.ODataModel") {
var oMetaModel = oModel.getMetaModel();
return oMetaModel.loaded().then(function(){
var sBindingContextPath = _getBindingPath(oElement, sAggregationName);
if (sBindingContextPath) {
var oMetaModelContext = oMetaModel.getMetaContext(sBindingContextPath);
var mODataEntity = oMetaModelContext.getObject();
var oDefaultAggregation = oElement.getMetadata().getAggregation();
if (oDefaultAggregation) {
var oBinding = oElement.getBindingInfo(oDefaultAggregation.name);
var oTemplate = oBinding && oBinding.template;
if (oTemplate) {
var sPath = oElement.getBindingPath(oDefaultAggregation.name);
var oODataAssociationEnd = oMetaModel.getODataAssociationEnd(mODataEntity, sPath);
var sFullyQualifiedEntityName = oODataAssociationEnd && oODataAssociationEnd.type;
if (sFullyQualifiedEntityName) {
var oEntityType = oMetaModel.getODataEntityType(sFullyQualifiedEntityName);
mODataEntity = oEntityType;
}
}
}
mData.property = mODataEntity.property || [];
mData.property = _expandComplexProperties(mData.property, oMetaModel, mODataEntity);
mData.property = _filterInvisibleProperties(mData.property, oElement, sAggregationName);
if (mODataEntity.navigationProperty){
mData.navigationProperty = mODataEntity.navigationProperty;
mODataEntity.navigationProperty.forEach(function(oNavProp){
var sFullyQualifiedEntityName = (
oMetaModel.getODataAssociationEnd(mODataEntity, oNavProp.name)
&& oMetaModel.getODataAssociationEnd(mODataEntity, oNavProp.name).type
);
var oEntityType = oMetaModel.getODataEntityType(sFullyQualifiedEntityName);
if (oEntityType && oEntityType.name){
if (mData.navigationEntityNames.indexOf(oEntityType.name) === -1){
mData.navigationEntityNames.push(oEntityType.name);
}
}
});
}
}
return mData;
});
}
}
return Promise.resolve(mData);
} | [
"function",
"_getODataPropertiesOfModel",
"(",
"oElement",
",",
"sAggregationName",
")",
"{",
"var",
"oModel",
"=",
"oElement",
".",
"getModel",
"(",
")",
";",
"var",
"mData",
"=",
"{",
"property",
":",
"[",
"]",
",",
"navigationProperty",
":",
"[",
"]",
"... | Fetching all available properties of the Element's Model
@param {sap.ui.core.Control} oElement - Control instance
@param {string} sAggregationName - aggregation name of the action
@return {Promise} - Returns Promise with results
@private | [
"Fetching",
"all",
"available",
"properties",
"of",
"the",
"Element",
"s",
"Model"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.rta/src/sap/ui/rta/plugin/additionalElements/AdditionalElementsAnalyzer.js#L157-L217 | train | Returns an object with all the properties of the given model | [
30522,
3853,
1035,
2131,
13390,
2696,
21572,
4842,
7368,
11253,
5302,
9247,
1006,
1051,
12260,
3672,
1010,
7842,
13871,
2890,
12540,
18442,
1007,
1063,
13075,
18168,
10244,
2140,
1027,
1051,
12260,
3672,
1012,
2131,
5302,
9247,
1006,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
angular/material | src/components/bottomSheet/bottom-sheet.js | registerGestures | function registerGestures(element, parent) {
var deregister = $mdGesture.register(parent, 'drag', { horizontal: false });
parent.on('$md.dragstart', onDragStart)
.on('$md.drag', onDrag)
.on('$md.dragend', onDragEnd);
return function cleanupGestures() {
deregister();
parent.off('$md.dragstart', onDragStart);
parent.off('$md.drag', onDrag);
parent.off('$md.dragend', onDragEnd);
};
function onDragStart() {
// Disable transitions on transform so that it feels fast
element.css($mdConstant.CSS.TRANSITION_DURATION, '0ms');
}
function onDrag(ev) {
var transform = ev.pointer.distanceY;
if (transform < 5) {
// Slow down drag when trying to drag up, and stop after PADDING
transform = Math.max(-PADDING, transform / 2);
}
element.css($mdConstant.CSS.TRANSFORM, 'translate3d(0,' + (PADDING + transform) + 'px,0)');
}
function onDragEnd(ev) {
if (ev.pointer.distanceY > 0 &&
(ev.pointer.distanceY > 20 || Math.abs(ev.pointer.velocityY) > CLOSING_VELOCITY)) {
var distanceRemaining = element.prop('offsetHeight') - ev.pointer.distanceY;
var transitionDuration = Math.min(distanceRemaining / ev.pointer.velocityY * 0.75, 500);
element.css($mdConstant.CSS.TRANSITION_DURATION, transitionDuration + 'ms');
$mdUtil.nextTick($mdBottomSheet.cancel,true);
} else {
element.css($mdConstant.CSS.TRANSITION_DURATION, '');
element.css($mdConstant.CSS.TRANSFORM, '');
}
}
} | javascript | function registerGestures(element, parent) {
var deregister = $mdGesture.register(parent, 'drag', { horizontal: false });
parent.on('$md.dragstart', onDragStart)
.on('$md.drag', onDrag)
.on('$md.dragend', onDragEnd);
return function cleanupGestures() {
deregister();
parent.off('$md.dragstart', onDragStart);
parent.off('$md.drag', onDrag);
parent.off('$md.dragend', onDragEnd);
};
function onDragStart() {
// Disable transitions on transform so that it feels fast
element.css($mdConstant.CSS.TRANSITION_DURATION, '0ms');
}
function onDrag(ev) {
var transform = ev.pointer.distanceY;
if (transform < 5) {
// Slow down drag when trying to drag up, and stop after PADDING
transform = Math.max(-PADDING, transform / 2);
}
element.css($mdConstant.CSS.TRANSFORM, 'translate3d(0,' + (PADDING + transform) + 'px,0)');
}
function onDragEnd(ev) {
if (ev.pointer.distanceY > 0 &&
(ev.pointer.distanceY > 20 || Math.abs(ev.pointer.velocityY) > CLOSING_VELOCITY)) {
var distanceRemaining = element.prop('offsetHeight') - ev.pointer.distanceY;
var transitionDuration = Math.min(distanceRemaining / ev.pointer.velocityY * 0.75, 500);
element.css($mdConstant.CSS.TRANSITION_DURATION, transitionDuration + 'ms');
$mdUtil.nextTick($mdBottomSheet.cancel,true);
} else {
element.css($mdConstant.CSS.TRANSITION_DURATION, '');
element.css($mdConstant.CSS.TRANSFORM, '');
}
}
} | [
"function",
"registerGestures",
"(",
"element",
",",
"parent",
")",
"{",
"var",
"deregister",
"=",
"$mdGesture",
".",
"register",
"(",
"parent",
",",
"'drag'",
",",
"{",
"horizontal",
":",
"false",
"}",
")",
";",
"parent",
".",
"on",
"(",
"'$md.dragstart'"... | Adds the drag gestures to the bottom sheet. | [
"Adds",
"the",
"drag",
"gestures",
"to",
"the",
"bottom",
"sheet",
"."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/bottomSheet/bottom-sheet.js#L307-L346 | train | Register a drag gesture | [
30522,
3853,
4236,
8449,
22662,
1006,
5783,
1010,
6687,
1007,
1063,
13075,
4315,
13910,
12911,
1027,
1002,
9108,
8449,
11244,
1012,
4236,
1006,
6687,
1010,
1005,
8011,
1005,
1010,
1063,
9876,
1024,
6270,
1065,
1007,
1025,
6687,
1012,
2006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/ExtractToFunction.js | extract | function extract(ast, text, scopes, srcScope, destScope, start, end, isExpression) {
var retObj = analyzeCode(text, scopes, srcScope, destScope, start, end),
passParams = retObj.passParams,
retParams = retObj.retParams,
thisPointerUsed = retObj.thisPointerUsed,
returnStatementUsed = retObj.returnStatementUsed,
variableDeclarations = retObj.variableDeclarations,
doc = session.editor.document,
fnBody = text,
fnName = RefactoringUtils.getUniqueIdentifierName(scopes, "extracted"),
fnDeclaration,
fnCall;
function appendVarDeclaration(identifier) {
if (variableDeclarations.hasOwnProperty(identifier)) {
return variableDeclarations[identifier] + " " + identifier;
}
else {
return identifier;
}
}
if (destScope.isClass) {
fnCall = StringUtils.format(template.functionCall.class, fnName, passParams.join(", "));
} else if (thisPointerUsed) {
passParams.unshift("this");
fnCall = StringUtils.format(template.functionCall.thisPointer, fnName, passParams.join(", "));
passParams.shift();
} else {
fnCall = StringUtils.format(template.functionCall.normal, fnName, passParams.join(", "));
}
// Append return to the fnCall, if the extracted text contains return statement
// Ideally in this case retParams should be empty.
if (returnStatementUsed) {
fnCall = "return " + fnCall;
}
if (isExpression) {
fnBody = StringUtils.format(template.returnStatement.single, fnBody);
} else {
var retParamsStr = "";
if (retParams.length > 1) {
retParamsStr = StringUtils.format(template.returnStatement.multiple, retParams.join(", "));
fnCall = "var ret = " + fnCall + ";\n";
fnCall += retParams.map(function (param) {
return StringUtils.format(template.assignment, appendVarDeclaration(param), "ret." + param);
}).join("\n");
} else if (retParams.length === 1) {
retParamsStr = StringUtils.format(template.returnStatement.single, retParams.join(", "));
fnCall = StringUtils.format(template.assignment, appendVarDeclaration(retParams[0]), fnCall);
} else {
fnCall += ";";
}
fnBody = fnBody + "\n" + retParamsStr;
}
if (destScope.isClass) {
fnDeclaration = StringUtils.format(template.functionDeclaration.class, fnName, passParams.join(", "), fnBody);
} else {
fnDeclaration = StringUtils.format(template.functionDeclaration.normal, fnName, passParams.join(", "), fnBody);
}
start = session.editor.posFromIndex(start);
end = session.editor.posFromIndex(end);
// Get the insertion pos for function declaration
var insertPos = _.clone(start);
var fnScopes = scopes.filter(RefactoringUtils.isFnScope);
for (var i = 0; i < fnScopes.length; ++i) {
if (fnScopes[i].id === destScope.id) {
if (fnScopes[i - 1]) {
insertPos = session.editor.posFromIndex(fnScopes[i - 1].originNode.start);
// If the origin node of the destination scope is a function expression or a arrow function expression,
// get the surrounding statement to get the position
if (fnScopes[i - 1].originNode.type === "FunctionExpression" || fnScopes[i - 1].originNode.type === "ArrowFunctionExpression") {
var surroundStatement = RefactoringUtils.findSurroundASTNode(ast, { start: session.editor.indexFromPos(insertPos)}, ["Statement"]);
insertPos = session.editor.posFromIndex(surroundStatement.start);
}
}
break;
}
}
insertPos.ch = 0;
// Replace and multi-select and indent
doc.batchOperation(function() {
// Replace
doc.replaceRange(fnCall, start, end);
doc.replaceRange(fnDeclaration, insertPos);
// Set selections
start = doc.adjustPosForChange(start, fnDeclaration.split("\n"), insertPos, insertPos);
end = doc.adjustPosForChange(end, fnDeclaration.split("\n"), insertPos, insertPos);
session.editor.setSelections([
{
start: session.editor.posFromIndex(session.editor.indexFromPos(start) + fnCall.indexOf(fnName)),
end: session.editor.posFromIndex(session.editor.indexFromPos(start) + fnCall.indexOf(fnName) + fnName.length)
},
{
start: session.editor.posFromIndex(session.editor.indexFromPos(insertPos) + fnDeclaration.indexOf(fnName)),
end: session.editor.posFromIndex(session.editor.indexFromPos(insertPos) + fnDeclaration.indexOf(fnName) + fnName.length)
}
]);
// indent
for (var i = start.line; i < start.line + RefactoringUtils.numLines(fnCall); ++i) {
session.editor._codeMirror.indentLine(i, "smart");
}
for (var i = insertPos.line; i < insertPos.line + RefactoringUtils.numLines(fnDeclaration); ++i) {
session.editor._codeMirror.indentLine(i, "smart");
}
});
} | javascript | function extract(ast, text, scopes, srcScope, destScope, start, end, isExpression) {
var retObj = analyzeCode(text, scopes, srcScope, destScope, start, end),
passParams = retObj.passParams,
retParams = retObj.retParams,
thisPointerUsed = retObj.thisPointerUsed,
returnStatementUsed = retObj.returnStatementUsed,
variableDeclarations = retObj.variableDeclarations,
doc = session.editor.document,
fnBody = text,
fnName = RefactoringUtils.getUniqueIdentifierName(scopes, "extracted"),
fnDeclaration,
fnCall;
function appendVarDeclaration(identifier) {
if (variableDeclarations.hasOwnProperty(identifier)) {
return variableDeclarations[identifier] + " " + identifier;
}
else {
return identifier;
}
}
if (destScope.isClass) {
fnCall = StringUtils.format(template.functionCall.class, fnName, passParams.join(", "));
} else if (thisPointerUsed) {
passParams.unshift("this");
fnCall = StringUtils.format(template.functionCall.thisPointer, fnName, passParams.join(", "));
passParams.shift();
} else {
fnCall = StringUtils.format(template.functionCall.normal, fnName, passParams.join(", "));
}
// Append return to the fnCall, if the extracted text contains return statement
// Ideally in this case retParams should be empty.
if (returnStatementUsed) {
fnCall = "return " + fnCall;
}
if (isExpression) {
fnBody = StringUtils.format(template.returnStatement.single, fnBody);
} else {
var retParamsStr = "";
if (retParams.length > 1) {
retParamsStr = StringUtils.format(template.returnStatement.multiple, retParams.join(", "));
fnCall = "var ret = " + fnCall + ";\n";
fnCall += retParams.map(function (param) {
return StringUtils.format(template.assignment, appendVarDeclaration(param), "ret." + param);
}).join("\n");
} else if (retParams.length === 1) {
retParamsStr = StringUtils.format(template.returnStatement.single, retParams.join(", "));
fnCall = StringUtils.format(template.assignment, appendVarDeclaration(retParams[0]), fnCall);
} else {
fnCall += ";";
}
fnBody = fnBody + "\n" + retParamsStr;
}
if (destScope.isClass) {
fnDeclaration = StringUtils.format(template.functionDeclaration.class, fnName, passParams.join(", "), fnBody);
} else {
fnDeclaration = StringUtils.format(template.functionDeclaration.normal, fnName, passParams.join(", "), fnBody);
}
start = session.editor.posFromIndex(start);
end = session.editor.posFromIndex(end);
// Get the insertion pos for function declaration
var insertPos = _.clone(start);
var fnScopes = scopes.filter(RefactoringUtils.isFnScope);
for (var i = 0; i < fnScopes.length; ++i) {
if (fnScopes[i].id === destScope.id) {
if (fnScopes[i - 1]) {
insertPos = session.editor.posFromIndex(fnScopes[i - 1].originNode.start);
// If the origin node of the destination scope is a function expression or a arrow function expression,
// get the surrounding statement to get the position
if (fnScopes[i - 1].originNode.type === "FunctionExpression" || fnScopes[i - 1].originNode.type === "ArrowFunctionExpression") {
var surroundStatement = RefactoringUtils.findSurroundASTNode(ast, { start: session.editor.indexFromPos(insertPos)}, ["Statement"]);
insertPos = session.editor.posFromIndex(surroundStatement.start);
}
}
break;
}
}
insertPos.ch = 0;
// Replace and multi-select and indent
doc.batchOperation(function() {
// Replace
doc.replaceRange(fnCall, start, end);
doc.replaceRange(fnDeclaration, insertPos);
// Set selections
start = doc.adjustPosForChange(start, fnDeclaration.split("\n"), insertPos, insertPos);
end = doc.adjustPosForChange(end, fnDeclaration.split("\n"), insertPos, insertPos);
session.editor.setSelections([
{
start: session.editor.posFromIndex(session.editor.indexFromPos(start) + fnCall.indexOf(fnName)),
end: session.editor.posFromIndex(session.editor.indexFromPos(start) + fnCall.indexOf(fnName) + fnName.length)
},
{
start: session.editor.posFromIndex(session.editor.indexFromPos(insertPos) + fnDeclaration.indexOf(fnName)),
end: session.editor.posFromIndex(session.editor.indexFromPos(insertPos) + fnDeclaration.indexOf(fnName) + fnName.length)
}
]);
// indent
for (var i = start.line; i < start.line + RefactoringUtils.numLines(fnCall); ++i) {
session.editor._codeMirror.indentLine(i, "smart");
}
for (var i = insertPos.line; i < insertPos.line + RefactoringUtils.numLines(fnDeclaration); ++i) {
session.editor._codeMirror.indentLine(i, "smart");
}
});
} | [
"function",
"extract",
"(",
"ast",
",",
"text",
",",
"scopes",
",",
"srcScope",
",",
"destScope",
",",
"start",
",",
"end",
",",
"isExpression",
")",
"{",
"var",
"retObj",
"=",
"analyzeCode",
"(",
"text",
",",
"scopes",
",",
"srcScope",
",",
"destScope",... | Does the actual extraction. i.e Replacing the text, Creating a function
and multi select function names | [
"Does",
"the",
"actual",
"extraction",
".",
"i",
".",
"e",
"Replacing",
"the",
"text",
"Creating",
"a",
"function",
"and",
"multi",
"select",
"function",
"names"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/JavaScriptRefactoring/ExtractToFunction.js#L142-L260 | train | Extract the code from the source code | [
30522,
3853,
14817,
1006,
2004,
2102,
1010,
3793,
1010,
9531,
2015,
1010,
5034,
6169,
16186,
30524,
2015,
1010,
5034,
6169,
16186,
1010,
4078,
3215,
16186,
1010,
2707,
1010,
2203,
1007,
1010,
3413,
28689,
5244,
1027,
2128,
3406,
2497,
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... |
SAP/openui5 | src/sap.ui.table/src/sap/ui/table/TableGrouping.js | function(oTable) {
if (TableGrouping.isGroupMode(oTable) || TableGrouping.isTreeMode(oTable)) {
var oBinding = oTable.getBinding("rows");
var oRowBindingInfo = oTable.getBindingInfo("rows");
var aRows = oTable.getRows();
var iCount = aRows.length;
var iRow;
if (oBinding) {
for (iRow = 0; iRow < iCount; iRow++) {
var oRowGroupInfo = TableGrouping.getRowGroupInfo(oTable, aRows[iRow], oBinding, oRowBindingInfo);
TableGrouping.updateTableRowForGrouping(oTable, aRows[iRow], oRowGroupInfo.isHeader, oRowGroupInfo.expanded,
oRowGroupInfo.hidden, false, oRowGroupInfo.level, oRowGroupInfo.title);
}
} else {
for (iRow = 0; iRow < iCount; iRow++) {
TableGrouping.cleanupTableRowForGrouping(oTable, aRows[iRow]);
}
}
}
} | javascript | function(oTable) {
if (TableGrouping.isGroupMode(oTable) || TableGrouping.isTreeMode(oTable)) {
var oBinding = oTable.getBinding("rows");
var oRowBindingInfo = oTable.getBindingInfo("rows");
var aRows = oTable.getRows();
var iCount = aRows.length;
var iRow;
if (oBinding) {
for (iRow = 0; iRow < iCount; iRow++) {
var oRowGroupInfo = TableGrouping.getRowGroupInfo(oTable, aRows[iRow], oBinding, oRowBindingInfo);
TableGrouping.updateTableRowForGrouping(oTable, aRows[iRow], oRowGroupInfo.isHeader, oRowGroupInfo.expanded,
oRowGroupInfo.hidden, false, oRowGroupInfo.level, oRowGroupInfo.title);
}
} else {
for (iRow = 0; iRow < iCount; iRow++) {
TableGrouping.cleanupTableRowForGrouping(oTable, aRows[iRow]);
}
}
}
} | [
"function",
"(",
"oTable",
")",
"{",
"if",
"(",
"TableGrouping",
".",
"isGroupMode",
"(",
"oTable",
")",
"||",
"TableGrouping",
".",
"isTreeMode",
"(",
"oTable",
")",
")",
"{",
"var",
"oBinding",
"=",
"oTable",
".",
"getBinding",
"(",
"\"rows\"",
")",
";... | Updates the dom of the rows of the given table.
@param {sap.ui.table.Table} oTable Instance of the table.
@see TableGrouping.updateTableRowForGrouping
@see TableGrouping.cleanupTableRowForGrouping | [
"Updates",
"the",
"dom",
"of",
"the",
"rows",
"of",
"the",
"given",
"table",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableGrouping.js#L454-L474 | train | Updates the table with the data from the table s rows. | [
30522,
3853,
1006,
27178,
3085,
1007,
1063,
2065,
1006,
2795,
17058,
2075,
1012,
2003,
17058,
5302,
3207,
1006,
27178,
3085,
1007,
1064,
1064,
2795,
17058,
2075,
1012,
21541,
9910,
5302,
3207,
1006,
27178,
3085,
1007,
1007,
1063,
13075,
278... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | fuzzynum | function fuzzynum(s) {
var v = Number(s);
if(!isNaN(v)) return v;
var wt = 1;
var ss = s.replace(/([\d]),([\d])/g,"$1$2").replace(/[$]/g,"").replace(/[%]/g, function() { wt *= 100; return "";});
if(!isNaN(v = Number(ss))) return v / wt;
ss = ss.replace(/[(](.*)[)]/,function($$, $1) { wt = -wt; return $1;});
if(!isNaN(v = Number(ss))) return v / wt;
return v;
} | javascript | function fuzzynum(s) {
var v = Number(s);
if(!isNaN(v)) return v;
var wt = 1;
var ss = s.replace(/([\d]),([\d])/g,"$1$2").replace(/[$]/g,"").replace(/[%]/g, function() { wt *= 100; return "";});
if(!isNaN(v = Number(ss))) return v / wt;
ss = ss.replace(/[(](.*)[)]/,function($$, $1) { wt = -wt; return $1;});
if(!isNaN(v = Number(ss))) return v / wt;
return v;
} | [
"function",
"fuzzynum",
"(",
"s",
")",
"{",
"var",
"v",
"=",
"Number",
"(",
"s",
")",
";",
"if",
"(",
"!",
"isNaN",
"(",
"v",
")",
")",
"return",
"v",
";",
"var",
"wt",
"=",
"1",
";",
"var",
"ss",
"=",
"s",
".",
"replace",
"(",
"/",
"([\\d]... | /* TODO: stress test | [
"/",
"*",
"TODO",
":",
"stress",
"test"
] | 9a6d8a1d3d80c78dad5201fb389316f935279cdc | https://github.com/SheetJS/js-xlsx/blob/9a6d8a1d3d80c78dad5201fb389316f935279cdc/xlsx.js#L2748-L2757 | train | Fuzzynum function | [
30522,
3853,
18001,
19172,
1006,
1055,
1007,
1063,
13075,
1058,
1027,
2193,
1006,
1055,
1007,
1025,
2065,
1006,
999,
3475,
2319,
1006,
1058,
1007,
1007,
2709,
1058,
1025,
13075,
1059,
2102,
1027,
1015,
1025,
13075,
7020,
1027,
1055,
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... |
electron/electron | lib/browser/chrome-extension.js | function (manifest) {
return {
startPage: manifest.startPage,
srcDirectory: manifest.srcDirectory,
name: manifest.name,
exposeExperimentalAPIs: true
}
} | javascript | function (manifest) {
return {
startPage: manifest.startPage,
srcDirectory: manifest.srcDirectory,
name: manifest.name,
exposeExperimentalAPIs: true
}
} | [
"function",
"(",
"manifest",
")",
"{",
"return",
"{",
"startPage",
":",
"manifest",
".",
"startPage",
",",
"srcDirectory",
":",
"manifest",
".",
"srcDirectory",
",",
"name",
":",
"manifest",
".",
"name",
",",
"exposeExperimentalAPIs",
":",
"true",
"}",
"}"
] | Transfer the |manifest| to a format that can be recognized by the |DevToolsAPI.addExtensions|. | [
"Transfer",
"the",
"|manifest|",
"to",
"a",
"format",
"that",
"can",
"be",
"recognized",
"by",
"the",
"|DevToolsAPI",
".",
"addExtensions|",
"."
] | 6e29611788277729647acf465f10db1ea6f15788 | https://github.com/electron/electron/blob/6e29611788277729647acf465f10db1ea6f15788/lib/browser/chrome-extension.js#L357-L364 | train | Returns an object with the properties of the specified node - modules containing the node - modules. | [
30522,
3853,
1006,
19676,
1007,
1063,
2709,
1063,
2707,
13704,
1024,
19676,
1012,
2707,
13704,
1010,
5034,
19797,
7442,
16761,
2100,
1024,
19676,
1012,
5034,
19797,
7442,
16761,
2100,
1010,
2171,
1024,
19676,
1012,
2171,
1010,
14451,
10288,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
jgraph/mxgraph | javascript/mxClient.js | function(node, text)
{
if (node.innerText !== undefined)
{
node.innerText = text;
}
else
{
node[(node.textContent === undefined) ? 'text' : 'textContent'] = text;
}
} | javascript | function(node, text)
{
if (node.innerText !== undefined)
{
node.innerText = text;
}
else
{
node[(node.textContent === undefined) ? 'text' : 'textContent'] = text;
}
} | [
"function",
"(",
"node",
",",
"text",
")",
"{",
"if",
"(",
"node",
".",
"innerText",
"!==",
"undefined",
")",
"{",
"node",
".",
"innerText",
"=",
"text",
";",
"}",
"else",
"{",
"node",
"[",
"(",
"node",
".",
"textContent",
"===",
"undefined",
")",
... | Function: setTextContent
Sets the text content of the specified node.
Parameters:
node - DOM node to set the text content for.
text - String that represents the text content. | [
"Function",
":",
"setTextContent"
] | 33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44 | https://github.com/jgraph/mxgraph/blob/33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44/javascript/mxClient.js#L3110-L3120 | train | set text on node | [
30522,
3853,
1006,
13045,
1010,
3793,
1007,
1063,
2065,
1006,
13045,
1012,
5110,
18209,
999,
1027,
1027,
6151,
28344,
1007,
1063,
13045,
1012,
5110,
18209,
1027,
3793,
1025,
1065,
2842,
1063,
13045,
1031,
1006,
13045,
1012,
3793,
8663,
6528... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
mochajs/mocha | lib/reporters/json.js | cleanCycles | function cleanCycles(obj) {
var cache = [];
return JSON.parse(
JSON.stringify(obj, function(key, value) {
if (typeof value === 'object' && value !== null) {
if (cache.indexOf(value) !== -1) {
// Instead of going in a circle, we'll print [object Object]
return '' + value;
}
cache.push(value);
}
return value;
})
);
} | javascript | function cleanCycles(obj) {
var cache = [];
return JSON.parse(
JSON.stringify(obj, function(key, value) {
if (typeof value === 'object' && value !== null) {
if (cache.indexOf(value) !== -1) {
// Instead of going in a circle, we'll print [object Object]
return '' + value;
}
cache.push(value);
}
return value;
})
);
} | [
"function",
"cleanCycles",
"(",
"obj",
")",
"{",
"var",
"cache",
"=",
"[",
"]",
";",
"return",
"JSON",
".",
"parse",
"(",
"JSON",
".",
"stringify",
"(",
"obj",
",",
"function",
"(",
"key",
",",
"value",
")",
"{",
"if",
"(",
"typeof",
"value",
"==="... | Replaces any circular references inside `obj` with '[object Object]'
@private
@param {Object} obj
@return {Object} | [
"Replaces",
"any",
"circular",
"references",
"inside",
"obj",
"with",
"[",
"object",
"Object",
"]"
] | 9b00fedb610241e33f7592c40164e42a38a793cf | https://github.com/mochajs/mocha/blob/9b00fedb610241e33f7592c40164e42a38a793cf/lib/reporters/json.js#L103-L118 | train | Clean the object | [
30522,
3853,
4550,
23490,
2015,
1006,
27885,
3501,
1007,
1063,
13075,
17053,
1027,
1031,
1033,
1025,
2709,
1046,
3385,
1012,
11968,
3366,
1006,
1046,
3385,
1012,
5164,
8757,
1006,
27885,
3501,
1010,
3853,
1006,
3145,
1010,
3643,
1007,
1063,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Dogfalo/materialize | dist/js/materialize.js | ScrollSpy | function ScrollSpy(el, options) {
_classCallCheck(this, ScrollSpy);
var _this35 = _possibleConstructorReturn(this, (ScrollSpy.__proto__ || Object.getPrototypeOf(ScrollSpy)).call(this, ScrollSpy, el, options));
_this35.el.M_ScrollSpy = _this35;
/**
* Options for the modal
* @member Modal#options
* @prop {Number} [throttle=100] - Throttle of scroll handler
* @prop {Number} [scrollOffset=200] - Offset for centering element when scrolled to
* @prop {String} [activeClass='active'] - Class applied to active elements
* @prop {Function} [getActiveElement] - Used to find active element
*/
_this35.options = $.extend({}, ScrollSpy.defaults, options);
// setup
ScrollSpy._elements.push(_this35);
ScrollSpy._count++;
ScrollSpy._increment++;
_this35.tickId = -1;
_this35.id = ScrollSpy._increment;
_this35._setupEventHandlers();
_this35._handleWindowScroll();
return _this35;
} | javascript | function ScrollSpy(el, options) {
_classCallCheck(this, ScrollSpy);
var _this35 = _possibleConstructorReturn(this, (ScrollSpy.__proto__ || Object.getPrototypeOf(ScrollSpy)).call(this, ScrollSpy, el, options));
_this35.el.M_ScrollSpy = _this35;
/**
* Options for the modal
* @member Modal#options
* @prop {Number} [throttle=100] - Throttle of scroll handler
* @prop {Number} [scrollOffset=200] - Offset for centering element when scrolled to
* @prop {String} [activeClass='active'] - Class applied to active elements
* @prop {Function} [getActiveElement] - Used to find active element
*/
_this35.options = $.extend({}, ScrollSpy.defaults, options);
// setup
ScrollSpy._elements.push(_this35);
ScrollSpy._count++;
ScrollSpy._increment++;
_this35.tickId = -1;
_this35.id = ScrollSpy._increment;
_this35._setupEventHandlers();
_this35._handleWindowScroll();
return _this35;
} | [
"function",
"ScrollSpy",
"(",
"el",
",",
"options",
")",
"{",
"_classCallCheck",
"(",
"this",
",",
"ScrollSpy",
")",
";",
"var",
"_this35",
"=",
"_possibleConstructorReturn",
"(",
"this",
",",
"(",
"ScrollSpy",
".",
"__proto__",
"||",
"Object",
".",
"getProt... | Construct ScrollSpy instance
@constructor
@param {Element} el
@param {Object} options | [
"Construct",
"ScrollSpy",
"instance"
] | 1122efadad8f1433d404696f7613e3cc13fb83a4 | https://github.com/Dogfalo/materialize/blob/1122efadad8f1433d404696f7613e3cc13fb83a4/dist/js/materialize.js#L6129-L6155 | train | Construct a new ScrollSpy instance | [
30522,
3853,
23074,
7685,
1006,
3449,
1010,
7047,
1007,
1063,
1035,
2465,
9289,
29358,
11012,
1006,
2023,
1010,
23074,
7685,
1007,
1025,
13075,
1035,
2023,
19481,
1027,
1035,
2825,
8663,
3367,
6820,
16761,
13465,
14287,
1006,
2023,
1010,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/incubator-echarts | src/data/Tree.js | function (options, cb, context) {
if (typeof options === 'function') {
context = cb;
cb = options;
options = null;
}
options = options || {};
if (zrUtil.isString(options)) {
options = {order: options};
}
var order = options.order || 'preorder';
var children = this[options.attr || 'children'];
var suppressVisitSub;
order === 'preorder' && (suppressVisitSub = cb.call(context, this));
for (var i = 0; !suppressVisitSub && i < children.length; i++) {
children[i].eachNode(options, cb, context);
}
order === 'postorder' && cb.call(context, this);
} | javascript | function (options, cb, context) {
if (typeof options === 'function') {
context = cb;
cb = options;
options = null;
}
options = options || {};
if (zrUtil.isString(options)) {
options = {order: options};
}
var order = options.order || 'preorder';
var children = this[options.attr || 'children'];
var suppressVisitSub;
order === 'preorder' && (suppressVisitSub = cb.call(context, this));
for (var i = 0; !suppressVisitSub && i < children.length; i++) {
children[i].eachNode(options, cb, context);
}
order === 'postorder' && cb.call(context, this);
} | [
"function",
"(",
"options",
",",
"cb",
",",
"context",
")",
"{",
"if",
"(",
"typeof",
"options",
"===",
"'function'",
")",
"{",
"context",
"=",
"cb",
";",
"cb",
"=",
"options",
";",
"options",
"=",
"null",
";",
"}",
"options",
"=",
"options",
"||",
... | Travel this subtree (include this node).
Usage:
node.eachNode(function () { ... }); // preorder
node.eachNode('preorder', function () { ... }); // preorder
node.eachNode('postorder', function () { ... }); // postorder
node.eachNode(
{order: 'postorder', attr: 'viewChildren'},
function () { ... }
); // postorder
@param {(Object|string)} options If string, means order.
@param {string=} options.order 'preorder' or 'postorder'
@param {string=} options.attr 'children' or 'viewChildren'
@param {Function} cb If in preorder and return false,
its subtree will not be visited.
@param {Object} [context] | [
"Travel",
"this",
"subtree",
"(",
"include",
"this",
"node",
")",
".",
"Usage",
":",
"node",
".",
"eachNode",
"(",
"function",
"()",
"{",
"...",
"}",
")",
";",
"//",
"preorder",
"node",
".",
"eachNode",
"(",
"preorder",
"function",
"()",
"{",
"...",
... | 4d0ea095dc3929cb6de40c45748826e7999c7aa8 | https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/data/Tree.js#L125-L148 | train | Iterate over all nodes in the tree and call the callback with the node | [
30522,
3853,
1006,
7047,
1010,
17324,
1010,
6123,
1007,
1063,
2065,
1006,
2828,
11253,
7047,
1027,
1027,
1027,
1005,
3853,
1005,
1007,
1063,
6123,
1027,
17324,
1025,
17324,
1027,
7047,
1025,
7047,
1027,
19701,
1025,
1065,
7047,
1027,
7047,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | src/sap.m/src/sap/m/GrowingEnablement.js | function(oBinding) {
var aSorters = oBinding.aSorters || [];
var oSorter = aSorters[0] || {};
return (oSorter.fnGroup) ? oSorter.sPath || "" : "";
} | javascript | function(oBinding) {
var aSorters = oBinding.aSorters || [];
var oSorter = aSorters[0] || {};
return (oSorter.fnGroup) ? oSorter.sPath || "" : "";
} | [
"function",
"(",
"oBinding",
")",
"{",
"var",
"aSorters",
"=",
"oBinding",
".",
"aSorters",
"||",
"[",
"]",
";",
"var",
"oSorter",
"=",
"aSorters",
"[",
"0",
"]",
"||",
"{",
"}",
";",
"return",
"(",
"oSorter",
".",
"fnGroup",
")",
"?",
"oSorter",
"... | returns the first sorters grouping path when available | [
"returns",
"the",
"first",
"sorters",
"grouping",
"path",
"when",
"available"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/GrowingEnablement.js#L269-L273 | train | Returns the path of the first sorter in the list of sorters | [
30522,
3853,
1006,
27885,
22254,
2075,
1007,
1063,
13075,
2004,
11589,
2545,
1027,
30524,
14690,
2232,
1064,
1064,
1000,
1000,
1024,
1000,
1000,
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... | |
wuchangming/spy-debugger | buildin_modules/weinre/web/interfaces/interfaces.js | showInterfaceIdlMethod | function showInterfaceIdlMethod(method, html) {
var line = "\n "
var allParameters = method.parameters.concat(method.callbackParameters)
line += getIdlType(method.returns)
line += " <span class='methodName'>" + method.name + "</span> (" + getIdlParameterList(allParameters) + ");"
html.push(line)
} | javascript | function showInterfaceIdlMethod(method, html) {
var line = "\n "
var allParameters = method.parameters.concat(method.callbackParameters)
line += getIdlType(method.returns)
line += " <span class='methodName'>" + method.name + "</span> (" + getIdlParameterList(allParameters) + ");"
html.push(line)
} | [
"function",
"showInterfaceIdlMethod",
"(",
"method",
",",
"html",
")",
"{",
"var",
"line",
"=",
"\"\\n \"",
"var",
"allParameters",
"=",
"method",
".",
"parameters",
".",
"concat",
"(",
"method",
".",
"callbackParameters",
")",
"line",
"+=",
"getIdlType",
"(... | ----------------------------------------------------------------------------- | [
"-----------------------------------------------------------------------------"
] | 55c1dda0dff0c44920673711656ddfd7ff03c307 | https://github.com/wuchangming/spy-debugger/blob/55c1dda0dff0c44920673711656ddfd7ff03c307/buildin_modules/weinre/web/interfaces/interfaces.js#L179-L187 | train | showInterfaceIdlMethod - Show the method | [
30522,
3853,
2265,
18447,
2121,
12172,
3593,
13728,
11031,
7716,
1006,
4118,
1010,
16129,
1007,
1063,
13075,
2240,
1027,
1000,
1032,
1050,
1000,
13075,
2035,
28689,
22828,
2015,
1027,
4118,
1012,
11709,
1012,
9530,
11266,
1006,
4118,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/model/analytics/odata4analytics.js | function(aMeasureName) {
if (!aMeasureName) {
aMeasureName = this._oQueryResult.getAllMeasureNames();
}
this._oSelectedPropertyNames = null; // reset previously compiled list of selected properties
this._oMeasures = {};
for (var i = -1, sMeasName; (sMeasName = aMeasureName[++i]) !== undefined;) {
if (!this._oQueryResult.findMeasureByName(sMeasName)) {
throw sMeasName + " is not a valid measure name"; // TODO
}
this._oMeasures[sMeasName] = {
value : true,
text : false,
unit : false
};
}
} | javascript | function(aMeasureName) {
if (!aMeasureName) {
aMeasureName = this._oQueryResult.getAllMeasureNames();
}
this._oSelectedPropertyNames = null; // reset previously compiled list of selected properties
this._oMeasures = {};
for (var i = -1, sMeasName; (sMeasName = aMeasureName[++i]) !== undefined;) {
if (!this._oQueryResult.findMeasureByName(sMeasName)) {
throw sMeasName + " is not a valid measure name"; // TODO
}
this._oMeasures[sMeasName] = {
value : true,
text : false,
unit : false
};
}
} | [
"function",
"(",
"aMeasureName",
")",
"{",
"if",
"(",
"!",
"aMeasureName",
")",
"{",
"aMeasureName",
"=",
"this",
".",
"_oQueryResult",
".",
"getAllMeasureNames",
"(",
")",
";",
"}",
"this",
".",
"_oSelectedPropertyNames",
"=",
"null",
";",
"// reset previousl... | Set the measures to be included in the query result request. By default,
the query result will include the properties holding the raw values of
the given measures. This setting can be changed using
includeMeasureRawFormattedValueUnit.
@param aMeasureName
Array of measure names to be part of the query result request.
If null, the request includes all measures, if empty, no
measure is included.
@public
@function
@name sap.ui.model.analytics.odata4analytics.QueryResultRequest#setMeasures | [
"Set",
"the",
"measures",
"to",
"be",
"included",
"in",
"the",
"query",
"result",
"request",
".",
"By",
"default",
"the",
"query",
"result",
"will",
"include",
"the",
"properties",
"holding",
"the",
"raw",
"values",
"of",
"the",
"given",
"measures",
".",
"... | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/analytics/odata4analytics.js#L4302-L4320 | train | Sets the selected properties of the query result | [
30522,
3853,
1006,
2572,
5243,
28632,
18442,
1007,
1063,
2065,
1006,
999,
2572,
5243,
28632,
18442,
1007,
1063,
2572,
5243,
28632,
18442,
1027,
2023,
1012,
1035,
1051,
4226,
2854,
6072,
11314,
1012,
2131,
8095,
4168,
3022,
5397,
18442,
2015... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | src/sap.ui.dt/src/sap/ui/dt/ContextMenuControl.js | function () {
var sPopId = this.getId() + "-popover";
var oPopover = new Popover(sPopId, {
showHeader: false,
verticalScrolling: false,
placement: "Top",
showArrow: true,
horizontalScrolling: false,
content: new HBox(sPopId + "ContentBox", {
renderType: "Bare"
})
});
// Returns the duration for the Popover's closing animation.
// It particularily concerns the setting of the focus within the contextMenu
oPopover._getAnimationDuration = function() {
return 0;
};
oPopover.attachBrowserEvent("keydown", this._changeFocusOnKeyStroke, this);
oPopover.oPopup.attachClosed(this._popupClosed, this);
this._oPopover = oPopover;
oPopover.addStyleClass("sapUiDtContextMenu");
var sPopExpId = this.getId() + "-popoverExp";
var oPopoverExpanded = new Popover(sPopExpId, {
showHeader: false,
showArrow: false,
verticalScrolling: false,
horizontalScrolling: false,
content: new VBox(sPopExpId + "ContentBox", {
renderType: "Bare"
})
});
// Returns the duration for the Popover's closing animation.
// It particularily concerns the setting of the focus within the contextMenu
oPopoverExpanded._getAnimationDuration = function() {
return 0;
};
oPopoverExpanded.attachBrowserEvent("keydown", this._changeFocusOnKeyStroke, this);
oPopoverExpanded.oPopup.attachClosed(this._popupClosed, this);
this._oExpandedPopover = oPopoverExpanded;
oPopoverExpanded.addStyleClass("sapUiDtContextMenu");
oPopover.attachBrowserEvent("contextmenu", this._onContextMenu, this);
oPopoverExpanded.attachBrowserEvent("contextmenu", this._onContextMenu, this);
this.bOnInit = true;
} | javascript | function () {
var sPopId = this.getId() + "-popover";
var oPopover = new Popover(sPopId, {
showHeader: false,
verticalScrolling: false,
placement: "Top",
showArrow: true,
horizontalScrolling: false,
content: new HBox(sPopId + "ContentBox", {
renderType: "Bare"
})
});
// Returns the duration for the Popover's closing animation.
// It particularily concerns the setting of the focus within the contextMenu
oPopover._getAnimationDuration = function() {
return 0;
};
oPopover.attachBrowserEvent("keydown", this._changeFocusOnKeyStroke, this);
oPopover.oPopup.attachClosed(this._popupClosed, this);
this._oPopover = oPopover;
oPopover.addStyleClass("sapUiDtContextMenu");
var sPopExpId = this.getId() + "-popoverExp";
var oPopoverExpanded = new Popover(sPopExpId, {
showHeader: false,
showArrow: false,
verticalScrolling: false,
horizontalScrolling: false,
content: new VBox(sPopExpId + "ContentBox", {
renderType: "Bare"
})
});
// Returns the duration for the Popover's closing animation.
// It particularily concerns the setting of the focus within the contextMenu
oPopoverExpanded._getAnimationDuration = function() {
return 0;
};
oPopoverExpanded.attachBrowserEvent("keydown", this._changeFocusOnKeyStroke, this);
oPopoverExpanded.oPopup.attachClosed(this._popupClosed, this);
this._oExpandedPopover = oPopoverExpanded;
oPopoverExpanded.addStyleClass("sapUiDtContextMenu");
oPopover.attachBrowserEvent("contextmenu", this._onContextMenu, this);
oPopoverExpanded.attachBrowserEvent("contextmenu", this._onContextMenu, this);
this.bOnInit = true;
} | [
"function",
"(",
")",
"{",
"var",
"sPopId",
"=",
"this",
".",
"getId",
"(",
")",
"+",
"\"-popover\"",
";",
"var",
"oPopover",
"=",
"new",
"Popover",
"(",
"sPopId",
",",
"{",
"showHeader",
":",
"false",
",",
"verticalScrolling",
":",
"false",
",",
"plac... | initializes the ContextMenu by creating the internal a sap.m.Popover (with a sap.m.Flexbox as a content aggregation) in internal _popovers aggregation of the ContextMenu | [
"initializes",
"the",
"ContextMenu",
"by",
"creating",
"the",
"internal",
"a",
"sap",
".",
"m",
".",
"Popover",
"(",
"with",
"a",
"sap",
".",
"m",
".",
"Flexbox",
"as",
"a",
"content",
"aggregation",
")",
"in",
"internal",
"_popovers",
"aggregation",
"of",... | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.dt/src/sap/ui/dt/ContextMenuControl.js#L92-L141 | train | Creates the Popover and adds the CSS class to the ContextMenu. | [
30522,
3853,
1006,
1007,
1063,
13075,
11867,
7361,
3593,
1027,
2023,
1012,
2131,
3593,
1006,
1007,
1009,
1000,
1011,
3769,
7840,
1000,
1025,
13075,
6728,
7361,
7840,
1027,
2047,
3769,
7840,
1006,
11867,
7361,
3593,
1010,
1063,
2265,
4974,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/controllers/Analysis.controller.js | function (aColumnsIds, bVisibilityValue) {
var aColumns = this.treeTable.getColumns();
aColumns.forEach(function(oColumn) {
oColumn.setVisible(!bVisibilityValue);
aColumnsIds.forEach(function(sRuleId) {
if (oColumn.sId.includes(sRuleId)) {
oColumn.setVisible(bVisibilityValue);
}
});
});
} | javascript | function (aColumnsIds, bVisibilityValue) {
var aColumns = this.treeTable.getColumns();
aColumns.forEach(function(oColumn) {
oColumn.setVisible(!bVisibilityValue);
aColumnsIds.forEach(function(sRuleId) {
if (oColumn.sId.includes(sRuleId)) {
oColumn.setVisible(bVisibilityValue);
}
});
});
} | [
"function",
"(",
"aColumnsIds",
",",
"bVisibilityValue",
")",
"{",
"var",
"aColumns",
"=",
"this",
".",
"treeTable",
".",
"getColumns",
"(",
")",
";",
"aColumns",
".",
"forEach",
"(",
"function",
"(",
"oColumn",
")",
"{",
"oColumn",
".",
"setVisible",
"(",... | Sets visibility to columns.
@param {Array} aColumnsIds Ids of columns
@param {boolean} bVisibilityValue | [
"Sets",
"visibility",
"to",
"columns",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.support/src/sap/ui/support/supportRules/ui/controllers/Analysis.controller.js#L996-L1007 | train | Sets visibility of the columns | [
30522,
3853,
1006,
9353,
4747,
2819,
3619,
9821,
1010,
1038,
11365,
13464,
10175,
5657,
1007,
1063,
13075,
9353,
4747,
2819,
3619,
1027,
30524,
1006,
3853,
1006,
1051,
25778,
2819,
2078,
1007,
1063,
1051,
25778,
2819,
2078,
1012,
2275,
1136... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | src/sap.ui.core/src/sap/ui/core/support/techinfo/moduleTreeHelper.js | function (oHierarchy, oTree, iDepth, bSelected) {
var iSelectionDepth,
iInnerSelectionDepth;
bSelected = oHierarchy === true || oHierarchy[""] || bSelected;
oTree.nodes = [];
oTree.selected = bSelected;
if (bSelected) {
iSelectionDepth = iDepth;
}
for (var sProperty in oHierarchy) {
if (sProperty === "") {
continue;
}
var oChildNode = {
text: sProperty
};
iInnerSelectionDepth = this.setTreeNode(oHierarchy[sProperty], oChildNode, iDepth + 1, bSelected);
if (iInnerSelectionDepth > iSelectionDepth || !iSelectionDepth) {
iSelectionDepth = iInnerSelectionDepth;
}
oTree.nodes.push(oChildNode);
}
return iSelectionDepth;
} | javascript | function (oHierarchy, oTree, iDepth, bSelected) {
var iSelectionDepth,
iInnerSelectionDepth;
bSelected = oHierarchy === true || oHierarchy[""] || bSelected;
oTree.nodes = [];
oTree.selected = bSelected;
if (bSelected) {
iSelectionDepth = iDepth;
}
for (var sProperty in oHierarchy) {
if (sProperty === "") {
continue;
}
var oChildNode = {
text: sProperty
};
iInnerSelectionDepth = this.setTreeNode(oHierarchy[sProperty], oChildNode, iDepth + 1, bSelected);
if (iInnerSelectionDepth > iSelectionDepth || !iSelectionDepth) {
iSelectionDepth = iInnerSelectionDepth;
}
oTree.nodes.push(oChildNode);
}
return iSelectionDepth;
} | [
"function",
"(",
"oHierarchy",
",",
"oTree",
",",
"iDepth",
",",
"bSelected",
")",
"{",
"var",
"iSelectionDepth",
",",
"iInnerSelectionDepth",
";",
"bSelected",
"=",
"oHierarchy",
"===",
"true",
"||",
"oHierarchy",
"[",
"\"\"",
"]",
"||",
"bSelected",
";",
"... | Recursively constructs tree nodes in a format that it can be bound to a sap.m.Tree control
@param {object} oHierarchy The module hierarchy node with selected state
@param {object} oTree The tree node to be filled with the hierarchy information
@param {int} iDepth The current depth of the recursion
@param {boolean} bSelected The selected state of the parent node
@return {int} The depth of the deepest node in the tree | [
"Recursively",
"constructs",
"tree",
"nodes",
"in",
"a",
"format",
"that",
"it",
"can",
"be",
"bound",
"to",
"a",
"sap",
".",
"m",
".",
"Tree",
"control"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/support/techinfo/moduleTreeHelper.js#L147-L174 | train | Sets the selected property of the tree | [
30522,
3853,
1006,
2821,
3771,
2906,
11714,
1010,
27178,
9910,
1010,
8909,
23606,
2232,
1010,
18667,
12260,
10985,
1007,
1063,
13075,
2003,
12260,
7542,
3207,
13876,
2232,
1010,
2462,
10087,
22573,
2571,
7542,
3207,
13876,
2232,
1025,
18667,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | src/sap.ui.core/src/sap/ui/dom/jquery/Aria.js | addToAttributeList | function addToAttributeList(sAttribute, sValue, bPrepend) {
var sAttributes = this.attr(sAttribute);
if (!sAttributes) {
return this.attr(sAttribute, sValue);
}
var aAttributes = sAttributes.split(" ");
if (aAttributes.indexOf(sValue) == -1) {
bPrepend ? aAttributes.unshift(sValue) : aAttributes.push(sValue);
this.attr(sAttribute, aAttributes.join(" "));
}
return this;
} | javascript | function addToAttributeList(sAttribute, sValue, bPrepend) {
var sAttributes = this.attr(sAttribute);
if (!sAttributes) {
return this.attr(sAttribute, sValue);
}
var aAttributes = sAttributes.split(" ");
if (aAttributes.indexOf(sValue) == -1) {
bPrepend ? aAttributes.unshift(sValue) : aAttributes.push(sValue);
this.attr(sAttribute, aAttributes.join(" "));
}
return this;
} | [
"function",
"addToAttributeList",
"(",
"sAttribute",
",",
"sValue",
",",
"bPrepend",
")",
"{",
"var",
"sAttributes",
"=",
"this",
".",
"attr",
"(",
"sAttribute",
")",
";",
"if",
"(",
"!",
"sAttributes",
")",
"{",
"return",
"this",
".",
"attr",
"(",
"sAtt... | This module provides the following API:
<ul>
<li>{@link jQuery#addAriaLabelledBy}</li>
<li>{@link jQuery#removeAriaLabelledBy}</li>
<li>{@link jQuery#addAriaDescribedBy}</li>
<li>{@link jQuery#removeAriaDescribedBy}</li>
</ul>
@namespace
@name module:sap/ui/dom/jquery/Aria
@public
@since 1.58
Adds space separated value to the given attribute.
This method ignores when the value is already available for the given attribute.
@this {jQuery} jQuery context
@param {string} sAttribute The name of the attribute.
@param {string} sValue The value of the attribute to be inserted.
@param {string} [bPrepend=false] Whether prepend or not
@return {jQuery} <code>this</code> to allow method chaining.
@author SAP SE
@function
@private | [
"This",
"module",
"provides",
"the",
"following",
"API",
":",
"<ul",
">",
"<li",
">",
"{",
"@link",
"jQuery#addAriaLabelledBy",
"}",
"<",
"/",
"li",
">",
"<li",
">",
"{",
"@link",
"jQuery#removeAriaLabelledBy",
"}",
"<",
"/",
"li",
">",
"<li",
">",
"{",
... | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/dom/jquery/Aria.js#L36-L49 | train | Adds an attribute to the end of the list of attributes | [
30522,
3853,
5587,
3406,
19321,
3089,
8569,
9834,
2923,
1006,
2938,
18886,
8569,
2618,
1010,
17917,
2389,
5657,
1010,
17531,
2890,
11837,
2094,
1007,
1063,
13075,
2938,
18886,
8569,
4570,
1027,
2023,
1012,
2012,
16344,
1006,
2938,
18886,
85... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/model/analytics/odata4analytics.js | function (aOldColumns, aNewColumns, fnFormatterChanged) {
var oNewColumn,
oOldColumn,
iResult = 0,
i,
n;
if (!aOldColumns || aOldColumns.length !== aNewColumns.length) {
return 2;
}
if (aOldColumns !== aNewColumns) {
for (i = 0, n = aOldColumns.length; i < n; i += 1) {
oOldColumn = aOldColumns[i];
oNewColumn = aNewColumns[i];
if (oOldColumn.grouped !== oNewColumn.grouped
|| oOldColumn.inResult !== oNewColumn.inResult
|| oOldColumn.level !== oNewColumn.level
|| oOldColumn.name !== oNewColumn.name
|| oOldColumn.total !== oNewColumn.total
|| oOldColumn.visible !== oNewColumn.visible) {
return 2;
}
if (oOldColumn.formatter !== oNewColumn.formatter) {
iResult = 1;
if (fnFormatterChanged) {
fnFormatterChanged(oNewColumn);
}
}
}
}
return iResult;
} | javascript | function (aOldColumns, aNewColumns, fnFormatterChanged) {
var oNewColumn,
oOldColumn,
iResult = 0,
i,
n;
if (!aOldColumns || aOldColumns.length !== aNewColumns.length) {
return 2;
}
if (aOldColumns !== aNewColumns) {
for (i = 0, n = aOldColumns.length; i < n; i += 1) {
oOldColumn = aOldColumns[i];
oNewColumn = aNewColumns[i];
if (oOldColumn.grouped !== oNewColumn.grouped
|| oOldColumn.inResult !== oNewColumn.inResult
|| oOldColumn.level !== oNewColumn.level
|| oOldColumn.name !== oNewColumn.name
|| oOldColumn.total !== oNewColumn.total
|| oOldColumn.visible !== oNewColumn.visible) {
return 2;
}
if (oOldColumn.formatter !== oNewColumn.formatter) {
iResult = 1;
if (fnFormatterChanged) {
fnFormatterChanged(oNewColumn);
}
}
}
}
return iResult;
} | [
"function",
"(",
"aOldColumns",
",",
"aNewColumns",
",",
"fnFormatterChanged",
")",
"{",
"var",
"oNewColumn",
",",
"oOldColumn",
",",
"iResult",
"=",
"0",
",",
"i",
",",
"n",
";",
"if",
"(",
"!",
"aOldColumns",
"||",
"aOldColumns",
".",
"length",
"!==",
... | /*
@param {object[]} [aOldColumns]
@param {object[]} aNewColumns
@param {function} [fnFormatterChanged]
called for each column where only a formatter has changed
@returns {number} 0: same, 1: only formatters changed, 2: important changes | [
"/",
"*"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/analytics/odata4analytics.js#L51-L83 | train | Compare two columns | [
30522,
3853,
1006,
20118,
6392,
25778,
2819,
3619,
1010,
2019,
7974,
25778,
2819,
3619,
1010,
1042,
2078,
14192,
20097,
22305,
2098,
1007,
1063,
13075,
2028,
16526,
4747,
2819,
2078,
1010,
1051,
11614,
25778,
2819,
2078,
1010,
20868,
2229,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
angular/material | src/components/autocomplete/js/autocompleteController.js | moveDropdown | function moveDropdown () {
if (!elements.$.root.length) return;
$mdTheming(elements.$.scrollContainer);
elements.$.scrollContainer.detach();
elements.$.root.append(elements.$.scrollContainer);
if ($animate.pin) $animate.pin(elements.$.scrollContainer, $rootElement);
} | javascript | function moveDropdown () {
if (!elements.$.root.length) return;
$mdTheming(elements.$.scrollContainer);
elements.$.scrollContainer.detach();
elements.$.root.append(elements.$.scrollContainer);
if ($animate.pin) $animate.pin(elements.$.scrollContainer, $rootElement);
} | [
"function",
"moveDropdown",
"(",
")",
"{",
"if",
"(",
"!",
"elements",
".",
"$",
".",
"root",
".",
"length",
")",
"return",
";",
"$mdTheming",
"(",
"elements",
".",
"$",
".",
"scrollContainer",
")",
";",
"elements",
".",
"$",
".",
"scrollContainer",
".... | Moves the dropdown menu to the body tag in order to avoid z-index and overflow issues. | [
"Moves",
"the",
"dropdown",
"menu",
"to",
"the",
"body",
"tag",
"in",
"order",
"to",
"avoid",
"z",
"-",
"index",
"and",
"overflow",
"issues",
"."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/autocomplete/js/autocompleteController.js#L218-L224 | train | Move the dropdown to the root element | [
30522,
3853,
2333,
18981,
7698,
1006,
1007,
1063,
2065,
1006,
999,
3787,
1012,
1002,
1012,
7117,
1012,
3091,
1007,
2709,
1025,
1002,
9108,
10760,
6562,
1006,
3787,
1012,
30524,
17186,
8663,
18249,
2121,
1007,
1025,
2065,
1006,
1002,
2019,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
angular/material | src/components/autocomplete/autocomplete.spec.js | fakeItemMatch | function fakeItemMatch() {
var matches = [];
for (var i = 0; i < dropdownItems; i++) {
matches.push('Item ' + i);
}
return matches;
} | javascript | function fakeItemMatch() {
var matches = [];
for (var i = 0; i < dropdownItems; i++) {
matches.push('Item ' + i);
}
return matches;
} | [
"function",
"fakeItemMatch",
"(",
")",
"{",
"var",
"matches",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"dropdownItems",
";",
"i",
"++",
")",
"{",
"matches",
".",
"push",
"(",
"'Item '",
"+",
"i",
")",
";",
"}",
"retu... | Function to create fake matches with the given dropdown items.
Useful when running tests against the dropdown max items calculations.
@returns {Array} Fake matches. | [
"Function",
"to",
"create",
"fake",
"matches",
"with",
"the",
"given",
"dropdown",
"items",
".",
"Useful",
"when",
"running",
"tests",
"against",
"the",
"dropdown",
"max",
"items",
"calculations",
"."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/autocomplete/autocomplete.spec.js#L2456-L2464 | train | fakeItemMatch - fake item match | [
30522,
3853,
8275,
4221,
14760,
10649,
1006,
1007,
1063,
13075,
3503,
1027,
1031,
1033,
1025,
2005,
1006,
13075,
1045,
1027,
1014,
1025,
1045,
1026,
30524,
1012,
5245,
1006,
1005,
8875,
1005,
1009,
1045,
1007,
1025,
1065,
2709,
3503,
1025,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
wuchangming/spy-debugger | buildin_modules/weinre/web/client/UglifyJS/process.js | repeat_string | function repeat_string(str, i) {
if (i <= 0) return "";
if (i == 1) return str;
var d = repeat_string(str, i >> 1);
d += d;
if (i & 1) d += str;
return d;
} | javascript | function repeat_string(str, i) {
if (i <= 0) return "";
if (i == 1) return str;
var d = repeat_string(str, i >> 1);
d += d;
if (i & 1) d += str;
return d;
} | [
"function",
"repeat_string",
"(",
"str",
",",
"i",
")",
"{",
"if",
"(",
"i",
"<=",
"0",
")",
"return",
"\"\"",
";",
"if",
"(",
"i",
"==",
"1",
")",
"return",
"str",
";",
"var",
"d",
"=",
"repeat_string",
"(",
"str",
",",
"i",
">>",
"1",
")",
... | /* -----[ Utilities ]----- | [
"/",
"*",
"-----",
"[",
"Utilities",
"]",
"-----"
] | 55c1dda0dff0c44920673711656ddfd7ff03c307 | https://github.com/wuchangming/spy-debugger/blob/55c1dda0dff0c44920673711656ddfd7ff03c307/buildin_modules/weinre/web/client/UglifyJS/process.js#L1439-L1446 | train | repeat_string - Repeats a string | [
30522,
3853,
9377,
1035,
5164,
1006,
2358,
2099,
1010,
1045,
1007,
1063,
2065,
1006,
1045,
1026,
1027,
1014,
1007,
2709,
1000,
1000,
1025,
2065,
1006,
1045,
1027,
1027,
1015,
1007,
2709,
2358,
2099,
1025,
13075,
1040,
1027,
9377,
1035,
51... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
TryGhost/Ghost | core/server/models/base/index.js | onUpdating | function onUpdating(model, attr, options) {
if (this.relationships) {
model.changed = _.omit(model.changed, this.relationships);
}
if (schema.tables[this.tableName].hasOwnProperty('updated_by')) {
if (!options.importing && !options.migrating) {
this.set('updated_by', String(this.contextUser(options)));
}
}
if (options && options.context && !options.context.internal && !options.importing) {
if (schema.tables[this.tableName].hasOwnProperty('created_at')) {
if (model.hasDateChanged('created_at', {beforeWrite: true})) {
model.set('created_at', this.previous('created_at'));
}
}
if (schema.tables[this.tableName].hasOwnProperty('created_by')) {
if (model.hasChanged('created_by')) {
model.set('created_by', String(this.previous('created_by')));
}
}
}
// CASE: do not allow setting only the `updated_at` field, exception: importing
if (schema.tables[this.tableName].hasOwnProperty('updated_at') && !options.importing) {
if (options.migrating) {
model.set('updated_at', model.previous('updated_at'));
} else if (Object.keys(model.changed).length === 1 && model.changed.updated_at) {
model.set('updated_at', model.previous('updated_at'));
delete model.changed.updated_at;
}
}
model._changed = _.cloneDeep(model.changed);
return Promise.resolve(this.onValidate(model, attr, options));
} | javascript | function onUpdating(model, attr, options) {
if (this.relationships) {
model.changed = _.omit(model.changed, this.relationships);
}
if (schema.tables[this.tableName].hasOwnProperty('updated_by')) {
if (!options.importing && !options.migrating) {
this.set('updated_by', String(this.contextUser(options)));
}
}
if (options && options.context && !options.context.internal && !options.importing) {
if (schema.tables[this.tableName].hasOwnProperty('created_at')) {
if (model.hasDateChanged('created_at', {beforeWrite: true})) {
model.set('created_at', this.previous('created_at'));
}
}
if (schema.tables[this.tableName].hasOwnProperty('created_by')) {
if (model.hasChanged('created_by')) {
model.set('created_by', String(this.previous('created_by')));
}
}
}
// CASE: do not allow setting only the `updated_at` field, exception: importing
if (schema.tables[this.tableName].hasOwnProperty('updated_at') && !options.importing) {
if (options.migrating) {
model.set('updated_at', model.previous('updated_at'));
} else if (Object.keys(model.changed).length === 1 && model.changed.updated_at) {
model.set('updated_at', model.previous('updated_at'));
delete model.changed.updated_at;
}
}
model._changed = _.cloneDeep(model.changed);
return Promise.resolve(this.onValidate(model, attr, options));
} | [
"function",
"onUpdating",
"(",
"model",
",",
"attr",
",",
"options",
")",
"{",
"if",
"(",
"this",
".",
"relationships",
")",
"{",
"model",
".",
"changed",
"=",
"_",
".",
"omit",
"(",
"model",
".",
"changed",
",",
"this",
".",
"relationships",
")",
";... | Changing resources implies setting these properties on the server side
- set `updated_by` based on the context
- ensure `created_at` never changes
- ensure `created_by` never changes
- the bookshelf `timestamps` plugin sets `updated_at` automatically
Exceptions:
- importing data
- internal context
- if no context
@deprecated: x_by fields (https://github.com/TryGhost/Ghost/issues/10286) | [
"Changing",
"resources",
"implies",
"setting",
"these",
"properties",
"on",
"the",
"server",
"side",
"-",
"set",
"updated_by",
"based",
"on",
"the",
"context",
"-",
"ensure",
"created_at",
"never",
"changes",
"-",
"ensure",
"created_by",
"never",
"changes",
"-",... | bb7bb55cf3e60af99ebbc56099928827b58461bc | https://github.com/TryGhost/Ghost/blob/bb7bb55cf3e60af99ebbc56099928827b58461bc/core/server/models/base/index.js#L376-L414 | train | onUpdating - Updates the model | [
30522,
3853,
2006,
6279,
16616,
1006,
2944,
1010,
2012,
16344,
1010,
7047,
1007,
1063,
2065,
1006,
2023,
1012,
6550,
1007,
1063,
2944,
1012,
2904,
1027,
1035,
1012,
18168,
4183,
1006,
2944,
1012,
2904,
1010,
2023,
1012,
6550,
1007,
1025,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
grpc/grpc-node | packages/grpc-native-core/src/server.js | handleUnary | function handleUnary(call, handler, metadata) {
var emitter = new ServerUnaryCall(call, metadata);
emitter.on('error', function(error) {
handleError(call, error);
});
emitter.waitForCancel();
var batch = {};
batch[grpc.opType.RECV_MESSAGE] = true;
call.startBatch(batch, function(err, result) {
if (err) {
handleError(call, err);
return;
}
try {
emitter.request = handler.deserialize(result.read);
} catch (e) {
e.code = constants.status.INTERNAL;
handleError(call, e);
return;
}
if (emitter.cancelled) {
return;
}
handler.func(emitter, function sendUnaryData(err, value, trailer, flags) {
if (err) {
if (trailer) {
err.metadata = trailer;
}
handleError(call, err);
} else {
sendUnaryResponse(call, value, handler.serialize, trailer, flags);
}
});
});
} | javascript | function handleUnary(call, handler, metadata) {
var emitter = new ServerUnaryCall(call, metadata);
emitter.on('error', function(error) {
handleError(call, error);
});
emitter.waitForCancel();
var batch = {};
batch[grpc.opType.RECV_MESSAGE] = true;
call.startBatch(batch, function(err, result) {
if (err) {
handleError(call, err);
return;
}
try {
emitter.request = handler.deserialize(result.read);
} catch (e) {
e.code = constants.status.INTERNAL;
handleError(call, e);
return;
}
if (emitter.cancelled) {
return;
}
handler.func(emitter, function sendUnaryData(err, value, trailer, flags) {
if (err) {
if (trailer) {
err.metadata = trailer;
}
handleError(call, err);
} else {
sendUnaryResponse(call, value, handler.serialize, trailer, flags);
}
});
});
} | [
"function",
"handleUnary",
"(",
"call",
",",
"handler",
",",
"metadata",
")",
"{",
"var",
"emitter",
"=",
"new",
"ServerUnaryCall",
"(",
"call",
",",
"metadata",
")",
";",
"emitter",
".",
"on",
"(",
"'error'",
",",
"function",
"(",
"error",
")",
"{",
"... | User-provided method to handle unary requests on a server
@callback grpc.Server~handleUnaryCall
@param {grpc~ServerUnaryCall} call The call object
@param {grpc.Server~sendUnaryData} callback The callback to call to respond
to the request
Fully handle a unary call
@private
@param {grpc.internal~Call} call The call to handle
@param {Object} handler Request handler object for the method that was called
@param {grpc~Server.handleUnaryCall} handler.func The handler function
@param {grpc~deserialize} handler.deserialize The deserialization function
for request data
@param {grpc~serialize} handler.serialize The serialization function for
response data
@param {grpc.Metadata} metadata Metadata from the client | [
"User",
"-",
"provided",
"method",
"to",
"handle",
"unary",
"requests",
"on",
"a",
"server"
] | b36b285f4cdb334bbd48f74c12c13bec69961488 | https://github.com/grpc/grpc-node/blob/b36b285f4cdb334bbd48f74c12c13bec69961488/packages/grpc-native-core/src/server.js#L567-L601 | train | Handle unary call | [
30522,
3853,
5047,
9521,
2854,
1006,
2655,
1010,
28213,
1010,
27425,
1007,
1063,
13075,
12495,
12079,
1027,
2047,
8241,
9521,
2854,
9289,
2140,
1006,
2655,
1010,
27425,
1007,
1025,
12495,
12079,
1012,
2006,
1006,
1005,
7561,
1005,
1010,
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... |
caolan/async | lib/detectLimit.js | detectLimit | function detectLimit(coll, limit, iteratee, callback) {
return createTester(bool => bool, (res, item) => item)(eachOfLimit(limit), coll, iteratee, callback)
} | javascript | function detectLimit(coll, limit, iteratee, callback) {
return createTester(bool => bool, (res, item) => item)(eachOfLimit(limit), coll, iteratee, callback)
} | [
"function",
"detectLimit",
"(",
"coll",
",",
"limit",
",",
"iteratee",
",",
"callback",
")",
"{",
"return",
"createTester",
"(",
"bool",
"=>",
"bool",
",",
"(",
"res",
",",
"item",
")",
"=>",
"item",
")",
"(",
"eachOfLimit",
"(",
"limit",
")",
",",
"... | The same as [`detect`]{@link module:Collections.detect} but runs a maximum of `limit` async operations at a
time.
@name detectLimit
@static
@memberOf module:Collections
@method
@see [async.detect]{@link module:Collections.detect}
@alias findLimit
@category Collections
@param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
@param {number} limit - The maximum number of async operations at a time.
@param {AsyncFunction} iteratee - A truth test to apply to each item in `coll`.
The iteratee must complete with a boolean value as its result.
Invoked with (item, callback).
@param {Function} [callback] - A callback which is called as soon as any
iteratee returns `true`, or after all the `iteratee` functions have finished.
Result will be the first item in the array that passes the truth test
(iteratee) or the value `undefined` if none passed. Invoked with
(err, result).
@returns a Promise if no callback is passed | [
"The",
"same",
"as",
"[",
"detect",
"]",
"{",
"@link",
"module",
":",
"Collections",
".",
"detect",
"}",
"but",
"runs",
"a",
"maximum",
"of",
"limit",
"async",
"operations",
"at",
"a",
"time",
"."
] | 4330d536c106592139fa82062494c9dba0da1fdb | https://github.com/caolan/async/blob/4330d536c106592139fa82062494c9dba0da1fdb/lib/detectLimit.js#L28-L30 | train | Detects a limit of items in a collection. | [
30522,
3853,
11487,
17960,
4183,
1006,
8902,
2140,
1010,
5787,
1010,
2009,
22139,
2063,
1010,
2655,
5963,
1007,
1063,
2709,
3443,
22199,
2121,
1006,
22017,
2140,
1027,
1028,
22017,
2140,
1010,
1006,
24501,
1010,
8875,
1007,
1027,
1028,
8875... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
electron/electron | script/bump-version.js | nextVersion | async function nextVersion (bumpType, version) {
if (utils.isNightly(version) || utils.isBeta(version)) {
switch (bumpType) {
case 'nightly':
version = await utils.nextNightly(version)
break
case 'beta':
version = await utils.nextBeta(version)
break
case 'stable':
version = semver.valid(semver.coerce(version))
break
default:
throw new Error('Invalid bump type.')
}
} else if (utils.isStable(version)) {
switch (bumpType) {
case 'nightly':
version = utils.nextNightly(version)
break
case 'beta':
throw new Error('Cannot bump to beta from stable.')
case 'stable':
version = semver.inc(version, 'patch')
break
default:
throw new Error('Invalid bump type.')
}
} else {
throw new Error(`Invalid current version: ${version}`)
}
return version
} | javascript | async function nextVersion (bumpType, version) {
if (utils.isNightly(version) || utils.isBeta(version)) {
switch (bumpType) {
case 'nightly':
version = await utils.nextNightly(version)
break
case 'beta':
version = await utils.nextBeta(version)
break
case 'stable':
version = semver.valid(semver.coerce(version))
break
default:
throw new Error('Invalid bump type.')
}
} else if (utils.isStable(version)) {
switch (bumpType) {
case 'nightly':
version = utils.nextNightly(version)
break
case 'beta':
throw new Error('Cannot bump to beta from stable.')
case 'stable':
version = semver.inc(version, 'patch')
break
default:
throw new Error('Invalid bump type.')
}
} else {
throw new Error(`Invalid current version: ${version}`)
}
return version
} | [
"async",
"function",
"nextVersion",
"(",
"bumpType",
",",
"version",
")",
"{",
"if",
"(",
"utils",
".",
"isNightly",
"(",
"version",
")",
"||",
"utils",
".",
"isBeta",
"(",
"version",
")",
")",
"{",
"switch",
"(",
"bumpType",
")",
"{",
"case",
"'nightl... | get next version for release based on [nightly, beta, stable] | [
"get",
"next",
"version",
"for",
"release",
"based",
"on",
"[",
"nightly",
"beta",
"stable",
"]"
] | 6e29611788277729647acf465f10db1ea6f15788 | https://github.com/electron/electron/blob/6e29611788277729647acf465f10db1ea6f15788/script/bump-version.js#L72-L104 | train | Returns the next version in the sequence of terms | [
30522,
2004,
6038,
2278,
3853,
2279,
27774,
1006,
16906,
13874,
1010,
2544,
1007,
1063,
2065,
1006,
21183,
12146,
1012,
3475,
18743,
2135,
1006,
2544,
1007,
1064,
1064,
21183,
12146,
1012,
2003,
20915,
2050,
1006,
2544,
1007,
1007,
1063,
69... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/datepicker/js/calendarMonth.js | CalendarMonthCtrl | function CalendarMonthCtrl($element, $scope, $animate, $q,
$$mdDateUtil, $mdDateLocale) {
/** @final {!angular.JQLite} */
this.$element = $element;
/** @final {!angular.Scope} */
this.$scope = $scope;
/** @final {!angular.$animate} */
this.$animate = $animate;
/** @final {!angular.$q} */
this.$q = $q;
/** @final */
this.dateUtil = $$mdDateUtil;
/** @final */
this.dateLocale = $mdDateLocale;
/** @final {HTMLElement} */
this.calendarScroller = $element[0].querySelector('.md-virtual-repeat-scroller');
/** @type {boolean} */
this.isInitialized = false;
/** @type {boolean} */
this.isMonthTransitionInProgress = false;
var self = this;
/**
* Handles a click event on a date cell.
* Created here so that every cell can use the same function instance.
* @this {HTMLTableCellElement} The cell that was clicked.
*/
this.cellClickHandler = function() {
var timestamp = $$mdDateUtil.getTimestampFromNode(this);
self.$scope.$apply(function() {
self.calendarCtrl.setNgModelValue(timestamp);
});
};
/**
* Handles click events on the month headers. Switches
* the calendar to the year view.
* @this {HTMLTableCellElement} The cell that was clicked.
*/
this.headerClickHandler = function() {
self.calendarCtrl.setCurrentView('year', $$mdDateUtil.getTimestampFromNode(this));
};
} | javascript | function CalendarMonthCtrl($element, $scope, $animate, $q,
$$mdDateUtil, $mdDateLocale) {
/** @final {!angular.JQLite} */
this.$element = $element;
/** @final {!angular.Scope} */
this.$scope = $scope;
/** @final {!angular.$animate} */
this.$animate = $animate;
/** @final {!angular.$q} */
this.$q = $q;
/** @final */
this.dateUtil = $$mdDateUtil;
/** @final */
this.dateLocale = $mdDateLocale;
/** @final {HTMLElement} */
this.calendarScroller = $element[0].querySelector('.md-virtual-repeat-scroller');
/** @type {boolean} */
this.isInitialized = false;
/** @type {boolean} */
this.isMonthTransitionInProgress = false;
var self = this;
/**
* Handles a click event on a date cell.
* Created here so that every cell can use the same function instance.
* @this {HTMLTableCellElement} The cell that was clicked.
*/
this.cellClickHandler = function() {
var timestamp = $$mdDateUtil.getTimestampFromNode(this);
self.$scope.$apply(function() {
self.calendarCtrl.setNgModelValue(timestamp);
});
};
/**
* Handles click events on the month headers. Switches
* the calendar to the year view.
* @this {HTMLTableCellElement} The cell that was clicked.
*/
this.headerClickHandler = function() {
self.calendarCtrl.setCurrentView('year', $$mdDateUtil.getTimestampFromNode(this));
};
} | [
"function",
"CalendarMonthCtrl",
"(",
"$element",
",",
"$scope",
",",
"$animate",
",",
"$q",
",",
"$$mdDateUtil",
",",
"$mdDateLocale",
")",
"{",
"/** @final {!angular.JQLite} */",
"this",
".",
"$element",
"=",
"$element",
";",
"/** @final {!angular.Scope} */",
"this"... | Controller for the calendar month component.
@ngInject @constructor | [
"Controller",
"for",
"the",
"calendar",
"month",
"component",
"."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/datepicker/js/calendarMonth.js#L61-L113 | train | The calendar controller for a month. | [
30522,
3853,
8094,
9629,
16257,
16344,
2140,
1006,
1002,
5783,
1010,
1002,
9531,
1010,
1002,
2019,
21499,
1010,
1002,
1053,
1010,
1002,
1002,
9108,
13701,
21823,
2140,
1010,
1002,
9108,
13701,
4135,
9289,
2063,
1007,
1063,
1013,
1008,
1008,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
mochajs/mocha | lib/runnable.js | Runnable | function Runnable(title, fn) {
this.title = title;
this.fn = fn;
this.body = (fn || '').toString();
this.async = fn && fn.length;
this.sync = !this.async;
this._timeout = 2000;
this._slow = 75;
this._enableTimeouts = true;
this.timedOut = false;
this._retries = -1;
this._currentRetry = 0;
this.pending = false;
} | javascript | function Runnable(title, fn) {
this.title = title;
this.fn = fn;
this.body = (fn || '').toString();
this.async = fn && fn.length;
this.sync = !this.async;
this._timeout = 2000;
this._slow = 75;
this._enableTimeouts = true;
this.timedOut = false;
this._retries = -1;
this._currentRetry = 0;
this.pending = false;
} | [
"function",
"Runnable",
"(",
"title",
",",
"fn",
")",
"{",
"this",
".",
"title",
"=",
"title",
";",
"this",
".",
"fn",
"=",
"fn",
";",
"this",
".",
"body",
"=",
"(",
"fn",
"||",
"''",
")",
".",
"toString",
"(",
")",
";",
"this",
".",
"async",
... | Initialize a new `Runnable` with the given `title` and callback `fn`.
@class
@extends external:EventEmitter
@public
@param {String} title
@param {Function} fn | [
"Initialize",
"a",
"new",
"Runnable",
"with",
"the",
"given",
"title",
"and",
"callback",
"fn",
"."
] | 9b00fedb610241e33f7592c40164e42a38a793cf | https://github.com/mochajs/mocha/blob/9b00fedb610241e33f7592c40164e42a38a793cf/lib/runnable.js#L30-L43 | train | A Runnable is a class that can be used to run a single function. | [
30522,
3853,
2448,
22966,
1006,
2516,
30524,
1006,
1007,
1025,
2023,
1012,
2004,
6038,
2278,
1027,
1042,
2078,
1004,
1004,
1042,
2078,
1012,
3091,
1025,
2023,
1012,
26351,
1027,
999,
2023,
1012,
2004,
6038,
2278,
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... |
SAP/openui5 | src/sap.ui.fl/src/sap/ui/fl/support/apps/contentbrowser/controller/ContentDetails.controller.js | function (sLayer, sNamespace, sFileName, sFileType, sTransportId, sSelectedLayer) {
return LRepConnector.deleteFile(sLayer, sNamespace, sFileName, sFileType, sTransportId, sSelectedLayer).then(function () {
var oRouter = sap.ui.core.UIComponent.getRouterFor(this);
oRouter.navTo("LayerContentMaster", {
"layer": sSelectedLayer,
"namespace": encodeURIComponent(sNamespace)
});
}.bind(this));
} | javascript | function (sLayer, sNamespace, sFileName, sFileType, sTransportId, sSelectedLayer) {
return LRepConnector.deleteFile(sLayer, sNamespace, sFileName, sFileType, sTransportId, sSelectedLayer).then(function () {
var oRouter = sap.ui.core.UIComponent.getRouterFor(this);
oRouter.navTo("LayerContentMaster", {
"layer": sSelectedLayer,
"namespace": encodeURIComponent(sNamespace)
});
}.bind(this));
} | [
"function",
"(",
"sLayer",
",",
"sNamespace",
",",
"sFileName",
",",
"sFileType",
",",
"sTransportId",
",",
"sSelectedLayer",
")",
"{",
"return",
"LRepConnector",
".",
"deleteFile",
"(",
"sLayer",
",",
"sNamespace",
",",
"sFileName",
",",
"sFileType",
",",
"sT... | Handler if a deletion was confirmed.
@returns {Promise} - <code>LRepConnector</code> "deleteFile" promise
@private | [
"Handler",
"if",
"a",
"deletion",
"was",
"confirmed",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/support/apps/contentbrowser/controller/ContentDetails.controller.js#L275-L283 | train | Delete a file from the specified layer | [
30522,
3853,
1006,
20005,
1010,
1055,
18442,
23058,
1010,
16420,
9463,
18442,
1010,
16420,
9463,
13874,
1010,
2358,
5521,
20205,
3593,
1010,
7020,
12260,
10985,
24314,
1007,
1063,
2709,
1048,
2890,
15042,
18256,
16761,
1012,
3972,
12870,
8873... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
angular/material | src/components/autocomplete/js/autocompleteController.js | handleResults | function handleResults(results) {
ctrl.matches = results;
ctrl.hidden = shouldHide();
// If loading is in progress, then we'll end the progress. This is needed for example,
// when the `clear` button was clicked, because there we always show the loading process, to prevent flashing.
if (ctrl.loading) setLoading(false);
if ($scope.selectOnMatch) selectItemOnMatch();
positionDropdown();
reportMessages(true, ReportType.Count);
} | javascript | function handleResults(results) {
ctrl.matches = results;
ctrl.hidden = shouldHide();
// If loading is in progress, then we'll end the progress. This is needed for example,
// when the `clear` button was clicked, because there we always show the loading process, to prevent flashing.
if (ctrl.loading) setLoading(false);
if ($scope.selectOnMatch) selectItemOnMatch();
positionDropdown();
reportMessages(true, ReportType.Count);
} | [
"function",
"handleResults",
"(",
"results",
")",
"{",
"ctrl",
".",
"matches",
"=",
"results",
";",
"ctrl",
".",
"hidden",
"=",
"shouldHide",
"(",
")",
";",
"// If loading is in progress, then we'll end the progress. This is needed for example,",
"// when the `clear` button... | Handles the retrieved results by showing them in the autocompletes dropdown.
@param results Retrieved results | [
"Handles",
"the",
"retrieved",
"results",
"by",
"showing",
"them",
"in",
"the",
"autocompletes",
"dropdown",
"."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/autocomplete/js/autocompleteController.js#L1042-L1054 | train | Handles the results of the search | [
30522,
3853,
28213,
2229,
11314,
2015,
1006,
3463,
1007,
1063,
14931,
12190,
1012,
3503,
1027,
3463,
1025,
14931,
12190,
1012,
5023,
1027,
2323,
26100,
1006,
1007,
1025,
1013,
1013,
2065,
10578,
2003,
1999,
5082,
1010,
2059,
2057,
1005,
222... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
uber/deck.gl | modules/aggregation-layers/src/utils/gpu-grid-aggregation/grid-aggregation-utils.js | calculateLonOffset | function calculateLonOffset(lat, dx) {
return ((dx / R_EARTH) * (180 / Math.PI)) / Math.cos((lat * Math.PI) / 180);
} | javascript | function calculateLonOffset(lat, dx) {
return ((dx / R_EARTH) * (180 / Math.PI)) / Math.cos((lat * Math.PI) / 180);
} | [
"function",
"calculateLonOffset",
"(",
"lat",
",",
"dx",
")",
"{",
"return",
"(",
"(",
"dx",
"/",
"R_EARTH",
")",
"*",
"(",
"180",
"/",
"Math",
".",
"PI",
")",
")",
"/",
"Math",
".",
"cos",
"(",
"(",
"lat",
"*",
"Math",
".",
"PI",
")",
"/",
"... | with a given x-km change, and current latitude
calculate the increment of longitude
based on stackoverflow http://stackoverflow.com/questions/7477003
@param {number} lat - latitude of current location (based on city)
@param {number} dx - change in km
@return {number} - increment in longitude | [
"with",
"a",
"given",
"x",
"-",
"km",
"change",
"and",
"current",
"latitude",
"calculate",
"the",
"increment",
"of",
"longitude",
"based",
"on",
"stackoverflow",
"http",
":",
"//",
"stackoverflow",
".",
"com",
"/",
"questions",
"/",
"7477003"
] | a2010448b7f268bbd03617b812334c68a6b9e5b2 | https://github.com/uber/deck.gl/blob/a2010448b7f268bbd03617b812334c68a6b9e5b2/modules/aggregation-layers/src/utils/gpu-grid-aggregation/grid-aggregation-utils.js#L195-L197 | train | Calculate the offset of the lon - lat - dx degrees | [
30522,
3853,
18422,
7811,
27475,
3388,
1006,
2474,
2102,
1010,
1040,
2595,
1007,
1063,
2709,
1006,
1006,
1040,
2595,
1013,
1054,
1035,
3011,
1007,
1008,
1006,
8380,
1013,
8785,
1012,
14255,
1007,
1007,
1013,
8785,
1012,
2522,
2015,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
angular/material | src/core/services/theming/theming.js | sanitizePalette | function sanitizePalette(palette, name) {
var defaultContrast = palette.contrastDefaultColor;
var lightColors = palette.contrastLightColors || [];
var strongLightColors = palette.contrastStrongLightColors || [];
var darkColors = palette.contrastDarkColors || [];
// These colors are provided as space-separated lists
if (typeof lightColors === 'string') lightColors = lightColors.split(' ');
if (typeof strongLightColors === 'string') strongLightColors = strongLightColors.split(' ');
if (typeof darkColors === 'string') darkColors = darkColors.split(' ');
// Cleanup after ourselves
delete palette.contrastDefaultColor;
delete palette.contrastLightColors;
delete palette.contrastStrongLightColors;
delete palette.contrastDarkColors;
// Change { 'A100': '#fffeee' } to { 'A100': { value: '#fffeee', contrast:DARK_CONTRAST_COLOR }
angular.forEach(palette, function(hueValue, hueName) {
if (angular.isObject(hueValue)) return; // Already converted
// Map everything to rgb colors
var rgbValue = colorToRgbaArray(hueValue);
if (!rgbValue) {
throw new Error("Color %1, in palette %2's hue %3, is invalid. Hex or rgb(a) color expected."
.replace('%1', hueValue)
.replace('%2', palette.name)
.replace('%3', hueName));
}
palette[hueName] = {
hex: palette[hueName],
value: rgbValue,
contrast: getContrastColor()
};
function getContrastColor() {
if (defaultContrast === 'light') {
if (darkColors.indexOf(hueName) > -1) {
return DARK_CONTRAST_COLOR;
} else {
return strongLightColors.indexOf(hueName) > -1 ? STRONG_LIGHT_CONTRAST_COLOR
: LIGHT_CONTRAST_COLOR;
}
} else {
if (lightColors.indexOf(hueName) > -1) {
return strongLightColors.indexOf(hueName) > -1 ? STRONG_LIGHT_CONTRAST_COLOR
: LIGHT_CONTRAST_COLOR;
} else {
return DARK_CONTRAST_COLOR;
}
}
}
});
} | javascript | function sanitizePalette(palette, name) {
var defaultContrast = palette.contrastDefaultColor;
var lightColors = palette.contrastLightColors || [];
var strongLightColors = palette.contrastStrongLightColors || [];
var darkColors = palette.contrastDarkColors || [];
// These colors are provided as space-separated lists
if (typeof lightColors === 'string') lightColors = lightColors.split(' ');
if (typeof strongLightColors === 'string') strongLightColors = strongLightColors.split(' ');
if (typeof darkColors === 'string') darkColors = darkColors.split(' ');
// Cleanup after ourselves
delete palette.contrastDefaultColor;
delete palette.contrastLightColors;
delete palette.contrastStrongLightColors;
delete palette.contrastDarkColors;
// Change { 'A100': '#fffeee' } to { 'A100': { value: '#fffeee', contrast:DARK_CONTRAST_COLOR }
angular.forEach(palette, function(hueValue, hueName) {
if (angular.isObject(hueValue)) return; // Already converted
// Map everything to rgb colors
var rgbValue = colorToRgbaArray(hueValue);
if (!rgbValue) {
throw new Error("Color %1, in palette %2's hue %3, is invalid. Hex or rgb(a) color expected."
.replace('%1', hueValue)
.replace('%2', palette.name)
.replace('%3', hueName));
}
palette[hueName] = {
hex: palette[hueName],
value: rgbValue,
contrast: getContrastColor()
};
function getContrastColor() {
if (defaultContrast === 'light') {
if (darkColors.indexOf(hueName) > -1) {
return DARK_CONTRAST_COLOR;
} else {
return strongLightColors.indexOf(hueName) > -1 ? STRONG_LIGHT_CONTRAST_COLOR
: LIGHT_CONTRAST_COLOR;
}
} else {
if (lightColors.indexOf(hueName) > -1) {
return strongLightColors.indexOf(hueName) > -1 ? STRONG_LIGHT_CONTRAST_COLOR
: LIGHT_CONTRAST_COLOR;
} else {
return DARK_CONTRAST_COLOR;
}
}
}
});
} | [
"function",
"sanitizePalette",
"(",
"palette",
",",
"name",
")",
"{",
"var",
"defaultContrast",
"=",
"palette",
".",
"contrastDefaultColor",
";",
"var",
"lightColors",
"=",
"palette",
".",
"contrastLightColors",
"||",
"[",
"]",
";",
"var",
"strongLightColors",
"... | The user specifies a 'default' contrast color as either light or dark, then explicitly lists which hues are the opposite contrast (eg. A100 has dark, A200 has light) | [
"The",
"user",
"specifies",
"a",
"default",
"contrast",
"color",
"as",
"either",
"light",
"or",
"dark",
"then",
"explicitly",
"lists",
"which",
"hues",
"are",
"the",
"opposite",
"contrast",
"(",
"eg",
".",
"A100",
"has",
"dark",
"A200",
"has",
"light",
")"... | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/services/theming/theming.js#L1098-L1150 | train | Sanitize palette | [
30522,
3853,
2624,
25090,
4371,
12952,
7585,
1006,
27396,
1010,
2171,
1007,
1063,
13075,
12398,
8663,
6494,
3367,
1027,
27396,
1012,
5688,
3207,
7011,
11314,
18717,
1025,
13075,
2422,
18717,
2015,
1027,
27396,
1012,
5688,
7138,
18717,
2015,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
moleculerjs/moleculer | src/serializers/index.js | resolve | function resolve(opt) {
if (opt instanceof Serializers.Base) {
return opt;
} else if (_.isString(opt)) {
let SerializerClass = getByName(opt);
if (SerializerClass)
return new SerializerClass();
else
throw new BrokerOptionsError(`Invalid serializer type '${opt}'.`, { type: opt });
} else if (_.isObject(opt)) {
let SerializerClass = getByName(opt.type || "JSON");
if (SerializerClass)
return new SerializerClass(opt.options);
else
throw new BrokerOptionsError(`Invalid serializer type '${opt.type}'.`, { type: opt.type });
}
return new Serializers.JSON();
} | javascript | function resolve(opt) {
if (opt instanceof Serializers.Base) {
return opt;
} else if (_.isString(opt)) {
let SerializerClass = getByName(opt);
if (SerializerClass)
return new SerializerClass();
else
throw new BrokerOptionsError(`Invalid serializer type '${opt}'.`, { type: opt });
} else if (_.isObject(opt)) {
let SerializerClass = getByName(opt.type || "JSON");
if (SerializerClass)
return new SerializerClass(opt.options);
else
throw new BrokerOptionsError(`Invalid serializer type '${opt.type}'.`, { type: opt.type });
}
return new Serializers.JSON();
} | [
"function",
"resolve",
"(",
"opt",
")",
"{",
"if",
"(",
"opt",
"instanceof",
"Serializers",
".",
"Base",
")",
"{",
"return",
"opt",
";",
"}",
"else",
"if",
"(",
"_",
".",
"isString",
"(",
"opt",
")",
")",
"{",
"let",
"SerializerClass",
"=",
"getByNam... | Resolve serializer by name
@param {object|string} opt
@returns {Serializer}
@memberof ServiceBroker | [
"Resolve",
"serializer",
"by",
"name"
] | f95aadc2d61b0d0e3c643a43c3ed28bca6425cde | https://github.com/moleculerjs/moleculer/blob/f95aadc2d61b0d0e3c643a43c3ed28bca6425cde/src/serializers/index.js#L39-L58 | train | Resolve serializer object | [
30522,
3853,
10663,
1006,
23569,
1007,
1063,
2065,
1006,
23569,
6013,
11253,
7642,
17629,
2015,
1012,
2918,
1007,
1063,
2709,
23569,
1025,
1065,
2842,
2065,
1006,
1035,
1012,
26354,
18886,
3070,
1006,
23569,
1007,
1007,
1063,
2292,
7642,
17... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/language/LanguageManager.js | getLanguageForPath | function getLanguageForPath(path, ignoreOverride) {
var fileName,
language = _filePathToLanguageMap[path],
extension,
parts;
// if there's an override, return it
if (!ignoreOverride && language) {
return language;
}
fileName = FileUtils.getBaseName(path).toLowerCase();
language = _fileNameToLanguageMap[fileName];
// If no language was found for the file name, use the file extension instead
if (!language) {
// Split the file name into parts:
// "foo.coffee.md" => ["foo", "coffee", "md"]
// ".profile.bak" => ["", "profile", "bak"]
// "1. Vacation.txt" => ["1", " Vacation", "txt"]
parts = fileName.split(".");
// A leading dot does not indicate a file extension, but marks the file as hidden => remove it
if (parts[0] === "") {
// ["", "profile", "bak"] => ["profile", "bak"]
parts.shift();
}
// The first part is assumed to be the title, not the extension => remove it
// ["foo", "coffee", "md"] => ["coffee", "md"]
// ["profile", "bak"] => ["bak"]
// ["1", " Vacation", "txt"] => [" Vacation", "txt"]
parts.shift();
// Join the remaining parts into a file extension until none are left or a language was found
while (!language && parts.length) {
// First iteration:
// ["coffee", "md"] => "coffee.md"
// ["bak"] => "bak"
// [" Vacation", "txt"] => " Vacation.txt"
// Second iteration (assuming no language was found for "coffee.md"):
// ["md"] => "md"
// ["txt"] => "txt"
extension = parts.join(".");
language = _fileExtensionToLanguageMap[extension];
// Remove the first part
// First iteration:
// ["coffee", "md"] => ["md"]
// ["bak"] => []
// [" Vacation", "txt"] => ["txt"]
// Second iteration:
// ["md"] => []
// ["txt"] => []
parts.shift();
}
}
return language || _fallbackLanguage;
} | javascript | function getLanguageForPath(path, ignoreOverride) {
var fileName,
language = _filePathToLanguageMap[path],
extension,
parts;
// if there's an override, return it
if (!ignoreOverride && language) {
return language;
}
fileName = FileUtils.getBaseName(path).toLowerCase();
language = _fileNameToLanguageMap[fileName];
// If no language was found for the file name, use the file extension instead
if (!language) {
// Split the file name into parts:
// "foo.coffee.md" => ["foo", "coffee", "md"]
// ".profile.bak" => ["", "profile", "bak"]
// "1. Vacation.txt" => ["1", " Vacation", "txt"]
parts = fileName.split(".");
// A leading dot does not indicate a file extension, but marks the file as hidden => remove it
if (parts[0] === "") {
// ["", "profile", "bak"] => ["profile", "bak"]
parts.shift();
}
// The first part is assumed to be the title, not the extension => remove it
// ["foo", "coffee", "md"] => ["coffee", "md"]
// ["profile", "bak"] => ["bak"]
// ["1", " Vacation", "txt"] => [" Vacation", "txt"]
parts.shift();
// Join the remaining parts into a file extension until none are left or a language was found
while (!language && parts.length) {
// First iteration:
// ["coffee", "md"] => "coffee.md"
// ["bak"] => "bak"
// [" Vacation", "txt"] => " Vacation.txt"
// Second iteration (assuming no language was found for "coffee.md"):
// ["md"] => "md"
// ["txt"] => "txt"
extension = parts.join(".");
language = _fileExtensionToLanguageMap[extension];
// Remove the first part
// First iteration:
// ["coffee", "md"] => ["md"]
// ["bak"] => []
// [" Vacation", "txt"] => ["txt"]
// Second iteration:
// ["md"] => []
// ["txt"] => []
parts.shift();
}
}
return language || _fallbackLanguage;
} | [
"function",
"getLanguageForPath",
"(",
"path",
",",
"ignoreOverride",
")",
"{",
"var",
"fileName",
",",
"language",
"=",
"_filePathToLanguageMap",
"[",
"path",
"]",
",",
"extension",
",",
"parts",
";",
"// if there's an override, return it",
"if",
"(",
"!",
"ignor... | Resolves a file path to a Language object.
@param {!string} path Path to the file to find a language for
@param {?boolean} ignoreOverride If set to true will cause the lookup to ignore any
overrides and return default binding. By default override is not ignored.
@return {Language} The language for the provided file type or the fallback language | [
"Resolves",
"a",
"file",
"path",
"to",
"a",
"Language",
"object",
".",
"@param",
"{",
"!string",
"}",
"path",
"Path",
"to",
"the",
"file",
"to",
"find",
"a",
"language",
"for",
"@param",
"{",
"?boolean",
"}",
"ignoreOverride",
"If",
"set",
"to",
"true",
... | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/language/LanguageManager.js#L264-L322 | train | Get language for a file path | [
30522,
3853,
2131,
25023,
6692,
3351,
29278,
15069,
1006,
4130,
1010,
8568,
7840,
15637,
1007,
1063,
13075,
5371,
18442,
1010,
2653,
1027,
1035,
5371,
15069,
3406,
25023,
6692,
3351,
2863,
2361,
1031,
4130,
1033,
1010,
5331,
1010,
3033,
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/model/odata/v4/ODataListBinding.js | shrinkContexts | function shrinkContexts() {
var i,
iNewLength = that.iMaxLength + that.iCreatedContexts;
if (iNewLength >= that.aContexts.length) {
return;
}
for (i = iNewLength; i < that.aContexts.length; i += 1) {
if (that.aContexts[i]) {
that.aContexts[i].destroy();
}
}
while (iNewLength > 0 && !that.aContexts[iNewLength - 1]) {
iNewLength -= 1;
}
that.aContexts.length = iNewLength;
bChanged = true;
} | javascript | function shrinkContexts() {
var i,
iNewLength = that.iMaxLength + that.iCreatedContexts;
if (iNewLength >= that.aContexts.length) {
return;
}
for (i = iNewLength; i < that.aContexts.length; i += 1) {
if (that.aContexts[i]) {
that.aContexts[i].destroy();
}
}
while (iNewLength > 0 && !that.aContexts[iNewLength - 1]) {
iNewLength -= 1;
}
that.aContexts.length = iNewLength;
bChanged = true;
} | [
"function",
"shrinkContexts",
"(",
")",
"{",
"var",
"i",
",",
"iNewLength",
"=",
"that",
".",
"iMaxLength",
"+",
"that",
".",
"iCreatedContexts",
";",
"if",
"(",
"iNewLength",
">=",
"that",
".",
"aContexts",
".",
"length",
")",
"{",
"return",
";",
"}",
... | /*
Shrinks contexts to the new length, destroys unneeded contexts | [
"/",
"*",
"Shrinks",
"contexts",
"to",
"the",
"new",
"length",
"destroys",
"unneeded",
"contexts"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/ODataListBinding.js#L654-L672 | train | Shrinks the contexts array | [
30522,
3853,
22802,
8663,
18209,
2015,
1006,
1007,
1063,
13075,
1045,
1010,
1999,
7974,
7770,
13512,
2232,
1027,
2008,
1012,
10047,
8528,
7770,
13512,
2232,
1009,
2008,
1012,
24582,
29313,
16409,
28040,
18413,
2015,
1025,
2065,
1006,
1999,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/require-atomic-updates.js | findOutdatedReads | function findOutdatedReads(
codePathSegment,
surroundingFunction,
{
stateBySegmentStart = new WeakMap(),
stateBySegmentEnd = new WeakMap()
} = {}
) {
if (!stateBySegmentStart.has(codePathSegment)) {
stateBySegmentStart.set(codePathSegment, new AssignmentTrackerState());
}
const currentState = stateBySegmentStart.get(codePathSegment).copy();
expressionsByCodePathSegment.get(codePathSegment).forEach(({ entering, node }) => {
if (node.type === "AssignmentExpression") {
if (entering) {
currentState.enterAssignment(node);
} else {
currentState.exitAssignment(node);
}
} else if (!entering && (node.type === "AwaitExpression" || node.type === "YieldExpression")) {
currentState.exitAwaitOrYield(node, surroundingFunction);
} else if (!entering && (node.type === "Identifier" || node.type === "MemberExpression")) {
currentState.exitIdentifierOrMemberExpression(node);
}
});
stateBySegmentEnd.set(codePathSegment, currentState);
codePathSegment.nextSegments.forEach(nextSegment => {
if (stateBySegmentStart.has(nextSegment)) {
if (!stateBySegmentStart.get(nextSegment).merge(currentState)) {
/*
* This segment has already been processed with the given set of inputs;
* no need to do it again. After no new state is available to process
* for any control flow segment in the graph, the analysis reaches a fixpoint and
* traversal stops.
*/
return;
}
} else {
stateBySegmentStart.set(nextSegment, currentState.copy());
}
findOutdatedReads(
nextSegment,
surroundingFunction,
{ stateBySegmentStart, stateBySegmentEnd }
);
});
} | javascript | function findOutdatedReads(
codePathSegment,
surroundingFunction,
{
stateBySegmentStart = new WeakMap(),
stateBySegmentEnd = new WeakMap()
} = {}
) {
if (!stateBySegmentStart.has(codePathSegment)) {
stateBySegmentStart.set(codePathSegment, new AssignmentTrackerState());
}
const currentState = stateBySegmentStart.get(codePathSegment).copy();
expressionsByCodePathSegment.get(codePathSegment).forEach(({ entering, node }) => {
if (node.type === "AssignmentExpression") {
if (entering) {
currentState.enterAssignment(node);
} else {
currentState.exitAssignment(node);
}
} else if (!entering && (node.type === "AwaitExpression" || node.type === "YieldExpression")) {
currentState.exitAwaitOrYield(node, surroundingFunction);
} else if (!entering && (node.type === "Identifier" || node.type === "MemberExpression")) {
currentState.exitIdentifierOrMemberExpression(node);
}
});
stateBySegmentEnd.set(codePathSegment, currentState);
codePathSegment.nextSegments.forEach(nextSegment => {
if (stateBySegmentStart.has(nextSegment)) {
if (!stateBySegmentStart.get(nextSegment).merge(currentState)) {
/*
* This segment has already been processed with the given set of inputs;
* no need to do it again. After no new state is available to process
* for any control flow segment in the graph, the analysis reaches a fixpoint and
* traversal stops.
*/
return;
}
} else {
stateBySegmentStart.set(nextSegment, currentState.copy());
}
findOutdatedReads(
nextSegment,
surroundingFunction,
{ stateBySegmentStart, stateBySegmentEnd }
);
});
} | [
"function",
"findOutdatedReads",
"(",
"codePathSegment",
",",
"surroundingFunction",
",",
"{",
"stateBySegmentStart",
"=",
"new",
"WeakMap",
"(",
")",
",",
"stateBySegmentEnd",
"=",
"new",
"WeakMap",
"(",
")",
"}",
"=",
"{",
"}",
")",
"{",
"if",
"(",
"!",
... | If the control flow graph of a function enters an assignment expression, then does the
both of the following steps in order (possibly with other steps in between) before exiting the
assignment expression, then the assignment might be using an outdated value.
1. Enters a read of the variable or property assigned in the expression (not necessary if operator assignment is used)
2. Exits an `await` or `yield` expression
This function checks for the outdated values and reports them.
@param {CodePathSegment} codePathSegment The current code path segment to traverse
@param {ASTNode} surroundingFunction The function node containing the code path segment
@returns {void} | [
"If",
"the",
"control",
"flow",
"graph",
"of",
"a",
"function",
"enters",
"an",
"assignment",
"expression",
"then",
"does",
"the",
"both",
"of",
"the",
"following",
"steps",
"in",
"order",
"(",
"possibly",
"with",
"other",
"steps",
"in",
"between",
")",
"b... | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/require-atomic-updates.js#L198-L249 | train | Find outdated reads for a given code path. | [
30522,
3853,
2424,
5833,
13701,
16200,
19303,
1006,
3642,
15069,
3366,
21693,
4765,
1010,
4193,
11263,
27989,
1010,
1063,
2110,
3762,
3366,
21693,
11187,
7559,
2102,
1027,
2047,
5410,
2863,
2361,
1006,
1007,
1010,
2110,
3762,
3366,
21693,
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... |
Tonejs/Tone.js | Tone/core/IntervalTimeline.js | function(low, high, event){
//the event container
this.event = event;
//the low value
this.low = low;
//the high value
this.high = high;
//the high value for this and all child nodes
this.max = this.high;
//the nodes to the left
this._left = null;
//the nodes to the right
this._right = null;
//the parent node
this.parent = null;
//the number of child nodes
this.height = 0;
} | javascript | function(low, high, event){
//the event container
this.event = event;
//the low value
this.low = low;
//the high value
this.high = high;
//the high value for this and all child nodes
this.max = this.high;
//the nodes to the left
this._left = null;
//the nodes to the right
this._right = null;
//the parent node
this.parent = null;
//the number of child nodes
this.height = 0;
} | [
"function",
"(",
"low",
",",
"high",
",",
"event",
")",
"{",
"//the event container",
"this",
".",
"event",
"=",
"event",
";",
"//the low value",
"this",
".",
"low",
"=",
"low",
";",
"//the high value",
"this",
".",
"high",
"=",
"high",
";",
"//the high va... | ///////////////////////////////////////////////////////////////////////// INTERVAL NODE HELPER /////////////////////////////////////////////////////////////////////////
Represents a node in the binary search tree, with the addition
of a "high" value which keeps track of the highest value of
its children.
References:
https://brooknovak.wordpress.com/2013/12/07/augmented-interval-tree-in-c/
http://www.mif.vu.lt/~valdas/ALGORITMAI/LITERATURA/Cormen/Cormen.pdf
@param {Number} low
@param {Number} high
@private | [
"/////////////////////////////////////////////////////////////////////////",
"INTERVAL",
"NODE",
"HELPER",
"/////////////////////////////////////////////////////////////////////////",
"Represents",
"a",
"node",
"in",
"the",
"binary",
"search",
"tree",
"with",
"the",
"addition",
"of",... | bb67e9c83d5553dfaa3c10babc147600aa14c147 | https://github.com/Tonejs/Tone.js/blob/bb67e9c83d5553dfaa3c10babc147600aa14c147/Tone/core/IntervalTimeline.js#L390-L407 | train | set the low and high values | [
30522,
3853,
1006,
2659,
1010,
2152,
1010,
2724,
1007,
1063,
1013,
1013,
1996,
2724,
11661,
2023,
1012,
2724,
1027,
2724,
1025,
1013,
1013,
1996,
2659,
3643,
2023,
1012,
30524,
2023,
1012,
2152,
1025,
1013,
1013,
1996,
14164,
2000,
1996,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
adobe/brackets | src/filesystem/impls/appshell/AppshellFileSystem.js | moveToTrash | function moveToTrash(path, callback) {
appshell.fs.moveToTrash(path, function (err) {
callback(_mapError(err));
});
} | javascript | function moveToTrash(path, callback) {
appshell.fs.moveToTrash(path, function (err) {
callback(_mapError(err));
});
} | [
"function",
"moveToTrash",
"(",
"path",
",",
"callback",
")",
"{",
"appshell",
".",
"fs",
".",
"moveToTrash",
"(",
"path",
",",
"function",
"(",
"err",
")",
"{",
"callback",
"(",
"_mapError",
"(",
"err",
")",
")",
";",
"}",
")",
";",
"}"
] | Move the file or directory at the given path to a system dependent trash
location, calling back asynchronously with a possibly null FileSystemError
string. Directories will be moved even when non-empty.
@param {string} path
@param {function(string)=} callback | [
"Move",
"the",
"file",
"or",
"directory",
"at",
"the",
"given",
"path",
"to",
"a",
"system",
"dependent",
"trash",
"location",
"calling",
"back",
"asynchronously",
"with",
"a",
"possibly",
"null",
"FileSystemError",
"string",
".",
"Directories",
"will",
"be",
... | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/filesystem/impls/appshell/AppshellFileSystem.js#L484-L488 | train | Move the file system to the trash | [
30522,
3853,
2693,
3406,
6494,
4095,
1006,
4130,
1010,
2655,
5963,
1007,
1063,
18726,
18223,
1012,
1042,
2015,
1012,
2693,
3406,
6494,
4095,
1006,
4130,
1010,
3853,
1006,
9413,
2099,
1007,
1063,
2655,
5963,
1006,
1035,
4949,
2121,
29165,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.demokit/src/sap/ui/demokit/explored/view/entity.controller.js | function (sText) {
return '<span class="fs0875">' + JSDocUtil.formatTextBlock(sText, {
linkFormatter: function (target, text) {
var p;
target = target.trim().replace(/\.prototype\./g, "#");
p = target.indexOf("#");
if ( p === 0 ) {
// a relative reference - we can't support that
return "<code>" + target.slice(1) + "</code>";
}
if ( p > 0 ) {
text = text || target; // keep the full target in the fallback text
target = target.slice(0, p);
}
return "<a class=\"jsdoclink\" href=\"#\" data-sap-ui-target=\"" + target + "\">" + (text || target) + "</a>";
}
}) + '</span>';
} | javascript | function (sText) {
return '<span class="fs0875">' + JSDocUtil.formatTextBlock(sText, {
linkFormatter: function (target, text) {
var p;
target = target.trim().replace(/\.prototype\./g, "#");
p = target.indexOf("#");
if ( p === 0 ) {
// a relative reference - we can't support that
return "<code>" + target.slice(1) + "</code>";
}
if ( p > 0 ) {
text = text || target; // keep the full target in the fallback text
target = target.slice(0, p);
}
return "<a class=\"jsdoclink\" href=\"#\" data-sap-ui-target=\"" + target + "\">" + (text || target) + "</a>";
}
}) + '</span>';
} | [
"function",
"(",
"sText",
")",
"{",
"return",
"'<span class=\"fs0875\">'",
"+",
"JSDocUtil",
".",
"formatTextBlock",
"(",
"sText",
",",
"{",
"linkFormatter",
":",
"function",
"(",
"target",
",",
"text",
")",
"{",
"var",
"p",
";",
"target",
"=",
"target",
"... | This function wraps a text in a span tag so that it can be represented in an HTML control.
@param {string} sText
@returns {string}
@private | [
"This",
"function",
"wraps",
"a",
"text",
"in",
"a",
"span",
"tag",
"so",
"that",
"it",
"can",
"be",
"represented",
"in",
"an",
"HTML",
"control",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.demokit/src/sap/ui/demokit/explored/view/entity.controller.js#L409-L431 | train | Returns a link to the target | [
30522,
3853,
1006,
26261,
18413,
1007,
1063,
2709,
1005,
1026,
8487,
2465,
1027,
1000,
1042,
2015,
2692,
2620,
23352,
1000,
1028,
1005,
1009,
1046,
16150,
10085,
21823,
2140,
1012,
4289,
18209,
23467,
1006,
26261,
18413,
1010,
1063,
4957,
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... | |
vuejs/vue-cli | packages/@vue/babel-preset-app/polyfillsPlugin.js | getModulePath | function getModulePath (mod, useAbsolutePath) {
const modPath =
mod === 'regenerator-runtime'
? 'regenerator-runtime/runtime'
: `core-js/modules/${mod}`
return useAbsolutePath ? require.resolve(modPath) : modPath
} | javascript | function getModulePath (mod, useAbsolutePath) {
const modPath =
mod === 'regenerator-runtime'
? 'regenerator-runtime/runtime'
: `core-js/modules/${mod}`
return useAbsolutePath ? require.resolve(modPath) : modPath
} | [
"function",
"getModulePath",
"(",
"mod",
",",
"useAbsolutePath",
")",
"{",
"const",
"modPath",
"=",
"mod",
"===",
"'regenerator-runtime'",
"?",
"'regenerator-runtime/runtime'",
":",
"`",
"${",
"mod",
"}",
"`",
"return",
"useAbsolutePath",
"?",
"require",
".",
"r... | slightly modifiled from @babel/preset-env/src/utils use an absolute path for core-js modules, to fix conflicts of different core-js versions | [
"slightly",
"modifiled",
"from"
] | 206803cbefefdfbc7d8ed12440b0b751688b77b2 | https://github.com/vuejs/vue-cli/blob/206803cbefefdfbc7d8ed12440b0b751688b77b2/packages/@vue/babel-preset-app/polyfillsPlugin.js#L5-L11 | train | Get the absolute path of a module | [
30522,
3853,
2131,
5302,
8566,
2571,
15069,
1006,
16913,
1010,
2224,
7875,
19454,
10421,
15069,
1007,
1063,
9530,
3367,
16913,
15069,
1027,
16913,
1027,
1027,
1027,
1005,
19723,
24454,
8844,
1011,
2448,
7292,
1005,
1029,
1005,
19723,
24454,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
lovell/sharp | lib/output.js | _setBooleanOption | function _setBooleanOption (key, val) {
if (is.bool(val)) {
this.options[key] = val;
} else {
throw new Error('Invalid ' + key + ' (boolean) ' + val);
}
} | javascript | function _setBooleanOption (key, val) {
if (is.bool(val)) {
this.options[key] = val;
} else {
throw new Error('Invalid ' + key + ' (boolean) ' + val);
}
} | [
"function",
"_setBooleanOption",
"(",
"key",
",",
"val",
")",
"{",
"if",
"(",
"is",
".",
"bool",
"(",
"val",
")",
")",
"{",
"this",
".",
"options",
"[",
"key",
"]",
"=",
"val",
";",
"}",
"else",
"{",
"throw",
"new",
"Error",
"(",
"'Invalid '",
"+... | Update a Boolean attribute of the this.options Object.
@private
@param {String} key
@param {Boolean} val
@throws {Error} Invalid key | [
"Update",
"a",
"Boolean",
"attribute",
"of",
"the",
"this",
".",
"options",
"Object",
"."
] | 05d76eeadfe54713606a615185b2da047923406b | https://github.com/lovell/sharp/blob/05d76eeadfe54713606a615185b2da047923406b/lib/output.js#L589-L595 | train | Set boolean option | [
30522,
3853,
1035,
2275,
5092,
9890,
6761,
16790,
1006,
3145,
1010,
11748,
1007,
1063,
2065,
1006,
2003,
1012,
22017,
2140,
1006,
11748,
1007,
1007,
1063,
2023,
1012,
7047,
1031,
3145,
1033,
1027,
11748,
1025,
1065,
2842,
1063,
5466,
2047,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/XMLTemplateProcessor.js | getObjectFallback | function getObjectFallback(oClassObject) {
// some modules might not return a class definition, so we fallback to the global
// this is against the AMD definition, but is required for backward compatibility
if (!oClassObject) {
Log.error("Control '" + sClassName + "' did not return a class definition from sap.ui.define.", "", "XMLTemplateProcessor");
oClassObject = ObjectPath.get(sClassName);
}
if (!oClassObject) {
Log.error("Can't find object class '" + sClassName + "' for XML-view", "", "XMLTemplateProcessor");
}
return oClassObject;
} | javascript | function getObjectFallback(oClassObject) {
// some modules might not return a class definition, so we fallback to the global
// this is against the AMD definition, but is required for backward compatibility
if (!oClassObject) {
Log.error("Control '" + sClassName + "' did not return a class definition from sap.ui.define.", "", "XMLTemplateProcessor");
oClassObject = ObjectPath.get(sClassName);
}
if (!oClassObject) {
Log.error("Can't find object class '" + sClassName + "' for XML-view", "", "XMLTemplateProcessor");
}
return oClassObject;
} | [
"function",
"getObjectFallback",
"(",
"oClassObject",
")",
"{",
"// some modules might not return a class definition, so we fallback to the global",
"// this is against the AMD definition, but is required for backward compatibility",
"if",
"(",
"!",
"oClassObject",
")",
"{",
"Log",
"."... | ensure that control and library are loaded | [
"ensure",
"that",
"control",
"and",
"library",
"are",
"loaded"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/XMLTemplateProcessor.js#L481-L492 | train | This function is called by the control constructor to get the object class from the global object path | [
30522,
3853,
2131,
16429,
20614,
13976,
5963,
1006,
1051,
26266,
16429,
20614,
1007,
1063,
1013,
1013,
2070,
14184,
2453,
2025,
2709,
1037,
2465,
6210,
1010,
2061,
2057,
2991,
5963,
2000,
1996,
3795,
1013,
1013,
2023,
2003,
2114,
1996,
2572... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | mxCompactTreeLayout | function mxCompactTreeLayout(graph, horizontal, invert)
{
mxGraphLayout.call(this, graph);
this.horizontal = (horizontal != null) ? horizontal : true;
this.invert = (invert != null) ? invert : false;
} | javascript | function mxCompactTreeLayout(graph, horizontal, invert)
{
mxGraphLayout.call(this, graph);
this.horizontal = (horizontal != null) ? horizontal : true;
this.invert = (invert != null) ? invert : false;
} | [
"function",
"mxCompactTreeLayout",
"(",
"graph",
",",
"horizontal",
",",
"invert",
")",
"{",
"mxGraphLayout",
".",
"call",
"(",
"this",
",",
"graph",
")",
";",
"this",
".",
"horizontal",
"=",
"(",
"horizontal",
"!=",
"null",
")",
"?",
"horizontal",
":",
... | Copyright (c) 2006-2018, JGraph Ltd
Copyright (c) 2006-2018, Gaudenz Alder
Class: mxCompactTreeLayout
Extends <mxGraphLayout> to implement a compact tree (Moen) algorithm. This
layout is suitable for graphs that have no cycles (trees). Vertices that are
not connected to the tree will be ignored by this layout.
Example:
(code)
var layout = new mxCompactTreeLayout(graph);
layout.execute(graph.getDefaultParent());
(end)
Constructor: mxCompactTreeLayout
Constructs a new compact tree layout for the specified graph
and orientation. | [
"Copyright",
"(",
"c",
")",
"2006",
"-",
"2018",
"JGraph",
"Ltd",
"Copyright",
"(",
"c",
")",
"2006",
"-",
"2018",
"Gaudenz",
"Alder",
"Class",
":",
"mxCompactTreeLayout"
] | 33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44 | https://github.com/jgraph/mxgraph/blob/33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44/javascript/mxClient.js#L30040-L30045 | train | A compact tree layout | [
30522,
3853,
25630,
9006,
19498,
4779,
9910,
8485,
5833,
1006,
10629,
1010,
9876,
1010,
1999,
16874,
1007,
1063,
25630,
14413,
8485,
5833,
1012,
2655,
1006,
2023,
1010,
10629,
1007,
1025,
2023,
1012,
9876,
1027,
1006,
9876,
999,
1027,
19701... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
eslint/eslint | lib/rules/capitalized-comments.js | isInlineComment | function isInlineComment(comment) {
const previousToken = sourceCode.getTokenBefore(comment, { includeComments: true }),
nextToken = sourceCode.getTokenAfter(comment, { includeComments: true });
return Boolean(
previousToken &&
nextToken &&
comment.loc.start.line === previousToken.loc.end.line &&
comment.loc.end.line === nextToken.loc.start.line
);
} | javascript | function isInlineComment(comment) {
const previousToken = sourceCode.getTokenBefore(comment, { includeComments: true }),
nextToken = sourceCode.getTokenAfter(comment, { includeComments: true });
return Boolean(
previousToken &&
nextToken &&
comment.loc.start.line === previousToken.loc.end.line &&
comment.loc.end.line === nextToken.loc.start.line
);
} | [
"function",
"isInlineComment",
"(",
"comment",
")",
"{",
"const",
"previousToken",
"=",
"sourceCode",
".",
"getTokenBefore",
"(",
"comment",
",",
"{",
"includeComments",
":",
"true",
"}",
")",
",",
"nextToken",
"=",
"sourceCode",
".",
"getTokenAfter",
"(",
"co... | ---------------------------------------------------------------------- Helpers ----------------------------------------------------------------------
Checks whether a comment is an inline comment.
For the purpose of this rule, a comment is inline if:
1. The comment is preceded by a token on the same line; and
2. The command is followed by a token on the same line.
Note that the comment itself need not be single-line!
Also, it follows from this definition that only block comments can
be considered as possibly inline. This is because line comments
would consume any following tokens on the same line as the comment.
@param {ASTNode} comment The comment node to check.
@returns {boolean} True if the comment is an inline comment, false
otherwise. | [
"----------------------------------------------------------------------",
"Helpers",
"----------------------------------------------------------------------",
"Checks",
"whether",
"a",
"comment",
"is",
"an",
"inline",
"comment",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/capitalized-comments.js#L170-L180 | train | Check if comment is inline | [
30522,
3853,
2003,
2378,
4179,
9006,
3672,
1006,
7615,
1007,
1063,
9530,
3367,
3025,
18715,
2368,
1027,
3120,
16044,
1012,
2131,
18715,
2368,
4783,
29278,
2063,
1006,
7615,
1010,
1063,
2421,
9006,
8163,
1024,
2995,
1065,
1007,
1010,
2279,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.m/src/sap/m/IconTabBarDragAndDropUtil.js | function (context, sDropLayout) {
var oIconTabHeader = context._iconTabHeader ? context._iconTabHeader : context;
var sIconTabHeaderId = oIconTabHeader.getId();
//Adding Drag&Drop configuration to the dragDropConfig aggregation if needed
context.addDragDropConfig(new DragInfo({
sourceAggregation: "items",
groupName: DRAG_DROP_GROUP_NAME + sIconTabHeaderId
}));
context.addDragDropConfig(new DropInfo({
targetAggregation: "items",
dropPosition: "Between",
dropLayout: sDropLayout,
drop: context._handleDragAndDrop.bind(context),
groupName: DRAG_DROP_GROUP_NAME + sIconTabHeaderId
}));
} | javascript | function (context, sDropLayout) {
var oIconTabHeader = context._iconTabHeader ? context._iconTabHeader : context;
var sIconTabHeaderId = oIconTabHeader.getId();
//Adding Drag&Drop configuration to the dragDropConfig aggregation if needed
context.addDragDropConfig(new DragInfo({
sourceAggregation: "items",
groupName: DRAG_DROP_GROUP_NAME + sIconTabHeaderId
}));
context.addDragDropConfig(new DropInfo({
targetAggregation: "items",
dropPosition: "Between",
dropLayout: sDropLayout,
drop: context._handleDragAndDrop.bind(context),
groupName: DRAG_DROP_GROUP_NAME + sIconTabHeaderId
}));
} | [
"function",
"(",
"context",
",",
"sDropLayout",
")",
"{",
"var",
"oIconTabHeader",
"=",
"context",
".",
"_iconTabHeader",
"?",
"context",
".",
"_iconTabHeader",
":",
"context",
";",
"var",
"sIconTabHeaderId",
"=",
"oIconTabHeader",
".",
"getId",
"(",
")",
";",... | Adding aggregations for drag and drop.
@param {object} context from which context function is called (sap.m.IconTabHeader or sap.m.IconTabSelectList)
@param {string} sDropLayout Depending on the control we are dragging in, it could be Vertical or Horizontal | [
"Adding",
"aggregations",
"for",
"drag",
"and",
"drop",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/IconTabBarDragAndDropUtil.js#L239-L254 | train | Adds the drag & drop configuration to the context | [
30522,
3853,
1006,
6123,
1010,
17371,
18981,
8485,
5833,
1007,
1063,
13075,
1051,
28524,
2696,
23706,
13775,
2121,
1027,
6123,
1012,
1035,
12696,
2696,
23706,
13775,
2121,
1029,
6123,
1012,
1035,
12696,
2696,
23706,
13775,
2121,
1024,
6123,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | resources/benchmark.js | prepareAndRunBenchmarks | function prepareAndRunBenchmarks(benchmarkPatterns, revisions) {
// Find all benchmark tests to be run.
let benchmarks = findFiles(LOCAL_DIR('src'), '*/__tests__/*-benchmark.js');
if (benchmarkPatterns.length !== 0) {
benchmarks = benchmarks.filter(benchmark =>
benchmarkPatterns.some(pattern =>
path.join('src', benchmark).includes(pattern)
)
);
}
if (benchmarks.length === 0) {
console.warn(
'No benchmarks matching: ' +
`\u001b[1m${benchmarkPatterns.join('\u001b[0m or \u001b[1m')}\u001b[0m`
);
return;
}
const environments = revisions.map(revision => ({
revision,
distPath: prepareRevision(revision),
}));
benchmarks.forEach(benchmark => runBenchmark(benchmark, environments));
} | javascript | function prepareAndRunBenchmarks(benchmarkPatterns, revisions) {
// Find all benchmark tests to be run.
let benchmarks = findFiles(LOCAL_DIR('src'), '*/__tests__/*-benchmark.js');
if (benchmarkPatterns.length !== 0) {
benchmarks = benchmarks.filter(benchmark =>
benchmarkPatterns.some(pattern =>
path.join('src', benchmark).includes(pattern)
)
);
}
if (benchmarks.length === 0) {
console.warn(
'No benchmarks matching: ' +
`\u001b[1m${benchmarkPatterns.join('\u001b[0m or \u001b[1m')}\u001b[0m`
);
return;
}
const environments = revisions.map(revision => ({
revision,
distPath: prepareRevision(revision),
}));
benchmarks.forEach(benchmark => runBenchmark(benchmark, environments));
} | [
"function",
"prepareAndRunBenchmarks",
"(",
"benchmarkPatterns",
",",
"revisions",
")",
"{",
"// Find all benchmark tests to be run.",
"let",
"benchmarks",
"=",
"findFiles",
"(",
"LOCAL_DIR",
"(",
"'src'",
")",
",",
"'*/__tests__/*-benchmark.js'",
")",
";",
"if",
"(",
... | Prepare all revisions and run benchmarks matching a pattern against them. | [
"Prepare",
"all",
"revisions",
"and",
"run",
"benchmarks",
"matching",
"a",
"pattern",
"against",
"them",
"."
] | b65ff6db8893c1c68f0f236c4b2d663e6c55f5ef | https://github.com/graphql/graphql-js/blob/b65ff6db8893c1c68f0f236c4b2d663e6c55f5ef/resources/benchmark.js#L187-L211 | train | Run benchmarks matching the given benchmark patterns | [
30522,
3853,
7374,
5685,
15532,
10609,
2818,
27373,
1006,
6847,
10665,
4502,
12079,
3619,
1010,
24699,
1007,
1063,
1013,
1013,
2424,
2035,
6847,
10665,
5852,
2000,
2022,
2448,
1012,
2292,
6847,
27373,
1027,
2424,
8873,
4244,
1006,
2334,
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.ui.core/src/sap/ui/thirdparty/zyngascroll.js | function(id) {
var cleared = running[id] != null;
if (cleared) {
running[id] = null;
}
return cleared;
} | javascript | function(id) {
var cleared = running[id] != null;
if (cleared) {
running[id] = null;
}
return cleared;
} | [
"function",
"(",
"id",
")",
"{",
"var",
"cleared",
"=",
"running",
"[",
"id",
"]",
"!=",
"null",
";",
"if",
"(",
"cleared",
")",
"{",
"running",
"[",
"id",
"]",
"=",
"null",
";",
"}",
"return",
"cleared",
";",
"}"
] | Stops the given animation.
@param {Integer} id Unique animation ID
@return {Boolean} Whether the animation was stopped (aka, was running before) | [
"Stops",
"the",
"given",
"animation",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/zyngascroll.js#L182-L189 | train | Clears the context associated with the specified context id. | [
30522,
3853,
1006,
8909,
1007,
1063,
13075,
5985,
1027,
2770,
1031,
8909,
1033,
999,
1027,
19701,
1025,
2065,
1006,
5985,
1007,
1063,
2770,
1031,
8909,
1033,
1027,
19701,
1025,
1065,
2709,
5985,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/jQuery.sap.support.js | function (oExecutionScope, vPresetOrRules) {
if (RuleSetLoader._bRulesCreated) {
return Main.analyze(oExecutionScope, vPresetOrRules);
}
return RuleSetLoader._oMainPromise.then(function () {
return Main.analyze(oExecutionScope, vPresetOrRules);
});
} | javascript | function (oExecutionScope, vPresetOrRules) {
if (RuleSetLoader._bRulesCreated) {
return Main.analyze(oExecutionScope, vPresetOrRules);
}
return RuleSetLoader._oMainPromise.then(function () {
return Main.analyze(oExecutionScope, vPresetOrRules);
});
} | [
"function",
"(",
"oExecutionScope",
",",
"vPresetOrRules",
")",
"{",
"if",
"(",
"RuleSetLoader",
".",
"_bRulesCreated",
")",
"{",
"return",
"Main",
".",
"analyze",
"(",
"oExecutionScope",
",",
"vPresetOrRules",
")",
";",
"}",
"return",
"RuleSetLoader",
".",
"_... | 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 jQuery.sap.support
@deprecated Since version 1.60.0. Please use sap/ui/support/RuleAnalyzer instead.
@public
@param {object} [oExecutionScope] The execution scope of the analysis (see {@link topic:e15067d976f24b11907f4c262bd749a0 Execution Scopes}).
@param {string} [oExecutionScope.type = "global"] Possible values are <code>global</code>, <code>subtree</code> or <code>component</code>.
@param {string} [oExecutionScope.parentId] ID of the root element that forms a subtree. Use when the scope is not <code>global</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>
@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/jQuery.sap.support.js#L59-L68 | train | Analyze the given rules | [
30522,
3853,
1006,
1051,
10288,
8586,
13700,
26127,
1010,
21210,
6072,
18903,
12171,
16308,
1007,
1063,
2065,
1006,
3513,
3388,
11066,
2121,
1012,
1035,
7987,
16308,
16748,
4383,
1007,
1063,
2709,
2364,
1012,
17908,
1006,
1051,
30524,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
angular/material | src/components/fabToolbar/fabToolbar.js | MdFabToolbarDirective | function MdFabToolbarDirective() {
return {
restrict: 'E',
transclude: true,
template: '<div class="md-fab-toolbar-wrapper">' +
' <div class="md-fab-toolbar-content" ng-transclude></div>' +
'</div>',
scope: {
direction: '@?mdDirection',
isOpen: '=?mdOpen'
},
bindToController: true,
controller: 'MdFabController',
controllerAs: 'vm',
link: link
};
function link(scope, element, attributes) {
// Add the base class for animations
element.addClass('md-fab-toolbar');
// Prepend the background element to the trigger's button
element.find('md-fab-trigger').find('button')
.prepend('<div class="md-fab-toolbar-background"></div>');
}
} | javascript | function MdFabToolbarDirective() {
return {
restrict: 'E',
transclude: true,
template: '<div class="md-fab-toolbar-wrapper">' +
' <div class="md-fab-toolbar-content" ng-transclude></div>' +
'</div>',
scope: {
direction: '@?mdDirection',
isOpen: '=?mdOpen'
},
bindToController: true,
controller: 'MdFabController',
controllerAs: 'vm',
link: link
};
function link(scope, element, attributes) {
// Add the base class for animations
element.addClass('md-fab-toolbar');
// Prepend the background element to the trigger's button
element.find('md-fab-trigger').find('button')
.prepend('<div class="md-fab-toolbar-background"></div>');
}
} | [
"function",
"MdFabToolbarDirective",
"(",
")",
"{",
"return",
"{",
"restrict",
":",
"'E'",
",",
"transclude",
":",
"true",
",",
"template",
":",
"'<div class=\"md-fab-toolbar-wrapper\">'",
"+",
"' <div class=\"md-fab-toolbar-content\" ng-transclude></div>'",
"+",
"'</div>'... | @ngdoc directive
@name mdFabToolbar
@module material.components.fabToolbar
@restrict E
@description
The `<md-fab-toolbar>` directive is used to present a toolbar of elements (usually `<md-button>`s)
for quick access to common actions when a floating action button is activated (via click or
keyboard navigation).
You may also easily position the trigger by applying one one of the following classes to the
`<md-fab-toolbar>` element:
- `md-fab-top-left`
- `md-fab-top-right`
- `md-fab-bottom-left`
- `md-fab-bottom-right`
These CSS classes use `position: absolute`, so you need to ensure that the container element
also uses `position: absolute` or `position: relative` in order for them to work.
@usage
<hljs lang="html">
<md-fab-toolbar md-direction='left'>
<md-fab-trigger>
<md-button aria-label="Add..."><md-icon md-svg-src="/img/icons/plus.svg"></md-icon></md-button>
</md-fab-trigger>
<md-toolbar>
<md-fab-actions>
<md-button aria-label="Add User">
<md-icon md-svg-src="/img/icons/user.svg"></md-icon>
</md-button>
<md-button aria-label="Add Group">
<md-icon md-svg-src="/img/icons/group.svg"></md-icon>
</md-button>
</md-fab-actions>
</md-toolbar>
</md-fab-toolbar>
</hljs>
@param {string} md-direction From which direction you would like the toolbar items to appear
relative to the trigger element. Supports `left` and `right` directions.
@param {expression=} md-open Programmatically control whether or not the toolbar is visible. | [
"@ngdoc",
"directive",
"@name",
"mdFabToolbar",
"@module",
"material",
".",
"components",
".",
"fabToolbar"
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/fabToolbar/fabToolbar.js#L74-L102 | train | The md - toolbar directive | [
30522,
3853,
9108,
7011,
19279,
13669,
21458,
7442,
15277,
1006,
1007,
1063,
2709,
1063,
21573,
1024,
1005,
1041,
1005,
1010,
9099,
20464,
12672,
1024,
2995,
1010,
23561,
1024,
1005,
1026,
4487,
2615,
2465,
1027,
1000,
9108,
1011,
6904,
249... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/ExactList.js | function(oList, bCollapse, oEvent, bSkipParentTraversal){
if (oEvent) {
oEvent.preventDefault();
oEvent.stopPropagation();
}
if (oList._isTop()) {
return;
}
if (oList._bCollapsed != bCollapse) {
//Toggles the horizontal Collapse State
var bFocus = !!oEvent;
var cntntAnimParam = {};
cntntAnimParam["margin-" + (oList._bRTL ? "right" : "left")] = (oList._bCollapsed ?
(oList._iCurrentWidth + "px") : Parameters.get("sapUiUx3ExactLstCollapseWidth"));
cntntAnimParam["border-top-width"] = (oList._bCollapsed ?
Parameters.get("sapUiUx3ExactLstContentTop") : "0px");
var $Ctnt = oList.$("cntnt");
if (jQuery.fx.off) {
for (var css in cntntAnimParam) {
$Ctnt.css(css, cntntAnimParam[css]);
}
} else {
$Ctnt.stop(true, true).animate(cntntAnimParam, 200, 'linear');
}
if (oList._bCollapsed) {
//expand
animate(oList.$("lst"), true, oList._iCurrentWidth + "px", function() {
jQuery(oList.getDomRef()).removeClass("sapUiUx3ExactLstCollapsed");
oList.$("head").css("overflow", "hidden");
}, function($Ref) {
oList.$("hide")
.html(ExactListRenderer.getExpanderSymbol(true, true))
.attr("title", oList._rb.getText("EXACT_LST_LIST_COLLAPSE"));
if (bFocus) {
oList.focus();
}
var $head = oList.$("head");
oList.$("head-txt").removeAttr("style");
$head.removeAttr("style");
$Ref.removeAttr("style");
refreshScrollBehaviour(oList);
setWidth(oList, oList._iCurrentWidth);
refreshCollapseHeaderTextWidth(oList);
$head.removeAttr("role");
$head.removeAttr("aria-label");
$head.removeAttr("aria-expanded");
var oAtt = oList._getAtt();
if (oAtt && oAtt._scrollToAttributeId) {
oAtt.scrollTo(sap.ui.getCore().byId(oAtt._scrollToAttributeId));
}
});
oList._oCollapseStyles = undefined;
} else {
oList._oCollapseStyles = {};
//collapse
animate(oList.$("lst"), true, 0, null, function() {
jQuery(oList.getDomRef()).addClass("sapUiUx3ExactLstCollapsed");
oList.$("hide")
.html(ExactListRenderer.getExpanderSymbol(false, true))
.attr("title", oList._rb.getText("EXACT_LST_LIST_EXPAND"));
if (bFocus) {
oList.focus();
}
refreshCollapseHeaderTextWidth(oList);
var $head = oList.$("head");
$head.attr("role", "region");
$head.attr("aria-label", oList._rb.getText("EXACT_LST_LIST_COLL_ARIA_LABEL", [oList._iLevel, oList._getAtt().getText()]));
$head.attr("aria-expanded", "false");
});
//Remember the current styles for rerendering
var aStyles = [];
for (var css in cntntAnimParam) {
aStyles.push(css, ":", cntntAnimParam[css], ";");
}
oList._oCollapseStyles["cntnt"] = aStyles.join("");
oList._oCollapseStyles["lst"] = "width:0px;";
}
oList._bCollapsed = !oList._bCollapsed;
}
if (bSkipParentTraversal) {
return;
}
var oParent = oList.getParent();
if (!oList._isTop() && oParent && oParent._isTop && !oParent._isTop()) {
collapseHorizontally(oParent, bCollapse);
}
} | javascript | function(oList, bCollapse, oEvent, bSkipParentTraversal){
if (oEvent) {
oEvent.preventDefault();
oEvent.stopPropagation();
}
if (oList._isTop()) {
return;
}
if (oList._bCollapsed != bCollapse) {
//Toggles the horizontal Collapse State
var bFocus = !!oEvent;
var cntntAnimParam = {};
cntntAnimParam["margin-" + (oList._bRTL ? "right" : "left")] = (oList._bCollapsed ?
(oList._iCurrentWidth + "px") : Parameters.get("sapUiUx3ExactLstCollapseWidth"));
cntntAnimParam["border-top-width"] = (oList._bCollapsed ?
Parameters.get("sapUiUx3ExactLstContentTop") : "0px");
var $Ctnt = oList.$("cntnt");
if (jQuery.fx.off) {
for (var css in cntntAnimParam) {
$Ctnt.css(css, cntntAnimParam[css]);
}
} else {
$Ctnt.stop(true, true).animate(cntntAnimParam, 200, 'linear');
}
if (oList._bCollapsed) {
//expand
animate(oList.$("lst"), true, oList._iCurrentWidth + "px", function() {
jQuery(oList.getDomRef()).removeClass("sapUiUx3ExactLstCollapsed");
oList.$("head").css("overflow", "hidden");
}, function($Ref) {
oList.$("hide")
.html(ExactListRenderer.getExpanderSymbol(true, true))
.attr("title", oList._rb.getText("EXACT_LST_LIST_COLLAPSE"));
if (bFocus) {
oList.focus();
}
var $head = oList.$("head");
oList.$("head-txt").removeAttr("style");
$head.removeAttr("style");
$Ref.removeAttr("style");
refreshScrollBehaviour(oList);
setWidth(oList, oList._iCurrentWidth);
refreshCollapseHeaderTextWidth(oList);
$head.removeAttr("role");
$head.removeAttr("aria-label");
$head.removeAttr("aria-expanded");
var oAtt = oList._getAtt();
if (oAtt && oAtt._scrollToAttributeId) {
oAtt.scrollTo(sap.ui.getCore().byId(oAtt._scrollToAttributeId));
}
});
oList._oCollapseStyles = undefined;
} else {
oList._oCollapseStyles = {};
//collapse
animate(oList.$("lst"), true, 0, null, function() {
jQuery(oList.getDomRef()).addClass("sapUiUx3ExactLstCollapsed");
oList.$("hide")
.html(ExactListRenderer.getExpanderSymbol(false, true))
.attr("title", oList._rb.getText("EXACT_LST_LIST_EXPAND"));
if (bFocus) {
oList.focus();
}
refreshCollapseHeaderTextWidth(oList);
var $head = oList.$("head");
$head.attr("role", "region");
$head.attr("aria-label", oList._rb.getText("EXACT_LST_LIST_COLL_ARIA_LABEL", [oList._iLevel, oList._getAtt().getText()]));
$head.attr("aria-expanded", "false");
});
//Remember the current styles for rerendering
var aStyles = [];
for (var css in cntntAnimParam) {
aStyles.push(css, ":", cntntAnimParam[css], ";");
}
oList._oCollapseStyles["cntnt"] = aStyles.join("");
oList._oCollapseStyles["lst"] = "width:0px;";
}
oList._bCollapsed = !oList._bCollapsed;
}
if (bSkipParentTraversal) {
return;
}
var oParent = oList.getParent();
if (!oList._isTop() && oParent && oParent._isTop && !oParent._isTop()) {
collapseHorizontally(oParent, bCollapse);
}
} | [
"function",
"(",
"oList",
",",
"bCollapse",
",",
"oEvent",
",",
"bSkipParentTraversal",
")",
"{",
"if",
"(",
"oEvent",
")",
"{",
"oEvent",
".",
"preventDefault",
"(",
")",
";",
"oEvent",
".",
"stopPropagation",
"(",
")",
";",
"}",
"if",
"(",
"oList",
"... | Collapses or expands the given list horizontally | [
"Collapses",
"or",
"expands",
"the",
"given",
"list",
"horizontally"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.ux3/src/sap/ui/ux3/ExactList.js#L1247-L1344 | train | Collapse the list | [
30522,
3853,
1006,
19330,
2923,
1010,
4647,
14511,
9331,
3366,
1010,
1051,
18697,
3372,
1010,
18667,
3211,
13944,
22787,
6494,
14028,
2389,
1007,
1063,
2065,
1006,
1051,
18697,
3372,
1007,
1063,
1051,
18697,
3372,
1012,
4652,
3207,
7011,
11... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
adobe/brackets | src/filesystem/FileSystem.js | registerProtocolAdapter | function registerProtocolAdapter(protocol, adapter) {
var adapters;
if (protocol) {
adapters = _fileProtocolPlugins[protocol] || [];
adapters.push(adapter);
// We will keep a sorted adapter list on 'priority'
// If priority is not provided a default of '0' is assumed
adapters.sort(function (a, b) {
return (b.priority || 0) - (a.priority || 0);
});
_fileProtocolPlugins[protocol] = adapters;
}
} | javascript | function registerProtocolAdapter(protocol, adapter) {
var adapters;
if (protocol) {
adapters = _fileProtocolPlugins[protocol] || [];
adapters.push(adapter);
// We will keep a sorted adapter list on 'priority'
// If priority is not provided a default of '0' is assumed
adapters.sort(function (a, b) {
return (b.priority || 0) - (a.priority || 0);
});
_fileProtocolPlugins[protocol] = adapters;
}
} | [
"function",
"registerProtocolAdapter",
"(",
"protocol",
",",
"adapter",
")",
"{",
"var",
"adapters",
";",
"if",
"(",
"protocol",
")",
"{",
"adapters",
"=",
"_fileProtocolPlugins",
"[",
"protocol",
"]",
"||",
"[",
"]",
";",
"adapters",
".",
"push",
"(",
"ad... | Typical signature of a file protocol adapter.
@typedef {Object} FileProtocol~Adapter
@property {Number} priority - Indicates the priority.
@property {Object} fileImpl - Handle for the custom file implementation prototype.
@property {function} canRead - To check if this impl can read a file for a given path.
FileSystem hook to register file protocol adapter
@param {string} protocol ex: "https:"|"http:"|"ftp:"|"file:"
@param {...FileProtocol~Adapter} adapter wrapper over file implementation | [
"Typical",
"signature",
"of",
"a",
"file",
"protocol",
"adapter",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/filesystem/FileSystem.js#L118-L132 | train | Register an adapter for a protocol | [
30522,
3853,
4236,
21572,
3406,
26289,
2850,
13876,
2121,
1006,
8778,
1010,
15581,
2121,
1007,
1063,
13075,
15581,
2545,
1025,
2065,
1006,
8778,
1007,
1063,
15581,
2545,
1027,
1035,
5371,
21572,
3406,
25778,
24759,
15916,
7076,
1031,
8778,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/controllers/controller.bar.js | computeFitCategoryTraits | function computeFitCategoryTraits(index, ruler, options) {
var thickness = options.barThickness;
var count = ruler.stackCount;
var curr = ruler.pixels[index];
var size, ratio;
if (helpers.isNullOrUndef(thickness)) {
size = ruler.min * options.categoryPercentage;
ratio = options.barPercentage;
} else {
// When bar thickness is enforced, category and bar percentages are ignored.
// Note(SB): we could add support for relative bar thickness (e.g. barThickness: '50%')
// and deprecate barPercentage since this value is ignored when thickness is absolute.
size = thickness * count;
ratio = 1;
}
return {
chunk: size / count,
ratio: ratio,
start: curr - (size / 2)
};
} | javascript | function computeFitCategoryTraits(index, ruler, options) {
var thickness = options.barThickness;
var count = ruler.stackCount;
var curr = ruler.pixels[index];
var size, ratio;
if (helpers.isNullOrUndef(thickness)) {
size = ruler.min * options.categoryPercentage;
ratio = options.barPercentage;
} else {
// When bar thickness is enforced, category and bar percentages are ignored.
// Note(SB): we could add support for relative bar thickness (e.g. barThickness: '50%')
// and deprecate barPercentage since this value is ignored when thickness is absolute.
size = thickness * count;
ratio = 1;
}
return {
chunk: size / count,
ratio: ratio,
start: curr - (size / 2)
};
} | [
"function",
"computeFitCategoryTraits",
"(",
"index",
",",
"ruler",
",",
"options",
")",
"{",
"var",
"thickness",
"=",
"options",
".",
"barThickness",
";",
"var",
"count",
"=",
"ruler",
".",
"stackCount",
";",
"var",
"curr",
"=",
"ruler",
".",
"pixels",
"[... | Computes an "ideal" category based on the absolute bar thickness or, if undefined or null,
uses the smallest interval (see computeMinSampleSize) that prevents bar overlapping. This
mode currently always generates bars equally sized (until we introduce scriptable options?).
@private | [
"Computes",
"an",
"ideal",
"category",
"based",
"on",
"the",
"absolute",
"bar",
"thickness",
"or",
"if",
"undefined",
"or",
"null",
"uses",
"the",
"smallest",
"interval",
"(",
"see",
"computeMinSampleSize",
")",
"that",
"prevents",
"bar",
"overlapping",
".",
"... | f093c36574d290330ed623e60fbd070421c730d5 | https://github.com/chartjs/Chart.js/blob/f093c36574d290330ed623e60fbd070421c730d5/src/controllers/controller.bar.js#L60-L82 | train | Compute the fit category traits | [
30522,
3853,
24134,
8873,
13535,
3686,
20255,
22123,
14995,
3215,
1006,
5950,
1010,
7786,
1010,
7047,
1007,
1063,
13075,
14983,
1027,
7047,
1012,
12075,
16066,
2243,
2791,
1025,
13075,
4175,
1027,
7786,
1012,
9991,
3597,
16671,
1025,
13075,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
nhn/tui.editor | src/js/extensions/table/mergedTableAddCol.js | _createNewCell | function _createNewCell(rowData, rowIndex, colIndex, prevCell) {
const cellData = rowData[colIndex];
let newCell;
if (util.isExisty(cellData.colMergeWith)) {
const {colMergeWith} = cellData;
const merger = rowData[colMergeWith];
const lastMergedCellIndex = colMergeWith + merger.colspan - 1;
if (util.isExisty(merger.rowMergeWith) && prevCell) {
newCell = util.extend({}, prevCell);
} else if (lastMergedCellIndex > colIndex) {
merger.colspan += 1;
newCell = util.extend({}, cellData);
}
} else if (cellData.colspan > 1) {
cellData.colspan += 1;
newCell = _createColMergedCell(colIndex, cellData.nodeName);
}
if (!newCell) {
newCell = dataHandler.createBasicCell(rowIndex, colIndex + 1, cellData.nodeName);
}
return newCell;
} | javascript | function _createNewCell(rowData, rowIndex, colIndex, prevCell) {
const cellData = rowData[colIndex];
let newCell;
if (util.isExisty(cellData.colMergeWith)) {
const {colMergeWith} = cellData;
const merger = rowData[colMergeWith];
const lastMergedCellIndex = colMergeWith + merger.colspan - 1;
if (util.isExisty(merger.rowMergeWith) && prevCell) {
newCell = util.extend({}, prevCell);
} else if (lastMergedCellIndex > colIndex) {
merger.colspan += 1;
newCell = util.extend({}, cellData);
}
} else if (cellData.colspan > 1) {
cellData.colspan += 1;
newCell = _createColMergedCell(colIndex, cellData.nodeName);
}
if (!newCell) {
newCell = dataHandler.createBasicCell(rowIndex, colIndex + 1, cellData.nodeName);
}
return newCell;
} | [
"function",
"_createNewCell",
"(",
"rowData",
",",
"rowIndex",
",",
"colIndex",
",",
"prevCell",
")",
"{",
"const",
"cellData",
"=",
"rowData",
"[",
"colIndex",
"]",
";",
"let",
"newCell",
";",
"if",
"(",
"util",
".",
"isExisty",
"(",
"cellData",
".",
"c... | Create new cell data.
@param {Array.<object>} rowData - row data of table data
@param {number} rowIndex - row index of table data
@param {number} colIndex - column index of table data
@param {object | null} prevCell - previous cell data
@returns {object}
@private | [
"Create",
"new",
"cell",
"data",
"."
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/extensions/table/mergedTableAddCol.js#L77-L102 | train | Create new cell | [
30522,
3853,
1035,
3443,
2638,
16526,
5349,
1006,
5216,
2850,
2696,
1010,
5216,
22254,
10288,
1010,
6972,
3207,
2595,
1010,
3653,
25465,
5349,
1007,
1063,
9530,
3367,
3526,
2850,
2696,
1027,
5216,
2850,
2696,
1031,
6972,
3207,
2595,
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... |
eslint/eslint | lib/rules/no-use-before-define.js | isInInitializer | function isInInitializer(variable, reference) {
if (variable.scope !== reference.from) {
return false;
}
let node = variable.identifiers[0].parent;
const location = reference.identifier.range[1];
while (node) {
if (node.type === "VariableDeclarator") {
if (isInRange(node.init, location)) {
return true;
}
if (FOR_IN_OF_TYPE.test(node.parent.parent.type) &&
isInRange(node.parent.parent.right, location)
) {
return true;
}
break;
} else if (node.type === "AssignmentPattern") {
if (isInRange(node.right, location)) {
return true;
}
} else if (SENTINEL_TYPE.test(node.type)) {
break;
}
node = node.parent;
}
return false;
} | javascript | function isInInitializer(variable, reference) {
if (variable.scope !== reference.from) {
return false;
}
let node = variable.identifiers[0].parent;
const location = reference.identifier.range[1];
while (node) {
if (node.type === "VariableDeclarator") {
if (isInRange(node.init, location)) {
return true;
}
if (FOR_IN_OF_TYPE.test(node.parent.parent.type) &&
isInRange(node.parent.parent.right, location)
) {
return true;
}
break;
} else if (node.type === "AssignmentPattern") {
if (isInRange(node.right, location)) {
return true;
}
} else if (SENTINEL_TYPE.test(node.type)) {
break;
}
node = node.parent;
}
return false;
} | [
"function",
"isInInitializer",
"(",
"variable",
",",
"reference",
")",
"{",
"if",
"(",
"variable",
".",
"scope",
"!==",
"reference",
".",
"from",
")",
"{",
"return",
"false",
";",
"}",
"let",
"node",
"=",
"variable",
".",
"identifiers",
"[",
"0",
"]",
... | Checks whether or not a given reference is inside of the initializers of a given variable.
This returns `true` in the following cases:
var a = a
var [a = a] = list
var {a = a} = obj
for (var a in a) {}
for (var a of a) {}
@param {Variable} variable - A variable to check.
@param {Reference} reference - A reference to check.
@returns {boolean} `true` if the reference is inside of the initializers. | [
"Checks",
"whether",
"or",
"not",
"a",
"given",
"reference",
"is",
"inside",
"of",
"the",
"initializers",
"of",
"a",
"given",
"variable",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/no-use-before-define.js#L100-L131 | train | Check if a variable is in the initializer of a reference | [
30522,
3853,
2003,
5498,
3490,
20925,
17629,
1006,
8023,
1010,
4431,
1007,
1063,
2065,
1006,
8023,
1012,
9531,
999,
1027,
1027,
4431,
1012,
2013,
1007,
1063,
2709,
6270,
1025,
1065,
2292,
13045,
1027,
8023,
1012,
8909,
4765,
28295,
1031,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
LLK/scratch-blocks | blocks_vertical/event.js | function() {
this.jsonInit({
"message0": Blockly.Msg.EVENT_WHENGREATERTHAN,
"args0": [
{
"type": "field_dropdown",
"name": "WHENGREATERTHANMENU",
"options": [
[Blockly.Msg.EVENT_WHENGREATERTHAN_LOUDNESS, 'LOUDNESS'],
[Blockly.Msg.EVENT_WHENGREATERTHAN_TIMER, 'TIMER']
]
},
{
"type": "input_value",
"name": "VALUE"
}
],
"category": Blockly.Categories.event,
"extensions": ["colours_event", "shape_hat"]
});
} | javascript | function() {
this.jsonInit({
"message0": Blockly.Msg.EVENT_WHENGREATERTHAN,
"args0": [
{
"type": "field_dropdown",
"name": "WHENGREATERTHANMENU",
"options": [
[Blockly.Msg.EVENT_WHENGREATERTHAN_LOUDNESS, 'LOUDNESS'],
[Blockly.Msg.EVENT_WHENGREATERTHAN_TIMER, 'TIMER']
]
},
{
"type": "input_value",
"name": "VALUE"
}
],
"category": Blockly.Categories.event,
"extensions": ["colours_event", "shape_hat"]
});
} | [
"function",
"(",
")",
"{",
"this",
".",
"jsonInit",
"(",
"{",
"\"message0\"",
":",
"Blockly",
".",
"Msg",
".",
"EVENT_WHENGREATERTHAN",
",",
"\"args0\"",
":",
"[",
"{",
"\"type\"",
":",
"\"field_dropdown\"",
",",
"\"name\"",
":",
"\"WHENGREATERTHANMENU\"",
","... | Block for when loudness/timer/video motion is greater than the value.
@this Blockly.Block | [
"Block",
"for",
"when",
"loudness",
"/",
"timer",
"/",
"video",
"motion",
"is",
"greater",
"than",
"the",
"value",
"."
] | 455b2a854435c0a67da1da92320ddc3ec3e2b799 | https://github.com/LLK/scratch-blocks/blob/455b2a854435c0a67da1da92320ddc3ec3e2b799/blocks_vertical/event.js#L177-L197 | train | Block for whomerening between two terms. | [
30522,
3853,
1006,
1007,
1063,
2023,
1012,
1046,
3385,
5498,
2102,
1006,
1063,
1000,
4471,
2692,
1000,
1024,
3796,
2135,
1012,
5796,
2290,
1012,
2724,
1035,
2043,
17603,
24932,
21604,
1010,
1000,
12098,
5620,
2692,
1000,
1024,
1031,
1063,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SeleniumHQ/selenium | third_party/js/mozmill/shared-modules/search.js | searchBar_restoreDefaults | function searchBar_restoreDefaults()
{
// XXX: Bug 556477 - Restore default sorting
this.openEngineManager(function(controller) {
var manager = new engineManager(controller);
// We have to do any action so the restore button gets enabled
manager.moveDownEngine(manager.engines[0].name);
manager.restoreDefaults();
manager.close(true);
});
// Update the visibility status for each engine and reset the default engine
this._bss.restoreDefaultEngines();
this._bss.currentEngine = this._bss.defaultEngine;
// Clear any entered search term
this.clear();
} | javascript | function searchBar_restoreDefaults()
{
// XXX: Bug 556477 - Restore default sorting
this.openEngineManager(function(controller) {
var manager = new engineManager(controller);
// We have to do any action so the restore button gets enabled
manager.moveDownEngine(manager.engines[0].name);
manager.restoreDefaults();
manager.close(true);
});
// Update the visibility status for each engine and reset the default engine
this._bss.restoreDefaultEngines();
this._bss.currentEngine = this._bss.defaultEngine;
// Clear any entered search term
this.clear();
} | [
"function",
"searchBar_restoreDefaults",
"(",
")",
"{",
"// XXX: Bug 556477 - Restore default sorting",
"this",
".",
"openEngineManager",
"(",
"function",
"(",
"controller",
")",
"{",
"var",
"manager",
"=",
"new",
"engineManager",
"(",
"controller",
")",
";",
"// We h... | Restore the default set of search engines (API call) | [
"Restore",
"the",
"default",
"set",
"of",
"search",
"engines",
"(",
"API",
"call",
")"
] | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/search.js#L756-L774 | train | Restore the default sorting | [
30522,
3853,
3945,
8237,
1035,
5854,
12879,
23505,
2015,
1006,
1007,
1063,
1013,
1013,
22038,
2595,
1024,
11829,
4583,
21084,
2581,
2581,
1011,
9239,
12398,
22210,
2023,
1012,
2330,
13159,
3170,
24805,
4590,
1006,
3853,
1006,
11486,
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... |
SeleniumHQ/selenium | javascript/selenium-core/scripts/htmlutils.js | copyBody | function copyBody(bodyHtml, doc) {
if (doc.body.innerHTML == bodyHtml) {
return;
}
jQuery.init(doc.body).empty();
appendHTML(bodyHtml, doc.body);
} | javascript | function copyBody(bodyHtml, doc) {
if (doc.body.innerHTML == bodyHtml) {
return;
}
jQuery.init(doc.body).empty();
appendHTML(bodyHtml, doc.body);
} | [
"function",
"copyBody",
"(",
"bodyHtml",
",",
"doc",
")",
"{",
"if",
"(",
"doc",
".",
"body",
".",
"innerHTML",
"==",
"bodyHtml",
")",
"{",
"return",
";",
"}",
"jQuery",
".",
"init",
"(",
"doc",
".",
"body",
")",
".",
"empty",
"(",
")",
";",
"app... | 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. | [
"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",
".",
... | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/selenium-core/scripts/htmlutils.js#L1470-L1478 | train | Copy the body html to the document body | [
30522,
3853,
6100,
23684,
30524,
1046,
4226,
2854,
1012,
1999,
4183,
1006,
9986,
1012,
2303,
1007,
1012,
4064,
1006,
1007,
1025,
10439,
10497,
11039,
19968,
1006,
2303,
11039,
19968,
1010,
9986,
1012,
2303,
1007,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/type/String.js | setConstraints | function setConstraints(oType, oConstraints) {
var vIsDigitSequence, vMaxLength, vNullable;
oType.oConstraints = undefined;
if (oConstraints) {
vMaxLength = oConstraints.maxLength;
if (typeof vMaxLength === "string") {
vMaxLength = parseInt(vMaxLength);
}
if (typeof vMaxLength === "number" && !isNaN(vMaxLength) && vMaxLength > 0) {
oType.oConstraints = {maxLength : vMaxLength };
} else if (vMaxLength !== undefined) {
Log.warning("Illegal maxLength: " + oConstraints.maxLength, null, oType.getName());
}
vIsDigitSequence = oConstraints.isDigitSequence;
if (vIsDigitSequence === true || vIsDigitSequence === "true") {
oType.oConstraints = oType.oConstraints || {};
oType.oConstraints.isDigitSequence = true;
} else if (vIsDigitSequence !== undefined && vIsDigitSequence !== false
&& vIsDigitSequence !== "false") {
Log.warning("Illegal isDigitSequence: " + vIsDigitSequence, null, oType.getName());
}
vNullable = oConstraints.nullable;
if (vNullable === false || vNullable === "false") {
oType.oConstraints = oType.oConstraints || {};
oType.oConstraints.nullable = false;
} else if (vNullable !== undefined && vNullable !== true && vNullable !== "true") {
Log.warning("Illegal nullable: " + vNullable, null, oType.getName());
}
}
} | javascript | function setConstraints(oType, oConstraints) {
var vIsDigitSequence, vMaxLength, vNullable;
oType.oConstraints = undefined;
if (oConstraints) {
vMaxLength = oConstraints.maxLength;
if (typeof vMaxLength === "string") {
vMaxLength = parseInt(vMaxLength);
}
if (typeof vMaxLength === "number" && !isNaN(vMaxLength) && vMaxLength > 0) {
oType.oConstraints = {maxLength : vMaxLength };
} else if (vMaxLength !== undefined) {
Log.warning("Illegal maxLength: " + oConstraints.maxLength, null, oType.getName());
}
vIsDigitSequence = oConstraints.isDigitSequence;
if (vIsDigitSequence === true || vIsDigitSequence === "true") {
oType.oConstraints = oType.oConstraints || {};
oType.oConstraints.isDigitSequence = true;
} else if (vIsDigitSequence !== undefined && vIsDigitSequence !== false
&& vIsDigitSequence !== "false") {
Log.warning("Illegal isDigitSequence: " + vIsDigitSequence, null, oType.getName());
}
vNullable = oConstraints.nullable;
if (vNullable === false || vNullable === "false") {
oType.oConstraints = oType.oConstraints || {};
oType.oConstraints.nullable = false;
} else if (vNullable !== undefined && vNullable !== true && vNullable !== "true") {
Log.warning("Illegal nullable: " + vNullable, null, oType.getName());
}
}
} | [
"function",
"setConstraints",
"(",
"oType",
",",
"oConstraints",
")",
"{",
"var",
"vIsDigitSequence",
",",
"vMaxLength",
",",
"vNullable",
";",
"oType",
".",
"oConstraints",
"=",
"undefined",
";",
"if",
"(",
"oConstraints",
")",
"{",
"vMaxLength",
"=",
"oConst... | Sets the constraints.
@param {sap.ui.model.odata.type.String} oType
the type instance
@param {object} [oConstraints]
constraints, see {@link #constructor} | [
"Sets",
"the",
"constraints",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/type/String.js#L39-L70 | train | Sets constraints for the given type | [
30522,
3853,
2275,
8663,
20528,
18447,
2015,
1006,
27178,
18863,
1010,
1051,
8663,
20528,
18447,
2015,
1007,
1063,
13075,
25292,
4305,
23806,
3366,
4226,
5897,
1010,
1058,
17848,
7770,
13512,
2232,
1010,
1058,
11231,
4571,
3468,
1025,
27178,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/core/util/XMLPreprocessor.js | visitChildNodes | function visitChildNodes(oNode, oWithControl) {
return stopAndGo(
// cache live collection so that removing a template node does not hurt
Array.prototype.slice.apply(oNode.childNodes),
function (oChild) {
return visitNode(oChild, oWithControl);
});
} | javascript | function visitChildNodes(oNode, oWithControl) {
return stopAndGo(
// cache live collection so that removing a template node does not hurt
Array.prototype.slice.apply(oNode.childNodes),
function (oChild) {
return visitNode(oChild, oWithControl);
});
} | [
"function",
"visitChildNodes",
"(",
"oNode",
",",
"oWithControl",
")",
"{",
"return",
"stopAndGo",
"(",
"// cache live collection so that removing a template node does not hurt",
"Array",
".",
"prototype",
".",
"slice",
".",
"apply",
"(",
"oNode",
".",
"childNodes",
")"... | Visits all child nodes of the given node.
@param {Node} oNode the XML DOM node
@param {sap.ui.core.util._with} oWithControl the "with" control
@returns {sap.ui.base.SyncPromise}
A sync promise which resolves with <code>undefined</code> as soon as visiting is
done, or is rejected with a corresponding error if visiting fails. | [
"Visits",
"all",
"child",
"nodes",
"of",
"the",
"given",
"node",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/util/XMLPreprocessor.js#L1779-L1786 | train | Visit all child nodes of a node | [
30522,
3853,
3942,
19339,
3630,
6155,
1006,
21058,
3207,
1010,
27593,
8939,
8663,
13181,
2140,
1007,
1063,
2709,
2644,
5685,
3995,
1006,
1013,
1013,
17053,
2444,
3074,
2061,
2008,
9268,
1037,
23561,
13045,
2515,
2025,
3480,
9140,
1012,
8773... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
jakesgordon/javascript-state-machine | src/util/camelize.js | camelize | function camelize(label) {
if (label.length === 0)
return label;
var n, result, word, words = label.split(/[_-]/);
// single word with first character already lowercase, return untouched
if ((words.length === 1) && (words[0][0].toLowerCase() === words[0][0]))
return label;
result = words[0].toLowerCase();
for(n = 1 ; n < words.length ; n++) {
result = result + words[n].charAt(0).toUpperCase() + words[n].substring(1).toLowerCase();
}
return result;
} | javascript | function camelize(label) {
if (label.length === 0)
return label;
var n, result, word, words = label.split(/[_-]/);
// single word with first character already lowercase, return untouched
if ((words.length === 1) && (words[0][0].toLowerCase() === words[0][0]))
return label;
result = words[0].toLowerCase();
for(n = 1 ; n < words.length ; n++) {
result = result + words[n].charAt(0).toUpperCase() + words[n].substring(1).toLowerCase();
}
return result;
} | [
"function",
"camelize",
"(",
"label",
")",
"{",
"if",
"(",
"label",
".",
"length",
"===",
"0",
")",
"return",
"label",
";",
"var",
"n",
",",
"result",
",",
"word",
",",
"words",
"=",
"label",
".",
"split",
"(",
"/",
"[_-]",
"/",
")",
";",
"// sin... | ------------------------------------------------------------------------------------------------- | [
"-------------------------------------------------------------------------------------------------"
] | 0d603577423244228cebcd62e60dbbfff27c6ea3 | https://github.com/jakesgordon/javascript-state-machine/blob/0d603577423244228cebcd62e60dbbfff27c6ea3/src/util/camelize.js#L5-L22 | train | camelize a label | [
30522,
3853,
19130,
4697,
1006,
3830,
1007,
1063,
2065,
1006,
3830,
1012,
3091,
1027,
1027,
1027,
1014,
1007,
2709,
3830,
1025,
13075,
1050,
1010,
2765,
1010,
2773,
1010,
2616,
1027,
3830,
1012,
3975,
1006,
1013,
1031,
1035,
1011,
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... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Helper.js | function (mMap, sPath, oItem) {
if (oItem) {
if (!mMap[sPath]) {
mMap[sPath] = [oItem];
} else if (mMap[sPath].indexOf(oItem) < 0) {
mMap[sPath].push(oItem);
}
}
} | javascript | function (mMap, sPath, oItem) {
if (oItem) {
if (!mMap[sPath]) {
mMap[sPath] = [oItem];
} else if (mMap[sPath].indexOf(oItem) < 0) {
mMap[sPath].push(oItem);
}
}
} | [
"function",
"(",
"mMap",
",",
"sPath",
",",
"oItem",
")",
"{",
"if",
"(",
"oItem",
")",
"{",
"if",
"(",
"!",
"mMap",
"[",
"sPath",
"]",
")",
"{",
"mMap",
"[",
"sPath",
"]",
"=",
"[",
"oItem",
"]",
";",
"}",
"else",
"if",
"(",
"mMap",
"[",
"... | Adds an item to the given map by path.
@param {object} mMap
A map from path to a list of items
@param {string} sPath
The path
@param {object} [oItem]
The item; if it is <code>undefined</code>, nothing happens | [
"Adds",
"an",
"item",
"to",
"the",
"given",
"map",
"by",
"path",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Helper.js#L37-L45 | train | Adds an item to the map of items to be deleted | [
30522,
3853,
1006,
21021,
2361,
1010,
14690,
2232,
1010,
1051,
4221,
2213,
1007,
1063,
2065,
1006,
1051,
4221,
2213,
1007,
1063,
2065,
1006,
999,
21021,
2361,
1031,
14690,
2232,
1033,
1007,
1063,
21021,
2361,
1031,
14690,
2232,
1033,
30524,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
adobe/brackets | src/utils/EventDispatcher.js | triggerWithArray | function triggerWithArray(dispatcher, eventName, argsArray) {
var triggerArgs = [eventName].concat(argsArray);
dispatcher.trigger.apply(dispatcher, triggerArgs);
} | javascript | function triggerWithArray(dispatcher, eventName, argsArray) {
var triggerArgs = [eventName].concat(argsArray);
dispatcher.trigger.apply(dispatcher, triggerArgs);
} | [
"function",
"triggerWithArray",
"(",
"dispatcher",
",",
"eventName",
",",
"argsArray",
")",
"{",
"var",
"triggerArgs",
"=",
"[",
"eventName",
"]",
".",
"concat",
"(",
"argsArray",
")",
";",
"dispatcher",
".",
"trigger",
".",
"apply",
"(",
"dispatcher",
",",
... | Utility for calling on() with an array of arguments to pass to event handlers (rather than a varargs
list). makeEventDispatcher() must have previously been called on 'dispatcher'.
@param {!Object} dispatcher
@param {string} eventName
@param {!Array.<*>} argsArray | [
"Utility",
"for",
"calling",
"on",
"()",
"with",
"an",
"array",
"of",
"arguments",
"to",
"pass",
"to",
"event",
"handlers",
"(",
"rather",
"than",
"a",
"varargs",
"list",
")",
".",
"makeEventDispatcher",
"()",
"must",
"have",
"previously",
"been",
"called",
... | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/utils/EventDispatcher.js#L265-L268 | train | trigger with an array of arguments | [
30522,
3853,
9495,
24415,
2906,
9447,
1006,
18365,
2121,
1010,
2724,
18442,
1010,
12098,
5620,
2906,
9447,
1007,
1063,
13075,
9495,
2906,
5620,
1027,
1031,
2724,
18442,
1033,
1012,
9530,
11266,
1006,
12098,
5620,
2906,
9447,
1007,
1025,
183... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/ui-element.js | UISpecifier | function UISpecifier(uiSpecifierStringOrPagesetName, elementName, args)
{
/**
* Initializes this object from a UI specifier string of the form:
*
* pagesetName::elementName(arg1=value1, arg2=value2, ...)
*
* into its component parts, and returns them as an object.
*
* @return an object containing the components of the UI specifier
* @throws UISpecifierException
*/
this._initFromUISpecifierString = function(uiSpecifierString) {
var matches = /^(.*)::([^\(]+)\((.*)\)$/.exec(uiSpecifierString);
if (matches == null) {
throw new UISpecifierException('Error in '
+ 'UISpecifier._initFromUISpecifierString(): "'
+ this.string + '" is not a valid UI specifier string');
}
this.pagesetName = matches[1];
this.elementName = matches[2];
this.args = (matches[3]) ? parse_kwargs(matches[3]) : {};
};
/**
* Override the toString() method to return the UI specifier string when
* evaluated in a string context. Combines the UI specifier components into
* a canonical UI specifier string and returns it.
*
* @return a UI specifier string
*/
this.toString = function() {
// empty string is acceptable for the path, but it must be defined
if (this.pagesetName == undefined) {
throw new UISpecifierException('Error in UISpecifier.toString(): "'
+ this.pagesetName + '" is not a valid UI specifier pageset '
+ 'name');
}
if (!this.elementName) {
throw new UISpecifierException('Error in UISpecifier.unparse(): "'
+ this.elementName + '" is not a valid UI specifier element '
+ 'name');
}
if (!this.args) {
throw new UISpecifierException('Error in UISpecifier.unparse(): "'
+ this.args + '" are not valid UI specifier args');
}
uiElement = UIMap.getInstance()
.getUIElement(this.pagesetName, this.elementName);
if (uiElement != null) {
var kwargs = to_kwargs(this.args, uiElement.argsOrder);
}
else {
// probably under unit test
var kwargs = to_kwargs(this.args);
}
return this.pagesetName + '::' + this.elementName + '(' + kwargs + ')';
};
// construct the object
if (arguments.length < 2) {
this._initFromUISpecifierString(uiSpecifierStringOrPagesetName);
}
else {
this.pagesetName = uiSpecifierStringOrPagesetName;
this.elementName = elementName;
this.args = (args) ? clone(args) : {};
}
} | javascript | function UISpecifier(uiSpecifierStringOrPagesetName, elementName, args)
{
/**
* Initializes this object from a UI specifier string of the form:
*
* pagesetName::elementName(arg1=value1, arg2=value2, ...)
*
* into its component parts, and returns them as an object.
*
* @return an object containing the components of the UI specifier
* @throws UISpecifierException
*/
this._initFromUISpecifierString = function(uiSpecifierString) {
var matches = /^(.*)::([^\(]+)\((.*)\)$/.exec(uiSpecifierString);
if (matches == null) {
throw new UISpecifierException('Error in '
+ 'UISpecifier._initFromUISpecifierString(): "'
+ this.string + '" is not a valid UI specifier string');
}
this.pagesetName = matches[1];
this.elementName = matches[2];
this.args = (matches[3]) ? parse_kwargs(matches[3]) : {};
};
/**
* Override the toString() method to return the UI specifier string when
* evaluated in a string context. Combines the UI specifier components into
* a canonical UI specifier string and returns it.
*
* @return a UI specifier string
*/
this.toString = function() {
// empty string is acceptable for the path, but it must be defined
if (this.pagesetName == undefined) {
throw new UISpecifierException('Error in UISpecifier.toString(): "'
+ this.pagesetName + '" is not a valid UI specifier pageset '
+ 'name');
}
if (!this.elementName) {
throw new UISpecifierException('Error in UISpecifier.unparse(): "'
+ this.elementName + '" is not a valid UI specifier element '
+ 'name');
}
if (!this.args) {
throw new UISpecifierException('Error in UISpecifier.unparse(): "'
+ this.args + '" are not valid UI specifier args');
}
uiElement = UIMap.getInstance()
.getUIElement(this.pagesetName, this.elementName);
if (uiElement != null) {
var kwargs = to_kwargs(this.args, uiElement.argsOrder);
}
else {
// probably under unit test
var kwargs = to_kwargs(this.args);
}
return this.pagesetName + '::' + this.elementName + '(' + kwargs + ')';
};
// construct the object
if (arguments.length < 2) {
this._initFromUISpecifierString(uiSpecifierStringOrPagesetName);
}
else {
this.pagesetName = uiSpecifierStringOrPagesetName;
this.elementName = elementName;
this.args = (args) ? clone(args) : {};
}
} | [
"function",
"UISpecifier",
"(",
"uiSpecifierStringOrPagesetName",
",",
"elementName",
",",
"args",
")",
"{",
"/**\n * Initializes this object from a UI specifier string of the form:\n *\n * pagesetName::elementName(arg1=value1, arg2=value2, ...)\n *\n * into its component... | The UISpecifier constructor is overloaded. If less than three arguments are
provided, the first argument will be considered a UI specifier string, and
will be split out accordingly. Otherwise, the first argument will be
considered the path.
@param uiSpecifierStringOrPagesetName a UI specifier string, or the pageset
name of the UI specifier
@param elementName the name of the element
@param args an object associating keys to values
@return new UISpecifier object | [
"The",
"UISpecifier",
"constructor",
"is",
"overloaded",
".",
"If",
"less",
"than",
"three",
"arguments",
"are",
"provided",
"the",
"first",
"argument",
"will",
"be",
"considered",
"a",
"UI",
"specifier",
"string",
"and",
"will",
"be",
"split",
"out",
"accordi... | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/selenium-core/scripts/ui-element.js#L603-L675 | train | A UI specifier object | [
30522,
3853,
21318,
13102,
8586,
18095,
1006,
21318,
13102,
8586,
28295,
18886,
16656,
14536,
13923,
3388,
18442,
1010,
5783,
18442,
1010,
12098,
5620,
1007,
1063,
1013,
1008,
1008,
1008,
3988,
10057,
2023,
4874,
2013,
1037,
21318,
28699,
180... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | _updateTitle | function _updateTitle() {
var currentDoc = DocumentManager.getCurrentDocument(),
windowTitle = brackets.config.app_title,
currentlyViewedFile = MainViewManager.getCurrentlyViewedFile(MainViewManager.ACTIVE_PANE),
currentlyViewedPath = currentlyViewedFile && currentlyViewedFile.fullPath,
readOnlyString = (currentlyViewedFile && currentlyViewedFile.readOnly) ? "[Read Only] - " : "";
if (!brackets.nativeMenus) {
if (currentlyViewedPath) {
_$title.text(_currentTitlePath);
_$title.attr("title", currentlyViewedPath);
if (currentDoc) {
// dirty dot is always in DOM so layout doesn't change, and visibility is toggled
_$dirtydot.css("visibility", (currentDoc.isDirty) ? "visible" : "hidden");
} else {
// hide dirty dot if there is no document
_$dirtydot.css("visibility", "hidden");
}
} else {
_$title.text("");
_$title.attr("title", "");
_$dirtydot.css("visibility", "hidden");
}
// Set _$titleWrapper to a fixed width just large enough to accommodate _$title. This seems equivalent to what
// the browser would do automatically, but the CSS trick we use for layout requires _$titleWrapper to have a
// fixed width set on it (see the "#titlebar" CSS rule for details).
_$titleWrapper.css("width", "");
var newWidth = _$title.width();
_$titleWrapper.css("width", newWidth);
// Changing the width of the title may cause the toolbar layout to change height, which needs to resize the
// editor beneath it (toolbar changing height due to window resize is already caught by EditorManager).
var newToolbarHeight = _$titleContainerToolbar.height();
if (_lastToolbarHeight !== newToolbarHeight) {
_lastToolbarHeight = newToolbarHeight;
WorkspaceManager.recomputeLayout();
}
}
var projectRoot = ProjectManager.getProjectRoot();
if (projectRoot) {
var projectName = projectRoot.name;
// Construct shell/browser window title, e.g. "• index.html (myProject) — Brackets"
if (currentlyViewedPath) {
windowTitle = StringUtils.format(WINDOW_TITLE_STRING_DOC, readOnlyString + _currentTitlePath, projectName, brackets.config.app_title);
// Display dirty dot when there are unsaved changes
if (currentDoc && currentDoc.isDirty) {
windowTitle = "• " + windowTitle;
}
} else {
// A document is not open
windowTitle = StringUtils.format(WINDOW_TITLE_STRING_NO_DOC, projectName, brackets.config.app_title);
}
}
window.document.title = windowTitle;
} | javascript | function _updateTitle() {
var currentDoc = DocumentManager.getCurrentDocument(),
windowTitle = brackets.config.app_title,
currentlyViewedFile = MainViewManager.getCurrentlyViewedFile(MainViewManager.ACTIVE_PANE),
currentlyViewedPath = currentlyViewedFile && currentlyViewedFile.fullPath,
readOnlyString = (currentlyViewedFile && currentlyViewedFile.readOnly) ? "[Read Only] - " : "";
if (!brackets.nativeMenus) {
if (currentlyViewedPath) {
_$title.text(_currentTitlePath);
_$title.attr("title", currentlyViewedPath);
if (currentDoc) {
// dirty dot is always in DOM so layout doesn't change, and visibility is toggled
_$dirtydot.css("visibility", (currentDoc.isDirty) ? "visible" : "hidden");
} else {
// hide dirty dot if there is no document
_$dirtydot.css("visibility", "hidden");
}
} else {
_$title.text("");
_$title.attr("title", "");
_$dirtydot.css("visibility", "hidden");
}
// Set _$titleWrapper to a fixed width just large enough to accommodate _$title. This seems equivalent to what
// the browser would do automatically, but the CSS trick we use for layout requires _$titleWrapper to have a
// fixed width set on it (see the "#titlebar" CSS rule for details).
_$titleWrapper.css("width", "");
var newWidth = _$title.width();
_$titleWrapper.css("width", newWidth);
// Changing the width of the title may cause the toolbar layout to change height, which needs to resize the
// editor beneath it (toolbar changing height due to window resize is already caught by EditorManager).
var newToolbarHeight = _$titleContainerToolbar.height();
if (_lastToolbarHeight !== newToolbarHeight) {
_lastToolbarHeight = newToolbarHeight;
WorkspaceManager.recomputeLayout();
}
}
var projectRoot = ProjectManager.getProjectRoot();
if (projectRoot) {
var projectName = projectRoot.name;
// Construct shell/browser window title, e.g. "• index.html (myProject) — Brackets"
if (currentlyViewedPath) {
windowTitle = StringUtils.format(WINDOW_TITLE_STRING_DOC, readOnlyString + _currentTitlePath, projectName, brackets.config.app_title);
// Display dirty dot when there are unsaved changes
if (currentDoc && currentDoc.isDirty) {
windowTitle = "• " + windowTitle;
}
} else {
// A document is not open
windowTitle = StringUtils.format(WINDOW_TITLE_STRING_NO_DOC, projectName, brackets.config.app_title);
}
}
window.document.title = windowTitle;
} | [
"function",
"_updateTitle",
"(",
")",
"{",
"var",
"currentDoc",
"=",
"DocumentManager",
".",
"getCurrentDocument",
"(",
")",
",",
"windowTitle",
"=",
"brackets",
".",
"config",
".",
"app_title",
",",
"currentlyViewedFile",
"=",
"MainViewManager",
".",
"getCurrentl... | Updates the title bar with new file title or dirty indicator
@private | [
"Updates",
"the",
"title",
"bar",
"with",
"new",
"file",
"title",
"or",
"dirty",
"indicator"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/document/DocumentCommandHandlers.js#L157-L213 | train | Update the title of the toolbar | [
30522,
3853,
1035,
10651,
3775,
9286,
1006,
1007,
1063,
13075,
2783,
3527,
2278,
1027,
6254,
24805,
4590,
1012,
2131,
10841,
14343,
3372,
3527,
24894,
4765,
1006,
1007,
1010,
3332,
3775,
9286,
1027,
19719,
1012,
9530,
8873,
2290,
1012,
1043... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/editor/EditorManager.js | _handleCurrentFileChange | function _handleCurrentFileChange(e, file) {
var doc = file && DocumentManager.getOpenDocumentForPath(file.fullPath);
_notifyActiveEditorChanged(doc && doc._masterEditor);
} | javascript | function _handleCurrentFileChange(e, file) {
var doc = file && DocumentManager.getOpenDocumentForPath(file.fullPath);
_notifyActiveEditorChanged(doc && doc._masterEditor);
} | [
"function",
"_handleCurrentFileChange",
"(",
"e",
",",
"file",
")",
"{",
"var",
"doc",
"=",
"file",
"&&",
"DocumentManager",
".",
"getOpenDocumentForPath",
"(",
"file",
".",
"fullPath",
")",
";",
"_notifyActiveEditorChanged",
"(",
"doc",
"&&",
"doc",
".",
"_ma... | Current File Changed handler
MainViewManager dispatches a "currentFileChange" event whenever the currently viewed
file changes. Which could mean that the previously viewed file has been closed or a
non-editor view (image) has been given focus. _notifyAcitveEditorChanged is also hooked
up to editor.focus to handle focus events for editors which handles changing focus between
two editors but, because editormanager maintains a "_lastFocusedEditor" state, we have to
"nullify" that state whenever the focus goes to a non-editor or when the current editor is closed
@private
@param {!jQuery.Event} e - event
@param {?File} file - current file (can be null) | [
"Current",
"File",
"Changed",
"handler",
"MainViewManager",
"dispatches",
"a",
"currentFileChange",
"event",
"whenever",
"the",
"currently",
"viewed",
"file",
"changes",
".",
"Which",
"could",
"mean",
"that",
"the",
"previously",
"viewed",
"file",
"has",
"been",
"... | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/editor/EditorManager.js#L167-L170 | train | Handle current file change | [
30522,
3853,
1035,
5047,
10841,
14343,
3372,
8873,
2571,
22305,
2063,
1006,
1041,
1010,
5371,
1007,
1063,
13075,
9986,
1027,
5371,
1004,
1004,
6254,
24805,
4590,
1012,
2131,
26915,
3527,
24894,
4765,
29278,
15069,
1006,
5371,
1012,
2440,
15... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/util/graphic.js | getRichItemNames | function getRichItemNames(textStyleModel) {
// Use object to remove duplicated names.
var richItemNameMap;
while (textStyleModel && textStyleModel !== textStyleModel.ecModel) {
var rich = (textStyleModel.option || EMPTY_OBJ).rich;
if (rich) {
richItemNameMap = richItemNameMap || {};
for (var name in rich) {
if (rich.hasOwnProperty(name)) {
richItemNameMap[name] = 1;
}
}
}
textStyleModel = textStyleModel.parentModel;
}
return richItemNameMap;
} | javascript | function getRichItemNames(textStyleModel) {
// Use object to remove duplicated names.
var richItemNameMap;
while (textStyleModel && textStyleModel !== textStyleModel.ecModel) {
var rich = (textStyleModel.option || EMPTY_OBJ).rich;
if (rich) {
richItemNameMap = richItemNameMap || {};
for (var name in rich) {
if (rich.hasOwnProperty(name)) {
richItemNameMap[name] = 1;
}
}
}
textStyleModel = textStyleModel.parentModel;
}
return richItemNameMap;
} | [
"function",
"getRichItemNames",
"(",
"textStyleModel",
")",
"{",
"// Use object to remove duplicated names.",
"var",
"richItemNameMap",
";",
"while",
"(",
"textStyleModel",
"&&",
"textStyleModel",
"!==",
"textStyleModel",
".",
"ecModel",
")",
"{",
"var",
"rich",
"=",
... | Consider case: { data: [{ value: 12, label: { rich: { // no 'a' here but using parent 'a'. } } }], rich: { a: { ... } } } | [
"Consider",
"case",
":",
"{",
"data",
":",
"[",
"{",
"value",
":",
"12",
"label",
":",
"{",
"rich",
":",
"{",
"//",
"no",
"a",
"here",
"but",
"using",
"parent",
"a",
".",
"}",
"}",
"}",
"]",
"rich",
":",
"{",
"a",
":",
"{",
"...",
"}",
"}",... | 4d0ea095dc3929cb6de40c45748826e7999c7aa8 | https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/util/graphic.js#L814-L830 | train | Get rich item names | [
30522,
3853,
2131,
13149,
4221,
2213,
18442,
2015,
1006,
6981,
27983,
5302,
9247,
1007,
1063,
1013,
1013,
2224,
4874,
2000,
6366,
24473,
2094,
3415,
1012,
13075,
4138,
4221,
2213,
18442,
2863,
2361,
1025,
2096,
1006,
6981,
27983,
5302,
9247... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/preferences/PreferencesManager.js | setViewState | function setViewState(id, value, context, doNotSave) {
PreferencesImpl.stateManager.set(id, value, context);
if (!doNotSave) {
PreferencesImpl.stateManager.save();
}
} | javascript | function setViewState(id, value, context, doNotSave) {
PreferencesImpl.stateManager.set(id, value, context);
if (!doNotSave) {
PreferencesImpl.stateManager.save();
}
} | [
"function",
"setViewState",
"(",
"id",
",",
"value",
",",
"context",
",",
"doNotSave",
")",
"{",
"PreferencesImpl",
".",
"stateManager",
".",
"set",
"(",
"id",
",",
"value",
",",
"context",
")",
";",
"if",
"(",
"!",
"doNotSave",
")",
"{",
"PreferencesImp... | Convenience function that sets a view state and then saves the file
@param {string} id preference to set
@param {*} value new value for the preference
@param {?Object} context Optional additional information about the request
@param {boolean=} doNotSave If it is undefined or false, then save the
view state immediately. | [
"Convenience",
"function",
"that",
"sets",
"a",
"view",
"state",
"and",
"then",
"saves",
"the",
"file"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/preferences/PreferencesManager.js#L307-L314 | train | Set the state of a view | [
30522,
3853,
2275,
8584,
9153,
2618,
1006,
8909,
1010,
3643,
1010,
6123,
1010,
2123,
12868,
10696,
1007,
1063,
18394,
5714,
24759,
1012,
2110,
24805,
4590,
1012,
2275,
1006,
8909,
1010,
3643,
1010,
6123,
1007,
1025,
2065,
1006,
999,
2123,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.dt/src/sap/ui/dt/ContextMenuControl.js | function () {
if (this._bOpenAsContextMenu && this._oContextMenuPosition.x === null && this._oContextMenuPosition.y === null) {
this._bOpenAsContextMenu = false;
}
// fires the open event after popover is opened
this.getPopover().attachAfterOpen(this._handleAfterOpen, this);
this.getPopover().attachBeforeClose(this._handleBeforeClose, this);
//place the Popover and get the target DIV
this._oTarget = this._placeContextMenu(this._oTarget, this._bOpenAsContextMenu);
// set the PopOver visible
this.getPopover().setVisible(true);
this.bOpen = true;
this.bOpenNew = false;
} | javascript | function () {
if (this._bOpenAsContextMenu && this._oContextMenuPosition.x === null && this._oContextMenuPosition.y === null) {
this._bOpenAsContextMenu = false;
}
// fires the open event after popover is opened
this.getPopover().attachAfterOpen(this._handleAfterOpen, this);
this.getPopover().attachBeforeClose(this._handleBeforeClose, this);
//place the Popover and get the target DIV
this._oTarget = this._placeContextMenu(this._oTarget, this._bOpenAsContextMenu);
// set the PopOver visible
this.getPopover().setVisible(true);
this.bOpen = true;
this.bOpenNew = false;
} | [
"function",
"(",
")",
"{",
"if",
"(",
"this",
".",
"_bOpenAsContextMenu",
"&&",
"this",
".",
"_oContextMenuPosition",
".",
"x",
"===",
"null",
"&&",
"this",
".",
"_oContextMenuPosition",
".",
"y",
"===",
"null",
")",
"{",
"this",
".",
"_bOpenAsContextMenu",
... | Finalizes the Opening of the ContextMenu. Is called by "_popupClosed" (when the old Menu is closed) or by "show" if there was no ContextMenu opened before
Is needed to prevent flickering (wait for old ContextMenu to close) | [
"Finalizes",
"the",
"Opening",
"of",
"the",
"ContextMenu",
".",
"Is",
"called",
"by",
"_popupClosed",
"(",
"when",
"the",
"old",
"Menu",
"is",
"closed",
")",
"or",
"by",
"show",
"if",
"there",
"was",
"no",
"ContextMenu",
"opened",
"before",
"Is",
"needed",... | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.dt/src/sap/ui/dt/ContextMenuControl.js#L192-L209 | train | Opens the context menu | [
30522,
3853,
1006,
1007,
1063,
2065,
1006,
2023,
1012,
1035,
29432,
26474,
8663,
18209,
3549,
2226,
1004,
1004,
2023,
1012,
1035,
1051,
8663,
18209,
3549,
6279,
19234,
1012,
1060,
1027,
1027,
1027,
19701,
1004,
1004,
2023,
1012,
1035,
1051,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
eslint/eslint | lib/rules/no-else-return.js | alwaysReturns | function alwaysReturns(node) {
if (node.type === "BlockStatement") {
// If we have a BlockStatement, check each consequent body node.
return node.body.some(checkForReturnOrIf);
}
/*
* If not a block statement, make sure the consequent isn't a
* ReturnStatement or an IfStatement with returns on both paths.
*/
return checkForReturnOrIf(node);
} | javascript | function alwaysReturns(node) {
if (node.type === "BlockStatement") {
// If we have a BlockStatement, check each consequent body node.
return node.body.some(checkForReturnOrIf);
}
/*
* If not a block statement, make sure the consequent isn't a
* ReturnStatement or an IfStatement with returns on both paths.
*/
return checkForReturnOrIf(node);
} | [
"function",
"alwaysReturns",
"(",
"node",
")",
"{",
"if",
"(",
"node",
".",
"type",
"===",
"\"BlockStatement\"",
")",
"{",
"// If we have a BlockStatement, check each consequent body node.",
"return",
"node",
".",
"body",
".",
"some",
"(",
"checkForReturnOrIf",
")",
... | Check whether a node returns in every codepath.
@param {Node} node The node to be checked
@returns {boolean} `true` if it returns on every codepath. | [
"Check",
"whether",
"a",
"node",
"returns",
"in",
"every",
"codepath",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/no-else-return.js#L199-L211 | train | Check if a node is always returns | [
30522,
3853,
2467,
13465,
14287,
2015,
1006,
13045,
1007,
1063,
2065,
1006,
13045,
1012,
2828,
1027,
1027,
1027,
1000,
5991,
12259,
3672,
1000,
1007,
1063,
1013,
1013,
2065,
2057,
2031,
1037,
5991,
12259,
3672,
1010,
4638,
2169,
9530,
3366,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/LiveDevelopment/Agents/ScriptAgent.js | _onPaused | function _onPaused(event, res) {
// res = {callFrames, reason, data}
switch (res.reason) {
// Exception
case "exception":
Inspector.Debugger.resume();
// var callFrame = res.callFrames[0];
// var script = scriptWithId(callFrame.location.scriptId);
break;
// DOMBreakpoint
case "DOM":
Inspector.Debugger.resume();
if (res.data.type === "subtree-modified" && res.data.insertion === true) {
_insertTrace = res.callFrames;
}
break;
}
} | javascript | function _onPaused(event, res) {
// res = {callFrames, reason, data}
switch (res.reason) {
// Exception
case "exception":
Inspector.Debugger.resume();
// var callFrame = res.callFrames[0];
// var script = scriptWithId(callFrame.location.scriptId);
break;
// DOMBreakpoint
case "DOM":
Inspector.Debugger.resume();
if (res.data.type === "subtree-modified" && res.data.insertion === true) {
_insertTrace = res.callFrames;
}
break;
}
} | [
"function",
"_onPaused",
"(",
"event",
",",
"res",
")",
"{",
"// res = {callFrames, reason, data}",
"switch",
"(",
"res",
".",
"reason",
")",
"{",
"// Exception",
"case",
"\"exception\"",
":",
"Inspector",
".",
"Debugger",
".",
"resume",
"(",
")",
";",
"// var... | WebInspector Event: Debugger.paused | [
"WebInspector",
"Event",
":",
"Debugger",
".",
"paused"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/LiveDevelopment/Agents/ScriptAgent.js#L85-L105 | train | onPaused event handler | [
30522,
3853,
1035,
2006,
4502,
13901,
1006,
2724,
1010,
24501,
1007,
1063,
1013,
1013,
24501,
1027,
1063,
2655,
15643,
2015,
1010,
3114,
1010,
2951,
1065,
6942,
1006,
24501,
1012,
3114,
1007,
1063,
1013,
1013,
6453,
2553,
1000,
6453,
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... |
aws/aws-sdk-js | lib/signers/v4_credentials.js | createScope | function createScope(date, region, serviceName) {
return [
date.substr(0, 8),
region,
serviceName,
v4Identifier
].join('/');
} | javascript | function createScope(date, region, serviceName) {
return [
date.substr(0, 8),
region,
serviceName,
v4Identifier
].join('/');
} | [
"function",
"createScope",
"(",
"date",
",",
"region",
",",
"serviceName",
")",
"{",
"return",
"[",
"date",
".",
"substr",
"(",
"0",
",",
"8",
")",
",",
"region",
",",
"serviceName",
",",
"v4Identifier",
"]",
".",
"join",
"(",
"'/'",
")",
";",
"}"
] | @api private
@param date [String]
@param region [String]
@param serviceName [String]
@return [String] | [
"@api",
"private"
] | c23e5f0edd150f8885267e5f7c8a564f8e6e8562 | https://github.com/aws/aws-sdk-js/blob/c23e5f0edd150f8885267e5f7c8a564f8e6e8562/lib/signers/v4_credentials.js#L35-L42 | train | Creates a scope for a given date region and serviceName | [
30522,
3853,
9005,
16186,
1006,
3058,
1010,
2555,
1010,
2326,
18442,
1007,
1063,
2709,
1031,
3058,
1012,
4942,
3367,
2099,
1006,
1014,
1010,
1022,
1007,
1010,
2555,
1010,
2326,
18442,
1010,
1058,
2549,
5178,
16778,
8873,
2121,
1033,
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... |
Dogfalo/materialize | dist/js/materialize.js | showEffect | function showEffect(e) {
var element = getWavesEffectElement(e);
if (element !== null) {
Effect.show(e, element);
if ('ontouchstart' in window) {
element.addEventListener('touchend', Effect.hide, false);
element.addEventListener('touchcancel', Effect.hide, false);
}
element.addEventListener('mouseup', Effect.hide, false);
element.addEventListener('mouseleave', Effect.hide, false);
element.addEventListener('dragend', Effect.hide, false);
}
} | javascript | function showEffect(e) {
var element = getWavesEffectElement(e);
if (element !== null) {
Effect.show(e, element);
if ('ontouchstart' in window) {
element.addEventListener('touchend', Effect.hide, false);
element.addEventListener('touchcancel', Effect.hide, false);
}
element.addEventListener('mouseup', Effect.hide, false);
element.addEventListener('mouseleave', Effect.hide, false);
element.addEventListener('dragend', Effect.hide, false);
}
} | [
"function",
"showEffect",
"(",
"e",
")",
"{",
"var",
"element",
"=",
"getWavesEffectElement",
"(",
"e",
")",
";",
"if",
"(",
"element",
"!==",
"null",
")",
"{",
"Effect",
".",
"show",
"(",
"e",
",",
"element",
")",
";",
"if",
"(",
"'ontouchstart'",
"... | Bubble the click and show effect if .waves-effect elem was found | [
"Bubble",
"the",
"click",
"and",
"show",
"effect",
"if",
".",
"waves",
"-",
"effect",
"elem",
"was",
"found"
] | 1122efadad8f1433d404696f7613e3cc13fb83a4 | https://github.com/Dogfalo/materialize/blob/1122efadad8f1433d404696f7613e3cc13fb83a4/dist/js/materialize.js#L5046-L5061 | train | show Effect | [
30522,
3853,
2265,
12879,
25969,
1006,
1041,
1007,
1063,
13075,
5783,
1027,
2131,
16535,
20106,
25969,
12260,
3672,
1006,
1041,
1007,
1025,
2065,
1006,
5783,
999,
1027,
1027,
19701,
1007,
1063,
3466,
1012,
2265,
1006,
1041,
1010,
5783,
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... |
aframevr/aframe | src/components/scene/inspector.js | function (evt) {
var shortcutPressed = evt.keyCode === 73 && evt.ctrlKey && evt.altKey;
if (!shortcutPressed) { return; }
this.openInspector();
} | javascript | function (evt) {
var shortcutPressed = evt.keyCode === 73 && evt.ctrlKey && evt.altKey;
if (!shortcutPressed) { return; }
this.openInspector();
} | [
"function",
"(",
"evt",
")",
"{",
"var",
"shortcutPressed",
"=",
"evt",
".",
"keyCode",
"===",
"73",
"&&",
"evt",
".",
"ctrlKey",
"&&",
"evt",
".",
"altKey",
";",
"if",
"(",
"!",
"shortcutPressed",
")",
"{",
"return",
";",
"}",
"this",
".",
"openInsp... | <ctrl> + <alt> + i keyboard shortcut. | [
"<ctrl",
">",
"+",
"<alt",
">",
"+",
"i",
"keyboard",
"shortcut",
"."
] | 24acc78a7299a4cdfe3ef617f4d40ddf6275c992 | https://github.com/aframevr/aframe/blob/24acc78a7299a4cdfe3ef617f4d40ddf6275c992/src/components/scene/inspector.js#L61-L65 | train | The event handler for the keyboard keypress event. | [
30522,
3853,
1006,
23408,
2102,
1007,
1063,
13075,
2460,
12690,
19811,
1027,
23408,
2102,
1012,
3145,
16044,
1027,
1027,
1027,
6421,
1004,
1004,
23408,
2102,
1012,
14931,
12190,
14839,
1004,
1004,
23408,
2102,
1012,
12456,
14839,
1025,
2065,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.