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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
TryGhost/Ghost | core/server/models/app.js | permittedOptions | function permittedOptions(methodName) {
var options = ghostBookshelf.Model.permittedOptions.call(this, methodName),
// whitelists for the `options` hash argument on methods, by method name.
// these are the only options that can be passed to Bookshelf / Knex.
validOptions = {
findOne: ['withRelated']
};
if (validOptions[methodName]) {
options = options.concat(validOptions[methodName]);
}
return options;
} | javascript | function permittedOptions(methodName) {
var options = ghostBookshelf.Model.permittedOptions.call(this, methodName),
// whitelists for the `options` hash argument on methods, by method name.
// these are the only options that can be passed to Bookshelf / Knex.
validOptions = {
findOne: ['withRelated']
};
if (validOptions[methodName]) {
options = options.concat(validOptions[methodName]);
}
return options;
} | [
"function",
"permittedOptions",
"(",
"methodName",
")",
"{",
"var",
"options",
"=",
"ghostBookshelf",
".",
"Model",
".",
"permittedOptions",
".",
"call",
"(",
"this",
",",
"methodName",
")",
",",
"// whitelists for the `options` hash argument on methods, by method name.",... | Returns an array of keys permitted in a method's `options` hash, depending on the current method.
@param {String} methodName The name of the method to check valid options for.
@return {Array} Keys allowed in the `options` hash of the model's method. | [
"Returns",
"an",
"array",
"of",
"keys",
"permitted",
"in",
"a",
"method",
"s",
"options",
"hash",
"depending",
"on",
"the",
"current",
"method",
"."
] | bb7bb55cf3e60af99ebbc56099928827b58461bc | https://github.com/TryGhost/Ghost/blob/bb7bb55cf3e60af99ebbc56099928827b58461bc/core/server/models/app.js#L36-L50 | train | returns an array of options for a given method | [
30522,
3853,
7936,
7361,
9285,
1006,
4118,
18442,
1007,
1063,
13075,
7047,
1027,
5745,
17470,
16001,
2546,
1012,
2944,
1012,
7936,
7361,
9285,
1012,
2655,
1006,
2023,
1010,
4118,
18442,
1007,
1010,
1013,
1013,
2317,
27103,
2005,
1996,
1036,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/project/ProjectManager.js | _getFallbackProjectPath | function _getFallbackProjectPath() {
var fallbackPaths = [],
recentProjects = PreferencesManager.getViewState("recentProjects") || [],
deferred = new $.Deferred();
// Build ordered fallback path array
if (recentProjects.length > 1) {
// *Most* recent project is the one that just failed to load, so use second most recent
fallbackPaths.push(recentProjects[1]);
}
// Next is Getting Started project
fallbackPaths.push(_getWelcomeProjectPath());
// Helper func for Async.firstSequentially()
function processItem(path) {
var deferred = new $.Deferred(),
fileEntry = FileSystem.getDirectoryForPath(path);
fileEntry.exists(function (err, exists) {
if (!err && exists) {
deferred.resolve();
} else {
deferred.reject();
}
});
return deferred.promise();
}
// Find first path that exists
Async.firstSequentially(fallbackPaths, processItem)
.done(function (fallbackPath) {
deferred.resolve(fallbackPath);
})
.fail(function () {
// Last resort is Brackets source folder which is guaranteed to exist
deferred.resolve(FileUtils.getNativeBracketsDirectoryPath());
});
return deferred.promise();
} | javascript | function _getFallbackProjectPath() {
var fallbackPaths = [],
recentProjects = PreferencesManager.getViewState("recentProjects") || [],
deferred = new $.Deferred();
// Build ordered fallback path array
if (recentProjects.length > 1) {
// *Most* recent project is the one that just failed to load, so use second most recent
fallbackPaths.push(recentProjects[1]);
}
// Next is Getting Started project
fallbackPaths.push(_getWelcomeProjectPath());
// Helper func for Async.firstSequentially()
function processItem(path) {
var deferred = new $.Deferred(),
fileEntry = FileSystem.getDirectoryForPath(path);
fileEntry.exists(function (err, exists) {
if (!err && exists) {
deferred.resolve();
} else {
deferred.reject();
}
});
return deferred.promise();
}
// Find first path that exists
Async.firstSequentially(fallbackPaths, processItem)
.done(function (fallbackPath) {
deferred.resolve(fallbackPath);
})
.fail(function () {
// Last resort is Brackets source folder which is guaranteed to exist
deferred.resolve(FileUtils.getNativeBracketsDirectoryPath());
});
return deferred.promise();
} | [
"function",
"_getFallbackProjectPath",
"(",
")",
"{",
"var",
"fallbackPaths",
"=",
"[",
"]",
",",
"recentProjects",
"=",
"PreferencesManager",
".",
"getViewState",
"(",
"\"recentProjects\"",
")",
"||",
"[",
"]",
",",
"deferred",
"=",
"new",
"$",
".",
"Deferred... | After failing to load a project, this function determines which project path to fallback to.
@return {$.Promise} Promise that resolves to a project path {string} | [
"After",
"failing",
"to",
"load",
"a",
"project",
"this",
"function",
"determines",
"which",
"project",
"path",
"to",
"fallback",
"to",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/project/ProjectManager.js#L733-L774 | train | Get fallback project path | [
30522,
3853,
1035,
2131,
13976,
5963,
21572,
20614,
15069,
1006,
1007,
1063,
13075,
2991,
5963,
15069,
2015,
1027,
1031,
1033,
1010,
3522,
21572,
20614,
2015,
1027,
18394,
24805,
4590,
1012,
2131,
8584,
9153,
2618,
1006,
1000,
3522,
21572,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
angular/material | src/components/autocomplete/js/autocompleteController.js | onListLeave | function onListLeave () {
if (!hasFocus && !ctrl.hidden) elements.input.focus();
noBlur = false;
ctrl.hidden = shouldHide();
} | javascript | function onListLeave () {
if (!hasFocus && !ctrl.hidden) elements.input.focus();
noBlur = false;
ctrl.hidden = shouldHide();
} | [
"function",
"onListLeave",
"(",
")",
"{",
"if",
"(",
"!",
"hasFocus",
"&&",
"!",
"ctrl",
".",
"hidden",
")",
"elements",
".",
"input",
".",
"focus",
"(",
")",
";",
"noBlur",
"=",
"false",
";",
"ctrl",
".",
"hidden",
"=",
"shouldHide",
"(",
")",
";"... | When the user's mouse leaves the menu, blur events may hide the menu again. | [
"When",
"the",
"user",
"s",
"mouse",
"leaves",
"the",
"menu",
"blur",
"events",
"may",
"hide",
"the",
"menu",
"again",
"."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/autocomplete/js/autocompleteController.js#L398-L402 | train | Leave the list | [
30522,
3853,
2006,
9863,
19738,
3726,
1006,
1007,
1063,
2065,
1006,
999,
2038,
14876,
7874,
1004,
1004,
999,
14931,
12190,
1012,
5023,
1007,
3787,
1012,
7953,
1012,
3579,
1006,
1007,
1025,
2053,
16558,
3126,
1027,
6270,
1025,
14931,
12190,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
getinsomnia/insomnia | packages/insomnia-app/app/ui/components/codemirror/extensions/autocomplete.js | replaceWithSurround | function replaceWithSurround(text, find, prefix, suffix) {
const escapedString = escapeRegex(find);
const re = new RegExp(escapedString, 'gi');
return text.replace(re, matched => prefix + matched + suffix);
} | javascript | function replaceWithSurround(text, find, prefix, suffix) {
const escapedString = escapeRegex(find);
const re = new RegExp(escapedString, 'gi');
return text.replace(re, matched => prefix + matched + suffix);
} | [
"function",
"replaceWithSurround",
"(",
"text",
",",
"find",
",",
"prefix",
",",
"suffix",
")",
"{",
"const",
"escapedString",
"=",
"escapeRegex",
"(",
"find",
")",
";",
"const",
"re",
"=",
"new",
"RegExp",
"(",
"escapedString",
",",
"'gi'",
")",
";",
"r... | Replace all occurrences of string
@param text
@param find
@param prefix
@param suffix
@returns string | [
"Replace",
"all",
"occurrences",
"of",
"string"
] | e24ce7f7b41246e700c4b9bdb6b34b6652ad589b | https://github.com/getinsomnia/insomnia/blob/e24ce7f7b41246e700c4b9bdb6b34b6652ad589b/packages/insomnia-app/app/ui/components/codemirror/extensions/autocomplete.js#L399-L403 | train | Replace all occurrences of find with prefix and suffix | [
30522,
3853,
5672,
24415,
26210,
22494,
4859,
1006,
3793,
1010,
2424,
1010,
17576,
1010,
16809,
1007,
1063,
9530,
3367,
6376,
3367,
4892,
1027,
4019,
2890,
3351,
2595,
1006,
2424,
1007,
1025,
9530,
3367,
2128,
1027,
2047,
19723,
10288,
2361... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/extensions/default/NavigationAndHistory/main.js | handleCurrentFileChange | function handleCurrentFileChange(e, newFile, newPaneId, oldFile) {
if (newFile) {
if (_mrofList.length === 0) {
_initRecentFilesList();
}
_addToMROFList(newFile, newPaneId);
}
} | javascript | function handleCurrentFileChange(e, newFile, newPaneId, oldFile) {
if (newFile) {
if (_mrofList.length === 0) {
_initRecentFilesList();
}
_addToMROFList(newFile, newPaneId);
}
} | [
"function",
"handleCurrentFileChange",
"(",
"e",
",",
"newFile",
",",
"newPaneId",
",",
"oldFile",
")",
"{",
"if",
"(",
"newFile",
")",
"{",
"if",
"(",
"_mrofList",
".",
"length",
"===",
"0",
")",
"{",
"_initRecentFilesList",
"(",
")",
";",
"}",
"_addToM... | Handle current file change | [
"Handle",
"current",
"file",
"change"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/NavigationAndHistory/main.js#L771-L779 | train | Handle the current file change | [
30522,
3853,
5047,
10841,
14343,
3372,
8873,
2571,
22305,
2063,
1006,
1041,
1010,
2047,
8873,
2571,
1010,
2047,
9739,
7416,
2094,
1010,
2214,
8873,
2571,
1007,
1063,
2065,
1006,
2047,
8873,
2571,
1007,
1063,
2065,
1006,
1035,
2720,
11253,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/LiveDevelopment/MultiBrowserImpl/protocol/remote/LiveDevProtocolRemote.js | onDocumentClick | function onDocumentClick(event) {
var element = event.target;
if (element && element.hasAttribute('data-brackets-id')) {
MessageBroker.send({"tagId": element.getAttribute('data-brackets-id')});
}
} | javascript | function onDocumentClick(event) {
var element = event.target;
if (element && element.hasAttribute('data-brackets-id')) {
MessageBroker.send({"tagId": element.getAttribute('data-brackets-id')});
}
} | [
"function",
"onDocumentClick",
"(",
"event",
")",
"{",
"var",
"element",
"=",
"event",
".",
"target",
";",
"if",
"(",
"element",
"&&",
"element",
".",
"hasAttribute",
"(",
"'data-brackets-id'",
")",
")",
"{",
"MessageBroker",
".",
"send",
"(",
"{",
"\"tagI... | Sends the message containing tagID which is being clicked
to the editor in order to change the cursor position to
the HTML tag corresponding to the clicked element. | [
"Sends",
"the",
"message",
"containing",
"tagID",
"which",
"is",
"being",
"clicked",
"to",
"the",
"editor",
"in",
"order",
"to",
"change",
"the",
"cursor",
"position",
"to",
"the",
"HTML",
"tag",
"corresponding",
"to",
"the",
"clicked",
"element",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/LiveDevelopment/MultiBrowserImpl/protocol/remote/LiveDevProtocolRemote.js#L385-L390 | train | This function is called when the user clicks on a document | [
30522,
3853,
2006,
3527,
24894,
4765,
20464,
6799,
1006,
2724,
1007,
30524,
1012,
4539,
1025,
2065,
1006,
5783,
1004,
1004,
5783,
1012,
2038,
19321,
3089,
8569,
2618,
1006,
1005,
2951,
1011,
19719,
1011,
8909,
1005,
1007,
1007,
1063,
4471,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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_ControlInfo | function parse_ControlInfo(blob) {
var flags = blob.read_shift(1);
blob.l++;
var accel = blob.read_shift(2);
blob.l += 2;
return [flags, accel];
} | javascript | function parse_ControlInfo(blob) {
var flags = blob.read_shift(1);
blob.l++;
var accel = blob.read_shift(2);
blob.l += 2;
return [flags, accel];
} | [
"function",
"parse_ControlInfo",
"(",
"blob",
")",
"{",
"var",
"flags",
"=",
"blob",
".",
"read_shift",
"(",
"1",
")",
";",
"blob",
".",
"l",
"++",
";",
"var",
"accel",
"=",
"blob",
".",
"read_shift",
"(",
"2",
")",
";",
"blob",
".",
"l",
"+=",
"... | /* [MS-XLS] 2.5.61 ControlInfo | [
"/",
"*",
"[",
"MS",
"-",
"XLS",
"]",
"2",
".",
"5",
".",
"61",
"ControlInfo"
] | 9a6d8a1d3d80c78dad5201fb389316f935279cdc | https://github.com/SheetJS/js-xlsx/blob/9a6d8a1d3d80c78dad5201fb389316f935279cdc/xlsx.js#L5451-L5457 | train | Parse ControlInfo | [
30522,
3853,
11968,
3366,
1035,
2491,
2378,
14876,
1006,
1038,
4135,
2497,
1007,
1063,
13075,
9245,
1027,
1038,
4135,
2497,
1012,
3191,
1035,
5670,
1006,
1015,
1007,
1025,
1038,
4135,
2497,
1012,
1048,
1009,
1009,
1025,
13075,
16222,
2884,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/ResponsiveFlowLayout.js | function(oRow, iWidth) {
/*
* initiating all required variables to increase speed and memory
* efficiency
*/
var r = [];
var currentRow = -1;
var currentWidth = 0;
var totalWeight = 0;
var indexLinebreak = 0;
var w1 = 0, w2 = 0;
var j = 0, k = 0;
// Find out the "rows" within a row
for (j = 0; j < oRow.cont.length; j++) {
currentWidth = 0;
totalWeight = 0;
for (k = indexLinebreak; k <= j; k++) {
totalWeight = totalWeight + oRow.cont[k].weight;
}
for (k = indexLinebreak; k <= j; k++) {
w1 = iWidth / totalWeight * oRow.cont[k].weight;
w1 = Math.floor(w1);
w2 = oRow.cont[k].minWidth;
currentWidth += Math.max(w1, w2);
}
if (currentRow == -1 || currentWidth > iWidth) {
r.push({
cont : []
});
if (currentRow !== -1) {
/*
* if this is NOT the first run -> all coming iterations
* needn't to start from '0' since the calculation of a new
* row has begun
*/
indexLinebreak = j;
}
currentRow++;
}
r[currentRow].cont.push(oRow.cont[j]);
}
return r;
} | javascript | function(oRow, iWidth) {
/*
* initiating all required variables to increase speed and memory
* efficiency
*/
var r = [];
var currentRow = -1;
var currentWidth = 0;
var totalWeight = 0;
var indexLinebreak = 0;
var w1 = 0, w2 = 0;
var j = 0, k = 0;
// Find out the "rows" within a row
for (j = 0; j < oRow.cont.length; j++) {
currentWidth = 0;
totalWeight = 0;
for (k = indexLinebreak; k <= j; k++) {
totalWeight = totalWeight + oRow.cont[k].weight;
}
for (k = indexLinebreak; k <= j; k++) {
w1 = iWidth / totalWeight * oRow.cont[k].weight;
w1 = Math.floor(w1);
w2 = oRow.cont[k].minWidth;
currentWidth += Math.max(w1, w2);
}
if (currentRow == -1 || currentWidth > iWidth) {
r.push({
cont : []
});
if (currentRow !== -1) {
/*
* if this is NOT the first run -> all coming iterations
* needn't to start from '0' since the calculation of a new
* row has begun
*/
indexLinebreak = j;
}
currentRow++;
}
r[currentRow].cont.push(oRow.cont[j]);
}
return r;
} | [
"function",
"(",
"oRow",
",",
"iWidth",
")",
"{",
"/*\n\t\t\t * initiating all required variables to increase speed and memory\n\t\t\t * efficiency\n\t\t\t */",
"var",
"r",
"=",
"[",
"]",
";",
"var",
"currentRow",
"=",
"-",
"1",
";",
"var",
"currentWidth",
"=",
"0",
"... | Returns the target wrapping.
@param {object} oRow The corresponding row of possible controls
@param {int} iWidth The width of the row in pixels
@returns {array} The target wrapping | [
"Returns",
"the",
"target",
"wrapping",
".",
"@param",
"{",
"object",
"}",
"oRow",
"The",
"corresponding",
"row",
"of",
"possible",
"controls",
"@param",
"{",
"int",
"}",
"iWidth",
"The",
"width",
"of",
"the",
"row",
"in",
"pixels",
"@returns",
"{",
"array... | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.layout/src/sap/ui/layout/ResponsiveFlowLayout.js#L232-L278 | train | Returns an array of the elements of a row that are at least iWidth | [
30522,
3853,
1006,
20298,
2860,
1010,
1045,
9148,
11927,
2232,
1007,
1063,
1013,
1008,
1008,
26616,
2035,
3223,
10857,
2000,
3623,
3177,
1998,
3638,
1008,
8122,
1008,
1013,
13075,
1054,
1027,
1031,
1033,
1025,
13075,
2783,
10524,
1027,
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... | |
apache/incubator-echarts | src/coord/Axis.js | function () {
var axisExtent = this._extent;
var dataExtent = this.scale.getExtent();
var len = dataExtent[1] - dataExtent[0] + (this.onBand ? 1 : 0);
// Fix #2728, avoid NaN when only one data.
len === 0 && (len = 1);
var size = Math.abs(axisExtent[1] - axisExtent[0]);
return Math.abs(size) / len;
} | javascript | function () {
var axisExtent = this._extent;
var dataExtent = this.scale.getExtent();
var len = dataExtent[1] - dataExtent[0] + (this.onBand ? 1 : 0);
// Fix #2728, avoid NaN when only one data.
len === 0 && (len = 1);
var size = Math.abs(axisExtent[1] - axisExtent[0]);
return Math.abs(size) / len;
} | [
"function",
"(",
")",
"{",
"var",
"axisExtent",
"=",
"this",
".",
"_extent",
";",
"var",
"dataExtent",
"=",
"this",
".",
"scale",
".",
"getExtent",
"(",
")",
";",
"var",
"len",
"=",
"dataExtent",
"[",
"1",
"]",
"-",
"dataExtent",
"[",
"0",
"]",
"+"... | Get width of band
@return {number} | [
"Get",
"width",
"of",
"band"
] | 4d0ea095dc3929cb6de40c45748826e7999c7aa8 | https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/coord/Axis.js#L242-L253 | train | Returns the formula for the current dataset | [
30522,
3853,
1006,
1007,
1063,
13075,
8123,
10288,
6528,
2102,
1027,
2023,
1012,
1035,
6698,
1025,
13075,
2951,
10288,
6528,
2102,
1027,
2023,
1012,
4094,
1012,
2131,
10288,
6528,
2102,
1006,
1007,
1025,
13075,
18798,
1027,
2951,
10288,
652... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
keplergl/kepler.gl | examples/demo-app/src/utils/cloud-providers/dropbox.js | getAccessTokenFromLocation | function getAccessTokenFromLocation(location) {
if (!(location && location.hash.length)) {
return null;
}
// dropbox token usually start with # therefore we want to remore the '#'
const query = window.location.hash.substring(1);
return parseQueryString(query).access_token;
} | javascript | function getAccessTokenFromLocation(location) {
if (!(location && location.hash.length)) {
return null;
}
// dropbox token usually start with # therefore we want to remore the '#'
const query = window.location.hash.substring(1);
return parseQueryString(query).access_token;
} | [
"function",
"getAccessTokenFromLocation",
"(",
"location",
")",
"{",
"if",
"(",
"!",
"(",
"location",
"&&",
"location",
".",
"hash",
".",
"length",
")",
")",
"{",
"return",
"null",
";",
"}",
"// dropbox token usually start with # therefore we want to remore the '#'",
... | This method will extract the atuch token from the third party service callback url. Default: Dropbox
@param {object} location the window location provided by react router
@returns {?string} the token extracted from the oauth 2 callback URL | [
"This",
"method",
"will",
"extract",
"the",
"atuch",
"token",
"from",
"the",
"third",
"party",
"service",
"callback",
"url",
".",
"Default",
":",
"Dropbox"
] | 779238435707cc54335c2d00001e4b9334b314aa | https://github.com/keplergl/kepler.gl/blob/779238435707cc54335c2d00001e4b9334b314aa/examples/demo-app/src/utils/cloud-providers/dropbox.js#L61-L69 | train | Get the dropbox access token from the location | [
30522,
3853,
2131,
6305,
9623,
16033,
7520,
19699,
5358,
4135,
10719,
1006,
3295,
1007,
1063,
2065,
1006,
999,
1006,
3295,
1004,
1004,
3295,
1012,
23325,
1012,
3091,
1007,
1007,
1063,
2709,
19701,
1025,
1065,
1013,
1013,
4530,
8758,
19204,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
cytoscape/cytoscape.js | documentation/demos/tokyo-railways/tokyo-railways.js | function(tag, attrs, children){
var el = document.createElement(tag);
if(attrs != null && typeof attrs === typeof {}){
Object.keys(attrs).forEach(function(key){
var val = attrs[key];
el.setAttribute(key, val);
});
} else if(typeof attrs === typeof []){
children = attrs;
}
if(children != null && typeof children === typeof []){
children.forEach(function(child){
el.appendChild(child);
});
} else if(children != null && typeof children === typeof ''){
el.appendChild(document.createTextNode(children));
}
return el;
} | javascript | function(tag, attrs, children){
var el = document.createElement(tag);
if(attrs != null && typeof attrs === typeof {}){
Object.keys(attrs).forEach(function(key){
var val = attrs[key];
el.setAttribute(key, val);
});
} else if(typeof attrs === typeof []){
children = attrs;
}
if(children != null && typeof children === typeof []){
children.forEach(function(child){
el.appendChild(child);
});
} else if(children != null && typeof children === typeof ''){
el.appendChild(document.createTextNode(children));
}
return el;
} | [
"function",
"(",
"tag",
",",
"attrs",
",",
"children",
")",
"{",
"var",
"el",
"=",
"document",
".",
"createElement",
"(",
"tag",
")",
";",
"if",
"(",
"attrs",
"!=",
"null",
"&&",
"typeof",
"attrs",
"===",
"typeof",
"{",
"}",
")",
"{",
"Object",
"."... | hyperscript-like function | [
"hyperscript",
"-",
"like",
"function"
] | ad2051b65e2243cfd953d8b24a8bf95bfa8559e5 | https://github.com/cytoscape/cytoscape.js/blob/ad2051b65e2243cfd953d8b24a8bf95bfa8559e5/documentation/demos/tokyo-railways/tokyo-railways.js#L20-L42 | train | Create an element with attributes and children | [
30522,
3853,
1006,
6415,
1010,
2012,
16344,
2015,
1010,
2336,
1007,
1063,
13075,
3449,
1027,
6254,
1012,
3443,
12260,
3672,
1006,
6415,
1007,
1025,
2065,
1006,
2012,
16344,
2015,
999,
1027,
19701,
1004,
1004,
2828,
11253,
2012,
16344,
2015,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | src/sap.ui.core/src/sap/ui/model/analytics/odata4analytics.js | function(sQueryOptionName) {
var sName,
sQueryOptionValue = null,
sSelectOption,
that = this;
// Adds given property (either the name of the property as string or an object with a
// property name) to sSelectOption and to this._oSelectedPropertyNames if not yet done
function addSelect(vProperty) {
var sPropertyName;
if (!vProperty) {
return;
}
sPropertyName = typeof vProperty === "string" ? vProperty : vProperty.name;
if (!that._oSelectedPropertyNames[sPropertyName]) {
sSelectOption += (sSelectOption == "" ? "" : ",") + sPropertyName;
that._oSelectedPropertyNames[sPropertyName] = true;
}
}
switch (sQueryOptionName) {
case "$select": {
sSelectOption = "";
this._oSelectedPropertyNames = {};
for (sName in this._oAggregationLevel) {
var oDim = this._oQueryResult.findDimensionByName(sName);
var oDimSelect = this._oAggregationLevel[sName];
if (oDimSelect.key == true) {
addSelect(oDim.getKeyProperty());
}
if (oDimSelect.text == true) {
addSelect(oDim.getTextProperty());
}
if (oDimSelect.attributes) {
for (var i = -1, sAttrName; (sAttrName = oDimSelect.attributes[++i]) !== undefined;) {
addSelect(oDim.findAttributeByName(sAttrName).getName());
}
}
}
for (sName in this._oMeasures) {
var oMeas = this._oQueryResult.findMeasureByName(sName);
var oMeasSelect = this._oMeasures[sName];
if (oMeasSelect.value == true) {
addSelect(oMeas.getRawValueProperty());
}
if (oMeasSelect.text == true) {
addSelect(oMeas.getFormattedValueProperty());
}
if (oMeasSelect.unit == true) {
addSelect(oMeas.getUnitProperty());
}
}
for (sName in this._oDimensionHierarchies) {
var oHier = this._oQueryResult.findDimensionByName(sName).getHierarchy();
var oHierSelect = this._oDimensionHierarchies[sName];
if (oHierSelect.id) {
addSelect(oHier.getNodeIDProperty());
}
if (oHierSelect.externalKey) {
addSelect(oHier.getNodeExternalKeyProperty());
}
if (oHierSelect.text) {
addSelect(this._oQueryResult.getEntityType()
.getTextPropertyOfProperty(oHier.getNodeIDProperty().name));
}
}
if (this._bIncludeEntityKey) {
var aKeyPropRef = this._oQueryResult.getEntityType().getTypeDescription().key.propertyRef;
for (var j = -1, oKeyProp; (oKeyProp = aKeyPropRef[++j]) !== undefined;) {
sSelectOption += (sSelectOption == "" ? "" : ",") + oKeyProp.name;
}
}
sQueryOptionValue = (sSelectOption ? sSelectOption : null);
break;
}
case "$filter": {
var sFilterOption = null;
if (this._oFilterExpression) {
sFilterOption = this._oFilterExpression.getURIFilterOptionValue();
}
sQueryOptionValue = (sFilterOption ? sFilterOption : null);
break;
}
case "$orderby": {
sQueryOptionValue = this.getURIOrderByOptionValue();
break;
}
case "$top": {
sQueryOptionValue = null;
if (this._bReturnNoEntities) {
sQueryOptionValue = 0;
} else if (this._iTopRequestOption !== null) {
sQueryOptionValue = this._iTopRequestOption;
}
break;
}
case "$skip": {
sQueryOptionValue = null;
if (!this._bReturnNoEntities) {
sQueryOptionValue = this._iSkipRequestOption;
}
break;
}
case "$inlinecount": {
sQueryOptionValue = (this._bIncludeCount == true ? "allpages" : null);
break;
}
default:
break;
}
return sQueryOptionValue;
} | javascript | function(sQueryOptionName) {
var sName,
sQueryOptionValue = null,
sSelectOption,
that = this;
// Adds given property (either the name of the property as string or an object with a
// property name) to sSelectOption and to this._oSelectedPropertyNames if not yet done
function addSelect(vProperty) {
var sPropertyName;
if (!vProperty) {
return;
}
sPropertyName = typeof vProperty === "string" ? vProperty : vProperty.name;
if (!that._oSelectedPropertyNames[sPropertyName]) {
sSelectOption += (sSelectOption == "" ? "" : ",") + sPropertyName;
that._oSelectedPropertyNames[sPropertyName] = true;
}
}
switch (sQueryOptionName) {
case "$select": {
sSelectOption = "";
this._oSelectedPropertyNames = {};
for (sName in this._oAggregationLevel) {
var oDim = this._oQueryResult.findDimensionByName(sName);
var oDimSelect = this._oAggregationLevel[sName];
if (oDimSelect.key == true) {
addSelect(oDim.getKeyProperty());
}
if (oDimSelect.text == true) {
addSelect(oDim.getTextProperty());
}
if (oDimSelect.attributes) {
for (var i = -1, sAttrName; (sAttrName = oDimSelect.attributes[++i]) !== undefined;) {
addSelect(oDim.findAttributeByName(sAttrName).getName());
}
}
}
for (sName in this._oMeasures) {
var oMeas = this._oQueryResult.findMeasureByName(sName);
var oMeasSelect = this._oMeasures[sName];
if (oMeasSelect.value == true) {
addSelect(oMeas.getRawValueProperty());
}
if (oMeasSelect.text == true) {
addSelect(oMeas.getFormattedValueProperty());
}
if (oMeasSelect.unit == true) {
addSelect(oMeas.getUnitProperty());
}
}
for (sName in this._oDimensionHierarchies) {
var oHier = this._oQueryResult.findDimensionByName(sName).getHierarchy();
var oHierSelect = this._oDimensionHierarchies[sName];
if (oHierSelect.id) {
addSelect(oHier.getNodeIDProperty());
}
if (oHierSelect.externalKey) {
addSelect(oHier.getNodeExternalKeyProperty());
}
if (oHierSelect.text) {
addSelect(this._oQueryResult.getEntityType()
.getTextPropertyOfProperty(oHier.getNodeIDProperty().name));
}
}
if (this._bIncludeEntityKey) {
var aKeyPropRef = this._oQueryResult.getEntityType().getTypeDescription().key.propertyRef;
for (var j = -1, oKeyProp; (oKeyProp = aKeyPropRef[++j]) !== undefined;) {
sSelectOption += (sSelectOption == "" ? "" : ",") + oKeyProp.name;
}
}
sQueryOptionValue = (sSelectOption ? sSelectOption : null);
break;
}
case "$filter": {
var sFilterOption = null;
if (this._oFilterExpression) {
sFilterOption = this._oFilterExpression.getURIFilterOptionValue();
}
sQueryOptionValue = (sFilterOption ? sFilterOption : null);
break;
}
case "$orderby": {
sQueryOptionValue = this.getURIOrderByOptionValue();
break;
}
case "$top": {
sQueryOptionValue = null;
if (this._bReturnNoEntities) {
sQueryOptionValue = 0;
} else if (this._iTopRequestOption !== null) {
sQueryOptionValue = this._iTopRequestOption;
}
break;
}
case "$skip": {
sQueryOptionValue = null;
if (!this._bReturnNoEntities) {
sQueryOptionValue = this._iSkipRequestOption;
}
break;
}
case "$inlinecount": {
sQueryOptionValue = (this._bIncludeCount == true ? "allpages" : null);
break;
}
default:
break;
}
return sQueryOptionValue;
} | [
"function",
"(",
"sQueryOptionName",
")",
"{",
"var",
"sName",
",",
"sQueryOptionValue",
"=",
"null",
",",
"sSelectOption",
",",
"that",
"=",
"this",
";",
"// Adds given property (either the name of the property as string or an object with a",
"// property name) to sSelectOptio... | Get the value of a query option for the OData request URI corresponding
to this request.
@param {String}
sQueryOptionName Identifies the query option: $select,
$filter,$orderby ... or any custom query option
@returns {String} The value of the requested query option or null, if
this option is not used for the OData request.
@public
@function
@name sap.ui.model.analytics.odata4analytics.QueryResultRequest#getURIQueryOptionValue | [
"Get",
"the",
"value",
"of",
"a",
"query",
"option",
"for",
"the",
"OData",
"request",
"URI",
"corresponding",
"to",
"this",
"request",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/analytics/odata4analytics.js#L4690-L4804 | train | Adds a select option to the select option | [
30522,
3853,
1006,
5490,
13094,
7677,
16790,
18442,
1007,
1063,
13075,
1055,
18442,
1010,
5490,
13094,
7677,
16790,
10175,
5657,
1027,
19701,
1010,
7020,
12260,
6593,
7361,
3508,
1010,
2008,
1027,
2023,
1025,
1013,
1013,
9909,
2445,
3200,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
GitbookIO/gitbook | lib/output/generateBook.js | processOutput | function processOutput(generator, startOutput) {
return Promise(startOutput)
.then(preparePlugins)
.then(preparePages)
.then(prepareAssets)
.then(
callHook.bind(null,
'config',
function(output) {
var book = output.getBook();
var config = book.getConfig();
var values = config.getValues();
return values.toJS();
},
function(output, result) {
var book = output.getBook();
var config = book.getConfig();
config = config.updateValues(result);
book = book.set('config', config);
return output.set('book', book);
}
)
)
.then(
callHook.bind(null,
'init',
function(output) {
return {};
},
function(output) {
return output;
}
)
)
.then(function(output) {
if (!generator.onInit) {
return output;
}
return generator.onInit(output);
})
.then(generateAssets.bind(null, generator))
.then(generatePages.bind(null, generator))
.tap(function(output) {
var book = output.getBook();
if (!book.isMultilingual()) {
return;
}
var logger = book.getLogger();
var books = book.getBooks();
var outputRoot = output.getRoot();
var plugins = output.getPlugins();
var state = output.getState();
var options = output.getOptions();
return Promise.forEach(books, function(langBook) {
// Inherits plugins list, options and state
var langOptions = options.set('root', path.join(outputRoot, langBook.getLanguage()));
var langOutput = new Output({
book: langBook,
options: langOptions,
state: state,
generator: generator.name,
plugins: plugins
});
logger.info.ln('');
logger.info.ln('generating language "' + langBook.getLanguage() + '"');
return processOutput(generator, langOutput);
});
})
.then(callHook.bind(null,
'finish:before',
function(output) {
return {};
},
function(output) {
return output;
}
)
)
.then(function(output) {
if (!generator.onFinish) {
return output;
}
return generator.onFinish(output);
})
.then(callHook.bind(null,
'finish',
function(output) {
return {};
},
function(output) {
return output;
}
)
);
} | javascript | function processOutput(generator, startOutput) {
return Promise(startOutput)
.then(preparePlugins)
.then(preparePages)
.then(prepareAssets)
.then(
callHook.bind(null,
'config',
function(output) {
var book = output.getBook();
var config = book.getConfig();
var values = config.getValues();
return values.toJS();
},
function(output, result) {
var book = output.getBook();
var config = book.getConfig();
config = config.updateValues(result);
book = book.set('config', config);
return output.set('book', book);
}
)
)
.then(
callHook.bind(null,
'init',
function(output) {
return {};
},
function(output) {
return output;
}
)
)
.then(function(output) {
if (!generator.onInit) {
return output;
}
return generator.onInit(output);
})
.then(generateAssets.bind(null, generator))
.then(generatePages.bind(null, generator))
.tap(function(output) {
var book = output.getBook();
if (!book.isMultilingual()) {
return;
}
var logger = book.getLogger();
var books = book.getBooks();
var outputRoot = output.getRoot();
var plugins = output.getPlugins();
var state = output.getState();
var options = output.getOptions();
return Promise.forEach(books, function(langBook) {
// Inherits plugins list, options and state
var langOptions = options.set('root', path.join(outputRoot, langBook.getLanguage()));
var langOutput = new Output({
book: langBook,
options: langOptions,
state: state,
generator: generator.name,
plugins: plugins
});
logger.info.ln('');
logger.info.ln('generating language "' + langBook.getLanguage() + '"');
return processOutput(generator, langOutput);
});
})
.then(callHook.bind(null,
'finish:before',
function(output) {
return {};
},
function(output) {
return output;
}
)
)
.then(function(output) {
if (!generator.onFinish) {
return output;
}
return generator.onFinish(output);
})
.then(callHook.bind(null,
'finish',
function(output) {
return {};
},
function(output) {
return output;
}
)
);
} | [
"function",
"processOutput",
"(",
"generator",
",",
"startOutput",
")",
"{",
"return",
"Promise",
"(",
"startOutput",
")",
".",
"then",
"(",
"preparePlugins",
")",
".",
"then",
"(",
"preparePages",
")",
".",
"then",
"(",
"prepareAssets",
")",
".",
"then",
... | Process an output to generate the book
@param {Generator} generator
@param {Output} output
@return {Promise<Output>} | [
"Process",
"an",
"output",
"to",
"generate",
"the",
"book"
] | 6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4 | https://github.com/GitbookIO/gitbook/blob/6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4/lib/output/generateBook.js#L22-L132 | train | Process the output | [
30522,
3853,
2832,
5833,
18780,
1006,
13103,
1010,
2707,
5833,
18780,
1007,
1063,
2709,
4872,
1006,
2707,
5833,
18780,
1007,
1012,
2059,
1006,
7374,
24759,
15916,
7076,
1007,
1012,
2059,
1006,
7374,
13704,
2015,
1007,
1012,
2059,
1006,
7374... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/dynamodb/converter.js | convertOutput | function convertOutput(data, options) {
options = options || {};
var list, map, i;
for (var type in data) {
var values = data[type];
if (type === 'M') {
map = {};
for (var key in values) {
map[key] = convertOutput(values[key], options);
}
return map;
} else if (type === 'L') {
list = [];
for (i = 0; i < values.length; i++) {
list.push(convertOutput(values[i], options));
}
return list;
} else if (type === 'SS') {
list = [];
for (i = 0; i < values.length; i++) {
list.push(values[i] + '');
}
return new DynamoDBSet(list);
} else if (type === 'NS') {
list = [];
for (i = 0; i < values.length; i++) {
list.push(convertNumber(values[i], options.wrapNumbers));
}
return new DynamoDBSet(list);
} else if (type === 'BS') {
list = [];
for (i = 0; i < values.length; i++) {
list.push(new util.Buffer(values[i]));
}
return new DynamoDBSet(list);
} else if (type === 'S') {
return values + '';
} else if (type === 'N') {
return convertNumber(values, options.wrapNumbers);
} else if (type === 'B') {
return new util.Buffer(values);
} else if (type === 'BOOL') {
return (values === 'true' || values === 'TRUE' || values === true);
} else if (type === 'NULL') {
return null;
}
}
} | javascript | function convertOutput(data, options) {
options = options || {};
var list, map, i;
for (var type in data) {
var values = data[type];
if (type === 'M') {
map = {};
for (var key in values) {
map[key] = convertOutput(values[key], options);
}
return map;
} else if (type === 'L') {
list = [];
for (i = 0; i < values.length; i++) {
list.push(convertOutput(values[i], options));
}
return list;
} else if (type === 'SS') {
list = [];
for (i = 0; i < values.length; i++) {
list.push(values[i] + '');
}
return new DynamoDBSet(list);
} else if (type === 'NS') {
list = [];
for (i = 0; i < values.length; i++) {
list.push(convertNumber(values[i], options.wrapNumbers));
}
return new DynamoDBSet(list);
} else if (type === 'BS') {
list = [];
for (i = 0; i < values.length; i++) {
list.push(new util.Buffer(values[i]));
}
return new DynamoDBSet(list);
} else if (type === 'S') {
return values + '';
} else if (type === 'N') {
return convertNumber(values, options.wrapNumbers);
} else if (type === 'B') {
return new util.Buffer(values);
} else if (type === 'BOOL') {
return (values === 'true' || values === 'TRUE' || values === true);
} else if (type === 'NULL') {
return null;
}
}
} | [
"function",
"convertOutput",
"(",
"data",
",",
"options",
")",
"{",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"var",
"list",
",",
"map",
",",
"i",
";",
"for",
"(",
"var",
"type",
"in",
"data",
")",
"{",
"var",
"values",
"=",
"data",
"[",
"t... | Convert a DynamoDB AttributeValue object to its equivalent JavaScript type.
@param data [map] An object in the Amazon DynamoDB AttributeValue format
@param options [map]
@option options convertEmptyValues [Boolean] Whether to automatically
convert empty strings, blobs,
and sets to `null`
@option options wrapNumbers [Boolean] Whether to return numbers as a
NumberValue object instead of
converting them to native JavaScript
numbers. This allows for the safe
round-trip transport of numbers of
arbitrary size.
@return [Object|Array|String|Number|Boolean|null]
@see AWS.DynamoDB.Converter.unmarshall AWS.DynamoDB.Converter.unmarshall to
convert entire records (rather than individual attributes) | [
"Convert",
"a",
"DynamoDB",
"AttributeValue",
"object",
"to",
"its",
"equivalent",
"JavaScript",
"type",
"."
] | c23e5f0edd150f8885267e5f7c8a564f8e6e8562 | https://github.com/aws/aws-sdk-js/blob/c23e5f0edd150f8885267e5f7c8a564f8e6e8562/lib/dynamodb/converter.js#L114-L161 | train | Converts an output object to a DynamoDB set | [
30522,
3853,
10463,
5833,
18780,
1006,
2951,
1010,
7047,
1007,
1063,
7047,
1027,
7047,
1064,
1064,
1063,
1065,
1025,
13075,
2862,
1010,
4949,
1010,
1045,
1025,
2005,
1006,
13075,
2828,
1999,
2951,
1007,
1063,
13075,
5300,
1027,
2951,
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/renderer/api/remote.js | metaToValue | function metaToValue (meta) {
const types = {
value: () => meta.value,
array: () => meta.members.map((member) => metaToValue(member)),
buffer: () => bufferUtils.metaToBuffer(meta.value),
promise: () => resolvePromise({ then: metaToValue(meta.then) }),
error: () => metaToPlainObject(meta),
date: () => new Date(meta.value),
exception: () => { throw errorUtils.deserialize(meta.value) }
}
if (meta.type in types) {
return types[meta.type]()
} else {
let ret
if (remoteObjectCache.has(meta.id)) {
v8Util.addRemoteObjectRef(contextId, meta.id)
return remoteObjectCache.get(meta.id)
}
// A shadow class to represent the remote function object.
if (meta.type === 'function') {
const remoteFunction = function (...args) {
let command
if (this && this.constructor === remoteFunction) {
command = 'ELECTRON_BROWSER_CONSTRUCTOR'
} else {
command = 'ELECTRON_BROWSER_FUNCTION_CALL'
}
const obj = ipcRendererInternal.sendSync(command, contextId, meta.id, wrapArgs(args))
return metaToValue(obj)
}
ret = remoteFunction
} else {
ret = {}
}
setObjectMembers(ret, ret, meta.id, meta.members)
setObjectPrototype(ret, ret, meta.id, meta.proto)
Object.defineProperty(ret.constructor, 'name', { value: meta.name })
// Track delegate obj's lifetime & tell browser to clean up when object is GCed.
v8Util.setRemoteObjectFreer(ret, contextId, meta.id)
v8Util.setHiddenValue(ret, 'atomId', meta.id)
v8Util.addRemoteObjectRef(contextId, meta.id)
remoteObjectCache.set(meta.id, ret)
return ret
}
} | javascript | function metaToValue (meta) {
const types = {
value: () => meta.value,
array: () => meta.members.map((member) => metaToValue(member)),
buffer: () => bufferUtils.metaToBuffer(meta.value),
promise: () => resolvePromise({ then: metaToValue(meta.then) }),
error: () => metaToPlainObject(meta),
date: () => new Date(meta.value),
exception: () => { throw errorUtils.deserialize(meta.value) }
}
if (meta.type in types) {
return types[meta.type]()
} else {
let ret
if (remoteObjectCache.has(meta.id)) {
v8Util.addRemoteObjectRef(contextId, meta.id)
return remoteObjectCache.get(meta.id)
}
// A shadow class to represent the remote function object.
if (meta.type === 'function') {
const remoteFunction = function (...args) {
let command
if (this && this.constructor === remoteFunction) {
command = 'ELECTRON_BROWSER_CONSTRUCTOR'
} else {
command = 'ELECTRON_BROWSER_FUNCTION_CALL'
}
const obj = ipcRendererInternal.sendSync(command, contextId, meta.id, wrapArgs(args))
return metaToValue(obj)
}
ret = remoteFunction
} else {
ret = {}
}
setObjectMembers(ret, ret, meta.id, meta.members)
setObjectPrototype(ret, ret, meta.id, meta.proto)
Object.defineProperty(ret.constructor, 'name', { value: meta.name })
// Track delegate obj's lifetime & tell browser to clean up when object is GCed.
v8Util.setRemoteObjectFreer(ret, contextId, meta.id)
v8Util.setHiddenValue(ret, 'atomId', meta.id)
v8Util.addRemoteObjectRef(contextId, meta.id)
remoteObjectCache.set(meta.id, ret)
return ret
}
} | [
"function",
"metaToValue",
"(",
"meta",
")",
"{",
"const",
"types",
"=",
"{",
"value",
":",
"(",
")",
"=>",
"meta",
".",
"value",
",",
"array",
":",
"(",
")",
"=>",
"meta",
".",
"members",
".",
"map",
"(",
"(",
"member",
")",
"=>",
"metaToValue",
... | Convert meta data from browser into real value. | [
"Convert",
"meta",
"data",
"from",
"browser",
"into",
"real",
"value",
"."
] | 6e29611788277729647acf465f10db1ea6f15788 | https://github.com/electron/electron/blob/6e29611788277729647acf465f10db1ea6f15788/lib/renderer/api/remote.js#L214-L262 | train | Converts a meta object to a plain object | [
30522,
3853,
18804,
26525,
2389,
5657,
1006,
18804,
1007,
1063,
9530,
3367,
4127,
1027,
1063,
3643,
1024,
1006,
1007,
1027,
1028,
18804,
1012,
30524,
18804,
3406,
8569,
12494,
1006,
18804,
1012,
3643,
1007,
1010,
4872,
1024,
1006,
1007,
102... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
rollup/rollup | rollup.config.js | fixAcornEsmImport | function fixAcornEsmImport() {
return {
name: 'fix-acorn-esm-import',
renderChunk(code, chunk, options) {
if (/esm?/.test(options.format)) {
let found = false;
const fixedCode = code.replace(expectedAcornImport, () => {
found = true;
return newAcornImport;
});
if (!found) {
this.error(
'Could not find expected acorn import, please deactive this plugin and examine generated code.'
);
}
return fixedCode;
}
}
};
} | javascript | function fixAcornEsmImport() {
return {
name: 'fix-acorn-esm-import',
renderChunk(code, chunk, options) {
if (/esm?/.test(options.format)) {
let found = false;
const fixedCode = code.replace(expectedAcornImport, () => {
found = true;
return newAcornImport;
});
if (!found) {
this.error(
'Could not find expected acorn import, please deactive this plugin and examine generated code.'
);
}
return fixedCode;
}
}
};
} | [
"function",
"fixAcornEsmImport",
"(",
")",
"{",
"return",
"{",
"name",
":",
"'fix-acorn-esm-import'",
",",
"renderChunk",
"(",
"code",
",",
"chunk",
",",
"options",
")",
"{",
"if",
"(",
"/",
"esm?",
"/",
".",
"test",
"(",
"options",
".",
"format",
")",
... | by default, rollup-plugin-commonjs will translate require statements as default imports which can cause issues for secondary tools that use the ESM version of acorn | [
"by",
"default",
"rollup",
"-",
"plugin",
"-",
"commonjs",
"will",
"translate",
"require",
"statements",
"as",
"default",
"imports",
"which",
"can",
"cause",
"issues",
"for",
"secondary",
"tools",
"that",
"use",
"the",
"ESM",
"version",
"of",
"acorn"
] | 7d669ebc19b8feb6a8a61fb84b95ea8df650dde1 | https://github.com/rollup/rollup/blob/7d669ebc19b8feb6a8a61fb84b95ea8df650dde1/rollup.config.js#L49-L68 | train | Fixes an acorn import in the generated code | [
30522,
3853,
8081,
22684,
12119,
6491,
5714,
6442,
1006,
1007,
1063,
2709,
1063,
2171,
1024,
1005,
8081,
1011,
9353,
9691,
1011,
9686,
2213,
1011,
12324,
1005,
1010,
17552,
20760,
8950,
1006,
3642,
1010,
20000,
1010,
7047,
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... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/base/ExpressionParser.js | function (oToken, oParser) {
if (!(oToken.value in oParser.globals)) {
Log.warning("Unsupported global identifier '" + oToken.value
+ "' in expression parser input '" + oParser.input + "'",
undefined,
sExpressionParser);
}
return CONSTANT.bind(null, oParser.globals[oToken.value]);
} | javascript | function (oToken, oParser) {
if (!(oToken.value in oParser.globals)) {
Log.warning("Unsupported global identifier '" + oToken.value
+ "' in expression parser input '" + oParser.input + "'",
undefined,
sExpressionParser);
}
return CONSTANT.bind(null, oParser.globals[oToken.value]);
} | [
"function",
"(",
"oToken",
",",
"oParser",
")",
"{",
"if",
"(",
"!",
"(",
"oToken",
".",
"value",
"in",
"oParser",
".",
"globals",
")",
")",
"{",
"Log",
".",
"warning",
"(",
"\"Unsupported global identifier '\"",
"+",
"oToken",
".",
"value",
"+",
"\"' in... | Note: cannot happen due to lbp: 0 | [
"Note",
":",
"cannot",
"happen",
"due",
"to",
"lbp",
":",
"0"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/base/ExpressionParser.js#L91-L99 | train | Returns a function that will be called for a global identifier. | [
30522,
3853,
1006,
27178,
11045,
2078,
1010,
6728,
11650,
2121,
1007,
1063,
2065,
1006,
999,
1006,
27178,
11045,
2078,
1012,
3643,
1999,
6728,
11650,
2121,
1012,
3795,
2015,
1007,
1007,
1063,
8833,
1012,
5432,
1006,
1000,
4895,
6342,
9397,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
catapult-project/catapult | netlog_viewer/netlog_viewer/ui_webui_resources_js_util.js | $ | function $(id) {
var el = document.getElementById(id);
return el ? assertInstanceof(el, HTMLElement) : null;
} | javascript | function $(id) {
var el = document.getElementById(id);
return el ? assertInstanceof(el, HTMLElement) : null;
} | [
"function",
"$",
"(",
"id",
")",
"{",
"var",
"el",
"=",
"document",
".",
"getElementById",
"(",
"id",
")",
";",
"return",
"el",
"?",
"assertInstanceof",
"(",
"el",
",",
"HTMLElement",
")",
":",
"null",
";",
"}"
] | <include src="assert.js">
Alias for document.getElementById. Found elements must be HTMLElements.
@param {string} id The ID of the element to find.
@return {HTMLElement} The found element or null if not found. | [
"<include",
"src",
"=",
"assert",
".",
"js",
">",
"Alias",
"for",
"document",
".",
"getElementById",
".",
"Found",
"elements",
"must",
"be",
"HTMLElements",
"."
] | 992929ffccac68827869a497f01ee4d653ed4f25 | https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/netlog_viewer/netlog_viewer/ui_webui_resources_js_util.js#L12-L15 | train | Returns the element with the given id | [
30522,
3853,
1002,
1006,
8909,
1007,
1063,
13075,
3449,
1027,
6254,
1012,
2131,
12260,
3672,
3762,
3593,
1006,
8909,
1007,
1025,
2709,
3449,
1029,
20865,
7076,
26897,
11253,
1006,
3449,
1010,
16129,
12260,
3672,
1007,
1024,
19701,
1025,
106... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/extensions/default/AutoUpdate/main.js | initializeState | function initializeState() {
var result = $.Deferred();
FileSystem.resolve(updateDir, function (err) {
if (!err) {
result.resolve();
} else {
var directory = FileSystem.getDirectoryForPath(updateDir);
directory.create(function (error) {
if (error) {
console.error('AutoUpdate : Error in creating update directory in Appdata');
result.reject();
} else {
result.resolve();
}
});
}
});
return result.promise();
} | javascript | function initializeState() {
var result = $.Deferred();
FileSystem.resolve(updateDir, function (err) {
if (!err) {
result.resolve();
} else {
var directory = FileSystem.getDirectoryForPath(updateDir);
directory.create(function (error) {
if (error) {
console.error('AutoUpdate : Error in creating update directory in Appdata');
result.reject();
} else {
result.resolve();
}
});
}
});
return result.promise();
} | [
"function",
"initializeState",
"(",
")",
"{",
"var",
"result",
"=",
"$",
".",
"Deferred",
"(",
")",
";",
"FileSystem",
".",
"resolve",
"(",
"updateDir",
",",
"function",
"(",
"err",
")",
"{",
"if",
"(",
"!",
"err",
")",
"{",
"result",
".",
"resolve",... | Initializes the state for AutoUpdate process
@returns {$.Deferred} - a jquery promise,
that is resolved with success or failure
of state initialization | [
"Initializes",
"the",
"state",
"for",
"AutoUpdate",
"process"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/AutoUpdate/main.js#L338-L358 | train | Initialize the state of the update | [
30522,
3853,
3988,
10057,
12259,
1006,
1007,
1063,
13075,
2765,
1027,
1002,
1012,
30524,
9413,
2099,
1007,
1063,
2765,
1012,
10663,
1006,
1007,
1025,
1065,
2842,
1063,
13075,
14176,
1027,
6764,
27268,
6633,
1012,
2131,
4305,
2890,
16761,
21... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
angular/material | src/core/util/iterator.js | findSubsequentItem | function findSubsequentItem(backwards, item, validate, limit) {
validate = validate || trueFn;
var curIndex = indexOf(item);
while (true) {
if (!inRange(curIndex)) return null;
var nextIndex = curIndex + (backwards ? -1 : 1);
var foundItem = null;
if (inRange(nextIndex)) {
foundItem = _items[nextIndex];
} else if (reloop) {
foundItem = backwards ? last() : first();
nextIndex = indexOf(foundItem);
}
if ((foundItem === null) || (nextIndex === limit)) return null;
if (validate(foundItem)) return foundItem;
if (angular.isUndefined(limit)) limit = nextIndex;
curIndex = nextIndex;
}
} | javascript | function findSubsequentItem(backwards, item, validate, limit) {
validate = validate || trueFn;
var curIndex = indexOf(item);
while (true) {
if (!inRange(curIndex)) return null;
var nextIndex = curIndex + (backwards ? -1 : 1);
var foundItem = null;
if (inRange(nextIndex)) {
foundItem = _items[nextIndex];
} else if (reloop) {
foundItem = backwards ? last() : first();
nextIndex = indexOf(foundItem);
}
if ((foundItem === null) || (nextIndex === limit)) return null;
if (validate(foundItem)) return foundItem;
if (angular.isUndefined(limit)) limit = nextIndex;
curIndex = nextIndex;
}
} | [
"function",
"findSubsequentItem",
"(",
"backwards",
",",
"item",
",",
"validate",
",",
"limit",
")",
"{",
"validate",
"=",
"validate",
"||",
"trueFn",
";",
"var",
"curIndex",
"=",
"indexOf",
"(",
"item",
")",
";",
"while",
"(",
"true",
")",
"{",
"if",
... | Find the next item. If reloop is true and at the end of the list, it will go back to the
first item. If given, the `validate` callback will be used to determine whether the next item
is valid. If not valid, it will try to find the next item again.
@param {boolean} backwards Specifies the direction of searching (forwards/backwards)
@param {*} item The item whose subsequent item we are looking for
@param {Function=} validate The `validate` function
@param {integer=} limit The recursion limit
@returns {*} The subsequent item or null | [
"Find",
"the",
"next",
"item",
".",
"If",
"reloop",
"is",
"true",
"and",
"at",
"the",
"end",
"of",
"the",
"list",
"it",
"will",
"go",
"back",
"to",
"the",
"first",
"item",
".",
"If",
"given",
"the",
"validate",
"callback",
"will",
"be",
"used",
"to",... | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/util/iterator.js#L202-L225 | train | Find the next item in the list | [
30522,
3853,
4858,
12083,
3366,
15417,
4221,
2213,
1006,
11043,
1010,
8875,
1010,
9398,
3686,
1010,
5787,
1007,
1063,
9398,
3686,
1027,
9398,
3686,
1064,
1064,
2995,
2546,
2078,
1025,
13075,
12731,
6657,
3207,
2595,
1027,
5950,
11253,
1006,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/language/HTMLDOMDiff.js | function (oldChild) {
var oldChildInNewTree = newNodeMap[oldChild.tagID];
return oldChild.children && oldChildInNewTree && getParentID(oldChild) !== getParentID(oldChildInNewTree);
} | javascript | function (oldChild) {
var oldChildInNewTree = newNodeMap[oldChild.tagID];
return oldChild.children && oldChildInNewTree && getParentID(oldChild) !== getParentID(oldChildInNewTree);
} | [
"function",
"(",
"oldChild",
")",
"{",
"var",
"oldChildInNewTree",
"=",
"newNodeMap",
"[",
"oldChild",
".",
"tagID",
"]",
";",
"return",
"oldChild",
".",
"children",
"&&",
"oldChildInNewTree",
"&&",
"getParentID",
"(",
"oldChild",
")",
"!==",
"getParentID",
"(... | Looks to see if the element in the old tree has moved by checking its
current and former parents.
@return {boolean} true if the element has moved | [
"Looks",
"to",
"see",
"if",
"the",
"element",
"in",
"the",
"old",
"tree",
"has",
"moved",
"by",
"checking",
"its",
"current",
"and",
"former",
"parents",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/language/HTMLDOMDiff.js#L351-L355 | train | returns true if oldChild is not a child of newNodeMap | [
30522,
3853,
1006,
2214,
19339,
1007,
1063,
13075,
2214,
19339,
23111,
7974,
13334,
1027,
2047,
3630,
3207,
2863,
2361,
1031,
2214,
19339,
1012,
6415,
3593,
1033,
1025,
2709,
2214,
19339,
1012,
2336,
1004,
1004,
2214,
19339,
23111,
7974,
13... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
artf/grapesjs | src/commands/index.js | function(id, obj) {
if (isFunction(obj)) obj = { run: obj };
if (!obj.stop) obj.noStop = 1;
delete obj.initialize;
obj.id = id;
commands[id] = CommandAbstract.extend(obj);
return this;
} | javascript | function(id, obj) {
if (isFunction(obj)) obj = { run: obj };
if (!obj.stop) obj.noStop = 1;
delete obj.initialize;
obj.id = id;
commands[id] = CommandAbstract.extend(obj);
return this;
} | [
"function",
"(",
"id",
",",
"obj",
")",
"{",
"if",
"(",
"isFunction",
"(",
"obj",
")",
")",
"obj",
"=",
"{",
"run",
":",
"obj",
"}",
";",
"if",
"(",
"!",
"obj",
".",
"stop",
")",
"obj",
".",
"noStop",
"=",
"1",
";",
"delete",
"obj",
".",
"i... | Need it here as it would be used below | [
"Need",
"it",
"here",
"as",
"it",
"would",
"be",
"used",
"below"
] | 3f053af969ef6a688d526d158b9df7e6aa076838 | https://github.com/artf/grapesjs/blob/3f053af969ef6a688d526d158b9df7e6aa076838/src/commands/index.js#L42-L49 | train | Add a command to the command list | [
30522,
3853,
1006,
8909,
1010,
27885,
3501,
1007,
1063,
2065,
1006,
2003,
11263,
27989,
1006,
27885,
3501,
1007,
1007,
27885,
3501,
1027,
1063,
2448,
1024,
27885,
3501,
1065,
1025,
2065,
1006,
999,
27885,
3501,
1012,
2644,
1007,
27885,
3501... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
angular/material | src/components/tabs/js/tabsController.js | getFocusedTabId | function getFocusedTabId() {
var focusedTab = ctrl.tabs[ctrl.focusIndex];
if (!focusedTab || !focusedTab.id) {
return null;
}
return 'tab-item-' + focusedTab.id;
} | javascript | function getFocusedTabId() {
var focusedTab = ctrl.tabs[ctrl.focusIndex];
if (!focusedTab || !focusedTab.id) {
return null;
}
return 'tab-item-' + focusedTab.id;
} | [
"function",
"getFocusedTabId",
"(",
")",
"{",
"var",
"focusedTab",
"=",
"ctrl",
".",
"tabs",
"[",
"ctrl",
".",
"focusIndex",
"]",
";",
"if",
"(",
"!",
"focusedTab",
"||",
"!",
"focusedTab",
".",
"id",
")",
"{",
"return",
"null",
";",
"}",
"return",
"... | Returns currently focused tab item's element ID | [
"Returns",
"currently",
"focused",
"tab",
"item",
"s",
"element",
"ID"
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/tabs/js/tabsController.js#L536-L542 | train | Returns the id of the currently focused tab | [
30522,
3853,
2131,
14876,
7874,
2098,
2696,
17062,
1006,
1007,
1063,
13075,
4208,
2696,
2497,
1027,
14931,
12190,
1012,
21628,
2015,
1031,
14931,
12190,
1012,
3579,
22254,
10288,
1033,
1025,
2065,
1006,
999,
4208,
2696,
2497,
1064,
1064,
99... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | mxCollapseChange | function mxCollapseChange(model, cell, collapsed)
{
this.model = model;
this.cell = cell;
this.collapsed = collapsed;
this.previous = collapsed;
} | javascript | function mxCollapseChange(model, cell, collapsed)
{
this.model = model;
this.cell = cell;
this.collapsed = collapsed;
this.previous = collapsed;
} | [
"function",
"mxCollapseChange",
"(",
"model",
",",
"cell",
",",
"collapsed",
")",
"{",
"this",
".",
"model",
"=",
"model",
";",
"this",
".",
"cell",
"=",
"cell",
";",
"this",
".",
"collapsed",
"=",
"collapsed",
";",
"this",
".",
"previous",
"=",
"colla... | Class: mxCollapseChange
Action to change a cell's collapsed state in a model.
Constructor: mxCollapseChange
Constructs a change of a collapsed state in the
specified model. | [
"Class",
":",
"mxCollapseChange"
] | 33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44 | https://github.com/jgraph/mxgraph/blob/33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44/javascript/mxClient.js#L41844-L41850 | train | Change the collapsed state of a cell | [
30522,
3853,
25630,
26895,
9331,
3366,
22305,
2063,
1006,
2944,
1010,
3526,
1010,
7798,
1007,
1063,
2023,
1012,
2944,
1027,
2944,
1025,
2023,
1012,
3526,
1027,
3526,
1025,
2023,
1012,
7798,
1027,
7798,
1025,
2023,
1012,
3025,
1027,
7798,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
BlackrockDigital/startbootstrap-sb-admin-2 | vendor/chart.js/Chart.js | fitBox | function fitBox(box) {
var minBoxSize = helpers$1.findNextWhere(minBoxSizes, function(minBox) {
return minBox.box === box;
});
if (minBoxSize) {
if (minBoxSize.horizontal) {
var scaleMargin = {
left: Math.max(outerBoxSizes.left, maxPadding.left),
right: Math.max(outerBoxSizes.right, maxPadding.right),
top: 0,
bottom: 0
};
// Don't use min size here because of label rotation. When the labels are rotated, their rotation highly depends
// on the margin. Sometimes they need to increase in size slightly
box.update(box.fullWidth ? chartWidth : maxChartAreaWidth, chartHeight / 2, scaleMargin);
} else {
box.update(minBoxSize.width, maxChartAreaHeight);
}
}
} | javascript | function fitBox(box) {
var minBoxSize = helpers$1.findNextWhere(minBoxSizes, function(minBox) {
return minBox.box === box;
});
if (minBoxSize) {
if (minBoxSize.horizontal) {
var scaleMargin = {
left: Math.max(outerBoxSizes.left, maxPadding.left),
right: Math.max(outerBoxSizes.right, maxPadding.right),
top: 0,
bottom: 0
};
// Don't use min size here because of label rotation. When the labels are rotated, their rotation highly depends
// on the margin. Sometimes they need to increase in size slightly
box.update(box.fullWidth ? chartWidth : maxChartAreaWidth, chartHeight / 2, scaleMargin);
} else {
box.update(minBoxSize.width, maxChartAreaHeight);
}
}
} | [
"function",
"fitBox",
"(",
"box",
")",
"{",
"var",
"minBoxSize",
"=",
"helpers$1",
".",
"findNextWhere",
"(",
"minBoxSizes",
",",
"function",
"(",
"minBox",
")",
"{",
"return",
"minBox",
".",
"box",
"===",
"box",
";",
"}",
")",
";",
"if",
"(",
"minBoxS... | At this point, maxChartAreaHeight and maxChartAreaWidth are the size the chart area could be if the axes are drawn at their minimum sizes. Steps 5 & 6 Function to fit a box | [
"At",
"this",
"point",
"maxChartAreaHeight",
"and",
"maxChartAreaWidth",
"are",
"the",
"size",
"the",
"chart",
"area",
"could",
"be",
"if",
"the",
"axes",
"are",
"drawn",
"at",
"their",
"minimum",
"sizes",
".",
"Steps",
"5",
"&",
"6",
"Function",
"to",
"fi... | ddfaceb4a8e65a41f163e2fdc4eab49384b810a1 | https://github.com/BlackrockDigital/startbootstrap-sb-admin-2/blob/ddfaceb4a8e65a41f163e2fdc4eab49384b810a1/vendor/chart.js/Chart.js#L6392-L6413 | train | Fit the chart area with the given box | [
30522,
3853,
4906,
8758,
1006,
3482,
1007,
1063,
13075,
8117,
8758,
5332,
4371,
1027,
2393,
2545,
1002,
1015,
1012,
2424,
2638,
18413,
2860,
5886,
2063,
1006,
8117,
8758,
5332,
11254,
1010,
3853,
1006,
8117,
8758,
1007,
1063,
2709,
8117,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/layout/layout.js | validateAttributeUsage | function validateAttributeUsage(className, attr, element, $log){
var message, usage, url;
var nodeName = element[0].nodeName.toLowerCase();
switch (className.replace(SUFFIXES,"")) {
case "flex":
if ((nodeName == "md-button") || (nodeName == "fieldset")){
// @see https://github.com/philipwalton/flexbugs#9-some-html-elements-cant-be-flex-containers
// Use <div flex> wrapper inside (preferred) or outside
usage = "<" + nodeName + " " + className + "></" + nodeName + ">";
url = "https://github.com/philipwalton/flexbugs#9-some-html-elements-cant-be-flex-containers";
message = "Markup '{0}' may not work as expected in IE Browsers. Consult '{1}' for details.";
$log.warn($mdUtil.supplant(message, [usage, url]));
}
}
} | javascript | function validateAttributeUsage(className, attr, element, $log){
var message, usage, url;
var nodeName = element[0].nodeName.toLowerCase();
switch (className.replace(SUFFIXES,"")) {
case "flex":
if ((nodeName == "md-button") || (nodeName == "fieldset")){
// @see https://github.com/philipwalton/flexbugs#9-some-html-elements-cant-be-flex-containers
// Use <div flex> wrapper inside (preferred) or outside
usage = "<" + nodeName + " " + className + "></" + nodeName + ">";
url = "https://github.com/philipwalton/flexbugs#9-some-html-elements-cant-be-flex-containers";
message = "Markup '{0}' may not work as expected in IE Browsers. Consult '{1}' for details.";
$log.warn($mdUtil.supplant(message, [usage, url]));
}
}
} | [
"function",
"validateAttributeUsage",
"(",
"className",
",",
"attr",
",",
"element",
",",
"$log",
")",
"{",
"var",
"message",
",",
"usage",
",",
"url",
";",
"var",
"nodeName",
"=",
"element",
"[",
"0",
"]",
".",
"nodeName",
".",
"toLowerCase",
"(",
")",
... | Centralize warnings for known flexbox issues (especially IE-related issues) | [
"Centralize",
"warnings",
"for",
"known",
"flexbox",
"issues",
"(",
"especially",
"IE",
"-",
"related",
"issues",
")"
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/services/layout/layout.js#L384-L402 | train | Validate the usage of an attribute | [
30522,
3853,
9398,
3686,
19321,
3089,
8569,
2618,
10383,
3351,
1006,
2465,
18442,
1010,
2012,
16344,
1010,
5783,
1010,
1002,
8833,
1007,
1063,
13075,
4471,
1010,
8192,
1010,
24471,
2140,
1025,
13075,
13045,
18442,
1027,
5783,
1031,
1014,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
BlackrockDigital/startbootstrap-sb-admin-2 | vendor/chart.js/Chart.js | hwbString | function hwbString(hwb, alpha) {
if (alpha === undefined) {
alpha = (hwb[3] !== undefined ? hwb[3] : 1);
}
return "hwb(" + hwb[0] + ", " + hwb[1] + "%, " + hwb[2] + "%"
+ (alpha !== undefined && alpha !== 1 ? ", " + alpha : "") + ")";
} | javascript | function hwbString(hwb, alpha) {
if (alpha === undefined) {
alpha = (hwb[3] !== undefined ? hwb[3] : 1);
}
return "hwb(" + hwb[0] + ", " + hwb[1] + "%, " + hwb[2] + "%"
+ (alpha !== undefined && alpha !== 1 ? ", " + alpha : "") + ")";
} | [
"function",
"hwbString",
"(",
"hwb",
",",
"alpha",
")",
"{",
"if",
"(",
"alpha",
"===",
"undefined",
")",
"{",
"alpha",
"=",
"(",
"hwb",
"[",
"3",
"]",
"!==",
"undefined",
"?",
"hwb",
"[",
"3",
"]",
":",
"1",
")",
";",
"}",
"return",
"\"hwb(\"",
... | hwb is a bit different than rgb(a) & hsl(a) since there is no alpha specific syntax (hwb have alpha optional & 1 is default value) | [
"hwb",
"is",
"a",
"bit",
"different",
"than",
"rgb",
"(",
"a",
")",
"&",
"hsl",
"(",
"a",
")",
"since",
"there",
"is",
"no",
"alpha",
"specific",
"syntax",
"(",
"hwb",
"have",
"alpha",
"optional",
"&",
"1",
"is",
"default",
"value",
")"
] | ddfaceb4a8e65a41f163e2fdc4eab49384b810a1 | https://github.com/BlackrockDigital/startbootstrap-sb-admin-2/blob/ddfaceb4a8e65a41f163e2fdc4eab49384b810a1/vendor/chart.js/Chart.js#L1165-L1171 | train | Returns a string representation of the HWB color | [
30522,
3853,
1044,
2860,
5910,
18886,
3070,
1006,
1044,
2860,
2497,
1010,
6541,
1007,
1063,
2065,
1006,
6541,
1027,
1027,
1027,
6151,
28344,
1007,
1063,
6541,
1027,
1006,
1044,
2860,
2497,
1031,
1017,
1033,
999,
1027,
1027,
6151,
28344,
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... |
pixijs/pixi.js | packages/canvas/canvas-prepare/src/CanvasPrepare.js | uploadBaseTextures | function uploadBaseTextures(prepare, item)
{
if (item instanceof BaseTexture)
{
const image = item.source;
// Sometimes images (like atlas images) report a size of zero, causing errors on windows phone.
// So if the width or height is equal to zero then use the canvas size
// Otherwise use whatever is smaller, the image dimensions or the canvas dimensions.
const imageWidth = image.width === 0 ? prepare.canvas.width : Math.min(prepare.canvas.width, image.width);
const imageHeight = image.height === 0 ? prepare.canvas.height : Math.min(prepare.canvas.height, image.height);
// Only a small subsections is required to be drawn to have the whole texture uploaded to the GPU
// A smaller draw can be faster.
prepare.ctx.drawImage(image, 0, 0, imageWidth, imageHeight, 0, 0, prepare.canvas.width, prepare.canvas.height);
return true;
}
return false;
} | javascript | function uploadBaseTextures(prepare, item)
{
if (item instanceof BaseTexture)
{
const image = item.source;
// Sometimes images (like atlas images) report a size of zero, causing errors on windows phone.
// So if the width or height is equal to zero then use the canvas size
// Otherwise use whatever is smaller, the image dimensions or the canvas dimensions.
const imageWidth = image.width === 0 ? prepare.canvas.width : Math.min(prepare.canvas.width, image.width);
const imageHeight = image.height === 0 ? prepare.canvas.height : Math.min(prepare.canvas.height, image.height);
// Only a small subsections is required to be drawn to have the whole texture uploaded to the GPU
// A smaller draw can be faster.
prepare.ctx.drawImage(image, 0, 0, imageWidth, imageHeight, 0, 0, prepare.canvas.width, prepare.canvas.height);
return true;
}
return false;
} | [
"function",
"uploadBaseTextures",
"(",
"prepare",
",",
"item",
")",
"{",
"if",
"(",
"item",
"instanceof",
"BaseTexture",
")",
"{",
"const",
"image",
"=",
"item",
".",
"source",
";",
"// Sometimes images (like atlas images) report a size of zero, causing errors on windows ... | Built-in hook to upload PIXI.Texture objects to the GPU.
@private
@param {*} prepare - Instance of CanvasPrepare
@param {*} item - Item to check
@return {boolean} If item was uploaded. | [
"Built",
"-",
"in",
"hook",
"to",
"upload",
"PIXI",
".",
"Texture",
"objects",
"to",
"the",
"GPU",
"."
] | 99ae03b7565ae7ca5a6de633b0a277f7128fa4d0 | https://github.com/pixijs/pixi.js/blob/99ae03b7565ae7ca5a6de633b0a277f7128fa4d0/packages/canvas/canvas-prepare/src/CanvasPrepare.js#L69-L89 | train | Upload a base texture to the GPU | [
30522,
3853,
2039,
11066,
15058,
18209,
14900,
1006,
7374,
1010,
8875,
1007,
1063,
2065,
1006,
8875,
6013,
11253,
2918,
18209,
5397,
1007,
1063,
9530,
3367,
3746,
1027,
8875,
1012,
3120,
1025,
1013,
1013,
2823,
4871,
1006,
2066,
11568,
4871... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/BindingParser.js | composeFormatters | function composeFormatters(aFormatters, fnRootFormatter) {
function formatter() {
var i,
n = aFormatters.length,
aResults = new Array(n);
for (i = 0; i < n; i += 1) {
aResults[i] = aFormatters[i].apply(this, arguments);
}
if (fnRootFormatter) {
return fnRootFormatter.apply(this, aResults);
}
// @see sap.ui.model.CompositeBinding#getExternalValue
// "default: multiple values are joined together as space separated list if no
// formatter or type specified"
return n > 1 ? aResults.join(" ") : aResults[0];
}
// @see sap.ui.base.ManagedObject#_bindProperty
formatter.textFragments = fnRootFormatter && fnRootFormatter.textFragments
|| "sap.ui.base.BindingParser: composeFormatters";
return formatter;
} | javascript | function composeFormatters(aFormatters, fnRootFormatter) {
function formatter() {
var i,
n = aFormatters.length,
aResults = new Array(n);
for (i = 0; i < n; i += 1) {
aResults[i] = aFormatters[i].apply(this, arguments);
}
if (fnRootFormatter) {
return fnRootFormatter.apply(this, aResults);
}
// @see sap.ui.model.CompositeBinding#getExternalValue
// "default: multiple values are joined together as space separated list if no
// formatter or type specified"
return n > 1 ? aResults.join(" ") : aResults[0];
}
// @see sap.ui.base.ManagedObject#_bindProperty
formatter.textFragments = fnRootFormatter && fnRootFormatter.textFragments
|| "sap.ui.base.BindingParser: composeFormatters";
return formatter;
} | [
"function",
"composeFormatters",
"(",
"aFormatters",
",",
"fnRootFormatter",
")",
"{",
"function",
"formatter",
"(",
")",
"{",
"var",
"i",
",",
"n",
"=",
"aFormatters",
".",
"length",
",",
"aResults",
"=",
"new",
"Array",
"(",
"n",
")",
";",
"for",
"(",
... | Creates a composite formatter which calls <code>fnRootFormatter</code> on the results of the
given formatters, which in turn are called on the original arguments.
@param {function[]} aFormatters
list of leaf-level formatters
@param {function} [fnRootFormatter]
root level formatter; default: <code>Array.prototype.join(., " ")</code>
@return {function}
a composite formatter | [
"Creates",
"a",
"composite",
"formatter",
"which",
"calls",
"<code",
">",
"fnRootFormatter<",
"/",
"code",
">",
"on",
"the",
"results",
"of",
"the",
"given",
"formatters",
"which",
"in",
"turn",
"are",
"called",
"on",
"the",
"original",
"arguments",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/base/BindingParser.js#L62-L84 | train | composeFormatters is a function that returns a function that will return a single value if no formatter or type specified | [
30522,
3853,
17202,
14192,
20097,
2015,
1006,
21358,
2953,
18900,
7747,
1010,
1042,
16118,
17206,
14192,
20097,
1007,
1063,
3853,
4289,
3334,
1006,
1007,
1063,
13075,
1045,
1010,
1050,
1027,
21358,
2953,
18900,
7747,
1012,
3091,
1010,
23631,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/data/importer/index.js | function (file, ext) {
var fileHandler = _.find(this.handlers, function (handler) {
return _.includes(handler.extensions, ext);
});
return fileHandler.loadFile([_.pick(file, 'name', 'path')]).then(function (loadedData) {
// normalize the returned data
var importData = {};
importData[fileHandler.type] = loadedData;
return importData;
});
} | javascript | function (file, ext) {
var fileHandler = _.find(this.handlers, function (handler) {
return _.includes(handler.extensions, ext);
});
return fileHandler.loadFile([_.pick(file, 'name', 'path')]).then(function (loadedData) {
// normalize the returned data
var importData = {};
importData[fileHandler.type] = loadedData;
return importData;
});
} | [
"function",
"(",
"file",
",",
"ext",
")",
"{",
"var",
"fileHandler",
"=",
"_",
".",
"find",
"(",
"this",
".",
"handlers",
",",
"function",
"(",
"handler",
")",
"{",
"return",
"_",
".",
"includes",
"(",
"handler",
".",
"extensions",
",",
"ext",
")",
... | Process File
Takes a reference to a single file, sends it to the relevant handler to be loaded and returns an object in the
importData format: {data: {}, images: []}
The data key contains JSON representing any data that should be imported
The image key contains references to images that will be stored (and where they will be stored)
@param {File} file
@returns {Promise(ImportData)} | [
"Process",
"File",
"Takes",
"a",
"reference",
"to",
"a",
"single",
"file",
"sends",
"it",
"to",
"the",
"relevant",
"handler",
"to",
"be",
"loaded",
"and",
"returns",
"an",
"object",
"in",
"the",
"importData",
"format",
":",
"{",
"data",
":",
"{}",
"image... | bb7bb55cf3e60af99ebbc56099928827b58461bc | https://github.com/TryGhost/Ghost/blob/bb7bb55cf3e60af99ebbc56099928827b58461bc/core/server/data/importer/index.js#L276-L287 | train | Load a file | [
30522,
3853,
1006,
5371,
1010,
4654,
2102,
1007,
1063,
13075,
5371,
11774,
3917,
1027,
1035,
1012,
2424,
1006,
2023,
1012,
28213,
2015,
1010,
3853,
1006,
28213,
1007,
1063,
2709,
1035,
1012,
2950,
1006,
28213,
1012,
14305,
1010,
4654,
2102,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
jhipster/generator-jhipster | generators/docker-utils.js | checkDocker | function checkDocker() {
if (this.abort || this.skipChecks) return;
const done = this.async();
shelljs.exec('docker -v', { silent: true }, (code, stdout, stderr) => {
if (stderr) {
this.log(
chalk.red(
'Docker version 1.10.0 or later is not installed on your computer.\n' +
' Read http://docs.docker.com/engine/installation/#installation\n'
)
);
this.abort = true;
} else {
const dockerVersion = stdout.split(' ')[2].replace(/,/g, '');
const dockerVersionMajor = dockerVersion.split('.')[0];
const dockerVersionMinor = dockerVersion.split('.')[1];
if (dockerVersionMajor < 1 || (dockerVersionMajor === 1 && dockerVersionMinor < 10)) {
this.log(
chalk.red(
`${'Docker version 1.10.0 or later is not installed on your computer.\n' +
' Docker version found: '}${dockerVersion}\n` +
' Read http://docs.docker.com/engine/installation/#installation\n'
)
);
this.abort = true;
} else {
this.log.ok('Docker is installed');
}
}
done();
});
} | javascript | function checkDocker() {
if (this.abort || this.skipChecks) return;
const done = this.async();
shelljs.exec('docker -v', { silent: true }, (code, stdout, stderr) => {
if (stderr) {
this.log(
chalk.red(
'Docker version 1.10.0 or later is not installed on your computer.\n' +
' Read http://docs.docker.com/engine/installation/#installation\n'
)
);
this.abort = true;
} else {
const dockerVersion = stdout.split(' ')[2].replace(/,/g, '');
const dockerVersionMajor = dockerVersion.split('.')[0];
const dockerVersionMinor = dockerVersion.split('.')[1];
if (dockerVersionMajor < 1 || (dockerVersionMajor === 1 && dockerVersionMinor < 10)) {
this.log(
chalk.red(
`${'Docker version 1.10.0 or later is not installed on your computer.\n' +
' Docker version found: '}${dockerVersion}\n` +
' Read http://docs.docker.com/engine/installation/#installation\n'
)
);
this.abort = true;
} else {
this.log.ok('Docker is installed');
}
}
done();
});
} | [
"function",
"checkDocker",
"(",
")",
"{",
"if",
"(",
"this",
".",
"abort",
"||",
"this",
".",
"skipChecks",
")",
"return",
";",
"const",
"done",
"=",
"this",
".",
"async",
"(",
")",
";",
"shelljs",
".",
"exec",
"(",
"'docker -v'",
",",
"{",
"silent",... | Check that Docker exists.
@param failOver flag | [
"Check",
"that",
"Docker",
"exists",
"."
] | f76fa8de0818ce6bda6c7b1455942e2a9b0ae3ff | https://github.com/jhipster/generator-jhipster/blob/f76fa8de0818ce6bda6c7b1455942e2a9b0ae3ff/generators/docker-utils.js#L39-L71 | train | Check Docker version 1. 10. 0 or later | [
30522,
3853,
4638,
14647,
2121,
1006,
1007,
1063,
2065,
1006,
2023,
1012,
11113,
11589,
1064,
1064,
2023,
1012,
13558,
5403,
10603,
1007,
2709,
1025,
9530,
3367,
2589,
1027,
2023,
1012,
2004,
6038,
2278,
1006,
1007,
1025,
5806,
22578,
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... |
caolan/async | lib/doWhilst.js | doWhilst | function doWhilst(iteratee, test, callback) {
callback = onlyOnce(callback);
var _fn = wrapAsync(iteratee);
var _test = wrapAsync(test);
var results
function next(err, ...args) {
if (err) return callback(err);
if (err === false) return;
results = args
_test(...args, check);
}
function check(err, truth) {
if (err) return callback(err);
if (err === false) return;
if (!truth) return callback(null, ...results);
_fn(next);
}
return check(null, true);
} | javascript | function doWhilst(iteratee, test, callback) {
callback = onlyOnce(callback);
var _fn = wrapAsync(iteratee);
var _test = wrapAsync(test);
var results
function next(err, ...args) {
if (err) return callback(err);
if (err === false) return;
results = args
_test(...args, check);
}
function check(err, truth) {
if (err) return callback(err);
if (err === false) return;
if (!truth) return callback(null, ...results);
_fn(next);
}
return check(null, true);
} | [
"function",
"doWhilst",
"(",
"iteratee",
",",
"test",
",",
"callback",
")",
"{",
"callback",
"=",
"onlyOnce",
"(",
"callback",
")",
";",
"var",
"_fn",
"=",
"wrapAsync",
"(",
"iteratee",
")",
";",
"var",
"_test",
"=",
"wrapAsync",
"(",
"test",
")",
";",... | The post-check version of [`whilst`]{@link module:ControlFlow.whilst}. To reflect the difference in
the order of operations, the arguments `test` and `iteratee` are switched.
`doWhilst` is to `whilst` as `do while` is to `while` in plain JavaScript.
@name doWhilst
@static
@memberOf module:ControlFlow
@method
@see [async.whilst]{@link module:ControlFlow.whilst}
@category Control Flow
@param {AsyncFunction} iteratee - A function which is called each time `test`
passes. Invoked with (callback).
@param {AsyncFunction} test - asynchronous truth test to perform after each
execution of `iteratee`. Invoked with (...args, callback), where `...args` are the
non-error args from the previous callback of `iteratee`.
@param {Function} [callback] - A callback which is called after the test
function has failed and repeated execution of `iteratee` has stopped.
`callback` will be passed an error and any arguments passed to the final
`iteratee`'s callback. Invoked with (err, [results]);
@returns {Promise} a promise, if no callback is passed | [
"The",
"post",
"-",
"check",
"version",
"of",
"[",
"whilst",
"]",
"{",
"@link",
"module",
":",
"ControlFlow",
".",
"whilst",
"}",
".",
"To",
"reflect",
"the",
"difference",
"in",
"the",
"order",
"of",
"operations",
"the",
"arguments",
"test",
"and",
"ite... | 4330d536c106592139fa82062494c9dba0da1fdb | https://github.com/caolan/async/blob/4330d536c106592139fa82062494c9dba0da1fdb/lib/doWhilst.js#L28-L49 | train | Do a series of functions that return true if all the results are true | [
30522,
3853,
23268,
19466,
3367,
1006,
2009,
22139,
2063,
1010,
3231,
1010,
2655,
5963,
1007,
1063,
2655,
5963,
1027,
2069,
2239,
3401,
1006,
2655,
5963,
1007,
1025,
13075,
1035,
1042,
2078,
1027,
10236,
3022,
6038,
2278,
1006,
2009,
22139,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/DemoApps.controller.js | function () {
// set i18n model on view
var oModel = new JSONModel(),
i18nModel = new ResourceModel({
bundleName: "sap.ui.documentation.sdk.i18n.i18n"
});
this.getView().setModel(i18nModel, "i18n");
// load demo app metadata from docuindex of all available libraries
libraryData.fillJSONModel(oModel);
this.setModel(oModel);
this.getRouter().getRoute("demoapps").attachPatternMatched(this._onMatched, this);
sap.ui.getVersionInfo({async: true}).then(function (oVersionInfo) {
var oViewModel = new JSONModel({
isOpenUI5: oVersionInfo && oVersionInfo.gav && /openui5/i.test(oVersionInfo.gav)
});
this.getView().setModel(oViewModel, "appView");
}.bind(this));
// manually call the handler once at startup as device API won't do this for us
this._onOrientationChange({
landscape: Device.orientation.landscape
});
this._onResize({
name: (Device.resize.width <= 600 ? "Phone" : "NoPhone")
});
} | javascript | function () {
// set i18n model on view
var oModel = new JSONModel(),
i18nModel = new ResourceModel({
bundleName: "sap.ui.documentation.sdk.i18n.i18n"
});
this.getView().setModel(i18nModel, "i18n");
// load demo app metadata from docuindex of all available libraries
libraryData.fillJSONModel(oModel);
this.setModel(oModel);
this.getRouter().getRoute("demoapps").attachPatternMatched(this._onMatched, this);
sap.ui.getVersionInfo({async: true}).then(function (oVersionInfo) {
var oViewModel = new JSONModel({
isOpenUI5: oVersionInfo && oVersionInfo.gav && /openui5/i.test(oVersionInfo.gav)
});
this.getView().setModel(oViewModel, "appView");
}.bind(this));
// manually call the handler once at startup as device API won't do this for us
this._onOrientationChange({
landscape: Device.orientation.landscape
});
this._onResize({
name: (Device.resize.width <= 600 ? "Phone" : "NoPhone")
});
} | [
"function",
"(",
")",
"{",
"// set i18n model on view",
"var",
"oModel",
"=",
"new",
"JSONModel",
"(",
")",
",",
"i18nModel",
"=",
"new",
"ResourceModel",
"(",
"{",
"bundleName",
":",
"\"sap.ui.documentation.sdk.i18n.i18n\"",
"}",
")",
";",
"this",
".",
"getView... | Called when the controller is instantiated.
@public | [
"Called",
"when",
"the",
"controller",
"is",
"instantiated",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/DemoApps.controller.js#L31-L60 | train | This function is called when the demo app is loaded | [
30522,
3853,
1006,
1007,
1063,
1013,
1013,
2275,
1045,
15136,
2078,
2944,
2006,
3193,
13075,
18168,
10244,
2140,
1027,
2047,
1046,
3385,
5302,
9247,
1006,
1007,
1010,
1045,
15136,
2078,
5302,
9247,
1027,
2047,
7692,
5302,
9247,
1006,
1063,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
aws-amplify/amplify-js | packages/amazon-cognito-identity-js/src/BigInteger.js | bnpRShiftTo | function bnpRShiftTo(n, r) {
r.s = this.s;
var ds = Math.floor(n / this.DB);
if (ds >= this.t) {
r.t = 0;
return;
}
var bs = n % this.DB;
var cbs = this.DB - bs;
var bm = (1 << bs) - 1;
r[0] = this[ds] >> bs;
for (var i = ds + 1; i < this.t; ++i) {
r[i - ds - 1] |= (this[i] & bm) << cbs;
r[i - ds] = this[i] >> bs;
}
if (bs > 0) r[this.t - ds - 1] |= (this.s & bm) << cbs;
r.t = this.t - ds;
r.clamp();
} | javascript | function bnpRShiftTo(n, r) {
r.s = this.s;
var ds = Math.floor(n / this.DB);
if (ds >= this.t) {
r.t = 0;
return;
}
var bs = n % this.DB;
var cbs = this.DB - bs;
var bm = (1 << bs) - 1;
r[0] = this[ds] >> bs;
for (var i = ds + 1; i < this.t; ++i) {
r[i - ds - 1] |= (this[i] & bm) << cbs;
r[i - ds] = this[i] >> bs;
}
if (bs > 0) r[this.t - ds - 1] |= (this.s & bm) << cbs;
r.t = this.t - ds;
r.clamp();
} | [
"function",
"bnpRShiftTo",
"(",
"n",
",",
"r",
")",
"{",
"r",
".",
"s",
"=",
"this",
".",
"s",
";",
"var",
"ds",
"=",
"Math",
".",
"floor",
"(",
"n",
"/",
"this",
".",
"DB",
")",
";",
"if",
"(",
"ds",
">=",
"this",
".",
"t",
")",
"{",
"r"... | (protected) r = this >> n | [
"(",
"protected",
")",
"r",
"=",
"this",
">>",
"n"
] | db55ff3dff31c64a246180f39eb0a04a89fd16e1 | https://github.com/aws-amplify/amplify-js/blob/db55ff3dff31c64a246180f39eb0a04a89fd16e1/packages/amazon-cognito-identity-js/src/BigInteger.js#L353-L371 | train | Shifts this number by n to the right of the polynomial | [
30522,
3853,
24869,
18098,
6182,
6199,
3406,
1006,
1050,
1010,
1054,
1007,
1063,
1054,
1012,
1055,
1027,
2023,
1012,
1055,
1025,
13075,
16233,
1027,
8785,
1012,
2723,
1006,
1050,
1013,
2023,
1012,
16962,
1007,
1025,
2065,
1006,
16233,
1028,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SheetJS/js-xlsx | bits/50_styxls.js | parse_XFExt | function parse_XFExt(blob, length) {
var end = blob.l + length;
blob.l += 2;
var ixfe = blob.read_shift(2);
blob.l += 2;
var cexts = blob.read_shift(2);
var ext/*:AOA*/ = [];
while(cexts-- > 0) ext.push(parse_ExtProp(blob, end-blob.l));
return {ixfe:ixfe, ext:ext};
} | javascript | function parse_XFExt(blob, length) {
var end = blob.l + length;
blob.l += 2;
var ixfe = blob.read_shift(2);
blob.l += 2;
var cexts = blob.read_shift(2);
var ext/*:AOA*/ = [];
while(cexts-- > 0) ext.push(parse_ExtProp(blob, end-blob.l));
return {ixfe:ixfe, ext:ext};
} | [
"function",
"parse_XFExt",
"(",
"blob",
",",
"length",
")",
"{",
"var",
"end",
"=",
"blob",
".",
"l",
"+",
"length",
";",
"blob",
".",
"l",
"+=",
"2",
";",
"var",
"ixfe",
"=",
"blob",
".",
"read_shift",
"(",
"2",
")",
";",
"blob",
".",
"l",
"+=... | /* 2.4.355 | [
"/",
"*",
"2",
".",
"4",
".",
"355"
] | 9a6d8a1d3d80c78dad5201fb389316f935279cdc | https://github.com/SheetJS/js-xlsx/blob/9a6d8a1d3d80c78dad5201fb389316f935279cdc/bits/50_styxls.js#L61-L70 | train | Parse an extended file | [
30522,
3853,
11968,
3366,
1035,
1060,
7959,
18413,
1006,
1038,
4135,
2497,
1010,
3091,
1007,
1063,
13075,
2203,
1027,
1038,
4135,
2497,
1012,
1048,
1009,
3091,
1025,
1038,
4135,
2497,
1012,
1048,
1009,
1027,
1016,
1025,
13075,
11814,
7959,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
babel/babel | packages/babel-helper-replace-supers/src/index.js | getPrototypeOfExpression | function getPrototypeOfExpression(objectRef, isStatic, file, isPrivateMethod) {
objectRef = t.cloneNode(objectRef);
const targetRef =
isStatic || isPrivateMethod
? objectRef
: t.memberExpression(objectRef, t.identifier("prototype"));
return t.callExpression(file.addHelper("getPrototypeOf"), [targetRef]);
} | javascript | function getPrototypeOfExpression(objectRef, isStatic, file, isPrivateMethod) {
objectRef = t.cloneNode(objectRef);
const targetRef =
isStatic || isPrivateMethod
? objectRef
: t.memberExpression(objectRef, t.identifier("prototype"));
return t.callExpression(file.addHelper("getPrototypeOf"), [targetRef]);
} | [
"function",
"getPrototypeOfExpression",
"(",
"objectRef",
",",
"isStatic",
",",
"file",
",",
"isPrivateMethod",
")",
"{",
"objectRef",
"=",
"t",
".",
"cloneNode",
"(",
"objectRef",
")",
";",
"const",
"targetRef",
"=",
"isStatic",
"||",
"isPrivateMethod",
"?",
... | Creates an expression which result is the proto of objectRef.
@example <caption>isStatic === true</caption>
helpers.getPrototypeOf(CLASS)
@example <caption>isStatic === false</caption>
helpers.getPrototypeOf(CLASS.prototype) | [
"Creates",
"an",
"expression",
"which",
"result",
"is",
"the",
"proto",
"of",
"objectRef",
"."
] | 1969e6b6aa7d90be3fbb3aca98ea96849656a55a | https://github.com/babel/babel/blob/1969e6b6aa7d90be3fbb3aca98ea96849656a55a/packages/babel-helper-replace-supers/src/index.js#L18-L26 | train | Returns the prototype of objectRef | [
30522,
3853,
2131,
21572,
3406,
13874,
11253,
10288,
20110,
3258,
1006,
4874,
2890,
2546,
1010,
26354,
29336,
2594,
1010,
5371,
1010,
2003,
18098,
21466,
11368,
6806,
2094,
1007,
1063,
4874,
2890,
2546,
1027,
1056,
1012,
17598,
3630,
3207,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
electron/electron | script/bump-version.js | updateVersion | async function updateVersion (version) {
const versionPath = path.resolve(__dirname, '..', 'ELECTRON_VERSION')
await writeFile(versionPath, version, 'utf8')
} | javascript | async function updateVersion (version) {
const versionPath = path.resolve(__dirname, '..', 'ELECTRON_VERSION')
await writeFile(versionPath, version, 'utf8')
} | [
"async",
"function",
"updateVersion",
"(",
"version",
")",
"{",
"const",
"versionPath",
"=",
"path",
".",
"resolve",
"(",
"__dirname",
",",
"'..'",
",",
"'ELECTRON_VERSION'",
")",
"await",
"writeFile",
"(",
"versionPath",
",",
"version",
",",
"'utf8'",
")",
... | update VERSION file with latest release info | [
"update",
"VERSION",
"file",
"with",
"latest",
"release",
"info"
] | 6e29611788277729647acf465f10db1ea6f15788 | https://github.com/electron/electron/blob/6e29611788277729647acf465f10db1ea6f15788/script/bump-version.js#L107-L110 | train | Update the version of the cluster | [
30522,
2004,
6038,
2278,
3853,
10651,
27774,
1006,
2544,
1007,
1063,
9530,
3367,
2544,
15069,
1027,
4130,
1012,
10663,
1006,
1035,
1035,
16101,
18442,
1010,
1005,
1012,
1012,
1005,
1010,
1005,
10496,
1035,
2544,
1005,
1007,
26751,
4339,
887... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | is_ancestor | function is_ancestor(node, target)
{
while (target.parentNode) {
target = target.parentNode;
if (node == target)
return true;
}
return false;
} | javascript | function is_ancestor(node, target)
{
while (target.parentNode) {
target = target.parentNode;
if (node == target)
return true;
}
return false;
} | [
"function",
"is_ancestor",
"(",
"node",
",",
"target",
")",
"{",
"while",
"(",
"target",
".",
"parentNode",
")",
"{",
"target",
"=",
"target",
".",
"parentNode",
";",
"if",
"(",
"node",
"==",
"target",
")",
"return",
"true",
";",
"}",
"return",
"false"... | Returns true if a node is an ancestor node of a target node, and false
otherwise.
@param node the node being compared to the target node
@param target the target node
@return true if node is an ancestor node of target, false otherwise. | [
"Returns",
"true",
"if",
"a",
"node",
"is",
"an",
"ancestor",
"node",
"of",
"a",
"target",
"node",
"and",
"false",
"otherwise",
"."
] | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/selenium-core/scripts/htmlutils.js#L2543-L2551 | train | returns true if node is an ancestor of target | [
30522,
3853,
2003,
1035,
13032,
1006,
13045,
1010,
4539,
1007,
1063,
2096,
1006,
4539,
1012,
6687,
3630,
3207,
1007,
1063,
4539,
1027,
4539,
1012,
6687,
3630,
3207,
1025,
2065,
1006,
13045,
1027,
1027,
4539,
1007,
2709,
2995,
1025,
1065,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
jhipster/generator-jhipster | generators/aws-containers/aws-client.js | saveCredentialsInAWS | function saveCredentialsInAWS(profile = 'default') {
credentials = new AWS.SharedIniFileCredentials({ profile });
return new Promise((resolve, reject) =>
credentials.refresh(err => {
if (err) {
reject(err);
}
AWS.config.credentials = credentials;
resolve();
})
);
} | javascript | function saveCredentialsInAWS(profile = 'default') {
credentials = new AWS.SharedIniFileCredentials({ profile });
return new Promise((resolve, reject) =>
credentials.refresh(err => {
if (err) {
reject(err);
}
AWS.config.credentials = credentials;
resolve();
})
);
} | [
"function",
"saveCredentialsInAWS",
"(",
"profile",
"=",
"'default'",
")",
"{",
"credentials",
"=",
"new",
"AWS",
".",
"SharedIniFileCredentials",
"(",
"{",
"profile",
"}",
")",
";",
"return",
"new",
"Promise",
"(",
"(",
"resolve",
",",
"reject",
")",
"=>",
... | Get the credentials from the ~/.aws/credentials file using the AWS_PROFILE env var to get the profile.
@param profile The AWS profile to get the credentials from. Default to 'default'
@returns {Promise} Will resolve with no parameters if it succeeds, rejects with the error if it fails (no credentials found for given profile. | [
"Get",
"the",
"credentials",
"from",
"the",
"~",
"/",
".",
"aws",
"/",
"credentials",
"file",
"using",
"the",
"AWS_PROFILE",
"env",
"var",
"to",
"get",
"the",
"profile",
"."
] | f76fa8de0818ce6bda6c7b1455942e2a9b0ae3ff | https://github.com/jhipster/generator-jhipster/blob/f76fa8de0818ce6bda6c7b1455942e2a9b0ae3ff/generators/aws-containers/aws-client.js#L196-L207 | train | Save credentials in AWS | [
30522,
3853,
3828,
16748,
16454,
26340,
3981,
9333,
1006,
6337,
1027,
1005,
12398,
1005,
1007,
1063,
22496,
1027,
2047,
22091,
2015,
1012,
4207,
5498,
8873,
2571,
16748,
16454,
26340,
1006,
1063,
6337,
1065,
1007,
1025,
2709,
2047,
4872,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
facebook/relay | packages/relay-runtime/network/ConvertToExecuteFunction.js | convertSubscribe | function convertSubscribe(fn: SubscribeFunction): ExecuteFunction {
return function subscribe(operation, variables, cacheConfig) {
return RelayObservable.fromLegacy(observer =>
fn(operation, variables, cacheConfig, observer),
);
};
} | javascript | function convertSubscribe(fn: SubscribeFunction): ExecuteFunction {
return function subscribe(operation, variables, cacheConfig) {
return RelayObservable.fromLegacy(observer =>
fn(operation, variables, cacheConfig, observer),
);
};
} | [
"function",
"convertSubscribe",
"(",
"fn",
":",
"SubscribeFunction",
")",
":",
"ExecuteFunction",
"{",
"return",
"function",
"subscribe",
"(",
"operation",
",",
"variables",
",",
"cacheConfig",
")",
"{",
"return",
"RelayObservable",
".",
"fromLegacy",
"(",
"observ... | Converts a SubscribeFunction into an ExecuteFunction for use by RelayNetwork. | [
"Converts",
"a",
"SubscribeFunction",
"into",
"an",
"ExecuteFunction",
"for",
"use",
"by",
"RelayNetwork",
"."
] | 7fb9be5182b9650637d7b92ead9a42713ac30aa4 | https://github.com/facebook/relay/blob/7fb9be5182b9650637d7b92ead9a42713ac30aa4/packages/relay-runtime/network/ConvertToExecuteFunction.js#L40-L46 | train | Convert SubscribeFunction to RelayObservable | [
30522,
3853,
19884,
12083,
29234,
1006,
1042,
2078,
1024,
4942,
29234,
11263,
27989,
1007,
1024,
15389,
11263,
27989,
1063,
2709,
3853,
4942,
29234,
1006,
3169,
1010,
10857,
1010,
17053,
8663,
8873,
2290,
1007,
1063,
2709,
8846,
16429,
8043,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/helpers/helpers.core.js | function(a0, a1) {
var i, ilen, v0, v1;
if (!a0 || !a1 || a0.length !== a1.length) {
return false;
}
for (i = 0, ilen = a0.length; i < ilen; ++i) {
v0 = a0[i];
v1 = a1[i];
if (v0 instanceof Array && v1 instanceof Array) {
if (!helpers.arrayEquals(v0, v1)) {
return false;
}
} else if (v0 !== v1) {
// NOTE: two different object instances will never be equal: {x:20} != {x:20}
return false;
}
}
return true;
} | javascript | function(a0, a1) {
var i, ilen, v0, v1;
if (!a0 || !a1 || a0.length !== a1.length) {
return false;
}
for (i = 0, ilen = a0.length; i < ilen; ++i) {
v0 = a0[i];
v1 = a1[i];
if (v0 instanceof Array && v1 instanceof Array) {
if (!helpers.arrayEquals(v0, v1)) {
return false;
}
} else if (v0 !== v1) {
// NOTE: two different object instances will never be equal: {x:20} != {x:20}
return false;
}
}
return true;
} | [
"function",
"(",
"a0",
",",
"a1",
")",
"{",
"var",
"i",
",",
"ilen",
",",
"v0",
",",
"v1",
";",
"if",
"(",
"!",
"a0",
"||",
"!",
"a1",
"||",
"a0",
".",
"length",
"!==",
"a1",
".",
"length",
")",
"{",
"return",
"false",
";",
"}",
"for",
"(",... | Returns true if the `a0` and `a1` arrays have the same content, else returns false.
@see https://stackoverflow.com/a/14853974
@param {Array} a0 - The array to compare
@param {Array} a1 - The array to compare
@returns {boolean} | [
"Returns",
"true",
"if",
"the",
"a0",
"and",
"a1",
"arrays",
"have",
"the",
"same",
"content",
"else",
"returns",
"false",
"."
] | f093c36574d290330ed623e60fbd070421c730d5 | https://github.com/chartjs/Chart.js/blob/f093c36574d290330ed623e60fbd070421c730d5/src/helpers/helpers.core.js#L143-L165 | train | Returns true if the given arrays are equal | [
30522,
3853,
1006,
1037,
2692,
1010,
17350,
1007,
1063,
13075,
1045,
1010,
17869,
2078,
1010,
1058,
2692,
1010,
1058,
2487,
1025,
2065,
1006,
999,
1037,
2692,
1064,
1064,
999,
17350,
1064,
1064,
1037,
2692,
1012,
3091,
999,
1027,
1027,
17... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
apache/incubator-echarts | src/util/graphic.js | setTextStyleCommon | function setTextStyleCommon(textStyle, textStyleModel, opt, isEmphasis) {
// Consider there will be abnormal when merge hover style to normal style if given default value.
opt = opt || EMPTY_OBJ;
if (opt.isRectText) {
var textPosition = textStyleModel.getShallow('position')
|| (isEmphasis ? null : 'inside');
// 'outside' is not a valid zr textPostion value, but used
// in bar series, and magric type should be considered.
textPosition === 'outside' && (textPosition = 'top');
textStyle.textPosition = textPosition;
textStyle.textOffset = textStyleModel.getShallow('offset');
var labelRotate = textStyleModel.getShallow('rotate');
labelRotate != null && (labelRotate *= Math.PI / 180);
textStyle.textRotation = labelRotate;
textStyle.textDistance = zrUtil.retrieve2(
textStyleModel.getShallow('distance'), isEmphasis ? null : 5
);
}
var ecModel = textStyleModel.ecModel;
var globalTextStyle = ecModel && ecModel.option.textStyle;
// Consider case:
// {
// data: [{
// value: 12,
// label: {
// rich: {
// // no 'a' here but using parent 'a'.
// }
// }
// }],
// rich: {
// a: { ... }
// }
// }
var richItemNames = getRichItemNames(textStyleModel);
var richResult;
if (richItemNames) {
richResult = {};
for (var name in richItemNames) {
if (richItemNames.hasOwnProperty(name)) {
// Cascade is supported in rich.
var richTextStyle = textStyleModel.getModel(['rich', name]);
// In rich, never `disableBox`.
// FIXME: consider `label: {formatter: '{a|xx}', color: 'blue', rich: {a: {}}}`,
// the default color `'blue'` will not be adopted if no color declared in `rich`.
// That might confuses users. So probably we should put `textStyleModel` as the
// root ancestor of the `richTextStyle`. But that would be a break change.
setTokenTextStyle(richResult[name] = {}, richTextStyle, globalTextStyle, opt, isEmphasis);
}
}
}
textStyle.rich = richResult;
setTokenTextStyle(textStyle, textStyleModel, globalTextStyle, opt, isEmphasis, true);
if (opt.forceRich && !opt.textStyle) {
opt.textStyle = {};
}
return textStyle;
} | javascript | function setTextStyleCommon(textStyle, textStyleModel, opt, isEmphasis) {
// Consider there will be abnormal when merge hover style to normal style if given default value.
opt = opt || EMPTY_OBJ;
if (opt.isRectText) {
var textPosition = textStyleModel.getShallow('position')
|| (isEmphasis ? null : 'inside');
// 'outside' is not a valid zr textPostion value, but used
// in bar series, and magric type should be considered.
textPosition === 'outside' && (textPosition = 'top');
textStyle.textPosition = textPosition;
textStyle.textOffset = textStyleModel.getShallow('offset');
var labelRotate = textStyleModel.getShallow('rotate');
labelRotate != null && (labelRotate *= Math.PI / 180);
textStyle.textRotation = labelRotate;
textStyle.textDistance = zrUtil.retrieve2(
textStyleModel.getShallow('distance'), isEmphasis ? null : 5
);
}
var ecModel = textStyleModel.ecModel;
var globalTextStyle = ecModel && ecModel.option.textStyle;
// Consider case:
// {
// data: [{
// value: 12,
// label: {
// rich: {
// // no 'a' here but using parent 'a'.
// }
// }
// }],
// rich: {
// a: { ... }
// }
// }
var richItemNames = getRichItemNames(textStyleModel);
var richResult;
if (richItemNames) {
richResult = {};
for (var name in richItemNames) {
if (richItemNames.hasOwnProperty(name)) {
// Cascade is supported in rich.
var richTextStyle = textStyleModel.getModel(['rich', name]);
// In rich, never `disableBox`.
// FIXME: consider `label: {formatter: '{a|xx}', color: 'blue', rich: {a: {}}}`,
// the default color `'blue'` will not be adopted if no color declared in `rich`.
// That might confuses users. So probably we should put `textStyleModel` as the
// root ancestor of the `richTextStyle`. But that would be a break change.
setTokenTextStyle(richResult[name] = {}, richTextStyle, globalTextStyle, opt, isEmphasis);
}
}
}
textStyle.rich = richResult;
setTokenTextStyle(textStyle, textStyleModel, globalTextStyle, opt, isEmphasis, true);
if (opt.forceRich && !opt.textStyle) {
opt.textStyle = {};
}
return textStyle;
} | [
"function",
"setTextStyleCommon",
"(",
"textStyle",
",",
"textStyleModel",
",",
"opt",
",",
"isEmphasis",
")",
"{",
"// Consider there will be abnormal when merge hover style to normal style if given default value.",
"opt",
"=",
"opt",
"||",
"EMPTY_OBJ",
";",
"if",
"(",
"op... | The uniform entry of set text style, that is, retrieve style definitions
from `model` and set to `textStyle` object.
Never in merge mode, but in overwrite mode, that is, all of the text style
properties will be set. (Consider the states of normal and emphasis and
default value can be adopted, merge would make the logic too complicated
to manage.)
The `textStyle` object can either be a plain object or an instance of
`zrender/src/graphic/Style`, and either be the style of normal or emphasis.
After this mothod called, the `textStyle` object can then be used in
`el.setStyle(textStyle)` or `el.hoverStyle = textStyle`.
Default value will be adopted and `insideRollbackOpt` will be created.
See `applyDefaultTextStyle` `rollbackDefaultTextStyle` for more details.
opt: {
disableBox: boolean, Whether diable drawing box of block (outer most).
isRectText: boolean,
autoColor: string, specify a color when color is 'auto',
for textFill, textStroke, textBackgroundColor, and textBorderColor.
If autoColor specified, it is used as default textFill.
useInsideStyle:
`true`: Use inside style (textFill, textStroke, textStrokeWidth)
if `textFill` is not specified.
`false`: Do not use inside style.
`null/undefined`: use inside style if `isRectText` is true and
`textFill` is not specified and textPosition contains `'inside'`.
forceRich: boolean
} | [
"The",
"uniform",
"entry",
"of",
"set",
"text",
"style",
"that",
"is",
"retrieve",
"style",
"definitions",
"from",
"model",
"and",
"set",
"to",
"textStyle",
"object",
"."
] | 4d0ea095dc3929cb6de40c45748826e7999c7aa8 | https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/util/graphic.js#L735-L798 | train | Set text style common to all items | [
30522,
3853,
2275,
18209,
21756,
2571,
9006,
8202,
1006,
6981,
27983,
1010,
6981,
27983,
5302,
9247,
1010,
23569,
1010,
2003,
6633,
21890,
6190,
1007,
1063,
1013,
1013,
5136,
2045,
2097,
2022,
19470,
2043,
13590,
25215,
2099,
2806,
2000,
36... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
vuejs/vue-devtools | src/backend/highlighter.js | showOverlay | function showOverlay ({ width = 0, height = 0, top = 0, left = 0 }, content = []) {
if (!isBrowser) return
overlay.style.width = ~~width + 'px'
overlay.style.height = ~~height + 'px'
overlay.style.top = ~~top + 'px'
overlay.style.left = ~~left + 'px'
overlayContent.innerHTML = ''
content.forEach(child => overlayContent.appendChild(child))
document.body.appendChild(overlay)
} | javascript | function showOverlay ({ width = 0, height = 0, top = 0, left = 0 }, content = []) {
if (!isBrowser) return
overlay.style.width = ~~width + 'px'
overlay.style.height = ~~height + 'px'
overlay.style.top = ~~top + 'px'
overlay.style.left = ~~left + 'px'
overlayContent.innerHTML = ''
content.forEach(child => overlayContent.appendChild(child))
document.body.appendChild(overlay)
} | [
"function",
"showOverlay",
"(",
"{",
"width",
"=",
"0",
",",
"height",
"=",
"0",
",",
"top",
"=",
"0",
",",
"left",
"=",
"0",
"}",
",",
"content",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"isBrowser",
")",
"return",
"overlay",
".",
"style",
"."... | Display the overlay with given rect.
@param {Rect} | [
"Display",
"the",
"overlay",
"with",
"given",
"rect",
"."
] | 4de4b86388453cd07f0c1bf967d43a4dd4b011c9 | https://github.com/vuejs/vue-devtools/blob/4de4b86388453cd07f0c1bf967d43a4dd4b011c9/src/backend/highlighter.js#L160-L172 | train | Show an overlay | [
30522,
3853,
2265,
7840,
8485,
1006,
1063,
9381,
1027,
1014,
1010,
4578,
1027,
1014,
1010,
2327,
1027,
1014,
1010,
2187,
1027,
1014,
1065,
1010,
4180,
1027,
1031,
1033,
1007,
1063,
2065,
1006,
999,
2003,
12618,
9333,
2121,
1007,
2709,
205... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
thomaspark/bootswatch | docs/_vendor/popper.js/dist/popper.js | getRoundedOffsets | function getRoundedOffsets(data, shouldRound) {
const { popper, reference } = data.offsets;
const { round, floor } = Math;
const noRound = v => v;
const referenceWidth = round(reference.width);
const popperWidth = round(popper.width);
const isVertical = ['left', 'right'].indexOf(data.placement) !== -1;
const isVariation = data.placement.indexOf('-') !== -1;
const sameWidthParity = referenceWidth % 2 === popperWidth % 2;
const bothOddWidth = referenceWidth % 2 === 1 && popperWidth % 2 === 1;
const horizontalToInteger = !shouldRound ? noRound : isVertical || isVariation || sameWidthParity ? round : floor;
const verticalToInteger = !shouldRound ? noRound : round;
return {
left: horizontalToInteger(bothOddWidth && !isVariation && shouldRound ? popper.left - 1 : popper.left),
top: verticalToInteger(popper.top),
bottom: verticalToInteger(popper.bottom),
right: horizontalToInteger(popper.right)
};
} | javascript | function getRoundedOffsets(data, shouldRound) {
const { popper, reference } = data.offsets;
const { round, floor } = Math;
const noRound = v => v;
const referenceWidth = round(reference.width);
const popperWidth = round(popper.width);
const isVertical = ['left', 'right'].indexOf(data.placement) !== -1;
const isVariation = data.placement.indexOf('-') !== -1;
const sameWidthParity = referenceWidth % 2 === popperWidth % 2;
const bothOddWidth = referenceWidth % 2 === 1 && popperWidth % 2 === 1;
const horizontalToInteger = !shouldRound ? noRound : isVertical || isVariation || sameWidthParity ? round : floor;
const verticalToInteger = !shouldRound ? noRound : round;
return {
left: horizontalToInteger(bothOddWidth && !isVariation && shouldRound ? popper.left - 1 : popper.left),
top: verticalToInteger(popper.top),
bottom: verticalToInteger(popper.bottom),
right: horizontalToInteger(popper.right)
};
} | [
"function",
"getRoundedOffsets",
"(",
"data",
",",
"shouldRound",
")",
"{",
"const",
"{",
"popper",
",",
"reference",
"}",
"=",
"data",
".",
"offsets",
";",
"const",
"{",
"round",
",",
"floor",
"}",
"=",
"Math",
";",
"const",
"noRound",
"=",
"v",
"=>",... | @function
@memberof Popper.Utils
@argument {Object} data - The data object generated by `update` method
@argument {Boolean} shouldRound - If the offsets should be rounded at all
@returns {Object} The popper's position offsets rounded
The tale of pixel-perfect positioning. It's still not 100% perfect, but as
good as it can be within reason.
Discussion here: https://github.com/FezVrasta/popper.js/pull/715
Low DPI screens cause a popper to be blurry if not using full pixels (Safari
as well on High DPI screens).
Firefox prefers no rounding for positioning and does not have blurriness on
high DPI screens.
Only horizontal placement and left/right values need to be considered. | [
"@function",
"@memberof",
"Popper",
".",
"Utils",
"@argument",
"{",
"Object",
"}",
"data",
"-",
"The",
"data",
"object",
"generated",
"by",
"update",
"method",
"@argument",
"{",
"Boolean",
"}",
"shouldRound",
"-",
"If",
"the",
"offsets",
"should",
"be",
"rou... | a913e4992dad8f7bf38df2e1d3f4cc6bfe5f26dd | https://github.com/thomaspark/bootswatch/blob/a913e4992dad8f7bf38df2e1d3f4cc6bfe5f26dd/docs/_vendor/popper.js/dist/popper.js#L1139-L1161 | train | Get the rounded offsets | [
30522,
3853,
2131,
22494,
25848,
27475,
8454,
1006,
2951,
1010,
2323,
22494,
4859,
1007,
1063,
9530,
3367,
1063,
3769,
4842,
1010,
4431,
1065,
1027,
2951,
1012,
16396,
2015,
1025,
9530,
3367,
1063,
2461,
1010,
2723,
1065,
1027,
8785,
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... |
uber/deck.gl | modules/layers/src/solid-polygon-layer/polygon.js | copyNestedRing | function copyNestedRing(target, targetStartIndex, simplePolygon, size) {
let targetIndex = targetStartIndex;
const len = simplePolygon.length;
for (let i = 0; i < len; i++) {
for (let j = 0; j < size; j++) {
target[targetIndex++] = simplePolygon[i][j] || 0;
}
}
if (!isNestedRingClosed(simplePolygon)) {
for (let j = 0; j < size; j++) {
target[targetIndex++] = simplePolygon[0][j] || 0;
}
}
return targetIndex;
} | javascript | function copyNestedRing(target, targetStartIndex, simplePolygon, size) {
let targetIndex = targetStartIndex;
const len = simplePolygon.length;
for (let i = 0; i < len; i++) {
for (let j = 0; j < size; j++) {
target[targetIndex++] = simplePolygon[i][j] || 0;
}
}
if (!isNestedRingClosed(simplePolygon)) {
for (let j = 0; j < size; j++) {
target[targetIndex++] = simplePolygon[0][j] || 0;
}
}
return targetIndex;
} | [
"function",
"copyNestedRing",
"(",
"target",
",",
"targetStartIndex",
",",
"simplePolygon",
",",
"size",
")",
"{",
"let",
"targetIndex",
"=",
"targetStartIndex",
";",
"const",
"len",
"=",
"simplePolygon",
".",
"length",
";",
"for",
"(",
"let",
"i",
"=",
"0",... | Copy a simple polygon coordinates into a flat array, closes the ring if needed.
@param {Float64Array} target - destination
@param {Number} targetStartIndex - index in the destination to start copying into
@param {Array} simplePolygon - array of points
@param {Number} size - size of a position, 2 (xy) or 3 (xyz)
@returns {Number} - the index of the write head in the destination | [
"Copy",
"a",
"simple",
"polygon",
"coordinates",
"into",
"a",
"flat",
"array",
"closes",
"the",
"ring",
"if",
"needed",
"."
] | a2010448b7f268bbd03617b812334c68a6b9e5b2 | https://github.com/uber/deck.gl/blob/a2010448b7f268bbd03617b812334c68a6b9e5b2/modules/layers/src/solid-polygon-layer/polygon.js#L90-L105 | train | Copy a simple polygon into a target array | [
30522,
3853,
6100,
5267,
3064,
4892,
1006,
4539,
1010,
7889,
7559,
7629,
3207,
2595,
1010,
3722,
18155,
2100,
7446,
1010,
2946,
1007,
1063,
2292,
4539,
22254,
10288,
1027,
7889,
7559,
7629,
3207,
2595,
1025,
9530,
3367,
18798,
1027,
3722,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
eslint/eslint | lib/rules/generator-star-spacing.js | checkFunction | function checkFunction(node) {
if (!node.generator) {
return;
}
const starToken = getStarToken(node);
const prevToken = sourceCode.getTokenBefore(starToken);
const nextToken = sourceCode.getTokenAfter(starToken);
let kind = "named";
if (node.parent.type === "MethodDefinition" || (node.parent.type === "Property" && node.parent.method)) {
kind = "method";
} else if (!node.id) {
kind = "anonymous";
}
// Only check before when preceded by `function`|`static` keyword
if (!(kind === "method" && starToken === sourceCode.getFirstToken(node.parent))) {
checkSpacing(kind, "before", prevToken, starToken);
}
checkSpacing(kind, "after", starToken, nextToken);
} | javascript | function checkFunction(node) {
if (!node.generator) {
return;
}
const starToken = getStarToken(node);
const prevToken = sourceCode.getTokenBefore(starToken);
const nextToken = sourceCode.getTokenAfter(starToken);
let kind = "named";
if (node.parent.type === "MethodDefinition" || (node.parent.type === "Property" && node.parent.method)) {
kind = "method";
} else if (!node.id) {
kind = "anonymous";
}
// Only check before when preceded by `function`|`static` keyword
if (!(kind === "method" && starToken === sourceCode.getFirstToken(node.parent))) {
checkSpacing(kind, "before", prevToken, starToken);
}
checkSpacing(kind, "after", starToken, nextToken);
} | [
"function",
"checkFunction",
"(",
"node",
")",
"{",
"if",
"(",
"!",
"node",
".",
"generator",
")",
"{",
"return",
";",
"}",
"const",
"starToken",
"=",
"getStarToken",
"(",
"node",
")",
";",
"const",
"prevToken",
"=",
"sourceCode",
".",
"getTokenBefore",
... | Enforces the spacing around the star if node is a generator function.
@param {ASTNode} node A function expression or declaration node.
@returns {void} | [
"Enforces",
"the",
"spacing",
"around",
"the",
"star",
"if",
"node",
"is",
"a",
"generator",
"function",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/generator-star-spacing.js#L180-L203 | train | Check if a function is a function | [
30522,
3853,
4638,
11263,
27989,
1006,
13045,
1007,
1063,
2065,
1006,
999,
13045,
1012,
13103,
1007,
1063,
2709,
1025,
1065,
9530,
3367,
2707,
11045,
2078,
1027,
4152,
7559,
18715,
2368,
1006,
13045,
1007,
1025,
9530,
3367,
3653,
2615,
1871... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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(element) {
var textLength = this._getInnerText(element).length;
if (textLength === 0)
return 0;
var linkLength = 0;
// XXX implement _reduceNodeList?
this._forEachNode(element.getElementsByTagName("a"), function(linkNode) {
linkLength += this._getInnerText(linkNode).length;
});
return linkLength / textLength;
} | javascript | function(element) {
var textLength = this._getInnerText(element).length;
if (textLength === 0)
return 0;
var linkLength = 0;
// XXX implement _reduceNodeList?
this._forEachNode(element.getElementsByTagName("a"), function(linkNode) {
linkLength += this._getInnerText(linkNode).length;
});
return linkLength / textLength;
} | [
"function",
"(",
"element",
")",
"{",
"var",
"textLength",
"=",
"this",
".",
"_getInnerText",
"(",
"element",
")",
".",
"length",
";",
"if",
"(",
"textLength",
"===",
"0",
")",
"return",
"0",
";",
"var",
"linkLength",
"=",
"0",
";",
"// XXX implement _re... | Get the density of links as a percentage of the content
This is the amount of text that is inside a link divided by the total text in the node.
@param Element
@return number (float) | [
"Get",
"the",
"density",
"of",
"links",
"as",
"a",
"percentage",
"of",
"the",
"content",
"This",
"is",
"the",
"amount",
"of",
"text",
"that",
"is",
"inside",
"a",
"link",
"divided",
"by",
"the",
"total",
"text",
"in",
"the",
"node",
"."
] | beb428b246cecba4630a3ca57b472f43c0933a43 | https://github.com/laurent22/joplin/blob/beb428b246cecba4630a3ca57b472f43c0933a43/Clipper/joplin-webclipper/content_scripts/Readability.js#L1396-L1409 | train | Calculate link length | [
30522,
3853,
1006,
5783,
1007,
1063,
13075,
3793,
7770,
13512,
2232,
1027,
2023,
1012,
1035,
2131,
23111,
8743,
10288,
2102,
1006,
5783,
1007,
1012,
3091,
1025,
2065,
1006,
3793,
7770,
13512,
2232,
1027,
1027,
1027,
1014,
1007,
2709,
1014,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | mxGraphView | function mxGraphView(graph)
{
this.graph = graph;
this.translate = new mxPoint();
this.graphBounds = new mxRectangle();
this.states = new mxDictionary();
} | javascript | function mxGraphView(graph)
{
this.graph = graph;
this.translate = new mxPoint();
this.graphBounds = new mxRectangle();
this.states = new mxDictionary();
} | [
"function",
"mxGraphView",
"(",
"graph",
")",
"{",
"this",
".",
"graph",
"=",
"graph",
";",
"this",
".",
"translate",
"=",
"new",
"mxPoint",
"(",
")",
";",
"this",
".",
"graphBounds",
"=",
"new",
"mxRectangle",
"(",
")",
";",
"this",
".",
"states",
"... | Copyright (c) 2006-2015, JGraph Ltd
Copyright (c) 2006-2015, Gaudenz Alder
Class: mxGraphView
Extends <mxEventSource> to implement a view for a graph. This class is in
charge of computing the absolute coordinates for the relative child
geometries, the points for perimeters and edge styles and keeping them
cached in <mxCellStates> for faster retrieval. The states are updated
whenever the model or the view state (translate, scale) changes. The scale
and translate are honoured in the bounds.
Event: mxEvent.UNDO
Fires after the root was changed in <setCurrentRoot>. The <code>edit</code>
property contains the <mxUndoableEdit> which contains the
<mxCurrentRootChange>.
Event: mxEvent.SCALE_AND_TRANSLATE
Fires after the scale and translate have been changed in <scaleAndTranslate>.
The <code>scale</code>, <code>previousScale</code>, <code>translate</code>
and <code>previousTranslate</code> properties contain the new and previous
scale and translate, respectively.
Event: mxEvent.SCALE
Fires after the scale was changed in <setScale>. The <code>scale</code> and
<code>previousScale</code> properties contain the new and previous scale.
Event: mxEvent.TRANSLATE
Fires after the translate was changed in <setTranslate>. The
<code>translate</code> and <code>previousTranslate</code> properties contain
the new and previous value for translate.
Event: mxEvent.DOWN and mxEvent.UP
Fire if the current root is changed by executing an <mxCurrentRootChange>.
The event name depends on the location of the root in the cell hierarchy
with respect to the current root. The <code>root</code> and
<code>previous</code> properties contain the new and previous root,
respectively.
Constructor: mxGraphView
Constructs a new view for the given <mxGraph>.
Parameters:
graph - Reference to the enclosing <mxGraph>. | [
"Copyright",
"(",
"c",
")",
"2006",
"-",
"2015",
"JGraph",
"Ltd",
"Copyright",
"(",
"c",
")",
"2006",
"-",
"2015",
"Gaudenz",
"Alder",
"Class",
":",
"mxGraphView"
] | 33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44 | https://github.com/jgraph/mxgraph/blob/33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44/javascript/mxClient.js#L51117-L51123 | train | This is the base class for all graph views | [
30522,
3853,
25630,
14413,
8584,
1006,
10629,
1007,
1063,
2023,
1012,
10629,
1027,
10629,
1025,
2023,
1012,
17637,
1027,
2047,
25630,
8400,
1006,
1007,
1025,
2023,
1012,
10629,
15494,
2015,
1027,
2047,
25630,
2890,
25572,
3070,
2571,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/extensions/default/QuickView/main.js | showPreview | function showPreview(editor, popover) {
var token, cm;
// Figure out which editor we are over
if (!editor) {
editor = getHoveredEditor(lastMousePos);
}
if (!editor || !editor._codeMirror) {
hidePreview();
return;
}
cm = editor._codeMirror;
// Find char mouse is over
var pos = cm.coordsChar({left: lastMousePos.clientX, top: lastMousePos.clientY});
// No preview if mouse is past last char on line
if (pos.ch >= editor.document.getLine(pos.line).length) {
return;
}
if (popover) {
popoverState = popover;
} else {
// Query providers and append to popoverState
token = TokenUtils.getTokenAt(cm, pos);
popoverState = $.extend({}, popoverState, queryPreviewProviders(editor, pos, token));
}
if (popoverState && popoverState.start && popoverState.end) {
popoverState.marker = cm.markText(
popoverState.start,
popoverState.end,
{className: "quick-view-highlight"}
);
$previewContent.append(popoverState.content);
$previewContainer.show();
popoverState.visible = true;
if (popoverState.onShow) {
popoverState.onShow();
} else {
positionPreview(editor, popoverState.xpos, popoverState.ytop, popoverState.ybot);
}
}
} | javascript | function showPreview(editor, popover) {
var token, cm;
// Figure out which editor we are over
if (!editor) {
editor = getHoveredEditor(lastMousePos);
}
if (!editor || !editor._codeMirror) {
hidePreview();
return;
}
cm = editor._codeMirror;
// Find char mouse is over
var pos = cm.coordsChar({left: lastMousePos.clientX, top: lastMousePos.clientY});
// No preview if mouse is past last char on line
if (pos.ch >= editor.document.getLine(pos.line).length) {
return;
}
if (popover) {
popoverState = popover;
} else {
// Query providers and append to popoverState
token = TokenUtils.getTokenAt(cm, pos);
popoverState = $.extend({}, popoverState, queryPreviewProviders(editor, pos, token));
}
if (popoverState && popoverState.start && popoverState.end) {
popoverState.marker = cm.markText(
popoverState.start,
popoverState.end,
{className: "quick-view-highlight"}
);
$previewContent.append(popoverState.content);
$previewContainer.show();
popoverState.visible = true;
if (popoverState.onShow) {
popoverState.onShow();
} else {
positionPreview(editor, popoverState.xpos, popoverState.ytop, popoverState.ybot);
}
}
} | [
"function",
"showPreview",
"(",
"editor",
",",
"popover",
")",
"{",
"var",
"token",
",",
"cm",
";",
"// Figure out which editor we are over",
"if",
"(",
"!",
"editor",
")",
"{",
"editor",
"=",
"getHoveredEditor",
"(",
"lastMousePos",
")",
";",
"}",
"if",
"("... | Changes the current hidden popoverState to visible, showing it in the UI and highlighting
its matching text in the editor. | [
"Changes",
"the",
"current",
"hidden",
"popoverState",
"to",
"visible",
"showing",
"it",
"in",
"the",
"UI",
"and",
"highlighting",
"its",
"matching",
"text",
"in",
"the",
"editor",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/QuickView/main.js#L616-L665 | train | Show preview of the last char | [
30522,
3853,
2265,
28139,
8584,
1006,
3559,
1010,
3769,
7840,
1007,
1063,
13075,
19204,
1010,
4642,
1025,
1013,
1013,
3275,
2041,
2029,
3559,
2057,
2024,
2058,
2065,
1006,
999,
3559,
1007,
1063,
3559,
1027,
2131,
6806,
25896,
2098,
15660,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/util/animation/animate.js | currentBounds | function currentBounds() {
var cntr = element ? element.parent() : null;
var parent = cntr ? cntr.parent() : null;
return parent ? self.clientRect(parent) : null;
} | javascript | function currentBounds() {
var cntr = element ? element.parent() : null;
var parent = cntr ? cntr.parent() : null;
return parent ? self.clientRect(parent) : null;
} | [
"function",
"currentBounds",
"(",
")",
"{",
"var",
"cntr",
"=",
"element",
"?",
"element",
".",
"parent",
"(",
")",
":",
"null",
";",
"var",
"parent",
"=",
"cntr",
"?",
"cntr",
".",
"parent",
"(",
")",
":",
"null",
";",
"return",
"parent",
"?",
"se... | This is a fallback if the origin information is no longer valid, then the
origin bounds simply becomes the current bounds for the dialogContainer's parent | [
"This",
"is",
"a",
"fallback",
"if",
"the",
"origin",
"information",
"is",
"no",
"longer",
"valid",
"then",
"the",
"origin",
"bounds",
"simply",
"becomes",
"the",
"current",
"bounds",
"for",
"the",
"dialogContainer",
"s",
"parent"
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/util/animation/animate.js#L126-L131 | train | Get current bounds of the current element | [
30522,
3853,
2783,
15494,
2015,
1006,
1007,
1063,
13075,
27166,
16344,
1027,
5783,
1029,
5783,
1012,
6687,
1006,
1007,
1024,
19701,
1025,
13075,
6687,
1027,
27166,
16344,
1029,
27166,
16344,
1012,
6687,
1006,
1007,
1024,
19701,
1025,
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/preferences/PreferencesBase.js | function (data) {
if (this._changeEventQueue) {
this._changeEventQueue = _.union(this._changeEventQueue, data.ids);
} else {
this.trigger(PREFERENCE_CHANGE, data);
}
} | javascript | function (data) {
if (this._changeEventQueue) {
this._changeEventQueue = _.union(this._changeEventQueue, data.ids);
} else {
this.trigger(PREFERENCE_CHANGE, data);
}
} | [
"function",
"(",
"data",
")",
"{",
"if",
"(",
"this",
".",
"_changeEventQueue",
")",
"{",
"this",
".",
"_changeEventQueue",
"=",
"_",
".",
"union",
"(",
"this",
".",
"_changeEventQueue",
",",
"data",
".",
"ids",
")",
";",
"}",
"else",
"{",
"this",
".... | @private
Sends a change event to listeners. If change events have been paused (see
pauseChangeEvents) then the IDs are queued up.
@param {{ids: Array.<string>}} data Message to send | [
"@private"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/preferences/PreferencesBase.js#L1885-L1891 | train | trigger preference change event | [
30522,
3853,
1006,
2951,
1007,
1063,
2065,
1006,
2023,
1012,
1035,
2689,
18697,
3372,
4226,
5657,
1007,
1063,
2023,
1012,
1035,
2689,
18697,
3372,
4226,
5657,
1027,
1035,
1012,
2586,
1006,
2023,
1012,
1035,
2689,
18697,
3372,
4226,
5657,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
adobe/brackets | src/file/FileUtils.js | convertToNativePath | function convertToNativePath(path) {
path = unescape(path);
if (path.indexOf(":") !== -1 && path[0] === "/") {
return path.substr(1);
}
return path;
} | javascript | function convertToNativePath(path) {
path = unescape(path);
if (path.indexOf(":") !== -1 && path[0] === "/") {
return path.substr(1);
}
return path;
} | [
"function",
"convertToNativePath",
"(",
"path",
")",
"{",
"path",
"=",
"unescape",
"(",
"path",
")",
";",
"if",
"(",
"path",
".",
"indexOf",
"(",
"\":\"",
")",
"!==",
"-",
"1",
"&&",
"path",
"[",
"0",
"]",
"===",
"\"/\"",
")",
"{",
"return",
"path"... | Convert a URI path to a native path.
On both platforms, this unescapes the URI
On windows, URI paths start with a "/", but have a drive letter ("C:"). In this
case, remove the initial "/".
@param {!string} path
@return {string} | [
"Convert",
"a",
"URI",
"path",
"to",
"a",
"native",
"path",
".",
"On",
"both",
"platforms",
"this",
"unescapes",
"the",
"URI",
"On",
"windows",
"URI",
"paths",
"start",
"with",
"a",
"/",
"but",
"have",
"a",
"drive",
"letter",
"(",
"C",
":",
")",
".",... | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/file/FileUtils.js#L240-L247 | train | Converts a path to a native path | [
30522,
3853,
10463,
2669,
8082,
15069,
1006,
4130,
1007,
1063,
4130,
1027,
16655,
15782,
5051,
1006,
4130,
1007,
1025,
2065,
1006,
4130,
1012,
5950,
11253,
1006,
1000,
1024,
1000,
1007,
999,
1027,
1027,
1011,
1015,
1004,
1004,
4130,
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... |
GeekyAnts/vue-native-core | dist/vue.common.js | shouldDecode | function shouldDecode (content, encoded) {
var div = document.createElement('div');
div.innerHTML = "<div a=\"" + content + "\">";
return div.innerHTML.indexOf(encoded) > 0
} | javascript | function shouldDecode (content, encoded) {
var div = document.createElement('div');
div.innerHTML = "<div a=\"" + content + "\">";
return div.innerHTML.indexOf(encoded) > 0
} | [
"function",
"shouldDecode",
"(",
"content",
",",
"encoded",
")",
"{",
"var",
"div",
"=",
"document",
".",
"createElement",
"(",
"'div'",
")",
";",
"div",
".",
"innerHTML",
"=",
"\"<div a=\\\"\"",
"+",
"content",
"+",
"\"\\\">\"",
";",
"return",
"div",
".",... | /* check whether current browser encodes a char inside attribute values | [
"/",
"*",
"check",
"whether",
"current",
"browser",
"encodes",
"a",
"char",
"inside",
"attribute",
"values"
] | a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e | https://github.com/GeekyAnts/vue-native-core/blob/a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e/dist/vue.common.js#L7116-L7120 | train | Check if content should be decoded | [
30522,
3853,
2323,
3207,
16044,
1006,
4180,
1010,
12359,
1007,
1063,
13075,
4487,
2615,
1027,
6254,
1012,
3443,
12260,
3672,
1006,
1005,
4487,
2615,
1005,
1007,
1025,
4487,
2615,
1012,
5110,
11039,
19968,
1027,
1000,
1026,
4487,
2615,
1037,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SheetJS/js-xlsx | xlsx.js | write_ws_bin_cell | function write_ws_bin_cell(ba, cell, R, C, opts, ws) {
if(cell.v === undefined) return "";
var vv = "";
switch(cell.t) {
case 'b': vv = cell.v ? "1" : "0"; break;
case 'd': // no BrtCellDate :(
cell = dup(cell);
cell.z = cell.z || SSF._table[14];
cell.v = datenum(parseDate(cell.v)); cell.t = 'n';
break;
/* falls through */
case 'n': case 'e': vv = ''+cell.v; break;
default: vv = cell.v; break;
}
var o = ({r:R, c:C});
/* TODO: cell style */
o.s = get_cell_style(opts.cellXfs, cell, opts);
if(cell.l) ws['!links'].push([encode_cell(o), cell.l]);
if(cell.c) ws['!comments'].push([encode_cell(o), cell.c]);
switch(cell.t) {
case 's': case 'str':
if(opts.bookSST) {
vv = get_sst_id(opts.Strings, (cell.v), opts.revStrings);
o.t = "s"; o.v = vv;
write_record(ba, "BrtCellIsst", write_BrtCellIsst(cell, o));
} else {
o.t = "str";
write_record(ba, "BrtCellSt", write_BrtCellSt(cell, o));
}
return;
case 'n':
/* TODO: determine threshold for Real vs RK */
if(cell.v == (cell.v | 0) && cell.v > -1000 && cell.v < 1000) write_record(ba, "BrtCellRk", write_BrtCellRk(cell, o));
else write_record(ba, "BrtCellReal", write_BrtCellReal(cell, o));
return;
case 'b':
o.t = "b";
write_record(ba, "BrtCellBool", write_BrtCellBool(cell, o));
return;
case 'e': /* TODO: error */ o.t = "e"; break;
}
write_record(ba, "BrtCellBlank", write_BrtCellBlank(cell, o));
} | javascript | function write_ws_bin_cell(ba, cell, R, C, opts, ws) {
if(cell.v === undefined) return "";
var vv = "";
switch(cell.t) {
case 'b': vv = cell.v ? "1" : "0"; break;
case 'd': // no BrtCellDate :(
cell = dup(cell);
cell.z = cell.z || SSF._table[14];
cell.v = datenum(parseDate(cell.v)); cell.t = 'n';
break;
/* falls through */
case 'n': case 'e': vv = ''+cell.v; break;
default: vv = cell.v; break;
}
var o = ({r:R, c:C});
/* TODO: cell style */
o.s = get_cell_style(opts.cellXfs, cell, opts);
if(cell.l) ws['!links'].push([encode_cell(o), cell.l]);
if(cell.c) ws['!comments'].push([encode_cell(o), cell.c]);
switch(cell.t) {
case 's': case 'str':
if(opts.bookSST) {
vv = get_sst_id(opts.Strings, (cell.v), opts.revStrings);
o.t = "s"; o.v = vv;
write_record(ba, "BrtCellIsst", write_BrtCellIsst(cell, o));
} else {
o.t = "str";
write_record(ba, "BrtCellSt", write_BrtCellSt(cell, o));
}
return;
case 'n':
/* TODO: determine threshold for Real vs RK */
if(cell.v == (cell.v | 0) && cell.v > -1000 && cell.v < 1000) write_record(ba, "BrtCellRk", write_BrtCellRk(cell, o));
else write_record(ba, "BrtCellReal", write_BrtCellReal(cell, o));
return;
case 'b':
o.t = "b";
write_record(ba, "BrtCellBool", write_BrtCellBool(cell, o));
return;
case 'e': /* TODO: error */ o.t = "e"; break;
}
write_record(ba, "BrtCellBlank", write_BrtCellBlank(cell, o));
} | [
"function",
"write_ws_bin_cell",
"(",
"ba",
",",
"cell",
",",
"R",
",",
"C",
",",
"opts",
",",
"ws",
")",
"{",
"if",
"(",
"cell",
".",
"v",
"===",
"undefined",
")",
"return",
"\"\"",
";",
"var",
"vv",
"=",
"\"\"",
";",
"switch",
"(",
"cell",
".",... | /* TODO: something useful -- this is a stub | [
"/",
"*",
"TODO",
":",
"something",
"useful",
"--",
"this",
"is",
"a",
"stub"
] | 9a6d8a1d3d80c78dad5201fb389316f935279cdc | https://github.com/SheetJS/js-xlsx/blob/9a6d8a1d3d80c78dad5201fb389316f935279cdc/xlsx.js#L14046-L14088 | train | write cell to binary stream | [
30522,
3853,
4339,
1035,
1059,
2015,
1035,
8026,
1035,
3526,
1006,
8670,
1010,
3526,
1010,
1054,
1010,
1039,
1010,
23569,
2015,
1010,
1059,
2015,
1007,
1063,
2065,
1006,
3526,
1012,
1058,
1027,
1027,
1027,
6151,
28344,
1007,
2709,
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/JavaScriptRefactoring/ExtractToVariable.js | extract | function extract(scopes, parentStatement, expns, text, insertPosition) {
var varType = "var",
varName = RefactoringUtils.getUniqueIdentifierName(scopes, "extracted"),
varDeclaration = varType + " " + varName + " = " + text + ";\n",
parentStatementStartPos = session.editor.posFromIndex(parentStatement.start),
insertStartPos = insertPosition || parentStatementStartPos,
selections = [],
doc = session.editor.document,
replaceExpnIndex = 0,
posToIndent,
edits = [];
// If parent statement is expression statement, then just append var declaration
// Ex: "add(1, 2)" will become "var extracted = add(1, 2)"
if (parentStatement.type === "ExpressionStatement" &&
RefactoringUtils.isEqual(parentStatement.expression, expns[0]) &&
insertStartPos.line === parentStatementStartPos.line &&
insertStartPos.ch === parentStatementStartPos.ch) {
varDeclaration = varType + " " + varName + " = ";
replaceExpnIndex = 1;
}
posToIndent = doc.adjustPosForChange(insertStartPos, varDeclaration.split("\n"), insertStartPos, insertStartPos);
// adjust pos for change
for (var i = replaceExpnIndex; i < expns.length; ++i) {
expns[i].start = session.editor.posFromIndex(expns[i].start);
expns[i].end = session.editor.posFromIndex(expns[i].end);
expns[i].start = doc.adjustPosForChange(expns[i].start, varDeclaration.split("\n"), insertStartPos, insertStartPos);
expns[i].end = doc.adjustPosForChange(expns[i].end, varDeclaration.split("\n"), insertStartPos, insertStartPos);
edits.push({
edit: {
text: varName,
start: expns[i].start,
end: expns[i].end
},
selection: {
start: expns[i].start,
end: {line: expns[i].start.line, ch: expns[i].start.ch + varName.length}
}
});
}
// Replace and multi-select
doc.batchOperation(function() {
doc.replaceRange(varDeclaration, insertStartPos);
selections = doc.doMultipleEdits(edits);
selections.push({
start: {line: insertStartPos.line, ch: insertStartPos.ch + varType.length + 1},
end: {line: insertStartPos.line, ch: insertStartPos.ch + varType.length + varName.length + 1},
primary: true
});
session.editor.setSelections(selections);
session.editor._codeMirror.indentLine(posToIndent.line, "smart");
});
} | javascript | function extract(scopes, parentStatement, expns, text, insertPosition) {
var varType = "var",
varName = RefactoringUtils.getUniqueIdentifierName(scopes, "extracted"),
varDeclaration = varType + " " + varName + " = " + text + ";\n",
parentStatementStartPos = session.editor.posFromIndex(parentStatement.start),
insertStartPos = insertPosition || parentStatementStartPos,
selections = [],
doc = session.editor.document,
replaceExpnIndex = 0,
posToIndent,
edits = [];
// If parent statement is expression statement, then just append var declaration
// Ex: "add(1, 2)" will become "var extracted = add(1, 2)"
if (parentStatement.type === "ExpressionStatement" &&
RefactoringUtils.isEqual(parentStatement.expression, expns[0]) &&
insertStartPos.line === parentStatementStartPos.line &&
insertStartPos.ch === parentStatementStartPos.ch) {
varDeclaration = varType + " " + varName + " = ";
replaceExpnIndex = 1;
}
posToIndent = doc.adjustPosForChange(insertStartPos, varDeclaration.split("\n"), insertStartPos, insertStartPos);
// adjust pos for change
for (var i = replaceExpnIndex; i < expns.length; ++i) {
expns[i].start = session.editor.posFromIndex(expns[i].start);
expns[i].end = session.editor.posFromIndex(expns[i].end);
expns[i].start = doc.adjustPosForChange(expns[i].start, varDeclaration.split("\n"), insertStartPos, insertStartPos);
expns[i].end = doc.adjustPosForChange(expns[i].end, varDeclaration.split("\n"), insertStartPos, insertStartPos);
edits.push({
edit: {
text: varName,
start: expns[i].start,
end: expns[i].end
},
selection: {
start: expns[i].start,
end: {line: expns[i].start.line, ch: expns[i].start.ch + varName.length}
}
});
}
// Replace and multi-select
doc.batchOperation(function() {
doc.replaceRange(varDeclaration, insertStartPos);
selections = doc.doMultipleEdits(edits);
selections.push({
start: {line: insertStartPos.line, ch: insertStartPos.ch + varType.length + 1},
end: {line: insertStartPos.line, ch: insertStartPos.ch + varType.length + varName.length + 1},
primary: true
});
session.editor.setSelections(selections);
session.editor._codeMirror.indentLine(posToIndent.line, "smart");
});
} | [
"function",
"extract",
"(",
"scopes",
",",
"parentStatement",
",",
"expns",
",",
"text",
",",
"insertPosition",
")",
"{",
"var",
"varType",
"=",
"\"var\"",
",",
"varName",
"=",
"RefactoringUtils",
".",
"getUniqueIdentifierName",
"(",
"scopes",
",",
"\"extracted\... | Does the actual extraction. i.e Replacing the text, Creating a variable
and multi select variable names | [
"Does",
"the",
"actual",
"extraction",
".",
"i",
".",
"e",
"Replacing",
"the",
"text",
"Creating",
"a",
"variable",
"and",
"multi",
"select",
"variable",
"names"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/JavaScriptRefactoring/ExtractToVariable.js#L40-L97 | train | Extract a variable from a statement | [
30522,
3853,
14817,
1006,
9531,
2015,
1010,
3008,
12259,
3672,
1010,
4654,
2361,
3619,
1010,
3793,
1010,
19274,
26994,
1007,
1063,
13075,
13075,
13874,
1027,
1000,
13075,
1000,
1010,
13075,
18442,
1027,
25416,
18908,
28741,
27920,
12146,
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... |
nhn/tui.editor | src/js/extensions/table/tableDataHandler.js | stuffCellsIntoIncompleteRow | function stuffCellsIntoIncompleteRow(tableData, limitIndex) {
tableData.forEach((rowData, rowIndex) => {
const startIndex = rowData.length;
if (startIndex) {
const [{nodeName}] = rowData;
util.range(startIndex, limitIndex).forEach(colIndex => {
rowData.push(createBasicCell(rowIndex, colIndex, nodeName));
});
}
});
} | javascript | function stuffCellsIntoIncompleteRow(tableData, limitIndex) {
tableData.forEach((rowData, rowIndex) => {
const startIndex = rowData.length;
if (startIndex) {
const [{nodeName}] = rowData;
util.range(startIndex, limitIndex).forEach(colIndex => {
rowData.push(createBasicCell(rowIndex, colIndex, nodeName));
});
}
});
} | [
"function",
"stuffCellsIntoIncompleteRow",
"(",
"tableData",
",",
"limitIndex",
")",
"{",
"tableData",
".",
"forEach",
"(",
"(",
"rowData",
",",
"rowIndex",
")",
"=>",
"{",
"const",
"startIndex",
"=",
"rowData",
".",
"length",
";",
"if",
"(",
"startIndex",
"... | Stuff cells into incomplete row.
@param {Array.<Array.<object>>} tableData - table data
@param {number} limitIndex - limit index
@ignore | [
"Stuff",
"cells",
"into",
"incomplete",
"row",
"."
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/extensions/table/tableDataHandler.js#L336-L347 | train | stuff cells into incomplete row | [
30522,
3853,
4933,
29109,
4877,
18447,
28765,
9006,
10814,
3334,
5004,
1006,
2795,
2850,
2696,
1010,
5787,
22254,
10288,
1007,
1063,
2795,
2850,
2696,
1012,
18921,
6776,
1006,
1006,
5216,
2850,
2696,
1010,
5216,
22254,
10288,
1007,
1027,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/language/CSSUtils.js | _findMatchingRulesInCSSFiles | function _findMatchingRulesInCSSFiles(selector, resultSelectors) {
var result = new $.Deferred();
// Load one CSS file and search its contents
function _loadFileAndScan(fullPath, selector) {
var oneFileResult = new $.Deferred();
DocumentManager.getDocumentForPath(fullPath)
.done(function (doc) {
// Find all matching rules for the given CSS file's content, and add them to the
// overall search result
var oneCSSFileMatches = _findAllMatchingSelectorsInText(doc.getText(), selector, doc.getLanguage().getMode());
_addSelectorsToResults(resultSelectors, oneCSSFileMatches, doc, 0);
oneFileResult.resolve();
})
.fail(function (error) {
console.warn("Unable to read " + fullPath + " during CSS rule search:", error);
oneFileResult.resolve(); // still resolve, so the overall result doesn't reject
});
return oneFileResult.promise();
}
ProjectManager.getAllFiles(ProjectManager.getLanguageFilter(["css", "less", "scss"]))
.done(function (cssFiles) {
// Load index of all CSS files; then process each CSS file in turn (see above)
Async.doInParallel(cssFiles, function (fileInfo, number) {
return _loadFileAndScan(fileInfo.fullPath, selector);
})
.then(result.resolve, result.reject);
});
return result.promise();
} | javascript | function _findMatchingRulesInCSSFiles(selector, resultSelectors) {
var result = new $.Deferred();
// Load one CSS file and search its contents
function _loadFileAndScan(fullPath, selector) {
var oneFileResult = new $.Deferred();
DocumentManager.getDocumentForPath(fullPath)
.done(function (doc) {
// Find all matching rules for the given CSS file's content, and add them to the
// overall search result
var oneCSSFileMatches = _findAllMatchingSelectorsInText(doc.getText(), selector, doc.getLanguage().getMode());
_addSelectorsToResults(resultSelectors, oneCSSFileMatches, doc, 0);
oneFileResult.resolve();
})
.fail(function (error) {
console.warn("Unable to read " + fullPath + " during CSS rule search:", error);
oneFileResult.resolve(); // still resolve, so the overall result doesn't reject
});
return oneFileResult.promise();
}
ProjectManager.getAllFiles(ProjectManager.getLanguageFilter(["css", "less", "scss"]))
.done(function (cssFiles) {
// Load index of all CSS files; then process each CSS file in turn (see above)
Async.doInParallel(cssFiles, function (fileInfo, number) {
return _loadFileAndScan(fileInfo.fullPath, selector);
})
.then(result.resolve, result.reject);
});
return result.promise();
} | [
"function",
"_findMatchingRulesInCSSFiles",
"(",
"selector",
",",
"resultSelectors",
")",
"{",
"var",
"result",
"=",
"new",
"$",
".",
"Deferred",
"(",
")",
";",
"// Load one CSS file and search its contents",
"function",
"_loadFileAndScan",
"(",
"fullPath",
",",
"sele... | Finds matching selectors in CSS files; adds them to 'resultSelectors' | [
"Finds",
"matching",
"selectors",
"in",
"CSS",
"files",
";",
"adds",
"them",
"to",
"resultSelectors"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/language/CSSUtils.js#L1424-L1458 | train | Find all matching rules in CSS files | [
30522,
3853,
1035,
2424,
18900,
8450,
6820,
4244,
2378,
6169,
22747,
9463,
2015,
1006,
27000,
1010,
3463,
12260,
24817,
1007,
1063,
13075,
2765,
1027,
2047,
1002,
1012,
13366,
28849,
2094,
1006,
1007,
1025,
1013,
1013,
7170,
2028,
20116,
20... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/dom/includeScript.js | function(vUrl, vId, fnLoadCallback, fnErrorCallback) {
var mAttributes;
if (typeof vUrl === "string") {
mAttributes = typeof vId === "string" ? {id: vId} : vId;
_includeScript(vUrl, mAttributes, fnLoadCallback, fnErrorCallback);
} else {
assert(typeof vUrl === 'object' && vUrl.url, "vUrl must be an object and requires a URL");
mAttributes = Object.assign({}, vUrl.attributes);
if (vUrl.id) {
mAttributes.id = vUrl.id;
}
return new Promise(function(fnResolve, fnReject) {
_includeScript(vUrl.url, mAttributes, fnResolve, fnReject);
});
}
} | javascript | function(vUrl, vId, fnLoadCallback, fnErrorCallback) {
var mAttributes;
if (typeof vUrl === "string") {
mAttributes = typeof vId === "string" ? {id: vId} : vId;
_includeScript(vUrl, mAttributes, fnLoadCallback, fnErrorCallback);
} else {
assert(typeof vUrl === 'object' && vUrl.url, "vUrl must be an object and requires a URL");
mAttributes = Object.assign({}, vUrl.attributes);
if (vUrl.id) {
mAttributes.id = vUrl.id;
}
return new Promise(function(fnResolve, fnReject) {
_includeScript(vUrl.url, mAttributes, fnResolve, fnReject);
});
}
} | [
"function",
"(",
"vUrl",
",",
"vId",
",",
"fnLoadCallback",
",",
"fnErrorCallback",
")",
"{",
"var",
"mAttributes",
";",
"if",
"(",
"typeof",
"vUrl",
"===",
"\"string\"",
")",
"{",
"mAttributes",
"=",
"typeof",
"vId",
"===",
"\"string\"",
"?",
"{",
"id",
... | Includes the script (via <script>-tag) into the head for the
specified <code>sUrl</code> and optional <code>sId</code>.
@param {string|object} vUrl the URL of the script to load or a configuration object
@param {string} vUrl.url the URL of the script to load
@param {string} [vUrl.id] id that should be used for the script tag
@param {object} [vUrl.attributes] map of attributes that should be used for the script tag
@param {string|object} [vId] id that should be used for the script tag or map of attributes
@param {function} [fnLoadCallback] callback function to get notified once the script has been loaded
@param {function} [fnErrorCallback] callback function to get notified once the script loading failed
@return {void|Promise} When using the configuration object a <code>Promise</code> will be returned. The
documentation for the <code>fnLoadCallback</code> applies to the <code>resolve</code>
handler of the <code>Promise</code> and the one for the <code>fnErrorCallback</code>
applies to the <code>reject</code> handler of the <code>Promise</code>.
@function
@public
@since 1.58
@SecSink {0|PATH} Parameter is used for future HTTP requests
@alias module:sap/ui/dom/includeScript | [
"Includes",
"the",
"script",
"(",
"via",
"<",
";",
"script>",
";",
"-",
"tag",
")",
"into",
"the",
"head",
"for",
"the",
"specified",
"<code",
">",
"sUrl<",
"/",
"code",
">",
"and",
"optional",
"<code",
">",
"sId<",
"/",
"code",
">",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/dom/includeScript.js#L69-L84 | train | Loads a script from a URL or an object with an id attribute | [
30522,
3853,
1006,
24728,
12190,
1010,
6819,
2094,
1010,
1042,
20554,
10441,
30524,
8909,
1024,
6819,
2094,
1065,
1024,
6819,
2094,
1025,
1035,
2950,
23235,
1006,
24728,
12190,
1010,
4717,
3089,
8569,
4570,
1010,
1042,
20554,
10441,
16409,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/shaders/standard.js | function (data) {
var self = this;
var material = this.material;
var envMap = data.envMap;
var sphericalEnvMap = data.sphericalEnvMap;
// No envMap defined or already loading.
if ((!envMap && !sphericalEnvMap) || this.isLoadingEnvMap) {
material.envMap = null;
material.needsUpdate = true;
return;
}
this.isLoadingEnvMap = true;
// if a spherical env map is defined then use it.
if (sphericalEnvMap) {
this.el.sceneEl.systems.material.loadTexture(sphericalEnvMap, {src: sphericalEnvMap}, function textureLoaded (texture) {
self.isLoadingEnvMap = false;
texture.mapping = THREE.SphericalReflectionMapping;
material.envMap = texture;
utils.material.handleTextureEvents(self.el, texture);
material.needsUpdate = true;
});
return;
}
// Another material is already loading this texture. Wait on promise.
if (texturePromises[envMap]) {
texturePromises[envMap].then(function (cube) {
self.isLoadingEnvMap = false;
material.envMap = cube;
utils.material.handleTextureEvents(self.el, cube);
material.needsUpdate = true;
});
return;
}
// Material is first to load this texture. Load and resolve texture.
texturePromises[envMap] = new Promise(function (resolve) {
utils.srcLoader.validateCubemapSrc(envMap, function loadEnvMap (urls) {
CubeLoader.load(urls, function (cube) {
// Texture loaded.
self.isLoadingEnvMap = false;
material.envMap = cube;
utils.material.handleTextureEvents(self.el, cube);
resolve(cube);
});
});
});
} | javascript | function (data) {
var self = this;
var material = this.material;
var envMap = data.envMap;
var sphericalEnvMap = data.sphericalEnvMap;
// No envMap defined or already loading.
if ((!envMap && !sphericalEnvMap) || this.isLoadingEnvMap) {
material.envMap = null;
material.needsUpdate = true;
return;
}
this.isLoadingEnvMap = true;
// if a spherical env map is defined then use it.
if (sphericalEnvMap) {
this.el.sceneEl.systems.material.loadTexture(sphericalEnvMap, {src: sphericalEnvMap}, function textureLoaded (texture) {
self.isLoadingEnvMap = false;
texture.mapping = THREE.SphericalReflectionMapping;
material.envMap = texture;
utils.material.handleTextureEvents(self.el, texture);
material.needsUpdate = true;
});
return;
}
// Another material is already loading this texture. Wait on promise.
if (texturePromises[envMap]) {
texturePromises[envMap].then(function (cube) {
self.isLoadingEnvMap = false;
material.envMap = cube;
utils.material.handleTextureEvents(self.el, cube);
material.needsUpdate = true;
});
return;
}
// Material is first to load this texture. Load and resolve texture.
texturePromises[envMap] = new Promise(function (resolve) {
utils.srcLoader.validateCubemapSrc(envMap, function loadEnvMap (urls) {
CubeLoader.load(urls, function (cube) {
// Texture loaded.
self.isLoadingEnvMap = false;
material.envMap = cube;
utils.material.handleTextureEvents(self.el, cube);
resolve(cube);
});
});
});
} | [
"function",
"(",
"data",
")",
"{",
"var",
"self",
"=",
"this",
";",
"var",
"material",
"=",
"this",
".",
"material",
";",
"var",
"envMap",
"=",
"data",
".",
"envMap",
";",
"var",
"sphericalEnvMap",
"=",
"data",
".",
"sphericalEnvMap",
";",
"// No envMap ... | Handle environment cubemap. Textures are cached in texturePromises. | [
"Handle",
"environment",
"cubemap",
".",
"Textures",
"are",
"cached",
"in",
"texturePromises",
"."
] | 24acc78a7299a4cdfe3ef617f4d40ddf6275c992 | https://github.com/aframevr/aframe/blob/24acc78a7299a4cdfe3ef617f4d40ddf6275c992/src/shaders/standard.js#L109-L158 | train | Load the env map and update the material. | [
30522,
3853,
1006,
2951,
1007,
1063,
13075,
2969,
1027,
2023,
1025,
13075,
3430,
1027,
2023,
1012,
3430,
1025,
13075,
4372,
2615,
2863,
2361,
1027,
2951,
1012,
4372,
2615,
2863,
2361,
1025,
13075,
18970,
2368,
2615,
2863,
2361,
1027,
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.fl/src/sap/ui/fl/support/apps/contentbrowser/controller/ContentDetails.controller.js | function () {
var oSelectedContentModel = this.getView().getModel("selectedContent");
var oContentData = oSelectedContentModel.getData();
var oRouter = sap.ui.core.UIComponent.getRouterFor(this);
oRouter.navTo("ContentDetailsEdit", {
"layer": oContentData.layer,
"namespace": encodeURIComponent(oContentData.namespace),
"fileName": oContentData.fileName,
"fileType": oContentData.fileType
});
} | javascript | function () {
var oSelectedContentModel = this.getView().getModel("selectedContent");
var oContentData = oSelectedContentModel.getData();
var oRouter = sap.ui.core.UIComponent.getRouterFor(this);
oRouter.navTo("ContentDetailsEdit", {
"layer": oContentData.layer,
"namespace": encodeURIComponent(oContentData.namespace),
"fileName": oContentData.fileName,
"fileType": oContentData.fileType
});
} | [
"function",
"(",
")",
"{",
"var",
"oSelectedContentModel",
"=",
"this",
".",
"getView",
"(",
")",
".",
"getModel",
"(",
"\"selectedContent\"",
")",
";",
"var",
"oContentData",
"=",
"oSelectedContentModel",
".",
"getData",
"(",
")",
";",
"var",
"oRouter",
"="... | Navigates to Edit mode of content.
@public | [
"Navigates",
"to",
"Edit",
"mode",
"of",
"content",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/support/apps/contentbrowser/controller/ContentDetails.controller.js#L143-L154 | train | Navigates to the selected content | [
30522,
3853,
1006,
1007,
1063,
13075,
9808,
12260,
10985,
8663,
6528,
21246,
10244,
2140,
1027,
2023,
1012,
2131,
8584,
1006,
1007,
1012,
2131,
5302,
9247,
1006,
1000,
3479,
8663,
6528,
2102,
1000,
1007,
1025,
13075,
1051,
8663,
6528,
2102,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
moment/luxon | src/datetime.js | toTechTimeFormat | function toTechTimeFormat(
dt,
{
suppressSeconds = false,
suppressMilliseconds = false,
includeOffset,
includeZone = false,
spaceZone = false
}
) {
let fmt = "HH:mm";
if (!suppressSeconds || dt.second !== 0 || dt.millisecond !== 0) {
fmt += ":ss";
if (!suppressMilliseconds || dt.millisecond !== 0) {
fmt += ".SSS";
}
}
if ((includeZone || includeOffset) && spaceZone) {
fmt += " ";
}
if (includeZone) {
fmt += "z";
} else if (includeOffset) {
fmt += "ZZ";
}
return toTechFormat(dt, fmt);
} | javascript | function toTechTimeFormat(
dt,
{
suppressSeconds = false,
suppressMilliseconds = false,
includeOffset,
includeZone = false,
spaceZone = false
}
) {
let fmt = "HH:mm";
if (!suppressSeconds || dt.second !== 0 || dt.millisecond !== 0) {
fmt += ":ss";
if (!suppressMilliseconds || dt.millisecond !== 0) {
fmt += ".SSS";
}
}
if ((includeZone || includeOffset) && spaceZone) {
fmt += " ";
}
if (includeZone) {
fmt += "z";
} else if (includeOffset) {
fmt += "ZZ";
}
return toTechFormat(dt, fmt);
} | [
"function",
"toTechTimeFormat",
"(",
"dt",
",",
"{",
"suppressSeconds",
"=",
"false",
",",
"suppressMilliseconds",
"=",
"false",
",",
"includeOffset",
",",
"includeZone",
"=",
"false",
",",
"spaceZone",
"=",
"false",
"}",
")",
"{",
"let",
"fmt",
"=",
"\"HH:m... | technical time formats (e.g. the time part of ISO 8601), take some options and this commonizes their handling | [
"technical",
"time",
"formats",
"(",
"e",
".",
"g",
".",
"the",
"time",
"part",
"of",
"ISO",
"8601",
")",
"take",
"some",
"options",
"and",
"this",
"commonizes",
"their",
"handling"
] | 236f2badea297ee73421aa39a83e06177c1be6d0 | https://github.com/moment/luxon/blob/236f2badea297ee73421aa39a83e06177c1be6d0/src/datetime.js#L185-L215 | train | Returns the time format of the specified time | [
30522,
3853,
2000,
15007,
7292,
14192,
4017,
1006,
26718,
1010,
1063,
16081,
3366,
8663,
5104,
1027,
6270,
1010,
16081,
19912,
5562,
8663,
5104,
1027,
6270,
1010,
2421,
27475,
3388,
1010,
2421,
15975,
1027,
6270,
1010,
2686,
15975,
1027,
62... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/treemap/treemapLayout.js | position | function position(row, rowFixedLength, rect, halfGapWidth, flush) {
// When rowFixedLength === rect.width,
// it is horizontal subdivision,
// rowFixedLength is the width of the subdivision,
// rowOtherLength is the height of the subdivision,
// and nodes will be positioned from left to right.
// wh[idx0WhenH] means: when horizontal,
// wh[idx0WhenH] => wh[0] => 'width'.
// xy[idx1WhenH] => xy[1] => 'y'.
var idx0WhenH = rowFixedLength === rect.width ? 0 : 1;
var idx1WhenH = 1 - idx0WhenH;
var xy = ['x', 'y'];
var wh = ['width', 'height'];
var last = rect[xy[idx0WhenH]];
var rowOtherLength = rowFixedLength
? row.area / rowFixedLength : 0;
if (flush || rowOtherLength > rect[wh[idx1WhenH]]) {
rowOtherLength = rect[wh[idx1WhenH]]; // over+underflow
}
for (var i = 0, rowLen = row.length; i < rowLen; i++) {
var node = row[i];
var nodeLayout = {};
var step = rowOtherLength
? node.getLayout().area / rowOtherLength : 0;
var wh1 = nodeLayout[wh[idx1WhenH]] = mathMax(rowOtherLength - 2 * halfGapWidth, 0);
// We use Math.max/min to avoid negative width/height when considering gap width.
var remain = rect[xy[idx0WhenH]] + rect[wh[idx0WhenH]] - last;
var modWH = (i === rowLen - 1 || remain < step) ? remain : step;
var wh0 = nodeLayout[wh[idx0WhenH]] = mathMax(modWH - 2 * halfGapWidth, 0);
nodeLayout[xy[idx1WhenH]] = rect[xy[idx1WhenH]] + mathMin(halfGapWidth, wh1 / 2);
nodeLayout[xy[idx0WhenH]] = last + mathMin(halfGapWidth, wh0 / 2);
last += modWH;
node.setLayout(nodeLayout, true);
}
rect[xy[idx1WhenH]] += rowOtherLength;
rect[wh[idx1WhenH]] -= rowOtherLength;
} | javascript | function position(row, rowFixedLength, rect, halfGapWidth, flush) {
// When rowFixedLength === rect.width,
// it is horizontal subdivision,
// rowFixedLength is the width of the subdivision,
// rowOtherLength is the height of the subdivision,
// and nodes will be positioned from left to right.
// wh[idx0WhenH] means: when horizontal,
// wh[idx0WhenH] => wh[0] => 'width'.
// xy[idx1WhenH] => xy[1] => 'y'.
var idx0WhenH = rowFixedLength === rect.width ? 0 : 1;
var idx1WhenH = 1 - idx0WhenH;
var xy = ['x', 'y'];
var wh = ['width', 'height'];
var last = rect[xy[idx0WhenH]];
var rowOtherLength = rowFixedLength
? row.area / rowFixedLength : 0;
if (flush || rowOtherLength > rect[wh[idx1WhenH]]) {
rowOtherLength = rect[wh[idx1WhenH]]; // over+underflow
}
for (var i = 0, rowLen = row.length; i < rowLen; i++) {
var node = row[i];
var nodeLayout = {};
var step = rowOtherLength
? node.getLayout().area / rowOtherLength : 0;
var wh1 = nodeLayout[wh[idx1WhenH]] = mathMax(rowOtherLength - 2 * halfGapWidth, 0);
// We use Math.max/min to avoid negative width/height when considering gap width.
var remain = rect[xy[idx0WhenH]] + rect[wh[idx0WhenH]] - last;
var modWH = (i === rowLen - 1 || remain < step) ? remain : step;
var wh0 = nodeLayout[wh[idx0WhenH]] = mathMax(modWH - 2 * halfGapWidth, 0);
nodeLayout[xy[idx1WhenH]] = rect[xy[idx1WhenH]] + mathMin(halfGapWidth, wh1 / 2);
nodeLayout[xy[idx0WhenH]] = last + mathMin(halfGapWidth, wh0 / 2);
last += modWH;
node.setLayout(nodeLayout, true);
}
rect[xy[idx1WhenH]] += rowOtherLength;
rect[wh[idx1WhenH]] -= rowOtherLength;
} | [
"function",
"position",
"(",
"row",
",",
"rowFixedLength",
",",
"rect",
",",
"halfGapWidth",
",",
"flush",
")",
"{",
"// When rowFixedLength === rect.width,",
"// it is horizontal subdivision,",
"// rowFixedLength is the width of the subdivision,",
"// rowOtherLength is the height ... | Positions the specified row of nodes. Modifies `rect`. | [
"Positions",
"the",
"specified",
"row",
"of",
"nodes",
".",
"Modifies",
"rect",
"."
] | 4d0ea095dc3929cb6de40c45748826e7999c7aa8 | https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/chart/treemap/treemapLayout.js#L431-L475 | train | Position the nodes in the row | [
30522,
3853,
2597,
1006,
5216,
1010,
5216,
23901,
7770,
13512,
2232,
1010,
28667,
2102,
1010,
2431,
3654,
28400,
3593,
2705,
1010,
13862,
1007,
1063,
1013,
1013,
2043,
5216,
23901,
7770,
13512,
2232,
1027,
1027,
1027,
28667,
2102,
1012,
938... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | _addFormElement | function _addFormElement(oFormContainer, oLabel) {
var oElement = _createFormElement.call(this, oLabel);
oFormContainer.addFormElement(oElement);
return oElement;
} | javascript | function _addFormElement(oFormContainer, oLabel) {
var oElement = _createFormElement.call(this, oLabel);
oFormContainer.addFormElement(oElement);
return oElement;
} | [
"function",
"_addFormElement",
"(",
"oFormContainer",
",",
"oLabel",
")",
"{",
"var",
"oElement",
"=",
"_createFormElement",
".",
"call",
"(",
"this",
",",
"oLabel",
")",
";",
"oFormContainer",
".",
"addFormElement",
"(",
"oElement",
")",
";",
"return",
"oElem... | /*
Adds a new FormElement to the given FormContainer and adds the given label to it.
@param {sap.ui.layout.form.FormContainer} The form container
@param {sap.ui.core.Label} optional (interface) The label of the FormElement
@returns {sap.ui.layout.form.FormElement} The newly created FormElement
@private | [
"/",
"*",
"Adds",
"a",
"new",
"FormElement",
"to",
"the",
"given",
"FormContainer",
"and",
"adds",
"the",
"given",
"label",
"to",
"it",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.layout/src/sap/ui/layout/form/SimpleForm.js#L1615-L1621 | train | Creates a new control element and adds it to the given container | [
30522,
3853,
1035,
5587,
14192,
12260,
3672,
1006,
1997,
2953,
12458,
12162,
18175,
2099,
1010,
19330,
16336,
2140,
1007,
1063,
13075,
1051,
12260,
3672,
1027,
1035,
3443,
14192,
12260,
3672,
1012,
2655,
1006,
2023,
1010,
19330,
16336,
2140,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
jgraph/mxgraph | javascript/mxClient.js | function(text)
{
if (text != null)
{
var lines = text.split('\n');
for (var i = 0; i < lines.length; i++)
{
if (lines[i].charAt(0) != '#')
{
var index = lines[i].indexOf('=');
if (index > 0)
{
var key = lines[i].substring(0, index);
var idx = lines[i].length;
if (lines[i].charCodeAt(idx - 1) == 13)
{
idx--;
}
var value = lines[i].substring(index + 1, idx);
if (this.resourcesEncoded)
{
value = value.replace(/\\(?=u[a-fA-F\d]{4})/g,"%");
mxResources.resources[key] = unescape(value);
}
else
{
mxResources.resources[key] = value;
}
}
}
}
}
} | javascript | function(text)
{
if (text != null)
{
var lines = text.split('\n');
for (var i = 0; i < lines.length; i++)
{
if (lines[i].charAt(0) != '#')
{
var index = lines[i].indexOf('=');
if (index > 0)
{
var key = lines[i].substring(0, index);
var idx = lines[i].length;
if (lines[i].charCodeAt(idx - 1) == 13)
{
idx--;
}
var value = lines[i].substring(index + 1, idx);
if (this.resourcesEncoded)
{
value = value.replace(/\\(?=u[a-fA-F\d]{4})/g,"%");
mxResources.resources[key] = unescape(value);
}
else
{
mxResources.resources[key] = value;
}
}
}
}
}
} | [
"function",
"(",
"text",
")",
"{",
"if",
"(",
"text",
"!=",
"null",
")",
"{",
"var",
"lines",
"=",
"text",
".",
"split",
"(",
"'\\n'",
")",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"lines",
".",
"length",
";",
"i",
"++",
")",
"... | Function: parse
Parses the key, value pairs in the specified
text and stores them as local resources. | [
"Function",
":",
"parse"
] | 33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44 | https://github.com/jgraph/mxgraph/blob/33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44/javascript/mxClient.js#L1539-L1576 | train | Parses the specified text into a map of resources | [
30522,
3853,
1006,
3793,
1007,
1063,
2065,
1006,
3793,
999,
1027,
19701,
1007,
1063,
13075,
3210,
1027,
3793,
1012,
3975,
1006,
1005,
1032,
1050,
1005,
1007,
1025,
2005,
1006,
13075,
1045,
1027,
1014,
1025,
1045,
1026,
3210,
1012,
3091,
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... | |
codemirror/CodeMirror | src/edit/global_events.js | forEachCodeMirror | function forEachCodeMirror(f) {
if (!document.getElementsByClassName) return
let byClass = document.getElementsByClassName("CodeMirror"), editors = []
for (let i = 0; i < byClass.length; i++) {
let cm = byClass[i].CodeMirror
if (cm) editors.push(cm)
}
if (editors.length) editors[0].operation(() => {
for (let i = 0; i < editors.length; i++) f(editors[i])
})
} | javascript | function forEachCodeMirror(f) {
if (!document.getElementsByClassName) return
let byClass = document.getElementsByClassName("CodeMirror"), editors = []
for (let i = 0; i < byClass.length; i++) {
let cm = byClass[i].CodeMirror
if (cm) editors.push(cm)
}
if (editors.length) editors[0].operation(() => {
for (let i = 0; i < editors.length; i++) f(editors[i])
})
} | [
"function",
"forEachCodeMirror",
"(",
"f",
")",
"{",
"if",
"(",
"!",
"document",
".",
"getElementsByClassName",
")",
"return",
"let",
"byClass",
"=",
"document",
".",
"getElementsByClassName",
"(",
"\"CodeMirror\"",
")",
",",
"editors",
"=",
"[",
"]",
"for",
... | These must be handled carefully, because naively registering a handler for each editor will cause the editors to never be garbage collected. | [
"These",
"must",
"be",
"handled",
"carefully",
"because",
"naively",
"registering",
"a",
"handler",
"for",
"each",
"editor",
"will",
"cause",
"the",
"editors",
"to",
"never",
"be",
"garbage",
"collected",
"."
] | dab6f676107c10ba8d16c654a42f66cae3f27db1 | https://github.com/codemirror/CodeMirror/blob/dab6f676107c10ba8d16c654a42f66cae3f27db1/src/edit/global_events.js#L8-L18 | train | forEachCodeMirror - function | [
30522,
3853,
18921,
6776,
16044,
14503,
29165,
1006,
1042,
1007,
1063,
2065,
1006,
999,
6254,
1012,
2131,
12260,
8163,
3762,
26266,
18442,
1007,
2709,
2292,
2011,
26266,
1027,
6254,
1012,
2131,
12260,
8163,
3762,
26266,
18442,
1006,
1000,
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... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/core/LocaleData.js | function() {
var aArguments = Array.prototype.slice.call(arguments),
sCalendar, sKey;
// Calendar data needs special handling, as CustomLocaleData does have one version of calendar data only
if (aArguments[0].indexOf("ca-") == 0) {
sCalendar = aArguments[0];
if (sCalendar == getCLDRCalendarName()) {
aArguments = aArguments.slice(1);
}
}
sKey = aArguments.join("-");
// first try customdata with special formatted key
// afterwards try customdata lookup
// afterwards try mData lookup
var vValue = this.mCustomData[sKey];
if (vValue == null) {
vValue = this._getDeep(this.mCustomData, arguments);
if (vValue == null) {
vValue = this._getDeep(this.mData, arguments);
}
}
return vValue;
} | javascript | function() {
var aArguments = Array.prototype.slice.call(arguments),
sCalendar, sKey;
// Calendar data needs special handling, as CustomLocaleData does have one version of calendar data only
if (aArguments[0].indexOf("ca-") == 0) {
sCalendar = aArguments[0];
if (sCalendar == getCLDRCalendarName()) {
aArguments = aArguments.slice(1);
}
}
sKey = aArguments.join("-");
// first try customdata with special formatted key
// afterwards try customdata lookup
// afterwards try mData lookup
var vValue = this.mCustomData[sKey];
if (vValue == null) {
vValue = this._getDeep(this.mCustomData, arguments);
if (vValue == null) {
vValue = this._getDeep(this.mData, arguments);
}
}
return vValue;
} | [
"function",
"(",
")",
"{",
"var",
"aArguments",
"=",
"Array",
".",
"prototype",
".",
"slice",
".",
"call",
"(",
"arguments",
")",
",",
"sCalendar",
",",
"sKey",
";",
"// Calendar data needs special handling, as CustomLocaleData does have one version of calendar data only"... | Retrieves the value for the given arguments by checking first <code>mCustomData</code> and if not
found <code>mData</code>
@returns {*} value
@private | [
"Retrieves",
"the",
"value",
"for",
"the",
"given",
"arguments",
"by",
"checking",
"first",
"<code",
">",
"mCustomData<",
"/",
"code",
">",
"and",
"if",
"not",
"found",
"<code",
">",
"mData<",
"/",
"code",
">"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/LocaleData.js#L3314-L3338 | train | Get the custom data for the given arguments | [
30522,
3853,
1006,
1007,
1063,
13075,
9779,
10623,
27417,
3215,
1027,
9140,
1012,
8773,
1012,
14704,
1012,
2655,
1006,
9918,
1007,
1010,
4094,
8943,
2099,
1010,
15315,
3240,
1025,
1013,
1013,
8094,
2951,
3791,
2569,
8304,
1010,
2004,
7661,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | src/sap.ui.core/src/sap/ui/model/analytics/odata4analytics.js | function() {
if (this._aAttributeNames) {
return this._aAttributeNames;
}
this._aAttributeNames = [];
for ( var sName in this._oAttributeSet) {
this._aAttributeNames.push(this._oAttributeSet[sName].getName());
}
return this._aAttributeNames;
} | javascript | function() {
if (this._aAttributeNames) {
return this._aAttributeNames;
}
this._aAttributeNames = [];
for ( var sName in this._oAttributeSet) {
this._aAttributeNames.push(this._oAttributeSet[sName].getName());
}
return this._aAttributeNames;
} | [
"function",
"(",
")",
"{",
"if",
"(",
"this",
".",
"_aAttributeNames",
")",
"{",
"return",
"this",
".",
"_aAttributeNames",
";",
"}",
"this",
".",
"_aAttributeNames",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"sName",
"in",
"this",
".",
"_oAttributeSet",
... | Get the names of all attributes included in this dimension
@returns {string[]} List of all attribute names
@public
@function
@name sap.ui.model.analytics.odata4analytics.Dimension#getAllAttributeNames | [
"Get",
"the",
"names",
"of",
"all",
"attributes",
"included",
"in",
"this",
"dimension"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/analytics/odata4analytics.js#L1843-L1855 | train | Returns an array of attribute names | [
30522,
3853,
1006,
1007,
1063,
2065,
1006,
2023,
1012,
1035,
9779,
4779,
3089,
8569,
6528,
14074,
2015,
1007,
1063,
2709,
2023,
1012,
1035,
9779,
4779,
3089,
8569,
6528,
14074,
2015,
1025,
1065,
2023,
1012,
1035,
9779,
4779,
3089,
8569,
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... | |
adobe/brackets | src/command/Menus.js | _insertInList | function _insertInList($list, $element, position, $relativeElement) {
// Determine where to insert. Default is LAST.
var inserted = false;
if (position) {
// Adjust relative position for menu section positions since $relativeElement
// has already been resolved by _getRelativeMenuItem() to a menuItem
if (position === FIRST_IN_SECTION) {
position = BEFORE;
} else if (position === LAST_IN_SECTION) {
position = AFTER;
}
if (position === FIRST) {
$list.prepend($element);
inserted = true;
} else if ($relativeElement && $relativeElement.length > 0) {
if (position === AFTER) {
$relativeElement.after($element);
inserted = true;
} else if (position === BEFORE) {
$relativeElement.before($element);
inserted = true;
}
}
}
// Default to LAST
if (!inserted) {
$list.append($element);
}
} | javascript | function _insertInList($list, $element, position, $relativeElement) {
// Determine where to insert. Default is LAST.
var inserted = false;
if (position) {
// Adjust relative position for menu section positions since $relativeElement
// has already been resolved by _getRelativeMenuItem() to a menuItem
if (position === FIRST_IN_SECTION) {
position = BEFORE;
} else if (position === LAST_IN_SECTION) {
position = AFTER;
}
if (position === FIRST) {
$list.prepend($element);
inserted = true;
} else if ($relativeElement && $relativeElement.length > 0) {
if (position === AFTER) {
$relativeElement.after($element);
inserted = true;
} else if (position === BEFORE) {
$relativeElement.before($element);
inserted = true;
}
}
}
// Default to LAST
if (!inserted) {
$list.append($element);
}
} | [
"function",
"_insertInList",
"(",
"$list",
",",
"$element",
",",
"position",
",",
"$relativeElement",
")",
"{",
"// Determine where to insert. Default is LAST.",
"var",
"inserted",
"=",
"false",
";",
"if",
"(",
"position",
")",
"{",
"// Adjust relative position for menu... | Help function for inserting elements into a list | [
"Help",
"function",
"for",
"inserting",
"elements",
"into",
"a",
"list"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/command/Menus.js#L256-L287 | train | Insert an element into the list | [
30522,
3853,
1035,
19274,
2378,
9863,
1006,
1002,
2862,
1010,
1002,
5783,
1010,
2597,
1010,
1002,
5816,
12260,
3672,
1007,
1063,
1013,
1013,
5646,
2073,
2000,
19274,
1012,
12398,
2003,
2197,
1012,
13075,
12889,
1027,
6270,
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... |
SAP/openui5 | src/sap.ui.table/src/sap/ui/table/TableScrollExtension.js | function(oTable) {
var oDomRef = oTable.getDomRef();
var aScrollableColumnAreas;
if (oDomRef) {
aScrollableColumnAreas = Array.prototype.slice.call(oTable.getDomRef().querySelectorAll(".sapUiTableCtrlScr"));
}
var aScrollAreas = [
oTable._getScrollExtension().getHorizontalScrollbar()
].concat(aScrollableColumnAreas);
return aScrollAreas.filter(function(oScrollArea) {
return oScrollArea != null;
});
} | javascript | function(oTable) {
var oDomRef = oTable.getDomRef();
var aScrollableColumnAreas;
if (oDomRef) {
aScrollableColumnAreas = Array.prototype.slice.call(oTable.getDomRef().querySelectorAll(".sapUiTableCtrlScr"));
}
var aScrollAreas = [
oTable._getScrollExtension().getHorizontalScrollbar()
].concat(aScrollableColumnAreas);
return aScrollAreas.filter(function(oScrollArea) {
return oScrollArea != null;
});
} | [
"function",
"(",
"oTable",
")",
"{",
"var",
"oDomRef",
"=",
"oTable",
".",
"getDomRef",
"(",
")",
";",
"var",
"aScrollableColumnAreas",
";",
"if",
"(",
"oDomRef",
")",
"{",
"aScrollableColumnAreas",
"=",
"Array",
".",
"prototype",
".",
"slice",
".",
"call"... | Gets the areas of the table which can be scrolled horizontally.
@param {sap.ui.table.Table} oTable Instance of the table.
@returns {HTMLElement[]} Returns only elements which exist in the DOM.
@private | [
"Gets",
"the",
"areas",
"of",
"the",
"table",
"which",
"can",
"be",
"scrolled",
"horizontally",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableScrollExtension.js#L270-L285 | train | Returns the list of all the scroll areas that are visible in the table. | [
30522,
3853,
1006,
27178,
3085,
1007,
1063,
13075,
1051,
9527,
2890,
2546,
1027,
27178,
3085,
1012,
2131,
9527,
2890,
2546,
1006,
1007,
1025,
13075,
2004,
26775,
14511,
3085,
25778,
2819,
26148,
3022,
30524,
22471,
6525,
3363,
1006,
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... | |
muaz-khan/RTCMultiConnection | dev/SipConnection.js | SipConnection | function SipConnection(connection, connectCallback) {
function isData(session) {
return !session.audio && !session.video && !session.screen && session.data;
}
connection.socket = {
send: function(data) {
var remoteSipURI = data.remoteUserId + '@yourServer.com';
sip.publish(remoteSipURI, data); // maybe JSON.stringify(data)
}
};
// connect/subscribe to SIP here
// ref: http://sipjs.com/demo-phone/
// and: http://sipjs.com/demo-phone/js/ua.js
var config = {
userAgentString: 'SIP.js/0.7.0 BB',
traceSip: true,
register: false,
displayName: '',
uri: '', // connection.userid + '@yourServer.com'
authorizationUser: '',
password: '',
wsServers: 'wss://edge.sip.onsip.com'
};
var sip = new SIP.UA(config);
sip.on('invite', function(session) {
// do the stuff!
});
sip.on('message', function(data) {
data = JSON.parse(data);
if (data.eventName === connection.socketMessageEvent) {
onMessagesCallback(data.data);
}
if (data.eventName === 'presence') {
data = data.data;
if (data.userid === connection.userid) return;
connection.onUserStatusChanged({
userid: data.userid,
status: data.isOnline === true ? 'online' : 'offline',
extra: connection.peers[data.userid] ? connection.peers[data.userid].extra : {}
});
}
});
// connected or registered
sip.on('connected', function() {
if (connection.enableLogs) {
console.info('SIP connection is opened.');
}
connection.socket.emit('presence', {
userid: connection.userid,
isOnline: true
});
if (connectCallback) connectCallback(connection.socket);
});
sip.on('unregistered', function() {
if (!connection.enableLogs) return;
console.warn('Socket connection is closed.');
});
connection.socket.emit = function(eventName, data, callback) {
if (eventName === 'changed-uuid') return;
if (data.message && data.message.shiftedModerationControl) return;
connection.socket.send({
eventName: eventName,
data: data
});
if (callback) {
callback(true);
}
};
var mPeer = connection.multiPeersHandler;
function onMessagesCallback(message) {
if (message.remoteUserId != connection.userid) return;
if (connection.peers[message.sender] && connection.peers[message.sender].extra != message.message.extra) {
connection.peers[message.sender].extra = message.message.extra;
connection.onExtraDataUpdated({
userid: message.sender,
extra: message.message.extra
});
}
if (message.message.streamSyncNeeded && connection.peers[message.sender]) {
var stream = connection.streamEvents[message.message.streamid];
if (!stream || !stream.stream) {
return;
}
var action = message.message.action;
if (action === 'ended' || action === 'stream-removed') {
connection.onstreamended(stream);
return;
}
var type = message.message.type != 'both' ? message.message.type : null;
stream.stream[action](type);
return;
}
if (message.message === 'connectWithAllParticipants') {
if (connection.broadcasters.indexOf(message.sender) === -1) {
connection.broadcasters.push(message.sender);
}
mPeer.onNegotiationNeeded({
allParticipants: connection.getAllParticipants(message.sender)
}, message.sender);
return;
}
if (message.message === 'removeFromBroadcastersList') {
if (connection.broadcasters.indexOf(message.sender) !== -1) {
delete connection.broadcasters[connection.broadcasters.indexOf(message.sender)];
connection.broadcasters = removeNullEntries(connection.broadcasters);
}
return;
}
if (message.message === 'dropPeerConnection') {
connection.deletePeer(message.sender);
return;
}
if (message.message.allParticipants) {
if (message.message.allParticipants.indexOf(message.sender) === -1) {
message.message.allParticipants.push(message.sender);
}
message.message.allParticipants.forEach(function(participant) {
mPeer[!connection.peers[participant] ? 'createNewPeer' : 'renegotiatePeer'](participant, {
localPeerSdpConstraints: {
OfferToReceiveAudio: connection.sdpConstraints.mandatory.OfferToReceiveAudio,
OfferToReceiveVideo: connection.sdpConstraints.mandatory.OfferToReceiveVideo
},
remotePeerSdpConstraints: {
OfferToReceiveAudio: connection.session.oneway ? !!connection.session.audio : connection.sdpConstraints.mandatory.OfferToReceiveAudio,
OfferToReceiveVideo: connection.session.oneway ? !!connection.session.video || !!connection.session.screen : connection.sdpConstraints.mandatory.OfferToReceiveVideo
},
isOneWay: !!connection.session.oneway || connection.direction === 'one-way',
isDataOnly: isData(connection.session)
});
});
return;
}
if (message.message.newParticipant) {
if (message.message.newParticipant == connection.userid) return;
if (!!connection.peers[message.message.newParticipant]) return;
mPeer.createNewPeer(message.message.newParticipant, message.message.userPreferences || {
localPeerSdpConstraints: {
OfferToReceiveAudio: connection.sdpConstraints.mandatory.OfferToReceiveAudio,
OfferToReceiveVideo: connection.sdpConstraints.mandatory.OfferToReceiveVideo
},
remotePeerSdpConstraints: {
OfferToReceiveAudio: connection.session.oneway ? !!connection.session.audio : connection.sdpConstraints.mandatory.OfferToReceiveAudio,
OfferToReceiveVideo: connection.session.oneway ? !!connection.session.video || !!connection.session.screen : connection.sdpConstraints.mandatory.OfferToReceiveVideo
},
isOneWay: !!connection.session.oneway || connection.direction === 'one-way',
isDataOnly: isData(connection.session)
});
return;
}
if (message.message.readyForOffer || message.message.addMeAsBroadcaster) {
connection.addNewBroadcaster(message.sender);
}
if (message.message.newParticipationRequest && message.sender !== connection.userid) {
if (connection.peers[message.sender]) {
connection.deletePeer(message.sender);
}
var userPreferences = {
extra: message.message.extra || {},
localPeerSdpConstraints: message.message.remotePeerSdpConstraints || {
OfferToReceiveAudio: connection.sdpConstraints.mandatory.OfferToReceiveAudio,
OfferToReceiveVideo: connection.sdpConstraints.mandatory.OfferToReceiveVideo
},
remotePeerSdpConstraints: message.message.localPeerSdpConstraints || {
OfferToReceiveAudio: connection.session.oneway ? !!connection.session.audio : connection.sdpConstraints.mandatory.OfferToReceiveAudio,
OfferToReceiveVideo: connection.session.oneway ? !!connection.session.video || !!connection.session.screen : connection.sdpConstraints.mandatory.OfferToReceiveVideo
},
isOneWay: typeof message.message.isOneWay !== 'undefined' ? message.message.isOneWay : !!connection.session.oneway || connection.direction === 'one-way',
isDataOnly: typeof message.message.isDataOnly !== 'undefined' ? message.message.isDataOnly : isData(connection.session),
dontGetRemoteStream: typeof message.message.isOneWay !== 'undefined' ? message.message.isOneWay : !!connection.session.oneway || connection.direction === 'one-way',
dontAttachLocalStream: !!message.message.dontGetRemoteStream,
connectionDescription: message,
successCallback: function() {
// if its oneway----- todo: THIS SEEMS NOT IMPORTANT.
if (typeof message.message.isOneWay !== 'undefined' ? message.message.isOneWay : !!connection.session.oneway || connection.direction === 'one-way') {
connection.addNewBroadcaster(message.sender, userPreferences);
}
if (!!connection.session.oneway || connection.direction === 'one-way' || isData(connection.session)) {
connection.addNewBroadcaster(message.sender, userPreferences);
}
}
};
connection.onNewParticipant(message.sender, userPreferences);
return;
}
if (message.message.shiftedModerationControl) {
connection.onShiftedModerationControl(message.sender, message.message.broadcasters);
return;
}
if (message.message.changedUUID) {
if (connection.peers[message.message.oldUUID]) {
connection.peers[message.message.newUUID] = connection.peers[message.message.oldUUID];
delete connection.peers[message.message.oldUUID];
}
}
if (message.message.userLeft) {
mPeer.onUserLeft(message.sender);
if (!!message.message.autoCloseEntireSession) {
connection.leave();
}
return;
}
mPeer.addNegotiatedMessage(message.message, message.sender);
}
window.addEventListener('beforeunload', function() {
connection.socket.emit('presence', {
userid: connection.userid,
isOnline: false
});
}, false);
} | javascript | function SipConnection(connection, connectCallback) {
function isData(session) {
return !session.audio && !session.video && !session.screen && session.data;
}
connection.socket = {
send: function(data) {
var remoteSipURI = data.remoteUserId + '@yourServer.com';
sip.publish(remoteSipURI, data); // maybe JSON.stringify(data)
}
};
// connect/subscribe to SIP here
// ref: http://sipjs.com/demo-phone/
// and: http://sipjs.com/demo-phone/js/ua.js
var config = {
userAgentString: 'SIP.js/0.7.0 BB',
traceSip: true,
register: false,
displayName: '',
uri: '', // connection.userid + '@yourServer.com'
authorizationUser: '',
password: '',
wsServers: 'wss://edge.sip.onsip.com'
};
var sip = new SIP.UA(config);
sip.on('invite', function(session) {
// do the stuff!
});
sip.on('message', function(data) {
data = JSON.parse(data);
if (data.eventName === connection.socketMessageEvent) {
onMessagesCallback(data.data);
}
if (data.eventName === 'presence') {
data = data.data;
if (data.userid === connection.userid) return;
connection.onUserStatusChanged({
userid: data.userid,
status: data.isOnline === true ? 'online' : 'offline',
extra: connection.peers[data.userid] ? connection.peers[data.userid].extra : {}
});
}
});
// connected or registered
sip.on('connected', function() {
if (connection.enableLogs) {
console.info('SIP connection is opened.');
}
connection.socket.emit('presence', {
userid: connection.userid,
isOnline: true
});
if (connectCallback) connectCallback(connection.socket);
});
sip.on('unregistered', function() {
if (!connection.enableLogs) return;
console.warn('Socket connection is closed.');
});
connection.socket.emit = function(eventName, data, callback) {
if (eventName === 'changed-uuid') return;
if (data.message && data.message.shiftedModerationControl) return;
connection.socket.send({
eventName: eventName,
data: data
});
if (callback) {
callback(true);
}
};
var mPeer = connection.multiPeersHandler;
function onMessagesCallback(message) {
if (message.remoteUserId != connection.userid) return;
if (connection.peers[message.sender] && connection.peers[message.sender].extra != message.message.extra) {
connection.peers[message.sender].extra = message.message.extra;
connection.onExtraDataUpdated({
userid: message.sender,
extra: message.message.extra
});
}
if (message.message.streamSyncNeeded && connection.peers[message.sender]) {
var stream = connection.streamEvents[message.message.streamid];
if (!stream || !stream.stream) {
return;
}
var action = message.message.action;
if (action === 'ended' || action === 'stream-removed') {
connection.onstreamended(stream);
return;
}
var type = message.message.type != 'both' ? message.message.type : null;
stream.stream[action](type);
return;
}
if (message.message === 'connectWithAllParticipants') {
if (connection.broadcasters.indexOf(message.sender) === -1) {
connection.broadcasters.push(message.sender);
}
mPeer.onNegotiationNeeded({
allParticipants: connection.getAllParticipants(message.sender)
}, message.sender);
return;
}
if (message.message === 'removeFromBroadcastersList') {
if (connection.broadcasters.indexOf(message.sender) !== -1) {
delete connection.broadcasters[connection.broadcasters.indexOf(message.sender)];
connection.broadcasters = removeNullEntries(connection.broadcasters);
}
return;
}
if (message.message === 'dropPeerConnection') {
connection.deletePeer(message.sender);
return;
}
if (message.message.allParticipants) {
if (message.message.allParticipants.indexOf(message.sender) === -1) {
message.message.allParticipants.push(message.sender);
}
message.message.allParticipants.forEach(function(participant) {
mPeer[!connection.peers[participant] ? 'createNewPeer' : 'renegotiatePeer'](participant, {
localPeerSdpConstraints: {
OfferToReceiveAudio: connection.sdpConstraints.mandatory.OfferToReceiveAudio,
OfferToReceiveVideo: connection.sdpConstraints.mandatory.OfferToReceiveVideo
},
remotePeerSdpConstraints: {
OfferToReceiveAudio: connection.session.oneway ? !!connection.session.audio : connection.sdpConstraints.mandatory.OfferToReceiveAudio,
OfferToReceiveVideo: connection.session.oneway ? !!connection.session.video || !!connection.session.screen : connection.sdpConstraints.mandatory.OfferToReceiveVideo
},
isOneWay: !!connection.session.oneway || connection.direction === 'one-way',
isDataOnly: isData(connection.session)
});
});
return;
}
if (message.message.newParticipant) {
if (message.message.newParticipant == connection.userid) return;
if (!!connection.peers[message.message.newParticipant]) return;
mPeer.createNewPeer(message.message.newParticipant, message.message.userPreferences || {
localPeerSdpConstraints: {
OfferToReceiveAudio: connection.sdpConstraints.mandatory.OfferToReceiveAudio,
OfferToReceiveVideo: connection.sdpConstraints.mandatory.OfferToReceiveVideo
},
remotePeerSdpConstraints: {
OfferToReceiveAudio: connection.session.oneway ? !!connection.session.audio : connection.sdpConstraints.mandatory.OfferToReceiveAudio,
OfferToReceiveVideo: connection.session.oneway ? !!connection.session.video || !!connection.session.screen : connection.sdpConstraints.mandatory.OfferToReceiveVideo
},
isOneWay: !!connection.session.oneway || connection.direction === 'one-way',
isDataOnly: isData(connection.session)
});
return;
}
if (message.message.readyForOffer || message.message.addMeAsBroadcaster) {
connection.addNewBroadcaster(message.sender);
}
if (message.message.newParticipationRequest && message.sender !== connection.userid) {
if (connection.peers[message.sender]) {
connection.deletePeer(message.sender);
}
var userPreferences = {
extra: message.message.extra || {},
localPeerSdpConstraints: message.message.remotePeerSdpConstraints || {
OfferToReceiveAudio: connection.sdpConstraints.mandatory.OfferToReceiveAudio,
OfferToReceiveVideo: connection.sdpConstraints.mandatory.OfferToReceiveVideo
},
remotePeerSdpConstraints: message.message.localPeerSdpConstraints || {
OfferToReceiveAudio: connection.session.oneway ? !!connection.session.audio : connection.sdpConstraints.mandatory.OfferToReceiveAudio,
OfferToReceiveVideo: connection.session.oneway ? !!connection.session.video || !!connection.session.screen : connection.sdpConstraints.mandatory.OfferToReceiveVideo
},
isOneWay: typeof message.message.isOneWay !== 'undefined' ? message.message.isOneWay : !!connection.session.oneway || connection.direction === 'one-way',
isDataOnly: typeof message.message.isDataOnly !== 'undefined' ? message.message.isDataOnly : isData(connection.session),
dontGetRemoteStream: typeof message.message.isOneWay !== 'undefined' ? message.message.isOneWay : !!connection.session.oneway || connection.direction === 'one-way',
dontAttachLocalStream: !!message.message.dontGetRemoteStream,
connectionDescription: message,
successCallback: function() {
// if its oneway----- todo: THIS SEEMS NOT IMPORTANT.
if (typeof message.message.isOneWay !== 'undefined' ? message.message.isOneWay : !!connection.session.oneway || connection.direction === 'one-way') {
connection.addNewBroadcaster(message.sender, userPreferences);
}
if (!!connection.session.oneway || connection.direction === 'one-way' || isData(connection.session)) {
connection.addNewBroadcaster(message.sender, userPreferences);
}
}
};
connection.onNewParticipant(message.sender, userPreferences);
return;
}
if (message.message.shiftedModerationControl) {
connection.onShiftedModerationControl(message.sender, message.message.broadcasters);
return;
}
if (message.message.changedUUID) {
if (connection.peers[message.message.oldUUID]) {
connection.peers[message.message.newUUID] = connection.peers[message.message.oldUUID];
delete connection.peers[message.message.oldUUID];
}
}
if (message.message.userLeft) {
mPeer.onUserLeft(message.sender);
if (!!message.message.autoCloseEntireSession) {
connection.leave();
}
return;
}
mPeer.addNegotiatedMessage(message.message, message.sender);
}
window.addEventListener('beforeunload', function() {
connection.socket.emit('presence', {
userid: connection.userid,
isOnline: false
});
}, false);
} | [
"function",
"SipConnection",
"(",
"connection",
",",
"connectCallback",
")",
"{",
"function",
"isData",
"(",
"session",
")",
"{",
"return",
"!",
"session",
".",
"audio",
"&&",
"!",
"session",
".",
"video",
"&&",
"!",
"session",
".",
"screen",
"&&",
"sessio... | github.com/muaz-khan/RTCMultiConnection/issues/ => #137 and #706 | [
"github",
".",
"com",
"/",
"muaz",
"-",
"khan",
"/",
"RTCMultiConnection",
"/",
"issues",
"/",
"=",
">",
"#137",
"and",
"#706"
] | 2032ce949bde30b43a3d2666e0f1e5afbf337f3d | https://github.com/muaz-khan/RTCMultiConnection/blob/2032ce949bde30b43a3d2666e0f1e5afbf337f3d/dev/SipConnection.js#L3-L254 | train | SIP Connection | [
30522,
3853,
10668,
8663,
2638,
7542,
1006,
4434,
1010,
7532,
9289,
20850,
8684,
1007,
1063,
3853,
2003,
2850,
2696,
1006,
5219,
1007,
1063,
2709,
999,
5219,
1012,
5746,
1004,
1004,
999,
5219,
1012,
2678,
1004,
1004,
999,
5219,
1012,
3898... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
MoePlayer/DPlayer | demo/modernizr.js | computedStyle | function computedStyle(elem, pseudo, prop) {
var result;
if ('getComputedStyle' in window) {
result = getComputedStyle.call(window, elem, pseudo);
var console = window.console;
if (result !== null) {
if (prop) {
result = result.getPropertyValue(prop);
}
} else {
if (console) {
var method = console.error ? 'error' : 'log';
console[method].call(console, 'getComputedStyle returning null, its possible modernizr test results are inaccurate');
}
}
} else {
result = !pseudo && elem.currentStyle && elem.currentStyle[prop];
}
return result;
} | javascript | function computedStyle(elem, pseudo, prop) {
var result;
if ('getComputedStyle' in window) {
result = getComputedStyle.call(window, elem, pseudo);
var console = window.console;
if (result !== null) {
if (prop) {
result = result.getPropertyValue(prop);
}
} else {
if (console) {
var method = console.error ? 'error' : 'log';
console[method].call(console, 'getComputedStyle returning null, its possible modernizr test results are inaccurate');
}
}
} else {
result = !pseudo && elem.currentStyle && elem.currentStyle[prop];
}
return result;
} | [
"function",
"computedStyle",
"(",
"elem",
",",
"pseudo",
",",
"prop",
")",
"{",
"var",
"result",
";",
"if",
"(",
"'getComputedStyle'",
"in",
"window",
")",
"{",
"result",
"=",
"getComputedStyle",
".",
"call",
"(",
"window",
",",
"elem",
",",
"pseudo",
")... | wrapper around getComputedStyle, to fix issues with Firefox returning null when
called inside of a hidden iframe
@access private
@function computedStyle
@param {HTMLElement|SVGElement} - The element we want to find the computed styles of
@param {string|null} [pseudoSelector]- An optional pseudo element selector (e.g. :before), of null if none
@returns {CSSStyleDeclaration} | [
"wrapper",
"around",
"getComputedStyle",
"to",
"fix",
"issues",
"with",
"Firefox",
"returning",
"null",
"when",
"called",
"inside",
"of",
"a",
"hidden",
"iframe"
] | f5c53f082634a6e5af56cfc72978ad7bad49b989 | https://github.com/MoePlayer/DPlayer/blob/f5c53f082634a6e5af56cfc72978ad7bad49b989/demo/modernizr.js#L817-L839 | train | Returns computed style of an element | [
30522,
3853,
24806,
21756,
2571,
1006,
3449,
6633,
1010,
18404,
1010,
17678,
1007,
1063,
13075,
2765,
1025,
2065,
1006,
1005,
2131,
9006,
29462,
21756,
2571,
1005,
1999,
3332,
1007,
1063,
2765,
1027,
2131,
9006,
29462,
21756,
2571,
1012,
26... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
grpc/grpc | examples/node/dynamic_codegen/route_guide/route_guide_server.js | checkFeature | function checkFeature(point) {
var feature;
// Check if there is already a feature object for the given point
for (var i = 0; i < feature_list.length; i++) {
feature = feature_list[i];
if (feature.location.latitude === point.latitude &&
feature.location.longitude === point.longitude) {
return feature;
}
}
var name = '';
feature = {
name: name,
location: point
};
return feature;
} | javascript | function checkFeature(point) {
var feature;
// Check if there is already a feature object for the given point
for (var i = 0; i < feature_list.length; i++) {
feature = feature_list[i];
if (feature.location.latitude === point.latitude &&
feature.location.longitude === point.longitude) {
return feature;
}
}
var name = '';
feature = {
name: name,
location: point
};
return feature;
} | [
"function",
"checkFeature",
"(",
"point",
")",
"{",
"var",
"feature",
";",
"// Check if there is already a feature object for the given point",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"feature_list",
".",
"length",
";",
"i",
"++",
")",
"{",
"feature",
... | Get a feature object at the given point, or creates one if it does not exist.
@param {point} point The point to check
@return {feature} The feature object at the point. Note that an empty name
indicates no feature | [
"Get",
"a",
"feature",
"object",
"at",
"the",
"given",
"point",
"or",
"creates",
"one",
"if",
"it",
"does",
"not",
"exist",
"."
] | cc75d93818410e2b0edd0fa3009a6def9ac403ca | https://github.com/grpc/grpc/blob/cc75d93818410e2b0edd0fa3009a6def9ac403ca/examples/node/dynamic_codegen/route_guide/route_guide_server.js#L57-L73 | train | Check if a feature object exists for the given point | [
30522,
3853,
4638,
7959,
4017,
5397,
1006,
2391,
1007,
1063,
13075,
3444,
1025,
1013,
1013,
4638,
2065,
2045,
2003,
2525,
1037,
3444,
4874,
2005,
1996,
2445,
2391,
2005,
1006,
13075,
1045,
1027,
1014,
1025,
1045,
1026,
3444,
1035,
2862,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
ColorlibHQ/AdminLTE | bower_components/ion.rangeSlider/js/ion.rangeSlider.js | function (e) {
if (!this.target) {
var x;
var $handle;
if (this.options.type === "single") {
$handle = this.$cache.single;
} else {
$handle = this.$cache.from;
}
x = $handle.offset().left;
x += ($handle.width() / 2) - 1;
this.pointerClick("single", {preventDefault: function () {}, pageX: x});
}
} | javascript | function (e) {
if (!this.target) {
var x;
var $handle;
if (this.options.type === "single") {
$handle = this.$cache.single;
} else {
$handle = this.$cache.from;
}
x = $handle.offset().left;
x += ($handle.width() / 2) - 1;
this.pointerClick("single", {preventDefault: function () {}, pageX: x});
}
} | [
"function",
"(",
"e",
")",
"{",
"if",
"(",
"!",
"this",
".",
"target",
")",
"{",
"var",
"x",
";",
"var",
"$handle",
";",
"if",
"(",
"this",
".",
"options",
".",
"type",
"===",
"\"single\"",
")",
"{",
"$handle",
"=",
"this",
".",
"$cache",
".",
... | Focus with tabIndex
@param e {Object} event object | [
"Focus",
"with",
"tabIndex"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/bower_components/ion.rangeSlider/js/ion.rangeSlider.js#L742-L758 | train | handle mouse click | [
30522,
3853,
1006,
1041,
1007,
1063,
2065,
1006,
999,
2023,
1012,
4539,
1007,
1063,
13075,
1060,
1025,
13075,
1002,
5047,
1025,
2065,
1006,
2023,
1012,
7047,
1012,
2828,
1027,
1027,
1027,
1000,
2309,
1000,
1007,
1063,
1002,
5047,
1027,
20... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
laurent22/joplin | Clipper/joplin-webclipper/content_scripts/Readability.js | function(doc) {
this._removeNodes(doc.getElementsByTagName('script'), function(scriptNode) {
scriptNode.nodeValue = "";
scriptNode.removeAttribute('src');
return true;
});
this._removeNodes(doc.getElementsByTagName('noscript'));
} | javascript | function(doc) {
this._removeNodes(doc.getElementsByTagName('script'), function(scriptNode) {
scriptNode.nodeValue = "";
scriptNode.removeAttribute('src');
return true;
});
this._removeNodes(doc.getElementsByTagName('noscript'));
} | [
"function",
"(",
"doc",
")",
"{",
"this",
".",
"_removeNodes",
"(",
"doc",
".",
"getElementsByTagName",
"(",
"'script'",
")",
",",
"function",
"(",
"scriptNode",
")",
"{",
"scriptNode",
".",
"nodeValue",
"=",
"\"\"",
";",
"scriptNode",
".",
"removeAttribute"... | Removes script tags from the document.
@param Element | [
"Removes",
"script",
"tags",
"from",
"the",
"document",
"."
] | beb428b246cecba4630a3ca57b472f43c0933a43 | https://github.com/laurent22/joplin/blob/beb428b246cecba4630a3ca57b472f43c0933a43/Clipper/joplin-webclipper/content_scripts/Readability.js#L1268-L1275 | train | Remove all script tags | [
30522,
3853,
1006,
9986,
1007,
1063,
2023,
1012,
1035,
6366,
3630,
6155,
1006,
9986,
1012,
2131,
12260,
8163,
3762,
15900,
18442,
1006,
1005,
5896,
1005,
1007,
1010,
3853,
1006,
5896,
3630,
3207,
1007,
1063,
5896,
3630,
3207,
1012,
13045,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
lovell/sharp | lib/operation.js | median | function median (size) {
if (!is.defined(size)) {
// No arguments: default to 3x3
this.options.medianSize = 3;
} else if (is.integer(size) && is.inRange(size, 1, 1000)) {
// Numeric argument: specific sigma
this.options.medianSize = size;
} else {
throw new Error('Invalid median size ' + size);
}
return this;
} | javascript | function median (size) {
if (!is.defined(size)) {
// No arguments: default to 3x3
this.options.medianSize = 3;
} else if (is.integer(size) && is.inRange(size, 1, 1000)) {
// Numeric argument: specific sigma
this.options.medianSize = size;
} else {
throw new Error('Invalid median size ' + size);
}
return this;
} | [
"function",
"median",
"(",
"size",
")",
"{",
"if",
"(",
"!",
"is",
".",
"defined",
"(",
"size",
")",
")",
"{",
"// No arguments: default to 3x3",
"this",
".",
"options",
".",
"medianSize",
"=",
"3",
";",
"}",
"else",
"if",
"(",
"is",
".",
"integer",
... | Apply median filter.
When used without parameters the default window is 3x3.
@param {Number} [size=3] square mask size: size x size
@returns {Sharp}
@throws {Error} Invalid parameters | [
"Apply",
"median",
"filter",
".",
"When",
"used",
"without",
"parameters",
"the",
"default",
"window",
"is",
"3x3",
"."
] | 05d76eeadfe54713606a615185b2da047923406b | https://github.com/lovell/sharp/blob/05d76eeadfe54713606a615185b2da047923406b/lib/operation.js#L136-L147 | train | Returns a new instance of the Centroid with the median value. | [
30522,
3853,
3991,
1006,
2946,
1007,
1063,
2065,
1006,
999,
2003,
1012,
4225,
1006,
2946,
1007,
1007,
1063,
1013,
1013,
2053,
9918,
1024,
12398,
2000,
1017,
2595,
2509,
2023,
1012,
7047,
1012,
3991,
5332,
4371,
1027,
1017,
1025,
1065,
284... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
showdownjs/showdown | dist/showdown.js | getDefaultOpts | function getDefaultOpts (simple) {
'use strict';
var defaultOptions = {
omitExtraWLInCodeBlocks: {
defaultValue: false,
describe: 'Omit the default extra whiteline added to code blocks',
type: 'boolean'
},
noHeaderId: {
defaultValue: false,
describe: 'Turn on/off generated header id',
type: 'boolean'
},
prefixHeaderId: {
defaultValue: false,
describe: 'Add a prefix to the generated header ids. Passing a string will prefix that string to the header id. Setting to true will add a generic \'section-\' prefix',
type: 'string'
},
rawPrefixHeaderId: {
defaultValue: false,
describe: 'Setting this option to true will prevent showdown from modifying the prefix. This might result in malformed IDs (if, for instance, the " char is used in the prefix)',
type: 'boolean'
},
ghCompatibleHeaderId: {
defaultValue: false,
describe: 'Generate header ids compatible with github style (spaces are replaced with dashes, a bunch of non alphanumeric chars are removed)',
type: 'boolean'
},
rawHeaderId: {
defaultValue: false,
describe: 'Remove only spaces, \' and " from generated header ids (including prefixes), replacing them with dashes (-). WARNING: This might result in malformed ids',
type: 'boolean'
},
headerLevelStart: {
defaultValue: false,
describe: 'The header blocks level start',
type: 'integer'
},
parseImgDimensions: {
defaultValue: false,
describe: 'Turn on/off image dimension parsing',
type: 'boolean'
},
simplifiedAutoLink: {
defaultValue: false,
describe: 'Turn on/off GFM autolink style',
type: 'boolean'
},
literalMidWordUnderscores: {
defaultValue: false,
describe: 'Parse midword underscores as literal underscores',
type: 'boolean'
},
literalMidWordAsterisks: {
defaultValue: false,
describe: 'Parse midword asterisks as literal asterisks',
type: 'boolean'
},
strikethrough: {
defaultValue: false,
describe: 'Turn on/off strikethrough support',
type: 'boolean'
},
tables: {
defaultValue: false,
describe: 'Turn on/off tables support',
type: 'boolean'
},
tablesHeaderId: {
defaultValue: false,
describe: 'Add an id to table headers',
type: 'boolean'
},
ghCodeBlocks: {
defaultValue: true,
describe: 'Turn on/off GFM fenced code blocks support',
type: 'boolean'
},
tasklists: {
defaultValue: false,
describe: 'Turn on/off GFM tasklist support',
type: 'boolean'
},
smoothLivePreview: {
defaultValue: false,
describe: 'Prevents weird effects in live previews due to incomplete input',
type: 'boolean'
},
smartIndentationFix: {
defaultValue: false,
description: 'Tries to smartly fix indentation in es6 strings',
type: 'boolean'
},
disableForced4SpacesIndentedSublists: {
defaultValue: false,
description: 'Disables the requirement of indenting nested sublists by 4 spaces',
type: 'boolean'
},
simpleLineBreaks: {
defaultValue: false,
description: 'Parses simple line breaks as <br> (GFM Style)',
type: 'boolean'
},
requireSpaceBeforeHeadingText: {
defaultValue: false,
description: 'Makes adding a space between `#` and the header text mandatory (GFM Style)',
type: 'boolean'
},
ghMentions: {
defaultValue: false,
description: 'Enables github @mentions',
type: 'boolean'
},
ghMentionsLink: {
defaultValue: 'https://github.com/{u}',
description: 'Changes the link generated by @mentions. Only applies if ghMentions option is enabled.',
type: 'string'
},
encodeEmails: {
defaultValue: true,
description: 'Encode e-mail addresses through the use of Character Entities, transforming ASCII e-mail addresses into its equivalent decimal entities',
type: 'boolean'
},
openLinksInNewWindow: {
defaultValue: false,
description: 'Open all links in new windows',
type: 'boolean'
},
backslashEscapesHTMLTags: {
defaultValue: false,
description: 'Support for HTML Tag escaping. ex: \<div>foo\</div>',
type: 'boolean'
},
emoji: {
defaultValue: false,
description: 'Enable emoji support. Ex: `this is a :smile: emoji`',
type: 'boolean'
},
underline: {
defaultValue: false,
description: 'Enable support for underline. Syntax is double or triple underscores: `__underline word__`. With this option enabled, underscores no longer parses into `<em>` and `<strong>`',
type: 'boolean'
},
completeHTMLDocument: {
defaultValue: false,
description: 'Outputs a complete html document, including `<html>`, `<head>` and `<body>` tags',
type: 'boolean'
},
metadata: {
defaultValue: false,
description: 'Enable support for document metadata (defined at the top of the document between `«««` and `»»»` or between `---` and `---`).',
type: 'boolean'
},
splitAdjacentBlockquotes: {
defaultValue: false,
description: 'Split adjacent blockquote blocks',
type: 'boolean'
}
};
if (simple === false) {
return JSON.parse(JSON.stringify(defaultOptions));
}
var ret = {};
for (var opt in defaultOptions) {
if (defaultOptions.hasOwnProperty(opt)) {
ret[opt] = defaultOptions[opt].defaultValue;
}
}
return ret;
} | javascript | function getDefaultOpts (simple) {
'use strict';
var defaultOptions = {
omitExtraWLInCodeBlocks: {
defaultValue: false,
describe: 'Omit the default extra whiteline added to code blocks',
type: 'boolean'
},
noHeaderId: {
defaultValue: false,
describe: 'Turn on/off generated header id',
type: 'boolean'
},
prefixHeaderId: {
defaultValue: false,
describe: 'Add a prefix to the generated header ids. Passing a string will prefix that string to the header id. Setting to true will add a generic \'section-\' prefix',
type: 'string'
},
rawPrefixHeaderId: {
defaultValue: false,
describe: 'Setting this option to true will prevent showdown from modifying the prefix. This might result in malformed IDs (if, for instance, the " char is used in the prefix)',
type: 'boolean'
},
ghCompatibleHeaderId: {
defaultValue: false,
describe: 'Generate header ids compatible with github style (spaces are replaced with dashes, a bunch of non alphanumeric chars are removed)',
type: 'boolean'
},
rawHeaderId: {
defaultValue: false,
describe: 'Remove only spaces, \' and " from generated header ids (including prefixes), replacing them with dashes (-). WARNING: This might result in malformed ids',
type: 'boolean'
},
headerLevelStart: {
defaultValue: false,
describe: 'The header blocks level start',
type: 'integer'
},
parseImgDimensions: {
defaultValue: false,
describe: 'Turn on/off image dimension parsing',
type: 'boolean'
},
simplifiedAutoLink: {
defaultValue: false,
describe: 'Turn on/off GFM autolink style',
type: 'boolean'
},
literalMidWordUnderscores: {
defaultValue: false,
describe: 'Parse midword underscores as literal underscores',
type: 'boolean'
},
literalMidWordAsterisks: {
defaultValue: false,
describe: 'Parse midword asterisks as literal asterisks',
type: 'boolean'
},
strikethrough: {
defaultValue: false,
describe: 'Turn on/off strikethrough support',
type: 'boolean'
},
tables: {
defaultValue: false,
describe: 'Turn on/off tables support',
type: 'boolean'
},
tablesHeaderId: {
defaultValue: false,
describe: 'Add an id to table headers',
type: 'boolean'
},
ghCodeBlocks: {
defaultValue: true,
describe: 'Turn on/off GFM fenced code blocks support',
type: 'boolean'
},
tasklists: {
defaultValue: false,
describe: 'Turn on/off GFM tasklist support',
type: 'boolean'
},
smoothLivePreview: {
defaultValue: false,
describe: 'Prevents weird effects in live previews due to incomplete input',
type: 'boolean'
},
smartIndentationFix: {
defaultValue: false,
description: 'Tries to smartly fix indentation in es6 strings',
type: 'boolean'
},
disableForced4SpacesIndentedSublists: {
defaultValue: false,
description: 'Disables the requirement of indenting nested sublists by 4 spaces',
type: 'boolean'
},
simpleLineBreaks: {
defaultValue: false,
description: 'Parses simple line breaks as <br> (GFM Style)',
type: 'boolean'
},
requireSpaceBeforeHeadingText: {
defaultValue: false,
description: 'Makes adding a space between `#` and the header text mandatory (GFM Style)',
type: 'boolean'
},
ghMentions: {
defaultValue: false,
description: 'Enables github @mentions',
type: 'boolean'
},
ghMentionsLink: {
defaultValue: 'https://github.com/{u}',
description: 'Changes the link generated by @mentions. Only applies if ghMentions option is enabled.',
type: 'string'
},
encodeEmails: {
defaultValue: true,
description: 'Encode e-mail addresses through the use of Character Entities, transforming ASCII e-mail addresses into its equivalent decimal entities',
type: 'boolean'
},
openLinksInNewWindow: {
defaultValue: false,
description: 'Open all links in new windows',
type: 'boolean'
},
backslashEscapesHTMLTags: {
defaultValue: false,
description: 'Support for HTML Tag escaping. ex: \<div>foo\</div>',
type: 'boolean'
},
emoji: {
defaultValue: false,
description: 'Enable emoji support. Ex: `this is a :smile: emoji`',
type: 'boolean'
},
underline: {
defaultValue: false,
description: 'Enable support for underline. Syntax is double or triple underscores: `__underline word__`. With this option enabled, underscores no longer parses into `<em>` and `<strong>`',
type: 'boolean'
},
completeHTMLDocument: {
defaultValue: false,
description: 'Outputs a complete html document, including `<html>`, `<head>` and `<body>` tags',
type: 'boolean'
},
metadata: {
defaultValue: false,
description: 'Enable support for document metadata (defined at the top of the document between `«««` and `»»»` or between `---` and `---`).',
type: 'boolean'
},
splitAdjacentBlockquotes: {
defaultValue: false,
description: 'Split adjacent blockquote blocks',
type: 'boolean'
}
};
if (simple === false) {
return JSON.parse(JSON.stringify(defaultOptions));
}
var ret = {};
for (var opt in defaultOptions) {
if (defaultOptions.hasOwnProperty(opt)) {
ret[opt] = defaultOptions[opt].defaultValue;
}
}
return ret;
} | [
"function",
"getDefaultOpts",
"(",
"simple",
")",
"{",
"'use strict'",
";",
"var",
"defaultOptions",
"=",
"{",
"omitExtraWLInCodeBlocks",
":",
"{",
"defaultValue",
":",
"false",
",",
"describe",
":",
"'Omit the default extra whiteline added to code blocks'",
",",
"type"... | Created by Tivie on 13-07-2015. | [
"Created",
"by",
"Tivie",
"on",
"13",
"-",
"07",
"-",
"2015",
"."
] | 33bba54535d6fcdde5c82d2ec4d7a3bd951b5bb9 | https://github.com/showdownjs/showdown/blob/33bba54535d6fcdde5c82d2ec4d7a3bd951b5bb9/dist/showdown.js#L7-L177 | train | Get the default options for the cgengen | [
30522,
3853,
2131,
3207,
7011,
11314,
7361,
3215,
1006,
3722,
1007,
1063,
1005,
2224,
9384,
1005,
1025,
13075,
30524,
10175,
5657,
1024,
6270,
1010,
6235,
1024,
1005,
18168,
4183,
1996,
12398,
4469,
2317,
4179,
2794,
2000,
3642,
5991,
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... |
Freeboard/freeboard | js/freeboard.thirdparty.js | function(inst) {
var onChange = this._get(inst, "onChangeMonthYear");
if (onChange) {
onChange.apply((inst.input ? inst.input[0] : null),
[inst.selectedYear, inst.selectedMonth + 1, inst]);
}
} | javascript | function(inst) {
var onChange = this._get(inst, "onChangeMonthYear");
if (onChange) {
onChange.apply((inst.input ? inst.input[0] : null),
[inst.selectedYear, inst.selectedMonth + 1, inst]);
}
} | [
"function",
"(",
"inst",
")",
"{",
"var",
"onChange",
"=",
"this",
".",
"_get",
"(",
"inst",
",",
"\"onChangeMonthYear\"",
")",
";",
"if",
"(",
"onChange",
")",
"{",
"onChange",
".",
"apply",
"(",
"(",
"inst",
".",
"input",
"?",
"inst",
".",
"input",... | /* Notify change of month/year. | [
"/",
"*",
"Notify",
"change",
"of",
"month",
"/",
"year",
"."
] | 38789f6e8bd3d04f7d3b2c3427e509d00f2610fc | https://github.com/Freeboard/freeboard/blob/38789f6e8bd3d04f7d3b2c3427e509d00f2610fc/js/freeboard.thirdparty.js#L9476-L9482 | train | Called when the month of the calendar is changed. | [
30522,
3853,
1006,
16021,
2102,
1007,
1063,
13075,
2006,
22305,
2063,
1027,
2023,
1012,
1035,
2131,
1006,
16021,
2102,
1010,
1000,
2006,
22305,
26941,
16921,
14644,
1000,
1007,
1025,
2065,
1006,
2006,
22305,
2063,
1007,
1063,
2006,
22305,
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... | |
dcloudio/mui | examples/login/libs/easymob-webim-sdk/strophe-custom-2.0.0.js | function() {
Strophe.info("Websocket open");
var start = this._buildStream();
this._conn.xmlOutput(start.tree());
var startString = Strophe.serialize(start);
this._conn.rawOutput(startString);
this.socket.send(startString);
} | javascript | function() {
Strophe.info("Websocket open");
var start = this._buildStream();
this._conn.xmlOutput(start.tree());
var startString = Strophe.serialize(start);
this._conn.rawOutput(startString);
this.socket.send(startString);
} | [
"function",
"(",
")",
"{",
"Strophe",
".",
"info",
"(",
"\"Websocket open\"",
")",
";",
"var",
"start",
"=",
"this",
".",
"_buildStream",
"(",
")",
";",
"this",
".",
"_conn",
".",
"xmlOutput",
"(",
"start",
".",
"tree",
"(",
")",
")",
";",
"var",
"... | PrivateFunction: _onOpen
_Private_ function to handle websockets connection setup.
The opening stream tag is sent here. | [
"PrivateFunction",
":",
"_onOpen",
"_Private_",
"function",
"to",
"handle",
"websockets",
"connection",
"setup",
"."
] | ff74c90a1671a552f3604b1288bf38a4126312d0 | https://github.com/dcloudio/mui/blob/ff74c90a1671a552f3604b1288bf38a4126312d0/examples/login/libs/easymob-webim-sdk/strophe-custom-2.0.0.js#L5175-L5183 | train | Send the start of the next token | [
30522,
3853,
1006,
1007,
1063,
2358,
18981,
5369,
1012,
18558,
1006,
1000,
4773,
6499,
19869,
2102,
2330,
1000,
1007,
1025,
13075,
2707,
1027,
2023,
1012,
1035,
16473,
25379,
1006,
1007,
1025,
2023,
1012,
1035,
9530,
2078,
1012,
20950,
5833... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | src/sap.ui.support/src/sap/ui/support/supportRules/ui/controllers/Analysis.controller.js | function (tempRule, treeTable) {
var ruleSource = this.model.getProperty("/editRuleSource");
for (var i in treeTable) {
if (treeTable[i].name === Constants.TEMP_RULESETS_NAME) {
for (var innerIndex in treeTable[i].nodes) {
if (treeTable[i].nodes[innerIndex].id === ruleSource.id) {
treeTable[i].nodes[innerIndex] = {
name: tempRule.title,
description: tempRule.description,
id: tempRule.id,
audiences: tempRule.audiences,
categories: tempRule.categories,
minversion: tempRule.minversion,
resolution: tempRule.resolution,
selected: treeTable[i].nodes[innerIndex].selected,
title: tempRule.title,
libName: treeTable[i].name,
check: tempRule.check
};
}
}
}
}
} | javascript | function (tempRule, treeTable) {
var ruleSource = this.model.getProperty("/editRuleSource");
for (var i in treeTable) {
if (treeTable[i].name === Constants.TEMP_RULESETS_NAME) {
for (var innerIndex in treeTable[i].nodes) {
if (treeTable[i].nodes[innerIndex].id === ruleSource.id) {
treeTable[i].nodes[innerIndex] = {
name: tempRule.title,
description: tempRule.description,
id: tempRule.id,
audiences: tempRule.audiences,
categories: tempRule.categories,
minversion: tempRule.minversion,
resolution: tempRule.resolution,
selected: treeTable[i].nodes[innerIndex].selected,
title: tempRule.title,
libName: treeTable[i].name,
check: tempRule.check
};
}
}
}
}
} | [
"function",
"(",
"tempRule",
",",
"treeTable",
")",
"{",
"var",
"ruleSource",
"=",
"this",
".",
"model",
".",
"getProperty",
"(",
"\"/editRuleSource\"",
")",
";",
"for",
"(",
"var",
"i",
"in",
"treeTable",
")",
"{",
"if",
"(",
"treeTable",
"[",
"i",
"]... | Keeps in sync the TreeViewModel for temporary rules that we use for visualisation of sap.m.TreeTable and the model that we use in the SuppportAssistant
@param {Object} tempRule Temporary rule
@param {Object} treeTable Model for sap.m.TreeTable visualization | [
"Keeps",
"in",
"sync",
"the",
"TreeViewModel",
"for",
"temporary",
"rules",
"that",
"we",
"use",
"for",
"visualisation",
"of",
"sap",
".",
"m",
".",
"TreeTable",
"and",
"the",
"model",
"that",
"we",
"use",
"in",
"the",
"SuppportAssistant"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.support/src/sap/ui/support/supportRules/ui/controllers/Analysis.controller.js#L521-L544 | train | This function is called to update the tree table of rules | [
30522,
3853,
1006,
8915,
8737,
6820,
2571,
1010,
3392,
10880,
1007,
1063,
13075,
3513,
8162,
3401,
1027,
2023,
1012,
2944,
1012,
2131,
21572,
4842,
3723,
1006,
1000,
1013,
10086,
6820,
4244,
8162,
3401,
1000,
1007,
1025,
2005,
1006,
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... | |
SAP/openui5 | src/sap.m/src/sap/m/TileContainer.js | handleAriaSize | function handleAriaSize (aVisibleTiles) {
var iTilesCount,
i,
oTile;
aVisibleTiles = aVisibleTiles || this._getVisibleTiles();
iTilesCount = aVisibleTiles.length;
for (i = 0; i < iTilesCount; i++) {
oTile = aVisibleTiles[i];
if (oTile._rendered && oTile.getDomRef()) {
oTile.getDomRef().setAttribute("aria-setsize", iTilesCount);
}
}
} | javascript | function handleAriaSize (aVisibleTiles) {
var iTilesCount,
i,
oTile;
aVisibleTiles = aVisibleTiles || this._getVisibleTiles();
iTilesCount = aVisibleTiles.length;
for (i = 0; i < iTilesCount; i++) {
oTile = aVisibleTiles[i];
if (oTile._rendered && oTile.getDomRef()) {
oTile.getDomRef().setAttribute("aria-setsize", iTilesCount);
}
}
} | [
"function",
"handleAriaSize",
"(",
"aVisibleTiles",
")",
"{",
"var",
"iTilesCount",
",",
"i",
",",
"oTile",
";",
"aVisibleTiles",
"=",
"aVisibleTiles",
"||",
"this",
".",
"_getVisibleTiles",
"(",
")",
";",
"iTilesCount",
"=",
"aVisibleTiles",
".",
"length",
";... | Handles the WAI ARIA property aria-setsize after a change in the TileContainer.
@private | [
"Handles",
"the",
"WAI",
"ARIA",
"property",
"aria",
"-",
"setsize",
"after",
"a",
"change",
"in",
"the",
"TileContainer",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/TileContainer.js#L2141-L2155 | train | Sets the aria - setsize attribute on all tiles | [
30522,
3853,
5047,
10980,
5332,
4371,
1006,
20704,
17417,
3468,
15286,
2015,
1007,
1063,
13075,
2009,
9463,
9363,
16671,
1010,
1045,
1010,
27178,
9463,
1025,
20704,
17417,
3468,
15286,
2015,
1027,
20704,
17417,
3468,
15286,
2015,
1064,
1064,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/extensibility/node/package-validator.js | containsWords | function containsWords(wordlist, str) {
var i;
var matches = [];
for (i = 0; i < wordlist.length; i++) {
var re = new RegExp("\\b" + wordlist[i] + "\\b", "i");
if (re.exec(str)) {
matches.push(wordlist[i]);
}
}
return matches;
} | javascript | function containsWords(wordlist, str) {
var i;
var matches = [];
for (i = 0; i < wordlist.length; i++) {
var re = new RegExp("\\b" + wordlist[i] + "\\b", "i");
if (re.exec(str)) {
matches.push(wordlist[i]);
}
}
return matches;
} | [
"function",
"containsWords",
"(",
"wordlist",
",",
"str",
")",
"{",
"var",
"i",
";",
"var",
"matches",
"=",
"[",
"]",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"wordlist",
".",
"length",
";",
"i",
"++",
")",
"{",
"var",
"re",
"=",
"new",
... | Determines if any of the words in wordlist appear in str.
@param {String[]} wordlist list of words to check
@param {String} str to check for words
@return {String[]} words that matched | [
"Determines",
"if",
"any",
"of",
"the",
"words",
"in",
"wordlist",
"appear",
"in",
"str",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensibility/node/package-validator.js#L131-L141 | train | Check if a string contains any of the words | [
30522,
3853,
3397,
22104,
1006,
2773,
9863,
1010,
2358,
2099,
1007,
1063,
13075,
1045,
1025,
13075,
3503,
1027,
1031,
1033,
1025,
2005,
1006,
1045,
1027,
1014,
1025,
1045,
1026,
2773,
9863,
1012,
3091,
1025,
1045,
1009,
1009,
1007,
1063,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
exceljs/exceljs | lib/doc/defined-names.js | hGrow | function hGrow(xx, edge) {
const cells = [];
for (y = range.top; y <= range.bottom; y++) {
const c = matrix.findCellAt(sheetName, y, xx);
if (c && c.mark) {
cells.push(c);
} else {
return false;
}
}
range[edge] = xx;
for (let i = 0; i < cells.length; i++) {
cells[i].mark = false;
}
return true;
} | javascript | function hGrow(xx, edge) {
const cells = [];
for (y = range.top; y <= range.bottom; y++) {
const c = matrix.findCellAt(sheetName, y, xx);
if (c && c.mark) {
cells.push(c);
} else {
return false;
}
}
range[edge] = xx;
for (let i = 0; i < cells.length; i++) {
cells[i].mark = false;
}
return true;
} | [
"function",
"hGrow",
"(",
"xx",
",",
"edge",
")",
"{",
"const",
"cells",
"=",
"[",
"]",
";",
"for",
"(",
"y",
"=",
"range",
".",
"top",
";",
"y",
"<=",
"range",
".",
"bottom",
";",
"y",
"++",
")",
"{",
"const",
"c",
"=",
"matrix",
".",
"findC... | grow horizontal - ensure all rows can grow | [
"grow",
"horizontal",
"-",
"ensure",
"all",
"rows",
"can",
"grow"
] | c6ee7a14d5e0e5a07bf0e475aa4dd7b9a1e907f2 | https://github.com/exceljs/exceljs/blob/c6ee7a14d5e0e5a07bf0e475aa4dd7b9a1e907f2/lib/doc/defined-names.js#L98-L113 | train | grow the cells at xx | [
30522,
3853,
1044,
16523,
5004,
1006,
22038,
1010,
3341,
1007,
1063,
9530,
3367,
4442,
1027,
1031,
1033,
1025,
2005,
1006,
1061,
1027,
2846,
1012,
2327,
1025,
1061,
1026,
1027,
2846,
1012,
3953,
1025,
1061,
1009,
1009,
1007,
1063,
9530,
3... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/extensibility/node/ExtensionManagerDomain.js | _cmdUpdate | function _cmdUpdate(packagePath, destinationDirectory, options, callback, pCallback) {
_cmdInstall(packagePath, destinationDirectory, options, callback, pCallback, true);
} | javascript | function _cmdUpdate(packagePath, destinationDirectory, options, callback, pCallback) {
_cmdInstall(packagePath, destinationDirectory, options, callback, pCallback, true);
} | [
"function",
"_cmdUpdate",
"(",
"packagePath",
",",
"destinationDirectory",
",",
"options",
",",
"callback",
",",
"pCallback",
")",
"{",
"_cmdInstall",
"(",
"packagePath",
",",
"destinationDirectory",
",",
"options",
",",
"callback",
",",
"pCallback",
",",
"true",
... | Implements the "update" command in the "extensions" domain.
Currently, this just wraps _cmdInstall, but will remove the existing directory
first.
There is no need to call validate independently. Validation is the first
thing that is done here.
After the extension is validated, it is installed in destinationDirectory
unless the extension is already present there. If it is already present,
a determination is made about whether the package being installed is
an update. If it does appear to be an update, then result.installationStatus
is set to NEEDS_UPDATE. If not, then it's set to ALREADY_INSTALLED.
If the installation succeeds, then result.installationStatus is set to INSTALLED.
The extension is unzipped into a directory in destinationDirectory with
the name of the extension (the name is derived either from package.json
or the name of the zip file).
The destinationDirectory will be created if it does not exist.
@param {string} Absolute path to the package zip file
@param {string} the destination directory
@param {{disabledDirectory: !string, apiVersion: !string, nameHint: ?string,
systemExtensionDirectory: !string}} additional settings to control the installation
@param {function} callback (err, result)
@param {function} pCallback (msg) callback for notifications about operation progress | [
"Implements",
"the",
"update",
"command",
"in",
"the",
"extensions",
"domain",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensibility/node/ExtensionManagerDomain.js#L345-L347 | train | Update the specified package | [
30522,
3853,
1035,
4642,
8566,
17299,
3686,
1006,
7427,
15069,
1010,
7688,
4305,
2890,
16761,
2100,
1010,
7047,
1010,
2655,
5963,
1010,
7473,
8095,
5963,
1007,
1063,
1035,
4642,
8718,
9153,
3363,
1006,
7427,
15069,
1010,
7688,
4305,
2890,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | copyHead | function copyHead(headHtml, doc) {
var head = doc.getElementsByTagName('head')[0];
if (head.innerHTML == headHtml) {
// the content is already correct
return;
}
jQuery.init(head).empty();
appendHTML(headHtml, head);
} | javascript | function copyHead(headHtml, doc) {
var head = doc.getElementsByTagName('head')[0];
if (head.innerHTML == headHtml) {
// the content is already correct
return;
}
jQuery.init(head).empty();
appendHTML(headHtml, head);
} | [
"function",
"copyHead",
"(",
"headHtml",
",",
"doc",
")",
"{",
"var",
"head",
"=",
"doc",
".",
"getElementsByTagName",
"(",
"'head'",
")",
"[",
"0",
"]",
";",
"if",
"(",
"head",
".",
"innerHTML",
"==",
"headHtml",
")",
"{",
"// the content is already corre... | Copies the given HTML as the content of the current document's <head>
element. If the current document's head already contains identical
markup, copying is skipped. <script> elements are omitted. | [
"Copies",
"the",
"given",
"HTML",
"as",
"the",
"content",
"of",
"the",
"current",
"document",
"s",
"<head",
">",
"element",
".",
"If",
"the",
"current",
"document",
"s",
"head",
"already",
"contains",
"identical",
"markup",
"copying",
"is",
"skipped",
".",
... | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/selenium-core/scripts/htmlutils.js#L1452-L1463 | train | copy head html to the head element | [
30522,
3853,
6100,
4974,
1006,
2132,
11039,
19968,
1010,
9986,
1007,
1063,
13075,
2132,
1027,
9986,
1012,
2131,
12260,
8163,
3762,
15900,
18442,
1006,
1005,
2132,
1005,
1007,
1031,
1014,
1033,
1025,
2065,
1006,
2132,
1012,
5110,
11039,
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.support/src/sap/ui/support/supportRules/ui/models/Documentation.js | function (sTopicId) {
var sUrl = "",
sVersion = "",
sFullVersion = sap.ui.getVersionInfo().version,
iMajorVersion = jQuery.sap.Version(sFullVersion).getMajor(),
iMinorVersion = jQuery.sap.Version(sFullVersion).getMinor(),
sOrigin = window.location.origin;
//This check is to make sure that version is even. Example: 1.53 will back down to 1.52
// This is used to generate the correct path to demokit
if (iMinorVersion % 2 !== 0) {
iMinorVersion--;
}
sVersion += String(iMajorVersion) + "." + String(iMinorVersion);
if (sOrigin.indexOf("veui5infra") !== -1) {
sUrl = sOrigin + "/sapui5-sdk-internal/#/topic/" + sTopicId;
} else {
sUrl = sOrigin + "/demokit-" + sVersion + "/#/topic/" + sTopicId;
}
this._redirectToUrlWithFallback(sUrl, sTopicId);
} | javascript | function (sTopicId) {
var sUrl = "",
sVersion = "",
sFullVersion = sap.ui.getVersionInfo().version,
iMajorVersion = jQuery.sap.Version(sFullVersion).getMajor(),
iMinorVersion = jQuery.sap.Version(sFullVersion).getMinor(),
sOrigin = window.location.origin;
//This check is to make sure that version is even. Example: 1.53 will back down to 1.52
// This is used to generate the correct path to demokit
if (iMinorVersion % 2 !== 0) {
iMinorVersion--;
}
sVersion += String(iMajorVersion) + "." + String(iMinorVersion);
if (sOrigin.indexOf("veui5infra") !== -1) {
sUrl = sOrigin + "/sapui5-sdk-internal/#/topic/" + sTopicId;
} else {
sUrl = sOrigin + "/demokit-" + sVersion + "/#/topic/" + sTopicId;
}
this._redirectToUrlWithFallback(sUrl, sTopicId);
} | [
"function",
"(",
"sTopicId",
")",
"{",
"var",
"sUrl",
"=",
"\"\"",
",",
"sVersion",
"=",
"\"\"",
",",
"sFullVersion",
"=",
"sap",
".",
"ui",
".",
"getVersionInfo",
"(",
")",
".",
"version",
",",
"iMajorVersion",
"=",
"jQuery",
".",
"sap",
".",
"Version... | Opens the given topic
@param {string} sTopicId The ID of the topic to open | [
"Opens",
"the",
"given",
"topic"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.support/src/sap/ui/support/supportRules/ui/models/Documentation.js#L16-L39 | train | This method is called when the user clicks on a topic | [
30522,
3853,
1006,
2644,
28775,
2094,
1007,
1063,
13075,
7505,
2140,
1027,
1000,
1000,
1010,
17917,
2545,
3258,
1027,
1000,
1000,
1010,
16420,
18083,
27774,
1027,
20066,
1012,
21318,
1012,
2131,
27774,
2378,
14876,
1006,
1007,
1012,
2544,
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... | |
ecomfe/zrender | src/tool/path.js | createPathOptions | function createPathOptions(str, opts) {
var pathProxy = createPathProxyFromString(str);
opts = opts || {};
opts.buildPath = function (path) {
if (path.setData) {
path.setData(pathProxy.data);
// Svg and vml renderer don't have context
var ctx = path.getContext();
if (ctx) {
path.rebuildPath(ctx);
}
}
else {
var ctx = path;
pathProxy.rebuildPath(ctx);
}
};
opts.applyTransform = function (m) {
transformPath(pathProxy, m);
this.dirty(true);
};
return opts;
} | javascript | function createPathOptions(str, opts) {
var pathProxy = createPathProxyFromString(str);
opts = opts || {};
opts.buildPath = function (path) {
if (path.setData) {
path.setData(pathProxy.data);
// Svg and vml renderer don't have context
var ctx = path.getContext();
if (ctx) {
path.rebuildPath(ctx);
}
}
else {
var ctx = path;
pathProxy.rebuildPath(ctx);
}
};
opts.applyTransform = function (m) {
transformPath(pathProxy, m);
this.dirty(true);
};
return opts;
} | [
"function",
"createPathOptions",
"(",
"str",
",",
"opts",
")",
"{",
"var",
"pathProxy",
"=",
"createPathProxyFromString",
"(",
"str",
")",
";",
"opts",
"=",
"opts",
"||",
"{",
"}",
";",
"opts",
".",
"buildPath",
"=",
"function",
"(",
"path",
")",
"{",
... | TODO Optimize double memory cost problem | [
"TODO",
"Optimize",
"double",
"memory",
"cost",
"problem"
] | 30321b57cba3149c30eacb0c1e18276f0f001b9f | https://github.com/ecomfe/zrender/blob/30321b57cba3149c30eacb0c1e18276f0f001b9f/src/tool/path.js#L359-L383 | train | Create options for a path | [
30522,
3853,
3443,
15069,
7361,
9285,
1006,
2358,
2099,
1010,
23569,
2015,
1007,
1063,
13075,
4130,
21572,
18037,
1027,
3443,
15069,
21572,
18037,
19699,
22225,
18886,
3070,
1006,
2358,
2099,
1007,
1025,
23569,
2015,
1027,
23569,
2015,
1064,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
moleculerjs/moleculer | src/middlewares/circuit-breaker.js | success | function success(item, ctx) {
item.count++;
if (item.state === C.CIRCUIT_HALF_OPEN_WAIT)
circuitClose(item, ctx);
else
checkThreshold(item, ctx);
} | javascript | function success(item, ctx) {
item.count++;
if (item.state === C.CIRCUIT_HALF_OPEN_WAIT)
circuitClose(item, ctx);
else
checkThreshold(item, ctx);
} | [
"function",
"success",
"(",
"item",
",",
"ctx",
")",
"{",
"item",
".",
"count",
"++",
";",
"if",
"(",
"item",
".",
"state",
"===",
"C",
".",
"CIRCUIT_HALF_OPEN_WAIT",
")",
"circuitClose",
"(",
"item",
",",
"ctx",
")",
";",
"else",
"checkThreshold",
"("... | Increment request counter and switch CB to CLOSE if it is on HALF_OPEN_WAIT.
@param {Object} item
@param {Context} ctx | [
"Increment",
"request",
"counter",
"and",
"switch",
"CB",
"to",
"CLOSE",
"if",
"it",
"is",
"on",
"HALF_OPEN_WAIT",
"."
] | f95aadc2d61b0d0e3c643a43c3ed28bca6425cde | https://github.com/moleculerjs/moleculer/blob/f95aadc2d61b0d0e3c643a43c3ed28bca6425cde/src/middlewares/circuit-breaker.js#L93-L100 | train | Called when a success event is received from the network. | [
30522,
3853,
3112,
1006,
8875,
1010,
14931,
2595,
1007,
1063,
8875,
1012,
4175,
1009,
1009,
1025,
2065,
1006,
8875,
1012,
2110,
1027,
1027,
1027,
1039,
1012,
4984,
1035,
2431,
1035,
2330,
1035,
3524,
1007,
4984,
20464,
9232,
1006,
8875,
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/document/TextRange.js | TextRange | function TextRange(document, startLine, endLine) {
this.startLine = startLine;
this.endLine = endLine;
this.document = document;
document.addRef();
// store this-bound versions of listeners so we can remove them later
this._handleDocumentChange = this._handleDocumentChange.bind(this);
this._handleDocumentDeleted = this._handleDocumentDeleted.bind(this);
document.on("change", this._handleDocumentChange);
document.on("deleted", this._handleDocumentDeleted);
} | javascript | function TextRange(document, startLine, endLine) {
this.startLine = startLine;
this.endLine = endLine;
this.document = document;
document.addRef();
// store this-bound versions of listeners so we can remove them later
this._handleDocumentChange = this._handleDocumentChange.bind(this);
this._handleDocumentDeleted = this._handleDocumentDeleted.bind(this);
document.on("change", this._handleDocumentChange);
document.on("deleted", this._handleDocumentDeleted);
} | [
"function",
"TextRange",
"(",
"document",
",",
"startLine",
",",
"endLine",
")",
"{",
"this",
".",
"startLine",
"=",
"startLine",
";",
"this",
".",
"endLine",
"=",
"endLine",
";",
"this",
".",
"document",
"=",
"document",
";",
"document",
".",
"addRef",
... | Stores a range of lines that is automatically maintained as the Document changes. The range
MAY drop out of sync with the Document in certain edge cases; startLine & endLine will become
null when that happens.
Important: you must dispose() a TextRange when you're done with it. Because TextRange addRef()s
the Document (in order to listen to it), you will leak Documents otherwise.
TextRange dispatches these events:
- change -- When the range boundary line numbers change (due to a Document change)
- contentChange -- When the actual content of the range changes. This might or might not
be accompanied by a change in the boundary line numbers.
- lostSync -- When the backing Document changes in such a way that the range can no longer
accurately be maintained. Generally, occurs whenever an edit spans a range boundary.
After this, startLine & endLine will be unusable (set to null).
Also occurs when the document is deleted, though startLine & endLine won't be modified
These events only ever occur in response to Document changes, so if you are already listening
to the Document, you could ignore the TextRange events and just read its updated value in your
own Document change handler.
@constructor
@param {!Document} document
@param {number} startLine First line in range (0-based, inclusive)
@param {number} endLine Last line in range (0-based, inclusive) | [
"Stores",
"a",
"range",
"of",
"lines",
"that",
"is",
"automatically",
"maintained",
"as",
"the",
"Document",
"changes",
".",
"The",
"range",
"MAY",
"drop",
"out",
"of",
"sync",
"with",
"the",
"Document",
"in",
"certain",
"edge",
"cases",
";",
"startLine",
... | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/document/TextRange.js#L58-L69 | train | A TextRange is a wrapper around a Document. | [
30522,
3853,
3793,
24388,
2063,
1006,
6254,
1010,
2707,
4179,
1010,
2203,
4179,
1007,
1063,
2023,
1012,
2707,
4179,
1027,
2707,
4179,
1025,
2023,
1012,
2203,
4179,
1027,
2203,
4179,
1025,
2023,
1012,
6254,
1027,
6254,
1025,
6254,
1012,
55... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
babel/babel | packages/babel-plugin-proposal-decorators/src/transformer-legacy.js | applyClassDecorators | function applyClassDecorators(classPath) {
if (!hasClassDecorators(classPath.node)) return;
const decorators = classPath.node.decorators || [];
classPath.node.decorators = null;
const name = classPath.scope.generateDeclaredUidIdentifier("class");
return decorators
.map(dec => dec.expression)
.reverse()
.reduce(function(acc, decorator) {
return buildClassDecorator({
CLASS_REF: t.cloneNode(name),
DECORATOR: t.cloneNode(decorator),
INNER: acc,
}).expression;
}, classPath.node);
} | javascript | function applyClassDecorators(classPath) {
if (!hasClassDecorators(classPath.node)) return;
const decorators = classPath.node.decorators || [];
classPath.node.decorators = null;
const name = classPath.scope.generateDeclaredUidIdentifier("class");
return decorators
.map(dec => dec.expression)
.reverse()
.reduce(function(acc, decorator) {
return buildClassDecorator({
CLASS_REF: t.cloneNode(name),
DECORATOR: t.cloneNode(decorator),
INNER: acc,
}).expression;
}, classPath.node);
} | [
"function",
"applyClassDecorators",
"(",
"classPath",
")",
"{",
"if",
"(",
"!",
"hasClassDecorators",
"(",
"classPath",
".",
"node",
")",
")",
"return",
";",
"const",
"decorators",
"=",
"classPath",
".",
"node",
".",
"decorators",
"||",
"[",
"]",
";",
"cla... | Given a class expression with class-level decorators, create a new expression
with the proper decorated behavior. | [
"Given",
"a",
"class",
"expression",
"with",
"class",
"-",
"level",
"decorators",
"create",
"a",
"new",
"expression",
"with",
"the",
"proper",
"decorated",
"behavior",
"."
] | 1969e6b6aa7d90be3fbb3aca98ea96849656a55a | https://github.com/babel/babel/blob/1969e6b6aa7d90be3fbb3aca98ea96849656a55a/packages/babel-plugin-proposal-decorators/src/transformer-legacy.js#L63-L81 | train | Apply class decorators to the class | [
30522,
3853,
6611,
26266,
3207,
27108,
18926,
1006,
2465,
15069,
1007,
1063,
2065,
1006,
999,
2038,
26266,
3207,
27108,
18926,
1006,
2465,
15069,
1012,
13045,
1007,
1007,
2709,
1025,
9530,
3367,
25545,
18926,
1027,
2465,
15069,
1012,
13045,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
transloadit/uppy | packages/@uppy/companion/src/server/controllers/authorized.js | authorized | function authorized (req, res) {
const { params, uppy } = req
const providerName = params.providerName
if (!uppy.providerTokens || !uppy.providerTokens[providerName]) {
return res.json({ authenticated: false })
}
const token = uppy.providerTokens[providerName]
uppy.provider.list({ token, uppy }, (err, response, body) => {
const notAuthenticated = Boolean(err)
if (notAuthenticated) {
logger.debug(`${providerName} failed authorizarion test err:${err}`, 'provider.auth.check')
}
return res.json({ authenticated: !notAuthenticated })
})
} | javascript | function authorized (req, res) {
const { params, uppy } = req
const providerName = params.providerName
if (!uppy.providerTokens || !uppy.providerTokens[providerName]) {
return res.json({ authenticated: false })
}
const token = uppy.providerTokens[providerName]
uppy.provider.list({ token, uppy }, (err, response, body) => {
const notAuthenticated = Boolean(err)
if (notAuthenticated) {
logger.debug(`${providerName} failed authorizarion test err:${err}`, 'provider.auth.check')
}
return res.json({ authenticated: !notAuthenticated })
})
} | [
"function",
"authorized",
"(",
"req",
",",
"res",
")",
"{",
"const",
"{",
"params",
",",
"uppy",
"}",
"=",
"req",
"const",
"providerName",
"=",
"params",
".",
"providerName",
"if",
"(",
"!",
"uppy",
".",
"providerTokens",
"||",
"!",
"uppy",
".",
"provi... | checks if companion is authorized to access a user's provider account.
@param {object} req
@param {object} res | [
"checks",
"if",
"companion",
"is",
"authorized",
"to",
"access",
"a",
"user",
"s",
"provider",
"account",
"."
] | 7ae18bf992d544a64da998f033258ec09a3de275 | https://github.com/transloadit/uppy/blob/7ae18bf992d544a64da998f033258ec09a3de275/packages/@uppy/companion/src/server/controllers/authorized.js#L12-L28 | train | Check if the user is authenticated | [
30522,
3853,
9362,
1006,
2128,
4160,
1010,
24501,
1007,
1063,
9530,
3367,
1063,
11498,
5244,
1010,
2039,
7685,
1065,
1027,
2128,
4160,
9530,
3367,
10802,
18442,
1027,
11498,
5244,
1012,
10802,
18442,
2065,
1006,
999,
2039,
7685,
1012,
10802... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/search/FindReplace.js | handleQueryChange | function handleQueryChange(editor, state, initial) {
setQueryInfo(state, findBar.getQueryInfo());
updateResultSet(editor);
if (state.parsedQuery) {
// 3rd arg: prefer to avoid scrolling if result is anywhere within view, since in this case user
// is in the middle of typing, not navigating explicitly; viewport jumping would be distracting.
findNext(editor, false, true, state.searchStartPos);
} else if (!initial) {
// Blank or invalid query: just jump back to initial pos
editor._codeMirror.setCursor(state.searchStartPos);
}
editor.lastParsedQuery = state.parsedQuery;
} | javascript | function handleQueryChange(editor, state, initial) {
setQueryInfo(state, findBar.getQueryInfo());
updateResultSet(editor);
if (state.parsedQuery) {
// 3rd arg: prefer to avoid scrolling if result is anywhere within view, since in this case user
// is in the middle of typing, not navigating explicitly; viewport jumping would be distracting.
findNext(editor, false, true, state.searchStartPos);
} else if (!initial) {
// Blank or invalid query: just jump back to initial pos
editor._codeMirror.setCursor(state.searchStartPos);
}
editor.lastParsedQuery = state.parsedQuery;
} | [
"function",
"handleQueryChange",
"(",
"editor",
",",
"state",
",",
"initial",
")",
"{",
"setQueryInfo",
"(",
"state",
",",
"findBar",
".",
"getQueryInfo",
"(",
")",
")",
";",
"updateResultSet",
"(",
"editor",
")",
";",
"if",
"(",
"state",
".",
"parsedQuery... | Called each time the search query field changes. Updates state.parsedQuery (parsedQuery will be falsy if the field
was blank OR contained a regexp with invalid syntax). Then calls updateResultSet(), and then jumps to
the first matching result, starting from the original cursor position.
@param {!Editor} editor The editor we're searching in.
@param {Object} state The current query state.
@param {boolean} initial Whether this is the initial population of the query when the search bar opens.
In that case, we don't want to change the selection unnecessarily. | [
"Called",
"each",
"time",
"the",
"search",
"query",
"field",
"changes",
".",
"Updates",
"state",
".",
"parsedQuery",
"(",
"parsedQuery",
"will",
"be",
"falsy",
"if",
"the",
"field",
"was",
"blank",
"OR",
"contained",
"a",
"regexp",
"with",
"invalid",
"syntax... | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/search/FindReplace.js#L575-L589 | train | Handle query change | [
30522,
3853,
5047,
4226,
2854,
22305,
2063,
1006,
3559,
1010,
2110,
1010,
3988,
1007,
1063,
2275,
4226,
2854,
2378,
14876,
1006,
2110,
1010,
2424,
8237,
1012,
2131,
4226,
2854,
2378,
14876,
1006,
1007,
1007,
1025,
10651,
6072,
11314,
13462,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/document/DocumentManager.js | findInWorkingSet | function findInWorkingSet(fullPath) {
DeprecationWarning.deprecationWarning("Use MainViewManager.findInWorkingSet() instead of DocumentManager.findInWorkingSet()", true);
return MainViewManager.findInWorkingSet(MainViewManager.ACTIVE_PANE, fullPath);
} | javascript | function findInWorkingSet(fullPath) {
DeprecationWarning.deprecationWarning("Use MainViewManager.findInWorkingSet() instead of DocumentManager.findInWorkingSet()", true);
return MainViewManager.findInWorkingSet(MainViewManager.ACTIVE_PANE, fullPath);
} | [
"function",
"findInWorkingSet",
"(",
"fullPath",
")",
"{",
"DeprecationWarning",
".",
"deprecationWarning",
"(",
"\"Use MainViewManager.findInWorkingSet() instead of DocumentManager.findInWorkingSet()\"",
",",
"true",
")",
";",
"return",
"MainViewManager",
".",
"findInWorkingSet"... | Returns the index of the file matching fullPath in the working set.
@deprecated Use MainViewManager.findInWorkingSet() instead
@param {!string} fullPath
@return {number} index, -1 if not found | [
"Returns",
"the",
"index",
"of",
"the",
"file",
"matching",
"fullPath",
"in",
"the",
"working",
"set",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/document/DocumentManager.js#L171-L174 | train | Find the file in the working set | [
30522,
3853,
2424,
2378,
21398,
13462,
1006,
2440,
15069,
1007,
1063,
2139,
28139,
10719,
9028,
5582,
1012,
2139,
28139,
10719,
9028,
5582,
1006,
1000,
2224,
2364,
8584,
24805,
4590,
1012,
2424,
2378,
21398,
13462,
1006,
1007,
2612,
1997,
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... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/thirdparty/qunit.js | generateHash | function generateHash( module, testName ) {
var hex,
i = 0,
hash = 0,
str = module + "\x1C" + testName,
len = str.length;
for ( ; i < len; i++ ) {
hash = ( ( hash << 5 ) - hash ) + str.charCodeAt( i );
hash |= 0;
}
// Convert the possibly negative integer hash code into an 8 character hex string, which isn't
// strictly necessary but increases user understanding that the id is a SHA-like hash
hex = ( 0x100000000 + hash ).toString( 16 );
if ( hex.length < 8 ) {
hex = "0000000" + hex;
}
return hex.slice( -8 );
} | javascript | function generateHash( module, testName ) {
var hex,
i = 0,
hash = 0,
str = module + "\x1C" + testName,
len = str.length;
for ( ; i < len; i++ ) {
hash = ( ( hash << 5 ) - hash ) + str.charCodeAt( i );
hash |= 0;
}
// Convert the possibly negative integer hash code into an 8 character hex string, which isn't
// strictly necessary but increases user understanding that the id is a SHA-like hash
hex = ( 0x100000000 + hash ).toString( 16 );
if ( hex.length < 8 ) {
hex = "0000000" + hex;
}
return hex.slice( -8 );
} | [
"function",
"generateHash",
"(",
"module",
",",
"testName",
")",
"{",
"var",
"hex",
",",
"i",
"=",
"0",
",",
"hash",
"=",
"0",
",",
"str",
"=",
"module",
"+",
"\"\\x1C\"",
"+",
"testName",
",",
"len",
"=",
"str",
".",
"length",
";",
"for",
"(",
"... | Based on Java's String.hashCode, a simple but not rigorously collision resistant hashing function | [
"Based",
"on",
"Java",
"s",
"String",
".",
"hashCode",
"a",
"simple",
"but",
"not",
"rigorously",
"collision",
"resistant",
"hashing",
"function"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/qunit.js#L1220-L1240 | train | Generate a hash code for a test | [
30522,
3853,
9699,
14949,
2232,
1006,
11336,
1010,
3231,
18442,
1007,
1063,
13075,
2002,
2595,
1010,
1045,
1027,
1014,
1010,
23325,
1027,
1014,
1010,
2358,
2099,
1027,
11336,
1009,
1000,
1032,
30524,
2099,
1012,
25869,
16044,
4017,
1006,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
eslint/eslint | lib/rules/comma-dangle.js | isMultiline | function isMultiline(node) {
const lastItem = getLastItem(node);
if (!lastItem) {
return false;
}
const penultimateToken = getTrailingToken(node, lastItem);
const lastToken = sourceCode.getTokenAfter(penultimateToken);
return lastToken.loc.end.line !== penultimateToken.loc.end.line;
} | javascript | function isMultiline(node) {
const lastItem = getLastItem(node);
if (!lastItem) {
return false;
}
const penultimateToken = getTrailingToken(node, lastItem);
const lastToken = sourceCode.getTokenAfter(penultimateToken);
return lastToken.loc.end.line !== penultimateToken.loc.end.line;
} | [
"function",
"isMultiline",
"(",
"node",
")",
"{",
"const",
"lastItem",
"=",
"getLastItem",
"(",
"node",
")",
";",
"if",
"(",
"!",
"lastItem",
")",
"{",
"return",
"false",
";",
"}",
"const",
"penultimateToken",
"=",
"getTrailingToken",
"(",
"node",
",",
"... | Checks whether or not a given node is multiline.
This rule handles a given node as multiline when the closing parenthesis
and the last element are not on the same line.
@param {ASTNode} node - A node to check.
@returns {boolean} `true` if the node is multiline. | [
"Checks",
"whether",
"or",
"not",
"a",
"given",
"node",
"is",
"multiline",
".",
"This",
"rule",
"handles",
"a",
"given",
"node",
"as",
"multiline",
"when",
"the",
"closing",
"parenthesis",
"and",
"the",
"last",
"element",
"are",
"not",
"on",
"the",
"same",... | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/comma-dangle.js#L206-L217 | train | Check if node is multiline | [
30522,
3853,
2003,
12274,
7096,
18622,
2638,
1006,
13045,
1007,
1063,
9530,
3367,
2197,
4221,
2213,
1027,
2131,
8523,
23096,
2213,
1006,
13045,
1007,
1025,
2065,
1006,
999,
2197,
4221,
2213,
1007,
1063,
2709,
6270,
1025,
1065,
9530,
3367,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
juliangarnier/anime | lib/anime.js | filterArray | function filterArray(arr, callback) {
var len = arr.length;
var thisArg = arguments.length >= 2 ? arguments[1] : void 0;
var result = [];
for (var i = 0; i < len; i++) {
if (i in arr) {
var val = arr[i];
if (callback.call(thisArg, val, i, arr)) {
result.push(val);
}
}
}
return result;
} | javascript | function filterArray(arr, callback) {
var len = arr.length;
var thisArg = arguments.length >= 2 ? arguments[1] : void 0;
var result = [];
for (var i = 0; i < len; i++) {
if (i in arr) {
var val = arr[i];
if (callback.call(thisArg, val, i, arr)) {
result.push(val);
}
}
}
return result;
} | [
"function",
"filterArray",
"(",
"arr",
",",
"callback",
")",
"{",
"var",
"len",
"=",
"arr",
".",
"length",
";",
"var",
"thisArg",
"=",
"arguments",
".",
"length",
">=",
"2",
"?",
"arguments",
"[",
"1",
"]",
":",
"void",
"0",
";",
"var",
"result",
"... | Arrays | [
"Arrays"
] | 875a3d6745d4bff2e4c6ffe0e2d24aac3bf8a45a | https://github.com/juliangarnier/anime/blob/875a3d6745d4bff2e4c6ffe0e2d24aac3bf8a45a/lib/anime.js#L321-L334 | train | filterArray Filter array by callback | [
30522,
3853,
11307,
2906,
9447,
1006,
12098,
2099,
1010,
2655,
5963,
1007,
1063,
13075,
18798,
1027,
12098,
2099,
1012,
3091,
1025,
13075,
2023,
2906,
2290,
1027,
9918,
1012,
3091,
1028,
1027,
1016,
1029,
9918,
1031,
1015,
1033,
1024,
11675... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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(bounds, x, y)
{
return (bounds.x <= x && bounds.x + bounds.width >= x &&
bounds.y <= y && bounds.y + bounds.height >= y);
} | javascript | function(bounds, x, y)
{
return (bounds.x <= x && bounds.x + bounds.width >= x &&
bounds.y <= y && bounds.y + bounds.height >= y);
} | [
"function",
"(",
"bounds",
",",
"x",
",",
"y",
")",
"{",
"return",
"(",
"bounds",
".",
"x",
"<=",
"x",
"&&",
"bounds",
".",
"x",
"+",
"bounds",
".",
"width",
">=",
"x",
"&&",
"bounds",
".",
"y",
"<=",
"y",
"&&",
"bounds",
".",
"y",
"+",
"boun... | Function: contains
Returns true if the specified point (x, y) is contained in the given rectangle.
Parameters:
bounds - <mxRectangle> that represents the area.
x - X-coordinate of the point.
y - Y-coordinate of the point. | [
"Function",
":",
"contains"
] | 33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44 | https://github.com/jgraph/mxgraph/blob/33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44/javascript/mxClient.js#L4630-L4634 | train | Returns true if the given bounds contains the specified region | [
30522,
3853,
1006,
19202,
1010,
1060,
1010,
1061,
1007,
1063,
2709,
1006,
19202,
1012,
1060,
1026,
1027,
1060,
1004,
1004,
19202,
1012,
1060,
1009,
19202,
1012,
9381,
1028,
1027,
1060,
1004,
1004,
19202,
1012,
1061,
1026,
1027,
1061,
1004,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
eslint/eslint | lib/util/apply-disable-directives.js | applyDirectives | function applyDirectives(options) {
const problems = [];
let nextDirectiveIndex = 0;
let currentGlobalDisableDirective = null;
const disabledRuleMap = new Map();
// enabledRules is only used when there is a current global disable directive.
const enabledRules = new Set();
const usedDisableDirectives = new Set();
for (const problem of options.problems) {
while (
nextDirectiveIndex < options.directives.length &&
compareLocations(options.directives[nextDirectiveIndex], problem) <= 0
) {
const directive = options.directives[nextDirectiveIndex++];
switch (directive.type) {
case "disable":
if (directive.ruleId === null) {
currentGlobalDisableDirective = directive;
disabledRuleMap.clear();
enabledRules.clear();
} else if (currentGlobalDisableDirective) {
enabledRules.delete(directive.ruleId);
disabledRuleMap.set(directive.ruleId, directive);
} else {
disabledRuleMap.set(directive.ruleId, directive);
}
break;
case "enable":
if (directive.ruleId === null) {
currentGlobalDisableDirective = null;
disabledRuleMap.clear();
} else if (currentGlobalDisableDirective) {
enabledRules.add(directive.ruleId);
disabledRuleMap.delete(directive.ruleId);
} else {
disabledRuleMap.delete(directive.ruleId);
}
break;
// no default
}
}
if (disabledRuleMap.has(problem.ruleId)) {
usedDisableDirectives.add(disabledRuleMap.get(problem.ruleId));
} else if (currentGlobalDisableDirective && !enabledRules.has(problem.ruleId)) {
usedDisableDirectives.add(currentGlobalDisableDirective);
} else {
problems.push(problem);
}
}
const unusedDisableDirectives = options.directives
.filter(directive => directive.type === "disable" && !usedDisableDirectives.has(directive))
.map(directive => ({
ruleId: null,
message: directive.ruleId
? `Unused eslint-disable directive (no problems were reported from '${directive.ruleId}').`
: "Unused eslint-disable directive (no problems were reported).",
line: directive.unprocessedDirective.line,
column: directive.unprocessedDirective.column,
severity: 2,
nodeType: null
}));
return { problems, unusedDisableDirectives };
} | javascript | function applyDirectives(options) {
const problems = [];
let nextDirectiveIndex = 0;
let currentGlobalDisableDirective = null;
const disabledRuleMap = new Map();
// enabledRules is only used when there is a current global disable directive.
const enabledRules = new Set();
const usedDisableDirectives = new Set();
for (const problem of options.problems) {
while (
nextDirectiveIndex < options.directives.length &&
compareLocations(options.directives[nextDirectiveIndex], problem) <= 0
) {
const directive = options.directives[nextDirectiveIndex++];
switch (directive.type) {
case "disable":
if (directive.ruleId === null) {
currentGlobalDisableDirective = directive;
disabledRuleMap.clear();
enabledRules.clear();
} else if (currentGlobalDisableDirective) {
enabledRules.delete(directive.ruleId);
disabledRuleMap.set(directive.ruleId, directive);
} else {
disabledRuleMap.set(directive.ruleId, directive);
}
break;
case "enable":
if (directive.ruleId === null) {
currentGlobalDisableDirective = null;
disabledRuleMap.clear();
} else if (currentGlobalDisableDirective) {
enabledRules.add(directive.ruleId);
disabledRuleMap.delete(directive.ruleId);
} else {
disabledRuleMap.delete(directive.ruleId);
}
break;
// no default
}
}
if (disabledRuleMap.has(problem.ruleId)) {
usedDisableDirectives.add(disabledRuleMap.get(problem.ruleId));
} else if (currentGlobalDisableDirective && !enabledRules.has(problem.ruleId)) {
usedDisableDirectives.add(currentGlobalDisableDirective);
} else {
problems.push(problem);
}
}
const unusedDisableDirectives = options.directives
.filter(directive => directive.type === "disable" && !usedDisableDirectives.has(directive))
.map(directive => ({
ruleId: null,
message: directive.ruleId
? `Unused eslint-disable directive (no problems were reported from '${directive.ruleId}').`
: "Unused eslint-disable directive (no problems were reported).",
line: directive.unprocessedDirective.line,
column: directive.unprocessedDirective.column,
severity: 2,
nodeType: null
}));
return { problems, unusedDisableDirectives };
} | [
"function",
"applyDirectives",
"(",
"options",
")",
"{",
"const",
"problems",
"=",
"[",
"]",
";",
"let",
"nextDirectiveIndex",
"=",
"0",
";",
"let",
"currentGlobalDisableDirective",
"=",
"null",
";",
"const",
"disabledRuleMap",
"=",
"new",
"Map",
"(",
")",
"... | This is the same as the exported function, except that it
doesn't handle disable-line and disable-next-line directives, and it always reports unused
disable directives.
@param {Object} options options for applying directives. This is the same as the options
for the exported function, except that `reportUnusedDisableDirectives` is not supported
(this function always reports unused disable directives).
@returns {{problems: Problem[], unusedDisableDirectives: Problem[]}} An object with a list
of filtered problems and unused eslint-disable directives | [
"This",
"is",
"the",
"same",
"as",
"the",
"exported",
"function",
"except",
"that",
"it",
"doesn",
"t",
"handle",
"disable",
"-",
"line",
"and",
"disable",
"-",
"next",
"-",
"line",
"directives",
"and",
"it",
"always",
"reports",
"unused",
"disable",
"dire... | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/util/apply-disable-directives.js#L31-L101 | train | Apply all directives to the given grammar | [
30522,
3853,
6611,
4305,
2890,
15277,
2015,
1006,
7047,
1007,
1063,
9530,
3367,
3471,
1027,
1031,
1033,
1025,
2292,
2279,
4305,
2890,
15277,
22254,
10288,
1027,
1014,
1025,
2292,
2783,
23296,
16429,
24657,
19150,
4305,
2890,
15277,
1027,
19... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.dt/src/sap/ui/dt/ContextMenuControl.js | function (oContPos, oPopover, oViewport) {
this.getPopover().setShowArrow(false);
var oPos = {};
if (oViewport.height - 10 - oContPos.y >= oPopover.height) {
oPos.top = oContPos.y;
this.getPopover().setPlacement("Bottom");
} else if (oContPos.y >= oPopover.height) {
oPos.top = oContPos.y;
this.getPopover().setPlacement("Top");
} else {
oPos.top = oViewport.height - oPopover.height;
this.getPopover().setPlacement("Bottom");
}
if (oViewport.width - oContPos.x >= oPopover.width) {
oPos.left = oContPos.x;
} else if (oContPos.x >= oPopover.width) {
oPos.left = oContPos.x - oPopover.width / 2;
} else {
oPos.left = oViewport.width - oPopover.width;
}
return oPos;
} | javascript | function (oContPos, oPopover, oViewport) {
this.getPopover().setShowArrow(false);
var oPos = {};
if (oViewport.height - 10 - oContPos.y >= oPopover.height) {
oPos.top = oContPos.y;
this.getPopover().setPlacement("Bottom");
} else if (oContPos.y >= oPopover.height) {
oPos.top = oContPos.y;
this.getPopover().setPlacement("Top");
} else {
oPos.top = oViewport.height - oPopover.height;
this.getPopover().setPlacement("Bottom");
}
if (oViewport.width - oContPos.x >= oPopover.width) {
oPos.left = oContPos.x;
} else if (oContPos.x >= oPopover.width) {
oPos.left = oContPos.x - oPopover.width / 2;
} else {
oPos.left = oViewport.width - oPopover.width;
}
return oPos;
} | [
"function",
"(",
"oContPos",
",",
"oPopover",
",",
"oViewport",
")",
"{",
"this",
".",
"getPopover",
"(",
")",
".",
"setShowArrow",
"(",
"false",
")",
";",
"var",
"oPos",
"=",
"{",
"}",
";",
"if",
"(",
"oViewport",
".",
"height",
"-",
"10",
"-",
"o... | Works out how the ContextMenu shall be placed
@param {object} oContPos the context menu position
@param {object} oPopover the dimensions of the popover
@param {object} oViewport the dimensions of the viewport
@return {object} the position of the "fakeDiv" | [
"Works",
"out",
"how",
"the",
"ContextMenu",
"shall",
"be",
"placed"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.dt/src/sap/ui/dt/ContextMenuControl.js#L400-L424 | train | Sets the position of the popover to the given position | [
30522,
3853,
1006,
1051,
8663,
25856,
2891,
1010,
6728,
7361,
7840,
1010,
1051,
8584,
6442,
1007,
1063,
2023,
1012,
2131,
16340,
7840,
1006,
1007,
1012,
4520,
14406,
2906,
10524,
1006,
6270,
1007,
1025,
13075,
6728,
2891,
1027,
1063,
1065,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | src/sap.ui.table/src/sap/ui/table/TablePointerExtension.js | function(oEvent) {
var iLocationY = ExtensionHelper._getEventPosition(oEvent, this).y;
var iMin = this.$().offset().top;
if (iLocationY > iMin) {
this.$("ghost").css("top", iLocationY + "px");
}
} | javascript | function(oEvent) {
var iLocationY = ExtensionHelper._getEventPosition(oEvent, this).y;
var iMin = this.$().offset().top;
if (iLocationY > iMin) {
this.$("ghost").css("top", iLocationY + "px");
}
} | [
"function",
"(",
"oEvent",
")",
"{",
"var",
"iLocationY",
"=",
"ExtensionHelper",
".",
"_getEventPosition",
"(",
"oEvent",
",",
"this",
")",
".",
"y",
";",
"var",
"iMin",
"=",
"this",
".",
"$",
"(",
")",
".",
"offset",
"(",
")",
".",
"top",
";",
"i... | /*
Handler for the move events while dragging the horizontal resize bar. | [
"/",
"*",
"Handler",
"for",
"the",
"move",
"events",
"while",
"dragging",
"the",
"horizontal",
"resize",
"bar",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TablePointerExtension.js#L436-L442 | train | This method is called when the event is triggered by the container | [
30522,
3853,
1006,
1051,
18697,
3372,
1007,
1063,
13075,
6335,
23909,
2100,
1027,
5331,
16001,
4842,
1012,
1035,
2131,
18697,
3372,
26994,
1006,
1051,
18697,
3372,
1010,
2023,
1007,
1012,
1061,
1025,
13075,
10047,
2378,
1027,
2023,
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... | |
SAP/openui5 | src/sap.ui.commons/src/sap/ui/commons/MenuBar.js | function(oThis, oEvent){
var jRef = jQuery(oEvent.target);
if (!jRef.attr("itemidx")) {
jRef = jRef.parent();
}
return jRef.attr("itemidx") ? jRef : null;
} | javascript | function(oThis, oEvent){
var jRef = jQuery(oEvent.target);
if (!jRef.attr("itemidx")) {
jRef = jRef.parent();
}
return jRef.attr("itemidx") ? jRef : null;
} | [
"function",
"(",
"oThis",
",",
"oEvent",
")",
"{",
"var",
"jRef",
"=",
"jQuery",
"(",
"oEvent",
".",
"target",
")",
";",
"if",
"(",
"!",
"jRef",
".",
"attr",
"(",
"\"itemidx\"",
")",
")",
"{",
"jRef",
"=",
"jRef",
".",
"parent",
"(",
")",
";",
... | Returns the jQuery Object of the item which was the target of the event (if exists) | [
"Returns",
"the",
"jQuery",
"Object",
"of",
"the",
"item",
"which",
"was",
"the",
"target",
"of",
"the",
"event",
"(",
"if",
"exists",
")"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.commons/src/sap/ui/commons/MenuBar.js#L417-L423 | train | Returns the jQuery object that represents the item in the list | [
30522,
3853,
1006,
27178,
24158,
1010,
1051,
18697,
3372,
1007,
1063,
13075,
3781,
12879,
1027,
1046,
4226,
2854,
1006,
1051,
18697,
3372,
1012,
4539,
1007,
1025,
2065,
1006,
999,
3781,
12879,
1012,
2012,
16344,
1006,
1000,
8875,
3593,
2595... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.