repo
stringclasses
192 values
path
stringlengths
4
115
func_name
stringlengths
0
45
original_string
stringlengths
74
24k
language
stringclasses
1 value
code
stringlengths
74
24k
code_tokens
listlengths
23
4.2k
docstring
stringlengths
2
23.7k
docstring_tokens
listlengths
1
810
sha
stringclasses
192 values
url
stringlengths
90
200
partition
stringclasses
1 value
summary
stringlengths
6
313
input_ids
listlengths
502
502
token_type_ids
listlengths
502
502
attention_mask
listlengths
502
502
labels
listlengths
502
502
adobe/brackets
src/language/HTMLTokenizer.js
Tokenizer
function Tokenizer(text) { this._state = TEXT; this._buffer = text; this._sectionStart = 0; this._sectionStartPos = {line: 0, ch: 0}; this._index = 0; this._indexPos = {line: 0, ch: 0}; this._special = 0; // 1 for script, 2 for style this._token = null; this._nextToken = null; }
javascript
function Tokenizer(text) { this._state = TEXT; this._buffer = text; this._sectionStart = 0; this._sectionStartPos = {line: 0, ch: 0}; this._index = 0; this._indexPos = {line: 0, ch: 0}; this._special = 0; // 1 for script, 2 for style this._token = null; this._nextToken = null; }
[ "function", "Tokenizer", "(", "text", ")", "{", "this", ".", "_state", "=", "TEXT", ";", "this", ".", "_buffer", "=", "text", ";", "this", ".", "_sectionStart", "=", "0", ";", "this", ".", "_sectionStartPos", "=", "{", "line", ":", "0", ",", "ch", ...
A simple HTML tokenizer. See the description of nextToken() for usage details. @constructor @param {string} text The HTML document to tokenize.
[ "A", "simple", "HTML", "tokenizer", ".", "See", "the", "description", "of", "nextToken", "()", "for", "usage", "details", "." ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/language/HTMLTokenizer.js#L149-L159
train
A tokenizer that can be used to parse a text
[ 30522, 3853, 19204, 17629, 1006, 3793, 1007, 1063, 2023, 1012, 1035, 2110, 1027, 3793, 1025, 2023, 1012, 1035, 17698, 1027, 3793, 1025, 2023, 1012, 1035, 5433, 7559, 2102, 1027, 1014, 1025, 2023, 1012, 1035, 5433, 7559, 25856, 2891, 1027, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.table/src/sap/ui/table/TableAccExtension.js
function(oInfo) { var sDesc = oInfo.type + " " + oInfo.description; if (oInfo.enabled === false) { sDesc = sDesc + " " + TableUtils.getResourceText("TBL_CTRL_STATE_DISABLED"); } else if (oInfo.editable === false) { sDesc = sDesc + " " + TableUtils.getResourceText("TBL_CTRL_STATE_READONLY"); } return sDesc.trim(); }
javascript
function(oInfo) { var sDesc = oInfo.type + " " + oInfo.description; if (oInfo.enabled === false) { sDesc = sDesc + " " + TableUtils.getResourceText("TBL_CTRL_STATE_DISABLED"); } else if (oInfo.editable === false) { sDesc = sDesc + " " + TableUtils.getResourceText("TBL_CTRL_STATE_READONLY"); } return sDesc.trim(); }
[ "function", "(", "oInfo", ")", "{", "var", "sDesc", "=", "oInfo", ".", "type", "+", "\" \"", "+", "oInfo", ".", "description", ";", "if", "(", "oInfo", ".", "enabled", "===", "false", ")", "{", "sDesc", "=", "sDesc", "+", "\" \"", "+", "TableUtils", ...
/* Returns the full control description incl. control type and enabled/editable state based on the information of the given acc info object Note: The description does not include the description of the children (if available).
[ "/", "*", "Returns", "the", "full", "control", "description", "incl", ".", "control", "type", "and", "enabled", "/", "editable", "state", "based", "on", "the", "information", "of", "the", "given", "acc", "info", "object", "Note", ":", "The", "description", ...
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableAccExtension.js#L107-L115
train
Returns the description of the control
[ 30522, 3853, 1006, 1051, 2378, 14876, 1007, 1063, 13075, 17371, 2229, 2278, 1027, 1051, 2378, 14876, 1012, 2828, 1009, 1000, 1000, 1009, 1051, 2378, 14876, 1012, 6412, 1025, 2065, 1006, 1051, 2378, 14876, 1012, 9124, 1027, 1027, 1027, 6270,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/search/FindInFiles.js
function () { function filter(file) { return _subtreeFilter(file, null) && _isReadableText(file.fullPath); } FindUtils.setInstantSearchDisabled(true); //we always listen for filesytem changes. _addListeners(); if (!PreferencesManager.get("findInFiles.nodeSearch")) { return; } ProjectManager.getAllFiles(filter, true, true) .done(function (fileListResult) { var files = fileListResult, filter = FileFilters.getActiveFilter(); if (filter && filter.patterns.length > 0) { files = FileFilters.filterFileList(FileFilters.compile(filter.patterns), files); } files = files.filter(function (entry) { return entry.isFile && _isReadableText(entry.fullPath); }).map(function (entry) { return entry.fullPath; }); FindUtils.notifyIndexingStarted(); searchDomain.exec("initCache", files); }); _searchScopeChanged(); }
javascript
function () { function filter(file) { return _subtreeFilter(file, null) && _isReadableText(file.fullPath); } FindUtils.setInstantSearchDisabled(true); //we always listen for filesytem changes. _addListeners(); if (!PreferencesManager.get("findInFiles.nodeSearch")) { return; } ProjectManager.getAllFiles(filter, true, true) .done(function (fileListResult) { var files = fileListResult, filter = FileFilters.getActiveFilter(); if (filter && filter.patterns.length > 0) { files = FileFilters.filterFileList(FileFilters.compile(filter.patterns), files); } files = files.filter(function (entry) { return entry.isFile && _isReadableText(entry.fullPath); }).map(function (entry) { return entry.fullPath; }); FindUtils.notifyIndexingStarted(); searchDomain.exec("initCache", files); }); _searchScopeChanged(); }
[ "function", "(", ")", "{", "function", "filter", "(", "file", ")", "{", "return", "_subtreeFilter", "(", "file", ",", "null", ")", "&&", "_isReadableText", "(", "file", ".", "fullPath", ")", ";", "}", "FindUtils", ".", "setInstantSearchDisabled", "(", "tru...
On project change, inform node about the new list of files that needs to be crawled. Instant search is also disabled for the time being till the crawl is complete in node.
[ "On", "project", "change", "inform", "node", "about", "the", "new", "list", "of", "files", "that", "needs", "to", "be", "crawled", ".", "Instant", "search", "is", "also", "disabled", "for", "the", "time", "being", "till", "the", "crawl", "is", "complete", ...
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/search/FindInFiles.js#L916-L944
train
Find in files. nodeSearch is not disabled.
[ 30522, 3853, 1006, 1007, 1063, 3853, 11307, 1006, 5371, 1007, 1063, 2709, 1035, 4942, 13334, 8873, 21928, 1006, 5371, 1010, 19701, 1007, 1004, 1004, 1035, 2003, 16416, 20782, 18209, 1006, 5371, 1012, 2440, 15069, 1007, 1025, 1065, 2424, 218...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/chart/chart.js
parseCode2ChartOption
function parseCode2ChartOption(optionCode) { const reservedKeys = ['type', 'url']; let options = {}; if (util.isUndefined(optionCode)) { return options; } const optionLines = optionCode.split(REGEX_LINE_ENDING); optionLines.forEach(line => { let [keyString, ...values] = line.split(OPTION_DELIMITER); let value = values.join(OPTION_DELIMITER); keyString = keyString.trim(); if (value.length === 0) { return; } try { value = JSON.parse(value.trim()); } catch (e) { value = value.trim(); } // parse keys let [...keys] = keyString.split('.'); let topKey = keys[0]; if (util.inArray(topKey, reservedKeys) >= 0) { // reserved keys for chart plugin option keys.unshift('editorChart'); } else if (keys.length === 1) { // short names for `chart` keys.unshift('chart'); } else if (topKey === 'x' || topKey === 'y') { // short-handed keys keys[0] = `${topKey}Axis`; } let option = options; for (let i = 0; i < keys.length; i += 1) { let key = keys[i]; option[key] = option[key] || (keys.length - 1 === i ? value : {}); option = option[key]; } }); return options; }
javascript
function parseCode2ChartOption(optionCode) { const reservedKeys = ['type', 'url']; let options = {}; if (util.isUndefined(optionCode)) { return options; } const optionLines = optionCode.split(REGEX_LINE_ENDING); optionLines.forEach(line => { let [keyString, ...values] = line.split(OPTION_DELIMITER); let value = values.join(OPTION_DELIMITER); keyString = keyString.trim(); if (value.length === 0) { return; } try { value = JSON.parse(value.trim()); } catch (e) { value = value.trim(); } // parse keys let [...keys] = keyString.split('.'); let topKey = keys[0]; if (util.inArray(topKey, reservedKeys) >= 0) { // reserved keys for chart plugin option keys.unshift('editorChart'); } else if (keys.length === 1) { // short names for `chart` keys.unshift('chart'); } else if (topKey === 'x' || topKey === 'y') { // short-handed keys keys[0] = `${topKey}Axis`; } let option = options; for (let i = 0; i < keys.length; i += 1) { let key = keys[i]; option[key] = option[key] || (keys.length - 1 === i ? value : {}); option = option[key]; } }); return options; }
[ "function", "parseCode2ChartOption", "(", "optionCode", ")", "{", "const", "reservedKeys", "=", "[", "'type'", ",", "'url'", "]", ";", "let", "options", "=", "{", "}", ";", "if", "(", "util", ".", "isUndefined", "(", "optionCode", ")", ")", "{", "return"...
parse option code @param {string} optionCode - option code @returns {Object} - tui.chart option string @see https://nhn.github.io/tui.chart/latest/tui.chart.html @ignore
[ "parse", "option", "code" ]
e75ab08c2a7ab07d1143e318f7cde135c5e3002e
https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/extensions/chart/chart.js#L242-L287
train
Parse chart option code
[ 30522, 3853, 11968, 3366, 16044, 2475, 7507, 5339, 7361, 3508, 1006, 5724, 16044, 1007, 1063, 9530, 3367, 9235, 14839, 2015, 1027, 1031, 1005, 2828, 1005, 1010, 1005, 24471, 2140, 1005, 1033, 1025, 2292, 7047, 1027, 1063, 1065, 1025, 2065, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
uber/deck.gl
modules/jupyter-widget/src/plugin.js
activateWidgetExtension
function activateWidgetExtension(app, registry) { registry.registerWidget({ name: MODULE_NAME, version: MODULE_VERSION, exports: { DeckGLModel, DeckGLView } }); }
javascript
function activateWidgetExtension(app, registry) { registry.registerWidget({ name: MODULE_NAME, version: MODULE_VERSION, exports: { DeckGLModel, DeckGLView } }); }
[ "function", "activateWidgetExtension", "(", "app", ",", "registry", ")", "{", "registry", ".", "registerWidget", "(", "{", "name", ":", "MODULE_NAME", ",", "version", ":", "MODULE_VERSION", ",", "exports", ":", "{", "DeckGLModel", ",", "DeckGLView", "}", "}", ...
Registers the widget with the Jupyter notebook
[ "Registers", "the", "widget", "with", "the", "Jupyter", "notebook" ]
a2010448b7f268bbd03617b812334c68a6b9e5b2
https://github.com/uber/deck.gl/blob/a2010448b7f268bbd03617b812334c68a6b9e5b2/modules/jupyter-widget/src/plugin.js#L21-L30
train
Activate the widget extension
[ 30522, 3853, 20544, 9148, 24291, 10288, 29048, 1006, 10439, 1010, 15584, 1007, 1063, 15584, 1012, 4236, 9148, 24291, 1006, 1063, 2171, 1024, 11336, 1035, 2171, 1010, 2544, 1024, 11336, 1035, 2544, 1010, 14338, 1024, 1063, 5877, 23296, 5302, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/dialog/dialog.js
stretchDialogContainerToViewport
function stretchDialogContainerToViewport(container, options) { var isFixed = $window.getComputedStyle($document[0].body).position == 'fixed'; var backdrop = options.backdrop ? $window.getComputedStyle(options.backdrop[0]) : null; var height = backdrop ? Math.min($document[0].body.clientHeight, Math.ceil(Math.abs(parseInt(backdrop.height, 10)))) : 0; var previousStyles = { top: container.css('top'), height: container.css('height') }; // If the body is fixed, determine the distance to the viewport in relative from the parent. var parentTop = Math.abs(options.parent[0].getBoundingClientRect().top); container.css({ top: (isFixed ? parentTop : 0) + 'px', height: height ? height + 'px' : '100%' }); return function() { // Reverts the modified styles back to the previous values. // This is needed for contentElements, which should have the same styles after close // as before. container.css(previousStyles); }; }
javascript
function stretchDialogContainerToViewport(container, options) { var isFixed = $window.getComputedStyle($document[0].body).position == 'fixed'; var backdrop = options.backdrop ? $window.getComputedStyle(options.backdrop[0]) : null; var height = backdrop ? Math.min($document[0].body.clientHeight, Math.ceil(Math.abs(parseInt(backdrop.height, 10)))) : 0; var previousStyles = { top: container.css('top'), height: container.css('height') }; // If the body is fixed, determine the distance to the viewport in relative from the parent. var parentTop = Math.abs(options.parent[0].getBoundingClientRect().top); container.css({ top: (isFixed ? parentTop : 0) + 'px', height: height ? height + 'px' : '100%' }); return function() { // Reverts the modified styles back to the previous values. // This is needed for contentElements, which should have the same styles after close // as before. container.css(previousStyles); }; }
[ "function", "stretchDialogContainerToViewport", "(", "container", ",", "options", ")", "{", "var", "isFixed", "=", "$window", ".", "getComputedStyle", "(", "$document", "[", "0", "]", ".", "body", ")", ".", "position", "==", "'fixed'", ";", "var", "backdrop", ...
Ensure the dialog container fill-stretches to the viewport
[ "Ensure", "the", "dialog", "container", "fill", "-", "stretches", "to", "the", "viewport" ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/dialog/dialog.js#L1195-L1219
train
Stretch the dialog container to the viewport
[ 30522, 3853, 7683, 27184, 8649, 8663, 18249, 8743, 4492, 2666, 2860, 6442, 1006, 11661, 1010, 7047, 1007, 1063, 13075, 2003, 23901, 1027, 1002, 3332, 1012, 2131, 9006, 29462, 21756, 2571, 1006, 1002, 6254, 1031, 1014, 1033, 1012, 2303, 1007...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
graphql/graphql-js
resources/benchmark.js
prepareAndRunBenchmarks
function prepareAndRunBenchmarks(benchmarkPatterns, revisions) { // Find all benchmark tests to be run. let benchmarks = findFiles(LOCAL_DIR('src'), '*/__tests__/*-benchmark.js'); if (benchmarkPatterns.length !== 0) { benchmarks = benchmarks.filter(benchmark => benchmarkPatterns.some(pattern => path.join('src', benchmark).includes(pattern) ) ); } if (benchmarks.length === 0) { console.warn( 'No benchmarks matching: ' + `\u001b[1m${benchmarkPatterns.join('\u001b[0m or \u001b[1m')}\u001b[0m` ); return; } const environments = revisions.map(revision => ({ revision, distPath: prepareRevision(revision), })); benchmarks.forEach(benchmark => runBenchmark(benchmark, environments)); }
javascript
function prepareAndRunBenchmarks(benchmarkPatterns, revisions) { // Find all benchmark tests to be run. let benchmarks = findFiles(LOCAL_DIR('src'), '*/__tests__/*-benchmark.js'); if (benchmarkPatterns.length !== 0) { benchmarks = benchmarks.filter(benchmark => benchmarkPatterns.some(pattern => path.join('src', benchmark).includes(pattern) ) ); } if (benchmarks.length === 0) { console.warn( 'No benchmarks matching: ' + `\u001b[1m${benchmarkPatterns.join('\u001b[0m or \u001b[1m')}\u001b[0m` ); return; } const environments = revisions.map(revision => ({ revision, distPath: prepareRevision(revision), })); benchmarks.forEach(benchmark => runBenchmark(benchmark, environments)); }
[ "function", "prepareAndRunBenchmarks", "(", "benchmarkPatterns", ",", "revisions", ")", "{", "// Find all benchmark tests to be run.", "let", "benchmarks", "=", "findFiles", "(", "LOCAL_DIR", "(", "'src'", ")", ",", "'*/__tests__/*-benchmark.js'", ")", ";", "if", "(", ...
Prepare all revisions and run benchmarks matching a pattern against them.
[ "Prepare", "all", "revisions", "and", "run", "benchmarks", "matching", "a", "pattern", "against", "them", "." ]
b65ff6db8893c1c68f0f236c4b2d663e6c55f5ef
https://github.com/graphql/graphql-js/blob/b65ff6db8893c1c68f0f236c4b2d663e6c55f5ef/resources/benchmark.js#L187-L211
train
Run benchmarks matching the given benchmark patterns
[ 30522, 3853, 7374, 5685, 15532, 10609, 2818, 27373, 1006, 6847, 10665, 4502, 12079, 3619, 1010, 24699, 1007, 1063, 1013, 1013, 2424, 2035, 6847, 10665, 5852, 2000, 2022, 2448, 1012, 2292, 6847, 27373, 1027, 2424, 8873, 4244, 1006, 2334, 103...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
nfarina/homebridge
example-plugins/homebridge-samplePlatform/index.js
SamplePlatform
function SamplePlatform(log, config, api) { log("SamplePlatform Init"); var platform = this; this.log = log; this.config = config; this.accessories = []; this.requestServer = http.createServer(function(request, response) { if (request.url === "/add") { this.addAccessory(new Date().toISOString()); response.writeHead(204); response.end(); } if (request.url == "/reachability") { this.updateAccessoriesReachability(); response.writeHead(204); response.end(); } if (request.url == "/remove") { this.removeAccessory(); response.writeHead(204); response.end(); } }.bind(this)); this.requestServer.listen(18081, function() { platform.log("Server Listening..."); }); if (api) { // Save the API object as plugin needs to register new accessory via this object this.api = api; // Listen to event "didFinishLaunching", this means homebridge already finished loading cached accessories. // Platform Plugin should only register new accessory that doesn't exist in homebridge after this event. // Or start discover new accessories. this.api.on('didFinishLaunching', function() { platform.log("DidFinishLaunching"); }.bind(this)); } }
javascript
function SamplePlatform(log, config, api) { log("SamplePlatform Init"); var platform = this; this.log = log; this.config = config; this.accessories = []; this.requestServer = http.createServer(function(request, response) { if (request.url === "/add") { this.addAccessory(new Date().toISOString()); response.writeHead(204); response.end(); } if (request.url == "/reachability") { this.updateAccessoriesReachability(); response.writeHead(204); response.end(); } if (request.url == "/remove") { this.removeAccessory(); response.writeHead(204); response.end(); } }.bind(this)); this.requestServer.listen(18081, function() { platform.log("Server Listening..."); }); if (api) { // Save the API object as plugin needs to register new accessory via this object this.api = api; // Listen to event "didFinishLaunching", this means homebridge already finished loading cached accessories. // Platform Plugin should only register new accessory that doesn't exist in homebridge after this event. // Or start discover new accessories. this.api.on('didFinishLaunching', function() { platform.log("DidFinishLaunching"); }.bind(this)); } }
[ "function", "SamplePlatform", "(", "log", ",", "config", ",", "api", ")", "{", "log", "(", "\"SamplePlatform Init\"", ")", ";", "var", "platform", "=", "this", ";", "this", ".", "log", "=", "log", ";", "this", ".", "config", "=", "config", ";", "this",...
Platform constructor config may be null api may be null if launched from old homebridge version
[ "Platform", "constructor", "config", "may", "be", "null", "api", "may", "be", "null", "if", "launched", "from", "old", "homebridge", "version" ]
724125dc1b500dfd81048a30a1e3229ff122189a
https://github.com/nfarina/homebridge/blob/724125dc1b500dfd81048a30a1e3229ff122189a/example-plugins/homebridge-samplePlatform/index.js#L23-L65
train
SamplePlatform constructor.
[ 30522, 3853, 7099, 24759, 4017, 14192, 1006, 8833, 1010, 9530, 8873, 2290, 1010, 17928, 1007, 1063, 8833, 1006, 1000, 7099, 24759, 4017, 14192, 1999, 4183, 1000, 1007, 1025, 13075, 4132, 1027, 2023, 1025, 2023, 1012, 8833, 1027, 8833, 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...
SAP/openui5
src/sap.f/src/sap/f/shellBar/ResponsiveHandler.js
function (oContext) { oControl = oContext; // Get and calculate padding's this._iREMSize = parseInt(jQuery("body").css("font-size")); this._iChildControlMargin = parseInt(Parameters.get("_sap_f_ShellBar_ChildMargin")); this._iDoubleChildControlMargin = this._iChildControlMargin * 2; this._iCoPilotWidth = parseInt(Parameters.get("_sap_f_ShellBar_CoPilotWidth")) + this._iDoubleChildControlMargin; this._iHalfCoPilotWidth = this._iCoPilotWidth / 2; // Delegate used to attach on ShellBar lifecycle events this._oDelegate = { onAfterRendering: this.onAfterRendering, onBeforeRendering: this.onBeforeRendering }; // Attach Event Delegates oControl.addDelegate(this._oDelegate, false, this); // Init resize handler method this._fnResize = this._resize; // Attach events oControl._oOverflowToolbar.attachEvent("_controlWidthChanged", this._handleResize, this); }
javascript
function (oContext) { oControl = oContext; // Get and calculate padding's this._iREMSize = parseInt(jQuery("body").css("font-size")); this._iChildControlMargin = parseInt(Parameters.get("_sap_f_ShellBar_ChildMargin")); this._iDoubleChildControlMargin = this._iChildControlMargin * 2; this._iCoPilotWidth = parseInt(Parameters.get("_sap_f_ShellBar_CoPilotWidth")) + this._iDoubleChildControlMargin; this._iHalfCoPilotWidth = this._iCoPilotWidth / 2; // Delegate used to attach on ShellBar lifecycle events this._oDelegate = { onAfterRendering: this.onAfterRendering, onBeforeRendering: this.onBeforeRendering }; // Attach Event Delegates oControl.addDelegate(this._oDelegate, false, this); // Init resize handler method this._fnResize = this._resize; // Attach events oControl._oOverflowToolbar.attachEvent("_controlWidthChanged", this._handleResize, this); }
[ "function", "(", "oContext", ")", "{", "oControl", "=", "oContext", ";", "// Get and calculate padding's", "this", ".", "_iREMSize", "=", "parseInt", "(", "jQuery", "(", "\"body\"", ")", ".", "css", "(", "\"font-size\"", ")", ")", ";", "this", ".", "_iChildC...
Class taking care of the control responsive behaviour. @alias sap/f/shellBar/ResponsiveHandler @since 1.63 @private @property {object} oContext the context of the ShellBar control instance
[ "Class", "taking", "care", "of", "the", "control", "responsive", "behaviour", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.f/src/sap/f/shellBar/ResponsiveHandler.js#L29-L53
train
Initializes the ShellBar
[ 30522, 3853, 1006, 1051, 8663, 18209, 1007, 1063, 1051, 8663, 13181, 2140, 1027, 1051, 8663, 18209, 1025, 1013, 1013, 2131, 1998, 18422, 11687, 4667, 1005, 1055, 2023, 1012, 1035, 20868, 6633, 5332, 4371, 1027, 11968, 20240, 3372, 1006, 104...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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 sCalendarPreference = this._get("calendarPreference"), aCalendars = sCalendarPreference ? sCalendarPreference.split(" ") : [], sCalendarName, sType, i; for ( i = 0 ; i < aCalendars.length ; i++ ) { // No support for calendar subtypes (islamic) yet, so ignore part after - sCalendarName = aCalendars[i].split("-")[0]; for (sType in CalendarType) { if (sCalendarName === sType.toLowerCase()) { return sType; } } } return CalendarType.Gregorian; }
javascript
function() { var sCalendarPreference = this._get("calendarPreference"), aCalendars = sCalendarPreference ? sCalendarPreference.split(" ") : [], sCalendarName, sType, i; for ( i = 0 ; i < aCalendars.length ; i++ ) { // No support for calendar subtypes (islamic) yet, so ignore part after - sCalendarName = aCalendars[i].split("-")[0]; for (sType in CalendarType) { if (sCalendarName === sType.toLowerCase()) { return sType; } } } return CalendarType.Gregorian; }
[ "function", "(", ")", "{", "var", "sCalendarPreference", "=", "this", ".", "_get", "(", "\"calendarPreference\"", ")", ",", "aCalendars", "=", "sCalendarPreference", "?", "sCalendarPreference", ".", "split", "(", "\" \"", ")", ":", "[", "]", ",", "sCalendarNam...
Returns the preferred calendar type for the current locale which exists in {@link sap.ui.core.CalendarType} @returns {sap.ui.core.CalendarType} the preferred calendar type @public @since 1.28.6
[ "Returns", "the", "preferred", "calendar", "type", "for", "the", "current", "locale", "which", "exists", "in", "{", "@link", "sap", ".", "ui", ".", "core", ".", "CalendarType", "}" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/LocaleData.js#L1522-L1538
train
Returns the calendar type for the current calendar
[ 30522, 3853, 1006, 1007, 1063, 13075, 4094, 8943, 14536, 2890, 25523, 1027, 2023, 1012, 1035, 2131, 1006, 1000, 8094, 28139, 25523, 1000, 1007, 1010, 9353, 9453, 8943, 2869, 1027, 4094, 8943, 14536, 2890, 25523, 1029, 4094, 8943, 14536, 289...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/43_sstbin.js
parse_sst_bin
function parse_sst_bin(data, opts)/*:SST*/ { var s/*:SST*/ = ([]/*:any*/); var pass = false; recordhopper(data, function hopper_sst(val, R_n, RT) { switch(RT) { case 0x009F: /* 'BrtBeginSst' */ s.Count = val[0]; s.Unique = val[1]; break; case 0x0013: /* 'BrtSSTItem' */ s.push(val); break; case 0x00A0: /* 'BrtEndSst' */ return true; case 0x0023: /* 'BrtFRTBegin' */ pass = true; break; case 0x0024: /* 'BrtFRTEnd' */ pass = false; break; default: if(R_n.indexOf("Begin") > 0){/* empty */} else if(R_n.indexOf("End") > 0){/* empty */} if(!pass || opts.WTF) throw new Error("Unexpected record " + RT + " " + R_n); } }); return s; }
javascript
function parse_sst_bin(data, opts)/*:SST*/ { var s/*:SST*/ = ([]/*:any*/); var pass = false; recordhopper(data, function hopper_sst(val, R_n, RT) { switch(RT) { case 0x009F: /* 'BrtBeginSst' */ s.Count = val[0]; s.Unique = val[1]; break; case 0x0013: /* 'BrtSSTItem' */ s.push(val); break; case 0x00A0: /* 'BrtEndSst' */ return true; case 0x0023: /* 'BrtFRTBegin' */ pass = true; break; case 0x0024: /* 'BrtFRTEnd' */ pass = false; break; default: if(R_n.indexOf("Begin") > 0){/* empty */} else if(R_n.indexOf("End") > 0){/* empty */} if(!pass || opts.WTF) throw new Error("Unexpected record " + RT + " " + R_n); } }); return s; }
[ "function", "parse_sst_bin", "(", "data", ",", "opts", ")", "/*:SST*/", "{", "var", "s", "/*:SST*/", "=", "(", "[", "]", "/*:any*/", ")", ";", "var", "pass", "=", "false", ";", "recordhopper", "(", "data", ",", "function", "hopper_sst", "(", "val", ","...
/* [MS-XLSB] 2.1.7.45 Shared Strings
[ "/", "*", "[", "MS", "-", "XLSB", "]", "2", ".", "1", ".", "7", ".", "45", "Shared", "Strings" ]
9a6d8a1d3d80c78dad5201fb389316f935279cdc
https://github.com/SheetJS/js-xlsx/blob/9a6d8a1d3d80c78dad5201fb389316f935279cdc/bits/43_sstbin.js#L7-L31
train
Parse SST record
[ 30522, 3853, 11968, 3366, 1035, 7020, 2102, 1035, 8026, 1006, 2951, 1010, 23569, 2015, 1007, 1013, 1008, 1024, 7020, 2102, 1008, 1013, 1063, 13075, 1055, 1013, 1008, 1024, 7020, 2102, 1008, 1013, 1027, 1006, 1031, 1033, 1013, 1008, 1024, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
caolan/async
lib/each.js
eachLimit
function eachLimit(coll, iteratee, callback) { return eachOf(coll, withoutIndex(wrapAsync(iteratee)), callback); }
javascript
function eachLimit(coll, iteratee, callback) { return eachOf(coll, withoutIndex(wrapAsync(iteratee)), callback); }
[ "function", "eachLimit", "(", "coll", ",", "iteratee", ",", "callback", ")", "{", "return", "eachOf", "(", "coll", ",", "withoutIndex", "(", "wrapAsync", "(", "iteratee", ")", ")", ",", "callback", ")", ";", "}" ]
Applies the function `iteratee` to each item in `coll`, in parallel. The `iteratee` is called with an item from the list, and a callback for when it has finished. If the `iteratee` passes an error to its `callback`, the main `callback` (for the `each` function) is immediately called with the error. Note, that since this function applies `iteratee` to each item in parallel, there is no guarantee that the iteratee functions will complete in order. @name each @static @memberOf module:Collections @method @alias forEach @category Collection @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. @param {AsyncFunction} iteratee - An async function to apply to each item in `coll`. Invoked with (item, callback). The array index is not passed to the iteratee. If you need the index, use `eachOf`. @param {Function} [callback] - A callback which is called when all `iteratee` functions have finished, or an error occurs. Invoked with (err). @returns {Promise} a promise, if a callback is omitted @example // assuming openFiles is an array of file names and saveFile is a function // to save the modified contents of that file: async.each(openFiles, saveFile, function(err){ // if any of the saves produced an error, err would equal that error }); // assuming openFiles is an array of file names async.each(openFiles, function(file, callback) { // Perform operation on file here. console.log('Processing file ' + file); if( file.length > 32 ) { console.log('This file name is too long'); callback('File name too long'); } else { // Do work to process file here console.log('File processed'); callback(); } }, function(err) { // if any of the file processing produced an error, err would equal that error if( err ) { // One of the iterations produced an error. // All processing will now stop. console.log('A file failed to process'); } else { console.log('All files have been processed successfully'); } });
[ "Applies", "the", "function", "iteratee", "to", "each", "item", "in", "coll", "in", "parallel", ".", "The", "iteratee", "is", "called", "with", "an", "item", "from", "the", "list", "and", "a", "callback", "for", "when", "it", "has", "finished", ".", "If"...
4330d536c106592139fa82062494c9dba0da1fdb
https://github.com/caolan/async/blob/4330d536c106592139fa82062494c9dba0da1fdb/lib/each.js#L64-L66
train
Iterates over collection and returns an array of items.
[ 30522, 3853, 2169, 17960, 4183, 1006, 8902, 2140, 1010, 2009, 22139, 2063, 1010, 2655, 5963, 1007, 1063, 2709, 2169, 11253, 1006, 8902, 2140, 1010, 2302, 22254, 10288, 1006, 10236, 3022, 6038, 2278, 1006, 2009, 22139, 2063, 1007, 1007, 1010...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
summernote/summernote
src/js/base/core/lists.js
next
function next(array, item) { if (array && array.length && item) { const idx = array.indexOf(item); return idx === -1 ? null : array[idx + 1]; } return null; }
javascript
function next(array, item) { if (array && array.length && item) { const idx = array.indexOf(item); return idx === -1 ? null : array[idx + 1]; } return null; }
[ "function", "next", "(", "array", ",", "item", ")", "{", "if", "(", "array", "&&", "array", ".", "length", "&&", "item", ")", "{", "const", "idx", "=", "array", ".", "indexOf", "(", "item", ")", ";", "return", "idx", "===", "-", "1", "?", "null",...
returns next item. @param {Array} array
[ "returns", "next", "item", "." ]
8dcafb8107453006b905ef697a529c42e76beb3f
https://github.com/summernote/summernote/blob/8dcafb8107453006b905ef697a529c42e76beb3f/src/js/base/core/lists.js#L163-L169
train
Returns the next item in an array of
[ 30522, 3853, 2279, 1006, 9140, 1010, 8875, 1007, 1063, 2065, 1006, 9140, 1004, 1004, 9140, 1012, 3091, 1004, 1004, 8875, 1007, 1063, 9530, 3367, 8909, 2595, 1027, 9140, 1012, 5950, 11253, 1006, 8875, 1007, 1025, 2709, 8909, 2595, 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/extensions/default/InAppNotifications/main.js
_getNotificationInformation
function _getNotificationInformation(_notificationInfoUrl) { // Last time the versionInfoURL was fetched var lastInfoURLFetchTime = PreferencesManager.getViewState("lastNotificationURLFetchTime"); var result = new $.Deferred(); var fetchData = false; var data; // If we don't have data saved in prefs, fetch data = PreferencesManager.getViewState("notificationInfo"); if (!data) { fetchData = true; } // If more than 24 hours have passed since our last fetch, fetch again if (Date.now() > lastInfoURLFetchTime + ONE_DAY) { fetchData = true; } if (fetchData) { var lookupPromise = new $.Deferred(), localNotificationInfoUrl; // If the current locale isn't "en" or "en-US", check whether we actually have a // locale-specific notification target, and fall back to "en" if not. var locale = brackets.getLocale().toLowerCase(); if (locale !== "en" && locale !== "en-us") { localNotificationInfoUrl = _notificationInfoUrl || _getVersionInfoUrl(); // Check if we can reach a locale specific notifications source $.ajax({ url: localNotificationInfoUrl, cache: false, type: "HEAD" }).fail(function (jqXHR, status, error) { // Fallback to "en" locale localNotificationInfoUrl = _getVersionInfoUrl("en"); }).always(function (jqXHR, status, error) { lookupPromise.resolve(); }); } else { localNotificationInfoUrl = _notificationInfoUrl || _getVersionInfoUrl("en"); lookupPromise.resolve(); } lookupPromise.done(function () { $.ajax({ url: localNotificationInfoUrl, dataType: "json", cache: false }).done(function (notificationInfo, textStatus, jqXHR) { lastInfoURLFetchTime = (new Date()).getTime(); PreferencesManager.setViewState("lastNotificationURLFetchTime", lastInfoURLFetchTime); PreferencesManager.setViewState("notificationInfo", notificationInfo); result.resolve(notificationInfo); }).fail(function (jqXHR, status, error) { // When loading data for unit tests, the error handler is // called but the responseText is valid. Try to use it here, // but *don't* save the results in prefs. if (!jqXHR.responseText) { // Text is NULL or empty string, reject(). result.reject(); return; } try { data = JSON.parse(jqXHR.responseText); result.resolve(data); } catch (e) { result.reject(); } }); }); } else { result.resolve(data); } return result.promise(); }
javascript
function _getNotificationInformation(_notificationInfoUrl) { // Last time the versionInfoURL was fetched var lastInfoURLFetchTime = PreferencesManager.getViewState("lastNotificationURLFetchTime"); var result = new $.Deferred(); var fetchData = false; var data; // If we don't have data saved in prefs, fetch data = PreferencesManager.getViewState("notificationInfo"); if (!data) { fetchData = true; } // If more than 24 hours have passed since our last fetch, fetch again if (Date.now() > lastInfoURLFetchTime + ONE_DAY) { fetchData = true; } if (fetchData) { var lookupPromise = new $.Deferred(), localNotificationInfoUrl; // If the current locale isn't "en" or "en-US", check whether we actually have a // locale-specific notification target, and fall back to "en" if not. var locale = brackets.getLocale().toLowerCase(); if (locale !== "en" && locale !== "en-us") { localNotificationInfoUrl = _notificationInfoUrl || _getVersionInfoUrl(); // Check if we can reach a locale specific notifications source $.ajax({ url: localNotificationInfoUrl, cache: false, type: "HEAD" }).fail(function (jqXHR, status, error) { // Fallback to "en" locale localNotificationInfoUrl = _getVersionInfoUrl("en"); }).always(function (jqXHR, status, error) { lookupPromise.resolve(); }); } else { localNotificationInfoUrl = _notificationInfoUrl || _getVersionInfoUrl("en"); lookupPromise.resolve(); } lookupPromise.done(function () { $.ajax({ url: localNotificationInfoUrl, dataType: "json", cache: false }).done(function (notificationInfo, textStatus, jqXHR) { lastInfoURLFetchTime = (new Date()).getTime(); PreferencesManager.setViewState("lastNotificationURLFetchTime", lastInfoURLFetchTime); PreferencesManager.setViewState("notificationInfo", notificationInfo); result.resolve(notificationInfo); }).fail(function (jqXHR, status, error) { // When loading data for unit tests, the error handler is // called but the responseText is valid. Try to use it here, // but *don't* save the results in prefs. if (!jqXHR.responseText) { // Text is NULL or empty string, reject(). result.reject(); return; } try { data = JSON.parse(jqXHR.responseText); result.resolve(data); } catch (e) { result.reject(); } }); }); } else { result.resolve(data); } return result.promise(); }
[ "function", "_getNotificationInformation", "(", "_notificationInfoUrl", ")", "{", "// Last time the versionInfoURL was fetched", "var", "lastInfoURLFetchTime", "=", "PreferencesManager", ".", "getViewState", "(", "\"lastNotificationURLFetchTime\"", ")", ";", "var", "result", "=...
Get a data structure that has information for all Brackets targeted notifications. _notificationInfoUrl is used for unit testing.
[ "Get", "a", "data", "structure", "that", "has", "information", "for", "all", "Brackets", "targeted", "notifications", "." ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/InAppNotifications/main.js#L71-L149
train
Get the notification information from the remote server
[ 30522, 3853, 1035, 2131, 17048, 9031, 2378, 14192, 3370, 1006, 1035, 26828, 2378, 14876, 3126, 2140, 1007, 1063, 1013, 1013, 2197, 2051, 1996, 2544, 2378, 14876, 3126, 2140, 2001, 18584, 2098, 30524, 10270, 3388, 10143, 14428, 1027, 18394, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SeleniumHQ/selenium
javascript/node/selenium-webdriver/lib/http.js
buildPath
function buildPath(path, parameters) { let pathParameters = path.match(/\/:(\w+)\b/g); if (pathParameters) { for (let i = 0; i < pathParameters.length; ++i) { let key = pathParameters[i].substring(2); // Trim the /: if (key in parameters) { let value = parameters[key]; if (WebElement.isId(value)) { // When inserting a WebElement into the URL, only use its ID value, // not the full JSON. value = WebElement.extractId(value); } path = path.replace(pathParameters[i], '/' + value); delete parameters[key]; } else { throw new error.InvalidArgumentError( 'Missing required parameter: ' + key); } } } return path; }
javascript
function buildPath(path, parameters) { let pathParameters = path.match(/\/:(\w+)\b/g); if (pathParameters) { for (let i = 0; i < pathParameters.length; ++i) { let key = pathParameters[i].substring(2); // Trim the /: if (key in parameters) { let value = parameters[key]; if (WebElement.isId(value)) { // When inserting a WebElement into the URL, only use its ID value, // not the full JSON. value = WebElement.extractId(value); } path = path.replace(pathParameters[i], '/' + value); delete parameters[key]; } else { throw new error.InvalidArgumentError( 'Missing required parameter: ' + key); } } } return path; }
[ "function", "buildPath", "(", "path", ",", "parameters", ")", "{", "let", "pathParameters", "=", "path", ".", "match", "(", "/", "\\/:(\\w+)\\b", "/", "g", ")", ";", "if", "(", "pathParameters", ")", "{", "for", "(", "let", "i", "=", "0", ";", "i", ...
Builds a fully qualified path using the given set of command parameters. Each path segment prefixed with ':' will be replaced by the value of the corresponding parameter. All parameters spliced into the path will be removed from the parameter map. @param {string} path The original resource path. @param {!Object<*>} parameters The parameters object to splice into the path. @return {string} The modified path.
[ "Builds", "a", "fully", "qualified", "path", "using", "the", "given", "set", "of", "command", "parameters", ".", "Each", "path", "segment", "prefixed", "with", ":", "will", "be", "replaced", "by", "the", "value", "of", "the", "corresponding", "parameter", "....
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/node/selenium-webdriver/lib/http.js#L593-L614
train
Build a path from the parameters
[ 30522, 3853, 3857, 15069, 1006, 4130, 1010, 11709, 1007, 1063, 2292, 4130, 28689, 22828, 2015, 1027, 4130, 1012, 2674, 1006, 1013, 1032, 1013, 1024, 1006, 1032, 1059, 1009, 1007, 1032, 1038, 1013, 1043, 1007, 1025, 2065, 1006, 4130, 28689, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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(sName) { var sLabel = ""; // remove leading 'P_' often used for parameter properties on HANA sLabel = sName.replace(/^P_(.*)/, "$1"); // split UpperCamelCase in words (treat numbers and _ as upper case) sLabel = sLabel.replace(/([^A-Z0-9_]+)([A-Z0-9_])/g, "$1 $2"); // split acronyms in words sLabel = sLabel.replace(/([A-Z0-9_]{2,})([A-Z0-9_])([^A-Z0-9_]+)/g, "$1 $2$3"); // remove trailing _E sLabel = sLabel.replace(/(.*) _E$/, "$1"); // remove underscores that were identified as upper case sLabel = sLabel.replace(/(.*) _(.*)/g, "$1 $2"); return sLabel; }
javascript
function(sName) { var sLabel = ""; // remove leading 'P_' often used for parameter properties on HANA sLabel = sName.replace(/^P_(.*)/, "$1"); // split UpperCamelCase in words (treat numbers and _ as upper case) sLabel = sLabel.replace(/([^A-Z0-9_]+)([A-Z0-9_])/g, "$1 $2"); // split acronyms in words sLabel = sLabel.replace(/([A-Z0-9_]{2,})([A-Z0-9_])([^A-Z0-9_]+)/g, "$1 $2$3"); // remove trailing _E sLabel = sLabel.replace(/(.*) _E$/, "$1"); // remove underscores that were identified as upper case sLabel = sLabel.replace(/(.*) _(.*)/g, "$1 $2"); return sLabel; }
[ "function", "(", "sName", ")", "{", "var", "sLabel", "=", "\"\"", ";", "// remove leading 'P_' often used for parameter properties on HANA", "sLabel", "=", "sName", ".", "replace", "(", "/", "^P_(.*)", "/", ",", "\"$1\"", ")", ";", "// split UpperCamelCase in words (t...
/* Old helpers that got replaced by robust functions provided by the UI5 ODataModel /* renderPropertyKeyValue : function(sKeyValue, sPropertyEDMTypeName) { if (typeof sKeyValue == "string" && sKeyValue.charAt(0) == "'") throw "Illegal property value starting with a quote"; switch (sPropertyEDMTypeName) { case 'Edm.String': return "'" + sKeyValue + "'"; case 'Edm.DateTime': return "datetime'" + sKeyValue + "'"; case 'Edm.Guid': return "guid'" + sKeyValue + "'"; case 'Edm.Time': return "time'" + sKeyValue + "'"; case 'Edm.DateTimeOffset': return "datetimeoffset'" + sKeyValue + "'"; default: return sKeyValue; } }, renderPropertyFilterValue : function(sFilterValue, sPropertyEDMTypeName) { if (typeof sFilterValue == "string" && sFilterValue.charAt(0) == "'") throw "Illegal property value starting with a quote"; switch (sPropertyEDMTypeName) { case 'Edm.String': return "'" + sFilterValue + "'"; case 'Edm.DateTime': return "datetime'" + sFilterValue + "'"; case 'Edm.Guid': return "guid'" + sFilterValue + "'"; case 'Edm.Time': return "time'" + sFilterValue + "'"; case 'Edm.DateTimeOffset': return "datetimeoffset'" + sFilterValue + "'"; default: return sFilterValue; } },
[ "/", "*", "Old", "helpers", "that", "got", "replaced", "by", "robust", "functions", "provided", "by", "the", "UI5", "ODataModel", "/", "*", "renderPropertyKeyValue", ":", "function", "(", "sKeyValue", "sPropertyEDMTypeName", ")", "{", "if", "(", "typeof", "sKe...
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/analytics/odata4analytics.js#L127-L141
train
returns the label of the given name
[ 30522, 3853, 1006, 1055, 18442, 1007, 1063, 13075, 17584, 2884, 1027, 1000, 1000, 1025, 1013, 1013, 6366, 2877, 1005, 1052, 1035, 1005, 2411, 2109, 2005, 16381, 5144, 2006, 26048, 17584, 2884, 1027, 1055, 18442, 1012, 5672, 1006, 1013, 1034...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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
read_bits_n
function read_bits_n(buf, bl, n) { var w = (bl&7), h = (bl>>>3), f = ((1<<n)-1); var v = buf[h] >>> w; if(n < 8 - w) return v & f; v |= buf[h+1]<<(8-w); if(n < 16 - w) return v & f; v |= buf[h+2]<<(16-w); if(n < 24 - w) return v & f; v |= buf[h+3]<<(24-w); return v & f; }
javascript
function read_bits_n(buf, bl, n) { var w = (bl&7), h = (bl>>>3), f = ((1<<n)-1); var v = buf[h] >>> w; if(n < 8 - w) return v & f; v |= buf[h+1]<<(8-w); if(n < 16 - w) return v & f; v |= buf[h+2]<<(16-w); if(n < 24 - w) return v & f; v |= buf[h+3]<<(24-w); return v & f; }
[ "function", "read_bits_n", "(", "buf", ",", "bl", ",", "n", ")", "{", "var", "w", "=", "(", "bl", "&", "7", ")", ",", "h", "=", "(", "bl", ">>>", "3", ")", ",", "f", "=", "(", "(", "1", "<<", "n", ")", "-", "1", ")", ";", "var", "v", ...
/* works up to n = 3 * 8 + 1 = 25
[ "/", "*", "works", "up", "to", "n", "=", "3", "*", "8", "+", "1", "=", "25" ]
9a6d8a1d3d80c78dad5201fb389316f935279cdc
https://github.com/SheetJS/js-xlsx/blob/9a6d8a1d3d80c78dad5201fb389316f935279cdc/xlsx.js#L2006-L2016
train
read n bits from buffer
[ 30522, 3853, 3191, 1035, 9017, 1035, 1050, 1006, 20934, 2546, 1010, 1038, 2140, 1010, 1050, 1007, 1063, 13075, 1059, 1027, 1006, 1038, 2140, 1004, 1021, 1007, 1010, 1044, 1027, 1006, 1038, 2140, 1028, 1028, 1028, 1017, 1007, 1010, 1042, 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...
aframevr/aframe
src/systems/material.js
function (src, data, cb) { var texture; texture = new THREE.CanvasTexture(src); setTextureProperties(texture, data); cb(texture); }
javascript
function (src, data, cb) { var texture; texture = new THREE.CanvasTexture(src); setTextureProperties(texture, data); cb(texture); }
[ "function", "(", "src", ",", "data", ",", "cb", ")", "{", "var", "texture", ";", "texture", "=", "new", "THREE", ".", "CanvasTexture", "(", "src", ")", ";", "setTextureProperties", "(", "texture", ",", "data", ")", ";", "cb", "(", "texture", ")", ";"...
High-level function for loading canvas textures (THREE.Texture). @param {Element|string} src - Texture source. @param {object} data - Texture data. @param {function} cb - Callback to pass texture to.
[ "High", "-", "level", "function", "for", "loading", "canvas", "textures", "(", "THREE", ".", "Texture", ")", "." ]
24acc78a7299a4cdfe3ef617f4d40ddf6275c992
https://github.com/aframevr/aframe/blob/24acc78a7299a4cdfe3ef617f4d40ddf6275c992/src/systems/material.js#L101-L106
train
Create a texture from a canvas
[ 30522, 3853, 1006, 5034, 2278, 1010, 2951, 1010, 17324, 1007, 1063, 13075, 14902, 1025, 14902, 1027, 2047, 2093, 1012, 10683, 18209, 5397, 1006, 5034, 2278, 1007, 1025, 2275, 18209, 5397, 21572, 4842, 7368, 1006, 14902, 1010, 2951, 1007, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
angular/material
src/components/gridList/grid-list.js
function() { return { tileCount: tileSpans.length, layoutTime: layoutTime, mapTime: mapTime, reflowTime: reflowTime, totalTime: layoutTime + mapTime + reflowTime }; }
javascript
function() { return { tileCount: tileSpans.length, layoutTime: layoutTime, mapTime: mapTime, reflowTime: reflowTime, totalTime: layoutTime + mapTime + reflowTime }; }
[ "function", "(", ")", "{", "return", "{", "tileCount", ":", "tileSpans", ".", "length", ",", "layoutTime", ":", "layoutTime", ",", "mapTime", ":", "mapTime", ",", "reflowTime", ":", "reflowTime", ",", "totalTime", ":", "layoutTime", "+", "mapTime", "+", "r...
Timing for the most recent layout run.
[ "Timing", "for", "the", "most", "recent", "layout", "run", "." ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/gridList/grid-list.js#L527-L535
train
get
[ 30522, 3853, 1006, 1007, 1063, 2709, 1063, 14090, 3597, 16671, 1024, 13262, 9739, 2015, 1012, 3091, 1010, 9621, 7292, 1024, 9621, 7292, 1010, 4949, 7292, 1024, 4949, 7292, 1010, 25416, 8261, 7292, 1024, 25416, 8261, 7292, 1010, 2561, 7292, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
facebook/relay
packages/relay-compiler/core/GraphQLSchemaUtils.js
hasID
function hasID(schema: GraphQLSchema, type: GraphQLCompositeType): boolean { const unmodifiedType = getRawType(type); invariant( unmodifiedType instanceof GraphQLObjectType || unmodifiedType instanceof GraphQLInterfaceType, 'GraphQLSchemaUtils.hasID(): Expected a concrete type or interface, ' + 'got type `%s`.', type, ); const idType = schema.getType(ID_TYPE); const idField = unmodifiedType.getFields()[ID]; return idField && getRawType(idField.type) === idType; }
javascript
function hasID(schema: GraphQLSchema, type: GraphQLCompositeType): boolean { const unmodifiedType = getRawType(type); invariant( unmodifiedType instanceof GraphQLObjectType || unmodifiedType instanceof GraphQLInterfaceType, 'GraphQLSchemaUtils.hasID(): Expected a concrete type or interface, ' + 'got type `%s`.', type, ); const idType = schema.getType(ID_TYPE); const idField = unmodifiedType.getFields()[ID]; return idField && getRawType(idField.type) === idType; }
[ "function", "hasID", "(", "schema", ":", "GraphQLSchema", ",", "type", ":", "GraphQLCompositeType", ")", ":", "boolean", "{", "const", "unmodifiedType", "=", "getRawType", "(", "type", ")", ";", "invariant", "(", "unmodifiedType", "instanceof", "GraphQLObjectType"...
Implements duck typing that checks whether a type has an id field of the ID type. This is approximating what we can hopefully do with the __id proposal a bit more cleanly.
[ "Implements", "duck", "typing", "that", "checks", "whether", "a", "type", "has", "an", "id", "field", "of", "the", "ID", "type", ".", "This", "is", "approximating", "what", "we", "can", "hopefully", "do", "with", "the", "__id", "proposal", "a", "bit", "m...
7fb9be5182b9650637d7b92ead9a42713ac30aa4
https://github.com/facebook/relay/blob/7fb9be5182b9650637d7b92ead9a42713ac30aa4/packages/relay-compiler/core/GraphQLSchemaUtils.js#L87-L99
train
Returns true if the given type has an ID field.
[ 30522, 3853, 2038, 3593, 1006, 8040, 28433, 1024, 10629, 4160, 4877, 5403, 2863, 1010, 2828, 1024, 10629, 4160, 22499, 8737, 20049, 22513, 18863, 1007, 1024, 22017, 20898, 1063, 9530, 3367, 4895, 5302, 4305, 10451, 13874, 1027, 2131, 2527, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
angular/material
src/core/services/interimElement/interimElement.js
startAutoHide
function startAutoHide() { var autoHideTimer, cancelAutoHide = angular.noop; if (options.hideDelay) { autoHideTimer = $timeout(service.hide, options.hideDelay) ; cancelAutoHide = function() { $timeout.cancel(autoHideTimer); }; } // Cache for subsequent use options.cancelAutoHide = function() { cancelAutoHide(); options.cancelAutoHide = undefined; }; }
javascript
function startAutoHide() { var autoHideTimer, cancelAutoHide = angular.noop; if (options.hideDelay) { autoHideTimer = $timeout(service.hide, options.hideDelay) ; cancelAutoHide = function() { $timeout.cancel(autoHideTimer); }; } // Cache for subsequent use options.cancelAutoHide = function() { cancelAutoHide(); options.cancelAutoHide = undefined; }; }
[ "function", "startAutoHide", "(", ")", "{", "var", "autoHideTimer", ",", "cancelAutoHide", "=", "angular", ".", "noop", ";", "if", "(", "options", ".", "hideDelay", ")", "{", "autoHideTimer", "=", "$timeout", "(", "service", ".", "hide", ",", "options", "....
If auto-hide is enabled, start timer and prepare cancel function
[ "If", "auto", "-", "hide", "is", "enabled", "start", "timer", "and", "prepare", "cancel", "function" ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/services/interimElement/interimElement.js#L670-L685
train
Starts auto - hiding the image
[ 30522, 3853, 2707, 4887, 3406, 26100, 1006, 1007, 1063, 13075, 8285, 26100, 7292, 2099, 1010, 17542, 4887, 3406, 26100, 1027, 16108, 1012, 2053, 7361, 1025, 2065, 1006, 7047, 1012, 5342, 9247, 4710, 1007, 1063, 8285, 26100, 7292, 2099, 1027...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/incubator-echarts
src/coord/View.js
function () { // Rect before any transform var rawRect = this.getBoundingRect(); var cx = rawRect.x + rawRect.width / 2; var cy = rawRect.y + rawRect.height / 2; return [cx, cy]; }
javascript
function () { // Rect before any transform var rawRect = this.getBoundingRect(); var cx = rawRect.x + rawRect.width / 2; var cy = rawRect.y + rawRect.height / 2; return [cx, cy]; }
[ "function", "(", ")", "{", "// Rect before any transform", "var", "rawRect", "=", "this", ".", "getBoundingRect", "(", ")", ";", "var", "cx", "=", "rawRect", ".", "x", "+", "rawRect", ".", "width", "/", "2", ";", "var", "cy", "=", "rawRect", ".", "y", ...
Get default center without roam
[ "Get", "default", "center", "without", "roam" ]
4d0ea095dc3929cb6de40c45748826e7999c7aa8
https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/coord/View.js#L161-L168
train
Returns the center of the image
[ 30522, 3853, 1006, 1007, 1063, 1013, 1013, 28667, 2102, 2077, 2151, 10938, 13075, 6315, 2890, 6593, 1027, 2023, 1012, 2131, 15494, 2075, 2890, 6593, 1006, 1007, 1025, 13075, 1039, 2595, 1027, 6315, 2890, 6593, 1012, 1060, 1009, 6315, 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...
Freeboard/freeboard
js/freeboard.thirdparty.js
Collision
function Collision(el, colliders, options) { this.options = $.extend(defaults, options); this.$element = el; this.last_colliders = []; this.last_colliders_coords = []; if(typeof colliders === 'string' || colliders instanceof jQuery) { this.$colliders = $(colliders, this.options.colliders_context).not(this.$element); } else { this.colliders = $(colliders); } this.init(); }
javascript
function Collision(el, colliders, options) { this.options = $.extend(defaults, options); this.$element = el; this.last_colliders = []; this.last_colliders_coords = []; if(typeof colliders === 'string' || colliders instanceof jQuery) { this.$colliders = $(colliders, this.options.colliders_context).not(this.$element); } else { this.colliders = $(colliders); } this.init(); }
[ "function", "Collision", "(", "el", ",", "colliders", ",", "options", ")", "{", "this", ".", "options", "=", "$", ".", "extend", "(", "defaults", ",", "options", ")", ";", "this", ".", "$element", "=", "el", ";", "this", ".", "last_colliders", "=", "...
Detects collisions between a DOM element against other DOM elements or Coords objects. @class Collision @uses Coords @param {HTMLElement} el The jQuery wrapped HTMLElement. @param {HTMLElement|Array} colliders Can be a jQuery collection of HTMLElements or an Array of Coords instances. @param {Object} [options] An Object with all options you want to overwrite: @param {Function} [options.on_overlap_start] Executes a function the first time each `collider ` is overlapped. @param {Function} [options.on_overlap_stop] Executes a function when a `collider` is no longer collided. @param {Function} [options.on_overlap] Executes a function when the mouse is moved during the collision. @return {Object} Collision instance. @constructor
[ "Detects", "collisions", "between", "a", "DOM", "element", "against", "other", "DOM", "elements", "or", "Coords", "objects", "." ]
38789f6e8bd3d04f7d3b2c3427e509d00f2610fc
https://github.com/Freeboard/freeboard/blob/38789f6e8bd3d04f7d3b2c3427e509d00f2610fc/js/freeboard.thirdparty.js#L15273-L15289
train
collision constructor
[ 30522, 3853, 12365, 1006, 3449, 1010, 8902, 24198, 2869, 1010, 7047, 1007, 1063, 2023, 1012, 7047, 1027, 1002, 1012, 7949, 1006, 12398, 2015, 1010, 7047, 1007, 1025, 2023, 1012, 1002, 5783, 1027, 3449, 1025, 2023, 1012, 2197, 1035, 8902, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/model/formatter.js
function (sLink) { if (sLink[0] === "#") { sLink = document.location.href.substring(0,document.location.href.search("demoapps\.html")) + sLink; } return sLink; }
javascript
function (sLink) { if (sLink[0] === "#") { sLink = document.location.href.substring(0,document.location.href.search("demoapps\.html")) + sLink; } return sLink; }
[ "function", "(", "sLink", ")", "{", "if", "(", "sLink", "[", "0", "]", "===", "\"#\"", ")", "{", "sLink", "=", "document", ".", "location", ".", "href", ".", "substring", "(", "0", ",", "document", ".", "location", ".", "href", ".", "search", "(", ...
Formats a library namespace to link to the API reference if it starts with sap. @public @param {string} sNamespace value to be formatted @returns {string} formatted link
[ "Formats", "a", "library", "namespace", "to", "link", "to", "the", "API", "reference", "if", "it", "starts", "with", "sap", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.documentation/src/sap/ui/documentation/sdk/model/formatter.js#L16-L21
train
Add a link to the index page
[ 30522, 3853, 1006, 22889, 19839, 1007, 1063, 2065, 1006, 22889, 19839, 1031, 1014, 1033, 1027, 1027, 1027, 1000, 1001, 1000, 1007, 1063, 22889, 19839, 1027, 6254, 1012, 3295, 1012, 17850, 12879, 1012, 4942, 3367, 4892, 1006, 1014, 1010, 625...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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 (handler, ns, name, type, id) { var hand = new Strophe.Handler(handler, ns, name, type, id); hand.user = false; this.addHandlers.push(hand); return hand; }
javascript
function (handler, ns, name, type, id) { var hand = new Strophe.Handler(handler, ns, name, type, id); hand.user = false; this.addHandlers.push(hand); return hand; }
[ "function", "(", "handler", ",", "ns", ",", "name", ",", "type", ",", "id", ")", "{", "var", "hand", "=", "new", "Strophe", ".", "Handler", "(", "handler", ",", "ns", ",", "name", ",", "type", ",", "id", ")", ";", "hand", ".", "user", "=", "fal...
PrivateFunction: _addSysHandler _Private_ function to add a system level stanza handler. This function is used to add a Strophe.Handler for the library code. System stanza handlers are allowed to run before authentication is complete. Parameters: (Function) handler - The callback function. (String) ns - The namespace to match. (String) name - The stanza name to match. (String) type - The stanza type attribute to match. (String) id - The stanza id attribute to match.
[ "PrivateFunction", ":", "_addSysHandler", "_Private_", "function", "to", "add", "a", "system", "level", "stanza", "handler", "." ]
ff74c90a1671a552f3604b1288bf38a4126312d0
https://github.com/dcloudio/mui/blob/ff74c90a1671a552f3604b1288bf38a4126312d0/examples/login/libs/easymob-webim-sdk/strophe-custom-2.0.0.js#L3405-L3411
train
Add a new handler to the end of the list of handlers
[ 30522, 3853, 1006, 28213, 1010, 24978, 1010, 2171, 1010, 2828, 1010, 8909, 1007, 1063, 13075, 2192, 1027, 2047, 2358, 18981, 5369, 1012, 28213, 1006, 28213, 1010, 24978, 1010, 2171, 1010, 2828, 1010, 8909, 1007, 1025, 2192, 1012, 5310, 1027...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
angular/material
src/components/tabs/js/tabsController.js
attachRipple
function attachRipple (scope, element) { var elements = getElements(); var options = { colorElement: angular.element(elements.inkBar) }; $mdTabInkRipple.attach(scope, element, options); }
javascript
function attachRipple (scope, element) { var elements = getElements(); var options = { colorElement: angular.element(elements.inkBar) }; $mdTabInkRipple.attach(scope, element, options); }
[ "function", "attachRipple", "(", "scope", ",", "element", ")", "{", "var", "elements", "=", "getElements", "(", ")", ";", "var", "options", "=", "{", "colorElement", ":", "angular", ".", "element", "(", "elements", ".", "inkBar", ")", "}", ";", "$mdTabIn...
Attaches a ripple to the tab item element. @param scope @param element
[ "Attaches", "a", "ripple", "to", "the", "tab", "item", "element", "." ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/tabs/js/tabsController.js#L947-L951
train
Attach a ripple to the tab
[ 30522, 3853, 22476, 29443, 10814, 1006, 9531, 1010, 5783, 1007, 1063, 13075, 3787, 1027, 2131, 12260, 8163, 1006, 1007, 1025, 13075, 7047, 1027, 1063, 3609, 12260, 3672, 1024, 16108, 1012, 5783, 1006, 3787, 1012, 10710, 8237, 1007, 1065, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/ControlsMaster.controller.js
function () { var oEntityModel, oDeviceModel, oFilterModel, fnOnDataReady = function (oControlsData) { this._oView.getModel().setData({ entityCount : oControlsData.entityCount, entities : oControlsData.entities }); this.getModel("filter").setData(oControlsData.filter); this._toggleListItem(this._getItemToSelect(), true); }.bind(this); this._oRouter = this.getRouter(); // Keep track if navigation happens via selecting items manually within the List this._bNavToEntityViaList = false; // Cache view reference this._oView = this.getView(); ControlsInfo.loadData().then(fnOnDataReady); oEntityModel = new JSONModel(); oEntityModel.setSizeLimit(100000); this._oView.setModel(oEntityModel); oDeviceModel = new JSONModel({ listMode : (Device.system.phone) ? "None" : "SingleSelectMaster", listItemType : (Device.system.phone) ? "Active" : "Inactive" }); oDeviceModel.setDefaultBindingMode("OneWay"); this._oView.setModel(oDeviceModel, "viewModel"); // Init Filter model oFilterModel = new JSONModel(); oFilterModel.setSizeLimit(100000); this.setModel(oFilterModel, "filter"); this._vsFilterBar = this._oView.byId("vsFilterBar"); this._vsFilterLabel = this._oView.byId("vsFilterLabel"); this._oRouter.getRoute("listFilter").attachPatternMatched(this._onFilterMatched, this); this._oRouter.getRoute("group").attachPatternMatched(this._onGroupMatched, this); this._oRouter.getRoute("entity").attachPatternMatched(this._onEntityMatched, this); this._oRouter.getRoute("sample").attachPatternMatched(this._onSampleMatched, this); this._oRouter.getRoute("code").attachPatternMatched(this._onSampleMatched, this); this._oRouter.getRoute("codeFile").attachPatternMatched(this._onSampleMatched, this); this._oRouter.getRoute("controls").attachPatternMatched(this._onControlsMatched, this); this._oRouter.getRoute("controlsMaster").attachPatternMatched(this._onControlsMasterMatched, this); this.LIST_SCROLL_DURATION = 0; // ms //DOM rendering delay is used before calling scroll, to ensure scroll is applied to the final DOM //DOM rendering delay value is minimal by default, but some function may increase it if that function calls intensive DOM operation // (e.g. RTL change, that leads to new CSS to be requested and applied on entire DOM) this._iDomRenderingDelay = 0; // (ms) this._getList().addEventDelegate({ onAfterRendering : function() { setTimeout(this._scrollToSelectedListItem.bind(this), this._iDomRenderingDelay); }}, this); this._oCore.attachThemeChanged(this._scrollToSelectedListItem, this); // theme change requires us to restore scroll position this._oCore.attachLocalizationChanged(this._onLocalizationChange, this); // Subscribe to view event to apply to it the current configuration this._oView.addEventDelegate({ onBeforeFirstShow: this.onBeforeFirstShow.bind(this) }); // subscribe to app events this._oComponent = this.getOwnerComponent(); this._oRootView = this.getRootView(); switch (this._oComponent.getContentDensityClass()) { case "sapUiSizeCompact": this._oViewSettings.densityMode = COMPACT; break; case "sapUiSizeCondensed": this._oViewSettings.densityMode = CONDENSED; break; default: this._oViewSettings.densityMode = COZY; } this._oViewSettings.rtl = this._oCore.getConfiguration().getRTL(); // Keep default settings for density mode up to date this._oDefaultSettings.densityMode = this._oViewSettings.densityMode; this._oDefaultSettings.rtl = this._oViewSettings.rtl; this._initListSettings(); }
javascript
function () { var oEntityModel, oDeviceModel, oFilterModel, fnOnDataReady = function (oControlsData) { this._oView.getModel().setData({ entityCount : oControlsData.entityCount, entities : oControlsData.entities }); this.getModel("filter").setData(oControlsData.filter); this._toggleListItem(this._getItemToSelect(), true); }.bind(this); this._oRouter = this.getRouter(); // Keep track if navigation happens via selecting items manually within the List this._bNavToEntityViaList = false; // Cache view reference this._oView = this.getView(); ControlsInfo.loadData().then(fnOnDataReady); oEntityModel = new JSONModel(); oEntityModel.setSizeLimit(100000); this._oView.setModel(oEntityModel); oDeviceModel = new JSONModel({ listMode : (Device.system.phone) ? "None" : "SingleSelectMaster", listItemType : (Device.system.phone) ? "Active" : "Inactive" }); oDeviceModel.setDefaultBindingMode("OneWay"); this._oView.setModel(oDeviceModel, "viewModel"); // Init Filter model oFilterModel = new JSONModel(); oFilterModel.setSizeLimit(100000); this.setModel(oFilterModel, "filter"); this._vsFilterBar = this._oView.byId("vsFilterBar"); this._vsFilterLabel = this._oView.byId("vsFilterLabel"); this._oRouter.getRoute("listFilter").attachPatternMatched(this._onFilterMatched, this); this._oRouter.getRoute("group").attachPatternMatched(this._onGroupMatched, this); this._oRouter.getRoute("entity").attachPatternMatched(this._onEntityMatched, this); this._oRouter.getRoute("sample").attachPatternMatched(this._onSampleMatched, this); this._oRouter.getRoute("code").attachPatternMatched(this._onSampleMatched, this); this._oRouter.getRoute("codeFile").attachPatternMatched(this._onSampleMatched, this); this._oRouter.getRoute("controls").attachPatternMatched(this._onControlsMatched, this); this._oRouter.getRoute("controlsMaster").attachPatternMatched(this._onControlsMasterMatched, this); this.LIST_SCROLL_DURATION = 0; // ms //DOM rendering delay is used before calling scroll, to ensure scroll is applied to the final DOM //DOM rendering delay value is minimal by default, but some function may increase it if that function calls intensive DOM operation // (e.g. RTL change, that leads to new CSS to be requested and applied on entire DOM) this._iDomRenderingDelay = 0; // (ms) this._getList().addEventDelegate({ onAfterRendering : function() { setTimeout(this._scrollToSelectedListItem.bind(this), this._iDomRenderingDelay); }}, this); this._oCore.attachThemeChanged(this._scrollToSelectedListItem, this); // theme change requires us to restore scroll position this._oCore.attachLocalizationChanged(this._onLocalizationChange, this); // Subscribe to view event to apply to it the current configuration this._oView.addEventDelegate({ onBeforeFirstShow: this.onBeforeFirstShow.bind(this) }); // subscribe to app events this._oComponent = this.getOwnerComponent(); this._oRootView = this.getRootView(); switch (this._oComponent.getContentDensityClass()) { case "sapUiSizeCompact": this._oViewSettings.densityMode = COMPACT; break; case "sapUiSizeCondensed": this._oViewSettings.densityMode = CONDENSED; break; default: this._oViewSettings.densityMode = COZY; } this._oViewSettings.rtl = this._oCore.getConfiguration().getRTL(); // Keep default settings for density mode up to date this._oDefaultSettings.densityMode = this._oViewSettings.densityMode; this._oDefaultSettings.rtl = this._oViewSettings.rtl; this._initListSettings(); }
[ "function", "(", ")", "{", "var", "oEntityModel", ",", "oDeviceModel", ",", "oFilterModel", ",", "fnOnDataReady", "=", "function", "(", "oControlsData", ")", "{", "this", ".", "_oView", ".", "getModel", "(", ")", ".", "setData", "(", "{", "entityCount", ":...
/* =========================================================== /* lifecycle methods /* =========================================================== Called when the master list controller is instantiated. It sets up the event handling for the master/detail communication and other lifecycle tasks. @public
[ "/", "*", "===========================================================", "/", "*", "lifecycle", "methods", "/", "*", "===========================================================", "Called", "when", "the", "master", "list", "controller", "is", "instantiated", ".", "It", "sets"...
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/ControlsMaster.controller.js#L82-L171
train
Initializes the controls model
[ 30522, 3853, 1006, 1007, 1063, 13075, 1051, 4765, 3012, 5302, 9247, 1010, 24040, 7903, 6633, 10244, 2140, 1010, 1997, 4014, 3334, 5302, 9247, 1010, 1042, 8540, 2850, 7559, 13775, 2100, 1027, 3853, 1006, 1051, 8663, 13181, 4877, 2850, 2696, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/babel-plugin-relay/getDocumentName.js
getDocumentName
function getDocumentName(path: any, state: BabelState): string { let topPath = path; while (topPath.parentPath) { topPath = topPath.parentPath; } // Cache the document name onto this top level path. let documentName = topPath.documentName; if (!documentName) { const parent = topPath.parent; if (parent.comments && parent.comments.length) { const docblock = parent.comments[0].value || ''; const propertyRegex = /@(\S+) *(\S*)/g; let captures; while ((captures = propertyRegex.exec(docblock))) { const property = captures[1]; const value = captures[2]; if (property === PROVIDES_MODULE) { documentName = value.replace(/[\.-:]/g, '_'); break; } } } const basename = state.file && state.file.opts && state.file.opts.filename && getBaseName(state.file.opts.filename); if (basename && !documentName) { const captures = basename.match(/^[_A-Za-z][_0-9A-Za-z]*/); if (captures) { documentName = captures[0]; } } documentName = documentName || 'UnknownFile'; topPath.documentName = documentName; } return documentName; }
javascript
function getDocumentName(path: any, state: BabelState): string { let topPath = path; while (topPath.parentPath) { topPath = topPath.parentPath; } // Cache the document name onto this top level path. let documentName = topPath.documentName; if (!documentName) { const parent = topPath.parent; if (parent.comments && parent.comments.length) { const docblock = parent.comments[0].value || ''; const propertyRegex = /@(\S+) *(\S*)/g; let captures; while ((captures = propertyRegex.exec(docblock))) { const property = captures[1]; const value = captures[2]; if (property === PROVIDES_MODULE) { documentName = value.replace(/[\.-:]/g, '_'); break; } } } const basename = state.file && state.file.opts && state.file.opts.filename && getBaseName(state.file.opts.filename); if (basename && !documentName) { const captures = basename.match(/^[_A-Za-z][_0-9A-Za-z]*/); if (captures) { documentName = captures[0]; } } documentName = documentName || 'UnknownFile'; topPath.documentName = documentName; } return documentName; }
[ "function", "getDocumentName", "(", "path", ":", "any", ",", "state", ":", "BabelState", ")", ":", "string", "{", "let", "topPath", "=", "path", ";", "while", "(", "topPath", ".", "parentPath", ")", "{", "topPath", "=", "topPath", ".", "parentPath", ";",...
Given a path anywhere in a document, produce the name of that document.
[ "Given", "a", "path", "anywhere", "in", "a", "document", "produce", "the", "name", "of", "that", "document", "." ]
7fb9be5182b9650637d7b92ead9a42713ac30aa4
https://github.com/facebook/relay/blob/7fb9be5182b9650637d7b92ead9a42713ac30aa4/packages/babel-plugin-relay/getDocumentName.js#L22-L59
train
Get the document name from the top level path.
[ 30522, 3853, 2131, 3527, 24894, 4765, 18442, 1006, 4130, 1024, 2151, 1010, 2110, 1024, 11561, 4877, 12259, 1007, 1024, 5164, 1063, 2292, 2327, 15069, 1027, 4130, 1025, 2096, 1006, 2327, 15069, 1012, 6687, 15069, 1007, 1063, 2327, 15069, 102...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/Welcome.controller.js
function (oEvent) { var isOpenUI5 = this.getView().getModel("welcomeView").getProperty("/isOpenUI5"), sUrl = isOpenUI5 ? "http://openui5.org/download.html" : "https://tools.hana.ondemand.com/#sapui5"; window.open(sUrl, "_blank"); }
javascript
function (oEvent) { var isOpenUI5 = this.getView().getModel("welcomeView").getProperty("/isOpenUI5"), sUrl = isOpenUI5 ? "http://openui5.org/download.html" : "https://tools.hana.ondemand.com/#sapui5"; window.open(sUrl, "_blank"); }
[ "function", "(", "oEvent", ")", "{", "var", "isOpenUI5", "=", "this", ".", "getView", "(", ")", ".", "getModel", "(", "\"welcomeView\"", ")", ".", "getProperty", "(", "\"/isOpenUI5\"", ")", ",", "sUrl", "=", "isOpenUI5", "?", "\"http://openui5.org/download.htm...
Redirects to the UI5 download page @param {sap.ui.base.Event} oEvent the Button press event @public
[ "Redirects", "to", "the", "UI5", "download", "page" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/Welcome.controller.js#L97-L101
train
Open the UI5 download page
[ 30522, 3853, 1006, 1051, 18697, 3372, 1007, 1063, 13075, 11163, 11837, 10179, 2629, 1027, 2023, 1012, 2131, 8584, 1006, 1007, 1012, 2131, 5302, 9247, 1006, 1000, 6160, 8584, 1000, 1007, 1012, 2131, 21572, 4842, 3723, 1006, 1000, 1013, 11163...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.table/src/sap/ui/table/TableUtils.js
function(oTable) { if (!oTable) { return false; } var oRowSettingsTemplate = oTable.getRowSettingsTemplate(); if (!oRowSettingsTemplate) { return false; } var sHighlight = oRowSettingsTemplate.getHighlight(); return oRowSettingsTemplate.isBound("highlight") || (sHighlight != null && sHighlight !== MessageType.None); }
javascript
function(oTable) { if (!oTable) { return false; } var oRowSettingsTemplate = oTable.getRowSettingsTemplate(); if (!oRowSettingsTemplate) { return false; } var sHighlight = oRowSettingsTemplate.getHighlight(); return oRowSettingsTemplate.isBound("highlight") || (sHighlight != null && sHighlight !== MessageType.None); }
[ "function", "(", "oTable", ")", "{", "if", "(", "!", "oTable", ")", "{", "return", "false", ";", "}", "var", "oRowSettingsTemplate", "=", "oTable", ".", "getRowSettingsTemplate", "(", ")", ";", "if", "(", "!", "oRowSettingsTemplate", ")", "{", "return", ...
Returns whether the table has row highlights. @param {sap.ui.table.Table} oTable Instance of the table. @returns {boolean} Whether the table has row highlights.
[ "Returns", "whether", "the", "table", "has", "row", "highlights", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableUtils.js#L257-L272
train
Returns true if the table has a row highlight property
[ 30522, 3853, 1006, 27178, 3085, 1007, 1063, 2065, 1006, 999, 27178, 3085, 1007, 1063, 2709, 6270, 1025, 1065, 13075, 20298, 9333, 18319, 3070, 13473, 8737, 13806, 1027, 27178, 3085, 1012, 2131, 10524, 21678, 30524, 13473, 8737, 13806, 1012, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
angular/material
src/components/colors/colors.js
interpolateColors
function interpolateColors(themeColors) { var rgbColors = {}; var hasColorProperty = themeColors.hasOwnProperty('color'); angular.forEach(themeColors, function (value, key) { var color = extractColorOptions(value); var hasBackground = key.indexOf('background') > -1; rgbColors[key] = parseColor(color); if (hasBackground && !hasColorProperty) { rgbColors.color = parseColor(color, true); } }); return rgbColors; }
javascript
function interpolateColors(themeColors) { var rgbColors = {}; var hasColorProperty = themeColors.hasOwnProperty('color'); angular.forEach(themeColors, function (value, key) { var color = extractColorOptions(value); var hasBackground = key.indexOf('background') > -1; rgbColors[key] = parseColor(color); if (hasBackground && !hasColorProperty) { rgbColors.color = parseColor(color, true); } }); return rgbColors; }
[ "function", "interpolateColors", "(", "themeColors", ")", "{", "var", "rgbColors", "=", "{", "}", ";", "var", "hasColorProperty", "=", "themeColors", ".", "hasOwnProperty", "(", "'color'", ")", ";", "angular", ".", "forEach", "(", "themeColors", ",", "function...
Convert the color expression into an object with scope-interpolated values Then calculate the rgba() values based on the theme color parts @param {Object} themeColors json object, keys are css properties and values are string of the wanted color, for example: `{color: 'red-A200-0.3'}`. @return {Object} Hashmap of CSS properties with associated `rgba()` string values
[ "Convert", "the", "color", "expression", "into", "an", "object", "with", "scope", "-", "interpolated", "values", "Then", "calculate", "the", "rgba", "()", "values", "based", "on", "the", "theme", "color", "parts" ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/colors/colors.js#L138-L154
train
Interpolates colors in themeColors
[ 30522, 3853, 6970, 18155, 3686, 18717, 2015, 1006, 4323, 18717, 2015, 1007, 1063, 13075, 1054, 18259, 18717, 2015, 1027, 1063, 1065, 1025, 13075, 2038, 18717, 21572, 4842, 3723, 1027, 4323, 18717, 2015, 1012, 2038, 12384, 21572, 4842, 3723, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/cli-engine.js
processFile
function processFile(filename, configHelper, options, linter) { const text = fs.readFileSync(path.resolve(filename), "utf8"); return processText( text, configHelper, filename, options.fix, options.allowInlineConfig, options.reportUnusedDisableDirectives, linter ); }
javascript
function processFile(filename, configHelper, options, linter) { const text = fs.readFileSync(path.resolve(filename), "utf8"); return processText( text, configHelper, filename, options.fix, options.allowInlineConfig, options.reportUnusedDisableDirectives, linter ); }
[ "function", "processFile", "(", "filename", ",", "configHelper", ",", "options", ",", "linter", ")", "{", "const", "text", "=", "fs", ".", "readFileSync", "(", "path", ".", "resolve", "(", "filename", ")", ",", "\"utf8\"", ")", ";", "return", "processText"...
Processes an individual file using ESLint. Files used here are known to exist, so no need to check that here. @param {string} filename The filename of the file being checked. @param {Object} configHelper The configuration options for ESLint. @param {Object} options The CLIEngine options object. @param {Linter} linter Linter context @returns {{rules: LintResult, config: Object}} The results for linting on this text and the fully-resolved config for it. @private
[ "Processes", "an", "individual", "file", "using", "ESLint", ".", "Files", "used", "here", "are", "known", "to", "exist", "so", "no", "need", "to", "check", "that", "here", "." ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/cli-engine.js#L243-L256
train
Process a single file
[ 30522, 3853, 2832, 8873, 2571, 1006, 5371, 18442, 1010, 9530, 8873, 5603, 2884, 4842, 1010, 7047, 1010, 11409, 3334, 1007, 1063, 9530, 3367, 3793, 1027, 1042, 2015, 1012, 3191, 8873, 4244, 6038, 2278, 1006, 4130, 1012, 10663, 1006, 5371, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
grpc/grpc-node
packages/grpc-native-core/src/server.js
_write
function _write(chunk, encoding, callback) { /* jshint validthis: true */ var batch = {}; var self = this; var message; try { message = this.serialize(chunk); } catch (e) { e.code = constants.status.INTERNAL; callback(e); return; } if (!this.call.metadataSent) { batch[grpc.opType.SEND_INITIAL_METADATA] = (new Metadata())._getCoreRepresentation(); this.call.metadataSent = true; } if (Number.isFinite(encoding)) { /* Attach the encoding if it is a finite number. This is the closest we * can get to checking that it is valid flags */ message.grpcWriteFlags = encoding; } batch[grpc.opType.SEND_MESSAGE] = message; this.call.startBatch(batch, function(err, value) { if (err) { self.emit('error', err); return; } callback(); }); }
javascript
function _write(chunk, encoding, callback) { /* jshint validthis: true */ var batch = {}; var self = this; var message; try { message = this.serialize(chunk); } catch (e) { e.code = constants.status.INTERNAL; callback(e); return; } if (!this.call.metadataSent) { batch[grpc.opType.SEND_INITIAL_METADATA] = (new Metadata())._getCoreRepresentation(); this.call.metadataSent = true; } if (Number.isFinite(encoding)) { /* Attach the encoding if it is a finite number. This is the closest we * can get to checking that it is valid flags */ message.grpcWriteFlags = encoding; } batch[grpc.opType.SEND_MESSAGE] = message; this.call.startBatch(batch, function(err, value) { if (err) { self.emit('error', err); return; } callback(); }); }
[ "function", "_write", "(", "chunk", ",", "encoding", ",", "callback", ")", "{", "/* jshint validthis: true */", "var", "batch", "=", "{", "}", ";", "var", "self", "=", "this", ";", "var", "message", ";", "try", "{", "message", "=", "this", ".", "serializ...
Start writing a chunk of data. This is an implementation of a method required for implementing stream.Writable. @private @param {Buffer} chunk The chunk of data to write @param {string} encoding Used to pass write flags @param {function(Error=)} callback Callback to indicate that the write is complete
[ "Start", "writing", "a", "chunk", "of", "data", ".", "This", "is", "an", "implementation", "of", "a", "method", "required", "for", "implementing", "stream", ".", "Writable", "." ]
b36b285f4cdb334bbd48f74c12c13bec69961488
https://github.com/grpc/grpc-node/blob/b36b285f4cdb334bbd48f74c12c13bec69961488/packages/grpc-native-core/src/server.js#L302-L332
train
Writes a chunk to the client
[ 30522, 3853, 1035, 4339, 1006, 20000, 1010, 17181, 1010, 2655, 5963, 1007, 1063, 1013, 1008, 1046, 17426, 2102, 9398, 15222, 2015, 1024, 2995, 1008, 1013, 13075, 14108, 1027, 1063, 1065, 1025, 13075, 2969, 1027, 2023, 1025, 13075, 4471, 102...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/BaseController.js
function (sControlName) { return APIInfo.getIndexJsonPromise().then(function (aData) { function findSymbol (a) { return a.some(function (o) { var bFound = o.name === sControlName; if (!bFound && o.nodes) { return findSymbol(o.nodes); } return bFound; }); } return findSymbol(aData); }); }
javascript
function (sControlName) { return APIInfo.getIndexJsonPromise().then(function (aData) { function findSymbol (a) { return a.some(function (o) { var bFound = o.name === sControlName; if (!bFound && o.nodes) { return findSymbol(o.nodes); } return bFound; }); } return findSymbol(aData); }); }
[ "function", "(", "sControlName", ")", "{", "return", "APIInfo", ".", "getIndexJsonPromise", "(", ")", ".", "then", "(", "function", "(", "aData", ")", "{", "function", "findSymbol", "(", "a", ")", "{", "return", "a", ".", "some", "(", "function", "(", ...
Checks if a control has API Reference @param {string} sControlName @return {Promise} A promise that resolves to {boolean}
[ "Checks", "if", "a", "control", "has", "API", "Reference" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/BaseController.js#L206-L219
train
Find the symbol in the index
[ 30522, 3853, 1006, 8040, 12162, 13153, 18442, 1007, 1063, 2709, 17928, 2378, 14876, 1012, 2131, 22254, 10288, 22578, 2239, 21572, 28732, 1006, 1007, 1012, 2059, 1006, 3853, 1006, 15262, 2696, 1007, 1063, 3853, 4858, 24335, 14956, 1006, 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...
eslint/eslint
lib/rules/no-constant-condition.js
isConstant
function isConstant(node, inBooleanPosition) { switch (node.type) { case "Literal": case "ArrowFunctionExpression": case "FunctionExpression": case "ObjectExpression": case "ArrayExpression": return true; case "UnaryExpression": if (node.operator === "void") { return true; } return (node.operator === "typeof" && inBooleanPosition) || isConstant(node.argument, true); case "BinaryExpression": return isConstant(node.left, false) && isConstant(node.right, false) && node.operator !== "in"; case "LogicalExpression": { const isLeftConstant = isConstant(node.left, inBooleanPosition); const isRightConstant = isConstant(node.right, inBooleanPosition); const isLeftShortCircuit = (isLeftConstant && isLogicalIdentity(node.left, node.operator)); const isRightShortCircuit = (isRightConstant && isLogicalIdentity(node.right, node.operator)); return (isLeftConstant && isRightConstant) || ( // in the case of an "OR", we need to know if the right constant value is truthy node.operator === "||" && isRightConstant && node.right.value && ( !node.parent || node.parent.type !== "BinaryExpression" || !(EQUALITY_OPERATORS.includes(node.parent.operator) || RELATIONAL_OPERATORS.includes(node.parent.operator)) ) ) || isLeftShortCircuit || isRightShortCircuit; } case "AssignmentExpression": return (node.operator === "=") && isConstant(node.right, inBooleanPosition); case "SequenceExpression": return isConstant(node.expressions[node.expressions.length - 1], inBooleanPosition); // no default } return false; }
javascript
function isConstant(node, inBooleanPosition) { switch (node.type) { case "Literal": case "ArrowFunctionExpression": case "FunctionExpression": case "ObjectExpression": case "ArrayExpression": return true; case "UnaryExpression": if (node.operator === "void") { return true; } return (node.operator === "typeof" && inBooleanPosition) || isConstant(node.argument, true); case "BinaryExpression": return isConstant(node.left, false) && isConstant(node.right, false) && node.operator !== "in"; case "LogicalExpression": { const isLeftConstant = isConstant(node.left, inBooleanPosition); const isRightConstant = isConstant(node.right, inBooleanPosition); const isLeftShortCircuit = (isLeftConstant && isLogicalIdentity(node.left, node.operator)); const isRightShortCircuit = (isRightConstant && isLogicalIdentity(node.right, node.operator)); return (isLeftConstant && isRightConstant) || ( // in the case of an "OR", we need to know if the right constant value is truthy node.operator === "||" && isRightConstant && node.right.value && ( !node.parent || node.parent.type !== "BinaryExpression" || !(EQUALITY_OPERATORS.includes(node.parent.operator) || RELATIONAL_OPERATORS.includes(node.parent.operator)) ) ) || isLeftShortCircuit || isRightShortCircuit; } case "AssignmentExpression": return (node.operator === "=") && isConstant(node.right, inBooleanPosition); case "SequenceExpression": return isConstant(node.expressions[node.expressions.length - 1], inBooleanPosition); // no default } return false; }
[ "function", "isConstant", "(", "node", ",", "inBooleanPosition", ")", "{", "switch", "(", "node", ".", "type", ")", "{", "case", "\"Literal\"", ":", "case", "\"ArrowFunctionExpression\"", ":", "case", "\"FunctionExpression\"", ":", "case", "\"ObjectExpression\"", ...
Checks if a node has a constant truthiness value. @param {ASTNode} node The AST node to check. @param {boolean} inBooleanPosition `false` if checking branch of a condition. `true` in all other cases @returns {Bool} true when node's truthiness is constant @private
[ "Checks", "if", "a", "node", "has", "a", "constant", "truthiness", "value", "." ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/no-constant-condition.js#L92-L146
train
Determines if a node is a constant value.
[ 30522, 3853, 2003, 8663, 12693, 2102, 1006, 13045, 1010, 1999, 5092, 9890, 2319, 26994, 1007, 1063, 6942, 1006, 13045, 1012, 2828, 1007, 1063, 2553, 1000, 18204, 1000, 1024, 2553, 1000, 8612, 11263, 27989, 10288, 20110, 3258, 1000, 1024, 25...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/json/encodeGlossary.js
encodeGlossary
function encodeGlossary(glossary) { var file = glossary.getFile(); var entries = glossary.getEntries(); return { file: encodeFile(file), entries: entries .map(encodeGlossaryEntry).toJS() }; }
javascript
function encodeGlossary(glossary) { var file = glossary.getFile(); var entries = glossary.getEntries(); return { file: encodeFile(file), entries: entries .map(encodeGlossaryEntry).toJS() }; }
[ "function", "encodeGlossary", "(", "glossary", ")", "{", "var", "file", "=", "glossary", ".", "getFile", "(", ")", ";", "var", "entries", "=", "glossary", ".", "getEntries", "(", ")", ";", "return", "{", "file", ":", "encodeFile", "(", "file", ")", ","...
Encode a glossary to JSON @param {Glossary} @return {Object}
[ "Encode", "a", "glossary", "to", "JSON" ]
6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4
https://github.com/GitbookIO/gitbook/blob/6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4/lib/json/encodeGlossary.js#L10-L19
train
Encode a glossary
[ 30522, 3853, 4372, 16044, 23296, 21842, 2854, 1006, 27068, 5649, 1007, 1063, 13075, 5371, 1027, 27068, 5649, 1012, 2131, 8873, 2571, 1006, 1007, 1025, 13075, 10445, 1027, 27068, 5649, 1012, 2131, 4765, 5134, 1006, 1007, 1025, 2709, 1063, 53...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
cytoscape/cytoscape.js
dist/cytoscape.esm.js
parsedStyle
function parsedStyle(property) { var includeNonDefault = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; var ele = this[0]; var cy = ele.cy(); if (!cy.styleEnabled()) { return; } if (ele) { var overriddenStyle = ele._private.style[property]; if (overriddenStyle != null) { return overriddenStyle; } else if (includeNonDefault) { return cy.style().getDefaultProperty(property); } else { return null; } } }
javascript
function parsedStyle(property) { var includeNonDefault = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; var ele = this[0]; var cy = ele.cy(); if (!cy.styleEnabled()) { return; } if (ele) { var overriddenStyle = ele._private.style[property]; if (overriddenStyle != null) { return overriddenStyle; } else if (includeNonDefault) { return cy.style().getDefaultProperty(property); } else { return null; } } }
[ "function", "parsedStyle", "(", "property", ")", "{", "var", "includeNonDefault", "=", "arguments", ".", "length", ">", "1", "&&", "arguments", "[", "1", "]", "!==", "undefined", "?", "arguments", "[", "1", "]", ":", "true", ";", "var", "ele", "=", "th...
get the internal parsed style object for the specified property
[ "get", "the", "internal", "parsed", "style", "object", "for", "the", "specified", "property" ]
ad2051b65e2243cfd953d8b24a8bf95bfa8559e5
https://github.com/cytoscape/cytoscape.js/blob/ad2051b65e2243cfd953d8b24a8bf95bfa8559e5/dist/cytoscape.esm.js#L10903-L10923
train
Get the parsed style for the specified property
[ 30522, 3853, 11968, 6924, 21756, 2571, 1006, 3200, 1007, 1063, 13075, 2421, 8540, 3207, 7011, 11314, 1027, 9918, 1012, 3091, 1028, 1015, 1004, 1004, 9918, 1031, 1015, 1033, 999, 1027, 1027, 6151, 28344, 1029, 9918, 1031, 1015, 1033, 1024, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
badges/shields
services/luarocks/luarocks-version-helpers.js
compareVersionLists
function compareVersionLists(v1, v2) { const maxLength = Math.max(v1.length, v2.length) let p1, p2 for (let i = 0; i < maxLength; i++) { p1 = v1[i] || 0 p2 = v2[i] || 0 if (p1 > p2) return 1 if (p1 < p2) return -1 } return 0 }
javascript
function compareVersionLists(v1, v2) { const maxLength = Math.max(v1.length, v2.length) let p1, p2 for (let i = 0; i < maxLength; i++) { p1 = v1[i] || 0 p2 = v2[i] || 0 if (p1 > p2) return 1 if (p1 < p2) return -1 } return 0 }
[ "function", "compareVersionLists", "(", "v1", ",", "v2", ")", "{", "const", "maxLength", "=", "Math", ".", "max", "(", "v1", ".", "length", ",", "v2", ".", "length", ")", "let", "p1", ",", "p2", "for", "(", "let", "i", "=", "0", ";", "i", "<", ...
Compare two arrays containing split and transformed to positive/negative numbers parts of version strings, respecting negative/missing values: [1, 2, 1] > [1, 2], but [1, 2, -1] < [1, 2] ([1, 2] is aligned to [1, 2, 0]) Return a negative value if v1 < v2, zero if v1 = v2, a positive value otherwise.
[ "Compare", "two", "arrays", "containing", "split", "and", "transformed", "to", "positive", "/", "negative", "numbers", "parts", "of", "version", "strings", "respecting", "negative", "/", "missing", "values", ":", "[", "1", "2", "1", "]", ">", "[", "1", "2"...
283601423f3d1a19aae83bf62032d40683948636
https://github.com/badges/shields/blob/283601423f3d1a19aae83bf62032d40683948636/services/luarocks/luarocks-version-helpers.js#L17-L27
train
Compare two version lists
[ 30522, 3853, 12826, 27774, 27103, 1006, 1058, 2487, 1010, 1058, 2475, 1007, 1063, 9530, 3367, 4098, 7770, 13512, 2232, 1027, 8785, 1012, 4098, 1006, 1058, 2487, 1012, 3091, 1010, 1058, 2475, 1012, 3091, 1007, 2292, 1052, 2487, 1010, 1052, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
facebook/relay
packages/relay-compiler/transforms/RelayRefetchableFragmentTransform.js
buildRefetchMap
function buildRefetchMap( context: GraphQLCompilerContext, ): Map<string, Fragment> { const refetchOperations = new Map(); const errors = eachWithErrors(context.documents(), node => { if (node.kind !== 'Fragment') { return; } const refetchName = getRefetchQueryName(node); if (refetchName === null) { return; } const previousOperation = refetchOperations.get(refetchName); if (previousOperation != null) { throw createUserError( `Duplicate definition for @refetchable operation '${refetchName}' from fragments '${ node.name }' and '${previousOperation.name}'`, [node.loc, previousOperation.loc], ); } refetchOperations.set(refetchName, node); }); if (errors != null && errors.length !== 0) { throw createCombinedError(errors, 'RelayRefetchableFragmentTransform'); } const transformed = inferRootArgumentDefinitions(context); return new Map( Array.from(refetchOperations.entries(), ([name, fragment]) => { return [name, transformed.getFragment(fragment.name)]; }), ); }
javascript
function buildRefetchMap( context: GraphQLCompilerContext, ): Map<string, Fragment> { const refetchOperations = new Map(); const errors = eachWithErrors(context.documents(), node => { if (node.kind !== 'Fragment') { return; } const refetchName = getRefetchQueryName(node); if (refetchName === null) { return; } const previousOperation = refetchOperations.get(refetchName); if (previousOperation != null) { throw createUserError( `Duplicate definition for @refetchable operation '${refetchName}' from fragments '${ node.name }' and '${previousOperation.name}'`, [node.loc, previousOperation.loc], ); } refetchOperations.set(refetchName, node); }); if (errors != null && errors.length !== 0) { throw createCombinedError(errors, 'RelayRefetchableFragmentTransform'); } const transformed = inferRootArgumentDefinitions(context); return new Map( Array.from(refetchOperations.entries(), ([name, fragment]) => { return [name, transformed.getFragment(fragment.name)]; }), ); }
[ "function", "buildRefetchMap", "(", "context", ":", "GraphQLCompilerContext", ",", ")", ":", "Map", "<", "string", ",", "Fragment", ">", "{", "const", "refetchOperations", "=", "new", "Map", "(", ")", ";", "const", "errors", "=", "eachWithErrors", "(", "cont...
Walk the documents of a compiler context and create a mapping of refetch operation names to the source fragment from which the refetch operation should be derived.
[ "Walk", "the", "documents", "of", "a", "compiler", "context", "and", "create", "a", "mapping", "of", "refetch", "operation", "names", "to", "the", "source", "fragment", "from", "which", "the", "refetch", "operation", "should", "be", "derived", "." ]
7fb9be5182b9650637d7b92ead9a42713ac30aa4
https://github.com/facebook/relay/blob/7fb9be5182b9650637d7b92ead9a42713ac30aa4/packages/relay-compiler/transforms/RelayRefetchableFragmentTransform.js#L169-L201
train
Build a refetch map from a GraphQL CompilerContext
[ 30522, 3853, 3857, 2890, 7959, 10649, 2863, 2361, 1006, 6123, 1024, 10629, 4160, 22499, 8737, 9463, 29566, 10111, 18413, 1010, 1007, 1024, 4949, 1026, 5164, 1010, 15778, 1028, 1063, 9530, 3367, 25416, 3388, 9905, 29487, 2015, 1027, 2047, 49...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
nhn/tui.editor
src/js/wysiwygCommands/tableRemoveRow.js
getSelectedRows
function getSelectedRows(firstSelectedCell, rangeInformation, $table) { const tbodyRowLength = $table.find('tbody tr').length; const isStartContainerInThead = $(firstSelectedCell).parents('thead').length; let startRowIndex = rangeInformation.from.row; let endRowIndex = rangeInformation.to.row; if (isStartContainerInThead) { startRowIndex += 1; } const isWholeTbodySelected = (startRowIndex === 1 || isStartContainerInThead) && endRowIndex === tbodyRowLength; if (isWholeTbodySelected) { endRowIndex -= 1; } return $table.find('tr').slice(startRowIndex, endRowIndex + 1); }
javascript
function getSelectedRows(firstSelectedCell, rangeInformation, $table) { const tbodyRowLength = $table.find('tbody tr').length; const isStartContainerInThead = $(firstSelectedCell).parents('thead').length; let startRowIndex = rangeInformation.from.row; let endRowIndex = rangeInformation.to.row; if (isStartContainerInThead) { startRowIndex += 1; } const isWholeTbodySelected = (startRowIndex === 1 || isStartContainerInThead) && endRowIndex === tbodyRowLength; if (isWholeTbodySelected) { endRowIndex -= 1; } return $table.find('tr').slice(startRowIndex, endRowIndex + 1); }
[ "function", "getSelectedRows", "(", "firstSelectedCell", ",", "rangeInformation", ",", "$table", ")", "{", "const", "tbodyRowLength", "=", "$table", ".", "find", "(", "'tbody tr'", ")", ".", "length", ";", "const", "isStartContainerInThead", "=", "$", "(", "firs...
Get start, end row index from current range @param {HTMLElement} firstSelectedCell Range object @param {object} rangeInformation Range information object @param {jQuery} $table jquery wrapped TABLE @returns {jQuery}
[ "Get", "start", "end", "row", "index", "from", "current", "range" ]
e75ab08c2a7ab07d1143e318f7cde135c5e3002e
https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/wysiwygCommands/tableRemoveRow.js#L69-L86
train
Get selected rows
[ 30522, 3853, 4152, 12260, 10985, 10524, 2015, 1006, 2034, 11246, 22471, 2098, 29109, 2140, 1010, 2846, 2378, 14192, 3370, 1010, 1002, 2795, 1007, 1063, 9530, 3367, 26419, 7716, 12541, 5004, 7770, 13512, 2232, 1027, 1002, 2795, 1012, 2424, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/MasterTreeBaseController.js
function () { var oBinding = this.byId("tree").getBinding("items"); if (this._sFilter) { oBinding.filter(new Filter({ path: "name", operator: FilterOperator.Contains, value1: this._sFilter })); return true; } else { oBinding.filter(); return false; } }
javascript
function () { var oBinding = this.byId("tree").getBinding("items"); if (this._sFilter) { oBinding.filter(new Filter({ path: "name", operator: FilterOperator.Contains, value1: this._sFilter })); return true; } else { oBinding.filter(); return false; } }
[ "function", "(", ")", "{", "var", "oBinding", "=", "this", ".", "byId", "(", "\"tree\"", ")", ".", "getBinding", "(", "\"items\"", ")", ";", "if", "(", "this", ".", "_sFilter", ")", "{", "oBinding", ".", "filter", "(", "new", "Filter", "(", "{", "p...
Build and apply filters to the tree model. @returns {boolean} if search filter is applied
[ "Build", "and", "apply", "filters", "to", "the", "tree", "model", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/MasterTreeBaseController.js#L123-L136
train
Returns true if the filter is set to true
[ 30522, 3853, 1006, 1007, 1063, 13075, 27885, 22254, 2075, 1027, 2023, 1012, 2011, 3593, 1006, 1000, 3392, 1000, 1007, 1012, 2131, 8428, 4667, 1006, 1000, 5167, 1000, 1007, 1025, 2065, 1006, 2023, 1012, 1035, 16420, 4014, 3334, 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...
SAP/openui5
src/sap.ui.table/src/sap/ui/table/TablePointerExtension.js
function(oTable, oPos, bShow) { if (!oPos || !oTable._$ReorderIndicator) { return; } var iLeft = oPos.left - oTable.getDomRef().getBoundingClientRect().left; if (oTable._bRtlMode && oPos.before || !oTable._bRtlMode && oPos.after) { iLeft = iLeft + oPos.width; } jQuery(oTable._$ReorderIndicator).css({ "left": iLeft + "px" }).toggleClass("sapUiTableColReorderIndicatorActive", bShow); }
javascript
function(oTable, oPos, bShow) { if (!oPos || !oTable._$ReorderIndicator) { return; } var iLeft = oPos.left - oTable.getDomRef().getBoundingClientRect().left; if (oTable._bRtlMode && oPos.before || !oTable._bRtlMode && oPos.after) { iLeft = iLeft + oPos.width; } jQuery(oTable._$ReorderIndicator).css({ "left": iLeft + "px" }).toggleClass("sapUiTableColReorderIndicatorActive", bShow); }
[ "function", "(", "oTable", ",", "oPos", ",", "bShow", ")", "{", "if", "(", "!", "oPos", "||", "!", "oTable", ".", "_$ReorderIndicator", ")", "{", "return", ";", "}", "var", "iLeft", "=", "oPos", ".", "left", "-", "oTable", ".", "getDomRef", "(", ")...
/* Positions the reorder marker on the column (given by the position information). @see findColumnForPosition
[ "/", "*", "Positions", "the", "reorder", "marker", "on", "the", "column", "(", "given", "by", "the", "position", "information", ")", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TablePointerExtension.js#L666-L679
train
Sets the active state of the reorder indicator
[ 30522, 3853, 1006, 27178, 3085, 1010, 6728, 2891, 1010, 18667, 14406, 1007, 1063, 2065, 1006, 999, 6728, 2891, 1064, 1064, 999, 27178, 3085, 1012, 1035, 1002, 2128, 8551, 23282, 14808, 8844, 1007, 1063, 2709, 1025, 1065, 13075, 17869, 6199,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/services/apigateway.js
setAcceptHeader
function setAcceptHeader(req) { var httpRequest = req.httpRequest; if (!httpRequest.headers.Accept) { httpRequest.headers['Accept'] = 'application/json'; } }
javascript
function setAcceptHeader(req) { var httpRequest = req.httpRequest; if (!httpRequest.headers.Accept) { httpRequest.headers['Accept'] = 'application/json'; } }
[ "function", "setAcceptHeader", "(", "req", ")", "{", "var", "httpRequest", "=", "req", ".", "httpRequest", ";", "if", "(", "!", "httpRequest", ".", "headers", ".", "Accept", ")", "{", "httpRequest", ".", "headers", "[", "'Accept'", "]", "=", "'application/...
Sets the Accept header to application/json. @api private
[ "Sets", "the", "Accept", "header", "to", "application", "/", "json", "." ]
c23e5f0edd150f8885267e5f7c8a564f8e6e8562
https://github.com/aws/aws-sdk-js/blob/c23e5f0edd150f8885267e5f7c8a564f8e6e8562/lib/services/apigateway.js#L9-L14
train
Set the Accept header
[ 30522, 3853, 2275, 6305, 3401, 13876, 4974, 2121, 1006, 2128, 4160, 1007, 1063, 13075, 8299, 2890, 15500, 1027, 2128, 4160, 1012, 8299, 2890, 15500, 1025, 2065, 1006, 999, 8299, 2890, 15500, 1012, 20346, 2015, 1012, 5138, 1007, 1063, 8299, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
tgriesser/knex
src/dialects/oracledb/index.js
readStream
function readStream(stream, cb) { const oracledb = require('oracledb'); let data = ''; if (stream.iLob.type === oracledb.CLOB) { stream.setEncoding('utf-8'); } else { data = Buffer.alloc(0); } stream.on('error', function(err) { cb(err); }); stream.on('data', function(chunk) { if (stream.iLob.type === oracledb.CLOB) { data += chunk; } else { data = Buffer.concat([data, chunk]); } }); stream.on('end', function() { cb(null, data); }); }
javascript
function readStream(stream, cb) { const oracledb = require('oracledb'); let data = ''; if (stream.iLob.type === oracledb.CLOB) { stream.setEncoding('utf-8'); } else { data = Buffer.alloc(0); } stream.on('error', function(err) { cb(err); }); stream.on('data', function(chunk) { if (stream.iLob.type === oracledb.CLOB) { data += chunk; } else { data = Buffer.concat([data, chunk]); } }); stream.on('end', function() { cb(null, data); }); }
[ "function", "readStream", "(", "stream", ",", "cb", ")", "{", "const", "oracledb", "=", "require", "(", "'oracledb'", ")", ";", "let", "data", "=", "''", ";", "if", "(", "stream", ".", "iLob", ".", "type", "===", "oracledb", ".", "CLOB", ")", "{", ...
Handle clob
[ "Handle", "clob" ]
6a4fecfe7822442ee5c43d924958eadfe6e17a93
https://github.com/tgriesser/knex/blob/6a4fecfe7822442ee5c43d924958eadfe6e17a93/src/dialects/oracledb/index.js#L337-L359
train
read stream data
[ 30522, 3853, 9631, 25379, 1006, 5460, 1010, 17324, 1007, 1063, 9530, 3367, 14721, 18939, 1027, 5478, 1006, 1005, 14721, 18939, 1005, 1007, 1025, 2292, 2951, 1027, 1005, 1005, 1025, 2065, 1006, 5460, 1012, 6335, 16429, 1012, 2828, 1027, 1027...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
dcloudio/mui
examples/login/libs/easymob-webim-sdk/strophe-custom-2.0.0.js
function (handRef) { // this must be done in the Idle loop so that we don't change // the handlers during iteration this.removeHandlers.push(handRef); // If a handler is being deleted while it is being added, // prevent it from getting added var i = this.addHandlers.indexOf(handRef); if (i >= 0) { this.addHandlers.splice(i, 1); } }
javascript
function (handRef) { // this must be done in the Idle loop so that we don't change // the handlers during iteration this.removeHandlers.push(handRef); // If a handler is being deleted while it is being added, // prevent it from getting added var i = this.addHandlers.indexOf(handRef); if (i >= 0) { this.addHandlers.splice(i, 1); } }
[ "function", "(", "handRef", ")", "{", "// this must be done in the Idle loop so that we don't change\r", "// the handlers during iteration\r", "this", ".", "removeHandlers", ".", "push", "(", "handRef", ")", ";", "// If a handler is being deleted while it is being added,\r", "// pr...
Function: deleteHandler Delete a stanza handler for a connection. This function removes a stanza handler from the connection. The handRef parameter is *not* the function passed to addHandler(), but is the reference returned from addHandler(). Parameters: (Strophe.Handler) handRef - The handler reference.
[ "Function", ":", "deleteHandler", "Delete", "a", "stanza", "handler", "for", "a", "connection", "." ]
ff74c90a1671a552f3604b1288bf38a4126312d0
https://github.com/dcloudio/mui/blob/ff74c90a1671a552f3604b1288bf38a4126312d0/examples/login/libs/easymob-webim-sdk/strophe-custom-2.0.0.js#L2665-L2676
train
Remove a handler from the list of handlers
[ 30522, 3853, 1006, 2192, 2890, 2546, 1007, 1063, 1013, 1013, 2023, 2442, 2022, 2589, 1999, 1996, 18373, 7077, 2061, 2008, 2057, 2123, 1005, 1056, 2689, 1013, 1013, 1996, 28213, 2015, 2076, 27758, 2023, 1012, 6366, 11774, 12910, 1012, 5245, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/json/encodeGlossaryEntry.js
encodeGlossaryEntry
function encodeGlossaryEntry(entry) { return { id: entry.getID(), name: entry.getName(), description: entry.getDescription() }; }
javascript
function encodeGlossaryEntry(entry) { return { id: entry.getID(), name: entry.getName(), description: entry.getDescription() }; }
[ "function", "encodeGlossaryEntry", "(", "entry", ")", "{", "return", "{", "id", ":", "entry", ".", "getID", "(", ")", ",", "name", ":", "entry", ".", "getName", "(", ")", ",", "description", ":", "entry", ".", "getDescription", "(", ")", "}", ";", "}...
Encode a SummaryArticle to JSON @param {GlossaryEntry} @return {Object}
[ "Encode", "a", "SummaryArticle", "to", "JSON" ]
6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4
https://github.com/GitbookIO/gitbook/blob/6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4/lib/json/encodeGlossaryEntry.js#L8-L14
train
Encode a glossary entry
[ 30522, 3853, 4372, 16044, 23296, 21842, 2854, 4765, 2854, 1006, 4443, 1007, 1063, 2709, 1063, 8909, 1024, 4443, 1012, 2131, 3593, 1006, 1007, 1010, 2171, 1024, 4443, 1012, 2131, 18442, 1006, 1007, 1010, 6412, 1024, 4443, 1012, 2131, 6155, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
eslint/eslint
lib/rules/no-mixed-operators.js
shouldIgnore
function shouldIgnore(node) { const a = node; const b = node.parent; return ( !includesBothInAGroup(options.groups, a.operator, b.operator) || ( options.allowSamePrecedence && astUtils.getPrecedence(a) === astUtils.getPrecedence(b) ) ); }
javascript
function shouldIgnore(node) { const a = node; const b = node.parent; return ( !includesBothInAGroup(options.groups, a.operator, b.operator) || ( options.allowSamePrecedence && astUtils.getPrecedence(a) === astUtils.getPrecedence(b) ) ); }
[ "function", "shouldIgnore", "(", "node", ")", "{", "const", "a", "=", "node", ";", "const", "b", "=", "node", ".", "parent", ";", "return", "(", "!", "includesBothInAGroup", "(", "options", ".", "groups", ",", "a", ".", "operator", ",", "b", ".", "op...
Checks whether a given node should be ignored by options or not. @param {ASTNode} node - A node to check. This is a BinaryExpression node or a LogicalExpression node. This parent node is one of them, too. @returns {boolean} `true` if the node should be ignored.
[ "Checks", "whether", "a", "given", "node", "should", "be", "ignored", "by", "options", "or", "not", "." ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/no-mixed-operators.js#L119-L130
train
Check if node should be ignored
[ 30522, 3853, 2323, 23773, 5686, 1006, 13045, 1007, 1063, 9530, 3367, 1037, 1027, 13045, 1025, 9530, 3367, 1038, 1027, 13045, 1012, 6687, 1025, 2709, 1006, 999, 2950, 18384, 10606, 8490, 22107, 1006, 7047, 1012, 2967, 1010, 1037, 1012, 6872,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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_borders
function parse_borders(t, styles, themes, opts) { styles.Borders = []; var border = {}/*, sub_border = {}*/; var pass = false; t[0].match(tagregex).forEach(function(x) { var y = parsexmltag(x); switch(strip_ns(y[0])) { case '<borders': case '<borders>': case '</borders>': break; /* 18.8.4 border CT_Border */ case '<border': case '<border>': case '<border/>': border = {}; if (y.diagonalUp) { border.diagonalUp = y.diagonalUp; } if (y.diagonalDown) { border.diagonalDown = y.diagonalDown; } styles.Borders.push(border); break; case '</border>': break; /* note: not in spec, appears to be CT_BorderPr */ case '<left/>': break; case '<left': case '<left>': break; case '</left>': break; /* note: not in spec, appears to be CT_BorderPr */ case '<right/>': break; case '<right': case '<right>': break; case '</right>': break; /* 18.8.43 top CT_BorderPr */ case '<top/>': break; case '<top': case '<top>': break; case '</top>': break; /* 18.8.6 bottom CT_BorderPr */ case '<bottom/>': break; case '<bottom': case '<bottom>': break; case '</bottom>': break; /* 18.8.13 diagonal CT_BorderPr */ case '<diagonal': case '<diagonal>': case '<diagonal/>': break; case '</diagonal>': break; /* 18.8.25 horizontal CT_BorderPr */ case '<horizontal': case '<horizontal>': case '<horizontal/>': break; case '</horizontal>': break; /* 18.8.44 vertical CT_BorderPr */ case '<vertical': case '<vertical>': case '<vertical/>': break; case '</vertical>': break; /* 18.8.37 start CT_BorderPr */ case '<start': case '<start>': case '<start/>': break; case '</start>': break; /* 18.8.16 end CT_BorderPr */ case '<end': case '<end>': case '<end/>': break; case '</end>': break; /* 18.8.? color CT_Color */ case '<color': case '<color>': break; case '<color/>': case '</color>': break; /* 18.2.10 extLst CT_ExtensionList ? */ case '<extLst': case '<extLst>': case '</extLst>': break; case '<ext': pass = true; break; case '</ext>': pass = false; break; default: if(opts && opts.WTF) { if(!pass) throw new Error('unrecognized ' + y[0] + ' in borders'); } } }); }
javascript
function parse_borders(t, styles, themes, opts) { styles.Borders = []; var border = {}/*, sub_border = {}*/; var pass = false; t[0].match(tagregex).forEach(function(x) { var y = parsexmltag(x); switch(strip_ns(y[0])) { case '<borders': case '<borders>': case '</borders>': break; /* 18.8.4 border CT_Border */ case '<border': case '<border>': case '<border/>': border = {}; if (y.diagonalUp) { border.diagonalUp = y.diagonalUp; } if (y.diagonalDown) { border.diagonalDown = y.diagonalDown; } styles.Borders.push(border); break; case '</border>': break; /* note: not in spec, appears to be CT_BorderPr */ case '<left/>': break; case '<left': case '<left>': break; case '</left>': break; /* note: not in spec, appears to be CT_BorderPr */ case '<right/>': break; case '<right': case '<right>': break; case '</right>': break; /* 18.8.43 top CT_BorderPr */ case '<top/>': break; case '<top': case '<top>': break; case '</top>': break; /* 18.8.6 bottom CT_BorderPr */ case '<bottom/>': break; case '<bottom': case '<bottom>': break; case '</bottom>': break; /* 18.8.13 diagonal CT_BorderPr */ case '<diagonal': case '<diagonal>': case '<diagonal/>': break; case '</diagonal>': break; /* 18.8.25 horizontal CT_BorderPr */ case '<horizontal': case '<horizontal>': case '<horizontal/>': break; case '</horizontal>': break; /* 18.8.44 vertical CT_BorderPr */ case '<vertical': case '<vertical>': case '<vertical/>': break; case '</vertical>': break; /* 18.8.37 start CT_BorderPr */ case '<start': case '<start>': case '<start/>': break; case '</start>': break; /* 18.8.16 end CT_BorderPr */ case '<end': case '<end>': case '<end/>': break; case '</end>': break; /* 18.8.? color CT_Color */ case '<color': case '<color>': break; case '<color/>': case '</color>': break; /* 18.2.10 extLst CT_ExtensionList ? */ case '<extLst': case '<extLst>': case '</extLst>': break; case '<ext': pass = true; break; case '</ext>': pass = false; break; default: if(opts && opts.WTF) { if(!pass) throw new Error('unrecognized ' + y[0] + ' in borders'); } } }); }
[ "function", "parse_borders", "(", "t", ",", "styles", ",", "themes", ",", "opts", ")", "{", "styles", ".", "Borders", "=", "[", "]", ";", "var", "border", "=", "{", "}", "/*, sub_border = {}*/", ";", "var", "pass", "=", "false", ";", "t", "[", "0", ...
/* 18.8.5 borders CT_Borders
[ "/", "*", "18", ".", "8", ".", "5", "borders", "CT_Borders" ]
9a6d8a1d3d80c78dad5201fb389316f935279cdc
https://github.com/SheetJS/js-xlsx/blob/9a6d8a1d3d80c78dad5201fb389316f935279cdc/xlsx.js#L8600-L8671
train
Parse the borders of an XML element
[ 30522, 3853, 11968, 3366, 1035, 6645, 1006, 1056, 1010, 6782, 1010, 6991, 1010, 23569, 2015, 1007, 1063, 6782, 1012, 6645, 1027, 1031, 1033, 1025, 13075, 3675, 1027, 1063, 1065, 1013, 1008, 1010, 4942, 1035, 3675, 1027, 1063, 1065, 1008, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
jiahaog/nativefier
src/options/fields/index.js
wrap
function wrap(fieldName, promise, args) { return promise(args).then((result) => ({ [fieldName]: result, })); }
javascript
function wrap(fieldName, promise, args) { return promise(args).then((result) => ({ [fieldName]: result, })); }
[ "function", "wrap", "(", "fieldName", ",", "promise", ",", "args", ")", "{", "return", "promise", "(", "args", ")", ".", "then", "(", "(", "result", ")", "=>", "(", "{", "[", "fieldName", "]", ":", "result", ",", "}", ")", ")", ";", "}" ]
Modifies the result of each promise from a scalar value to a object containing its fieldname
[ "Modifies", "the", "result", "of", "each", "promise", "from", "a", "scalar", "value", "to", "a", "object", "containing", "its", "fieldname" ]
b959956a38ce51a9dd95d42308f0a6c66489b624
https://github.com/jiahaog/nativefier/blob/b959956a38ce51a9dd95d42308f0a6c66489b624/src/options/fields/index.js#L22-L26
train
Wrap a promise with an object
[ 30522, 3853, 10236, 1006, 2492, 18442, 1010, 4872, 1010, 12098, 5620, 1007, 1063, 2709, 4872, 1006, 12098, 5620, 1007, 1012, 2059, 1006, 1006, 2765, 1007, 1027, 1028, 1006, 1063, 1031, 2492, 18442, 1033, 1024, 2765, 1010, 1065, 1007, 1007, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
30-seconds/30-seconds-of-code
scripts/module.js
build
async function build() { console.time('Packager'); let requires = []; let esmExportString = ''; let cjsExportString = ''; try { if (!fs.existsSync(DIST_PATH)) fs.mkdirSync(DIST_PATH); fs.writeFileSync(ROLLUP_INPUT_FILE, ''); fs.writeFileSync(TEST_MODULE_FILE, ''); // All the snippets that are Node.js-based and will break in a browser // environment const nodeSnippets = fs .readFileSync('tag_database', 'utf8') .split('\n') .filter(v => v.search(/:.*node/g) !== -1) .map(v => v.slice(0, v.indexOf(':'))); const snippets = fs.readdirSync(SNIPPETS_PATH); const archivedSnippets = fs .readdirSync(SNIPPETS_ARCHIVE_PATH) .filter(v => v !== 'README.md'); snippets.forEach(snippet => { const rawSnippetString = getRawSnippetString(SNIPPETS_PATH, snippet); const snippetName = snippet.replace('.md', ''); let code = getCode(rawSnippetString); if (nodeSnippets.includes(snippetName)) { requires.push(code.match(/const.*=.*require\(([^\)]*)\);/g)); code = code.replace(/const.*=.*require\(([^\)]*)\);/g, ''); } esmExportString += `export ${code}`; cjsExportString += code; }); archivedSnippets.forEach(snippet => { const rawSnippetString = getRawSnippetString( SNIPPETS_ARCHIVE_PATH, snippet ); cjsExportString += getCode(rawSnippetString); }); requires = [ ...new Set( requires .filter(Boolean) .map(v => v[0].replace( 'require(', 'typeof require !== "undefined" && require(' ) ) ) ].join('\n'); fs.writeFileSync(ROLLUP_INPUT_FILE, `${requires}\n\n${esmExportString}`); const testExports = `module.exports = {${[...snippets, ...archivedSnippets] .map(v => v.replace('.md', '')) .join(',')}}`; fs.writeFileSync( TEST_MODULE_FILE, `${requires}\n\n${cjsExportString}\n\n${testExports}` ); // Check Travis builds - Will skip builds on Travis if not CRON/API if (util.isTravisCI() && util.isNotTravisCronOrAPI()) { fs.unlink(ROLLUP_INPUT_FILE); console.log( `${chalk.green( 'NOBUILD' )} Module build terminated, not a cron job or a custom build!` ); console.timeEnd('Packager'); process.exit(0); } await doRollup(); // Clean up the temporary input file Rollup used for building the module fs.unlink(ROLLUP_INPUT_FILE); console.log(`${chalk.green('SUCCESS!')} Snippet module built!`); console.timeEnd('Packager'); } catch (err) { console.log(`${chalk.red('ERROR!')} During module creation: ${err}`); process.exit(1); } }
javascript
async function build() { console.time('Packager'); let requires = []; let esmExportString = ''; let cjsExportString = ''; try { if (!fs.existsSync(DIST_PATH)) fs.mkdirSync(DIST_PATH); fs.writeFileSync(ROLLUP_INPUT_FILE, ''); fs.writeFileSync(TEST_MODULE_FILE, ''); // All the snippets that are Node.js-based and will break in a browser // environment const nodeSnippets = fs .readFileSync('tag_database', 'utf8') .split('\n') .filter(v => v.search(/:.*node/g) !== -1) .map(v => v.slice(0, v.indexOf(':'))); const snippets = fs.readdirSync(SNIPPETS_PATH); const archivedSnippets = fs .readdirSync(SNIPPETS_ARCHIVE_PATH) .filter(v => v !== 'README.md'); snippets.forEach(snippet => { const rawSnippetString = getRawSnippetString(SNIPPETS_PATH, snippet); const snippetName = snippet.replace('.md', ''); let code = getCode(rawSnippetString); if (nodeSnippets.includes(snippetName)) { requires.push(code.match(/const.*=.*require\(([^\)]*)\);/g)); code = code.replace(/const.*=.*require\(([^\)]*)\);/g, ''); } esmExportString += `export ${code}`; cjsExportString += code; }); archivedSnippets.forEach(snippet => { const rawSnippetString = getRawSnippetString( SNIPPETS_ARCHIVE_PATH, snippet ); cjsExportString += getCode(rawSnippetString); }); requires = [ ...new Set( requires .filter(Boolean) .map(v => v[0].replace( 'require(', 'typeof require !== "undefined" && require(' ) ) ) ].join('\n'); fs.writeFileSync(ROLLUP_INPUT_FILE, `${requires}\n\n${esmExportString}`); const testExports = `module.exports = {${[...snippets, ...archivedSnippets] .map(v => v.replace('.md', '')) .join(',')}}`; fs.writeFileSync( TEST_MODULE_FILE, `${requires}\n\n${cjsExportString}\n\n${testExports}` ); // Check Travis builds - Will skip builds on Travis if not CRON/API if (util.isTravisCI() && util.isNotTravisCronOrAPI()) { fs.unlink(ROLLUP_INPUT_FILE); console.log( `${chalk.green( 'NOBUILD' )} Module build terminated, not a cron job or a custom build!` ); console.timeEnd('Packager'); process.exit(0); } await doRollup(); // Clean up the temporary input file Rollup used for building the module fs.unlink(ROLLUP_INPUT_FILE); console.log(`${chalk.green('SUCCESS!')} Snippet module built!`); console.timeEnd('Packager'); } catch (err) { console.log(`${chalk.red('ERROR!')} During module creation: ${err}`); process.exit(1); } }
[ "async", "function", "build", "(", ")", "{", "console", ".", "time", "(", "'Packager'", ")", ";", "let", "requires", "=", "[", "]", ";", "let", "esmExportString", "=", "''", ";", "let", "cjsExportString", "=", "''", ";", "try", "{", "if", "(", "!", ...
Starts the build process.
[ "Starts", "the", "build", "process", "." ]
5ef18713903aaaa5ff5409ef3a6de31dbd878d0c
https://github.com/30-seconds/30-seconds-of-code/blob/5ef18713903aaaa5ff5409ef3a6de31dbd878d0c/scripts/module.js#L74-L165
train
Build the project
[ 30522, 2004, 6038, 2278, 3853, 3857, 1006, 1007, 1063, 10122, 1012, 2051, 1006, 1005, 7427, 2099, 1005, 1007, 1025, 2292, 5942, 1027, 1031, 1033, 1025, 2292, 9686, 4168, 2595, 25378, 18886, 3070, 1027, 1005, 1005, 1025, 2292, 1039, 22578, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/cli.js
printResults
function printResults(engine, results, format, outputFile) { let formatter; let rules; try { formatter = engine.getFormatter(format); rules = engine.getRules(); } catch (e) { log.error(e.message); return false; } const rulesMeta = {}; rules.forEach((rule, ruleId) => { rulesMeta[ruleId] = rule.meta; }); const output = formatter(results, { rulesMeta }); if (output) { if (outputFile) { const filePath = path.resolve(process.cwd(), outputFile); if (fs.existsSync(filePath) && fs.statSync(filePath).isDirectory()) { log.error("Cannot write to output file path, it is a directory: %s", outputFile); return false; } try { mkdirp.sync(path.dirname(filePath)); fs.writeFileSync(filePath, output); } catch (ex) { log.error("There was a problem writing the output file:\n%s", ex); return false; } } else { log.info(output); } } return true; }
javascript
function printResults(engine, results, format, outputFile) { let formatter; let rules; try { formatter = engine.getFormatter(format); rules = engine.getRules(); } catch (e) { log.error(e.message); return false; } const rulesMeta = {}; rules.forEach((rule, ruleId) => { rulesMeta[ruleId] = rule.meta; }); const output = formatter(results, { rulesMeta }); if (output) { if (outputFile) { const filePath = path.resolve(process.cwd(), outputFile); if (fs.existsSync(filePath) && fs.statSync(filePath).isDirectory()) { log.error("Cannot write to output file path, it is a directory: %s", outputFile); return false; } try { mkdirp.sync(path.dirname(filePath)); fs.writeFileSync(filePath, output); } catch (ex) { log.error("There was a problem writing the output file:\n%s", ex); return false; } } else { log.info(output); } } return true; }
[ "function", "printResults", "(", "engine", ",", "results", ",", "format", ",", "outputFile", ")", "{", "let", "formatter", ";", "let", "rules", ";", "try", "{", "formatter", "=", "engine", ".", "getFormatter", "(", "format", ")", ";", "rules", "=", "engi...
Outputs the results of the linting. @param {CLIEngine} engine The CLIEngine to use. @param {LintResult[]} results The results to print. @param {string} format The name of the formatter to use or the path to the formatter. @param {string} outputFile The path for the output file. @returns {boolean} True if the printing succeeds, false if not. @private
[ "Outputs", "the", "results", "of", "the", "linting", "." ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/cli.js#L82-L125
train
Print the results to the specified file
[ 30522, 3853, 6140, 6072, 11314, 2015, 1006, 3194, 1010, 3463, 1010, 4289, 1010, 6434, 8873, 2571, 1007, 1063, 2292, 4289, 3334, 1025, 2292, 3513, 1025, 3046, 1063, 4289, 3334, 1027, 3194, 1012, 2131, 14192, 20097, 1006, 4289, 1007, 1025, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/extensions/default/JavaScriptCodeHints/main.js
setConfig
function setConfig(configUpdate) { var config = setConfig.config; Object.keys(configUpdate).forEach(function (key) { config[key] = configUpdate[key]; }); ScopeManager._setConfig(configUpdate); }
javascript
function setConfig(configUpdate) { var config = setConfig.config; Object.keys(configUpdate).forEach(function (key) { config[key] = configUpdate[key]; }); ScopeManager._setConfig(configUpdate); }
[ "function", "setConfig", "(", "configUpdate", ")", "{", "var", "config", "=", "setConfig", ".", "config", ";", "Object", ".", "keys", "(", "configUpdate", ")", ".", "forEach", "(", "function", "(", "key", ")", "{", "config", "[", "key", "]", "=", "conf...
Sets the configuration, generally for testing/debugging use. Configuration keys are merged into the current configuration. The Tern worker is automatically updated to the new config as well. * debug: Set to true if you want verbose logging * noReset: Set to true if you don't want the worker to restart periodically @param {Object} configUpdate keys/values to merge into the config
[ "Sets", "the", "configuration", "generally", "for", "testing", "/", "debugging", "use", ".", "Configuration", "keys", "are", "merged", "into", "the", "current", "configuration", ".", "The", "Tern", "worker", "is", "automatically", "updated", "to", "the", "new", ...
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/JavaScriptCodeHints/main.js#L123-L130
train
Sets the config object
[ 30522, 3853, 2275, 8663, 8873, 2290, 1006, 9530, 8873, 12193, 17299, 3686, 1007, 1063, 13075, 9530, 8873, 2290, 1027, 2275, 8663, 8873, 2290, 1012, 9530, 8873, 2290, 1025, 4874, 1012, 6309, 1006, 9530, 8873, 12193, 17299, 3686, 1007, 1012, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.table/src/sap/ui/table/TableUtils.js
function(oCell) { if (!oCell) { return null; } var $Cell = jQuery(oCell); var oCellInfo = TableUtils.getCellInfo($Cell); if (oCellInfo.isOfType(CELLTYPE.ANY | CELLTYPE.PSEUDO)) { var $InteractiveElements = $Cell.find(INTERACTIVE_ELEMENT_SELECTORS); if ($InteractiveElements.length > 0) { return $InteractiveElements; } } return null; }
javascript
function(oCell) { if (!oCell) { return null; } var $Cell = jQuery(oCell); var oCellInfo = TableUtils.getCellInfo($Cell); if (oCellInfo.isOfType(CELLTYPE.ANY | CELLTYPE.PSEUDO)) { var $InteractiveElements = $Cell.find(INTERACTIVE_ELEMENT_SELECTORS); if ($InteractiveElements.length > 0) { return $InteractiveElements; } } return null; }
[ "function", "(", "oCell", ")", "{", "if", "(", "!", "oCell", ")", "{", "return", "null", ";", "}", "var", "$Cell", "=", "jQuery", "(", "oCell", ")", ";", "var", "oCellInfo", "=", "TableUtils", ".", "getCellInfo", "(", "$Cell", ")", ";", "if", "(", ...
Returns all interactive elements in a cell. @param {jQuery | HTMLElement} oCell The cell from which to get the interactive elements. @returns {jQuery | null} Returns <code>null</code>, if the passed cell is not a cell or does not contain any interactive elements.
[ "Returns", "all", "interactive", "elements", "in", "a", "cell", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableUtils.js#L1430-L1446
train
Returns the interactive elements of the given cell
[ 30522, 3853, 1006, 1051, 29109, 2140, 1007, 1063, 2065, 1006, 999, 1051, 29109, 2140, 1007, 1063, 2709, 19701, 1025, 1065, 13075, 1002, 3526, 1027, 1046, 4226, 2854, 1006, 1051, 29109, 2140, 1007, 1025, 13075, 1051, 29109, 4115, 14876, 1027...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/incubator-echarts
src/chart/sankey/sankeyLayout.js
relaxRightToLeft
function relaxRightToLeft(nodesByBreadth, alpha, orient) { zrUtil.each(nodesByBreadth.slice().reverse(), function (nodes) { zrUtil.each(nodes, function (node) { if (node.outEdges.length) { var y = sum(node.outEdges, weightedTarget, orient) / sum(node.outEdges, getEdgeValue, orient); if (orient === 'vertical') { var nodeX = node.getLayout().x + (y - center(node, orient)) * alpha; node.setLayout({x: nodeX}, true); } else { var nodeY = node.getLayout().y + (y - center(node, orient)) * alpha; node.setLayout({y: nodeY}, true); } } }); }); }
javascript
function relaxRightToLeft(nodesByBreadth, alpha, orient) { zrUtil.each(nodesByBreadth.slice().reverse(), function (nodes) { zrUtil.each(nodes, function (node) { if (node.outEdges.length) { var y = sum(node.outEdges, weightedTarget, orient) / sum(node.outEdges, getEdgeValue, orient); if (orient === 'vertical') { var nodeX = node.getLayout().x + (y - center(node, orient)) * alpha; node.setLayout({x: nodeX}, true); } else { var nodeY = node.getLayout().y + (y - center(node, orient)) * alpha; node.setLayout({y: nodeY}, true); } } }); }); }
[ "function", "relaxRightToLeft", "(", "nodesByBreadth", ",", "alpha", ",", "orient", ")", "{", "zrUtil", ".", "each", "(", "nodesByBreadth", ".", "slice", "(", ")", ".", "reverse", "(", ")", ",", "function", "(", "nodes", ")", "{", "zrUtil", ".", "each", ...
Change the y-position of the nodes, except most the right side nodes @param {Array.<Array.<module:echarts/data/Graph~Node>>} nodesByBreadth group by the array of all sankey nodes based on the node x-position. @param {number} alpha parameter used to adjust the nodes y-position
[ "Change", "the", "y", "-", "position", "of", "the", "nodes", "except", "most", "the", "right", "side", "nodes" ]
4d0ea095dc3929cb6de40c45748826e7999c7aa8
https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/chart/sankey/sankeyLayout.js#L402-L419
train
RelaxRightToLeft - RelaxRightToLeft - RelaxRightToLeft - RelaxRightToLeft - RelaxRightToLeft - RelaxRightToLeft - RelaxRightToLeft - RelaxRightToLeft - RelaxRightToLeft - RelaxRightToLeft - RelaxRightToLeft - RelaxRightToLeft - RelaxRightToLeft - RelaxRightToLeft - RelaxRightToLeft - RelaxRightToLeft - Relax
[ 30522, 3853, 9483, 15950, 3406, 2571, 6199, 1006, 14164, 3762, 27035, 2705, 1010, 6541, 1010, 16865, 1007, 1063, 1062, 22134, 4014, 1012, 2169, 1006, 14164, 3762, 27035, 2705, 1012, 14704, 1006, 1007, 1012, 7901, 1006, 1007, 1010, 3853, 100...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
angular/material
src/components/subheader/subheader.js
MdSubheaderDirective
function MdSubheaderDirective($mdSticky, $compile, $mdTheming, $mdUtil, $mdAria) { return { restrict: 'E', replace: true, transclude: true, template: ( '<div class="md-subheader _md">' + ' <div class="md-subheader-inner">' + ' <div class="md-subheader-content"></div>' + ' </div>' + '</div>' ), link: function postLink(scope, element, attr, controllers, transclude) { $mdTheming(element); element.addClass('_md'); // Remove the ngRepeat attribute from the root element, because we don't want to compile // the ngRepeat for the sticky clone again. $mdUtil.prefixer().removeAttribute(element, 'ng-repeat'); var outerHTML = element[0].outerHTML; function getContent(el) { return angular.element(el[0].querySelector('.md-subheader-content')); } // Set the ARIA attributes on the original element since it keeps it's original place in // the DOM, whereas the clones are in reverse order. Should be done after the outerHTML, // in order to avoid having multiple element be marked as headers. attr.$set('role', 'heading'); $mdAria.expect(element, 'aria-level', '2'); // Transclude the user-given contents of the subheader // the conventional way. transclude(scope, function(clone) { getContent(element).append(clone); }); // Create another clone, that uses the outer and inner contents // of the element, that will be 'stickied' as the user scrolls. if (!element.hasClass('md-no-sticky')) { transclude(scope, function(clone) { // If the user adds an ng-if or ng-repeat directly to the md-subheader element, the // compiled clone below will only be a comment tag (since they replace their elements with // a comment) which cannot be properly passed to the $mdSticky; so we wrap it in our own // DIV to ensure we have something $mdSticky can use var wrapper = $compile('<div class="md-subheader-wrapper" aria-hidden="true">' + outerHTML + '</div>')(scope); // Delay initialization until after any `ng-if`/`ng-repeat`/etc has finished before // attempting to create the clone $mdUtil.nextTick(function() { // Append our transcluded clone into the wrapper. // We don't have to recompile the element again, because the clone is already // compiled in it's transclusion scope. If we recompile the outerHTML of the new clone, we would lose // our ngIf's and other previous registered bindings / properties. getContent(wrapper).append(clone); }); // Make the element sticky and provide the stickyClone our self, to avoid recompilation of the subheader // element. $mdSticky(scope, element, wrapper); }); } } }; }
javascript
function MdSubheaderDirective($mdSticky, $compile, $mdTheming, $mdUtil, $mdAria) { return { restrict: 'E', replace: true, transclude: true, template: ( '<div class="md-subheader _md">' + ' <div class="md-subheader-inner">' + ' <div class="md-subheader-content"></div>' + ' </div>' + '</div>' ), link: function postLink(scope, element, attr, controllers, transclude) { $mdTheming(element); element.addClass('_md'); // Remove the ngRepeat attribute from the root element, because we don't want to compile // the ngRepeat for the sticky clone again. $mdUtil.prefixer().removeAttribute(element, 'ng-repeat'); var outerHTML = element[0].outerHTML; function getContent(el) { return angular.element(el[0].querySelector('.md-subheader-content')); } // Set the ARIA attributes on the original element since it keeps it's original place in // the DOM, whereas the clones are in reverse order. Should be done after the outerHTML, // in order to avoid having multiple element be marked as headers. attr.$set('role', 'heading'); $mdAria.expect(element, 'aria-level', '2'); // Transclude the user-given contents of the subheader // the conventional way. transclude(scope, function(clone) { getContent(element).append(clone); }); // Create another clone, that uses the outer and inner contents // of the element, that will be 'stickied' as the user scrolls. if (!element.hasClass('md-no-sticky')) { transclude(scope, function(clone) { // If the user adds an ng-if or ng-repeat directly to the md-subheader element, the // compiled clone below will only be a comment tag (since they replace their elements with // a comment) which cannot be properly passed to the $mdSticky; so we wrap it in our own // DIV to ensure we have something $mdSticky can use var wrapper = $compile('<div class="md-subheader-wrapper" aria-hidden="true">' + outerHTML + '</div>')(scope); // Delay initialization until after any `ng-if`/`ng-repeat`/etc has finished before // attempting to create the clone $mdUtil.nextTick(function() { // Append our transcluded clone into the wrapper. // We don't have to recompile the element again, because the clone is already // compiled in it's transclusion scope. If we recompile the outerHTML of the new clone, we would lose // our ngIf's and other previous registered bindings / properties. getContent(wrapper).append(clone); }); // Make the element sticky and provide the stickyClone our self, to avoid recompilation of the subheader // element. $mdSticky(scope, element, wrapper); }); } } }; }
[ "function", "MdSubheaderDirective", "(", "$mdSticky", ",", "$compile", ",", "$mdTheming", ",", "$mdUtil", ",", "$mdAria", ")", "{", "return", "{", "restrict", ":", "'E'", ",", "replace", ":", "true", ",", "transclude", ":", "true", ",", "template", ":", "(...
@ngdoc directive @name mdSubheader @module material.components.subheader @restrict E @description The `md-subheader` directive creates a sticky subheader for a section. Developers are able to disable the stickiness of the subheader by using the following markup <hljs lang="html"> <md-subheader class="md-no-sticky">Not Sticky</md-subheader> </hljs> ### Notes - The `md-subheader` directive uses the <a ng-href="api/service/$mdSticky">$mdSticky</a> service to make the subheader sticky. > Whenever the current browser doesn't support stickiness natively, the subheader will be compiled twice to create a sticky clone of the subheader. @usage <hljs lang="html"> <md-subheader>Online Friends</md-subheader> </hljs>
[ "@ngdoc", "directive", "@name", "mdSubheader", "@module", "material", ".", "components", ".", "subheader" ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/subheader/subheader.js#L55-L120
train
The md - subheader directive is a directive that can be used to create a clone of the subheader.
[ 30522, 3853, 9108, 6342, 23706, 13775, 2121, 4305, 2890, 15277, 1006, 1002, 9108, 21354, 2100, 1010, 1002, 4012, 22090, 1010, 1002, 9108, 10760, 6562, 1010, 1002, 9108, 21823, 2140, 1010, 1002, 9108, 10980, 1007, 1063, 2709, 1063, 21573, 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...
uber/deck.gl
modules/core/src/utils/old-log.js
checkForAssertionErrors
function checkForAssertionErrors(args) { const isAssertion = args && args.length > 0 && typeof args[0] === 'object' && args[0] !== null && args[0].name === 'AssertionError'; if (isAssertion) { args = Array.prototype.slice.call(args); args.unshift(`assert(${args[0].message})`); } return args; }
javascript
function checkForAssertionErrors(args) { const isAssertion = args && args.length > 0 && typeof args[0] === 'object' && args[0] !== null && args[0].name === 'AssertionError'; if (isAssertion) { args = Array.prototype.slice.call(args); args.unshift(`assert(${args[0].message})`); } return args; }
[ "function", "checkForAssertionErrors", "(", "args", ")", "{", "const", "isAssertion", "=", "args", "&&", "args", ".", "length", ">", "0", "&&", "typeof", "args", "[", "0", "]", "===", "'object'", "&&", "args", "[", "0", "]", "!==", "null", "&&", "args"...
Assertions don't generate standard exceptions and don't print nicely
[ "Assertions", "don", "t", "generate", "standard", "exceptions", "and", "don", "t", "print", "nicely" ]
a2010448b7f268bbd03617b812334c68a6b9e5b2
https://github.com/uber/deck.gl/blob/a2010448b7f268bbd03617b812334c68a6b9e5b2/modules/core/src/utils/old-log.js#L127-L140
train
Check if an error is thrown
[ 30522, 3853, 4638, 29278, 27241, 28228, 5643, 18933, 2869, 1006, 12098, 5620, 1007, 1063, 9530, 3367, 18061, 18116, 3508, 1027, 12098, 5620, 1004, 1004, 12098, 5620, 1012, 3091, 1028, 1014, 1004, 1004, 2828, 11253, 12098, 5620, 1031, 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...
vuejs/vuex
dist/vuex.esm.js
vuexInit
function vuexInit () { var options = this.$options; // store injection if (options.store) { this.$store = typeof options.store === 'function' ? options.store() : options.store; } else if (options.parent && options.parent.$store) { this.$store = options.parent.$store; } }
javascript
function vuexInit () { var options = this.$options; // store injection if (options.store) { this.$store = typeof options.store === 'function' ? options.store() : options.store; } else if (options.parent && options.parent.$store) { this.$store = options.parent.$store; } }
[ "function", "vuexInit", "(", ")", "{", "var", "options", "=", "this", ".", "$options", ";", "// store injection", "if", "(", "options", ".", "store", ")", "{", "this", ".", "$store", "=", "typeof", "options", ".", "store", "===", "'function'", "?", "opti...
Vuex init hook, injected into each instances init hooks list.
[ "Vuex", "init", "hook", "injected", "into", "each", "instances", "init", "hooks", "list", "." ]
d7c7f9844831f98c5c9aaca213746c4ccc5d6929
https://github.com/vuejs/vuex/blob/d7c7f9844831f98c5c9aaca213746c4ccc5d6929/dist/vuex.esm.js#L29-L39
train
vuexInit - Initialize the injection
[ 30522, 3853, 24728, 10288, 5498, 2102, 1006, 1007, 1063, 13075, 7047, 1027, 2023, 1012, 1002, 7047, 1025, 1013, 1013, 3573, 13341, 2065, 30524, 1012, 1002, 3573, 1007, 1063, 2023, 1012, 1002, 3573, 1027, 7047, 1012, 6687, 1012, 1002, 3573, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Dialog.js
isHeaderClicked
function isHeaderClicked(eventTarget) { var $target = jQuery(eventTarget); var oControl = $target.control(0); if (!oControl || oControl.getMetadata().getInterfaces().indexOf("sap.m.IBar") > -1) { return true; } return $target.hasClass('sapMDialogTitle'); }
javascript
function isHeaderClicked(eventTarget) { var $target = jQuery(eventTarget); var oControl = $target.control(0); if (!oControl || oControl.getMetadata().getInterfaces().indexOf("sap.m.IBar") > -1) { return true; } return $target.hasClass('sapMDialogTitle'); }
[ "function", "isHeaderClicked", "(", "eventTarget", ")", "{", "var", "$target", "=", "jQuery", "(", "eventTarget", ")", ";", "var", "oControl", "=", "$target", ".", "control", "(", "0", ")", ";", "if", "(", "!", "oControl", "||", "oControl", ".", "getMeta...
/* =========================================================== /* Resize & Drag logic /* =========================================================== @param {Object} eventTarget @returns {boolean}
[ "/", "*", "===========================================================", "/", "*", "Resize", "&", "Drag", "logic", "/", "*", "===========================================================" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/Dialog.js#L1779-L1787
train
Returns true if the header is clicked
[ 30522, 3853, 2003, 4974, 2121, 20464, 6799, 2098, 1006, 2724, 7559, 18150, 1007, 1063, 13075, 1002, 4539, 1027, 1046, 4226, 2854, 1006, 2724, 7559, 18150, 1007, 1025, 13075, 1051, 8663, 13181, 2140, 1027, 1002, 4539, 1012, 2491, 1006, 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...
radare/radare2
shlr/www/graph/js-graph-it.js
initPageObjects
function initPageObjects() { if(isCanvas(document.body)) { var newCanvas = new Canvas(document.body); newCanvas.initCanvas(); canvases.push(newCanvas); } else { var divs = document.getElementsByTagName('div'); var i; for(i = 0; i < divs.length; i++) { if(isCanvas(divs[i]) && !findCanvas(divs[i].id)) { var newCanvas = new Canvas(divs[i]); newCanvas.initCanvas(); canvases.push(newCanvas); newCanvas.fitBlocks(); newCanvas.alignBlocks(); } } } }
javascript
function initPageObjects() { if(isCanvas(document.body)) { var newCanvas = new Canvas(document.body); newCanvas.initCanvas(); canvases.push(newCanvas); } else { var divs = document.getElementsByTagName('div'); var i; for(i = 0; i < divs.length; i++) { if(isCanvas(divs[i]) && !findCanvas(divs[i].id)) { var newCanvas = new Canvas(divs[i]); newCanvas.initCanvas(); canvases.push(newCanvas); newCanvas.fitBlocks(); newCanvas.alignBlocks(); } } } }
[ "function", "initPageObjects", "(", ")", "{", "if", "(", "isCanvas", "(", "document", ".", "body", ")", ")", "{", "var", "newCanvas", "=", "new", "Canvas", "(", "document", ".", "body", ")", ";", "newCanvas", ".", "initCanvas", "(", ")", ";", "canvases...
/* This function initializes the js_graph objects inspecting the html document
[ "/", "*", "This", "function", "initializes", "the", "js_graph", "objects", "inspecting", "the", "html", "document" ]
bf5e3028810a0ec7c267c6fe4bfad639b4819e35
https://github.com/radare/radare2/blob/bf5e3028810a0ec7c267c6fe4bfad639b4819e35/shlr/www/graph/js-graph-it.js#L1142-L1166
train
initPageObjects - Init page objects
[ 30522, 3853, 1999, 4183, 13704, 16429, 20614, 2015, 1006, 1007, 1063, 2065, 1006, 2003, 9336, 12044, 1006, 6254, 1012, 2303, 1007, 1007, 1063, 13075, 2047, 9336, 12044, 1027, 2047, 10683, 1006, 6254, 1012, 2303, 1007, 1025, 2047, 9336, 1204...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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
getFragmentRect
function getFragmentRect ({ _fragmentStart, _fragmentEnd }) { let top, bottom, left, right util().mapNodeRange(_fragmentStart, _fragmentEnd, function (node) { let rect if (node.nodeType === 1 || node.getBoundingClientRect) { rect = node.getBoundingClientRect() } else if (node.nodeType === 3 && node.data.trim()) { rect = getTextRect(node) } if (rect) { if (!top || rect.top < top) { top = rect.top } if (!bottom || rect.bottom > bottom) { bottom = rect.bottom } if (!left || rect.left < left) { left = rect.left } if (!right || rect.right > right) { right = rect.right } } }) return { top, left, width: right - left, height: bottom - top } }
javascript
function getFragmentRect ({ _fragmentStart, _fragmentEnd }) { let top, bottom, left, right util().mapNodeRange(_fragmentStart, _fragmentEnd, function (node) { let rect if (node.nodeType === 1 || node.getBoundingClientRect) { rect = node.getBoundingClientRect() } else if (node.nodeType === 3 && node.data.trim()) { rect = getTextRect(node) } if (rect) { if (!top || rect.top < top) { top = rect.top } if (!bottom || rect.bottom > bottom) { bottom = rect.bottom } if (!left || rect.left < left) { left = rect.left } if (!right || rect.right > right) { right = rect.right } } }) return { top, left, width: right - left, height: bottom - top } }
[ "function", "getFragmentRect", "(", "{", "_fragmentStart", ",", "_fragmentEnd", "}", ")", "{", "let", "top", ",", "bottom", ",", "left", ",", "right", "util", "(", ")", ".", "mapNodeRange", "(", "_fragmentStart", ",", "_fragmentEnd", ",", "function", "(", ...
Highlight a fragment instance. Loop over its node range and determine its bounding box. @param {Vue} instance @return {Object}
[ "Highlight", "a", "fragment", "instance", ".", "Loop", "over", "its", "node", "range", "and", "determine", "its", "bounding", "box", "." ]
4de4b86388453cd07f0c1bf967d43a4dd4b011c9
https://github.com/vuejs/vue-devtools/blob/4de4b86388453cd07f0c1bf967d43a4dd4b011c9/src/backend/highlighter.js#L106-L136
train
Get the bounding rect of a fragment
[ 30522, 3853, 2131, 27843, 21693, 4765, 30524, 1063, 2292, 28667, 2102, 2065, 1006, 13045, 1012, 13045, 13874, 1027, 1027, 1027, 1015, 1064, 1064, 13045, 1012, 2131, 15494, 2075, 20464, 11638, 2890, 6593, 1007, 1063, 28667, 2102, 1027, 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...
angular/material
release.js
updateBowerVersion
function updateBowerVersion () { start('Updating bower version...'); const options = { cwd: './bower-material' }; const bower = require(options.cwd + '/bower.json'), pkg = require(options.cwd + '/package.json'); // update versions in config files bower.version = pkg.version = newVersion; fs.writeFileSync(options.cwd + '/package.json', JSON.stringify(pkg, null, 2)); fs.writeFileSync(options.cwd + '/bower.json', JSON.stringify(bower, null, 2)); done(); start('Building bower files...'); // build files for bower exec([ 'rm -rf dist', 'gulp build', 'gulp build-all-modules --mode=default', 'gulp build-all-modules --mode=closure', 'rm -rf dist/demos' ]); done(); start('Copy files into bower repo...'); // copy files over to bower repo exec([ 'cp -Rf ../dist/* ./', 'git add -A', `git commit -m "release: version ${newVersion}"`, 'rm -rf ../dist' ], options); done(); // add steps to push script pushCmds.push( comment('push to bower (master and tag) and publish to npm'), 'cd ' + options.cwd, 'cp ../CHANGELOG.md .', 'git add CHANGELOG.md', 'git commit --amend --no-edit', `git tag -f v${newVersion}`, 'git pull --rebase --strategy=ours', 'git push', 'git push --tags', 'rm -rf .git/', 'npm publish', 'cd ..' ); }
javascript
function updateBowerVersion () { start('Updating bower version...'); const options = { cwd: './bower-material' }; const bower = require(options.cwd + '/bower.json'), pkg = require(options.cwd + '/package.json'); // update versions in config files bower.version = pkg.version = newVersion; fs.writeFileSync(options.cwd + '/package.json', JSON.stringify(pkg, null, 2)); fs.writeFileSync(options.cwd + '/bower.json', JSON.stringify(bower, null, 2)); done(); start('Building bower files...'); // build files for bower exec([ 'rm -rf dist', 'gulp build', 'gulp build-all-modules --mode=default', 'gulp build-all-modules --mode=closure', 'rm -rf dist/demos' ]); done(); start('Copy files into bower repo...'); // copy files over to bower repo exec([ 'cp -Rf ../dist/* ./', 'git add -A', `git commit -m "release: version ${newVersion}"`, 'rm -rf ../dist' ], options); done(); // add steps to push script pushCmds.push( comment('push to bower (master and tag) and publish to npm'), 'cd ' + options.cwd, 'cp ../CHANGELOG.md .', 'git add CHANGELOG.md', 'git commit --amend --no-edit', `git tag -f v${newVersion}`, 'git pull --rebase --strategy=ours', 'git push', 'git push --tags', 'rm -rf .git/', 'npm publish', 'cd ..' ); }
[ "function", "updateBowerVersion", "(", ")", "{", "start", "(", "'Updating bower version...'", ")", ";", "const", "options", "=", "{", "cwd", ":", "'./bower-material'", "}", ";", "const", "bower", "=", "require", "(", "options", ".", "cwd", "+", "'/bower.json'"...
updates the version for bower-material in package.json and bower.json
[ "updates", "the", "version", "for", "bower", "-", "material", "in", "package", ".", "json", "and", "bower", ".", "json" ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/release.js#L214-L258
train
Update bower version
[ 30522, 3853, 10651, 18912, 2121, 27774, 1006, 1007, 1063, 2707, 1006, 1005, 2039, 16616, 6812, 2121, 2544, 1012, 1012, 1012, 1005, 1007, 1025, 9530, 3367, 7047, 1027, 1063, 19296, 2094, 1024, 1005, 1012, 1013, 6812, 2121, 1011, 3430, 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...
facebook/flow
packages/flow-remove-types/index.js
getSpliceNodeAtPos
function getSpliceNodeAtPos(context, pos, loc, value) { return createNode({ start: pos, end: pos, loc: {start: loc, end: loc}, __spliceValue: value, }); }
javascript
function getSpliceNodeAtPos(context, pos, loc, value) { return createNode({ start: pos, end: pos, loc: {start: loc, end: loc}, __spliceValue: value, }); }
[ "function", "getSpliceNodeAtPos", "(", "context", ",", "pos", ",", "loc", ",", "value", ")", "{", "return", "createNode", "(", "{", "start", ":", "pos", ",", "end", ":", "pos", ",", "loc", ":", "{", "start", ":", "loc", ",", "end", ":", "loc", "}",...
Creates a zero-width "node" with a value to splice at that position. WARNING: This is only safe to use when source maps are off!
[ "Creates", "a", "zero", "-", "width", "node", "with", "a", "value", "to", "splice", "at", "that", "position", ".", "WARNING", ":", "This", "is", "only", "safe", "to", "use", "when", "source", "maps", "are", "off!" ]
25bc6aba258658eaf21ccc4722ef7124724a1d2b
https://github.com/facebook/flow/blob/25bc6aba258658eaf21ccc4722ef7124724a1d2b/packages/flow-remove-types/index.js#L399-L406
train
Get a node at pos with splice value
[ 30522, 3853, 4152, 24759, 6610, 3630, 3207, 4017, 6873, 2015, 1006, 6123, 1010, 13433, 2015, 1010, 8840, 2278, 1010, 3643, 1007, 1063, 2709, 3443, 3630, 3207, 1006, 1063, 2707, 1024, 13433, 2015, 1010, 2203, 1024, 13433, 2015, 1010, 8840, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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
tracing/third_party/oboe/src/instanceApi.js
addNodeOrPathListenerApi
function addNodeOrPathListenerApi( eventId, jsonPathOrListenerMap, callback ){ if( isString(jsonPathOrListenerMap) ) { addSingleNodeOrPathListener(eventId, jsonPathOrListenerMap, callback); } else { addMultipleNodeOrPathListeners(eventId, jsonPathOrListenerMap); } return oboeApi; // chaining }
javascript
function addNodeOrPathListenerApi( eventId, jsonPathOrListenerMap, callback ){ if( isString(jsonPathOrListenerMap) ) { addSingleNodeOrPathListener(eventId, jsonPathOrListenerMap, callback); } else { addMultipleNodeOrPathListeners(eventId, jsonPathOrListenerMap); } return oboeApi; // chaining }
[ "function", "addNodeOrPathListenerApi", "(", "eventId", ",", "jsonPathOrListenerMap", ",", "callback", ")", "{", "if", "(", "isString", "(", "jsonPathOrListenerMap", ")", ")", "{", "addSingleNodeOrPathListener", "(", "eventId", ",", "jsonPathOrListenerMap", ",", "call...
implementation behind .onPath() and .onNode()
[ "implementation", "behind", ".", "onPath", "()", "and", ".", "onNode", "()" ]
992929ffccac68827869a497f01ee4d653ed4f25
https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/tracing/third_party/oboe/src/instanceApi.js#L193-L203
train
Add a node or multiple listeners
[ 30522, 3853, 5587, 3630, 3207, 2953, 15069, 9863, 24454, 9331, 2072, 1006, 2724, 3593, 1010, 1046, 3385, 15069, 2953, 9863, 24454, 2863, 2361, 1010, 2655, 5963, 1007, 1063, 2065, 1006, 26354, 18886, 3070, 1006, 1046, 3385, 15069, 2953, 9863...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
pagekit/vue-resource
dist/vue-resource.esm.js
Request
function Request(options$$1) { this.body = null; this.params = {}; assign(this, options$$1, { method: toUpper(options$$1.method || 'GET') }); if (!(this.headers instanceof Headers)) { this.headers = new Headers(this.headers); } }
javascript
function Request(options$$1) { this.body = null; this.params = {}; assign(this, options$$1, { method: toUpper(options$$1.method || 'GET') }); if (!(this.headers instanceof Headers)) { this.headers = new Headers(this.headers); } }
[ "function", "Request", "(", "options$$1", ")", "{", "this", ".", "body", "=", "null", ";", "this", ".", "params", "=", "{", "}", ";", "assign", "(", "this", ",", "options$$1", ",", "{", "method", ":", "toUpper", "(", "options$$1", ".", "method", "||"...
HTTP Request.
[ "HTTP", "Request", "." ]
fe268fa1d6053ede5f34aef9a11e1a424a70446c
https://github.com/pagekit/vue-resource/blob/fe268fa1d6053ede5f34aef9a11e1a424a70446c/dist/vue-resource.esm.js#L1334-L1346
train
Construct a new Request
[ 30522, 3853, 5227, 1006, 7047, 1002, 1002, 1015, 1007, 1063, 2023, 1012, 2303, 1027, 19701, 1025, 2023, 1012, 11498, 5244, 1027, 1063, 1065, 1025, 23911, 1006, 2023, 1010, 7047, 1002, 1002, 1015, 1010, 1063, 4118, 1024, 2000, 29547, 2099, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SeleniumHQ/selenium
javascript/selenium-core/scripts/htmlutils.js
eval_locator
function eval_locator(locator, inDocument, opt_contextNode) { locator = parse_locator(locator); var pageBot; if (typeof(selenium) != 'undefined' && selenium != undefined) { if (typeof(editor) == 'undefined' || editor.state == 'playing') { safe_log('info', 'Trying [' + locator.type + ']: ' + locator.string); } pageBot = selenium.browserbot; } else { if (!UI_GLOBAL.mozillaBrowserBot) { // create a browser bot to evaluate the locator. Hand it the IDE // window as a dummy window, and cache it for future use. UI_GLOBAL.mozillaBrowserBot = new MozillaBrowserBot(window) } pageBot = UI_GLOBAL.mozillaBrowserBot; } var results = []; if (locator.type == 'xpath' || (locator.string.charAt(0) == '/' && locator.type == 'implicit')) { results = eval_xpath(locator.string, inDocument, { contextNode: opt_contextNode }); } else if (locator.type == 'css') { results = eval_css(locator.string, inDocument); } else { var element = pageBot .findElementBy(locator.type, locator.string, inDocument); if (element != null) { results.push(element); } } // Unwrap each of the elements in the result for (var i = 0; i < results.length; i++) { results[i] = core.firefox.unwrap(results[i]); } return results; }
javascript
function eval_locator(locator, inDocument, opt_contextNode) { locator = parse_locator(locator); var pageBot; if (typeof(selenium) != 'undefined' && selenium != undefined) { if (typeof(editor) == 'undefined' || editor.state == 'playing') { safe_log('info', 'Trying [' + locator.type + ']: ' + locator.string); } pageBot = selenium.browserbot; } else { if (!UI_GLOBAL.mozillaBrowserBot) { // create a browser bot to evaluate the locator. Hand it the IDE // window as a dummy window, and cache it for future use. UI_GLOBAL.mozillaBrowserBot = new MozillaBrowserBot(window) } pageBot = UI_GLOBAL.mozillaBrowserBot; } var results = []; if (locator.type == 'xpath' || (locator.string.charAt(0) == '/' && locator.type == 'implicit')) { results = eval_xpath(locator.string, inDocument, { contextNode: opt_contextNode }); } else if (locator.type == 'css') { results = eval_css(locator.string, inDocument); } else { var element = pageBot .findElementBy(locator.type, locator.string, inDocument); if (element != null) { results.push(element); } } // Unwrap each of the elements in the result for (var i = 0; i < results.length; i++) { results[i] = core.firefox.unwrap(results[i]); } return results; }
[ "function", "eval_locator", "(", "locator", ",", "inDocument", ",", "opt_contextNode", ")", "{", "locator", "=", "parse_locator", "(", "locator", ")", ";", "var", "pageBot", ";", "if", "(", "typeof", "(", "selenium", ")", "!=", "'undefined'", "&&", "selenium...
This function duplicates part of BrowserBot.findElement() to open up locator evaluation on arbitrary documents. It returns a plain old array of located elements found by using a Selenium locator. Multiple results may be generated for xpath and CSS locators. Even though a list could potentially be generated for other locator types, such as link, we don't try for them, because they aren't very expressive location strategies; if you want a list, use xpath or CSS. Furthermore, strategies for these locators have been optimized to only return the first result. For these types of locators, performance is more important than ideal behavior. @param locator a locator string @param inDocument the document in which to apply the locator @param opt_contextNode the context within which to evaluate the locator @return a list of result elements
[ "This", "function", "duplicates", "part", "of", "BrowserBot", ".", "findElement", "()", "to", "open", "up", "locator", "evaluation", "on", "arbitrary", "documents", ".", "It", "returns", "a", "plain", "old", "array", "of", "located", "elements", "found", "by",...
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/selenium-core/scripts/htmlutils.js#L2214-L2258
train
eval locator inDocument
[ 30522, 3853, 9345, 2140, 1035, 8840, 11266, 2953, 1006, 8840, 11266, 2953, 1010, 11424, 24894, 4765, 1010, 23569, 1035, 6123, 3630, 3207, 1007, 1063, 8840, 11266, 2953, 1027, 11968, 3366, 1035, 8840, 11266, 2953, 1006, 8840, 11266, 2953, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
angular/material
src/components/toast/toast.js
MdToastDirective
function MdToastDirective($mdToast) { return { restrict: 'E', link: function postLink(scope, element) { element.addClass('_md'); // private md component indicator for styling // When navigation force destroys an interimElement, then // listen and $destroy() that interim instance... scope.$on('$destroy', function() { $mdToast.destroy(); }); } }; }
javascript
function MdToastDirective($mdToast) { return { restrict: 'E', link: function postLink(scope, element) { element.addClass('_md'); // private md component indicator for styling // When navigation force destroys an interimElement, then // listen and $destroy() that interim instance... scope.$on('$destroy', function() { $mdToast.destroy(); }); } }; }
[ "function", "MdToastDirective", "(", "$mdToast", ")", "{", "return", "{", "restrict", ":", "'E'", ",", "link", ":", "function", "postLink", "(", "scope", ",", "element", ")", "{", "element", ".", "addClass", "(", "'_md'", ")", ";", "// private md component i...
/* @ngInject
[ "/", "*" ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/toast/toast.js#L15-L28
train
Directive to show a md toast
[ 30522, 3853, 9108, 3406, 14083, 4305, 2890, 15277, 1006, 1002, 9108, 3406, 14083, 1007, 1063, 2709, 1063, 21573, 1024, 1005, 1041, 1005, 1010, 4957, 1024, 3853, 2695, 13767, 1006, 9531, 1010, 5783, 1007, 1063, 5783, 1012, 5587, 26266, 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...
dcloudio/mui
examples/hello-mui/js/mui.picker.all.js
function() { var self = this; var items = []; for (var i in self.pickers) { var picker = self.pickers[i]; items.push(picker.getSelectedItem() || {}); } return items; }
javascript
function() { var self = this; var items = []; for (var i in self.pickers) { var picker = self.pickers[i]; items.push(picker.getSelectedItem() || {}); } return items; }
[ "function", "(", ")", "{", "var", "self", "=", "this", ";", "var", "items", "=", "[", "]", ";", "for", "(", "var", "i", "in", "self", ".", "pickers", ")", "{", "var", "picker", "=", "self", ".", "pickers", "[", "i", "]", ";", "items", ".", "p...
获取选中的项(数组)
[ "获取选中的项(数组)" ]
ff74c90a1671a552f3604b1288bf38a4126312d0
https://github.com/dcloudio/mui/blob/ff74c90a1671a552f3604b1288bf38a4126312d0/examples/hello-mui/js/mui.picker.all.js#L501-L509
train
Returns an array of items from the selected items
[ 30522, 3853, 1006, 1007, 1063, 13075, 2969, 1027, 2023, 1025, 13075, 5167, 1027, 1031, 1033, 1025, 2005, 1006, 13075, 1045, 1999, 2969, 1012, 4060, 2545, 1007, 1063, 13075, 4060, 2121, 1027, 2969, 1012, 4060, 2545, 1031, 1045, 1033, 1025, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/utils/Async.js
promisify
function promisify(obj, method) { var result = new $.Deferred(), args = Array.prototype.slice.call(arguments, 2); args.push(function (err) { if (err) { result.reject(err); } else { result.resolve.apply(result, Array.prototype.slice.call(arguments, 1)); } }); obj[method].apply(obj, args); return result.promise(); }
javascript
function promisify(obj, method) { var result = new $.Deferred(), args = Array.prototype.slice.call(arguments, 2); args.push(function (err) { if (err) { result.reject(err); } else { result.resolve.apply(result, Array.prototype.slice.call(arguments, 1)); } }); obj[method].apply(obj, args); return result.promise(); }
[ "function", "promisify", "(", "obj", ",", "method", ")", "{", "var", "result", "=", "new", "$", ".", "Deferred", "(", ")", ",", "args", "=", "Array", ".", "prototype", ".", "slice", ".", "call", "(", "arguments", ",", "2", ")", ";", "args", ".", ...
Utility for converting a method that takes (error, callback) to one that returns a promise; useful for using FileSystem methods (or other Node-style API methods) in a promise-oriented workflow. For example, instead of var deferred = new $.Deferred(); file.read(function (err, contents) { if (err) { deferred.reject(err); } else { // ...process the contents... deferred.resolve(); } } return deferred.promise(); you can just do return Async.promisify(file, "read").then(function (contents) { // ...process the contents... }); The object/method are passed as an object/string pair so that we can properly call the method without the caller having to deal with "bind" all the time. @param {Object} obj The object to call the method on. @param {string} method The name of the method. The method should expect the errback as its last parameter. @param {...Object} varargs The arguments you would have normally passed to the method (excluding the errback itself). @return {$.Promise} A promise that is resolved with the arguments that were passed to the errback (not including the err argument) if err is null, or rejected with the err if non-null.
[ "Utility", "for", "converting", "a", "method", "that", "takes", "(", "error", "callback", ")", "to", "one", "that", "returns", "a", "promise", ";", "useful", "for", "using", "FileSystem", "methods", "(", "or", "other", "Node", "-", "style", "API", "methods...
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/utils/Async.js#L493-L505
train
promisify method
[ 30522, 3853, 30524, 3501, 1010, 4118, 1007, 1063, 13075, 2765, 1027, 2047, 1002, 1012, 13366, 28849, 2094, 1006, 1007, 1010, 12098, 5620, 1027, 9140, 1012, 8773, 1012, 14704, 1012, 2655, 1006, 9918, 1010, 1016, 1007, 1025, 12098, 5620, 1012...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/language/XMLUtils.js
getTagInfo
function getTagInfo(editor, pos) { var ctx, offset, tagAttrs, tagAttrValue; ctx = TokenUtils.getInitialContext(editor._codeMirror, pos); offset = TokenUtils.offsetInToken(ctx); if (ctx.token && ctx.token.type === "tag bracket" && ctx.token.string === "<") { // Returns tagInfo when an angle bracket is created. return _createTagInfo(ctx.token, TOKEN_TAG); } else if (ctx.token && ctx.token.type === "tag") { // Return tagInfo when a tag is created. if (TokenUtils.movePrevToken(ctx)) { if (ctx.token.type === "tag bracket" && ctx.token.string === "<") { TokenUtils.moveNextToken(ctx); return _createTagInfo(ctx.token, TOKEN_TAG, offset); } } } else if (ctx.token && (ctx.token.type === "attribute" || (ctx.token.type === null && regexWhitespace.test(ctx.token.string)))) { // Return tagInfo when an attribute is created. tagAttrs = _getTagAttributes(editor, pos); if (tagAttrs && tagAttrs.tagName) { return _createTagInfo(ctx.token, TOKEN_ATTR, offset, tagAttrs.exclusionList, tagAttrs.tagName, null, tagAttrs.shouldReplace); } } else if (ctx.token && ((ctx.token.type === null && ctx.token.string === "=") || (ctx.token.type === "string" && /^['"]$/.test(ctx.token.string.charAt(0))))) { // Return tag info when an attribute value is created. // Allow no hints if the cursor is outside the value. if (ctx.token.type === "string" && /^['"]$/.test(ctx.token.string.substr(-1, 1)) && ctx.token.string.length !== 1 && ctx.token.end === pos.ch) { return _createTagInfo(); } tagAttrValue = _getTagAttributeValue(editor, pos); if (tagAttrValue && tagAttrValue.tagName && tagAttrValue.attrName) { return _createTagInfo(ctx.token, TOKEN_VALUE, offset, tagAttrValue.exclusionList, tagAttrValue.tagName, tagAttrValue.attrName); } } return _createTagInfo(); }
javascript
function getTagInfo(editor, pos) { var ctx, offset, tagAttrs, tagAttrValue; ctx = TokenUtils.getInitialContext(editor._codeMirror, pos); offset = TokenUtils.offsetInToken(ctx); if (ctx.token && ctx.token.type === "tag bracket" && ctx.token.string === "<") { // Returns tagInfo when an angle bracket is created. return _createTagInfo(ctx.token, TOKEN_TAG); } else if (ctx.token && ctx.token.type === "tag") { // Return tagInfo when a tag is created. if (TokenUtils.movePrevToken(ctx)) { if (ctx.token.type === "tag bracket" && ctx.token.string === "<") { TokenUtils.moveNextToken(ctx); return _createTagInfo(ctx.token, TOKEN_TAG, offset); } } } else if (ctx.token && (ctx.token.type === "attribute" || (ctx.token.type === null && regexWhitespace.test(ctx.token.string)))) { // Return tagInfo when an attribute is created. tagAttrs = _getTagAttributes(editor, pos); if (tagAttrs && tagAttrs.tagName) { return _createTagInfo(ctx.token, TOKEN_ATTR, offset, tagAttrs.exclusionList, tagAttrs.tagName, null, tagAttrs.shouldReplace); } } else if (ctx.token && ((ctx.token.type === null && ctx.token.string === "=") || (ctx.token.type === "string" && /^['"]$/.test(ctx.token.string.charAt(0))))) { // Return tag info when an attribute value is created. // Allow no hints if the cursor is outside the value. if (ctx.token.type === "string" && /^['"]$/.test(ctx.token.string.substr(-1, 1)) && ctx.token.string.length !== 1 && ctx.token.end === pos.ch) { return _createTagInfo(); } tagAttrValue = _getTagAttributeValue(editor, pos); if (tagAttrValue && tagAttrValue.tagName && tagAttrValue.attrName) { return _createTagInfo(ctx.token, TOKEN_VALUE, offset, tagAttrValue.exclusionList, tagAttrValue.tagName, tagAttrValue.attrName); } } return _createTagInfo(); }
[ "function", "getTagInfo", "(", "editor", ",", "pos", ")", "{", "var", "ctx", ",", "offset", ",", "tagAttrs", ",", "tagAttrValue", ";", "ctx", "=", "TokenUtils", ".", "getInitialContext", "(", "editor", ".", "_codeMirror", ",", "pos", ")", ";", "offset", ...
Return the tag info at a given position in the active editor @param {!Editor} editor Instance of active editor @param {!{line: number, ch: number}} pos Position of cursor in the editor @return {!{token: Object, tokenType: number, offset: number, exclusionList: Array.<string>, tagName: string, attrName: string, shouldReplace: boolean}}
[ "Return", "the", "tag", "info", "at", "a", "given", "position", "in", "the", "active", "editor" ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/language/XMLUtils.js#L229-L270
train
Returns tagInfo when a tag is created.
[ 30522, 3853, 2131, 15900, 2378, 14876, 1006, 3559, 1010, 13433, 2015, 1007, 1063, 13075, 14931, 2595, 1010, 16396, 1010, 6415, 19321, 2869, 1010, 6415, 19321, 26585, 5657, 1025, 14931, 2595, 1027, 19204, 21823, 4877, 1012, 2131, 5498, 20925, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/CodeInspection.js
toggleCollapsed
function toggleCollapsed(collapsed, doNotSave) { if (collapsed === undefined) { collapsed = !_collapsed; } if (collapsed === _collapsed) { return; } _collapsed = collapsed; if (!doNotSave) { prefs.set(PREF_COLLAPSED, _collapsed); prefs.save(); } if (_collapsed) { Resizer.hide($problemsPanel); } else { if (_hasErrors) { Resizer.show($problemsPanel); } } }
javascript
function toggleCollapsed(collapsed, doNotSave) { if (collapsed === undefined) { collapsed = !_collapsed; } if (collapsed === _collapsed) { return; } _collapsed = collapsed; if (!doNotSave) { prefs.set(PREF_COLLAPSED, _collapsed); prefs.save(); } if (_collapsed) { Resizer.hide($problemsPanel); } else { if (_hasErrors) { Resizer.show($problemsPanel); } } }
[ "function", "toggleCollapsed", "(", "collapsed", ",", "doNotSave", ")", "{", "if", "(", "collapsed", "===", "undefined", ")", "{", "collapsed", "=", "!", "_collapsed", ";", "}", "if", "(", "collapsed", "===", "_collapsed", ")", "{", "return", ";", "}", "...
Toggle the collapsed state for the panel. This explicitly collapses the panel (as opposed to the auto collapse due to files with no errors & filetypes with no provider). When explicitly collapsed, the panel will not reopen automatically on switch files or save. @param {?boolean} collapsed Collapsed state. If omitted, the state is toggled. @param {?boolean} doNotSave true if the preference should not be saved to user settings. This is generally for events triggered by project-level settings.
[ "Toggle", "the", "collapsed", "state", "for", "the", "panel", ".", "This", "explicitly", "collapses", "the", "panel", "(", "as", "opposed", "to", "the", "auto", "collapse", "due", "to", "files", "with", "no", "errors", "&", "filetypes", "with", "no", "prov...
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/language/CodeInspection.js#L591-L613
train
Toggle Collapsed
[ 30522, 3853, 2000, 24679, 26895, 9331, 6924, 1006, 7798, 1010, 2123, 12868, 10696, 1007, 1063, 2065, 1006, 7798, 1027, 1027, 1027, 6151, 28344, 1007, 1063, 7798, 1027, 999, 1035, 7798, 1025, 1065, 2065, 1006, 7798, 1027, 1027, 1027, 1035, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
jgraph/mxgraph
javascript/mxClient.js
function(pt, cos, sin, c) { c = (c != null) ? c : new mxPoint(); var x = pt.x - c.x; var y = pt.y - c.y; var x1 = x * cos - y * sin; var y1 = y * cos + x * sin; return new mxPoint(x1 + c.x, y1 + c.y); }
javascript
function(pt, cos, sin, c) { c = (c != null) ? c : new mxPoint(); var x = pt.x - c.x; var y = pt.y - c.y; var x1 = x * cos - y * sin; var y1 = y * cos + x * sin; return new mxPoint(x1 + c.x, y1 + c.y); }
[ "function", "(", "pt", ",", "cos", ",", "sin", ",", "c", ")", "{", "c", "=", "(", "c", "!=", "null", ")", "?", "c", ":", "new", "mxPoint", "(", ")", ";", "var", "x", "=", "pt", ".", "x", "-", "c", ".", "x", ";", "var", "y", "=", "pt", ...
Function: getRotatedPoint Rotates the given point by the given cos and sin.
[ "Function", ":", "getRotatedPoint" ]
33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44
https://github.com/jgraph/mxgraph/blob/33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44/javascript/mxClient.js#L4248-L4258
train
Returns the point at which the given point is in the clipped region
[ 30522, 3853, 1006, 13866, 1010, 2522, 2015, 1010, 8254, 1010, 1039, 1007, 1063, 1039, 1027, 1006, 1039, 999, 1027, 19701, 1007, 1029, 1039, 1024, 2047, 25630, 8400, 1006, 1007, 1025, 13075, 1060, 1027, 13866, 1012, 1060, 1011, 1039, 1012, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/model/analytics/odata4analytics.js
function(array, from, to) { var rest = array.slice((to || from) + 1 || array.length); array.length = from < 0 ? array.length + from : from; return array.push.apply(array, rest); }
javascript
function(array, from, to) { var rest = array.slice((to || from) + 1 || array.length); array.length = from < 0 ? array.length + from : from; return array.push.apply(array, rest); }
[ "function", "(", "array", ",", "from", ",", "to", ")", "{", "var", "rest", "=", "array", ".", "slice", "(", "(", "to", "||", "from", ")", "+", "1", "||", "array", ".", "length", ")", ";", "array", ".", "length", "=", "from", "<", "0", "?", "a...
TODO helper method to remove elements from array @private
[ "TODO", "helper", "method", "to", "remove", "elements", "from", "array" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/analytics/odata4analytics.js#L3654-L3658
train
Add a range of items to an array
[ 30522, 3853, 1006, 9140, 1010, 2013, 1010, 2000, 1007, 1063, 13075, 2717, 1027, 9140, 1012, 14704, 1006, 1006, 2000, 1064, 1064, 2013, 1007, 1009, 1015, 1064, 1064, 9140, 1012, 3091, 1007, 1025, 9140, 1012, 3091, 1027, 2013, 1026, 1014, 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...
quasarframework/quasar
cli/lib/generate.js
filterFiles
function filterFiles (filters) { return (files, metalsmith, done) => { filter(files, filters, metalsmith.metadata(), done) } }
javascript
function filterFiles (filters) { return (files, metalsmith, done) => { filter(files, filters, metalsmith.metadata(), done) } }
[ "function", "filterFiles", "(", "filters", ")", "{", "return", "(", "files", ",", "metalsmith", ",", "done", ")", "=>", "{", "filter", "(", "files", ",", "filters", ",", "metalsmith", ".", "metadata", "(", ")", ",", "done", ")", "}", "}" ]
Create a middleware for filtering files. @param {Object} filters @return {Function}
[ "Create", "a", "middleware", "for", "filtering", "files", "." ]
5d2fb6c96bff6095236f8ca6fe07a037e32e06b3
https://github.com/quasarframework/quasar/blob/5d2fb6c96bff6095236f8ca6fe07a037e32e06b3/cli/lib/generate.js#L106-L110
train
filter files by filter
[ 30522, 3853, 11307, 8873, 4244, 1006, 17736, 1007, 1063, 2709, 1006, 6764, 1010, 11970, 19864, 1010, 2589, 1007, 1027, 1028, 1063, 11307, 1006, 6764, 1010, 17736, 1010, 11970, 19864, 1012, 27425, 1006, 1007, 1010, 2589, 1007, 1065, 1065, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SheetJS/js-xlsx
bits/62_fxls.js
parse_PtgExtraArray
function parse_PtgExtraArray(blob, length, opts) { var rows = 0, cols = 0; if(opts.biff == 12) { rows = blob.read_shift(4); // DRw cols = blob.read_shift(4); // DCol } else { cols = 1 + blob.read_shift(1); //DColByteU rows = 1 + blob.read_shift(2); //DRw } if(opts.biff >= 2 && opts.biff < 8) { --rows; if(--cols == 0) cols = 0x100; } // $FlowIgnore for(var i = 0, o/*:Array<Array<any>>*/ = []; i != rows && (o[i] = []); ++i) for(var j = 0; j != cols; ++j) o[i][j] = parse_SerAr(blob, opts.biff); return o; }
javascript
function parse_PtgExtraArray(blob, length, opts) { var rows = 0, cols = 0; if(opts.biff == 12) { rows = blob.read_shift(4); // DRw cols = blob.read_shift(4); // DCol } else { cols = 1 + blob.read_shift(1); //DColByteU rows = 1 + blob.read_shift(2); //DRw } if(opts.biff >= 2 && opts.biff < 8) { --rows; if(--cols == 0) cols = 0x100; } // $FlowIgnore for(var i = 0, o/*:Array<Array<any>>*/ = []; i != rows && (o[i] = []); ++i) for(var j = 0; j != cols; ++j) o[i][j] = parse_SerAr(blob, opts.biff); return o; }
[ "function", "parse_PtgExtraArray", "(", "blob", ",", "length", ",", "opts", ")", "{", "var", "rows", "=", "0", ",", "cols", "=", "0", ";", "if", "(", "opts", ".", "biff", "==", "12", ")", "{", "rows", "=", "blob", ".", "read_shift", "(", "4", ")"...
/* [MS-XLS] 2.5.198.59 ; [MS-XLSB] 2.5.97.41
[ "/", "*", "[", "MS", "-", "XLS", "]", "2", ".", "5", ".", "198", ".", "59", ";", "[", "MS", "-", "XLSB", "]", "2", ".", "5", ".", "97", ".", "41" ]
9a6d8a1d3d80c78dad5201fb389316f935279cdc
https://github.com/SheetJS/js-xlsx/blob/9a6d8a1d3d80c78dad5201fb389316f935279cdc/bits/62_fxls.js#L311-L325
train
Parse an extra array
[ 30522, 3853, 11968, 3366, 1035, 13866, 3351, 18413, 2527, 2906, 9447, 1006, 1038, 4135, 2497, 1010, 3091, 1010, 23569, 2015, 1007, 1063, 13075, 10281, 1027, 1014, 1010, 8902, 2015, 1027, 1014, 1025, 2065, 1006, 23569, 2015, 1012, 12170, 424...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/prefer-named-capture-group.js
checkRegex
function checkRegex(regex, node, uFlag) { let ast; try { ast = parser.parsePattern(regex, 0, regex.length, uFlag); } catch (_) { // ignore regex syntax errors return; } regexpp.visitRegExpAST(ast, { onCapturingGroupEnter(group) { if (!group.name) { const locNode = node.type === "Literal" ? node : node.arguments[0]; context.report({ node, messageId: "required", loc: { start: { line: locNode.loc.start.line, column: locNode.loc.start.column + group.start + 1 }, end: { line: locNode.loc.start.line, column: locNode.loc.start.column + group.end + 1 } }, data: { group: group.raw } }); } } }); }
javascript
function checkRegex(regex, node, uFlag) { let ast; try { ast = parser.parsePattern(regex, 0, regex.length, uFlag); } catch (_) { // ignore regex syntax errors return; } regexpp.visitRegExpAST(ast, { onCapturingGroupEnter(group) { if (!group.name) { const locNode = node.type === "Literal" ? node : node.arguments[0]; context.report({ node, messageId: "required", loc: { start: { line: locNode.loc.start.line, column: locNode.loc.start.column + group.start + 1 }, end: { line: locNode.loc.start.line, column: locNode.loc.start.column + group.end + 1 } }, data: { group: group.raw } }); } } }); }
[ "function", "checkRegex", "(", "regex", ",", "node", ",", "uFlag", ")", "{", "let", "ast", ";", "try", "{", "ast", "=", "parser", ".", "parsePattern", "(", "regex", ",", "0", ",", "regex", ".", "length", ",", "uFlag", ")", ";", "}", "catch", "(", ...
Function to check regular expression. @param {string} regex The regular expression to be check. @param {ASTNode} node AST node which contains regular expression. @param {boolean} uFlag Flag indicates whether unicode mode is enabled or not. @returns {void}
[ "Function", "to", "check", "regular", "expression", "." ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/prefer-named-capture-group.js#L58-L94
train
Check if a regular expression is valid
[ 30522, 3853, 4638, 2890, 3351, 2595, 1006, 19723, 10288, 1010, 13045, 1010, 1057, 10258, 8490, 1007, 1063, 2292, 2004, 2102, 1025, 3046, 1063, 2004, 2102, 1027, 11968, 8043, 1012, 11968, 3366, 4502, 12079, 2078, 1006, 19723, 10288, 1010, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Batch.js
getHeaderParameterValue
function getHeaderParameterValue(sHeaderValue, sParameterName) { var iParamIndex, aHeaderParts = sHeaderValue.split(";"), aMatches; sParameterName = sParameterName.toLowerCase(); for (iParamIndex = 1; iParamIndex < aHeaderParts.length; iParamIndex += 1) { // remove possible quotes via reg exp // RFC7231: parameter = token "=" ( token / quoted-string ) aMatches = rHeaderParameter.exec(aHeaderParts[iParamIndex]); if (aMatches[1].toLowerCase() === sParameterName) { return aMatches[2] || aMatches[3]; } } }
javascript
function getHeaderParameterValue(sHeaderValue, sParameterName) { var iParamIndex, aHeaderParts = sHeaderValue.split(";"), aMatches; sParameterName = sParameterName.toLowerCase(); for (iParamIndex = 1; iParamIndex < aHeaderParts.length; iParamIndex += 1) { // remove possible quotes via reg exp // RFC7231: parameter = token "=" ( token / quoted-string ) aMatches = rHeaderParameter.exec(aHeaderParts[iParamIndex]); if (aMatches[1].toLowerCase() === sParameterName) { return aMatches[2] || aMatches[3]; } } }
[ "function", "getHeaderParameterValue", "(", "sHeaderValue", ",", "sParameterName", ")", "{", "var", "iParamIndex", ",", "aHeaderParts", "=", "sHeaderValue", ".", "split", "(", "\";\"", ")", ",", "aMatches", ";", "sParameterName", "=", "sParameterName", ".", "toLow...
Extracts value of the parameter with the specified <code>sParameterName</code> from the specified <code>sHeaderValue</code>. @param {string} sHeaderValue HTTP header value e.g. "application/json;charset=utf-8" @param {string} sParameterName Name of HTTP header parameter e.g. "charset" @returns {string} The HTTP header parameter value
[ "Extracts", "value", "of", "the", "parameter", "with", "the", "specified", "<code", ">", "sParameterName<", "/", "code", ">", "from", "the", "specified", "<code", ">", "sHeaderValue<", "/", "code", ">", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Batch.js#L50-L64
train
Get the value of a header parameter
[ 30522, 3853, 2131, 4974, 2121, 28689, 22828, 10175, 5657, 1006, 16994, 4063, 10175, 5657, 1010, 12403, 6444, 15141, 18442, 30524, 26950, 1027, 16994, 4063, 10175, 5657, 1012, 3975, 1006, 1000, 1025, 1000, 1007, 1010, 25933, 10649, 2229, 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...
goldfire/howler.js
dist/howler.js
function(o) { var self = this; // Throw an error if no source is provided. if (!o.src || o.src.length === 0) { console.error('An array of source files must be passed with any new Howl.'); return; } self.init(o); }
javascript
function(o) { var self = this; // Throw an error if no source is provided. if (!o.src || o.src.length === 0) { console.error('An array of source files must be passed with any new Howl.'); return; } self.init(o); }
[ "function", "(", "o", ")", "{", "var", "self", "=", "this", ";", "// Throw an error if no source is provided.", "if", "(", "!", "o", ".", "src", "||", "o", ".", "src", ".", "length", "===", "0", ")", "{", "console", ".", "error", "(", "'An array of sourc...
Group Methods * ************************************************************************ Create an audio group controller. @param {Object} o Passed in properties for this group.
[ "Group", "Methods", "*", "************************************************************************", "Create", "an", "audio", "group", "controller", "." ]
030db918dd8ce640afd57e172418472497e8f113
https://github.com/goldfire/howler.js/blob/030db918dd8ce640afd57e172418472497e8f113/dist/howler.js#L528-L538
train
This function is called by the howl constructor to create a new Howl object.
[ 30522, 3853, 1006, 1051, 1007, 1063, 13075, 2969, 1027, 2023, 1025, 1013, 1013, 5466, 2019, 7561, 2065, 2053, 3120, 2003, 3024, 1012, 2065, 1006, 999, 1051, 1012, 5034, 2278, 1064, 1064, 1051, 1012, 5034, 2278, 1012, 3091, 1027, 1027, 102...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/core/util/DraftEnabledMockServer.js
function(oAnnotations, oMockServer) { // callback function to update draft specific properties post creation var fnNewDraftPost = function(oEvent) { var oNewEntity = oEvent.getParameter("oEntity"); oNewEntity.IsActiveEntity = false; oNewEntity.HasActiveEntity = false; oNewEntity.HasDraftEntity = false; }; // callback function to update draft specific properties pre deletion var fnDraftDelete = function(oEvent) { var oXhr = oEvent.getParameter("oXhr"); var oEntry = jQuery.sap.sjax({ url: oXhr.url, dataType: "json" }).data.d; // navigate to draft nodes and delete nodes for (var i = 0; i < this._oDraftMetadata.draftNodes.length; i++) { for (var navprop in this._mEntitySets[this._oDraftMetadata.draftRootName].navprops) { if (this._mEntitySets[this._oDraftMetadata.draftRootName].navprops[navprop].to.entitySet === this._oDraftMetadata.draftNodes[i]) { var oResponse = jQuery.sap.sjax({ url: oEntry[navprop].__deferred.uri, dataType: "json" }); if (oResponse.data && oResponse.data.d && oResponse.data.d.results) { var oNode; for (var j = 0; j < oResponse.data.d.results.length; j++) { oNode = oResponse.data.d.results[j]; jQuery.sap.sjax({ url: oNode.__metadata.uri, type: "DELETE" }); } } } } } }; if (oAnnotations && oAnnotations.EntityContainer) { var oEntitySetsAnnotations = oAnnotations.EntityContainer[Object.keys(oAnnotations.EntityContainer)[0]]; //iterate over entitysets annotations for (var sEntityset in oEntitySetsAnnotations) { //get entity set annotations and look for DraftRoot annotation var oEntitySetAnnotations = oEntitySetsAnnotations[sEntityset]; if (oEntitySetAnnotations[this._oConstants.COM_SAP_VOCABULARIES_COMMON_V1_DRAFTROOT]) { this._oDraftMetadata.draftRootName = sEntityset; this._oDraftMetadata.annotations = oAnnotations; this._oDraftMetadata.mockServerRootUri = oMockServer.getRootUri(); if (oEntitySetAnnotations[this._oConstants.COM_SAP_VOCABULARIES_COMMON_V1_DRAFTROOT][this._oConstants.ACTIVATION_ACTION]){ this._oDraftMetadata.draftRootActivationName = oEntitySetAnnotations[this._oConstants.COM_SAP_VOCABULARIES_COMMON_V1_DRAFTROOT][this ._oConstants.ACTIVATION_ACTION ].String; } if (this._oDraftMetadata.draftRootActivationName) { this._oDraftMetadata.draftRootActivationName = this._oDraftMetadata.draftRootActivationName.substring(this._oDraftMetadata.draftRootActivationName .lastIndexOf("/") + 1); } this._oDraftMetadata.draftRootEditName = oEntitySetAnnotations[this._oConstants.COM_SAP_VOCABULARIES_COMMON_V1_DRAFTROOT][this ._oConstants.EDIT_ACTION ]; this._oDraftMetadata.draftRootEditName = this._oDraftMetadata.draftRootEditName ? this._oDraftMetadata.draftRootEditName.String : undefined; if (this._oDraftMetadata.draftRootEditName) { this._oDraftMetadata.draftRootEditName = this._oDraftMetadata.draftRootEditName.substring(this._oDraftMetadata.draftRootEditName .lastIndexOf("/") + 1); } this._oDraftMetadata.draftRootValidationName = oEntitySetAnnotations[this._oConstants.COM_SAP_VOCABULARIES_COMMON_V1_DRAFTROOT][this ._oConstants.VALIDATE_ACTION ]; this._oDraftMetadata.draftRootValidationName = this._oDraftMetadata.draftRootValidationName ? this._oDraftMetadata.draftRootValidationName .String : undefined; if (this._oDraftMetadata.draftRootValidationName) { this._oDraftMetadata.draftRootValidationName = this._oDraftMetadata.draftRootValidationName.substring(this._oDraftMetadata.draftRootValidationName .lastIndexOf("/") + 1); } this._oDraftMetadata.draftRootPreparationtionName = oEntitySetAnnotations[this._oConstants.COM_SAP_VOCABULARIES_COMMON_V1_DRAFTROOT] [this ._oConstants.PREPARE_ACTION ]; this._oDraftMetadata.draftRootPreparationtionName = this._oDraftMetadata.draftRootPreparationtionName ? this._oDraftMetadata.draftRootPreparationtionName .String : undefined; if (this._oDraftMetadata.draftRootPreparationtionName) { this._oDraftMetadata.draftRootPreparationtionName = this._oDraftMetadata.draftRootPreparationtionName.substring(this._oDraftMetadata .draftRootPreparationtionName .lastIndexOf("/") + 1); } // extend the mockserver with addtional draft functionality encapsulated in this file jQuery.extend(oMockServer, this); // A new draft is created with a POST request on the entity set for the root entities. oMockServer.attachAfter(MockServer.HTTPMETHOD.POST, fnNewDraftPost, this._oDraftMetadata.draftRootName); // A new draft can be deleted with a DELETE request to the root entity of the new draft; the root entity and all dependent entities will be deleted oMockServer.attachBefore(MockServer.HTTPMETHOD.DELETE, fnDraftDelete, this._oDraftMetadata.draftRootName); // Active documents without a related draft should return null for DraftAdministrativeData oMockServer.attachAfter(MockServer.HTTPMETHOD.GET, this._fnDraftAdministrativeData, this._oDraftMetadata.draftRootName); } } } }
javascript
function(oAnnotations, oMockServer) { // callback function to update draft specific properties post creation var fnNewDraftPost = function(oEvent) { var oNewEntity = oEvent.getParameter("oEntity"); oNewEntity.IsActiveEntity = false; oNewEntity.HasActiveEntity = false; oNewEntity.HasDraftEntity = false; }; // callback function to update draft specific properties pre deletion var fnDraftDelete = function(oEvent) { var oXhr = oEvent.getParameter("oXhr"); var oEntry = jQuery.sap.sjax({ url: oXhr.url, dataType: "json" }).data.d; // navigate to draft nodes and delete nodes for (var i = 0; i < this._oDraftMetadata.draftNodes.length; i++) { for (var navprop in this._mEntitySets[this._oDraftMetadata.draftRootName].navprops) { if (this._mEntitySets[this._oDraftMetadata.draftRootName].navprops[navprop].to.entitySet === this._oDraftMetadata.draftNodes[i]) { var oResponse = jQuery.sap.sjax({ url: oEntry[navprop].__deferred.uri, dataType: "json" }); if (oResponse.data && oResponse.data.d && oResponse.data.d.results) { var oNode; for (var j = 0; j < oResponse.data.d.results.length; j++) { oNode = oResponse.data.d.results[j]; jQuery.sap.sjax({ url: oNode.__metadata.uri, type: "DELETE" }); } } } } } }; if (oAnnotations && oAnnotations.EntityContainer) { var oEntitySetsAnnotations = oAnnotations.EntityContainer[Object.keys(oAnnotations.EntityContainer)[0]]; //iterate over entitysets annotations for (var sEntityset in oEntitySetsAnnotations) { //get entity set annotations and look for DraftRoot annotation var oEntitySetAnnotations = oEntitySetsAnnotations[sEntityset]; if (oEntitySetAnnotations[this._oConstants.COM_SAP_VOCABULARIES_COMMON_V1_DRAFTROOT]) { this._oDraftMetadata.draftRootName = sEntityset; this._oDraftMetadata.annotations = oAnnotations; this._oDraftMetadata.mockServerRootUri = oMockServer.getRootUri(); if (oEntitySetAnnotations[this._oConstants.COM_SAP_VOCABULARIES_COMMON_V1_DRAFTROOT][this._oConstants.ACTIVATION_ACTION]){ this._oDraftMetadata.draftRootActivationName = oEntitySetAnnotations[this._oConstants.COM_SAP_VOCABULARIES_COMMON_V1_DRAFTROOT][this ._oConstants.ACTIVATION_ACTION ].String; } if (this._oDraftMetadata.draftRootActivationName) { this._oDraftMetadata.draftRootActivationName = this._oDraftMetadata.draftRootActivationName.substring(this._oDraftMetadata.draftRootActivationName .lastIndexOf("/") + 1); } this._oDraftMetadata.draftRootEditName = oEntitySetAnnotations[this._oConstants.COM_SAP_VOCABULARIES_COMMON_V1_DRAFTROOT][this ._oConstants.EDIT_ACTION ]; this._oDraftMetadata.draftRootEditName = this._oDraftMetadata.draftRootEditName ? this._oDraftMetadata.draftRootEditName.String : undefined; if (this._oDraftMetadata.draftRootEditName) { this._oDraftMetadata.draftRootEditName = this._oDraftMetadata.draftRootEditName.substring(this._oDraftMetadata.draftRootEditName .lastIndexOf("/") + 1); } this._oDraftMetadata.draftRootValidationName = oEntitySetAnnotations[this._oConstants.COM_SAP_VOCABULARIES_COMMON_V1_DRAFTROOT][this ._oConstants.VALIDATE_ACTION ]; this._oDraftMetadata.draftRootValidationName = this._oDraftMetadata.draftRootValidationName ? this._oDraftMetadata.draftRootValidationName .String : undefined; if (this._oDraftMetadata.draftRootValidationName) { this._oDraftMetadata.draftRootValidationName = this._oDraftMetadata.draftRootValidationName.substring(this._oDraftMetadata.draftRootValidationName .lastIndexOf("/") + 1); } this._oDraftMetadata.draftRootPreparationtionName = oEntitySetAnnotations[this._oConstants.COM_SAP_VOCABULARIES_COMMON_V1_DRAFTROOT] [this ._oConstants.PREPARE_ACTION ]; this._oDraftMetadata.draftRootPreparationtionName = this._oDraftMetadata.draftRootPreparationtionName ? this._oDraftMetadata.draftRootPreparationtionName .String : undefined; if (this._oDraftMetadata.draftRootPreparationtionName) { this._oDraftMetadata.draftRootPreparationtionName = this._oDraftMetadata.draftRootPreparationtionName.substring(this._oDraftMetadata .draftRootPreparationtionName .lastIndexOf("/") + 1); } // extend the mockserver with addtional draft functionality encapsulated in this file jQuery.extend(oMockServer, this); // A new draft is created with a POST request on the entity set for the root entities. oMockServer.attachAfter(MockServer.HTTPMETHOD.POST, fnNewDraftPost, this._oDraftMetadata.draftRootName); // A new draft can be deleted with a DELETE request to the root entity of the new draft; the root entity and all dependent entities will be deleted oMockServer.attachBefore(MockServer.HTTPMETHOD.DELETE, fnDraftDelete, this._oDraftMetadata.draftRootName); // Active documents without a related draft should return null for DraftAdministrativeData oMockServer.attachAfter(MockServer.HTTPMETHOD.GET, this._fnDraftAdministrativeData, this._oDraftMetadata.draftRootName); } } } }
[ "function", "(", "oAnnotations", ",", "oMockServer", ")", "{", "// callback function to update draft specific properties post creation", "var", "fnNewDraftPost", "=", "function", "(", "oEvent", ")", "{", "var", "oNewEntity", "=", "oEvent", ".", "getParameter", "(", "\"o...
Enriches MockServer with draft capabilities based on the given OData service annotations. @param {object} oAnnotations annotation object of sap.ui.model.odata.ODataModel @param {object} oMockServer
[ "Enriches", "MockServer", "with", "draft", "capabilities", "based", "on", "the", "given", "OData", "service", "annotations", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/util/DraftEnabledMockServer.js#L28-L124
train
Updates the draft specific properties
[ 30522, 3853, 1006, 1051, 11639, 17287, 9285, 1010, 18168, 25384, 2121, 6299, 1007, 1063, 1013, 1013, 2655, 5963, 3853, 2000, 10651, 4433, 3563, 5144, 2695, 4325, 13075, 1042, 10087, 21724, 27528, 25856, 14122, 1027, 3853, 1006, 1051, 18697, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
pagekit/vue-resource
dist/vue-resource.esm.js
json
function json (request) { var type = request.headers.get('Content-Type') || ''; if (isObject(request.body) && type.indexOf('application/json') === 0) { request.body = JSON.stringify(request.body); } return function (response) { return response.bodyText ? when(response.text(), function (text) { var type = response.headers.get('Content-Type') || ''; if (type.indexOf('application/json') === 0 || isJson(text)) { try { response.body = JSON.parse(text); } catch (e) { response.body = null; } } else { response.body = text; } return response; }) : response; }; }
javascript
function json (request) { var type = request.headers.get('Content-Type') || ''; if (isObject(request.body) && type.indexOf('application/json') === 0) { request.body = JSON.stringify(request.body); } return function (response) { return response.bodyText ? when(response.text(), function (text) { var type = response.headers.get('Content-Type') || ''; if (type.indexOf('application/json') === 0 || isJson(text)) { try { response.body = JSON.parse(text); } catch (e) { response.body = null; } } else { response.body = text; } return response; }) : response; }; }
[ "function", "json", "(", "request", ")", "{", "var", "type", "=", "request", ".", "headers", ".", "get", "(", "'Content-Type'", ")", "||", "''", ";", "if", "(", "isObject", "(", "request", ".", "body", ")", "&&", "type", ".", "indexOf", "(", "'applic...
JSON Interceptor.
[ "JSON", "Interceptor", "." ]
fe268fa1d6053ede5f34aef9a11e1a424a70446c
https://github.com/pagekit/vue-resource/blob/fe268fa1d6053ede5f34aef9a11e1a424a70446c/dist/vue-resource.esm.js#L863-L894
train
json - json
[ 30522, 3853, 1046, 3385, 1006, 5227, 1007, 1063, 13075, 2828, 1027, 5227, 1012, 20346, 2015, 1012, 2131, 1006, 1005, 4180, 1011, 2828, 1005, 1007, 1064, 1064, 1005, 1005, 1025, 2065, 1006, 11163, 2497, 20614, 1006, 5227, 1012, 2303, 1007, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
facebook/relay
packages/relay-runtime/handlers/connection/RelayConnectionHandler.js
getConnection
function getConnection( record: ReadOnlyRecordProxy, key: string, filters?: ?Variables, ): ?RecordProxy { const handleKey = getRelayHandleKey(CONNECTION, key, null); return record.getLinkedRecord(handleKey, filters); }
javascript
function getConnection( record: ReadOnlyRecordProxy, key: string, filters?: ?Variables, ): ?RecordProxy { const handleKey = getRelayHandleKey(CONNECTION, key, null); return record.getLinkedRecord(handleKey, filters); }
[ "function", "getConnection", "(", "record", ":", "ReadOnlyRecordProxy", ",", "key", ":", "string", ",", "filters", "?", ":", "?", "Variables", ",", ")", ":", "?", "RecordProxy", "{", "const", "handleKey", "=", "getRelayHandleKey", "(", "CONNECTION", ",", "ke...
@public Given a record and the name of the schema field for which a connection was fetched, returns the linked connection record. Example: Given that data has already been fetched on some user `<id>` on the `friends` field: ``` fragment FriendsFragment on User { friends(first: 10) @connection(key: "FriendsFragment_friends") { edges { node { id } } } } ``` The `friends` connection record can be accessed with: ``` store => { const user = store.get('<id>'); const friends = RelayConnectionHandler.getConnection(user, 'FriendsFragment_friends'); // Access fields on the connection: const edges = friends.getLinkedRecords('edges'); } ``` TODO: t15733312 Currently we haven't run into this case yet, but we need to add a `getConnections` that returns an array of the connections under the same `key` regardless of the variables.
[ "@public" ]
7fb9be5182b9650637d7b92ead9a42713ac30aa4
https://github.com/facebook/relay/blob/7fb9be5182b9650637d7b92ead9a42713ac30aa4/packages/relay-runtime/handlers/connection/RelayConnectionHandler.js#L248-L255
train
Get a connection to a connection
[ 30522, 3853, 2131, 8663, 2638, 7542, 1006, 2501, 1024, 3191, 2239, 2135, 2890, 27108, 18927, 3217, 18037, 1010, 3145, 1024, 5164, 1010, 17736, 1029, 1024, 1029, 10857, 1010, 1007, 1024, 1029, 2501, 21572, 18037, 1063, 9530, 3367, 5047, 1483...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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(sName) { if (this._oMeasureSet[sName]) { // the easy case return this._oMeasureSet[sName]; } for ( var sMeasureName in this._oMeasureSet) { var oMeasure = this._oMeasureSet[sMeasureName]; var oFormattedValueProperty = oMeasure.getFormattedValueProperty(); if (oFormattedValueProperty && oFormattedValueProperty.name == sName) { return oMeasure; } } return null; }
javascript
function(sName) { if (this._oMeasureSet[sName]) { // the easy case return this._oMeasureSet[sName]; } for ( var sMeasureName in this._oMeasureSet) { var oMeasure = this._oMeasureSet[sMeasureName]; var oFormattedValueProperty = oMeasure.getFormattedValueProperty(); if (oFormattedValueProperty && oFormattedValueProperty.name == sName) { return oMeasure; } } return null; }
[ "function", "(", "sName", ")", "{", "if", "(", "this", ".", "_oMeasureSet", "[", "sName", "]", ")", "{", "// the easy case", "return", "this", ".", "_oMeasureSet", "[", "sName", "]", ";", "}", "for", "(", "var", "sMeasureName", "in", "this", ".", "_oMe...
Find measure by property name @param {string} sName Property name @returns {sap.ui.model.analytics.odata4analytics.Measure} The measure object to which the given property name is related, because the property holds the raw measure value or its formatted value. If no such measure exists, null is returned. @public @function @name sap.ui.model.analytics.odata4analytics.QueryResult#findMeasureByPropertyName
[ "Find", "measure", "by", "property", "name" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/analytics/odata4analytics.js#L1163-L1176
train
Returns the measure with the given name
[ 30522, 3853, 1006, 1055, 18442, 1007, 1063, 2065, 1006, 2023, 1012, 1035, 18168, 5243, 28632, 13462, 1031, 1055, 18442, 1033, 1007, 1063, 1013, 1013, 1996, 3733, 2553, 2709, 2023, 1012, 1035, 18168, 5243, 28632, 13462, 1031, 1055, 18442, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/thirdparty/jszip.js
function(options) { options = extend(options || {}, { base64: true, compression: "STORE", type: "base64" }); utils.checkSupport(options.type); var zipData = [], localDirLength = 0, centralDirLength = 0, writer, i; // first, generate all the zip parts. for (var name in this.files) { if (!this.files.hasOwnProperty(name)) { continue; } var file = this.files[name]; var compressionName = file.options.compression || options.compression.toUpperCase(); var compression = compressions[compressionName]; if (!compression) { throw new Error(compressionName + " is not a valid compression method !"); } var compressedObject = generateCompressedObjectFrom.call(this, file, compression); var zipPart = generateZipParts.call(this, name, file, compressedObject, localDirLength); localDirLength += zipPart.fileRecord.length + compressedObject.compressedSize; centralDirLength += zipPart.dirRecord.length; zipData.push(zipPart); } var dirEnd = ""; // end of central dir signature dirEnd = signature.CENTRAL_DIRECTORY_END + // number of this disk "\x00\x00" + // number of the disk with the start of the central directory "\x00\x00" + // total number of entries in the central directory on this disk decToHex(zipData.length, 2) + // total number of entries in the central directory decToHex(zipData.length, 2) + // size of the central directory 4 bytes decToHex(centralDirLength, 4) + // offset of start of central directory with respect to the starting disk number decToHex(localDirLength, 4) + // .ZIP file comment length "\x00\x00"; // we have all the parts (and the total length) // time to create a writer ! var typeName = options.type.toLowerCase(); if(typeName==="uint8array"||typeName==="arraybuffer"||typeName==="blob"||typeName==="nodebuffer") { writer = new Uint8ArrayWriter(localDirLength + centralDirLength + dirEnd.length); }else{ writer = new StringWriter(localDirLength + centralDirLength + dirEnd.length); } for (i = 0; i < zipData.length; i++) { writer.append(zipData[i].fileRecord); writer.append(zipData[i].compressedObject.compressedContent); } for (i = 0; i < zipData.length; i++) { writer.append(zipData[i].dirRecord); } writer.append(dirEnd); var zip = writer.finalize(); switch(options.type.toLowerCase()) { // case "zip is an Uint8Array" case "uint8array" : case "arraybuffer" : case "nodebuffer" : return utils.transformTo(options.type.toLowerCase(), zip); case "blob" : return utils.arrayBuffer2Blob(utils.transformTo("arraybuffer", zip)); // case "zip is a string" case "base64" : return (options.base64) ? base64.encode(zip) : zip; default : // case "string" : return zip; } }
javascript
function(options) { options = extend(options || {}, { base64: true, compression: "STORE", type: "base64" }); utils.checkSupport(options.type); var zipData = [], localDirLength = 0, centralDirLength = 0, writer, i; // first, generate all the zip parts. for (var name in this.files) { if (!this.files.hasOwnProperty(name)) { continue; } var file = this.files[name]; var compressionName = file.options.compression || options.compression.toUpperCase(); var compression = compressions[compressionName]; if (!compression) { throw new Error(compressionName + " is not a valid compression method !"); } var compressedObject = generateCompressedObjectFrom.call(this, file, compression); var zipPart = generateZipParts.call(this, name, file, compressedObject, localDirLength); localDirLength += zipPart.fileRecord.length + compressedObject.compressedSize; centralDirLength += zipPart.dirRecord.length; zipData.push(zipPart); } var dirEnd = ""; // end of central dir signature dirEnd = signature.CENTRAL_DIRECTORY_END + // number of this disk "\x00\x00" + // number of the disk with the start of the central directory "\x00\x00" + // total number of entries in the central directory on this disk decToHex(zipData.length, 2) + // total number of entries in the central directory decToHex(zipData.length, 2) + // size of the central directory 4 bytes decToHex(centralDirLength, 4) + // offset of start of central directory with respect to the starting disk number decToHex(localDirLength, 4) + // .ZIP file comment length "\x00\x00"; // we have all the parts (and the total length) // time to create a writer ! var typeName = options.type.toLowerCase(); if(typeName==="uint8array"||typeName==="arraybuffer"||typeName==="blob"||typeName==="nodebuffer") { writer = new Uint8ArrayWriter(localDirLength + centralDirLength + dirEnd.length); }else{ writer = new StringWriter(localDirLength + centralDirLength + dirEnd.length); } for (i = 0; i < zipData.length; i++) { writer.append(zipData[i].fileRecord); writer.append(zipData[i].compressedObject.compressedContent); } for (i = 0; i < zipData.length; i++) { writer.append(zipData[i].dirRecord); } writer.append(dirEnd); var zip = writer.finalize(); switch(options.type.toLowerCase()) { // case "zip is an Uint8Array" case "uint8array" : case "arraybuffer" : case "nodebuffer" : return utils.transformTo(options.type.toLowerCase(), zip); case "blob" : return utils.arrayBuffer2Blob(utils.transformTo("arraybuffer", zip)); // case "zip is a string" case "base64" : return (options.base64) ? base64.encode(zip) : zip; default : // case "string" : return zip; } }
[ "function", "(", "options", ")", "{", "options", "=", "extend", "(", "options", "||", "{", "}", ",", "{", "base64", ":", "true", ",", "compression", ":", "\"STORE\"", ",", "type", ":", "\"base64\"", "}", ")", ";", "utils", ".", "checkSupport", "(", "...
Generate the complete zip file @param {Object} options the options to generate the zip file : - base64, (deprecated, use type instead) true to generate base64. - compression, "STORE" by default. - type, "base64" by default. Values are : string, base64, uint8array, arraybuffer, blob. @return {String|Uint8Array|ArrayBuffer|Buffer|Blob} the zip file
[ "Generate", "the", "complete", "zip", "file" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/jszip.js#L1022-L1116
train
Generate central directory
[ 30522, 3853, 1006, 7047, 1007, 1063, 7047, 1027, 7949, 1006, 7047, 1064, 1064, 1063, 1065, 1010, 1063, 2918, 21084, 1024, 2995, 1010, 13379, 1024, 1000, 3573, 1000, 1010, 2828, 1024, 1000, 2918, 21084, 1000, 1065, 1007, 1025, 21183, 12146, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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...
SAP/openui5
src/sap.ui.core/src/sap/ui/core/support/techinfo/TechnicalInfo.js
function () { var oModel = this._oDialog.getModel("view"), sSelectedLocation = oModel.getProperty("/SelectedLocation"), sStandardUrl = oModel.getProperty("/StandardBootstrapURL"), sCustomUrl = oModel.getProperty("/CustomBootstrapURL"), aSupportedUrls = [], sBootstrapURL; oModel.getProperty("/SupportAssistantPopoverURLs").forEach(function (element) { aSupportedUrls.push(element.Value); }); if (aSupportedUrls.indexOf(sStandardUrl) === -1 && sSelectedLocation === "standard") { sSelectedLocation = "custom"; sCustomUrl = sStandardUrl; oModel.setProperty("/SelectedLocation", sSelectedLocation); this._storage.put(this._LOCAL_STORAGE_KEYS.STANDARD_URL, aSupportedUrls[0]); oModel.setProperty("/StandardBootstrapURL", this._storage.get(this._LOCAL_STORAGE_KEYS.STANDARD_URL)); } if (sSelectedLocation === "standard") { sBootstrapURL = sStandardUrl; } else if (sCustomUrl) { // this checks if selected location is custom and CustomBootstrapURL is filed if (!sCustomUrl.match(/\/$/)) { // checks if custom URL is missing / at the end and adds it if missing sCustomUrl += "/"; } this._storage.put(this._LOCAL_STORAGE_KEYS.CUSTOM_URL, sCustomUrl); oModel.setProperty("/CustomBootstrapURL", this._storage.get(this._LOCAL_STORAGE_KEYS.CUSTOM_URL)); sBootstrapURL = sCustomUrl; } this._startAssistant(sBootstrapURL); }
javascript
function () { var oModel = this._oDialog.getModel("view"), sSelectedLocation = oModel.getProperty("/SelectedLocation"), sStandardUrl = oModel.getProperty("/StandardBootstrapURL"), sCustomUrl = oModel.getProperty("/CustomBootstrapURL"), aSupportedUrls = [], sBootstrapURL; oModel.getProperty("/SupportAssistantPopoverURLs").forEach(function (element) { aSupportedUrls.push(element.Value); }); if (aSupportedUrls.indexOf(sStandardUrl) === -1 && sSelectedLocation === "standard") { sSelectedLocation = "custom"; sCustomUrl = sStandardUrl; oModel.setProperty("/SelectedLocation", sSelectedLocation); this._storage.put(this._LOCAL_STORAGE_KEYS.STANDARD_URL, aSupportedUrls[0]); oModel.setProperty("/StandardBootstrapURL", this._storage.get(this._LOCAL_STORAGE_KEYS.STANDARD_URL)); } if (sSelectedLocation === "standard") { sBootstrapURL = sStandardUrl; } else if (sCustomUrl) { // this checks if selected location is custom and CustomBootstrapURL is filed if (!sCustomUrl.match(/\/$/)) { // checks if custom URL is missing / at the end and adds it if missing sCustomUrl += "/"; } this._storage.put(this._LOCAL_STORAGE_KEYS.CUSTOM_URL, sCustomUrl); oModel.setProperty("/CustomBootstrapURL", this._storage.get(this._LOCAL_STORAGE_KEYS.CUSTOM_URL)); sBootstrapURL = sCustomUrl; } this._startAssistant(sBootstrapURL); }
[ "function", "(", ")", "{", "var", "oModel", "=", "this", ".", "_oDialog", ".", "getModel", "(", "\"view\"", ")", ",", "sSelectedLocation", "=", "oModel", ".", "getProperty", "(", "\"/SelectedLocation\"", ")", ",", "sStandardUrl", "=", "oModel", ".", "getProp...
Opens the support assistant with the given configuration
[ "Opens", "the", "support", "assistant", "with", "the", "given", "configuration" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/support/techinfo/TechnicalInfo.js#L302-L335
train
Sets the selected location and the default bootstrap URL
[ 30522, 3853, 1006, 1007, 1063, 13075, 18168, 10244, 2140, 1027, 2023, 1012, 1035, 21045, 23067, 2290, 1012, 2131, 5302, 9247, 1006, 1000, 3193, 1000, 1007, 1010, 7020, 12260, 10985, 4135, 10719, 1027, 18168, 10244, 2140, 1012, 2131, 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...
LLK/scratch-blocks
blocks_vertical/data.js
function() { this.jsonInit({ "message0": Blockly.Msg.DATA_ITEMOFLIST, "args0": [ { "type": "input_value", "name": "INDEX" }, { "type": "field_variable", "name": "LIST", "variableTypes": [Blockly.LIST_VARIABLE_TYPE] } ], "output": null, "category": Blockly.Categories.dataLists, "extensions": ["colours_data_lists"], "outputShape": Blockly.OUTPUT_SHAPE_ROUND }); }
javascript
function() { this.jsonInit({ "message0": Blockly.Msg.DATA_ITEMOFLIST, "args0": [ { "type": "input_value", "name": "INDEX" }, { "type": "field_variable", "name": "LIST", "variableTypes": [Blockly.LIST_VARIABLE_TYPE] } ], "output": null, "category": Blockly.Categories.dataLists, "extensions": ["colours_data_lists"], "outputShape": Blockly.OUTPUT_SHAPE_ROUND }); }
[ "function", "(", ")", "{", "this", ".", "jsonInit", "(", "{", "\"message0\"", ":", "Blockly", ".", "Msg", ".", "DATA_ITEMOFLIST", ",", "\"args0\"", ":", "[", "{", "\"type\"", ":", "\"input_value\"", ",", "\"name\"", ":", "\"INDEX\"", "}", ",", "{", "\"ty...
Block for reporting item of list. @this Blockly.Block
[ "Block", "for", "reporting", "item", "of", "list", "." ]
455b2a854435c0a67da1da92320ddc3ec3e2b799
https://github.com/LLK/scratch-blocks/blob/455b2a854435c0a67da1da92320ddc3ec3e2b799/blocks_vertical/data.js#L365-L384
train
Block for the .
[ 30522, 3853, 1006, 1007, 1063, 2023, 1012, 1046, 3385, 5498, 2102, 1006, 1063, 1000, 4471, 2692, 1000, 1024, 3796, 2135, 1012, 5796, 2290, 1012, 2951, 1035, 8875, 11253, 9863, 1010, 1000, 12098, 5620, 2692, 1000, 1024, 1031, 1063, 1000, 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...
SheetJS/js-xlsx
xlsx.js
parse_XTI
function parse_XTI(blob, length, opts) { var w = opts.biff > 8 ? 4 : 2; var iSupBook = blob.read_shift(w), itabFirst = blob.read_shift(w,'i'), itabLast = blob.read_shift(w,'i'); return [iSupBook, itabFirst, itabLast]; }
javascript
function parse_XTI(blob, length, opts) { var w = opts.biff > 8 ? 4 : 2; var iSupBook = blob.read_shift(w), itabFirst = blob.read_shift(w,'i'), itabLast = blob.read_shift(w,'i'); return [iSupBook, itabFirst, itabLast]; }
[ "function", "parse_XTI", "(", "blob", ",", "length", ",", "opts", ")", "{", "var", "w", "=", "opts", ".", "biff", ">", "8", "?", "4", ":", "2", ";", "var", "iSupBook", "=", "blob", ".", "read_shift", "(", "w", ")", ",", "itabFirst", "=", "blob", ...
/* [MS-XLS] 2.5.344
[ "/", "*", "[", "MS", "-", "XLS", "]", "2", ".", "5", ".", "344" ]
9a6d8a1d3d80c78dad5201fb389316f935279cdc
https://github.com/SheetJS/js-xlsx/blob/9a6d8a1d3d80c78dad5201fb389316f935279cdc/xlsx.js#L5599-L5603
train
XTI - 2. 5
[ 30522, 3853, 11968, 3366, 1035, 1060, 3775, 1006, 1038, 4135, 2497, 1010, 3091, 1010, 23569, 2015, 1007, 1063, 13075, 1059, 1027, 23569, 2015, 1012, 12170, 4246, 1028, 1022, 1029, 1018, 1024, 1016, 1025, 13075, 2003, 6279, 8654, 1027, 1038,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/FileViewController.js
addToWorkingSetAndSelect
function addToWorkingSetAndSelect(fullPath) { DeprecationWarning.deprecationWarning("Use FileViewController.openFileAndAddToWorkingSet() instead of FileViewController.addToWorkingSetAndSelect().", true); var result = new $.Deferred(); openFileAndAddToWorkingSet(fullPath) .done(function (file) { var doc; if (file) { doc = DocumentManager.getOpenDocumentForPath(file.fullPath); } result.resolve(doc); }) .fail(function (err) { result.reject(err); }); return result.promise(); }
javascript
function addToWorkingSetAndSelect(fullPath) { DeprecationWarning.deprecationWarning("Use FileViewController.openFileAndAddToWorkingSet() instead of FileViewController.addToWorkingSetAndSelect().", true); var result = new $.Deferred(); openFileAndAddToWorkingSet(fullPath) .done(function (file) { var doc; if (file) { doc = DocumentManager.getOpenDocumentForPath(file.fullPath); } result.resolve(doc); }) .fail(function (err) { result.reject(err); }); return result.promise(); }
[ "function", "addToWorkingSetAndSelect", "(", "fullPath", ")", "{", "DeprecationWarning", ".", "deprecationWarning", "(", "\"Use FileViewController.openFileAndAddToWorkingSet() instead of FileViewController.addToWorkingSetAndSelect().\"", ",", "true", ")", ";", "var", "result", "=",...
Opens the specified document if it's not already open, adds it to the working set, and selects it in the WorkingSetView @deprecated use FileViewController.openFileAndAddToWorkingSet() instead @param {!fullPath} @return {!$.Promise}
[ "Opens", "the", "specified", "document", "if", "it", "s", "not", "already", "open", "adds", "it", "to", "the", "working", "set", "and", "selects", "it", "in", "the", "WorkingSetView" ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/project/FileViewController.js#L236-L253
train
Add a file to the working set and select it
[ 30522, 3853, 5587, 18790, 2953, 6834, 13462, 29560, 12260, 6593, 1006, 2440, 15069, 1007, 1063, 2139, 28139, 10719, 9028, 5582, 1012, 2139, 28139, 10719, 9028, 5582, 1006, 1000, 2224, 5371, 8584, 8663, 13181, 10820, 1012, 2330, 8873, 20898, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/core/format/NumberFormat.js
findLongestMatch
function findLongestMatch(sValue, mCollection) { var sSymbol = "", sCode, sCurSymbol; for (var sCurCode in mCollection) { sCurSymbol = mCollection[sCurCode]; if (sValue.indexOf(sCurSymbol) >= 0 && sSymbol.length < sCurSymbol.length) { sSymbol = sCurSymbol; sCode = sCurCode; } } return { symbol: sSymbol, code: sCode }; }
javascript
function findLongestMatch(sValue, mCollection) { var sSymbol = "", sCode, sCurSymbol; for (var sCurCode in mCollection) { sCurSymbol = mCollection[sCurCode]; if (sValue.indexOf(sCurSymbol) >= 0 && sSymbol.length < sCurSymbol.length) { sSymbol = sCurSymbol; sCode = sCurCode; } } return { symbol: sSymbol, code: sCode }; }
[ "function", "findLongestMatch", "(", "sValue", ",", "mCollection", ")", "{", "var", "sSymbol", "=", "\"\"", ",", "sCode", ",", "sCurSymbol", ";", "for", "(", "var", "sCurCode", "in", "mCollection", ")", "{", "sCurSymbol", "=", "mCollection", "[", "sCurCode",...
Identify the longest match between a sub string of <code>sValue</code> and one of the values of the <code>mCollection</code> map. @param {string} sValue the string value which is checked for all currency codes/symbols during a parse call @param {object} mCollection a collection of currency codes or symbols @return {object} returns object containing matched symbol/ code
[ "Identify", "the", "longest", "match", "between", "a", "sub", "string", "of", "<code", ">", "sValue<", "/", "code", ">", "and", "one", "of", "the", "values", "of", "the", "<code", ">", "mCollection<", "/", "code", ">", "map", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/format/NumberFormat.js#L1966-L1981
train
Find the longest match in the given value
[ 30522, 3853, 2424, 10052, 4355, 18900, 2818, 1006, 17917, 2389, 5657, 1010, 11338, 14511, 18491, 1007, 1063, 13075, 7020, 24335, 14956, 1027, 1000, 1000, 1010, 8040, 10244, 1010, 8040, 9236, 24335, 14956, 1025, 2005, 1006, 13075, 8040, 3126, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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
authLink
function authLink(path = 'auth') { return dropbox.getAuthenticationUrl( `${window.location.origin}/${path}`, btoa(JSON.stringify({handler: 'dropbox', origin: window.location.origin})) ) }
javascript
function authLink(path = 'auth') { return dropbox.getAuthenticationUrl( `${window.location.origin}/${path}`, btoa(JSON.stringify({handler: 'dropbox', origin: window.location.origin})) ) }
[ "function", "authLink", "(", "path", "=", "'auth'", ")", "{", "return", "dropbox", ".", "getAuthenticationUrl", "(", "`", "${", "window", ".", "location", ".", "origin", "}", "${", "path", "}", "`", ",", "btoa", "(", "JSON", ".", "stringify", "(", "{",...
Generate auth link url to open to be used to handle OAuth2 @param {string} path
[ "Generate", "auth", "link", "url", "to", "open", "to", "be", "used", "to", "handle", "OAuth2" ]
779238435707cc54335c2d00001e4b9334b314aa
https://github.com/keplergl/kepler.gl/blob/779238435707cc54335c2d00001e4b9334b314aa/examples/demo-app/src/utils/cloud-providers/dropbox.js#L49-L54
train
Get the link to the auth page
[ 30522, 3853, 8740, 2705, 13767, 1006, 4130, 1027, 1005, 8740, 2705, 1005, 1007, 1063, 2709, 30524, 3332, 1012, 3295, 1012, 4761, 1065, 1007, 1007, 1007, 1065, 102, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
ColorlibHQ/AdminLTE
plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js
init
function init() { if (api.initialized) { return; } var testRange; var implementsDomRange = false, implementsTextRange = false; // First, perform basic feature tests if (isHostMethod(document, "createRange")) { testRange = document.createRange(); if (areHostMethods(testRange, domRangeMethods) && areHostProperties(testRange, domRangeProperties)) { implementsDomRange = true; } } var body = getBody(document); if (!body || body.nodeName.toLowerCase() != "body") { fail("No body element found"); return; } if (body && isHostMethod(body, "createTextRange")) { testRange = body.createTextRange(); if (isTextRange(testRange)) { implementsTextRange = true; } } if (!implementsDomRange && !implementsTextRange) { fail("Neither Range nor TextRange are available"); return; } api.initialized = true; api.features = { implementsDomRange: implementsDomRange, implementsTextRange: implementsTextRange }; // Initialize modules var module, errorMessage; for (var moduleName in modules) { if ( (module = modules[moduleName]) instanceof Module ) { module.init(module, api); } } // Call init listeners for (var i = 0, len = initListeners.length; i < len; ++i) { try { initListeners[i](api); } catch (ex) { errorMessage = "Rangy init listener threw an exception. Continuing. Detail: " + getErrorDesc(ex); consoleLog(errorMessage); } } }
javascript
function init() { if (api.initialized) { return; } var testRange; var implementsDomRange = false, implementsTextRange = false; // First, perform basic feature tests if (isHostMethod(document, "createRange")) { testRange = document.createRange(); if (areHostMethods(testRange, domRangeMethods) && areHostProperties(testRange, domRangeProperties)) { implementsDomRange = true; } } var body = getBody(document); if (!body || body.nodeName.toLowerCase() != "body") { fail("No body element found"); return; } if (body && isHostMethod(body, "createTextRange")) { testRange = body.createTextRange(); if (isTextRange(testRange)) { implementsTextRange = true; } } if (!implementsDomRange && !implementsTextRange) { fail("Neither Range nor TextRange are available"); return; } api.initialized = true; api.features = { implementsDomRange: implementsDomRange, implementsTextRange: implementsTextRange }; // Initialize modules var module, errorMessage; for (var moduleName in modules) { if ( (module = modules[moduleName]) instanceof Module ) { module.init(module, api); } } // Call init listeners for (var i = 0, len = initListeners.length; i < len; ++i) { try { initListeners[i](api); } catch (ex) { errorMessage = "Rangy init listener threw an exception. Continuing. Detail: " + getErrorDesc(ex); consoleLog(errorMessage); } } }
[ "function", "init", "(", ")", "{", "if", "(", "api", ".", "initialized", ")", "{", "return", ";", "}", "var", "testRange", ";", "var", "implementsDomRange", "=", "false", ",", "implementsTextRange", "=", "false", ";", "// First, perform basic feature tests", "...
Initialization
[ "Initialization" ]
19113c3cbc19a7afe0cfd3158d647064d2d30661
https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js#L284-L341
train
Initialize the Rangy API
[ 30522, 3853, 1999, 4183, 1006, 1007, 1063, 2065, 1006, 17928, 1012, 3988, 3550, 1007, 1063, 2709, 1025, 1065, 13075, 3231, 24388, 2063, 1025, 13075, 22164, 9527, 24388, 2063, 1027, 6270, 1010, 22164, 18209, 24388, 2063, 1027, 6270, 1025, 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...
dcloudio/mui
examples/login/libs/easymob-webim-sdk/strophe-custom-2.0.0.js
function (reason) { this._changeConnectStatus(Strophe.Status.DISCONNECTING, reason); Strophe.info("Disconnect was called because: " + reason); if (this.connected) { var pres = false; this.disconnecting = true; if (this.authenticated) { pres = $pres({ xmlns: Strophe.NS.CLIENT, type: 'unavailable' }); } // setup timeout handler this._disconnectTimeout = this._addSysTimedHandler( 3000, this._onDisconnectTimeout.bind(this)); this._proto._disconnect(pres); } else { Strophe.info("Disconnect was called before Strophe connected to the server"); this._proto._abortAllRequests(); } }
javascript
function (reason) { this._changeConnectStatus(Strophe.Status.DISCONNECTING, reason); Strophe.info("Disconnect was called because: " + reason); if (this.connected) { var pres = false; this.disconnecting = true; if (this.authenticated) { pres = $pres({ xmlns: Strophe.NS.CLIENT, type: 'unavailable' }); } // setup timeout handler this._disconnectTimeout = this._addSysTimedHandler( 3000, this._onDisconnectTimeout.bind(this)); this._proto._disconnect(pres); } else { Strophe.info("Disconnect was called before Strophe connected to the server"); this._proto._abortAllRequests(); } }
[ "function", "(", "reason", ")", "{", "this", ".", "_changeConnectStatus", "(", "Strophe", ".", "Status", ".", "DISCONNECTING", ",", "reason", ")", ";", "Strophe", ".", "info", "(", "\"Disconnect was called because: \"", "+", "reason", ")", ";", "if", "(", "t...
Function: disconnect Start the graceful disconnection process. This function starts the disconnection process. This process starts by sending unavailable presence and sending BOSH body of type terminate. A timeout handler makes sure that disconnection happens even if the BOSH server does not respond. If the Connection object isn't connected, at least tries to abort all pending requests so the connection object won't generate successful requests (which were already opened). The user supplied connection callback will be notified of the progress as this process happens. Parameters: (String) reason - The reason the disconnect is occuring.
[ "Function", ":", "disconnect", "Start", "the", "graceful", "disconnection", "process", "." ]
ff74c90a1671a552f3604b1288bf38a4126312d0
https://github.com/dcloudio/mui/blob/ff74c90a1671a552f3604b1288bf38a4126312d0/examples/login/libs/easymob-webim-sdk/strophe-custom-2.0.0.js#L2694-L2716
train
Disconnects from the server
[ 30522, 3853, 1006, 3114, 1007, 1063, 2023, 1012, 1035, 2689, 8663, 2638, 16649, 29336, 2271, 1006, 2358, 18981, 5369, 1012, 3570, 1012, 12532, 10087, 11873, 1010, 3114, 1007, 1025, 2358, 18981, 5369, 1012, 18558, 1006, 1000, 12532, 10087, 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...
eslint/eslint
lib/rules/no-else-return.js
alwaysReturns
function alwaysReturns(node) { if (node.type === "BlockStatement") { // If we have a BlockStatement, check each consequent body node. return node.body.some(checkForReturnOrIf); } /* * If not a block statement, make sure the consequent isn't a * ReturnStatement or an IfStatement with returns on both paths. */ return checkForReturnOrIf(node); }
javascript
function alwaysReturns(node) { if (node.type === "BlockStatement") { // If we have a BlockStatement, check each consequent body node. return node.body.some(checkForReturnOrIf); } /* * If not a block statement, make sure the consequent isn't a * ReturnStatement or an IfStatement with returns on both paths. */ return checkForReturnOrIf(node); }
[ "function", "alwaysReturns", "(", "node", ")", "{", "if", "(", "node", ".", "type", "===", "\"BlockStatement\"", ")", "{", "// If we have a BlockStatement, check each consequent body node.", "return", "node", ".", "body", ".", "some", "(", "checkForReturnOrIf", ")", ...
Check whether a node returns in every codepath. @param {Node} node The node to be checked @returns {boolean} `true` if it returns on every codepath.
[ "Check", "whether", "a", "node", "returns", "in", "every", "codepath", "." ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/no-else-return.js#L199-L211
train
Check if a node is always returns
[ 30522, 3853, 2467, 13465, 14287, 2015, 1006, 13045, 1007, 1063, 2065, 1006, 13045, 1012, 2828, 1027, 1027, 1027, 1000, 5991, 12259, 3672, 1000, 1007, 1063, 1013, 1013, 2065, 2057, 2031, 1037, 5991, 12259, 3672, 1010, 4638, 2169, 9530, 3366,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/preferences/PreferencesBase.js
_addEventDispatcherImpl
function _addEventDispatcherImpl(proto) { var temp = {}; EventDispatcher.makeEventDispatcher(temp); proto._on_internal = temp.on; proto._off_internal = temp.off; proto.trigger = temp.trigger; }
javascript
function _addEventDispatcherImpl(proto) { var temp = {}; EventDispatcher.makeEventDispatcher(temp); proto._on_internal = temp.on; proto._off_internal = temp.off; proto.trigger = temp.trigger; }
[ "function", "_addEventDispatcherImpl", "(", "proto", ")", "{", "var", "temp", "=", "{", "}", ";", "EventDispatcher", ".", "makeEventDispatcher", "(", "temp", ")", ";", "proto", ".", "_on_internal", "=", "temp", ".", "on", ";", "proto", ".", "_off_internal", ...
Utility for PreferencesSystem & PrefixedPreferencesSystem -- attach EventDispatcher's on()/off() implementation as private _on_internal()/_off_internal() methods, so the custom on()/off() APIs these classes use can leverage EventDispatcher code internally. Also attach the regular public trigger().
[ "Utility", "for", "PreferencesSystem", "&", "PrefixedPreferencesSystem", "--", "attach", "EventDispatcher", "s", "on", "()", "/", "off", "()", "implementation", "as", "private", "_on_internal", "()", "/", "_off_internal", "()", "methods", "so", "the", "custom", "o...
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/preferences/PreferencesBase.js#L1040-L1046
train
Add an event dispatcher implementation to the given proto
[ 30522, 3853, 1035, 5587, 18697, 3372, 10521, 4502, 10649, 11124, 8737, 2140, 1006, 15053, 1007, 1063, 13075, 8915, 8737, 1027, 1063, 1065, 1025, 30524, 8737, 1007, 1025, 15053, 1012, 1035, 2006, 1035, 4722, 1027, 8915, 8737, 1012, 2006, 102...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.commons/src/sap/ui/commons/MenuButton.js
function(oThis, oNewMenu){ var oMenu = oThis.getMenu(); if (oMenu) { oMenu.detachItemSelect(oThis._fItemSelectHandler); } oThis._fItemSelectHandler = onItemSelected.bind(oThis); if (oNewMenu) { oNewMenu.attachItemSelect(oThis._fItemSelectHandler); } }
javascript
function(oThis, oNewMenu){ var oMenu = oThis.getMenu(); if (oMenu) { oMenu.detachItemSelect(oThis._fItemSelectHandler); } oThis._fItemSelectHandler = onItemSelected.bind(oThis); if (oNewMenu) { oNewMenu.attachItemSelect(oThis._fItemSelectHandler); } }
[ "function", "(", "oThis", ",", "oNewMenu", ")", "{", "var", "oMenu", "=", "oThis", ".", "getMenu", "(", ")", ";", "if", "(", "oMenu", ")", "{", "oMenu", ".", "detachItemSelect", "(", "oThis", ".", "_fItemSelectHandler", ")", ";", "}", "oThis", ".", "...
********** Private ********** Detaches the select event handler from the current menu and attaches it to the new menu
[ "**********", "Private", "**********", "Detaches", "the", "select", "event", "handler", "from", "the", "current", "menu", "and", "attaches", "it", "to", "the", "new", "menu" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.commons/src/sap/ui/commons/MenuButton.js#L212-L221
train
Sets the handler to be called when the item is selected
[ 30522, 3853, 1006, 27178, 24158, 1010, 2028, 2860, 3549, 2226, 1007, 1063, 13075, 18168, 2368, 2226, 1027, 27178, 24158, 1012, 2131, 3549, 2226, 1006, 1007, 1025, 2065, 1006, 18168, 2368, 2226, 1007, 1063, 18168, 2368, 2226, 1012, 20010, 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...
ccxt/ccxt
build/transpile.js
createFolderRecursively
function createFolderRecursively (folder) { const parts = folder.split (path.sep) for (let i = 1; i <= parts.length; i++) { createFolder (path.join.apply (null, parts.slice (0, i))) } }
javascript
function createFolderRecursively (folder) { const parts = folder.split (path.sep) for (let i = 1; i <= parts.length; i++) { createFolder (path.join.apply (null, parts.slice (0, i))) } }
[ "function", "createFolderRecursively", "(", "folder", ")", "{", "const", "parts", "=", "folder", ".", "split", "(", "path", ".", "sep", ")", "for", "(", "let", "i", "=", "1", ";", "i", "<=", "parts", ".", "length", ";", "i", "++", ")", "{", "create...
-----------------------------------------------------------------------------
[ "-----------------------------------------------------------------------------" ]
8168069b9180a465532905e225586215e115a565
https://github.com/ccxt/ccxt/blob/8168069b9180a465532905e225586215e115a565/build/transpile.js#L779-L786
train
Create a folder recursively
[ 30522, 3853, 3443, 10371, 28849, 10841, 2869, 14547, 1006, 19622, 1007, 1063, 9530, 3367, 3033, 1027, 19622, 1012, 3975, 1006, 4130, 1012, 19802, 1007, 2005, 1006, 2292, 1045, 1027, 1015, 1025, 1045, 1026, 1027, 3033, 1012, 3091, 1025, 1045...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/extensions/default/InlineTimingFunctionEditor/StepEditor.js
StepCanvas
function StepCanvas(canvas, stepParams, padding) { this.canvas = canvas; this.stepParams = stepParams; this.padding = this.getPadding(padding); // Convert to a cartesian coordinate system with axes from 0 to 1 var ctx = this.canvas.getContext("2d"), p = this.padding; ctx.scale(canvas.width * (1 - p[1] - p[3]), -canvas.height * (1 - p[0] - p[2])); ctx.translate(p[3] / (1 - p[1] - p[3]), (-1 - p[0] / (1 - p[0] - p[2]))); }
javascript
function StepCanvas(canvas, stepParams, padding) { this.canvas = canvas; this.stepParams = stepParams; this.padding = this.getPadding(padding); // Convert to a cartesian coordinate system with axes from 0 to 1 var ctx = this.canvas.getContext("2d"), p = this.padding; ctx.scale(canvas.width * (1 - p[1] - p[3]), -canvas.height * (1 - p[0] - p[2])); ctx.translate(p[3] / (1 - p[1] - p[3]), (-1 - p[0] / (1 - p[0] - p[2]))); }
[ "function", "StepCanvas", "(", "canvas", ",", "stepParams", ",", "padding", ")", "{", "this", ".", "canvas", "=", "canvas", ";", "this", ".", "stepParams", "=", "stepParams", ";", "this", ".", "padding", "=", "this", ".", "getPadding", "(", "padding", ")...
StepCanvas object constructor @param {Element} canvas Inline editor <canvas> element @param {StepParameters} stepParams Associated StepParameters object @param {number|Array.number} padding Element padding
[ "StepCanvas", "object", "constructor" ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/InlineTimingFunctionEditor/StepEditor.js#L62-L73
train
StepCanvas constructor.
[ 30522, 3853, 3357, 9336, 12044, 1006, 10683, 1010, 3357, 28689, 5244, 1010, 11687, 4667, 1007, 1063, 2023, 1012, 10683, 1027, 10683, 1025, 2023, 1012, 3357, 28689, 5244, 1027, 3357, 28689, 5244, 1025, 2023, 1012, 11687, 4667, 1027, 2023, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SeleniumHQ/selenium
third_party/js/mozmill/shared-modules/addons.js
addonsManager_getViews
function addonsManager_getViews(aSpec) { var spec = aSpec || { }; var attribute = spec.attribute; var value = spec.value; return this.getElements({type: "views", subtype: attribute, value: value}); }
javascript
function addonsManager_getViews(aSpec) { var spec = aSpec || { }; var attribute = spec.attribute; var value = spec.value; return this.getElements({type: "views", subtype: attribute, value: value}); }
[ "function", "addonsManager_getViews", "(", "aSpec", ")", "{", "var", "spec", "=", "aSpec", "||", "{", "}", ";", "var", "attribute", "=", "spec", ".", "attribute", ";", "var", "value", "=", "spec", ".", "value", ";", "return", "this", ".", "getElements", ...
///////////////////////////// View section ///////////////////////////// Returns the views which match the filter criteria @param {object} aSpec Information for getting the views matched by the criteria Elements: attribute - DOM attribute of the node [optional - default: ""] value - Value of the DOM attribute [optional - default: ""] @returns Filtered list of views @type {array of ElemBase}
[ "/////////////////////////////", "View", "section", "/////////////////////////////", "Returns", "the", "views", "which", "match", "the", "filter", "criteria" ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/addons.js#L1007-L1013
train
Get all the views
[ 30522, 3853, 5587, 5644, 24805, 4590, 1035, 2131, 8584, 2015, 1006, 2004, 5051, 2278, 1007, 1063, 13075, 28699, 1027, 2004, 5051, 2278, 1064, 1064, 1063, 1065, 1025, 13075, 17961, 1027, 28699, 1012, 17961, 1025, 13075, 3643, 1027, 28699, 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/editor/CodeHintManager.js
_inSession
function _inSession(editor) { if (sessionEditor) { if (sessionEditor === editor && (hintList.isOpen() || (deferredHints && deferredHints.state() === "pending"))) { return true; } else { // the editor has changed _endSession(); } } return false; }
javascript
function _inSession(editor) { if (sessionEditor) { if (sessionEditor === editor && (hintList.isOpen() || (deferredHints && deferredHints.state() === "pending"))) { return true; } else { // the editor has changed _endSession(); } } return false; }
[ "function", "_inSession", "(", "editor", ")", "{", "if", "(", "sessionEditor", ")", "{", "if", "(", "sessionEditor", "===", "editor", "&&", "(", "hintList", ".", "isOpen", "(", ")", "||", "(", "deferredHints", "&&", "deferredHints", ".", "state", "(", ")...
Is there a hinting session active for a given editor? NOTE: the sessionEditor, sessionProvider and hintList objects are only guaranteed to be initialized during an active session. @param {Editor} editor @return boolean
[ "Is", "there", "a", "hinting", "session", "active", "for", "a", "given", "editor?" ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/editor/CodeHintManager.js#L398-L410
train
check if the session editor is in the session
[ 30522, 3853, 1035, 16021, 7971, 3258, 1006, 3559, 1007, 1063, 2065, 1006, 5219, 2098, 15660, 1007, 1063, 2065, 1006, 5219, 2098, 15660, 1027, 1027, 1027, 3559, 1004, 1004, 1006, 9374, 9863, 1012, 11163, 11837, 1006, 1007, 1064, 1064, 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...
GitbookIO/gitbook
lib/utils/images.js
convertSVGToPNG
function convertSVGToPNG(source, dest, options) { if (!fs.existsSync(source)) return Promise.reject(new error.FileNotFoundError({ filename: source })); return command.spawn('svgexport', [source, dest]) .fail(function(err) { if (err.code == 'ENOENT') { err = error.RequireInstallError({ cmd: 'svgexport', install: 'Install it using: "npm install svgexport -g"' }); } throw err; }) .then(function() { if (fs.existsSync(dest)) return; throw new Error('Error converting '+source+' into '+dest); }); }
javascript
function convertSVGToPNG(source, dest, options) { if (!fs.existsSync(source)) return Promise.reject(new error.FileNotFoundError({ filename: source })); return command.spawn('svgexport', [source, dest]) .fail(function(err) { if (err.code == 'ENOENT') { err = error.RequireInstallError({ cmd: 'svgexport', install: 'Install it using: "npm install svgexport -g"' }); } throw err; }) .then(function() { if (fs.existsSync(dest)) return; throw new Error('Error converting '+source+' into '+dest); }); }
[ "function", "convertSVGToPNG", "(", "source", ",", "dest", ",", "options", ")", "{", "if", "(", "!", "fs", ".", "existsSync", "(", "source", ")", ")", "return", "Promise", ".", "reject", "(", "new", "error", ".", "FileNotFoundError", "(", "{", "filename"...
Convert a svg file to a pmg
[ "Convert", "a", "svg", "file", "to", "a", "pmg" ]
6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4
https://github.com/GitbookIO/gitbook/blob/6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4/lib/utils/images.js#L7-L25
train
Convert SVG to PNG
[ 30522, 3853, 19884, 2615, 13512, 7361, 3070, 1006, 3120, 1010, 4078, 2102, 1010, 7047, 1007, 1063, 2065, 1006, 999, 1042, 2015, 1012, 6526, 6508, 12273, 1006, 3120, 1007, 1007, 2709, 4872, 1012, 15454, 1006, 2047, 7561, 1012, 5371, 17048, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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
common/src/web/jquery-1.3.2.js
function( event, data, elem, bubbling ) { // Event object or event type var type = event.type || event; if( !bubbling ){ event = typeof event === "object" ? // jQuery.Event object event[expando] ? event : // Object literal jQuery.extend( jQuery.Event(type), event ) : // Just the event type (string) jQuery.Event(type); if ( type.indexOf("!") >= 0 ) { event.type = type = type.slice(0, -1); event.exclusive = true; } // Handle a global trigger if ( !elem ) { // Don't bubble custom events when global (to avoid too much overhead) event.stopPropagation(); // Only trigger if we've ever bound an event for it if ( this.global[type] ) jQuery.each( jQuery.cache, function(){ if ( this.events && this.events[type] ) jQuery.event.trigger( event, data, this.handle.elem ); }); } // Handle triggering a single element // don't do events on text and comment nodes if ( !elem || elem.nodeType == 3 || elem.nodeType == 8 ) return undefined; // Clean up in case it is reused event.result = undefined; event.target = elem; // Clone the incoming data, if any data = jQuery.makeArray(data); data.unshift( event ); } event.currentTarget = elem; // Trigger the event, it is assumed that "handle" is a function var handle = jQuery.data(elem, "handle"); if ( handle ) handle.apply( elem, data ); // Handle triggering native .onfoo handlers (and on links since we don't call .click() for links) if ( (!elem[type] || (jQuery.nodeName(elem, 'a') && type == "click")) && elem["on"+type] && elem["on"+type].apply( elem, data ) === false ) event.result = false; // Trigger the native events (except for clicks on links) if ( !bubbling && elem[type] && !event.isDefaultPrevented() && !(jQuery.nodeName(elem, 'a') && type == "click") ) { this.triggered = true; try { elem[ type ](); // prevent IE from throwing an error for some hidden elements } catch (e) {} } this.triggered = false; if ( !event.isPropagationStopped() ) { var parent = elem.parentNode || elem.ownerDocument; if ( parent ) jQuery.event.trigger(event, data, parent, true); } }
javascript
function( event, data, elem, bubbling ) { // Event object or event type var type = event.type || event; if( !bubbling ){ event = typeof event === "object" ? // jQuery.Event object event[expando] ? event : // Object literal jQuery.extend( jQuery.Event(type), event ) : // Just the event type (string) jQuery.Event(type); if ( type.indexOf("!") >= 0 ) { event.type = type = type.slice(0, -1); event.exclusive = true; } // Handle a global trigger if ( !elem ) { // Don't bubble custom events when global (to avoid too much overhead) event.stopPropagation(); // Only trigger if we've ever bound an event for it if ( this.global[type] ) jQuery.each( jQuery.cache, function(){ if ( this.events && this.events[type] ) jQuery.event.trigger( event, data, this.handle.elem ); }); } // Handle triggering a single element // don't do events on text and comment nodes if ( !elem || elem.nodeType == 3 || elem.nodeType == 8 ) return undefined; // Clean up in case it is reused event.result = undefined; event.target = elem; // Clone the incoming data, if any data = jQuery.makeArray(data); data.unshift( event ); } event.currentTarget = elem; // Trigger the event, it is assumed that "handle" is a function var handle = jQuery.data(elem, "handle"); if ( handle ) handle.apply( elem, data ); // Handle triggering native .onfoo handlers (and on links since we don't call .click() for links) if ( (!elem[type] || (jQuery.nodeName(elem, 'a') && type == "click")) && elem["on"+type] && elem["on"+type].apply( elem, data ) === false ) event.result = false; // Trigger the native events (except for clicks on links) if ( !bubbling && elem[type] && !event.isDefaultPrevented() && !(jQuery.nodeName(elem, 'a') && type == "click") ) { this.triggered = true; try { elem[ type ](); // prevent IE from throwing an error for some hidden elements } catch (e) {} } this.triggered = false; if ( !event.isPropagationStopped() ) { var parent = elem.parentNode || elem.ownerDocument; if ( parent ) jQuery.event.trigger(event, data, parent, true); } }
[ "function", "(", "event", ",", "data", ",", "elem", ",", "bubbling", ")", "{", "// Event object or event type", "var", "type", "=", "event", ".", "type", "||", "event", ";", "if", "(", "!", "bubbling", ")", "{", "event", "=", "typeof", "event", "===", ...
bubbling is internal
[ "bubbling", "is", "internal" ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/common/src/web/jquery-1.3.2.js#L2591-L2663
train
trigger an event on an element
[ 30522, 3853, 1006, 2724, 1010, 2951, 1010, 3449, 6633, 1010, 25054, 1007, 1063, 1013, 1013, 2724, 4874, 2030, 2724, 2828, 13075, 2828, 1027, 2724, 1012, 2828, 1064, 1064, 2724, 1025, 2065, 1006, 999, 25054, 1007, 1063, 2724, 1027, 2828, 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...