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
SAP/openui5
src/sap.ui.core/src/sap/ui/core/hyphenation/Hyphenation.js
loadScript
function loadScript(sPath, sFilename) { return new Promise(function (resolve, reject) { var script = document.createElement('script'); script.async = true; script.src = sPath + sFilename; script.addEventListener('load', resolve); script.addEventListener('error', function () { return reject('Error loading script: ' + sFilename); }); script.addEventListener('abort', function () { return reject(sFilename + ' Script loading aborted.'); }); document.head.appendChild(script); }); }
javascript
function loadScript(sPath, sFilename) { return new Promise(function (resolve, reject) { var script = document.createElement('script'); script.async = true; script.src = sPath + sFilename; script.addEventListener('load', resolve); script.addEventListener('error', function () { return reject('Error loading script: ' + sFilename); }); script.addEventListener('abort', function () { return reject(sFilename + ' Script loading aborted.'); }); document.head.appendChild(script); }); }
[ "function", "loadScript", "(", "sPath", ",", "sFilename", ")", "{", "return", "new", "Promise", "(", "function", "(", "resolve", ",", "reject", ")", "{", "var", "script", "=", "document", ".", "createElement", "(", "'script'", ")", ";", "script", ".", "a...
Loads a <code>javascript</code> file. @param {string} sPath The root path @param {string} sFilename File to be loaded @returns {Promise} A promise which resolves when the script is loaded @private
[ "Loads", "a", "<code", ">", "javascript<", "/", "code", ">", "file", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/hyphenation/Hyphenation.js#L243-L257
train
Load a script
[ 30522, 3853, 15665, 23235, 1006, 14690, 2232, 1010, 16420, 9463, 18442, 1007, 1063, 2709, 2047, 4872, 1006, 3853, 1006, 10663, 1010, 15454, 1007, 1063, 13075, 5896, 1027, 6254, 1012, 3443, 12260, 3672, 1006, 1005, 5896, 1005, 1007, 1025, 58...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.fl/src/sap/ui/fl/context/ContextManager.js
function (aContextObjects, aRuntimeContextParameters) { var that = this; var aActiveContexts = []; aContextObjects.forEach(function (oContext) { if (that._isContextObjectActive(oContext, aRuntimeContextParameters)) { aActiveContexts.push(oContext.id); } }); return aActiveContexts; }
javascript
function (aContextObjects, aRuntimeContextParameters) { var that = this; var aActiveContexts = []; aContextObjects.forEach(function (oContext) { if (that._isContextObjectActive(oContext, aRuntimeContextParameters)) { aActiveContexts.push(oContext.id); } }); return aActiveContexts; }
[ "function", "(", "aContextObjects", ",", "aRuntimeContextParameters", ")", "{", "var", "that", "=", "this", ";", "var", "aActiveContexts", "=", "[", "]", ";", "aContextObjects", ".", "forEach", "(", "function", "(", "oContext", ")", "{", "if", "(", "that", ...
Function to filter all contexts by the passed runtime context parameters. @param {object[]} aContextObjects - context objects within the application @param {object} aRuntimeContextParameters - map of context keys and their current values @returns {string[]} aActiveContexts - id list of all active contexts
[ "Function", "to", "filter", "all", "contexts", "by", "the", "passed", "runtime", "context", "parameters", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/context/ContextManager.js#L100-L111
train
Returns an array of contexts that are active in the given context objects.
[ 30522, 3853, 1006, 9353, 28040, 18413, 16429, 20614, 2015, 1010, 28217, 7292, 8663, 18209, 28689, 22828, 2015, 1007, 1063, 13075, 2008, 1027, 2023, 1025, 13075, 9779, 15277, 8663, 18209, 2015, 1027, 1031, 1033, 1025, 9353, 28040, 18413, 16429...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
GitbookIO/gitbook
lib/output/website/createTemplateEngine.js
createTemplateEngine
function createTemplateEngine(output, currentFile) { var book = output.getBook(); var state = output.getState(); var i18n = state.getI18n(); var config = book.getConfig(); var summary = book.getSummary(); var outputFolder = output.getRoot(); // Search paths for templates var searchPaths = listSearchPaths(output); var tplSearchPaths = searchPaths.map(templateFolder); // Create loader var loader = new Templating.ThemesLoader(tplSearchPaths); // Get languages var language = config.getValue('language'); // Create API context var context = Api.encodeGlobal(output); /** * Check if a file exists * @param {String} fileName * @return {Boolean} */ function fileExists(fileName) { if (!fileName) { return false; } var filePath = PathUtils.resolveInRoot(outputFolder, fileName); return fs.existsSync(filePath); } /** * Return an article by its path * @param {String} filePath * @return {Object|undefined} */ function getArticleByPath(filePath) { var article = summary.getByPath(filePath); if (!article) return undefined; return JSONUtils.encodeSummaryArticle(article); } /** * Return a page by its path * @param {String} filePath * @return {Object|undefined} */ function getPageByPath(filePath) { var page = output.getPage(filePath); if (!page) return undefined; return JSONUtils.encodePage(page, summary); } return TemplateEngine.create({ loader: loader, context: context, globals: { getArticleByPath: getArticleByPath, getPageByPath: getPageByPath, fileExists: fileExists }, filters: defaultFilters.merge({ /** * Translate a sentence */ t: function t(s) { return i18n.t(language, s); }, /** * Resolve an absolute file path into a * relative path. * it also resolve pages */ resolveFile: function(filePath) { filePath = resolveFileToURL(output, filePath); return LocationUtils.relativeForFile(currentFile, filePath); }, resolveAsset: function(filePath) { filePath = LocationUtils.toAbsolute(filePath, '', ''); filePath = path.join('gitbook', filePath); filePath = LocationUtils.relativeForFile(currentFile, filePath); // Use assets from parent if language book if (book.isLanguageBook()) { filePath = path.join('../', filePath); } return LocationUtils.normalize(filePath); }, fileExists: deprecate.method(book, 'fileExists', fileExists, 'Filter "fileExists" is deprecated, use "fileExists(filename)" '), getArticleByPath: deprecate.method(book, 'getArticleByPath', fileExists, 'Filter "getArticleByPath" is deprecated, use "getArticleByPath(filename)" '), contentURL: function(filePath) { return fileToURL(output, filePath); } }), extensions: { 'DoExtension': new DoExtension() } }); }
javascript
function createTemplateEngine(output, currentFile) { var book = output.getBook(); var state = output.getState(); var i18n = state.getI18n(); var config = book.getConfig(); var summary = book.getSummary(); var outputFolder = output.getRoot(); // Search paths for templates var searchPaths = listSearchPaths(output); var tplSearchPaths = searchPaths.map(templateFolder); // Create loader var loader = new Templating.ThemesLoader(tplSearchPaths); // Get languages var language = config.getValue('language'); // Create API context var context = Api.encodeGlobal(output); /** * Check if a file exists * @param {String} fileName * @return {Boolean} */ function fileExists(fileName) { if (!fileName) { return false; } var filePath = PathUtils.resolveInRoot(outputFolder, fileName); return fs.existsSync(filePath); } /** * Return an article by its path * @param {String} filePath * @return {Object|undefined} */ function getArticleByPath(filePath) { var article = summary.getByPath(filePath); if (!article) return undefined; return JSONUtils.encodeSummaryArticle(article); } /** * Return a page by its path * @param {String} filePath * @return {Object|undefined} */ function getPageByPath(filePath) { var page = output.getPage(filePath); if (!page) return undefined; return JSONUtils.encodePage(page, summary); } return TemplateEngine.create({ loader: loader, context: context, globals: { getArticleByPath: getArticleByPath, getPageByPath: getPageByPath, fileExists: fileExists }, filters: defaultFilters.merge({ /** * Translate a sentence */ t: function t(s) { return i18n.t(language, s); }, /** * Resolve an absolute file path into a * relative path. * it also resolve pages */ resolveFile: function(filePath) { filePath = resolveFileToURL(output, filePath); return LocationUtils.relativeForFile(currentFile, filePath); }, resolveAsset: function(filePath) { filePath = LocationUtils.toAbsolute(filePath, '', ''); filePath = path.join('gitbook', filePath); filePath = LocationUtils.relativeForFile(currentFile, filePath); // Use assets from parent if language book if (book.isLanguageBook()) { filePath = path.join('../', filePath); } return LocationUtils.normalize(filePath); }, fileExists: deprecate.method(book, 'fileExists', fileExists, 'Filter "fileExists" is deprecated, use "fileExists(filename)" '), getArticleByPath: deprecate.method(book, 'getArticleByPath', fileExists, 'Filter "getArticleByPath" is deprecated, use "getArticleByPath(filename)" '), contentURL: function(filePath) { return fileToURL(output, filePath); } }), extensions: { 'DoExtension': new DoExtension() } }); }
[ "function", "createTemplateEngine", "(", "output", ",", "currentFile", ")", "{", "var", "book", "=", "output", ".", "getBook", "(", ")", ";", "var", "state", "=", "output", ".", "getState", "(", ")", ";", "var", "i18n", "=", "state", ".", "getI18n", "(...
Create templating engine to render themes @param {Output} output @param {String} currentFile @return {TemplateEngine}
[ "Create", "templating", "engine", "to", "render", "themes" ]
6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4
https://github.com/GitbookIO/gitbook/blob/6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4/lib/output/website/createTemplateEngine.js#L34-L149
train
Create TemplateEngine
[ 30522, 3853, 3443, 18532, 15725, 13159, 3170, 1006, 6434, 1010, 2783, 8873, 2571, 1007, 1063, 13075, 2338, 1027, 6434, 1012, 2131, 8654, 1006, 1007, 1025, 13075, 2110, 1027, 6434, 1012, 4152, 12259, 1006, 1007, 1025, 13075, 1045, 15136, 207...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SeleniumHQ/selenium
third_party/js/mozmill/shared-modules/search.js
searchBar_getElement
function searchBar_getElement(spec) { var elem = null; switch(spec.type) { /** * subtype: subtype to match * value: value to match */ case "engine": // XXX: bug 555938 - Mozmill can't fetch the element via a lookup here. // That means we have to grab it temporarily by iterating through all childs. var popup = this.getElement({type: "searchBar_dropDownPopup"}).getNode(); for (var ii = 0; ii < popup.childNodes.length; ii++) { var entry = popup.childNodes[ii]; if (entry.getAttribute(spec.subtype) == spec.value) { elem = new elementslib.Elem(entry); break; } } //elem = new elementslib.Lookup(this._controller.window.document, SEARCH_POPUP + // '/anon({"' + spec.subtype + '":"' + spec.value + '"})'); break; case "engine_manager": // XXX: bug 555938 - Mozmill can't fetch the element via a lookup here. // That means we have to grab it temporarily by iterating through all childs. var popup = this.getElement({type: "searchBar_dropDownPopup"}).getNode(); for (var ii = popup.childNodes.length - 1; ii >= 0; ii--) { var entry = popup.childNodes[ii]; if (entry.className == "open-engine-manager") { elem = new elementslib.Elem(entry); break; } } //elem = new elementslib.Lookup(this._controller.window.document, SEARCH_POPUP + // '/anon({"anonid":"open-engine-manager"})'); break; case "searchBar": elem = new elementslib.Lookup(this._controller.window.document, SEARCH_BAR); break; case "searchBar_autoCompletePopup": elem = new elementslib.Lookup(this._controller.window.document, SEARCH_AUTOCOMPLETE); break; case "searchBar_contextMenu": elem = new elementslib.Lookup(this._controller.window.document, SEARCH_CONTEXT); break; case "searchBar_dropDown": elem = new elementslib.Lookup(this._controller.window.document, SEARCH_DROPDOWN); break; case "searchBar_dropDownPopup": elem = new elementslib.Lookup(this._controller.window.document, SEARCH_POPUP); break; case "searchBar_goButton": elem = new elementslib.Lookup(this._controller.window.document, SEARCH_GO_BUTTON); break; case "searchBar_input": elem = new elementslib.Lookup(this._controller.window.document, SEARCH_INPUT); break; case "searchBar_suggestions": elem = new elementslib.Lookup(this._controller.window.document, SEARCH_AUTOCOMPLETE + '/anon({"anonid":"tree"})'); break; case "searchBar_textBox": elem = new elementslib.Lookup(this._controller.window.document, SEARCH_TEXTBOX); break; default: throw new Error(arguments.callee.name + ": Unknown element type - " + spec.type); } return elem; }
javascript
function searchBar_getElement(spec) { var elem = null; switch(spec.type) { /** * subtype: subtype to match * value: value to match */ case "engine": // XXX: bug 555938 - Mozmill can't fetch the element via a lookup here. // That means we have to grab it temporarily by iterating through all childs. var popup = this.getElement({type: "searchBar_dropDownPopup"}).getNode(); for (var ii = 0; ii < popup.childNodes.length; ii++) { var entry = popup.childNodes[ii]; if (entry.getAttribute(spec.subtype) == spec.value) { elem = new elementslib.Elem(entry); break; } } //elem = new elementslib.Lookup(this._controller.window.document, SEARCH_POPUP + // '/anon({"' + spec.subtype + '":"' + spec.value + '"})'); break; case "engine_manager": // XXX: bug 555938 - Mozmill can't fetch the element via a lookup here. // That means we have to grab it temporarily by iterating through all childs. var popup = this.getElement({type: "searchBar_dropDownPopup"}).getNode(); for (var ii = popup.childNodes.length - 1; ii >= 0; ii--) { var entry = popup.childNodes[ii]; if (entry.className == "open-engine-manager") { elem = new elementslib.Elem(entry); break; } } //elem = new elementslib.Lookup(this._controller.window.document, SEARCH_POPUP + // '/anon({"anonid":"open-engine-manager"})'); break; case "searchBar": elem = new elementslib.Lookup(this._controller.window.document, SEARCH_BAR); break; case "searchBar_autoCompletePopup": elem = new elementslib.Lookup(this._controller.window.document, SEARCH_AUTOCOMPLETE); break; case "searchBar_contextMenu": elem = new elementslib.Lookup(this._controller.window.document, SEARCH_CONTEXT); break; case "searchBar_dropDown": elem = new elementslib.Lookup(this._controller.window.document, SEARCH_DROPDOWN); break; case "searchBar_dropDownPopup": elem = new elementslib.Lookup(this._controller.window.document, SEARCH_POPUP); break; case "searchBar_goButton": elem = new elementslib.Lookup(this._controller.window.document, SEARCH_GO_BUTTON); break; case "searchBar_input": elem = new elementslib.Lookup(this._controller.window.document, SEARCH_INPUT); break; case "searchBar_suggestions": elem = new elementslib.Lookup(this._controller.window.document, SEARCH_AUTOCOMPLETE + '/anon({"anonid":"tree"})'); break; case "searchBar_textBox": elem = new elementslib.Lookup(this._controller.window.document, SEARCH_TEXTBOX); break; default: throw new Error(arguments.callee.name + ": Unknown element type - " + spec.type); } return elem; }
[ "function", "searchBar_getElement", "(", "spec", ")", "{", "var", "elem", "=", "null", ";", "switch", "(", "spec", ".", "type", ")", "{", "/**\n * subtype: subtype to match\n * value: value to match\n */", "case", "\"engine\"", ":", "// XXX: bug 555938 -...
Retrieve an UI element based on the given spec @param {object} spec Information of the UI element which should be retrieved type: General type information subtype: Specific element or property value: Value of the element or property @returns Element which has been created @type ElemBase
[ "Retrieve", "an", "UI", "element", "based", "on", "the", "given", "spec" ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/search.js#L600-L669
train
Returns the element that matches the specified specification
[ 30522, 3853, 3945, 8237, 1035, 2131, 12260, 3672, 1006, 28699, 1007, 1063, 13075, 3449, 6633, 1027, 19701, 1025, 6942, 1006, 28699, 1012, 2828, 1007, 1063, 1013, 1008, 1008, 1008, 4942, 13874, 1024, 4942, 13874, 2000, 2674, 1008, 3643, 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...
SAP/openui5
src/sap.ui.core/src/sap/ui/model/odata/_AnnotationHelperExpression.js
function (oPathValue, iIndex, oResult, bWrapExpression) { var oDate; if (oResult.result === "constant") { switch (oResult.category) { case "boolean": case "number": return oResult.value; case "date": oDate = Expression.parseDate(oResult.value); if (!oDate) { Basics.error(Basics.descend(oPathValue, iIndex), "Invalid Date " + oResult.value); } return String(oDate.getTime()); case "datetime": oDate = Expression.parseDateTimeOffset(oResult.value); if (!oDate) { Basics.error(Basics.descend(oPathValue, iIndex), "Invalid DateTime " + oResult.value); } return String(oDate.getTime()); case "time": return String(Expression.parseTimeOfDay(oResult.value).getTime()); // no default } } if (bWrapExpression) { Expression.wrapExpression(oResult); } return Basics.resultToString(oResult, true); }
javascript
function (oPathValue, iIndex, oResult, bWrapExpression) { var oDate; if (oResult.result === "constant") { switch (oResult.category) { case "boolean": case "number": return oResult.value; case "date": oDate = Expression.parseDate(oResult.value); if (!oDate) { Basics.error(Basics.descend(oPathValue, iIndex), "Invalid Date " + oResult.value); } return String(oDate.getTime()); case "datetime": oDate = Expression.parseDateTimeOffset(oResult.value); if (!oDate) { Basics.error(Basics.descend(oPathValue, iIndex), "Invalid DateTime " + oResult.value); } return String(oDate.getTime()); case "time": return String(Expression.parseTimeOfDay(oResult.value).getTime()); // no default } } if (bWrapExpression) { Expression.wrapExpression(oResult); } return Basics.resultToString(oResult, true); }
[ "function", "(", "oPathValue", ",", "iIndex", ",", "oResult", ",", "bWrapExpression", ")", "{", "var", "oDate", ";", "if", "(", "oResult", ".", "result", "===", "\"constant\"", ")", "{", "switch", "(", "oResult", ".", "category", ")", "{", "case", "\"boo...
Formats the result to be an operand for a logical or comparison operator. Handles constants accordingly. @param {object} oPathValue path and value information pointing to the parameters array (for a possible error message, see above) @param {number} iIndex the parameter index (for a possible error message) @param {object} oResult a result object with category @param {boolean} bWrapExpression if true, wrap an expression in <code>oResult</code> with "()" @returns {string} the formatted result
[ "Formats", "the", "result", "to", "be", "an", "operand", "for", "a", "logical", "or", "comparison", "operator", ".", "Handles", "constants", "accordingly", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/_AnnotationHelperExpression.js#L418-L449
train
Returns the value of the given result
[ 30522, 3853, 1006, 6728, 8988, 10175, 5657, 1010, 2462, 13629, 2595, 1010, 10848, 23722, 2102, 1010, 1038, 13088, 24065, 2595, 20110, 3258, 1007, 1063, 13075, 1051, 13701, 1025, 2065, 1006, 10848, 23722, 2102, 1012, 2765, 1027, 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...
jgraph/mxgraph
javascript/mxClient.js
function(state, source, target, hints, result) { // Creates array of all way- and terminalpoints var pts = state.absolutePoints; var tol = Math.max(1, state.view.scale); // Whether the first segment outgoing from the source end is horizontal var lastPushed = (result.length > 0) ? result[0] : null; var horizontal = true; var hint = null; // Adds waypoints only if outside of tolerance function pushPoint(pt) { if (lastPushed == null || Math.abs(lastPushed.x - pt.x) >= tol || Math.abs(lastPushed.y - pt.y) >= tol) { result.push(pt); lastPushed = pt; } return lastPushed; }; // Adds the first point var pt = pts[0]; if (pt == null && source != null) { pt = new mxPoint(state.view.getRoutingCenterX(source), state.view.getRoutingCenterY(source)); } else if (pt != null) { pt = pt.clone(); } pt.x = Math.round(pt.x); pt.y = Math.round(pt.y); var lastInx = pts.length - 1; // Adds the waypoints if (hints != null && hints.length > 0) { // Converts all hints and removes nulls var newHints = []; for (var i = 0; i < hints.length; i++) { var tmp = state.view.transformControlPoint(state, hints[i]); if (tmp != null) { tmp.x = Math.round(tmp.x); tmp.y = Math.round(tmp.y); newHints.push(tmp); } } if (newHints.length == 0) { return; } hints = newHints; // Aligns source and target hint to fixed points if (pt != null && hints[0] != null) { if (Math.abs(hints[0].x - pt.x) < tol) { hints[0].x = pt.x; } if (Math.abs(hints[0].y - pt.y) < tol) { hints[0].y = pt.y; } } var pe = pts[lastInx]; if (pe != null && hints[hints.length - 1] != null) { if (Math.abs(hints[hints.length - 1].x - pe.x) < tol) { hints[hints.length - 1].x = pe.x; } if (Math.abs(hints[hints.length - 1].y - pe.y) < tol) { hints[hints.length - 1].y = pe.y; } } hint = hints[0]; var currentTerm = source; var currentPt = pts[0]; var hozChan = false; var vertChan = false; var currentHint = hint; if (currentPt != null) { currentPt.x = Math.round(currentPt.x); currentPt.y = Math.round(currentPt.y); currentTerm = null; } // Check for alignment with fixed points and with channels // at source and target segments only for (var i = 0; i < 2; i++) { var fixedVertAlign = currentPt != null && currentPt.x == currentHint.x; var fixedHozAlign = currentPt != null && currentPt.y == currentHint.y; var inHozChan = currentTerm != null && (currentHint.y >= currentTerm.y && currentHint.y <= currentTerm.y + currentTerm.height); var inVertChan = currentTerm != null && (currentHint.x >= currentTerm.x && currentHint.x <= currentTerm.x + currentTerm.width); hozChan = fixedHozAlign || (currentPt == null && inHozChan); vertChan = fixedVertAlign || (currentPt == null && inVertChan); // If the current hint falls in both the hor and vert channels in the case // of a floating port, or if the hint is exactly co-incident with a // fixed point, ignore the source and try to work out the orientation // from the target end if (i==0 && ((hozChan && vertChan) || (fixedVertAlign && fixedHozAlign))) { } else { if (currentPt != null && (!fixedHozAlign && !fixedVertAlign) && (inHozChan || inVertChan)) { horizontal = inHozChan ? false : true; break; } if (vertChan || hozChan) { horizontal = hozChan; if (i == 1) { // Work back from target end horizontal = hints.length % 2 == 0 ? hozChan : vertChan; } break; } } currentTerm = target; currentPt = pts[lastInx]; if (currentPt != null) { currentPt.x = Math.round(currentPt.x); currentPt.y = Math.round(currentPt.y); currentTerm = null; } currentHint = hints[hints.length - 1]; if (fixedVertAlign && fixedHozAlign) { hints = hints.slice(1); } } if (horizontal && ((pts[0] != null && pts[0].y != hint.y) || (pts[0] == null && source != null && (hint.y < source.y || hint.y > source.y + source.height)))) { pushPoint(new mxPoint(pt.x, hint.y)); } else if (!horizontal && ((pts[0] != null && pts[0].x != hint.x) || (pts[0] == null && source != null && (hint.x < source.x || hint.x > source.x + source.width)))) { pushPoint(new mxPoint(hint.x, pt.y)); } if (horizontal) { pt.y = hint.y; } else { pt.x = hint.x; } for (var i = 0; i < hints.length; i++) { horizontal = !horizontal; hint = hints[i]; // mxLog.show(); // mxLog.debug('hint', i, hint.x, hint.y); if (horizontal) { pt.y = hint.y; } else { pt.x = hint.x; } pushPoint(pt.clone()); } } else { hint = pt; // FIXME: First click in connect preview toggles orientation horizontal = true; } // Adds the last point pt = pts[lastInx]; if (pt == null && target != null) { pt = new mxPoint(state.view.getRoutingCenterX(target), state.view.getRoutingCenterY(target)); } if (pt != null) { pt.x = Math.round(pt.x); pt.y = Math.round(pt.y); if (hint != null) { if (horizontal && ((pts[lastInx] != null && pts[lastInx].y != hint.y) || (pts[lastInx] == null && target != null && (hint.y < target.y || hint.y > target.y + target.height)))) { pushPoint(new mxPoint(pt.x, hint.y)); } else if (!horizontal && ((pts[lastInx] != null && pts[lastInx].x != hint.x) || (pts[lastInx] == null && target != null && (hint.x < target.x || hint.x > target.x + target.width)))) { pushPoint(new mxPoint(hint.x, pt.y)); } } } // Removes bends inside the source terminal for floating ports if (pts[0] == null && source != null) { while (result.length > 1 && result[1] != null && mxUtils.contains(source, result[1].x, result[1].y)) { result.splice(1, 1); } } // Removes bends inside the target terminal if (pts[lastInx] == null && target != null) { while (result.length > 1 && result[result.length - 1] != null && mxUtils.contains(target, result[result.length - 1].x, result[result.length - 1].y)) { result.splice(result.length - 1, 1); } } // Removes last point if inside tolerance with end point if (pe != null && result[result.length - 1] != null && Math.abs(pe.x - result[result.length - 1].x) < tol && Math.abs(pe.y - result[result.length - 1].y) < tol) { result.splice(result.length - 1, 1); // Lines up second last point in result with end point if (result[result.length - 1] != null) { if (Math.abs(result[result.length - 1].x - pe.x) < tol) { result[result.length - 1].x = pe.x; } if (Math.abs(result[result.length - 1].y - pe.y) < tol) { result[result.length - 1].y = pe.y; } } } }
javascript
function(state, source, target, hints, result) { // Creates array of all way- and terminalpoints var pts = state.absolutePoints; var tol = Math.max(1, state.view.scale); // Whether the first segment outgoing from the source end is horizontal var lastPushed = (result.length > 0) ? result[0] : null; var horizontal = true; var hint = null; // Adds waypoints only if outside of tolerance function pushPoint(pt) { if (lastPushed == null || Math.abs(lastPushed.x - pt.x) >= tol || Math.abs(lastPushed.y - pt.y) >= tol) { result.push(pt); lastPushed = pt; } return lastPushed; }; // Adds the first point var pt = pts[0]; if (pt == null && source != null) { pt = new mxPoint(state.view.getRoutingCenterX(source), state.view.getRoutingCenterY(source)); } else if (pt != null) { pt = pt.clone(); } pt.x = Math.round(pt.x); pt.y = Math.round(pt.y); var lastInx = pts.length - 1; // Adds the waypoints if (hints != null && hints.length > 0) { // Converts all hints and removes nulls var newHints = []; for (var i = 0; i < hints.length; i++) { var tmp = state.view.transformControlPoint(state, hints[i]); if (tmp != null) { tmp.x = Math.round(tmp.x); tmp.y = Math.round(tmp.y); newHints.push(tmp); } } if (newHints.length == 0) { return; } hints = newHints; // Aligns source and target hint to fixed points if (pt != null && hints[0] != null) { if (Math.abs(hints[0].x - pt.x) < tol) { hints[0].x = pt.x; } if (Math.abs(hints[0].y - pt.y) < tol) { hints[0].y = pt.y; } } var pe = pts[lastInx]; if (pe != null && hints[hints.length - 1] != null) { if (Math.abs(hints[hints.length - 1].x - pe.x) < tol) { hints[hints.length - 1].x = pe.x; } if (Math.abs(hints[hints.length - 1].y - pe.y) < tol) { hints[hints.length - 1].y = pe.y; } } hint = hints[0]; var currentTerm = source; var currentPt = pts[0]; var hozChan = false; var vertChan = false; var currentHint = hint; if (currentPt != null) { currentPt.x = Math.round(currentPt.x); currentPt.y = Math.round(currentPt.y); currentTerm = null; } // Check for alignment with fixed points and with channels // at source and target segments only for (var i = 0; i < 2; i++) { var fixedVertAlign = currentPt != null && currentPt.x == currentHint.x; var fixedHozAlign = currentPt != null && currentPt.y == currentHint.y; var inHozChan = currentTerm != null && (currentHint.y >= currentTerm.y && currentHint.y <= currentTerm.y + currentTerm.height); var inVertChan = currentTerm != null && (currentHint.x >= currentTerm.x && currentHint.x <= currentTerm.x + currentTerm.width); hozChan = fixedHozAlign || (currentPt == null && inHozChan); vertChan = fixedVertAlign || (currentPt == null && inVertChan); // If the current hint falls in both the hor and vert channels in the case // of a floating port, or if the hint is exactly co-incident with a // fixed point, ignore the source and try to work out the orientation // from the target end if (i==0 && ((hozChan && vertChan) || (fixedVertAlign && fixedHozAlign))) { } else { if (currentPt != null && (!fixedHozAlign && !fixedVertAlign) && (inHozChan || inVertChan)) { horizontal = inHozChan ? false : true; break; } if (vertChan || hozChan) { horizontal = hozChan; if (i == 1) { // Work back from target end horizontal = hints.length % 2 == 0 ? hozChan : vertChan; } break; } } currentTerm = target; currentPt = pts[lastInx]; if (currentPt != null) { currentPt.x = Math.round(currentPt.x); currentPt.y = Math.round(currentPt.y); currentTerm = null; } currentHint = hints[hints.length - 1]; if (fixedVertAlign && fixedHozAlign) { hints = hints.slice(1); } } if (horizontal && ((pts[0] != null && pts[0].y != hint.y) || (pts[0] == null && source != null && (hint.y < source.y || hint.y > source.y + source.height)))) { pushPoint(new mxPoint(pt.x, hint.y)); } else if (!horizontal && ((pts[0] != null && pts[0].x != hint.x) || (pts[0] == null && source != null && (hint.x < source.x || hint.x > source.x + source.width)))) { pushPoint(new mxPoint(hint.x, pt.y)); } if (horizontal) { pt.y = hint.y; } else { pt.x = hint.x; } for (var i = 0; i < hints.length; i++) { horizontal = !horizontal; hint = hints[i]; // mxLog.show(); // mxLog.debug('hint', i, hint.x, hint.y); if (horizontal) { pt.y = hint.y; } else { pt.x = hint.x; } pushPoint(pt.clone()); } } else { hint = pt; // FIXME: First click in connect preview toggles orientation horizontal = true; } // Adds the last point pt = pts[lastInx]; if (pt == null && target != null) { pt = new mxPoint(state.view.getRoutingCenterX(target), state.view.getRoutingCenterY(target)); } if (pt != null) { pt.x = Math.round(pt.x); pt.y = Math.round(pt.y); if (hint != null) { if (horizontal && ((pts[lastInx] != null && pts[lastInx].y != hint.y) || (pts[lastInx] == null && target != null && (hint.y < target.y || hint.y > target.y + target.height)))) { pushPoint(new mxPoint(pt.x, hint.y)); } else if (!horizontal && ((pts[lastInx] != null && pts[lastInx].x != hint.x) || (pts[lastInx] == null && target != null && (hint.x < target.x || hint.x > target.x + target.width)))) { pushPoint(new mxPoint(hint.x, pt.y)); } } } // Removes bends inside the source terminal for floating ports if (pts[0] == null && source != null) { while (result.length > 1 && result[1] != null && mxUtils.contains(source, result[1].x, result[1].y)) { result.splice(1, 1); } } // Removes bends inside the target terminal if (pts[lastInx] == null && target != null) { while (result.length > 1 && result[result.length - 1] != null && mxUtils.contains(target, result[result.length - 1].x, result[result.length - 1].y)) { result.splice(result.length - 1, 1); } } // Removes last point if inside tolerance with end point if (pe != null && result[result.length - 1] != null && Math.abs(pe.x - result[result.length - 1].x) < tol && Math.abs(pe.y - result[result.length - 1].y) < tol) { result.splice(result.length - 1, 1); // Lines up second last point in result with end point if (result[result.length - 1] != null) { if (Math.abs(result[result.length - 1].x - pe.x) < tol) { result[result.length - 1].x = pe.x; } if (Math.abs(result[result.length - 1].y - pe.y) < tol) { result[result.length - 1].y = pe.y; } } } }
[ "function", "(", "state", ",", "source", ",", "target", ",", "hints", ",", "result", ")", "{", "// Creates array of all way- and terminalpoints", "var", "pts", "=", "state", ".", "absolutePoints", ";", "var", "tol", "=", "Math", ".", "max", "(", "1", ",", ...
Function: SegmentConnector Implements an orthogonal edge style. Use <mxEdgeSegmentHandler> as an interactive handler for this style.
[ "Function", ":", "SegmentConnector" ]
33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44
https://github.com/jgraph/mxgraph/blob/33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44/javascript/mxClient.js#L50004-L50295
train
Adds a point to the end of the source segment
[ 30522, 3853, 1006, 2110, 1010, 3120, 1010, 4539, 1010, 20385, 1010, 2765, 30524, 4098, 1006, 1015, 1010, 2110, 1012, 3193, 1012, 4094, 1007, 1025, 1013, 1013, 3251, 1996, 2034, 6903, 22011, 2013, 1996, 3120, 2203, 2003, 9876, 13075, 2197, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
wangfupeng1988/wangEditor
src/js/text/index.js
function (val) { const editor = this.editor const $textElem = editor.$textElem let html if (val == null) { html = $textElem.html() // 未选中任何内容的时候点击“加粗”或者“斜体”等按钮,就得需要一个空的占位符 &#8203 ,这里替换掉 html = html.replace(/\u200b/gm, '') return html } else { $textElem.html(val) // 初始化选取,将光标定位到内容尾部 editor.initSelection() } }
javascript
function (val) { const editor = this.editor const $textElem = editor.$textElem let html if (val == null) { html = $textElem.html() // 未选中任何内容的时候点击“加粗”或者“斜体”等按钮,就得需要一个空的占位符 &#8203 ,这里替换掉 html = html.replace(/\u200b/gm, '') return html } else { $textElem.html(val) // 初始化选取,将光标定位到内容尾部 editor.initSelection() } }
[ "function", "(", "val", ")", "{", "const", "editor", "=", "this", ".", "editor", "const", "$textElem", "=", "editor", ".", "$textElem", "let", "html", "if", "(", "val", "==", "null", ")", "{", "html", "=", "$textElem", ".", "html", "(", ")", "// 未选中任...
获取 设置 html
[ "获取", "设置", "html" ]
b77696f5e81c8ec13d9d341252d6b9fa8a22db18
https://github.com/wangfupeng1988/wangEditor/blob/b77696f5e81c8ec13d9d341252d6b9fa8a22db18/src/js/text/index.js#L71-L86
train
set the tag
[ 30522, 3853, 1006, 11748, 1007, 1063, 9530, 3367, 3559, 1027, 2023, 1012, 3559, 9530, 3367, 1002, 3793, 12260, 2213, 1027, 3559, 1012, 1002, 3793, 12260, 2213, 2292, 16129, 2065, 1006, 11748, 1027, 1027, 19701, 1007, 1063, 16129, 1027, 1002...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
wuchangming/spy-debugger
buildin_modules/weinre/web/demo/weinre-demo.js
createDatabase_other
function createDatabase_other(tx) { var schema = "clicks_other (id integer primary key, other text)" var sql = "create table if not exists " + schema tx.executeSql(sql, null, null, sqlError); }
javascript
function createDatabase_other(tx) { var schema = "clicks_other (id integer primary key, other text)" var sql = "create table if not exists " + schema tx.executeSql(sql, null, null, sqlError); }
[ "function", "createDatabase_other", "(", "tx", ")", "{", "var", "schema", "=", "\"clicks_other (id integer primary key, other text)\"", "var", "sql", "=", "\"create table if not exists \"", "+", "schema", "tx", ".", "executeSql", "(", "sql", ",", "null", ",", "null", ...
------------------------------------------------------------------------------
[ "------------------------------------------------------------------------------" ]
55c1dda0dff0c44920673711656ddfd7ff03c307
https://github.com/wuchangming/spy-debugger/blob/55c1dda0dff0c44920673711656ddfd7ff03c307/buildin_modules/weinre/web/demo/weinre-demo.js#L154-L159
train
create database other
[ 30522, 3853, 2580, 6790, 15058, 1035, 2060, 1006, 19067, 1007, 1063, 13075, 8040, 28433, 1027, 1000, 30524, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
fex-team/webuploader
dist/webuploader.withoutimage.js
function( file, ret, hds ) { var owner = this.owner; return owner .request( 'after-send-file', arguments, function() { file.setStatus( Status.COMPLETE ); owner.trigger( 'uploadSuccess', file, ret, hds ); }) .fail(function( reason ) { // 如果外部已经标记为invalid什么的,不再改状态。 if ( file.getStatus() === Status.PROGRESS ) { file.setStatus( Status.ERROR, reason ); } owner.trigger( 'uploadError', file, reason ); }) .always(function() { owner.trigger( 'uploadComplete', file ); }); }
javascript
function( file, ret, hds ) { var owner = this.owner; return owner .request( 'after-send-file', arguments, function() { file.setStatus( Status.COMPLETE ); owner.trigger( 'uploadSuccess', file, ret, hds ); }) .fail(function( reason ) { // 如果外部已经标记为invalid什么的,不再改状态。 if ( file.getStatus() === Status.PROGRESS ) { file.setStatus( Status.ERROR, reason ); } owner.trigger( 'uploadError', file, reason ); }) .always(function() { owner.trigger( 'uploadComplete', file ); }); }
[ "function", "(", "file", ",", "ret", ",", "hds", ")", "{", "var", "owner", "=", "this", ".", "owner", ";", "return", "owner", ".", "request", "(", "'after-send-file'", ",", "arguments", ",", "function", "(", ")", "{", "file", ".", "setStatus", "(", "...
完成上传。
[ "完成上传。" ]
7094e4476c5af3b06993d91dde2d223200b9feb7
https://github.com/fex-team/webuploader/blob/7094e4476c5af3b06993d91dde2d223200b9feb7/dist/webuploader.withoutimage.js#L3685-L3705
train
upload success error
[ 30522, 3853, 1006, 5371, 1010, 2128, 2102, 1010, 10751, 2015, 1007, 1063, 13075, 3954, 1027, 2023, 1012, 3954, 1025, 2709, 3954, 1012, 5227, 1006, 1005, 2044, 1011, 4604, 1011, 5371, 1005, 1010, 9918, 1010, 3853, 1006, 1007, 1063, 5371, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getinsomnia/insomnia
packages/insomnia-app/app/ui/components/codemirror/extensions/autocomplete.js
matchSegments
function matchSegments(listOfThings, segment, type, limit = -1) { if (!Array.isArray(listOfThings)) { console.warn('Autocomplete received items in non-list form', listOfThings); return []; } const matches = []; for (const t of listOfThings) { const name = typeof t === 'string' ? t : t.name; const value = typeof t === 'string' ? '' : t.value; const displayName = t.displayName || name; const defaultFill = typeof t === 'string' ? name : getDefaultFill(t.name, t.args); const matchSegment = segment.toLowerCase(); const matchName = displayName.toLowerCase(); // Throw away things that don't match if (!matchName.includes(matchSegment)) { continue; } matches.push({ // Custom Insomnia keys type, segment, comment: value, displayValue: value ? JSON.stringify(value) : '', score: name.length, // In case we want to sort by this // CodeMirror text: defaultFill, displayText: displayName, render: renderHintMatch, hint: replaceHintMatch, }); } if (limit >= 0) { return matches.slice(0, limit); } else { return matches; } }
javascript
function matchSegments(listOfThings, segment, type, limit = -1) { if (!Array.isArray(listOfThings)) { console.warn('Autocomplete received items in non-list form', listOfThings); return []; } const matches = []; for (const t of listOfThings) { const name = typeof t === 'string' ? t : t.name; const value = typeof t === 'string' ? '' : t.value; const displayName = t.displayName || name; const defaultFill = typeof t === 'string' ? name : getDefaultFill(t.name, t.args); const matchSegment = segment.toLowerCase(); const matchName = displayName.toLowerCase(); // Throw away things that don't match if (!matchName.includes(matchSegment)) { continue; } matches.push({ // Custom Insomnia keys type, segment, comment: value, displayValue: value ? JSON.stringify(value) : '', score: name.length, // In case we want to sort by this // CodeMirror text: defaultFill, displayText: displayName, render: renderHintMatch, hint: replaceHintMatch, }); } if (limit >= 0) { return matches.slice(0, limit); } else { return matches; } }
[ "function", "matchSegments", "(", "listOfThings", ",", "segment", ",", "type", ",", "limit", "=", "-", "1", ")", "{", "if", "(", "!", "Array", ".", "isArray", "(", "listOfThings", ")", ")", "{", "console", ".", "warn", "(", "'Autocomplete received items in...
Match against a list of things @param listOfThings - Can be list of strings or list of {name, value} @param segment - segment to match against @param type @param limit @returns {Array}
[ "Match", "against", "a", "list", "of", "things" ]
e24ce7f7b41246e700c4b9bdb6b34b6652ad589b
https://github.com/getinsomnia/insomnia/blob/e24ce7f7b41246e700c4b9bdb6b34b6652ad589b/packages/insomnia-app/app/ui/components/codemirror/extensions/autocomplete.js#L347-L389
train
Match a segment with a list of things
[ 30522, 3853, 2674, 3366, 21693, 11187, 1006, 2862, 15794, 12053, 2015, 1010, 6903, 1010, 2828, 1010, 5787, 1027, 1011, 1015, 1007, 1063, 2065, 1006, 999, 9140, 1012, 18061, 11335, 2100, 1006, 2862, 15794, 12053, 2015, 1007, 1007, 1063, 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/utils/ExtensionUtils.js
addLinkedStyleSheet
function addLinkedStyleSheet(url, deferred) { var attributes = { type: "text/css", rel: "stylesheet", href: url }; var $link = $("<link/>").attr(attributes); if (deferred) { $link.on('load', deferred.resolve).on('error', deferred.reject); } $link.appendTo("head"); return $link[0]; }
javascript
function addLinkedStyleSheet(url, deferred) { var attributes = { type: "text/css", rel: "stylesheet", href: url }; var $link = $("<link/>").attr(attributes); if (deferred) { $link.on('load', deferred.resolve).on('error', deferred.reject); } $link.appendTo("head"); return $link[0]; }
[ "function", "addLinkedStyleSheet", "(", "url", ",", "deferred", ")", "{", "var", "attributes", "=", "{", "type", ":", "\"text/css\"", ",", "rel", ":", "\"stylesheet\"", ",", "href", ":", "url", "}", ";", "var", "$link", "=", "$", "(", "\"<link/>\"", ")",...
Appends a <link> tag to the document's head. @param {!string} url URL to a style sheet @param {$.Deferred=} deferred Optionally check for load and error events @return {!HTMLLinkElement} The generated HTML node
[ "Appends", "a", "<link", ">", "tag", "to", "the", "document", "s", "head", "." ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/utils/ExtensionUtils.js#L55-L71
train
Add a linked stylesheet to the page
[ 30522, 3853, 5587, 13767, 2098, 21756, 4244, 21030, 2102, 1006, 24471, 2140, 1010, 13366, 28849, 2094, 1007, 1063, 13075, 12332, 1027, 1063, 2828, 1024, 1000, 3793, 1013, 20116, 2015, 1000, 1010, 2128, 2140, 1024, 1000, 6782, 21030, 2102, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/extensions/default/QuickView/main.js
normalizeGradientExpressionForQuickview
function normalizeGradientExpressionForQuickview(expression) { if (expression.indexOf("px") > 0) { var paramStart = expression.indexOf("(") + 1, paramEnd = expression.lastIndexOf(")"), parameters = expression.substring(paramStart, paramEnd), params = splitStyleProperty(parameters), lowerBound = 0, upperBound = $previewContainer.width(), args, thisSize, i; // find lower bound for (i = 0; i < params.length; i++) { args = params[i].split(" "); if (hasLengthInPixels(args)) { thisSize = parseFloat(args[1]); upperBound = Math.max(upperBound, thisSize); // we really only care about converting negative // pixel values -- so take the smallest negative pixel // value and use that as baseline for display purposes if (thisSize < 0) { lowerBound = Math.min(lowerBound, thisSize); } } } // convert negative lower bound to positive and adjust all pixel values // so that -20px is now 0px and 100px is now 120px lowerBound = Math.abs(lowerBound); // Offset the upperbound by the lowerBound to give us a corrected context upperBound += lowerBound; // convert to % for (i = 0; i < params.length; i++) { args = params[i].split(" "); if (isGradientColorStop(args) && hasLengthInPixels(args)) { if (upperBound === 0) { thisSize = 0; } else { thisSize = ((parseFloat(args[1]) + lowerBound) / upperBound) * 100; } args[1] = thisSize + "%"; } params[i] = args.join(" "); } // put it back together. expression = expression.substring(0, paramStart) + params.join(", ") + expression.substring(paramEnd); } return expression; }
javascript
function normalizeGradientExpressionForQuickview(expression) { if (expression.indexOf("px") > 0) { var paramStart = expression.indexOf("(") + 1, paramEnd = expression.lastIndexOf(")"), parameters = expression.substring(paramStart, paramEnd), params = splitStyleProperty(parameters), lowerBound = 0, upperBound = $previewContainer.width(), args, thisSize, i; // find lower bound for (i = 0; i < params.length; i++) { args = params[i].split(" "); if (hasLengthInPixels(args)) { thisSize = parseFloat(args[1]); upperBound = Math.max(upperBound, thisSize); // we really only care about converting negative // pixel values -- so take the smallest negative pixel // value and use that as baseline for display purposes if (thisSize < 0) { lowerBound = Math.min(lowerBound, thisSize); } } } // convert negative lower bound to positive and adjust all pixel values // so that -20px is now 0px and 100px is now 120px lowerBound = Math.abs(lowerBound); // Offset the upperbound by the lowerBound to give us a corrected context upperBound += lowerBound; // convert to % for (i = 0; i < params.length; i++) { args = params[i].split(" "); if (isGradientColorStop(args) && hasLengthInPixels(args)) { if (upperBound === 0) { thisSize = 0; } else { thisSize = ((parseFloat(args[1]) + lowerBound) / upperBound) * 100; } args[1] = thisSize + "%"; } params[i] = args.join(" "); } // put it back together. expression = expression.substring(0, paramStart) + params.join(", ") + expression.substring(paramEnd); } return expression; }
[ "function", "normalizeGradientExpressionForQuickview", "(", "expression", ")", "{", "if", "(", "expression", ".", "indexOf", "(", "\"px\"", ")", ">", "0", ")", "{", "var", "paramStart", "=", "expression", ".", "indexOf", "(", "\"(\"", ")", "+", "1", ",", "...
Normalizes px color stops to %
[ "Normalizes", "px", "color", "stops", "to", "%" ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/QuickView/main.js#L335-L389
train
Normalizes a gradient expression for quickview
[ 30522, 3853, 3671, 4697, 16307, 25099, 2595, 20110, 3258, 29278, 15549, 3600, 8584, 1006, 3670, 1007, 1063, 2065, 1006, 3670, 1012, 5950, 11253, 1006, 1000, 1052, 2595, 1000, 1007, 1028, 1014, 1007, 1063, 13075, 11498, 5244, 7559, 2102, 102...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/model/odata/_AnnotationHelperBasics.js
function (oPathValue, sMessage, sComponent) { sMessage = oPathValue.path + ": " + sMessage; Log.error(sMessage, Basics.toErrorString(oPathValue.value), sComponent || sAnnotationHelper); throw new SyntaxError(sMessage); }
javascript
function (oPathValue, sMessage, sComponent) { sMessage = oPathValue.path + ": " + sMessage; Log.error(sMessage, Basics.toErrorString(oPathValue.value), sComponent || sAnnotationHelper); throw new SyntaxError(sMessage); }
[ "function", "(", "oPathValue", ",", "sMessage", ",", "sComponent", ")", "{", "sMessage", "=", "oPathValue", ".", "path", "+", "\": \"", "+", "sMessage", ";", "Log", ".", "error", "(", "sMessage", ",", "Basics", ".", "toErrorString", "(", "oPathValue", ".",...
Logs the error message for the given path and throws a SyntaxError. @param {object} oPathValue a path/value pair @param {string} sMessage the message to log @param {string} [sComponent="sap.ui.model.odata.AnnotationHelper"] Name of the component that produced the log entry
[ "Logs", "the", "error", "message", "for", "the", "given", "path", "and", "throws", "a", "SyntaxError", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/_AnnotationHelperBasics.js#L91-L96
train
Log an error and throw an error
[ 30522, 3853, 1006, 6728, 8988, 10175, 5657, 1010, 15488, 7971, 4270, 1010, 8040, 25377, 5643, 3372, 1007, 1063, 15488, 7971, 4270, 1027, 6728, 8988, 10175, 5657, 1012, 4130, 1009, 1000, 1024, 1000, 1009, 15488, 7971, 4270, 1025, 8833, 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...
muaz-khan/RecordRTC
RecordRTC.js
isElectron
function isElectron() { // Renderer process if (typeof window !== 'undefined' && typeof window.process === 'object' && window.process.type === 'renderer') { return true; } // Main process if (typeof process !== 'undefined' && typeof process.versions === 'object' && !!process.versions.electron) { return true; } // Detect the user agent when the `nodeIntegration` option is set to true if (typeof navigator === 'object' && typeof navigator.userAgent === 'string' && navigator.userAgent.indexOf('Electron') >= 0) { return true; } return false; }
javascript
function isElectron() { // Renderer process if (typeof window !== 'undefined' && typeof window.process === 'object' && window.process.type === 'renderer') { return true; } // Main process if (typeof process !== 'undefined' && typeof process.versions === 'object' && !!process.versions.electron) { return true; } // Detect the user agent when the `nodeIntegration` option is set to true if (typeof navigator === 'object' && typeof navigator.userAgent === 'string' && navigator.userAgent.indexOf('Electron') >= 0) { return true; } return false; }
[ "function", "isElectron", "(", ")", "{", "// Renderer process", "if", "(", "typeof", "window", "!==", "'undefined'", "&&", "typeof", "window", ".", "process", "===", "'object'", "&&", "window", ".", "process", ".", "type", "===", "'renderer'", ")", "{", "ret...
from: https://github.com/cheton/is-electron/blob/master/index.js
[ "from", ":", "https", ":", "//", "github", ".", "com", "/", "cheton", "/", "is", "-", "electron", "/", "blob", "/", "master", "/", "index", ".", "js" ]
3c6bad427b9da35c1cf617199ed13dda056c38ba
https://github.com/muaz-khan/RecordRTC/blob/3c6bad427b9da35c1cf617199ed13dda056c38ba/RecordRTC.js#L1842-L1859
train
Detect if the current environment is Electron
[ 30522, 3853, 2003, 12260, 6593, 4948, 1006, 1007, 1063, 1013, 1013, 17552, 2121, 2832, 2065, 1006, 2828, 11253, 3332, 999, 1027, 1027, 1005, 6151, 28344, 1005, 1004, 1004, 2828, 11253, 3332, 1012, 2832, 1027, 1027, 1027, 1005, 30524, 11253,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
angular/material
src/core/services/interimElement/interimElement.js
setDefaults
function setDefaults(definition) { providerConfig.optionsFactory = definition.options; providerConfig.methods = (definition.methods || []).concat(EXPOSED_METHODS); return provider; }
javascript
function setDefaults(definition) { providerConfig.optionsFactory = definition.options; providerConfig.methods = (definition.methods || []).concat(EXPOSED_METHODS); return provider; }
[ "function", "setDefaults", "(", "definition", ")", "{", "providerConfig", ".", "optionsFactory", "=", "definition", ".", "options", ";", "providerConfig", ".", "methods", "=", "(", "definition", ".", "methods", "||", "[", "]", ")", ".", "concat", "(", "EXPOS...
Save the configured defaults to be used when the factory is instantiated
[ "Save", "the", "configured", "defaults", "to", "be", "used", "when", "the", "factory", "is", "instantiated" ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/services/interimElement/interimElement.js#L65-L69
train
set the default values for the provider
[ 30522, 3853, 2275, 3207, 7011, 11314, 2015, 1006, 6210, 1007, 1063, 10802, 8663, 8873, 2290, 1012, 7047, 21450, 1027, 6210, 1012, 7047, 1025, 10802, 8663, 8873, 2290, 1012, 4725, 1027, 1006, 6210, 1012, 4725, 1064, 1064, 1031, 1033, 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...
moleculerjs/moleculer
src/serializers/proto/packets.proto.js
PacketInfo
function PacketInfo(properties) { this.ipList = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]]; }
javascript
function PacketInfo(properties) { this.ipList = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]]; }
[ "function", "PacketInfo", "(", "properties", ")", "{", "this", ".", "ipList", "=", "[", "]", ";", "if", "(", "properties", ")", "for", "(", "var", "keys", "=", "Object", ".", "keys", "(", "properties", ")", ",", "i", "=", "0", ";", "i", "<", "key...
Properties of a PacketInfo. @memberof packets @interface IPacketInfo @property {string} ver PacketInfo ver @property {string} sender PacketInfo sender @property {string} services PacketInfo services @property {string} config PacketInfo config @property {Array.<string>|null} [ipList] PacketInfo ipList @property {string} hostname PacketInfo hostname @property {packets.PacketInfo.IClient} client PacketInfo client @property {number|null} [seq] PacketInfo seq Constructs a new PacketInfo. @memberof packets @classdesc Represents a PacketInfo. @implements IPacketInfo @constructor @param {packets.IPacketInfo=} [properties] Properties to set
[ "Properties", "of", "a", "PacketInfo", "." ]
f95aadc2d61b0d0e3c643a43c3ed28bca6425cde
https://github.com/moleculerjs/moleculer/blob/f95aadc2d61b0d0e3c643a43c3ed28bca6425cde/src/serializers/proto/packets.proto.js#L1361-L1367
train
Properties of a PacketInfo.
[ 30522, 3853, 14771, 2378, 14876, 1006, 5144, 1007, 1063, 2023, 1012, 12997, 9863, 1027, 1031, 1033, 1025, 2065, 1006, 5144, 1007, 2005, 1006, 13075, 6309, 1027, 4874, 1012, 6309, 1006, 5144, 1007, 1010, 1045, 1027, 1014, 1025, 1045, 1026, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
electron/electron
lib/browser/guest-window-manager.js
function (child, parent, visited) { // Check for circular reference. if (visited == null) visited = new Set() if (visited.has(parent)) return visited.add(parent) for (const key in parent) { if (key === 'isBrowserView') continue if (!hasProp.call(parent, key)) continue if (key in child && key !== 'webPreferences') continue const value = parent[key] if (typeof value === 'object') { child[key] = mergeOptions(child[key] || {}, value, visited) } else { child[key] = value } } visited.delete(parent) return child }
javascript
function (child, parent, visited) { // Check for circular reference. if (visited == null) visited = new Set() if (visited.has(parent)) return visited.add(parent) for (const key in parent) { if (key === 'isBrowserView') continue if (!hasProp.call(parent, key)) continue if (key in child && key !== 'webPreferences') continue const value = parent[key] if (typeof value === 'object') { child[key] = mergeOptions(child[key] || {}, value, visited) } else { child[key] = value } } visited.delete(parent) return child }
[ "function", "(", "child", ",", "parent", ",", "visited", ")", "{", "// Check for circular reference.", "if", "(", "visited", "==", "null", ")", "visited", "=", "new", "Set", "(", ")", "if", "(", "visited", ".", "has", "(", "parent", ")", ")", "return", ...
Copy attribute of |parent| to |child| if it is not defined in |child|.
[ "Copy", "attribute", "of", "|parent|", "to", "|child|", "if", "it", "is", "not", "defined", "in", "|child|", "." ]
6e29611788277729647acf465f10db1ea6f15788
https://github.com/electron/electron/blob/6e29611788277729647acf465f10db1ea6f15788/lib/browser/guest-window-manager.js#L24-L45
train
Merge child with parent
[ 30522, 3853, 1006, 2775, 1010, 6687, 1010, 4716, 1007, 1063, 1013, 1013, 4638, 2005, 8206, 4431, 1012, 2065, 1006, 4716, 1027, 1027, 19701, 1007, 30524, 2065, 1006, 4716, 1012, 2038, 1006, 6687, 1007, 1007, 2709, 4716, 1012, 5587, 1006, 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...
ecomfe/zrender
src/core/PathProxy.js
function () { var data = this.data; if (data instanceof Array) { data.length = this._len; if (hasTypedArray) { this.data = new Float32Array(data); } } }
javascript
function () { var data = this.data; if (data instanceof Array) { data.length = this._len; if (hasTypedArray) { this.data = new Float32Array(data); } } }
[ "function", "(", ")", "{", "var", "data", "=", "this", ".", "data", ";", "if", "(", "data", "instanceof", "Array", ")", "{", "data", ".", "length", "=", "this", ".", "_len", ";", "if", "(", "hasTypedArray", ")", "{", "this", ".", "data", "=", "ne...
转成静态的 Float32Array 减少堆内存占用 Convert dynamic array to static Float32Array
[ "转成静态的", "Float32Array", "减少堆内存占用", "Convert", "dynamic", "array", "to", "static", "Float32Array" ]
30321b57cba3149c30eacb0c1e18276f0f001b9f
https://github.com/ecomfe/zrender/blob/30321b57cba3149c30eacb0c1e18276f0f001b9f/src/core/PathProxy.js#L553-L561
train
Aliquate de código de a sequenz
[ 30522, 3853, 1006, 1007, 1063, 13075, 2951, 1027, 2023, 1012, 2951, 1025, 2065, 1006, 2951, 6013, 11253, 9140, 1007, 1063, 2951, 1012, 3091, 1027, 2023, 1012, 1035, 18798, 1025, 2065, 1006, 27151, 5669, 2906, 9447, 1007, 1063, 2023, 1012, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
facebook/relay
packages/relay-runtime/handlers/connection/RelayConnectionHandler.js
deleteNode
function deleteNode(record: RecordProxy, nodeID: DataID): void { const {EDGES, NODE} = RelayConnectionInterface.get(); const edges = record.getLinkedRecords(EDGES); if (!edges) { return; } let nextEdges; for (let ii = 0; ii < edges.length; ii++) { const edge = edges[ii]; const node = edge && edge.getLinkedRecord(NODE); if (node != null && node.getDataID() === nodeID) { if (nextEdges === undefined) { nextEdges = edges.slice(0, ii); } } else if (nextEdges !== undefined) { nextEdges.push(edge); } } if (nextEdges !== undefined) { record.setLinkedRecords(nextEdges, EDGES); } }
javascript
function deleteNode(record: RecordProxy, nodeID: DataID): void { const {EDGES, NODE} = RelayConnectionInterface.get(); const edges = record.getLinkedRecords(EDGES); if (!edges) { return; } let nextEdges; for (let ii = 0; ii < edges.length; ii++) { const edge = edges[ii]; const node = edge && edge.getLinkedRecord(NODE); if (node != null && node.getDataID() === nodeID) { if (nextEdges === undefined) { nextEdges = edges.slice(0, ii); } } else if (nextEdges !== undefined) { nextEdges.push(edge); } } if (nextEdges !== undefined) { record.setLinkedRecords(nextEdges, EDGES); } }
[ "function", "deleteNode", "(", "record", ":", "RecordProxy", ",", "nodeID", ":", "DataID", ")", ":", "void", "{", "const", "{", "EDGES", ",", "NODE", "}", "=", "RelayConnectionInterface", ".", "get", "(", ")", ";", "const", "edges", "=", "record", ".", ...
@public Remove any edges whose `node.id` matches the given id.
[ "@public" ]
7fb9be5182b9650637d7b92ead9a42713ac30aa4
https://github.com/facebook/relay/blob/7fb9be5182b9650637d7b92ead9a42713ac30aa4/packages/relay-runtime/handlers/connection/RelayConnectionHandler.js#L431-L453
train
Delete a node from a record
[ 30522, 3853, 3972, 12870, 3630, 3207, 1006, 2501, 1024, 2501, 21572, 18037, 1010, 13045, 3593, 1024, 2951, 3593, 1007, 1024, 11675, 1063, 9530, 3367, 1063, 7926, 1010, 13045, 1065, 1027, 8846, 8663, 2638, 7542, 18447, 2121, 12172, 1012, 213...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
badges/shields
services/pypi/pypi-helpers.js
parseClassifiers
function parseClassifiers(parsedData, pattern) { const results = [] for (let i = 0; i < parsedData.info.classifiers.length; i++) { const matched = pattern.exec(parsedData.info.classifiers[i]) if (matched && matched[1]) { results.push(matched[1].toLowerCase()) } } return results }
javascript
function parseClassifiers(parsedData, pattern) { const results = [] for (let i = 0; i < parsedData.info.classifiers.length; i++) { const matched = pattern.exec(parsedData.info.classifiers[i]) if (matched && matched[1]) { results.push(matched[1].toLowerCase()) } } return results }
[ "function", "parseClassifiers", "(", "parsedData", ",", "pattern", ")", "{", "const", "results", "=", "[", "]", "for", "(", "let", "i", "=", "0", ";", "i", "<", "parsedData", ".", "info", ".", "classifiers", ".", "length", ";", "i", "++", ")", "{", ...
Extract classifiers from a pypi json response based on a regex.
[ "Extract", "classifiers", "from", "a", "pypi", "json", "response", "based", "on", "a", "regex", "." ]
283601423f3d1a19aae83bf62032d40683948636
https://github.com/badges/shields/blob/283601423f3d1a19aae83bf62032d40683948636/services/pypi/pypi-helpers.js#L42-L51
train
Parse classifier from parsed data
[ 30522, 3853, 11968, 3366, 26266, 28295, 1006, 11968, 6924, 2850, 2696, 1010, 5418, 1007, 1063, 9530, 3367, 3463, 1027, 1031, 1033, 2005, 1006, 2292, 1045, 1027, 1014, 1025, 1045, 1026, 11968, 6924, 2850, 2696, 1012, 18558, 1012, 2465, 28295...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
firebase/firebaseui-web
buildtools/country_data/get_directory_args.js
assertIsDirectory
function assertIsDirectory(path) { try { if (!fs.lstatSync(path).isDirectory()) { console.log('Path "' + path + '" is not a directory.'); process.exit(); } } catch (e) { console.log('Directory "' + path + '" could not be found.'); process.exit(); } }
javascript
function assertIsDirectory(path) { try { if (!fs.lstatSync(path).isDirectory()) { console.log('Path "' + path + '" is not a directory.'); process.exit(); } } catch (e) { console.log('Directory "' + path + '" could not be found.'); process.exit(); } }
[ "function", "assertIsDirectory", "(", "path", ")", "{", "try", "{", "if", "(", "!", "fs", ".", "lstatSync", "(", "path", ")", ".", "isDirectory", "(", ")", ")", "{", "console", ".", "log", "(", "'Path \"'", "+", "path", "+", "'\" is not a directory.'", ...
Asserts that the given path points to a directory and exits otherwise. @param {string} path
[ "Asserts", "that", "the", "given", "path", "points", "to", "a", "directory", "and", "exits", "otherwise", "." ]
c10aa51e38aeb38dc63baa22b48cd6690c2be087
https://github.com/firebase/firebaseui-web/blob/c10aa51e38aeb38dc63baa22b48cd6690c2be087/buildtools/country_data/get_directory_args.js#L26-L36
train
Assert that the path is a directory
[ 30522, 3853, 20865, 2483, 4305, 2890, 16761, 2100, 1006, 4130, 1007, 1063, 3046, 1063, 2065, 1006, 999, 1042, 2015, 1012, 1048, 9153, 3215, 6038, 2278, 1006, 4130, 1007, 1012, 2003, 4305, 2890, 16761, 2100, 1006, 1007, 1007, 1063, 10122, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
Freeboard/freeboard
js/freeboard.thirdparty.js
function(date) { if (!date) { return null; } date.setHours(date.getHours() > 12 ? date.getHours() + 2 : 0); return date; }
javascript
function(date) { if (!date) { return null; } date.setHours(date.getHours() > 12 ? date.getHours() + 2 : 0); return date; }
[ "function", "(", "date", ")", "{", "if", "(", "!", "date", ")", "{", "return", "null", ";", "}", "date", ".", "setHours", "(", "date", ".", "getHours", "(", ")", ">", "12", "?", "date", ".", "getHours", "(", ")", "+", "2", ":", "0", ")", ";",...
/* Handle switch to/from daylight saving. Hours may be non-zero on daylight saving cut-over: > 12 when midnight changeover, but then cannot generate midnight datetime, so jump to 1AM, otherwise reset. @param date (Date) the date to check @return (Date) the corrected date
[ "/", "*", "Handle", "switch", "to", "/", "from", "daylight", "saving", ".", "Hours", "may", "be", "non", "-", "zero", "on", "daylight", "saving", "cut", "-", "over", ":", ">", "12", "when", "midnight", "changeover", "but", "then", "cannot", "generate", ...
38789f6e8bd3d04f7d3b2c3427e509d00f2610fc
https://github.com/Freeboard/freeboard/blob/38789f6e8bd3d04f7d3b2c3427e509d00f2610fc/js/freeboard.thirdparty.js#L9124-L9130
train
Returns the date of the last day of the week
[ 30522, 3853, 1006, 3058, 1007, 1063, 2065, 1006, 999, 3058, 1007, 1063, 2709, 19701, 1025, 1065, 3058, 1012, 6662, 22957, 1006, 3058, 1012, 2131, 6806, 9236, 1006, 1007, 1028, 2260, 1029, 3058, 1012, 2131, 6806, 9236, 1006, 1007, 1009, 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/angular
tools/npm/check-node-modules.js
checkNodeModules
function checkNodeModules(logOutput, purgeIfStale) { var yarnCheck = childProcess.spawnSync( 'yarn check --integrity', {shell: true, cwd: path.resolve(__dirname, '../..')}); var nodeModulesOK = yarnCheck.status === 0; if (nodeModulesOK) { if (logOutput) console.log(':-) npm dependencies are looking good!'); } else { if (logOutput) console.error(':-( npm dependencies are stale or in an in unknown state!'); if (purgeIfStale) { if (logOutput) console.log(' purging...'); _deleteDir(path.join(PROJECT_ROOT, 'node_modules')); } } return nodeModulesOK; }
javascript
function checkNodeModules(logOutput, purgeIfStale) { var yarnCheck = childProcess.spawnSync( 'yarn check --integrity', {shell: true, cwd: path.resolve(__dirname, '../..')}); var nodeModulesOK = yarnCheck.status === 0; if (nodeModulesOK) { if (logOutput) console.log(':-) npm dependencies are looking good!'); } else { if (logOutput) console.error(':-( npm dependencies are stale or in an in unknown state!'); if (purgeIfStale) { if (logOutput) console.log(' purging...'); _deleteDir(path.join(PROJECT_ROOT, 'node_modules')); } } return nodeModulesOK; }
[ "function", "checkNodeModules", "(", "logOutput", ",", "purgeIfStale", ")", "{", "var", "yarnCheck", "=", "childProcess", ".", "spawnSync", "(", "'yarn check --integrity'", ",", "{", "shell", ":", "true", ",", "cwd", ":", "path", ".", "resolve", "(", "__dirnam...
tslint:disable:no-console
[ "tslint", ":", "disable", ":", "no", "-", "console" ]
c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c
https://github.com/angular/angular/blob/c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c/tools/npm/check-node-modules.js#L18-L34
train
Check if node_modules are looking good
[ 30522, 3853, 4638, 3630, 3207, 5302, 8566, 4244, 1006, 8154, 4904, 18780, 1010, 24694, 10128, 9153, 2571, 1007, 1063, 13075, 27158, 5403, 3600, 1027, 2775, 21572, 9623, 2015, 1012, 25645, 6508, 12273, 1006, 1005, 27158, 4638, 1011, 1011, 11...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
angular/material
src/components/icon/js/iconService.js
findRegisteredFontSet
function findRegisteredFontSet(alias) { var useDefault = angular.isUndefined(alias) || !(alias && alias.length); if (useDefault) { return config.defaultFontSet; } var result = alias; angular.forEach(config.fontSets, function(fontSet) { if (fontSet.alias === alias) { result = fontSet.fontSet || result; } }); return result; }
javascript
function findRegisteredFontSet(alias) { var useDefault = angular.isUndefined(alias) || !(alias && alias.length); if (useDefault) { return config.defaultFontSet; } var result = alias; angular.forEach(config.fontSets, function(fontSet) { if (fontSet.alias === alias) { result = fontSet.fontSet || result; } }); return result; }
[ "function", "findRegisteredFontSet", "(", "alias", ")", "{", "var", "useDefault", "=", "angular", ".", "isUndefined", "(", "alias", ")", "||", "!", "(", "alias", "&&", "alias", ".", "length", ")", ";", "if", "(", "useDefault", ")", "{", "return", "config...
Lookup a registered fontSet style using its alias. @param {string} alias used to lookup the alias in the array of fontSets @returns {*} matching fontSet or the defaultFontSet if that alias does not match
[ "Lookup", "a", "registered", "fontSet", "style", "using", "its", "alias", "." ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/icon/js/iconService.js#L459-L473
train
Find the registered fontSet
[ 30522, 3853, 2424, 2890, 24063, 6850, 14876, 7666, 3388, 1006, 14593, 1007, 1063, 13075, 2109, 12879, 23505, 1027, 16108, 1012, 2003, 8630, 28344, 1006, 14593, 1007, 1064, 1064, 999, 1006, 14593, 1004, 1004, 14593, 1012, 3091, 1007, 1025, 2...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.demokit/src/sap/ui/demokit/js/highlight-query-terms.js
markText
function markText(node, expr, classes) { /* Names of Element nodes whose children must not be visited */ var rtags = /object|embed|script|select|textarea/i; function replace(node) { var text = node.nodeValue, p = node.parentNode, start = 0, match,span; while ( (match = expr.exec(text)) != null ) { // add a new text node with the string before the match if ( start < match.index ) { p.insertBefore(document.createTextNode(text.slice(start, match.index)), node); } // add a span for the match span = document.createElement("span"); span.appendChild(document.createTextNode(match[0])); span.className = classes[match[0].toLowerCase()]; p.insertBefore(span, node); // robustness: should a non-empty search term result in an empty match, then exit the loop if ( start <= expr.lastindex ) { break; } // continue search after current match start = expr.lastIndex; } // if there was any match, then reduce the text of original text node // to the substring after the last match (might be empty) if ( start > 0 ) { node.nodeValue = text.slice(start); } } function visit(node) { if (node.nodeType == 3) { // Node.TEXT_NODE replace(node); } else if ( !rtags.test(node.nodeName) ) { // skip 'critical' nodes for (node = node.firstChild; node; node = node.nextSibling) { visit(node); } } } visit(node); }
javascript
function markText(node, expr, classes) { /* Names of Element nodes whose children must not be visited */ var rtags = /object|embed|script|select|textarea/i; function replace(node) { var text = node.nodeValue, p = node.parentNode, start = 0, match,span; while ( (match = expr.exec(text)) != null ) { // add a new text node with the string before the match if ( start < match.index ) { p.insertBefore(document.createTextNode(text.slice(start, match.index)), node); } // add a span for the match span = document.createElement("span"); span.appendChild(document.createTextNode(match[0])); span.className = classes[match[0].toLowerCase()]; p.insertBefore(span, node); // robustness: should a non-empty search term result in an empty match, then exit the loop if ( start <= expr.lastindex ) { break; } // continue search after current match start = expr.lastIndex; } // if there was any match, then reduce the text of original text node // to the substring after the last match (might be empty) if ( start > 0 ) { node.nodeValue = text.slice(start); } } function visit(node) { if (node.nodeType == 3) { // Node.TEXT_NODE replace(node); } else if ( !rtags.test(node.nodeName) ) { // skip 'critical' nodes for (node = node.firstChild; node; node = node.nextSibling) { visit(node); } } } visit(node); }
[ "function", "markText", "(", "node", ",", "expr", ",", "classes", ")", "{", "/* Names of Element nodes whose children must not be visited */", "var", "rtags", "=", "/", "object|embed|script|select|textarea", "/", "i", ";", "function", "replace", "(", "node", ")", "{",...
/* Loops over all text nodes in the given subtree and searches for text fragments that match the given RegExp. Each match is wrapped in its own span and the span is given the class corresponding to the match.
[ "/", "*", "Loops", "over", "all", "text", "nodes", "in", "the", "given", "subtree", "and", "searches", "for", "text", "fragments", "that", "match", "the", "given", "RegExp", ".", "Each", "match", "is", "wrapped", "in", "its", "own", "span", "and", "the",...
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.demokit/src/sap/ui/demokit/js/highlight-query-terms.js#L76-L127
train
Mark text nodes
[ 30522, 3853, 2928, 18209, 1006, 13045, 1010, 4654, 18098, 1010, 4280, 1007, 1063, 1013, 1008, 3415, 1997, 5783, 14164, 3005, 2336, 2442, 2025, 2022, 4716, 1008, 1013, 13075, 19387, 26454, 1027, 1013, 4874, 1064, 7861, 8270, 1064, 5896, 1064...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.dt/src/sap/ui/dt/ContextMenuControl.js
function (iIndex) { this.setProperty("buttons", this.getProperty("buttons").splice(iIndex, 1)); this.getFlexbox(true).removeItem(iIndex); return this.getFlexbox(false).removeItem(iIndex); }
javascript
function (iIndex) { this.setProperty("buttons", this.getProperty("buttons").splice(iIndex, 1)); this.getFlexbox(true).removeItem(iIndex); return this.getFlexbox(false).removeItem(iIndex); }
[ "function", "(", "iIndex", ")", "{", "this", ".", "setProperty", "(", "\"buttons\"", ",", "this", ".", "getProperty", "(", "\"buttons\"", ")", ".", "splice", "(", "iIndex", ",", "1", ")", ")", ";", "this", ".", "getFlexbox", "(", "true", ")", ".", "r...
Removes a button from the ContextMenu. @param {int} iIndex the button to remove or its index or id @return {sap.m.OverflowToolbarButton} The removed button or null @public
[ "Removes", "a", "button", "from", "the", "ContextMenu", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.dt/src/sap/ui/dt/ContextMenuControl.js#L642-L646
train
Removes the button at the given index from the toolbar
[ 30522, 3853, 1006, 2462, 13629, 2595, 1007, 1063, 2023, 1012, 2275, 21572, 4842, 3723, 1006, 1000, 11287, 1000, 1010, 2023, 1012, 2131, 21572, 4842, 3723, 1006, 1000, 11287, 1000, 1007, 1012, 11867, 13231, 1006, 2462, 13629, 2595, 1010, 101...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
aframevr/aframe
src/systems/material.js
function (material) { delete this.materials[material.uuid]; // If any textures on this material are no longer in use, dispose of them. var textureCounts = this.textureCounts; Object.keys(material) .filter(function (propName) { return material[propName] && material[propName].isTexture; }) .forEach(function (mapName) { textureCounts[material[mapName].uuid]--; if (textureCounts[material[mapName].uuid] <= 0) { material[mapName].dispose(); } }); }
javascript
function (material) { delete this.materials[material.uuid]; // If any textures on this material are no longer in use, dispose of them. var textureCounts = this.textureCounts; Object.keys(material) .filter(function (propName) { return material[propName] && material[propName].isTexture; }) .forEach(function (mapName) { textureCounts[material[mapName].uuid]--; if (textureCounts[material[mapName].uuid] <= 0) { material[mapName].dispose(); } }); }
[ "function", "(", "material", ")", "{", "delete", "this", ".", "materials", "[", "material", ".", "uuid", "]", ";", "// If any textures on this material are no longer in use, dispose of them.", "var", "textureCounts", "=", "this", ".", "textureCounts", ";", "Object", "...
Stop tracking material, and dispose of any textures not being used by another material component. @param {object} material
[ "Stop", "tracking", "material", "and", "dispose", "of", "any", "textures", "not", "being", "used", "by", "another", "material", "component", "." ]
24acc78a7299a4cdfe3ef617f4d40ddf6275c992
https://github.com/aframevr/aframe/blob/24acc78a7299a4cdfe3ef617f4d40ddf6275c992/src/systems/material.js#L207-L222
train
Remove material from cache
[ 30522, 3853, 1006, 3430, 1007, 1063, 3972, 12870, 2023, 1012, 4475, 1031, 3430, 1012, 1057, 21272, 1033, 1025, 1013, 1013, 2065, 2151, 29343, 2006, 2023, 3430, 2024, 2053, 2936, 1999, 2224, 1010, 27764, 1997, 2068, 1012, 13075, 14902, 3597,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
sparksuite/simplemde-markdown-editor
src/js/simplemde.js
extend
function extend(target) { for(var i = 1; i < arguments.length; i++) { target = _mergeProperties(target, arguments[i]); } return target; }
javascript
function extend(target) { for(var i = 1; i < arguments.length; i++) { target = _mergeProperties(target, arguments[i]); } return target; }
[ "function", "extend", "(", "target", ")", "{", "for", "(", "var", "i", "=", "1", ";", "i", "<", "arguments", ".", "length", ";", "i", "++", ")", "{", "target", "=", "_mergeProperties", "(", "target", ",", "arguments", "[", "i", "]", ")", ";", "}"...
Merge an arbitrary number of objects into one.
[ "Merge", "an", "arbitrary", "number", "of", "objects", "into", "one", "." ]
6abda7ab68cc20f4aca870eb243747951b90ab04
https://github.com/sparksuite/simplemde-markdown-editor/blob/6abda7ab68cc20f4aca870eb243747951b90ab04/src/js/simplemde.js#L1045-L1051
train
Extend target with the properties of the first argument
[ 30522, 3853, 7949, 1006, 4539, 1007, 1063, 2005, 1006, 13075, 1045, 1027, 1015, 1025, 1045, 1026, 9918, 1012, 3091, 1025, 1045, 1009, 1009, 1007, 1063, 4539, 1027, 1035, 13590, 21572, 4842, 7368, 1006, 4539, 1010, 9918, 1031, 1045, 1033, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
airbnb/enzyme
packages/enzyme/src/ShallowWrapper.js
filterWhereUnwrapped
function filterWhereUnwrapped(wrapper, predicate) { return wrapper.wrap(wrapper.getNodesInternal().filter(predicate).filter(Boolean)); }
javascript
function filterWhereUnwrapped(wrapper, predicate) { return wrapper.wrap(wrapper.getNodesInternal().filter(predicate).filter(Boolean)); }
[ "function", "filterWhereUnwrapped", "(", "wrapper", ",", "predicate", ")", "{", "return", "wrapper", ".", "wrap", "(", "wrapper", ".", "getNodesInternal", "(", ")", ".", "filter", "(", "predicate", ")", ".", "filter", "(", "Boolean", ")", ")", ";", "}" ]
Returns a new wrapper instance with only the nodes of the current wrapper instance that match the provided predicate function. @param {ShallowWrapper} wrapper @param {Function} predicate @returns {ShallowWrapper}
[ "Returns", "a", "new", "wrapper", "instance", "with", "only", "the", "nodes", "of", "the", "current", "wrapper", "instance", "that", "match", "the", "provided", "predicate", "function", "." ]
cd430eae95eba151f17e970ee77c18f09476de0e
https://github.com/airbnb/enzyme/blob/cd430eae95eba151f17e970ee77c18f09476de0e/packages/enzyme/src/ShallowWrapper.js#L71-L73
train
Filter nodes by predicate.
[ 30522, 3853, 11307, 2860, 5886, 13765, 2078, 13088, 29098, 2098, 1006, 10236, 4842, 1010, 3653, 16467, 1007, 1063, 2709, 10236, 4842, 1012, 10236, 1006, 10236, 4842, 1012, 2131, 3630, 6155, 18447, 11795, 2389, 1006, 1007, 1012, 11307, 1006, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
angular/material
src/components/autocomplete/js/autocompleteController.js
configureWatchers
function configureWatchers () { var wait = parseInt($scope.delay, 10) || 0; $attrs.$observe('disabled', function (value) { ctrl.isDisabled = $mdUtil.parseAttributeBoolean(value, false); }); $attrs.$observe('required', function (value) { ctrl.isRequired = $mdUtil.parseAttributeBoolean(value, false); }); $attrs.$observe('readonly', function (value) { ctrl.isReadonly = $mdUtil.parseAttributeBoolean(value, false); }); $scope.$watch('searchText', wait ? $mdUtil.debounce(handleSearchText, wait) : handleSearchText); $scope.$watch('selectedItem', selectedItemChange); angular.element($window).on('resize', debouncedOnResize); $scope.$on('$destroy', cleanup); }
javascript
function configureWatchers () { var wait = parseInt($scope.delay, 10) || 0; $attrs.$observe('disabled', function (value) { ctrl.isDisabled = $mdUtil.parseAttributeBoolean(value, false); }); $attrs.$observe('required', function (value) { ctrl.isRequired = $mdUtil.parseAttributeBoolean(value, false); }); $attrs.$observe('readonly', function (value) { ctrl.isReadonly = $mdUtil.parseAttributeBoolean(value, false); }); $scope.$watch('searchText', wait ? $mdUtil.debounce(handleSearchText, wait) : handleSearchText); $scope.$watch('selectedItem', selectedItemChange); angular.element($window).on('resize', debouncedOnResize); $scope.$on('$destroy', cleanup); }
[ "function", "configureWatchers", "(", ")", "{", "var", "wait", "=", "parseInt", "(", "$scope", ".", "delay", ",", "10", ")", "||", "0", ";", "$attrs", ".", "$observe", "(", "'disabled'", ",", "function", "(", "value", ")", "{", "ctrl", ".", "isDisabled...
Sets up any watchers used by autocomplete
[ "Sets", "up", "any", "watchers", "used", "by", "autocomplete" ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/autocomplete/js/autocompleteController.js#L236-L249
train
Configure watchers
[ 30522, 3853, 9530, 8873, 27390, 7974, 4017, 21844, 1006, 1007, 1063, 13075, 3524, 1027, 11968, 20240, 3372, 1006, 1002, 9531, 1012, 8536, 1010, 2184, 1007, 1064, 1064, 1014, 1025, 1002, 2012, 16344, 2015, 1012, 1002, 11949, 1006, 1005, 9776...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
angular/material
src/core/util/util.js
function(nodes) { nodes = nodes || []; var results = []; for (var i = 0; i < nodes.length; ++i) { results.push(nodes.item(i)); } return results; }
javascript
function(nodes) { nodes = nodes || []; var results = []; for (var i = 0; i < nodes.length; ++i) { results.push(nodes.item(i)); } return results; }
[ "function", "(", "nodes", ")", "{", "nodes", "=", "nodes", "||", "[", "]", ";", "var", "results", "=", "[", "]", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "nodes", ".", "length", ";", "++", "i", ")", "{", "results", ".", "push", ...
Annoying method to copy nodes to an array, thanks to IE
[ "Annoying", "method", "to", "copy", "nodes", "to", "an", "array", "thanks", "to", "IE" ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/util/util.js#L144-L152
train
Returns an array of the result of the query
[ 30522, 3853, 1006, 14164, 1007, 1063, 14164, 1027, 14164, 1064, 1064, 1031, 1033, 1025, 13075, 3463, 1027, 1031, 1033, 1025, 2005, 1006, 13075, 1045, 1027, 1014, 1025, 1045, 1026, 14164, 1012, 3091, 1025, 1009, 1009, 1045, 1007, 1063, 3463,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/JSUtils/ScopeManager.js
TernModule
function TernModule() { var ternPromise = null, addFilesPromise = null, rootTernDir = null, projectRoot = null, stopAddingFiles = false, resolvedFiles = {}, // file -> resolved file numInitialFiles = 0, numResolvedFiles = 0, numAddedFiles = 0, _ternNodeDomain = null; /** * @param {string} file a relative path * @return {string} returns the path we resolved when we tried to parse the file, or undefined */ function getResolvedPath(file) { return resolvedFiles[file]; } /** * Determine whether the current set of files are using modules to pull in * additional files. * * @return {boolean} - true if more files than the current directory have * been read in. */ function usingModules() { return numInitialFiles !== numResolvedFiles; } /** * Send a message to the tern node domain - if the module is being initialized, * the message will not be posted until initialization is complete */ function postMessage(msg) { addFilesPromise.done(function (ternModule) { // If an error came up during file handling, bail out now if (!_ternNodeDomain) { return; } if (config.debug) { console.debug("Sending message", msg); } _ternNodeDomain.exec("invokeTernCommand", msg); }); } /** * Send a message to the tern node domain - this is only for messages that * need to be sent before and while the addFilesPromise is being resolved. */ function _postMessageByPass(msg) { ternPromise.done(function (ternModule) { if (config.debug) { console.debug("Sending message", msg); } _ternNodeDomain.exec("invokeTernCommand", msg); }); } /** * Update tern with the new contents of a given file. * * @param {Document} document - the document to update * @return {jQuery.Promise} - the promise for the request */ function updateTernFile(document) { var path = document.file.fullPath; _postMessageByPass({ type : MessageIds.TERN_UPDATE_FILE_MSG, path : path, text : getTextFromDocument(document) }); return addPendingRequest(path, OFFSET_ZERO, MessageIds.TERN_UPDATE_FILE_MSG); } /** * Handle a request from the tern node domain for text of a file * * @param {{file:string}} request - the request from the tern node domain. Should be an Object containing the name * of the file tern wants the contents of */ function handleTernGetFile(request) { function replyWith(name, txt) { _postMessageByPass({ type: MessageIds.TERN_GET_FILE_MSG, file: name, text: txt }); } var name = request.file; /** * Helper function to get the text of a given document and send it to tern. * If DocumentManager successfully gets the file's text then we'll send it to the tern node domain. * The Promise for getDocumentText() is returned so that custom fail functions can be used. * * @param {string} filePath - the path of the file to get the text of * @return {jQuery.Promise} - the Promise returned from DocumentMangaer.getDocumentText() */ function getDocText(filePath) { if (!FileSystem.isAbsolutePath(filePath) || // don't handle URLs filePath.slice(0, 2) === "//") { // don't handle protocol-relative URLs like //example.com/main.js (see #10566) return (new $.Deferred()).reject().promise(); } var file = FileSystem.getFileForPath(filePath), promise = DocumentManager.getDocumentText(file); promise.done(function (docText) { resolvedFiles[name] = filePath; numResolvedFiles++; replyWith(name, filterText(docText)); }); return promise; } /** * Helper function to find any files in the project that end with the * name we are looking for. This is so we can find requirejs modules * when the baseUrl is unknown, or when the project root is not the same * as the script root (e.g. if you open the 'brackets' dir instead of 'brackets/src' dir). */ function findNameInProject() { // check for any files in project that end with the right path. var fileName = name.substring(name.lastIndexOf("/") + 1); function _fileFilter(entry) { return entry.name === fileName; } ProjectManager.getAllFiles(_fileFilter).done(function (files) { var file; files = files.filter(function (file) { var pos = file.fullPath.length - name.length; return pos === file.fullPath.lastIndexOf(name); }); if (files.length === 1) { file = files[0]; } if (file) { getDocText(file.fullPath).fail(function () { replyWith(name, ""); }); } else { replyWith(name, ""); } }); } if (!isFileExcludedInternal(name)) { getDocText(name).fail(function () { getDocText(rootTernDir + name).fail(function () { // check relative to project root getDocText(projectRoot + name) // last look for any files that end with the right path // in the project .fail(findNameInProject); }); }); } } /** * Prime the pump for a fast first lookup. * * @param {string} path - full path of file * @return {jQuery.Promise} - the promise for the request */ function primePump(path, isUntitledDoc) { _postMessageByPass({ type : MessageIds.TERN_PRIME_PUMP_MSG, path : path, isUntitledDoc : isUntitledDoc }); return addPendingRequest(path, OFFSET_ZERO, MessageIds.TERN_PRIME_PUMP_MSG); } /** * Handle the response from the tern node domain when * it responds to the prime pump message. * * @param {{path: string, type: string}} response - the response from node domain */ function handlePrimePumpCompletion(response) { var path = response.path, type = response.type, $deferredHints = getPendingRequest(path, OFFSET_ZERO, type); if ($deferredHints) { $deferredHints.resolve(); } } /** * Add new files to tern, keeping any previous files. * The tern server must be initialized before making * this call. * * @param {Array.<string>} files - array of file to add to tern. * @return {boolean} - true if more files may be added, false if maximum has been reached. */ function addFilesToTern(files) { // limit the number of files added to tern. var maxFileCount = preferences.getMaxFileCount(); if (numResolvedFiles + numAddedFiles < maxFileCount) { var available = maxFileCount - numResolvedFiles - numAddedFiles; if (available < files.length) { files = files.slice(0, available); } numAddedFiles += files.length; ternPromise.done(function (ternModule) { var msg = { type : MessageIds.TERN_ADD_FILES_MSG, files : files }; if (config.debug) { console.debug("Sending message", msg); } _ternNodeDomain.exec("invokeTernCommand", msg); }); } else { stopAddingFiles = true; } return stopAddingFiles; } /** * Add the files in the directory and subdirectories of a given directory * to tern. * * @param {string} dir - the root directory to add. * @param {function ()} doneCallback - called when all files have been * added to tern. */ function addAllFilesAndSubdirectories(dir, doneCallback) { FileSystem.resolve(dir, function (err, directory) { function visitor(entry) { if (entry.isFile) { if (!isFileExcluded(entry)) { // ignore .dotfiles and non-.js files addFilesToTern([entry.fullPath]); } } else { return !isDirectoryExcluded(entry.fullPath) && entry.name.indexOf(".") !== 0 && !stopAddingFiles; } } if (err) { return; } if (dir === FileSystem.getDirectoryForPath(rootTernDir)) { doneCallback(); return; } directory.visit(visitor, doneCallback); }); } /** * Init the Tern module that does all the code hinting work. */ function initTernModule() { var moduleDeferred = $.Deferred(); ternPromise = moduleDeferred.promise(); function prepareTern() { _ternNodeDomain.exec("setInterface", { messageIds : MessageIds }); _ternNodeDomain.exec("invokeTernCommand", { type: MessageIds.SET_CONFIG, config: config }); moduleDeferred.resolveWith(null, [_ternNodeDomain]); } if (_ternNodeDomain) { _ternNodeDomain.exec("resetTernServer"); moduleDeferred.resolveWith(null, [_ternNodeDomain]); } else { _ternNodeDomain = new NodeDomain("TernNodeDomain", _domainPath); _ternNodeDomain.on("data", function (evt, data) { if (config.debug) { console.log("Message received", data.type); } var response = data, type = response.type; if (type === MessageIds.TERN_COMPLETIONS_MSG || type === MessageIds.TERN_CALLED_FUNC_TYPE_MSG) { // handle any completions the tern server calculated handleTernCompletions(response); } else if (type === MessageIds.TERN_GET_FILE_MSG) { // handle a request for the contents of a file handleTernGetFile(response); } else if (type === MessageIds.TERN_JUMPTODEF_MSG) { handleJumptoDef(response); } else if (type === MessageIds.TERN_SCOPEDATA_MSG) { handleScopeData(response); } else if (type === MessageIds.TERN_REFS) { handleRename(response); } else if (type === MessageIds.TERN_PRIME_PUMP_MSG) { handlePrimePumpCompletion(response); } else if (type === MessageIds.TERN_GET_GUESSES_MSG) { handleGetGuesses(response); } else if (type === MessageIds.TERN_UPDATE_FILE_MSG) { handleUpdateFile(response); } else if (type === MessageIds.TERN_INFERENCE_TIMEDOUT) { handleTimedOut(response); } else if (type === MessageIds.TERN_WORKER_READY) { moduleDeferred.resolveWith(null, [_ternNodeDomain]); } else if (type === "RE_INIT_TERN") { // Ensure the request is because of a node restart if (currentModule) { prepareTern(); // Mark the module with resetForced, then creation of TernModule will // happen again as part of '_maybeReset' call currentModule.resetForced = true; } } else { console.log("Tern Module: " + (response.log || response)); } }); _ternNodeDomain.promise().done(prepareTern); } } /** * Create a new tern server. */ function initTernServer(dir, files) { initTernModule(); numResolvedFiles = 0; numAddedFiles = 0; stopAddingFiles = false; numInitialFiles = files.length; ternPromise.done(function (ternModule) { var msg = { type : MessageIds.TERN_INIT_MSG, dir : dir, files : files, env : ternEnvironment, timeout : PreferencesManager.get("jscodehints.inferenceTimeout") }; _ternNodeDomain.exec("invokeTernCommand", msg); }); rootTernDir = dir + "/"; } /** * We can skip tern initialization if we are opening a file that has * already been added to tern. * * @param {string} newFile - full path of new file being opened in the editor. * @return {boolean} - true if tern initialization should be skipped, * false otherwise. */ function canSkipTernInitialization(newFile) { return resolvedFiles[newFile] !== undefined; } /** * Do the work to initialize a code hinting session. * * @param {Session} session - the active hinting session (TODO: currently unused) * @param {!Document} document - the document the editor has changed to * @param {?Document} previousDocument - the document the editor has changed from */ function doEditorChange(session, document, previousDocument) { var file = document.file, path = file.fullPath, dir = file.parentPath, pr; var addFilesDeferred = $.Deferred(); documentChanges = null; addFilesPromise = addFilesDeferred.promise(); pr = ProjectManager.getProjectRoot() ? ProjectManager.getProjectRoot().fullPath : null; // avoid re-initializing tern if possible. if (canSkipTernInitialization(path)) { // update the previous document in tern to prevent stale files. if (isDocumentDirty && previousDocument) { var updateFilePromise = updateTernFile(previousDocument); updateFilePromise.done(function () { primePump(path, document.isUntitled()); addFilesDeferred.resolveWith(null, [_ternNodeDomain]); }); } else { addFilesDeferred.resolveWith(null, [_ternNodeDomain]); } isDocumentDirty = false; return; } if (previousDocument && previousDocument.isDirty) { updateTernFile(previousDocument); } isDocumentDirty = false; resolvedFiles = {}; projectRoot = pr; ensurePreferences(); deferredPreferences.done(function () { if (file instanceof InMemoryFile) { initTernServer(pr, []); var hintsPromise = primePump(path, true); hintsPromise.done(function () { addFilesDeferred.resolveWith(null, [_ternNodeDomain]); }); return; } FileSystem.resolve(dir, function (err, directory) { if (err) { console.error("Error resolving", dir); addFilesDeferred.resolveWith(null); return; } directory.getContents(function (err, contents) { if (err) { console.error("Error getting contents for", directory); addFilesDeferred.resolveWith(null); return; } var files = contents .filter(function (entry) { return entry.isFile && !isFileExcluded(entry); }) .map(function (entry) { return entry.fullPath; }); initTernServer(dir, files); var hintsPromise = primePump(path, false); hintsPromise.done(function () { if (!usingModules()) { // Read the subdirectories of the new file's directory. // Read them first in case there are too many files to // read in the project. addAllFilesAndSubdirectories(dir, function () { // If the file is in the project root, then read // all the files under the project root. var currentDir = (dir + "/"); if (projectRoot && currentDir !== projectRoot && currentDir.indexOf(projectRoot) === 0) { addAllFilesAndSubdirectories(projectRoot, function () { // prime the pump again but this time don't wait // for completion. primePump(path, false); addFilesDeferred.resolveWith(null, [_ternNodeDomain]); }); } else { addFilesDeferred.resolveWith(null, [_ternNodeDomain]); } }); } else { addFilesDeferred.resolveWith(null, [_ternNodeDomain]); } }); }); }); }); } /** * Called each time a new editor becomes active. * * @param {Session} session - the active hinting session (TODO: currently unused by doEditorChange()) * @param {!Document} document - the document of the editor that has changed * @param {?Document} previousDocument - the document of the editor is changing from */ function handleEditorChange(session, document, previousDocument) { if (addFilesPromise === null) { doEditorChange(session, document, previousDocument); } else { addFilesPromise.done(function () { doEditorChange(session, document, previousDocument); }); } } /** * Do some cleanup when a project is closed. * * We can clean up the node tern server we use to calculate hints now, since * we know we will need to re-init it in any new project that is opened. */ function resetModule() { function resetTernServer() { if (_ternNodeDomain.ready()) { _ternNodeDomain.exec('resetTernServer'); } } if (_ternNodeDomain) { if (addFilesPromise) { // If we're in the middle of added files, don't reset // until we're done addFilesPromise.done(resetTernServer).fail(resetTernServer); } else { resetTernServer(); } } } function whenReady(func) { addFilesPromise.done(func); } this.resetModule = resetModule; this.handleEditorChange = handleEditorChange; this.postMessage = postMessage; this.getResolvedPath = getResolvedPath; this.whenReady = whenReady; return this; }
javascript
function TernModule() { var ternPromise = null, addFilesPromise = null, rootTernDir = null, projectRoot = null, stopAddingFiles = false, resolvedFiles = {}, // file -> resolved file numInitialFiles = 0, numResolvedFiles = 0, numAddedFiles = 0, _ternNodeDomain = null; /** * @param {string} file a relative path * @return {string} returns the path we resolved when we tried to parse the file, or undefined */ function getResolvedPath(file) { return resolvedFiles[file]; } /** * Determine whether the current set of files are using modules to pull in * additional files. * * @return {boolean} - true if more files than the current directory have * been read in. */ function usingModules() { return numInitialFiles !== numResolvedFiles; } /** * Send a message to the tern node domain - if the module is being initialized, * the message will not be posted until initialization is complete */ function postMessage(msg) { addFilesPromise.done(function (ternModule) { // If an error came up during file handling, bail out now if (!_ternNodeDomain) { return; } if (config.debug) { console.debug("Sending message", msg); } _ternNodeDomain.exec("invokeTernCommand", msg); }); } /** * Send a message to the tern node domain - this is only for messages that * need to be sent before and while the addFilesPromise is being resolved. */ function _postMessageByPass(msg) { ternPromise.done(function (ternModule) { if (config.debug) { console.debug("Sending message", msg); } _ternNodeDomain.exec("invokeTernCommand", msg); }); } /** * Update tern with the new contents of a given file. * * @param {Document} document - the document to update * @return {jQuery.Promise} - the promise for the request */ function updateTernFile(document) { var path = document.file.fullPath; _postMessageByPass({ type : MessageIds.TERN_UPDATE_FILE_MSG, path : path, text : getTextFromDocument(document) }); return addPendingRequest(path, OFFSET_ZERO, MessageIds.TERN_UPDATE_FILE_MSG); } /** * Handle a request from the tern node domain for text of a file * * @param {{file:string}} request - the request from the tern node domain. Should be an Object containing the name * of the file tern wants the contents of */ function handleTernGetFile(request) { function replyWith(name, txt) { _postMessageByPass({ type: MessageIds.TERN_GET_FILE_MSG, file: name, text: txt }); } var name = request.file; /** * Helper function to get the text of a given document and send it to tern. * If DocumentManager successfully gets the file's text then we'll send it to the tern node domain. * The Promise for getDocumentText() is returned so that custom fail functions can be used. * * @param {string} filePath - the path of the file to get the text of * @return {jQuery.Promise} - the Promise returned from DocumentMangaer.getDocumentText() */ function getDocText(filePath) { if (!FileSystem.isAbsolutePath(filePath) || // don't handle URLs filePath.slice(0, 2) === "//") { // don't handle protocol-relative URLs like //example.com/main.js (see #10566) return (new $.Deferred()).reject().promise(); } var file = FileSystem.getFileForPath(filePath), promise = DocumentManager.getDocumentText(file); promise.done(function (docText) { resolvedFiles[name] = filePath; numResolvedFiles++; replyWith(name, filterText(docText)); }); return promise; } /** * Helper function to find any files in the project that end with the * name we are looking for. This is so we can find requirejs modules * when the baseUrl is unknown, or when the project root is not the same * as the script root (e.g. if you open the 'brackets' dir instead of 'brackets/src' dir). */ function findNameInProject() { // check for any files in project that end with the right path. var fileName = name.substring(name.lastIndexOf("/") + 1); function _fileFilter(entry) { return entry.name === fileName; } ProjectManager.getAllFiles(_fileFilter).done(function (files) { var file; files = files.filter(function (file) { var pos = file.fullPath.length - name.length; return pos === file.fullPath.lastIndexOf(name); }); if (files.length === 1) { file = files[0]; } if (file) { getDocText(file.fullPath).fail(function () { replyWith(name, ""); }); } else { replyWith(name, ""); } }); } if (!isFileExcludedInternal(name)) { getDocText(name).fail(function () { getDocText(rootTernDir + name).fail(function () { // check relative to project root getDocText(projectRoot + name) // last look for any files that end with the right path // in the project .fail(findNameInProject); }); }); } } /** * Prime the pump for a fast first lookup. * * @param {string} path - full path of file * @return {jQuery.Promise} - the promise for the request */ function primePump(path, isUntitledDoc) { _postMessageByPass({ type : MessageIds.TERN_PRIME_PUMP_MSG, path : path, isUntitledDoc : isUntitledDoc }); return addPendingRequest(path, OFFSET_ZERO, MessageIds.TERN_PRIME_PUMP_MSG); } /** * Handle the response from the tern node domain when * it responds to the prime pump message. * * @param {{path: string, type: string}} response - the response from node domain */ function handlePrimePumpCompletion(response) { var path = response.path, type = response.type, $deferredHints = getPendingRequest(path, OFFSET_ZERO, type); if ($deferredHints) { $deferredHints.resolve(); } } /** * Add new files to tern, keeping any previous files. * The tern server must be initialized before making * this call. * * @param {Array.<string>} files - array of file to add to tern. * @return {boolean} - true if more files may be added, false if maximum has been reached. */ function addFilesToTern(files) { // limit the number of files added to tern. var maxFileCount = preferences.getMaxFileCount(); if (numResolvedFiles + numAddedFiles < maxFileCount) { var available = maxFileCount - numResolvedFiles - numAddedFiles; if (available < files.length) { files = files.slice(0, available); } numAddedFiles += files.length; ternPromise.done(function (ternModule) { var msg = { type : MessageIds.TERN_ADD_FILES_MSG, files : files }; if (config.debug) { console.debug("Sending message", msg); } _ternNodeDomain.exec("invokeTernCommand", msg); }); } else { stopAddingFiles = true; } return stopAddingFiles; } /** * Add the files in the directory and subdirectories of a given directory * to tern. * * @param {string} dir - the root directory to add. * @param {function ()} doneCallback - called when all files have been * added to tern. */ function addAllFilesAndSubdirectories(dir, doneCallback) { FileSystem.resolve(dir, function (err, directory) { function visitor(entry) { if (entry.isFile) { if (!isFileExcluded(entry)) { // ignore .dotfiles and non-.js files addFilesToTern([entry.fullPath]); } } else { return !isDirectoryExcluded(entry.fullPath) && entry.name.indexOf(".") !== 0 && !stopAddingFiles; } } if (err) { return; } if (dir === FileSystem.getDirectoryForPath(rootTernDir)) { doneCallback(); return; } directory.visit(visitor, doneCallback); }); } /** * Init the Tern module that does all the code hinting work. */ function initTernModule() { var moduleDeferred = $.Deferred(); ternPromise = moduleDeferred.promise(); function prepareTern() { _ternNodeDomain.exec("setInterface", { messageIds : MessageIds }); _ternNodeDomain.exec("invokeTernCommand", { type: MessageIds.SET_CONFIG, config: config }); moduleDeferred.resolveWith(null, [_ternNodeDomain]); } if (_ternNodeDomain) { _ternNodeDomain.exec("resetTernServer"); moduleDeferred.resolveWith(null, [_ternNodeDomain]); } else { _ternNodeDomain = new NodeDomain("TernNodeDomain", _domainPath); _ternNodeDomain.on("data", function (evt, data) { if (config.debug) { console.log("Message received", data.type); } var response = data, type = response.type; if (type === MessageIds.TERN_COMPLETIONS_MSG || type === MessageIds.TERN_CALLED_FUNC_TYPE_MSG) { // handle any completions the tern server calculated handleTernCompletions(response); } else if (type === MessageIds.TERN_GET_FILE_MSG) { // handle a request for the contents of a file handleTernGetFile(response); } else if (type === MessageIds.TERN_JUMPTODEF_MSG) { handleJumptoDef(response); } else if (type === MessageIds.TERN_SCOPEDATA_MSG) { handleScopeData(response); } else if (type === MessageIds.TERN_REFS) { handleRename(response); } else if (type === MessageIds.TERN_PRIME_PUMP_MSG) { handlePrimePumpCompletion(response); } else if (type === MessageIds.TERN_GET_GUESSES_MSG) { handleGetGuesses(response); } else if (type === MessageIds.TERN_UPDATE_FILE_MSG) { handleUpdateFile(response); } else if (type === MessageIds.TERN_INFERENCE_TIMEDOUT) { handleTimedOut(response); } else if (type === MessageIds.TERN_WORKER_READY) { moduleDeferred.resolveWith(null, [_ternNodeDomain]); } else if (type === "RE_INIT_TERN") { // Ensure the request is because of a node restart if (currentModule) { prepareTern(); // Mark the module with resetForced, then creation of TernModule will // happen again as part of '_maybeReset' call currentModule.resetForced = true; } } else { console.log("Tern Module: " + (response.log || response)); } }); _ternNodeDomain.promise().done(prepareTern); } } /** * Create a new tern server. */ function initTernServer(dir, files) { initTernModule(); numResolvedFiles = 0; numAddedFiles = 0; stopAddingFiles = false; numInitialFiles = files.length; ternPromise.done(function (ternModule) { var msg = { type : MessageIds.TERN_INIT_MSG, dir : dir, files : files, env : ternEnvironment, timeout : PreferencesManager.get("jscodehints.inferenceTimeout") }; _ternNodeDomain.exec("invokeTernCommand", msg); }); rootTernDir = dir + "/"; } /** * We can skip tern initialization if we are opening a file that has * already been added to tern. * * @param {string} newFile - full path of new file being opened in the editor. * @return {boolean} - true if tern initialization should be skipped, * false otherwise. */ function canSkipTernInitialization(newFile) { return resolvedFiles[newFile] !== undefined; } /** * Do the work to initialize a code hinting session. * * @param {Session} session - the active hinting session (TODO: currently unused) * @param {!Document} document - the document the editor has changed to * @param {?Document} previousDocument - the document the editor has changed from */ function doEditorChange(session, document, previousDocument) { var file = document.file, path = file.fullPath, dir = file.parentPath, pr; var addFilesDeferred = $.Deferred(); documentChanges = null; addFilesPromise = addFilesDeferred.promise(); pr = ProjectManager.getProjectRoot() ? ProjectManager.getProjectRoot().fullPath : null; // avoid re-initializing tern if possible. if (canSkipTernInitialization(path)) { // update the previous document in tern to prevent stale files. if (isDocumentDirty && previousDocument) { var updateFilePromise = updateTernFile(previousDocument); updateFilePromise.done(function () { primePump(path, document.isUntitled()); addFilesDeferred.resolveWith(null, [_ternNodeDomain]); }); } else { addFilesDeferred.resolveWith(null, [_ternNodeDomain]); } isDocumentDirty = false; return; } if (previousDocument && previousDocument.isDirty) { updateTernFile(previousDocument); } isDocumentDirty = false; resolvedFiles = {}; projectRoot = pr; ensurePreferences(); deferredPreferences.done(function () { if (file instanceof InMemoryFile) { initTernServer(pr, []); var hintsPromise = primePump(path, true); hintsPromise.done(function () { addFilesDeferred.resolveWith(null, [_ternNodeDomain]); }); return; } FileSystem.resolve(dir, function (err, directory) { if (err) { console.error("Error resolving", dir); addFilesDeferred.resolveWith(null); return; } directory.getContents(function (err, contents) { if (err) { console.error("Error getting contents for", directory); addFilesDeferred.resolveWith(null); return; } var files = contents .filter(function (entry) { return entry.isFile && !isFileExcluded(entry); }) .map(function (entry) { return entry.fullPath; }); initTernServer(dir, files); var hintsPromise = primePump(path, false); hintsPromise.done(function () { if (!usingModules()) { // Read the subdirectories of the new file's directory. // Read them first in case there are too many files to // read in the project. addAllFilesAndSubdirectories(dir, function () { // If the file is in the project root, then read // all the files under the project root. var currentDir = (dir + "/"); if (projectRoot && currentDir !== projectRoot && currentDir.indexOf(projectRoot) === 0) { addAllFilesAndSubdirectories(projectRoot, function () { // prime the pump again but this time don't wait // for completion. primePump(path, false); addFilesDeferred.resolveWith(null, [_ternNodeDomain]); }); } else { addFilesDeferred.resolveWith(null, [_ternNodeDomain]); } }); } else { addFilesDeferred.resolveWith(null, [_ternNodeDomain]); } }); }); }); }); } /** * Called each time a new editor becomes active. * * @param {Session} session - the active hinting session (TODO: currently unused by doEditorChange()) * @param {!Document} document - the document of the editor that has changed * @param {?Document} previousDocument - the document of the editor is changing from */ function handleEditorChange(session, document, previousDocument) { if (addFilesPromise === null) { doEditorChange(session, document, previousDocument); } else { addFilesPromise.done(function () { doEditorChange(session, document, previousDocument); }); } } /** * Do some cleanup when a project is closed. * * We can clean up the node tern server we use to calculate hints now, since * we know we will need to re-init it in any new project that is opened. */ function resetModule() { function resetTernServer() { if (_ternNodeDomain.ready()) { _ternNodeDomain.exec('resetTernServer'); } } if (_ternNodeDomain) { if (addFilesPromise) { // If we're in the middle of added files, don't reset // until we're done addFilesPromise.done(resetTernServer).fail(resetTernServer); } else { resetTernServer(); } } } function whenReady(func) { addFilesPromise.done(func); } this.resetModule = resetModule; this.handleEditorChange = handleEditorChange; this.postMessage = postMessage; this.getResolvedPath = getResolvedPath; this.whenReady = whenReady; return this; }
[ "function", "TernModule", "(", ")", "{", "var", "ternPromise", "=", "null", ",", "addFilesPromise", "=", "null", ",", "rootTernDir", "=", "null", ",", "projectRoot", "=", "null", ",", "stopAddingFiles", "=", "false", ",", "resolvedFiles", "=", "{", "}", ",...
Encapsulate all the logic to talk to the tern module. This will create a new instance of a TernModule, which the rest of the hinting code can use to talk to the tern node domain, without worrying about initialization, priming the pump, etc.
[ "Encapsulate", "all", "the", "logic", "to", "talk", "to", "the", "tern", "module", ".", "This", "will", "create", "a", "new", "instance", "of", "a", "TernModule", "which", "the", "rest", "of", "the", "hinting", "code", "can", "use", "to", "talk", "to", ...
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/JSUtils/ScopeManager.js#L817-L1364
train
TernModule - TernModule constructor
[ 30522, 3853, 28774, 2078, 5302, 8566, 2571, 1006, 1007, 1063, 13075, 28774, 16275, 21716, 5562, 1027, 19701, 1010, 5587, 8873, 4244, 21572, 28732, 1027, 19701, 1010, 7117, 16451, 4305, 2099, 1027, 19701, 1010, 2622, 3217, 4140, 1027, 19701, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
Dogfalo/materialize
extras/noUiSlider/nouislider.js
addSlider
function addSlider ( target ) { // Apply classes and data to the target. addClass(target, options.cssClasses.target); if ( options.dir === 0 ) { addClass(target, options.cssClasses.ltr); } else { addClass(target, options.cssClasses.rtl); } if ( options.ort === 0 ) { addClass(target, options.cssClasses.horizontal); } else { addClass(target, options.cssClasses.vertical); } scope_Base = addNodeTo(target, options.cssClasses.base); }
javascript
function addSlider ( target ) { // Apply classes and data to the target. addClass(target, options.cssClasses.target); if ( options.dir === 0 ) { addClass(target, options.cssClasses.ltr); } else { addClass(target, options.cssClasses.rtl); } if ( options.ort === 0 ) { addClass(target, options.cssClasses.horizontal); } else { addClass(target, options.cssClasses.vertical); } scope_Base = addNodeTo(target, options.cssClasses.base); }
[ "function", "addSlider", "(", "target", ")", "{", "// Apply classes and data to the target.", "addClass", "(", "target", ",", "options", ".", "cssClasses", ".", "target", ")", ";", "if", "(", "options", ".", "dir", "===", "0", ")", "{", "addClass", "(", "tar...
Initialize a single slider.
[ "Initialize", "a", "single", "slider", "." ]
1122efadad8f1433d404696f7613e3cc13fb83a4
https://github.com/Dogfalo/materialize/blob/1122efadad8f1433d404696f7613e3cc13fb83a4/extras/noUiSlider/nouislider.js#L960-L978
train
Add slider to target
[ 30522, 3853, 9909, 24198, 2099, 1006, 4539, 1007, 1063, 1013, 1013, 6611, 4280, 1998, 2951, 2000, 1996, 4539, 1012, 5587, 26266, 1006, 4539, 1010, 7047, 1012, 20116, 11020, 27102, 2229, 1012, 4539, 1007, 1025, 2065, 1006, 7047, 1012, 16101,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
nhn/tui.editor
src/js/extensions/table/mergedTableUI.js
_bindEvents
function _bindEvents(popupTableUtils, eventManager, selectionManager) { const $popupContent = popupTableUtils.$content; const $mergeBtn = $($popupContent[5]); const $unmergeBtn = $($popupContent[6]); const $separator = $($popupContent[7]); popupTableUtils.on('click .te-table-merge', () => { eventManager.emit('command', 'MergeCells'); }); popupTableUtils.on('click .te-table-unmerge', () => { eventManager.emit('command', 'UnmergeCells'); }); eventManager.listen('openPopupTableUtils', () => { const $selectedCells = selectionManager.getSelectedCells(); const selectedCellCount = $selectedCells.length; if (selectedCellCount) { if (selectedCellCount < 2 || selectionManager.hasSelectedBothThAndTd($selectedCells)) { $mergeBtn.hide(); } else { $mergeBtn.show(); } if ($selectedCells.is('[rowspan], [colspan]')) { $unmergeBtn.show(); } else { $unmergeBtn.hide(); } $separator.show(); } else { $mergeBtn.hide(); $unmergeBtn.hide(); $separator.hide(); } }); }
javascript
function _bindEvents(popupTableUtils, eventManager, selectionManager) { const $popupContent = popupTableUtils.$content; const $mergeBtn = $($popupContent[5]); const $unmergeBtn = $($popupContent[6]); const $separator = $($popupContent[7]); popupTableUtils.on('click .te-table-merge', () => { eventManager.emit('command', 'MergeCells'); }); popupTableUtils.on('click .te-table-unmerge', () => { eventManager.emit('command', 'UnmergeCells'); }); eventManager.listen('openPopupTableUtils', () => { const $selectedCells = selectionManager.getSelectedCells(); const selectedCellCount = $selectedCells.length; if (selectedCellCount) { if (selectedCellCount < 2 || selectionManager.hasSelectedBothThAndTd($selectedCells)) { $mergeBtn.hide(); } else { $mergeBtn.show(); } if ($selectedCells.is('[rowspan], [colspan]')) { $unmergeBtn.show(); } else { $unmergeBtn.hide(); } $separator.show(); } else { $mergeBtn.hide(); $unmergeBtn.hide(); $separator.hide(); } }); }
[ "function", "_bindEvents", "(", "popupTableUtils", ",", "eventManager", ",", "selectionManager", ")", "{", "const", "$popupContent", "=", "popupTableUtils", ".", "$content", ";", "const", "$mergeBtn", "=", "$", "(", "$popupContent", "[", "5", "]", ")", ";", "c...
Bind events for merge feature of contextmenu. @param {object} popupTableUtils - PopupTableUtils instance for managing contextmenu of table @param {object} eventManager - event manager instance of editor @param {object} selectionManager - table selection manager instance @private
[ "Bind", "events", "for", "merge", "feature", "of", "contextmenu", "." ]
e75ab08c2a7ab07d1143e318f7cde135c5e3002e
https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/extensions/table/mergedTableUI.js#L43-L80
train
Bind events to the tableUtils
[ 30522, 3853, 1035, 14187, 18697, 7666, 1006, 3769, 29441, 3085, 21823, 4877, 1010, 2724, 24805, 4590, 1010, 4989, 24805, 4590, 1007, 1063, 9530, 3367, 1002, 3769, 6279, 8663, 6528, 2102, 1027, 3769, 29441, 3085, 21823, 4877, 1012, 1002, 418...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Device.js
calcBrowser
function calcBrowser(customUa) { var sUserAgent = (customUa || ua).toLowerCase(); // use custom user-agent if given var rwebkit = /(webkit)[ \/]([\w.]+)/; var ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/; var rmsie = /(msie) ([\w.]+)/; var rmsie11 = /(trident)\/[\w.]+;.*rv:([\w.]+)/; var redge = /(edge)[ \/]([\w.]+)/; var rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/; // WinPhone IE11 and MS Edge userAgents contain "WebKit" and "Mozilla" and therefore must be checked first var browserMatch = redge.exec(sUserAgent) || rmsie11.exec(sUserAgent) || rwebkit.exec(sUserAgent) || ropera.exec(sUserAgent) || rmsie.exec(sUserAgent) || sUserAgent.indexOf("compatible") < 0 && rmozilla.exec(sUserAgent) || []; var oRes = { browser: browserMatch[1] || "", version: browserMatch[2] || "0" }; oRes[oRes.browser] = true; return oRes; }
javascript
function calcBrowser(customUa) { var sUserAgent = (customUa || ua).toLowerCase(); // use custom user-agent if given var rwebkit = /(webkit)[ \/]([\w.]+)/; var ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/; var rmsie = /(msie) ([\w.]+)/; var rmsie11 = /(trident)\/[\w.]+;.*rv:([\w.]+)/; var redge = /(edge)[ \/]([\w.]+)/; var rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/; // WinPhone IE11 and MS Edge userAgents contain "WebKit" and "Mozilla" and therefore must be checked first var browserMatch = redge.exec(sUserAgent) || rmsie11.exec(sUserAgent) || rwebkit.exec(sUserAgent) || ropera.exec(sUserAgent) || rmsie.exec(sUserAgent) || sUserAgent.indexOf("compatible") < 0 && rmozilla.exec(sUserAgent) || []; var oRes = { browser: browserMatch[1] || "", version: browserMatch[2] || "0" }; oRes[oRes.browser] = true; return oRes; }
[ "function", "calcBrowser", "(", "customUa", ")", "{", "var", "sUserAgent", "=", "(", "customUa", "||", "ua", ")", ".", "toLowerCase", "(", ")", ";", "// use custom user-agent if given", "var", "rwebkit", "=", "/", "(webkit)[ \\/]([\\w.]+)", "/", ";", "var", "r...
/*! Taken from jQuery JavaScript Library v1.7.1 http://jquery.com/ Copyright 2011, John Resig Dual licensed under the MIT or GPL Version 2 licenses. http://jquery.org/license Includes Sizzle.js http://sizzlejs.com/ Copyright 2011, The Dojo Foundation Released under the MIT, BSD, and GPL Licenses. Date: Mon Nov 21 21:11:03 2011 -0500
[ "/", "*", "!", "Taken", "from", "jQuery", "JavaScript", "Library", "v1", ".", "7", ".", "1", "http", ":", "//", "jquery", ".", "com", "/" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/Device.js#L688-L712
train
Calculates the browser name and version
[ 30522, 3853, 10250, 27421, 10524, 8043, 1006, 7661, 6692, 1007, 1063, 13075, 10514, 8043, 4270, 3372, 1027, 1006, 7661, 6692, 1064, 1064, 25423, 1007, 1012, 2000, 27663, 18992, 3366, 1006, 1007, 1025, 1013, 1013, 2224, 7661, 5310, 1011, 400...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/extensions/default/InlineTimingFunctionEditor/TimingFunctionUtils.js
showHideHint
function showHideHint(hint, show, documentCode, editorCode) { if (!hint || !hint.elem) { return; } if (show) { hint.shown = true; hint.animationInProgress = false; hint.elem.removeClass("fadeout"); hint.elem.html(StringUtils.format(Strings.INLINE_TIMING_EDITOR_INVALID, documentCode, editorCode)); hint.elem.css("display", "block"); } else if (hint.shown) { hint.animationInProgress = true; AnimationUtils.animateUsingClass(hint.elem[0], "fadeout", 750) .done(function () { if (hint.animationInProgress) { // do this only if the animation was not cancelled hint.elem.hide(); } hint.shown = false; hint.animationInProgress = false; }); } else { hint.elem.hide(); } }
javascript
function showHideHint(hint, show, documentCode, editorCode) { if (!hint || !hint.elem) { return; } if (show) { hint.shown = true; hint.animationInProgress = false; hint.elem.removeClass("fadeout"); hint.elem.html(StringUtils.format(Strings.INLINE_TIMING_EDITOR_INVALID, documentCode, editorCode)); hint.elem.css("display", "block"); } else if (hint.shown) { hint.animationInProgress = true; AnimationUtils.animateUsingClass(hint.elem[0], "fadeout", 750) .done(function () { if (hint.animationInProgress) { // do this only if the animation was not cancelled hint.elem.hide(); } hint.shown = false; hint.animationInProgress = false; }); } else { hint.elem.hide(); } }
[ "function", "showHideHint", "(", "hint", ",", "show", ",", "documentCode", ",", "editorCode", ")", "{", "if", "(", "!", "hint", "||", "!", "hint", ".", "elem", ")", "{", "return", ";", "}", "if", "(", "show", ")", "{", "hint", ".", "shown", "=", ...
Show, hide or update the hint text @param {object} hint Editor.hint object of the current InlineTimingFunctionEditor @param {boolean} show Whether the hint should be shown or hidden @param {string=} documentCode The invalid code from the document (can be omitted when hiding) @param {string=} editorCode The valid code that is shown in the Inline Editor (can be omitted when hiding)
[ "Show", "hide", "or", "update", "the", "hint", "text" ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/InlineTimingFunctionEditor/TimingFunctionUtils.js#L254-L278
train
showHideHint - show the hint
[ 30522, 3853, 2265, 26100, 10606, 2102, 1006, 9374, 1010, 2265, 1010, 6254, 16044, 1010, 3559, 16044, 1007, 1063, 2065, 1006, 999, 9374, 1064, 1064, 999, 9374, 1012, 3449, 6633, 1007, 1063, 2709, 1025, 1065, 2065, 1006, 2265, 1007, 1063, 9...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
dimsemenov/PhotoSwipe
src/js/gestures.js
function() { // temp local vars var lastFlickDuration, tempReleasePos; // s = this var s = { lastFlickOffset: {}, lastFlickDist: {}, lastFlickSpeed: {}, slowDownRatio: {}, slowDownRatioReverse: {}, speedDecelerationRatio: {}, speedDecelerationRatioAbs: {}, distanceOffset: {}, backAnimDestination: {}, backAnimStarted: {}, calculateSwipeSpeed: function(axis) { if( _posPoints.length > 1) { lastFlickDuration = _getCurrentTime() - _gestureCheckSpeedTime + 50; tempReleasePos = _posPoints[_posPoints.length-2][axis]; } else { lastFlickDuration = _getCurrentTime() - _gestureStartTime; // total gesture duration tempReleasePos = _startPoint[axis]; } s.lastFlickOffset[axis] = _currPoint[axis] - tempReleasePos; s.lastFlickDist[axis] = Math.abs(s.lastFlickOffset[axis]); if(s.lastFlickDist[axis] > 20) { s.lastFlickSpeed[axis] = s.lastFlickOffset[axis] / lastFlickDuration; } else { s.lastFlickSpeed[axis] = 0; } if( Math.abs(s.lastFlickSpeed[axis]) < 0.1 ) { s.lastFlickSpeed[axis] = 0; } s.slowDownRatio[axis] = 0.95; s.slowDownRatioReverse[axis] = 1 - s.slowDownRatio[axis]; s.speedDecelerationRatio[axis] = 1; }, calculateOverBoundsAnimOffset: function(axis, speed) { if(!s.backAnimStarted[axis]) { if(_panOffset[axis] > _currPanBounds.min[axis]) { s.backAnimDestination[axis] = _currPanBounds.min[axis]; } else if(_panOffset[axis] < _currPanBounds.max[axis]) { s.backAnimDestination[axis] = _currPanBounds.max[axis]; } if(s.backAnimDestination[axis] !== undefined) { s.slowDownRatio[axis] = 0.7; s.slowDownRatioReverse[axis] = 1 - s.slowDownRatio[axis]; if(s.speedDecelerationRatioAbs[axis] < 0.05) { s.lastFlickSpeed[axis] = 0; s.backAnimStarted[axis] = true; _animateProp('bounceZoomPan'+axis,_panOffset[axis], s.backAnimDestination[axis], speed || 300, framework.easing.sine.out, function(pos) { _panOffset[axis] = pos; _applyCurrentZoomPan(); } ); } } } }, // Reduces the speed by slowDownRatio (per 10ms) calculateAnimOffset: function(axis) { if(!s.backAnimStarted[axis]) { s.speedDecelerationRatio[axis] = s.speedDecelerationRatio[axis] * (s.slowDownRatio[axis] + s.slowDownRatioReverse[axis] - s.slowDownRatioReverse[axis] * s.timeDiff / 10); s.speedDecelerationRatioAbs[axis] = Math.abs(s.lastFlickSpeed[axis] * s.speedDecelerationRatio[axis]); s.distanceOffset[axis] = s.lastFlickSpeed[axis] * s.speedDecelerationRatio[axis] * s.timeDiff; _panOffset[axis] += s.distanceOffset[axis]; } }, panAnimLoop: function() { if ( _animations.zoomPan ) { _animations.zoomPan.raf = _requestAF(s.panAnimLoop); s.now = _getCurrentTime(); s.timeDiff = s.now - s.lastNow; s.lastNow = s.now; s.calculateAnimOffset('x'); s.calculateAnimOffset('y'); _applyCurrentZoomPan(); s.calculateOverBoundsAnimOffset('x'); s.calculateOverBoundsAnimOffset('y'); if (s.speedDecelerationRatioAbs.x < 0.05 && s.speedDecelerationRatioAbs.y < 0.05) { // round pan position _panOffset.x = Math.round(_panOffset.x); _panOffset.y = Math.round(_panOffset.y); _applyCurrentZoomPan(); _stopAnimation('zoomPan'); return; } } } }; return s; }
javascript
function() { // temp local vars var lastFlickDuration, tempReleasePos; // s = this var s = { lastFlickOffset: {}, lastFlickDist: {}, lastFlickSpeed: {}, slowDownRatio: {}, slowDownRatioReverse: {}, speedDecelerationRatio: {}, speedDecelerationRatioAbs: {}, distanceOffset: {}, backAnimDestination: {}, backAnimStarted: {}, calculateSwipeSpeed: function(axis) { if( _posPoints.length > 1) { lastFlickDuration = _getCurrentTime() - _gestureCheckSpeedTime + 50; tempReleasePos = _posPoints[_posPoints.length-2][axis]; } else { lastFlickDuration = _getCurrentTime() - _gestureStartTime; // total gesture duration tempReleasePos = _startPoint[axis]; } s.lastFlickOffset[axis] = _currPoint[axis] - tempReleasePos; s.lastFlickDist[axis] = Math.abs(s.lastFlickOffset[axis]); if(s.lastFlickDist[axis] > 20) { s.lastFlickSpeed[axis] = s.lastFlickOffset[axis] / lastFlickDuration; } else { s.lastFlickSpeed[axis] = 0; } if( Math.abs(s.lastFlickSpeed[axis]) < 0.1 ) { s.lastFlickSpeed[axis] = 0; } s.slowDownRatio[axis] = 0.95; s.slowDownRatioReverse[axis] = 1 - s.slowDownRatio[axis]; s.speedDecelerationRatio[axis] = 1; }, calculateOverBoundsAnimOffset: function(axis, speed) { if(!s.backAnimStarted[axis]) { if(_panOffset[axis] > _currPanBounds.min[axis]) { s.backAnimDestination[axis] = _currPanBounds.min[axis]; } else if(_panOffset[axis] < _currPanBounds.max[axis]) { s.backAnimDestination[axis] = _currPanBounds.max[axis]; } if(s.backAnimDestination[axis] !== undefined) { s.slowDownRatio[axis] = 0.7; s.slowDownRatioReverse[axis] = 1 - s.slowDownRatio[axis]; if(s.speedDecelerationRatioAbs[axis] < 0.05) { s.lastFlickSpeed[axis] = 0; s.backAnimStarted[axis] = true; _animateProp('bounceZoomPan'+axis,_panOffset[axis], s.backAnimDestination[axis], speed || 300, framework.easing.sine.out, function(pos) { _panOffset[axis] = pos; _applyCurrentZoomPan(); } ); } } } }, // Reduces the speed by slowDownRatio (per 10ms) calculateAnimOffset: function(axis) { if(!s.backAnimStarted[axis]) { s.speedDecelerationRatio[axis] = s.speedDecelerationRatio[axis] * (s.slowDownRatio[axis] + s.slowDownRatioReverse[axis] - s.slowDownRatioReverse[axis] * s.timeDiff / 10); s.speedDecelerationRatioAbs[axis] = Math.abs(s.lastFlickSpeed[axis] * s.speedDecelerationRatio[axis]); s.distanceOffset[axis] = s.lastFlickSpeed[axis] * s.speedDecelerationRatio[axis] * s.timeDiff; _panOffset[axis] += s.distanceOffset[axis]; } }, panAnimLoop: function() { if ( _animations.zoomPan ) { _animations.zoomPan.raf = _requestAF(s.panAnimLoop); s.now = _getCurrentTime(); s.timeDiff = s.now - s.lastNow; s.lastNow = s.now; s.calculateAnimOffset('x'); s.calculateAnimOffset('y'); _applyCurrentZoomPan(); s.calculateOverBoundsAnimOffset('x'); s.calculateOverBoundsAnimOffset('y'); if (s.speedDecelerationRatioAbs.x < 0.05 && s.speedDecelerationRatioAbs.y < 0.05) { // round pan position _panOffset.x = Math.round(_panOffset.x); _panOffset.y = Math.round(_panOffset.y); _applyCurrentZoomPan(); _stopAnimation('zoomPan'); return; } } } }; return s; }
[ "function", "(", ")", "{", "// temp local vars", "var", "lastFlickDuration", ",", "tempReleasePos", ";", "// s = this", "var", "s", "=", "{", "lastFlickOffset", ":", "{", "}", ",", "lastFlickDist", ":", "{", "}", ",", "lastFlickSpeed", ":", "{", "}", ",", ...
amount of pixels to drag to determine direction of swipe
[ "amount", "of", "pixels", "to", "drag", "to", "determine", "direction", "of", "swipe" ]
80607e12542a1a54ecefa837649e862b35dffd25
https://github.com/dimsemenov/PhotoSwipe/blob/80607e12542a1a54ecefa837649e862b35dffd25/src/js/gestures.js#L800-L922
train
This function is called by the gesture manager when the gesture is in progress
[ 30522, 3853, 1006, 1007, 1063, 1013, 1013, 8915, 8737, 2334, 13075, 2015, 13075, 2197, 10258, 6799, 24979, 3370, 1010, 8915, 8737, 16570, 19500, 6873, 2015, 1025, 1013, 1013, 1055, 1027, 2023, 13075, 1055, 1027, 1063, 2197, 10258, 6799, 274...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/core/routing/TargetCache.js
function (sName, sType) { if (!sName) { var sMessage = "A name for the " + sType.toLowerCase() + " has to be defined"; Log.error(sMessage, this); throw Error(sMessage); } }
javascript
function (sName, sType) { if (!sName) { var sMessage = "A name for the " + sType.toLowerCase() + " has to be defined"; Log.error(sMessage, this); throw Error(sMessage); } }
[ "function", "(", "sName", ",", "sType", ")", "{", "if", "(", "!", "sName", ")", "{", "var", "sMessage", "=", "\"A name for the \"", "+", "sType", ".", "toLowerCase", "(", ")", "+", "\" has to be defined\"", ";", "Log", ".", "error", "(", "sMessage", ",",...
hook for the deprecated property viewId on the route, will not prefix the id with the component @name sap.ui.core.routing.TargetCache#_getViewWithGlobalId @returns {*} @private @param {string} sName logs an error if it is empty or undefined @param {string} sType whether it's a 'View' or 'Component' @private
[ "hook", "for", "the", "deprecated", "property", "viewId", "on", "the", "route", "will", "not", "prefix", "the", "id", "with", "the", "component" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/routing/TargetCache.js#L305-L313
train
Checks if the name is defined and if not throws an error
[ 30522, 3853, 1006, 1055, 18442, 1010, 2358, 18863, 1007, 1063, 2065, 1006, 999, 1055, 18442, 1007, 1063, 13075, 15488, 7971, 4270, 1027, 1000, 1037, 2171, 2005, 1996, 1000, 1009, 2358, 18863, 1012, 2000, 27663, 18992, 3366, 1006, 1007, 1009...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.ux3/src/sap/ui/ux3/library.js
function() { "use strict"; /** * Controls that implement the SAP User Experience (UX) Guidelines 3.0 * * @namespace * @name sap.ui.ux3 * @author SAP SE * @version ${version} * @public * @deprecated Since 1.38 */ // delegate further initialization of this library to the Core sap.ui.getCore().initLibrary({ name : "sap.ui.ux3", version: "${version}", dependencies : ["sap.ui.core","sap.ui.commons"], types: [ "sap.ui.ux3.ActionBarSocialActions", "sap.ui.ux3.ExactOrder", "sap.ui.ux3.FeederType", "sap.ui.ux3.FollowActionState", "sap.ui.ux3.NotificationBarStatus", "sap.ui.ux3.ShellDesignType", "sap.ui.ux3.ShellHeaderType", "sap.ui.ux3.ThingViewerHeaderType", "sap.ui.ux3.VisibleItemCountMode" ], interfaces: [ "sap.ui.ux3.DataSetView" ], controls: [ "sap.ui.ux3.ActionBar", "sap.ui.ux3.CollectionInspector", "sap.ui.ux3.DataSet", "sap.ui.ux3.DataSetSimpleView", "sap.ui.ux3.Exact", "sap.ui.ux3.ExactArea", "sap.ui.ux3.ExactBrowser", "sap.ui.ux3.ExactList", "sap.ui.ux3.FacetFilter", "sap.ui.ux3.FacetFilterList", "sap.ui.ux3.Feed", "sap.ui.ux3.FeedChunk", "sap.ui.ux3.Feeder", "sap.ui.ux3.NavigationBar", "sap.ui.ux3.NotificationBar", "sap.ui.ux3.Overlay", "sap.ui.ux3.OverlayContainer", "sap.ui.ux3.OverlayDialog", "sap.ui.ux3.QuickView", "sap.ui.ux3.Shell", "sap.ui.ux3.ThingInspector", "sap.ui.ux3.ThingViewer", "sap.ui.ux3.ToolPopup" ], elements: [ "sap.ui.ux3.Collection", "sap.ui.ux3.DataSetItem", "sap.ui.ux3.ExactAttribute", "sap.ui.ux3.NavigationItem", "sap.ui.ux3.Notifier", "sap.ui.ux3.ThingAction", "sap.ui.ux3.ThingGroup" ] }); /** * Enumeration of available standard actions for 'sap.ui.ux3.ActionBar'. To be used as parameters for function 'sap.ui.ux3.ActionBar.getSocialAction'. * * @enum {string} * @public * @experimental Since version 1.2. * API is not yet finished and might change completely * @ui5-metamodel This enumeration also will be described in the UI5 (legacy) designtime metamodel * @deprecated Since 1.38 */ sap.ui.ux3.ActionBarSocialActions = { /** * Standard action 'Create an update' (Feed) * @public */ Update : "Update", /** * Standard action 'Follow/Unfollow' * @public */ Follow : "Follow", /** * Standard action 'Mark for Follow up' * @public */ Flag : "Flag", /** * Standards action 'Mark as Favorite' * @public */ Favorite : "Favorite", /** * Standard action 'Open Thing Inspector' * @public */ Open : "Open" }; /** * * Marker interface for controls which are suitable as view rendering for a DataSet. * * * @author SAP SE * @name sap.ui.ux3.DataSetView * @interface * @public * @ui5-metamodel This interface also will be described in the UI5 (legacy) designtime metamodel * @deprecated Since 1.38 */ /** * Defines the order of the sub lists of a list in the ExactBrowser. * * @author SAP SE * @enum {string} * @public * @since 1.7.1 * @ui5-metamodel This enumeration also will be described in the UI5 (legacy) designtime metamodel * @deprecated Since 1.38 */ sap.ui.ux3.ExactOrder = { /** * The order of the sub lists is defined by the selection order of the user. * @public */ Select : "Select", /** * The order of the sub lists is defined by order of the defined sub attributes. * @public */ Fixed : "Fixed" }; /** * Type of a Feeder. * * @enum {string} * @public * @experimental Since version 1.2. * The whole Feed/Feeder API is still under discussion, significant changes are likely. Especially text presentation (e.g. @-references and formatted text) is not final. Also the Feed model topic is still open. * @ui5-metamodel This enumeration also will be described in the UI5 (legacy) designtime metamodel * @deprecated Since 1.38 */ sap.ui.ux3.FeederType = { /** * large Feeder * @public */ Large : "Large", /** * medium feeder * @public */ Medium : "Medium", /** * comment feeder (small) * @public */ Comment : "Comment" }; /** * Defines the states of the follow action * * @enum {string} * @public * @ui5-metamodel This enumeration also will be described in the UI5 (legacy) designtime metamodel * @deprecated Since 1.38 */ sap.ui.ux3.FollowActionState = { /** * follow state * @public */ Follow : "Follow", /** * hold state * @public */ Hold : "Hold", /** * default state * @public */ Default : "Default" }; /** * This entries are used to set the visibility status of a NotificationBar * * @author SAP * @enum {string} * @public * @ui5-metamodel This enumeration also will be described in the UI5 (legacy) designtime metamodel * @deprecated Since 1.38 */ sap.ui.ux3.NotificationBarStatus = { /** * Default height for the bar * @public */ Default : "Default", /** * Bar should be minimized * @public */ Min : "Min", /** * Bar should be maximized * @public */ Max : "Max", /** * Bar should not be visible * @public */ None : "None" }; /** * Available shell design types. * * @author SAP SE * @enum {string} * @public * @since 1.12.0 * @ui5-metamodel This enumeration also will be described in the UI5 (legacy) designtime metamodel * @deprecated Since 1.38 */ sap.ui.ux3.ShellDesignType = { /** * The standard Shell design (dark). * @public */ Standard : "Standard", /** * * A lighter design. Should be used in combination with the Standard header * type. * * @public */ Light : "Light", /** * * An even lighter design. It borrows most of its properties from the Light * design and just changes a few details like the header colors in order to * have a blue design within gold reflection. * * @public */ Crystal : "Crystal" }; /** * Available shell header display types. * * @author SAP SE * @enum {string} * @public * @ui5-metamodel This enumeration also will be described in the UI5 (legacy) designtime metamodel * @deprecated Since 1.38 */ sap.ui.ux3.ShellHeaderType = { /** * The standard Shell header. * @public */ Standard : "Standard", /** * Only the branding area is visible. Top-level navigation bar, header items, title and icon are not shown. * @public */ BrandOnly : "BrandOnly", /** * Like the Standard Area but without top-level navigation bar. * @public */ NoNavigation : "NoNavigation", /** * Like the Standard Area but with a leaner top-level navigation bar. * @public */ SlimNavigation : "SlimNavigation" }; /** * Available ThingViewer header display types. * * @author SAP SE * @enum {string} * @public * @since 1.16.3 * @ui5-metamodel This enumeration also will be described in the UI5 (legacy) designtime metamodel * @deprecated Since 1.38 */ sap.ui.ux3.ThingViewerHeaderType = { /** * The standard ThingViewer header. * @public */ Standard : "Standard", /** * The header content is displayed horizontally above the facet content * @public */ Horizontal : "Horizontal" }; /** * VisibleItemCountMode of the FacetFilter defines if the FacetFilter takes the whole available height (Auto) in the surrounding container, or is so high as needed to show 5 Items ("Fixed " - default). * * @enum {string} * @public * @ui5-metamodel This enumeration also will be described in the UI5 (legacy) designtime metamodel * @deprecated Since 1.38 */ sap.ui.ux3.VisibleItemCountMode = { /** * The FacetFilter always has as many items in the FacetFilterList as defined in the visibleItemCount property. * @public */ Fixed : "Fixed", /** * The FacetFilter automatically fills the height of the surrounding container. The visibleItemCount property is automatically changed accordingly. * @public */ Auto : "Auto" }; return sap.ui.ux3; }
javascript
function() { "use strict"; /** * Controls that implement the SAP User Experience (UX) Guidelines 3.0 * * @namespace * @name sap.ui.ux3 * @author SAP SE * @version ${version} * @public * @deprecated Since 1.38 */ // delegate further initialization of this library to the Core sap.ui.getCore().initLibrary({ name : "sap.ui.ux3", version: "${version}", dependencies : ["sap.ui.core","sap.ui.commons"], types: [ "sap.ui.ux3.ActionBarSocialActions", "sap.ui.ux3.ExactOrder", "sap.ui.ux3.FeederType", "sap.ui.ux3.FollowActionState", "sap.ui.ux3.NotificationBarStatus", "sap.ui.ux3.ShellDesignType", "sap.ui.ux3.ShellHeaderType", "sap.ui.ux3.ThingViewerHeaderType", "sap.ui.ux3.VisibleItemCountMode" ], interfaces: [ "sap.ui.ux3.DataSetView" ], controls: [ "sap.ui.ux3.ActionBar", "sap.ui.ux3.CollectionInspector", "sap.ui.ux3.DataSet", "sap.ui.ux3.DataSetSimpleView", "sap.ui.ux3.Exact", "sap.ui.ux3.ExactArea", "sap.ui.ux3.ExactBrowser", "sap.ui.ux3.ExactList", "sap.ui.ux3.FacetFilter", "sap.ui.ux3.FacetFilterList", "sap.ui.ux3.Feed", "sap.ui.ux3.FeedChunk", "sap.ui.ux3.Feeder", "sap.ui.ux3.NavigationBar", "sap.ui.ux3.NotificationBar", "sap.ui.ux3.Overlay", "sap.ui.ux3.OverlayContainer", "sap.ui.ux3.OverlayDialog", "sap.ui.ux3.QuickView", "sap.ui.ux3.Shell", "sap.ui.ux3.ThingInspector", "sap.ui.ux3.ThingViewer", "sap.ui.ux3.ToolPopup" ], elements: [ "sap.ui.ux3.Collection", "sap.ui.ux3.DataSetItem", "sap.ui.ux3.ExactAttribute", "sap.ui.ux3.NavigationItem", "sap.ui.ux3.Notifier", "sap.ui.ux3.ThingAction", "sap.ui.ux3.ThingGroup" ] }); /** * Enumeration of available standard actions for 'sap.ui.ux3.ActionBar'. To be used as parameters for function 'sap.ui.ux3.ActionBar.getSocialAction'. * * @enum {string} * @public * @experimental Since version 1.2. * API is not yet finished and might change completely * @ui5-metamodel This enumeration also will be described in the UI5 (legacy) designtime metamodel * @deprecated Since 1.38 */ sap.ui.ux3.ActionBarSocialActions = { /** * Standard action 'Create an update' (Feed) * @public */ Update : "Update", /** * Standard action 'Follow/Unfollow' * @public */ Follow : "Follow", /** * Standard action 'Mark for Follow up' * @public */ Flag : "Flag", /** * Standards action 'Mark as Favorite' * @public */ Favorite : "Favorite", /** * Standard action 'Open Thing Inspector' * @public */ Open : "Open" }; /** * * Marker interface for controls which are suitable as view rendering for a DataSet. * * * @author SAP SE * @name sap.ui.ux3.DataSetView * @interface * @public * @ui5-metamodel This interface also will be described in the UI5 (legacy) designtime metamodel * @deprecated Since 1.38 */ /** * Defines the order of the sub lists of a list in the ExactBrowser. * * @author SAP SE * @enum {string} * @public * @since 1.7.1 * @ui5-metamodel This enumeration also will be described in the UI5 (legacy) designtime metamodel * @deprecated Since 1.38 */ sap.ui.ux3.ExactOrder = { /** * The order of the sub lists is defined by the selection order of the user. * @public */ Select : "Select", /** * The order of the sub lists is defined by order of the defined sub attributes. * @public */ Fixed : "Fixed" }; /** * Type of a Feeder. * * @enum {string} * @public * @experimental Since version 1.2. * The whole Feed/Feeder API is still under discussion, significant changes are likely. Especially text presentation (e.g. @-references and formatted text) is not final. Also the Feed model topic is still open. * @ui5-metamodel This enumeration also will be described in the UI5 (legacy) designtime metamodel * @deprecated Since 1.38 */ sap.ui.ux3.FeederType = { /** * large Feeder * @public */ Large : "Large", /** * medium feeder * @public */ Medium : "Medium", /** * comment feeder (small) * @public */ Comment : "Comment" }; /** * Defines the states of the follow action * * @enum {string} * @public * @ui5-metamodel This enumeration also will be described in the UI5 (legacy) designtime metamodel * @deprecated Since 1.38 */ sap.ui.ux3.FollowActionState = { /** * follow state * @public */ Follow : "Follow", /** * hold state * @public */ Hold : "Hold", /** * default state * @public */ Default : "Default" }; /** * This entries are used to set the visibility status of a NotificationBar * * @author SAP * @enum {string} * @public * @ui5-metamodel This enumeration also will be described in the UI5 (legacy) designtime metamodel * @deprecated Since 1.38 */ sap.ui.ux3.NotificationBarStatus = { /** * Default height for the bar * @public */ Default : "Default", /** * Bar should be minimized * @public */ Min : "Min", /** * Bar should be maximized * @public */ Max : "Max", /** * Bar should not be visible * @public */ None : "None" }; /** * Available shell design types. * * @author SAP SE * @enum {string} * @public * @since 1.12.0 * @ui5-metamodel This enumeration also will be described in the UI5 (legacy) designtime metamodel * @deprecated Since 1.38 */ sap.ui.ux3.ShellDesignType = { /** * The standard Shell design (dark). * @public */ Standard : "Standard", /** * * A lighter design. Should be used in combination with the Standard header * type. * * @public */ Light : "Light", /** * * An even lighter design. It borrows most of its properties from the Light * design and just changes a few details like the header colors in order to * have a blue design within gold reflection. * * @public */ Crystal : "Crystal" }; /** * Available shell header display types. * * @author SAP SE * @enum {string} * @public * @ui5-metamodel This enumeration also will be described in the UI5 (legacy) designtime metamodel * @deprecated Since 1.38 */ sap.ui.ux3.ShellHeaderType = { /** * The standard Shell header. * @public */ Standard : "Standard", /** * Only the branding area is visible. Top-level navigation bar, header items, title and icon are not shown. * @public */ BrandOnly : "BrandOnly", /** * Like the Standard Area but without top-level navigation bar. * @public */ NoNavigation : "NoNavigation", /** * Like the Standard Area but with a leaner top-level navigation bar. * @public */ SlimNavigation : "SlimNavigation" }; /** * Available ThingViewer header display types. * * @author SAP SE * @enum {string} * @public * @since 1.16.3 * @ui5-metamodel This enumeration also will be described in the UI5 (legacy) designtime metamodel * @deprecated Since 1.38 */ sap.ui.ux3.ThingViewerHeaderType = { /** * The standard ThingViewer header. * @public */ Standard : "Standard", /** * The header content is displayed horizontally above the facet content * @public */ Horizontal : "Horizontal" }; /** * VisibleItemCountMode of the FacetFilter defines if the FacetFilter takes the whole available height (Auto) in the surrounding container, or is so high as needed to show 5 Items ("Fixed " - default). * * @enum {string} * @public * @ui5-metamodel This enumeration also will be described in the UI5 (legacy) designtime metamodel * @deprecated Since 1.38 */ sap.ui.ux3.VisibleItemCountMode = { /** * The FacetFilter always has as many items in the FacetFilterList as defined in the visibleItemCount property. * @public */ Fixed : "Fixed", /** * The FacetFilter automatically fills the height of the surrounding container. The visibleItemCount property is automatically changed accordingly. * @public */ Auto : "Auto" }; return sap.ui.ux3; }
[ "function", "(", ")", "{", "\"use strict\"", ";", "/**\n\t * Controls that implement the SAP User Experience (UX) Guidelines 3.0\n\t *\n\t * @namespace\n\t * @name sap.ui.ux3\n\t * @author SAP SE\n\t * @version ${version}\n\t * @public\n\t * @deprecated Since 1.38\n\t */", "// delegate further initial...
library dependency
[ "library", "dependency" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.ux3/src/sap/ui/ux3/library.js#L11-L399
train
The sap. ui. ux3. 0. 0 library
[ 30522, 3853, 1006, 1007, 1063, 1000, 2224, 9384, 1000, 1025, 1013, 1008, 1008, 1008, 7711, 2008, 10408, 1996, 20066, 5310, 3325, 1006, 1057, 2595, 1007, 11594, 1017, 1012, 1014, 1008, 1008, 1030, 3415, 15327, 1008, 1030, 2171, 20066, 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...
moleculerjs/moleculer
src/middlewares/circuit-breaker.js
resetStore
function resetStore() { if (!logger) return; logger.debug("Reset circuit-breaker endpoint states..."); store.forEach((item, key) => { if (item.count == 0) { logger.debug(`Remove '${key}' endpoint state because it is not used`); store.delete(key); return; } logger.debug(`Clean '${key}' endpoint state.`); item.count = 0; item.failures = 0; }); }
javascript
function resetStore() { if (!logger) return; logger.debug("Reset circuit-breaker endpoint states..."); store.forEach((item, key) => { if (item.count == 0) { logger.debug(`Remove '${key}' endpoint state because it is not used`); store.delete(key); return; } logger.debug(`Clean '${key}' endpoint state.`); item.count = 0; item.failures = 0; }); }
[ "function", "resetStore", "(", ")", "{", "if", "(", "!", "logger", ")", "return", ";", "logger", ".", "debug", "(", "\"Reset circuit-breaker endpoint states...\"", ")", ";", "store", ".", "forEach", "(", "(", "item", ",", "key", ")", "=>", "{", "if", "("...
Clear endpoint state store
[ "Clear", "endpoint", "state", "store" ]
f95aadc2d61b0d0e3c643a43c3ed28bca6425cde
https://github.com/moleculerjs/moleculer/blob/f95aadc2d61b0d0e3c643a43c3ed28bca6425cde/src/middlewares/circuit-breaker.js#L33-L48
train
Reset the circuit - breaker endpoint states store
[ 30522, 3853, 25141, 23809, 2063, 1006, 1007, 1063, 2065, 1006, 999, 8833, 4590, 1007, 2709, 1025, 8833, 4590, 1012, 2139, 8569, 2290, 1006, 1000, 25141, 4984, 1011, 24733, 2203, 8400, 2163, 1012, 1012, 1012, 1000, 1007, 1025, 3573, 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...
wuchangming/spy-debugger
buildin_modules/weinre/web/client/Resource.js
function(type) { switch (type) { case this.Document: return "document"; case this.Stylesheet: return "stylesheet"; case this.Image: return "image"; case this.Font: return "font"; case this.Script: return "script"; case this.XHR: return "xhr"; case this.WebSocket: return "websocket"; case this.Other: default: return "other"; } }
javascript
function(type) { switch (type) { case this.Document: return "document"; case this.Stylesheet: return "stylesheet"; case this.Image: return "image"; case this.Font: return "font"; case this.Script: return "script"; case this.XHR: return "xhr"; case this.WebSocket: return "websocket"; case this.Other: default: return "other"; } }
[ "function", "(", "type", ")", "{", "switch", "(", "type", ")", "{", "case", "this", ".", "Document", ":", "return", "\"document\"", ";", "case", "this", ".", "Stylesheet", ":", "return", "\"stylesheet\"", ";", "case", "this", ".", "Image", ":", "return",...
Returns locale-independent string identifier of resource type (primarily for use in extension API). The IDs need to be kept in sync with webInspector.resoureces.Types object in ExtensionAPI.js.
[ "Returns", "locale", "-", "independent", "string", "identifier", "of", "resource", "type", "(", "primarily", "for", "use", "in", "extension", "API", ")", ".", "The", "IDs", "need", "to", "be", "kept", "in", "sync", "with", "webInspector", ".", "resoureces", ...
55c1dda0dff0c44920673711656ddfd7ff03c307
https://github.com/wuchangming/spy-debugger/blob/55c1dda0dff0c44920673711656ddfd7ff03c307/buildin_modules/weinre/web/client/Resource.js#L80-L101
train
returns the name of the resource
[ 30522, 3853, 1006, 2828, 1007, 1063, 6942, 1006, 2828, 1007, 1063, 2553, 2023, 1012, 6254, 1024, 2709, 1000, 6254, 1000, 1025, 2553, 2023, 1012, 6782, 21030, 2102, 1024, 2709, 1000, 6782, 21030, 2102, 1000, 1025, 2553, 2023, 1012, 3746, 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...
firebase/firebase-js-sdk
packages/firestore/karma.conf.js
getFirestoreSettings
function getFirestoreSettings(argv) { if (argv.local) { return { host: 'localhost:8080', ssl: false }; } else { return { host: 'firestore.googleapis.com', ssl: true }; } }
javascript
function getFirestoreSettings(argv) { if (argv.local) { return { host: 'localhost:8080', ssl: false }; } else { return { host: 'firestore.googleapis.com', ssl: true }; } }
[ "function", "getFirestoreSettings", "(", "argv", ")", "{", "if", "(", "argv", ".", "local", ")", "{", "return", "{", "host", ":", "'localhost:8080'", ",", "ssl", ":", "false", "}", ";", "}", "else", "{", "return", "{", "host", ":", "'firestore.googleapis...
If the --local argument is passed, returns a {host, ssl} FirestoreSettings object that point to localhost instead of production.
[ "If", "the", "--", "local", "argument", "is", "passed", "returns", "a", "{", "host", "ssl", "}", "FirestoreSettings", "object", "that", "point", "to", "localhost", "instead", "of", "production", "." ]
491598a499813dacc23724de5e237ec220cc560e
https://github.com/firebase/firebase-js-sdk/blob/491598a499813dacc23724de5e237ec220cc560e/packages/firestore/karma.conf.js#L60-L72
train
Get the firestore settings
[ 30522, 3853, 2131, 26332, 19277, 21678, 8613, 1006, 12098, 2290, 2615, 1007, 1063, 2065, 1006, 12098, 2290, 2615, 1012, 2334, 1007, 1063, 2709, 1063, 3677, 1024, 1005, 2334, 15006, 2102, 1024, 3770, 17914, 1005, 1010, 7020, 2140, 1024, 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...
jgraph/mxgraph
javascript/mxClient.js
mxGraph
function mxGraph(container, model, renderHint, stylesheet) { // Initializes the variable in case the prototype has been // modified to hold some listeners (which is possible because // the createHandlers call is executed regardless of the // arguments passed into the ctor). this.mouseListeners = null; // Converts the renderHint into a dialect this.renderHint = renderHint; if (mxClient.IS_SVG) { this.dialect = mxConstants.DIALECT_SVG; } else if (renderHint == mxConstants.RENDERING_HINT_EXACT && mxClient.IS_VML) { this.dialect = mxConstants.DIALECT_VML; } else if (renderHint == mxConstants.RENDERING_HINT_FASTEST) { this.dialect = mxConstants.DIALECT_STRICTHTML; } else if (renderHint == mxConstants.RENDERING_HINT_FASTER) { this.dialect = mxConstants.DIALECT_PREFERHTML; } else // default for VML { this.dialect = mxConstants.DIALECT_MIXEDHTML; } // Initializes the main members that do not require a container this.model = (model != null) ? model : new mxGraphModel(); this.multiplicities = []; this.imageBundles = []; this.cellRenderer = this.createCellRenderer(); this.setSelectionModel(this.createSelectionModel()); this.setStylesheet((stylesheet != null) ? stylesheet : this.createStylesheet()); this.view = this.createGraphView(); // Adds a graph model listener to update the view this.graphModelChangeListener = mxUtils.bind(this, function(sender, evt) { this.graphModelChanged(evt.getProperty('edit').changes); }); this.model.addListener(mxEvent.CHANGE, this.graphModelChangeListener); // Installs basic event handlers with disabled default settings. this.createHandlers(); // Initializes the display if a container was specified if (container != null) { this.init(container); } this.view.revalidate(); }
javascript
function mxGraph(container, model, renderHint, stylesheet) { // Initializes the variable in case the prototype has been // modified to hold some listeners (which is possible because // the createHandlers call is executed regardless of the // arguments passed into the ctor). this.mouseListeners = null; // Converts the renderHint into a dialect this.renderHint = renderHint; if (mxClient.IS_SVG) { this.dialect = mxConstants.DIALECT_SVG; } else if (renderHint == mxConstants.RENDERING_HINT_EXACT && mxClient.IS_VML) { this.dialect = mxConstants.DIALECT_VML; } else if (renderHint == mxConstants.RENDERING_HINT_FASTEST) { this.dialect = mxConstants.DIALECT_STRICTHTML; } else if (renderHint == mxConstants.RENDERING_HINT_FASTER) { this.dialect = mxConstants.DIALECT_PREFERHTML; } else // default for VML { this.dialect = mxConstants.DIALECT_MIXEDHTML; } // Initializes the main members that do not require a container this.model = (model != null) ? model : new mxGraphModel(); this.multiplicities = []; this.imageBundles = []; this.cellRenderer = this.createCellRenderer(); this.setSelectionModel(this.createSelectionModel()); this.setStylesheet((stylesheet != null) ? stylesheet : this.createStylesheet()); this.view = this.createGraphView(); // Adds a graph model listener to update the view this.graphModelChangeListener = mxUtils.bind(this, function(sender, evt) { this.graphModelChanged(evt.getProperty('edit').changes); }); this.model.addListener(mxEvent.CHANGE, this.graphModelChangeListener); // Installs basic event handlers with disabled default settings. this.createHandlers(); // Initializes the display if a container was specified if (container != null) { this.init(container); } this.view.revalidate(); }
[ "function", "mxGraph", "(", "container", ",", "model", ",", "renderHint", ",", "stylesheet", ")", "{", "// Initializes the variable in case the prototype has been", "// modified to hold some listeners (which is possible because", "// the createHandlers call is executed regardless of the"...
Copyright (c) 2006-2015, JGraph Ltd Copyright (c) 2006-2015, Gaudenz Alder Class: mxGraph Extends <mxEventSource> to implement a graph component for the browser. This is the main class of the package. To activate panning and connections use <setPanning> and <setConnectable>. For rubberband selection you must create a new instance of <mxRubberband>. The following listeners are added to <mouseListeners> by default: - <tooltipHandler>: <mxTooltipHandler> that displays tooltips - <panningHandler>: <mxPanningHandler> for panning and popup menus - <connectionHandler>: <mxConnectionHandler> for creating connections - <graphHandler>: <mxGraphHandler> for moving and cloning cells These listeners will be called in the above order if they are enabled. Background Images: To display a background image, set the image, image width and image height using <setBackgroundImage>. If one of the above values has changed then the <view>'s <mxGraphView.validate> should be invoked. Cell Images: To use images in cells, a shape must be specified in the default vertex style (or any named style). Possible shapes are <mxConstants.SHAPE_IMAGE> and <mxConstants.SHAPE_LABEL>. The code to change the shape used in the default vertex style, the following code is used: (code) var style = graph.getStylesheet().getDefaultVertexStyle(); style[mxConstants.STYLE_SHAPE] = mxConstants.SHAPE_IMAGE; (end) For the default vertex style, the image to be displayed can be specified in a cell's style using the <mxConstants.STYLE_IMAGE> key and the image URL as a value, for example: (code) image=http://www.example.com/image.gif (end) For a named style, the the stylename must be the first element of the cell style: (code) stylename;image=http://www.example.com/image.gif (end) A cell style can have any number of key=value pairs added, divided by a semicolon as follows: (code) [stylename;|key=value;] (end) Labels: The cell labels are defined by <getLabel> which uses <convertValueToString> if <labelsVisible> is true. If a label must be rendered as HTML markup, then <isHtmlLabel> should return true for the respective cell. If all labels contain HTML markup, <htmlLabels> can be set to true. NOTE: Enabling HTML labels carries a possible security risk (see the section on security in the manual). If wrapping is needed for a label, then <isHtmlLabel> and <isWrapping> must return true for the cell whose label should be wrapped. See <isWrapping> for an example. If clipping is needed to keep the rendering of a HTML label inside the bounds of its vertex, then <isClipping> should return true for the respective cell. By default, edge labels are movable and vertex labels are fixed. This can be changed by setting <edgeLabelsMovable> and <vertexLabelsMovable>, or by overriding <isLabelMovable>. In-place Editing: In-place editing is started with a doubleclick or by typing F2. Programmatically, <edit> is used to check if the cell is editable (<isCellEditable>) and call <startEditingAtCell>, which invokes <mxCellEditor.startEditing>. The editor uses the value returned by <getEditingValue> as the editing value. After in-place editing, <labelChanged> is called, which invokes <mxGraphModel.setValue>, which in turn calls <mxGraphModel.valueForCellChanged> via <mxValueChange>. The event that triggers in-place editing is passed through to the <cellEditor>, which may take special actions depending on the type of the event or mouse location, and is also passed to <getEditingValue>. The event is then passed back to the event processing functions which can perform specific actions based on the trigger event. Tooltips: Tooltips are implemented by <getTooltip>, which calls <getTooltipForCell> if a cell is under the mousepointer. The default implementation checks if the cell has a getTooltip function and calls it if it exists. Hence, in order to provide custom tooltips, the cell must provide a getTooltip function, or one of the two above functions must be overridden. Typically, for custom cell tooltips, the latter function is overridden as follows: (code) graph.getTooltipForCell = function(cell) { var label = this.convertValueToString(cell); return 'Tooltip for '+label; } (end) When using a config file, the function is overridden in the mxGraph section using the following entry: (code) <add as="getTooltipForCell"><![CDATA[ function(cell) { var label = this.convertValueToString(cell); return 'Tooltip for '+label; } ]]></add> (end) "this" refers to the graph in the implementation, so for example to check if a cell is an edge, you use this.getModel().isEdge(cell) For replacing the default implementation of <getTooltipForCell> (rather than replacing the function on a specific instance), the following code should be used after loading the JavaScript files, but before creating a new mxGraph instance using <mxGraph>: (code) mxGraph.prototype.getTooltipForCell = function(cell) { var label = this.convertValueToString(cell); return 'Tooltip for '+label; } (end) Shapes & Styles: The implementation of new shapes is demonstrated in the examples. We'll assume that we have implemented a custom shape with the name BoxShape which we want to use for drawing vertices. To use this shape, it must first be registered in the cell renderer as follows: (code) mxCellRenderer.registerShape('box', BoxShape); (end) The code registers the BoxShape constructor under the name box in the cell renderer of the graph. The shape can now be referenced using the shape-key in a style definition. (The cell renderer contains a set of additional shapes, namely one for each constant with a SHAPE-prefix in <mxConstants>.) Styles are a collection of key, value pairs and a stylesheet is a collection of named styles. The names are referenced by the cellstyle, which is stored in <mxCell.style> with the following format: [stylename;|key=value;]. The string is resolved to a collection of key, value pairs, where the keys are overridden with the values in the string. When introducing a new shape, the name under which the shape is registered must be used in the stylesheet. There are three ways of doing this: - By changing the default style, so that all vertices will use the new shape - By defining a new style, so that only vertices with the respective cellstyle will use the new shape - By using shape=box in the cellstyle's optional list of key, value pairs to be overridden In the first case, the code to fetch and modify the default style for vertices is as follows: (code) var style = graph.getStylesheet().getDefaultVertexStyle(); style[mxConstants.STYLE_SHAPE] = 'box'; (end) The code takes the default vertex style, which is used for all vertices that do not have a specific cellstyle, and modifies the value for the shape-key in-place to use the new BoxShape for drawing vertices. This is done by assigning the box value in the second line, which refers to the name of the BoxShape in the cell renderer. In the second case, a collection of key, value pairs is created and then added to the stylesheet under a new name. In order to distinguish the shapename and the stylename we'll use boxstyle for the stylename: (code) var style = new Object(); style[mxConstants.STYLE_SHAPE] = 'box'; style[mxConstants.STYLE_STROKECOLOR] = '#000000'; style[mxConstants.STYLE_FONTCOLOR] = '#000000'; graph.getStylesheet().putCellStyle('boxstyle', style); (end) The code adds a new style with the name boxstyle to the stylesheet. To use this style with a cell, it must be referenced from the cellstyle as follows: (code) var vertex = graph.insertVertex(parent, null, 'Hello, World!', 20, 20, 80, 20, 'boxstyle'); (end) To summarize, each new shape must be registered in the <mxCellRenderer> with a unique name. That name is then used as the value of the shape-key in a default or custom style. If there are multiple custom shapes, then there should be a separate style for each shape. Inheriting Styles: For fill-, stroke-, gradient- and indicatorColors special keywords can be used. The inherit keyword for one of these colors will inherit the color for the same key from the parent cell. The swimlane keyword does the same, but inherits from the nearest swimlane in the ancestor hierarchy. Finally, the indicated keyword will use the color of the indicator as the color for the given key. Scrollbars: The <containers> overflow CSS property defines if scrollbars are used to display the graph. For values of 'auto' or 'scroll', the scrollbars will be shown. Note that the <resizeContainer> flag is normally not used together with scrollbars, as it will resize the container to match the size of the graph after each change. Multiplicities and Validation: To control the possible connections in mxGraph, <getEdgeValidationError> is used. The default implementation of the function uses <multiplicities>, which is an array of <mxMultiplicity>. Using this class allows to establish simple multiplicities, which are enforced by the graph. The <mxMultiplicity> uses <mxCell.is> to determine for which terminals it applies. The default implementation of <mxCell.is> works with DOM nodes (XML nodes) and checks if the given type parameter matches the nodeName of the node (case insensitive). Optionally, an attributename and value can be specified which are also checked. <getEdgeValidationError> is called whenever the connectivity of an edge changes. It returns an empty string or an error message if the edge is invalid or null if the edge is valid. If the returned string is not empty then it is displayed as an error message. <mxMultiplicity> allows to specify the multiplicity between a terminal and its possible neighbors. For example, if any rectangle may only be connected to, say, a maximum of two circles you can add the following rule to <multiplicities>: (code) graph.multiplicities.push(new mxMultiplicity( true, 'rectangle', null, null, 0, 2, ['circle'], 'Only 2 targets allowed', 'Only shape targets allowed')); (end) This will display the first error message whenever a rectangle is connected to more than two circles and the second error message if a rectangle is connected to anything but a circle. For certain multiplicities, such as a minimum of 1 connection, which cannot be enforced at cell creation time (unless the cell is created together with the connection), mxGraph offers <validate> which checks all multiplicities for all cells and displays the respective error messages in an overlay icon on the cells. If a cell is collapsed and contains validation errors, a respective warning icon is attached to the collapsed cell. Auto-Layout: For automatic layout, the <getLayout> hook is provided in <mxLayoutManager>. It can be overridden to return a layout algorithm for the children of a given cell. Unconnected edges: The default values for all switches are designed to meet the requirements of general diagram drawing applications. A very typical set of settings to avoid edges that are not connected is the following: (code) graph.setAllowDanglingEdges(false); graph.setDisconnectOnMove(false); (end) Setting the <cloneInvalidEdges> switch to true is optional. This switch controls if edges are inserted after a copy, paste or clone-drag if they are invalid. For example, edges are invalid if copied or control-dragged without having selected the corresponding terminals and allowDanglingEdges is false, in which case the edges will not be cloned if the switch is false. Output: To produce an XML representation for a diagram, the following code can be used. (code) var enc = new mxCodec(mxUtils.createXmlDocument()); var node = enc.encode(graph.getModel()); (end) This will produce an XML node than can be handled using the DOM API or turned into a string representation using the following code: (code) var xml = mxUtils.getXml(node); (end) To obtain a formatted string, mxUtils.getPrettyXml can be used instead. This string can now be stored in a local persistent storage (for example using Google Gears) or it can be passed to a backend using mxUtils.post as follows. The url variable is the URL of the Java servlet, PHP page or HTTP handler, depending on the server. (code) var xmlString = encodeURIComponent(mxUtils.getXml(node)); mxUtils.post(url, 'xml='+xmlString, function(req) { // Process server response using req of type mxXmlRequest }); (end) Input: To load an XML representation of a diagram into an existing graph object mxUtils.load can be used as follows. The url variable is the URL of the Java servlet, PHP page or HTTP handler that produces the XML string. (code) var xmlDoc = mxUtils.load(url).getXml(); var node = xmlDoc.documentElement; var dec = new mxCodec(node.ownerDocument); dec.decode(node, graph.getModel()); (end) For creating a page that loads the client and a diagram using a single request please refer to the deployment examples in the backends. Functional dependencies: (see images/callgraph.png) Resources: resources/graph - Language resources for mxGraph Group: Events Event: mxEvent.ROOT Fires if the root in the model has changed. This event has no properties. Event: mxEvent.ALIGN_CELLS Fires between begin- and endUpdate in <alignCells>. The <code>cells</code> and <code>align</code> properties contain the respective arguments that were passed to <alignCells>. Event: mxEvent.FLIP_EDGE Fires between begin- and endUpdate in <flipEdge>. The <code>edge</code> property contains the edge passed to <flipEdge>. Event: mxEvent.ORDER_CELLS Fires between begin- and endUpdate in <orderCells>. The <code>cells</code> and <code>back</code> properties contain the respective arguments that were passed to <orderCells>. Event: mxEvent.CELLS_ORDERED Fires between begin- and endUpdate in <cellsOrdered>. The <code>cells</code> and <code>back</code> arguments contain the respective arguments that were passed to <cellsOrdered>. Event: mxEvent.GROUP_CELLS Fires between begin- and endUpdate in <groupCells>. The <code>group</code>, <code>cells</code> and <code>border</code> arguments contain the respective arguments that were passed to <groupCells>. Event: mxEvent.UNGROUP_CELLS Fires between begin- and endUpdate in <ungroupCells>. The <code>cells</code> property contains the array of cells that was passed to <ungroupCells>. Event: mxEvent.REMOVE_CELLS_FROM_PARENT Fires between begin- and endUpdate in <removeCellsFromParent>. The <code>cells</code> property contains the array of cells that was passed to <removeCellsFromParent>. Event: mxEvent.ADD_CELLS Fires between begin- and endUpdate in <addCells>. The <code>cells</code>, <code>parent</code>, <code>index</code>, <code>source</code> and <code>target</code> properties contain the respective arguments that were passed to <addCells>. Event: mxEvent.CELLS_ADDED Fires between begin- and endUpdate in <cellsAdded>. The <code>cells</code>, <code>parent</code>, <code>index</code>, <code>source</code>, <code>target</code> and <code>absolute</code> properties contain the respective arguments that were passed to <cellsAdded>. Event: mxEvent.REMOVE_CELLS Fires between begin- and endUpdate in <removeCells>. The <code>cells</code> and <code>includeEdges</code> arguments contain the respective arguments that were passed to <removeCells>. Event: mxEvent.CELLS_REMOVED Fires between begin- and endUpdate in <cellsRemoved>. The <code>cells</code> argument contains the array of cells that was removed. Event: mxEvent.SPLIT_EDGE Fires between begin- and endUpdate in <splitEdge>. The <code>edge</code> property contains the edge to be splitted, the <code>cells</code>, <code>newEdge</code>, <code>dx</code> and <code>dy</code> properties contain the respective arguments that were passed to <splitEdge>. Event: mxEvent.TOGGLE_CELLS Fires between begin- and endUpdate in <toggleCells>. The <code>show</code>, <code>cells</code> and <code>includeEdges</code> properties contain the respective arguments that were passed to <toggleCells>. Event: mxEvent.FOLD_CELLS Fires between begin- and endUpdate in <foldCells>. The <code>collapse</code>, <code>cells</code> and <code>recurse</code> properties contain the respective arguments that were passed to <foldCells>. Event: mxEvent.CELLS_FOLDED Fires between begin- and endUpdate in cellsFolded. The <code>collapse</code>, <code>cells</code> and <code>recurse</code> properties contain the respective arguments that were passed to <cellsFolded>. Event: mxEvent.UPDATE_CELL_SIZE Fires between begin- and endUpdate in <updateCellSize>. The <code>cell</code> and <code>ignoreChildren</code> properties contain the respective arguments that were passed to <updateCellSize>. Event: mxEvent.RESIZE_CELLS Fires between begin- and endUpdate in <resizeCells>. The <code>cells</code> and <code>bounds</code> properties contain the respective arguments that were passed to <resizeCells>. Event: mxEvent.CELLS_RESIZED Fires between begin- and endUpdate in <cellsResized>. The <code>cells</code> and <code>bounds</code> properties contain the respective arguments that were passed to <cellsResized>. Event: mxEvent.MOVE_CELLS Fires between begin- and endUpdate in <moveCells>. The <code>cells</code>, <code>dx</code>, <code>dy</code>, <code>clone</code>, <code>target</code> and <code>event</code> properties contain the respective arguments that were passed to <moveCells>. Event: mxEvent.CELLS_MOVED Fires between begin- and endUpdate in <cellsMoved>. The <code>cells</code>, <code>dx</code>, <code>dy</code> and <code>disconnect</code> properties contain the respective arguments that were passed to <cellsMoved>. Event: mxEvent.CONNECT_CELL Fires between begin- and endUpdate in <connectCell>. The <code>edge</code>, <code>terminal</code> and <code>source</code> properties contain the respective arguments that were passed to <connectCell>. Event: mxEvent.CELL_CONNECTED Fires between begin- and endUpdate in <cellConnected>. The <code>edge</code>, <code>terminal</code> and <code>source</code> properties contain the respective arguments that were passed to <cellConnected>. Event: mxEvent.REFRESH Fires after <refresh> was executed. This event has no properties. Event: mxEvent.CLICK Fires in <click> after a click event. The <code>event</code> property contains the original mouse event and <code>cell</code> property contains the cell under the mouse or null if the background was clicked. Event: mxEvent.DOUBLE_CLICK Fires in <dblClick> after a double click. The <code>event</code> property contains the original mouse event and the <code>cell</code> property contains the cell under the mouse or null if the background was clicked. Event: mxEvent.GESTURE Fires in <fireGestureEvent> after a touch gesture. The <code>event</code> property contains the original gesture end event and the <code>cell</code> property contains the optional cell associated with the gesture. Event: mxEvent.TAP_AND_HOLD Fires in <tapAndHold> if a tap and hold event was detected. The <code>event</code> property contains the initial touch event and the <code>cell</code> property contains the cell under the mouse or null if the background was clicked. Event: mxEvent.FIRE_MOUSE_EVENT Fires in <fireMouseEvent> before the mouse listeners are invoked. The <code>eventName</code> property contains the event name and the <code>event</code> property contains the <mxMouseEvent>. Event: mxEvent.SIZE Fires after <sizeDidChange> was executed. The <code>bounds</code> property contains the new graph bounds. Event: mxEvent.START_EDITING Fires before the in-place editor starts in <startEditingAtCell>. The <code>cell</code> property contains the cell that is being edited and the <code>event</code> property contains the optional event argument that was passed to <startEditingAtCell>. Event: mxEvent.EDITING_STARTED Fires after the in-place editor starts in <startEditingAtCell>. The <code>cell</code> property contains the cell that is being edited and the <code>event</code> property contains the optional event argument that was passed to <startEditingAtCell>. Event: mxEvent.EDITING_STOPPED Fires after the in-place editor stops in <stopEditing>. Event: mxEvent.LABEL_CHANGED Fires between begin- and endUpdate in <cellLabelChanged>. The <code>cell</code> property contains the cell, the <code>value</code> property contains the new value for the cell, the <code>old</code> property contains the old value and the optional <code>event</code> property contains the mouse event that started the edit. Event: mxEvent.ADD_OVERLAY Fires after an overlay is added in <addCellOverlay>. The <code>cell</code> property contains the cell and the <code>overlay</code> property contains the <mxCellOverlay> that was added. Event: mxEvent.REMOVE_OVERLAY Fires after an overlay is removed in <removeCellOverlay> and <removeCellOverlays>. The <code>cell</code> property contains the cell and the <code>overlay</code> property contains the <mxCellOverlay> that was removed. Constructor: mxGraph Constructs a new mxGraph in the specified container. Model is an optional mxGraphModel. If no model is provided, a new mxGraphModel instance is used as the model. The container must have a valid owner document prior to calling this function in Internet Explorer. RenderHint is a string to affect the display performance and rendering in IE, but not in SVG-based browsers. The parameter is mapped to <dialect>, which may be one of <mxConstants.DIALECT_SVG> for SVG-based browsers, <mxConstants.DIALECT_STRICTHTML> for fastest display mode, <mxConstants.DIALECT_PREFERHTML> for faster display mode, <mxConstants.DIALECT_MIXEDHTML> for fast and <mxConstants.DIALECT_VML> for exact display mode (slowest). The dialects are defined in mxConstants. The default values are DIALECT_SVG for SVG-based browsers and DIALECT_MIXED for IE. The possible values for the renderingHint parameter are explained below: fast - The parameter is based on the fact that the display performance is highly improved in IE if the VML is not contained within a VML group element. The lack of a group element only slightly affects the display while panning, but improves the performance by almost a factor of 2, while keeping the display sufficiently accurate. This also allows to render certain shapes as HTML if the display accuracy is not affected, which is implemented by <mxShape.isMixedModeHtml>. This is the default setting and is mapped to DIALECT_MIXEDHTML. faster - Same as fast, but more expensive shapes are avoided. This is controlled by <mxShape.preferModeHtml>. The default implementation will avoid gradients and rounded rectangles, but more significant shapes, such as rhombus, ellipse, actor and cylinder will be rendered accurately. This setting is mapped to DIALECT_PREFERHTML. fastest - Almost anything will be rendered in Html. This allows for rectangles, labels and images. This setting is mapped to DIALECT_STRICTHTML. exact - If accurate panning is required and if the diagram is small (up to 100 cells), then this value should be used. In this mode, a group is created that contains the VML. This allows for accurate panning and is mapped to DIALECT_VML. Example: To create a graph inside a DOM node with an id of graph: (code) var container = document.getElementById('graph'); var graph = new mxGraph(container); (end) Parameters: container - Optional DOM node that acts as a container for the graph. If this is null then the container can be initialized later using <init>. model - Optional <mxGraphModel> that constitutes the graph data. renderHint - Optional string that specifies the display accuracy and performance. Default is mxConstants.DIALECT_MIXEDHTML (for IE). stylesheet - Optional <mxStylesheet> to be used in the graph.
[ "Copyright", "(", "c", ")", "2006", "-", "2015", "JGraph", "Ltd", "Copyright", "(", "c", ")", "2006", "-", "2015", "Gaudenz", "Alder", "Class", ":", "mxGraph" ]
33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44
https://github.com/jgraph/mxgraph/blob/33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44/javascript/mxClient.js#L54714-L54773
train
Constructs a new graph instance.
[ 30522, 3853, 25630, 14413, 1006, 11661, 1010, 2944, 1010, 17552, 10606, 2102, 1010, 6782, 21030, 2102, 1007, 1063, 1013, 1013, 3988, 10057, 1996, 8023, 1999, 2553, 1996, 8773, 2038, 2042, 1013, 1013, 6310, 2000, 2907, 2070, 13810, 1006, 202...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/store/RelayResponseNormalizer.js
normalize
function normalize( recordSource: MutableRecordSource, selector: NormalizationSelector, response: PayloadData, options: NormalizationOptions, ): NormalizedResponse { const {dataID, node, variables} = selector; const normalizer = new RelayResponseNormalizer( recordSource, variables, options, ); return normalizer.normalizeResponse(node, dataID, response); }
javascript
function normalize( recordSource: MutableRecordSource, selector: NormalizationSelector, response: PayloadData, options: NormalizationOptions, ): NormalizedResponse { const {dataID, node, variables} = selector; const normalizer = new RelayResponseNormalizer( recordSource, variables, options, ); return normalizer.normalizeResponse(node, dataID, response); }
[ "function", "normalize", "(", "recordSource", ":", "MutableRecordSource", ",", "selector", ":", "NormalizationSelector", ",", "response", ":", "PayloadData", ",", "options", ":", "NormalizationOptions", ",", ")", ":", "NormalizedResponse", "{", "const", "{", "dataID...
Normalizes the results of a query and standard GraphQL response, writing the normalized records/fields into the given MutableRecordSource. If handleStrippedNulls is true, will replace fields on the Selector that are not present in the response with null. Otherwise will leave fields unset.
[ "Normalizes", "the", "results", "of", "a", "query", "and", "standard", "GraphQL", "response", "writing", "the", "normalized", "records", "/", "fields", "into", "the", "given", "MutableRecordSource", "." ]
7fb9be5182b9650637d7b92ead9a42713ac30aa4
https://github.com/facebook/relay/blob/7fb9be5182b9650637d7b92ead9a42713ac30aa4/packages/relay-runtime/store/RelayResponseNormalizer.js#L83-L96
train
Normalizes a response from a relation
[ 30522, 3853, 3671, 4697, 1006, 2636, 8162, 3401, 1024, 14163, 10880, 2890, 27108, 5104, 8162, 3401, 1010, 27000, 1024, 3671, 22318, 12260, 16761, 1010, 3433, 1024, 18093, 2850, 2696, 1010, 7047, 1024, 3671, 3989, 7361, 9285, 1010, 1007, 102...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/thirdparty/blanket.js
parseCatchClause
function parseCatchClause() { var param, body, startToken; startToken = lookahead; expectKeyword('catch'); expect('('); if (match(')')) { throwUnexpected(lookahead); } param = parseVariableIdentifier(); // 12.14.1 if (strict && isRestrictedWord(param.name)) { throwErrorTolerant({}, Messages.StrictCatchVariable); } expect(')'); body = parseBlock(); return delegate.markEnd(delegate.createCatchClause(param, body), startToken); }
javascript
function parseCatchClause() { var param, body, startToken; startToken = lookahead; expectKeyword('catch'); expect('('); if (match(')')) { throwUnexpected(lookahead); } param = parseVariableIdentifier(); // 12.14.1 if (strict && isRestrictedWord(param.name)) { throwErrorTolerant({}, Messages.StrictCatchVariable); } expect(')'); body = parseBlock(); return delegate.markEnd(delegate.createCatchClause(param, body), startToken); }
[ "function", "parseCatchClause", "(", ")", "{", "var", "param", ",", "body", ",", "startToken", ";", "startToken", "=", "lookahead", ";", "expectKeyword", "(", "'catch'", ")", ";", "expect", "(", "'('", ")", ";", "if", "(", "match", "(", "')'", ")", ")"...
12.14 The try statement
[ "12", ".", "14", "The", "try", "statement" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/blanket.js#L3132-L3152
train
ECMA - 262 12. 1 CatchClause
[ 30522, 3853, 11968, 3366, 11266, 2818, 30524, 1027, 2298, 4430, 13775, 1025, 5987, 14839, 18351, 1006, 1005, 4608, 1005, 1007, 1025, 5987, 1006, 1005, 1006, 1005, 1007, 1025, 2065, 1006, 2674, 1006, 1005, 1007, 1005, 1007, 1007, 1063, 5466,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
exceljs/exceljs
lib/utils/zip-stream.js
function(data, encoding, callback) { if (this.error) { if (callback) { callback(error); } throw error; } else { return this.stream.write(data, encoding, callback); } }
javascript
function(data, encoding, callback) { if (this.error) { if (callback) { callback(error); } throw error; } else { return this.stream.write(data, encoding, callback); } }
[ "function", "(", "data", ",", "encoding", ",", "callback", ")", "{", "if", "(", "this", ".", "error", ")", "{", "if", "(", "callback", ")", "{", "callback", "(", "error", ")", ";", "}", "throw", "error", ";", "}", "else", "{", "return", "this", "...
========================================================================== Stream.Writable interface
[ "==========================================================================", "Stream", ".", "Writable", "interface" ]
c6ee7a14d5e0e5a07bf0e475aa4dd7b9a1e907f2
https://github.com/exceljs/exceljs/blob/c6ee7a14d5e0e5a07bf0e475aa4dd7b9a1e907f2/lib/utils/zip-stream.js#L72-L81
train
Writes the specified data to the file system.
[ 30522, 3853, 1006, 2951, 1010, 17181, 1010, 2655, 5963, 1007, 1063, 2065, 1006, 2023, 1012, 7561, 1007, 1063, 2065, 1006, 2655, 5963, 1007, 1063, 2655, 5963, 1006, 7561, 1007, 1025, 1065, 5466, 7561, 1025, 1065, 2842, 1063, 2709, 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...
apache/incubator-echarts
src/coord/geo/Geo.js
Geo
function Geo(name, map, nameMap, invertLongitute) { View.call(this, name); /** * Map type * @type {string} */ this.map = map; var source = geoSourceManager.load(map, nameMap); this._nameCoordMap = source.nameCoordMap; this._regionsMap = source.regionsMap; this._invertLongitute = invertLongitute == null ? true : invertLongitute; /** * @readOnly */ this.regions = source.regions; /** * @type {module:zrender/src/core/BoundingRect} */ this._rect = source.boundingRect; }
javascript
function Geo(name, map, nameMap, invertLongitute) { View.call(this, name); /** * Map type * @type {string} */ this.map = map; var source = geoSourceManager.load(map, nameMap); this._nameCoordMap = source.nameCoordMap; this._regionsMap = source.regionsMap; this._invertLongitute = invertLongitute == null ? true : invertLongitute; /** * @readOnly */ this.regions = source.regions; /** * @type {module:zrender/src/core/BoundingRect} */ this._rect = source.boundingRect; }
[ "function", "Geo", "(", "name", ",", "map", ",", "nameMap", ",", "invertLongitute", ")", "{", "View", ".", "call", "(", "this", ",", "name", ")", ";", "/**\n * Map type\n * @type {string}\n */", "this", ".", "map", "=", "map", ";", "var", "source...
[Geo description] For backward compatibility, the orginal interface: `name, map, geoJson, specialAreas, nameMap` is kept. @param {string|Object} name @param {string} map Map type Specify the positioned areas by left, top, width, height @param {Object.<string, string>} [nameMap] Specify name alias @param {boolean} [invertLongitute=true]
[ "[", "Geo", "description", "]", "For", "backward", "compatibility", "the", "orginal", "interface", ":", "name", "map", "geoJson", "specialAreas", "nameMap", "is", "kept", "." ]
4d0ea095dc3929cb6de40c45748826e7999c7aa8
https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/coord/geo/Geo.js#L38-L63
train
A geo view
[ 30522, 3853, 20248, 1006, 2171, 1010, 4949, 1010, 2171, 2863, 2361, 1010, 1999, 16874, 10052, 4183, 10421, 1007, 1063, 3193, 1012, 2655, 1006, 2023, 1010, 30524, 1013, 2023, 1012, 4949, 1027, 4949, 1025, 13075, 3120, 1027, 20248, 6499, 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...
angular/angular
tools/build/file2modulename.js
file2moduleName
function file2moduleName(filePath) { return filePath .replace(/\\/g, '/') // module name should be relative to `modules` and `tools` folder .replace(/.*\/modules\//, '') // and 'dist' folder .replace(/.*\/dist\/js\/dev\/es5\//, '') // module name should not include `lib`, `web` folders // as they are wrapper packages for dart .replace(/\/web\//, '/') .replace(/\/lib\//, '/') // module name should not have a suffix .replace(/\.\w*$/, ''); }
javascript
function file2moduleName(filePath) { return filePath .replace(/\\/g, '/') // module name should be relative to `modules` and `tools` folder .replace(/.*\/modules\//, '') // and 'dist' folder .replace(/.*\/dist\/js\/dev\/es5\//, '') // module name should not include `lib`, `web` folders // as they are wrapper packages for dart .replace(/\/web\//, '/') .replace(/\/lib\//, '/') // module name should not have a suffix .replace(/\.\w*$/, ''); }
[ "function", "file2moduleName", "(", "filePath", ")", "{", "return", "filePath", ".", "replace", "(", "/", "\\\\", "/", "g", ",", "'/'", ")", "// module name should be relative to `modules` and `tools` folder", ".", "replace", "(", "/", ".*\\/modules\\/", "/", ",", ...
@license Copyright Google Inc. All Rights Reserved. Use of this source code is governed by an MIT-style license that can be found in the LICENSE file at https://angular.io/license
[ "@license", "Copyright", "Google", "Inc", ".", "All", "Rights", "Reserved", "." ]
c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c
https://github.com/angular/angular/blob/c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c/tools/build/file2modulename.js#L9-L22
train
Convert a file path to a module name
[ 30522, 3853, 5371, 2475, 5302, 8566, 20844, 4168, 1006, 5371, 15069, 1007, 1063, 2709, 5371, 15069, 1012, 5672, 1006, 1013, 1032, 1032, 1013, 1043, 1010, 1005, 1013, 1005, 1007, 1013, 1013, 11336, 2171, 2323, 2022, 5816, 2000, 1036, 14184, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kriasoft/react-starter-kit
tools/build.js
build
async function build() { await run(clean); await run(copy); await run(bundle); if (process.argv.includes('--static')) { await run(render); } if (process.argv.includes('--docker')) { cp.spawnSync('docker', ['build', '-t', pkg.name, '.'], { stdio: 'inherit', }); } }
javascript
async function build() { await run(clean); await run(copy); await run(bundle); if (process.argv.includes('--static')) { await run(render); } if (process.argv.includes('--docker')) { cp.spawnSync('docker', ['build', '-t', pkg.name, '.'], { stdio: 'inherit', }); } }
[ "async", "function", "build", "(", ")", "{", "await", "run", "(", "clean", ")", ";", "await", "run", "(", "copy", ")", ";", "await", "run", "(", "bundle", ")", ";", "if", "(", "process", ".", "argv", ".", "includes", "(", "'--static'", ")", ")", ...
Compiles the project from source files into a distributable format and copies it to the output (build) folder.
[ "Compiles", "the", "project", "from", "source", "files", "into", "a", "distributable", "format", "and", "copies", "it", "to", "the", "output", "(", "build", ")", "folder", "." ]
8d6c018f3198dec2a580ecafb011a32f06e38dbf
https://github.com/kriasoft/react-starter-kit/blob/8d6c018f3198dec2a580ecafb011a32f06e38dbf/tools/build.js#L22-L36
train
Build the cluster
[ 30522, 2004, 6038, 2278, 3853, 3857, 1006, 1007, 1063, 26751, 2448, 1006, 4550, 1007, 1025, 26751, 2448, 1006, 6100, 1007, 1025, 26751, 2448, 1006, 14012, 1007, 1025, 2065, 1006, 2832, 1012, 12098, 2290, 2615, 1012, 2950, 1006, 1005, 1011, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/language/CSSUtils.js
_getRangeForPropValue
function _getRangeForPropValue(startCtx, endCtx) { var range = { "start": {}, "end": {} }; // Skip the ":" and any leading whitespace while (TokenUtils.moveNextToken(startCtx)) { if (_hasNonWhitespace(startCtx.token.string)) { break; } } // Skip the trailing whitespace and property separators. while (endCtx.token.string === ";" || endCtx.token.string === "}" || !_hasNonWhitespace(endCtx.token.string)) { TokenUtils.movePrevToken(endCtx); } range.start = _.clone(startCtx.pos); range.start.ch = startCtx.token.start; range.end = _.clone(endCtx.pos); range.end.ch = endCtx.token.end; return range; }
javascript
function _getRangeForPropValue(startCtx, endCtx) { var range = { "start": {}, "end": {} }; // Skip the ":" and any leading whitespace while (TokenUtils.moveNextToken(startCtx)) { if (_hasNonWhitespace(startCtx.token.string)) { break; } } // Skip the trailing whitespace and property separators. while (endCtx.token.string === ";" || endCtx.token.string === "}" || !_hasNonWhitespace(endCtx.token.string)) { TokenUtils.movePrevToken(endCtx); } range.start = _.clone(startCtx.pos); range.start.ch = startCtx.token.start; range.end = _.clone(endCtx.pos); range.end.ch = endCtx.token.end; return range; }
[ "function", "_getRangeForPropValue", "(", "startCtx", ",", "endCtx", ")", "{", "var", "range", "=", "{", "\"start\"", ":", "{", "}", ",", "\"end\"", ":", "{", "}", "}", ";", "// Skip the \":\" and any leading whitespace", "while", "(", "TokenUtils", ".", "move...
@private Return a range object with a start position and an end position after skipping any whitespaces and all separators used before and after a valid property value. @param {editor:{CodeMirror}, pos:{ch:{string}, line:{number}}, token:{object}} startCtx context @param {editor:{CodeMirror}, pos:{ch:{string}, line:{number}}, token:{object}} endCtx context @return {{start: {line: number, ch: number}, end: {line: number, ch: number}}} A range object.
[ "@private", "Return", "a", "range", "object", "with", "a", "start", "position", "and", "an", "end", "position", "after", "skipping", "any", "whitespaces", "and", "all", "separators", "used", "before", "and", "after", "a", "valid", "property", "value", "." ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/language/CSSUtils.js#L403-L427
train
Get the range for a property value
[ 30522, 3853, 1035, 2131, 24388, 12879, 2953, 21572, 2361, 10175, 5657, 1006, 2707, 6593, 2595, 1010, 2203, 6593, 2595, 1007, 1063, 13075, 2846, 1027, 1063, 1000, 2707, 1000, 1024, 1063, 1065, 1010, 1000, 2203, 1000, 1024, 1063, 1065, 1065, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
chartjs/Chart.js
src/scales/scale.time.js
determineStepSize
function determineStepSize(min, max, unit, capacity) { var range = max - min; var interval = INTERVALS[unit]; var milliseconds = interval.size; var steps = interval.steps; var i, ilen, factor; if (!steps) { return Math.ceil(range / (capacity * milliseconds)); } for (i = 0, ilen = steps.length; i < ilen; ++i) { factor = steps[i]; if (Math.ceil(range / (milliseconds * factor)) <= capacity) { break; } } return factor; }
javascript
function determineStepSize(min, max, unit, capacity) { var range = max - min; var interval = INTERVALS[unit]; var milliseconds = interval.size; var steps = interval.steps; var i, ilen, factor; if (!steps) { return Math.ceil(range / (capacity * milliseconds)); } for (i = 0, ilen = steps.length; i < ilen; ++i) { factor = steps[i]; if (Math.ceil(range / (milliseconds * factor)) <= capacity) { break; } } return factor; }
[ "function", "determineStepSize", "(", "min", ",", "max", ",", "unit", ",", "capacity", ")", "{", "var", "range", "=", "max", "-", "min", ";", "var", "interval", "=", "INTERVALS", "[", "unit", "]", ";", "var", "milliseconds", "=", "interval", ".", "size...
Returns the number of unit to skip to be able to display up to `capacity` number of ticks in `unit` for the given `min` / `max` range and respecting the interval steps constraints.
[ "Returns", "the", "number", "of", "unit", "to", "skip", "to", "be", "able", "to", "display", "up", "to", "capacity", "number", "of", "ticks", "in", "unit", "for", "the", "given", "min", "/", "max", "range", "and", "respecting", "the", "interval", "steps"...
f093c36574d290330ed623e60fbd070421c730d5
https://github.com/chartjs/Chart.js/blob/f093c36574d290330ed623e60fbd070421c730d5/src/scales/scale.time.js#L254-L273
train
Determine the step size of a range of time
[ 30522, 3853, 16463, 2618, 4523, 4697, 1006, 8117, 1010, 4098, 1010, 3131, 1010, 3977, 1007, 1063, 13075, 2846, 1027, 4098, 1011, 8117, 1025, 13075, 13483, 1027, 14025, 1031, 3131, 1033, 1025, 13075, 4971, 5562, 8663, 5104, 1027, 13483, 1012...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
eslint/eslint
lib/rules/init-declarations.js
isInitialized
function isInitialized(node) { const declaration = node.parent; const block = declaration.parent; if (isForLoop(block)) { if (block.type === "ForStatement") { return block.init === declaration; } return block.left === declaration; } return Boolean(node.init); }
javascript
function isInitialized(node) { const declaration = node.parent; const block = declaration.parent; if (isForLoop(block)) { if (block.type === "ForStatement") { return block.init === declaration; } return block.left === declaration; } return Boolean(node.init); }
[ "function", "isInitialized", "(", "node", ")", "{", "const", "declaration", "=", "node", ".", "parent", ";", "const", "block", "=", "declaration", ".", "parent", ";", "if", "(", "isForLoop", "(", "block", ")", ")", "{", "if", "(", "block", ".", "type",...
Checks whether or not a given declarator node has its initializer. @param {ASTNode} node - A declarator node to check. @returns {boolean} `true` when the node has its initializer.
[ "Checks", "whether", "or", "not", "a", "given", "declarator", "node", "has", "its", "initializer", "." ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/init-declarations.js#L28-L39
train
Returns true if the given node is initialized.
[ 30522, 3853, 2003, 5498, 20925, 3550, 1006, 13045, 1007, 1063, 9530, 3367, 8170, 1027, 13045, 1012, 6687, 1025, 9530, 3367, 3796, 1027, 8170, 1012, 6687, 1025, 2065, 1006, 2003, 29278, 4135, 7361, 1006, 3796, 1007, 1007, 1063, 2065, 1006, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
aframevr/aframe
src/core/schema.js
processPropertyDefinition
function processPropertyDefinition (propDefinition, componentName) { var defaultVal = propDefinition.default; var isCustomType; var propType; var typeName = propDefinition.type; // Type inference. if (!propDefinition.type) { if (defaultVal !== undefined && (typeof defaultVal === 'boolean' || typeof defaultVal === 'number')) { // Type inference. typeName = typeof defaultVal; } else if (Array.isArray(defaultVal)) { typeName = 'array'; } else { // Fall back to string. typeName = 'string'; } } else if (propDefinition.type === 'bool') { typeName = 'boolean'; } else if (propDefinition.type === 'float') { typeName = 'number'; } propType = propertyTypes[typeName]; if (!propType) { warn('Unknown property type for component `' + componentName + '`: ' + typeName); } // Fill in parse and stringify using property types. isCustomType = !!propDefinition.parse; propDefinition.parse = propDefinition.parse || propType.parse; propDefinition.stringify = propDefinition.stringify || propType.stringify; // Fill in type name. propDefinition.type = typeName; // Check that default value exists. if ('default' in propDefinition) { // Check that default values are valid. if (!isCustomType && !isValidDefaultValue(typeName, defaultVal)) { warn('Default value `' + defaultVal + '` does not match type `' + typeName + '` in component `' + componentName + '`'); } } else { // Fill in default value. propDefinition.default = propType.default; } return propDefinition; }
javascript
function processPropertyDefinition (propDefinition, componentName) { var defaultVal = propDefinition.default; var isCustomType; var propType; var typeName = propDefinition.type; // Type inference. if (!propDefinition.type) { if (defaultVal !== undefined && (typeof defaultVal === 'boolean' || typeof defaultVal === 'number')) { // Type inference. typeName = typeof defaultVal; } else if (Array.isArray(defaultVal)) { typeName = 'array'; } else { // Fall back to string. typeName = 'string'; } } else if (propDefinition.type === 'bool') { typeName = 'boolean'; } else if (propDefinition.type === 'float') { typeName = 'number'; } propType = propertyTypes[typeName]; if (!propType) { warn('Unknown property type for component `' + componentName + '`: ' + typeName); } // Fill in parse and stringify using property types. isCustomType = !!propDefinition.parse; propDefinition.parse = propDefinition.parse || propType.parse; propDefinition.stringify = propDefinition.stringify || propType.stringify; // Fill in type name. propDefinition.type = typeName; // Check that default value exists. if ('default' in propDefinition) { // Check that default values are valid. if (!isCustomType && !isValidDefaultValue(typeName, defaultVal)) { warn('Default value `' + defaultVal + '` does not match type `' + typeName + '` in component `' + componentName + '`'); } } else { // Fill in default value. propDefinition.default = propType.default; } return propDefinition; }
[ "function", "processPropertyDefinition", "(", "propDefinition", ",", "componentName", ")", "{", "var", "defaultVal", "=", "propDefinition", ".", "default", ";", "var", "isCustomType", ";", "var", "propType", ";", "var", "typeName", "=", "propDefinition", ".", "typ...
Inject default value, parser, stringifier for single property. @param {object} propDefinition @param {string} componentName
[ "Inject", "default", "value", "parser", "stringifier", "for", "single", "property", "." ]
24acc78a7299a4cdfe3ef617f4d40ddf6275c992
https://github.com/aframevr/aframe/blob/24acc78a7299a4cdfe3ef617f4d40ddf6275c992/src/core/schema.js#L52-L102
train
Process a property definition.
[ 30522, 3853, 2832, 21572, 4842, 3723, 3207, 16294, 22753, 1006, 17678, 3207, 16294, 22753, 1010, 6922, 18442, 1007, 1063, 13075, 12398, 10175, 1027, 17678, 3207, 16294, 22753, 1012, 12398, 1025, 13075, 2003, 7874, 20389, 13874, 1025, 13075, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
eslint/eslint
lib/linter.js
addDeclaredGlobals
function addDeclaredGlobals(globalScope, configGlobals, { exportedVariables, enabledGlobals }) { // Define configured global variables. for (const id of new Set([...Object.keys(configGlobals), ...Object.keys(enabledGlobals)])) { /* * `ConfigOps.normalizeConfigGlobal` will throw an error if a configured global value is invalid. However, these errors would * typically be caught when validating a config anyway (validity for inline global comments is checked separately). */ const configValue = configGlobals[id] === void 0 ? void 0 : ConfigOps.normalizeConfigGlobal(configGlobals[id]); const commentValue = enabledGlobals[id] && enabledGlobals[id].value; const value = commentValue || configValue; const sourceComments = enabledGlobals[id] && enabledGlobals[id].comments; if (value === "off") { continue; } let variable = globalScope.set.get(id); if (!variable) { variable = new eslintScope.Variable(id, globalScope); globalScope.variables.push(variable); globalScope.set.set(id, variable); } variable.eslintImplicitGlobalSetting = configValue; variable.eslintExplicitGlobal = sourceComments !== void 0; variable.eslintExplicitGlobalComments = sourceComments; variable.writeable = (value === "writable"); } // mark all exported variables as such Object.keys(exportedVariables).forEach(name => { const variable = globalScope.set.get(name); if (variable) { variable.eslintUsed = true; } }); /* * "through" contains all references which definitions cannot be found. * Since we augment the global scope using configuration, we need to update * references and remove the ones that were added by configuration. */ globalScope.through = globalScope.through.filter(reference => { const name = reference.identifier.name; const variable = globalScope.set.get(name); if (variable) { /* * Links the variable and the reference. * And this reference is removed from `Scope#through`. */ reference.resolved = variable; variable.references.push(reference); return false; } return true; }); }
javascript
function addDeclaredGlobals(globalScope, configGlobals, { exportedVariables, enabledGlobals }) { // Define configured global variables. for (const id of new Set([...Object.keys(configGlobals), ...Object.keys(enabledGlobals)])) { /* * `ConfigOps.normalizeConfigGlobal` will throw an error if a configured global value is invalid. However, these errors would * typically be caught when validating a config anyway (validity for inline global comments is checked separately). */ const configValue = configGlobals[id] === void 0 ? void 0 : ConfigOps.normalizeConfigGlobal(configGlobals[id]); const commentValue = enabledGlobals[id] && enabledGlobals[id].value; const value = commentValue || configValue; const sourceComments = enabledGlobals[id] && enabledGlobals[id].comments; if (value === "off") { continue; } let variable = globalScope.set.get(id); if (!variable) { variable = new eslintScope.Variable(id, globalScope); globalScope.variables.push(variable); globalScope.set.set(id, variable); } variable.eslintImplicitGlobalSetting = configValue; variable.eslintExplicitGlobal = sourceComments !== void 0; variable.eslintExplicitGlobalComments = sourceComments; variable.writeable = (value === "writable"); } // mark all exported variables as such Object.keys(exportedVariables).forEach(name => { const variable = globalScope.set.get(name); if (variable) { variable.eslintUsed = true; } }); /* * "through" contains all references which definitions cannot be found. * Since we augment the global scope using configuration, we need to update * references and remove the ones that were added by configuration. */ globalScope.through = globalScope.through.filter(reference => { const name = reference.identifier.name; const variable = globalScope.set.get(name); if (variable) { /* * Links the variable and the reference. * And this reference is removed from `Scope#through`. */ reference.resolved = variable; variable.references.push(reference); return false; } return true; }); }
[ "function", "addDeclaredGlobals", "(", "globalScope", ",", "configGlobals", ",", "{", "exportedVariables", ",", "enabledGlobals", "}", ")", "{", "// Define configured global variables.", "for", "(", "const", "id", "of", "new", "Set", "(", "[", "...", "Object", "."...
------------------------------------------------------------------------------ Helpers ------------------------------------------------------------------------------ Ensures that variables representing built-in properties of the Global Object, and any globals declared by special block comments, are present in the global scope. @param {Scope} globalScope The global scope. @param {Object} configGlobals The globals declared in configuration @param {{exportedVariables: Object, enabledGlobals: Object}} commentDirectives Directives from comment configuration @returns {void}
[ "------------------------------------------------------------------------------", "Helpers", "------------------------------------------------------------------------------", "Ensures", "that", "variables", "representing", "built", "-", "in", "properties", "of", "the", "Global", "Object"...
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/linter.js#L73-L138
train
Adds defined global variables to the global scope.
[ 30522, 3853, 5587, 3207, 20464, 12069, 2094, 23296, 16429, 9777, 1006, 3795, 26127, 1010, 9530, 8873, 13871, 4135, 10264, 2015, 1010, 1063, 15612, 10755, 19210, 2015, 1010, 9124, 23296, 16429, 9777, 1065, 1007, 1063, 1013, 1013, 9375, 26928, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Icon.js
function (vColor) { if (vColor != null && vColor !== "" && !CSSColor.isValid(vColor) && !(vColor in IconColor)) { Log.error("\"" + vColor + "\" is not of type sap.ui.core.CSSColor nor of type sap.ui.core.IconColor."); return false; } else { return true; } }
javascript
function (vColor) { if (vColor != null && vColor !== "" && !CSSColor.isValid(vColor) && !(vColor in IconColor)) { Log.error("\"" + vColor + "\" is not of type sap.ui.core.CSSColor nor of type sap.ui.core.IconColor."); return false; } else { return true; } }
[ "function", "(", "vColor", ")", "{", "if", "(", "vColor", "!=", "null", "&&", "vColor", "!==", "\"\"", "&&", "!", "CSSColor", ".", "isValid", "(", "vColor", ")", "&&", "!", "(", "vColor", "in", "IconColor", ")", ")", "{", "Log", ".", "error", "(", ...
Validates whether an input color is a valid color of type <code>sap.ui.core.CSSColor</code> or <code>sap.ui.core.IconColor</code>. undefined, null and an empty string are also valid. In case the color is not valid, an error gets logged to the console. @param {sap.ui.core.CSSColor|sap.ui.core.IconColor|null|undefined|string} vColor input color. In case a string value other than <code>sap.ui.core.CSSColor</code> or <code>sap.ui.core.IconColor</code> is passed, only an empty string is a valid value. @returns {boolean} True in case the color is valid and false in case it is not valid. @private
[ "Validates", "whether", "an", "input", "color", "is", "a", "valid", "color", "of", "type", "<code", ">", "sap", ".", "ui", ".", "core", ".", "CSSColor<", "/", "code", ">", "or", "<code", ">", "sap", ".", "ui", ".", "core", ".", "IconColor<", "/", "...
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Icon.js#L48-L55
train
Checks if the given color is valid
[ 30522, 3853, 1006, 18315, 12898, 2099, 1007, 1063, 2065, 1006, 18315, 12898, 2099, 999, 1027, 19701, 1004, 1004, 18315, 12898, 2099, 999, 1027, 1027, 1000, 1000, 1004, 1004, 999, 20116, 9363, 10626, 1012, 2003, 10175, 3593, 1006, 18315, 128...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/core/routing/Router.js
function (bIgnoreInitialHash) { var that = this; if (!this.oHashChanger) { this.oHashChanger = HashChanger.getInstance().createRouterHashChanger(); } if (this._bIsInitialized) { Log.warning("Router is already initialized.", this); return this; } this._bIsInitialized = true; this._bLastHashReplaced = false; this._bHashChangedAfterTitleChange = false; this.fnHashChanged = function(oEvent) { that.parse(oEvent.getParameter("newHash")); that._bHashChangedAfterTitleChange = true; }; if (!this.oHashChanger) { Log.error("navTo of the router is called before the router is initialized. If you want to replace the current hash before you initialize the router you may use getUrl and use replaceHash of the Hashchanger.", this); return this; } if (this._oTargets) { var oHomeRoute = this._oRoutes[this._oConfig.homeRoute]; this._oTargets.attachTitleChanged(function(oEvent) { var oEventParameters = oEvent.getParameters(); if (oHomeRoute && isHomeRouteTarget(oEventParameters.name, oHomeRoute._oConfig.name)) { oEventParameters.isHome = true; } this.fireTitleChanged(oEventParameters); }, this); this._aHistory = []; // Add the initial home route entry to history var oHomeRouteEntry = oHomeRoute && getHomeEntry(this._oOwner, oHomeRoute); if (oHomeRouteEntry) { this._aHistory.push(oHomeRouteEntry); } } this.oHashChanger.init(); // initialized because whether the current hash is parsed is // controlled by the 'bSuppressHashParsing' parameter and the // 'hashchanged' event which may be fired from hashChanger.init() // shouldn't be processed. this.oHashChanger.attachEvent("hashChanged", this.fnHashChanged); if (!bIgnoreInitialHash) { this.parse(this.oHashChanger.getHash()); } return this; }
javascript
function (bIgnoreInitialHash) { var that = this; if (!this.oHashChanger) { this.oHashChanger = HashChanger.getInstance().createRouterHashChanger(); } if (this._bIsInitialized) { Log.warning("Router is already initialized.", this); return this; } this._bIsInitialized = true; this._bLastHashReplaced = false; this._bHashChangedAfterTitleChange = false; this.fnHashChanged = function(oEvent) { that.parse(oEvent.getParameter("newHash")); that._bHashChangedAfterTitleChange = true; }; if (!this.oHashChanger) { Log.error("navTo of the router is called before the router is initialized. If you want to replace the current hash before you initialize the router you may use getUrl and use replaceHash of the Hashchanger.", this); return this; } if (this._oTargets) { var oHomeRoute = this._oRoutes[this._oConfig.homeRoute]; this._oTargets.attachTitleChanged(function(oEvent) { var oEventParameters = oEvent.getParameters(); if (oHomeRoute && isHomeRouteTarget(oEventParameters.name, oHomeRoute._oConfig.name)) { oEventParameters.isHome = true; } this.fireTitleChanged(oEventParameters); }, this); this._aHistory = []; // Add the initial home route entry to history var oHomeRouteEntry = oHomeRoute && getHomeEntry(this._oOwner, oHomeRoute); if (oHomeRouteEntry) { this._aHistory.push(oHomeRouteEntry); } } this.oHashChanger.init(); // initialized because whether the current hash is parsed is // controlled by the 'bSuppressHashParsing' parameter and the // 'hashchanged' event which may be fired from hashChanger.init() // shouldn't be processed. this.oHashChanger.attachEvent("hashChanged", this.fnHashChanged); if (!bIgnoreInitialHash) { this.parse(this.oHashChanger.getHash()); } return this; }
[ "function", "(", "bIgnoreInitialHash", ")", "{", "var", "that", "=", "this", ";", "if", "(", "!", "this", ".", "oHashChanger", ")", "{", "this", ".", "oHashChanger", "=", "HashChanger", ".", "getInstance", "(", ")", ".", "createRouterHashChanger", "(", ")"...
Attaches the router to the hash changer @see sap.ui.core.routing.HashChanger @param {boolean} [bIgnoreInitialHash=false] @since 1.48.0 whether the current url hash shouldn't be parsed after the router is initialized @public @returns {sap.ui.core.routing.Router} this for chaining.
[ "Attaches", "the", "router", "to", "the", "hash", "changer", "@see", "sap", ".", "ui", ".", "core", ".", "routing", ".", "HashChanger" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/routing/Router.js#L319-L383
train
Initializes the hashChanger
[ 30522, 3853, 1006, 2502, 12131, 12377, 29050, 2140, 14949, 2232, 1007, 1063, 13075, 2008, 1027, 2023, 1025, 2065, 1006, 999, 2023, 1012, 2821, 11823, 22305, 2121, 1007, 1063, 2023, 1012, 2821, 11823, 22305, 2121, 1027, 23325, 22305, 2121, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/LiveDevelopment/LiveDevelopment.js
_onDirtyFlagChange
function _onDirtyFlagChange(event, doc) { if (doc && Inspector.connected() && _server && agents.network && agents.network.wasURLRequested(_server.pathToUrl(doc.file.fullPath))) { // Set status to out of sync if dirty. Otherwise, set it to active status. _setStatus(_docIsOutOfSync(doc) ? STATUS_OUT_OF_SYNC : STATUS_ACTIVE); } }
javascript
function _onDirtyFlagChange(event, doc) { if (doc && Inspector.connected() && _server && agents.network && agents.network.wasURLRequested(_server.pathToUrl(doc.file.fullPath))) { // Set status to out of sync if dirty. Otherwise, set it to active status. _setStatus(_docIsOutOfSync(doc) ? STATUS_OUT_OF_SYNC : STATUS_ACTIVE); } }
[ "function", "_onDirtyFlagChange", "(", "event", ",", "doc", ")", "{", "if", "(", "doc", "&&", "Inspector", ".", "connected", "(", ")", "&&", "_server", "&&", "agents", ".", "network", "&&", "agents", ".", "network", ".", "wasURLRequested", "(", "_server", ...
Triggered by a change in dirty flag from the DocumentManager
[ "Triggered", "by", "a", "change", "in", "dirty", "flag", "from", "the", "DocumentManager" ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/LiveDevelopment/LiveDevelopment.js#L1491-L1497
train
Called when the doc is dirty
[ 30522, 3853, 1035, 2006, 4305, 5339, 2100, 10258, 8490, 22305, 2063, 1006, 2724, 1010, 9986, 1007, 1063, 2065, 1006, 9986, 1004, 1004, 7742, 1012, 4198, 1006, 1007, 1004, 1004, 1035, 8241, 1004, 1004, 6074, 1012, 2897, 1004, 1004, 6074, 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...
angular/material
src/core/services/registry/componentRegistry.js
function(handle) { if (isValidID(handle)) { var deferred = $q.defer(); var instance = self.get(handle); if (instance) { deferred.resolve(instance); } else { if (pendings[handle] === undefined) { pendings[handle] = []; } pendings[handle].push(deferred); } return deferred.promise; } return $q.reject("Invalid `md-component-id` value."); }
javascript
function(handle) { if (isValidID(handle)) { var deferred = $q.defer(); var instance = self.get(handle); if (instance) { deferred.resolve(instance); } else { if (pendings[handle] === undefined) { pendings[handle] = []; } pendings[handle].push(deferred); } return deferred.promise; } return $q.reject("Invalid `md-component-id` value."); }
[ "function", "(", "handle", ")", "{", "if", "(", "isValidID", "(", "handle", ")", ")", "{", "var", "deferred", "=", "$q", ".", "defer", "(", ")", ";", "var", "instance", "=", "self", ".", "get", "(", "handle", ")", ";", "if", "(", "instance", ")",...
Async accessor to registered component instance If not available then a promise is created to notify all listeners when the instance is registered.
[ "Async", "accessor", "to", "registered", "component", "instance", "If", "not", "available", "then", "a", "promise", "is", "created", "to", "notify", "all", "listeners", "when", "the", "instance", "is", "registered", "." ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/services/registry/componentRegistry.js#L99-L116
train
Return a promise that resolves to the instance of the component with the given handle.
[ 30522, 3853, 1006, 5047, 1007, 1063, 2065, 1006, 2003, 10175, 28173, 2094, 1006, 5047, 1007, 1007, 1063, 13075, 13366, 28849, 2094, 1027, 1002, 1053, 1012, 13366, 2121, 1006, 1007, 1025, 13075, 6013, 1027, 2969, 1012, 2131, 1006, 5047, 1007...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
aframevr/aframe
src/utils/src-loader.js
checkIsImage
function checkIsImage (src, onResult) { var request; if (src.tagName) { onResult(src.tagName === 'IMG'); return; } request = new XMLHttpRequest(); // Try to send HEAD request to check if image first. request.open('HEAD', src); request.addEventListener('load', function (event) { var contentType; if (request.status >= 200 && request.status < 300) { contentType = request.getResponseHeader('Content-Type'); if (contentType == null) { checkIsImageFallback(src, onResult); } else { if (contentType.startsWith('image')) { onResult(true); } else { onResult(false); } } } else { checkIsImageFallback(src, onResult); } request.abort(); }); request.send(); }
javascript
function checkIsImage (src, onResult) { var request; if (src.tagName) { onResult(src.tagName === 'IMG'); return; } request = new XMLHttpRequest(); // Try to send HEAD request to check if image first. request.open('HEAD', src); request.addEventListener('load', function (event) { var contentType; if (request.status >= 200 && request.status < 300) { contentType = request.getResponseHeader('Content-Type'); if (contentType == null) { checkIsImageFallback(src, onResult); } else { if (contentType.startsWith('image')) { onResult(true); } else { onResult(false); } } } else { checkIsImageFallback(src, onResult); } request.abort(); }); request.send(); }
[ "function", "checkIsImage", "(", "src", ",", "onResult", ")", "{", "var", "request", ";", "if", "(", "src", ".", "tagName", ")", "{", "onResult", "(", "src", ".", "tagName", "===", "'IMG'", ")", ";", "return", ";", "}", "request", "=", "new", "XMLHtt...
Call back whether `src` is an image. @param {string|Element} src - URL or element that will be tested. @param {function} onResult - Callback with whether `src` is an image.
[ "Call", "back", "whether", "src", "is", "an", "image", "." ]
24acc78a7299a4cdfe3ef617f4d40ddf6275c992
https://github.com/aframevr/aframe/blob/24acc78a7299a4cdfe3ef617f4d40ddf6275c992/src/utils/src-loader.js#L91-L121
train
Check if src is an image
[ 30522, 3853, 4638, 17417, 26860, 1006, 5034, 2278, 1010, 2006, 6072, 11314, 1007, 1063, 13075, 5227, 1025, 2065, 1006, 5034, 2278, 1012, 6415, 18442, 1007, 1063, 2006, 6072, 11314, 1006, 5034, 2278, 1012, 6415, 18442, 1027, 1027, 1027, 1005...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.table/src/sap/ui/table/TableAccExtension.js
function(oExtension, $Cell, aDefaultLabels, aDefaultDescriptions, aLabels, aDescriptions, sText, fAdapt) { ExtensionHelper.storeDefaultsBeforeCellModifications(oExtension, $Cell, aDefaultLabels, aDefaultDescriptions); var oCountChangeInfo = ExtensionHelper.updateRowColCount(oExtension); oExtension.getTable().$("cellacc").text(sText || " "); //set the custom text to the prepared hidden element if (fAdapt) { //Allow to adapt the labels / descriptions based on the changed row / column count fAdapt(aLabels, aDescriptions, oCountChangeInfo.rowChange, oCountChangeInfo.colChange, oCountChangeInfo.initial); } var sLabel = ""; if (oCountChangeInfo.initial) { var oTable = oExtension.getTable(); sLabel = oTable.getAriaLabelledBy().join(" ") + " " + oTable.getId() + "-ariacount"; if (oTable.getSelectionMode() !== SelectionMode.None) { sLabel = sLabel + " " + oTable.getId() + "-ariaselection"; } } if (aLabels && aLabels.length) { sLabel = sLabel + " " + aLabels.join(" "); } $Cell.attr({ "aria-labelledby": sLabel ? sLabel : null, "aria-describedby": aDescriptions && aDescriptions.length ? aDescriptions.join(" ") : null }); }
javascript
function(oExtension, $Cell, aDefaultLabels, aDefaultDescriptions, aLabels, aDescriptions, sText, fAdapt) { ExtensionHelper.storeDefaultsBeforeCellModifications(oExtension, $Cell, aDefaultLabels, aDefaultDescriptions); var oCountChangeInfo = ExtensionHelper.updateRowColCount(oExtension); oExtension.getTable().$("cellacc").text(sText || " "); //set the custom text to the prepared hidden element if (fAdapt) { //Allow to adapt the labels / descriptions based on the changed row / column count fAdapt(aLabels, aDescriptions, oCountChangeInfo.rowChange, oCountChangeInfo.colChange, oCountChangeInfo.initial); } var sLabel = ""; if (oCountChangeInfo.initial) { var oTable = oExtension.getTable(); sLabel = oTable.getAriaLabelledBy().join(" ") + " " + oTable.getId() + "-ariacount"; if (oTable.getSelectionMode() !== SelectionMode.None) { sLabel = sLabel + " " + oTable.getId() + "-ariaselection"; } } if (aLabels && aLabels.length) { sLabel = sLabel + " " + aLabels.join(" "); } $Cell.attr({ "aria-labelledby": sLabel ? sLabel : null, "aria-describedby": aDescriptions && aDescriptions.length ? aDescriptions.join(" ") : null }); }
[ "function", "(", "oExtension", ",", "$Cell", ",", "aDefaultLabels", ",", "aDefaultDescriptions", ",", "aLabels", ",", "aDescriptions", ",", "sText", ",", "fAdapt", ")", "{", "ExtensionHelper", ".", "storeDefaultsBeforeCellModifications", "(", "oExtension", ",", "$Ce...
/* Updates the row / column counters, adapts the labels and descriptions of the given cell and stores the the given defaults before the modification. @see ExtensionHelper.updateRowColCount @see ExtensionHelper.storeDefaultsBeforeCellModifications
[ "/", "*", "Updates", "the", "row", "/", "column", "counters", "adapts", "the", "labels", "and", "descriptions", "of", "the", "given", "cell", "and", "stores", "the", "the", "given", "defaults", "before", "the", "modification", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableAccExtension.js#L307-L333
train
Updates the default values of the cell
[ 30522, 3853, 1006, 1051, 10288, 29048, 1010, 1002, 3526, 1010, 4748, 12879, 23505, 20470, 9050, 1010, 4748, 12879, 23505, 6155, 23235, 8496, 1010, 21862, 8671, 2015, 1010, 4748, 2229, 23235, 8496, 1010, 26261, 18413, 1010, 6904, 2850, 13876, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/lists.js
all
function all(fn, list) { return !list || ( fn(head(list)) && all(fn, tail(list)) ); }
javascript
function all(fn, list) { return !list || ( fn(head(list)) && all(fn, tail(list)) ); }
[ "function", "all", "(", "fn", ",", "list", ")", "{", "return", "!", "list", "||", "(", "fn", "(", "head", "(", "list", ")", ")", "&&", "all", "(", "fn", ",", "tail", "(", "list", ")", ")", ")", ";", "}" ]
Returns true if the given function holds for every item in the list, false otherwise
[ "Returns", "true", "if", "the", "given", "function", "holds", "for", "every", "item", "in", "the", "list", "false", "otherwise" ]
992929ffccac68827869a497f01ee4d653ed4f25
https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/tracing/third_party/oboe/src/lists.js#L147-L151
train
Returns true if fn returns true for all elements in list
[ 30522, 3853, 2035, 1006, 1042, 2078, 1010, 2862, 1007, 1063, 2709, 999, 2862, 1064, 1064, 1006, 1042, 2078, 1006, 2132, 1006, 2862, 1007, 1007, 1004, 1004, 2035, 1006, 1042, 2078, 1010, 5725, 1006, 2862, 1007, 1007, 1007, 1025, 1065, 102,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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_FILETIME
function parse_FILETIME(blob) { var dwLowDateTime = blob.read_shift(4), dwHighDateTime = blob.read_shift(4); return new Date(((dwHighDateTime/1e7*Math.pow(2,32) + dwLowDateTime/1e7) - 11644473600)*1000).toISOString().replace(/\.000/,""); }
javascript
function parse_FILETIME(blob) { var dwLowDateTime = blob.read_shift(4), dwHighDateTime = blob.read_shift(4); return new Date(((dwHighDateTime/1e7*Math.pow(2,32) + dwLowDateTime/1e7) - 11644473600)*1000).toISOString().replace(/\.000/,""); }
[ "function", "parse_FILETIME", "(", "blob", ")", "{", "var", "dwLowDateTime", "=", "blob", ".", "read_shift", "(", "4", ")", ",", "dwHighDateTime", "=", "blob", ".", "read_shift", "(", "4", ")", ";", "return", "new", "Date", "(", "(", "(", "dwHighDateTime...
/* [MS-DTYP] 2.3.3 FILETIME /* [MS-OLEDS] 2.1.3 FILETIME (Packet Version) /* [MS-OLEPS] 2.8 FILETIME (Packet Version)
[ "/", "*", "[", "MS", "-", "DTYP", "]", "2", ".", "3", ".", "3", "FILETIME", "/", "*", "[", "MS", "-", "OLEDS", "]", "2", ".", "1", ".", "3", "FILETIME", "(", "Packet", "Version", ")", "/", "*", "[", "MS", "-", "OLEPS", "]", "2", ".", "8",...
9a6d8a1d3d80c78dad5201fb389316f935279cdc
https://github.com/SheetJS/js-xlsx/blob/9a6d8a1d3d80c78dad5201fb389316f935279cdc/xlsx.js#L4971-L4974
train
Parse FILETIME
[ 30522, 3853, 11968, 3366, 1035, 5371, 7292, 1006, 1038, 4135, 2497, 1007, 1063, 13075, 1040, 13668, 5004, 13701, 7292, 1027, 1038, 4135, 2497, 1012, 3191, 1035, 5670, 1006, 1018, 1007, 1010, 1040, 2860, 4048, 5603, 13701, 7292, 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...
angular/material
src/core/util/animation/animate.js
function (element, originator) { var zoomTemplate = "translate3d( {centerX}px, {centerY}px, 0 ) scale( {scaleX}, {scaleY} )"; var buildZoom = angular.bind(null, $mdUtil.supplant, zoomTemplate); return buildZoom(self.calculateTransformValues(element, originator)); }
javascript
function (element, originator) { var zoomTemplate = "translate3d( {centerX}px, {centerY}px, 0 ) scale( {scaleX}, {scaleY} )"; var buildZoom = angular.bind(null, $mdUtil.supplant, zoomTemplate); return buildZoom(self.calculateTransformValues(element, originator)); }
[ "function", "(", "element", ",", "originator", ")", "{", "var", "zoomTemplate", "=", "\"translate3d( {centerX}px, {centerY}px, 0 ) scale( {scaleX}, {scaleY} )\"", ";", "var", "buildZoom", "=", "angular", ".", "bind", "(", "null", ",", "$mdUtil", ".", "supplant", ",", ...
Calculate the zoom transform from dialog to origin. We use this to set the dialog position immediately; then the md-transition-in actually translates back to `translate3d(0,0,0) scale(1.0)`... NOTE: all values are rounded to the nearest integer
[ "Calculate", "the", "zoom", "transform", "from", "dialog", "to", "origin", "." ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/util/animation/animate.js#L143-L148
train
Calculate the zoom transform for the element
[ 30522, 3853, 1006, 5783, 1010, 4761, 8844, 1007, 1063, 13075, 24095, 18532, 15725, 1027, 1000, 17637, 29097, 1006, 1063, 2415, 2595, 1065, 1052, 2595, 1010, 1063, 2415, 2100, 1065, 1052, 2595, 1010, 1014, 1007, 4094, 1006, 1063, 4094, 2595,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.m/src/sap/m/ColorPalette.js
function (sColor) { var sHexColor = ""; if (!sColor || sColor.toLowerCase().indexOf("hsl") !== -1) { return undefined; } // named color if (sColor.indexOf("#") === -1) { return this.NAME_COLORS_TO_RGB_MAP[sColor.toLowerCase()] ? sColor.toLowerCase() : undefined; } //HEX value if (sColor.length === 4) { sHexColor = ["#", sColor[1], sColor[1], sColor[2], sColor[2], sColor[3], sColor[3]].join(""); } else { sHexColor = sColor; } sHexColor = sHexColor.toUpperCase(); return this.RGB_TO_NAMED_COLORS_MAP[sHexColor]; }
javascript
function (sColor) { var sHexColor = ""; if (!sColor || sColor.toLowerCase().indexOf("hsl") !== -1) { return undefined; } // named color if (sColor.indexOf("#") === -1) { return this.NAME_COLORS_TO_RGB_MAP[sColor.toLowerCase()] ? sColor.toLowerCase() : undefined; } //HEX value if (sColor.length === 4) { sHexColor = ["#", sColor[1], sColor[1], sColor[2], sColor[2], sColor[3], sColor[3]].join(""); } else { sHexColor = sColor; } sHexColor = sHexColor.toUpperCase(); return this.RGB_TO_NAMED_COLORS_MAP[sHexColor]; }
[ "function", "(", "sColor", ")", "{", "var", "sHexColor", "=", "\"\"", ";", "if", "(", "!", "sColor", "||", "sColor", ".", "toLowerCase", "(", ")", ".", "indexOf", "(", "\"hsl\"", ")", "!==", "-", "1", ")", "{", "return", "undefined", ";", "}", "// ...
Returns a named color for given color. For example - "gold" for input "#FFB200". @param {string} sColor the given color @return {string|undefined} The named color, if such can really corresponds to the input color, or undefined otherwise.
[ "Returns", "a", "named", "color", "for", "given", "color", ".", "For", "example", "-", "gold", "for", "input", "#FFB200", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/ColorPalette.js#L922-L944
train
Returns the named color if it exists otherwise returns undefined
[ 30522, 3853, 1006, 8040, 12898, 2099, 1007, 1063, 13075, 2016, 2595, 18717, 1027, 1000, 1000, 1025, 2065, 1006, 999, 8040, 12898, 2099, 1064, 1064, 8040, 12898, 2099, 1012, 2000, 27663, 18992, 3366, 1006, 1007, 1012, 5950, 11253, 1006, 1000...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.m/src/sap/m/TimePickerSlider.js
function (oEvent) { var iPageY = oEvent.touches && oEvent.touches.length ? oEvent.touches[0].pageY : oEvent.pageY; this._bIsDrag = false; if (!this.getIsExpanded()) { return; } this._stopAnimation(); this._startDrag(iPageY); oEvent.preventDefault(); this._mousedown = true; }
javascript
function (oEvent) { var iPageY = oEvent.touches && oEvent.touches.length ? oEvent.touches[0].pageY : oEvent.pageY; this._bIsDrag = false; if (!this.getIsExpanded()) { return; } this._stopAnimation(); this._startDrag(iPageY); oEvent.preventDefault(); this._mousedown = true; }
[ "function", "(", "oEvent", ")", "{", "var", "iPageY", "=", "oEvent", ".", "touches", "&&", "oEvent", ".", "touches", ".", "length", "?", "oEvent", ".", "touches", "[", "0", "]", ".", "pageY", ":", "oEvent", ".", "pageY", ";", "this", ".", "_bIsDrag",...
Default onTouchStart handler. @param {jQuery.Event} oEvent Event object
[ "Default", "onTouchStart", "handler", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/TimePickerSlider.js#L1235-L1248
train
Dragging the page
[ 30522, 3853, 1006, 1051, 18697, 3372, 1007, 1063, 13075, 24531, 3351, 2100, 1027, 1051, 18697, 3372, 1012, 12817, 1004, 1004, 1051, 18697, 3372, 1012, 12817, 1012, 3091, 1029, 1051, 18697, 3372, 1012, 12817, 1031, 1014, 1033, 1012, 3931, 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...
apache/incubator-echarts
src/data/helper/linkList.js
linkList
function linkList(opt) { var mainData = opt.mainData; var datas = opt.datas; if (!datas) { datas = {main: mainData}; opt.datasAttr = {main: 'data'}; } opt.datas = opt.mainData = null; linkAll(mainData, datas, opt); // Porxy data original methods. each(datas, function (data) { each(mainData.TRANSFERABLE_METHODS, function (methodName) { data.wrapMethod(methodName, zrUtil.curry(transferInjection, opt)); }); }); // Beyond transfer, additional features should be added to `cloneShallow`. mainData.wrapMethod('cloneShallow', zrUtil.curry(cloneShallowInjection, opt)); // Only mainData trigger change, because struct.update may trigger // another changable methods, which may bring about dead lock. each(mainData.CHANGABLE_METHODS, function (methodName) { mainData.wrapMethod(methodName, zrUtil.curry(changeInjection, opt)); }); // Make sure datas contains mainData. zrUtil.assert(datas[mainData.dataType] === mainData); }
javascript
function linkList(opt) { var mainData = opt.mainData; var datas = opt.datas; if (!datas) { datas = {main: mainData}; opt.datasAttr = {main: 'data'}; } opt.datas = opt.mainData = null; linkAll(mainData, datas, opt); // Porxy data original methods. each(datas, function (data) { each(mainData.TRANSFERABLE_METHODS, function (methodName) { data.wrapMethod(methodName, zrUtil.curry(transferInjection, opt)); }); }); // Beyond transfer, additional features should be added to `cloneShallow`. mainData.wrapMethod('cloneShallow', zrUtil.curry(cloneShallowInjection, opt)); // Only mainData trigger change, because struct.update may trigger // another changable methods, which may bring about dead lock. each(mainData.CHANGABLE_METHODS, function (methodName) { mainData.wrapMethod(methodName, zrUtil.curry(changeInjection, opt)); }); // Make sure datas contains mainData. zrUtil.assert(datas[mainData.dataType] === mainData); }
[ "function", "linkList", "(", "opt", ")", "{", "var", "mainData", "=", "opt", ".", "mainData", ";", "var", "datas", "=", "opt", ".", "datas", ";", "if", "(", "!", "datas", ")", "{", "datas", "=", "{", "main", ":", "mainData", "}", ";", "opt", ".",...
Caution: In most case, either list or its shallow clones (see list.cloneShallow) is active in echarts process. So considering heap memory consumption, we do not clone tree or graph, but share them among list and its shallow clones. But in some rare case, we have to keep old list (like do animation in chart). So please take care that both the old list and the new list share the same tree/graph. @param {Object} opt @param {module:echarts/data/List} opt.mainData @param {Object} [opt.struct] For example, instance of Graph or Tree. @param {string} [opt.structAttr] designation: list[structAttr] = struct; @param {Object} [opt.datas] {dataType: data}, like: {node: nodeList, edge: edgeList}. Should contain mainData. @param {Object} [opt.datasAttr] {dataType: attr}, designation: struct[datasAttr[dataType]] = list;
[ "Caution", ":", "In", "most", "case", "either", "list", "or", "its", "shallow", "clones", "(", "see", "list", ".", "cloneShallow", ")", "is", "active", "in", "echarts", "process", ".", "So", "considering", "heap", "memory", "consumption", "we", "do", "not"...
4d0ea095dc3929cb6de40c45748826e7999c7aa8
https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/data/helper/linkList.js#L49-L80
train
Link all the methods to the next class.
[ 30522, 3853, 4957, 9863, 1006, 23569, 1007, 1063, 13075, 2364, 2850, 2696, 1027, 23569, 1012, 2364, 2850, 2696, 1025, 13075, 2951, 2015, 1027, 23569, 1012, 2951, 2015, 1025, 2065, 1006, 999, 2951, 2015, 1007, 1063, 2951, 2015, 1027, 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...
angular/protractor
lib/clientsidescripts.js
getNg1Hooks
function getNg1Hooks(selector, injectorPlease) { function tryEl(el) { try { if (!injectorPlease && angular.getTestability) { var $$testability = angular.getTestability(el); if ($$testability) { return {$$testability: $$testability}; } } else { var $injector = angular.element(el).injector(); if ($injector) { return {$injector: $injector}; } } } catch(err) {} } function trySelector(selector) { var els = document.querySelectorAll(selector); for (var i = 0; i < els.length; i++) { var elHooks = tryEl(els[i]); if (elHooks) { return elHooks; } } } if (selector) { return trySelector(selector); } else if (window.__TESTABILITY__NG1_APP_ROOT_INJECTOR__) { var $injector = window.__TESTABILITY__NG1_APP_ROOT_INJECTOR__; var $$testability = null; try { $$testability = $injector.get('$$testability'); } catch (e) {} return {$injector: $injector, $$testability: $$testability}; } else { return tryEl(document.body) || trySelector('[ng-app]') || trySelector('[ng\\:app]') || trySelector('[ng-controller]') || trySelector('[ng\\:controller]'); } }
javascript
function getNg1Hooks(selector, injectorPlease) { function tryEl(el) { try { if (!injectorPlease && angular.getTestability) { var $$testability = angular.getTestability(el); if ($$testability) { return {$$testability: $$testability}; } } else { var $injector = angular.element(el).injector(); if ($injector) { return {$injector: $injector}; } } } catch(err) {} } function trySelector(selector) { var els = document.querySelectorAll(selector); for (var i = 0; i < els.length; i++) { var elHooks = tryEl(els[i]); if (elHooks) { return elHooks; } } } if (selector) { return trySelector(selector); } else if (window.__TESTABILITY__NG1_APP_ROOT_INJECTOR__) { var $injector = window.__TESTABILITY__NG1_APP_ROOT_INJECTOR__; var $$testability = null; try { $$testability = $injector.get('$$testability'); } catch (e) {} return {$injector: $injector, $$testability: $$testability}; } else { return tryEl(document.body) || trySelector('[ng-app]') || trySelector('[ng\\:app]') || trySelector('[ng-controller]') || trySelector('[ng\\:controller]'); } }
[ "function", "getNg1Hooks", "(", "selector", ",", "injectorPlease", ")", "{", "function", "tryEl", "(", "el", ")", "{", "try", "{", "if", "(", "!", "injectorPlease", "&&", "angular", ".", "getTestability", ")", "{", "var", "$$testability", "=", "angular", "...
/* Tries to find $$testability and possibly $injector for an ng1 app By default, doesn't care about $injector if it finds $$testability. However, these priorities can be reversed. @param {string=} selector The selector for the element with the injector. If falsy, tries a variety of methods to find an injector @param {boolean=} injectorPlease Prioritize finding an injector @return {$$testability?: Testability, $injector?: Injector} Returns whatever ng1 app hooks it finds
[ "/", "*", "Tries", "to", "find", "$$testability", "and", "possibly", "$injector", "for", "an", "ng1", "app" ]
4f74a4ec753c97adfe955fe468a39286a0a55837
https://github.com/angular/protractor/blob/4f74a4ec753c97adfe955fe468a39286a0a55837/lib/clientsidescripts.js#L75-L115
train
Returns the first hook element that matches the selector
[ 30522, 3853, 2131, 3070, 2487, 6806, 6559, 2015, 1006, 27000, 1010, 1999, 20614, 2953, 10814, 11022, 1007, 1063, 3853, 3046, 2884, 1006, 3449, 1007, 1063, 3046, 1063, 2065, 1006, 999, 1999, 20614, 2953, 10814, 11022, 1004, 1004, 16108, 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...
heyui/heyui
src/plugins/popper/index.js
isModifierRequired
function isModifierRequired(modifiers, requestingName, requestedName) { var requesting = find(modifiers, function (_ref) { var name = _ref.name; return name === requestingName; }); var isRequired = !!requesting && modifiers.some(function (modifier) { return modifier.name === requestedName && modifier.enabled && modifier.order < requesting.order; }); if (!isRequired) { var _requesting = '`' + requestingName + '`'; var requested = '`' + requestedName + '`'; console.warn(requested + ' modifier is required by ' + _requesting + ' modifier in order to work, be sure to include it before ' + _requesting + '!'); } return isRequired; }
javascript
function isModifierRequired(modifiers, requestingName, requestedName) { var requesting = find(modifiers, function (_ref) { var name = _ref.name; return name === requestingName; }); var isRequired = !!requesting && modifiers.some(function (modifier) { return modifier.name === requestedName && modifier.enabled && modifier.order < requesting.order; }); if (!isRequired) { var _requesting = '`' + requestingName + '`'; var requested = '`' + requestedName + '`'; console.warn(requested + ' modifier is required by ' + _requesting + ' modifier in order to work, be sure to include it before ' + _requesting + '!'); } return isRequired; }
[ "function", "isModifierRequired", "(", "modifiers", ",", "requestingName", ",", "requestedName", ")", "{", "var", "requesting", "=", "find", "(", "modifiers", ",", "function", "(", "_ref", ")", "{", "var", "name", "=", "_ref", ".", "name", ";", "return", "...
Helper used to know if the given modifier depends from another one.<br /> It checks if the needed modifier is listed and enabled. @method @memberof Popper.Utils @param {Array} modifiers - list of modifiers @param {String} requestingName - name of requesting modifier @param {String} requestedName - name of requested modifier @returns {Boolean}
[ "Helper", "used", "to", "know", "if", "the", "given", "modifier", "depends", "from", "another", "one", ".", "<br", "/", ">", "It", "checks", "if", "the", "needed", "modifier", "is", "listed", "and", "enabled", "." ]
d5405d27d994151b676eb91c12b389316d7f6679
https://github.com/heyui/heyui/blob/d5405d27d994151b676eb91c12b389316d7f6679/src/plugins/popper/index.js#L1365-L1381
train
Checks if a modifier is required by a particular specification
[ 30522, 3853, 2003, 5302, 4305, 8873, 28849, 15549, 5596, 1006, 16913, 28295, 1010, 17942, 18442, 1010, 7303, 18442, 1007, 1063, 13075, 17942, 1027, 2424, 1006, 16913, 28295, 1010, 3853, 1006, 1035, 25416, 1007, 1063, 13075, 2171, 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...
LLK/scratch-blocks
blocks_vertical/sound.js
function() { this.jsonInit({ "message0": Blockly.Msg.SOUND_SETEFFECTO, "args0": [ { "type": "field_dropdown", "name": "EFFECT", "options": [ [Blockly.Msg.SOUND_EFFECTS_PITCH, 'PITCH'], [Blockly.Msg.SOUND_EFFECTS_PAN, 'PAN'] ] }, { "type": "input_value", "name": "VALUE" } ], "category": Blockly.Categories.sound, "extensions": ["colours_sounds", "shape_statement"] }); }
javascript
function() { this.jsonInit({ "message0": Blockly.Msg.SOUND_SETEFFECTO, "args0": [ { "type": "field_dropdown", "name": "EFFECT", "options": [ [Blockly.Msg.SOUND_EFFECTS_PITCH, 'PITCH'], [Blockly.Msg.SOUND_EFFECTS_PAN, 'PAN'] ] }, { "type": "input_value", "name": "VALUE" } ], "category": Blockly.Categories.sound, "extensions": ["colours_sounds", "shape_statement"] }); }
[ "function", "(", ")", "{", "this", ".", "jsonInit", "(", "{", "\"message0\"", ":", "Blockly", ".", "Msg", ".", "SOUND_SETEFFECTO", ",", "\"args0\"", ":", "[", "{", "\"type\"", ":", "\"field_dropdown\"", ",", "\"name\"", ":", "\"EFFECT\"", ",", "\"options\"",...
Block to set the audio effect @this Blockly.Block
[ "Block", "to", "set", "the", "audio", "effect" ]
455b2a854435c0a67da1da92320ddc3ec3e2b799
https://github.com/LLK/scratch-blocks/blob/455b2a854435c0a67da1da92320ddc3ec3e2b799/blocks_vertical/sound.js#L126-L146
train
Block for the segfault section.
[ 30522, 3853, 1006, 1007, 1063, 2023, 1012, 1046, 3385, 5498, 2102, 1006, 1063, 1000, 4471, 2692, 1000, 1024, 3796, 2135, 1012, 5796, 2290, 1012, 2614, 1035, 2275, 12879, 25969, 2080, 1010, 1000, 12098, 5620, 2692, 1000, 1024, 1031, 1063, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/extensions/default/AutoUpdate/main.js
handleInstallationStatus
function handleInstallationStatus(statusObj) { var errorCode = "", errorline = statusObj.installError; if (errorline) { errorCode = errorline.substr(errorline.lastIndexOf(':') + 2, errorline.length); } HealthLogger.sendAnalyticsData( autoUpdateEventNames.AUTOUPDATE_INSTALLATION_FAILED, "autoUpdate", "install", "fail", errorCode ); }
javascript
function handleInstallationStatus(statusObj) { var errorCode = "", errorline = statusObj.installError; if (errorline) { errorCode = errorline.substr(errorline.lastIndexOf(':') + 2, errorline.length); } HealthLogger.sendAnalyticsData( autoUpdateEventNames.AUTOUPDATE_INSTALLATION_FAILED, "autoUpdate", "install", "fail", errorCode ); }
[ "function", "handleInstallationStatus", "(", "statusObj", ")", "{", "var", "errorCode", "=", "\"\"", ",", "errorline", "=", "statusObj", ".", "installError", ";", "if", "(", "errorline", ")", "{", "errorCode", "=", "errorline", ".", "substr", "(", "errorline",...
Send Installer Error Code to Analytics Server
[ "Send", "Installer", "Error", "Code", "to", "Analytics", "Server" ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/AutoUpdate/main.js#L266-L279
train
Handle installation status
[ 30522, 3853, 5047, 7076, 9080, 13490, 9153, 5809, 1006, 3570, 16429, 3501, 1007, 1063, 13075, 7561, 16044, 1027, 1000, 1000, 1010, 7561, 4179, 1027, 3570, 16429, 3501, 1012, 16500, 2121, 29165, 1025, 2065, 1006, 7561, 4179, 1007, 1063, 7561...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/core/routing/async/Target.js
function (oParentInfo) { var oOptions = this._oOptions, oControl = oParentInfo && oParentInfo.control, bHasTargetControl = (oControl || oOptions.controlId), bIsValid = true, sLogMessage = ""; if (!bHasTargetControl) { sLogMessage = "The target " + oOptions._name + " has no controlId set and no parent so the target cannot be displayed."; bIsValid = false; } if (!oOptions.controlAggregation) { sLogMessage = "The target " + oOptions._name + " has a control id or a parent but no 'controlAggregation' was set, so the target could not be displayed."; bIsValid = false; } if (sLogMessage) { Log.error(sLogMessage, this); } return bIsValid || sLogMessage; }
javascript
function (oParentInfo) { var oOptions = this._oOptions, oControl = oParentInfo && oParentInfo.control, bHasTargetControl = (oControl || oOptions.controlId), bIsValid = true, sLogMessage = ""; if (!bHasTargetControl) { sLogMessage = "The target " + oOptions._name + " has no controlId set and no parent so the target cannot be displayed."; bIsValid = false; } if (!oOptions.controlAggregation) { sLogMessage = "The target " + oOptions._name + " has a control id or a parent but no 'controlAggregation' was set, so the target could not be displayed."; bIsValid = false; } if (sLogMessage) { Log.error(sLogMessage, this); } return bIsValid || sLogMessage; }
[ "function", "(", "oParentInfo", ")", "{", "var", "oOptions", "=", "this", ".", "_oOptions", ",", "oControl", "=", "oParentInfo", "&&", "oParentInfo", ".", "control", ",", "bHasTargetControl", "=", "(", "oControl", "||", "oOptions", ".", "controlId", ")", ","...
Validates the target options, will also be called from the route but route will not log errors @param oParentInfo @returns {boolean|string} returns true if it's valid otherwise the error message @private
[ "Validates", "the", "target", "options", "will", "also", "be", "called", "from", "the", "route", "but", "route", "will", "not", "log", "errors" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/routing/async/Target.js#L277-L299
train
Checks if the target has a control and if so logs an error.
[ 30522, 3853, 1006, 6728, 12069, 16778, 2078, 14876, 30524, 13181, 2140, 1027, 1006, 1051, 8663, 13181, 2140, 1064, 1064, 1051, 7361, 9285, 1012, 2491, 3593, 1007, 1010, 20377, 10175, 3593, 1027, 2995, 1010, 22889, 8649, 7834, 3736, 3351, 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...
expressjs/express
lib/router/index.js
getProtohost
function getProtohost(url) { if (typeof url !== 'string' || url.length === 0 || url[0] === '/') { return undefined } var searchIndex = url.indexOf('?') var pathLength = searchIndex !== -1 ? searchIndex : url.length var fqdnIndex = url.substr(0, pathLength).indexOf('://') return fqdnIndex !== -1 ? url.substr(0, url.indexOf('/', 3 + fqdnIndex)) : undefined }
javascript
function getProtohost(url) { if (typeof url !== 'string' || url.length === 0 || url[0] === '/') { return undefined } var searchIndex = url.indexOf('?') var pathLength = searchIndex !== -1 ? searchIndex : url.length var fqdnIndex = url.substr(0, pathLength).indexOf('://') return fqdnIndex !== -1 ? url.substr(0, url.indexOf('/', 3 + fqdnIndex)) : undefined }
[ "function", "getProtohost", "(", "url", ")", "{", "if", "(", "typeof", "url", "!==", "'string'", "||", "url", ".", "length", "===", "0", "||", "url", "[", "0", "]", "===", "'/'", ")", "{", "return", "undefined", "}", "var", "searchIndex", "=", "url",...
Get get protocol + host for a URL
[ "Get", "get", "protocol", "+", "host", "for", "a", "URL" ]
dc538f6e810bd462c98ee7e6aae24c64d4b1da93
https://github.com/expressjs/express/blob/dc538f6e810bd462c98ee7e6aae24c64d4b1da93/lib/router/index.js#L535-L549
train
Get the protocol of the given url
[ 30522, 3853, 2131, 21572, 3406, 15006, 2102, 1006, 24471, 2140, 1007, 1063, 2065, 1006, 2828, 11253, 24471, 2140, 999, 1027, 1027, 1005, 5164, 1005, 1064, 1064, 24471, 2140, 1012, 3091, 1027, 1027, 1027, 1014, 1064, 1064, 24471, 2140, 1031,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
eslint/eslint
lib/rules/no-unused-vars.js
getFunctionDefinitions
function getFunctionDefinitions(variable) { const functionDefinitions = []; variable.defs.forEach(def => { const { type, node } = def; // FunctionDeclarations if (type === "FunctionName") { functionDefinitions.push(node); } // FunctionExpressions if (type === "Variable" && node.init && (node.init.type === "FunctionExpression" || node.init.type === "ArrowFunctionExpression")) { functionDefinitions.push(node.init); } }); return functionDefinitions; }
javascript
function getFunctionDefinitions(variable) { const functionDefinitions = []; variable.defs.forEach(def => { const { type, node } = def; // FunctionDeclarations if (type === "FunctionName") { functionDefinitions.push(node); } // FunctionExpressions if (type === "Variable" && node.init && (node.init.type === "FunctionExpression" || node.init.type === "ArrowFunctionExpression")) { functionDefinitions.push(node.init); } }); return functionDefinitions; }
[ "function", "getFunctionDefinitions", "(", "variable", ")", "{", "const", "functionDefinitions", "=", "[", "]", ";", "variable", ".", "defs", ".", "forEach", "(", "def", "=>", "{", "const", "{", "type", ",", "node", "}", "=", "def", ";", "// FunctionDeclar...
Gets a list of function definitions for a specified variable. @param {Variable} variable - eslint-scope variable object. @returns {ASTNode[]} Function nodes. @private
[ "Gets", "a", "list", "of", "function", "definitions", "for", "a", "specified", "variable", "." ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/no-unused-vars.js#L233-L251
train
Get Function Definitions
[ 30522, 3853, 2131, 11263, 27989, 3207, 16294, 22753, 2015, 1006, 8023, 1007, 1063, 9530, 3367, 3853, 3207, 16294, 22753, 2015, 1027, 1031, 1033, 1025, 8023, 1012, 13366, 2015, 1012, 18921, 6776, 1006, 13366, 1027, 1028, 1063, 9530, 3367, 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/utils/UpdateNotification.js
_getVersionInfoUrl
function _getVersionInfoUrl(locale, removeCountryPartOfLocale) { locale = locale || brackets.getLocale(); if (removeCountryPartOfLocale) { locale = locale.substring(0, 2); } //AUTOUPDATE_PRERELEASE_BEGIN // The following code is needed for supporting Auto Update in prerelease, //and will be removed eventually for stable releases { if (locale) { if(locale.length > 2) { locale = locale.substring(0, 2); } switch(locale) { case "de": break; case "es": break; case "fr": break; case "ja": break; case "en": default: locale = "en"; } return brackets.config.update_info_url.replace("<locale>", locale); } } //AUTOUPDATE_PRERELEASE_END return brackets.config.update_info_url + '?locale=' + locale; }
javascript
function _getVersionInfoUrl(locale, removeCountryPartOfLocale) { locale = locale || brackets.getLocale(); if (removeCountryPartOfLocale) { locale = locale.substring(0, 2); } //AUTOUPDATE_PRERELEASE_BEGIN // The following code is needed for supporting Auto Update in prerelease, //and will be removed eventually for stable releases { if (locale) { if(locale.length > 2) { locale = locale.substring(0, 2); } switch(locale) { case "de": break; case "es": break; case "fr": break; case "ja": break; case "en": default: locale = "en"; } return brackets.config.update_info_url.replace("<locale>", locale); } } //AUTOUPDATE_PRERELEASE_END return brackets.config.update_info_url + '?locale=' + locale; }
[ "function", "_getVersionInfoUrl", "(", "locale", ",", "removeCountryPartOfLocale", ")", "{", "locale", "=", "locale", "||", "brackets", ".", "getLocale", "(", ")", ";", "if", "(", "removeCountryPartOfLocale", ")", "{", "locale", "=", "locale", ".", "substring", ...
Construct a new version update url with the given locale. @param {string=} locale - optional locale, defaults to 'brackets.getLocale()' when omitted. @param {boolean=} removeCountryPartOfLocale - optional, remove existing country information from locale 'en-gb' => 'en' return {string} the new version update url
[ "Construct", "a", "new", "version", "update", "url", "with", "the", "given", "locale", "." ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/utils/UpdateNotification.js#L110-L145
train
Get the version info url
[ 30522, 3853, 1035, 2131, 27774, 2378, 14876, 3126, 2140, 1006, 2334, 2063, 1010, 6366, 3597, 16671, 2854, 19362, 3406, 10258, 24755, 2571, 1007, 1063, 2334, 2063, 1027, 2334, 2063, 1064, 1064, 19719, 1012, 2131, 4135, 9289, 2063, 1006, 1007...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.fl/src/sap/ui/fl/context/ContextManager.js
function (aContextObjects) { var aDesignTimeContextIdsByUrl = this._getContextIdsFromUrl(); if (aDesignTimeContextIdsByUrl.length === 0) { // [default: runtime] use runtime contexts return this._getContextParametersFromAPI(aContextObjects) .then(this._getActiveContextsByAPIParameters.bind(this, aContextObjects)); } else { // [designtime] use url parameters to determine the current active context(s) return Promise.resolve(this._getActiveContextsByUrlParameters(aContextObjects, aDesignTimeContextIdsByUrl)); } }
javascript
function (aContextObjects) { var aDesignTimeContextIdsByUrl = this._getContextIdsFromUrl(); if (aDesignTimeContextIdsByUrl.length === 0) { // [default: runtime] use runtime contexts return this._getContextParametersFromAPI(aContextObjects) .then(this._getActiveContextsByAPIParameters.bind(this, aContextObjects)); } else { // [designtime] use url parameters to determine the current active context(s) return Promise.resolve(this._getActiveContextsByUrlParameters(aContextObjects, aDesignTimeContextIdsByUrl)); } }
[ "function", "(", "aContextObjects", ")", "{", "var", "aDesignTimeContextIdsByUrl", "=", "this", ".", "_getContextIdsFromUrl", "(", ")", ";", "if", "(", "aDesignTimeContextIdsByUrl", ".", "length", "===", "0", ")", "{", "// [default: runtime] use runtime contexts", "re...
Helper to filter passed context objects. This method loops over each context object and check for its current validity @param {sap.ui.fl.Context[]} aContextObjects - context objects within the application @returns {Promise|string[]} aActiveContexts - Promise returning or direct build array containing ids of context objects
[ "Helper", "to", "filter", "passed", "context", "objects", ".", "This", "method", "loops", "over", "each", "context", "object", "and", "check", "for", "its", "current", "validity" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/context/ContextManager.js#L59-L70
train
Returns a promise that resolves to the active contexts
[ 30522, 3853, 1006, 9353, 28040, 18413, 16429, 20614, 2015, 1007, 1063, 13075, 4748, 2229, 23773, 7292, 8663, 18209, 9821, 3762, 3126, 2140, 1027, 2023, 1012, 1035, 2131, 8663, 18209, 9821, 19699, 5358, 3126, 2140, 1006, 1007, 1025, 2065, 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/tabs/js/tabsController.js
updateTabOrder
function updateTabOrder () { var selectedItem = ctrl.tabs[ ctrl.selectedIndex ], focusItem = ctrl.tabs[ ctrl.focusIndex ]; ctrl.tabs = ctrl.tabs.sort(function (a, b) { return a.index - b.index; }); ctrl.selectedIndex = ctrl.tabs.indexOf(selectedItem); ctrl.focusIndex = ctrl.tabs.indexOf(focusItem); }
javascript
function updateTabOrder () { var selectedItem = ctrl.tabs[ ctrl.selectedIndex ], focusItem = ctrl.tabs[ ctrl.focusIndex ]; ctrl.tabs = ctrl.tabs.sort(function (a, b) { return a.index - b.index; }); ctrl.selectedIndex = ctrl.tabs.indexOf(selectedItem); ctrl.focusIndex = ctrl.tabs.indexOf(focusItem); }
[ "function", "updateTabOrder", "(", ")", "{", "var", "selectedItem", "=", "ctrl", ".", "tabs", "[", "ctrl", ".", "selectedIndex", "]", ",", "focusItem", "=", "ctrl", ".", "tabs", "[", "ctrl", ".", "focusIndex", "]", ";", "ctrl", ".", "tabs", "=", "ctrl"...
Re-orders the tabs and updates the selected and focus indexes to their new positions. This is triggered by `tabDirective.js` when the user's tabs have been re-ordered.
[ "Re", "-", "orders", "the", "tabs", "and", "updates", "the", "selected", "and", "focus", "indexes", "to", "their", "new", "positions", ".", "This", "is", "triggered", "by", "tabDirective", ".", "js", "when", "the", "user", "s", "tabs", "have", "been", "r...
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/tabs/js/tabsController.js#L679-L687
train
Update tab order
[ 30522, 3853, 10651, 2696, 12821, 4063, 1006, 1007, 1063, 13075, 3479, 4221, 2213, 1027, 14931, 12190, 1012, 21628, 2015, 1031, 14931, 12190, 1012, 3479, 22254, 10288, 1033, 1010, 3579, 4221, 2213, 1027, 14931, 12190, 1012, 21628, 2015, 1031, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SeleniumHQ/selenium
javascript/selenium-core/scripts/htmlutils.js
getTimeoutTime
function getTimeoutTime(timeout) { var now = new Date().getTime(); var timeoutLength = parseInt(timeout); if (isNaN(timeoutLength)) { throw new SeleniumError("Timeout is not a number: '" + timeout + "'"); } return now + timeoutLength; }
javascript
function getTimeoutTime(timeout) { var now = new Date().getTime(); var timeoutLength = parseInt(timeout); if (isNaN(timeoutLength)) { throw new SeleniumError("Timeout is not a number: '" + timeout + "'"); } return now + timeoutLength; }
[ "function", "getTimeoutTime", "(", "timeout", ")", "{", "var", "now", "=", "new", "Date", "(", ")", ".", "getTime", "(", ")", ";", "var", "timeoutLength", "=", "parseInt", "(", "timeout", ")", ";", "if", "(", "isNaN", "(", "timeoutLength", ")", ")", ...
Returns the absolute time represented as an offset of the current time. Throws a SeleniumException if timeout is invalid. @param timeout the number of milliseconds from "now" whose absolute time to return
[ "Returns", "the", "absolute", "time", "represented", "as", "an", "offset", "of", "the", "current", "time", ".", "Throws", "a", "SeleniumException", "if", "timeout", "is", "invalid", "." ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/selenium-core/scripts/htmlutils.js#L943-L952
train
Get timeout time
[ 30522, 3853, 2131, 7292, 5833, 7292, 1006, 2051, 5833, 1007, 1063, 13075, 2085, 1027, 2047, 3058, 1006, 1007, 1012, 2131, 7292, 1006, 1007, 1025, 13075, 2051, 5833, 7770, 13512, 2232, 1027, 11968, 20240, 3372, 1006, 2051, 5833, 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...
laurent22/joplin
Clipper/joplin-webclipper/content_scripts/Readability.js
function(e, tag) { if (!this._flagIsActive(this.FLAG_CLEAN_CONDITIONALLY)) return; var isList = tag === "ul" || tag === "ol"; // Gather counts for other typical elements embedded within. // Traverse backwards so we can remove nodes at the same time // without effecting the traversal. // // TODO: Consider taking into account original contentScore here. this._removeNodes(e.getElementsByTagName(tag), function(node) { // First check if we're in a data table, in which case don't remove us. var isDataTable = function(t) { return t._readabilityDataTable; }; if (this._hasAncestorTag(node, "table", -1, isDataTable)) { return false; } var weight = this._getClassWeight(node); var contentScore = 0; this.log("Cleaning Conditionally", node); if (weight + contentScore < 0) { return true; } if (this._getCharCount(node, ',') < 10) { // If there are not very many commas, and the number of // non-paragraph elements is more than paragraphs or other // ominous signs, remove the element. var p = node.getElementsByTagName("p").length; var img = node.getElementsByTagName("img").length; var li = node.getElementsByTagName("li").length - 100; var input = node.getElementsByTagName("input").length; var embedCount = 0; var embeds = node.getElementsByTagName("embed"); for (var ei = 0, il = embeds.length; ei < il; ei += 1) { if (!this.REGEXPS.videos.test(embeds[ei].src)) embedCount += 1; } var linkDensity = this._getLinkDensity(node); var contentLength = this._getInnerText(node).length; var haveToRemove = (img > 1 && p / img < 0.5 && !this._hasAncestorTag(node, "figure")) || (!isList && li > p) || (input > Math.floor(p/3)) || (!isList && contentLength < 25 && (img === 0 || img > 2) && !this._hasAncestorTag(node, "figure")) || (!isList && weight < 25 && linkDensity > 0.2) || (weight >= 25 && linkDensity > 0.5) || ((embedCount === 1 && contentLength < 75) || embedCount > 1); return haveToRemove; } return false; }); }
javascript
function(e, tag) { if (!this._flagIsActive(this.FLAG_CLEAN_CONDITIONALLY)) return; var isList = tag === "ul" || tag === "ol"; // Gather counts for other typical elements embedded within. // Traverse backwards so we can remove nodes at the same time // without effecting the traversal. // // TODO: Consider taking into account original contentScore here. this._removeNodes(e.getElementsByTagName(tag), function(node) { // First check if we're in a data table, in which case don't remove us. var isDataTable = function(t) { return t._readabilityDataTable; }; if (this._hasAncestorTag(node, "table", -1, isDataTable)) { return false; } var weight = this._getClassWeight(node); var contentScore = 0; this.log("Cleaning Conditionally", node); if (weight + contentScore < 0) { return true; } if (this._getCharCount(node, ',') < 10) { // If there are not very many commas, and the number of // non-paragraph elements is more than paragraphs or other // ominous signs, remove the element. var p = node.getElementsByTagName("p").length; var img = node.getElementsByTagName("img").length; var li = node.getElementsByTagName("li").length - 100; var input = node.getElementsByTagName("input").length; var embedCount = 0; var embeds = node.getElementsByTagName("embed"); for (var ei = 0, il = embeds.length; ei < il; ei += 1) { if (!this.REGEXPS.videos.test(embeds[ei].src)) embedCount += 1; } var linkDensity = this._getLinkDensity(node); var contentLength = this._getInnerText(node).length; var haveToRemove = (img > 1 && p / img < 0.5 && !this._hasAncestorTag(node, "figure")) || (!isList && li > p) || (input > Math.floor(p/3)) || (!isList && contentLength < 25 && (img === 0 || img > 2) && !this._hasAncestorTag(node, "figure")) || (!isList && weight < 25 && linkDensity > 0.2) || (weight >= 25 && linkDensity > 0.5) || ((embedCount === 1 && contentLength < 75) || embedCount > 1); return haveToRemove; } return false; }); }
[ "function", "(", "e", ",", "tag", ")", "{", "if", "(", "!", "this", ".", "_flagIsActive", "(", "this", ".", "FLAG_CLEAN_CONDITIONALLY", ")", ")", "return", ";", "var", "isList", "=", "tag", "===", "\"ul\"", "||", "tag", "===", "\"ol\"", ";", "// Gather...
Clean an element of all tags of type "tag" if they look fishy. "Fishy" is an algorithm based on content length, classnames, link density, number of images & embeds, etc. @return void
[ "Clean", "an", "element", "of", "all", "tags", "of", "type", "tag", "if", "they", "look", "fishy", ".", "Fishy", "is", "an", "algorithm", "based", "on", "content", "length", "classnames", "link", "density", "number", "of", "images", "&", "embeds", "etc", ...
beb428b246cecba4630a3ca57b472f43c0933a43
https://github.com/laurent22/joplin/blob/beb428b246cecba4630a3ca57b472f43c0933a43/Clipper/joplin-webclipper/content_scripts/Readability.js#L1593-L1654
train
Remove the elements that are not in the conditionally list.
[ 30522, 3853, 1006, 1041, 1010, 6415, 1007, 1063, 2065, 1006, 999, 2023, 1012, 1035, 5210, 14268, 15277, 1006, 2023, 1012, 5210, 1035, 4550, 1035, 18462, 2135, 1007, 1007, 2709, 1025, 13075, 2003, 9863, 1027, 6415, 1027, 1027, 1027, 1000, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SheetJS/js-xlsx
xlsx.js
parse_DataSpaceMapEntry
function parse_DataSpaceMapEntry(blob) { var len = blob.read_shift(4); var end = blob.l + len - 4; var o = {}; var cnt = blob.read_shift(4); var comps = []; /* [MS-OFFCRYPTO] 2.1.6.2 DataSpaceReferenceComponent Structure */ while(cnt-- > 0) comps.push({ t: blob.read_shift(4), v: blob.read_shift(0, 'lpp4') }); o.name = blob.read_shift(0, 'lpp4'); o.comps = comps; if(blob.l != end) throw new Error("Bad DataSpaceMapEntry: " + blob.l + " != " + end); return o; }
javascript
function parse_DataSpaceMapEntry(blob) { var len = blob.read_shift(4); var end = blob.l + len - 4; var o = {}; var cnt = blob.read_shift(4); var comps = []; /* [MS-OFFCRYPTO] 2.1.6.2 DataSpaceReferenceComponent Structure */ while(cnt-- > 0) comps.push({ t: blob.read_shift(4), v: blob.read_shift(0, 'lpp4') }); o.name = blob.read_shift(0, 'lpp4'); o.comps = comps; if(blob.l != end) throw new Error("Bad DataSpaceMapEntry: " + blob.l + " != " + end); return o; }
[ "function", "parse_DataSpaceMapEntry", "(", "blob", ")", "{", "var", "len", "=", "blob", ".", "read_shift", "(", "4", ")", ";", "var", "end", "=", "blob", ".", "l", "+", "len", "-", "4", ";", "var", "o", "=", "{", "}", ";", "var", "cnt", "=", "...
/* [MS-OFFCRYPTO] 2.1.6.1 DataSpaceMapEntry Structure
[ "/", "*", "[", "MS", "-", "OFFCRYPTO", "]", "2", ".", "1", ".", "6", ".", "1", "DataSpaceMapEntry", "Structure" ]
9a6d8a1d3d80c78dad5201fb389316f935279cdc
https://github.com/SheetJS/js-xlsx/blob/9a6d8a1d3d80c78dad5201fb389316f935279cdc/xlsx.js#L8141-L8153
train
Parse a DataSpaceMapEntry
[ 30522, 3853, 11968, 3366, 1035, 2951, 23058, 2863, 11837, 11129, 1006, 1038, 4135, 2497, 1007, 1063, 13075, 18798, 1027, 1038, 4135, 2497, 1012, 3191, 1035, 5670, 1006, 1018, 1007, 1025, 13075, 2203, 1027, 1038, 4135, 2497, 1012, 1048, 1009...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
mdn/browser-compat-data
scripts/render.js
writeSupportCells
function writeSupportCells(supportData, compatNotes, browserPlatformType) { let output = ''; for (let browserNameKey of Object.keys(browsers[browserPlatformType])) { let support = supportData[browserNameKey]; let supportInfo = ''; // if supportData is an array, there are multiple support statements if (Array.isArray(support)) { for (let entry of support) { supportInfo += `<p>${writeSupportInfo(entry, browserNameKey, compatNotes)}</p>`; } } else if (support) { // there is just one support statement supportInfo = writeSupportInfo(support, browserNameKey, compatNotes); } else { // this browser has no info, it's unknown supportInfo = writeSupportInfo(null); } output += `<td class="${getSupportClass(supportData[browserNameKey])}">${supportInfo}</td>`; } return output; }
javascript
function writeSupportCells(supportData, compatNotes, browserPlatformType) { let output = ''; for (let browserNameKey of Object.keys(browsers[browserPlatformType])) { let support = supportData[browserNameKey]; let supportInfo = ''; // if supportData is an array, there are multiple support statements if (Array.isArray(support)) { for (let entry of support) { supportInfo += `<p>${writeSupportInfo(entry, browserNameKey, compatNotes)}</p>`; } } else if (support) { // there is just one support statement supportInfo = writeSupportInfo(support, browserNameKey, compatNotes); } else { // this browser has no info, it's unknown supportInfo = writeSupportInfo(null); } output += `<td class="${getSupportClass(supportData[browserNameKey])}">${supportInfo}</td>`; } return output; }
[ "function", "writeSupportCells", "(", "supportData", ",", "compatNotes", ",", "browserPlatformType", ")", "{", "let", "output", "=", "''", ";", "for", "(", "let", "browserNameKey", "of", "Object", ".", "keys", "(", "browsers", "[", "browserPlatformType", "]", ...
/* For a single row, write all the cells that contain support data. (That is, every cell in the row except the first, which contains an identifier for the row, like "Basic support".
[ "/", "*", "For", "a", "single", "row", "write", "all", "the", "cells", "that", "contain", "support", "data", ".", "(", "That", "is", "every", "cell", "in", "the", "row", "except", "the", "first", "which", "contains", "an", "identifier", "for", "the", "...
6ca59b232e8fe080f441c7cb625d2bfd1a6fbe2b
https://github.com/mdn/browser-compat-data/blob/6ca59b232e8fe080f441c7cb625d2bfd1a6fbe2b/scripts/render.js#L333-L352
train
Writes support cells
[ 30522, 3853, 7009, 6279, 6442, 29109, 4877, 1006, 2490, 2850, 2696, 1010, 4012, 4502, 2102, 20564, 1010, 16602, 24759, 4017, 14192, 13874, 1007, 1063, 2292, 6434, 1027, 1005, 1005, 1025, 2005, 1006, 2292, 16602, 18442, 14839, 1997, 4874, 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...
knsv/mermaid
src/diagrams/git/gitGraphRenderer.js
getElementCoords
function getElementCoords (element, coords) { coords = coords || element.node().getBBox() const ctm = element.node().getCTM() const xn = ctm.e + coords.x * ctm.a const yn = ctm.f + coords.y * ctm.d return { left: xn, top: yn, width: coords.width, height: coords.height } }
javascript
function getElementCoords (element, coords) { coords = coords || element.node().getBBox() const ctm = element.node().getCTM() const xn = ctm.e + coords.x * ctm.a const yn = ctm.f + coords.y * ctm.d return { left: xn, top: yn, width: coords.width, height: coords.height } }
[ "function", "getElementCoords", "(", "element", ",", "coords", ")", "{", "coords", "=", "coords", "||", "element", ".", "node", "(", ")", ".", "getBBox", "(", ")", "const", "ctm", "=", "element", ".", "node", "(", ")", ".", "getCTM", "(", ")", "const...
Pass in the element and its pre-transform coords
[ "Pass", "in", "the", "element", "and", "its", "pre", "-", "transform", "coords" ]
7d3578b31aeea3bc9bbc618dcda57d82574eaffb
https://github.com/knsv/mermaid/blob/7d3578b31aeea3bc9bbc618dcda57d82574eaffb/src/diagrams/git/gitGraphRenderer.js#L76-L87
train
Get element s bounding box
[ 30522, 3853, 2131, 12260, 3672, 3597, 8551, 2015, 1006, 5783, 1010, 2522, 8551, 2015, 1007, 1063, 2522, 8551, 2015, 1027, 2522, 8551, 2015, 1064, 1064, 5783, 1012, 13045, 1006, 1007, 1012, 2131, 10322, 11636, 1006, 1007, 9530, 3367, 14931, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laurent22/joplin
Clipper/joplin-webclipper/content_scripts/Readability.js
function(node, ignoreSelfAndKids) { // First check for kids if those aren't being ignored if (!ignoreSelfAndKids && node.firstElementChild) { return node.firstElementChild; } // Then for siblings... if (node.nextElementSibling) { return node.nextElementSibling; } // And finally, move up the parent chain *and* find a sibling // (because this is depth-first traversal, we will have already // seen the parent nodes themselves). do { node = node.parentNode; } while (node && !node.nextElementSibling); return node && node.nextElementSibling; }
javascript
function(node, ignoreSelfAndKids) { // First check for kids if those aren't being ignored if (!ignoreSelfAndKids && node.firstElementChild) { return node.firstElementChild; } // Then for siblings... if (node.nextElementSibling) { return node.nextElementSibling; } // And finally, move up the parent chain *and* find a sibling // (because this is depth-first traversal, we will have already // seen the parent nodes themselves). do { node = node.parentNode; } while (node && !node.nextElementSibling); return node && node.nextElementSibling; }
[ "function", "(", "node", ",", "ignoreSelfAndKids", ")", "{", "// First check for kids if those aren't being ignored", "if", "(", "!", "ignoreSelfAndKids", "&&", "node", ".", "firstElementChild", ")", "{", "return", "node", ".", "firstElementChild", ";", "}", "// Then ...
Traverse the DOM from node to node, starting at the node passed in. Pass true for the second parameter to indicate this node itself (and its kids) are going away, and we want the next node over. Calling this in a loop will traverse the DOM depth-first.
[ "Traverse", "the", "DOM", "from", "node", "to", "node", "starting", "at", "the", "node", "passed", "in", ".", "Pass", "true", "for", "the", "second", "parameter", "to", "indicate", "this", "node", "itself", "(", "and", "its", "kids", ")", "are", "going",...
beb428b246cecba4630a3ca57b472f43c0933a43
https://github.com/laurent22/joplin/blob/beb428b246cecba4630a3ca57b472f43c0933a43/Clipper/joplin-webclipper/content_scripts/Readability.js#L676-L692
train
Returns the first child of node
[ 30522, 3853, 1006, 13045, 1010, 26663, 2884, 15143, 2094, 3211, 5104, 1007, 1063, 1013, 1013, 2034, 4638, 2005, 4268, 2065, 2216, 4995, 1005, 1056, 2108, 6439, 2065, 1006, 999, 26663, 2884, 15143, 2094, 3211, 5104, 1004, 1004, 13045, 1012, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/core/routing/History.js
function(oHashChanger) { this._iHistoryLength = window.history.length; this.aHistory = []; this._bIsInitial = true; if (!Device.browser.msie) { // the state information isn't used for IE // because it doesn't clear the state after new hash is set var oState = window.history.state === null ? {} : window.history.state; if (typeof oState === "object") { History._aStateHistory.push(window.location.hash); oState.sap = {}; oState.sap.history = History._aStateHistory; window.history.replaceState(oState, window.document.title); } else { Log.debug("Unable to determine HistoryDirection as history.state is already set: " + window.history.state, "sap.ui.core.routing.History"); } } if (!oHashChanger) { Log.error("sap.ui.core.routing.History constructor was called and it did not get a hashChanger as parameter"); } this._setHashChanger(oHashChanger); this._reset(); }
javascript
function(oHashChanger) { this._iHistoryLength = window.history.length; this.aHistory = []; this._bIsInitial = true; if (!Device.browser.msie) { // the state information isn't used for IE // because it doesn't clear the state after new hash is set var oState = window.history.state === null ? {} : window.history.state; if (typeof oState === "object") { History._aStateHistory.push(window.location.hash); oState.sap = {}; oState.sap.history = History._aStateHistory; window.history.replaceState(oState, window.document.title); } else { Log.debug("Unable to determine HistoryDirection as history.state is already set: " + window.history.state, "sap.ui.core.routing.History"); } } if (!oHashChanger) { Log.error("sap.ui.core.routing.History constructor was called and it did not get a hashChanger as parameter"); } this._setHashChanger(oHashChanger); this._reset(); }
[ "function", "(", "oHashChanger", ")", "{", "this", ".", "_iHistoryLength", "=", "window", ".", "history", ".", "length", ";", "this", ".", "aHistory", "=", "[", "]", ";", "this", ".", "_bIsInitial", "=", "true", ";", "if", "(", "!", "Device", ".", "b...
Used to determine the {@link sap.ui.core.routing.HistoryDirection} of the current or a future navigation, done with a {@link sap.ui.core.routing.Router} or {@link sap.ui.core.routing.HashChanger}. <strong>ATTENTION:</strong> this class will not be accurate if someone does hash-replacement without the named classes above If you are manipulating the hash directly this class is not supported anymore. @param {sap.ui.core.routing.HashChanger} oHashChanger required, without a HashChanger this class cannot work. The class needs to be aware of the hash-changes. @public @class @alias sap.ui.core.routing.History
[ "Used", "to", "determine", "the", "{", "@link", "sap", ".", "ui", ".", "core", ".", "routing", ".", "HistoryDirection", "}", "of", "the", "current", "or", "a", "future", "navigation", "done", "with", "a", "{", "@link", "sap", ".", "ui", ".", "core", ...
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/routing/History.js#L26-L52
train
Sets the history to the current location
[ 30522, 3853, 1006, 2821, 11823, 22305, 2121, 1007, 1063, 2023, 1012, 1035, 1045, 24158, 7062, 7770, 13512, 2232, 1027, 3332, 1012, 2381, 1012, 3091, 1025, 2023, 1012, 6289, 20483, 2854, 1027, 1031, 1033, 1025, 2023, 1012, 1035, 20377, 5498,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
tailwindcss/tailwindcss
src/cli/commands/build.js
stopWithHelp
function stopWithHelp(...msgs) { utils.header() utils.error(...msgs) commands.help.forCommand(commands.build) utils.die() }
javascript
function stopWithHelp(...msgs) { utils.header() utils.error(...msgs) commands.help.forCommand(commands.build) utils.die() }
[ "function", "stopWithHelp", "(", "...", "msgs", ")", "{", "utils", ".", "header", "(", ")", "utils", ".", "error", "(", "...", "msgs", ")", "commands", ".", "help", ".", "forCommand", "(", "commands", ".", "build", ")", "utils", ".", "die", "(", ")",...
Prints the error message and help for this command, then stops the process. @param {...string} [msgs]
[ "Prints", "the", "error", "message", "and", "help", "for", "this", "command", "then", "stops", "the", "process", "." ]
5066a1e97b3f06b899a4539767ca2bee4bde2da9
https://github.com/tailwindcss/tailwindcss/blob/5066a1e97b3f06b899a4539767ca2bee4bde2da9/src/cli/commands/build.js#L53-L58
train
Stop with help
[ 30522, 3853, 2644, 24415, 16001, 2361, 1006, 1012, 1012, 1012, 5796, 5620, 1007, 1063, 21183, 12146, 1012, 20346, 1006, 1007, 21183, 12146, 1012, 7561, 1006, 1012, 1012, 1012, 5796, 5620, 1007, 10954, 1012, 2393, 1012, 2005, 9006, 2386, 209...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/AppCacheBuster.js
function(sBaseUrl, oSyncPoint) { // determine the index var mIndex = oSession.index; // the request object var oRequest; var sUrl; var sAbsoluteBaseUrl; // in case of an incoming array we register each base url on its own // except in case of the batch mode => there we pass all URLs in a POST request. if (Array.isArray(sBaseUrl) && !bBatch) { sBaseUrl.forEach(function(sBaseUrlEntry) { fnRegister(sBaseUrlEntry, oSyncPoint); }); } else if (Array.isArray(sBaseUrl) && bBatch) { // BATCH MODE: send all base urls via POST request to the server // -> server returns a JSON object for containing the index for // different base urls. // // returns e.g.: // { // "<absolute_url>": { ...<index>... }, // ... // } var sRootUrl = fnEnsureTrailingSlash(sBaseUrl[0]); var sContent = []; // log Log.debug("sap.ui.core.AppCacheBuster.register(\"" + sRootUrl + "\"); // BATCH MODE!"); // determine the base URL var sAbsoluteRootUrl = AppCacheBuster.normalizeURL(sRootUrl); // "./" removes the html doc from path // log Log.debug(" --> normalized to: \"" + sAbsoluteRootUrl + "\""); // create the list of absolute base urls sBaseUrl.forEach(function(sUrlEntry) { sUrl = fnEnsureTrailingSlash(sUrlEntry); var sAbsoluteUrl = AppCacheBuster.normalizeURL(sUrl); if (!mIndex[sAbsoluteBaseUrl]) { sContent.push(sAbsoluteUrl); } }); // if we need to fetch some base urls we trigger the request otherwise // we gracefully ignore the function call if (sContent.length > 0) { // create the URL for the index file var sUrl = sAbsoluteRootUrl + "sap-ui-cachebuster-info.json?sap-ui-language=" + sLanguage; // configure request; check how to execute the request (sync|async) oRequest = { url: sUrl, type: "POST", async: !bSync && !!oSyncPoint, dataType: "json", contentType: "text/plain", data: sContent.join("\n"), success: function(data) { // notify that the content has been loaded AppCacheBuster.onIndexLoaded(sUrl, data); // add the index file to the index map jQuery.extend(mIndex, data); }, error: function() { Log.error("Failed to batch load AppCacheBuster index file from: \"" + sUrl + "\"."); } }; } } else { // ensure the trailing slash sBaseUrl = fnEnsureTrailingSlash(sBaseUrl); // log Log.debug("sap.ui.core.AppCacheBuster.register(\"" + sBaseUrl + "\");"); // determine the base URL sAbsoluteBaseUrl = AppCacheBuster.normalizeURL(sBaseUrl); // "./" removes the html doc from path // log Log.debug(" --> normalized to: \"" + sAbsoluteBaseUrl + "\""); // if the index file has not been loaded yet => load! if (!mIndex[sAbsoluteBaseUrl]) { // create the URL for the index file var sUrl = sAbsoluteBaseUrl + "sap-ui-cachebuster-info.json?sap-ui-language=" + sLanguage; // configure request; check how to execute the request (sync|async) oRequest = { url: sUrl, async: !bSync && !!oSyncPoint, dataType: "json", success: function(data) { // notify that the content has been loaded AppCacheBuster.onIndexLoaded(sUrl, data); // add the index file to the index map mIndex[sAbsoluteBaseUrl] = data; }, error: function() { Log.error("Failed to load AppCacheBuster index file from: \"" + sUrl + "\"."); } }; } } // only request in case of having a correct request object! if (oRequest) { // hook to onIndexLoad to allow to inject the index file manually var mIndexInfo = AppCacheBuster.onIndexLoad(oRequest.url); // if anything else than undefined or null is returned we will use this // content as data for the cache buster index if (mIndexInfo != null) { Log.info("AppCacheBuster index file injected for: \"" + sUrl + "\"."); oRequest.success(mIndexInfo); } else { // use the syncpoint only during boot => otherwise the syncpoint // is not given because during runtime the registration needs to // be done synchronously. if (oRequest.async) { var iSyncPoint = oSyncPoint.startTask("load " + sUrl); var fnSuccess = oRequest.success, fnError = oRequest.error; jQuery.extend(oRequest, { success: function(data) { fnSuccess.apply(this, arguments); oSyncPoint.finishTask(iSyncPoint); }, error: function() { fnError.apply(this, arguments); oSyncPoint.finishTask(iSyncPoint, false); } }); } // load it Log.info("Loading AppCacheBuster index file from: \"" + sUrl + "\"."); jQuery.ajax(oRequest); } } }
javascript
function(sBaseUrl, oSyncPoint) { // determine the index var mIndex = oSession.index; // the request object var oRequest; var sUrl; var sAbsoluteBaseUrl; // in case of an incoming array we register each base url on its own // except in case of the batch mode => there we pass all URLs in a POST request. if (Array.isArray(sBaseUrl) && !bBatch) { sBaseUrl.forEach(function(sBaseUrlEntry) { fnRegister(sBaseUrlEntry, oSyncPoint); }); } else if (Array.isArray(sBaseUrl) && bBatch) { // BATCH MODE: send all base urls via POST request to the server // -> server returns a JSON object for containing the index for // different base urls. // // returns e.g.: // { // "<absolute_url>": { ...<index>... }, // ... // } var sRootUrl = fnEnsureTrailingSlash(sBaseUrl[0]); var sContent = []; // log Log.debug("sap.ui.core.AppCacheBuster.register(\"" + sRootUrl + "\"); // BATCH MODE!"); // determine the base URL var sAbsoluteRootUrl = AppCacheBuster.normalizeURL(sRootUrl); // "./" removes the html doc from path // log Log.debug(" --> normalized to: \"" + sAbsoluteRootUrl + "\""); // create the list of absolute base urls sBaseUrl.forEach(function(sUrlEntry) { sUrl = fnEnsureTrailingSlash(sUrlEntry); var sAbsoluteUrl = AppCacheBuster.normalizeURL(sUrl); if (!mIndex[sAbsoluteBaseUrl]) { sContent.push(sAbsoluteUrl); } }); // if we need to fetch some base urls we trigger the request otherwise // we gracefully ignore the function call if (sContent.length > 0) { // create the URL for the index file var sUrl = sAbsoluteRootUrl + "sap-ui-cachebuster-info.json?sap-ui-language=" + sLanguage; // configure request; check how to execute the request (sync|async) oRequest = { url: sUrl, type: "POST", async: !bSync && !!oSyncPoint, dataType: "json", contentType: "text/plain", data: sContent.join("\n"), success: function(data) { // notify that the content has been loaded AppCacheBuster.onIndexLoaded(sUrl, data); // add the index file to the index map jQuery.extend(mIndex, data); }, error: function() { Log.error("Failed to batch load AppCacheBuster index file from: \"" + sUrl + "\"."); } }; } } else { // ensure the trailing slash sBaseUrl = fnEnsureTrailingSlash(sBaseUrl); // log Log.debug("sap.ui.core.AppCacheBuster.register(\"" + sBaseUrl + "\");"); // determine the base URL sAbsoluteBaseUrl = AppCacheBuster.normalizeURL(sBaseUrl); // "./" removes the html doc from path // log Log.debug(" --> normalized to: \"" + sAbsoluteBaseUrl + "\""); // if the index file has not been loaded yet => load! if (!mIndex[sAbsoluteBaseUrl]) { // create the URL for the index file var sUrl = sAbsoluteBaseUrl + "sap-ui-cachebuster-info.json?sap-ui-language=" + sLanguage; // configure request; check how to execute the request (sync|async) oRequest = { url: sUrl, async: !bSync && !!oSyncPoint, dataType: "json", success: function(data) { // notify that the content has been loaded AppCacheBuster.onIndexLoaded(sUrl, data); // add the index file to the index map mIndex[sAbsoluteBaseUrl] = data; }, error: function() { Log.error("Failed to load AppCacheBuster index file from: \"" + sUrl + "\"."); } }; } } // only request in case of having a correct request object! if (oRequest) { // hook to onIndexLoad to allow to inject the index file manually var mIndexInfo = AppCacheBuster.onIndexLoad(oRequest.url); // if anything else than undefined or null is returned we will use this // content as data for the cache buster index if (mIndexInfo != null) { Log.info("AppCacheBuster index file injected for: \"" + sUrl + "\"."); oRequest.success(mIndexInfo); } else { // use the syncpoint only during boot => otherwise the syncpoint // is not given because during runtime the registration needs to // be done synchronously. if (oRequest.async) { var iSyncPoint = oSyncPoint.startTask("load " + sUrl); var fnSuccess = oRequest.success, fnError = oRequest.error; jQuery.extend(oRequest, { success: function(data) { fnSuccess.apply(this, arguments); oSyncPoint.finishTask(iSyncPoint); }, error: function() { fnError.apply(this, arguments); oSyncPoint.finishTask(iSyncPoint, false); } }); } // load it Log.info("Loading AppCacheBuster index file from: \"" + sUrl + "\"."); jQuery.ajax(oRequest); } } }
[ "function", "(", "sBaseUrl", ",", "oSyncPoint", ")", "{", "// determine the index", "var", "mIndex", "=", "oSession", ".", "index", ";", "// the request object", "var", "oRequest", ";", "var", "sUrl", ";", "var", "sAbsoluteBaseUrl", ";", "// in case of an incoming a...
internal registration function (with SyncPoint usage)
[ "internal", "registration", "function", "(", "with", "SyncPoint", "usage", ")" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/AppCacheBuster.js#L96-L252
train
This function is called by the server to register the base urls
[ 30522, 3853, 1006, 24829, 11022, 3126, 2140, 1010, 9808, 6038, 21906, 25785, 1007, 1063, 1013, 1013, 5646, 1996, 5950, 13075, 2568, 10288, 1027, 9808, 7971, 3258, 1012, 5950, 1025, 1013, 1013, 1996, 5227, 4874, 13075, 10848, 15500, 1025, 13...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.unified/src/sap/ui/unified/CalendarMonthInterval.js
_showYearPicker
function _showYearPicker(){ var oDate = this._getFocusedDate(); var oYearPicker = this.getAggregation("yearPicker"); if (oYearPicker.getDomRef()) { // already rendered oYearPicker.$().css("display", ""); } else { var oRm = sap.ui.getCore().createRenderManager(); var $Container = this.$("content"); oRm.renderControl(oYearPicker); oRm.flush($Container[0], false, true); // insert it oRm.destroy(); } this._showOverlay(); oYearPicker.setDate(oDate.toLocalJSDate()); if (this._iMode == 0) { // remove tabindex from month var oMonthsRow = this.getAggregation("monthsRow"); jQuery(oMonthsRow._oItemNavigation.getItemDomRefs()[oMonthsRow._oItemNavigation.getFocusedIndex()]).attr("tabindex", "-1"); } _togglePrevNexYearPicker.call(this); this._iMode = 1; }
javascript
function _showYearPicker(){ var oDate = this._getFocusedDate(); var oYearPicker = this.getAggregation("yearPicker"); if (oYearPicker.getDomRef()) { // already rendered oYearPicker.$().css("display", ""); } else { var oRm = sap.ui.getCore().createRenderManager(); var $Container = this.$("content"); oRm.renderControl(oYearPicker); oRm.flush($Container[0], false, true); // insert it oRm.destroy(); } this._showOverlay(); oYearPicker.setDate(oDate.toLocalJSDate()); if (this._iMode == 0) { // remove tabindex from month var oMonthsRow = this.getAggregation("monthsRow"); jQuery(oMonthsRow._oItemNavigation.getItemDomRefs()[oMonthsRow._oItemNavigation.getFocusedIndex()]).attr("tabindex", "-1"); } _togglePrevNexYearPicker.call(this); this._iMode = 1; }
[ "function", "_showYearPicker", "(", ")", "{", "var", "oDate", "=", "this", ".", "_getFocusedDate", "(", ")", ";", "var", "oYearPicker", "=", "this", ".", "getAggregation", "(", "\"yearPicker\"", ")", ";", "if", "(", "oYearPicker", ".", "getDomRef", "(", ")...
Opens the year picker. This function assumes its called when a yearPicker aggregation is available, so the caller must take care for it. @private @returns {void}
[ "Opens", "the", "year", "picker", ".", "This", "function", "assumes", "its", "called", "when", "a", "yearPicker", "aggregation", "is", "available", "so", "the", "caller", "must", "take", "care", "for", "it", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.unified/src/sap/ui/unified/CalendarMonthInterval.js#L1074-L1103
train
show year picker
[ 30522, 3853, 1035, 2265, 29100, 24330, 5484, 1006, 1007, 1063, 13075, 1051, 13701, 1027, 2023, 1012, 1035, 2131, 14876, 7874, 22367, 3686, 1006, 1007, 1025, 13075, 1051, 29100, 24330, 5484, 1027, 2023, 1012, 2131, 8490, 17603, 12540, 1006, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
nhn/tui.editor
src/js/extensions/table/tableDataHandler.js
findColMergedLastIndex
function findColMergedLastIndex(tableData, rowIndex, colIndex) { const cellData = tableData[rowIndex][colIndex]; let foundColIndex = colIndex; if (cellData.colspan > 1) { foundColIndex += cellData.colspan - 1; } return foundColIndex; }
javascript
function findColMergedLastIndex(tableData, rowIndex, colIndex) { const cellData = tableData[rowIndex][colIndex]; let foundColIndex = colIndex; if (cellData.colspan > 1) { foundColIndex += cellData.colspan - 1; } return foundColIndex; }
[ "function", "findColMergedLastIndex", "(", "tableData", ",", "rowIndex", ",", "colIndex", ")", "{", "const", "cellData", "=", "tableData", "[", "rowIndex", "]", "[", "colIndex", "]", ";", "let", "foundColIndex", "=", "colIndex", ";", "if", "(", "cellData", "...
Find last index of col merged cells. @param {Array.<Array.<object>>} tableData - tableData data @param {number} rowIndex - row index of base data @param {number} colIndex - column index of tabld data @returns {number} @ignore
[ "Find", "last", "index", "of", "col", "merged", "cells", "." ]
e75ab08c2a7ab07d1143e318f7cde135c5e3002e
https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/extensions/table/tableDataHandler.js#L302-L311
train
Find the last index of a cell in a table
[ 30522, 3853, 2424, 25778, 5017, 5999, 8523, 7629, 3207, 2595, 1006, 2795, 2850, 2696, 1010, 5216, 22254, 10288, 1010, 6972, 3207, 2595, 1007, 1063, 9530, 3367, 3526, 2850, 2696, 1027, 2795, 2850, 2696, 1031, 5216, 22254, 10288, 1033, 1031, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/core/Manifest.js
function() { // afterwards we load our dependencies! var oDep = this.getEntry("/sap.ui5/dependencies"), sComponentName = this.getComponentName(); if (oDep) { // load the libraries var mLibraries = oDep["libs"]; if (mLibraries) { for (var sLib in mLibraries) { if (!mLibraries[sLib].lazy) { Log.info("Component \"" + sComponentName + "\" is loading library: \"" + sLib + "\""); sap.ui.getCore().loadLibrary(sLib); } } } // load the components var mComponents = oDep["components"]; if (mComponents) { for (var sName in mComponents) { if (!mComponents[sName].lazy) { // TODO: refactor component/library loading code within Manifest / Component // Only load component if not (pre-)loaded already // Usually the dependencies are already loaded beforehand within Component.create var sControllerModule = sName.replace(/\./g, "/") + "/Component"; var iModuleState = sap.ui.loader._.getModuleState(sControllerModule + ".js"); if (iModuleState === -1 /* PRELOADED */) { // Execute preloaded component controller module sap.ui.requireSync(sControllerModule); } else if (iModuleState === 0 /* INITIAL */) { Log.info("Component \"" + sComponentName + "\" is loading component: \"" + sName + ".Component\""); // This can't be migrated to "Component.load" as the contract is sync sap.ui.requireSync("sap/ui/core/Component"); sap.ui.component.load({ name: sName }); } } } } } }
javascript
function() { // afterwards we load our dependencies! var oDep = this.getEntry("/sap.ui5/dependencies"), sComponentName = this.getComponentName(); if (oDep) { // load the libraries var mLibraries = oDep["libs"]; if (mLibraries) { for (var sLib in mLibraries) { if (!mLibraries[sLib].lazy) { Log.info("Component \"" + sComponentName + "\" is loading library: \"" + sLib + "\""); sap.ui.getCore().loadLibrary(sLib); } } } // load the components var mComponents = oDep["components"]; if (mComponents) { for (var sName in mComponents) { if (!mComponents[sName].lazy) { // TODO: refactor component/library loading code within Manifest / Component // Only load component if not (pre-)loaded already // Usually the dependencies are already loaded beforehand within Component.create var sControllerModule = sName.replace(/\./g, "/") + "/Component"; var iModuleState = sap.ui.loader._.getModuleState(sControllerModule + ".js"); if (iModuleState === -1 /* PRELOADED */) { // Execute preloaded component controller module sap.ui.requireSync(sControllerModule); } else if (iModuleState === 0 /* INITIAL */) { Log.info("Component \"" + sComponentName + "\" is loading component: \"" + sName + ".Component\""); // This can't be migrated to "Component.load" as the contract is sync sap.ui.requireSync("sap/ui/core/Component"); sap.ui.component.load({ name: sName }); } } } } } }
[ "function", "(", ")", "{", "// afterwards we load our dependencies!", "var", "oDep", "=", "this", ".", "getEntry", "(", "\"/sap.ui5/dependencies\"", ")", ",", "sComponentName", "=", "this", ".", "getComponentName", "(", ")", ";", "if", "(", "oDep", ")", "{", "...
Load external dependencies (like libraries and components) @private
[ "Load", "external", "dependencies", "(", "like", "libraries", "and", "components", ")" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Manifest.js#L496-L542
train
Loads the component dependencies
[ 30522, 3853, 1006, 1007, 1063, 1013, 1013, 5728, 2057, 7170, 2256, 12530, 15266, 999, 13075, 24040, 2361, 1027, 2023, 1012, 2131, 4765, 2854, 1006, 1000, 1013, 20066, 1012, 21318, 2629, 1013, 12530, 15266, 1000, 1007, 1010, 8040, 25377, 564...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/QuickOpen.js
extractCursorPos
function extractCursorPos(query) { var regInfo = query.match(CURSOR_POS_EXP); if (query.length <= 1 || !regInfo || (regInfo[1] && isNaN(regInfo[1])) || (regInfo[3] && isNaN(regInfo[3]))) { return null; } return { query: regInfo[0], local: query[0] === ":", line: regInfo[1] - 1 || 0, ch: regInfo[3] - 1 || 0 }; }
javascript
function extractCursorPos(query) { var regInfo = query.match(CURSOR_POS_EXP); if (query.length <= 1 || !regInfo || (regInfo[1] && isNaN(regInfo[1])) || (regInfo[3] && isNaN(regInfo[3]))) { return null; } return { query: regInfo[0], local: query[0] === ":", line: regInfo[1] - 1 || 0, ch: regInfo[3] - 1 || 0 }; }
[ "function", "extractCursorPos", "(", "query", ")", "{", "var", "regInfo", "=", "query", ".", "match", "(", "CURSOR_POS_EXP", ")", ";", "if", "(", "query", ".", "length", "<=", "1", "||", "!", "regInfo", "||", "(", "regInfo", "[", "1", "]", "&&", "isN...
Attempts to extract a line number from the query where the line number is followed by a colon. Callers should explicitly test result with isNaN() @param {string} query string to extract line number from @return {{query: string, local: boolean, line: number, ch: number}} An object with the extracted line and column numbers, and two additional fields: query with the original position string and local indicating if the cursor position should be applied to the current file. Or null if the query is invalid
[ "Attempts", "to", "extract", "a", "line", "number", "from", "the", "query", "where", "the", "line", "number", "is", "followed", "by", "a", "colon", ".", "Callers", "should", "explicitly", "test", "result", "with", "isNaN", "()" ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/search/QuickOpen.js#L299-L315
train
Extract cursor pos from query
[ 30522, 3853, 14817, 10841, 25301, 14536, 2891, 1006, 23032, 1007, 1063, 13075, 19723, 2378, 14876, 1027, 23032, 1012, 2674, 1006, 12731, 25301, 2099, 1035, 13433, 2015, 1035, 4654, 2361, 1007, 1025, 2065, 1006, 23032, 1012, 3091, 1026, 1027, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/editor/CodeHintManager.js
_handleChange
function _handleChange(event, editor, changeList) { if (lastChar && editor === keyDownEditor) { keyDownEditor = null; if (_inSession(editor)) { var charToRetest = lastChar; _updateHintList(); // _updateHintList() may end a hinting session and clear lastChar, but a // different provider may want to start a new session with the same character. // So check whether current provider terminates the current hinting // session. If so, then restore lastChar and restart a new session. if (!_inSession(editor)) { lastChar = charToRetest; _beginSession(editor); } } else { _beginSession(editor); } // Pending Text is used in hintList._keydownHook() if (hintList && changeList[0] && changeList[0].text.length && changeList[0].text[0].length) { var expectedLength = editor.getCursorPos().ch - changeList[0].from.ch, newText = changeList[0].text[0]; // We may get extra text in newText since some features like auto // close braces can append some text automatically. // See https://github.com/adobe/brackets/issues/6345#issuecomment-32548064 // as an example of this scenario. if (newText.length > expectedLength) { // Strip off the extra text before calling removePendingText. newText = newText.substr(0, expectedLength); } hintList.removePendingText(newText); } } }
javascript
function _handleChange(event, editor, changeList) { if (lastChar && editor === keyDownEditor) { keyDownEditor = null; if (_inSession(editor)) { var charToRetest = lastChar; _updateHintList(); // _updateHintList() may end a hinting session and clear lastChar, but a // different provider may want to start a new session with the same character. // So check whether current provider terminates the current hinting // session. If so, then restore lastChar and restart a new session. if (!_inSession(editor)) { lastChar = charToRetest; _beginSession(editor); } } else { _beginSession(editor); } // Pending Text is used in hintList._keydownHook() if (hintList && changeList[0] && changeList[0].text.length && changeList[0].text[0].length) { var expectedLength = editor.getCursorPos().ch - changeList[0].from.ch, newText = changeList[0].text[0]; // We may get extra text in newText since some features like auto // close braces can append some text automatically. // See https://github.com/adobe/brackets/issues/6345#issuecomment-32548064 // as an example of this scenario. if (newText.length > expectedLength) { // Strip off the extra text before calling removePendingText. newText = newText.substr(0, expectedLength); } hintList.removePendingText(newText); } } }
[ "function", "_handleChange", "(", "event", ",", "editor", ",", "changeList", ")", "{", "if", "(", "lastChar", "&&", "editor", "===", "keyDownEditor", ")", "{", "keyDownEditor", "=", "null", ";", "if", "(", "_inSession", "(", "editor", ")", ")", "{", "var...
Start a new implicit hinting session, or update the existing hint list. Called by the editor after handleKeyEvent, which is responsible for setting the lastChar. @param {Event} event @param {Editor} editor @param {{from: Pos, to: Pos, text: Array, origin: string}} changeList
[ "Start", "a", "new", "implicit", "hinting", "session", "or", "update", "the", "existing", "hint", "list", ".", "Called", "by", "the", "editor", "after", "handleKeyEvent", "which", "is", "responsible", "for", "setting", "the", "lastChar", "." ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/editor/CodeHintManager.js#L618-L652
train
Handle change event
[ 30522, 3853, 1035, 5047, 22305, 2063, 1006, 2724, 1010, 3559, 1010, 2689, 9863, 1007, 1063, 2065, 1006, 2197, 7507, 2099, 1004, 1004, 3559, 1027, 1027, 1027, 3145, 7698, 2098, 15660, 1007, 1063, 3145, 7698, 2098, 15660, 1027, 19701, 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...
jhipster/generator-jhipster
generators/docker-utils.js
checkImageExist
function checkImageExist(opts = { cwd: './', appConfig: null }) { if (this.abort) return; let imagePath = ''; this.warning = false; this.warningMessage = 'To generate the missing Docker image(s), please run:\n'; if (opts.appConfig.buildTool === 'maven') { imagePath = this.destinationPath(`${opts.cwd + opts.cwd}/target/docker`); this.dockerBuildCommand = './mvnw -Pprod verify jib:dockerBuild'; } else { imagePath = this.destinationPath(`${opts.cwd + opts.cwd}/build/docker`); this.dockerBuildCommand = './gradlew bootWar -Pprod jibDockerBuild'; } if (shelljs.ls(imagePath).length === 0) { this.warning = true; this.warningMessage += ` ${chalk.cyan(this.dockerBuildCommand)} in ${this.destinationPath(this.directoryPath + opts.cwd)}\n`; } }
javascript
function checkImageExist(opts = { cwd: './', appConfig: null }) { if (this.abort) return; let imagePath = ''; this.warning = false; this.warningMessage = 'To generate the missing Docker image(s), please run:\n'; if (opts.appConfig.buildTool === 'maven') { imagePath = this.destinationPath(`${opts.cwd + opts.cwd}/target/docker`); this.dockerBuildCommand = './mvnw -Pprod verify jib:dockerBuild'; } else { imagePath = this.destinationPath(`${opts.cwd + opts.cwd}/build/docker`); this.dockerBuildCommand = './gradlew bootWar -Pprod jibDockerBuild'; } if (shelljs.ls(imagePath).length === 0) { this.warning = true; this.warningMessage += ` ${chalk.cyan(this.dockerBuildCommand)} in ${this.destinationPath(this.directoryPath + opts.cwd)}\n`; } }
[ "function", "checkImageExist", "(", "opts", "=", "{", "cwd", ":", "'./'", ",", "appConfig", ":", "null", "}", ")", "{", "if", "(", "this", ".", "abort", ")", "return", ";", "let", "imagePath", "=", "''", ";", "this", ".", "warning", "=", "false", "...
Check that a Docker image exists in a JHipster app. @param opts Options to pass. @property pwd JHipster app directory. default is './' @property appConfig Configuration for the current application
[ "Check", "that", "a", "Docker", "image", "exists", "in", "a", "JHipster", "app", "." ]
f76fa8de0818ce6bda6c7b1455942e2a9b0ae3ff
https://github.com/jhipster/generator-jhipster/blob/f76fa8de0818ce6bda6c7b1455942e2a9b0ae3ff/generators/docker-utils.js#L80-L98
train
Check if Docker image exists
[ 30522, 3853, 4638, 9581, 18372, 9048, 3367, 1006, 23569, 2015, 1027, 1063, 19296, 2094, 1024, 1005, 1012, 1013, 1005, 1010, 10439, 8663, 8873, 2290, 1024, 19701, 1065, 1007, 1063, 2065, 1006, 2023, 1012, 11113, 11589, 1007, 2709, 1025, 2292...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.fl/src/sap/ui/fl/support/apps/contentbrowser/utils/DataUtils.js
function (oContentItem) { var bNotBlacklisted = true; jQuery.each(this.aBlacklist, function (index, mBlacklistedElement) { var bAllPropertiesMatched = true; jQuery.each(mBlacklistedElement, function (sProperty, sValue) { bAllPropertiesMatched = bAllPropertiesMatched && oContentItem[sProperty] === sValue; }); if (bAllPropertiesMatched) { bNotBlacklisted = false; return false; // break each } }); return bNotBlacklisted; }
javascript
function (oContentItem) { var bNotBlacklisted = true; jQuery.each(this.aBlacklist, function (index, mBlacklistedElement) { var bAllPropertiesMatched = true; jQuery.each(mBlacklistedElement, function (sProperty, sValue) { bAllPropertiesMatched = bAllPropertiesMatched && oContentItem[sProperty] === sValue; }); if (bAllPropertiesMatched) { bNotBlacklisted = false; return false; // break each } }); return bNotBlacklisted; }
[ "function", "(", "oContentItem", ")", "{", "var", "bNotBlacklisted", "=", "true", ";", "jQuery", ".", "each", "(", "this", ".", "aBlacklist", ",", "function", "(", "index", ",", "mBlacklistedElement", ")", "{", "var", "bAllPropertiesMatched", "=", "true", ";...
Verifies if item content is not in the black list. @param {Object} oContentItem - content item needs to be verified @returns {Boolean} - <code>true</code> if not in the black list @public
[ "Verifies", "if", "item", "content", "is", "not", "in", "the", "black", "list", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/support/apps/contentbrowser/utils/DataUtils.js#L79-L94
train
Checks if the content item is not in the blacklist
[ 30522, 3853, 1006, 1051, 8663, 6528, 23096, 2213, 1007, 1063, 13075, 24869, 4140, 28522, 3600, 9863, 2098, 1027, 2995, 1025, 1046, 4226, 2854, 1012, 2169, 1006, 2023, 1012, 11113, 30524, 7368, 18900, 7690, 1027, 2995, 1025, 1046, 4226, 2854...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.table/src/sap/ui/table/TableScrollExtension.js
function(oTable) { var oScrollExtension = oTable._getScrollExtension(); var oHSb = oScrollExtension.getHorizontalScrollbar(); var aScrollAreas = HorizontalScrollingHelper.getScrollAreas(oTable); if (oScrollExtension._onHorizontalScrollEventHandler) { for (var i = 0; i < aScrollAreas.length; i++) { aScrollAreas[i].removeEventListener("scroll", oScrollExtension._onHorizontalScrollEventHandler); delete aScrollAreas[i]._scrollLeft; } delete oScrollExtension._onHorizontalScrollEventHandler; } if (oHSb && oScrollExtension._onHorizontalScrollbarMouseDownEventHandler) { oHSb.removeEventListener("mousedown", oScrollExtension._onHorizontalScrollbarMouseDownEventHandler); delete oScrollExtension._onHorizontalScrollbarMouseDownEventHandler; } }
javascript
function(oTable) { var oScrollExtension = oTable._getScrollExtension(); var oHSb = oScrollExtension.getHorizontalScrollbar(); var aScrollAreas = HorizontalScrollingHelper.getScrollAreas(oTable); if (oScrollExtension._onHorizontalScrollEventHandler) { for (var i = 0; i < aScrollAreas.length; i++) { aScrollAreas[i].removeEventListener("scroll", oScrollExtension._onHorizontalScrollEventHandler); delete aScrollAreas[i]._scrollLeft; } delete oScrollExtension._onHorizontalScrollEventHandler; } if (oHSb && oScrollExtension._onHorizontalScrollbarMouseDownEventHandler) { oHSb.removeEventListener("mousedown", oScrollExtension._onHorizontalScrollbarMouseDownEventHandler); delete oScrollExtension._onHorizontalScrollbarMouseDownEventHandler; } }
[ "function", "(", "oTable", ")", "{", "var", "oScrollExtension", "=", "oTable", ".", "_getScrollExtension", "(", ")", ";", "var", "oHSb", "=", "oScrollExtension", ".", "getHorizontalScrollbar", "(", ")", ";", "var", "aScrollAreas", "=", "HorizontalScrollingHelper",...
Removes the horizontal <code>scroll</code> event listener from all horizontal scroll areas of a table. @param {sap.ui.table.Table} oTable Instance of the table.
[ "Removes", "the", "horizontal", "<code", ">", "scroll<", "/", "code", ">", "event", "listener", "from", "all", "horizontal", "scroll", "areas", "of", "a", "table", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableScrollExtension.js#L244-L261
train
Removes the event listeners for the horizontal scroll area.
[ 30522, 3853, 1006, 27178, 3085, 1007, 1063, 13075, 9808, 26775, 14511, 10288, 29048, 1027, 27178, 3085, 1012, 1035, 4152, 26775, 14511, 10288, 29048, 1006, 1007, 1025, 13075, 2821, 19022, 1027, 9808, 26775, 14511, 10288, 29048, 1012, 2131, 16...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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-var.js
isOutsideOfScope
function isOutsideOfScope(reference) { const scope = scopeNode.range; const id = reference.identifier.range; return id[0] < scope[0] || id[1] > scope[1]; }
javascript
function isOutsideOfScope(reference) { const scope = scopeNode.range; const id = reference.identifier.range; return id[0] < scope[0] || id[1] > scope[1]; }
[ "function", "isOutsideOfScope", "(", "reference", ")", "{", "const", "scope", "=", "scopeNode", ".", "range", ";", "const", "id", "=", "reference", ".", "identifier", ".", "range", ";", "return", "id", "[", "0", "]", "<", "scope", "[", "0", "]", "||", ...
Checks whether a given reference is inside of the specified scope or not. @param {eslint-scope.Reference} reference - A reference to check. @returns {boolean} `true` if the reference is inside of the specified scope.
[ "Checks", "whether", "a", "given", "reference", "is", "inside", "of", "the", "specified", "scope", "or", "not", "." ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/no-var.js#L128-L133
train
Checks whether the reference is outside of the scope
[ 30522, 3853, 11163, 16446, 5178, 11253, 26127, 1006, 4431, 1007, 1063, 9530, 3367, 9531, 1027, 9531, 3630, 3207, 1012, 2846, 1025, 9530, 3367, 8909, 1027, 4431, 1012, 8909, 4765, 18095, 1012, 2846, 1025, 2709, 8909, 1031, 1014, 1033, 1026, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
jhipster/generator-jhipster
generators/docker-prompts.js
askForClustersMode
function askForClustersMode() { if (this.regenerate) return; const clusteredDbApps = []; this.appConfigs.forEach((appConfig, index) => { if (appConfig.prodDatabaseType === 'mongodb' || appConfig.prodDatabaseType === 'couchbase') { clusteredDbApps.push(this.appsFolders[index]); } }); if (clusteredDbApps.length === 0) return; const done = this.async(); const prompts = [ { type: 'checkbox', name: 'clusteredDbApps', message: 'Which applications do you want to use with clustered databases (only available with MongoDB and Couchbase)?', choices: clusteredDbApps, default: this.clusteredDbApps } ]; this.prompt(prompts).then(props => { this.clusteredDbApps = props.clusteredDbApps; setClusteredApps.call(this); done(); }); }
javascript
function askForClustersMode() { if (this.regenerate) return; const clusteredDbApps = []; this.appConfigs.forEach((appConfig, index) => { if (appConfig.prodDatabaseType === 'mongodb' || appConfig.prodDatabaseType === 'couchbase') { clusteredDbApps.push(this.appsFolders[index]); } }); if (clusteredDbApps.length === 0) return; const done = this.async(); const prompts = [ { type: 'checkbox', name: 'clusteredDbApps', message: 'Which applications do you want to use with clustered databases (only available with MongoDB and Couchbase)?', choices: clusteredDbApps, default: this.clusteredDbApps } ]; this.prompt(prompts).then(props => { this.clusteredDbApps = props.clusteredDbApps; setClusteredApps.call(this); done(); }); }
[ "function", "askForClustersMode", "(", ")", "{", "if", "(", "this", ".", "regenerate", ")", "return", ";", "const", "clusteredDbApps", "=", "[", "]", ";", "this", ".", "appConfigs", ".", "forEach", "(", "(", "appConfig", ",", "index", ")", "=>", "{", "...
Ask For Clusters Mode
[ "Ask", "For", "Clusters", "Mode" ]
f76fa8de0818ce6bda6c7b1455942e2a9b0ae3ff
https://github.com/jhipster/generator-jhipster/blob/f76fa8de0818ce6bda6c7b1455942e2a9b0ae3ff/generators/docker-prompts.js#L196-L225
train
Ask For Clusters Mode
[ 30522, 3853, 3198, 29278, 20464, 19966, 2545, 5302, 3207, 1006, 1007, 1063, 2065, 1006, 2023, 1012, 19723, 30524, 4013, 25062, 2696, 15058, 13874, 1027, 1027, 1027, 1005, 12256, 3995, 18939, 1005, 1064, 1064, 10439, 8663, 8873, 2290, 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...
apache/incubator-echarts
src/component/graphic.js
function (graphicModel) { var elOptionsToUpdate = graphicModel.useElOptionsToUpdate(); if (!elOptionsToUpdate) { return; } var elMap = this._elMap; var rootGroup = this.group; // Top-down tranverse to assign graphic settings to each elements. zrUtil.each(elOptionsToUpdate, function (elOption) { var $action = elOption.$action; var id = elOption.id; var existEl = elMap.get(id); var parentId = elOption.parentId; var targetElParent = parentId != null ? elMap.get(parentId) : rootGroup; var elOptionStyle = elOption.style; if (elOption.type === 'text' && elOptionStyle) { // In top/bottom mode, textVerticalAlign should not be used, which cause // inaccurately locating. if (elOption.hv && elOption.hv[1]) { elOptionStyle.textVerticalAlign = elOptionStyle.textBaseline = null; } // Compatible with previous setting: both support fill and textFill, // stroke and textStroke. !elOptionStyle.hasOwnProperty('textFill') && elOptionStyle.fill && ( elOptionStyle.textFill = elOptionStyle.fill ); !elOptionStyle.hasOwnProperty('textStroke') && elOptionStyle.stroke && ( elOptionStyle.textStroke = elOptionStyle.stroke ); } // Remove unnecessary props to avoid potential problems. var elOptionCleaned = getCleanedElOption(elOption); // For simple, do not support parent change, otherwise reorder is needed. if (__DEV__) { existEl && zrUtil.assert( targetElParent === existEl.parent, 'Changing parent is not supported.' ); } if (!$action || $action === 'merge') { existEl ? existEl.attr(elOptionCleaned) : createEl(id, targetElParent, elOptionCleaned, elMap); } else if ($action === 'replace') { removeEl(existEl, elMap); createEl(id, targetElParent, elOptionCleaned, elMap); } else if ($action === 'remove') { removeEl(existEl, elMap); } var el = elMap.get(id); if (el) { el.__ecGraphicWidth = elOption.width; el.__ecGraphicHeight = elOption.height; setEventData(el, graphicModel, elOption); } }); }
javascript
function (graphicModel) { var elOptionsToUpdate = graphicModel.useElOptionsToUpdate(); if (!elOptionsToUpdate) { return; } var elMap = this._elMap; var rootGroup = this.group; // Top-down tranverse to assign graphic settings to each elements. zrUtil.each(elOptionsToUpdate, function (elOption) { var $action = elOption.$action; var id = elOption.id; var existEl = elMap.get(id); var parentId = elOption.parentId; var targetElParent = parentId != null ? elMap.get(parentId) : rootGroup; var elOptionStyle = elOption.style; if (elOption.type === 'text' && elOptionStyle) { // In top/bottom mode, textVerticalAlign should not be used, which cause // inaccurately locating. if (elOption.hv && elOption.hv[1]) { elOptionStyle.textVerticalAlign = elOptionStyle.textBaseline = null; } // Compatible with previous setting: both support fill and textFill, // stroke and textStroke. !elOptionStyle.hasOwnProperty('textFill') && elOptionStyle.fill && ( elOptionStyle.textFill = elOptionStyle.fill ); !elOptionStyle.hasOwnProperty('textStroke') && elOptionStyle.stroke && ( elOptionStyle.textStroke = elOptionStyle.stroke ); } // Remove unnecessary props to avoid potential problems. var elOptionCleaned = getCleanedElOption(elOption); // For simple, do not support parent change, otherwise reorder is needed. if (__DEV__) { existEl && zrUtil.assert( targetElParent === existEl.parent, 'Changing parent is not supported.' ); } if (!$action || $action === 'merge') { existEl ? existEl.attr(elOptionCleaned) : createEl(id, targetElParent, elOptionCleaned, elMap); } else if ($action === 'replace') { removeEl(existEl, elMap); createEl(id, targetElParent, elOptionCleaned, elMap); } else if ($action === 'remove') { removeEl(existEl, elMap); } var el = elMap.get(id); if (el) { el.__ecGraphicWidth = elOption.width; el.__ecGraphicHeight = elOption.height; setEventData(el, graphicModel, elOption); } }); }
[ "function", "(", "graphicModel", ")", "{", "var", "elOptionsToUpdate", "=", "graphicModel", ".", "useElOptionsToUpdate", "(", ")", ";", "if", "(", "!", "elOptionsToUpdate", ")", "{", "return", ";", "}", "var", "elMap", "=", "this", ".", "_elMap", ";", "var...
Update graphic elements. @private @param {Object} graphicModel graphic model
[ "Update", "graphic", "elements", "." ]
4d0ea095dc3929cb6de40c45748826e7999c7aa8
https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/component/graphic.js#L279-L346
train
Updates the graphic settings of the elements.
[ 30522, 3853, 1006, 8425, 5302, 9247, 1007, 1063, 13075, 3449, 7361, 9285, 24826, 17299, 3686, 1027, 8425, 5302, 9247, 1012, 2224, 18349, 16790, 16033, 6279, 13701, 1006, 1007, 1025, 2065, 1006, 999, 3449, 7361, 9285, 24826, 17299, 3686, 100...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/model/analytics/odata4analytics.js
function(sName) { if (this._oDimensionSet[sName]) { // the easy case return this._oDimensionSet[sName]; } for ( var sDimensionName in this._oDimensionSet) { var oDimension = this._oDimensionSet[sDimensionName]; var oTextProperty = oDimension.getTextProperty(); if (oTextProperty && oTextProperty.name == sName) { return oDimension; } if (oDimension.findAttributeByName(sName)) { return oDimension; } } return null; }
javascript
function(sName) { if (this._oDimensionSet[sName]) { // the easy case return this._oDimensionSet[sName]; } for ( var sDimensionName in this._oDimensionSet) { var oDimension = this._oDimensionSet[sDimensionName]; var oTextProperty = oDimension.getTextProperty(); if (oTextProperty && oTextProperty.name == sName) { return oDimension; } if (oDimension.findAttributeByName(sName)) { return oDimension; } } return null; }
[ "function", "(", "sName", ")", "{", "if", "(", "this", ".", "_oDimensionSet", "[", "sName", "]", ")", "{", "// the easy case", "return", "this", ".", "_oDimensionSet", "[", "sName", "]", ";", "}", "for", "(", "var", "sDimensionName", "in", "this", ".", ...
Find dimension by property name @param {string} sName Property name @returns {sap.ui.model.analytics.odata4analytics.Dimension} The dimension object to which the given property name is related, because the property holds the dimension key, its text, or is an attribute of this dimension. If no such dimension exists, null is returned. @public @function @name sap.ui.model.analytics.odata4analytics.QueryResult#findDimensionByPropertyName
[ "Find", "dimension", "by", "property", "name" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/analytics/odata4analytics.js#L1105-L1121
train
Returns the dimension with the given name
[ 30522, 3853, 1006, 1055, 18442, 1007, 1063, 2065, 1006, 2023, 1012, 1035, 21045, 3549, 27466, 3388, 1031, 1055, 18442, 1033, 1007, 1063, 1013, 1013, 1996, 3733, 2553, 2709, 2023, 1012, 1035, 21045, 3549, 27466, 3388, 1031, 1055, 18442, 1033...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/core/Element.js
function(element, key) { var aData = element.getAggregation("customData"); if (aData) { for (var i = 0; i < aData.length; i++) { if (aData[i].getKey() == key) { return aData[i]; } } } return null; }
javascript
function(element, key) { var aData = element.getAggregation("customData"); if (aData) { for (var i = 0; i < aData.length; i++) { if (aData[i].getKey() == key) { return aData[i]; } } } return null; }
[ "function", "(", "element", ",", "key", ")", "{", "var", "aData", "=", "element", ".", "getAggregation", "(", "\"customData\"", ")", ";", "if", "(", "aData", ")", "{", "for", "(", "var", "i", "=", "0", ";", "i", "<", "aData", ".", "length", ";", ...
Returns the data object with the given key
[ "Returns", "the", "data", "object", "with", "the", "given", "key" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Element.js#L908-L918
train
Returns the data object for the given key
[ 30522, 3853, 1006, 5783, 1010, 3145, 1007, 1063, 13075, 15262, 2696, 1027, 5783, 1012, 2131, 8490, 17603, 12540, 1006, 1000, 7661, 2850, 2696, 1000, 1007, 1025, 2065, 1006, 15262, 2696, 1007, 1063, 2005, 1006, 13075, 1045, 1027, 1014, 1025,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.unified/src/sap/ui/unified/ColorPicker.js
function(oEvent) { var iX = oEvent.offsetX, iY = oEvent.offsetY, iBoxHeight, // Keep in mind that box width and height should be equal on all screen sizes iBoxWidth = iBoxHeight = this.getWidth(), oEventPosition, oOffset; // Prevent default to eliminate scrolling while someone uses the color picker box oEvent.preventDefault && oEvent.preventDefault(); // If no control offset is available try to get touch event position if (!iX) { oEventPosition = oEvent.targetTouches ? oEvent.targetTouches[0] : oEvent; // get the event position for tap/touch/click events if (!oEventPosition || !oEventPosition.pageX) { // desktop fallback oEventPosition = oEvent; if ((!oEventPosition || !oEventPosition.pageX) && oEvent.changedTouches) { // touchend fallback oEventPosition = oEvent.changedTouches[0]; } } // if an event position is not present we don't continue if (!oEventPosition.pageX) { return false; } // Calculate interaction point based on control->page offset oOffset = this.getOffset(); iX = oEventPosition.pageX - oOffset.left; iY = oEventPosition.pageY - oOffset.top; } // Keep handle position always in range 0..iBox{Width|Height} for both X and Y coordinates iX = Math.min(Math.max(iX, 0), iBoxWidth); iY = Math.min(Math.max(iY, 0), iBoxHeight); // Handle RTL mode if (this.bRtl) { iX = iBoxWidth - iX; } return { value: iX / iBoxWidth * 100, saturation: (1 - iY / iBoxHeight) * 100 }; }
javascript
function(oEvent) { var iX = oEvent.offsetX, iY = oEvent.offsetY, iBoxHeight, // Keep in mind that box width and height should be equal on all screen sizes iBoxWidth = iBoxHeight = this.getWidth(), oEventPosition, oOffset; // Prevent default to eliminate scrolling while someone uses the color picker box oEvent.preventDefault && oEvent.preventDefault(); // If no control offset is available try to get touch event position if (!iX) { oEventPosition = oEvent.targetTouches ? oEvent.targetTouches[0] : oEvent; // get the event position for tap/touch/click events if (!oEventPosition || !oEventPosition.pageX) { // desktop fallback oEventPosition = oEvent; if ((!oEventPosition || !oEventPosition.pageX) && oEvent.changedTouches) { // touchend fallback oEventPosition = oEvent.changedTouches[0]; } } // if an event position is not present we don't continue if (!oEventPosition.pageX) { return false; } // Calculate interaction point based on control->page offset oOffset = this.getOffset(); iX = oEventPosition.pageX - oOffset.left; iY = oEventPosition.pageY - oOffset.top; } // Keep handle position always in range 0..iBox{Width|Height} for both X and Y coordinates iX = Math.min(Math.max(iX, 0), iBoxWidth); iY = Math.min(Math.max(iY, 0), iBoxHeight); // Handle RTL mode if (this.bRtl) { iX = iBoxWidth - iX; } return { value: iX / iBoxWidth * 100, saturation: (1 - iY / iBoxHeight) * 100 }; }
[ "function", "(", "oEvent", ")", "{", "var", "iX", "=", "oEvent", ".", "offsetX", ",", "iY", "=", "oEvent", ".", "offsetY", ",", "iBoxHeight", ",", "// Keep in mind that box width and height should be equal on all screen sizes", "iBoxWidth", "=", "iBoxHeight", "=", "...
Calculates the <code>value</code> and <code>saturation</code> from event XY coordinates related to the <code>ColorPickerBox</code> coordinates. @param {object} oEvent event object @returns {object|false} with 'value' and 'saturation' properties
[ "Calculates", "the", "<code", ">", "value<", "/", "code", ">", "and", "<code", ">", "saturation<", "/", "code", ">", "from", "event", "XY", "coordinates", "related", "to", "the", "<code", ">", "ColorPickerBox<", "/", "code", ">", "coordinates", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.unified/src/sap/ui/unified/ColorPicker.js#L700-L749
train
Returns the handle position based on the event position
[ 30522, 3853, 1006, 1051, 18697, 3372, 1007, 1063, 13075, 11814, 1027, 1051, 18697, 3372, 1012, 16396, 2595, 1010, 1045, 2100, 1027, 1051, 18697, 3372, 1012, 16396, 2100, 1010, 21307, 11636, 26036, 13900, 1010, 1013, 1013, 2562, 1999, 2568, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
google/material-design-lite
gulpfile.babel.js
watch
function watch() { gulp.watch(['src/**/*.js', '!src/**/README.md'], ['scripts', 'demos', 'components', reload]); gulp.watch(['src/**/*.{scss,css}'], ['styles', 'styles-grid', 'styletemplates', reload]); gulp.watch(['src/**/*.html'], ['pages', reload]); gulp.watch(['src/**/*.{svg,png,jpg}'], ['images', reload]); gulp.watch(['src/**/README.md'], ['pages', reload]); gulp.watch(['templates/**/*'], ['templates', reload]); gulp.watch(['docs/**/*'], ['pages', 'assets', reload]); gulp.watch(['package.json', 'bower.json', 'LICENSE'], ['metadata']); }
javascript
function watch() { gulp.watch(['src/**/*.js', '!src/**/README.md'], ['scripts', 'demos', 'components', reload]); gulp.watch(['src/**/*.{scss,css}'], ['styles', 'styles-grid', 'styletemplates', reload]); gulp.watch(['src/**/*.html'], ['pages', reload]); gulp.watch(['src/**/*.{svg,png,jpg}'], ['images', reload]); gulp.watch(['src/**/README.md'], ['pages', reload]); gulp.watch(['templates/**/*'], ['templates', reload]); gulp.watch(['docs/**/*'], ['pages', 'assets', reload]); gulp.watch(['package.json', 'bower.json', 'LICENSE'], ['metadata']); }
[ "function", "watch", "(", ")", "{", "gulp", ".", "watch", "(", "[", "'src/**/*.js'", ",", "'!src/**/README.md'", "]", ",", "[", "'scripts'", ",", "'demos'", ",", "'components'", ",", "reload", "]", ")", ";", "gulp", ".", "watch", "(", "[", "'src/**/*.{sc...
Defines the list of resources to watch for changes.
[ "Defines", "the", "list", "of", "resources", "to", "watch", "for", "changes", "." ]
60f441a22ed98ed2c03f6179adf460d888bf459f
https://github.com/google/material-design-lite/blob/60f441a22ed98ed2c03f6179adf460d888bf459f/gulpfile.babel.js#L493-L504
train
Watches the files
[ 30522, 3853, 3422, 1006, 1007, 1063, 26546, 1012, 3422, 1006, 1031, 1005, 5034, 2278, 1013, 1008, 1008, 1013, 1008, 1012, 1046, 2015, 1005, 1010, 1005, 999, 5034, 2278, 1013, 1008, 1008, 1013, 3191, 4168, 1012, 9108, 1005, 1033, 1010, 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...