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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
adobe/brackets | src/preferences/PreferencesBase.js | function (id, type, initial, options) {
return this.base.definePreference(this.prefix + id, type, initial, options);
} | javascript | function (id, type, initial, options) {
return this.base.definePreference(this.prefix + id, type, initial, options);
} | [
"function",
"(",
"id",
",",
"type",
",",
"initial",
",",
"options",
")",
"{",
"return",
"this",
".",
"base",
".",
"definePreference",
"(",
"this",
".",
"prefix",
"+",
"id",
",",
"type",
",",
"initial",
",",
"options",
")",
";",
"}"
] | Defines a new (prefixed) preference.
@param {string} id unprefixed identifier of the preference. Generally a dotted name.
@param {string} type Data type for the preference (generally, string, boolean, number)
@param {Object} initial Default value for the preference
@param {?{name: string=, description: string=, validator: function=, excludeFromHints: boolean=, keys: object=, values: array=, valueType: string=}} options
Additional options for the pref.
- `options.name` Name of the preference that can be used in the UI.
- `options.description` A description of the preference.
- `options.validator` A function to validate the value of a preference.
- `options.excludeFromHints` True if you want to exclude a preference from code hints.
- `options.keys` An object that will hold the child preferences in case the preference type is `object`
- `options.values` An array of possible values of a preference. It will show up in code hints.
- `options.valueType` In case the preference type is `array`, `valueType` should hold data type of its elements.
@return {Object} The preference object. | [
"Defines",
"a",
"new",
"(",
"prefixed",
")",
"preference",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/preferences/PreferencesBase.js#L1080-L1082 | train | define preference for the user | [
30522,
3853,
1006,
8909,
1010,
2828,
1010,
3988,
1010,
7047,
1007,
1063,
2709,
2023,
1012,
2918,
1012,
9375,
28139,
25523,
1006,
2023,
1012,
17576,
1009,
8909,
1010,
2828,
1010,
3988,
1010,
7047,
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,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
facebook/relay | packages/relay-compiler/language/javascript/RelayFlowBabelFactories.js | readOnlyObjectTypeProperty | function readOnlyObjectTypeProperty(key: string, value: BabelAST) {
const prop = t.objectTypeProperty(t.identifier(key), value);
prop.variance = t.variance('plus');
return prop;
} | javascript | function readOnlyObjectTypeProperty(key: string, value: BabelAST) {
const prop = t.objectTypeProperty(t.identifier(key), value);
prop.variance = t.variance('plus');
return prop;
} | [
"function",
"readOnlyObjectTypeProperty",
"(",
"key",
":",
"string",
",",
"value",
":",
"BabelAST",
")",
"{",
"const",
"prop",
"=",
"t",
".",
"objectTypeProperty",
"(",
"t",
".",
"identifier",
"(",
"key",
")",
",",
"value",
")",
";",
"prop",
".",
"varian... | +KEY: VALUE | [
"+",
"KEY",
":",
"VALUE"
] | 7fb9be5182b9650637d7b92ead9a42713ac30aa4 | https://github.com/facebook/relay/blob/7fb9be5182b9650637d7b92ead9a42713ac30aa4/packages/relay-compiler/language/javascript/RelayFlowBabelFactories.js#L94-L98 | train | Returns a property that is read only if the value is not a number | [
30522,
3853,
3191,
2239,
2135,
16429,
20614,
13874,
21572,
4842,
3723,
1006,
3145,
1024,
5164,
1010,
3643,
1024,
11561,
8523,
2102,
1007,
1063,
9530,
3367,
17678,
1027,
1056,
1012,
4874,
13874,
21572,
4842,
3723,
1006,
1056,
1012,
8909,
476... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
moleculerjs/moleculer | src/middlewares/metrics.js | shouldMetric | function shouldMetric(ctx) {
if (ctx.broker.options.metrics) {
sampleCounter++;
if (sampleCounter * ctx.broker.options.metricsRate >= 1.0) {
sampleCounter = 0;
return true;
}
}
return false;
} | javascript | function shouldMetric(ctx) {
if (ctx.broker.options.metrics) {
sampleCounter++;
if (sampleCounter * ctx.broker.options.metricsRate >= 1.0) {
sampleCounter = 0;
return true;
}
}
return false;
} | [
"function",
"shouldMetric",
"(",
"ctx",
")",
"{",
"if",
"(",
"ctx",
".",
"broker",
".",
"options",
".",
"metrics",
")",
"{",
"sampleCounter",
"++",
";",
"if",
"(",
"sampleCounter",
"*",
"ctx",
".",
"broker",
".",
"options",
".",
"metricsRate",
">=",
"1... | Check should metric the current context
@param {Context} ctx
@returns {Boolean}
@memberof ServiceBroker | [
"Check",
"should",
"metric",
"the",
"current",
"context"
] | f95aadc2d61b0d0e3c643a43c3ed28bca6425cde | https://github.com/moleculerjs/moleculer/blob/f95aadc2d61b0d0e3c643a43c3ed28bca6425cde/src/middlewares/metrics.js#L21-L31 | train | Returns true if the metric should be applied | [
30522,
3853,
2323,
12589,
1006,
14931,
2595,
1007,
1063,
2065,
1006,
14931,
2595,
1012,
20138,
1012,
7047,
1012,
12046,
2015,
1007,
1063,
7099,
3597,
16671,
2121,
1009,
1009,
1025,
2065,
1006,
7099,
3597,
16671,
2121,
1008,
14931,
2595,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/base/ManagedObject.js | updateRecursive | function updateRecursive(oControl, oContexts) {
update(oControl, oContexts, null, function(oContext, oClone) {
updateRecursive(oClone, oBinding.getNodeContexts(oContext));
});
} | javascript | function updateRecursive(oControl, oContexts) {
update(oControl, oContexts, null, function(oContext, oClone) {
updateRecursive(oClone, oBinding.getNodeContexts(oContext));
});
} | [
"function",
"updateRecursive",
"(",
"oControl",
",",
"oContexts",
")",
"{",
"update",
"(",
"oControl",
",",
"oContexts",
",",
"null",
",",
"function",
"(",
"oContext",
",",
"oClone",
")",
"{",
"updateRecursive",
"(",
"oClone",
",",
"oBinding",
".",
"getNodeC... | Update the tree recursively | [
"Update",
"the",
"tree",
"recursively"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/base/ManagedObject.js#L4056-L4060 | train | Updates the context tree recursively. | [
30522,
3853,
10651,
2890,
10841,
2869,
3512,
1006,
1051,
8663,
13181,
2140,
1010,
1051,
8663,
18209,
2015,
1007,
1063,
10651,
1006,
1051,
8663,
13181,
2140,
1010,
1051,
8663,
18209,
2015,
1010,
19701,
1010,
3853,
1006,
1051,
8663,
18209,
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... |
websockets/ws | lib/websocket.js | receiverOnConclude | function receiverOnConclude(code, reason) {
const websocket = this[kWebSocket];
websocket._socket.removeListener('data', socketOnData);
websocket._socket.resume();
websocket._closeFrameReceived = true;
websocket._closeMessage = reason;
websocket._closeCode = code;
if (code === 1005) websocket.close();
else websocket.close(code, reason);
} | javascript | function receiverOnConclude(code, reason) {
const websocket = this[kWebSocket];
websocket._socket.removeListener('data', socketOnData);
websocket._socket.resume();
websocket._closeFrameReceived = true;
websocket._closeMessage = reason;
websocket._closeCode = code;
if (code === 1005) websocket.close();
else websocket.close(code, reason);
} | [
"function",
"receiverOnConclude",
"(",
"code",
",",
"reason",
")",
"{",
"const",
"websocket",
"=",
"this",
"[",
"kWebSocket",
"]",
";",
"websocket",
".",
"_socket",
".",
"removeListener",
"(",
"'data'",
",",
"socketOnData",
")",
";",
"websocket",
".",
"_sock... | The listener of the `Receiver` `'conclude'` event.
@param {Number} code The status code
@param {String} reason The reason for closing
@private | [
"The",
"listener",
"of",
"the",
"Receiver",
"conclude",
"event",
"."
] | 995c527c87d0d4833d8093c18dcfa2e4a41d9582 | https://github.com/websockets/ws/blob/995c527c87d0d4833d8093c18dcfa2e4a41d9582/lib/websocket.js#L740-L752 | train | receiverOnConclude - Close the connection | [
30522,
3853,
8393,
2239,
8663,
20464,
12672,
1006,
3642,
1010,
3114,
1007,
1063,
9530,
3367,
4773,
6499,
19869,
2102,
1027,
2023,
1031,
6448,
15878,
6499,
19869,
2102,
1033,
1025,
4773,
6499,
19869,
2102,
1012,
1035,
22278,
1012,
6366,
9863... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | lib/jsdoc/ui5/plugin.js | function (e) {
currentProgram = undefined;
currentModule = {
name: null,
resource: getResourceName(e.filename),
module: getModuleName(getResourceName(e.filename)),
localNames: Object.create(null)
};
} | javascript | function (e) {
currentProgram = undefined;
currentModule = {
name: null,
resource: getResourceName(e.filename),
module: getModuleName(getResourceName(e.filename)),
localNames: Object.create(null)
};
} | [
"function",
"(",
"e",
")",
"{",
"currentProgram",
"=",
"undefined",
";",
"currentModule",
"=",
"{",
"name",
":",
"null",
",",
"resource",
":",
"getResourceName",
"(",
"e",
".",
"filename",
")",
",",
"module",
":",
"getModuleName",
"(",
"getResourceName",
"... | Log each file before it is parsed
@param {object} e Event info object | [
"Log",
"each",
"file",
"before",
"it",
"is",
"parsed"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/lib/jsdoc/ui5/plugin.js#L2106-L2114 | train | This function is called when a module is loaded | [
30522,
3853,
1006,
1041,
1007,
1063,
2783,
21572,
13113,
1027,
6151,
28344,
1025,
2783,
5302,
8566,
2571,
1027,
1063,
2171,
1024,
19701,
1010,
7692,
1024,
2131,
6072,
8162,
27524,
14074,
1006,
1041,
1012,
5371,
18442,
1007,
1010,
11336,
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... | |
adobe/brackets | src/extensions/default/InlineTimingFunctionEditor/TimingFunctionUtils.js | _getValidStepsParams | function _getValidStepsParams(match) {
var param,
def = [ "5", "end" ],
params = def,
oldIndex = match.index, // we need to store the old match.index to re-set the index afterwards
originalString = match[0];
if (match) {
match = match[1].split(",");
}
if (match) {
if (match[0]) {
param = match[0].replace(/[\s\"']/g, ""); // replace possible trailing whitespace or leading quotes
param = _convertToNumber(param);
// Verify number_of_params is a number
// If not, replace it with the default value
if (!param.isNumber) {
param.value = def[0];
// Round number_of_params to an integer
} else if (param.value) {
param.value = Math.floor(param.value);
}
// Verify number_of_steps is >= 1
// If not, set them to the default value
if (param.value < 1) {
param.value = def[0];
}
params[0] = param.value;
}
if (match[1]) {
// little autocorrect feature: leading s gets 'start', everything else gets 'end'
param = match[1].replace(/[\s\"']/g, ""); // replace possible trailing whitespace or leading quotes
param = param.substr(0, 1);
if (param === "s") {
params[1] = "start";
} else {
params[1] = "end";
}
}
}
params = "steps(" + params.join(", ") + ")";
params = params.match(STEPS_VALID_REGEX);
if (params) {
params.index = oldIndex; // re-set the index here to get the right context
params.originalString = originalString;
return params;
}
return null;
} | javascript | function _getValidStepsParams(match) {
var param,
def = [ "5", "end" ],
params = def,
oldIndex = match.index, // we need to store the old match.index to re-set the index afterwards
originalString = match[0];
if (match) {
match = match[1].split(",");
}
if (match) {
if (match[0]) {
param = match[0].replace(/[\s\"']/g, ""); // replace possible trailing whitespace or leading quotes
param = _convertToNumber(param);
// Verify number_of_params is a number
// If not, replace it with the default value
if (!param.isNumber) {
param.value = def[0];
// Round number_of_params to an integer
} else if (param.value) {
param.value = Math.floor(param.value);
}
// Verify number_of_steps is >= 1
// If not, set them to the default value
if (param.value < 1) {
param.value = def[0];
}
params[0] = param.value;
}
if (match[1]) {
// little autocorrect feature: leading s gets 'start', everything else gets 'end'
param = match[1].replace(/[\s\"']/g, ""); // replace possible trailing whitespace or leading quotes
param = param.substr(0, 1);
if (param === "s") {
params[1] = "start";
} else {
params[1] = "end";
}
}
}
params = "steps(" + params.join(", ") + ")";
params = params.match(STEPS_VALID_REGEX);
if (params) {
params.index = oldIndex; // re-set the index here to get the right context
params.originalString = originalString;
return params;
}
return null;
} | [
"function",
"_getValidStepsParams",
"(",
"match",
")",
"{",
"var",
"param",
",",
"def",
"=",
"[",
"\"5\"",
",",
"\"end\"",
"]",
",",
"params",
"=",
"def",
",",
"oldIndex",
"=",
"match",
".",
"index",
",",
"// we need to store the old match.index to re-set the in... | Get valid params for an invalid steps function.
@param {RegExp.match} match (Invalid) matches from stepsMatch()
@return {?RegExp.match} Valid match or null if the output is not valid | [
"Get",
"valid",
"params",
"for",
"an",
"invalid",
"steps",
"function",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/InlineTimingFunctionEditor/TimingFunctionUtils.js#L170-L223 | train | Get valid steps parameters | [
30522,
3853,
1035,
2131,
10175,
9821,
2618,
4523,
28689,
5244,
1006,
2674,
1007,
1063,
13075,
11498,
2213,
1010,
13366,
1027,
1031,
1000,
1019,
1000,
1010,
1000,
2203,
1000,
1033,
1010,
11498,
5244,
1027,
13366,
1010,
2214,
22254,
10288,
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... |
aframevr/aframe | src/components/look-controls.js | function () {
var el = this.el;
var savedPose = this.savedPose;
if (!this.hasSavedPose) { return; }
// Reset camera orientation.
el.object3D.position.copy(savedPose.position);
el.object3D.rotation.copy(savedPose.rotation);
this.hasSavedPose = false;
} | javascript | function () {
var el = this.el;
var savedPose = this.savedPose;
if (!this.hasSavedPose) { return; }
// Reset camera orientation.
el.object3D.position.copy(savedPose.position);
el.object3D.rotation.copy(savedPose.rotation);
this.hasSavedPose = false;
} | [
"function",
"(",
")",
"{",
"var",
"el",
"=",
"this",
".",
"el",
";",
"var",
"savedPose",
"=",
"this",
".",
"savedPose",
";",
"if",
"(",
"!",
"this",
".",
"hasSavedPose",
")",
"{",
"return",
";",
"}",
"// Reset camera orientation.",
"el",
".",
"object3D... | Reset camera pose to before entering VR. | [
"Reset",
"camera",
"pose",
"to",
"before",
"entering",
"VR",
"."
] | 24acc78a7299a4cdfe3ef617f4d40ddf6275c992 | https://github.com/aframevr/aframe/blob/24acc78a7299a4cdfe3ef617f4d40ddf6275c992/src/components/look-controls.js#L420-L430 | train | Reset camera orientation | [
30522,
3853,
1006,
1007,
1063,
13075,
3449,
1027,
2023,
1012,
3449,
1025,
13075,
5552,
20688,
1027,
2023,
1012,
5552,
20688,
1025,
2065,
1006,
999,
2023,
1012,
2038,
3736,
7178,
20688,
1007,
1063,
2709,
1025,
1065,
1013,
1013,
25141,
4950,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
jgraph/mxgraph | javascript/mxClient.js | function(lan)
{
if (mxClient.languages != null)
{
return mxUtils.indexOf(mxClient.languages, lan) >= 0;
}
return true;
} | javascript | function(lan)
{
if (mxClient.languages != null)
{
return mxUtils.indexOf(mxClient.languages, lan) >= 0;
}
return true;
} | [
"function",
"(",
"lan",
")",
"{",
"if",
"(",
"mxClient",
".",
"languages",
"!=",
"null",
")",
"{",
"return",
"mxUtils",
".",
"indexOf",
"(",
"mxClient",
".",
"languages",
",",
"lan",
")",
">=",
"0",
";",
"}",
"return",
"true",
";",
"}"
] | Function: isLanguageSupported
Hook for subclassers to disable support for a given language. This
implementation returns true if lan is in <mxClient.languages>.
Parameters:
lan - The current language. | [
"Function",
":",
"isLanguageSupported"
] | 33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44 | https://github.com/jgraph/mxgraph/blob/33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44/javascript/mxClient.js#L1347-L1355 | train | Returns true if the language is a valid language | [
30522,
3853,
1006,
17595,
1007,
1063,
2065,
1006,
25630,
20464,
11638,
1012,
4155,
999,
1027,
19701,
1007,
1063,
2709,
25630,
21823,
4877,
1012,
5950,
11253,
1006,
25630,
20464,
11638,
1012,
4155,
1010,
17595,
1007,
1028,
1027,
1014,
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... | |
aws-amplify/amplify-js | packages/amazon-cognito-identity-js/src/BigInteger.js | bnCompareTo | function bnCompareTo(a) {
var r = this.s - a.s;
if (r != 0) return r;
var i = this.t;
r = i - a.t;
if (r != 0) return this.s < 0 ? -r : r;
while (--i >= 0)
if ((r = this[i] - a[i]) != 0) return r;
return 0;
} | javascript | function bnCompareTo(a) {
var r = this.s - a.s;
if (r != 0) return r;
var i = this.t;
r = i - a.t;
if (r != 0) return this.s < 0 ? -r : r;
while (--i >= 0)
if ((r = this[i] - a[i]) != 0) return r;
return 0;
} | [
"function",
"bnCompareTo",
"(",
"a",
")",
"{",
"var",
"r",
"=",
"this",
".",
"s",
"-",
"a",
".",
"s",
";",
"if",
"(",
"r",
"!=",
"0",
")",
"return",
"r",
";",
"var",
"i",
"=",
"this",
".",
"t",
";",
"r",
"=",
"i",
"-",
"a",
".",
"t",
";... | (public) return + if this > a, - if this < a, 0 if equal | [
"(",
"public",
")",
"return",
"+",
"if",
"this",
">",
"a",
"-",
"if",
"this",
"<",
"a",
"0",
"if",
"equal"
] | db55ff3dff31c64a246180f39eb0a04a89fd16e1 | https://github.com/aws-amplify/amplify-js/blob/db55ff3dff31c64a246180f39eb0a04a89fd16e1/packages/amazon-cognito-identity-js/src/BigInteger.js#L272-L281 | train | Compare two numbers | [
30522,
3853,
24869,
9006,
19362,
18903,
1006,
1037,
1007,
1063,
13075,
1054,
1027,
2023,
1012,
1055,
1011,
1037,
1012,
1055,
1025,
2065,
1006,
1054,
999,
1027,
1014,
1007,
2709,
1054,
1025,
13075,
1045,
1027,
2023,
1012,
1056,
1025,
1054,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/waterfall.js | waterfall | function waterfall (tasks, callback) {
callback = once(callback);
if (!Array.isArray(tasks)) return callback(new Error('First argument to waterfall must be an array of functions'));
if (!tasks.length) return callback();
var taskIndex = 0;
function nextTask(args) {
var task = wrapAsync(tasks[taskIndex++]);
task(...args, onlyOnce(next));
}
function next(err, ...args) {
if (err === false) return
if (err || taskIndex === tasks.length) {
return callback(err, ...args);
}
nextTask(args);
}
nextTask([]);
} | javascript | function waterfall (tasks, callback) {
callback = once(callback);
if (!Array.isArray(tasks)) return callback(new Error('First argument to waterfall must be an array of functions'));
if (!tasks.length) return callback();
var taskIndex = 0;
function nextTask(args) {
var task = wrapAsync(tasks[taskIndex++]);
task(...args, onlyOnce(next));
}
function next(err, ...args) {
if (err === false) return
if (err || taskIndex === tasks.length) {
return callback(err, ...args);
}
nextTask(args);
}
nextTask([]);
} | [
"function",
"waterfall",
"(",
"tasks",
",",
"callback",
")",
"{",
"callback",
"=",
"once",
"(",
"callback",
")",
";",
"if",
"(",
"!",
"Array",
".",
"isArray",
"(",
"tasks",
")",
")",
"return",
"callback",
"(",
"new",
"Error",
"(",
"'First argument to wat... | Runs the `tasks` array of functions in series, each passing their results to
the next in the array. However, if any of the `tasks` pass an error to their
own callback, the next function is not executed, and the main `callback` is
immediately called with the error.
@name waterfall
@static
@memberOf module:ControlFlow
@method
@category Control Flow
@param {Array} tasks - An array of [async functions]{@link AsyncFunction}
to run.
Each function should complete with any number of `result` values.
The `result` values will be passed as arguments, in order, to the next task.
@param {Function} [callback] - An optional callback to run once all the
functions have completed. This will be passed the results of the last task's
callback. Invoked with (err, [results]).
@returns undefined
@example
async.waterfall([
function(callback) {
callback(null, 'one', 'two');
},
function(arg1, arg2, callback) {
// arg1 now equals 'one' and arg2 now equals 'two'
callback(null, 'three');
},
function(arg1, callback) {
// arg1 now equals 'three'
callback(null, 'done');
}
], function (err, result) {
// result now equals 'done'
});
// Or, with named functions:
async.waterfall([
myFirstFunction,
mySecondFunction,
myLastFunction,
], function (err, result) {
// result now equals 'done'
});
function myFirstFunction(callback) {
callback(null, 'one', 'two');
}
function mySecondFunction(arg1, arg2, callback) {
// arg1 now equals 'one' and arg2 now equals 'two'
callback(null, 'three');
}
function myLastFunction(arg1, callback) {
// arg1 now equals 'three'
callback(null, 'done');
} | [
"Runs",
"the",
"tasks",
"array",
"of",
"functions",
"in",
"series",
"each",
"passing",
"their",
"results",
"to",
"the",
"next",
"in",
"the",
"array",
".",
"However",
"if",
"any",
"of",
"the",
"tasks",
"pass",
"an",
"error",
"to",
"their",
"own",
"callbac... | 4330d536c106592139fa82062494c9dba0da1fdb | https://github.com/caolan/async/blob/4330d536c106592139fa82062494c9dba0da1fdb/lib/waterfall.js#L64-L84 | train | A function that runs a series of functions in parallel. | [
30522,
3853,
14297,
1006,
8518,
1010,
2655,
5963,
1007,
1063,
2655,
5963,
1027,
2320,
1006,
2655,
5963,
1007,
1025,
2065,
1006,
999,
9140,
1012,
18061,
11335,
2100,
1006,
8518,
1007,
1007,
2709,
2655,
5963,
1006,
2047,
7561,
1006,
1005,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
openlayers/openlayers | examples/color-manipulation.js | rgb2hcl | function rgb2hcl(pixel) {
const red = rgb2xyz(pixel[0]);
const green = rgb2xyz(pixel[1]);
const blue = rgb2xyz(pixel[2]);
const x = xyz2lab(
(0.4124564 * red + 0.3575761 * green + 0.1804375 * blue) / Xn);
const y = xyz2lab(
(0.2126729 * red + 0.7151522 * green + 0.0721750 * blue) / Yn);
const z = xyz2lab(
(0.0193339 * red + 0.1191920 * green + 0.9503041 * blue) / Zn);
const l = 116 * y - 16;
const a = 500 * (x - y);
const b = 200 * (y - z);
const c = Math.sqrt(a * a + b * b);
let h = Math.atan2(b, a);
if (h < 0) {
h += twoPi;
}
pixel[0] = h;
pixel[1] = c;
pixel[2] = l;
return pixel;
} | javascript | function rgb2hcl(pixel) {
const red = rgb2xyz(pixel[0]);
const green = rgb2xyz(pixel[1]);
const blue = rgb2xyz(pixel[2]);
const x = xyz2lab(
(0.4124564 * red + 0.3575761 * green + 0.1804375 * blue) / Xn);
const y = xyz2lab(
(0.2126729 * red + 0.7151522 * green + 0.0721750 * blue) / Yn);
const z = xyz2lab(
(0.0193339 * red + 0.1191920 * green + 0.9503041 * blue) / Zn);
const l = 116 * y - 16;
const a = 500 * (x - y);
const b = 200 * (y - z);
const c = Math.sqrt(a * a + b * b);
let h = Math.atan2(b, a);
if (h < 0) {
h += twoPi;
}
pixel[0] = h;
pixel[1] = c;
pixel[2] = l;
return pixel;
} | [
"function",
"rgb2hcl",
"(",
"pixel",
")",
"{",
"const",
"red",
"=",
"rgb2xyz",
"(",
"pixel",
"[",
"0",
"]",
")",
";",
"const",
"green",
"=",
"rgb2xyz",
"(",
"pixel",
"[",
"1",
"]",
")",
";",
"const",
"blue",
"=",
"rgb2xyz",
"(",
"pixel",
"[",
"2"... | Convert an RGB pixel into an HCL pixel.
@param {Array<number>} pixel A pixel in RGB space.
@return {Array<number>} A pixel in HCL space. | [
"Convert",
"an",
"RGB",
"pixel",
"into",
"an",
"HCL",
"pixel",
"."
] | f366eaea522388fb575b11010e69d309164baca7 | https://github.com/openlayers/openlayers/blob/f366eaea522388fb575b11010e69d309164baca7/examples/color-manipulation.js#L26-L53 | train | Convert an RGB pixel to HCL pixel | [
30522,
3853,
1054,
30524,
3367,
2665,
1027,
1054,
18259,
2475,
18037,
2480,
1006,
22138,
1031,
1015,
1033,
1007,
1025,
9530,
3367,
2630,
1027,
1054,
18259,
2475,
18037,
2480,
1006,
22138,
1031,
1016,
1033,
1007,
1025,
9530,
3367,
1060,
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... |
laurent22/joplin | Clipper/joplin-webclipper/content_scripts/Readability.js | function() {
var metadata = {};
var values = {};
var metaElements = this._doc.getElementsByTagName("meta");
// Match "description", or Twitter's "twitter:description" (Cards)
// in name attribute.
var namePattern = /^\s*((twitter)\s*:\s*)?(description|title)\s*$/gi;
// Match Facebook's Open Graph title & description properties.
var propertyPattern = /^\s*og\s*:\s*(description|title)\s*$/gi;
// Find description tags.
this._forEachNode(metaElements, function(element) {
var elementName = element.getAttribute("name");
var elementProperty = element.getAttribute("property");
if ([elementName, elementProperty].indexOf("author") !== -1) {
metadata.byline = element.getAttribute("content");
return;
}
var name = null;
if (namePattern.test(elementName)) {
name = elementName;
} else if (propertyPattern.test(elementProperty)) {
name = elementProperty;
}
if (name) {
var content = element.getAttribute("content");
if (content) {
// Convert to lowercase and remove any whitespace
// so we can match below.
name = name.toLowerCase().replace(/\s/g, '');
values[name] = content.trim();
}
}
});
if ("description" in values) {
metadata.excerpt = values["description"];
} else if ("og:description" in values) {
// Use facebook open graph description.
metadata.excerpt = values["og:description"];
} else if ("twitter:description" in values) {
// Use twitter cards description.
metadata.excerpt = values["twitter:description"];
}
metadata.title = this._getArticleTitle();
if (!metadata.title) {
if ("og:title" in values) {
// Use facebook open graph title.
metadata.title = values["og:title"];
} else if ("twitter:title" in values) {
// Use twitter cards title.
metadata.title = values["twitter:title"];
}
}
return metadata;
} | javascript | function() {
var metadata = {};
var values = {};
var metaElements = this._doc.getElementsByTagName("meta");
// Match "description", or Twitter's "twitter:description" (Cards)
// in name attribute.
var namePattern = /^\s*((twitter)\s*:\s*)?(description|title)\s*$/gi;
// Match Facebook's Open Graph title & description properties.
var propertyPattern = /^\s*og\s*:\s*(description|title)\s*$/gi;
// Find description tags.
this._forEachNode(metaElements, function(element) {
var elementName = element.getAttribute("name");
var elementProperty = element.getAttribute("property");
if ([elementName, elementProperty].indexOf("author") !== -1) {
metadata.byline = element.getAttribute("content");
return;
}
var name = null;
if (namePattern.test(elementName)) {
name = elementName;
} else if (propertyPattern.test(elementProperty)) {
name = elementProperty;
}
if (name) {
var content = element.getAttribute("content");
if (content) {
// Convert to lowercase and remove any whitespace
// so we can match below.
name = name.toLowerCase().replace(/\s/g, '');
values[name] = content.trim();
}
}
});
if ("description" in values) {
metadata.excerpt = values["description"];
} else if ("og:description" in values) {
// Use facebook open graph description.
metadata.excerpt = values["og:description"];
} else if ("twitter:description" in values) {
// Use twitter cards description.
metadata.excerpt = values["twitter:description"];
}
metadata.title = this._getArticleTitle();
if (!metadata.title) {
if ("og:title" in values) {
// Use facebook open graph title.
metadata.title = values["og:title"];
} else if ("twitter:title" in values) {
// Use twitter cards title.
metadata.title = values["twitter:title"];
}
}
return metadata;
} | [
"function",
"(",
")",
"{",
"var",
"metadata",
"=",
"{",
"}",
";",
"var",
"values",
"=",
"{",
"}",
";",
"var",
"metaElements",
"=",
"this",
".",
"_doc",
".",
"getElementsByTagName",
"(",
"\"meta\"",
")",
";",
"// Match \"description\", or Twitter's \"twitter:de... | Attempts to get excerpt and byline metadata for the article.
@return Object with optional "excerpt" and "byline" properties | [
"Attempts",
"to",
"get",
"excerpt",
"and",
"byline",
"metadata",
"for",
"the",
"article",
"."
] | beb428b246cecba4630a3ca57b472f43c0933a43 | https://github.com/laurent22/joplin/blob/beb428b246cecba4630a3ca57b472f43c0933a43/Clipper/joplin-webclipper/content_scripts/Readability.js#L1199-L1261 | train | Get the metadata object from the meta elements | [
30522,
3853,
1006,
1007,
1063,
13075,
27425,
1027,
1063,
1065,
1025,
13075,
5300,
1027,
1063,
1065,
1025,
13075,
18804,
12260,
8163,
1027,
2023,
1012,
30524,
2030,
10474,
1005,
1055,
1000,
10474,
1024,
6412,
1000,
1006,
5329,
1007,
1013,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
typeorm/typeorm | extra/typeorm-class-transformer-shim.js | OneToOne | function OneToOne(typeFunction, inverseSideOrOptions, options) {
return function (object, propertyName) {
class_transformer_1.Type(typeFunction)(object, propertyName);
};
} | javascript | function OneToOne(typeFunction, inverseSideOrOptions, options) {
return function (object, propertyName) {
class_transformer_1.Type(typeFunction)(object, propertyName);
};
} | [
"function",
"OneToOne",
"(",
"typeFunction",
",",
"inverseSideOrOptions",
",",
"options",
")",
"{",
"return",
"function",
"(",
"object",
",",
"propertyName",
")",
"{",
"class_transformer_1",
".",
"Type",
"(",
"typeFunction",
")",
"(",
"object",
",",
"propertyNam... | /* export | [
"/",
"*",
"export"
] | 360468b7913db8d988346fba1ee2d3f323498eef | https://github.com/typeorm/typeorm/blob/360468b7913db8d988346fba1ee2d3f323498eef/extra/typeorm-class-transformer-shim.js#L161-L165 | train | OneToOne is a helper function for creating a new one - to - one relation. | [
30522,
3853,
2028,
3406,
5643,
1006,
2828,
11263,
27989,
1010,
19262,
7363,
14604,
16790,
2015,
1010,
7047,
1007,
1063,
2709,
3853,
1006,
4874,
1010,
3200,
18442,
1007,
1063,
2465,
1035,
10938,
2121,
1035,
1015,
1012,
2828,
1006,
2828,
1126... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
chartjs/Chart.js | src/core/core.datasetController.js | function() {
var me = this;
me._config = helpers.merge({}, [
me.chart.options.datasets[me._type],
me.getDataset(),
], {
merger: function(key, target, source) {
if (key !== '_meta' && key !== 'data') {
helpers._merger(key, target, source);
}
}
});
} | javascript | function() {
var me = this;
me._config = helpers.merge({}, [
me.chart.options.datasets[me._type],
me.getDataset(),
], {
merger: function(key, target, source) {
if (key !== '_meta' && key !== 'data') {
helpers._merger(key, target, source);
}
}
});
} | [
"function",
"(",
")",
"{",
"var",
"me",
"=",
"this",
";",
"me",
".",
"_config",
"=",
"helpers",
".",
"merge",
"(",
"{",
"}",
",",
"[",
"me",
".",
"chart",
".",
"options",
".",
"datasets",
"[",
"me",
".",
"_type",
"]",
",",
"me",
".",
"getDatase... | Returns the merged user-supplied and default dataset-level options
@private | [
"Returns",
"the",
"merged",
"user",
"-",
"supplied",
"and",
"default",
"dataset",
"-",
"level",
"options"
] | f093c36574d290330ed623e60fbd070421c730d5 | https://github.com/chartjs/Chart.js/blob/f093c36574d290330ed623e60fbd070421c730d5/src/core/core.datasetController.js#L244-L256 | train | Merge the config with the dataset | [
30522,
3853,
1006,
1007,
1063,
13075,
2033,
1027,
2023,
1025,
2033,
1012,
1035,
9530,
8873,
2290,
1027,
2393,
2545,
1012,
13590,
1006,
1063,
1065,
1010,
1031,
2033,
1012,
3673,
1012,
7047,
1012,
2951,
13462,
2015,
1031,
2033,
1012,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
apache/incubator-echarts | src/chart/heatmap/HeatmapLayer.js | function (data, colorFunc, state) {
var gradientPixels = this._gradientPixels;
var pixelsSingleState = gradientPixels[state] || (gradientPixels[state] = new Uint8ClampedArray(256 * 4));
var color = [0, 0, 0, 0];
var off = 0;
for (var i = 0; i < 256; i++) {
colorFunc[state](i / 255, true, color);
pixelsSingleState[off++] = color[0];
pixelsSingleState[off++] = color[1];
pixelsSingleState[off++] = color[2];
pixelsSingleState[off++] = color[3];
}
return pixelsSingleState;
} | javascript | function (data, colorFunc, state) {
var gradientPixels = this._gradientPixels;
var pixelsSingleState = gradientPixels[state] || (gradientPixels[state] = new Uint8ClampedArray(256 * 4));
var color = [0, 0, 0, 0];
var off = 0;
for (var i = 0; i < 256; i++) {
colorFunc[state](i / 255, true, color);
pixelsSingleState[off++] = color[0];
pixelsSingleState[off++] = color[1];
pixelsSingleState[off++] = color[2];
pixelsSingleState[off++] = color[3];
}
return pixelsSingleState;
} | [
"function",
"(",
"data",
",",
"colorFunc",
",",
"state",
")",
"{",
"var",
"gradientPixels",
"=",
"this",
".",
"_gradientPixels",
";",
"var",
"pixelsSingleState",
"=",
"gradientPixels",
"[",
"state",
"]",
"||",
"(",
"gradientPixels",
"[",
"state",
"]",
"=",
... | get gradient color map
@private | [
"get",
"gradient",
"color",
"map"
] | 4d0ea095dc3929cb6de40c45748826e7999c7aa8 | https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/chart/heatmap/HeatmapLayer.js#L159-L172 | train | get gradient pixels | [
30522,
3853,
1006,
2951,
1010,
3609,
11263,
12273,
1010,
2110,
1007,
1063,
13075,
17978,
8197,
2595,
9050,
1027,
2023,
1012,
1035,
17978,
8197,
2595,
9050,
1025,
13075,
27725,
7741,
4244,
12259,
1027,
17978,
8197,
2595,
9050,
1031,
2110,
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... | |
angular/material | src/components/panel/panel.js | MdPanelService | function MdPanelService(presets, $rootElement, $rootScope, $injector, $window) {
/**
* Default config options for the panel.
* Anything angular related needs to be done later. Therefore
* scope: $rootScope.$new(true),
* attachTo: $rootElement,
* are added later.
* @private {!Object}
*/
this._defaultConfigOptions = {
bindToController: true,
clickOutsideToClose: false,
disableParentScroll: false,
escapeToClose: false,
focusOnOpen: true,
fullscreen: false,
hasBackdrop: false,
propagateContainerEvents: false,
transformTemplate: angular.bind(this, this._wrapTemplate),
trapFocus: false,
zIndex: MD_PANEL_Z_INDEX
};
/** @private {!Object} */
this._config = {};
/** @private {!Object} */
this._presets = presets;
/** @private @const */
this._$rootElement = $rootElement;
/** @private @const */
this._$rootScope = $rootScope;
/** @private @const */
this._$injector = $injector;
/** @private @const */
this._$window = $window;
/** @private @const */
this._$mdUtil = this._$injector.get('$mdUtil');
/** @private {!Object<string, !MdPanelRef>} */
this._trackedPanels = {};
/**
* @private {!Object<string,
* {panels: !Array<!MdPanelRef>,
* openPanels: !Array<!MdPanelRef>,
* maxOpen: number}>}
*/
this._groups = Object.create(null);
/**
* Default animations that can be used within the panel.
* @type {enum}
*/
this.animation = MdPanelAnimation.animation;
/**
* Possible values of xPosition for positioning the panel relative to
* another element.
* @type {enum}
*/
this.xPosition = MdPanelPosition.xPosition;
/**
* Possible values of yPosition for positioning the panel relative to
* another element.
* @type {enum}
*/
this.yPosition = MdPanelPosition.yPosition;
/**
* Possible values for the interceptors that can be registered on a panel.
* @type {enum}
*/
this.interceptorTypes = MdPanelRef.interceptorTypes;
/**
* Possible values for closing of a panel.
* @type {enum}
*/
this.closeReasons = MdPanelRef.closeReasons;
/**
* Possible values of absolute position.
* @type {enum}
*/
this.absPosition = MdPanelPosition.absPosition;
} | javascript | function MdPanelService(presets, $rootElement, $rootScope, $injector, $window) {
/**
* Default config options for the panel.
* Anything angular related needs to be done later. Therefore
* scope: $rootScope.$new(true),
* attachTo: $rootElement,
* are added later.
* @private {!Object}
*/
this._defaultConfigOptions = {
bindToController: true,
clickOutsideToClose: false,
disableParentScroll: false,
escapeToClose: false,
focusOnOpen: true,
fullscreen: false,
hasBackdrop: false,
propagateContainerEvents: false,
transformTemplate: angular.bind(this, this._wrapTemplate),
trapFocus: false,
zIndex: MD_PANEL_Z_INDEX
};
/** @private {!Object} */
this._config = {};
/** @private {!Object} */
this._presets = presets;
/** @private @const */
this._$rootElement = $rootElement;
/** @private @const */
this._$rootScope = $rootScope;
/** @private @const */
this._$injector = $injector;
/** @private @const */
this._$window = $window;
/** @private @const */
this._$mdUtil = this._$injector.get('$mdUtil');
/** @private {!Object<string, !MdPanelRef>} */
this._trackedPanels = {};
/**
* @private {!Object<string,
* {panels: !Array<!MdPanelRef>,
* openPanels: !Array<!MdPanelRef>,
* maxOpen: number}>}
*/
this._groups = Object.create(null);
/**
* Default animations that can be used within the panel.
* @type {enum}
*/
this.animation = MdPanelAnimation.animation;
/**
* Possible values of xPosition for positioning the panel relative to
* another element.
* @type {enum}
*/
this.xPosition = MdPanelPosition.xPosition;
/**
* Possible values of yPosition for positioning the panel relative to
* another element.
* @type {enum}
*/
this.yPosition = MdPanelPosition.yPosition;
/**
* Possible values for the interceptors that can be registered on a panel.
* @type {enum}
*/
this.interceptorTypes = MdPanelRef.interceptorTypes;
/**
* Possible values for closing of a panel.
* @type {enum}
*/
this.closeReasons = MdPanelRef.closeReasons;
/**
* Possible values of absolute position.
* @type {enum}
*/
this.absPosition = MdPanelPosition.absPosition;
} | [
"function",
"MdPanelService",
"(",
"presets",
",",
"$rootElement",
",",
"$rootScope",
",",
"$injector",
",",
"$window",
")",
"{",
"/**\n * Default config options for the panel.\n * Anything angular related needs to be done later. Therefore\n * scope: $rootScope.$new(true),\n ... | ***************************************************************************
MdPanel Service *
***************************************************************************
A service that is used for controlling/displaying panels on the screen.
@param {!Object} presets
@param {!angular.JQLite} $rootElement
@param {!angular.Scope} $rootScope
@param {!angular.$injector} $injector
@param {!angular.$window} $window
@final @constructor @ngInject | [
"***************************************************************************",
"MdPanel",
"Service",
"*",
"***************************************************************************",
"A",
"service",
"that",
"is",
"used",
"for",
"controlling",
"/",
"displaying",
"panels",
"on",
"the... | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/panel/panel.js#L1036-L1128 | train | The MdPanelService constructor. | [
30522,
3853,
9108,
9739,
9050,
2121,
7903,
2063,
1006,
3653,
13462,
2015,
1010,
1002,
7117,
12260,
3672,
1010,
1002,
6147,
16186,
1010,
1002,
1999,
20614,
2953,
1010,
1002,
3332,
1007,
1063,
1013,
1008,
1008,
1008,
12398,
9530,
8873,
2290,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
GitbookIO/gitbook | lib/parse/parseStructureFile.js | parseStructureFile | function parseStructureFile(book, type) {
var fs = book.getContentFS();
return lookupStructureFile(book, type)
.then(function(file) {
if (!file) return [undefined, undefined];
return parseFile(fs, file, type);
});
} | javascript | function parseStructureFile(book, type) {
var fs = book.getContentFS();
return lookupStructureFile(book, type)
.then(function(file) {
if (!file) return [undefined, undefined];
return parseFile(fs, file, type);
});
} | [
"function",
"parseStructureFile",
"(",
"book",
",",
"type",
")",
"{",
"var",
"fs",
"=",
"book",
".",
"getContentFS",
"(",
")",
";",
"return",
"lookupStructureFile",
"(",
"book",
",",
"type",
")",
".",
"then",
"(",
"function",
"(",
"file",
")",
"{",
"if... | Parse a structure file (ex: SUMMARY.md, GLOSSARY.md).
It uses the configuration to find the specified file.
@param {Book} book
@param {String} type: one of ["glossary", "readme", "summary"]
@return {Promise<List|Map>} | [
"Parse",
"a",
"structure",
"file",
"(",
"ex",
":",
"SUMMARY",
".",
"md",
"GLOSSARY",
".",
"md",
")",
".",
"It",
"uses",
"the",
"configuration",
"to",
"find",
"the",
"specified",
"file",
"."
] | 6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4 | https://github.com/GitbookIO/gitbook/blob/6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4/lib/parse/parseStructureFile.js#L56-L65 | train | Parse structure file | [
30522,
3853,
11968,
8583,
18300,
5397,
8873,
2571,
1006,
2338,
1010,
2828,
1007,
1063,
13075,
1042,
2015,
1027,
2338,
1012,
2131,
8663,
6528,
24475,
2015,
1006,
1007,
1025,
2709,
2298,
22264,
18300,
5397,
8873,
2571,
1006,
2338,
1010,
2828,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/preferences/PreferencesBase.js | function (data, context) {
if (!data) {
return;
}
var relativeFilename = FileUtils.getRelativeFilename(this.prefFilePath, context[this.key]);
if (relativeFilename) {
var glob = _findMatchingGlob(data, relativeFilename);
if (glob) {
return _.keys(data[glob]);
} else {
return [];
}
}
return _.union.apply(null, _.map(_.values(data), _.keys));
} | javascript | function (data, context) {
if (!data) {
return;
}
var relativeFilename = FileUtils.getRelativeFilename(this.prefFilePath, context[this.key]);
if (relativeFilename) {
var glob = _findMatchingGlob(data, relativeFilename);
if (glob) {
return _.keys(data[glob]);
} else {
return [];
}
}
return _.union.apply(null, _.map(_.values(data), _.keys));
} | [
"function",
"(",
"data",
",",
"context",
")",
"{",
"if",
"(",
"!",
"data",
")",
"{",
"return",
";",
"}",
"var",
"relativeFilename",
"=",
"FileUtils",
".",
"getRelativeFilename",
"(",
"this",
".",
"prefFilePath",
",",
"context",
"[",
"this",
".",
"key",
... | Retrieves the keys provided by this layer object. If context with a filename is provided,
only the keys for the matching file glob are given. Otherwise, all keys for all globs
are provided.
@param {Object} data the preference data from the Scope
@param {?Object} context Additional context data (filename in particular is important) | [
"Retrieves",
"the",
"keys",
"provided",
"by",
"this",
"layer",
"object",
".",
"If",
"context",
"with",
"a",
"filename",
"is",
"provided",
"only",
"the",
"keys",
"for",
"the",
"matching",
"file",
"glob",
"are",
"given",
".",
"Otherwise",
"all",
"keys",
"for... | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/preferences/PreferencesBase.js#L960-L976 | train | get the list of all the records in the file | [
30522,
3853,
1006,
2951,
1010,
6123,
1007,
1063,
2065,
1006,
999,
2951,
1007,
1063,
2709,
1025,
1065,
13075,
5816,
8873,
20844,
4168,
1027,
5371,
21823,
4877,
1012,
2131,
16570,
8082,
8873,
20844,
4168,
1006,
30524,
2951,
1010,
5816,
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... | |
SAP/openui5 | src/sap.ui.core/src/sap/ui/core/RenderManager.js | triggerBeforeRendering | function triggerBeforeRendering(oControl){
bLocked = true;
try {
var oEvent = jQuery.Event("BeforeRendering");
// store the element on the event (aligned with jQuery syntax)
oEvent.srcControl = oControl;
oControl._handleEvent(oEvent);
} finally {
bLocked = false;
}
} | javascript | function triggerBeforeRendering(oControl){
bLocked = true;
try {
var oEvent = jQuery.Event("BeforeRendering");
// store the element on the event (aligned with jQuery syntax)
oEvent.srcControl = oControl;
oControl._handleEvent(oEvent);
} finally {
bLocked = false;
}
} | [
"function",
"triggerBeforeRendering",
"(",
"oControl",
")",
"{",
"bLocked",
"=",
"true",
";",
"try",
"{",
"var",
"oEvent",
"=",
"jQuery",
".",
"Event",
"(",
"\"BeforeRendering\"",
")",
";",
"// store the element on the event (aligned with jQuery syntax)",
"oEvent",
".... | Triggers the BeforeRendering event on the given Control | [
"Triggers",
"the",
"BeforeRendering",
"event",
"on",
"the",
"given",
"Control"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/RenderManager.js#L577-L587 | train | trigger the BeforeRendering event | [
30522,
3853,
9495,
4783,
29278,
7869,
11563,
2075,
1006,
1051,
8663,
13181,
2140,
1007,
1063,
8534,
1027,
2995,
30524,
3372,
13153,
1027,
1051,
8663,
13181,
2140,
1025,
1051,
8663,
13181,
2140,
1012,
1035,
5047,
18697,
3372,
1006,
1051,
186... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/HTMLUtils.js | getTagAttributes | function getTagAttributes(editor, pos) {
var attrs = [],
backwardCtx = TokenUtils.getInitialContext(editor._codeMirror, pos),
forwardCtx = $.extend({}, backwardCtx);
if (editor.getModeForSelection() === "html") {
if (backwardCtx.token && !tagPrefixedRegExp.test(backwardCtx.token.type)) {
while (TokenUtils.movePrevToken(backwardCtx) && !tagPrefixedRegExp.test(backwardCtx.token.type)) {
if (backwardCtx.token.type === "error" && backwardCtx.token.string.indexOf("<") === 0) {
break;
}
if (backwardCtx.token.type === "attribute") {
attrs.push(backwardCtx.token.string);
}
}
while (TokenUtils.moveNextToken(forwardCtx) && !tagPrefixedRegExp.test(forwardCtx.token.type)) {
if (forwardCtx.token.type === "attribute") {
// If the current tag is not closed, codemirror may return the next opening
// tag as an attribute. Stop the search loop in that case.
if (forwardCtx.token.string.indexOf("<") === 0) {
break;
}
attrs.push(forwardCtx.token.string);
} else if (forwardCtx.token.type === "error") {
if (forwardCtx.token.string.indexOf("<") === 0 || forwardCtx.token.string.indexOf(">") === 0) {
break;
}
// If we type the first letter of the next attribute, it comes as an error
// token. We need to double check for possible invalidated attributes.
if (/\S/.test(forwardCtx.token.string) &&
forwardCtx.token.string.indexOf("\"") === -1 &&
forwardCtx.token.string.indexOf("'") === -1 &&
forwardCtx.token.string.indexOf("=") === -1) {
attrs.push(forwardCtx.token.string);
}
}
}
}
}
return attrs;
} | javascript | function getTagAttributes(editor, pos) {
var attrs = [],
backwardCtx = TokenUtils.getInitialContext(editor._codeMirror, pos),
forwardCtx = $.extend({}, backwardCtx);
if (editor.getModeForSelection() === "html") {
if (backwardCtx.token && !tagPrefixedRegExp.test(backwardCtx.token.type)) {
while (TokenUtils.movePrevToken(backwardCtx) && !tagPrefixedRegExp.test(backwardCtx.token.type)) {
if (backwardCtx.token.type === "error" && backwardCtx.token.string.indexOf("<") === 0) {
break;
}
if (backwardCtx.token.type === "attribute") {
attrs.push(backwardCtx.token.string);
}
}
while (TokenUtils.moveNextToken(forwardCtx) && !tagPrefixedRegExp.test(forwardCtx.token.type)) {
if (forwardCtx.token.type === "attribute") {
// If the current tag is not closed, codemirror may return the next opening
// tag as an attribute. Stop the search loop in that case.
if (forwardCtx.token.string.indexOf("<") === 0) {
break;
}
attrs.push(forwardCtx.token.string);
} else if (forwardCtx.token.type === "error") {
if (forwardCtx.token.string.indexOf("<") === 0 || forwardCtx.token.string.indexOf(">") === 0) {
break;
}
// If we type the first letter of the next attribute, it comes as an error
// token. We need to double check for possible invalidated attributes.
if (/\S/.test(forwardCtx.token.string) &&
forwardCtx.token.string.indexOf("\"") === -1 &&
forwardCtx.token.string.indexOf("'") === -1 &&
forwardCtx.token.string.indexOf("=") === -1) {
attrs.push(forwardCtx.token.string);
}
}
}
}
}
return attrs;
} | [
"function",
"getTagAttributes",
"(",
"editor",
",",
"pos",
")",
"{",
"var",
"attrs",
"=",
"[",
"]",
",",
"backwardCtx",
"=",
"TokenUtils",
".",
"getInitialContext",
"(",
"editor",
".",
"_codeMirror",
",",
"pos",
")",
",",
"forwardCtx",
"=",
"$",
".",
"ex... | Compiles a list of used attributes for a given tag
@param {CodeMirror} editor An instance of a CodeMirror editor
@param {ch:{string}, line:{number}} pos A CodeMirror position
@return {Array.<string>} A list of the used attributes inside the current tag | [
"Compiles",
"a",
"list",
"of",
"used",
"attributes",
"for",
"a",
"given",
"tag"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/language/HTMLUtils.js#L131-L173 | train | Get the attributes of a tag | [
30522,
3853,
2131,
15900,
19321,
3089,
8569,
4570,
1006,
3559,
1010,
13433,
2015,
1007,
1063,
13075,
2012,
16344,
2015,
1027,
1031,
1033,
1010,
8848,
6593,
2595,
1027,
19204,
21823,
4877,
1012,
2131,
5498,
20925,
8663,
18209,
1006,
3559,
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... |
firebase/firebase-js-sdk | packages/auth/src/cordovahandler.js | function(eventData) {
initialResolve = true;
// Cancel no event timer.
if (noEventTimer) {
noEventTimer.cancel();
}
// Incoming link detected.
// Check for any stored partial event.
self.getPartialStoredEvent_().then(function(event) {
// Initialize to an unknown event.
var authEvent = noEvent;
// Confirm OAuth response included.
if (event && eventData && eventData['url']) {
// Construct complete event. Default to unknown event if none found.
authEvent = self.extractAuthEventFromUrl_(event, eventData['url']) ||
noEvent;
}
// Dispatch Auth event.
self.dispatchEvent_(authEvent);
});
} | javascript | function(eventData) {
initialResolve = true;
// Cancel no event timer.
if (noEventTimer) {
noEventTimer.cancel();
}
// Incoming link detected.
// Check for any stored partial event.
self.getPartialStoredEvent_().then(function(event) {
// Initialize to an unknown event.
var authEvent = noEvent;
// Confirm OAuth response included.
if (event && eventData && eventData['url']) {
// Construct complete event. Default to unknown event if none found.
authEvent = self.extractAuthEventFromUrl_(event, eventData['url']) ||
noEvent;
}
// Dispatch Auth event.
self.dispatchEvent_(authEvent);
});
} | [
"function",
"(",
"eventData",
")",
"{",
"initialResolve",
"=",
"true",
";",
"// Cancel no event timer.",
"if",
"(",
"noEventTimer",
")",
"{",
"noEventTimer",
".",
"cancel",
"(",
")",
";",
"}",
"// Incoming link detected.",
"// Check for any stored partial event.",
"se... | No event name needed, subscribe to all incoming universal links. | [
"No",
"event",
"name",
"needed",
"subscribe",
"to",
"all",
"incoming",
"universal",
"links",
"."
] | 491598a499813dacc23724de5e237ec220cc560e | https://github.com/firebase/firebase-js-sdk/blob/491598a499813dacc23724de5e237ec220cc560e/packages/auth/src/cordovahandler.js#L753-L773 | train | This function is called when the link is received from the server. | [
30522,
3853,
1006,
2724,
2850,
2696,
1007,
1063,
3988,
6072,
4747,
3726,
1027,
2995,
1025,
1013,
1013,
17542,
2053,
2724,
25309,
1012,
2065,
1006,
2053,
18697,
3372,
7292,
2099,
1007,
1063,
2053,
18697,
3372,
7292,
2099,
1012,
17542,
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... | |
nhn/tui.editor | src/js/extensions/scrollSync/scrollSync.js | scrollSyncExtension | function scrollSyncExtension(editor) {
const className = 'tui-scrollsync';
const i18n = editor.i18n;
const TOOL_TIP = {
active: i18n.get('Auto scroll enabled'),
inactive: i18n.get('Auto scroll disabled')
};
if (editor.isViewer()) {
return;
}
const cm = editor.getCodeMirror();
const sectionManager = new SectionManager(cm, editor.preview);
const scrollManager = new ScrollManager(sectionManager, cm, editor.preview.$el);
let isScrollable = false;
let isActive = true;
let button;
let $divider;
// UI
if (editor.getUI().name === 'default') {
const toolbar = editor.getUI().getToolbar();
toolbar.addItem('divider');
toolbar.addItem({
type: 'button',
options: {
className,
command: 'scrollSyncToggle',
tooltip: TOOL_TIP.active,
$el: $(`<button class="active ${className}" type="button"></button>`)
}
});
const items = toolbar.getItems();
$divider = items[items.length - 2].$el;
button = items[items.length - 1];
changeButtonVisiblityStateIfNeed();
// hide scroll follow button in wysiwyg
editor.on('changeMode', changeButtonVisiblityStateIfNeed);
editor.on('changePreviewStyle', changeButtonVisiblityStateIfNeed);
// Commands
editor.addCommand('markdown', {
name: 'scrollSyncToggle',
exec() {
isActive = !isActive;
button._onOut();
if (isActive) {
button.$el.addClass('active');
button.setTooltip(TOOL_TIP.active);
} else {
button.$el.removeClass('active');
button.setTooltip(TOOL_TIP.inactive);
}
button._onOver();
}
});
}
// Events
cm.on('change', () => {
isScrollable = false;
sectionManager.makeSectionList();
});
/**
* change button visiblity state
*/
function changeButtonVisiblityStateIfNeed() {
if (editor.mdPreviewStyle === 'vertical' && editor.currentMode === 'markdown') {
button.$el.show();
$divider.show();
} else {
button.$el.hide();
$divider.hide();
}
}
editor.on('previewRenderAfter', () => {
sectionManager.sectionMatch();
if (isActive) {
scrollManager.syncPreviewScrollTopToMarkdown();
}
isScrollable = true;
});
editor.eventManager.listen('scroll', event => {
if (!isActive) {
return;
}
if (isScrollable && editor.preview.isVisible()) {
if (event.source === 'markdown' && !scrollManager.isMarkdownScrollEventBlocked) {
scrollManager.syncPreviewScrollTopToMarkdown();
} else if (event.source === 'preview' && !scrollManager.isPreviewScrollEventBlocked) {
scrollManager.syncMarkdownScrollTopToPreview();
}
} else {
scrollManager.saveScrollInfo();
}
});
} | javascript | function scrollSyncExtension(editor) {
const className = 'tui-scrollsync';
const i18n = editor.i18n;
const TOOL_TIP = {
active: i18n.get('Auto scroll enabled'),
inactive: i18n.get('Auto scroll disabled')
};
if (editor.isViewer()) {
return;
}
const cm = editor.getCodeMirror();
const sectionManager = new SectionManager(cm, editor.preview);
const scrollManager = new ScrollManager(sectionManager, cm, editor.preview.$el);
let isScrollable = false;
let isActive = true;
let button;
let $divider;
// UI
if (editor.getUI().name === 'default') {
const toolbar = editor.getUI().getToolbar();
toolbar.addItem('divider');
toolbar.addItem({
type: 'button',
options: {
className,
command: 'scrollSyncToggle',
tooltip: TOOL_TIP.active,
$el: $(`<button class="active ${className}" type="button"></button>`)
}
});
const items = toolbar.getItems();
$divider = items[items.length - 2].$el;
button = items[items.length - 1];
changeButtonVisiblityStateIfNeed();
// hide scroll follow button in wysiwyg
editor.on('changeMode', changeButtonVisiblityStateIfNeed);
editor.on('changePreviewStyle', changeButtonVisiblityStateIfNeed);
// Commands
editor.addCommand('markdown', {
name: 'scrollSyncToggle',
exec() {
isActive = !isActive;
button._onOut();
if (isActive) {
button.$el.addClass('active');
button.setTooltip(TOOL_TIP.active);
} else {
button.$el.removeClass('active');
button.setTooltip(TOOL_TIP.inactive);
}
button._onOver();
}
});
}
// Events
cm.on('change', () => {
isScrollable = false;
sectionManager.makeSectionList();
});
/**
* change button visiblity state
*/
function changeButtonVisiblityStateIfNeed() {
if (editor.mdPreviewStyle === 'vertical' && editor.currentMode === 'markdown') {
button.$el.show();
$divider.show();
} else {
button.$el.hide();
$divider.hide();
}
}
editor.on('previewRenderAfter', () => {
sectionManager.sectionMatch();
if (isActive) {
scrollManager.syncPreviewScrollTopToMarkdown();
}
isScrollable = true;
});
editor.eventManager.listen('scroll', event => {
if (!isActive) {
return;
}
if (isScrollable && editor.preview.isVisible()) {
if (event.source === 'markdown' && !scrollManager.isMarkdownScrollEventBlocked) {
scrollManager.syncPreviewScrollTopToMarkdown();
} else if (event.source === 'preview' && !scrollManager.isPreviewScrollEventBlocked) {
scrollManager.syncMarkdownScrollTopToPreview();
}
} else {
scrollManager.saveScrollInfo();
}
});
} | [
"function",
"scrollSyncExtension",
"(",
"editor",
")",
"{",
"const",
"className",
"=",
"'tui-scrollsync'",
";",
"const",
"i18n",
"=",
"editor",
".",
"i18n",
";",
"const",
"TOOL_TIP",
"=",
"{",
"active",
":",
"i18n",
".",
"get",
"(",
"'Auto scroll enabled'",
... | scrollSync plugin
@param {Editor} editor - editor
@ignore | [
"scrollSync",
"plugin"
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/extensions/scrollSync/scrollSync.js#L15-L119 | train | Scroll sync extension | [
30522,
3853,
23074,
6038,
3401,
18413,
6132,
3258,
1006,
3559,
1007,
1063,
9530,
3367,
2465,
18442,
1027,
1005,
10722,
2072,
1011,
23074,
6038,
2278,
1005,
1025,
9530,
3367,
1045,
15136,
2078,
1027,
3559,
1012,
1045,
15136,
2078,
1025,
9530... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
ColorlibHQ/AdminLTE | bower_components/ion.rangeSlider/js/ion.rangeSlider.js | function (update) {
if (!this.options) {
return;
}
this.calc_count++;
if (this.calc_count === 10 || update) {
this.calc_count = 0;
this.coords.w_rs = this.$cache.rs.outerWidth(false);
this.calcHandlePercent();
}
if (!this.coords.w_rs) {
return;
}
this.calcPointerPercent();
var handle_x = this.getHandleX();
if (this.target === "both") {
this.coords.p_gap = 0;
handle_x = this.getHandleX();
}
if (this.target === "click") {
this.coords.p_gap = this.coords.p_handle / 2;
handle_x = this.getHandleX();
if (this.options.drag_interval) {
this.target = "both_one";
} else {
this.target = this.chooseHandle(handle_x);
}
}
switch (this.target) {
case "base":
var w = (this.options.max - this.options.min) / 100,
f = (this.result.from - this.options.min) / w,
t = (this.result.to - this.options.min) / w;
this.coords.p_single_real = this.toFixed(f);
this.coords.p_from_real = this.toFixed(f);
this.coords.p_to_real = this.toFixed(t);
this.coords.p_single_real = this.checkDiapason(this.coords.p_single_real, this.options.from_min, this.options.from_max);
this.coords.p_from_real = this.checkDiapason(this.coords.p_from_real, this.options.from_min, this.options.from_max);
this.coords.p_to_real = this.checkDiapason(this.coords.p_to_real, this.options.to_min, this.options.to_max);
this.coords.p_single_fake = this.convertToFakePercent(this.coords.p_single_real);
this.coords.p_from_fake = this.convertToFakePercent(this.coords.p_from_real);
this.coords.p_to_fake = this.convertToFakePercent(this.coords.p_to_real);
this.target = null;
break;
case "single":
if (this.options.from_fixed) {
break;
}
this.coords.p_single_real = this.convertToRealPercent(handle_x);
this.coords.p_single_real = this.calcWithStep(this.coords.p_single_real);
this.coords.p_single_real = this.checkDiapason(this.coords.p_single_real, this.options.from_min, this.options.from_max);
this.coords.p_single_fake = this.convertToFakePercent(this.coords.p_single_real);
break;
case "from":
if (this.options.from_fixed) {
break;
}
this.coords.p_from_real = this.convertToRealPercent(handle_x);
this.coords.p_from_real = this.calcWithStep(this.coords.p_from_real);
if (this.coords.p_from_real > this.coords.p_to_real) {
this.coords.p_from_real = this.coords.p_to_real;
}
this.coords.p_from_real = this.checkDiapason(this.coords.p_from_real, this.options.from_min, this.options.from_max);
this.coords.p_from_real = this.checkMinInterval(this.coords.p_from_real, this.coords.p_to_real, "from");
this.coords.p_from_real = this.checkMaxInterval(this.coords.p_from_real, this.coords.p_to_real, "from");
this.coords.p_from_fake = this.convertToFakePercent(this.coords.p_from_real);
break;
case "to":
if (this.options.to_fixed) {
break;
}
this.coords.p_to_real = this.convertToRealPercent(handle_x);
this.coords.p_to_real = this.calcWithStep(this.coords.p_to_real);
if (this.coords.p_to_real < this.coords.p_from_real) {
this.coords.p_to_real = this.coords.p_from_real;
}
this.coords.p_to_real = this.checkDiapason(this.coords.p_to_real, this.options.to_min, this.options.to_max);
this.coords.p_to_real = this.checkMinInterval(this.coords.p_to_real, this.coords.p_from_real, "to");
this.coords.p_to_real = this.checkMaxInterval(this.coords.p_to_real, this.coords.p_from_real, "to");
this.coords.p_to_fake = this.convertToFakePercent(this.coords.p_to_real);
break;
case "both":
if (this.options.from_fixed || this.options.to_fixed) {
break;
}
handle_x = this.toFixed(handle_x + (this.coords.p_handle * 0.001));
this.coords.p_from_real = this.convertToRealPercent(handle_x) - this.coords.p_gap_left;
this.coords.p_from_real = this.calcWithStep(this.coords.p_from_real);
this.coords.p_from_real = this.checkDiapason(this.coords.p_from_real, this.options.from_min, this.options.from_max);
this.coords.p_from_real = this.checkMinInterval(this.coords.p_from_real, this.coords.p_to_real, "from");
this.coords.p_from_fake = this.convertToFakePercent(this.coords.p_from_real);
this.coords.p_to_real = this.convertToRealPercent(handle_x) + this.coords.p_gap_right;
this.coords.p_to_real = this.calcWithStep(this.coords.p_to_real);
this.coords.p_to_real = this.checkDiapason(this.coords.p_to_real, this.options.to_min, this.options.to_max);
this.coords.p_to_real = this.checkMinInterval(this.coords.p_to_real, this.coords.p_from_real, "to");
this.coords.p_to_fake = this.convertToFakePercent(this.coords.p_to_real);
break;
case "both_one":
if (this.options.from_fixed || this.options.to_fixed) {
break;
}
var real_x = this.convertToRealPercent(handle_x),
from = this.result.from_percent,
to = this.result.to_percent,
full = to - from,
half = full / 2,
new_from = real_x - half,
new_to = real_x + half;
if (new_from < 0) {
new_from = 0;
new_to = new_from + full;
}
if (new_to > 100) {
new_to = 100;
new_from = new_to - full;
}
this.coords.p_from_real = this.calcWithStep(new_from);
this.coords.p_from_real = this.checkDiapason(this.coords.p_from_real, this.options.from_min, this.options.from_max);
this.coords.p_from_fake = this.convertToFakePercent(this.coords.p_from_real);
this.coords.p_to_real = this.calcWithStep(new_to);
this.coords.p_to_real = this.checkDiapason(this.coords.p_to_real, this.options.to_min, this.options.to_max);
this.coords.p_to_fake = this.convertToFakePercent(this.coords.p_to_real);
break;
}
if (this.options.type === "single") {
this.coords.p_bar_x = (this.coords.p_handle / 2);
this.coords.p_bar_w = this.coords.p_single_fake;
this.result.from_percent = this.coords.p_single_real;
this.result.from = this.convertToValue(this.coords.p_single_real);
this.result.from_pretty = this._prettify(this.result.from);
if (this.options.values.length) {
this.result.from_value = this.options.values[this.result.from];
}
} else {
this.coords.p_bar_x = this.toFixed(this.coords.p_from_fake + (this.coords.p_handle / 2));
this.coords.p_bar_w = this.toFixed(this.coords.p_to_fake - this.coords.p_from_fake);
this.result.from_percent = this.coords.p_from_real;
this.result.from = this.convertToValue(this.coords.p_from_real);
this.result.from_pretty = this._prettify(this.result.from);
this.result.to_percent = this.coords.p_to_real;
this.result.to = this.convertToValue(this.coords.p_to_real);
this.result.to_pretty = this._prettify(this.result.to);
if (this.options.values.length) {
this.result.from_value = this.options.values[this.result.from];
this.result.to_value = this.options.values[this.result.to];
}
}
this.calcMinMax();
this.calcLabels();
} | javascript | function (update) {
if (!this.options) {
return;
}
this.calc_count++;
if (this.calc_count === 10 || update) {
this.calc_count = 0;
this.coords.w_rs = this.$cache.rs.outerWidth(false);
this.calcHandlePercent();
}
if (!this.coords.w_rs) {
return;
}
this.calcPointerPercent();
var handle_x = this.getHandleX();
if (this.target === "both") {
this.coords.p_gap = 0;
handle_x = this.getHandleX();
}
if (this.target === "click") {
this.coords.p_gap = this.coords.p_handle / 2;
handle_x = this.getHandleX();
if (this.options.drag_interval) {
this.target = "both_one";
} else {
this.target = this.chooseHandle(handle_x);
}
}
switch (this.target) {
case "base":
var w = (this.options.max - this.options.min) / 100,
f = (this.result.from - this.options.min) / w,
t = (this.result.to - this.options.min) / w;
this.coords.p_single_real = this.toFixed(f);
this.coords.p_from_real = this.toFixed(f);
this.coords.p_to_real = this.toFixed(t);
this.coords.p_single_real = this.checkDiapason(this.coords.p_single_real, this.options.from_min, this.options.from_max);
this.coords.p_from_real = this.checkDiapason(this.coords.p_from_real, this.options.from_min, this.options.from_max);
this.coords.p_to_real = this.checkDiapason(this.coords.p_to_real, this.options.to_min, this.options.to_max);
this.coords.p_single_fake = this.convertToFakePercent(this.coords.p_single_real);
this.coords.p_from_fake = this.convertToFakePercent(this.coords.p_from_real);
this.coords.p_to_fake = this.convertToFakePercent(this.coords.p_to_real);
this.target = null;
break;
case "single":
if (this.options.from_fixed) {
break;
}
this.coords.p_single_real = this.convertToRealPercent(handle_x);
this.coords.p_single_real = this.calcWithStep(this.coords.p_single_real);
this.coords.p_single_real = this.checkDiapason(this.coords.p_single_real, this.options.from_min, this.options.from_max);
this.coords.p_single_fake = this.convertToFakePercent(this.coords.p_single_real);
break;
case "from":
if (this.options.from_fixed) {
break;
}
this.coords.p_from_real = this.convertToRealPercent(handle_x);
this.coords.p_from_real = this.calcWithStep(this.coords.p_from_real);
if (this.coords.p_from_real > this.coords.p_to_real) {
this.coords.p_from_real = this.coords.p_to_real;
}
this.coords.p_from_real = this.checkDiapason(this.coords.p_from_real, this.options.from_min, this.options.from_max);
this.coords.p_from_real = this.checkMinInterval(this.coords.p_from_real, this.coords.p_to_real, "from");
this.coords.p_from_real = this.checkMaxInterval(this.coords.p_from_real, this.coords.p_to_real, "from");
this.coords.p_from_fake = this.convertToFakePercent(this.coords.p_from_real);
break;
case "to":
if (this.options.to_fixed) {
break;
}
this.coords.p_to_real = this.convertToRealPercent(handle_x);
this.coords.p_to_real = this.calcWithStep(this.coords.p_to_real);
if (this.coords.p_to_real < this.coords.p_from_real) {
this.coords.p_to_real = this.coords.p_from_real;
}
this.coords.p_to_real = this.checkDiapason(this.coords.p_to_real, this.options.to_min, this.options.to_max);
this.coords.p_to_real = this.checkMinInterval(this.coords.p_to_real, this.coords.p_from_real, "to");
this.coords.p_to_real = this.checkMaxInterval(this.coords.p_to_real, this.coords.p_from_real, "to");
this.coords.p_to_fake = this.convertToFakePercent(this.coords.p_to_real);
break;
case "both":
if (this.options.from_fixed || this.options.to_fixed) {
break;
}
handle_x = this.toFixed(handle_x + (this.coords.p_handle * 0.001));
this.coords.p_from_real = this.convertToRealPercent(handle_x) - this.coords.p_gap_left;
this.coords.p_from_real = this.calcWithStep(this.coords.p_from_real);
this.coords.p_from_real = this.checkDiapason(this.coords.p_from_real, this.options.from_min, this.options.from_max);
this.coords.p_from_real = this.checkMinInterval(this.coords.p_from_real, this.coords.p_to_real, "from");
this.coords.p_from_fake = this.convertToFakePercent(this.coords.p_from_real);
this.coords.p_to_real = this.convertToRealPercent(handle_x) + this.coords.p_gap_right;
this.coords.p_to_real = this.calcWithStep(this.coords.p_to_real);
this.coords.p_to_real = this.checkDiapason(this.coords.p_to_real, this.options.to_min, this.options.to_max);
this.coords.p_to_real = this.checkMinInterval(this.coords.p_to_real, this.coords.p_from_real, "to");
this.coords.p_to_fake = this.convertToFakePercent(this.coords.p_to_real);
break;
case "both_one":
if (this.options.from_fixed || this.options.to_fixed) {
break;
}
var real_x = this.convertToRealPercent(handle_x),
from = this.result.from_percent,
to = this.result.to_percent,
full = to - from,
half = full / 2,
new_from = real_x - half,
new_to = real_x + half;
if (new_from < 0) {
new_from = 0;
new_to = new_from + full;
}
if (new_to > 100) {
new_to = 100;
new_from = new_to - full;
}
this.coords.p_from_real = this.calcWithStep(new_from);
this.coords.p_from_real = this.checkDiapason(this.coords.p_from_real, this.options.from_min, this.options.from_max);
this.coords.p_from_fake = this.convertToFakePercent(this.coords.p_from_real);
this.coords.p_to_real = this.calcWithStep(new_to);
this.coords.p_to_real = this.checkDiapason(this.coords.p_to_real, this.options.to_min, this.options.to_max);
this.coords.p_to_fake = this.convertToFakePercent(this.coords.p_to_real);
break;
}
if (this.options.type === "single") {
this.coords.p_bar_x = (this.coords.p_handle / 2);
this.coords.p_bar_w = this.coords.p_single_fake;
this.result.from_percent = this.coords.p_single_real;
this.result.from = this.convertToValue(this.coords.p_single_real);
this.result.from_pretty = this._prettify(this.result.from);
if (this.options.values.length) {
this.result.from_value = this.options.values[this.result.from];
}
} else {
this.coords.p_bar_x = this.toFixed(this.coords.p_from_fake + (this.coords.p_handle / 2));
this.coords.p_bar_w = this.toFixed(this.coords.p_to_fake - this.coords.p_from_fake);
this.result.from_percent = this.coords.p_from_real;
this.result.from = this.convertToValue(this.coords.p_from_real);
this.result.from_pretty = this._prettify(this.result.from);
this.result.to_percent = this.coords.p_to_real;
this.result.to = this.convertToValue(this.coords.p_to_real);
this.result.to_pretty = this._prettify(this.result.to);
if (this.options.values.length) {
this.result.from_value = this.options.values[this.result.from];
this.result.to_value = this.options.values[this.result.to];
}
}
this.calcMinMax();
this.calcLabels();
} | [
"function",
"(",
"update",
")",
"{",
"if",
"(",
"!",
"this",
".",
"options",
")",
"{",
"return",
";",
"}",
"this",
".",
"calc_count",
"++",
";",
"if",
"(",
"this",
".",
"calc_count",
"===",
"10",
"||",
"update",
")",
"{",
"this",
".",
"calc_count",... | ============================================================================================================= Calculations
All calculations and measures start here
@param update {boolean=} | [
"=============================================================================================================",
"Calculations",
"All",
"calculations",
"and",
"measures",
"start",
"here"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/bower_components/ion.rangeSlider/js/ion.rangeSlider.js#L1004-L1198 | train | update the coords | [
30522,
3853,
1006,
10651,
1007,
1063,
2065,
1006,
999,
2023,
1012,
7047,
1007,
1063,
2709,
1025,
1065,
2023,
1012,
10250,
2278,
1035,
4175,
1009,
1009,
1025,
2065,
1006,
2023,
1012,
10250,
2278,
1035,
4175,
1027,
1027,
1027,
2184,
1064,
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... | |
dequelabs/axe-core | lib/core/utils/respondable.js | respondable | function respondable(win, topic, message, keepalive, callback) {
var id = uuid.v1();
post(win, topic, message, id, keepalive, callback);
} | javascript | function respondable(win, topic, message, keepalive, callback) {
var id = uuid.v1();
post(win, topic, message, id, keepalive, callback);
} | [
"function",
"respondable",
"(",
"win",
",",
"topic",
",",
"message",
",",
"keepalive",
",",
"callback",
")",
"{",
"var",
"id",
"=",
"uuid",
".",
"v1",
"(",
")",
";",
"post",
"(",
"win",
",",
"topic",
",",
"message",
",",
"id",
",",
"keepalive",
","... | Post a message to a window who may or may not respond to it.
@param {Window} win The window to post the message to
@param {String} topic The topic of the message
@param {Object} message The message content
@param {Boolean} keepalive Whether to allow multiple responses - default is false
@param {Function} callback The function to invoke when/if the message is responded to | [
"Post",
"a",
"message",
"to",
"a",
"window",
"who",
"may",
"or",
"may",
"not",
"respond",
"to",
"it",
"."
] | 727323c07980e2291575f545444d389fb942906f | https://github.com/dequelabs/axe-core/blob/727323c07980e2291575f545444d389fb942906f/lib/core/utils/respondable.js#L104-L107 | train | Send a message to the remote device | [
30522,
3853,
6869,
3085,
1006,
2663,
1010,
8476,
1010,
4471,
1010,
2562,
11475,
3726,
1010,
2655,
5963,
1007,
1063,
13075,
8909,
1027,
1057,
21272,
1012,
1058,
2487,
1006,
1007,
1025,
2695,
1006,
2663,
1010,
8476,
1010,
4471,
1010,
8909,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/animation.js | function () {
var config = this.config;
var data = this.data;
var el = this.el;
var from;
var isBoolean;
var isNumber;
var to;
if (this.waitComponentInitRawProperty(this.updateConfigForDefault)) {
return;
}
if (data.from === '') {
// Infer from.
from = isRawProperty(data)
? getRawProperty(el, data.property)
: getComponentProperty(el, data.property);
} else {
// Explicit from.
from = data.from;
}
to = data.to;
isNumber = !isNaN(from || to);
if (isNumber) {
from = parseFloat(from);
to = parseFloat(to);
} else {
from = from ? from.toString() : from;
to = to ? to.toString() : to;
}
// Convert booleans to integer to allow boolean flipping.
isBoolean = data.to === 'true' || data.to === 'false' ||
data.to === true || data.to === false;
if (isBoolean) {
from = data.from === 'true' || data.from === true ? 1 : 0;
to = data.to === 'true' || data.to === true ? 1 : 0;
}
this.targets.aframeProperty = from;
config.targets = this.targets;
config.aframeProperty = to;
config.update = (function () {
var lastValue;
return function (anim) {
var value;
value = anim.animatables[0].target.aframeProperty;
// Need to do a last value check for animation timeline since all the tweening
// begins simultaenously even if the value has not changed. Also better for perf
// anyways.
if (value === lastValue) { return; }
lastValue = value;
if (isBoolean) { value = value >= 1; }
if (isRawProperty(data)) {
setRawProperty(el, data.property, value, data.type);
} else {
setComponentProperty(el, data.property, value);
}
};
})();
} | javascript | function () {
var config = this.config;
var data = this.data;
var el = this.el;
var from;
var isBoolean;
var isNumber;
var to;
if (this.waitComponentInitRawProperty(this.updateConfigForDefault)) {
return;
}
if (data.from === '') {
// Infer from.
from = isRawProperty(data)
? getRawProperty(el, data.property)
: getComponentProperty(el, data.property);
} else {
// Explicit from.
from = data.from;
}
to = data.to;
isNumber = !isNaN(from || to);
if (isNumber) {
from = parseFloat(from);
to = parseFloat(to);
} else {
from = from ? from.toString() : from;
to = to ? to.toString() : to;
}
// Convert booleans to integer to allow boolean flipping.
isBoolean = data.to === 'true' || data.to === 'false' ||
data.to === true || data.to === false;
if (isBoolean) {
from = data.from === 'true' || data.from === true ? 1 : 0;
to = data.to === 'true' || data.to === true ? 1 : 0;
}
this.targets.aframeProperty = from;
config.targets = this.targets;
config.aframeProperty = to;
config.update = (function () {
var lastValue;
return function (anim) {
var value;
value = anim.animatables[0].target.aframeProperty;
// Need to do a last value check for animation timeline since all the tweening
// begins simultaenously even if the value has not changed. Also better for perf
// anyways.
if (value === lastValue) { return; }
lastValue = value;
if (isBoolean) { value = value >= 1; }
if (isRawProperty(data)) {
setRawProperty(el, data.property, value, data.type);
} else {
setComponentProperty(el, data.property, value);
}
};
})();
} | [
"function",
"(",
")",
"{",
"var",
"config",
"=",
"this",
".",
"config",
";",
"var",
"data",
"=",
"this",
".",
"data",
";",
"var",
"el",
"=",
"this",
".",
"el",
";",
"var",
"from",
";",
"var",
"isBoolean",
";",
"var",
"isNumber",
";",
"var",
"to",... | Stuff property into generic `property` key. | [
"Stuff",
"property",
"into",
"generic",
"property",
"key",
"."
] | 24acc78a7299a4cdfe3ef617f4d40ddf6275c992 | https://github.com/aframevr/aframe/blob/24acc78a7299a4cdfe3ef617f4d40ddf6275c992/src/components/animation.js#L273-L340 | train | Update the aframe property of the component. | [
30522,
3853,
1006,
1007,
1063,
13075,
9530,
8873,
2290,
1027,
2023,
1012,
9530,
8873,
2290,
1025,
13075,
2951,
1027,
2023,
1012,
2951,
1025,
13075,
3449,
1027,
2023,
1012,
3449,
1025,
13075,
2013,
1025,
13075,
2003,
5092,
9890,
2319,
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/widgets/StatusBar.js | addIndicator | function addIndicator(id, indicator, visible, style, tooltip, insertBefore) {
if (!_init) {
console.error("StatusBar API invoked before status bar created");
return;
}
indicator = indicator || window.document.createElement("div");
tooltip = tooltip || "";
style = style || "";
id = id.replace(_indicatorIDRegexp, "-") || "";
var $indicator = $(indicator);
$indicator.attr("id", id);
$indicator.attr("title", tooltip);
$indicator.addClass("indicator");
$indicator.addClass(style);
if (!visible) {
$indicator.hide();
}
// This code looks backwards because the DOM model is ordered
// top-to-bottom but the UI view is ordered right-to-left. The concept
// of "before" in the model is "after" in the view, and vice versa.
if (insertBefore && $("#" + insertBefore).length > 0) {
$indicator.insertAfter("#" + insertBefore);
} else {
// No positioning is provided, put on left end of indicators, but
// to right of "busy" indicator (which is usually hidden).
var $busyIndicator = $("#status-bar .spinner");
$indicator.insertBefore($busyIndicator);
}
} | javascript | function addIndicator(id, indicator, visible, style, tooltip, insertBefore) {
if (!_init) {
console.error("StatusBar API invoked before status bar created");
return;
}
indicator = indicator || window.document.createElement("div");
tooltip = tooltip || "";
style = style || "";
id = id.replace(_indicatorIDRegexp, "-") || "";
var $indicator = $(indicator);
$indicator.attr("id", id);
$indicator.attr("title", tooltip);
$indicator.addClass("indicator");
$indicator.addClass(style);
if (!visible) {
$indicator.hide();
}
// This code looks backwards because the DOM model is ordered
// top-to-bottom but the UI view is ordered right-to-left. The concept
// of "before" in the model is "after" in the view, and vice versa.
if (insertBefore && $("#" + insertBefore).length > 0) {
$indicator.insertAfter("#" + insertBefore);
} else {
// No positioning is provided, put on left end of indicators, but
// to right of "busy" indicator (which is usually hidden).
var $busyIndicator = $("#status-bar .spinner");
$indicator.insertBefore($busyIndicator);
}
} | [
"function",
"addIndicator",
"(",
"id",
",",
"indicator",
",",
"visible",
",",
"style",
",",
"tooltip",
",",
"insertBefore",
")",
"{",
"if",
"(",
"!",
"_init",
")",
"{",
"console",
".",
"error",
"(",
"\"StatusBar API invoked before status bar created\"",
")",
"... | Registers a new status indicator
@param {string} id Registration id of the indicator to be updated.
@param {(DOMNode|jQueryObject)=} indicator Optional DOMNode for the indicator
@param {boolean=} visible Shows or hides the indicator over the statusbar.
@param {string=} style Sets the attribute "class" of the indicator.
@param {string=} tooltip Sets the attribute "title" of the indicator.
@param {string=} insertBefore An id of an existing status bar indicator.
The new indicator will be inserted before (i.e. to the left of)
the indicator specified by this parameter. | [
"Registers",
"a",
"new",
"status",
"indicator"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/widgets/StatusBar.js#L102-L135 | train | Add indicator to status bar | [
30522,
3853,
5587,
22254,
5555,
4263,
1006,
8909,
1010,
17245,
1010,
5710,
1010,
2806,
1010,
6994,
25101,
1010,
19274,
4783,
29278,
2063,
1007,
1063,
2065,
1006,
999,
1035,
1999,
4183,
1007,
1063,
10122,
1012,
7561,
1006,
1000,
3570,
8237,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/utils.js | closeContentAreaContextMenu | function closeContentAreaContextMenu(controller) {
var contextMenu = new elementslib.ID(controller.window.document, "contentAreaContextMenu");
controller.keypress(contextMenu, "VK_ESCAPE", {});
} | javascript | function closeContentAreaContextMenu(controller) {
var contextMenu = new elementslib.ID(controller.window.document, "contentAreaContextMenu");
controller.keypress(contextMenu, "VK_ESCAPE", {});
} | [
"function",
"closeContentAreaContextMenu",
"(",
"controller",
")",
"{",
"var",
"contextMenu",
"=",
"new",
"elementslib",
".",
"ID",
"(",
"controller",
".",
"window",
".",
"document",
",",
"\"contentAreaContextMenu\"",
")",
";",
"controller",
".",
"keypress",
"(",
... | Close the context menu inside the content area of the currently open tab
@param {MozmillController} controller
MozMillController of the window to operate on | [
"Close",
"the",
"context",
"menu",
"inside",
"the",
"content",
"area",
"of",
"the",
"currently",
"open",
"tab"
] | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/utils.js#L213-L216 | train | Close the context menu | [
30522,
3853,
2485,
8663,
6528,
7559,
5243,
8663,
18209,
3549,
2226,
1006,
11486,
1007,
1063,
13075,
6123,
3549,
2226,
1027,
2047,
3787,
29521,
1012,
8909,
1006,
11486,
1012,
3332,
1012,
6254,
1010,
1000,
4180,
12069,
22684,
10111,
18413,
35... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
ColorlibHQ/AdminLTE | plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js | function(shouldParseHtml) {
var textareaValue = this.textarea.getValue(false, false);
if (textareaValue) {
this.composer.setValue(textareaValue, shouldParseHtml);
} else {
this.composer.clear();
this.editor.fire("set_placeholder");
}
} | javascript | function(shouldParseHtml) {
var textareaValue = this.textarea.getValue(false, false);
if (textareaValue) {
this.composer.setValue(textareaValue, shouldParseHtml);
} else {
this.composer.clear();
this.editor.fire("set_placeholder");
}
} | [
"function",
"(",
"shouldParseHtml",
")",
"{",
"var",
"textareaValue",
"=",
"this",
".",
"textarea",
".",
"getValue",
"(",
"false",
",",
"false",
")",
";",
"if",
"(",
"textareaValue",
")",
"{",
"this",
".",
"composer",
".",
"setValue",
"(",
"textareaValue",... | Sync value of textarea to composer
Takes care of placeholders
@param {Boolean} shouldParseHtml Whether the html should be sanitized before inserting it into the composer | [
"Sync",
"value",
"of",
"textarea",
"to",
"composer",
"Takes",
"care",
"of",
"placeholders"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js#L13054-L13062 | train | Set the value of the textarea | [
30522,
3853,
1006,
2323,
19362,
3366,
11039,
19968,
30524,
10175,
5657,
1006,
6270,
1010,
6270,
1007,
1025,
2065,
1006,
3793,
12069,
12462,
7630,
2063,
1007,
1063,
2023,
1012,
4543,
1012,
2275,
10175,
5657,
1006,
3793,
12069,
12462,
7630,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
angular/material | src/core/services/theming/theming.js | function (scope, el) {
if (el === undefined) { el = scope; scope = undefined; }
if (scope === undefined) { scope = $rootScope; }
applyTheme.inherit(el, el);
} | javascript | function (scope, el) {
if (el === undefined) { el = scope; scope = undefined; }
if (scope === undefined) { scope = $rootScope; }
applyTheme.inherit(el, el);
} | [
"function",
"(",
"scope",
",",
"el",
")",
"{",
"if",
"(",
"el",
"===",
"undefined",
")",
"{",
"el",
"=",
"scope",
";",
"scope",
"=",
"undefined",
";",
"}",
"if",
"(",
"scope",
"===",
"undefined",
")",
"{",
"scope",
"=",
"$rootScope",
";",
"}",
"a... | Allow us to be invoked via a linking function signature. | [
"Allow",
"us",
"to",
"be",
"invoked",
"via",
"a",
"linking",
"function",
"signature",
"."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/services/theming/theming.js#L711-L715 | train | inherit theme from parent theme | [
30522,
3853,
1006,
9531,
1010,
3449,
1007,
1063,
2065,
1006,
3449,
1027,
1027,
1027,
6151,
28344,
1007,
1063,
3449,
1027,
9531,
1025,
9531,
1027,
6151,
28344,
1025,
1065,
2065,
1006,
9531,
1027,
1027,
1027,
6151,
28344,
1007,
1063,
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... | |
SeleniumHQ/selenium | third_party/closure/goog/string/stringformat.js | replacerDemuxer | function replacerDemuxer(
match, flags, width, dotp, precision, type, offset, wholeString) {
// The % is too simple and doesn't take an argument.
if (type == '%') {
return '%';
}
// Try to get the actual value from parent function.
var value = args.shift();
// If we didn't get any arguments, fail.
if (typeof value == 'undefined') {
throw Error('[goog.string.format] Not enough arguments');
}
// Patch the value argument to the beginning of our type specific call.
arguments[0] = value;
return goog.string.format.demuxes_[type].apply(null, arguments);
} | javascript | function replacerDemuxer(
match, flags, width, dotp, precision, type, offset, wholeString) {
// The % is too simple and doesn't take an argument.
if (type == '%') {
return '%';
}
// Try to get the actual value from parent function.
var value = args.shift();
// If we didn't get any arguments, fail.
if (typeof value == 'undefined') {
throw Error('[goog.string.format] Not enough arguments');
}
// Patch the value argument to the beginning of our type specific call.
arguments[0] = value;
return goog.string.format.demuxes_[type].apply(null, arguments);
} | [
"function",
"replacerDemuxer",
"(",
"match",
",",
"flags",
",",
"width",
",",
"dotp",
",",
"precision",
",",
"type",
",",
"offset",
",",
"wholeString",
")",
"{",
"// The % is too simple and doesn't take an argument.",
"if",
"(",
"type",
"==",
"'%'",
")",
"{",
... | Chooses which conversion function to call based on type conversion
specifier.
@param {string} match Contains the re matched string.
@param {string} flags Formatting flags.
@param {string} width Replacement string minimum width.
@param {string} dotp Matched precision including a dot.
@param {string} precision Specifies floating point precision.
@param {string} type Type conversion specifier.
@param {string} offset Matching location in the original string.
@param {string} wholeString Has the actualString being searched.
@return {string} Formatted parameter. | [
"Chooses",
"which",
"conversion",
"function",
"to",
"call",
"based",
"on",
"type",
"conversion",
"specifier",
"."
] | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/closure/goog/string/stringformat.js#L66-L85 | train | This function is used to replace the % in a string. | [
30522,
3853,
5672,
25547,
12274,
2595,
2121,
1006,
2674,
1010,
9245,
1010,
9381,
1010,
11089,
2361,
1010,
11718,
1010,
2828,
1010,
16396,
1010,
2878,
3367,
4892,
1007,
1063,
1013,
1013,
1996,
1003,
2003,
2205,
3722,
1998,
2987,
1005,
1056,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 (mChangeListeners, sPath, oOldObject, oNewObject) {
if (!oNewObject) {
return;
}
// iterate over all properties in the old object
Object.keys(oOldObject).forEach(function (sProperty) {
var sPropertyPath = _Helper.buildPath(sPath, sProperty),
vOldProperty = oOldObject[sProperty],
vNewProperty;
if (sProperty in oNewObject || sProperty[0] === "#") {
// the property was patched
vNewProperty = oNewObject[sProperty];
if (vNewProperty && typeof vNewProperty === "object") {
if (Array.isArray(vNewProperty)) {
// copy complete collection; no change events as long as
// collection-valued properties are not supported
oOldObject[sProperty] = vNewProperty;
} else if (vOldProperty) {
// a structural property in cache and patch -> recursion
_Helper.updateExisting(mChangeListeners, sPropertyPath, vOldProperty,
vNewProperty);
} else {
// a structural property was added
oOldObject[sProperty] = vNewProperty;
_Helper.fireChanges(mChangeListeners, sPropertyPath, vNewProperty,
false);
}
} else if (vOldProperty && typeof vOldProperty === "object") {
// a structural property was removed
oOldObject[sProperty] = vNewProperty;
_Helper.fireChanges(mChangeListeners, sPropertyPath, vOldProperty, true);
} else {
// a primitive property
oOldObject[sProperty] = vNewProperty;
if (vOldProperty !== vNewProperty) {
_Helper.fireChange(mChangeListeners, sPropertyPath, vNewProperty);
}
}
}
});
// iterate over all new advertised actions
Object.keys(oNewObject).filter(function (sProperty) {
return sProperty[0] === "#";
}).filter(function (sAdvertisedAction) {
return !(sAdvertisedAction in oOldObject);
}).forEach(function (sNewAdvertisedAction) {
var vNewProperty = oNewObject[sNewAdvertisedAction],
sPropertyPath = _Helper.buildPath(sPath, sNewAdvertisedAction);
// a structural property was added
oOldObject[sNewAdvertisedAction] = vNewProperty;
_Helper.fireChanges(mChangeListeners, sPropertyPath, vNewProperty, false);
});
} | javascript | function (mChangeListeners, sPath, oOldObject, oNewObject) {
if (!oNewObject) {
return;
}
// iterate over all properties in the old object
Object.keys(oOldObject).forEach(function (sProperty) {
var sPropertyPath = _Helper.buildPath(sPath, sProperty),
vOldProperty = oOldObject[sProperty],
vNewProperty;
if (sProperty in oNewObject || sProperty[0] === "#") {
// the property was patched
vNewProperty = oNewObject[sProperty];
if (vNewProperty && typeof vNewProperty === "object") {
if (Array.isArray(vNewProperty)) {
// copy complete collection; no change events as long as
// collection-valued properties are not supported
oOldObject[sProperty] = vNewProperty;
} else if (vOldProperty) {
// a structural property in cache and patch -> recursion
_Helper.updateExisting(mChangeListeners, sPropertyPath, vOldProperty,
vNewProperty);
} else {
// a structural property was added
oOldObject[sProperty] = vNewProperty;
_Helper.fireChanges(mChangeListeners, sPropertyPath, vNewProperty,
false);
}
} else if (vOldProperty && typeof vOldProperty === "object") {
// a structural property was removed
oOldObject[sProperty] = vNewProperty;
_Helper.fireChanges(mChangeListeners, sPropertyPath, vOldProperty, true);
} else {
// a primitive property
oOldObject[sProperty] = vNewProperty;
if (vOldProperty !== vNewProperty) {
_Helper.fireChange(mChangeListeners, sPropertyPath, vNewProperty);
}
}
}
});
// iterate over all new advertised actions
Object.keys(oNewObject).filter(function (sProperty) {
return sProperty[0] === "#";
}).filter(function (sAdvertisedAction) {
return !(sAdvertisedAction in oOldObject);
}).forEach(function (sNewAdvertisedAction) {
var vNewProperty = oNewObject[sNewAdvertisedAction],
sPropertyPath = _Helper.buildPath(sPath, sNewAdvertisedAction);
// a structural property was added
oOldObject[sNewAdvertisedAction] = vNewProperty;
_Helper.fireChanges(mChangeListeners, sPropertyPath, vNewProperty, false);
});
} | [
"function",
"(",
"mChangeListeners",
",",
"sPath",
",",
"oOldObject",
",",
"oNewObject",
")",
"{",
"if",
"(",
"!",
"oNewObject",
")",
"{",
"return",
";",
"}",
"// iterate over all properties in the old object",
"Object",
".",
"keys",
"(",
"oOldObject",
")",
".",... | Updates the old object with the new object. Only existing properties of the old object
are updated. Fires change events for all changed properties. The function recursively
handles modified, added or removed structural properties and fires change events for all
modified/added/removed primitive properties therein. Collection-valued properties are
only updated in the old object, there are no change events for properties therein. Also
fires change events for new advertised actions.
@param {object} mChangeListeners A map of change listeners by path
@param {string} sPath The path of the old object in mChangeListeners
@param {object} oOldObject The old object
@param {object} [oNewObject] The new object | [
"Updates",
"the",
"old",
"object",
"with",
"the",
"new",
"object",
".",
"Only",
"existing",
"properties",
"of",
"the",
"old",
"object",
"are",
"updated",
".",
"Fires",
"change",
"events",
"for",
"all",
"changed",
"properties",
".",
"The",
"function",
"recurs... | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Helper.js#L1118-L1174 | train | Updates the properties in the new object | [
30522,
3853,
1006,
11338,
18003,
29282,
6528,
2545,
1010,
14690,
2232,
1010,
1051,
11614,
16429,
20614,
1010,
2028,
12155,
2497,
20614,
1007,
1063,
2065,
1006,
999,
2028,
12155,
2497,
20614,
1007,
1063,
2709,
1025,
1065,
1013,
1013,
2009,
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 | lib/jsdoc/transform-apijson-for-sdk.js | function (aEvents) {
var fnExtractParameterProperties = function (oParameter, aParameters, iDepth, aPhoneName) {
if (oParameter.parameterProperties) {
Object.keys(oParameter.parameterProperties).forEach(function (sProperty) {
var oProperty = oParameter.parameterProperties[sProperty],
sPhoneTypeSuffix;
oProperty.depth = iDepth;
// Phone name - available only for parameters
sPhoneTypeSuffix = oProperty.type === "array" ? "[]" : "";
oProperty.phoneName = [aPhoneName.join("."), (oProperty.name + sPhoneTypeSuffix)].join(".");
// Add property to parameter array as we need a simple structure
aParameters.push(oProperty);
// Handle child parameterProperties
fnExtractParameterProperties(oProperty, aParameters, (iDepth + 1),
aPhoneName.concat([oProperty.name + sPhoneTypeSuffix]));
});
// Keep file size in check
delete oParameter.parameterProperties;
}
};
aEvents.forEach(function (aEvents) {
// New array to hold modified parameters
var aParameters = [];
// Handle parameters
if (aEvents.parameters) {
aEvents.parameters.forEach(function (oParameter) {
// Add the parameter before the properties
aParameters.push(oParameter);
// Handle Parameter Properties
// Note: We flatten the structure
fnExtractParameterProperties(oParameter, aParameters, 1, [oParameter.name]);
});
// Override the old data
aEvents.parameters = aParameters;
}
});
} | javascript | function (aEvents) {
var fnExtractParameterProperties = function (oParameter, aParameters, iDepth, aPhoneName) {
if (oParameter.parameterProperties) {
Object.keys(oParameter.parameterProperties).forEach(function (sProperty) {
var oProperty = oParameter.parameterProperties[sProperty],
sPhoneTypeSuffix;
oProperty.depth = iDepth;
// Phone name - available only for parameters
sPhoneTypeSuffix = oProperty.type === "array" ? "[]" : "";
oProperty.phoneName = [aPhoneName.join("."), (oProperty.name + sPhoneTypeSuffix)].join(".");
// Add property to parameter array as we need a simple structure
aParameters.push(oProperty);
// Handle child parameterProperties
fnExtractParameterProperties(oProperty, aParameters, (iDepth + 1),
aPhoneName.concat([oProperty.name + sPhoneTypeSuffix]));
});
// Keep file size in check
delete oParameter.parameterProperties;
}
};
aEvents.forEach(function (aEvents) {
// New array to hold modified parameters
var aParameters = [];
// Handle parameters
if (aEvents.parameters) {
aEvents.parameters.forEach(function (oParameter) {
// Add the parameter before the properties
aParameters.push(oParameter);
// Handle Parameter Properties
// Note: We flatten the structure
fnExtractParameterProperties(oParameter, aParameters, 1, [oParameter.name]);
});
// Override the old data
aEvents.parameters = aParameters;
}
});
} | [
"function",
"(",
"aEvents",
")",
"{",
"var",
"fnExtractParameterProperties",
"=",
"function",
"(",
"oParameter",
",",
"aParameters",
",",
"iDepth",
",",
"aPhoneName",
")",
"{",
"if",
"(",
"oParameter",
".",
"parameterProperties",
")",
"{",
"Object",
".",
"keys... | Adjusts events info so that it can be easily displayed in a table
@param {Array} aEvents - the events array initially coming from the server | [
"Adjusts",
"events",
"info",
"so",
"that",
"it",
"can",
"be",
"easily",
"displayed",
"in",
"a",
"table"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/lib/jsdoc/transform-apijson-for-sdk.js#L1871-L1915 | train | This function is called when the event is added to the event list | [
30522,
3853,
1006,
29347,
15338,
2015,
1007,
1063,
13075,
1042,
2638,
18413,
22648,
25856,
5400,
22828,
21572,
4842,
7368,
1027,
3853,
1006,
6728,
5400,
22828,
1010,
9706,
5400,
22828,
2015,
1010,
8909,
23606,
2232,
1010,
9706,
27406,
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... | |
uber/deck.gl | modules/layers/src/solid-polygon-layer/polygon.js | getFlatVertexCount | function getFlatVertexCount(positions, size, startIndex = 0, endIndex) {
endIndex = endIndex || positions.length;
if (startIndex >= endIndex) {
return 0;
}
return (
(isFlatRingClosed(positions, size, startIndex, endIndex) ? 0 : 1) +
(endIndex - startIndex) / size
);
} | javascript | function getFlatVertexCount(positions, size, startIndex = 0, endIndex) {
endIndex = endIndex || positions.length;
if (startIndex >= endIndex) {
return 0;
}
return (
(isFlatRingClosed(positions, size, startIndex, endIndex) ? 0 : 1) +
(endIndex - startIndex) / size
);
} | [
"function",
"getFlatVertexCount",
"(",
"positions",
",",
"size",
",",
"startIndex",
"=",
"0",
",",
"endIndex",
")",
"{",
"endIndex",
"=",
"endIndex",
"||",
"positions",
".",
"length",
";",
"if",
"(",
"startIndex",
">=",
"endIndex",
")",
"{",
"return",
"0",... | Counts the number of vertices in a simple flat array, closes the polygon if needed.
@param {Array} positions - array of numbers
@param {Number} size - size of a position, 2 (xy) or 3 (xyz)
@param {Number} [startIndex] - start index of the path in the positions array
@param {Number} [endIndex] - end index of the path in the positions array
@returns {Number} vertex count | [
"Counts",
"the",
"number",
"of",
"vertices",
"in",
"a",
"simple",
"flat",
"array",
"closes",
"the",
"polygon",
"if",
"needed",
"."
] | a2010448b7f268bbd03617b812334c68a6b9e5b2 | https://github.com/uber/deck.gl/blob/a2010448b7f268bbd03617b812334c68a6b9e5b2/modules/layers/src/solid-polygon-layer/polygon.js#L154-L163 | train | Get the number of vertices in a flat ring | [
30522,
3853,
2131,
10258,
4017,
16874,
10288,
3597,
16671,
1006,
4460,
1010,
2946,
1010,
2707,
22254,
10288,
1027,
1014,
1010,
2203,
22254,
10288,
1007,
1063,
2203,
22254,
10288,
1027,
2203,
22254,
10288,
1064,
1064,
4460,
1012,
3091,
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... |
angular/material | src/core/services/interimElement/interimElement.js | transitionOutAndRemove | function transitionOutAndRemove(response, isCancelled, opts) {
// abort if the show() and compile failed
if (!element) return $q.when(false);
options = angular.extend(options || {}, opts || {});
options.cancelAutoHide && options.cancelAutoHide();
options.element.triggerHandler('$mdInterimElementRemove');
if (options.$destroy === true) {
return hideElement(options.element, options).then(function(){
(isCancelled && rejectAll(response)) || resolveAll(response);
});
} else {
$q.when(showAction).finally(function() {
hideElement(options.element, options).then(function() {
isCancelled ? rejectAll(response) : resolveAll(response);
}, rejectAll);
});
return self.deferred.promise;
}
/**
* The `show()` returns a promise that will be resolved when the interim
* element is hidden or cancelled...
*/
function resolveAll(response) {
self.deferred.resolve(response);
}
/**
* Force the '$md<xxx>.show()' promise to reject
*/
function rejectAll(fault) {
self.deferred.reject(fault);
}
} | javascript | function transitionOutAndRemove(response, isCancelled, opts) {
// abort if the show() and compile failed
if (!element) return $q.when(false);
options = angular.extend(options || {}, opts || {});
options.cancelAutoHide && options.cancelAutoHide();
options.element.triggerHandler('$mdInterimElementRemove');
if (options.$destroy === true) {
return hideElement(options.element, options).then(function(){
(isCancelled && rejectAll(response)) || resolveAll(response);
});
} else {
$q.when(showAction).finally(function() {
hideElement(options.element, options).then(function() {
isCancelled ? rejectAll(response) : resolveAll(response);
}, rejectAll);
});
return self.deferred.promise;
}
/**
* The `show()` returns a promise that will be resolved when the interim
* element is hidden or cancelled...
*/
function resolveAll(response) {
self.deferred.resolve(response);
}
/**
* Force the '$md<xxx>.show()' promise to reject
*/
function rejectAll(fault) {
self.deferred.reject(fault);
}
} | [
"function",
"transitionOutAndRemove",
"(",
"response",
",",
"isCancelled",
",",
"opts",
")",
"{",
"// abort if the show() and compile failed",
"if",
"(",
"!",
"element",
")",
"return",
"$q",
".",
"when",
"(",
"false",
")",
";",
"options",
"=",
"angular",
".",
... | After the show process has finished/rejected:
- announce 'removing',
- perform the transition-out, and
- perform optional clean up scope. | [
"After",
"the",
"show",
"process",
"has",
"finished",
"/",
"rejected",
":",
"-",
"announce",
"removing",
"-",
"perform",
"the",
"transition",
"-",
"out",
"and",
"-",
"perform",
"optional",
"clean",
"up",
"scope",
"."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/services/interimElement/interimElement.js#L526-L566 | train | transition out and remove | [
30522,
3853,
6653,
5833,
5685,
28578,
21818,
1006,
3433,
1010,
2003,
9336,
29109,
3709,
1010,
23569,
2015,
1007,
1063,
1013,
1013,
11113,
11589,
2065,
1996,
2265,
1006,
1007,
1998,
4012,
22090,
3478,
2065,
1006,
999,
5783,
1007,
2709,
1002,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
websockets/ws | lib/buffer-util.js | concat | function concat(list, totalLength) {
if (list.length === 0) return EMPTY_BUFFER;
if (list.length === 1) return list[0];
const target = Buffer.allocUnsafe(totalLength);
let offset = 0;
for (let i = 0; i < list.length; i++) {
const buf = list[i];
buf.copy(target, offset);
offset += buf.length;
}
return target;
} | javascript | function concat(list, totalLength) {
if (list.length === 0) return EMPTY_BUFFER;
if (list.length === 1) return list[0];
const target = Buffer.allocUnsafe(totalLength);
let offset = 0;
for (let i = 0; i < list.length; i++) {
const buf = list[i];
buf.copy(target, offset);
offset += buf.length;
}
return target;
} | [
"function",
"concat",
"(",
"list",
",",
"totalLength",
")",
"{",
"if",
"(",
"list",
".",
"length",
"===",
"0",
")",
"return",
"EMPTY_BUFFER",
";",
"if",
"(",
"list",
".",
"length",
"===",
"1",
")",
"return",
"list",
"[",
"0",
"]",
";",
"const",
"ta... | Merges an array of buffers into a new buffer.
@param {Buffer[]} list The array of buffers to concat
@param {Number} totalLength The total length of buffers in the list
@return {Buffer} The resulting buffer
@public | [
"Merges",
"an",
"array",
"of",
"buffers",
"into",
"a",
"new",
"buffer",
"."
] | 995c527c87d0d4833d8093c18dcfa2e4a41d9582 | https://github.com/websockets/ws/blob/995c527c87d0d4833d8093c18dcfa2e4a41d9582/lib/buffer-util.js#L13-L27 | train | Concat a list of buffers into a new buffer | [
30522,
3853,
9530,
11266,
1006,
2862,
1010,
2561,
7770,
13512,
2232,
1007,
1063,
2065,
1006,
2862,
1012,
3091,
1027,
1027,
1027,
1014,
1007,
2709,
4064,
1035,
17698,
1025,
2065,
1006,
2862,
1012,
3091,
1027,
1027,
1027,
1015,
1007,
2709,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/main.js | prepareEditorForProvider | function prepareEditorForProvider(hostEditor, pos) {
var cursorLine, sel, startPos, endPos, startBookmark, endBookmark, currentMatch,
cm = hostEditor._codeMirror;
sel = hostEditor.getSelection();
if (sel.start.line !== sel.end.line) {
return {timingFunction: null, reason: null};
}
cursorLine = hostEditor.document.getLine(pos.line);
// code runs several matches complicated patterns, multiple times, so
// first do a quick, simple check to see make sure we may have a match
if (!cursorLine.match(/cubic-bezier|linear|ease|step/)) {
return {timingFunction: null, reason: null};
}
currentMatch = TimingFunctionUtils.timingFunctionMatch(cursorLine, false);
if (!currentMatch) {
return {timingFunction: null, reason: Strings.ERROR_TIMINGQUICKEDIT_INVALIDSYNTAX};
}
// check for subsequent matches, and use first match after pos
var lineOffset = 0,
matchLength = ((currentMatch.originalString && currentMatch.originalString.length) || currentMatch[0].length);
while (pos.ch > (currentMatch.index + matchLength + lineOffset)) {
var restOfLine = cursorLine.substring(currentMatch.index + matchLength + lineOffset),
newMatch = TimingFunctionUtils.timingFunctionMatch(restOfLine, false);
if (newMatch) {
lineOffset += (currentMatch.index + matchLength);
currentMatch = $.extend(true, [], newMatch);
} else {
break;
}
}
currentMatch.lineOffset = lineOffset;
startPos = {line: pos.line, ch: lineOffset + currentMatch.index};
endPos = {line: pos.line, ch: lineOffset + currentMatch.index + matchLength};
startBookmark = cm.setBookmark(startPos);
endBookmark = cm.setBookmark(endPos);
// Adjust selection to the match so that the inline editor won't
// get dismissed while we're updating the timing function.
hostEditor.setSelection(startPos, endPos);
return {
timingFunction: currentMatch,
start: startBookmark,
end: endBookmark
};
} | javascript | function prepareEditorForProvider(hostEditor, pos) {
var cursorLine, sel, startPos, endPos, startBookmark, endBookmark, currentMatch,
cm = hostEditor._codeMirror;
sel = hostEditor.getSelection();
if (sel.start.line !== sel.end.line) {
return {timingFunction: null, reason: null};
}
cursorLine = hostEditor.document.getLine(pos.line);
// code runs several matches complicated patterns, multiple times, so
// first do a quick, simple check to see make sure we may have a match
if (!cursorLine.match(/cubic-bezier|linear|ease|step/)) {
return {timingFunction: null, reason: null};
}
currentMatch = TimingFunctionUtils.timingFunctionMatch(cursorLine, false);
if (!currentMatch) {
return {timingFunction: null, reason: Strings.ERROR_TIMINGQUICKEDIT_INVALIDSYNTAX};
}
// check for subsequent matches, and use first match after pos
var lineOffset = 0,
matchLength = ((currentMatch.originalString && currentMatch.originalString.length) || currentMatch[0].length);
while (pos.ch > (currentMatch.index + matchLength + lineOffset)) {
var restOfLine = cursorLine.substring(currentMatch.index + matchLength + lineOffset),
newMatch = TimingFunctionUtils.timingFunctionMatch(restOfLine, false);
if (newMatch) {
lineOffset += (currentMatch.index + matchLength);
currentMatch = $.extend(true, [], newMatch);
} else {
break;
}
}
currentMatch.lineOffset = lineOffset;
startPos = {line: pos.line, ch: lineOffset + currentMatch.index};
endPos = {line: pos.line, ch: lineOffset + currentMatch.index + matchLength};
startBookmark = cm.setBookmark(startPos);
endBookmark = cm.setBookmark(endPos);
// Adjust selection to the match so that the inline editor won't
// get dismissed while we're updating the timing function.
hostEditor.setSelection(startPos, endPos);
return {
timingFunction: currentMatch,
start: startBookmark,
end: endBookmark
};
} | [
"function",
"prepareEditorForProvider",
"(",
"hostEditor",
",",
"pos",
")",
"{",
"var",
"cursorLine",
",",
"sel",
",",
"startPos",
",",
"endPos",
",",
"startBookmark",
",",
"endBookmark",
",",
"currentMatch",
",",
"cm",
"=",
"hostEditor",
".",
"_codeMirror",
"... | Functions
Prepare hostEditor for an InlineTimingFunctionEditor at pos if possible.
Return editor context if so; otherwise null.
@param {Editor} hostEditor
@param {{line:Number, ch:Number}} pos
@return {timingFunction:{?string}, reason:{?string}, start:{?TextMarker}, end:{?TextMarker}} | [
"Functions",
"Prepare",
"hostEditor",
"for",
"an",
"InlineTimingFunctionEditor",
"at",
"pos",
"if",
"possible",
".",
"Return",
"editor",
"context",
"if",
"so",
";",
"otherwise",
"null",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/InlineTimingFunctionEditor/main.js#L68-L122 | train | prepareEditorForProvider - prepare editor for provider | [
30522,
3853,
7374,
2098,
15660,
29278,
21572,
17258,
2121,
1006,
4354,
15660,
1010,
13433,
2015,
1007,
1063,
13075,
12731,
25301,
19403,
2063,
1010,
7367,
2140,
1010,
2707,
6873,
2015,
1010,
2203,
6873,
2015,
1010,
2707,
8654,
10665,
1010,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.fl/src/sap/ui/fl/Utils.js | function (oControl) {
var oMetadata;
if (oControl && typeof oControl.getMetadata === "function") {
oMetadata = oControl.getMetadata();
if (oMetadata && typeof oMetadata.getElementName === "function") {
return oMetadata.getElementName();
}
}
} | javascript | function (oControl) {
var oMetadata;
if (oControl && typeof oControl.getMetadata === "function") {
oMetadata = oControl.getMetadata();
if (oMetadata && typeof oMetadata.getElementName === "function") {
return oMetadata.getElementName();
}
}
} | [
"function",
"(",
"oControl",
")",
"{",
"var",
"oMetadata",
";",
"if",
"(",
"oControl",
"&&",
"typeof",
"oControl",
".",
"getMetadata",
"===",
"\"function\"",
")",
"{",
"oMetadata",
"=",
"oControl",
".",
"getMetadata",
"(",
")",
";",
"if",
"(",
"oMetadata",... | Retrieves the controlType of the control
@param {sap.ui.core.Control} oControl Control instance
@returns {string} control type of the control - undefined if controlType cannot be determined
@private | [
"Retrieves",
"the",
"controlType",
"of",
"the",
"control"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/Utils.js#L800-L808 | train | Returns the name of the metadata of the control. | [
30522,
3853,
1006,
1051,
30524,
1012,
2131,
11368,
8447,
2696,
1006,
1007,
1025,
2065,
1006,
18168,
12928,
2850,
2696,
1004,
1004,
2828,
11253,
18168,
12928,
2850,
2696,
1012,
2131,
12260,
3672,
18442,
1027,
1027,
1027,
1000,
3853,
1000,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
tensorflow/tfjs-models | speech-commands/demo/index.js | scrollToPageBottom | function scrollToPageBottom() {
const scrollingElement = (document.scrollingElement || document.body);
scrollingElement.scrollTop = scrollingElement.scrollHeight;
} | javascript | function scrollToPageBottom() {
const scrollingElement = (document.scrollingElement || document.body);
scrollingElement.scrollTop = scrollingElement.scrollHeight;
} | [
"function",
"scrollToPageBottom",
"(",
")",
"{",
"const",
"scrollingElement",
"=",
"(",
"document",
".",
"scrollingElement",
"||",
"document",
".",
"body",
")",
";",
"scrollingElement",
".",
"scrollTop",
"=",
"scrollingElement",
".",
"scrollHeight",
";",
"}"
] | Transfer learning logic.
Scroll to the bottom of the page | [
"Transfer",
"learning",
"logic",
".",
"Scroll",
"to",
"the",
"bottom",
"of",
"the",
"page"
] | af194797c90cc5bcac1060d3cd41b0258a34c7dc | https://github.com/tensorflow/tfjs-models/blob/af194797c90cc5bcac1060d3cd41b0258a34c7dc/speech-commands/demo/index.js#L162-L165 | train | Scrolls to the bottom of the page | [
30522,
3853,
17186,
14399,
4270,
18384,
20389,
1006,
1007,
1063,
9530,
3367,
28903,
12260,
3672,
1027,
1006,
6254,
1012,
28903,
12260,
3672,
1064,
1064,
6254,
1012,
2303,
1007,
1025,
28903,
12260,
3672,
1012,
17186,
14399,
1027,
28903,
12260,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | _pointKeyDown | function _pointKeyDown(e) {
var code = e.keyCode,
self = e.target,
bezierEditor = self.bezierEditor;
if (code >= KeyEvent.DOM_VK_LEFT && code <= KeyEvent.DOM_VK_DOWN) {
e.preventDefault();
// Arrow keys pressed
var $this = $(e.target),
left = parseInt($this.css("left"), 10),
top = parseInt($this.css("top"), 10),
offset = (e.shiftKey ? 15 : 3),
newVal;
switch (code) {
case KeyEvent.DOM_VK_LEFT:
newVal = Math.max(0, left - offset);
if (left === newVal) {
return false;
}
$this.css({ left: newVal + "px" });
break;
case KeyEvent.DOM_VK_UP:
newVal = Math.max(-HEIGHT_ABOVE, top - offset);
if (top === newVal) {
return false;
}
$this.css({ top: newVal + "px" });
break;
case KeyEvent.DOM_VK_RIGHT:
newVal = Math.min(WIDTH_MAIN, left + offset);
if (left === newVal) {
return false;
}
$this.css({ left: newVal + "px" });
break;
case KeyEvent.DOM_VK_DOWN:
newVal = Math.min(HEIGHT_MAIN + HEIGHT_BELOW, top + offset);
if (top === newVal) {
return false;
}
$this.css({ top: newVal + "px" });
break;
}
// update coords
bezierEditor._cubicBezierCoords = bezierEditor.bezierCanvas
.offsetsToCoordinates(bezierEditor.P1)
.concat(bezierEditor.bezierCanvas.offsetsToCoordinates(bezierEditor.P2));
bezierEditor._commitTimingFunction();
bezierEditor._updateCanvas();
return true;
} else if (code === KeyEvent.DOM_VK_ESCAPE) {
return true;
} else if (code === KeyEvent.DOM_VK_TAB && !e.ctrlKey && !e.metaKey && !e.altKey) {
// Switch between the two points by tabbing
if ($(e.target).hasClass("P1")) {
$(".P2").focus();
} else {
$(".P1").focus();
}
e.preventDefault();
return true;
}
return false;
} | javascript | function _pointKeyDown(e) {
var code = e.keyCode,
self = e.target,
bezierEditor = self.bezierEditor;
if (code >= KeyEvent.DOM_VK_LEFT && code <= KeyEvent.DOM_VK_DOWN) {
e.preventDefault();
// Arrow keys pressed
var $this = $(e.target),
left = parseInt($this.css("left"), 10),
top = parseInt($this.css("top"), 10),
offset = (e.shiftKey ? 15 : 3),
newVal;
switch (code) {
case KeyEvent.DOM_VK_LEFT:
newVal = Math.max(0, left - offset);
if (left === newVal) {
return false;
}
$this.css({ left: newVal + "px" });
break;
case KeyEvent.DOM_VK_UP:
newVal = Math.max(-HEIGHT_ABOVE, top - offset);
if (top === newVal) {
return false;
}
$this.css({ top: newVal + "px" });
break;
case KeyEvent.DOM_VK_RIGHT:
newVal = Math.min(WIDTH_MAIN, left + offset);
if (left === newVal) {
return false;
}
$this.css({ left: newVal + "px" });
break;
case KeyEvent.DOM_VK_DOWN:
newVal = Math.min(HEIGHT_MAIN + HEIGHT_BELOW, top + offset);
if (top === newVal) {
return false;
}
$this.css({ top: newVal + "px" });
break;
}
// update coords
bezierEditor._cubicBezierCoords = bezierEditor.bezierCanvas
.offsetsToCoordinates(bezierEditor.P1)
.concat(bezierEditor.bezierCanvas.offsetsToCoordinates(bezierEditor.P2));
bezierEditor._commitTimingFunction();
bezierEditor._updateCanvas();
return true;
} else if (code === KeyEvent.DOM_VK_ESCAPE) {
return true;
} else if (code === KeyEvent.DOM_VK_TAB && !e.ctrlKey && !e.metaKey && !e.altKey) {
// Switch between the two points by tabbing
if ($(e.target).hasClass("P1")) {
$(".P2").focus();
} else {
$(".P1").focus();
}
e.preventDefault();
return true;
}
return false;
} | [
"function",
"_pointKeyDown",
"(",
"e",
")",
"{",
"var",
"code",
"=",
"e",
".",
"keyCode",
",",
"self",
"=",
"e",
".",
"target",
",",
"bezierEditor",
"=",
"self",
".",
"bezierEditor",
";",
"if",
"(",
"code",
">=",
"KeyEvent",
".",
"DOM_VK_LEFT",
"&&",
... | Handle key down in <button> element
@param {Event} e Key down event | [
"Handle",
"key",
"down",
"in",
"<button",
">",
"element"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/InlineTimingFunctionEditor/BezierCurveEditor.js#L435-L504 | train | Point key down | [
30522,
3853,
1035,
2391,
14839,
7698,
1006,
1041,
1007,
1063,
13075,
3642,
1027,
1041,
1012,
3145,
16044,
1010,
2969,
1027,
1041,
1012,
4539,
1010,
2022,
21548,
2098,
15660,
1027,
2969,
1012,
2022,
21548,
2098,
15660,
1025,
2065,
1006,
3642... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SeleniumHQ/selenium | javascript/selenium-core/scripts/htmlutils.js | function( event ) {
// Check if mouse(over|out) are still within the same parent element
var parent = event.relatedTarget;
// Traverse up the tree
while ( parent && parent !== this ) {
// Firefox sometimes assigns relatedTarget a XUL element
// which we cannot access the parentNode property of
try {
parent = parent.parentNode;
// assuming we've left the element since we most likely mousedover a xul element
} catch(e) {
break;
}
}
if ( parent !== this ) {
// set the correct event type
event.type = event.data;
// handle event if we actually just moused on to a non sub-element
jQuery.event.handle.apply( this, arguments );
}
} | javascript | function( event ) {
// Check if mouse(over|out) are still within the same parent element
var parent = event.relatedTarget;
// Traverse up the tree
while ( parent && parent !== this ) {
// Firefox sometimes assigns relatedTarget a XUL element
// which we cannot access the parentNode property of
try {
parent = parent.parentNode;
// assuming we've left the element since we most likely mousedover a xul element
} catch(e) {
break;
}
}
if ( parent !== this ) {
// set the correct event type
event.type = event.data;
// handle event if we actually just moused on to a non sub-element
jQuery.event.handle.apply( this, arguments );
}
} | [
"function",
"(",
"event",
")",
"{",
"// Check if mouse(over|out) are still within the same parent element",
"var",
"parent",
"=",
"event",
".",
"relatedTarget",
";",
"// Traverse up the tree",
"while",
"(",
"parent",
"&&",
"parent",
"!==",
"this",
")",
"{",
"// Firefox ... | Checks if an event happened on an element within another element Used in jQuery.event.special.mouseenter and mouseleave handlers | [
"Checks",
"if",
"an",
"event",
"happened",
"on",
"an",
"element",
"within",
"another",
"element",
"Used",
"in",
"jQuery",
".",
"event",
".",
"special",
".",
"mouseenter",
"and",
"mouseleave",
"handlers"
] | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/selenium-core/scripts/htmlutils.js#L4697-L4722 | train | The event handler for the mouseover event | [
30522,
3853,
1006,
2724,
1007,
1063,
1013,
1013,
4638,
2065,
8000,
1006,
2058,
1064,
2041,
1007,
2024,
2145,
2306,
1996,
2168,
6687,
5783,
13075,
6687,
1027,
2724,
1012,
3141,
7559,
18150,
1025,
1013,
1013,
20811,
2039,
1996,
3392,
2096,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | src/sap.ui.core/src/sap/ui/core/cache/LRUPersistentCache.js | cloneMetadata | function cloneMetadata(source) {
var backupMetadata = initMetadata(source.__ui5version);
for (var index in source.__byIndex__) {
backupMetadata.__byIndex__[index] = source.__byIndex__[index];
}
for (var key in source.__byKey__) {
backupMetadata.__byKey__[key] = source.__byKey__[key];
}
return backupMetadata;
} | javascript | function cloneMetadata(source) {
var backupMetadata = initMetadata(source.__ui5version);
for (var index in source.__byIndex__) {
backupMetadata.__byIndex__[index] = source.__byIndex__[index];
}
for (var key in source.__byKey__) {
backupMetadata.__byKey__[key] = source.__byKey__[key];
}
return backupMetadata;
} | [
"function",
"cloneMetadata",
"(",
"source",
")",
"{",
"var",
"backupMetadata",
"=",
"initMetadata",
"(",
"source",
".",
"__ui5version",
")",
";",
"for",
"(",
"var",
"index",
"in",
"source",
".",
"__byIndex__",
")",
"{",
"backupMetadata",
".",
"__byIndex__",
... | Clones a given metadata instance
@param source the instance to clone
@returns {*} cloned metadata | [
"Clones",
"a",
"given",
"metadata",
"instance"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/cache/LRUPersistentCache.js#L722-L731 | train | Clone metadata from source | [
30522,
3853,
17598,
11368,
8447,
2696,
1006,
3120,
1007,
1063,
13075,
10200,
11368,
8447,
2696,
1027,
1999,
4183,
11368,
8447,
2696,
1006,
3120,
1012,
1035,
1035,
21318,
2629,
27774,
1007,
1025,
2005,
1006,
13075,
5950,
1999,
3120,
1012,
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... |
getinsomnia/insomnia | packages/insomnia-importers/src/importers/swagger2.js | generateParameterExample | function generateParameterExample(schema) {
const typeExamples = {
string: () => 'string',
string_email: () => 'user@example.com',
'string_date-time': () => new Date().toISOString(),
string_byte: () => 'ZXhhbXBsZQ==',
number: () => 0,
number_float: () => 0.0,
number_double: () => 0.0,
integer: () => 0,
boolean: () => true,
object: schema => {
const example = {};
const { properties } = schema;
Object.keys(properties).forEach(propertyName => {
example[propertyName] = generateParameterExample(properties[propertyName]);
});
return example;
},
array: schema => {
const value = generateParameterExample(schema.items);
if (schema.collectionFormat === 'csv') {
return value;
} else {
return [value];
}
},
};
if (typeof schema === 'string') {
return typeExamples[schema];
}
if (schema instanceof Object) {
const { type, format, example, default: defaultValue } = schema;
if (example) {
return example;
}
if (defaultValue) {
return defaultValue;
}
const factory = typeExamples[`${type}_${format}`] || typeExamples[type];
if (!factory) {
return null;
}
return factory(schema);
}
} | javascript | function generateParameterExample(schema) {
const typeExamples = {
string: () => 'string',
string_email: () => 'user@example.com',
'string_date-time': () => new Date().toISOString(),
string_byte: () => 'ZXhhbXBsZQ==',
number: () => 0,
number_float: () => 0.0,
number_double: () => 0.0,
integer: () => 0,
boolean: () => true,
object: schema => {
const example = {};
const { properties } = schema;
Object.keys(properties).forEach(propertyName => {
example[propertyName] = generateParameterExample(properties[propertyName]);
});
return example;
},
array: schema => {
const value = generateParameterExample(schema.items);
if (schema.collectionFormat === 'csv') {
return value;
} else {
return [value];
}
},
};
if (typeof schema === 'string') {
return typeExamples[schema];
}
if (schema instanceof Object) {
const { type, format, example, default: defaultValue } = schema;
if (example) {
return example;
}
if (defaultValue) {
return defaultValue;
}
const factory = typeExamples[`${type}_${format}`] || typeExamples[type];
if (!factory) {
return null;
}
return factory(schema);
}
} | [
"function",
"generateParameterExample",
"(",
"schema",
")",
"{",
"const",
"typeExamples",
"=",
"{",
"string",
":",
"(",
")",
"=>",
"'string'",
",",
"string_email",
":",
"(",
")",
"=>",
"'user@example.com'",
",",
"'string_date-time'",
":",
"(",
")",
"=>",
"ne... | Generate example value of parameter based on it's schema.
Returns example / default value of the parameter, if any of those are defined. If not, returns value based on parameter type.
@param {string|Object} schema - Swagger 2.0 parameter definition object
(https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#parametersDefinitionsObject) or string with valid parameter type
@returns {*} | [
"Generate",
"example",
"value",
"of",
"parameter",
"based",
"on",
"it",
"s",
"schema",
".",
"Returns",
"example",
"/",
"default",
"value",
"of",
"the",
"parameter",
"if",
"any",
"of",
"those",
"are",
"defined",
".",
"If",
"not",
"returns",
"value",
"based"... | e24ce7f7b41246e700c4b9bdb6b34b6652ad589b | https://github.com/getinsomnia/insomnia/blob/e24ce7f7b41246e700c4b9bdb6b34b6652ad589b/packages/insomnia-importers/src/importers/swagger2.js#L281-L335 | train | Generates a parameter example from a schema | [
30522,
3853,
9699,
28689,
22828,
10288,
16613,
2571,
1006,
8040,
28433,
1007,
1063,
9530,
3367,
2828,
10288,
16613,
4244,
1027,
1063,
5164,
1024,
1006,
1007,
1027,
1028,
1005,
5164,
1005,
1010,
5164,
1035,
10373,
1024,
1006,
1007,
1027,
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.documentation/src/sap/ui/documentation/sdk/controller/TopicDetailInitial.controller.js | function () {
var oVersionModel = this.getModel("versionData"),
bIsDevVersion = oVersionModel.getProperty('/isDevVersion'),
bIsOpenUI5 = oVersionModel.getProperty('/isOpenUI5');
if (bIsOpenUI5) {
return 'https://help.sap.com/OpenUI5_PDF/OpenUI5.pdf';
}
return bIsDevVersion ? 'https://help.sap.com/DRAFT/SAPUI5_Internal_PDF/SAPUI5_Internal.pdf' : 'https://help.sap.com/SAPUI5_PDF/SAPUI5.pdf';
} | javascript | function () {
var oVersionModel = this.getModel("versionData"),
bIsDevVersion = oVersionModel.getProperty('/isDevVersion'),
bIsOpenUI5 = oVersionModel.getProperty('/isOpenUI5');
if (bIsOpenUI5) {
return 'https://help.sap.com/OpenUI5_PDF/OpenUI5.pdf';
}
return bIsDevVersion ? 'https://help.sap.com/DRAFT/SAPUI5_Internal_PDF/SAPUI5_Internal.pdf' : 'https://help.sap.com/SAPUI5_PDF/SAPUI5.pdf';
} | [
"function",
"(",
")",
"{",
"var",
"oVersionModel",
"=",
"this",
".",
"getModel",
"(",
"\"versionData\"",
")",
",",
"bIsDevVersion",
"=",
"oVersionModel",
".",
"getProperty",
"(",
"'/isDevVersion'",
")",
",",
"bIsOpenUI5",
"=",
"oVersionModel",
".",
"getProperty"... | Determines the downloaded PDF's file location.
@returns {string} The location of the PDF file
@private | [
"Determines",
"the",
"downloaded",
"PDF",
"s",
"file",
"location",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/TopicDetailInitial.controller.js#L83-L93 | train | Returns the url of the PDF file | [
30522,
3853,
1006,
1007,
1063,
13075,
15849,
3258,
5302,
9247,
1027,
2023,
1012,
2131,
5302,
9247,
1006,
1000,
2544,
2850,
2696,
1000,
1007,
1010,
20377,
24844,
27774,
1027,
15849,
3258,
5302,
9247,
1012,
2131,
21572,
4842,
3723,
1006,
1005... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | src/sap.ui.core/src/sap/ui/dom/units/Rem.js | function(vPx) {
assert(((typeof vPx === "string") && (vPx !== "") && !isNaN(parseFloat(vPx)) && (typeof parseFloat(vPx) === "number")) || ((typeof vPx === "number") && !isNaN(vPx)), 'Rem.fromPx: either the "vPx" parameter must be an integer, or a string e.g.: "16px"');
return parseFloat(vPx) / getRootFontSize();
} | javascript | function(vPx) {
assert(((typeof vPx === "string") && (vPx !== "") && !isNaN(parseFloat(vPx)) && (typeof parseFloat(vPx) === "number")) || ((typeof vPx === "number") && !isNaN(vPx)), 'Rem.fromPx: either the "vPx" parameter must be an integer, or a string e.g.: "16px"');
return parseFloat(vPx) / getRootFontSize();
} | [
"function",
"(",
"vPx",
")",
"{",
"assert",
"(",
"(",
"(",
"typeof",
"vPx",
"===",
"\"string\"",
")",
"&&",
"(",
"vPx",
"!==",
"\"\"",
")",
"&&",
"!",
"isNaN",
"(",
"parseFloat",
"(",
"vPx",
")",
")",
"&&",
"(",
"typeof",
"parseFloat",
"(",
"vPx",
... | Convert <code>px</code> values to <code>rem</code>.
@param {string|float} vPx The value in <code>px</code> units. E.g.: <code>"16px"</code> or <code>16</code>
@returns {float} The converted value in <code>rem</code> units. E.g.: <code>1</code>
@private
@ui5-restricted sap.m | [
"Convert",
"<code",
">",
"px<",
"/",
"code",
">",
"values",
"to",
"<code",
">",
"rem<",
"/",
"code",
">",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/dom/units/Rem.js#L38-L41 | train | Converts a px value to a pixel value | [
30522,
3853,
1006,
21210,
2595,
1007,
1063,
20865,
1006,
1006,
1006,
2828,
11253,
21210,
2595,
1027,
1027,
1027,
1000,
5164,
1000,
1007,
1004,
1004,
1006,
21210,
2595,
999,
1027,
1027,
1000,
1000,
1007,
1004,
1004,
999,
3475,
2319,
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/rules/padding-line-between-statements.js | match | function match(node, type) {
let innerStatementNode = node;
while (innerStatementNode.type === "LabeledStatement") {
innerStatementNode = innerStatementNode.body;
}
if (Array.isArray(type)) {
return type.some(match.bind(null, innerStatementNode));
}
return StatementTypes[type].test(innerStatementNode, sourceCode);
} | javascript | function match(node, type) {
let innerStatementNode = node;
while (innerStatementNode.type === "LabeledStatement") {
innerStatementNode = innerStatementNode.body;
}
if (Array.isArray(type)) {
return type.some(match.bind(null, innerStatementNode));
}
return StatementTypes[type].test(innerStatementNode, sourceCode);
} | [
"function",
"match",
"(",
"node",
",",
"type",
")",
"{",
"let",
"innerStatementNode",
"=",
"node",
";",
"while",
"(",
"innerStatementNode",
".",
"type",
"===",
"\"LabeledStatement\"",
")",
"{",
"innerStatementNode",
"=",
"innerStatementNode",
".",
"body",
";",
... | Checks whether the given node matches the given type.
@param {ASTNode} node The statement node to check.
@param {string|string[]} type The statement type to check.
@returns {boolean} `true` if the statement node matched the type.
@private | [
"Checks",
"whether",
"the",
"given",
"node",
"matches",
"the",
"given",
"type",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/padding-line-between-statements.js#L520-L530 | train | Check if node matches type | [
30522,
3853,
2674,
1006,
13045,
1010,
2828,
1007,
1063,
2292,
5110,
9153,
18532,
4765,
3630,
3207,
1027,
13045,
1025,
2096,
1006,
5110,
9153,
18532,
4765,
3630,
3207,
1012,
2828,
1027,
1027,
1027,
1000,
12599,
9153,
18532,
4765,
1000,
1007,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/base/ExpressionParser.js | advance | function advance(sExpectedTokenId) {
var oToken = aTokens[iNextToken];
if (sExpectedTokenId) {
if (!oToken) {
error("Expected " + sExpectedTokenId + " but instead saw end of input",
sInput);
} else if (oToken.id !== sExpectedTokenId) {
error("Expected " + sExpectedTokenId + " but instead saw "
+ sInput.slice(oToken.start, oToken.end),
sInput,
oToken.start + 1);
}
}
iNextToken += 1;
return oToken;
} | javascript | function advance(sExpectedTokenId) {
var oToken = aTokens[iNextToken];
if (sExpectedTokenId) {
if (!oToken) {
error("Expected " + sExpectedTokenId + " but instead saw end of input",
sInput);
} else if (oToken.id !== sExpectedTokenId) {
error("Expected " + sExpectedTokenId + " but instead saw "
+ sInput.slice(oToken.start, oToken.end),
sInput,
oToken.start + 1);
}
}
iNextToken += 1;
return oToken;
} | [
"function",
"advance",
"(",
"sExpectedTokenId",
")",
"{",
"var",
"oToken",
"=",
"aTokens",
"[",
"iNextToken",
"]",
";",
"if",
"(",
"sExpectedTokenId",
")",
"{",
"if",
"(",
"!",
"oToken",
")",
"{",
"error",
"(",
"\"Expected \"",
"+",
"sExpectedTokenId",
"+"... | Returns the next token in the array of tokens and advances the index in this array.
Throws an error if the next token's ID is not equal to the optional
<code>sExpectedTokenId</code>.
@param {string} [sExpectedTokenId] - the expected id of the next token
@returns {object} - the next token or undefined if all tokens have been read | [
"Returns",
"the",
"next",
"token",
"in",
"the",
"array",
"of",
"tokens",
"and",
"advances",
"the",
"index",
"in",
"this",
"array",
".",
"Throws",
"an",
"error",
"if",
"the",
"next",
"token",
"s",
"ID",
"is",
"not",
"equal",
"to",
"the",
"optional",
"<c... | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/base/ExpressionParser.js#L734-L750 | train | Advance to next token | [
30522,
3853,
5083,
1006,
3348,
5051,
10985,
18715,
18595,
2094,
1007,
1063,
13075,
27178,
11045,
2078,
1027,
2012,
11045,
3619,
1031,
1999,
10288,
9284,
7520,
1033,
1025,
2065,
1006,
3348,
5051,
10985,
18715,
18595,
2094,
1007,
1063,
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... |
dcloudio/mui | examples/login/libs/easymob-webim-sdk/strophe-custom-2.0.0.js | function(message) {
var elem, data;
// check for closing stream
var close = '<close xmlns="urn:ietf:params:xml:ns:xmpp-framing" />';
if (message.data === close) {
this._conn.rawInput(close);
this._conn.xmlInput(message);
if (!this._conn.disconnecting) {
this._conn._doDisconnect();
}
return;
} else if (message.data.search("<open ") === 0) {
// This handles stream restarts
elem = new DOMParser().parseFromString(message.data, "text/xml").documentElement;
if (!this._handleStreamStart(elem)) {
return;
}
} else {
data = this._streamWrap(message.data);
elem = new DOMParser().parseFromString(data, "text/xml").documentElement;
}
if (this._check_streamerror(elem, Strophe.Status.ERROR)) {
return;
}
//handle unavailable presence stanza before disconnecting
if (this._conn.disconnecting &&
elem.firstChild.nodeName === "presence" &&
elem.firstChild.getAttribute("type") === "unavailable") {
this._conn.xmlInput(elem);
this._conn.rawInput(Strophe.serialize(elem));
// if we are already disconnecting we will ignore the unavailable stanza and
// wait for the </stream:stream> tag before we close the connection
return;
}
this._conn._dataRecv(elem, message.data);
} | javascript | function(message) {
var elem, data;
// check for closing stream
var close = '<close xmlns="urn:ietf:params:xml:ns:xmpp-framing" />';
if (message.data === close) {
this._conn.rawInput(close);
this._conn.xmlInput(message);
if (!this._conn.disconnecting) {
this._conn._doDisconnect();
}
return;
} else if (message.data.search("<open ") === 0) {
// This handles stream restarts
elem = new DOMParser().parseFromString(message.data, "text/xml").documentElement;
if (!this._handleStreamStart(elem)) {
return;
}
} else {
data = this._streamWrap(message.data);
elem = new DOMParser().parseFromString(data, "text/xml").documentElement;
}
if (this._check_streamerror(elem, Strophe.Status.ERROR)) {
return;
}
//handle unavailable presence stanza before disconnecting
if (this._conn.disconnecting &&
elem.firstChild.nodeName === "presence" &&
elem.firstChild.getAttribute("type") === "unavailable") {
this._conn.xmlInput(elem);
this._conn.rawInput(Strophe.serialize(elem));
// if we are already disconnecting we will ignore the unavailable stanza and
// wait for the </stream:stream> tag before we close the connection
return;
}
this._conn._dataRecv(elem, message.data);
} | [
"function",
"(",
"message",
")",
"{",
"var",
"elem",
",",
"data",
";",
"// check for closing stream\r",
"var",
"close",
"=",
"'<close xmlns=\"urn:ietf:params:xml:ns:xmpp-framing\" />'",
";",
"if",
"(",
"message",
".",
"data",
"===",
"close",
")",
"{",
"this",
".",... | PrivateFunction: _onMessage
_Private_ function to handle websockets messages.
This function parses each of the messages as if they are full documents. [TODO : We may actually want to use a SAX Push parser].
Since all XMPP traffic starts with "<stream:stream version='1.0' xml:lang='en' xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' id='3697395463' from='SERVER'>"
The first stanza will always fail to be parsed...
Addtionnaly, the seconds stanza will always be a <stream:features> with the stream NS defined in the previous stanza... so we need to 'force' the inclusion of the NS in this stanza!
Parameters:
(string) message - The websocket message. | [
"PrivateFunction",
":",
"_onMessage",
"_Private_",
"function",
"to",
"handle",
"websockets",
"messages",
"."
] | ff74c90a1671a552f3604b1288bf38a4126312d0 | https://github.com/dcloudio/mui/blob/ff74c90a1671a552f3604b1288bf38a4126312d0/examples/login/libs/easymob-webim-sdk/strophe-custom-2.0.0.js#L5130-L5168 | train | Handle message from the device | [
30522,
3853,
1006,
4471,
1007,
1063,
13075,
3449,
6633,
1010,
2951,
1025,
1013,
1013,
4638,
2005,
5494,
5460,
13075,
2485,
1027,
1005,
1026,
2485,
20950,
3619,
1027,
1000,
24471,
2078,
1024,
29464,
24475,
1024,
11498,
5244,
1024,
20950,
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... | |
goldfire/howler.js | examples/player/player.js | function(direction) {
var self = this;
// Get the next track based on the direction of the track.
var index = 0;
if (direction === 'prev') {
index = self.index - 1;
if (index < 0) {
index = self.playlist.length - 1;
}
} else {
index = self.index + 1;
if (index >= self.playlist.length) {
index = 0;
}
}
self.skipTo(index);
} | javascript | function(direction) {
var self = this;
// Get the next track based on the direction of the track.
var index = 0;
if (direction === 'prev') {
index = self.index - 1;
if (index < 0) {
index = self.playlist.length - 1;
}
} else {
index = self.index + 1;
if (index >= self.playlist.length) {
index = 0;
}
}
self.skipTo(index);
} | [
"function",
"(",
"direction",
")",
"{",
"var",
"self",
"=",
"this",
";",
"// Get the next track based on the direction of the track.",
"var",
"index",
"=",
"0",
";",
"if",
"(",
"direction",
"===",
"'prev'",
")",
"{",
"index",
"=",
"self",
".",
"index",
"-",
... | Skip to the next or previous track.
@param {String} direction 'next' or 'prev'. | [
"Skip",
"to",
"the",
"next",
"or",
"previous",
"track",
"."
] | 030db918dd8ce640afd57e172418472497e8f113 | https://github.com/goldfire/howler.js/blob/030db918dd8ce640afd57e172418472497e8f113/examples/player/player.js#L142-L160 | train | Get the next track in the list | [
30522,
3853,
1006,
3257,
1007,
1063,
13075,
2969,
1027,
2023,
1025,
1013,
1013,
2131,
1996,
2279,
2650,
2241,
2006,
1996,
3257,
1997,
1996,
2650,
1012,
13075,
5950,
1027,
1014,
1025,
2065,
1006,
3257,
1027,
1027,
1027,
1005,
3653,
2615,
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... | |
chartjs/Chart.js | src/core/core.interaction.js | getDistanceMetricForAxis | function getDistanceMetricForAxis(axis) {
var useX = axis.indexOf('x') !== -1;
var useY = axis.indexOf('y') !== -1;
return function(pt1, pt2) {
var deltaX = useX ? Math.abs(pt1.x - pt2.x) : 0;
var deltaY = useY ? Math.abs(pt1.y - pt2.y) : 0;
return Math.sqrt(Math.pow(deltaX, 2) + Math.pow(deltaY, 2));
};
} | javascript | function getDistanceMetricForAxis(axis) {
var useX = axis.indexOf('x') !== -1;
var useY = axis.indexOf('y') !== -1;
return function(pt1, pt2) {
var deltaX = useX ? Math.abs(pt1.x - pt2.x) : 0;
var deltaY = useY ? Math.abs(pt1.y - pt2.y) : 0;
return Math.sqrt(Math.pow(deltaX, 2) + Math.pow(deltaY, 2));
};
} | [
"function",
"getDistanceMetricForAxis",
"(",
"axis",
")",
"{",
"var",
"useX",
"=",
"axis",
".",
"indexOf",
"(",
"'x'",
")",
"!==",
"-",
"1",
";",
"var",
"useY",
"=",
"axis",
".",
"indexOf",
"(",
"'y'",
")",
"!==",
"-",
"1",
";",
"return",
"function",... | Get a distance metric function for two points based on the
axis mode setting
@param {string} axis - the axis mode. x|y|xy | [
"Get",
"a",
"distance",
"metric",
"function",
"for",
"two",
"points",
"based",
"on",
"the",
"axis",
"mode",
"setting"
] | f093c36574d290330ed623e60fbd070421c730d5 | https://github.com/chartjs/Chart.js/blob/f093c36574d290330ed623e60fbd070421c730d5/src/core/core.interaction.js#L100-L109 | train | Returns a function that returns the distance between two points | [
30522,
3853,
2131,
10521,
26897,
12589,
29278,
8528,
2483,
1006,
8123,
1007,
1063,
13075,
2224,
2595,
1027,
8123,
1012,
5950,
11253,
1006,
1005,
1060,
1005,
1007,
999,
1027,
1027,
1011,
1015,
1025,
13075,
2224,
2100,
1027,
8123,
1012,
5950,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
TryGhost/Ghost | core/server/api/v0.1/subscribers.js | doQuery | function doQuery(options) {
return models.Subscriber.findPage(options)
.then(({data, meta}) => {
return {
subscribers: data.map(model => model.toJSON(options)),
meta: meta
};
});
} | javascript | function doQuery(options) {
return models.Subscriber.findPage(options)
.then(({data, meta}) => {
return {
subscribers: data.map(model => model.toJSON(options)),
meta: meta
};
});
} | [
"function",
"doQuery",
"(",
"options",
")",
"{",
"return",
"models",
".",
"Subscriber",
".",
"findPage",
"(",
"options",
")",
".",
"then",
"(",
"(",
"{",
"data",
",",
"meta",
"}",
")",
"=>",
"{",
"return",
"{",
"subscribers",
":",
"data",
".",
"map",... | ### Model Query
Make the call to the Model layer
@param {Object} options
@returns {Object} options | [
"###",
"Model",
"Query",
"Make",
"the",
"call",
"to",
"the",
"Model",
"layer"
] | bb7bb55cf3e60af99ebbc56099928827b58461bc | https://github.com/TryGhost/Ghost/blob/bb7bb55cf3e60af99ebbc56099928827b58461bc/core/server/api/v0.1/subscribers.js#L35-L43 | train | Query the database for the subscribers | [
30522,
3853,
2079,
4226,
2854,
1006,
7047,
1007,
1063,
2709,
4275,
1012,
4942,
29234,
2099,
1012,
2424,
13704,
1006,
7047,
1007,
1012,
2059,
1006,
1006,
1063,
2951,
1010,
18804,
1065,
1007,
1027,
1028,
1063,
2709,
1063,
17073,
1024,
2951,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/DraftEnabledMockServer.js | function(oEvent) {
var oXhr = oEvent.getParameter("oXhr");
var oEntry = jQuery.sap.sjax({
url: oXhr.url,
dataType: "json"
}).data.d;
// navigate to draft nodes and delete nodes
for (var i = 0; i < this._oDraftMetadata.draftNodes.length; i++) {
for (var navprop in this._mEntitySets[this._oDraftMetadata.draftRootName].navprops) {
if (this._mEntitySets[this._oDraftMetadata.draftRootName].navprops[navprop].to.entitySet === this._oDraftMetadata.draftNodes[i]) {
var oResponse = jQuery.sap.sjax({
url: oEntry[navprop].__deferred.uri,
dataType: "json"
});
if (oResponse.data && oResponse.data.d && oResponse.data.d.results) {
var oNode;
for (var j = 0; j < oResponse.data.d.results.length; j++) {
oNode = oResponse.data.d.results[j];
jQuery.sap.sjax({
url: oNode.__metadata.uri,
type: "DELETE"
});
}
}
}
}
}
} | javascript | function(oEvent) {
var oXhr = oEvent.getParameter("oXhr");
var oEntry = jQuery.sap.sjax({
url: oXhr.url,
dataType: "json"
}).data.d;
// navigate to draft nodes and delete nodes
for (var i = 0; i < this._oDraftMetadata.draftNodes.length; i++) {
for (var navprop in this._mEntitySets[this._oDraftMetadata.draftRootName].navprops) {
if (this._mEntitySets[this._oDraftMetadata.draftRootName].navprops[navprop].to.entitySet === this._oDraftMetadata.draftNodes[i]) {
var oResponse = jQuery.sap.sjax({
url: oEntry[navprop].__deferred.uri,
dataType: "json"
});
if (oResponse.data && oResponse.data.d && oResponse.data.d.results) {
var oNode;
for (var j = 0; j < oResponse.data.d.results.length; j++) {
oNode = oResponse.data.d.results[j];
jQuery.sap.sjax({
url: oNode.__metadata.uri,
type: "DELETE"
});
}
}
}
}
}
} | [
"function",
"(",
"oEvent",
")",
"{",
"var",
"oXhr",
"=",
"oEvent",
".",
"getParameter",
"(",
"\"oXhr\"",
")",
";",
"var",
"oEntry",
"=",
"jQuery",
".",
"sap",
".",
"sjax",
"(",
"{",
"url",
":",
"oXhr",
".",
"url",
",",
"dataType",
":",
"\"json\"",
... | callback function to update draft specific properties pre deletion | [
"callback",
"function",
"to",
"update",
"draft",
"specific",
"properties",
"pre",
"deletion"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/util/DraftEnabledMockServer.js#L37-L64 | train | callback function for the delete event | [
30522,
3853,
1006,
1051,
18697,
3372,
1007,
1063,
13075,
23060,
8093,
1027,
1051,
18697,
3372,
1012,
2131,
28689,
22828,
1006,
1000,
23060,
8093,
1000,
1007,
1025,
13075,
1051,
4765,
2854,
1027,
1046,
4226,
2854,
1012,
20066,
1012,
1055,
39... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/hand-controls.js | function (gesture, lastGesture, reverse) {
var clip;
var fromAction;
var mesh = this.el.getObject3D('mesh');
var toAction;
if (!mesh) { return; }
// Stop all current animations.
mesh.mixer.stopAllAction();
// Grab clip action.
clip = this.getClip(gesture);
toAction = mesh.mixer.clipAction(clip);
toAction.clampWhenFinished = true;
toAction.loop = THREE.LoopRepeat;
toAction.repetitions = 0;
toAction.timeScale = reverse ? -1 : 1;
toAction.time = reverse ? clip.duration : 0;
toAction.weight = 1;
// No gesture to gesture or gesture to no gesture.
if (!lastGesture || gesture === lastGesture) {
// Stop all current animations.
mesh.mixer.stopAllAction();
// Play animation.
toAction.play();
return;
}
// Animate or crossfade from gesture to gesture.
clip = this.getClip(lastGesture);
fromAction = mesh.mixer.clipAction(clip);
fromAction.weight = 0.15;
fromAction.play();
toAction.play();
fromAction.crossFadeTo(toAction, 0.15, true);
} | javascript | function (gesture, lastGesture, reverse) {
var clip;
var fromAction;
var mesh = this.el.getObject3D('mesh');
var toAction;
if (!mesh) { return; }
// Stop all current animations.
mesh.mixer.stopAllAction();
// Grab clip action.
clip = this.getClip(gesture);
toAction = mesh.mixer.clipAction(clip);
toAction.clampWhenFinished = true;
toAction.loop = THREE.LoopRepeat;
toAction.repetitions = 0;
toAction.timeScale = reverse ? -1 : 1;
toAction.time = reverse ? clip.duration : 0;
toAction.weight = 1;
// No gesture to gesture or gesture to no gesture.
if (!lastGesture || gesture === lastGesture) {
// Stop all current animations.
mesh.mixer.stopAllAction();
// Play animation.
toAction.play();
return;
}
// Animate or crossfade from gesture to gesture.
clip = this.getClip(lastGesture);
fromAction = mesh.mixer.clipAction(clip);
fromAction.weight = 0.15;
fromAction.play();
toAction.play();
fromAction.crossFadeTo(toAction, 0.15, true);
} | [
"function",
"(",
"gesture",
",",
"lastGesture",
",",
"reverse",
")",
"{",
"var",
"clip",
";",
"var",
"fromAction",
";",
"var",
"mesh",
"=",
"this",
".",
"el",
".",
"getObject3D",
"(",
"'mesh'",
")",
";",
"var",
"toAction",
";",
"if",
"(",
"!",
"mesh"... | Play hand animation based on button state.
@param {string} gesture - Name of the animation as specified by the model.
@param {string} lastGesture - Previous pose.
@param {boolean} reverse - Whether animation should play in reverse. | [
"Play",
"hand",
"animation",
"based",
"on",
"button",
"state",
"."
] | 24acc78a7299a4cdfe3ef617f4d40ddf6275c992 | https://github.com/aframevr/aframe/blob/24acc78a7299a4cdfe3ef617f4d40ddf6275c992/src/components/hand-controls.js#L326-L363 | train | Animate the current animation to the given gesture. | [
30522,
3853,
1006,
9218,
1010,
2197,
8449,
11244,
1010,
7901,
1007,
1063,
13075,
12528,
1025,
13075,
2013,
18908,
3258,
1025,
13075,
20437,
1027,
2023,
1012,
3449,
1012,
2131,
16429,
20614,
29097,
1006,
1005,
20437,
1005,
1007,
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... | |
LLK/scratch-blocks | blocks_vertical/motion.js | function() {
this.jsonInit({
"message0": Blockly.Msg.MOTION_ALIGNSCENE,
"args0": [
{
"type": "field_dropdown",
"name": "ALIGNMENT",
"options": [
[Blockly.Msg.MOTION_ALIGNSCENE_BOTTOMLEFT, 'bottom-left'],
[Blockly.Msg.MOTION_ALIGNSCENE_BOTTOMRIGHT, 'bottom-right'],
[Blockly.Msg.MOTION_ALIGNSCENE_MIDDLE, 'middle'],
[Blockly.Msg.MOTION_ALIGNSCENE_TOPLEFT, 'top-left'],
[Blockly.Msg.MOTION_ALIGNSCENE_TOPRIGHT, 'top-right']
]
}
],
"category": Blockly.Categories.motion,
"extensions": ["colours_motion", "shape_statement"]
});
} | javascript | function() {
this.jsonInit({
"message0": Blockly.Msg.MOTION_ALIGNSCENE,
"args0": [
{
"type": "field_dropdown",
"name": "ALIGNMENT",
"options": [
[Blockly.Msg.MOTION_ALIGNSCENE_BOTTOMLEFT, 'bottom-left'],
[Blockly.Msg.MOTION_ALIGNSCENE_BOTTOMRIGHT, 'bottom-right'],
[Blockly.Msg.MOTION_ALIGNSCENE_MIDDLE, 'middle'],
[Blockly.Msg.MOTION_ALIGNSCENE_TOPLEFT, 'top-left'],
[Blockly.Msg.MOTION_ALIGNSCENE_TOPRIGHT, 'top-right']
]
}
],
"category": Blockly.Categories.motion,
"extensions": ["colours_motion", "shape_statement"]
});
} | [
"function",
"(",
")",
"{",
"this",
".",
"jsonInit",
"(",
"{",
"\"message0\"",
":",
"Blockly",
".",
"Msg",
".",
"MOTION_ALIGNSCENE",
",",
"\"args0\"",
":",
"[",
"{",
"\"type\"",
":",
"\"field_dropdown\"",
",",
"\"name\"",
":",
"\"ALIGNMENT\"",
",",
"\"options... | Block to change the stage's scrolling alignment. Does not actually do
anything. This is an obsolete block that is implemented for compatibility
with Scratch 2.0 projects.
@this Blockly.Block | [
"Block",
"to",
"change",
"the",
"stage",
"s",
"scrolling",
"alignment",
".",
"Does",
"not",
"actually",
"do",
"anything",
".",
"This",
"is",
"an",
"obsolete",
"block",
"that",
"is",
"implemented",
"for",
"compatibility",
"with",
"Scratch",
"2",
".",
"0",
"... | 455b2a854435c0a67da1da92320ddc3ec3e2b799 | https://github.com/LLK/scratch-blocks/blob/455b2a854435c0a67da1da92320ddc3ec3e2b799/blocks_vertical/motion.js#L532-L551 | train | Block for the ambient alignment section. | [
30522,
3853,
1006,
1007,
1063,
2023,
1012,
1046,
3385,
5498,
2102,
1006,
1063,
1000,
4471,
2692,
1000,
1024,
3796,
2135,
1012,
5796,
2290,
1012,
4367,
1035,
25705,
11020,
8625,
1010,
1000,
12098,
5620,
2692,
1000,
1024,
1031,
1063,
1000,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | src/sap.ui.core/src/sap/ui/model/odata/_AnnotationHelperExpression.js | function (oInterface, oPathValue) {
var sBindingPath = oPathValue.value,
oConstraints = {},
oExclusiveAnnotation,
oIsDigitSequence,
oMinMaxAnnotation,
oModel = oInterface.getModel(),
oPathValueInterface = {
getModel : function () {
return oModel;
},
getPath : function () {
return oPathValue.path;
}
},
oProperty,
oResult = {result : "binding", value : sBindingPath},
oTarget;
Basics.expectType(oPathValue, "string");
// Note: "PropertyPath" is treated the same...
oTarget = Basics.followPath(oPathValueInterface, {"Path" : sBindingPath});
if (oTarget && oTarget.resolvedPath) {
oProperty = oModel.getProperty(oTarget.resolvedPath);
oResult.type = oProperty.type;
switch (oProperty.type) {
case "Edm.DateTime":
oConstraints.displayFormat = oProperty["sap:display-format"];
break;
case "Edm.Decimal":
if (oProperty.precision) {
oConstraints.precision = oProperty.precision;
}
if (oProperty.scale) {
oConstraints.scale = oProperty.scale;
}
oMinMaxAnnotation = oProperty["Org.OData.Validation.V1.Minimum"];
if (oMinMaxAnnotation
&& (oMinMaxAnnotation.Decimal || oMinMaxAnnotation.String)) {
oConstraints.minimum =
oMinMaxAnnotation.Decimal || oMinMaxAnnotation.String;
oExclusiveAnnotation =
oMinMaxAnnotation["Org.OData.Validation.V1.Exclusive"];
if (oExclusiveAnnotation) {
oConstraints.minimumExclusive = oExclusiveAnnotation.Bool || "true";
}
}
oMinMaxAnnotation = oProperty["Org.OData.Validation.V1.Maximum"];
if (oMinMaxAnnotation
&& (oMinMaxAnnotation.Decimal || oMinMaxAnnotation.String)) {
oConstraints.maximum =
oMinMaxAnnotation.Decimal || oMinMaxAnnotation.String;
oExclusiveAnnotation =
oMinMaxAnnotation["Org.OData.Validation.V1.Exclusive"];
if (oExclusiveAnnotation) {
oConstraints.maximumExclusive = oExclusiveAnnotation.Bool || "true";
}
}
break;
case "Edm.String":
oConstraints.maxLength = oProperty.maxLength;
oIsDigitSequence = oProperty["com.sap.vocabularies.Common.v1.IsDigitSequence"];
if (oIsDigitSequence) {
oConstraints.isDigitSequence = oIsDigitSequence.Bool || "true";
}
break;
// no default
}
if (oProperty.nullable === "false") {
oConstraints.nullable = "false";
}
oResult.constraints = oConstraints;
} else {
Log.warning("Could not find property '" + sBindingPath + "' starting from '"
+ oPathValue.path + "'", null, sAnnotationHelper);
}
return oResult;
} | javascript | function (oInterface, oPathValue) {
var sBindingPath = oPathValue.value,
oConstraints = {},
oExclusiveAnnotation,
oIsDigitSequence,
oMinMaxAnnotation,
oModel = oInterface.getModel(),
oPathValueInterface = {
getModel : function () {
return oModel;
},
getPath : function () {
return oPathValue.path;
}
},
oProperty,
oResult = {result : "binding", value : sBindingPath},
oTarget;
Basics.expectType(oPathValue, "string");
// Note: "PropertyPath" is treated the same...
oTarget = Basics.followPath(oPathValueInterface, {"Path" : sBindingPath});
if (oTarget && oTarget.resolvedPath) {
oProperty = oModel.getProperty(oTarget.resolvedPath);
oResult.type = oProperty.type;
switch (oProperty.type) {
case "Edm.DateTime":
oConstraints.displayFormat = oProperty["sap:display-format"];
break;
case "Edm.Decimal":
if (oProperty.precision) {
oConstraints.precision = oProperty.precision;
}
if (oProperty.scale) {
oConstraints.scale = oProperty.scale;
}
oMinMaxAnnotation = oProperty["Org.OData.Validation.V1.Minimum"];
if (oMinMaxAnnotation
&& (oMinMaxAnnotation.Decimal || oMinMaxAnnotation.String)) {
oConstraints.minimum =
oMinMaxAnnotation.Decimal || oMinMaxAnnotation.String;
oExclusiveAnnotation =
oMinMaxAnnotation["Org.OData.Validation.V1.Exclusive"];
if (oExclusiveAnnotation) {
oConstraints.minimumExclusive = oExclusiveAnnotation.Bool || "true";
}
}
oMinMaxAnnotation = oProperty["Org.OData.Validation.V1.Maximum"];
if (oMinMaxAnnotation
&& (oMinMaxAnnotation.Decimal || oMinMaxAnnotation.String)) {
oConstraints.maximum =
oMinMaxAnnotation.Decimal || oMinMaxAnnotation.String;
oExclusiveAnnotation =
oMinMaxAnnotation["Org.OData.Validation.V1.Exclusive"];
if (oExclusiveAnnotation) {
oConstraints.maximumExclusive = oExclusiveAnnotation.Bool || "true";
}
}
break;
case "Edm.String":
oConstraints.maxLength = oProperty.maxLength;
oIsDigitSequence = oProperty["com.sap.vocabularies.Common.v1.IsDigitSequence"];
if (oIsDigitSequence) {
oConstraints.isDigitSequence = oIsDigitSequence.Bool || "true";
}
break;
// no default
}
if (oProperty.nullable === "false") {
oConstraints.nullable = "false";
}
oResult.constraints = oConstraints;
} else {
Log.warning("Could not find property '" + sBindingPath + "' starting from '"
+ oPathValue.path + "'", null, sAnnotationHelper);
}
return oResult;
} | [
"function",
"(",
"oInterface",
",",
"oPathValue",
")",
"{",
"var",
"sBindingPath",
"=",
"oPathValue",
".",
"value",
",",
"oConstraints",
"=",
"{",
"}",
",",
"oExclusiveAnnotation",
",",
"oIsDigitSequence",
",",
"oMinMaxAnnotation",
",",
"oModel",
"=",
"oInterfac... | Handling of "14.5.12 Expression edm:Path" and "14.5.13 Expression edm:PropertyPath";
embedded within an entity set or entity type (see {@link Basics.followPath}).
@param {sap.ui.core.util.XMLPreprocessor.IContext|sap.ui.model.Context} oInterface
the callback interface related to the current formatter call
@param {object} oPathValue
path and value information pointing to the edm:Path (see Expression object)
@returns {object}
the result object | [
"Handling",
"of",
"14",
".",
"5",
".",
"12",
"Expression",
"edm",
":",
"Path",
"and",
"14",
".",
"5",
".",
"13",
"Expression",
"edm",
":",
"PropertyPath",
";",
"embedded",
"within",
"an",
"entity",
"set",
"or",
"entity",
"type",
"(",
"see",
"{",
"@li... | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/_AnnotationHelperExpression.js#L708-L788 | train | Returns the binding result | [
30522,
3853,
1006,
1051,
18447,
2121,
12172,
1010,
6728,
8988,
10175,
5657,
1007,
1063,
13075,
24829,
22254,
2075,
15069,
1027,
6728,
8988,
10175,
5657,
1012,
3643,
1010,
1051,
8663,
20528,
18447,
2015,
1027,
1063,
1065,
1010,
1051,
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... | |
adobe/brackets | src/editor/CodeHintManager.js | _getProvidersForLanguageId | function _getProvidersForLanguageId(languageId) {
var providers = hintProviders[languageId] || hintProviders.all;
// Exclude providers that are explicitly disabled in the preferences.
// All code hint providers that do not have their constructor
// names listed in the preferences are enabled by default.
return providers.filter(function (provider) {
var prefKey = "codehint." + provider.provider.constructor.name;
return PreferencesManager.get(prefKey) !== false;
});
} | javascript | function _getProvidersForLanguageId(languageId) {
var providers = hintProviders[languageId] || hintProviders.all;
// Exclude providers that are explicitly disabled in the preferences.
// All code hint providers that do not have their constructor
// names listed in the preferences are enabled by default.
return providers.filter(function (provider) {
var prefKey = "codehint." + provider.provider.constructor.name;
return PreferencesManager.get(prefKey) !== false;
});
} | [
"function",
"_getProvidersForLanguageId",
"(",
"languageId",
")",
"{",
"var",
"providers",
"=",
"hintProviders",
"[",
"languageId",
"]",
"||",
"hintProviders",
".",
"all",
";",
"// Exclude providers that are explicitly disabled in the preferences.",
"// All code hint providers ... | Return the array of hint providers for the given language id.
This gets called (potentially) on every keypress. So, it should be fast.
@param {!string} languageId
@return {?Array.<{provider: Object, priority: number}>} | [
"Return",
"the",
"array",
"of",
"hint",
"providers",
"for",
"the",
"given",
"language",
"id",
".",
"This",
"gets",
"called",
"(",
"potentially",
")",
"on",
"every",
"keypress",
".",
"So",
"it",
"should",
"be",
"fast",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/editor/CodeHintManager.js#L356-L366 | train | Returns a list of code hint providers for a given language. | [
30522,
3853,
1035,
2131,
21572,
17258,
2545,
29278,
25023,
6692,
3351,
3593,
1006,
2653,
3593,
1007,
1063,
13075,
11670,
1027,
9374,
21572,
17258,
2545,
1031,
2653,
3593,
1033,
1064,
1064,
9374,
21572,
17258,
2545,
1012,
2035,
1025,
1013,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
pagekit/vue-resource | dist/vue-resource.esm.js | template | function template (options) {
var variables = [], url = expand(options.url, options.params, variables);
variables.forEach(function (key) {
delete options.params[key];
});
return url;
} | javascript | function template (options) {
var variables = [], url = expand(options.url, options.params, variables);
variables.forEach(function (key) {
delete options.params[key];
});
return url;
} | [
"function",
"template",
"(",
"options",
")",
"{",
"var",
"variables",
"=",
"[",
"]",
",",
"url",
"=",
"expand",
"(",
"options",
".",
"url",
",",
"options",
".",
"params",
",",
"variables",
")",
";",
"variables",
".",
"forEach",
"(",
"function",
"(",
... | URL Template (RFC 6570) Transform. | [
"URL",
"Template",
"(",
"RFC",
"6570",
")",
"Transform",
"."
] | fe268fa1d6053ede5f34aef9a11e1a424a70446c | https://github.com/pagekit/vue-resource/blob/fe268fa1d6053ede5f34aef9a11e1a424a70446c/dist/vue-resource.esm.js#L637-L646 | train | template function for the
| [
30522,
3853,
23561,
1006,
7047,
1007,
1063,
13075,
10857,
1027,
1031,
1033,
1010,
24471,
2140,
1027,
7818,
1006,
7047,
1012,
24471,
2140,
1010,
7047,
1012,
11498,
5244,
1010,
10857,
1007,
1025,
10857,
1012,
18921,
6776,
1006,
3853,
1006,
31... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/panel/panel.spec.js | openPanel | function openPanel(preset, opt_config) {
// TODO(ErinCoughlan): Investigate why panelRef.open() doesn't return
// panelRef.
var openPromise;
if (panelRef) {
openPromise = panelRef.open();
} else {
openPromise = $mdPanel.open(preset, opt_config);
}
openPromise.then(function(createdPanelRef) {
panelRef = createdPanelRef;
return panelRef;
});
flushPanel();
} | javascript | function openPanel(preset, opt_config) {
// TODO(ErinCoughlan): Investigate why panelRef.open() doesn't return
// panelRef.
var openPromise;
if (panelRef) {
openPromise = panelRef.open();
} else {
openPromise = $mdPanel.open(preset, opt_config);
}
openPromise.then(function(createdPanelRef) {
panelRef = createdPanelRef;
return panelRef;
});
flushPanel();
} | [
"function",
"openPanel",
"(",
"preset",
",",
"opt_config",
")",
"{",
"// TODO(ErinCoughlan): Investigate why panelRef.open() doesn't return",
"// panelRef.",
"var",
"openPromise",
";",
"if",
"(",
"panelRef",
")",
"{",
"openPromise",
"=",
"panelRef",
".",
"open",
"(",
... | Opens the panel. If a config value is passed, creates a new panelRef
using $mdPanel.open(config); Otherwise, called open on the panelRef,
assuming one has already been created.
@param {!Object=} opt_config | [
"Opens",
"the",
"panel",
".",
"If",
"a",
"config",
"value",
"is",
"passed",
"creates",
"a",
"new",
"panelRef",
"using",
"$mdPanel",
".",
"open",
"(",
"config",
")",
";",
"Otherwise",
"called",
"open",
"on",
"the",
"panelRef",
"assuming",
"one",
"has",
"a... | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/panel/panel.spec.js#L3423-L3440 | train | Open a panel | [
30522,
3853,
2330,
9739,
2884,
1006,
3653,
13462,
1010,
23569,
1035,
9530,
8873,
2290,
1007,
1063,
1013,
1013,
28681,
2080,
1006,
11781,
3597,
8953,
5802,
1007,
1024,
8556,
2339,
5997,
2890,
2546,
1012,
2330,
1006,
1007,
2987,
1005,
1056,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/JSUtils/Session.js | Session | function Session(editor) {
this.editor = editor;
this.path = editor.document.file.fullPath;
this.ternHints = [];
this.ternGuesses = null;
this.fnType = null;
this.builtins = null;
} | javascript | function Session(editor) {
this.editor = editor;
this.path = editor.document.file.fullPath;
this.ternHints = [];
this.ternGuesses = null;
this.fnType = null;
this.builtins = null;
} | [
"function",
"Session",
"(",
"editor",
")",
"{",
"this",
".",
"editor",
"=",
"editor",
";",
"this",
".",
"path",
"=",
"editor",
".",
"document",
".",
"file",
".",
"fullPath",
";",
"this",
".",
"ternHints",
"=",
"[",
"]",
";",
"this",
".",
"ternGuesses... | Session objects encapsulate state associated with a hinting session
and provide methods for updating and querying the session.
@constructor
@param {Editor} editor - the editor context for the session | [
"Session",
"objects",
"encapsulate",
"state",
"associated",
"with",
"a",
"hinting",
"session",
"and",
"provide",
"methods",
"for",
"updating",
"and",
"querying",
"the",
"session",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/JSUtils/Session.js#L45-L52 | train | Session constructor. | [
30522,
3853,
5219,
1006,
3559,
1007,
1063,
2023,
1012,
3559,
1027,
3559,
1025,
2023,
1012,
4130,
1027,
3559,
1012,
6254,
1012,
5371,
1012,
2440,
15069,
1025,
2023,
1012,
28774,
25311,
18447,
2015,
1027,
1031,
1033,
1025,
2023,
1012,
28774,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Editor.js | _clearMessagePopover | function _clearMessagePopover() {
if (self._$messagePopover && self._$messagePopover.length > 0) {
// self._$messagePopover.remove() is done by PopUpManager
self._$messagePopover = null;
}
_removeListeners();
} | javascript | function _clearMessagePopover() {
if (self._$messagePopover && self._$messagePopover.length > 0) {
// self._$messagePopover.remove() is done by PopUpManager
self._$messagePopover = null;
}
_removeListeners();
} | [
"function",
"_clearMessagePopover",
"(",
")",
"{",
"if",
"(",
"self",
".",
"_$messagePopover",
"&&",
"self",
".",
"_$messagePopover",
".",
"length",
">",
"0",
")",
"{",
"// self._$messagePopover.remove() is done by PopUpManager",
"self",
".",
"_$messagePopover",
"=",
... | PopUpManager.removePopUp() callback | [
"PopUpManager",
".",
"removePopUp",
"()",
"callback"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/editor/Editor.js#L1854-L1860 | train | Clear the message popover | [
30522,
3853,
1035,
3154,
7834,
3736,
3351,
16340,
7840,
1006,
1007,
1063,
2065,
1006,
2969,
1012,
1035,
1002,
4471,
16340,
7840,
1004,
1004,
2969,
1012,
30524,
16340,
7840,
1012,
6366,
1006,
1007,
2003,
2589,
2011,
3769,
6279,
24805,
4590,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/virtualRepeat/virtual-repeater.js | VirtualRepeatDirective | function VirtualRepeatDirective($parse) {
return {
controller: VirtualRepeatController,
priority: 1000,
require: ['mdVirtualRepeat', '^^mdVirtualRepeatContainer'],
restrict: 'A',
terminal: true,
transclude: 'element',
compile: function VirtualRepeatCompile($element, $attrs) {
var expression = $attrs.mdVirtualRepeat;
var match = expression.match(/^\s*([\s\S]+?)\s+in\s+([\s\S]+?)\s*$/);
var repeatName = match[1];
var repeatListExpression = $parse(match[2]);
var extraName = $attrs.mdExtraName && $parse($attrs.mdExtraName);
return function VirtualRepeatLink($scope, $element, $attrs, ctrl, $transclude) {
ctrl[0].link_(ctrl[1], $transclude, repeatName, repeatListExpression, extraName);
};
}
};
} | javascript | function VirtualRepeatDirective($parse) {
return {
controller: VirtualRepeatController,
priority: 1000,
require: ['mdVirtualRepeat', '^^mdVirtualRepeatContainer'],
restrict: 'A',
terminal: true,
transclude: 'element',
compile: function VirtualRepeatCompile($element, $attrs) {
var expression = $attrs.mdVirtualRepeat;
var match = expression.match(/^\s*([\s\S]+?)\s+in\s+([\s\S]+?)\s*$/);
var repeatName = match[1];
var repeatListExpression = $parse(match[2]);
var extraName = $attrs.mdExtraName && $parse($attrs.mdExtraName);
return function VirtualRepeatLink($scope, $element, $attrs, ctrl, $transclude) {
ctrl[0].link_(ctrl[1], $transclude, repeatName, repeatListExpression, extraName);
};
}
};
} | [
"function",
"VirtualRepeatDirective",
"(",
"$parse",
")",
"{",
"return",
"{",
"controller",
":",
"VirtualRepeatController",
",",
"priority",
":",
"1000",
",",
"require",
":",
"[",
"'mdVirtualRepeat'",
",",
"'^^mdVirtualRepeatContainer'",
"]",
",",
"restrict",
":",
... | @ngdoc directive
@name mdVirtualRepeat
@module material.components.virtualRepeat
@restrict A
@priority 1000
@description
The `md-virtual-repeat` attribute is applied to a template that is repeated using virtual
scrolling. This provides smooth and performant scrolling through very large lists of elements.
Virtual repeat is a limited substitute for `ng-repeat` that renders only
enough DOM nodes to fill the container, recycling them as the user scrolls.
### Notes
- Arrays are supported for iteration by default.
- An object can used use if `md-on-demand` is specified and the object implements the interface
described in the `md-on-demand` <a ng-href="#attributes">documentation</a>.
- `trackBy`, `as` alias, and `(key, value)` syntax from `ng-repeat` are not supported.
### On-Demand Async Item Loading
When using the `md-on-demand` attribute and loading some asynchronous data,
the `getItemAtIndex` function will mostly return nothing.
<hljs lang="js">
DynamicItems.prototype.getItemAtIndex = function(index) {
if (this.pages[index]) {
return this.pages[index];
} else {
// This is an asynchronous action and does not return any value.
this.loadPage(index);
}
};
</hljs>
This means that the Virtual Repeat will not have any value for the given index.<br/>
After the data loading completes, the user expects the Virtual Repeat to recognize the change.
To make sure that the Virtual Repeat properly detects any change, you need to run the operation
in another digest.
<hljs lang="js">
DynamicItems.prototype.loadPage = function(index) {
var self = this;
// Trigger a new digest by using $timeout
$timeout(function() {
self.pages[index] = Data;
});
};
</hljs>
> <b>Note:</b> Please also review the
<a ng-href="api/directive/mdVirtualRepeatContainer">VirtualRepeatContainer</a> documentation
for more information.
@usage
<hljs lang="html">
<md-virtual-repeat-container>
<div md-virtual-repeat="i in items">Hello {{i}}!</div>
</md-virtual-repeat-container>
<md-virtual-repeat-container md-orient-horizontal>
<div md-virtual-repeat="i in items" md-item-size="20">Hello {{i}}!</div>
</md-virtual-repeat-container>
</hljs>
@param {expression=} md-extra-name Evaluates to an additional name to which the current iterated
item can be assigned on the repeated scope (needed for use in `md-autocomplete`).
@param {number=} md-item-size Optional height or width of the repeated elements (which **must be
identical for each element**). Virtual repeat will attempt to read the size from the DOM,
if missing, but it still assumes that all repeated nodes have the **same height**
(when scrolling vertically) or **same width** (when scrolling horizontally).
@param {boolean=} md-on-demand When present, treats the `md-virtual-repeat` argument as an object
that can fetch rows rather than an array.
**NOTE:** This object **must** implement the following interface with two methods:
- `getItemAtIndex` - `{function(index): Object}`: The item at that `index` or `null` if it is
not yet loaded (it should start downloading the item in that case).
- `getLength` - `{function(): number}`: The data length to which the repeater container
should be sized. Ideally, when the count is known, this method should return it.
Otherwise, return a higher number than the currently loaded items to produce an
infinite-scroll behavior. | [
"@ngdoc",
"directive",
"@name",
"mdVirtualRepeat",
"@module",
"material",
".",
"components",
".",
"virtualRepeat",
"@restrict",
"A",
"@priority",
"1000",
"@description",
"The",
"md",
"-",
"virtual",
"-",
"repeat",
"attribute",
"is",
"applied",
"to",
"a",
"template... | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/virtualRepeat/virtual-repeater.js#L513-L533 | train | VirtualRepeat directive. | [
30522,
3853,
7484,
2890,
5051,
4017,
4305,
2890,
15277,
1006,
1002,
11968,
3366,
1007,
1063,
2709,
1063,
11486,
1024,
7484,
2890,
5051,
4017,
8663,
13181,
10820,
1010,
9470,
1024,
6694,
1010,
5478,
1024,
1031,
1005,
9108,
21663,
26302,
2097... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/event-stream/int64.js | negate | function negate(bytes) {
for (var i = 0; i < 8; i++) {
bytes[i] ^= 0xFF;
}
for (var i = 7; i > -1; i--) {
bytes[i]++;
if (bytes[i] !== 0) {
break;
}
}
} | javascript | function negate(bytes) {
for (var i = 0; i < 8; i++) {
bytes[i] ^= 0xFF;
}
for (var i = 7; i > -1; i--) {
bytes[i]++;
if (bytes[i] !== 0) {
break;
}
}
} | [
"function",
"negate",
"(",
"bytes",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"8",
";",
"i",
"++",
")",
"{",
"bytes",
"[",
"i",
"]",
"^=",
"0xFF",
";",
"}",
"for",
"(",
"var",
"i",
"=",
"7",
";",
"i",
">",
"-",
"1",
";"... | @param {Buffer} bytes
@api private | [
"@param",
"{",
"Buffer",
"}",
"bytes"
] | c23e5f0edd150f8885267e5f7c8a564f8e6e8562 | https://github.com/aws/aws-sdk-js/blob/c23e5f0edd150f8885267e5f7c8a564f8e6e8562/lib/event-stream/int64.js#L76-L86 | train | Negate the given byte array | [
30522,
3853,
11265,
5867,
1006,
27507,
1007,
1063,
2005,
1006,
13075,
1045,
1027,
1014,
1025,
1045,
1026,
1022,
1025,
1045,
1009,
1009,
1007,
1063,
27507,
1031,
1045,
1033,
1034,
1027,
1014,
2595,
4246,
1025,
1065,
2005,
1006,
13075,
1045,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laurent22/joplin | ReactNativeClient/lib/import-enex-md-gen.js | simplifyString | function simplifyString(s) {
let output = '';
let previousWhite = false;
for (let i = 0; i < s.length; i++) {
let c = s[i];
let isWhite = isWhiteSpace(c);
if (previousWhite && isWhite) {
// skip
} else {
output += c;
}
previousWhite = isWhite;
}
while (output.length && isWhiteSpace(output[0])) output = output.substr(1);
while (output.length && isWhiteSpace(output[output.length - 1])) output = output.substr(0, output.length - 1);
return output;
} | javascript | function simplifyString(s) {
let output = '';
let previousWhite = false;
for (let i = 0; i < s.length; i++) {
let c = s[i];
let isWhite = isWhiteSpace(c);
if (previousWhite && isWhite) {
// skip
} else {
output += c;
}
previousWhite = isWhite;
}
while (output.length && isWhiteSpace(output[0])) output = output.substr(1);
while (output.length && isWhiteSpace(output[output.length - 1])) output = output.substr(0, output.length - 1);
return output;
} | [
"function",
"simplifyString",
"(",
"s",
")",
"{",
"let",
"output",
"=",
"''",
";",
"let",
"previousWhite",
"=",
"false",
";",
"for",
"(",
"let",
"i",
"=",
"0",
";",
"i",
"<",
"s",
".",
"length",
";",
"i",
"++",
")",
"{",
"let",
"c",
"=",
"s",
... | Like QString::simpified(), except that it preserves non-breaking spaces (which Evernote uses for identation, etc.) | [
"Like",
"QString",
"::",
"simpified",
"()",
"except",
"that",
"it",
"preserves",
"non",
"-",
"breaking",
"spaces",
"(",
"which",
"Evernote",
"uses",
"for",
"identation",
"etc",
".",
")"
] | beb428b246cecba4630a3ca57b472f43c0933a43 | https://github.com/laurent22/joplin/blob/beb428b246cecba4630a3ca57b472f43c0933a43/ReactNativeClient/lib/import-enex-md-gen.js#L251-L269 | train | simplifies a string | [
30522,
3853,
21934,
28250,
3367,
4892,
1006,
1055,
1007,
1063,
2292,
6434,
1027,
1005,
1005,
1025,
2292,
3025,
2860,
16584,
2063,
1027,
6270,
1025,
2005,
1006,
2292,
1045,
1027,
1014,
1025,
1045,
1026,
1055,
1012,
3091,
1025,
1045,
1009,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | lib/jsdoc/create-api-index.js | function (oList) {
/* Sorting since records */
let aKeys = Object.keys(oList),
oSorted = {};
aKeys.sort((a, b) => {
let aA = a.split("."),
aB = b.split(".");
if (a === "noVersion") {
return 1; /* No version always at end of list */
}
if (b === "noVersion") {
return -1; /* No version always at end of list */
}
// Normalize old versions 1.4 to 1.04 for proper sorting
a = [aA[0], ('0' + aA[1]).slice(-2)].join("");
b = [aB[0], ('0' + aB[1]).slice(-2)].join("");
// Sort descending
return parseInt(b, 10) - parseInt(a, 10);
});
aKeys.forEach((sKey) => {
oSorted[sKey] = oList[sKey];
});
return oSorted;
} | javascript | function (oList) {
/* Sorting since records */
let aKeys = Object.keys(oList),
oSorted = {};
aKeys.sort((a, b) => {
let aA = a.split("."),
aB = b.split(".");
if (a === "noVersion") {
return 1; /* No version always at end of list */
}
if (b === "noVersion") {
return -1; /* No version always at end of list */
}
// Normalize old versions 1.4 to 1.04 for proper sorting
a = [aA[0], ('0' + aA[1]).slice(-2)].join("");
b = [aB[0], ('0' + aB[1]).slice(-2)].join("");
// Sort descending
return parseInt(b, 10) - parseInt(a, 10);
});
aKeys.forEach((sKey) => {
oSorted[sKey] = oList[sKey];
});
return oSorted;
} | [
"function",
"(",
"oList",
")",
"{",
"/* Sorting since records */",
"let",
"aKeys",
"=",
"Object",
".",
"keys",
"(",
"oList",
")",
",",
"oSorted",
"=",
"{",
"}",
";",
"aKeys",
".",
"sort",
"(",
"(",
"a",
",",
"b",
")",
"=>",
"{",
"let",
"aA",
"=",
... | /* Lists - modify and cleanup | [
"/",
"*",
"Lists",
"-",
"modify",
"and",
"cleanup"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/lib/jsdoc/create-api-index.js#L378-L408 | train | Sort the given list by version | [
30522,
3853,
1006,
19330,
2923,
1007,
1063,
1013,
1008,
22210,
2144,
2636,
1008,
1013,
2292,
17712,
3240,
2015,
1027,
4874,
1012,
6309,
1006,
19330,
2923,
1007,
1010,
9808,
15613,
1027,
1063,
1065,
1025,
17712,
3240,
2015,
1012,
4066,
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... | |
ColorlibHQ/AdminLTE | plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js | isHtmlNamespace | function isHtmlNamespace(node) {
var ns;
return typeof node.namespaceURI == UNDEF || ((ns = node.namespaceURI) === null || ns == "http://www.w3.org/1999/xhtml");
} | javascript | function isHtmlNamespace(node) {
var ns;
return typeof node.namespaceURI == UNDEF || ((ns = node.namespaceURI) === null || ns == "http://www.w3.org/1999/xhtml");
} | [
"function",
"isHtmlNamespace",
"(",
"node",
")",
"{",
"var",
"ns",
";",
"return",
"typeof",
"node",
".",
"namespaceURI",
"==",
"UNDEF",
"||",
"(",
"(",
"ns",
"=",
"node",
".",
"namespaceURI",
")",
"===",
"null",
"||",
"ns",
"==",
"\"http://www.w3.org/1999/... | Opera 11 puts HTML elements in the null namespace, it seems, and IE 7 has undefined namespaceURI | [
"Opera",
"11",
"puts",
"HTML",
"elements",
"in",
"the",
"null",
"namespace",
"it",
"seems",
"and",
"IE",
"7",
"has",
"undefined",
"namespaceURI"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js#L560-L563 | train | Check if node is an HTML namespace | [
30522,
3853,
2003,
11039,
19968,
18442,
23058,
1006,
13045,
1007,
1063,
13075,
24978,
1025,
2709,
2828,
11253,
13045,
1012,
3415,
15327,
9496,
1027,
1027,
6151,
12879,
1064,
1064,
1006,
1006,
24978,
1027,
13045,
1012,
3415,
15327,
9496,
1007,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | lib/jsdoc/transform-apijson-for-sdk.js | getLibraryPromise | function getLibraryPromise(oChainObject) {
return new Promise(function(oResolve) {
fs.readFile(oChainObject.libraryFile, 'utf8', (oError, oData) => {
oChainObject.libraryFileData = oData;
oResolve(oChainObject);
});
});
} | javascript | function getLibraryPromise(oChainObject) {
return new Promise(function(oResolve) {
fs.readFile(oChainObject.libraryFile, 'utf8', (oError, oData) => {
oChainObject.libraryFileData = oData;
oResolve(oChainObject);
});
});
} | [
"function",
"getLibraryPromise",
"(",
"oChainObject",
")",
"{",
"return",
"new",
"Promise",
"(",
"function",
"(",
"oResolve",
")",
"{",
"fs",
".",
"readFile",
"(",
"oChainObject",
".",
"libraryFile",
",",
"'utf8'",
",",
"(",
"oError",
",",
"oData",
")",
"=... | Load .library file
@param oChainObject chain return object
@returns {Promise} library file promise | [
"Load",
".",
"library",
"file"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/lib/jsdoc/transform-apijson-for-sdk.js#L768-L775 | train | Reads the library file and returns a promise | [
30522,
3853,
2131,
29521,
19848,
22571,
21716,
5562,
1006,
28166,
8113,
16429,
20614,
1007,
1063,
2709,
2047,
4872,
1006,
3853,
1006,
10848,
19454,
3726,
1007,
1063,
1042,
2015,
1012,
3191,
8873,
2571,
1006,
28166,
8113,
16429,
20614,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/core/IntervalTrigger.js | function() {
clearTimeout(this._delayedCallId);
// if interval is active and there are registered listeners
var bHasListeners = this._oEventBus._defaultChannel.hasListeners(_EVENT_ID);
if (this._iInterval > 0 && bHasListeners) {
this._oEventBus.publish(_EVENT_ID);
this._delayedCallId = setTimeout(this._trigger, this._iInterval);
}
} | javascript | function() {
clearTimeout(this._delayedCallId);
// if interval is active and there are registered listeners
var bHasListeners = this._oEventBus._defaultChannel.hasListeners(_EVENT_ID);
if (this._iInterval > 0 && bHasListeners) {
this._oEventBus.publish(_EVENT_ID);
this._delayedCallId = setTimeout(this._trigger, this._iInterval);
}
} | [
"function",
"(",
")",
"{",
"clearTimeout",
"(",
"this",
".",
"_delayedCallId",
")",
";",
"// if interval is active and there are registered listeners",
"var",
"bHasListeners",
"=",
"this",
".",
"_oEventBus",
".",
"_defaultChannel",
".",
"hasListeners",
"(",
"_EVENT_ID",... | This is the function that will be used for triggering.
@private | [
"This",
"is",
"the",
"function",
"that",
"will",
"be",
"used",
"for",
"triggering",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/IntervalTrigger.js#L50-L60 | train | trigger the event | [
30522,
3853,
1006,
1007,
1063,
3154,
7292,
5833,
1006,
2023,
1012,
1035,
8394,
9289,
21273,
1007,
1025,
1013,
1013,
2065,
13483,
2003,
3161,
1998,
2045,
2024,
5068,
13810,
13075,
1038,
14949,
9863,
24454,
2015,
1027,
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/spaced-comment.js | createExceptionsPattern | function createExceptionsPattern(exceptions) {
let pattern = "";
/*
* A space or an exception pattern sequence.
* [] ==> "\s"
* ["-"] ==> "(?:\s|\-+$)"
* ["-", "="] ==> "(?:\s|(?:\-+|=+)$)"
* ["-", "=", "--=="] ==> "(?:\s|(?:\-+|=+|(?:\-\-==)+)$)" ==> https://jex.im/regulex/#!embed=false&flags=&re=(%3F%3A%5Cs%7C(%3F%3A%5C-%2B%7C%3D%2B%7C(%3F%3A%5C-%5C-%3D%3D)%2B)%24)
*/
if (exceptions.length === 0) {
// a space.
pattern += "\\s";
} else {
// a space or...
pattern += "(?:\\s|";
if (exceptions.length === 1) {
// a sequence of the exception pattern.
pattern += escapeAndRepeat(exceptions[0]);
} else {
// a sequence of one of the exception patterns.
pattern += "(?:";
pattern += exceptions.map(escapeAndRepeat).join("|");
pattern += ")";
}
pattern += `(?:$|[${Array.from(astUtils.LINEBREAKS).join("")}]))`;
}
return pattern;
} | javascript | function createExceptionsPattern(exceptions) {
let pattern = "";
/*
* A space or an exception pattern sequence.
* [] ==> "\s"
* ["-"] ==> "(?:\s|\-+$)"
* ["-", "="] ==> "(?:\s|(?:\-+|=+)$)"
* ["-", "=", "--=="] ==> "(?:\s|(?:\-+|=+|(?:\-\-==)+)$)" ==> https://jex.im/regulex/#!embed=false&flags=&re=(%3F%3A%5Cs%7C(%3F%3A%5C-%2B%7C%3D%2B%7C(%3F%3A%5C-%5C-%3D%3D)%2B)%24)
*/
if (exceptions.length === 0) {
// a space.
pattern += "\\s";
} else {
// a space or...
pattern += "(?:\\s|";
if (exceptions.length === 1) {
// a sequence of the exception pattern.
pattern += escapeAndRepeat(exceptions[0]);
} else {
// a sequence of one of the exception patterns.
pattern += "(?:";
pattern += exceptions.map(escapeAndRepeat).join("|");
pattern += ")";
}
pattern += `(?:$|[${Array.from(astUtils.LINEBREAKS).join("")}]))`;
}
return pattern;
} | [
"function",
"createExceptionsPattern",
"(",
"exceptions",
")",
"{",
"let",
"pattern",
"=",
"\"\"",
";",
"/*\n * A space or an exception pattern sequence.\n * [] ==> \"\\s\"\n * [\"-\"] ==> \"(?:\\s|\\-+$)\"\n * [\"-\", \"=\"] ==> \"(?:\\s|(?... | Creates string pattern for exceptions.
Generated pattern:
1. A space or an exception pattern sequence.
@param {string[]} exceptions - An exception pattern list.
@returns {string} A regular expression string for exceptions. | [
"Creates",
"string",
"pattern",
"for",
"exceptions",
".",
"Generated",
"pattern",
":"
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/spaced-comment.js#L58-L92 | train | Creates a pattern for the exception patterns. | [
30522,
3853,
3443,
10288,
24422,
13102,
20097,
2078,
1006,
11790,
1007,
1063,
2292,
5418,
1027,
1000,
1000,
1025,
1013,
1008,
1008,
1037,
2686,
2030,
2019,
6453,
5418,
5537,
1012,
1008,
1031,
1033,
1027,
1027,
1028,
1000,
1032,
1055,
1000,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/model/base/ManagedObjectModel.js | _traverseToLastManagedObject | function _traverseToLastManagedObject(aNodeStack) {
//Determine last managed object via node stack of getProperty
var sMember, i = aNodeStack.length - 1, aParts = [];
while (!(aNodeStack[i].node instanceof ManagedObject)) {
if (sMember) {
aParts.splice(0, 0, sMember);
}
sMember = aNodeStack[i].path;
i--;
}
return [aNodeStack[i].node, aNodeStack[i + 1], aParts, sMember];
} | javascript | function _traverseToLastManagedObject(aNodeStack) {
//Determine last managed object via node stack of getProperty
var sMember, i = aNodeStack.length - 1, aParts = [];
while (!(aNodeStack[i].node instanceof ManagedObject)) {
if (sMember) {
aParts.splice(0, 0, sMember);
}
sMember = aNodeStack[i].path;
i--;
}
return [aNodeStack[i].node, aNodeStack[i + 1], aParts, sMember];
} | [
"function",
"_traverseToLastManagedObject",
"(",
"aNodeStack",
")",
"{",
"//Determine last managed object via node stack of getProperty",
"var",
"sMember",
",",
"i",
"=",
"aNodeStack",
".",
"length",
"-",
"1",
",",
"aParts",
"=",
"[",
"]",
";",
"while",
"(",
"!",
... | Traverse in the recorded node stack of an object retrievel to tha last used
managed object in oder to be able to get the value/binding to use this
for further retrietment
@param aNodeStack
@returns {array} an array containing:
<ul>
<li>the last managed object</li>
<li>a map with the value of the last direct child and its path</li>
<li>an array of the remaining parts in the traversal</li>
<li>a string that represents the reimaining path from the last managed object to the value</li>
</ul> | [
"Traverse",
"in",
"the",
"recorded",
"node",
"stack",
"of",
"an",
"object",
"retrievel",
"to",
"tha",
"last",
"used",
"managed",
"object",
"in",
"oder",
"to",
"be",
"able",
"to",
"get",
"the",
"value",
"/",
"binding",
"to",
"use",
"this",
"for",
"further... | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/base/ManagedObjectModel.js#L77-L89 | train | Traverse the node stack to the last managed object | [
30522,
3853,
1035,
20811,
3406,
8523,
22942,
18655,
16429,
20614,
1006,
2019,
19847,
2696,
3600,
1007,
1063,
1013,
1013,
5646,
2197,
3266,
4874,
3081,
13045,
9991,
1997,
2131,
21572,
4842,
3723,
13075,
15488,
6633,
5677,
1010,
1045,
1027,
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... |
ColorlibHQ/AdminLTE | plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js | _wrapMatchesInNode | function _wrapMatchesInNode(textNode) {
var parentNode = textNode.parentNode,
nodeValue = wysihtml5.lang.string(textNode.data).escapeHTML(),
tempElement = _getTempElement(parentNode.ownerDocument);
// We need to insert an empty/temporary <span /> to fix IE quirks
// Elsewise IE would strip white space in the beginning
tempElement.innerHTML = "<span></span>" + _convertUrlsToLinks(nodeValue);
tempElement.removeChild(tempElement.firstChild);
while (tempElement.firstChild) {
// inserts tempElement.firstChild before textNode
parentNode.insertBefore(tempElement.firstChild, textNode);
}
parentNode.removeChild(textNode);
} | javascript | function _wrapMatchesInNode(textNode) {
var parentNode = textNode.parentNode,
nodeValue = wysihtml5.lang.string(textNode.data).escapeHTML(),
tempElement = _getTempElement(parentNode.ownerDocument);
// We need to insert an empty/temporary <span /> to fix IE quirks
// Elsewise IE would strip white space in the beginning
tempElement.innerHTML = "<span></span>" + _convertUrlsToLinks(nodeValue);
tempElement.removeChild(tempElement.firstChild);
while (tempElement.firstChild) {
// inserts tempElement.firstChild before textNode
parentNode.insertBefore(tempElement.firstChild, textNode);
}
parentNode.removeChild(textNode);
} | [
"function",
"_wrapMatchesInNode",
"(",
"textNode",
")",
"{",
"var",
"parentNode",
"=",
"textNode",
".",
"parentNode",
",",
"nodeValue",
"=",
"wysihtml5",
".",
"lang",
".",
"string",
"(",
"textNode",
".",
"data",
")",
".",
"escapeHTML",
"(",
")",
",",
"temp... | Replaces the original text nodes with the newly auto-linked dom tree | [
"Replaces",
"the",
"original",
"text",
"nodes",
"with",
"the",
"newly",
"auto",
"-",
"linked",
"dom",
"tree"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js#L4972-L4987 | train | Wrap matches in a node | [
30522,
3853,
1035,
10236,
18900,
8376,
23111,
10244,
1006,
3793,
3630,
3207,
1007,
1063,
13075,
6687,
3630,
3207,
1027,
3793,
3630,
3207,
1012,
6687,
3630,
3207,
1010,
13045,
10175,
5657,
1027,
1059,
7274,
19190,
21246,
2140,
2629,
1012,
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... |
aws/aws-sdk-js | lib/polly/presigner.js | Signer | function Signer(options) {
options = options || {};
this.options = options;
this.service = options.service;
this.bindServiceObject(options);
this._operations = {};
} | javascript | function Signer(options) {
options = options || {};
this.options = options;
this.service = options.service;
this.bindServiceObject(options);
this._operations = {};
} | [
"function",
"Signer",
"(",
"options",
")",
"{",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"this",
".",
"options",
"=",
"options",
";",
"this",
".",
"service",
"=",
"options",
".",
"service",
";",
"this",
".",
"bindServiceObject",
"(",
"options",
... | Creates a presigner object with a set of configuration options.
@option options params [map] An optional map of parameters to bind to every
request sent by this service object.
@option options service [AWS.Polly] An optional pre-configured instance
of the AWS.Polly service object to use for requests. The object may
bound parameters used by the presigner.
@see AWS.Polly.constructor | [
"Creates",
"a",
"presigner",
"object",
"with",
"a",
"set",
"of",
"configuration",
"options",
"."
] | c23e5f0edd150f8885267e5f7c8a564f8e6e8562 | https://github.com/aws/aws-sdk-js/blob/c23e5f0edd150f8885267e5f7c8a564f8e6e8562/lib/polly/presigner.js#L18-L24 | train | Signer constructor. | [
30522,
3853,
3696,
2121,
1006,
7047,
1007,
1063,
7047,
1027,
7047,
1064,
1064,
1063,
1065,
1025,
2023,
1012,
7047,
1027,
7047,
1025,
2023,
1012,
2326,
1027,
7047,
1012,
2326,
1025,
2023,
1012,
20817,
2121,
7903,
8780,
2497,
20614,
1006,
7... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/_GroupLock.js | _GroupLock | function _GroupLock(sGroupId, bLocked, oOwner, iSerialNumber) {
this.sGroupId = sGroupId;
this.bLocked = bLocked;
this.oOwner = oOwner;
// maps a group ID to a promise waiting for it, see waitFor
this.mPromiseForGroup = {};
// maps a group ID to the resolve function of the promise above
this.mResolveFunctionForGroup = {};
this.iSerialNumber = iSerialNumber === undefined ? Infinity : iSerialNumber;
} | javascript | function _GroupLock(sGroupId, bLocked, oOwner, iSerialNumber) {
this.sGroupId = sGroupId;
this.bLocked = bLocked;
this.oOwner = oOwner;
// maps a group ID to a promise waiting for it, see waitFor
this.mPromiseForGroup = {};
// maps a group ID to the resolve function of the promise above
this.mResolveFunctionForGroup = {};
this.iSerialNumber = iSerialNumber === undefined ? Infinity : iSerialNumber;
} | [
"function",
"_GroupLock",
"(",
"sGroupId",
",",
"bLocked",
",",
"oOwner",
",",
"iSerialNumber",
")",
"{",
"this",
".",
"sGroupId",
"=",
"sGroupId",
";",
"this",
".",
"bLocked",
"=",
"bLocked",
";",
"this",
".",
"oOwner",
"=",
"oOwner",
";",
"// maps a grou... | Constructs a potential lock for the given group ID. The group ID may be left empty initially,
you can set it later exactly once. A group lock may be created locked or unlocked. If locked,
its {@link #waitFor} returns a promise that is resolved when the lock is unlocked. If a
locked group lock does not have a group ID yet, it blocks all groups until the group is
specified via {@link #setGroupId}.
@param {string} [sGroupId]
The group ID
@param {boolean} [bLocked=false]
Whether the lock is locked
@param {object} [oOwner]
The lock's owner for debugging
@param {number} [iSerialNumber=Infinity]
A serial number which may be used on unlock
@alias sap.ui.model.odata.v4.lib._GroupLock
@constructor
@private | [
"Constructs",
"a",
"potential",
"lock",
"for",
"the",
"given",
"group",
"ID",
".",
"The",
"group",
"ID",
"may",
"be",
"left",
"empty",
"initially",
"you",
"can",
"set",
"it",
"later",
"exactly",
"once",
".",
"A",
"group",
"lock",
"may",
"be",
"created",
... | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_GroupLock.js#L31-L40 | train | Constructor for the GroupLock class | [
30522,
3853,
1035,
2177,
7878,
1006,
22214,
22107,
3593,
1010,
8534,
1010,
1051,
12384,
2121,
1010,
2003,
11610,
19666,
29440,
1007,
1063,
2023,
1012,
22214,
22107,
3593,
1027,
22214,
22107,
3593,
1025,
2023,
1012,
8534,
1027,
8534,
1025,
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... |
summernote/summernote | src/js/base/core/env.js | isFontInstalled | function isFontInstalled(fontName) {
const testFontName = fontName === 'Comic Sans MS' ? 'Courier New' : 'Comic Sans MS';
const testText = 'mmmmmmmmmmwwwww';
const testSize = '200px';
var canvas = document.createElement('canvas');
var context = canvas.getContext('2d');
context.font = testSize + " '" + testFontName + "'";
const originalWidth = context.measureText(testText).width;
context.font = testSize + " '" + fontName + "', '" + testFontName + "'";
const width = context.measureText(testText).width;
return originalWidth !== width;
} | javascript | function isFontInstalled(fontName) {
const testFontName = fontName === 'Comic Sans MS' ? 'Courier New' : 'Comic Sans MS';
const testText = 'mmmmmmmmmmwwwww';
const testSize = '200px';
var canvas = document.createElement('canvas');
var context = canvas.getContext('2d');
context.font = testSize + " '" + testFontName + "'";
const originalWidth = context.measureText(testText).width;
context.font = testSize + " '" + fontName + "', '" + testFontName + "'";
const width = context.measureText(testText).width;
return originalWidth !== width;
} | [
"function",
"isFontInstalled",
"(",
"fontName",
")",
"{",
"const",
"testFontName",
"=",
"fontName",
"===",
"'Comic Sans MS'",
"?",
"'Courier New'",
":",
"'Comic Sans MS'",
";",
"const",
"testText",
"=",
"'mmmmmmmmmmwwwww'",
";",
"const",
"testSize",
"=",
"'200px'",
... | eslint-disable-line
returns whether font is installed or not.
@param {String} fontName
@return {Boolean} | [
"eslint",
"-",
"disable",
"-",
"line",
"returns",
"whether",
"font",
"is",
"installed",
"or",
"not",
"."
] | 8dcafb8107453006b905ef697a529c42e76beb3f | https://github.com/summernote/summernote/blob/8dcafb8107453006b905ef697a529c42e76beb3f/src/js/base/core/env.js#L10-L25 | train | Check if font is installed | [
30522,
3853,
2003,
14876,
16778,
23808,
24164,
2094,
1006,
15489,
18442,
1007,
1063,
9530,
3367,
3231,
14876,
3372,
18442,
1027,
15489,
18442,
1027,
1027,
1027,
1005,
5021,
20344,
5796,
1005,
1029,
1005,
18092,
2047,
1005,
1024,
1005,
5021,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
nhn/tui.editor | src/js/extensions/table/tableDataHandler.js | createBasicCell | function createBasicCell(rowIndex, colIndex, nodeName) {
return {
nodeName: nodeName || 'TD',
colspan: 1,
rowspan: 1,
content: BASIC_CELL_CONTENT,
elementIndex: {
rowIndex,
colIndex
}
};
} | javascript | function createBasicCell(rowIndex, colIndex, nodeName) {
return {
nodeName: nodeName || 'TD',
colspan: 1,
rowspan: 1,
content: BASIC_CELL_CONTENT,
elementIndex: {
rowIndex,
colIndex
}
};
} | [
"function",
"createBasicCell",
"(",
"rowIndex",
",",
"colIndex",
",",
"nodeName",
")",
"{",
"return",
"{",
"nodeName",
":",
"nodeName",
"||",
"'TD'",
",",
"colspan",
":",
"1",
",",
"rowspan",
":",
"1",
",",
"content",
":",
"BASIC_CELL_CONTENT",
",",
"eleme... | Create basic cell data.
@param {number} rowIndex - row index
@param {number} colIndex - column index
@param {string} nodeName - node name
@returns {{
nodeName: string,
colspan: number,
rowspan: number,
content: string
}}
@ignore | [
"Create",
"basic",
"cell",
"data",
"."
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/extensions/table/tableDataHandler.js#L221-L232 | train | Creates a cell with the given row and column indices. | [
30522,
3853,
3443,
22083,
2594,
29109,
2140,
1006,
5216,
22254,
10288,
1010,
6972,
3207,
2595,
1010,
13045,
18442,
1007,
1063,
2709,
1063,
13045,
18442,
1024,
13045,
18442,
1064,
1064,
1005,
14595,
1005,
1010,
8902,
13102,
2319,
1024,
1015,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/wysiwygCommands/tableAlignCol.js | getRangeInformation | function getRangeInformation(range, selectionMgr) {
const $selectedCells = selectionMgr.getSelectedCells();
let rangeInformation, startCell;
if ($selectedCells.length) {
rangeInformation = selectionMgr.getSelectionRangeFromTable($selectedCells.first().get(0),
$selectedCells.last().get(0));
} else {
const {startContainer} = range;
startCell = domUtil.isTextNode(startContainer) ? $(startContainer).parent('td,th')[0] : startContainer;
rangeInformation = selectionMgr.getSelectionRangeFromTable(startCell, startCell);
}
return rangeInformation;
} | javascript | function getRangeInformation(range, selectionMgr) {
const $selectedCells = selectionMgr.getSelectedCells();
let rangeInformation, startCell;
if ($selectedCells.length) {
rangeInformation = selectionMgr.getSelectionRangeFromTable($selectedCells.first().get(0),
$selectedCells.last().get(0));
} else {
const {startContainer} = range;
startCell = domUtil.isTextNode(startContainer) ? $(startContainer).parent('td,th')[0] : startContainer;
rangeInformation = selectionMgr.getSelectionRangeFromTable(startCell, startCell);
}
return rangeInformation;
} | [
"function",
"getRangeInformation",
"(",
"range",
",",
"selectionMgr",
")",
"{",
"const",
"$selectedCells",
"=",
"selectionMgr",
".",
"getSelectedCells",
"(",
")",
";",
"let",
"rangeInformation",
",",
"startCell",
";",
"if",
"(",
"$selectedCells",
".",
"length",
... | Get range information
@param {Range} range Range object
@param {object} selectionMgr Table selection manager
@returns {object} | [
"Get",
"range",
"information"
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/wysiwygCommands/tableAlignCol.js#L115-L129 | train | Get selection range information | [
30522,
3853,
2131,
24388,
12377,
14192,
3370,
1006,
2846,
1010,
4989,
24798,
2099,
1007,
1063,
9530,
3367,
1002,
3479,
29109,
4877,
1027,
4989,
24798,
2099,
1012,
4152,
12260,
10985,
29109,
4877,
1006,
1007,
1025,
2292,
2846,
2378,
14192,
3... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SeleniumHQ/selenium | third_party/js/mozmill/shared-modules/tabs.js | getTabsWithURL | function getTabsWithURL(aUrl) {
var tabs = [ ];
var uri = utils.createURI(aUrl, null, null);
var wm = Cc["@mozilla.org/appshell/window-mediator;1"].
getService(Ci.nsIWindowMediator);
var winEnum = wm.getEnumerator("navigator:browser");
// Iterate through all windows
while (winEnum.hasMoreElements()) {
var window = winEnum.getNext();
// Don't check windows which are about to close or don't have gBrowser set
if (window.closed || !("gBrowser" in window))
continue;
// Iterate through all tabs in the current window
var browsers = window.gBrowser.browsers;
for (var i = 0; i < browsers.length; i++) {
var browser = browsers[i];
if (browser.currentURI.equals(uri)) {
tabs.push({
controller : new mozmill.controller.MozMillController(window),
index : i
});
}
}
}
return tabs;
} | javascript | function getTabsWithURL(aUrl) {
var tabs = [ ];
var uri = utils.createURI(aUrl, null, null);
var wm = Cc["@mozilla.org/appshell/window-mediator;1"].
getService(Ci.nsIWindowMediator);
var winEnum = wm.getEnumerator("navigator:browser");
// Iterate through all windows
while (winEnum.hasMoreElements()) {
var window = winEnum.getNext();
// Don't check windows which are about to close or don't have gBrowser set
if (window.closed || !("gBrowser" in window))
continue;
// Iterate through all tabs in the current window
var browsers = window.gBrowser.browsers;
for (var i = 0; i < browsers.length; i++) {
var browser = browsers[i];
if (browser.currentURI.equals(uri)) {
tabs.push({
controller : new mozmill.controller.MozMillController(window),
index : i
});
}
}
}
return tabs;
} | [
"function",
"getTabsWithURL",
"(",
"aUrl",
")",
"{",
"var",
"tabs",
"=",
"[",
"]",
";",
"var",
"uri",
"=",
"utils",
".",
"createURI",
"(",
"aUrl",
",",
"null",
",",
"null",
")",
";",
"var",
"wm",
"=",
"Cc",
"[",
"\"@mozilla.org/appshell/window-mediator;1... | Check and return all open tabs with the specified URL
@param {string} aUrl
URL to check for
@returns Array of tabs | [
"Check",
"and",
"return",
"all",
"open",
"tabs",
"with",
"the",
"specified",
"URL"
] | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/tabs.js#L80-L111 | train | Get tabs with a given URL | [
30522,
3853,
2131,
2696,
5910,
24415,
3126,
2140,
1006,
8740,
12190,
1007,
1063,
13075,
21628,
2015,
1027,
1031,
1033,
1025,
13075,
24471,
2072,
1027,
21183,
12146,
1012,
3443,
9496,
1006,
8740,
12190,
1010,
19701,
1010,
19701,
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... |
SheetJS/js-xlsx | xlsx.js | parse_Palette | function parse_Palette(blob) {
var ccv = blob.read_shift(2);
var o = [];
while(ccv-->0) o.push(parse_LongRGB(blob, 8));
return o;
} | javascript | function parse_Palette(blob) {
var ccv = blob.read_shift(2);
var o = [];
while(ccv-->0) o.push(parse_LongRGB(blob, 8));
return o;
} | [
"function",
"parse_Palette",
"(",
"blob",
")",
"{",
"var",
"ccv",
"=",
"blob",
".",
"read_shift",
"(",
"2",
")",
";",
"var",
"o",
"=",
"[",
"]",
";",
"while",
"(",
"ccv",
"--",
">",
"0",
")",
"o",
".",
"push",
"(",
"parse_LongRGB",
"(",
"blob",
... | /* [MS-XLS] 2.4.188 | [
"/",
"*",
"[",
"MS",
"-",
"XLS",
"]",
"2",
".",
"4",
".",
"188"
] | 9a6d8a1d3d80c78dad5201fb389316f935279cdc | https://github.com/SheetJS/js-xlsx/blob/9a6d8a1d3d80c78dad5201fb389316f935279cdc/xlsx.js#L6489-L6494 | train | Parse palette from blob | [
30522,
3853,
11968,
3366,
1035,
27396,
1006,
1038,
4135,
2497,
1007,
1063,
13075,
10507,
2615,
1027,
1038,
4135,
2497,
1012,
3191,
1035,
5670,
1006,
1016,
1007,
1025,
13075,
1051,
1027,
1031,
1033,
1025,
2096,
1006,
10507,
2615,
1011,
1011,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/LiveDevelopment/Agents/RemoteFunctions.js | highlightRule | function highlightRule(rule) {
hideHighlight();
var i, nodes = window.document.querySelectorAll(rule);
for (i = 0; i < nodes.length; i++) {
highlight(nodes[i]);
}
_remoteHighlight.selector = rule;
} | javascript | function highlightRule(rule) {
hideHighlight();
var i, nodes = window.document.querySelectorAll(rule);
for (i = 0; i < nodes.length; i++) {
highlight(nodes[i]);
}
_remoteHighlight.selector = rule;
} | [
"function",
"highlightRule",
"(",
"rule",
")",
"{",
"hideHighlight",
"(",
")",
";",
"var",
"i",
",",
"nodes",
"=",
"window",
".",
"document",
".",
"querySelectorAll",
"(",
"rule",
")",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"nodes",
".",
"l... | highlight a rule | [
"highlight",
"a",
"rule"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/LiveDevelopment/Agents/RemoteFunctions.js#L675-L682 | train | Highlights a rule | [
30522,
30524,
14164,
1012,
3091,
1025,
1045,
1009,
1009,
1007,
1063,
12944,
1006,
14164,
1031,
1045,
1033,
1007,
1025,
1065,
1035,
6556,
4048,
5603,
7138,
1012,
27000,
1027,
3627,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/ControlTreeModifier.js | function (oControl, bVisible) {
var bOldVisible = this.getVisible(oControl);
var vReturnValue = JsControlTreeModifier.setVisible.apply(this, arguments);
/* If the visibility changed, record the reversal as undo operation */
if (bOldVisible !== this.getVisible(oControl)){
this._saveUndoOperation("setVisible", [oControl, bOldVisible]);
}
return vReturnValue;
} | javascript | function (oControl, bVisible) {
var bOldVisible = this.getVisible(oControl);
var vReturnValue = JsControlTreeModifier.setVisible.apply(this, arguments);
/* If the visibility changed, record the reversal as undo operation */
if (bOldVisible !== this.getVisible(oControl)){
this._saveUndoOperation("setVisible", [oControl, bOldVisible]);
}
return vReturnValue;
} | [
"function",
"(",
"oControl",
",",
"bVisible",
")",
"{",
"var",
"bOldVisible",
"=",
"this",
".",
"getVisible",
"(",
"oControl",
")",
";",
"var",
"vReturnValue",
"=",
"JsControlTreeModifier",
".",
"setVisible",
".",
"apply",
"(",
"this",
",",
"arguments",
")",... | Execute the visibility change from parent and record the opposite visibility as undo operation
@override | [
"Execute",
"the",
"visibility",
"change",
"from",
"parent",
"and",
"record",
"the",
"opposite",
"visibility",
"as",
"undo",
"operation"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.rta/src/sap/ui/rta/ControlTreeModifier.js#L77-L88 | train | Sets the visibility of the control. | [
30522,
3853,
1006,
1051,
8663,
13181,
30524,
7028,
1012,
6611,
1006,
2023,
1010,
9918,
1007,
1025,
1013,
1008,
2065,
1996,
16476,
2904,
1010,
2501,
1996,
23163,
2004,
25672,
3169,
1008,
1013,
2065,
1006,
7782,
11365,
7028,
999,
1027,
1027,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
jantimon/html-webpack-plugin | lib/html-tags.js | createHtmlTagObject | function createHtmlTagObject (tagName, attributes, innerHTML) {
return {
tagName: tagName,
voidTag: voidTags.indexOf(tagName) !== -1,
attributes: attributes || {},
innerHTML: innerHTML
};
} | javascript | function createHtmlTagObject (tagName, attributes, innerHTML) {
return {
tagName: tagName,
voidTag: voidTags.indexOf(tagName) !== -1,
attributes: attributes || {},
innerHTML: innerHTML
};
} | [
"function",
"createHtmlTagObject",
"(",
"tagName",
",",
"attributes",
",",
"innerHTML",
")",
"{",
"return",
"{",
"tagName",
":",
"tagName",
",",
"voidTag",
":",
"voidTags",
".",
"indexOf",
"(",
"tagName",
")",
"!==",
"-",
"1",
",",
"attributes",
":",
"attr... | Static helper to create a tag object to be get injected into the dom
@param {string} tagName
the name of the tage e.g. 'div'
@param {{[attributeName: string]: string|boolean}} [attributes]
tag attributes e.g. `{ 'class': 'example', disabled: true }`
@param {string} [innerHTML]
@returns {HtmlTagObject} | [
"Static",
"helper",
"to",
"create",
"a",
"tag",
"object",
"to",
"be",
"get",
"injected",
"into",
"the",
"dom"
] | 38db64ae8805de37d038e0ee0f6dfa2a26e2163a | https://github.com/jantimon/html-webpack-plugin/blob/38db64ae8805de37d038e0ee0f6dfa2a26e2163a/lib/html-tags.js#L59-L66 | train | Create an object that can be used to create a tag object | [
30522,
3853,
3443,
11039,
19968,
15900,
16429,
20614,
1006,
6415,
18442,
1010,
12332,
1010,
5110,
11039,
19968,
1007,
1063,
2709,
1063,
6415,
18442,
1024,
6415,
18442,
1010,
11675,
15900,
1024,
11675,
15900,
2015,
1012,
5950,
11253,
1006,
641... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/core/CustomizingConfiguration.js | function(sComponentName) {
Log.info("CustomizingConfiguration: activateForComponent('" + sComponentName + "')");
var sFullComponentName = sComponentName + ".Component";
sap.ui.requireSync(sFullComponentName.replace(/\./g, "/"));
var oCustomizingConfig = ObjectPath.get(sFullComponentName).getMetadata().getCustomizing();
mComponentConfigs[sComponentName] = oCustomizingConfig;
Log.debug("CustomizingConfiguration: customizing configuration for component '" + sComponentName + "' loaded: " + JSON.stringify(oCustomizingConfig));
} | javascript | function(sComponentName) {
Log.info("CustomizingConfiguration: activateForComponent('" + sComponentName + "')");
var sFullComponentName = sComponentName + ".Component";
sap.ui.requireSync(sFullComponentName.replace(/\./g, "/"));
var oCustomizingConfig = ObjectPath.get(sFullComponentName).getMetadata().getCustomizing();
mComponentConfigs[sComponentName] = oCustomizingConfig;
Log.debug("CustomizingConfiguration: customizing configuration for component '" + sComponentName + "' loaded: " + JSON.stringify(oCustomizingConfig));
} | [
"function",
"(",
"sComponentName",
")",
"{",
"Log",
".",
"info",
"(",
"\"CustomizingConfiguration: activateForComponent('\"",
"+",
"sComponentName",
"+",
"\"')\"",
")",
";",
"var",
"sFullComponentName",
"=",
"sComponentName",
"+",
"\".Component\"",
";",
"sap",
".",
... | Activates the Customizing of a component by registering the component
configuration in the central customizing configuration.
@param {string} sComponentName the name of the component
@private | [
"Activates",
"the",
"Customizing",
"of",
"a",
"component",
"by",
"registering",
"the",
"component",
"configuration",
"in",
"the",
"central",
"customizing",
"configuration",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/CustomizingConfiguration.js#L98-L106 | train | Activate customizing for a component | [
30522,
3853,
1006,
8040,
25377,
5643,
3372,
18442,
1007,
1063,
8833,
1012,
18558,
1006,
1000,
7661,
6026,
8663,
8873,
27390,
3370,
1024,
20544,
29278,
9006,
29513,
3372,
1006,
1005,
1000,
1009,
8040,
25377,
5643,
3372,
18442,
1009,
1000,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Parser.js | brackets | function brackets() {
for (;;) {
oToken = that.advance();
if (!oToken || oToken.id === ';') {
that.expected("')'", oToken);
}
sValue += oToken.value;
if (oToken.id === ")") {
return;
}
if (oToken.id === "(") {
brackets();
}
}
} | javascript | function brackets() {
for (;;) {
oToken = that.advance();
if (!oToken || oToken.id === ';') {
that.expected("')'", oToken);
}
sValue += oToken.value;
if (oToken.id === ")") {
return;
}
if (oToken.id === "(") {
brackets();
}
}
} | [
"function",
"brackets",
"(",
")",
"{",
"for",
"(",
";",
";",
")",
"{",
"oToken",
"=",
"that",
".",
"advance",
"(",
")",
";",
"if",
"(",
"!",
"oToken",
"||",
"oToken",
".",
"id",
"===",
"';'",
")",
"{",
"that",
".",
"expected",
"(",
"\"')'\"",
"... | recursive function that advances and adds to sValue until the matching closing bracket has been consumed | [
"recursive",
"function",
"that",
"advances",
"and",
"adds",
"to",
"sValue",
"until",
"the",
"matching",
"closing",
"bracket",
"has",
"been",
"consumed"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Parser.js#L482-L496 | train | The following code is used to parse the brackets. | [
30522,
3853,
19719,
1006,
1007,
1063,
2005,
1006,
1025,
1025,
1007,
1063,
27178,
11045,
2078,
1027,
2008,
1012,
5083,
1006,
1007,
1025,
2065,
1006,
999,
27178,
11045,
2078,
1064,
1064,
27178,
11045,
2078,
1012,
8909,
1027,
1027,
1027,
1005,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
openlayers/openlayers | src/ol/events.js | getListenerMap | function getListenerMap(target, opt_create) {
let listenerMap = target.ol_lm;
if (!listenerMap && opt_create) {
listenerMap = target.ol_lm = {};
}
return listenerMap;
} | javascript | function getListenerMap(target, opt_create) {
let listenerMap = target.ol_lm;
if (!listenerMap && opt_create) {
listenerMap = target.ol_lm = {};
}
return listenerMap;
} | [
"function",
"getListenerMap",
"(",
"target",
",",
"opt_create",
")",
"{",
"let",
"listenerMap",
"=",
"target",
".",
"ol_lm",
";",
"if",
"(",
"!",
"listenerMap",
"&&",
"opt_create",
")",
"{",
"listenerMap",
"=",
"target",
".",
"ol_lm",
"=",
"{",
"}",
";",... | Get the lookup of listeners.
@param {Object} target Target.
@param {boolean=} opt_create If a map should be created if it doesn't exist.
@return {!Object<string, Array<EventsKey>>} Map of
listeners by event type. | [
"Get",
"the",
"lookup",
"of",
"listeners",
"."
] | f366eaea522388fb575b11010e69d309164baca7 | https://github.com/openlayers/openlayers/blob/f366eaea522388fb575b11010e69d309164baca7/src/ol/events.js#L93-L99 | train | Get the listener map for a given target | [
30522,
3853,
2131,
9863,
24454,
2863,
2361,
1006,
4539,
1010,
23569,
1035,
3443,
1007,
1063,
2292,
19373,
2863,
2361,
1027,
4539,
1012,
19330,
1035,
1048,
2213,
1025,
2065,
1006,
999,
19373,
2863,
2361,
1004,
1004,
23569,
1035,
3443,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/LiveDevelopment/LiveDevelopment.js | onActiveEditorChange | function onActiveEditorChange(event, current, previous) {
if (previous && previous.document &&
CSSUtils.isCSSPreprocessorFile(previous.document.file.fullPath)) {
var prevDocUrl = _server && _server.pathToUrl(previous.document.file.fullPath);
if (_relatedDocuments && _relatedDocuments[prevDocUrl]) {
_closeRelatedDocument(_relatedDocuments[prevDocUrl]);
}
}
if (current && current.document &&
CSSUtils.isCSSPreprocessorFile(current.document.file.fullPath)) {
var docUrl = _server && _server.pathToUrl(current.document.file.fullPath);
_styleSheetAdded(null, docUrl);
}
} | javascript | function onActiveEditorChange(event, current, previous) {
if (previous && previous.document &&
CSSUtils.isCSSPreprocessorFile(previous.document.file.fullPath)) {
var prevDocUrl = _server && _server.pathToUrl(previous.document.file.fullPath);
if (_relatedDocuments && _relatedDocuments[prevDocUrl]) {
_closeRelatedDocument(_relatedDocuments[prevDocUrl]);
}
}
if (current && current.document &&
CSSUtils.isCSSPreprocessorFile(current.document.file.fullPath)) {
var docUrl = _server && _server.pathToUrl(current.document.file.fullPath);
_styleSheetAdded(null, docUrl);
}
} | [
"function",
"onActiveEditorChange",
"(",
"event",
",",
"current",
",",
"previous",
")",
"{",
"if",
"(",
"previous",
"&&",
"previous",
".",
"document",
"&&",
"CSSUtils",
".",
"isCSSPreprocessorFile",
"(",
"previous",
".",
"document",
".",
"file",
".",
"fullPath... | If the current editor is for a CSS preprocessor file, then add it to the style sheet
so that we can track cursor positions in the editor to show live preview highlighting.
For normal CSS we only do highlighting from files we know for sure are referenced by the
current live preview document, but for preprocessors we just assume that any preprocessor
file you edit is probably related to the live preview.
@param {Event} event (unused)
@param {Editor} current Current editor
@param {Editor} previous Previous editor | [
"If",
"the",
"current",
"editor",
"is",
"for",
"a",
"CSS",
"preprocessor",
"file",
"then",
"add",
"it",
"to",
"the",
"style",
"sheet",
"so",
"that",
"we",
"can",
"track",
"cursor",
"positions",
"in",
"the",
"editor",
"to",
"show",
"live",
"preview",
"hig... | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/LiveDevelopment/LiveDevelopment.js#L783-L797 | train | onActiveEditorChange - On Active Editor change | [
30522,
3853,
2006,
19620,
2098,
15660,
22305,
2063,
1006,
2724,
1010,
2783,
1010,
3025,
1007,
1063,
2065,
1006,
3025,
1004,
1004,
3025,
1012,
6254,
1004,
1004,
20116,
6342,
3775,
4877,
1012,
2003,
6169,
13102,
2890,
21572,
9623,
21748,
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... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/model/odata/_AnnotationHelperExpression.js | function (oModel, sPath) {
var aMatches,
aParts = sPath.split('/'),
sObjectPath,
sRecordType;
/**
* Processes the property with the given path of the object at <code>sObjectPath</code>.
* If it exists and is of type "string", the index at position <code>i</code> in
* <code>aParts</code> is replaced by a query "[${propertyPath}==='propertyValue']".
*
* @param {string} sPropertyPath the property path
* @param {number} i the index in aParts
* @returns {boolean} true if the index was replaced by a query
*/
function processProperty(sPropertyPath, i) {
var sProperty = oModel.getProperty(sObjectPath + "/" + sPropertyPath);
if (typeof sProperty === "string") {
aParts[i] = "[${" + sPropertyPath + "}===" + Basics.toJSON(sProperty) + "]";
return true;
}
return false;
}
aMatches = rSchemaPath.exec(sPath);
if (!aMatches) {
return sPath;
}
sObjectPath = aMatches[1];
// aParts now contains ["", "dataServices", "schema", "<i>", ...]
// try to replace the schema index in aParts[3] by a query for the schema's namespace
if (!processProperty("namespace", 3)) {
return sPath;
}
// continue after the schema index
for (var i = 4; i < aParts.length; i += 1) {
sObjectPath = sObjectPath + "/" + aParts[i];
// if there is an index, first try a query for "name"
if (rInteger.test(aParts[i]) && !processProperty("name", i)) {
// check data fields: since they always extend DataFieldAbstract, the record
// type must be given
sRecordType = oModel.getProperty(sObjectPath + "/RecordType");
if (sRecordType) {
if (sRecordType === "com.sap.vocabularies.UI.v1.DataFieldForAction") {
processProperty("Action/String", i);
} else if (sRecordType ===
"com.sap.vocabularies.UI.v1.DataFieldForAnnotation") {
processProperty("Target/AnnotationPath", i);
} else if (sRecordType.indexOf("com.sap.vocabularies.UI.v1.DataField")
=== 0) {
processProperty("Value/Path", i);
}
}
}
}
return aParts.join('/');
} | javascript | function (oModel, sPath) {
var aMatches,
aParts = sPath.split('/'),
sObjectPath,
sRecordType;
/**
* Processes the property with the given path of the object at <code>sObjectPath</code>.
* If it exists and is of type "string", the index at position <code>i</code> in
* <code>aParts</code> is replaced by a query "[${propertyPath}==='propertyValue']".
*
* @param {string} sPropertyPath the property path
* @param {number} i the index in aParts
* @returns {boolean} true if the index was replaced by a query
*/
function processProperty(sPropertyPath, i) {
var sProperty = oModel.getProperty(sObjectPath + "/" + sPropertyPath);
if (typeof sProperty === "string") {
aParts[i] = "[${" + sPropertyPath + "}===" + Basics.toJSON(sProperty) + "]";
return true;
}
return false;
}
aMatches = rSchemaPath.exec(sPath);
if (!aMatches) {
return sPath;
}
sObjectPath = aMatches[1];
// aParts now contains ["", "dataServices", "schema", "<i>", ...]
// try to replace the schema index in aParts[3] by a query for the schema's namespace
if (!processProperty("namespace", 3)) {
return sPath;
}
// continue after the schema index
for (var i = 4; i < aParts.length; i += 1) {
sObjectPath = sObjectPath + "/" + aParts[i];
// if there is an index, first try a query for "name"
if (rInteger.test(aParts[i]) && !processProperty("name", i)) {
// check data fields: since they always extend DataFieldAbstract, the record
// type must be given
sRecordType = oModel.getProperty(sObjectPath + "/RecordType");
if (sRecordType) {
if (sRecordType === "com.sap.vocabularies.UI.v1.DataFieldForAction") {
processProperty("Action/String", i);
} else if (sRecordType ===
"com.sap.vocabularies.UI.v1.DataFieldForAnnotation") {
processProperty("Target/AnnotationPath", i);
} else if (sRecordType.indexOf("com.sap.vocabularies.UI.v1.DataField")
=== 0) {
processProperty("Value/Path", i);
}
}
}
}
return aParts.join('/');
} | [
"function",
"(",
"oModel",
",",
"sPath",
")",
"{",
"var",
"aMatches",
",",
"aParts",
"=",
"sPath",
".",
"split",
"(",
"'/'",
")",
",",
"sObjectPath",
",",
"sRecordType",
";",
"/**\n\t\t\t * Processes the property with the given path of the object at <code>sObjectPath</c... | Replaces the indexes in the given path by queries in the form
<code>[${key}==='value']</code> if possible. Expects the path to start with
"/dataServices/schema/<i>/".
@param {sap.ui.model.Model} oModel
the model the path belongs to
@param {string} sPath
the path, where to replace the indexes
@returns {string}
the replaced path | [
"Replaces",
"the",
"indexes",
"in",
"the",
"given",
"path",
"by",
"queries",
"in",
"the",
"form",
"<code",
">",
"[",
"$",
"{",
"key",
"}",
"===",
"value",
"]",
"<",
"/",
"code",
">",
"if",
"possible",
".",
"Expects",
"the",
"path",
"to",
"start",
"... | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/_AnnotationHelperExpression.js#L802-L859 | train | Checks if the given property path is a valid index in the given model. | [
30522,
3853,
1006,
18168,
10244,
2140,
1010,
14690,
2232,
1007,
1063,
13075,
25933,
10649,
2229,
1010,
4237,
2015,
1027,
14690,
2232,
1012,
3975,
1006,
1005,
1013,
1005,
1007,
1010,
17540,
20614,
15069,
1010,
5034,
8586,
8551,
13874,
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... | |
angular/material | gulp/util.js | validateProp | function validateProp(prop) {
return prop && prop.type === 'decl' && ![prop.prop, prop.value].some(function(value) {
return value.indexOf('-') > -1 && prefixRegex.test(value);
});
} | javascript | function validateProp(prop) {
return prop && prop.type === 'decl' && ![prop.prop, prop.value].some(function(value) {
return value.indexOf('-') > -1 && prefixRegex.test(value);
});
} | [
"function",
"validateProp",
"(",
"prop",
")",
"{",
"return",
"prop",
"&&",
"prop",
".",
"type",
"===",
"'decl'",
"&&",
"!",
"[",
"prop",
".",
"prop",
",",
"prop",
".",
"value",
"]",
".",
"some",
"(",
"function",
"(",
"value",
")",
"{",
"return",
"v... | Checks if a property is a style declaration and that it doesn't contain any vendor prefixes. | [
"Checks",
"if",
"a",
"property",
"is",
"a",
"style",
"declaration",
"and",
"that",
"it",
"doesn",
"t",
"contain",
"any",
"vendor",
"prefixes",
"."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/gulp/util.js#L289-L293 | train | Validate a property | [
30522,
3853,
9398,
3686,
21572,
2361,
1006,
17678,
1007,
1063,
2709,
17678,
1004,
1004,
17678,
1012,
2828,
1027,
1027,
1027,
1005,
11703,
2140,
1005,
1004,
1004,
999,
1031,
17678,
1012,
17678,
1010,
17678,
1012,
3643,
1033,
1012,
2070,
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... |
SeleniumHQ/selenium | third_party/closure/goog/labs/format/csv.js | readField | function readField() {
var start = index;
var didSeeComma = sawComma;
sawComma = false;
var token = nextToken();
if (token == EMPTY) {
return EOR;
}
if (token == EOF || token == NEWLINE) {
if (didSeeComma) {
pushBack(EMPTY);
return '';
}
return EOR;
}
// This is the beginning of a quoted field.
if (token == '"') {
return readQuotedField();
}
while (true) {
// This is the end of line or file.
if (token == EOF || token == NEWLINE) {
pushBack(token);
break;
}
// This is the end of record.
if (token == delimiter) {
sawComma = true;
break;
}
if (token == '"' && !opt_ignoreErrors) {
throw new goog.labs.format.csv.ParseError(
text, index - 1, 'Unexpected quote mark');
}
token = nextToken();
}
var returnString = (token == EOF) ?
text.substring(start) : // Return to end of file.
text.substring(start, index - 1);
return returnString.replace(/[\r\n]+/g, ''); // Squash any CRLFs.
} | javascript | function readField() {
var start = index;
var didSeeComma = sawComma;
sawComma = false;
var token = nextToken();
if (token == EMPTY) {
return EOR;
}
if (token == EOF || token == NEWLINE) {
if (didSeeComma) {
pushBack(EMPTY);
return '';
}
return EOR;
}
// This is the beginning of a quoted field.
if (token == '"') {
return readQuotedField();
}
while (true) {
// This is the end of line or file.
if (token == EOF || token == NEWLINE) {
pushBack(token);
break;
}
// This is the end of record.
if (token == delimiter) {
sawComma = true;
break;
}
if (token == '"' && !opt_ignoreErrors) {
throw new goog.labs.format.csv.ParseError(
text, index - 1, 'Unexpected quote mark');
}
token = nextToken();
}
var returnString = (token == EOF) ?
text.substring(start) : // Return to end of file.
text.substring(start, index - 1);
return returnString.replace(/[\r\n]+/g, ''); // Squash any CRLFs.
} | [
"function",
"readField",
"(",
")",
"{",
"var",
"start",
"=",
"index",
";",
"var",
"didSeeComma",
"=",
"sawComma",
";",
"sawComma",
"=",
"false",
";",
"var",
"token",
"=",
"nextToken",
"(",
")",
";",
"if",
"(",
"token",
"==",
"EMPTY",
")",
"{",
"retur... | Read a field from input.
@return {string|!goog.labs.format.csv.Sentinels_} The field, as a string,
or a sentinel (if applicable). | [
"Read",
"a",
"field",
"from",
"input",
"."
] | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/closure/goog/labs/format/csv.js#L289-L337 | train | Read a field from the current line. | [
30522,
3853,
3191,
3790,
1006,
1007,
1063,
13075,
2707,
1027,
5950,
1025,
13075,
2106,
19763,
9006,
2863,
1027,
2387,
9006,
2863,
1025,
2387,
9006,
2863,
1027,
6270,
1025,
13075,
19204,
1027,
2279,
18715,
2368,
1006,
1007,
1025,
2065,
1006,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
lynckia/licode | extras/basic_example/public/script.js | toggleSlideShowMode | function toggleSlideShowMode() {
const streams = room.remoteStreams;
const cb = (evt) => {
console.log('SlideShowMode changed', evt);
};
slideShowMode = !slideShowMode;
streams.forEach((stream) => {
if (localStream.getID() !== stream.getID()) {
console.log('Updating config');
stream.updateConfiguration({ slideShowMode }, cb);
}
});
} | javascript | function toggleSlideShowMode() {
const streams = room.remoteStreams;
const cb = (evt) => {
console.log('SlideShowMode changed', evt);
};
slideShowMode = !slideShowMode;
streams.forEach((stream) => {
if (localStream.getID() !== stream.getID()) {
console.log('Updating config');
stream.updateConfiguration({ slideShowMode }, cb);
}
});
} | [
"function",
"toggleSlideShowMode",
"(",
")",
"{",
"const",
"streams",
"=",
"room",
".",
"remoteStreams",
";",
"const",
"cb",
"=",
"(",
"evt",
")",
"=>",
"{",
"console",
".",
"log",
"(",
"'SlideShowMode changed'",
",",
"evt",
")",
";",
"}",
";",
"slideSho... | eslint-disable-next-line no-unused-vars | [
"eslint",
"-",
"disable",
"-",
"next",
"-",
"line",
"no",
"-",
"unused",
"-",
"vars"
] | ce1f09ae30054f677fc25f2011b0e5072fa6f71f | https://github.com/lynckia/licode/blob/ce1f09ae30054f677fc25f2011b0e5072fa6f71f/extras/basic_example/public/script.js#L45-L57 | train | Toggle slideShowMode | [
30522,
3853,
2000,
24989,
24198,
22231,
2860,
5302,
3207,
1006,
1007,
1063,
9530,
3367,
9199,
1027,
2282,
1012,
6556,
21422,
2015,
1025,
9530,
3367,
17324,
1027,
1006,
23408,
2102,
1007,
1027,
1028,
1063,
10122,
1012,
8833,
1006,
1005,
1481... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | examples/showcase/link-traversal/js/components/aframe-tooltip-component.js | function (oldData) {
var data = this.data;
this.material.color.setStyle(data.color);
this.material.opacity = data.opacity;
this.material.transparent = data.transparent;
this.material.wireframe = data.debug;
this.material.side = parseSide(data.side);
var diff = AFRAME.utils.diff(data, oldData);
if ('src' in diff) {
this.updateMap();
}
else if ('width' in diff || 'height' in diff || 'padding' in diff || 'left' in diff || 'top' in diff || 'bottom' in diff || 'right' in diff) {
this.regenerateMesh();
}
} | javascript | function (oldData) {
var data = this.data;
this.material.color.setStyle(data.color);
this.material.opacity = data.opacity;
this.material.transparent = data.transparent;
this.material.wireframe = data.debug;
this.material.side = parseSide(data.side);
var diff = AFRAME.utils.diff(data, oldData);
if ('src' in diff) {
this.updateMap();
}
else if ('width' in diff || 'height' in diff || 'padding' in diff || 'left' in diff || 'top' in diff || 'bottom' in diff || 'right' in diff) {
this.regenerateMesh();
}
} | [
"function",
"(",
"oldData",
")",
"{",
"var",
"data",
"=",
"this",
".",
"data",
";",
"this",
".",
"material",
".",
"color",
".",
"setStyle",
"(",
"data",
".",
"color",
")",
";",
"this",
".",
"material",
".",
"opacity",
"=",
"data",
".",
"opacity",
"... | Called when component is attached and when component data changes.
Generally modifies the entity based on the data. | [
"Called",
"when",
"component",
"is",
"attached",
"and",
"when",
"component",
"data",
"changes",
".",
"Generally",
"modifies",
"the",
"entity",
"based",
"on",
"the",
"data",
"."
] | 24acc78a7299a4cdfe3ef617f4d40ddf6275c992 | https://github.com/aframevr/aframe/blob/24acc78a7299a4cdfe3ef617f4d40ddf6275c992/examples/showcase/link-traversal/js/components/aframe-tooltip-component.js#L312-L328 | train | Update the material | [
30522,
3853,
1006,
2214,
2850,
2696,
1007,
1063,
13075,
2951,
1027,
2023,
1012,
2951,
1025,
2023,
1012,
3430,
1012,
3609,
1012,
4520,
27983,
1006,
2951,
1012,
3609,
1007,
1025,
2023,
1012,
3430,
1012,
6728,
6305,
3012,
1027,
2951,
1012,
6... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
GitbookIO/gitbook | lib/utils/command.js | escapeShellArg | function escapeShellArg(value) {
if (is.number(value)) {
return value;
}
value = String(value);
value = value.replace(/"/g, '\\"');
return '"' + value + '"';
} | javascript | function escapeShellArg(value) {
if (is.number(value)) {
return value;
}
value = String(value);
value = value.replace(/"/g, '\\"');
return '"' + value + '"';
} | [
"function",
"escapeShellArg",
"(",
"value",
")",
"{",
"if",
"(",
"is",
".",
"number",
"(",
"value",
")",
")",
"{",
"return",
"value",
";",
"}",
"value",
"=",
"String",
"(",
"value",
")",
";",
"value",
"=",
"value",
".",
"replace",
"(",
"/",
"\"",
... | Transform an option object to a command line string
@param {String|number} value
@param {String} | [
"Transform",
"an",
"option",
"object",
"to",
"a",
"command",
"line",
"string"
] | 6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4 | https://github.com/GitbookIO/gitbook/blob/6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4/lib/utils/command.js#L77-L86 | train | Escape shell arguments | [
30522,
3853,
12976,
18223,
2906,
2290,
1006,
3643,
1007,
1063,
2065,
1006,
2003,
1012,
2193,
1006,
3643,
1007,
1007,
1063,
2709,
3643,
1025,
1065,
3643,
1027,
5164,
1006,
3643,
1007,
1025,
3643,
1027,
3643,
1012,
5672,
1006,
1013,
1000,
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/QuickView/main.js | queryPreviewProviders | function queryPreviewProviders(editor, pos, token) {
var line = editor.document.getLine(pos.line);
// FUTURE: Support plugin providers. For now we just hard-code...
var popover = colorAndGradientPreviewProvider(editor, pos, token, line) ||
imagePreviewProvider(editor, pos, token, line);
if (popover) {
// Providers return just { start, end, content, ?onShow, xpos, ytop, ybot }
popover.visible = false;
popover.editor = editor;
return popover;
}
return null;
} | javascript | function queryPreviewProviders(editor, pos, token) {
var line = editor.document.getLine(pos.line);
// FUTURE: Support plugin providers. For now we just hard-code...
var popover = colorAndGradientPreviewProvider(editor, pos, token, line) ||
imagePreviewProvider(editor, pos, token, line);
if (popover) {
// Providers return just { start, end, content, ?onShow, xpos, ytop, ybot }
popover.visible = false;
popover.editor = editor;
return popover;
}
return null;
} | [
"function",
"queryPreviewProviders",
"(",
"editor",
",",
"pos",
",",
"token",
")",
"{",
"var",
"line",
"=",
"editor",
".",
"document",
".",
"getLine",
"(",
"pos",
".",
"line",
")",
";",
"// FUTURE: Support plugin providers. For now we just hard-code...",
"var",
"p... | Preview hide/show logic ------------------------------------------------
Returns a 'ready for use' popover state object:
{ visible: false, editor, start, end, content, ?onShow, xpos, ytop, ybot }
Lacks only hoverTimer (supplied by handleMouseMove()) and marker (supplied by showPreview()). | [
"Preview",
"hide",
"/",
"show",
"logic",
"------------------------------------------------",
"Returns",
"a",
"ready",
"for",
"use",
"popover",
"state",
"object",
":",
"{",
"visible",
":",
"false",
"editor",
"start",
"end",
"content",
"?onShow",
"xpos",
"ytop",
"yb... | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/QuickView/main.js#L559-L574 | train | Query the provider to use for previewing | [
30522,
3853,
23032,
28139,
8584,
21572,
17258,
2545,
1006,
3559,
1010,
13433,
2015,
1010,
19204,
1007,
1063,
13075,
2240,
1027,
3559,
1012,
6254,
1012,
2131,
4179,
1006,
13433,
2015,
1012,
2240,
1007,
1025,
1013,
1013,
2925,
1024,
2490,
133... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/hyphenopoly/hyphenEngine.asm.js | asmHyphenEngine | function asmHyphenEngine(std, ext, heap) {
"use asm";
var ui8 = new std.Uint8Array(heap);
var ui16 = new std.Uint16Array(heap);
var i32 = new std.Int32Array(heap);
var imul = std.Math.imul;
var hpbTranslateOffset = ext.hpbTranslateOffset | 0;
var hpbPatternsOffset = ext.hpbPatternsOffset | 0;
var patternsLength = ext.patternsLength | 0;
var valueStoreOffset = ext.valueStoreOffset | 0;
var patternTrieOffset = ext.patternTrieOffset | 0;
var wordOffset = ext.wordOffset | 0;
var translatedWordOffset = ext.translatedWordOffset | 0;
var hyphenPointsOffset = ext.hyphenPointsOffset | 0;
var hyphenatedWordOffset = ext.hyphenatedWordOffset | 0;
var trieRowLength = 0;
var alphabetCount = 0;
function hashCharCode(cc) {
//maps BMP-charCode (16bit) to 9bit adresses
//{0, 1, 2, ..., 2^16 - 1} -> {0, 1, 2, ..., 2^9 - 1}
//collisions will occur!
cc = cc | 0;
var h = 0;
h = imul(cc, 40503); // 2^16 (-1 + sqrt(5)) / 2 = 40’503.475...
h = (h >> 8) + 1 & 255; //shift and mask 8bits
return h << 1;
}
function pushToTranslateMap(cc, id) {
cc = cc | 0;
id = id | 0;
var addr = 0;
addr = hashCharCode(cc | 0) | 0;
while ((ui16[addr >> 1] | 0) != 0) {
addr = (addr + 2) | 0;
}
ui16[addr >> 1] = cc;
ui8[((addr >> 1) + 512) | 0] = id;
}
function pullFromTranslateMap(cc) {
cc = cc | 0;
var addr = 0;
if ((cc | 0) == 0) {
return 255;
}
addr = hashCharCode(cc) | 0;
while ((ui16[addr >> 1] | 0) != (cc | 0)) {
addr = (addr + 2) | 0;
if ((addr | 0) >= 512) {
return 255;
}
}
return ui8[((addr >> 1) + 512) | 0] | 0;
}
function createTranslateMap() {
var i = 0;
var k = 0;
var first = 0;
var second = 0;
var secondInt = 0;
i = (hpbTranslateOffset + 2) | 0;
k = 12 | 0;
trieRowLength = ui16[hpbTranslateOffset >> 1] << 1;
while ((i | 0) < (hpbPatternsOffset | 0)) {
first = ui16[i >> 1] | 0;
second = ui16[(i + 2) >> 1] | 0;
secondInt = pullFromTranslateMap(second) | 0;
if ((secondInt | 0) == 255) {
//there's no such char yet in the TranslateMap
pushToTranslateMap(first, k);
if ((second | 0) != 0) {
//set upperCase representation
pushToTranslateMap(second, k);
}
k = (k + 1) | 0;
} else {
//char is already in TranslateMap -> SUBSTITUTION
pushToTranslateMap(first, secondInt);
}
//add to alphabet
ui16[(768 + (alphabetCount << 1)) >> 1] = first;
alphabetCount = (alphabetCount + 1) | 0;
i = (i + 4) | 0;
}
}
function translateCharCode(cc) {
cc = cc | 0;
var charIdx = 0;
charIdx = pullFromTranslateMap(cc | 0) | 0;
if ((charIdx | 0) == 255) {
return 255;
}
return (charIdx - 12) << 3;
}
function convert() {
var i = 0;
var last_i = 0;
var charAti = 0;
var mode = 0; //0: init/collect patterns, 1: get patlen
var plen = 0;
var count = 0;
var prevWasDigit = 0;
var nextRowStart = 0;
var trieNextEmptyRow = 0;
var rowStart = 0;
var rowOffset = 0;
var valueStoreStartIndex = 0;
var valueStoreCurrentIdx = 0;
var valueStorePrevIdx = 0;
valueStoreStartIndex = (valueStoreOffset + 1) | 0;
valueStoreCurrentIdx = (valueStoreOffset + 1) | 0;
valueStorePrevIdx = (valueStoreOffset + 1) | 0;
createTranslateMap();
i = hpbPatternsOffset | 0;
last_i = hpbPatternsOffset + patternsLength | 0;
while ((i | 0) < (last_i | 0)) {
charAti = ui8[i | 0] | 0;
if ((charAti | 0) == 58) { //58 === ":"
mode = !mode;
} else {
if ((mode | 0) == 1) {
plen = charAti | 0;
} else {
count = (count + 1) | 0;
//add to trie
if ((charAti | 0) > 11) {
if ((prevWasDigit | 0) == 0) {
valueStoreCurrentIdx = (valueStoreCurrentIdx + 1) | 0;
}
prevWasDigit = 0;
if ((nextRowStart | 0) == -1) {
//start a new row
trieNextEmptyRow = (trieNextEmptyRow + (((trieRowLength + 1) | 0) << 2)) | 0;
nextRowStart = trieNextEmptyRow;
i32[(patternTrieOffset + rowStart + rowOffset) >> 2] = nextRowStart;
}
rowOffset = ((charAti - 12) | 0) << 3;
rowStart = nextRowStart;
nextRowStart = i32[(patternTrieOffset + rowStart + rowOffset) >> 2] | 0;
if ((nextRowStart | 0) == 0) {
i32[(patternTrieOffset + rowStart + rowOffset) >> 2] = -1;
nextRowStart = -1;
}
} else {
ui8[valueStoreCurrentIdx | 0] = charAti | 0;
valueStorePrevIdx = valueStoreCurrentIdx;
valueStoreCurrentIdx = (valueStoreCurrentIdx + 1) | 0;
prevWasDigit = 1;
}
if ((count | 0) == (plen | 0)) {
//terminate valueStore and save link to valueStoreStartIndex
ui8[(valueStorePrevIdx + 1) | 0] = 255; //mark end of pattern
i32[(patternTrieOffset + rowStart + rowOffset + 4) >> 2] = (valueStoreStartIndex - valueStoreOffset) | 0;
//reset indizes
valueStoreStartIndex = (valueStorePrevIdx + 2) | 0;
valueStoreCurrentIdx = valueStoreStartIndex;
count = 0;
rowStart = 0;
nextRowStart = 0;
prevWasDigit = 0;
}
}
}
i = (i + 1) | 0;
}
}
function hyphenate(lm, rm) {
lm = lm | 0;
rm = rm | 0;
var patternStartPos = 0;
var wordLength = 0;
var charOffset = 0;
var row = 0;
var wordStartOffset = 0;
var rowOffset2 = 0;
var link = 0;
var value = 0;
var hyphenPointsCount = 0;
var hyphenPoint = 0;
var hpPos = 0;
var unknownChar = 0;
var translatedChar = 0;
wordLength = (ui8[wordOffset | 0] << 1) | 0;
wordStartOffset = (wordOffset + 2) | 0;
//translate UTF16 word to internal ints
while ((charOffset | 0) < (wordLength | 0)) {
translatedChar = translateCharCode(ui16[(wordStartOffset + charOffset) >> 1] | 0) | 0;
if ((translatedChar | 0) == 255) {
unknownChar = 1;
break;
}
ui16[(translatedWordOffset + charOffset) >> 1] = translatedChar | 0;
charOffset = (charOffset + 2) | 0;
}
while ((hpPos | 0) < ((wordLength + 1) | 0)) {
ui8[(hyphenPointsOffset + hpPos) | 0] = 0;
hpPos = (hpPos + 1) | 0;
}
if ((unknownChar | 0) == 1) {
return 0;
}
hpPos = 0;
while ((patternStartPos | 0) < (wordLength | 0)) {
row = 0;
charOffset = patternStartPos | 0;
while ((charOffset | 0) < (wordLength | 0)) {
rowOffset2 = ui16[(translatedWordOffset + charOffset) >> 1] | 0;
link = i32[(patternTrieOffset + row + rowOffset2) >> 2] | 0;
value = i32[(patternTrieOffset + row + rowOffset2 + 4) >> 2] | 0;
if ((value | 0) > 0) {
hyphenPointsCount = 0;
hyphenPoint = ui8[(valueStoreOffset + value) | 0] | 0;
while ((hyphenPoint | 0) != 255) {
hpPos = (hyphenPointsOffset + (patternStartPos >> 1) + hyphenPointsCount) | 0;
if ((hyphenPoint | 0) > (ui8[hpPos | 0] | 0)) {
ui8[hpPos | 0] = hyphenPoint | 0;
}
hyphenPointsCount = (hyphenPointsCount + 1) | 0;
hyphenPoint = ui8[(valueStoreOffset + value + hyphenPointsCount) | 0] | 0;
}
}
if ((link | 0) > 0) {
row = link | 0;
} else {
break;
}
charOffset = (charOffset + 2) | 0;
}
patternStartPos = (patternStartPos + 2) | 0;
}
charOffset = 0;
hyphenPointsCount = 0;
while ((charOffset | 0) <= (wordLength | 0)) {
ui16[(hyphenatedWordOffset + charOffset + hyphenPointsCount) >> 1] = ui16[(wordStartOffset + charOffset) >> 1] | 0;
if ((charOffset >> 1) >= (lm | 0)) {
if ((charOffset >> 1) <= (((wordLength >> 1) - rm - 2) | 0)) {
if (ui8[(hyphenPointsOffset + (charOffset >> 1) + 1) | 0] & 1 == 1) {
ui16[(hyphenatedWordOffset + charOffset + hyphenPointsCount + 2) >> 1] = 173;
hyphenPointsCount = (hyphenPointsCount + 2) | 0
}
}
}
charOffset = (charOffset + 2) | 0;
}
ui16[hyphenatedWordOffset >> 1] = ((wordLength >> 1) + (hyphenPointsCount >> 1) - 2) | 0;
return 1;
}
return {
convert: convert,
hyphenate: hyphenate
};
} | javascript | function asmHyphenEngine(std, ext, heap) {
"use asm";
var ui8 = new std.Uint8Array(heap);
var ui16 = new std.Uint16Array(heap);
var i32 = new std.Int32Array(heap);
var imul = std.Math.imul;
var hpbTranslateOffset = ext.hpbTranslateOffset | 0;
var hpbPatternsOffset = ext.hpbPatternsOffset | 0;
var patternsLength = ext.patternsLength | 0;
var valueStoreOffset = ext.valueStoreOffset | 0;
var patternTrieOffset = ext.patternTrieOffset | 0;
var wordOffset = ext.wordOffset | 0;
var translatedWordOffset = ext.translatedWordOffset | 0;
var hyphenPointsOffset = ext.hyphenPointsOffset | 0;
var hyphenatedWordOffset = ext.hyphenatedWordOffset | 0;
var trieRowLength = 0;
var alphabetCount = 0;
function hashCharCode(cc) {
//maps BMP-charCode (16bit) to 9bit adresses
//{0, 1, 2, ..., 2^16 - 1} -> {0, 1, 2, ..., 2^9 - 1}
//collisions will occur!
cc = cc | 0;
var h = 0;
h = imul(cc, 40503); // 2^16 (-1 + sqrt(5)) / 2 = 40’503.475...
h = (h >> 8) + 1 & 255; //shift and mask 8bits
return h << 1;
}
function pushToTranslateMap(cc, id) {
cc = cc | 0;
id = id | 0;
var addr = 0;
addr = hashCharCode(cc | 0) | 0;
while ((ui16[addr >> 1] | 0) != 0) {
addr = (addr + 2) | 0;
}
ui16[addr >> 1] = cc;
ui8[((addr >> 1) + 512) | 0] = id;
}
function pullFromTranslateMap(cc) {
cc = cc | 0;
var addr = 0;
if ((cc | 0) == 0) {
return 255;
}
addr = hashCharCode(cc) | 0;
while ((ui16[addr >> 1] | 0) != (cc | 0)) {
addr = (addr + 2) | 0;
if ((addr | 0) >= 512) {
return 255;
}
}
return ui8[((addr >> 1) + 512) | 0] | 0;
}
function createTranslateMap() {
var i = 0;
var k = 0;
var first = 0;
var second = 0;
var secondInt = 0;
i = (hpbTranslateOffset + 2) | 0;
k = 12 | 0;
trieRowLength = ui16[hpbTranslateOffset >> 1] << 1;
while ((i | 0) < (hpbPatternsOffset | 0)) {
first = ui16[i >> 1] | 0;
second = ui16[(i + 2) >> 1] | 0;
secondInt = pullFromTranslateMap(second) | 0;
if ((secondInt | 0) == 255) {
//there's no such char yet in the TranslateMap
pushToTranslateMap(first, k);
if ((second | 0) != 0) {
//set upperCase representation
pushToTranslateMap(second, k);
}
k = (k + 1) | 0;
} else {
//char is already in TranslateMap -> SUBSTITUTION
pushToTranslateMap(first, secondInt);
}
//add to alphabet
ui16[(768 + (alphabetCount << 1)) >> 1] = first;
alphabetCount = (alphabetCount + 1) | 0;
i = (i + 4) | 0;
}
}
function translateCharCode(cc) {
cc = cc | 0;
var charIdx = 0;
charIdx = pullFromTranslateMap(cc | 0) | 0;
if ((charIdx | 0) == 255) {
return 255;
}
return (charIdx - 12) << 3;
}
function convert() {
var i = 0;
var last_i = 0;
var charAti = 0;
var mode = 0; //0: init/collect patterns, 1: get patlen
var plen = 0;
var count = 0;
var prevWasDigit = 0;
var nextRowStart = 0;
var trieNextEmptyRow = 0;
var rowStart = 0;
var rowOffset = 0;
var valueStoreStartIndex = 0;
var valueStoreCurrentIdx = 0;
var valueStorePrevIdx = 0;
valueStoreStartIndex = (valueStoreOffset + 1) | 0;
valueStoreCurrentIdx = (valueStoreOffset + 1) | 0;
valueStorePrevIdx = (valueStoreOffset + 1) | 0;
createTranslateMap();
i = hpbPatternsOffset | 0;
last_i = hpbPatternsOffset + patternsLength | 0;
while ((i | 0) < (last_i | 0)) {
charAti = ui8[i | 0] | 0;
if ((charAti | 0) == 58) { //58 === ":"
mode = !mode;
} else {
if ((mode | 0) == 1) {
plen = charAti | 0;
} else {
count = (count + 1) | 0;
//add to trie
if ((charAti | 0) > 11) {
if ((prevWasDigit | 0) == 0) {
valueStoreCurrentIdx = (valueStoreCurrentIdx + 1) | 0;
}
prevWasDigit = 0;
if ((nextRowStart | 0) == -1) {
//start a new row
trieNextEmptyRow = (trieNextEmptyRow + (((trieRowLength + 1) | 0) << 2)) | 0;
nextRowStart = trieNextEmptyRow;
i32[(patternTrieOffset + rowStart + rowOffset) >> 2] = nextRowStart;
}
rowOffset = ((charAti - 12) | 0) << 3;
rowStart = nextRowStart;
nextRowStart = i32[(patternTrieOffset + rowStart + rowOffset) >> 2] | 0;
if ((nextRowStart | 0) == 0) {
i32[(patternTrieOffset + rowStart + rowOffset) >> 2] = -1;
nextRowStart = -1;
}
} else {
ui8[valueStoreCurrentIdx | 0] = charAti | 0;
valueStorePrevIdx = valueStoreCurrentIdx;
valueStoreCurrentIdx = (valueStoreCurrentIdx + 1) | 0;
prevWasDigit = 1;
}
if ((count | 0) == (plen | 0)) {
//terminate valueStore and save link to valueStoreStartIndex
ui8[(valueStorePrevIdx + 1) | 0] = 255; //mark end of pattern
i32[(patternTrieOffset + rowStart + rowOffset + 4) >> 2] = (valueStoreStartIndex - valueStoreOffset) | 0;
//reset indizes
valueStoreStartIndex = (valueStorePrevIdx + 2) | 0;
valueStoreCurrentIdx = valueStoreStartIndex;
count = 0;
rowStart = 0;
nextRowStart = 0;
prevWasDigit = 0;
}
}
}
i = (i + 1) | 0;
}
}
function hyphenate(lm, rm) {
lm = lm | 0;
rm = rm | 0;
var patternStartPos = 0;
var wordLength = 0;
var charOffset = 0;
var row = 0;
var wordStartOffset = 0;
var rowOffset2 = 0;
var link = 0;
var value = 0;
var hyphenPointsCount = 0;
var hyphenPoint = 0;
var hpPos = 0;
var unknownChar = 0;
var translatedChar = 0;
wordLength = (ui8[wordOffset | 0] << 1) | 0;
wordStartOffset = (wordOffset + 2) | 0;
//translate UTF16 word to internal ints
while ((charOffset | 0) < (wordLength | 0)) {
translatedChar = translateCharCode(ui16[(wordStartOffset + charOffset) >> 1] | 0) | 0;
if ((translatedChar | 0) == 255) {
unknownChar = 1;
break;
}
ui16[(translatedWordOffset + charOffset) >> 1] = translatedChar | 0;
charOffset = (charOffset + 2) | 0;
}
while ((hpPos | 0) < ((wordLength + 1) | 0)) {
ui8[(hyphenPointsOffset + hpPos) | 0] = 0;
hpPos = (hpPos + 1) | 0;
}
if ((unknownChar | 0) == 1) {
return 0;
}
hpPos = 0;
while ((patternStartPos | 0) < (wordLength | 0)) {
row = 0;
charOffset = patternStartPos | 0;
while ((charOffset | 0) < (wordLength | 0)) {
rowOffset2 = ui16[(translatedWordOffset + charOffset) >> 1] | 0;
link = i32[(patternTrieOffset + row + rowOffset2) >> 2] | 0;
value = i32[(patternTrieOffset + row + rowOffset2 + 4) >> 2] | 0;
if ((value | 0) > 0) {
hyphenPointsCount = 0;
hyphenPoint = ui8[(valueStoreOffset + value) | 0] | 0;
while ((hyphenPoint | 0) != 255) {
hpPos = (hyphenPointsOffset + (patternStartPos >> 1) + hyphenPointsCount) | 0;
if ((hyphenPoint | 0) > (ui8[hpPos | 0] | 0)) {
ui8[hpPos | 0] = hyphenPoint | 0;
}
hyphenPointsCount = (hyphenPointsCount + 1) | 0;
hyphenPoint = ui8[(valueStoreOffset + value + hyphenPointsCount) | 0] | 0;
}
}
if ((link | 0) > 0) {
row = link | 0;
} else {
break;
}
charOffset = (charOffset + 2) | 0;
}
patternStartPos = (patternStartPos + 2) | 0;
}
charOffset = 0;
hyphenPointsCount = 0;
while ((charOffset | 0) <= (wordLength | 0)) {
ui16[(hyphenatedWordOffset + charOffset + hyphenPointsCount) >> 1] = ui16[(wordStartOffset + charOffset) >> 1] | 0;
if ((charOffset >> 1) >= (lm | 0)) {
if ((charOffset >> 1) <= (((wordLength >> 1) - rm - 2) | 0)) {
if (ui8[(hyphenPointsOffset + (charOffset >> 1) + 1) | 0] & 1 == 1) {
ui16[(hyphenatedWordOffset + charOffset + hyphenPointsCount + 2) >> 1] = 173;
hyphenPointsCount = (hyphenPointsCount + 2) | 0
}
}
}
charOffset = (charOffset + 2) | 0;
}
ui16[hyphenatedWordOffset >> 1] = ((wordLength >> 1) + (hyphenPointsCount >> 1) - 2) | 0;
return 1;
}
return {
convert: convert,
hyphenate: hyphenate
};
} | [
"function",
"asmHyphenEngine",
"(",
"std",
",",
"ext",
",",
"heap",
")",
"{",
"\"use asm\"",
";",
"var",
"ui8",
"=",
"new",
"std",
".",
"Uint8Array",
"(",
"heap",
")",
";",
"var",
"ui16",
"=",
"new",
"std",
".",
"Uint16Array",
"(",
"heap",
")",
";",
... | @license hyphenEngine.asm.js 2.4.0-devel - client side hyphenation for webbrowsers
©2018 Mathias Nater, Zürich (mathiasnater at gmail dot com)
https://github.com/mnater/Hyphenopoly
Released under the MIT license
http://mnater.github.io/Hyphenopoly/LICENSE | [
"@license",
"hyphenEngine",
".",
"asm",
".",
"js",
"2",
".",
"4",
".",
"0",
"-",
"devel",
"-",
"client",
"side",
"hyphenation",
"for",
"webbrowsers",
"©2018",
"Mathias",
"Nater",
"Zürich",
"(",
"mathiasnater",
"at",
"gmail",
"dot",
"com",
")",
"https",
"... | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/hyphenopoly/hyphenEngine.asm.js#L10-L280 | train | The hyphen engine | [
30522,
3853,
2004,
2213,
10536,
8458,
8625,
3070,
3170,
1006,
2358,
2094,
1010,
4654,
2102,
1010,
16721,
1007,
1063,
1000,
2224,
2004,
2213,
1000,
1025,
13075,
21318,
2620,
1027,
2047,
2358,
2094,
1012,
21318,
3372,
2620,
2906,
9447,
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... |
aframevr/aframe | src/components/look-controls.js | function () {
var sceneEl = this.el.sceneEl;
var canvasEl = sceneEl.canvas;
// Wait for canvas to load.
if (!canvasEl) {
sceneEl.addEventListener('render-target-loaded', bind(this.addEventListeners, this));
return;
}
// Mouse events.
canvasEl.addEventListener('mousedown', this.onMouseDown, false);
window.addEventListener('mousemove', this.onMouseMove, false);
window.addEventListener('mouseup', this.onMouseUp, false);
// Touch events.
canvasEl.addEventListener('touchstart', this.onTouchStart);
window.addEventListener('touchmove', this.onTouchMove);
window.addEventListener('touchend', this.onTouchEnd);
// sceneEl events.
sceneEl.addEventListener('enter-vr', this.onEnterVR);
sceneEl.addEventListener('exit-vr', this.onExitVR);
// Pointer Lock events.
if (this.data.pointerLockEnabled) {
document.addEventListener('pointerlockchange', this.onPointerLockChange, false);
document.addEventListener('mozpointerlockchange', this.onPointerLockChange, false);
document.addEventListener('pointerlockerror', this.onPointerLockError, false);
}
} | javascript | function () {
var sceneEl = this.el.sceneEl;
var canvasEl = sceneEl.canvas;
// Wait for canvas to load.
if (!canvasEl) {
sceneEl.addEventListener('render-target-loaded', bind(this.addEventListeners, this));
return;
}
// Mouse events.
canvasEl.addEventListener('mousedown', this.onMouseDown, false);
window.addEventListener('mousemove', this.onMouseMove, false);
window.addEventListener('mouseup', this.onMouseUp, false);
// Touch events.
canvasEl.addEventListener('touchstart', this.onTouchStart);
window.addEventListener('touchmove', this.onTouchMove);
window.addEventListener('touchend', this.onTouchEnd);
// sceneEl events.
sceneEl.addEventListener('enter-vr', this.onEnterVR);
sceneEl.addEventListener('exit-vr', this.onExitVR);
// Pointer Lock events.
if (this.data.pointerLockEnabled) {
document.addEventListener('pointerlockchange', this.onPointerLockChange, false);
document.addEventListener('mozpointerlockchange', this.onPointerLockChange, false);
document.addEventListener('pointerlockerror', this.onPointerLockError, false);
}
} | [
"function",
"(",
")",
"{",
"var",
"sceneEl",
"=",
"this",
".",
"el",
".",
"sceneEl",
";",
"var",
"canvasEl",
"=",
"sceneEl",
".",
"canvas",
";",
"// Wait for canvas to load.",
"if",
"(",
"!",
"canvasEl",
")",
"{",
"sceneEl",
".",
"addEventListener",
"(",
... | Add mouse and touch event listeners to canvas. | [
"Add",
"mouse",
"and",
"touch",
"event",
"listeners",
"to",
"canvas",
"."
] | 24acc78a7299a4cdfe3ef617f4d40ddf6275c992 | https://github.com/aframevr/aframe/blob/24acc78a7299a4cdfe3ef617f4d40ddf6275c992/src/components/look-controls.js#L121-L151 | train | Add event listeners | [
30522,
3853,
1006,
1007,
1063,
13075,
3496,
2884,
1027,
2023,
1012,
3449,
1012,
3496,
2884,
1025,
13075,
10683,
2884,
1027,
3496,
2884,
1012,
10683,
1025,
1013,
1013,
3524,
2005,
10683,
2000,
7170,
1012,
2065,
1006,
999,
10683,
2884,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | src/sap.ui.dt/src/sap/ui/dt/ContextMenuControl.js | function (aButtons) {
var iButtonsEnabled = this._getNumberOfEnabledButtons(aButtons);
if (iButtonsEnabled !== 0) {
this._hideDisabledButtons(aButtons);
}
this._iButtonsVisible = this._hideButtonsInOverflow(aButtons);
if (this._iButtonsVisible === this.getMaxButtonsDisplayed() && this._iButtonsVisible !== aButtons.length) {
this._replaceLastVisibleButtonWithOverflowButton(aButtons);
} else if (iButtonsEnabled < aButtons.length - 1 && iButtonsEnabled !== 0) {
this.addOverflowButton();
}
iButtonsEnabled = null;
} | javascript | function (aButtons) {
var iButtonsEnabled = this._getNumberOfEnabledButtons(aButtons);
if (iButtonsEnabled !== 0) {
this._hideDisabledButtons(aButtons);
}
this._iButtonsVisible = this._hideButtonsInOverflow(aButtons);
if (this._iButtonsVisible === this.getMaxButtonsDisplayed() && this._iButtonsVisible !== aButtons.length) {
this._replaceLastVisibleButtonWithOverflowButton(aButtons);
} else if (iButtonsEnabled < aButtons.length - 1 && iButtonsEnabled !== 0) {
this.addOverflowButton();
}
iButtonsEnabled = null;
} | [
"function",
"(",
"aButtons",
")",
"{",
"var",
"iButtonsEnabled",
"=",
"this",
".",
"_getNumberOfEnabledButtons",
"(",
"aButtons",
")",
";",
"if",
"(",
"iButtonsEnabled",
"!==",
"0",
")",
"{",
"this",
".",
"_hideDisabledButtons",
"(",
"aButtons",
")",
";",
"}... | Sets all parameters of the buttons in the non-expanded ContextMenu
@param {array} aButtons some buttons | [
"Sets",
"all",
"parameters",
"of",
"the",
"buttons",
"in",
"the",
"non",
"-",
"expanded",
"ContextMenu"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.dt/src/sap/ui/dt/ContextMenuControl.js#L215-L229 | train | Hides the buttons that are not enabled and overflow | [
30522,
3853,
30524,
5054,
3085,
2094,
999,
1027,
1027,
1014,
1007,
1063,
2023,
1012,
1035,
5342,
10521,
3085,
18939,
4904,
2669,
2015,
1006,
8273,
15474,
2015,
1007,
1025,
1065,
2023,
1012,
1035,
21307,
4904,
2669,
2015,
11365,
7028,
1027,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | src/sap.ui.layout/src/sap/ui/layout/form/SimpleForm.js | _getFieldLayoutData | function _getFieldLayoutData(oField){
var oLayoutData;
switch (this.getLayout()) {
case SimpleFormLayout.ResponsiveLayout:
oLayoutData = FormLayout.prototype.getLayoutDataForElement(oField, "sap.ui.layout.ResponsiveFlowLayoutData");
break;
case SimpleFormLayout.GridLayout:
oLayoutData = FormLayout.prototype.getLayoutDataForElement(oField, "sap.ui.layout.form.GridElementData");
break;
case SimpleFormLayout.ResponsiveGridLayout:
oLayoutData = FormLayout.prototype.getLayoutDataForElement(oField, "sap.ui.layout.GridData");
break;
case SimpleFormLayout.ColumnLayout:
oLayoutData = FormLayout.prototype.getLayoutDataForElement(oField, "sap.ui.layout.form.ColumnElementData");
break;
// no default
}
return oLayoutData;
} | javascript | function _getFieldLayoutData(oField){
var oLayoutData;
switch (this.getLayout()) {
case SimpleFormLayout.ResponsiveLayout:
oLayoutData = FormLayout.prototype.getLayoutDataForElement(oField, "sap.ui.layout.ResponsiveFlowLayoutData");
break;
case SimpleFormLayout.GridLayout:
oLayoutData = FormLayout.prototype.getLayoutDataForElement(oField, "sap.ui.layout.form.GridElementData");
break;
case SimpleFormLayout.ResponsiveGridLayout:
oLayoutData = FormLayout.prototype.getLayoutDataForElement(oField, "sap.ui.layout.GridData");
break;
case SimpleFormLayout.ColumnLayout:
oLayoutData = FormLayout.prototype.getLayoutDataForElement(oField, "sap.ui.layout.form.ColumnElementData");
break;
// no default
}
return oLayoutData;
} | [
"function",
"_getFieldLayoutData",
"(",
"oField",
")",
"{",
"var",
"oLayoutData",
";",
"switch",
"(",
"this",
".",
"getLayout",
"(",
")",
")",
"{",
"case",
"SimpleFormLayout",
".",
"ResponsiveLayout",
":",
"oLayoutData",
"=",
"FormLayout",
".",
"prototype",
".... | /*
There may be VariantLayoutData used -> so get the right one for the used Layout | [
"/",
"*",
"There",
"may",
"be",
"VariantLayoutData",
"used",
"-",
">",
"so",
"get",
"the",
"right",
"one",
"for",
"the",
"used",
"Layout"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.layout/src/sap/ui/layout/form/SimpleForm.js#L1458-L1480 | train | Returns the layout data for the given field | [
30522,
3853,
1035,
2131,
3790,
8485,
5833,
2850,
2696,
1006,
1997,
12891,
1007,
1063,
13075,
19330,
28852,
4904,
2850,
2696,
1025,
6942,
1006,
2023,
1012,
2131,
8485,
5833,
1006,
1007,
1007,
1063,
2553,
3722,
14192,
8485,
5833,
1012,
26651,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/model/odata/_AnnotationHelperExpression.js | function (oInterface, oPathValue) {
var oResult = Expression.parameter(oInterface, oPathValue, 0);
if (oResult.result === "constant") {
// convert V4 to V2 for sap.ui.model.odata.ODataUtils
if (oResult.type === "Edm.Date") {
oResult.type = "Edm.DateTime";
// Note: ODataUtils.formatValue calls Date.parse() indirectly, use UTC to make
// sure IE9 does not mess with time zone
oResult.value = oResult.value + "T00:00:00Z";
} else if (oResult.type === "Edm.TimeOfDay") {
oResult.type = "Edm.Time";
oResult.value = "PT"
+ oResult.value.slice(0, 2) + "H"
+ oResult.value.slice(3, 5) + "M"
+ oResult.value.slice(6, 8) + "S";
}
}
return {
result : "expression",
value : 'odata.uriEncode(' + Basics.resultToString(oResult, true) + ","
+ Basics.toJSON(oResult.type) + ")",
type : "Edm.String"
};
} | javascript | function (oInterface, oPathValue) {
var oResult = Expression.parameter(oInterface, oPathValue, 0);
if (oResult.result === "constant") {
// convert V4 to V2 for sap.ui.model.odata.ODataUtils
if (oResult.type === "Edm.Date") {
oResult.type = "Edm.DateTime";
// Note: ODataUtils.formatValue calls Date.parse() indirectly, use UTC to make
// sure IE9 does not mess with time zone
oResult.value = oResult.value + "T00:00:00Z";
} else if (oResult.type === "Edm.TimeOfDay") {
oResult.type = "Edm.Time";
oResult.value = "PT"
+ oResult.value.slice(0, 2) + "H"
+ oResult.value.slice(3, 5) + "M"
+ oResult.value.slice(6, 8) + "S";
}
}
return {
result : "expression",
value : 'odata.uriEncode(' + Basics.resultToString(oResult, true) + ","
+ Basics.toJSON(oResult.type) + ")",
type : "Edm.String"
};
} | [
"function",
"(",
"oInterface",
",",
"oPathValue",
")",
"{",
"var",
"oResult",
"=",
"Expression",
".",
"parameter",
"(",
"oInterface",
",",
"oPathValue",
",",
"0",
")",
";",
"if",
"(",
"oResult",
".",
"result",
"===",
"\"constant\"",
")",
"{",
"// convert V... | Handling of "14.5.3.1.3 Function odata.uriEncode".
@param {sap.ui.core.util.XMLPreprocessor.IContext|sap.ui.model.Context} oInterface
the callback interface related to the current formatter call
@param {object} oPathValue
path and value information pointing to the parameters array (see Expression object)
@returns {object}
the result object | [
"Handling",
"of",
"14",
".",
"5",
".",
"3",
".",
"1",
".",
"3",
"Function",
"odata",
".",
"uriEncode",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/_AnnotationHelperExpression.js#L878-L903 | train | Returns an object with the result of an expression | [
30522,
3853,
1006,
1051,
18447,
2121,
12172,
1010,
6728,
8988,
10175,
5657,
1007,
1063,
13075,
10848,
23722,
2102,
1027,
3670,
1012,
16381,
1006,
1051,
18447,
2121,
12172,
1010,
6728,
8988,
10175,
5657,
1010,
1014,
1007,
1025,
2065,
1006,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SeleniumHQ/selenium | third_party/js/mozmill/shared-modules/places.js | removeAllHistory | function removeAllHistory() {
const TOPIC_EXPIRATION_FINISHED = "places-expiration-finished";
// Create flag visible to both the eval and the observer object
var finishedFlag = {
state: false
}
// Set up an observer so we get notified when remove completes
let observer = {
observe: function(aSubject, aTopic, aData) {
observerService.removeObserver(this, TOPIC_EXPIRATION_FINISHED);
finishedFlag.state = true;
}
}
observerService.addObserver(observer, TOPIC_EXPIRATION_FINISHED, false);
// Remove the pages, then block until we're done or until timeout is reached
browserHistory.removeAllPages();
mozmill.controller.waitForEval("subject.state == true", gTimeout, 100, finishedFlag);
} | javascript | function removeAllHistory() {
const TOPIC_EXPIRATION_FINISHED = "places-expiration-finished";
// Create flag visible to both the eval and the observer object
var finishedFlag = {
state: false
}
// Set up an observer so we get notified when remove completes
let observer = {
observe: function(aSubject, aTopic, aData) {
observerService.removeObserver(this, TOPIC_EXPIRATION_FINISHED);
finishedFlag.state = true;
}
}
observerService.addObserver(observer, TOPIC_EXPIRATION_FINISHED, false);
// Remove the pages, then block until we're done or until timeout is reached
browserHistory.removeAllPages();
mozmill.controller.waitForEval("subject.state == true", gTimeout, 100, finishedFlag);
} | [
"function",
"removeAllHistory",
"(",
")",
"{",
"const",
"TOPIC_EXPIRATION_FINISHED",
"=",
"\"places-expiration-finished\"",
";",
"// Create flag visible to both the eval and the observer object",
"var",
"finishedFlag",
"=",
"{",
"state",
":",
"false",
"}",
"// Set up an observe... | Synchronous wrapper around browserHistory.removeAllPages()
Removes history and blocks until done | [
"Synchronous",
"wrapper",
"around",
"browserHistory",
".",
"removeAllPages",
"()",
"Removes",
"history",
"and",
"blocks",
"until",
"done"
] | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/places.js#L161-L181 | train | Remove all pages from the history | [
30522,
3853,
6366,
8095,
24158,
7062,
1006,
1007,
1063,
9530,
3367,
8476,
1035,
4654,
16781,
1035,
2736,
1027,
1000,
3182,
1011,
4654,
16781,
1011,
2736,
1000,
1025,
1013,
1013,
3443,
5210,
5710,
2000,
2119,
1996,
9345,
2140,
1998,
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... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/thirdparty/sinon-server.js | function (obj, method, args) {
switch (args.length) {
case 0: return obj[method]();
case 1: return obj[method](args[0]);
case 2: return obj[method](args[0], args[1]);
case 3: return obj[method](args[0], args[1], args[2]);
case 4: return obj[method](args[0], args[1], args[2], args[3]);
case 5: return obj[method](args[0], args[1], args[2], args[3], args[4]);
}
} | javascript | function (obj, method, args) {
switch (args.length) {
case 0: return obj[method]();
case 1: return obj[method](args[0]);
case 2: return obj[method](args[0], args[1]);
case 3: return obj[method](args[0], args[1], args[2]);
case 4: return obj[method](args[0], args[1], args[2], args[3]);
case 5: return obj[method](args[0], args[1], args[2], args[3], args[4]);
}
} | [
"function",
"(",
"obj",
",",
"method",
",",
"args",
")",
"{",
"switch",
"(",
"args",
".",
"length",
")",
"{",
"case",
"0",
":",
"return",
"obj",
"[",
"method",
"]",
"(",
")",
";",
"case",
"1",
":",
"return",
"obj",
"[",
"method",
"]",
"(",
"arg... | largest arity in XHR is 5 - XHR#open | [
"largest",
"arity",
"in",
"XHR",
"is",
"5",
"-",
"XHR#open"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/sinon-server.js#L1140-L1149 | train | This is the main function for the
Language | [
30522,
3853,
1006,
27885,
3501,
1010,
4118,
1010,
12098,
5620,
1007,
1063,
6942,
1006,
12098,
5620,
1012,
3091,
1007,
1063,
2553,
1014,
1024,
2709,
27885,
3501,
1031,
4118,
1033,
1006,
1007,
1025,
2553,
1015,
1024,
2709,
27885,
3501,
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... | |
electron/electron | lib/browser/guest-view-manager.js | function (embedder, params) {
if (webViewManager == null) {
webViewManager = process.electronBinding('web_view_manager')
}
const guest = webContents.create({
isGuest: true,
partition: params.partition,
embedder: embedder
})
const guestInstanceId = guest.id
guestInstances[guestInstanceId] = {
guest: guest,
embedder: embedder
}
// Clear the guest from map when it is destroyed.
//
// The guest WebContents is usually destroyed in 2 cases:
// 1. The embedder frame is closed (reloaded or destroyed), and it
// automatically closes the guest frame.
// 2. The guest frame is detached dynamically via JS, and it is manually
// destroyed when the renderer sends the GUEST_VIEW_MANAGER_DESTROY_GUEST
// message.
// The second case relies on the libcc patch:
// https://github.com/electron/libchromiumcontent/pull/676
// The patch was introduced to work around a bug in Chromium:
// https://github.com/electron/electron/issues/14211
// We should revisit the bug to see if we can remove our libcc patch, the
// patch was introduced in Chrome 66.
guest.once('destroyed', () => {
if (guestInstanceId in guestInstances) {
detachGuest(embedder, guestInstanceId)
}
})
// Init guest web view after attached.
guest.once('did-attach', function (event) {
params = this.attachParams
delete this.attachParams
const previouslyAttached = this.viewInstanceId != null
this.viewInstanceId = params.instanceId
// Only load URL and set size on first attach
if (previouslyAttached) {
return
}
if (params.src) {
const opts = {}
if (params.httpreferrer) {
opts.httpReferrer = params.httpreferrer
}
if (params.useragent) {
opts.userAgent = params.useragent
}
this.loadURL(params.src, opts)
}
guest.allowPopups = params.allowpopups
embedder.emit('did-attach-webview', event, guest)
})
const sendToEmbedder = (channel, ...args) => {
if (!embedder.isDestroyed()) {
embedder._sendInternal(`${channel}-${guest.viewInstanceId}`, ...args)
}
}
// Dispatch events to embedder.
const fn = function (event) {
guest.on(event, function (_, ...args) {
sendToEmbedder('ELECTRON_GUEST_VIEW_INTERNAL_DISPATCH_EVENT', event, ...args)
})
}
for (const event of supportedWebViewEvents) {
fn(event)
}
// Dispatch guest's IPC messages to embedder.
guest.on('ipc-message-host', function (_, channel, args) {
sendToEmbedder('ELECTRON_GUEST_VIEW_INTERNAL_IPC_MESSAGE', channel, ...args)
})
// Notify guest of embedder window visibility when it is ready
// FIXME Remove once https://github.com/electron/electron/issues/6828 is fixed
guest.on('dom-ready', function () {
const guestInstance = guestInstances[guestInstanceId]
if (guestInstance != null && guestInstance.visibilityState != null) {
guest._sendInternal('ELECTRON_GUEST_INSTANCE_VISIBILITY_CHANGE', guestInstance.visibilityState)
}
})
// Forward internal web contents event to embedder to handle
// native window.open setup
guest.on('-add-new-contents', (...args) => {
if (guest.getLastWebPreferences().nativeWindowOpen === true) {
const embedder = getEmbedder(guestInstanceId)
if (embedder != null) {
embedder.emit('-add-new-contents', ...args)
}
}
})
return guestInstanceId
} | javascript | function (embedder, params) {
if (webViewManager == null) {
webViewManager = process.electronBinding('web_view_manager')
}
const guest = webContents.create({
isGuest: true,
partition: params.partition,
embedder: embedder
})
const guestInstanceId = guest.id
guestInstances[guestInstanceId] = {
guest: guest,
embedder: embedder
}
// Clear the guest from map when it is destroyed.
//
// The guest WebContents is usually destroyed in 2 cases:
// 1. The embedder frame is closed (reloaded or destroyed), and it
// automatically closes the guest frame.
// 2. The guest frame is detached dynamically via JS, and it is manually
// destroyed when the renderer sends the GUEST_VIEW_MANAGER_DESTROY_GUEST
// message.
// The second case relies on the libcc patch:
// https://github.com/electron/libchromiumcontent/pull/676
// The patch was introduced to work around a bug in Chromium:
// https://github.com/electron/electron/issues/14211
// We should revisit the bug to see if we can remove our libcc patch, the
// patch was introduced in Chrome 66.
guest.once('destroyed', () => {
if (guestInstanceId in guestInstances) {
detachGuest(embedder, guestInstanceId)
}
})
// Init guest web view after attached.
guest.once('did-attach', function (event) {
params = this.attachParams
delete this.attachParams
const previouslyAttached = this.viewInstanceId != null
this.viewInstanceId = params.instanceId
// Only load URL and set size on first attach
if (previouslyAttached) {
return
}
if (params.src) {
const opts = {}
if (params.httpreferrer) {
opts.httpReferrer = params.httpreferrer
}
if (params.useragent) {
opts.userAgent = params.useragent
}
this.loadURL(params.src, opts)
}
guest.allowPopups = params.allowpopups
embedder.emit('did-attach-webview', event, guest)
})
const sendToEmbedder = (channel, ...args) => {
if (!embedder.isDestroyed()) {
embedder._sendInternal(`${channel}-${guest.viewInstanceId}`, ...args)
}
}
// Dispatch events to embedder.
const fn = function (event) {
guest.on(event, function (_, ...args) {
sendToEmbedder('ELECTRON_GUEST_VIEW_INTERNAL_DISPATCH_EVENT', event, ...args)
})
}
for (const event of supportedWebViewEvents) {
fn(event)
}
// Dispatch guest's IPC messages to embedder.
guest.on('ipc-message-host', function (_, channel, args) {
sendToEmbedder('ELECTRON_GUEST_VIEW_INTERNAL_IPC_MESSAGE', channel, ...args)
})
// Notify guest of embedder window visibility when it is ready
// FIXME Remove once https://github.com/electron/electron/issues/6828 is fixed
guest.on('dom-ready', function () {
const guestInstance = guestInstances[guestInstanceId]
if (guestInstance != null && guestInstance.visibilityState != null) {
guest._sendInternal('ELECTRON_GUEST_INSTANCE_VISIBILITY_CHANGE', guestInstance.visibilityState)
}
})
// Forward internal web contents event to embedder to handle
// native window.open setup
guest.on('-add-new-contents', (...args) => {
if (guest.getLastWebPreferences().nativeWindowOpen === true) {
const embedder = getEmbedder(guestInstanceId)
if (embedder != null) {
embedder.emit('-add-new-contents', ...args)
}
}
})
return guestInstanceId
} | [
"function",
"(",
"embedder",
",",
"params",
")",
"{",
"if",
"(",
"webViewManager",
"==",
"null",
")",
"{",
"webViewManager",
"=",
"process",
".",
"electronBinding",
"(",
"'web_view_manager'",
")",
"}",
"const",
"guest",
"=",
"webContents",
".",
"create",
"("... | Create a new guest instance. | [
"Create",
"a",
"new",
"guest",
"instance",
"."
] | 6e29611788277729647acf465f10db1ea6f15788 | https://github.com/electron/electron/blob/6e29611788277729647acf465f10db1ea6f15788/lib/browser/guest-view-manager.js#L56-L161 | train | Create a new guest web view | [
30522,
3853,
1006,
7861,
8270,
4063,
1010,
11498,
5244,
1007,
1063,
2065,
1006,
4773,
8584,
24805,
4590,
1027,
1027,
19701,
1007,
1063,
4773,
8584,
24805,
4590,
1027,
2832,
1012,
10496,
8428,
4667,
1006,
1005,
4773,
1035,
3193,
1035,
3208,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
dcloudio/mui | examples/login/libs/easymob-webim-sdk/strophe-custom-2.0.0.js | function(text)
{
text = text.replace(/\&/g, "&");
text = text.replace(/</g, "<");
text = text.replace(/>/g, ">");
text = text.replace(/'/g, "'");
text = text.replace(/"/g, """);
return text;
} | javascript | function(text)
{
text = text.replace(/\&/g, "&");
text = text.replace(/</g, "<");
text = text.replace(/>/g, ">");
text = text.replace(/'/g, "'");
text = text.replace(/"/g, """);
return text;
} | [
"function",
"(",
"text",
")",
"{",
"text",
"=",
"text",
".",
"replace",
"(",
"/",
"\\&",
"/",
"g",
",",
"\"&\"",
")",
";",
"text",
"=",
"text",
".",
"replace",
"(",
"/",
"<",
"/",
"g",
",",
"\"<\"",
")",
";",
"text",
"=",
"text",
".",
... | /* Function: xmlescape
Excapes invalid xml characters.
Parameters:
(String) text - text to escape.
Returns:
Escaped text. | [
"/",
"*",
"Function",
":",
"xmlescape",
"Excapes",
"invalid",
"xml",
"characters",
"."
] | ff74c90a1671a552f3604b1288bf38a4126312d0 | https://github.com/dcloudio/mui/blob/ff74c90a1671a552f3604b1288bf38a4126312d0/examples/login/libs/easymob-webim-sdk/strophe-custom-2.0.0.js#L1040-L1048 | train | Converts a text to a string of unicode | [
30522,
3853,
1006,
3793,
1007,
1063,
3793,
1027,
3793,
1012,
5672,
1006,
1013,
1032,
1004,
1013,
1043,
1010,
1000,
1004,
23713,
1025,
1000,
1007,
1025,
3793,
1027,
3793,
1012,
5672,
1006,
1013,
1026,
1013,
1043,
1010,
1000,
1004,
8318,
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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.