repo
stringclasses
195 values
path
stringlengths
4
99
func_name
stringlengths
0
41
original_string
stringlengths
72
56.1k
language
stringclasses
1 value
code
stringlengths
72
56.1k
code_tokens
listlengths
25
8.12k
docstring
stringlengths
2
12.5k
docstring_tokens
listlengths
1
449
sha
stringclasses
197 values
url
stringlengths
88
186
partition
stringclasses
1 value
summary
stringlengths
8
338
input_ids
listlengths
502
502
token_type_ids
listlengths
502
502
attention_mask
listlengths
502
502
labels
listlengths
502
502
jgraph/mxgraph
javascript/mxClient.js
mxGeometryChange
function mxGeometryChange(model, cell, geometry) { this.model = model; this.cell = cell; this.geometry = geometry; this.previous = geometry; }
javascript
function mxGeometryChange(model, cell, geometry) { this.model = model; this.cell = cell; this.geometry = geometry; this.previous = geometry; }
[ "function", "mxGeometryChange", "(", "model", ",", "cell", ",", "geometry", ")", "{", "this", ".", "model", "=", "model", ";", "this", ".", "cell", "=", "cell", ";", "this", ".", "geometry", "=", "geometry", ";", "this", ".", "previous", "=", "geometry...
Class: mxGeometryChange Action to change a cell's geometry in a model. Constructor: mxGeometryChange Constructs a change of a geometry in the specified model.
[ "Class", ":", "mxGeometryChange" ]
33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44
https://github.com/jgraph/mxgraph/blob/33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44/javascript/mxClient.js#L41810-L41816
train
This is the callback function for the geometry change event
[ 30522, 3853, 25630, 3351, 8462, 11129, 22305, 2063, 1006, 2944, 1010, 3526, 1010, 10988, 1007, 1063, 2023, 1012, 2944, 1027, 2944, 1025, 2023, 1012, 3526, 1027, 3526, 1025, 2023, 1012, 10988, 1027, 10988, 1025, 2023, 1012, 3025, 1027, 10988...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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
getTernFunctionType
function getTernFunctionType(fileInfo, offset) { postMessage({ type: MessageIds.TERN_CALLED_FUNC_TYPE_MSG, fileInfo: fileInfo, offset: offset }); return addPendingRequest(fileInfo.name, offset, MessageIds.TERN_CALLED_FUNC_TYPE_MSG); }
javascript
function getTernFunctionType(fileInfo, offset) { postMessage({ type: MessageIds.TERN_CALLED_FUNC_TYPE_MSG, fileInfo: fileInfo, offset: offset }); return addPendingRequest(fileInfo.name, offset, MessageIds.TERN_CALLED_FUNC_TYPE_MSG); }
[ "function", "getTernFunctionType", "(", "fileInfo", ",", "offset", ")", "{", "postMessage", "(", "{", "type", ":", "MessageIds", ".", "TERN_CALLED_FUNC_TYPE_MSG", ",", "fileInfo", ":", "fileInfo", ",", "offset", ":", "offset", "}", ")", ";", "return", "addPend...
Get a Promise for the function type from TernJS. @param {{type: string, name: string, offsetLines: number, text: string}} fileInfo - type of update, name of file, and the text of the update. For "full" updates, the whole text of the file is present. For "part" updates, the changed portion of the text. For "empty" updates, the file has not been modified and the text is empty. @param {{line:number, ch:number}} offset - the line, column info for what we want the function type of. @return {jQuery.Promise} - a promise that will resolve to the function type of the function being called.
[ "Get", "a", "Promise", "for", "the", "function", "type", "from", "TernJS", "." ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/JSUtils/ScopeManager.js#L502-L510
train
Get tern function type
[ 30522, 3853, 2131, 16451, 11263, 27989, 13874, 1006, 5371, 2378, 14876, 1010, 16396, 1007, 1063, 2695, 7834, 3736, 3351, 1006, 1063, 2828, 1024, 4471, 9821, 1012, 28774, 2078, 1035, 2170, 1035, 4569, 2278, 1035, 2828, 1035, 5796, 2290, 1010...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
ksky521/nodeppt
packages/nodeppt-parser/lib/markdown/attrs/index.js
get
function get(arr, n) { return n >= 0 ? arr[n] : arr[arr.length + n]; }
javascript
function get(arr, n) { return n >= 0 ? arr[n] : arr[arr.length + n]; }
[ "function", "get", "(", "arr", ",", "n", ")", "{", "return", "n", ">=", "0", "?", "arr", "[", "n", "]", ":", "arr", "[", "arr", ".", "length", "+", "n", "]", ";", "}" ]
Get n item of array. Supports negative n, where -1 is last element in array. @param {array} arr @param {number} n
[ "Get", "n", "item", "of", "array", ".", "Supports", "negative", "n", "where", "-", "1", "is", "last", "element", "in", "array", "." ]
ca77e29ef818c08b0522b31e3925b073cf159b9c
https://github.com/ksky521/nodeppt/blob/ca77e29ef818c08b0522b31e3925b073cf159b9c/packages/nodeppt-parser/lib/markdown/attrs/index.js#L158-L160
train
Get the n - th item from an array of words
[ 30522, 3853, 2131, 1006, 12098, 2099, 1010, 1050, 1007, 1063, 2709, 1050, 1028, 1027, 1014, 1029, 12098, 2099, 1031, 1050, 1033, 1024, 12098, 2099, 1031, 12098, 2099, 1012, 3091, 1009, 1050, 1033, 1025, 1065, 102, 0, 0, 0, 0, 0, 0, 0,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
angular/material
docs/app/js/codepen.js
translate
function translate(demo, externalScripts) { var files = demo.files; return appendLicenses({ title: demo.title, html: processHtml(demo), head: LINK_FONTS_ROBOTO, js: processJs(files.js), css: mergeFiles(files.css).join(' '), js_external: externalScripts.concat([ASSET_CACHE_JS, CORE_JS]).join(';'), css_external: [CORE_CSS, DOC_CSS].join(';') }); }
javascript
function translate(demo, externalScripts) { var files = demo.files; return appendLicenses({ title: demo.title, html: processHtml(demo), head: LINK_FONTS_ROBOTO, js: processJs(files.js), css: mergeFiles(files.css).join(' '), js_external: externalScripts.concat([ASSET_CACHE_JS, CORE_JS]).join(';'), css_external: [CORE_CSS, DOC_CSS].join(';') }); }
[ "function", "translate", "(", "demo", ",", "externalScripts", ")", "{", "var", "files", "=", "demo", ".", "files", ";", "return", "appendLicenses", "(", "{", "title", ":", "demo", ".", "title", ",", "html", ":", "processHtml", "(", "demo", ")", ",", "h...
Translates a demo model to match Codepen's post data See http://blog.codepen.io/documentation/api/prefill
[ "Translates", "a", "demo", "model", "to", "match", "Codepen", "s", "post", "data", "See", "http", ":", "//", "blog", ".", "codepen", ".", "io", "/", "documentation", "/", "api", "/", "prefill" ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/docs/app/js/codepen.js#L80-L94
train
Translate a demo to a language specific language
[ 30522, 3853, 17637, 1006, 9703, 1010, 6327, 22483, 2015, 1007, 1063, 13075, 6764, 1027, 9703, 1012, 6764, 1025, 2709, 10439, 10497, 13231, 12325, 2015, 1006, 1063, 2516, 1024, 9703, 1012, 2516, 1010, 16129, 1024, 2832, 11039, 19968, 1006, 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...
SAP/openui5
src/sap.ui.table/src/sap/ui/table/TablePointerExtension.js
function(oTable) { if (oTable._$colResize) { oTable._$colResize.toggleClass("sapUiTableColRszActive", false); oTable._$colResize = null; } oTable._iColumnResizeStart = null; oTable._bIsColumnResizerMoving = false; oTable.$().toggleClass("sapUiTableResizing", false); oTable._enableTextSelection(); var $Document = jQuery(document); $Document.unbind("touchmove.sapUiTableColumnResize"); $Document.unbind("touchend.sapUiTableColumnResize"); $Document.unbind("mousemove.sapUiTableColumnResize"); $Document.unbind("mouseup.sapUiTableColumnResize"); }
javascript
function(oTable) { if (oTable._$colResize) { oTable._$colResize.toggleClass("sapUiTableColRszActive", false); oTable._$colResize = null; } oTable._iColumnResizeStart = null; oTable._bIsColumnResizerMoving = false; oTable.$().toggleClass("sapUiTableResizing", false); oTable._enableTextSelection(); var $Document = jQuery(document); $Document.unbind("touchmove.sapUiTableColumnResize"); $Document.unbind("touchend.sapUiTableColumnResize"); $Document.unbind("mousemove.sapUiTableColumnResize"); $Document.unbind("mouseup.sapUiTableColumnResize"); }
[ "function", "(", "oTable", ")", "{", "if", "(", "oTable", ".", "_$colResize", ")", "{", "oTable", ".", "_$colResize", ".", "toggleClass", "(", "\"sapUiTableColRszActive\"", ",", "false", ")", ";", "oTable", ".", "_$colResize", "=", "null", ";", "}", "oTabl...
/* Cleans up the state which is created while resize a column via drag&drop.
[ "/", "*", "Cleans", "up", "the", "state", "which", "is", "created", "while", "resize", "a", "column", "via", "drag&drop", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TablePointerExtension.js#L225-L240
train
Removes the Column Resize event listeners.
[ 30522, 3853, 1006, 27178, 3085, 1007, 1063, 2065, 1006, 27178, 3085, 1012, 1035, 1002, 8902, 6072, 4697, 1007, 1063, 27178, 3085, 1012, 1035, 1002, 8902, 6072, 4697, 1012, 2000, 24679, 26266, 1006, 1000, 20066, 14663, 3085, 25778, 2869, 414...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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
packages/bazel/src/protractor/protractor.conf.js
setConf
function setConf(conf, name, value, msg) { if (conf[name] && conf[name] !== value) { console.warn( `Your protractor configuration specifies an option which is overwritten by Bazel: '${name}' ${msg}`); } conf[name] = value; }
javascript
function setConf(conf, name, value, msg) { if (conf[name] && conf[name] !== value) { console.warn( `Your protractor configuration specifies an option which is overwritten by Bazel: '${name}' ${msg}`); } conf[name] = value; }
[ "function", "setConf", "(", "conf", ",", "name", ",", "value", ",", "msg", ")", "{", "if", "(", "conf", "[", "name", "]", "&&", "conf", "[", "name", "]", "!==", "value", ")", "{", "console", ".", "warn", "(", "`", "${", "name", "}", "${", "msg"...
Helper function to warn when a user specified value is being overwritten
[ "Helper", "function", "to", "warn", "when", "a", "user", "specified", "value", "is", "being", "overwritten" ]
c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c
https://github.com/angular/angular/blob/c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c/packages/bazel/src/protractor/protractor.conf.js#L24-L30
train
Set a protractor configuration option
[ 30522, 3853, 2275, 8663, 2546, 1006, 9530, 2546, 1010, 2171, 1010, 3643, 1010, 5796, 2290, 1007, 1063, 2065, 1006, 9530, 2546, 1031, 2171, 1033, 1004, 1004, 9530, 2546, 1031, 2171, 1033, 999, 1027, 1027, 3643, 1007, 1063, 10122, 1012, 115...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/FindUtils.js
performReplacements
function performReplacements(results, replaceText, options) { return Async.doInParallel_aggregateErrors(Object.keys(results), function (fullPath) { return _doReplaceInOneFile(fullPath, results[fullPath], replaceText, options); }).done(function () { if (options && options.forceFilesOpen) { // If the currently selected document wasn't modified by the search, or there is no open document, // then open the first modified document. var doc = DocumentManager.getCurrentDocument(); if (!doc || !results[doc.file.fullPath] || !hasCheckedMatches(results[doc.file.fullPath])) { // Figure out the first modified document. This logic is slightly different from // SearchResultsView._getSortedFiles() because it doesn't sort the currently open file to // the top. But if the currently open file were in the search results, we wouldn't be // doing this anyway. var sortedPaths = Object.keys(results).sort(FileUtils.comparePaths), firstPath = _.find(sortedPaths, function (path) { return hasCheckedMatches(results[path]); }); if (firstPath) { var newDoc = DocumentManager.getOpenDocumentForPath(firstPath); // newDoc might be null if the replacement failed. if (newDoc) { // @todo change the `_edit` call to this: // /// CommandManager.execute(Commands.FILE_OPEN, {fullPath: firstPath}); // // The problem with doing that is that the promise returned by this // function has already been resolved by `Async.doInParallel()` and // `CommandManager.execute` is an asynchronous operation. // An asynchronous open can't be waited on (since the promise has been // resolved already) so use the synchronous version so that the next `done` // handler is blocked until the open completes MainViewManager._edit(MainViewManager.ACTIVE_PANE, newDoc); } } } } }); }
javascript
function performReplacements(results, replaceText, options) { return Async.doInParallel_aggregateErrors(Object.keys(results), function (fullPath) { return _doReplaceInOneFile(fullPath, results[fullPath], replaceText, options); }).done(function () { if (options && options.forceFilesOpen) { // If the currently selected document wasn't modified by the search, or there is no open document, // then open the first modified document. var doc = DocumentManager.getCurrentDocument(); if (!doc || !results[doc.file.fullPath] || !hasCheckedMatches(results[doc.file.fullPath])) { // Figure out the first modified document. This logic is slightly different from // SearchResultsView._getSortedFiles() because it doesn't sort the currently open file to // the top. But if the currently open file were in the search results, we wouldn't be // doing this anyway. var sortedPaths = Object.keys(results).sort(FileUtils.comparePaths), firstPath = _.find(sortedPaths, function (path) { return hasCheckedMatches(results[path]); }); if (firstPath) { var newDoc = DocumentManager.getOpenDocumentForPath(firstPath); // newDoc might be null if the replacement failed. if (newDoc) { // @todo change the `_edit` call to this: // /// CommandManager.execute(Commands.FILE_OPEN, {fullPath: firstPath}); // // The problem with doing that is that the promise returned by this // function has already been resolved by `Async.doInParallel()` and // `CommandManager.execute` is an asynchronous operation. // An asynchronous open can't be waited on (since the promise has been // resolved already) so use the synchronous version so that the next `done` // handler is blocked until the open completes MainViewManager._edit(MainViewManager.ACTIVE_PANE, newDoc); } } } } }); }
[ "function", "performReplacements", "(", "results", ",", "replaceText", ",", "options", ")", "{", "return", "Async", ".", "doInParallel_aggregateErrors", "(", "Object", ".", "keys", "(", "results", ")", ",", "function", "(", "fullPath", ")", "{", "return", "_do...
Given a set of search results, replaces them with the given replaceText, either on disk or in memory. Checks timestamps to ensure replacements are not performed in files that have changed on disk since the original search results were generated. However, does *not* check whether edits have been performed in in-memory documents since the search; it's up to the caller to guarantee this hasn't happened. (When called from the standard Find in Files UI, SearchResultsView guarantees this. If called headlessly, the caller needs to track changes.) Replacements in documents that are already open in memory at the start of the replacement are guaranteed to happen synchronously; replacements in files on disk will return an error if the on-disk file changes between the time performReplacements() is called and the time the replacement actually happens. @param {Object.<fullPath: string, {matches: Array.<{start: {line:number,ch:number}, end: {line:number,ch:number}, startOffset: number, endOffset: number, line: string}>, collapsed: boolean}>} results The list of results to replace, as returned from _doSearch.. @param {string} replaceText The text to replace each result with. @param {?Object} options An options object: forceFilesOpen: boolean - Whether to open all files in editors and do replacements there rather than doing the replacements on disk. Note that even if this is false, files that are already open in editors will have replacements done in memory. isRegexp: boolean - Whether the original query was a regexp. If true, $-substitution is performed on the replaceText. @return {$.Promise} A promise that's resolved when the replacement is finished or rejected with an array of errors if there were one or more errors. Each individual item in the array will be a {item: string, error: string} object, where item is the full path to the file that could not be updated, and error is either a FileSystem error or one of the `FindUtils.ERROR_*` constants.
[ "Given", "a", "set", "of", "search", "results", "replaces", "them", "with", "the", "given", "replaceText", "either", "on", "disk", "or", "in", "memory", ".", "Checks", "timestamps", "to", "ensure", "replacements", "are", "not", "performed", "in", "files", "t...
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/search/FindUtils.js#L239-L279
train
Perform a set of replacements in the search results.
[ 30522, 3853, 4685, 2890, 24759, 10732, 8163, 1006, 3463, 1010, 5672, 18209, 1010, 7047, 1007, 1063, 2709, 2004, 6038, 2278, 1012, 24341, 28689, 6216, 2140, 1035, 9572, 2121, 29165, 2015, 1006, 4874, 1012, 6309, 1006, 3463, 1007, 1010, 3853,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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
common/py_vulcanize/third_party/rjsmin/bench/jquery-1.7.1.js
createFlags
function createFlags( flags ) { var object = flagsCache[ flags ] = {}, i, length; flags = flags.split( /\s+/ ); for ( i = 0, length = flags.length; i < length; i++ ) { object[ flags[i] ] = true; } return object; }
javascript
function createFlags( flags ) { var object = flagsCache[ flags ] = {}, i, length; flags = flags.split( /\s+/ ); for ( i = 0, length = flags.length; i < length; i++ ) { object[ flags[i] ] = true; } return object; }
[ "function", "createFlags", "(", "flags", ")", "{", "var", "object", "=", "flagsCache", "[", "flags", "]", "=", "{", "}", ",", "i", ",", "length", ";", "flags", "=", "flags", ".", "split", "(", "/", "\\s+", "/", ")", ";", "for", "(", "i", "=", "...
Convert String-formatted flags into Object-formatted ones and store in cache
[ "Convert", "String", "-", "formatted", "flags", "into", "Object", "-", "formatted", "ones", "and", "store", "in", "cache" ]
992929ffccac68827869a497f01ee4d653ed4f25
https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/common/py_vulcanize/third_party/rjsmin/bench/jquery-1.7.1.js#L964-L972
train
Create flags object
[ 30522, 3853, 3443, 10258, 26454, 1006, 9245, 1007, 1063, 13075, 4874, 1027, 9245, 3540, 5403, 1031, 9245, 1033, 1027, 1063, 1065, 1010, 1045, 1010, 3091, 1025, 9245, 1027, 9245, 1012, 3975, 1006, 1013, 1032, 1055, 1009, 1013, 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...
jgraph/mxgraph
javascript/mxClient.js
function(text, fontSize, fontFamily, textWidth) { fontSize = (fontSize != null) ? fontSize : mxConstants.DEFAULT_FONTSIZE; fontFamily = (fontFamily != null) ? fontFamily : mxConstants.DEFAULT_FONTFAMILY; var div = document.createElement('div'); // Sets the font size and family div.style.fontFamily = fontFamily; div.style.fontSize = Math.round(fontSize) + 'px'; div.style.lineHeight = Math.round(fontSize * mxConstants.LINE_HEIGHT) + 'px'; // Disables block layout and outside wrapping and hides the div div.style.position = 'absolute'; div.style.visibility = 'hidden'; div.style.display = (mxClient.IS_QUIRKS) ? 'inline' : 'inline-block'; div.style.zoom = '1'; if (textWidth != null) { div.style.width = textWidth + 'px'; div.style.whiteSpace = 'normal'; } else { div.style.whiteSpace = 'nowrap'; } // Adds the text and inserts into DOM for updating of size div.innerHTML = text; document.body.appendChild(div); // Gets the size and removes from DOM var size = new mxRectangle(0, 0, div.offsetWidth, div.offsetHeight); document.body.removeChild(div); return size; }
javascript
function(text, fontSize, fontFamily, textWidth) { fontSize = (fontSize != null) ? fontSize : mxConstants.DEFAULT_FONTSIZE; fontFamily = (fontFamily != null) ? fontFamily : mxConstants.DEFAULT_FONTFAMILY; var div = document.createElement('div'); // Sets the font size and family div.style.fontFamily = fontFamily; div.style.fontSize = Math.round(fontSize) + 'px'; div.style.lineHeight = Math.round(fontSize * mxConstants.LINE_HEIGHT) + 'px'; // Disables block layout and outside wrapping and hides the div div.style.position = 'absolute'; div.style.visibility = 'hidden'; div.style.display = (mxClient.IS_QUIRKS) ? 'inline' : 'inline-block'; div.style.zoom = '1'; if (textWidth != null) { div.style.width = textWidth + 'px'; div.style.whiteSpace = 'normal'; } else { div.style.whiteSpace = 'nowrap'; } // Adds the text and inserts into DOM for updating of size div.innerHTML = text; document.body.appendChild(div); // Gets the size and removes from DOM var size = new mxRectangle(0, 0, div.offsetWidth, div.offsetHeight); document.body.removeChild(div); return size; }
[ "function", "(", "text", ",", "fontSize", ",", "fontFamily", ",", "textWidth", ")", "{", "fontSize", "=", "(", "fontSize", "!=", "null", ")", "?", "fontSize", ":", "mxConstants", ".", "DEFAULT_FONTSIZE", ";", "fontFamily", "=", "(", "fontFamily", "!=", "nu...
Function: getSizeForString Returns an <mxRectangle> with the size (width and height in pixels) of the given string. The string may contain HTML markup. Newlines should be converted to <br> before calling this method. The caller is responsible for sanitizing the HTML markup. Example: (code) var label = graph.getLabel(cell).replace(/\n/g, "<br>"); var size = graph.getSizeForString(label); (end) Parameters: text - String whose size should be returned. fontSize - Integer that specifies the font size in pixels. Default is <mxConstants.DEFAULT_FONTSIZE>. fontFamily - String that specifies the name of the font family. Default is <mxConstants.DEFAULT_FONTFAMILY>. textWidth - Optional width for text wrapping.
[ "Function", ":", "getSizeForString" ]
33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44
https://github.com/jgraph/mxgraph/blob/33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44/javascript/mxClient.js#L5757-L5793
train
Creates a div that will be used to display the text
[ 30522, 3853, 1006, 3793, 1010, 15489, 5332, 4371, 1010, 15489, 7011, 4328, 2135, 1010, 3793, 9148, 11927, 2232, 1007, 1063, 15489, 5332, 4371, 1027, 1006, 15489, 5332, 4371, 999, 1027, 19701, 1007, 1029, 15489, 5332, 4371, 1024, 25630, 8663...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
vuejs/vuex
dist/vuex.esm.js
Module
function Module (rawModule, runtime) { this.runtime = runtime; // Store some children item this._children = Object.create(null); // Store the origin module object which passed by programmer this._rawModule = rawModule; var rawState = rawModule.state; // Store the origin module's state this.state = (typeof rawState === 'function' ? rawState() : rawState) || {}; }
javascript
function Module (rawModule, runtime) { this.runtime = runtime; // Store some children item this._children = Object.create(null); // Store the origin module object which passed by programmer this._rawModule = rawModule; var rawState = rawModule.state; // Store the origin module's state this.state = (typeof rawState === 'function' ? rawState() : rawState) || {}; }
[ "function", "Module", "(", "rawModule", ",", "runtime", ")", "{", "this", ".", "runtime", "=", "runtime", ";", "// Store some children item", "this", ".", "_children", "=", "Object", ".", "create", "(", "null", ")", ";", "// Store the origin module object which pa...
Base data struct for store's module, package with some attribute and method
[ "Base", "data", "struct", "for", "store", "s", "module", "package", "with", "some", "attribute", "and", "method" ]
d7c7f9844831f98c5c9aaca213746c4ccc5d6929
https://github.com/vuejs/vuex/blob/d7c7f9844831f98c5c9aaca213746c4ccc5d6929/dist/vuex.esm.js#L91-L101
train
The module object
[ 30522, 3853, 11336, 1006, 6315, 5302, 8566, 2571, 1010, 2448, 7292, 1007, 1063, 2023, 1012, 2448, 7292, 1027, 2448, 7292, 1025, 1013, 1013, 3573, 2070, 2336, 8875, 2023, 1012, 1035, 2336, 1027, 4874, 1012, 3443, 1006, 19701, 1007, 1025, 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...
facebook/flow
packages/flow-remove-types/index.js
isLastNodeRemovedFromLine
function isLastNodeRemovedFromLine(context, node) { var tokens = context.ast.tokens; var priorTokenIdx = findTokenIndex(tokens, startOf(node)) - 1; var token = tokens[priorTokenIdx]; var line = node.loc.end.line; // Find previous token that was not removed on the same line. while ( priorTokenIdx >= 0 && token.loc.end.line === line && isRemovedToken(context, token) ) { token = tokens[--priorTokenIdx]; } // If there's no prior token (start of file), or the prior token is on another // line, this line must be fully removed. return !token || token.loc.end.line !== line; }
javascript
function isLastNodeRemovedFromLine(context, node) { var tokens = context.ast.tokens; var priorTokenIdx = findTokenIndex(tokens, startOf(node)) - 1; var token = tokens[priorTokenIdx]; var line = node.loc.end.line; // Find previous token that was not removed on the same line. while ( priorTokenIdx >= 0 && token.loc.end.line === line && isRemovedToken(context, token) ) { token = tokens[--priorTokenIdx]; } // If there's no prior token (start of file), or the prior token is on another // line, this line must be fully removed. return !token || token.loc.end.line !== line; }
[ "function", "isLastNodeRemovedFromLine", "(", "context", ",", "node", ")", "{", "var", "tokens", "=", "context", ".", "ast", ".", "tokens", ";", "var", "priorTokenIdx", "=", "findTokenIndex", "(", "tokens", ",", "startOf", "(", "node", ")", ")", "-", "1", ...
Returns true if node is the last to be removed from a line.
[ "Returns", "true", "if", "node", "is", "the", "last", "to", "be", "removed", "from", "a", "line", "." ]
25bc6aba258658eaf21ccc4722ef7124724a1d2b
https://github.com/facebook/flow/blob/25bc6aba258658eaf21ccc4722ef7124724a1d2b/packages/flow-remove-types/index.js#L409-L427
train
Checks if the node is the last node removed from the line.
[ 30522, 3853, 25340, 3367, 3630, 4063, 6633, 21818, 20952, 21716, 4179, 1006, 6123, 1010, 13045, 1007, 1063, 13075, 19204, 2015, 1027, 6123, 1012, 2004, 2102, 1012, 19204, 2015, 1025, 13075, 3188, 18715, 18595, 2094, 2595, 1027, 2424, 18715, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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
_classForDocument
function _classForDocument(doc) { switch (doc.getLanguage().getId()) { case "less": case "scss": return CSSPreprocessorDocument; case "css": return CSSDocument; case "javascript": return exports.config.experimental ? JSDocument : null; } if (LiveDevelopmentUtils.isHtmlFileExt(doc.file.fullPath)) { return HTMLDocument; } return null; }
javascript
function _classForDocument(doc) { switch (doc.getLanguage().getId()) { case "less": case "scss": return CSSPreprocessorDocument; case "css": return CSSDocument; case "javascript": return exports.config.experimental ? JSDocument : null; } if (LiveDevelopmentUtils.isHtmlFileExt(doc.file.fullPath)) { return HTMLDocument; } return null; }
[ "function", "_classForDocument", "(", "doc", ")", "{", "switch", "(", "doc", ".", "getLanguage", "(", ")", ".", "getId", "(", ")", ")", "{", "case", "\"less\"", ":", "case", "\"scss\"", ":", "return", "CSSPreprocessorDocument", ";", "case", "\"css\"", ":",...
Determine which document class should be used for a given document @param {Document} document
[ "Determine", "which", "document", "class", "should", "be", "used", "for", "a", "given", "document" ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/LiveDevelopment/LiveDevelopment.js#L224-L240
train
Returns the class for a given document
[ 30522, 3853, 1035, 2465, 3877, 10085, 27417, 2102, 1006, 9986, 1007, 1063, 6942, 1006, 9986, 1012, 2131, 25023, 6692, 3351, 1006, 1007, 1012, 2131, 3593, 1006, 1007, 1007, 1063, 2553, 1000, 2625, 1000, 1024, 2553, 1000, 8040, 4757, 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...
SeleniumHQ/selenium
javascript/node/selenium-webdriver/io/zip.js
load
function load(path) { return io.read(path).then(data => { let zip = new Zip; return zip.z_.loadAsync(data).then(() => zip); }); }
javascript
function load(path) { return io.read(path).then(data => { let zip = new Zip; return zip.z_.loadAsync(data).then(() => zip); }); }
[ "function", "load", "(", "path", ")", "{", "return", "io", ".", "read", "(", "path", ")", ".", "then", "(", "data", "=>", "{", "let", "zip", "=", "new", "Zip", ";", "return", "zip", ".", "z_", ".", "loadAsync", "(", "data", ")", ".", "then", "(...
Asynchronously opens a zip archive. @param {string} path to the zip archive to load. @return {!Promise<!Zip>} a promise that will resolve with the opened archive.
[ "Asynchronously", "opens", "a", "zip", "archive", "." ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/node/selenium-webdriver/io/zip.js#L154-L159
train
Load a centric coding specification file
[ 30522, 3853, 7170, 1006, 4130, 1007, 1063, 2709, 22834, 1012, 3191, 1006, 4130, 1007, 1012, 2059, 1006, 2951, 1027, 1028, 1063, 2292, 14101, 1027, 2047, 14101, 1025, 2709, 14101, 1012, 1062, 1035, 1012, 7170, 3022, 6038, 2278, 1006, 2951, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/thirdparty/blanket.js
parseStatement
function parseStatement() { var type = lookahead.type, expr, labeledBody, key, startToken; if (type === Token.EOF) { throwUnexpected(lookahead); } if (type === Token.Punctuator && lookahead.value === '{') { return parseBlock(); } startToken = lookahead; if (type === Token.Punctuator) { switch (lookahead.value) { case ';': return delegate.markEnd(parseEmptyStatement(), startToken); case '(': return delegate.markEnd(parseExpressionStatement(), startToken); default: break; } } if (type === Token.Keyword) { switch (lookahead.value) { case 'break': return delegate.markEnd(parseBreakStatement(), startToken); case 'continue': return delegate.markEnd(parseContinueStatement(), startToken); case 'debugger': return delegate.markEnd(parseDebuggerStatement(), startToken); case 'do': return delegate.markEnd(parseDoWhileStatement(), startToken); case 'for': return delegate.markEnd(parseForStatement(), startToken); case 'function': return delegate.markEnd(parseFunctionDeclaration(), startToken); case 'if': return delegate.markEnd(parseIfStatement(), startToken); case 'return': return delegate.markEnd(parseReturnStatement(), startToken); case 'switch': return delegate.markEnd(parseSwitchStatement(), startToken); case 'throw': return delegate.markEnd(parseThrowStatement(), startToken); case 'try': return delegate.markEnd(parseTryStatement(), startToken); case 'var': return delegate.markEnd(parseVariableStatement(), startToken); case 'while': return delegate.markEnd(parseWhileStatement(), startToken); case 'with': return delegate.markEnd(parseWithStatement(), startToken); default: break; } } expr = parseExpression(); // 12.12 Labelled Statements if ((expr.type === Syntax.Identifier) && match(':')) { lex(); key = '$' + expr.name; if (Object.prototype.hasOwnProperty.call(state.labelSet, key)) { throwError({}, Messages.Redeclaration, 'Label', expr.name); } state.labelSet[key] = true; labeledBody = parseStatement(); delete state.labelSet[key]; return delegate.markEnd(delegate.createLabeledStatement(expr, labeledBody), startToken); } consumeSemicolon(); return delegate.markEnd(delegate.createExpressionStatement(expr), startToken); }
javascript
function parseStatement() { var type = lookahead.type, expr, labeledBody, key, startToken; if (type === Token.EOF) { throwUnexpected(lookahead); } if (type === Token.Punctuator && lookahead.value === '{') { return parseBlock(); } startToken = lookahead; if (type === Token.Punctuator) { switch (lookahead.value) { case ';': return delegate.markEnd(parseEmptyStatement(), startToken); case '(': return delegate.markEnd(parseExpressionStatement(), startToken); default: break; } } if (type === Token.Keyword) { switch (lookahead.value) { case 'break': return delegate.markEnd(parseBreakStatement(), startToken); case 'continue': return delegate.markEnd(parseContinueStatement(), startToken); case 'debugger': return delegate.markEnd(parseDebuggerStatement(), startToken); case 'do': return delegate.markEnd(parseDoWhileStatement(), startToken); case 'for': return delegate.markEnd(parseForStatement(), startToken); case 'function': return delegate.markEnd(parseFunctionDeclaration(), startToken); case 'if': return delegate.markEnd(parseIfStatement(), startToken); case 'return': return delegate.markEnd(parseReturnStatement(), startToken); case 'switch': return delegate.markEnd(parseSwitchStatement(), startToken); case 'throw': return delegate.markEnd(parseThrowStatement(), startToken); case 'try': return delegate.markEnd(parseTryStatement(), startToken); case 'var': return delegate.markEnd(parseVariableStatement(), startToken); case 'while': return delegate.markEnd(parseWhileStatement(), startToken); case 'with': return delegate.markEnd(parseWithStatement(), startToken); default: break; } } expr = parseExpression(); // 12.12 Labelled Statements if ((expr.type === Syntax.Identifier) && match(':')) { lex(); key = '$' + expr.name; if (Object.prototype.hasOwnProperty.call(state.labelSet, key)) { throwError({}, Messages.Redeclaration, 'Label', expr.name); } state.labelSet[key] = true; labeledBody = parseStatement(); delete state.labelSet[key]; return delegate.markEnd(delegate.createLabeledStatement(expr, labeledBody), startToken); } consumeSemicolon(); return delegate.markEnd(delegate.createExpressionStatement(expr), startToken); }
[ "function", "parseStatement", "(", ")", "{", "var", "type", "=", "lookahead", ".", "type", ",", "expr", ",", "labeledBody", ",", "key", ",", "startToken", ";", "if", "(", "type", "===", "Token", ".", "EOF", ")", "{", "throwUnexpected", "(", "lookahead", ...
12 Statements
[ "12", "Statements" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/blanket.js#L3189-L3272
train
ECMA - 262 12. 2 Statement
[ 30522, 3853, 11968, 8583, 12259, 30524, 1007, 1025, 1065, 2065, 1006, 2828, 1027, 1027, 1027, 19204, 1012, 26136, 6593, 6692, 4263, 1004, 1004, 2298, 4430, 13775, 1012, 3643, 1027, 1027, 1027, 1005, 1063, 1005, 1007, 1063, 2709, 11968, 3366...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/core/util/serializer/ViewSerializer.js
function (oEvent) { // both xml and html view write this ui5 internal property for the serializer if (oEvent.fFunction && oEvent.fFunction._sapui_handlerName) { var sHandlerName = oEvent.fFunction._sapui_handlerName; // double check that the function is on the controller var oController = oView.getController(); if (oController[sHandlerName] || sap.ui.getCore().getConfiguration().getControllerCodeDeactivated()) { return sHandlerName; } } // TODO: ITERARTE OVER HANDLERS AND CHECK THE EVENT FUNCTION // NOTE: JQUERY GUID WON'T WORK AS THE GUID WILL BE SAVED AT THE CLOSURED FUNCTION AS WELL // WHEN THE FUNCTION IS REUSED FOR SEVERAL HANDLERS WE WILL LOSE THE INFORMATION /*for (var sHandler in oController) { if (oController[sHandler] === oEvent.fFunction) { return sHandler; } }*/ }
javascript
function (oEvent) { // both xml and html view write this ui5 internal property for the serializer if (oEvent.fFunction && oEvent.fFunction._sapui_handlerName) { var sHandlerName = oEvent.fFunction._sapui_handlerName; // double check that the function is on the controller var oController = oView.getController(); if (oController[sHandlerName] || sap.ui.getCore().getConfiguration().getControllerCodeDeactivated()) { return sHandlerName; } } // TODO: ITERARTE OVER HANDLERS AND CHECK THE EVENT FUNCTION // NOTE: JQUERY GUID WON'T WORK AS THE GUID WILL BE SAVED AT THE CLOSURED FUNCTION AS WELL // WHEN THE FUNCTION IS REUSED FOR SEVERAL HANDLERS WE WILL LOSE THE INFORMATION /*for (var sHandler in oController) { if (oController[sHandler] === oEvent.fFunction) { return sHandler; } }*/ }
[ "function", "(", "oEvent", ")", "{", "// both xml and html view write this ui5 internal property for the serializer", "if", "(", "oEvent", ".", "fFunction", "&&", "oEvent", ".", "fFunction", ".", "_sapui_handlerName", ")", "{", "var", "sHandlerName", "=", "oEvent", ".",...
a function to find the event handler name for an event
[ "a", "function", "to", "find", "the", "event", "handler", "name", "for", "an", "event" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/util/serializer/ViewSerializer.js#L142-L162
train
Returns the name of the handler that the event is on.
[ 30522, 3853, 1006, 1051, 18697, 3372, 1007, 1063, 1013, 1013, 2119, 20950, 1998, 16129, 3193, 4339, 2023, 21318, 2629, 4722, 3200, 2005, 1996, 7642, 17629, 30524, 1012, 21461, 4609, 7542, 1012, 1035, 20066, 10179, 1035, 28213, 18442, 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...
openlayers/openlayers
examples/wms-custom-proj.js
WGStoCHx
function WGStoCHx(lat, lng) { // Converts degrees dec to sex lat = DECtoSEX(lat); lng = DECtoSEX(lng); // Converts degrees to seconds (sex) lat = DEGtoSEC(lat); lng = DEGtoSEC(lng); // Axiliary values (% Bern) const lat_aux = (lat - 169028.66) / 10000; const lng_aux = (lng - 26782.5) / 10000; // Process X const x = 200147.07 + 308807.95 * lat_aux + 3745.25 * Math.pow(lng_aux, 2) + 76.63 * Math.pow(lat_aux, 2) - 194.56 * Math.pow(lng_aux, 2) * lat_aux + 119.79 * Math.pow(lat_aux, 3); return x; }
javascript
function WGStoCHx(lat, lng) { // Converts degrees dec to sex lat = DECtoSEX(lat); lng = DECtoSEX(lng); // Converts degrees to seconds (sex) lat = DEGtoSEC(lat); lng = DEGtoSEC(lng); // Axiliary values (% Bern) const lat_aux = (lat - 169028.66) / 10000; const lng_aux = (lng - 26782.5) / 10000; // Process X const x = 200147.07 + 308807.95 * lat_aux + 3745.25 * Math.pow(lng_aux, 2) + 76.63 * Math.pow(lat_aux, 2) - 194.56 * Math.pow(lng_aux, 2) * lat_aux + 119.79 * Math.pow(lat_aux, 3); return x; }
[ "function", "WGStoCHx", "(", "lat", ",", "lng", ")", "{", "// Converts degrees dec to sex", "lat", "=", "DECtoSEX", "(", "lat", ")", ";", "lng", "=", "DECtoSEX", "(", "lng", ")", ";", "// Converts degrees to seconds (sex)", "lat", "=", "DEGtoSEC", "(", "lat", ...
Convert WGS lat/long (° dec) to CH x
[ "Convert", "WGS", "lat", "/", "long", "(", "°", "dec", ")", "to", "CH", "x" ]
f366eaea522388fb575b11010e69d309164baca7
https://github.com/openlayers/openlayers/blob/f366eaea522388fb575b11010e69d309164baca7/examples/wms-custom-proj.js#L119-L143
train
Calculate the WGStoCHx
[ 30522, 3853, 1059, 5620, 3406, 2818, 2595, 1006, 2474, 2102, 1010, 1048, 3070, 1007, 1063, 1013, 1013, 19884, 5445, 11703, 2000, 3348, 2474, 2102, 1027, 11703, 22282, 2595, 1006, 2474, 2102, 1007, 1025, 1048, 3070, 1027, 11703, 22282, 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...
exceljs/exceljs
lib/xlsx/xlsx.js
function(filename, options) { var self = this; var stream; return utils.fs.exists(filename) .then(function(exists) { if (!exists) { throw new Error('File not found: ' + filename); } stream = fs.createReadStream(filename); return self.read(stream, options) .catch(function(error) { stream.close(); throw error; }); }) .then(function(workbook) { stream.close(); return workbook; }); }
javascript
function(filename, options) { var self = this; var stream; return utils.fs.exists(filename) .then(function(exists) { if (!exists) { throw new Error('File not found: ' + filename); } stream = fs.createReadStream(filename); return self.read(stream, options) .catch(function(error) { stream.close(); throw error; }); }) .then(function(workbook) { stream.close(); return workbook; }); }
[ "function", "(", "filename", ",", "options", ")", "{", "var", "self", "=", "this", ";", "var", "stream", ";", "return", "utils", ".", "fs", ".", "exists", "(", "filename", ")", ".", "then", "(", "function", "(", "exists", ")", "{", "if", "(", "!", ...
=============================================================================== Workbook ========================================================================= Read
[ "===============================================================================", "Workbook", "=========================================================================", "Read" ]
c6ee7a14d5e0e5a07bf0e475aa4dd7b9a1e907f2
https://github.com/exceljs/exceljs/blob/c6ee7a14d5e0e5a07bf0e475aa4dd7b9a1e907f2/lib/xlsx/xlsx.js#L48-L67
train
Reads a file
[ 30522, 3853, 1006, 5371, 18442, 1010, 7047, 1007, 1063, 13075, 2969, 1027, 2023, 1025, 13075, 5460, 1025, 2709, 21183, 12146, 1012, 1042, 2015, 1012, 6526, 1006, 5371, 18442, 1007, 1012, 2059, 1006, 3853, 1006, 6526, 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...
SAP/openui5
src/sap.ui.core/src/sap/ui/core/cache/CacheManager.js
function (sMethodName, aArgs) { var pCallInstance, sMsrCallInstance = "[sync ] _callInstanceMethod"; Measurement.start(sMsrCallInstance, "CM", S_MSR_CAT_CACHE_MANAGER); if (this._instance) { Log.debug("Cache Manager: calling instance..."); return this._instance[sMethodName].apply(this._instance, aArgs); } Log.debug("Cache Manager: getting instance..."); pCallInstance = this._getInstance().then(function instanceResolving(instance) { return instance[sMethodName].apply(instance, aArgs); }); Measurement.end(sMsrCallInstance); return pCallInstance; }
javascript
function (sMethodName, aArgs) { var pCallInstance, sMsrCallInstance = "[sync ] _callInstanceMethod"; Measurement.start(sMsrCallInstance, "CM", S_MSR_CAT_CACHE_MANAGER); if (this._instance) { Log.debug("Cache Manager: calling instance..."); return this._instance[sMethodName].apply(this._instance, aArgs); } Log.debug("Cache Manager: getting instance..."); pCallInstance = this._getInstance().then(function instanceResolving(instance) { return instance[sMethodName].apply(instance, aArgs); }); Measurement.end(sMsrCallInstance); return pCallInstance; }
[ "function", "(", "sMethodName", ",", "aArgs", ")", "{", "var", "pCallInstance", ",", "sMsrCallInstance", "=", "\"[sync ] _callInstanceMethod\"", ";", "Measurement", ".", "start", "(", "sMsrCallInstance", ",", "\"CM\"", ",", "S_MSR_CAT_CACHE_MANAGER", ")", ";", "if",...
Forwards method's call to the underlying implementation @param {string} sMethodName the name of the method to forward @param {any[]} aArgs array of arguments @returns {Promise} @private
[ "Forwards", "method", "s", "call", "to", "the", "underlying", "implementation" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/cache/CacheManager.js#L278-L294
train
Calls the method s method with the given arguments
[ 30522, 3853, 1006, 15488, 11031, 7716, 18442, 1010, 9779, 10623, 2015, 1007, 1063, 13075, 7473, 8095, 7076, 26897, 1010, 22434, 18992, 26655, 26897, 1027, 1000, 1031, 26351, 1033, 1035, 2655, 7076, 26897, 11368, 6806, 2094, 1000, 1025, 10903,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
mozilla-services/react-jsonschema-form
src/components/fields/ArrayField.js
DefaultArrayItem
function DefaultArrayItem(props) { const btnStyle = { flex: 1, paddingLeft: 6, paddingRight: 6, fontWeight: "bold", }; return ( <div key={props.index} className={props.className}> <div className={props.hasToolbar ? "col-xs-9" : "col-xs-12"}> {props.children} </div> {props.hasToolbar && ( <div className="col-xs-3 array-item-toolbox"> <div className="btn-group" style={{ display: "flex", justifyContent: "space-around", }}> {(props.hasMoveUp || props.hasMoveDown) && ( <IconButton icon="arrow-up" className="array-item-move-up" tabIndex="-1" style={btnStyle} disabled={props.disabled || props.readonly || !props.hasMoveUp} onClick={props.onReorderClick(props.index, props.index - 1)} /> )} {(props.hasMoveUp || props.hasMoveDown) && ( <IconButton icon="arrow-down" className="array-item-move-down" tabIndex="-1" style={btnStyle} disabled={ props.disabled || props.readonly || !props.hasMoveDown } onClick={props.onReorderClick(props.index, props.index + 1)} /> )} {props.hasRemove && ( <IconButton type="danger" icon="remove" className="array-item-remove" tabIndex="-1" style={btnStyle} disabled={props.disabled || props.readonly} onClick={props.onDropIndexClick(props.index)} /> )} </div> </div> )} </div> ); }
javascript
function DefaultArrayItem(props) { const btnStyle = { flex: 1, paddingLeft: 6, paddingRight: 6, fontWeight: "bold", }; return ( <div key={props.index} className={props.className}> <div className={props.hasToolbar ? "col-xs-9" : "col-xs-12"}> {props.children} </div> {props.hasToolbar && ( <div className="col-xs-3 array-item-toolbox"> <div className="btn-group" style={{ display: "flex", justifyContent: "space-around", }}> {(props.hasMoveUp || props.hasMoveDown) && ( <IconButton icon="arrow-up" className="array-item-move-up" tabIndex="-1" style={btnStyle} disabled={props.disabled || props.readonly || !props.hasMoveUp} onClick={props.onReorderClick(props.index, props.index - 1)} /> )} {(props.hasMoveUp || props.hasMoveDown) && ( <IconButton icon="arrow-down" className="array-item-move-down" tabIndex="-1" style={btnStyle} disabled={ props.disabled || props.readonly || !props.hasMoveDown } onClick={props.onReorderClick(props.index, props.index + 1)} /> )} {props.hasRemove && ( <IconButton type="danger" icon="remove" className="array-item-remove" tabIndex="-1" style={btnStyle} disabled={props.disabled || props.readonly} onClick={props.onDropIndexClick(props.index)} /> )} </div> </div> )} </div> ); }
[ "function", "DefaultArrayItem", "(", "props", ")", "{", "const", "btnStyle", "=", "{", "flex", ":", "1", ",", "paddingLeft", ":", "6", ",", "paddingRight", ":", "6", ",", "fontWeight", ":", "\"bold\"", ",", "}", ";", "return", "(", "<", "div", "key", ...
Used in the two templates
[ "Used", "in", "the", "two", "templates" ]
1ee343d4654a6d98ac08ece97330ce2a3f9f1de3
https://github.com/mozilla-services/react-jsonschema-form/blob/1ee343d4654a6d98ac08ece97330ce2a3f9f1de3/src/components/fields/ArrayField.js#L39-L100
train
Default array item
[ 30522, 3853, 12398, 2906, 9447, 4221, 2213, 1006, 24387, 1007, 1063, 9530, 3367, 18411, 23808, 12844, 1027, 1063, 23951, 1024, 1015, 1010, 11687, 4667, 2571, 6199, 1024, 1020, 1010, 11687, 4667, 15950, 1024, 1020, 1010, 15489, 11179, 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...
SheetJS/js-xlsx
bits/69_chartxml.js
parse_chart
function parse_chart(data/*:?string*/, name/*:string*/, opts, rels, wb, csheet) { var cs/*:Worksheet*/ = ((csheet || {"!type":"chart"})/*:any*/); if(!data) return csheet; /* 21.2.2.27 chart CT_Chart */ var C = 0, R = 0, col = "A"; var refguess = {s: {r:2000000, c:2000000}, e: {r:0, c:0} }; /* 21.2.2.120 numCache CT_NumData */ (data.match(/<c:numCache>[\s\S]*?<\/c:numCache>/gm)||[]).forEach(function(nc) { var cache = parse_numCache(nc); refguess.s.r = refguess.s.c = 0; refguess.e.c = C; col = encode_col(C); cache[0].forEach(function(n,i) { cs[col + encode_row(i)] = {t:'n', v:n, z:cache[1] }; R = i; }); if(refguess.e.r < R) refguess.e.r = R; ++C; }); if(C > 0) cs["!ref"] = encode_range(refguess); return cs; }
javascript
function parse_chart(data/*:?string*/, name/*:string*/, opts, rels, wb, csheet) { var cs/*:Worksheet*/ = ((csheet || {"!type":"chart"})/*:any*/); if(!data) return csheet; /* 21.2.2.27 chart CT_Chart */ var C = 0, R = 0, col = "A"; var refguess = {s: {r:2000000, c:2000000}, e: {r:0, c:0} }; /* 21.2.2.120 numCache CT_NumData */ (data.match(/<c:numCache>[\s\S]*?<\/c:numCache>/gm)||[]).forEach(function(nc) { var cache = parse_numCache(nc); refguess.s.r = refguess.s.c = 0; refguess.e.c = C; col = encode_col(C); cache[0].forEach(function(n,i) { cs[col + encode_row(i)] = {t:'n', v:n, z:cache[1] }; R = i; }); if(refguess.e.r < R) refguess.e.r = R; ++C; }); if(C > 0) cs["!ref"] = encode_range(refguess); return cs; }
[ "function", "parse_chart", "(", "data", "/*:?string*/", ",", "name", "/*:string*/", ",", "opts", ",", "rels", ",", "wb", ",", "csheet", ")", "{", "var", "cs", "/*:Worksheet*/", "=", "(", "(", "csheet", "||", "{", "\"!type\"", ":", "\"chart\"", "}", ")", ...
/* 21.2 DrawingML - Charts
[ "/", "*", "21", ".", "2", "DrawingML", "-", "Charts" ]
9a6d8a1d3d80c78dad5201fb389316f935279cdc
https://github.com/SheetJS/js-xlsx/blob/9a6d8a1d3d80c78dad5201fb389316f935279cdc/bits/69_chartxml.js#L18-L41
train
Parse chart data
[ 30522, 3853, 11968, 3366, 1035, 3673, 1006, 2951, 1013, 1008, 1024, 1029, 5164, 1008, 1013, 1010, 2171, 1013, 1008, 1024, 5164, 1008, 1013, 1010, 23569, 2015, 1010, 2128, 4877, 1010, 25610, 1010, 20116, 21030, 2102, 1007, 1063, 13075, 20116...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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-extra-parens.js
isInReturnStatement
function isInReturnStatement(node) { for (let currentNode = node; currentNode; currentNode = currentNode.parent) { if ( currentNode.type === "ReturnStatement" || (currentNode.type === "ArrowFunctionExpression" && currentNode.body.type !== "BlockStatement") ) { return true; } } return false; }
javascript
function isInReturnStatement(node) { for (let currentNode = node; currentNode; currentNode = currentNode.parent) { if ( currentNode.type === "ReturnStatement" || (currentNode.type === "ArrowFunctionExpression" && currentNode.body.type !== "BlockStatement") ) { return true; } } return false; }
[ "function", "isInReturnStatement", "(", "node", ")", "{", "for", "(", "let", "currentNode", "=", "node", ";", "currentNode", ";", "currentNode", "=", "currentNode", ".", "parent", ")", "{", "if", "(", "currentNode", ".", "type", "===", "\"ReturnStatement\"", ...
Determines if a node is in a return statement @param {ASTNode} node - The node to be checked. @returns {boolean} True if the node is in a return statement. @private
[ "Determines", "if", "a", "node", "is", "in", "a", "return", "statement" ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/no-extra-parens.js#L171-L182
train
isInReturnStatement - check if node is in return statement
[ 30522, 3853, 2003, 2378, 13465, 14287, 9153, 18532, 4765, 1006, 13045, 1007, 1063, 2005, 1006, 2292, 2783, 3630, 3207, 1027, 13045, 1025, 2783, 3630, 3207, 1025, 2783, 3630, 3207, 1027, 2783, 3630, 3207, 1012, 6687, 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...
SAP/openui5
src/sap.ui.core/src/sap/ui/core/Core.js
preloadLibraryAsync
function preloadLibraryAsync(libConfig) { var that = this; libConfig = evalLibConfig(libConfig); var lib = libConfig.name, fileType = libConfig.fileType, libPackage = lib.replace(/\./g, '/'), http2 = this.oConfiguration.getDepCache(); if ( fileType === 'none' || !!sap.ui.loader._.getModuleState(libPackage + '/library.js') ) { return Promise.resolve(true); } var libInfo = mLibraryPreloadBundles[lib] || (mLibraryPreloadBundles[lib] = { }); // return any existing promise (either lib is currently loading or has been loaded) if ( libInfo.promise ) { return libInfo.promise; } // otherwise mark as pending libInfo.pending = true; libInfo.async = true; // first preload code, resolves with list of dependencies (or undefined) var p; if ( fileType !== 'json' /* 'js' or 'both', not forced to JSON */ ) { var sPreloadModule = libPackage + (http2 ? '/library-h2-preload.js' : '/library-preload.js'); p = sap.ui.loader._.loadJSResourceAsync(sPreloadModule).then( function() { return dependenciesFromManifest(lib); }, function(e) { // loading library-preload.js failed, might be an old style lib with a library-preload.json only. // with json === false, this fallback can be suppressed if ( fileType !== 'js' /* 'both' */ ) { Log.error("failed to load '" + sPreloadModule + "' (" + (e && e.message || e) + "), falling back to library-preload.json"); return loadJSONAsync(lib); } // ignore other errors } ); } else { p = loadJSONAsync(lib); } // load dependencies, if there are any libInfo.promise = p.then(function(dependencies) { var aPromises = [], oManifest = getManifest(lib); if ( dependencies && dependencies.length ) { dependencies = VersionInfo._getTransitiveDependencyForLibraries(dependencies); aPromises = dependencies.map(preloadLibraryAsync.bind(that)); } if (oManifest && Version(oManifest._version).compareTo("1.9.0") >= 0) { aPromises.push(that.getLibraryResourceBundle(lib, true)); } return Promise.all(aPromises).then(function() { libInfo.pending = false; }); }); // return resulting promise return libInfo.promise; }
javascript
function preloadLibraryAsync(libConfig) { var that = this; libConfig = evalLibConfig(libConfig); var lib = libConfig.name, fileType = libConfig.fileType, libPackage = lib.replace(/\./g, '/'), http2 = this.oConfiguration.getDepCache(); if ( fileType === 'none' || !!sap.ui.loader._.getModuleState(libPackage + '/library.js') ) { return Promise.resolve(true); } var libInfo = mLibraryPreloadBundles[lib] || (mLibraryPreloadBundles[lib] = { }); // return any existing promise (either lib is currently loading or has been loaded) if ( libInfo.promise ) { return libInfo.promise; } // otherwise mark as pending libInfo.pending = true; libInfo.async = true; // first preload code, resolves with list of dependencies (or undefined) var p; if ( fileType !== 'json' /* 'js' or 'both', not forced to JSON */ ) { var sPreloadModule = libPackage + (http2 ? '/library-h2-preload.js' : '/library-preload.js'); p = sap.ui.loader._.loadJSResourceAsync(sPreloadModule).then( function() { return dependenciesFromManifest(lib); }, function(e) { // loading library-preload.js failed, might be an old style lib with a library-preload.json only. // with json === false, this fallback can be suppressed if ( fileType !== 'js' /* 'both' */ ) { Log.error("failed to load '" + sPreloadModule + "' (" + (e && e.message || e) + "), falling back to library-preload.json"); return loadJSONAsync(lib); } // ignore other errors } ); } else { p = loadJSONAsync(lib); } // load dependencies, if there are any libInfo.promise = p.then(function(dependencies) { var aPromises = [], oManifest = getManifest(lib); if ( dependencies && dependencies.length ) { dependencies = VersionInfo._getTransitiveDependencyForLibraries(dependencies); aPromises = dependencies.map(preloadLibraryAsync.bind(that)); } if (oManifest && Version(oManifest._version).compareTo("1.9.0") >= 0) { aPromises.push(that.getLibraryResourceBundle(lib, true)); } return Promise.all(aPromises).then(function() { libInfo.pending = false; }); }); // return resulting promise return libInfo.promise; }
[ "function", "preloadLibraryAsync", "(", "libConfig", ")", "{", "var", "that", "=", "this", ";", "libConfig", "=", "evalLibConfig", "(", "libConfig", ")", ";", "var", "lib", "=", "libConfig", ".", "name", ",", "fileType", "=", "libConfig", ".", "fileType", ...
Preloads a library asynchronously. @param {string|object} libConfig Name of the library to preload or settings object describing library @param {string} [libConfig.name] Name of the library to preload @param {boolean|undefined} [libConfig.json] Whether library supports only JSON (<code>true</code>) or only JS (<code>false</code>) or whether both should be tried (undefined) @returns {Promise} A promise to be fulfilled when the library has been preloaded @private
[ "Preloads", "a", "library", "asynchronously", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Core.js#L1599-L1669
train
Load a library asynchronously
[ 30522, 3853, 3653, 11066, 29521, 19848, 16303, 6038, 2278, 1006, 5622, 9818, 2239, 8873, 2290, 1007, 1063, 13075, 2008, 1027, 2023, 1025, 5622, 9818, 2239, 8873, 2290, 1027, 9345, 6894, 9818, 2239, 8873, 2290, 1006, 5622, 9818, 2239, 8873, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
chriso/validator.js
lib/isCreditCard.js
isCreditCard
function isCreditCard(str) { (0, _assertString.default)(str); var sanitized = str.replace(/[- ]+/g, ''); if (!creditCard.test(sanitized)) { return false; } var sum = 0; var digit; var tmpNum; var shouldDouble; for (var i = sanitized.length - 1; i >= 0; i--) { digit = sanitized.substring(i, i + 1); tmpNum = parseInt(digit, 10); if (shouldDouble) { tmpNum *= 2; if (tmpNum >= 10) { sum += tmpNum % 10 + 1; } else { sum += tmpNum; } } else { sum += tmpNum; } shouldDouble = !shouldDouble; } return !!(sum % 10 === 0 ? sanitized : false); }
javascript
function isCreditCard(str) { (0, _assertString.default)(str); var sanitized = str.replace(/[- ]+/g, ''); if (!creditCard.test(sanitized)) { return false; } var sum = 0; var digit; var tmpNum; var shouldDouble; for (var i = sanitized.length - 1; i >= 0; i--) { digit = sanitized.substring(i, i + 1); tmpNum = parseInt(digit, 10); if (shouldDouble) { tmpNum *= 2; if (tmpNum >= 10) { sum += tmpNum % 10 + 1; } else { sum += tmpNum; } } else { sum += tmpNum; } shouldDouble = !shouldDouble; } return !!(sum % 10 === 0 ? sanitized : false); }
[ "function", "isCreditCard", "(", "str", ")", "{", "(", "0", ",", "_assertString", ".", "default", ")", "(", "str", ")", ";", "var", "sanitized", "=", "str", ".", "replace", "(", "/", "[- ]+", "/", "g", ",", "''", ")", ";", "if", "(", "!", "credit...
/* eslint-enable max-len
[ "/", "*", "eslint", "-", "enable", "max", "-", "len" ]
63e4c78f07d08543af4be7b6c2c9cf24df009003
https://github.com/chriso/validator.js/blob/63e4c78f07d08543af4be7b6c2c9cf24df009003/lib/isCreditCard.js#L16-L49
train
Check if a string is a credit card
[ 30522, 3853, 2003, 16748, 23194, 11522, 1006, 2358, 2099, 30524, 1005, 1005, 1007, 1025, 2065, 1006, 999, 4923, 11522, 1012, 3231, 1006, 2624, 25090, 5422, 1007, 1007, 1063, 2709, 6270, 1025, 1065, 13075, 7680, 1027, 1014, 1025, 13075, 1534...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/core/LocaleData.js
function(sCurrencySymbol) { var oCurrencySymbols = this._get("currencySymbols"), sCurrencyCode; for (sCurrencyCode in oCurrencySymbols) { if (oCurrencySymbols[sCurrencyCode] === sCurrencySymbol) { return sCurrencyCode; } } return sCurrencySymbol; }
javascript
function(sCurrencySymbol) { var oCurrencySymbols = this._get("currencySymbols"), sCurrencyCode; for (sCurrencyCode in oCurrencySymbols) { if (oCurrencySymbols[sCurrencyCode] === sCurrencySymbol) { return sCurrencyCode; } } return sCurrencySymbol; }
[ "function", "(", "sCurrencySymbol", ")", "{", "var", "oCurrencySymbols", "=", "this", ".", "_get", "(", "\"currencySymbols\"", ")", ",", "sCurrencyCode", ";", "for", "(", "sCurrencyCode", "in", "oCurrencySymbols", ")", "{", "if", "(", "oCurrencySymbols", "[", ...
Returns the currency code which is corresponded with the given currency symbol. @param {string} sCurrencySymbol The currency symbol which needs to be converted to currency code @return {string} The corresponded currency code defined for the given currency symbol. The given currency symbol is returned if no currency code can be found by using the given currency symbol. @public @since 1.27.0
[ "Returns", "the", "currency", "code", "which", "is", "corresponded", "with", "the", "given", "currency", "symbol", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/LocaleData.js#L1007-L1015
train
Returns the currency symbol for the given currency symbol.
[ 30522, 3853, 1006, 8040, 3126, 7389, 5666, 6508, 13344, 2140, 1007, 1063, 13075, 1051, 10841, 14343, 9407, 6508, 13344, 4877, 1027, 2023, 1012, 1035, 2131, 1006, 1000, 9598, 6508, 13344, 4877, 1000, 1007, 1010, 8040, 3126, 7389, 5666, 16044...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
aframevr/aframe
src/components/light.js
function (data) { var angle = data.angle; var color = new THREE.Color(data.color); this.rendererSystem.applyColorCorrection(color); color = color.getHex(); var decay = data.decay; var distance = data.distance; var groundColor = new THREE.Color(data.groundColor); this.rendererSystem.applyColorCorrection(groundColor); groundColor = groundColor.getHex(); var intensity = data.intensity; var type = data.type; var target = data.target; var light = null; switch (type.toLowerCase()) { case 'ambient': { return new THREE.AmbientLight(color, intensity); } case 'directional': { light = new THREE.DirectionalLight(color, intensity); this.defaultTarget = light.target; if (target) { if (target.hasLoaded) { this.onSetTarget(target, light); } else { target.addEventListener('loaded', bind(this.onSetTarget, this, target, light)); } } return light; } case 'hemisphere': { return new THREE.HemisphereLight(color, groundColor, intensity); } case 'point': { return new THREE.PointLight(color, intensity, distance, decay); } case 'spot': { light = new THREE.SpotLight(color, intensity, distance, degToRad(angle), data.penumbra, decay); this.defaultTarget = light.target; if (target) { if (target.hasLoaded) { this.onSetTarget(target, light); } else { target.addEventListener('loaded', bind(this.onSetTarget, this, target, light)); } } return light; } default: { warn('%s is not a valid light type. ' + 'Choose from ambient, directional, hemisphere, point, spot.', type); } } }
javascript
function (data) { var angle = data.angle; var color = new THREE.Color(data.color); this.rendererSystem.applyColorCorrection(color); color = color.getHex(); var decay = data.decay; var distance = data.distance; var groundColor = new THREE.Color(data.groundColor); this.rendererSystem.applyColorCorrection(groundColor); groundColor = groundColor.getHex(); var intensity = data.intensity; var type = data.type; var target = data.target; var light = null; switch (type.toLowerCase()) { case 'ambient': { return new THREE.AmbientLight(color, intensity); } case 'directional': { light = new THREE.DirectionalLight(color, intensity); this.defaultTarget = light.target; if (target) { if (target.hasLoaded) { this.onSetTarget(target, light); } else { target.addEventListener('loaded', bind(this.onSetTarget, this, target, light)); } } return light; } case 'hemisphere': { return new THREE.HemisphereLight(color, groundColor, intensity); } case 'point': { return new THREE.PointLight(color, intensity, distance, decay); } case 'spot': { light = new THREE.SpotLight(color, intensity, distance, degToRad(angle), data.penumbra, decay); this.defaultTarget = light.target; if (target) { if (target.hasLoaded) { this.onSetTarget(target, light); } else { target.addEventListener('loaded', bind(this.onSetTarget, this, target, light)); } } return light; } default: { warn('%s is not a valid light type. ' + 'Choose from ambient, directional, hemisphere, point, spot.', type); } } }
[ "function", "(", "data", ")", "{", "var", "angle", "=", "data", ".", "angle", ";", "var", "color", "=", "new", "THREE", ".", "Color", "(", "data", ".", "color", ")", ";", "this", ".", "rendererSystem", ".", "applyColorCorrection", "(", "color", ")", ...
Creates a new three.js light object given data object defining the light. @param {object} data
[ "Creates", "a", "new", "three", ".", "js", "light", "object", "given", "data", "object", "defining", "the", "light", "." ]
24acc78a7299a4cdfe3ef617f4d40ddf6275c992
https://github.com/aframevr/aframe/blob/24acc78a7299a4cdfe3ef617f4d40ddf6275c992/src/components/light.js#L212-L271
train
Creates a new light object
[ 30522, 3853, 1006, 2951, 1007, 1063, 13075, 6466, 1027, 2951, 1012, 6466, 1025, 13075, 3609, 1027, 2047, 2093, 1012, 3609, 1006, 2951, 1012, 3609, 1007, 1025, 2023, 1012, 17552, 2545, 27268, 6633, 1012, 6611, 18717, 27108, 2890, 7542, 1006,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
lib/jsdoc/ui5/template/publish.js
createAPIJS
function createAPIJS(symbols, filename) { var output = []; var rkeywords = /^(?:abstract|as|boolean|break|byte|case|catch|char|class|continue|const|debugger|default|delete|do|double|else|enum|export|extends|false|final|finally|float|for|function|goto|if|implements|import|in|instanceof|int|interface|is|long|namespace|native|new|null|package|private|protected|public|return|short|static|super|switch|synchronized|this|throw|throws|transient|true|try|typeof|use|var|void|volatile|while|with)$/; function isNoKeyword($) { return !rkeywords.test($.name); } function isAPI($) { return $.access === 'public' || $.access === 'protected' || !$.access; } function writeln(args) { if ( arguments.length ) { for (var i = 0; i < arguments.length; i++) { output.push(arguments[i]); } } output.push("\n"); } function unwrap(docletSrc) { if (!docletSrc) { return ''; } // note: keep trailing whitespace for @examples // extra opening/closing stars are ignored // left margin is considered a star and a space // use the /m flag on regex to avoid having to guess what this platform's newline is docletSrc = docletSrc.replace(/^\/\*\*+/, '') // remove opening slash+stars .replace(/\**\*\/$/, "\\Z") // replace closing star slash with end-marker .replace(/^\s*(\* ?|\\Z)/gm, '') // remove left margin like: spaces+star or spaces+end-marker .replace(/\s*\\Z$/g, ''); // remove end-marker return docletSrc; } function comment($, sMetaType) { var s = unwrap($.comment.toString()); // remove the @desc tag s = s.replace(/(\r\n|\r|\n)/gm, "\n"); s = s.replace(/^\s*@desc\s*/gm, ""); s = s.replace(/^\s*@alias[^\r\n]*(\r\n|\r|\n)?/gm, ""); s = s.replace(/^\s*@name[^\r\n]*(\r\n|\r|\n)?/gm, ""); s = s.replace(/^\s*@function[^\r\n]*(\r\n|\r|\n)?/gm, ""); s = s.replace(/^\s*@author[^\r\n]*(\r\n|\r|\n)?/gm, ""); s = s.replace(/^\s*@synthetic[^\r\n]*(\r\n|\r|\n)?/gm, ""); s = s.replace(/^\s*<\/p><p>\s*(\r\n|\r|\n)?/gm, "\n"); // skip empty documentation if ( !s ) { return; } // for namespaces, enforce the @.memberof tag if ( sMetaType === "namespace" && $.memberof && s.indexOf("@memberof") < 0 ) { s = s + "\n@memberof " + $.memberof; } writeln("/**\n * " + s.replace(/\n/g, "\n * ") + "\n */"); /* writeln("/**"); writeln(s.split(/\r\n|\r|\n/g).map(function($) { return " * " + $;}).join("\r\n")); writeln(" * /"); */ } function signature($) { var p = $.params, r = [], i; if ( p ) { for (i = 0; i < p.length; i++) { // ignore @param tags for 'virtual' params that are used to document members of config-like params // (e.g. like "@param param1.key ...") if (p[i].name && p[i].name.indexOf('.') < 0) { r.push(p[i].name); } } } return r.join(','); } function qname(member,parent) { var r = member.memberof; if ( member.scope !== 'static' ) { r += ".prototype"; } return (r ? r + "." : "") + member.name; } var mValues = { "boolean" : "false", "int" : "0", "float" : "0.0", "number" : "0.0", "string" : "\"\"", "object" : "new Object()", "function" : "function() {}" }; function valueForType(type) { if ( type && type.names && type.names[0] ) { type = type.names[0]; if ( REGEXP_ARRAY_TYPE.test(type) || type.indexOf("[]") > 0 ) { return "new Array()"; } else if ( mValues[type] ) { return mValues[type]; } else if ( type.indexOf(".") > 0 ) { return "new " + type + "()"; } else { // return "/* unsupported type: " + member.type + " */ null"; return "null"; } } } function value(member) { return valueForType(member.type); } function retvalue(member) { //debug(member); var r = valueForType(member.type || (member.returns && member.returns.length && member.returns[0] && member.returns[0].type && member.returns[0].type)); if ( r ) { return "return " + r + ";"; } return ""; } var sortedSymbols = symbols.slice(0).filter(function($) { return isaClass($) && isAPI($) && !$.synthetic; }).sort(sortByAlias); // sort only a copy(!) of the symbols, otherwise the SymbolSet lookup is broken sortedSymbols.forEach(function(symbol) { var sMetaType = (symbol.kind === 'member' && symbol.isEnum) ? 'enum' : symbol.kind; if ( sMetaType ) { writeln(""); writeln("// ---- " + symbol.longname + " --------------------------------------------------------------------------"); writeln(""); var memberId, member; var ownProperties = childrenOfKind(symbol, 'property').own.filter(isNoKeyword).sort(sortByAlias); if ( sMetaType === "class" ) { comment(symbol, sMetaType); writeln(symbol.longname + " = function(" + signature(symbol) + ") {};"); for ( memberId in ownProperties ) { member = ownProperties[memberId]; comment(member, sMetaType); writeln(qname(member, symbol) + " = " + value(member)); writeln(""); } } else if ( sMetaType === 'namespace' || sMetaType === 'enum' ) { //debug("found namespace " + symbol.longname); //debug(ownProperties); if ( ownProperties.length ) { writeln("// dummy function to make Eclipse aware of namespace"); writeln(symbol.longname + ".toString = function() { return \"\"; };"); } } var ownEvents = childrenOfKind(symbol, 'event').own.filter(isNoKeyword).sort(sortByAlias); if ( ownEvents.length ) { for ( memberId in ownEvents ) { member = ownEvents[memberId]; comment(member, sMetaType); writeln(qname(member, symbol) + " = function(" + signature(member) + ") { " + retvalue(member) + " };"); writeln(""); } } var ownMethods = childrenOfKind(symbol, 'method').own.filter(isNoKeyword).sort(sortByAlias); if ( ownMethods.length ) { for ( memberId in ownMethods ) { member = ownMethods[memberId]; comment(member, sMetaType); writeln(qname(member, symbol) + " = function(" + signature(member) + ") { " + retvalue(member) + " };"); writeln(""); } } } }); writeln("// ---- static fields of namespaces ---------------------------------------------------------------------"); sortedSymbols.forEach(function(symbol) { var sMetaType = (symbol.kind === 'member' && symbol.isEnum) ? 'enum' : symbol.kind; if ( sMetaType === 'namespace' || sMetaType === 'enum' ) { var ownProperties = childrenOfKind(symbol, 'property').own.filter(isNoKeyword).sort(sortByAlias); if ( ownProperties.length ) { writeln(""); writeln("// ---- " + symbol.longname + " --------------------------------------------------------------------------"); writeln(""); for (var memberId in ownProperties ) { var member = ownProperties[memberId]; comment(member, sMetaType); writeln(qname(member, symbol) + " = " + value(member) + ";"); writeln(""); } } } }); fs.mkPath(path.dirname(filename)); fs.writeFileSync(filename, output.join(""), 'utf8'); info(" saved as " + filename); }
javascript
function createAPIJS(symbols, filename) { var output = []; var rkeywords = /^(?:abstract|as|boolean|break|byte|case|catch|char|class|continue|const|debugger|default|delete|do|double|else|enum|export|extends|false|final|finally|float|for|function|goto|if|implements|import|in|instanceof|int|interface|is|long|namespace|native|new|null|package|private|protected|public|return|short|static|super|switch|synchronized|this|throw|throws|transient|true|try|typeof|use|var|void|volatile|while|with)$/; function isNoKeyword($) { return !rkeywords.test($.name); } function isAPI($) { return $.access === 'public' || $.access === 'protected' || !$.access; } function writeln(args) { if ( arguments.length ) { for (var i = 0; i < arguments.length; i++) { output.push(arguments[i]); } } output.push("\n"); } function unwrap(docletSrc) { if (!docletSrc) { return ''; } // note: keep trailing whitespace for @examples // extra opening/closing stars are ignored // left margin is considered a star and a space // use the /m flag on regex to avoid having to guess what this platform's newline is docletSrc = docletSrc.replace(/^\/\*\*+/, '') // remove opening slash+stars .replace(/\**\*\/$/, "\\Z") // replace closing star slash with end-marker .replace(/^\s*(\* ?|\\Z)/gm, '') // remove left margin like: spaces+star or spaces+end-marker .replace(/\s*\\Z$/g, ''); // remove end-marker return docletSrc; } function comment($, sMetaType) { var s = unwrap($.comment.toString()); // remove the @desc tag s = s.replace(/(\r\n|\r|\n)/gm, "\n"); s = s.replace(/^\s*@desc\s*/gm, ""); s = s.replace(/^\s*@alias[^\r\n]*(\r\n|\r|\n)?/gm, ""); s = s.replace(/^\s*@name[^\r\n]*(\r\n|\r|\n)?/gm, ""); s = s.replace(/^\s*@function[^\r\n]*(\r\n|\r|\n)?/gm, ""); s = s.replace(/^\s*@author[^\r\n]*(\r\n|\r|\n)?/gm, ""); s = s.replace(/^\s*@synthetic[^\r\n]*(\r\n|\r|\n)?/gm, ""); s = s.replace(/^\s*<\/p><p>\s*(\r\n|\r|\n)?/gm, "\n"); // skip empty documentation if ( !s ) { return; } // for namespaces, enforce the @.memberof tag if ( sMetaType === "namespace" && $.memberof && s.indexOf("@memberof") < 0 ) { s = s + "\n@memberof " + $.memberof; } writeln("/**\n * " + s.replace(/\n/g, "\n * ") + "\n */"); /* writeln("/**"); writeln(s.split(/\r\n|\r|\n/g).map(function($) { return " * " + $;}).join("\r\n")); writeln(" * /"); */ } function signature($) { var p = $.params, r = [], i; if ( p ) { for (i = 0; i < p.length; i++) { // ignore @param tags for 'virtual' params that are used to document members of config-like params // (e.g. like "@param param1.key ...") if (p[i].name && p[i].name.indexOf('.') < 0) { r.push(p[i].name); } } } return r.join(','); } function qname(member,parent) { var r = member.memberof; if ( member.scope !== 'static' ) { r += ".prototype"; } return (r ? r + "." : "") + member.name; } var mValues = { "boolean" : "false", "int" : "0", "float" : "0.0", "number" : "0.0", "string" : "\"\"", "object" : "new Object()", "function" : "function() {}" }; function valueForType(type) { if ( type && type.names && type.names[0] ) { type = type.names[0]; if ( REGEXP_ARRAY_TYPE.test(type) || type.indexOf("[]") > 0 ) { return "new Array()"; } else if ( mValues[type] ) { return mValues[type]; } else if ( type.indexOf(".") > 0 ) { return "new " + type + "()"; } else { // return "/* unsupported type: " + member.type + " */ null"; return "null"; } } } function value(member) { return valueForType(member.type); } function retvalue(member) { //debug(member); var r = valueForType(member.type || (member.returns && member.returns.length && member.returns[0] && member.returns[0].type && member.returns[0].type)); if ( r ) { return "return " + r + ";"; } return ""; } var sortedSymbols = symbols.slice(0).filter(function($) { return isaClass($) && isAPI($) && !$.synthetic; }).sort(sortByAlias); // sort only a copy(!) of the symbols, otherwise the SymbolSet lookup is broken sortedSymbols.forEach(function(symbol) { var sMetaType = (symbol.kind === 'member' && symbol.isEnum) ? 'enum' : symbol.kind; if ( sMetaType ) { writeln(""); writeln("// ---- " + symbol.longname + " --------------------------------------------------------------------------"); writeln(""); var memberId, member; var ownProperties = childrenOfKind(symbol, 'property').own.filter(isNoKeyword).sort(sortByAlias); if ( sMetaType === "class" ) { comment(symbol, sMetaType); writeln(symbol.longname + " = function(" + signature(symbol) + ") {};"); for ( memberId in ownProperties ) { member = ownProperties[memberId]; comment(member, sMetaType); writeln(qname(member, symbol) + " = " + value(member)); writeln(""); } } else if ( sMetaType === 'namespace' || sMetaType === 'enum' ) { //debug("found namespace " + symbol.longname); //debug(ownProperties); if ( ownProperties.length ) { writeln("// dummy function to make Eclipse aware of namespace"); writeln(symbol.longname + ".toString = function() { return \"\"; };"); } } var ownEvents = childrenOfKind(symbol, 'event').own.filter(isNoKeyword).sort(sortByAlias); if ( ownEvents.length ) { for ( memberId in ownEvents ) { member = ownEvents[memberId]; comment(member, sMetaType); writeln(qname(member, symbol) + " = function(" + signature(member) + ") { " + retvalue(member) + " };"); writeln(""); } } var ownMethods = childrenOfKind(symbol, 'method').own.filter(isNoKeyword).sort(sortByAlias); if ( ownMethods.length ) { for ( memberId in ownMethods ) { member = ownMethods[memberId]; comment(member, sMetaType); writeln(qname(member, symbol) + " = function(" + signature(member) + ") { " + retvalue(member) + " };"); writeln(""); } } } }); writeln("// ---- static fields of namespaces ---------------------------------------------------------------------"); sortedSymbols.forEach(function(symbol) { var sMetaType = (symbol.kind === 'member' && symbol.isEnum) ? 'enum' : symbol.kind; if ( sMetaType === 'namespace' || sMetaType === 'enum' ) { var ownProperties = childrenOfKind(symbol, 'property').own.filter(isNoKeyword).sort(sortByAlias); if ( ownProperties.length ) { writeln(""); writeln("// ---- " + symbol.longname + " --------------------------------------------------------------------------"); writeln(""); for (var memberId in ownProperties ) { var member = ownProperties[memberId]; comment(member, sMetaType); writeln(qname(member, symbol) + " = " + value(member) + ";"); writeln(""); } } } }); fs.mkPath(path.dirname(filename)); fs.writeFileSync(filename, output.join(""), 'utf8'); info(" saved as " + filename); }
[ "function", "createAPIJS", "(", "symbols", ",", "filename", ")", "{", "var", "output", "=", "[", "]", ";", "var", "rkeywords", "=", "/", "^(?:abstract|as|boolean|break|byte|case|catch|char|class|continue|const|debugger|default|delete|do|double|else|enum|export|extends|false|final...
---- add on: API JS -----------------------------------------------------------------
[ "----", "add", "on", ":", "API", "JS", "-----------------------------------------------------------------" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/lib/jsdoc/ui5/template/publish.js#L3877-L4090
train
Create API JS
[ 30522, 3853, 3443, 9331, 28418, 2015, 1006, 9255, 1010, 5371, 18442, 1007, 1063, 13075, 6434, 1027, 1031, 1033, 1025, 13075, 1054, 14839, 30524, 1064, 22017, 20898, 1064, 3338, 1064, 24880, 1064, 2553, 1064, 4608, 1064, 25869, 1064, 2465, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.m/src/sap/m/IconTabBarDragAndDropUtil.js
function (iBeginDragIndex, iControlCount) { if (iBeginDragIndex === iControlCount - 1) { sInsertAfterBeforePosition = INSERT_BEFORE; return iBeginDragIndex; } sInsertAfterBeforePosition = INSERT_AFTER; return iBeginDragIndex + 1; }
javascript
function (iBeginDragIndex, iControlCount) { if (iBeginDragIndex === iControlCount - 1) { sInsertAfterBeforePosition = INSERT_BEFORE; return iBeginDragIndex; } sInsertAfterBeforePosition = INSERT_AFTER; return iBeginDragIndex + 1; }
[ "function", "(", "iBeginDragIndex", ",", "iControlCount", ")", "{", "if", "(", "iBeginDragIndex", "===", "iControlCount", "-", "1", ")", "{", "sInsertAfterBeforePosition", "=", "INSERT_BEFORE", ";", "return", "iBeginDragIndex", ";", "}", "sInsertAfterBeforePosition", ...
Increases the drop index. @param {number} iBeginDragIndex Index of dragged control @param {number} iControlCount Number of controls @private
[ "Increases", "the", "drop", "index", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/IconTabBarDragAndDropUtil.js#L127-L134
train
Returns the index of the drag element after the drag element
[ 30522, 3853, 1006, 21307, 13910, 22254, 29181, 22254, 10288, 1010, 12696, 13181, 22499, 16671, 1007, 1063, 2065, 1006, 21307, 13910, 22254, 29181, 22254, 10288, 1027, 1027, 1027, 12696, 13181, 22499, 16671, 1011, 1015, 1007, 1063, 15516, 8743, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/model/Global.js
function (condition) { var mainType = condition.mainType; if (!mainType) { return []; } var index = condition.index; var id = condition.id; var name = condition.name; var cpts = this._componentsMap.get(mainType); if (!cpts || !cpts.length) { return []; } var result; if (index != null) { if (!isArray(index)) { index = [index]; } result = filter(map(index, function (idx) { return cpts[idx]; }), function (val) { return !!val; }); } else if (id != null) { var isIdArray = isArray(id); result = filter(cpts, function (cpt) { return (isIdArray && indexOf(id, cpt.id) >= 0) || (!isIdArray && cpt.id === id); }); } else if (name != null) { var isNameArray = isArray(name); result = filter(cpts, function (cpt) { return (isNameArray && indexOf(name, cpt.name) >= 0) || (!isNameArray && cpt.name === name); }); } else { // Return all components with mainType result = cpts.slice(); } return filterBySubType(result, condition); }
javascript
function (condition) { var mainType = condition.mainType; if (!mainType) { return []; } var index = condition.index; var id = condition.id; var name = condition.name; var cpts = this._componentsMap.get(mainType); if (!cpts || !cpts.length) { return []; } var result; if (index != null) { if (!isArray(index)) { index = [index]; } result = filter(map(index, function (idx) { return cpts[idx]; }), function (val) { return !!val; }); } else if (id != null) { var isIdArray = isArray(id); result = filter(cpts, function (cpt) { return (isIdArray && indexOf(id, cpt.id) >= 0) || (!isIdArray && cpt.id === id); }); } else if (name != null) { var isNameArray = isArray(name); result = filter(cpts, function (cpt) { return (isNameArray && indexOf(name, cpt.name) >= 0) || (!isNameArray && cpt.name === name); }); } else { // Return all components with mainType result = cpts.slice(); } return filterBySubType(result, condition); }
[ "function", "(", "condition", ")", "{", "var", "mainType", "=", "condition", ".", "mainType", ";", "if", "(", "!", "mainType", ")", "{", "return", "[", "]", ";", "}", "var", "index", "=", "condition", ".", "index", ";", "var", "id", "=", "condition",...
If none of index and id and name used, return all components with mainType. @param {Object} condition @param {string} condition.mainType @param {string} [condition.subType] If ignore, only query by mainType @param {number|Array.<number>} [condition.index] Either input index or id or name. @param {string|Array.<string>} [condition.id] Either input index or id or name. @param {string|Array.<string>} [condition.name] Either input index or id or name. @return {Array.<module:echarts/model/Component>}
[ "If", "none", "of", "index", "and", "id", "and", "name", "used", "return", "all", "components", "with", "mainType", "." ]
4d0ea095dc3929cb6de40c45748826e7999c7aa8
https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/model/Global.js#L314-L362
train
Returns a list of all the pages that match the condition
[ 30522, 3853, 1006, 4650, 1007, 1063, 13075, 2364, 13874, 1027, 4650, 1012, 2364, 13874, 1025, 2065, 1006, 999, 2364, 13874, 1007, 1063, 2709, 1031, 1033, 1025, 1065, 13075, 5950, 1027, 4650, 1012, 5950, 1025, 13075, 8909, 1027, 4650, 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.support/src/sap/ui/support/supportRules/IssueManager.js
function (oIssues) { var viewModel = []; for (var i = 0; i < oIssues.length; i++) { viewModel.push(_convertIssueToViewModel(oIssues[i])); } return viewModel; }
javascript
function (oIssues) { var viewModel = []; for (var i = 0; i < oIssues.length; i++) { viewModel.push(_convertIssueToViewModel(oIssues[i])); } return viewModel; }
[ "function", "(", "oIssues", ")", "{", "var", "viewModel", "=", "[", "]", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "oIssues", ".", "length", ";", "i", "++", ")", "{", "viewModel", ".", "push", "(", "_convertIssueToViewModel", "(", "oIss...
Converts issues to view model format. @public @method @name sap.ui.support.IssueManager.convertToViewModel @param {array} oIssues The issues to convert @returns {array} viewModel Issues in ViewModel format
[ "Converts", "issues", "to", "view", "model", "format", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.support/src/sap/ui/support/supportRules/IssueManager.js#L398-L404
train
Converts an array of issues to a view model
[ 30522, 3853, 1006, 1051, 14643, 15808, 1007, 1063, 13075, 3193, 5302, 9247, 1027, 1031, 1033, 1025, 2005, 1006, 13075, 1045, 1027, 1014, 1025, 1045, 1026, 1051, 14643, 15808, 1012, 3091, 1025, 1045, 1009, 1009, 1007, 1063, 3193, 5302, 9247,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
markdown-it/markdown-it
lib/token.js
Token
function Token(type, tag, nesting) { /** * Token#type -> String * * Type of the token (string, e.g. "paragraph_open") **/ this.type = type; /** * Token#tag -> String * * html tag name, e.g. "p" **/ this.tag = tag; /** * Token#attrs -> Array * * Html attributes. Format: `[ [ name1, value1 ], [ name2, value2 ] ]` **/ this.attrs = null; /** * Token#map -> Array * * Source map info. Format: `[ line_begin, line_end ]` **/ this.map = null; /** * Token#nesting -> Number * * Level change (number in {-1, 0, 1} set), where: * * - `1` means the tag is opening * - `0` means the tag is self-closing * - `-1` means the tag is closing **/ this.nesting = nesting; /** * Token#level -> Number * * nesting level, the same as `state.level` **/ this.level = 0; /** * Token#children -> Array * * An array of child nodes (inline and img tokens) **/ this.children = null; /** * Token#content -> String * * In a case of self-closing tag (code, html, fence, etc.), * it has contents of this tag. **/ this.content = ''; /** * Token#markup -> String * * '*' or '_' for emphasis, fence string for fence, etc. **/ this.markup = ''; /** * Token#info -> String * * fence infostring **/ this.info = ''; /** * Token#meta -> Object * * A place for plugins to store an arbitrary data **/ this.meta = null; /** * Token#block -> Boolean * * True for block-level tokens, false for inline tokens. * Used in renderer to calculate line breaks **/ this.block = false; /** * Token#hidden -> Boolean * * If it's true, ignore this element when rendering. Used for tight lists * to hide paragraphs. **/ this.hidden = false; }
javascript
function Token(type, tag, nesting) { /** * Token#type -> String * * Type of the token (string, e.g. "paragraph_open") **/ this.type = type; /** * Token#tag -> String * * html tag name, e.g. "p" **/ this.tag = tag; /** * Token#attrs -> Array * * Html attributes. Format: `[ [ name1, value1 ], [ name2, value2 ] ]` **/ this.attrs = null; /** * Token#map -> Array * * Source map info. Format: `[ line_begin, line_end ]` **/ this.map = null; /** * Token#nesting -> Number * * Level change (number in {-1, 0, 1} set), where: * * - `1` means the tag is opening * - `0` means the tag is self-closing * - `-1` means the tag is closing **/ this.nesting = nesting; /** * Token#level -> Number * * nesting level, the same as `state.level` **/ this.level = 0; /** * Token#children -> Array * * An array of child nodes (inline and img tokens) **/ this.children = null; /** * Token#content -> String * * In a case of self-closing tag (code, html, fence, etc.), * it has contents of this tag. **/ this.content = ''; /** * Token#markup -> String * * '*' or '_' for emphasis, fence string for fence, etc. **/ this.markup = ''; /** * Token#info -> String * * fence infostring **/ this.info = ''; /** * Token#meta -> Object * * A place for plugins to store an arbitrary data **/ this.meta = null; /** * Token#block -> Boolean * * True for block-level tokens, false for inline tokens. * Used in renderer to calculate line breaks **/ this.block = false; /** * Token#hidden -> Boolean * * If it's true, ignore this element when rendering. Used for tight lists * to hide paragraphs. **/ this.hidden = false; }
[ "function", "Token", "(", "type", ",", "tag", ",", "nesting", ")", "{", "/**\n * Token#type -> String\n *\n * Type of the token (string, e.g. \"paragraph_open\")\n **/", "this", ".", "type", "=", "type", ";", "/**\n * Token#tag -> String\n *\n * html tag name, e.g. \"...
class Token new Token(type, tag, nesting) Create new token and fill passed properties.
[ "class", "Token", "new", "Token", "(", "type", "tag", "nesting", ")" ]
ba6830ba13fb92953a91fb90318964ccd15b82c4
https://github.com/markdown-it/markdown-it/blob/ba6830ba13fb92953a91fb90318964ccd15b82c4/lib/token.js#L15-L113
train
A token object
[ 30522, 3853, 19204, 1006, 2828, 1010, 6415, 1010, 21016, 1007, 1063, 1013, 1008, 1008, 1008, 19204, 1001, 2828, 1011, 1028, 5164, 1008, 1008, 2828, 1997, 1996, 19204, 1006, 5164, 1010, 1041, 1012, 1043, 1012, 1000, 20423, 1035, 2330, 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...
fex-team/webuploader
dist/webuploader.withoutimage.js
function( files ) { var me = this; if ( !files.length ) { files = [ files ]; } files = $.map( files, function( file ) { return me._addFile( file ); }); me.owner.trigger( 'filesQueued', files ); if ( me.options.auto ) { setTimeout(function() { me.request('start-upload'); }, 20 ); } }
javascript
function( files ) { var me = this; if ( !files.length ) { files = [ files ]; } files = $.map( files, function( file ) { return me._addFile( file ); }); me.owner.trigger( 'filesQueued', files ); if ( me.options.auto ) { setTimeout(function() { me.request('start-upload'); }, 20 ); } }
[ "function", "(", "files", ")", "{", "var", "me", "=", "this", ";", "if", "(", "!", "files", ".", "length", ")", "{", "files", "=", "[", "files", "]", ";", "}", "files", "=", "$", ".", "map", "(", "files", ",", "function", "(", "file", ")", "{...
@property {Boolean} [auto=false] @namespace options @for Uploader @description 设置为 true 后,不需要手动调用上传,有文件选择即开始上传。 @method addFiles @grammar addFiles( file ) => undefined @grammar addFiles( [file1, file2 ...] ) => undefined @param {Array of File or File} [files] Files 对象 数组 @description 添加文件到队列 @for Uploader
[ "@property", "{", "Boolean", "}", "[", "auto", "=", "false", "]", "@namespace", "options", "@for", "Uploader", "@description", "设置为", "true", "后,不需要手动调用上传,有文件选择即开始上传。" ]
7094e4476c5af3b06993d91dde2d223200b9feb7
https://github.com/fex-team/webuploader/blob/7094e4476c5af3b06993d91dde2d223200b9feb7/dist/webuploader.withoutimage.js#L2541-L2559
train
upload files to the server
[ 30522, 3853, 1006, 6764, 1007, 1063, 13075, 2033, 1027, 2023, 1025, 2065, 1006, 999, 6764, 1012, 3091, 1007, 1063, 6764, 1027, 1031, 6764, 1033, 1025, 1065, 6764, 1027, 1002, 1012, 4949, 1006, 6764, 1010, 3853, 1006, 5371, 1007, 1063, 270...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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-ex-assign.js
checkVariable
function checkVariable(variable) { astUtils.getModifyingReferences(variable.references).forEach(reference => { context.report({ node: reference.identifier, messageId: "unexpected" }); }); }
javascript
function checkVariable(variable) { astUtils.getModifyingReferences(variable.references).forEach(reference => { context.report({ node: reference.identifier, messageId: "unexpected" }); }); }
[ "function", "checkVariable", "(", "variable", ")", "{", "astUtils", ".", "getModifyingReferences", "(", "variable", ".", "references", ")", ".", "forEach", "(", "reference", "=>", "{", "context", ".", "report", "(", "{", "node", ":", "reference", ".", "ident...
Finds and reports references that are non initializer and writable. @param {Variable} variable - A variable to check. @returns {void}
[ "Finds", "and", "reports", "references", "that", "are", "non", "initializer", "and", "writable", "." ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/no-ex-assign.js#L39-L43
train
Check variable references
[ 30522, 3853, 4638, 10755, 19210, 1006, 8023, 1007, 1063, 2004, 8525, 3775, 4877, 1012, 2131, 5302, 4305, 14116, 2890, 25523, 2015, 1006, 8023, 1012, 7604, 1007, 1012, 18921, 6776, 1006, 4431, 1027, 1028, 1063, 6123, 1012, 3189, 1006, 1063, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.unified/src/sap/ui/unified/CalendarRow.js
_positionAppointments
function _positionAppointments() { if (this._isOneMonthIntervalOnSmallSizes()) { return; } var $Apps = this.$("Apps"); var iRowWidth = $Apps.innerWidth(); if (iRowWidth <= 0) { // if no size (invisible) do nothing return; } var $DummyApp = this.$("DummyApp"); var iHeight = $DummyApp.outerHeight(true); if (iHeight <= 0) { // if no size (theme seems not to be loaded) do nothing return; } var iMinWidth = $DummyApp.outerWidth(); var iMinPercent = iMinWidth / iRowWidth * 100; var iMinPercentCeil = Math.ceil(1000 * iMinPercent) / 1000; var oAppointment; var $Appointment; var iStaticHeight = 0; var iLevels = 0; var i = 0; var bAppointmentsReducedHeight = !Device.system.phone && this.getAppointmentsReducedHeight(); if (this.getShowIntervalHeaders() && (this.getShowEmptyIntervalHeaders() || this._getVisibleIntervalHeaders().length > 0)) { iStaticHeight = jQuery(this.$("AppsInt0").children(".sapUiCalendarRowAppsIntHead")[0]).outerHeight(true); } // adjust min width for (i = 0; i < this._aVisibleAppointments.length; i++) { oAppointment = this._aVisibleAppointments[i]; $Appointment = oAppointment.appointment.$(); var iPercent = Math.floor(1000 * (100 - oAppointment.calculatedEnd - oAppointment.begin)) / 1000; var bChanged = false; if (iPercent < iMinPercentCeil) { oAppointment.end = 100 - oAppointment.begin - iMinPercent; if (oAppointment.end < 0) { oAppointment.end = 0; } oAppointment.level = -1; // level must be new calculated bChanged = true; $Appointment.addClass("sapUiCalendarAppSmall"); }else if ($Appointment.hasClass("sapUiCalendarAppSmall")){ // not longer too small oAppointment.end = oAppointment.calculatedEnd; bChanged = true; $Appointment.removeClass("sapUiCalendarAppSmall"); } if (bChanged) { if (this._bRTL) { $Appointment.css("left", oAppointment.end + "%"); } else { $Appointment.css("right", oAppointment.end + "%"); } } } // calculate levels for (i = 0; i < this._aVisibleAppointments.length; i++) { oAppointment = this._aVisibleAppointments[i]; $Appointment = oAppointment.appointment.$(); var oBlockedLevels = {}; var bTwoLevels = bAppointmentsReducedHeight && !this._getAppointmentReducedHeight(oAppointment.appointment); if (oAppointment.level < 0) { for (var j = 0; j < this._aVisibleAppointments.length; j++) { var oVisibleAppointment = this._aVisibleAppointments[j]; if (oAppointment != oVisibleAppointment && oAppointment.begin < (Math.floor(1000 * (100 - oVisibleAppointment.end)) / 1000) && (Math.floor(1000 * (100 - oAppointment.end)) / 1000) > oVisibleAppointment.begin && oVisibleAppointment.level >= 0) { // if one appointment starts directly at the end of an other one place it at the same level if (oBlockedLevels[oVisibleAppointment.level]) { oBlockedLevels[oVisibleAppointment.level]++; } else { oBlockedLevels[oVisibleAppointment.level] = 1; } if (bAppointmentsReducedHeight && !this._getAppointmentReducedHeight(oVisibleAppointment.appointment)) { // 2 levels used if (oBlockedLevels[oVisibleAppointment.level + 1]) { oBlockedLevels[oVisibleAppointment.level + 1]++; } else { oBlockedLevels[oVisibleAppointment.level + 1] = 1; } } } } oAppointment.level = 0; while (oBlockedLevels[oAppointment.level] || (bTwoLevels && oBlockedLevels[oAppointment.level + 1])) { oAppointment.level++; } $Appointment.attr("data-sap-level", oAppointment.level); } $Appointment.css("top", (iHeight * oAppointment.level + iStaticHeight) + "px"); var iAppointmentEndLevel = oAppointment.level; if (bTwoLevels) { iAppointmentEndLevel++; } if (iLevels < iAppointmentEndLevel) { iLevels = iAppointmentEndLevel; } } iLevels++; // as 0 is a valid level iHeight = iHeight * iLevels + iStaticHeight; if (!this.getHeight()) { // no height set -> determine from rendered levels $Apps.outerHeight(iHeight); }else { // make intervals as large as scroll height var aIntervals = this.$("Apps").children(".sapUiCalendarRowAppsInt"); for (i = 0; i < aIntervals.length; i++) { var $Interval = jQuery(aIntervals[i]); $Interval.outerHeight(iHeight); } } // hide dummy appointment $DummyApp.css("display", "none"); }
javascript
function _positionAppointments() { if (this._isOneMonthIntervalOnSmallSizes()) { return; } var $Apps = this.$("Apps"); var iRowWidth = $Apps.innerWidth(); if (iRowWidth <= 0) { // if no size (invisible) do nothing return; } var $DummyApp = this.$("DummyApp"); var iHeight = $DummyApp.outerHeight(true); if (iHeight <= 0) { // if no size (theme seems not to be loaded) do nothing return; } var iMinWidth = $DummyApp.outerWidth(); var iMinPercent = iMinWidth / iRowWidth * 100; var iMinPercentCeil = Math.ceil(1000 * iMinPercent) / 1000; var oAppointment; var $Appointment; var iStaticHeight = 0; var iLevels = 0; var i = 0; var bAppointmentsReducedHeight = !Device.system.phone && this.getAppointmentsReducedHeight(); if (this.getShowIntervalHeaders() && (this.getShowEmptyIntervalHeaders() || this._getVisibleIntervalHeaders().length > 0)) { iStaticHeight = jQuery(this.$("AppsInt0").children(".sapUiCalendarRowAppsIntHead")[0]).outerHeight(true); } // adjust min width for (i = 0; i < this._aVisibleAppointments.length; i++) { oAppointment = this._aVisibleAppointments[i]; $Appointment = oAppointment.appointment.$(); var iPercent = Math.floor(1000 * (100 - oAppointment.calculatedEnd - oAppointment.begin)) / 1000; var bChanged = false; if (iPercent < iMinPercentCeil) { oAppointment.end = 100 - oAppointment.begin - iMinPercent; if (oAppointment.end < 0) { oAppointment.end = 0; } oAppointment.level = -1; // level must be new calculated bChanged = true; $Appointment.addClass("sapUiCalendarAppSmall"); }else if ($Appointment.hasClass("sapUiCalendarAppSmall")){ // not longer too small oAppointment.end = oAppointment.calculatedEnd; bChanged = true; $Appointment.removeClass("sapUiCalendarAppSmall"); } if (bChanged) { if (this._bRTL) { $Appointment.css("left", oAppointment.end + "%"); } else { $Appointment.css("right", oAppointment.end + "%"); } } } // calculate levels for (i = 0; i < this._aVisibleAppointments.length; i++) { oAppointment = this._aVisibleAppointments[i]; $Appointment = oAppointment.appointment.$(); var oBlockedLevels = {}; var bTwoLevels = bAppointmentsReducedHeight && !this._getAppointmentReducedHeight(oAppointment.appointment); if (oAppointment.level < 0) { for (var j = 0; j < this._aVisibleAppointments.length; j++) { var oVisibleAppointment = this._aVisibleAppointments[j]; if (oAppointment != oVisibleAppointment && oAppointment.begin < (Math.floor(1000 * (100 - oVisibleAppointment.end)) / 1000) && (Math.floor(1000 * (100 - oAppointment.end)) / 1000) > oVisibleAppointment.begin && oVisibleAppointment.level >= 0) { // if one appointment starts directly at the end of an other one place it at the same level if (oBlockedLevels[oVisibleAppointment.level]) { oBlockedLevels[oVisibleAppointment.level]++; } else { oBlockedLevels[oVisibleAppointment.level] = 1; } if (bAppointmentsReducedHeight && !this._getAppointmentReducedHeight(oVisibleAppointment.appointment)) { // 2 levels used if (oBlockedLevels[oVisibleAppointment.level + 1]) { oBlockedLevels[oVisibleAppointment.level + 1]++; } else { oBlockedLevels[oVisibleAppointment.level + 1] = 1; } } } } oAppointment.level = 0; while (oBlockedLevels[oAppointment.level] || (bTwoLevels && oBlockedLevels[oAppointment.level + 1])) { oAppointment.level++; } $Appointment.attr("data-sap-level", oAppointment.level); } $Appointment.css("top", (iHeight * oAppointment.level + iStaticHeight) + "px"); var iAppointmentEndLevel = oAppointment.level; if (bTwoLevels) { iAppointmentEndLevel++; } if (iLevels < iAppointmentEndLevel) { iLevels = iAppointmentEndLevel; } } iLevels++; // as 0 is a valid level iHeight = iHeight * iLevels + iStaticHeight; if (!this.getHeight()) { // no height set -> determine from rendered levels $Apps.outerHeight(iHeight); }else { // make intervals as large as scroll height var aIntervals = this.$("Apps").children(".sapUiCalendarRowAppsInt"); for (i = 0; i < aIntervals.length; i++) { var $Interval = jQuery(aIntervals[i]); $Interval.outerHeight(iHeight); } } // hide dummy appointment $DummyApp.css("display", "none"); }
[ "function", "_positionAppointments", "(", ")", "{", "if", "(", "this", ".", "_isOneMonthIntervalOnSmallSizes", "(", ")", ")", "{", "return", ";", "}", "var", "$Apps", "=", "this", ".", "$", "(", "\"Apps\"", ")", ";", "var", "iRowWidth", "=", "$Apps", "."...
as the top position of the appointments depends on the rendered height it must be calculated after rendering
[ "as", "the", "top", "position", "of", "the", "appointments", "depends", "on", "the", "rendered", "height", "it", "must", "be", "calculated", "after", "rendering" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.unified/src/sap/ui/unified/CalendarRow.js#L1482-L1617
train
Position the app points in the app
[ 30522, 3853, 1035, 2597, 29098, 25785, 8163, 1006, 1007, 1063, 2065, 1006, 2023, 1012, 1035, 11163, 25832, 12162, 10606, 3334, 10175, 5644, 9067, 4877, 10057, 1006, 1007, 1007, 1063, 2709, 1025, 1065, 13075, 1002, 18726, 1027, 2023, 1012, 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/project/FileTreeViewModel.js
_createNotFullyLoadedDirectory
function _createNotFullyLoadedDirectory(directory) { if (!directory) { return Immutable.Map({ notFullyLoaded: true, children: Immutable.Map() }); } return directory.merge({ notFullyLoaded: true, children: Immutable.Map() }); }
javascript
function _createNotFullyLoadedDirectory(directory) { if (!directory) { return Immutable.Map({ notFullyLoaded: true, children: Immutable.Map() }); } return directory.merge({ notFullyLoaded: true, children: Immutable.Map() }); }
[ "function", "_createNotFullyLoadedDirectory", "(", "directory", ")", "{", "if", "(", "!", "directory", ")", "{", "return", "Immutable", ".", "Map", "(", "{", "notFullyLoaded", ":", "true", ",", "children", ":", "Immutable", ".", "Map", "(", ")", "}", ")", ...
@private Creates a directory object (or updates an existing directory object) to look like one that has not yet been loaded, but in which we want to start displaying entries. @param {Immutable.Map=} directory Directory entry to update @return {Immutable.Map} New or updated directory object
[ "@private" ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/project/FileTreeViewModel.js#L702-L713
train
Create not fully loaded directory
[ 30522, 3853, 1035, 3443, 17048, 7699, 17468, 4305, 2890, 16761, 2100, 1006, 14176, 1007, 1063, 2065, 1006, 999, 14176, 1007, 1063, 2709, 10047, 28120, 3085, 1012, 4949, 1006, 1063, 2025, 7699, 17468, 1024, 2995, 1010, 2336, 1024, 10047, 281...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/core/util/reflection/BaseTreeModifier.js
function(fnCallback, oRootNode) { function recurse(oParent, oCurrentNode, bIsAggregation) { var oAggregations; if (!bIsAggregation) { var oMetadata = this._getControlMetadataInXml(oCurrentNode); oAggregations = oMetadata.getAllAggregations(); } var aChildren = this._getElementNodeChildren(oCurrentNode); aChildren.forEach(function(oChild) { var bIsCurrentNodeAggregation = oAggregations && oAggregations[oChild.localName]; recurse.call(this, oCurrentNode, oChild, bIsCurrentNodeAggregation); // if it's an aggregation, we don't call the callback function if (!bIsCurrentNodeAggregation) { fnCallback(oChild); } }.bind(this)); } recurse.call(this, oRootNode, oRootNode, false); }
javascript
function(fnCallback, oRootNode) { function recurse(oParent, oCurrentNode, bIsAggregation) { var oAggregations; if (!bIsAggregation) { var oMetadata = this._getControlMetadataInXml(oCurrentNode); oAggregations = oMetadata.getAllAggregations(); } var aChildren = this._getElementNodeChildren(oCurrentNode); aChildren.forEach(function(oChild) { var bIsCurrentNodeAggregation = oAggregations && oAggregations[oChild.localName]; recurse.call(this, oCurrentNode, oChild, bIsCurrentNodeAggregation); // if it's an aggregation, we don't call the callback function if (!bIsCurrentNodeAggregation) { fnCallback(oChild); } }.bind(this)); } recurse.call(this, oRootNode, oRootNode, false); }
[ "function", "(", "fnCallback", ",", "oRootNode", ")", "{", "function", "recurse", "(", "oParent", ",", "oCurrentNode", ",", "bIsAggregation", ")", "{", "var", "oAggregations", ";", "if", "(", "!", "bIsAggregation", ")", "{", "var", "oMetadata", "=", "this", ...
Recursively goes through an XML tree and calls a callback function for every control inside. Does not call the callback function for aggregations. @param {function} fnCallback - Function that will be called for every control with the following arguments: fnCallback(<Element>) @param {Element} oRootNode - Root node from which we start traversing the tree
[ "Recursively", "goes", "through", "an", "XML", "tree", "and", "calls", "a", "callback", "function", "for", "every", "control", "inside", ".", "Does", "not", "call", "the", "callback", "function", "for", "aggregations", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/util/reflection/BaseTreeModifier.js#L321-L339
train
Recursively traverses the control tree and calls the callback function
[ 30522, 3853, 1006, 1042, 20909, 3363, 5963, 1010, 20298, 4140, 3630, 3207, 1007, 1063, 3853, 28667, 28393, 1006, 6728, 12069, 3372, 1010, 1051, 10841, 14343, 3372, 3630, 3207, 1010, 20377, 8490, 17603, 12540, 1007, 1063, 13075, 1051, 8490, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/api/auto-updater/squirrel-update-win.js
function (args, detached, callback) { let error, errorEmitted, stderr, stdout try { // Ensure we don't spawn multiple squirrel processes // Process spawned, same args: Attach events to alread running process // Process spawned, different args: Return with error // No process spawned: Spawn new process if (spawnedProcess && !isSameArgs(args)) { // Disabled for backwards compatibility: // eslint-disable-next-line standard/no-callback-literal return callback(`AutoUpdater process with arguments ${args} is already running`) } else if (!spawnedProcess) { spawnedProcess = spawn(updateExe, args, { detached: detached, windowsHide: true }) spawnedArgs = args || [] } } catch (error1) { error = error1 // Shouldn't happen, but still guard it. process.nextTick(function () { return callback(error) }) return } stdout = '' stderr = '' spawnedProcess.stdout.on('data', (data) => { stdout += data }) spawnedProcess.stderr.on('data', (data) => { stderr += data }) errorEmitted = false spawnedProcess.on('error', (error) => { errorEmitted = true callback(error) }) return spawnedProcess.on('exit', function (code, signal) { spawnedProcess = undefined spawnedArgs = [] // We may have already emitted an error. if (errorEmitted) { return } // Process terminated with error. if (code !== 0) { // Disabled for backwards compatibility: // eslint-disable-next-line standard/no-callback-literal return callback(`Command failed: ${signal != null ? signal : code}\n${stderr}`) } // Success. callback(null, stdout) }) }
javascript
function (args, detached, callback) { let error, errorEmitted, stderr, stdout try { // Ensure we don't spawn multiple squirrel processes // Process spawned, same args: Attach events to alread running process // Process spawned, different args: Return with error // No process spawned: Spawn new process if (spawnedProcess && !isSameArgs(args)) { // Disabled for backwards compatibility: // eslint-disable-next-line standard/no-callback-literal return callback(`AutoUpdater process with arguments ${args} is already running`) } else if (!spawnedProcess) { spawnedProcess = spawn(updateExe, args, { detached: detached, windowsHide: true }) spawnedArgs = args || [] } } catch (error1) { error = error1 // Shouldn't happen, but still guard it. process.nextTick(function () { return callback(error) }) return } stdout = '' stderr = '' spawnedProcess.stdout.on('data', (data) => { stdout += data }) spawnedProcess.stderr.on('data', (data) => { stderr += data }) errorEmitted = false spawnedProcess.on('error', (error) => { errorEmitted = true callback(error) }) return spawnedProcess.on('exit', function (code, signal) { spawnedProcess = undefined spawnedArgs = [] // We may have already emitted an error. if (errorEmitted) { return } // Process terminated with error. if (code !== 0) { // Disabled for backwards compatibility: // eslint-disable-next-line standard/no-callback-literal return callback(`Command failed: ${signal != null ? signal : code}\n${stderr}`) } // Success. callback(null, stdout) }) }
[ "function", "(", "args", ",", "detached", ",", "callback", ")", "{", "let", "error", ",", "errorEmitted", ",", "stderr", ",", "stdout", "try", "{", "// Ensure we don't spawn multiple squirrel processes", "// Process spawned, same args: Attach events to alread running p...
Spawn a command and invoke the callback when it completes with an error and the output from standard out.
[ "Spawn", "a", "command", "and", "invoke", "the", "callback", "when", "it", "completes", "with", "an", "error", "and", "the", "output", "from", "standard", "out", "." ]
6e29611788277729647acf465f10db1ea6f15788
https://github.com/electron/electron/blob/6e29611788277729647acf465f10db1ea6f15788/lib/browser/api/auto-updater/squirrel-update-win.js#L20-L79
train
AutoUpdater process spawned
[ 30522, 3853, 1006, 12098, 5620, 1010, 12230, 1010, 2655, 5963, 1007, 1063, 2292, 7561, 1010, 7561, 23238, 16190, 1010, 2358, 4063, 2099, 1010, 2358, 26797, 2102, 3046, 1063, 1013, 1013, 5676, 2057, 2123, 1005, 1056, 25645, 3674, 18197, 6194...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
firebase/firebase-js-sdk
packages/auth/demo/public/script.js
onSignUp
function onSignUp() { var email = $('#signup-email').val(); var password = $('#signup-password').val(); auth.createUserWithEmailAndPassword(email, password) .then(onAuthUserCredentialSuccess, onAuthError); }
javascript
function onSignUp() { var email = $('#signup-email').val(); var password = $('#signup-password').val(); auth.createUserWithEmailAndPassword(email, password) .then(onAuthUserCredentialSuccess, onAuthError); }
[ "function", "onSignUp", "(", ")", "{", "var", "email", "=", "$", "(", "'#signup-email'", ")", ".", "val", "(", ")", ";", "var", "password", "=", "$", "(", "'#signup-password'", ")", ".", "val", "(", ")", ";", "auth", ".", "createUserWithEmailAndPassword"...
Signs up a new user with an email and a password.
[ "Signs", "up", "a", "new", "user", "with", "an", "email", "and", "a", "password", "." ]
491598a499813dacc23724de5e237ec220cc560e
https://github.com/firebase/firebase-js-sdk/blob/491598a499813dacc23724de5e237ec220cc560e/packages/auth/demo/public/script.js#L307-L312
train
Sign up user
[ 30522, 3853, 2006, 5332, 16206, 6279, 1006, 1007, 1063, 13075, 10373, 1027, 1002, 1006, 1005, 1001, 3696, 6279, 1011, 10373, 1005, 1007, 1012, 11748, 1006, 1007, 1025, 13075, 20786, 1027, 1002, 1006, 1005, 1001, 3696, 6279, 1011, 20786, 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.fl/src/sap/ui/fl/ChangePersistence.js
function(mComponent) { this._mComponent = mComponent; //_mChanges contains: // - mChanges: map of changes (selector id) // - mDependencies: map of changes (change key) that need to be applied before any change. Used to check if a change can be applied. Format: // mDependencies: { // "fileNameChange2USERnamespace": { // "changeObject": oChange2, // "dependencies": ["fileNameChange1USERnamespace"] // }, // "fileNameChange3USERnamespace": { // "changeObject": oChange3, // "dependencies": ["fileNameChange2USERnamespace"] // } // } // - mDependentChangesOnMe: map of changes (change key) that cannot be applied before the change. Used to remove dependencies faster. Format: // mDependentChangesOnMe: { // "fileNameChange1USERnamespace": [oChange2], // "fileNameChange2USERnamespace": [oChange3] // } // - aChanges: array of changes ordered by layer and creation time // aChanges: [oChange1, oChange2, oChange3] this._mChanges = { mChanges: {}, mDependencies: {}, mDependentChangesOnMe: {}, aChanges: [] }; //_mChangesInitial contains a clone of _mChanges to recreated dependencies if changes need to be reapplied this._mChangesInitial = merge({}, this._mChanges); this._mVariantsChanges = {}; if (!this._mComponent || !this._mComponent.name) { Utils.log.error("The Control does not belong to an SAPUI5 component. Personalization and changes for this control might not work as expected."); throw new Error("Missing component name."); } this._oVariantController = new VariantController(this._mComponent.name, this._mComponent.appVersion, {}); this._oTransportSelection = new TransportSelection(); this._oConnector = this._createLrepConnector(); this._aDirtyChanges = []; this._oMessagebundle = undefined; this._mChangesEntries = {}; this._bHasChangesOverMaxLayer = false; this.HIGHER_LAYER_CHANGES_EXIST = "higher_layer_changes_exist"; }
javascript
function(mComponent) { this._mComponent = mComponent; //_mChanges contains: // - mChanges: map of changes (selector id) // - mDependencies: map of changes (change key) that need to be applied before any change. Used to check if a change can be applied. Format: // mDependencies: { // "fileNameChange2USERnamespace": { // "changeObject": oChange2, // "dependencies": ["fileNameChange1USERnamespace"] // }, // "fileNameChange3USERnamespace": { // "changeObject": oChange3, // "dependencies": ["fileNameChange2USERnamespace"] // } // } // - mDependentChangesOnMe: map of changes (change key) that cannot be applied before the change. Used to remove dependencies faster. Format: // mDependentChangesOnMe: { // "fileNameChange1USERnamespace": [oChange2], // "fileNameChange2USERnamespace": [oChange3] // } // - aChanges: array of changes ordered by layer and creation time // aChanges: [oChange1, oChange2, oChange3] this._mChanges = { mChanges: {}, mDependencies: {}, mDependentChangesOnMe: {}, aChanges: [] }; //_mChangesInitial contains a clone of _mChanges to recreated dependencies if changes need to be reapplied this._mChangesInitial = merge({}, this._mChanges); this._mVariantsChanges = {}; if (!this._mComponent || !this._mComponent.name) { Utils.log.error("The Control does not belong to an SAPUI5 component. Personalization and changes for this control might not work as expected."); throw new Error("Missing component name."); } this._oVariantController = new VariantController(this._mComponent.name, this._mComponent.appVersion, {}); this._oTransportSelection = new TransportSelection(); this._oConnector = this._createLrepConnector(); this._aDirtyChanges = []; this._oMessagebundle = undefined; this._mChangesEntries = {}; this._bHasChangesOverMaxLayer = false; this.HIGHER_LAYER_CHANGES_EXIST = "higher_layer_changes_exist"; }
[ "function", "(", "mComponent", ")", "{", "this", ".", "_mComponent", "=", "mComponent", ";", "//_mChanges contains:", "// - mChanges: map of changes (selector id)", "// - mDependencies: map of changes (change key) that need to be applied before any change. Used to check if a change can be ...
Helper object to access a change from the back end. Access helper object for each change (and variant) which was fetched from the back end @constructor @author SAP SE @version 1.37.0-SNAPSHOT @experimental Since 1.25.0 @param {object} mComponent Component data to initiate <code>ChangePersistence</code> instance @param {string} mComponent.name Name of the component this instance is responsible for @param {string} mComponent.appVersion Version of application
[ "Helper", "object", "to", "access", "a", "change", "from", "the", "back", "end", ".", "Access", "helper", "object", "for", "each", "change", "(", "and", "variant", ")", "which", "was", "fetched", "from", "the", "back", "end" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/ChangePersistence.js#L53-L100
train
Creates a new control instance.
[ 30522, 3853, 1006, 11338, 25377, 30524, 2023, 1012, 1035, 11338, 25377, 5643, 3372, 1027, 11338, 25377, 5643, 3372, 1025, 1013, 1013, 1035, 11338, 18003, 2229, 3397, 1024, 1013, 1013, 1011, 11338, 18003, 2229, 1024, 4949, 1997, 3431, 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...
chartjs/Chart.js
src/scales/scale.linear.js
function() { var me = this; var tickFont; if (me.isHorizontal()) { return Math.ceil(me.width / 40); } tickFont = helpers.options._parseFont(me.options.ticks); return Math.ceil(me.height / tickFont.lineHeight); }
javascript
function() { var me = this; var tickFont; if (me.isHorizontal()) { return Math.ceil(me.width / 40); } tickFont = helpers.options._parseFont(me.options.ticks); return Math.ceil(me.height / tickFont.lineHeight); }
[ "function", "(", ")", "{", "var", "me", "=", "this", ";", "var", "tickFont", ";", "if", "(", "me", ".", "isHorizontal", "(", ")", ")", "{", "return", "Math", ".", "ceil", "(", "me", ".", "width", "/", "40", ")", ";", "}", "tickFont", "=", "help...
Returns the maximum number of ticks based on the scale dimension
[ "Returns", "the", "maximum", "number", "of", "ticks", "based", "on", "the", "scale", "dimension" ]
f093c36574d290330ed623e60fbd070421c730d5
https://github.com/chartjs/Chart.js/blob/f093c36574d290330ed623e60fbd070421c730d5/src/scales/scale.linear.js#L134-L143
train
Returns the number of ticks per line
[ 30522, 3853, 1006, 1007, 1063, 13075, 2033, 1027, 2023, 1025, 13075, 16356, 14876, 3372, 1025, 2065, 1006, 2033, 1012, 2003, 16368, 10993, 12162, 2389, 1006, 1007, 1007, 1063, 2709, 8785, 1012, 8292, 4014, 1006, 2033, 1012, 9381, 1013, 2871...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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
drawTable
function drawTable(editor) { var cm = editor.codemirror; var stat = getState(cm); var options = editor.options; _replaceSelection(cm, stat.table, options.insertTexts.table); }
javascript
function drawTable(editor) { var cm = editor.codemirror; var stat = getState(cm); var options = editor.options; _replaceSelection(cm, stat.table, options.insertTexts.table); }
[ "function", "drawTable", "(", "editor", ")", "{", "var", "cm", "=", "editor", ".", "codemirror", ";", "var", "stat", "=", "getState", "(", "cm", ")", ";", "var", "options", "=", "editor", ".", "options", ";", "_replaceSelection", "(", "cm", ",", "stat"...
Action for drawing a table.
[ "Action", "for", "drawing", "a", "table", "." ]
6abda7ab68cc20f4aca870eb243747951b90ab04
https://github.com/sparksuite/simplemde-markdown-editor/blob/6abda7ab68cc20f4aca870eb243747951b90ab04/src/js/simplemde.js#L650-L655
train
Draw the table
[ 30522, 3853, 4009, 10880, 1006, 3559, 1007, 1063, 13075, 4642, 1027, 3559, 1012, 3642, 14503, 29165, 1025, 13075, 28093, 1027, 4152, 12259, 1006, 4642, 1007, 1025, 13075, 7047, 1027, 3559, 1012, 7047, 1025, 1035, 20736, 12260, 7542, 1006, 4...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
eslint/eslint
lib/rules/prefer-template.js
hasNonStringLiteral
function hasNonStringLiteral(node) { if (isConcatenation(node)) { // `left` is deeper than `right` normally. return hasNonStringLiteral(node.right) || hasNonStringLiteral(node.left); } return !astUtils.isStringLiteral(node); }
javascript
function hasNonStringLiteral(node) { if (isConcatenation(node)) { // `left` is deeper than `right` normally. return hasNonStringLiteral(node.right) || hasNonStringLiteral(node.left); } return !astUtils.isStringLiteral(node); }
[ "function", "hasNonStringLiteral", "(", "node", ")", "{", "if", "(", "isConcatenation", "(", "node", ")", ")", "{", "// `left` is deeper than `right` normally.", "return", "hasNonStringLiteral", "(", "node", ".", "right", ")", "||", "hasNonStringLiteral", "(", "node...
Checks whether or not a given binary expression has non string literals. @param {ASTNode} node - A node to check. @returns {boolean} `true` if the node has non string literals.
[ "Checks", "whether", "or", "not", "a", "given", "binary", "expression", "has", "non", "string", "literals", "." ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/prefer-template.js#L99-L106
train
Checks whether a node has a non string literal.
[ 30522, 3853, 8440, 5644, 18886, 3070, 22779, 7941, 1006, 13045, 1007, 1063, 2065, 1006, 2003, 8663, 16280, 9323, 1006, 13045, 1007, 1007, 1063, 1013, 1013, 1036, 2187, 1036, 2003, 6748, 2084, 1036, 2157, 1036, 5373, 1012, 2709, 8440, 5644, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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
mxImage
function mxImage(src, width, height) { this.src = src; this.width = width; this.height = height; }
javascript
function mxImage(src, width, height) { this.src = src; this.width = width; this.height = height; }
[ "function", "mxImage", "(", "src", ",", "width", ",", "height", ")", "{", "this", ".", "src", "=", "src", ";", "this", ".", "width", "=", "width", ";", "this", ".", "height", "=", "height", ";", "}" ]
Copyright (c) 2006-2015, JGraph Ltd Copyright (c) 2006-2015, Gaudenz Alder Class: mxImage Encapsulates the URL, width and height of an image. Constructor: mxImage Constructs a new image.
[ "Copyright", "(", "c", ")", "2006", "-", "2015", "JGraph", "Ltd", "Copyright", "(", "c", ")", "2006", "-", "2015", "Gaudenz", "Alder", "Class", ":", "mxImage" ]
33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44
https://github.com/jgraph/mxgraph/blob/33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44/javascript/mxClient.js#L12816-L12821
train
This is the base class for the image objects
[ 30522, 3853, 25630, 9581, 3351, 1006, 5034, 2278, 1010, 9381, 1010, 4578, 1007, 1063, 2023, 1012, 5034, 2278, 1027, 5034, 2278, 1025, 2023, 1012, 9381, 1027, 9381, 1025, 2023, 1012, 4578, 1027, 4578, 1025, 1065, 102, 0, 0, 0, 0, 0, 0,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
eslint/eslint
lib/rules/prefer-const.js
groupByDestructuring
function groupByDestructuring(variables, ignoreReadBeforeAssign) { const identifierMap = new Map(); for (let i = 0; i < variables.length; ++i) { const variable = variables[i]; const references = variable.references; const identifier = getIdentifierIfShouldBeConst(variable, ignoreReadBeforeAssign); let prevId = null; for (let j = 0; j < references.length; ++j) { const reference = references[j]; const id = reference.identifier; /* * Avoid counting a reference twice or more for default values of * destructuring. */ if (id === prevId) { continue; } prevId = id; // Add the identifier node into the destructuring group. const group = getDestructuringHost(reference); if (group) { if (identifierMap.has(group)) { identifierMap.get(group).push(identifier); } else { identifierMap.set(group, [identifier]); } } } } return identifierMap; }
javascript
function groupByDestructuring(variables, ignoreReadBeforeAssign) { const identifierMap = new Map(); for (let i = 0; i < variables.length; ++i) { const variable = variables[i]; const references = variable.references; const identifier = getIdentifierIfShouldBeConst(variable, ignoreReadBeforeAssign); let prevId = null; for (let j = 0; j < references.length; ++j) { const reference = references[j]; const id = reference.identifier; /* * Avoid counting a reference twice or more for default values of * destructuring. */ if (id === prevId) { continue; } prevId = id; // Add the identifier node into the destructuring group. const group = getDestructuringHost(reference); if (group) { if (identifierMap.has(group)) { identifierMap.get(group).push(identifier); } else { identifierMap.set(group, [identifier]); } } } } return identifierMap; }
[ "function", "groupByDestructuring", "(", "variables", ",", "ignoreReadBeforeAssign", ")", "{", "const", "identifierMap", "=", "new", "Map", "(", ")", ";", "for", "(", "let", "i", "=", "0", ";", "i", "<", "variables", ".", "length", ";", "++", "i", ")", ...
Groups by the VariableDeclarator/AssignmentExpression node that each reference of given variables belongs to. This is used to detect a mix of reassigned and never reassigned in a destructuring. @param {eslint-scope.Variable[]} variables - Variables to group by destructuring. @param {boolean} ignoreReadBeforeAssign - The value of `ignoreReadBeforeAssign` option. @returns {Map<ASTNode, ASTNode[]>} Grouped identifier nodes.
[ "Groups", "by", "the", "VariableDeclarator", "/", "AssignmentExpression", "node", "that", "each", "reference", "of", "given", "variables", "belongs", "to", ".", "This", "is", "used", "to", "detect", "a", "mix", "of", "reassigned", "and", "never", "reassigned", ...
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/prefer-const.js#L271-L307
train
Groups the references of a destructuring variable into a map of identifiers
[ 30522, 3853, 2177, 3762, 6155, 18300, 12228, 1006, 10857, 1010, 8568, 16416, 18939, 12879, 5686, 12054, 23773, 1007, 1063, 9530, 3367, 8909, 4765, 18095, 2863, 2361, 1027, 2047, 4949, 1006, 1007, 1025, 2005, 1006, 2292, 1045, 1027, 1014, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
ColorlibHQ/AdminLTE
plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js
function(options) { var prevNode = node.previousSibling, types = (options && options.nodeTypes) ? options.nodeTypes : defaultNodeTypes; if (!prevNode) { return null; } if ( (!wysihtml5.lang.array(types).contains(prevNode.nodeType)) || // nodeTypes check. (options && options.ignoreBlankTexts && _isBlankText(prevNode)) // Blank text nodes bypassed if set ) { return wysihtml5.dom.domNode(prevNode).prev(options); } return prevNode; }
javascript
function(options) { var prevNode = node.previousSibling, types = (options && options.nodeTypes) ? options.nodeTypes : defaultNodeTypes; if (!prevNode) { return null; } if ( (!wysihtml5.lang.array(types).contains(prevNode.nodeType)) || // nodeTypes check. (options && options.ignoreBlankTexts && _isBlankText(prevNode)) // Blank text nodes bypassed if set ) { return wysihtml5.dom.domNode(prevNode).prev(options); } return prevNode; }
[ "function", "(", "options", ")", "{", "var", "prevNode", "=", "node", ".", "previousSibling", ",", "types", "=", "(", "options", "&&", "options", ".", "nodeTypes", ")", "?", "options", ".", "nodeTypes", ":", "defaultNodeTypes", ";", "if", "(", "!", "prev...
var node = wysihtml5.dom.domNode(element).prev({nodeTypes: [1,3], ignoreBlankTexts: true});
[ "var", "node", "=", "wysihtml5", ".", "dom", ".", "domNode", "(", "element", ")", ".", "prev", "(", "{", "nodeTypes", ":", "[", "1", "3", "]", "ignoreBlankTexts", ":", "true", "}", ")", ";" ]
19113c3cbc19a7afe0cfd3158d647064d2d30661
https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js#L5337-L5353
train
Returns the previous sibling of node
[ 30522, 3853, 1006, 7047, 1007, 1063, 13075, 3653, 16022, 10244, 1027, 13045, 1012, 3025, 5332, 9709, 1010, 4127, 1027, 1006, 7047, 1004, 1004, 7047, 1012, 13045, 13874, 2015, 1007, 1029, 7047, 1012, 13045, 13874, 2015, 1024, 12398, 3630, 32...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/document/DocumentCommandHandlers.js
handleFileRename
function handleFileRename() { // Prefer selected sidebar item (which could be a folder) var entry = ProjectManager.getContext(); if (!entry) { // Else use current file (not selected in ProjectManager if not visible in tree or workingset) entry = MainViewManager.getCurrentlyViewedFile(); } if (entry) { ProjectManager.renameItemInline(entry); } }
javascript
function handleFileRename() { // Prefer selected sidebar item (which could be a folder) var entry = ProjectManager.getContext(); if (!entry) { // Else use current file (not selected in ProjectManager if not visible in tree or workingset) entry = MainViewManager.getCurrentlyViewedFile(); } if (entry) { ProjectManager.renameItemInline(entry); } }
[ "function", "handleFileRename", "(", ")", "{", "// Prefer selected sidebar item (which could be a folder)", "var", "entry", "=", "ProjectManager", ".", "getContext", "(", ")", ";", "if", "(", "!", "entry", ")", "{", "// Else use current file (not selected in ProjectManager ...
Show a textfield to rename whatever is currently selected in the sidebar (or current doc if nothing else selected)
[ "Show", "a", "textfield", "to", "rename", "whatever", "is", "currently", "selected", "in", "the", "sidebar", "(", "or", "current", "doc", "if", "nothing", "else", "selected", ")" ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/document/DocumentCommandHandlers.js#L1494-L1504
train
Handle file renaming
[ 30522, 3853, 5047, 8873, 3917, 8189, 4168, 1006, 1007, 1063, 1013, 1013, 9544, 3479, 2217, 8237, 8875, 1006, 2029, 2071, 2022, 1037, 19622, 1007, 13075, 4443, 1027, 2622, 24805, 4590, 1012, 2131, 8663, 18209, 1006, 1007, 1025, 2065, 1006, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
eslint/eslint
lib/rules/prefer-template.js
hasOctalEscapeSequence
function hasOctalEscapeSequence(node) { if (isConcatenation(node)) { return hasOctalEscapeSequence(node.left) || hasOctalEscapeSequence(node.right); } return isOctalEscapeSequence(node); }
javascript
function hasOctalEscapeSequence(node) { if (isConcatenation(node)) { return hasOctalEscapeSequence(node.left) || hasOctalEscapeSequence(node.right); } return isOctalEscapeSequence(node); }
[ "function", "hasOctalEscapeSequence", "(", "node", ")", "{", "if", "(", "isConcatenation", "(", "node", ")", ")", "{", "return", "hasOctalEscapeSequence", "(", "node", ".", "left", ")", "||", "hasOctalEscapeSequence", "(", "node", ".", "right", ")", ";", "}"...
Checks whether or not a node contains a octal escape sequence @param {ASTNode} node A node to check @returns {boolean} `true` if the node contains an octal escape sequence
[ "Checks", "whether", "or", "not", "a", "node", "contains", "a", "octal", "escape", "sequence" ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/prefer-template.js#L72-L78
train
Check if a node has an octal escape sequence
[ 30522, 3853, 2038, 10085, 22059, 15782, 10374, 2063, 4226, 5897, 1006, 13045, 1007, 1063, 2065, 1006, 2003, 8663, 16280, 9323, 1006, 13045, 1007, 1007, 1063, 2709, 2038, 10085, 22059, 15782, 10374, 2063, 4226, 5897, 1006, 13045, 1012, 2187, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
summernote/summernote
src/js/base/core/dom.js
removeWhile
function removeWhile(node, pred) { while (node) { if (isEditable(node) || !pred(node)) { break; } const parent = node.parentNode; remove(node); node = parent; } }
javascript
function removeWhile(node, pred) { while (node) { if (isEditable(node) || !pred(node)) { break; } const parent = node.parentNode; remove(node); node = parent; } }
[ "function", "removeWhile", "(", "node", ",", "pred", ")", "{", "while", "(", "node", ")", "{", "if", "(", "isEditable", "(", "node", ")", "||", "!", "pred", "(", "node", ")", ")", "{", "break", ";", "}", "const", "parent", "=", "node", ".", "pare...
@method removeWhile @param {Node} node @param {Function} pred
[ "@method", "removeWhile" ]
8dcafb8107453006b905ef697a529c42e76beb3f
https://github.com/summernote/summernote/blob/8dcafb8107453006b905ef697a529c42e76beb3f/src/js/base/core/dom.js#L900-L910
train
Remove nodes from the tree while predicate returns true
[ 30522, 3853, 6366, 19927, 1006, 13045, 1010, 3653, 2094, 1007, 1063, 2096, 1006, 13045, 1007, 1063, 2065, 1006, 2003, 2098, 6590, 3468, 1006, 13045, 1007, 1064, 1064, 999, 3653, 2094, 1006, 13045, 1007, 1007, 1063, 3338, 1025, 1065, 9530, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
google/closure-library
closure/goog/structs/avltree.js
function(opt_comparator) { /** * Comparison function used to compare values in the tree. This function * should take two values, a and b, and return x where: * * <pre> * x < 0 if a < b, * x > 0 if a > b, * x = 0 otherwise * </pre> * * @private @const {!Function} */ this.comparator_ = opt_comparator || DEFAULT_COMPARATOR; /** * Pointer to the root node of the tree. * * @private {?Node<T>} */ this.root_ = null; /** * Pointer to the node with the smallest value in the tree. * * @private {?Node<T>} */ this.minNode_ = null; /** * Pointer to the node with the largest value in the tree. * * @private {?Node<T>} */ this.maxNode_ = null; }
javascript
function(opt_comparator) { /** * Comparison function used to compare values in the tree. This function * should take two values, a and b, and return x where: * * <pre> * x < 0 if a < b, * x > 0 if a > b, * x = 0 otherwise * </pre> * * @private @const {!Function} */ this.comparator_ = opt_comparator || DEFAULT_COMPARATOR; /** * Pointer to the root node of the tree. * * @private {?Node<T>} */ this.root_ = null; /** * Pointer to the node with the smallest value in the tree. * * @private {?Node<T>} */ this.minNode_ = null; /** * Pointer to the node with the largest value in the tree. * * @private {?Node<T>} */ this.maxNode_ = null; }
[ "function", "(", "opt_comparator", ")", "{", "/**\n * Comparison function used to compare values in the tree. This function\n * should take two values, a and b, and return x where:\n *\n * <pre>\n * x < 0 if a < b,\n * x > 0 if a > b,\n * x = 0 otherwise\n * </pre>\n *\n * @private ...
Constructs an AVL-Tree, which uses the specified comparator to order its values. The values can be accessed efficiently in their sorted order since the tree enforces a O(logn) maximum height. @param {?Function=} opt_comparator Function used to order the tree's nodes. @constructor @implements {Collection<T>} @final @template T
[ "Constructs", "an", "AVL", "-", "Tree", "which", "uses", "the", "specified", "comparator", "to", "order", "its", "values", ".", "The", "values", "can", "be", "accessed", "efficiently", "in", "their", "sorted", "order", "since", "the", "tree", "enforces", "a"...
97390e9ca4483cebb9628e06026139fbb3023d65
https://github.com/google/closure-library/blob/97390e9ca4483cebb9628e06026139fbb3023d65/closure/goog/structs/avltree.js#L65-L100
train
A comparison function for the tree.
[ 30522, 3853, 1006, 23569, 1035, 4012, 28689, 4263, 1007, 1063, 1013, 1008, 1008, 1008, 7831, 3853, 2109, 2000, 12826, 5300, 1999, 1996, 3392, 1012, 2023, 3853, 1008, 2323, 2202, 2048, 5300, 1010, 1037, 1998, 1038, 1010, 1998, 2709, 1060, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/utils/EventDispatcher.js
splitNs
function splitNs(eventStr) { var dot = eventStr.indexOf("."); if (dot === -1) { return { eventName: eventStr }; } else { return { eventName: eventStr.substring(0, dot), ns: eventStr.substring(dot) }; } }
javascript
function splitNs(eventStr) { var dot = eventStr.indexOf("."); if (dot === -1) { return { eventName: eventStr }; } else { return { eventName: eventStr.substring(0, dot), ns: eventStr.substring(dot) }; } }
[ "function", "splitNs", "(", "eventStr", ")", "{", "var", "dot", "=", "eventStr", ".", "indexOf", "(", "\".\"", ")", ";", "if", "(", "dot", "===", "-", "1", ")", "{", "return", "{", "eventName", ":", "eventStr", "}", ";", "}", "else", "{", "return",...
Split "event.namespace" string into its two parts; both parts are optional. @param {string} eventName Event name and/or trailing ".namespace" @return {!{event:string, ns:string}} Uses "" for missing parts.
[ "Split", "event", ".", "namespace", "string", "into", "its", "two", "parts", ";", "both", "parts", "are", "optional", "." ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/utils/EventDispatcher.js#L66-L73
train
Split event name into event name and namespace
[ 30522, 3853, 3975, 3619, 1006, 2824, 16344, 1007, 1063, 13075, 11089, 1027, 2824, 16344, 1012, 5950, 11253, 1006, 1000, 1012, 1000, 1007, 1025, 2065, 1006, 11089, 1027, 1027, 1027, 1011, 1015, 1007, 1063, 2709, 1063, 2724, 18442, 1024, 2824...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SheetJS/js-xlsx
bits/70_csheet.js
parse_BrtCsProp
function parse_BrtCsProp(data, length/*:number*/) { data.l += 10; var name = parse_XLWideString(data, length - 10); return { name: name }; }
javascript
function parse_BrtCsProp(data, length/*:number*/) { data.l += 10; var name = parse_XLWideString(data, length - 10); return { name: name }; }
[ "function", "parse_BrtCsProp", "(", "data", ",", "length", "/*:number*/", ")", "{", "data", ".", "l", "+=", "10", ";", "var", "name", "=", "parse_XLWideString", "(", "data", ",", "length", "-", "10", ")", ";", "return", "{", "name", ":", "name", "}", ...
/* [MS-XLSB] 2.4.331 BrtCsProp
[ "/", "*", "[", "MS", "-", "XLSB", "]", "2", ".", "4", ".", "331", "BrtCsProp" ]
9a6d8a1d3d80c78dad5201fb389316f935279cdc
https://github.com/SheetJS/js-xlsx/blob/9a6d8a1d3d80c78dad5201fb389316f935279cdc/bits/70_csheet.js#L35-L39
train
Parse BrtCsProp
[ 30522, 3853, 11968, 3366, 1035, 7987, 13535, 13102, 18981, 1006, 2951, 1010, 3091, 1013, 1008, 1024, 2193, 1008, 1013, 1007, 1063, 2951, 1012, 1048, 1009, 1027, 2184, 1025, 13075, 2171, 1027, 11968, 3366, 1035, 28712, 22517, 3367, 4892, 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...
facebook/relay
packages/relay-compiler/util/areEqualOSS.js
areEqual
function areEqual(a: any, b: any): boolean { const aStack = aStackPool.length ? aStackPool.pop() : []; const bStack = bStackPool.length ? bStackPool.pop() : []; const result = eq(a, b, aStack, bStack); aStack.length = 0; bStack.length = 0; aStackPool.push(aStack); bStackPool.push(bStack); return result; }
javascript
function areEqual(a: any, b: any): boolean { const aStack = aStackPool.length ? aStackPool.pop() : []; const bStack = bStackPool.length ? bStackPool.pop() : []; const result = eq(a, b, aStack, bStack); aStack.length = 0; bStack.length = 0; aStackPool.push(aStack); bStackPool.push(bStack); return result; }
[ "function", "areEqual", "(", "a", ":", "any", ",", "b", ":", "any", ")", ":", "boolean", "{", "const", "aStack", "=", "aStackPool", ".", "length", "?", "aStackPool", ".", "pop", "(", ")", ":", "[", "]", ";", "const", "bStack", "=", "bStackPool", "....
Checks if two values are equal. Values may be primitives, arrays, or objects. Returns true if both arguments have the same keys and values. @see http://underscorejs.org @copyright 2009-2013 Jeremy Ashkenas, DocumentCloud Inc. @license MIT
[ "Checks", "if", "two", "values", "are", "equal", ".", "Values", "may", "be", "primitives", "arrays", "or", "objects", ".", "Returns", "true", "if", "both", "arguments", "have", "the", "same", "keys", "and", "values", "." ]
7fb9be5182b9650637d7b92ead9a42713ac30aa4
https://github.com/facebook/relay/blob/7fb9be5182b9650637d7b92ead9a42713ac30aa4/packages/relay-compiler/util/areEqualOSS.js#L23-L32
train
A is equal to b
[ 30522, 3853, 2024, 2063, 26426, 1006, 1037, 1024, 2151, 1010, 1038, 1024, 2151, 1007, 1024, 22017, 20898, 1063, 9530, 3367, 2004, 2696, 3600, 1027, 2004, 2696, 3600, 16869, 1012, 3091, 1029, 2004, 2696, 3600, 16869, 1012, 3769, 1006, 30524,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/incubator-echarts
src/chart/treemap/treemapLayout.js
worst
function worst(row, rowFixedLength, ratio) { var areaMax = 0; var areaMin = Infinity; for (var i = 0, area, len = row.length; i < len; i++) { area = row[i].getLayout().area; if (area) { area < areaMin && (areaMin = area); area > areaMax && (areaMax = area); } } var squareArea = row.area * row.area; var f = rowFixedLength * rowFixedLength * ratio; return squareArea ? mathMax( (f * areaMax) / squareArea, squareArea / (f * areaMin) ) : Infinity; }
javascript
function worst(row, rowFixedLength, ratio) { var areaMax = 0; var areaMin = Infinity; for (var i = 0, area, len = row.length; i < len; i++) { area = row[i].getLayout().area; if (area) { area < areaMin && (areaMin = area); area > areaMax && (areaMax = area); } } var squareArea = row.area * row.area; var f = rowFixedLength * rowFixedLength * ratio; return squareArea ? mathMax( (f * areaMax) / squareArea, squareArea / (f * areaMin) ) : Infinity; }
[ "function", "worst", "(", "row", ",", "rowFixedLength", ",", "ratio", ")", "{", "var", "areaMax", "=", "0", ";", "var", "areaMin", "=", "Infinity", ";", "for", "(", "var", "i", "=", "0", ",", "area", ",", "len", "=", "row", ".", "length", ";", "i...
Computes the score for the specified row, as the worst aspect ratio.
[ "Computes", "the", "score", "for", "the", "specified", "row", "as", "the", "worst", "aspect", "ratio", "." ]
4d0ea095dc3929cb6de40c45748826e7999c7aa8
https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/chart/treemap/treemapLayout.js#L405-L426
train
Returns the worst area of a row
[ 30522, 3853, 5409, 1006, 5216, 1010, 5216, 23901, 7770, 13512, 2232, 1010, 6463, 1007, 1063, 13075, 2181, 17848, 1027, 1014, 1025, 13075, 2181, 10020, 1027, 15579, 1025, 2005, 1006, 13075, 1045, 1027, 1014, 1010, 2181, 1010, 18798, 1027, 52...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
vuejs/vue-cli
packages/@vue/cli-service/lib/util/prepareProxy.js
mayProxy
function mayProxy (pathname) { const maybePublicPath = path.resolve(appPublicFolder, pathname.slice(1)) return !fs.existsSync(maybePublicPath) }
javascript
function mayProxy (pathname) { const maybePublicPath = path.resolve(appPublicFolder, pathname.slice(1)) return !fs.existsSync(maybePublicPath) }
[ "function", "mayProxy", "(", "pathname", ")", "{", "const", "maybePublicPath", "=", "path", ".", "resolve", "(", "appPublicFolder", ",", "pathname", ".", "slice", "(", "1", ")", ")", "return", "!", "fs", ".", "existsSync", "(", "maybePublicPath", ")", "}" ...
Otherwise, if proxy is specified, we will let it handle any request except for files in the public folder.
[ "Otherwise", "if", "proxy", "is", "specified", "we", "will", "let", "it", "handle", "any", "request", "except", "for", "files", "in", "the", "public", "folder", "." ]
206803cbefefdfbc7d8ed12440b0b751688b77b2
https://github.com/vuejs/vue-cli/blob/206803cbefefdfbc7d8ed12440b0b751688b77b2/packages/@vue/cli-service/lib/util/prepareProxy.js#L48-L51
train
Check if pathname is a public folder
[ 30522, 3853, 2089, 21572, 18037, 1006, 4130, 18442, 1007, 1063, 9530, 3367, 2672, 14289, 16558, 2594, 15069, 1027, 4130, 1012, 10663, 1006, 10439, 14289, 16558, 2594, 10371, 2121, 1010, 4130, 18442, 1012, 14704, 1006, 1015, 1007, 1007, 2709, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/thirdparty/qunit.js
escapeText
function escapeText( s ) { if ( !s ) { return ""; } s = s + ""; // Both single quotes and double quotes (for attributes) return s.replace( /['"<>&]/g, function( s ) { switch ( s ) { case "'": return "&#039;"; case "\"": return "&quot;"; case "<": return "&lt;"; case ">": return "&gt;"; case "&": return "&amp;"; } }); }
javascript
function escapeText( s ) { if ( !s ) { return ""; } s = s + ""; // Both single quotes and double quotes (for attributes) return s.replace( /['"<>&]/g, function( s ) { switch ( s ) { case "'": return "&#039;"; case "\"": return "&quot;"; case "<": return "&lt;"; case ">": return "&gt;"; case "&": return "&amp;"; } }); }
[ "function", "escapeText", "(", "s", ")", "{", "if", "(", "!", "s", ")", "{", "return", "\"\"", ";", "}", "s", "=", "s", "+", "\"\"", ";", "// Both single quotes and double quotes (for attributes)", "return", "s", ".", "replace", "(", "/", "['\"<>&]", "/", ...
Escape text for attribute or text content.
[ "Escape", "text", "for", "attribute", "or", "text", "content", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/qunit.js#L3162-L3183
train
Escape text
[ 30522, 3853, 4019, 18209, 1006, 1055, 1007, 1063, 2065, 1006, 999, 1055, 1007, 1063, 2709, 1000, 1000, 1025, 1065, 1055, 1027, 1055, 1009, 1000, 1000, 1025, 1013, 1013, 2119, 2309, 16614, 1998, 3313, 16614, 1006, 2005, 12332, 1007, 2709, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
googleapis/google-api-nodejs-client
samples/youtube/upload.js
runSample
async function runSample(fileName) { const fileSize = fs.statSync(fileName).size; const res = await youtube.videos.insert( { part: 'id,snippet,status', notifySubscribers: false, requestBody: { snippet: { title: 'Node.js YouTube Upload Test', description: 'Testing YouTube upload via Google APIs Node.js Client', }, status: { privacyStatus: 'private', }, }, media: { body: fs.createReadStream(fileName), }, }, { // Use the `onUploadProgress` event from Axios to track the // number of bytes uploaded to this point. onUploadProgress: evt => { const progress = (evt.bytesRead / fileSize) * 100; readline.clearLine(process.stdout, 0); readline.cursorTo(process.stdout, 0, null); process.stdout.write(`${Math.round(progress)}% complete`); }, } ); console.log('\n\n'); console.log(res.data); return res.data; }
javascript
async function runSample(fileName) { const fileSize = fs.statSync(fileName).size; const res = await youtube.videos.insert( { part: 'id,snippet,status', notifySubscribers: false, requestBody: { snippet: { title: 'Node.js YouTube Upload Test', description: 'Testing YouTube upload via Google APIs Node.js Client', }, status: { privacyStatus: 'private', }, }, media: { body: fs.createReadStream(fileName), }, }, { // Use the `onUploadProgress` event from Axios to track the // number of bytes uploaded to this point. onUploadProgress: evt => { const progress = (evt.bytesRead / fileSize) * 100; readline.clearLine(process.stdout, 0); readline.cursorTo(process.stdout, 0, null); process.stdout.write(`${Math.round(progress)}% complete`); }, } ); console.log('\n\n'); console.log(res.data); return res.data; }
[ "async", "function", "runSample", "(", "fileName", ")", "{", "const", "fileSize", "=", "fs", ".", "statSync", "(", "fileName", ")", ".", "size", ";", "const", "res", "=", "await", "youtube", ".", "videos", ".", "insert", "(", "{", "part", ":", "'id,sni...
very basic example of uploading a video to youtube
[ "very", "basic", "example", "of", "uploading", "a", "video", "to", "youtube" ]
e6e632a29d0b246d058e3067de3a5c3827e2b54e
https://github.com/googleapis/google-api-nodejs-client/blob/e6e632a29d0b246d058e3067de3a5c3827e2b54e/samples/youtube/upload.js#L33-L66
train
Runs a sample of YouTube
[ 30522, 2004, 6038, 2278, 3853, 3216, 16613, 2571, 1006, 5371, 18442, 1007, 1063, 9530, 3367, 6764, 4697, 1027, 1042, 2015, 1012, 26319, 6038, 2278, 1006, 5371, 18442, 1007, 1012, 2946, 1025, 9530, 3367, 24501, 1027, 26751, 7858, 1012, 6876,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/ODataMetaModel.js
stripKeyPredicate
function stripKeyPredicate(sSegment) { var iPos = sSegment.indexOf("("); return iPos >= 0 ? sSegment.slice(0, iPos) : sSegment; }
javascript
function stripKeyPredicate(sSegment) { var iPos = sSegment.indexOf("("); return iPos >= 0 ? sSegment.slice(0, iPos) : sSegment; }
[ "function", "stripKeyPredicate", "(", "sSegment", ")", "{", "var", "iPos", "=", "sSegment", ".", "indexOf", "(", "\"(\"", ")", ";", "return", "iPos", ">=", "0", "?", "sSegment", ".", "slice", "(", "0", ",", "iPos", ")", ":", "sSegment", ";", "}" ]
qualified name of current (entity) type across navigations /* Strips the OData key predicate from a resource path segment. @param {string} sSegment @returns {string}
[ "qualified", "name", "of", "current", "(", "entity", ")", "type", "across", "navigations", "/", "*", "Strips", "the", "OData", "key", "predicate", "from", "a", "resource", "path", "segment", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/ODataMetaModel.js#L549-L554
train
Removes the key predicate from the segment if it exists
[ 30522, 3853, 6167, 14839, 28139, 16467, 1006, 7020, 13910, 3672, 1007, 1063, 13075, 12997, 2891, 1027, 7020, 13910, 3672, 1012, 5950, 11253, 1006, 1000, 1006, 1000, 1007, 1025, 2709, 12997, 2891, 1028, 1027, 1014, 1029, 7020, 13910, 3672, 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...
SheetJS/js-xlsx
xlsx.js
shift_formula_str
function shift_formula_str(f, delta) { return f.replace(crefregex, function($0, $1, $2, $3, $4, $5) { return $1+($2=="$" ? $2+$3 : encode_col(decode_col($3)+delta.c))+($4=="$" ? $4+$5 : encode_row(decode_row($5) + delta.r)); }); }
javascript
function shift_formula_str(f, delta) { return f.replace(crefregex, function($0, $1, $2, $3, $4, $5) { return $1+($2=="$" ? $2+$3 : encode_col(decode_col($3)+delta.c))+($4=="$" ? $4+$5 : encode_row(decode_row($5) + delta.r)); }); }
[ "function", "shift_formula_str", "(", "f", ",", "delta", ")", "{", "return", "f", ".", "replace", "(", "crefregex", ",", "function", "(", "$0", ",", "$1", ",", "$2", ",", "$3", ",", "$4", ",", "$5", ")", "{", "return", "$1", "+", "(", "$2", "==",...
/* no defined name can collide with a valid cell address A1:XFD1048576 ... except LOG10!
[ "/", "*", "no", "defined", "name", "can", "collide", "with", "a", "valid", "cell", "address", "A1", ":", "XFD1048576", "...", "except", "LOG10!" ]
9a6d8a1d3d80c78dad5201fb389316f935279cdc
https://github.com/SheetJS/js-xlsx/blob/9a6d8a1d3d80c78dad5201fb389316f935279cdc/xlsx.js#L10204-L10208
train
Shift formula string
[ 30522, 3853, 5670, 1035, 5675, 1035, 2358, 2099, 1006, 1042, 1010, 7160, 1007, 1063, 2709, 1042, 1012, 5672, 1006, 13675, 12879, 2890, 3351, 2595, 1010, 3853, 1006, 1002, 1014, 1010, 1002, 1015, 1010, 1002, 1016, 1010, 1002, 1017, 1010, 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...
apache/incubator-echarts
src/chart/treemap/treemapLayout.js
estimateRootSize
function estimateRootSize(seriesModel, targetInfo, viewRoot, containerWidth, containerHeight) { // If targetInfo.node exists, we zoom to the node, // so estimate whold width and heigth by target node. var currNode = (targetInfo || {}).node; var defaultSize = [containerWidth, containerHeight]; if (!currNode || currNode === viewRoot) { return defaultSize; } var parent; var viewArea = containerWidth * containerHeight; var area = viewArea * seriesModel.option.zoomToNodeRatio; while (parent = currNode.parentNode) { // jshint ignore:line var sum = 0; var siblings = parent.children; for (var i = 0, len = siblings.length; i < len; i++) { sum += siblings[i].getValue(); } var currNodeValue = currNode.getValue(); if (currNodeValue === 0) { return defaultSize; } area *= sum / currNodeValue; // Considering border, suppose aspect ratio is 1. var parentModel = parent.getModel(); var borderWidth = parentModel.get(PATH_BORDER_WIDTH); var upperHeight = Math.max(borderWidth, getUpperLabelHeight(parentModel, borderWidth)); area += 4 * borderWidth * borderWidth + (3 * borderWidth + upperHeight) * Math.pow(area, 0.5); area > MAX_SAFE_INTEGER && (area = MAX_SAFE_INTEGER); currNode = parent; } area < viewArea && (area = viewArea); var scale = Math.pow(area / viewArea, 0.5); return [containerWidth * scale, containerHeight * scale]; }
javascript
function estimateRootSize(seriesModel, targetInfo, viewRoot, containerWidth, containerHeight) { // If targetInfo.node exists, we zoom to the node, // so estimate whold width and heigth by target node. var currNode = (targetInfo || {}).node; var defaultSize = [containerWidth, containerHeight]; if (!currNode || currNode === viewRoot) { return defaultSize; } var parent; var viewArea = containerWidth * containerHeight; var area = viewArea * seriesModel.option.zoomToNodeRatio; while (parent = currNode.parentNode) { // jshint ignore:line var sum = 0; var siblings = parent.children; for (var i = 0, len = siblings.length; i < len; i++) { sum += siblings[i].getValue(); } var currNodeValue = currNode.getValue(); if (currNodeValue === 0) { return defaultSize; } area *= sum / currNodeValue; // Considering border, suppose aspect ratio is 1. var parentModel = parent.getModel(); var borderWidth = parentModel.get(PATH_BORDER_WIDTH); var upperHeight = Math.max(borderWidth, getUpperLabelHeight(parentModel, borderWidth)); area += 4 * borderWidth * borderWidth + (3 * borderWidth + upperHeight) * Math.pow(area, 0.5); area > MAX_SAFE_INTEGER && (area = MAX_SAFE_INTEGER); currNode = parent; } area < viewArea && (area = viewArea); var scale = Math.pow(area / viewArea, 0.5); return [containerWidth * scale, containerHeight * scale]; }
[ "function", "estimateRootSize", "(", "seriesModel", ",", "targetInfo", ",", "viewRoot", ",", "containerWidth", ",", "containerHeight", ")", "{", "// If targetInfo.node exists, we zoom to the node,", "// so estimate whold width and heigth by target node.", "var", "currNode", "=", ...
Return [containerWidth, containerHeight] as defualt.
[ "Return", "[", "containerWidth", "containerHeight", "]", "as", "defualt", "." ]
4d0ea095dc3929cb6de40c45748826e7999c7aa8
https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/chart/treemap/treemapLayout.js#L478-L521
train
Estimate the root size of the container.
[ 30522, 3853, 10197, 3217, 12868, 4697, 1006, 2186, 5302, 9247, 1010, 4539, 2378, 14876, 1010, 3193, 3217, 4140, 1010, 11661, 9148, 11927, 2232, 1010, 11661, 26036, 13900, 1007, 1063, 1013, 1013, 2065, 4539, 2378, 14876, 1012, 13045, 6526, 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...
laurent22/joplin
ReactNativeClient/lib/import-enex-md-gen.js
drawTable
function drawTable(table) { // | First Header | Second Header | // | ------------- | ------------- | // | Content Cell | Content Cell | // | Content Cell | Content Cell | // There must be at least 3 dashes separating each header cell. // https://gist.github.com/IanWang/28965e13cdafdef4e11dc91f578d160d#tables const flatRender = tableHasSubTables(table); // Render the table has regular text let lines = []; lines.push(BLOCK_OPEN); let headerDone = false; for (let trIndex = 0; trIndex < table.lines.length; trIndex++) { const tr = table.lines[trIndex]; const isHeader = tr.isHeader; let line = []; let headerLine = []; let emptyHeader = null; for (let tdIndex = 0; tdIndex < tr.lines.length; tdIndex++) { const td = tr.lines[tdIndex]; if (flatRender) { line.push(BLOCK_OPEN); let currentCells = []; const renderCurrentCells = () => { if (!currentCells.length) return; const cellText = processMdArrayNewLines(currentCells); line.push(cellText); currentCells = []; } // In here, recursively render the tables for (let i = 0; i < td.lines.length; i++) { const c = td.lines[i]; if (typeof c === 'object' && ['table', 'td', 'tr', 'th'].indexOf(c.type) >= 0) { // This is a table renderCurrentCells(); currentCells = currentCells.concat(drawTable(c)); } else { // This is plain text currentCells.push(c); } } renderCurrentCells(); line.push(BLOCK_CLOSE); } else { // Regular table rendering // A cell in a Markdown table cannot have actual new lines so replace // them with <br>, which are supported by the markdown renderers. let cellText = processMdArrayNewLines(td.lines, true) let lines = cellText.split('\n'); lines = postProcessMarkdown(lines); cellText = lines.join('\n').replace(/\n+/g, "<br>"); // Inside tables cells, "|" needs to be escaped cellText = cellText.replace(/\|/g, "\\|"); // Previously the width of the cell was as big as the content since it looks nicer, however that often doesn't work // since the content can be very long, resulting in unreadable markdown. So no solution is perfect but making it a // width of 3 is a bit better. Note that 3 is the minimum width of a cell - below this, it won't be rendered by // markdown parsers. const width = 3; line.push(stringPadding(cellText, width, ' ', stringPadding.RIGHT)); if (!headerDone) { if (!isHeader) { if (!emptyHeader) emptyHeader = []; let h = stringPadding(' ', width, ' ', stringPadding.RIGHT); emptyHeader.push(h); } headerLine.push('-'.repeat(width)); } } } if (flatRender) { headerDone = true; lines.push(BLOCK_OPEN); lines = lines.concat(line); lines.push(BLOCK_CLOSE); } else { if (emptyHeader) { lines.push('| ' + emptyHeader.join(' | ') + ' |'); lines.push('| ' + headerLine.join(' | ') + ' |'); headerDone = true; } lines.push('| ' + line.join(' | ') + ' |'); if (!headerDone) { lines.push('| ' + headerLine.join(' | ') + ' |'); headerDone = true; } } } lines.push(BLOCK_CLOSE); return flatRender ? lines : lines.join('<<<<:D>>>>' + NEWLINE + '<<<<:D>>>>').split('<<<<:D>>>>'); }
javascript
function drawTable(table) { // | First Header | Second Header | // | ------------- | ------------- | // | Content Cell | Content Cell | // | Content Cell | Content Cell | // There must be at least 3 dashes separating each header cell. // https://gist.github.com/IanWang/28965e13cdafdef4e11dc91f578d160d#tables const flatRender = tableHasSubTables(table); // Render the table has regular text let lines = []; lines.push(BLOCK_OPEN); let headerDone = false; for (let trIndex = 0; trIndex < table.lines.length; trIndex++) { const tr = table.lines[trIndex]; const isHeader = tr.isHeader; let line = []; let headerLine = []; let emptyHeader = null; for (let tdIndex = 0; tdIndex < tr.lines.length; tdIndex++) { const td = tr.lines[tdIndex]; if (flatRender) { line.push(BLOCK_OPEN); let currentCells = []; const renderCurrentCells = () => { if (!currentCells.length) return; const cellText = processMdArrayNewLines(currentCells); line.push(cellText); currentCells = []; } // In here, recursively render the tables for (let i = 0; i < td.lines.length; i++) { const c = td.lines[i]; if (typeof c === 'object' && ['table', 'td', 'tr', 'th'].indexOf(c.type) >= 0) { // This is a table renderCurrentCells(); currentCells = currentCells.concat(drawTable(c)); } else { // This is plain text currentCells.push(c); } } renderCurrentCells(); line.push(BLOCK_CLOSE); } else { // Regular table rendering // A cell in a Markdown table cannot have actual new lines so replace // them with <br>, which are supported by the markdown renderers. let cellText = processMdArrayNewLines(td.lines, true) let lines = cellText.split('\n'); lines = postProcessMarkdown(lines); cellText = lines.join('\n').replace(/\n+/g, "<br>"); // Inside tables cells, "|" needs to be escaped cellText = cellText.replace(/\|/g, "\\|"); // Previously the width of the cell was as big as the content since it looks nicer, however that often doesn't work // since the content can be very long, resulting in unreadable markdown. So no solution is perfect but making it a // width of 3 is a bit better. Note that 3 is the minimum width of a cell - below this, it won't be rendered by // markdown parsers. const width = 3; line.push(stringPadding(cellText, width, ' ', stringPadding.RIGHT)); if (!headerDone) { if (!isHeader) { if (!emptyHeader) emptyHeader = []; let h = stringPadding(' ', width, ' ', stringPadding.RIGHT); emptyHeader.push(h); } headerLine.push('-'.repeat(width)); } } } if (flatRender) { headerDone = true; lines.push(BLOCK_OPEN); lines = lines.concat(line); lines.push(BLOCK_CLOSE); } else { if (emptyHeader) { lines.push('| ' + emptyHeader.join(' | ') + ' |'); lines.push('| ' + headerLine.join(' | ') + ' |'); headerDone = true; } lines.push('| ' + line.join(' | ') + ' |'); if (!headerDone) { lines.push('| ' + headerLine.join(' | ') + ' |'); headerDone = true; } } } lines.push(BLOCK_CLOSE); return flatRender ? lines : lines.join('<<<<:D>>>>' + NEWLINE + '<<<<:D>>>>').split('<<<<:D>>>>'); }
[ "function", "drawTable", "(", "table", ")", "{", "// | First Header | Second Header |", "// | ------------- | ------------- |", "// | Content Cell | Content Cell |", "// | Content Cell | Content Cell |", "// There must be at least 3 dashes separating each header cell.", "// https://gist.g...
Markdown tables don't support tables within tables, which is common in notes that are complete web pages, for example when imported via Web Clipper. So to handle this, we render all the outer tables as regular text (as if replacing all the <table>, <tr> and <td> elements by <div>) and only the inner ones, those that don't contain any other tables, are rendered as actual tables. This is generally the required behaviour since the outer tables are usually for layout and the inner ones are the content.
[ "Markdown", "tables", "don", "t", "support", "tables", "within", "tables", "which", "is", "common", "in", "notes", "that", "are", "complete", "web", "pages", "for", "example", "when", "imported", "via", "Web", "Clipper", ".", "So", "to", "handle", "this", ...
beb428b246cecba4630a3ca57b472f43c0933a43
https://github.com/laurent22/joplin/blob/beb428b246cecba4630a3ca57b472f43c0933a43/ReactNativeClient/lib/import-enex-md-gen.js#L869-L972
train
Draw the table
[ 30522, 3853, 4009, 10880, 1006, 2795, 1007, 1063, 1013, 1013, 1064, 2034, 20346, 1064, 2117, 20346, 1064, 1013, 1013, 1064, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1064, 1011, 1011, 1011, 1011, 1011, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Cache.js
PropertyCache
function PropertyCache(oRequestor, sResourcePath, mQueryOptions) { Cache.call(this, oRequestor, sResourcePath, mQueryOptions); this.oPromise = null; }
javascript
function PropertyCache(oRequestor, sResourcePath, mQueryOptions) { Cache.call(this, oRequestor, sResourcePath, mQueryOptions); this.oPromise = null; }
[ "function", "PropertyCache", "(", "oRequestor", ",", "sResourcePath", ",", "mQueryOptions", ")", "{", "Cache", ".", "call", "(", "this", ",", "oRequestor", ",", "sResourcePath", ",", "mQueryOptions", ")", ";", "this", ".", "oPromise", "=", "null", ";", "}" ]
********************************************************************************************* PropertyCache ********************************************************************************************* Creates a cache for a single property that performs requests using the given requestor. @param {sap.ui.model.odata.v4.lib._Requestor} oRequestor The requestor @param {string} sResourcePath A resource path relative to the service URL @param {object} [mQueryOptions] A map of key-value pairs representing the query string
[ "*********************************************************************************************", "PropertyCache", "*********************************************************************************************", "Creates", "a", "cache", "for", "a", "single", "property", "that", "performs", "r...
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Cache.js#L1926-L1930
train
Creates a new cache object.
[ 30522, 3853, 3200, 3540, 5403, 1006, 10848, 15500, 2953, 1010, 5034, 2229, 8162, 3401, 15069, 1010, 1049, 4226, 2854, 7361, 9285, 1007, 1063, 17053, 1012, 2655, 1006, 2023, 1010, 10848, 15500, 2953, 1010, 5034, 2229, 8162, 3401, 15069, 1010...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
NervJS/taro-ui
src/components/input-number/index.js
parseValue
function parseValue (num) { if (num === '') return '0' const numStr = _toString(num) if (numStr.indexOf('0') === 0 && numStr.indexOf('.') === -1) { // 处理01变成1,并且不处理1. return _toString(parseFloat(num)) } return _toString(num) }
javascript
function parseValue (num) { if (num === '') return '0' const numStr = _toString(num) if (numStr.indexOf('0') === 0 && numStr.indexOf('.') === -1) { // 处理01变成1,并且不处理1. return _toString(parseFloat(num)) } return _toString(num) }
[ "function", "parseValue", "(", "num", ")", "{", "if", "(", "num", "===", "''", ")", "return", "'0'", "const", "numStr", "=", "_toString", "(", "num", ")", "if", "(", "numStr", ".", "indexOf", "(", "'0'", ")", "===", "0", "&&", "numStr", ".", "index...
格式化数字,处理01变成1,并且不处理1. 这种情况
[ "格式化数字,处理01变成1", "并且不处理1", ".", "这种情况" ]
9a761032b3663abf82dd4514ac29deec2eb13d2a
https://github.com/NervJS/taro-ui/blob/9a761032b3663abf82dd4514ac29deec2eb13d2a/src/components/input-number/index.js#L28-L38
train
parse value
[ 30522, 3853, 11968, 3366, 10175, 5657, 1006, 16371, 2213, 1007, 1063, 2065, 1006, 16371, 2213, 1027, 1027, 1027, 1005, 1005, 1007, 2709, 1005, 1014, 1005, 9530, 3367, 16371, 5244, 16344, 1027, 1035, 2000, 3367, 4892, 1006, 16371, 2213, 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...
GitbookIO/gitbook
lib/plugins/validateConfig.js
validatePluginConfig
function validatePluginConfig(book, plugin) { var config = book.getConfig(); var packageInfos = plugin.getPackage(); var configKey = [ 'pluginsConfig', plugin.getName() ].join('.'); var pluginConfig = config.getValue(configKey, {}).toJS(); var schema = (packageInfos.get('gitbook') || Immutable.Map()).toJS(); if (!schema) return book; // Normalize schema schema.id = '/' + configKey; schema.type = 'object'; // Validate and throw if invalid var v = new jsonschema.Validator(); var result = v.validate(pluginConfig, schema, { propertyName: configKey }); // Throw error if (result.errors.length > 0) { throw new error.ConfigurationError(new Error(result.errors[0].stack)); } // Insert default values var defaults = jsonSchemaDefaults(schema); pluginConfig = mergeDefaults(pluginConfig, defaults); // Update configuration config = config.setValue(configKey, pluginConfig); // Return new book return book.set('config', config); }
javascript
function validatePluginConfig(book, plugin) { var config = book.getConfig(); var packageInfos = plugin.getPackage(); var configKey = [ 'pluginsConfig', plugin.getName() ].join('.'); var pluginConfig = config.getValue(configKey, {}).toJS(); var schema = (packageInfos.get('gitbook') || Immutable.Map()).toJS(); if (!schema) return book; // Normalize schema schema.id = '/' + configKey; schema.type = 'object'; // Validate and throw if invalid var v = new jsonschema.Validator(); var result = v.validate(pluginConfig, schema, { propertyName: configKey }); // Throw error if (result.errors.length > 0) { throw new error.ConfigurationError(new Error(result.errors[0].stack)); } // Insert default values var defaults = jsonSchemaDefaults(schema); pluginConfig = mergeDefaults(pluginConfig, defaults); // Update configuration config = config.setValue(configKey, pluginConfig); // Return new book return book.set('config', config); }
[ "function", "validatePluginConfig", "(", "book", ",", "plugin", ")", "{", "var", "config", "=", "book", ".", "getConfig", "(", ")", ";", "var", "packageInfos", "=", "plugin", ".", "getPackage", "(", ")", ";", "var", "configKey", "=", "[", "'pluginsConfig'"...
Validate one plugin for a book and update book's confiration @param {Book} @param {Plugin} @return {Book}
[ "Validate", "one", "plugin", "for", "a", "book", "and", "update", "book", "s", "confiration" ]
6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4
https://github.com/GitbookIO/gitbook/blob/6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4/lib/plugins/validateConfig.js#L16-L55
train
Validate plugin config
[ 30522, 3853, 9398, 3686, 24759, 15916, 2378, 8663, 8873, 2290, 1006, 2338, 1010, 13354, 2378, 1007, 1063, 13075, 9530, 8873, 2290, 1027, 2338, 1012, 2131, 8663, 8873, 2290, 1006, 1007, 1025, 13075, 7427, 2378, 14876, 2015, 1027, 13354, 2378...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/demoFloatingLabel/script.js
createFilterFor
function createFilterFor(query) { var lowercaseQuery = query.toLowerCase(); return function filterFn(state) { return (state.value.indexOf(lowercaseQuery) === 0); }; }
javascript
function createFilterFor(query) { var lowercaseQuery = query.toLowerCase(); return function filterFn(state) { return (state.value.indexOf(lowercaseQuery) === 0); }; }
[ "function", "createFilterFor", "(", "query", ")", "{", "var", "lowercaseQuery", "=", "query", ".", "toLowerCase", "(", ")", ";", "return", "function", "filterFn", "(", "state", ")", "{", "return", "(", "state", ".", "value", ".", "indexOf", "(", "lowercase...
Create filter function for a query string
[ "Create", "filter", "function", "for", "a", "query", "string" ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/autocomplete/demoFloatingLabel/script.js#L54-L61
train
Create a filter function for a given query
[ 30522, 3853, 3443, 8873, 21928, 29278, 1006, 23032, 1007, 1063, 13075, 2896, 18382, 4226, 2854, 1027, 23032, 1012, 2000, 27663, 18992, 3366, 1006, 1007, 1025, 2709, 3853, 11307, 2546, 2078, 1006, 2110, 1007, 1063, 2709, 1006, 2110, 1012, 36...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
angular/material
src/components/colors/colors.js
parseColor
function parseColor(color, contrast) { contrast = contrast || false; var rgbValues = $mdTheming.PALETTES[color.palette][color.hue]; rgbValues = contrast ? rgbValues.contrast : rgbValues.value; return $mdUtil.supplant('rgba({0}, {1}, {2}, {3})', [rgbValues[0], rgbValues[1], rgbValues[2], rgbValues[3] || color.opacity] ); }
javascript
function parseColor(color, contrast) { contrast = contrast || false; var rgbValues = $mdTheming.PALETTES[color.palette][color.hue]; rgbValues = contrast ? rgbValues.contrast : rgbValues.value; return $mdUtil.supplant('rgba({0}, {1}, {2}, {3})', [rgbValues[0], rgbValues[1], rgbValues[2], rgbValues[3] || color.opacity] ); }
[ "function", "parseColor", "(", "color", ",", "contrast", ")", "{", "contrast", "=", "contrast", "||", "false", ";", "var", "rgbValues", "=", "$mdTheming", ".", "PALETTES", "[", "color", ".", "palette", "]", "[", "color", ".", "hue", "]", ";", "rgbValues"...
Return the parsed color @param {{hue: *, theme: any, palette: *, opacity: (*|string|number)}} color hash map of color definitions @param {boolean=} contrast whether use contrast color for foreground. Defaults to false. @returns {string} rgba color string
[ "Return", "the", "parsed", "color" ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/colors/colors.js#L120-L129
train
Parse a color
[ 30522, 3853, 11968, 3366, 18717, 1006, 3609, 1010, 5688, 1007, 1063, 5688, 1027, 5688, 1064, 1064, 6270, 1025, 13075, 1054, 18259, 10175, 15808, 1027, 1002, 9108, 10760, 6562, 1012, 27396, 2015, 1031, 3609, 1012, 27396, 1033, 1031, 3609, 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...
thomaspark/bootswatch
docs/_vendor/popper.js/dist/popper.js
getPopperOffsets
function getPopperOffsets(popper, referenceOffsets, placement) { placement = placement.split('-')[0]; // Get popper node sizes const popperRect = getOuterSizes(popper); // Add position, width and height to our offsets object const popperOffsets = { width: popperRect.width, height: popperRect.height }; // depending by the popper placement we have to compute its offsets slightly differently const isHoriz = ['right', 'left'].indexOf(placement) !== -1; const mainSide = isHoriz ? 'top' : 'left'; const secondarySide = isHoriz ? 'left' : 'top'; const measurement = isHoriz ? 'height' : 'width'; const secondaryMeasurement = !isHoriz ? 'height' : 'width'; popperOffsets[mainSide] = referenceOffsets[mainSide] + referenceOffsets[measurement] / 2 - popperRect[measurement] / 2; if (placement === secondarySide) { popperOffsets[secondarySide] = referenceOffsets[secondarySide] - popperRect[secondaryMeasurement]; } else { popperOffsets[secondarySide] = referenceOffsets[getOppositePlacement(secondarySide)]; } return popperOffsets; }
javascript
function getPopperOffsets(popper, referenceOffsets, placement) { placement = placement.split('-')[0]; // Get popper node sizes const popperRect = getOuterSizes(popper); // Add position, width and height to our offsets object const popperOffsets = { width: popperRect.width, height: popperRect.height }; // depending by the popper placement we have to compute its offsets slightly differently const isHoriz = ['right', 'left'].indexOf(placement) !== -1; const mainSide = isHoriz ? 'top' : 'left'; const secondarySide = isHoriz ? 'left' : 'top'; const measurement = isHoriz ? 'height' : 'width'; const secondaryMeasurement = !isHoriz ? 'height' : 'width'; popperOffsets[mainSide] = referenceOffsets[mainSide] + referenceOffsets[measurement] / 2 - popperRect[measurement] / 2; if (placement === secondarySide) { popperOffsets[secondarySide] = referenceOffsets[secondarySide] - popperRect[secondaryMeasurement]; } else { popperOffsets[secondarySide] = referenceOffsets[getOppositePlacement(secondarySide)]; } return popperOffsets; }
[ "function", "getPopperOffsets", "(", "popper", ",", "referenceOffsets", ",", "placement", ")", "{", "placement", "=", "placement", ".", "split", "(", "'-'", ")", "[", "0", "]", ";", "// Get popper node sizes", "const", "popperRect", "=", "getOuterSizes", "(", ...
Get offsets to the popper @method @memberof Popper.Utils @param {Object} position - CSS position the Popper will get applied @param {HTMLElement} popper - the popper element @param {Object} referenceOffsets - the reference offsets (the popper will be relative to this) @param {String} placement - one of the valid placement options @returns {Object} popperOffsets - An object containing the offsets which will be applied to the popper
[ "Get", "offsets", "to", "the", "popper" ]
a913e4992dad8f7bf38df2e1d3f4cc6bfe5f26dd
https://github.com/thomaspark/bootswatch/blob/a913e4992dad8f7bf38df2e1d3f4cc6bfe5f26dd/docs/_vendor/popper.js/dist/popper.js#L710-L737
train
Get offsets for a popper
[ 30522, 3853, 2131, 16340, 4842, 27475, 8454, 1006, 3769, 4842, 1010, 4431, 27475, 8454, 1010, 11073, 1007, 1063, 11073, 1027, 11073, 1012, 3975, 1006, 1005, 1011, 1005, 1007, 1031, 1014, 1033, 1025, 1013, 1013, 2131, 3769, 4842, 13045, 1082...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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
third_party/polymer3/bower_components/polymer/lib/utils/templatize.js
createTemplatizerClass
function createTemplatizerClass(template, templateInfo, options) { // Anonymous class created by the templatize let base = options.mutableData ? MutableTemplateInstanceBase : TemplateInstanceBase; /** * @constructor * @extends {base} * @private */ let klass = class extends base { }; klass.prototype.__templatizeOptions = options; klass.prototype._bindTemplate(template); addNotifyEffects(klass, template, templateInfo, options); return klass; }
javascript
function createTemplatizerClass(template, templateInfo, options) { // Anonymous class created by the templatize let base = options.mutableData ? MutableTemplateInstanceBase : TemplateInstanceBase; /** * @constructor * @extends {base} * @private */ let klass = class extends base { }; klass.prototype.__templatizeOptions = options; klass.prototype._bindTemplate(template); addNotifyEffects(klass, template, templateInfo, options); return klass; }
[ "function", "createTemplatizerClass", "(", "template", ",", "templateInfo", ",", "options", ")", "{", "// Anonymous class created by the templatize", "let", "base", "=", "options", ".", "mutableData", "?", "MutableTemplateInstanceBase", ":", "TemplateInstanceBase", ";", "...
/* eslint-disable valid-jsdoc @suppress {missingProperties} class.prototype is not defined for some reason
[ "/", "*", "eslint", "-", "disable", "valid", "-", "jsdoc" ]
992929ffccac68827869a497f01ee4d653ed4f25
https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/third_party/polymer3/bower_components/polymer/lib/utils/templatize.js#L284-L298
train
Creates an anonymous templatizer class
[ 30522, 3853, 3443, 18532, 24759, 10450, 6290, 26266, 1006, 23561, 1010, 23561, 2378, 14876, 1010, 7047, 1007, 1063, 1013, 1013, 10812, 2465, 2580, 2011, 1996, 8915, 8737, 20051, 4697, 2292, 2918, 1027, 7047, 1012, 14163, 10880, 2850, 2696, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SheetJS/js-xlsx
xlsx.js
parse_numFmts
function parse_numFmts(t, styles, opts) { styles.NumberFmt = []; var k/*Array<number>*/ = (keys(SSF._table)); for(var i=0; i < k.length; ++i) styles.NumberFmt[k[i]] = SSF._table[k[i]]; var m = t[0].match(tagregex); if(!m) return; for(i=0; i < m.length; ++i) { var y = parsexmltag(m[i]); switch(strip_ns(y[0])) { case '<numFmts': case '</numFmts>': case '<numFmts/>': case '<numFmts>': break; case '<numFmt': { var f=unescapexml(utf8read(y.formatCode)), j=parseInt(y.numFmtId,10); styles.NumberFmt[j] = f; if(j>0) { if(j > 0x188) { for(j = 0x188; j > 0x3c; --j) if(styles.NumberFmt[j] == null) break; styles.NumberFmt[j] = f; } SSF.load(f,j); } } break; case '</numFmt>': break; default: if(opts.WTF) throw new Error('unrecognized ' + y[0] + ' in numFmts'); } } }
javascript
function parse_numFmts(t, styles, opts) { styles.NumberFmt = []; var k/*Array<number>*/ = (keys(SSF._table)); for(var i=0; i < k.length; ++i) styles.NumberFmt[k[i]] = SSF._table[k[i]]; var m = t[0].match(tagregex); if(!m) return; for(i=0; i < m.length; ++i) { var y = parsexmltag(m[i]); switch(strip_ns(y[0])) { case '<numFmts': case '</numFmts>': case '<numFmts/>': case '<numFmts>': break; case '<numFmt': { var f=unescapexml(utf8read(y.formatCode)), j=parseInt(y.numFmtId,10); styles.NumberFmt[j] = f; if(j>0) { if(j > 0x188) { for(j = 0x188; j > 0x3c; --j) if(styles.NumberFmt[j] == null) break; styles.NumberFmt[j] = f; } SSF.load(f,j); } } break; case '</numFmt>': break; default: if(opts.WTF) throw new Error('unrecognized ' + y[0] + ' in numFmts'); } } }
[ "function", "parse_numFmts", "(", "t", ",", "styles", ",", "opts", ")", "{", "styles", ".", "NumberFmt", "=", "[", "]", ";", "var", "k", "/*Array<number>*/", "=", "(", "keys", "(", "SSF", ".", "_table", ")", ")", ";", "for", "(", "var", "i", "=", ...
/* 18.8.31 numFmts CT_NumFmts
[ "/", "*", "18", ".", "8", ".", "31", "numFmts", "CT_NumFmts" ]
9a6d8a1d3d80c78dad5201fb389316f935279cdc
https://github.com/SheetJS/js-xlsx/blob/9a6d8a1d3d80c78dad5201fb389316f935279cdc/xlsx.js#L8856-L8881
train
Parse number formats
[ 30522, 3853, 11968, 3366, 1035, 16371, 2213, 16715, 3215, 1006, 1056, 1010, 6782, 1010, 23569, 2015, 1007, 1063, 6782, 1012, 2193, 16715, 2102, 1027, 1031, 1033, 1025, 13075, 1047, 1013, 1008, 9140, 1026, 2193, 1028, 1008, 1013, 1027, 1006,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/model/odata/v4/AnnotationHelper.js
function (vRawValue, oDetails) { var sPath = oDetails.context.getPath(); if (sPath.slice(-1) === "/") { // cut off trailing slash, happens with computed annotations sPath = sPath.slice(0, -1); } return Expression.getExpression({ asExpression : false, complexBinding : false, model : oDetails.context.getModel(), path : sPath, prefix : "", value : vRawValue, $$valueAsPromise : oDetails.$$valueAsPromise }); }
javascript
function (vRawValue, oDetails) { var sPath = oDetails.context.getPath(); if (sPath.slice(-1) === "/") { // cut off trailing slash, happens with computed annotations sPath = sPath.slice(0, -1); } return Expression.getExpression({ asExpression : false, complexBinding : false, model : oDetails.context.getModel(), path : sPath, prefix : "", value : vRawValue, $$valueAsPromise : oDetails.$$valueAsPromise }); }
[ "function", "(", "vRawValue", ",", "oDetails", ")", "{", "var", "sPath", "=", "oDetails", ".", "context", ".", "getPath", "(", ")", ";", "if", "(", "sPath", ".", "slice", "(", "-", "1", ")", "===", "\"/\"", ")", "{", "// cut off trailing slash, happens w...
A function that helps to interpret OData V4 annotations. It knows about the following expressions: <ul> <li>"14.4 Constant Expressions" for "edm:Bool", "edm:Date", "edm:DateTimeOffset", "edm:Decimal", "edm:Float", "edm:Guid", "edm:Int", "edm:TimeOfDay". <li>constant "14.4.11 Expression edm:String": This is turned into a fixed text (e.g. <code>"Width"</code>). String constants that contain a simple binding <code>"{@i18n>...}"</code> to the hard-coded model name "@i18n" with arbitrary path are not turned into a fixed text, but kept as a data binding expression; this allows local annotation files to refer to a resource bundle for internationalization. <li>dynamic "14.5.1 Comparison and Logical Operators": These are turned into expression bindings to perform the operations at runtime. <li>dynamic "14.5.3 Expression edm:Apply": <ul> <li>"14.5.3.1.1 Function odata.concat": This is turned into a data binding expression. <li>"14.5.3.1.2 Function odata.fillUriTemplate": This is turned into an expression binding to fill the template at runtime. <li>"14.5.3.1.3 Function odata.uriEncode": This is turned into an expression binding to encode the parameter at runtime. <li>Apply functions may be nested arbitrarily. </ul> <li>dynamic "14.5.6 Expression edm:If": This is turned into an expression binding to be evaluated at runtime. The expression is a conditional expression like <code>"{=condition ? expression1 : expression2}"</code>. <li>dynamic "14.5.10 Expression edm:Null": This is turned into a <code>null</code> value. It is ignored in <code>odata.concat</code>. <li>dynamic "14.5.12 Expression edm:Path" and "14.5.13 Expression edm:PropertyPath": This is turned into a simple data binding, e.g. <code>"{Name}"</code>. </ul> Unsupported or incorrect values are turned into a string nevertheless, but indicated as such. In such a case, an error describing the problem is logged to the console. Example: <pre> &lt;Text text="{meta>Value/@@sap.ui.model.odata.v4.AnnotationHelper.value}" /> </pre> @param {any} vRawValue The raw value from the meta model @param {object} oDetails The details object @param {sap.ui.model.Context} oDetails.context Points to the given raw value, that is <code>oDetails.context.getProperty("") === vRawValue</code> @returns {string} A data binding or a fixed text or a sequence thereof @public @since 1.43.0
[ "A", "function", "that", "helps", "to", "interpret", "OData", "V4", "annotations", ".", "It", "knows", "about", "the", "following", "expressions", ":", "<ul", ">", "<li", ">", "14", ".", "4", "Constant", "Expressions", "for", "edm", ":", "Bool", "edm", "...
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/AnnotationHelper.js#L582-L598
train
Returns the value of the property in the context
[ 30522, 3853, 1006, 27830, 10376, 10175, 5657, 1010, 24040, 22081, 1007, 1063, 13075, 14690, 2232, 1027, 24040, 22081, 1012, 6123, 1012, 2131, 15069, 1006, 1007, 1025, 2065, 1006, 14690, 2232, 1012, 14704, 1006, 1011, 1015, 1007, 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...
fex-team/webuploader
_draft/music/webuploader.js
function( block ) { var me = this, file = block.file, promise; me.pool.push( block ); me.remaning++; // 如果没有分片,则直接使用原始的。 // 不会丢失content-type信息。 block.blob = block.chunks === 1 ? file.source : file.source.slice( block.start, block.end ); // hook, 每个分片发送之前可能要做些异步的事情。 promise = me.request( 'before-send', block, function() { // 有可能文件已经上传出错了,所以不需要再传输了。 if ( file.getStatus() === Status.PROGRESS ) { me._doSend( block ); } else { me._popBlock( block ); Base.nextTick( me.__tick ); } }); // 如果为fail了,则跳过此分片。 promise.fail(function() { if ( file.remaning === 1 ) { me._finishFile( file ).always(function() { block.percentage = 1; me._popBlock( block ); me.owner.trigger( 'uploadComplete', file ); Base.nextTick( me.__tick ); }); } else { block.percentage = 1; me._popBlock( block ); Base.nextTick( me.__tick ); } }); }
javascript
function( block ) { var me = this, file = block.file, promise; me.pool.push( block ); me.remaning++; // 如果没有分片,则直接使用原始的。 // 不会丢失content-type信息。 block.blob = block.chunks === 1 ? file.source : file.source.slice( block.start, block.end ); // hook, 每个分片发送之前可能要做些异步的事情。 promise = me.request( 'before-send', block, function() { // 有可能文件已经上传出错了,所以不需要再传输了。 if ( file.getStatus() === Status.PROGRESS ) { me._doSend( block ); } else { me._popBlock( block ); Base.nextTick( me.__tick ); } }); // 如果为fail了,则跳过此分片。 promise.fail(function() { if ( file.remaning === 1 ) { me._finishFile( file ).always(function() { block.percentage = 1; me._popBlock( block ); me.owner.trigger( 'uploadComplete', file ); Base.nextTick( me.__tick ); }); } else { block.percentage = 1; me._popBlock( block ); Base.nextTick( me.__tick ); } }); }
[ "function", "(", "block", ")", "{", "var", "me", "=", "this", ",", "file", "=", "block", ".", "file", ",", "promise", ";", "me", ".", "pool", ".", "push", "(", "block", ")", ";", "me", ".", "remaning", "++", ";", "// 如果没有分片,则直接使用原始的。", "// 不会丢失conten...
开始上传,可以被掉过。如果promise被reject了,则表示跳过此分片。
[ "开始上传,可以被掉过。如果promise被reject了,则表示跳过此分片。" ]
7094e4476c5af3b06993d91dde2d223200b9feb7
https://github.com/fex-team/webuploader/blob/7094e4476c5af3b06993d91dde2d223200b9feb7/_draft/music/webuploader.js#L5007-L5047
train
send a file to the server
[ 30522, 3853, 1006, 3796, 1007, 1063, 13075, 2033, 1027, 2023, 1010, 5371, 1027, 3796, 1012, 5371, 1010, 4872, 1025, 2033, 1012, 4770, 1012, 5245, 1006, 3796, 1007, 1025, 2033, 1012, 2128, 20799, 3070, 1009, 1009, 1025, 1013, 1013, 100, 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...
GitbookIO/gitbook
lib/output/website/listSearchPaths.js
listSearchPaths
function listSearchPaths(output) { var book = output.getBook(); var plugins = output.getPlugins(); var searchPaths = plugins .valueSeq() .map(function(plugin) { return plugin.getPath(); }) .toList(); return searchPaths.unshift(book.getContentRoot()); }
javascript
function listSearchPaths(output) { var book = output.getBook(); var plugins = output.getPlugins(); var searchPaths = plugins .valueSeq() .map(function(plugin) { return plugin.getPath(); }) .toList(); return searchPaths.unshift(book.getContentRoot()); }
[ "function", "listSearchPaths", "(", "output", ")", "{", "var", "book", "=", "output", ".", "getBook", "(", ")", ";", "var", "plugins", "=", "output", ".", "getPlugins", "(", ")", ";", "var", "searchPaths", "=", "plugins", ".", "valueSeq", "(", ")", "."...
List search paths for templates / i18n, etc @param {Output} output @return {List<String>}
[ "List", "search", "paths", "for", "templates", "/", "i18n", "etc" ]
6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4
https://github.com/GitbookIO/gitbook/blob/6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4/lib/output/website/listSearchPaths.js#L8-L20
train
List all search paths
[ 30522, 3853, 7201, 14644, 2818, 15069, 2015, 1006, 6434, 1007, 1063, 13075, 2338, 1027, 6434, 1012, 2131, 8654, 1006, 1007, 1025, 13075, 13354, 7076, 1027, 6434, 1012, 2131, 24759, 15916, 7076, 1006, 1007, 1025, 13075, 3945, 15069, 2015, 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...
mui-org/material-ui
packages/material-ui/src/CssBaseline/CssBaseline.js
CssBaseline
function CssBaseline(props) { const { children = null } = props; useStyles(); return <React.Fragment>{children}</React.Fragment>; }
javascript
function CssBaseline(props) { const { children = null } = props; useStyles(); return <React.Fragment>{children}</React.Fragment>; }
[ "function", "CssBaseline", "(", "props", ")", "{", "const", "{", "children", "=", "null", "}", "=", "props", ";", "useStyles", "(", ")", ";", "return", "<", "React", ".", "Fragment", ">", "{", "children", "}", "<", "/", "React", ".", "Fragment", ">",...
Kickstart an elegant, consistent, and simple baseline to build upon.
[ "Kickstart", "an", "elegant", "consistent", "and", "simple", "baseline", "to", "build", "upon", "." ]
1555e52367835946382fbf2a8f681de71318915d
https://github.com/mui-org/material-ui/blob/1555e52367835946382fbf2a8f681de71318915d/packages/material-ui/src/CssBaseline/CssBaseline.js#L37-L41
train
A component that uses the CSS baseline.
[ 30522, 3853, 20116, 19022, 11022, 4179, 1006, 24387, 1007, 1063, 9530, 3367, 1063, 2336, 1027, 19701, 1065, 1027, 24387, 1025, 3594, 27983, 2015, 1006, 1007, 1025, 2709, 1026, 10509, 1012, 15778, 1028, 1063, 2336, 1065, 1026, 1013, 10509, 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/preferences/PreferencesBase.js
function () { var self = this; if (this._dirty) { self._dirty = false; return this.storage.save(this.data); } else { return (new $.Deferred()).resolve().promise(); } }
javascript
function () { var self = this; if (this._dirty) { self._dirty = false; return this.storage.save(this.data); } else { return (new $.Deferred()).resolve().promise(); } }
[ "function", "(", ")", "{", "var", "self", "=", "this", ";", "if", "(", "this", ".", "_dirty", ")", "{", "self", ".", "_dirty", "=", "false", ";", "return", "this", ".", "storage", ".", "save", "(", "this", ".", "data", ")", ";", "}", "else", "{...
Saves the prefs for this `Scope`. @return {Promise} promise resolved once the data is saved.
[ "Saves", "the", "prefs", "for", "this", "Scope", "." ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/preferences/PreferencesBase.js#L338-L346
train
Save the data to the database
[ 30522, 3853, 1006, 1007, 1063, 13075, 2969, 1027, 2023, 1025, 2065, 1006, 2023, 1012, 1035, 6530, 1007, 1063, 2969, 1012, 1035, 6530, 1027, 6270, 1025, 2709, 2023, 1012, 5527, 1012, 3828, 1006, 2023, 1012, 2951, 1007, 1025, 1065, 2842, 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...
google/material-design-lite
src/mdlComponentHandler.js
upgradeElementInternal
function upgradeElementInternal(element, optJsClass) { // Verify argument type. if (!(typeof element === 'object' && element instanceof Element)) { throw new Error('Invalid argument provided to upgrade MDL element.'); } // Allow upgrade to be canceled by canceling emitted event. var upgradingEv = createEvent_('mdl-componentupgrading', true, true); element.dispatchEvent(upgradingEv); if (upgradingEv.defaultPrevented) { return; } var upgradedList = getUpgradedListOfElement_(element); var classesToUpgrade = []; // If jsClass is not provided scan the registered components to find the // ones matching the element's CSS classList. if (!optJsClass) { var classList = element.classList; registeredComponents_.forEach(function(component) { // Match CSS & Not to be upgraded & Not upgraded. if (classList.contains(component.cssClass) && classesToUpgrade.indexOf(component) === -1 && !isElementUpgraded_(element, component.className)) { classesToUpgrade.push(component); } }); } else if (!isElementUpgraded_(element, optJsClass)) { classesToUpgrade.push(findRegisteredClass_(optJsClass)); } // Upgrade the element for each classes. for (var i = 0, n = classesToUpgrade.length, registeredClass; i < n; i++) { registeredClass = classesToUpgrade[i]; if (registeredClass) { // Mark element as upgraded. upgradedList.push(registeredClass.className); element.setAttribute('data-upgraded', upgradedList.join(',')); var instance = new registeredClass.classConstructor(element); instance[componentConfigProperty_] = registeredClass; createdComponents_.push(instance); // Call any callbacks the user has registered with this component type. for (var j = 0, m = registeredClass.callbacks.length; j < m; j++) { registeredClass.callbacks[j](element); } if (registeredClass.widget) { // Assign per element instance for control over API element[registeredClass.className] = instance; } } else { throw new Error( 'Unable to find a registered component for the given class.'); } var upgradedEv = createEvent_('mdl-componentupgraded', true, false); element.dispatchEvent(upgradedEv); } }
javascript
function upgradeElementInternal(element, optJsClass) { // Verify argument type. if (!(typeof element === 'object' && element instanceof Element)) { throw new Error('Invalid argument provided to upgrade MDL element.'); } // Allow upgrade to be canceled by canceling emitted event. var upgradingEv = createEvent_('mdl-componentupgrading', true, true); element.dispatchEvent(upgradingEv); if (upgradingEv.defaultPrevented) { return; } var upgradedList = getUpgradedListOfElement_(element); var classesToUpgrade = []; // If jsClass is not provided scan the registered components to find the // ones matching the element's CSS classList. if (!optJsClass) { var classList = element.classList; registeredComponents_.forEach(function(component) { // Match CSS & Not to be upgraded & Not upgraded. if (classList.contains(component.cssClass) && classesToUpgrade.indexOf(component) === -1 && !isElementUpgraded_(element, component.className)) { classesToUpgrade.push(component); } }); } else if (!isElementUpgraded_(element, optJsClass)) { classesToUpgrade.push(findRegisteredClass_(optJsClass)); } // Upgrade the element for each classes. for (var i = 0, n = classesToUpgrade.length, registeredClass; i < n; i++) { registeredClass = classesToUpgrade[i]; if (registeredClass) { // Mark element as upgraded. upgradedList.push(registeredClass.className); element.setAttribute('data-upgraded', upgradedList.join(',')); var instance = new registeredClass.classConstructor(element); instance[componentConfigProperty_] = registeredClass; createdComponents_.push(instance); // Call any callbacks the user has registered with this component type. for (var j = 0, m = registeredClass.callbacks.length; j < m; j++) { registeredClass.callbacks[j](element); } if (registeredClass.widget) { // Assign per element instance for control over API element[registeredClass.className] = instance; } } else { throw new Error( 'Unable to find a registered component for the given class.'); } var upgradedEv = createEvent_('mdl-componentupgraded', true, false); element.dispatchEvent(upgradedEv); } }
[ "function", "upgradeElementInternal", "(", "element", ",", "optJsClass", ")", "{", "// Verify argument type.", "if", "(", "!", "(", "typeof", "element", "===", "'object'", "&&", "element", "instanceof", "Element", ")", ")", "{", "throw", "new", "Error", "(", "...
Upgrades a specific element rather than all in the DOM. @param {!Element} element The element we wish to upgrade. @param {string=} optJsClass Optional name of the class we want to upgrade the element to.
[ "Upgrades", "a", "specific", "element", "rather", "than", "all", "in", "the", "DOM", "." ]
60f441a22ed98ed2c03f6179adf460d888bf459f
https://github.com/google/material-design-lite/blob/60f441a22ed98ed2c03f6179adf460d888bf459f/src/mdlComponentHandler.js#L203-L260
train
Upgrade an element to a new class.
[ 30522, 3853, 12200, 12260, 3672, 18447, 11795, 2389, 1006, 5783, 1010, 23569, 22578, 26266, 1007, 1063, 1013, 1013, 20410, 6685, 2828, 1012, 2065, 1006, 999, 1006, 2828, 11253, 5783, 1027, 1027, 1027, 1005, 4874, 1005, 1004, 1004, 5783, 601...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
ipfs/js-ipfs
src/core/components/resolve.js
resolve
function resolve (cid, path, callback) { let value, remainderPath doUntil( (cb) => { self.block.get(cid, (err, block) => { if (err) return cb(err) const r = self._ipld.resolvers[cid.codec] if (!r) { return cb(new Error(`No resolver found for codec "${cid.codec}"`)) } r.resolver.resolve(block.data, path, (err, result) => { if (err) return cb(err) value = result.value remainderPath = result.remainderPath cb() }) }) }, () => { if (value && value['/']) { // If we've hit a CID, replace the current CID. cid = new CID(value['/']) path = remainderPath } else if (CID.isCID(value)) { // If we've hit a CID, replace the current CID. cid = value path = remainderPath } else { // We've hit a value. Return the current CID and the remaining path. return true } // Continue resolving unless the path is empty. return !path || path === '/' }, (err) => { if (err) return callback(err) callback(null, { cid, remainderPath: path }) } ) }
javascript
function resolve (cid, path, callback) { let value, remainderPath doUntil( (cb) => { self.block.get(cid, (err, block) => { if (err) return cb(err) const r = self._ipld.resolvers[cid.codec] if (!r) { return cb(new Error(`No resolver found for codec "${cid.codec}"`)) } r.resolver.resolve(block.data, path, (err, result) => { if (err) return cb(err) value = result.value remainderPath = result.remainderPath cb() }) }) }, () => { if (value && value['/']) { // If we've hit a CID, replace the current CID. cid = new CID(value['/']) path = remainderPath } else if (CID.isCID(value)) { // If we've hit a CID, replace the current CID. cid = value path = remainderPath } else { // We've hit a value. Return the current CID and the remaining path. return true } // Continue resolving unless the path is empty. return !path || path === '/' }, (err) => { if (err) return callback(err) callback(null, { cid, remainderPath: path }) } ) }
[ "function", "resolve", "(", "cid", ",", "path", ",", "callback", ")", "{", "let", "value", ",", "remainderPath", "doUntil", "(", "(", "cb", ")", "=>", "{", "self", ".", "block", ".", "get", "(", "cid", ",", "(", "err", ",", "block", ")", "=>", "{...
Resolve the given CID + path to a CID.
[ "Resolve", "the", "given", "CID", "+", "path", "to", "a", "CID", "." ]
97e67601094acda3906549ecb0248fd09f1a8cc3
https://github.com/ipfs/js-ipfs/blob/97e67601094acda3906549ecb0248fd09f1a8cc3/src/core/components/resolve.js#L45-L88
train
Resolves the given CID and path.
[ 30522, 3853, 10663, 1006, 28744, 1010, 4130, 1010, 2655, 5963, 1007, 1063, 2292, 3643, 1010, 6893, 15069, 2079, 16671, 4014, 1006, 1006, 17324, 1007, 1027, 1028, 1063, 2969, 1012, 3796, 1012, 2131, 1006, 28744, 1010, 1006, 9413, 2099, 1010,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/core/Configuration.js
function (mUnitMappings) { // add custom units, or remove the existing ones if none are given var mExistingUnits = this.getUnitMappings(); if (mExistingUnits){ mUnitMappings = jQuery.extend({}, mExistingUnits, mUnitMappings); } this.setUnitMappings(mUnitMappings); return this; }
javascript
function (mUnitMappings) { // add custom units, or remove the existing ones if none are given var mExistingUnits = this.getUnitMappings(); if (mExistingUnits){ mUnitMappings = jQuery.extend({}, mExistingUnits, mUnitMappings); } this.setUnitMappings(mUnitMappings); return this; }
[ "function", "(", "mUnitMappings", ")", "{", "// add custom units, or remove the existing ones if none are given", "var", "mExistingUnits", "=", "this", ".", "getUnitMappings", "(", ")", ";", "if", "(", "mExistingUnits", ")", "{", "mUnitMappings", "=", "jQuery", ".", "...
Adds unit mappings. Similar to {@link sap.ui.core.Configuration#setUnitMappings} but instead of setting the unit mappings, it will add additional ones. @param mUnitMappings {object} unit mappings @return {sap.ui.core.Configuration.FormatSettings} @see sap.ui.core.Configuration#setUnitMappings
[ "Adds", "unit", "mappings", ".", "Similar", "to", "{" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Configuration.js#L1798-L1806
train
Adds custom units to the unit list
[ 30522, 3853, 1006, 14163, 3490, 29418, 14853, 2015, 1007, 1063, 1013, 1013, 5587, 7661, 3197, 1010, 2030, 6366, 1996, 4493, 3924, 2065, 3904, 2024, 2445, 13075, 2033, 9048, 16643, 3070, 19496, 3215, 1027, 2023, 1012, 2131, 19496, 29418, 148...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/jquery.sap.history.js
getNextSuffix
function getNextSuffix(sHash){ var sPath = sHash ? sHash : ""; if (isVirtualHash(sPath)) { var iIndex = sPath.lastIndexOf(skipSuffix); sPath = sPath.slice(0, iIndex); } return sPath + skipSuffix + skipIndex++; }
javascript
function getNextSuffix(sHash){ var sPath = sHash ? sHash : ""; if (isVirtualHash(sPath)) { var iIndex = sPath.lastIndexOf(skipSuffix); sPath = sPath.slice(0, iIndex); } return sPath + skipSuffix + skipIndex++; }
[ "function", "getNextSuffix", "(", "sHash", ")", "{", "var", "sPath", "=", "sHash", "?", "sHash", ":", "\"\"", ";", "if", "(", "isVirtualHash", "(", "sPath", ")", ")", "{", "var", "iIndex", "=", "sPath", ".", "lastIndexOf", "(", "skipSuffix", ")", ";", ...
This function returns a hash with suffix added to the end based on the sHash parameter. It handles as well when the current hash is already with suffix. It returns a new suffix with a unique number in the end. @private
[ "This", "function", "returns", "a", "hash", "with", "suffix", "added", "to", "the", "end", "based", "on", "the", "sHash", "parameter", ".", "It", "handles", "as", "well", "when", "the", "current", "hash", "is", "already", "with", "suffix", ".", "It", "re...
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/jquery.sap.history.js#L478-L487
train
Returns the next suffix for the given hash
[ 30522, 3853, 2131, 2638, 18413, 6342, 26989, 2595, 1006, 21146, 4095, 1007, 1063, 13075, 14690, 2232, 1027, 21146, 4095, 1029, 21146, 4095, 1024, 1000, 1000, 1025, 2065, 1006, 2003, 21663, 26302, 2140, 14949, 2232, 1006, 14690, 2232, 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...
grpc/grpc-node
packages/grpc-native-core/src/client_interceptors.js
function(providers, method_definition) { if (!Array.isArray(providers)) { return null; } var interceptors = []; for (var i = 0; i < providers.length; i++) { var provider = providers[i]; var interceptor = provider(method_definition); if (interceptor) { interceptors.push(interceptor); } } return interceptors; }
javascript
function(providers, method_definition) { if (!Array.isArray(providers)) { return null; } var interceptors = []; for (var i = 0; i < providers.length; i++) { var provider = providers[i]; var interceptor = provider(method_definition); if (interceptor) { interceptors.push(interceptor); } } return interceptors; }
[ "function", "(", "providers", ",", "method_definition", ")", "{", "if", "(", "!", "Array", ".", "isArray", "(", "providers", ")", ")", "{", "return", "null", ";", "}", "var", "interceptors", "=", "[", "]", ";", "for", "(", "var", "i", "=", "0", ";"...
Transforms a list of interceptor providers into interceptors. @param {InterceptorProvider[]} providers @param {grpc~MethodDefinition} method_definition @return {null|Interceptor[]}
[ "Transforms", "a", "list", "of", "interceptor", "providers", "into", "interceptors", "." ]
b36b285f4cdb334bbd48f74c12c13bec69961488
https://github.com/grpc/grpc-node/blob/b36b285f4cdb334bbd48f74c12c13bec69961488/packages/grpc-native-core/src/client_interceptors.js#L354-L367
train
Returns an array of interceptor functions
[ 30522, 3853, 1006, 11670, 1010, 4118, 1035, 6210, 1007, 1063, 2065, 1006, 999, 9140, 1012, 18061, 11335, 2100, 1006, 11670, 1007, 30524, 11670, 1012, 3091, 1025, 1045, 1009, 1009, 1007, 1063, 13075, 10802, 1027, 11670, 1031, 1045, 1033, 102...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/model/odata/v4/ODataMetaModel.js
maybeParameter
function maybeParameter(sName, aOverloads) { return aOverloads.some(function (oOverload) { return oOverload.$Parameter && oOverload.$Parameter.some(function (oParameter) { return oParameter.$Name === sName; }); }); }
javascript
function maybeParameter(sName, aOverloads) { return aOverloads.some(function (oOverload) { return oOverload.$Parameter && oOverload.$Parameter.some(function (oParameter) { return oParameter.$Name === sName; }); }); }
[ "function", "maybeParameter", "(", "sName", ",", "aOverloads", ")", "{", "return", "aOverloads", ".", "some", "(", "function", "(", "oOverload", ")", "{", "return", "oOverload", ".", "$Parameter", "&&", "oOverload", ".", "$Parameter", ".", "some", "(", "func...
Tells whether the given name matches a parameter of at least one of the given overloads. @param {string} sName A path segment which maybe is a parameter name @param {object[]} aOverloads Operation overload(s) @returns {boolean} <code>true</code> iff at least one of the given overloads has a parameter with the given name.
[ "Tells", "whether", "the", "given", "name", "matches", "a", "parameter", "of", "at", "least", "one", "of", "the", "given", "overloads", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/ODataMetaModel.js#L256-L262
train
Checks if a parameter is present in an overloads array
[ 30522, 3853, 2672, 28689, 22828, 1006, 1055, 18442, 1010, 20118, 6299, 11066, 2015, 1007, 1063, 2709, 20118, 6299, 11066, 2015, 1012, 2070, 1006, 3853, 1006, 1051, 7840, 11066, 1007, 1063, 2709, 1051, 7840, 11066, 1012, 1002, 16381, 1004, 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/gesture/gesture.js
runHandlers
function runHandlers(handlerEvent, event) { var handler; for (var name in HANDLERS) { handler = HANDLERS[name]; if (handler instanceof $$MdGestureHandler) { if (handlerEvent === 'start') { // Run cancel to reset any handlers' state handler.cancel(); } handler[handlerEvent](event, pointer); } } }
javascript
function runHandlers(handlerEvent, event) { var handler; for (var name in HANDLERS) { handler = HANDLERS[name]; if (handler instanceof $$MdGestureHandler) { if (handlerEvent === 'start') { // Run cancel to reset any handlers' state handler.cancel(); } handler[handlerEvent](event, pointer); } } }
[ "function", "runHandlers", "(", "handlerEvent", ",", "event", ")", "{", "var", "handler", ";", "for", "(", "var", "name", "in", "HANDLERS", ")", "{", "handler", "=", "HANDLERS", "[", "name", "]", ";", "if", "(", "handler", "instanceof", "$$MdGestureHandler...
/* When a DOM event happens, run all registered gesture handlers' lifecycle methods which match the DOM event. Eg when a 'touchstart' event happens, runHandlers('start') will call and run `handler.cancel()` and `handler.start()` on all registered handlers.
[ "/", "*", "When", "a", "DOM", "event", "happens", "run", "all", "registered", "gesture", "handlers", "lifecycle", "methods", "which", "match", "the", "DOM", "event", ".", "Eg", "when", "a", "touchstart", "event", "happens", "runHandlers", "(", "start", ")", ...
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/services/gesture/gesture.js#L630-L644
train
Run all handlers
[ 30522, 3853, 2448, 11774, 12910, 1006, 28213, 18697, 3372, 1010, 2724, 1007, 1063, 13075, 28213, 1025, 2005, 1006, 13075, 2171, 1999, 28213, 2015, 1007, 1063, 28213, 1027, 28213, 2015, 1031, 2171, 1033, 1025, 2065, 1006, 28213, 6013, 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...
sass/node-sass
lib/index.js
tryCallback
function tryCallback(callback, args) { try { return callback.apply(this, args); } catch (e) { if (typeof e === 'string') { return new binding.types.Error(e); } else if (e instanceof Error) { return new binding.types.Error(e.message); } else { return new binding.types.Error('An unexpected error occurred'); } } }
javascript
function tryCallback(callback, args) { try { return callback.apply(this, args); } catch (e) { if (typeof e === 'string') { return new binding.types.Error(e); } else if (e instanceof Error) { return new binding.types.Error(e.message); } else { return new binding.types.Error('An unexpected error occurred'); } } }
[ "function", "tryCallback", "(", "callback", ",", "args", ")", "{", "try", "{", "return", "callback", ".", "apply", "(", "this", ",", "args", ")", ";", "}", "catch", "(", "e", ")", "{", "if", "(", "typeof", "e", "===", "'string'", ")", "{", "return"...
Executes a callback and transforms any exception raised into a sass error @param {Function} callback @param {Array} arguments @api private
[ "Executes", "a", "callback", "and", "transforms", "any", "exception", "raised", "into", "a", "sass", "error" ]
0c1a49eefa37544d16041c5fe5b2e3d9168004b7
https://github.com/sass/node-sass/blob/0c1a49eefa37544d16041c5fe5b2e3d9168004b7/lib/index.js#L226-L238
train
Try a callback
[ 30522, 3853, 3046, 9289, 20850, 8684, 1006, 2655, 5963, 1010, 12098, 5620, 1007, 1063, 3046, 1063, 2709, 2655, 5963, 1012, 6611, 1006, 2023, 1010, 12098, 5620, 1007, 1025, 1065, 4608, 1006, 1041, 1007, 1063, 2065, 1006, 2828, 11253, 1041, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/chips/js/chipRemoveDirective.js
MdChipRemove
function MdChipRemove ($timeout) { return { restrict: 'A', require: '^mdChips', scope: false, link: postLink }; function postLink(scope, element, attr, ctrl) { element.on('click', function(event) { scope.$apply(function() { ctrl.removeChip(scope.$$replacedScope.$index); }); }); // Child elements aren't available until after a $timeout tick as they are hidden by an // `ng-if`. see http://goo.gl/zIWfuw $timeout(function() { element.attr({ 'tabindex': '-1', 'aria-hidden': 'true' }); element.find('button').attr('tabindex', '-1'); }); } }
javascript
function MdChipRemove ($timeout) { return { restrict: 'A', require: '^mdChips', scope: false, link: postLink }; function postLink(scope, element, attr, ctrl) { element.on('click', function(event) { scope.$apply(function() { ctrl.removeChip(scope.$$replacedScope.$index); }); }); // Child elements aren't available until after a $timeout tick as they are hidden by an // `ng-if`. see http://goo.gl/zIWfuw $timeout(function() { element.attr({ 'tabindex': '-1', 'aria-hidden': 'true' }); element.find('button').attr('tabindex', '-1'); }); } }
[ "function", "MdChipRemove", "(", "$timeout", ")", "{", "return", "{", "restrict", ":", "'A'", ",", "require", ":", "'^mdChips'", ",", "scope", ":", "false", ",", "link", ":", "postLink", "}", ";", "function", "postLink", "(", "scope", ",", "element", ","...
@ngdoc directive @name mdChipRemove @restrict A @module material.components.chips @description Indicates that the associated element should be used as the delete button template for all chips. The associated element must be a child of `md-chips`. The provided button template will be appended to each chip and will remove the associated chip on click. The button is not styled or themed based on the theme set on the `md-chips` component. A theme class and custom icon can be specified in your template. You can also specify the `type` of the button in your template. @usage ### With Standard Chips <hljs lang="html"> <md-chips ...> <button md-chip-remove class="md-primary" type="button" aria-label="Remove {{$chip}}"> <md-icon md-svg-icon="md-close"></md-icon> </button> </md-chips> </hljs> ### With Object Chips <hljs lang="html"> <md-chips ...> <button md-chip-remove class="md-primary" type="button" aria-label="Remove {{$chip.name}}"> <md-icon md-svg-icon="md-close"></md-icon> </button> </md-chips> </hljs> MdChipRemove Directive Definition. @param $timeout @returns {{restrict: string, require: string[], link: Function, scope: boolean}} @constructor
[ "@ngdoc", "directive", "@name", "mdChipRemove", "@restrict", "A", "@module", "material", ".", "components", ".", "chips" ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/chips/js/chipRemoveDirective.js#L51-L73
train
A directive to remove a Chip
[ 30522, 3853, 9108, 5428, 28139, 5302, 3726, 1006, 1002, 2051, 5833, 1007, 1063, 2709, 1063, 21573, 1024, 1005, 1037, 1005, 1010, 5478, 1024, 1005, 1034, 9108, 5428, 4523, 1005, 1010, 9531, 1024, 6270, 1010, 4957, 1024, 2695, 13767, 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...
adobe/brackets
src/utils/ExtensionUtils.js
loadFile
function loadFile(module, path) { var url = PathUtils.isAbsoluteUrl(path) ? path : getModuleUrl(module, path), promise = $.get(url); return promise; }
javascript
function loadFile(module, path) { var url = PathUtils.isAbsoluteUrl(path) ? path : getModuleUrl(module, path), promise = $.get(url); return promise; }
[ "function", "loadFile", "(", "module", ",", "path", ")", "{", "var", "url", "=", "PathUtils", ".", "isAbsoluteUrl", "(", "path", ")", "?", "path", ":", "getModuleUrl", "(", "module", ",", "path", ")", ",", "promise", "=", "$", ".", "get", "(", "url",...
Performs a GET request using a path relative to an extension module. The resulting URL can be retrieved in the resolve callback by accessing @param {!module} module Module provided by RequireJS @param {!string} path Relative path from the extension folder to a file @return {!$.Promise} A promise object that is resolved with the contents of the requested file
[ "Performs", "a", "GET", "request", "using", "a", "path", "relative", "to", "an", "extension", "module", "." ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/utils/ExtensionUtils.js#L176-L181
train
Load a file from the cache
[ 30522, 3853, 7170, 8873, 2571, 1006, 11336, 1010, 4130, 1007, 1063, 13075, 24471, 2140, 1027, 4130, 21823, 4877, 1012, 18061, 5910, 4747, 10421, 3126, 2140, 1006, 4130, 1007, 1029, 4130, 1024, 2131, 5302, 8566, 2571, 3126, 2140, 1006, 11336...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
grpc/grpc
examples/node/static_codegen/route_guide/route_guide_server.js
routeChat
function routeChat(call) { call.on('data', function(note) { var key = pointKey(note.getLocation()); /* For each note sent, respond with all previous notes that correspond to * the same point */ if (route_notes.hasOwnProperty(key)) { _.each(route_notes[key], function(note) { call.write(note); }); } else { route_notes[key] = []; } // Then add the new note to the list route_notes[key].push(note); }); call.on('end', function() { call.end(); }); }
javascript
function routeChat(call) { call.on('data', function(note) { var key = pointKey(note.getLocation()); /* For each note sent, respond with all previous notes that correspond to * the same point */ if (route_notes.hasOwnProperty(key)) { _.each(route_notes[key], function(note) { call.write(note); }); } else { route_notes[key] = []; } // Then add the new note to the list route_notes[key].push(note); }); call.on('end', function() { call.end(); }); }
[ "function", "routeChat", "(", "call", ")", "{", "call", ".", "on", "(", "'data'", ",", "function", "(", "note", ")", "{", "var", "key", "=", "pointKey", "(", "note", ".", "getLocation", "(", ")", ")", ";", "/* For each note sent, respond with all previous no...
routeChat handler. Receives a stream of message/location pairs, and responds with a stream of all previous messages at each of those locations. @param {Duplex} call The stream for incoming and outgoing messages
[ "routeChat", "handler", ".", "Receives", "a", "stream", "of", "message", "/", "location", "pairs", "and", "responds", "with", "a", "stream", "of", "all", "previous", "messages", "at", "each", "of", "those", "locations", "." ]
cc75d93818410e2b0edd0fa3009a6def9ac403ca
https://github.com/grpc/grpc/blob/cc75d93818410e2b0edd0fa3009a6def9ac403ca/examples/node/static_codegen/route_guide/route_guide_server.js#L184-L202
train
routeChat - Sends all notes sent to the specified call
[ 30522, 3853, 2799, 7507, 2102, 1006, 2655, 1007, 1063, 2655, 1012, 2006, 1006, 1005, 2951, 1005, 1010, 3853, 1006, 3602, 1007, 1063, 13075, 3145, 1027, 2391, 14839, 1006, 3602, 1012, 2131, 4135, 10719, 1006, 1007, 1007, 1025, 1013, 1008, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
typeorm/typeorm
extra/typeorm-class-transformer-shim.js
OneToMany
function OneToMany(typeFunction, inverseSideOrOptions, options) { return function (object, propertyName) { class_transformer_1.Type(typeFunction)(object, propertyName); }; }
javascript
function OneToMany(typeFunction, inverseSideOrOptions, options) { return function (object, propertyName) { class_transformer_1.Type(typeFunction)(object, propertyName); }; }
[ "function", "OneToMany", "(", "typeFunction", ",", "inverseSideOrOptions", ",", "options", ")", "{", "return", "function", "(", "object", ",", "propertyName", ")", "{", "class_transformer_1", ".", "Type", "(", "typeFunction", ")", "(", "object", ",", "propertyNa...
/* export
[ "/", "*", "export" ]
360468b7913db8d988346fba1ee2d3f323498eef
https://github.com/typeorm/typeorm/blob/360468b7913db8d988346fba1ee2d3f323498eef/extra/typeorm-class-transformer-shim.js#L154-L158
train
OneToMany is a helper function for creating a new one - to - many relation.
[ 30522, 3853, 2028, 20389, 19092, 1006, 2828, 11263, 27989, 1010, 19262, 7363, 14604, 16790, 2015, 1010, 7047, 1007, 1063, 2709, 3853, 1006, 4874, 1010, 3200, 18442, 1007, 1063, 2465, 1035, 10938, 2121, 1035, 1015, 1012, 2828, 1006, 2828, 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...
caolan/async
lib/detect.js
detect
function detect(coll, iteratee, callback) { return createTester(bool => bool, (res, item) => item)(eachOf, coll, iteratee, callback) }
javascript
function detect(coll, iteratee, callback) { return createTester(bool => bool, (res, item) => item)(eachOf, coll, iteratee, callback) }
[ "function", "detect", "(", "coll", ",", "iteratee", ",", "callback", ")", "{", "return", "createTester", "(", "bool", "=>", "bool", ",", "(", "res", ",", "item", ")", "=>", "item", ")", "(", "eachOf", ",", "coll", ",", "iteratee", ",", "callback", ")...
Returns the first value in `coll` that passes an async truth test. The `iteratee` is applied in parallel, meaning the first iteratee to return `true` will fire the detect `callback` with that result. That means the result might not be the first item in the original `coll` (in terms of order) that passes the test. If order within the original `coll` is important, then look at [`detectSeries`]{@link module:Collections.detectSeries}. @name detect @static @memberOf module:Collections @method @alias find @category Collections @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. @param {AsyncFunction} iteratee - A truth test to apply to each item in `coll`. The iteratee must complete with a boolean value as its result. Invoked with (item, callback). @param {Function} [callback] - A callback which is called as soon as any iteratee returns `true`, or after all the `iteratee` functions have finished. Result will be the first item in the array that passes the truth test (iteratee) or the value `undefined` if none passed. Invoked with (err, result). @returns A Promise, if no callback is passed @example async.detect(['file1','file2','file3'], function(filePath, callback) { fs.access(filePath, function(err) { callback(null, !err) }); }, function(err, result) { // result now equals the first file in the list that exists });
[ "Returns", "the", "first", "value", "in", "coll", "that", "passes", "an", "async", "truth", "test", ".", "The", "iteratee", "is", "applied", "in", "parallel", "meaning", "the", "first", "iteratee", "to", "return", "true", "will", "fire", "the", "detect", "...
4330d536c106592139fa82062494c9dba0da1fdb
https://github.com/caolan/async/blob/4330d536c106592139fa82062494c9dba0da1fdb/lib/detect.js#L41-L43
train
Detects if a collection contains items.
[ 30522, 3853, 11487, 1006, 8902, 2140, 1010, 2009, 22139, 2063, 1010, 2655, 5963, 1007, 1063, 2709, 3443, 22199, 2121, 1006, 22017, 2140, 1027, 1028, 22017, 2140, 1010, 1006, 24501, 1010, 8875, 1007, 1027, 1028, 8875, 1007, 1006, 2169, 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...
eslint/eslint
lib/rules/no-extra-boolean-cast.js
isInBooleanContext
function isInBooleanContext(node, parent) { return ( (BOOLEAN_NODE_TYPES.indexOf(parent.type) !== -1 && node === parent.test) || // !<bool> (parent.type === "UnaryExpression" && parent.operator === "!") ); }
javascript
function isInBooleanContext(node, parent) { return ( (BOOLEAN_NODE_TYPES.indexOf(parent.type) !== -1 && node === parent.test) || // !<bool> (parent.type === "UnaryExpression" && parent.operator === "!") ); }
[ "function", "isInBooleanContext", "(", "node", ",", "parent", ")", "{", "return", "(", "(", "BOOLEAN_NODE_TYPES", ".", "indexOf", "(", "parent", ".", "type", ")", "!==", "-", "1", "&&", "node", "===", "parent", ".", "test", ")", "||", "// !<bool>", "(", ...
Check if a node is in a context where its value would be coerced to a boolean at runtime. @param {Object} node The node @param {Object} parent Its parent @returns {boolean} If it is in a boolean context
[ "Check", "if", "a", "node", "is", "in", "a", "context", "where", "its", "value", "would", "be", "coerced", "to", "a", "boolean", "at", "runtime", "." ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/no-extra-boolean-cast.js#L57-L66
train
Check if the node is in boolean context
[ 30522, 3853, 2003, 2378, 5092, 9890, 2319, 8663, 18209, 1006, 13045, 1010, 6687, 1007, 1063, 2709, 1006, 1006, 22017, 20898, 1035, 13045, 1035, 4127, 1012, 5950, 11253, 1006, 6687, 1012, 2828, 1007, 999, 1027, 1027, 1011, 1015, 1004, 1004, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SheetJS/js-xlsx
xlsx.js
parse_fonts
function parse_fonts(t, styles, themes, opts) { styles.Fonts = []; var font = {}; var pass = false; t[0].match(tagregex).forEach(function(x) { var y = parsexmltag(x); switch(strip_ns(y[0])) { case '<fonts': case '<fonts>': case '</fonts>': break; /* 18.8.22 font CT_Font */ case '<font': case '<font>': break; case '</font>': case '<font/>': styles.Fonts.push(font); font = {}; break; /* 18.8.29 name CT_FontName */ case '<name': if(y.val) font.name = y.val; break; case '<name/>': case '</name>': break; /* 18.8.2 b CT_BooleanProperty */ case '<b': font.bold = y.val ? parsexmlbool(y.val) : 1; break; case '<b/>': font.bold = 1; break; /* 18.8.26 i CT_BooleanProperty */ case '<i': font.italic = y.val ? parsexmlbool(y.val) : 1; break; case '<i/>': font.italic = 1; break; /* 18.4.13 u CT_UnderlineProperty */ case '<u': switch(y.val) { case "none": font.underline = 0x00; break; case "single": font.underline = 0x01; break; case "double": font.underline = 0x02; break; case "singleAccounting": font.underline = 0x21; break; case "doubleAccounting": font.underline = 0x22; break; } break; case '<u/>': font.underline = 1; break; /* 18.4.10 strike CT_BooleanProperty */ case '<strike': font.strike = y.val ? parsexmlbool(y.val) : 1; break; case '<strike/>': font.strike = 1; break; /* 18.4.2 outline CT_BooleanProperty */ case '<outline': font.outline = y.val ? parsexmlbool(y.val) : 1; break; case '<outline/>': font.outline = 1; break; /* 18.8.36 shadow CT_BooleanProperty */ case '<shadow': font.shadow = y.val ? parsexmlbool(y.val) : 1; break; case '<shadow/>': font.shadow = 1; break; /* 18.8.12 condense CT_BooleanProperty */ case '<condense': font.condense = y.val ? parsexmlbool(y.val) : 1; break; case '<condense/>': font.condense = 1; break; /* 18.8.17 extend CT_BooleanProperty */ case '<extend': font.extend = y.val ? parsexmlbool(y.val) : 1; break; case '<extend/>': font.extend = 1; break; /* 18.4.11 sz CT_FontSize */ case '<sz': if(y.val) font.sz = +y.val; break; case '<sz/>': case '</sz>': break; /* 18.4.14 vertAlign CT_VerticalAlignFontProperty */ case '<vertAlign': if(y.val) font.vertAlign = y.val; break; case '<vertAlign/>': case '</vertAlign>': break; /* 18.8.18 family CT_FontFamily */ case '<family': if(y.val) font.family = parseInt(y.val,10); break; case '<family/>': case '</family>': break; /* 18.8.35 scheme CT_FontScheme */ case '<scheme': if(y.val) font.scheme = y.val; break; case '<scheme/>': case '</scheme>': break; /* 18.4.1 charset CT_IntProperty */ case '<charset': if(y.val == '1') break; y.codepage = CS2CP[parseInt(y.val, 10)]; break; /* 18.?.? color CT_Color */ case '<color': if(!font.color) font.color = {}; if(y.auto) font.color.auto = parsexmlbool(y.auto); if(y.rgb) font.color.rgb = y.rgb.slice(-6); else if(y.indexed) { font.color.index = parseInt(y.indexed, 10); var icv = XLSIcv[font.color.index]; if(font.color.index == 81) icv = XLSIcv[1]; if(!icv) throw new Error(x); font.color.rgb = icv[0].toString(16) + icv[1].toString(16) + icv[2].toString(16); } else if(y.theme) { font.color.theme = parseInt(y.theme, 10); if(y.tint) font.color.tint = parseFloat(y.tint); if(y.theme && themes.themeElements && themes.themeElements.clrScheme) { font.color.rgb = rgb_tint(themes.themeElements.clrScheme[font.color.theme].rgb, font.color.tint || 0); } } break; case '<color/>': case '</color>': break; /* 18.2.10 extLst CT_ExtensionList ? */ case '<extLst': case '<extLst>': case '</extLst>': break; case '<ext': pass = true; break; case '</ext>': pass = false; break; default: if(opts && opts.WTF) { if(!pass) throw new Error('unrecognized ' + y[0] + ' in fonts'); } } }); }
javascript
function parse_fonts(t, styles, themes, opts) { styles.Fonts = []; var font = {}; var pass = false; t[0].match(tagregex).forEach(function(x) { var y = parsexmltag(x); switch(strip_ns(y[0])) { case '<fonts': case '<fonts>': case '</fonts>': break; /* 18.8.22 font CT_Font */ case '<font': case '<font>': break; case '</font>': case '<font/>': styles.Fonts.push(font); font = {}; break; /* 18.8.29 name CT_FontName */ case '<name': if(y.val) font.name = y.val; break; case '<name/>': case '</name>': break; /* 18.8.2 b CT_BooleanProperty */ case '<b': font.bold = y.val ? parsexmlbool(y.val) : 1; break; case '<b/>': font.bold = 1; break; /* 18.8.26 i CT_BooleanProperty */ case '<i': font.italic = y.val ? parsexmlbool(y.val) : 1; break; case '<i/>': font.italic = 1; break; /* 18.4.13 u CT_UnderlineProperty */ case '<u': switch(y.val) { case "none": font.underline = 0x00; break; case "single": font.underline = 0x01; break; case "double": font.underline = 0x02; break; case "singleAccounting": font.underline = 0x21; break; case "doubleAccounting": font.underline = 0x22; break; } break; case '<u/>': font.underline = 1; break; /* 18.4.10 strike CT_BooleanProperty */ case '<strike': font.strike = y.val ? parsexmlbool(y.val) : 1; break; case '<strike/>': font.strike = 1; break; /* 18.4.2 outline CT_BooleanProperty */ case '<outline': font.outline = y.val ? parsexmlbool(y.val) : 1; break; case '<outline/>': font.outline = 1; break; /* 18.8.36 shadow CT_BooleanProperty */ case '<shadow': font.shadow = y.val ? parsexmlbool(y.val) : 1; break; case '<shadow/>': font.shadow = 1; break; /* 18.8.12 condense CT_BooleanProperty */ case '<condense': font.condense = y.val ? parsexmlbool(y.val) : 1; break; case '<condense/>': font.condense = 1; break; /* 18.8.17 extend CT_BooleanProperty */ case '<extend': font.extend = y.val ? parsexmlbool(y.val) : 1; break; case '<extend/>': font.extend = 1; break; /* 18.4.11 sz CT_FontSize */ case '<sz': if(y.val) font.sz = +y.val; break; case '<sz/>': case '</sz>': break; /* 18.4.14 vertAlign CT_VerticalAlignFontProperty */ case '<vertAlign': if(y.val) font.vertAlign = y.val; break; case '<vertAlign/>': case '</vertAlign>': break; /* 18.8.18 family CT_FontFamily */ case '<family': if(y.val) font.family = parseInt(y.val,10); break; case '<family/>': case '</family>': break; /* 18.8.35 scheme CT_FontScheme */ case '<scheme': if(y.val) font.scheme = y.val; break; case '<scheme/>': case '</scheme>': break; /* 18.4.1 charset CT_IntProperty */ case '<charset': if(y.val == '1') break; y.codepage = CS2CP[parseInt(y.val, 10)]; break; /* 18.?.? color CT_Color */ case '<color': if(!font.color) font.color = {}; if(y.auto) font.color.auto = parsexmlbool(y.auto); if(y.rgb) font.color.rgb = y.rgb.slice(-6); else if(y.indexed) { font.color.index = parseInt(y.indexed, 10); var icv = XLSIcv[font.color.index]; if(font.color.index == 81) icv = XLSIcv[1]; if(!icv) throw new Error(x); font.color.rgb = icv[0].toString(16) + icv[1].toString(16) + icv[2].toString(16); } else if(y.theme) { font.color.theme = parseInt(y.theme, 10); if(y.tint) font.color.tint = parseFloat(y.tint); if(y.theme && themes.themeElements && themes.themeElements.clrScheme) { font.color.rgb = rgb_tint(themes.themeElements.clrScheme[font.color.theme].rgb, font.color.tint || 0); } } break; case '<color/>': case '</color>': break; /* 18.2.10 extLst CT_ExtensionList ? */ case '<extLst': case '<extLst>': case '</extLst>': break; case '<ext': pass = true; break; case '</ext>': pass = false; break; default: if(opts && opts.WTF) { if(!pass) throw new Error('unrecognized ' + y[0] + ' in fonts'); } } }); }
[ "function", "parse_fonts", "(", "t", ",", "styles", ",", "themes", ",", "opts", ")", "{", "styles", ".", "Fonts", "=", "[", "]", ";", "var", "font", "=", "{", "}", ";", "var", "pass", "=", "false", ";", "t", "[", "0", "]", ".", "match", "(", ...
/* 18.8.23 fonts CT_Fonts
[ "/", "*", "18", ".", "8", ".", "23", "fonts", "CT_Fonts" ]
9a6d8a1d3d80c78dad5201fb389316f935279cdc
https://github.com/SheetJS/js-xlsx/blob/9a6d8a1d3d80c78dad5201fb389316f935279cdc/xlsx.js#L8740-L8853
train
Parse the XML fonts
[ 30522, 3853, 11968, 3366, 1035, 15489, 2015, 1006, 1056, 1010, 6782, 1010, 6991, 1010, 23569, 2015, 1007, 1063, 6782, 1012, 15489, 2015, 1027, 1031, 1033, 1025, 13075, 15489, 1027, 1063, 1065, 1025, 13075, 3413, 1027, 6270, 1025, 1056, 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...
goldfire/howler.js
dist/howler.js
function(event, id, msg) { var self = this; var events = self['_on' + event]; // Loop through event store and fire all functions. for (var i=events.length-1; i>=0; i--) { // Only fire the listener if the correct ID is used. if (!events[i].id || events[i].id === id || event === 'load') { setTimeout(function(fn) { fn.call(this, id, msg); }.bind(self, events[i].fn), 0); // If this event was setup with `once`, remove it. if (events[i].once) { self.off(event, events[i].fn, events[i].id); } } } // Pass the event type into load queue so that it can continue stepping. self._loadQueue(event); return self; }
javascript
function(event, id, msg) { var self = this; var events = self['_on' + event]; // Loop through event store and fire all functions. for (var i=events.length-1; i>=0; i--) { // Only fire the listener if the correct ID is used. if (!events[i].id || events[i].id === id || event === 'load') { setTimeout(function(fn) { fn.call(this, id, msg); }.bind(self, events[i].fn), 0); // If this event was setup with `once`, remove it. if (events[i].once) { self.off(event, events[i].fn, events[i].id); } } } // Pass the event type into load queue so that it can continue stepping. self._loadQueue(event); return self; }
[ "function", "(", "event", ",", "id", ",", "msg", ")", "{", "var", "self", "=", "this", ";", "var", "events", "=", "self", "[", "'_on'", "+", "event", "]", ";", "// Loop through event store and fire all functions.", "for", "(", "var", "i", "=", "events", ...
Emit all events of a specific type and pass the sound id. @param {String} event Event name. @param {Number} id Sound ID. @param {Number} msg Message to go with event. @return {Howl}
[ "Emit", "all", "events", "of", "a", "specific", "type", "and", "pass", "the", "sound", "id", "." ]
030db918dd8ce640afd57e172418472497e8f113
https://github.com/goldfire/howler.js/blob/030db918dd8ce640afd57e172418472497e8f113/dist/howler.js#L1848-L1871
train
Fires all functions for a specific event
[ 30522, 3853, 1006, 2724, 1010, 8909, 1010, 5796, 2290, 1007, 1063, 13075, 2969, 1027, 2023, 1025, 13075, 2824, 1027, 2969, 1031, 1005, 1035, 2006, 1005, 1009, 2724, 1033, 1025, 1013, 1013, 7077, 2083, 2724, 3573, 1998, 2543, 2035, 4972, 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/angular
tools/gulp-tasks/cldr/extract.js
generateLocaleExtra
function generateLocaleExtra(locale, localeData) { const dayPeriods = getDayPeriodsNoAmPm(localeData); const dayPeriodRules = getDayPeriodRules(localeData); let dayPeriodsSupplemental = []; if (Object.keys(dayPeriods.format.narrow).length) { const keys = Object.keys(dayPeriods.format.narrow); if (keys.length !== Object.keys(dayPeriodRules).length) { throw new Error(`Error: locale ${locale} has not the correct number of day period rules`); } const dayPeriodsFormat = removeDuplicates([ objectValues(dayPeriods.format.narrow), objectValues(dayPeriods.format.abbreviated), objectValues(dayPeriods.format.wide) ]); const dayPeriodsStandalone = removeDuplicates([ objectValues(dayPeriods['stand-alone'].narrow), objectValues(dayPeriods['stand-alone'].abbreviated), objectValues(dayPeriods['stand-alone'].wide) ]); const rules = keys.map(key => dayPeriodRules[key]); dayPeriodsSupplemental = [...removeDuplicates([dayPeriodsFormat, dayPeriodsStandalone]), rules]; } return `${HEADER} const u = undefined; export default ${stringify(dayPeriodsSupplemental).replace(/undefined/g, 'u')}; `; }
javascript
function generateLocaleExtra(locale, localeData) { const dayPeriods = getDayPeriodsNoAmPm(localeData); const dayPeriodRules = getDayPeriodRules(localeData); let dayPeriodsSupplemental = []; if (Object.keys(dayPeriods.format.narrow).length) { const keys = Object.keys(dayPeriods.format.narrow); if (keys.length !== Object.keys(dayPeriodRules).length) { throw new Error(`Error: locale ${locale} has not the correct number of day period rules`); } const dayPeriodsFormat = removeDuplicates([ objectValues(dayPeriods.format.narrow), objectValues(dayPeriods.format.abbreviated), objectValues(dayPeriods.format.wide) ]); const dayPeriodsStandalone = removeDuplicates([ objectValues(dayPeriods['stand-alone'].narrow), objectValues(dayPeriods['stand-alone'].abbreviated), objectValues(dayPeriods['stand-alone'].wide) ]); const rules = keys.map(key => dayPeriodRules[key]); dayPeriodsSupplemental = [...removeDuplicates([dayPeriodsFormat, dayPeriodsStandalone]), rules]; } return `${HEADER} const u = undefined; export default ${stringify(dayPeriodsSupplemental).replace(/undefined/g, 'u')}; `; }
[ "function", "generateLocaleExtra", "(", "locale", ",", "localeData", ")", "{", "const", "dayPeriods", "=", "getDayPeriodsNoAmPm", "(", "localeData", ")", ";", "const", "dayPeriodRules", "=", "getDayPeriodRules", "(", "localeData", ")", ";", "let", "dayPeriodsSupplem...
Generate a file that contains extra data (for now: day period rules, and extended day period data)
[ "Generate", "a", "file", "that", "contains", "extra", "data", "(", "for", "now", ":", "day", "period", "rules", "and", "extended", "day", "period", "data", ")" ]
c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c
https://github.com/angular/angular/blob/c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c/tools/gulp-tasks/cldr/extract.js#L122-L157
train
Generate extra information for a locale
[ 30522, 3853, 9699, 4135, 9289, 4402, 18413, 2527, 1006, 2334, 2063, 1010, 2334, 11960, 2696, 1007, 1063, 9530, 3367, 2154, 4842, 3695, 5104, 1027, 2131, 10259, 4842, 3695, 5104, 3630, 16613, 2213, 1006, 2334, 11960, 30524, 2154, 4842, 3695,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
cytoscape/cytoscape.js
dist/cytoscape.esm.js
spring
function spring(tension, friction, duration) { if (duration === 0) { // can't get a spring w/ duration 0 return easings.linear; // duration 0 => jump to end so impl doesn't matter } var spring = generateSpringRK4(tension, friction, duration); return function (start, end, percent) { return start + (end - start) * spring(percent); }; }
javascript
function spring(tension, friction, duration) { if (duration === 0) { // can't get a spring w/ duration 0 return easings.linear; // duration 0 => jump to end so impl doesn't matter } var spring = generateSpringRK4(tension, friction, duration); return function (start, end, percent) { return start + (end - start) * spring(percent); }; }
[ "function", "spring", "(", "tension", ",", "friction", ",", "duration", ")", "{", "if", "(", "duration", "===", "0", ")", "{", "// can't get a spring w/ duration 0", "return", "easings", ".", "linear", ";", "// duration 0 => jump to end so impl doesn't matter", "}", ...
user param easings...
[ "user", "param", "easings", "..." ]
ad2051b65e2243cfd953d8b24a8bf95bfa8559e5
https://github.com/cytoscape/cytoscape.js/blob/ad2051b65e2243cfd953d8b24a8bf95bfa8559e5/dist/cytoscape.esm.js#L12947-L12957
train
Returns a function that will return a spring function that will return a number
[ 30522, 3853, 3500, 1006, 6980, 1010, 15012, 1010, 9367, 1007, 1063, 2065, 1006, 9367, 1027, 1027, 1027, 1014, 1007, 1063, 1013, 1013, 2064, 1005, 1056, 2131, 1037, 3500, 1059, 1013, 9367, 1014, 2709, 24070, 2015, 1012, 7399, 1025, 1013, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
eslint/eslint
lib/rules/no-mixed-operators.js
shouldIgnore
function shouldIgnore(node) { const a = node; const b = node.parent; return ( !includesBothInAGroup(options.groups, a.operator, b.operator) || ( options.allowSamePrecedence && astUtils.getPrecedence(a) === astUtils.getPrecedence(b) ) ); }
javascript
function shouldIgnore(node) { const a = node; const b = node.parent; return ( !includesBothInAGroup(options.groups, a.operator, b.operator) || ( options.allowSamePrecedence && astUtils.getPrecedence(a) === astUtils.getPrecedence(b) ) ); }
[ "function", "shouldIgnore", "(", "node", ")", "{", "const", "a", "=", "node", ";", "const", "b", "=", "node", ".", "parent", ";", "return", "(", "!", "includesBothInAGroup", "(", "options", ".", "groups", ",", "a", ".", "operator", ",", "b", ".", "op...
Checks whether a given node should be ignored by options or not. @param {ASTNode} node - A node to check. This is a BinaryExpression node or a LogicalExpression node. This parent node is one of them, too. @returns {boolean} `true` if the node should be ignored.
[ "Checks", "whether", "a", "given", "node", "should", "be", "ignored", "by", "options", "or", "not", "." ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/no-mixed-operators.js#L119-L130
train
Check if node should be ignored
[ 30522, 3853, 2323, 23773, 5686, 1006, 13045, 1007, 1063, 9530, 3367, 1037, 1027, 13045, 1025, 9530, 3367, 1038, 1027, 13045, 1012, 6687, 1025, 2709, 1006, 999, 2950, 18384, 10606, 8490, 22107, 1006, 7047, 1012, 2967, 1010, 1037, 1012, 6872,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
uber/deck.gl
examples/experimental/bezier/src/bezier-graph-layer.js
layoutGraph
function layoutGraph(graph) { // create a map for referencing node position by node id. const nodePositionMap = graph.nodes.reduce((res, node) => { res[node.id] = node.position; return res; }, {}); // bucket edges between the same source/target node pairs. const nodePairs = graph.edges.reduce((res, edge) => { const nodes = [edge.sourceId, edge.targetId]; // sort the node ids to count the edges with the same pair // but different direction (a -> b or b -> a) const pairId = nodes.sort().toString(); // push this edge into the bucket if (!res[pairId]) { res[pairId] = [edge]; } else { res[pairId].push(edge); } return res; }, {}); // start to create curved edges const unitOffset = 30; const layoutEdges = Object.keys(nodePairs).reduce((res, pairId) => { const edges = nodePairs[pairId]; const curved = edges.length > 1; // curve line is directional, pairId is a list of sorted node ids. const nodeIds = pairId.split(','); const curveSourceId = nodeIds[0]; const curveTargetId = nodeIds[1]; // generate new edges with layout information const newEdges = edges.map((e, idx) => { // curve direction (1 or -1) const direction = idx % 2 ? 1 : -1; // straight line if there's only one edge between this two nodes. const offset = curved ? (1 + Math.floor(idx / 2)) * unitOffset : 0; return { ...e, source: nodePositionMap[e.sourceId], target: nodePositionMap[e.targetId], controlPoint: computeControlPoint( nodePositionMap[curveSourceId], nodePositionMap[curveTargetId], direction, offset ) }; }); return res.concat(newEdges); }, []); return { nodes: graph.nodes, edges: layoutEdges }; }
javascript
function layoutGraph(graph) { // create a map for referencing node position by node id. const nodePositionMap = graph.nodes.reduce((res, node) => { res[node.id] = node.position; return res; }, {}); // bucket edges between the same source/target node pairs. const nodePairs = graph.edges.reduce((res, edge) => { const nodes = [edge.sourceId, edge.targetId]; // sort the node ids to count the edges with the same pair // but different direction (a -> b or b -> a) const pairId = nodes.sort().toString(); // push this edge into the bucket if (!res[pairId]) { res[pairId] = [edge]; } else { res[pairId].push(edge); } return res; }, {}); // start to create curved edges const unitOffset = 30; const layoutEdges = Object.keys(nodePairs).reduce((res, pairId) => { const edges = nodePairs[pairId]; const curved = edges.length > 1; // curve line is directional, pairId is a list of sorted node ids. const nodeIds = pairId.split(','); const curveSourceId = nodeIds[0]; const curveTargetId = nodeIds[1]; // generate new edges with layout information const newEdges = edges.map((e, idx) => { // curve direction (1 or -1) const direction = idx % 2 ? 1 : -1; // straight line if there's only one edge between this two nodes. const offset = curved ? (1 + Math.floor(idx / 2)) * unitOffset : 0; return { ...e, source: nodePositionMap[e.sourceId], target: nodePositionMap[e.targetId], controlPoint: computeControlPoint( nodePositionMap[curveSourceId], nodePositionMap[curveTargetId], direction, offset ) }; }); return res.concat(newEdges); }, []); return { nodes: graph.nodes, edges: layoutEdges }; }
[ "function", "layoutGraph", "(", "graph", ")", "{", "// create a map for referencing node position by node id.", "const", "nodePositionMap", "=", "graph", ".", "nodes", ".", "reduce", "(", "(", "res", ",", "node", ")", "=>", "{", "res", "[", "node", ".", "id", ...
A helper function to generate a graph with curved edges. @param {Object} graph - {nodes: [], edges: []} expected input format: { nodes: [{id: 'a', position: [0, -100]}, {id: 'b', position: [0, 100]}, ...], edges: [{id: '1', sourceId: 'a',, targetId: 'b',}, ...] } @return {Object} Return new graph with curved edges. expected output format: { nodes: [{id: 'a', position: [0, -100]}, {id: 'b', position: [0, 100]}, ...], edges: [{id: '1', sourceId: 'a', source: [0, -100], targetId: 'b', target: [0, 100], controlPoint: [50, 0]}, ...] }
[ "A", "helper", "function", "to", "generate", "a", "graph", "with", "curved", "edges", "." ]
a2010448b7f268bbd03617b812334c68a6b9e5b2
https://github.com/uber/deck.gl/blob/a2010448b7f268bbd03617b812334c68a6b9e5b2/examples/experimental/bezier/src/bezier-graph-layer.js#L80-L133
train
Layouts the graph.
[ 30522, 3853, 9621, 14413, 1006, 10629, 1007, 1063, 1013, 1013, 3443, 1037, 4949, 2005, 28789, 13045, 2597, 2011, 13045, 8909, 1012, 9530, 3367, 13045, 26994, 2863, 2361, 1027, 10629, 1012, 14164, 1012, 5547, 1006, 1006, 24501, 1010, 13045, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
angular/material
src/components/radioButton/radio-button.js
mdRadioButtonDirective
function mdRadioButtonDirective($mdAria, $mdUtil, $mdTheming) { var CHECKED_CSS = 'md-checked'; return { restrict: 'E', require: '^mdRadioGroup', transclude: true, template: '<div class="md-container" md-ink-ripple md-ink-ripple-checkbox>' + '<div class="md-off"></div>' + '<div class="md-on"></div>' + '</div>' + '<div ng-transclude class="md-label"></div>', link: link }; function link(scope, element, attr, rgCtrl) { var lastChecked; $mdTheming(element); configureAria(element, scope); // ngAria overwrites the aria-checked inside a $watch for ngValue. // We should defer the initialization until all the watches have fired. // This can also be fixed by removing the `lastChecked` check, but that'll // cause more DOM manipulation on each digest. if (attr.ngValue) { $mdUtil.nextTick(initialize, false); } else { initialize(); } /** * Initializes the component. */ function initialize() { if (!rgCtrl) { throw 'RadioButton: No RadioGroupController could be found.'; } rgCtrl.add(render); attr.$observe('value', render); element .on('click', listener) .on('$destroy', function() { rgCtrl.remove(render); }); } /** * On click functionality. */ function listener(ev) { if (element[0].hasAttribute('disabled') || rgCtrl.isDisabled()) return; scope.$apply(function() { rgCtrl.setViewValue(attr.value, ev && ev.type); }); } /** * Add or remove the `.md-checked` class from the RadioButton (and conditionally its parent). * Update the `aria-activedescendant` attribute. */ function render() { var checked = rgCtrl.getViewValue() == attr.value; if (checked === lastChecked) return; if (element[0].parentNode.nodeName.toLowerCase() !== 'md-radio-group') { // If the radioButton is inside a div, then add class so highlighting will work element.parent().toggleClass(CHECKED_CSS, checked); } if (checked) { rgCtrl.setActiveDescendant(element.attr('id')); } lastChecked = checked; element .attr('aria-checked', checked) .toggleClass(CHECKED_CSS, checked); } /** * Inject ARIA-specific attributes appropriate for each radio button */ function configureAria(element, scope){ element.attr({ id: attr.id || 'radio_' + $mdUtil.nextUid(), role: 'radio', 'aria-checked': 'false' }); $mdAria.expectWithText(element, 'aria-label'); } } }
javascript
function mdRadioButtonDirective($mdAria, $mdUtil, $mdTheming) { var CHECKED_CSS = 'md-checked'; return { restrict: 'E', require: '^mdRadioGroup', transclude: true, template: '<div class="md-container" md-ink-ripple md-ink-ripple-checkbox>' + '<div class="md-off"></div>' + '<div class="md-on"></div>' + '</div>' + '<div ng-transclude class="md-label"></div>', link: link }; function link(scope, element, attr, rgCtrl) { var lastChecked; $mdTheming(element); configureAria(element, scope); // ngAria overwrites the aria-checked inside a $watch for ngValue. // We should defer the initialization until all the watches have fired. // This can also be fixed by removing the `lastChecked` check, but that'll // cause more DOM manipulation on each digest. if (attr.ngValue) { $mdUtil.nextTick(initialize, false); } else { initialize(); } /** * Initializes the component. */ function initialize() { if (!rgCtrl) { throw 'RadioButton: No RadioGroupController could be found.'; } rgCtrl.add(render); attr.$observe('value', render); element .on('click', listener) .on('$destroy', function() { rgCtrl.remove(render); }); } /** * On click functionality. */ function listener(ev) { if (element[0].hasAttribute('disabled') || rgCtrl.isDisabled()) return; scope.$apply(function() { rgCtrl.setViewValue(attr.value, ev && ev.type); }); } /** * Add or remove the `.md-checked` class from the RadioButton (and conditionally its parent). * Update the `aria-activedescendant` attribute. */ function render() { var checked = rgCtrl.getViewValue() == attr.value; if (checked === lastChecked) return; if (element[0].parentNode.nodeName.toLowerCase() !== 'md-radio-group') { // If the radioButton is inside a div, then add class so highlighting will work element.parent().toggleClass(CHECKED_CSS, checked); } if (checked) { rgCtrl.setActiveDescendant(element.attr('id')); } lastChecked = checked; element .attr('aria-checked', checked) .toggleClass(CHECKED_CSS, checked); } /** * Inject ARIA-specific attributes appropriate for each radio button */ function configureAria(element, scope){ element.attr({ id: attr.id || 'radio_' + $mdUtil.nextUid(), role: 'radio', 'aria-checked': 'false' }); $mdAria.expectWithText(element, 'aria-label'); } } }
[ "function", "mdRadioButtonDirective", "(", "$mdAria", ",", "$mdUtil", ",", "$mdTheming", ")", "{", "var", "CHECKED_CSS", "=", "'md-checked'", ";", "return", "{", "restrict", ":", "'E'", ",", "require", ":", "'^mdRadioGroup'", ",", "transclude", ":", "true", ",...
@ngdoc directive @module material.components.radioButton @name mdRadioButton @restrict E @description The `<md-radio-button>`directive is the child directive required to be used within `<md-radio-group>` elements. While similar to the `<input type="radio" ng-model="" value="">` directive, the `<md-radio-button>` directive provides ink effects, ARIA support, and supports use within named radio groups. One of `value` or `ng-value` must be set so that the `md-radio-group`'s model is set properly when the `md-radio-button` is selected. @param {string} value The value to which the model should be set when selected. @param {string} ng-value AngularJS expression which sets the value to which the model should be set when selected. @param {string=} name Property name of the form under which the control is published. @param {string=} aria-label Adds label to radio button for accessibility. Defaults to radio button's text. If no text content is available, a warning will be logged. @usage <hljs lang="html"> <md-radio-button value="1" aria-label="Label 1"> Label 1 </md-radio-button> <md-radio-button ng-value="specialValue" aria-label="Green"> Green </md-radio-button> </hljs>
[ "@ngdoc", "directive", "@module", "material", ".", "components", ".", "radioButton", "@name", "mdRadioButton" ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/radioButton/radio-button.js#L246-L345
train
A directive that can be used to create a radio button.
[ 30522, 3853, 9108, 12173, 3695, 8569, 15474, 4305, 2890, 15277, 1006, 1002, 9108, 10980, 1010, 1002, 9108, 30524, 2709, 1063, 21573, 1024, 1005, 1041, 1005, 1010, 5478, 1024, 1005, 1034, 9108, 12173, 3695, 17058, 1005, 1010, 9099, 20464, 12...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.fl/src/sap/ui/fl/Utils.js
function (vControl, oAppComponent, bSuppressLogging) { if (!oAppComponent) { vControl = vControl instanceof ManagedObject ? vControl : sap.ui.getCore().byId(vControl); oAppComponent = Utils.getAppComponentForControl(vControl); } return BaseTreeModifier.checkControlId(vControl, oAppComponent, bSuppressLogging); }
javascript
function (vControl, oAppComponent, bSuppressLogging) { if (!oAppComponent) { vControl = vControl instanceof ManagedObject ? vControl : sap.ui.getCore().byId(vControl); oAppComponent = Utils.getAppComponentForControl(vControl); } return BaseTreeModifier.checkControlId(vControl, oAppComponent, bSuppressLogging); }
[ "function", "(", "vControl", ",", "oAppComponent", ",", "bSuppressLogging", ")", "{", "if", "(", "!", "oAppComponent", ")", "{", "vControl", "=", "vControl", "instanceof", "ManagedObject", "?", "vControl", ":", "sap", ".", "ui", ".", "getCore", "(", ")", "...
See {@link sap.ui.core.BaseTreeModifier#checkControlId} method
[ "See", "{" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/Utils.js#L850-L856
train
Checks if the control is a child of an app component
[ 30522, 3853, 1006, 18315, 12162, 13153, 1010, 1051, 29098, 9006, 29513, 3372, 1010, 18667, 6279, 20110, 21197, 4726, 1007, 1063, 2065, 1006, 999, 1051, 29098, 9006, 29513, 3372, 1007, 1063, 18315, 12162, 13153, 1027, 18315, 12162, 13153, 6013...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/a-register-element.js
wrapMethod
function wrapMethod (obj, methodName, derivedObj, baseObj) { var derivedMethod = derivedObj[methodName]; var baseMethod = baseObj[methodName]; // Derived prototype does not define method, no need to wrap. if (!derivedMethod || !baseMethod) { return; } // Derived prototype doesn't override the one in the base one, no need to wrap. if (derivedMethod === baseMethod) { return; } // Wrap to ensure the base method is called before the one in the derived prototype. obj[methodName] = { value: function wrappedMethod () { baseMethod.apply(this, arguments); return derivedMethod.apply(this, arguments); }, writable: window.debug }; }
javascript
function wrapMethod (obj, methodName, derivedObj, baseObj) { var derivedMethod = derivedObj[methodName]; var baseMethod = baseObj[methodName]; // Derived prototype does not define method, no need to wrap. if (!derivedMethod || !baseMethod) { return; } // Derived prototype doesn't override the one in the base one, no need to wrap. if (derivedMethod === baseMethod) { return; } // Wrap to ensure the base method is called before the one in the derived prototype. obj[methodName] = { value: function wrappedMethod () { baseMethod.apply(this, arguments); return derivedMethod.apply(this, arguments); }, writable: window.debug }; }
[ "function", "wrapMethod", "(", "obj", ",", "methodName", ",", "derivedObj", ",", "baseObj", ")", "{", "var", "derivedMethod", "=", "derivedObj", "[", "methodName", "]", ";", "var", "baseMethod", "=", "baseObj", "[", "methodName", "]", ";", "// Derived prototyp...
Wrap one method to ensure that the one in the base prototype is called before the one in the derived one. @param {object} obj - Object that will contain the wrapped method. @param {string} methodName - The name of the method that will be wrapped. @param {object} derivedObject - Object that inherits from the baseObj. @param {object} baseObj - Object that derivedObj inherits from.
[ "Wrap", "one", "method", "to", "ensure", "that", "the", "one", "in", "the", "base", "prototype", "is", "called", "before", "the", "one", "in", "the", "derived", "one", "." ]
24acc78a7299a4cdfe3ef617f4d40ddf6275c992
https://github.com/aframevr/aframe/blob/24acc78a7299a4cdfe3ef617f4d40ddf6275c992/src/core/a-register-element.js#L146-L164
train
Wrap a method in the derived prototype
[ 30522, 3853, 10236, 11368, 6806, 2094, 1006, 27885, 3501, 1010, 4118, 18442, 1010, 5173, 16429, 3501, 1010, 2918, 16429, 3501, 1007, 1063, 30524, 1013, 5173, 8773, 2515, 2025, 9375, 4118, 1010, 2053, 2342, 2000, 10236, 1012, 2065, 1006, 999...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
LLK/scratch-blocks
blocks_vertical/motion.js
function() { this.jsonInit({ "message0": "%1", "args0": [ { "type": "field_dropdown", "name": "TO", "options": [ [Blockly.Msg.MOTION_GOTO_POINTER, '_mouse_'], [Blockly.Msg.MOTION_GOTO_RANDOM, '_random_'] ] } ], "colour": Blockly.Colours.motion.secondary, "colourSecondary": Blockly.Colours.motion.secondary, "colourTertiary": Blockly.Colours.motion.tertiary, "extensions": ["output_string"] }); }
javascript
function() { this.jsonInit({ "message0": "%1", "args0": [ { "type": "field_dropdown", "name": "TO", "options": [ [Blockly.Msg.MOTION_GOTO_POINTER, '_mouse_'], [Blockly.Msg.MOTION_GOTO_RANDOM, '_random_'] ] } ], "colour": Blockly.Colours.motion.secondary, "colourSecondary": Blockly.Colours.motion.secondary, "colourTertiary": Blockly.Colours.motion.tertiary, "extensions": ["output_string"] }); }
[ "function", "(", ")", "{", "this", ".", "jsonInit", "(", "{", "\"message0\"", ":", "\"%1\"", ",", "\"args0\"", ":", "[", "{", "\"type\"", ":", "\"field_dropdown\"", ",", "\"name\"", ":", "\"TO\"", ",", "\"options\"", ":", "[", "[", "Blockly", ".", "Msg",...
Go to drop-down menu. @this Blockly.Block
[ "Go", "to", "drop", "-", "down", "menu", "." ]
455b2a854435c0a67da1da92320ddc3ec3e2b799
https://github.com/LLK/scratch-blocks/blob/455b2a854435c0a67da1da92320ddc3ec3e2b799/blocks_vertical/motion.js#L174-L192
train
Block for .
[ 30522, 3853, 1006, 1007, 1063, 2023, 1012, 1046, 3385, 5498, 2102, 1006, 1063, 1000, 4471, 2692, 1000, 1024, 1000, 1003, 1015, 1000, 1010, 1000, 12098, 5620, 2692, 1000, 1024, 1031, 1063, 1000, 2828, 1000, 1024, 1000, 2492, 1035, 4530, 76...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
uber/deck.gl
modules/layers/src/icon-layer/icon-manager.js
buildRowMapping
function buildRowMapping(mapping, columns, yOffset) { for (let i = 0; i < columns.length; i++) { const {icon, xOffset} = columns[i]; const id = getIconId(icon); mapping[id] = Object.assign({}, icon, { x: xOffset, y: yOffset }); } }
javascript
function buildRowMapping(mapping, columns, yOffset) { for (let i = 0; i < columns.length; i++) { const {icon, xOffset} = columns[i]; const id = getIconId(icon); mapping[id] = Object.assign({}, icon, { x: xOffset, y: yOffset }); } }
[ "function", "buildRowMapping", "(", "mapping", ",", "columns", ",", "yOffset", ")", "{", "for", "(", "let", "i", "=", "0", ";", "i", "<", "columns", ".", "length", ";", "i", "++", ")", "{", "const", "{", "icon", ",", "xOffset", "}", "=", "columns",...
traverse icons in a row of icon atlas extend each icon with left-top coordinates
[ "traverse", "icons", "in", "a", "row", "of", "icon", "atlas", "extend", "each", "icon", "with", "left", "-", "top", "coordinates" ]
a2010448b7f268bbd03617b812334c68a6b9e5b2
https://github.com/uber/deck.gl/blob/a2010448b7f268bbd03617b812334c68a6b9e5b2/modules/layers/src/icon-layer/icon-manager.js#L46-L55
train
Build a row mapping from a list of icons
[ 30522, 3853, 3857, 10524, 2863, 14853, 1006, 12375, 1010, 7753, 1010, 10930, 21807, 3388, 1007, 1063, 2005, 1006, 2292, 1045, 1027, 1014, 1025, 1045, 1026, 7753, 1012, 3091, 1025, 1045, 1009, 1009, 1007, 1063, 9530, 3367, 1063, 12696, 1010,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/extensions/default/JavaScriptCodeHints/main.js
setCachedHintContext
function setCachedHintContext(hints, cursor, type, token) { cachedHints = hints; cachedCursor = cursor; cachedType = type; cachedToken = token; }
javascript
function setCachedHintContext(hints, cursor, type, token) { cachedHints = hints; cachedCursor = cursor; cachedType = type; cachedToken = token; }
[ "function", "setCachedHintContext", "(", "hints", ",", "cursor", ",", "type", ",", "token", ")", "{", "cachedHints", "=", "hints", ";", "cachedCursor", "=", "cursor", ";", "cachedType", "=", "type", ";", "cachedToken", "=", "token", ";", "}" ]
Cache the hints and the hint's context. @param {Array.<string>} hints - array of hints @param {{line:number, ch:number}} cursor - the location where the hints were created. @param {{property: boolean, showFunctionType:boolean, context: string, functionCallPos: {line:number, ch:number}}} type - type information about the hints @param {Object} token - CodeMirror token
[ "Cache", "the", "hints", "and", "the", "hint", "s", "context", "." ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/JavaScriptCodeHints/main.js#L325-L330
train
Sets the context for the hint cache
[ 30522, 3853, 2275, 3540, 7690, 10606, 13535, 28040, 18413, 1006, 20385, 1010, 12731, 25301, 2099, 1010, 2828, 1010, 19204, 1007, 1063, 17053, 19114, 7666, 1027, 20385, 1025, 17053, 16409, 9236, 2953, 1027, 12731, 25301, 2099, 1025, 17053, 119...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
cytoscape/cytoscape.js
dist/cytoscape.esm.js
matches
function matches(query, ele) { return query.checks.every(function (chk) { return match[chk.type](chk, ele); }); }
javascript
function matches(query, ele) { return query.checks.every(function (chk) { return match[chk.type](chk, ele); }); }
[ "function", "matches", "(", "query", ",", "ele", ")", "{", "return", "query", ".", "checks", ".", "every", "(", "function", "(", "chk", ")", "{", "return", "match", "[", "chk", ".", "type", "]", "(", "chk", ",", "ele", ")", ";", "}", ")", ";", ...
Returns whether the query matches for the element @param query The `{ type, value, ... }` query object @param ele The element to compare against
[ "Returns", "whether", "the", "query", "matches", "for", "the", "element" ]
ad2051b65e2243cfd953d8b24a8bf95bfa8559e5
https://github.com/cytoscape/cytoscape.js/blob/ad2051b65e2243cfd953d8b24a8bf95bfa8559e5/dist/cytoscape.esm.js#L7460-L7464
train
Check if the element matches the query
[ 30522, 3853, 3503, 1006, 23032, 1010, 3449, 2063, 1007, 1063, 2709, 23032, 1012, 14148, 1012, 2296, 1006, 3853, 1006, 10381, 2243, 1007, 1063, 2709, 2674, 1031, 10381, 2243, 1012, 2828, 1033, 1006, 10381, 2243, 1010, 3449, 2063, 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...
pixijs/pixi.js
packages/prepare/src/BasePrepare.js
findBaseTexture
function findBaseTexture(item, queue) { // Objects with textures, like Sprites/Text if (item instanceof BaseTexture) { if (queue.indexOf(item) === -1) { queue.push(item); } return true; } return false; }
javascript
function findBaseTexture(item, queue) { // Objects with textures, like Sprites/Text if (item instanceof BaseTexture) { if (queue.indexOf(item) === -1) { queue.push(item); } return true; } return false; }
[ "function", "findBaseTexture", "(", "item", ",", "queue", ")", "{", "// Objects with textures, like Sprites/Text", "if", "(", "item", "instanceof", "BaseTexture", ")", "{", "if", "(", "queue", ".", "indexOf", "(", "item", ")", "===", "-", "1", ")", "{", "que...
Built-in hook to find BaseTextures from Sprites. @private @param {PIXI.DisplayObject} item - Display object to check @param {Array<*>} queue - Collection of items to upload @return {boolean} if a PIXI.Texture object was found.
[ "Built", "-", "in", "hook", "to", "find", "BaseTextures", "from", "Sprites", "." ]
99ae03b7565ae7ca5a6de633b0a277f7128fa4d0
https://github.com/pixijs/pixi.js/blob/99ae03b7565ae7ca5a6de633b0a277f7128fa4d0/packages/prepare/src/BasePrepare.js#L356-L370
train
Find BaseTexture in the queue
[ 30522, 3853, 2424, 15058, 18209, 5397, 1006, 8875, 1010, 24240, 1007, 1063, 1013, 1013, 5200, 2007, 29343, 1010, 2066, 11867, 28884, 1013, 3793, 2065, 1006, 8875, 6013, 11253, 2918, 18209, 5397, 1007, 1063, 2065, 1006, 24240, 1012, 5950, 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...